@muhkoo/connect 0.15.0-alpha.3 → 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.
@@ -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 };