@cadenza.io/core 3.25.1 → 3.26.1
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 +34 -8
- package/dist/index.d.ts +34 -8
- package/dist/index.js +204 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -355,6 +355,7 @@ interface InquiryOptions {
|
|
|
355
355
|
timeout?: number;
|
|
356
356
|
rejectOnTimeout?: boolean;
|
|
357
357
|
includePendingTasks?: boolean;
|
|
358
|
+
requireComplete?: boolean;
|
|
358
359
|
}
|
|
359
360
|
declare class InquiryBroker extends SignalEmitter {
|
|
360
361
|
static instance_: InquiryBroker;
|
|
@@ -1070,14 +1071,14 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
1070
1071
|
* @param {...string[]} signals - The array of signal names to observe.
|
|
1071
1072
|
* @return {this} The current instance after adding the specified signals.
|
|
1072
1073
|
*/
|
|
1073
|
-
doOn(...signals:
|
|
1074
|
+
doOn(...signals: SignalDefinitionInput[]): this;
|
|
1074
1075
|
/**
|
|
1075
1076
|
* Registers the specified signals to be emitted after the Task executes successfully and attaches them for further processing.
|
|
1076
1077
|
*
|
|
1077
1078
|
* @param {...string} signals - The list of signals to be registered for emission.
|
|
1078
1079
|
* @return {this} The current instance for method chaining.
|
|
1079
1080
|
*/
|
|
1080
|
-
emits(...signals:
|
|
1081
|
+
emits(...signals: SignalDefinitionInput[]): this;
|
|
1081
1082
|
/**
|
|
1082
1083
|
* Configures the instance to emit specified signals when the task execution fails.
|
|
1083
1084
|
* A failure is defined as anything that does not return a successful result.
|
|
@@ -1085,14 +1086,14 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
1085
1086
|
* @param {...string} signals - The names of the signals to emit upon failure.
|
|
1086
1087
|
* @return {this} Returns the current instance for chaining.
|
|
1087
1088
|
*/
|
|
1088
|
-
emitsOnFail(...signals:
|
|
1089
|
+
emitsOnFail(...signals: SignalDefinitionInput[]): this;
|
|
1089
1090
|
/**
|
|
1090
1091
|
* Attaches a signal to the current context and emits metadata if the register flag is set.
|
|
1091
1092
|
*
|
|
1092
1093
|
* @param {...string} signals - The names of the signals to attach.
|
|
1093
1094
|
* @return {void} This method does not return a value.
|
|
1094
1095
|
*/
|
|
1095
|
-
attachSignal(...signals:
|
|
1096
|
+
attachSignal(...signals: SignalDefinitionInput[]): Task;
|
|
1096
1097
|
/**
|
|
1097
1098
|
* Unsubscribes the current instance from the specified signals.
|
|
1098
1099
|
* This method removes the signals from the observedSignals set, unsubscribes
|
|
@@ -1485,6 +1486,22 @@ interface EmitOptions {
|
|
|
1485
1486
|
throttleBatch?: number;
|
|
1486
1487
|
flushStrategy?: string;
|
|
1487
1488
|
}
|
|
1489
|
+
type SignalDeliveryMode = "single" | "broadcast";
|
|
1490
|
+
type SignalReceiverFilter = {
|
|
1491
|
+
serviceNames?: string[];
|
|
1492
|
+
serviceInstanceIds?: string[];
|
|
1493
|
+
origins?: string[];
|
|
1494
|
+
roles?: string[];
|
|
1495
|
+
protocols?: string[];
|
|
1496
|
+
runtimeStates?: string[];
|
|
1497
|
+
};
|
|
1498
|
+
type SignalMetadata = {
|
|
1499
|
+
deliveryMode?: SignalDeliveryMode;
|
|
1500
|
+
broadcastFilter?: SignalReceiverFilter | null;
|
|
1501
|
+
};
|
|
1502
|
+
type SignalDefinitionInput = string | ({
|
|
1503
|
+
name: string;
|
|
1504
|
+
} & SignalMetadata);
|
|
1488
1505
|
type FlushStrategyName = string;
|
|
1489
1506
|
interface FlushStrategy {
|
|
1490
1507
|
intervalMs: number;
|
|
@@ -1513,12 +1530,17 @@ declare class SignalBroker {
|
|
|
1513
1530
|
registered: boolean;
|
|
1514
1531
|
}>;
|
|
1515
1532
|
emittedSignalsRegistry: Set<string>;
|
|
1533
|
+
signalMetadataRegistry: Map<string, SignalMetadata>;
|
|
1516
1534
|
private flushStrategies;
|
|
1517
1535
|
private strategyData;
|
|
1518
1536
|
private strategyTimers;
|
|
1519
1537
|
private isStrategyFlushing;
|
|
1520
1538
|
private readonly defaultStrategyName;
|
|
1521
1539
|
constructor();
|
|
1540
|
+
private resolveSignalMetadataKey;
|
|
1541
|
+
private normalizeSignalMetadata;
|
|
1542
|
+
setSignalMetadata(signal: string, metadata?: SignalMetadata | null): void;
|
|
1543
|
+
getSignalMetadata(signal: string): SignalMetadata | undefined;
|
|
1522
1544
|
logMemoryFootprint(label?: string): void;
|
|
1523
1545
|
/**
|
|
1524
1546
|
* Validates the provided signal name string to ensure it adheres to specific formatting rules.
|
|
@@ -1617,15 +1639,15 @@ declare class SignalBroker {
|
|
|
1617
1639
|
* @param {string} signal - The name of the signal to be added.
|
|
1618
1640
|
* @return {void} This method does not return any value.
|
|
1619
1641
|
*/
|
|
1620
|
-
addSignal(signal: string): void;
|
|
1642
|
+
addSignal(signal: string, metadata?: SignalMetadata | null): void;
|
|
1621
1643
|
/**
|
|
1622
1644
|
* Observes a signal with a routine/task.
|
|
1623
1645
|
* @param signal The signal (e.g., 'domain.action', 'domain.*' for wildcards).
|
|
1624
1646
|
* @param routineOrTask The observer.
|
|
1625
1647
|
* @edge Duplicates ignored; supports wildcards for broad listening.
|
|
1626
1648
|
*/
|
|
1627
|
-
observe(signal: string, routineOrTask: Task | GraphRoutine): void;
|
|
1628
|
-
registerEmittedSignal(signal: string): void;
|
|
1649
|
+
observe(signal: string, routineOrTask: Task | GraphRoutine, metadata?: SignalMetadata | null): void;
|
|
1650
|
+
registerEmittedSignal(signal: string, metadata?: SignalMetadata | null): void;
|
|
1629
1651
|
/**
|
|
1630
1652
|
* Unsubscribes a routine/task from a signal.
|
|
1631
1653
|
* @param signal The signal.
|
|
@@ -2082,6 +2104,7 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
|
|
|
2082
2104
|
private readonly stateByKey;
|
|
2083
2105
|
private readonly sessionByKey;
|
|
2084
2106
|
private readonly idempotencyByKey;
|
|
2107
|
+
private readonly writeQueueByKey;
|
|
2085
2108
|
private nextTaskBindingIndex;
|
|
2086
2109
|
/**
|
|
2087
2110
|
* Creates an actor instance and optionally materializes the default key.
|
|
@@ -2132,7 +2155,10 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
|
|
|
2132
2155
|
private resolveInitialRuntimeState;
|
|
2133
2156
|
private ensureStateRecord;
|
|
2134
2157
|
private touchSession;
|
|
2158
|
+
private pruneExpiredActorKeys;
|
|
2159
|
+
private isSessionExpired;
|
|
2135
2160
|
private runWithOptionalIdempotency;
|
|
2161
|
+
private runWithPerKeyWriteSerialization;
|
|
2136
2162
|
private getActiveIdempotencyRecord;
|
|
2137
2163
|
private persistDurableStateIfConfigured;
|
|
2138
2164
|
private emitActorCreatedSignal;
|
|
@@ -2666,4 +2692,4 @@ declare class Cadenza {
|
|
|
2666
2692
|
static reset(): void;
|
|
2667
2693
|
}
|
|
2668
2694
|
|
|
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 };
|
|
2695
|
+
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, type SignalDefinitionInput, type SignalDeliveryMode, SignalEmitter, type SignalMetadata, type SignalReceiverFilter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -355,6 +355,7 @@ interface InquiryOptions {
|
|
|
355
355
|
timeout?: number;
|
|
356
356
|
rejectOnTimeout?: boolean;
|
|
357
357
|
includePendingTasks?: boolean;
|
|
358
|
+
requireComplete?: boolean;
|
|
358
359
|
}
|
|
359
360
|
declare class InquiryBroker extends SignalEmitter {
|
|
360
361
|
static instance_: InquiryBroker;
|
|
@@ -1070,14 +1071,14 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
1070
1071
|
* @param {...string[]} signals - The array of signal names to observe.
|
|
1071
1072
|
* @return {this} The current instance after adding the specified signals.
|
|
1072
1073
|
*/
|
|
1073
|
-
doOn(...signals:
|
|
1074
|
+
doOn(...signals: SignalDefinitionInput[]): this;
|
|
1074
1075
|
/**
|
|
1075
1076
|
* Registers the specified signals to be emitted after the Task executes successfully and attaches them for further processing.
|
|
1076
1077
|
*
|
|
1077
1078
|
* @param {...string} signals - The list of signals to be registered for emission.
|
|
1078
1079
|
* @return {this} The current instance for method chaining.
|
|
1079
1080
|
*/
|
|
1080
|
-
emits(...signals:
|
|
1081
|
+
emits(...signals: SignalDefinitionInput[]): this;
|
|
1081
1082
|
/**
|
|
1082
1083
|
* Configures the instance to emit specified signals when the task execution fails.
|
|
1083
1084
|
* A failure is defined as anything that does not return a successful result.
|
|
@@ -1085,14 +1086,14 @@ declare class Task extends SignalEmitter implements Graph {
|
|
|
1085
1086
|
* @param {...string} signals - The names of the signals to emit upon failure.
|
|
1086
1087
|
* @return {this} Returns the current instance for chaining.
|
|
1087
1088
|
*/
|
|
1088
|
-
emitsOnFail(...signals:
|
|
1089
|
+
emitsOnFail(...signals: SignalDefinitionInput[]): this;
|
|
1089
1090
|
/**
|
|
1090
1091
|
* Attaches a signal to the current context and emits metadata if the register flag is set.
|
|
1091
1092
|
*
|
|
1092
1093
|
* @param {...string} signals - The names of the signals to attach.
|
|
1093
1094
|
* @return {void} This method does not return a value.
|
|
1094
1095
|
*/
|
|
1095
|
-
attachSignal(...signals:
|
|
1096
|
+
attachSignal(...signals: SignalDefinitionInput[]): Task;
|
|
1096
1097
|
/**
|
|
1097
1098
|
* Unsubscribes the current instance from the specified signals.
|
|
1098
1099
|
* This method removes the signals from the observedSignals set, unsubscribes
|
|
@@ -1485,6 +1486,22 @@ interface EmitOptions {
|
|
|
1485
1486
|
throttleBatch?: number;
|
|
1486
1487
|
flushStrategy?: string;
|
|
1487
1488
|
}
|
|
1489
|
+
type SignalDeliveryMode = "single" | "broadcast";
|
|
1490
|
+
type SignalReceiverFilter = {
|
|
1491
|
+
serviceNames?: string[];
|
|
1492
|
+
serviceInstanceIds?: string[];
|
|
1493
|
+
origins?: string[];
|
|
1494
|
+
roles?: string[];
|
|
1495
|
+
protocols?: string[];
|
|
1496
|
+
runtimeStates?: string[];
|
|
1497
|
+
};
|
|
1498
|
+
type SignalMetadata = {
|
|
1499
|
+
deliveryMode?: SignalDeliveryMode;
|
|
1500
|
+
broadcastFilter?: SignalReceiverFilter | null;
|
|
1501
|
+
};
|
|
1502
|
+
type SignalDefinitionInput = string | ({
|
|
1503
|
+
name: string;
|
|
1504
|
+
} & SignalMetadata);
|
|
1488
1505
|
type FlushStrategyName = string;
|
|
1489
1506
|
interface FlushStrategy {
|
|
1490
1507
|
intervalMs: number;
|
|
@@ -1513,12 +1530,17 @@ declare class SignalBroker {
|
|
|
1513
1530
|
registered: boolean;
|
|
1514
1531
|
}>;
|
|
1515
1532
|
emittedSignalsRegistry: Set<string>;
|
|
1533
|
+
signalMetadataRegistry: Map<string, SignalMetadata>;
|
|
1516
1534
|
private flushStrategies;
|
|
1517
1535
|
private strategyData;
|
|
1518
1536
|
private strategyTimers;
|
|
1519
1537
|
private isStrategyFlushing;
|
|
1520
1538
|
private readonly defaultStrategyName;
|
|
1521
1539
|
constructor();
|
|
1540
|
+
private resolveSignalMetadataKey;
|
|
1541
|
+
private normalizeSignalMetadata;
|
|
1542
|
+
setSignalMetadata(signal: string, metadata?: SignalMetadata | null): void;
|
|
1543
|
+
getSignalMetadata(signal: string): SignalMetadata | undefined;
|
|
1522
1544
|
logMemoryFootprint(label?: string): void;
|
|
1523
1545
|
/**
|
|
1524
1546
|
* Validates the provided signal name string to ensure it adheres to specific formatting rules.
|
|
@@ -1617,15 +1639,15 @@ declare class SignalBroker {
|
|
|
1617
1639
|
* @param {string} signal - The name of the signal to be added.
|
|
1618
1640
|
* @return {void} This method does not return any value.
|
|
1619
1641
|
*/
|
|
1620
|
-
addSignal(signal: string): void;
|
|
1642
|
+
addSignal(signal: string, metadata?: SignalMetadata | null): void;
|
|
1621
1643
|
/**
|
|
1622
1644
|
* Observes a signal with a routine/task.
|
|
1623
1645
|
* @param signal The signal (e.g., 'domain.action', 'domain.*' for wildcards).
|
|
1624
1646
|
* @param routineOrTask The observer.
|
|
1625
1647
|
* @edge Duplicates ignored; supports wildcards for broad listening.
|
|
1626
1648
|
*/
|
|
1627
|
-
observe(signal: string, routineOrTask: Task | GraphRoutine): void;
|
|
1628
|
-
registerEmittedSignal(signal: string): void;
|
|
1649
|
+
observe(signal: string, routineOrTask: Task | GraphRoutine, metadata?: SignalMetadata | null): void;
|
|
1650
|
+
registerEmittedSignal(signal: string, metadata?: SignalMetadata | null): void;
|
|
1629
1651
|
/**
|
|
1630
1652
|
* Unsubscribes a routine/task from a signal.
|
|
1631
1653
|
* @param signal The signal.
|
|
@@ -2082,6 +2104,7 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
|
|
|
2082
2104
|
private readonly stateByKey;
|
|
2083
2105
|
private readonly sessionByKey;
|
|
2084
2106
|
private readonly idempotencyByKey;
|
|
2107
|
+
private readonly writeQueueByKey;
|
|
2085
2108
|
private nextTaskBindingIndex;
|
|
2086
2109
|
/**
|
|
2087
2110
|
* Creates an actor instance and optionally materializes the default key.
|
|
@@ -2132,7 +2155,10 @@ declare class Actor<D extends Record<string, any> = AnyObject, R = AnyObject> {
|
|
|
2132
2155
|
private resolveInitialRuntimeState;
|
|
2133
2156
|
private ensureStateRecord;
|
|
2134
2157
|
private touchSession;
|
|
2158
|
+
private pruneExpiredActorKeys;
|
|
2159
|
+
private isSessionExpired;
|
|
2135
2160
|
private runWithOptionalIdempotency;
|
|
2161
|
+
private runWithPerKeyWriteSerialization;
|
|
2136
2162
|
private getActiveIdempotencyRecord;
|
|
2137
2163
|
private persistDurableStateIfConfigured;
|
|
2138
2164
|
private emitActorCreatedSignal;
|
|
@@ -2666,4 +2692,4 @@ declare class Cadenza {
|
|
|
2666
2692
|
static reset(): void;
|
|
2667
2693
|
}
|
|
2668
2694
|
|
|
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 };
|
|
2695
|
+
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, type SignalDefinitionInput, type SignalDeliveryMode, SignalEmitter, type SignalMetadata, type SignalReceiverFilter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };
|