@app-studio/realtime-core 0.1.0 → 0.1.3

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
@@ -19,6 +19,47 @@ RealtimeEventSchema.parse(event);
19
19
 
20
20
  The core package is framework-free. It does not know about NestJS, Prisma, React, Socket.IO, or Pub/Sub.
21
21
 
22
+ ## Payload guard
23
+
24
+ `RealtimeEventSchema` rejects anything JSON cannot represent, and the durable log
25
+ is replayed to browsers — so an unbounded or non-JSON payload is both a storage
26
+ and a delivery problem. `boundRealtimePayload` produces a bounded, JSON-safe copy
27
+ and reports what it had to do:
28
+
29
+ ```ts
30
+ const {payload, truncated, coerced, bytes} = boundRealtimePayload(input, {
31
+ maxBytes: 64 * 1024,
32
+ maxStringBytes: 8 * 1024,
33
+ maxArrayItems: 256,
34
+ maxObjectKeys: 128,
35
+ maxDepth: 12,
36
+ });
37
+ ```
38
+
39
+ It truncates oversized strings head-and-tail, caps arrays and objects, replaces
40
+ cycles and over-deep subtrees, and converts `Date`/`bigint`/`NaN`/`undefined`.
41
+ Every reduction leaves a self-describing marker: a silent truncation reads as
42
+ complete data to whoever consumes the event later.
43
+
44
+ `createRealtimePayloadGuard({transform, ...limits})` adds a redaction hook that
45
+ runs **before** bounding, because truncating first can cut a secret in half and
46
+ leave a prefix that no longer matches the pattern meant to remove it.
47
+ `@app-studio/realtime-nest` applies the guard to every emit.
48
+
49
+ ## Ordering
50
+
51
+ `compareRealtimeEvents` is a total order: `seq` within a run (the only gap-free
52
+ monotonic field, since it is allocated under a unique constraint), then timestamp
53
+ and id across runs. Use it whenever events can arrive out of order — replay
54
+ racing live delivery, or several scopes merged into one view.
55
+
56
+ ## Wire frames
57
+
58
+ The transports and the browser client share their frame names here, so a rename
59
+ cannot drift between the two halves of the protocol:
60
+ `REALTIME_EVENT_FRAME`, `REALTIME_CAUGHT_UP_FRAME`, `REALTIME_KEEPALIVE_FRAME`,
61
+ `REALTIME_CONNECTED_FRAME`, and the `RealtimeDeliveryPhase` (`replay` | `live`).
62
+
22
63
  ## Install
23
64
 
24
65
  ```bash
@@ -1,4 +1,25 @@
1
1
  export declare const REALTIME_V1: 1;
2
+ /**
3
+ * Wire names shared by the server transports and the browser client. They live
4
+ * in core so a rename cannot drift between the two halves of the protocol.
5
+ */
6
+ export declare const REALTIME_EVENT_FRAME: "realtime";
7
+ /**
8
+ * Control frame marking the switch from durable replay to live delivery. A
9
+ * consumer cannot tell the two apart from the events themselves, and the
10
+ * difference matters: replayed events must not re-trigger notifications.
11
+ */
12
+ export declare const REALTIME_CAUGHT_UP_FRAME: "caught-up";
13
+ /** Idle-connection keepalive. Carries no event and is safe to ignore. */
14
+ export declare const REALTIME_KEEPALIVE_FRAME: "ping";
15
+ /** Socket.IO handshake acknowledgement, emitted once rooms are joined. */
16
+ export declare const REALTIME_CONNECTED_FRAME: "connected";
17
+ /**
18
+ * Whether an event reached the consumer through durable replay or live
19
+ * delivery.
20
+ */
21
+ export declare const REALTIME_DELIVERY_PHASES: readonly ["replay", "live"];
22
+ export type RealtimeDeliveryPhase = (typeof REALTIME_DELIVERY_PHASES)[number];
2
23
  export declare const REALTIME_EVENT_VISIBILITY: readonly ["user", "project", "admin", "debug", "internal"];
3
24
  export type RealtimeEventVisibility = (typeof REALTIME_EVENT_VISIBILITY)[number];
4
25
  export declare const REALTIME_EVENT_STATUS: readonly ["pending", "assigned", "running", "paused", "blocked", "waiting_input", "review", "completed", "failed", "cancelled", "expired", "archived"];
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,EAAG,CAAU,CAAC;AAEtC,eAAO,MAAM,yBAAyB,4DAM5B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7C,eAAO,MAAM,qBAAqB,wJAaxB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,EAAG,CAAU,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAG,UAAmB,CAAC;AACxD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAG,WAAoB,CAAC;AAC7D,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,EAAG,MAAe,CAAC;AACxD,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,EAAG,WAAoB,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,wBAAwB,6BAA8B,CAAC;AAEpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,eAAO,MAAM,yBAAyB,4DAM5B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7C,eAAO,MAAM,qBAAqB,wJAaxB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/constants.js CHANGED
@@ -1,7 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REALTIME_EVENT_STATUS = exports.REALTIME_EVENT_VISIBILITY = exports.REALTIME_V1 = void 0;
3
+ exports.REALTIME_EVENT_STATUS = exports.REALTIME_EVENT_VISIBILITY = exports.REALTIME_DELIVERY_PHASES = exports.REALTIME_CONNECTED_FRAME = exports.REALTIME_KEEPALIVE_FRAME = exports.REALTIME_CAUGHT_UP_FRAME = exports.REALTIME_EVENT_FRAME = exports.REALTIME_V1 = void 0;
4
4
  exports.REALTIME_V1 = 1;
5
+ /**
6
+ * Wire names shared by the server transports and the browser client. They live
7
+ * in core so a rename cannot drift between the two halves of the protocol.
8
+ */
9
+ exports.REALTIME_EVENT_FRAME = 'realtime';
10
+ /**
11
+ * Control frame marking the switch from durable replay to live delivery. A
12
+ * consumer cannot tell the two apart from the events themselves, and the
13
+ * difference matters: replayed events must not re-trigger notifications.
14
+ */
15
+ exports.REALTIME_CAUGHT_UP_FRAME = 'caught-up';
16
+ /** Idle-connection keepalive. Carries no event and is safe to ignore. */
17
+ exports.REALTIME_KEEPALIVE_FRAME = 'ping';
18
+ /** Socket.IO handshake acknowledgement, emitted once rooms are joined. */
19
+ exports.REALTIME_CONNECTED_FRAME = 'connected';
20
+ /**
21
+ * Whether an event reached the consumer through durable replay or live
22
+ * delivery.
23
+ */
24
+ exports.REALTIME_DELIVERY_PHASES = ['replay', 'live'];
5
25
  exports.REALTIME_EVENT_VISIBILITY = [
6
26
  'user',
7
27
  'project',
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,CAAU,CAAC;AAEzB,QAAA,yBAAyB,GAAG;IACvC,MAAM;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACP,UAAU;CACF,CAAC;AAKE,QAAA,qBAAqB,GAAG;IACnC,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;IACR,SAAS;IACT,eAAe;IACf,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,WAAW;IACX,SAAS;IACT,UAAU;CACF,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,CAAU,CAAC;AAEtC;;;GAGG;AACU,QAAA,oBAAoB,GAAG,UAAmB,CAAC;AACxD;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,WAAoB,CAAC;AAC7D,yEAAyE;AAC5D,QAAA,wBAAwB,GAAG,MAAe,CAAC;AACxD,0EAA0E;AAC7D,QAAA,wBAAwB,GAAG,WAAoB,CAAC;AAE7D;;;GAGG;AACU,QAAA,wBAAwB,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAU,CAAC;AAIvD,QAAA,yBAAyB,GAAG;IACvC,MAAM;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACP,UAAU;CACF,CAAC;AAKE,QAAA,qBAAqB,GAAG;IACnC,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;IACR,SAAS;IACT,eAAe;IACf,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,WAAW;IACX,SAAS;IACT,UAAU;CACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,5 +3,7 @@ export * from './cursor';
3
3
  export * from './deduper';
4
4
  export * from './event';
5
5
  export * from './json';
6
+ export * from './order';
7
+ export * from './payload';
6
8
  export * from './schema';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -19,5 +19,7 @@ __exportStar(require("./cursor"), exports);
19
19
  __exportStar(require("./deduper"), exports);
20
20
  __exportStar(require("./event"), exports);
21
21
  __exportStar(require("./json"), exports);
22
+ __exportStar(require("./order"), exports);
23
+ __exportStar(require("./payload"), exports);
22
24
  __exportStar(require("./schema"), exports);
23
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,yCAAuB;AACvB,0CAAwB;AACxB,4CAA0B;AAC1B,2CAAyB"}
@@ -0,0 +1,13 @@
1
+ import type { RealtimeEvent } from './schema';
2
+ /**
3
+ * Total order for events that may arrive out of order — replay racing live
4
+ * delivery, or several scopes multiplexed into one store.
5
+ *
6
+ * Within a run, `seq` is the authority: it is allocated under a unique
7
+ * constraint, so it is the only field guaranteed to be gap-free and monotonic.
8
+ * Across runs there is no shared sequence, so the comparison falls back to the
9
+ * timestamp and then to the id, which keeps the order stable (never 0 for two
10
+ * distinct events) even when two runs emit in the same millisecond.
11
+ */
12
+ export declare function compareRealtimeEvents(left: RealtimeEvent, right: RealtimeEvent): number;
13
+ //# sourceMappingURL=order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../src/order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,aAAa,GACnB,MAAM,CASR"}
package/dist/order.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compareRealtimeEvents = compareRealtimeEvents;
4
+ /**
5
+ * Total order for events that may arrive out of order — replay racing live
6
+ * delivery, or several scopes multiplexed into one store.
7
+ *
8
+ * Within a run, `seq` is the authority: it is allocated under a unique
9
+ * constraint, so it is the only field guaranteed to be gap-free and monotonic.
10
+ * Across runs there is no shared sequence, so the comparison falls back to the
11
+ * timestamp and then to the id, which keeps the order stable (never 0 for two
12
+ * distinct events) even when two runs emit in the same millisecond.
13
+ */
14
+ function compareRealtimeEvents(left, right) {
15
+ if (left.runId === right.runId) {
16
+ if (left.seq !== right.seq)
17
+ return left.seq - right.seq;
18
+ return left.id < right.id ? -1 : left.id > right.id ? 1 : 0;
19
+ }
20
+ if (left.timestamp !== right.timestamp) {
21
+ return left.timestamp < right.timestamp ? -1 : 1;
22
+ }
23
+ return left.id < right.id ? -1 : left.id > right.id ? 1 : 0;
24
+ }
25
+ //# sourceMappingURL=order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.js","sourceRoot":"","sources":["../src/order.ts"],"names":[],"mappings":";;AAYA,sDAYC;AAtBD;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,IAAmB,EACnB,KAAoB;IAEpB,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACxD,OAAO,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { RealtimeJsonValue } from './json';
2
+ /**
3
+ * Structural and size limits applied to an event payload before it reaches the
4
+ * durable store and the live transports.
5
+ *
6
+ * Two properties motivate this guard:
7
+ *
8
+ * - the durable log is replayed to browsers, so an unbounded payload becomes
9
+ * an unbounded SSE frame and an unbounded browser allocation;
10
+ * - `RealtimeJsonValueSchema` rejects values JSON cannot represent (`Date`,
11
+ * `bigint`, `undefined`, `NaN`, cyclic references), so an emitter that
12
+ * forwards a caller payload verbatim throws on perfectly ordinary input.
13
+ *
14
+ * The guard therefore both bounds and coerces, and reports which of the two it
15
+ * had to do.
16
+ */
17
+ export interface RealtimePayloadLimits {
18
+ /** Approximate serialized ceiling for the whole payload. */
19
+ maxBytes?: number;
20
+ /** Nesting levels kept before a subtree is replaced by a marker. */
21
+ maxDepth?: number;
22
+ /** Per-string ceiling, applied before the whole-payload ceiling. */
23
+ maxStringBytes?: number;
24
+ /** Items kept per array. */
25
+ maxArrayItems?: number;
26
+ /** Keys kept per object. */
27
+ maxObjectKeys?: number;
28
+ }
29
+ export declare const REALTIME_PAYLOAD_LIMITS: Required<RealtimePayloadLimits>;
30
+ /** Marker used when the whole payload cannot be brought under `maxBytes`. */
31
+ export declare const REALTIME_PAYLOAD_TOO_LARGE = "payload_too_large";
32
+ export interface BoundRealtimePayload {
33
+ payload: RealtimeJsonValue;
34
+ /** Data was dropped: string, array, object or depth truncation. */
35
+ truncated: boolean;
36
+ /** Values JSON cannot represent were converted or omitted. */
37
+ coerced: boolean;
38
+ /** Serialized size of the returned payload. */
39
+ bytes: number;
40
+ }
41
+ export declare function realtimeJsonByteLength(text: string): number;
42
+ /**
43
+ * Produce a JSON-safe, bounded copy of `value`.
44
+ *
45
+ * The byte budget is consumed during the walk rather than checked afterwards,
46
+ * so bounding a pathologically large input does not first materialize a
47
+ * pathologically large copy. Every reduction leaves a self-describing marker in
48
+ * place of the removed data — a silent truncation reads as complete data to
49
+ * whoever consumes the event later.
50
+ */
51
+ export declare function boundRealtimePayload(value: unknown, limits?: RealtimePayloadLimits): BoundRealtimePayload;
52
+ export interface RealtimePayloadGuardOptions extends RealtimePayloadLimits {
53
+ /**
54
+ * Redaction hook, applied to the raw payload *before* bounding.
55
+ *
56
+ * The order matters: truncating first can cut a secret in half and leave a
57
+ * prefix that no longer matches the pattern meant to remove it, so anything
58
+ * pattern-based has to see the untruncated value.
59
+ */
60
+ transform?: (payload: unknown) => unknown;
61
+ }
62
+ export type RealtimePayloadGuard = (value: unknown) => BoundRealtimePayload;
63
+ export declare function createRealtimePayloadGuard(options?: RealtimePayloadGuardOptions): RealtimePayloadGuard;
64
+ //# sourceMappingURL=payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../src/payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,qBAAqB;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,qBAAqB,CAMnE,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,mEAAmE;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;CACf;AAeD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,MAAM,GAAE,qBAA0B,GACjC,oBAAoB,CAgCtB;AAED,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACxE;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;CAC3C;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,oBAAoB,CAAC;AAE5E,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,2BAAgC,GACxC,oBAAoB,CAItB"}
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REALTIME_PAYLOAD_TOO_LARGE = exports.REALTIME_PAYLOAD_LIMITS = void 0;
4
+ exports.realtimeJsonByteLength = realtimeJsonByteLength;
5
+ exports.boundRealtimePayload = boundRealtimePayload;
6
+ exports.createRealtimePayloadGuard = createRealtimePayloadGuard;
7
+ exports.REALTIME_PAYLOAD_LIMITS = {
8
+ maxBytes: 64 * 1024,
9
+ maxDepth: 12,
10
+ maxStringBytes: 8 * 1024,
11
+ maxArrayItems: 256,
12
+ maxObjectKeys: 128,
13
+ };
14
+ /** Marker used when the whole payload cannot be brought under `maxBytes`. */
15
+ exports.REALTIME_PAYLOAD_TOO_LARGE = 'payload_too_large';
16
+ const encoder = new TextEncoder();
17
+ /** Sentinel meaning "this value has no JSON representation at all". */
18
+ const OMIT = Symbol('realtime.payload.omit');
19
+ function realtimeJsonByteLength(text) {
20
+ return encoder.encode(text).length;
21
+ }
22
+ /**
23
+ * Produce a JSON-safe, bounded copy of `value`.
24
+ *
25
+ * The byte budget is consumed during the walk rather than checked afterwards,
26
+ * so bounding a pathologically large input does not first materialize a
27
+ * pathologically large copy. Every reduction leaves a self-describing marker in
28
+ * place of the removed data — a silent truncation reads as complete data to
29
+ * whoever consumes the event later.
30
+ */
31
+ function boundRealtimePayload(value, limits = {}) {
32
+ const resolved = { ...exports.REALTIME_PAYLOAD_LIMITS, ...stripUndefined(limits) };
33
+ const state = {
34
+ limits: resolved,
35
+ remaining: resolved.maxBytes,
36
+ truncated: false,
37
+ coerced: false,
38
+ seen: new WeakSet(),
39
+ };
40
+ const bounded = bound(value, 0, state);
41
+ const payload = bounded === OMIT ? null : bounded;
42
+ if (bounded === OMIT)
43
+ state.coerced = true;
44
+ const bytes = serializedByteLength(payload);
45
+ if (bytes <= resolved.maxBytes) {
46
+ return { payload, truncated: state.truncated, coerced: state.coerced, bytes };
47
+ }
48
+ // Backstop: the budget accounting is approximate, so a payload can still land
49
+ // over the ceiling. Replace it wholesale rather than emit an oversized frame.
50
+ const marker = {
51
+ _truncated: true,
52
+ _reason: exports.REALTIME_PAYLOAD_TOO_LARGE,
53
+ _bytes: bytes,
54
+ };
55
+ return {
56
+ payload: marker,
57
+ truncated: true,
58
+ coerced: state.coerced,
59
+ bytes: serializedByteLength(marker),
60
+ };
61
+ }
62
+ function createRealtimePayloadGuard(options = {}) {
63
+ const { transform, ...limits } = options;
64
+ return (value) => boundRealtimePayload(transform ? transform(value) : value, limits);
65
+ }
66
+ function bound(value, depth, state) {
67
+ if (value === null)
68
+ return charge(null, 4, state);
69
+ const valueType = typeof value;
70
+ if (valueType === 'boolean')
71
+ return charge(value, 5, state);
72
+ if (valueType === 'number') {
73
+ if (!Number.isFinite(value)) {
74
+ state.coerced = true;
75
+ return charge(null, 4, state);
76
+ }
77
+ return charge(value, 8, state);
78
+ }
79
+ if (valueType === 'string')
80
+ return boundString(value, state);
81
+ if (valueType === 'bigint') {
82
+ state.coerced = true;
83
+ return boundString(String(value), state);
84
+ }
85
+ if (valueType === 'undefined' || valueType === 'function' || valueType === 'symbol') {
86
+ state.coerced = true;
87
+ return OMIT;
88
+ }
89
+ const objectValue = value;
90
+ if (state.seen.has(objectValue)) {
91
+ state.truncated = true;
92
+ return boundString('[circular]', state);
93
+ }
94
+ const unwrapped = unwrapToJson(objectValue, state);
95
+ if (unwrapped !== objectValue)
96
+ return bound(unwrapped, depth, state);
97
+ if (depth >= state.limits.maxDepth) {
98
+ state.truncated = true;
99
+ return boundString('[truncated: max depth]', state);
100
+ }
101
+ state.seen.add(objectValue);
102
+ try {
103
+ return Array.isArray(objectValue)
104
+ ? boundArray(objectValue, depth, state)
105
+ : boundObject(objectValue, depth, state);
106
+ }
107
+ finally {
108
+ // Only sibling reuse should be allowed; a value reachable twice on
109
+ // different branches is not a cycle.
110
+ state.seen.delete(objectValue);
111
+ }
112
+ }
113
+ function boundArray(value, depth, state) {
114
+ const result = [];
115
+ state.remaining -= 2;
116
+ const keep = Math.min(value.length, state.limits.maxArrayItems);
117
+ for (let index = 0; index < keep; index++) {
118
+ if (state.remaining <= 0) {
119
+ state.truncated = true;
120
+ result.push(`[truncated: ${value.length - index} more items]`);
121
+ return result;
122
+ }
123
+ const item = bound(value[index], depth + 1, state);
124
+ // JSON.stringify renders a hole as null rather than dropping it.
125
+ result.push(item === OMIT ? null : item);
126
+ state.remaining -= 1;
127
+ }
128
+ if (keep < value.length) {
129
+ state.truncated = true;
130
+ result.push(`[truncated: ${value.length - keep} more items]`);
131
+ }
132
+ return result;
133
+ }
134
+ function boundObject(value, depth, state) {
135
+ const result = {};
136
+ state.remaining -= 2;
137
+ const keys = Object.keys(value);
138
+ const keep = Math.min(keys.length, state.limits.maxObjectKeys);
139
+ let written = 0;
140
+ for (let index = 0; index < keep; index++) {
141
+ const key = keys[index];
142
+ if (state.remaining <= 0) {
143
+ state.truncated = true;
144
+ result._truncatedKeys = keys.length - written;
145
+ return result;
146
+ }
147
+ const bounded = bound(value[key], depth + 1, state);
148
+ if (bounded === OMIT)
149
+ continue;
150
+ result[key] = bounded;
151
+ written += 1;
152
+ state.remaining -= realtimeJsonByteLength(key) + 4;
153
+ }
154
+ if (keep < keys.length) {
155
+ state.truncated = true;
156
+ result._truncatedKeys = keys.length - keep;
157
+ }
158
+ return result;
159
+ }
160
+ function boundString(value, state) {
161
+ const ceiling = Math.max(0, Math.min(state.limits.maxStringBytes, Math.max(state.remaining, 0)));
162
+ const text = truncateToBytes(value, ceiling, state);
163
+ state.remaining -= realtimeJsonByteLength(text) + 2;
164
+ return text;
165
+ }
166
+ /**
167
+ * Keep the head and the tail of an oversized string: for logs and stack traces
168
+ * the two ends carry the signal, and the marker states exactly how much of the
169
+ * middle went missing.
170
+ */
171
+ function truncateToBytes(value, maxBytes, state) {
172
+ if (realtimeJsonByteLength(value) <= maxBytes)
173
+ return value;
174
+ state.truncated = true;
175
+ let budget = Math.min(value.length, Math.max(maxBytes, 0));
176
+ for (;;) {
177
+ const head = Math.floor(budget * 0.6);
178
+ const tail = Math.floor(budget * 0.25);
179
+ const omitted = value.length - head - tail;
180
+ const candidate = `${value.slice(0, head)}\n[truncated ${omitted} chars]\n${value.slice(value.length - tail)}`;
181
+ if (budget === 0 || realtimeJsonByteLength(candidate) <= maxBytes) {
182
+ return candidate;
183
+ }
184
+ budget = Math.floor(budget / 2);
185
+ }
186
+ }
187
+ /**
188
+ * Apply `JSON.stringify` semantics for objects that describe their own JSON
189
+ * form, so a `Date` becomes its ISO string instead of an empty object.
190
+ */
191
+ function unwrapToJson(value, state) {
192
+ const candidate = value;
193
+ if (typeof candidate.toJSON !== 'function')
194
+ return value;
195
+ state.coerced = true;
196
+ try {
197
+ return candidate.toJSON();
198
+ }
199
+ catch {
200
+ state.truncated = true;
201
+ return '[unserializable]';
202
+ }
203
+ }
204
+ function charge(value, cost, state) {
205
+ state.remaining -= cost;
206
+ return value;
207
+ }
208
+ function serializedByteLength(value) {
209
+ try {
210
+ return realtimeJsonByteLength(JSON.stringify(value) ?? 'null');
211
+ }
212
+ catch {
213
+ return Number.POSITIVE_INFINITY;
214
+ }
215
+ }
216
+ function stripUndefined(limits) {
217
+ return Object.fromEntries(Object.entries(limits).filter(([, value]) => value !== undefined));
218
+ }
219
+ //# sourceMappingURL=payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.js","sourceRoot":"","sources":["../src/payload.ts"],"names":[],"mappings":";;;AAgEA,wDAEC;AAWD,oDAmCC;AAeD,gEAMC;AAvGY,QAAA,uBAAuB,GAAoC;IACtE,QAAQ,EAAE,EAAE,GAAG,IAAI;IACnB,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,CAAC,GAAG,IAAI;IACxB,aAAa,EAAE,GAAG;IAClB,aAAa,EAAE,GAAG;CACnB,CAAC;AAEF,6EAA6E;AAChE,QAAA,0BAA0B,GAAG,mBAAmB,CAAC;AAY9D,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,uEAAuE;AACvE,MAAM,IAAI,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAU7C,SAAgB,sBAAsB,CAAC,IAAY;IACjD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,KAAc,EACd,SAAgC,EAAE;IAElC,MAAM,QAAQ,GAAG,EAAC,GAAG,+BAAuB,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,EAAC,CAAC;IACzE,MAAM,KAAK,GAAe;QACxB,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,QAAQ,CAAC,QAAQ;QAC5B,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,IAAI,OAAO,EAAU;KAC5B,CAAC;IAEF,MAAM,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AC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,iBAAiB,CAAC;IAClC,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CACrB,MAA6B;IAE7B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAClE,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-studio/realtime-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "license": "UNLICENSED",
5
5
  "type": "commonjs",
6
6
  "description": "Core realtime event envelope, schemas, cursor helpers, and deduplication utilities.",