@amalgm/live 0.2.81-main.41740705397 → 0.2.81-main.41784750721
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/dist/apply/contracts.d.ts +4 -2
- package/dist/apply/contracts.d.ts.map +1 -1
- package/dist/apply/contracts.js.map +1 -1
- package/dist/apply/index.d.ts +0 -3
- package/dist/apply/index.d.ts.map +1 -1
- package/dist/apply/index.js +0 -3
- package/dist/apply/index.js.map +1 -1
- package/dist/apply/plans.d.ts +3 -4
- package/dist/apply/plans.d.ts.map +1 -1
- package/dist/apply/plans.js +2 -6
- package/dist/apply/plans.js.map +1 -1
- package/dist/apply/settling.d.ts +1 -1
- package/dist/apply/settling.d.ts.map +1 -1
- package/dist/apply/window.d.ts +0 -2
- package/dist/apply/window.d.ts.map +1 -1
- package/dist/apply/window.js +0 -2
- package/dist/apply/window.js.map +1 -1
- package/dist/contracts/validate.d.ts +0 -2
- package/dist/contracts/validate.d.ts.map +1 -1
- package/dist/contracts/validate.js +0 -2
- package/dist/contracts/validate.js.map +1 -1
- package/dist/detection/batch.d.ts +0 -1
- package/dist/detection/batch.d.ts.map +1 -1
- package/dist/detection/batch.js +1 -4
- package/dist/detection/batch.js.map +1 -1
- package/dist/detection/content.d.ts +29 -12
- package/dist/detection/content.d.ts.map +1 -1
- package/dist/detection/content.js +58 -75
- package/dist/detection/content.js.map +1 -1
- package/dist/detection/echo.d.ts +3 -15
- package/dist/detection/echo.d.ts.map +1 -1
- package/dist/detection/echo.js +3 -18
- package/dist/detection/echo.js.map +1 -1
- package/dist/detection/enrollment.d.ts +3 -5
- package/dist/detection/enrollment.d.ts.map +1 -1
- package/dist/detection/enrollment.js.map +1 -1
- package/dist/detection/index.d.ts +2 -0
- package/dist/detection/index.d.ts.map +1 -1
- package/dist/detection/index.js +2 -0
- package/dist/detection/index.js.map +1 -1
- package/dist/detection/record-order.d.ts +37 -0
- package/dist/detection/record-order.d.ts.map +1 -0
- package/dist/detection/record-order.js +311 -0
- package/dist/detection/record-order.js.map +1 -0
- package/dist/detection/record-proposal.d.ts +3 -0
- package/dist/detection/record-proposal.d.ts.map +1 -1
- package/dist/detection/record-proposal.js +6 -3
- package/dist/detection/record-proposal.js.map +1 -1
- package/dist/detection/removals.d.ts +0 -1
- package/dist/detection/removals.d.ts.map +1 -1
- package/dist/detection/removals.js +1 -4
- package/dist/detection/removals.js.map +1 -1
- package/dist/entities/graph-head.d.ts +0 -7
- package/dist/entities/graph-head.d.ts.map +1 -1
- package/dist/entities/graph-head.js +0 -13
- package/dist/entities/graph-head.js.map +1 -1
- package/dist/entities/index.d.ts +0 -8
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +0 -8
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/rules.d.ts +7 -69
- package/dist/entities/rules.d.ts.map +1 -1
- package/dist/entities/rules.js +1 -148
- package/dist/entities/rules.js.map +1 -1
- package/dist/entities/types.d.ts +3 -24
- package/dist/entities/types.d.ts.map +1 -1
- package/dist/files/cloud-files.d.ts.map +1 -1
- package/dist/files/cloud-files.js +2 -1
- package/dist/files/cloud-files.js.map +1 -1
- package/dist/git/merge.d.ts +1 -1
- package/dist/git/merge.js +1 -1
- package/dist/records/contracts.d.ts +0 -1
- package/dist/records/contracts.d.ts.map +1 -1
- package/dist/records/contracts.js +0 -1
- package/dist/records/contracts.js.map +1 -1
- package/dist/registration/user-ground.d.ts +9 -0
- package/dist/registration/user-ground.d.ts.map +1 -1
- package/dist/registration/user-ground.js +29 -10
- package/dist/registration/user-ground.js.map +1 -1
- package/dist/steps.d.ts +0 -2
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +0 -2
- package/dist/steps.js.map +1 -1
- package/dist/transfer/cargo.d.ts +0 -2
- package/dist/transfer/cargo.d.ts.map +1 -1
- package/dist/transfer/cargo.js +0 -20
- package/dist/transfer/cargo.js.map +1 -1
- package/dist/transfer/index.d.ts +1 -1
- package/dist/transfer/index.d.ts.map +1 -1
- package/dist/transfer/index.js +1 -1
- package/dist/transfer/index.js.map +1 -1
- package/dist/transfer/parallel.d.ts +4 -1
- package/dist/transfer/parallel.d.ts.map +1 -1
- package/dist/transfer/parallel.js +13 -10
- package/dist/transfer/parallel.js.map +1 -1
- package/dist/watching/coverage.d.ts +0 -2
- package/dist/watching/coverage.d.ts.map +1 -1
- package/dist/watching/coverage.js +0 -5
- package/dist/watching/coverage.js.map +1 -1
- package/dist/workspace/index.d.ts +0 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +0 -1
- package/dist/workspace/index.js.map +1 -1
- package/dist-cjs/apply/contracts.js.map +1 -1
- package/dist-cjs/apply/index.js +0 -5
- package/dist-cjs/apply/index.js.map +1 -1
- package/dist-cjs/apply/plans.js +2 -7
- package/dist-cjs/apply/plans.js.map +1 -1
- package/dist-cjs/apply/window.js +1 -4
- package/dist-cjs/apply/window.js.map +1 -1
- package/dist-cjs/contracts/validate.js +1 -4
- package/dist-cjs/contracts/validate.js.map +1 -1
- package/dist-cjs/detection/batch.js +0 -4
- package/dist-cjs/detection/batch.js.map +1 -1
- package/dist-cjs/detection/content.js +61 -78
- package/dist-cjs/detection/content.js.map +1 -1
- package/dist-cjs/detection/echo.js +3 -19
- package/dist-cjs/detection/echo.js.map +1 -1
- package/dist-cjs/detection/enrollment.js.map +1 -1
- package/dist-cjs/detection/index.js +2 -0
- package/dist-cjs/detection/index.js.map +1 -1
- package/dist-cjs/detection/record-order.js +314 -0
- package/dist-cjs/detection/record-order.js.map +1 -0
- package/dist-cjs/detection/record-proposal.js +7 -3
- package/dist-cjs/detection/record-proposal.js.map +1 -1
- package/dist-cjs/detection/removals.js +0 -4
- package/dist-cjs/detection/removals.js.map +1 -1
- package/dist-cjs/entities/graph-head.js +0 -14
- package/dist-cjs/entities/graph-head.js.map +1 -1
- package/dist-cjs/entities/index.js +0 -8
- package/dist-cjs/entities/index.js.map +1 -1
- package/dist-cjs/entities/rules.js +1 -157
- package/dist-cjs/entities/rules.js.map +1 -1
- package/dist-cjs/files/cloud-files.js +2 -1
- package/dist-cjs/files/cloud-files.js.map +1 -1
- package/dist-cjs/git/merge.js +1 -1
- package/dist-cjs/records/contracts.js +1 -3
- package/dist-cjs/records/contracts.js.map +1 -1
- package/dist-cjs/registration/user-ground.js +32 -10
- package/dist-cjs/registration/user-ground.js.map +1 -1
- package/dist-cjs/steps.js +1 -3
- package/dist-cjs/steps.js.map +1 -1
- package/dist-cjs/transfer/cargo.js +0 -21
- package/dist-cjs/transfer/cargo.js.map +1 -1
- package/dist-cjs/transfer/index.js +2 -1
- package/dist-cjs/transfer/index.js.map +1 -1
- package/dist-cjs/transfer/parallel.js +13 -10
- package/dist-cjs/transfer/parallel.js.map +1 -1
- package/dist-cjs/watching/coverage.js +0 -6
- package/dist-cjs/watching/coverage.js.map +1 -1
- package/dist-cjs/workspace/index.js +1 -3
- package/dist-cjs/workspace/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/apply/content-results.d.ts +0 -27
- package/dist/apply/content-results.d.ts.map +0 -1
- package/dist/apply/content-results.js +0 -53
- package/dist/apply/content-results.js.map +0 -1
- package/dist/apply/local-work.d.ts +0 -34
- package/dist/apply/local-work.d.ts.map +0 -1
- package/dist/apply/local-work.js +0 -31
- package/dist/apply/local-work.js.map +0 -1
- package/dist/entities/digest-steps.d.ts +0 -14
- package/dist/entities/digest-steps.d.ts.map +0 -1
- package/dist/entities/digest-steps.js +0 -26
- package/dist/entities/digest-steps.js.map +0 -1
- package/dist/entities/json-steps.d.ts +0 -21
- package/dist/entities/json-steps.d.ts.map +0 -1
- package/dist/entities/json-steps.js +0 -130
- package/dist/entities/json-steps.js.map +0 -1
- package/dist/entities/moves.d.ts +0 -42
- package/dist/entities/moves.d.ts.map +0 -1
- package/dist/entities/moves.js +0 -82
- package/dist/entities/moves.js.map +0 -1
- package/dist/entities/trash.d.ts +0 -7
- package/dist/entities/trash.d.ts.map +0 -1
- package/dist/entities/trash.js +0 -10
- package/dist/entities/trash.js.map +0 -1
- package/dist/workspace/memory-store.d.ts +0 -7
- package/dist/workspace/memory-store.d.ts.map +0 -1
- package/dist/workspace/memory-store.js +0 -16
- package/dist/workspace/memory-store.js.map +0 -1
- package/dist-cjs/apply/content-results.js +0 -58
- package/dist-cjs/apply/content-results.js.map +0 -1
- package/dist-cjs/apply/local-work.js +0 -34
- package/dist-cjs/apply/local-work.js.map +0 -1
- package/dist-cjs/entities/digest-steps.js +0 -30
- package/dist-cjs/entities/digest-steps.js.map +0 -1
- package/dist-cjs/entities/json-steps.js +0 -135
- package/dist-cjs/entities/json-steps.js.map +0 -1
- package/dist-cjs/entities/moves.js +0 -85
- package/dist-cjs/entities/moves.js.map +0 -1
- package/dist-cjs/entities/trash.js +0 -14
- package/dist-cjs/entities/trash.js.map +0 -1
- package/dist-cjs/workspace/memory-store.js +0 -20
- package/dist-cjs/workspace/memory-store.js.map +0 -1
package/dist/entities/moves.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Batch move validation — the entity model's one-truth-transition law for
|
|
3
|
-
* addresses (engine docs/entity-model.md, "Continuity"): the slot law and
|
|
4
|
-
* acyclicity are STATE invariants — they constrain the graph after the
|
|
5
|
-
* batch, never the order inside it — so movers may hold each other's slots
|
|
6
|
-
* (directories exchange addresses on disk, and detection reports the
|
|
7
|
-
* endpoints). A single move is a batch of one.
|
|
8
|
-
*
|
|
9
|
-
* A PARENTLESS mover is ADOPTION: the whole tree joins another under one
|
|
10
|
-
* parent update — a tree boundary is never an identity boundary, so this
|
|
11
|
-
* is the same lawful move, not a special ceremony. Adoption sheds the root
|
|
12
|
-
* shape in the SAME transition: workspace is the root type only, so a
|
|
13
|
-
* parentless workspace landing under a parent lands as a folder — one
|
|
14
|
-
* write, never a two-step that could tear into a nested workspace.
|
|
15
|
-
*
|
|
16
|
-
* This module validates and PLANS; the host's store applies the returned
|
|
17
|
-
* writes in one transaction.
|
|
18
|
-
*/
|
|
19
|
-
import { CONTAINERS } from './types.js';
|
|
20
|
-
import { mustGet, validName } from './rules.js';
|
|
21
|
-
/**
|
|
22
|
-
* Validate one batch of moves as one transition and return the writes to
|
|
23
|
-
* land together. Refused whole when any move breaks a law: a mover named
|
|
24
|
-
* twice, an inactive mover, an invalid name, a non-container target, two
|
|
25
|
-
* movers claiming one slot, an occupied slot outside the batch, a cycle in
|
|
26
|
-
* the post-state parent graph, or an inactive target chain.
|
|
27
|
-
*/
|
|
28
|
-
export function planMoveBatch(moves, port) {
|
|
29
|
-
const byUuid = port.byUuid.bind(port);
|
|
30
|
-
const rows = new Map(); // uuid -> current row
|
|
31
|
-
const post = new Map(); // uuid -> its move
|
|
32
|
-
for (const move of moves) {
|
|
33
|
-
const { uuid, name } = move;
|
|
34
|
-
if (post.has(uuid))
|
|
35
|
-
throw new Error(`one batch moves ${uuid} once, not twice`);
|
|
36
|
-
const row = mustGet(uuid, byUuid);
|
|
37
|
-
if (row.status !== 'active') {
|
|
38
|
-
throw new Error(`only an active entity moves: ${uuid} is ${row.status}`);
|
|
39
|
-
}
|
|
40
|
-
validName(name);
|
|
41
|
-
rows.set(uuid, row);
|
|
42
|
-
post.set(uuid, move);
|
|
43
|
-
}
|
|
44
|
-
const postParentOf = (uuid) => post.get(uuid)?.parentUUID ?? mustGet(uuid, byUuid).parentUuid;
|
|
45
|
-
const targets = new Set();
|
|
46
|
-
for (const { uuid, parentUUID, name } of moves) {
|
|
47
|
-
const parent = mustGet(parentUUID, byUuid);
|
|
48
|
-
if (!CONTAINERS.has(parent.type)) {
|
|
49
|
-
throw new Error(`only containers hold active children: ${parentUUID} is ${parent.type}, not workspace/folder/repo.git`);
|
|
50
|
-
}
|
|
51
|
-
const slot = `${parentUUID}\0${name}`;
|
|
52
|
-
if (targets.has(slot))
|
|
53
|
-
throw new Error(`slot taken: two movers claim (${parentUUID}, ${name}) in one batch`);
|
|
54
|
-
targets.add(slot);
|
|
55
|
-
const occupant = port.activeChildByName(parentUUID, name);
|
|
56
|
-
if (occupant && occupant.uuid !== uuid && !post.has(occupant.uuid)) {
|
|
57
|
-
throw new Error(`slot taken: active entity ${occupant.uuid} already owns (${parentUUID}, ${name}) — move or trash it first`);
|
|
58
|
-
}
|
|
59
|
-
// The target parent's whole post-state chain: acyclic and effectively
|
|
60
|
-
// active, walked once.
|
|
61
|
-
const seen = new Set();
|
|
62
|
-
let cursor = parentUUID;
|
|
63
|
-
while (cursor !== null) {
|
|
64
|
-
if (cursor === uuid) {
|
|
65
|
-
throw new Error(`the parent graph is acyclic: ${uuid} cannot live under itself`);
|
|
66
|
-
}
|
|
67
|
-
if (seen.has(cursor))
|
|
68
|
-
throw new Error(`registry corrupt: parent cycle at ${cursor}`);
|
|
69
|
-
seen.add(cursor);
|
|
70
|
-
if (mustGet(cursor, byUuid).status !== 'active') {
|
|
71
|
-
throw new Error(`parent ${parentUUID} is not effectively active — restore it before putting entities under it`);
|
|
72
|
-
}
|
|
73
|
-
cursor = postParentOf(cursor);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return moves.map(({ uuid, parentUUID, name }) => {
|
|
77
|
-
const row = rows.get(uuid); // seated in the first pass
|
|
78
|
-
const adoptedWorkspace = row.parentUuid === null && row.type === 'workspace';
|
|
79
|
-
return { uuid, parentUuid: parentUUID, name, ...(adoptedWorkspace ? { type: 'folder' } : {}) };
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=moves.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"moves.js","sourceRoot":"","sources":["../../src/entities/moves.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAuC,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAkBhD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAA4B,EAAE,IAAoB;IAC9E,MAAM,MAAM,G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AU,UAAU,0EAA0E,CAAC,CAAC;YAClH,CAAC;YACD,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC,2BAA2B;QACxD,MAAM,gBAAgB,GAAG,GAAG,CAAC,UAAU,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;QAC7E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1G,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/entities/trash.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Trash expiry uses the authority's accepted Trash time, never a device clock. */
|
|
2
|
-
import type { EntityStatus } from './types.js';
|
|
3
|
-
export declare const TRASH_RETENTION_MS: number;
|
|
4
|
-
/** Permanent removal is eligible at the end of 30 days in the current Trash
|
|
5
|
-
* episode. Restore cancels that episode; a later Trash starts a new one. */
|
|
6
|
-
export declare function trashHasExpired(status: EntityStatus, trashedAt: number, authorityNow: number): boolean;
|
|
7
|
-
//# sourceMappingURL=trash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trash.d.ts","sourceRoot":"","sources":["../../src/entities/trash.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,kBAAkB,QAA2B,CAAC;AAE3D;4EAC4E;AAC5E,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAKT"}
|
package/dist/entities/trash.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const TRASH_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
|
|
2
|
-
/** Permanent removal is eligible at the end of 30 days in the current Trash
|
|
3
|
-
* episode. Restore cancels that episode; a later Trash starts a new one. */
|
|
4
|
-
export function trashHasExpired(status, trashedAt, authorityNow) {
|
|
5
|
-
if (![trashedAt, authorityNow].every(value => Number.isSafeInteger(value) && value >= 0)) {
|
|
6
|
-
throw new Error('Trash expiry requires valid authority timestamps');
|
|
7
|
-
}
|
|
8
|
-
return status === 'trashed' && authorityNow - trashedAt >= TRASH_RETENTION_MS;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=trash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trash.js","sourceRoot":"","sources":["../../src/entities/trash.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3D;4EAC4E;AAC5E,MAAM,UAAU,eAAe,CAC7B,MAAoB,EACpB,SAAiB,EACjB,YAAoB;IAEpB,IAAI,CAAC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC;QACzF,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,KAAK,SAAS,IAAI,YAAY,GAAG,SAAS,IAAI,kBAAkB,CAAC;AAChF,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceEntry, WorkspaceStore } from './types.js';
|
|
2
|
-
export declare class MemoryWorkspaceStore implements WorkspaceStore {
|
|
3
|
-
#private;
|
|
4
|
-
list(): readonly WorkspaceEntry[];
|
|
5
|
-
replace(entries: readonly WorkspaceEntry[]): void;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=memory-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/workspace/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjE,qBAAa,oBAAqB,YAAW,cAAc;;IAGzD,IAAI,IAAI,SAAS,cAAc,EAAE;IAKjC,OAAO,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,IAAI;CAIlD"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { assertWorkspaceEntries } from './entries.js';
|
|
2
|
-
export class MemoryWorkspaceStore {
|
|
3
|
-
#entries = new Map();
|
|
4
|
-
list() {
|
|
5
|
-
return [...this.#entries.values()]
|
|
6
|
-
.sort((left, right) => left.name.localeCompare(right.name) || entryPath(left).localeCompare(entryPath(right)));
|
|
7
|
-
}
|
|
8
|
-
replace(entries) {
|
|
9
|
-
assertWorkspaceEntries(entries);
|
|
10
|
-
this.#entries = new Map(entries.map((entry) => [entry.id, entry]));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function entryPath(entry) {
|
|
14
|
-
return entry.kind === 'group' ? entry.folders[0]?.path ?? '' : entry.path;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=memory-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../src/workspace/memory-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,OAAO,oBAAoB;IAC/B,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE7C,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;aAC/B,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnH,CAAC;IAED,OAAO,CAAC,OAAkC;QACxC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AAED,SAAS,SAAS,CAAC,KAAqB;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AAC5E,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** Portable private-result construction for file, link, and construct adapters. */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.prepareTextResult = prepareTextResult;
|
|
5
|
-
exports.prepareBinaryResult = prepareBinaryResult;
|
|
6
|
-
exports.prepareLinkResult = prepareLinkResult;
|
|
7
|
-
const content_js_1 = require("../detection/content.js");
|
|
8
|
-
const bytes_js_1 = require("../entities/bytes.js");
|
|
9
|
-
const exactResult = (bytes, expected, sha256Hex, label) => {
|
|
10
|
-
if (sha256Hex(bytes) !== expected) {
|
|
11
|
-
throw new Error(`${label} does not match its accepted complete result`);
|
|
12
|
-
}
|
|
13
|
-
return bytes;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Construct text privately. The snapshot is mandatory truth. A delta is only
|
|
17
|
-
* a shortcut over the exact immutable base; reproduceTextChange falls back to
|
|
18
|
-
* the already-verified snapshot on every base or result mismatch. The returned
|
|
19
|
-
* snapshot reference remains caller-owned immutable input; Apply never mutates
|
|
20
|
-
* it and the host streams it into private staging.
|
|
21
|
-
*/
|
|
22
|
-
function prepareTextResult(plan, snapshot, exactBase, sha256Hex) {
|
|
23
|
-
const verifiedSnapshot = exactResult(snapshot, plan.artifact.contentHash, sha256Hex, 'text Apply snapshot');
|
|
24
|
-
if (plan.strategy.kind === 'snapshot')
|
|
25
|
-
return verifiedSnapshot;
|
|
26
|
-
return (0, content_js_1.reproduceTextChange)(exactBase, {
|
|
27
|
-
kind: 'file.text',
|
|
28
|
-
mode: 'delta',
|
|
29
|
-
basePayloadVersion: plan.strategy.basePayloadVersion,
|
|
30
|
-
resultPayloadVersion: plan.artifact.contentHash,
|
|
31
|
-
delta: plan.strategy.delta,
|
|
32
|
-
}, verifiedSnapshot, sha256Hex);
|
|
33
|
-
}
|
|
34
|
-
/** Verify reusable blocks while streaming them into private staging. A
|
|
35
|
-
* construct payload stages exactly like a binary file. */
|
|
36
|
-
async function prepareBinaryResult(plan, read, sink, sha256Hex) {
|
|
37
|
-
for (const [index, expected] of plan.manifest.chunks.entries()) {
|
|
38
|
-
const chunk = await read(index);
|
|
39
|
-
if (!(chunk instanceof Uint8Array)
|
|
40
|
-
|| chunk.byteLength !== expected.bytes
|
|
41
|
-
|| sha256Hex(chunk) !== expected.sha256) {
|
|
42
|
-
throw new Error(`binary Apply block ${index} failed verification`);
|
|
43
|
-
}
|
|
44
|
-
await sink.write(index, chunk);
|
|
45
|
-
}
|
|
46
|
-
const receipt = await sink.seal();
|
|
47
|
-
if (receipt.bytes !== plan.manifest.bytes
|
|
48
|
-
|| receipt.contentHash !== plan.artifact.contentHash) {
|
|
49
|
-
throw new Error('binary Apply staged result failed complete verification');
|
|
50
|
-
}
|
|
51
|
-
return Object.freeze({ ...receipt });
|
|
52
|
-
}
|
|
53
|
-
/** A link result is only its literal UTF-8 target bytes. */
|
|
54
|
-
function prepareLinkResult(plan, sha256Hex) {
|
|
55
|
-
exactResult((0, bytes_js_1.utf8Encode)(plan.targetText), plan.artifact.contentHash, sha256Hex, 'link Apply target');
|
|
56
|
-
return plan.targetText;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=content-results.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-results.js","sourceRoot":"","sources":["../../src/apply/content-results.ts"],"names":[],"mappings":";AAAA,mFAAmF;;AA+BnF,8CAiBC;AAgBD,kDAqBC;AAGD,8CAKC;AA3FD,wDAA8D;AAC9D,mDAAkD;AASlD,MAAM,WAAW,GAAG,CAClB,KAAiB,EACjB,QAAgB,EAChB,SAAoB,EACpB,KAAa,EACD,EAAE;IACd,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,8CAA8C,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC/B,IAAmB,EACnB,QAAoB,EACpB,SAA4B,EAC5B,SAAoB;IAEpB,MAAM,gBAAgB,GAAG,WAAW,CAClC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,EAAE,qBAAqB,CACtE,CAAC;IACF,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,gBAAgB,CAAC;IAC/D,OAAO,IAAA,gCAAmB,EAAC,SAAS,EAAE;QACpC,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,OAAO;QACb,kBAAkB,EAAE,IAAI,CAAC,QAAQ,CAAC,kBAAkB;QACpD,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,WA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,mBAAmB,CACvF,CAAC;IACF,OAAO,IAAI,CAAC,UAAU,CAAC;AACzB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Local work after a target: the local records that protect working ground
|
|
4
|
-
* from an older accepted result. The Apply store answers it inside its
|
|
5
|
-
* transaction; this is its pure form.
|
|
6
|
-
*
|
|
7
|
-
* An entity speaks only on its own channel, so a local record protects an
|
|
8
|
-
* entity from a target when it is on that entity's channel and is not ordered
|
|
9
|
-
* at or before the target. Order is delivery position, the one order every
|
|
10
|
-
* channel shares; a channel's own sequence orders only that channel and never
|
|
11
|
-
* decides here.
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.hasLocalWorkAfter = hasLocalWorkAfter;
|
|
15
|
-
/**
|
|
16
|
-
* True when a local record on the entity's channel has a position that is
|
|
17
|
-
* unknown or after `targetDelivery`. Its position is its stamp, or, before
|
|
18
|
-
* the stamp lands, the Inbox position of the same mutation: Receive may hold
|
|
19
|
-
* this computer's own record first, and a result ordered at or before the
|
|
20
|
-
* target is older than it, never newer. A local record at the target is the
|
|
21
|
-
* target itself, which Apply verifies against the already-equal disk.
|
|
22
|
-
*/
|
|
23
|
-
function hasLocalWorkAfter(local, received, entityId, targetDelivery) {
|
|
24
|
-
if (!entityId || !Number.isSafeInteger(targetDelivery) || targetDelivery < 1) {
|
|
25
|
-
throw new Error('Apply local-work target is invalid');
|
|
26
|
-
}
|
|
27
|
-
return local.some((work) => {
|
|
28
|
-
if (work.entityId !== entityId)
|
|
29
|
-
return false;
|
|
30
|
-
const position = work.deliverySequence ?? received.find((delivered) => (delivered.entityId === work.entityId && delivered.mutationId === work.mutationId))?.deliverySequence;
|
|
31
|
-
return position === undefined || position > targetDelivery;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=local-work.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-work.js","sourceRoot":"","sources":["../../src/apply/local-work.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAyBH,8CAgBC;AAxBD;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,KAA2B,EAC3B,QAAsC,EACtC,QAAgB,EAChB,cAAsB;IAEtB,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CACrE,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,CACjF,CAAC,EAAE,gBAAgB,CAAC;QACrB,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,GAAG,cAAc,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Digests taken in steps (steps.ts): bytes a block per step, and JSON text a
|
|
4
|
-
* bounded run per step (json-steps.ts). Each digests exactly the bytes its
|
|
5
|
-
* whole-input form would, so the hash is the same however the steps are
|
|
6
|
-
* paced.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.digestSteps = digestSteps;
|
|
10
|
-
exports.jsonDigestSteps = jsonDigestSteps;
|
|
11
|
-
const steps_js_1 = require("../steps.js");
|
|
12
|
-
const bytes_js_1 = require("./bytes.js");
|
|
13
|
-
const json_steps_js_1 = require("./json-steps.js");
|
|
14
|
-
/** The SHA-256 of `bytes`. */
|
|
15
|
-
function* digestSteps(bytes, createSha256) {
|
|
16
|
-
const hash = createSha256();
|
|
17
|
-
for (let offset = 0; offset < bytes.length; offset += steps_js_1.BYTES_PER_BOUNDARY) {
|
|
18
|
-
hash.update(bytes.subarray(offset, offset + steps_js_1.BYTES_PER_BOUNDARY));
|
|
19
|
-
yield;
|
|
20
|
-
}
|
|
21
|
-
return hash.digestHex();
|
|
22
|
-
}
|
|
23
|
-
/** The SHA-256 of the UTF-8 text JSON.stringify writes for plain JSON data,
|
|
24
|
-
* each JsonItems standing for its mapped array. */
|
|
25
|
-
function* jsonDigestSteps(value, createSha256) {
|
|
26
|
-
const hash = createSha256();
|
|
27
|
-
yield* (0, json_steps_js_1.jsonTextSteps)(value, text => hash.update((0, bytes_js_1.utf8Encode)(text)));
|
|
28
|
-
return hash.digestHex();
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=digest-steps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"digest-steps.js","sourceRoot":"","sources":["../../src/entities/digest-steps.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAQH,kCAOC;AAID,0CAIC;AArBD,0CAA6D;AAC7D,yCAAwC;AACxC,mDAAgD;AAGhD,8BAA8B;AAC9B,QAAe,CAAC,CAAC,WAAW,CAAC,KAAiB,EAAE,YAA0B;IACxE,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,6BAAkB,EAAE,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,6BAAkB,CAAC,CAAC,CAAC;QACjE,KAAK,CAAC;IACR,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;AAC1B,CAAC;AAED;mDACmD;AACnD,QAAe,CAAC,CAAC,eAAe,CAAC,KAAc,EAAE,YAA0B;IACzE,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,KAAK,CAAC,CAAC,IAAA,6BAAa,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* JSON text written in steps (steps.ts): exactly the text JSON.stringify
|
|
4
|
-
* writes for plain JSON data, handed out in bounded runs, so a long list or
|
|
5
|
-
* string never holds a host's thread however the steps are paced.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.JsonItems = void 0;
|
|
9
|
-
exports.jsonTextSteps = jsonTextSteps;
|
|
10
|
-
const steps_js_1 = require("../steps.js");
|
|
11
|
-
/** JSON text, in UTF-16 code units, handed out between boundaries: at most
|
|
12
|
-
* three UTF-8 bytes each, six for an escaped control character. A string
|
|
13
|
-
* longer than this is written in pieces of this length. */
|
|
14
|
-
const TEXT_PER_BOUNDARY = steps_js_1.BYTES_PER_BOUNDARY / 4;
|
|
15
|
-
/** An array within JSON text standing for `items.map(json)`, so a long list
|
|
16
|
-
* is never copied just to be written. */
|
|
17
|
-
class JsonItems {
|
|
18
|
-
items;
|
|
19
|
-
json;
|
|
20
|
-
constructor(items, json) {
|
|
21
|
-
this.items = items;
|
|
22
|
-
this.json = json;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.JsonItems = JsonItems;
|
|
26
|
-
/** The most UTF-16 code units JSON text spends on a value that is not a
|
|
27
|
-
* string, array or object. */
|
|
28
|
-
const SCALAR_TEXT = 24;
|
|
29
|
-
/** What remains of `budget` code units once `value`'s text is spent from it,
|
|
30
|
-
* before escaping, negative as soon as the text is surely longer. A
|
|
31
|
-
* JsonItems is always longer. */
|
|
32
|
-
function remaining(value, budget) {
|
|
33
|
-
if (typeof value === 'string')
|
|
34
|
-
return budget - value.length - 2;
|
|
35
|
-
if (typeof value !== 'object' || value === null)
|
|
36
|
-
return budget - SCALAR_TEXT;
|
|
37
|
-
if (value instanceof JsonItems)
|
|
38
|
-
return -1;
|
|
39
|
-
budget -= 2;
|
|
40
|
-
if (Array.isArray(value)) {
|
|
41
|
-
for (let index = 0; index < value.length && budget >= 0; index += 1) {
|
|
42
|
-
budget = remaining(value[index], budget - 1);
|
|
43
|
-
}
|
|
44
|
-
return budget;
|
|
45
|
-
}
|
|
46
|
-
for (const key in value) {
|
|
47
|
-
if (budget < 0)
|
|
48
|
-
break;
|
|
49
|
-
budget = remaining(value[key], budget - key.length - 4);
|
|
50
|
-
}
|
|
51
|
-
return budget;
|
|
52
|
-
}
|
|
53
|
-
/** Whether a value's JSON text is surely short, so it is written whole. */
|
|
54
|
-
const short = (value) => remaining(value, TEXT_PER_BOUNDARY) >= 0;
|
|
55
|
-
/** What JSON.stringify writes for a value, where a value it omits is `null`
|
|
56
|
-
* inside an array and nothing in an object. */
|
|
57
|
-
function whole(value, inArray) {
|
|
58
|
-
return JSON.stringify(value) ?? (inArray ? 'null' : '');
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Hand `write` the text JSON.stringify writes for `value`, each JsonItems
|
|
62
|
-
* standing for its mapped array, in runs that join to exactly that text.
|
|
63
|
-
* A value whose text is surely short is written whole; longer strings,
|
|
64
|
-
* arrays and objects are walked, a boundary after each run of items or text.
|
|
65
|
-
*/
|
|
66
|
-
function* jsonTextSteps(value, write) {
|
|
67
|
-
let text = '', work = 0;
|
|
68
|
-
function* walk(value) {
|
|
69
|
-
if (typeof value === 'string') {
|
|
70
|
-
text += '"';
|
|
71
|
-
for (let start = 0; start < value.length;) {
|
|
72
|
-
// A piece never ends between the two halves of a surrogate pair.
|
|
73
|
-
let end = Math.min(start + TEXT_PER_BOUNDARY, value.length);
|
|
74
|
-
const last = value.charCodeAt(end - 1);
|
|
75
|
-
if (end < value.length && last >= 0xd800 && last <= 0xdbff)
|
|
76
|
-
end -= 1;
|
|
77
|
-
text += JSON.stringify(value.slice(start, end)).slice(1, -1);
|
|
78
|
-
start = end;
|
|
79
|
-
write(text);
|
|
80
|
-
text = '';
|
|
81
|
-
yield;
|
|
82
|
-
}
|
|
83
|
-
text += '"';
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const mapped = value instanceof JsonItems;
|
|
87
|
-
if (mapped || Array.isArray(value)) {
|
|
88
|
-
const items = mapped ? value.items : value;
|
|
89
|
-
text += '[';
|
|
90
|
-
for (let index = 0; index < items.length; index += 1) {
|
|
91
|
-
if (index > 0)
|
|
92
|
-
text += ',';
|
|
93
|
-
const item = !(index in items) ? undefined
|
|
94
|
-
: mapped ? value.json(items[index]) : items[index];
|
|
95
|
-
if (short(item))
|
|
96
|
-
text += whole(item, true);
|
|
97
|
-
else
|
|
98
|
-
yield* walk(item);
|
|
99
|
-
if (++work % steps_js_1.ITEMS_PER_BOUNDARY === 0 || text.length >= TEXT_PER_BOUNDARY) {
|
|
100
|
-
write(text);
|
|
101
|
-
text = '';
|
|
102
|
-
yield;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
text += ']';
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
const fields = value;
|
|
109
|
-
text += '{';
|
|
110
|
-
let first = true;
|
|
111
|
-
for (const key of Object.keys(fields)) {
|
|
112
|
-
const field = fields[key];
|
|
113
|
-
if (field === undefined || typeof field === 'function' || typeof field === 'symbol')
|
|
114
|
-
continue;
|
|
115
|
-
text += `${first ? '' : ','}${JSON.stringify(key)}:`;
|
|
116
|
-
first = false;
|
|
117
|
-
if (short(field))
|
|
118
|
-
text += whole(field, false);
|
|
119
|
-
else
|
|
120
|
-
yield* walk(field);
|
|
121
|
-
if (++work % steps_js_1.ITEMS_PER_BOUNDARY === 0 || text.length >= TEXT_PER_BOUNDARY) {
|
|
122
|
-
write(text);
|
|
123
|
-
text = '';
|
|
124
|
-
yield;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
text += '}';
|
|
128
|
-
}
|
|
129
|
-
if (short(value))
|
|
130
|
-
text = whole(value, false);
|
|
131
|
-
else
|
|
132
|
-
yield* walk(value);
|
|
133
|
-
write(text);
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=json-steps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-steps.js","sourceRoot":"","sources":["../../src/entities/json-steps.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA6DH,sCA2DC;AAtHD,0CAAiF;AAEjF;;2DAE2D;AAC3D,MAAM,iBAAiB,GAAG,6BAAkB,GAAG,CAAC,CAAC;AAEjD;yCACyC;AACzC,MAAa,SAAS;IACX,KAAK,CAAe;IACpB,IAAI,CAAuB;IAEpC,YAAY,KAAmB,EAAE,IAA0B;QACzD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,8BAQC;AAED;8BAC8B;AAC9B,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;iCAEiC;AACjC,SAAS,SAAS,CAAC,KAAc,EAAE,MAAc;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,GAAG,WAAW,CAAC;IAC7E,IAAI,KAAK,YAAY,SAAS;QAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,MAAM,IAAI,CAAC,CAAC;IACZ,IAA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AC,MAAM,IAAI,iBAAiB,EAAE,CAAC;gBAC1E,KAAK,CAAC,IAAI,CAAC,CAAC;gBACZ,IAAI,GAAG,EAAE,CAAC;gBACV,KAAK,CAAC;YACR,CAAC;QACH,CAAC;QACD,IAAI,IAAI,GAAG,CAAC;IACd,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,CAAC;QAAE,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;QACxC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,KAAK,CAAC,IAAI,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Batch move validation — the entity model's one-truth-transition law for
|
|
4
|
-
* addresses (engine docs/entity-model.md, "Continuity"): the slot law and
|
|
5
|
-
* acyclicity are STATE invariants — they constrain the graph after the
|
|
6
|
-
* batch, never the order inside it — so movers may hold each other's slots
|
|
7
|
-
* (directories exchange addresses on disk, and detection reports the
|
|
8
|
-
* endpoints). A single move is a batch of one.
|
|
9
|
-
*
|
|
10
|
-
* A PARENTLESS mover is ADOPTION: the whole tree joins another under one
|
|
11
|
-
* parent update — a tree boundary is never an identity boundary, so this
|
|
12
|
-
* is the same lawful move, not a special ceremony. Adoption sheds the root
|
|
13
|
-
* shape in the SAME transition: workspace is the root type only, so a
|
|
14
|
-
* parentless workspace landing under a parent lands as a folder — one
|
|
15
|
-
* write, never a two-step that could tear into a nested workspace.
|
|
16
|
-
*
|
|
17
|
-
* This module validates and PLANS; the host's store applies the returned
|
|
18
|
-
* writes in one transaction.
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.planMoveBatch = planMoveBatch;
|
|
22
|
-
const types_js_1 = require("./types.js");
|
|
23
|
-
const rules_js_1 = require("./rules.js");
|
|
24
|
-
/**
|
|
25
|
-
* Validate one batch of moves as one transition and return the writes to
|
|
26
|
-
* land together. Refused whole when any move breaks a law: a mover named
|
|
27
|
-
* twice, an inactive mover, an invalid name, a non-container target, two
|
|
28
|
-
* movers claiming one slot, an occupied slot outside the batch, a cycle in
|
|
29
|
-
* the post-state parent graph, or an inactive target chain.
|
|
30
|
-
*/
|
|
31
|
-
function planMoveBatch(moves, port) {
|
|
32
|
-
const byUuid = port.byUuid.bind(port);
|
|
33
|
-
const rows = new Map(); // uuid -> current row
|
|
34
|
-
const post = new Map(); // uuid -> its move
|
|
35
|
-
for (const move of moves) {
|
|
36
|
-
const { uuid, name } = move;
|
|
37
|
-
if (post.has(uuid))
|
|
38
|
-
throw new Error(`one batch moves ${uuid} once, not twice`);
|
|
39
|
-
const row = (0, rules_js_1.mustGet)(uuid, byUuid);
|
|
40
|
-
if (row.status !== 'active') {
|
|
41
|
-
throw new Error(`only an active entity moves: ${uuid} is ${row.status}`);
|
|
42
|
-
}
|
|
43
|
-
(0, rules_js_1.validName)(name);
|
|
44
|
-
rows.set(uuid, row);
|
|
45
|
-
post.set(uuid, move);
|
|
46
|
-
}
|
|
47
|
-
const postParentOf = (uuid) => post.get(uuid)?.parentUUID ?? (0, rules_js_1.mustGet)(uuid, byUuid).parentUuid;
|
|
48
|
-
const targets = new Set();
|
|
49
|
-
for (const { uuid, parentUUID, name } of moves) {
|
|
50
|
-
const parent = (0, rules_js_1.mustGet)(parentUUID, byUuid);
|
|
51
|
-
if (!types_js_1.CONTAINERS.has(parent.type)) {
|
|
52
|
-
throw new Error(`only containers hold active children: ${parentUUID} is ${parent.type}, not workspace/folder/repo.git`);
|
|
53
|
-
}
|
|
54
|
-
const slot = `${parentUUID}\0${name}`;
|
|
55
|
-
if (targets.has(slot))
|
|
56
|
-
throw new Error(`slot taken: two movers claim (${parentUUID}, ${name}) in one batch`);
|
|
57
|
-
targets.add(slot);
|
|
58
|
-
const occupant = port.activeChildByName(parentUUID, name);
|
|
59
|
-
if (occupant && occupant.uuid !== uuid && !post.has(occupant.uuid)) {
|
|
60
|
-
throw new Error(`slot taken: active entity ${occupant.uuid} already owns (${parentUUID}, ${name}) — move or trash it first`);
|
|
61
|
-
}
|
|
62
|
-
// The target parent's whole post-state chain: acyclic and effectively
|
|
63
|
-
// active, walked once.
|
|
64
|
-
const seen = new Set();
|
|
65
|
-
let cursor = parentUUID;
|
|
66
|
-
while (cursor !== null) {
|
|
67
|
-
if (cursor === uuid) {
|
|
68
|
-
throw new Error(`the parent graph is acyclic: ${uuid} cannot live under itself`);
|
|
69
|
-
}
|
|
70
|
-
if (seen.has(cursor))
|
|
71
|
-
throw new Error(`registry corrupt: parent cycle at ${cursor}`);
|
|
72
|
-
seen.add(cursor);
|
|
73
|
-
if ((0, rules_js_1.mustGet)(cursor, byUuid).status !== 'active') {
|
|
74
|
-
throw new Error(`parent ${parentUUID} is not effectively active — restore it before putting entities under it`);
|
|
75
|
-
}
|
|
76
|
-
cursor = postParentOf(cursor);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return moves.map(({ uuid, parentUUID, name }) => {
|
|
80
|
-
const row = rows.get(uuid); // seated in the first pass
|
|
81
|
-
const adoptedWorkspace = row.parentUuid === null && row.type === 'workspace';
|
|
82
|
-
return { uuid, parentUuid: parentUUID, name, ...(adoptedWorkspace ? { type: 'folder' } : {}) };
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=moves.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"moves.js","sourceRoot":"","sources":["../../src/entities/moves.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AA4BH,sCAmDC;AA7ED,yCAA6E;AAC7E,yCAAgD;AAkBhD;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,KAA4B,EAAE,IAAoB;IAC9E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAqB,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CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC,2BAA2B;QACxD,MAAM,gBAAgB,GAAG,GAAG,CAAC,UAAU,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;QAC7E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1G,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TRASH_RETENTION_MS = void 0;
|
|
4
|
-
exports.trashHasExpired = trashHasExpired;
|
|
5
|
-
exports.TRASH_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
|
|
6
|
-
/** Permanent removal is eligible at the end of 30 days in the current Trash
|
|
7
|
-
* episode. Restore cancels that episode; a later Trash starts a new one. */
|
|
8
|
-
function trashHasExpired(status, trashedAt, authorityNow) {
|
|
9
|
-
if (![trashedAt, authorityNow].every(value => Number.isSafeInteger(value) && value >= 0)) {
|
|
10
|
-
throw new Error('Trash expiry requires valid authority timestamps');
|
|
11
|
-
}
|
|
12
|
-
return status === 'trashed' && authorityNow - trashedAt >= exports.TRASH_RETENTION_MS;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=trash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trash.js","sourceRoot":"","sources":["../../src/entities/trash.ts"],"names":[],"mappings":";;;AAOA,0CASC;AAbY,QAAA,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3D;4EAC4E;AAC5E,SAAgB,eAAe,CAC7B,MAAoB,EACpB,SAAiB,EACjB,YAAoB;IAEpB,IAAI,CAAC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC;QACzF,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,KAAK,SAAS,IAAI,YAAY,GAAG,SAAS,IAAI,0BAAkB,CAAC;AAChF,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryWorkspaceStore = void 0;
|
|
4
|
-
const entries_js_1 = require("./entries.js");
|
|
5
|
-
class MemoryWorkspaceStore {
|
|
6
|
-
#entries = new Map();
|
|
7
|
-
list() {
|
|
8
|
-
return [...this.#entries.values()]
|
|
9
|
-
.sort((left, right) => left.name.localeCompare(right.name) || entryPath(left).localeCompare(entryPath(right)));
|
|
10
|
-
}
|
|
11
|
-
replace(entries) {
|
|
12
|
-
(0, entries_js_1.assertWorkspaceEntries)(entries);
|
|
13
|
-
this.#entries = new Map(entries.map((entry) => [entry.id, entry]));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.MemoryWorkspaceStore = MemoryWorkspaceStore;
|
|
17
|
-
function entryPath(entry) {
|
|
18
|
-
return entry.kind === 'group' ? entry.folders[0]?.path ?? '' : entry.path;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=memory-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../src/workspace/memory-store.ts"],"names":[],"mappings":";;;AACA,6CAAsD;AAEtD,MAAa,oBAAoB;IAC/B,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE7C,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;aAC/B,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnH,CAAC;IAED,OAAO,CAAC,OAAkC;QACxC,IAAA,mCAAsB,EAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AAZD,oDAYC;AAED,SAAS,SAAS,CAAC,KAAqB;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AAC5E,CAAC"}
|