You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
createVarsTimeout: z.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
624
-
createConnStateTimeout: z.number().optional().describe("Timeout in ms for createConnState handler. Default: 5000"),
625
-
onConnectTimeout: z.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
626
-
onSleepTimeout: z.number().optional().describe("Timeout in ms for onSleep handler. Must be less than ACTOR_STOP_THRESHOLD_MS. Default: 5000"),
627
-
onDestroyTimeout: z.number().optional().describe("Timeout in ms for onDestroy handler. Default: 5000"),
628
-
stateSaveInterval: z.number().optional().describe("Interval in ms between automatic state saves. Default: 10000"),
629
-
actionTimeout: z.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
630
-
waitUntilTimeout: z.number().optional().describe("Max time in ms to wait for waitUntil background promises during shutdown. Default: 15000"),
631
-
connectionLivenessTimeout: z.number().optional().describe("Timeout in ms for connection liveness checks. Default: 2500"),
632
-
connectionLivenessInterval: z.number().optional().describe("Interval in ms between connection liveness checks. Default: 5000"),
633
-
noSleep: z.boolean().optional().describe("If true, the actor will never sleep. Default: false"),
634
-
sleepTimeout: z.number().optional().describe("Time in ms of inactivity before the actor sleeps. Default: 30000"),
635
-
canHibernateWebSocket: z.boolean().optional().describe("Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"),
630
+
createVarsTimeout: z
631
+
.number()
632
+
.optional()
633
+
.describe("Timeout in ms for createVars handler. Default: 5000"),
634
+
createConnStateTimeout: z
635
+
.number()
636
+
.optional()
637
+
.describe(
638
+
"Timeout in ms for createConnState handler. Default: 5000",
639
+
),
640
+
onConnectTimeout: z
641
+
.number()
642
+
.optional()
643
+
.describe("Timeout in ms for onConnect handler. Default: 5000"),
644
+
onSleepTimeout: z
645
+
.number()
646
+
.optional()
647
+
.describe(
648
+
"Timeout in ms for onSleep handler. Must be less than ACTOR_STOP_THRESHOLD_MS. Default: 5000",
649
+
),
650
+
onDestroyTimeout: z
651
+
.number()
652
+
.optional()
653
+
.describe("Timeout in ms for onDestroy handler. Default: 5000"),
654
+
stateSaveInterval: z
655
+
.number()
656
+
.optional()
657
+
.describe(
658
+
"Interval in ms between automatic state saves. Default: 10000",
659
+
),
660
+
actionTimeout: z
661
+
.number()
662
+
.optional()
663
+
.describe("Timeout in ms for action handlers. Default: 60000"),
664
+
waitUntilTimeout: z
665
+
.number()
666
+
.optional()
667
+
.describe(
668
+
"Max time in ms to wait for waitUntil background promises during shutdown. Default: 15000",
669
+
),
670
+
connectionLivenessTimeout: z
671
+
.number()
672
+
.optional()
673
+
.describe(
674
+
"Timeout in ms for connection liveness checks. Default: 2500",
675
+
),
676
+
connectionLivenessInterval: z
677
+
.number()
678
+
.optional()
679
+
.describe(
680
+
"Interval in ms between connection liveness checks. Default: 5000",
681
+
),
682
+
noSleep: z
683
+
.boolean()
684
+
.optional()
685
+
.describe("If true, the actor will never sleep. Default: false"),
686
+
sleepTimeout: z
687
+
.number()
688
+
.optional()
689
+
.describe(
690
+
"Time in ms of inactivity before the actor sleeps. Default: 30000",
691
+
),
692
+
canHibernateWebSocket: z
693
+
.boolean()
694
+
.optional()
695
+
.describe(
696
+
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false",
697
+
),
636
698
})
637
699
.describe("Actor options for timeouts and behavior configuration.");
638
700
639
701
exportconstDocActorConfigSchema=z
640
702
.object({
641
-
state: z.unknown().optional().describe("Initial state value for the actor. Cannot be used with createState."),
642
-
createState: z.unknown().optional().describe("Function to create initial state. Receives context and input. Cannot be used with state."),
643
-
connState: z.unknown().optional().describe("Initial connection state value. Cannot be used with createConnState."),
644
-
createConnState: z.unknown().optional().describe("Function to create connection state. Receives context and connection params. Cannot be used with connState."),
645
-
vars: z.unknown().optional().describe("Initial ephemeral variables value. Cannot be used with createVars."),
646
-
createVars: z.unknown().optional().describe("Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."),
647
-
db: z.unknown().optional().describe("Database provider instance for the actor."),
648
-
onCreate: z.unknown().optional().describe("Called when the actor is first initialized. Use to initialize state."),
649
-
onDestroy: z.unknown().optional().describe("Called when the actor is destroyed."),
650
-
onWake: z.unknown().optional().describe("Called when the actor wakes up and is ready to receive connections and actions."),
651
-
onSleep: z.unknown().optional().describe("Called when the actor is stopping or sleeping. Use to clean up resources."),
652
-
onStateChange: z.unknown().optional().describe("Called when the actor's state changes. State changes within this hook won't trigger recursion."),
653
-
onBeforeConnect: z.unknown().optional().describe("Called before a client connects. Throw an error to reject the connection."),
654
-
onConnect: z.unknown().optional().describe("Called when a client successfully connects."),
655
-
onDisconnect: z.unknown().optional().describe("Called when a client disconnects."),
656
-
onBeforeActionResponse: z.unknown().optional().describe("Called before sending an action response. Use to transform output."),
657
-
onRequest: z.unknown().optional().describe("Called for raw HTTP requests to /actors/{name}/http/* endpoints."),
658
-
onWebSocket: z.unknown().optional().describe("Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."),
659
-
actions: z.record(z.string(),z.unknown()).optional().describe("Map of action name to handler function."),
703
+
state: z
704
+
.unknown()
705
+
.optional()
706
+
.describe(
707
+
"Initial state value for the actor. Cannot be used with createState.",
708
+
),
709
+
createState: z
710
+
.unknown()
711
+
.optional()
712
+
.describe(
713
+
"Function to create initial state. Receives context and input. Cannot be used with state.",
714
+
),
715
+
connState: z
716
+
.unknown()
717
+
.optional()
718
+
.describe(
719
+
"Initial connection state value. Cannot be used with createConnState.",
720
+
),
721
+
createConnState: z
722
+
.unknown()
723
+
.optional()
724
+
.describe(
725
+
"Function to create connection state. Receives context and connection params. Cannot be used with connState.",
726
+
),
727
+
vars: z
728
+
.unknown()
729
+
.optional()
730
+
.describe(
731
+
"Initial ephemeral variables value. Cannot be used with createVars.",
732
+
),
733
+
createVars: z
734
+
.unknown()
735
+
.optional()
736
+
.describe(
737
+
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars.",
738
+
),
739
+
db: z
740
+
.unknown()
741
+
.optional()
742
+
.describe("Database provider instance for the actor."),
743
+
onCreate: z
744
+
.unknown()
745
+
.optional()
746
+
.describe(
747
+
"Called when the actor is first initialized. Use to initialize state.",
748
+
),
749
+
onDestroy: z
750
+
.unknown()
751
+
.optional()
752
+
.describe("Called when the actor is destroyed."),
753
+
onWake: z
754
+
.unknown()
755
+
.optional()
756
+
.describe(
757
+
"Called when the actor wakes up and is ready to receive connections and actions.",
758
+
),
759
+
onSleep: z
760
+
.unknown()
761
+
.optional()
762
+
.describe(
763
+
"Called when the actor is stopping or sleeping. Use to clean up resources.",
764
+
),
765
+
onStateChange: z
766
+
.unknown()
767
+
.optional()
768
+
.describe(
769
+
"Called when the actor's state changes. State changes within this hook won't trigger recursion.",
770
+
),
771
+
onBeforeConnect: z
772
+
.unknown()
773
+
.optional()
774
+
.describe(
775
+
"Called before a client connects. Throw an error to reject the connection.",
776
+
),
777
+
onConnect: z
778
+
.unknown()
779
+
.optional()
780
+
.describe("Called when a client successfully connects."),
781
+
onDisconnect: z
782
+
.unknown()
783
+
.optional()
784
+
.describe("Called when a client disconnects."),
785
+
onBeforeActionResponse: z
786
+
.unknown()
787
+
.optional()
788
+
.describe(
789
+
"Called before sending an action response. Use to transform output.",
790
+
),
791
+
onRequest: z
792
+
.unknown()
793
+
.optional()
794
+
.describe(
795
+
"Called for raw HTTP requests to /actors/{name}/http/* endpoints.",
796
+
),
797
+
onWebSocket: z
798
+
.unknown()
799
+
.optional()
800
+
.describe(
801
+
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints.",
802
+
),
803
+
actions: z
804
+
.record(z.string(),z.unknown())
805
+
.optional()
806
+
.describe(
807
+
"Map of action name to handler function. Defaults to an empty object.",
808
+
),
660
809
options: DocActorOptionsSchema.optional(),
661
810
})
662
811
.describe("Actor configuration passed to the actor() function.");
0 commit comments