rivetkit 2.3.10 → 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 +24 -6
- package/dist/browser/client.js +18 -4
- 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 +24 -6
- package/dist/tsup/agent-os/index.d.ts +24 -6
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-PCJSDS7N.cjs → chunk-57ZE43T5.cjs} +3 -3
- package/dist/tsup/{chunk-PCJSDS7N.cjs.map → chunk-57ZE43T5.cjs.map} +1 -1
- package/dist/tsup/{chunk-Q5H37KNQ.js → chunk-5FVMFSBH.js} +2 -2
- package/dist/tsup/{chunk-E6IEX6AP.js → chunk-5ZS22TOP.js} +3 -3
- package/dist/tsup/{chunk-XSPAARQ5.js → chunk-6ZPMYIZ6.js} +2 -2
- package/dist/tsup/{chunk-X7XY6NCU.js → chunk-ET2F6BXK.js} +6 -3
- package/dist/tsup/chunk-ET2F6BXK.js.map +1 -0
- package/dist/tsup/{chunk-INXPYXN6.cjs → chunk-JAQHV6LB.cjs} +7 -7
- package/dist/tsup/{chunk-INXPYXN6.cjs.map → chunk-JAQHV6LB.cjs.map} +1 -1
- package/dist/tsup/{chunk-G6XA2OSW.cjs → chunk-K4DNAIWT.cjs} +4 -4
- package/dist/tsup/{chunk-G6XA2OSW.cjs.map → chunk-K4DNAIWT.cjs.map} +1 -1
- package/dist/tsup/{chunk-6UHZLL6S.js → chunk-L4DYLD7P.js} +3 -3
- package/dist/tsup/{chunk-DPM73GAL.js → chunk-MMPE77KO.js} +20 -5
- package/dist/tsup/chunk-MMPE77KO.js.map +1 -0
- package/dist/tsup/{chunk-Z2ESFE5Z.cjs → chunk-TWNMQDZK.cjs} +6 -3
- package/dist/tsup/chunk-TWNMQDZK.cjs.map +1 -0
- package/dist/tsup/{chunk-LCWHS6K7.cjs → chunk-W2YEXCCJ.cjs} +156 -141
- package/dist/tsup/chunk-W2YEXCCJ.cjs.map +1 -0
- package/dist/tsup/{chunk-U2A3Y7OK.cjs → chunk-XEOPXHN2.cjs} +9 -9
- package/dist/tsup/{chunk-U2A3Y7OK.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-BRpVbJCD.d.ts → config-BKAMOHez.d.ts} +25 -7
- package/dist/tsup/{config-BobvQpex.d.cts → config-Caocy3Z9.d.cts} +25 -7
- package/dist/tsup/{context-Cj-DFyiy.d.ts → context-AfCExwbr.d.ts} +1 -1
- package/dist/tsup/{context-YEBNJrws.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 +187 -72
- 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 +129 -14
- 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/raw-utils.ts +3 -2
- package/src/common/encoding.ts +4 -1
- package/src/common/fetch-like.ts +49 -0
- package/src/registry/index.ts +117 -12
- package/src/registry/napi-runtime.ts +47 -0
- package/src/registry/native.ts +3 -2
- package/src/registry/runtime.ts +21 -0
- package/src/registry/wasm-runtime.ts +11 -0
- package/dist/tsup/chunk-DPM73GAL.js.map +0 -1
- package/dist/tsup/chunk-LCWHS6K7.cjs.map +0 -1
- package/dist/tsup/chunk-X7XY6NCU.js.map +0 -1
- package/dist/tsup/chunk-Z2ESFE5Z.cjs.map +0 -1
- /package/dist/tsup/{chunk-Q5H37KNQ.js.map → chunk-5FVMFSBH.js.map} +0 -0
- /package/dist/tsup/{chunk-E6IEX6AP.js.map → chunk-5ZS22TOP.js.map} +0 -0
- /package/dist/tsup/{chunk-XSPAARQ5.js.map → chunk-6ZPMYIZ6.js.map} +0 -0
- /package/dist/tsup/{chunk-6UHZLL6S.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
|
|
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
|
|
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,
|
|
@@ -20,15 +20,16 @@ import {
|
|
|
20
20
|
convertRegistryConfigToClientConfig,
|
|
21
21
|
createClientWithDriver,
|
|
22
22
|
getDatacenters,
|
|
23
|
+
isResponseLike,
|
|
23
24
|
tryParseEndpoint,
|
|
24
25
|
updateRunnerConfig
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-MMPE77KO.js";
|
|
26
27
|
import {
|
|
27
28
|
makePrefixedKey,
|
|
28
29
|
removePrefixFromKey
|
|
29
30
|
} from "./chunk-JI6GZ2C2.js";
|
|
30
31
|
import "./chunk-7AFZMFPQ.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-5FVMFSBH.js";
|
|
32
33
|
import {
|
|
33
34
|
LogLevelSchema,
|
|
34
35
|
VERSION,
|
|
@@ -61,7 +62,7 @@ import {
|
|
|
61
62
|
parsePortEnv,
|
|
62
63
|
stringifyError,
|
|
63
64
|
toUint8Array
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-ET2F6BXK.js";
|
|
65
66
|
import {
|
|
66
67
|
INTERNAL_ERROR_CODE,
|
|
67
68
|
RivetError,
|
|
@@ -1433,6 +1434,22 @@ function toNapiSqlBatchStatement(statement) {
|
|
|
1433
1434
|
function toNapiBuffer(value) {
|
|
1434
1435
|
return Buffer.from(value);
|
|
1435
1436
|
}
|
|
1437
|
+
function toNapiApplication(application) {
|
|
1438
|
+
return async (error, request) => {
|
|
1439
|
+
if (error) throw error;
|
|
1440
|
+
if (!request) {
|
|
1441
|
+
throw new Error("application fetch callback received no request");
|
|
1442
|
+
}
|
|
1443
|
+
const response = await application({
|
|
1444
|
+
...request,
|
|
1445
|
+
body: new Uint8Array(request.body)
|
|
1446
|
+
});
|
|
1447
|
+
return {
|
|
1448
|
+
...response,
|
|
1449
|
+
body: toNapiBuffer(response.body)
|
|
1450
|
+
};
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1436
1453
|
function toNapiHttpRequest(request) {
|
|
1437
1454
|
if (!request) {
|
|
1438
1455
|
return request;
|
|
@@ -1539,12 +1556,25 @@ var NapiCoreRuntime = class {
|
|
|
1539
1556
|
);
|
|
1540
1557
|
}
|
|
1541
1558
|
async serveListener(registry, listener, config) {
|
|
1559
|
+
const application = listener.application ? toNapiApplication(listener.application) : void 0;
|
|
1542
1560
|
await asNativeRegistry(registry).serveListener(
|
|
1543
1561
|
{
|
|
1544
1562
|
port: listener.port,
|
|
1545
1563
|
host: listener.host,
|
|
1546
1564
|
publicDir: listener.publicDir
|
|
1547
1565
|
},
|
|
1566
|
+
config,
|
|
1567
|
+
application
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
async serveApplicationListener(registry, listener, config) {
|
|
1571
|
+
await asNativeRegistry(registry).serveApplicationListener(
|
|
1572
|
+
{
|
|
1573
|
+
port: listener.port,
|
|
1574
|
+
host: listener.host,
|
|
1575
|
+
publicDir: listener.publicDir
|
|
1576
|
+
},
|
|
1577
|
+
toNapiApplication(listener.application),
|
|
1548
1578
|
config
|
|
1549
1579
|
);
|
|
1550
1580
|
}
|
|
@@ -2204,6 +2234,11 @@ var WasmCoreRuntime = class {
|
|
|
2204
2234
|
"registry.listen() is not supported on the wasm runtime; use registry.serve() and mount the handler in your platform's HTTP server instead"
|
|
2205
2235
|
);
|
|
2206
2236
|
}
|
|
2237
|
+
async serveApplicationListener(_registry, _listener, _config) {
|
|
2238
|
+
throw new Error(
|
|
2239
|
+
"registry.listen() is not supported on the wasm runtime; use an application-owned HTTP server instead"
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2207
2242
|
createActorFactory(callbacks, config) {
|
|
2208
2243
|
return callWasmSync(
|
|
2209
2244
|
() => asActorFactoryHandle2(
|
|
@@ -6046,7 +6081,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6046
6081
|
requestCtx,
|
|
6047
6082
|
jsRequest
|
|
6048
6083
|
);
|
|
6049
|
-
if (!(response
|
|
6084
|
+
if (!isResponseLike(response)) {
|
|
6050
6085
|
throw new Error(
|
|
6051
6086
|
"onRequest handler must return a Response"
|
|
6052
6087
|
);
|
|
@@ -6318,6 +6353,29 @@ function finishShutdownSignal(signal) {
|
|
|
6318
6353
|
}
|
|
6319
6354
|
process.kill(process.pid, signal);
|
|
6320
6355
|
}
|
|
6356
|
+
function createApplicationFetch(application) {
|
|
6357
|
+
return async (request) => {
|
|
6358
|
+
const method2 = request.method.toUpperCase();
|
|
6359
|
+
const body = method2 === "GET" || method2 === "HEAD" || request.body.length === 0 ? void 0 : Uint8Array.from(request.body).buffer;
|
|
6360
|
+
const response = await application.fetch(
|
|
6361
|
+
new Request(request.url, {
|
|
6362
|
+
method: method2,
|
|
6363
|
+
headers: request.headers,
|
|
6364
|
+
body
|
|
6365
|
+
})
|
|
6366
|
+
);
|
|
6367
|
+
if (!isResponseLike(response)) {
|
|
6368
|
+
throw new TypeError(
|
|
6369
|
+
"registry.listen() application fetch must return a Response"
|
|
6370
|
+
);
|
|
6371
|
+
}
|
|
6372
|
+
return {
|
|
6373
|
+
status: response.status,
|
|
6374
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
6375
|
+
body: new Uint8Array(await response.arrayBuffer())
|
|
6376
|
+
};
|
|
6377
|
+
};
|
|
6378
|
+
}
|
|
6321
6379
|
var Registry = class {
|
|
6322
6380
|
#config;
|
|
6323
6381
|
#buildConfiguredRegistry;
|
|
@@ -6333,6 +6391,7 @@ var Registry = class {
|
|
|
6333
6391
|
#runtimeReadyPromise;
|
|
6334
6392
|
#runtimeServeConfiguredPromise;
|
|
6335
6393
|
#runtimeServerlessPromise;
|
|
6394
|
+
#applicationListenerPromise;
|
|
6336
6395
|
#configureServerlessPoolPromise;
|
|
6337
6396
|
#welcomePrinted = false;
|
|
6338
6397
|
#shutdownInstalled = false;
|
|
@@ -6558,17 +6617,63 @@ var Registry = class {
|
|
|
6558
6617
|
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
6559
6618
|
* @param opts.publicDir If set, serves static files from this directory
|
|
6560
6619
|
* as a fallback below the framework routes.
|
|
6620
|
+
* @param opts.application If set, handles requests that do not match a
|
|
6621
|
+
* framework route.
|
|
6561
6622
|
*
|
|
6562
6623
|
* @example
|
|
6563
6624
|
* ```ts
|
|
6564
6625
|
* await registry.listen();
|
|
6565
|
-
* await registry.listen({
|
|
6626
|
+
* await registry.listen({ application: app });
|
|
6566
6627
|
* ```
|
|
6567
6628
|
*/
|
|
6568
6629
|
async listen(opts = {}) {
|
|
6569
6630
|
const port = opts.port ?? parsePortEnv(process.env.RIVET_PORT) ?? 3e3;
|
|
6570
6631
|
const publicDir = opts.publicDir ?? getRivetkitPublicDir();
|
|
6571
6632
|
const config = this.parseConfig();
|
|
6633
|
+
const application = opts.application ? createApplicationFetch(opts.application) : void 0;
|
|
6634
|
+
if (application && getRivetkitRuntimeMode() !== "serverless") {
|
|
6635
|
+
if (config.runtime === "wasm") {
|
|
6636
|
+
throw new Error(
|
|
6637
|
+
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
6638
|
+
);
|
|
6639
|
+
}
|
|
6640
|
+
this.#installSignalHandlers(config);
|
|
6641
|
+
this.#printWelcome(config, "serverful", {
|
|
6642
|
+
port,
|
|
6643
|
+
host: opts.host,
|
|
6644
|
+
publicDir
|
|
6645
|
+
});
|
|
6646
|
+
this.#startEnvoy(config, true);
|
|
6647
|
+
const readyPromise = this.startAndWait();
|
|
6648
|
+
const configuredRegistryPromise2 = this.#runtimeServeConfiguredPromise;
|
|
6649
|
+
if (!configuredRegistryPromise2) {
|
|
6650
|
+
throw new Error("registry envoy startup did not initialize");
|
|
6651
|
+
}
|
|
6652
|
+
const { runtime: runtime2, registry: registry2, serveConfig: serveConfig2 } = await configuredRegistryPromise2;
|
|
6653
|
+
const listenerPromise = runtime2.serveApplicationListener(
|
|
6654
|
+
registry2,
|
|
6655
|
+
{
|
|
6656
|
+
port,
|
|
6657
|
+
host: opts.host,
|
|
6658
|
+
publicDir,
|
|
6659
|
+
application
|
|
6660
|
+
},
|
|
6661
|
+
serveConfig2
|
|
6662
|
+
);
|
|
6663
|
+
this.#applicationListenerPromise = listenerPromise;
|
|
6664
|
+
const serveLifecyclePromise = this.#runtimeServeLifecyclePromise;
|
|
6665
|
+
if (!serveLifecyclePromise) {
|
|
6666
|
+
throw new Error(
|
|
6667
|
+
"registry envoy serve lifecycle did not initialize"
|
|
6668
|
+
);
|
|
6669
|
+
}
|
|
6670
|
+
await Promise.all([
|
|
6671
|
+
readyPromise,
|
|
6672
|
+
listenerPromise,
|
|
6673
|
+
serveLifecyclePromise
|
|
6674
|
+
]);
|
|
6675
|
+
return;
|
|
6676
|
+
}
|
|
6572
6677
|
const configuredRegistryPromise = buildConfiguredRegistry(config);
|
|
6573
6678
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
6574
6679
|
this.#runtimeServerlessPromise = configuredRegistryPromise;
|
|
@@ -6582,7 +6687,12 @@ var Registry = class {
|
|
|
6582
6687
|
const { runtime, registry, serveConfig } = await configuredRegistryPromise;
|
|
6583
6688
|
await runtime.serveListener(
|
|
6584
6689
|
registry,
|
|
6585
|
-
{
|
|
6690
|
+
{
|
|
6691
|
+
port,
|
|
6692
|
+
host: opts.host,
|
|
6693
|
+
publicDir,
|
|
6694
|
+
application
|
|
6695
|
+
},
|
|
6586
6696
|
serveConfig
|
|
6587
6697
|
);
|
|
6588
6698
|
}
|
|
@@ -6682,11 +6792,9 @@ var Registry = class {
|
|
|
6682
6792
|
await runtime.serveRegistry(registry, serveConfig);
|
|
6683
6793
|
}
|
|
6684
6794
|
);
|
|
6685
|
-
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch(
|
|
6686
|
-
(
|
|
6687
|
-
|
|
6688
|
-
}
|
|
6689
|
-
);
|
|
6795
|
+
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch((error) => {
|
|
6796
|
+
logger2().warn({ error }, "runtime registry serve errored");
|
|
6797
|
+
});
|
|
6690
6798
|
this.#installSignalHandlers(config);
|
|
6691
6799
|
}
|
|
6692
6800
|
if (printWelcome) {
|
|
@@ -6793,6 +6901,9 @@ var Registry = class {
|
|
|
6793
6901
|
if (runtimeServePromise !== void 0) {
|
|
6794
6902
|
await runtimeServePromise.catch(() => void 0);
|
|
6795
6903
|
}
|
|
6904
|
+
if (this.#applicationListenerPromise !== void 0) {
|
|
6905
|
+
await this.#applicationListenerPromise.catch(() => void 0);
|
|
6906
|
+
}
|
|
6796
6907
|
};
|
|
6797
6908
|
await Promise.race([
|
|
6798
6909
|
drain(),
|
|
@@ -6843,7 +6954,9 @@ var Registry = class {
|
|
|
6843
6954
|
startAndWait() {
|
|
6844
6955
|
if (this.#shutdownInFlight !== null) {
|
|
6845
6956
|
return Promise.reject(
|
|
6846
|
-
new Error(
|
|
6957
|
+
new Error(
|
|
6958
|
+
"registry.startAndWait() cannot run after shutdown has begun"
|
|
6959
|
+
)
|
|
6847
6960
|
);
|
|
6848
6961
|
}
|
|
6849
6962
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
@@ -6884,7 +6997,9 @@ var Registry = class {
|
|
|
6884
6997
|
const readinessPromise = (async () => {
|
|
6885
6998
|
const { runtime, registry } = await configuredRegistryPromise;
|
|
6886
6999
|
const stoppedBeforeReady = serveLifecyclePromise.then(() => {
|
|
6887
|
-
throw new Error(
|
|
7000
|
+
throw new Error(
|
|
7001
|
+
"RivetKit registry stopped before becoming ready"
|
|
7002
|
+
);
|
|
6888
7003
|
});
|
|
6889
7004
|
await Promise.race([
|
|
6890
7005
|
runtime.waitRegistryReady(registry),
|