@muhkoo/connect 0.15.0-alpha.0 → 0.15.0-alpha.10
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/browser/blockEngine.worker.js.map +1 -1
- package/dist/browser/index.js +2447 -337
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +742 -30
- package/dist/connect.workers.d.ts +55 -2
- package/dist/server/index.js +2447 -337
- package/dist/server/index.js.map +1 -1
- package/dist/workers/index.js +62 -1
- package/dist/workers/index.js.map +1 -1
- package/package.json +17 -7
package/dist/connect.d.ts
CHANGED
|
@@ -1099,6 +1099,59 @@ declare class BroadcastChannel {
|
|
|
1099
1099
|
private handleInboundFrame;
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
|
+
/**
|
|
1103
|
+
* `HttpError` — thrown for any non-2xx accelerator response.
|
|
1104
|
+
*
|
|
1105
|
+
* In a module of its own so that `PaymentRequiredError` can extend it while
|
|
1106
|
+
* `HttpClient`, which throws both, imports `PaymentRequiredError`: with the
|
|
1107
|
+
* class in `HttpClient.ts`, the two modules would import each other, and
|
|
1108
|
+
* whichever loaded second would extend a class not yet defined. `HttpClient`
|
|
1109
|
+
* re-exports it, so `import { HttpError } from "./HttpClient"` still works.
|
|
1110
|
+
*/
|
|
1111
|
+
/** Thrown for any non-2xx accelerator response. Carries the HTTP status. */
|
|
1112
|
+
declare class HttpError extends Error {
|
|
1113
|
+
readonly status: number;
|
|
1114
|
+
readonly body?: unknown | undefined;
|
|
1115
|
+
constructor(message: string, status: number, body?: unknown | undefined);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* `PaymentRequiredError` — a write the accelerator refused for payment
|
|
1120
|
+
* (accelerator spec 2026-10-06-paid-accounts-and-past-due, "Interfaces and
|
|
1121
|
+
* contracts").
|
|
1122
|
+
*
|
|
1123
|
+
* The accelerator answers such a write with a 402 whose body carries one of
|
|
1124
|
+
* three codes:
|
|
1125
|
+
* - `user_plan_required`: the app takes paid Muhkoo plans only, and the
|
|
1126
|
+
* signed-in user is on Free;
|
|
1127
|
+
* - `user_payment_past_due`: the user's own Muhkoo payment is past due. Only
|
|
1128
|
+
* first-party apps are told this; every other app is told
|
|
1129
|
+
* `user_plan_required` instead;
|
|
1130
|
+
* - `owner_payment_past_due`: the app owner's payment is past due, so the
|
|
1131
|
+
* app stores nothing new for anyone.
|
|
1132
|
+
* Reads, sign-in and deletes still work in all three cases.
|
|
1133
|
+
*
|
|
1134
|
+
* Every other 402 — the Free-tier refusals that carry `quotaExceeded`,
|
|
1135
|
+
* `requiresPaidTier` or `freeTierFull` — has no `code`, and stays a plain
|
|
1136
|
+
* `HttpError`, as before.
|
|
1137
|
+
*/
|
|
1138
|
+
|
|
1139
|
+
/** Why a write was refused for payment. A wire contract: these strings never change. */
|
|
1140
|
+
type PaymentRequiredCode = "user_plan_required" | "user_payment_past_due" | "owner_payment_past_due";
|
|
1141
|
+
/** Thrown for a 402 whose body carries one of the three {@link PaymentRequiredCode}s. */
|
|
1142
|
+
declare class PaymentRequiredError extends HttpError {
|
|
1143
|
+
/** Why the write was refused. */
|
|
1144
|
+
readonly code: PaymentRequiredCode;
|
|
1145
|
+
/**
|
|
1146
|
+
* Where to send the user: the portal's upgrade page or its billing page,
|
|
1147
|
+
* as an absolute URL. Set only when the server sent an absolute http(s)
|
|
1148
|
+
* URL. The relative `upgradeUrl` of the Free-tier refusals is never here:
|
|
1149
|
+
* those are not this error.
|
|
1150
|
+
*/
|
|
1151
|
+
readonly upgradeUrl?: string;
|
|
1152
|
+
constructor(message: string, code: PaymentRequiredCode, body?: unknown, upgradeUrl?: string);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1102
1155
|
/**
|
|
1103
1156
|
* Cloudflare-Workers-compatible Groth16 ZK proof verifier.
|
|
1104
1157
|
*
|
|
@@ -2416,6 +2469,15 @@ interface ShardClientOptions {
|
|
|
2416
2469
|
* Provided so callers can inject retries / auth / instrumentation.
|
|
2417
2470
|
*/
|
|
2418
2471
|
fetch?: typeof fetch;
|
|
2472
|
+
/**
|
|
2473
|
+
* The same fetch with the client's silent re-authentication
|
|
2474
|
+
* (`HttpClient.fetchWithRecovery`), used for uploads only. A paid-only
|
|
2475
|
+
* app refuses a PUT made with a dead session with `401 session_required`;
|
|
2476
|
+
* through this, the session is re-established once and the PUT sent
|
|
2477
|
+
* again, which is safe because its bytes can be sent twice. Reads keep
|
|
2478
|
+
* {@link fetch}. Defaults to {@link fetch}.
|
|
2479
|
+
*/
|
|
2480
|
+
fetchWithRecovery?: typeof fetch;
|
|
2419
2481
|
/**
|
|
2420
2482
|
* Optional offline byte cache. When present, GETs are served cache-first and
|
|
2421
2483
|
* populated on success, and PUTs write the cache before the network so a
|
|
@@ -2462,8 +2524,10 @@ declare class ShardClient {
|
|
|
2462
2524
|
private readonly baseUrl;
|
|
2463
2525
|
private readonly pathPrefix;
|
|
2464
2526
|
private readonly fetchFn;
|
|
2527
|
+
/** What a PUT goes through: {@link ShardClientOptions.fetchWithRecovery} when given, else {@link fetchFn}. */
|
|
2528
|
+
private readonly putFn;
|
|
2465
2529
|
private readonly cache?;
|
|
2466
|
-
/** Hashes waiting for the next batch, each with everyone awaiting it. */
|
|
2530
|
+
/** Hashes waiting for the next batch, each with everyone awaiting it and its size if a caller gave it. */
|
|
2467
2531
|
private pendingShards;
|
|
2468
2532
|
private batchTimer;
|
|
2469
2533
|
/** False once the server is known not to have the batch route. */
|
|
@@ -2496,8 +2560,13 @@ declare class ShardClient {
|
|
|
2496
2560
|
/**
|
|
2497
2561
|
* Fetch a shard by hash. Throws if the server returns a non-200; returns
|
|
2498
2562
|
* `null` for 404 so callers can distinguish "missing" from "errored".
|
|
2563
|
+
*
|
|
2564
|
+
* `size`, the shard's byte length when known (a manifest's `shardSize`),
|
|
2565
|
+
* lets concurrent reads be batched within what the server will send.
|
|
2499
2566
|
*/
|
|
2500
|
-
getShard(hash: string
|
|
2567
|
+
getShard(hash: string, opts?: {
|
|
2568
|
+
size?: number;
|
|
2569
|
+
}): Promise<Uint8Array | null>;
|
|
2501
2570
|
/**
|
|
2502
2571
|
* Fetch from origin, COALESCING concurrent requests into one batch.
|
|
2503
2572
|
*
|
|
@@ -2520,6 +2589,8 @@ declare class ShardClient {
|
|
|
2520
2589
|
private fetchFromOrigin;
|
|
2521
2590
|
/** Send one batch of whatever has accumulated, and settle those callers. */
|
|
2522
2591
|
private flushShardBatch;
|
|
2592
|
+
/** POST one batch and settle everyone waiting on it. Never throws. */
|
|
2593
|
+
private sendShardBatch;
|
|
2523
2594
|
/** Fetch a shard from origin. Returns `null` for 404 (or offline when a
|
|
2524
2595
|
* cache is present, so RS recovery can proceed); throws otherwise. */
|
|
2525
2596
|
private fetchOneFromOrigin;
|
|
@@ -2718,6 +2789,25 @@ declare class FileStorage {
|
|
|
2718
2789
|
* origin) and per-chunk auth as {@link readFileFromShards}.
|
|
2719
2790
|
*/
|
|
2720
2791
|
readChunksFromShards(manifest: FileManifest): AsyncGenerator<Uint8Array>;
|
|
2792
|
+
/**
|
|
2793
|
+
* Each chunk's plaintext, in order, with the next {@link READ_AHEAD_CHUNKS}
|
|
2794
|
+
* already being fetched.
|
|
2795
|
+
*
|
|
2796
|
+
* One chunk at a time, a large file cost a full round trip per 4 MB chunk
|
|
2797
|
+
* with nothing overlapping it: a 33 MB file was eight serial requests,
|
|
2798
|
+
* each mostly waiting. Within a chunk the shard reads were already
|
|
2799
|
+
* parallel; this overlaps the chunks too.
|
|
2800
|
+
*
|
|
2801
|
+
* Bounded on purpose: while the caller holds a yielded chunk, at most
|
|
2802
|
+
* `1 + READ_AHEAD_CHUNKS` more are in flight, and nothing new starts until
|
|
2803
|
+
* it asks for the next — a slow consumer of the stream is not run away
|
|
2804
|
+
* from. A failure surfaces at its own chunk, in order; reads already
|
|
2805
|
+
* started past it are let finish, their failures swallowed rather than
|
|
2806
|
+
* left unhandled. If the caller stops early (`break` or `return()`), no
|
|
2807
|
+
* further read starts and the ones in flight settle on their own; they are
|
|
2808
|
+
* not awaited, so `return()` is not delayed by a slow shard.
|
|
2809
|
+
*/
|
|
2810
|
+
private chunksInOrder;
|
|
2721
2811
|
/** As {@link writeFileToShards}, plus POSTs the manifest to `input.spaceId`. */
|
|
2722
2812
|
writeFile(input: WriteFileInput): Promise<FileStat>;
|
|
2723
2813
|
/** As {@link readFileFromShards}, but fetches the manifest from a space first. */
|
|
@@ -3888,12 +3978,7 @@ interface HttpClientOptions {
|
|
|
3888
3978
|
*/
|
|
3889
3979
|
onUnauthorized?: () => Promise<boolean>;
|
|
3890
3980
|
}
|
|
3891
|
-
|
|
3892
|
-
declare class HttpError extends Error {
|
|
3893
|
-
readonly status: number;
|
|
3894
|
-
readonly body?: unknown | undefined;
|
|
3895
|
-
constructor(message: string, status: number, body?: unknown | undefined);
|
|
3896
|
-
}
|
|
3981
|
+
|
|
3897
3982
|
declare class HttpClient {
|
|
3898
3983
|
readonly baseUrl: string;
|
|
3899
3984
|
/** Origin of {@link baseUrl} — credentials are only attached same-origin. */
|
|
@@ -4045,6 +4130,14 @@ interface QueueEntry {
|
|
|
4045
4130
|
method: string;
|
|
4046
4131
|
/** Serializable arguments captured at enqueue time. */
|
|
4047
4132
|
args: unknown;
|
|
4133
|
+
/**
|
|
4134
|
+
* Whose write it is: the commitment of the user signed in when it was
|
|
4135
|
+
* queued, stamped by `OutboundQueue.enqueue`. A drain sends only the
|
|
4136
|
+
* signed-in user's entries, because every replayer builds its request
|
|
4137
|
+
* from the session signed in when it runs. Absent on entries an older
|
|
4138
|
+
* SDK queued, which any drain sends, as before.
|
|
4139
|
+
*/
|
|
4140
|
+
commitment?: string;
|
|
4048
4141
|
}
|
|
4049
4142
|
interface OfflineEntry<T> {
|
|
4050
4143
|
key: string;
|
|
@@ -4084,35 +4177,92 @@ interface OfflineStore {
|
|
|
4084
4177
|
* mutation by re-invoking the real namespace method (with an `isReplay` flag so
|
|
4085
4178
|
* it doesn't re-enqueue). `drain()` replays entries in HLC order:
|
|
4086
4179
|
* - success → remove the entry;
|
|
4087
|
-
* -
|
|
4088
|
-
*
|
|
4089
|
-
*
|
|
4180
|
+
* - refused for payment (`PaymentRequiredError`: the app takes paid plans
|
|
4181
|
+
* only, or someone's payment is past due) → keep it and everything after
|
|
4182
|
+
* it, stop, and surface a `SYNC_ERROR` with `dropped: false`. The server
|
|
4183
|
+
* accepts it once the user or the app owner pays, so it waits for the next
|
|
4184
|
+
* reconnect, or for `client.app.access()` to report the app allowed;
|
|
4185
|
+
* - permanent failure (any other 4xx, or a Space whose member list refuses
|
|
4186
|
+
* this user) → drop it and surface a `SYNC_ERROR` (a write the server will
|
|
4187
|
+
* never accept must not wedge the queue forever);
|
|
4090
4188
|
* - transient/network failure → stop draining and leave the rest for the next
|
|
4091
4189
|
* reconnect.
|
|
4092
4190
|
*
|
|
4093
4191
|
* Replays are idempotent by construction (kv/db are LWW-by-key, messages dedupe
|
|
4094
4192
|
* by `clientId`, file PUTs are content-addressed), so re-running a partially
|
|
4095
4193
|
* drained queue is safe.
|
|
4194
|
+
*
|
|
4195
|
+
* Every tab of an origin shares the queue. Given a `tryLock`, a drain runs
|
|
4196
|
+
* only while holding `muhkoo:offline-drain:<commitment>`, so two tabs coming
|
|
4197
|
+
* back online replay it once between them, not once each.
|
|
4096
4198
|
*/
|
|
4097
4199
|
|
|
4098
4200
|
type Replayer = (entry: QueueEntry) => Promise<void>;
|
|
4201
|
+
/**
|
|
4202
|
+
* Run `fn` holding lock `name` if no one else holds it: true once it has
|
|
4203
|
+
* run, false - without running it - when another holder has it. Web Locks'
|
|
4204
|
+
* `ifAvailable` in a browser tab; see `core/crossTab.ts`.
|
|
4205
|
+
*/
|
|
4206
|
+
type TryLock = (name: string, fn: () => Promise<void>) => Promise<boolean>;
|
|
4207
|
+
interface OutboundQueueOptions {
|
|
4208
|
+
/**
|
|
4209
|
+
* The lock that keeps two tabs from draining at once. Every tab of an
|
|
4210
|
+
* origin shares one IndexedDB queue, and each replayed all of it when it
|
|
4211
|
+
* came back online: two tabs, every queued write twice. Absent (Node,
|
|
4212
|
+
* tests), every drain runs, as before.
|
|
4213
|
+
*/
|
|
4214
|
+
tryLock?: TryLock;
|
|
4215
|
+
/**
|
|
4216
|
+
* The signed-in user: stamps each enqueued write, picks which writes a
|
|
4217
|
+
* drain sends, and names the drain lock. With no one signed in, writes are
|
|
4218
|
+
* unstamped and the drain runs unlocked.
|
|
4219
|
+
*/
|
|
4220
|
+
commitment?: () => string | null;
|
|
4221
|
+
}
|
|
4099
4222
|
declare class OutboundQueue {
|
|
4100
4223
|
private readonly store;
|
|
4224
|
+
private readonly opts;
|
|
4101
4225
|
private readonly replayers;
|
|
4102
4226
|
private draining;
|
|
4103
|
-
constructor(store: OfflineStore);
|
|
4227
|
+
constructor(store: OfflineStore, opts?: OutboundQueueOptions);
|
|
4104
4228
|
/** A domain registers how to replay its mutations. */
|
|
4105
4229
|
register(domain: QueueEntry["domain"], replayer: Replayer): void;
|
|
4106
|
-
/**
|
|
4230
|
+
/**
|
|
4231
|
+
* Record a mutation for later replay; resolves with its assigned seq.
|
|
4232
|
+
* Stamped with the signed-in user's commitment, so that it is only ever
|
|
4233
|
+
* sent under their session (see {@link waiting}).
|
|
4234
|
+
*/
|
|
4107
4235
|
enqueue(entry: Omit<QueueEntry, "seq">): Promise<number>;
|
|
4108
|
-
/** Number of writes still awaiting sync. */
|
|
4236
|
+
/** Number of writes still awaiting sync, every user's. */
|
|
4109
4237
|
pending(): Promise<number>;
|
|
4238
|
+
/**
|
|
4239
|
+
* The writes a drain would send now, in order: the signed-in user's, and
|
|
4240
|
+
* any an older SDK queued without saying whose they are. Every tab of an
|
|
4241
|
+
* origin shares this queue, and every replayer builds its request from
|
|
4242
|
+
* the session signed in when it runs, so another user's write sent now
|
|
4243
|
+
* would land in this user's space, or overwrite their data. It stays
|
|
4244
|
+
* queued, as it is, until its own user signs in on this device again.
|
|
4245
|
+
*/
|
|
4246
|
+
waiting(): Promise<QueueEntry[]>;
|
|
4247
|
+
/** True for an entry this drain may send: the signed-in user's, or one with no user. */
|
|
4248
|
+
private sendable;
|
|
4110
4249
|
/**
|
|
4111
4250
|
* Replay queued mutations in HLC order. Coalesces concurrent calls into a
|
|
4112
4251
|
* single in-flight drain. Stops on the first transient failure, leaving the
|
|
4113
4252
|
* remaining entries for the next attempt.
|
|
4114
4253
|
*/
|
|
4115
4254
|
drain(): Promise<void>;
|
|
4255
|
+
/**
|
|
4256
|
+
* One drain, holding the device-wide drain lock where there is one. A
|
|
4257
|
+
* tab that finds another tab holding it leaves the queue to that one,
|
|
4258
|
+
* which is replaying it already and removes each entry as it lands - so
|
|
4259
|
+
* a drain after it finds only what it left.
|
|
4260
|
+
*/
|
|
4261
|
+
private drainOnce;
|
|
4262
|
+
/**
|
|
4263
|
+
* One pass over the queue. False when a write refused for payment stopped
|
|
4264
|
+
* it, which leaves that write and everything after it queued.
|
|
4265
|
+
*/
|
|
4116
4266
|
private runDrain;
|
|
4117
4267
|
}
|
|
4118
4268
|
|
|
@@ -4242,6 +4392,12 @@ interface OfflineManagerDeps {
|
|
|
4242
4392
|
session: SessionState;
|
|
4243
4393
|
/** Whether offline support is active (browser) vs a no-op (Node/Workers). */
|
|
4244
4394
|
enabled: boolean;
|
|
4395
|
+
/**
|
|
4396
|
+
* The drain lock the tabs of this origin share - Web Locks in a browser
|
|
4397
|
+
* tab. Absent, every tab drains the shared queue itself, as before. See
|
|
4398
|
+
* `OutboundQueue`.
|
|
4399
|
+
*/
|
|
4400
|
+
locks?: TryLock;
|
|
4245
4401
|
}
|
|
4246
4402
|
declare class OfflineManager {
|
|
4247
4403
|
/** True in browsers with IndexedDB; false when running over a NoopStore. */
|
|
@@ -4265,6 +4421,16 @@ declare class OfflineManager {
|
|
|
4265
4421
|
* replayer re-PUTs from the cache on reconnect.
|
|
4266
4422
|
*/
|
|
4267
4423
|
deferShardUpload(hash: string): Promise<void>;
|
|
4424
|
+
/**
|
|
4425
|
+
* Replay the queue now, as a reconnect does, if anything is waiting in it.
|
|
4426
|
+
* `client.app.access()` calls this each time it reports the app allowed,
|
|
4427
|
+
* so writes kept after a refusal for payment go out once the user or the
|
|
4428
|
+
* app owner has paid, without waiting for the next reconnect. One drain per
|
|
4429
|
+
* call, never on a timer. With nothing of the signed-in user's queued it
|
|
4430
|
+
* does not drain at all, so the app sees no "syncing". A drain also runs the
|
|
4431
|
+
* catch-up tasks (Space history paging), as a reconnect does.
|
|
4432
|
+
*/
|
|
4433
|
+
resume(): Promise<void>;
|
|
4268
4434
|
/** Resolve once the clock + node id are loaded. */
|
|
4269
4435
|
ready(): Promise<void>;
|
|
4270
4436
|
/** Current connectivity state (`online` | `offline` | `syncing`). */
|
|
@@ -4328,8 +4494,12 @@ declare class KvCache {
|
|
|
4328
4494
|
* state but a fresh local write wins.
|
|
4329
4495
|
*/
|
|
4330
4496
|
mergeRemote(commitment: string, fullKey: string, envelope: unknown | null, op: "set" | "delete", hlc?: string): Promise<void>;
|
|
4331
|
-
/**
|
|
4332
|
-
|
|
4497
|
+
/**
|
|
4498
|
+
* Non-tombstoned full keys for a commitment that start with `prefix` (all
|
|
4499
|
+
* of them by default), for offline `list`. The store scans the key range
|
|
4500
|
+
* `${commitment}|${prefix}`, so other collections are never read.
|
|
4501
|
+
*/
|
|
4502
|
+
liveKeys(commitment: string, prefix?: string): Promise<string[]>;
|
|
4333
4503
|
/** Queue a kv mutation for replay on reconnect. */
|
|
4334
4504
|
enqueue(method: "set" | "delete", args: unknown, hlc: string, clientId: string): Promise<void>;
|
|
4335
4505
|
}
|
|
@@ -4341,6 +4511,7 @@ declare class KvCache {
|
|
|
4341
4511
|
* await client.kv.set('todos', id, { title, completed })
|
|
4342
4512
|
* const todo = await client.kv.get('todos', id)
|
|
4343
4513
|
* const ids = await client.kv.list('todos')
|
|
4514
|
+
* const keys = await client.kv.keys('todos/') // full keys, any prefix
|
|
4344
4515
|
* await client.kv.delete('todos', id)
|
|
4345
4516
|
* const off = client.kv.on('change', e => …) // realtime, cross-device
|
|
4346
4517
|
*
|
|
@@ -4392,8 +4563,23 @@ declare class KvNamespace {
|
|
|
4392
4563
|
get<T = unknown>(collection: string, id: string): Promise<T | null>;
|
|
4393
4564
|
/** Delete `collection`/`id`. Returns whether the key existed. */
|
|
4394
4565
|
delete(collection: string, id: string): Promise<boolean>;
|
|
4395
|
-
/**
|
|
4566
|
+
/**
|
|
4567
|
+
* List the ids present in `collection`. The server filters by
|
|
4568
|
+
* `${collection}/` and pages; values are not fetched.
|
|
4569
|
+
*/
|
|
4396
4570
|
list(collection: string): Promise<string[]>;
|
|
4571
|
+
/**
|
|
4572
|
+
* Every key in the signed-in user's personal space that starts with
|
|
4573
|
+
* `prefix` (all of them when it is ""), as full keys: `todos/t1`, not
|
|
4574
|
+
* `t1`. Values are not fetched. The personal space is shared by every
|
|
4575
|
+
* app the user signs into, so expect keys you did not write: the VFS's
|
|
4576
|
+
* `vfs/…`, version control's `vcs/…`, the SDK's own `chat-keys` and
|
|
4577
|
+
* `space-keys/…`.
|
|
4578
|
+
*
|
|
4579
|
+
* The local `startsWith` filter stays on purpose: a server older than
|
|
4580
|
+
* the key index ignores `prefix` and returns every key.
|
|
4581
|
+
*/
|
|
4582
|
+
keys(prefix?: string): Promise<string[]>;
|
|
4397
4583
|
/** Reserved — server-side query is deferred (see the overhaul plan). */
|
|
4398
4584
|
query(_collection: string, _filter?: unknown): Promise<never>;
|
|
4399
4585
|
/**
|
|
@@ -5385,6 +5571,12 @@ interface SpaceDeps {
|
|
|
5385
5571
|
httpBaseUrl: string;
|
|
5386
5572
|
/** Header-injecting fetch from the client's HttpClient. */
|
|
5387
5573
|
fetch: typeof fetch;
|
|
5574
|
+
/**
|
|
5575
|
+
* The same fetch with the client's silent 401 recovery (`HttpClient.fetchWithRecovery`). File uploads
|
|
5576
|
+
* use it, so a PUT made with a dead session re-establishes the session once instead of failing.
|
|
5577
|
+
* Defaults to {@link fetch}.
|
|
5578
|
+
*/
|
|
5579
|
+
fetchWithRecovery?: typeof fetch;
|
|
5388
5580
|
/** Resolves the user id used for the ratchet / member id (signed-in username). */
|
|
5389
5581
|
myId: () => string;
|
|
5390
5582
|
/** Resolves a short-lived WS upgrade ticket (or null when keyless). */
|
|
@@ -6521,6 +6713,68 @@ declare class AccessTokensNamespace {
|
|
|
6521
6713
|
private path;
|
|
6522
6714
|
}
|
|
6523
6715
|
|
|
6716
|
+
/**
|
|
6717
|
+
* `client.app` — what the signed-in user may do in this app (accelerator spec
|
|
6718
|
+
* 2026-10-06-paid-accounts-and-past-due, B6 and B8).
|
|
6719
|
+
*
|
|
6720
|
+
* An app's owner can turn on "Paid Muhkoo accounts only" in the portal. The
|
|
6721
|
+
* accelerator then refuses a Free user's writes that add data, with a 402 the
|
|
6722
|
+
* SDK throws as `PaymentRequiredError`. Reads, sign-in and deletes still work.
|
|
6723
|
+
* The same refusal reaches every user of an app whose owner's payment is past
|
|
6724
|
+
* due, whether or not the setting is on.
|
|
6725
|
+
*
|
|
6726
|
+
* `access()` asks up front, so an app can show the right screen before the
|
|
6727
|
+
* first refusal.
|
|
6728
|
+
*/
|
|
6729
|
+
|
|
6730
|
+
/** The answer of `GET /api/app/access`. */
|
|
6731
|
+
interface AppAccess {
|
|
6732
|
+
/** The owner has turned on "Paid Muhkoo accounts only" for this app. */
|
|
6733
|
+
paidAccountsOnly: boolean;
|
|
6734
|
+
/** The signed-in user may add data in this app now. */
|
|
6735
|
+
allowed: boolean;
|
|
6736
|
+
/**
|
|
6737
|
+
* Why not: the code a refused write carries. Read only when `allowed` is
|
|
6738
|
+
* false, and only when it is one of the three codes.
|
|
6739
|
+
*/
|
|
6740
|
+
reason?: PaymentRequiredCode;
|
|
6741
|
+
/**
|
|
6742
|
+
* Where to send the user, as an absolute URL: the portal's upgrade page
|
|
6743
|
+
* for `user_plan_required`, with a way back to this app when the request
|
|
6744
|
+
* came from one of its registered redirect URIs, or its billing page for
|
|
6745
|
+
* `user_payment_past_due`. The accelerator sends it only for those two
|
|
6746
|
+
* reasons: the user can do nothing about the owner's payment. Read only
|
|
6747
|
+
* when `allowed` is false, and only when it is an absolute http(s) URL.
|
|
6748
|
+
*/
|
|
6749
|
+
upgradeUrl?: string;
|
|
6750
|
+
}
|
|
6751
|
+
interface AppNamespaceDeps {
|
|
6752
|
+
http: HttpClient;
|
|
6753
|
+
/**
|
|
6754
|
+
* Called each time `access()` answers `allowed: true`. The Client sends
|
|
6755
|
+
* the writes its offline queue kept after a refusal for payment
|
|
6756
|
+
* (`OfflineManager.resume`). A throw or a rejection is logged and ignored.
|
|
6757
|
+
*/
|
|
6758
|
+
onAllowed?: () => Promise<void>;
|
|
6759
|
+
}
|
|
6760
|
+
declare class AppNamespace {
|
|
6761
|
+
private readonly deps;
|
|
6762
|
+
constructor(deps: AppNamespaceDeps);
|
|
6763
|
+
/**
|
|
6764
|
+
* Whether the signed-in user may add data in this app and, if not, why
|
|
6765
|
+
* and where to send them. Needs the app key and a session; a stale session
|
|
6766
|
+
* is re-established once, as for every request. The route is never
|
|
6767
|
+
* refused for payment. Throws `HttpError` for anything else, among them a
|
|
6768
|
+
* 401 without a session and a 404 from an accelerator older than the
|
|
6769
|
+
* route.
|
|
6770
|
+
*
|
|
6771
|
+
* Each `allowed: true` also sends any writes the offline queue kept after
|
|
6772
|
+
* a refusal for payment, without waiting for them. Call it after sign-in,
|
|
6773
|
+
* and again when the user comes back from the portal.
|
|
6774
|
+
*/
|
|
6775
|
+
access(): Promise<AppAccess>;
|
|
6776
|
+
}
|
|
6777
|
+
|
|
6524
6778
|
/**
|
|
6525
6779
|
* Wire types for the VFS metadata layer.
|
|
6526
6780
|
*
|
|
@@ -6657,8 +6911,14 @@ interface VfsStore {
|
|
|
6657
6911
|
get(key: string): Promise<unknown | null>;
|
|
6658
6912
|
put(key: string, value: unknown): Promise<void>;
|
|
6659
6913
|
delete(key: string): Promise<void>;
|
|
6660
|
-
/**
|
|
6661
|
-
|
|
6914
|
+
/**
|
|
6915
|
+
* Keys in the store that start with `prefix`, or every key without one.
|
|
6916
|
+
* The personal space is shared, so this is NOT VFS-only. An implementation
|
|
6917
|
+
* may ignore `prefix` and return more (the parameter is optional so that
|
|
6918
|
+
* a store written for the old no-argument `list()` still fits), so callers
|
|
6919
|
+
* filter what they get back.
|
|
6920
|
+
*/
|
|
6921
|
+
list(prefix?: string): Promise<string[]>;
|
|
6662
6922
|
}
|
|
6663
6923
|
/** Raised when the master seed is not held, so the root key cannot be derived. */
|
|
6664
6924
|
declare class VfsLockedError extends Error {
|
|
@@ -6724,6 +6984,114 @@ declare class VfsLimitError extends Error {
|
|
|
6724
6984
|
constructor(limit: VfsLimitError["limit"], max: number, path: string, at: string, doing?: string);
|
|
6725
6985
|
}
|
|
6726
6986
|
|
|
6987
|
+
/**
|
|
6988
|
+
* How `client.vfs` orders writes of one directory record between the tabs of
|
|
6989
|
+
* an app on one device. Internal: nothing re-exports this module, and it is
|
|
6990
|
+
* not public API.
|
|
6991
|
+
*
|
|
6992
|
+
* The personal space keeps whichever write of a key arrives last, so two tabs
|
|
6993
|
+
* that each edit a copy of a folder and write it lose one tab's edit. A
|
|
6994
|
+
* coordinator gives every namespace on the device one lock per record, held
|
|
6995
|
+
* from the decision to write until the write has landed or failed, and a
|
|
6996
|
+
* count of each record's writes, which a writer stores before it lets go of
|
|
6997
|
+
* the lock and the next holder reads to tell whether its copy is current.
|
|
6998
|
+
* It also tells the others which record was written, as a hint: that can
|
|
6999
|
+
* reach them after the next holder has decided, or never. And it gives
|
|
7000
|
+
* each file or folder being moved or deleted a lock, which a move or delete
|
|
7001
|
+
* of it elsewhere takes only if it is free, and refuses otherwise (see
|
|
7002
|
+
* `holdMoving`). `Client` builds one
|
|
7003
|
+
* from Web Locks and a BroadcastChannel in a browser tab (see
|
|
7004
|
+
* `core/crossTab.ts`); without one, writes are ordered within one namespace
|
|
7005
|
+
* only, as they always were.
|
|
7006
|
+
*/
|
|
7007
|
+
interface VfsCoordinator {
|
|
7008
|
+
/**
|
|
7009
|
+
* Run `fn` holding the device-wide lock for record `id`, and settle as it
|
|
7010
|
+
* does. Where the runtime refuses the lock to this document, as it then
|
|
7011
|
+
* does to every tab of the app, `fn` runs without it.
|
|
7012
|
+
*/
|
|
7013
|
+
lock<T>(id: string, fn: () => Promise<T>): Promise<T>;
|
|
7014
|
+
/** Tell every other namespace that this one has just written record `id`. Called while holding its lock. */
|
|
7015
|
+
announce(id: string): void;
|
|
7016
|
+
/**
|
|
7017
|
+
* Call `handler` with the id of each record another namespace announces -
|
|
7018
|
+
* or with null when announcements may have been missed, because this one
|
|
7019
|
+
* has only just started hearing them, or now hears them for someone else,
|
|
7020
|
+
* so that every record held must be taken as written elsewhere. Returns a
|
|
7021
|
+
* function that stops it.
|
|
7022
|
+
*/
|
|
7023
|
+
onAnnounce(handler: (id: string | null) => void): () => void;
|
|
7024
|
+
/**
|
|
7025
|
+
* Make sure announcements for whoever is signed in now are being heard.
|
|
7026
|
+
* Cheap; called before every read of a record from the store, so that
|
|
7027
|
+
* nothing is read before this namespace can hear of a later write of it.
|
|
7028
|
+
*/
|
|
7029
|
+
listen(): void;
|
|
7030
|
+
/**
|
|
7031
|
+
* How often each record in `ids` has been written by any namespace on
|
|
7032
|
+
* the device, for whoever is signed in: one counter each, in order, read
|
|
7033
|
+
* at one moment from storage every tab of the app shares (IndexedDB, in
|
|
7034
|
+
* a browser). Null where it cannot be told: the storage cannot be read,
|
|
7035
|
+
* or does not answer within a few seconds, or a write of the record has
|
|
7036
|
+
* begun and not been counted (see `begin`). Never rejects.
|
|
7037
|
+
*
|
|
7038
|
+
* A copy of a record fetched after its counter was read holds every
|
|
7039
|
+
* write the counter counts. Read again once its holder has taken a lock
|
|
7040
|
+
* that another tab held while it wrote the record - the record's own, or
|
|
7041
|
+
* a move lock - a counter that has not moved says no other tab has
|
|
7042
|
+
* written it since: unlike an announcement, a count is stored before
|
|
7043
|
+
* the writer lets go of its locks. See `VfsNamespace.sendLocked`.
|
|
7044
|
+
*/
|
|
7045
|
+
counters(ids: readonly string[]): Promise<Array<string | null>>;
|
|
7046
|
+
/**
|
|
7047
|
+
* Called holding record `id`'s lock, before deciding whether a copy of it
|
|
7048
|
+
* is current: its counter as the last tab to write it left it - one whose
|
|
7049
|
+
* write began and was never counted, which no copy holds, included. And
|
|
7050
|
+
* from then, stored with it, a mark that a write of it has begun, which
|
|
7051
|
+
* `counters` reports as null until `bump`: a tab that goes, or cannot
|
|
7052
|
+
* count its write, in between leaves every tab reading the record again.
|
|
7053
|
+
* Null when the storage could not be read and marked within a few
|
|
7054
|
+
* seconds. Never rejects.
|
|
7055
|
+
*/
|
|
7056
|
+
begin(id: string): Promise<string | null>;
|
|
7057
|
+
/**
|
|
7058
|
+
* Called holding record `id`'s lock, after `begin`, once the write has
|
|
7059
|
+
* landed or failed, or nothing was written after all: count it, and
|
|
7060
|
+
* resolve to the record's new counter once that is stored - so before
|
|
7061
|
+
* the lock is let go of. Null when it could not be stored within a few
|
|
7062
|
+
* seconds. Never rejects.
|
|
7063
|
+
*/
|
|
7064
|
+
bump(id: string): Promise<string | null>;
|
|
7065
|
+
/**
|
|
7066
|
+
* Hold the lock that says entry `id` - a file or a folder, by its id in
|
|
7067
|
+
* the tree - is being moved or deleted on this device, if no one holds
|
|
7068
|
+
* it. Never waits: resolves to null when another holder has it, in this
|
|
7069
|
+
* tab or another, and otherwise to the function that lets go of it. A
|
|
7070
|
+
* tab that dies lets go of everything it held. With no one signed in it
|
|
7071
|
+
* holds nothing, and resolves to a function that does nothing; so too
|
|
7072
|
+
* where the runtime refuses the lock to this document, as it then does
|
|
7073
|
+
* to every tab of the app.
|
|
7074
|
+
*
|
|
7075
|
+
* `shared` holds a folder's lock as a place on the way to where a move
|
|
7076
|
+
* is putting something. Any number of shared holders hold it at once,
|
|
7077
|
+
* in any tab; a holder that is not shared cannot have it while they do,
|
|
7078
|
+
* nor they while it does.
|
|
7079
|
+
*
|
|
7080
|
+
* A move marks its entry before it puts it in its second place, and a
|
|
7081
|
+
* mark cannot tell a move still writing from one that was interrupted.
|
|
7082
|
+
* Another tab took the first for the second: it finished the move too,
|
|
7083
|
+
* naming the entry in two places, or let go of what the move was about
|
|
7084
|
+
* to put somewhere else. So a move holds this from before it marks until
|
|
7085
|
+
* it has taken the entry from where it was, a delete holds it for all it
|
|
7086
|
+
* is deleting, and either refuses when it cannot have it. A move also
|
|
7087
|
+
* holds the folder it is moving into, and every folder above that one,
|
|
7088
|
+
* shared, for as long: a move into a folder that another tab was
|
|
7089
|
+
* deleting put what it moved in a record the delete then purged. See
|
|
7090
|
+
* `VfsNamespace.rename` and `VfsNamespace.delete`.
|
|
7091
|
+
*/
|
|
7092
|
+
holdMoving(id: string, shared?: boolean): Promise<(() => void) | null>;
|
|
7093
|
+
}
|
|
7094
|
+
|
|
6727
7095
|
/**
|
|
6728
7096
|
* `client.vfs` — a real filesystem over Muhkoo primitives.
|
|
6729
7097
|
*
|
|
@@ -6736,11 +7104,24 @@ declare class VfsLimitError extends Error {
|
|
|
6736
7104
|
*
|
|
6737
7105
|
* Every mutation is a read-modify-write of exactly ONE directory record, so a
|
|
6738
7106
|
* write cannot leave the tree half-updated: either the parent names the new
|
|
6739
|
-
* child or it does not.
|
|
6740
|
-
*
|
|
6741
|
-
*
|
|
6742
|
-
*
|
|
6743
|
-
*
|
|
7107
|
+
* child or it does not. A VFS write sends no HLC and the personal space has
|
|
7108
|
+
* no compare-and-swap: of two writes of one key it keeps whichever arrives
|
|
7109
|
+
* last.
|
|
7110
|
+
*
|
|
7111
|
+
* Within ONE namespace, writes of a record are sent one at a time, in the
|
|
7112
|
+
* order they were made - edits made while one is in flight go out together
|
|
7113
|
+
* in the next (see `queue`) - and a read that has to fetch a record waits for
|
|
7114
|
+
* its write in flight (see `writing`). Every edit of a record is made to one
|
|
7115
|
+
* in-memory copy of it, and that copy is what is written (see `mutate`).
|
|
7116
|
+
*
|
|
7117
|
+
* Between the tabs of an app on one device, a coordinator (`VfsCoordinator`;
|
|
7118
|
+
* `Client` wires one in a browser tab) gives each record one lock, and a tab
|
|
7119
|
+
* reads a record another tab has written again before its next write of it
|
|
7120
|
+
* (see `sendLocked`). Between devices - or a browser and the CLI - two writes
|
|
7121
|
+
* of the same directory are still last-writer-wins, and the other edit is
|
|
7122
|
+
* lost: that takes a compare-and-swap at the server. Orphaned records (a
|
|
7123
|
+
* directory whose parent entry lost the race) are unreachable rather than
|
|
7124
|
+
* corrupting - they cost storage until a sweep, the trade this shape makes in
|
|
6744
7125
|
* exchange for single-record writes.
|
|
6745
7126
|
*/
|
|
6746
7127
|
|
|
@@ -6757,6 +7138,8 @@ interface VfsContentStore {
|
|
|
6757
7138
|
write(data: Uint8Array | Blob, meta: {
|
|
6758
7139
|
name: string;
|
|
6759
7140
|
type: string;
|
|
7141
|
+
}, opts?: {
|
|
7142
|
+
onProgress?: (done: number, total: number) => void;
|
|
6760
7143
|
}): Promise<{
|
|
6761
7144
|
manifest: FileManifest;
|
|
6762
7145
|
size: number;
|
|
@@ -6805,6 +7188,13 @@ interface VfsNamespaceDeps {
|
|
|
6805
7188
|
entries?: number;
|
|
6806
7189
|
pathChars?: number;
|
|
6807
7190
|
};
|
|
7191
|
+
/**
|
|
7192
|
+
* Orders writes of a record with the other tabs of this app on the
|
|
7193
|
+
* device. `Client` passes one in a browser tab; without it - Node, a
|
|
7194
|
+
* test, a runtime with no Web Locks - writes are ordered within this
|
|
7195
|
+
* namespace only. See `VfsCoordinator`.
|
|
7196
|
+
*/
|
|
7197
|
+
coordinator?: VfsCoordinator;
|
|
6808
7198
|
}
|
|
6809
7199
|
declare class VfsNamespace {
|
|
6810
7200
|
private readonly deps;
|
|
@@ -6815,8 +7205,114 @@ declare class VfsNamespace {
|
|
|
6815
7205
|
* The file tree re-lists constantly while typing, and every miss is a
|
|
6816
7206
|
* network round trip plus a decrypt. Invalidated precisely on write rather
|
|
6817
7207
|
* than by TTL — a stale directory listing shows files that are not there.
|
|
7208
|
+
*
|
|
7209
|
+
* What a cached read resolves to is also THE copy of that record: the one
|
|
7210
|
+
* every edit of it is made to, and the one written. See `mutate`.
|
|
6818
7211
|
*/
|
|
6819
7212
|
private cache;
|
|
7213
|
+
/**
|
|
7214
|
+
* Bumped by `clearCache`, which is for a change of identity.
|
|
7215
|
+
*
|
|
7216
|
+
* A read or write begun before it can finish after it, and what it read
|
|
7217
|
+
* or wrote belongs to whoever was signed in before. So every record
|
|
7218
|
+
* carries the generation it was read under, and none goes into the cache,
|
|
7219
|
+
* or is edited as the cache's copy, under another.
|
|
7220
|
+
*/
|
|
7221
|
+
private generation;
|
|
7222
|
+
/**
|
|
7223
|
+
* The record each promise in `cache` resolved to, and each write in
|
|
7224
|
+
* `writing` is sending: what `editable` finds without waiting.
|
|
7225
|
+
*/
|
|
7226
|
+
private readonly copyOf;
|
|
7227
|
+
/**
|
|
7228
|
+
* The write of each directory record still in flight, by id.
|
|
7229
|
+
*
|
|
7230
|
+
* Two writes of one record must land in the order they were made. The
|
|
7231
|
+
* personal space has no compare-and-swap: of two writes of one key that
|
|
7232
|
+
* are in flight together it keeps whichever request finishes last, and
|
|
7233
|
+
* that is often the one sent first. Then the earlier write, sealed before
|
|
7234
|
+
* the later edit was made, undoes it. That is how a file deleted forever
|
|
7235
|
+
* from the Trash, while the move that put it there was still being
|
|
7236
|
+
* written, came back. So each write waits for the one before it, and a
|
|
7237
|
+
* read that has to fetch the record waits for its write too: see
|
|
7238
|
+
* `openDirById`.
|
|
7239
|
+
*/
|
|
7240
|
+
private readonly writing;
|
|
7241
|
+
/**
|
|
7242
|
+
* Every entry this namespace is moving right now, by id.
|
|
7243
|
+
*
|
|
7244
|
+
* A move between two directories marks the entry before it puts it in
|
|
7245
|
+
* the second (see `rename`), and a mark is all a later operation can
|
|
7246
|
+
* see. It cannot tell a move still writing from one that was
|
|
7247
|
+
* interrupted, and was taken for the second: a delete that began after
|
|
7248
|
+
* a move had marked a folder looked for the folder's other half, found
|
|
7249
|
+
* none yet, and purged it while the move was putting it in its new
|
|
7250
|
+
* place; a second move of a file finished the "interrupted" move and
|
|
7251
|
+
* left it named in two places. So a move holds its entry here until it
|
|
7252
|
+
* has taken it from where it was, and `rename` and `delete` refuse an
|
|
7253
|
+
* entry that is here - or, for a delete, a folder holding one. A delete
|
|
7254
|
+
* holds what it deletes the same way: see `deleting`.
|
|
7255
|
+
*
|
|
7256
|
+
* This set is one namespace's. With a coordinator, a move also holds
|
|
7257
|
+
* the entry's move lock for every tab on the device, for as long as the
|
|
7258
|
+
* entry is here: see `VfsCoordinator.holdMoving`.
|
|
7259
|
+
*/
|
|
7260
|
+
private readonly inMotion;
|
|
7261
|
+
/**
|
|
7262
|
+
* What each delete under way in this namespace is deleting, by entry id,
|
|
7263
|
+
* one set per delete: its target from the moment it has found the target
|
|
7264
|
+
* not in `inMotion`, and everything it read below the target once it has
|
|
7265
|
+
* read it. Each delete lets go of its own set when it is done.
|
|
7266
|
+
*
|
|
7267
|
+
* A delete waits after it has read what it will let go of: on more
|
|
7268
|
+
* reads, and on a read of the whole tree for the other half of a move.
|
|
7269
|
+
* A move of any of it that started meanwhile could put it in its new
|
|
7270
|
+
* place, fail to take it from the old, and end, all before the delete's
|
|
7271
|
+
* detach. Ended, it was no longer in `inMotion`; and an entry that was
|
|
7272
|
+
* marked already showed no change. So the delete let go of what the
|
|
7273
|
+
* move had just named somewhere else. Now `rename` refuses an entry that
|
|
7274
|
+
* is here, or one on a way from the root that passes through a folder
|
|
7275
|
+
* that is: everything below a delete's target, read yet or not.
|
|
7276
|
+
*/
|
|
7277
|
+
private readonly deleting;
|
|
7278
|
+
/**
|
|
7279
|
+
* The write of each record that has not gone out yet, by id: the one
|
|
7280
|
+
* the next edit of that record joins. See `queue`.
|
|
7281
|
+
*/
|
|
7282
|
+
private readonly waiting;
|
|
7283
|
+
/**
|
|
7284
|
+
* Announcements heard from other tabs, counted. `heardAt` is the count
|
|
7285
|
+
* at the last one for each record, `missedAt` the count when some may
|
|
7286
|
+
* have been missed. A copy read after both holds every write announced:
|
|
7287
|
+
* see `current`.
|
|
7288
|
+
*/
|
|
7289
|
+
private hearing;
|
|
7290
|
+
private missedAt;
|
|
7291
|
+
private readonly heardAt;
|
|
7292
|
+
/**
|
|
7293
|
+
* Each record a write of which this namespace marked as begun and could
|
|
7294
|
+
* not count, and has said so, until one is counted. And whether it has
|
|
7295
|
+
* said that a write it could not mark or count may be lost, which it
|
|
7296
|
+
* says only once. See `notCounted`.
|
|
7297
|
+
*/
|
|
7298
|
+
private readonly uncounted;
|
|
7299
|
+
private lossWarned;
|
|
7300
|
+
/**
|
|
7301
|
+
* The copy of each record this namespace is writing under the record's
|
|
7302
|
+
* lock, by id, from when it has decided what to write until it has
|
|
7303
|
+
* counted the write, or failed to. Its counter reads as unknown
|
|
7304
|
+
* meanwhile, as this write has begun and is not counted yet, but the
|
|
7305
|
+
* copy holds every write of the record another tab has counted, and no
|
|
7306
|
+
* other tab can make one until this one lets go of the lock. See
|
|
7307
|
+
* `dropStale`.
|
|
7308
|
+
*/
|
|
7309
|
+
private readonly locked;
|
|
7310
|
+
/**
|
|
7311
|
+
* Each directory a `createDir` here has named whose write has not landed
|
|
7312
|
+
* yet, by entry id: a promise that settles - and never rejects - once
|
|
7313
|
+
* that write has landed or failed. See `mkdir`.
|
|
7314
|
+
*/
|
|
7315
|
+
private readonly naming;
|
|
6820
7316
|
private readonly historyLimit;
|
|
6821
7317
|
private readonly maxEntries;
|
|
6822
7318
|
private readonly maxPathChars;
|
|
@@ -6975,6 +7471,7 @@ declare class VfsNamespace {
|
|
|
6975
7471
|
*/
|
|
6976
7472
|
writeFile(path: string, data: Uint8Array | string | Blob, opts?: {
|
|
6977
7473
|
type?: string;
|
|
7474
|
+
onProgress?: (done: number, total: number) => void;
|
|
6978
7475
|
}): Promise<VfsStat>;
|
|
6979
7476
|
/**
|
|
6980
7477
|
* Delete a file, or a directory when `recursive`.
|
|
@@ -7037,8 +7534,12 @@ declare class VfsNamespace {
|
|
|
7037
7534
|
* Delete metadata records no longer reachable from the root.
|
|
7038
7535
|
*
|
|
7039
7536
|
* These accumulate because every write touches exactly one record: if two
|
|
7040
|
-
*
|
|
7041
|
-
*
|
|
7537
|
+
* devices edit the same directory - or two tabs, where there is no
|
|
7538
|
+
* coordinator - the personal space keeps whichever put arrives last (a
|
|
7539
|
+
* VFS write sends no HLC, and the space applies puts of one key in arrival
|
|
7540
|
+
* order), which can leave a child whose parent entry lost the race. The
|
|
7541
|
+
* per-record queue and the coordinator order writes within one device
|
|
7542
|
+
* only. Unreachable is harmless —
|
|
7042
7543
|
* it is invisible and undecryptable-by-nobody — but it costs storage, so
|
|
7043
7544
|
* this reclaims it.
|
|
7044
7545
|
*
|
|
@@ -7078,6 +7579,15 @@ declare class VfsNamespace {
|
|
|
7078
7579
|
* the error names whichever asked first.
|
|
7079
7580
|
*/
|
|
7080
7581
|
private openDirById;
|
|
7582
|
+
/**
|
|
7583
|
+
* Fetch record `id` from the store and open it. Whatever another tab
|
|
7584
|
+
* announced before the fetch began is in what it returns (see
|
|
7585
|
+
* `current`), and so is every write its counter counts: read here, or
|
|
7586
|
+
* given as `counter` (see `OpenDir.counter`).
|
|
7587
|
+
*/
|
|
7588
|
+
private fetchRecord;
|
|
7589
|
+
/** Record `id`'s write counter now: see `OpenDir.counter`. */
|
|
7590
|
+
private counterOf;
|
|
7081
7591
|
/**
|
|
7082
7592
|
* Turn a decrypted record into an OpenDir, or throw.
|
|
7083
7593
|
*
|
|
@@ -7086,8 +7596,172 @@ declare class VfsNamespace {
|
|
|
7086
7596
|
* aside in `hidden` instead: out of every read, but kept for the write.
|
|
7087
7597
|
*/
|
|
7088
7598
|
private readRecord;
|
|
7089
|
-
/**
|
|
7599
|
+
/**
|
|
7600
|
+
* Apply an edit to a directory record and persist it.
|
|
7601
|
+
*
|
|
7602
|
+
* `dir` says which record - its id, key and path - and nothing more. The
|
|
7603
|
+
* edit is made to THE copy of that record (see `editable`), which `dir`
|
|
7604
|
+
* may no longer be, and that copy is what is written. Editing whichever
|
|
7605
|
+
* copy the caller held let two copies of one record exist at once: an
|
|
7606
|
+
* overwrite held its directory across storing the old version's
|
|
7607
|
+
* history, a write of the directory failed meanwhile and dropped it from
|
|
7608
|
+
* the cache, and a save that then read a second copy and stored it,
|
|
7609
|
+
* successfully, was undone when the overwrite stored the first.
|
|
7610
|
+
*
|
|
7611
|
+
* So `edit` must take what it writes from the record it is given, not
|
|
7612
|
+
* from anything read off `dir` before an await - and re-check whatever it
|
|
7613
|
+
* relies on from then, throwing if another write changed it, before it
|
|
7614
|
+
* changes anything. Returning false writes nothing after all.
|
|
7615
|
+
*
|
|
7616
|
+
* The write that carries the edit may carry others, made while an
|
|
7617
|
+
* earlier write of the record was in flight (see `queue`): it lands, or
|
|
7618
|
+
* fails, for all of them at once.
|
|
7619
|
+
*
|
|
7620
|
+
* With a coordinator, the edit may be made a second time, to the record
|
|
7621
|
+
* as another tab left it, and refused then (see `replay`): an edit must
|
|
7622
|
+
* check everything before it changes anything, and whatever it sets
|
|
7623
|
+
* outside `node` and `record` must be safe to set again, since each run
|
|
7624
|
+
* overwrites the last.
|
|
7625
|
+
*/
|
|
7090
7626
|
private mutate;
|
|
7627
|
+
/**
|
|
7628
|
+
* The copy of `dir`'s record that edits are made to, if there is one
|
|
7629
|
+
* without waiting: the one the cache holds, once read.
|
|
7630
|
+
*
|
|
7631
|
+
* Failing that, the one a write in flight is sending. The record was
|
|
7632
|
+
* dropped from the cache - a change was reported, our own write's echo
|
|
7633
|
+
* among them - and a read that came in since is waiting for that write,
|
|
7634
|
+
* to answer with this very copy if it lands (see `openDirById`); if it
|
|
7635
|
+
* fails, the write an edit now queues behind it carries the copy instead.
|
|
7636
|
+
*
|
|
7637
|
+
* Undefined when the record is not cached and nothing is writing it, or
|
|
7638
|
+
* it is still being read: `reopen` waits for that. A record read before
|
|
7639
|
+
* `clearCache` is edited as it is, as it always was. It is not the copy of
|
|
7640
|
+
* anything the cache holds now, and must not be handed the next identity's.
|
|
7641
|
+
*/
|
|
7642
|
+
private editable;
|
|
7643
|
+
/**
|
|
7644
|
+
* Read `dir`'s record - the cached read, or a fetch made once any write of
|
|
7645
|
+
* it in flight has settled - and then find the copy edits are made to.
|
|
7646
|
+
*/
|
|
7647
|
+
private reopen;
|
|
7648
|
+
/** Make `dir` the cached copy of its record - unless the cache has been cleared since it was read. */
|
|
7649
|
+
private adopt;
|
|
7650
|
+
/** After an edit of `copy`: its time, and any entry it cannot read that the edit replaced. */
|
|
7651
|
+
private touch;
|
|
7652
|
+
/**
|
|
7653
|
+
* The write that will carry the edit just made to `copy`.
|
|
7654
|
+
*
|
|
7655
|
+
* Writes of a record go out one at a time, each once the one before it
|
|
7656
|
+
* has landed or failed (see `writing`), and each seals the record as it
|
|
7657
|
+
* stands when it goes out. So a write still waiting carries every edit
|
|
7658
|
+
* made while it waits, and an edit made then joins it instead of
|
|
7659
|
+
* queueing a write of its own: a burst of edits of one directory while a
|
|
7660
|
+
* write of it is in flight costs two writes, not one per edit. Each is a
|
|
7661
|
+
* billed write; a 20-file upload into one folder cost twenty.
|
|
7662
|
+
*/
|
|
7663
|
+
private queue;
|
|
7664
|
+
/**
|
|
7665
|
+
* Send `batch`: from here on, an edit of its record goes in the next
|
|
7666
|
+
* write. With a coordinator, holding the lock every tab of the device
|
|
7667
|
+
* takes to write this record - see `sendLocked`.
|
|
7668
|
+
*/
|
|
7669
|
+
private send;
|
|
7670
|
+
/** Stop `batch` taking more edits, as it is sealed. */
|
|
7671
|
+
private close;
|
|
7672
|
+
/**
|
|
7673
|
+
* Send `batch` while no other tab can write its record.
|
|
7674
|
+
*
|
|
7675
|
+
* If another tab wrote the record since this copy was read, the copy is
|
|
7676
|
+
* out of date, and writing it would undo that tab's write. So it is read
|
|
7677
|
+
* again, here, under the lock, and every edit the batch carries is made
|
|
7678
|
+
* again to what was read (see `replay`). A copy no other tab has written
|
|
7679
|
+
* over is sent as it is: one tab on its own costs no extra request.
|
|
7680
|
+
*
|
|
7681
|
+
* Which it is, the record's write counter says (see
|
|
7682
|
+
* `VfsCoordinator.counters`). Read once the lock is granted, it counts
|
|
7683
|
+
* every write of the record another tab made, because each counts its
|
|
7684
|
+
* write, and waits for the count to be stored, before it lets go of the
|
|
7685
|
+
* lock. If it has moved since the copy was read, or cannot be told, the
|
|
7686
|
+
* copy is read again. Whether this tab has heard of another tab's write
|
|
7687
|
+
* does not decide it: an announcement can reach this tab after the
|
|
7688
|
+
* lock does, or never. One it has heard of can only add a read.
|
|
7689
|
+
*
|
|
7690
|
+
* The write is counted once it has landed or failed - one that failed
|
|
7691
|
+
* may have landed even so - and the other tabs are then told of it,
|
|
7692
|
+
* all before the lock is let go of.
|
|
7693
|
+
*/
|
|
7694
|
+
private sendLocked;
|
|
7695
|
+
/**
|
|
7696
|
+
* Say that a write of `copy`'s record could not be counted.
|
|
7697
|
+
*
|
|
7698
|
+
* `marked`: `VfsCoordinator.begin` stored its mark, which stays until a
|
|
7699
|
+
* count can be stored, so every tab reads the record again before it
|
|
7700
|
+
* writes it. Said once for each record, until a write of it is counted.
|
|
7701
|
+
*
|
|
7702
|
+
* Not marked, a tab whose IndexedDB works may take its copy for current
|
|
7703
|
+
* and write it over this write. Said once for this namespace, whatever
|
|
7704
|
+
* the record: where IndexedDB cannot be used at all, no write of any
|
|
7705
|
+
* folder is counted, and a warning for each said nothing new. And only
|
|
7706
|
+
* where another tab can count its writes can one be lost, which the
|
|
7707
|
+
* warning says: where no tab can, every tab reads each folder again.
|
|
7708
|
+
*/
|
|
7709
|
+
private notCounted;
|
|
7710
|
+
/**
|
|
7711
|
+
* Make every edit in `batch` again, in order, to `fresh` - the record as
|
|
7712
|
+
* another tab left it - and make that the copy. An edit that no longer
|
|
7713
|
+
* applies throws, as it would have the first time, and is left out; its
|
|
7714
|
+
* caller gets what it threw. Every edit checks before it changes
|
|
7715
|
+
* anything (see `mutate`), so one that throws has changed nothing. True
|
|
7716
|
+
* when what is left changes the record, and so needs writing.
|
|
7717
|
+
*/
|
|
7718
|
+
private replay;
|
|
7719
|
+
/**
|
|
7720
|
+
* Another tab wrote record `id` - or, null, this namespace may have
|
|
7721
|
+
* missed some announcements. What the cache holds is read again when
|
|
7722
|
+
* next asked for, as a change frame from the personal space would have
|
|
7723
|
+
* it, and a copy read before then is read again before the next write
|
|
7724
|
+
* of its record (see `current`). A hint, not a guarantee: an
|
|
7725
|
+
* announcement can reach this tab after the next lock does, or never.
|
|
7726
|
+
* What decides whether a copy may be written over, or relied on under a
|
|
7727
|
+
* move's or a delete's locks, is the record's counter: see `sendLocked`
|
|
7728
|
+
* and `dropStale`.
|
|
7729
|
+
*/
|
|
7730
|
+
private heard;
|
|
7731
|
+
/**
|
|
7732
|
+
* Does `copy` hold every write of its record another tab has announced
|
|
7733
|
+
* that this one has heard of? See `heard`. Only ever a reason to read it
|
|
7734
|
+
* again, never to take it for current: see `sendLocked`.
|
|
7735
|
+
*/
|
|
7736
|
+
private current;
|
|
7737
|
+
/**
|
|
7738
|
+
* Drop from the cache every copy of a record in `ids` that may not hold
|
|
7739
|
+
* every write of it another tab has made: its counter has moved since
|
|
7740
|
+
* the copy was read, or cannot be told, or the copy is still being read.
|
|
7741
|
+
* Returns every id whose copy here is not known to be current - those,
|
|
7742
|
+
* and those not cached - so that the next read of each fetches it again,
|
|
7743
|
+
* once any write of it in flight here has landed or failed. Not a copy
|
|
7744
|
+
* this tab is writing under its lock (see `locked`): its counter reads
|
|
7745
|
+
* as unknown only because that write is not counted yet, and dropped,
|
|
7746
|
+
* the next read would wait for the write.
|
|
7747
|
+
*
|
|
7748
|
+
* The counters are read in one go, after the caller has taken the locks
|
|
7749
|
+
* it relies on: another tab counts each write of a record before it lets
|
|
7750
|
+
* go of the locks it held while writing it, the record's own and any
|
|
7751
|
+
* move lock, so what it wrote before letting go of one of them is
|
|
7752
|
+
* counted by then. Its announcements may not have reached this tab yet,
|
|
7753
|
+
* or ever. See `sendLocked`.
|
|
7754
|
+
*/
|
|
7755
|
+
private dropStale;
|
|
7756
|
+
/**
|
|
7757
|
+
* Seal a directory record as it stands NOW and put it in the store.
|
|
7758
|
+
*
|
|
7759
|
+
* Read at the moment of sending, not when the edit was made, so a write
|
|
7760
|
+
* that waited behind another carries every edit made to the record by
|
|
7761
|
+
* then, its own included.
|
|
7762
|
+
*/
|
|
7763
|
+
private writeRecord;
|
|
7764
|
+
/** For `mkdir`: name a new, empty directory `path` in the one at `parentPath`. */
|
|
7091
7765
|
private createDir;
|
|
7092
7766
|
/**
|
|
7093
7767
|
* Every directory record in a subtree, each once, opened - and nothing
|
|
@@ -7103,8 +7777,44 @@ declare class VfsNamespace {
|
|
|
7103
7777
|
*
|
|
7104
7778
|
* `moving` says whether anything in it is marked as half of an
|
|
7105
7779
|
* interrupted move, which is what makes a delete look for the other half.
|
|
7780
|
+
*
|
|
7781
|
+
* `ids` is every entry id in it, and `shape` what each record named when
|
|
7782
|
+
* it was read: see `currentSubtree`.
|
|
7106
7783
|
*/
|
|
7107
7784
|
private subtree;
|
|
7785
|
+
/**
|
|
7786
|
+
* The records a recursive delete read, as they are now - or null when
|
|
7787
|
+
* one has changed since in a way that purging it would get wrong.
|
|
7788
|
+
*
|
|
7789
|
+
* The delete decided what to let go of, and whether to look for the
|
|
7790
|
+
* other half of a move, from what it read; then it waited, on reads and
|
|
7791
|
+
* on the write of its parent. A record that is no longer named by the
|
|
7792
|
+
* record it was read in has been moved out, and is not this delete's to
|
|
7793
|
+
* purge; an entry marked since it was read is being moved, and is about
|
|
7794
|
+
* to be named somewhere the delete never looked. Purging either purged
|
|
7795
|
+
* the folder a move had just put somewhere else. Anything else - a file
|
|
7796
|
+
* saved into one of them, or moved out - is purged as it now stands,
|
|
7797
|
+
* which is why the copies to purge are what this returns.
|
|
7798
|
+
*
|
|
7799
|
+
* Synchronous, for an edit. A record whose copy is not to hand counts as
|
|
7800
|
+
* changed.
|
|
7801
|
+
*
|
|
7802
|
+
* `held`, with a coordinator, is every entry whose move lock the delete
|
|
7803
|
+
* holds. An entry named since the records were read - saved or moved in
|
|
7804
|
+
* - is not among them, so nothing stops another tab moving it out while
|
|
7805
|
+
* the delete writes the parent, and purging it then let go of what that
|
|
7806
|
+
* move had put somewhere else. So with `held`, that counts as changed
|
|
7807
|
+
* too, and the delete is tried again from the start.
|
|
7808
|
+
*/
|
|
7809
|
+
private currentSubtree;
|
|
7810
|
+
/**
|
|
7811
|
+
* Hold the move lock of every entry in `ids` - see
|
|
7812
|
+
* `VfsCoordinator.holdMoving` - or of none: null when another holder has
|
|
7813
|
+
* any of them, and then nothing is held. Otherwise the function that
|
|
7814
|
+
* lets go of them all. Asked for all at once: none of them waits.
|
|
7815
|
+
* `shared` holds them as the folders a move goes into.
|
|
7816
|
+
*/
|
|
7817
|
+
private holdAll;
|
|
7108
7818
|
/**
|
|
7109
7819
|
* Delete these records and let go of every file in them. The second half
|
|
7110
7820
|
* of a recursive delete, run only once the subtree is detached. Cannot
|
|
@@ -7689,6 +8399,8 @@ declare class Client {
|
|
|
7689
8399
|
readonly functions: FunctionsNamespace;
|
|
7690
8400
|
/** Access tokens — `client.accessTokens.create(appId, …)`, etc. */
|
|
7691
8401
|
readonly accessTokens: AccessTokensNamespace;
|
|
8402
|
+
/** This app — `client.app.access()`: may the signed-in user add data here? */
|
|
8403
|
+
readonly app: AppNamespace;
|
|
7692
8404
|
/** Offline cache + sync — `client.offline.status`, `client.offline.snapshot`, etc. */
|
|
7693
8405
|
readonly offline: OfflineManager;
|
|
7694
8406
|
private readonly session;
|
|
@@ -8975,7 +9687,7 @@ declare function getId(row: {
|
|
|
8975
9687
|
* expect (and isn't serving a stale cached bundle). Keep this in sync with
|
|
8976
9688
|
* `package.json` `version`.
|
|
8977
9689
|
*/
|
|
8978
|
-
declare const VERSION = "0.15.0-alpha.
|
|
9690
|
+
declare const VERSION = "0.15.0-alpha.10";
|
|
8979
9691
|
|
|
8980
9692
|
/**
|
|
8981
9693
|
* The SDK's process-global logger.
|
|
@@ -9007,5 +9719,5 @@ declare global {
|
|
|
9007
9719
|
}
|
|
9008
9720
|
declare const appLogger: InstanceType<typeof Logger>;
|
|
9009
9721
|
|
|
9010
|
-
export { ACCESS_TOKEN_SCOPES, AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AccessTokensNamespace, AdmissionDeniedError, AgentsNamespace, AuthClient, AuthHttpError, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, CircuitIntegrityError, Client, ConnectivityManager, DEFAULT_AUTH_BASE_URL, DEFAULT_BASE_URL, DEFAULT_BRANCH, DEFAULT_FN_HOST_SUFFIX, DEVICE_IDENTITY_STORAGE_KEY, DEVICE_KEY_DB_NAME, DbCache, DbNamespace, DbTable, DevicePairingError, DeviceRevokedError, DeviceStoreUnavailableError, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HostedAuth, HttpClient, HttpError, IdentityLockedError, IdentityUnavailableError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KeyringHttpError, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, Logger, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NOT_MEMBER_CLOSE_CODE, NOT_MEMBER_RECHECK_MS, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PAIRING_CODE_ALPHABET, PAIRING_CODE_LENGTH, PBKDF2_DEFAULT_ITERATIONS, PINNED_CIRCUIT_DIGESTS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PasskeyOriginError, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, ROOT_ID, Ready, ReauthRequiredError, ReedSolomonCodec, Repo, Retry, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, SpaceTrustError, StorageNamespace, SyncEngine, VERSION, VFS_ROOT_INFO, VaultProtocolMismatchError, VaultUnavailableError, VcsError, VcsNamespace, VfsConflictError, VfsCorruptRecordError, VfsLimitError, VfsLockedError, VfsNamespace, VfsNotFoundError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, _accountId, _formatBytes, _messageId, _objectId, _packetId, _socketId, _userId, appLogger, assertType, base58Decode, base58Encode, buildCommitment, canonicalUserCode, clearDeviceIdentity, compareHlc, compilePrograms, concatBytes, configureDeviceStore, createPasskeyWithPrf, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultRpId, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, deserialize, deviceFingerprint, deviceIdentityIsEphemeral, deviceIdentityKey, dirKey, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, evaluatePasskeyPrf, exportPublicKeyBase64, exportPublicKeyHex, formatUserCode, fromBase64, fromBase64Url, fromHex, generateAuthProof, generateChecksum, generateDevicePairingKeypair, generateId, generatePkce, getIPAddress, getId, getMuhkooAppDescriptor, getSubtle, hasDeviceIdentity, headKey, historyKey, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isNumber, isOfflineCapable, isP2pCapable, isProvisional, isSameOriginPath, loadDeviceIdentity, log, manifestToStat, materializeRow, merge3, merge3Text, mergeKey, mergeMap, mergeMessage, mergeRegister, messageKey, objectKey, pack, padHandle, pairingVerificationCode, passkeyPrfCapable, passkeySupported, passkeyUsableFromOrigin, persistDeviceIdentity, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, refKey, refsIndexKey, rpIdUsableForOrigin, sealSeed, sealSeedToDevice, serialize, shardHash, signMessage, stableStringify, toBase64, toBase64Url, toField, toHex, tombstoneRow, unpack, unsealSeed, unsealSeedFromDevice, unwrapWithPassphrase, utf8Decode, utf8Encode, verify, verifyChecksum, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
9011
|
-
export type { ACL, ACLEntry, AccessTokenInfo, AccessTokensNamespaceDeps, AdmissionState, AgentConfig, AgentCreateInput, AgentDbToolMode, AgentProvisioned, AgentScopeOpts, AgentSkill, AgentToolsConfig, AgentTrigger, AgentTriggerType, AgentUpdateInput, AgentsNamespaceDeps, AttachedPeerNetwork, AuthClientOptions, AuthKeyPair, AuthSuccess, AuthToken, AuthType, AuthUser, BlockStore, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, CachedSpaceMessage, Change, ChannelLike, ChatKeyCert, ChunkKeyMaterial, ChunkManifest, CipherFrame, CipherMessage, CipherMessageHeader, CircuitBufferConfig, CircuitIntegrity, CircuitUrls, ClientOptions, Commit, Conflict, ConnectivityOptions, ConnectivityState, CreateAccessTokenInput, CreatedAccessToken, DbFilterOp, DbNamespaceDeps, DbQuery, DbQueryPage, DbQueryResult, DbWhereCondition, DehydratedKeypair, DehydratedKeys, DeviceBlobStore, DeviceKeyVault, DevicePairingErrorReason, DevicePairingKeypair, DevicePairingPoll, DevicePairingRequest, DevicePairingSession, DirEntry, DirNode, DoubleRatchetCipherDeps, ECDHCurve, EncodeResult, EngineHandle, EngineHost, Entry, EphemeralEvent, EpochKeyProvider, FileEntry, FileManifest, FileNamespaceDeps, FileStat, FileStorageOptions, FunctionCaps, FunctionConfig, FunctionDeployInput, FunctionInvokeOptions, FunctionScopeOpts, FunctionTrigger, FunctionTriggerType, FunctionTriggers, FunctionUpdateInput, FunctionsNamespaceDeps, Groth16Proof, Hasher, Head, HistoryRecord, HlcParts, HlcState, HostedAuthDeps, HttpClientOptions, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, KeyringClientDeps, KeyringTransport, KvEntry, KvNamespaceDeps, LogEntry, LoginOptions, LwwMap, LwwRegister, MemberView, MembershipEntry, Merge3Result, MergeRegionConflict, MergeResult, MessageBody, MessageDeletedEvent, MessageEntry, MessageEvent, MessageHeaders, MessageNamespaceDeps, MessageOp, MessageOptions, MessageSubscription, MuhkooAgentMeta, MuhkooAgentToolsConfig, MuhkooAppDescriptor, MuhkooDBAccess, MuhkooDBMeta, MuhkooFunctionMeta, MuhkooKeystoreBridge, MuhkooMessageEvent, MuhkooSpaceMeta, OAuthProvider, OfflineEntry, OfflineManagerDeps, OfflineStore, OutSink, PacketCipher, PacketHeaders, PacketOptions, PairedDevice, Participant, PasskeyEnrollment, PeerBlockSource, PeerExchangeOptions, PeerId, PeerNetworkOptions, PeerTransport, Permission, PermissionCheckRequest, PermissionCheckResult, PersistedDeviceIdentity, PersonalSpaceClientOptions, Pkce, PublicKeyJWK, QueueEntry, RatchetState, ReceiveResult, RegisterParams, Replayer, Role$1 as Role, SpaceDeps as RoomDeps, SpaceFileMetadata as RoomFileMetadata, Scope, SealedHandoff, SealedHeaders, SealedRecord, Session, SessionOptions, SessionStore, SetOptions, ShardByteCache, ShardClientOptions, SharedSpaceClientOptions, SignalEnvelope, SignalKind, SignalingSpace, SnapshotNamespaceDeps, SnarkProof, SpaceChannelLike, SpaceCursor, SpaceDeps, SpaceFileMetadata, SpaceKeyCache, SpaceKeyringDeps, SpaceMessageEvent, SpaceNamespaceDeps, SpaceOfflineAdapter, SpaceTrustCode, StartDevicePairingOptions, StorageChangeEvent, StoreName, StoredSession, Subscription, Tree, TreeDir, TreeEntry, TreeFile, UserIdentity, VaultFactor, VcsNamespaceDeps, VcsNamespaceOptions, VerificationKey, VfsContentStore, VfsNamespaceDeps, VfsStat, VfsStore, WSMessage, WSMessageType, WSTransportOptions, WaitForDevicePairingOptions, WebRtcTransportOptions, WrappedPayload, WriteFileInput, WriteFileOptions, WriteToShardsInput, ZkAuthDeps, ZkAuthenticateRequest, ZkChallengeResponse, ZkCompiled, ZkIdentity, ZkRegisterRequest, ZkRegisterResponse };
|
|
9722
|
+
export { ACCESS_TOKEN_SCOPES, AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AccessTokensNamespace, AdmissionDeniedError, AgentsNamespace, AppNamespace, AuthClient, AuthHttpError, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, CircuitIntegrityError, Client, ConnectivityManager, DEFAULT_AUTH_BASE_URL, DEFAULT_BASE_URL, DEFAULT_BRANCH, DEFAULT_FN_HOST_SUFFIX, DEVICE_IDENTITY_STORAGE_KEY, DEVICE_KEY_DB_NAME, DbCache, DbNamespace, DbTable, DevicePairingError, DeviceRevokedError, DeviceStoreUnavailableError, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HostedAuth, HttpClient, HttpError, IdentityLockedError, IdentityUnavailableError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KeyringHttpError, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, Logger, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NOT_MEMBER_CLOSE_CODE, NOT_MEMBER_RECHECK_MS, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PAIRING_CODE_ALPHABET, PAIRING_CODE_LENGTH, PBKDF2_DEFAULT_ITERATIONS, PINNED_CIRCUIT_DIGESTS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PasskeyOriginError, PaymentRequiredError, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, ROOT_ID, Ready, ReauthRequiredError, ReedSolomonCodec, Repo, Retry, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, SpaceTrustError, StorageNamespace, SyncEngine, VERSION, VFS_ROOT_INFO, VaultProtocolMismatchError, VaultUnavailableError, VcsError, VcsNamespace, VfsConflictError, VfsCorruptRecordError, VfsLimitError, VfsLockedError, VfsNamespace, VfsNotFoundError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, _accountId, _formatBytes, _messageId, _objectId, _packetId, _socketId, _userId, appLogger, assertType, base58Decode, base58Encode, buildCommitment, canonicalUserCode, clearDeviceIdentity, compareHlc, compilePrograms, concatBytes, configureDeviceStore, createPasskeyWithPrf, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultRpId, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, deserialize, deviceFingerprint, deviceIdentityIsEphemeral, deviceIdentityKey, dirKey, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, evaluatePasskeyPrf, exportPublicKeyBase64, exportPublicKeyHex, formatUserCode, fromBase64, fromBase64Url, fromHex, generateAuthProof, generateChecksum, generateDevicePairingKeypair, generateId, generatePkce, getIPAddress, getId, getMuhkooAppDescriptor, getSubtle, hasDeviceIdentity, headKey, historyKey, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isNumber, isOfflineCapable, isP2pCapable, isProvisional, isSameOriginPath, loadDeviceIdentity, log, manifestToStat, materializeRow, merge3, merge3Text, mergeKey, mergeMap, mergeMessage, mergeRegister, messageKey, objectKey, pack, padHandle, pairingVerificationCode, passkeyPrfCapable, passkeySupported, passkeyUsableFromOrigin, persistDeviceIdentity, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, refKey, refsIndexKey, rpIdUsableForOrigin, sealSeed, sealSeedToDevice, serialize, shardHash, signMessage, stableStringify, toBase64, toBase64Url, toField, toHex, tombstoneRow, unpack, unsealSeed, unsealSeedFromDevice, unwrapWithPassphrase, utf8Decode, utf8Encode, verify, verifyChecksum, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
9723
|
+
export type { ACL, ACLEntry, AccessTokenInfo, AccessTokensNamespaceDeps, AdmissionState, AgentConfig, AgentCreateInput, AgentDbToolMode, AgentProvisioned, AgentScopeOpts, AgentSkill, AgentToolsConfig, AgentTrigger, AgentTriggerType, AgentUpdateInput, AgentsNamespaceDeps, AppAccess, AppNamespaceDeps, AttachedPeerNetwork, AuthClientOptions, AuthKeyPair, AuthSuccess, AuthToken, AuthType, AuthUser, BlockStore, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, CachedSpaceMessage, Change, ChannelLike, ChatKeyCert, ChunkKeyMaterial, ChunkManifest, CipherFrame, CipherMessage, CipherMessageHeader, CircuitBufferConfig, CircuitIntegrity, CircuitUrls, ClientOptions, Commit, Conflict, ConnectivityOptions, ConnectivityState, CreateAccessTokenInput, CreatedAccessToken, DbFilterOp, DbNamespaceDeps, DbQuery, DbQueryPage, DbQueryResult, DbWhereCondition, DehydratedKeypair, DehydratedKeys, DeviceBlobStore, DeviceKeyVault, DevicePairingErrorReason, DevicePairingKeypair, DevicePairingPoll, DevicePairingRequest, DevicePairingSession, DirEntry, DirNode, DoubleRatchetCipherDeps, ECDHCurve, EncodeResult, EngineHandle, EngineHost, Entry, EphemeralEvent, EpochKeyProvider, FileEntry, FileManifest, FileNamespaceDeps, FileStat, FileStorageOptions, FunctionCaps, FunctionConfig, FunctionDeployInput, FunctionInvokeOptions, FunctionScopeOpts, FunctionTrigger, FunctionTriggerType, FunctionTriggers, FunctionUpdateInput, FunctionsNamespaceDeps, Groth16Proof, Hasher, Head, HistoryRecord, HlcParts, HlcState, HostedAuthDeps, HttpClientOptions, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, KeyringClientDeps, KeyringTransport, KvEntry, KvNamespaceDeps, LogEntry, LoginOptions, LwwMap, LwwRegister, MemberView, MembershipEntry, Merge3Result, MergeRegionConflict, MergeResult, MessageBody, MessageDeletedEvent, MessageEntry, MessageEvent, MessageHeaders, MessageNamespaceDeps, MessageOp, MessageOptions, MessageSubscription, MuhkooAgentMeta, MuhkooAgentToolsConfig, MuhkooAppDescriptor, MuhkooDBAccess, MuhkooDBMeta, MuhkooFunctionMeta, MuhkooKeystoreBridge, MuhkooMessageEvent, MuhkooSpaceMeta, OAuthProvider, OfflineEntry, OfflineManagerDeps, OfflineStore, OutSink, PacketCipher, PacketHeaders, PacketOptions, PairedDevice, Participant, PasskeyEnrollment, PaymentRequiredCode, PeerBlockSource, PeerExchangeOptions, PeerId, PeerNetworkOptions, PeerTransport, Permission, PermissionCheckRequest, PermissionCheckResult, PersistedDeviceIdentity, PersonalSpaceClientOptions, Pkce, PublicKeyJWK, QueueEntry, RatchetState, ReceiveResult, RegisterParams, Replayer, Role$1 as Role, SpaceDeps as RoomDeps, SpaceFileMetadata as RoomFileMetadata, Scope, SealedHandoff, SealedHeaders, SealedRecord, Session, SessionOptions, SessionStore, SetOptions, ShardByteCache, ShardClientOptions, SharedSpaceClientOptions, SignalEnvelope, SignalKind, SignalingSpace, SnapshotNamespaceDeps, SnarkProof, SpaceChannelLike, SpaceCursor, SpaceDeps, SpaceFileMetadata, SpaceKeyCache, SpaceKeyringDeps, SpaceMessageEvent, SpaceNamespaceDeps, SpaceOfflineAdapter, SpaceTrustCode, StartDevicePairingOptions, StorageChangeEvent, StoreName, StoredSession, Subscription, Tree, TreeDir, TreeEntry, TreeFile, UserIdentity, VaultFactor, VcsNamespaceDeps, VcsNamespaceOptions, VerificationKey, VfsContentStore, VfsNamespaceDeps, VfsStat, VfsStore, WSMessage, WSMessageType, WSTransportOptions, WaitForDevicePairingOptions, WebRtcTransportOptions, WrappedPayload, WriteFileInput, WriteFileOptions, WriteToShardsInput, ZkAuthDeps, ZkAuthenticateRequest, ZkChallengeResponse, ZkCompiled, ZkIdentity, ZkRegisterRequest, ZkRegisterResponse };
|