Type/field handling overhaul

This changes the way item types, item fields, creator types, and CSL
mappings are defined and handled, in preparation for updated types and
fields.

Instead of being predefined in SQL files or code, type/field info is
read from a bundled JSON file shared with other parts of the Zotero
ecosystem [1], referred to as the "global schema". Updates to the
bundled schema file are automatically applied to the database at first
run, allowing changes to be made consistently across apps.

When syncing, invalid JSON properties are now rejected instead of being
ignored and processed later, which will allow for schema changes to be
made without causing problems in existing clients. We considered many
alternative approaches, but this approach is by far the simplest,
safest, and most transparent to the user.

For now, there are no actual changes to types and fields, since we'll
first need to do a sync cut-off for earlier versions that don't reject
invalid properties.

For third-party code, the main change is that type and field IDs should
no longer be hard-coded, since they may not be consistent in new
installs. For example, code should use `Zotero.ItemTypes.getID('note')`
instead of hard-coding `1`.

[1] https://github.com/zotero/zotero-schema
This commit is contained in:
Dan Stillman 2019-05-16 04:56:46 -04:00
parent 725e6e779e
commit 4b60c6ca27
42 changed files with 1470 additions and 1505 deletions

View file

@ -62,7 +62,11 @@ const browserifyConfigs = [
];
// exclude mask used for js, copy, symlink and sass tasks
const ignoreMask = ['**/#*', '**/_*.scss'];
const ignoreMask = [
'**/#*',
'**/_*.scss',
'resource/schema/global/schema.json.gz'
];
const jsFiles = [
`{${dirs.join(',')}}/**/*.js`,