@cadenza.io/service 2.7.0 → 2.9.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 +69 -29
- package/dist/index.d.ts +69 -29
- package/dist/index.js +1610 -643
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1613 -644
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _cadenza_io_core from '@cadenza.io/core';
|
|
2
|
-
import { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, EmitOptions, CadenzaMode, Intent, TaskOptions, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
3
|
-
export { AnyObject, DebounceOptions, DebounceTask, EphemeralTask, EphemeralTaskOptions, GraphRoutine, Task, TaskFunction, TaskOptions, ThrottleTagGetter } from '@cadenza.io/core';
|
|
2
|
+
import { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, EmitOptions, CadenzaMode, Intent, TaskOptions, ActorSpec, ActorFactoryOptions, Actor, ActorDefinition, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
3
|
+
export { Actor, ActorConsistencyProfileName, ActorDefinition, ActorFactoryOptions, ActorInvocationOptions, ActorKeyDefinition, ActorKind, ActorLoadPolicy, ActorRuntimeReadGuard, ActorSpec, ActorStateDefinition, ActorStateReducer, ActorStateStore, ActorTaskBindingDefinition, ActorTaskBindingOptions, ActorTaskContext, ActorTaskHandler, ActorTaskMode, ActorWriteContract, AnyObject, DebounceOptions, DebounceTask, EphemeralTask, EphemeralTaskOptions, GraphRoutine, IdempotencyPolicy, RetryPolicy, SessionPolicy, Task, TaskFunction, TaskOptions, ThrottleTagGetter } from '@cadenza.io/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a task that delegates execution of a routine to a remote system or service.
|
|
@@ -236,6 +236,8 @@ declare class ServiceRegistry {
|
|
|
236
236
|
private remoteIntentDeputiesByTask;
|
|
237
237
|
private dependeesByService;
|
|
238
238
|
private dependeeByInstance;
|
|
239
|
+
private readinessDependeesByService;
|
|
240
|
+
private readinessDependeeByInstance;
|
|
239
241
|
private lastHeartbeatAtByInstance;
|
|
240
242
|
private missedHeartbeatsByInstance;
|
|
241
243
|
private runtimeStatusFallbackInFlightByInstance;
|
|
@@ -270,6 +272,7 @@ declare class ServiceRegistry {
|
|
|
270
272
|
handleServiceNotRespondingTask: Task;
|
|
271
273
|
handleServiceHandshakeTask: Task;
|
|
272
274
|
collectTransportDiagnosticsTask: Task;
|
|
275
|
+
collectReadinessTask: Task;
|
|
273
276
|
private buildRemoteIntentDeputyKey;
|
|
274
277
|
private normalizeIntentMaps;
|
|
275
278
|
private registerRemoteIntentDeputy;
|
|
@@ -279,11 +282,16 @@ declare class ServiceRegistry {
|
|
|
279
282
|
private getLocalInstance;
|
|
280
283
|
private registerDependee;
|
|
281
284
|
private unregisterDependee;
|
|
285
|
+
private getHeartbeatMisses;
|
|
286
|
+
private shouldRequireReadinessFromCommunicationTypes;
|
|
282
287
|
private resolveRuntimeStatusSnapshot;
|
|
283
288
|
private normalizeRuntimeStatusReport;
|
|
284
289
|
private applyRuntimeStatusReport;
|
|
285
290
|
private buildLocalRuntimeStatusReport;
|
|
286
291
|
private selectRuntimeStatusReportForTarget;
|
|
292
|
+
private resolveRuntimeStatusFallbackInquiry;
|
|
293
|
+
private evaluateDependencyReadinessDetail;
|
|
294
|
+
private buildLocalReadinessReport;
|
|
287
295
|
/**
|
|
288
296
|
* Initializes a private constructor for managing service instances, remote signals,
|
|
289
297
|
* service health, and handling updates or synchronization tasks. The constructor
|
|
@@ -22414,6 +22422,8 @@ declare class CadenzaService {
|
|
|
22414
22422
|
* @return {void} - This method does not return a value.
|
|
22415
22423
|
*/
|
|
22416
22424
|
static createMetaDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22425
|
+
static createActor<D extends Record<string, any> = AnyObject, R = AnyObject>(spec: ActorSpec<D, R>, options?: ActorFactoryOptions): Actor<D, R>;
|
|
22426
|
+
static createActorFromDefinition<D extends Record<string, any> = AnyObject, R = AnyObject>(definition: ActorDefinition<D, R>, options?: ActorFactoryOptions<D, R>): Actor<D, R>;
|
|
22417
22427
|
/**
|
|
22418
22428
|
* Creates and registers a new task with the provided name, function, and optional details.
|
|
22419
22429
|
*
|
|
@@ -22776,6 +22786,9 @@ declare class RestController {
|
|
|
22776
22786
|
static get instance(): RestController;
|
|
22777
22787
|
private fetchClientDiagnostics;
|
|
22778
22788
|
private readonly diagnosticsErrorHistoryLimit;
|
|
22789
|
+
private readonly diagnosticsMaxClientEntries;
|
|
22790
|
+
private readonly destroyedDiagnosticsTtlMs;
|
|
22791
|
+
private pruneFetchClientDiagnostics;
|
|
22779
22792
|
private resolveTransportDiagnosticsOptions;
|
|
22780
22793
|
private ensureFetchClientDiagnostics;
|
|
22781
22794
|
private getErrorMessage;
|
|
@@ -22805,41 +22818,68 @@ declare class RestController {
|
|
|
22805
22818
|
constructor();
|
|
22806
22819
|
}
|
|
22807
22820
|
|
|
22821
|
+
interface TransportDiagnosticErrorEntry {
|
|
22822
|
+
at: string;
|
|
22823
|
+
message: string;
|
|
22824
|
+
}
|
|
22825
|
+
interface SocketClientDiagnosticsState {
|
|
22826
|
+
fetchId: string;
|
|
22827
|
+
serviceName: string;
|
|
22828
|
+
url: string;
|
|
22829
|
+
socketId: string | null;
|
|
22830
|
+
connected: boolean;
|
|
22831
|
+
handshake: boolean;
|
|
22832
|
+
reconnectAttempts: number;
|
|
22833
|
+
connectErrors: number;
|
|
22834
|
+
reconnectErrors: number;
|
|
22835
|
+
socketErrors: number;
|
|
22836
|
+
pendingDelegations: number;
|
|
22837
|
+
pendingTimers: number;
|
|
22838
|
+
destroyed: boolean;
|
|
22839
|
+
lastHandshakeAt: string | null;
|
|
22840
|
+
lastHandshakeError: string | null;
|
|
22841
|
+
lastDisconnectAt: string | null;
|
|
22842
|
+
lastError: string | null;
|
|
22843
|
+
lastErrorAt: number;
|
|
22844
|
+
errorHistory: TransportDiagnosticErrorEntry[];
|
|
22845
|
+
updatedAt: number;
|
|
22846
|
+
}
|
|
22808
22847
|
/**
|
|
22809
|
-
*
|
|
22810
|
-
*
|
|
22811
|
-
*
|
|
22812
|
-
*
|
|
22813
|
-
*
|
|
22848
|
+
* Socket transport orchestration in the Cadenza primitive ecosystem.
|
|
22849
|
+
*
|
|
22850
|
+
* - setup is signal-triggered
|
|
22851
|
+
* - state/runtime ownership is actor-backed
|
|
22852
|
+
* - dynamic runtime tasks are still allowed for advanced orchestration (ephemeral resolvers etc.)
|
|
22814
22853
|
*/
|
|
22815
22854
|
declare class SocketController {
|
|
22816
22855
|
private static _instance;
|
|
22817
22856
|
static get instance(): SocketController;
|
|
22818
|
-
private socketClientDiagnostics;
|
|
22819
22857
|
private readonly diagnosticsErrorHistoryLimit;
|
|
22820
|
-
private
|
|
22821
|
-
private
|
|
22858
|
+
private readonly diagnosticsMaxClientEntries;
|
|
22859
|
+
private readonly destroyedDiagnosticsTtlMs;
|
|
22860
|
+
private readonly socketServerDefaultKey;
|
|
22861
|
+
private readonly socketServerActor;
|
|
22862
|
+
private readonly socketClientActor;
|
|
22863
|
+
private readonly socketClientDiagnosticsActor;
|
|
22864
|
+
constructor();
|
|
22865
|
+
private registerDiagnosticsTasks;
|
|
22866
|
+
private registerSocketServerTasks;
|
|
22867
|
+
private registerSocketClientTasks;
|
|
22868
|
+
private createInitialSocketServerSessionState;
|
|
22869
|
+
private createInitialSocketClientSessionState;
|
|
22870
|
+
private resolveSocketServerKey;
|
|
22871
|
+
private resolveSocketClientFetchId;
|
|
22872
|
+
private resolveServicePort;
|
|
22873
|
+
private createSocketServerRuntimeHandleFromContext;
|
|
22874
|
+
private destroySocketServerRuntimeHandle;
|
|
22875
|
+
private createSocketClientRuntimeHandle;
|
|
22876
|
+
private destroySocketClientRuntimeHandle;
|
|
22877
|
+
private normalizeCommunicationTypes;
|
|
22822
22878
|
private getErrorMessage;
|
|
22823
|
-
private
|
|
22879
|
+
private pruneDiagnosticsEntries;
|
|
22880
|
+
getSocketClientDiagnosticsEntry(fetchId: string): Promise<SocketClientDiagnosticsState | undefined>;
|
|
22881
|
+
private resolveTransportDiagnosticsOptions;
|
|
22824
22882
|
private collectSocketTransportDiagnostics;
|
|
22825
|
-
/**
|
|
22826
|
-
* Constructs the `SocketServer`, setting up a WebSocket server with specific configurations,
|
|
22827
|
-
* including connection state recovery, rate limiting, CORS handling, and custom event handling.
|
|
22828
|
-
* This class sets up the communication infrastructure for scalable, resilient, and secure WebSocket-based interactions
|
|
22829
|
-
* using metadata-driven task execution with `Cadenza`.
|
|
22830
|
-
*
|
|
22831
|
-
* It provides support for:
|
|
22832
|
-
* - Origin-based access control for connections.
|
|
22833
|
-
* - Optional payload sanitization.
|
|
22834
|
-
* - Configurable rate limiting and behavior on limit breaches (soft/hard disconnects).
|
|
22835
|
-
* - Event handlers for connection, handshake, delegation, signaling, status checks, and disconnection.
|
|
22836
|
-
*
|
|
22837
|
-
* The server can handle both internal and external interactions depending on the provided configurations,
|
|
22838
|
-
* and integrates directly with Cadenza's task workflow engine.
|
|
22839
|
-
*
|
|
22840
|
-
* Initializes the `SocketServer` to be ready for WebSocket communication.
|
|
22841
|
-
*/
|
|
22842
|
-
constructor();
|
|
22843
22883
|
}
|
|
22844
22884
|
|
|
22845
22885
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _cadenza_io_core from '@cadenza.io/core';
|
|
2
|
-
import { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, EmitOptions, CadenzaMode, Intent, TaskOptions, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
3
|
-
export { AnyObject, DebounceOptions, DebounceTask, EphemeralTask, EphemeralTaskOptions, GraphRoutine, Task, TaskFunction, TaskOptions, ThrottleTagGetter } from '@cadenza.io/core';
|
|
2
|
+
import { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, EmitOptions, CadenzaMode, Intent, TaskOptions, ActorSpec, ActorFactoryOptions, Actor, ActorDefinition, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
3
|
+
export { Actor, ActorConsistencyProfileName, ActorDefinition, ActorFactoryOptions, ActorInvocationOptions, ActorKeyDefinition, ActorKind, ActorLoadPolicy, ActorRuntimeReadGuard, ActorSpec, ActorStateDefinition, ActorStateReducer, ActorStateStore, ActorTaskBindingDefinition, ActorTaskBindingOptions, ActorTaskContext, ActorTaskHandler, ActorTaskMode, ActorWriteContract, AnyObject, DebounceOptions, DebounceTask, EphemeralTask, EphemeralTaskOptions, GraphRoutine, IdempotencyPolicy, RetryPolicy, SessionPolicy, Task, TaskFunction, TaskOptions, ThrottleTagGetter } from '@cadenza.io/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a task that delegates execution of a routine to a remote system or service.
|
|
@@ -236,6 +236,8 @@ declare class ServiceRegistry {
|
|
|
236
236
|
private remoteIntentDeputiesByTask;
|
|
237
237
|
private dependeesByService;
|
|
238
238
|
private dependeeByInstance;
|
|
239
|
+
private readinessDependeesByService;
|
|
240
|
+
private readinessDependeeByInstance;
|
|
239
241
|
private lastHeartbeatAtByInstance;
|
|
240
242
|
private missedHeartbeatsByInstance;
|
|
241
243
|
private runtimeStatusFallbackInFlightByInstance;
|
|
@@ -270,6 +272,7 @@ declare class ServiceRegistry {
|
|
|
270
272
|
handleServiceNotRespondingTask: Task;
|
|
271
273
|
handleServiceHandshakeTask: Task;
|
|
272
274
|
collectTransportDiagnosticsTask: Task;
|
|
275
|
+
collectReadinessTask: Task;
|
|
273
276
|
private buildRemoteIntentDeputyKey;
|
|
274
277
|
private normalizeIntentMaps;
|
|
275
278
|
private registerRemoteIntentDeputy;
|
|
@@ -279,11 +282,16 @@ declare class ServiceRegistry {
|
|
|
279
282
|
private getLocalInstance;
|
|
280
283
|
private registerDependee;
|
|
281
284
|
private unregisterDependee;
|
|
285
|
+
private getHeartbeatMisses;
|
|
286
|
+
private shouldRequireReadinessFromCommunicationTypes;
|
|
282
287
|
private resolveRuntimeStatusSnapshot;
|
|
283
288
|
private normalizeRuntimeStatusReport;
|
|
284
289
|
private applyRuntimeStatusReport;
|
|
285
290
|
private buildLocalRuntimeStatusReport;
|
|
286
291
|
private selectRuntimeStatusReportForTarget;
|
|
292
|
+
private resolveRuntimeStatusFallbackInquiry;
|
|
293
|
+
private evaluateDependencyReadinessDetail;
|
|
294
|
+
private buildLocalReadinessReport;
|
|
287
295
|
/**
|
|
288
296
|
* Initializes a private constructor for managing service instances, remote signals,
|
|
289
297
|
* service health, and handling updates or synchronization tasks. The constructor
|
|
@@ -22414,6 +22422,8 @@ declare class CadenzaService {
|
|
|
22414
22422
|
* @return {void} - This method does not return a value.
|
|
22415
22423
|
*/
|
|
22416
22424
|
static createMetaDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22425
|
+
static createActor<D extends Record<string, any> = AnyObject, R = AnyObject>(spec: ActorSpec<D, R>, options?: ActorFactoryOptions): Actor<D, R>;
|
|
22426
|
+
static createActorFromDefinition<D extends Record<string, any> = AnyObject, R = AnyObject>(definition: ActorDefinition<D, R>, options?: ActorFactoryOptions<D, R>): Actor<D, R>;
|
|
22417
22427
|
/**
|
|
22418
22428
|
* Creates and registers a new task with the provided name, function, and optional details.
|
|
22419
22429
|
*
|
|
@@ -22776,6 +22786,9 @@ declare class RestController {
|
|
|
22776
22786
|
static get instance(): RestController;
|
|
22777
22787
|
private fetchClientDiagnostics;
|
|
22778
22788
|
private readonly diagnosticsErrorHistoryLimit;
|
|
22789
|
+
private readonly diagnosticsMaxClientEntries;
|
|
22790
|
+
private readonly destroyedDiagnosticsTtlMs;
|
|
22791
|
+
private pruneFetchClientDiagnostics;
|
|
22779
22792
|
private resolveTransportDiagnosticsOptions;
|
|
22780
22793
|
private ensureFetchClientDiagnostics;
|
|
22781
22794
|
private getErrorMessage;
|
|
@@ -22805,41 +22818,68 @@ declare class RestController {
|
|
|
22805
22818
|
constructor();
|
|
22806
22819
|
}
|
|
22807
22820
|
|
|
22821
|
+
interface TransportDiagnosticErrorEntry {
|
|
22822
|
+
at: string;
|
|
22823
|
+
message: string;
|
|
22824
|
+
}
|
|
22825
|
+
interface SocketClientDiagnosticsState {
|
|
22826
|
+
fetchId: string;
|
|
22827
|
+
serviceName: string;
|
|
22828
|
+
url: string;
|
|
22829
|
+
socketId: string | null;
|
|
22830
|
+
connected: boolean;
|
|
22831
|
+
handshake: boolean;
|
|
22832
|
+
reconnectAttempts: number;
|
|
22833
|
+
connectErrors: number;
|
|
22834
|
+
reconnectErrors: number;
|
|
22835
|
+
socketErrors: number;
|
|
22836
|
+
pendingDelegations: number;
|
|
22837
|
+
pendingTimers: number;
|
|
22838
|
+
destroyed: boolean;
|
|
22839
|
+
lastHandshakeAt: string | null;
|
|
22840
|
+
lastHandshakeError: string | null;
|
|
22841
|
+
lastDisconnectAt: string | null;
|
|
22842
|
+
lastError: string | null;
|
|
22843
|
+
lastErrorAt: number;
|
|
22844
|
+
errorHistory: TransportDiagnosticErrorEntry[];
|
|
22845
|
+
updatedAt: number;
|
|
22846
|
+
}
|
|
22808
22847
|
/**
|
|
22809
|
-
*
|
|
22810
|
-
*
|
|
22811
|
-
*
|
|
22812
|
-
*
|
|
22813
|
-
*
|
|
22848
|
+
* Socket transport orchestration in the Cadenza primitive ecosystem.
|
|
22849
|
+
*
|
|
22850
|
+
* - setup is signal-triggered
|
|
22851
|
+
* - state/runtime ownership is actor-backed
|
|
22852
|
+
* - dynamic runtime tasks are still allowed for advanced orchestration (ephemeral resolvers etc.)
|
|
22814
22853
|
*/
|
|
22815
22854
|
declare class SocketController {
|
|
22816
22855
|
private static _instance;
|
|
22817
22856
|
static get instance(): SocketController;
|
|
22818
|
-
private socketClientDiagnostics;
|
|
22819
22857
|
private readonly diagnosticsErrorHistoryLimit;
|
|
22820
|
-
private
|
|
22821
|
-
private
|
|
22858
|
+
private readonly diagnosticsMaxClientEntries;
|
|
22859
|
+
private readonly destroyedDiagnosticsTtlMs;
|
|
22860
|
+
private readonly socketServerDefaultKey;
|
|
22861
|
+
private readonly socketServerActor;
|
|
22862
|
+
private readonly socketClientActor;
|
|
22863
|
+
private readonly socketClientDiagnosticsActor;
|
|
22864
|
+
constructor();
|
|
22865
|
+
private registerDiagnosticsTasks;
|
|
22866
|
+
private registerSocketServerTasks;
|
|
22867
|
+
private registerSocketClientTasks;
|
|
22868
|
+
private createInitialSocketServerSessionState;
|
|
22869
|
+
private createInitialSocketClientSessionState;
|
|
22870
|
+
private resolveSocketServerKey;
|
|
22871
|
+
private resolveSocketClientFetchId;
|
|
22872
|
+
private resolveServicePort;
|
|
22873
|
+
private createSocketServerRuntimeHandleFromContext;
|
|
22874
|
+
private destroySocketServerRuntimeHandle;
|
|
22875
|
+
private createSocketClientRuntimeHandle;
|
|
22876
|
+
private destroySocketClientRuntimeHandle;
|
|
22877
|
+
private normalizeCommunicationTypes;
|
|
22822
22878
|
private getErrorMessage;
|
|
22823
|
-
private
|
|
22879
|
+
private pruneDiagnosticsEntries;
|
|
22880
|
+
getSocketClientDiagnosticsEntry(fetchId: string): Promise<SocketClientDiagnosticsState | undefined>;
|
|
22881
|
+
private resolveTransportDiagnosticsOptions;
|
|
22824
22882
|
private collectSocketTransportDiagnostics;
|
|
22825
|
-
/**
|
|
22826
|
-
* Constructs the `SocketServer`, setting up a WebSocket server with specific configurations,
|
|
22827
|
-
* including connection state recovery, rate limiting, CORS handling, and custom event handling.
|
|
22828
|
-
* This class sets up the communication infrastructure for scalable, resilient, and secure WebSocket-based interactions
|
|
22829
|
-
* using metadata-driven task execution with `Cadenza`.
|
|
22830
|
-
*
|
|
22831
|
-
* It provides support for:
|
|
22832
|
-
* - Origin-based access control for connections.
|
|
22833
|
-
* - Optional payload sanitization.
|
|
22834
|
-
* - Configurable rate limiting and behavior on limit breaches (soft/hard disconnects).
|
|
22835
|
-
* - Event handlers for connection, handshake, delegation, signaling, status checks, and disconnection.
|
|
22836
|
-
*
|
|
22837
|
-
* The server can handle both internal and external interactions depending on the provided configurations,
|
|
22838
|
-
* and integrates directly with Cadenza's task workflow engine.
|
|
22839
|
-
*
|
|
22840
|
-
* Initializes the `SocketServer` to be ready for WebSocket communication.
|
|
22841
|
-
*/
|
|
22842
|
-
constructor();
|
|
22843
22883
|
}
|
|
22844
22884
|
|
|
22845
22885
|
/**
|