@agentshouse/mdruntime 0.1.0-alpha.3 → 0.1.0-alpha.30
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/AGENTS.md +178 -0
- package/dist/adapter.d.ts +150 -18
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +2 -1
- package/dist/adapter.js.map +1 -1
- package/dist/bootstrap.d.ts +5 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +13 -5
- package/dist/bootstrap.js.map +1 -1
- package/dist/change-set.d.ts +33 -0
- package/dist/change-set.d.ts.map +1 -0
- package/dist/change-set.js +89 -0
- package/dist/change-set.js.map +1 -0
- package/dist/change.d.ts +10 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js.map +1 -1
- package/dist/client.d.ts +72 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +231 -0
- package/dist/client.js.map +1 -0
- package/dist/collection.d.ts +22 -12
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +88 -30
- package/dist/collection.js.map +1 -1
- package/dist/connection.d.ts +90 -20
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1732 -194
- package/dist/connection.js.map +1 -1
- package/dist/conversation.d.ts +72 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +529 -0
- package/dist/conversation.js.map +1 -0
- package/dist/durability.d.ts +9 -0
- package/dist/durability.d.ts.map +1 -0
- package/dist/durability.js +11 -0
- package/dist/durability.js.map +1 -0
- package/dist/file.d.ts +20 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/file.js +149 -0
- package/dist/file.js.map +1 -0
- package/dist/host.d.ts +13 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +205 -0
- package/dist/host.js.map +1 -0
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +23 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +15 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +5 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +15 -0
- package/dist/log.js.map +1 -0
- package/dist/memory.d.ts +17 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +201 -15
- package/dist/memory.js.map +1 -1
- package/dist/model.d.ts +56 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +37 -0
- package/dist/model.js.map +1 -0
- package/dist/observation.d.ts +25 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/observation.js +92 -0
- package/dist/observation.js.map +1 -0
- package/dist/outcome.d.ts +34 -0
- package/dist/outcome.d.ts.map +1 -0
- package/dist/outcome.js +3 -0
- package/dist/outcome.js.map +1 -0
- package/dist/overlay.d.ts +2 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +107 -1
- package/dist/overlay.js.map +1 -1
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -4
- package/dist/paths.js.map +1 -1
- package/dist/query.d.ts +209 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +467 -0
- package/dist/query.js.map +1 -0
- package/dist/read-side.d.ts +14 -0
- package/dist/read-side.d.ts.map +1 -0
- package/dist/read-side.js +451 -0
- package/dist/read-side.js.map +1 -0
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +5 -3
- package/dist/refresh.js.map +1 -1
- package/dist/replica.d.ts +17 -3
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +160 -8
- package/dist/replica.js.map +1 -1
- package/dist/room-draft.d.ts +124 -0
- package/dist/room-draft.d.ts.map +1 -0
- package/dist/room-draft.js +406 -0
- package/dist/room-draft.js.map +1 -0
- package/dist/rows.d.ts +39 -0
- package/dist/rows.d.ts.map +1 -0
- package/dist/rows.js +100 -0
- package/dist/rows.js.map +1 -0
- package/dist/save.d.ts +11 -2
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +104 -128
- package/dist/save.js.map +1 -1
- package/dist/search.d.ts +61 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +155 -0
- package/dist/search.js.map +1 -0
- package/dist/status.d.ts +9 -1
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +7 -4
- package/dist/status.js.map +1 -1
- package/dist/store.d.ts +87 -15
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +436 -54
- package/dist/store.js.map +1 -1
- package/dist/wire.d.ts +64 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +142 -0
- package/dist/wire.js.map +1 -0
- package/package.json +14 -4
package/dist/replica.js
CHANGED
|
@@ -1,14 +1,108 @@
|
|
|
1
|
+
import { parse } from '@agentshouse/mdmodel';
|
|
1
2
|
import { immutable } from './change.js';
|
|
2
|
-
import { parseCollection, readCollection } from './collection.js';
|
|
3
|
-
import { overlay } from './overlay.js';
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { parseCollection, readCollection, validateCollection } from './collection.js';
|
|
4
|
+
import { overlay, overlayChanged, sameLayerText } from './overlay.js';
|
|
5
|
+
import { providerRewritten } from './save.js';
|
|
6
|
+
import { equalValue } from './room-draft.js';
|
|
7
|
+
export function compositionOf(record) {
|
|
8
|
+
return {
|
|
9
|
+
collectionRoot: record.collectionRoot,
|
|
10
|
+
model: record.model,
|
|
11
|
+
selection: record.typedSelection === null ? null : {
|
|
12
|
+
roots: record.typedSelection.roots,
|
|
13
|
+
model: record.selectionModel
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function readConfirmed(record, previous) {
|
|
18
|
+
const collection = readCollection(record.documents, compositionOf(record), previous === undefined ? undefined : {
|
|
19
|
+
text: previous.record.documents,
|
|
20
|
+
collection: previous.collection
|
|
21
|
+
});
|
|
6
22
|
return collection === null ? null : {
|
|
7
23
|
record,
|
|
8
24
|
collection
|
|
9
25
|
};
|
|
10
26
|
}
|
|
11
|
-
export function
|
|
27
|
+
export function readStaged(record, previous) {
|
|
28
|
+
if ((record.model.status === 'current' || record.selectionModel.status === 'current') && (previous === undefined || !sameLayerText(record, previous.record) || record.model !== previous.record.model || record.selectionModel !== previous.record.selectionModel)) {
|
|
29
|
+
const verdict = validateCollection(record.documents, record.binaryTargets, compositionOf(record));
|
|
30
|
+
if (verdict.verdict === 'refuse' && verdict.rule !== 'model-unavailable') return null;
|
|
31
|
+
}
|
|
32
|
+
return readConfirmed(record, previous);
|
|
33
|
+
}
|
|
34
|
+
export function applyReturned(confirmed, documents, revisions, removals, roomVersion) {
|
|
35
|
+
const nextDocuments = {
|
|
36
|
+
...confirmed.record.documents,
|
|
37
|
+
...documents
|
|
38
|
+
};
|
|
39
|
+
const nextRevisions = {
|
|
40
|
+
...confirmed.record.revisions,
|
|
41
|
+
...revisions
|
|
42
|
+
};
|
|
43
|
+
const binaryTargets = new Set(confirmed.record.binaryTargets);
|
|
44
|
+
for (const path of removals){
|
|
45
|
+
delete nextDocuments[path];
|
|
46
|
+
delete nextRevisions[path];
|
|
47
|
+
binaryTargets.delete(path);
|
|
48
|
+
}
|
|
49
|
+
return readStaged({
|
|
50
|
+
...confirmed.record,
|
|
51
|
+
roomVersion,
|
|
52
|
+
documents: nextDocuments,
|
|
53
|
+
revisions: nextRevisions,
|
|
54
|
+
binaryTargets: [
|
|
55
|
+
...binaryTargets
|
|
56
|
+
].sort()
|
|
57
|
+
}, confirmed);
|
|
58
|
+
}
|
|
59
|
+
function predicted(confirmed, batches, previous) {
|
|
60
|
+
const composition = compositionOf(confirmed.record);
|
|
61
|
+
let layer = confirmed.record;
|
|
62
|
+
const replay = [];
|
|
63
|
+
const prior = new Map(previous?.replay.map((step)=>[
|
|
64
|
+
step.id,
|
|
65
|
+
step
|
|
66
|
+
]) ?? []);
|
|
67
|
+
for (const batch of batches){
|
|
68
|
+
const before = layer;
|
|
69
|
+
const old = prior.get(batch.id);
|
|
70
|
+
const hasMove = batch.changes.some((change)=>change.kind === 'move');
|
|
71
|
+
const reuseRewrite = old?.collection !== undefined && sameLayerText(before, old.before) && old.collection.composition.collectionRoot === composition.collectionRoot && old.collection.composition.model === composition.model && old.collection.composition.selection?.model === composition.selection?.model && JSON.stringify(old.collection.composition.selection?.roots) === JSON.stringify(composition.selection?.roots);
|
|
72
|
+
const collection = hasMove ? reuseRewrite ? old.collection : parseCollection(before.documents, composition, old?.collection === undefined ? {
|
|
73
|
+
text: confirmed.record.documents,
|
|
74
|
+
collection: confirmed.collection
|
|
75
|
+
} : {
|
|
76
|
+
text: old.before.documents,
|
|
77
|
+
collection: old.collection
|
|
78
|
+
}) : undefined;
|
|
79
|
+
const effective = collection === undefined ? batch : reuseRewrite ? old.effective : providerRewritten(batch, {
|
|
80
|
+
...before,
|
|
81
|
+
collection
|
|
82
|
+
});
|
|
83
|
+
layer = old === undefined ? overlay(before, [
|
|
84
|
+
effective
|
|
85
|
+
]) : overlayChanged(before, [
|
|
86
|
+
effective
|
|
87
|
+
], old.before, [
|
|
88
|
+
old.effective
|
|
89
|
+
], old.after);
|
|
90
|
+
replay.push({
|
|
91
|
+
id: batch.id,
|
|
92
|
+
before,
|
|
93
|
+
after: layer,
|
|
94
|
+
effective,
|
|
95
|
+
...collection === undefined ? {} : {
|
|
96
|
+
collection
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
layer,
|
|
102
|
+
replay
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function replicaOf(confirmed, queue, rewriting, previous) {
|
|
12
106
|
const batches = Object.freeze(queue.map(immutable));
|
|
13
107
|
if (batches.length === 0) {
|
|
14
108
|
return {
|
|
@@ -19,18 +113,76 @@ export function replicaOf(confirmed, queue) {
|
|
|
19
113
|
binaryTargets: confirmed.record.binaryTargets,
|
|
20
114
|
revisions: confirmed.record.revisions,
|
|
21
115
|
collection: confirmed.collection
|
|
22
|
-
}
|
|
116
|
+
},
|
|
117
|
+
replay: []
|
|
23
118
|
};
|
|
24
119
|
}
|
|
25
|
-
const
|
|
120
|
+
const predictedState = rewriting === 'provider' ? predicted(confirmed, batches, previous) : null;
|
|
121
|
+
const layer = rewriting === 'provider' ? predictedState.layer : previous === undefined ? overlay(confirmed.record, batches) : overlayChanged(confirmed.record, batches, previous.confirmed.record, previous.queue, previous.visible);
|
|
26
122
|
return {
|
|
27
123
|
confirmed,
|
|
28
124
|
queue: batches,
|
|
125
|
+
replay: predictedState?.replay ?? [],
|
|
29
126
|
visible: {
|
|
30
127
|
...layer,
|
|
31
|
-
collection: parseCollection(layer.documents)
|
|
128
|
+
collection: parseCollection(layer.documents, compositionOf(confirmed.record), previous === undefined ? undefined : {
|
|
129
|
+
text: previous.visible.documents,
|
|
130
|
+
collection: previous.visible.collection
|
|
131
|
+
})
|
|
32
132
|
}
|
|
33
133
|
};
|
|
34
134
|
}
|
|
135
|
+
function present(layer, path) {
|
|
136
|
+
return layer.documents[path] !== undefined || layer.binaryTargets.includes(path);
|
|
137
|
+
}
|
|
138
|
+
function holds(layer, preconditions) {
|
|
139
|
+
const parsed = new Map();
|
|
140
|
+
const documentAt = (path)=>{
|
|
141
|
+
if (!parsed.has(path)) {
|
|
142
|
+
const text = layer.documents[path];
|
|
143
|
+
const opened = text === undefined ? null : parse(text, path);
|
|
144
|
+
parsed.set(path, opened?.ok === true ? opened.document : null);
|
|
145
|
+
}
|
|
146
|
+
return parsed.get(path) ?? null;
|
|
147
|
+
};
|
|
148
|
+
return preconditions.every((precondition)=>{
|
|
149
|
+
const path = precondition.path;
|
|
150
|
+
if (precondition.kind === 'absent') return !present(layer, path);
|
|
151
|
+
if (precondition.kind === 'present') return present(layer, path);
|
|
152
|
+
if (precondition.kind === 'revision') {
|
|
153
|
+
return present(layer, path) && layer.revisions[path] === precondition.revision;
|
|
154
|
+
}
|
|
155
|
+
const document = documentAt(path);
|
|
156
|
+
if (document === null) return false;
|
|
157
|
+
if (precondition.kind === 'field') {
|
|
158
|
+
const value = Object.hasOwn(document.fields, precondition.name) ? document.fields[precondition.name] : undefined;
|
|
159
|
+
return equalValue(value, precondition.value);
|
|
160
|
+
}
|
|
161
|
+
if (precondition.kind === 'section') {
|
|
162
|
+
return Object.hasOwn(document.sections, precondition.name) && document.sections[precondition.name] === precondition.value;
|
|
163
|
+
}
|
|
164
|
+
return document.preamble === precondition.value;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
export function withdrawals(confirmed, queue, withdrawable, rewriting) {
|
|
168
|
+
if (!queue.some(withdrawable)) return [];
|
|
169
|
+
const composition = compositionOf(confirmed.record);
|
|
170
|
+
let layer = confirmed.record;
|
|
171
|
+
const withdrawn = [];
|
|
172
|
+
for (const batch of queue){
|
|
173
|
+
if (withdrawable(batch) && !holds(layer, batch.preconditions)) {
|
|
174
|
+
withdrawn.push(batch);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const effective = rewriting === 'provider' && batch.changes.some((change)=>change.kind === 'move') ? providerRewritten(batch, {
|
|
178
|
+
...layer,
|
|
179
|
+
collection: parseCollection(layer.documents, composition)
|
|
180
|
+
}) : batch;
|
|
181
|
+
layer = overlay(layer, [
|
|
182
|
+
effective
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
return withdrawn;
|
|
186
|
+
}
|
|
35
187
|
|
|
36
188
|
//# sourceMappingURL=replica.js.map
|
package/dist/replica.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/replica.ts"],"sourcesContent":["import { immutable, type ChangeBatch } from './change.js';\nimport { parseCollection, readCollection, type Collection } from './collection.js';\nimport { overlay, type Layer } from './overlay.js';\nimport type { ReplicaRecord } from './store.js';\n\nexport type ConfirmedLayer = {\n record: ReplicaRecord;\n collection: Collection;\n};\n\nexport type VisibleLayer = Layer & {\n collection: Collection;\n};\n\nexport type Replica = {\n confirmed: ConfirmedLayer;\n queue: readonly ChangeBatch[];\n visible: VisibleLayer;\n};\n\nexport function readConfirmed(record: ReplicaRecord): ConfirmedLayer | null {\n const collection = readCollection(record.documents, record.binaryTargets);\n return collection === null ? null : { record, collection };\n}\n\nexport function replicaOf(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[]): Replica {\n const batches = Object.freeze(queue.map(immutable));\n if (batches.length === 0) {\n return {\n confirmed,\n queue: batches,\n visible: {\n documents: confirmed.record.documents,\n binaryTargets: confirmed.record.binaryTargets,\n revisions: confirmed.record.revisions,\n collection: confirmed.collection,\n },\n };\n }\n const layer = overlay(confirmed.record, batches);\n return {\n confirmed,\n queue: batches,\n visible: { ...layer, collection: parseCollection(layer.documents) },\n };\n}\n"],"names":["immutable","parseCollection","readCollection","overlay","readConfirmed","record","collection","documents","binaryTargets","replicaOf","confirmed","queue","batches","Object","freeze","map","length","visible","revisions","layer"],"mappings":"AAAA,SAASA,SAAS,QAA0B,cAAc;AAC1D,SAASC,eAAe,EAAEC,cAAc,QAAyB,kBAAkB;AACnF,SAASC,OAAO,QAAoB,eAAe;AAkBnD,OAAO,SAASC,cAAcC,MAAqB;IACjD,MAAMC,aAAaJ,eAAeG,OAAOE,SAAS,EAAEF,OAAOG,aAAa;IACxE,OAAOF,eAAe,OAAO,OAAO;QAAED;QAAQC;IAAW;AAC3D;AAEA,OAAO,SAASG,UAAUC,SAAyB,EAAEC,KAA6B;IAChF,MAAMC,UAAUC,OAAOC,MAAM,CAACH,MAAMI,GAAG,CAACf;IACxC,IAAIY,QAAQI,MAAM,KAAK,GAAG;QACxB,OAAO;YACLN;YACAC,OAAOC;YACPK,SAAS;gBACPV,WAAWG,UAAUL,MAAM,CAACE,SAAS;gBACrCC,eAAeE,UAAUL,MAAM,CAACG,aAAa;gBAC7CU,WAAWR,UAAUL,MAAM,CAACa,SAAS;gBACrCZ,YAAYI,UAAUJ,UAAU;YAClC;QACF;IACF;IACA,MAAMa,QAAQhB,QAAQO,UAAUL,MAAM,EAAEO;IACxC,OAAO;QACLF;QACAC,OAAOC;QACPK,SAAS;YAAE,GAAGE,KAAK;YAAEb,YAAYL,gBAAgBkB,MAAMZ,SAAS;QAAE;IACpE;AACF"}
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/replica.ts"],"sourcesContent":["import { parse, type Document } from '@agentshouse/mdmodel';\nimport { immutable, type ChangeBatch, type Precondition } from './change.js';\nimport {\n parseCollection,\n readCollection,\n validateCollection,\n type Collection,\n type Composition,\n} from './collection.js';\nimport { overlay, overlayChanged, sameLayerText, type Layer } from './overlay.js';\nimport { providerRewritten, type Rewriting } from './save.js';\nimport { equalValue } from './room-draft.js';\nimport type { ReplicaRecord } from './store.js';\n\nexport type ConfirmedLayer = {\n record: ReplicaRecord;\n collection: Collection;\n};\n\nexport type VisibleLayer = Layer & {\n collection: Collection;\n};\n\nexport type Replica = {\n confirmed: ConfirmedLayer;\n queue: readonly ChangeBatch[];\n visible: VisibleLayer;\n replay: readonly ReplayStep[];\n};\n\ntype ReplayStep = {\n id: string;\n before: Layer;\n after: Layer;\n effective: ChangeBatch;\n collection?: Collection;\n};\n\nexport function compositionOf(record: ReplicaRecord): Composition {\n return {\n collectionRoot: record.collectionRoot,\n model: record.model,\n selection:\n record.typedSelection === null\n ? null\n : { roots: record.typedSelection.roots, model: record.selectionModel },\n };\n}\n\nexport function readConfirmed(\n record: ReplicaRecord,\n previous?: ConfirmedLayer,\n): ConfirmedLayer | null {\n const collection = readCollection(\n record.documents,\n compositionOf(record),\n previous === undefined\n ? undefined\n : { text: previous.record.documents, collection: previous.collection },\n );\n return collection === null ? null : { record, collection };\n}\n\nexport function readStaged(\n record: ReplicaRecord,\n previous?: ConfirmedLayer,\n): ConfirmedLayer | null {\n if (\n (record.model.status === 'current' || record.selectionModel.status === 'current') &&\n (previous === undefined ||\n !sameLayerText(record, previous.record) ||\n record.model !== previous.record.model ||\n record.selectionModel !== previous.record.selectionModel)\n ) {\n const verdict = validateCollection(\n record.documents,\n record.binaryTargets,\n compositionOf(record),\n );\n if (verdict.verdict === 'refuse' && verdict.rule !== 'model-unavailable') return null;\n }\n return readConfirmed(record, previous);\n}\n\nexport function applyReturned(\n confirmed: ConfirmedLayer,\n documents: Readonly<Record<string, string>>,\n revisions: Readonly<Record<string, string>>,\n removals: readonly string[],\n roomVersion: string,\n): ConfirmedLayer | null {\n const nextDocuments = { ...confirmed.record.documents, ...documents };\n const nextRevisions = { ...confirmed.record.revisions, ...revisions };\n const binaryTargets = new Set(confirmed.record.binaryTargets);\n for (const path of removals) {\n delete nextDocuments[path];\n delete nextRevisions[path];\n binaryTargets.delete(path);\n }\n return readStaged(\n {\n ...confirmed.record,\n roomVersion,\n documents: nextDocuments,\n revisions: nextRevisions,\n binaryTargets: [...binaryTargets].sort(),\n },\n confirmed,\n );\n}\n\nfunction predicted(\n confirmed: ConfirmedLayer,\n batches: readonly ChangeBatch[],\n previous?: Replica,\n): { layer: Layer; replay: readonly ReplayStep[] } {\n const composition = compositionOf(confirmed.record);\n let layer: Layer = confirmed.record;\n const replay: ReplayStep[] = [];\n const prior = new Map(previous?.replay.map((step) => [step.id, step]) ?? []);\n for (const batch of batches) {\n const before = layer;\n const old = prior.get(batch.id);\n const hasMove = batch.changes.some((change) => change.kind === 'move');\n const reuseRewrite =\n old?.collection !== undefined &&\n sameLayerText(before, old.before) &&\n old.collection.composition.collectionRoot === composition.collectionRoot &&\n old.collection.composition.model === composition.model &&\n old.collection.composition.selection?.model === composition.selection?.model &&\n JSON.stringify(old.collection.composition.selection?.roots) ===\n JSON.stringify(composition.selection?.roots);\n const collection = hasMove\n ? reuseRewrite\n ? old.collection\n : parseCollection(\n before.documents,\n composition,\n old?.collection === undefined\n ? { text: confirmed.record.documents, collection: confirmed.collection }\n : { text: old.before.documents, collection: old.collection },\n )\n : undefined;\n const effective =\n collection === undefined\n ? batch\n : reuseRewrite\n ? old.effective\n : providerRewritten(batch, { ...before, collection });\n layer =\n old === undefined\n ? overlay(before, [effective])\n : overlayChanged(before, [effective], old.before, [old.effective], old.after);\n replay.push({\n id: batch.id,\n before,\n after: layer,\n effective,\n ...(collection === undefined ? {} : { collection }),\n });\n }\n return { layer, replay };\n}\n\nexport function replicaOf(\n confirmed: ConfirmedLayer,\n queue: readonly ChangeBatch[],\n rewriting: Rewriting,\n previous?: Replica,\n): Replica {\n const batches = Object.freeze(queue.map(immutable));\n if (batches.length === 0) {\n return {\n confirmed,\n queue: batches,\n visible: {\n documents: confirmed.record.documents,\n binaryTargets: confirmed.record.binaryTargets,\n revisions: confirmed.record.revisions,\n collection: confirmed.collection,\n },\n replay: [],\n };\n }\n const predictedState = rewriting === 'provider' ? predicted(confirmed, batches, previous) : null;\n const layer =\n rewriting === 'provider'\n ? predictedState!.layer\n : previous === undefined\n ? overlay(confirmed.record, batches)\n : overlayChanged(\n confirmed.record,\n batches,\n previous.confirmed.record,\n previous.queue,\n previous.visible,\n );\n return {\n confirmed,\n queue: batches,\n replay: predictedState?.replay ?? [],\n visible: {\n ...layer,\n collection: parseCollection(\n layer.documents,\n compositionOf(confirmed.record),\n previous === undefined\n ? undefined\n : { text: previous.visible.documents, collection: previous.visible.collection },\n ),\n },\n };\n}\n\nfunction present(layer: Layer, path: string): boolean {\n return layer.documents[path] !== undefined || layer.binaryTargets.includes(path);\n}\n\nfunction holds(layer: Layer, preconditions: readonly Precondition[]): boolean {\n const parsed = new Map<string, Document | null>();\n const documentAt = (path: string) => {\n if (!parsed.has(path)) {\n const text = layer.documents[path];\n const opened = text === undefined ? null : parse(text, path);\n parsed.set(path, opened?.ok === true ? opened.document : null);\n }\n return parsed.get(path) ?? null;\n };\n return preconditions.every((precondition) => {\n const path = precondition.path;\n if (precondition.kind === 'absent') return !present(layer, path);\n if (precondition.kind === 'present') return present(layer, path);\n if (precondition.kind === 'revision') {\n return present(layer, path) && layer.revisions[path] === precondition.revision;\n }\n const document = documentAt(path);\n if (document === null) return false;\n if (precondition.kind === 'field') {\n const value = Object.hasOwn(document.fields, precondition.name)\n ? document.fields[precondition.name]\n : undefined;\n return equalValue(value, precondition.value);\n }\n if (precondition.kind === 'section') {\n return (\n Object.hasOwn(document.sections, precondition.name) &&\n document.sections[precondition.name] === precondition.value\n );\n }\n return document.preamble === precondition.value;\n });\n}\n\nexport function withdrawals(\n confirmed: ConfirmedLayer,\n queue: readonly ChangeBatch[],\n withdrawable: (batch: ChangeBatch) => boolean,\n rewriting: Rewriting,\n): readonly ChangeBatch[] {\n if (!queue.some(withdrawable)) return [];\n const composition = compositionOf(confirmed.record);\n let layer: Layer = confirmed.record;\n const withdrawn: ChangeBatch[] = [];\n for (const batch of queue) {\n if (withdrawable(batch) && !holds(layer, batch.preconditions)) {\n withdrawn.push(batch);\n continue;\n }\n const effective =\n rewriting === 'provider' && batch.changes.some((change) => change.kind === 'move')\n ? providerRewritten(batch, {\n ...layer,\n collection: parseCollection(layer.documents, composition),\n })\n : batch;\n layer = overlay(layer, [effective]);\n }\n return withdrawn;\n}\n"],"names":["parse","immutable","parseCollection","readCollection","validateCollection","overlay","overlayChanged","sameLayerText","providerRewritten","equalValue","compositionOf","record","collectionRoot","model","selection","typedSelection","roots","selectionModel","readConfirmed","previous","collection","documents","undefined","text","readStaged","status","verdict","binaryTargets","rule","applyReturned","confirmed","revisions","removals","roomVersion","nextDocuments","nextRevisions","Set","path","delete","sort","predicted","batches","composition","layer","replay","prior","Map","map","step","id","batch","before","old","get","hasMove","changes","some","change","kind","reuseRewrite","JSON","stringify","effective","after","push","replicaOf","queue","rewriting","Object","freeze","length","visible","predictedState","present","includes","holds","preconditions","parsed","documentAt","has","opened","set","ok","document","every","precondition","revision","value","hasOwn","fields","name","sections","preamble","withdrawals","withdrawable","withdrawn"],"mappings":"AAAA,SAASA,KAAK,QAAuB,uBAAuB;AAC5D,SAASC,SAAS,QAA6C,cAAc;AAC7E,SACEC,eAAe,EACfC,cAAc,EACdC,kBAAkB,QAGb,kBAAkB;AACzB,SAASC,OAAO,EAAEC,cAAc,EAAEC,aAAa,QAAoB,eAAe;AAClF,SAASC,iBAAiB,QAAwB,YAA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AAMK,OAAO,CAACC,IAAI,CAAC,CAACC,SAAWA,OAAOC,IAAI,KAAK,UACvElD,kBAAkB0C,OAAO;YACvB,GAAGP,KAAK;YACRvB,YAAYlB,gBAAgByC,MAAMtB,SAAS,EAAEqB;QAC/C,KACAQ;QACNP,QAAQtC,QAAQsC,OAAO;YAACmB;SAAU;IACpC;IACA,OAAOiC;AACT"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
+
import type { Change, Precondition } from './change.js';
|
|
3
|
+
import type { VisibleLayer } from './replica.js';
|
|
4
|
+
export type FieldValue = {
|
|
5
|
+
readonly value: unknown;
|
|
6
|
+
} | null;
|
|
7
|
+
export type RoomDraftCreation = {
|
|
8
|
+
readonly type: string;
|
|
9
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
10
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
11
|
+
} | {
|
|
12
|
+
readonly markdown: string;
|
|
13
|
+
};
|
|
14
|
+
export type RoomDraftParts = {
|
|
15
|
+
readonly fields?: Readonly<Record<string, {
|
|
16
|
+
readonly value: unknown;
|
|
17
|
+
readonly base?: FieldValue;
|
|
18
|
+
}>>;
|
|
19
|
+
readonly sections?: Readonly<Record<string, {
|
|
20
|
+
readonly value: string;
|
|
21
|
+
readonly base?: string;
|
|
22
|
+
}>>;
|
|
23
|
+
readonly preamble?: {
|
|
24
|
+
readonly value: string;
|
|
25
|
+
readonly base?: string;
|
|
26
|
+
};
|
|
27
|
+
readonly markdown?: {
|
|
28
|
+
readonly value: string;
|
|
29
|
+
readonly base?: string;
|
|
30
|
+
};
|
|
31
|
+
readonly creation?: RoomDraftCreation;
|
|
32
|
+
readonly move?: {
|
|
33
|
+
readonly to: string;
|
|
34
|
+
readonly base?: string | null;
|
|
35
|
+
};
|
|
36
|
+
readonly removal?: {
|
|
37
|
+
readonly base?: string | null;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
type HeldParts = {
|
|
41
|
+
readonly fields?: Readonly<Record<string, {
|
|
42
|
+
readonly value: unknown;
|
|
43
|
+
readonly base: FieldValue;
|
|
44
|
+
}>>;
|
|
45
|
+
readonly sections?: Readonly<Record<string, {
|
|
46
|
+
readonly value: string;
|
|
47
|
+
readonly base: string;
|
|
48
|
+
}>>;
|
|
49
|
+
readonly preamble?: {
|
|
50
|
+
readonly value: string;
|
|
51
|
+
readonly base: string;
|
|
52
|
+
};
|
|
53
|
+
readonly markdown?: {
|
|
54
|
+
readonly value: string;
|
|
55
|
+
readonly base: string;
|
|
56
|
+
};
|
|
57
|
+
readonly creation?: RoomDraftCreation;
|
|
58
|
+
readonly move?: {
|
|
59
|
+
readonly to: string;
|
|
60
|
+
readonly base: string | null;
|
|
61
|
+
};
|
|
62
|
+
readonly removal?: {
|
|
63
|
+
readonly base: string | null;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
type ChangedUnderneath = {
|
|
67
|
+
readonly fields?: Readonly<Record<string, FieldValue>>;
|
|
68
|
+
readonly sections?: Readonly<Record<string, string | null>>;
|
|
69
|
+
readonly preamble?: string | null;
|
|
70
|
+
readonly markdown?: string | null;
|
|
71
|
+
readonly creation?: string;
|
|
72
|
+
readonly move?: string | null;
|
|
73
|
+
readonly removal?: string | null;
|
|
74
|
+
};
|
|
75
|
+
export type ReturnReason = (ProviderRefusal & {
|
|
76
|
+
readonly kind: 'conflicted' | 'rejected';
|
|
77
|
+
}) | {
|
|
78
|
+
readonly kind: 'expired';
|
|
79
|
+
} | {
|
|
80
|
+
readonly kind: 'withdrawn';
|
|
81
|
+
};
|
|
82
|
+
export type RoomDraft = {
|
|
83
|
+
readonly room: string;
|
|
84
|
+
readonly path: string;
|
|
85
|
+
readonly revision: string;
|
|
86
|
+
readonly parts: HeldParts;
|
|
87
|
+
readonly changedUnderneath: ChangedUnderneath;
|
|
88
|
+
readonly returned: ReturnReason | null;
|
|
89
|
+
};
|
|
90
|
+
export type RoomDraftWrite = {
|
|
91
|
+
readonly outcome: 'written';
|
|
92
|
+
readonly roomDraft: RoomDraft | null;
|
|
93
|
+
} | {
|
|
94
|
+
readonly outcome: 'stale';
|
|
95
|
+
readonly current: RoomDraft | null;
|
|
96
|
+
};
|
|
97
|
+
export type ChangedPart = {
|
|
98
|
+
readonly path: string;
|
|
99
|
+
readonly part: 'field' | 'section' | 'preamble' | 'markdown' | 'creation' | 'move' | 'removal';
|
|
100
|
+
readonly name?: string;
|
|
101
|
+
};
|
|
102
|
+
export type RoomDraftRecord = {
|
|
103
|
+
readonly locator: string;
|
|
104
|
+
readonly path: string;
|
|
105
|
+
readonly revision: string;
|
|
106
|
+
readonly parts: HeldParts;
|
|
107
|
+
readonly returned: ReturnReason | null;
|
|
108
|
+
};
|
|
109
|
+
export type SavedDraft = {
|
|
110
|
+
readonly path: string;
|
|
111
|
+
readonly parts: HeldParts;
|
|
112
|
+
};
|
|
113
|
+
export declare function readParts(value: unknown): RoomDraftParts;
|
|
114
|
+
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts): HeldParts;
|
|
115
|
+
export declare function equalValue(left: unknown, right: unknown): boolean;
|
|
116
|
+
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
117
|
+
export declare function changedParts(path: string, report: ChangedUnderneath): readonly ChangedPart[];
|
|
118
|
+
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
119
|
+
export declare function changesOf(path: string, parts: HeldParts): {
|
|
120
|
+
changes: readonly Change[];
|
|
121
|
+
bases: readonly Precondition[];
|
|
122
|
+
};
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=room-draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-draft.d.ts","sourceRoot":"","sources":["../src/room-draft.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAA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