linked-rolls 0.58.0 → 0.59.0
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/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/io/asJsonLd.js +0 -2
- package/lib/io/importJsonLd.js +1 -1
- package/lib/io/migrate.d.ts +0 -9
- package/lib/io/migrate.js +11 -26
- package/lib/spec/context.json +0 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export * from './analysis/sigla.js';
|
|
|
45
45
|
export * from './model/notes.js';
|
|
46
46
|
export { asJsonLd } from './io/asJsonLd.js';
|
|
47
47
|
export { importJsonLd } from './io/importJsonLd.js';
|
|
48
|
-
export {
|
|
48
|
+
export { migrate } from './io/migrate.js';
|
|
49
49
|
export { readFromStanfordAton, type StanfordAtonOptions } from './readers/stanfordAton.js';
|
|
50
50
|
export { readFromPhillipsEroll, CONTROL_OFFSET, phillipsSystems, type PhillipsErollOptions } from './readers/phillipsEroll.js';
|
|
51
51
|
export { readFromSpencerBar, readSpencerAnn, paperSpeedOfSpencerAnn, SPENCER_ROWS_PER_INCH, type SpencerBarOptions } from './readers/spencerBar.js';
|
package/lib/index.js
CHANGED
|
@@ -38,7 +38,7 @@ export * from './analysis/sigla.js';
|
|
|
38
38
|
export * from './model/notes.js';
|
|
39
39
|
export { asJsonLd } from './io/asJsonLd.js';
|
|
40
40
|
export { importJsonLd } from './io/importJsonLd.js';
|
|
41
|
-
export {
|
|
41
|
+
export { migrate } from './io/migrate.js';
|
|
42
42
|
export { readFromStanfordAton } from './readers/stanfordAton.js';
|
|
43
43
|
export { readFromPhillipsEroll, CONTROL_OFFSET, phillipsSystems } from './readers/phillipsEroll.js';
|
|
44
44
|
export { readFromSpencerBar, readSpencerAnn, paperSpeedOfSpencerAnn, SPENCER_ROWS_PER_INCH } from './readers/spencerBar.js';
|
package/lib/io/asJsonLd.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { systemIdIn } from "../systems/TrackerBar.js";
|
|
2
2
|
import { certaintyOf, isAsserted } from "../model/Assumption.js";
|
|
3
3
|
import context from "../spec/context.json" with { type: 'json' };
|
|
4
|
-
import { formatVersion } from "./migrate.js";
|
|
5
4
|
/**
|
|
6
5
|
* The keys an export derives from the tree, which no node of the
|
|
7
6
|
* edition states itself. An import reads them off again.
|
|
@@ -164,7 +163,6 @@ export const asJsonLd = (edition) => {
|
|
|
164
163
|
}
|
|
165
164
|
],
|
|
166
165
|
'@id': edition.base,
|
|
167
|
-
formatVersion,
|
|
168
166
|
...rest,
|
|
169
167
|
...(quoted.length > 0 && { '@included': quoted })
|
|
170
168
|
};
|
package/lib/io/importJsonLd.js
CHANGED
|
@@ -119,7 +119,7 @@ const withQuotedStatementsInPlace = (edition) => {
|
|
|
119
119
|
return withReferencesOn({ ...rest, ...(others.length > 0 && { '@included': others }) }, bySubject);
|
|
120
120
|
};
|
|
121
121
|
export const importJsonLd = (json) => {
|
|
122
|
-
const { '@context': context,
|
|
122
|
+
const { '@context': context, ...document } = withPlainCopyIds(migrate(withQuotedStatementsInPlace(json)));
|
|
123
123
|
const edition = fromJsonLdEntity(document);
|
|
124
124
|
edition.base = Array.isArray(context)
|
|
125
125
|
? context.find((c) => c['@base'])?.['@base'] || ''
|
package/lib/io/migrate.d.ts
CHANGED
|
@@ -13,14 +13,5 @@
|
|
|
13
13
|
type Json = any;
|
|
14
14
|
/** A copy's id without the `copy/` that documents of earlier releases put before it. */
|
|
15
15
|
export declare const plainCopyId: (id: string) => string;
|
|
16
|
-
/**
|
|
17
|
-
* The revision of the format this release writes, stated in every export
|
|
18
|
-
* as `formatVersion`. A document stating it is in the current shape and
|
|
19
|
-
* passes through untouched; one stating none was written before the
|
|
20
|
-
* revisions were numbered and is brought up by recognising its shapes.
|
|
21
|
-
* A step added later is to run on the documents of the revisions before
|
|
22
|
-
* it, and to raise this number.
|
|
23
|
-
*/
|
|
24
|
-
export declare const formatVersion = 1;
|
|
25
16
|
export declare const migrate: (edition: Json) => Json;
|
|
26
17
|
export {};
|
package/lib/io/migrate.js
CHANGED
|
@@ -4,10 +4,10 @@ import { welteT100 } from "../systems/welteT100/bar.js";
|
|
|
4
4
|
import { isDateString } from "../shared/utils.js";
|
|
5
5
|
const retiredVersionTypes = new Set(['edition', 'unicum']);
|
|
6
6
|
/**
|
|
7
|
-
* The vocabulary the steps below were written against, as it stood
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* The vocabulary the steps below were written against, as it stood in
|
|
8
|
+
* release 0.58.0. It is copied here rather than imported from the model,
|
|
9
|
+
* so that changing today's vocabulary cannot change how an old document
|
|
10
|
+
* is read. The tracker bars are still
|
|
11
11
|
* asked, being the layout of instruments rather than a choice of the
|
|
12
12
|
* format.
|
|
13
13
|
*/
|
|
@@ -511,27 +511,12 @@ const withDerivationTolerance = (edition) => {
|
|
|
511
511
|
: version)
|
|
512
512
|
};
|
|
513
513
|
};
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
* as `formatVersion`. A document stating it is in the current shape and
|
|
518
|
-
* passes through untouched; one stating none was written before the
|
|
519
|
-
* revisions were numbered and is brought up by recognising its shapes.
|
|
520
|
-
* A step added later is to run on the documents of the revisions before
|
|
521
|
-
* it, and to raise this number.
|
|
522
|
-
*/
|
|
523
|
-
export const formatVersion = 1;
|
|
524
|
-
export const migrate = (edition) => {
|
|
525
|
-
const stated = edition?.formatVersion;
|
|
526
|
-
if (stated === formatVersion)
|
|
514
|
+
/** Release 0.58.0 stated a revision of the format, which the format does not state. */
|
|
515
|
+
const withoutFormatVersion = (edition) => {
|
|
516
|
+
if (!Object.hasOwn(edition, 'formatVersion'))
|
|
527
517
|
return edition;
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
const current = walk(editionSteps.reduce((result, step) => step(result), edition));
|
|
532
|
-
// What comes out is in the current revision and says so, so that it
|
|
533
|
-
// passes through untouched when it is migrated again.
|
|
534
|
-
return current !== null && typeof current === 'object' && !Array.isArray(current)
|
|
535
|
-
? { ...current, formatVersion }
|
|
536
|
-
: current;
|
|
518
|
+
const { formatVersion: _stated, ...rest } = edition;
|
|
519
|
+
return rest;
|
|
537
520
|
};
|
|
521
|
+
const editionSteps = [withoutFormatVersion, withoutEditionType, withSystems, withEditors, withDerivationTolerance];
|
|
522
|
+
export const migrate = (edition) => walk(editionSteps.reduce((result, step) => step(result), edition));
|
package/lib/spec/context.json
CHANGED
package/package.json
CHANGED