@cadenza.io/service 2.12.0 → 2.15.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 +7 -1
- package/dist/index.d.mts +15 -11
- package/dist/index.d.ts +15 -11
- package/dist/index.js +271 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +271 -86
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@ This repository (@Cadenza.io/service) is an extension of the core package, provi
|
|
|
16
16
|
|
|
17
17
|
The service package provides everything in the core package plus the following:
|
|
18
18
|
- **Service Extension**: A Service exposes the local graphs and signals to other Services in the system and enables them to interact with tasks and signals across other Services in the system via socket and/or REST.
|
|
19
|
-
- **
|
|
19
|
+
- **PostgresActor Extension**: A PostgresActor is a specialized actor that owns a Postgres pool, applies schema setup, and auto generates database tasks and intents without creating a network service.
|
|
20
|
+
- **Database Service Extension**: A Database Service is the higher-level helper that first creates a PostgresActor and then creates a Service that exposes those generated database tasks.
|
|
20
21
|
- **CadenzaDB compatibility**: A service can connect to the official CadenzaDB service and will automatically sync realtime data for introspection and visualization.
|
|
21
22
|
|
|
22
23
|
There is no need to install the core package separately. Instead, install the service package, which includes everything in the core package plus the distributed extensions.
|
|
@@ -62,6 +63,11 @@ Canonical PostgresActor docs:
|
|
|
62
63
|
- [PostgresActor Guide](./docs/postgres-actor-guide.md)
|
|
63
64
|
- [PostgresActor Reference](./docs/postgres-actor-reference.md)
|
|
64
65
|
|
|
66
|
+
High-level database service helper APIs:
|
|
67
|
+
|
|
68
|
+
- `Cadenza.createDatabaseService(...)`
|
|
69
|
+
- `Cadenza.createMetaDatabaseService(...)`
|
|
70
|
+
|
|
65
71
|
Workspace mirror (for cross-repo publication):
|
|
66
72
|
|
|
67
73
|
- [Workspace Guide Mirror](../docs/postgres-actor-guide.md)
|
package/dist/index.d.mts
CHANGED
|
@@ -507,6 +507,7 @@ interface DatabaseOptions {
|
|
|
507
507
|
databaseType?: "postgres";
|
|
508
508
|
databaseName?: string;
|
|
509
509
|
poolSize?: number;
|
|
510
|
+
ownerServiceName?: string | null;
|
|
510
511
|
}
|
|
511
512
|
/**
|
|
512
513
|
* The CadenzaService class serves as a central service layer providing various utility methods for managing tasks, signals, logging, and service interactions.
|
|
@@ -22430,28 +22431,28 @@ declare class CadenzaService {
|
|
|
22430
22431
|
*/
|
|
22431
22432
|
static createCadenzaMetaService(serviceName: string, description: string, options?: ServerOptions): void;
|
|
22432
22433
|
/**
|
|
22433
|
-
* Creates and initializes a PostgresActor
|
|
22434
|
-
* This is
|
|
22434
|
+
* Creates and initializes a specialized PostgresActor.
|
|
22435
|
+
* This is actor-only and does not create or register a network service.
|
|
22435
22436
|
*
|
|
22436
|
-
* @param {string} name - Logical
|
|
22437
|
+
* @param {string} name - Logical PostgresActor name.
|
|
22437
22438
|
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22438
|
-
* @param {string} [description=""] - Optional human-readable description.
|
|
22439
|
-
* @param {ServerOptions & DatabaseOptions} [options={}] -
|
|
22439
|
+
* @param {string} [description=""] - Optional human-readable actor description.
|
|
22440
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Actor/database runtime options.
|
|
22440
22441
|
* @return {void}
|
|
22441
22442
|
*/
|
|
22442
22443
|
static createPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22443
22444
|
/**
|
|
22444
|
-
* Creates a meta PostgresActor
|
|
22445
|
+
* Creates a meta PostgresActor.
|
|
22445
22446
|
*
|
|
22446
|
-
* @param {string} name - Logical
|
|
22447
|
+
* @param {string} name - Logical PostgresActor name.
|
|
22447
22448
|
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22448
22449
|
* @param {string} [description=""] - Optional description.
|
|
22449
|
-
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional
|
|
22450
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional actor/database options.
|
|
22450
22451
|
* @return {void}
|
|
22451
22452
|
*/
|
|
22452
22453
|
static createMetaPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22453
22454
|
/**
|
|
22454
|
-
*
|
|
22455
|
+
* Creates a dedicated database service by composing a PostgresActor and a Cadenza service.
|
|
22455
22456
|
*/
|
|
22456
22457
|
static createDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22457
22458
|
/**
|
|
@@ -22464,6 +22465,9 @@ declare class CadenzaService {
|
|
|
22464
22465
|
* @return {void} - This method does not return a value.
|
|
22465
22466
|
*/
|
|
22466
22467
|
static createMetaDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22468
|
+
private static normalizePostgresActorOptions;
|
|
22469
|
+
private static normalizeDatabaseServiceOptions;
|
|
22470
|
+
private static registerDatabaseServiceBridgeTask;
|
|
22467
22471
|
static createActor<D extends Record<string, any> = AnyObject, R = AnyObject>(spec: ActorSpec<D, R>, options?: ActorFactoryOptions): Actor<D, R>;
|
|
22468
22472
|
static createActorFromDefinition<D extends Record<string, any> = AnyObject, R = AnyObject>(definition: ActorDefinition<D, R>, options?: ActorFactoryOptions<D, R>): Actor<D, R>;
|
|
22469
22473
|
/**
|
|
@@ -22758,14 +22762,14 @@ declare class CadenzaService {
|
|
|
22758
22762
|
*/
|
|
22759
22763
|
static createEphemeralTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions & EphemeralTaskOptions): EphemeralTask;
|
|
22760
22764
|
/**
|
|
22761
|
-
* Creates an ephemeral meta
|
|
22765
|
+
* Creates an ephemeral meta-task with the specified name, function, description, and options.
|
|
22762
22766
|
* See {@link createEphemeralTask} and {@link createMetaTask} for more details.
|
|
22763
22767
|
*
|
|
22764
22768
|
* @param {string} name - The name of the task to be created.
|
|
22765
22769
|
* @param {TaskFunction} func - The function to be executed as part of the task.
|
|
22766
22770
|
* @param {string} [description] - An optional description of the task.
|
|
22767
22771
|
* @param {TaskOptions & EphemeralTaskOptions} [options={}] - Additional options for configuring the task.
|
|
22768
|
-
* @return {EphemeralTask} The created ephemeral meta
|
|
22772
|
+
* @return {EphemeralTask} The created ephemeral meta-task.
|
|
22769
22773
|
*/
|
|
22770
22774
|
static createEphemeralMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions & EphemeralTaskOptions): EphemeralTask;
|
|
22771
22775
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -507,6 +507,7 @@ interface DatabaseOptions {
|
|
|
507
507
|
databaseType?: "postgres";
|
|
508
508
|
databaseName?: string;
|
|
509
509
|
poolSize?: number;
|
|
510
|
+
ownerServiceName?: string | null;
|
|
510
511
|
}
|
|
511
512
|
/**
|
|
512
513
|
* The CadenzaService class serves as a central service layer providing various utility methods for managing tasks, signals, logging, and service interactions.
|
|
@@ -22430,28 +22431,28 @@ declare class CadenzaService {
|
|
|
22430
22431
|
*/
|
|
22431
22432
|
static createCadenzaMetaService(serviceName: string, description: string, options?: ServerOptions): void;
|
|
22432
22433
|
/**
|
|
22433
|
-
* Creates and initializes a PostgresActor
|
|
22434
|
-
* This is
|
|
22434
|
+
* Creates and initializes a specialized PostgresActor.
|
|
22435
|
+
* This is actor-only and does not create or register a network service.
|
|
22435
22436
|
*
|
|
22436
|
-
* @param {string} name - Logical
|
|
22437
|
+
* @param {string} name - Logical PostgresActor name.
|
|
22437
22438
|
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22438
|
-
* @param {string} [description=""] - Optional human-readable description.
|
|
22439
|
-
* @param {ServerOptions & DatabaseOptions} [options={}] -
|
|
22439
|
+
* @param {string} [description=""] - Optional human-readable actor description.
|
|
22440
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Actor/database runtime options.
|
|
22440
22441
|
* @return {void}
|
|
22441
22442
|
*/
|
|
22442
22443
|
static createPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22443
22444
|
/**
|
|
22444
|
-
* Creates a meta PostgresActor
|
|
22445
|
+
* Creates a meta PostgresActor.
|
|
22445
22446
|
*
|
|
22446
|
-
* @param {string} name - Logical
|
|
22447
|
+
* @param {string} name - Logical PostgresActor name.
|
|
22447
22448
|
* @param {DatabaseSchemaDefinition} schema - Database schema definition.
|
|
22448
22449
|
* @param {string} [description=""] - Optional description.
|
|
22449
|
-
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional
|
|
22450
|
+
* @param {ServerOptions & DatabaseOptions} [options={}] - Optional actor/database options.
|
|
22450
22451
|
* @return {void}
|
|
22451
22452
|
*/
|
|
22452
22453
|
static createMetaPostgresActor(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22453
22454
|
/**
|
|
22454
|
-
*
|
|
22455
|
+
* Creates a dedicated database service by composing a PostgresActor and a Cadenza service.
|
|
22455
22456
|
*/
|
|
22456
22457
|
static createDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22457
22458
|
/**
|
|
@@ -22464,6 +22465,9 @@ declare class CadenzaService {
|
|
|
22464
22465
|
* @return {void} - This method does not return a value.
|
|
22465
22466
|
*/
|
|
22466
22467
|
static createMetaDatabaseService(name: string, schema: DatabaseSchemaDefinition, description?: string, options?: ServerOptions & DatabaseOptions): void;
|
|
22468
|
+
private static normalizePostgresActorOptions;
|
|
22469
|
+
private static normalizeDatabaseServiceOptions;
|
|
22470
|
+
private static registerDatabaseServiceBridgeTask;
|
|
22467
22471
|
static createActor<D extends Record<string, any> = AnyObject, R = AnyObject>(spec: ActorSpec<D, R>, options?: ActorFactoryOptions): Actor<D, R>;
|
|
22468
22472
|
static createActorFromDefinition<D extends Record<string, any> = AnyObject, R = AnyObject>(definition: ActorDefinition<D, R>, options?: ActorFactoryOptions<D, R>): Actor<D, R>;
|
|
22469
22473
|
/**
|
|
@@ -22758,14 +22762,14 @@ declare class CadenzaService {
|
|
|
22758
22762
|
*/
|
|
22759
22763
|
static createEphemeralTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions & EphemeralTaskOptions): EphemeralTask;
|
|
22760
22764
|
/**
|
|
22761
|
-
* Creates an ephemeral meta
|
|
22765
|
+
* Creates an ephemeral meta-task with the specified name, function, description, and options.
|
|
22762
22766
|
* See {@link createEphemeralTask} and {@link createMetaTask} for more details.
|
|
22763
22767
|
*
|
|
22764
22768
|
* @param {string} name - The name of the task to be created.
|
|
22765
22769
|
* @param {TaskFunction} func - The function to be executed as part of the task.
|
|
22766
22770
|
* @param {string} [description] - An optional description of the task.
|
|
22767
22771
|
* @param {TaskOptions & EphemeralTaskOptions} [options={}] - Additional options for configuring the task.
|
|
22768
|
-
* @return {EphemeralTask} The created ephemeral meta
|
|
22772
|
+
* @return {EphemeralTask} The created ephemeral meta-task.
|
|
22769
22773
|
*/
|
|
22770
22774
|
static createEphemeralMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions & EphemeralTaskOptions): EphemeralTask;
|
|
22771
22775
|
/**
|