rivetkit 2.0.22-rc.1 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schemas/actor-persist/v2.ts +259 -0
- package/dist/tsup/{chunk-LCQDY73V.cjs → chunk-2GJILCGQ.cjs} +3 -3
- package/dist/tsup/{chunk-LCQDY73V.cjs.map → chunk-2GJILCGQ.cjs.map} +1 -1
- package/dist/tsup/{chunk-JN6GPVFY.js → chunk-2K2LR56Q.js} +3 -3
- package/dist/tsup/{chunk-EEXX243L.js → chunk-2WVCZCJL.js} +6 -6
- package/dist/tsup/{chunk-FETQGZN4.js → chunk-3BJJSSTM.js} +272 -89
- package/dist/tsup/chunk-3BJJSSTM.js.map +1 -0
- package/dist/tsup/{chunk-ZZYMCYAY.cjs → chunk-3LFMVAJV.cjs} +14 -14
- package/dist/tsup/{chunk-ZZYMCYAY.cjs.map → chunk-3LFMVAJV.cjs.map} +1 -1
- package/dist/tsup/{chunk-NDLOG2JH.js → chunk-6YQKMAMV.js} +2 -2
- package/dist/tsup/{chunk-C2U6KGOG.cjs → chunk-AR4S2QJ7.cjs} +3 -3
- package/dist/tsup/{chunk-C2U6KGOG.cjs.map → chunk-AR4S2QJ7.cjs.map} +1 -1
- package/dist/tsup/{chunk-PELXJCJS.cjs → chunk-B4QZKOMH.cjs} +8 -8
- package/dist/tsup/{chunk-PELXJCJS.cjs.map → chunk-B4QZKOMH.cjs.map} +1 -1
- package/dist/tsup/{chunk-5EB77IQ2.cjs → chunk-CYA35VI3.cjs} +6 -6
- package/dist/tsup/{chunk-5EB77IQ2.cjs.map → chunk-CYA35VI3.cjs.map} +1 -1
- package/dist/tsup/{chunk-UBCUW7HD.js → chunk-D7AA2DK5.js} +2 -2
- package/dist/tsup/{chunk-I7EJWHYV.js → chunk-EBSGEDD3.js} +51 -47
- package/dist/tsup/chunk-EBSGEDD3.js.map +1 -0
- package/dist/tsup/{chunk-R6XOZKMU.cjs → chunk-HSO2H2SB.cjs} +467 -284
- package/dist/tsup/chunk-HSO2H2SB.cjs.map +1 -0
- package/dist/tsup/{chunk-VJLGVVGP.cjs → chunk-HZ4ZM3FL.cjs} +31 -12
- package/dist/tsup/chunk-HZ4ZM3FL.cjs.map +1 -0
- package/dist/tsup/{chunk-7FEMVD3D.cjs → chunk-LMZSOCYD.cjs} +12 -12
- package/dist/tsup/{chunk-7FEMVD3D.cjs.map → chunk-LMZSOCYD.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZVEDMBFT.js → chunk-PBFLG45S.js} +3 -3
- package/dist/tsup/{chunk-GJPOIJHZ.js → chunk-ST6FGRCH.js} +26 -7
- package/dist/tsup/chunk-ST6FGRCH.js.map +1 -0
- package/dist/tsup/{chunk-BIOPK7IB.cjs → chunk-TI72NLP3.cjs} +71 -67
- package/dist/tsup/chunk-TI72NLP3.cjs.map +1 -0
- package/dist/tsup/{chunk-RPI45FGS.js → chunk-TQ4OAC2G.js} +2 -2
- package/dist/tsup/{chunk-4B25D5OW.js → chunk-UB4OHFDW.js} +385 -104
- package/dist/tsup/chunk-UB4OHFDW.js.map +1 -0
- package/dist/tsup/{chunk-6Z3YA6QR.cjs → chunk-V6C34TVH.cjs} +35 -15
- package/dist/tsup/chunk-V6C34TVH.cjs.map +1 -0
- package/dist/tsup/{chunk-OAB7ECAB.cjs → chunk-WVUAO2F7.cjs} +558 -277
- package/dist/tsup/chunk-WVUAO2F7.cjs.map +1 -0
- package/dist/tsup/{chunk-JKNDUKFI.js → chunk-WWAZJHTS.js} +36 -16
- package/dist/tsup/chunk-WWAZJHTS.js.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{conn-Clu655RU.d.ts → conn-BYXlxnh0.d.ts} +111 -102
- package/dist/tsup/{conn-lUvFLo_q.d.cts → conn-BiazosE_.d.cts} +111 -102
- package/dist/tsup/driver-helpers/mod.cjs +5 -5
- package/dist/tsup/driver-helpers/mod.d.cts +1 -1
- package/dist/tsup/driver-helpers/mod.d.ts +1 -1
- package/dist/tsup/driver-helpers/mod.js +4 -4
- package/dist/tsup/driver-test-suite/mod.cjs +71 -71
- package/dist/tsup/driver-test-suite/mod.d.cts +1 -1
- package/dist/tsup/driver-test-suite/mod.d.ts +1 -1
- package/dist/tsup/driver-test-suite/mod.js +11 -11
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.d.cts +2 -2
- package/dist/tsup/inspector/mod.d.ts +2 -2
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/mod.cjs +10 -10
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +9 -9
- package/dist/tsup/test/mod.cjs +11 -11
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +10 -10
- package/dist/tsup/utils.cjs +8 -2
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +8 -1
- package/dist/tsup/utils.d.ts +8 -1
- package/dist/tsup/utils.js +7 -1
- package/package.json +5 -4
- package/src/actor/config.ts +10 -0
- package/src/actor/conn-drivers.ts +43 -1
- package/src/actor/conn-socket.ts +1 -1
- package/src/actor/conn.ts +22 -2
- package/src/actor/context.ts +1 -1
- package/src/actor/driver.ts +13 -2
- package/src/actor/instance.ts +248 -57
- package/src/actor/persisted.ts +7 -0
- package/src/actor/router-endpoints.ts +67 -45
- package/src/actor/router.ts +25 -17
- package/src/client/actor-conn.ts +9 -5
- package/src/common/cors.ts +57 -0
- package/src/common/log.ts +26 -5
- package/src/common/utils.ts +5 -9
- package/src/common/websocket-interface.ts +10 -0
- package/src/driver-helpers/utils.ts +1 -0
- package/src/drivers/engine/actor-driver.ts +261 -14
- package/src/drivers/engine/config.ts +2 -4
- package/src/drivers/file-system/actor.ts +3 -2
- package/src/drivers/file-system/global-state.ts +1 -1
- package/src/drivers/file-system/manager.ts +3 -0
- package/src/engine-process/mod.ts +22 -4
- package/src/inspector/config.ts +0 -45
- package/src/manager/gateway.ts +45 -32
- package/src/manager/hono-websocket-adapter.ts +31 -3
- package/src/manager/router.ts +11 -17
- package/src/registry/run-config.ts +2 -8
- package/src/remote-manager-driver/actor-http-client.ts +5 -8
- package/src/remote-manager-driver/actor-websocket-client.ts +2 -14
- package/src/remote-manager-driver/mod.ts +0 -1
- package/src/schemas/actor-persist/mod.ts +1 -1
- package/src/schemas/actor-persist/versioned.ts +22 -10
- package/src/utils.ts +26 -0
- package/dist/tsup/chunk-4B25D5OW.js.map +0 -1
- package/dist/tsup/chunk-6Z3YA6QR.cjs.map +0 -1
- package/dist/tsup/chunk-BIOPK7IB.cjs.map +0 -1
- package/dist/tsup/chunk-FETQGZN4.js.map +0 -1
- package/dist/tsup/chunk-GJPOIJHZ.js.map +0 -1
- package/dist/tsup/chunk-I7EJWHYV.js.map +0 -1
- package/dist/tsup/chunk-JKNDUKFI.js.map +0 -1
- package/dist/tsup/chunk-OAB7ECAB.cjs.map +0 -1
- package/dist/tsup/chunk-R6XOZKMU.cjs.map +0 -1
- package/dist/tsup/chunk-VJLGVVGP.cjs.map +0 -1
- /package/dist/tsup/{chunk-JN6GPVFY.js.map → chunk-2K2LR56Q.js.map} +0 -0
- /package/dist/tsup/{chunk-EEXX243L.js.map → chunk-2WVCZCJL.js.map} +0 -0
- /package/dist/tsup/{chunk-NDLOG2JH.js.map → chunk-6YQKMAMV.js.map} +0 -0
- /package/dist/tsup/{chunk-UBCUW7HD.js.map → chunk-D7AA2DK5.js.map} +0 -0
- /package/dist/tsup/{chunk-ZVEDMBFT.js.map → chunk-PBFLG45S.js.map} +0 -0
- /package/dist/tsup/{chunk-RPI45FGS.js.map → chunk-TQ4OAC2G.js.map} +0 -0
|
@@ -3,7 +3,6 @@ import { WSContext } from 'hono/ws';
|
|
|
3
3
|
import { GetUpgradeWebSocket, promiseWithResolvers } from './utils.cjs';
|
|
4
4
|
import z$1, { z } from 'zod';
|
|
5
5
|
import { Logger } from 'pino';
|
|
6
|
-
import * as hono from 'hono';
|
|
7
6
|
import { Env, Context, Hono } from 'hono';
|
|
8
7
|
import * as nanoevents from 'nanoevents';
|
|
9
8
|
import z__default from 'zod/v4';
|
|
@@ -69,9 +68,19 @@ interface RivetEvent {
|
|
|
69
68
|
type: string;
|
|
70
69
|
target?: any;
|
|
71
70
|
currentTarget?: any;
|
|
71
|
+
/**
|
|
72
|
+
* @experimental
|
|
73
|
+
* Request ID for hibernatable websockets (provided by engine runner)
|
|
74
|
+
**/
|
|
75
|
+
rivetRequestId?: ArrayBuffer;
|
|
72
76
|
}
|
|
73
77
|
interface RivetMessageEvent extends RivetEvent {
|
|
74
78
|
data: any;
|
|
79
|
+
/**
|
|
80
|
+
* @experimental
|
|
81
|
+
* Message index for hibernatable websockets (provided by engine runner)
|
|
82
|
+
**/
|
|
83
|
+
rivetMessageIndex?: number;
|
|
75
84
|
}
|
|
76
85
|
interface RivetCloseEvent extends RivetEvent {
|
|
77
86
|
code: number;
|
|
@@ -169,21 +178,6 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
169
178
|
name: string;
|
|
170
179
|
manager: ManagerDriverBuilder;
|
|
171
180
|
}>>;
|
|
172
|
-
cors: z.ZodOptional<z.ZodType<{
|
|
173
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
174
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
175
|
-
allowHeaders?: string[];
|
|
176
|
-
maxAge?: number;
|
|
177
|
-
credentials?: boolean;
|
|
178
|
-
exposeHeaders?: string[];
|
|
179
|
-
}, z.ZodTypeDef, {
|
|
180
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
181
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
182
|
-
allowHeaders?: string[];
|
|
183
|
-
maxAge?: number;
|
|
184
|
-
credentials?: boolean;
|
|
185
|
-
exposeHeaders?: string[];
|
|
186
|
-
}>>;
|
|
187
181
|
maxIncomingMessageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
188
182
|
inspector: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
189
183
|
enabled: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
@@ -196,21 +190,6 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
196
190
|
actor?: boolean | undefined;
|
|
197
191
|
manager?: boolean | undefined;
|
|
198
192
|
}>]>>>;
|
|
199
|
-
cors: z.ZodDefault<z.ZodOptional<z.ZodType<{
|
|
200
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
201
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
202
|
-
allowHeaders?: string[];
|
|
203
|
-
maxAge?: number;
|
|
204
|
-
credentials?: boolean;
|
|
205
|
-
exposeHeaders?: string[];
|
|
206
|
-
}, z.ZodTypeDef, {
|
|
207
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
208
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
209
|
-
allowHeaders?: string[];
|
|
210
|
-
maxAge?: number;
|
|
211
|
-
credentials?: boolean;
|
|
212
|
-
exposeHeaders?: string[];
|
|
213
|
-
}>>>;
|
|
214
193
|
token: z.ZodDefault<z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodString>>>;
|
|
215
194
|
defaultEndpoint: z.ZodOptional<z.ZodString>;
|
|
216
195
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -219,14 +198,6 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
219
198
|
manager: boolean;
|
|
220
199
|
};
|
|
221
200
|
token: (...args: unknown[]) => string;
|
|
222
|
-
cors: {
|
|
223
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
224
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
225
|
-
allowHeaders?: string[];
|
|
226
|
-
maxAge?: number;
|
|
227
|
-
credentials?: boolean;
|
|
228
|
-
exposeHeaders?: string[];
|
|
229
|
-
};
|
|
230
201
|
defaultEndpoint?: string | undefined;
|
|
231
202
|
}, {
|
|
232
203
|
enabled?: boolean | {
|
|
@@ -234,14 +205,6 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
234
205
|
manager?: boolean | undefined;
|
|
235
206
|
} | undefined;
|
|
236
207
|
token?: ((...args: unknown[]) => string) | undefined;
|
|
237
|
-
cors?: {
|
|
238
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
239
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
240
|
-
allowHeaders?: string[];
|
|
241
|
-
maxAge?: number;
|
|
242
|
-
credentials?: boolean;
|
|
243
|
-
exposeHeaders?: string[];
|
|
244
|
-
} | undefined;
|
|
245
208
|
defaultEndpoint?: string | undefined;
|
|
246
209
|
}>>>;
|
|
247
210
|
disableDefaultServer: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -292,7 +255,7 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
292
255
|
slotsPerRunner?: number | undefined;
|
|
293
256
|
}>]>>;
|
|
294
257
|
} & {
|
|
295
|
-
runnerKey: z.
|
|
258
|
+
runnerKey: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
296
259
|
totalSlots: z.ZodDefault<z.ZodNumber>;
|
|
297
260
|
endpoint: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
298
261
|
token: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
@@ -316,17 +279,8 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
316
279
|
manager: boolean;
|
|
317
280
|
};
|
|
318
281
|
token: (...args: unknown[]) => string;
|
|
319
|
-
cors: {
|
|
320
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
321
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
322
|
-
allowHeaders?: string[];
|
|
323
|
-
maxAge?: number;
|
|
324
|
-
credentials?: boolean;
|
|
325
|
-
exposeHeaders?: string[];
|
|
326
|
-
};
|
|
327
282
|
defaultEndpoint?: string | undefined;
|
|
328
283
|
};
|
|
329
|
-
runnerKey: string;
|
|
330
284
|
totalSlots: number;
|
|
331
285
|
maxIncomingMessageSize: number;
|
|
332
286
|
disableDefaultServer: boolean;
|
|
@@ -349,14 +303,7 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
349
303
|
endpoint?: string | undefined;
|
|
350
304
|
token?: string | undefined;
|
|
351
305
|
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
352
|
-
|
|
353
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
354
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
355
|
-
allowHeaders?: string[];
|
|
356
|
-
maxAge?: number;
|
|
357
|
-
credentials?: boolean;
|
|
358
|
-
exposeHeaders?: string[];
|
|
359
|
-
} | undefined;
|
|
306
|
+
runnerKey?: string | undefined;
|
|
360
307
|
overrideServerAddress?: string | undefined;
|
|
361
308
|
autoConfigureServerless?: boolean | {
|
|
362
309
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -389,24 +336,8 @@ declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
389
336
|
manager?: boolean | undefined;
|
|
390
337
|
} | undefined;
|
|
391
338
|
token?: ((...args: unknown[]) => string) | undefined;
|
|
392
|
-
cors?: {
|
|
393
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
394
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
395
|
-
allowHeaders?: string[];
|
|
396
|
-
maxAge?: number;
|
|
397
|
-
credentials?: boolean;
|
|
398
|
-
exposeHeaders?: string[];
|
|
399
|
-
} | undefined;
|
|
400
339
|
defaultEndpoint?: string | undefined;
|
|
401
340
|
} | undefined;
|
|
402
|
-
cors?: {
|
|
403
|
-
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
404
|
-
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
405
|
-
allowHeaders?: string[];
|
|
406
|
-
maxAge?: number;
|
|
407
|
-
credentials?: boolean;
|
|
408
|
-
exposeHeaders?: string[];
|
|
409
|
-
} | undefined;
|
|
410
341
|
runnerKey?: string | undefined;
|
|
411
342
|
totalSlots?: number | undefined;
|
|
412
343
|
maxIncomingMessageSize?: number | undefined;
|
|
@@ -505,10 +436,20 @@ interface ActorDriver {
|
|
|
505
436
|
* This is an experimental API that may change in the future.
|
|
506
437
|
*/
|
|
507
438
|
getDatabase(actorId: string): Promise<unknown | undefined>;
|
|
508
|
-
|
|
509
|
-
|
|
439
|
+
/**
|
|
440
|
+
* Requests the actor to go to sleep.
|
|
441
|
+
*
|
|
442
|
+
* This will call `_stop` independently.
|
|
443
|
+
*/
|
|
444
|
+
startSleep?(actorId: string): void;
|
|
445
|
+
/**
|
|
446
|
+
* Shuts down the actor runner.
|
|
447
|
+
*/
|
|
448
|
+
shutdownRunner?(immediate: boolean): Promise<void>;
|
|
510
449
|
/** This handles the serverless start request. This should manage the lifecycle of the runner tied to the request lifecycle. */
|
|
511
450
|
serverlessHandleStart?(c: Context): Promise<Response>;
|
|
451
|
+
/** Extra properties to add to logs for each actor. */
|
|
452
|
+
getExtraActorLogParams?(): Record<string, string>;
|
|
512
453
|
}
|
|
513
454
|
|
|
514
455
|
type ServerlessActorDriverBuilder = (updateConfig: (config: RunnerConfig) => void) => ActorDriver;
|
|
@@ -1397,6 +1338,8 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1397
1338
|
connectionLivenessInterval: z.ZodDefault<z.ZodNumber>;
|
|
1398
1339
|
noSleep: z.ZodDefault<z.ZodBoolean>;
|
|
1399
1340
|
sleepTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1341
|
+
/** @experimental */
|
|
1342
|
+
canHibernatWebSocket: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodFunction<z.ZodTuple<[z.ZodType<Request, z.ZodTypeDef, Request>], z.ZodUnknown>, z.ZodBoolean>]>>;
|
|
1400
1343
|
}, "strict", z.ZodTypeAny, {
|
|
1401
1344
|
createVarsTimeout: number;
|
|
1402
1345
|
createConnStateTimeout: number;
|
|
@@ -1409,6 +1352,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1409
1352
|
connectionLivenessInterval: number;
|
|
1410
1353
|
noSleep: boolean;
|
|
1411
1354
|
sleepTimeout: number;
|
|
1355
|
+
canHibernatWebSocket: boolean | ((args_0: Request, ...args: unknown[]) => boolean);
|
|
1412
1356
|
}, {
|
|
1413
1357
|
createVarsTimeout?: number | undefined;
|
|
1414
1358
|
createConnStateTimeout?: number | undefined;
|
|
@@ -1421,6 +1365,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1421
1365
|
connectionLivenessInterval?: number | undefined;
|
|
1422
1366
|
noSleep?: boolean | undefined;
|
|
1423
1367
|
sleepTimeout?: number | undefined;
|
|
1368
|
+
canHibernatWebSocket?: boolean | ((args_0: Request, ...args: unknown[]) => boolean) | undefined;
|
|
1424
1369
|
}>>;
|
|
1425
1370
|
}, "strict", z.ZodTypeAny, {
|
|
1426
1371
|
options: {
|
|
@@ -1435,6 +1380,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1435
1380
|
connectionLivenessInterval: number;
|
|
1436
1381
|
noSleep: boolean;
|
|
1437
1382
|
sleepTimeout: number;
|
|
1383
|
+
canHibernatWebSocket: boolean | ((args_0: Request, ...args: unknown[]) => boolean);
|
|
1438
1384
|
};
|
|
1439
1385
|
actions: Record<string, (...args: unknown[]) => unknown>;
|
|
1440
1386
|
state?: any;
|
|
@@ -1468,6 +1414,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1468
1414
|
connectionLivenessInterval?: number | undefined;
|
|
1469
1415
|
noSleep?: boolean | undefined;
|
|
1470
1416
|
sleepTimeout?: number | undefined;
|
|
1417
|
+
canHibernatWebSocket?: boolean | ((args_0: Request, ...args: unknown[]) => boolean) | undefined;
|
|
1471
1418
|
} | undefined;
|
|
1472
1419
|
onCreate?: ((...args: unknown[]) => unknown) | undefined;
|
|
1473
1420
|
onStart?: ((...args: unknown[]) => unknown) | undefined;
|
|
@@ -1499,6 +1446,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1499
1446
|
connectionLivenessInterval: number;
|
|
1500
1447
|
noSleep: boolean;
|
|
1501
1448
|
sleepTimeout: number;
|
|
1449
|
+
canHibernatWebSocket: boolean | ((args_0: Request, ...args: unknown[]) => boolean);
|
|
1502
1450
|
};
|
|
1503
1451
|
actions: Record<string, (...args: unknown[]) => unknown>;
|
|
1504
1452
|
state?: any;
|
|
@@ -1532,6 +1480,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1532
1480
|
connectionLivenessInterval?: number | undefined;
|
|
1533
1481
|
noSleep?: boolean | undefined;
|
|
1534
1482
|
sleepTimeout?: number | undefined;
|
|
1483
|
+
canHibernatWebSocket?: boolean | ((args_0: Request, ...args: unknown[]) => boolean) | undefined;
|
|
1535
1484
|
} | undefined;
|
|
1536
1485
|
onCreate?: ((...args: unknown[]) => unknown) | undefined;
|
|
1537
1486
|
onStart?: ((...args: unknown[]) => unknown) | undefined;
|
|
@@ -1563,6 +1512,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1563
1512
|
connectionLivenessInterval: number;
|
|
1564
1513
|
noSleep: boolean;
|
|
1565
1514
|
sleepTimeout: number;
|
|
1515
|
+
canHibernatWebSocket: boolean | ((args_0: Request, ...args: unknown[]) => boolean);
|
|
1566
1516
|
};
|
|
1567
1517
|
actions: Record<string, (...args: unknown[]) => unknown>;
|
|
1568
1518
|
state?: any;
|
|
@@ -1596,6 +1546,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1596
1546
|
connectionLivenessInterval?: number | undefined;
|
|
1597
1547
|
noSleep?: boolean | undefined;
|
|
1598
1548
|
sleepTimeout?: number | undefined;
|
|
1549
|
+
canHibernatWebSocket?: boolean | ((args_0: Request, ...args: unknown[]) => boolean) | undefined;
|
|
1599
1550
|
} | undefined;
|
|
1600
1551
|
onCreate?: ((...args: unknown[]) => unknown) | undefined;
|
|
1601
1552
|
onStart?: ((...args: unknown[]) => unknown) | undefined;
|
|
@@ -1627,6 +1578,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1627
1578
|
connectionLivenessInterval: number;
|
|
1628
1579
|
noSleep: boolean;
|
|
1629
1580
|
sleepTimeout: number;
|
|
1581
|
+
canHibernatWebSocket: boolean | ((args_0: Request, ...args: unknown[]) => boolean);
|
|
1630
1582
|
};
|
|
1631
1583
|
actions: Record<string, (...args: unknown[]) => unknown>;
|
|
1632
1584
|
state?: any;
|
|
@@ -1660,6 +1612,7 @@ declare const ActorConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
1660
1612
|
connectionLivenessInterval?: number | undefined;
|
|
1661
1613
|
noSleep?: boolean | undefined;
|
|
1662
1614
|
sleepTimeout?: number | undefined;
|
|
1615
|
+
canHibernatWebSocket?: boolean | ((args_0: Request, ...args: unknown[]) => boolean) | undefined;
|
|
1663
1616
|
} | undefined;
|
|
1664
1617
|
onCreate?: ((...args: unknown[]) => unknown) | undefined;
|
|
1665
1618
|
onStart?: ((...args: unknown[]) => unknown) | undefined;
|
|
@@ -2105,10 +2058,51 @@ declare class ActorInspector {
|
|
|
2105
2058
|
}
|
|
2106
2059
|
|
|
2107
2060
|
interface ConnSocket {
|
|
2108
|
-
|
|
2061
|
+
requestId: string;
|
|
2109
2062
|
driverState: ConnDriverState;
|
|
2110
2063
|
}
|
|
2111
2064
|
|
|
2065
|
+
/** State object that gets automatically persisted to storage. */
|
|
2066
|
+
interface PersistedActor<S, CP, CS, I> {
|
|
2067
|
+
input?: I;
|
|
2068
|
+
hasInitiated: boolean;
|
|
2069
|
+
state: S;
|
|
2070
|
+
connections: PersistedConn<CP, CS>[];
|
|
2071
|
+
scheduledEvents: PersistedScheduleEvent[];
|
|
2072
|
+
hibernatableWebSocket: PersistedHibernatableWebSocket[];
|
|
2073
|
+
}
|
|
2074
|
+
/** Object representing connection that gets persisted to storage. */
|
|
2075
|
+
interface PersistedConn<CP, CS> {
|
|
2076
|
+
connId: string;
|
|
2077
|
+
token: string;
|
|
2078
|
+
params: CP;
|
|
2079
|
+
state: CS;
|
|
2080
|
+
subscriptions: PersistedSubscription[];
|
|
2081
|
+
/** Last time the socket was seen. This is set when disconencted so we can determine when we need to clean this up. */
|
|
2082
|
+
lastSeen: number;
|
|
2083
|
+
}
|
|
2084
|
+
interface PersistedSubscription {
|
|
2085
|
+
eventName: string;
|
|
2086
|
+
}
|
|
2087
|
+
interface GenericPersistedScheduleEvent {
|
|
2088
|
+
actionName: string;
|
|
2089
|
+
args: ArrayBuffer | null;
|
|
2090
|
+
}
|
|
2091
|
+
type PersistedScheduleEventKind = {
|
|
2092
|
+
generic: GenericPersistedScheduleEvent;
|
|
2093
|
+
};
|
|
2094
|
+
interface PersistedScheduleEvent {
|
|
2095
|
+
eventId: string;
|
|
2096
|
+
timestamp: number;
|
|
2097
|
+
kind: PersistedScheduleEventKind;
|
|
2098
|
+
}
|
|
2099
|
+
interface PersistedHibernatableWebSocket {
|
|
2100
|
+
requestId: ArrayBuffer;
|
|
2101
|
+
lastSeenTimestamp: bigint;
|
|
2102
|
+
msgIndex: bigint;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
declare const PERSIST_SYMBOL: unique symbol;
|
|
2112
2106
|
/**
|
|
2113
2107
|
* Options for the `_saveState` method.
|
|
2114
2108
|
*/
|
|
@@ -2126,6 +2120,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
|
|
|
2126
2120
|
#private;
|
|
2127
2121
|
actorContext: ActorContext<S, CP, CS, V, I, DB>;
|
|
2128
2122
|
get isStopping(): boolean;
|
|
2123
|
+
get [PERSIST_SYMBOL](): PersistedActor<S, CP, CS, I>;
|
|
2129
2124
|
get id(): string;
|
|
2130
2125
|
get inlineClient(): Client<Registry<any>>;
|
|
2131
2126
|
get inspector(): ActorInspector;
|
|
@@ -2156,7 +2151,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
|
|
|
2156
2151
|
*
|
|
2157
2152
|
* If not a clean disconnect, will keep the connection alive for a given interval to wait for reconnect.
|
|
2158
2153
|
*/
|
|
2159
|
-
__connDisconnected(conn: Conn<S, CP, CS, V, I, DB>, wasClean: boolean,
|
|
2154
|
+
__connDisconnected(conn: Conn<S, CP, CS, V, I, DB>, wasClean: boolean, requestId: string): void;
|
|
2160
2155
|
/**
|
|
2161
2156
|
* Called to create a new connection or reconnect an existing one.
|
|
2162
2157
|
*/
|
|
@@ -2245,9 +2240,31 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
|
|
|
2245
2240
|
* @param opts - Options for saving the state.
|
|
2246
2241
|
*/
|
|
2247
2242
|
saveState(opts: SaveStateOptions): Promise<void>;
|
|
2248
|
-
/**
|
|
2249
|
-
|
|
2250
|
-
|
|
2243
|
+
/**
|
|
2244
|
+
* Called by router middleware when an HTTP request begins.
|
|
2245
|
+
*/
|
|
2246
|
+
__beginHonoHttpRequest(): void;
|
|
2247
|
+
/**
|
|
2248
|
+
* Called by router middleware when an HTTP request ends.
|
|
2249
|
+
*/
|
|
2250
|
+
__endHonoHttpRequest(): void;
|
|
2251
|
+
/**
|
|
2252
|
+
* Puts an actor to sleep. This should just start the sleep sequence, most shutdown logic should be in _stop (which is called by the ActorDriver when sleeping).
|
|
2253
|
+
*
|
|
2254
|
+
* For the engine, this will:
|
|
2255
|
+
* 1. Publish EventActorIntent with ActorIntentSleep (via driver.startSleep)
|
|
2256
|
+
* 2. Engine runner will wait for CommandStopActor
|
|
2257
|
+
* 3. Engine runner will call _onStop and wait for it to finish
|
|
2258
|
+
* 4. Engine runner will publish EventActorStateUpdate with ActorStateSTop
|
|
2259
|
+
**/
|
|
2260
|
+
_startSleep(): void;
|
|
2261
|
+
/**
|
|
2262
|
+
* For the engine:
|
|
2263
|
+
* 1. Engine runner receives CommandStopActor
|
|
2264
|
+
* 2. Engine runner calls _onStop and waits for it to finish
|
|
2265
|
+
* 3. Engine runner publishes EventActorStateUpdate with ActorStateSTop
|
|
2266
|
+
*/
|
|
2267
|
+
_onStop(): Promise<void>;
|
|
2251
2268
|
/** Abort signal that fires when the actor is stopping. */
|
|
2252
2269
|
get abortSignal(): AbortSignal;
|
|
2253
2270
|
}
|
|
@@ -2275,20 +2292,6 @@ type ConnDriverState = {
|
|
|
2275
2292
|
[ConnDriverKind.HTTP]: ConnDriverHttpState;
|
|
2276
2293
|
};
|
|
2277
2294
|
|
|
2278
|
-
/** Object representing connection that gets persisted to storage. */
|
|
2279
|
-
interface PersistedConn<CP, CS> {
|
|
2280
|
-
connId: string;
|
|
2281
|
-
token: string;
|
|
2282
|
-
params: CP;
|
|
2283
|
-
state: CS;
|
|
2284
|
-
subscriptions: PersistedSubscription[];
|
|
2285
|
-
/** Last time the socket was seen. This is set when disconencted so we can determine when we need to clean this up. */
|
|
2286
|
-
lastSeen: number;
|
|
2287
|
-
}
|
|
2288
|
-
interface PersistedSubscription {
|
|
2289
|
-
eventName: string;
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
2295
|
declare function generateConnId(): string;
|
|
2293
2296
|
declare function generateConnToken(): string;
|
|
2294
2297
|
type ConnId = string;
|
|
@@ -2343,6 +2346,12 @@ declare class Conn<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
|
|
|
2343
2346
|
* Status of the connection.
|
|
2344
2347
|
*/
|
|
2345
2348
|
get status(): ConnectionStatus;
|
|
2349
|
+
/**
|
|
2350
|
+
* @experimental
|
|
2351
|
+
*
|
|
2352
|
+
* If the underlying connection can hibernate.
|
|
2353
|
+
*/
|
|
2354
|
+
get isHibernatable(): boolean;
|
|
2346
2355
|
/**
|
|
2347
2356
|
* Timestamp of the last time the connection was seen, i.e. the last time the connection was active and checked for liveness.
|
|
2348
2357
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkTI72NLP3cjs = require('../chunk-TI72NLP3.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -25,9 +25,9 @@ var _chunkBIOPK7IBcjs = require('../chunk-BIOPK7IB.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
29
|
-
require('../chunk-
|
|
30
|
-
require('../chunk-
|
|
28
|
+
var _chunkB4QZKOMHcjs = require('../chunk-B4QZKOMH.cjs');
|
|
29
|
+
require('../chunk-HZ4ZM3FL.cjs');
|
|
30
|
+
require('../chunk-V6C34TVH.cjs');
|
|
31
31
|
require('../chunk-KSRXX3Z4.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
@@ -54,5 +54,5 @@ require('../chunk-KSRXX3Z4.cjs');
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
57
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkB4QZKOMHcjs.ALLOWED_PUBLIC_HEADERS; exports.DriverConfigSchema = _chunkTI72NLP3cjs.DriverConfigSchema; exports.HEADER_ACTOR_ID = _chunkB4QZKOMHcjs.HEADER_ACTOR_ID; exports.HEADER_ACTOR_QUERY = _chunkB4QZKOMHcjs.HEADER_ACTOR_QUERY; exports.HEADER_CONN_ID = _chunkB4QZKOMHcjs.HEADER_CONN_ID; exports.HEADER_CONN_PARAMS = _chunkB4QZKOMHcjs.HEADER_CONN_PARAMS; exports.HEADER_CONN_TOKEN = _chunkB4QZKOMHcjs.HEADER_CONN_TOKEN; exports.HEADER_ENCODING = _chunkB4QZKOMHcjs.HEADER_ENCODING; exports.HEADER_RIVET_ACTOR = _chunkB4QZKOMHcjs.HEADER_RIVET_ACTOR; exports.HEADER_RIVET_TARGET = _chunkB4QZKOMHcjs.HEADER_RIVET_TARGET; exports.PATH_CONNECT_WEBSOCKET = _chunkB4QZKOMHcjs.PATH_CONNECT_WEBSOCKET; exports.PATH_RAW_WEBSOCKET_PREFIX = _chunkB4QZKOMHcjs.PATH_RAW_WEBSOCKET_PREFIX; exports.RunConfigSchema = _chunkTI72NLP3cjs.RunnerConfigSchema; exports.WS_PROTOCOL_ACTOR = _chunkB4QZKOMHcjs.WS_PROTOCOL_ACTOR; exports.WS_PROTOCOL_CONN_ID = _chunkB4QZKOMHcjs.WS_PROTOCOL_CONN_ID; exports.WS_PROTOCOL_CONN_PARAMS = _chunkB4QZKOMHcjs.WS_PROTOCOL_CONN_PARAMS; exports.WS_PROTOCOL_CONN_TOKEN = _chunkB4QZKOMHcjs.WS_PROTOCOL_CONN_TOKEN; exports.WS_PROTOCOL_ENCODING = _chunkB4QZKOMHcjs.WS_PROTOCOL_ENCODING; exports.WS_PROTOCOL_PATH = _chunkB4QZKOMHcjs.WS_PROTOCOL_PATH; exports.WS_PROTOCOL_STANDARD = _chunkB4QZKOMHcjs.WS_PROTOCOL_STANDARD; exports.WS_PROTOCOL_TARGET = _chunkB4QZKOMHcjs.WS_PROTOCOL_TARGET; exports.WS_PROTOCOL_TRANSPORT = _chunkB4QZKOMHcjs.WS_PROTOCOL_TRANSPORT; exports.generateRandomString = _chunkB4QZKOMHcjs.generateRandomString; exports.serializeEmptyPersistData = _chunkTI72NLP3cjs.serializeEmptyPersistData;
|
|
58
58
|
//# sourceMappingURL=mod.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ActorDriver, ab as ActorInstance, ac as ActorOutput, v as AnyActorInstance, ad as CreateInput, aj as DriverConfigSchema, ae as GetForIdInput, af as GetOrCreateWithKeyInput, ag as GetWithKeyInput, ah as ManagerDisplayInformation, ai as ManagerDriver, ak as RunConfigSchema } from '../conn-
|
|
1
|
+
export { A as ActorDriver, ab as ActorInstance, ac as ActorOutput, v as AnyActorInstance, ad as CreateInput, aj as DriverConfigSchema, ae as GetForIdInput, af as GetOrCreateWithKeyInput, ag as GetWithKeyInput, ah as ManagerDisplayInformation, ai as ManagerDriver, ak as RunConfigSchema } from '../conn-BiazosE_.cjs';
|
|
2
2
|
export { A as ALLOWED_PUBLIC_HEADERS, H as HEADER_ACTOR_ID, b as HEADER_ACTOR_QUERY, c as HEADER_CONN_ID, d as HEADER_CONN_PARAMS, e as HEADER_CONN_TOKEN, f as HEADER_ENCODING, g as HEADER_RIVET_ACTOR, h as HEADER_RIVET_TARGET, P as PATH_CONNECT_WEBSOCKET, a as PATH_RAW_WEBSOCKET_PREFIX, W as WS_PROTOCOL_ACTOR, i as WS_PROTOCOL_CONN_ID, j as WS_PROTOCOL_CONN_PARAMS, k as WS_PROTOCOL_CONN_TOKEN, l as WS_PROTOCOL_ENCODING, m as WS_PROTOCOL_PATH, n as WS_PROTOCOL_STANDARD, o as WS_PROTOCOL_TARGET, p as WS_PROTOCOL_TRANSPORT } from '../actor-router-consts-B3Lu87yJ.cjs';
|
|
3
3
|
import 'hono/streaming';
|
|
4
4
|
import 'hono/ws';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ActorDriver, ab as ActorInstance, ac as ActorOutput, v as AnyActorInstance, ad as CreateInput, aj as DriverConfigSchema, ae as GetForIdInput, af as GetOrCreateWithKeyInput, ag as GetWithKeyInput, ah as ManagerDisplayInformation, ai as ManagerDriver, ak as RunConfigSchema } from '../conn-
|
|
1
|
+
export { A as ActorDriver, ab as ActorInstance, ac as ActorOutput, v as AnyActorInstance, ad as CreateInput, aj as DriverConfigSchema, ae as GetForIdInput, af as GetOrCreateWithKeyInput, ag as GetWithKeyInput, ah as ManagerDisplayInformation, ai as ManagerDriver, ak as RunConfigSchema } from '../conn-BYXlxnh0.js';
|
|
2
2
|
export { A as ALLOWED_PUBLIC_HEADERS, H as HEADER_ACTOR_ID, b as HEADER_ACTOR_QUERY, c as HEADER_CONN_ID, d as HEADER_CONN_PARAMS, e as HEADER_CONN_TOKEN, f as HEADER_ENCODING, g as HEADER_RIVET_ACTOR, h as HEADER_RIVET_TARGET, P as PATH_CONNECT_WEBSOCKET, a as PATH_RAW_WEBSOCKET_PREFIX, W as WS_PROTOCOL_ACTOR, i as WS_PROTOCOL_CONN_ID, j as WS_PROTOCOL_CONN_PARAMS, k as WS_PROTOCOL_CONN_TOKEN, l as WS_PROTOCOL_ENCODING, m as WS_PROTOCOL_PATH, n as WS_PROTOCOL_STANDARD, o as WS_PROTOCOL_TARGET, p as WS_PROTOCOL_TRANSPORT } from '../actor-router-consts-B3Lu87yJ.js';
|
|
3
3
|
import 'hono/streaming';
|
|
4
4
|
import 'hono/ws';
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
DriverConfigSchema,
|
|
3
3
|
RunnerConfigSchema,
|
|
4
4
|
serializeEmptyPersistData
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-EBSGEDD3.js";
|
|
6
6
|
import {
|
|
7
7
|
ALLOWED_PUBLIC_HEADERS,
|
|
8
8
|
HEADER_ACTOR_ID,
|
|
@@ -25,9 +25,9 @@ import {
|
|
|
25
25
|
WS_PROTOCOL_TARGET,
|
|
26
26
|
WS_PROTOCOL_TRANSPORT,
|
|
27
27
|
generateRandomString
|
|
28
|
-
} from "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
28
|
+
} from "../chunk-PBFLG45S.js";
|
|
29
|
+
import "../chunk-ST6FGRCH.js";
|
|
30
|
+
import "../chunk-WWAZJHTS.js";
|
|
31
31
|
import "../chunk-G64QUEDJ.js";
|
|
32
32
|
export {
|
|
33
33
|
ALLOWED_PUBLIC_HEADERS,
|