@cadenza.io/core 3.23.0 → 3.25.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 +56 -3
- package/dist/index.d.ts +56 -3
- package/dist/index.js +328 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +327 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -854,8 +854,10 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
854
854
|
readonly isEphemeral: boolean;
|
|
855
855
|
readonly isDebounce: boolean;
|
|
856
856
|
inputContextSchema: Schema;
|
|
857
|
+
hasExplicitInputContextSchema: boolean;
|
|
857
858
|
validateInputContext: boolean;
|
|
858
859
|
outputContextSchema: Schema;
|
|
860
|
+
hasExplicitOutputContextSchema: boolean;
|
|
859
861
|
validateOutputContext: boolean;
|
|
860
862
|
readonly retryCount: number;
|
|
861
863
|
readonly retryDelay: number;
|
|
@@ -962,7 +964,10 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
962
964
|
* @param {AnyObject} context - The input context to validate.
|
|
963
965
|
* @return {true | AnyObject} - Returns `true` if validation succeeds, otherwise returns an error object containing details of the validation failure.
|
|
964
966
|
*/
|
|
965
|
-
|
|
967
|
+
private getEffectiveValidationMode;
|
|
968
|
+
private warnMissingSchema;
|
|
969
|
+
private logValidationFailure;
|
|
970
|
+
validateInput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
|
|
966
971
|
/**
|
|
967
972
|
* Validates the output context using the provided schema and emits metadata if validation fails.
|
|
968
973
|
*
|
|
@@ -970,7 +975,7 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
970
975
|
* @return {true | AnyObject} Returns `true` if the output context is valid; otherwise, returns an object
|
|
971
976
|
* containing error information when validation fails.
|
|
972
977
|
*/
|
|
973
|
-
validateOutput(context: AnyObject): true | AnyObject;
|
|
978
|
+
validateOutput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
|
|
974
979
|
/**
|
|
975
980
|
* Executes a task within a given context, optionally emitting signals and reporting progress.
|
|
976
981
|
*
|
|
@@ -1854,6 +1859,8 @@ interface SessionPolicy {
|
|
|
1854
1859
|
idleTtlMs?: number;
|
|
1855
1860
|
absoluteTtlMs?: number;
|
|
1856
1861
|
extendIdleTtlOnRead?: boolean;
|
|
1862
|
+
persistDurableState?: boolean;
|
|
1863
|
+
persistenceTimeoutMs?: number;
|
|
1857
1864
|
}
|
|
1858
1865
|
/**
|
|
1859
1866
|
* Task retry policy metadata for actor definitions/specs.
|
|
@@ -2056,6 +2063,7 @@ interface ActorTaskRuntimeMetadata {
|
|
|
2056
2063
|
mode: ActorTaskMode;
|
|
2057
2064
|
forceMeta: boolean;
|
|
2058
2065
|
}
|
|
2066
|
+
declare const META_ACTOR_SESSION_STATE_PERSIST_INTENT = "meta-actor-session-state-persist";
|
|
2059
2067
|
/**
|
|
2060
2068
|
* Reads actor metadata from a wrapped task function if available.
|
|
2061
2069
|
*/
|
|
@@ -2126,6 +2134,7 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
|
|
|
2126
2134
|
private touchSession;
|
|
2127
2135
|
private runWithOptionalIdempotency;
|
|
2128
2136
|
private getActiveIdempotencyRecord;
|
|
2137
|
+
private persistDurableStateIfConfigured;
|
|
2129
2138
|
private emitActorCreatedSignal;
|
|
2130
2139
|
}
|
|
2131
2140
|
|
|
@@ -2148,6 +2157,33 @@ interface TaskOptions {
|
|
|
2148
2157
|
retryDelayFactor?: number;
|
|
2149
2158
|
}
|
|
2150
2159
|
type CadenzaMode = "dev" | "debug" | "verbose" | "production";
|
|
2160
|
+
type RuntimeValidationMode = "off" | "warn" | "enforce";
|
|
2161
|
+
interface RuntimeValidationPolicy {
|
|
2162
|
+
metaInput?: RuntimeValidationMode;
|
|
2163
|
+
metaOutput?: RuntimeValidationMode;
|
|
2164
|
+
businessInput?: RuntimeValidationMode;
|
|
2165
|
+
businessOutput?: RuntimeValidationMode;
|
|
2166
|
+
warnOnMissingMetaInputSchema?: boolean;
|
|
2167
|
+
warnOnMissingMetaOutputSchema?: boolean;
|
|
2168
|
+
warnOnMissingBusinessInputSchema?: boolean;
|
|
2169
|
+
warnOnMissingBusinessOutputSchema?: boolean;
|
|
2170
|
+
}
|
|
2171
|
+
interface RuntimeValidationScope {
|
|
2172
|
+
id: string;
|
|
2173
|
+
active?: boolean;
|
|
2174
|
+
startTaskNames?: string[];
|
|
2175
|
+
startRoutineNames?: string[];
|
|
2176
|
+
policy?: RuntimeValidationPolicy;
|
|
2177
|
+
}
|
|
2178
|
+
interface ResolvedRuntimeValidationPolicy {
|
|
2179
|
+
layer: "meta" | "business";
|
|
2180
|
+
inputMode: RuntimeValidationMode;
|
|
2181
|
+
outputMode: RuntimeValidationMode;
|
|
2182
|
+
warnOnMissingInputSchema: boolean;
|
|
2183
|
+
warnOnMissingOutputSchema: boolean;
|
|
2184
|
+
activeScopeIds: string[];
|
|
2185
|
+
}
|
|
2186
|
+
type RuntimeInquiryDelegate = (inquiry: string, context: AnyObject, options?: InquiryOptions) => Promise<any>;
|
|
2151
2187
|
/**
|
|
2152
2188
|
* Represents the core class of the Cadenza framework managing tasks, meta-tasks, signal emissions, and execution strategies.
|
|
2153
2189
|
* All core components such as SignalBroker, GraphRunner, and GraphRegistry are initialized through this class, and it provides
|
|
@@ -2161,6 +2197,10 @@ declare class Cadenza {
|
|
|
2161
2197
|
static registry: GraphRegistry;
|
|
2162
2198
|
private static taskCache;
|
|
2163
2199
|
private static actorCache;
|
|
2200
|
+
private static runtimeInquiryDelegate;
|
|
2201
|
+
private static runtimeValidationPolicy;
|
|
2202
|
+
private static runtimeValidationScopes;
|
|
2203
|
+
private static emittedMissingSchemaWarnings;
|
|
2164
2204
|
static isBootstrapped: boolean;
|
|
2165
2205
|
static mode: CadenzaMode;
|
|
2166
2206
|
/**
|
|
@@ -2248,6 +2288,19 @@ declare class Cadenza {
|
|
|
2248
2288
|
static getRoutine(routineName: string): GraphRoutine | undefined;
|
|
2249
2289
|
static defineIntent(intent: Intent): Intent;
|
|
2250
2290
|
static inquire(inquiry: string, context: AnyObject, options?: InquiryOptions): Promise<any>;
|
|
2291
|
+
static setRuntimeInquiryDelegate(delegate?: RuntimeInquiryDelegate): void;
|
|
2292
|
+
static resolveRuntimeInquiryDelegate(): RuntimeInquiryDelegate;
|
|
2293
|
+
static getRuntimeValidationPolicy(): RuntimeValidationPolicy;
|
|
2294
|
+
static setRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
|
|
2295
|
+
static replaceRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
|
|
2296
|
+
static clearRuntimeValidationPolicy(): void;
|
|
2297
|
+
static getRuntimeValidationScopes(): RuntimeValidationScope[];
|
|
2298
|
+
static upsertRuntimeValidationScope(scope: RuntimeValidationScope): RuntimeValidationScope;
|
|
2299
|
+
static removeRuntimeValidationScope(id: string): void;
|
|
2300
|
+
static clearRuntimeValidationScopes(): void;
|
|
2301
|
+
static applyRuntimeValidationScopesToContext(context: AnyObject, routineName: string, tasks: Task[]): AnyObject;
|
|
2302
|
+
static resolveRuntimeValidationPolicyForTask(task: Task, metadata?: AnyObject): ResolvedRuntimeValidationPolicy;
|
|
2303
|
+
static shouldEmitMissingSchemaWarning(cacheKey: string): boolean;
|
|
2251
2304
|
/**
|
|
2252
2305
|
* Creates an in-memory actor runtime instance.
|
|
2253
2306
|
*
|
|
@@ -2613,4 +2666,4 @@ declare class Cadenza {
|
|
|
2613
2666
|
static reset(): void;
|
|
2614
2667
|
}
|
|
2615
2668
|
|
|
2616
|
-
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, 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 };
|
|
2669
|
+
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 ResolvedRuntimeValidationPolicy, type RetryPolicy, type RuntimeValidationMode, type RuntimeValidationPolicy, type RuntimeValidationScope, 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
|
@@ -854,8 +854,10 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
854
854
|
readonly isEphemeral: boolean;
|
|
855
855
|
readonly isDebounce: boolean;
|
|
856
856
|
inputContextSchema: Schema;
|
|
857
|
+
hasExplicitInputContextSchema: boolean;
|
|
857
858
|
validateInputContext: boolean;
|
|
858
859
|
outputContextSchema: Schema;
|
|
860
|
+
hasExplicitOutputContextSchema: boolean;
|
|
859
861
|
validateOutputContext: boolean;
|
|
860
862
|
readonly retryCount: number;
|
|
861
863
|
readonly retryDelay: number;
|
|
@@ -962,7 +964,10 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
962
964
|
* @param {AnyObject} context - The input context to validate.
|
|
963
965
|
* @return {true | AnyObject} - Returns `true` if validation succeeds, otherwise returns an error object containing details of the validation failure.
|
|
964
966
|
*/
|
|
965
|
-
|
|
967
|
+
private getEffectiveValidationMode;
|
|
968
|
+
private warnMissingSchema;
|
|
969
|
+
private logValidationFailure;
|
|
970
|
+
validateInput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
|
|
966
971
|
/**
|
|
967
972
|
* Validates the output context using the provided schema and emits metadata if validation fails.
|
|
968
973
|
*
|
|
@@ -970,7 +975,7 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
970
975
|
* @return {true | AnyObject} Returns `true` if the output context is valid; otherwise, returns an object
|
|
971
976
|
* containing error information when validation fails.
|
|
972
977
|
*/
|
|
973
|
-
validateOutput(context: AnyObject): true | AnyObject;
|
|
978
|
+
validateOutput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
|
|
974
979
|
/**
|
|
975
980
|
* Executes a task within a given context, optionally emitting signals and reporting progress.
|
|
976
981
|
*
|
|
@@ -1854,6 +1859,8 @@ interface SessionPolicy {
|
|
|
1854
1859
|
idleTtlMs?: number;
|
|
1855
1860
|
absoluteTtlMs?: number;
|
|
1856
1861
|
extendIdleTtlOnRead?: boolean;
|
|
1862
|
+
persistDurableState?: boolean;
|
|
1863
|
+
persistenceTimeoutMs?: number;
|
|
1857
1864
|
}
|
|
1858
1865
|
/**
|
|
1859
1866
|
* Task retry policy metadata for actor definitions/specs.
|
|
@@ -2056,6 +2063,7 @@ interface ActorTaskRuntimeMetadata {
|
|
|
2056
2063
|
mode: ActorTaskMode;
|
|
2057
2064
|
forceMeta: boolean;
|
|
2058
2065
|
}
|
|
2066
|
+
declare const META_ACTOR_SESSION_STATE_PERSIST_INTENT = "meta-actor-session-state-persist";
|
|
2059
2067
|
/**
|
|
2060
2068
|
* Reads actor metadata from a wrapped task function if available.
|
|
2061
2069
|
*/
|
|
@@ -2126,6 +2134,7 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
|
|
|
2126
2134
|
private touchSession;
|
|
2127
2135
|
private runWithOptionalIdempotency;
|
|
2128
2136
|
private getActiveIdempotencyRecord;
|
|
2137
|
+
private persistDurableStateIfConfigured;
|
|
2129
2138
|
private emitActorCreatedSignal;
|
|
2130
2139
|
}
|
|
2131
2140
|
|
|
@@ -2148,6 +2157,33 @@ interface TaskOptions {
|
|
|
2148
2157
|
retryDelayFactor?: number;
|
|
2149
2158
|
}
|
|
2150
2159
|
type CadenzaMode = "dev" | "debug" | "verbose" | "production";
|
|
2160
|
+
type RuntimeValidationMode = "off" | "warn" | "enforce";
|
|
2161
|
+
interface RuntimeValidationPolicy {
|
|
2162
|
+
metaInput?: RuntimeValidationMode;
|
|
2163
|
+
metaOutput?: RuntimeValidationMode;
|
|
2164
|
+
businessInput?: RuntimeValidationMode;
|
|
2165
|
+
businessOutput?: RuntimeValidationMode;
|
|
2166
|
+
warnOnMissingMetaInputSchema?: boolean;
|
|
2167
|
+
warnOnMissingMetaOutputSchema?: boolean;
|
|
2168
|
+
warnOnMissingBusinessInputSchema?: boolean;
|
|
2169
|
+
warnOnMissingBusinessOutputSchema?: boolean;
|
|
2170
|
+
}
|
|
2171
|
+
interface RuntimeValidationScope {
|
|
2172
|
+
id: string;
|
|
2173
|
+
active?: boolean;
|
|
2174
|
+
startTaskNames?: string[];
|
|
2175
|
+
startRoutineNames?: string[];
|
|
2176
|
+
policy?: RuntimeValidationPolicy;
|
|
2177
|
+
}
|
|
2178
|
+
interface ResolvedRuntimeValidationPolicy {
|
|
2179
|
+
layer: "meta" | "business";
|
|
2180
|
+
inputMode: RuntimeValidationMode;
|
|
2181
|
+
outputMode: RuntimeValidationMode;
|
|
2182
|
+
warnOnMissingInputSchema: boolean;
|
|
2183
|
+
warnOnMissingOutputSchema: boolean;
|
|
2184
|
+
activeScopeIds: string[];
|
|
2185
|
+
}
|
|
2186
|
+
type RuntimeInquiryDelegate = (inquiry: string, context: AnyObject, options?: InquiryOptions) => Promise<any>;
|
|
2151
2187
|
/**
|
|
2152
2188
|
* Represents the core class of the Cadenza framework managing tasks, meta-tasks, signal emissions, and execution strategies.
|
|
2153
2189
|
* All core components such as SignalBroker, GraphRunner, and GraphRegistry are initialized through this class, and it provides
|
|
@@ -2161,6 +2197,10 @@ declare class Cadenza {
|
|
|
2161
2197
|
static registry: GraphRegistry;
|
|
2162
2198
|
private static taskCache;
|
|
2163
2199
|
private static actorCache;
|
|
2200
|
+
private static runtimeInquiryDelegate;
|
|
2201
|
+
private static runtimeValidationPolicy;
|
|
2202
|
+
private static runtimeValidationScopes;
|
|
2203
|
+
private static emittedMissingSchemaWarnings;
|
|
2164
2204
|
static isBootstrapped: boolean;
|
|
2165
2205
|
static mode: CadenzaMode;
|
|
2166
2206
|
/**
|
|
@@ -2248,6 +2288,19 @@ declare class Cadenza {
|
|
|
2248
2288
|
static getRoutine(routineName: string): GraphRoutine | undefined;
|
|
2249
2289
|
static defineIntent(intent: Intent): Intent;
|
|
2250
2290
|
static inquire(inquiry: string, context: AnyObject, options?: InquiryOptions): Promise<any>;
|
|
2291
|
+
static setRuntimeInquiryDelegate(delegate?: RuntimeInquiryDelegate): void;
|
|
2292
|
+
static resolveRuntimeInquiryDelegate(): RuntimeInquiryDelegate;
|
|
2293
|
+
static getRuntimeValidationPolicy(): RuntimeValidationPolicy;
|
|
2294
|
+
static setRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
|
|
2295
|
+
static replaceRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
|
|
2296
|
+
static clearRuntimeValidationPolicy(): void;
|
|
2297
|
+
static getRuntimeValidationScopes(): RuntimeValidationScope[];
|
|
2298
|
+
static upsertRuntimeValidationScope(scope: RuntimeValidationScope): RuntimeValidationScope;
|
|
2299
|
+
static removeRuntimeValidationScope(id: string): void;
|
|
2300
|
+
static clearRuntimeValidationScopes(): void;
|
|
2301
|
+
static applyRuntimeValidationScopesToContext(context: AnyObject, routineName: string, tasks: Task[]): AnyObject;
|
|
2302
|
+
static resolveRuntimeValidationPolicyForTask(task: Task, metadata?: AnyObject): ResolvedRuntimeValidationPolicy;
|
|
2303
|
+
static shouldEmitMissingSchemaWarning(cacheKey: string): boolean;
|
|
2251
2304
|
/**
|
|
2252
2305
|
* Creates an in-memory actor runtime instance.
|
|
2253
2306
|
*
|
|
@@ -2613,4 +2666,4 @@ declare class Cadenza {
|
|
|
2613
2666
|
static reset(): void;
|
|
2614
2667
|
}
|
|
2615
2668
|
|
|
2616
|
-
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, 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 };
|
|
2669
|
+
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 ResolvedRuntimeValidationPolicy, type RetryPolicy, type RuntimeValidationMode, type RuntimeValidationPolicy, type RuntimeValidationScope, 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 };
|