@scalebun-release/protocol 2.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ScaleBun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @scalebun/protocol — Barrel Export
3
+ *
4
+ * Versioned Zod wire schemas for the ScaleBun UNIFIED INGESTION PROTOCOL. This is the one contract
5
+ * every platform speaks (web today; RN, Flutter, native next) and the backend validates against.
6
+ * Runtime Zod schemas live here; pure TS-only types live in @scalebun/sdk-contracts.
7
+ */
8
+ export * from './internal/enums.js';
9
+ export * from './internal/frames.js';
10
+ export * from './internal/items.js';
11
+ export * from './internal/envelope.js';
12
+ export * from './internal/validation.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @scalebun/protocol — Barrel Export
3
+ *
4
+ * Versioned Zod wire schemas for the ScaleBun UNIFIED INGESTION PROTOCOL. This is the one contract
5
+ * every platform speaks (web today; RN, Flutter, native next) and the backend validates against.
6
+ * Runtime Zod schemas live here; pure TS-only types live in @scalebun/sdk-contracts.
7
+ */
8
+ export * from './internal/enums.js';
9
+ export * from './internal/frames.js';
10
+ export * from './internal/items.js';
11
+ export * from './internal/envelope.js';
12
+ export * from './internal/validation.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * `platform` is an OPEN enum on purpose. The whole point of the unified protocol is that a future
4
+ * Flutter / native client "just works" without a backend change — so the wire type is a plain
5
+ * string, and we publish the known values for tooling/UI. Never make this a closed z.enum().
6
+ */
7
+ export declare const KNOWN_PLATFORMS: readonly ["web", "ios", "android", "react-native", "flutter"];
8
+ export type KnownPlatform = (typeof KNOWN_PLATFORMS)[number];
9
+ export declare const PlatformSchema: z.ZodString;
10
+ export type Platform = z.infer<typeof PlatformSchema>;
11
+ /**
12
+ * The capture model. The ONLY axis on which platforms structurally diverge — it discriminates the
13
+ * shape of a replay `frame` (see frames.ts). Closed enum: adding a renderer is a deliberate change
14
+ * because the dashboard player must learn to render it.
15
+ */
16
+ export declare const RendererSchema: z.ZodEnum<["dom", "screenshot", "view-hierarchy", "canvas"]>;
17
+ export type Renderer = z.infer<typeof RendererSchema>;
18
+ /** Item discriminator. Each maps to one backend handler/table. */
19
+ export declare const ItemKindSchema: z.ZodEnum<["error", "network", "performance", "frame", "event", "rating", "log", "identify"]>;
20
+ export type ItemKind = z.infer<typeof ItemKindSchema>;
21
+ /** Timestamps are epoch-ms OR ISO string on the wire (every SDK historically sent both). */
22
+ export declare const TimestampSchema: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
23
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/internal/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,eAAe,+DAAgE,CAAC;AAC7F,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,cAAc,aAAoB,CAAC;AAChD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,cAAc,8DAA4D,CAAC;AACxF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,kEAAkE;AAClE,eAAO,MAAM,cAAc,+FASzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,4FAA4F;AAC5F,eAAO,MAAM,eAAe,wCAAoC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * `platform` is an OPEN enum on purpose. The whole point of the unified protocol is that a future
4
+ * Flutter / native client "just works" without a backend change — so the wire type is a plain
5
+ * string, and we publish the known values for tooling/UI. Never make this a closed z.enum().
6
+ */
7
+ export const KNOWN_PLATFORMS = ['web', 'ios', 'android', 'react-native', 'flutter'];
8
+ export const PlatformSchema = z.string().min(1);
9
+ /**
10
+ * The capture model. The ONLY axis on which platforms structurally diverge — it discriminates the
11
+ * shape of a replay `frame` (see frames.ts). Closed enum: adding a renderer is a deliberate change
12
+ * because the dashboard player must learn to render it.
13
+ */
14
+ export const RendererSchema = z.enum(['dom', 'screenshot', 'view-hierarchy', 'canvas']);
15
+ /** Item discriminator. Each maps to one backend handler/table. */
16
+ export const ItemKindSchema = z.enum([
17
+ 'error',
18
+ 'network',
19
+ 'performance',
20
+ 'frame',
21
+ 'event',
22
+ 'rating',
23
+ 'log',
24
+ 'identify',
25
+ ]);
26
+ /** Timestamps are epoch-ms OR ISO string on the wire (every SDK historically sent both). */
27
+ export const TimestampSchema = z.union([z.number(), z.string()]);
28
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/internal/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,CAAU,CAAC;AAG7F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAGhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGxF,kEAAkE;AAClE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,OAAO;IACP,SAAS;IACT,aAAa;IACb,OAAO;IACP,OAAO;IACP,QAAQ;IACR,KAAK;IACL,UAAU;CACX,CAAC,CAAC;AAGH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC"}