@cadenza.io/service 2.10.0 → 2.12.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/README.md +12 -0
- package/dist/index.d.mts +48 -8
- package/dist/index.d.ts +48 -8
- package/dist/index.js +1691 -1350
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1653 -1312
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,6 +55,18 @@ localTask.doOn('ContextService.process.failed');
|
|
|
55
55
|
|
|
56
56
|
For full examples, see this repository or the test suite.
|
|
57
57
|
|
|
58
|
+
## PostgresActor Documentation
|
|
59
|
+
|
|
60
|
+
Canonical PostgresActor docs:
|
|
61
|
+
|
|
62
|
+
- [PostgresActor Guide](./docs/postgres-actor-guide.md)
|
|
63
|
+
- [PostgresActor Reference](./docs/postgres-actor-reference.md)
|
|
64
|
+
|
|
65
|
+
Workspace mirror (for cross-repo publication):
|
|
66
|
+
|
|
67
|
+
- [Workspace Guide Mirror](../docs/postgres-actor-guide.md)
|
|
68
|
+
- [Workspace Reference Mirror](../docs/postgres-actor-reference.md)
|
|
69
|
+
|
|
58
70
|
|
|
59
71
|
## Features
|
|
60
72
|
|
package/dist/index.d.mts
CHANGED
|
@@ -57,6 +57,14 @@ declare class DeputyTask extends Task {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
type DbOperationType$1 = "query" | "insert" | "update" | "delete";
|
|
60
|
+
type QueryMode = "rows" | "count" | "exists" | "one" | "aggregate";
|
|
61
|
+
type AggregateFunction = "count" | "sum" | "avg" | "min" | "max";
|
|
62
|
+
interface AggregateDefinition {
|
|
63
|
+
fn: AggregateFunction;
|
|
64
|
+
field?: string;
|
|
65
|
+
as?: string;
|
|
66
|
+
distinct?: boolean;
|
|
67
|
+
}
|
|
60
68
|
type SortDirection = "asc" | "desc";
|
|
61
69
|
interface JoinDefinition {
|
|
62
70
|
on: string;
|
|
@@ -88,6 +96,9 @@ interface DbOperationPayload {
|
|
|
88
96
|
filter?: Record<string, ValueOrList>;
|
|
89
97
|
fields?: string[];
|
|
90
98
|
joins?: Record<string, JoinDefinition>;
|
|
99
|
+
queryMode?: QueryMode;
|
|
100
|
+
aggregates?: AggregateDefinition[];
|
|
101
|
+
groupBy?: string[];
|
|
91
102
|
sort?: Record<string, SortDirection>;
|
|
92
103
|
limit?: number;
|
|
93
104
|
offset?: number;
|
|
@@ -434,6 +445,21 @@ interface TableDefinition {
|
|
|
434
445
|
description?: string;
|
|
435
446
|
input?: SchemaDefinition;
|
|
436
447
|
})[];
|
|
448
|
+
insert?: (string | {
|
|
449
|
+
intent: string;
|
|
450
|
+
description?: string;
|
|
451
|
+
input?: SchemaDefinition;
|
|
452
|
+
})[];
|
|
453
|
+
update?: (string | {
|
|
454
|
+
intent: string;
|
|
455
|
+
description?: string;
|
|
456
|
+
input?: SchemaDefinition;
|
|
457
|
+
})[];
|
|
458
|
+
delete?: (string | {
|
|
459
|
+
intent: string;
|
|
460
|
+
description?: string;
|
|
461
|
+
input?: SchemaDefinition;
|
|
462
|
+
})[];
|
|
437
463
|
};
|
|
438
464
|
initialData?: {
|
|
439
465
|
fields: string[];
|
|
@@ -22404,14 +22430,28 @@ declare class CadenzaService {
|
|
|
22404
22430
|
*/
|
|
22405
22431
|
static createCadenzaMetaService(serviceName: string, description: string, options?: ServerOptions): void;
|
|
22406
22432
|
/**
|
|
22407
|
-
* Creates and initializes a database service
|
|
22408
|
-
* This
|
|
22433
|
+
* Creates and initializes a PostgresActor-backed database service.
|
|
22434
|
+
* This is the canonical API for schema-driven postgres setup in cadenza-service.
|
|
22409
22435
|
*
|
|
22410
|
-
* @param {string} name -
|
|
22411
|
-
* @param {DatabaseSchemaDefinition} schema -
|
|
22412
|
-
* @param {string} [description=""] -
|
|
22413
|
-
* @param {ServerOptions & DatabaseOptions} [options={}] -
|
|
22414
|
-
* @return {void}
|
|
22436
|
+
* @param {string} name - Logical actor/service name.
|
|
22437
|
+
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22438
|
+
* @param {string} [description=""] - Optional human-readable description.
|
|
22439
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Server/database runtime options.
|
|
22440
|
+
* @return {void}
|
|
22441
|
+
*/
|
|
22442
|
+
static createPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22443
|
+
/**
|
|
22444
|
+
* Creates a meta PostgresActor service.
|
|
22445
|
+
*
|
|
22446
|
+
* @param {string} name - Logical actor/service name.
|
|
22447
|
+
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22448
|
+
* @param {string} [description=""] - Optional description.
|
|
22449
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional server/database options.
|
|
22450
|
+
* @return {void}
|
|
22451
|
+
*/
|
|
22452
|
+
static createMetaPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22453
|
+
/**
|
|
22454
|
+
* Legacy compatibility wrapper. Prefer {@link createPostgresActor}.
|
|
22415
22455
|
*/
|
|
22416
22456
|
static createDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22417
22457
|
/**
|
|
@@ -22921,4 +22961,4 @@ declare class SignalController {
|
|
|
22921
22961
|
constructor();
|
|
22922
22962
|
}
|
|
22923
22963
|
|
|
22924
|
-
export { DatabaseTask, type DbOperationPayload, type DbOperationType$1 as DbOperationType, type DeputyDescriptor, DeputyTask, type DistributedInquiryMeta, type DistributedInquiryOptions, GraphMetadataController, type InquiryResponderDescriptor, type InquiryResponderStatus, type JoinDefinition, type NetworkMode, type OpEffect, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, type ValueOrSubOp, CadenzaService as default };
|
|
22964
|
+
export { type AggregateDefinition, type AggregateFunction, DatabaseTask, type DbOperationPayload, type DbOperationType$1 as DbOperationType, type DeputyDescriptor, DeputyTask, type DistributedInquiryMeta, type DistributedInquiryOptions, GraphMetadataController, type InquiryResponderDescriptor, type InquiryResponderStatus, type JoinDefinition, type NetworkMode, type OpEffect, type QueryMode, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, type ValueOrSubOp, CadenzaService as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,14 @@ declare class DeputyTask extends Task {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
type DbOperationType$1 = "query" | "insert" | "update" | "delete";
|
|
60
|
+
type QueryMode = "rows" | "count" | "exists" | "one" | "aggregate";
|
|
61
|
+
type AggregateFunction = "count" | "sum" | "avg" | "min" | "max";
|
|
62
|
+
interface AggregateDefinition {
|
|
63
|
+
fn: AggregateFunction;
|
|
64
|
+
field?: string;
|
|
65
|
+
as?: string;
|
|
66
|
+
distinct?: boolean;
|
|
67
|
+
}
|
|
60
68
|
type SortDirection = "asc" | "desc";
|
|
61
69
|
interface JoinDefinition {
|
|
62
70
|
on: string;
|
|
@@ -88,6 +96,9 @@ interface DbOperationPayload {
|
|
|
88
96
|
filter?: Record<string, ValueOrList>;
|
|
89
97
|
fields?: string[];
|
|
90
98
|
joins?: Record<string, JoinDefinition>;
|
|
99
|
+
queryMode?: QueryMode;
|
|
100
|
+
aggregates?: AggregateDefinition[];
|
|
101
|
+
groupBy?: string[];
|
|
91
102
|
sort?: Record<string, SortDirection>;
|
|
92
103
|
limit?: number;
|
|
93
104
|
offset?: number;
|
|
@@ -434,6 +445,21 @@ interface TableDefinition {
|
|
|
434
445
|
description?: string;
|
|
435
446
|
input?: SchemaDefinition;
|
|
436
447
|
})[];
|
|
448
|
+
insert?: (string | {
|
|
449
|
+
intent: string;
|
|
450
|
+
description?: string;
|
|
451
|
+
input?: SchemaDefinition;
|
|
452
|
+
})[];
|
|
453
|
+
update?: (string | {
|
|
454
|
+
intent: string;
|
|
455
|
+
description?: string;
|
|
456
|
+
input?: SchemaDefinition;
|
|
457
|
+
})[];
|
|
458
|
+
delete?: (string | {
|
|
459
|
+
intent: string;
|
|
460
|
+
description?: string;
|
|
461
|
+
input?: SchemaDefinition;
|
|
462
|
+
})[];
|
|
437
463
|
};
|
|
438
464
|
initialData?: {
|
|
439
465
|
fields: string[];
|
|
@@ -22404,14 +22430,28 @@ declare class CadenzaService {
|
|
|
22404
22430
|
*/
|
|
22405
22431
|
static createCadenzaMetaService(serviceName: string, description: string, options?: ServerOptions): void;
|
|
22406
22432
|
/**
|
|
22407
|
-
* Creates and initializes a database service
|
|
22408
|
-
* This
|
|
22433
|
+
* Creates and initializes a PostgresActor-backed database service.
|
|
22434
|
+
* This is the canonical API for schema-driven postgres setup in cadenza-service.
|
|
22409
22435
|
*
|
|
22410
|
-
* @param {string} name -
|
|
22411
|
-
* @param {DatabaseSchemaDefinition} schema -
|
|
22412
|
-
* @param {string} [description=""] -
|
|
22413
|
-
* @param {ServerOptions & DatabaseOptions} [options={}] -
|
|
22414
|
-
* @return {void}
|
|
22436
|
+
* @param {string} name - Logical actor/service name.
|
|
22437
|
+
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22438
|
+
* @param {string} [description=""] - Optional human-readable description.
|
|
22439
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Server/database runtime options.
|
|
22440
|
+
* @return {void}
|
|
22441
|
+
*/
|
|
22442
|
+
static createPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22443
|
+
/**
|
|
22444
|
+
* Creates a meta PostgresActor service.
|
|
22445
|
+
*
|
|
22446
|
+
* @param {string} name - Logical actor/service name.
|
|
22447
|
+
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22448
|
+
* @param {string} [description=""] - Optional description.
|
|
22449
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional server/database options.
|
|
22450
|
+
* @return {void}
|
|
22451
|
+
*/
|
|
22452
|
+
static createMetaPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22453
|
+
/**
|
|
22454
|
+
* Legacy compatibility wrapper. Prefer {@link createPostgresActor}.
|
|
22415
22455
|
*/
|
|
22416
22456
|
static createDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22417
22457
|
/**
|
|
@@ -22921,4 +22961,4 @@ declare class SignalController {
|
|
|
22921
22961
|
constructor();
|
|
22922
22962
|
}
|
|
22923
22963
|
|
|
22924
|
-
export { DatabaseTask, type DbOperationPayload, type DbOperationType$1 as DbOperationType, type DeputyDescriptor, DeputyTask, type DistributedInquiryMeta, type DistributedInquiryOptions, GraphMetadataController, type InquiryResponderDescriptor, type InquiryResponderStatus, type JoinDefinition, type NetworkMode, type OpEffect, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, type ValueOrSubOp, CadenzaService as default };
|
|
22964
|
+
export { type AggregateDefinition, type AggregateFunction, DatabaseTask, type DbOperationPayload, type DbOperationType$1 as DbOperationType, type DeputyDescriptor, DeputyTask, type DistributedInquiryMeta, type DistributedInquiryOptions, GraphMetadataController, type InquiryResponderDescriptor, type InquiryResponderStatus, type JoinDefinition, type NetworkMode, type OpEffect, type QueryMode, RestController, type SecurityProfile, type ServerOptions, type ServiceInstanceDescriptor, ServiceRegistry, SignalController, SignalTransmissionTask, SocketController, type SortDirection, type SubOperation, type SubOperationType, type ValueOrSubOp, CadenzaService as default };
|