rivetkit 2.3.9 → 2.3.11-rc.1
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/browser/client.d.ts +2 -12
- package/dist/browser/client.js +22 -27
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/agent-os/index.cjs +1 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +2 -12
- package/dist/tsup/agent-os/index.d.ts +2 -12
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-S57DMBTM.cjs → chunk-57ZE43T5.cjs} +3 -3
- package/dist/tsup/{chunk-S57DMBTM.cjs.map → chunk-57ZE43T5.cjs.map} +1 -1
- package/dist/tsup/{chunk-X25YYVFL.js → chunk-5FVMFSBH.js} +2 -2
- package/dist/tsup/{chunk-BQU4XTKM.js → chunk-5ZS22TOP.js} +3 -3
- package/dist/tsup/{chunk-CQ23UFQ4.js → chunk-6ZPMYIZ6.js} +2 -2
- package/dist/tsup/{chunk-UBYPRYJR.js → chunk-ET2F6BXK.js} +2 -2
- package/dist/tsup/chunk-ET2F6BXK.js.map +1 -0
- package/dist/tsup/{chunk-AVUMOGUE.cjs → chunk-JAQHV6LB.cjs} +7 -7
- package/dist/tsup/{chunk-AVUMOGUE.cjs.map → chunk-JAQHV6LB.cjs.map} +1 -1
- package/dist/tsup/{chunk-GZ5DYSIR.cjs → chunk-K4DNAIWT.cjs} +4 -4
- package/dist/tsup/{chunk-GZ5DYSIR.cjs.map → chunk-K4DNAIWT.cjs.map} +1 -1
- package/dist/tsup/{chunk-KVKWTOW7.js → chunk-L4DYLD7P.js} +3 -3
- package/dist/tsup/{chunk-MQDQ3A72.js → chunk-MMPE77KO.js} +27 -33
- package/dist/tsup/chunk-MMPE77KO.js.map +1 -0
- package/dist/tsup/{chunk-M4R2O5NJ.cjs → chunk-TWNMQDZK.cjs} +2 -2
- package/dist/tsup/chunk-TWNMQDZK.cjs.map +1 -0
- package/dist/tsup/{chunk-3IDKUXQT.cjs → chunk-W2YEXCCJ.cjs} +163 -169
- package/dist/tsup/chunk-W2YEXCCJ.cjs.map +1 -0
- package/dist/tsup/{chunk-KPP2YRS5.cjs → chunk-XEOPXHN2.cjs} +9 -9
- package/dist/tsup/{chunk-KPP2YRS5.cjs.map → chunk-XEOPXHN2.cjs.map} +1 -1
- 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-CUymbyM6.d.ts → config-BKAMOHez.d.ts} +2 -12
- package/dist/tsup/{config-CpB-e4I9.d.cts → config-Caocy3Z9.d.cts} +2 -12
- package/dist/tsup/{context-YBUBTwTS.d.ts → context-AfCExwbr.d.ts} +1 -1
- package/dist/tsup/{context-c-6G4mjk.d.cts → context-D1_m5x1D.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +2 -2
- package/dist/tsup/db/mod.js +1 -1
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/inspector/mod.cjs +4 -4
- package/dist/tsup/inspector/mod.js +3 -3
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/mod.cjs +131 -341
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +68 -278
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +6 -6
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +3 -3
- package/package.json +8 -8
- package/src/client/actor-handle.ts +1 -3
- package/src/client/raw-utils.ts +0 -8
- package/src/common/actor-router-consts.ts +0 -1
- package/src/engine-client/actor-http-client.ts +22 -6
- package/src/registry/index.ts +11 -51
- package/src/registry/napi-runtime.ts +5 -32
- package/src/registry/native.ts +63 -110
- package/src/registry/runtime.ts +2 -16
- package/dist/tsup/chunk-3IDKUXQT.cjs.map +0 -1
- package/dist/tsup/chunk-M4R2O5NJ.cjs.map +0 -1
- package/dist/tsup/chunk-MQDQ3A72.js.map +0 -1
- package/dist/tsup/chunk-UBYPRYJR.js.map +0 -1
- package/src/registry/native-http.ts +0 -208
- /package/dist/tsup/{chunk-X25YYVFL.js.map → chunk-5FVMFSBH.js.map} +0 -0
- /package/dist/tsup/{chunk-BQU4XTKM.js.map → chunk-5ZS22TOP.js.map} +0 -0
- /package/dist/tsup/{chunk-CQ23UFQ4.js.map → chunk-6ZPMYIZ6.js.map} +0 -0
- /package/dist/tsup/{chunk-KVKWTOW7.js.map → chunk-L4DYLD7P.js.map} +0 -0
package/dist/tsup/mod.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-
|
|
2
|
-
export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as Actions, n as ActorConfig, o as ActorConfigInput, p as ActorConfigSchema, q as ActorContext, r as ActorContextOf, s as ActorCron, t as ActorCronEveryOptions, u as ActorCronSetOptions, v as ActorDefinition, w as ActorInspectorConfig, x as ActorInspectorConfigSchema, y as ActorKey, z as ActorKv, F as ActorLogger, G as ActorOptions, H as ActorOptionsInput, I as ActorOptionsSchema, J as ActorQuery, K as ActorQueue, L as ActorSchedule, N as ActorTypes, O as ActorsSchema, P as AnyActorInstance, T as AnyClient, U as AnyConn, V as AnyStaticActorDefinition, X as AnyStaticActorInstance, Y as AuthIntent, Z as BUILTIN_INSPECTOR_TAB_IDS, _ as BaseActorInstance, $ as BuiltinInspectorTabIdSchema, a0 as CONN_DRIVER_SYMBOL, a1 as CONN_STATE_MANAGER_SYMBOL, a2 as Client, a3 as Conn, a4 as CronFire, a5 as CronJobInfo, a6 as CustomInspectorTabEntrySchema, a7 as DEFAULT_SLEEP_GRACE_PERIOD, a8 as DocActorConfigSchema, a9 as DocActorOptionsSchema, aa as DocConfigurePoolSchema, ab as DocEnvoyConfigSchema, ac as DocRegistryConfigSchema, ad as DocServerlessConfigSchema, ae as DocSqliteConfigSchema, af as FetchHandler, ag as GlobalActorOptions, ah as GlobalActorOptionsInput, ai as GlobalActorOptionsSchema, aj as HideInspectorTabEntrySchema, ak as InspectorTabEntrySchema, al as InspectorUnsubscribe, am as InstanceActorOptions, an as InstanceActorOptionsInput, ao as InstanceActorOptionsSchema, ap as QueueEnqueueAndWaitOptions, aq as QueueFilterName, ar as QueueIterOptions, as as QueueMessageOf, at as QueueName, au as QueueNextBatchOptions, av as QueueNextOptions, aw as QueueResultMessageForName, ax as QueueTryNextBatchOptions, ay as QueueTryNextOptions, az as QueueWaitOptions, aA as RAW_STATE_SYMBOL, aB as RUN_FUNCTION_CONFIG_SYMBOL, aC as Registry, aD as RegistryActors, aE as RegistryApplication, aF as RegistryConfig, aG as RegistryConfigInput, aH as RegistryConfigSchema, aI as RegistryDeps, aJ as RegistryListenOptions, aK as RegistryRoutes, aL as RunConfig, aM as RunConfigSchema, aN as RunInspectorConfig, aO as RuntimeKind, aP as RuntimeKindSchema, aQ as ScheduledEventInfo, aR as ScheduledFireInfo, aS as ServerlessHandler, aT as SqliteBackend, aU as SqliteBackendSchema, aV as SqliteConfig, aW as SqliteConfigSchema, aX as TestConfig, aY as TestConfigSchema, aZ as Type, a_ as WasmRuntimeBindings, a$ as WasmRuntimeConfig, b0 as WasmRuntimeConfigSchema, b1 as WasmRuntimeInitInput, b2 as WorkflowInspectorConfig, b3 as actor, b4 as buildActorNames, b5 as createClientWithDriver, b6 as disposeRunInspector, b7 as event, b8 as getRunFunction, b9 as getRunInspectorConfig, ba as getRunMetadata, bb as isStaticActorDefinition, bc as isStaticActorInstance, bd as lookupInRegistry, be as queue, bf as setup, bg as test } from './config-
|
|
1
|
+
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-Caocy3Z9.cjs';
|
|
2
|
+
export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as Actions, n as ActorConfig, o as ActorConfigInput, p as ActorConfigSchema, q as ActorContext, r as ActorContextOf, s as ActorCron, t as ActorCronEveryOptions, u as ActorCronSetOptions, v as ActorDefinition, w as ActorInspectorConfig, x as ActorInspectorConfigSchema, y as ActorKey, z as ActorKv, F as ActorLogger, G as ActorOptions, H as ActorOptionsInput, I as ActorOptionsSchema, J as ActorQuery, K as ActorQueue, L as ActorSchedule, N as ActorTypes, O as ActorsSchema, P as AnyActorInstance, T as AnyClient, U as AnyConn, V as AnyStaticActorDefinition, X as AnyStaticActorInstance, Y as AuthIntent, Z as BUILTIN_INSPECTOR_TAB_IDS, _ as BaseActorInstance, $ as BuiltinInspectorTabIdSchema, a0 as CONN_DRIVER_SYMBOL, a1 as CONN_STATE_MANAGER_SYMBOL, a2 as Client, a3 as Conn, a4 as CronFire, a5 as CronJobInfo, a6 as CustomInspectorTabEntrySchema, a7 as DEFAULT_SLEEP_GRACE_PERIOD, a8 as DocActorConfigSchema, a9 as DocActorOptionsSchema, aa as DocConfigurePoolSchema, ab as DocEnvoyConfigSchema, ac as DocRegistryConfigSchema, ad as DocServerlessConfigSchema, ae as DocSqliteConfigSchema, af as FetchHandler, ag as GlobalActorOptions, ah as GlobalActorOptionsInput, ai as GlobalActorOptionsSchema, aj as HideInspectorTabEntrySchema, ak as InspectorTabEntrySchema, al as InspectorUnsubscribe, am as InstanceActorOptions, an as InstanceActorOptionsInput, ao as InstanceActorOptionsSchema, ap as QueueEnqueueAndWaitOptions, aq as QueueFilterName, ar as QueueIterOptions, as as QueueMessageOf, at as QueueName, au as QueueNextBatchOptions, av as QueueNextOptions, aw as QueueResultMessageForName, ax as QueueTryNextBatchOptions, ay as QueueTryNextOptions, az as QueueWaitOptions, aA as RAW_STATE_SYMBOL, aB as RUN_FUNCTION_CONFIG_SYMBOL, aC as Registry, aD as RegistryActors, aE as RegistryApplication, aF as RegistryConfig, aG as RegistryConfigInput, aH as RegistryConfigSchema, aI as RegistryDeps, aJ as RegistryListenOptions, aK as RegistryRoutes, aL as RunConfig, aM as RunConfigSchema, aN as RunInspectorConfig, aO as RuntimeKind, aP as RuntimeKindSchema, aQ as ScheduledEventInfo, aR as ScheduledFireInfo, aS as ServerlessHandler, aT as SqliteBackend, aU as SqliteBackendSchema, aV as SqliteConfig, aW as SqliteConfigSchema, aX as TestConfig, aY as TestConfigSchema, aZ as Type, a_ as WasmRuntimeBindings, a$ as WasmRuntimeConfig, b0 as WasmRuntimeConfigSchema, b1 as WasmRuntimeInitInput, b2 as WorkflowInspectorConfig, b3 as actor, b4 as buildActorNames, b5 as createClientWithDriver, b6 as disposeRunInspector, b7 as event, b8 as getRunFunction, b9 as getRunInspectorConfig, ba as getRunMetadata, bb as isStaticActorDefinition, bc as isStaticActorInstance, bd as lookupInRegistry, be as queue, bf as setup, bg as test } from './config-Caocy3Z9.cjs';
|
|
3
3
|
export { E as Encoding, t as toUint8Array } from './utils-DQDCphrl.cjs';
|
|
4
4
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
5
|
export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
6
6
|
import { A as AnyDatabaseProvider } from './config-BxOimoGX.cjs';
|
|
7
7
|
export { R as ActorError, R as RivetError, a as RivetErrorLike, b as RivetErrorOptions, U as UserError, c as UserErrorOptions, n as noopNext } from './utils-CqDnC_PS.cjs';
|
|
8
8
|
import { WSContext } from 'hono/ws';
|
|
9
|
-
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-
|
|
9
|
+
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-D1_m5x1D.cjs';
|
|
10
10
|
import 'zod/v4';
|
|
11
11
|
import '@rivetkit/rivetkit-wasm';
|
|
12
12
|
import 'zod';
|
package/dist/tsup/mod.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-
|
|
2
|
-
export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as Actions, n as ActorConfig, o as ActorConfigInput, p as ActorConfigSchema, q as ActorContext, r as ActorContextOf, s as ActorCron, t as ActorCronEveryOptions, u as ActorCronSetOptions, v as ActorDefinition, w as ActorInspectorConfig, x as ActorInspectorConfigSchema, y as ActorKey, z as ActorKv, F as ActorLogger, G as ActorOptions, H as ActorOptionsInput, I as ActorOptionsSchema, J as ActorQuery, K as ActorQueue, L as ActorSchedule, N as ActorTypes, O as ActorsSchema, P as AnyActorInstance, T as AnyClient, U as AnyConn, V as AnyStaticActorDefinition, X as AnyStaticActorInstance, Y as AuthIntent, Z as BUILTIN_INSPECTOR_TAB_IDS, _ as BaseActorInstance, $ as BuiltinInspectorTabIdSchema, a0 as CONN_DRIVER_SYMBOL, a1 as CONN_STATE_MANAGER_SYMBOL, a2 as Client, a3 as Conn, a4 as CronFire, a5 as CronJobInfo, a6 as CustomInspectorTabEntrySchema, a7 as DEFAULT_SLEEP_GRACE_PERIOD, a8 as DocActorConfigSchema, a9 as DocActorOptionsSchema, aa as DocConfigurePoolSchema, ab as DocEnvoyConfigSchema, ac as DocRegistryConfigSchema, ad as DocServerlessConfigSchema, ae as DocSqliteConfigSchema, af as FetchHandler, ag as GlobalActorOptions, ah as GlobalActorOptionsInput, ai as GlobalActorOptionsSchema, aj as HideInspectorTabEntrySchema, ak as InspectorTabEntrySchema, al as InspectorUnsubscribe, am as InstanceActorOptions, an as InstanceActorOptionsInput, ao as InstanceActorOptionsSchema, ap as QueueEnqueueAndWaitOptions, aq as QueueFilterName, ar as QueueIterOptions, as as QueueMessageOf, at as QueueName, au as QueueNextBatchOptions, av as QueueNextOptions, aw as QueueResultMessageForName, ax as QueueTryNextBatchOptions, ay as QueueTryNextOptions, az as QueueWaitOptions, aA as RAW_STATE_SYMBOL, aB as RUN_FUNCTION_CONFIG_SYMBOL, aC as Registry, aD as RegistryActors, aE as RegistryApplication, aF as RegistryConfig, aG as RegistryConfigInput, aH as RegistryConfigSchema, aI as RegistryDeps, aJ as RegistryListenOptions, aK as RegistryRoutes, aL as RunConfig, aM as RunConfigSchema, aN as RunInspectorConfig, aO as RuntimeKind, aP as RuntimeKindSchema, aQ as ScheduledEventInfo, aR as ScheduledFireInfo, aS as ServerlessHandler, aT as SqliteBackend, aU as SqliteBackendSchema, aV as SqliteConfig, aW as SqliteConfigSchema, aX as TestConfig, aY as TestConfigSchema, aZ as Type, a_ as WasmRuntimeBindings, a$ as WasmRuntimeConfig, b0 as WasmRuntimeConfigSchema, b1 as WasmRuntimeInitInput, b2 as WorkflowInspectorConfig, b3 as actor, b4 as buildActorNames, b5 as createClientWithDriver, b6 as disposeRunInspector, b7 as event, b8 as getRunFunction, b9 as getRunInspectorConfig, ba as getRunMetadata, bb as isStaticActorDefinition, bc as isStaticActorInstance, bd as lookupInRegistry, be as queue, bf as setup, bg as test } from './config-
|
|
1
|
+
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-BKAMOHez.js';
|
|
2
|
+
export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as Actions, n as ActorConfig, o as ActorConfigInput, p as ActorConfigSchema, q as ActorContext, r as ActorContextOf, s as ActorCron, t as ActorCronEveryOptions, u as ActorCronSetOptions, v as ActorDefinition, w as ActorInspectorConfig, x as ActorInspectorConfigSchema, y as ActorKey, z as ActorKv, F as ActorLogger, G as ActorOptions, H as ActorOptionsInput, I as ActorOptionsSchema, J as ActorQuery, K as ActorQueue, L as ActorSchedule, N as ActorTypes, O as ActorsSchema, P as AnyActorInstance, T as AnyClient, U as AnyConn, V as AnyStaticActorDefinition, X as AnyStaticActorInstance, Y as AuthIntent, Z as BUILTIN_INSPECTOR_TAB_IDS, _ as BaseActorInstance, $ as BuiltinInspectorTabIdSchema, a0 as CONN_DRIVER_SYMBOL, a1 as CONN_STATE_MANAGER_SYMBOL, a2 as Client, a3 as Conn, a4 as CronFire, a5 as CronJobInfo, a6 as CustomInspectorTabEntrySchema, a7 as DEFAULT_SLEEP_GRACE_PERIOD, a8 as DocActorConfigSchema, a9 as DocActorOptionsSchema, aa as DocConfigurePoolSchema, ab as DocEnvoyConfigSchema, ac as DocRegistryConfigSchema, ad as DocServerlessConfigSchema, ae as DocSqliteConfigSchema, af as FetchHandler, ag as GlobalActorOptions, ah as GlobalActorOptionsInput, ai as GlobalActorOptionsSchema, aj as HideInspectorTabEntrySchema, ak as InspectorTabEntrySchema, al as InspectorUnsubscribe, am as InstanceActorOptions, an as InstanceActorOptionsInput, ao as InstanceActorOptionsSchema, ap as QueueEnqueueAndWaitOptions, aq as QueueFilterName, ar as QueueIterOptions, as as QueueMessageOf, at as QueueName, au as QueueNextBatchOptions, av as QueueNextOptions, aw as QueueResultMessageForName, ax as QueueTryNextBatchOptions, ay as QueueTryNextOptions, az as QueueWaitOptions, aA as RAW_STATE_SYMBOL, aB as RUN_FUNCTION_CONFIG_SYMBOL, aC as Registry, aD as RegistryActors, aE as RegistryApplication, aF as RegistryConfig, aG as RegistryConfigInput, aH as RegistryConfigSchema, aI as RegistryDeps, aJ as RegistryListenOptions, aK as RegistryRoutes, aL as RunConfig, aM as RunConfigSchema, aN as RunInspectorConfig, aO as RuntimeKind, aP as RuntimeKindSchema, aQ as ScheduledEventInfo, aR as ScheduledFireInfo, aS as ServerlessHandler, aT as SqliteBackend, aU as SqliteBackendSchema, aV as SqliteConfig, aW as SqliteConfigSchema, aX as TestConfig, aY as TestConfigSchema, aZ as Type, a_ as WasmRuntimeBindings, a$ as WasmRuntimeConfig, b0 as WasmRuntimeConfigSchema, b1 as WasmRuntimeInitInput, b2 as WorkflowInspectorConfig, b3 as actor, b4 as buildActorNames, b5 as createClientWithDriver, b6 as disposeRunInspector, b7 as event, b8 as getRunFunction, b9 as getRunInspectorConfig, ba as getRunMetadata, bb as isStaticActorDefinition, bc as isStaticActorInstance, bd as lookupInRegistry, be as queue, bf as setup, bg as test } from './config-BKAMOHez.js';
|
|
3
3
|
export { E as Encoding, t as toUint8Array } from './utils-CV0akuDD.js';
|
|
4
4
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
5
|
export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
6
6
|
import { A as AnyDatabaseProvider } from './config-BxOimoGX.js';
|
|
7
7
|
export { R as ActorError, R as RivetError, a as RivetErrorLike, b as RivetErrorOptions, U as UserError, c as UserErrorOptions, n as noopNext } from './utils-CqDnC_PS.js';
|
|
8
8
|
import { WSContext } from 'hono/ws';
|
|
9
|
-
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-
|
|
9
|
+
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-AfCExwbr.js';
|
|
10
10
|
import 'zod/v4';
|
|
11
11
|
import '@rivetkit/rivetkit-wasm';
|
|
12
12
|
import 'zod';
|
package/dist/tsup/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeWorkflowHistoryTransport
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6ZPMYIZ6.js";
|
|
4
4
|
import {
|
|
5
5
|
ACTOR_CONTEXT_INTERNAL_SYMBOL,
|
|
6
6
|
ActorConfigSchema,
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
ALLOWED_PUBLIC_HEADERS,
|
|
18
18
|
HEADER_CONN_PARAMS,
|
|
19
|
-
HEADER_ORIGINAL_REQUEST_URL,
|
|
20
19
|
RemoteEngineControlClient,
|
|
21
20
|
convertRegistryConfigToClientConfig,
|
|
22
21
|
createClientWithDriver,
|
|
@@ -24,13 +23,13 @@ import {
|
|
|
24
23
|
isResponseLike,
|
|
25
24
|
tryParseEndpoint,
|
|
26
25
|
updateRunnerConfig
|
|
27
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-MMPE77KO.js";
|
|
28
27
|
import {
|
|
29
28
|
makePrefixedKey,
|
|
30
29
|
removePrefixFromKey
|
|
31
30
|
} from "./chunk-JI6GZ2C2.js";
|
|
32
31
|
import "./chunk-7AFZMFPQ.js";
|
|
33
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-5FVMFSBH.js";
|
|
34
33
|
import {
|
|
35
34
|
LogLevelSchema,
|
|
36
35
|
VERSION,
|
|
@@ -63,7 +62,7 @@ import {
|
|
|
63
62
|
parsePortEnv,
|
|
64
63
|
stringifyError,
|
|
65
64
|
toUint8Array
|
|
66
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-ET2F6BXK.js";
|
|
67
66
|
import {
|
|
68
67
|
INTERNAL_ERROR_CODE,
|
|
69
68
|
RivetError,
|
|
@@ -1441,30 +1440,16 @@ function toNapiApplication(application) {
|
|
|
1441
1440
|
if (!request) {
|
|
1442
1441
|
throw new Error("application fetch callback received no request");
|
|
1443
1442
|
}
|
|
1444
|
-
const response = await application(
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
cancelToken: request.cancelToken
|
|
1449
|
-
},
|
|
1450
|
-
request.responseBodyStream ? fromNapiHttpResponseBodyStream(
|
|
1451
|
-
request.responseBodyStream
|
|
1452
|
-
) : void 0
|
|
1453
|
-
);
|
|
1443
|
+
const response = await application({
|
|
1444
|
+
...request,
|
|
1445
|
+
body: new Uint8Array(request.body)
|
|
1446
|
+
});
|
|
1454
1447
|
return {
|
|
1455
1448
|
...response,
|
|
1456
|
-
body:
|
|
1449
|
+
body: toNapiBuffer(response.body)
|
|
1457
1450
|
};
|
|
1458
1451
|
};
|
|
1459
1452
|
}
|
|
1460
|
-
function fromNapiHttpResponseBodyStream(stream) {
|
|
1461
|
-
return {
|
|
1462
|
-
cancelled: () => stream.cancelled(),
|
|
1463
|
-
write: (chunk) => stream.write(Buffer.from(chunk)),
|
|
1464
|
-
end: () => stream.end(),
|
|
1465
|
-
error: (message) => stream.error(message)
|
|
1466
|
-
};
|
|
1467
|
-
}
|
|
1468
1453
|
function toNapiHttpRequest(request) {
|
|
1469
1454
|
if (!request) {
|
|
1470
1455
|
return request;
|
|
@@ -1977,137 +1962,6 @@ async function loadNapiRuntime() {
|
|
|
1977
1962
|
};
|
|
1978
1963
|
}
|
|
1979
1964
|
|
|
1980
|
-
// src/registry/native-http.ts
|
|
1981
|
-
var HTTP_BODY_CHUNK_SIZE = 64 * 1024;
|
|
1982
|
-
function runtimeBytesToArrayBuffer(value) {
|
|
1983
|
-
return value.buffer.slice(
|
|
1984
|
-
value.byteOffset,
|
|
1985
|
-
value.byteOffset + value.byteLength
|
|
1986
|
-
);
|
|
1987
|
-
}
|
|
1988
|
-
function buildNativeHttpRequest(init) {
|
|
1989
|
-
var _a;
|
|
1990
|
-
const headers = new Headers(init.headers);
|
|
1991
|
-
const originalUrl = headers.get(HEADER_ORIGINAL_REQUEST_URL);
|
|
1992
|
-
headers.delete(HEADER_ORIGINAL_REQUEST_URL);
|
|
1993
|
-
const url = originalUrl ?? (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString());
|
|
1994
|
-
const method2 = init.method.toUpperCase();
|
|
1995
|
-
const bodyForbidden = method2 === "GET" || method2 === "HEAD";
|
|
1996
|
-
const body = bodyForbidden ? void 0 : init.bodyStream ? new ReadableStream({
|
|
1997
|
-
async pull(controller) {
|
|
1998
|
-
var _a2, _b;
|
|
1999
|
-
try {
|
|
2000
|
-
if (init.body && init.body.length > 0) {
|
|
2001
|
-
controller.enqueue(new Uint8Array(init.body));
|
|
2002
|
-
init.body = void 0;
|
|
2003
|
-
return;
|
|
2004
|
-
}
|
|
2005
|
-
const chunk = await ((_a2 = init.bodyStream) == null ? void 0 : _a2.read());
|
|
2006
|
-
if (!chunk) {
|
|
2007
|
-
controller.close();
|
|
2008
|
-
} else {
|
|
2009
|
-
controller.enqueue(new Uint8Array(chunk));
|
|
2010
|
-
}
|
|
2011
|
-
} catch (error) {
|
|
2012
|
-
(_b = init.abortController) == null ? void 0 : _b.abort(error);
|
|
2013
|
-
controller.error(error);
|
|
2014
|
-
}
|
|
2015
|
-
},
|
|
2016
|
-
async cancel() {
|
|
2017
|
-
var _a2;
|
|
2018
|
-
await ((_a2 = init.bodyStream) == null ? void 0 : _a2.cancel());
|
|
2019
|
-
}
|
|
2020
|
-
}) : init.body && init.body.length > 0 ? runtimeBytesToArrayBuffer(init.body) : void 0;
|
|
2021
|
-
const streamInit = init.bodyStream && !bodyForbidden ? { duplex: "half" } : {};
|
|
2022
|
-
return new Request(url, {
|
|
2023
|
-
method: method2,
|
|
2024
|
-
headers,
|
|
2025
|
-
body,
|
|
2026
|
-
signal: ((_a = init.abortController) == null ? void 0 : _a.signal) ?? init.signal,
|
|
2027
|
-
...streamInit
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2030
|
-
async function cancelNativeHttpRequestBody(bodyStream) {
|
|
2031
|
-
await (bodyStream == null ? void 0 : bodyStream.cancel());
|
|
2032
|
-
}
|
|
2033
|
-
async function writeResponseChunk(stream, chunk) {
|
|
2034
|
-
for (let offset = 0; offset < chunk.byteLength; offset += HTTP_BODY_CHUNK_SIZE) {
|
|
2035
|
-
await stream.write(
|
|
2036
|
-
chunk.subarray(offset, offset + HTTP_BODY_CHUNK_SIZE)
|
|
2037
|
-
);
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
async function pumpResponseBody(reader, stream) {
|
|
2041
|
-
var _a;
|
|
2042
|
-
const cancelled = stream.cancelled().then(() => ({ cancelled: true }));
|
|
2043
|
-
try {
|
|
2044
|
-
for (; ; ) {
|
|
2045
|
-
const read = reader.read().then((next2) => ({ cancelled: false, next: next2 }));
|
|
2046
|
-
const result = await Promise.race([read, cancelled]);
|
|
2047
|
-
if (result.cancelled) {
|
|
2048
|
-
await reader.cancel(
|
|
2049
|
-
new Error("native http response stream receiver dropped")
|
|
2050
|
-
);
|
|
2051
|
-
return;
|
|
2052
|
-
}
|
|
2053
|
-
const { next } = result;
|
|
2054
|
-
if (next.done) {
|
|
2055
|
-
await stream.end();
|
|
2056
|
-
return;
|
|
2057
|
-
}
|
|
2058
|
-
if ((_a = next.value) == null ? void 0 : _a.byteLength) {
|
|
2059
|
-
await writeResponseChunk(stream, next.value);
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
} catch (error) {
|
|
2063
|
-
try {
|
|
2064
|
-
await stream.error(stringifyError(error));
|
|
2065
|
-
} catch (streamError) {
|
|
2066
|
-
logger2().debug({
|
|
2067
|
-
msg: "failed to report native http response stream error",
|
|
2068
|
-
error: streamError
|
|
2069
|
-
});
|
|
2070
|
-
}
|
|
2071
|
-
try {
|
|
2072
|
-
await reader.cancel(error);
|
|
2073
|
-
} catch {
|
|
2074
|
-
}
|
|
2075
|
-
} finally {
|
|
2076
|
-
reader.releaseLock();
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
async function convertNativeHttpResponse(response, responseBodyStream) {
|
|
2080
|
-
const headers = Object.fromEntries(response.headers.entries());
|
|
2081
|
-
if (!response.body) {
|
|
2082
|
-
return {
|
|
2083
|
-
response: {
|
|
2084
|
-
status: response.status,
|
|
2085
|
-
headers,
|
|
2086
|
-
body: new Uint8Array()
|
|
2087
|
-
}
|
|
2088
|
-
};
|
|
2089
|
-
}
|
|
2090
|
-
if (responseBodyStream) {
|
|
2091
|
-
const reader = response.body.getReader();
|
|
2092
|
-
const bodyCompletion = pumpResponseBody(reader, responseBodyStream);
|
|
2093
|
-
return {
|
|
2094
|
-
response: {
|
|
2095
|
-
status: response.status,
|
|
2096
|
-
headers,
|
|
2097
|
-
stream: true
|
|
2098
|
-
},
|
|
2099
|
-
bodyCompletion
|
|
2100
|
-
};
|
|
2101
|
-
}
|
|
2102
|
-
return {
|
|
2103
|
-
response: {
|
|
2104
|
-
status: response.status,
|
|
2105
|
-
headers,
|
|
2106
|
-
body: new Uint8Array(await response.arrayBuffer())
|
|
2107
|
-
}
|
|
2108
|
-
};
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
1965
|
// src/registry/native-validation.ts
|
|
2112
1966
|
var CONN_PARAMS_KEY = "__conn_params__";
|
|
2113
1967
|
function validateActionArgs(schemas, name, args) {
|
|
@@ -3242,7 +3096,7 @@ function toRuntimeBytes(value) {
|
|
|
3242
3096
|
function arrayBufferViewToRuntimeBytes(value) {
|
|
3243
3097
|
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
3244
3098
|
}
|
|
3245
|
-
function
|
|
3099
|
+
function runtimeBytesToArrayBuffer(value) {
|
|
3246
3100
|
return value.buffer.slice(
|
|
3247
3101
|
value.byteOffset,
|
|
3248
3102
|
value.byteOffset + value.byteLength
|
|
@@ -3572,6 +3426,24 @@ function decodeArgs(value) {
|
|
|
3572
3426
|
const decoded = decodeValue(value);
|
|
3573
3427
|
return normalizeArgs(decoded);
|
|
3574
3428
|
}
|
|
3429
|
+
function buildRequest(init) {
|
|
3430
|
+
const url = init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString();
|
|
3431
|
+
const body = init.body && init.body.length > 0 ? runtimeBytesToArrayBuffer(init.body) : void 0;
|
|
3432
|
+
return new Request(url, {
|
|
3433
|
+
method: init.method,
|
|
3434
|
+
headers: init.headers,
|
|
3435
|
+
body
|
|
3436
|
+
});
|
|
3437
|
+
}
|
|
3438
|
+
async function toRuntimeHttpResponse(response) {
|
|
3439
|
+
const headers = Object.fromEntries(response.headers.entries());
|
|
3440
|
+
const body = new Uint8Array(await response.arrayBuffer());
|
|
3441
|
+
return {
|
|
3442
|
+
status: response.status,
|
|
3443
|
+
headers,
|
|
3444
|
+
body
|
|
3445
|
+
};
|
|
3446
|
+
}
|
|
3575
3447
|
function toActorKey(segments) {
|
|
3576
3448
|
return segments.map(
|
|
3577
3449
|
(segment) => segment.kind === "number" ? String(segment.numberValue ?? 0) : segment.stringValue ?? ""
|
|
@@ -4236,7 +4108,7 @@ var NativeWebSocketAdapter = class {
|
|
|
4236
4108
|
this.#runtime.webSocketSetEventCallback(this.#ws, (event2) => {
|
|
4237
4109
|
if (event2.kind === "message") {
|
|
4238
4110
|
this.#virtual.triggerMessage(
|
|
4239
|
-
event2.binary ?
|
|
4111
|
+
event2.binary ? runtimeBytesToArrayBuffer(event2.data) : event2.data,
|
|
4240
4112
|
event2.messageIndex
|
|
4241
4113
|
);
|
|
4242
4114
|
return;
|
|
@@ -5468,14 +5340,12 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5468
5340
|
onStateChange,
|
|
5469
5341
|
cancelToken
|
|
5470
5342
|
);
|
|
5471
|
-
const maybeHandleNativeInspectorRequest = async (ctx,
|
|
5343
|
+
const maybeHandleNativeInspectorRequest = async (ctx, _rawRequest, jsRequest) => {
|
|
5472
5344
|
var _a2, _b, _c, _d;
|
|
5473
|
-
const
|
|
5474
|
-
const url = new URL(rawUrl);
|
|
5345
|
+
const url = new URL(jsRequest.url);
|
|
5475
5346
|
if (!url.pathname.startsWith("/inspector/")) {
|
|
5476
5347
|
return void 0;
|
|
5477
5348
|
}
|
|
5478
|
-
const jsRequest = buildNativeHttpRequest(rawRequest);
|
|
5479
5349
|
const jsonResponse = (body, init) => new Response(JSON.stringify(body), {
|
|
5480
5350
|
status: (init == null ? void 0 : init.status) ?? 200,
|
|
5481
5351
|
headers: {
|
|
@@ -6006,7 +5876,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6006
5876
|
);
|
|
6007
5877
|
const actorCtx = makeActorCtx(
|
|
6008
5878
|
ctx,
|
|
6009
|
-
request ?
|
|
5879
|
+
request ? buildRequest(request) : void 0
|
|
6010
5880
|
);
|
|
6011
5881
|
try {
|
|
6012
5882
|
await config.onBeforeConnect(
|
|
@@ -6026,7 +5896,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6026
5896
|
const { ctx, conn, params, request } = unwrapTsfnPayload(error, payload);
|
|
6027
5897
|
const actorCtx = makeActorCtx(
|
|
6028
5898
|
ctx,
|
|
6029
|
-
request ?
|
|
5899
|
+
request ? buildRequest(request) : void 0
|
|
6030
5900
|
);
|
|
6031
5901
|
const connAdapter = new NativeConnAdapter(
|
|
6032
5902
|
runtime,
|
|
@@ -6063,7 +5933,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6063
5933
|
);
|
|
6064
5934
|
const actorCtx = makeActorCtx(
|
|
6065
5935
|
ctx,
|
|
6066
|
-
request ?
|
|
5936
|
+
request ? buildRequest(request) : void 0
|
|
6067
5937
|
);
|
|
6068
5938
|
const connAdapter = new NativeConnAdapter(
|
|
6069
5939
|
runtime,
|
|
@@ -6168,45 +6038,27 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6168
6038
|
onRequest: wrapNativeCallback(
|
|
6169
6039
|
async (error, payload) => {
|
|
6170
6040
|
try {
|
|
6171
|
-
const { ctx, request, cancelToken
|
|
6172
|
-
|
|
6041
|
+
const { ctx, request, cancelToken } = unwrapTsfnPayload(
|
|
6042
|
+
error,
|
|
6043
|
+
payload
|
|
6044
|
+
);
|
|
6045
|
+
const jsRequest = buildRequest(request);
|
|
6046
|
+
const inspectorResponse = await maybeHandleNativeInspectorRequest(
|
|
6047
|
+
ctx,
|
|
6048
|
+
request,
|
|
6049
|
+
jsRequest
|
|
6050
|
+
);
|
|
6173
6051
|
if (inspectorResponse) {
|
|
6174
|
-
await
|
|
6175
|
-
return (await convertNativeHttpResponse(
|
|
6176
|
-
inspectorResponse,
|
|
6177
|
-
responseBodyStream
|
|
6178
|
-
)).response;
|
|
6052
|
+
return await toRuntimeHttpResponse(inspectorResponse);
|
|
6179
6053
|
}
|
|
6180
6054
|
if (typeof config.onRequest !== "function") {
|
|
6181
|
-
await
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
responseBodyStream
|
|
6185
|
-
)).response;
|
|
6055
|
+
return await toRuntimeHttpResponse(
|
|
6056
|
+
new Response(null, { status: 404 })
|
|
6057
|
+
);
|
|
6186
6058
|
}
|
|
6187
|
-
const
|
|
6188
|
-
const handlerRequest = buildNativeHttpRequest({
|
|
6189
|
-
...request,
|
|
6190
|
-
abortController: requestAbortController
|
|
6191
|
-
});
|
|
6192
|
-
const rawConnParams = handlerRequest.headers.get(HEADER_CONN_PARAMS);
|
|
6059
|
+
const rawConnParams = jsRequest.headers.get(HEADER_CONN_PARAMS);
|
|
6193
6060
|
let requestCtx;
|
|
6194
6061
|
let conn;
|
|
6195
|
-
let removeRequestAbortListener;
|
|
6196
|
-
let cleanupDeferredToBody = false;
|
|
6197
|
-
let cleanedUp = false;
|
|
6198
|
-
const cleanupRequest = async () => {
|
|
6199
|
-
if (cleanedUp) return;
|
|
6200
|
-
cleanedUp = true;
|
|
6201
|
-
removeRequestAbortListener == null ? void 0 : removeRequestAbortListener();
|
|
6202
|
-
try {
|
|
6203
|
-
await (requestCtx == null ? void 0 : requestCtx.dispose());
|
|
6204
|
-
} finally {
|
|
6205
|
-
if (conn) {
|
|
6206
|
-
await runtime.connDisconnect(conn);
|
|
6207
|
-
}
|
|
6208
|
-
}
|
|
6209
|
-
};
|
|
6210
6062
|
try {
|
|
6211
6063
|
const connParams = validateConnParams(
|
|
6212
6064
|
schemaConfig.connParamsSchema,
|
|
@@ -6222,56 +6074,23 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6222
6074
|
requestCtx = makeConnCtx(
|
|
6223
6075
|
ctx,
|
|
6224
6076
|
conn,
|
|
6225
|
-
|
|
6077
|
+
jsRequest,
|
|
6226
6078
|
cancelToken
|
|
6227
6079
|
);
|
|
6228
|
-
const ctxAbortSignal = requestCtx.abortSignal;
|
|
6229
|
-
const abortRequest = () => requestAbortController.abort(ctxAbortSignal.reason);
|
|
6230
|
-
if (ctxAbortSignal.aborted) {
|
|
6231
|
-
abortRequest();
|
|
6232
|
-
} else {
|
|
6233
|
-
ctxAbortSignal.addEventListener(
|
|
6234
|
-
"abort",
|
|
6235
|
-
abortRequest,
|
|
6236
|
-
{ once: true }
|
|
6237
|
-
);
|
|
6238
|
-
removeRequestAbortListener = () => ctxAbortSignal.removeEventListener(
|
|
6239
|
-
"abort",
|
|
6240
|
-
abortRequest
|
|
6241
|
-
);
|
|
6242
|
-
}
|
|
6243
6080
|
const response = await config.onRequest(
|
|
6244
6081
|
requestCtx,
|
|
6245
|
-
|
|
6082
|
+
jsRequest
|
|
6246
6083
|
);
|
|
6247
6084
|
if (!isResponseLike(response)) {
|
|
6248
6085
|
throw new Error(
|
|
6249
6086
|
"onRequest handler must return a Response"
|
|
6250
6087
|
);
|
|
6251
6088
|
}
|
|
6252
|
-
|
|
6253
|
-
response,
|
|
6254
|
-
responseBodyStream
|
|
6255
|
-
);
|
|
6256
|
-
if (conversion.bodyCompletion) {
|
|
6257
|
-
cleanupDeferredToBody = true;
|
|
6258
|
-
void conversion.bodyCompletion.then(cleanupRequest).catch((cleanupError) => {
|
|
6259
|
-
logger2().error({
|
|
6260
|
-
msg: "failed to clean up native streaming http request",
|
|
6261
|
-
error: cleanupError
|
|
6262
|
-
});
|
|
6263
|
-
});
|
|
6264
|
-
}
|
|
6265
|
-
return conversion.response;
|
|
6089
|
+
return await toRuntimeHttpResponse(response);
|
|
6266
6090
|
} finally {
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
);
|
|
6271
|
-
} finally {
|
|
6272
|
-
if (!cleanupDeferredToBody) {
|
|
6273
|
-
await cleanupRequest();
|
|
6274
|
-
}
|
|
6091
|
+
await (requestCtx == null ? void 0 : requestCtx.dispose());
|
|
6092
|
+
if (conn) {
|
|
6093
|
+
await runtime.connDisconnect(conn);
|
|
6275
6094
|
}
|
|
6276
6095
|
}
|
|
6277
6096
|
} catch (error2) {
|
|
@@ -6286,7 +6105,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6286
6105
|
onWebSocket: typeof config.onWebSocket === "function" ? wrapNativeCallback(
|
|
6287
6106
|
async (error, payload) => {
|
|
6288
6107
|
const { ctx, conn, ws, request } = unwrapTsfnPayload(error, payload);
|
|
6289
|
-
const jsRequest = request ?
|
|
6108
|
+
const jsRequest = request ? buildRequest(request) : void 0;
|
|
6290
6109
|
const actorCtx = makeConnCtx(ctx, conn, jsRequest);
|
|
6291
6110
|
try {
|
|
6292
6111
|
await config.onWebSocket(
|
|
@@ -6383,7 +6202,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6383
6202
|
timeoutMs,
|
|
6384
6203
|
cancelToken
|
|
6385
6204
|
} = unwrapTsfnPayload(error, payload);
|
|
6386
|
-
const jsRequest =
|
|
6205
|
+
const jsRequest = buildRequest(request);
|
|
6387
6206
|
const actorCtx = withConnContext(
|
|
6388
6207
|
runtime,
|
|
6389
6208
|
ctx,
|
|
@@ -6534,27 +6353,15 @@ function finishShutdownSignal(signal) {
|
|
|
6534
6353
|
}
|
|
6535
6354
|
process.kill(process.pid, signal);
|
|
6536
6355
|
}
|
|
6537
|
-
function createApplicationFetch(application
|
|
6538
|
-
return async (request
|
|
6356
|
+
function createApplicationFetch(application) {
|
|
6357
|
+
return async (request) => {
|
|
6539
6358
|
const method2 = request.method.toUpperCase();
|
|
6540
6359
|
const body = method2 === "GET" || method2 === "HEAD" || request.body.length === 0 ? void 0 : Uint8Array.from(request.body).buffer;
|
|
6541
|
-
const abortController = new AbortController();
|
|
6542
|
-
if (request.cancelToken) {
|
|
6543
|
-
if (runtime.cancellationTokenAborted(request.cancelToken)) {
|
|
6544
|
-
abortController.abort();
|
|
6545
|
-
} else {
|
|
6546
|
-
runtime.onCancellationTokenCancelled(
|
|
6547
|
-
request.cancelToken,
|
|
6548
|
-
() => abortController.abort()
|
|
6549
|
-
);
|
|
6550
|
-
}
|
|
6551
|
-
}
|
|
6552
6360
|
const response = await application.fetch(
|
|
6553
6361
|
new Request(request.url, {
|
|
6554
6362
|
method: method2,
|
|
6555
6363
|
headers: request.headers,
|
|
6556
|
-
body
|
|
6557
|
-
signal: abortController.signal
|
|
6364
|
+
body
|
|
6558
6365
|
})
|
|
6559
6366
|
);
|
|
6560
6367
|
if (!isResponseLike(response)) {
|
|
@@ -6562,23 +6369,10 @@ function createApplicationFetch(application, runtime) {
|
|
|
6562
6369
|
"registry.listen() application fetch must return a Response"
|
|
6563
6370
|
);
|
|
6564
6371
|
}
|
|
6565
|
-
const conversion = await convertNativeHttpResponse(
|
|
6566
|
-
response,
|
|
6567
|
-
responseBodyStream
|
|
6568
|
-
);
|
|
6569
|
-
if (conversion.bodyCompletion) {
|
|
6570
|
-
void conversion.bodyCompletion.catch((error) => {
|
|
6571
|
-
logger2().error({
|
|
6572
|
-
msg: "application response stream failed",
|
|
6573
|
-
error
|
|
6574
|
-
});
|
|
6575
|
-
});
|
|
6576
|
-
}
|
|
6577
6372
|
return {
|
|
6578
|
-
status:
|
|
6579
|
-
headers:
|
|
6580
|
-
body:
|
|
6581
|
-
stream: conversion.response.stream
|
|
6373
|
+
status: response.status,
|
|
6374
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
6375
|
+
body: new Uint8Array(await response.arrayBuffer())
|
|
6582
6376
|
};
|
|
6583
6377
|
};
|
|
6584
6378
|
}
|
|
@@ -6836,7 +6630,8 @@ var Registry = class {
|
|
|
6836
6630
|
const port = opts.port ?? parsePortEnv(process.env.RIVET_PORT) ?? 3e3;
|
|
6837
6631
|
const publicDir = opts.publicDir ?? getRivetkitPublicDir();
|
|
6838
6632
|
const config = this.parseConfig();
|
|
6839
|
-
|
|
6633
|
+
const application = opts.application ? createApplicationFetch(opts.application) : void 0;
|
|
6634
|
+
if (application && getRivetkitRuntimeMode() !== "serverless") {
|
|
6840
6635
|
if (config.runtime === "wasm") {
|
|
6841
6636
|
throw new Error(
|
|
6842
6637
|
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
@@ -6855,18 +6650,13 @@ var Registry = class {
|
|
|
6855
6650
|
throw new Error("registry envoy startup did not initialize");
|
|
6856
6651
|
}
|
|
6857
6652
|
const { runtime: runtime2, registry: registry2, serveConfig: serveConfig2 } = await configuredRegistryPromise2;
|
|
6858
|
-
const application2 = createApplicationFetch(
|
|
6859
|
-
opts.application,
|
|
6860
|
-
runtime2
|
|
6861
|
-
);
|
|
6862
|
-
await readyPromise;
|
|
6863
6653
|
const listenerPromise = runtime2.serveApplicationListener(
|
|
6864
6654
|
registry2,
|
|
6865
6655
|
{
|
|
6866
6656
|
port,
|
|
6867
6657
|
host: opts.host,
|
|
6868
6658
|
publicDir,
|
|
6869
|
-
application
|
|
6659
|
+
application
|
|
6870
6660
|
},
|
|
6871
6661
|
serveConfig2
|
|
6872
6662
|
);
|
|
@@ -6878,12 +6668,13 @@ var Registry = class {
|
|
|
6878
6668
|
);
|
|
6879
6669
|
}
|
|
6880
6670
|
await Promise.all([
|
|
6671
|
+
readyPromise,
|
|
6881
6672
|
listenerPromise,
|
|
6882
6673
|
serveLifecyclePromise
|
|
6883
6674
|
]);
|
|
6884
6675
|
return;
|
|
6885
6676
|
}
|
|
6886
|
-
const configuredRegistryPromise =
|
|
6677
|
+
const configuredRegistryPromise = buildConfiguredRegistry(config);
|
|
6887
6678
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
6888
6679
|
this.#runtimeServerlessPromise = configuredRegistryPromise;
|
|
6889
6680
|
this.#installSignalHandlers(config);
|
|
@@ -6894,7 +6685,6 @@ var Registry = class {
|
|
|
6894
6685
|
});
|
|
6895
6686
|
this.#ensureServerlessPoolConfigured(config);
|
|
6896
6687
|
const { runtime, registry, serveConfig } = await configuredRegistryPromise;
|
|
6897
|
-
const application = opts.application ? createApplicationFetch(opts.application, runtime) : void 0;
|
|
6898
6688
|
await runtime.serveListener(
|
|
6899
6689
|
registry,
|
|
6900
6690
|
{
|