@manuscripts/transform 2.3.34-LEAN-3911.2 → 2.3.35
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/__tests__/data/project-dump.json +825 -0
- package/dist/cjs/jats/importer/index.js +3 -3
- package/dist/cjs/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +9 -229
- package/dist/cjs/jats/importer/jats-body-transformations.js +0 -70
- package/dist/cjs/jats/importer/jats-comments.js +104 -27
- package/dist/cjs/jats/importer/jats-front-parser.js +321 -0
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +1 -8
- package/dist/cjs/jats/importer/jats-parser-utils.js +5 -39
- package/dist/cjs/jats/importer/jats-reference-parser.js +27 -16
- package/dist/cjs/jats/importer/jats-references.js +18 -18
- package/dist/cjs/jats/importer/parse-jats-article.js +78 -42
- package/dist/cjs/jats/index.js +3 -4
- package/dist/cjs/jats/jats-exporter.js +354 -251
- package/dist/cjs/lib/utils.js +1 -9
- package/dist/cjs/schema/nodes/inline_footnote.js +1 -0
- package/dist/cjs/transformer/__tests__/__helpers__/doc.js +37 -0
- package/dist/cjs/transformer/builders.js +219 -0
- package/dist/cjs/transformer/decode.js +874 -0
- package/dist/cjs/transformer/document-object-types.js +31 -0
- package/dist/cjs/transformer/encode.js +664 -0
- package/dist/cjs/transformer/footnote-category.js +20 -0
- package/dist/cjs/transformer/footnotes-order.js +60 -0
- package/dist/cjs/transformer/highlight-markers.js +138 -0
- package/dist/cjs/transformer/html.js +400 -0
- package/dist/cjs/transformer/id.js +6 -6
- package/dist/cjs/transformer/index.js +18 -0
- package/dist/cjs/{jats → transformer}/labels.js +3 -3
- package/dist/cjs/transformer/manuscript-dependencies.js +21 -0
- package/dist/cjs/transformer/model-map.js +26 -0
- package/dist/cjs/transformer/models.js +17 -0
- package/dist/cjs/transformer/object-types.js +57 -0
- package/dist/cjs/transformer/project-bundle.js +94 -0
- package/dist/cjs/transformer/serializer.js +23 -0
- package/dist/cjs/transformer/update-identifiers.js +93 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/__tests__/data/project-dump.json +825 -0
- package/dist/es/jats/importer/index.js +1 -2
- package/dist/es/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +10 -230
- package/dist/es/jats/importer/jats-body-transformations.js +0 -70
- package/dist/es/jats/importer/jats-comments.js +101 -26
- package/dist/es/jats/importer/jats-front-parser.js +315 -0
- package/dist/es/jats/importer/jats-journal-meta-parser.js +0 -6
- package/dist/es/jats/importer/jats-parser-utils.js +6 -40
- package/dist/es/jats/importer/jats-reference-parser.js +27 -16
- package/dist/es/jats/importer/jats-references.js +18 -18
- package/dist/es/jats/importer/parse-jats-article.js +77 -43
- package/dist/es/jats/index.js +1 -3
- package/dist/es/jats/jats-exporter.js +356 -253
- package/dist/es/lib/utils.js +0 -7
- package/dist/es/schema/nodes/inline_footnote.js +1 -0
- package/dist/es/transformer/__tests__/__helpers__/doc.js +29 -0
- package/dist/es/transformer/builders.js +186 -0
- package/dist/es/transformer/decode.js +864 -0
- package/dist/es/transformer/document-object-types.js +28 -0
- package/dist/es/transformer/encode.js +654 -0
- package/dist/{types/jats/importer/create-article-node.d.ts → es/transformer/footnote-category.js} +2 -3
- package/dist/es/transformer/footnotes-order.js +55 -0
- package/dist/es/transformer/highlight-markers.js +132 -0
- package/dist/es/transformer/html.js +393 -0
- package/dist/es/transformer/id.js +4 -5
- package/dist/es/transformer/index.js +16 -0
- package/dist/es/{jats → transformer}/labels.js +3 -3
- package/dist/es/transformer/manuscript-dependencies.js +17 -0
- package/dist/es/transformer/model-map.js +22 -0
- package/dist/es/transformer/models.js +16 -0
- package/dist/es/transformer/object-types.js +52 -0
- package/dist/es/transformer/project-bundle.js +85 -0
- package/dist/es/transformer/serializer.js +17 -0
- package/dist/es/transformer/update-identifiers.js +87 -0
- package/dist/es/version.js +1 -1
- package/dist/types/jats/importer/index.d.ts +1 -2
- package/dist/types/jats/importer/{jats-dom-parser.d.ts → jats-body-dom-parser.d.ts} +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +0 -5
- package/dist/types/jats/importer/jats-comments.d.ts +10 -4
- package/dist/types/jats/importer/jats-front-parser.d.ts +84 -0
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +0 -10
- package/dist/types/jats/importer/jats-references.d.ts +8 -19
- package/dist/types/jats/importer/parse-jats-article.d.ts +5 -12
- package/dist/types/jats/index.d.ts +1 -3
- package/dist/types/jats/jats-exporter.d.ts +29 -10
- package/dist/types/lib/utils.d.ts +0 -3
- package/dist/types/schema/nodes/bibliography_item.d.ts +6 -16
- package/dist/types/schema/nodes/contributor.d.ts +0 -10
- package/dist/types/schema/nodes/keyword_group.d.ts +0 -1
- package/dist/types/transformer/__tests__/__helpers__/doc.d.ts +18 -0
- package/dist/types/transformer/builders.d.ts +61 -0
- package/dist/types/transformer/decode.d.ts +51 -0
- package/dist/types/transformer/document-object-types.d.ts +17 -0
- package/dist/types/transformer/encode.d.ts +29 -0
- package/dist/types/transformer/footnote-category.d.ts +17 -0
- package/dist/types/transformer/footnotes-order.d.ts +22 -0
- package/dist/types/transformer/highlight-markers.d.ts +31 -0
- package/dist/types/transformer/html.d.ts +36 -0
- package/dist/types/transformer/id.d.ts +3 -4
- package/dist/types/transformer/index.d.ts +16 -0
- package/dist/types/{jats → transformer}/labels.d.ts +1 -2
- package/dist/types/transformer/manuscript-dependencies.d.ts +4 -0
- package/dist/types/transformer/model-map.d.ts +19 -0
- package/dist/types/transformer/models.d.ts +48 -0
- package/dist/types/transformer/object-types.d.ts +30 -0
- package/dist/types/transformer/project-bundle.d.ts +30 -0
- package/dist/types/transformer/serializer.d.ts +19 -0
- package/dist/types/transformer/update-identifiers.d.ts +23 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -2
- package/dist/cjs/jats/importer/create-article-node.js +0 -31
- package/dist/cjs/jats/importer/jats-front-transformations.js +0 -262
- package/dist/es/jats/importer/create-article-node.js +0 -27
- package/dist/es/jats/importer/jats-front-transformations.js +0 -259
- package/dist/types/jats/importer/jats-front-transformations.d.ts +0 -38
- /package/dist/cjs/{jats → transformer}/filename.js +0 -0
- /package/dist/cjs/{jats → transformer}/timestamp.js +0 -0
- /package/dist/es/{jats → transformer}/filename.js +0 -0
- /package/dist/es/{jats → transformer}/timestamp.js +0 -0
- /package/dist/types/{jats → transformer}/filename.d.ts +0 -0
- /package/dist/types/{jats → transformer}/timestamp.d.ts +0 -0
package/dist/cjs/lib/utils.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.getTrimmedTextContent = exports.findParentNodeClosestToPos = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
|
|
19
19
|
const bibliography_section_1 = require("../schema/nodes/bibliography_section");
|
|
20
20
|
const graphical_abstract_section_1 = require("../schema/nodes/graphical_abstract_section");
|
|
21
21
|
function* iterateChildren(node, recurse = false) {
|
|
@@ -83,11 +83,3 @@ const getTrimmedTextContent = (node, querySelector) => {
|
|
|
83
83
|
return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
84
84
|
};
|
|
85
85
|
exports.getTrimmedTextContent = getTrimmedTextContent;
|
|
86
|
-
const setElementAttributes = (element, attributes) => {
|
|
87
|
-
Object.entries(attributes).forEach(([key, value]) => {
|
|
88
|
-
if (value) {
|
|
89
|
-
element.setAttribute(key, value);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
exports.setElementAttributes = setElementAttributes;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.createTestDoc = exports.createTestModelMap = void 0;
|
|
22
|
+
const project_dump_json_1 = __importDefault(require("../../../__tests__/data/project-dump.json"));
|
|
23
|
+
const decode_1 = require("../../decode");
|
|
24
|
+
const createTestModelMap = () => {
|
|
25
|
+
const modelMap = new Map();
|
|
26
|
+
for (const component of project_dump_json_1.default.data) {
|
|
27
|
+
modelMap.set(component._id, component);
|
|
28
|
+
}
|
|
29
|
+
return modelMap;
|
|
30
|
+
};
|
|
31
|
+
exports.createTestModelMap = createTestModelMap;
|
|
32
|
+
const createTestDoc = () => {
|
|
33
|
+
const modelMap = (0, exports.createTestModelMap)();
|
|
34
|
+
const decoder = new decode_1.Decoder(modelMap);
|
|
35
|
+
return decoder.createArticleNode();
|
|
36
|
+
};
|
|
37
|
+
exports.createTestDoc = createTestDoc;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildJournal = exports.buildAttribution = exports.buildContributorRole = exports.buildContribution = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildAuthorNotes = exports.buildFootnote = exports.buildNote = exports.buildComment = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildKeywordGroup = exports.buildKeyword = exports.buildBibliographyElement = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = void 0;
|
|
22
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
23
|
+
const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
|
|
24
|
+
const schema_1 = require("../schema");
|
|
25
|
+
const id_1 = require("./id");
|
|
26
|
+
const timestamp_1 = require("./timestamp");
|
|
27
|
+
const buildProject = (owner) => ({
|
|
28
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Project),
|
|
29
|
+
objectType: json_schema_1.ObjectTypes.Project,
|
|
30
|
+
owners: [owner],
|
|
31
|
+
writers: [],
|
|
32
|
+
viewers: [],
|
|
33
|
+
title: '',
|
|
34
|
+
});
|
|
35
|
+
exports.buildProject = buildProject;
|
|
36
|
+
const buildManuscript = () => ({
|
|
37
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Manuscript),
|
|
38
|
+
objectType: json_schema_1.ObjectTypes.Manuscript,
|
|
39
|
+
});
|
|
40
|
+
exports.buildManuscript = buildManuscript;
|
|
41
|
+
const buildContributor = (bibliographicName, role = 'author', priority = 0, userID, invitationID) => ({
|
|
42
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Contributor),
|
|
43
|
+
objectType: json_schema_1.ObjectTypes.Contributor,
|
|
44
|
+
priority,
|
|
45
|
+
role,
|
|
46
|
+
affiliations: [],
|
|
47
|
+
bibliographicName: (0, exports.buildBibliographicName)(bibliographicName),
|
|
48
|
+
userID,
|
|
49
|
+
invitationID,
|
|
50
|
+
});
|
|
51
|
+
exports.buildContributor = buildContributor;
|
|
52
|
+
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 }));
|
|
53
|
+
exports.buildBibliographyItem = buildBibliographyItem;
|
|
54
|
+
const buildBibliographicName = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographicName), objectType: json_schema_1.ObjectTypes.BibliographicName }));
|
|
55
|
+
exports.buildBibliographicName = buildBibliographicName;
|
|
56
|
+
const buildBibliographicDate = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographicDate), objectType: json_schema_1.ObjectTypes.BibliographicDate }));
|
|
57
|
+
exports.buildBibliographicDate = buildBibliographicDate;
|
|
58
|
+
const buildBibliographyElement = (bibliographyItems) => ({
|
|
59
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographyElement),
|
|
60
|
+
objectType: json_schema_1.ObjectTypes.BibliographyElement,
|
|
61
|
+
contents: '',
|
|
62
|
+
elementType: 'div',
|
|
63
|
+
containedObjectIDs: bibliographyItems.map((b) => b._id),
|
|
64
|
+
});
|
|
65
|
+
exports.buildBibliographyElement = buildBibliographyElement;
|
|
66
|
+
const buildKeyword = (name) => ({
|
|
67
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Keyword),
|
|
68
|
+
objectType: json_schema_1.ObjectTypes.Keyword,
|
|
69
|
+
name,
|
|
70
|
+
});
|
|
71
|
+
exports.buildKeyword = buildKeyword;
|
|
72
|
+
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 })));
|
|
73
|
+
exports.buildKeywordGroup = buildKeywordGroup;
|
|
74
|
+
const buildFigure = (blob) => ({
|
|
75
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Figure),
|
|
76
|
+
objectType: json_schema_1.ObjectTypes.Figure,
|
|
77
|
+
contentType: blob.type,
|
|
78
|
+
src: window.URL.createObjectURL(blob),
|
|
79
|
+
attachment: {
|
|
80
|
+
id: 'image',
|
|
81
|
+
type: blob.type,
|
|
82
|
+
data: blob,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
exports.buildFigure = buildFigure;
|
|
86
|
+
const buildAffiliation = (institution, priority = 0) => ({
|
|
87
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Affiliation),
|
|
88
|
+
objectType: json_schema_1.ObjectTypes.Affiliation,
|
|
89
|
+
institution,
|
|
90
|
+
priority,
|
|
91
|
+
});
|
|
92
|
+
exports.buildAffiliation = buildAffiliation;
|
|
93
|
+
const buildSupplementaryMaterial = (title, href) => ({
|
|
94
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Supplement),
|
|
95
|
+
objectType: json_schema_1.ObjectTypes.Supplement,
|
|
96
|
+
title,
|
|
97
|
+
href,
|
|
98
|
+
});
|
|
99
|
+
exports.buildSupplementaryMaterial = buildSupplementaryMaterial;
|
|
100
|
+
const buildComment = (target, contents = '', selector, contributions, annotationColor) => ({
|
|
101
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.CommentAnnotation),
|
|
102
|
+
objectType: json_schema_1.ObjectTypes.CommentAnnotation,
|
|
103
|
+
target,
|
|
104
|
+
selector,
|
|
105
|
+
contents,
|
|
106
|
+
contributions,
|
|
107
|
+
annotationColor,
|
|
108
|
+
});
|
|
109
|
+
exports.buildComment = buildComment;
|
|
110
|
+
const buildNote = (target, source, contents = '') => ({
|
|
111
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ManuscriptNote),
|
|
112
|
+
objectType: json_schema_1.ObjectTypes.ManuscriptNote,
|
|
113
|
+
target,
|
|
114
|
+
source,
|
|
115
|
+
contents,
|
|
116
|
+
});
|
|
117
|
+
exports.buildNote = buildNote;
|
|
118
|
+
const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
|
|
119
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Footnote),
|
|
120
|
+
objectType: json_schema_1.ObjectTypes.Footnote,
|
|
121
|
+
containingObject: containingObject || undefined,
|
|
122
|
+
contents,
|
|
123
|
+
kind,
|
|
124
|
+
});
|
|
125
|
+
exports.buildFootnote = buildFootnote;
|
|
126
|
+
const buildAuthorNotes = (containedObjectIDs) => ({
|
|
127
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.AuthorNotes),
|
|
128
|
+
objectType: json_schema_1.ObjectTypes.AuthorNotes,
|
|
129
|
+
containedObjectIDs: containedObjectIDs,
|
|
130
|
+
});
|
|
131
|
+
exports.buildAuthorNotes = buildAuthorNotes;
|
|
132
|
+
const buildFootnotesOrder = (footnotesList, containedObjectID) => ({
|
|
133
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.FootnotesOrder),
|
|
134
|
+
objectType: json_schema_1.ObjectTypes.FootnotesOrder,
|
|
135
|
+
footnotesList,
|
|
136
|
+
containedObjectID,
|
|
137
|
+
});
|
|
138
|
+
exports.buildFootnotesOrder = buildFootnotesOrder;
|
|
139
|
+
const buildCorresp = (contents) => ({
|
|
140
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Corresponding),
|
|
141
|
+
objectType: json_schema_1.ObjectTypes.Corresponding,
|
|
142
|
+
contents,
|
|
143
|
+
});
|
|
144
|
+
exports.buildCorresp = buildCorresp;
|
|
145
|
+
const buildSection = (priority = 0, path = []) => {
|
|
146
|
+
const id = (0, id_1.generateID)(json_schema_1.ObjectTypes.Section);
|
|
147
|
+
return {
|
|
148
|
+
_id: id,
|
|
149
|
+
objectType: json_schema_1.ObjectTypes.Section,
|
|
150
|
+
priority,
|
|
151
|
+
path: path.concat(id),
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
exports.buildSection = buildSection;
|
|
155
|
+
const buildParagraph = (innerHTML = '') => {
|
|
156
|
+
const _id = (0, id_1.generateID)(json_schema_1.ObjectTypes.ParagraphElement);
|
|
157
|
+
const element = document.createElementNS(null, 'p');
|
|
158
|
+
element.setAttribute('id', _id);
|
|
159
|
+
if (innerHTML) {
|
|
160
|
+
element.innerHTML = innerHTML;
|
|
161
|
+
}
|
|
162
|
+
const contents = (0, w3c_xmlserializer_1.default)(element);
|
|
163
|
+
return {
|
|
164
|
+
_id,
|
|
165
|
+
objectType: json_schema_1.ObjectTypes.ParagraphElement,
|
|
166
|
+
elementType: 'p',
|
|
167
|
+
contents,
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
exports.buildParagraph = buildParagraph;
|
|
171
|
+
const buildColor = (value, priority) => ({
|
|
172
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Color),
|
|
173
|
+
objectType: json_schema_1.ObjectTypes.Color,
|
|
174
|
+
priority,
|
|
175
|
+
value,
|
|
176
|
+
});
|
|
177
|
+
exports.buildColor = buildColor;
|
|
178
|
+
const buildContribution = (profileID) => ({
|
|
179
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Contribution),
|
|
180
|
+
objectType: json_schema_1.ObjectTypes.Contribution,
|
|
181
|
+
profileID,
|
|
182
|
+
timestamp: (0, timestamp_1.timestamp)(),
|
|
183
|
+
});
|
|
184
|
+
exports.buildContribution = buildContribution;
|
|
185
|
+
const buildContributorRole = (name) => ({
|
|
186
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ContributorRole),
|
|
187
|
+
objectType: json_schema_1.ObjectTypes.ContributorRole,
|
|
188
|
+
name,
|
|
189
|
+
});
|
|
190
|
+
exports.buildContributorRole = buildContributorRole;
|
|
191
|
+
const buildAttribution = () => ({
|
|
192
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Attribution),
|
|
193
|
+
objectType: json_schema_1.ObjectTypes.Attribution,
|
|
194
|
+
});
|
|
195
|
+
exports.buildAttribution = buildAttribution;
|
|
196
|
+
const buildJournal = () => ({
|
|
197
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Journal),
|
|
198
|
+
objectType: json_schema_1.ObjectTypes.Journal,
|
|
199
|
+
});
|
|
200
|
+
exports.buildJournal = buildJournal;
|
|
201
|
+
exports.auxiliaryObjectTypes = new Set([
|
|
202
|
+
schema_1.schema.nodes.figure_element,
|
|
203
|
+
schema_1.schema.nodes.table_element,
|
|
204
|
+
schema_1.schema.nodes.equation_element,
|
|
205
|
+
schema_1.schema.nodes.listing_element,
|
|
206
|
+
]);
|
|
207
|
+
const buildElementsOrder = (elementType) => ({
|
|
208
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ElementsOrder),
|
|
209
|
+
objectType: json_schema_1.ObjectTypes.ElementsOrder,
|
|
210
|
+
elementType: elementType,
|
|
211
|
+
elements: [],
|
|
212
|
+
});
|
|
213
|
+
exports.buildElementsOrder = buildElementsOrder;
|
|
214
|
+
const buildTitles = (title) => ({
|
|
215
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Titles),
|
|
216
|
+
objectType: json_schema_1.ObjectTypes.Titles,
|
|
217
|
+
title: title || '',
|
|
218
|
+
});
|
|
219
|
+
exports.buildTitles = buildTitles;
|