@manuscripts/transform 3.0.27-fix-migration3021.0 → 3.0.27-fix-migration3021.2

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.
@@ -28,7 +28,7 @@ function migrateFor(oldDoc, baseVersion) {
28
28
  continue;
29
29
  }
30
30
  console.log('Migrating doc with script to version ' + script.toVersion);
31
- migratedDoc = migrate(migratedDoc, script.migrateNode);
31
+ migratedDoc = migrate(migratedDoc, (node, oldDoc) => script.migrateNode(node, oldDoc));
32
32
  }
33
33
  return testDoc(migratedDoc, baseVersion);
34
34
  }
@@ -4,19 +4,19 @@ class Migration3021 {
4
4
  constructor() {
5
5
  this.fromVersion = '3.0.20';
6
6
  this.toVersion = '3.0.21';
7
- }
8
- migrateNode(node) {
9
- const suffixMap = new Map([
7
+ this.suffixMap = new Map([
10
8
  ['competing-interests', 'coi-statement'],
11
9
  ['acknowledgement', 'acknowledgements'],
12
10
  ['introduction', 'intro'],
13
11
  ['materials-method', 'methods'],
14
12
  ['subsection', ''],
15
13
  ]);
14
+ }
15
+ migrateNode(node) {
16
16
  if (node.type === 'section' &&
17
17
  node.attrs.category.startsWith('MPSectionCategory:')) {
18
18
  const [, suffix] = node.attrs.category.split(':', 2);
19
- const newCategory = suffixMap.get(suffix) || suffix;
19
+ const newCategory = this.suffixMap.get(suffix) || suffix;
20
20
  return Object.assign(Object.assign({}, node), { attrs: Object.assign(Object.assign({}, node.attrs), { category: newCategory }) });
21
21
  }
22
22
  return node;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "3.0.27-fix-migration3021.0";
4
+ exports.VERSION = "3.0.27-fix-migration3021.2";
@@ -21,7 +21,7 @@ export function migrateFor(oldDoc, baseVersion) {
21
21
  continue;
22
22
  }
23
23
  console.log('Migrating doc with script to version ' + script.toVersion);
24
- migratedDoc = migrate(migratedDoc, script.migrateNode);
24
+ migratedDoc = migrate(migratedDoc, (node, oldDoc) => script.migrateNode(node, oldDoc));
25
25
  }
26
26
  return testDoc(migratedDoc, baseVersion);
27
27
  }
@@ -2,19 +2,19 @@ class Migration3021 {
2
2
  constructor() {
3
3
  this.fromVersion = '3.0.20';
4
4
  this.toVersion = '3.0.21';
5
- }
6
- migrateNode(node) {
7
- const suffixMap = new Map([
5
+ this.suffixMap = new Map([
8
6
  ['competing-interests', 'coi-statement'],
9
7
  ['acknowledgement', 'acknowledgements'],
10
8
  ['introduction', 'intro'],
11
9
  ['materials-method', 'methods'],
12
10
  ['subsection', ''],
13
11
  ]);
12
+ }
13
+ migrateNode(node) {
14
14
  if (node.type === 'section' &&
15
15
  node.attrs.category.startsWith('MPSectionCategory:')) {
16
16
  const [, suffix] = node.attrs.category.split(':', 2);
17
- const newCategory = suffixMap.get(suffix) || suffix;
17
+ const newCategory = this.suffixMap.get(suffix) || suffix;
18
18
  return Object.assign(Object.assign({}, node), { attrs: Object.assign(Object.assign({}, node.attrs), { category: newCategory }) });
19
19
  }
20
20
  return node;
@@ -1 +1 @@
1
- export const VERSION = "3.0.27-fix-migration3021.0";
1
+ export const VERSION = "3.0.27-fix-migration3021.2";
@@ -3,6 +3,7 @@ import { MigrationScript } from '../migration-script';
3
3
  declare class Migration3021 implements MigrationScript {
4
4
  fromVersion: string;
5
5
  toVersion: string;
6
+ private suffixMap;
6
7
  migrateNode(node: JSONNode): JSONNode;
7
8
  }
8
9
  export default Migration3021;
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.27-fix-migration3021.0";
1
+ export declare const VERSION = "3.0.27-fix-migration3021.2";
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": "3.0.27-fix-migration3021.0",
4
+ "version": "3.0.27-fix-migration3021.2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",