@manuscripts/transform 1.3.3 → 1.3.4
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/jats-exporter.js +0 -24
- package/dist/cjs/transformer/builders.js +1 -13
- package/dist/cjs/transformer/decode.js +1 -1
- package/dist/cjs/transformer/manuscript-dependencies.js +1 -1
- package/dist/cjs/transformer/project-bundle.js +1 -14
- package/dist/es/jats/jats-exporter.js +1 -25
- package/dist/es/transformer/builders.js +0 -10
- package/dist/es/transformer/decode.js +1 -1
- package/dist/es/transformer/manuscript-dependencies.js +1 -1
- package/dist/es/transformer/project-bundle.js +0 -12
- package/dist/types/transformer/builders.d.ts +1 -3
- package/dist/types/transformer/project-bundle.d.ts +1 -2
- package/package.json +2 -2
|
@@ -236,7 +236,6 @@ class JATSExporter {
|
|
|
236
236
|
this.buildFront = (doi, id, links) => {
|
|
237
237
|
var _a, _b, _c, _d;
|
|
238
238
|
const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
|
|
239
|
-
const submission = (0, project_bundle_1.findLatestManuscriptSubmission)(this.modelMap, manuscript);
|
|
240
239
|
const front = this.document.createElement('front');
|
|
241
240
|
const journalMeta = this.document.createElement('journal-meta');
|
|
242
241
|
front.appendChild(journalMeta);
|
|
@@ -291,29 +290,6 @@ class JATSExporter {
|
|
|
291
290
|
journalMeta.appendChild(publisher);
|
|
292
291
|
}
|
|
293
292
|
}
|
|
294
|
-
else {
|
|
295
|
-
if (submission) {
|
|
296
|
-
if (submission.journalCode) {
|
|
297
|
-
const journalID = this.document.createElement('journal-id');
|
|
298
|
-
journalID.setAttribute('journal-id-type', 'publisher-id');
|
|
299
|
-
journalID.textContent = submission.journalCode;
|
|
300
|
-
journalMeta.appendChild(journalID);
|
|
301
|
-
}
|
|
302
|
-
if (submission.journalTitle) {
|
|
303
|
-
const journalTitleGroup = this.document.createElement('journal-title-group');
|
|
304
|
-
journalMeta.appendChild(journalTitleGroup);
|
|
305
|
-
const journalTitle = this.document.createElement('journal-title');
|
|
306
|
-
journalTitle.textContent = submission.journalTitle;
|
|
307
|
-
journalTitleGroup.appendChild(journalTitle);
|
|
308
|
-
}
|
|
309
|
-
if (submission.issn) {
|
|
310
|
-
const issn = this.document.createElement('issn');
|
|
311
|
-
issn.setAttribute('pub-type', 'epub');
|
|
312
|
-
issn.textContent = submission.issn;
|
|
313
|
-
journalMeta.appendChild(issn);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
293
|
if (id) {
|
|
318
294
|
const articleID = this.document.createElement('article-id');
|
|
319
295
|
articleID.setAttribute('pub-id-type', 'publisher-id');
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.
|
|
21
|
+
exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildStatusLabel = exports.buildJournal = 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
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");
|
|
@@ -267,11 +267,6 @@ const buildAttribution = () => ({
|
|
|
267
267
|
objectType: json_schema_1.ObjectTypes.Attribution,
|
|
268
268
|
});
|
|
269
269
|
exports.buildAttribution = buildAttribution;
|
|
270
|
-
const buildSubmission = () => ({
|
|
271
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Submission),
|
|
272
|
-
objectType: json_schema_1.ObjectTypes.Submission,
|
|
273
|
-
});
|
|
274
|
-
exports.buildSubmission = buildSubmission;
|
|
275
270
|
const buildJournal = () => ({
|
|
276
271
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Journal),
|
|
277
272
|
objectType: json_schema_1.ObjectTypes.Journal,
|
|
@@ -283,13 +278,6 @@ const buildStatusLabel = (name) => ({
|
|
|
283
278
|
name,
|
|
284
279
|
});
|
|
285
280
|
exports.buildStatusLabel = buildStatusLabel;
|
|
286
|
-
const buildUserFootNote = (noteId, content) => ({
|
|
287
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.UserProfileFootNote),
|
|
288
|
-
objectType: json_schema_1.ObjectTypes.UserProfileFootNote,
|
|
289
|
-
noteId,
|
|
290
|
-
content,
|
|
291
|
-
});
|
|
292
|
-
exports.buildUserFootNote = buildUserFootNote;
|
|
293
281
|
exports.auxiliaryObjectTypes = new Set([
|
|
294
282
|
schema_1.schema.nodes.figure_element,
|
|
295
283
|
schema_1.schema.nodes.table_element,
|
|
@@ -43,7 +43,7 @@ const timestamp_1 = require("./timestamp");
|
|
|
43
43
|
const warn = (0, debug_1.default)('manuscripts-transform');
|
|
44
44
|
const parser = prosemirror_model_1.DOMParser.fromSchema(schema_1.schema);
|
|
45
45
|
const getModelData = (model) => {
|
|
46
|
-
const {
|
|
46
|
+
const { updatedAt, createdAt } = model, data = __rest(model, ["updatedAt", "createdAt"]);
|
|
47
47
|
return data;
|
|
48
48
|
};
|
|
49
49
|
exports.getModelData = getModelData;
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.fromPrototype = void 0;
|
|
15
15
|
const id_1 = require("./id");
|
|
16
16
|
const fromPrototype = (model) => {
|
|
17
|
-
const { _id
|
|
17
|
+
const { _id } = model, data = __rest(model, ["_id"]);
|
|
18
18
|
const output = Object.assign(Object.assign({}, data), { prototype: _id, _id: (0, id_1.generateID)(model.objectType) });
|
|
19
19
|
return output;
|
|
20
20
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.findManuscriptById = exports.
|
|
18
|
+
exports.findManuscriptById = exports.findManuscriptModelByType = exports.findJournal = exports.findManuscript = exports.parseProjectBundle = void 0;
|
|
19
19
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const decode_1 = require("./decode");
|
|
21
21
|
const object_types_1 = require("./object-types");
|
|
@@ -63,19 +63,6 @@ const findManuscriptModelByType = (modelMap, manuscript, objectType) => {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
exports.findManuscriptModelByType = findManuscriptModelByType;
|
|
66
|
-
const isSubmission = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Submission);
|
|
67
|
-
const newestFirst = (a, b) => b.createdAt - a.createdAt;
|
|
68
|
-
const findLatestManuscriptSubmission = (modelMap, manuscript) => {
|
|
69
|
-
const submissions = [];
|
|
70
|
-
for (const model of modelMap.values()) {
|
|
71
|
-
if (isSubmission(model) && model.manuscriptID === manuscript._id) {
|
|
72
|
-
submissions.push(model);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
submissions.sort(newestFirst);
|
|
76
|
-
return submissions.length ? submissions[0] : undefined;
|
|
77
|
-
};
|
|
78
|
-
exports.findLatestManuscriptSubmission = findLatestManuscriptSubmission;
|
|
79
66
|
const findManuscriptById = (modelMap, manuscriptID) => {
|
|
80
67
|
const manuscript = modelMap.get(manuscriptID);
|
|
81
68
|
if (manuscript && isManuscript(manuscript)) {
|
|
@@ -25,7 +25,7 @@ import { generateAttachmentFilename } from '../transformer/filename';
|
|
|
25
25
|
import { buildTargets } from '../transformer/labels';
|
|
26
26
|
import { isExecutableNodeType, isNodeType } from '../transformer/node-types';
|
|
27
27
|
import { hasObjectType } from '../transformer/object-types';
|
|
28
|
-
import {
|
|
28
|
+
import { findManuscript, findManuscriptById, } from '../transformer/project-bundle';
|
|
29
29
|
import { chooseSecType } from '../transformer/section-category';
|
|
30
30
|
import { selectVersionIds } from './jats-versions';
|
|
31
31
|
const warn = debug('manuscripts-transform');
|
|
@@ -229,7 +229,6 @@ export class JATSExporter {
|
|
|
229
229
|
this.buildFront = (doi, id, links) => {
|
|
230
230
|
var _a, _b, _c, _d;
|
|
231
231
|
const manuscript = findManuscript(this.modelMap);
|
|
232
|
-
const submission = findLatestManuscriptSubmission(this.modelMap, manuscript);
|
|
233
232
|
const front = this.document.createElement('front');
|
|
234
233
|
const journalMeta = this.document.createElement('journal-meta');
|
|
235
234
|
front.appendChild(journalMeta);
|
|
@@ -284,29 +283,6 @@ export class JATSExporter {
|
|
|
284
283
|
journalMeta.appendChild(publisher);
|
|
285
284
|
}
|
|
286
285
|
}
|
|
287
|
-
else {
|
|
288
|
-
if (submission) {
|
|
289
|
-
if (submission.journalCode) {
|
|
290
|
-
const journalID = this.document.createElement('journal-id');
|
|
291
|
-
journalID.setAttribute('journal-id-type', 'publisher-id');
|
|
292
|
-
journalID.textContent = submission.journalCode;
|
|
293
|
-
journalMeta.appendChild(journalID);
|
|
294
|
-
}
|
|
295
|
-
if (submission.journalTitle) {
|
|
296
|
-
const journalTitleGroup = this.document.createElement('journal-title-group');
|
|
297
|
-
journalMeta.appendChild(journalTitleGroup);
|
|
298
|
-
const journalTitle = this.document.createElement('journal-title');
|
|
299
|
-
journalTitle.textContent = submission.journalTitle;
|
|
300
|
-
journalTitleGroup.appendChild(journalTitle);
|
|
301
|
-
}
|
|
302
|
-
if (submission.issn) {
|
|
303
|
-
const issn = this.document.createElement('issn');
|
|
304
|
-
issn.setAttribute('pub-type', 'epub');
|
|
305
|
-
issn.textContent = submission.issn;
|
|
306
|
-
journalMeta.appendChild(issn);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
286
|
if (id) {
|
|
311
287
|
const articleID = this.document.createElement('article-id');
|
|
312
288
|
articleID.setAttribute('pub-id-type', 'publisher-id');
|
|
@@ -228,10 +228,6 @@ export const buildAttribution = () => ({
|
|
|
228
228
|
_id: generateID(ObjectTypes.Attribution),
|
|
229
229
|
objectType: ObjectTypes.Attribution,
|
|
230
230
|
});
|
|
231
|
-
export const buildSubmission = () => ({
|
|
232
|
-
_id: generateID(ObjectTypes.Submission),
|
|
233
|
-
objectType: ObjectTypes.Submission,
|
|
234
|
-
});
|
|
235
231
|
export const buildJournal = () => ({
|
|
236
232
|
_id: generateID(ObjectTypes.Journal),
|
|
237
233
|
objectType: ObjectTypes.Journal,
|
|
@@ -241,12 +237,6 @@ export const buildStatusLabel = (name) => ({
|
|
|
241
237
|
objectType: ObjectTypes.StatusLabel,
|
|
242
238
|
name,
|
|
243
239
|
});
|
|
244
|
-
export const buildUserFootNote = (noteId, content) => ({
|
|
245
|
-
_id: generateID(ObjectTypes.UserProfileFootNote),
|
|
246
|
-
objectType: ObjectTypes.UserProfileFootNote,
|
|
247
|
-
noteId,
|
|
248
|
-
content,
|
|
249
|
-
});
|
|
250
240
|
export const auxiliaryObjectTypes = new Set([
|
|
251
241
|
schema.nodes.figure_element,
|
|
252
242
|
schema.nodes.table_element,
|
|
@@ -37,7 +37,7 @@ import { timestamp } from './timestamp';
|
|
|
37
37
|
const warn = debug('manuscripts-transform');
|
|
38
38
|
const parser = DOMParser.fromSchema(schema);
|
|
39
39
|
export const getModelData = (model) => {
|
|
40
|
-
const {
|
|
40
|
+
const { updatedAt, createdAt } = model, data = __rest(model, ["updatedAt", "createdAt"]);
|
|
41
41
|
return data;
|
|
42
42
|
};
|
|
43
43
|
export const getModelsByType = (modelMap, objectType) => {
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { generateID } from './id';
|
|
13
13
|
export const fromPrototype = (model) => {
|
|
14
|
-
const { _id
|
|
14
|
+
const { _id } = model, data = __rest(model, ["_id"]);
|
|
15
15
|
const output = Object.assign(Object.assign({}, data), { prototype: _id, _id: generateID(model.objectType) });
|
|
16
16
|
return output;
|
|
17
17
|
};
|
|
@@ -56,18 +56,6 @@ export const findManuscriptModelByType = (modelMap, manuscript, objectType) => {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
const isSubmission = hasObjectType(ObjectTypes.Submission);
|
|
60
|
-
const newestFirst = (a, b) => b.createdAt - a.createdAt;
|
|
61
|
-
export const findLatestManuscriptSubmission = (modelMap, manuscript) => {
|
|
62
|
-
const submissions = [];
|
|
63
|
-
for (const model of modelMap.values()) {
|
|
64
|
-
if (isSubmission(model) && model.manuscriptID === manuscript._id) {
|
|
65
|
-
submissions.push(model);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
submissions.sort(newestFirst);
|
|
69
|
-
return submissions.length ? submissions[0] : undefined;
|
|
70
|
-
};
|
|
71
59
|
export const findManuscriptById = (modelMap, manuscriptID) => {
|
|
72
60
|
const manuscript = modelMap.get(manuscriptID);
|
|
73
61
|
if (manuscript && isManuscript(manuscript)) {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Affiliation, Attribution, AuxiliaryObjectReference, BibliographicDate, BibliographicName, BibliographyItem, Citation, CitationItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Highlight, HighlightMarker, InlineMathFragment, InlineStyle, Journal, Keyword, KeywordGroup, LibraryCollection, Manuscript, ManuscriptKeyword, ManuscriptNote, ObjectTypes, ParagraphElement, Project, RequirementsValidation, RequirementsValidationData, Section, StatusLabel,
|
|
16
|
+
import { Affiliation, Attribution, AuxiliaryObjectReference, BibliographicDate, BibliographicName, BibliographyItem, Citation, CitationItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Highlight, HighlightMarker, InlineMathFragment, InlineStyle, Journal, Keyword, KeywordGroup, LibraryCollection, Manuscript, ManuscriptKeyword, ManuscriptNote, ObjectTypes, ParagraphElement, Project, RequirementsValidation, RequirementsValidationData, Section, StatusLabel, Supplement, UserProfileAffiliation } from '@manuscripts/json-schema';
|
|
17
17
|
import { FootnotesOrderIndexList } from './footnotes-order';
|
|
18
18
|
import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
|
|
19
19
|
export declare const DEFAULT_BUNDLE = "MPBundle:www-zotero-org-styles-nature";
|
|
@@ -65,10 +65,8 @@ export declare const buildContribution: (profileID: string) => Contribution;
|
|
|
65
65
|
export declare const buildContributorRole: (name: string) => Build<ContributorRole>;
|
|
66
66
|
export declare const buildInlineStyle: (priority: number, title?: string) => Build<InlineStyle>;
|
|
67
67
|
export declare const buildAttribution: () => Build<Attribution>;
|
|
68
|
-
export declare const buildSubmission: () => Build<Submission>;
|
|
69
68
|
export declare const buildJournal: () => Build<Journal>;
|
|
70
69
|
export declare const buildStatusLabel: (name: string) => Build<StatusLabel>;
|
|
71
|
-
export declare const buildUserFootNote: (noteId: string, content: string) => Build<UserProfileFootNote>;
|
|
72
70
|
export type AuxiliaryObjects = 'MPFigureElement' | 'MPTableElement' | 'MPListingElement' | 'MPEquationElement';
|
|
73
71
|
export declare const auxiliaryObjectTypes: Set<import("prosemirror-model").NodeType>;
|
|
74
72
|
export declare const buildElementsOrder: (elementType: AuxiliaryObjects) => Build<ElementsOrder>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Journal, Manuscript, Model, ObjectTypes
|
|
16
|
+
import { Journal, Manuscript, Model, ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptModel } from './models';
|
|
18
18
|
export interface ProjectBundle {
|
|
19
19
|
version: string;
|
|
@@ -26,5 +26,4 @@ export declare const parseProjectBundle: (projectBundle: ProjectBundle, manuscri
|
|
|
26
26
|
export declare const findManuscript: (modelMap: Map<string, Model>) => Manuscript;
|
|
27
27
|
export declare const findJournal: (modelMap: Map<string, Model>) => Journal | null;
|
|
28
28
|
export declare const findManuscriptModelByType: <T extends ManuscriptModel>(modelMap: Map<string, Model>, manuscript: Manuscript, objectType: ObjectTypes) => T | undefined;
|
|
29
|
-
export declare const findLatestManuscriptSubmission: (modelMap: Map<string, Model>, manuscript: Manuscript) => Submission | undefined;
|
|
30
29
|
export declare const findManuscriptById: (modelMap: Map<string, Model>, manuscriptID: string) => Manuscript;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.4",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"version": "yarn build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@manuscripts/json-schema": "^2.0
|
|
32
|
+
"@manuscripts/json-schema": "^2.1.0",
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
34
|
"jszip": "^3.10.1",
|
|
35
35
|
"mathjax-full": "^3.2.2",
|