linked-rolls 0.27.0 → 0.28.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/README.md +6 -3
- package/lib/RollCopy.d.ts +6 -0
- package/lib/Version.d.ts +6 -2
- package/lib/Version.js +8 -2
- package/lib/editionOps.d.ts +2 -0
- package/lib/editionOps.js +8 -0
- package/lib/schema.json +5 -0
- package/lib/witnesses.d.ts +10 -1
- package/lib/witnesses.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,9 +88,12 @@ no features to carry the symbols of a version. It states instead
|
|
|
88
88
|
which versions it is held to carry, in `carries`, each under a belief
|
|
89
89
|
that says how certainly and why. `witnessesOf` gathers the copies of a
|
|
90
90
|
version, whether their features carry its symbols or they state that
|
|
91
|
-
they carry it,
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
they carry it, a statement with the belief it rests on;
|
|
92
|
+
`versionsWitnessedBy` gathers the same from the side of a copy.
|
|
93
|
+
`carriageProblems` reports a statement made beside features that carry
|
|
94
|
+
symbols already, or one naming a version the edition lacks. A copy may
|
|
95
|
+
carry a `siglum`, as a version does; one without is named by its
|
|
96
|
+
keeper.
|
|
94
97
|
|
|
95
98
|
```ts
|
|
96
99
|
import { reservationsAbout, stateSource } from 'linked-rolls'
|
package/lib/RollCopy.d.ts
CHANGED
|
@@ -273,6 +273,12 @@ export interface RollCopy extends WithType<'RollCopy'>, WithId {
|
|
|
273
273
|
* @see crm:P44 has condition
|
|
274
274
|
*/
|
|
275
275
|
conditions: RollConditionAssignment[];
|
|
276
|
+
/**
|
|
277
|
+
* A short siglum to identify the copy, e.g. "W1" or "S2". A copy
|
|
278
|
+
* without one is named by its keeper.
|
|
279
|
+
* @see reo:siglum
|
|
280
|
+
*/
|
|
281
|
+
siglum?: string;
|
|
276
282
|
/**
|
|
277
283
|
* The institution or person holding this copy. Left out where it is
|
|
278
284
|
* not known, as for a copy known only from a recording.
|
package/lib/Version.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Edit } from "./Edit";
|
|
2
2
|
import { Concept } from "./Agent";
|
|
3
|
-
import { ActorAssignment, Certainty, DateAssignment, ReferenceAssumption } from "./Assumption";
|
|
3
|
+
import { ActorAssignment, Belief, Certainty, DateAssignment, ReferenceAssumption } from "./Assumption";
|
|
4
4
|
import { CollationTolerance } from "./Collation";
|
|
5
5
|
import { AnySymbol } from "./Symbol";
|
|
6
6
|
import { WithId, WithNote, WithType } from "./utils";
|
|
@@ -136,10 +136,14 @@ export declare const editsOf: (version: Readonly<Version>) => Edit[];
|
|
|
136
136
|
export declare const insertedBy: (version: Readonly<Version>) => AnySymbol[];
|
|
137
137
|
/** The ids of the symbols the version's edits delete. */
|
|
138
138
|
export declare const deletedBy: (version: Readonly<Version>) => string[];
|
|
139
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* The parents the version names, in the order of `basedOn`, each with the
|
|
141
|
+
* certainty its derivation is held with and the belief it rests on.
|
|
142
|
+
*/
|
|
140
143
|
export declare const derivationsOf: (version: Readonly<Version>) => {
|
|
141
144
|
parent: string;
|
|
142
145
|
certainty: Certainty;
|
|
146
|
+
belief?: Belief;
|
|
143
147
|
}[];
|
|
144
148
|
/**
|
|
145
149
|
* The derivation the version's text is read against: the first of those
|
package/lib/Version.js
CHANGED
|
@@ -19,8 +19,14 @@ export const editsOf = (version) => version.edits ?? [];
|
|
|
19
19
|
export const insertedBy = (version) => editsOf(version).flatMap(edit => edit.insert ?? []);
|
|
20
20
|
/** The ids of the symbols the version's edits delete. */
|
|
21
21
|
export const deletedBy = (version) => editsOf(version).flatMap(edit => edit.delete ?? []);
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The parents the version names, in the order of `basedOn`, each with the
|
|
24
|
+
* certainty its derivation is held with and the belief it rests on.
|
|
25
|
+
*/
|
|
26
|
+
export const derivationsOf = (version) => (version.basedOn ?? []).map(derivation => {
|
|
27
|
+
const belief = derivation['@annotation']?.belief;
|
|
28
|
+
return { parent: idOf(derivation), certainty: certaintyOf(derivation), ...(belief && { belief }) };
|
|
29
|
+
});
|
|
24
30
|
const rankOf = (derivation) => certainties.indexOf(certaintyOf(derivation));
|
|
25
31
|
/**
|
|
26
32
|
* The derivation the version's text is read against: the first of those
|
package/lib/editionOps.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export declare const unalignCopy: (copyId: string) => EditionOp;
|
|
|
44
44
|
export declare const stateSource: (copyId: string, source: FeatureSource) => EditionOp;
|
|
45
45
|
/** Takes back the statement, leaving the copy silent about its source again. */
|
|
46
46
|
export declare const clearSource: (copyId: string) => EditionOp;
|
|
47
|
+
/** Gives the copy the siglum it is referred to by, or takes it away where the siglum given is blank. */
|
|
48
|
+
export declare const nameCopy: (copyId: string, siglum: string) => EditionOp;
|
|
47
49
|
/**
|
|
48
50
|
* States that the copy carries the version, under the belief given. It
|
|
49
51
|
* is meant for a copy whose features are not read into symbols, such as
|
package/lib/editionOps.js
CHANGED
|
@@ -135,6 +135,14 @@ export const stateSource = (copyId, source) => onCopy(copyId, copy => {
|
|
|
135
135
|
export const clearSource = (copyId) => onCopy(copyId, copy => {
|
|
136
136
|
copy.readFrom = undefined;
|
|
137
137
|
});
|
|
138
|
+
/** Gives the copy the siglum it is referred to by, or takes it away where the siglum given is blank. */
|
|
139
|
+
export const nameCopy = (copyId, siglum) => onCopy(copyId, copy => {
|
|
140
|
+
const trimmed = siglum.trim();
|
|
141
|
+
if (trimmed)
|
|
142
|
+
copy.siglum = trimmed;
|
|
143
|
+
else
|
|
144
|
+
delete copy.siglum;
|
|
145
|
+
});
|
|
138
146
|
/** A reference under the belief given, where one is given. */
|
|
139
147
|
const referenceHeld = (id, belief) => ({ ...assignReference(id), ...(belief && { '@annotation': { id: v4(), belief } }) });
|
|
140
148
|
/** The references less those that match, or nothing where none is left. */
|
package/lib/schema.json
CHANGED
|
@@ -2270,6 +2270,11 @@
|
|
|
2270
2270
|
"type": "string",
|
|
2271
2271
|
"ontology": "crm:P138i has representation"
|
|
2272
2272
|
},
|
|
2273
|
+
"siglum": {
|
|
2274
|
+
"description": "A short siglum to identify the copy, e.g. \"W1\" or \"S2\". A copy without one is named by its keeper.",
|
|
2275
|
+
"type": "string",
|
|
2276
|
+
"ontology": "reo:siglum"
|
|
2277
|
+
},
|
|
2273
2278
|
"@id": {
|
|
2274
2279
|
"description": "A unique identifier for this object.",
|
|
2275
2280
|
"type": "string"
|
package/lib/witnesses.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Certainty } from "./Assumption";
|
|
1
|
+
import { Belief, Certainty } from "./Assumption";
|
|
2
2
|
import { EditionView } from "./EditionView";
|
|
3
3
|
export type WitnessBy = 'carriers' | 'statement';
|
|
4
4
|
/** A copy that bears witness to a version, and how. */
|
|
@@ -9,6 +9,8 @@ export interface Witness {
|
|
|
9
9
|
by: WitnessBy;
|
|
10
10
|
/** How certainly a statement is held. Carriage through features is no statement and holds none. */
|
|
11
11
|
certainty?: Certainty;
|
|
12
|
+
/** The belief a statement rests on, where it states one. */
|
|
13
|
+
belief?: Belief;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* The copies that bear witness to the version: those whose features carry
|
|
@@ -20,6 +22,13 @@ export interface Witness {
|
|
|
20
22
|
* are not stated is witnessed by statement alone.
|
|
21
23
|
*/
|
|
22
24
|
export declare const witnessesOf: (view: EditionView, versionId: string) => Witness[];
|
|
25
|
+
/**
|
|
26
|
+
* The versions the copy bears witness to, each with how, in the order the
|
|
27
|
+
* edition lists its versions.
|
|
28
|
+
*/
|
|
29
|
+
export declare const versionsWitnessedBy: (view: EditionView, copyId: string) => (Witness & {
|
|
30
|
+
version: string;
|
|
31
|
+
})[];
|
|
23
32
|
export type CarriageProblem = {
|
|
24
33
|
copy: string;
|
|
25
34
|
version: string;
|
package/lib/witnesses.js
CHANGED
|
@@ -28,9 +28,19 @@ export const witnessesOf = (view, versionId) => {
|
|
|
28
28
|
.filter(copy => !carrying.has(copy.id))
|
|
29
29
|
.flatMap(copy => (copy.carries ?? [])
|
|
30
30
|
.filter(statement => idOf(statement) === versionId)
|
|
31
|
-
.map((statement) =>
|
|
31
|
+
.map((statement) => {
|
|
32
|
+
const belief = statement['@annotation']?.belief;
|
|
33
|
+
return { copy: copy.id, by: 'statement', certainty: certaintyOf(statement), ...(belief && { belief }) };
|
|
34
|
+
}));
|
|
32
35
|
return [...byCarriers, ...byStatement];
|
|
33
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* The versions the copy bears witness to, each with how, in the order the
|
|
39
|
+
* edition lists its versions.
|
|
40
|
+
*/
|
|
41
|
+
export const versionsWitnessedBy = (view, copyId) => view.edition.versions.flatMap(version => witnessesOf(view, version.id)
|
|
42
|
+
.filter(witness => witness.copy === copyId)
|
|
43
|
+
.map(witness => ({ ...witness, version: version.id })));
|
|
34
44
|
/**
|
|
35
45
|
* Where a copy's statement that it carries a version cannot stand: one
|
|
36
46
|
* made although the copy's features carry symbols, which say by
|
package/package.json
CHANGED