@manuscripts/transform 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/jats/importer/jats-parser-utils.js +2 -2
- package/dist/cjs/jats/jats-exporter.js +16 -16
- package/dist/cjs/schema/nodes/blockquote_element.js +2 -2
- package/dist/cjs/schema/nodes/equation.js +3 -3
- package/dist/cjs/schema/nodes/inline_equation.js +3 -3
- package/dist/cjs/schema/nodes/list.js +3 -3
- package/dist/cjs/schema/nodes/listing.js +3 -3
- package/dist/cjs/schema/nodes/paragraph.js +2 -2
- package/dist/cjs/schema/nodes/pullquote_element.js +2 -2
- package/dist/cjs/transformer/builders.js +73 -73
- package/dist/cjs/transformer/decode.js +25 -25
- package/dist/cjs/transformer/document-object-types.js +11 -11
- package/dist/cjs/transformer/html.js +2 -2
- package/dist/cjs/transformer/index.js +0 -1
- package/dist/cjs/transformer/labels.js +1 -2
- package/dist/cjs/transformer/manuscript-dependencies.js +3 -3
- package/dist/cjs/transformer/node-types.js +33 -33
- package/dist/cjs/transformer/object-types.js +23 -23
- package/dist/cjs/transformer/project-bundle.js +4 -4
- package/dist/cjs/transformer/section-category.js +5 -5
- package/dist/es/jats/importer/jats-parser-utils.js +1 -1
- package/dist/es/jats/jats-exporter.js +1 -1
- package/dist/es/schema/nodes/blockquote_element.js +1 -1
- package/dist/es/schema/nodes/equation.js +1 -1
- package/dist/es/schema/nodes/inline_equation.js +1 -1
- package/dist/es/schema/nodes/list.js +1 -1
- package/dist/es/schema/nodes/listing.js +1 -1
- package/dist/es/schema/nodes/paragraph.js +1 -1
- package/dist/es/schema/nodes/pullquote_element.js +1 -1
- package/dist/es/transformer/builders.js +1 -1
- package/dist/es/transformer/decode.js +1 -1
- package/dist/es/transformer/document-object-types.js +1 -1
- package/dist/es/transformer/html.js +1 -1
- package/dist/es/transformer/index.js +0 -1
- package/dist/es/transformer/labels.js +1 -2
- package/dist/es/transformer/manuscript-dependencies.js +1 -1
- package/dist/es/transformer/node-types.js +1 -1
- package/dist/es/transformer/object-types.js +1 -1
- package/dist/es/transformer/project-bundle.js +1 -1
- package/dist/es/transformer/section-category.js +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -1
- package/dist/types/jats/importer/jats-comments.d.ts +1 -1
- package/dist/types/jats/importer/jats-front-parser.d.ts +6 -6
- package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -1
- package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -2
- package/dist/types/jats/importer/parse-jats-article.d.ts +2 -2
- package/dist/types/jats/jats-exporter.d.ts +1 -1
- package/dist/types/lib/styled-content.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +1 -1
- package/dist/types/transformer/bundles-data.d.ts +1 -1
- package/dist/types/transformer/bundles.d.ts +1 -1
- package/dist/types/transformer/decode.d.ts +1 -1
- package/dist/types/transformer/document-object-types.d.ts +1 -1
- package/dist/types/transformer/encode.d.ts +1 -1
- package/dist/types/transformer/footnotes-order.d.ts +1 -1
- package/dist/types/transformer/highlight-markers.d.ts +1 -1
- package/dist/types/transformer/html.d.ts +1 -1
- package/dist/types/transformer/id.d.ts +1 -1
- package/dist/types/transformer/index.d.ts +0 -1
- package/dist/types/transformer/labels.d.ts +1 -1
- package/dist/types/transformer/manuscript-dependencies.d.ts +1 -1
- package/dist/types/transformer/model-map.d.ts +1 -1
- package/dist/types/transformer/models.d.ts +1 -1
- package/dist/types/transformer/node-types.d.ts +1 -1
- package/dist/types/transformer/object-types.d.ts +1 -1
- package/dist/types/transformer/project-bundle.d.ts +1 -1
- package/dist/types/transformer/section-category.d.ts +1 -1
- package/dist/types/transformer/shared-data.d.ts +1 -1
- package/dist/types/transformer/update-identifiers.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/transformer/tei-grobid-importer.js +0 -121
- package/dist/es/transformer/tei-grobid-importer.js +0 -115
- package/dist/types/transformer/tei-grobid-importer.d.ts +0 -20
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.htmlFromJatsNode = exports.fixBodyPMNode = exports.flatten = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const transformer_1 = require("../../transformer");
|
|
21
|
-
const isAuxiliaryObjectReference = (0, transformer_1.hasObjectType)(
|
|
21
|
+
const isAuxiliaryObjectReference = (0, transformer_1.hasObjectType)(json_schema_1.ObjectTypes.AuxiliaryObjectReference);
|
|
22
22
|
function flatten(arrays) {
|
|
23
23
|
return [].concat(...arrays);
|
|
24
24
|
}
|
|
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.JATSExporter = exports.createCounter = void 0;
|
|
22
|
-
const
|
|
22
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
23
23
|
const debug_1 = __importDefault(require("debug"));
|
|
24
24
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
25
25
|
const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
|
|
@@ -45,7 +45,7 @@ const findChildNodeOfType = (node, nodeType) => {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
const isContributor = (0, object_types_1.hasObjectType)(
|
|
48
|
+
const isContributor = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Contributor);
|
|
49
49
|
const CREDIT_VOCAB_IDENTIFIER = 'https://dictionary.casrai.org/Contributor_Roles';
|
|
50
50
|
const chooseRoleVocabAttributes = (role) => {
|
|
51
51
|
if (role.uri && role.uri.startsWith(CREDIT_VOCAB_IDENTIFIER)) {
|
|
@@ -99,18 +99,18 @@ const createDefaultIdGenerator = () => {
|
|
|
99
99
|
};
|
|
100
100
|
const chooseRefType = (objectType) => {
|
|
101
101
|
switch (objectType) {
|
|
102
|
-
case
|
|
103
|
-
case
|
|
102
|
+
case json_schema_1.ObjectTypes.Figure:
|
|
103
|
+
case json_schema_1.ObjectTypes.FigureElement:
|
|
104
104
|
return 'fig';
|
|
105
|
-
case
|
|
105
|
+
case json_schema_1.ObjectTypes.Footnote:
|
|
106
106
|
return 'fn';
|
|
107
|
-
case
|
|
108
|
-
case
|
|
107
|
+
case json_schema_1.ObjectTypes.Table:
|
|
108
|
+
case json_schema_1.ObjectTypes.TableElement:
|
|
109
109
|
return 'table';
|
|
110
|
-
case
|
|
110
|
+
case json_schema_1.ObjectTypes.Section:
|
|
111
111
|
return 'sec';
|
|
112
|
-
case
|
|
113
|
-
case
|
|
112
|
+
case json_schema_1.ObjectTypes.Equation:
|
|
113
|
+
case json_schema_1.ObjectTypes.EquationElement:
|
|
114
114
|
return 'disp-formula';
|
|
115
115
|
}
|
|
116
116
|
};
|
|
@@ -240,7 +240,7 @@ class JATSExporter {
|
|
|
240
240
|
front.appendChild(journalMeta);
|
|
241
241
|
const articleMeta = this.document.createElement('article-meta');
|
|
242
242
|
front.appendChild(articleMeta);
|
|
243
|
-
const journal = [...this.modelMap.values()].find((model) => model.objectType ===
|
|
243
|
+
const journal = [...this.modelMap.values()].find((model) => model.objectType === json_schema_1.ObjectTypes.Journal);
|
|
244
244
|
if (journal) {
|
|
245
245
|
if (journal.journalIdentifiers) {
|
|
246
246
|
for (const item of journal.journalIdentifiers) {
|
|
@@ -351,7 +351,7 @@ class JATSExporter {
|
|
|
351
351
|
this.setTitleContent(element, manuscript.runningTitle);
|
|
352
352
|
titleGroup.appendChild(element);
|
|
353
353
|
}
|
|
354
|
-
const supplements = [...this.modelMap.values()].filter((model) => model.objectType ===
|
|
354
|
+
const supplements = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Supplement);
|
|
355
355
|
if (supplements && supplements.length > 0) {
|
|
356
356
|
for (const supplement of supplements) {
|
|
357
357
|
const supplementaryMaterial = this.document.createElement('supplementary-material');
|
|
@@ -481,7 +481,7 @@ class JATSExporter {
|
|
|
481
481
|
refList = this.document.createElement('ref-list');
|
|
482
482
|
}
|
|
483
483
|
back.appendChild(refList);
|
|
484
|
-
const bibliographyItems = this.models.filter((0, object_types_1.hasObjectType)(
|
|
484
|
+
const bibliographyItems = this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.BibliographyItem));
|
|
485
485
|
for (const bibliographyItem of bibliographyItems) {
|
|
486
486
|
const ref = this.document.createElement('ref');
|
|
487
487
|
ref.setAttribute('id', normalizeID(bibliographyItem._id));
|
|
@@ -1182,7 +1182,7 @@ class JATSExporter {
|
|
|
1182
1182
|
affiliationRIDs.push(...contributor.affiliations);
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
|
-
const affiliations = this.models.filter((0, object_types_1.hasObjectType)(
|
|
1185
|
+
const affiliations = this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Affiliation));
|
|
1186
1186
|
if (affiliations) {
|
|
1187
1187
|
const usedAffiliations = affiliations.filter((affiliation) => affiliationRIDs.includes(affiliation._id));
|
|
1188
1188
|
usedAffiliations.sort((a, b) => affiliationRIDs.indexOf(a._id) - affiliationRIDs.indexOf(b._id));
|
|
@@ -1257,9 +1257,9 @@ class JATSExporter {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
1259
|
const footnotes = [];
|
|
1260
|
-
footnotes.push(...this.models.filter((0, object_types_1.hasObjectType)(
|
|
1260
|
+
footnotes.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote)));
|
|
1261
1261
|
const correspodings = [];
|
|
1262
|
-
correspodings.push(...this.models.filter((0, object_types_1.hasObjectType)(
|
|
1262
|
+
correspodings.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Corresponding)));
|
|
1263
1263
|
if (footnotes || correspodings) {
|
|
1264
1264
|
const authorNotesEl = this.document.createElement('author-notes');
|
|
1265
1265
|
const usedFootnotes = footnotes.filter((footnote) => {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isBlockquoteElement = exports.blockquoteElement = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const attributes_1 = require("../../lib/attributes");
|
|
21
21
|
exports.blockquoteElement = {
|
|
22
22
|
content: 'paragraph+ attribution',
|
|
@@ -51,7 +51,7 @@ exports.blockquoteElement = {
|
|
|
51
51
|
attrs.id = blockquoteElementNode.attrs.id;
|
|
52
52
|
}
|
|
53
53
|
attrs.class = (0, attributes_1.buildElementClass)(blockquoteElementNode.attrs);
|
|
54
|
-
attrs['data-object-type'] =
|
|
54
|
+
attrs['data-object-type'] = json_schema_1.ObjectTypes.QuoteElement;
|
|
55
55
|
if (blockquoteElementNode.attrs.placeholder) {
|
|
56
56
|
attrs['data-placeholder-text'] = blockquoteElementNode.attrs.placeholder;
|
|
57
57
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.equation = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
exports.equation = {
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
@@ -28,7 +28,7 @@ exports.equation = {
|
|
|
28
28
|
group: 'block',
|
|
29
29
|
parseDOM: [
|
|
30
30
|
{
|
|
31
|
-
tag: `div.${
|
|
31
|
+
tag: `div.${json_schema_1.ObjectTypes.Equation}`,
|
|
32
32
|
getAttrs: (p) => {
|
|
33
33
|
const dom = p;
|
|
34
34
|
return {
|
|
@@ -44,7 +44,7 @@ exports.equation = {
|
|
|
44
44
|
const equationNode = node;
|
|
45
45
|
const dom = document.createElement('div');
|
|
46
46
|
dom.setAttribute('id', equationNode.attrs.id);
|
|
47
|
-
dom.classList.add(
|
|
47
|
+
dom.classList.add(json_schema_1.ObjectTypes.Equation);
|
|
48
48
|
if (equationNode.attrs.MathMLStringRepresentation) {
|
|
49
49
|
dom.setAttribute('data-mathml-string-representation', equationNode.attrs.MathMLStringRepresentation);
|
|
50
50
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.inlineEquation = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
exports.inlineEquation = {
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
@@ -31,7 +31,7 @@ exports.inlineEquation = {
|
|
|
31
31
|
group: 'inline',
|
|
32
32
|
parseDOM: [
|
|
33
33
|
{
|
|
34
|
-
tag: `span.${
|
|
34
|
+
tag: `span.${json_schema_1.ObjectTypes.InlineMathFragment}`,
|
|
35
35
|
getAttrs: (p) => {
|
|
36
36
|
const dom = p;
|
|
37
37
|
return {
|
|
@@ -46,7 +46,7 @@ exports.inlineEquation = {
|
|
|
46
46
|
toDOM: (node) => {
|
|
47
47
|
const inlineEquationNode = node;
|
|
48
48
|
const dom = document.createElement('span');
|
|
49
|
-
dom.classList.add(
|
|
49
|
+
dom.classList.add(json_schema_1.ObjectTypes.InlineMathFragment);
|
|
50
50
|
dom.setAttribute('id', inlineEquationNode.attrs.id);
|
|
51
51
|
dom.setAttribute('data-tex-representation', inlineEquationNode.attrs.TeXRepresentation);
|
|
52
52
|
if (inlineEquationNode.attrs.MathMLRepresentation) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isListNode = exports.listItem = exports.orderedList = exports.bulletList = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const attributes_1 = require("../../lib/attributes");
|
|
21
21
|
exports.bulletList = {
|
|
22
22
|
content: 'list_item+',
|
|
@@ -45,7 +45,7 @@ exports.bulletList = {
|
|
|
45
45
|
{
|
|
46
46
|
id: bulletListNode.attrs.id,
|
|
47
47
|
class: (0, attributes_1.buildElementClass)(bulletListNode.attrs),
|
|
48
|
-
'data-object-type':
|
|
48
|
+
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
49
49
|
},
|
|
50
50
|
0,
|
|
51
51
|
]
|
|
@@ -79,7 +79,7 @@ exports.orderedList = {
|
|
|
79
79
|
{
|
|
80
80
|
id: orderedListNode.attrs.id,
|
|
81
81
|
class: (0, attributes_1.buildElementClass)(orderedListNode.attrs),
|
|
82
|
-
'data-object-type':
|
|
82
|
+
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
83
83
|
},
|
|
84
84
|
0,
|
|
85
85
|
]
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isListingNode = exports.listing = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
exports.listing = {
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
@@ -33,7 +33,7 @@ exports.listing = {
|
|
|
33
33
|
group: 'block',
|
|
34
34
|
parseDOM: [
|
|
35
35
|
{
|
|
36
|
-
tag: `pre.${
|
|
36
|
+
tag: `pre.${json_schema_1.ObjectTypes.Listing}`,
|
|
37
37
|
preserveWhitespace: 'full',
|
|
38
38
|
getAttrs: (p) => {
|
|
39
39
|
const node = p;
|
|
@@ -62,7 +62,7 @@ exports.listing = {
|
|
|
62
62
|
const listingNode = node;
|
|
63
63
|
const dom = document.createElement('div');
|
|
64
64
|
dom.setAttribute('id', listingNode.attrs.id);
|
|
65
|
-
dom.classList.add(
|
|
65
|
+
dom.classList.add(json_schema_1.ObjectTypes.Listing);
|
|
66
66
|
dom.setAttribute('data-language', listingNode.attrs.language);
|
|
67
67
|
dom.setAttribute('data-languageKey', listingNode.attrs.languageKey);
|
|
68
68
|
dom.textContent = listingNode.attrs.contents;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isParagraphNode = exports.paragraph = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const attributes_1 = require("../../lib/attributes");
|
|
21
21
|
exports.paragraph = {
|
|
22
22
|
content: 'inline*',
|
|
@@ -52,7 +52,7 @@ exports.paragraph = {
|
|
|
52
52
|
attrs.id = paragraphNode.attrs.id;
|
|
53
53
|
}
|
|
54
54
|
attrs.class = (0, attributes_1.buildElementClass)(paragraphNode.attrs);
|
|
55
|
-
attrs['data-object-type'] =
|
|
55
|
+
attrs['data-object-type'] = json_schema_1.ObjectTypes.ParagraphElement;
|
|
56
56
|
if (paragraphNode.attrs.placeholder) {
|
|
57
57
|
attrs['data-placeholder-text'] = paragraphNode.attrs.placeholder;
|
|
58
58
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isPullquoteElement = exports.pullquoteElement = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const attributes_1 = require("../../lib/attributes");
|
|
21
21
|
exports.pullquoteElement = {
|
|
22
22
|
content: 'paragraph+ attribution',
|
|
@@ -54,7 +54,7 @@ exports.pullquoteElement = {
|
|
|
54
54
|
'pullquote',
|
|
55
55
|
(0, attributes_1.buildElementClass)(pullquoteElementNode.attrs),
|
|
56
56
|
].join(' ');
|
|
57
|
-
attrs['data-object-type'] =
|
|
57
|
+
attrs['data-object-type'] = json_schema_1.ObjectTypes.QuoteElement;
|
|
58
58
|
if (pullquoteElementNode.attrs.placeholder) {
|
|
59
59
|
attrs['data-placeholder-text'] = pullquoteElementNode.attrs.placeholder;
|
|
60
60
|
}
|
|
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildUserFootNote = exports.buildStatusLabel = exports.buildJournal = exports.buildSubmission = exports.buildAttribution = exports.buildInlineStyle = exports.buildContributorRole = exports.buildContribution = exports.buildHighlightMarker = exports.buildHighlight = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildInlineMathFragment = exports.buildValidation = exports.buildNote = exports.buildComment = exports.buildUserProfileAffiliation = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildLibraryCollection = exports.buildManuscriptKeyword = exports.buildKeywordGroup = exports.buildKeyword = exports.buildCitation = exports.buildEmbeddedCitationItem = exports.buildAuxiliaryObjectReference = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = exports.DEFAULT_PAGE_LAYOUT = exports.DEFAULT_BUNDLE = void 0;
|
|
22
|
-
const
|
|
22
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
23
23
|
const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
|
|
24
24
|
const schema_1 = require("../schema");
|
|
25
25
|
const id_1 = require("./id");
|
|
@@ -27,8 +27,8 @@ const timestamp_1 = require("./timestamp");
|
|
|
27
27
|
exports.DEFAULT_BUNDLE = 'MPBundle:www-zotero-org-styles-nature';
|
|
28
28
|
exports.DEFAULT_PAGE_LAYOUT = 'MPPageLayout:defaultA4';
|
|
29
29
|
const buildProject = (owner) => ({
|
|
30
|
-
_id: (0, id_1.generateID)(
|
|
31
|
-
objectType:
|
|
30
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Project),
|
|
31
|
+
objectType: json_schema_1.ObjectTypes.Project,
|
|
32
32
|
owners: [owner],
|
|
33
33
|
writers: [],
|
|
34
34
|
viewers: [],
|
|
@@ -36,14 +36,14 @@ const buildProject = (owner) => ({
|
|
|
36
36
|
});
|
|
37
37
|
exports.buildProject = buildProject;
|
|
38
38
|
const buildManuscript = (title = '') => ({
|
|
39
|
-
_id: (0, id_1.generateID)(
|
|
40
|
-
objectType:
|
|
39
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Manuscript),
|
|
40
|
+
objectType: json_schema_1.ObjectTypes.Manuscript,
|
|
41
41
|
title,
|
|
42
42
|
});
|
|
43
43
|
exports.buildManuscript = buildManuscript;
|
|
44
44
|
const buildContributor = (bibliographicName, role = 'author', priority = 0, userID, invitationID) => ({
|
|
45
|
-
_id: (0, id_1.generateID)(
|
|
46
|
-
objectType:
|
|
45
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Contributor),
|
|
46
|
+
objectType: json_schema_1.ObjectTypes.Contributor,
|
|
47
47
|
priority,
|
|
48
48
|
role,
|
|
49
49
|
affiliations: [],
|
|
@@ -52,16 +52,16 @@ const buildContributor = (bibliographicName, role = 'author', priority = 0, user
|
|
|
52
52
|
invitationID,
|
|
53
53
|
});
|
|
54
54
|
exports.buildContributor = buildContributor;
|
|
55
|
-
const buildBibliographyItem = (data) => (Object.assign(Object.assign({}, data), { type: data.type || 'article-journal', _id: (0, id_1.generateID)(
|
|
55
|
+
const buildBibliographyItem = (data) => (Object.assign(Object.assign({}, data), { type: data.type || 'article-journal', _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographyItem), objectType: json_schema_1.ObjectTypes.BibliographyItem }));
|
|
56
56
|
exports.buildBibliographyItem = buildBibliographyItem;
|
|
57
|
-
const buildBibliographicName = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(
|
|
57
|
+
const buildBibliographicName = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographicName), objectType: json_schema_1.ObjectTypes.BibliographicName }));
|
|
58
58
|
exports.buildBibliographicName = buildBibliographicName;
|
|
59
|
-
const buildBibliographicDate = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(
|
|
59
|
+
const buildBibliographicDate = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographicDate), objectType: json_schema_1.ObjectTypes.BibliographicDate }));
|
|
60
60
|
exports.buildBibliographicDate = buildBibliographicDate;
|
|
61
61
|
const buildAuxiliaryObjectReference = (containingObject, rids) => {
|
|
62
62
|
const auxiliaryObjectReference = {
|
|
63
|
-
_id: (0, id_1.generateID)(
|
|
64
|
-
objectType:
|
|
63
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.AuxiliaryObjectReference),
|
|
64
|
+
objectType: json_schema_1.ObjectTypes.AuxiliaryObjectReference,
|
|
65
65
|
containingObject: containingObject || undefined,
|
|
66
66
|
};
|
|
67
67
|
if (rids.length < 2) {
|
|
@@ -74,35 +74,35 @@ const buildAuxiliaryObjectReference = (containingObject, rids) => {
|
|
|
74
74
|
};
|
|
75
75
|
exports.buildAuxiliaryObjectReference = buildAuxiliaryObjectReference;
|
|
76
76
|
const buildEmbeddedCitationItem = (bibliographyItem) => ({
|
|
77
|
-
_id: (0, id_1.generateID)(
|
|
78
|
-
objectType:
|
|
77
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.CitationItem),
|
|
78
|
+
objectType: json_schema_1.ObjectTypes.CitationItem,
|
|
79
79
|
bibliographyItem,
|
|
80
80
|
});
|
|
81
81
|
exports.buildEmbeddedCitationItem = buildEmbeddedCitationItem;
|
|
82
82
|
const buildCitation = (containingObject, embeddedCitationItems) => ({
|
|
83
|
-
_id: (0, id_1.generateID)(
|
|
84
|
-
objectType:
|
|
83
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Citation),
|
|
84
|
+
objectType: json_schema_1.ObjectTypes.Citation,
|
|
85
85
|
containingObject: containingObject || undefined,
|
|
86
86
|
embeddedCitationItems: embeddedCitationItems.map(exports.buildEmbeddedCitationItem),
|
|
87
87
|
});
|
|
88
88
|
exports.buildCitation = buildCitation;
|
|
89
89
|
const buildKeyword = (name) => ({
|
|
90
|
-
_id: (0, id_1.generateID)(
|
|
91
|
-
objectType:
|
|
90
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Keyword),
|
|
91
|
+
objectType: json_schema_1.ObjectTypes.Keyword,
|
|
92
92
|
name,
|
|
93
93
|
});
|
|
94
94
|
exports.buildKeyword = buildKeyword;
|
|
95
|
-
const buildKeywordGroup = (attributes) => (Object.assign(Object.assign(Object.assign({ _id: (0, id_1.generateID)(
|
|
95
|
+
const buildKeywordGroup = (attributes) => (Object.assign(Object.assign(Object.assign({ _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.KeywordGroup), objectType: json_schema_1.ObjectTypes.KeywordGroup }, (attributes.type && { type: attributes.type })), (attributes.title && { title: attributes.title })), (attributes.label && { label: attributes.label })));
|
|
96
96
|
exports.buildKeywordGroup = buildKeywordGroup;
|
|
97
97
|
const buildManuscriptKeyword = (name) => ({
|
|
98
|
-
_id: (0, id_1.generateID)(
|
|
99
|
-
objectType:
|
|
98
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ManuscriptKeyword),
|
|
99
|
+
objectType: json_schema_1.ObjectTypes.ManuscriptKeyword,
|
|
100
100
|
name,
|
|
101
101
|
});
|
|
102
102
|
exports.buildManuscriptKeyword = buildManuscriptKeyword;
|
|
103
103
|
const buildLibraryCollection = (owner, name) => ({
|
|
104
|
-
_id: (0, id_1.generateID)(
|
|
105
|
-
objectType:
|
|
104
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.LibraryCollection),
|
|
105
|
+
objectType: json_schema_1.ObjectTypes.LibraryCollection,
|
|
106
106
|
owners: [owner],
|
|
107
107
|
writers: [],
|
|
108
108
|
viewers: [],
|
|
@@ -110,8 +110,8 @@ const buildLibraryCollection = (owner, name) => ({
|
|
|
110
110
|
});
|
|
111
111
|
exports.buildLibraryCollection = buildLibraryCollection;
|
|
112
112
|
const buildFigure = (blob) => ({
|
|
113
|
-
_id: (0, id_1.generateID)(
|
|
114
|
-
objectType:
|
|
113
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Figure),
|
|
114
|
+
objectType: json_schema_1.ObjectTypes.Figure,
|
|
115
115
|
contentType: blob.type,
|
|
116
116
|
src: window.URL.createObjectURL(blob),
|
|
117
117
|
attachment: {
|
|
@@ -122,29 +122,29 @@ const buildFigure = (blob) => ({
|
|
|
122
122
|
});
|
|
123
123
|
exports.buildFigure = buildFigure;
|
|
124
124
|
const buildAffiliation = (institution, priority = 0) => ({
|
|
125
|
-
_id: (0, id_1.generateID)(
|
|
126
|
-
objectType:
|
|
125
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Affiliation),
|
|
126
|
+
objectType: json_schema_1.ObjectTypes.Affiliation,
|
|
127
127
|
institution,
|
|
128
128
|
priority,
|
|
129
129
|
});
|
|
130
130
|
exports.buildAffiliation = buildAffiliation;
|
|
131
131
|
const buildSupplementaryMaterial = (title, href) => ({
|
|
132
|
-
_id: (0, id_1.generateID)(
|
|
133
|
-
objectType:
|
|
132
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Supplement),
|
|
133
|
+
objectType: json_schema_1.ObjectTypes.Supplement,
|
|
134
134
|
title,
|
|
135
135
|
href,
|
|
136
136
|
});
|
|
137
137
|
exports.buildSupplementaryMaterial = buildSupplementaryMaterial;
|
|
138
138
|
const buildUserProfileAffiliation = (institution, priority = 0) => ({
|
|
139
|
-
_id: (0, id_1.generateID)(
|
|
140
|
-
objectType:
|
|
139
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.UserProfileAffiliation),
|
|
140
|
+
objectType: json_schema_1.ObjectTypes.UserProfileAffiliation,
|
|
141
141
|
institution,
|
|
142
142
|
priority,
|
|
143
143
|
});
|
|
144
144
|
exports.buildUserProfileAffiliation = buildUserProfileAffiliation;
|
|
145
145
|
const buildComment = (target, contents = '', selector, contributions, annotationColor) => ({
|
|
146
|
-
_id: (0, id_1.generateID)(
|
|
147
|
-
objectType:
|
|
146
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.CommentAnnotation),
|
|
147
|
+
objectType: json_schema_1.ObjectTypes.CommentAnnotation,
|
|
148
148
|
target,
|
|
149
149
|
selector,
|
|
150
150
|
contents,
|
|
@@ -153,58 +153,58 @@ const buildComment = (target, contents = '', selector, contributions, annotation
|
|
|
153
153
|
});
|
|
154
154
|
exports.buildComment = buildComment;
|
|
155
155
|
const buildNote = (target, source, contents = '') => ({
|
|
156
|
-
_id: (0, id_1.generateID)(
|
|
157
|
-
objectType:
|
|
156
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ManuscriptNote),
|
|
157
|
+
objectType: json_schema_1.ObjectTypes.ManuscriptNote,
|
|
158
158
|
target,
|
|
159
159
|
source,
|
|
160
160
|
contents,
|
|
161
161
|
});
|
|
162
162
|
exports.buildNote = buildNote;
|
|
163
163
|
const buildValidation = (results) => ({
|
|
164
|
-
_id: (0, id_1.generateID)(
|
|
165
|
-
objectType:
|
|
164
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.RequirementsValidation),
|
|
165
|
+
objectType: json_schema_1.ObjectTypes.RequirementsValidation,
|
|
166
166
|
results,
|
|
167
167
|
});
|
|
168
168
|
exports.buildValidation = buildValidation;
|
|
169
169
|
const buildInlineMathFragment = (containingObject, TeXRepresentation) => ({
|
|
170
|
-
_id: (0, id_1.generateID)(
|
|
171
|
-
objectType:
|
|
170
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.InlineMathFragment),
|
|
171
|
+
objectType: json_schema_1.ObjectTypes.InlineMathFragment,
|
|
172
172
|
containingObject: containingObject || undefined,
|
|
173
173
|
TeXRepresentation,
|
|
174
174
|
});
|
|
175
175
|
exports.buildInlineMathFragment = buildInlineMathFragment;
|
|
176
176
|
const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
|
|
177
|
-
_id: (0, id_1.generateID)(
|
|
178
|
-
objectType:
|
|
177
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Footnote),
|
|
178
|
+
objectType: json_schema_1.ObjectTypes.Footnote,
|
|
179
179
|
containingObject: containingObject || undefined,
|
|
180
180
|
contents,
|
|
181
181
|
kind,
|
|
182
182
|
});
|
|
183
183
|
exports.buildFootnote = buildFootnote;
|
|
184
184
|
const buildFootnotesOrder = (footnotesList) => ({
|
|
185
|
-
_id: (0, id_1.generateID)(
|
|
186
|
-
objectType:
|
|
185
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.FootnotesOrder),
|
|
186
|
+
objectType: json_schema_1.ObjectTypes.FootnotesOrder,
|
|
187
187
|
footnotesList,
|
|
188
188
|
});
|
|
189
189
|
exports.buildFootnotesOrder = buildFootnotesOrder;
|
|
190
190
|
const buildCorresp = (contents) => ({
|
|
191
|
-
_id: (0, id_1.generateID)(
|
|
192
|
-
objectType:
|
|
191
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Corresponding),
|
|
192
|
+
objectType: json_schema_1.ObjectTypes.Corresponding,
|
|
193
193
|
contents,
|
|
194
194
|
});
|
|
195
195
|
exports.buildCorresp = buildCorresp;
|
|
196
196
|
const buildSection = (priority = 0, path = []) => {
|
|
197
|
-
const id = (0, id_1.generateID)(
|
|
197
|
+
const id = (0, id_1.generateID)(json_schema_1.ObjectTypes.Section);
|
|
198
198
|
return {
|
|
199
199
|
_id: id,
|
|
200
|
-
objectType:
|
|
200
|
+
objectType: json_schema_1.ObjectTypes.Section,
|
|
201
201
|
priority,
|
|
202
202
|
path: path.concat(id),
|
|
203
203
|
};
|
|
204
204
|
};
|
|
205
205
|
exports.buildSection = buildSection;
|
|
206
206
|
const buildParagraph = (placeholderInnerHTML) => {
|
|
207
|
-
const _id = (0, id_1.generateID)(
|
|
207
|
+
const _id = (0, id_1.generateID)(json_schema_1.ObjectTypes.ParagraphElement);
|
|
208
208
|
const element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p');
|
|
209
209
|
element.setAttribute('id', _id);
|
|
210
210
|
element.setAttribute('class', 'MPElement');
|
|
@@ -214,7 +214,7 @@ const buildParagraph = (placeholderInnerHTML) => {
|
|
|
214
214
|
const contents = (0, w3c_xmlserializer_1.default)(element);
|
|
215
215
|
return {
|
|
216
216
|
_id,
|
|
217
|
-
objectType:
|
|
217
|
+
objectType: json_schema_1.ObjectTypes.ParagraphElement,
|
|
218
218
|
elementType: 'p',
|
|
219
219
|
contents,
|
|
220
220
|
placeholderInnerHTML,
|
|
@@ -222,70 +222,70 @@ const buildParagraph = (placeholderInnerHTML) => {
|
|
|
222
222
|
};
|
|
223
223
|
exports.buildParagraph = buildParagraph;
|
|
224
224
|
const buildColor = (value, priority) => ({
|
|
225
|
-
_id: (0, id_1.generateID)(
|
|
226
|
-
objectType:
|
|
225
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Color),
|
|
226
|
+
objectType: json_schema_1.ObjectTypes.Color,
|
|
227
227
|
priority,
|
|
228
228
|
value,
|
|
229
229
|
});
|
|
230
230
|
exports.buildColor = buildColor;
|
|
231
231
|
const buildHighlight = () => ({
|
|
232
|
-
_id: (0, id_1.generateID)(
|
|
233
|
-
objectType:
|
|
232
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Highlight),
|
|
233
|
+
objectType: json_schema_1.ObjectTypes.Highlight,
|
|
234
234
|
});
|
|
235
235
|
exports.buildHighlight = buildHighlight;
|
|
236
236
|
const buildHighlightMarker = (highlightID, start, offset, field) => ({
|
|
237
237
|
highlightID,
|
|
238
|
-
objectType:
|
|
239
|
-
_id: (0, id_1.generateID)(
|
|
238
|
+
objectType: json_schema_1.ObjectTypes.HighlightMarker,
|
|
239
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.HighlightMarker),
|
|
240
240
|
start,
|
|
241
241
|
offset,
|
|
242
242
|
field,
|
|
243
243
|
});
|
|
244
244
|
exports.buildHighlightMarker = buildHighlightMarker;
|
|
245
245
|
const buildContribution = (profileID) => ({
|
|
246
|
-
_id: (0, id_1.generateID)(
|
|
247
|
-
objectType:
|
|
246
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Contribution),
|
|
247
|
+
objectType: json_schema_1.ObjectTypes.Contribution,
|
|
248
248
|
profileID,
|
|
249
249
|
timestamp: (0, timestamp_1.timestamp)(),
|
|
250
250
|
});
|
|
251
251
|
exports.buildContribution = buildContribution;
|
|
252
252
|
const buildContributorRole = (name) => ({
|
|
253
|
-
_id: (0, id_1.generateID)(
|
|
254
|
-
objectType:
|
|
253
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ContributorRole),
|
|
254
|
+
objectType: json_schema_1.ObjectTypes.ContributorRole,
|
|
255
255
|
name,
|
|
256
256
|
});
|
|
257
257
|
exports.buildContributorRole = buildContributorRole;
|
|
258
258
|
const buildInlineStyle = (priority, title) => ({
|
|
259
|
-
_id: (0, id_1.generateID)(
|
|
260
|
-
objectType:
|
|
259
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.InlineStyle),
|
|
260
|
+
objectType: json_schema_1.ObjectTypes.InlineStyle,
|
|
261
261
|
priority,
|
|
262
262
|
title,
|
|
263
263
|
});
|
|
264
264
|
exports.buildInlineStyle = buildInlineStyle;
|
|
265
265
|
const buildAttribution = () => ({
|
|
266
|
-
_id: (0, id_1.generateID)(
|
|
267
|
-
objectType:
|
|
266
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Attribution),
|
|
267
|
+
objectType: json_schema_1.ObjectTypes.Attribution,
|
|
268
268
|
});
|
|
269
269
|
exports.buildAttribution = buildAttribution;
|
|
270
270
|
const buildSubmission = () => ({
|
|
271
|
-
_id: (0, id_1.generateID)(
|
|
272
|
-
objectType:
|
|
271
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Submission),
|
|
272
|
+
objectType: json_schema_1.ObjectTypes.Submission,
|
|
273
273
|
});
|
|
274
274
|
exports.buildSubmission = buildSubmission;
|
|
275
275
|
const buildJournal = () => ({
|
|
276
|
-
_id: (0, id_1.generateID)(
|
|
277
|
-
objectType:
|
|
276
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Journal),
|
|
277
|
+
objectType: json_schema_1.ObjectTypes.Journal,
|
|
278
278
|
});
|
|
279
279
|
exports.buildJournal = buildJournal;
|
|
280
280
|
const buildStatusLabel = (name) => ({
|
|
281
|
-
_id: (0, id_1.generateID)(
|
|
282
|
-
objectType:
|
|
281
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.StatusLabel),
|
|
282
|
+
objectType: json_schema_1.ObjectTypes.StatusLabel,
|
|
283
283
|
name,
|
|
284
284
|
});
|
|
285
285
|
exports.buildStatusLabel = buildStatusLabel;
|
|
286
286
|
const buildUserFootNote = (noteId, content) => ({
|
|
287
|
-
_id: (0, id_1.generateID)(
|
|
288
|
-
objectType:
|
|
287
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.UserProfileFootNote),
|
|
288
|
+
objectType: json_schema_1.ObjectTypes.UserProfileFootNote,
|
|
289
289
|
noteId,
|
|
290
290
|
content,
|
|
291
291
|
});
|
|
@@ -297,8 +297,8 @@ exports.auxiliaryObjectTypes = new Set([
|
|
|
297
297
|
schema_1.schema.nodes.listing_element,
|
|
298
298
|
]);
|
|
299
299
|
const buildElementsOrder = (elementType) => ({
|
|
300
|
-
_id: (0, id_1.generateID)(
|
|
301
|
-
objectType:
|
|
300
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ElementsOrder),
|
|
301
|
+
objectType: json_schema_1.ObjectTypes.ElementsOrder,
|
|
302
302
|
elementType: elementType,
|
|
303
303
|
elements: [],
|
|
304
304
|
});
|