@xyo-network/event-kit-node 1.0.1 → 2.2.0
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/README.md +53 -34
- package/dist/node/bestEffortSnapshotWorker.d.ts +44 -0
- package/dist/node/bestEffortSnapshotWorker.d.ts.map +1 -0
- package/dist/node/bestEffortTypes.d.ts +55 -0
- package/dist/node/bestEffortTypes.d.ts.map +1 -0
- package/dist/node/filesystemCursorStore.d.ts.map +1 -1
- package/dist/node/filesystemJson.d.ts.map +1 -1
- package/dist/node/filesystemPublisherOutbox.d.ts.map +1 -1
- package/dist/node/filesystemWakeInbox.d.ts +3 -20
- package/dist/node/filesystemWakeInbox.d.ts.map +1 -1
- package/dist/node/filesystemWakeQueue.d.ts +10 -19
- package/dist/node/filesystemWakeQueue.d.ts.map +1 -1
- package/dist/node/handshake.mjs +24 -11
- package/dist/node/handshake.mjs.map +2 -2
- package/dist/node/handshakeClients.d.ts +5 -1
- package/dist/node/handshakeClients.d.ts.map +1 -1
- package/dist/node/handshakeMutationIntent.d.ts +128 -66
- package/dist/node/handshakeMutationIntent.d.ts.map +1 -1
- package/dist/node/index.d.ts +8 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.mjs +2190 -706
- package/dist/node/index.mjs.map +4 -4
- package/dist/node/privateSqlite.d.ts +19 -0
- package/dist/node/privateSqlite.d.ts.map +1 -0
- package/dist/node/receiverAuthority.d.ts +102 -0
- package/dist/node/receiverAuthority.d.ts.map +1 -0
- package/dist/node/receiverMigration.d.ts +16 -0
- package/dist/node/receiverMigration.d.ts.map +1 -0
- package/dist/node/receiverMigrationInventory.d.ts +6 -0
- package/dist/node/receiverMigrationInventory.d.ts.map +1 -0
- package/dist/node/receiverMigrationSnapshot.d.ts +6 -0
- package/dist/node/receiverMigrationSnapshot.d.ts.map +1 -0
- package/dist/node/receiverMigrationTypes.d.ts +113 -0
- package/dist/node/receiverMigrationTypes.d.ts.map +1 -0
- package/dist/node/runtime/handshakeDiscovery.d.ts +4 -0
- package/dist/node/runtime/handshakeDiscovery.d.ts.map +1 -1
- package/dist/node/runtime/publisherDeliveryState.d.ts +107 -0
- package/dist/node/runtime/publisherDeliveryState.d.ts.map +1 -0
- package/dist/node/runtime/publisherRuntime.d.ts +17 -1
- package/dist/node/runtime/publisherRuntime.d.ts.map +1 -1
- package/dist/node/runtime/sourceSigner.d.ts +1 -0
- package/dist/node/runtime/sourceSigner.d.ts.map +1 -1
- package/dist/node/runtime/sqliteHandshakeStores.d.ts +3 -1
- package/dist/node/runtime/sqliteHandshakeStores.d.ts.map +1 -1
- package/dist/node/runtime.mjs +265 -93
- package/dist/node/runtime.mjs.map +4 -4
- package/dist/node/sqliteBestEffortInbox.d.ts +20 -0
- package/dist/node/sqliteBestEffortInbox.d.ts.map +1 -0
- package/dist/node/sqliteWakeQueue.d.ts +83 -17
- package/dist/node/sqliteWakeQueue.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
export declare class LegacyReceiverStoreError extends Error {
|
|
3
|
+
readonly name = "LegacyReceiverStoreError";
|
|
4
|
+
constructor(path: string);
|
|
5
|
+
}
|
|
6
|
+
/** Only the store's own directory is created/checked; unrelated parents are not chmodded. */
|
|
7
|
+
export declare function ensurePrivateDirectory(path: string): void;
|
|
8
|
+
export declare function checkPrivateStoreFile(path: string, create?: boolean): void;
|
|
9
|
+
export interface PrivateSqliteOptions {
|
|
10
|
+
readonly format: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
}
|
|
13
|
+
/** A synchronous commit boundary; no callback may await filesystem/network work. */
|
|
14
|
+
export declare function openPrivateSqlite(options: PrivateSqliteOptions): {
|
|
15
|
+
database: DatabaseSync;
|
|
16
|
+
transaction<T>(work: () => T): T;
|
|
17
|
+
close(): void;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=privateSqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privateSqlite.d.ts","sourceRoot":"","sources":["../../src/privateSqlite.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAkB,IAAI,8BAA6B;gBACvC,IAAI,EAAE,MAAM;CAGzB;AAED,6FAA6F;AAC7F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAezD;AAaD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,IAAI,CAgBxE;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AA0BD,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB;;gBAyB/C,CAAC,QAAQ,MAAM,CAAC,GAAG,CAAC;aAevB,IAAI;EAMhB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { AdmittedWake, AtomicWakeInbox, LeasedWake, WakeAdmissionReceipt, WakeQueue } from '@xyo-network/event-kit-protocol';
|
|
2
|
+
export interface ReceiverQueueRow {
|
|
3
|
+
readonly body: string | null;
|
|
4
|
+
readonly id: number;
|
|
5
|
+
readonly lease_token: string | null;
|
|
6
|
+
readonly state: 'pending' | 'inflight' | 'completed';
|
|
7
|
+
readonly terminal_operation: 'ack' | 'release' | null;
|
|
8
|
+
readonly terminal_token: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function receiverIdentity(parts: readonly string[]): string;
|
|
11
|
+
/** One durable authority for admission, queue transitions and completion. */
|
|
12
|
+
export declare function openReceiverAuthority(path: string): {
|
|
13
|
+
queue: WakeQueue<{
|
|
14
|
+
audience: string;
|
|
15
|
+
deploymentId: string;
|
|
16
|
+
event: {
|
|
17
|
+
schema: "network.xyo.event.wake.envelope" & {
|
|
18
|
+
readonly __schema: true;
|
|
19
|
+
};
|
|
20
|
+
authorizationChainId: string;
|
|
21
|
+
deploymentId: string;
|
|
22
|
+
wakeId: string;
|
|
23
|
+
deliveryMode: "best-effort" | "durable";
|
|
24
|
+
source: {
|
|
25
|
+
kind: "xl1-finalized";
|
|
26
|
+
chainId: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "ethereum-finalized";
|
|
29
|
+
chainId: string;
|
|
30
|
+
genesisHash: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "utc-interval";
|
|
33
|
+
scheduleId: string;
|
|
34
|
+
anchorSeconds: number;
|
|
35
|
+
intervalSeconds: number;
|
|
36
|
+
};
|
|
37
|
+
fromPosition: number;
|
|
38
|
+
toPosition: number;
|
|
39
|
+
filterHash: string;
|
|
40
|
+
issuedAt: number;
|
|
41
|
+
queueId?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
eventHash: string;
|
|
44
|
+
fromPosition: number;
|
|
45
|
+
toPosition: number;
|
|
46
|
+
jti: string;
|
|
47
|
+
publisher: string;
|
|
48
|
+
wakeId: string;
|
|
49
|
+
queueId?: string | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
inbox: AtomicWakeInbox<{
|
|
52
|
+
audience: string;
|
|
53
|
+
deploymentId: string;
|
|
54
|
+
event: {
|
|
55
|
+
schema: "network.xyo.event.wake.envelope" & {
|
|
56
|
+
readonly __schema: true;
|
|
57
|
+
};
|
|
58
|
+
authorizationChainId: string;
|
|
59
|
+
deploymentId: string;
|
|
60
|
+
wakeId: string;
|
|
61
|
+
deliveryMode: "best-effort" | "durable";
|
|
62
|
+
source: {
|
|
63
|
+
kind: "xl1-finalized";
|
|
64
|
+
chainId: string;
|
|
65
|
+
} | {
|
|
66
|
+
kind: "ethereum-finalized";
|
|
67
|
+
chainId: string;
|
|
68
|
+
genesisHash: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "utc-interval";
|
|
71
|
+
scheduleId: string;
|
|
72
|
+
anchorSeconds: number;
|
|
73
|
+
intervalSeconds: number;
|
|
74
|
+
};
|
|
75
|
+
fromPosition: number;
|
|
76
|
+
toPosition: number;
|
|
77
|
+
filterHash: string;
|
|
78
|
+
issuedAt: number;
|
|
79
|
+
queueId?: string | undefined;
|
|
80
|
+
};
|
|
81
|
+
eventHash: string;
|
|
82
|
+
fromPosition: number;
|
|
83
|
+
toPosition: number;
|
|
84
|
+
jti: string;
|
|
85
|
+
publisher: string;
|
|
86
|
+
wakeId: string;
|
|
87
|
+
queueId?: string | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
database: import("node:sqlite").DatabaseSync;
|
|
90
|
+
claim: (validate?: (row: ReceiverQueueRow) => Promise<void>) => Promise<(LeasedWake & {
|
|
91
|
+
readonly id: number;
|
|
92
|
+
readonly token: string;
|
|
93
|
+
}) | undefined>;
|
|
94
|
+
currentRow: (id: number) => ReceiverQueueRow | undefined;
|
|
95
|
+
rows: () => readonly ReceiverQueueRow[];
|
|
96
|
+
append(wake: AdmittedWake): Promise<number>;
|
|
97
|
+
receiptQueueId(receipt: WakeAdmissionReceipt): number;
|
|
98
|
+
close: () => void;
|
|
99
|
+
pruneExpiredTokens(nowSeconds: number): number;
|
|
100
|
+
};
|
|
101
|
+
export type ReceiverAuthority = ReturnType<typeof openReceiverAuthority>;
|
|
102
|
+
//# sourceMappingURL=receiverAuthority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiverAuthority.d.ts","sourceRoot":"","sources":["../../src/receiverAuthority.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAE,UAAU,EACnB,oBAAoB,EAAyB,SAAS,EAC7E,MAAM,iCAAiC,CAAA;AAQxC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAA;IACpD,QAAQ,CAAC,kBAAkB,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAAA;IACrD,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CACvC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEjE;AAkCD,6EAA6E;AAC7E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA+LhB,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,KAAG,OAAO,CAAC,CAAC,UAAU,GAAG;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;qBAnBtI,MAAM,KAAG,gBAAgB,GAAG,SAAS;gBAG5C,SAAS,gBAAgB,EAAE;iBAiEvB,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;4BAIzB,oBAAoB,GAAG,MAAM;;mCAMtB,MAAM,GAAG,MAAM;EAKjD;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AdmittedWake } from '@xyo-network/event-kit-protocol';
|
|
2
|
+
import type { ReceiverMigrationOptions, ReceiverMigrationReport } from './receiverMigrationTypes.ts';
|
|
3
|
+
export type { FilesystemReceiverMigrationSource, ReceiverMigrationFile, ReceiverMigrationIssue, ReceiverMigrationOptions, ReceiverMigrationReport, ReceiverMigrationReview, ReceiverMigrationSource, SqliteQueueMigrationSource, } from './receiverMigrationTypes.ts';
|
|
4
|
+
/** Offline copy-only migration. Unknown history blocks target publication. */
|
|
5
|
+
export declare function migrateReceiverStore(options: ReceiverMigrationOptions): Promise<ReceiverMigrationReport>;
|
|
6
|
+
export interface LegacyIdOnlyReducerCheckpoint {
|
|
7
|
+
readonly appliedWakeIds: readonly string[];
|
|
8
|
+
readonly lastProcessedPosition: number;
|
|
9
|
+
}
|
|
10
|
+
export interface MigratedReducerCheckpoint {
|
|
11
|
+
readonly appliedWakes: readonly Pick<AdmittedWake, 'audience' | 'eventHash' | 'publisher' | 'wakeId'>[];
|
|
12
|
+
readonly lastProcessedPosition: number;
|
|
13
|
+
}
|
|
14
|
+
/** Requires one externally established exact scoped hash mapping for every historical ID. */
|
|
15
|
+
export declare function migrateIdOnlyReducerCheckpoint(checkpoint: LegacyIdOnlyReducerCheckpoint, mappings: MigratedReducerCheckpoint['appliedWakes']): MigratedReducerCheckpoint;
|
|
16
|
+
//# sourceMappingURL=receiverMigration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiverMigration.d.ts","sourceRoot":"","sources":["../../src/receiverMigration.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAUnE,OAAO,KAAK,EACqC,wBAAwB,EAAyB,uBAAuB,EACxH,MAAM,6BAA6B,CAAA;AAEpC,YAAY,EACV,iCAAiC,EAAE,qBAAqB,EAAE,sBAAsB,EAChF,wBAAwB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,uBAAuB,EACnG,0BAA0B,GAC3B,MAAM,6BAA6B,CAAA;AA2KpC,8EAA8E;AAC9E,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAmB9G;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAA;CACvC;AACD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,YAAY,EAAE,SAAS,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC,EAAE,CAAA;IACvG,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAA;CACvC;AAED,6FAA6F;AAC7F,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,6BAA6B,EACzC,QAAQ,EAAE,yBAAyB,CAAC,cAAc,CAAC,GAClD,yBAAyB,CAgB3B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WakeAdmissionReceipt } from '@xyo-network/event-kit-protocol';
|
|
2
|
+
import type { ReceiverMigrationFile, ReceiverMigrationPlan, ReceiverMigrationReview, ReceiverMigrationSource } from './receiverMigrationTypes.ts';
|
|
3
|
+
export declare function validateMigrationReceipt(receipt: WakeAdmissionReceipt): WakeAdmissionReceipt;
|
|
4
|
+
/** Inspects a disposable private copy only. Originals and exact-byte backups are never opened by SQLite. */
|
|
5
|
+
export declare function inventoryReceiverMigration(source: ReceiverMigrationSource, copiedRoot: string, files: readonly ReceiverMigrationFile[], reviews: readonly ReceiverMigrationReview[]): Promise<ReceiverMigrationPlan>;
|
|
6
|
+
//# sourceMappingURL=receiverMigrationInventory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiverMigrationInventory.d.ts","sourceRoot":"","sources":["../../src/receiverMigrationInventory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAgB,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AASzF,OAAO,KAAK,EACuE,qBAAqB,EACtG,qBAAqB,EAA+B,uBAAuB,EAAE,uBAAuB,EACrG,MAAM,6BAA6B,CAAA;AAwBpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CAI5F;AA2MD,4GAA4G;AAC5G,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,uBAAuB,EAC/B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,SAAS,qBAAqB,EAAE,EACvC,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAC1C,OAAO,CAAC,qBAAqB,CAAC,CAQhC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReceiverMigrationFile } from './receiverMigrationTypes.ts';
|
|
2
|
+
/** Refuse symlinks and escaping configuration rather than following other stores. */
|
|
3
|
+
export declare function migrationRelativePath(root: string, relative: string): string;
|
|
4
|
+
export declare function snapshotMigrationSource(root: string, destination?: string): Promise<readonly ReceiverMigrationFile[]>;
|
|
5
|
+
export declare function verifyMigrationSource(root: string, files: readonly ReceiverMigrationFile[]): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=receiverMigrationSnapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiverMigrationSnapshot.d.ts","sourceRoot":"","sources":["../../src/receiverMigrationSnapshot.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAExE,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK5E;AAkBD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC,CA2B3H;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,qBAAqB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhH"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { AdmittedWake, WakeAdmissionReceipt } from '@xyo-network/event-kit-protocol';
|
|
2
|
+
export interface FilesystemReceiverMigrationSource {
|
|
3
|
+
readonly inboxDirectory: string;
|
|
4
|
+
readonly kind: 'filesystem';
|
|
5
|
+
/** Entire owned, stopped source store. Relative paths stay inside this root. */
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly queueDirectory: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SqliteQueueMigrationSource {
|
|
10
|
+
readonly databaseFile: string;
|
|
11
|
+
readonly kind: 'sqlite-queue';
|
|
12
|
+
readonly path: string;
|
|
13
|
+
/** Queue-only rows do not establish any admission receipt or grant. */
|
|
14
|
+
readonly scope: 'queue-only';
|
|
15
|
+
}
|
|
16
|
+
export type ReceiverMigrationSource = FilesystemReceiverMigrationSource | SqliteQueueMigrationSource;
|
|
17
|
+
export interface ReceiverMigrationReview {
|
|
18
|
+
readonly action: 'pending' | 'completed' | 'quarantine';
|
|
19
|
+
/** External acknowledgment/checkpoint or exact operator-reviewed mapping reference. */
|
|
20
|
+
readonly evidence: string;
|
|
21
|
+
/** Scoped identity digest from the dry-run report, or artifact:<relative path>. */
|
|
22
|
+
readonly identity: string;
|
|
23
|
+
/** New placement decision only when no matching original queue reference exists. */
|
|
24
|
+
readonly queueOrder?: {
|
|
25
|
+
readonly evidence: string;
|
|
26
|
+
readonly kind: 'after-known';
|
|
27
|
+
};
|
|
28
|
+
readonly receipt?: WakeAdmissionReceipt;
|
|
29
|
+
readonly wake?: AdmittedWake;
|
|
30
|
+
}
|
|
31
|
+
export interface ReceiverMigrationOptions {
|
|
32
|
+
readonly backupPath?: string;
|
|
33
|
+
/** Explicit assertion covering every writer and consumer of the source. */
|
|
34
|
+
readonly consumersStopped: true;
|
|
35
|
+
readonly dryRun?: boolean;
|
|
36
|
+
readonly reviews?: readonly ReceiverMigrationReview[];
|
|
37
|
+
readonly source: ReceiverMigrationSource;
|
|
38
|
+
readonly targetPath?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ReceiverMigrationFile {
|
|
41
|
+
readonly bytes: number;
|
|
42
|
+
readonly mode: number;
|
|
43
|
+
readonly path: string;
|
|
44
|
+
readonly sha256: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ReceiverMigrationIssue {
|
|
47
|
+
readonly identity: string;
|
|
48
|
+
readonly paths: readonly string[];
|
|
49
|
+
readonly reason: string;
|
|
50
|
+
}
|
|
51
|
+
export type ReceiverMigrationQueueOrder = {
|
|
52
|
+
readonly kind: 'filesystem-entry-name';
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly path: string;
|
|
55
|
+
} | {
|
|
56
|
+
readonly id: number;
|
|
57
|
+
readonly kind: 'sqlite-row-id';
|
|
58
|
+
readonly path: string;
|
|
59
|
+
} | {
|
|
60
|
+
readonly evidence: string;
|
|
61
|
+
readonly kind: 'reviewed-after-known';
|
|
62
|
+
};
|
|
63
|
+
export interface ReceiverMigrationReport {
|
|
64
|
+
readonly backupPath?: string;
|
|
65
|
+
readonly completedIdentities: number;
|
|
66
|
+
readonly executed: boolean;
|
|
67
|
+
readonly files: readonly ReceiverMigrationFile[];
|
|
68
|
+
readonly pendingIdentities: number;
|
|
69
|
+
readonly quarantined: readonly ReceiverMigrationIssue[];
|
|
70
|
+
readonly ready: boolean;
|
|
71
|
+
readonly reviews: readonly Pick<ReceiverMigrationReview, 'action' | 'evidence' | 'identity' | 'queueOrder'>[];
|
|
72
|
+
readonly rollback: 'restore-backup-only-before-new-writers-resume; after-that-repair-forward; reverse-migration-unsupported';
|
|
73
|
+
readonly selected: readonly {
|
|
74
|
+
readonly completionProvenance?: 'Fresh reviewed migration tombstone; no historical lease or ack inferred';
|
|
75
|
+
readonly eventHash?: string;
|
|
76
|
+
readonly identity: string;
|
|
77
|
+
readonly paths: readonly string[];
|
|
78
|
+
/** Pending work preserves a recorded queue reference; metadata supplies no chronology. */
|
|
79
|
+
readonly queueOrder?: ReceiverMigrationQueueOrder;
|
|
80
|
+
readonly state: 'pending' | 'completed';
|
|
81
|
+
}[];
|
|
82
|
+
readonly sourceBytes: number;
|
|
83
|
+
readonly sourcePath: string;
|
|
84
|
+
readonly sourceUnchanged: true;
|
|
85
|
+
readonly targetPath?: string;
|
|
86
|
+
readonly tokenRecords: number;
|
|
87
|
+
readonly unknown: readonly ReceiverMigrationIssue[];
|
|
88
|
+
}
|
|
89
|
+
export interface LegacyMigrationToken {
|
|
90
|
+
readonly audience: string;
|
|
91
|
+
readonly eventHash: string;
|
|
92
|
+
readonly jwtId: string;
|
|
93
|
+
readonly publisher: string;
|
|
94
|
+
readonly receipt: WakeAdmissionReceipt;
|
|
95
|
+
readonly retainJwtUntil: number;
|
|
96
|
+
readonly wakeId: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ReceiverMigrationEntry {
|
|
99
|
+
readonly evidence: string;
|
|
100
|
+
readonly identity: string;
|
|
101
|
+
readonly paths: readonly string[];
|
|
102
|
+
readonly queueOrder?: ReceiverMigrationQueueOrder;
|
|
103
|
+
readonly receipt?: WakeAdmissionReceipt;
|
|
104
|
+
readonly state: 'pending' | 'completed';
|
|
105
|
+
readonly tokens: readonly LegacyMigrationToken[];
|
|
106
|
+
readonly wake?: AdmittedWake;
|
|
107
|
+
}
|
|
108
|
+
export interface ReceiverMigrationPlan {
|
|
109
|
+
readonly entries: readonly ReceiverMigrationEntry[];
|
|
110
|
+
readonly quarantined: readonly ReceiverMigrationIssue[];
|
|
111
|
+
readonly unknown: readonly ReceiverMigrationIssue[];
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=receiverMigrationTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiverMigrationTypes.d.ts","sourceRoot":"","sources":["../../src/receiverMigrationTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAEzF,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM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CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,2BAA2B,CAAA;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,CAAA;IACvC,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAA;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAA;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAA;IACnD,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAA;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAA;CACpD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BestEffortDeliveryPolicy, WakeDeliveryMode } from '@xyo-network/event-kit-schemas';
|
|
1
2
|
import type { PublisherEncryptionKeyCustody, PublisherHandshakeClient } from '../handshakeClients.ts';
|
|
2
3
|
import type { PublisherHttpsTransport } from './httpsTransport.ts';
|
|
3
4
|
import type { PublisherRuntimeDiscovery } from './publisherRuntime.ts';
|
|
@@ -5,11 +6,14 @@ import type { SqlitePublisherState } from './sqlitePublisherState.ts';
|
|
|
5
6
|
/** Real D005 lifecycle discovery. Off-chain configuration never grants delivery authority. */
|
|
6
7
|
export declare function createPublisherHandshakeDiscovery(options: {
|
|
7
8
|
readonly authorizationChainId: string;
|
|
9
|
+
readonly bestEffort?: BestEffortDeliveryPolicy;
|
|
8
10
|
readonly client: PublisherHandshakeClient;
|
|
11
|
+
readonly deliveryMode?: WakeDeliveryMode;
|
|
9
12
|
readonly keys: PublisherEncryptionKeyCustody;
|
|
10
13
|
readonly maxSubscriptions?: number;
|
|
11
14
|
readonly nowSeconds?: () => number;
|
|
12
15
|
readonly publisher: string;
|
|
16
|
+
readonly serviceHash?: string;
|
|
13
17
|
readonly state: SqlitePublisherState;
|
|
14
18
|
readonly transport: PublisherHttpsTransport;
|
|
15
19
|
}): PublisherRuntimeDiscovery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshakeDiscovery.d.ts","sourceRoot":"","sources":["../../../src/runtime/handshakeDiscovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handshakeDiscovery.d.ts","sourceRoot":"","sources":["../../../src/runtime/handshakeDiscovery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EAA6B,gBAAgB,EACtE,MAAM,gCAAgC,CAAA;AAIvC,OAAO,KAAK,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AAErG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EACV,yBAAyB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAQrE,8FAA8F;AAC9F,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAA;IAC9C,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAA;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAA;IACxC,QAAQ,CAAC,IAAI,EAAE,6BAA6B,CAAA;IAC5C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,MAAM,CAAA;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAA;IACpC,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAA;CAC5C,GAAG,yBAAyB,CAiN5B"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { BestEffortDeliveryPolicy, WakeEnvelope } from '@xyo-network/event-kit-schemas';
|
|
2
|
+
import type { PublisherRuntimeSubscription } from './publisherRuntime.ts';
|
|
3
|
+
import type { PublisherSourceHead } from './sources.ts';
|
|
4
|
+
import type { SqlitePublisherState } from './sqlitePublisherState.ts';
|
|
5
|
+
export interface DeliveryState {
|
|
6
|
+
readonly abandoned?: number;
|
|
7
|
+
readonly attempts?: number;
|
|
8
|
+
readonly cursor: number;
|
|
9
|
+
readonly delivered: number;
|
|
10
|
+
readonly failures: number;
|
|
11
|
+
readonly lastError?: string;
|
|
12
|
+
readonly lastHintAt?: number;
|
|
13
|
+
readonly lastHintTarget?: number;
|
|
14
|
+
readonly lastNotifiedAt?: number;
|
|
15
|
+
readonly nextAttemptMs: number;
|
|
16
|
+
readonly pending?: WakeEnvelope;
|
|
17
|
+
readonly state: 'active' | 'blocked' | 'cancelled';
|
|
18
|
+
readonly subscription: PublisherRuntimeSubscription;
|
|
19
|
+
readonly superseded?: number;
|
|
20
|
+
readonly totalAttempts?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function assertDeliveryState(record: DeliveryState, subscription: PublisherRuntimeSubscription): void;
|
|
23
|
+
export declare function makeEvent(subscription: PublisherRuntimeSubscription, fromPosition: number, toPosition: number, now: number, wakeId?: string): {
|
|
24
|
+
schema: "network.xyo.event.wake.envelope" & {
|
|
25
|
+
readonly __schema: true;
|
|
26
|
+
};
|
|
27
|
+
authorizationChainId: string;
|
|
28
|
+
deploymentId: string;
|
|
29
|
+
wakeId: string;
|
|
30
|
+
deliveryMode: "best-effort" | "durable";
|
|
31
|
+
source: {
|
|
32
|
+
kind: "xl1-finalized";
|
|
33
|
+
chainId: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "ethereum-finalized";
|
|
36
|
+
chainId: string;
|
|
37
|
+
genesisHash: string;
|
|
38
|
+
} | {
|
|
39
|
+
kind: "utc-interval";
|
|
40
|
+
scheduleId: string;
|
|
41
|
+
anchorSeconds: number;
|
|
42
|
+
intervalSeconds: number;
|
|
43
|
+
};
|
|
44
|
+
fromPosition: number;
|
|
45
|
+
toPosition: number;
|
|
46
|
+
filterHash: string;
|
|
47
|
+
issuedAt: number;
|
|
48
|
+
queueId?: string | undefined;
|
|
49
|
+
};
|
|
50
|
+
export declare class DeliveryResponseError extends Error {
|
|
51
|
+
readonly retryAfterMs?: number;
|
|
52
|
+
readonly status: number;
|
|
53
|
+
constructor(status: number, retryAfterMs?: number);
|
|
54
|
+
get retryable(): boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare function prepareBestEffortDelivery(options: {
|
|
57
|
+
readonly bestEffort: BestEffortDeliveryPolicy;
|
|
58
|
+
readonly first: boolean;
|
|
59
|
+
readonly heads: ReadonlyMap<string, PublisherSourceHead | Error>;
|
|
60
|
+
readonly now: number;
|
|
61
|
+
readonly record: DeliveryState;
|
|
62
|
+
readonly state: SqlitePublisherState;
|
|
63
|
+
}): {
|
|
64
|
+
pending: {
|
|
65
|
+
schema: "network.xyo.event.wake.envelope" & {
|
|
66
|
+
readonly __schema: true;
|
|
67
|
+
};
|
|
68
|
+
authorizationChainId: string;
|
|
69
|
+
deploymentId: string;
|
|
70
|
+
wakeId: string;
|
|
71
|
+
deliveryMode: "best-effort" | "durable";
|
|
72
|
+
source: {
|
|
73
|
+
kind: "xl1-finalized";
|
|
74
|
+
chainId: string;
|
|
75
|
+
} | {
|
|
76
|
+
kind: "ethereum-finalized";
|
|
77
|
+
chainId: string;
|
|
78
|
+
genesisHash: string;
|
|
79
|
+
} | {
|
|
80
|
+
kind: "utc-interval";
|
|
81
|
+
scheduleId: string;
|
|
82
|
+
anchorSeconds: number;
|
|
83
|
+
intervalSeconds: number;
|
|
84
|
+
};
|
|
85
|
+
fromPosition: number;
|
|
86
|
+
toPosition: number;
|
|
87
|
+
filterHash: string;
|
|
88
|
+
issuedAt: number;
|
|
89
|
+
queueId?: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
abandoned?: number;
|
|
92
|
+
attempts?: number;
|
|
93
|
+
cursor: number;
|
|
94
|
+
delivered: number;
|
|
95
|
+
failures: number;
|
|
96
|
+
lastError?: string;
|
|
97
|
+
lastHintAt?: number;
|
|
98
|
+
lastHintTarget?: number;
|
|
99
|
+
lastNotifiedAt?: number;
|
|
100
|
+
nextAttemptMs: number;
|
|
101
|
+
state: "active" | "blocked" | "cancelled";
|
|
102
|
+
subscription: PublisherRuntimeSubscription;
|
|
103
|
+
superseded?: number;
|
|
104
|
+
totalAttempts?: number;
|
|
105
|
+
} | undefined;
|
|
106
|
+
export declare function failedDelivery(record: DeliveryState, current: DeliveryState | undefined, mode: string, error: unknown, now: number): DeliveryState;
|
|
107
|
+
//# sourceMappingURL=publisherDeliveryState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisherDeliveryState.d.ts","sourceRoot":"","sources":["../../../src/runtime/publisherDeliveryState.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAG5F,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAEvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAErE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,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,KAAK,EAAE,oBAAoB,CAAA;CACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAvEsB,MAAM;eACP,MAAM;YACT,MAAM;eACH,MAAM;cACP,MAAM;gBACJ,MAAM;iBACL,MAAM;qBACF,MAAM;qBACN,MAAM;mBACR,MAAM;WAEd,QAAQ,GAAG,SAAS,GAAG,WAAW;kBAC3B,4BAA4B;iBAC7B,MAAM;oBACH,MAAM;cA6FhC;AAWD,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa,CAclJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WakeSource } from '@xyo-network/event-kit-schemas';
|
|
1
|
+
import type { BestEffortDeliveryPolicy, WakeDeliveryMode, WakeSource } from '@xyo-network/event-kit-schemas';
|
|
2
2
|
import type { AccountInstance } from '@xyo-network/sdk';
|
|
3
3
|
import type { PublisherHttpsTransport } from './httpsTransport.ts';
|
|
4
4
|
import type { PublisherSourceReader } from './sources.ts';
|
|
@@ -6,13 +6,16 @@ import type { SqlitePublisherState } from './sqlitePublisherState.ts';
|
|
|
6
6
|
export interface PublisherRuntimeSubscription {
|
|
7
7
|
readonly audience: string;
|
|
8
8
|
readonly authorizationChainId: string;
|
|
9
|
+
readonly bestEffort?: BestEffortDeliveryPolicy;
|
|
9
10
|
readonly controller: string;
|
|
11
|
+
readonly deliveryMode: WakeDeliveryMode;
|
|
10
12
|
readonly deploymentId: string;
|
|
11
13
|
readonly endpoint: string;
|
|
12
14
|
readonly filterHash: string;
|
|
13
15
|
readonly fromPosition: number;
|
|
14
16
|
readonly maxPositionsPerWake: number;
|
|
15
17
|
readonly queueId?: string;
|
|
18
|
+
readonly serviceHash?: string;
|
|
16
19
|
readonly source: WakeSource;
|
|
17
20
|
readonly subscriptionHash: string;
|
|
18
21
|
}
|
|
@@ -37,22 +40,29 @@ export interface PublisherRuntimeDiscoveryStatus {
|
|
|
37
40
|
}
|
|
38
41
|
export interface PersistentEventPublisherOptions {
|
|
39
42
|
readonly account: AccountInstance;
|
|
43
|
+
readonly bestEffort?: BestEffortDeliveryPolicy;
|
|
40
44
|
readonly concurrency?: number;
|
|
45
|
+
readonly deliveryMode: WakeDeliveryMode;
|
|
41
46
|
readonly discovery: PublisherRuntimeDiscovery;
|
|
42
47
|
readonly intervalMs?: number;
|
|
43
48
|
readonly maxSubscriptions?: number;
|
|
44
49
|
readonly nowSeconds?: () => number;
|
|
45
50
|
readonly publisher: string;
|
|
46
51
|
readonly requestTimeoutMs?: number;
|
|
52
|
+
/** Optional immutable operator pin; mismatches fail readiness without revoking subscriptions. */
|
|
53
|
+
readonly serviceHash?: string;
|
|
47
54
|
readonly sources: readonly PublisherSourceReader[];
|
|
48
55
|
readonly state: SqlitePublisherState;
|
|
49
56
|
readonly transport: PublisherHttpsTransport;
|
|
50
57
|
}
|
|
51
58
|
export interface PersistentEventPublisherStatus {
|
|
59
|
+
readonly abandoned: number;
|
|
52
60
|
readonly activeSubscriptions: number;
|
|
61
|
+
readonly bestEffort?: BestEffortDeliveryPolicy;
|
|
53
62
|
readonly clockHealthy: boolean;
|
|
54
63
|
readonly degraded: boolean;
|
|
55
64
|
readonly delivered: number;
|
|
65
|
+
readonly deliveryMode: WakeDeliveryMode;
|
|
56
66
|
readonly failures: number;
|
|
57
67
|
readonly handshake?: PublisherRuntimeDiscoveryStatus;
|
|
58
68
|
readonly lastError?: string;
|
|
@@ -67,12 +77,18 @@ export interface PersistentEventPublisherStatus {
|
|
|
67
77
|
readonly position: number;
|
|
68
78
|
}[];
|
|
69
79
|
readonly subscriptions: readonly {
|
|
80
|
+
readonly attempts?: number;
|
|
70
81
|
readonly cursor: number;
|
|
71
82
|
readonly failures: number;
|
|
72
83
|
readonly id: string;
|
|
84
|
+
/** Best Effort admission target is not a contiguous source prefix. */
|
|
85
|
+
readonly lastAdmissionTarget?: number;
|
|
86
|
+
readonly lastHintAt?: number;
|
|
73
87
|
readonly pending: boolean;
|
|
74
88
|
readonly state: string;
|
|
75
89
|
}[];
|
|
90
|
+
readonly superseded: number;
|
|
91
|
+
readonly totalAttempts: number;
|
|
76
92
|
}
|
|
77
93
|
export interface PersistentEventPublisher {
|
|
78
94
|
runOnce(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publisherRuntime.d.ts","sourceRoot":"","sources":["../../../src/runtime/publisherRuntime.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"publisherRuntime.d.ts","sourceRoot":"","sources":["../../../src/runtime/publisherRuntime.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,wBAAwB,EAAE,gBAAgB,EAAgB,UAAU,EACrE,MAAM,gCAAgC,CAAA;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAIvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAKlE,OAAO,KAAK,EAAuB,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAG9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAA;IAC9C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAA;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,YAAY,EAAE,M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AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAIlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,+EAA+E;AAC/E,wBAAgB,6BAA6B,CAAC,OAAO,EAAE;IACrD,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,MAAM,CAAA;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;gBAKqB,YAAY,YAAY,MAAM
|
|
1
|
+
{"version":3,"file":"sourceSigner.d.ts","sourceRoot":"","sources":["../../../src/runtime/sourceSigner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAIlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,+EAA+E;AAC/E,wBAAgB,6BAA6B,CAAC,OAAO,EAAE;IACrD,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,MAAM,CAAA;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;gBAKqB,YAAY,YAAY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBnD"}
|
|
@@ -5,7 +5,9 @@ import type { PublisherEncryptionKeyCustody } from '../handshakeClients.ts';
|
|
|
5
5
|
import type { HandshakeMutationIntentStore } from '../handshakeMutationIntent.ts';
|
|
6
6
|
import type { SqlitePublisherState } from './sqlitePublisherState.ts';
|
|
7
7
|
/** All handshake durability uses the same single-owner SQLite authority as delivery. */
|
|
8
|
-
export declare function createSqlitePublisherHandshakeStores(state: SqlitePublisherState
|
|
8
|
+
export declare function createSqlitePublisherHandshakeStores(state: SqlitePublisherState, options?: {
|
|
9
|
+
readonly replayNamespace?: string;
|
|
10
|
+
}): {
|
|
9
11
|
readonly challenges: PublisherEndpointChallengeStore;
|
|
10
12
|
readonly intents: HandshakeMutationIntentStore;
|
|
11
13
|
readonly journal: FinalizedStatementPublicationJournal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteHandshakeStores.d.ts","sourceRoot":"","sources":["../../../src/runtime/sqliteHandshakeStores.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoC,+BAA+B,EAAE,MAAM,iCAAiC,CAAA;AAKxH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAA;AAC3F,OAAO,KAAK,EAC2B,oCAAoC,EAC1E,MAAM,4BAA4B,CAAA;AAGnC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAA2B,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAI1G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAyBrE,wFAAwF;AACxF,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,oBAAoB,GAAG;
|
|
1
|
+
{"version":3,"file":"sqliteHandshakeStores.d.ts","sourceRoot":"","sources":["../../../src/runtime/sqliteHandshakeStores.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoC,+BAA+B,EAAE,MAAM,iCAAiC,CAAA;AAKxH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAA;AAC3F,OAAO,KAAK,EAC2B,oCAAoC,EAC1E,MAAM,4BAA4B,CAAA;AAGnC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAA2B,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAI1G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAyBrE,wFAAwF;AACxF,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,eAAe,CA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