@manuscripts/transform 2.6.0 → 2.6.1-LEAN-3966.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.
Files changed (126) hide show
  1. package/dist/cjs/index.js +6 -6
  2. package/dist/cjs/jats/{jats-exporter.js → exporter/jats-exporter.js} +305 -416
  3. package/dist/cjs/jats/{jats-versions.js → exporter/jats-versions.js} +1 -3
  4. package/dist/cjs/{transformer → jats/exporter}/labels.js +4 -4
  5. package/dist/cjs/{transformer/filename.js → jats/importer/create-article-node.js} +10 -9
  6. package/dist/cjs/jats/importer/jats-comments.js +32 -111
  7. package/dist/cjs/jats/importer/{jats-body-dom-parser.js → jats-dom-parser.js} +350 -10
  8. package/dist/cjs/jats/importer/jats-journal-meta-parser.js +11 -1
  9. package/dist/cjs/jats/importer/jats-parser-utils.js +76 -9
  10. package/dist/cjs/jats/importer/jats-transformations.js +397 -0
  11. package/dist/cjs/jats/importer/parse-jats-article.js +44 -101
  12. package/dist/cjs/jats/index.js +7 -7
  13. package/dist/cjs/{transformer/models.js → lib/deafults.js} +3 -1
  14. package/dist/cjs/lib/utils.js +3 -1
  15. package/dist/cjs/schema/nodes/highlight_marker.js +0 -4
  16. package/dist/cjs/transformer/id.js +1 -5
  17. package/dist/cjs/transformer/index.js +0 -18
  18. package/dist/cjs/version.js +1 -1
  19. package/dist/es/index.js +5 -5
  20. package/dist/es/jats/{jats-exporter.js → exporter/jats-exporter.js} +300 -411
  21. package/dist/es/jats/{jats-versions.js → exporter/jats-versions.js} +0 -1
  22. package/dist/es/{transformer → jats/exporter}/labels.js +4 -4
  23. package/dist/{cjs/transformer/model-map.js → es/jats/importer/create-article-node.js} +8 -10
  24. package/dist/es/jats/importer/jats-comments.js +32 -107
  25. package/dist/es/jats/importer/{jats-body-dom-parser.js → jats-dom-parser.js} +350 -10
  26. package/dist/es/jats/importer/jats-journal-meta-parser.js +9 -0
  27. package/dist/es/jats/importer/jats-parser-utils.js +78 -11
  28. package/dist/es/jats/importer/jats-transformations.js +377 -0
  29. package/dist/es/jats/importer/parse-jats-article.js +44 -99
  30. package/dist/es/jats/index.js +5 -3
  31. package/dist/{types/transformer/timestamp.d.ts → es/lib/deafults.js} +2 -2
  32. package/dist/es/lib/utils.js +1 -0
  33. package/dist/es/schema/nodes/highlight_marker.js +0 -4
  34. package/dist/es/transformer/id.js +0 -3
  35. package/dist/es/transformer/index.js +0 -16
  36. package/dist/es/version.js +1 -1
  37. package/dist/types/index.d.ts +6 -6
  38. package/dist/types/jats/{jats-exporter.d.ts → exporter/jats-exporter.d.ts} +16 -29
  39. package/dist/types/jats/{jats-versions.d.ts → exporter/jats-versions.d.ts} +0 -1
  40. package/dist/types/{transformer → jats/exporter}/labels.d.ts +2 -2
  41. package/dist/{es/transformer/footnote-category.js → types/jats/importer/create-article-node.d.ts} +3 -2
  42. package/dist/types/jats/importer/jats-comments.d.ts +2 -15
  43. package/dist/types/jats/importer/{jats-body-dom-parser.d.ts → jats-dom-parser.d.ts} +1 -1
  44. package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +9 -0
  45. package/dist/types/jats/importer/jats-parser-utils.d.ts +2 -2
  46. package/dist/types/jats/importer/jats-transformations.d.ts +33 -0
  47. package/dist/types/jats/importer/parse-jats-article.d.ts +12 -5
  48. package/dist/types/jats/index.d.ts +5 -3
  49. package/dist/types/jats/types.d.ts +1 -0
  50. package/dist/{es/transformer/models.js → types/lib/deafults.d.ts} +2 -2
  51. package/dist/types/lib/utils.d.ts +1 -0
  52. package/dist/types/schema/nodes/bibliography_item.d.ts +3 -3
  53. package/dist/types/schema/nodes/contributor.d.ts +10 -0
  54. package/dist/types/schema/nodes/highlight_marker.d.ts +0 -2
  55. package/dist/types/schema/nodes/keyword_group.d.ts +1 -0
  56. package/dist/types/schema/nodes/manuscript.d.ts +8 -7
  57. package/dist/types/schema/nodes/title.d.ts +0 -3
  58. package/dist/types/transformer/id.d.ts +0 -3
  59. package/dist/types/transformer/index.d.ts +0 -16
  60. package/dist/types/version.d.ts +1 -1
  61. package/package.json +2 -1
  62. package/dist/cjs/__tests__/data/project-dump.json +0 -825
  63. package/dist/cjs/jats/importer/index.js +0 -22
  64. package/dist/cjs/jats/importer/jats-front-parser.js +0 -321
  65. package/dist/cjs/jats/importer/jats-reference-parser.js +0 -130
  66. package/dist/cjs/jats/importer/jats-references.js +0 -34
  67. package/dist/cjs/transformer/__tests__/__helpers__/doc.js +0 -37
  68. package/dist/cjs/transformer/builders.js +0 -219
  69. package/dist/cjs/transformer/decode.js +0 -898
  70. package/dist/cjs/transformer/document-object-types.js +0 -31
  71. package/dist/cjs/transformer/encode.js +0 -674
  72. package/dist/cjs/transformer/footnote-category.js +0 -20
  73. package/dist/cjs/transformer/footnotes-order.js +0 -60
  74. package/dist/cjs/transformer/highlight-markers.js +0 -138
  75. package/dist/cjs/transformer/html.js +0 -400
  76. package/dist/cjs/transformer/manuscript-dependencies.js +0 -21
  77. package/dist/cjs/transformer/object-types.js +0 -57
  78. package/dist/cjs/transformer/project-bundle.js +0 -94
  79. package/dist/cjs/transformer/serializer.js +0 -23
  80. package/dist/cjs/transformer/timestamp.js +0 -20
  81. package/dist/cjs/transformer/update-identifiers.js +0 -93
  82. package/dist/es/__tests__/data/project-dump.json +0 -825
  83. package/dist/es/jats/importer/index.js +0 -16
  84. package/dist/es/jats/importer/jats-front-parser.js +0 -315
  85. package/dist/es/jats/importer/jats-reference-parser.js +0 -127
  86. package/dist/es/jats/importer/jats-references.js +0 -30
  87. package/dist/es/transformer/__tests__/__helpers__/doc.js +0 -29
  88. package/dist/es/transformer/builders.js +0 -186
  89. package/dist/es/transformer/decode.js +0 -888
  90. package/dist/es/transformer/document-object-types.js +0 -28
  91. package/dist/es/transformer/encode.js +0 -664
  92. package/dist/es/transformer/filename.js +0 -23
  93. package/dist/es/transformer/footnotes-order.js +0 -55
  94. package/dist/es/transformer/highlight-markers.js +0 -132
  95. package/dist/es/transformer/html.js +0 -393
  96. package/dist/es/transformer/manuscript-dependencies.js +0 -17
  97. package/dist/es/transformer/model-map.js +0 -22
  98. package/dist/es/transformer/object-types.js +0 -52
  99. package/dist/es/transformer/project-bundle.js +0 -85
  100. package/dist/es/transformer/serializer.js +0 -17
  101. package/dist/es/transformer/timestamp.js +0 -16
  102. package/dist/es/transformer/update-identifiers.js +0 -87
  103. package/dist/types/jats/importer/index.d.ts +0 -16
  104. package/dist/types/jats/importer/jats-front-parser.d.ts +0 -84
  105. package/dist/types/jats/importer/jats-reference-parser.d.ts +0 -19
  106. package/dist/types/jats/importer/jats-references.d.ts +0 -12
  107. package/dist/types/transformer/__tests__/__helpers__/doc.d.ts +0 -18
  108. package/dist/types/transformer/builders.d.ts +0 -61
  109. package/dist/types/transformer/decode.d.ts +0 -52
  110. package/dist/types/transformer/document-object-types.d.ts +0 -17
  111. package/dist/types/transformer/encode.d.ts +0 -29
  112. package/dist/types/transformer/filename.d.ts +0 -16
  113. package/dist/types/transformer/footnote-category.d.ts +0 -17
  114. package/dist/types/transformer/footnotes-order.d.ts +0 -22
  115. package/dist/types/transformer/highlight-markers.d.ts +0 -31
  116. package/dist/types/transformer/html.d.ts +0 -36
  117. package/dist/types/transformer/manuscript-dependencies.d.ts +0 -4
  118. package/dist/types/transformer/model-map.d.ts +0 -19
  119. package/dist/types/transformer/models.d.ts +0 -48
  120. package/dist/types/transformer/object-types.d.ts +0 -30
  121. package/dist/types/transformer/project-bundle.d.ts +0 -30
  122. package/dist/types/transformer/serializer.d.ts +0 -19
  123. package/dist/types/transformer/update-identifiers.d.ts +0 -23
  124. package/dist/types/types.d.ts +0 -2
  125. /package/dist/cjs/{types.js → jats/types.js} +0 -0
  126. /package/dist/es/{types.js → jats/types.js} +0 -0
@@ -1,31 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { CommentAnnotation, Model } from '@manuscripts/json-schema';
17
- export type HighlightableField = 'title' | 'caption' | 'contents';
18
- export declare const highlightableFields: HighlightableField[];
19
- export declare const isHighlightableModel: (model: Model) => model is HighlightableModel;
20
- export interface HighlightableModel extends Model {
21
- contents?: string;
22
- title?: string;
23
- caption?: string;
24
- }
25
- export type CommentMarker = {
26
- _id: string;
27
- from: number;
28
- to: number;
29
- };
30
- export declare const extractCommentMarkers: (model: Model) => CommentMarker[];
31
- export declare const insertHighlightMarkers: (contents: string, commentAnnotations: CommentAnnotation[]) => string;
@@ -1,36 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Model } from '@manuscripts/json-schema';
17
- import { ManuscriptFragment } from '../schema';
18
- import { IDGenerator, MediaPathGenerator } from '../types';
19
- export interface HTMLExporterOptions {
20
- idGenerator?: IDGenerator;
21
- mediaPathGenerator?: MediaPathGenerator;
22
- }
23
- export declare class HTMLTransformer {
24
- private document;
25
- private modelMap;
26
- private labelTargets?;
27
- serializeToHTML: (fragment: ManuscriptFragment, modelMap: Map<string, Model>, options?: HTMLExporterOptions) => Promise<string>;
28
- protected rewriteMediaPaths: (mediaPathGenerator: MediaPathGenerator) => Promise<void>;
29
- protected rewriteIDs: (idGenerator?: IDGenerator) => Promise<void>;
30
- private buildFront;
31
- private buildContributors;
32
- private buildBody;
33
- private idSelector;
34
- private fixFigure;
35
- private fixBody;
36
- }
@@ -1,4 +0,0 @@
1
- import { Model } from '@manuscripts/json-schema';
2
- export declare const fromPrototype: <T extends Model>(model: T) => T & {
3
- prototype: string;
4
- };
@@ -1,19 +0,0 @@
1
- /*!
2
- * © 2020 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Model } from '@manuscripts/json-schema';
17
- import { Build } from './builders';
18
- export type AddModel = <T extends Model>(data: Partial<T> | Build<T>) => void;
19
- export declare const addModelToMap: (modelMap: Map<string, Model>) => AddModel;
@@ -1,48 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Model, UserProfile } from '@manuscripts/json-schema';
17
- import { ManuscriptNode } from '../schema';
18
- export interface Attachment {
19
- id: string;
20
- data: Blob | ArrayBuffer;
21
- type: string;
22
- }
23
- export interface ModelAttachment {
24
- attachment?: Attachment;
25
- }
26
- export type ModelWithAttachment = Model & ModelAttachment;
27
- export interface UserProfileWithAvatar extends UserProfile {
28
- avatar?: string;
29
- }
30
- export interface ContainedProps {
31
- containerID: string;
32
- }
33
- export type ContainedModel = Model & ContainedProps;
34
- export interface ManuscriptProps {
35
- manuscriptID: string;
36
- }
37
- export type ManuscriptModel = ContainedModel & ManuscriptProps;
38
- export interface CommentSelector {
39
- from: number;
40
- to: number;
41
- }
42
- export interface PlaceholderElement extends ContainedModel {
43
- elementType: 'p';
44
- }
45
- export interface Selected {
46
- pos: number;
47
- node: ManuscriptNode;
48
- }
@@ -1,30 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { CommentAnnotation, Figure, Keyword, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
17
- import { ManuscriptModel } from './models';
18
- export declare enum ExtraObjectTypes {
19
- PlaceholderElement = "MPPlaceholderElement",
20
- GeneralTableFootnote = "MPGeneralTableFootnote"
21
- }
22
- export declare const elementObjects: ObjectTypes[];
23
- export declare const manuscriptObjects: ObjectTypes[];
24
- export declare const isManuscriptModel: (model: Model) => model is ManuscriptModel;
25
- export declare const hasObjectType: <T extends Model>(objectType: string) => (model: Model) => model is T;
26
- export declare const isFigure: (model: Model) => model is Figure;
27
- export declare const isManuscript: (model: Model) => model is Manuscript;
28
- export declare const isTable: (model: Model) => model is Table;
29
- export declare const isCommentAnnotation: (model: Model) => model is CommentAnnotation;
30
- export declare const isKeyword: (model: Model) => model is Keyword;
@@ -1,30 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Journal, Manuscript, Model, ObjectTypes, Titles } from '@manuscripts/json-schema';
17
- import { ManuscriptModel } from './models';
18
- export interface ProjectBundle {
19
- version: string;
20
- data: Model[];
21
- }
22
- export declare const parseProjectBundle: (projectBundle: ProjectBundle, manuscriptID?: string) => {
23
- doc: import("prosemirror-model").Node;
24
- modelMap: Map<string, Model>;
25
- };
26
- export declare const findManuscript: (modelMap: Map<string, Model>) => Manuscript;
27
- export declare const findJournal: (modelMap: Map<string, Model>) => Journal | null;
28
- export declare const findManuscriptModelByType: <T extends ManuscriptModel>(modelMap: Map<string, Model>, manuscript: Manuscript, objectType: ObjectTypes) => T | undefined;
29
- export declare const findManuscriptById: (modelMap: Map<string, Model>, manuscriptID: string) => Manuscript;
30
- export declare const findTitles: (modelMap: Map<string, Model>) => Titles;
@@ -1,19 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import serializeToString from 'w3c-xmlserializer';
17
- export declare const xmlSerializer: {
18
- serializeToString: typeof serializeToString;
19
- };
@@ -1,23 +0,0 @@
1
- /*!
2
- * © 2020 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Model } from '@manuscripts/json-schema';
17
- import JSZip from 'jszip';
18
- export declare const updateIdentifiers: (data: Model[]) => Promise<{
19
- data: Model[];
20
- idMap: Map<string, string>;
21
- }>;
22
- export declare const updateAttachmentPath: (oldPath: string, idMap: Map<string, string>) => string | undefined;
23
- export declare const updateAttachments: (zip: JSZip, idMap: Map<string, string>) => Promise<void>;
@@ -1,2 +0,0 @@
1
- export type IDGenerator = (element: Element) => Promise<string | null>;
2
- export type MediaPathGenerator = (element: Element, parentID: string) => Promise<string>;
File without changes
File without changes