@muhkoo/connect 0.15.0-alpha.4 → 0.15.0-alpha.6

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.
@@ -2529,6 +2529,67 @@ class BroadcastChannel {
2529
2529
  }
2530
2530
  }
2531
2531
 
2532
+ /**
2533
+ * `HttpError` — thrown for any non-2xx accelerator response.
2534
+ *
2535
+ * In a module of its own so that `PaymentRequiredError` can extend it while
2536
+ * `HttpClient`, which throws both, imports `PaymentRequiredError`: with the
2537
+ * class in `HttpClient.ts`, the two modules would import each other, and
2538
+ * whichever loaded second would extend a class not yet defined. `HttpClient`
2539
+ * re-exports it, so `import { HttpError } from "./HttpClient"` still works.
2540
+ */
2541
+ /** Thrown for any non-2xx accelerator response. Carries the HTTP status. */
2542
+ class HttpError extends Error {
2543
+ status;
2544
+ body;
2545
+ constructor(message, status, body) {
2546
+ super(message);
2547
+ this.status = status;
2548
+ this.body = body;
2549
+ this.name = "HttpError";
2550
+ }
2551
+ }
2552
+
2553
+ /**
2554
+ * `PaymentRequiredError` — a write the accelerator refused for payment
2555
+ * (accelerator spec 2026-10-06-paid-accounts-and-past-due, "Interfaces and
2556
+ * contracts").
2557
+ *
2558
+ * The accelerator answers such a write with a 402 whose body carries one of
2559
+ * three codes:
2560
+ * - `user_plan_required`: the app takes paid Muhkoo plans only, and the
2561
+ * signed-in user is on Free;
2562
+ * - `user_payment_past_due`: the user's own Muhkoo payment is past due. Only
2563
+ * first-party apps are told this; every other app is told
2564
+ * `user_plan_required` instead;
2565
+ * - `owner_payment_past_due`: the app owner's payment is past due, so the
2566
+ * app stores nothing new for anyone.
2567
+ * Reads, sign-in and deletes still work in all three cases.
2568
+ *
2569
+ * Every other 402 — the Free-tier refusals that carry `quotaExceeded`,
2570
+ * `requiresPaidTier` or `freeTierFull` — has no `code`, and stays a plain
2571
+ * `HttpError`, as before.
2572
+ */
2573
+ /** Thrown for a 402 whose body carries one of the three {@link PaymentRequiredCode}s. */
2574
+ class PaymentRequiredError extends HttpError {
2575
+ /** Why the write was refused. */
2576
+ code;
2577
+ /**
2578
+ * Where to send the user: the portal's upgrade page or its billing page,
2579
+ * as an absolute URL. Set only when the server sent an absolute http(s)
2580
+ * URL. The relative `upgradeUrl` of the Free-tier refusals is never here:
2581
+ * those are not this error.
2582
+ */
2583
+ upgradeUrl;
2584
+ constructor(message, code, body, upgradeUrl) {
2585
+ super(message, 402, body);
2586
+ this.name = "PaymentRequiredError";
2587
+ this.code = code;
2588
+ if (upgradeUrl !== undefined)
2589
+ this.upgradeUrl = upgradeUrl;
2590
+ }
2591
+ }
2592
+
2532
2593
  function _loadWasmModule (sync, filepath, src, imports) {
2533
2594
  function _instantiateOrCompile(source, imports, stream) {
2534
2595
  var instantiateFunc = stream ? WebAssembly.instantiateStreaming : WebAssembly.instantiate;
@@ -2815,5 +2876,5 @@ function alloc(u32, size) {
2815
2876
  return ptr;
2816
2877
  }
2817
2878
 
2818
- 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 };
2879
+ 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 };
2819
2880
  //# sourceMappingURL=index.js.map