@agentshouse/mdruntime 0.1.0-c8ca66ac9e99d → 0.1.0-c8eac46931574
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 +19 -16
- package/dist/adapter.d.ts +152 -53
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +5 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +38 -4
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +27 -11
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +184 -81
- package/dist/chain.d.ts +11 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -63
- package/dist/change.d.ts +31 -1
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +10 -1
- package/dist/client.d.ts +28 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +98 -12
- package/dist/collection.d.ts +10 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +38 -79
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +789 -0
- package/dist/connection.d.ts +44 -16
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +3840 -967
- package/dist/conversation.d.ts +39 -17
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +704 -259
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +4 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +20 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +152 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -19
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +7 -122
- package/dist/host.d.ts +11 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +127 -17
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +3 -0
- package/dist/index.d.ts +17 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/job.d.ts +8 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +13 -0
- package/dist/live.d.ts +23 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +127 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +16 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +214 -94
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +89 -0
- package/dist/model.d.ts +9 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +8 -2
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +22 -4
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +120 -14
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +49 -7
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +40 -0
- package/dist/overlay.d.ts +3 -4
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +100 -182
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/phrase.d.ts +3 -0
- package/dist/phrase.d.ts.map +1 -0
- package/dist/phrase.js +8 -0
- package/dist/query.d.ts +70 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +67 -7
- package/dist/reach.d.ts +19 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +227 -80
- package/dist/react.d.ts +9 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/readiness.d.ts +50 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +27 -0
- package/dist/recovery.d.ts +26 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +224 -0
- package/dist/refresh.d.ts +17 -14
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +155 -51
- package/dist/replica.d.ts +55 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +300 -154
- package/dist/room-draft.d.ts +36 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +161 -74
- package/dist/rows.d.ts +38 -37
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +178 -104
- package/dist/save.d.ts +52 -9
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +539 -171
- package/dist/search.d.ts +15 -55
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -121
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +421 -0
- package/dist/status.d.ts +5 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +111 -78
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +342 -478
- package/dist/stored.d.ts +162 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +549 -0
- package/dist/tables.d.ts +353 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +585 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +75 -0
- package/dist/validation.d.ts +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +101 -0
- package/dist/windows.d.ts +22 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +89 -0
- package/dist/wire.d.ts +165 -32
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +56 -31
- package/package.json +22 -19
- package/AGENTS.md +0 -299
- package/dist/chat/acts.d.ts +0 -34
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/context.js +0 -10
- package/dist/chat/input.d.ts +0 -9
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -99
- package/dist/chat/kit.d.ts +0 -60
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -26
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -62
- package/dist/chat/markdown.d.ts +0 -20
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -188
- package/dist/chat/message.d.ts +0 -6
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -192
- package/dist/chat/messages.d.ts +0 -21
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -151
- package/dist/chat/name.d.ts +0 -6
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -11
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -17
- package/dist/chat/overlay.d.ts +0 -31
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -97
- package/dist/chat/parts.d.ts +0 -57
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -119
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -63
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -645
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -80
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -33
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -91
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -302
- package/dist/chat.d.ts +0 -14
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/read-side.d.ts +0 -18
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -440
package/dist/replica.d.ts
CHANGED
|
@@ -1,46 +1,68 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BootstrapInventory, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
|
|
2
|
+
import { type ChangeBatch, type Precondition } from './change.js';
|
|
2
3
|
import { type Collection, type Composition } from './collection.js';
|
|
4
|
+
import { type ModelState } from './model.js';
|
|
3
5
|
import { type Layer } from './overlay.js';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import type { HeldEntry, OverlayEntry, StoredEntry } from './tables.js';
|
|
7
|
+
export type ReplicaRecord = {
|
|
8
|
+
readonly locator: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly handle: string;
|
|
11
|
+
readonly operations: OperationScopes;
|
|
12
|
+
readonly replica: ReplicaAdmission;
|
|
13
|
+
readonly model: ModelState;
|
|
14
|
+
readonly typedSelection: TypedSelection | null;
|
|
15
|
+
readonly providerOwnedPaths: readonly string[];
|
|
16
|
+
readonly roomVersion: string;
|
|
17
|
+
readonly transfer: string;
|
|
18
|
+
readonly inventory: BootstrapInventory;
|
|
19
|
+
readonly key: number;
|
|
20
|
+
};
|
|
21
|
+
export type HeldReplica = {
|
|
22
|
+
readonly record: ReplicaRecord;
|
|
23
|
+
readonly queue: readonly ChangeBatch[];
|
|
24
|
+
readonly overlaid: ReadonlySet<string>;
|
|
25
|
+
readonly count: number;
|
|
26
|
+
readonly confirmed: number;
|
|
27
|
+
readonly indexed: boolean;
|
|
10
28
|
};
|
|
11
29
|
export type VisibleLayer = Layer & {
|
|
12
|
-
collection: Collection;
|
|
30
|
+
readonly collection: Collection;
|
|
13
31
|
};
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} | Refused;
|
|
18
|
-
export type Replica = {
|
|
19
|
-
confirmed: ConfirmedLayer;
|
|
20
|
-
queue: readonly ChangeBatch[];
|
|
21
|
-
visible: VisibleLayer;
|
|
22
|
-
replay: readonly ReplayStep[];
|
|
32
|
+
export type Slice = Layer & {
|
|
33
|
+
readonly written: Readonly<Record<string, string>>;
|
|
34
|
+
readonly held: ReadonlySet<string>;
|
|
23
35
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState): Composition;
|
|
37
|
+
export declare function storedRecord(record: ReplicaRecord): string;
|
|
38
|
+
export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
|
|
39
|
+
export declare function entryAt(layer: Layer & {
|
|
40
|
+
readonly written?: Readonly<Record<string, string>>;
|
|
41
|
+
}, path: string): StoredEntry | null;
|
|
42
|
+
export declare function slicingWith(slice: Slice, set: readonly StoredEntry[], removed: readonly string[]): Generator<number, Slice, void>;
|
|
43
|
+
export declare function touchedBy(queue: readonly ChangeBatch[]): Set<string>;
|
|
44
|
+
export declare function movedBy(queue: readonly ChangeBatch[], locator: string): Set<string>;
|
|
45
|
+
export type Replayed = {
|
|
46
|
+
readonly visible: VisibleLayer;
|
|
47
|
+
readonly touched: ReadonlySet<string>;
|
|
30
48
|
};
|
|
31
|
-
export declare function
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
export
|
|
36
|
-
|
|
49
|
+
export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
|
|
50
|
+
export declare function overlayOf(visible: Layer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
|
|
51
|
+
export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
|
|
52
|
+
export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
|
|
53
|
+
export type Standing = {
|
|
54
|
+
readonly withdrawn: readonly ChangeBatch[];
|
|
55
|
+
readonly kept: readonly ChangeBatch[];
|
|
37
56
|
};
|
|
57
|
+
export declare function standing(confirmed: Slice, queue: readonly ChangeBatch[], withdrawable: (batch: ChangeBatch) => boolean, local: boolean, locator: string, composition: Composition): Generator<number, Standing, void>;
|
|
38
58
|
type Accepted = Extract<MutationResult, {
|
|
39
59
|
kind: 'accepted';
|
|
40
60
|
}>;
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
export type Returned = {
|
|
62
|
+
readonly set: readonly StoredEntry[];
|
|
63
|
+
readonly removed: readonly string[];
|
|
64
|
+
};
|
|
65
|
+
export declare function returnedPaths(submitted: ChangeBatch, accepted: Accepted): Set<string>;
|
|
66
|
+
export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string): Generator<number, Returned, void>;
|
|
45
67
|
export {};
|
|
46
68
|
//# sourceMappingURL=replica.d.ts.map
|
package/dist/replica.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replica.d.ts","sourceRoot":"","sources":["../src/replica.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"replica.d.ts","sourceRoot":"","sources":["../src/replica.ts"],"names":[],"mappings":"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"}
|
package/dist/replica.js
CHANGED
|
@@ -1,174 +1,197 @@
|
|
|
1
1
|
import { equalValue, parse } from '@agentshouse/mdmodel';
|
|
2
2
|
import { immutable, landing } from './change.js';
|
|
3
|
-
import { collectionOf
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { collectionOf } from './collection.js';
|
|
4
|
+
import { storedModel } from './model.js';
|
|
5
|
+
import { acceptedBinaries, overlaying } from './overlay.js';
|
|
6
|
+
import { effectiveIn, rewriting } from './save.js';
|
|
7
|
+
import { ROW_WEIGHT } from './turn.js';
|
|
8
|
+
export function compositionOf(record, builtIn) {
|
|
7
9
|
return {
|
|
8
10
|
model: record.model,
|
|
9
11
|
selection: record.typedSelection === null
|
|
10
12
|
? null
|
|
11
|
-
: { roots: record.typedSelection.roots, model:
|
|
13
|
+
: { roots: record.typedSelection.roots, model: builtIn },
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
|
-
export function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
collection: collectionOf(record.documents, compositionOf(record), previous?.collection),
|
|
18
|
-
};
|
|
16
|
+
export function storedRecord(record) {
|
|
17
|
+
const { key: _key, ...stored } = record;
|
|
18
|
+
return JSON.stringify({ ...stored, model: storedModel(stored.model) });
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
record.selectionModel !== previous?.record.selectionModel)) {
|
|
31
|
-
const verdict = validateCollection(record.documents, Object.keys(record.binaries), compositionOf(record));
|
|
32
|
-
if (verdict.verdict === 'refuse' && verdict.rule !== 'model-unavailable') {
|
|
33
|
-
return { kind: 'refused', refusal: verdict };
|
|
34
|
-
}
|
|
35
|
-
if (verdict.verdict === 'refuse') {
|
|
36
|
-
const refused = unreadable(record.documents, previous?.record.documents);
|
|
37
|
-
if (refused !== null)
|
|
38
|
-
return refused;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else if (textChanged) {
|
|
42
|
-
const refused = unreadable(record.documents, previous?.record.documents);
|
|
43
|
-
if (refused !== null)
|
|
44
|
-
return refused;
|
|
20
|
+
const PROBES = new Set([
|
|
21
|
+
'then',
|
|
22
|
+
'toJSON',
|
|
23
|
+
'constructor',
|
|
24
|
+
'valueOf',
|
|
25
|
+
'toString',
|
|
26
|
+
]);
|
|
27
|
+
class UnreadPath extends Error {
|
|
28
|
+
constructor(path) {
|
|
29
|
+
super(`the replica slice holds no row for ${path}`);
|
|
45
30
|
}
|
|
46
|
-
return { kind: 'staged', confirmed: confirmedOf(record, previous) };
|
|
47
31
|
}
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
function strict(values, held) {
|
|
33
|
+
const guard = (property) => {
|
|
34
|
+
if (typeof property === 'string' && !held.has(property) && !PROBES.has(property)) {
|
|
35
|
+
throw new UnreadPath(property);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return new Proxy(values, {
|
|
39
|
+
get(target, property, receiver) {
|
|
40
|
+
guard(property);
|
|
41
|
+
return Reflect.get(target, property, receiver);
|
|
42
|
+
},
|
|
43
|
+
has(target, property) {
|
|
44
|
+
guard(property);
|
|
45
|
+
return Reflect.has(target, property);
|
|
46
|
+
},
|
|
47
|
+
getOwnPropertyDescriptor(target, property) {
|
|
48
|
+
guard(property);
|
|
49
|
+
return Reflect.getOwnPropertyDescriptor(target, property);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
55
52
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
for (const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
export function* slicing(entries, paths) {
|
|
54
|
+
const held = new Set(paths);
|
|
55
|
+
for (const entry of entries)
|
|
56
|
+
held.add(entry.path);
|
|
57
|
+
const documents = {};
|
|
58
|
+
const binaries = {};
|
|
59
|
+
const revisions = {};
|
|
60
|
+
const fileIds = {};
|
|
61
|
+
const changes = {};
|
|
62
|
+
const written = {};
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
if (entry.binary !== null)
|
|
65
|
+
binaries[entry.path] = entry.binary;
|
|
66
|
+
else if (entry.content !== null)
|
|
67
|
+
documents[entry.path] = entry.content;
|
|
68
|
+
if (entry.revision !== null)
|
|
69
|
+
revisions[entry.path] = entry.revision;
|
|
70
|
+
if (entry.fileId !== null)
|
|
71
|
+
fileIds[entry.path] = entry.fileId;
|
|
72
|
+
if (entry.change !== null)
|
|
73
|
+
changes[entry.path] = entry.change;
|
|
74
|
+
if (entry.written !== null)
|
|
75
|
+
written[entry.path] = entry.written;
|
|
76
|
+
yield ROW_WEIGHT;
|
|
66
77
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
return {
|
|
79
|
+
documents: strict(documents, held),
|
|
80
|
+
binaries: strict(binaries, held),
|
|
81
|
+
revisions: strict(revisions, held),
|
|
82
|
+
fileIds: strict(fileIds, held),
|
|
83
|
+
changes: strict(changes, held),
|
|
84
|
+
written: strict(written, held),
|
|
85
|
+
held,
|
|
86
|
+
};
|
|
71
87
|
}
|
|
72
|
-
export function
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
export function entryAt(layer, path) {
|
|
89
|
+
const content = layer.documents[path];
|
|
90
|
+
const binary = layer.binaries[path];
|
|
91
|
+
if (content === undefined && binary === undefined)
|
|
92
|
+
return null;
|
|
93
|
+
return {
|
|
94
|
+
path,
|
|
95
|
+
content: content ?? null,
|
|
96
|
+
outline: null,
|
|
97
|
+
binary: binary ?? null,
|
|
98
|
+
revision: layer.revisions[path] ?? null,
|
|
99
|
+
fileId: layer.fileIds[path] ?? null,
|
|
100
|
+
change: layer.changes[path] ?? null,
|
|
101
|
+
written: layer.written?.[path] ?? null,
|
|
80
102
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
103
|
+
}
|
|
104
|
+
export function* slicingWith(slice, set, removed) {
|
|
105
|
+
const entries = new Map();
|
|
106
|
+
for (const path of slice.held) {
|
|
107
|
+
const entry = entryAt(slice, path);
|
|
108
|
+
if (entry !== null)
|
|
109
|
+
entries.set(path, { ...entry, type: null });
|
|
110
|
+
yield ROW_WEIGHT;
|
|
84
111
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
112
|
+
for (const path of removed)
|
|
113
|
+
entries.delete(path);
|
|
114
|
+
for (const entry of set)
|
|
115
|
+
entries.set(entry.path, { ...entry, type: null });
|
|
116
|
+
return yield* slicing([...entries.values()], [...slice.held, ...set.map(({ path }) => path), ...removed]);
|
|
117
|
+
}
|
|
118
|
+
function changePaths(change) {
|
|
119
|
+
return change.kind === 'move' ? [change.path, change.to] : [change.path];
|
|
120
|
+
}
|
|
121
|
+
export function touchedBy(queue) {
|
|
122
|
+
const paths = new Set();
|
|
123
|
+
for (const batch of queue) {
|
|
124
|
+
for (const change of batch.changes)
|
|
125
|
+
for (const path of changePaths(change))
|
|
126
|
+
paths.add(path);
|
|
127
|
+
for (const precondition of batch.preconditions)
|
|
128
|
+
paths.add(precondition.path);
|
|
129
|
+
for (const move of batch.between?.moves ?? [])
|
|
130
|
+
paths.add(move.path);
|
|
91
131
|
}
|
|
92
|
-
return
|
|
93
|
-
...confirmed.record,
|
|
94
|
-
roomVersion,
|
|
95
|
-
documents: nextDocuments,
|
|
96
|
-
revisions: nextRevisions,
|
|
97
|
-
changes: nextChanges,
|
|
98
|
-
written: nextWritten,
|
|
99
|
-
binaries: returnedBinaries(confirmed.record.binaries, submitted, accepted),
|
|
100
|
-
}, confirmed);
|
|
132
|
+
return paths;
|
|
101
133
|
}
|
|
102
|
-
function
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
old.collection.composition.selection?.model === composition.selection?.model &&
|
|
115
|
-
JSON.stringify(old.collection.composition.selection?.roots) ===
|
|
116
|
-
JSON.stringify(composition.selection?.roots);
|
|
117
|
-
const collection = hasMove
|
|
118
|
-
? reuseRewrite
|
|
119
|
-
? old.collection
|
|
120
|
-
: collectionOf(before.documents, composition, old?.collection ?? confirmed.collection)
|
|
121
|
-
: undefined;
|
|
122
|
-
const effective = collection === undefined
|
|
123
|
-
? batch
|
|
124
|
-
: reuseRewrite
|
|
125
|
-
? old.effective
|
|
126
|
-
: providerRewritten(batch, { ...before, collection });
|
|
127
|
-
layer =
|
|
128
|
-
old === undefined
|
|
129
|
-
? overlay(before, [effective])
|
|
130
|
-
: overlayChanged(before, [effective], old.before, [old.effective], old.after);
|
|
131
|
-
replay.push({
|
|
132
|
-
id: batch.id,
|
|
133
|
-
before,
|
|
134
|
-
after: layer,
|
|
135
|
-
effective,
|
|
136
|
-
...(collection === undefined ? {} : { collection }),
|
|
137
|
-
});
|
|
134
|
+
export function movedBy(queue, locator) {
|
|
135
|
+
const paths = new Set();
|
|
136
|
+
for (const batch of queue) {
|
|
137
|
+
if (!rewriting(batch, locator))
|
|
138
|
+
continue;
|
|
139
|
+
for (const change of batch.changes)
|
|
140
|
+
if (change.kind === 'move')
|
|
141
|
+
paths.add(change.path);
|
|
142
|
+
if (batch.between?.source.room === locator) {
|
|
143
|
+
for (const move of batch.between.moves)
|
|
144
|
+
paths.add(move.path);
|
|
145
|
+
}
|
|
138
146
|
}
|
|
139
|
-
return
|
|
147
|
+
return paths;
|
|
140
148
|
}
|
|
141
|
-
export function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
export function* replaying(confirmed, queue, locator, composition) {
|
|
150
|
+
let layer = confirmed;
|
|
151
|
+
const touched = new Set();
|
|
152
|
+
for (const batch of queue) {
|
|
153
|
+
const effective = rewriting(batch, locator)
|
|
154
|
+
? yield* effectiveIn(batch, locator, {
|
|
155
|
+
...layer,
|
|
156
|
+
collection: collectionOf(layer.documents, composition),
|
|
157
|
+
})
|
|
158
|
+
: batch;
|
|
159
|
+
for (const change of effective.changes)
|
|
160
|
+
for (const path of changePaths(change))
|
|
161
|
+
touched.add(path);
|
|
162
|
+
layer = yield* overlaying(layer, [effective]);
|
|
163
|
+
yield ROW_WEIGHT;
|
|
156
164
|
}
|
|
157
|
-
const { layer, replay } = predicted(confirmed, batches, previous);
|
|
158
165
|
return {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
replay,
|
|
162
|
-
visible: {
|
|
163
|
-
...layer,
|
|
164
|
-
collection: collectionOf(layer.documents, compositionOf(confirmed.record), previous?.visible.collection ?? confirmed.collection),
|
|
165
|
-
},
|
|
166
|
+
visible: { ...layer, collection: collectionOf(layer.documents, composition) },
|
|
167
|
+
touched,
|
|
166
168
|
};
|
|
167
169
|
}
|
|
170
|
+
export function* overlayOf(visible, touched) {
|
|
171
|
+
const rows = [];
|
|
172
|
+
for (const path of touched) {
|
|
173
|
+
yield ROW_WEIGHT;
|
|
174
|
+
const entry = entryAt(visible, path);
|
|
175
|
+
rows.push(entry === null
|
|
176
|
+
? {
|
|
177
|
+
path,
|
|
178
|
+
present: false,
|
|
179
|
+
content: null,
|
|
180
|
+
outline: null,
|
|
181
|
+
binary: null,
|
|
182
|
+
revision: null,
|
|
183
|
+
fileId: null,
|
|
184
|
+
change: null,
|
|
185
|
+
written: null,
|
|
186
|
+
}
|
|
187
|
+
: { ...entry, written: null, present: true });
|
|
188
|
+
}
|
|
189
|
+
return rows;
|
|
190
|
+
}
|
|
168
191
|
function present(layer, path) {
|
|
169
192
|
return layer.documents[path] !== undefined || layer.binaries[path] !== undefined;
|
|
170
193
|
}
|
|
171
|
-
function holds(layer, preconditions) {
|
|
194
|
+
export function holds(layer, preconditions) {
|
|
172
195
|
const parsed = new Map();
|
|
173
196
|
const documentAt = (path) => {
|
|
174
197
|
if (!parsed.has(path)) {
|
|
@@ -233,12 +256,19 @@ function effects(change) {
|
|
|
233
256
|
{ kind: 'present', path: change.to },
|
|
234
257
|
];
|
|
235
258
|
}
|
|
236
|
-
if (change.kind === 'binary')
|
|
259
|
+
if (change.kind === 'binary' || change.kind === 'arrival')
|
|
237
260
|
return [{ kind: 'present', path }];
|
|
238
261
|
return [{ kind: 'absent', path }];
|
|
239
262
|
}
|
|
240
263
|
export function landed(batch, confirmed, current = {}) {
|
|
241
|
-
const
|
|
264
|
+
const documents = new Proxy(confirmed.documents, {
|
|
265
|
+
get(target, property, receiver) {
|
|
266
|
+
if (typeof property === 'string' && Object.hasOwn(current, property))
|
|
267
|
+
return current[property];
|
|
268
|
+
return Reflect.get(target, property, receiver);
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
const layer = { ...confirmed, documents };
|
|
242
272
|
return batch.changes.every((change, index) => {
|
|
243
273
|
if (change.kind === 'replace' || (change.kind === 'create' && 'content' in change)) {
|
|
244
274
|
const at = landing(batch.changes, index, change.path);
|
|
@@ -256,32 +286,148 @@ export function landed(batch, confirmed, current = {}) {
|
|
|
256
286
|
});
|
|
257
287
|
});
|
|
258
288
|
}
|
|
259
|
-
|
|
289
|
+
function founded(batch, layer) {
|
|
290
|
+
let changed = false;
|
|
291
|
+
const preconditions = batch.preconditions.map((precondition) => {
|
|
292
|
+
if (precondition.kind !== 'content')
|
|
293
|
+
return precondition;
|
|
294
|
+
const revision = layer.revisions[precondition.path];
|
|
295
|
+
if (revision === undefined || layer.documents[precondition.path] !== precondition.content) {
|
|
296
|
+
return precondition;
|
|
297
|
+
}
|
|
298
|
+
changed = true;
|
|
299
|
+
return { kind: 'revision', path: precondition.path, revision };
|
|
300
|
+
});
|
|
301
|
+
return changed ? immutable({ ...batch, preconditions }) : batch;
|
|
302
|
+
}
|
|
303
|
+
export function* standing(confirmed, queue, withdrawable, local, locator, composition) {
|
|
260
304
|
if (!queue.some(withdrawable))
|
|
261
|
-
return [];
|
|
262
|
-
|
|
263
|
-
let layer = confirmed.record;
|
|
305
|
+
return { withdrawn: [], kept: queue };
|
|
306
|
+
let layer = confirmed;
|
|
264
307
|
const withdrawn = [];
|
|
308
|
+
const kept = [];
|
|
265
309
|
for (const batch of queue) {
|
|
266
310
|
if (withdrawable(batch) && !holds(layer, batch.preconditions)) {
|
|
267
311
|
withdrawn.push(batch);
|
|
268
312
|
continue;
|
|
269
313
|
}
|
|
270
|
-
const effective = batch
|
|
271
|
-
?
|
|
314
|
+
const effective = rewriting(batch, locator)
|
|
315
|
+
? yield* effectiveIn(batch, locator, {
|
|
272
316
|
...layer,
|
|
273
317
|
collection: collectionOf(layer.documents, composition),
|
|
274
318
|
})
|
|
275
319
|
: batch;
|
|
276
320
|
let unapplied = false;
|
|
277
|
-
const next =
|
|
321
|
+
const next = yield* overlaying(layer, [effective], () => {
|
|
278
322
|
unapplied = true;
|
|
279
323
|
});
|
|
280
324
|
if (local && unapplied) {
|
|
281
325
|
withdrawn.push(batch);
|
|
282
326
|
continue;
|
|
283
327
|
}
|
|
328
|
+
kept.push(local || !withdrawable(batch) ? batch : founded(batch, layer));
|
|
284
329
|
layer = next;
|
|
285
330
|
}
|
|
286
|
-
return withdrawn;
|
|
331
|
+
return { withdrawn, kept };
|
|
332
|
+
}
|
|
333
|
+
export function returnedPaths(submitted, accepted) {
|
|
334
|
+
const paths = new Set([
|
|
335
|
+
...Object.keys(accepted.documents),
|
|
336
|
+
...Object.keys(accepted.revisions),
|
|
337
|
+
...Object.keys(accepted.fileIds ?? {}),
|
|
338
|
+
...Object.keys(accepted.changes),
|
|
339
|
+
...Object.keys(accepted.binaryFiles ?? {}),
|
|
340
|
+
...accepted.removals,
|
|
341
|
+
]);
|
|
342
|
+
for (const change of submitted.changes) {
|
|
343
|
+
if (change.kind === 'move') {
|
|
344
|
+
paths.add(change.path);
|
|
345
|
+
paths.add(change.to);
|
|
346
|
+
}
|
|
347
|
+
if (change.kind === 'arrival')
|
|
348
|
+
paths.add(change.path);
|
|
349
|
+
}
|
|
350
|
+
return paths;
|
|
351
|
+
}
|
|
352
|
+
export function* returning(confirmed, submitted, accepted, writtenAt) {
|
|
353
|
+
const documents = new Map();
|
|
354
|
+
const binaries = new Map();
|
|
355
|
+
const revisions = new Map();
|
|
356
|
+
const fileIds = new Map();
|
|
357
|
+
const changes = new Map();
|
|
358
|
+
const written = new Map();
|
|
359
|
+
const read = (changed, held, path) => (changed.has(path) ? changed.get(path) : held[path]);
|
|
360
|
+
for (const [path, content] of Object.entries(accepted.documents)) {
|
|
361
|
+
yield ROW_WEIGHT;
|
|
362
|
+
documents.set(path, content);
|
|
363
|
+
fileIds.set(path, undefined);
|
|
364
|
+
written.set(path, writtenAt);
|
|
365
|
+
}
|
|
366
|
+
for (const [path, revision] of Object.entries(accepted.revisions)) {
|
|
367
|
+
yield ROW_WEIGHT;
|
|
368
|
+
revisions.set(path, revision);
|
|
369
|
+
fileIds.set(path, undefined);
|
|
370
|
+
if (confirmed.revisions[path] !== revision)
|
|
371
|
+
changes.set(path, undefined);
|
|
372
|
+
}
|
|
373
|
+
for (const [path, fileId] of Object.entries(accepted.fileIds ?? {}))
|
|
374
|
+
fileIds.set(path, fileId);
|
|
375
|
+
for (const [path, change] of Object.entries(accepted.changes))
|
|
376
|
+
changes.set(path, change);
|
|
377
|
+
for (const path of accepted.removals) {
|
|
378
|
+
documents.set(path, undefined);
|
|
379
|
+
revisions.set(path, undefined);
|
|
380
|
+
fileIds.set(path, undefined);
|
|
381
|
+
changes.set(path, undefined);
|
|
382
|
+
written.set(path, undefined);
|
|
383
|
+
}
|
|
384
|
+
for (const change of submitted.changes) {
|
|
385
|
+
if (change.kind === 'arrival' && 'binary' in change) {
|
|
386
|
+
if (accepted.revisions[change.path] !== undefined) {
|
|
387
|
+
binaries.set(change.path, { state: 'accepted', ...change.binary });
|
|
388
|
+
}
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
if (change.kind !== 'move')
|
|
392
|
+
continue;
|
|
393
|
+
const moved = read(binaries, confirmed.binaries, change.path);
|
|
394
|
+
if (moved === undefined || accepted.revisions[change.to] === undefined)
|
|
395
|
+
continue;
|
|
396
|
+
binaries.set(change.to, moved);
|
|
397
|
+
binaries.set(change.path, undefined);
|
|
398
|
+
}
|
|
399
|
+
for (const [path, binary] of acceptedBinaries(accepted.binaryFiles ?? {}))
|
|
400
|
+
binaries.set(path, binary);
|
|
401
|
+
for (const path of accepted.removals)
|
|
402
|
+
binaries.set(path, undefined);
|
|
403
|
+
const paths = new Set([
|
|
404
|
+
...documents.keys(),
|
|
405
|
+
...binaries.keys(),
|
|
406
|
+
...revisions.keys(),
|
|
407
|
+
...fileIds.keys(),
|
|
408
|
+
...changes.keys(),
|
|
409
|
+
...written.keys(),
|
|
410
|
+
]);
|
|
411
|
+
const set = [];
|
|
412
|
+
const removed = [];
|
|
413
|
+
for (const path of paths) {
|
|
414
|
+
yield ROW_WEIGHT;
|
|
415
|
+
const content = read(documents, confirmed.documents, path);
|
|
416
|
+
const binary = read(binaries, confirmed.binaries, path);
|
|
417
|
+
if (content === undefined && binary === undefined) {
|
|
418
|
+
removed.push(path);
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
set.push({
|
|
422
|
+
path,
|
|
423
|
+
content: binary === undefined ? (content ?? null) : null,
|
|
424
|
+
outline: null,
|
|
425
|
+
binary: binary ?? null,
|
|
426
|
+
revision: read(revisions, confirmed.revisions, path) ?? null,
|
|
427
|
+
fileId: read(fileIds, confirmed.fileIds, path) ?? null,
|
|
428
|
+
change: read(changes, confirmed.changes, path) ?? null,
|
|
429
|
+
written: read(written, confirmed.written, path) ?? null,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
return { set, removed };
|
|
287
433
|
}
|