@amalgm/shell 0.1.164-main.41987694940 → 0.1.164-main.42004338907
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-window-cargo.d.ts +10 -7
- package/dist/apply-window-cargo.js +27 -19
- package/dist/apply-window-cargo.js.map +1 -1
- package/dist/apply-window-host.js +44 -7
- package/dist/apply-window-host.js.map +1 -1
- package/dist/apply-window-verify.js +1 -1
- package/dist/apply-window-verify.js.map +1 -1
- package/dist/content-cache-retention.js +1 -1
- package/dist/content-cache-retention.js.map +1 -1
- package/dist/content-capture-pool.d.ts +1 -2
- package/dist/content-capture-pool.js +4 -4
- package/dist/content-capture-pool.js.map +1 -1
- package/dist/content-capture-worker.js +1 -1
- package/dist/content-capture-worker.js.map +1 -1
- package/dist/declaration-chain.d.ts +4 -19
- package/dist/declaration-chain.js +34 -74
- package/dist/declaration-chain.js.map +1 -1
- package/dist/declaration-commit.d.ts +0 -7
- package/dist/declaration-commit.js +10 -23
- package/dist/declaration-commit.js.map +1 -1
- package/dist/declaration-hold.d.ts +10 -22
- package/dist/declaration-hold.js +2 -34
- package/dist/declaration-hold.js.map +1 -1
- package/dist/declaration-journal.d.ts +17 -6
- package/dist/declaration-journal.js +48 -10
- package/dist/declaration-journal.js.map +1 -1
- package/dist/declaration-save.d.ts +2 -12
- package/dist/declaration-save.js +13 -46
- package/dist/declaration-save.js.map +1 -1
- package/dist/detection/owed-selection.d.ts +2 -4
- package/dist/detection/owed-selection.js +3 -18
- package/dist/detection/owed-selection.js.map +1 -1
- package/dist/detection/policy-owed.d.ts +1 -1
- package/dist/detection/policy-owed.js +2 -2
- package/dist/detection/policy-owed.js.map +1 -1
- package/dist/detection/root-examination.d.ts +0 -4
- package/dist/detection/root-examination.js +7 -20
- package/dist/detection/root-examination.js.map +1 -1
- package/dist/detection/root-walk.js +6 -18
- package/dist/detection/root-walk.js.map +1 -1
- package/dist/detection/runtime.js +4 -3
- package/dist/detection/runtime.js.map +1 -1
- package/dist/detection/scope-frame.d.ts +0 -3
- package/dist/detection/scope-frame.js +2 -2
- package/dist/detection/scope-frame.js.map +1 -1
- package/dist/detection/walk-law.d.ts +0 -8
- package/dist/detection/walk-law.js +0 -23
- package/dist/detection/walk-law.js.map +1 -1
- package/dist/entity-access-wire.d.ts +1 -1
- package/dist/entity-channel-holdings.d.ts +7 -7
- package/dist/entity-channel-holdings.js +49 -8
- package/dist/entity-channel-holdings.js.map +1 -1
- package/dist/entity-grant-watch.d.ts +6 -4
- package/dist/entity-grant-watch.js +13 -17
- package/dist/entity-grant-watch.js.map +1 -1
- package/dist/files-register-host.d.ts +5 -17
- package/dist/files-register-host.js +35 -37
- package/dist/files-register-host.js.map +1 -1
- package/dist/git/rail.d.ts +1 -1
- package/dist/git/rail.js +8 -7
- package/dist/git/rail.js.map +1 -1
- package/dist/git/read-state.d.ts +4 -2
- package/dist/git/read-state.js +20 -8
- package/dist/git/read-state.js.map +1 -1
- package/dist/git/write-files.js +6 -2
- package/dist/git/write-files.js.map +1 -1
- package/dist/graph-heads.d.ts +6 -0
- package/dist/graph-heads.js +8 -0
- package/dist/graph-heads.js.map +1 -1
- package/dist/ground-database.js +7 -2
- package/dist/ground-database.js.map +1 -1
- package/dist/ground-install-saves.d.ts +22 -8
- package/dist/ground-install-saves.js +23 -11
- package/dist/ground-install-saves.js.map +1 -1
- package/dist/ground-save-ops.d.ts +4 -3
- package/dist/ground-save-ops.js +4 -3
- package/dist/ground-save-ops.js.map +1 -1
- package/dist/materialize-records.js +1 -1
- package/dist/materialize-records.js.map +1 -1
- package/dist/native/cloud-files.node +0 -0
- package/dist/reference-placement.d.ts +62 -0
- package/dist/reference-placement.js +283 -0
- package/dist/reference-placement.js.map +1 -0
- package/dist/source-signature.d.ts +16 -3
- package/dist/source-signature.js +16 -3
- package/dist/source-signature.js.map +1 -1
- package/dist/user-ground-host.d.ts +47 -22
- package/dist/user-ground-host.js +278 -341
- package/dist/user-ground-host.js.map +1 -1
- package/dist/wire-client.d.ts +2 -3
- package/dist/wire-client.js +18 -13
- package/dist/wire-client.js.map +1 -1
- package/dist/wire-request-scope.d.ts +0 -1
- package/dist/wire-request-scope.js +0 -1
- package/dist/wire-request-scope.js.map +1 -1
- package/examinations/fixtures/private-wire-authority.js +13 -11
- package/npm-shrinkwrap.json +6 -6
- package/package.json +5 -5
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A Register declaration holds its root back from ordinary Detect until the
|
|
3
|
-
* authority has accepted it
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* committed yet.
|
|
3
|
+
* authority has accepted it and its way in core stands (reference-placement.ts).
|
|
4
|
+
* A root is held while a publication row owns its declaration, or while it is
|
|
5
|
+
* bound and sharing (B) has never recorded it: then the declaration exists
|
|
6
|
+
* only as a local binding that no Register has committed yet.
|
|
7
7
|
*
|
|
8
|
-
* Held ground is observed, never selected
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Held ground is observed, never selected: its root admits no Record, so
|
|
9
|
+
* ordinary Detect can never publish a declaration piecemeal before the graph
|
|
10
|
+
* head that introduces it. Nothing of the declaration stands in core before
|
|
11
|
+
* that head is accepted, so core holds nothing back. The placement that ends
|
|
12
|
+
* the publication row wakes the ground it held.
|
|
13
13
|
*/
|
|
14
14
|
import type Database from "better-sqlite3";
|
|
15
|
-
import type { GroundRow } from "./ground-row.js";
|
|
16
15
|
/** A Watch pass could not conclude because these roots are held: the
|
|
17
|
-
*
|
|
16
|
+
* placement that ends their declaration, never a timer, wakes them. */
|
|
18
17
|
export declare class DeclarationHeld extends Error {
|
|
19
18
|
readonly roots: readonly string[];
|
|
20
19
|
constructor(roots: readonly string[]);
|
|
@@ -22,14 +21,3 @@ export declare class DeclarationHeld extends Error {
|
|
|
22
21
|
/** The held subset of these bound roots, read on the caller's connection so
|
|
23
22
|
* it joins whatever read transaction the caller is in. */
|
|
24
23
|
export declare function heldDeclarations(database: Database.Database, bindings: Iterable<string>): Set<string>;
|
|
25
|
-
/** Whether a selection holds this row back: a reference whose workspace a
|
|
26
|
-
* declaration holds. Its binding is read as the reference is judged, never
|
|
27
|
-
* from a list taken before: Register binds a workspace before it renders the
|
|
28
|
-
* reference, so a reference already seen has its binding to see. A reference
|
|
29
|
-
* to a workspace this machine never bound (one it has not added) is no
|
|
30
|
-
* declaration of its own and travels. */
|
|
31
|
-
export declare function referenceHold(database: Database.Database, bindingDir: string): (row: Pick<GroundRow, "type" | "payloadVersion">) => boolean;
|
|
32
|
-
/** Where the declarations of the held references at these addresses of root
|
|
33
|
-
* `rootUUID` begin (`declarationTop`), sharing read on the caller's
|
|
34
|
-
* connection so it joins whatever read transaction the caller is in. */
|
|
35
|
-
export declare function declarationTops(database: Database.Database, rootUUID: string, references: Iterable<string>): Set<string>;
|
package/dist/declaration-hold.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { lstatSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { declarationTop } from "./detection/walk-law.js";
|
|
4
1
|
import { cachedStatement } from "./sqlite.js";
|
|
5
2
|
/** A Watch pass could not conclude because these roots are held: the
|
|
6
|
-
*
|
|
3
|
+
* placement that ends their declaration, never a timer, wakes them. */
|
|
7
4
|
export class DeclarationHeld extends Error {
|
|
8
5
|
roots;
|
|
9
6
|
constructor(roots) {
|
|
@@ -15,37 +12,8 @@ export class DeclarationHeld extends Error {
|
|
|
15
12
|
/** The held subset of these bound roots, read on the caller's connection so
|
|
16
13
|
* it joins whatever read transaction the caller is in. */
|
|
17
14
|
export function heldDeclarations(database, bindings) {
|
|
18
|
-
const holds = declarationHolds(database);
|
|
19
|
-
return new Set([...bindings].filter(root => holds(root, true)));
|
|
20
|
-
}
|
|
21
|
-
/** Whether a selection holds this row back: a reference whose workspace a
|
|
22
|
-
* declaration holds. Its binding is read as the reference is judged, never
|
|
23
|
-
* from a list taken before: Register binds a workspace before it renders the
|
|
24
|
-
* reference, so a reference already seen has its binding to see. A reference
|
|
25
|
-
* to a workspace this machine never bound (one it has not added) is no
|
|
26
|
-
* declaration of its own and travels. */
|
|
27
|
-
export function referenceHold(database, bindingDir) {
|
|
28
|
-
const holds = declarationHolds(database);
|
|
29
|
-
return row => {
|
|
30
|
-
if (row.type !== "reference" || !row.payloadVersion)
|
|
31
|
-
return false;
|
|
32
|
-
const binding = lstatSync(join(bindingDir, row.payloadVersion), { throwIfNoEntry: false });
|
|
33
|
-
return holds(row.payloadVersion, binding?.isSymbolicLink() === true);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
/** Where the declarations of the held references at these addresses of root
|
|
37
|
-
* `rootUUID` begin (`declarationTop`), sharing read on the caller's
|
|
38
|
-
* connection so it joins whatever read transaction the caller is in. */
|
|
39
|
-
export function declarationTops(database, rootUUID, references) {
|
|
40
|
-
const shared = cachedStatement(database, "SELECT 1 FROM detection_notebook WHERE root_uuid = ? AND relative_path = ? AND status = 'active' LIMIT 1").pluck();
|
|
41
|
-
const tops = new Set();
|
|
42
|
-
for (const path of references)
|
|
43
|
-
tops.add(declarationTop(path, address => shared.get(rootUUID, address) !== undefined));
|
|
44
|
-
return tops;
|
|
45
|
-
}
|
|
46
|
-
function declarationHolds(database) {
|
|
47
15
|
const journaled = cachedStatement(database, "SELECT 1 FROM snapshot_publications WHERE declaration_root = ? LIMIT 1").pluck();
|
|
48
16
|
const shared = cachedStatement(database, "SELECT 1 FROM detection_notebook WHERE uuid = ?").pluck();
|
|
49
|
-
return (root
|
|
17
|
+
return new Set([...bindings].filter(root => journaled.get(root) !== undefined || shared.get(root) === undefined));
|
|
50
18
|
}
|
|
51
19
|
//# sourceMappingURL=declaration-hold.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-hold.js","sourceRoot":"","sources":["../src/declaration-hold.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"declaration-hold.js","sourceRoot":"","sources":["../src/declaration-hold.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;uEACuE;AACvE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACnB;IAArB,YAAqB,KAAwB;QAC3C,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;QADhE,UAAK,GAAL,KAAK,CAAmB;QAE3C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;0DAC0D;AAC1D,MAAM,UAAU,gBAAgB,CAAC,QAA2B,EAAE,QAA0B;IACtF,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,EACxC,wEAAwE,CAAC,CAAC,KAAK,EAAE,CAAC;IACpF,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,iDAAiD,CAAC,CAAC,KAAK,EAAE,CAAC;IACpG,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;AACpH,CAAC"}
|
|
@@ -14,11 +14,15 @@
|
|
|
14
14
|
* rejected: the authority conclusively refused this mutation. It is never
|
|
15
15
|
* replayed; the next Register re-folds its D onto the current accepted view
|
|
16
16
|
* under a new mutation id.
|
|
17
|
+
* accepted: the authority committed it. The row keeps no pages and owes only
|
|
18
|
+
* the placement of what D declared beside W: the folders on its way and its
|
|
19
|
+
* reference. Placement removes it in the commit that writes those rows.
|
|
17
20
|
*
|
|
18
21
|
* While any row names W, W's ground is held from ordinary Detect. Every write
|
|
19
22
|
* here runs on the ground file's saver thread (ground-save-ops.ts).
|
|
20
23
|
*/
|
|
21
24
|
import type Database from "better-sqlite3";
|
|
25
|
+
import { type CloudEntityRecord, type Sha256Hex } from "@amalgm/live";
|
|
22
26
|
import { type GraphHeadInput } from "./graph-heads.js";
|
|
23
27
|
/** One immutable graph page exactly as it must be sealed. */
|
|
24
28
|
export interface JournaledGraphPage {
|
|
@@ -44,25 +48,32 @@ export interface DeclarationJournalEntry {
|
|
|
44
48
|
readonly operationBlob: Buffer;
|
|
45
49
|
/** Pages the committed head did not already name. */
|
|
46
50
|
readonly pages: readonly JournaledGraphPage[];
|
|
47
|
-
readonly status: "pending" | "rejected";
|
|
51
|
+
readonly status: "pending" | "rejected" | "accepted";
|
|
48
52
|
/** True once a submit attempt was durably declared for this row. */
|
|
49
53
|
readonly submitted: boolean;
|
|
50
54
|
}
|
|
51
55
|
export declare function readDeclarationJournal(database: Database.Database): DeclarationJournalEntry[];
|
|
56
|
+
/** The core records W's unaccepted row declared, read back from its pages,
|
|
57
|
+
* so the declaration folded again names them again (declaration-chain.ts). */
|
|
58
|
+
export declare function journaledDeclaration(database: Database.Database, declarationRoot: string, coreRootId: string, sha256Hex: Sha256Hex): CloudEntityRecord[];
|
|
52
59
|
/** Journal one declaration publication, superseding that declaration's
|
|
53
60
|
* earlier rows. Runs inside the caller's transaction, so the row lands with
|
|
54
61
|
* whatever the caller commits beside it. A submitted pending row for the same
|
|
55
|
-
* declaration may already be accepted,
|
|
62
|
+
* declaration may already be accepted, and an accepted one still owes its
|
|
63
|
+
* placement, so both refuse supersession. */
|
|
56
64
|
export declare function journalDeclaration(database: Database.Database, entry: DeclarationJournalEntry): void;
|
|
57
65
|
/** Durably declare a submit attempt before the first frame leaves. From this
|
|
58
66
|
* moment the outcome may exist only at the authority. */
|
|
59
67
|
export declare function markDeclarationSubmitted(database: Database.Database, mutationId: string): void;
|
|
60
68
|
/** The authority conclusively refused this exact mutation. */
|
|
61
69
|
export declare function markDeclarationRejected(database: Database.Database, mutationId: string): void;
|
|
62
|
-
/** The authority accepted it
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
export declare function
|
|
70
|
+
/** The authority accepted it. The head it committed is kept in the same
|
|
71
|
+
* commit, so this machine never holds an accepted declaration its received
|
|
72
|
+
* state lacks (graph-heads.ts); the row stays, holding W, until placement. */
|
|
73
|
+
export declare function markDeclarationAccepted(database: Database.Database, { mutationId, head }: {
|
|
66
74
|
readonly mutationId: string;
|
|
67
75
|
readonly head: GraphHeadInput;
|
|
68
76
|
}): void;
|
|
77
|
+
/** The declaration owes nothing more: W is released to ordinary Detect. Runs
|
|
78
|
+
* inside the caller's transaction when placement writes rows beside it. */
|
|
79
|
+
export declare function clearDeclaration(database: Database.Database, mutationId: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRAPH_HEAD_OPERATION_KIND, stableJson } from "@amalgm/live";
|
|
1
|
+
import { GRAPH_HEAD_OPERATION_KIND, parseGraphPage, stableJson, } from "@amalgm/live";
|
|
2
2
|
import { keepGraphHead } from "./graph-heads.js";
|
|
3
3
|
export function readDeclarationJournal(database) {
|
|
4
4
|
const pagesByMutation = new Map();
|
|
@@ -13,7 +13,8 @@ export function readDeclarationJournal(database) {
|
|
|
13
13
|
return database.prepare(`
|
|
14
14
|
SELECT mutation_id AS mutationId, resource_id AS resourceId,
|
|
15
15
|
declaration_root AS declarationRoot, meta_json AS metaJson,
|
|
16
|
-
operation_blob AS operationBlob, status, submitted_at AS submittedAt
|
|
16
|
+
operation_blob AS operationBlob, status, submitted_at AS submittedAt,
|
|
17
|
+
accepted_at AS acceptedAt
|
|
17
18
|
FROM snapshot_publications ORDER BY sequence
|
|
18
19
|
`).all().map((row) => {
|
|
19
20
|
const meta = JSON.parse(row.metaJson);
|
|
@@ -40,23 +41,53 @@ export function readDeclarationJournal(database) {
|
|
|
40
41
|
replacementRootIds: meta.replacementRootIds.map(String),
|
|
41
42
|
operationBlob: row.operationBlob,
|
|
42
43
|
pages: pagesByMutation.get(row.mutationId) ?? [],
|
|
43
|
-
status: row.
|
|
44
|
+
status: row.acceptedAt !== null ? "accepted"
|
|
45
|
+
: row.status === "rejected" ? "rejected" : "pending",
|
|
44
46
|
submitted: row.submittedAt !== null,
|
|
45
47
|
};
|
|
46
48
|
});
|
|
47
49
|
}
|
|
50
|
+
/** The core records W's unaccepted row declared, read back from its pages,
|
|
51
|
+
* so the declaration folded again names them again (declaration-chain.ts). */
|
|
52
|
+
export function journaledDeclaration(database, declarationRoot, coreRootId, sha256Hex) {
|
|
53
|
+
const row = database.prepare(`
|
|
54
|
+
SELECT mutation_id AS mutationId, meta_json AS metaJson, operation_blob AS operationBlob
|
|
55
|
+
FROM snapshot_publications WHERE declaration_root = ? AND accepted_at IS NULL
|
|
56
|
+
`).get(declarationRoot);
|
|
57
|
+
if (row === undefined)
|
|
58
|
+
return [];
|
|
59
|
+
const declared = new Set(JSON.parse(row.metaJson).declaredIds);
|
|
60
|
+
const operation = JSON.parse(row.operationBlob.toString("utf8"));
|
|
61
|
+
const refs = new Map((operation.head.roots.find((root) => root.rootId === coreRootId)?.pages ?? [])
|
|
62
|
+
.map((ref) => [ref.sha256, ref]));
|
|
63
|
+
const records = [];
|
|
64
|
+
for (const page of database.prepare(`
|
|
65
|
+
SELECT sha256, bytes FROM snapshot_publication_pages WHERE mutation_id = ?
|
|
66
|
+
`).iterate(row.mutationId)) {
|
|
67
|
+
const ref = refs.get(page.sha256);
|
|
68
|
+
if (ref === undefined)
|
|
69
|
+
continue;
|
|
70
|
+
for (const record of parseGraphPage(ref, page.bytes, sha256Hex)) {
|
|
71
|
+
if (declared.has(record.uuid))
|
|
72
|
+
records.push(record);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return records;
|
|
76
|
+
}
|
|
48
77
|
/** Journal one declaration publication, superseding that declaration's
|
|
49
78
|
* earlier rows. Runs inside the caller's transaction, so the row lands with
|
|
50
79
|
* whatever the caller commits beside it. A submitted pending row for the same
|
|
51
|
-
* declaration may already be accepted,
|
|
80
|
+
* declaration may already be accepted, and an accepted one still owes its
|
|
81
|
+
* placement, so both refuse supersession. */
|
|
52
82
|
export function journalDeclaration(database, entry) {
|
|
53
83
|
if (!database.inTransaction)
|
|
54
84
|
throw new Error("a declaration journals inside its caller's transaction");
|
|
55
85
|
if (database.prepare(`
|
|
56
86
|
SELECT 1 FROM snapshot_publications
|
|
57
|
-
WHERE declaration_root = ? AND
|
|
87
|
+
WHERE declaration_root = ? AND (accepted_at IS NOT NULL
|
|
88
|
+
OR (status = 'pending' AND submitted_at IS NOT NULL)) LIMIT 1
|
|
58
89
|
`).get(entry.declarationRoot) !== undefined) {
|
|
59
|
-
throw new Error(`declaration ${entry.declarationRoot} has a submitted publication
|
|
90
|
+
throw new Error(`declaration ${entry.declarationRoot} has a submitted publication not yet placed`);
|
|
60
91
|
}
|
|
61
92
|
database.prepare(`
|
|
62
93
|
DELETE FROM snapshot_publication_pages WHERE mutation_id IN (
|
|
@@ -92,11 +123,18 @@ export function markDeclarationRejected(database, mutationId) {
|
|
|
92
123
|
database.prepare("UPDATE snapshot_publications SET status = 'rejected' WHERE mutation_id = ?")
|
|
93
124
|
.run(mutationId);
|
|
94
125
|
}
|
|
95
|
-
/** The authority accepted it
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
export function
|
|
126
|
+
/** The authority accepted it. The head it committed is kept in the same
|
|
127
|
+
* commit, so this machine never holds an accepted declaration its received
|
|
128
|
+
* state lacks (graph-heads.ts); the row stays, holding W, until placement. */
|
|
129
|
+
export function markDeclarationAccepted(database, { mutationId, head }) {
|
|
99
130
|
keepGraphHead(database, head);
|
|
131
|
+
database.prepare("DELETE FROM snapshot_publication_pages WHERE mutation_id = ?").run(mutationId);
|
|
132
|
+
database.prepare("UPDATE snapshot_publications SET accepted_at = ? WHERE mutation_id = ?")
|
|
133
|
+
.run(Date.now(), mutationId);
|
|
134
|
+
}
|
|
135
|
+
/** The declaration owes nothing more: W is released to ordinary Detect. Runs
|
|
136
|
+
* inside the caller's transaction when placement writes rows beside it. */
|
|
137
|
+
export function clearDeclaration(database, mutationId) {
|
|
100
138
|
database.prepare("DELETE FROM snapshot_publication_pages WHERE mutation_id = ?").run(mutationId);
|
|
101
139
|
database.prepare("DELETE FROM snapshot_publications WHERE mutation_id = ?").run(mutationId);
|
|
102
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-journal.js","sourceRoot":"","sources":["../src/declaration-journal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declaration-journal.js","sourceRoot":"","sources":["../src/declaration-journal.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,UAAU,GAIX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AA0CtE,MAAM,UAAU,sBAAsB,CAAC,QAA2B;IAChE,MAAM,eAAe,GAAG,IAAI,GAAG,EAAgC,CAAC;IAChE,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC;;;GAGnC,CAAC,CAAC,OAAO,EAAqE,EAAE,CAAC;QAChF,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACzD,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IACD,OAAQ,QAAQ,CAAC,OAAO,CAAC;;;;;;GAMxB,CAAC,CAAC,GAAG,EASH,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAgD,CAAC;QACrF,0EAA0E;QAC1E,wEAAwE;QACxE,wCAAwC;QACxC,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,i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"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type Database from "better-sqlite3";
|
|
2
2
|
import { type EntityType } from "@amalgm/live";
|
|
3
|
-
import type { DeclarationChain } from "./declaration-chain.js";
|
|
4
3
|
import { type DeclarationJournalEntry } from "./declaration-journal.js";
|
|
5
4
|
import { type GroundRow } from "./ground-row.js";
|
|
6
5
|
/** One declaration as data. */
|
|
7
6
|
export interface DeclarationSave {
|
|
8
7
|
readonly resourceId: string;
|
|
9
|
-
readonly coreRootId: string;
|
|
10
8
|
/** W's walk, or null for a re-fold whose walk already stands. */
|
|
11
9
|
readonly walk: {
|
|
12
10
|
readonly observed: readonly GroundRow[];
|
|
@@ -16,7 +14,6 @@ export interface DeclarationSave {
|
|
|
16
14
|
readonly absorbed: readonly string[];
|
|
17
15
|
/** Every bound root W's ground encloses; its rows join W's root. */
|
|
18
16
|
readonly enclosed: readonly string[];
|
|
19
|
-
readonly chain: DeclarationChain;
|
|
20
17
|
readonly journal: DeclarationJournalEntry;
|
|
21
18
|
}
|
|
22
19
|
/** The entity local ground names at one core address: B first, then O. */
|
|
@@ -24,12 +21,5 @@ export declare function namedAt(database: Database.Database, resourceId: string,
|
|
|
24
21
|
readonly uuid: string;
|
|
25
22
|
readonly type: EntityType;
|
|
26
23
|
} | null;
|
|
27
|
-
/**
|
|
28
|
-
export declare function
|
|
29
|
-
/** `register.declare`: nothing when an address moved. O rows already held
|
|
30
|
-
* under the chain's identities where the chain places them stand as
|
|
31
|
-
* observed, and rows at its addresses under other identities are displaced:
|
|
32
|
-
* sharing names the identity, and observation re-derives the rest on its next
|
|
33
|
-
* pass. A chain row observed under another parent is placed as the chain
|
|
34
|
-
* places it, or observation would find it under a parent that is gone. */
|
|
35
|
-
export declare function saveDeclaration(database: Database.Database, input: DeclarationSave): "committed" | "moved";
|
|
24
|
+
/** `register.declare`. */
|
|
25
|
+
export declare function saveDeclaration(database: Database.Database, input: DeclarationSave): void;
|
package/dist/declaration-save.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `register.declare`, run only by the ground file's saver thread
|
|
3
|
-
* (ground-saver.ts): one declaration D admitted beside its
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* (ground-saver.ts): one declaration D's ground in W admitted beside its
|
|
4
|
+
* journal row. declaration-commit.ts posts it. Core ground gains nothing
|
|
5
|
+
* here: what D declares there is placed once the authority accepts it
|
|
6
|
+
* (reference-placement.ts).
|
|
6
7
|
*
|
|
7
8
|
* Ground W absorbs (declaration-absorption.ts) joins W's root in both
|
|
8
9
|
* inventories. Observation takes the walk as it takes the rest of W. Sharing
|
|
@@ -27,38 +28,9 @@ export function namedAt(database, resourceId, coreRootId, relativePath) {
|
|
|
27
28
|
}
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
|
-
/**
|
|
31
|
-
export function sharedAt(database, resourceId, coreRootId, uuid) {
|
|
32
|
-
const row = cachedStatement(database, `SELECT ${groundRowProjection("detection_notebook")} FROM detection_notebook
|
|
33
|
-
WHERE resource_id = ? AND root_uuid = ? AND uuid = ?`).get(resourceId, coreRootId, uuid);
|
|
34
|
-
return row ?? null;
|
|
35
|
-
}
|
|
36
|
-
/** `register.declare`: nothing when an address moved. O rows already held
|
|
37
|
-
* under the chain's identities where the chain places them stand as
|
|
38
|
-
* observed, and rows at its addresses under other identities are displaced:
|
|
39
|
-
* sharing names the identity, and observation re-derives the rest on its next
|
|
40
|
-
* pass. A chain row observed under another parent is placed as the chain
|
|
41
|
-
* places it, or observation would find it under a parent that is gone. */
|
|
31
|
+
/** `register.declare`. */
|
|
42
32
|
export function saveDeclaration(database, input) {
|
|
43
|
-
const { resourceId,
|
|
44
|
-
if (chain.chained.some((row, index) => (namedAt(database, resourceId, coreRootId, row.relativePath)?.uuid ?? null) !== chain.named[index])) {
|
|
45
|
-
return "moved";
|
|
46
|
-
}
|
|
47
|
-
const held = cachedStatement(database, `SELECT 1 FROM entities
|
|
48
|
-
WHERE uuid = ? AND resource_id = ? AND root_uuid = ? AND relative_path = ? AND parent_uuid IS ? AND name = ?
|
|
49
|
-
AND status = 'active'`).pluck();
|
|
50
|
-
const occupants = cachedStatement(database, `SELECT uuid FROM entities
|
|
51
|
-
WHERE resource_id = ? AND root_uuid = ? AND relative_path = ? AND uuid <> ?`).pluck();
|
|
52
|
-
const observed = chain.chained.filter(row => held.get(row.uuid, resourceId, coreRootId, row.relativePath, row.parentUUID, row.name) === undefined);
|
|
53
|
-
// A spine W's reference replaced held only the references W's ground
|
|
54
|
-
// absorbs: its observed rows leave with it.
|
|
55
|
-
const beneath = cachedStatement(database, `SELECT uuid FROM entities
|
|
56
|
-
WHERE resource_id = ? AND root_uuid = ? AND relative_path > ? AND relative_path < ?`).pluck();
|
|
57
|
-
const reference = chain.chained[0].relativePath;
|
|
58
|
-
const displaced = [
|
|
59
|
-
...chain.chained.flatMap(row => occupants.all(resourceId, coreRootId, row.relativePath, row.uuid)),
|
|
60
|
-
...beneath.all(resourceId, coreRootId, `${reference}/`, `${reference}0`),
|
|
61
|
-
];
|
|
33
|
+
const { resourceId, walk, journal } = input;
|
|
62
34
|
const roots = [journal.declarationRoot, ...input.enclosed];
|
|
63
35
|
const rootRows = (inventory) => cachedStatement(database, `SELECT ${groundRowProjection(inventory)} FROM ${inventory}
|
|
64
36
|
WHERE resource_id = ? AND root_uuid IN (${roots.map(() => "?").join(", ")})`)
|
|
@@ -67,24 +39,19 @@ export function saveDeclaration(database, input) {
|
|
|
67
39
|
const keep = new Set(kept.map((row) => row.uuid));
|
|
68
40
|
return rootRows(inventory).map((row) => row.uuid).filter((uuid) => !keep.has(uuid));
|
|
69
41
|
};
|
|
70
|
-
const sharing = walk && sharedGround(walk, journal.declarationRoot, input.absorbed, rootRows("detection_notebook"));
|
|
71
42
|
groundStore(database).write((writer) => {
|
|
72
|
-
|
|
73
|
-
|
|
43
|
+
if (walk) {
|
|
44
|
+
const sharing = sharedGround(walk, journal.declarationRoot, input.absorbed, rootRows("detection_notebook"));
|
|
45
|
+
writer.replace("entities", walk.observed, stale("entities", walk.observed));
|
|
74
46
|
const removed = stale("detection_notebook", [...sharing.kept, ...sharing.selected]);
|
|
75
47
|
writer.replace("detection_notebook", sharing.kept, [], "retain-equivalent");
|
|
76
|
-
writer.replace("detection_notebook",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
writer.
|
|
48
|
+
writer.replace("detection_notebook", sharing.selected, removed, "replace");
|
|
49
|
+
// Sharing's absorbed placements change these parents' membership
|
|
50
|
+
// (detection/container-membership.ts).
|
|
51
|
+
writer.refreshMembership("detection_notebook", sharing.containers);
|
|
80
52
|
}
|
|
81
|
-
// The chain's containers, and sharing's absorbed placements, change
|
|
82
|
-
// these parents' membership (detection/container-membership.ts).
|
|
83
|
-
writer.refreshMembership("entities", chain.containers);
|
|
84
|
-
writer.refreshMembership("detection_notebook", [...chain.containers, ...sharing?.containers ?? []]);
|
|
85
53
|
journalDeclaration(database, journal);
|
|
86
54
|
});
|
|
87
|
-
return "committed";
|
|
88
55
|
}
|
|
89
56
|
/** B for W's ground after D. Sharing's own rows of absorbed ground are kept,
|
|
90
57
|
* framed in W, each absorbed root re-placed as the walk selected it: a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-save.js","sourceRoot":"","sources":["../src/declaration-save.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"declaration-save.js","sourceRoot":"","sources":["../src/declaration-save.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAgC,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACzH,OAAO,EAAE,WAAW,E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IAAI,6CAA6C,CAAC,CAAC;IACvF,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;QAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1E,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,UAAU;YAAE,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* observation (O), read from committed facts alone: no ground is walked.
|
|
3
3
|
*
|
|
4
4
|
* Selection is one law, Live's selectPublication: an identity that policy or
|
|
5
|
-
*
|
|
5
|
+
* policy withholds keeps B's row, or none, and every other takes O's;
|
|
6
6
|
* membership and payloads follow. B stands at that law's fixed point exactly
|
|
7
7
|
* when each identity selection takes from O already stands in B as O holds
|
|
8
8
|
* it (a leaf or repository at O's version, a container at O's structure,
|
|
@@ -42,11 +42,9 @@ type Includes = (path: string, rootId: string, directory: boolean) => boolean;
|
|
|
42
42
|
* the scope's own proof. */
|
|
43
43
|
export declare function owedIdentities(database: Database.Database, rootUUID: string, includes: Includes): OwedIdentity[];
|
|
44
44
|
/** One root's owed addresses under `policy`, outermost only, read in one
|
|
45
|
-
* committed transaction.
|
|
46
|
-
* Register has not published, its binding read in `bindingDir`. */
|
|
45
|
+
* committed transaction. */
|
|
47
46
|
export declare function owedAddresses(database: Database.Database, input: {
|
|
48
47
|
readonly rootUUID: string;
|
|
49
48
|
readonly policy: string;
|
|
50
|
-
readonly bindingDir: string;
|
|
51
49
|
}): string[];
|
|
52
50
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { CONTAINERS, createUserGroundEnrollmentPolicy, materializableRecords, PublicationScopeExceeded, selectPublication } from "@amalgm/live";
|
|
2
|
-
import { declarationTops, referenceHold } from "../declaration-hold.js";
|
|
3
2
|
import { groundDifferences } from "../ground-differences.js";
|
|
4
3
|
import { GROUND_ROW_PROJECTION, portableGroundRecord } from "../ground-row.js";
|
|
5
4
|
import { cachedStatement } from "../sqlite.js";
|
|
6
|
-
import { withholds } from "./walk-law.js";
|
|
7
5
|
/** One root's owed identities under `includes`, read from the differences,
|
|
8
6
|
* so a root costs what O and B hold differently, never what Trash keeps.
|
|
9
7
|
* Each identity a scope exceeds joins the targets with every identity beneath
|
|
@@ -39,24 +37,11 @@ const subtree = (database, inventory) => cachedStatement(database, `WITH RECURSI
|
|
|
39
37
|
UNION SELECT child.uuid FROM ${inventory} AS child JOIN beneath ON child.parent_uuid = beneath.uuid
|
|
40
38
|
) SELECT uuid FROM beneath`);
|
|
41
39
|
/** One root's owed addresses under `policy`, outermost only, read in one
|
|
42
|
-
* committed transaction.
|
|
43
|
-
* Register has not published, its binding read in `bindingDir`. */
|
|
40
|
+
* committed transaction. */
|
|
44
41
|
export function owedAddresses(database, input) {
|
|
45
|
-
const { rootUUID } = input;
|
|
46
42
|
const policy = createUserGroundEnrollmentPolicy(input.policy);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// identity O and B hold differently.
|
|
50
|
-
const held = referenceHold(database, input.bindingDir);
|
|
51
|
-
const reference = cachedStatement(database, `SELECT ${GROUND_ROW_PROJECTION}
|
|
52
|
-
FROM entities WHERE uuid = ? AND root_uuid = ? AND type = 'reference'`);
|
|
53
|
-
const withheld = declarationTops(database, rootUUID, groundDifferences(database, rootUUID).flatMap(uuid => {
|
|
54
|
-
const row = reference.get(uuid, rootUUID);
|
|
55
|
-
return row && held(row) ? [row.relativePath] : [];
|
|
56
|
-
}));
|
|
57
|
-
const includes = (path, _rootId, directory) => policy(path, directory) && !withholds(withheld, path);
|
|
58
|
-
return outermostAddresses(owedIdentities(database, rootUUID, includes).map(identity => identity.path));
|
|
59
|
-
})();
|
|
43
|
+
const includes = (path, _rootId, directory) => policy(path, directory);
|
|
44
|
+
return database.transaction(() => outermostAddresses(owedIdentities(database, input.rootUUID, includes).map(identity => identity.path)))();
|
|
60
45
|
}
|
|
61
46
|
/** Selection over the differences as targets. Its context is, in each
|
|
62
47
|
* inventory, the root, every container on the ancestry of either of a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owed-selection.js","sourceRoot":"","sources":["../../src/detection/owed-selection.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,iBAAiB,EAChD,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"owed-selection.js","sourceRoot":"","sources":["../../src/detection/owed-selection.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,iBAAiB,EAChD,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAkB,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiB/C;;;;;4BAK4B;AAC5B,MAAM,UAAU,cAAc,CAAC,QAA2B,EAAE,QAAgB,EAAE,QAAkB;IAC9F,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC;QACR,IAAI,CAAC;YACH,OAAO,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CA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SAAS,IAAI,CAAC,CAAC,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;YAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -10,4 +10,4 @@ export interface PolicyRoot {
|
|
|
10
10
|
readonly policy: string;
|
|
11
11
|
}
|
|
12
12
|
/** The addresses these committed changes owe, absolute, in root order. */
|
|
13
|
-
export declare function policyExaminations(database: string,
|
|
13
|
+
export declare function policyExaminations(database: string, changes: readonly CommittedChange[], rootOf: (rootUUID: string) => PolicyRoot): Promise<string[]>;
|
|
@@ -13,7 +13,7 @@ import { readOwedAddresses } from "../content-capture-pool.js";
|
|
|
13
13
|
/** The policy a row states, by version, while it states one. */
|
|
14
14
|
const stated = (row) => row?.status === "active" && row.relativePath === USER_IGNORE_FILE_NAME ? row.version : null;
|
|
15
15
|
/** The addresses these committed changes owe, absolute, in root order. */
|
|
16
|
-
export async function policyExaminations(database,
|
|
16
|
+
export async function policyExaminations(database, changes, rootOf) {
|
|
17
17
|
const roots = new Set();
|
|
18
18
|
for (const { before, after } of changes) {
|
|
19
19
|
if (stated(before) === stated(after))
|
|
@@ -25,7 +25,7 @@ export async function policyExaminations(database, bindingDir, changes, rootOf)
|
|
|
25
25
|
const owed = [];
|
|
26
26
|
for (const rootUUID of roots) {
|
|
27
27
|
const { directory, policy } = rootOf(rootUUID);
|
|
28
|
-
for (const path of await readOwedAddresses(database, rootUUID, policy
|
|
28
|
+
for (const path of await readOwedAddresses(database, rootUUID, policy)) {
|
|
29
29
|
owed.push(join(directory, ...path.split("/")));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-owed.js","sourceRoot":"","sources":["../../src/detection/policy-owed.ts"],"names":[],"mappings":"AAAA;;;;;;;;w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AI,CAAC,MAAM,EAAE,KAAK,CAAC;YAAE,IAAI,GAAG,EAAE,YAAY,KAAK,qBAAqB;gBAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9G,CAAC;IACD,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;QAC7B,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/C,KAAK,MAAM,IAAI,IAAI,MAAM,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -7,10 +7,6 @@ interface RootGround {
|
|
|
7
7
|
/** The content cache, holding the artifact each repository row's
|
|
8
8
|
* transport version names: the last state a Git-refused one stands at. */
|
|
9
9
|
readonly cacheDir: string;
|
|
10
|
-
/** Where this machine binds its workspaces: core must reference each
|
|
11
|
-
* materialized one, and a declaration Register has not published holds its
|
|
12
|
-
* reference back. */
|
|
13
|
-
readonly bindingDir: string;
|
|
14
10
|
/** Core ground's portable name; null for a bound root. */
|
|
15
11
|
readonly core: {
|
|
16
12
|
readonly name: string;
|