rivetkit 2.0.37 → 2.0.38
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/tsup/{chunk-XI335ZED.js → chunk-4U45T5KW.js} +6 -4
- package/dist/tsup/chunk-4U45T5KW.js.map +1 -0
- package/dist/tsup/{chunk-G4N7FZMM.cjs → chunk-6WLJW57U.cjs} +149 -93
- package/dist/tsup/chunk-6WLJW57U.cjs.map +1 -0
- package/dist/tsup/{chunk-ZQBSQ6H3.js → chunk-EEL32AJM.js} +140 -89
- package/dist/tsup/chunk-EEL32AJM.js.map +1 -0
- package/dist/tsup/{chunk-J6TX5EFW.js → chunk-FA6FGAEC.js} +62 -6
- package/dist/tsup/chunk-FA6FGAEC.js.map +1 -0
- package/dist/tsup/{chunk-22NKW7F5.cjs → chunk-FZQHTGQX.cjs} +9 -9
- package/dist/tsup/{chunk-22NKW7F5.cjs.map → chunk-FZQHTGQX.cjs.map} +1 -1
- package/dist/tsup/{chunk-4V7MS7SO.cjs → chunk-GFKZZG2A.cjs} +3 -3
- package/dist/tsup/{chunk-4V7MS7SO.cjs.map → chunk-GFKZZG2A.cjs.map} +1 -1
- package/dist/tsup/{chunk-LYYTV7DN.cjs → chunk-IRTVRBJA.cjs} +46 -46
- package/dist/tsup/{chunk-LYYTV7DN.cjs.map → chunk-IRTVRBJA.cjs.map} +1 -1
- package/dist/tsup/{chunk-B6BP74X3.cjs → chunk-IWXMFQDT.cjs} +113 -74
- package/dist/tsup/chunk-IWXMFQDT.cjs.map +1 -0
- package/dist/tsup/{chunk-RBA5AQTB.js → chunk-K2RNF2ZR.js} +5 -5
- package/dist/tsup/{chunk-5VVIFC6M.cjs → chunk-LULP6HM2.cjs} +381 -330
- package/dist/tsup/chunk-LULP6HM2.cjs.map +1 -0
- package/dist/tsup/{chunk-5XGZXH74.js → chunk-MIOU6BF3.js} +57 -18
- package/dist/tsup/chunk-MIOU6BF3.js.map +1 -0
- package/dist/tsup/{chunk-X5IX3YPO.cjs → chunk-O433HWWG.cjs} +6 -4
- package/dist/tsup/chunk-O433HWWG.cjs.map +1 -0
- package/dist/tsup/{chunk-FIUSIG6J.js → chunk-UUEZVDRL.js} +4 -4
- package/dist/tsup/{chunk-RXA3ZMCL.js → chunk-WIZ4JGP6.js} +2 -2
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-CRuzI6n4.d.ts → config-CbIHPGKl.d.ts} +167 -56
- package/dist/tsup/{config--NjwiYlS.d.cts → config-CwJCQyP1.d.cts} +167 -56
- package/dist/tsup/{driver-BcmckRaF.d.ts → driver-CMN823Lc.d.ts} +1 -1
- package/dist/tsup/{driver-yKjYx9Yy.d.cts → driver-Lw_oORox.d.cts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +3 -3
- package/dist/tsup/driver-helpers/mod.d.cts +2 -2
- package/dist/tsup/driver-helpers/mod.d.ts +2 -2
- package/dist/tsup/driver-helpers/mod.js +2 -2
- package/dist/tsup/driver-test-suite/mod.cjs +34 -34
- package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
- package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
- package/dist/tsup/driver-test-suite/mod.js +7 -7
- package/dist/tsup/mod.cjs +17 -7
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +4 -4
- package/dist/tsup/mod.d.ts +4 -4
- package/dist/tsup/mod.js +16 -6
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/package.json +6 -4
- package/src/actor/config.ts +47 -0
- package/src/client/actor-conn.ts +70 -81
- package/src/client/actor-handle.ts +22 -12
- package/src/client/actor-query.ts +47 -0
- package/src/client/errors.ts +22 -58
- package/src/client/utils.ts +33 -0
- package/src/manager/driver.ts +1 -3
- package/src/manager-api/actors.ts +1 -20
- package/src/registry/config/index.ts +68 -0
- package/src/remote-manager-driver/mod.ts +11 -1
- package/src/serverless/router.test.ts +166 -0
- package/src/serverless/router.ts +58 -5
- package/src/utils/env-vars.ts +4 -1
- package/dist/tsup/chunk-5VVIFC6M.cjs.map +0 -1
- package/dist/tsup/chunk-5XGZXH74.js.map +0 -1
- package/dist/tsup/chunk-B6BP74X3.cjs.map +0 -1
- package/dist/tsup/chunk-G4N7FZMM.cjs.map +0 -1
- package/dist/tsup/chunk-J6TX5EFW.js.map +0 -1
- package/dist/tsup/chunk-X5IX3YPO.cjs.map +0 -1
- package/dist/tsup/chunk-XI335ZED.js.map +0 -1
- package/dist/tsup/chunk-ZQBSQ6H3.js.map +0 -1
- /package/dist/tsup/{chunk-RBA5AQTB.js.map → chunk-K2RNF2ZR.js.map} +0 -0
- /package/dist/tsup/{chunk-FIUSIG6J.js.map → chunk-UUEZVDRL.js.map} +0 -0
- /package/dist/tsup/{chunk-RXA3ZMCL.js.map → chunk-WIZ4JGP6.js.map} +0 -0
package/dist/tsup/mod.cjs
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk6WLJW57Ucjs = require('./chunk-6WLJW57U.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkIRTVRBJAcjs = require('./chunk-IRTVRBJA.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
require('./chunk-
|
|
16
|
+
var _chunkLULP6HM2cjs = require('./chunk-LULP6HM2.cjs');
|
|
17
|
+
require('./chunk-GFKZZG2A.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -26,12 +26,17 @@ require('./chunk-4V7MS7SO.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkIWXMFQDTcjs = require('./chunk-IWXMFQDT.cjs');
|
|
30
35
|
require('./chunk-KDFWJKMJ.cjs');
|
|
31
36
|
|
|
32
37
|
|
|
33
38
|
|
|
34
|
-
var
|
|
39
|
+
var _chunkO433HWWGcjs = require('./chunk-O433HWWG.cjs');
|
|
35
40
|
|
|
36
41
|
|
|
37
42
|
var _chunkSNAUKDDKcjs = require('./chunk-SNAUKDDK.cjs');
|
|
@@ -60,5 +65,10 @@ require('./chunk-GBENOENJ.cjs');
|
|
|
60
65
|
|
|
61
66
|
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkIWXMFQDTcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorsSchema = _chunkIWXMFQDTcjs.ActorsSchema; exports.DocConfigureRunnerPoolSchema = _chunkIWXMFQDTcjs.DocConfigureRunnerPoolSchema; exports.DocInspectorConfigSchema = _chunkIWXMFQDTcjs.DocInspectorConfigSchema; exports.DocRegistryConfigSchema = _chunkIWXMFQDTcjs.DocRegistryConfigSchema; exports.DocRunnerConfigSchema = _chunkIWXMFQDTcjs.DocRunnerConfigSchema; exports.DocServerlessConfigSchema = _chunkIWXMFQDTcjs.DocServerlessConfigSchema; exports.DriverConfigSchema = _chunkIWXMFQDTcjs.DriverConfigSchema; exports.InlineWebSocketAdapter = _chunkIRTVRBJAcjs.InlineWebSocketAdapter; exports.KV_KEYS = _chunkIWXMFQDTcjs.KEYS; exports.PATH_CONNECT = _chunkIWXMFQDTcjs.PATH_CONNECT; exports.PATH_WEBSOCKET_PREFIX = _chunkIWXMFQDTcjs.PATH_WEBSOCKET_PREFIX; exports.Registry = _chunk6WLJW57Ucjs.Registry; exports.RegistryConfigSchema = _chunkIWXMFQDTcjs.RegistryConfigSchema; exports.TestConfigSchema = _chunkIWXMFQDTcjs.TestConfigSchema; exports.UserError = _chunkSNAUKDDKcjs.UserError; exports.actor = _chunk6WLJW57Ucjs.actor; exports.buildActorNames = _chunkIWXMFQDTcjs.buildActorNames; exports.createActorRouter = _chunkIRTVRBJAcjs.createActorRouter; exports.createClientWithDriver = _chunkLULP6HM2cjs.createClientWithDriver; exports.createEngineDriver = _chunk6WLJW57Ucjs.createEngineDriver; exports.createFileSystemDriver = _chunkIRTVRBJAcjs.createFileSystemDriver; exports.createMemoryDriver = _chunkIRTVRBJAcjs.createMemoryDriver; exports.lookupInRegistry = _chunkLULP6HM2cjs.lookupInRegistry; exports.noopNext = _chunkO433HWWGcjs.noopNext; exports.routeWebSocket = _chunkIWXMFQDTcjs.routeWebSocket; exports.setup = _chunk6WLJW57Ucjs.setup; exports.toUint8Array = _chunkO433HWWGcjs.toUint8Array;
|
|
64
74
|
//# sourceMappingURL=mod.cjs.map
|
package/dist/tsup/mod.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/mod.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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/mod.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wvDAAC","file":"/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/mod.cjs"}
|
package/dist/tsup/mod.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { R as RegistryConfig, A as ActorDriver, a as AnyConn, b as AnyActorInstance, E as Encoding, c as AnyDatabaseProvider, d as Actions, e as ActorConfigInput, f as ActorDefinition } from './config
|
|
2
|
-
export {
|
|
1
|
+
import { R as RegistryConfig, A as ActorDriver, a as AnyConn, b as AnyActorInstance, E as Encoding, c as AnyDatabaseProvider, d as Actions, e as ActorConfigInput, f as ActorDefinition } from './config-CwJCQyP1.cjs';
|
|
2
|
+
export { z as ActionContext, B as ActionContextOf, q as ActorConfig, o as ActorConfigSchema, s as ActorContext, u as ActorContextOf, j as ActorKey, i as ActorQuery, n as ActorTypes, ab as ActorsSchema, l as AnyActorDefinition, g as AnyClient, p as AuthIntent, F as BeforeActionResponseContext, G as BeforeActionResponseContextOf, H as BeforeConnectContext, I as BeforeConnectContextOf, C as Client, k as Conn, v as ConnContext, w as ConnContextOf, x as ConnInitContext, y as ConnInitContextOf, J as ConnectContext, K as ConnectContextOf, N as CreateConnStateContext, O as CreateConnStateContextOf, L as CreateContext, M as CreateContextOf, P as CreateVarsContext, Q as CreateVarsContextOf, S as DestroyContext, T as DestroyContextOf, U as DisconnectContext, V as DisconnectContextOf, r as DocActorConfigSchema, D as DocActorOptionsSchema, ah as DocConfigureRunnerPoolSchema, ag as DocInspectorConfigSchema, ak as DocRegistryConfigSchema, aj as DocRunnerConfigSchema, ai as DocServerlessConfigSchema, a6 as FetchHandler, a8 as LegacyStartServerOutput, a9 as Registry, a4 as RegistryActors, ae as RegistryConfigInput, a5 as RegistryConfigSchema, W as RequestContext, X as RequestContextOf, a7 as ServerlessHandler, Y as SleepContext, Z as SleepContextOf, _ as StateChangeContext, $ as StateChangeContextOf, ad as TestConfig, ac as TestConfigSchema, a0 as WakeContext, a1 as WakeContextOf, a2 as WebSocketContext, a3 as WebSocketContextOf, af as buildActorNames, h as createClientWithDriver, m as lookupInRegistry, aa as setup, t as test } from './config-CwJCQyP1.cjs';
|
|
3
3
|
import { WSContext } from 'hono/ws';
|
|
4
4
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
5
|
export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
6
6
|
export { n as noopNext } from './utils-fwx3o3K9.cjs';
|
|
7
|
-
import { D as DriverConfig } from './driver-
|
|
8
|
-
export { a as DriverConfigSchema } from './driver-
|
|
7
|
+
import { D as DriverConfig } from './driver-Lw_oORox.cjs';
|
|
8
|
+
export { a as DriverConfigSchema } from './driver-Lw_oORox.cjs';
|
|
9
9
|
import { GetUpgradeWebSocket } from './utils.cjs';
|
|
10
10
|
export { toUint8Array } from './utils.cjs';
|
|
11
11
|
export { A as ALLOWED_PUBLIC_HEADERS, P as PATH_CONNECT, a as PATH_WEBSOCKET_PREFIX } from './actor-router-consts-DzI2szci.cjs';
|
package/dist/tsup/mod.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { R as RegistryConfig, A as ActorDriver, a as AnyConn, b as AnyActorInstance, E as Encoding, c as AnyDatabaseProvider, d as Actions, e as ActorConfigInput, f as ActorDefinition } from './config-
|
|
2
|
-
export {
|
|
1
|
+
import { R as RegistryConfig, A as ActorDriver, a as AnyConn, b as AnyActorInstance, E as Encoding, c as AnyDatabaseProvider, d as Actions, e as ActorConfigInput, f as ActorDefinition } from './config-CbIHPGKl.js';
|
|
2
|
+
export { z as ActionContext, B as ActionContextOf, q as ActorConfig, o as ActorConfigSchema, s as ActorContext, u as ActorContextOf, j as ActorKey, i as ActorQuery, n as ActorTypes, ab as ActorsSchema, l as AnyActorDefinition, g as AnyClient, p as AuthIntent, F as BeforeActionResponseContext, G as BeforeActionResponseContextOf, H as BeforeConnectContext, I as BeforeConnectContextOf, C as Client, k as Conn, v as ConnContext, w as ConnContextOf, x as ConnInitContext, y as ConnInitContextOf, J as ConnectContext, K as ConnectContextOf, N as CreateConnStateContext, O as CreateConnStateContextOf, L as CreateContext, M as CreateContextOf, P as CreateVarsContext, Q as CreateVarsContextOf, S as DestroyContext, T as DestroyContextOf, U as DisconnectContext, V as DisconnectContextOf, r as DocActorConfigSchema, D as DocActorOptionsSchema, ah as DocConfigureRunnerPoolSchema, ag as DocInspectorConfigSchema, ak as DocRegistryConfigSchema, aj as DocRunnerConfigSchema, ai as DocServerlessConfigSchema, a6 as FetchHandler, a8 as LegacyStartServerOutput, a9 as Registry, a4 as RegistryActors, ae as RegistryConfigInput, a5 as RegistryConfigSchema, W as RequestContext, X as RequestContextOf, a7 as ServerlessHandler, Y as SleepContext, Z as SleepContextOf, _ as StateChangeContext, $ as StateChangeContextOf, ad as TestConfig, ac as TestConfigSchema, a0 as WakeContext, a1 as WakeContextOf, a2 as WebSocketContext, a3 as WebSocketContextOf, af as buildActorNames, h as createClientWithDriver, m as lookupInRegistry, aa as setup, t as test } from './config-CbIHPGKl.js';
|
|
3
3
|
import { WSContext } from 'hono/ws';
|
|
4
4
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
5
|
export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
6
6
|
export { n as noopNext } from './utils-fwx3o3K9.js';
|
|
7
|
-
import { D as DriverConfig } from './driver-
|
|
8
|
-
export { a as DriverConfigSchema } from './driver-
|
|
7
|
+
import { D as DriverConfig } from './driver-CMN823Lc.js';
|
|
8
|
+
export { a as DriverConfigSchema } from './driver-CMN823Lc.js';
|
|
9
9
|
import { GetUpgradeWebSocket } from './utils.js';
|
|
10
10
|
export { toUint8Array } from './utils.js';
|
|
11
11
|
export { A as ALLOWED_PUBLIC_HEADERS, P as PATH_CONNECT, a as PATH_WEBSOCKET_PREFIX } from './actor-router-consts-DzI2szci.js';
|
package/dist/tsup/mod.js
CHANGED
|
@@ -3,21 +3,26 @@ import {
|
|
|
3
3
|
actor,
|
|
4
4
|
createEngineDriver,
|
|
5
5
|
setup
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FA6FGAEC.js";
|
|
7
7
|
import {
|
|
8
8
|
InlineWebSocketAdapter,
|
|
9
9
|
createActorRouter,
|
|
10
10
|
createFileSystemDriver,
|
|
11
11
|
createMemoryDriver
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UUEZVDRL.js";
|
|
13
13
|
import {
|
|
14
14
|
createClientWithDriver,
|
|
15
15
|
lookupInRegistry
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-EEL32AJM.js";
|
|
17
|
+
import "./chunk-WIZ4JGP6.js";
|
|
18
18
|
import {
|
|
19
19
|
ALLOWED_PUBLIC_HEADERS,
|
|
20
20
|
ActorsSchema,
|
|
21
|
+
DocConfigureRunnerPoolSchema,
|
|
22
|
+
DocInspectorConfigSchema,
|
|
23
|
+
DocRegistryConfigSchema,
|
|
24
|
+
DocRunnerConfigSchema,
|
|
25
|
+
DocServerlessConfigSchema,
|
|
21
26
|
DriverConfigSchema,
|
|
22
27
|
KEYS,
|
|
23
28
|
PATH_CONNECT,
|
|
@@ -26,18 +31,23 @@ import {
|
|
|
26
31
|
TestConfigSchema,
|
|
27
32
|
buildActorNames,
|
|
28
33
|
routeWebSocket
|
|
29
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-MIOU6BF3.js";
|
|
30
35
|
import "./chunk-E6ZE2YEA.js";
|
|
31
36
|
import {
|
|
32
37
|
noopNext,
|
|
33
38
|
toUint8Array
|
|
34
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-4U45T5KW.js";
|
|
35
40
|
import {
|
|
36
41
|
UserError
|
|
37
42
|
} from "./chunk-2YHR67M4.js";
|
|
38
43
|
export {
|
|
39
44
|
ALLOWED_PUBLIC_HEADERS,
|
|
40
45
|
ActorsSchema,
|
|
46
|
+
DocConfigureRunnerPoolSchema,
|
|
47
|
+
DocInspectorConfigSchema,
|
|
48
|
+
DocRegistryConfigSchema,
|
|
49
|
+
DocRunnerConfigSchema,
|
|
50
|
+
DocServerlessConfigSchema,
|
|
41
51
|
DriverConfigSchema,
|
|
42
52
|
InlineWebSocketAdapter,
|
|
43
53
|
KEYS as KV_KEYS,
|
package/dist/tsup/test/mod.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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-
|
|
4
|
+
var _chunkFZQHTGQXcjs = require('../chunk-FZQHTGQX.cjs');
|
|
5
|
+
require('../chunk-IRTVRBJA.cjs');
|
|
6
|
+
require('../chunk-LULP6HM2.cjs');
|
|
7
|
+
require('../chunk-GFKZZG2A.cjs');
|
|
8
|
+
require('../chunk-IWXMFQDT.cjs');
|
|
9
9
|
require('../chunk-KDFWJKMJ.cjs');
|
|
10
|
-
require('../chunk-
|
|
10
|
+
require('../chunk-O433HWWG.cjs');
|
|
11
11
|
require('../chunk-SNAUKDDK.cjs');
|
|
12
12
|
require('../chunk-GBENOENJ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.getPort =
|
|
16
|
+
exports.getPort = _chunkFZQHTGQXcjs.getPort; exports.setupTest = _chunkFZQHTGQXcjs.setupTest;
|
|
17
17
|
//# 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,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getPort,
|
|
3
3
|
setupTest
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-K2RNF2ZR.js";
|
|
5
|
+
import "../chunk-UUEZVDRL.js";
|
|
6
|
+
import "../chunk-EEL32AJM.js";
|
|
7
|
+
import "../chunk-WIZ4JGP6.js";
|
|
8
|
+
import "../chunk-MIOU6BF3.js";
|
|
9
9
|
import "../chunk-E6ZE2YEA.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-4U45T5KW.js";
|
|
11
11
|
import "../chunk-2YHR67M4.js";
|
|
12
12
|
export {
|
|
13
13
|
getPort,
|
package/dist/tsup/utils.cjs
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkO433HWWGcjs = require('./chunk-O433HWWG.cjs');
|
|
18
18
|
require('./chunk-SNAUKDDK.cjs');
|
|
19
19
|
require('./chunk-GBENOENJ.cjs');
|
|
20
20
|
|
|
@@ -33,5 +33,5 @@ require('./chunk-GBENOENJ.cjs');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
exports.EXTRA_ERROR_LOG =
|
|
36
|
+
exports.EXTRA_ERROR_LOG = _chunkO433HWWGcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkO433HWWGcjs.SinglePromiseQueue; exports.VERSION = _chunkO433HWWGcjs.VERSION; exports.arrayBuffersEqual = _chunkO433HWWGcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkO433HWWGcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkO433HWWGcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkO433HWWGcjs.combineUrlPath; exports.dbg = _chunkO433HWWGcjs.dbg; exports.detectRuntime = _chunkO433HWWGcjs.detectRuntime; exports.getEnvUniversal = _chunkO433HWWGcjs.getEnvUniversal; exports.httpUserAgent = _chunkO433HWWGcjs.httpUserAgent; exports.promiseWithResolvers = _chunkO433HWWGcjs.promiseWithResolvers; exports.setLongTimeout = _chunkO433HWWGcjs.setLongTimeout; exports.stringifyError = _chunkO433HWWGcjs.stringifyError; exports.toUint8Array = _chunkO433HWWGcjs.toUint8Array;
|
|
37
37
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/tsup/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rivetkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.38",
|
|
4
4
|
"description": "Lightweight libraries for building stateful actors on edge platforms",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"uuid": "^12.0.0",
|
|
168
168
|
"vbare": "^0.0.4",
|
|
169
169
|
"zod": "^4.1.0",
|
|
170
|
-
"@rivetkit/engine-runner": "2.0.
|
|
170
|
+
"@rivetkit/engine-runner": "2.0.38",
|
|
171
171
|
"@rivetkit/virtual-websocket": "2.0.33"
|
|
172
172
|
},
|
|
173
173
|
"devDependencies": {
|
|
@@ -221,7 +221,9 @@
|
|
|
221
221
|
"format:write": "biome format --write .",
|
|
222
222
|
"test": "vitest run",
|
|
223
223
|
"test:watch": "vitest",
|
|
224
|
-
"
|
|
225
|
-
"dump-asyncapi": "tsx scripts/dump-asyncapi.ts"
|
|
224
|
+
"manager-openapi-gen": "tsx scripts/manager-openapi-gen.ts",
|
|
225
|
+
"dump-asyncapi": "tsx scripts/dump-asyncapi.ts",
|
|
226
|
+
"registry-config-schema-gen": "tsx scripts/registry-config-schema-gen.ts",
|
|
227
|
+
"actor-config-schema-gen": "tsx scripts/actor-config-schema-gen.ts"
|
|
226
228
|
}
|
|
227
229
|
}
|
package/src/actor/config.ts
CHANGED
|
@@ -613,3 +613,50 @@ export function test<
|
|
|
613
613
|
>;
|
|
614
614
|
return config;
|
|
615
615
|
}
|
|
616
|
+
|
|
617
|
+
// MARK: Documentation Schema
|
|
618
|
+
// This schema is JSON-serializable for documentation generation.
|
|
619
|
+
// It excludes function types and focuses on the configurable options.
|
|
620
|
+
|
|
621
|
+
export const DocActorOptionsSchema = z
|
|
622
|
+
.object({
|
|
623
|
+
createVarsTimeout: z.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
624
|
+
createConnStateTimeout: z.number().optional().describe("Timeout in ms for createConnState handler. Default: 5000"),
|
|
625
|
+
onConnectTimeout: z.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
|
|
626
|
+
onSleepTimeout: z.number().optional().describe("Timeout in ms for onSleep handler. Must be less than ACTOR_STOP_THRESHOLD_MS. Default: 5000"),
|
|
627
|
+
onDestroyTimeout: z.number().optional().describe("Timeout in ms for onDestroy handler. Default: 5000"),
|
|
628
|
+
stateSaveInterval: z.number().optional().describe("Interval in ms between automatic state saves. Default: 10000"),
|
|
629
|
+
actionTimeout: z.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
|
|
630
|
+
waitUntilTimeout: z.number().optional().describe("Max time in ms to wait for waitUntil background promises during shutdown. Default: 15000"),
|
|
631
|
+
connectionLivenessTimeout: z.number().optional().describe("Timeout in ms for connection liveness checks. Default: 2500"),
|
|
632
|
+
connectionLivenessInterval: z.number().optional().describe("Interval in ms between connection liveness checks. Default: 5000"),
|
|
633
|
+
noSleep: z.boolean().optional().describe("If true, the actor will never sleep. Default: false"),
|
|
634
|
+
sleepTimeout: z.number().optional().describe("Time in ms of inactivity before the actor sleeps. Default: 30000"),
|
|
635
|
+
canHibernateWebSocket: z.boolean().optional().describe("Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"),
|
|
636
|
+
})
|
|
637
|
+
.describe("Actor options for timeouts and behavior configuration.");
|
|
638
|
+
|
|
639
|
+
export const DocActorConfigSchema = z
|
|
640
|
+
.object({
|
|
641
|
+
state: z.unknown().optional().describe("Initial state value for the actor. Cannot be used with createState."),
|
|
642
|
+
createState: z.unknown().optional().describe("Function to create initial state. Receives context and input. Cannot be used with state."),
|
|
643
|
+
connState: z.unknown().optional().describe("Initial connection state value. Cannot be used with createConnState."),
|
|
644
|
+
createConnState: z.unknown().optional().describe("Function to create connection state. Receives context and connection params. Cannot be used with connState."),
|
|
645
|
+
vars: z.unknown().optional().describe("Initial ephemeral variables value. Cannot be used with createVars."),
|
|
646
|
+
createVars: z.unknown().optional().describe("Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."),
|
|
647
|
+
db: z.unknown().optional().describe("Database provider instance for the actor."),
|
|
648
|
+
onCreate: z.unknown().optional().describe("Called when the actor is first initialized. Use to initialize state."),
|
|
649
|
+
onDestroy: z.unknown().optional().describe("Called when the actor is destroyed."),
|
|
650
|
+
onWake: z.unknown().optional().describe("Called when the actor wakes up and is ready to receive connections and actions."),
|
|
651
|
+
onSleep: z.unknown().optional().describe("Called when the actor is stopping or sleeping. Use to clean up resources."),
|
|
652
|
+
onStateChange: z.unknown().optional().describe("Called when the actor's state changes. State changes within this hook won't trigger recursion."),
|
|
653
|
+
onBeforeConnect: z.unknown().optional().describe("Called before a client connects. Throw an error to reject the connection."),
|
|
654
|
+
onConnect: z.unknown().optional().describe("Called when a client successfully connects."),
|
|
655
|
+
onDisconnect: z.unknown().optional().describe("Called when a client disconnects."),
|
|
656
|
+
onBeforeActionResponse: z.unknown().optional().describe("Called before sending an action response. Use to transform output."),
|
|
657
|
+
onRequest: z.unknown().optional().describe("Called for raw HTTP requests to /actors/{name}/http/* endpoints."),
|
|
658
|
+
onWebSocket: z.unknown().optional().describe("Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."),
|
|
659
|
+
actions: z.record(z.string(), z.unknown()).optional().describe("Map of action name to handler function."),
|
|
660
|
+
options: DocActorOptionsSchema.optional(),
|
|
661
|
+
})
|
|
662
|
+
.describe("Actor configuration passed to the actor() function.");
|
package/src/client/actor-conn.ts
CHANGED
|
@@ -26,13 +26,14 @@ import { deserializeWithEncoding, serializeWithEncoding } from "@/serde";
|
|
|
26
26
|
import { bufferToArrayBuffer, promiseWithResolvers } from "@/utils";
|
|
27
27
|
import { getLogMessage } from "@/utils/env-vars";
|
|
28
28
|
import type { ActorDefinitionActions } from "./actor-common";
|
|
29
|
-
import { queryActor } from "./actor-query";
|
|
29
|
+
import { checkForSchedulingError, queryActor } from "./actor-query";
|
|
30
30
|
import { ACTOR_CONNS_SYMBOL, type ClientRaw } from "./client";
|
|
31
31
|
import * as errors from "./errors";
|
|
32
32
|
import { logger } from "./log";
|
|
33
33
|
import {
|
|
34
34
|
type WebSocketMessage as ConnMessage,
|
|
35
35
|
messageLength,
|
|
36
|
+
parseWebSocketCloseReason,
|
|
36
37
|
sendHttpRequest,
|
|
37
38
|
} from "./utils";
|
|
38
39
|
|
|
@@ -387,9 +388,9 @@ enc
|
|
|
387
388
|
});
|
|
388
389
|
}
|
|
389
390
|
});
|
|
390
|
-
ws.addEventListener("close", (ev) => {
|
|
391
|
+
ws.addEventListener("close", async (ev) => {
|
|
391
392
|
try {
|
|
392
|
-
this.#handleOnClose(ev);
|
|
393
|
+
await this.#handleOnClose(ev);
|
|
393
394
|
} catch (err) {
|
|
394
395
|
logger().error({
|
|
395
396
|
msg: "error in websocket close handler",
|
|
@@ -519,27 +520,24 @@ enc
|
|
|
519
520
|
metadata,
|
|
520
521
|
});
|
|
521
522
|
|
|
522
|
-
// Check if this is an actor scheduling error
|
|
523
|
-
let errorToThrow
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
) {
|
|
530
|
-
|
|
531
|
-
const schedulingError =
|
|
532
|
-
await this.#checkForSchedulingError();
|
|
533
|
-
errorToThrow =
|
|
534
|
-
schedulingError ??
|
|
535
|
-
new errors.ActorError(group, code, message, metadata);
|
|
536
|
-
} else {
|
|
537
|
-
errorToThrow = new errors.ActorError(
|
|
523
|
+
// Check if this is an actor scheduling error and try to get more details
|
|
524
|
+
let errorToThrow = new errors.ActorError(
|
|
525
|
+
group,
|
|
526
|
+
code,
|
|
527
|
+
message,
|
|
528
|
+
metadata,
|
|
529
|
+
);
|
|
530
|
+
if (errors.isSchedulingError(group, code) && this.#actorId) {
|
|
531
|
+
const schedulingError = await checkForSchedulingError(
|
|
538
532
|
group,
|
|
539
533
|
code,
|
|
540
|
-
|
|
541
|
-
|
|
534
|
+
this.#actorId,
|
|
535
|
+
this.#actorQuery,
|
|
536
|
+
this.#driver,
|
|
542
537
|
);
|
|
538
|
+
if (schedulingError) {
|
|
539
|
+
errorToThrow = schedulingError;
|
|
540
|
+
}
|
|
543
541
|
}
|
|
544
542
|
|
|
545
543
|
// If we have an onOpenPromise, reject it with the error
|
|
@@ -553,10 +551,7 @@ enc
|
|
|
553
551
|
this.#actionsInFlight.delete(id);
|
|
554
552
|
}
|
|
555
553
|
|
|
556
|
-
|
|
557
|
-
if (errorToThrow instanceof errors.ActorError) {
|
|
558
|
-
this.#dispatchActorError(errorToThrow);
|
|
559
|
-
}
|
|
554
|
+
this.#dispatchActorError(errorToThrow);
|
|
560
555
|
}
|
|
561
556
|
} else if (response.body.tag === "ActionResponse") {
|
|
562
557
|
// Action response OK
|
|
@@ -587,7 +582,7 @@ enc
|
|
|
587
582
|
}
|
|
588
583
|
|
|
589
584
|
/** Called by the onclose event from drivers. */
|
|
590
|
-
#handleOnClose(event: Event | CloseEvent) {
|
|
585
|
+
async #handleOnClose(event: Event | CloseEvent) {
|
|
591
586
|
// We can't use `event instanceof CloseEvent` because it's not defined in NodeJS
|
|
592
587
|
const closeEvent = event as CloseEvent;
|
|
593
588
|
const wasClean = closeEvent.wasClean;
|
|
@@ -609,12 +604,55 @@ enc
|
|
|
609
604
|
this.#rejectPendingPromises(new errors.ActorConnDisposed(), true);
|
|
610
605
|
} else {
|
|
611
606
|
this.#setConnStatus("disconnected");
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
607
|
+
|
|
608
|
+
// Build error from close event
|
|
609
|
+
let error: Error;
|
|
610
|
+
const reason = closeEvent.reason || "";
|
|
611
|
+
const parsed = parseWebSocketCloseReason(reason);
|
|
612
|
+
|
|
613
|
+
if (parsed) {
|
|
614
|
+
const { group, code } = parsed;
|
|
615
|
+
|
|
616
|
+
// Check if this is a scheduling error
|
|
617
|
+
if (errors.isSchedulingError(group, code) && this.#actorId) {
|
|
618
|
+
const schedulingError = await checkForSchedulingError(
|
|
619
|
+
group,
|
|
620
|
+
code,
|
|
621
|
+
this.#actorId,
|
|
622
|
+
this.#actorQuery,
|
|
623
|
+
this.#driver,
|
|
624
|
+
);
|
|
625
|
+
if (schedulingError) {
|
|
626
|
+
error = schedulingError;
|
|
627
|
+
} else {
|
|
628
|
+
error = new errors.ActorError(
|
|
629
|
+
group,
|
|
630
|
+
code,
|
|
631
|
+
`Connection closed: ${reason}`,
|
|
632
|
+
undefined,
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
} else {
|
|
636
|
+
error = new errors.ActorError(
|
|
637
|
+
group,
|
|
638
|
+
code,
|
|
639
|
+
`Connection closed: ${reason}`,
|
|
640
|
+
undefined,
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
} else {
|
|
644
|
+
// Default error for non-structured close reasons
|
|
645
|
+
error = new Error(
|
|
646
|
+
`${wasClean ? "Connection closed" : "Connection lost"} (code: ${closeEvent.code}, reason: ${reason})`,
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
this.#rejectPendingPromises(error, false);
|
|
651
|
+
|
|
652
|
+
// Dispatch to error handler if it's an ActorError
|
|
653
|
+
if (error instanceof errors.ActorError) {
|
|
654
|
+
this.#dispatchActorError(error);
|
|
655
|
+
}
|
|
618
656
|
|
|
619
657
|
// Automatically reconnect if we were connected
|
|
620
658
|
if (wasConnected) {
|
|
@@ -712,55 +750,6 @@ enc
|
|
|
712
750
|
}
|
|
713
751
|
}
|
|
714
752
|
|
|
715
|
-
async #checkForSchedulingError(): Promise<errors.ActorSchedulingError | null> {
|
|
716
|
-
if (!this.#actorId) return null;
|
|
717
|
-
|
|
718
|
-
// Extract name from the query (it's nested in one of the variant properties)
|
|
719
|
-
const query = this.#actorQuery;
|
|
720
|
-
const name =
|
|
721
|
-
"getForId" in query
|
|
722
|
-
? query.getForId.name
|
|
723
|
-
: "getForKey" in query
|
|
724
|
-
? query.getForKey.name
|
|
725
|
-
: "getOrCreateForKey" in query
|
|
726
|
-
? query.getOrCreateForKey.name
|
|
727
|
-
: "create" in query
|
|
728
|
-
? query.create.name
|
|
729
|
-
: null;
|
|
730
|
-
|
|
731
|
-
if (!name) return null;
|
|
732
|
-
|
|
733
|
-
try {
|
|
734
|
-
// Fetch actor details to check for scheduling errors
|
|
735
|
-
const actor = await this.#driver.getForId({
|
|
736
|
-
name,
|
|
737
|
-
actorId: this.#actorId,
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
if (actor?.error) {
|
|
741
|
-
logger().info({
|
|
742
|
-
msg: "found actor scheduling error",
|
|
743
|
-
actorId: this.#actorId,
|
|
744
|
-
error: actor.error,
|
|
745
|
-
});
|
|
746
|
-
return new errors.ActorSchedulingError(
|
|
747
|
-
this.#actorId,
|
|
748
|
-
actor.error,
|
|
749
|
-
);
|
|
750
|
-
}
|
|
751
|
-
} catch (err) {
|
|
752
|
-
// If we can't fetch actor details, just return null
|
|
753
|
-
// and fall back to the generic error
|
|
754
|
-
logger().warn({
|
|
755
|
-
msg: "failed to fetch actor details for scheduling error check",
|
|
756
|
-
actorId: this.#actorId,
|
|
757
|
-
error: stringifyError(err),
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
return null;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
753
|
#addEventSubscription<Args extends Array<unknown>>(
|
|
765
754
|
eventName: string,
|
|
766
755
|
callback: (...args: Args) => void,
|
|
@@ -25,9 +25,9 @@ import {
|
|
|
25
25
|
import { bufferToArrayBuffer } from "@/utils";
|
|
26
26
|
import type { ActorDefinitionActions } from "./actor-common";
|
|
27
27
|
import { type ActorConn, ActorConnRaw } from "./actor-conn";
|
|
28
|
-
import { queryActor } from "./actor-query";
|
|
28
|
+
import { checkForSchedulingError, queryActor } from "./actor-query";
|
|
29
29
|
import { type ClientRaw, CREATE_ACTOR_CONN_PROXY } from "./client";
|
|
30
|
-
import { ActorError } from "./errors";
|
|
30
|
+
import { ActorError, isSchedulingError } from "./errors";
|
|
31
31
|
import { logger } from "./log";
|
|
32
32
|
import { rawHttpFetch, rawWebSocket } from "./raw-utils";
|
|
33
33
|
import { sendHttpRequest } from "./utils";
|
|
@@ -81,22 +81,17 @@ export class ActorHandleRaw {
|
|
|
81
81
|
args: Args;
|
|
82
82
|
signal?: AbortSignal;
|
|
83
83
|
}): Promise<Response> {
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// this.#encodingKind,
|
|
88
|
-
// this.#params,
|
|
89
|
-
// opts.name,
|
|
90
|
-
// opts.args,
|
|
91
|
-
// { signal: opts.signal },
|
|
92
|
-
// );
|
|
84
|
+
// Track actorId for scheduling error lookups
|
|
85
|
+
let actorId: string | undefined;
|
|
86
|
+
|
|
93
87
|
try {
|
|
94
88
|
// Get the actor ID
|
|
95
|
-
const
|
|
89
|
+
const result = await queryActor(
|
|
96
90
|
undefined,
|
|
97
91
|
this.#actorQuery,
|
|
98
92
|
this.#driver,
|
|
99
93
|
);
|
|
94
|
+
actorId = result.actorId;
|
|
100
95
|
logger().debug({ msg: "found actor for action", actorId });
|
|
101
96
|
invariant(actorId, "Missing actor ID");
|
|
102
97
|
|
|
@@ -159,6 +154,21 @@ export class ActorHandleRaw {
|
|
|
159
154
|
{},
|
|
160
155
|
true,
|
|
161
156
|
);
|
|
157
|
+
|
|
158
|
+
// Check if this is a scheduling error and try to get more details
|
|
159
|
+
if (actorId && isSchedulingError(group, code)) {
|
|
160
|
+
const schedulingError = await checkForSchedulingError(
|
|
161
|
+
group,
|
|
162
|
+
code,
|
|
163
|
+
actorId,
|
|
164
|
+
this.#actorQuery,
|
|
165
|
+
this.#driver,
|
|
166
|
+
);
|
|
167
|
+
if (schedulingError) {
|
|
168
|
+
throw schedulingError;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
162
172
|
throw new ActorError(group, code, message, metadata);
|
|
163
173
|
}
|
|
164
174
|
}
|