linked-rolls 0.70.0 → 0.72.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.
Files changed (143) hide show
  1. package/README.md +106 -5
  2. package/lib/analysis/constraints.d.ts +7 -0
  3. package/lib/analysis/constraints.js +1 -0
  4. package/lib/analysis/ownPaper.d.ts +5 -1
  5. package/lib/analysis/ownPaper.js +5 -1
  6. package/lib/analysis/paper.d.ts +22 -4
  7. package/lib/analysis/paper.js +6 -0
  8. package/lib/analysis/reservations.d.ts +24 -1
  9. package/lib/analysis/reservations.js +15 -1
  10. package/lib/analysis/sigla.d.ts +6 -1
  11. package/lib/analysis/sigla.js +5 -1
  12. package/lib/analysis/stemma.d.ts +6 -1
  13. package/lib/analysis/stemma.js +6 -1
  14. package/lib/analysis/text.d.ts +16 -2
  15. package/lib/analysis/text.js +16 -2
  16. package/lib/analysis/witnesses.d.ts +20 -1
  17. package/lib/analysis/witnesses.js +4 -0
  18. package/lib/collation/Collation.d.ts +47 -8
  19. package/lib/collation/Collation.js +29 -5
  20. package/lib/collation/alignment.d.ts +16 -3
  21. package/lib/collation/alignment.js +15 -3
  22. package/lib/collation/scatter.d.ts +50 -9
  23. package/lib/collation/scatter.js +11 -1
  24. package/lib/collation/statistics.d.ts +39 -9
  25. package/lib/collation/statistics.js +27 -6
  26. package/lib/collation/substitution.d.ts +5 -0
  27. package/lib/collation/substitution.js +4 -0
  28. package/lib/emulation/Emulation.d.ts +16 -1
  29. package/lib/emulation/Emulation.js +10 -0
  30. package/lib/emulation/negotiation.d.ts +1 -0
  31. package/lib/emulation/negotiation.js +1 -0
  32. package/lib/filiation/adoption.d.ts +47 -0
  33. package/lib/filiation/adoption.js +190 -0
  34. package/lib/filiation/changes.d.ts +33 -0
  35. package/lib/filiation/changes.js +38 -0
  36. package/lib/filiation/index.d.ts +12 -0
  37. package/lib/filiation/index.js +12 -0
  38. package/lib/filiation/presence.d.ts +50 -0
  39. package/lib/filiation/presence.js +122 -0
  40. package/lib/filiation/proposal.d.ts +132 -0
  41. package/lib/filiation/proposal.js +376 -0
  42. package/lib/filiation/readings.d.ts +108 -0
  43. package/lib/filiation/readings.js +281 -0
  44. package/lib/filiation/search.d.ts +113 -0
  45. package/lib/filiation/search.js +268 -0
  46. package/lib/filiation/systems.d.ts +21 -0
  47. package/lib/filiation/systems.js +39 -0
  48. package/lib/filiation/trees.d.ts +20 -0
  49. package/lib/filiation/trees.js +69 -0
  50. package/lib/index.d.ts +34 -2
  51. package/lib/index.js +3 -1
  52. package/lib/io/asJsonLd.d.ts +10 -0
  53. package/lib/io/asJsonLd.js +10 -0
  54. package/lib/io/context.d.ts +16 -2
  55. package/lib/io/context.js +16 -2
  56. package/lib/io/importJsonLd.d.ts +1 -0
  57. package/lib/io/importJsonLd.js +1 -0
  58. package/lib/io/migrate.d.ts +8 -0
  59. package/lib/io/migrate.js +8 -0
  60. package/lib/lookup/lookup.d.ts +29 -5
  61. package/lib/lookup/lookup.js +29 -5
  62. package/lib/lookup/paths.d.ts +23 -3
  63. package/lib/lookup/paths.js +17 -3
  64. package/lib/model/Agent.d.ts +28 -2
  65. package/lib/model/Agent.js +15 -1
  66. package/lib/model/Assumption.d.ts +96 -7
  67. package/lib/model/Assumption.js +65 -7
  68. package/lib/model/ConditionState.d.ts +1 -0
  69. package/lib/model/Edit.d.ts +10 -0
  70. package/lib/model/Edit.js +8 -0
  71. package/lib/model/Edition.d.ts +11 -0
  72. package/lib/model/Edition.js +1 -0
  73. package/lib/model/Feature.d.ts +74 -7
  74. package/lib/model/Feature.js +41 -3
  75. package/lib/model/FeatureSource.d.ts +14 -1
  76. package/lib/model/FeatureSource.js +7 -1
  77. package/lib/model/Perforator.d.ts +10 -0
  78. package/lib/model/Perforator.js +1 -0
  79. package/lib/model/Quantity.d.ts +160 -13
  80. package/lib/model/Quantity.js +110 -6
  81. package/lib/model/RollCopy.d.ts +74 -12
  82. package/lib/model/RollCopy.js +53 -10
  83. package/lib/model/Symbol.d.ts +38 -1
  84. package/lib/model/Symbol.js +16 -0
  85. package/lib/model/TrackCalibration.d.ts +10 -2
  86. package/lib/model/TrackCalibration.js +9 -2
  87. package/lib/model/Version.d.ts +24 -4
  88. package/lib/model/Version.js +19 -4
  89. package/lib/model/notes.d.ts +15 -2
  90. package/lib/model/notes.js +9 -2
  91. package/lib/model/procedures.d.ts +5 -1
  92. package/lib/model/procedures.js +5 -1
  93. package/lib/model/vocabulary.d.ts +6 -1
  94. package/lib/model/vocabulary.js +6 -1
  95. package/lib/ops/beliefs.d.ts +23 -1
  96. package/lib/ops/beliefs.js +23 -1
  97. package/lib/ops/collation.d.ts +3 -0
  98. package/lib/ops/collation.js +3 -0
  99. package/lib/ops/commands.d.ts +17 -2
  100. package/lib/ops/commands.js +17 -2
  101. package/lib/ops/copies.d.ts +37 -6
  102. package/lib/ops/copies.js +37 -6
  103. package/lib/ops/draft.d.ts +2 -0
  104. package/lib/ops/draft.js +1 -0
  105. package/lib/ops/edits.d.ts +5 -1
  106. package/lib/ops/edits.js +5 -1
  107. package/lib/ops/features.d.ts +12 -1
  108. package/lib/ops/features.js +7 -0
  109. package/lib/ops/versions.d.ts +15 -3
  110. package/lib/ops/versions.js +15 -3
  111. package/lib/readers/phillipsEroll.d.ts +12 -1
  112. package/lib/readers/phillipsEroll.js +6 -1
  113. package/lib/readers/spencerBar.d.ts +12 -1
  114. package/lib/readers/spencerBar.js +7 -1
  115. package/lib/readers/stanfordAton.d.ts +15 -0
  116. package/lib/readers/stanfordAton.js +9 -0
  117. package/lib/schema.json +10 -0
  118. package/lib/shared/utils.d.ts +12 -0
  119. package/lib/spec/context.json +4 -0
  120. package/lib/systems/ReproducingSystem.d.ts +46 -3
  121. package/lib/systems/TrackerBar.d.ts +45 -4
  122. package/lib/systems/TrackerBar.js +20 -3
  123. package/lib/systems/index.d.ts +9 -2
  124. package/lib/systems/index.js +9 -2
  125. package/lib/systems/velocity.d.ts +1 -0
  126. package/lib/systems/velocity.js +1 -0
  127. package/lib/systems/welte.d.ts +18 -3
  128. package/lib/systems/welte.js +9 -2
  129. package/lib/systems/welteLicensee/bar.d.ts +1 -0
  130. package/lib/systems/welteLicensee/bar.js +1 -0
  131. package/lib/systems/welteLicensee/system.d.ts +18 -0
  132. package/lib/systems/welteLicensee/system.js +17 -0
  133. package/lib/systems/welteT100/bar.d.ts +8 -0
  134. package/lib/systems/welteT100/bar.js +4 -0
  135. package/lib/systems/welteT100/system.d.ts +46 -5
  136. package/lib/systems/welteT100/system.js +29 -3
  137. package/lib/systems/welteT98/bar.d.ts +6 -0
  138. package/lib/systems/welteT98/bar.js +2 -0
  139. package/lib/systems/welteT98/system.d.ts +58 -5
  140. package/lib/systems/welteT98/system.js +42 -3
  141. package/lib/validate.d.ts +16 -0
  142. package/lib/validate.js +15 -0
  143. package/package.json +2 -1
@@ -10,22 +10,44 @@ const onBeliefAt = (path, op) => onAssumptionAt(path, assumption => {
10
10
  if (belief)
11
11
  op(belief);
12
12
  });
13
- /** Annotates the assumption at the path with a belief held true, for reasons to be added. */
13
+ /**
14
+ * Annotates the assumption at the path with a belief held true, for reasons to be added.
15
+ * @category Operations
16
+ */
14
17
  export const createBelief = (path) => onAssumptionAt(path, assumption => {
15
18
  assumption['@annotation'] = {
16
19
  id: v4(),
17
20
  belief: { type: 'belief', id: v4(), certainty: 'true', reasons: [] }
18
21
  };
19
22
  });
23
+ /**
24
+ * Takes the belief off the assumption at the path, which leaves the
25
+ * statement stated plainly.
26
+ * @category Operations
27
+ */
20
28
  export const clearBelief = (path) => onAssumptionAt(path, assumption => {
21
29
  delete assumption['@annotation'];
22
30
  });
31
+ /**
32
+ * Sets the certainty the belief on the assumption at the path is held
33
+ * with.
34
+ * @category Operations
35
+ */
23
36
  export const setCertainty = (path, certainty) => onBeliefAt(path, belief => {
24
37
  belief.certainty = certainty;
25
38
  });
39
+ /**
40
+ * Adds a reason to the belief on the assumption at the path.
41
+ * @category Operations
42
+ */
26
43
  export const addReason = (path, reason) => onBeliefAt(path, belief => {
27
44
  belief.reasons.push(reason);
28
45
  });
46
+ /**
47
+ * Takes the reason at the index off the belief on the assumption at the
48
+ * path.
49
+ * @category Operations
50
+ */
29
51
  export const removeReason = (path, index) => onBeliefAt(path, belief => {
30
52
  belief.reasons.splice(index, 1);
31
53
  });
@@ -26,12 +26,14 @@ import { EditionOp } from "./draft.js";
26
26
  * A version is based on itself or on one of its own descendants in no
27
27
  * statement, since the stemma would loop; asked for that, nothing
28
28
  * changes.
29
+ * @category Operations
29
30
  */
30
31
  export declare const connectVersions: (childId: string, parentId: string, tolerance?: ObjectAssumption<CollationTolerance>) => EditionOp;
31
32
  /**
32
33
  * Folds the version's own symbols into those it inherits and collates
33
34
  * with: the carriers pass over, and the insertions go. Collates at the
34
35
  * tolerance of the derivation, where the caller names none.
36
+ * @category Operations
35
37
  */
36
38
  export declare const collateSymbols: (versionId: string, symbolIds: readonly string[], tolerance?: CollationTolerance) => EditionOp;
37
39
  /**
@@ -57,5 +59,6 @@ export declare const collateSymbols: (versionId: string, symbolIds: readonly str
57
59
  * and are passed over, so a reading somebody has separated by hand
58
60
  * keeps its identifier and the edit that speaks for it. Named symbols
59
61
  * narrow the act to those; naming none separates the whole reading.
62
+ * @category Operations
60
63
  */
61
64
  export declare const separateReadings: (versionId: string, copies: ReadonlySet<string>, symbolIds?: readonly string[]) => EditionOp;
@@ -60,6 +60,7 @@ const byExchange = (edits) => new Map(edits.map(edit => [exchangeKey((edit.inser
60
60
  * A version is based on itself or on one of its own descendants in no
61
61
  * statement, since the stemma would loop; asked for that, nothing
62
62
  * changes.
63
+ * @category Operations
63
64
  */
64
65
  export const connectVersions = (childId, parentId, tolerance = defaultCollationTolerance) => reading(edition => {
65
66
  if (childId === parentId || derivesFrom(edition.versions, parentId, childId))
@@ -132,6 +133,7 @@ export const connectVersions = (childId, parentId, tolerance = defaultCollationT
132
133
  * Folds the version's own symbols into those it inherits and collates
133
134
  * with: the carriers pass over, and the insertions go. Collates at the
134
135
  * tolerance of the derivation, where the caller names none.
136
+ * @category Operations
135
137
  */
136
138
  export const collateSymbols = (versionId, symbolIds, tolerance) => reading(edition => {
137
139
  const version = versionIn(edition, versionId);
@@ -201,6 +203,7 @@ const sharedWith = (edition, symbol, copies) => {
201
203
  * and are passed over, so a reading somebody has separated by hand
202
204
  * keeps its identifier and the edit that speaks for it. Named symbols
203
205
  * narrow the act to those; naming none separates the whole reading.
206
+ * @category Operations
204
207
  */
205
208
  export const separateReadings = (versionId, copies, symbolIds) => reading(edition => {
206
209
  const version = versionIn(edition, versionId);
@@ -1,8 +1,23 @@
1
1
  import { PlacementRelation } from "../model/Symbol.js";
2
2
  import { EditionOp } from "./draft.js";
3
- /** States how the follower is placed relative to the reference, in place of any earlier statement. */
3
+ /**
4
+ * States how the follower is placed relative to the reference, in place of any earlier statement.
5
+ * @category Operations
6
+ */
4
7
  export declare const placeCommand: (followerId: string, referenceId: string, relation: PlacementRelation) => EditionOp;
8
+ /**
9
+ * Withdraws the statement placing the command relative to another,
10
+ * whichever relation it states.
11
+ * @category Operations
12
+ */
5
13
  export declare const unplaceCommand: (followerId: string) => EditionOp;
6
- /** The pair is stated on `statingId` only, as the format asks. */
14
+ /**
15
+ * The pair is stated on `statingId` only, as the format asks.
16
+ * @category Operations
17
+ */
7
18
  export declare const pairCommands: (statingId: string, partnerId: string) => EditionOp;
19
+ /**
20
+ * Withdraws the pairing the command states.
21
+ * @category Operations
22
+ */
8
23
  export declare const unpairCommand: (statingId: string) => EditionOp;
@@ -14,16 +14,31 @@ const onCommand = (id, op) => reading(edition => draft => {
14
14
  op(symbol);
15
15
  });
16
16
  const clearPlacement = (command) => placementRelations.forEach(relation => { delete command[relation]; });
17
- /** States how the follower is placed relative to the reference, in place of any earlier statement. */
17
+ /**
18
+ * States how the follower is placed relative to the reference, in place of any earlier statement.
19
+ * @category Operations
20
+ */
18
21
  export const placeCommand = (followerId, referenceId, relation) => onCommand(followerId, command => {
19
22
  clearPlacement(command);
20
23
  command[relation] = assignReference(referenceId);
21
24
  });
25
+ /**
26
+ * Withdraws the statement placing the command relative to another,
27
+ * whichever relation it states.
28
+ * @category Operations
29
+ */
22
30
  export const unplaceCommand = (followerId) => onCommand(followerId, clearPlacement);
23
- /** The pair is stated on `statingId` only, as the format asks. */
31
+ /**
32
+ * The pair is stated on `statingId` only, as the format asks.
33
+ * @category Operations
34
+ */
24
35
  export const pairCommands = (statingId, partnerId) => onCommand(statingId, command => {
25
36
  command.pairedWith = assignReference(partnerId);
26
37
  });
38
+ /**
39
+ * Withdraws the pairing the command states.
40
+ * @category Operations
41
+ */
27
42
  export const unpairCommand = (statingId) => onCommand(statingId, command => {
28
43
  delete command.pairedWith;
29
44
  });
@@ -12,12 +12,14 @@ import { EditionOp } from "./draft.js";
12
12
  * inserts every symbol the copy's own tracker bar reads on it. The
13
13
  * version is a reading in that system's words, so it is coded for the
14
14
  * system the copy was cut for.
15
+ * @category Operations
15
16
  */
16
17
  export declare const createVersion: (copy: RollCopy) => EditionOp;
17
18
  /**
18
19
  * Puts the copy into the edition without a version of its own, as for a
19
20
  * copy whose features are not read into symbols: one known only from a
20
21
  * recording states instead which versions it carries.
22
+ * @category Operations
21
23
  */
22
24
  export declare const addCopy: (copy: RollCopy) => EditionOp;
23
25
  /**
@@ -26,6 +28,7 @@ export declare const addCopy: (copy: RollCopy) => EditionOp;
26
28
  * copy, or where the copy is the reference itself. The copy is read at
27
29
  * its own places whatever alignment it has, and through its own bar,
28
30
  * which is what lets a copy cut for another system be aligned at all.
31
+ * @category Operations
29
32
  */
30
33
  export declare const alignmentFor: (edition: Edition, copy: RollCopy, date?: Date) => Alignment | undefined;
31
34
  /**
@@ -34,12 +37,14 @@ export declare const alignmentFor: (edition: Edition, copy: RollCopy, date?: Dat
34
37
  * its features and tears onto the axis by them, in place of any
35
38
  * alignment it had. A copy that shares no run of notes with the
36
39
  * reference copy is left as it was.
40
+ * @category Operations
37
41
  */
38
42
  export declare const alignCopy: (copyId: string, date?: Date) => EditionOp;
39
43
  /**
40
44
  * Aligns every copy that has features with the reference copy, as
41
45
  * `alignCopy` does one. The reference copy itself is taken off any
42
46
  * alignment it had, its places being the axis.
47
+ * @category Operations
43
48
  */
44
49
  export declare const alignCopies: (date?: Date) => EditionOp;
45
50
  /**
@@ -47,27 +52,42 @@ export declare const alignCopies: (date?: Date) => EditionOp;
47
52
  * aligns every other copy onto it. Every place the edition gives along
48
53
  * the roll moves with this, which is why it is a choice and not
49
54
  * something worked out.
55
+ * @category Operations
50
56
  */
51
57
  export declare const chooseReferenceCopy: (copyId: string, date?: Date) => EditionOp;
52
58
  /**
53
59
  * Puts the copy's features back where they were measured, off the
54
60
  * axis. What the alignments say about the paper goes with it, since
55
61
  * that is worked out from them.
62
+ * @category Operations
56
63
  */
57
64
  export declare const unalignCopy: (copyId: string) => EditionOp;
58
65
  /**
59
66
  * Takes the extension a pneumatic reader adds off the ends of the
60
67
  * copy's chains of holes, and records how much was taken, so that their lengths
61
68
  * can be compared with a scanned copy's at all.
69
+ * @category Operations
62
70
  */
63
71
  export declare const shortenCopy: (copyId: string, extension: Millimeters, leaving?: ReadonlySet<string>) => EditionOp;
64
- /** Puts the reader's extension back on the copy's chains of holes. */
72
+ /**
73
+ * Puts the reader's extension back on the copy's chains of holes.
74
+ * @category Operations
75
+ */
65
76
  export declare const unshortenCopy: (copyId: string) => EditionOp;
66
- /** States what the copy's features were read from, in place of any earlier statement. */
77
+ /**
78
+ * States what the copy's features were read from, in place of any earlier statement.
79
+ * @category Operations
80
+ */
67
81
  export declare const stateSource: (copyId: string, source: FeatureSource) => EditionOp;
68
- /** Takes back the statement, leaving the copy silent about its source again. */
82
+ /**
83
+ * Takes back the statement, leaving the copy silent about its source again.
84
+ * @category Operations
85
+ */
69
86
  export declare const clearSource: (copyId: string) => EditionOp;
70
- /** Gives the copy the siglum it is referred to by, or takes it away where the siglum given is blank. */
87
+ /**
88
+ * Gives the copy the siglum it is referred to by, or takes it away where the siglum given is blank.
89
+ * @category Operations
90
+ */
71
91
  export declare const nameCopy: (copyId: string, siglum: string) => EditionOp;
72
92
  /** Takes out the copy's statements that match, and the list itself where none is left. */
73
93
  export declare const dropStatements: (copy: Draft<RollCopy>, matches: (statement: Readonly<ReferenceAssumption>) => boolean) => void;
@@ -77,15 +97,20 @@ export declare const dropStatements: (copy: Draft<RollCopy>, matches: (statement
77
97
  * one known only from a recording, and `carriageProblems` reports it
78
98
  * where features carry symbols already. A second statement about one
79
99
  * version is none.
100
+ * @category Operations
80
101
  */
81
102
  export declare const stateCarriage: (copyId: string, versionId: string, belief?: Belief) => EditionOp;
82
- /** Takes back the copy's statement that it carries the version. */
103
+ /**
104
+ * Takes back the copy's statement that it carries the version.
105
+ * @category Operations
106
+ */
83
107
  export declare const clearCarriage: (copyId: string, versionId: string) => EditionOp;
84
108
  /**
85
109
  * Adds a general condition to the copy, beside whatever is stated of it
86
110
  * already. A paper stretch is added the same way, where one was
87
111
  * measured; what the alignments say of the paper is worked out from
88
112
  * them and stated nowhere.
113
+ * @category Operations
89
114
  */
90
115
  export declare const addGeneralCondition: (copyId: string, condition: ObjectAssumption<GeneralRollCondition>) => EditionOp;
91
116
  /**
@@ -93,19 +118,25 @@ export declare const addGeneralCondition: (copyId: string, condition: ObjectAssu
93
118
  * what was stated before; given nothing, it takes the statement away. A
94
119
  * copy has one paper, so it has one such condition, which may give a
95
120
  * strain in either direction.
121
+ * @category Operations
96
122
  */
97
123
  export declare const statePaperStretch: (copyId: string, stretch?: ObjectAssumption<PaperStretch>) => EditionOp;
98
124
  /**
99
125
  * Adds a tear to the copy, beside whatever is stated of it already. The
100
126
  * tear is given on the axis, where the copy's features stand, and moves
101
127
  * with them from then on.
128
+ * @category Operations
102
129
  */
103
130
  export declare const addTear: (copyId: string, tear: ObjectAssumption<Tear>) => EditionOp;
104
- /** The symbols of the versions that no other copy carries. */
131
+ /**
132
+ * The symbols of the versions that no other copy carries.
133
+ * @category Operations
134
+ */
105
135
  export declare const symbolsCarriedOnlyBy: (edition: Edition, copyId: string) => AnySymbol[];
106
136
  /**
107
137
  * Takes the copy out of the edition together with the symbols only it
108
138
  * carries, and with every reference the versions and the argumentations
109
139
  * made to those symbols.
140
+ * @category Operations
110
141
  */
111
142
  export declare const removeCopy: (copyId: string) => EditionOp;
package/lib/ops/copies.js CHANGED
@@ -13,6 +13,7 @@ import { featureIdsOf, carriedOnlyOn, forgetFeatures } from "./forget.js";
13
13
  * inserts every symbol the copy's own tracker bar reads on it. The
14
14
  * version is a reading in that system's words, so it is coded for the
15
15
  * system the copy was cut for.
16
+ * @category Operations
16
17
  */
17
18
  export const createVersion = (copy) => draft => {
18
19
  const bar = barOf(copy);
@@ -28,6 +29,7 @@ export const createVersion = (copy) => draft => {
28
29
  * Puts the copy into the edition without a version of its own, as for a
29
30
  * copy whose features are not read into symbols: one known only from a
30
31
  * recording states instead which versions it carries.
32
+ * @category Operations
31
33
  */
32
34
  export const addCopy = (copy) => draft => {
33
35
  draft.copies.push(copy);
@@ -38,6 +40,7 @@ export const addCopy = (copy) => draft => {
38
40
  * copy, or where the copy is the reference itself. The copy is read at
39
41
  * its own places whatever alignment it has, and through its own bar,
40
42
  * which is what lets a copy cut for another system be aligned at all.
43
+ * @category Operations
41
44
  */
42
45
  export const alignmentFor = (edition, copy, date = new Date()) => {
43
46
  const reference = referenceCopyOf(edition);
@@ -62,6 +65,7 @@ export const alignmentFor = (edition, copy, date = new Date()) => {
62
65
  * its features and tears onto the axis by them, in place of any
63
66
  * alignment it had. A copy that shares no run of notes with the
64
67
  * reference copy is left as it was.
68
+ * @category Operations
65
69
  */
66
70
  export const alignCopy = (copyId, date = new Date()) => draft => {
67
71
  const state = stateOf(draft);
@@ -75,6 +79,7 @@ export const alignCopy = (copyId, date = new Date()) => draft => {
75
79
  * Aligns every copy that has features with the reference copy, as
76
80
  * `alignCopy` does one. The reference copy itself is taken off any
77
81
  * alignment it had, its places being the axis.
82
+ * @category Operations
78
83
  */
79
84
  export const alignCopies = (date = new Date()) => draft => {
80
85
  const reference = referenceCopyOf(stateOf(draft));
@@ -100,6 +105,7 @@ export const alignCopies = (date = new Date()) => draft => {
100
105
  * aligns every other copy onto it. Every place the edition gives along
101
106
  * the roll moves with this, which is why it is a choice and not
102
107
  * something worked out.
108
+ * @category Operations
103
109
  */
104
110
  export const chooseReferenceCopy = (copyId, date = new Date()) => draft => {
105
111
  if (!draft.copies.some(copy => copy.id === copyId))
@@ -111,6 +117,7 @@ export const chooseReferenceCopy = (copyId, date = new Date()) => draft => {
111
117
  * Puts the copy's features back where they were measured, off the
112
118
  * axis. What the alignments say about the paper goes with it, since
113
119
  * that is worked out from them.
120
+ * @category Operations
114
121
  */
115
122
  export const unalignCopy = (copyId) => onCopy(copyId, copy => {
116
123
  revertAlignment(copy);
@@ -119,19 +126,32 @@ export const unalignCopy = (copyId) => onCopy(copyId, copy => {
119
126
  * Takes the extension a pneumatic reader adds off the ends of the
120
127
  * copy's chains of holes, and records how much was taken, so that their lengths
121
128
  * can be compared with a scanned copy's at all.
129
+ * @category Operations
122
130
  */
123
131
  export const shortenCopy = (copyId, extension, leaving) => onCopy(copyId, copy => shortenChains(extension, copy, leaving));
124
- /** Puts the reader's extension back on the copy's chains of holes. */
132
+ /**
133
+ * Puts the reader's extension back on the copy's chains of holes.
134
+ * @category Operations
135
+ */
125
136
  export const unshortenCopy = (copyId) => onCopy(copyId, copy => revertShortening(copy));
126
- /** States what the copy's features were read from, in place of any earlier statement. */
137
+ /**
138
+ * States what the copy's features were read from, in place of any earlier statement.
139
+ * @category Operations
140
+ */
127
141
  export const stateSource = (copyId, source) => onCopy(copyId, copy => {
128
142
  copy.readFrom = source;
129
143
  });
130
- /** Takes back the statement, leaving the copy silent about its source again. */
144
+ /**
145
+ * Takes back the statement, leaving the copy silent about its source again.
146
+ * @category Operations
147
+ */
131
148
  export const clearSource = (copyId) => onCopy(copyId, copy => {
132
149
  copy.readFrom = undefined;
133
150
  });
134
- /** Gives the copy the siglum it is referred to by, or takes it away where the siglum given is blank. */
151
+ /**
152
+ * Gives the copy the siglum it is referred to by, or takes it away where the siglum given is blank.
153
+ * @category Operations
154
+ */
135
155
  export const nameCopy = (copyId, siglum) => onCopy(copyId, copy => {
136
156
  const trimmed = siglum.trim();
137
157
  if (trimmed)
@@ -156,6 +176,7 @@ export const dropStatements = (copy, matches) => {
156
176
  * one known only from a recording, and `carriageProblems` reports it
157
177
  * where features carry symbols already. A second statement about one
158
178
  * version is none.
179
+ * @category Operations
159
180
  */
160
181
  export const stateCarriage = (copyId, versionId, belief) => onCopy(copyId, copy => {
161
182
  const statements = stateOf(copy).carries ?? [];
@@ -163,13 +184,17 @@ export const stateCarriage = (copyId, versionId, belief) => onCopy(copyId, copy
163
184
  return;
164
185
  copy.carries = [...statements, referenceHeld(versionId, belief)];
165
186
  });
166
- /** Takes back the copy's statement that it carries the version. */
187
+ /**
188
+ * Takes back the copy's statement that it carries the version.
189
+ * @category Operations
190
+ */
167
191
  export const clearCarriage = (copyId, versionId) => onCopy(copyId, copy => dropStatements(copy, statement => idOf(statement) === versionId));
168
192
  /**
169
193
  * Adds a general condition to the copy, beside whatever is stated of it
170
194
  * already. A paper stretch is added the same way, where one was
171
195
  * measured; what the alignments say of the paper is worked out from
172
196
  * them and stated nowhere.
197
+ * @category Operations
173
198
  */
174
199
  export const addGeneralCondition = (copyId, condition) => onCopy(copyId, copy => {
175
200
  copy.conditions.push(condition);
@@ -179,6 +204,7 @@ export const addGeneralCondition = (copyId, condition) => onCopy(copyId, copy =>
179
204
  * what was stated before; given nothing, it takes the statement away. A
180
205
  * copy has one paper, so it has one such condition, which may give a
181
206
  * strain in either direction.
207
+ * @category Operations
182
208
  */
183
209
  export const statePaperStretch = (copyId, stretch) => onCopy(copyId, copy => {
184
210
  copy.conditions = [...without(copy.conditions, isPaperStretch), ...(stretch ? [stretch] : [])];
@@ -187,11 +213,15 @@ export const statePaperStretch = (copyId, stretch) => onCopy(copyId, copy => {
187
213
  * Adds a tear to the copy, beside whatever is stated of it already. The
188
214
  * tear is given on the axis, where the copy's features stand, and moves
189
215
  * with them from then on.
216
+ * @category Operations
190
217
  */
191
218
  export const addTear = (copyId, tear) => onCopy(copyId, copy => {
192
219
  copy.conditions.push(tear);
193
220
  });
194
- /** The symbols of the versions that no other copy carries. */
221
+ /**
222
+ * The symbols of the versions that no other copy carries.
223
+ * @category Operations
224
+ */
195
225
  export const symbolsCarriedOnlyBy = (edition, copyId) => {
196
226
  const copy = edition.copies.find(c => c.id === copyId);
197
227
  return copy ? insertedIn(edition.versions).filter(carriedOnlyOn(featureIdsOf(copy))) : [];
@@ -200,6 +230,7 @@ export const symbolsCarriedOnlyBy = (edition, copyId) => {
200
230
  * Takes the copy out of the edition together with the symbols only it
201
231
  * carries, and with every reference the versions and the argumentations
202
232
  * made to those symbols.
233
+ * @category Operations
203
234
  */
204
235
  export const removeCopy = (copyId) => onCopy(copyId, (copy, draft) => {
205
236
  forgetFeatures(draft, featureIdsOf(copy));
@@ -15,6 +15,7 @@ import { WithId } from "../shared/utils.js";
15
15
  * (`reading`) and does all its writing in the one function it builds
16
16
  * from that. Where operations run one after another on one draft, each
17
17
  * reads what the ones before it wrote.
18
+ * @category Operations
18
19
  */
19
20
  export type EditionOp = (draft: Draft<Edition>) => void;
20
21
  export declare const noChange: EditionOp;
@@ -33,6 +34,7 @@ export declare const reading: (build: (edition: Edition) => EditionOp) => Editio
33
34
  * The state a draft stands at, as plain data. Reading a draft proxies
34
35
  * everything it touches, so what is only read is read from this, and
35
36
  * what is looked up in an edition is looked up in this (`takenOf`).
37
+ * @category Lookups
36
38
  */
37
39
  export declare const stateOf: <T>(draft: Draft<T>) => T;
38
40
  /** The ids of the items the rewriting left out. */
package/lib/ops/draft.js CHANGED
@@ -35,6 +35,7 @@ export const reading = (build) => draft => build(stateOf(draft))(draft);
35
35
  * The state a draft stands at, as plain data. Reading a draft proxies
36
36
  * everything it touches, so what is only read is read from this, and
37
37
  * what is looked up in an edition is looked up in this (`takenOf`).
38
+ * @category Lookups
38
39
  */
39
40
  export const stateOf = (draft) => isDraft(draft) ? takenOf(draft) : draft;
40
41
  /** The ids of the items the rewriting left out. */
@@ -3,7 +3,11 @@ import { EditionOp } from "./draft.js";
3
3
  /**
4
4
  * Replaces the edits with a single one carrying all their insertions
5
5
  * and deletions, classified by a guess at what the exchange does.
6
+ * @category Operations
6
7
  */
7
8
  export declare const mergeEdits: (versionId: string, toMerge: readonly Edit[]) => EditionOp;
8
- /** Replaces the edit with one edit per inserted and one per deleted symbol. */
9
+ /**
10
+ * Replaces the edit with one edit per inserted and one per deleted symbol.
11
+ * @category Operations
12
+ */
9
13
  export declare const splitEdit: (versionId: string, toSplit: Edit) => EditionOp;
package/lib/ops/edits.js CHANGED
@@ -63,6 +63,7 @@ const guessEditType = (edition, versionId, edit) => {
63
63
  /**
64
64
  * Replaces the edits with a single one carrying all their insertions
65
65
  * and deletions, classified by a guess at what the exchange does.
66
+ * @category Operations
66
67
  */
67
68
  export const mergeEdits = (versionId, toMerge) => reading(edition => {
68
69
  if (toMerge.length === 0)
@@ -79,7 +80,10 @@ export const mergeEdits = (versionId, toMerge) => reading(edition => {
79
80
  version.edits = [...editsOf(version).filter(edit => !mergedIds.has(edit.id)), merged];
80
81
  });
81
82
  });
82
- /** Replaces the edit with one edit per inserted and one per deleted symbol. */
83
+ /**
84
+ * Replaces the edit with one edit per inserted and one per deleted symbol.
85
+ * @category Operations
86
+ */
83
87
  export const splitEdit = (versionId, toSplit) => {
84
88
  const parts = [
85
89
  ...(toSplit.insert ?? []).map(insertion),
@@ -6,6 +6,7 @@ import { EditionOp } from "./draft.js";
6
6
  * States the condition of the feature, in place of any earlier
7
7
  * statement. Throws where the kind of feature is in no such condition;
8
8
  * `conditions` says which conditions each kind of feature may be in.
9
+ * @category Operations
9
10
  */
10
11
  export declare const stateFeatureCondition: (copyId: string, featureId: string, condition: FeatureConditionAssignment) => EditionOp;
11
12
  /**
@@ -13,6 +14,7 @@ export declare const stateFeatureCondition: (copyId: string, featureId: string,
13
14
  * copy, the act that brought another feature about, or, where neither
14
15
  * is said, an act of its own for the purpose given. A patch is never
15
16
  * punched, being glued on, so `punched` says nothing of one.
17
+ * @category Operations
16
18
  */
17
19
  export interface FeatureAct {
18
20
  /** The copy came from its punching with it, which is where a reading of a scan puts every chain of holes. */
@@ -28,12 +30,14 @@ export interface FeatureAct {
28
30
  * produced, by the punching or by a later act. Which act, `FeatureAct`
29
31
  * says; a `beside` that names nothing the copy bears is passed over and
30
32
  * the feature goes into an act of its own.
33
+ * @category Operations
31
34
  */
32
35
  export declare const addFeature: (copyId: string, feature: FeatureOrPatch, act?: FeatureAct) => EditionOp;
33
36
  /**
34
37
  * States that the patch bears the feature. What a patch bears came onto
35
38
  * the copy with the patch, so it belongs to no act of its own and
36
39
  * states no place: it stands where the patch stands.
40
+ * @category Operations
37
41
  */
38
42
  export declare const addBorneFeature: (copyId: string, patchId: string, feature: NestedFeature) => EditionOp;
39
43
  /**
@@ -42,9 +46,13 @@ export declare const addBorneFeature: (copyId: string, patchId: string, feature:
42
46
  * a patch goes with everything glued onto it, and a feature of a patch
43
47
  * may be taken back on its own, the patch staying where it is. An act
44
48
  * left having produced or added nothing goes as well.
49
+ * @category Operations
45
50
  */
46
51
  export declare const removeFeatures: (copyId: string, featureIds: readonly string[]) => EditionOp;
47
- /** Why several features cannot be replaced by one. */
52
+ /**
53
+ * Why several features cannot be replaced by one.
54
+ * @category Operations
55
+ */
48
56
  export type MergeObstacle = 'fewer-than-two' | 'different-types' | 'different-tracks' | 'differing-conditions' | 'unlike-features' | 'different-acts';
49
57
  /**
50
58
  * What stands in the way of reading the features as one, or nothing
@@ -53,6 +61,7 @@ export type MergeObstacle = 'fewer-than-two' | 'different-types' | 'different-tr
53
61
  * condition at most one of them states. How far apart they lie is not
54
62
  * asked: whether a gap is a bridge of the perforator, a tear or two
55
63
  * perforations of their own is the editor's reading.
64
+ * @category Operations
56
65
  */
57
66
  export declare const mergeObstacle: (features: readonly FeatureOrPatch[]) => MergeObstacle | undefined;
58
67
  /**
@@ -61,6 +70,7 @@ export declare const mergeObstacle: (features: readonly FeatureOrPatch[]) => Mer
61
70
  * features themselves say, which cannot reach `different-acts`: one
62
71
  * feature is the work of one act, and where the features stand is the
63
72
  * edition's business rather than theirs.
73
+ * @category Operations
64
74
  */
65
75
  export declare const mergeObstacleIn: (edition: Edition, featureIds: readonly string[]) => MergeObstacle | undefined;
66
76
  /**
@@ -80,5 +90,6 @@ export declare const mergeObstacleIn: (edition: Edition, featureIds: readonly st
80
90
  *
81
91
  * Throws where the features cannot stand for one; `mergeObstacle`
82
92
  * says beforehand whether they can.
93
+ * @category Operations
83
94
  */
84
95
  export declare const mergeFeatures: (copyId: string, featureIds: readonly string[]) => EditionOp;
@@ -20,6 +20,7 @@ const allows = (feature, condition) => {
20
20
  * States the condition of the feature, in place of any earlier
21
21
  * statement. Throws where the kind of feature is in no such condition;
22
22
  * `conditions` says which conditions each kind of feature may be in.
23
+ * @category Operations
23
24
  */
24
25
  export const stateFeatureCondition = (copyId, featureId, condition) => onFeature(copyId, featureId, feature => {
25
26
  if (!allows(feature, condition)) {
@@ -108,6 +109,7 @@ const actFor = (copy, patch, act) => {
108
109
  * produced, by the punching or by a later act. Which act, `FeatureAct`
109
110
  * says; a `beside` that names nothing the copy bears is passed over and
110
111
  * the feature goes into an act of its own.
112
+ * @category Operations
111
113
  */
112
114
  export const addFeature = (copyId, feature, act = {}) => onCopy(copyId, copy => {
113
115
  actFor(copy, isPatch(feature), act).push(feature);
@@ -116,6 +118,7 @@ export const addFeature = (copyId, feature, act = {}) => onCopy(copyId, copy =>
116
118
  * States that the patch bears the feature. What a patch bears came onto
117
119
  * the copy with the patch, so it belongs to no act of its own and
118
120
  * states no place: it stands where the patch stands.
121
+ * @category Operations
119
122
  */
120
123
  export const addBorneFeature = (copyId, patchId, feature) => onCopy(copyId, copy => {
121
124
  const patch = featuresOf(copy).flatMap(withBorneFeatures).find(borne => borne.id === patchId);
@@ -131,6 +134,7 @@ export const addBorneFeature = (copyId, patchId, feature) => onCopy(copyId, copy
131
134
  * a patch goes with everything glued onto it, and a feature of a patch
132
135
  * may be taken back on its own, the patch staying where it is. An act
133
136
  * left having produced or added nothing goes as well.
137
+ * @category Operations
134
138
  */
135
139
  export const removeFeatures = (copyId, featureIds) => onCopy(copyId, (copy, draft) => {
136
140
  const named = new Set(featureIds);
@@ -172,6 +176,7 @@ const conditionsOf = (features) => features.flatMap(feature => feature.condition
172
176
  * condition at most one of them states. How far apart they lie is not
173
177
  * asked: whether a gap is a bridge of the perforator, a tear or two
174
178
  * perforations of their own is the editor's reading.
179
+ * @category Operations
175
180
  */
176
181
  export const mergeObstacle = (features) => {
177
182
  if (features.length < 2)
@@ -209,6 +214,7 @@ const obstacleIn = (copy, featureIds) => {
209
214
  * features themselves say, which cannot reach `different-acts`: one
210
215
  * feature is the work of one act, and where the features stand is the
211
216
  * edition's business rather than theirs.
217
+ * @category Operations
212
218
  */
213
219
  export const mergeObstacleIn = (edition, featureIds) => {
214
220
  const copy = featureIds.map(id => copyOfFeature(edition, id)).find(copy => copy !== undefined);
@@ -277,6 +283,7 @@ const carryOver = (draft, replaced, mergedId) => {
277
283
  *
278
284
  * Throws where the features cannot stand for one; `mergeObstacle`
279
285
  * says beforehand whether they can.
286
+ * @category Operations
280
287
  */
281
288
  export const mergeFeatures = (copyId, featureIds) => onCopy(copyId, (copy, draft) => {
282
289
  const state = stateOf(copy);
@@ -7,17 +7,25 @@ export declare const hypothesesBeside: (version: Readonly<Version>, parentId: st
7
7
  * Makes the version stand on its own: what it inherited becomes its
8
8
  * own insertions, and its derivations go, the hypotheses among them,
9
9
  * with the motivations that belonged to them.
10
+ * @category Operations
10
11
  */
11
12
  export declare const detachVersion: (versionId: string) => EditionOp;
12
13
  /**
13
14
  * Takes the version out. Whatever read its text against it comes to
14
15
  * stand on its own, a hypothesis that something derives from it goes,
15
16
  * and so does a copy's statement that it carries the version.
17
+ * @category Operations
16
18
  */
17
19
  export declare const removeVersion: (versionId: string) => EditionOp;
18
- /** Takes the symbols out of the version's own insertions, and the edits that had nothing else. */
20
+ /**
21
+ * Takes the symbols out of the version's own insertions, and the edits that had nothing else.
22
+ * @category Operations
23
+ */
19
24
  export declare const removeSymbols: (versionId: string, symbolIds: readonly string[]) => EditionOp;
20
- /** Moves the edits into a new version based on this one. */
25
+ /**
26
+ * Moves the edits into a new version based on this one.
27
+ * @category Operations
28
+ */
21
29
  export declare const deriveVersion: (versionId: string, editIds: readonly string[]) => EditionOp;
22
30
  /**
23
31
  * States that the version may also derive from the parent, beside what
@@ -26,7 +34,11 @@ export declare const deriveVersion: (versionId: string, editIds: readonly string
26
34
  * unless the belief holds this one more certain. A version derives from
27
35
  * itself, twice from one parent, or from one of its own descendants in
28
36
  * no statement.
37
+ * @category Operations
29
38
  */
30
39
  export declare const stateDerivation: (versionId: string, parentId: string, belief?: Belief) => EditionOp;
31
- /** Takes back the hypothesis that the version derives from the parent; the principal derivation goes with `detachVersion`. */
40
+ /**
41
+ * Takes back the hypothesis that the version derives from the parent; the principal derivation goes with `detachVersion`.
42
+ * @category Operations
43
+ */
32
44
  export declare const clearDerivation: (versionId: string, parentId: string) => EditionOp;