@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
|
@@ -49,31 +49,34 @@ function createWeightedGate(capacity) {
|
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
/** Run
|
|
52
|
+
/** Run `effect` over every item, in input order, with at most `concurrency`
|
|
53
|
+
* in flight. A failure stops admission; every started effect still settles,
|
|
54
|
+
* and the earliest started item's failure fails the loop. Admitted items are
|
|
55
|
+
* always a prefix, so that failure is the one an in-order loop would have met. */
|
|
53
56
|
async function parallelForEach(items, concurrency, effect) {
|
|
54
57
|
if (!Number.isSafeInteger(concurrency) || concurrency < 1) {
|
|
55
58
|
throw new Error('transfer concurrency must be a positive integer');
|
|
56
59
|
}
|
|
57
60
|
let cursor = 0;
|
|
58
|
-
|
|
61
|
+
const failure = { index: items.length };
|
|
59
62
|
const worker = async () => {
|
|
60
|
-
while (failure ===
|
|
63
|
+
while (failure.index === items.length && cursor < items.length) {
|
|
61
64
|
const index = cursor;
|
|
62
65
|
cursor += 1;
|
|
63
|
-
const item = items[index];
|
|
64
|
-
if (item === undefined)
|
|
65
|
-
continue;
|
|
66
66
|
try {
|
|
67
|
-
await effect(
|
|
67
|
+
await effect(items[index]);
|
|
68
68
|
}
|
|
69
69
|
catch (error) {
|
|
70
|
-
failure
|
|
70
|
+
if (index < failure.index) {
|
|
71
|
+
failure.index = index;
|
|
72
|
+
failure.error = error;
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
};
|
|
74
77
|
await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, worker));
|
|
75
|
-
if (failure
|
|
76
|
-
throw failure;
|
|
78
|
+
if (failure.index < items.length)
|
|
79
|
+
throw failure.error;
|
|
77
80
|
}
|
|
78
81
|
/** Run independent effects under both a count bound and a total weight
|
|
79
82
|
* bound. Input order is the admission order; a failure stops new admission
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel.js","sourceRoot":"","sources":["../../src/transfer/parallel.ts"],"names":[],"mappings":";;;AAYA,gDAMC;AAWD,gDA6BC;
|
|
1
|
+
{"version":3,"file":"parallel.js","sourceRoot":"","sources":["../../src/transfer/parallel.ts"],"names":[],"mappings":";;;AAYA,gDAMC;AAWD,gDA6BC;AAMD,0CA4BC;AAKD,0DA+DC;AAhKD;;uEAEuE;AAC1D,QAAA,4BAA4B,GAAG,CAAC,CAAC;AAS9C,SAAgB,kBAAkB,CAAC,WAAmB;IACpD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,IAAI,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7C,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;AAClD,CAAC;AAWD,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,IAAI,CAAC,MAAM,CAAC,aAAa,C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AK,CAAC,MAAM,CAAC,CAAC;gBAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC/B,IAAI,IAAI,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBAC/C,OAAO,GAAG,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;oBACvD,MAAM;gBACR,CAAC;gBACD,IAAI,MAAM,GAAG,CAAC,IAAI,YAAY,GAAG,MAAM,GAAG,SAAS;oBAAE,MAAM;gBAC3D,MAAM,IAAI,CAAC,CAAC;gBACZ,MAAM,IAAI,CAAC,CAAC;gBACZ,YAAY,IAAI,MAAM,CAAC;gBACvB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CACpB,GAAG,EAAE;oBACH,MAAM,IAAI,CAAC,CAAC;oBACZ,YAAY,IAAI,MAAM,CAAC;oBACvB,OAAO,EAAE,CAAC;gBACZ,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;oBACjB,OAAO,KAAK,KAAK,CAAC;oBAClB,MAAM,IAAI,CAAC,CAAC;oBACZ,YAAY,IAAI,MAAM,CAAC;oBACvB,OAAO,EAAE,CAAC;gBACZ,CAAC,CACF,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,IAAI,MAAM,KAAK,CAAC;oBAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnD,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.doorbellGround = doorbellGround;
|
|
15
15
|
exports.watchOwnerOf = watchOwnerOf;
|
|
16
|
-
exports.coveredRoots = coveredRoots;
|
|
17
16
|
/** '/a/b' → '/a'; '/a' → '/'; a bare name → '.'. */
|
|
18
17
|
const parentDirOf = (path) => {
|
|
19
18
|
const cut = path.lastIndexOf('/');
|
|
@@ -46,9 +45,4 @@ function watchOwnerOf(root, roots) {
|
|
|
46
45
|
}
|
|
47
46
|
return owner;
|
|
48
47
|
}
|
|
49
|
-
/** Every logical root routed through an owner's physical handle. */
|
|
50
|
-
function coveredRoots(owner, roots) {
|
|
51
|
-
return roots.filter((root) => root.rootId !== owner.rootId
|
|
52
|
-
&& watchOwnerOf(root, roots)?.rootId === owner.rootId);
|
|
53
|
-
}
|
|
54
48
|
//# sourceMappingURL=coverage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../src/watching/coverage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAwBH,wCAEC;AAMD,oCASC;
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../src/watching/coverage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAwBH,wCAEC;AAMD,oCASC;AA7BD,oDAAoD;AACpD,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACxB,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAe;IAC5C,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAe,EAAE,KAA2B;IACvE,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,KAAK,GAAqB,IAAI,CAAC;IACnC,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;YAAE,SAAS;QACpE,IAAI,MAAM,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC;YAAE,SAAS;QAC5E,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM;YAAE,KAAK,GAAG,KAAK,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkspaceRegistry = exports.
|
|
3
|
+
exports.WorkspaceRegistry = exports.WorkspaceRequestError = exports.assertWorkspaceEntries = exports.workspaceUriForPath = exports.uuidV7 = exports.isUuidV7 = exports.createWorkspaceApi = void 0;
|
|
4
4
|
var api_js_1 = require("./api.js");
|
|
5
5
|
Object.defineProperty(exports, "createWorkspaceApi", { enumerable: true, get: function () { return api_js_1.createWorkspaceApi; } });
|
|
6
6
|
var identity_js_1 = require("./identity.js");
|
|
@@ -10,8 +10,6 @@ Object.defineProperty(exports, "workspaceUriForPath", { enumerable: true, get: f
|
|
|
10
10
|
var entries_js_1 = require("./entries.js");
|
|
11
11
|
Object.defineProperty(exports, "assertWorkspaceEntries", { enumerable: true, get: function () { return entries_js_1.assertWorkspaceEntries; } });
|
|
12
12
|
Object.defineProperty(exports, "WorkspaceRequestError", { enumerable: true, get: function () { return entries_js_1.WorkspaceRequestError; } });
|
|
13
|
-
var memory_store_js_1 = require("./memory-store.js");
|
|
14
|
-
Object.defineProperty(exports, "MemoryWorkspaceStore", { enumerable: true, get: function () { return memory_store_js_1.MemoryWorkspaceStore; } });
|
|
15
13
|
var registry_js_1 = require("./registry.js");
|
|
16
14
|
Object.defineProperty(exports, "WorkspaceRegistry", { enumerable: true, get: function () { return registry_js_1.WorkspaceRegistry; } });
|
|
17
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":";;;AAAA,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAE3B,6CAAsE;AAA7D,uGAAA,QAAQ,OAAA;AAAE,qGAAA,MAAM,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAC9C,2CAA6E;AAApE,oHAAA,sBAAsB,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AACtD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":";;;AAAA,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAE3B,6CAAsE;AAA7D,uGAAA,QAAQ,OAAA;AAAE,qGAAA,MAAM,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAC9C,2CAA6E;AAApE,oHAAA,sBAAsB,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AACtD,6CAAkD;AAAzC,gHAAA,iBAAiB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amalgm/live",
|
|
3
|
-
"version": "0.2.81-main.
|
|
3
|
+
"version": "0.2.81-main.41784750721",
|
|
4
4
|
"description": "Portable realtime SDK for Amalgm — wire contracts, mutation discipline, and delivery state machines behind host-injected adapters.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist-cjs/index.js",
|
|
@@ -112,11 +112,11 @@
|
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@amalgm/core": "0.5.1-main.41264319540"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "4fe7aaf22eb874445f8227e2438d98790858bafc",
|
|
116
116
|
"amalgmSource": {
|
|
117
117
|
"repository": "amalgm-inc/amalgm-live",
|
|
118
118
|
"branch": "main",
|
|
119
|
-
"commit": "
|
|
120
|
-
"occurrence": "
|
|
119
|
+
"commit": "4fe7aaf22eb874445f8227e2438d98790858bafc",
|
|
120
|
+
"occurrence": "41784750721"
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** Portable private-result construction for file, link, and construct adapters. */
|
|
2
|
-
import type { Sha256Hex } from '../entities/types.js';
|
|
3
|
-
import type { BinaryApplyPlan, ConstructApplyPlan, LinkApplyPlan, TextApplyPlan } from './contracts.js';
|
|
4
|
-
/**
|
|
5
|
-
* Construct text privately. The snapshot is mandatory truth. A delta is only
|
|
6
|
-
* a shortcut over the exact immutable base; reproduceTextChange falls back to
|
|
7
|
-
* the already-verified snapshot on every base or result mismatch. The returned
|
|
8
|
-
* snapshot reference remains caller-owned immutable input; Apply never mutates
|
|
9
|
-
* it and the host streams it into private staging.
|
|
10
|
-
*/
|
|
11
|
-
export declare function prepareTextResult(plan: TextApplyPlan, snapshot: Uint8Array, exactBase: Uint8Array | null, sha256Hex: Sha256Hex): Uint8Array;
|
|
12
|
-
export interface BinaryApplySinkReceipt {
|
|
13
|
-
readonly bytes: number;
|
|
14
|
-
readonly contentHash: string;
|
|
15
|
-
}
|
|
16
|
-
export interface BinaryApplySink {
|
|
17
|
-
/** Persist one verified block at its manifest position in private staging. */
|
|
18
|
-
write(index: number, bytes: Uint8Array): Promise<void>;
|
|
19
|
-
/** Fsync/close and verify the staged whole without returning its bytes. */
|
|
20
|
-
seal(): Promise<BinaryApplySinkReceipt>;
|
|
21
|
-
}
|
|
22
|
-
/** Verify reusable blocks while streaming them into private staging. A
|
|
23
|
-
* construct payload stages exactly like a binary file. */
|
|
24
|
-
export declare function prepareBinaryResult(plan: BinaryApplyPlan | ConstructApplyPlan, read: (index: number) => Promise<Uint8Array>, sink: BinaryApplySink, sha256Hex: Sha256Hex): Promise<BinaryApplySinkReceipt>;
|
|
25
|
-
/** A link result is only its literal UTF-8 target bytes. */
|
|
26
|
-
export declare function prepareLinkResult(plan: LinkApplyPlan, sha256Hex: Sha256Hex): string;
|
|
27
|
-
//# sourceMappingURL=content-results.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-results.d.ts","sourceRoot":"","sources":["../../src/apply/content-results.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAInF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,aAAa,EACd,MAAM,gBAAgB,CAAC;AAcxB;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,UAAU,GAAG,IAAI,EAC5B,SAAS,EAAE,SAAS,GACnB,UAAU,CAYZ;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,2EAA2E;IAC3E,IAAI,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACzC;AAED;0DAC0D;AAC1D,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,eAAe,GAAG,kBAAkB,EAC1C,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,EAC5C,IAAI,EAAE,eAAe,EACrB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,sBAAsB,CAAC,CAgBjC;AAED,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAKnF"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/** Portable private-result construction for file, link, and construct adapters. */
|
|
2
|
-
import { reproduceTextChange } from '../detection/content.js';
|
|
3
|
-
import { utf8Encode } from '../entities/bytes.js';
|
|
4
|
-
const exactResult = (bytes, expected, sha256Hex, label) => {
|
|
5
|
-
if (sha256Hex(bytes) !== expected) {
|
|
6
|
-
throw new Error(`${label} does not match its accepted complete result`);
|
|
7
|
-
}
|
|
8
|
-
return bytes;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Construct text privately. The snapshot is mandatory truth. A delta is only
|
|
12
|
-
* a shortcut over the exact immutable base; reproduceTextChange falls back to
|
|
13
|
-
* the already-verified snapshot on every base or result mismatch. The returned
|
|
14
|
-
* snapshot reference remains caller-owned immutable input; Apply never mutates
|
|
15
|
-
* it and the host streams it into private staging.
|
|
16
|
-
*/
|
|
17
|
-
export function prepareTextResult(plan, snapshot, exactBase, sha256Hex) {
|
|
18
|
-
const verifiedSnapshot = exactResult(snapshot, plan.artifact.contentHash, sha256Hex, 'text Apply snapshot');
|
|
19
|
-
if (plan.strategy.kind === 'snapshot')
|
|
20
|
-
return verifiedSnapshot;
|
|
21
|
-
return reproduceTextChange(exactBase, {
|
|
22
|
-
kind: 'file.text',
|
|
23
|
-
mode: 'delta',
|
|
24
|
-
basePayloadVersion: plan.strategy.basePayloadVersion,
|
|
25
|
-
resultPayloadVersion: plan.artifact.contentHash,
|
|
26
|
-
delta: plan.strategy.delta,
|
|
27
|
-
}, verifiedSnapshot, sha256Hex);
|
|
28
|
-
}
|
|
29
|
-
/** Verify reusable blocks while streaming them into private staging. A
|
|
30
|
-
* construct payload stages exactly like a binary file. */
|
|
31
|
-
export async function prepareBinaryResult(plan, read, sink, sha256Hex) {
|
|
32
|
-
for (const [index, expected] of plan.manifest.chunks.entries()) {
|
|
33
|
-
const chunk = await read(index);
|
|
34
|
-
if (!(chunk instanceof Uint8Array)
|
|
35
|
-
|| chunk.byteLength !== expected.bytes
|
|
36
|
-
|| sha256Hex(chunk) !== expected.sha256) {
|
|
37
|
-
throw new Error(`binary Apply block ${index} failed verification`);
|
|
38
|
-
}
|
|
39
|
-
await sink.write(index, chunk);
|
|
40
|
-
}
|
|
41
|
-
const receipt = await sink.seal();
|
|
42
|
-
if (receipt.bytes !== plan.manifest.bytes
|
|
43
|
-
|| receipt.contentHash !== plan.artifact.contentHash) {
|
|
44
|
-
throw new Error('binary Apply staged result failed complete verification');
|
|
45
|
-
}
|
|
46
|
-
return Object.freeze({ ...receipt });
|
|
47
|
-
}
|
|
48
|
-
/** A link result is only its literal UTF-8 target bytes. */
|
|
49
|
-
export function prepareLinkResult(plan, sha256Hex) {
|
|
50
|
-
exactResult(utf8Encode(plan.targetText), plan.artifact.contentHash, sha256Hex, 'link Apply target');
|
|
51
|
-
return plan.targetText;
|
|
52
|
-
}
|
|
53
|
-
//# 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;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;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,8CA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K,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK;WACpC,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,IAAmB,EAAE,SAAoB;IACzE,WAAW,CACT,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,EAAE,mBAAmB,CACvF,CAAC;IACF,OAAO,IAAI,CAAC,UAAU,CAAC;AACzB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local work after a target: the local records that protect working ground
|
|
3
|
-
* from an older accepted result. The Apply store answers it inside its
|
|
4
|
-
* transaction; this is its pure form.
|
|
5
|
-
*
|
|
6
|
-
* An entity speaks only on its own channel, so a local record protects an
|
|
7
|
-
* entity from a target when it is on that entity's channel and is not ordered
|
|
8
|
-
* at or before the target. Order is delivery position, the one order every
|
|
9
|
-
* channel shares; a channel's own sequence orders only that channel and never
|
|
10
|
-
* decides here.
|
|
11
|
-
*/
|
|
12
|
-
/** One local record as the gate reads it. */
|
|
13
|
-
export interface LocalWork {
|
|
14
|
-
readonly entityId: string;
|
|
15
|
-
readonly mutationId: string;
|
|
16
|
-
/** Its stamped delivery position; null until Send's stamp lands. */
|
|
17
|
-
readonly deliverySequence: number | null;
|
|
18
|
-
}
|
|
19
|
-
/** Where the authority delivered one accepted mutation. */
|
|
20
|
-
export interface DeliveredMutation {
|
|
21
|
-
readonly entityId: string;
|
|
22
|
-
readonly mutationId: string;
|
|
23
|
-
readonly deliverySequence: number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* True when a local record on the entity's channel has a position that is
|
|
27
|
-
* unknown or after `targetDelivery`. Its position is its stamp, or, before
|
|
28
|
-
* the stamp lands, the Inbox position of the same mutation: Receive may hold
|
|
29
|
-
* this computer's own record first, and a result ordered at or before the
|
|
30
|
-
* target is older than it, never newer. A local record at the target is the
|
|
31
|
-
* target itself, which Apply verifies against the already-equal disk.
|
|
32
|
-
*/
|
|
33
|
-
export declare function hasLocalWorkAfter(local: readonly LocalWork[], received: readonly DeliveredMutation[], entityId: string, targetDelivery: number): boolean;
|
|
34
|
-
//# sourceMappingURL=local-work.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-work.d.ts","sourceRoot":"","sources":["../../src/apply/local-work.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,QAAQ,EAAE,SAAS,iBAAiB,EAAE,EACtC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAWT"}
|
package/dist/apply/local-work.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local work after a target: the local records that protect working ground
|
|
3
|
-
* from an older accepted result. The Apply store answers it inside its
|
|
4
|
-
* transaction; this is its pure form.
|
|
5
|
-
*
|
|
6
|
-
* An entity speaks only on its own channel, so a local record protects an
|
|
7
|
-
* entity from a target when it is on that entity's channel and is not ordered
|
|
8
|
-
* at or before the target. Order is delivery position, the one order every
|
|
9
|
-
* channel shares; a channel's own sequence orders only that channel and never
|
|
10
|
-
* decides here.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* True when a local record on the entity's channel has a position that is
|
|
14
|
-
* unknown or after `targetDelivery`. Its position is its stamp, or, before
|
|
15
|
-
* the stamp lands, the Inbox position of the same mutation: Receive may hold
|
|
16
|
-
* this computer's own record first, and a result ordered at or before the
|
|
17
|
-
* target is older than it, never newer. A local record at the target is the
|
|
18
|
-
* target itself, which Apply verifies against the already-equal disk.
|
|
19
|
-
*/
|
|
20
|
-
export function hasLocalWorkAfter(local, received, entityId, targetDelivery) {
|
|
21
|
-
if (!entityId || !Number.isSafeInteger(targetDelivery) || targetDelivery < 1) {
|
|
22
|
-
throw new Error('Apply local-work target is invalid');
|
|
23
|
-
}
|
|
24
|
-
return local.some((work) => {
|
|
25
|
-
if (work.entityId !== entityId)
|
|
26
|
-
return false;
|
|
27
|
-
const position = work.deliverySequence ?? received.find((delivered) => (delivered.entityId === work.entityId && delivered.mutationId === work.mutationId))?.deliverySequence;
|
|
28
|
-
return position === undefined || position > targetDelivery;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# 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;AAiBH;;;;;;;GAOG;AACH,MAAM,UAAU,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,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Digests taken in steps (steps.ts): bytes a block per step, and JSON text a
|
|
3
|
-
* bounded run per step (json-steps.ts). Each digests exactly the bytes its
|
|
4
|
-
* whole-input form would, so the hash is the same however the steps are
|
|
5
|
-
* paced.
|
|
6
|
-
*/
|
|
7
|
-
import { type Steps } from '../steps.js';
|
|
8
|
-
import type { CreateSha256 } from './types.js';
|
|
9
|
-
/** The SHA-256 of `bytes`. */
|
|
10
|
-
export declare function digestSteps(bytes: Uint8Array, createSha256: CreateSha256): Steps<string>;
|
|
11
|
-
/** The SHA-256 of the UTF-8 text JSON.stringify writes for plain JSON data,
|
|
12
|
-
* each JsonItems standing for its mapped array. */
|
|
13
|
-
export declare function jsonDigestSteps(value: unknown, createSha256: CreateSha256): Steps<string>;
|
|
14
|
-
//# sourceMappingURL=digest-steps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"digest-steps.d.ts","sourceRoot":"","sources":["../../src/entities/digest-steps.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAsB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,8BAA8B;AAC9B,wBAAiB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAOzF;AAED;mDACmD;AACnD,wBAAiB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAI1F"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Digests taken in steps (steps.ts): bytes a block per step, and JSON text a
|
|
3
|
-
* bounded run per step (json-steps.ts). Each digests exactly the bytes its
|
|
4
|
-
* whole-input form would, so the hash is the same however the steps are
|
|
5
|
-
* paced.
|
|
6
|
-
*/
|
|
7
|
-
import { BYTES_PER_BOUNDARY } from '../steps.js';
|
|
8
|
-
import { utf8Encode } from './bytes.js';
|
|
9
|
-
import { jsonTextSteps } from './json-steps.js';
|
|
10
|
-
/** The SHA-256 of `bytes`. */
|
|
11
|
-
export function* digestSteps(bytes, createSha256) {
|
|
12
|
-
const hash = createSha256();
|
|
13
|
-
for (let offset = 0; offset < bytes.length; offset += BYTES_PER_BOUNDARY) {
|
|
14
|
-
hash.update(bytes.subarray(offset, offset + BYTES_PER_BOUNDARY));
|
|
15
|
-
yield;
|
|
16
|
-
}
|
|
17
|
-
return hash.digestHex();
|
|
18
|
-
}
|
|
19
|
-
/** The SHA-256 of the UTF-8 text JSON.stringify writes for plain JSON data,
|
|
20
|
-
* each JsonItems standing for its mapped array. */
|
|
21
|
-
export function* jsonDigestSteps(value, createSha256) {
|
|
22
|
-
const hash = createSha256();
|
|
23
|
-
yield* jsonTextSteps(value, text => hash.update(utf8Encode(text)));
|
|
24
|
-
return hash.digestHex();
|
|
25
|
-
}
|
|
26
|
-
//# 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;AAEH,OAAO,EAAE,kBAAkB,EAAc,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,8BAA8B;AAC9B,MAAM,SAAS,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,kBAAkB,EAAE,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC;QACjE,KAAK,CAAC;IACR,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;AAC1B,CAAC;AAED;mDACmD;AACnD,MAAM,SAAS,CAAC,CAAC,eAAe,CAAC,KAAc,EAAE,YAA0B;IACzE,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,KAAK,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON text written in steps (steps.ts): exactly the text JSON.stringify
|
|
3
|
-
* writes for plain JSON data, handed out in bounded runs, so a long list or
|
|
4
|
-
* string never holds a host's thread however the steps are paced.
|
|
5
|
-
*/
|
|
6
|
-
import { type Steps } from '../steps.js';
|
|
7
|
-
/** An array within JSON text standing for `items.map(json)`, so a long list
|
|
8
|
-
* is never copied just to be written. */
|
|
9
|
-
export declare class JsonItems<T> {
|
|
10
|
-
readonly items: readonly T[];
|
|
11
|
-
readonly json: (item: T) => unknown;
|
|
12
|
-
constructor(items: readonly T[], json: (item: T) => unknown);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Hand `write` the text JSON.stringify writes for `value`, each JsonItems
|
|
16
|
-
* standing for its mapped array, in runs that join to exactly that text.
|
|
17
|
-
* A value whose text is surely short is written whole; longer strings,
|
|
18
|
-
* arrays and objects are walked, a boundary after each run of items or text.
|
|
19
|
-
*/
|
|
20
|
-
export declare function jsonTextSteps(value: unknown, write: (text: string) => void): Steps<void>;
|
|
21
|
-
//# sourceMappingURL=json-steps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-steps.d.ts","sourceRoot":"","sources":["../../src/entities/json-steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAA0C,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAOjF;yCACyC;AACzC,qBAAa,SAAS,CAAC,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;gBAExB,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO;CAI5D;AAoCD;;;;;GAKG;AACH,wBAAiB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CA2DzF"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON text written in steps (steps.ts): exactly the text JSON.stringify
|
|
3
|
-
* writes for plain JSON data, handed out in bounded runs, so a long list or
|
|
4
|
-
* string never holds a host's thread however the steps are paced.
|
|
5
|
-
*/
|
|
6
|
-
import { BYTES_PER_BOUNDARY, ITEMS_PER_BOUNDARY } from '../steps.js';
|
|
7
|
-
/** JSON text, in UTF-16 code units, handed out between boundaries: at most
|
|
8
|
-
* three UTF-8 bytes each, six for an escaped control character. A string
|
|
9
|
-
* longer than this is written in pieces of this length. */
|
|
10
|
-
const TEXT_PER_BOUNDARY = BYTES_PER_BOUNDARY / 4;
|
|
11
|
-
/** An array within JSON text standing for `items.map(json)`, so a long list
|
|
12
|
-
* is never copied just to be written. */
|
|
13
|
-
export class JsonItems {
|
|
14
|
-
items;
|
|
15
|
-
json;
|
|
16
|
-
constructor(items, json) {
|
|
17
|
-
this.items = items;
|
|
18
|
-
this.json = json;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/** The most UTF-16 code units JSON text spends on a value that is not a
|
|
22
|
-
* string, array or object. */
|
|
23
|
-
const SCALAR_TEXT = 24;
|
|
24
|
-
/** What remains of `budget` code units once `value`'s text is spent from it,
|
|
25
|
-
* before escaping, negative as soon as the text is surely longer. A
|
|
26
|
-
* JsonItems is always longer. */
|
|
27
|
-
function remaining(value, budget) {
|
|
28
|
-
if (typeof value === 'string')
|
|
29
|
-
return budget - value.length - 2;
|
|
30
|
-
if (typeof value !== 'object' || value === null)
|
|
31
|
-
return budget - SCALAR_TEXT;
|
|
32
|
-
if (value instanceof JsonItems)
|
|
33
|
-
return -1;
|
|
34
|
-
budget -= 2;
|
|
35
|
-
if (Array.isArray(value)) {
|
|
36
|
-
for (let index = 0; index < value.length && budget >= 0; index += 1) {
|
|
37
|
-
budget = remaining(value[index], budget - 1);
|
|
38
|
-
}
|
|
39
|
-
return budget;
|
|
40
|
-
}
|
|
41
|
-
for (const key in value) {
|
|
42
|
-
if (budget < 0)
|
|
43
|
-
break;
|
|
44
|
-
budget = remaining(value[key], budget - key.length - 4);
|
|
45
|
-
}
|
|
46
|
-
return budget;
|
|
47
|
-
}
|
|
48
|
-
/** Whether a value's JSON text is surely short, so it is written whole. */
|
|
49
|
-
const short = (value) => remaining(value, TEXT_PER_BOUNDARY) >= 0;
|
|
50
|
-
/** What JSON.stringify writes for a value, where a value it omits is `null`
|
|
51
|
-
* inside an array and nothing in an object. */
|
|
52
|
-
function whole(value, inArray) {
|
|
53
|
-
return JSON.stringify(value) ?? (inArray ? 'null' : '');
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Hand `write` the text JSON.stringify writes for `value`, each JsonItems
|
|
57
|
-
* standing for its mapped array, in runs that join to exactly that text.
|
|
58
|
-
* A value whose text is surely short is written whole; longer strings,
|
|
59
|
-
* arrays and objects are walked, a boundary after each run of items or text.
|
|
60
|
-
*/
|
|
61
|
-
export function* jsonTextSteps(value, write) {
|
|
62
|
-
let text = '', work = 0;
|
|
63
|
-
function* walk(value) {
|
|
64
|
-
if (typeof value === 'string') {
|
|
65
|
-
text += '"';
|
|
66
|
-
for (let start = 0; start < value.length;) {
|
|
67
|
-
// A piece never ends between the two halves of a surrogate pair.
|
|
68
|
-
let end = Math.min(start + TEXT_PER_BOUNDARY, value.length);
|
|
69
|
-
const last = value.charCodeAt(end - 1);
|
|
70
|
-
if (end < value.length && last >= 0xd800 && last <= 0xdbff)
|
|
71
|
-
end -= 1;
|
|
72
|
-
text += JSON.stringify(value.slice(start, end)).slice(1, -1);
|
|
73
|
-
start = end;
|
|
74
|
-
write(text);
|
|
75
|
-
text = '';
|
|
76
|
-
yield;
|
|
77
|
-
}
|
|
78
|
-
text += '"';
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const mapped = value instanceof JsonItems;
|
|
82
|
-
if (mapped || Array.isArray(value)) {
|
|
83
|
-
const items = mapped ? value.items : value;
|
|
84
|
-
text += '[';
|
|
85
|
-
for (let index = 0; index < items.length; index += 1) {
|
|
86
|
-
if (index > 0)
|
|
87
|
-
text += ',';
|
|
88
|
-
const item = !(index in items) ? undefined
|
|
89
|
-
: mapped ? value.json(items[index]) : items[index];
|
|
90
|
-
if (short(item))
|
|
91
|
-
text += whole(item, true);
|
|
92
|
-
else
|
|
93
|
-
yield* walk(item);
|
|
94
|
-
if (++work % ITEMS_PER_BOUNDARY === 0 || text.length >= TEXT_PER_BOUNDARY) {
|
|
95
|
-
write(text);
|
|
96
|
-
text = '';
|
|
97
|
-
yield;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
text += ']';
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const fields = value;
|
|
104
|
-
text += '{';
|
|
105
|
-
let first = true;
|
|
106
|
-
for (const key of Object.keys(fields)) {
|
|
107
|
-
const field = fields[key];
|
|
108
|
-
if (field === undefined || typeof field === 'function' || typeof field === 'symbol')
|
|
109
|
-
continue;
|
|
110
|
-
text += `${first ? '' : ','}${JSON.stringify(key)}:`;
|
|
111
|
-
first = false;
|
|
112
|
-
if (short(field))
|
|
113
|
-
text += whole(field, false);
|
|
114
|
-
else
|
|
115
|
-
yield* walk(field);
|
|
116
|
-
if (++work % ITEMS_PER_BOUNDARY === 0 || text.length >= TEXT_PER_BOUNDARY) {
|
|
117
|
-
write(text);
|
|
118
|
-
text = '';
|
|
119
|
-
yield;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
text += '}';
|
|
123
|
-
}
|
|
124
|
-
if (short(value))
|
|
125
|
-
text = whole(value, false);
|
|
126
|
-
else
|
|
127
|
-
yield* walk(value);
|
|
128
|
-
write(text);
|
|
129
|
-
}
|
|
130
|
-
//# 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;AAEH,OAAO,EAAE,kBAA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
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 { type EntityReadPort } from './types.js';
|
|
20
|
-
/** One requested move: the entity, its target parent, its target name. */
|
|
21
|
-
export interface EntityMove {
|
|
22
|
-
readonly uuid: string;
|
|
23
|
-
readonly parentUUID: string;
|
|
24
|
-
readonly name: string;
|
|
25
|
-
}
|
|
26
|
-
/** One planned store write. `type: 'folder'` appears exactly when the
|
|
27
|
-
* mover was a parentless workspace shedding its root shape on adoption. */
|
|
28
|
-
export interface PlannedMove {
|
|
29
|
-
readonly uuid: string;
|
|
30
|
-
readonly parentUuid: string;
|
|
31
|
-
readonly name: string;
|
|
32
|
-
readonly type?: 'folder';
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Validate one batch of moves as one transition and return the writes to
|
|
36
|
-
* land together. Refused whole when any move breaks a law: a mover named
|
|
37
|
-
* twice, an inactive mover, an invalid name, a non-container target, two
|
|
38
|
-
* movers claiming one slot, an occupied slot outside the batch, a cycle in
|
|
39
|
-
* the post-state parent graph, or an inactive target chain.
|
|
40
|
-
*/
|
|
41
|
-
export declare function planMoveBatch(moves: readonly EntityMove[], port: EntityReadPort): PlannedMove[];
|
|
42
|
-
//# sourceMappingURL=moves.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"moves.d.ts","sourceRoot":"","sources":["../../src/entities/moves.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAc,KAAK,cAAc,EAAkB,MAAM,YAAY,CAAC;AAG7E,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;2EAC2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,WAAW,EAAE,CAmD/F"}
|