@livestore/sync-cf 0.0.0-snapshot-909cdd1ac2fd591945c2be2b0f53e14d87f3c9d4

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,164 @@
1
+ import { makeColumnSpec } from '@livestore/common';
2
+ import { DbSchema, mutationEventSchemaAny } from '@livestore/common/schema';
3
+ import { shouldNeverHappen } from '@livestore/utils';
4
+ import { Effect, Schema } from '@livestore/utils/effect';
5
+ import { DurableObject } from 'cloudflare:workers';
6
+ import { WSMessage } from '../common/index.js';
7
+ const encodeOutgoingMessage = Schema.encodeSync(Schema.parseJson(WSMessage.BackendToClientMessage));
8
+ const encodeIncomingMessage = Schema.encodeSync(Schema.parseJson(WSMessage.ClientToBackendMessage));
9
+ const decodeIncomingMessage = Schema.decodeUnknownEither(Schema.parseJson(WSMessage.ClientToBackendMessage));
10
+ export const mutationLogTable = DbSchema.table('__unused', {
11
+ id: DbSchema.integer({ primaryKey: true }),
12
+ parentId: DbSchema.integer({}),
13
+ mutation: DbSchema.text({}),
14
+ args: DbSchema.text({ schema: Schema.parseJson(Schema.Any) }),
15
+ });
16
+ // Durable Object
17
+ export class WebSocketServer extends DurableObject {
18
+ dbName = `mutation_log_${this.ctx.id.toString()}`;
19
+ storage = makeStorage(this.ctx, this.env, this.dbName);
20
+ constructor(ctx, env) {
21
+ super(ctx, env);
22
+ }
23
+ fetch = async (_request) => Effect.gen(this, function* () {
24
+ const { 0: client, 1: server } = new WebSocketPair();
25
+ // See https://developers.cloudflare.com/durable-objects/examples/websocket-hibernation-server
26
+ this.ctx.acceptWebSocket(server);
27
+ this.ctx.setWebSocketAutoResponse(new WebSocketRequestResponsePair(encodeIncomingMessage(WSMessage.Ping.make({ requestId: 'ping' })), encodeOutgoingMessage(WSMessage.Pong.make({ requestId: 'ping' }))));
28
+ const colSpec = makeColumnSpec(mutationLogTable.sqliteDef.ast);
29
+ this.env.DB.exec(`CREATE TABLE IF NOT EXISTS ${this.dbName} (${colSpec}) strict`);
30
+ return new Response(null, {
31
+ status: 101,
32
+ webSocket: client,
33
+ });
34
+ }).pipe(Effect.tapCauseLogPretty, Effect.runPromise);
35
+ webSocketMessage = async (ws, message) => {
36
+ const decodedMessageRes = decodeIncomingMessage(message);
37
+ if (decodedMessageRes._tag === 'Left') {
38
+ console.error('Invalid message received', decodedMessageRes.left);
39
+ return;
40
+ }
41
+ const decodedMessage = decodedMessageRes.right;
42
+ const requestId = decodedMessage.requestId;
43
+ try {
44
+ switch (decodedMessage._tag) {
45
+ case 'WSMessage.PullReq': {
46
+ const cursor = decodedMessage.cursor;
47
+ const CHUNK_SIZE = 100;
48
+ // TODO use streaming
49
+ const remainingEvents = [...(await this.storage.getEvents(cursor))];
50
+ // NOTE we want to make sure the WS server responds at least once with `InitRes` even if `events` is empty
51
+ while (true) {
52
+ const events = remainingEvents.splice(0, CHUNK_SIZE);
53
+ const encodedEvents = Schema.encodeSync(Schema.Array(mutationEventSchemaAny))(events);
54
+ const hasMore = remainingEvents.length > 0;
55
+ ws.send(encodeOutgoingMessage(WSMessage.PullRes.make({ events: encodedEvents, hasMore, requestId })));
56
+ if (hasMore === false) {
57
+ break;
58
+ }
59
+ }
60
+ break;
61
+ }
62
+ case 'WSMessage.PushReq': {
63
+ // TODO check whether we could use the Durable Object storage for this to speed up the lookup
64
+ const latestEvent = await this.storage.getLatestEvent();
65
+ const expectedParentId = latestEvent?.id ?? { global: 0, local: 0 };
66
+ if (decodedMessage.mutationEventEncoded.parentId !== expectedParentId) {
67
+ ws.send(encodeOutgoingMessage(WSMessage.Error.make({
68
+ message: `Invalid parent id. Received ${decodedMessage.mutationEventEncoded.parentId} but expected ${expectedParentId}`,
69
+ requestId,
70
+ })));
71
+ return;
72
+ }
73
+ // TODO handle clientId unique conflict
74
+ // NOTE we're currently not blocking on this to allow broadcasting right away
75
+ const storePromise = decodedMessage.persisted
76
+ ? this.storage.appendEvent(decodedMessage.mutationEventEncoded)
77
+ : Promise.resolve();
78
+ ws.send(encodeOutgoingMessage(WSMessage.PushAck.make({ mutationId: decodedMessage.mutationEventEncoded.id.global, requestId })));
79
+ // console.debug(`Broadcasting mutation event to ${this.subscribedWebSockets.size} clients`)
80
+ const connectedClients = this.ctx.getWebSockets();
81
+ if (connectedClients.length > 0) {
82
+ const broadcastMessage = encodeOutgoingMessage(WSMessage.PushBroadcast.make({
83
+ mutationEventEncoded: decodedMessage.mutationEventEncoded,
84
+ persisted: decodedMessage.persisted,
85
+ }));
86
+ for (const conn of connectedClients) {
87
+ console.log('Broadcasting to client', conn === ws ? 'self' : 'other');
88
+ // if (conn !== ws) {
89
+ conn.send(broadcastMessage);
90
+ // }
91
+ }
92
+ }
93
+ await storePromise;
94
+ break;
95
+ }
96
+ case 'WSMessage.AdminResetRoomReq': {
97
+ if (decodedMessage.adminSecret !== this.env.ADMIN_SECRET) {
98
+ ws.send(encodeOutgoingMessage(WSMessage.Error.make({ message: 'Invalid admin secret', requestId })));
99
+ return;
100
+ }
101
+ await this.storage.resetRoom();
102
+ ws.send(encodeOutgoingMessage(WSMessage.AdminResetRoomRes.make({ requestId })));
103
+ break;
104
+ }
105
+ case 'WSMessage.AdminInfoReq': {
106
+ if (decodedMessage.adminSecret !== this.env.ADMIN_SECRET) {
107
+ ws.send(encodeOutgoingMessage(WSMessage.Error.make({ message: 'Invalid admin secret', requestId })));
108
+ return;
109
+ }
110
+ ws.send(encodeOutgoingMessage(WSMessage.AdminInfoRes.make({ requestId, info: { durableObjectId: this.ctx.id.toString() } })));
111
+ break;
112
+ }
113
+ default: {
114
+ console.error('unsupported message', decodedMessage);
115
+ return shouldNeverHappen();
116
+ }
117
+ }
118
+ }
119
+ catch (error) {
120
+ ws.send(encodeOutgoingMessage(WSMessage.Error.make({ message: error.message, requestId })));
121
+ }
122
+ };
123
+ webSocketClose = async (ws, code, _reason, _wasClean) => {
124
+ // If the client closes the connection, the runtime will invoke the webSocketClose() handler.
125
+ ws.close(code, 'Durable Object is closing WebSocket');
126
+ };
127
+ }
128
+ const makeStorage = (ctx, env, dbName) => {
129
+ const getLatestEvent = async () => {
130
+ const rawEvents = await env.DB.prepare(`SELECT * FROM ${dbName} ORDER BY id DESC LIMIT 1`).all();
131
+ if (rawEvents.error) {
132
+ throw new Error(rawEvents.error);
133
+ }
134
+ const events = Schema.decodeUnknownSync(Schema.Array(mutationLogTable.schema))(rawEvents.results).map((e) => ({
135
+ ...e,
136
+ id: { global: e.id, local: 0 },
137
+ parentId: { global: e.parentId, local: 0 },
138
+ }));
139
+ return events[0];
140
+ };
141
+ const getEvents = async (cursor) => {
142
+ const whereClause = cursor ? `WHERE id > ${cursor}` : '';
143
+ // TODO handle case where `cursor` was not found
144
+ const rawEvents = await env.DB.prepare(`SELECT * FROM ${dbName} ${whereClause} ORDER BY id ASC`).all();
145
+ if (rawEvents.error) {
146
+ throw new Error(rawEvents.error);
147
+ }
148
+ const events = Schema.decodeUnknownSync(Schema.Array(mutationLogTable.schema))(rawEvents.results).map((e) => ({
149
+ ...e,
150
+ id: { global: e.id, local: 0 },
151
+ parentId: { global: e.parentId, local: 0 },
152
+ }));
153
+ return events;
154
+ };
155
+ const appendEvent = async (event) => {
156
+ const sql = `INSERT INTO ${dbName} (id, parentId, args, mutation) VALUES (?, ?, ?, ?)`;
157
+ await env.DB.prepare(sql).bind(event.id, event.parentId, JSON.stringify(event.args), event.mutation).run();
158
+ };
159
+ const resetRoom = async () => {
160
+ await ctx.storage.deleteAll();
161
+ };
162
+ return { getLatestEvent, getEvents, appendEvent, resetRoom };
163
+ };
164
+ //# sourceMappingURL=durable-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-object.js","sourceRoot":"","sources":["../../src/cf-worker/durable-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAsB,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAC/F,OAAO,EAAE,iBAAiB,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,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAA;IAC5G,CAAC,CAAA;IAED,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC3B,MAAM,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,CAAA;IAC/B,CAAC,CAAA;IAED,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AAC9D,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ /// <reference no-default-lib="true"/>
2
+ import type { Env } from './durable-object.js';
3
+ export * from './durable-object.js';
4
+ declare const _default: {
5
+ fetch: (request: Request, env: Env, _ctx: ExecutionContext) => Promise<Response>;
6
+ };
7
+ export default _default;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cf-worker/index.ts"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAE9C,cAAc,qBAAqB,CAAA;;qBA4CV,OAAO,OAAO,GAAG,QAAQ,gBAAgB,KAAG,OAAO,CAAC,QAAQ,CAAC;;AADtF,wBAgCC"}
@@ -0,0 +1,67 @@
1
+ /// <reference no-default-lib="true"/>
2
+ /// <reference lib="esnext" />
3
+ export * from './durable-object.js';
4
+ // const handleRequest = (request: Request, env: Env) =>
5
+ // HttpServer.router.empty.pipe(
6
+ // HttpServer.router.get(
7
+ // '/websocket',
8
+ // Effect.gen(function* () {
9
+ // // This example will refer to the same Durable Object instance,
10
+ // // since the name "foo" is hardcoded.
11
+ // const id = env.WEBSOCKET_SERVER.idFromName('foo')
12
+ // const durableObject = env.WEBSOCKET_SERVER.get(id)
13
+ // HttpServer.
14
+ // // Expect to receive a WebSocket Upgrade request.
15
+ // // If there is one, accept the request and return a WebSocket Response.
16
+ // const headerRes = yield* HttpServer.request
17
+ // .schemaHeaders(
18
+ // Schema.Struct({
19
+ // Upgrade: Schema.Literal('websocket'),
20
+ // }),
21
+ // )
22
+ // .pipe(Effect.either)
23
+ // if (headerRes._tag === 'Left') {
24
+ // // return new Response('Durable Object expected Upgrade: websocket', { status: 426 })
25
+ // return yield* HttpServer.response.text('Durable Object expected Upgrade: websocket', { status: 426 })
26
+ // }
27
+ // HttpServer.response.empty
28
+ // return yield* Effect.promise(() => durableObject.fetch(request))
29
+ // }),
30
+ // ),
31
+ // HttpServer.router.catchAll((e) => {
32
+ // console.log(e)
33
+ // return HttpServer.response.empty({ status: 400 })
34
+ // }),
35
+ // (_) => HttpServer.app.toWebHandler(_)(request),
36
+ // // request
37
+ // )
38
+ // Worker
39
+ export default {
40
+ fetch: async (request, env, _ctx) => {
41
+ const url = new URL(request.url);
42
+ const searchParams = url.searchParams;
43
+ const roomId = searchParams.get('room');
44
+ if (roomId === null) {
45
+ return new Response('Room ID is required', { status: 400 });
46
+ }
47
+ // This example will refer to the same Durable Object instance,
48
+ // since the name "foo" is hardcoded.
49
+ const id = env.WEBSOCKET_SERVER.idFromName(roomId);
50
+ const durableObject = env.WEBSOCKET_SERVER.get(id);
51
+ if (url.pathname.endsWith('/websocket')) {
52
+ const upgradeHeader = request.headers.get('Upgrade');
53
+ if (!upgradeHeader || upgradeHeader !== 'websocket') {
54
+ return new Response('Durable Object expected Upgrade: websocket', { status: 426 });
55
+ }
56
+ return durableObject.fetch(request);
57
+ }
58
+ return new Response(null, {
59
+ status: 400,
60
+ statusText: 'Bad Request',
61
+ headers: {
62
+ 'Content-Type': 'text/plain',
63
+ },
64
+ });
65
+ },
66
+ };
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cf-worker/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,8BAA8B;AAO9B,cAAc,qBAAqB,CAAA;AAEnC,wDAAwD;AACxD,kCAAkC;AAClC,6BAA6B;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CAAC,aAAa,IAAI,aAAa,KAAK,WAAW,EAAE,CAAC;gBACpD,OAAO,IAAI,QAAQ,CAAC,4CAA4C,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;YACpF,CAAC;YAED,OAAO,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QAED,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;YACxB,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,aAAa;YACzB,OAAO,EAAE;gBACP,cAAc,EAAE,YAAY;aAC7B;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * as WSMessage from './ws-message-types.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * as WSMessage from './ws-message-types.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,344 @@
1
+ import { Schema } from '@livestore/utils/effect';
2
+ export declare const PullReq: Schema.TaggedStruct<"WSMessage.PullReq", {
3
+ requestId: typeof Schema.String;
4
+ /** Omitting the cursor will start from the beginning */
5
+ cursor: Schema.optional<typeof Schema.Number>;
6
+ }>;
7
+ export type PullReq = typeof PullReq.Type;
8
+ export declare const PullRes: Schema.TaggedStruct<"WSMessage.PullRes", {
9
+ requestId: typeof Schema.String;
10
+ events: Schema.Array$<Schema.SchemaClass<{
11
+ readonly id: {
12
+ readonly global: number;
13
+ readonly local: number;
14
+ };
15
+ readonly mutation: string;
16
+ readonly args: any;
17
+ readonly parentId: {
18
+ readonly global: number;
19
+ readonly local: number;
20
+ };
21
+ }, {
22
+ readonly id: {
23
+ readonly global: number;
24
+ readonly local: number;
25
+ };
26
+ readonly mutation: string;
27
+ readonly args: any;
28
+ readonly parentId: {
29
+ readonly global: number;
30
+ readonly local: number;
31
+ };
32
+ }, never>>;
33
+ hasMore: typeof Schema.Boolean;
34
+ }>;
35
+ export type PullRes = typeof PullRes.Type;
36
+ export declare const PushBroadcast: Schema.TaggedStruct<"WSMessage.PushBroadcast", {
37
+ mutationEventEncoded: Schema.SchemaClass<{
38
+ readonly id: {
39
+ readonly global: number;
40
+ readonly local: number;
41
+ };
42
+ readonly mutation: string;
43
+ readonly args: any;
44
+ readonly parentId: {
45
+ readonly global: number;
46
+ readonly local: number;
47
+ };
48
+ }, {
49
+ readonly id: {
50
+ readonly global: number;
51
+ readonly local: number;
52
+ };
53
+ readonly mutation: string;
54
+ readonly args: any;
55
+ readonly parentId: {
56
+ readonly global: number;
57
+ readonly local: number;
58
+ };
59
+ }, never>;
60
+ persisted: typeof Schema.Boolean;
61
+ }>;
62
+ export type PushBroadcast = typeof PushBroadcast.Type;
63
+ export declare const PushReq: Schema.TaggedStruct<"WSMessage.PushReq", {
64
+ requestId: typeof Schema.String;
65
+ mutationEventEncoded: Schema.SchemaClass<{
66
+ readonly id: {
67
+ readonly global: number;
68
+ readonly local: number;
69
+ };
70
+ readonly mutation: string;
71
+ readonly args: any;
72
+ readonly parentId: {
73
+ readonly global: number;
74
+ readonly local: number;
75
+ };
76
+ }, {
77
+ readonly id: {
78
+ readonly global: number;
79
+ readonly local: number;
80
+ };
81
+ readonly mutation: string;
82
+ readonly args: any;
83
+ readonly parentId: {
84
+ readonly global: number;
85
+ readonly local: number;
86
+ };
87
+ }, never>;
88
+ persisted: typeof Schema.Boolean;
89
+ }>;
90
+ export type PushReq = typeof PushReq.Type;
91
+ export declare const PushAck: Schema.TaggedStruct<"WSMessage.PushAck", {
92
+ requestId: typeof Schema.String;
93
+ mutationId: typeof Schema.Number;
94
+ }>;
95
+ export type PushAck = typeof PushAck.Type;
96
+ export declare const Error: Schema.TaggedStruct<"WSMessage.Error", {
97
+ requestId: typeof Schema.String;
98
+ message: typeof Schema.String;
99
+ }>;
100
+ export declare const Ping: Schema.TaggedStruct<"WSMessage.Ping", {
101
+ requestId: Schema.Literal<["ping"]>;
102
+ }>;
103
+ export type Ping = typeof Ping.Type;
104
+ export declare const Pong: Schema.TaggedStruct<"WSMessage.Pong", {
105
+ requestId: Schema.Literal<["ping"]>;
106
+ }>;
107
+ export type Pong = typeof Pong.Type;
108
+ export declare const AdminResetRoomReq: Schema.TaggedStruct<"WSMessage.AdminResetRoomReq", {
109
+ requestId: typeof Schema.String;
110
+ adminSecret: typeof Schema.String;
111
+ }>;
112
+ export type AdminResetRoomReq = typeof AdminResetRoomReq.Type;
113
+ export declare const AdminResetRoomRes: Schema.TaggedStruct<"WSMessage.AdminResetRoomRes", {
114
+ requestId: typeof Schema.String;
115
+ }>;
116
+ export type AdminResetRoomRes = typeof AdminResetRoomRes.Type;
117
+ export declare const AdminInfoReq: Schema.TaggedStruct<"WSMessage.AdminInfoReq", {
118
+ requestId: typeof Schema.String;
119
+ adminSecret: typeof Schema.String;
120
+ }>;
121
+ export type AdminInfoReq = typeof AdminInfoReq.Type;
122
+ export declare const AdminInfoRes: Schema.TaggedStruct<"WSMessage.AdminInfoRes", {
123
+ requestId: typeof Schema.String;
124
+ info: Schema.Struct<{
125
+ durableObjectId: typeof Schema.String;
126
+ }>;
127
+ }>;
128
+ export type AdminInfoRes = typeof AdminInfoRes.Type;
129
+ export declare const Message: Schema.Union<[Schema.TaggedStruct<"WSMessage.PullReq", {
130
+ requestId: typeof Schema.String;
131
+ /** Omitting the cursor will start from the beginning */
132
+ cursor: Schema.optional<typeof Schema.Number>;
133
+ }>, Schema.TaggedStruct<"WSMessage.PullRes", {
134
+ requestId: typeof Schema.String;
135
+ events: Schema.Array$<Schema.SchemaClass<{
136
+ readonly id: {
137
+ readonly global: number;
138
+ readonly local: number;
139
+ };
140
+ readonly mutation: string;
141
+ readonly args: any;
142
+ readonly parentId: {
143
+ readonly global: number;
144
+ readonly local: number;
145
+ };
146
+ }, {
147
+ readonly id: {
148
+ readonly global: number;
149
+ readonly local: number;
150
+ };
151
+ readonly mutation: string;
152
+ readonly args: any;
153
+ readonly parentId: {
154
+ readonly global: number;
155
+ readonly local: number;
156
+ };
157
+ }, never>>;
158
+ hasMore: typeof Schema.Boolean;
159
+ }>, Schema.TaggedStruct<"WSMessage.PushBroadcast", {
160
+ mutationEventEncoded: Schema.SchemaClass<{
161
+ readonly id: {
162
+ readonly global: number;
163
+ readonly local: number;
164
+ };
165
+ readonly mutation: string;
166
+ readonly args: any;
167
+ readonly parentId: {
168
+ readonly global: number;
169
+ readonly local: number;
170
+ };
171
+ }, {
172
+ readonly id: {
173
+ readonly global: number;
174
+ readonly local: number;
175
+ };
176
+ readonly mutation: string;
177
+ readonly args: any;
178
+ readonly parentId: {
179
+ readonly global: number;
180
+ readonly local: number;
181
+ };
182
+ }, never>;
183
+ persisted: typeof Schema.Boolean;
184
+ }>, Schema.TaggedStruct<"WSMessage.PushReq", {
185
+ requestId: typeof Schema.String;
186
+ mutationEventEncoded: Schema.SchemaClass<{
187
+ readonly id: {
188
+ readonly global: number;
189
+ readonly local: number;
190
+ };
191
+ readonly mutation: string;
192
+ readonly args: any;
193
+ readonly parentId: {
194
+ readonly global: number;
195
+ readonly local: number;
196
+ };
197
+ }, {
198
+ readonly id: {
199
+ readonly global: number;
200
+ readonly local: number;
201
+ };
202
+ readonly mutation: string;
203
+ readonly args: any;
204
+ readonly parentId: {
205
+ readonly global: number;
206
+ readonly local: number;
207
+ };
208
+ }, never>;
209
+ persisted: typeof Schema.Boolean;
210
+ }>, Schema.TaggedStruct<"WSMessage.PushAck", {
211
+ requestId: typeof Schema.String;
212
+ mutationId: typeof Schema.Number;
213
+ }>, Schema.TaggedStruct<"WSMessage.Error", {
214
+ requestId: typeof Schema.String;
215
+ message: typeof Schema.String;
216
+ }>, Schema.TaggedStruct<"WSMessage.Ping", {
217
+ requestId: Schema.Literal<["ping"]>;
218
+ }>, Schema.TaggedStruct<"WSMessage.Pong", {
219
+ requestId: Schema.Literal<["ping"]>;
220
+ }>, Schema.TaggedStruct<"WSMessage.AdminResetRoomReq", {
221
+ requestId: typeof Schema.String;
222
+ adminSecret: typeof Schema.String;
223
+ }>, Schema.TaggedStruct<"WSMessage.AdminResetRoomRes", {
224
+ requestId: typeof Schema.String;
225
+ }>, Schema.TaggedStruct<"WSMessage.AdminInfoReq", {
226
+ requestId: typeof Schema.String;
227
+ adminSecret: typeof Schema.String;
228
+ }>, Schema.TaggedStruct<"WSMessage.AdminInfoRes", {
229
+ requestId: typeof Schema.String;
230
+ info: Schema.Struct<{
231
+ durableObjectId: typeof Schema.String;
232
+ }>;
233
+ }>]>;
234
+ export type Message = typeof Message.Type;
235
+ export type MessageEncoded = typeof Message.Encoded;
236
+ export declare const BackendToClientMessage: Schema.Union<[Schema.TaggedStruct<"WSMessage.PullRes", {
237
+ requestId: typeof Schema.String;
238
+ events: Schema.Array$<Schema.SchemaClass<{
239
+ readonly id: {
240
+ readonly global: number;
241
+ readonly local: number;
242
+ };
243
+ readonly mutation: string;
244
+ readonly args: any;
245
+ readonly parentId: {
246
+ readonly global: number;
247
+ readonly local: number;
248
+ };
249
+ }, {
250
+ readonly id: {
251
+ readonly global: number;
252
+ readonly local: number;
253
+ };
254
+ readonly mutation: string;
255
+ readonly args: any;
256
+ readonly parentId: {
257
+ readonly global: number;
258
+ readonly local: number;
259
+ };
260
+ }, never>>;
261
+ hasMore: typeof Schema.Boolean;
262
+ }>, Schema.TaggedStruct<"WSMessage.PushBroadcast", {
263
+ mutationEventEncoded: Schema.SchemaClass<{
264
+ readonly id: {
265
+ readonly global: number;
266
+ readonly local: number;
267
+ };
268
+ readonly mutation: string;
269
+ readonly args: any;
270
+ readonly parentId: {
271
+ readonly global: number;
272
+ readonly local: number;
273
+ };
274
+ }, {
275
+ readonly id: {
276
+ readonly global: number;
277
+ readonly local: number;
278
+ };
279
+ readonly mutation: string;
280
+ readonly args: any;
281
+ readonly parentId: {
282
+ readonly global: number;
283
+ readonly local: number;
284
+ };
285
+ }, never>;
286
+ persisted: typeof Schema.Boolean;
287
+ }>, Schema.TaggedStruct<"WSMessage.PushAck", {
288
+ requestId: typeof Schema.String;
289
+ mutationId: typeof Schema.Number;
290
+ }>, Schema.TaggedStruct<"WSMessage.AdminResetRoomRes", {
291
+ requestId: typeof Schema.String;
292
+ }>, Schema.TaggedStruct<"WSMessage.AdminInfoRes", {
293
+ requestId: typeof Schema.String;
294
+ info: Schema.Struct<{
295
+ durableObjectId: typeof Schema.String;
296
+ }>;
297
+ }>, Schema.TaggedStruct<"WSMessage.Error", {
298
+ requestId: typeof Schema.String;
299
+ message: typeof Schema.String;
300
+ }>, Schema.TaggedStruct<"WSMessage.Pong", {
301
+ requestId: Schema.Literal<["ping"]>;
302
+ }>]>;
303
+ export type BackendToClientMessage = typeof BackendToClientMessage.Type;
304
+ export declare const ClientToBackendMessage: Schema.Union<[Schema.TaggedStruct<"WSMessage.PullReq", {
305
+ requestId: typeof Schema.String;
306
+ /** Omitting the cursor will start from the beginning */
307
+ cursor: Schema.optional<typeof Schema.Number>;
308
+ }>, Schema.TaggedStruct<"WSMessage.PushReq", {
309
+ requestId: typeof Schema.String;
310
+ mutationEventEncoded: Schema.SchemaClass<{
311
+ readonly id: {
312
+ readonly global: number;
313
+ readonly local: number;
314
+ };
315
+ readonly mutation: string;
316
+ readonly args: any;
317
+ readonly parentId: {
318
+ readonly global: number;
319
+ readonly local: number;
320
+ };
321
+ }, {
322
+ readonly id: {
323
+ readonly global: number;
324
+ readonly local: number;
325
+ };
326
+ readonly mutation: string;
327
+ readonly args: any;
328
+ readonly parentId: {
329
+ readonly global: number;
330
+ readonly local: number;
331
+ };
332
+ }, never>;
333
+ persisted: typeof Schema.Boolean;
334
+ }>, Schema.TaggedStruct<"WSMessage.AdminResetRoomReq", {
335
+ requestId: typeof Schema.String;
336
+ adminSecret: typeof Schema.String;
337
+ }>, Schema.TaggedStruct<"WSMessage.AdminInfoReq", {
338
+ requestId: typeof Schema.String;
339
+ adminSecret: typeof Schema.String;
340
+ }>, Schema.TaggedStruct<"WSMessage.Ping", {
341
+ requestId: Schema.Literal<["ping"]>;
342
+ }>]>;
343
+ export type ClientToBackendMessage = typeof ClientToBackendMessage.Type;
344
+ //# sourceMappingURL=ws-message-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws-message-types.d.ts","sourceRoot":"","sources":["../../src/common/ws-message-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,eAAO,MAAM,OAAO;;IAElB,wDAAwD;;EAExD,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;EAMlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;EAGxB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC,eAAO,MAAM,OAAO;;;EAGlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AAEF,eAAO,MAAM,IAAI;;EAEf,CAAA;AAEF,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC,eAAO,MAAM,IAAI;;EAEf,CAAA;AAEF,MAAM,MAAM,IAA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