@finalai/websocket-gateway-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.
Potentially problematic release.
This version of @finalai/websocket-gateway-protocol might be problematic. Click here for more details.
- package/README.md +6 -0
- package/dist/modules/index.d.mts +686 -0
- package/dist/modules/index.mjs +528 -0
- package/dist/modules/index.mjs.map +7 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const websocketGatewayDataSchema: z.ZodJSONSchema;
|
|
3
|
+
export type WebsocketGatewayData = z.infer<typeof websocketGatewayDataSchema>;
|
|
4
|
+
export declare const websocketGatewayProtocolVersion: 1;
|
|
5
|
+
export declare const websocketGatewayActionNames: readonly ["subscribe", "publish", "history", "presence", "realtime.subscribe", "rpc.send", "rpc.receive", "bridge.join", "bridge.send", "bridge.receive", "proxy.connect", "work.lease", "work.heartbeat", "work.complete", "work.fail"];
|
|
6
|
+
export declare const websocketGatewayActionSchema: z.ZodEnum<{
|
|
7
|
+
subscribe: "subscribe";
|
|
8
|
+
publish: "publish";
|
|
9
|
+
history: "history";
|
|
10
|
+
presence: "presence";
|
|
11
|
+
"realtime.subscribe": "realtime.subscribe";
|
|
12
|
+
"rpc.send": "rpc.send";
|
|
13
|
+
"rpc.receive": "rpc.receive";
|
|
14
|
+
"bridge.join": "bridge.join";
|
|
15
|
+
"bridge.send": "bridge.send";
|
|
16
|
+
"bridge.receive": "bridge.receive";
|
|
17
|
+
"proxy.connect": "proxy.connect";
|
|
18
|
+
"work.lease": "work.lease";
|
|
19
|
+
"work.heartbeat": "work.heartbeat";
|
|
20
|
+
"work.complete": "work.complete";
|
|
21
|
+
"work.fail": "work.fail";
|
|
22
|
+
}>;
|
|
23
|
+
export type WebsocketGatewayAction = z.infer<typeof websocketGatewayActionSchema>;
|
|
24
|
+
export declare const websocketGatewayCapabilityLimitsSchema: z.ZodObject<{
|
|
25
|
+
maxFrameBytes: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
maxFramesPerMinute: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
maxSubscriptions: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export declare const websocketGatewayCapabilitySchema: z.ZodObject<{
|
|
30
|
+
channels: z.ZodArray<z.ZodString>;
|
|
31
|
+
actions: z.ZodArray<z.ZodEnum<{
|
|
32
|
+
subscribe: "subscribe";
|
|
33
|
+
publish: "publish";
|
|
34
|
+
history: "history";
|
|
35
|
+
presence: "presence";
|
|
36
|
+
"realtime.subscribe": "realtime.subscribe";
|
|
37
|
+
"rpc.send": "rpc.send";
|
|
38
|
+
"rpc.receive": "rpc.receive";
|
|
39
|
+
"bridge.join": "bridge.join";
|
|
40
|
+
"bridge.send": "bridge.send";
|
|
41
|
+
"bridge.receive": "bridge.receive";
|
|
42
|
+
"proxy.connect": "proxy.connect";
|
|
43
|
+
"work.lease": "work.lease";
|
|
44
|
+
"work.heartbeat": "work.heartbeat";
|
|
45
|
+
"work.complete": "work.complete";
|
|
46
|
+
"work.fail": "work.fail";
|
|
47
|
+
}>>;
|
|
48
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
maxFrameBytes: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
maxFramesPerMinute: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
maxSubscriptions: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type WebsocketGatewayCapability = z.infer<typeof websocketGatewayCapabilitySchema>;
|
|
55
|
+
export declare const websocketGatewayProxyUpstreamDescriptorSchema: z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
url: z.ZodString;
|
|
58
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type WebsocketGatewayProxyUpstreamDescriptor = z.infer<typeof websocketGatewayProxyUpstreamDescriptorSchema>;
|
|
61
|
+
export declare const websocketGatewayAuthFrameSchema: z.ZodObject<{
|
|
62
|
+
id: z.ZodOptional<z.ZodString>;
|
|
63
|
+
type: z.ZodLiteral<"auth">;
|
|
64
|
+
token: z.ZodString;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
export declare const websocketGatewaySubscribeFrameSchema: z.ZodObject<{
|
|
67
|
+
id: z.ZodOptional<z.ZodString>;
|
|
68
|
+
type: z.ZodLiteral<"channel.subscribe">;
|
|
69
|
+
channel: z.ZodString;
|
|
70
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export declare const websocketGatewayUnsubscribeFrameSchema: z.ZodObject<{
|
|
73
|
+
id: z.ZodOptional<z.ZodString>;
|
|
74
|
+
type: z.ZodLiteral<"channel.unsubscribe">;
|
|
75
|
+
channel: z.ZodString;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export declare const websocketGatewayPublishFrameSchema: z.ZodObject<{
|
|
78
|
+
id: z.ZodOptional<z.ZodString>;
|
|
79
|
+
type: z.ZodLiteral<"channel.publish">;
|
|
80
|
+
channel: z.ZodString;
|
|
81
|
+
name: z.ZodDefault<z.ZodString>;
|
|
82
|
+
data: z.ZodJSONSchema;
|
|
83
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
84
|
+
retain: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export declare const websocketGatewayHistoryFrameSchema: z.ZodObject<{
|
|
87
|
+
id: z.ZodOptional<z.ZodString>;
|
|
88
|
+
type: z.ZodLiteral<"channel.history">;
|
|
89
|
+
channel: z.ZodString;
|
|
90
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
91
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
export declare const websocketGatewayRealtimeSubscriptionSchema: z.ZodObject<{
|
|
94
|
+
topic: z.ZodString;
|
|
95
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
export declare const websocketGatewayRealtimeSubscribeFrameSchema: z.ZodObject<{
|
|
98
|
+
id: z.ZodOptional<z.ZodString>;
|
|
99
|
+
type: z.ZodLiteral<"realtime.subscribe">;
|
|
100
|
+
subscriptions: z.ZodArray<z.ZodObject<{
|
|
101
|
+
topic: z.ZodString;
|
|
102
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
export declare const websocketGatewayRealtimeUnsubscribeFrameSchema: z.ZodObject<{
|
|
106
|
+
id: z.ZodOptional<z.ZodString>;
|
|
107
|
+
type: z.ZodLiteral<"realtime.unsubscribe">;
|
|
108
|
+
topics: z.ZodArray<z.ZodString>;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
export declare const websocketGatewayRealtimeHistoryFrameSchema: z.ZodObject<{
|
|
111
|
+
id: z.ZodOptional<z.ZodString>;
|
|
112
|
+
type: z.ZodLiteral<"realtime.history">;
|
|
113
|
+
topic: z.ZodString;
|
|
114
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
115
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
export declare const websocketGatewayRealtimePresenceEnterFrameSchema: z.ZodObject<{
|
|
118
|
+
id: z.ZodOptional<z.ZodString>;
|
|
119
|
+
type: z.ZodLiteral<"realtime.presence.enter">;
|
|
120
|
+
topic: z.ZodString;
|
|
121
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
export declare const websocketGatewayRealtimePresenceUpdateFrameSchema: z.ZodObject<{
|
|
124
|
+
id: z.ZodOptional<z.ZodString>;
|
|
125
|
+
type: z.ZodLiteral<"realtime.presence.update">;
|
|
126
|
+
topic: z.ZodString;
|
|
127
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
128
|
+
}, z.core.$strict>;
|
|
129
|
+
export declare const websocketGatewayRealtimePresenceLeaveFrameSchema: z.ZodObject<{
|
|
130
|
+
id: z.ZodOptional<z.ZodString>;
|
|
131
|
+
type: z.ZodLiteral<"realtime.presence.leave">;
|
|
132
|
+
topic: z.ZodString;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
export declare const websocketGatewayRealtimePresenceGetFrameSchema: z.ZodObject<{
|
|
135
|
+
id: z.ZodOptional<z.ZodString>;
|
|
136
|
+
type: z.ZodLiteral<"realtime.presence.get">;
|
|
137
|
+
topic: z.ZodString;
|
|
138
|
+
}, z.core.$strict>;
|
|
139
|
+
export declare const websocketGatewayPresenceEnterFrameSchema: z.ZodObject<{
|
|
140
|
+
id: z.ZodOptional<z.ZodString>;
|
|
141
|
+
type: z.ZodLiteral<"presence.enter">;
|
|
142
|
+
channel: z.ZodString;
|
|
143
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
144
|
+
}, z.core.$strict>;
|
|
145
|
+
export declare const websocketGatewayPresenceUpdateFrameSchema: z.ZodObject<{
|
|
146
|
+
id: z.ZodOptional<z.ZodString>;
|
|
147
|
+
type: z.ZodLiteral<"presence.update">;
|
|
148
|
+
channel: z.ZodString;
|
|
149
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
150
|
+
}, z.core.$strict>;
|
|
151
|
+
export declare const websocketGatewayPresenceLeaveFrameSchema: z.ZodObject<{
|
|
152
|
+
id: z.ZodOptional<z.ZodString>;
|
|
153
|
+
type: z.ZodLiteral<"presence.leave">;
|
|
154
|
+
channel: z.ZodString;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
export declare const websocketGatewayPresenceGetFrameSchema: z.ZodObject<{
|
|
157
|
+
id: z.ZodOptional<z.ZodString>;
|
|
158
|
+
type: z.ZodLiteral<"presence.get">;
|
|
159
|
+
channel: z.ZodString;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
export declare const websocketGatewayRpcRegisterFrameSchema: z.ZodObject<{
|
|
162
|
+
id: z.ZodOptional<z.ZodString>;
|
|
163
|
+
type: z.ZodLiteral<"rpc.register">;
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
export declare const websocketGatewayRpcCallFrameSchema: z.ZodObject<{
|
|
167
|
+
id: z.ZodOptional<z.ZodString>;
|
|
168
|
+
type: z.ZodLiteral<"rpc.call">;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
correlationId: z.ZodString;
|
|
171
|
+
data: z.ZodJSONSchema;
|
|
172
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
173
|
+
}, z.core.$strict>;
|
|
174
|
+
export declare const websocketGatewayRpcRespondFrameSchema: z.ZodObject<{
|
|
175
|
+
id: z.ZodOptional<z.ZodString>;
|
|
176
|
+
type: z.ZodLiteral<"rpc.respond">;
|
|
177
|
+
correlationId: z.ZodString;
|
|
178
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
179
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
code: z.ZodString;
|
|
181
|
+
message: z.ZodString;
|
|
182
|
+
}, z.core.$strip>>;
|
|
183
|
+
}, z.core.$strict>;
|
|
184
|
+
export declare const websocketGatewayBridgeJoinFrameSchema: z.ZodObject<{
|
|
185
|
+
id: z.ZodOptional<z.ZodString>;
|
|
186
|
+
type: z.ZodLiteral<"bridge.join">;
|
|
187
|
+
bridge: z.ZodString;
|
|
188
|
+
role: z.ZodString;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
export declare const websocketGatewayBridgeLeaveFrameSchema: z.ZodObject<{
|
|
191
|
+
id: z.ZodOptional<z.ZodString>;
|
|
192
|
+
type: z.ZodLiteral<"bridge.leave">;
|
|
193
|
+
bridge: z.ZodString;
|
|
194
|
+
}, z.core.$strict>;
|
|
195
|
+
export declare const websocketGatewayBridgeSendFrameSchema: z.ZodObject<{
|
|
196
|
+
id: z.ZodOptional<z.ZodString>;
|
|
197
|
+
type: z.ZodLiteral<"bridge.send">;
|
|
198
|
+
bridge: z.ZodString;
|
|
199
|
+
data: z.ZodJSONSchema;
|
|
200
|
+
}, z.core.$strict>;
|
|
201
|
+
export declare const websocketGatewayProxyConnectFrameSchema: z.ZodObject<{
|
|
202
|
+
id: z.ZodOptional<z.ZodString>;
|
|
203
|
+
type: z.ZodLiteral<"proxy.connect">;
|
|
204
|
+
upstreamId: z.ZodString;
|
|
205
|
+
}, z.core.$strict>;
|
|
206
|
+
export declare const websocketGatewayProxyPayloadSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
207
|
+
encoding: z.ZodLiteral<"base64">;
|
|
208
|
+
data: z.ZodString;
|
|
209
|
+
}, z.core.$strip>]>;
|
|
210
|
+
export type WebsocketGatewayProxyPayload = z.infer<typeof websocketGatewayProxyPayloadSchema>;
|
|
211
|
+
export declare const websocketGatewayProxySendFrameSchema: z.ZodObject<{
|
|
212
|
+
id: z.ZodOptional<z.ZodString>;
|
|
213
|
+
type: z.ZodLiteral<"proxy.send">;
|
|
214
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
215
|
+
encoding: z.ZodLiteral<"base64">;
|
|
216
|
+
data: z.ZodString;
|
|
217
|
+
}, z.core.$strip>]>;
|
|
218
|
+
}, z.core.$strict>;
|
|
219
|
+
export declare const websocketGatewayProxyCloseFrameSchema: z.ZodObject<{
|
|
220
|
+
id: z.ZodOptional<z.ZodString>;
|
|
221
|
+
type: z.ZodLiteral<"proxy.close">;
|
|
222
|
+
code: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strict>;
|
|
225
|
+
export declare const websocketGatewayWorkerHelloFrameSchema: z.ZodObject<{
|
|
226
|
+
id: z.ZodOptional<z.ZodString>;
|
|
227
|
+
type: z.ZodLiteral<"worker.hello">;
|
|
228
|
+
workerId: z.ZodString;
|
|
229
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
230
|
+
appVersion: z.ZodOptional<z.ZodString>;
|
|
231
|
+
queues: z.ZodArray<z.ZodString>;
|
|
232
|
+
maxConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
inFlightLeaseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
234
|
+
inFlightLeases: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
235
|
+
leaseId: z.ZodString;
|
|
236
|
+
queue: z.ZodString;
|
|
237
|
+
}, z.core.$strip>>>;
|
|
238
|
+
}, z.core.$strict>;
|
|
239
|
+
export declare const websocketGatewayWorkOfferFrameSchema: z.ZodObject<{
|
|
240
|
+
id: z.ZodOptional<z.ZodString>;
|
|
241
|
+
type: z.ZodLiteral<"work.offer">;
|
|
242
|
+
queue: z.ZodString;
|
|
243
|
+
leaseId: z.ZodString;
|
|
244
|
+
payload: z.ZodJSONSchema;
|
|
245
|
+
}, z.core.$strict>;
|
|
246
|
+
export declare const websocketGatewayWorkAcceptFrameSchema: z.ZodObject<{
|
|
247
|
+
id: z.ZodOptional<z.ZodString>;
|
|
248
|
+
type: z.ZodLiteral<"work.accept">;
|
|
249
|
+
leaseId: z.ZodString;
|
|
250
|
+
}, z.core.$strict>;
|
|
251
|
+
export declare const websocketGatewayWorkHeartbeatFrameSchema: z.ZodObject<{
|
|
252
|
+
id: z.ZodOptional<z.ZodString>;
|
|
253
|
+
type: z.ZodLiteral<"work.heartbeat">;
|
|
254
|
+
leaseId: z.ZodString;
|
|
255
|
+
}, z.core.$strict>;
|
|
256
|
+
export declare const websocketGatewayWorkCompleteFrameSchema: z.ZodObject<{
|
|
257
|
+
id: z.ZodOptional<z.ZodString>;
|
|
258
|
+
type: z.ZodLiteral<"work.complete">;
|
|
259
|
+
leaseId: z.ZodString;
|
|
260
|
+
result: z.ZodOptional<z.ZodJSONSchema>;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
export declare const websocketGatewayWorkFailFrameSchema: z.ZodObject<{
|
|
263
|
+
id: z.ZodOptional<z.ZodString>;
|
|
264
|
+
type: z.ZodLiteral<"work.fail">;
|
|
265
|
+
leaseId: z.ZodString;
|
|
266
|
+
error: z.ZodString;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
export declare const websocketGatewayWorkDrainFrameSchema: z.ZodObject<{
|
|
269
|
+
id: z.ZodOptional<z.ZodString>;
|
|
270
|
+
type: z.ZodLiteral<"work.drain">;
|
|
271
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, z.core.$strict>;
|
|
273
|
+
export declare const websocketGatewayPingFrameSchema: z.ZodObject<{
|
|
274
|
+
id: z.ZodOptional<z.ZodString>;
|
|
275
|
+
type: z.ZodLiteral<"ping">;
|
|
276
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
277
|
+
}, z.core.$strict>;
|
|
278
|
+
export declare const websocketGatewayClientFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
279
|
+
id: z.ZodOptional<z.ZodString>;
|
|
280
|
+
type: z.ZodLiteral<"auth">;
|
|
281
|
+
token: z.ZodString;
|
|
282
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
283
|
+
id: z.ZodOptional<z.ZodString>;
|
|
284
|
+
type: z.ZodLiteral<"channel.subscribe">;
|
|
285
|
+
channel: z.ZodString;
|
|
286
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
288
|
+
id: z.ZodOptional<z.ZodString>;
|
|
289
|
+
type: z.ZodLiteral<"channel.unsubscribe">;
|
|
290
|
+
channel: z.ZodString;
|
|
291
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
292
|
+
id: z.ZodOptional<z.ZodString>;
|
|
293
|
+
type: z.ZodLiteral<"channel.publish">;
|
|
294
|
+
channel: z.ZodString;
|
|
295
|
+
name: z.ZodDefault<z.ZodString>;
|
|
296
|
+
data: z.ZodJSONSchema;
|
|
297
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
298
|
+
retain: z.ZodOptional<z.ZodBoolean>;
|
|
299
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
300
|
+
id: z.ZodOptional<z.ZodString>;
|
|
301
|
+
type: z.ZodLiteral<"channel.history">;
|
|
302
|
+
channel: z.ZodString;
|
|
303
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
304
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
305
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
306
|
+
id: z.ZodOptional<z.ZodString>;
|
|
307
|
+
type: z.ZodLiteral<"realtime.subscribe">;
|
|
308
|
+
subscriptions: z.ZodArray<z.ZodObject<{
|
|
309
|
+
topic: z.ZodString;
|
|
310
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
311
|
+
}, z.core.$strip>>;
|
|
312
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
313
|
+
id: z.ZodOptional<z.ZodString>;
|
|
314
|
+
type: z.ZodLiteral<"realtime.unsubscribe">;
|
|
315
|
+
topics: z.ZodArray<z.ZodString>;
|
|
316
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
317
|
+
id: z.ZodOptional<z.ZodString>;
|
|
318
|
+
type: z.ZodLiteral<"realtime.history">;
|
|
319
|
+
topic: z.ZodString;
|
|
320
|
+
afterCursor: z.ZodOptional<z.ZodString>;
|
|
321
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
322
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
323
|
+
id: z.ZodOptional<z.ZodString>;
|
|
324
|
+
type: z.ZodLiteral<"realtime.presence.enter">;
|
|
325
|
+
topic: z.ZodString;
|
|
326
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
327
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
328
|
+
id: z.ZodOptional<z.ZodString>;
|
|
329
|
+
type: z.ZodLiteral<"realtime.presence.update">;
|
|
330
|
+
topic: z.ZodString;
|
|
331
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
332
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
333
|
+
id: z.ZodOptional<z.ZodString>;
|
|
334
|
+
type: z.ZodLiteral<"realtime.presence.leave">;
|
|
335
|
+
topic: z.ZodString;
|
|
336
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
337
|
+
id: z.ZodOptional<z.ZodString>;
|
|
338
|
+
type: z.ZodLiteral<"realtime.presence.get">;
|
|
339
|
+
topic: z.ZodString;
|
|
340
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
341
|
+
id: z.ZodOptional<z.ZodString>;
|
|
342
|
+
type: z.ZodLiteral<"presence.enter">;
|
|
343
|
+
channel: z.ZodString;
|
|
344
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
345
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
346
|
+
id: z.ZodOptional<z.ZodString>;
|
|
347
|
+
type: z.ZodLiteral<"presence.update">;
|
|
348
|
+
channel: z.ZodString;
|
|
349
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
350
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
351
|
+
id: z.ZodOptional<z.ZodString>;
|
|
352
|
+
type: z.ZodLiteral<"presence.leave">;
|
|
353
|
+
channel: z.ZodString;
|
|
354
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
355
|
+
id: z.ZodOptional<z.ZodString>;
|
|
356
|
+
type: z.ZodLiteral<"presence.get">;
|
|
357
|
+
channel: z.ZodString;
|
|
358
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
359
|
+
id: z.ZodOptional<z.ZodString>;
|
|
360
|
+
type: z.ZodLiteral<"rpc.register">;
|
|
361
|
+
name: z.ZodString;
|
|
362
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
363
|
+
id: z.ZodOptional<z.ZodString>;
|
|
364
|
+
type: z.ZodLiteral<"rpc.call">;
|
|
365
|
+
name: z.ZodString;
|
|
366
|
+
correlationId: z.ZodString;
|
|
367
|
+
data: z.ZodJSONSchema;
|
|
368
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
369
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
370
|
+
id: z.ZodOptional<z.ZodString>;
|
|
371
|
+
type: z.ZodLiteral<"rpc.respond">;
|
|
372
|
+
correlationId: z.ZodString;
|
|
373
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
374
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
375
|
+
code: z.ZodString;
|
|
376
|
+
message: z.ZodString;
|
|
377
|
+
}, z.core.$strip>>;
|
|
378
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
379
|
+
id: z.ZodOptional<z.ZodString>;
|
|
380
|
+
type: z.ZodLiteral<"bridge.join">;
|
|
381
|
+
bridge: z.ZodString;
|
|
382
|
+
role: z.ZodString;
|
|
383
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
384
|
+
id: z.ZodOptional<z.ZodString>;
|
|
385
|
+
type: z.ZodLiteral<"bridge.leave">;
|
|
386
|
+
bridge: z.ZodString;
|
|
387
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
388
|
+
id: z.ZodOptional<z.ZodString>;
|
|
389
|
+
type: z.ZodLiteral<"bridge.send">;
|
|
390
|
+
bridge: z.ZodString;
|
|
391
|
+
data: z.ZodJSONSchema;
|
|
392
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
393
|
+
id: z.ZodOptional<z.ZodString>;
|
|
394
|
+
type: z.ZodLiteral<"proxy.connect">;
|
|
395
|
+
upstreamId: z.ZodString;
|
|
396
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
397
|
+
id: z.ZodOptional<z.ZodString>;
|
|
398
|
+
type: z.ZodLiteral<"proxy.send">;
|
|
399
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
400
|
+
encoding: z.ZodLiteral<"base64">;
|
|
401
|
+
data: z.ZodString;
|
|
402
|
+
}, z.core.$strip>]>;
|
|
403
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
404
|
+
id: z.ZodOptional<z.ZodString>;
|
|
405
|
+
type: z.ZodLiteral<"proxy.close">;
|
|
406
|
+
code: z.ZodOptional<z.ZodNumber>;
|
|
407
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
408
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
409
|
+
id: z.ZodOptional<z.ZodString>;
|
|
410
|
+
type: z.ZodLiteral<"worker.hello">;
|
|
411
|
+
workerId: z.ZodString;
|
|
412
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
413
|
+
appVersion: z.ZodOptional<z.ZodString>;
|
|
414
|
+
queues: z.ZodArray<z.ZodString>;
|
|
415
|
+
maxConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
416
|
+
inFlightLeaseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
417
|
+
inFlightLeases: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
418
|
+
leaseId: z.ZodString;
|
|
419
|
+
queue: z.ZodString;
|
|
420
|
+
}, z.core.$strip>>>;
|
|
421
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
422
|
+
id: z.ZodOptional<z.ZodString>;
|
|
423
|
+
type: z.ZodLiteral<"work.offer">;
|
|
424
|
+
queue: z.ZodString;
|
|
425
|
+
leaseId: z.ZodString;
|
|
426
|
+
payload: z.ZodJSONSchema;
|
|
427
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
428
|
+
id: z.ZodOptional<z.ZodString>;
|
|
429
|
+
type: z.ZodLiteral<"work.accept">;
|
|
430
|
+
leaseId: z.ZodString;
|
|
431
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
432
|
+
id: z.ZodOptional<z.ZodString>;
|
|
433
|
+
type: z.ZodLiteral<"work.heartbeat">;
|
|
434
|
+
leaseId: z.ZodString;
|
|
435
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
436
|
+
id: z.ZodOptional<z.ZodString>;
|
|
437
|
+
type: z.ZodLiteral<"work.complete">;
|
|
438
|
+
leaseId: z.ZodString;
|
|
439
|
+
result: z.ZodOptional<z.ZodJSONSchema>;
|
|
440
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
441
|
+
id: z.ZodOptional<z.ZodString>;
|
|
442
|
+
type: z.ZodLiteral<"work.fail">;
|
|
443
|
+
leaseId: z.ZodString;
|
|
444
|
+
error: z.ZodString;
|
|
445
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
446
|
+
id: z.ZodOptional<z.ZodString>;
|
|
447
|
+
type: z.ZodLiteral<"work.drain">;
|
|
448
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
449
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
450
|
+
id: z.ZodOptional<z.ZodString>;
|
|
451
|
+
type: z.ZodLiteral<"ping">;
|
|
452
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
453
|
+
}, z.core.$strict>], "type">;
|
|
454
|
+
export type WebsocketGatewayClientFrame = z.infer<typeof websocketGatewayClientFrameSchema>;
|
|
455
|
+
export declare const websocketGatewayMessageSchema: z.ZodObject<{
|
|
456
|
+
id: z.ZodString;
|
|
457
|
+
channel: z.ZodString;
|
|
458
|
+
name: z.ZodString;
|
|
459
|
+
data: z.ZodJSONSchema;
|
|
460
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
461
|
+
publishedAt: z.ZodString;
|
|
462
|
+
}, z.core.$strip>;
|
|
463
|
+
export declare const websocketGatewayPublishSuccessResponseSchema: z.ZodObject<{
|
|
464
|
+
published: z.ZodLiteral<true>;
|
|
465
|
+
message: z.ZodObject<{
|
|
466
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
467
|
+
}, z.core.$strip>;
|
|
468
|
+
}, z.core.$strip>;
|
|
469
|
+
export declare const WEBSOCKET_GATEWAY_PUBLISH_BATCH_MAX = 100;
|
|
470
|
+
export declare const websocketGatewayPublishBatchRequestSchema: z.ZodObject<{
|
|
471
|
+
tenantId: z.ZodString;
|
|
472
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
473
|
+
channel: z.ZodString;
|
|
474
|
+
name: z.ZodDefault<z.ZodString>;
|
|
475
|
+
data: z.ZodJSONSchema;
|
|
476
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
477
|
+
retain: z.ZodOptional<z.ZodBoolean>;
|
|
478
|
+
}, z.core.$strip>>;
|
|
479
|
+
}, z.core.$strip>;
|
|
480
|
+
export declare const websocketGatewayPublishBatchResponseSchema: z.ZodObject<{
|
|
481
|
+
messages: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
482
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
483
|
+
}, z.core.$strip>>>;
|
|
484
|
+
}, z.core.$strip>;
|
|
485
|
+
export type WebsocketGatewayMessage = z.infer<typeof websocketGatewayMessageSchema>;
|
|
486
|
+
export declare const websocketGatewayRealtimeMessageSchema: z.ZodObject<{
|
|
487
|
+
id: z.ZodString;
|
|
488
|
+
data: z.ZodJSONSchema;
|
|
489
|
+
name: z.ZodString;
|
|
490
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
491
|
+
publishedAt: z.ZodString;
|
|
492
|
+
}, z.core.$strip>;
|
|
493
|
+
export type WebsocketGatewayRealtimeMessage = z.infer<typeof websocketGatewayRealtimeMessageSchema>;
|
|
494
|
+
export declare const websocketGatewayPresenceMemberSchema: z.ZodObject<{
|
|
495
|
+
connectionId: z.ZodString;
|
|
496
|
+
clientId: z.ZodString;
|
|
497
|
+
tenantId: z.ZodString;
|
|
498
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
499
|
+
enteredAt: z.ZodString;
|
|
500
|
+
updatedAt: z.ZodString;
|
|
501
|
+
}, z.core.$strip>;
|
|
502
|
+
export type WebsocketGatewayPresenceMember = z.infer<typeof websocketGatewayPresenceMemberSchema>;
|
|
503
|
+
export declare const websocketGatewayServerFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
504
|
+
type: z.ZodLiteral<"hello">;
|
|
505
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
506
|
+
connectionId: z.ZodString;
|
|
507
|
+
serverTime: z.ZodString;
|
|
508
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
509
|
+
type: z.ZodLiteral<"ack">;
|
|
510
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
511
|
+
operation: z.ZodString;
|
|
512
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
513
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
514
|
+
type: z.ZodLiteral<"error">;
|
|
515
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
516
|
+
code: z.ZodString;
|
|
517
|
+
message: z.ZodString;
|
|
518
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
519
|
+
type: z.ZodLiteral<"channel.message">;
|
|
520
|
+
message: z.ZodObject<{
|
|
521
|
+
id: z.ZodString;
|
|
522
|
+
channel: z.ZodString;
|
|
523
|
+
name: z.ZodString;
|
|
524
|
+
data: z.ZodJSONSchema;
|
|
525
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
526
|
+
publishedAt: z.ZodString;
|
|
527
|
+
}, z.core.$strip>;
|
|
528
|
+
prevCursor: z.ZodOptional<z.ZodString>;
|
|
529
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
530
|
+
type: z.ZodLiteral<"channel.history">;
|
|
531
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
532
|
+
channel: z.ZodString;
|
|
533
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
534
|
+
id: z.ZodString;
|
|
535
|
+
channel: z.ZodString;
|
|
536
|
+
name: z.ZodString;
|
|
537
|
+
data: z.ZodJSONSchema;
|
|
538
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
539
|
+
publishedAt: z.ZodString;
|
|
540
|
+
}, z.core.$strip>>;
|
|
541
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
542
|
+
type: z.ZodLiteral<"realtime.subscribed">;
|
|
543
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
544
|
+
topic: z.ZodString;
|
|
545
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
546
|
+
resyncRequired: z.ZodBoolean;
|
|
547
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
548
|
+
type: z.ZodLiteral<"realtime.message">;
|
|
549
|
+
topic: z.ZodString;
|
|
550
|
+
message: z.ZodObject<{
|
|
551
|
+
id: z.ZodString;
|
|
552
|
+
data: z.ZodJSONSchema;
|
|
553
|
+
name: z.ZodString;
|
|
554
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
555
|
+
publishedAt: z.ZodString;
|
|
556
|
+
}, z.core.$strip>;
|
|
557
|
+
prevCursor: z.ZodOptional<z.ZodString>;
|
|
558
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
559
|
+
type: z.ZodLiteral<"realtime.error">;
|
|
560
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
561
|
+
topic: z.ZodString;
|
|
562
|
+
code: z.ZodString;
|
|
563
|
+
message: z.ZodString;
|
|
564
|
+
retryable: z.ZodBoolean;
|
|
565
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
566
|
+
type: z.ZodLiteral<"realtime.history">;
|
|
567
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
568
|
+
topic: z.ZodString;
|
|
569
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
570
|
+
id: z.ZodString;
|
|
571
|
+
data: z.ZodJSONSchema;
|
|
572
|
+
name: z.ZodString;
|
|
573
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
574
|
+
publishedAt: z.ZodString;
|
|
575
|
+
}, z.core.$strip>>;
|
|
576
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
577
|
+
type: z.ZodLiteral<"realtime.presence.event">;
|
|
578
|
+
topic: z.ZodString;
|
|
579
|
+
action: z.ZodEnum<{
|
|
580
|
+
enter: "enter";
|
|
581
|
+
update: "update";
|
|
582
|
+
leave: "leave";
|
|
583
|
+
}>;
|
|
584
|
+
member: z.ZodObject<{
|
|
585
|
+
connectionId: z.ZodString;
|
|
586
|
+
clientId: z.ZodString;
|
|
587
|
+
tenantId: z.ZodString;
|
|
588
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
589
|
+
enteredAt: z.ZodString;
|
|
590
|
+
updatedAt: z.ZodString;
|
|
591
|
+
}, z.core.$strip>;
|
|
592
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
593
|
+
type: z.ZodLiteral<"realtime.presence.snapshot">;
|
|
594
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
595
|
+
topic: z.ZodString;
|
|
596
|
+
members: z.ZodArray<z.ZodObject<{
|
|
597
|
+
connectionId: z.ZodString;
|
|
598
|
+
clientId: z.ZodString;
|
|
599
|
+
tenantId: z.ZodString;
|
|
600
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
601
|
+
enteredAt: z.ZodString;
|
|
602
|
+
updatedAt: z.ZodString;
|
|
603
|
+
}, z.core.$strip>>;
|
|
604
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
605
|
+
type: z.ZodLiteral<"presence.event">;
|
|
606
|
+
channel: z.ZodString;
|
|
607
|
+
action: z.ZodEnum<{
|
|
608
|
+
enter: "enter";
|
|
609
|
+
update: "update";
|
|
610
|
+
leave: "leave";
|
|
611
|
+
}>;
|
|
612
|
+
member: z.ZodObject<{
|
|
613
|
+
connectionId: z.ZodString;
|
|
614
|
+
clientId: z.ZodString;
|
|
615
|
+
tenantId: z.ZodString;
|
|
616
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
617
|
+
enteredAt: z.ZodString;
|
|
618
|
+
updatedAt: z.ZodString;
|
|
619
|
+
}, z.core.$strip>;
|
|
620
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
621
|
+
type: z.ZodLiteral<"presence.snapshot">;
|
|
622
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
623
|
+
channel: z.ZodString;
|
|
624
|
+
members: z.ZodArray<z.ZodObject<{
|
|
625
|
+
connectionId: z.ZodString;
|
|
626
|
+
clientId: z.ZodString;
|
|
627
|
+
tenantId: z.ZodString;
|
|
628
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
629
|
+
enteredAt: z.ZodString;
|
|
630
|
+
updatedAt: z.ZodString;
|
|
631
|
+
}, z.core.$strip>>;
|
|
632
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
633
|
+
type: z.ZodLiteral<"rpc.call">;
|
|
634
|
+
name: z.ZodString;
|
|
635
|
+
correlationId: z.ZodString;
|
|
636
|
+
data: z.ZodJSONSchema;
|
|
637
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
638
|
+
type: z.ZodLiteral<"rpc.response">;
|
|
639
|
+
correlationId: z.ZodString;
|
|
640
|
+
data: z.ZodOptional<z.ZodJSONSchema>;
|
|
641
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
642
|
+
code: z.ZodString;
|
|
643
|
+
message: z.ZodString;
|
|
644
|
+
}, z.core.$strip>>;
|
|
645
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
646
|
+
type: z.ZodLiteral<"bridge.message">;
|
|
647
|
+
bridge: z.ZodString;
|
|
648
|
+
fromConnectionId: z.ZodString;
|
|
649
|
+
role: z.ZodString;
|
|
650
|
+
data: z.ZodJSONSchema;
|
|
651
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
652
|
+
type: z.ZodLiteral<"work.offer">;
|
|
653
|
+
queue: z.ZodString;
|
|
654
|
+
leaseId: z.ZodString;
|
|
655
|
+
payload: z.ZodJSONSchema;
|
|
656
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
657
|
+
type: z.ZodLiteral<"work.completed">;
|
|
658
|
+
leaseId: z.ZodString;
|
|
659
|
+
result: z.ZodOptional<z.ZodJSONSchema>;
|
|
660
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
661
|
+
type: z.ZodLiteral<"work.failed">;
|
|
662
|
+
leaseId: z.ZodString;
|
|
663
|
+
error: z.ZodString;
|
|
664
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
665
|
+
type: z.ZodLiteral<"proxy.open">;
|
|
666
|
+
upstreamId: z.ZodString;
|
|
667
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
668
|
+
type: z.ZodLiteral<"proxy.message">;
|
|
669
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
670
|
+
encoding: z.ZodLiteral<"base64">;
|
|
671
|
+
data: z.ZodString;
|
|
672
|
+
}, z.core.$strip>]>;
|
|
673
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
674
|
+
type: z.ZodLiteral<"proxy.closed">;
|
|
675
|
+
code: z.ZodOptional<z.ZodNumber>;
|
|
676
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
677
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
678
|
+
type: z.ZodLiteral<"pong">;
|
|
679
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
680
|
+
}, z.core.$strip>], "type">;
|
|
681
|
+
export type WebsocketGatewayServerFrame = z.infer<typeof websocketGatewayServerFrameSchema>;
|
|
682
|
+
export declare const compareWebsocketGatewayCursors: (left: string, right: string) => number;
|
|
683
|
+
export declare const hasWebsocketGatewayCapability: (capabilities: readonly WebsocketGatewayCapability[], args: {
|
|
684
|
+
action: WebsocketGatewayAction;
|
|
685
|
+
resource: string;
|
|
686
|
+
}) => boolean;
|
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
const websocketGatewayDataSchema = z.json();
|
|
3
|
+
const websocketGatewayProtocolVersion = 1;
|
|
4
|
+
const websocketGatewayActionNames = [
|
|
5
|
+
"subscribe",
|
|
6
|
+
"publish",
|
|
7
|
+
"history",
|
|
8
|
+
"presence",
|
|
9
|
+
"realtime.subscribe",
|
|
10
|
+
"rpc.send",
|
|
11
|
+
"rpc.receive",
|
|
12
|
+
"bridge.join",
|
|
13
|
+
"bridge.send",
|
|
14
|
+
"bridge.receive",
|
|
15
|
+
"proxy.connect",
|
|
16
|
+
"work.lease",
|
|
17
|
+
"work.heartbeat",
|
|
18
|
+
"work.complete",
|
|
19
|
+
"work.fail"
|
|
20
|
+
];
|
|
21
|
+
const websocketGatewayActionSchema = z.enum(websocketGatewayActionNames);
|
|
22
|
+
const websocketGatewayCapabilityLimitsSchema = z.object({
|
|
23
|
+
maxFrameBytes: z.number().int().positive().optional(),
|
|
24
|
+
maxFramesPerMinute: z.number().int().positive().optional(),
|
|
25
|
+
maxSubscriptions: z.number().int().positive().optional()
|
|
26
|
+
});
|
|
27
|
+
const websocketGatewayCapabilitySchema = z.object({
|
|
28
|
+
channels: z.array(z.string().min(1)).min(1),
|
|
29
|
+
actions: z.array(websocketGatewayActionSchema).min(1),
|
|
30
|
+
limits: websocketGatewayCapabilityLimitsSchema.optional()
|
|
31
|
+
});
|
|
32
|
+
const websocketGatewayWebsocketUrlSchema = z.string().url().refine(
|
|
33
|
+
(value) => {
|
|
34
|
+
try {
|
|
35
|
+
const protocol = new URL(value).protocol;
|
|
36
|
+
return protocol === "ws:" || protocol === "wss:";
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{ message: "Expected a ws:// or wss:// URL" }
|
|
42
|
+
);
|
|
43
|
+
const websocketGatewayProxyUpstreamDescriptorSchema = z.object({
|
|
44
|
+
id: z.string().min(1),
|
|
45
|
+
url: websocketGatewayWebsocketUrlSchema,
|
|
46
|
+
headers: z.record(z.string().min(1), z.string()).default({})
|
|
47
|
+
});
|
|
48
|
+
const baseClientFrameSchema = z.strictObject({
|
|
49
|
+
id: z.string().min(1).optional()
|
|
50
|
+
});
|
|
51
|
+
const websocketGatewayAuthFrameSchema = baseClientFrameSchema.extend({
|
|
52
|
+
type: z.literal("auth"),
|
|
53
|
+
token: z.string().min(1)
|
|
54
|
+
});
|
|
55
|
+
const websocketGatewaySubscribeFrameSchema = baseClientFrameSchema.extend({
|
|
56
|
+
type: z.literal("channel.subscribe"),
|
|
57
|
+
channel: z.string().min(1),
|
|
58
|
+
afterCursor: z.string().min(1).optional()
|
|
59
|
+
});
|
|
60
|
+
const websocketGatewayUnsubscribeFrameSchema = baseClientFrameSchema.extend({
|
|
61
|
+
type: z.literal("channel.unsubscribe"),
|
|
62
|
+
channel: z.string().min(1)
|
|
63
|
+
});
|
|
64
|
+
const websocketGatewayPublishFrameSchema = z.object({
|
|
65
|
+
id: z.string().min(1).optional(),
|
|
66
|
+
type: z.literal("channel.publish"),
|
|
67
|
+
channel: z.string().min(1),
|
|
68
|
+
name: z.string().min(1).default("message"),
|
|
69
|
+
data: websocketGatewayDataSchema,
|
|
70
|
+
idempotencyKey: z.string().min(1).optional(),
|
|
71
|
+
// retain: false skips channel-history storage (pub/sub delivery only). For
|
|
72
|
+
// streams whose durability lives elsewhere (the ACP outbox, heartbeats, hot previews).
|
|
73
|
+
retain: z.boolean().optional()
|
|
74
|
+
});
|
|
75
|
+
const websocketGatewayHistoryFrameSchema = baseClientFrameSchema.extend({
|
|
76
|
+
type: z.literal("channel.history"),
|
|
77
|
+
channel: z.string().min(1),
|
|
78
|
+
afterCursor: z.string().min(1).optional(),
|
|
79
|
+
limit: z.number().int().positive().max(1e3).default(100)
|
|
80
|
+
});
|
|
81
|
+
const websocketGatewayRealtimeSubscriptionSchema = z.object({
|
|
82
|
+
topic: z.string().min(1),
|
|
83
|
+
afterCursor: z.string().min(1).optional()
|
|
84
|
+
});
|
|
85
|
+
const websocketGatewayRealtimeSubscribeFrameSchema = baseClientFrameSchema.extend({
|
|
86
|
+
type: z.literal("realtime.subscribe"),
|
|
87
|
+
subscriptions: z.array(websocketGatewayRealtimeSubscriptionSchema).min(1).max(64)
|
|
88
|
+
});
|
|
89
|
+
const websocketGatewayRealtimeUnsubscribeFrameSchema = baseClientFrameSchema.extend({
|
|
90
|
+
type: z.literal("realtime.unsubscribe"),
|
|
91
|
+
topics: z.array(z.string().min(1)).min(1).max(64)
|
|
92
|
+
});
|
|
93
|
+
const websocketGatewayRealtimeHistoryFrameSchema = baseClientFrameSchema.extend({
|
|
94
|
+
type: z.literal("realtime.history"),
|
|
95
|
+
topic: z.string().min(1),
|
|
96
|
+
afterCursor: z.string().min(1).optional(),
|
|
97
|
+
limit: z.number().int().positive().max(1e3).default(100)
|
|
98
|
+
});
|
|
99
|
+
const websocketGatewayRealtimePresenceEnterFrameSchema = baseClientFrameSchema.extend({
|
|
100
|
+
type: z.literal("realtime.presence.enter"),
|
|
101
|
+
topic: z.string().min(1),
|
|
102
|
+
data: websocketGatewayDataSchema.optional()
|
|
103
|
+
});
|
|
104
|
+
const websocketGatewayRealtimePresenceUpdateFrameSchema = baseClientFrameSchema.extend({
|
|
105
|
+
type: z.literal("realtime.presence.update"),
|
|
106
|
+
topic: z.string().min(1),
|
|
107
|
+
data: websocketGatewayDataSchema.optional()
|
|
108
|
+
});
|
|
109
|
+
const websocketGatewayRealtimePresenceLeaveFrameSchema = baseClientFrameSchema.extend({
|
|
110
|
+
type: z.literal("realtime.presence.leave"),
|
|
111
|
+
topic: z.string().min(1)
|
|
112
|
+
});
|
|
113
|
+
const websocketGatewayRealtimePresenceGetFrameSchema = baseClientFrameSchema.extend({
|
|
114
|
+
type: z.literal("realtime.presence.get"),
|
|
115
|
+
topic: z.string().min(1)
|
|
116
|
+
});
|
|
117
|
+
const websocketGatewayPresenceEnterFrameSchema = baseClientFrameSchema.extend({
|
|
118
|
+
type: z.literal("presence.enter"),
|
|
119
|
+
channel: z.string().min(1),
|
|
120
|
+
data: websocketGatewayDataSchema.optional()
|
|
121
|
+
});
|
|
122
|
+
const websocketGatewayPresenceUpdateFrameSchema = baseClientFrameSchema.extend({
|
|
123
|
+
type: z.literal("presence.update"),
|
|
124
|
+
channel: z.string().min(1),
|
|
125
|
+
data: websocketGatewayDataSchema.optional()
|
|
126
|
+
});
|
|
127
|
+
const websocketGatewayPresenceLeaveFrameSchema = baseClientFrameSchema.extend({
|
|
128
|
+
type: z.literal("presence.leave"),
|
|
129
|
+
channel: z.string().min(1)
|
|
130
|
+
});
|
|
131
|
+
const websocketGatewayPresenceGetFrameSchema = baseClientFrameSchema.extend({
|
|
132
|
+
type: z.literal("presence.get"),
|
|
133
|
+
channel: z.string().min(1)
|
|
134
|
+
});
|
|
135
|
+
const websocketGatewayRpcRegisterFrameSchema = baseClientFrameSchema.extend({
|
|
136
|
+
type: z.literal("rpc.register"),
|
|
137
|
+
name: z.string().min(1)
|
|
138
|
+
});
|
|
139
|
+
const websocketGatewayRpcCallFrameSchema = baseClientFrameSchema.extend({
|
|
140
|
+
type: z.literal("rpc.call"),
|
|
141
|
+
name: z.string().min(1),
|
|
142
|
+
correlationId: z.string().min(1),
|
|
143
|
+
data: websocketGatewayDataSchema,
|
|
144
|
+
timeoutMs: z.number().int().positive().max(9e5).default(3e4)
|
|
145
|
+
}).refine((frame) => frame.timeoutMs <= 12e4 || /^final-node:[^:]+:runtime$/.test(frame.name), {
|
|
146
|
+
path: ["timeoutMs"],
|
|
147
|
+
message: "Only Final Node runtime RPCs support timeouts above 120 seconds"
|
|
148
|
+
});
|
|
149
|
+
const websocketGatewayRpcRespondFrameSchema = baseClientFrameSchema.extend({
|
|
150
|
+
type: z.literal("rpc.respond"),
|
|
151
|
+
correlationId: z.string().min(1),
|
|
152
|
+
data: websocketGatewayDataSchema.optional(),
|
|
153
|
+
error: z.object({
|
|
154
|
+
code: z.string().min(1),
|
|
155
|
+
message: z.string().min(1)
|
|
156
|
+
}).optional()
|
|
157
|
+
});
|
|
158
|
+
const websocketGatewayBridgeJoinFrameSchema = baseClientFrameSchema.extend({
|
|
159
|
+
type: z.literal("bridge.join"),
|
|
160
|
+
bridge: z.string().min(1),
|
|
161
|
+
role: z.string().min(1)
|
|
162
|
+
});
|
|
163
|
+
const websocketGatewayBridgeLeaveFrameSchema = baseClientFrameSchema.extend({
|
|
164
|
+
type: z.literal("bridge.leave"),
|
|
165
|
+
bridge: z.string().min(1)
|
|
166
|
+
});
|
|
167
|
+
const websocketGatewayBridgeSendFrameSchema = baseClientFrameSchema.extend({
|
|
168
|
+
type: z.literal("bridge.send"),
|
|
169
|
+
bridge: z.string().min(1),
|
|
170
|
+
data: websocketGatewayDataSchema
|
|
171
|
+
});
|
|
172
|
+
const websocketGatewayProxyConnectFrameSchema = baseClientFrameSchema.extend({
|
|
173
|
+
type: z.literal("proxy.connect"),
|
|
174
|
+
upstreamId: z.string().min(1)
|
|
175
|
+
});
|
|
176
|
+
const websocketGatewayProxyPayloadSchema = z.union([
|
|
177
|
+
z.string(),
|
|
178
|
+
z.object({
|
|
179
|
+
encoding: z.literal("base64"),
|
|
180
|
+
data: z.string()
|
|
181
|
+
})
|
|
182
|
+
]);
|
|
183
|
+
const websocketGatewayProxySendFrameSchema = baseClientFrameSchema.extend({
|
|
184
|
+
type: z.literal("proxy.send"),
|
|
185
|
+
data: websocketGatewayProxyPayloadSchema
|
|
186
|
+
});
|
|
187
|
+
const websocketGatewayProxyCloseFrameSchema = baseClientFrameSchema.extend({
|
|
188
|
+
type: z.literal("proxy.close"),
|
|
189
|
+
code: z.number().int().positive().optional(),
|
|
190
|
+
reason: z.string().optional()
|
|
191
|
+
});
|
|
192
|
+
const websocketGatewayWorkerHelloFrameSchema = baseClientFrameSchema.extend({
|
|
193
|
+
type: z.literal("worker.hello"),
|
|
194
|
+
workerId: z.string().min(1),
|
|
195
|
+
namespace: z.string().min(1).optional(),
|
|
196
|
+
appVersion: z.string().min(1).optional(),
|
|
197
|
+
queues: z.array(z.string().min(1)).min(1),
|
|
198
|
+
maxConcurrency: z.number().int().min(1).max(1e4).optional(),
|
|
199
|
+
inFlightLeaseIds: z.array(z.string().min(1)).default([]),
|
|
200
|
+
inFlightLeases: z.array(
|
|
201
|
+
z.object({
|
|
202
|
+
leaseId: z.string().min(1),
|
|
203
|
+
queue: z.string().min(1)
|
|
204
|
+
})
|
|
205
|
+
).default([])
|
|
206
|
+
});
|
|
207
|
+
const websocketGatewayWorkOfferFrameSchema = baseClientFrameSchema.extend({
|
|
208
|
+
type: z.literal("work.offer"),
|
|
209
|
+
queue: z.string().min(1),
|
|
210
|
+
leaseId: z.string().min(1),
|
|
211
|
+
payload: websocketGatewayDataSchema
|
|
212
|
+
});
|
|
213
|
+
const websocketGatewayWorkAcceptFrameSchema = baseClientFrameSchema.extend({
|
|
214
|
+
type: z.literal("work.accept"),
|
|
215
|
+
leaseId: z.string().min(1)
|
|
216
|
+
});
|
|
217
|
+
const websocketGatewayWorkHeartbeatFrameSchema = baseClientFrameSchema.extend({
|
|
218
|
+
type: z.literal("work.heartbeat"),
|
|
219
|
+
leaseId: z.string().min(1)
|
|
220
|
+
});
|
|
221
|
+
const websocketGatewayWorkCompleteFrameSchema = baseClientFrameSchema.extend({
|
|
222
|
+
type: z.literal("work.complete"),
|
|
223
|
+
leaseId: z.string().min(1),
|
|
224
|
+
result: websocketGatewayDataSchema.optional()
|
|
225
|
+
});
|
|
226
|
+
const websocketGatewayWorkFailFrameSchema = baseClientFrameSchema.extend({
|
|
227
|
+
type: z.literal("work.fail"),
|
|
228
|
+
leaseId: z.string().min(1),
|
|
229
|
+
error: z.string().min(1)
|
|
230
|
+
});
|
|
231
|
+
const websocketGatewayWorkDrainFrameSchema = baseClientFrameSchema.extend({
|
|
232
|
+
type: z.literal("work.drain"),
|
|
233
|
+
reason: z.string().min(1).optional()
|
|
234
|
+
});
|
|
235
|
+
const websocketGatewayPingFrameSchema = baseClientFrameSchema.extend({
|
|
236
|
+
type: z.literal("ping"),
|
|
237
|
+
nonce: z.string().min(1).optional()
|
|
238
|
+
});
|
|
239
|
+
const websocketGatewayClientFrameSchema = z.discriminatedUnion("type", [
|
|
240
|
+
websocketGatewayAuthFrameSchema,
|
|
241
|
+
websocketGatewaySubscribeFrameSchema,
|
|
242
|
+
websocketGatewayUnsubscribeFrameSchema,
|
|
243
|
+
websocketGatewayPublishFrameSchema,
|
|
244
|
+
websocketGatewayHistoryFrameSchema,
|
|
245
|
+
websocketGatewayRealtimeSubscribeFrameSchema,
|
|
246
|
+
websocketGatewayRealtimeUnsubscribeFrameSchema,
|
|
247
|
+
websocketGatewayRealtimeHistoryFrameSchema,
|
|
248
|
+
websocketGatewayRealtimePresenceEnterFrameSchema,
|
|
249
|
+
websocketGatewayRealtimePresenceUpdateFrameSchema,
|
|
250
|
+
websocketGatewayRealtimePresenceLeaveFrameSchema,
|
|
251
|
+
websocketGatewayRealtimePresenceGetFrameSchema,
|
|
252
|
+
websocketGatewayPresenceEnterFrameSchema,
|
|
253
|
+
websocketGatewayPresenceUpdateFrameSchema,
|
|
254
|
+
websocketGatewayPresenceLeaveFrameSchema,
|
|
255
|
+
websocketGatewayPresenceGetFrameSchema,
|
|
256
|
+
websocketGatewayRpcRegisterFrameSchema,
|
|
257
|
+
websocketGatewayRpcCallFrameSchema,
|
|
258
|
+
websocketGatewayRpcRespondFrameSchema,
|
|
259
|
+
websocketGatewayBridgeJoinFrameSchema,
|
|
260
|
+
websocketGatewayBridgeLeaveFrameSchema,
|
|
261
|
+
websocketGatewayBridgeSendFrameSchema,
|
|
262
|
+
websocketGatewayProxyConnectFrameSchema,
|
|
263
|
+
websocketGatewayProxySendFrameSchema,
|
|
264
|
+
websocketGatewayProxyCloseFrameSchema,
|
|
265
|
+
websocketGatewayWorkerHelloFrameSchema,
|
|
266
|
+
websocketGatewayWorkOfferFrameSchema,
|
|
267
|
+
websocketGatewayWorkAcceptFrameSchema,
|
|
268
|
+
websocketGatewayWorkHeartbeatFrameSchema,
|
|
269
|
+
websocketGatewayWorkCompleteFrameSchema,
|
|
270
|
+
websocketGatewayWorkFailFrameSchema,
|
|
271
|
+
websocketGatewayWorkDrainFrameSchema,
|
|
272
|
+
websocketGatewayPingFrameSchema
|
|
273
|
+
]);
|
|
274
|
+
const websocketGatewayMessageSchema = z.object({
|
|
275
|
+
id: z.string().min(1),
|
|
276
|
+
channel: z.string().min(1),
|
|
277
|
+
name: z.string().min(1),
|
|
278
|
+
data: websocketGatewayDataSchema,
|
|
279
|
+
// null for non-retained messages: they have no position in the history
|
|
280
|
+
// stream, and subscribers must not advance their replay cursor past them.
|
|
281
|
+
cursor: z.string().min(1).nullable(),
|
|
282
|
+
publishedAt: z.string().datetime()
|
|
283
|
+
});
|
|
284
|
+
const websocketGatewayPublishSuccessResponseSchema = z.object({
|
|
285
|
+
published: z.literal(true),
|
|
286
|
+
message: websocketGatewayMessageSchema.pick({ cursor: true })
|
|
287
|
+
});
|
|
288
|
+
const WEBSOCKET_GATEWAY_PUBLISH_BATCH_MAX = 100;
|
|
289
|
+
const websocketGatewayPublishBatchRequestSchema = z.object({
|
|
290
|
+
tenantId: z.string().min(1),
|
|
291
|
+
messages: z.array(
|
|
292
|
+
z.object({
|
|
293
|
+
channel: z.string().min(1),
|
|
294
|
+
name: z.string().min(1).default("message"),
|
|
295
|
+
data: websocketGatewayDataSchema,
|
|
296
|
+
idempotencyKey: z.string().min(1).optional(),
|
|
297
|
+
retain: z.boolean().optional()
|
|
298
|
+
})
|
|
299
|
+
).min(1).max(WEBSOCKET_GATEWAY_PUBLISH_BATCH_MAX)
|
|
300
|
+
});
|
|
301
|
+
const websocketGatewayPublishBatchResponseSchema = z.object({
|
|
302
|
+
messages: z.array(websocketGatewayMessageSchema.pick({ cursor: true }).nullable())
|
|
303
|
+
});
|
|
304
|
+
const websocketGatewayRealtimeMessageSchema = websocketGatewayMessageSchema.omit({
|
|
305
|
+
channel: true
|
|
306
|
+
});
|
|
307
|
+
const websocketGatewayPresenceMemberSchema = z.object({
|
|
308
|
+
connectionId: z.string().min(1),
|
|
309
|
+
clientId: z.string().min(1),
|
|
310
|
+
tenantId: z.string().min(1),
|
|
311
|
+
data: websocketGatewayDataSchema.optional(),
|
|
312
|
+
enteredAt: z.string().datetime(),
|
|
313
|
+
updatedAt: z.string().datetime()
|
|
314
|
+
});
|
|
315
|
+
const websocketGatewayServerFrameSchema = z.discriminatedUnion("type", [
|
|
316
|
+
z.object({
|
|
317
|
+
type: z.literal("hello"),
|
|
318
|
+
protocolVersion: z.literal(websocketGatewayProtocolVersion),
|
|
319
|
+
connectionId: z.string().min(1),
|
|
320
|
+
serverTime: z.string().datetime()
|
|
321
|
+
}),
|
|
322
|
+
z.object({
|
|
323
|
+
type: z.literal("ack"),
|
|
324
|
+
requestId: z.string().min(1).optional(),
|
|
325
|
+
operation: z.string().min(1),
|
|
326
|
+
// channel.subscribe: the channel's newest retained cursor, where a reconnect resumes.
|
|
327
|
+
cursor: z.string().min(1).optional()
|
|
328
|
+
}),
|
|
329
|
+
z.object({
|
|
330
|
+
type: z.literal("error"),
|
|
331
|
+
requestId: z.string().min(1).optional(),
|
|
332
|
+
code: z.string().min(1),
|
|
333
|
+
message: z.string().min(1)
|
|
334
|
+
}),
|
|
335
|
+
z.object({
|
|
336
|
+
type: z.literal("channel.message"),
|
|
337
|
+
message: websocketGatewayMessageSchema,
|
|
338
|
+
// Cursor of the previous retained message on this channel as seen by the
|
|
339
|
+
// delivering instance; a mismatch with the client's last-seen cursor means
|
|
340
|
+
// messages were skipped (backpressure) and the client should gap-fill via
|
|
341
|
+
// channel.history. Absent for non-retained messages.
|
|
342
|
+
prevCursor: z.string().min(1).optional()
|
|
343
|
+
}),
|
|
344
|
+
z.object({
|
|
345
|
+
type: z.literal("channel.history"),
|
|
346
|
+
requestId: z.string().min(1).optional(),
|
|
347
|
+
channel: z.string().min(1),
|
|
348
|
+
messages: z.array(websocketGatewayMessageSchema)
|
|
349
|
+
}),
|
|
350
|
+
z.object({
|
|
351
|
+
type: z.literal("realtime.subscribed"),
|
|
352
|
+
requestId: z.string().min(1).optional(),
|
|
353
|
+
topic: z.string().min(1),
|
|
354
|
+
cursor: z.string().min(1).nullable(),
|
|
355
|
+
resyncRequired: z.boolean()
|
|
356
|
+
}),
|
|
357
|
+
z.object({
|
|
358
|
+
type: z.literal("realtime.message"),
|
|
359
|
+
topic: z.string().min(1),
|
|
360
|
+
message: websocketGatewayRealtimeMessageSchema,
|
|
361
|
+
prevCursor: z.string().min(1).optional()
|
|
362
|
+
}),
|
|
363
|
+
z.object({
|
|
364
|
+
type: z.literal("realtime.error"),
|
|
365
|
+
requestId: z.string().min(1).optional(),
|
|
366
|
+
topic: z.string().min(1),
|
|
367
|
+
code: z.string().min(1),
|
|
368
|
+
message: z.string().min(1),
|
|
369
|
+
retryable: z.boolean()
|
|
370
|
+
}),
|
|
371
|
+
z.object({
|
|
372
|
+
type: z.literal("realtime.history"),
|
|
373
|
+
requestId: z.string().min(1).optional(),
|
|
374
|
+
topic: z.string().min(1),
|
|
375
|
+
messages: z.array(websocketGatewayRealtimeMessageSchema)
|
|
376
|
+
}),
|
|
377
|
+
z.object({
|
|
378
|
+
type: z.literal("realtime.presence.event"),
|
|
379
|
+
topic: z.string().min(1),
|
|
380
|
+
action: z.enum(["enter", "update", "leave"]),
|
|
381
|
+
member: websocketGatewayPresenceMemberSchema
|
|
382
|
+
}),
|
|
383
|
+
z.object({
|
|
384
|
+
type: z.literal("realtime.presence.snapshot"),
|
|
385
|
+
requestId: z.string().min(1).optional(),
|
|
386
|
+
topic: z.string().min(1),
|
|
387
|
+
members: z.array(websocketGatewayPresenceMemberSchema)
|
|
388
|
+
}),
|
|
389
|
+
z.object({
|
|
390
|
+
type: z.literal("presence.event"),
|
|
391
|
+
channel: z.string().min(1),
|
|
392
|
+
action: z.enum(["enter", "update", "leave"]),
|
|
393
|
+
member: websocketGatewayPresenceMemberSchema
|
|
394
|
+
}),
|
|
395
|
+
z.object({
|
|
396
|
+
type: z.literal("presence.snapshot"),
|
|
397
|
+
requestId: z.string().min(1).optional(),
|
|
398
|
+
channel: z.string().min(1),
|
|
399
|
+
members: z.array(websocketGatewayPresenceMemberSchema)
|
|
400
|
+
}),
|
|
401
|
+
z.object({
|
|
402
|
+
type: z.literal("rpc.call"),
|
|
403
|
+
name: z.string().min(1),
|
|
404
|
+
correlationId: z.string().min(1),
|
|
405
|
+
data: websocketGatewayDataSchema
|
|
406
|
+
}),
|
|
407
|
+
z.object({
|
|
408
|
+
type: z.literal("rpc.response"),
|
|
409
|
+
correlationId: z.string().min(1),
|
|
410
|
+
data: websocketGatewayDataSchema.optional(),
|
|
411
|
+
error: z.object({
|
|
412
|
+
code: z.string().min(1),
|
|
413
|
+
message: z.string().min(1)
|
|
414
|
+
}).optional()
|
|
415
|
+
}),
|
|
416
|
+
z.object({
|
|
417
|
+
type: z.literal("bridge.message"),
|
|
418
|
+
bridge: z.string().min(1),
|
|
419
|
+
fromConnectionId: z.string().min(1),
|
|
420
|
+
role: z.string().min(1),
|
|
421
|
+
data: websocketGatewayDataSchema
|
|
422
|
+
}),
|
|
423
|
+
z.object({
|
|
424
|
+
type: z.literal("work.offer"),
|
|
425
|
+
queue: z.string().min(1),
|
|
426
|
+
leaseId: z.string().min(1),
|
|
427
|
+
payload: websocketGatewayDataSchema
|
|
428
|
+
}),
|
|
429
|
+
z.object({
|
|
430
|
+
type: z.literal("work.completed"),
|
|
431
|
+
leaseId: z.string().min(1),
|
|
432
|
+
result: websocketGatewayDataSchema.optional()
|
|
433
|
+
}),
|
|
434
|
+
z.object({
|
|
435
|
+
type: z.literal("work.failed"),
|
|
436
|
+
leaseId: z.string().min(1),
|
|
437
|
+
error: z.string().min(1)
|
|
438
|
+
}),
|
|
439
|
+
z.object({
|
|
440
|
+
type: z.literal("proxy.open"),
|
|
441
|
+
upstreamId: z.string().min(1)
|
|
442
|
+
}),
|
|
443
|
+
z.object({
|
|
444
|
+
type: z.literal("proxy.message"),
|
|
445
|
+
data: websocketGatewayProxyPayloadSchema
|
|
446
|
+
}),
|
|
447
|
+
z.object({
|
|
448
|
+
type: z.literal("proxy.closed"),
|
|
449
|
+
code: z.number().int().optional(),
|
|
450
|
+
reason: z.string().optional()
|
|
451
|
+
}),
|
|
452
|
+
z.object({
|
|
453
|
+
type: z.literal("pong"),
|
|
454
|
+
nonce: z.string().min(1).optional()
|
|
455
|
+
})
|
|
456
|
+
]);
|
|
457
|
+
const compareWebsocketGatewayCursors = (left, right) => {
|
|
458
|
+
const [leftMs = "0", leftSeq = "0"] = left.split("-");
|
|
459
|
+
const [rightMs = "0", rightSeq = "0"] = right.split("-");
|
|
460
|
+
const ms = BigInt(leftMs) - BigInt(rightMs);
|
|
461
|
+
if (ms !== 0n) return ms < 0n ? -1 : 1;
|
|
462
|
+
const seq = BigInt(leftSeq) - BigInt(rightSeq);
|
|
463
|
+
return seq === 0n ? 0 : seq < 0n ? -1 : 1;
|
|
464
|
+
};
|
|
465
|
+
const matchesPattern = (pattern, value) => {
|
|
466
|
+
if (pattern === "*") return true;
|
|
467
|
+
if (pattern.endsWith("*")) return value.startsWith(pattern.slice(0, -1));
|
|
468
|
+
return pattern === value;
|
|
469
|
+
};
|
|
470
|
+
const hasWebsocketGatewayCapability = (capabilities, args) => capabilities.some(
|
|
471
|
+
(capability) => capability.actions.includes(args.action) && capability.channels.some((pattern) => matchesPattern(pattern, args.resource))
|
|
472
|
+
);
|
|
473
|
+
export {
|
|
474
|
+
WEBSOCKET_GATEWAY_PUBLISH_BATCH_MAX,
|
|
475
|
+
compareWebsocketGatewayCursors,
|
|
476
|
+
hasWebsocketGatewayCapability,
|
|
477
|
+
websocketGatewayActionNames,
|
|
478
|
+
websocketGatewayActionSchema,
|
|
479
|
+
websocketGatewayAuthFrameSchema,
|
|
480
|
+
websocketGatewayBridgeJoinFrameSchema,
|
|
481
|
+
websocketGatewayBridgeLeaveFrameSchema,
|
|
482
|
+
websocketGatewayBridgeSendFrameSchema,
|
|
483
|
+
websocketGatewayCapabilityLimitsSchema,
|
|
484
|
+
websocketGatewayCapabilitySchema,
|
|
485
|
+
websocketGatewayClientFrameSchema,
|
|
486
|
+
websocketGatewayDataSchema,
|
|
487
|
+
websocketGatewayHistoryFrameSchema,
|
|
488
|
+
websocketGatewayMessageSchema,
|
|
489
|
+
websocketGatewayPingFrameSchema,
|
|
490
|
+
websocketGatewayPresenceEnterFrameSchema,
|
|
491
|
+
websocketGatewayPresenceGetFrameSchema,
|
|
492
|
+
websocketGatewayPresenceLeaveFrameSchema,
|
|
493
|
+
websocketGatewayPresenceMemberSchema,
|
|
494
|
+
websocketGatewayPresenceUpdateFrameSchema,
|
|
495
|
+
websocketGatewayProtocolVersion,
|
|
496
|
+
websocketGatewayProxyCloseFrameSchema,
|
|
497
|
+
websocketGatewayProxyConnectFrameSchema,
|
|
498
|
+
websocketGatewayProxyPayloadSchema,
|
|
499
|
+
websocketGatewayProxySendFrameSchema,
|
|
500
|
+
websocketGatewayProxyUpstreamDescriptorSchema,
|
|
501
|
+
websocketGatewayPublishBatchRequestSchema,
|
|
502
|
+
websocketGatewayPublishBatchResponseSchema,
|
|
503
|
+
websocketGatewayPublishFrameSchema,
|
|
504
|
+
websocketGatewayPublishSuccessResponseSchema,
|
|
505
|
+
websocketGatewayRealtimeHistoryFrameSchema,
|
|
506
|
+
websocketGatewayRealtimeMessageSchema,
|
|
507
|
+
websocketGatewayRealtimePresenceEnterFrameSchema,
|
|
508
|
+
websocketGatewayRealtimePresenceGetFrameSchema,
|
|
509
|
+
websocketGatewayRealtimePresenceLeaveFrameSchema,
|
|
510
|
+
websocketGatewayRealtimePresenceUpdateFrameSchema,
|
|
511
|
+
websocketGatewayRealtimeSubscribeFrameSchema,
|
|
512
|
+
websocketGatewayRealtimeSubscriptionSchema,
|
|
513
|
+
websocketGatewayRealtimeUnsubscribeFrameSchema,
|
|
514
|
+
websocketGatewayRpcCallFrameSchema,
|
|
515
|
+
websocketGatewayRpcRegisterFrameSchema,
|
|
516
|
+
websocketGatewayRpcRespondFrameSchema,
|
|
517
|
+
websocketGatewayServerFrameSchema,
|
|
518
|
+
websocketGatewaySubscribeFrameSchema,
|
|
519
|
+
websocketGatewayUnsubscribeFrameSchema,
|
|
520
|
+
websocketGatewayWorkAcceptFrameSchema,
|
|
521
|
+
websocketGatewayWorkCompleteFrameSchema,
|
|
522
|
+
websocketGatewayWorkDrainFrameSchema,
|
|
523
|
+
websocketGatewayWorkFailFrameSchema,
|
|
524
|
+
websocketGatewayWorkHeartbeatFrameSchema,
|
|
525
|
+
websocketGatewayWorkOfferFrameSchema,
|
|
526
|
+
websocketGatewayWorkerHelloFrameSchema
|
|
527
|
+
};
|
|
528
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as z from 'zod';\n\nexport const websocketGatewayDataSchema = z.json();\n\nexport type WebsocketGatewayData = z.infer<typeof websocketGatewayDataSchema>;\n\nexport const websocketGatewayProtocolVersion = 1 as const;\n\nexport const websocketGatewayActionNames = [\n 'subscribe',\n 'publish',\n 'history',\n 'presence',\n 'realtime.subscribe',\n 'rpc.send',\n 'rpc.receive',\n 'bridge.join',\n 'bridge.send',\n 'bridge.receive',\n 'proxy.connect',\n 'work.lease',\n 'work.heartbeat',\n 'work.complete',\n 'work.fail',\n] as const;\n\nexport const websocketGatewayActionSchema = z.enum(websocketGatewayActionNames);\n\nexport type WebsocketGatewayAction = z.infer<typeof websocketGatewayActionSchema>;\n\nexport const websocketGatewayCapabilityLimitsSchema = z.object({\n maxFrameBytes: z.number().int().positive().optional(),\n maxFramesPerMinute: z.number().int().positive().optional(),\n maxSubscriptions: z.number().int().positive().optional(),\n});\n\nexport const websocketGatewayCapabilitySchema = z.object({\n channels: z.array(z.string().min(1)).min(1),\n actions: z.array(websocketGatewayActionSchema).min(1),\n limits: websocketGatewayCapabilityLimitsSchema.optional(),\n});\n\nexport type WebsocketGatewayCapability = z.infer<typeof websocketGatewayCapabilitySchema>;\n\nconst websocketGatewayWebsocketUrlSchema = z\n .string()\n .url()\n .refine(\n (value) => {\n try {\n const protocol = new URL(value).protocol;\n return protocol === 'ws:' || protocol === 'wss:';\n } catch {\n return false;\n }\n },\n { message: 'Expected a ws:// or wss:// URL' },\n );\n\nexport const websocketGatewayProxyUpstreamDescriptorSchema = z.object({\n id: z.string().min(1),\n url: websocketGatewayWebsocketUrlSchema,\n headers: z.record(z.string().min(1), z.string()).default({}),\n});\n\nexport type WebsocketGatewayProxyUpstreamDescriptor = z.infer<\n typeof websocketGatewayProxyUpstreamDescriptorSchema\n>;\n\n// Strict: a stale client sending a retired authorization-bearing field (e.g.\n// pre-tenancy resourceOrgId) must fail loudly, not be silently rescoped.\nconst baseClientFrameSchema = z.strictObject({\n id: z.string().min(1).optional(),\n});\n\nexport const websocketGatewayAuthFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('auth'),\n token: z.string().min(1),\n});\n\nexport const websocketGatewaySubscribeFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('channel.subscribe'),\n channel: z.string().min(1),\n afterCursor: z.string().min(1).optional(),\n});\n\nexport const websocketGatewayUnsubscribeFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('channel.unsubscribe'),\n channel: z.string().min(1),\n});\n\n// Non-strict, unlike the other client frames: publishers (notably the runtime\n// artifact) roll out independently of the gateway, so a new delivery-semantics\n// field must degrade to its absent-default on old gateways instead of killing\n// the frame. Authorization-bearing changes must never ride an optional publish\n// field \u2014 use a new frame type instead.\nexport const websocketGatewayPublishFrameSchema = z.object({\n id: z.string().min(1).optional(),\n type: z.literal('channel.publish'),\n channel: z.string().min(1),\n name: z.string().min(1).default('message'),\n data: websocketGatewayDataSchema,\n idempotencyKey: z.string().min(1).optional(),\n // retain: false skips channel-history storage (pub/sub delivery only). For\n // streams whose durability lives elsewhere (the ACP outbox, heartbeats, hot previews).\n retain: z.boolean().optional(),\n});\n\nexport const websocketGatewayHistoryFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('channel.history'),\n channel: z.string().min(1),\n afterCursor: z.string().min(1).optional(),\n limit: z.number().int().positive().max(1000).default(100),\n});\n\nexport const websocketGatewayRealtimeSubscriptionSchema = z.object({\n topic: z.string().min(1),\n afterCursor: z.string().min(1).optional(),\n});\n\nexport const websocketGatewayRealtimeSubscribeFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('realtime.subscribe'),\n subscriptions: z.array(websocketGatewayRealtimeSubscriptionSchema).min(1).max(64),\n});\n\nexport const websocketGatewayRealtimeUnsubscribeFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('realtime.unsubscribe'),\n topics: z.array(z.string().min(1)).min(1).max(64),\n});\n\nexport const websocketGatewayRealtimeHistoryFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('realtime.history'),\n topic: z.string().min(1),\n afterCursor: z.string().min(1).optional(),\n limit: z.number().int().positive().max(1000).default(100),\n});\n\nexport const websocketGatewayRealtimePresenceEnterFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('realtime.presence.enter'),\n topic: z.string().min(1),\n data: websocketGatewayDataSchema.optional(),\n});\n\nexport const websocketGatewayRealtimePresenceUpdateFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('realtime.presence.update'),\n topic: z.string().min(1),\n data: websocketGatewayDataSchema.optional(),\n});\n\nexport const websocketGatewayRealtimePresenceLeaveFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('realtime.presence.leave'),\n topic: z.string().min(1),\n});\n\nexport const websocketGatewayRealtimePresenceGetFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('realtime.presence.get'),\n topic: z.string().min(1),\n});\n\nexport const websocketGatewayPresenceEnterFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('presence.enter'),\n channel: z.string().min(1),\n data: websocketGatewayDataSchema.optional(),\n});\n\nexport const websocketGatewayPresenceUpdateFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('presence.update'),\n channel: z.string().min(1),\n data: websocketGatewayDataSchema.optional(),\n});\n\nexport const websocketGatewayPresenceLeaveFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('presence.leave'),\n channel: z.string().min(1),\n});\n\nexport const websocketGatewayPresenceGetFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('presence.get'),\n channel: z.string().min(1),\n});\n\nexport const websocketGatewayRpcRegisterFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('rpc.register'),\n name: z.string().min(1),\n});\n\nexport const websocketGatewayRpcCallFrameSchema = baseClientFrameSchema\n .extend({\n type: z.literal('rpc.call'),\n name: z.string().min(1),\n correlationId: z.string().min(1),\n data: websocketGatewayDataSchema,\n timeoutMs: z.number().int().positive().max(900_000).default(30_000),\n })\n .refine((frame) => frame.timeoutMs <= 120_000 || /^final-node:[^:]+:runtime$/.test(frame.name), {\n path: ['timeoutMs'],\n message: 'Only Final Node runtime RPCs support timeouts above 120 seconds',\n });\n\nexport const websocketGatewayRpcRespondFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('rpc.respond'),\n correlationId: z.string().min(1),\n data: websocketGatewayDataSchema.optional(),\n error: z\n .object({\n code: z.string().min(1),\n message: z.string().min(1),\n })\n .optional(),\n});\n\nexport const websocketGatewayBridgeJoinFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('bridge.join'),\n bridge: z.string().min(1),\n role: z.string().min(1),\n});\n\nexport const websocketGatewayBridgeLeaveFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('bridge.leave'),\n bridge: z.string().min(1),\n});\n\nexport const websocketGatewayBridgeSendFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('bridge.send'),\n bridge: z.string().min(1),\n data: websocketGatewayDataSchema,\n});\n\nexport const websocketGatewayProxyConnectFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('proxy.connect'),\n upstreamId: z.string().min(1),\n});\n\nexport const websocketGatewayProxyPayloadSchema = z.union([\n z.string(),\n z.object({\n encoding: z.literal('base64'),\n data: z.string(),\n }),\n]);\n\nexport type WebsocketGatewayProxyPayload = z.infer<typeof websocketGatewayProxyPayloadSchema>;\n\nexport const websocketGatewayProxySendFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('proxy.send'),\n data: websocketGatewayProxyPayloadSchema,\n});\n\nexport const websocketGatewayProxyCloseFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('proxy.close'),\n code: z.number().int().positive().optional(),\n reason: z.string().optional(),\n});\n\nexport const websocketGatewayWorkerHelloFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('worker.hello'),\n workerId: z.string().min(1),\n namespace: z.string().min(1).optional(),\n appVersion: z.string().min(1).optional(),\n queues: z.array(z.string().min(1)).min(1),\n maxConcurrency: z.number().int().min(1).max(10_000).optional(),\n inFlightLeaseIds: z.array(z.string().min(1)).default([]),\n inFlightLeases: z\n .array(\n z.object({\n leaseId: z.string().min(1),\n queue: z.string().min(1),\n }),\n )\n .default([]),\n});\n\nexport const websocketGatewayWorkOfferFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('work.offer'),\n queue: z.string().min(1),\n leaseId: z.string().min(1),\n payload: websocketGatewayDataSchema,\n});\n\nexport const websocketGatewayWorkAcceptFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('work.accept'),\n leaseId: z.string().min(1),\n});\n\nexport const websocketGatewayWorkHeartbeatFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('work.heartbeat'),\n leaseId: z.string().min(1),\n});\n\nexport const websocketGatewayWorkCompleteFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('work.complete'),\n leaseId: z.string().min(1),\n result: websocketGatewayDataSchema.optional(),\n});\n\nexport const websocketGatewayWorkFailFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('work.fail'),\n leaseId: z.string().min(1),\n error: z.string().min(1),\n});\n\nexport const websocketGatewayWorkDrainFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('work.drain'),\n reason: z.string().min(1).optional(),\n});\n\nexport const websocketGatewayPingFrameSchema = baseClientFrameSchema.extend({\n type: z.literal('ping'),\n nonce: z.string().min(1).optional(),\n});\n\nexport const websocketGatewayClientFrameSchema = z.discriminatedUnion('type', [\n websocketGatewayAuthFrameSchema,\n websocketGatewaySubscribeFrameSchema,\n websocketGatewayUnsubscribeFrameSchema,\n websocketGatewayPublishFrameSchema,\n websocketGatewayHistoryFrameSchema,\n websocketGatewayRealtimeSubscribeFrameSchema,\n websocketGatewayRealtimeUnsubscribeFrameSchema,\n websocketGatewayRealtimeHistoryFrameSchema,\n websocketGatewayRealtimePresenceEnterFrameSchema,\n websocketGatewayRealtimePresenceUpdateFrameSchema,\n websocketGatewayRealtimePresenceLeaveFrameSchema,\n websocketGatewayRealtimePresenceGetFrameSchema,\n websocketGatewayPresenceEnterFrameSchema,\n websocketGatewayPresenceUpdateFrameSchema,\n websocketGatewayPresenceLeaveFrameSchema,\n websocketGatewayPresenceGetFrameSchema,\n websocketGatewayRpcRegisterFrameSchema,\n websocketGatewayRpcCallFrameSchema,\n websocketGatewayRpcRespondFrameSchema,\n websocketGatewayBridgeJoinFrameSchema,\n websocketGatewayBridgeLeaveFrameSchema,\n websocketGatewayBridgeSendFrameSchema,\n websocketGatewayProxyConnectFrameSchema,\n websocketGatewayProxySendFrameSchema,\n websocketGatewayProxyCloseFrameSchema,\n websocketGatewayWorkerHelloFrameSchema,\n websocketGatewayWorkOfferFrameSchema,\n websocketGatewayWorkAcceptFrameSchema,\n websocketGatewayWorkHeartbeatFrameSchema,\n websocketGatewayWorkCompleteFrameSchema,\n websocketGatewayWorkFailFrameSchema,\n websocketGatewayWorkDrainFrameSchema,\n websocketGatewayPingFrameSchema,\n]);\n\nexport type WebsocketGatewayClientFrame = z.infer<typeof websocketGatewayClientFrameSchema>;\n\nexport const websocketGatewayMessageSchema = z.object({\n id: z.string().min(1),\n channel: z.string().min(1),\n name: z.string().min(1),\n data: websocketGatewayDataSchema,\n // null for non-retained messages: they have no position in the history\n // stream, and subscribers must not advance their replay cursor past them.\n cursor: z.string().min(1).nullable(),\n publishedAt: z.string().datetime(),\n});\n\nexport const websocketGatewayPublishSuccessResponseSchema = z.object({\n published: z.literal(true),\n message: websocketGatewayMessageSchema.pick({ cursor: true }),\n});\n\n// `/internal/publish-batch`: one tenant's messages, published in order under one token.\nexport const WEBSOCKET_GATEWAY_PUBLISH_BATCH_MAX = 100;\n\nexport const websocketGatewayPublishBatchRequestSchema = z.object({\n tenantId: z.string().min(1),\n messages: z\n .array(\n z.object({\n channel: z.string().min(1),\n name: z.string().min(1).default('message'),\n data: websocketGatewayDataSchema,\n idempotencyKey: z.string().min(1).optional(),\n retain: z.boolean().optional(),\n }),\n )\n .min(1)\n .max(WEBSOCKET_GATEWAY_PUBLISH_BATCH_MAX),\n});\n\n// One entry per request message, in order: its cursor, or null when it was refused.\nexport const websocketGatewayPublishBatchResponseSchema = z.object({\n messages: z.array(websocketGatewayMessageSchema.pick({ cursor: true }).nullable()),\n});\n\nexport type WebsocketGatewayMessage = z.infer<typeof websocketGatewayMessageSchema>;\n\nexport const websocketGatewayRealtimeMessageSchema = websocketGatewayMessageSchema.omit({\n channel: true,\n});\n\nexport type WebsocketGatewayRealtimeMessage = z.infer<typeof websocketGatewayRealtimeMessageSchema>;\n\nexport const websocketGatewayPresenceMemberSchema = z.object({\n connectionId: z.string().min(1),\n clientId: z.string().min(1),\n tenantId: z.string().min(1),\n data: websocketGatewayDataSchema.optional(),\n enteredAt: z.string().datetime(),\n updatedAt: z.string().datetime(),\n});\n\nexport type WebsocketGatewayPresenceMember = z.infer<typeof websocketGatewayPresenceMemberSchema>;\n\nexport const websocketGatewayServerFrameSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('hello'),\n protocolVersion: z.literal(websocketGatewayProtocolVersion),\n connectionId: z.string().min(1),\n serverTime: z.string().datetime(),\n }),\n z.object({\n type: z.literal('ack'),\n requestId: z.string().min(1).optional(),\n operation: z.string().min(1),\n // channel.subscribe: the channel's newest retained cursor, where a reconnect resumes.\n cursor: z.string().min(1).optional(),\n }),\n z.object({\n type: z.literal('error'),\n requestId: z.string().min(1).optional(),\n code: z.string().min(1),\n message: z.string().min(1),\n }),\n z.object({\n type: z.literal('channel.message'),\n message: websocketGatewayMessageSchema,\n // Cursor of the previous retained message on this channel as seen by the\n // delivering instance; a mismatch with the client's last-seen cursor means\n // messages were skipped (backpressure) and the client should gap-fill via\n // channel.history. Absent for non-retained messages.\n prevCursor: z.string().min(1).optional(),\n }),\n z.object({\n type: z.literal('channel.history'),\n requestId: z.string().min(1).optional(),\n channel: z.string().min(1),\n messages: z.array(websocketGatewayMessageSchema),\n }),\n z.object({\n type: z.literal('realtime.subscribed'),\n requestId: z.string().min(1).optional(),\n topic: z.string().min(1),\n cursor: z.string().min(1).nullable(),\n resyncRequired: z.boolean(),\n }),\n z.object({\n type: z.literal('realtime.message'),\n topic: z.string().min(1),\n message: websocketGatewayRealtimeMessageSchema,\n prevCursor: z.string().min(1).optional(),\n }),\n z.object({\n type: z.literal('realtime.error'),\n requestId: z.string().min(1).optional(),\n topic: z.string().min(1),\n code: z.string().min(1),\n message: z.string().min(1),\n retryable: z.boolean(),\n }),\n z.object({\n type: z.literal('realtime.history'),\n requestId: z.string().min(1).optional(),\n topic: z.string().min(1),\n messages: z.array(websocketGatewayRealtimeMessageSchema),\n }),\n z.object({\n type: z.literal('realtime.presence.event'),\n topic: z.string().min(1),\n action: z.enum(['enter', 'update', 'leave']),\n member: websocketGatewayPresenceMemberSchema,\n }),\n z.object({\n type: z.literal('realtime.presence.snapshot'),\n requestId: z.string().min(1).optional(),\n topic: z.string().min(1),\n members: z.array(websocketGatewayPresenceMemberSchema),\n }),\n z.object({\n type: z.literal('presence.event'),\n channel: z.string().min(1),\n action: z.enum(['enter', 'update', 'leave']),\n member: websocketGatewayPresenceMemberSchema,\n }),\n z.object({\n type: z.literal('presence.snapshot'),\n requestId: z.string().min(1).optional(),\n channel: z.string().min(1),\n members: z.array(websocketGatewayPresenceMemberSchema),\n }),\n z.object({\n type: z.literal('rpc.call'),\n name: z.string().min(1),\n correlationId: z.string().min(1),\n data: websocketGatewayDataSchema,\n }),\n z.object({\n type: z.literal('rpc.response'),\n correlationId: z.string().min(1),\n data: websocketGatewayDataSchema.optional(),\n error: z\n .object({\n code: z.string().min(1),\n message: z.string().min(1),\n })\n .optional(),\n }),\n z.object({\n type: z.literal('bridge.message'),\n bridge: z.string().min(1),\n fromConnectionId: z.string().min(1),\n role: z.string().min(1),\n data: websocketGatewayDataSchema,\n }),\n z.object({\n type: z.literal('work.offer'),\n queue: z.string().min(1),\n leaseId: z.string().min(1),\n payload: websocketGatewayDataSchema,\n }),\n z.object({\n type: z.literal('work.completed'),\n leaseId: z.string().min(1),\n result: websocketGatewayDataSchema.optional(),\n }),\n z.object({\n type: z.literal('work.failed'),\n leaseId: z.string().min(1),\n error: z.string().min(1),\n }),\n z.object({\n type: z.literal('proxy.open'),\n upstreamId: z.string().min(1),\n }),\n z.object({\n type: z.literal('proxy.message'),\n data: websocketGatewayProxyPayloadSchema,\n }),\n z.object({\n type: z.literal('proxy.closed'),\n code: z.number().int().optional(),\n reason: z.string().optional(),\n }),\n z.object({\n type: z.literal('pong'),\n nonce: z.string().min(1).optional(),\n }),\n]);\n\nexport type WebsocketGatewayServerFrame = z.infer<typeof websocketGatewayServerFrameSchema>;\n\n// Stream cursors are `<ms>-<seq>`; lexicographic comparison is wrong across\n// digit-length boundaries (\"9-1\" vs \"10-1\"). Shared here so the gateway's\n// server-side resync merge and the SDK's replay merge cannot drift.\nexport const compareWebsocketGatewayCursors = (left: string, right: string): number => {\n const [leftMs = '0', leftSeq = '0'] = left.split('-');\n const [rightMs = '0', rightSeq = '0'] = right.split('-');\n const ms = BigInt(leftMs) - BigInt(rightMs);\n if (ms !== 0n) return ms < 0n ? -1 : 1;\n const seq = BigInt(leftSeq) - BigInt(rightSeq);\n return seq === 0n ? 0 : seq < 0n ? -1 : 1;\n};\n\nconst matchesPattern = (pattern: string, value: string): boolean => {\n if (pattern === '*') return true;\n if (pattern.endsWith('*')) return value.startsWith(pattern.slice(0, -1));\n return pattern === value;\n};\n\nexport const hasWebsocketGatewayCapability = (\n capabilities: readonly WebsocketGatewayCapability[],\n args: { action: WebsocketGatewayAction; resource: string },\n): boolean =>\n capabilities.some(\n (capability) =>\n capability.actions.includes(args.action) &&\n capability.channels.some((pattern) => matchesPattern(pattern, args.resource)),\n );\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,OAAO;AAEZ,MAAM,6BAA6B,EAAE,KAAK;AAI1C,MAAM,kCAAkC;AAExC,MAAM,8BAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,+BAA+B,EAAE,KAAK,2BAA2B;AAIvE,MAAM,yCAAyC,EAAE,OAAO;AAAA,EAC7D,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EACpD,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EACzD,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AACzD,CAAC;AAEM,MAAM,mCAAmC,EAAE,OAAO;AAAA,EACvD,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAAA,EAC1C,SAAS,EAAE,MAAM,4BAA4B,EAAE,IAAI,CAAC;AAAA,EACpD,QAAQ,uCAAuC,SAAS;AAC1D,CAAC;AAID,MAAM,qCAAqC,EACxC,OAAO,EACP,IAAI,EACJ;AAAA,EACC,CAAC,UAAU;AACT,QAAI;AACF,YAAM,WAAW,IAAI,IAAI,KAAK,EAAE;AAChC,aAAO,aAAa,SAAS,aAAa;AAAA,IAC5C,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,EAAE,SAAS,iCAAiC;AAC9C;AAEK,MAAM,gDAAgD,EAAE,OAAO;AAAA,EACpE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,KAAK;AAAA,EACL,SAAS,EAA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1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Shared protocol schemas for the Final SDK-first websocket gateway platform.",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md",
|
|
10
|
+
"THIRD_PARTY_NOTICES.md"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"types": "./dist/modules/index.d.mts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/modules/index.d.mts",
|
|
18
|
+
"import": "./dist/modules/index.mjs",
|
|
19
|
+
"default": "./dist/modules/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "restricted",
|
|
25
|
+
"registry": "https://registry.npmjs.org/"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"zod": "4.6.5"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=26"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/final-company/packages-typescript.git",
|
|
36
|
+
"directory": "packages/@finalai/websocket-gateway-protocol"
|
|
37
|
+
}
|
|
38
|
+
}
|