rivetkit 2.3.0-rc.11 → 2.3.0-rc.12
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 +357 -20
- package/dist/browser/client.js +4 -3
- 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 +354 -17
- package/dist/tsup/agent-os/index.d.ts +354 -17
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-XG25CGSW.cjs → chunk-2U6RLFKX.cjs} +141 -140
- package/dist/tsup/chunk-2U6RLFKX.cjs.map +1 -0
- package/dist/tsup/{chunk-2NXFKPRB.cjs → chunk-2ZTBRZRS.cjs} +10 -10
- package/dist/tsup/{chunk-2NXFKPRB.cjs.map → chunk-2ZTBRZRS.cjs.map} +1 -1
- package/dist/tsup/{chunk-4FP4FFB5.js → chunk-3EVVOYFD.js} +3 -3
- package/dist/tsup/chunk-3EVVOYFD.js.map +1 -0
- package/dist/tsup/{chunk-Y3JBOFBG.cjs → chunk-6KTMKPNU.cjs} +8 -8
- package/dist/tsup/{chunk-Y3JBOFBG.cjs.map → chunk-6KTMKPNU.cjs.map} +1 -1
- package/dist/tsup/{chunk-TTLUIDVH.js → chunk-7UZF56RS.js} +6 -5
- package/dist/tsup/chunk-7UZF56RS.js.map +1 -0
- package/dist/tsup/{chunk-LNP7Q6I6.cjs → chunk-C7AAIILH.cjs} +4 -4
- package/dist/tsup/{chunk-LNP7Q6I6.cjs.map → chunk-C7AAIILH.cjs.map} +1 -1
- package/dist/tsup/{chunk-WXYWDLJY.js → chunk-EWVOWEMD.js} +4 -4
- package/dist/tsup/{chunk-YRQ4F5CD.js → chunk-OLIJHKLL.js} +3 -3
- package/dist/tsup/{chunk-KRC4L3YB.js → chunk-OOB32JVG.js} +2 -2
- package/dist/tsup/{chunk-GRFBV2U7.js → chunk-QKSGGKGQ.js} +2 -2
- package/dist/tsup/{chunk-GX6W4MW3.cjs → chunk-SS56HFM2.cjs} +5 -5
- package/dist/tsup/{chunk-GX6W4MW3.cjs.map → chunk-SS56HFM2.cjs.map} +1 -1
- package/dist/tsup/{chunk-LW5HNCWD.cjs → chunk-UETC5RF7.cjs} +3 -3
- package/dist/tsup/{chunk-LW5HNCWD.cjs.map → chunk-UETC5RF7.cjs.map} +1 -1
- package/dist/tsup/{chunk-3P2JUHWJ.js → chunk-VLXRFJ7P.js} +2 -2
- package/dist/tsup/{chunk-RDBGKI66.cjs → chunk-VNMIAPPF.cjs} +3 -3
- package/dist/tsup/chunk-VNMIAPPF.cjs.map +1 -0
- package/dist/tsup/{chunk-XCDCURZ4.cjs → chunk-WHYBAEWG.cjs} +1 -1
- package/dist/tsup/{chunk-XCDCURZ4.cjs.map → chunk-WHYBAEWG.cjs.map} +1 -1
- package/dist/tsup/{chunk-T3VCJ4PV.js → chunk-WIMUFZVJ.js} +1 -1
- package/dist/tsup/{chunk-T3VCJ4PV.js.map → chunk-WIMUFZVJ.js.map} +1 -1
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +5 -5
- 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-CTwe3WwC.d.cts → config-BtAh7oBu.d.cts} +356 -19
- package/dist/tsup/{config-De5UVu0V.d.ts → config-DKgPGC0f.d.ts} +356 -19
- package/dist/tsup/{context-DPHISlUi.d.ts → context-C-6dGebY.d.ts} +1 -1
- package/dist/tsup/{context-Dmj477Uh.d.cts → context-Cfjl5pgz.d.cts} +1 -1
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- 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/mod.cjs +222 -127
- 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 +159 -64
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +9 -9
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +11 -11
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +8 -8
- package/src/actor/config.ts +20 -10
- package/src/actor/definition.ts +6 -5
- package/src/client/actor-common.ts +24 -27
- package/src/client/actor-handle.ts +2 -1
- package/src/common/utils.ts +1 -1
- package/src/drivers/engine/actor-driver.ts +16 -5
- package/src/engine-client/api-endpoints.ts +5 -1
- package/src/registry/config/index.ts +3 -9
- package/src/registry/index.ts +139 -60
- package/src/registry/napi-runtime.ts +6 -0
- package/src/registry/native.ts +52 -20
- package/src/registry/process-metrics.ts +16 -4
- package/src/registry/runtime.ts +6 -0
- package/src/registry/wasm-runtime.ts +16 -1
- package/dist/tsup/chunk-4FP4FFB5.js.map +0 -1
- package/dist/tsup/chunk-RDBGKI66.cjs.map +0 -1
- package/dist/tsup/chunk-TTLUIDVH.js.map +0 -1
- package/dist/tsup/chunk-XG25CGSW.cjs.map +0 -1
- /package/dist/tsup/{chunk-WXYWDLJY.js.map → chunk-EWVOWEMD.js.map} +0 -0
- /package/dist/tsup/{chunk-YRQ4F5CD.js.map → chunk-OLIJHKLL.js.map} +0 -0
- /package/dist/tsup/{chunk-KRC4L3YB.js.map → chunk-OOB32JVG.js.map} +0 -0
- /package/dist/tsup/{chunk-GRFBV2U7.js.map → chunk-QKSGGKGQ.js.map} +0 -0
- /package/dist/tsup/{chunk-3P2JUHWJ.js.map → chunk-VLXRFJ7P.js.map} +0 -0
|
@@ -203,7 +203,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
203
203
|
envoyKey: z.ZodOptional<z.ZodString>;
|
|
204
204
|
}, z.core.$strip>>>;
|
|
205
205
|
shutdown: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
206
|
-
gracePeriodMs: z.
|
|
206
|
+
gracePeriodMs: z.ZodOptional<z.ZodNumber>;
|
|
207
207
|
disableSignalHandlers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
208
208
|
}, z.core.$strip>>>;
|
|
209
209
|
}, z.core.$strip>, z.ZodTransform<{
|
|
@@ -252,8 +252,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
252
252
|
envoyKey?: string | undefined;
|
|
253
253
|
};
|
|
254
254
|
shutdown: {
|
|
255
|
-
gracePeriodMs: number;
|
|
256
255
|
disableSignalHandlers: boolean;
|
|
256
|
+
gracePeriodMs?: number | undefined;
|
|
257
257
|
};
|
|
258
258
|
staticDir?: string | undefined;
|
|
259
259
|
httpHost?: string | undefined;
|
|
@@ -309,8 +309,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
309
309
|
envoyKey?: string | undefined;
|
|
310
310
|
};
|
|
311
311
|
shutdown: {
|
|
312
|
-
gracePeriodMs: number;
|
|
313
312
|
disableSignalHandlers: boolean;
|
|
313
|
+
gracePeriodMs?: number | undefined;
|
|
314
314
|
};
|
|
315
315
|
staticDir?: string | undefined;
|
|
316
316
|
httpHost?: string | undefined;
|
|
@@ -369,15 +369,15 @@ type InferQueueCompleteMap<T extends QueueSchemaConfig> = {
|
|
|
369
369
|
type InferEventArgs<T> = T extends readonly unknown[] ? number extends T["length"] ? [T] : T : [T];
|
|
370
370
|
|
|
371
371
|
interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, _R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> {
|
|
372
|
-
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
372
|
+
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q, _R>;
|
|
373
373
|
}
|
|
374
374
|
interface AnyActorDefinition {
|
|
375
375
|
readonly config: any;
|
|
376
376
|
}
|
|
377
377
|
declare class ActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> implements BaseActorDefinition<S, CP, CS, V, I, DB, E, Q, R> {
|
|
378
378
|
#private;
|
|
379
|
-
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>);
|
|
380
|
-
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
379
|
+
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>);
|
|
380
|
+
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q, R>;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
declare const EncodingSchema: z$1.ZodEnum<{
|
|
@@ -554,6 +554,318 @@ interface ActorOutput {
|
|
|
554
554
|
error?: unknown;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
+
declare const handleBrand: unique symbol;
|
|
558
|
+
type OpaqueHandle<Name extends string> = {
|
|
559
|
+
readonly [handleBrand]: Name;
|
|
560
|
+
};
|
|
561
|
+
type RegistryHandle = OpaqueHandle<"registry">;
|
|
562
|
+
type ActorFactoryHandle = OpaqueHandle<"actorFactory">;
|
|
563
|
+
type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
564
|
+
type ConnHandle = OpaqueHandle<"conn">;
|
|
565
|
+
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
566
|
+
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
567
|
+
type RuntimeBytes = Uint8Array;
|
|
568
|
+
interface RuntimeActorKeySegment {
|
|
569
|
+
kind: string;
|
|
570
|
+
stringValue?: string;
|
|
571
|
+
numberValue?: number;
|
|
572
|
+
}
|
|
573
|
+
interface RuntimeHttpRequest {
|
|
574
|
+
method: string;
|
|
575
|
+
uri: string;
|
|
576
|
+
headers?: Record<string, string>;
|
|
577
|
+
body?: RuntimeBytes;
|
|
578
|
+
}
|
|
579
|
+
interface RuntimeStateDeltaPayload {
|
|
580
|
+
state?: RuntimeBytes;
|
|
581
|
+
connHibernation: Array<{
|
|
582
|
+
connId: string;
|
|
583
|
+
bytes: RuntimeBytes;
|
|
584
|
+
}>;
|
|
585
|
+
connHibernationRemoved: string[];
|
|
586
|
+
}
|
|
587
|
+
interface RuntimeRequestSaveOpts {
|
|
588
|
+
immediate?: boolean;
|
|
589
|
+
maxWaitMs?: number;
|
|
590
|
+
}
|
|
591
|
+
interface RuntimeInspectorSnapshot {
|
|
592
|
+
stateRevision: number;
|
|
593
|
+
connectionsRevision: number;
|
|
594
|
+
queueRevision: number;
|
|
595
|
+
activeConnections: number;
|
|
596
|
+
queueSize: number;
|
|
597
|
+
connectedClients: number;
|
|
598
|
+
}
|
|
599
|
+
interface RuntimeQueueMessage {
|
|
600
|
+
id(): bigint;
|
|
601
|
+
name(): string;
|
|
602
|
+
body(): RuntimeBytes;
|
|
603
|
+
createdAt(): number;
|
|
604
|
+
isCompletable(): boolean;
|
|
605
|
+
complete(response?: RuntimeBytes | undefined | null): Promise<void>;
|
|
606
|
+
}
|
|
607
|
+
interface RuntimeQueueInspectMessage {
|
|
608
|
+
id: number;
|
|
609
|
+
name: string;
|
|
610
|
+
createdAtMs: number;
|
|
611
|
+
}
|
|
612
|
+
interface RuntimeQueueNextBatchOptions {
|
|
613
|
+
names?: string[];
|
|
614
|
+
count?: number;
|
|
615
|
+
timeoutMs?: number;
|
|
616
|
+
completable?: boolean;
|
|
617
|
+
}
|
|
618
|
+
interface RuntimeQueueWaitOptions {
|
|
619
|
+
timeoutMs?: number;
|
|
620
|
+
completable?: boolean;
|
|
621
|
+
}
|
|
622
|
+
interface RuntimeQueueEnqueueAndWaitOptions {
|
|
623
|
+
timeoutMs?: number;
|
|
624
|
+
}
|
|
625
|
+
interface RuntimeQueueTryNextBatchOptions {
|
|
626
|
+
names?: string[];
|
|
627
|
+
count?: number;
|
|
628
|
+
completable?: boolean;
|
|
629
|
+
}
|
|
630
|
+
interface RuntimeKvListOptions {
|
|
631
|
+
reverse?: boolean;
|
|
632
|
+
limit?: number;
|
|
633
|
+
}
|
|
634
|
+
interface RuntimeKvEntry {
|
|
635
|
+
key: RuntimeBytes;
|
|
636
|
+
value: RuntimeBytes;
|
|
637
|
+
}
|
|
638
|
+
type RuntimeSqlBindNoValues = {
|
|
639
|
+
intValue?: never;
|
|
640
|
+
floatValue?: never;
|
|
641
|
+
textValue?: never;
|
|
642
|
+
blobValue?: never;
|
|
643
|
+
};
|
|
644
|
+
type RuntimeSqlBindParam = ({
|
|
645
|
+
kind: "null";
|
|
646
|
+
} & RuntimeSqlBindNoValues) | {
|
|
647
|
+
kind: "int";
|
|
648
|
+
intValue: number;
|
|
649
|
+
floatValue?: never;
|
|
650
|
+
textValue?: never;
|
|
651
|
+
blobValue?: never;
|
|
652
|
+
} | {
|
|
653
|
+
kind: "float";
|
|
654
|
+
intValue?: never;
|
|
655
|
+
floatValue: number;
|
|
656
|
+
textValue?: never;
|
|
657
|
+
blobValue?: never;
|
|
658
|
+
} | {
|
|
659
|
+
kind: "text";
|
|
660
|
+
intValue?: never;
|
|
661
|
+
floatValue?: never;
|
|
662
|
+
textValue: string;
|
|
663
|
+
blobValue?: never;
|
|
664
|
+
} | {
|
|
665
|
+
kind: "blob";
|
|
666
|
+
intValue?: never;
|
|
667
|
+
floatValue?: never;
|
|
668
|
+
textValue?: never;
|
|
669
|
+
blobValue: RuntimeBytes;
|
|
670
|
+
};
|
|
671
|
+
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
672
|
+
interface RuntimeSqlQueryResult {
|
|
673
|
+
columns: string[];
|
|
674
|
+
rows: unknown[][];
|
|
675
|
+
}
|
|
676
|
+
type RuntimeSqlExecResult = RuntimeSqlQueryResult;
|
|
677
|
+
interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
678
|
+
changes: number;
|
|
679
|
+
lastInsertRowId?: number | null;
|
|
680
|
+
}
|
|
681
|
+
interface RuntimeSqlRunResult {
|
|
682
|
+
changes: number;
|
|
683
|
+
}
|
|
684
|
+
interface RuntimeActorConfig {
|
|
685
|
+
name?: string;
|
|
686
|
+
icon?: string;
|
|
687
|
+
hasDatabase?: boolean;
|
|
688
|
+
remoteSqlite?: boolean;
|
|
689
|
+
hasState?: boolean;
|
|
690
|
+
canHibernateWebsocket?: boolean;
|
|
691
|
+
stateSaveIntervalMs?: number;
|
|
692
|
+
createStateTimeoutMs?: number;
|
|
693
|
+
onCreateTimeoutMs?: number;
|
|
694
|
+
createVarsTimeoutMs?: number;
|
|
695
|
+
createConnStateTimeoutMs?: number;
|
|
696
|
+
onBeforeConnectTimeoutMs?: number;
|
|
697
|
+
onConnectTimeoutMs?: number;
|
|
698
|
+
onMigrateTimeoutMs?: number;
|
|
699
|
+
onWakeTimeoutMs?: number;
|
|
700
|
+
onBeforeActorStartTimeoutMs?: number;
|
|
701
|
+
actionTimeoutMs?: number;
|
|
702
|
+
onRequestTimeoutMs?: number;
|
|
703
|
+
sleepTimeoutMs?: number;
|
|
704
|
+
noSleep?: boolean;
|
|
705
|
+
sleepGracePeriodMs?: number;
|
|
706
|
+
connectionLivenessTimeoutMs?: number;
|
|
707
|
+
connectionLivenessIntervalMs?: number;
|
|
708
|
+
maxQueueSize?: number;
|
|
709
|
+
maxQueueMessageSize?: number;
|
|
710
|
+
maxIncomingMessageSize?: number;
|
|
711
|
+
maxOutgoingMessageSize?: number;
|
|
712
|
+
preloadMaxWorkflowBytes?: number;
|
|
713
|
+
preloadMaxConnectionsBytes?: number;
|
|
714
|
+
actions?: Array<{
|
|
715
|
+
name: string;
|
|
716
|
+
}>;
|
|
717
|
+
}
|
|
718
|
+
interface RuntimeServeConfig {
|
|
719
|
+
version: number;
|
|
720
|
+
endpoint: string;
|
|
721
|
+
token?: string;
|
|
722
|
+
namespace: string;
|
|
723
|
+
poolName: string;
|
|
724
|
+
engineBinaryPath?: string;
|
|
725
|
+
handleInspectorHttpInRuntime?: boolean;
|
|
726
|
+
inspectorTestToken?: string;
|
|
727
|
+
serverlessBasePath?: string;
|
|
728
|
+
serverlessPackageVersion: string;
|
|
729
|
+
serverlessClientEndpoint?: string;
|
|
730
|
+
serverlessClientNamespace?: string;
|
|
731
|
+
serverlessClientToken?: string;
|
|
732
|
+
serverlessValidateEndpoint: boolean;
|
|
733
|
+
serverlessMaxStartPayloadBytes: number;
|
|
734
|
+
}
|
|
735
|
+
interface RuntimeServerlessRequest {
|
|
736
|
+
method: string;
|
|
737
|
+
url: string;
|
|
738
|
+
headers: Record<string, string>;
|
|
739
|
+
body: RuntimeBytes;
|
|
740
|
+
}
|
|
741
|
+
interface RuntimeServerlessResponseHead {
|
|
742
|
+
status: number;
|
|
743
|
+
headers: Record<string, string>;
|
|
744
|
+
}
|
|
745
|
+
interface RuntimeRegistryRouteResponse {
|
|
746
|
+
status: number;
|
|
747
|
+
headers: Record<string, string>;
|
|
748
|
+
body: RuntimeBytes;
|
|
749
|
+
}
|
|
750
|
+
type RuntimeServerlessStreamEvent = {
|
|
751
|
+
kind: "chunk";
|
|
752
|
+
chunk?: RuntimeBytes;
|
|
753
|
+
} | {
|
|
754
|
+
kind: "end";
|
|
755
|
+
error?: {
|
|
756
|
+
group: string;
|
|
757
|
+
code: string;
|
|
758
|
+
message: string;
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
type RuntimeServerlessStreamCallback = (error: unknown, event?: RuntimeServerlessStreamEvent) => unknown;
|
|
762
|
+
type RuntimeWebSocketEvent = {
|
|
763
|
+
kind: "message";
|
|
764
|
+
data: string | RuntimeBytes;
|
|
765
|
+
binary: boolean;
|
|
766
|
+
messageIndex?: number;
|
|
767
|
+
} | {
|
|
768
|
+
kind: "close";
|
|
769
|
+
code: number;
|
|
770
|
+
reason: string;
|
|
771
|
+
wasClean: boolean;
|
|
772
|
+
};
|
|
773
|
+
interface CoreRuntime {
|
|
774
|
+
readonly kind: "napi" | "wasm";
|
|
775
|
+
createRegistry(): RegistryHandle;
|
|
776
|
+
registerActor(registry: RegistryHandle, name: string, factory: ActorFactoryHandle): void;
|
|
777
|
+
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
778
|
+
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
779
|
+
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
780
|
+
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
781
|
+
registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
782
|
+
registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
783
|
+
registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
784
|
+
createActorFactory(callbacks: object, config?: RuntimeActorConfig | undefined | null): ActorFactoryHandle;
|
|
785
|
+
createCancellationToken(): CancellationTokenHandle;
|
|
786
|
+
cancellationTokenAborted(token: CancellationTokenHandle): boolean;
|
|
787
|
+
cancelCancellationToken(token: CancellationTokenHandle): void;
|
|
788
|
+
onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): void;
|
|
789
|
+
actorState(ctx: ActorContextHandle): RuntimeBytes;
|
|
790
|
+
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
791
|
+
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
792
|
+
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
793
|
+
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
794
|
+
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
795
|
+
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
796
|
+
actorDecodeInspectorRequest(ctx: ActorContextHandle, bytes: RuntimeBytes, advertisedVersion: number): RuntimeBytes;
|
|
797
|
+
actorEncodeInspectorResponse(ctx: ActorContextHandle, bytes: RuntimeBytes, targetVersion: number): RuntimeBytes;
|
|
798
|
+
actorVerifyInspectorAuth(ctx: ActorContextHandle, bearerToken?: string | undefined | null): Promise<void>;
|
|
799
|
+
actorQueueHibernationRemoval(ctx: ActorContextHandle, connId: string): void;
|
|
800
|
+
actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
|
|
801
|
+
actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
|
|
802
|
+
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
803
|
+
actorId(ctx: ActorContextHandle): string;
|
|
804
|
+
actorName(ctx: ActorContextHandle): string;
|
|
805
|
+
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
806
|
+
actorRegion(ctx: ActorContextHandle): string;
|
|
807
|
+
actorSleep(ctx: ActorContextHandle): void;
|
|
808
|
+
actorDestroy(ctx: ActorContextHandle): void;
|
|
809
|
+
actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
|
|
810
|
+
actorConns(ctx: ActorContextHandle): ConnHandle[];
|
|
811
|
+
actorConnectConn(ctx: ActorContextHandle, params: RuntimeBytes, request?: RuntimeHttpRequest | undefined | null): Promise<ConnHandle>;
|
|
812
|
+
actorBroadcast(ctx: ActorContextHandle, name: string, args: RuntimeBytes): void;
|
|
813
|
+
actorWaitUntil(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
814
|
+
actorWaitForTrackedShutdownWork(ctx: ActorContextHandle): Promise<boolean>;
|
|
815
|
+
actorWaitForTrackedShutdownWorkUnbounded(ctx: ActorContextHandle): Promise<void>;
|
|
816
|
+
actorKeepAwake(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
817
|
+
actorBeginKeepAwake(ctx: ActorContextHandle): number;
|
|
818
|
+
actorEndKeepAwake(ctx: ActorContextHandle, regionId: number): void;
|
|
819
|
+
actorRegisterTask(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
820
|
+
actorRuntimeState(ctx: ActorContextHandle): object;
|
|
821
|
+
actorClearRuntimeState(ctx: ActorContextHandle): void;
|
|
822
|
+
actorRestartRunHandler(ctx: ActorContextHandle): void;
|
|
823
|
+
actorBeginWebsocketCallback(ctx: ActorContextHandle): number;
|
|
824
|
+
actorEndWebsocketCallback(ctx: ActorContextHandle, regionId: number): void;
|
|
825
|
+
actorKvGet(ctx: ActorContextHandle, key: RuntimeBytes): Promise<RuntimeBytes | null>;
|
|
826
|
+
actorKvPut(ctx: ActorContextHandle, key: RuntimeBytes, value: RuntimeBytes): Promise<void>;
|
|
827
|
+
actorKvDelete(ctx: ActorContextHandle, key: RuntimeBytes): Promise<void>;
|
|
828
|
+
actorKvDeleteRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes): Promise<void>;
|
|
829
|
+
actorKvListPrefix(ctx: ActorContextHandle, prefix: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
830
|
+
actorKvListRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
831
|
+
actorKvBatchGet(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<Array<RuntimeBytes | undefined | null>>;
|
|
832
|
+
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
833
|
+
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
834
|
+
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
835
|
+
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
836
|
+
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
837
|
+
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
838
|
+
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
839
|
+
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
840
|
+
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
841
|
+
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
842
|
+
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
843
|
+
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
844
|
+
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
845
|
+
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
846
|
+
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
847
|
+
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
848
|
+
actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
|
|
849
|
+
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): void;
|
|
850
|
+
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): void;
|
|
851
|
+
connId(conn: ConnHandle): string;
|
|
852
|
+
connParams(conn: ConnHandle): RuntimeBytes;
|
|
853
|
+
connState(conn: ConnHandle): RuntimeBytes;
|
|
854
|
+
connSetState(conn: ConnHandle, state: RuntimeBytes): void;
|
|
855
|
+
connIsHibernatable(conn: ConnHandle): boolean;
|
|
856
|
+
connSend(conn: ConnHandle, name: string, args: RuntimeBytes): void;
|
|
857
|
+
connDisconnect(conn: ConnHandle, reason?: string | undefined | null): Promise<void>;
|
|
858
|
+
webSocketSend(ws: WebSocketHandle, data: RuntimeBytes, binary: boolean): void;
|
|
859
|
+
webSocketClose(ws: WebSocketHandle, code?: number | undefined | null, reason?: string | undefined | null): Promise<void>;
|
|
860
|
+
webSocketSetEventCallback(ws: WebSocketHandle, callback: (event: RuntimeWebSocketEvent) => void): void;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
declare function buildConfiguredRegistry(config: RegistryConfig): Promise<{
|
|
864
|
+
runtime: CoreRuntime;
|
|
865
|
+
registry: RegistryHandle;
|
|
866
|
+
serveConfig: RuntimeServeConfig;
|
|
867
|
+
}>;
|
|
868
|
+
|
|
557
869
|
type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
|
|
558
870
|
interface ServerlessHandler {
|
|
559
871
|
fetch: FetchHandler;
|
|
@@ -563,12 +875,20 @@ interface RegistryRoutes {
|
|
|
563
875
|
metadata(): Promise<Response>;
|
|
564
876
|
prometheusMetrics(request?: Request): Promise<Response>;
|
|
565
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* Injectable dependencies for {@link Registry}. Production code uses the
|
|
880
|
+
* defaults. Tests override `buildConfiguredRegistry` to drive lifecycle
|
|
881
|
+
* orchestration against a fake `CoreRuntime` without an engine.
|
|
882
|
+
*/
|
|
883
|
+
interface RegistryDeps {
|
|
884
|
+
buildConfiguredRegistry: typeof buildConfiguredRegistry;
|
|
885
|
+
}
|
|
566
886
|
declare class Registry<A extends RegistryActors> {
|
|
567
887
|
#private;
|
|
568
888
|
readonly routes: RegistryRoutes;
|
|
569
889
|
get config(): RegistryConfigInput<A>;
|
|
570
890
|
parseConfig(): RegistryConfig;
|
|
571
|
-
constructor(config: RegistryConfigInput<A>);
|
|
891
|
+
constructor(config: RegistryConfigInput<A>, deps?: Partial<RegistryDeps>);
|
|
572
892
|
/**
|
|
573
893
|
* Handle an incoming HTTP request for serverless deployments.
|
|
574
894
|
*
|
|
@@ -608,6 +928,27 @@ declare class Registry<A extends RegistryActors> {
|
|
|
608
928
|
port?: number;
|
|
609
929
|
publicDir?: string;
|
|
610
930
|
}): Promise<void>;
|
|
931
|
+
/**
|
|
932
|
+
* Gracefully drains all live registries.
|
|
933
|
+
*
|
|
934
|
+
* Programmatic counterpart to the SIGINT/SIGTERM handlers: tears down
|
|
935
|
+
* every live `CoreRegistry` (both `start()` and `handler()` modes) and
|
|
936
|
+
* waits for the serve promise to resolve, all bounded by the shutdown
|
|
937
|
+
* grace period. Unlike a signal-driven shutdown, this does not re-raise a
|
|
938
|
+
* signal or exit the process. The caller owns process lifetime.
|
|
939
|
+
*
|
|
940
|
+
* Idempotent: concurrent or repeated calls share a single drain. Safe to
|
|
941
|
+
* call even if nothing has been started.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```ts
|
|
945
|
+
* const registry = setup({ use: { counter } });
|
|
946
|
+
* registry.start();
|
|
947
|
+
* // ...later, on your own shutdown trigger:
|
|
948
|
+
* await registry.shutdown();
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
shutdown(): Promise<void>;
|
|
611
952
|
startEnvoy(): void;
|
|
612
953
|
/**
|
|
613
954
|
* Starts the actor envoy for standalone server deployments.
|
|
@@ -648,6 +989,10 @@ interface QueueSendResult<TResponse = unknown> {
|
|
|
648
989
|
type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unknown> = (...args: Args extends [unknown, ...infer Rest] ? Rest : Args) => Promise<Response>;
|
|
649
990
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
650
991
|
type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => void) => () => void;
|
|
992
|
+
type ActorActionMap<R> = {
|
|
993
|
+
[K in keyof NonNullable<R>]: NonNullable<R>[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Awaited<Return>> : never;
|
|
994
|
+
};
|
|
995
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? R : never;
|
|
651
996
|
interface ActorGatewayOptions {
|
|
652
997
|
skipReadyWait?: boolean;
|
|
653
998
|
}
|
|
@@ -660,15 +1005,7 @@ type ActorWebSocketOptions = ActorGatewayOptions;
|
|
|
660
1005
|
/**
|
|
661
1006
|
* Maps action methods from actor definition to typed function signatures.
|
|
662
1007
|
*/
|
|
663
|
-
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : AD
|
|
664
|
-
config: {
|
|
665
|
-
actions?: infer R;
|
|
666
|
-
};
|
|
667
|
-
} ? {
|
|
668
|
-
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
669
|
-
} : AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? {
|
|
670
|
-
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
671
|
-
} : {};
|
|
1008
|
+
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
|
|
672
1009
|
type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
|
|
673
1010
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
|
|
674
1011
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
|
|
@@ -1577,7 +1914,7 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
|
|
|
1577
1914
|
*/
|
|
1578
1915
|
db: TDatabase;
|
|
1579
1916
|
} | Record<never, never>;
|
|
1580
|
-
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = Omit<z$1.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues,
|
|
1917
|
+
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>> = Omit<z$1.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
|
|
1581
1918
|
|
|
1582
1919
|
type AgentOsActorState = {};
|
|
1583
1920
|
interface AgentOsActorVars {
|
|
@@ -261,7 +261,7 @@ function isRivetErrorCode(error, group, code) {
|
|
|
261
261
|
// package.json
|
|
262
262
|
var package_default = {
|
|
263
263
|
name: "rivetkit",
|
|
264
|
-
version: "2.3.0-rc.
|
|
264
|
+
version: "2.3.0-rc.12",
|
|
265
265
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
266
266
|
license: "Apache-2.0",
|
|
267
267
|
keywords: [
|