@amalgm/live 0.2.54 → 0.2.56

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.
Files changed (88) hide show
  1. package/PURPOSE.md +6 -0
  2. package/dist/contracts/binding.d.ts +3 -2
  3. package/dist/contracts/binding.d.ts.map +1 -1
  4. package/dist/contracts/deployments.d.ts +39 -0
  5. package/dist/contracts/deployments.d.ts.map +1 -0
  6. package/dist/contracts/deployments.js +75 -0
  7. package/dist/contracts/deployments.js.map +1 -0
  8. package/dist/contracts/index.d.ts +1 -0
  9. package/dist/contracts/index.d.ts.map +1 -1
  10. package/dist/contracts/index.js +1 -0
  11. package/dist/contracts/index.js.map +1 -1
  12. package/dist/detection/adapter-contract.d.ts +0 -33
  13. package/dist/detection/adapter-contract.d.ts.map +1 -1
  14. package/dist/detection/adapter-contract.js +0 -32
  15. package/dist/detection/adapter-contract.js.map +1 -1
  16. package/dist/detection/diff.d.ts +5 -87
  17. package/dist/detection/diff.d.ts.map +1 -1
  18. package/dist/detection/diff.js +5 -111
  19. package/dist/detection/diff.js.map +1 -1
  20. package/dist/detection/enrollment.d.ts +8 -17
  21. package/dist/detection/enrollment.d.ts.map +1 -1
  22. package/dist/detection/enrollment.js +8 -73
  23. package/dist/detection/enrollment.js.map +1 -1
  24. package/dist/detection/index.d.ts +5 -8
  25. package/dist/detection/index.d.ts.map +1 -1
  26. package/dist/detection/index.js +5 -8
  27. package/dist/detection/index.js.map +1 -1
  28. package/dist/detection/territory.d.ts +1 -27
  29. package/dist/detection/territory.d.ts.map +1 -1
  30. package/dist/detection/territory.js +1 -77
  31. package/dist/detection/territory.js.map +1 -1
  32. package/dist/transfer/cargo.d.ts +46 -12
  33. package/dist/transfer/cargo.d.ts.map +1 -1
  34. package/dist/transfer/cargo.js +52 -18
  35. package/dist/transfer/cargo.js.map +1 -1
  36. package/dist/transfer/download.d.ts +8 -6
  37. package/dist/transfer/download.d.ts.map +1 -1
  38. package/dist/transfer/download.js +8 -6
  39. package/dist/transfer/download.js.map +1 -1
  40. package/dist/transfer/index.d.ts +2 -1
  41. package/dist/transfer/index.d.ts.map +1 -1
  42. package/dist/transfer/index.js +2 -1
  43. package/dist/transfer/index.js.map +1 -1
  44. package/dist/transfer/ranges.d.ts +43 -0
  45. package/dist/transfer/ranges.d.ts.map +1 -0
  46. package/dist/transfer/ranges.js +109 -0
  47. package/dist/transfer/ranges.js.map +1 -0
  48. package/dist/transfer/refs.d.ts +35 -0
  49. package/dist/transfer/refs.d.ts.map +1 -0
  50. package/dist/transfer/refs.js +45 -0
  51. package/dist/transfer/refs.js.map +1 -0
  52. package/dist-cjs/contracts/deployments.js +81 -0
  53. package/dist-cjs/contracts/deployments.js.map +1 -0
  54. package/dist-cjs/contracts/index.js +1 -0
  55. package/dist-cjs/contracts/index.js.map +1 -1
  56. package/dist-cjs/detection/adapter-contract.js +1 -34
  57. package/dist-cjs/detection/adapter-contract.js.map +1 -1
  58. package/dist-cjs/detection/diff.js +5 -113
  59. package/dist-cjs/detection/diff.js.map +1 -1
  60. package/dist-cjs/detection/enrollment.js +9 -75
  61. package/dist-cjs/detection/enrollment.js.map +1 -1
  62. package/dist-cjs/detection/index.js +5 -8
  63. package/dist-cjs/detection/index.js.map +1 -1
  64. package/dist-cjs/detection/territory.js +1 -79
  65. package/dist-cjs/detection/territory.js.map +1 -1
  66. package/dist-cjs/transfer/cargo.js +55 -20
  67. package/dist-cjs/transfer/cargo.js.map +1 -1
  68. package/dist-cjs/transfer/download.js +8 -6
  69. package/dist-cjs/transfer/download.js.map +1 -1
  70. package/dist-cjs/transfer/index.js +2 -1
  71. package/dist-cjs/transfer/index.js.map +1 -1
  72. package/dist-cjs/transfer/ranges.js +114 -0
  73. package/dist-cjs/transfer/ranges.js.map +1 -0
  74. package/dist-cjs/transfer/refs.js +49 -0
  75. package/dist-cjs/transfer/refs.js.map +1 -0
  76. package/package.json +2 -2
  77. package/dist/detection/continuity.d.ts +0 -54
  78. package/dist/detection/continuity.d.ts.map +0 -1
  79. package/dist/detection/continuity.js +0 -85
  80. package/dist/detection/continuity.js.map +0 -1
  81. package/dist/transfer/presign.d.ts +0 -26
  82. package/dist/transfer/presign.d.ts.map +0 -1
  83. package/dist/transfer/presign.js +0 -44
  84. package/dist/transfer/presign.js.map +0 -1
  85. package/dist-cjs/detection/continuity.js +0 -88
  86. package/dist-cjs/detection/continuity.js.map +0 -1
  87. package/dist-cjs/transfer/presign.js +0 -48
  88. package/dist-cjs/transfer/presign.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/live",
3
- "version": "0.2.54",
3
+ "version": "0.2.56",
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",
@@ -94,7 +94,7 @@
94
94
  "certification:smoke": "node certification/src/release.mjs prepare --profile smoke --amalgm-version latest",
95
95
  "certification:release": "node certification/src/release.mjs prepare --profile certification",
96
96
  "certification:preflight": "node certification/src/release.mjs preflight",
97
- "test": "npm run build && node --test tests/",
97
+ "test": "npm run build && node --test",
98
98
  "test:parity": "npm run build && node --test tests/parity/"
99
99
  },
100
100
  "devDependencies": {
@@ -1,54 +0,0 @@
1
- /**
2
- * Root continuity verdicts: what a root's WITNESSED physical identity
3
- * is, whether its recorded address still holds its ground, and whether
4
- * a piece of ground rescues a moved root. Ratified by entity-model.md
5
- * ("Ground that moves is rescued by continuity" — the directory law
6
- * lifted to roots; "the follow rides witnessed continuity, never
7
- * clairvoyance").
8
- *
9
- * Pure verdicts over injected answers — the host supplies the one look
10
- * at an address (`statAt`) and the store's witnessed channel row
11
- * (`channelIdentity`); the ACTIONS a verdict triggers (rebind, presence
12
- * transitions, the undecided-address decision) stay in the host's
13
- * wiring, because they re-aim watchers and scans.
14
- */
15
- import type { PhysicalIdentity } from './diff.js';
16
- import type { RootKind } from '../watching/coverage.js';
17
- /** What one look at an address found standing there. */
18
- export type GroundKind = 'file' | 'dir' | 'link' | 'other';
19
- export interface GroundStat extends PhysicalIdentity {
20
- readonly kind: GroundKind;
21
- }
22
- export interface ContinuityRoot {
23
- readonly rootId: string;
24
- readonly path: string;
25
- readonly kind: RootKind;
26
- /** Directory roots: the root's own witnessed identity; null/absent when unwitnessed. */
27
- readonly device?: number | null;
28
- readonly inode?: number | null;
29
- }
30
- export interface ContinuityPorts {
31
- /**
32
- * One look at an address: the ground's physical identity and kind, or
33
- * null when the look did not return ground. ANY failed look answers
34
- * null here — at the evidence horizon's edge, "could not look" and
35
- * "not there" both leave the address undecided, so this seam never
36
- * needs the absent/unsettled split.
37
- */
38
- readonly statAt: (path: string) => GroundStat | null;
39
- /**
40
- * A single-ground root's one channel row identity — current as of the
41
- * last completed scan — or null when unwitnessed. The file laws
42
- * absorb atomic-save and retarget churn each time a scan witnesses
43
- * the ground, and continuity can only ever claim what a scan has
44
- * witnessed.
45
- */
46
- readonly channelIdentity: (rootId: string) => PhysicalIdentity | null;
47
- }
48
- export interface ContinuityVerdicts {
49
- readonly rootIdentity: (root: ContinuityRoot) => PhysicalIdentity | null;
50
- readonly findMovedRoot: (stat: GroundStat, roots: readonly ContinuityRoot[]) => ContinuityRoot | null;
51
- readonly addressUndecided: (root: ContinuityRoot) => boolean;
52
- }
53
- export declare function createContinuity({ statAt, channelIdentity }: ContinuityPorts): ContinuityVerdicts;
54
- //# sourceMappingURL=continuity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"continuity.d.ts","sourceRoot":"","sources":["../../src/detection/continuity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,wFAAwF;IACxF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,CAAC;IACrD;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,gBAAgB,GAAG,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,gBAAgB,GAAG,IAAI,CAAC;IACzE,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,cAAc,EAAE,KAAK,cAAc,GAAG,IAAI,CAAC;IACtG,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC;CAC9D;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,eAAe,GAAG,kBAAkB,CAmEjG"}
@@ -1,85 +0,0 @@
1
- /**
2
- * Root continuity verdicts: what a root's WITNESSED physical identity
3
- * is, whether its recorded address still holds its ground, and whether
4
- * a piece of ground rescues a moved root. Ratified by entity-model.md
5
- * ("Ground that moves is rescued by continuity" — the directory law
6
- * lifted to roots; "the follow rides witnessed continuity, never
7
- * clairvoyance").
8
- *
9
- * Pure verdicts over injected answers — the host supplies the one look
10
- * at an address (`statAt`) and the store's witnessed channel row
11
- * (`channelIdentity`); the ACTIONS a verdict triggers (rebind, presence
12
- * transitions, the undecided-address decision) stay in the host's
13
- * wiring, because they re-aim watchers and scans.
14
- */
15
- export function createContinuity({ statAt, channelIdentity }) {
16
- /**
17
- * A root's WITNESSED physical identity, for continuity rescue.
18
- * Directory roots carry their own device:inode (nothing replaces a
19
- * directory's inode in place). A single-ground root's identity lives
20
- * in its one channel row. Ground that changed inodes inside a
21
- * still-open settle window is unwitnessed — no evidence, no claim.
22
- */
23
- function rootIdentity(root) {
24
- if (root.kind !== 'file') {
25
- const { device, inode } = root;
26
- return device == null || inode == null ? null : { device, inode };
27
- }
28
- return channelIdentity(root.rootId);
29
- }
30
- /** Orphaned means the recorded address no longer holds this ground. */
31
- function orphanedAtAddress(root) {
32
- const identity = rootIdentity(root);
33
- if (!identity)
34
- return false;
35
- const stat = statAt(root.path);
36
- if (!stat)
37
- return true;
38
- return stat.device !== identity.device || stat.inode !== identity.inode;
39
- }
40
- /**
41
- * Continuity claims a root exactly like it claims the directories
42
- * inside one: unique device:inode match, exactly one candidate, and
43
- * only for a path-orphan — a root whose recorded address still holds
44
- * its ground is never stolen by a lookalike.
45
- */
46
- function findMovedRoot(stat, roots) {
47
- const wantDir = stat.kind === 'dir';
48
- const matches = roots.filter((root) => {
49
- if (wantDir !== (root.kind !== 'file'))
50
- return false;
51
- const identity = rootIdentity(root);
52
- return identity !== null && identity.device === stat.device && identity.inode === stat.inode;
53
- });
54
- const only = matches.length === 1 ? matches[0] : null;
55
- return only && orphanedAtAddress(only) ? only : null;
56
- }
57
- /**
58
- * A scan's evidence horizon is the root's ground; the root's own
59
- * address is the horizon's edge. Ground missing there — or a
60
- * directory root's address wearing a different physical identity — is
61
- * UNDECIDABLE from here: moved away, deleted, or replaced by a
62
- * lookalike all present the same address, and concluding "deleted"
63
- * would end every channel a rescue could have saved. So the scan
64
- * concludes nothing: beliefs freeze, the referee convicts the
65
- * divergence, and the next enrollment moment decides — naming the new
66
- * address rescues, re-naming this one adopts, and explicit removal is
67
- * the only deletion (an external filesystem change is never
68
- * permission to end identity). A single-ground root's address
69
- * lawfully churns inodes (atomic saves, retargets), so only absence —
70
- * or foreign directory ground — freezes it; presence is the file
71
- * laws' business.
72
- */
73
- function addressUndecided(root) {
74
- const stat = statAt(root.path);
75
- if (!stat)
76
- return true;
77
- if (root.kind === 'file')
78
- return stat.kind !== 'file' && stat.kind !== 'link';
79
- if (stat.kind !== 'dir')
80
- return true;
81
- return root.device != null && (stat.device !== root.device || stat.inode !== root.inode);
82
- }
83
- return { rootIdentity, findMovedRoot, addressUndecided };
84
- }
85
- //# sourceMappingURL=continuity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"continuity.js","sourceRoot":"","sources":["../../src/detection/continuity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA8CH,MAAM,UAAU,gBAAgB,CAAC,EAAE,MAAM,EAAE,eAAe,EAAmB;IAC3E;;;;;;OAMG;IACH,SAAS,YAAY,CAAC,IAAoB;QACxC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;YAC/B,OAAO,MAAM,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QACpE,CAAC;QACD,OAAO,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED,uEAAuE;IACvE,SAAS,iBAAiB,CAAC,IAAoB;QAC7C,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,I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C;QAC9E,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK;YAAE,OAAO,IAAI,CAAC;QACrC,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3F,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AAC3D,CAAC"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Presigned-URL brokering for direct content-storage fetches.
3
- *
4
- * Downloads fetch every storage object straight from content storage using
5
- * short-lived URLs the gateway signs. Callers ask for one object's URL at a
6
- * time; the broker coalesces every request made in the same event-loop turn
7
- * into one batched signing call, so thousands of tiny fetches cost a handful
8
- * of control-plane round trips. URLs are used immediately and never cached —
9
- * their expiry is the gateway's revocation lever.
10
- */
11
- /** One law shared with the gateway: the most objects one signing call may name. */
12
- export declare const PRESIGN_BATCH_OBJECTS = 2048;
13
- export interface PresignObject {
14
- /** 'manifest' names a whole artifact by content hash; 'block' one chunk by its sha256. */
15
- readonly kind: 'manifest' | 'block';
16
- readonly sha256: string;
17
- }
18
- export interface PresignBrokerPorts {
19
- /** Sign every named object, returning URLs aligned by index. */
20
- requestUrls(objects: readonly PresignObject[]): Promise<readonly string[]>;
21
- }
22
- export interface PresignBroker {
23
- url(object: PresignObject): Promise<string>;
24
- }
25
- export declare function createPresignBroker(ports: PresignBrokerPorts): PresignBroker;
26
- //# sourceMappingURL=presign.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"presign.d.ts","sourceRoot":"","sources":["../../src/transfer/presign.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,MAAM,WAAW,aAAa;IAC5B,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,WAAW,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CAC5E;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C;AAQD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,aAAa,CA+B5E"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Presigned-URL brokering for direct content-storage fetches.
3
- *
4
- * Downloads fetch every storage object straight from content storage using
5
- * short-lived URLs the gateway signs. Callers ask for one object's URL at a
6
- * time; the broker coalesces every request made in the same event-loop turn
7
- * into one batched signing call, so thousands of tiny fetches cost a handful
8
- * of control-plane round trips. URLs are used immediately and never cached —
9
- * their expiry is the gateway's revocation lever.
10
- */
11
- /** One law shared with the gateway: the most objects one signing call may name. */
12
- export const PRESIGN_BATCH_OBJECTS = 2048;
13
- export function createPresignBroker(ports) {
14
- let pending = [];
15
- let scheduled = false;
16
- const flush = async () => {
17
- scheduled = false;
18
- while (pending.length > 0) {
19
- const batch = pending.splice(0, PRESIGN_BATCH_OBJECTS);
20
- try {
21
- const urls = await ports.requestUrls(batch.map((waiter) => waiter.object));
22
- if (urls.length !== batch.length) {
23
- throw new Error('presign returned the wrong number of urls');
24
- }
25
- batch.forEach((waiter, index) => waiter.resolve(urls[index]));
26
- }
27
- catch (error) {
28
- batch.forEach((waiter) => waiter.reject(error));
29
- }
30
- }
31
- };
32
- return {
33
- url(object) {
34
- return new Promise((resolve, reject) => {
35
- pending.push({ object, resolve, reject });
36
- if (!scheduled) {
37
- scheduled = true;
38
- setTimeout(() => { void flush(); }, 0);
39
- }
40
- });
41
- },
42
- };
43
- }
44
- //# sourceMappingURL=presign.js.map
@@ -1 +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CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC1C,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,SAAS,GAAG,IAAI,CAAC;oBACjB,UAAU,CAAC,GAAG,EAAE,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,88 +0,0 @@
1
- "use strict";
2
- /**
3
- * Root continuity verdicts: what a root's WITNESSED physical identity
4
- * is, whether its recorded address still holds its ground, and whether
5
- * a piece of ground rescues a moved root. Ratified by entity-model.md
6
- * ("Ground that moves is rescued by continuity" — the directory law
7
- * lifted to roots; "the follow rides witnessed continuity, never
8
- * clairvoyance").
9
- *
10
- * Pure verdicts over injected answers — the host supplies the one look
11
- * at an address (`statAt`) and the store's witnessed channel row
12
- * (`channelIdentity`); the ACTIONS a verdict triggers (rebind, presence
13
- * transitions, the undecided-address decision) stay in the host's
14
- * wiring, because they re-aim watchers and scans.
15
- */
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createContinuity = createContinuity;
18
- function createContinuity({ statAt, channelIdentity }) {
19
- /**
20
- * A root's WITNESSED physical identity, for continuity rescue.
21
- * Directory roots carry their own device:inode (nothing replaces a
22
- * directory's inode in place). A single-ground root's identity lives
23
- * in its one channel row. Ground that changed inodes inside a
24
- * still-open settle window is unwitnessed — no evidence, no claim.
25
- */
26
- function rootIdentity(root) {
27
- if (root.kind !== 'file') {
28
- const { device, inode } = root;
29
- return device == null || inode == null ? null : { device, inode };
30
- }
31
- return channelIdentity(root.rootId);
32
- }
33
- /** Orphaned means the recorded address no longer holds this ground. */
34
- function orphanedAtAddress(root) {
35
- const identity = rootIdentity(root);
36
- if (!identity)
37
- return false;
38
- const stat = statAt(root.path);
39
- if (!stat)
40
- return true;
41
- return stat.device !== identity.device || stat.inode !== identity.inode;
42
- }
43
- /**
44
- * Continuity claims a root exactly like it claims the directories
45
- * inside one: unique device:inode match, exactly one candidate, and
46
- * only for a path-orphan — a root whose recorded address still holds
47
- * its ground is never stolen by a lookalike.
48
- */
49
- function findMovedRoot(stat, roots) {
50
- const wantDir = stat.kind === 'dir';
51
- const matches = roots.filter((root) => {
52
- if (wantDir !== (root.kind !== 'file'))
53
- return false;
54
- const identity = rootIdentity(root);
55
- return identity !== null && identity.device === stat.device && identity.inode === stat.inode;
56
- });
57
- const only = matches.length === 1 ? matches[0] : null;
58
- return only && orphanedAtAddress(only) ? only : null;
59
- }
60
- /**
61
- * A scan's evidence horizon is the root's ground; the root's own
62
- * address is the horizon's edge. Ground missing there — or a
63
- * directory root's address wearing a different physical identity — is
64
- * UNDECIDABLE from here: moved away, deleted, or replaced by a
65
- * lookalike all present the same address, and concluding "deleted"
66
- * would end every channel a rescue could have saved. So the scan
67
- * concludes nothing: beliefs freeze, the referee convicts the
68
- * divergence, and the next enrollment moment decides — naming the new
69
- * address rescues, re-naming this one adopts, and explicit removal is
70
- * the only deletion (an external filesystem change is never
71
- * permission to end identity). A single-ground root's address
72
- * lawfully churns inodes (atomic saves, retargets), so only absence —
73
- * or foreign directory ground — freezes it; presence is the file
74
- * laws' business.
75
- */
76
- function addressUndecided(root) {
77
- const stat = statAt(root.path);
78
- if (!stat)
79
- return true;
80
- if (root.kind === 'file')
81
- return stat.kind !== 'file' && stat.kind !== 'link';
82
- if (stat.kind !== 'dir')
83
- return true;
84
- return root.device != null && (stat.device !== root.device || stat.inode !== root.inode);
85
- }
86
- return { rootIdentity, findMovedRoot, addressUndecided };
87
- }
88
- //# sourceMappingURL=continuity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"continuity.js","sourceRoot":"","sources":["../../src/detection/continuity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AA8CH,4CAmEC;AAnED,SAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,eAAe,EAA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,KAAK,CAAC;QAC/F,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACvD,OAAO,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAS,gBAAgB,CAAC,IAAoB;QAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;QAC9E,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK;YAAE,OAAO,IAAI,CAAC;QACrC,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3F,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AAC3D,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- /**
3
- * Presigned-URL brokering for direct content-storage fetches.
4
- *
5
- * Downloads fetch every storage object straight from content storage using
6
- * short-lived URLs the gateway signs. Callers ask for one object's URL at a
7
- * time; the broker coalesces every request made in the same event-loop turn
8
- * into one batched signing call, so thousands of tiny fetches cost a handful
9
- * of control-plane round trips. URLs are used immediately and never cached —
10
- * their expiry is the gateway's revocation lever.
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.PRESIGN_BATCH_OBJECTS = void 0;
14
- exports.createPresignBroker = createPresignBroker;
15
- /** One law shared with the gateway: the most objects one signing call may name. */
16
- exports.PRESIGN_BATCH_OBJECTS = 2048;
17
- function createPresignBroker(ports) {
18
- let pending = [];
19
- let scheduled = false;
20
- const flush = async () => {
21
- scheduled = false;
22
- while (pending.length > 0) {
23
- const batch = pending.splice(0, exports.PRESIGN_BATCH_OBJECTS);
24
- try {
25
- const urls = await ports.requestUrls(batch.map((waiter) => waiter.object));
26
- if (urls.length !== batch.length) {
27
- throw new Error('presign returned the wrong number of urls');
28
- }
29
- batch.forEach((waiter, index) => waiter.resolve(urls[index]));
30
- }
31
- catch (error) {
32
- batch.forEach((waiter) => waiter.reject(error));
33
- }
34
- }
35
- };
36
- return {
37
- url(object) {
38
- return new Promise((resolve, reject) => {
39
- pending.push({ object, resolve, reject });
40
- if (!scheduled) {
41
- scheduled = true;
42
- setTimeout(() => { void flush(); }, 0);
43
- }
44
- });
45
- },
46
- };
47
- }
48
- //# sourceMappingURL=presign.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"presign.js","sourceRoot":"","sources":["../../src/transfer/presign.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AA0BH,kDA+BC;AAvDD,mFAAmF;AACtE,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAuB1C,SAAgB,mBAAmB,CAAC,KAAyB;IAC3D,IAAI,OAAO,GAAa,EAAE,CAAC;IAC3B,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,MAAM,KAAK,GAAG,KAAK,IAAmB,EAAE;QACtC,SAAS,GAAG,KAAK,CAAC;QAClB,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,6BAAqB,CAAC,CAAC;YACvD,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM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