naro-js 0.7.0 → 0.7.1

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/README.md CHANGED
@@ -774,7 +774,10 @@ await naro.removeChannel(room);
774
774
  4003, 4004 and 4410 stop it — call `subscribe()` again; it connects after
775
775
  the backoff, counted from the stop, so a `subscribe()` in the
776
776
  `CHANNEL_ERROR` callback does not spin. 4029 comes back after 5 seconds at
777
- least (60 to 70 for `IP_RATE_LIMITED`); 4503 after 0 to 10 seconds, every
777
+ least (60 to 70 for `IP_RATE_LIMITED`; 900 to 910 for
778
+ `REALTIME_QUOTA_EXCEEDED` — the project used its realtime messages for the
779
+ month (an operator's cap): tried again every 15 minutes, naro-js 0.7.1);
780
+ 4503 after 0 to 10 seconds, every
778
781
  time; anything else after 1, 2, 5 and then 10 seconds, each times 0.5 to
779
782
  1.5 — after a 4008 the steps start over only once the connection outlived
780
783
  a heartbeat. Removing the last channel and subscribing again keeps the wait
package/dist/index.js CHANGED
@@ -717,6 +717,9 @@ var RETRY_AFTER_CODES = /* @__PURE__ */ new Set([
717
717
  "STORAGE_OPS_QUOTA_EXCEEDED",
718
718
  // Realtime's REST broadcast over the project's message budget (x-retry-after: 1).
719
719
  "TOO_MANY_MESSAGES",
720
+ // The dispatcher's REST 429 of a project over its month of Realtime (3-2e):
721
+ // `x-retry-after` is the seconds to the 1st at 00:00 UTC.
722
+ "REALTIME_QUOTA_EXCEEDED",
720
723
  // Naro Functions (design F20): a team over its monthly function CPU, and
721
724
  // the control plane's Cloudflare limit. `invoke` reads x-retry-after on
722
725
  // every relay error anyway (invoke/client.ts).
@@ -2672,6 +2675,7 @@ var TableBuilder = class {
2672
2675
  var BACKOFF_STEPS_MS = [1e3, 2e3, 5e3, 1e4];
2673
2676
  var RATE_LIMITED_MIN_MS = 5e3;
2674
2677
  var IP_LIMIT_WAIT_MS = 6e4;
2678
+ var QUOTA_WAIT_MS = 9e5;
2675
2679
  var RESTART_JITTER_MS = 1e4;
2676
2680
  var UNOPENED_SLOWDOWN_AFTER = 6;
2677
2681
  var UNOPENED_DELAY_MS = 6e4;
@@ -2688,7 +2692,7 @@ function closeAction(code, reason) {
2688
2692
  if (code === 4401) return { kind: "session" };
2689
2693
  if (code === 4503) return { kind: "restart" };
2690
2694
  if (code === 4029)
2691
- return reason === "IP_RATE_LIMITED" ? { kind: "wait", ms: IP_LIMIT_WAIT_MS } : { kind: "retry", minMs: RATE_LIMITED_MIN_MS };
2695
+ return reason === "IP_RATE_LIMITED" ? { kind: "wait", ms: IP_LIMIT_WAIT_MS } : reason === "REALTIME_QUOTA_EXCEEDED" ? { kind: "wait", ms: QUOTA_WAIT_MS } : { kind: "retry", minMs: RATE_LIMITED_MIN_MS };
2692
2696
  return { kind: "retry", minMs: 0 };
2693
2697
  }
2694
2698
  function backoffMs(attempt2, random) {
@@ -4,6 +4,12 @@ export declare const BACKOFF_STEPS_MS: readonly [1000, 2000, 5000, 10000];
4
4
  export declare const RATE_LIMITED_MIN_MS = 5000;
5
5
  /** The dispatcher's per-address window is a fixed minute (3-2c-2 결정 9). */
6
6
  export declare const IP_LIMIT_WAIT_MS = 60000;
7
+ /**
8
+ * A month's block (Realtime 3-2e): the meter looks again every 15 minutes, so
9
+ * a refused client comes back on that beat — not every few seconds for the
10
+ * rest of the month. After the 1st it is back within about 15 minutes.
11
+ */
12
+ export declare const QUOTA_WAIT_MS = 900000;
7
13
  /**
8
14
  * A restart closes everyone at once, so every 4503 return waits 0–10 s (design
9
15
  * D6). The wait does not grow with the attempt count or the unopened tries:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naro-js",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Auth, data and files for your Naro project, from the browser or the server.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -34,11 +34,11 @@
34
34
  "tsup": "8.5.0",
35
35
  "typescript": "7.0.2",
36
36
  "vitest": "3.2.7",
37
+ "@next-deploy/backend-worker": "0.1.0",
37
38
  "@next-deploy/config": "0.1.0",
38
- "@next-deploy/data-core": "0.1.0",
39
- "@next-deploy/sdk": "0.1.0",
40
39
  "@next-deploy/functions-runtime": "0.1.0",
41
- "@next-deploy/backend-worker": "0.1.0"
40
+ "@next-deploy/sdk": "0.1.0",
41
+ "@next-deploy/data-core": "0.1.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsup && pnpm build:types",