@cadenza.io/core 3.22.0 → 3.24.0

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/index.d.mts CHANGED
@@ -1854,6 +1854,8 @@ interface SessionPolicy {
1854
1854
  idleTtlMs?: number;
1855
1855
  absoluteTtlMs?: number;
1856
1856
  extendIdleTtlOnRead?: boolean;
1857
+ persistDurableState?: boolean;
1858
+ persistenceTimeoutMs?: number;
1857
1859
  }
1858
1860
  /**
1859
1861
  * Task retry policy metadata for actor definitions/specs.
@@ -2046,6 +2048,21 @@ interface ActorTaskContext<D extends Record<string, any>, R = AnyObject> {
2046
2048
  * Handler signature used by `actor.task(...)`.
2047
2049
  */
2048
2050
  type ActorTaskHandler<D extends Record<string, any>, R = AnyObject> = (context: ActorTaskContext<D, R>) => TaskResult | ActorStateReducer<D> | Promise<TaskResult | ActorStateReducer<D>>;
2051
+ /**
2052
+ * Metadata attached to wrapped actor task functions.
2053
+ */
2054
+ interface ActorTaskRuntimeMetadata {
2055
+ actorName: string;
2056
+ actorDescription?: string;
2057
+ actorKind: ActorKind;
2058
+ mode: ActorTaskMode;
2059
+ forceMeta: boolean;
2060
+ }
2061
+ declare const META_ACTOR_SESSION_STATE_PERSIST_INTENT = "meta-actor-session-state-persist";
2062
+ /**
2063
+ * Reads actor metadata from a wrapped task function if available.
2064
+ */
2065
+ declare function getActorTaskRuntimeMetadata(taskFunction: TaskFunction): ActorTaskRuntimeMetadata | undefined;
2049
2066
  /**
2050
2067
  * In-memory actor runtime.
2051
2068
  *
@@ -2112,6 +2129,8 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
2112
2129
  private touchSession;
2113
2130
  private runWithOptionalIdempotency;
2114
2131
  private getActiveIdempotencyRecord;
2132
+ private persistDurableStateIfConfigured;
2133
+ private emitActorCreatedSignal;
2115
2134
  }
2116
2135
 
2117
2136
  interface TaskOptions {
@@ -2145,6 +2164,7 @@ declare class Cadenza {
2145
2164
  static metaRunner: GraphRunner;
2146
2165
  static registry: GraphRegistry;
2147
2166
  private static taskCache;
2167
+ private static actorCache;
2148
2168
  static isBootstrapped: boolean;
2149
2169
  static mode: CadenzaMode;
2150
2170
  /**
@@ -2185,6 +2205,7 @@ declare class Cadenza {
2185
2205
  */
2186
2206
  static validateName(name: string): void;
2187
2207
  private static resolveTaskOptionsForActorTask;
2208
+ private static registerActor;
2188
2209
  /**
2189
2210
  * Executes the specified task or GraphRoutine with the given context using an internal runner.
2190
2211
  *
@@ -2226,6 +2247,8 @@ declare class Cadenza {
2226
2247
  static interval(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
2227
2248
  static debounce(signalName: string, context: any, delayMs: number): void;
2228
2249
  static get(taskName: string): Task | undefined;
2250
+ static getActor<D extends Record<string, any> = AnyObject, R = AnyObject>(actorName: string): Actor<D, R> | undefined;
2251
+ static getAllActors<D extends Record<string, any> = AnyObject, R = AnyObject>(): Actor<D, R>[];
2229
2252
  static getRoutine(routineName: string): GraphRoutine | undefined;
2230
2253
  static defineIntent(intent: Intent): Intent;
2231
2254
  static inquire(inquiry: string, context: AnyObject, options?: InquiryOptions): Promise<any>;
@@ -2594,4 +2617,4 @@ declare class Cadenza {
2594
2617
  static reset(): void;
2595
2618
  }
2596
2619
 
2597
- export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, type RetryPolicy, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
2620
+ export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorTaskRuntimeMetadata, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, META_ACTOR_SESSION_STATE_PERSIST_INTENT, type RetryPolicy, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };
package/dist/index.d.ts CHANGED
@@ -1854,6 +1854,8 @@ interface SessionPolicy {
1854
1854
  idleTtlMs?: number;
1855
1855
  absoluteTtlMs?: number;
1856
1856
  extendIdleTtlOnRead?: boolean;
1857
+ persistDurableState?: boolean;
1858
+ persistenceTimeoutMs?: number;
1857
1859
  }
1858
1860
  /**
1859
1861
  * Task retry policy metadata for actor definitions/specs.
@@ -2046,6 +2048,21 @@ interface ActorTaskContext<D extends Record<string, any>, R = AnyObject> {
2046
2048
  * Handler signature used by `actor.task(...)`.
2047
2049
  */
2048
2050
  type ActorTaskHandler<D extends Record<string, any>, R = AnyObject> = (context: ActorTaskContext<D, R>) => TaskResult | ActorStateReducer<D> | Promise<TaskResult | ActorStateReducer<D>>;
2051
+ /**
2052
+ * Metadata attached to wrapped actor task functions.
2053
+ */
2054
+ interface ActorTaskRuntimeMetadata {
2055
+ actorName: string;
2056
+ actorDescription?: string;
2057
+ actorKind: ActorKind;
2058
+ mode: ActorTaskMode;
2059
+ forceMeta: boolean;
2060
+ }
2061
+ declare const META_ACTOR_SESSION_STATE_PERSIST_INTENT = "meta-actor-session-state-persist";
2062
+ /**
2063
+ * Reads actor metadata from a wrapped task function if available.
2064
+ */
2065
+ declare function getActorTaskRuntimeMetadata(taskFunction: TaskFunction): ActorTaskRuntimeMetadata | undefined;
2049
2066
  /**
2050
2067
  * In-memory actor runtime.
2051
2068
  *
@@ -2112,6 +2129,8 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
2112
2129
  private touchSession;
2113
2130
  private runWithOptionalIdempotency;
2114
2131
  private getActiveIdempotencyRecord;
2132
+ private persistDurableStateIfConfigured;
2133
+ private emitActorCreatedSignal;
2115
2134
  }
2116
2135
 
2117
2136
  interface TaskOptions {
@@ -2145,6 +2164,7 @@ declare class Cadenza {
2145
2164
  static metaRunner: GraphRunner;
2146
2165
  static registry: GraphRegistry;
2147
2166
  private static taskCache;
2167
+ private static actorCache;
2148
2168
  static isBootstrapped: boolean;
2149
2169
  static mode: CadenzaMode;
2150
2170
  /**
@@ -2185,6 +2205,7 @@ declare class Cadenza {
2185
2205
  */
2186
2206
  static validateName(name: string): void;
2187
2207
  private static resolveTaskOptionsForActorTask;
2208
+ private static registerActor;
2188
2209
  /**
2189
2210
  * Executes the specified task or GraphRoutine with the given context using an internal runner.
2190
2211
  *
@@ -2226,6 +2247,8 @@ declare class Cadenza {
2226
2247
  static interval(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
2227
2248
  static debounce(signalName: string, context: any, delayMs: number): void;
2228
2249
  static get(taskName: string): Task | undefined;
2250
+ static getActor<D extends Record<string, any> = AnyObject, R = AnyObject>(actorName: string): Actor<D, R> | undefined;
2251
+ static getAllActors<D extends Record<string, any> = AnyObject, R = AnyObject>(): Actor<D, R>[];
2229
2252
  static getRoutine(routineName: string): GraphRoutine | undefined;
2230
2253
  static defineIntent(intent: Intent): Intent;
2231
2254
  static inquire(inquiry: string, context: AnyObject, options?: InquiryOptions): Promise<any>;
@@ -2594,4 +2617,4 @@ declare class Cadenza {
2594
2617
  static reset(): void;
2595
2618
  }
2596
2619
 
2597
- export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, type RetryPolicy, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
2620
+ export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorTaskRuntimeMetadata, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, META_ACTOR_SESSION_STATE_PERSIST_INTENT, type RetryPolicy, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };