@stringpush/realtime-protocol 0.1.0

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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Redis pub/sub channel naming for project-scoped realtime fan-out.
3
+ *
4
+ * Intent: `project:{id}` isolates subscribers; pattern helpers support gateway subscribe/unsubscribe.
5
+ */
6
+ export declare function projectChannel(projectId: string): string;
7
+ export declare const PROJECT_CHANNEL_PATTERN = "project:*";
8
+ export declare function projectIdFromChannel(channel: string): string | null;
9
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../src/channels.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,uBAAuB,cAAc,CAAC;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOnE"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Redis pub/sub channel naming for project-scoped realtime fan-out.
3
+ *
4
+ * Intent: `project:{id}` isolates subscribers; pattern helpers support gateway subscribe/unsubscribe.
5
+ */
6
+ export function projectChannel(projectId) {
7
+ return `project:${projectId}`;
8
+ }
9
+ export const PROJECT_CHANNEL_PATTERN = "project:*";
10
+ export function projectIdFromChannel(channel) {
11
+ const prefix = "project:";
12
+ if (!channel.startsWith(prefix)) {
13
+ return null;
14
+ }
15
+ const id = channel.slice(prefix.length);
16
+ return id.length > 0 ? id : null;
17
+ }
18
+ //# sourceMappingURL=channels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.js","sourceRoot":"","sources":["../src/channels.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,WAAW,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAEnD,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,MAAM,MAAM,GAAG,UAAU,CAAC;IAC1B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACnC,CAAC"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Zod schemas and helpers for project-scoped realtime event payloads.
3
+ *
4
+ * Intent: delta-only messages with a 4KB cap; validated on publish and before fan-out to clients.
5
+ */
6
+ import { z } from "zod";
7
+ export declare const MAX_REALTIME_PAYLOAD_BYTES = 4096;
8
+ export declare const translationUpdatedPayloadSchema: z.ZodObject<{
9
+ projectId: z.ZodString;
10
+ keyId: z.ZodString;
11
+ localeId: z.ZodString;
12
+ environmentId: z.ZodString;
13
+ version: z.ZodNumber;
14
+ /** Wire-format key (`namespace.segment`) for SDK catalog patches. */
15
+ keyPath: z.ZodString;
16
+ localeCode: z.ZodString;
17
+ value: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ projectId: string;
20
+ keyId: string;
21
+ localeId: string;
22
+ environmentId: string;
23
+ version: number;
24
+ keyPath: string;
25
+ localeCode: string;
26
+ value: string;
27
+ }, {
28
+ projectId: string;
29
+ keyId: string;
30
+ localeId: string;
31
+ environmentId: string;
32
+ version: number;
33
+ keyPath: string;
34
+ localeCode: string;
35
+ value: string;
36
+ }>;
37
+ export declare const bundlePublishedReleaseSchema: z.ZodObject<{
38
+ localeId: z.ZodString;
39
+ localeCode: z.ZodString;
40
+ bundleVersion: z.ZodNumber;
41
+ }, "strip", z.ZodTypeAny, {
42
+ localeId: string;
43
+ localeCode: string;
44
+ bundleVersion: number;
45
+ }, {
46
+ localeId: string;
47
+ localeCode: string;
48
+ bundleVersion: number;
49
+ }>;
50
+ export declare const bundlePublishedPayloadSchema: z.ZodObject<{
51
+ projectId: z.ZodString;
52
+ applicationId: z.ZodString;
53
+ environmentId: z.ZodString;
54
+ releases: z.ZodArray<z.ZodObject<{
55
+ localeId: z.ZodString;
56
+ localeCode: z.ZodString;
57
+ bundleVersion: z.ZodNumber;
58
+ }, "strip", z.ZodTypeAny, {
59
+ localeId: string;
60
+ localeCode: string;
61
+ bundleVersion: number;
62
+ }, {
63
+ localeId: string;
64
+ localeCode: string;
65
+ bundleVersion: number;
66
+ }>, "many">;
67
+ }, "strip", z.ZodTypeAny, {
68
+ projectId: string;
69
+ environmentId: string;
70
+ applicationId: string;
71
+ releases: {
72
+ localeId: string;
73
+ localeCode: string;
74
+ bundleVersion: number;
75
+ }[];
76
+ }, {
77
+ projectId: string;
78
+ environmentId: string;
79
+ applicationId: string;
80
+ releases: {
81
+ localeId: string;
82
+ localeCode: string;
83
+ bundleVersion: number;
84
+ }[];
85
+ }>;
86
+ export declare const realtimeEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
87
+ type: z.ZodLiteral<"translation.updated">;
88
+ payload: z.ZodObject<{
89
+ projectId: z.ZodString;
90
+ keyId: z.ZodString;
91
+ localeId: z.ZodString;
92
+ environmentId: z.ZodString;
93
+ version: z.ZodNumber;
94
+ /** Wire-format key (`namespace.segment`) for SDK catalog patches. */
95
+ keyPath: z.ZodString;
96
+ localeCode: z.ZodString;
97
+ value: z.ZodString;
98
+ }, "strip", z.ZodTypeAny, {
99
+ projectId: string;
100
+ keyId: string;
101
+ localeId: string;
102
+ environmentId: string;
103
+ version: number;
104
+ keyPath: string;
105
+ localeCode: string;
106
+ value: string;
107
+ }, {
108
+ projectId: string;
109
+ keyId: string;
110
+ localeId: string;
111
+ environmentId: string;
112
+ version: number;
113
+ keyPath: string;
114
+ localeCode: string;
115
+ value: string;
116
+ }>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ type: "translation.updated";
119
+ payload: {
120
+ projectId: string;
121
+ keyId: string;
122
+ localeId: string;
123
+ environmentId: string;
124
+ version: number;
125
+ keyPath: string;
126
+ localeCode: string;
127
+ value: string;
128
+ };
129
+ }, {
130
+ type: "translation.updated";
131
+ payload: {
132
+ projectId: string;
133
+ keyId: string;
134
+ localeId: string;
135
+ environmentId: string;
136
+ version: number;
137
+ keyPath: string;
138
+ localeCode: string;
139
+ value: string;
140
+ };
141
+ }>, z.ZodObject<{
142
+ type: z.ZodLiteral<"bundle.published">;
143
+ payload: z.ZodObject<{
144
+ projectId: z.ZodString;
145
+ applicationId: z.ZodString;
146
+ environmentId: z.ZodString;
147
+ releases: z.ZodArray<z.ZodObject<{
148
+ localeId: z.ZodString;
149
+ localeCode: z.ZodString;
150
+ bundleVersion: z.ZodNumber;
151
+ }, "strip", z.ZodTypeAny, {
152
+ localeId: string;
153
+ localeCode: string;
154
+ bundleVersion: number;
155
+ }, {
156
+ localeId: string;
157
+ localeCode: string;
158
+ bundleVersion: number;
159
+ }>, "many">;
160
+ }, "strip", z.ZodTypeAny, {
161
+ projectId: string;
162
+ environmentId: string;
163
+ applicationId: string;
164
+ releases: {
165
+ localeId: string;
166
+ localeCode: string;
167
+ bundleVersion: number;
168
+ }[];
169
+ }, {
170
+ projectId: string;
171
+ environmentId: string;
172
+ applicationId: string;
173
+ releases: {
174
+ localeId: string;
175
+ localeCode: string;
176
+ bundleVersion: number;
177
+ }[];
178
+ }>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ type: "bundle.published";
181
+ payload: {
182
+ projectId: string;
183
+ environmentId: string;
184
+ applicationId: string;
185
+ releases: {
186
+ localeId: string;
187
+ localeCode: string;
188
+ bundleVersion: number;
189
+ }[];
190
+ };
191
+ }, {
192
+ type: "bundle.published";
193
+ payload: {
194
+ projectId: string;
195
+ environmentId: string;
196
+ applicationId: string;
197
+ releases: {
198
+ localeId: string;
199
+ localeCode: string;
200
+ bundleVersion: number;
201
+ }[];
202
+ };
203
+ }>]>;
204
+ export type TranslationUpdatedPayload = z.infer<typeof translationUpdatedPayloadSchema>;
205
+ export type BundlePublishedPayload = z.infer<typeof bundlePublishedPayloadSchema>;
206
+ export type RealtimeEvent = z.infer<typeof realtimeEventSchema>;
207
+ export declare function parseRealtimeEvent(raw: string): RealtimeEvent;
208
+ export declare function serializeRealtimeEvent(event: RealtimeEvent): string;
209
+ export declare function assertRealtimePayloadSize(json: string): void;
210
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,eAAO,MAAM,+BAA+B;;;;;;IAM1C,qEAAqE;;;;;;;;;;;;;;;;;;;;;;EAIrE,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EAIvC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKvC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;QAnB9B,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4BrE,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAG7D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAInE;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI5D"}
package/dist/events.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Zod schemas and helpers for project-scoped realtime event payloads.
3
+ *
4
+ * Intent: delta-only messages with a 4KB cap; validated on publish and before fan-out to clients.
5
+ */
6
+ import { z } from "zod";
7
+ export const MAX_REALTIME_PAYLOAD_BYTES = 4096;
8
+ export const translationUpdatedPayloadSchema = z.object({
9
+ projectId: z.string().uuid(),
10
+ keyId: z.string().uuid(),
11
+ localeId: z.string().uuid(),
12
+ environmentId: z.string().uuid(),
13
+ version: z.number().int().positive(),
14
+ /** Wire-format key (`namespace.segment`) for SDK catalog patches. */
15
+ keyPath: z.string().min(1).max(512),
16
+ localeCode: z.string().min(1).max(32),
17
+ value: z.string().max(10_000),
18
+ });
19
+ export const bundlePublishedReleaseSchema = z.object({
20
+ localeId: z.string().uuid(),
21
+ localeCode: z.string(),
22
+ bundleVersion: z.number().int().positive(),
23
+ });
24
+ export const bundlePublishedPayloadSchema = z.object({
25
+ projectId: z.string().uuid(),
26
+ applicationId: z.string().uuid(),
27
+ environmentId: z.string().uuid(),
28
+ releases: z.array(bundlePublishedReleaseSchema),
29
+ });
30
+ export const realtimeEventSchema = z.discriminatedUnion("type", [
31
+ z.object({
32
+ type: z.literal("translation.updated"),
33
+ payload: translationUpdatedPayloadSchema,
34
+ }),
35
+ z.object({
36
+ type: z.literal("bundle.published"),
37
+ payload: bundlePublishedPayloadSchema,
38
+ }),
39
+ ]);
40
+ export function parseRealtimeEvent(raw) {
41
+ const json = JSON.parse(raw);
42
+ return realtimeEventSchema.parse(json);
43
+ }
44
+ export function serializeRealtimeEvent(event) {
45
+ const json = JSON.stringify(event);
46
+ assertRealtimePayloadSize(json);
47
+ return json;
48
+ }
49
+ export function assertRealtimePayloadSize(json) {
50
+ if (Buffer.byteLength(json, "utf8") > MAX_REALTIME_PAYLOAD_BYTES) {
51
+ throw new Error(`Realtime event exceeds ${MAX_REALTIME_PAYLOAD_BYTES} bytes`);
52
+ }
53
+ }
54
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC3B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACpC,qEAAqE;IACrE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACnC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAChC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC;CAChD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC9D,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACtC,OAAO,EAAE,+BAA+B;KACzC,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACnC,OAAO,EAAE,4BAA4B;KACtC,CAAC;CACH,CAAC,CAAC;AAMH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,IAAI,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAoB;IACzD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,0BAA0B,EAAE,CAAC;QACjE,MAAM,IAAI,KAAK,CAAC,0BAA0B,0BAA0B,QAAQ,CAAC,CAAC;IAChF,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=events.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.test.d.ts","sourceRoot":"","sources":["../src/events.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { assertRealtimePayloadSize, parseRealtimeEvent, serializeRealtimeEvent } from "./events.js";
3
+ describe("realtime events", () => {
4
+ it("serializes and parses translation.updated", () => {
5
+ const event = {
6
+ type: "translation.updated",
7
+ payload: {
8
+ projectId: "a0000001-0000-4000-8000-000000000001",
9
+ keyId: "b0000001-0000-4000-8000-000000000002",
10
+ localeId: "c0000001-0000-4000-8000-000000000003",
11
+ environmentId: "d0000001-0000-4000-8000-000000000004",
12
+ version: 2,
13
+ keyPath: "common.greeting",
14
+ localeCode: "en",
15
+ value: "Hello",
16
+ },
17
+ };
18
+ const json = serializeRealtimeEvent(event);
19
+ expect(parseRealtimeEvent(json)).toEqual(event);
20
+ assertRealtimePayloadSize(json);
21
+ });
22
+ });
23
+ //# sourceMappingURL=events.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.test.js","sourceRoot":"","sources":["../src/events.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpG,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,KAAK,GAAG;YACZ,IAAI,EAAE,qBAA8B;YACpC,OAAO,EAAE;gBACP,SAAS,EAAE,sCAAsC;gBACjD,KAAK,EAAE,sCAAsC;gBAC7C,QAAQ,EAAE,sCAAsC;gBAChD,aAAa,EAAE,sCAAsC;gBACrD,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,iBAAiB;gBAC1B,UAAU,EAAE,IAAI;gBAChB,KAAK,EAAE,OAAO;aACf;SACF,CAAC;QACF,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChD,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared realtime wire format: Redis channels, event schemas, and serialization helpers.
3
+ *
4
+ * Intent: single contract for API publisher, realtime gateway, and SDK overlay subscriber.
5
+ */
6
+ export { projectChannel, PROJECT_CHANNEL_PATTERN, projectIdFromChannel, } from "./channels.js";
7
+ export { assertRealtimePayloadSize, bundlePublishedPayloadSchema, bundlePublishedReleaseSchema, MAX_REALTIME_PAYLOAD_BYTES, parseRealtimeEvent, realtimeEventSchema, serializeRealtimeEvent, translationUpdatedPayloadSchema, type BundlePublishedPayload, type RealtimeEvent, type TranslationUpdatedPayload, } from "./events.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,yBAAyB,GAC/B,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared realtime wire format: Redis channels, event schemas, and serialization helpers.
3
+ *
4
+ * Intent: single contract for API publisher, realtime gateway, and SDK overlay subscriber.
5
+ */
6
+ export { projectChannel, PROJECT_CHANNEL_PATTERN, projectIdFromChannel, } from "./channels.js";
7
+ export { assertRealtimePayloadSize, bundlePublishedPayloadSchema, bundlePublishedReleaseSchema, MAX_REALTIME_PAYLOAD_BYTES, parseRealtimeEvent, realtimeEventSchema, serializeRealtimeEvent, translationUpdatedPayloadSchema, } from "./events.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,GAIhC,MAAM,aAAa,CAAC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@stringpush/realtime-protocol",
3
+ "version": "0.1.0",
4
+ "description": "Realtime event protocol for SDK overlay WebSocket",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/StringPush/translations.git",
12
+ "directory": "packages/realtime-protocol"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "dependencies": {
27
+ "zod": "^3.24.1"
28
+ },
29
+ "devDependencies": {
30
+ "vitest": "^2.1.8"
31
+ },
32
+ "scripts": {
33
+ "build": "tsc -p tsconfig.json",
34
+ "typecheck": "tsc --noEmit",
35
+ "lint": "eslint src",
36
+ "test": "vitest run"
37
+ }
38
+ }