@amalgm/live 0.2.33 → 0.2.34
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/detection/echo.d.ts
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* real local change; unreadable truth is retried.
|
|
8
8
|
*/
|
|
9
9
|
import type { TruthReading } from './adapter-contract.js';
|
|
10
|
-
import type
|
|
10
|
+
import { type CloudEntityRecord } from '../entities/cloud.js';
|
|
11
|
+
import type { DetectedChangeProposal } from './record-proposal.js';
|
|
12
|
+
import type { AcceptedEntityRecord } from '../records/contracts.js';
|
|
11
13
|
export type EchoDecision = {
|
|
12
14
|
readonly kind: 'silence';
|
|
13
15
|
} | {
|
|
@@ -17,4 +19,17 @@ export type EchoDecision = {
|
|
|
17
19
|
readonly reason?: string | undefined;
|
|
18
20
|
};
|
|
19
21
|
export declare function echoDecision(notebook: Pick<CloudEntityRecord, 'status' | 'version' | 'transportVersion'>, observed: TruthReading): EchoDecision;
|
|
22
|
+
/**
|
|
23
|
+
* Detect may observe an authority result before Apply has advanced the local
|
|
24
|
+
* notebook through that accepted Inbox row. The observation is already
|
|
25
|
+
* globally ordered work when its complete result, replay, and immutable cargo
|
|
26
|
+
* are exact. Recording it again would create an outgoing echo solely because
|
|
27
|
+
* two local rails crossed in time.
|
|
28
|
+
*
|
|
29
|
+
* Lineage and facets are intentionally not compared: they describe how each
|
|
30
|
+
* observer reached the same complete result, while the filesystem rail is
|
|
31
|
+
* whole-result LWW. Different result bytes, address, type, lifecycle, replay,
|
|
32
|
+
* or repository identity transport still require a new local record.
|
|
33
|
+
*/
|
|
34
|
+
export declare function acceptedResultCoversDetection(accepted: AcceptedEntityRecord, proposal: DetectedChangeProposal): boolean;
|
|
20
35
|
//# 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,
|
|
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,EAAc,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,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;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,sBAAsB,GAC/B,OAAO,CAMT"}
|
package/dist/detection/echo.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* equality judgment: exact expected truth is silence; different truth is a
|
|
7
7
|
* real local change; unreadable truth is retried.
|
|
8
8
|
*/
|
|
9
|
+
import { stableJson } from '../entities/cloud.js';
|
|
9
10
|
export function echoDecision(notebook, observed) {
|
|
10
11
|
if (observed.truth === 'unsettled') {
|
|
11
12
|
return observed.reason === undefined
|
|
@@ -26,4 +27,23 @@ export function echoDecision(notebook, observed) {
|
|
|
26
27
|
}
|
|
27
28
|
return observed.truth === 'absent' ? { kind: 'silence' } : { kind: 'detect' };
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Detect may observe an authority result before Apply has advanced the local
|
|
32
|
+
* notebook through that accepted Inbox row. The observation is already
|
|
33
|
+
* globally ordered work when its complete result, replay, and immutable cargo
|
|
34
|
+
* are exact. Recording it again would create an outgoing echo solely because
|
|
35
|
+
* two local rails crossed in time.
|
|
36
|
+
*
|
|
37
|
+
* Lineage and facets are intentionally not compared: they describe how each
|
|
38
|
+
* observer reached the same complete result, while the filesystem rail is
|
|
39
|
+
* whole-result LWW. Different result bytes, address, type, lifecycle, replay,
|
|
40
|
+
* or repository identity transport still require a new local record.
|
|
41
|
+
*/
|
|
42
|
+
export function acceptedResultCoversDetection(accepted, proposal) {
|
|
43
|
+
return accepted.entityId === proposal.entityId
|
|
44
|
+
&& accepted.resultState === proposal.result.version
|
|
45
|
+
&& stableJson(accepted.change.result) === stableJson(proposal.result)
|
|
46
|
+
&& stableJson(accepted.change.replay) === stableJson(proposal.replay)
|
|
47
|
+
&& stableJson(accepted.change.cargo) === stableJson(proposal.cargo);
|
|
48
|
+
}
|
|
29
49
|
//# sourceMappingURL=echo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,EAA0B,MAAM,sBAAsB,CAAC;AAS1E,MAAM,UAAU,YAAY,CAC1B,QAA4E,EAC5E,QAAsB;IAEtB,IAAI,QAAQ,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,QAAQ,CAAC,MAAM,KAA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,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;WAClE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.echoDecision = echoDecision;
|
|
12
|
+
exports.acceptedResultCoversDetection = acceptedResultCoversDetection;
|
|
13
|
+
const cloud_js_1 = require("../entities/cloud.js");
|
|
12
14
|
function echoDecision(notebook, observed) {
|
|
13
15
|
if (observed.truth === 'unsettled') {
|
|
14
16
|
return observed.reason === undefined
|
|
@@ -29,4 +31,23 @@ function echoDecision(notebook, observed) {
|
|
|
29
31
|
}
|
|
30
32
|
return observed.truth === 'absent' ? { kind: 'silence' } : { kind: 'detect' };
|
|
31
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Detect may observe an authority result before Apply has advanced the local
|
|
36
|
+
* notebook through that accepted Inbox row. The observation is already
|
|
37
|
+
* globally ordered work when its complete result, replay, and immutable cargo
|
|
38
|
+
* are exact. Recording it again would create an outgoing echo solely because
|
|
39
|
+
* two local rails crossed in time.
|
|
40
|
+
*
|
|
41
|
+
* Lineage and facets are intentionally not compared: they describe how each
|
|
42
|
+
* observer reached the same complete result, while the filesystem rail is
|
|
43
|
+
* whole-result LWW. Different result bytes, address, type, lifecycle, replay,
|
|
44
|
+
* or repository identity transport still require a new local record.
|
|
45
|
+
*/
|
|
46
|
+
function acceptedResultCoversDetection(accepted, proposal) {
|
|
47
|
+
return accepted.entityId === proposal.entityId
|
|
48
|
+
&& accepted.resultState === proposal.result.version
|
|
49
|
+
&& (0, cloud_js_1.stableJson)(accepted.change.result) === (0, cloud_js_1.stableJson)(proposal.result)
|
|
50
|
+
&& (0, cloud_js_1.stableJson)(accepted.change.replay) === (0, cloud_js_1.stableJson)(proposal.replay)
|
|
51
|
+
&& (0, cloud_js_1.stableJson)(accepted.change.cargo) === (0, cloud_js_1.stableJson)(proposal.cargo);
|
|
52
|
+
}
|
|
32
53
|
//# sourceMappingURL=echo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;
|
|
1
|
+
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../src/detection/echo.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAYH,oCAsBC;AAcD,sEASC;AAtDD,mDAA0E;AAS1E,SAAgB,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;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,6BAA6B,CAC3C,QAA8B,EAC9B,QAAgC;IAEhC,OAAO,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;WACzC,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,MAAM,CAAC,OAAO;WAChD,IAAA,qBAAU,EAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAA,qBAAU,EAAC,QAAQ,CAAC,MAAM,CAAC;WAClE,IAAA,qBAAU,EAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAA,qBAAU,EAAC,QAAQ,CAAC,MAAM,CAAC;WAClE,IAAA,qBAAU,EAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAA,qBAAU,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amalgm/live",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
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",
|