rivetkit 0.0.0-sqlite-sync-3-0-1-final.5663d2f → 0.0.0-sqlite-sync-3-0-6-final.cf8679c
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 +103 -27
- package/dist/browser/client.js +2 -2
- 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/{chunk-DGU2H5IJ.cjs → chunk-275ZGRSG.cjs} +3 -3
- package/dist/tsup/{chunk-DGU2H5IJ.cjs.map → chunk-275ZGRSG.cjs.map} +1 -1
- package/dist/tsup/{chunk-X567WA3N.cjs → chunk-E54YPM4V.cjs} +10 -10
- package/dist/tsup/{chunk-X567WA3N.cjs.map → chunk-E54YPM4V.cjs.map} +1 -1
- package/dist/tsup/{chunk-6UDO6UYM.cjs → chunk-I26AW6BG.cjs} +2 -2
- package/dist/tsup/{chunk-6UDO6UYM.cjs.map → chunk-I26AW6BG.cjs.map} +1 -1
- package/dist/tsup/{chunk-C2NON6V4.cjs → chunk-JHHUCWBC.cjs} +7 -7
- package/dist/tsup/{chunk-C2NON6V4.cjs.map → chunk-JHHUCWBC.cjs.map} +1 -1
- package/dist/tsup/{chunk-XLD6TRSE.cjs → chunk-LYXPQB6H.cjs} +3 -3
- package/dist/tsup/{chunk-XLD6TRSE.cjs.map → chunk-LYXPQB6H.cjs.map} +1 -1
- package/dist/tsup/{chunk-DU7V4SDK.js → chunk-M72ZKQ7R.js} +2 -2
- package/dist/tsup/{chunk-DU7V4SDK.js.map → chunk-M72ZKQ7R.js.map} +1 -1
- package/dist/tsup/{chunk-3ZKCK6NL.js → chunk-ME74LHJM.js} +7 -7
- package/dist/tsup/chunk-ME74LHJM.js.map +1 -0
- package/dist/tsup/{chunk-UXDASKP6.js → chunk-PBIQPYE5.js} +12 -13
- package/dist/tsup/chunk-PBIQPYE5.js.map +1 -0
- package/dist/tsup/{chunk-TTMWSZZA.js → chunk-R4QCQBB4.js} +2 -2
- package/dist/tsup/{chunk-GAFMEUAL.js → chunk-RJ7WDGOJ.js} +3 -3
- package/dist/tsup/{chunk-YJ2X5STT.cjs → chunk-SJJWJU26.cjs} +145 -145
- package/dist/tsup/chunk-SJJWJU26.cjs.map +1 -0
- package/dist/tsup/{chunk-SEKTNJU6.js → chunk-SSMFNH4N.js} +4 -4
- package/dist/tsup/{chunk-EKERHPCE.cjs → chunk-TKCX6KNZ.cjs} +4 -4
- package/dist/tsup/{chunk-EKERHPCE.cjs.map → chunk-TKCX6KNZ.cjs.map} +1 -1
- package/dist/tsup/{chunk-G26OT2Q6.cjs → chunk-TVBQQXQE.cjs} +3 -3
- package/dist/tsup/{chunk-G26OT2Q6.cjs.map → chunk-TVBQQXQE.cjs.map} +1 -1
- package/dist/tsup/{chunk-YNAEH775.js → chunk-VXVJHTW6.js} +2 -2
- package/dist/tsup/{chunk-MT4SROQM.js → chunk-XATHAIZX.js} +2 -2
- package/dist/tsup/{chunk-T7DJZSPH.js → chunk-Y5TV6V5Z.js} +2 -2
- package/dist/tsup/{chunk-SSF2XC33.cjs → chunk-YWWDUC6D.cjs} +12 -13
- package/dist/tsup/chunk-YWWDUC6D.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +3 -3
- package/dist/tsup/client/mod.d.ts +3 -3
- 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-RMLak20L.d.cts → config-5K0rzjv1.d.cts} +57 -25
- package/dist/tsup/{config-BfG1qpYz.d.ts → config-Df5jOcde.d.cts} +50 -8
- package/dist/tsup/{config-BfG1qpYz.d.cts → config-Df5jOcde.d.ts} +50 -8
- package/dist/tsup/{config-CASGH-5t.d.ts → config-DsAjIyfZ.d.ts} +57 -25
- package/dist/tsup/{context-C1tMYvV-.d.ts → context-B19Rx5Zg.d.cts} +5 -2
- package/dist/tsup/{context-CxNE2KvK.d.cts → context-BEh8x4jn.d.ts} +5 -2
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.d.cts +1 -1
- package/dist/tsup/db/drizzle.d.ts +1 -1
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +2 -2
- package/dist/tsup/dynamic/mod.d.ts +2 -2
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector/workflow.cjs +4 -4
- package/dist/tsup/inspector/workflow.js +3 -3
- package/dist/tsup/inspector-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +3 -3
- package/dist/tsup/inspector-tab/mod.d.ts +3 -3
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +255 -135
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +6 -4
- package/dist/tsup/mod.d.ts +6 -4
- package/dist/tsup/mod.js +152 -32
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +2 -2
- package/dist/tsup/test/mod.d.ts +2 -2
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/unstable/migrations.d.cts +1 -1
- package/dist/tsup/unstable/migrations.d.ts +1 -1
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +13 -10
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +4 -4
- package/dist/tsup/workflow/mod.d.ts +4 -4
- package/dist/tsup/workflow/mod.js +8 -5
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +9 -9
- package/src/actor/config.ts +41 -29
- package/src/actor/contexts/index.ts +2 -0
- package/src/actor/definition.ts +33 -1
- package/src/actor/schema.ts +4 -0
- package/src/client/actor-common.ts +4 -0
- package/src/client/actor-conn.ts +2 -0
- package/src/client/actor-handle.ts +2 -0
- package/src/client/config.ts +1 -1
- package/src/client/queue.ts +2 -0
- package/src/common/database/config.ts +50 -7
- package/src/db/mod.ts +1 -0
- package/src/registry/index.ts +142 -1
- package/src/registry/napi-runtime.ts +15 -4
- package/src/registry/native.ts +4 -11
- package/src/registry/runtime.ts +6 -8
- package/src/registry/wasm-runtime.ts +0 -14
- package/src/workflow/context.ts +3 -0
- package/dist/tsup/chunk-3ZKCK6NL.js.map +0 -1
- package/dist/tsup/chunk-SSF2XC33.cjs.map +0 -1
- package/dist/tsup/chunk-UXDASKP6.js.map +0 -1
- package/dist/tsup/chunk-YJ2X5STT.cjs.map +0 -1
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +0 -848
- /package/dist/tsup/{chunk-TTMWSZZA.js.map → chunk-R4QCQBB4.js.map} +0 -0
- /package/dist/tsup/{chunk-GAFMEUAL.js.map → chunk-RJ7WDGOJ.js.map} +0 -0
- /package/dist/tsup/{chunk-SEKTNJU6.js.map → chunk-SSMFNH4N.js.map} +0 -0
- /package/dist/tsup/{chunk-YNAEH775.js.map → chunk-VXVJHTW6.js.map} +0 -0
- /package/dist/tsup/{chunk-MT4SROQM.js.map → chunk-XATHAIZX.js.map} +0 -0
- /package/dist/tsup/{chunk-T7DJZSPH.js.map → chunk-Y5TV6V5Z.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 ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw 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-5K0rzjv1.cjs';
|
|
2
|
+
export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw as test } from './config-5K0rzjv1.cjs';
|
|
3
3
|
export { E as Encoding, t as toUint8Array } from './utils-C6b0aYUM.cjs';
|
|
4
4
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
5
|
export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
6
|
-
import { A as AnyDatabaseProvider } from './config-
|
|
6
|
+
import { A as AnyDatabaseProvider } from './config-Df5jOcde.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-3rsE0JvI.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-B19Rx5Zg.cjs';
|
|
10
10
|
import 'zod/v4';
|
|
11
11
|
import '@rivetkit/rivetkit-wasm';
|
|
12
12
|
import 'zod';
|
|
@@ -68,6 +68,7 @@ type BeforeConnectContextOf<AD extends AnyActorDefinition> = AD extends BaseActo
|
|
|
68
68
|
type ConnectContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? ConnectContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
69
69
|
type ConnContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? ActionContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
70
70
|
type ConnInitContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? BeforeConnectContext<S, V, I, DB, E, Q> : never;
|
|
71
|
+
/** @deprecated Connection state was deprecated in 3.0 and will be removed in a future version. Track live connections in `c.vars` from `onConnect` and `onDisconnect`, and store durable per-connection data in SQLite. See https://rivet.dev/actors/docs/deprecated/state#connection-state */
|
|
71
72
|
type CreateConnStateContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? CreateConnStateContext<S, V, I, DB, E, Q> : never;
|
|
72
73
|
type CreateContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, any, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? CreateContext<S, I, DB, E, Q> : never;
|
|
73
74
|
type CreateVarsContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, any, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? CreateVarsContext<S, I, DB, E, Q> : never;
|
|
@@ -77,6 +78,7 @@ type MigrateContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefin
|
|
|
77
78
|
type RequestContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? RequestContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
78
79
|
type RunContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? RunContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
79
80
|
type SleepContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? SleepContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
81
|
+
/** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. See https://rivet.dev/actors/docs/deprecated/state */
|
|
80
82
|
type StateChangeContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? StateChangeContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
81
83
|
type WakeContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? WakeContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
82
84
|
type WebSocketContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? WebSocketContext<S, CP, CS, V, I, DB, E, Q> : never;
|
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 ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw 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-DsAjIyfZ.js';
|
|
2
|
+
export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw as test } from './config-DsAjIyfZ.js';
|
|
3
3
|
export { E as Encoding, t as toUint8Array } from './utils-C1O-SklO.js';
|
|
4
4
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
5
|
export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
6
|
-
import { A as AnyDatabaseProvider } from './config-
|
|
6
|
+
import { A as AnyDatabaseProvider } from './config-Df5jOcde.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-3rsE0JvI.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-BEh8x4jn.js';
|
|
10
10
|
import 'zod/v4';
|
|
11
11
|
import '@rivetkit/rivetkit-wasm';
|
|
12
12
|
import 'zod';
|
|
@@ -68,6 +68,7 @@ type BeforeConnectContextOf<AD extends AnyActorDefinition> = AD extends BaseActo
|
|
|
68
68
|
type ConnectContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? ConnectContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
69
69
|
type ConnContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? ActionContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
70
70
|
type ConnInitContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? BeforeConnectContext<S, V, I, DB, E, Q> : never;
|
|
71
|
+
/** @deprecated Connection state was deprecated in 3.0 and will be removed in a future version. Track live connections in `c.vars` from `onConnect` and `onDisconnect`, and store durable per-connection data in SQLite. See https://rivet.dev/actors/docs/deprecated/state#connection-state */
|
|
71
72
|
type CreateConnStateContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? CreateConnStateContext<S, V, I, DB, E, Q> : never;
|
|
72
73
|
type CreateContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, any, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? CreateContext<S, I, DB, E, Q> : never;
|
|
73
74
|
type CreateVarsContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, any, any, any, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? CreateVarsContext<S, I, DB, E, Q> : never;
|
|
@@ -77,6 +78,7 @@ type MigrateContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefin
|
|
|
77
78
|
type RequestContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? RequestContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
78
79
|
type RunContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? RunContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
79
80
|
type SleepContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? SleepContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
81
|
+
/** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. See https://rivet.dev/actors/docs/deprecated/state */
|
|
80
82
|
type StateChangeContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? StateChangeContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
81
83
|
type WakeContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? WakeContext<S, CP, CS, V, I, DB, E, Q> : never;
|
|
82
84
|
type WebSocketContextOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<infer S, infer CP, infer CS, infer V, infer I, infer DB extends AnyDatabaseProvider, infer E extends EventSchemaConfig, infer Q extends QueueSchemaConfig, any> ? WebSocketContext<S, CP, CS, V, I, DB, E, Q> : never;
|
package/dist/tsup/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeWorkflowHistoryTransport
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y5TV6V5Z.js";
|
|
4
4
|
import {
|
|
5
5
|
ACTOR_CONTEXT_INTERNAL_SYMBOL,
|
|
6
6
|
ActorConfigSchema,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
getRunInspectorKind,
|
|
18
18
|
getRunMetadata,
|
|
19
19
|
hasRunInspectorConfig
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-PBIQPYE5.js";
|
|
21
21
|
import {
|
|
22
22
|
ALLOWED_PUBLIC_HEADERS,
|
|
23
23
|
ENGINE_HOST,
|
|
@@ -35,18 +35,18 @@ import {
|
|
|
35
35
|
runWithActorInvocationSpan,
|
|
36
36
|
tryParseEndpoint,
|
|
37
37
|
updateRunnerConfig
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ME74LHJM.js";
|
|
39
39
|
import {
|
|
40
40
|
makePrefixedKey,
|
|
41
41
|
removePrefixFromKey
|
|
42
42
|
} from "./chunk-A2CF6PFH.js";
|
|
43
|
-
import "./chunk-YNAEH775.js";
|
|
44
43
|
import {
|
|
45
44
|
bindNativeStateTransactionContext,
|
|
46
45
|
db,
|
|
47
46
|
registerNativeStateTransactionOpener
|
|
48
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-XATHAIZX.js";
|
|
49
48
|
import "./chunk-JTHHCZCZ.js";
|
|
49
|
+
import "./chunk-VXVJHTW6.js";
|
|
50
50
|
import {
|
|
51
51
|
LogLevelSchema,
|
|
52
52
|
VERSION,
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
parsePortEnv,
|
|
81
81
|
stringifyError,
|
|
82
82
|
toUint8Array
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-M72ZKQ7R.js";
|
|
84
84
|
import {
|
|
85
85
|
INTERNAL_ERROR_CODE,
|
|
86
86
|
RivetError,
|
|
@@ -116,11 +116,25 @@ function warnDeprecatedOptionKeys(options) {
|
|
|
116
116
|
if (opts[key] !== void 0 && !warnedDeprecatedOptionKeys.has(key)) {
|
|
117
117
|
warnedDeprecatedOptionKeys.add(key);
|
|
118
118
|
loggerWithoutContext().warn({
|
|
119
|
-
msg: `actor option \`${key}\` is deprecated and is now ignored. ${detail} Will be removed in
|
|
119
|
+
msg: `actor option \`${key}\` is deprecated and is now ignored. ${detail} Will be removed in 3.2.0.`
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
+
var warnedDeprecatedRun = false;
|
|
125
|
+
function warnDeprecatedRun(input) {
|
|
126
|
+
if (warnedDeprecatedRun || !input || typeof input !== "object") return;
|
|
127
|
+
const run = input.run;
|
|
128
|
+
if (run === void 0) return;
|
|
129
|
+
const runFunction = typeof run === "object" && run !== null ? run.run : run;
|
|
130
|
+
if (typeof runFunction === "function" && getRunInspectorKind(runFunction) === "workflow") {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
warnedDeprecatedRun = true;
|
|
134
|
+
loggerWithoutContext().warn({
|
|
135
|
+
msg: "actor option `run` with a plain function was deprecated in 3.0 and will be removed in a future version. Start background work from `onWake` with `c.keepAwake` and track it in `c.vars`. `run: workflow(...)` is not deprecated. See https://rivet.dev/actors/docs/deprecated/run"
|
|
136
|
+
});
|
|
137
|
+
}
|
|
124
138
|
var ActorDefinition = class {
|
|
125
139
|
#config;
|
|
126
140
|
constructor(config) {
|
|
@@ -138,6 +152,7 @@ function actor(input) {
|
|
|
138
152
|
warnDeprecatedOptionKeys(
|
|
139
153
|
input == null ? void 0 : input.options
|
|
140
154
|
);
|
|
155
|
+
warnDeprecatedRun(input);
|
|
141
156
|
const config = ActorConfigSchema.parse(input);
|
|
142
157
|
flattenActionHandlers(config.actions);
|
|
143
158
|
flattenActionInputSchemas(config.actions, config.actionInputSchemas);
|
|
@@ -1740,6 +1755,15 @@ var NapiCoreRuntime = class {
|
|
|
1740
1755
|
async registryActorStopThresholdMs(registry) {
|
|
1741
1756
|
return await asNativeRegistry(registry).actorStopThresholdMs() ?? void 0;
|
|
1742
1757
|
}
|
|
1758
|
+
registryActiveActorCount(registry) {
|
|
1759
|
+
return asNativeRegistry(registry).activeActorCount();
|
|
1760
|
+
}
|
|
1761
|
+
onRegistryActiveActorCountChange(registry, callback, cancelToken) {
|
|
1762
|
+
asNativeRegistry(registry).onActiveActorCountChange(
|
|
1763
|
+
callback,
|
|
1764
|
+
asNativeCancellationToken(cancelToken)
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1743
1767
|
async registryHealth(registry) {
|
|
1744
1768
|
const response = await asNativeRegistry(registry).health();
|
|
1745
1769
|
return {
|
|
@@ -2161,9 +2185,6 @@ var NapiCoreRuntime = class {
|
|
|
2161
2185
|
}
|
|
2162
2186
|
await nativeCtx.sql().close();
|
|
2163
2187
|
}
|
|
2164
|
-
async actorRuntimeSocketProvision(ctx) {
|
|
2165
|
-
return await asNativeActorContext(ctx).provisionActorRuntimeSocket();
|
|
2166
|
-
}
|
|
2167
2188
|
async actorQueueSend(ctx, name, body) {
|
|
2168
2189
|
return toNapiQueueMessage(
|
|
2169
2190
|
await this.#actorContextForOperation(ctx).queue().send(name, toNapiBuffer(body))
|
|
@@ -3297,17 +3318,6 @@ var WasmCoreRuntime = class {
|
|
|
3297
3318
|
this.#sql.delete(wasmCtx);
|
|
3298
3319
|
await callWasm(() => database.close());
|
|
3299
3320
|
}
|
|
3300
|
-
async actorRuntimeSocketProvision(_ctx) {
|
|
3301
|
-
throw new RivetError(
|
|
3302
|
-
"actor_runtime_socket",
|
|
3303
|
-
"unsupported",
|
|
3304
|
-
"Actor Runtime Socket is only available on Unix native runtimes.",
|
|
3305
|
-
{
|
|
3306
|
-
public: true,
|
|
3307
|
-
metadata: { runtime: "wasm" }
|
|
3308
|
-
}
|
|
3309
|
-
);
|
|
3310
|
-
}
|
|
3311
3321
|
async actorQueueSend(ctx, name, body) {
|
|
3312
3322
|
const queue2 = childHandle(asWasmActorContext(ctx), "queue");
|
|
3313
3323
|
return normalizeQueueMessage(
|
|
@@ -5495,11 +5505,6 @@ var ActorContextHandleAdapter = class {
|
|
|
5495
5505
|
}
|
|
5496
5506
|
return this.#kv;
|
|
5497
5507
|
}
|
|
5498
|
-
async actorRuntimeSocket() {
|
|
5499
|
-
return await callNative(
|
|
5500
|
-
() => this.#runtime.actorRuntimeSocketProvision(this.#ctx)
|
|
5501
|
-
);
|
|
5502
|
-
}
|
|
5503
5508
|
get db() {
|
|
5504
5509
|
if (!this.#databaseProvider) {
|
|
5505
5510
|
throw databaseNotConfiguredError();
|
|
@@ -6058,16 +6063,16 @@ var ActorContextHandleAdapter = class {
|
|
|
6058
6063
|
// need to keep an actor awake should use `keepAwake(promise)` or
|
|
6059
6064
|
// `waitUntil(promise)` so the native counter machinery in rivetkit-core
|
|
6060
6065
|
// owns the lifecycle.
|
|
6061
|
-
/** @deprecated Use `keepAwake(promise)` or `waitUntil(promise)
|
|
6066
|
+
/** @deprecated `setPreventSleep` was deprecated in 3.0 and will be removed in a future version. It is a no-op. Use `c.keepAwake(promise)` or `c.waitUntil(promise)`. See https://rivet.dev/actors/docs/deprecated/prevent-sleep */
|
|
6062
6067
|
setPreventSleep(_preventSleep) {
|
|
6063
6068
|
logger2().warn({
|
|
6064
|
-
msg: "setPreventSleep
|
|
6069
|
+
msg: "setPreventSleep was deprecated in 3.0 and will be removed in a future version. It is a no-op; use keepAwake(promise) or waitUntil(promise) instead. See https://rivet.dev/actors/docs/deprecated/prevent-sleep"
|
|
6065
6070
|
});
|
|
6066
6071
|
}
|
|
6067
|
-
/** @deprecated Use `keepAwake(promise)` or `waitUntil(promise)
|
|
6072
|
+
/** @deprecated `preventSleep` was deprecated in 3.0 and will be removed in a future version. It is a no-op that always returns `false`. Use `c.keepAwake(promise)` or `c.waitUntil(promise)`. See https://rivet.dev/actors/docs/deprecated/prevent-sleep */
|
|
6068
6073
|
get preventSleep() {
|
|
6069
6074
|
logger2().warn({
|
|
6070
|
-
msg: "preventSleep
|
|
6075
|
+
msg: "preventSleep was deprecated in 3.0 and will be removed in a future version. It always returns false; use keepAwake(promise) or waitUntil(promise) instead. See https://rivet.dev/actors/docs/deprecated/prevent-sleep"
|
|
6071
6076
|
});
|
|
6072
6077
|
return false;
|
|
6073
6078
|
}
|
|
@@ -6400,7 +6405,6 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
|
6400
6405
|
definition.config.actions,
|
|
6401
6406
|
definition.config.tracing
|
|
6402
6407
|
),
|
|
6403
|
-
enableActorRuntimeSocket: options.enableActorRuntimeSocket === true,
|
|
6404
6408
|
hasState: config.state !== void 0 || typeof config.createState === "function",
|
|
6405
6409
|
canHibernateWebsocket: typeof canHibernate === "boolean" ? canHibernate : void 0,
|
|
6406
6410
|
stateSaveIntervalMs: options.stateSaveInterval,
|
|
@@ -7680,6 +7684,7 @@ async function buildConfiguredRegistry(config) {
|
|
|
7680
7684
|
var REGISTRY_READY_TIMEOUT_MS = 3e4;
|
|
7681
7685
|
var LOCAL_ENGINE_READY_TIMEOUT_MS = 6e4;
|
|
7682
7686
|
var LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS = 4e3;
|
|
7687
|
+
var DEFAULT_ACTOR_STOP_THRESHOLD_MS = 3e4;
|
|
7683
7688
|
function rejectServerless() {
|
|
7684
7689
|
throw new Error("serverless is disabled in this version");
|
|
7685
7690
|
}
|
|
@@ -7766,6 +7771,11 @@ var Registry = class {
|
|
|
7766
7771
|
#shutdownInstalled = false;
|
|
7767
7772
|
#shutdownInFlight = null;
|
|
7768
7773
|
#signalHandlers = {};
|
|
7774
|
+
#envoyConfiguredRegistry;
|
|
7775
|
+
#activeActorCountListeners = /* @__PURE__ */ new Set();
|
|
7776
|
+
#activeActorCountToken;
|
|
7777
|
+
#lastActiveActorCount;
|
|
7778
|
+
#activeActorCountSupported;
|
|
7769
7779
|
constructor(config, deps) {
|
|
7770
7780
|
var _a;
|
|
7771
7781
|
this.#config = config;
|
|
@@ -8180,6 +8190,21 @@ var Registry = class {
|
|
|
8180
8190
|
}
|
|
8181
8191
|
const configuredRegistryPromise = this.#buildConfiguredRegistry(config);
|
|
8182
8192
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
8193
|
+
configuredRegistryPromise.then(
|
|
8194
|
+
(configured) => {
|
|
8195
|
+
this.#envoyConfiguredRegistry = configured;
|
|
8196
|
+
try {
|
|
8197
|
+
this.#syncActiveActorCountSubscription();
|
|
8198
|
+
} catch (error) {
|
|
8199
|
+
logger2().error(
|
|
8200
|
+
{ error },
|
|
8201
|
+
"failed to subscribe to the active actor count"
|
|
8202
|
+
);
|
|
8203
|
+
}
|
|
8204
|
+
},
|
|
8205
|
+
// The serve lifecycle below reports build failures.
|
|
8206
|
+
() => void 0
|
|
8207
|
+
);
|
|
8183
8208
|
this.#runtimeServeLifecyclePromise = configuredRegistryPromise.then(
|
|
8184
8209
|
async ({ runtime, registry, serveConfig }) => {
|
|
8185
8210
|
await runtime.serveRegistry(registry, serveConfig);
|
|
@@ -8265,7 +8290,7 @@ var Registry = class {
|
|
|
8265
8290
|
if (gracePeriodMs === void 0) {
|
|
8266
8291
|
gracePeriodMs = localDevSignal ? LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS : await this.#actorStopThresholdMs(
|
|
8267
8292
|
modeAPromise ?? modeBPromise
|
|
8268
|
-
) ??
|
|
8293
|
+
) ?? DEFAULT_ACTOR_STOP_THRESHOLD_MS;
|
|
8269
8294
|
}
|
|
8270
8295
|
const drain = async () => {
|
|
8271
8296
|
const registries = [];
|
|
@@ -8459,6 +8484,101 @@ var Registry = class {
|
|
|
8459
8484
|
const config = this.parseConfig();
|
|
8460
8485
|
this.#startEnvoy(config, true);
|
|
8461
8486
|
}
|
|
8487
|
+
/**
|
|
8488
|
+
* Returns the number of actors hosted by this process's envoy, which is zero
|
|
8489
|
+
* while it is not serving. Requires the native runtime.
|
|
8490
|
+
*/
|
|
8491
|
+
activeActorCount() {
|
|
8492
|
+
this.#assertActiveActorCountSupported("activeActorCount");
|
|
8493
|
+
const configured = this.#envoyConfiguredRegistry;
|
|
8494
|
+
if (!configured) return 0;
|
|
8495
|
+
const { runtime, registry } = configured;
|
|
8496
|
+
if (!runtime.registryActiveActorCount) {
|
|
8497
|
+
throw new Error(
|
|
8498
|
+
"registry.activeActorCount() is not supported by this runtime"
|
|
8499
|
+
);
|
|
8500
|
+
}
|
|
8501
|
+
return runtime.registryActiveActorCount(registry);
|
|
8502
|
+
}
|
|
8503
|
+
/**
|
|
8504
|
+
* Calls `callback` with the number of actors hosted by this process's envoy
|
|
8505
|
+
* and again whenever it changes. Rapid changes may coalesce.
|
|
8506
|
+
* Returns a function that unsubscribes. Requires the native runtime.
|
|
8507
|
+
*
|
|
8508
|
+
* @example
|
|
8509
|
+
* ```ts
|
|
8510
|
+
* const unsubscribe = registry.onActiveActorCountChange((count) => {
|
|
8511
|
+
* setTaskProtection(count > 0);
|
|
8512
|
+
* });
|
|
8513
|
+
* ```
|
|
8514
|
+
*/
|
|
8515
|
+
onActiveActorCountChange(callback) {
|
|
8516
|
+
this.#assertActiveActorCountSupported("onActiveActorCountChange");
|
|
8517
|
+
const listener = (count) => callback(count);
|
|
8518
|
+
this.#activeActorCountListeners.add(listener);
|
|
8519
|
+
this.#syncActiveActorCountSubscription();
|
|
8520
|
+
const lastCount = this.#lastActiveActorCount;
|
|
8521
|
+
if (lastCount !== void 0) {
|
|
8522
|
+
queueMicrotask(() => {
|
|
8523
|
+
if (this.#activeActorCountListeners.has(listener)) {
|
|
8524
|
+
this.#deliverActiveActorCount(listener, lastCount);
|
|
8525
|
+
}
|
|
8526
|
+
});
|
|
8527
|
+
}
|
|
8528
|
+
return () => {
|
|
8529
|
+
this.#activeActorCountListeners.delete(listener);
|
|
8530
|
+
this.#syncActiveActorCountSubscription();
|
|
8531
|
+
};
|
|
8532
|
+
}
|
|
8533
|
+
#assertActiveActorCountSupported(method2) {
|
|
8534
|
+
this.#activeActorCountSupported ??= this.parseConfig().runtime !== "wasm";
|
|
8535
|
+
if (!this.#activeActorCountSupported) {
|
|
8536
|
+
throw new Error(
|
|
8537
|
+
`registry.${method2}() requires the native runtime; WebAssembly registries do not host an envoy`
|
|
8538
|
+
);
|
|
8539
|
+
}
|
|
8540
|
+
}
|
|
8541
|
+
/** Holds one native subscription while any listener is registered. */
|
|
8542
|
+
#syncActiveActorCountSubscription() {
|
|
8543
|
+
const configured = this.#envoyConfiguredRegistry;
|
|
8544
|
+
if (!configured) return;
|
|
8545
|
+
const { runtime, registry } = configured;
|
|
8546
|
+
const token = this.#activeActorCountToken;
|
|
8547
|
+
if (this.#activeActorCountListeners.size === 0) {
|
|
8548
|
+
if (token !== void 0) {
|
|
8549
|
+
this.#activeActorCountToken = void 0;
|
|
8550
|
+
this.#lastActiveActorCount = void 0;
|
|
8551
|
+
runtime.cancelCancellationToken(token);
|
|
8552
|
+
}
|
|
8553
|
+
return;
|
|
8554
|
+
}
|
|
8555
|
+
if (token !== void 0) return;
|
|
8556
|
+
if (!runtime.onRegistryActiveActorCountChange) {
|
|
8557
|
+
throw new Error(
|
|
8558
|
+
"active actor count subscriptions are not supported by this runtime"
|
|
8559
|
+
);
|
|
8560
|
+
}
|
|
8561
|
+
const nextToken = runtime.createCancellationToken();
|
|
8562
|
+
this.#activeActorCountToken = nextToken;
|
|
8563
|
+
runtime.onRegistryActiveActorCountChange(
|
|
8564
|
+
registry,
|
|
8565
|
+
(count) => {
|
|
8566
|
+
if (this.#activeActorCountToken !== nextToken) return;
|
|
8567
|
+
this.#lastActiveActorCount = count;
|
|
8568
|
+
for (const listener of [...this.#activeActorCountListeners]) {
|
|
8569
|
+
this.#deliverActiveActorCount(listener, count);
|
|
8570
|
+
}
|
|
8571
|
+
},
|
|
8572
|
+
nextToken
|
|
8573
|
+
);
|
|
8574
|
+
}
|
|
8575
|
+
#deliverActiveActorCount(listener, count) {
|
|
8576
|
+
try {
|
|
8577
|
+
listener(count);
|
|
8578
|
+
} catch (error) {
|
|
8579
|
+
logger2().error({ error }, "active actor count listener threw");
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8462
8582
|
#printWelcome(config, kind, listener) {
|
|
8463
8583
|
if (config.noWelcome || this.#welcomePrinted) return;
|
|
8464
8584
|
this.#welcomePrinted = true;
|