@opendatalabs/personal-server-ts-lite 0.0.1-canary.052d47e → 0.0.1-canary.05cdd81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-mode-store.d.ts +11 -0
- package/dist/account-mode-store.d.ts.map +1 -0
- package/dist/account-mode-store.js +68 -0
- package/dist/account-mode-store.js.map +1 -0
- package/dist/additions-crypto.d.ts +3 -0
- package/dist/additions-crypto.d.ts.map +1 -0
- package/dist/additions-crypto.js +42 -0
- package/dist/additions-crypto.js.map +1 -0
- package/dist/additions-protocol.d.ts +56 -0
- package/dist/additions-protocol.d.ts.map +1 -0
- package/dist/additions-protocol.js +17 -0
- package/dist/additions-protocol.js.map +1 -0
- package/dist/additions-session.d.ts +20 -0
- package/dist/additions-session.d.ts.map +1 -0
- package/dist/additions-session.js +215 -0
- package/dist/additions-session.js.map +1 -0
- package/dist/additions-transport.d.ts +72 -0
- package/dist/additions-transport.d.ts.map +1 -0
- package/dist/additions-transport.js +428 -0
- package/dist/additions-transport.js.map +1 -0
- package/dist/additions-worker.bundle.js +31252 -0
- package/dist/additions-worker.d.ts +2 -0
- package/dist/additions-worker.d.ts.map +1 -0
- package/dist/additions-worker.js +308 -0
- package/dist/additions-worker.js.map +1 -0
- package/dist/bridge.d.ts +3 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js +4 -0
- package/dist/bridge.js.map +1 -1
- package/dist/browser-runtime.d.ts +111 -1
- package/dist/browser-runtime.d.ts.map +1 -1
- package/dist/browser-runtime.js +176 -11
- package/dist/browser-runtime.js.map +1 -1
- package/dist/canonical-persistence.d.ts +53 -0
- package/dist/canonical-persistence.d.ts.map +1 -0
- package/dist/canonical-persistence.js +13 -0
- package/dist/canonical-persistence.js.map +1 -0
- package/dist/canonical-store.d.ts +395 -0
- package/dist/canonical-store.d.ts.map +1 -0
- package/dist/canonical-store.js +1807 -0
- package/dist/canonical-store.js.map +1 -0
- package/dist/client.d.ts +24 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +214 -1
- package/dist/client.js.map +1 -1
- package/dist/derivatives.d.ts.map +1 -1
- package/dist/derivatives.js +4 -2
- package/dist/derivatives.js.map +1 -1
- package/dist/diagnostics.d.ts +3 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +9 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/history-probe-worker.bundle.js +31274 -0
- package/dist/history-probe.worker.d.ts +35 -0
- package/dist/history-probe.worker.d.ts.map +1 -0
- package/dist/history-probe.worker.js +161 -0
- package/dist/history-probe.worker.js.map +1 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/localdb-port.d.ts +28 -0
- package/dist/localdb-port.d.ts.map +1 -0
- package/dist/localdb-port.js +30 -0
- package/dist/localdb-port.js.map +1 -0
- package/dist/mcp-store.d.ts +1 -1
- package/dist/mcp-store.d.ts.map +1 -1
- package/dist/mcp-store.js +144 -15
- package/dist/mcp-store.js.map +1 -1
- package/dist/oura-import.d.ts +2 -0
- package/dist/oura-import.d.ts.map +1 -0
- package/dist/oura-import.js +3 -0
- package/dist/oura-import.js.map +1 -0
- package/dist/owner-binding.d.ts +5 -0
- package/dist/owner-binding.d.ts.map +1 -1
- package/dist/owner-binding.js +4 -8
- package/dist/owner-binding.js.map +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.d.ts.map +1 -1
- package/dist/persistence.js +2 -2
- package/dist/persistence.js.map +1 -1
- package/dist/pull-signals.d.ts +38 -0
- package/dist/pull-signals.d.ts.map +1 -0
- package/dist/pull-signals.js +73 -0
- package/dist/pull-signals.js.map +1 -0
- package/dist/relay-tls.d.ts.map +1 -1
- package/dist/relay-tls.js +10 -0
- package/dist/relay-tls.js.map +1 -1
- package/dist/relay.d.ts +91 -3
- package/dist/relay.d.ts.map +1 -1
- package/dist/relay.js +522 -75
- package/dist/relay.js.map +1 -1
- package/dist/replication-coordinator-state.d.ts +19 -0
- package/dist/replication-coordinator-state.d.ts.map +1 -0
- package/dist/replication-coordinator-state.js +20 -0
- package/dist/replication-coordinator-state.js.map +1 -0
- package/dist/replication-door.d.ts +17 -0
- package/dist/replication-door.d.ts.map +1 -0
- package/dist/replication-door.js +23 -0
- package/dist/replication-door.js.map +1 -0
- package/dist/replication-engine.d.ts +49 -0
- package/dist/replication-engine.d.ts.map +1 -0
- package/dist/replication-engine.js +589 -0
- package/dist/replication-engine.js.map +1 -0
- package/dist/replication-host.d.ts +92 -0
- package/dist/replication-host.d.ts.map +1 -0
- package/dist/replication-host.js +135 -0
- package/dist/replication-host.js.map +1 -0
- package/dist/replication-ports.d.ts +194 -0
- package/dist/replication-ports.d.ts.map +1 -0
- package/dist/replication-ports.js +58 -0
- package/dist/replication-ports.js.map +1 -0
- package/dist/replication-runtime.d.ts +64 -0
- package/dist/replication-runtime.d.ts.map +1 -0
- package/dist/replication-runtime.js +79 -0
- package/dist/replication-runtime.js.map +1 -0
- package/dist/replication-storage.d.ts +42 -0
- package/dist/replication-storage.d.ts.map +1 -0
- package/dist/replication-storage.js +173 -0
- package/dist/replication-storage.js.map +1 -0
- package/dist/runtime.d.ts +85 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +561 -37
- package/dist/runtime.js.map +1 -1
- package/dist/seed-staging.d.ts +8 -0
- package/dist/seed-staging.d.ts.map +1 -0
- package/dist/seed-staging.js +106 -0
- package/dist/seed-staging.js.map +1 -0
- package/dist/state.d.ts +16 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +93 -23
- package/dist/state.js.map +1 -1
- package/dist/storage-utils.d.ts.map +1 -1
- package/dist/storage-utils.js +11 -3
- package/dist/storage-utils.js.map +1 -1
- package/dist/storage.d.ts +59 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +601 -150
- package/dist/storage.js.map +1 -1
- package/dist/stream-sync-budget.d.ts +3 -0
- package/dist/stream-sync-budget.d.ts.map +1 -0
- package/dist/stream-sync-budget.js +3 -0
- package/dist/stream-sync-budget.js.map +1 -0
- package/dist/sync.d.ts +104 -3
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +377 -62
- package/dist/sync.js.map +1 -1
- package/package.json +12 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const inputSchema: z.ZodObject<{
|
|
3
|
+
ownerAddress: z.ZodString;
|
|
4
|
+
ownerSignature: z.ZodString;
|
|
5
|
+
storageEndpoint: z.ZodString;
|
|
6
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
7
|
+
scope: z.ZodString;
|
|
8
|
+
expectedVersion: z.ZodString;
|
|
9
|
+
storageVersion: z.ZodOptional<z.ZodString>;
|
|
10
|
+
dataHash: z.ZodString;
|
|
11
|
+
metadataHash: z.ZodString;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
/** Read-only candidate verification for an explicit Moksha recovery investigation.
|
|
15
|
+
* It never repairs objects or accepts uncommitted plaintext as history. */
|
|
16
|
+
export type OriginalHistoryProbeInput = z.input<typeof inputSchema>;
|
|
17
|
+
export type OriginalHistoryProbeCode = "read_failed" | "not_found" | "decrypt_failed" | "data_hash_mismatch" | "metadata_hash_mismatch" | "invalid_envelope" | "exact_commitment_match" | "budget_exceeded";
|
|
18
|
+
export type OriginalHistoryProbeMessage = {
|
|
19
|
+
kind: "candidate";
|
|
20
|
+
scope: string;
|
|
21
|
+
version: string;
|
|
22
|
+
storageVersion?: string;
|
|
23
|
+
namespace: "legacy" | "moksha";
|
|
24
|
+
code: OriginalHistoryProbeCode;
|
|
25
|
+
size?: number;
|
|
26
|
+
ciphertextHash?: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "complete";
|
|
29
|
+
inspected: number;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "refused";
|
|
32
|
+
code: "invalid_input_or_owner";
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=history-probe.worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-probe.worker.d.ts","sourceRoot":"","sources":["../src/history-probe.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,QAAA,MAAM,WAAW;;;;;;;;;;;iBAsBf,CAAC;AACH;2EAC2E;AAC3E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,WAAW,GACX,gBAAgB,GAChB,oBAAoB,GACpB,wBAAwB,GACxB,kBAAkB,GAClB,wBAAwB,GACxB,iBAAiB,CAAC;AACtB,MAAM,MAAM,2BAA2B,GACnC;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC/B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,wBAAwB,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { keccak256, stringToHex } from "viem";
|
|
3
|
+
import { DataFileEnvelopeSchema, deriveScopeKey, } from "@opendatalabs/vana-sdk/browser";
|
|
4
|
+
import { legacyMasterKey, recoverOwnerAddress, } from "@opendatalabs/personal-server-ts-core/keys";
|
|
5
|
+
import { AdditionsBudget, AdditionsBudgetExceeded, } from "@opendatalabs/personal-server-ts-core/additions";
|
|
6
|
+
import { decryptBoundedAdditions } from "./additions-crypto.js";
|
|
7
|
+
const hexHash = z.string().regex(/^0x[0-9a-fA-F]{64}$/);
|
|
8
|
+
const inputSchema = z.object({
|
|
9
|
+
ownerAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/),
|
|
10
|
+
ownerSignature: z.string().regex(/^0x[0-9a-fA-F]{130}$/),
|
|
11
|
+
storageEndpoint: z.string().url(),
|
|
12
|
+
candidates: z
|
|
13
|
+
.array(z.object({
|
|
14
|
+
scope: z
|
|
15
|
+
.string()
|
|
16
|
+
.regex(/^[a-zA-Z0-9._-]{1,256}$/)
|
|
17
|
+
.refine((scope) => scope !== "." && scope !== ".."),
|
|
18
|
+
expectedVersion: z.string().regex(/^[1-9][0-9]{0,63}$/),
|
|
19
|
+
storageVersion: z
|
|
20
|
+
.string()
|
|
21
|
+
.regex(/^\d{4}-\d{2}-\d{2}T\d{2}%3A\d{2}%3A\d{2}Z$/)
|
|
22
|
+
.optional(),
|
|
23
|
+
dataHash: hexHash,
|
|
24
|
+
metadataHash: hexHash,
|
|
25
|
+
}))
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(12),
|
|
28
|
+
});
|
|
29
|
+
const worker = globalThis;
|
|
30
|
+
worker.onmessage = async ({ data }) => {
|
|
31
|
+
worker.onmessage = null;
|
|
32
|
+
let master;
|
|
33
|
+
try {
|
|
34
|
+
const input = inputSchema.parse(data);
|
|
35
|
+
const endpoint = new URL(input.storageEndpoint);
|
|
36
|
+
if ((endpoint.origin !== "https://storage-dev.vana.org" &&
|
|
37
|
+
!(endpoint.protocol === "http:" && endpoint.hostname === "127.0.0.1")) ||
|
|
38
|
+
endpoint.pathname !== "/" ||
|
|
39
|
+
endpoint.search ||
|
|
40
|
+
endpoint.hash ||
|
|
41
|
+
endpoint.username ||
|
|
42
|
+
endpoint.password)
|
|
43
|
+
throw new Error();
|
|
44
|
+
const owner = input.ownerAddress.toLowerCase();
|
|
45
|
+
if ((await recoverOwnerAddress(input.ownerSignature)).toLowerCase() !== owner)
|
|
46
|
+
throw new Error();
|
|
47
|
+
master = legacyMasterKey(input.ownerSignature);
|
|
48
|
+
const budget = new AdditionsBudget(32 * 1024 * 1024, 120_000);
|
|
49
|
+
let inspected = 0;
|
|
50
|
+
outer: for (const candidate of input.candidates) {
|
|
51
|
+
for (const namespace of ["legacy", "moksha"]) {
|
|
52
|
+
if (budget.signal?.aborted || budget.remaining <= 0)
|
|
53
|
+
break;
|
|
54
|
+
let exhausted = false;
|
|
55
|
+
let code = "read_failed";
|
|
56
|
+
let size;
|
|
57
|
+
let ciphertextHash;
|
|
58
|
+
const signal = AbortSignal.any([
|
|
59
|
+
budget.signal,
|
|
60
|
+
AbortSignal.timeout(10_000),
|
|
61
|
+
]);
|
|
62
|
+
try {
|
|
63
|
+
budget.charge();
|
|
64
|
+
const prefix = namespace === "legacy" ? "v1/blobs" : "v1/chains/14800/blobs";
|
|
65
|
+
const response = await fetch(`${endpoint.origin}/${prefix}/${owner}/${candidate.scope}/${candidate.storageVersion ?? candidate.expectedVersion}`, {
|
|
66
|
+
method: "GET",
|
|
67
|
+
credentials: "omit",
|
|
68
|
+
redirect: "error",
|
|
69
|
+
cache: "no-store",
|
|
70
|
+
signal,
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok)
|
|
73
|
+
code = response.status === 404 ? "not_found" : "read_failed";
|
|
74
|
+
else {
|
|
75
|
+
const reader = response.body.getReader();
|
|
76
|
+
const chunks = [];
|
|
77
|
+
let length = 0;
|
|
78
|
+
try {
|
|
79
|
+
while (true) {
|
|
80
|
+
const part = await reader.read();
|
|
81
|
+
if (part.done)
|
|
82
|
+
break;
|
|
83
|
+
length += part.value.length;
|
|
84
|
+
budget.charge(part.value.length * 2);
|
|
85
|
+
if (length > 2 * 1024 * 1024)
|
|
86
|
+
throw new Error();
|
|
87
|
+
chunks.push(part.value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
await reader.cancel();
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
const encrypted = new Uint8Array(length);
|
|
95
|
+
let offset = 0;
|
|
96
|
+
for (const chunk of chunks) {
|
|
97
|
+
encrypted.set(chunk, offset);
|
|
98
|
+
offset += chunk.length;
|
|
99
|
+
}
|
|
100
|
+
size = length;
|
|
101
|
+
ciphertextHash = keccak256(encrypted);
|
|
102
|
+
code = "decrypt_failed";
|
|
103
|
+
const password = Array.from(deriveScopeKey(master, candidate.scope), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
104
|
+
const plaintext = await decryptBoundedAdditions(encrypted, password, budget);
|
|
105
|
+
budget.charge(plaintext.byteLength);
|
|
106
|
+
if (keccak256(plaintext).toLowerCase() !==
|
|
107
|
+
candidate.dataHash.toLowerCase())
|
|
108
|
+
code = "data_hash_mismatch";
|
|
109
|
+
else {
|
|
110
|
+
code = "invalid_envelope";
|
|
111
|
+
budget.charge(plaintext.byteLength * 3);
|
|
112
|
+
const envelope = DataFileEnvelopeSchema.parse(JSON.parse(new TextDecoder().decode(plaintext)));
|
|
113
|
+
const metadataHash = keccak256(stringToHex(JSON.stringify({
|
|
114
|
+
scope: candidate.scope,
|
|
115
|
+
collectedAt: envelope.collectedAt,
|
|
116
|
+
sizeBytes: length,
|
|
117
|
+
})));
|
|
118
|
+
code =
|
|
119
|
+
envelope.scope === candidate.scope &&
|
|
120
|
+
Number.isFinite(Date.parse(envelope.collectedAt)) &&
|
|
121
|
+
metadataHash.toLowerCase() ===
|
|
122
|
+
candidate.metadataHash.toLowerCase()
|
|
123
|
+
? "exact_commitment_match"
|
|
124
|
+
: "metadata_hash_mismatch";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (error instanceof AdditionsBudgetExceeded ||
|
|
130
|
+
budget.signal?.aborted ||
|
|
131
|
+
signal.aborted)
|
|
132
|
+
code = "budget_exceeded";
|
|
133
|
+
exhausted =
|
|
134
|
+
error instanceof AdditionsBudgetExceeded ||
|
|
135
|
+
Boolean(budget.signal?.aborted);
|
|
136
|
+
}
|
|
137
|
+
inspected++;
|
|
138
|
+
worker.postMessage({
|
|
139
|
+
kind: "candidate",
|
|
140
|
+
scope: candidate.scope,
|
|
141
|
+
version: candidate.expectedVersion,
|
|
142
|
+
storageVersion: candidate.storageVersion,
|
|
143
|
+
namespace,
|
|
144
|
+
code,
|
|
145
|
+
size,
|
|
146
|
+
ciphertextHash,
|
|
147
|
+
});
|
|
148
|
+
if (exhausted)
|
|
149
|
+
break outer;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
worker.postMessage({ kind: "complete", inspected });
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
worker.postMessage({ kind: "refused", code: "invalid_input_or_owner" });
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
master?.fill(0);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=history-probe.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-probe.worker.js","sourceRoot":"","sources":["../src/history-probe.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,eAAe,EACf,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,eAAe,EACf,uBAAuB,GACxB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACxD,MAA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,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAC1E,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
+
export type { PublicationReceipt, ViewChange, ViewChangeListener, } from "@opendatalabs/personal-server-ts-core/localdb";
|
|
1
2
|
export { createIndexedDbPsLiteRuntime, type IndexedDbPsLiteRuntime, type IndexedDbPsLiteRuntimeOptions, } from "./browser-runtime.js";
|
|
2
|
-
export { startPersonalServer, type StartPersonalServerLiteOptions, type StartPersonalServerLiteRelayOptions, } from "./client.js";
|
|
3
|
+
export { startPersonalServer, type PersonalServerLiteHandle, type PersonalServerLitePublicationResult, type StartPersonalServerLiteOptions, type StartPersonalServerLiteRelayOptions, } from "./client.js";
|
|
3
4
|
export type { PersonalServerHandle, PersonalServerClientErrorBody, PersonalServerDataVersion, PersonalServerHealthRegistration, PersonalServerIdentity, PersonalServerInfo, PersonalServerAuthRequestOptions, PersonalServerListDataOptions, PersonalServerListDataResult, PersonalServerListVersionsOptions, PersonalServerListVersionsResult, PersonalServerReadDataOptions, PersonalServerRegistrationRequest, PersonalServerStatus, PersonalServerSyncTriggerResult, PersonalServerUrls, } from "@opendatalabs/personal-server-ts-core/client";
|
|
4
5
|
export { PersonalServerClientError, dataListPath, dataReadPath, dataVersionsPath, parsePersonalServerJsonResponse, } from "@opendatalabs/personal-server-ts-core/client";
|
|
5
6
|
export { handlePsLiteBridgeRequest, type PsLiteBridgeRequest, type PsLiteBridgeResponse, } from "./bridge.js";
|
|
6
7
|
export { createIndexedDbPsLitePersistence, createOpfsPsLiteDataFileStore, createPersistentPsLiteStorage, isOpfsAvailable, type IndexedDbPsLitePersistenceOptions, type PsLiteDataFileStore, type PsLiteFileStorageKind, type PsLitePersistedStorageState, type PsLitePersistenceAdapter, type PsLiteStorageCapabilities, type PsLiteStoragePort, } from "./storage.js";
|
|
7
|
-
export { createIndexedDbPsLiteAccessLogStore, createIndexedDbPsLiteStateStore, createIndexedDbPsLiteTokenStore, loadOrCreatePsLiteConfig, loadOrCreatePsLiteServerIdentity, loadPsLiteRelayState, savePsLiteConfig, savePsLiteRelayState, type IndexedDbPsLiteAccessLogStoreOptions, type IndexedDbPsLiteStateStoreOptions, type IndexedDbPsLiteTokenStoreOptions, type PsLiteEncryptedPrivateKey, type PsLiteEncryptedServerIdentity, type PsLiteRelayState, type PsLiteStateKey, type PsLiteStateStore, type PsLiteUnlockedServerIdentity, } from "./state.js";
|
|
8
|
-
export { createPsLitePendingBlobDeletionStore, createPsLiteSyncCursor, createPsLiteSyncManager, type PsLiteSyncOptions, } from "./sync.js";
|
|
8
|
+
export { createIndexedDbPsLiteAccessLogStore, createIndexedDbPsLiteStateStore, createIndexedDbPsLiteTokenStore, loadOrCreatePsLiteConfig, loadOrCreatePsLiteServerIdentity, loadPsLiteRelayState, savePsLiteConfig, savePsLiteRelayState, type IndexedDbPsLiteAccessLogStoreOptions, type IndexedDbPsLiteStateStoreOptions, type IndexedDbPsLiteTokenStoreOptions, type PsLiteEncryptedPrivateKey, type PsLiteEncryptedServerIdentity, type PsLiteRelayState, type PsLiteStateKey, type PsLiteStateStore, type PsLiteBoundedStateStore, type PsLiteUnlockedServerIdentity, } from "./state.js";
|
|
9
|
+
export { createPsLitePendingBlobDeletionStore, createPsLiteSyncCursor, createPsLiteUploadAttemptStore, createPsLiteSyncManager, type PsLiteSyncOptions, type PsLiteOwnerSyncSigner, } from "./sync.js";
|
|
10
|
+
export { openLiteLocalDb, type LiteLocalDbOptions, type LiteSqlDriverFactory, } from "./localdb-port.js";
|
|
9
11
|
export { resolvePsLiteOwner, type PsLiteOwnerBindingInput, } from "./owner-binding.js";
|
|
10
12
|
export { createPsLiteDerivativeCompute, createPsLiteQuestionStore, psLiteInferenceConfigured, type PsLiteDerivativeCompute, type PsLiteDerivativeComputeOptions, } from "./derivatives.js";
|
|
11
13
|
export { createBearerTokenPsLiteAuth, createPsLiteRuntime, createWeb3SignedPsLiteAuth, type BearerTokenPsLiteAuthOptions, type PsLiteAuthAdapter, type PsLiteReadAuthInput, type PsLiteRuntime, type PsLiteRuntimeOptions, type PsLiteStorageAdapter, type PsLiteTokenStore, type PsLiteWriteSessionAuthOptions, type Web3SignedPsLiteAuthOptions, } from "./runtime.js";
|
|
12
14
|
export { createInMemoryWriteProofReplayStore, createInMemoryWriteSessionStore, hashWriteSessionToken, verifyStoredWriterAttribution, WRITE_SIGNATURE_HEADER, WRITER_ATTRIBUTION_KEY, type WriteProofReplayStore, type WriteSessionRecord, type WriteSessionStore, } from "@opendatalabs/personal-server-ts-core/write";
|
|
13
15
|
export { createIndexedDbMcpConnectionStore, createIndexedDbMcpOAuthAuthorizationStore, type IndexedDbMcpConnectionStoreOptions, type IndexedDbMcpOAuthAuthorizationStoreOptions, } from "./mcp-store.js";
|
|
14
16
|
export { DiagnosticsRecorder, collectDiagnosticsWithTimeout, DIAGNOSTICS_VERSION, type ActiveOperation, type DiagnosticsEvent, type DiagnosticsPhase, type LastNetworkOperation, type PsLiteDiagnosticsSnapshot, type RecordEventOptions, type ScopeDiagnostics, type ScopeReadinessStatus, type StorageHealthSummary, type SyncDiagnostics, } from "./diagnostics.js";
|
|
15
|
-
export { decodeDataFrame, encodeDataFrame, psLiteRelayControlUrl, psLiteRelayPublicUrl, RELAY_CLOSE_SESSION_REPLACED, startPsLiteRelayClient, type PsLiteRelayClient, type PsLiteRelayClientOptions, type PsLiteRelayCloseEvent, type PsLiteRelayStatus, type PsLiteRelayTlsFactory, type PsLiteRelayTlsPrepareInput, type PsLiteRelayTlsStep, type PsLiteRelayTlsStream, type PsLiteRelayTlsStreamInput, type PsLiteRelayWebSocket, type PsLiteRelayWebSocketFactory, } from "./relay.js";
|
|
17
|
+
export { decodeDataFrame, encodeDataFrame, psLiteRelayControlUrl, psLiteRelayPublicUrl, RELAY_CLOSE_SESSION_REPLACED, startPsLiteRelayClient, type PsLiteRelayClient, type PsLiteAppVisibility, type PsLiteReadEvent, type PsLiteReadOutcome, type PsLiteRelayClientOptions, type PsLiteRelayCloseEvent, type PsLiteRelayStatus, type PsLiteRelayTlsFactory, type PsLiteRelayTlsPrepareInput, type PsLiteRelayTlsStep, type PsLiteRelayTlsStream, type PsLiteRelayTlsStreamInput, type PsLiteRelayWebSocket, type PsLiteRelayWebSocketFactory, } from "./relay.js";
|
|
16
18
|
export { createLocalStoragePsLiteRelayTlsIdentityStore, createRustlsPsLiteRelayTlsFactory, psLiteRelayPublicHost, psLiteRelayPublicUrl as psLiteRelayTlsPublicUrl, type PsLiteRelayTlsIdentity, type PsLiteRelayTlsIdentityStore, type RustlsPsLiteRelayTlsOptions, } from "./relay-tls.js";
|
|
17
19
|
export { assertCompletePsLitePersistenceBundle, psLitePersistenceRuntimeOptions, type PsLitePersistenceBundle, type PsLitePersistenceRuntimeOptions, } from "./persistence.js";
|
|
20
|
+
export { createLiteCanonicalStore, LiteCanonicalRefusal, litePendingFingerprint, type LiteCommitReceipt, type LiteReplicaReadOptions, type LiteVisibleRecord, type LiteOperationDraft, } from "./canonical-store.js";
|
|
21
|
+
export { LITE_CANONICAL_BATCH_BYTES, LITE_CANONICAL_MAX_OPERATION_BYTES, LITE_CANONICAL_MAX_VALUE_BYTES, type LiteCanonicalPersistence, type LiteCanonicalTransaction, type LiteBlobDescriptor, type LiteStorageEntry, type LiteStoragePage, } from "./canonical-persistence.js";
|
|
22
|
+
export { LITE_MAX_FRAGMENT_BYTES, LITE_REPLICA_SQL_BYTES, LITE_REPLICATION_LIMITS, LiteReplicaTransferError, replicationBootConfigProblem, type LiteReplicaBytes, type LiteReplicaBytesInfo, type LiteReplicaNetwork, type LiteReplicaObjectTransfers, type LiteReplicaTransferCall, type LiteReplicaTransferFailure, type LiteReplicaPersistence, type LiteReplicaSql, type LiteReplicaTransaction, type LiteReplicationEngine, type LiteReplicationTrigger, type ReplicationBootConfig, type ReplicationLimits, } from "./replication-ports.js";
|
|
23
|
+
export { acquireLiteReplicaOwner, createLiteReplicaCoordinatorState, } from "./replication-coordinator-state.js";
|
|
24
|
+
export { createLiteReplicaEngine, type LiteReplicaEngine, type LiteReplicaEngineInput, } from "./replication-engine.js";
|
|
25
|
+
export { LITE_REPLICA_TRANSFER_DEADLINE_MS, createLiteReplicaStorage, type LiteReplicaUploadHeaders, type LiteTransientBytesInUse, } from "./replication-storage.js";
|
|
26
|
+
export { createLiteReplication, liteTargetChunkBytes, liteVanaReplicaObjects, type LiteReplication, type LiteReplicationInput, } from "./replication-host.js";
|
|
27
|
+
export { LITE_REPLICATION_PAUSE_GRACE_MS, createLiteReplicationRuntime, type LiteReplicationRuntime, type LiteReplicationStatus, } from "./replication-runtime.js";
|
|
28
|
+
export { importOuraBrowserRecords, type OuraBrowserImportInput, type OuraBrowserImportOptions, type OuraBrowserImportResult, type OuraImportReceipt, } from "./oura-import.js";
|
|
29
|
+
export { OURA_LEGACY_TAKEOVER_CONTRACT } from "@opendatalabs/personal-server-ts-core/api";
|
|
30
|
+
export type { SeedIntake } from "@opendatalabs/personal-server-ts-core/localdb";
|
|
18
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GACnC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EACnB,KAAK,8BAA8B,EACnC,KAAK,mCAAmC,GACzC,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,oBAAoB,EACpB,6BAA6B,EAC7B,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EACtB,kBAAkB,EAClB,gCAAgC,EAChC,6BAA6B,EAC7B,4BAA4B,EAC5B,iCAAiC,EACjC,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EAC/B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iCAAiC,EACjC,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAE1F,YAAY,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,8 @@ export { PersonalServerClientError, dataListPath, dataReadPath, dataVersionsPath
|
|
|
4
4
|
export { handlePsLiteBridgeRequest, } from "./bridge.js";
|
|
5
5
|
export { createIndexedDbPsLitePersistence, createOpfsPsLiteDataFileStore, createPersistentPsLiteStorage, isOpfsAvailable, } from "./storage.js";
|
|
6
6
|
export { createIndexedDbPsLiteAccessLogStore, createIndexedDbPsLiteStateStore, createIndexedDbPsLiteTokenStore, loadOrCreatePsLiteConfig, loadOrCreatePsLiteServerIdentity, loadPsLiteRelayState, savePsLiteConfig, savePsLiteRelayState, } from "./state.js";
|
|
7
|
-
export { createPsLitePendingBlobDeletionStore, createPsLiteSyncCursor, createPsLiteSyncManager, } from "./sync.js";
|
|
7
|
+
export { createPsLitePendingBlobDeletionStore, createPsLiteSyncCursor, createPsLiteUploadAttemptStore, createPsLiteSyncManager, } from "./sync.js";
|
|
8
|
+
export { openLiteLocalDb, } from "./localdb-port.js";
|
|
8
9
|
export { resolvePsLiteOwner, } from "./owner-binding.js";
|
|
9
10
|
export { createPsLiteDerivativeCompute, createPsLiteQuestionStore, psLiteInferenceConfigured, } from "./derivatives.js";
|
|
10
11
|
export { createBearerTokenPsLiteAuth, createPsLiteRuntime, createWeb3SignedPsLiteAuth, } from "./runtime.js";
|
|
@@ -16,4 +17,14 @@ export { DiagnosticsRecorder, collectDiagnosticsWithTimeout, DIAGNOSTICS_VERSION
|
|
|
16
17
|
export { decodeDataFrame, encodeDataFrame, psLiteRelayControlUrl, psLiteRelayPublicUrl, RELAY_CLOSE_SESSION_REPLACED, startPsLiteRelayClient, } from "./relay.js";
|
|
17
18
|
export { createLocalStoragePsLiteRelayTlsIdentityStore, createRustlsPsLiteRelayTlsFactory, psLiteRelayPublicHost, psLiteRelayPublicUrl as psLiteRelayTlsPublicUrl, } from "./relay-tls.js";
|
|
18
19
|
export { assertCompletePsLitePersistenceBundle, psLitePersistenceRuntimeOptions, } from "./persistence.js";
|
|
20
|
+
export { createLiteCanonicalStore, LiteCanonicalRefusal, litePendingFingerprint, } from "./canonical-store.js";
|
|
21
|
+
export { LITE_CANONICAL_BATCH_BYTES, LITE_CANONICAL_MAX_OPERATION_BYTES, LITE_CANONICAL_MAX_VALUE_BYTES, } from "./canonical-persistence.js";
|
|
22
|
+
export { LITE_MAX_FRAGMENT_BYTES, LITE_REPLICA_SQL_BYTES, LITE_REPLICATION_LIMITS, LiteReplicaTransferError, replicationBootConfigProblem, } from "./replication-ports.js";
|
|
23
|
+
export { acquireLiteReplicaOwner, createLiteReplicaCoordinatorState, } from "./replication-coordinator-state.js";
|
|
24
|
+
export { createLiteReplicaEngine, } from "./replication-engine.js";
|
|
25
|
+
export { LITE_REPLICA_TRANSFER_DEADLINE_MS, createLiteReplicaStorage, } from "./replication-storage.js";
|
|
26
|
+
export { createLiteReplication, liteTargetChunkBytes, liteVanaReplicaObjects, } from "./replication-host.js";
|
|
27
|
+
export { LITE_REPLICATION_PAUSE_GRACE_MS, createLiteReplicationRuntime, } from "./replication-runtime.js";
|
|
28
|
+
export { importOuraBrowserRecords, } from "./oura-import.js";
|
|
29
|
+
export { OURA_LEGACY_TAKEOVER_CONTRACT } from "@opendatalabs/personal-server-ts-core/api";
|
|
19
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,4BAA4B,GAG7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,GAKpB,MAAM,aAAa,CAAC;AAmBrB,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EACL,yBAAyB,GAG1B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,6BAA6B,EAC7B,eAAe,GAQhB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAC/B,+BAA+B,EAC/B,wBAAwB,EACxB,gCAAgC,EAChC,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,GAWrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oCAAoC,EACpC,sBAAsB,EAC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B,EACvB,iCAAiC,GAClC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,uBAAuB,GAGxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iCAAiC,EACjC,wBAAwB,GAGzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,GAG7B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,wBAAwB,GAKzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type SqlDriver } from "@opendatalabs/personal-server-ts-core/localdb";
|
|
2
|
+
/**
|
|
3
|
+
* Lite's database port (PS-2, B.3/B.4). The host (Web Worker, phone `psSql`
|
|
4
|
+
* bridge, or a test) supplies one factory; Lite opens the database through it
|
|
5
|
+
* with `openLocalDb` and runs `createLocalSync` on the result. Lite owns no
|
|
6
|
+
* SQL driver of its own. `persistent: false` = memory mode (DB6).
|
|
7
|
+
*/
|
|
8
|
+
export type LiteSqlDriverFactory = (request: {
|
|
9
|
+
/** `localDatabaseName(owner, network)`. */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly owner: string;
|
|
12
|
+
readonly network: string;
|
|
13
|
+
}) => Promise<SqlDriver | null>;
|
|
14
|
+
export interface LiteLocalDbOptions {
|
|
15
|
+
/** The host holds the database exclusively until the driver is closed. */
|
|
16
|
+
readonly openDriver: LiteSqlDriverFactory;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Opens the host's driver and the shared database for one owner and network;
|
|
20
|
+
* `null` when the host cannot hold the database (the caller then treats stream
|
|
21
|
+
* sync as unavailable in this process).
|
|
22
|
+
*/
|
|
23
|
+
export declare function openLiteLocalDb(options: LiteLocalDbOptions, identity: {
|
|
24
|
+
readonly owner: string;
|
|
25
|
+
readonly network: string;
|
|
26
|
+
readonly deviceId: string;
|
|
27
|
+
}): Promise<SqlDriver | null>;
|
|
28
|
+
//# sourceMappingURL=localdb-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localdb-port.d.ts","sourceRoot":"","sources":["../src/localdb-port.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,+CAA+C,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE;IAC3C,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;AAEhC,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;CAC3C;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE;IACR,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,GACA,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAmB3B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { localDatabaseName, openLocalDb, } from "@opendatalabs/personal-server-ts-core/localdb";
|
|
2
|
+
/**
|
|
3
|
+
* Opens the host's driver and the shared database for one owner and network;
|
|
4
|
+
* `null` when the host cannot hold the database (the caller then treats stream
|
|
5
|
+
* sync as unavailable in this process).
|
|
6
|
+
*/
|
|
7
|
+
export async function openLiteLocalDb(options, identity) {
|
|
8
|
+
const owner = identity.owner.toLowerCase();
|
|
9
|
+
const driver = await options.openDriver({
|
|
10
|
+
name: localDatabaseName(owner, identity.network),
|
|
11
|
+
owner,
|
|
12
|
+
network: identity.network,
|
|
13
|
+
});
|
|
14
|
+
if (driver === null)
|
|
15
|
+
return null;
|
|
16
|
+
try {
|
|
17
|
+
return await openLocalDb(driver, { ...identity, owner });
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
// Release the host lock even when migration or identity checks fail.
|
|
21
|
+
try {
|
|
22
|
+
await driver.close();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Preserve the error that prevented the database from opening.
|
|
26
|
+
}
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=localdb-port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localdb-port.js","sourceRoot":"","sources":["../src/localdb-port.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,GAEZ,MAAM,+CAA+C,CAAC;AAoBvD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA2B,EAC3B,QAIC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,EAAE,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;QAChD,KAAK;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC,CAAC;IACH,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACjC,IAAI,CAAC;QACH,OAAO,MAAM,WAAW,CAAC,MAAM,EAAE,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,qEAAqE;QACrE,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,+DAA+D;QACjE,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/mcp-store.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* prior Claude connection on every reload, indistinguishable from a real
|
|
22
22
|
* revoke from the user's perspective.
|
|
23
23
|
*/
|
|
24
|
-
import type
|
|
24
|
+
import { type McpConnectionStore, type McpOAuthAuthorizationStore } from "@opendatalabs/personal-server-ts-core/mcp";
|
|
25
25
|
export interface IndexedDbMcpConnectionStoreOptions {
|
|
26
26
|
dbName?: string;
|
|
27
27
|
storeName?: string;
|
package/dist/mcp-store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-store.d.ts","sourceRoot":"","sources":["../src/mcp-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mcp-store.d.ts","sourceRoot":"","sources":["../src/mcp-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAML,KAAK,kBAAkB,EAEvB,KAAK,0BAA0B,EAChC,MAAM,2CAA2C,CAAC;AAqBnD,MAAM,WAAW,kCAAkC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,0CAA0C;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA2MD,wBAAgB,iCAAiC,CAC/C,OAAO,GAAE,kCAAuC,GAC/C,kBAAkB,CA4IpB;AAED,wBAAgB,yCAAyC,CACvD,OAAO,GAAE,0CAA+C,GACvD,0BAA0B,CA0E5B"}
|
package/dist/mcp-store.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* prior Claude connection on every reload, indistinguishable from a real
|
|
22
22
|
* revoke from the user's perspective.
|
|
23
23
|
*/
|
|
24
|
+
import { isMcpTokenExpired, isPreExpiryMcpRecord, matchesMcpRefreshHash, nextMcpConnectionRevision, } from "@opendatalabs/personal-server-ts-core/mcp";
|
|
24
25
|
const DEFAULT_DB_NAME = "personal-server-lite";
|
|
25
26
|
const DEFAULT_STORE_NAME = "mcpConnections";
|
|
26
27
|
const DEFAULT_AUTHORIZATION_STORE_NAME = "mcpOAuthAuthorizations";
|
|
@@ -75,16 +76,45 @@ function openDb(opts, indexes) {
|
|
|
75
76
|
}
|
|
76
77
|
function runTx(opts, mode, indexes, fn) {
|
|
77
78
|
return openDb(opts, indexes).then((db) => new Promise((resolve, reject) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
let settled = false;
|
|
80
|
+
let result;
|
|
81
|
+
const closeDb = () => {
|
|
82
|
+
try {
|
|
83
|
+
db.close();
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// The transaction result or error remains the useful outcome.
|
|
87
|
+
}
|
|
87
88
|
};
|
|
89
|
+
const resolveOnce = (value) => {
|
|
90
|
+
if (settled)
|
|
91
|
+
return;
|
|
92
|
+
settled = true;
|
|
93
|
+
closeDb();
|
|
94
|
+
resolve(value);
|
|
95
|
+
};
|
|
96
|
+
const rejectOnce = (error) => {
|
|
97
|
+
if (settled)
|
|
98
|
+
return;
|
|
99
|
+
settled = true;
|
|
100
|
+
closeDb();
|
|
101
|
+
reject(error);
|
|
102
|
+
};
|
|
103
|
+
try {
|
|
104
|
+
const transaction = db.transaction(opts.storeName, mode);
|
|
105
|
+
const store = transaction.objectStore(opts.storeName);
|
|
106
|
+
const request = fn(store);
|
|
107
|
+
request.onsuccess = () => {
|
|
108
|
+
result = request.result;
|
|
109
|
+
};
|
|
110
|
+
request.onerror = () => rejectOnce(request.error ?? new Error("IndexedDB request failed"));
|
|
111
|
+
transaction.oncomplete = () => resolveOnce(result);
|
|
112
|
+
transaction.onerror = () => rejectOnce(transaction.error ?? new Error("IndexedDB transaction failed"));
|
|
113
|
+
transaction.onabort = () => rejectOnce(transaction.error ?? new Error("IndexedDB transaction aborted"));
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
rejectOnce(error);
|
|
117
|
+
}
|
|
88
118
|
}));
|
|
89
119
|
}
|
|
90
120
|
function runIndexQuery(opts, indexName, indexes, fn) {
|
|
@@ -101,6 +131,54 @@ function runIndexQuery(opts, indexName, indexes, fn) {
|
|
|
101
131
|
};
|
|
102
132
|
}));
|
|
103
133
|
}
|
|
134
|
+
function mutateConnectionRecord(opts, id, update) {
|
|
135
|
+
return openDb(opts, CONNECTION_INDEXES).then((db) => new Promise((resolve, reject) => {
|
|
136
|
+
const transaction = db.transaction(opts.storeName, "readwrite");
|
|
137
|
+
const store = transaction.objectStore(opts.storeName);
|
|
138
|
+
const request = store.get(id);
|
|
139
|
+
let result = null;
|
|
140
|
+
let settled = false;
|
|
141
|
+
const resolveOnce = (value) => {
|
|
142
|
+
if (settled)
|
|
143
|
+
return;
|
|
144
|
+
settled = true;
|
|
145
|
+
db.close();
|
|
146
|
+
resolve(value);
|
|
147
|
+
};
|
|
148
|
+
const rejectOnce = (error) => {
|
|
149
|
+
if (settled)
|
|
150
|
+
return;
|
|
151
|
+
settled = true;
|
|
152
|
+
db.close();
|
|
153
|
+
reject(error);
|
|
154
|
+
};
|
|
155
|
+
request.onsuccess = () => {
|
|
156
|
+
if (!request.result)
|
|
157
|
+
return;
|
|
158
|
+
try {
|
|
159
|
+
const next = update(structuredClone(request.result));
|
|
160
|
+
result = {
|
|
161
|
+
...next,
|
|
162
|
+
revision: nextMcpConnectionRevision(request.result, next),
|
|
163
|
+
};
|
|
164
|
+
store.put(result);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
try {
|
|
168
|
+
transaction.abort();
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// The transaction may already be inactive; settle with the update error.
|
|
172
|
+
}
|
|
173
|
+
rejectOnce(error);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
request.onerror = () => rejectOnce(request.error ?? new Error("IndexedDB request failed"));
|
|
177
|
+
transaction.oncomplete = () => resolveOnce(result ? structuredClone(result) : null);
|
|
178
|
+
transaction.onerror = () => rejectOnce(transaction.error ?? new Error("IndexedDB transaction failed"));
|
|
179
|
+
transaction.onabort = () => rejectOnce(transaction.error ?? new Error("IndexedDB transaction aborted"));
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
104
182
|
export function createIndexedDbMcpConnectionStore(options = {}) {
|
|
105
183
|
const resolved = {
|
|
106
184
|
dbName: options.dbName ?? DEFAULT_DB_NAME,
|
|
@@ -114,6 +192,46 @@ export function createIndexedDbMcpConnectionStore(options = {}) {
|
|
|
114
192
|
}
|
|
115
193
|
await runTx(resolved, "readwrite", CONNECTION_INDEXES, (store) => store.put({ ...record }));
|
|
116
194
|
},
|
|
195
|
+
replacePendingOAuthConnections(clientId, expiredBefore, replacement) {
|
|
196
|
+
if (replacement.status !== "pending" ||
|
|
197
|
+
replacement.clientId !== clientId) {
|
|
198
|
+
return Promise.reject(new Error("OAuth replacement must be pending for its client"));
|
|
199
|
+
}
|
|
200
|
+
return openDb(resolved, CONNECTION_INDEXES).then((db) => new Promise((resolve, reject) => {
|
|
201
|
+
const transaction = db.transaction(resolved.storeName, "readwrite");
|
|
202
|
+
const store = transaction.objectStore(resolved.storeName);
|
|
203
|
+
const request = store.getAll();
|
|
204
|
+
request.onsuccess = () => {
|
|
205
|
+
for (const record of request.result) {
|
|
206
|
+
const expired = Date.parse(record.createdAt) <= expiredBefore;
|
|
207
|
+
if (record.status !== "pending" ||
|
|
208
|
+
!record.clientId ||
|
|
209
|
+
(record.clientId !== clientId && !expired)) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
store.put({
|
|
213
|
+
...record,
|
|
214
|
+
status: "revoked",
|
|
215
|
+
revokedAt: replacement.createdAt,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
store.add({ ...replacement });
|
|
219
|
+
};
|
|
220
|
+
request.onerror = () => reject(request.error);
|
|
221
|
+
transaction.oncomplete = () => {
|
|
222
|
+
db.close();
|
|
223
|
+
resolve();
|
|
224
|
+
};
|
|
225
|
+
transaction.onerror = () => {
|
|
226
|
+
db.close();
|
|
227
|
+
reject(transaction.error);
|
|
228
|
+
};
|
|
229
|
+
transaction.onabort = () => {
|
|
230
|
+
db.close();
|
|
231
|
+
reject(transaction.error);
|
|
232
|
+
};
|
|
233
|
+
}));
|
|
234
|
+
},
|
|
117
235
|
async list() {
|
|
118
236
|
const all = await runTx(resolved, "readonly", CONNECTION_INDEXES, (store) => store.getAll());
|
|
119
237
|
return all.map((r) => ({ ...r }));
|
|
@@ -128,15 +246,26 @@ export function createIndexedDbMcpConnectionStore(options = {}) {
|
|
|
128
246
|
return null;
|
|
129
247
|
if (record.status !== "approved")
|
|
130
248
|
return null;
|
|
249
|
+
// Web owners' connections from PS-Lite < 1.17 have no stored lifetime
|
|
250
|
+
// and no refresh token; keep them working rather than force a
|
|
251
|
+
// re-consent on every one of them.
|
|
252
|
+
if (!isPreExpiryMcpRecord(record) && isMcpTokenExpired(record)) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
131
255
|
return { ...record };
|
|
132
256
|
},
|
|
257
|
+
async getByRefreshTokenHash(refreshTokenHash) {
|
|
258
|
+
// No IndexedDB index: a presented token may match either the current or
|
|
259
|
+
// the rotated-out hash, and the store holds a handful of connections.
|
|
260
|
+
const all = await runTx(resolved, "readonly", CONNECTION_INDEXES, (store) => store.getAll());
|
|
261
|
+
const record = all.find((candidate) => matchesMcpRefreshHash(candidate, refreshTokenHash));
|
|
262
|
+
return record ? { ...record } : null;
|
|
263
|
+
},
|
|
264
|
+
mutate(id, update) {
|
|
265
|
+
return mutateConnectionRecord(resolved, id, update);
|
|
266
|
+
},
|
|
133
267
|
async update(id, patch) {
|
|
134
|
-
|
|
135
|
-
if (!existing)
|
|
136
|
-
return null;
|
|
137
|
-
const updated = { ...existing, ...patch };
|
|
138
|
-
await runTx(resolved, "readwrite", CONNECTION_INDEXES, (store) => store.put(updated));
|
|
139
|
-
return { ...updated };
|
|
268
|
+
return mutateConnectionRecord(resolved, id, (existing) => ({ ...existing, ...patch }));
|
|
140
269
|
},
|
|
141
270
|
};
|
|
142
271
|
}
|