@cadenza.io/service 1.2.2 → 1.3.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 +98 -9
- package/dist/index.d.ts +98 -9
- package/dist/index.js +1176 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1178 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
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, SchemaDefinition, GraphContext, AnyObject, TaskResult, SignalBroker, GraphRunner, GraphRegistry, CadenzaMode, TaskOptions, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask, GraphRoutine } from '@cadenza.io/core';
|
|
3
|
-
export { AnyObject } from '@cadenza.io/core';
|
|
2
|
+
import { Task, ThrottleTagGetter, SchemaDefinition as SchemaDefinition$1, GraphContext, AnyObject, TaskResult, SignalBroker, GraphRunner, GraphRegistry, CadenzaMode, TaskOptions, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask, GraphRoutine } from '@cadenza.io/core';
|
|
3
|
+
export { AnyObject, DebounceOptions, DebounceTask, EphemeralTask, EphemeralTaskOptions, GraphRoutine, Task, TaskFunction, TaskOptions, ThrottleTagGetter } from '@cadenza.io/core';
|
|
4
4
|
|
|
5
5
|
declare class DeputyTask extends Task {
|
|
6
6
|
readonly isDeputy: boolean;
|
|
@@ -31,7 +31,7 @@ declare class DeputyTask extends Task {
|
|
|
31
31
|
* @emits {meta.deputy.delegation_requested} - Emitted on construction with task and service details.
|
|
32
32
|
* @note Fallbacks should be handled externally via `.doOnFail`; timeouts are managed by the engine.
|
|
33
33
|
*/
|
|
34
|
-
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 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
34
|
+
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
35
|
/**
|
|
36
36
|
* Triggers the delegation flow via a signal to the meta-layer.
|
|
37
37
|
* @param context - The GraphContext containing execution data.
|
|
@@ -45,7 +45,7 @@ declare class DeputyTask extends Task {
|
|
|
45
45
|
execute(context: GraphContext, emit: (signal: string, ctx: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
type DbOperationType = "query" | "insert" | "update" | "delete";
|
|
48
|
+
type DbOperationType$1 = "query" | "insert" | "update" | "delete";
|
|
49
49
|
type SortDirection = "asc" | "desc";
|
|
50
50
|
interface JoinDefinition {
|
|
51
51
|
on: string;
|
|
@@ -106,7 +106,7 @@ declare class DatabaseTask extends DeputyTask {
|
|
|
106
106
|
* @emits {meta.deputy.created} - Emitted on construction with task and service details.
|
|
107
107
|
* @note Fallbacks via `.doOnFail` externally; timeouts managed by the engine.
|
|
108
108
|
*/
|
|
109
|
-
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 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
109
|
+
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);
|
|
110
110
|
/**
|
|
111
111
|
* Triggers the database operation delegation flow via a signal to the meta-layer.
|
|
112
112
|
* @param context - The GraphContext containing execution data.
|
|
@@ -193,7 +193,7 @@ declare class SignalTransmissionTask extends Task {
|
|
|
193
193
|
* @emits {meta.deputy.created} - Emitted on construction with task and service details.
|
|
194
194
|
* @note Fallbacks via `.doOnFail` externally; timeouts managed by the engine.
|
|
195
195
|
*/
|
|
196
|
-
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 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
196
|
+
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);
|
|
197
197
|
/**
|
|
198
198
|
* Triggers the database operation delegation flow via a signal to the meta-layer.
|
|
199
199
|
* @param context - The GraphContext containing execution data.
|
|
@@ -207,6 +207,87 @@ declare class SignalTransmissionTask extends Task {
|
|
|
207
207
|
execute(context: GraphContext, emit: (signal: string, ctx: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
type SchemaType = "varchar" | "text" | "int" | "bigint" | "decimal" | "boolean" | "array" | "object" | "jsonb" | "uuid" | "timestamp" | "date" | "geo_point" | "bytea" | "any";
|
|
211
|
+
type SchemaConstraints = {
|
|
212
|
+
min?: number;
|
|
213
|
+
max?: number;
|
|
214
|
+
minLength?: number;
|
|
215
|
+
maxLength?: number;
|
|
216
|
+
pattern?: string;
|
|
217
|
+
enum?: any[];
|
|
218
|
+
multipleOf?: number;
|
|
219
|
+
format?: "email" | "url" | "date-time" | "uuid" | "custom";
|
|
220
|
+
oneOf?: any[];
|
|
221
|
+
appendOnly?: boolean;
|
|
222
|
+
check?: string;
|
|
223
|
+
precision?: number;
|
|
224
|
+
scale?: number;
|
|
225
|
+
};
|
|
226
|
+
interface FieldDefinition {
|
|
227
|
+
type: SchemaType;
|
|
228
|
+
primary?: boolean;
|
|
229
|
+
index?: boolean;
|
|
230
|
+
unique?: boolean;
|
|
231
|
+
default?: any;
|
|
232
|
+
required?: boolean;
|
|
233
|
+
nullable?: boolean;
|
|
234
|
+
encrypted?: boolean;
|
|
235
|
+
constraints?: SchemaConstraints;
|
|
236
|
+
references?: string;
|
|
237
|
+
items?: FieldDefinition;
|
|
238
|
+
description?: string;
|
|
239
|
+
generated?: "uuid" | "timestamp" | "now" | "autoIncrement";
|
|
240
|
+
onDelete?: "cascade" | "set_null" | "no_action";
|
|
241
|
+
onUpdate?: "cascade" | "set_null" | "no_action";
|
|
242
|
+
}
|
|
243
|
+
type DbOperationType = "query" | "insert" | "update" | "delete";
|
|
244
|
+
interface TableDefinition {
|
|
245
|
+
fields: Record<string, FieldDefinition>;
|
|
246
|
+
meta?: {
|
|
247
|
+
description?: string;
|
|
248
|
+
tags?: string[];
|
|
249
|
+
shardKey?: string;
|
|
250
|
+
partitionHint?: string;
|
|
251
|
+
appendOnly?: boolean;
|
|
252
|
+
encryptedFields?: string[];
|
|
253
|
+
};
|
|
254
|
+
indexes?: string[][];
|
|
255
|
+
uniqueConstraints?: string[][];
|
|
256
|
+
fullTextIndexes?: string[][];
|
|
257
|
+
triggers?: Record<string, {
|
|
258
|
+
when: "before" | "after";
|
|
259
|
+
event: "insert" | "update" | "delete";
|
|
260
|
+
function: string;
|
|
261
|
+
}>;
|
|
262
|
+
customSignals?: {
|
|
263
|
+
triggers?: {
|
|
264
|
+
[key in DbOperationType]?: (string | {
|
|
265
|
+
signal: string;
|
|
266
|
+
condition?: (ctx: AnyObject) => boolean;
|
|
267
|
+
})[];
|
|
268
|
+
};
|
|
269
|
+
emissions?: {
|
|
270
|
+
[key in DbOperationType]?: (string | {
|
|
271
|
+
signal: string;
|
|
272
|
+
condition?: (ctx: AnyObject) => boolean;
|
|
273
|
+
})[];
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
interface SchemaDefinition {
|
|
278
|
+
version?: number;
|
|
279
|
+
tables: Record<string, TableDefinition>;
|
|
280
|
+
relations?: Record<string, {
|
|
281
|
+
on: string;
|
|
282
|
+
type?: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
|
|
283
|
+
}>;
|
|
284
|
+
meta?: {
|
|
285
|
+
defaultEncoding?: "utf8" | "base64";
|
|
286
|
+
autoIndex?: boolean;
|
|
287
|
+
relationsVersion?: number;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
210
291
|
type SecurityProfile = "low" | "medium" | "high";
|
|
211
292
|
type NetworkMode = "internal" | "exposed" | "exposed-high-sec" | "auto" | "dev";
|
|
212
293
|
type ServerOptions = {
|
|
@@ -226,6 +307,11 @@ type ServerOptions = {
|
|
|
226
307
|
};
|
|
227
308
|
relatedServices?: string[][];
|
|
228
309
|
};
|
|
310
|
+
interface DatabaseOptions {
|
|
311
|
+
type?: "postgres";
|
|
312
|
+
databaseName?: string;
|
|
313
|
+
poolSize?: number;
|
|
314
|
+
}
|
|
229
315
|
declare class CadenzaService {
|
|
230
316
|
static broker: SignalBroker;
|
|
231
317
|
static runner: GraphRunner;
|
|
@@ -233,6 +319,7 @@ declare class CadenzaService {
|
|
|
233
319
|
static registry: GraphRegistry;
|
|
234
320
|
static serviceRegistry: ServiceRegistry;
|
|
235
321
|
protected static isBootstrapped: boolean;
|
|
322
|
+
protected static serviceCreated: boolean;
|
|
236
323
|
static bootstrap(): void;
|
|
237
324
|
protected static validateServiceName(serviceName: string): void;
|
|
238
325
|
protected static validateName(name: string): void;
|
|
@@ -21614,10 +21701,10 @@ declare class CadenzaService {
|
|
|
21614
21701
|
static createThrottledDeputyTask(routineName: string, serviceName?: string | undefined, throttledIdGetter?: ThrottleTagGetter, options?: TaskOptions): DeputyTask;
|
|
21615
21702
|
static createMetaThrottledDeputyTask(routineName: string, serviceName?: string | undefined, throttledIdGetter?: ThrottleTagGetter, options?: TaskOptions): DeputyTask;
|
|
21616
21703
|
static createSignalTransmissionTask(signalName: string, serviceName: string, options?: TaskOptions): SignalTransmissionTask;
|
|
21617
|
-
static createDatabaseTask(tableName: string, operation: DbOperationType, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21704
|
+
static createDatabaseTask(tableName: string, operation: DbOperationType$1, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21618
21705
|
static createDatabaseInertTask(tableName: string, databaseServiceName?: string | undefined, queryData?: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21619
21706
|
static createDatabaseQueryTask(tableName: string, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21620
|
-
static createCadenzaDBTask(tableName: string, operation: DbOperationType, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21707
|
+
static createCadenzaDBTask(tableName: string, operation: DbOperationType$1, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21621
21708
|
static createCadenzaDBInsertTask(tableName: string, queryData?: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21622
21709
|
static createCadenzaDBQueryTask(tableName: string, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21623
21710
|
/**
|
|
@@ -21632,6 +21719,8 @@ declare class CadenzaService {
|
|
|
21632
21719
|
*/
|
|
21633
21720
|
static createCadenzaService(serviceName: string, description?: string, options?: ServerOptions): void;
|
|
21634
21721
|
static createCadenzaMetaService(serviceName: string, description: string, options?: ServerOptions): void;
|
|
21722
|
+
static createDatabaseService(name: string, schema: SchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
21723
|
+
static createMetaDatabaseService(name: string, schema: SchemaDefinition, description?: string, options?: ServerOptions): void;
|
|
21635
21724
|
/**
|
|
21636
21725
|
* Creates a standard Task and registers it in the GraphRegistry.
|
|
21637
21726
|
* @param name Unique identifier for the task.
|
|
@@ -21779,4 +21868,4 @@ declare class SignalController {
|
|
|
21779
21868
|
constructor();
|
|
21780
21869
|
}
|
|
21781
21870
|
|
|
21782
|
-
export { DatabaseTask, type DbOperationPayload, type DbOperationType, type DeputyDescriptor, DeputyTask, type JoinDefinition, type NetworkMode, type OpEffect, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, TaskController, type ValueOrSubOp, CadenzaService as default };
|
|
21871
|
+
export { DatabaseTask, type DbOperationPayload, type DbOperationType$1 as DbOperationType, type DeputyDescriptor, DeputyTask, type JoinDefinition, type NetworkMode, type OpEffect, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, TaskController, type ValueOrSubOp, CadenzaService as default };
|
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, SchemaDefinition, GraphContext, AnyObject, TaskResult, SignalBroker, GraphRunner, GraphRegistry, CadenzaMode, TaskOptions, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask, GraphRoutine } from '@cadenza.io/core';
|
|
3
|
-
export { AnyObject } from '@cadenza.io/core';
|
|
2
|
+
import { Task, ThrottleTagGetter, SchemaDefinition as SchemaDefinition$1, GraphContext, AnyObject, TaskResult, SignalBroker, GraphRunner, GraphRegistry, CadenzaMode, TaskOptions, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask, GraphRoutine } from '@cadenza.io/core';
|
|
3
|
+
export { AnyObject, DebounceOptions, DebounceTask, EphemeralTask, EphemeralTaskOptions, GraphRoutine, Task, TaskFunction, TaskOptions, ThrottleTagGetter } from '@cadenza.io/core';
|
|
4
4
|
|
|
5
5
|
declare class DeputyTask extends Task {
|
|
6
6
|
readonly isDeputy: boolean;
|
|
@@ -31,7 +31,7 @@ declare class DeputyTask extends Task {
|
|
|
31
31
|
* @emits {meta.deputy.delegation_requested} - Emitted on construction with task and service details.
|
|
32
32
|
* @note Fallbacks should be handled externally via `.doOnFail`; timeouts are managed by the engine.
|
|
33
33
|
*/
|
|
34
|
-
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 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
34
|
+
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
35
|
/**
|
|
36
36
|
* Triggers the delegation flow via a signal to the meta-layer.
|
|
37
37
|
* @param context - The GraphContext containing execution data.
|
|
@@ -45,7 +45,7 @@ declare class DeputyTask extends Task {
|
|
|
45
45
|
execute(context: GraphContext, emit: (signal: string, ctx: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
type DbOperationType = "query" | "insert" | "update" | "delete";
|
|
48
|
+
type DbOperationType$1 = "query" | "insert" | "update" | "delete";
|
|
49
49
|
type SortDirection = "asc" | "desc";
|
|
50
50
|
interface JoinDefinition {
|
|
51
51
|
on: string;
|
|
@@ -106,7 +106,7 @@ declare class DatabaseTask extends DeputyTask {
|
|
|
106
106
|
* @emits {meta.deputy.created} - Emitted on construction with task and service details.
|
|
107
107
|
* @note Fallbacks via `.doOnFail` externally; timeouts managed by the engine.
|
|
108
108
|
*/
|
|
109
|
-
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 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
109
|
+
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);
|
|
110
110
|
/**
|
|
111
111
|
* Triggers the database operation delegation flow via a signal to the meta-layer.
|
|
112
112
|
* @param context - The GraphContext containing execution data.
|
|
@@ -193,7 +193,7 @@ declare class SignalTransmissionTask extends Task {
|
|
|
193
193
|
* @emits {meta.deputy.created} - Emitted on construction with task and service details.
|
|
194
194
|
* @note Fallbacks via `.doOnFail` externally; timeouts managed by the engine.
|
|
195
195
|
*/
|
|
196
|
-
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 | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
196
|
+
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);
|
|
197
197
|
/**
|
|
198
198
|
* Triggers the database operation delegation flow via a signal to the meta-layer.
|
|
199
199
|
* @param context - The GraphContext containing execution data.
|
|
@@ -207,6 +207,87 @@ declare class SignalTransmissionTask extends Task {
|
|
|
207
207
|
execute(context: GraphContext, emit: (signal: string, ctx: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
type SchemaType = "varchar" | "text" | "int" | "bigint" | "decimal" | "boolean" | "array" | "object" | "jsonb" | "uuid" | "timestamp" | "date" | "geo_point" | "bytea" | "any";
|
|
211
|
+
type SchemaConstraints = {
|
|
212
|
+
min?: number;
|
|
213
|
+
max?: number;
|
|
214
|
+
minLength?: number;
|
|
215
|
+
maxLength?: number;
|
|
216
|
+
pattern?: string;
|
|
217
|
+
enum?: any[];
|
|
218
|
+
multipleOf?: number;
|
|
219
|
+
format?: "email" | "url" | "date-time" | "uuid" | "custom";
|
|
220
|
+
oneOf?: any[];
|
|
221
|
+
appendOnly?: boolean;
|
|
222
|
+
check?: string;
|
|
223
|
+
precision?: number;
|
|
224
|
+
scale?: number;
|
|
225
|
+
};
|
|
226
|
+
interface FieldDefinition {
|
|
227
|
+
type: SchemaType;
|
|
228
|
+
primary?: boolean;
|
|
229
|
+
index?: boolean;
|
|
230
|
+
unique?: boolean;
|
|
231
|
+
default?: any;
|
|
232
|
+
required?: boolean;
|
|
233
|
+
nullable?: boolean;
|
|
234
|
+
encrypted?: boolean;
|
|
235
|
+
constraints?: SchemaConstraints;
|
|
236
|
+
references?: string;
|
|
237
|
+
items?: FieldDefinition;
|
|
238
|
+
description?: string;
|
|
239
|
+
generated?: "uuid" | "timestamp" | "now" | "autoIncrement";
|
|
240
|
+
onDelete?: "cascade" | "set_null" | "no_action";
|
|
241
|
+
onUpdate?: "cascade" | "set_null" | "no_action";
|
|
242
|
+
}
|
|
243
|
+
type DbOperationType = "query" | "insert" | "update" | "delete";
|
|
244
|
+
interface TableDefinition {
|
|
245
|
+
fields: Record<string, FieldDefinition>;
|
|
246
|
+
meta?: {
|
|
247
|
+
description?: string;
|
|
248
|
+
tags?: string[];
|
|
249
|
+
shardKey?: string;
|
|
250
|
+
partitionHint?: string;
|
|
251
|
+
appendOnly?: boolean;
|
|
252
|
+
encryptedFields?: string[];
|
|
253
|
+
};
|
|
254
|
+
indexes?: string[][];
|
|
255
|
+
uniqueConstraints?: string[][];
|
|
256
|
+
fullTextIndexes?: string[][];
|
|
257
|
+
triggers?: Record<string, {
|
|
258
|
+
when: "before" | "after";
|
|
259
|
+
event: "insert" | "update" | "delete";
|
|
260
|
+
function: string;
|
|
261
|
+
}>;
|
|
262
|
+
customSignals?: {
|
|
263
|
+
triggers?: {
|
|
264
|
+
[key in DbOperationType]?: (string | {
|
|
265
|
+
signal: string;
|
|
266
|
+
condition?: (ctx: AnyObject) => boolean;
|
|
267
|
+
})[];
|
|
268
|
+
};
|
|
269
|
+
emissions?: {
|
|
270
|
+
[key in DbOperationType]?: (string | {
|
|
271
|
+
signal: string;
|
|
272
|
+
condition?: (ctx: AnyObject) => boolean;
|
|
273
|
+
})[];
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
interface SchemaDefinition {
|
|
278
|
+
version?: number;
|
|
279
|
+
tables: Record<string, TableDefinition>;
|
|
280
|
+
relations?: Record<string, {
|
|
281
|
+
on: string;
|
|
282
|
+
type?: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
|
|
283
|
+
}>;
|
|
284
|
+
meta?: {
|
|
285
|
+
defaultEncoding?: "utf8" | "base64";
|
|
286
|
+
autoIndex?: boolean;
|
|
287
|
+
relationsVersion?: number;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
210
291
|
type SecurityProfile = "low" | "medium" | "high";
|
|
211
292
|
type NetworkMode = "internal" | "exposed" | "exposed-high-sec" | "auto" | "dev";
|
|
212
293
|
type ServerOptions = {
|
|
@@ -226,6 +307,11 @@ type ServerOptions = {
|
|
|
226
307
|
};
|
|
227
308
|
relatedServices?: string[][];
|
|
228
309
|
};
|
|
310
|
+
interface DatabaseOptions {
|
|
311
|
+
type?: "postgres";
|
|
312
|
+
databaseName?: string;
|
|
313
|
+
poolSize?: number;
|
|
314
|
+
}
|
|
229
315
|
declare class CadenzaService {
|
|
230
316
|
static broker: SignalBroker;
|
|
231
317
|
static runner: GraphRunner;
|
|
@@ -233,6 +319,7 @@ declare class CadenzaService {
|
|
|
233
319
|
static registry: GraphRegistry;
|
|
234
320
|
static serviceRegistry: ServiceRegistry;
|
|
235
321
|
protected static isBootstrapped: boolean;
|
|
322
|
+
protected static serviceCreated: boolean;
|
|
236
323
|
static bootstrap(): void;
|
|
237
324
|
protected static validateServiceName(serviceName: string): void;
|
|
238
325
|
protected static validateName(name: string): void;
|
|
@@ -21614,10 +21701,10 @@ declare class CadenzaService {
|
|
|
21614
21701
|
static createThrottledDeputyTask(routineName: string, serviceName?: string | undefined, throttledIdGetter?: ThrottleTagGetter, options?: TaskOptions): DeputyTask;
|
|
21615
21702
|
static createMetaThrottledDeputyTask(routineName: string, serviceName?: string | undefined, throttledIdGetter?: ThrottleTagGetter, options?: TaskOptions): DeputyTask;
|
|
21616
21703
|
static createSignalTransmissionTask(signalName: string, serviceName: string, options?: TaskOptions): SignalTransmissionTask;
|
|
21617
|
-
static createDatabaseTask(tableName: string, operation: DbOperationType, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21704
|
+
static createDatabaseTask(tableName: string, operation: DbOperationType$1, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21618
21705
|
static createDatabaseInertTask(tableName: string, databaseServiceName?: string | undefined, queryData?: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21619
21706
|
static createDatabaseQueryTask(tableName: string, databaseServiceName: string | undefined, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21620
|
-
static createCadenzaDBTask(tableName: string, operation: DbOperationType, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21707
|
+
static createCadenzaDBTask(tableName: string, operation: DbOperationType$1, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21621
21708
|
static createCadenzaDBInsertTask(tableName: string, queryData?: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21622
21709
|
static createCadenzaDBQueryTask(tableName: string, queryData: DbOperationPayload, options?: TaskOptions): DatabaseTask;
|
|
21623
21710
|
/**
|
|
@@ -21632,6 +21719,8 @@ declare class CadenzaService {
|
|
|
21632
21719
|
*/
|
|
21633
21720
|
static createCadenzaService(serviceName: string, description?: string, options?: ServerOptions): void;
|
|
21634
21721
|
static createCadenzaMetaService(serviceName: string, description: string, options?: ServerOptions): void;
|
|
21722
|
+
static createDatabaseService(name: string, schema: SchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
21723
|
+
static createMetaDatabaseService(name: string, schema: SchemaDefinition, description?: string, options?: ServerOptions): void;
|
|
21635
21724
|
/**
|
|
21636
21725
|
* Creates a standard Task and registers it in the GraphRegistry.
|
|
21637
21726
|
* @param name Unique identifier for the task.
|
|
@@ -21779,4 +21868,4 @@ declare class SignalController {
|
|
|
21779
21868
|
constructor();
|
|
21780
21869
|
}
|
|
21781
21870
|
|
|
21782
|
-
export { DatabaseTask, type DbOperationPayload, type DbOperationType, type DeputyDescriptor, DeputyTask, type JoinDefinition, type NetworkMode, type OpEffect, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, TaskController, type ValueOrSubOp, CadenzaService as default };
|
|
21871
|
+
export { DatabaseTask, type DbOperationPayload, type DbOperationType$1 as DbOperationType, type DeputyDescriptor, DeputyTask, type JoinDefinition, type NetworkMode, type OpEffect, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, TaskController, type ValueOrSubOp, CadenzaService as default };
|