@amalgm/live 0.2.29 → 0.2.31
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/PURPOSE.md +37 -2
- package/README.md +1 -0
- package/dist/apply/content-results.d.ts +26 -0
- package/dist/apply/content-results.d.ts.map +1 -0
- package/dist/apply/content-results.js +52 -0
- package/dist/apply/content-results.js.map +1 -0
- package/dist/apply/contracts.d.ts +191 -0
- package/dist/apply/contracts.d.ts.map +1 -0
- package/dist/apply/contracts.js +47 -0
- package/dist/apply/contracts.js.map +1 -0
- package/dist/apply/index.d.ts +10 -0
- package/dist/apply/index.d.ts.map +1 -0
- package/dist/apply/index.js +10 -0
- package/dist/apply/index.js.map +1 -0
- package/dist/apply/local-work.d.ts +10 -0
- package/dist/apply/local-work.d.ts.map +1 -0
- package/dist/apply/local-work.js +17 -0
- package/dist/apply/local-work.js.map +1 -0
- package/dist/apply/plans.d.ts +14 -0
- package/dist/apply/plans.d.ts.map +1 -0
- package/dist/apply/plans.js +183 -0
- package/dist/apply/plans.js.map +1 -0
- package/dist/apply/rail.d.ts +25 -0
- package/dist/apply/rail.d.ts.map +1 -0
- package/dist/apply/rail.js +304 -0
- package/dist/apply/rail.js.map +1 -0
- package/dist/apply/repository-result.d.ts +25 -0
- package/dist/apply/repository-result.d.ts.map +1 -0
- package/dist/apply/repository-result.js +83 -0
- package/dist/apply/repository-result.js.map +1 -0
- package/dist/apply/selection.d.ts +14 -0
- package/dist/apply/selection.d.ts.map +1 -0
- package/dist/apply/selection.js +63 -0
- package/dist/apply/selection.js.map +1 -0
- package/dist/apply/type-adapters.d.ts +13 -0
- package/dist/apply/type-adapters.d.ts.map +1 -0
- package/dist/apply/type-adapters.js +37 -0
- package/dist/apply/type-adapters.js.map +1 -0
- package/dist/detection/adapter-contract.d.ts +11 -8
- package/dist/detection/adapter-contract.d.ts.map +1 -1
- package/dist/detection/adapter-contract.js +5 -5
- package/dist/detection/adapter-contract.js.map +1 -1
- package/dist/detection/echo.d.ts +1 -1
- package/dist/detection/echo.d.ts.map +1 -1
- package/dist/detection/echo.js +8 -1
- package/dist/detection/echo.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/records/index.d.ts +2 -0
- package/dist/records/index.d.ts.map +1 -1
- package/dist/records/index.js +2 -0
- package/dist/records/index.js.map +1 -1
- package/dist/records/rail.d.ts +97 -0
- package/dist/records/rail.d.ts.map +1 -0
- package/dist/records/rail.js +250 -0
- package/dist/records/rail.js.map +1 -0
- package/dist/records/wire.d.ts +63 -0
- package/dist/records/wire.d.ts.map +1 -0
- package/dist/records/wire.js +86 -0
- package/dist/records/wire.js.map +1 -0
- package/dist-cjs/apply/content-results.js +57 -0
- package/dist-cjs/apply/content-results.js.map +1 -0
- package/dist-cjs/apply/contracts.js +53 -0
- package/dist-cjs/apply/contracts.js.map +1 -0
- package/dist-cjs/apply/index.js +28 -0
- package/dist-cjs/apply/index.js.map +1 -0
- package/dist-cjs/apply/local-work.js +20 -0
- package/dist-cjs/apply/local-work.js.map +1 -0
- package/dist-cjs/apply/plans.js +187 -0
- package/dist-cjs/apply/plans.js.map +1 -0
- package/dist-cjs/apply/rail.js +308 -0
- package/dist-cjs/apply/rail.js.map +1 -0
- package/dist-cjs/apply/repository-result.js +86 -0
- package/dist-cjs/apply/repository-result.js.map +1 -0
- package/dist-cjs/apply/selection.js +66 -0
- package/dist-cjs/apply/selection.js.map +1 -0
- package/dist-cjs/apply/type-adapters.js +41 -0
- package/dist-cjs/apply/type-adapters.js.map +1 -0
- package/dist-cjs/detection/adapter-contract.js +5 -5
- package/dist-cjs/detection/adapter-contract.js.map +1 -1
- package/dist-cjs/detection/echo.js +8 -1
- package/dist-cjs/detection/echo.js.map +1 -1
- package/dist-cjs/index.js +1 -0
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/records/index.js +2 -0
- package/dist-cjs/records/index.js.map +1 -1
- package/dist-cjs/records/rail.js +254 -0
- package/dist-cjs/records/rail.js.map +1 -0
- package/dist-cjs/records/wire.js +91 -0
- package/dist-cjs/records/wire.js.map +1 -0
- package/package.json +7 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Portable proof of one incremental Git Card + Checkpoint transport chain. */
|
|
2
|
+
import { applyRepositoryIdentity, decodeRepositoryTransport, deriveCardId, deriveCheckpointId, deriveStateId, } from '../entities/repo-states.js';
|
|
3
|
+
const portableRepositoryPath = (path) => path.length > 0
|
|
4
|
+
&& !path.startsWith('/')
|
|
5
|
+
&& !path.includes('\0')
|
|
6
|
+
&& path.split('/').every((part) => part !== '' && part !== '.' && part !== '..');
|
|
7
|
+
function assertTransportTruth(state, sha256Hex) {
|
|
8
|
+
const cardId = deriveCardId(state.card, sha256Hex);
|
|
9
|
+
const checkpointId = deriveCheckpointId(state.checkpoint, sha256Hex);
|
|
10
|
+
const stateId = deriveStateId(cardId, checkpointId, sha256Hex);
|
|
11
|
+
if (state.cardId !== cardId || state.checkpointId !== checkpointId || state.stateId !== stateId) {
|
|
12
|
+
throw new Error('repository Apply transport IDs do not describe its Card + Checkpoint');
|
|
13
|
+
}
|
|
14
|
+
if (state.pack !== null && sha256Hex(state.pack.bytes) !== state.pack.sha256) {
|
|
15
|
+
throw new Error('repository Apply Git pack failed verification');
|
|
16
|
+
}
|
|
17
|
+
const paths = new Set();
|
|
18
|
+
for (const file of state.checkpoint.untracked) {
|
|
19
|
+
if (!portableRepositoryPath(file.path) || paths.has(file.path)
|
|
20
|
+
|| !['100644', '100755', '120000'].includes(file.mode)) {
|
|
21
|
+
throw new Error('repository Apply Checkpoint has an invalid untracked path or mode');
|
|
22
|
+
}
|
|
23
|
+
paths.add(file.path);
|
|
24
|
+
if (file.content !== null && sha256Hex(file.content) !== file.sha256) {
|
|
25
|
+
throw new Error(`repository Apply Checkpoint content failed verification for ${file.path}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const entry of state.identityDelta.upsert) {
|
|
29
|
+
if (!portableRepositoryPath(entry.path)) {
|
|
30
|
+
throw new Error('repository Apply identity map has an unsafe path');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (state.identityDelta.remove.some((path) => !portableRepositoryPath(path))) {
|
|
34
|
+
throw new Error('repository Apply identity map has an unsafe removal path');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Verify a sealed transport suffix before a host invokes Git. With a null
|
|
39
|
+
* base the chain must be complete from its reset node. With a durable local
|
|
40
|
+
* base, the first incremental node must name that exact transport frontier.
|
|
41
|
+
*/
|
|
42
|
+
export function prepareRepositoryResult(plan, nodes, base, sha256Hex) {
|
|
43
|
+
if (nodes.length === 0)
|
|
44
|
+
throw new Error('repository Apply transport chain is empty');
|
|
45
|
+
let priorVersion = base.transportVersion;
|
|
46
|
+
let identity = base.identity;
|
|
47
|
+
if ((base.transportVersion === null) !== (base.identity === null)) {
|
|
48
|
+
throw new Error('repository Apply base frontier is incomplete');
|
|
49
|
+
}
|
|
50
|
+
const transports = [];
|
|
51
|
+
for (const node of nodes) {
|
|
52
|
+
if (sha256Hex(node.bytes) !== node.transportVersion) {
|
|
53
|
+
throw new Error('repository Apply transport failed its immutable hash');
|
|
54
|
+
}
|
|
55
|
+
const state = decodeRepositoryTransport(node.bytes);
|
|
56
|
+
if (state.parentTransportVersion !== priorVersion) {
|
|
57
|
+
throw new Error('repository Apply transport chain is discontinuous');
|
|
58
|
+
}
|
|
59
|
+
assertTransportTruth(state, sha256Hex);
|
|
60
|
+
identity = applyRepositoryIdentity(identity, state, sha256Hex);
|
|
61
|
+
transports.push(state);
|
|
62
|
+
priorVersion = node.transportVersion;
|
|
63
|
+
}
|
|
64
|
+
const latest = transports.at(-1);
|
|
65
|
+
if (priorVersion !== plan.transportVersion
|
|
66
|
+
|| latest.parentTransportVersion !== plan.parentTransportVersion
|
|
67
|
+
|| latest.stateId !== plan.stateId
|
|
68
|
+
|| latest.cardId !== plan.cardId
|
|
69
|
+
|| latest.checkpointId !== plan.checkpointId) {
|
|
70
|
+
throw new Error('repository Apply chain does not produce its accepted complete result');
|
|
71
|
+
}
|
|
72
|
+
const missingUntracked = latest.checkpoint.untracked.find((file) => file.content === null);
|
|
73
|
+
if (missingUntracked) {
|
|
74
|
+
throw new Error(`repository Apply Checkpoint omitted untracked content for ${missingUntracked.path}`);
|
|
75
|
+
}
|
|
76
|
+
return Object.freeze({
|
|
77
|
+
transports: Object.freeze(transports),
|
|
78
|
+
latest,
|
|
79
|
+
transportVersion: priorVersion,
|
|
80
|
+
identity: Object.freeze([...identity]),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=repository-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-result.js","sourceRoot":"","sources":["../../src/apply/repository-result.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,YAAY,EACZ,kBAAkB,EAClB,aAAa,GAGd,MAAM,4BAA4B,CAAC;AAqBpC,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;OACpE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;OACrB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;OACpB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC;AAEnF,SAAS,oBAAoB,CAAC,KAA0B,EAAE,SAAoB;IAC5E,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,UAA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and complete-result coalescing. */
|
|
2
|
+
import { type AcceptedEntityRecord } from '../records/contracts.js';
|
|
3
|
+
import { type EntityApplyWork } from './contracts.js';
|
|
4
|
+
export interface SelectedEntityApply {
|
|
5
|
+
readonly records: readonly AcceptedEntityRecord[];
|
|
6
|
+
readonly target: AcceptedEntityRecord;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Select the exact target named by a recovering intent, otherwise the newest
|
|
10
|
+
* contiguous complete result. The host may reveal only this target; every
|
|
11
|
+
* earlier selected row becomes resolved after target Verify succeeds.
|
|
12
|
+
*/
|
|
13
|
+
export declare function selectEntityApply(work: EntityApplyWork): SelectedEntityApply;
|
|
14
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../src/apply/selection.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAG1E,OAAO,EAA6B,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEzE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;CACvC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,mBAAmB,CAmD5E"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Gap-free per-entity Apply selection and complete-result coalescing. */
|
|
2
|
+
import { assertRecord } from '../entities/cloud.js';
|
|
3
|
+
import { checkAcceptedEntityRecord } from '../records/contracts.js';
|
|
4
|
+
import { assertApplyIntent } from './contracts.js';
|
|
5
|
+
/**
|
|
6
|
+
* Select the exact target named by a recovering intent, otherwise the newest
|
|
7
|
+
* contiguous complete result. The host may reveal only this target; every
|
|
8
|
+
* earlier selected row becomes resolved after target Verify succeeds.
|
|
9
|
+
*/
|
|
10
|
+
export function selectEntityApply(work) {
|
|
11
|
+
if (!work.authorityId || !work.entityId
|
|
12
|
+
|| !Number.isSafeInteger(work.resolvedThrough) || work.resolvedThrough < 0
|
|
13
|
+
|| work.records.length === 0) {
|
|
14
|
+
throw new Error('entity Apply work is invalid');
|
|
15
|
+
}
|
|
16
|
+
let expected = work.resolvedThrough + 1;
|
|
17
|
+
for (const record of work.records) {
|
|
18
|
+
const checked = checkAcceptedEntityRecord(record);
|
|
19
|
+
if (!checked.ok)
|
|
20
|
+
throw new Error(checked.error);
|
|
21
|
+
if (record.authorityId !== work.authorityId || record.entityId !== work.entityId) {
|
|
22
|
+
throw new Error('one entity Apply batch cannot cross authority or UUID channels');
|
|
23
|
+
}
|
|
24
|
+
if (record.globalSequence !== expected) {
|
|
25
|
+
throw new Error(`entity Apply work has a gap before sequence ${record.globalSequence}`);
|
|
26
|
+
}
|
|
27
|
+
expected += 1;
|
|
28
|
+
}
|
|
29
|
+
if (work.materialized !== null) {
|
|
30
|
+
const current = assertRecord(work.materialized.record);
|
|
31
|
+
if (current.uuid !== work.entityId
|
|
32
|
+
|| !Number.isSafeInteger(work.materialized.globalSequence)
|
|
33
|
+
|| work.materialized.globalSequence < 1
|
|
34
|
+
|| work.materialized.globalSequence > work.resolvedThrough) {
|
|
35
|
+
throw new Error('entity Apply materialization proof is invalid');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let through = work.records.at(-1).globalSequence;
|
|
39
|
+
if (work.intent !== null) {
|
|
40
|
+
assertApplyIntent(work.intent);
|
|
41
|
+
if (work.intent.authorityId !== work.authorityId
|
|
42
|
+
|| work.intent.entityId !== work.entityId
|
|
43
|
+
|| work.intent.fromSequence !== work.resolvedThrough) {
|
|
44
|
+
throw new Error('entity Apply intent does not own this work range');
|
|
45
|
+
}
|
|
46
|
+
through = work.intent.throughSequence;
|
|
47
|
+
}
|
|
48
|
+
const index = through - work.resolvedThrough - 1;
|
|
49
|
+
const target = work.records[index];
|
|
50
|
+
if (!target)
|
|
51
|
+
throw new Error('entity Apply intent target is absent from Inbox work');
|
|
52
|
+
if (work.intent !== null
|
|
53
|
+
&& (target.mutationId !== work.intent.targetMutationId
|
|
54
|
+
|| target.resultState !== work.intent.targetState
|
|
55
|
+
|| target.change.result.type !== work.intent.targetType)) {
|
|
56
|
+
throw new Error('entity Apply intent target does not match its retained Inbox record');
|
|
57
|
+
}
|
|
58
|
+
return Object.freeze({
|
|
59
|
+
records: Object.freeze(work.records.slice(0, index + 1)),
|
|
60
|
+
target,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/apply/selection.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAA6B,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AAOzE;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ;WAClC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,eAAe,GAAG,CAAC;WACvE,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,QAAQ,GAAG,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IACxC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,OA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IAAI,CAAC,MAAM,CAAC,YAAY,KAAK,IAAI,CAAC,eAAe,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;IACxC,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,GAAG,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACrF,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;WACnB,CAAC,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,gBAAgB;eACjD,MAAM,CAAC,WAAW,KAAK,IAAI,CAAC,MAAM,CAAC,WAAW;eAC9C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACxD,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Bridge the canonical entity type registry to the Apply/Verify coordinator. */
|
|
2
|
+
import { type AdapterDescriptor } from '../detection/adapter-contract.js';
|
|
3
|
+
import type { EntityApplyEffectsPort } from './contracts.js';
|
|
4
|
+
export type CaptureLocalEffect = EntityApplyEffectsPort['captureLocal'];
|
|
5
|
+
/**
|
|
6
|
+
* Adapt the already-convicted one-type/one-adapter registry for Apply. The
|
|
7
|
+
* subsystem refuses partial support: every type selected at runtime must bind
|
|
8
|
+
* both complete sockets, never a generic fallback or a path-based guess.
|
|
9
|
+
*/
|
|
10
|
+
export declare function entityApplyEffects(byType: ReadonlyMap<string, AdapterDescriptor>, captureLocal: CaptureLocalEffect): EntityApplyEffectsPort;
|
|
11
|
+
/** Build the universal physical-type registry, refusing any missing type. */
|
|
12
|
+
export declare function buildEntityApplyEffects(adapters: Iterable<unknown>, captureLocal: CaptureLocalEffect): EntityApplyEffectsPort;
|
|
13
|
+
//# sourceMappingURL=type-adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-adapters.d.ts","sourceRoot":"","sources":["../../src/apply/type-adapters.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,KAAK,EACV,sBAAsB,EAIvB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAC9C,YAAY,EAAE,kBAAkB,GAC/B,sBAAsB,CA0BxB;AAED,6EAA6E;AAC7E,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC3B,YAAY,EAAE,kBAAkB,GAC/B,sBAAsB,CAExB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Bridge the canonical entity type registry to the Apply/Verify coordinator. */
|
|
2
|
+
import { buildTypeMap } from '../detection/adapter-contract.js';
|
|
3
|
+
import { ENTITY_TYPES, isEntityType } from '../entities/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Adapt the already-convicted one-type/one-adapter registry for Apply. The
|
|
6
|
+
* subsystem refuses partial support: every type selected at runtime must bind
|
|
7
|
+
* both complete sockets, never a generic fallback or a path-based guess.
|
|
8
|
+
*/
|
|
9
|
+
export function entityApplyEffects(byType, captureLocal) {
|
|
10
|
+
const operational = new Map();
|
|
11
|
+
for (const [type, descriptor] of byType) {
|
|
12
|
+
if (!isEntityType(type)) {
|
|
13
|
+
throw new Error(`Apply adapter registry contains unknown entity type ${JSON.stringify(type)}`);
|
|
14
|
+
}
|
|
15
|
+
const { apply, verify } = descriptor.rails;
|
|
16
|
+
if (!apply || !verify) {
|
|
17
|
+
throw new Error(`adapter ${descriptor.name} cannot Apply ${type} until both Apply and Verify sockets are bound`);
|
|
18
|
+
}
|
|
19
|
+
operational.set(type, Object.freeze({ name: descriptor.name, apply, verify }));
|
|
20
|
+
}
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
adapterFor(type) {
|
|
23
|
+
const adapter = operational.get(type);
|
|
24
|
+
if (!adapter)
|
|
25
|
+
throw new Error(`entity type ${type} has no operational Apply adapter`);
|
|
26
|
+
return adapter;
|
|
27
|
+
},
|
|
28
|
+
captureLocal(intent, plan, position) {
|
|
29
|
+
return captureLocal(intent, plan, position);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Build the universal physical-type registry, refusing any missing type. */
|
|
34
|
+
export function buildEntityApplyEffects(adapters, captureLocal) {
|
|
35
|
+
return entityApplyEffects(buildTypeMap(adapters, ENTITY_TYPES), captureLocal);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=type-adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-adapters.js","sourceRoot":"","sources":["../../src/apply/type-adapters.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,EAAE,YAAY,EAA0B,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAmB,MAAM,sBAAsB,CAAC;AAUnF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA8C,EAC9C,YAAgC;IAEhC,MA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,CAAC"}
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
* rail earns a socket only when a real consumer proves that
|
|
33
33
|
* behavior differs by type — never for symmetry.
|
|
34
34
|
*/
|
|
35
|
+
import type { EntityApplySocket, EntityVerifySocket } from '../apply/contracts.js';
|
|
35
36
|
export type Rail = 'watch' | 'detect' | 'record' | 'send' | 'receive' | 'apply' | 'verify';
|
|
36
37
|
/** The seven rails, declared once, frozen, in journey order. */
|
|
37
38
|
export declare const RAILS: readonly Rail[];
|
|
@@ -49,6 +50,9 @@ export declare const RAILS: readonly Rail[];
|
|
|
49
50
|
export type TruthReading = {
|
|
50
51
|
readonly truth: 'present';
|
|
51
52
|
readonly version: string;
|
|
53
|
+
/** Repository identity transport is exact materialization truth even when
|
|
54
|
+
* Card + Checkpoint logical version is unchanged. */
|
|
55
|
+
readonly transportVersion?: string | null;
|
|
52
56
|
readonly state?: unknown;
|
|
53
57
|
} | {
|
|
54
58
|
readonly truth: 'absent';
|
|
@@ -56,18 +60,16 @@ export type TruthReading = {
|
|
|
56
60
|
readonly truth: 'unsettled';
|
|
57
61
|
readonly reason?: string | undefined;
|
|
58
62
|
};
|
|
59
|
-
/**
|
|
63
|
+
/** Detect's one ratified truth-read socket. */
|
|
60
64
|
export interface DetectSocket {
|
|
61
65
|
readonly truth: (path: string) => TruthReading;
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
64
68
|
* The ratified sockets — for each rail that has one, the exact surfaces
|
|
65
69
|
* every binding adapter implements. Same names, same shapes, every
|
|
66
|
-
* type.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* verify join only when the Send/Receive rails exist to derive their
|
|
70
|
-
* socket from. A socket is ratified from a real consumer or it is not
|
|
70
|
+
* type. Detect, Apply, and Verify are ratified from their real portable
|
|
71
|
+
* consumers. Watch, Record, Send, and Receive need no type-specific surface
|
|
72
|
+
* at this bar. A socket is ratified from a real consumer or it is not
|
|
71
73
|
* ratified at all.
|
|
72
74
|
*/
|
|
73
75
|
export declare const SOCKETS: Readonly<Partial<Record<Rail, readonly string[]>>>;
|
|
@@ -76,14 +78,15 @@ export declare const SOCKETS: Readonly<Partial<Record<Rail, readonly string[]>>>
|
|
|
76
78
|
*
|
|
77
79
|
* name — the adapter's one name
|
|
78
80
|
* types — { entityType: 'one-sentence source of truth', ... }
|
|
79
|
-
* rails — only rails whose ratified socket the adapter fully
|
|
80
|
-
* implements; detect is the only bindable rail today
|
|
81
|
+
* rails — only rails whose ratified socket the adapter fully implements
|
|
81
82
|
*/
|
|
82
83
|
export interface AdapterDescriptor {
|
|
83
84
|
readonly name: string;
|
|
84
85
|
readonly types: Readonly<Record<string, string>>;
|
|
85
86
|
readonly rails: {
|
|
86
87
|
readonly detect?: DetectSocket;
|
|
88
|
+
readonly apply?: EntityApplySocket;
|
|
89
|
+
readonly verify?: EntityVerifySocket;
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
92
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-contract.d.ts","sourceRoot":"","sources":["../../src/detection/adapter-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3F,gEAAgE;AAChE,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAE/B,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,GACpB;
|
|
1
|
+
{"version":3,"file":"adapter-contract.d.ts","sourceRoot":"","sources":["../../src/detection/adapter-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,MAAM,MAAM,IAAI,GAAG,OAAO,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tC,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CA6CjE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC3B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GACzB,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAsBhC;AAED,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,UAAU,KAChB;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAGpD,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAM7B,CAAC"}
|
|
@@ -39,15 +39,15 @@ export const RAILS = Object.freeze([
|
|
|
39
39
|
/**
|
|
40
40
|
* The ratified sockets — for each rail that has one, the exact surfaces
|
|
41
41
|
* every binding adapter implements. Same names, same shapes, every
|
|
42
|
-
* type.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* verify join only when the Send/Receive rails exist to derive their
|
|
46
|
-
* socket from. A socket is ratified from a real consumer or it is not
|
|
42
|
+
* type. Detect, Apply, and Verify are ratified from their real portable
|
|
43
|
+
* consumers. Watch, Record, Send, and Receive need no type-specific surface
|
|
44
|
+
* at this bar. A socket is ratified from a real consumer or it is not
|
|
47
45
|
* ratified at all.
|
|
48
46
|
*/
|
|
49
47
|
export const SOCKETS = Object.freeze({
|
|
50
48
|
detect: Object.freeze(['truth']),
|
|
49
|
+
apply: Object.freeze(['prepare', 'guard', 'reveal', 'discard']),
|
|
50
|
+
verify: Object.freeze(['verify']),
|
|
51
51
|
});
|
|
52
52
|
/**
|
|
53
53
|
* Convict a malformed adapter descriptor loudly; return it (typed)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-contract.js","sourceRoot":"","sources":["../../src/detection/adapter-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"adapter-contract.js","sourceRoot":"","sources":["../../src/detection/adapter-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAMH,gEAAgE;AAChE,MAAM,CAAC,MAAM,KAAK,GAAoB,MAAM,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ;CAClE,CAAC,CAAC;AA8BH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAuD,MAAM,CAAC,MAAM,CAAC;IACvF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/D,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;CAClC,CAAC,CAAC;AAmBH;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;QACvF,CAAC,CAAC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IAAI,KAAK,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAAiB,EACoF,EAAE,CACvG,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;IACjD,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE;IACrB,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAsB,MAAM,CAAC,MAAM,CAAC;IAC/D,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,4FAA4F;KACxG,CAAC;IACF,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;CACzB,CAAC,CAAC"}
|
package/dist/detection/echo.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type EchoDecision = {
|
|
|
16
16
|
readonly kind: 'retry';
|
|
17
17
|
readonly reason?: string | undefined;
|
|
18
18
|
};
|
|
19
|
-
export declare function echoDecision(notebook: Pick<CloudEntityRecord, 'status' | 'version'>, observed: TruthReading): EchoDecision;
|
|
19
|
+
export declare function echoDecision(notebook: Pick<CloudEntityRecord, 'status' | 'version' | 'transportVersion'>, observed: TruthReading): EchoDecision;
|
|
20
20
|
//# sourceMappingURL=echo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAErE,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAErE,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,GAAG,kBAAkB,CAAC,EAC5E,QAAQ,EAAE,YAAY,GACrB,YAAY,CAmBd"}
|
package/dist/detection/echo.js
CHANGED
|
@@ -13,7 +13,14 @@ export function echoDecision(notebook, observed) {
|
|
|
13
13
|
: { kind: 'retry', reason: observed.reason };
|
|
14
14
|
}
|
|
15
15
|
if (notebook.status === 'active') {
|
|
16
|
-
|
|
16
|
+
const exactTransport = notebook.transportVersion === null
|
|
17
|
+
? observed.truth === 'present'
|
|
18
|
+
&& (observed.transportVersion === undefined || observed.transportVersion === null)
|
|
19
|
+
: observed.truth === 'present'
|
|
20
|
+
&& observed.transportVersion === notebook.transportVersion;
|
|
21
|
+
return observed.truth === 'present'
|
|
22
|
+
&& observed.version === notebook.version
|
|
23
|
+
&& exactTransport
|
|
17
24
|
? { kind: 'silence' }
|
|
18
25
|
: { kind: 'detect' };
|
|
19
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,MAAM,UAAU,YAAY,CAC1B,
|
|
1
|
+
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,MAAM,UAAU,YAAY,CAC1B,QAA4E,EAC5E,QAAsB;IAEtB,IAAI,QAAQ,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,QAAQ,CAAC,MAAM,KAAK,SAAS;YAClC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;YACnB,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,cAAc,GAAG,QAAQ,CAAC,gBAAgB,KAAK,IAAI;YACvD,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,SAAS;mBACzB,CAAC,QAAQ,CAAC,gBAAgB,KAAK,SAAS,IAAI,QAAQ,CAAC,gBAAgB,KAAK,IAAI,CAAC;YACpF,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,SAAS;mBACzB,QAAQ,CAAC,gBAAgB,KAAK,QAAQ,CAAC,gBAAgB,CAAC;QAC/D,OAAO,QAAQ,CAAC,KAAK,KAAK,SAAS;eAC9B,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;eACrC,cAAc;YACjB,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE;YACrB,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAChF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './entities/index.js';
|
|
|
15
15
|
export * from './watching/index.js';
|
|
16
16
|
export * from './detection/index.js';
|
|
17
17
|
export * from './records/index.js';
|
|
18
|
+
export * from './apply/index.js';
|
|
18
19
|
export * from './registration/index.js';
|
|
19
20
|
export * from './files/index.js';
|
|
20
21
|
export * from './transfer/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from './entities/index.js';
|
|
|
15
15
|
export * from './watching/index.js';
|
|
16
16
|
export * from './detection/index.js';
|
|
17
17
|
export * from './records/index.js';
|
|
18
|
+
export * from './apply/index.js';
|
|
18
19
|
export * from './registration/index.js';
|
|
19
20
|
export * from './files/index.js';
|
|
20
21
|
export * from './transfer/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
package/dist/records/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/records/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/records/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
package/dist/records/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/records/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/records/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Portable, event-driven Send and Receive orchestration. Hosts inject effects. */
|
|
2
|
+
import { type OutboxRow } from './outbox.js';
|
|
3
|
+
import type { AcceptedEntityRecord, LocalEntityRecord } from './contracts.js';
|
|
4
|
+
export declare const ENTITY_RECORD_DELIVERY_LIMIT = 256;
|
|
5
|
+
export declare const ENTITY_RECORD_RETRY_BASE_MS = 1000;
|
|
6
|
+
export declare const ENTITY_RECORD_RETRY_MAX_MS = 30000;
|
|
7
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
8
|
+
export type PendingEntityRecord = Extract<OutboxRow, {
|
|
9
|
+
readonly status: 'pending';
|
|
10
|
+
}> & {
|
|
11
|
+
readonly localSequence: number;
|
|
12
|
+
};
|
|
13
|
+
export interface DeliveredEntityRecord {
|
|
14
|
+
readonly deliverySequence: number;
|
|
15
|
+
readonly record: AcceptedEntityRecord;
|
|
16
|
+
}
|
|
17
|
+
export interface EntityRecordAvailability {
|
|
18
|
+
readonly authorityId: string;
|
|
19
|
+
}
|
|
20
|
+
export interface EntityRecordGap {
|
|
21
|
+
readonly entityId: string;
|
|
22
|
+
readonly after: number;
|
|
23
|
+
readonly received: number;
|
|
24
|
+
}
|
|
25
|
+
export type ReceiveEntityDeliveriesResult = {
|
|
26
|
+
readonly kind: 'stored';
|
|
27
|
+
readonly deliveryCursor: number;
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: 'gap';
|
|
30
|
+
readonly gap: EntityRecordGap;
|
|
31
|
+
};
|
|
32
|
+
/** One persistent host-owned transaction boundary for the two local queues. */
|
|
33
|
+
export interface EntityRecordStorePort {
|
|
34
|
+
readPending(): MaybePromise<readonly PendingEntityRecord[]>;
|
|
35
|
+
stampAccepted(row: PendingEntityRecord, accepted: AcceptedEntityRecord): MaybePromise<void>;
|
|
36
|
+
readDeliveryCursor(authorityId: string): MaybePromise<number>;
|
|
37
|
+
receive(input: {
|
|
38
|
+
readonly authorityId: string;
|
|
39
|
+
readonly deliveries: readonly DeliveredEntityRecord[];
|
|
40
|
+
/** False only while repairing one entity gap. */
|
|
41
|
+
readonly advanceDeliveryCursor: boolean;
|
|
42
|
+
}): MaybePromise<ReceiveEntityDeliveriesResult>;
|
|
43
|
+
}
|
|
44
|
+
export interface EntityRecordCargoPort {
|
|
45
|
+
ensure(record: LocalEntityRecord): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
/** Authenticated authority effects. `subscribe` registers before it reads. */
|
|
48
|
+
export interface EntityRecordAuthorityPort {
|
|
49
|
+
submit(record: LocalEntityRecord): Promise<AcceptedEntityRecord>;
|
|
50
|
+
subscribe(input: {
|
|
51
|
+
readonly authorityId: string;
|
|
52
|
+
readonly afterDeliverySequence: number;
|
|
53
|
+
readonly limit: number;
|
|
54
|
+
}): Promise<readonly DeliveredEntityRecord[]>;
|
|
55
|
+
backfill(input: {
|
|
56
|
+
readonly authorityId: string;
|
|
57
|
+
readonly entityId: string;
|
|
58
|
+
readonly afterGlobalSequence: number;
|
|
59
|
+
readonly throughGlobalSequence: number;
|
|
60
|
+
}): Promise<readonly DeliveredEntityRecord[]>;
|
|
61
|
+
onAvailable(listener: (signal: EntityRecordAvailability) => void): () => void;
|
|
62
|
+
onDisconnect(listener: (error: unknown) => void): () => void;
|
|
63
|
+
}
|
|
64
|
+
export interface EntityRecordSchedulePort {
|
|
65
|
+
schedule(delayMs: number, callback: () => void): {
|
|
66
|
+
cancel(): void;
|
|
67
|
+
};
|
|
68
|
+
random(): number;
|
|
69
|
+
}
|
|
70
|
+
export interface EntityRecordRailOptions {
|
|
71
|
+
readonly authorityId: string;
|
|
72
|
+
readonly store: EntityRecordStorePort;
|
|
73
|
+
readonly cargo: EntityRecordCargoPort;
|
|
74
|
+
readonly authority: EntityRecordAuthorityPort;
|
|
75
|
+
readonly schedule: EntityRecordSchedulePort;
|
|
76
|
+
/** Payload-free local doorbell emitted only after Receive commits Inbox truth. */
|
|
77
|
+
readonly onInboxCommitted?: () => void;
|
|
78
|
+
readonly onBackgroundError?: (error: unknown) => void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* One rail has only two reasons to run: local work exists, or authority work
|
|
82
|
+
* may exist. Repeated reasons coalesce while the current run is in flight.
|
|
83
|
+
*/
|
|
84
|
+
export declare class EntityRecordRail {
|
|
85
|
+
#private;
|
|
86
|
+
constructor(options: EntityRecordRailOptions);
|
|
87
|
+
/** Subscribe first, catch up from the durable cursor, then drain local work. */
|
|
88
|
+
start(): Promise<void>;
|
|
89
|
+
/** Record calls this only after its local outbox transaction commits. */
|
|
90
|
+
localRecordsAvailable(): void;
|
|
91
|
+
/** Await all work known at this boundary; it never creates an idle query. */
|
|
92
|
+
flush(): Promise<void>;
|
|
93
|
+
/** Stop accepting events. Closing the injected wire may interrupt a request. */
|
|
94
|
+
stop(): Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=rail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rail.d.ts","sourceRoot":"","sources":["../../src/records/rail.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAChD,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AACjD,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC,GAAG;IACrF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,C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