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
package/dist/tsup/mod.cjs
CHANGED
|
@@ -10,27 +10,27 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
require('./chunk-
|
|
13
|
+
var _chunkWVUAO2F7cjs = require('./chunk-WVUAO2F7.cjs');
|
|
14
|
+
require('./chunk-2GJILCGQ.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
require('./chunk-
|
|
22
|
-
require('./chunk-
|
|
23
|
-
require('./chunk-
|
|
20
|
+
var _chunkHSO2H2SBcjs = require('./chunk-HSO2H2SB.cjs');
|
|
21
|
+
require('./chunk-LMZSOCYD.cjs');
|
|
22
|
+
require('./chunk-AR4S2QJ7.cjs');
|
|
23
|
+
require('./chunk-TI72NLP3.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
29
|
-
require('./chunk-
|
|
28
|
+
var _chunkB4QZKOMHcjs = require('./chunk-B4QZKOMH.cjs');
|
|
29
|
+
require('./chunk-HZ4ZM3FL.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkV6C34TVHcjs = require('./chunk-V6C34TVH.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
var _chunkKSRXX3Z4cjs = require('./chunk-KSRXX3Z4.cjs');
|
|
@@ -56,5 +56,5 @@ var _chunkKSRXX3Z4cjs = require('./chunk-KSRXX3Z4.cjs');
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
59
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkB4QZKOMHcjs.ALLOWED_PUBLIC_HEADERS; exports.InlineWebSocketAdapter2 = _chunkWVUAO2F7cjs.InlineWebSocketAdapter2; exports.PATH_CONNECT_WEBSOCKET = _chunkB4QZKOMHcjs.PATH_CONNECT_WEBSOCKET; exports.PATH_RAW_WEBSOCKET_PREFIX = _chunkB4QZKOMHcjs.PATH_RAW_WEBSOCKET_PREFIX; exports.Registry = _chunkWVUAO2F7cjs.Registry; exports.RegistryConfigSchema = _chunkWVUAO2F7cjs.RegistryConfigSchema; exports.UserError = _chunkKSRXX3Z4cjs.UserError; exports.actor = _chunkWVUAO2F7cjs.actor; exports.createActorRouter = _chunkWVUAO2F7cjs.createActorRouter; exports.createClientWithDriver = _chunkHSO2H2SBcjs.createClientWithDriver; exports.createEngineDriver = _chunkWVUAO2F7cjs.createEngineDriver; exports.createFileSystemDriver = _chunkWVUAO2F7cjs.createFileSystemDriver; exports.createMemoryDriver = _chunkWVUAO2F7cjs.createMemoryDriver; exports.generateConnId = _chunkHSO2H2SBcjs.generateConnId; exports.generateConnToken = _chunkHSO2H2SBcjs.generateConnToken; exports.handleRawWebSocketHandler = _chunkWVUAO2F7cjs.handleRawWebSocketHandler; exports.handleWebSocketConnect = _chunkWVUAO2F7cjs.handleWebSocketConnect; exports.lookupInRegistry = _chunkHSO2H2SBcjs.lookupInRegistry; exports.noopNext = _chunkV6C34TVHcjs.noopNext; exports.setup = _chunkWVUAO2F7cjs.setup; exports.toUint8Array = _chunkV6C34TVHcjs.toUint8Array;
|
|
60
60
|
//# sourceMappingURL=mod.cjs.map
|
package/dist/tsup/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as UniversalWebSocket, R as RivetEvent, a as RivetCloseEvent, b as RivetMessageEvent, A as ActorDriver, c as RunnerConfig, E as Encoding, d as AnyDatabaseProvider, e as Actions, f as ActorConfigInput, g as ActorDefinition, D as DriverConfig } from './conn-
|
|
2
|
-
export { n as ActionContext, r as ActionContextOf, z as ActorConfig, x as ActorConfigSchema, q as ActorContext, s as ActorContextOf, m as ActorKey, l as ActorQuery, w as ActorTypes, t as AnyActorDefinition, v as AnyActorInstance, j as AnyClient, y as AuthIntent, C as Client, o as Conn, p as ConnectionStatus, I as InitContext, O as OnConnectOptions, K as Registry, G as RegistryActors, F as RegistryConfig, J as RegistryConfigSchema, H as RunConfigInput, S as ServerlessActorDriverBuilder, k as createClientWithDriver, h as generateConnId, i as generateConnToken, u as lookupInRegistry, L as setup, B as test } from './conn-
|
|
1
|
+
import { U as UniversalWebSocket, R as RivetEvent, a as RivetCloseEvent, b as RivetMessageEvent, A as ActorDriver, c as RunnerConfig, E as Encoding, d as AnyDatabaseProvider, e as Actions, f as ActorConfigInput, g as ActorDefinition, D as DriverConfig } from './conn-BiazosE_.cjs';
|
|
2
|
+
export { n as ActionContext, r as ActionContextOf, z as ActorConfig, x as ActorConfigSchema, q as ActorContext, s as ActorContextOf, m as ActorKey, l as ActorQuery, w as ActorTypes, t as AnyActorDefinition, v as AnyActorInstance, j as AnyClient, y as AuthIntent, C as Client, o as Conn, p as ConnectionStatus, I as InitContext, O as OnConnectOptions, K as Registry, G as RegistryActors, F as RegistryConfig, J as RegistryConfigSchema, H as RunConfigInput, S as ServerlessActorDriverBuilder, k as createClientWithDriver, h as generateConnId, i as generateConnToken, u as lookupInRegistry, L as setup, B as test } from './conn-BiazosE_.cjs';
|
|
3
3
|
import { WSContext } from 'hono/ws';
|
|
4
4
|
export { n as noopNext } from './utils-fwx3o3K9.cjs';
|
|
5
5
|
export { toUint8Array } from './utils.cjs';
|
|
@@ -95,7 +95,7 @@ declare class InlineWebSocketAdapter2 implements UniversalWebSocket {
|
|
|
95
95
|
/**
|
|
96
96
|
* Creates a WebSocket connection handler
|
|
97
97
|
*/
|
|
98
|
-
declare function handleWebSocketConnect(req: Request | undefined, runConfig: RunnerConfig, actorDriver: ActorDriver, actorId: string, encoding: Encoding, parameters: unknown, connId
|
|
98
|
+
declare function handleWebSocketConnect(req: Request | undefined, runConfig: RunnerConfig, actorDriver: ActorDriver, actorId: string, encoding: Encoding, parameters: unknown, requestId: string, connId: string | undefined, connToken: string | undefined): Promise<UpgradeWebSocketArgs>;
|
|
99
99
|
declare function handleRawWebSocketHandler(req: Request | undefined, path: string, actorDriver: ActorDriver, actorId: string): Promise<UpgradeWebSocketArgs>;
|
|
100
100
|
|
|
101
101
|
interface ActorRouterBindings {
|
package/dist/tsup/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as UniversalWebSocket, R as RivetEvent, a as RivetCloseEvent, b as RivetMessageEvent, A as ActorDriver, c as RunnerConfig, E as Encoding, d as AnyDatabaseProvider, e as Actions, f as ActorConfigInput, g as ActorDefinition, D as DriverConfig } from './conn-
|
|
2
|
-
export { n as ActionContext, r as ActionContextOf, z as ActorConfig, x as ActorConfigSchema, q as ActorContext, s as ActorContextOf, m as ActorKey, l as ActorQuery, w as ActorTypes, t as AnyActorDefinition, v as AnyActorInstance, j as AnyClient, y as AuthIntent, C as Client, o as Conn, p as ConnectionStatus, I as InitContext, O as OnConnectOptions, K as Registry, G as RegistryActors, F as RegistryConfig, J as RegistryConfigSchema, H as RunConfigInput, S as ServerlessActorDriverBuilder, k as createClientWithDriver, h as generateConnId, i as generateConnToken, u as lookupInRegistry, L as setup, B as test } from './conn-
|
|
1
|
+
import { U as UniversalWebSocket, R as RivetEvent, a as RivetCloseEvent, b as RivetMessageEvent, A as ActorDriver, c as RunnerConfig, E as Encoding, d as AnyDatabaseProvider, e as Actions, f as ActorConfigInput, g as ActorDefinition, D as DriverConfig } from './conn-BYXlxnh0.js';
|
|
2
|
+
export { n as ActionContext, r as ActionContextOf, z as ActorConfig, x as ActorConfigSchema, q as ActorContext, s as ActorContextOf, m as ActorKey, l as ActorQuery, w as ActorTypes, t as AnyActorDefinition, v as AnyActorInstance, j as AnyClient, y as AuthIntent, C as Client, o as Conn, p as ConnectionStatus, I as InitContext, O as OnConnectOptions, K as Registry, G as RegistryActors, F as RegistryConfig, J as RegistryConfigSchema, H as RunConfigInput, S as ServerlessActorDriverBuilder, k as createClientWithDriver, h as generateConnId, i as generateConnToken, u as lookupInRegistry, L as setup, B as test } from './conn-BYXlxnh0.js';
|
|
3
3
|
import { WSContext } from 'hono/ws';
|
|
4
4
|
export { n as noopNext } from './utils-fwx3o3K9.js';
|
|
5
5
|
export { toUint8Array } from './utils.js';
|
|
@@ -95,7 +95,7 @@ declare class InlineWebSocketAdapter2 implements UniversalWebSocket {
|
|
|
95
95
|
/**
|
|
96
96
|
* Creates a WebSocket connection handler
|
|
97
97
|
*/
|
|
98
|
-
declare function handleWebSocketConnect(req: Request | undefined, runConfig: RunnerConfig, actorDriver: ActorDriver, actorId: string, encoding: Encoding, parameters: unknown, connId
|
|
98
|
+
declare function handleWebSocketConnect(req: Request | undefined, runConfig: RunnerConfig, actorDriver: ActorDriver, actorId: string, encoding: Encoding, parameters: unknown, requestId: string, connId: string | undefined, connToken: string | undefined): Promise<UpgradeWebSocketArgs>;
|
|
99
99
|
declare function handleRawWebSocketHandler(req: Request | undefined, path: string, actorDriver: ActorDriver, actorId: string): Promise<UpgradeWebSocketArgs>;
|
|
100
100
|
|
|
101
101
|
interface ActorRouterBindings {
|
package/dist/tsup/mod.js
CHANGED
|
@@ -10,27 +10,27 @@ import {
|
|
|
10
10
|
handleRawWebSocketHandler,
|
|
11
11
|
handleWebSocketConnect,
|
|
12
12
|
setup
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-UB4OHFDW.js";
|
|
14
|
+
import "./chunk-6YQKMAMV.js";
|
|
15
15
|
import {
|
|
16
16
|
createClientWithDriver,
|
|
17
17
|
generateConnId,
|
|
18
18
|
generateConnToken,
|
|
19
19
|
lookupInRegistry
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-3BJJSSTM.js";
|
|
21
|
+
import "./chunk-TQ4OAC2G.js";
|
|
22
|
+
import "./chunk-D7AA2DK5.js";
|
|
23
|
+
import "./chunk-EBSGEDD3.js";
|
|
24
24
|
import {
|
|
25
25
|
ALLOWED_PUBLIC_HEADERS,
|
|
26
26
|
PATH_CONNECT_WEBSOCKET,
|
|
27
27
|
PATH_RAW_WEBSOCKET_PREFIX
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-PBFLG45S.js";
|
|
29
|
+
import "./chunk-ST6FGRCH.js";
|
|
30
30
|
import {
|
|
31
31
|
noopNext,
|
|
32
32
|
toUint8Array
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-WWAZJHTS.js";
|
|
34
34
|
import {
|
|
35
35
|
UserError
|
|
36
36
|
} from "./chunk-G64QUEDJ.js";
|
package/dist/tsup/test/mod.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
11
|
-
require('../chunk-
|
|
12
|
-
require('../chunk-
|
|
13
|
-
require('../chunk-
|
|
4
|
+
var _chunk3LFMVAJVcjs = require('../chunk-3LFMVAJV.cjs');
|
|
5
|
+
require('../chunk-WVUAO2F7.cjs');
|
|
6
|
+
require('../chunk-2GJILCGQ.cjs');
|
|
7
|
+
require('../chunk-HSO2H2SB.cjs');
|
|
8
|
+
require('../chunk-LMZSOCYD.cjs');
|
|
9
|
+
require('../chunk-AR4S2QJ7.cjs');
|
|
10
|
+
require('../chunk-TI72NLP3.cjs');
|
|
11
|
+
require('../chunk-B4QZKOMH.cjs');
|
|
12
|
+
require('../chunk-HZ4ZM3FL.cjs');
|
|
13
|
+
require('../chunk-V6C34TVH.cjs');
|
|
14
14
|
require('../chunk-KSRXX3Z4.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.getPort =
|
|
18
|
+
exports.getPort = _chunk3LFMVAJVcjs.getPort; exports.setupTest = _chunk3LFMVAJVcjs.setupTest;
|
|
19
19
|
//# sourceMappingURL=mod.cjs.map
|
package/dist/tsup/test/mod.d.cts
CHANGED
package/dist/tsup/test/mod.d.ts
CHANGED
package/dist/tsup/test/mod.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getPort,
|
|
3
3
|
setupTest
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-2WVCZCJL.js";
|
|
5
|
+
import "../chunk-UB4OHFDW.js";
|
|
6
|
+
import "../chunk-6YQKMAMV.js";
|
|
7
|
+
import "../chunk-3BJJSSTM.js";
|
|
8
|
+
import "../chunk-TQ4OAC2G.js";
|
|
9
|
+
import "../chunk-D7AA2DK5.js";
|
|
10
|
+
import "../chunk-EBSGEDD3.js";
|
|
11
|
+
import "../chunk-PBFLG45S.js";
|
|
12
|
+
import "../chunk-ST6FGRCH.js";
|
|
13
|
+
import "../chunk-WWAZJHTS.js";
|
|
14
14
|
import "../chunk-G64QUEDJ.js";
|
|
15
15
|
export {
|
|
16
16
|
getPort,
|
package/dist/tsup/utils.cjs
CHANGED
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkV6C34TVHcjs = require('./chunk-V6C34TVH.cjs');
|
|
15
18
|
require('./chunk-KSRXX3Z4.cjs');
|
|
16
19
|
|
|
17
20
|
|
|
@@ -26,5 +29,8 @@ require('./chunk-KSRXX3Z4.cjs');
|
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
exports.EXTRA_ERROR_LOG = _chunkV6C34TVHcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkV6C34TVHcjs.SinglePromiseQueue; exports.VERSION = _chunkV6C34TVHcjs.VERSION; exports.arrayBuffersEqual = _chunkV6C34TVHcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkV6C34TVHcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkV6C34TVHcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkV6C34TVHcjs.combineUrlPath; exports.dbg = _chunkV6C34TVHcjs.dbg; exports.getEnvUniversal = _chunkV6C34TVHcjs.getEnvUniversal; exports.httpUserAgent = _chunkV6C34TVHcjs.httpUserAgent; exports.idToStr = _chunkV6C34TVHcjs.idToStr; exports.promiseWithResolvers = _chunkV6C34TVHcjs.promiseWithResolvers; exports.setLongTimeout = _chunkV6C34TVHcjs.setLongTimeout; exports.stringifyError = _chunkV6C34TVHcjs.stringifyError; exports.toUint8Array = _chunkV6C34TVHcjs.toUint8Array;
|
|
30
36
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/tsup/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/utils.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/utils.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,02BAAC","file":"/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/utils.cjs"}
|
package/dist/tsup/utils.d.cts
CHANGED
|
@@ -60,5 +60,12 @@ declare function bufferToArrayBuffer(buf: Buffer | Uint8Array): ArrayBuffer;
|
|
|
60
60
|
* @returns The properly combined URL string
|
|
61
61
|
*/
|
|
62
62
|
declare function combineUrlPath(endpoint: string, path: string, queryParams?: Record<string, string | undefined>): string;
|
|
63
|
+
declare function arrayBuffersEqual(buf1: ArrayBuffer, buf2: ArrayBuffer): boolean;
|
|
64
|
+
declare const EXTRA_ERROR_LOG: {
|
|
65
|
+
issues: string;
|
|
66
|
+
support: string;
|
|
67
|
+
version: string;
|
|
68
|
+
};
|
|
69
|
+
declare function idToStr(id: ArrayBuffer): string;
|
|
63
70
|
|
|
64
|
-
export { type GetUpgradeWebSocket, type LongTimeoutHandle, SinglePromiseQueue, type UpgradeWebSocket, VERSION, bufferToArrayBuffer, combineUrlPath, dbg, getEnvUniversal, httpUserAgent, promiseWithResolvers, setLongTimeout, toUint8Array };
|
|
71
|
+
export { EXTRA_ERROR_LOG, type GetUpgradeWebSocket, type LongTimeoutHandle, SinglePromiseQueue, type UpgradeWebSocket, VERSION, arrayBuffersEqual, bufferToArrayBuffer, combineUrlPath, dbg, getEnvUniversal, httpUserAgent, idToStr, promiseWithResolvers, setLongTimeout, toUint8Array };
|
package/dist/tsup/utils.d.ts
CHANGED
|
@@ -60,5 +60,12 @@ declare function bufferToArrayBuffer(buf: Buffer | Uint8Array): ArrayBuffer;
|
|
|
60
60
|
* @returns The properly combined URL string
|
|
61
61
|
*/
|
|
62
62
|
declare function combineUrlPath(endpoint: string, path: string, queryParams?: Record<string, string | undefined>): string;
|
|
63
|
+
declare function arrayBuffersEqual(buf1: ArrayBuffer, buf2: ArrayBuffer): boolean;
|
|
64
|
+
declare const EXTRA_ERROR_LOG: {
|
|
65
|
+
issues: string;
|
|
66
|
+
support: string;
|
|
67
|
+
version: string;
|
|
68
|
+
};
|
|
69
|
+
declare function idToStr(id: ArrayBuffer): string;
|
|
63
70
|
|
|
64
|
-
export { type GetUpgradeWebSocket, type LongTimeoutHandle, SinglePromiseQueue, type UpgradeWebSocket, VERSION, bufferToArrayBuffer, combineUrlPath, dbg, getEnvUniversal, httpUserAgent, promiseWithResolvers, setLongTimeout, toUint8Array };
|
|
71
|
+
export { EXTRA_ERROR_LOG, type GetUpgradeWebSocket, type LongTimeoutHandle, SinglePromiseQueue, type UpgradeWebSocket, VERSION, arrayBuffersEqual, bufferToArrayBuffer, combineUrlPath, dbg, getEnvUniversal, httpUserAgent, idToStr, promiseWithResolvers, setLongTimeout, toUint8Array };
|
package/dist/tsup/utils.js
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
+
EXTRA_ERROR_LOG,
|
|
2
3
|
SinglePromiseQueue,
|
|
3
4
|
VERSION,
|
|
5
|
+
arrayBuffersEqual,
|
|
4
6
|
assertUnreachable,
|
|
5
7
|
bufferToArrayBuffer,
|
|
6
8
|
combineUrlPath,
|
|
7
9
|
dbg,
|
|
8
10
|
getEnvUniversal,
|
|
9
11
|
httpUserAgent,
|
|
12
|
+
idToStr,
|
|
10
13
|
promiseWithResolvers,
|
|
11
14
|
setLongTimeout,
|
|
12
15
|
stringifyError,
|
|
13
16
|
toUint8Array
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WWAZJHTS.js";
|
|
15
18
|
import "./chunk-G64QUEDJ.js";
|
|
16
19
|
export {
|
|
20
|
+
EXTRA_ERROR_LOG,
|
|
17
21
|
SinglePromiseQueue,
|
|
18
22
|
VERSION,
|
|
23
|
+
arrayBuffersEqual,
|
|
19
24
|
assertUnreachable,
|
|
20
25
|
bufferToArrayBuffer,
|
|
21
26
|
combineUrlPath,
|
|
22
27
|
dbg,
|
|
23
28
|
getEnvUniversal,
|
|
24
29
|
httpUserAgent,
|
|
30
|
+
idToStr,
|
|
25
31
|
promiseWithResolvers,
|
|
26
32
|
setLongTimeout,
|
|
27
33
|
stringifyError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rivetkit",
|
|
3
|
-
"version": "2.0.22
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "Lightweight libraries for building stateful actors on edge platforms",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -160,11 +160,12 @@
|
|
|
160
160
|
"hono": "^4.7.0",
|
|
161
161
|
"invariant": "^2.2.4",
|
|
162
162
|
"nanoevents": "^9.1.0",
|
|
163
|
-
"on-change": "
|
|
163
|
+
"on-change": "npm:@rivetkit/on-change@^6.0.2-rc.1",
|
|
164
164
|
"p-retry": "^6.2.1",
|
|
165
165
|
"pino": "^9.5.0",
|
|
166
|
+
"uuid": "^12.0.0",
|
|
166
167
|
"zod": "^3.25.76",
|
|
167
|
-
"@rivetkit/engine-runner": "2.0.22
|
|
168
|
+
"@rivetkit/engine-runner": "2.0.22"
|
|
168
169
|
},
|
|
169
170
|
"devDependencies": {
|
|
170
171
|
"@bare-ts/tools": "^0.13.0",
|
|
@@ -206,7 +207,7 @@
|
|
|
206
207
|
"stableVersion": "0.8.0",
|
|
207
208
|
"scripts": {
|
|
208
209
|
"build": "tsup src/mod.ts src/client/mod.ts src/common/log.ts src/common/websocket.ts src/actor/errors.ts src/topologies/coordinate/mod.ts src/topologies/partition/mod.ts src/utils.ts src/driver-helpers/mod.ts src/driver-test-suite/mod.ts src/test/mod.ts src/inspector/mod.ts",
|
|
209
|
-
"build:schema": "./scripts/compile-bare.ts compile schemas/client-protocol/v1.bare -o dist/schemas/client-protocol/v1.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v1.bare -o dist/schemas/file-system-driver/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v1.bare -o dist/schemas/actor-persist/v1.ts",
|
|
210
|
+
"build:schema": "./scripts/compile-bare.ts compile schemas/client-protocol/v1.bare -o dist/schemas/client-protocol/v1.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v1.bare -o dist/schemas/file-system-driver/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v1.bare -o dist/schemas/actor-persist/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v2.bare -o dist/schemas/actor-persist/v2.ts",
|
|
210
211
|
"check-types": "tsc --noEmit",
|
|
211
212
|
"test": "vitest run",
|
|
212
213
|
"test:watch": "vitest",
|
package/src/actor/config.ts
CHANGED
|
@@ -70,6 +70,16 @@ export const ActorConfigSchema = z
|
|
|
70
70
|
connectionLivenessInterval: z.number().positive().default(5000),
|
|
71
71
|
noSleep: z.boolean().default(false),
|
|
72
72
|
sleepTimeout: z.number().positive().default(30_000),
|
|
73
|
+
/** @experimental */
|
|
74
|
+
canHibernatWebSocket: z
|
|
75
|
+
.union([
|
|
76
|
+
z.boolean(),
|
|
77
|
+
z
|
|
78
|
+
.function()
|
|
79
|
+
.args(z.custom<Request>())
|
|
80
|
+
.returns(z.boolean()),
|
|
81
|
+
])
|
|
82
|
+
.default(false),
|
|
73
83
|
})
|
|
74
84
|
.strict()
|
|
75
85
|
.default({}),
|
|
@@ -5,6 +5,7 @@ import type { AnyConn } from "@/actor/conn";
|
|
|
5
5
|
import type { AnyActorInstance } from "@/actor/instance";
|
|
6
6
|
import type { CachedSerializer, Encoding } from "@/actor/protocol/serde";
|
|
7
7
|
import { encodeDataToString } from "@/actor/protocol/serde";
|
|
8
|
+
import type { HonoWebSocketAdapter } from "@/manager/hono-websocket-adapter";
|
|
8
9
|
import type * as protocol from "@/schemas/client-protocol/mod";
|
|
9
10
|
import { assertUnreachable, type promiseWithResolvers } from "@/utils";
|
|
10
11
|
|
|
@@ -67,16 +68,34 @@ export interface ConnDriver<State> {
|
|
|
67
68
|
conn: AnyConn,
|
|
68
69
|
state: State,
|
|
69
70
|
): ConnReadyState | undefined;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* If the underlying connection can hibernate.
|
|
74
|
+
*/
|
|
75
|
+
isHibernatable(
|
|
76
|
+
actor: AnyActorInstance,
|
|
77
|
+
conn: AnyConn,
|
|
78
|
+
state: State,
|
|
79
|
+
): boolean;
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
// MARK: WebSocket
|
|
73
83
|
const WEBSOCKET_DRIVER: ConnDriver<ConnDriverWebSocketState> = {
|
|
74
84
|
sendMessage: (
|
|
75
85
|
actor: AnyActorInstance,
|
|
76
|
-
|
|
86
|
+
conn: AnyConn,
|
|
77
87
|
state: ConnDriverWebSocketState,
|
|
78
88
|
message: CachedSerializer<protocol.ToClient>,
|
|
79
89
|
) => {
|
|
90
|
+
if (state.websocket.readyState !== ConnReadyState.OPEN) {
|
|
91
|
+
actor.rLog.warn({
|
|
92
|
+
msg: "attempting to send message to closed websocket, this is likely a bug in RivetKit",
|
|
93
|
+
connId: conn.id,
|
|
94
|
+
wsReadyState: state.websocket.readyState,
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
80
99
|
const serialized = message.serialize(state.encoding);
|
|
81
100
|
|
|
82
101
|
actor.rLog.debug({
|
|
@@ -140,6 +159,22 @@ const WEBSOCKET_DRIVER: ConnDriver<ConnDriverWebSocketState> = {
|
|
|
140
159
|
): ConnReadyState | undefined => {
|
|
141
160
|
return state.websocket.readyState;
|
|
142
161
|
},
|
|
162
|
+
|
|
163
|
+
isHibernatable(
|
|
164
|
+
_actor: AnyActorInstance,
|
|
165
|
+
_conn: AnyConn,
|
|
166
|
+
state: ConnDriverWebSocketState,
|
|
167
|
+
): boolean {
|
|
168
|
+
// Extract isHibernatable from the HonoWebSocketAdapter
|
|
169
|
+
if (state.websocket.raw) {
|
|
170
|
+
const raw = state.websocket.raw as HonoWebSocketAdapter;
|
|
171
|
+
if (typeof raw.isHibernatable === "boolean") {
|
|
172
|
+
return raw.isHibernatable;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return false;
|
|
177
|
+
},
|
|
143
178
|
};
|
|
144
179
|
|
|
145
180
|
// MARK: SSE
|
|
@@ -175,6 +210,10 @@ const SSE_DRIVER: ConnDriver<ConnDriverSseState> = {
|
|
|
175
210
|
|
|
176
211
|
return ConnReadyState.OPEN;
|
|
177
212
|
},
|
|
213
|
+
|
|
214
|
+
isHibernatable(): boolean {
|
|
215
|
+
return false;
|
|
216
|
+
},
|
|
178
217
|
};
|
|
179
218
|
|
|
180
219
|
// MARK: HTTP
|
|
@@ -187,6 +226,9 @@ const HTTP_DRIVER: ConnDriver<ConnDriverHttpState> = {
|
|
|
187
226
|
// Noop
|
|
188
227
|
// TODO: Abort the request
|
|
189
228
|
},
|
|
229
|
+
isHibernatable(): boolean {
|
|
230
|
+
return false;
|
|
231
|
+
},
|
|
190
232
|
};
|
|
191
233
|
|
|
192
234
|
/** List of all connection drivers. */
|
package/src/actor/conn-socket.ts
CHANGED
package/src/actor/conn.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as cbor from "cbor-x";
|
|
2
2
|
import invariant from "invariant";
|
|
3
|
+
import { PersistedHibernatableWebSocket } from "@/schemas/actor-persist/mod";
|
|
3
4
|
import type * as protocol from "@/schemas/client-protocol/mod";
|
|
4
5
|
import { TO_CLIENT_VERSIONED } from "@/schemas/client-protocol/versioned";
|
|
5
6
|
import { bufferToArrayBuffer } from "@/utils";
|
|
@@ -26,7 +27,7 @@ export function generateConnToken(): string {
|
|
|
26
27
|
return generateSecureToken(32);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export function
|
|
30
|
+
export function generateConnRequestId(): string {
|
|
30
31
|
return crypto.randomUUID();
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -125,6 +126,25 @@ export class Conn<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
|
|
|
125
126
|
return this.__status;
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
/**
|
|
130
|
+
* @experimental
|
|
131
|
+
*
|
|
132
|
+
* If the underlying connection can hibernate.
|
|
133
|
+
*/
|
|
134
|
+
public get isHibernatable(): boolean {
|
|
135
|
+
if (this.__driverState) {
|
|
136
|
+
const driverKind = getConnDriverKindFromState(this.__driverState);
|
|
137
|
+
const driver = CONN_DRIVERS[driverKind];
|
|
138
|
+
return driver.isHibernatable(
|
|
139
|
+
this.#actor,
|
|
140
|
+
this,
|
|
141
|
+
(this.__driverState as any)[driverKind],
|
|
142
|
+
);
|
|
143
|
+
} else {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
128
148
|
/**
|
|
129
149
|
* Timestamp of the last time the connection was seen, i.e. the last time the connection was active and checked for liveness.
|
|
130
150
|
*/
|
|
@@ -238,7 +258,7 @@ export class Conn<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
|
|
|
238
258
|
});
|
|
239
259
|
}
|
|
240
260
|
|
|
241
|
-
this.#actor.__connDisconnected(this, true, this.__socket.
|
|
261
|
+
this.#actor.__connDisconnected(this, true, this.__socket.requestId);
|
|
242
262
|
} else {
|
|
243
263
|
this.#actor.rLog.warn({
|
|
244
264
|
msg: "missing connection driver state for disconnect",
|
package/src/actor/context.ts
CHANGED
package/src/actor/driver.ts
CHANGED
|
@@ -35,11 +35,22 @@ export interface ActorDriver {
|
|
|
35
35
|
*/
|
|
36
36
|
getDatabase(actorId: string): Promise<unknown | undefined>;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Requests the actor to go to sleep.
|
|
40
|
+
*
|
|
41
|
+
* This will call `_stop` independently.
|
|
42
|
+
*/
|
|
43
|
+
startSleep?(actorId: string): void;
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Shuts down the actor runner.
|
|
47
|
+
*/
|
|
48
|
+
shutdownRunner?(immediate: boolean): Promise<void>;
|
|
41
49
|
|
|
42
50
|
// Serverless
|
|
43
51
|
/** This handles the serverless start request. This should manage the lifecycle of the runner tied to the request lifecycle. */
|
|
44
52
|
serverlessHandleStart?(c: HonoContext): Promise<Response>;
|
|
53
|
+
|
|
54
|
+
/** Extra properties to add to logs for each actor. */
|
|
55
|
+
getExtraActorLogParams?(): Record<string, string>;
|
|
45
56
|
}
|