@opendatalabs/personal-server-ts-lite 0.0.1-canary.052d47e → 0.0.1-canary.0620a9a

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 (124) hide show
  1. package/dist/additions-crypto.d.ts +3 -0
  2. package/dist/additions-crypto.d.ts.map +1 -0
  3. package/dist/additions-crypto.js +42 -0
  4. package/dist/additions-crypto.js.map +1 -0
  5. package/dist/additions-protocol.d.ts +56 -0
  6. package/dist/additions-protocol.d.ts.map +1 -0
  7. package/dist/additions-protocol.js +17 -0
  8. package/dist/additions-protocol.js.map +1 -0
  9. package/dist/additions-session.d.ts +20 -0
  10. package/dist/additions-session.d.ts.map +1 -0
  11. package/dist/additions-session.js +215 -0
  12. package/dist/additions-session.js.map +1 -0
  13. package/dist/additions-transport.d.ts +72 -0
  14. package/dist/additions-transport.d.ts.map +1 -0
  15. package/dist/additions-transport.js +428 -0
  16. package/dist/additions-transport.js.map +1 -0
  17. package/dist/additions-worker.bundle.js +31161 -0
  18. package/dist/additions-worker.d.ts +2 -0
  19. package/dist/additions-worker.d.ts.map +1 -0
  20. package/dist/additions-worker.js +308 -0
  21. package/dist/additions-worker.js.map +1 -0
  22. package/dist/browser-runtime.d.ts +54 -0
  23. package/dist/browser-runtime.d.ts.map +1 -1
  24. package/dist/browser-runtime.js +69 -3
  25. package/dist/browser-runtime.js.map +1 -1
  26. package/dist/canonical-persistence.d.ts +53 -0
  27. package/dist/canonical-persistence.d.ts.map +1 -0
  28. package/dist/canonical-persistence.js +13 -0
  29. package/dist/canonical-persistence.js.map +1 -0
  30. package/dist/canonical-store.d.ts +395 -0
  31. package/dist/canonical-store.d.ts.map +1 -0
  32. package/dist/canonical-store.js +1807 -0
  33. package/dist/canonical-store.js.map +1 -0
  34. package/dist/client.d.ts +7 -1
  35. package/dist/client.d.ts.map +1 -1
  36. package/dist/client.js +155 -1
  37. package/dist/client.js.map +1 -1
  38. package/dist/derivatives.d.ts.map +1 -1
  39. package/dist/derivatives.js +4 -2
  40. package/dist/derivatives.js.map +1 -1
  41. package/dist/diagnostics.d.ts +3 -0
  42. package/dist/diagnostics.d.ts.map +1 -1
  43. package/dist/diagnostics.js +9 -1
  44. package/dist/diagnostics.js.map +1 -1
  45. package/dist/history-probe-worker.bundle.js +31241 -0
  46. package/dist/history-probe.worker.d.ts +35 -0
  47. package/dist/history-probe.worker.d.ts.map +1 -0
  48. package/dist/history-probe.worker.js +160 -0
  49. package/dist/history-probe.worker.js.map +1 -0
  50. package/dist/index.d.ts +13 -2
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +11 -0
  53. package/dist/index.js.map +1 -1
  54. package/dist/mcp-store.d.ts +1 -1
  55. package/dist/mcp-store.d.ts.map +1 -1
  56. package/dist/mcp-store.js +140 -15
  57. package/dist/mcp-store.js.map +1 -1
  58. package/dist/oura-import.d.ts +2 -0
  59. package/dist/oura-import.d.ts.map +1 -0
  60. package/dist/oura-import.js +3 -0
  61. package/dist/oura-import.js.map +1 -0
  62. package/dist/relay-tls.d.ts.map +1 -1
  63. package/dist/relay-tls.js +10 -0
  64. package/dist/relay-tls.js.map +1 -1
  65. package/dist/relay.d.ts +2 -2
  66. package/dist/relay.d.ts.map +1 -1
  67. package/dist/relay.js +118 -55
  68. package/dist/relay.js.map +1 -1
  69. package/dist/replication-coordinator-state.d.ts +19 -0
  70. package/dist/replication-coordinator-state.d.ts.map +1 -0
  71. package/dist/replication-coordinator-state.js +20 -0
  72. package/dist/replication-coordinator-state.js.map +1 -0
  73. package/dist/replication-door.d.ts +17 -0
  74. package/dist/replication-door.d.ts.map +1 -0
  75. package/dist/replication-door.js +23 -0
  76. package/dist/replication-door.js.map +1 -0
  77. package/dist/replication-engine.d.ts +49 -0
  78. package/dist/replication-engine.d.ts.map +1 -0
  79. package/dist/replication-engine.js +589 -0
  80. package/dist/replication-engine.js.map +1 -0
  81. package/dist/replication-host.d.ts +92 -0
  82. package/dist/replication-host.d.ts.map +1 -0
  83. package/dist/replication-host.js +135 -0
  84. package/dist/replication-host.js.map +1 -0
  85. package/dist/replication-ports.d.ts +194 -0
  86. package/dist/replication-ports.d.ts.map +1 -0
  87. package/dist/replication-ports.js +58 -0
  88. package/dist/replication-ports.js.map +1 -0
  89. package/dist/replication-runtime.d.ts +64 -0
  90. package/dist/replication-runtime.d.ts.map +1 -0
  91. package/dist/replication-runtime.js +79 -0
  92. package/dist/replication-runtime.js.map +1 -0
  93. package/dist/replication-storage.d.ts +42 -0
  94. package/dist/replication-storage.d.ts.map +1 -0
  95. package/dist/replication-storage.js +173 -0
  96. package/dist/replication-storage.js.map +1 -0
  97. package/dist/runtime.d.ts +57 -5
  98. package/dist/runtime.d.ts.map +1 -1
  99. package/dist/runtime.js +287 -36
  100. package/dist/runtime.js.map +1 -1
  101. package/dist/state.d.ts +8 -1
  102. package/dist/state.d.ts.map +1 -1
  103. package/dist/state.js +84 -20
  104. package/dist/state.js.map +1 -1
  105. package/dist/storage-utils.d.ts.map +1 -1
  106. package/dist/storage-utils.js +10 -2
  107. package/dist/storage-utils.js.map +1 -1
  108. package/dist/storage.d.ts +33 -0
  109. package/dist/storage.d.ts.map +1 -1
  110. package/dist/storage.js +465 -131
  111. package/dist/storage.js.map +1 -1
  112. package/dist/stream-sync-files.d.ts +54 -0
  113. package/dist/stream-sync-files.d.ts.map +1 -0
  114. package/dist/stream-sync-files.js +316 -0
  115. package/dist/stream-sync-files.js.map +1 -0
  116. package/dist/stream-sync-read-cache-files.d.ts +5 -0
  117. package/dist/stream-sync-read-cache-files.d.ts.map +1 -0
  118. package/dist/stream-sync-read-cache-files.js +19 -0
  119. package/dist/stream-sync-read-cache-files.js.map +1 -0
  120. package/dist/sync.d.ts +62 -1
  121. package/dist/sync.d.ts.map +1 -1
  122. package/dist/sync.js +261 -61
  123. package/dist/sync.js.map +1 -1
  124. package/package.json +12 -5
@@ -0,0 +1,53 @@
1
+ import type { ReplicaOperation } from "@opendatalabs/personal-server-ts-core/replication/envelope";
2
+ export type LiteBlobDescriptor = Extract<ReplicaOperation, {
3
+ kind: "blob-claim";
4
+ }>["blob"];
5
+ declare const liteStagingIdBrand: unique symbol;
6
+ export type LiteStagingId = string & {
7
+ readonly [liteStagingIdBrand]: true;
8
+ };
9
+ export interface LiteStorageEntry {
10
+ key: string;
11
+ value: string;
12
+ }
13
+ export interface LiteStoragePage {
14
+ entries: LiteStorageEntry[];
15
+ after?: string;
16
+ }
17
+ /** One serializable, owner-partitioned SQLite transaction. No await escapes its lifetime. */
18
+ export interface LiteCanonicalTransaction {
19
+ get(key: string): Promise<string | undefined>;
20
+ put(key: string, value: string): Promise<void>;
21
+ delete(key: string): Promise<void>;
22
+ /** Exclusive bytewise key cursor; snapshot stable for this transaction. */
23
+ scan(prefix: string, after?: string): Promise<LiteStoragePage>;
24
+ /** Verify staged length/hash/MIME and publish its immutable reference in THIS transaction. */
25
+ attachBlob(stagingId: LiteStagingId, expected: LiteBlobDescriptor): Promise<void>;
26
+ blob(blobId: string): Promise<LiteBlobDescriptor | undefined>;
27
+ }
28
+ /** The largest canonical value the native store keeps, in UTF-8 bytes. */
29
+ export declare const LITE_CANONICAL_MAX_VALUE_BYTES: number;
30
+ /**
31
+ * The largest operation the store keeps: it retains each operation, and the
32
+ * row it decides, as one native value. The margin covers the row's fields
33
+ * beside the record data. A received larger operation is held as
34
+ * `resource_unsupported` (core `maxOperationBytes`); a build that raises this
35
+ * bound must also raise core `REPLICA_LIMITS_VERSION` so held batches return.
36
+ */
37
+ export declare const LITE_CANONICAL_MAX_OPERATION_BYTES: number;
38
+ /** A local batch: the caller splits larger writes at record boundaries. */
39
+ export declare const LITE_CANONICAL_BATCH_BYTES: number;
40
+ /**
41
+ * Slice 7b implements this over PsNativeStore, not browser storage. Each scan is
42
+ * <=100 entries and <=512 KiB; individual values <=LITE_CANONICAL_MAX_VALUE_BYTES. An oversized entry
43
+ * throws, never truncates. Roll back on callback error, bridge loss or host kill.
44
+ */
45
+ export interface LiteCanonicalPersistence {
46
+ transaction<T>(run: (tx: LiteCanonicalTransaction) => Promise<T>): Promise<T>;
47
+ /** Backpressured <=128 KiB frames. Final hash is computed natively, not trusted from JS. */
48
+ stageBlob(descriptor: LiteBlobDescriptor, chunks: AsyncIterable<Uint8Array>): Promise<LiteStagingId>;
49
+ /** Internal bytes, not a grant-authorized read API. Missing/uncommitted blobs throw. */
50
+ readBlob(blobId: string): AsyncIterable<Uint8Array>;
51
+ }
52
+ export {};
53
+ //# sourceMappingURL=canonical-persistence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-persistence.d.ts","sourceRoot":"","sources":["../src/canonical-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAEnG,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,gBAAgB,EAChB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CACvB,CAAC,MAAM,CAAC,CAAC;AACV,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC;AAChD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IACnC,QAAQ,CAAC,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC;CACrC,CAAC;AACF,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,6FAA6F;AAC7F,MAAM,WAAW,wBAAwB;IACvC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,2EAA2E;IAC3E,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/D,8FAA8F;IAC9F,UAAU,CACR,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;CAC/D;AAED,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,QAAa,CAAC;AACzD;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,QACJ,CAAC;AAC5C,2EAA2E;AAC3E,eAAO,MAAM,0BAA0B,QAAa,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,wBAAwB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9E,4FAA4F;IAC5F,SAAS,CACP,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAChC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1B,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;CACrD"}
@@ -0,0 +1,13 @@
1
+ /** The largest canonical value the native store keeps, in UTF-8 bytes. */
2
+ export const LITE_CANONICAL_MAX_VALUE_BYTES = 256 * 1024;
3
+ /**
4
+ * The largest operation the store keeps: it retains each operation, and the
5
+ * row it decides, as one native value. The margin covers the row's fields
6
+ * beside the record data. A received larger operation is held as
7
+ * `resource_unsupported` (core `maxOperationBytes`); a build that raises this
8
+ * bound must also raise core `REPLICA_LIMITS_VERSION` so held batches return.
9
+ */
10
+ export const LITE_CANONICAL_MAX_OPERATION_BYTES = LITE_CANONICAL_MAX_VALUE_BYTES - 8 * 1024;
11
+ /** A local batch: the caller splits larger writes at record boundaries. */
12
+ export const LITE_CANONICAL_BATCH_BYTES = 192 * 1024;
13
+ //# sourceMappingURL=canonical-persistence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-persistence.js","sourceRoot":"","sources":["../src/canonical-persistence.ts"],"names":[],"mappings":"AAkCA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,GAAG,IAAI,CAAC;AACzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAC7C,8BAA8B,GAAG,CAAC,GAAG,IAAI,CAAC;AAC5C,2EAA2E;AAC3E,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,GAAG,IAAI,CAAC"}
@@ -0,0 +1,395 @@
1
+ import { type ReplicaOperation } from "@opendatalabs/personal-server-ts-core/replication/envelope";
2
+ import { type MergeContext } from "@opendatalabs/personal-server-ts-core/replication/merge-plan";
3
+ import { type PdppRecordRow } from "@opendatalabs/personal-server-ts-core/storage/pdpp-records/portable";
4
+ import { type CompletionOperation } from "@opendatalabs/personal-server-ts-core/replication/completion";
5
+ import { type ReplicaReader, type ReplicaVisibilityPolicy } from "@opendatalabs/personal-server-ts-core/replication/visibility-policy";
6
+ import { type LiteCanonicalPersistence, type LiteBlobDescriptor, type LiteStagingId } from "./canonical-persistence.js";
7
+ /**
8
+ * A refusal that the batch's content or the store's immutable state decides:
9
+ * the same input fails the same way on every retry. A replica import that
10
+ * throws it stops retrying (`ReplicaCopyRefused` on the engine host).
11
+ */
12
+ export declare class LiteCanonicalRefusal extends Error {
13
+ readonly reason: "batch_too_large" | "operation_too_large" | "wrong_owner" | "connection_binding_mismatch" | "partition_too_large" | "commit_id_reused" | "blob_metadata_conflict";
14
+ readonly code = "lite_canonical_refused";
15
+ constructor(reason: "batch_too_large" | "operation_too_large" | "wrong_owner" | "connection_binding_mismatch" | "partition_too_large" | "commit_id_reused" | "blob_metadata_conflict", message: string);
16
+ }
17
+ export type LiteOperationDraft = ReplicaOperation extends infer T ? T extends ReplicaOperation ? Omit<T, "revision"> : never : never;
18
+ interface Connection {
19
+ sourceId: string;
20
+ methodId: string;
21
+ }
22
+ export interface LiteCommitReceipt {
23
+ sequence: number;
24
+ operationCount: number;
25
+ }
26
+ export interface LiteReplicaReadOptions {
27
+ reader?: ReplicaReader;
28
+ }
29
+ export type LiteVisibleRecord = PdppRecordRow;
30
+ /** One local commit, in sequence order. It points at the retained operation. */
31
+ interface LogEntry {
32
+ batchId: string;
33
+ operationKey: string;
34
+ sequence: number;
35
+ /** The record row's version after this operation (record operations only). */
36
+ rowVersion?: number;
37
+ }
38
+ /** The fingerprint `stagePending` and `pendingBatch` report for an envelope. */
39
+ export declare const litePendingFingerprint: (envelope: unknown) => string;
40
+ export declare function createLiteCanonicalStore(deps: {
41
+ persistence: LiteCanonicalPersistence;
42
+ context: () => MergeContext;
43
+ authenticateReplica: (credential: unknown) => string | undefined;
44
+ enabled?: boolean;
45
+ visibilityPolicy?: ReplicaVisibilityPolicy;
46
+ newId?: () => string;
47
+ /** Called after each local batch commits, so replication steps soon. */
48
+ localCommitted?: () => void;
49
+ }): {
50
+ /** Host hook: caller authenticates/decrypts transport and verifies its hash before staging. */
51
+ stagePending(input: {
52
+ id: string;
53
+ envelope: unknown;
54
+ credential: unknown;
55
+ blobs?: {
56
+ stagingId: LiteStagingId;
57
+ descriptor: LiteBlobDescriptor;
58
+ }[];
59
+ }): Promise<{
60
+ fingerprint: string;
61
+ state: "confirmed" | "quarantined";
62
+ } | {
63
+ fingerprint: string;
64
+ state: "pending";
65
+ }>;
66
+ /** Trusted finality hook; fingerprint must come from independently verified finalized evidence. */
67
+ promotePending(input: {
68
+ id: string;
69
+ credential: unknown;
70
+ fingerprint: string;
71
+ }): Promise<LiteCommitReceipt>;
72
+ quarantinePending(input: {
73
+ id: string;
74
+ credential: unknown;
75
+ reason: string;
76
+ }): Promise<void>;
77
+ /** Trusted host provisioning only; never called by replica or collector input. */
78
+ provisionConnection(id: string, connection: Connection): Promise<void>;
79
+ /**
80
+ * Replication's writer identity (host contract §3.2): local operations
81
+ * from now on name `writerId`. The first time a writer binds, every
82
+ * unpublished local operation is dropped from the outbox and the current
83
+ * canonical state is re-exported under it (`reexport`), so a phone with
84
+ * local writes before its first enable, or after a writer rotation,
85
+ * still converges. Binding the writer already exported is a no-op.
86
+ */
87
+ rebaseline(writerId: string): Promise<{
88
+ reissued: number;
89
+ skipped: number;
90
+ } | undefined>;
91
+ /** A staged pending batch's state and fingerprint, if any. */
92
+ pendingBatch(id: string): Promise<{
93
+ state: "pending" | "confirmed" | "quarantined";
94
+ fingerprint: string;
95
+ } | undefined>;
96
+ commitLocal: (id: string, operations: LiteOperationDraft[], blobs?: {
97
+ stagingId: LiteStagingId;
98
+ descriptor: LiteBlobDescriptor;
99
+ }[]) => Promise<LiteCommitReceipt>;
100
+ import: (input: {
101
+ id: string;
102
+ envelope: unknown;
103
+ credential: unknown;
104
+ blobs?: {
105
+ stagingId: LiteStagingId;
106
+ descriptor: LiteBlobDescriptor;
107
+ }[];
108
+ }) => Promise<LiteCommitReceipt>;
109
+ /** True when reconcile withdraws this connection from every reader. */
110
+ isConnectionQuarantined(connectionId: string): Promise<boolean>;
111
+ /**
112
+ * Trusted host hook for a terminal batch (contract v3.1 A, H): record
113
+ * the absorbing connection-quarantine fact and withdraw the connection
114
+ * from every reader in the same transaction. The view revisions advance,
115
+ * so open page cursors expire. Rows stay retained; nothing is deleted.
116
+ */
117
+ quarantineConnection(input: {
118
+ credential: unknown;
119
+ connectionId: string;
120
+ reason: string;
121
+ }): Promise<void>;
122
+ /** Invoke after trusted declaration/validator changes. Continue until after is absent. */
123
+ retry(input: {
124
+ credential: unknown;
125
+ after?: string;
126
+ }): Promise<{
127
+ after: string | undefined;
128
+ }>;
129
+ readRecord(connection: string, stream: string, key: string, options?: LiteReplicaReadOptions): Promise<PdppRecordRow | undefined>;
130
+ /**
131
+ * The certified completions of a connection's canonical streams, by
132
+ * stream. A completion describes canonical rows as stored, so a reader
133
+ * that sees the pending preview gets none, as on Node.
134
+ */
135
+ readStreamCompletions(connection: string, options?: LiteReplicaReadOptions): Promise<CompletionOperation[]>;
136
+ /** Host-only current-row page. Includes tombstones; not a public query cursor. */
137
+ readConnectionPage(connection: string, after?: string, options?: LiteReplicaReadOptions): Promise<{
138
+ rows: PdppRecordRow[];
139
+ after: string | undefined;
140
+ }>;
141
+ /**
142
+ * Internal bounded page of every local commit after a sequence, including
143
+ * acknowledged ones. Never a public PDPP cursor or grant-relative read.
144
+ */
145
+ readLogPage(afterSequence?: number): Promise<{
146
+ entries: (LogEntry & {
147
+ operation: ReplicaOperation;
148
+ })[];
149
+ nextAfterSequence: number;
150
+ hasMore: boolean;
151
+ }>;
152
+ /** Local commits after `afterSequence` that are not yet acknowledged. */
153
+ readOutboxPage(afterSequence?: number): Promise<{
154
+ entries: {
155
+ sequence: number;
156
+ batchId: string;
157
+ operation: {
158
+ kind: "upsert";
159
+ data: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
160
+ [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
161
+ } | null)[] | {
162
+ [key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
163
+ } | null)[] | {
164
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
165
+ } | null)[] | {
166
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
167
+ } | null)[] | {
168
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
169
+ } | null)[] | {
170
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
171
+ } | null)[] | {
172
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
173
+ } | null)[] | {
174
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
175
+ } | null)[] | {
176
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
177
+ } | null)[] | {
178
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
179
+ } | null)[] | {
180
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
181
+ } | null)[] | {
182
+ [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
183
+ } | null>;
184
+ blobs: {
185
+ blobId: string;
186
+ sha256: string;
187
+ mimeType: string;
188
+ sizeBytes: number;
189
+ }[];
190
+ declaration: {
191
+ digest: string;
192
+ version: string;
193
+ stream: string;
194
+ semantics: "append_only" | "mutable_state";
195
+ primaryKey: string[];
196
+ schemaDigest: string;
197
+ };
198
+ recordKey: string;
199
+ emittedAt: string;
200
+ owner: string;
201
+ sourceId: string;
202
+ connectionId: string;
203
+ methodId: string;
204
+ generation: number;
205
+ revision: {
206
+ counter: number;
207
+ writerId: string;
208
+ operationId: string;
209
+ origin?: {
210
+ writerId: string;
211
+ operationId: string;
212
+ } | undefined;
213
+ };
214
+ } | {
215
+ kind: "delete";
216
+ deletedAt: string;
217
+ declaration: {
218
+ digest: string;
219
+ version: string;
220
+ stream: string;
221
+ semantics: "append_only" | "mutable_state";
222
+ primaryKey: string[];
223
+ schemaDigest: string;
224
+ };
225
+ recordKey: string;
226
+ emittedAt: string;
227
+ owner: string;
228
+ sourceId: string;
229
+ connectionId: string;
230
+ methodId: string;
231
+ generation: number;
232
+ revision: {
233
+ counter: number;
234
+ writerId: string;
235
+ operationId: string;
236
+ origin?: {
237
+ writerId: string;
238
+ operationId: string;
239
+ } | undefined;
240
+ };
241
+ } | {
242
+ kind: "connection-register";
243
+ generation: 1;
244
+ owner: string;
245
+ sourceId: string;
246
+ connectionId: string;
247
+ methodId: string;
248
+ revision: {
249
+ counter: number;
250
+ writerId: string;
251
+ operationId: string;
252
+ origin?: {
253
+ writerId: string;
254
+ operationId: string;
255
+ } | undefined;
256
+ };
257
+ } | {
258
+ kind: "connection-reset";
259
+ previousGeneration: number;
260
+ owner: string;
261
+ sourceId: string;
262
+ connectionId: string;
263
+ methodId: string;
264
+ generation: number;
265
+ revision: {
266
+ counter: number;
267
+ writerId: string;
268
+ operationId: string;
269
+ origin?: {
270
+ writerId: string;
271
+ operationId: string;
272
+ } | undefined;
273
+ };
274
+ } | {
275
+ kind: "connection-delete";
276
+ owner: string;
277
+ sourceId: string;
278
+ connectionId: string;
279
+ methodId: string;
280
+ generation: number;
281
+ revision: {
282
+ counter: number;
283
+ writerId: string;
284
+ operationId: string;
285
+ origin?: {
286
+ writerId: string;
287
+ operationId: string;
288
+ } | undefined;
289
+ };
290
+ } | {
291
+ kind: "blob-claim";
292
+ blob: {
293
+ blobId: string;
294
+ sha256: string;
295
+ mimeType: string;
296
+ sizeBytes: number;
297
+ };
298
+ owner: string;
299
+ sourceId: string;
300
+ connectionId: string;
301
+ methodId: string;
302
+ generation: number;
303
+ revision: {
304
+ counter: number;
305
+ writerId: string;
306
+ operationId: string;
307
+ origin?: {
308
+ writerId: string;
309
+ operationId: string;
310
+ } | undefined;
311
+ };
312
+ } | {
313
+ kind: "stream-invalidate";
314
+ declaration: {
315
+ digest: string;
316
+ version: string;
317
+ stream: string;
318
+ semantics: "append_only" | "mutable_state";
319
+ primaryKey: string[];
320
+ schemaDigest: string;
321
+ };
322
+ owner: string;
323
+ sourceId: string;
324
+ connectionId: string;
325
+ methodId: string;
326
+ generation: number;
327
+ revision: {
328
+ counter: number;
329
+ writerId: string;
330
+ operationId: string;
331
+ origin?: {
332
+ writerId: string;
333
+ operationId: string;
334
+ } | undefined;
335
+ };
336
+ } | {
337
+ kind: "stream-complete";
338
+ declaration: {
339
+ digest: string;
340
+ version: string;
341
+ stream: string;
342
+ semantics: "append_only" | "mutable_state";
343
+ primaryKey: string[];
344
+ schemaDigest: string;
345
+ };
346
+ sourceCollectedAt: string;
347
+ liveCount: number;
348
+ snapshotSha256: string;
349
+ proof: {
350
+ kind: "native";
351
+ snapshotSha256: string;
352
+ collectionTimeBasis: "host_run_finished";
353
+ } | {
354
+ kind: "producer-asserted";
355
+ snapshotSha256: null;
356
+ collectionTimeBasis: null;
357
+ };
358
+ dependencies: {
359
+ writerId: string;
360
+ operationId: string;
361
+ digest: string;
362
+ }[];
363
+ owner: string;
364
+ sourceId: string;
365
+ connectionId: string;
366
+ methodId: string;
367
+ generation: number;
368
+ revision: {
369
+ counter: number;
370
+ writerId: string;
371
+ operationId: string;
372
+ origin?: {
373
+ writerId: string;
374
+ operationId: string;
375
+ } | undefined;
376
+ };
377
+ };
378
+ }[];
379
+ nextAfterSequence: number;
380
+ hasMore: boolean;
381
+ }>;
382
+ /** Moves the outbox past `next`. The log keeps every entry. */
383
+ acknowledgeOutbox(expected: number, next: number): Promise<void>;
384
+ /**
385
+ * The engine published every outbox operation up to `next` and the
386
+ * gateway confirmed its registration: move the outbox past them. The log
387
+ * keeps every entry. Monotonic; a lower or repeated acknowledgment is a
388
+ * no-op.
389
+ */
390
+ acknowledgePublished(next: number): Promise<void>;
391
+ stageBlob(descriptor: LiteBlobDescriptor, chunks: AsyncIterable<Uint8Array>, signal?: AbortSignal): Promise<LiteStagingId>;
392
+ readBlob(blobId: string, options?: LiteReplicaReadOptions): AsyncGenerator<Uint8Array<ArrayBufferLike>, void, unknown>;
393
+ };
394
+ export {};
395
+ //# sourceMappingURL=canonical-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-store.d.ts","sourceRoot":"","sources":["../src/canonical-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gBAAgB,EAGtB,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,qEAAqE,CAAC;AAY7E,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8DAA8D,CAAC;AAOtE,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC7B,MAAM,qEAAqE,CAAC;AAC7E,OAAO,EAGL,KAAK,wBAAwB,EAE7B,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAG3C,QAAQ,CAAC,MAAM,EACX,iBAAiB,GACjB,qBAAqB,GACrB,aAAa,GACb,6BAA6B,GAC7B,qBAAqB,GACrB,kBAAkB,GAClB,wBAAwB;IAT9B,QAAQ,CAAC,IAAI,4BAA4B;gBAE9B,MAAM,EACX,iBAAiB,GACjB,qBAAqB,GACrB,aAAa,GACb,6BAA6B,GAC7B,qBAAqB,GACrB,kBAAkB,GAClB,wBAAwB,EAC5B,OAAO,EAAE,MAAM;CAKlB;AAED,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,SAAS,MAAM,CAAC,GAC7D,CAAC,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