@cadenza.io/service 1.24.1 → 1.24.3
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 +494 -182
- package/dist/index.d.ts +494 -182
- package/dist/index.js +592 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +592 -185
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -2,46 +2,51 @@ import * as _cadenza_io_core from '@cadenza.io/core';
|
|
|
2
2
|
import { Task, ThrottleTagGetter, SchemaDefinition as SchemaDefinition$1, GraphContext, AnyObject, TaskResult, SignalBroker, GraphRunner, GraphRegistry, CadenzaMode, GraphRoutine, TaskOptions, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
3
3
|
export { AnyObject, DebounceOptions, DebounceTask, EphemeralTask, EphemeralTaskOptions, GraphRoutine, Task, TaskFunction, TaskOptions, ThrottleTagGetter } from '@cadenza.io/core';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Represents a task that delegates execution of a routine to a remote system or service.
|
|
7
|
+
* The `DeputyTask` serves as a proxy to perform and track the progress of a remote workflow.
|
|
8
|
+
* It extends the `Task` class with additional delegation capabilities.
|
|
9
|
+
*
|
|
10
|
+
* Emits various meta-signals for monitoring delegation progress and resolution.
|
|
11
|
+
*/
|
|
5
12
|
declare class DeputyTask extends Task {
|
|
6
13
|
readonly isDeputy: boolean;
|
|
7
14
|
protected readonly remoteRoutineName: string;
|
|
8
15
|
protected serviceName: string | undefined;
|
|
9
16
|
/**
|
|
10
|
-
* Constructs a
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @
|
|
32
|
-
* @
|
|
17
|
+
* Constructs a new instance of the class with the specified parameters.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} name - The name of the task.
|
|
20
|
+
* @param {string} remoteRoutineName - The name of the remote routine to delegate tasks to.
|
|
21
|
+
* @param {string | undefined} [serviceName=undefined] - The name of the service associated with the task.
|
|
22
|
+
* @param {string} [description=""] - A brief description of the task.
|
|
23
|
+
* @param {number} [concurrency=0] - The concurrency level of the task.
|
|
24
|
+
* @param {number} [timeout=0] - The timeout duration for the task.
|
|
25
|
+
* @param {boolean} [register=true] - Whether the task should be registered in the system.
|
|
26
|
+
* @param {boolean} [isUnique=false] - Whether the task is unique.
|
|
27
|
+
* @param {boolean} [isMeta=false] - Whether the task is a meta task.
|
|
28
|
+
* @param {boolean} [isSubMeta=false] - Whether the task is a sub-meta task.
|
|
29
|
+
* @param {boolean} [isHidden=false] - Whether the task is hidden from the system.
|
|
30
|
+
* @param {ThrottleTagGetter | undefined} [getTagCallback=undefined] - A callback function to retrieve throttle tags.
|
|
31
|
+
* @param {SchemaDefinition | undefined} [inputSchema=undefined] - The input schema definition for the task.
|
|
32
|
+
* @param {boolean} [validateInputContext=false] - Whether to validate the input context against the input schema.
|
|
33
|
+
* @param {SchemaDefinition | undefined} [outputSchema=undefined] - The output schema definition for the task.
|
|
34
|
+
* @param {boolean} [validateOutputContext=false] - Whether to validate the output context against the output schema.
|
|
35
|
+
* @param {number} [retryCount=0] - The number of retries allowed for task execution.
|
|
36
|
+
* @param {number} [retryDelay=0] - The initial delay between retries in milliseconds.
|
|
37
|
+
* @param {number} [retryDelayMax=0] - The maximum retry delay in milliseconds.
|
|
38
|
+
* @param {number} [retryDelayFactor=1] - The factor by which to increase the retry delay for subsequent retries.
|
|
39
|
+
* @return {void} This constructor does not return a value.
|
|
33
40
|
*/
|
|
34
41
|
constructor(name: string, remoteRoutineName: string, serviceName?: string | undefined, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition$1 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition$1 | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
35
42
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @
|
|
42
|
-
* @
|
|
43
|
-
* @edge Engine handles timeout and error, triggering `.doOnFail` if chained.
|
|
44
|
-
* @note The resolution and progress are managed by ephemeral meta-tasks.
|
|
43
|
+
* Executes the specified task function within the provided execution context.
|
|
44
|
+
*
|
|
45
|
+
* @param {GraphContext} context - The execution context containing methods and metadata for task execution.
|
|
46
|
+
* @param {function(string, AnyObject): void} emit - A function for emitting signals with associated data during execution.
|
|
47
|
+
* @param {function(number): void} progressCallback - A callback function to report progress updates during task processing.
|
|
48
|
+
* @param {{ nodeId: string, routineExecId: string }} nodeData - Object containing identifiers for the node and routine execution.
|
|
49
|
+
* @return {TaskResult} Returns the result of the task function execution.
|
|
45
50
|
*/
|
|
46
51
|
execute(context: GraphContext, emit: (signal: string, ctx: AnyObject) => void, progressCallback: (progress: number) => void, nodeData: {
|
|
47
52
|
nodeId: string;
|
|
@@ -96,45 +101,48 @@ interface DbOperationPayload {
|
|
|
96
101
|
}>;
|
|
97
102
|
}
|
|
98
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Represents a specialized task for delegating database operations. Extends `DeputyTask`.
|
|
106
|
+
* This class is designed to abstract database operation requests, delegating execution to a meta-layer system.
|
|
107
|
+
*/
|
|
99
108
|
declare class DatabaseTask extends DeputyTask {
|
|
100
109
|
private readonly queryData;
|
|
101
110
|
/**
|
|
102
|
-
* Constructs
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
117
|
-
* @param
|
|
118
|
-
* @param
|
|
119
|
-
* @param
|
|
120
|
-
* @param
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
123
|
-
* @param
|
|
124
|
-
* @
|
|
125
|
-
* @
|
|
111
|
+
* Constructs an instance of the class with the provided parameters, defining
|
|
112
|
+
* various configuration options and behaviors for the task.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} name - The unique name of the task.
|
|
115
|
+
* @param {string} taskName - The specific name of the task.
|
|
116
|
+
* @param {string | undefined} serviceName - The associated service name. Defaults to undefined.
|
|
117
|
+
* @param {string} description - A brief description of the task. Defaults to an empty string.
|
|
118
|
+
* @param {DbOperationPayload} queryData - The data payload for database operations.
|
|
119
|
+
* @param {number} concurrency - The level of concurrency allowed. Defaults to 0.
|
|
120
|
+
* @param {number} timeout - The timeout duration in milliseconds. Defaults to 0.
|
|
121
|
+
* @param {boolean} register - A flag indicating whether to register the task. Defaults to true.
|
|
122
|
+
* @param {boolean} isUnique - Indicates if the task instance is unique. Defaults to false.
|
|
123
|
+
* @param {boolean} isMeta - Indicates if the task is meta. Defaults to false.
|
|
124
|
+
* @param {boolean} isSubMeta - Indicates if the task is a sub-meta task. Defaults to false.
|
|
125
|
+
* @param {boolean} isHidden - Indicates if the task is hidden. Defaults to false.
|
|
126
|
+
* @param {ThrottleTagGetter | undefined} getTagCallback - A callback used for throttling. Defaults to undefined.
|
|
127
|
+
* @param {SchemaDefinition | undefined} inputSchema - The schema definition for input validation. Defaults to undefined.
|
|
128
|
+
* @param {boolean} validateInputContext - Whether to validate the input context. Defaults to false.
|
|
129
|
+
* @param {SchemaDefinition | undefined} outputSchema - The schema definition for output validation. Defaults to undefined.
|
|
130
|
+
* @param {boolean} validateOutputContext - Whether to validate the output context. Defaults to false.
|
|
131
|
+
* @param {number} retryCount - The maximum number of retry attempts. Defaults to 0.
|
|
132
|
+
* @param {number} retryDelay - The delay between retries in milliseconds. Defaults to 0.
|
|
133
|
+
* @param {number} retryDelayMax - The maximum delay between retries in milliseconds. Defaults to 0.
|
|
134
|
+
* @param {number} retryDelayFactor - The factor for exponential backoff. Defaults to 1.
|
|
135
|
+
* @return {void}
|
|
126
136
|
*/
|
|
127
137
|
constructor(name: string, taskName: string, serviceName: string | undefined, description: string | undefined, queryData: DbOperationPayload, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition$1 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition$1 | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
128
138
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
134
|
-
* @
|
|
135
|
-
* @
|
|
136
|
-
* @edge Engine handles timeout and error, triggering `.doOnFail` if chained.
|
|
137
|
-
* @note The resolution and progress are managed by ephemeral meta-tasks.
|
|
139
|
+
* Executes the specified task within the given context.
|
|
140
|
+
*
|
|
141
|
+
* @param {GraphContext} context - The execution context for the current task, which includes data and metadata required for processing.
|
|
142
|
+
* @param {(signal: string, ctx: AnyObject) => void} emit - A function used to send signals or events during task execution.
|
|
143
|
+
* @param {(progress: number) => void} progressCallback - A function to report execution progress as a percentage (0-100).
|
|
144
|
+
* @param {{ nodeId: string; routineExecId: string }} nodeData - An object containing identifiers for the current node and routine execution.
|
|
145
|
+
* @return {TaskResult} The result of the task execution.
|
|
138
146
|
*/
|
|
139
147
|
execute(context: GraphContext, emit: (signal: string, ctx: AnyObject) => void, progressCallback: (progress: number) => void, nodeData: {
|
|
140
148
|
nodeId: string;
|
|
@@ -164,6 +172,12 @@ interface DeputyDescriptor {
|
|
|
164
172
|
localTaskName: string;
|
|
165
173
|
communicationType: string;
|
|
166
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* The ServiceRegistry class is a singleton that manages the registration and lifecycle of
|
|
177
|
+
* service instances, deputies, and remote signals in a distributed service architecture.
|
|
178
|
+
* It handles various tasks such as instance updates, remote signal registration,
|
|
179
|
+
* service status synchronization, and error/event broadcasting.
|
|
180
|
+
*/
|
|
167
181
|
declare class ServiceRegistry {
|
|
168
182
|
private static _instance;
|
|
169
183
|
static get instance(): ServiceRegistry;
|
|
@@ -192,49 +206,63 @@ declare class ServiceRegistry {
|
|
|
192
206
|
insertServiceInstanceTask: Task;
|
|
193
207
|
handleServiceNotRespondingTask: Task;
|
|
194
208
|
handleServiceHandshakeTask: Task;
|
|
209
|
+
/**
|
|
210
|
+
* Initializes a private constructor for managing service instances, remote signals,
|
|
211
|
+
* service health, and handling updates or synchronization tasks. The constructor
|
|
212
|
+
* creates a variety of meta tasks that process different lifecycle events and
|
|
213
|
+
* service-related updates in a distributed service registry model.
|
|
214
|
+
*
|
|
215
|
+
* @return {Object} An instance of the constructed class with initialized tasks
|
|
216
|
+
* and state management necessary to process service-related events.
|
|
217
|
+
*/
|
|
195
218
|
private constructor();
|
|
196
219
|
reset(): void;
|
|
197
220
|
}
|
|
198
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Represents a task responsible for transmitting signals to a remote service
|
|
224
|
+
* through the meta-layer for operations delegation.
|
|
225
|
+
*
|
|
226
|
+
* @class
|
|
227
|
+
* @extends Task
|
|
228
|
+
*/
|
|
199
229
|
declare class SignalTransmissionTask extends Task {
|
|
200
230
|
readonly isDeputy: boolean;
|
|
201
231
|
protected readonly signalName: string;
|
|
202
232
|
protected readonly serviceName: string;
|
|
203
233
|
/**
|
|
204
|
-
* Constructs a
|
|
205
|
-
*
|
|
206
|
-
* @param
|
|
207
|
-
* @param
|
|
208
|
-
* @param
|
|
209
|
-
* @param
|
|
210
|
-
* @param
|
|
211
|
-
* @param
|
|
212
|
-
* @param
|
|
213
|
-
* @param
|
|
214
|
-
* @param
|
|
215
|
-
* @param
|
|
216
|
-
* @param
|
|
217
|
-
* @param
|
|
218
|
-
* @param
|
|
219
|
-
* @param
|
|
220
|
-
* @param
|
|
221
|
-
* @param
|
|
222
|
-
* @param
|
|
223
|
-
* @param
|
|
224
|
-
* @param
|
|
225
|
-
* @
|
|
226
|
-
* @
|
|
234
|
+
* Constructs a new instance of the class and initializes it with the provided parameters.
|
|
235
|
+
*
|
|
236
|
+
* @param {string} name - The name of the task being created.
|
|
237
|
+
* @param {string} signalName - The name of the signal associated with this task.
|
|
238
|
+
* @param {string} serviceName - The name of the service associated with this task.
|
|
239
|
+
* @param {string} [description=""] - An optional description of the task.
|
|
240
|
+
* @param {number} [concurrency=0] - The maximum allowed concurrency for this task.
|
|
241
|
+
* @param {number} [timeout=0] - The maximum execution time for this task, in milliseconds.
|
|
242
|
+
* @param {boolean} [register=true] - Whether the task should be registered upon creation.
|
|
243
|
+
* @param {boolean} [isUnique=false] - Indicates if the task should enforce uniqueness.
|
|
244
|
+
* @param {boolean} [isMeta=false] - Specifies if the task is a meta-task.
|
|
245
|
+
* @param {boolean} [isSubMeta=false] - Specifies if the task is a sub-meta-task.
|
|
246
|
+
* @param {boolean} [isHidden=false] - Indicates if the task is hidden from visibility.
|
|
247
|
+
* @param {ThrottleTagGetter|undefined} [getTagCallback=undefined] - A callback for tag throttling logic.
|
|
248
|
+
* @param {SchemaDefinition|undefined} [inputSchema=undefined] - An optional schema for validating input data.
|
|
249
|
+
* @param {boolean} [validateInputContext=false] - Whether to validate the input context against the input schema.
|
|
250
|
+
* @param {SchemaDefinition|undefined} [outputSchema=undefined] - An optional schema for validating output data.
|
|
251
|
+
* @param {boolean} [validateOutputContext=false] - Whether to validate the output context against the output schema.
|
|
252
|
+
* @param {number} [retryCount=0] - The number of retry attempts allowed in case of task failure.
|
|
253
|
+
* @param {number} [retryDelay=0] - The initial delay before retrying a failed task, in milliseconds.
|
|
254
|
+
* @param {number} [retryDelayMax=0] - The maximum delay between retry attempts, in milliseconds.
|
|
255
|
+
* @param {number} [retryDelayFactor=1] - A multiplier applied to retry delay for exponential backoff.
|
|
256
|
+
* @return {void} Does not return a value.
|
|
227
257
|
*/
|
|
228
258
|
constructor(name: string, signalName: string, serviceName: string, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition$1 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition$1 | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
229
259
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* @param
|
|
233
|
-
* @param
|
|
234
|
-
* @
|
|
235
|
-
* @
|
|
236
|
-
* @edge Engine handles timeout and error, triggering `.doOnFail` if chained.
|
|
237
|
-
* @note The resolution and progress are managed by ephemeral meta-tasks.
|
|
260
|
+
* Executes the given task function within the provided execution context.
|
|
261
|
+
*
|
|
262
|
+
* @param {GraphContext} context - The context object providing the graph execution environment and metadata.
|
|
263
|
+
* @param {Function} emit - A function to emit signals with the provided name and context.
|
|
264
|
+
* @param {Function} progressCallback - A callback function to report the progress of the task execution as a number between 0 and 1.
|
|
265
|
+
* @return {TaskResult} The result of the executed task function.
|
|
238
266
|
*/
|
|
239
267
|
execute(context: GraphContext, emit: (signal: string, ctx: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
240
268
|
}
|
|
@@ -359,6 +387,10 @@ interface DatabaseOptions {
|
|
|
359
387
|
databaseName?: string;
|
|
360
388
|
poolSize?: number;
|
|
361
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* The CadenzaService class serves as a central service layer providing various utility methods for managing tasks, signals, logging, and service interactions.
|
|
392
|
+
* This class handles the initialization (`bootstrap`) and validation of services, as well as the creation of tasks associated with services and signals.
|
|
393
|
+
*/
|
|
362
394
|
declare class CadenzaService {
|
|
363
395
|
static broker: SignalBroker;
|
|
364
396
|
static runner: GraphRunner;
|
|
@@ -367,9 +399,38 @@ declare class CadenzaService {
|
|
|
367
399
|
static serviceRegistry: ServiceRegistry;
|
|
368
400
|
protected static isBootstrapped: boolean;
|
|
369
401
|
protected static serviceCreated: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Initializes the application by setting up necessary components and configurations.
|
|
404
|
+
* This method ensures the initialization process is only executed once throughout the application lifecycle.
|
|
405
|
+
*
|
|
406
|
+
* @return {void} This method does not return any value.
|
|
407
|
+
*/
|
|
370
408
|
static bootstrap(): void;
|
|
409
|
+
/**
|
|
410
|
+
* Validates the provided service name based on specific rules.
|
|
411
|
+
*
|
|
412
|
+
* @param {string} serviceName - The service name to validate. Must be less than 100 characters,
|
|
413
|
+
* must not contain spaces, dots, or backslashes, and must start with a capital letter.
|
|
414
|
+
* @return {void} Throws an error if the service name does not meet the validation criteria.
|
|
415
|
+
* @throws {Error} If the service name exceeds 100 characters.
|
|
416
|
+
* @throws {Error} If the service name contains spaces.
|
|
417
|
+
* @throws {Error} If the service name contains dots.
|
|
418
|
+
* @throws {Error} If the service name contains backslashes.
|
|
419
|
+
* @throws {Error} If the service name does not start with a capital letter.
|
|
420
|
+
*/
|
|
371
421
|
protected static validateServiceName(serviceName: string): void;
|
|
422
|
+
/**
|
|
423
|
+
* Validates the provided name to ensure it meets the required criteria.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} name - The name to be validated.
|
|
426
|
+
* @return {void} Does not return any value.
|
|
427
|
+
*/
|
|
372
428
|
protected static validateName(name: string): void;
|
|
429
|
+
/**
|
|
430
|
+
* Gets the current run strategy from the Cadenza configuration.
|
|
431
|
+
*
|
|
432
|
+
* @return {Function} The run strategy function defined in the Cadenza configuration.
|
|
433
|
+
*/
|
|
373
434
|
static get runStrategy(): {
|
|
374
435
|
PARALLEL: {
|
|
375
436
|
run(): Promise<void>;
|
|
@@ -21740,155 +21801,326 @@ declare class CadenzaService {
|
|
|
21740
21801
|
updateRunInstance(): void;
|
|
21741
21802
|
};
|
|
21742
21803
|
};
|
|
21804
|
+
/**
|
|
21805
|
+
* Sets the mode for the Cadenza application.
|
|
21806
|
+
*
|
|
21807
|
+
* @param {CadenzaMode} mode - The mode to be set for the application.
|
|
21808
|
+
* @return {void} This method does not return a value.
|
|
21809
|
+
*/
|
|
21743
21810
|
static setMode(mode: CadenzaMode): void;
|
|
21811
|
+
/**
|
|
21812
|
+
* Emits a signal with the specified data using the associated broker.
|
|
21813
|
+
*
|
|
21814
|
+
* @param {string} signal - The name of the event or signal to emit.
|
|
21815
|
+
* @param {AnyObject} [data={}] - The data to be emitted along with the signal.
|
|
21816
|
+
* @return {void} No return value.
|
|
21817
|
+
*/
|
|
21744
21818
|
static emit(signal: string, data?: AnyObject): void;
|
|
21819
|
+
/**
|
|
21820
|
+
* Executes the given task or graph routine within the provided context using the configured runner.
|
|
21821
|
+
*
|
|
21822
|
+
* @param {Task | GraphRoutine} task - The task or graph routine to be executed.
|
|
21823
|
+
* @param {AnyObject} context - The context within which the task will be executed.
|
|
21824
|
+
* @return {void}
|
|
21825
|
+
*/
|
|
21745
21826
|
static run(task: Task | GraphRoutine, context: AnyObject): void;
|
|
21827
|
+
/**
|
|
21828
|
+
* Logs a message with a specified log level and additional contextual data.
|
|
21829
|
+
*
|
|
21830
|
+
* @param {string} message - The main message to be logged.
|
|
21831
|
+
* @param {any} [data={}] - Additional data or metadata to include with the log.
|
|
21832
|
+
* @param {"info"|"warning"|"error"|"critical"} [level="info"] - The severity level of the log message.
|
|
21833
|
+
* @param {string|null} [subjectServiceName=null] - The name of the subject service related to the log.
|
|
21834
|
+
* @param {string|null} [subjectServiceInstanceId=null] - The instance ID of the subject service related to the log.
|
|
21835
|
+
* @return {void} No return value.
|
|
21836
|
+
*/
|
|
21746
21837
|
static log(message: string, data?: any, level?: "info" | "warning" | "error" | "critical", subjectServiceName?: string | null, subjectServiceInstanceId?: string | null): void;
|
|
21838
|
+
/**
|
|
21839
|
+
* Creates a new DeputyTask instance based on the provided routine name, service name, and options.
|
|
21840
|
+
* This method ensures proper task initialization, including setting a unique name,
|
|
21841
|
+
* validation of the routine name, and applying default option values.
|
|
21842
|
+
*
|
|
21843
|
+
* @param {string} routineName - The name of the routine the task references. This is mandatory and should be a valid string.
|
|
21844
|
+
* @param {string|undefined} [serviceName] - The name of the service that the routine belongs to. This is optional and defaults to undefined.
|
|
21845
|
+
* @param {TaskOptions} [options={}] - A configuration object for the task, allowing various properties such as concurrency, timeout, and retry settings to be customized.
|
|
21846
|
+
* @return {DeputyTask} - A new DeputyTask instance initialized with the specified parameters.
|
|
21847
|
+
*/
|
|
21747
21848
|
static createDeputyTask(routineName: string, serviceName?: string | undefined, options?: TaskOptions): DeputyTask;
|
|
21849
|
+
/**
|
|
21850
|
+
* Creates a meta deputy task by setting the `isMeta` property in the options to true,
|
|
21851
|
+
* and delegating task creation to the `createDeputyTask` method.
|
|
21852
|
+
*
|
|
21853
|
+
* @param {string} routineName - The name of the routine associated with the task.
|
|
21854
|
+
* @param {string | undefined} [serviceName] - The optional name of the service associated with the task.
|
|
21855
|
+
* @param {TaskOptions} [options={}] - Additional options for the task. Defaults to an empty object if not provided.
|
|
21856
|
+
* @return {DeputyTask} - The created meta deputy task.
|
|
21857
|
+
*/
|
|
21748
21858
|
static createMetaDeputyTask(routineName: string, serviceName?: string | undefined, options?: TaskOptions): DeputyTask;
|
|
21859
|
+
/**
|
|
21860
|
+
* Creates a unique deputy task with the specified routine name, service name,
|
|
21861
|
+
* and optional task options. The uniqueness is ensured by setting the
|
|
21862
|
+
* `isUnique` property in the task options.
|
|
21863
|
+
*
|
|
21864
|
+
* @param {string} routineName - The name of the routine associated with the task.
|
|
21865
|
+
* @param {string | undefined} [serviceName] - The name of the service associated with the task. If undefined, no service name is used.
|
|
21866
|
+
* @param {TaskOptions} [options={}] - Additional configuration options for the task.
|
|
21867
|
+
* @return {*} - Returns the result of creating a deputy task with the provided parameters and unique configuration.
|
|
21868
|
+
*/
|
|
21749
21869
|
static createUniqueDeputyTask(routineName: string, serviceName?: string | undefined, options?: TaskOptions): DeputyTask;
|
|
21870
|
+
/**
|
|
21871
|
+
* Creates a unique meta deputy task based on the provided routine name, service name, and options.
|
|
21872
|
+
* This method sets the task as a meta task and delegates the creation to the `createUniqueDeputyTask` method.
|
|
21873
|
+
*
|
|
21874
|
+
* @param {string} routineName - The routine name to associate with the meta deputy task.
|
|
21875
|
+
* @param {string | undefined} [serviceName] - The optional service name associated with the task.
|
|
21876
|
+
* @param {TaskOptions} [options] - Additional options to configure the task. Defaults to an empty options object.
|
|
21877
|
+
* @return {*} A unique meta deputy task created based on the given parameters.
|
|
21878
|
+
*/
|
|
21750
21879
|
static createUniqueMetaDeputyTask(routineName: string, serviceName?: string | undefined, options?: TaskOptions): DeputyTask;
|
|
21880
|
+
/**
|
|
21881
|
+
* Creates a throttled deputy task with the specified parameters.
|
|
21882
|
+
*
|
|
21883
|
+
* @param {string} routineName - The name of the routine to be executed.
|
|
21884
|
+
* @param {string | undefined} [serviceName=undefined] - The name of the service, if applicable.
|
|
21885
|
+
* @param {ThrottleTagGetter} [throttledIdGetter=() => "default"] - A function to get the throttled tag for the task.
|
|
21886
|
+
* @param {TaskOptions} [options={}] - The options for task configuration, including concurrency and callbacks.
|
|
21887
|
+
* @return {any} The created throttled deputy task.
|
|
21888
|
+
*/
|
|
21751
21889
|
static createThrottledDeputyTask(routineName: string, serviceName?: string | undefined, throttledIdGetter?: ThrottleTagGetter, options?: TaskOptions): DeputyTask;
|
|
21890
|
+
/**
|
|
21891
|
+
* Creates a throttled deputy task with meta-task settings enabled.
|
|
21892
|
+
*
|
|
21893
|
+
* @param {string} routineName - The name of the routine for which the task is being created.
|
|
21894
|
+
* @param {string|undefined} [serviceName=undefined] - The name of the service associated with the task, or undefined if not applicable.
|
|
21895
|
+
* @param {ThrottleTagGetter} [throttledIdGetter=() => "default"] - A function to compute or return the throttling identifier.
|
|
21896
|
+
* @param {TaskOptions} [options={}] - Additional options for the task configuration.
|
|
21897
|
+
* @return {any} Returns the created throttled deputy task instance.
|
|
21898
|
+
*/
|
|
21752
21899
|
static createMetaThrottledDeputyTask(routineName: string, serviceName?: string | undefined, throttledIdGetter?: ThrottleTagGetter, options?: TaskOptions): DeputyTask;
|
|
21900
|
+
/**
|
|
21901
|
+
* Creates and configures a signal transmission task that handles the transmission
|
|
21902
|
+
* of a specified signal to a target service with a set of customizable options.
|
|
21903
|
+
*
|
|
21904
|
+
* @param {string} signalName - The name of the signal to be transmitted.
|
|
21905
|
+
* @param {string} serviceName - The name of the target service to transmit the signal to.
|
|
21906
|
+
* @param {TaskOptions} [options={}] - A set of optional parameters to further configure the task.
|
|
21907
|
+
* @return {SignalTransmissionTask} A new instance of SignalTransmissionTask configured with the given parameters.
|
|
21908
|
+
*/
|
|
21753
21909
|
static createSignalTransmissionTask(signalName: string, serviceName: string, options?: TaskOptions): SignalTransmissionTask;
|
|
21910
|
+
/**
|
|
21911
|
+
* Creates and configures a database task that performs an operation on a specified table.
|
|
21912
|
+
*
|
|
21913
|
+
* @param {string} tableName - The name of the database table on which the operation will be performed.
|
|
21914
|
+
* @param {DbOperationType} operation - The type of database operation to execute (e.g., insert, update, delete).
|
|
21915
|
+
* @param {string|undefined} [databaseServiceName=undefined] - The name of the database service; defaults to "default database service" if not provided.
|
|
21916
|
+
* @param {DbOperationPayload} queryData - The data payload required for executing the specified database operation.
|
|
21917
|
+
* @param {TaskOptions} [options={}] - Optional configuration for the task, including concurrency, timeout, and retry policies.
|
|
21918
|
+
* @return {DatabaseTask} A configured database task instance ready for execution.
|
|
21919
|
+
*/
|
|
21754
21920
|
static createDatabaseTask(tableName: string, operation: DbOperationType$1, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21921
|
+
/**
|
|
21922
|
+
* Creates a task for performing a database insert operation.
|
|
21923
|
+
*
|
|
21924
|
+
* @param {string} tableName - The name of the table where the insert operation will be performed.
|
|
21925
|
+
* @param {string | undefined} [databaseServiceName=undefined] - The name of the database service to use. Optional parameter, defaults to undefined.
|
|
21926
|
+
* @param {DbOperationPayload} [queryData={}] - The data payload for the insert operation. Defaults to an empty object.
|
|
21927
|
+
* @param {TaskOptions} [options={}] - Additional task options to configure the insert operation. Defaults to an empty object.
|
|
21928
|
+
* @return {object} A task configuration object for the database insert operation.
|
|
21929
|
+
*/
|
|
21755
21930
|
static createDatabaseInsertTask(tableName: string, databaseServiceName?: string | undefined, queryData?: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21931
|
+
/**
|
|
21932
|
+
* Creates a database query task for the specified table and configuration.
|
|
21933
|
+
*
|
|
21934
|
+
* @param {string} tableName - The name of the database table to execute the query on.
|
|
21935
|
+
* @param {string | undefined} [databaseServiceName=undefined] - The name of the database service to use. If undefined, the default service will be used.
|
|
21936
|
+
* @param {DbOperationPayload} queryData - The payload containing the query data to be executed.
|
|
21937
|
+
* @param {TaskOptions} [options={}] - Optional parameters to configure the task execution.
|
|
21938
|
+
* @return {Task} The created database query task.
|
|
21939
|
+
*/
|
|
21756
21940
|
static createDatabaseQueryTask(tableName: string, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21941
|
+
/**
|
|
21942
|
+
* Creates a database task for the CadenzaDB with the specified parameters.
|
|
21943
|
+
*
|
|
21944
|
+
* @param {string} tableName - The name of the database table on which the operation will be performed.
|
|
21945
|
+
* @param {DbOperationType} operation - The type of database operation to execute (e.g., INSERT, UPDATE, DELETE).
|
|
21946
|
+
* @param {DbOperationPayload} queryData - The payload or data required to perform the database operation.
|
|
21947
|
+
* @param {TaskOptions} [options={}] - Additional options for the task, such as configuration settings.
|
|
21948
|
+
* @return {any} The result of creating the database task.
|
|
21949
|
+
*/
|
|
21757
21950
|
static createCadenzaDBTask(tableName: string, operation: DbOperationType$1, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21951
|
+
/**
|
|
21952
|
+
* Creates a database insert task specifically for the CadenzaDB database.
|
|
21953
|
+
*
|
|
21954
|
+
* @param {string} tableName - The name of the table into which the data will be inserted.
|
|
21955
|
+
* @param {DbOperationPayload} [queryData={}] - An object representing the data to be inserted.
|
|
21956
|
+
* @param {TaskOptions} [options={}] - Additional options to customize the task. The `isMeta` property is set to true by default.
|
|
21957
|
+
* @return {Task} A task object configured to perform an insert operation in the CadenzaDB database.
|
|
21958
|
+
*/
|
|
21758
21959
|
static createCadenzaDBInsertTask(tableName: string, queryData?: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21960
|
+
/**
|
|
21961
|
+
* Creates a database query task specifically for the CadenzaDB.
|
|
21962
|
+
*
|
|
21963
|
+
* @param {string} tableName - The name of the database table to execute the query on.
|
|
21964
|
+
* @param {DbOperationPayload} queryData - The payload containing data and parameters for the database operation.
|
|
21965
|
+
* @param {TaskOptions} [options={}] - Additional options for the task configuration.
|
|
21966
|
+
* @return {any} The created task for executing a database query.
|
|
21967
|
+
*/
|
|
21759
21968
|
static createCadenzaDBQueryTask(tableName: string, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21760
21969
|
/**
|
|
21761
|
-
* Creates a
|
|
21762
|
-
*
|
|
21763
|
-
* @param serviceName
|
|
21764
|
-
* @param description
|
|
21765
|
-
* @param
|
|
21766
|
-
*
|
|
21767
|
-
* @returns The created MetaTask instance.
|
|
21768
|
-
* @throws Error if name invalid or duplicate.
|
|
21970
|
+
* Creates a new Cadenza service with the specified configuration.
|
|
21971
|
+
*
|
|
21972
|
+
* @param {string} serviceName - The unique name of the service to create.
|
|
21973
|
+
* @param {string} [description] - An optional description of the service.
|
|
21974
|
+
* @param {ServerOptions} [options] - An optional object containing configuration options for the service.
|
|
21975
|
+
* @return {boolean} Returns true when the service is successfully created.
|
|
21769
21976
|
*/
|
|
21770
21977
|
static createCadenzaService(serviceName: string, description?: string, options?: ServerOptions): void;
|
|
21978
|
+
/**
|
|
21979
|
+
* Creates a Cadenza metadata service with the specified name, description, and options.
|
|
21980
|
+
*
|
|
21981
|
+
* @param {string} serviceName - The name of the metadata service to be created.
|
|
21982
|
+
* @param {string} description - A brief description of the metadata service.
|
|
21983
|
+
* @param {ServerOptions} [options={}] - Optional configuration for the metadata service. Defaults to an empty object.
|
|
21984
|
+
* @return {void} Does not return a value.
|
|
21985
|
+
*/
|
|
21771
21986
|
static createCadenzaMetaService(serviceName: string, description: string, options?: ServerOptions): void;
|
|
21987
|
+
/**
|
|
21988
|
+
* Creates and initializes a database service with the provided name, schema, and configuration options.
|
|
21989
|
+
* This method is not supported in a browser environment and will log a warning if called in such an environment.
|
|
21990
|
+
*
|
|
21991
|
+
* @param {string} name - The name of the database service to be created.
|
|
21992
|
+
* @param {SchemaDefinition} schema - The schema definition for the database service.
|
|
21993
|
+
* @param {string} [description=""] - An optional description of the database service.
|
|
21994
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional configuration settings for the database and server.
|
|
21995
|
+
* @return {void} This method does not return a value.
|
|
21996
|
+
*/
|
|
21772
21997
|
static createDatabaseService(name: string, schema: SchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
21998
|
+
/**
|
|
21999
|
+
* Creates a meta database service with the specified configuration.
|
|
22000
|
+
*
|
|
22001
|
+
* @param {string} name - The name of the database service to be created.
|
|
22002
|
+
* @param {SchemaDefinition} schema - The schema definition for the database.
|
|
22003
|
+
* @param {string} [description=""] - An optional description of the database service.
|
|
22004
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional server and database configuration options. The `isMeta` flag will be automatically set to true.
|
|
22005
|
+
* @return {void} - This method does not return a value.
|
|
22006
|
+
*/
|
|
21773
22007
|
static createMetaDatabaseService(name: string, schema: SchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
21774
22008
|
/**
|
|
21775
|
-
* Creates a
|
|
21776
|
-
*
|
|
21777
|
-
* @param
|
|
21778
|
-
* @param
|
|
21779
|
-
* @param
|
|
21780
|
-
* @
|
|
21781
|
-
* @
|
|
22009
|
+
* Creates and registers a new task with the provided name, function, and optional details.
|
|
22010
|
+
*
|
|
22011
|
+
* @param {string} name - The name of the task to be created.
|
|
22012
|
+
* @param {TaskFunction} func - The function that contains the task execution logic.
|
|
22013
|
+
* @param {string} [description] - An optional description of what the task does.
|
|
22014
|
+
* @param {TaskOptions} [options={}] - An optional configuration object specifying additional task options.
|
|
22015
|
+
* @return {Task} - The created task instance.
|
|
21782
22016
|
*/
|
|
21783
22017
|
static createTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
21784
22018
|
/**
|
|
21785
|
-
* Creates a
|
|
21786
|
-
*
|
|
21787
|
-
* @param name
|
|
21788
|
-
* @param func The function
|
|
21789
|
-
* @param description
|
|
21790
|
-
* @param options
|
|
21791
|
-
* @
|
|
21792
|
-
* @throws Error if name invalid or duplicate.
|
|
22019
|
+
* Creates a new meta task with the specified name, function, description, and options.
|
|
22020
|
+
*
|
|
22021
|
+
* @param {string} name - The name of the meta task.
|
|
22022
|
+
* @param {TaskFunction} func - The function to be executed by the meta task.
|
|
22023
|
+
* @param {string} [description] - An optional description of the meta task.
|
|
22024
|
+
* @param {TaskOptions} [options={}] - Additional options to configure the meta task.
|
|
22025
|
+
* @return {Task} The created meta task instance.
|
|
21793
22026
|
*/
|
|
21794
22027
|
static createMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
21795
22028
|
/**
|
|
21796
22029
|
* Creates a UniqueTask (executes once per execution ID, merging parents) and registers it.
|
|
21797
22030
|
* Use for fan-in/joins after parallel branches.
|
|
21798
|
-
* @param name Unique identifier.
|
|
21799
|
-
* @param func Function receiving joinedContexts.
|
|
21800
|
-
* @param description Optional description.
|
|
21801
|
-
* @param options Optional task options.
|
|
21802
|
-
* @returns The created UniqueTask.
|
|
21803
|
-
* @throws Error if invalid.
|
|
22031
|
+
* @param {string} name Unique identifier.
|
|
22032
|
+
* @param {TaskFunction} func Function receiving joinedContexts as a list (context.joinedContexts).
|
|
22033
|
+
* @param {string} [description] Optional description.
|
|
22034
|
+
* @param {TaskOptions} [options={}] Optional task options.
|
|
22035
|
+
* @returns {Task} The created UniqueTask.
|
|
21804
22036
|
*/
|
|
21805
22037
|
static createUniqueTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
21806
22038
|
/**
|
|
21807
|
-
* Creates a
|
|
21808
|
-
*
|
|
21809
|
-
* @param
|
|
21810
|
-
* @param
|
|
21811
|
-
* @param
|
|
21812
|
-
* @
|
|
22039
|
+
* Creates a unique meta task with the provided name, function, description, and options.
|
|
22040
|
+
*
|
|
22041
|
+
* @param {string} name - The unique name for the meta task.
|
|
22042
|
+
* @param {TaskFunction} func - The function to be executed by the task.
|
|
22043
|
+
* @param {string} [description] - An optional description of the task's purpose.
|
|
22044
|
+
* @param {TaskOptions} [options={}] - Additional optional configuration settings for the task.
|
|
22045
|
+
* @return {Task} Returns the created unique meta task.
|
|
21813
22046
|
*/
|
|
21814
22047
|
static createUniqueMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
21815
22048
|
/**
|
|
21816
22049
|
* Creates a ThrottledTask (rate-limited by concurrency or custom groups) and registers it.
|
|
21817
|
-
* @param name Unique identifier.
|
|
21818
|
-
* @param func Function.
|
|
21819
|
-
* @param throttledIdGetter Optional getter for dynamic grouping (e.g., per-user).
|
|
21820
|
-
* @param description Optional.
|
|
21821
|
-
* @param options Optional task options.
|
|
21822
|
-
* @returns The created ThrottledTask.
|
|
21823
|
-
* @edge If no getter, throttles per task ID; use for resource protection.
|
|
22050
|
+
* @param {string} name Unique identifier.
|
|
22051
|
+
* @param {TaskFunction} func Function.
|
|
22052
|
+
* @param {ThrottleTagGetter} [throttledIdGetter=() => "default"] Optional getter for dynamic grouping (e.g., per-user).
|
|
22053
|
+
* @param {string} [description] Optional.
|
|
22054
|
+
* @param {TaskOptions} [options={}] Optional task options.
|
|
22055
|
+
* @returns {Task} The created ThrottledTask.
|
|
21824
22056
|
*/
|
|
21825
22057
|
static createThrottledTask(name: string, func: TaskFunction, throttledIdGetter?: ThrottleTagGetter, description?: string, options?: TaskOptions): Task;
|
|
21826
22058
|
/**
|
|
21827
|
-
* Creates a
|
|
21828
|
-
*
|
|
21829
|
-
*
|
|
21830
|
-
* @param
|
|
21831
|
-
* @param
|
|
21832
|
-
* @param
|
|
21833
|
-
* @
|
|
22059
|
+
* Creates and returns a throttled meta task with the specified name, function,
|
|
22060
|
+
* and additional options. Throttling is determined based on the throttled ID getter.
|
|
22061
|
+
*
|
|
22062
|
+
* @param {string} name - The unique name for the meta task.
|
|
22063
|
+
* @param {TaskFunction} func - The function to be executed as the task.
|
|
22064
|
+
* @param {ThrottleTagGetter} [throttledIdGetter=() => "default"] - A function that determines the throttle ID for the task.
|
|
22065
|
+
* @param {string} [description] - An optional description of the task.
|
|
22066
|
+
* @param {TaskOptions} [options={}] - Additional configuration options for the task.
|
|
22067
|
+
* @return {Task} The created throttled meta task.
|
|
21834
22068
|
*/
|
|
21835
|
-
static createThrottledMetaTask(name: string, func: TaskFunction, throttledIdGetter
|
|
22069
|
+
static createThrottledMetaTask(name: string, func: TaskFunction, throttledIdGetter?: ThrottleTagGetter, description?: string, options?: TaskOptions): Task;
|
|
21836
22070
|
/**
|
|
21837
22071
|
* Creates a DebounceTask (delays exec until quiet period) and registers it.
|
|
21838
|
-
* @param name Identifier.
|
|
21839
|
-
* @param func Function.
|
|
21840
|
-
* @param description Optional.
|
|
21841
|
-
* @param debounceTime Delay in ms
|
|
21842
|
-
* @param options Optional task options plus optional debounce config (e.g., leading/trailing).
|
|
21843
|
-
* @returns The created DebounceTask.
|
|
21844
|
-
* @edge Multiple triggers within time collapse to one exec.
|
|
22072
|
+
* @param {string} name Identifier.
|
|
22073
|
+
* @param {TaskFunction} func Function.
|
|
22074
|
+
* @param {string} [description] Optional.
|
|
22075
|
+
* @param {number} [debounceTime=1000] Delay in ms.
|
|
22076
|
+
* @param {TaskOptions & DebounceOptions} [options={}] Optional task options plus optional debounce config (e.g., leading/trailing).
|
|
22077
|
+
* @returns {Task} The created DebounceTask.
|
|
21845
22078
|
*/
|
|
21846
22079
|
static createDebounceTask(name: string, func: TaskFunction, description?: string, debounceTime?: number, options?: TaskOptions & DebounceOptions): DebounceTask;
|
|
21847
22080
|
/**
|
|
21848
|
-
* Creates a
|
|
21849
|
-
* @param name Identifier.
|
|
21850
|
-
* @param func Function.
|
|
21851
|
-
* @param description Optional.
|
|
21852
|
-
* @param debounceTime Delay in ms.
|
|
21853
|
-
* @param options Optional task options plus optional debounce config (e.g., leading/trailing).
|
|
21854
|
-
* @returns The created
|
|
22081
|
+
* Creates a DebounceTask for the meta layer (delays exec until quiet period) and registers it.
|
|
22082
|
+
* @param {string} name Identifier.
|
|
22083
|
+
* @param {TaskFunction} func Function.
|
|
22084
|
+
* @param {string} [description] Optional.
|
|
22085
|
+
* @param {number} [debounceTime=1000] Delay in ms.
|
|
22086
|
+
* @param {TaskOptions & DebounceOptions} [options={}] Optional task options plus optional debounce config (e.g., leading/trailing).
|
|
22087
|
+
* @returns {Task} The created DebounceMetaTask.
|
|
21855
22088
|
*/
|
|
21856
22089
|
static createDebounceMetaTask(name: string, func: TaskFunction, description?: string, debounceTime?: number, options?: TaskOptions & DebounceOptions): DebounceTask;
|
|
21857
22090
|
/**
|
|
21858
22091
|
* Creates an EphemeralTask (self-destructs after exec or condition) without default registration.
|
|
21859
22092
|
* Useful for transients; optionally register if needed.
|
|
21860
|
-
* @param name Identifier (may not be unique if not registered).
|
|
21861
|
-
* @param func Function.
|
|
21862
|
-
* @param description Optional.
|
|
21863
|
-
* @param options Optional task options.
|
|
21864
|
-
* @returns The created EphemeralTask.
|
|
21865
|
-
* @edge Destruction triggered post-exec via Node/Builder; emits meta-signal for cleanup.
|
|
22093
|
+
* @param {string} name Identifier (may not be unique if not registered).
|
|
22094
|
+
* @param {TaskFunction} func Function.
|
|
22095
|
+
* @param {string} [description] Optional.
|
|
22096
|
+
* @param {TaskOptions & EphemeralTaskOptions} [options={}] Optional task options.
|
|
22097
|
+
* @returns {Task} The created EphemeralTask.
|
|
21866
22098
|
*/
|
|
21867
22099
|
static createEphemeralTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions & EphemeralTaskOptions): EphemeralTask;
|
|
21868
22100
|
/**
|
|
21869
|
-
* Creates an
|
|
21870
|
-
*
|
|
21871
|
-
* @param
|
|
21872
|
-
* @param
|
|
21873
|
-
* @param
|
|
21874
|
-
* @
|
|
22101
|
+
* Creates an EphemeralTask for the meta layer (self-destructs after exec or condition) without default registration.
|
|
22102
|
+
* Useful for transients; optionally register if needed.
|
|
22103
|
+
* @param {string} name Identifier (may not be unique if not registered).
|
|
22104
|
+
* @param {TaskFunction} func Function.
|
|
22105
|
+
* @param {string} [description] Optional.
|
|
22106
|
+
* @param {TaskOptions & EphemeralTaskOptions} [options={}] Optional task options.
|
|
22107
|
+
* @returns {Task} The created EphemeralMetaTask.
|
|
21875
22108
|
*/
|
|
21876
22109
|
static createEphemeralMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions & EphemeralTaskOptions): EphemeralTask;
|
|
21877
22110
|
/**
|
|
21878
22111
|
* Creates a GraphRoutine (named entry to starting tasks) and registers it.
|
|
21879
|
-
* @param name Unique identifier.
|
|
21880
|
-
* @param tasks Starting tasks
|
|
21881
|
-
* @param description Optional.
|
|
21882
|
-
* @returns The created GraphRoutine.
|
|
21883
|
-
* @edge If tasks empty, routine is valid but inert.
|
|
22112
|
+
* @param {string} name Unique identifier.
|
|
22113
|
+
* @param {Task[]} tasks Starting tasks.
|
|
22114
|
+
* @param {string} [description] Optional.
|
|
22115
|
+
* @returns {GraphRoutine} The created GraphRoutine.
|
|
21884
22116
|
*/
|
|
21885
22117
|
static createRoutine(name: string, tasks: Task[], description?: string): GraphRoutine;
|
|
21886
22118
|
/**
|
|
21887
|
-
* Creates a
|
|
21888
|
-
* @param name
|
|
21889
|
-
* @param tasks Starting tasks.
|
|
21890
|
-
* @param description Optional.
|
|
21891
|
-
* @returns The created
|
|
22119
|
+
* Creates a GraphRoutine for the meta layer (named entry to starting tasks) and registers it.
|
|
22120
|
+
* @param {string} name Unique identifier.
|
|
22121
|
+
* @param {Task[]} tasks Starting tasks.
|
|
22122
|
+
* @param {string} [description] Optional.
|
|
22123
|
+
* @returns {GraphRoutine} The created GraphMetaRoutine.
|
|
21892
22124
|
*/
|
|
21893
22125
|
static createMetaRoutine(name: string, tasks: Task[], description?: string): GraphRoutine;
|
|
21894
22126
|
static reset(): void;
|
|
@@ -21900,22 +22132,102 @@ declare class GraphMetadataController {
|
|
|
21900
22132
|
constructor();
|
|
21901
22133
|
}
|
|
21902
22134
|
|
|
22135
|
+
/**
|
|
22136
|
+
* RestController class is responsible for managing RESTful interactions, including defining
|
|
22137
|
+
* server configurations and handling client requests. It serves as a singleton, accessible via
|
|
22138
|
+
* the `instance` property.
|
|
22139
|
+
*/
|
|
21903
22140
|
declare class RestController {
|
|
21904
22141
|
private static _instance;
|
|
21905
22142
|
static get instance(): RestController;
|
|
22143
|
+
/**
|
|
22144
|
+
* Fetches data from the given URL with a specified timeout. This function performs
|
|
22145
|
+
* a fetch request with the ability to cancel the request if it exceeds the provided timeout duration.
|
|
22146
|
+
*
|
|
22147
|
+
* @param {string} url - The URL to make the request to.
|
|
22148
|
+
* @param {any} requestInit - The initialization object for the fetch request, which may include method, headers, and body.
|
|
22149
|
+
* @param {number} timeoutMs - The maximum duration in milliseconds to wait for the fetch request to complete before aborting.
|
|
22150
|
+
* @returns {Promise<any>} A promise that resolves to the parsed response data if the request is successful.
|
|
22151
|
+
* @throws {Error} Throws an error if the request fails due to issues such as timeout or other unexpected errors.
|
|
22152
|
+
*/
|
|
21906
22153
|
fetchDataWithTimeout: (url: string, requestInit: any, timeoutMs: number) => Promise<any>;
|
|
22154
|
+
/**
|
|
22155
|
+
* Constructor for initializing the REST server and related configurations.
|
|
22156
|
+
*
|
|
22157
|
+
* This method configures and sets up the REST server tasks using Cadenza's meta-task system, defining certain endpoints
|
|
22158
|
+
* like `/handshake`, `/delegation`, `/signal`, and `/status`. It also integrates security settings, CORS policies,
|
|
22159
|
+
* and rate-limiting profiles (low, medium, high) based on the provided context. Furthermore, it starts the server and
|
|
22160
|
+
* establishes necessary meta-handlings to enable delegated operations and signal processing.
|
|
22161
|
+
*
|
|
22162
|
+
* It initializes and configures the REST server tasks.
|
|
22163
|
+
*/
|
|
21907
22164
|
constructor();
|
|
21908
22165
|
}
|
|
21909
22166
|
|
|
22167
|
+
/**
|
|
22168
|
+
* The `SocketController` class handles the setup and management of a WebSocket server,
|
|
22169
|
+
* ensuring secure connections, message handling, and rate-limiting.
|
|
22170
|
+
* This class is designed to function as a singleton, providing a unified interface
|
|
22171
|
+
* for WebSocket interactions in the application by standardizing the server setup
|
|
22172
|
+
* and integrating task-based processing through the `Cadenza` framework.
|
|
22173
|
+
*/
|
|
21910
22174
|
declare class SocketController {
|
|
21911
22175
|
private static _instance;
|
|
21912
22176
|
static get instance(): SocketController;
|
|
22177
|
+
/**
|
|
22178
|
+
* Constructs the `SocketServer`, setting up a WebSocket server with specific configurations,
|
|
22179
|
+
* including connection state recovery, rate limiting, CORS handling, and custom event handling.
|
|
22180
|
+
* This class sets up the communication infrastructure for scalable, resilient, and secure WebSocket-based interactions
|
|
22181
|
+
* using metadata-driven task execution with `Cadenza`.
|
|
22182
|
+
*
|
|
22183
|
+
* It provides support for:
|
|
22184
|
+
* - Origin-based access control for connections.
|
|
22185
|
+
* - Optional payload sanitization.
|
|
22186
|
+
* - Configurable rate limiting and behavior on limit breaches (soft/hard disconnects).
|
|
22187
|
+
* - Event handlers for connection, handshake, delegation, signaling, status checks, and disconnection.
|
|
22188
|
+
*
|
|
22189
|
+
* The server can handle both internal and external interactions depending on the provided configurations,
|
|
22190
|
+
* and integrates directly with Cadenza's task workflow engine.
|
|
22191
|
+
*
|
|
22192
|
+
* Initializes the `SocketServer` to be ready for WebSocket communication.
|
|
22193
|
+
*/
|
|
21913
22194
|
constructor();
|
|
21914
22195
|
}
|
|
21915
22196
|
|
|
22197
|
+
/**
|
|
22198
|
+
* SignalController is a singleton class that manages signal registration, transmission,
|
|
22199
|
+
* and metadata handling within a service instance.
|
|
22200
|
+
*
|
|
22201
|
+
* This class utilizes the Cadenza framework to handle various tasks related to signals,
|
|
22202
|
+
* such as registering signals, transmitting signals to remote services, adding metadata,
|
|
22203
|
+
* and maintaining clean-forwarding and processing of signals.
|
|
22204
|
+
*
|
|
22205
|
+
* Features:
|
|
22206
|
+
* - Ensures signals are properly registered and metadata is propagated.
|
|
22207
|
+
* - Handles foreign signal registration for cross-service communication.
|
|
22208
|
+
* - Forwards signal observations and manages their metadata.
|
|
22209
|
+
* - Adds metadata during signal emission and consumption.
|
|
22210
|
+
* - Implements a meta-task-based system for handling complex workflows.
|
|
22211
|
+
*
|
|
22212
|
+
* Constructor initializes the necessary meta-tasks and tasks required for signal management.
|
|
22213
|
+
*/
|
|
21916
22214
|
declare class SignalController {
|
|
21917
22215
|
private static _instance;
|
|
21918
22216
|
static get instance(): SignalController;
|
|
22217
|
+
/**
|
|
22218
|
+
* Constructor method for initializing the signal registration and data transmission process.
|
|
22219
|
+
* This method defines multiple meta tasks to manage signals, forwarding, and adding metadata
|
|
22220
|
+
* for service instances in a distributed system.
|
|
22221
|
+
*
|
|
22222
|
+
* Some key functionalities include:
|
|
22223
|
+
* - Registering signals from a service instance.
|
|
22224
|
+
* - Handling foreign signal registration from remote services.
|
|
22225
|
+
* - Forwarding signal observations between services.
|
|
22226
|
+
* - Adding metadata to signal emissions for better traceability.
|
|
22227
|
+
* - Adding metadata to signal consumption events.
|
|
22228
|
+
*
|
|
22229
|
+
* It serves as an initializer for signals and tasks.
|
|
22230
|
+
*/
|
|
21919
22231
|
constructor();
|
|
21920
22232
|
}
|
|
21921
22233
|
|