@muhkoo/connect 0.15.0-alpha.4 → 0.15.0-alpha.5
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 +352 -59
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +190 -15
- package/dist/connect.workers.d.ts +55 -2
- package/dist/server/index.js +352 -59
- 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 +1 -1
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,6 +2524,8 @@ 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
2530
|
/** Hashes waiting for the next batch, each with everyone awaiting it and its size if a caller gave it. */
|
|
2467
2531
|
private pendingShards;
|
|
@@ -3895,12 +3959,7 @@ interface HttpClientOptions {
|
|
|
3895
3959
|
*/
|
|
3896
3960
|
onUnauthorized?: () => Promise<boolean>;
|
|
3897
3961
|
}
|
|
3898
|
-
|
|
3899
|
-
declare class HttpError extends Error {
|
|
3900
|
-
readonly status: number;
|
|
3901
|
-
readonly body?: unknown | undefined;
|
|
3902
|
-
constructor(message: string, status: number, body?: unknown | undefined);
|
|
3903
|
-
}
|
|
3962
|
+
|
|
3904
3963
|
declare class HttpClient {
|
|
3905
3964
|
readonly baseUrl: string;
|
|
3906
3965
|
/** Origin of {@link baseUrl} — credentials are only attached same-origin. */
|
|
@@ -4052,6 +4111,14 @@ interface QueueEntry {
|
|
|
4052
4111
|
method: string;
|
|
4053
4112
|
/** Serializable arguments captured at enqueue time. */
|
|
4054
4113
|
args: unknown;
|
|
4114
|
+
/**
|
|
4115
|
+
* Whose write it is: the commitment of the user signed in when it was
|
|
4116
|
+
* queued, stamped by `OutboundQueue.enqueue`. A drain sends only the
|
|
4117
|
+
* signed-in user's entries, because every replayer builds its request
|
|
4118
|
+
* from the session signed in when it runs. Absent on entries an older
|
|
4119
|
+
* SDK queued, which any drain sends, as before.
|
|
4120
|
+
*/
|
|
4121
|
+
commitment?: string;
|
|
4055
4122
|
}
|
|
4056
4123
|
interface OfflineEntry<T> {
|
|
4057
4124
|
key: string;
|
|
@@ -4091,9 +4158,14 @@ interface OfflineStore {
|
|
|
4091
4158
|
* mutation by re-invoking the real namespace method (with an `isReplay` flag so
|
|
4092
4159
|
* it doesn't re-enqueue). `drain()` replays entries in HLC order:
|
|
4093
4160
|
* - success → remove the entry;
|
|
4094
|
-
* -
|
|
4095
|
-
*
|
|
4096
|
-
*
|
|
4161
|
+
* - refused for payment (`PaymentRequiredError`: the app takes paid plans
|
|
4162
|
+
* only, or someone's payment is past due) → keep it and everything after
|
|
4163
|
+
* it, stop, and surface a `SYNC_ERROR` with `dropped: false`. The server
|
|
4164
|
+
* accepts it once the user or the app owner pays, so it waits for the next
|
|
4165
|
+
* reconnect, or for `client.app.access()` to report the app allowed;
|
|
4166
|
+
* - permanent failure (any other 4xx, or a Space whose member list refuses
|
|
4167
|
+
* this user) → drop it and surface a `SYNC_ERROR` (a write the server will
|
|
4168
|
+
* never accept must not wedge the queue forever);
|
|
4097
4169
|
* - transient/network failure → stop draining and leave the rest for the next
|
|
4098
4170
|
* reconnect.
|
|
4099
4171
|
*
|
|
@@ -4121,7 +4193,11 @@ interface OutboundQueueOptions {
|
|
|
4121
4193
|
* tests), every drain runs, as before.
|
|
4122
4194
|
*/
|
|
4123
4195
|
tryLock?: TryLock;
|
|
4124
|
-
/**
|
|
4196
|
+
/**
|
|
4197
|
+
* The signed-in user: stamps each enqueued write, picks which writes a
|
|
4198
|
+
* drain sends, and names the drain lock. With no one signed in, writes are
|
|
4199
|
+
* unstamped and the drain runs unlocked.
|
|
4200
|
+
*/
|
|
4125
4201
|
commitment?: () => string | null;
|
|
4126
4202
|
}
|
|
4127
4203
|
declare class OutboundQueue {
|
|
@@ -4132,10 +4208,25 @@ declare class OutboundQueue {
|
|
|
4132
4208
|
constructor(store: OfflineStore, opts?: OutboundQueueOptions);
|
|
4133
4209
|
/** A domain registers how to replay its mutations. */
|
|
4134
4210
|
register(domain: QueueEntry["domain"], replayer: Replayer): void;
|
|
4135
|
-
/**
|
|
4211
|
+
/**
|
|
4212
|
+
* Record a mutation for later replay; resolves with its assigned seq.
|
|
4213
|
+
* Stamped with the signed-in user's commitment, so that it is only ever
|
|
4214
|
+
* sent under their session (see {@link waiting}).
|
|
4215
|
+
*/
|
|
4136
4216
|
enqueue(entry: Omit<QueueEntry, "seq">): Promise<number>;
|
|
4137
|
-
/** Number of writes still awaiting sync. */
|
|
4217
|
+
/** Number of writes still awaiting sync, every user's. */
|
|
4138
4218
|
pending(): Promise<number>;
|
|
4219
|
+
/**
|
|
4220
|
+
* The writes a drain would send now, in order: the signed-in user's, and
|
|
4221
|
+
* any an older SDK queued without saying whose they are. Every tab of an
|
|
4222
|
+
* origin shares this queue, and every replayer builds its request from
|
|
4223
|
+
* the session signed in when it runs, so another user's write sent now
|
|
4224
|
+
* would land in this user's space, or overwrite their data. It stays
|
|
4225
|
+
* queued, as it is, until its own user signs in on this device again.
|
|
4226
|
+
*/
|
|
4227
|
+
waiting(): Promise<QueueEntry[]>;
|
|
4228
|
+
/** True for an entry this drain may send: the signed-in user's, or one with no user. */
|
|
4229
|
+
private sendable;
|
|
4139
4230
|
/**
|
|
4140
4231
|
* Replay queued mutations in HLC order. Coalesces concurrent calls into a
|
|
4141
4232
|
* single in-flight drain. Stops on the first transient failure, leaving the
|
|
@@ -4149,6 +4240,10 @@ declare class OutboundQueue {
|
|
|
4149
4240
|
* a drain after it finds only what it left.
|
|
4150
4241
|
*/
|
|
4151
4242
|
private drainOnce;
|
|
4243
|
+
/**
|
|
4244
|
+
* One pass over the queue. False when a write refused for payment stopped
|
|
4245
|
+
* it, which leaves that write and everything after it queued.
|
|
4246
|
+
*/
|
|
4152
4247
|
private runDrain;
|
|
4153
4248
|
}
|
|
4154
4249
|
|
|
@@ -4307,6 +4402,16 @@ declare class OfflineManager {
|
|
|
4307
4402
|
* replayer re-PUTs from the cache on reconnect.
|
|
4308
4403
|
*/
|
|
4309
4404
|
deferShardUpload(hash: string): Promise<void>;
|
|
4405
|
+
/**
|
|
4406
|
+
* Replay the queue now, as a reconnect does, if anything is waiting in it.
|
|
4407
|
+
* `client.app.access()` calls this each time it reports the app allowed,
|
|
4408
|
+
* so writes kept after a refusal for payment go out once the user or the
|
|
4409
|
+
* app owner has paid, without waiting for the next reconnect. One drain per
|
|
4410
|
+
* call, never on a timer. With nothing of the signed-in user's queued it
|
|
4411
|
+
* does not drain at all, so the app sees no "syncing". A drain also runs the
|
|
4412
|
+
* catch-up tasks (Space history paging), as a reconnect does.
|
|
4413
|
+
*/
|
|
4414
|
+
resume(): Promise<void>;
|
|
4310
4415
|
/** Resolve once the clock + node id are loaded. */
|
|
4311
4416
|
ready(): Promise<void>;
|
|
4312
4417
|
/** Current connectivity state (`online` | `offline` | `syncing`). */
|
|
@@ -5447,6 +5552,12 @@ interface SpaceDeps {
|
|
|
5447
5552
|
httpBaseUrl: string;
|
|
5448
5553
|
/** Header-injecting fetch from the client's HttpClient. */
|
|
5449
5554
|
fetch: typeof fetch;
|
|
5555
|
+
/**
|
|
5556
|
+
* The same fetch with the client's silent 401 recovery (`HttpClient.fetchWithRecovery`). File uploads
|
|
5557
|
+
* use it, so a PUT made with a dead session re-establishes the session once instead of failing.
|
|
5558
|
+
* Defaults to {@link fetch}.
|
|
5559
|
+
*/
|
|
5560
|
+
fetchWithRecovery?: typeof fetch;
|
|
5450
5561
|
/** Resolves the user id used for the ratchet / member id (signed-in username). */
|
|
5451
5562
|
myId: () => string;
|
|
5452
5563
|
/** Resolves a short-lived WS upgrade ticket (or null when keyless). */
|
|
@@ -6583,6 +6694,68 @@ declare class AccessTokensNamespace {
|
|
|
6583
6694
|
private path;
|
|
6584
6695
|
}
|
|
6585
6696
|
|
|
6697
|
+
/**
|
|
6698
|
+
* `client.app` — what the signed-in user may do in this app (accelerator spec
|
|
6699
|
+
* 2026-10-06-paid-accounts-and-past-due, B6 and B8).
|
|
6700
|
+
*
|
|
6701
|
+
* An app's owner can turn on "Paid Muhkoo accounts only" in the portal. The
|
|
6702
|
+
* accelerator then refuses a Free user's writes that add data, with a 402 the
|
|
6703
|
+
* SDK throws as `PaymentRequiredError`. Reads, sign-in and deletes still work.
|
|
6704
|
+
* The same refusal reaches every user of an app whose owner's payment is past
|
|
6705
|
+
* due, whether or not the setting is on.
|
|
6706
|
+
*
|
|
6707
|
+
* `access()` asks up front, so an app can show the right screen before the
|
|
6708
|
+
* first refusal.
|
|
6709
|
+
*/
|
|
6710
|
+
|
|
6711
|
+
/** The answer of `GET /api/app/access`. */
|
|
6712
|
+
interface AppAccess {
|
|
6713
|
+
/** The owner has turned on "Paid Muhkoo accounts only" for this app. */
|
|
6714
|
+
paidAccountsOnly: boolean;
|
|
6715
|
+
/** The signed-in user may add data in this app now. */
|
|
6716
|
+
allowed: boolean;
|
|
6717
|
+
/**
|
|
6718
|
+
* Why not: the code a refused write carries. Read only when `allowed` is
|
|
6719
|
+
* false, and only when it is one of the three codes.
|
|
6720
|
+
*/
|
|
6721
|
+
reason?: PaymentRequiredCode;
|
|
6722
|
+
/**
|
|
6723
|
+
* Where to send the user, as an absolute URL: the portal's upgrade page
|
|
6724
|
+
* for `user_plan_required`, with a way back to this app when the request
|
|
6725
|
+
* came from one of its registered redirect URIs, or its billing page for
|
|
6726
|
+
* `user_payment_past_due`. The accelerator sends it only for those two
|
|
6727
|
+
* reasons: the user can do nothing about the owner's payment. Read only
|
|
6728
|
+
* when `allowed` is false, and only when it is an absolute http(s) URL.
|
|
6729
|
+
*/
|
|
6730
|
+
upgradeUrl?: string;
|
|
6731
|
+
}
|
|
6732
|
+
interface AppNamespaceDeps {
|
|
6733
|
+
http: HttpClient;
|
|
6734
|
+
/**
|
|
6735
|
+
* Called each time `access()` answers `allowed: true`. The Client sends
|
|
6736
|
+
* the writes its offline queue kept after a refusal for payment
|
|
6737
|
+
* (`OfflineManager.resume`). A throw or a rejection is logged and ignored.
|
|
6738
|
+
*/
|
|
6739
|
+
onAllowed?: () => Promise<void>;
|
|
6740
|
+
}
|
|
6741
|
+
declare class AppNamespace {
|
|
6742
|
+
private readonly deps;
|
|
6743
|
+
constructor(deps: AppNamespaceDeps);
|
|
6744
|
+
/**
|
|
6745
|
+
* Whether the signed-in user may add data in this app and, if not, why
|
|
6746
|
+
* and where to send them. Needs the app key and a session; a stale session
|
|
6747
|
+
* is re-established once, as for every request. The route is never
|
|
6748
|
+
* refused for payment. Throws `HttpError` for anything else, among them a
|
|
6749
|
+
* 401 without a session and a 404 from an accelerator older than the
|
|
6750
|
+
* route.
|
|
6751
|
+
*
|
|
6752
|
+
* Each `allowed: true` also sends any writes the offline queue kept after
|
|
6753
|
+
* a refusal for payment, without waiting for them. Call it after sign-in,
|
|
6754
|
+
* and again when the user comes back from the portal.
|
|
6755
|
+
*/
|
|
6756
|
+
access(): Promise<AppAccess>;
|
|
6757
|
+
}
|
|
6758
|
+
|
|
6586
6759
|
/**
|
|
6587
6760
|
* Wire types for the VFS metadata layer.
|
|
6588
6761
|
*
|
|
@@ -8207,6 +8380,8 @@ declare class Client {
|
|
|
8207
8380
|
readonly functions: FunctionsNamespace;
|
|
8208
8381
|
/** Access tokens — `client.accessTokens.create(appId, …)`, etc. */
|
|
8209
8382
|
readonly accessTokens: AccessTokensNamespace;
|
|
8383
|
+
/** This app — `client.app.access()`: may the signed-in user add data here? */
|
|
8384
|
+
readonly app: AppNamespace;
|
|
8210
8385
|
/** Offline cache + sync — `client.offline.status`, `client.offline.snapshot`, etc. */
|
|
8211
8386
|
readonly offline: OfflineManager;
|
|
8212
8387
|
private readonly session;
|
|
@@ -9493,7 +9668,7 @@ declare function getId(row: {
|
|
|
9493
9668
|
* expect (and isn't serving a stale cached bundle). Keep this in sync with
|
|
9494
9669
|
* `package.json` `version`.
|
|
9495
9670
|
*/
|
|
9496
|
-
declare const VERSION = "0.15.0-alpha.
|
|
9671
|
+
declare const VERSION = "0.15.0-alpha.5";
|
|
9497
9672
|
|
|
9498
9673
|
/**
|
|
9499
9674
|
* The SDK's process-global logger.
|
|
@@ -9525,5 +9700,5 @@ declare global {
|
|
|
9525
9700
|
}
|
|
9526
9701
|
declare const appLogger: InstanceType<typeof Logger>;
|
|
9527
9702
|
|
|
9528
|
-
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 };
|
|
9529
|
-
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 };
|
|
9703
|
+
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 };
|
|
9704
|
+
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 };
|
|
@@ -1179,6 +1179,59 @@ declare class BroadcastChannel {
|
|
|
1179
1179
|
private handleInboundFrame;
|
|
1180
1180
|
}
|
|
1181
1181
|
|
|
1182
|
+
/**
|
|
1183
|
+
* `HttpError` — thrown for any non-2xx accelerator response.
|
|
1184
|
+
*
|
|
1185
|
+
* In a module of its own so that `PaymentRequiredError` can extend it while
|
|
1186
|
+
* `HttpClient`, which throws both, imports `PaymentRequiredError`: with the
|
|
1187
|
+
* class in `HttpClient.ts`, the two modules would import each other, and
|
|
1188
|
+
* whichever loaded second would extend a class not yet defined. `HttpClient`
|
|
1189
|
+
* re-exports it, so `import { HttpError } from "./HttpClient"` still works.
|
|
1190
|
+
*/
|
|
1191
|
+
/** Thrown for any non-2xx accelerator response. Carries the HTTP status. */
|
|
1192
|
+
declare class HttpError extends Error {
|
|
1193
|
+
readonly status: number;
|
|
1194
|
+
readonly body?: unknown | undefined;
|
|
1195
|
+
constructor(message: string, status: number, body?: unknown | undefined);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* `PaymentRequiredError` — a write the accelerator refused for payment
|
|
1200
|
+
* (accelerator spec 2026-10-06-paid-accounts-and-past-due, "Interfaces and
|
|
1201
|
+
* contracts").
|
|
1202
|
+
*
|
|
1203
|
+
* The accelerator answers such a write with a 402 whose body carries one of
|
|
1204
|
+
* three codes:
|
|
1205
|
+
* - `user_plan_required`: the app takes paid Muhkoo plans only, and the
|
|
1206
|
+
* signed-in user is on Free;
|
|
1207
|
+
* - `user_payment_past_due`: the user's own Muhkoo payment is past due. Only
|
|
1208
|
+
* first-party apps are told this; every other app is told
|
|
1209
|
+
* `user_plan_required` instead;
|
|
1210
|
+
* - `owner_payment_past_due`: the app owner's payment is past due, so the
|
|
1211
|
+
* app stores nothing new for anyone.
|
|
1212
|
+
* Reads, sign-in and deletes still work in all three cases.
|
|
1213
|
+
*
|
|
1214
|
+
* Every other 402 — the Free-tier refusals that carry `quotaExceeded`,
|
|
1215
|
+
* `requiresPaidTier` or `freeTierFull` — has no `code`, and stays a plain
|
|
1216
|
+
* `HttpError`, as before.
|
|
1217
|
+
*/
|
|
1218
|
+
|
|
1219
|
+
/** Why a write was refused for payment. A wire contract: these strings never change. */
|
|
1220
|
+
type PaymentRequiredCode = "user_plan_required" | "user_payment_past_due" | "owner_payment_past_due";
|
|
1221
|
+
/** Thrown for a 402 whose body carries one of the three {@link PaymentRequiredCode}s. */
|
|
1222
|
+
declare class PaymentRequiredError extends HttpError {
|
|
1223
|
+
/** Why the write was refused. */
|
|
1224
|
+
readonly code: PaymentRequiredCode;
|
|
1225
|
+
/**
|
|
1226
|
+
* Where to send the user: the portal's upgrade page or its billing page,
|
|
1227
|
+
* as an absolute URL. Set only when the server sent an absolute http(s)
|
|
1228
|
+
* URL. The relative `upgradeUrl` of the Free-tier refusals is never here:
|
|
1229
|
+
* those are not this error.
|
|
1230
|
+
*/
|
|
1231
|
+
readonly upgradeUrl?: string;
|
|
1232
|
+
constructor(message: string, code: PaymentRequiredCode, body?: unknown, upgradeUrl?: string);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1182
1235
|
/**
|
|
1183
1236
|
* Cloudflare-Workers-compatible Groth16 ZK proof verifier.
|
|
1184
1237
|
*
|
|
@@ -1221,5 +1274,5 @@ declare function initBn128Wasm(wasmModule?: WebAssembly.Module): Promise<Bn128Wa
|
|
|
1221
1274
|
*/
|
|
1222
1275
|
declare function verifyGroth16(wasmInstance: WebAssembly.Instance, memory: WebAssembly.Memory, initialPFree: number, verificationKey: VerificationKey, proof: Groth16Proof, publicSignals: string[]): Promise<boolean>;
|
|
1223
1276
|
|
|
1224
|
-
export { AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, BroadcastChannel, BroadcastChannelEvents, ChunkCipher, DoubleRatchet, EncryptedSession, EventCore, EventCoreEvents, KeyStore, Message, Message as MessageDefault, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, SerializeMessage, WSTransport, decorators, decryptAesGcm, deriveAesKeyFromPassphrase, deriveBitsHkdf, encryptAesGcm, getSubtle, initBn128Wasm, randomBytes, unwrapWithPassphrase, verifyGroth16, wrapWithPassphrase };
|
|
1225
|
-
export type { ACL, ACLEntry, AuthKeyPair, AuthType, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, ChunkKeyMaterial, CipherFrame, CipherMessage, CipherMessageHeader, DehydratedKeypair, DehydratedKeys, ECDHCurve, Groth16Proof, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, MessageBody, MessageEvent, MessageHeaders, MessageOptions, OAuthProvider, PacketOptions, Participant, Permission, PermissionCheckRequest, PermissionCheckResult, PublicKeyJWK, RatchetState, ReceiveResult, Role, Session, SessionOptions, Subscription, UserIdentity, VerificationKey, WSMessage, WSMessageType, WSTransportOptions, WrappedPayload };
|
|
1277
|
+
export { AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, BroadcastChannel, BroadcastChannelEvents, ChunkCipher, DoubleRatchet, EncryptedSession, EventCore, EventCoreEvents, KeyStore, Message, Message as MessageDefault, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PaymentRequiredError, SerializeMessage, WSTransport, decorators, decryptAesGcm, deriveAesKeyFromPassphrase, deriveBitsHkdf, encryptAesGcm, getSubtle, initBn128Wasm, randomBytes, unwrapWithPassphrase, verifyGroth16, wrapWithPassphrase };
|
|
1278
|
+
export type { ACL, ACLEntry, AuthKeyPair, AuthType, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, ChunkKeyMaterial, CipherFrame, CipherMessage, CipherMessageHeader, DehydratedKeypair, DehydratedKeys, ECDHCurve, Groth16Proof, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, MessageBody, MessageEvent, MessageHeaders, MessageOptions, OAuthProvider, PacketOptions, Participant, PaymentRequiredCode, Permission, PermissionCheckRequest, PermissionCheckResult, PublicKeyJWK, RatchetState, ReceiveResult, Role, Session, SessionOptions, Subscription, UserIdentity, VerificationKey, WSMessage, WSMessageType, WSTransportOptions, WrappedPayload };
|