@cadenza.io/service 2.17.28 → 2.17.30
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/browser/index.js +66 -54
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +25 -13
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +66 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -30,27 +30,27 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
Actor: () =>
|
|
33
|
+
Actor: () => import_core7.Actor,
|
|
34
34
|
DatabaseController: () => DatabaseController,
|
|
35
35
|
DatabaseTask: () => DatabaseTask,
|
|
36
|
-
DebounceTask: () =>
|
|
36
|
+
DebounceTask: () => import_core7.DebounceTask,
|
|
37
37
|
DeputyTask: () => DeputyTask,
|
|
38
|
-
EphemeralTask: () =>
|
|
38
|
+
EphemeralTask: () => import_core7.EphemeralTask,
|
|
39
39
|
GraphMetadataController: () => GraphMetadataController,
|
|
40
|
-
GraphRoutine: () =>
|
|
40
|
+
GraphRoutine: () => import_core7.GraphRoutine,
|
|
41
41
|
RestController: () => RestController,
|
|
42
42
|
ServiceRegistry: () => ServiceRegistry,
|
|
43
43
|
SignalController: () => SignalController,
|
|
44
44
|
SignalTransmissionTask: () => SignalTransmissionTask,
|
|
45
45
|
SocketController: () => SocketController,
|
|
46
|
-
Task: () =>
|
|
46
|
+
Task: () => import_core7.Task,
|
|
47
47
|
createSSRInquiryBridge: () => createSSRInquiryBridge,
|
|
48
48
|
default: () => index_default
|
|
49
49
|
});
|
|
50
50
|
module.exports = __toCommonJS(index_exports);
|
|
51
51
|
|
|
52
52
|
// src/Cadenza.ts
|
|
53
|
-
var
|
|
53
|
+
var import_core6 = __toESM(require("@cadenza.io/core"));
|
|
54
54
|
|
|
55
55
|
// src/graph/definition/DeputyTask.ts
|
|
56
56
|
var import_uuid = require("uuid");
|
|
@@ -299,6 +299,9 @@ var DatabaseTask = class extends DeputyTask {
|
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
301
|
|
|
302
|
+
// src/registry/ServiceRegistry.ts
|
|
303
|
+
var import_core2 = require("@cadenza.io/core");
|
|
304
|
+
|
|
302
305
|
// src/utils/environment.ts
|
|
303
306
|
var isNode = typeof process !== "undefined" && process.versions?.node != null;
|
|
304
307
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
@@ -828,11 +831,15 @@ function resolveServiceRegistryInsertTask(tableName, queryData = {}, options = {
|
|
|
828
831
|
delegationContext.__metadata.__skipRemoteExecution = delegationContext.__metadata.__skipRemoteExecution ?? delegationContext.__skipRemoteExecution ?? false;
|
|
829
832
|
delegationContext.__metadata.__blockRemoteExecution = delegationContext.__metadata.__blockRemoteExecution ?? delegationContext.__blockRemoteExecution ?? false;
|
|
830
833
|
return Promise.resolve(
|
|
831
|
-
targetTask.
|
|
832
|
-
delegationContext,
|
|
834
|
+
targetTask.execute(
|
|
835
|
+
new import_core2.GraphContext(delegationContext),
|
|
833
836
|
emit,
|
|
834
837
|
inquire,
|
|
835
|
-
progressCallback
|
|
838
|
+
progressCallback,
|
|
839
|
+
{
|
|
840
|
+
nodeId: delegationContext.__previousTaskExecutionId ?? delegationContext.__metadata?.__previousTaskExecutionId ?? `service-registry-${tableName}`,
|
|
841
|
+
routineExecId: delegationContext.__routineExecId ?? delegationContext.__metadata?.__routineExecId ?? delegationContext.__metadata?.__localRoutineExecId ?? "service-registry"
|
|
842
|
+
}
|
|
836
843
|
)
|
|
837
844
|
).then(
|
|
838
845
|
(result) => normalizeServiceRegistryInsertResult(
|
|
@@ -3425,9 +3432,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
3425
3432
|
};
|
|
3426
3433
|
|
|
3427
3434
|
// src/graph/definition/SignalTransmissionTask.ts
|
|
3428
|
-
var
|
|
3435
|
+
var import_core3 = require("@cadenza.io/core");
|
|
3429
3436
|
var import_uuid3 = require("uuid");
|
|
3430
|
-
var SignalTransmissionTask = class extends
|
|
3437
|
+
var SignalTransmissionTask = class extends import_core3.Task {
|
|
3431
3438
|
/**
|
|
3432
3439
|
* Constructs a new instance of the class and initializes it with the provided parameters.
|
|
3433
3440
|
*
|
|
@@ -5474,7 +5481,7 @@ var SignalController = class _SignalController {
|
|
|
5474
5481
|
};
|
|
5475
5482
|
|
|
5476
5483
|
// src/graph/controllers/registerActorSessionPersistence.ts
|
|
5477
|
-
var
|
|
5484
|
+
var import_core4 = require("@cadenza.io/core");
|
|
5478
5485
|
function registerActorSessionPersistenceTasks() {
|
|
5479
5486
|
if (CadenzaService.get("Persist actor session state")) {
|
|
5480
5487
|
return;
|
|
@@ -5595,7 +5602,7 @@ function registerActorSessionPersistenceTasks() {
|
|
|
5595
5602
|
},
|
|
5596
5603
|
"Validates and prepares actor_session_state payload for strict write-through persistence.",
|
|
5597
5604
|
{ isSubMeta: true, concurrency: 100 }
|
|
5598
|
-
).then(insertAndValidateActorSessionStateTask).respondsTo(
|
|
5605
|
+
).then(insertAndValidateActorSessionStateTask).respondsTo(import_core4.META_ACTOR_SESSION_STATE_PERSIST_INTENT);
|
|
5599
5606
|
}
|
|
5600
5607
|
|
|
5601
5608
|
// src/graph/controllers/GraphMetadataController.ts
|
|
@@ -5882,6 +5889,7 @@ var DatabaseController = class _DatabaseController {
|
|
|
5882
5889
|
var import_uuid4 = require("uuid");
|
|
5883
5890
|
|
|
5884
5891
|
// src/graph/controllers/GraphSyncController.ts
|
|
5892
|
+
var import_core5 = require("@cadenza.io/core");
|
|
5885
5893
|
var ACTOR_TASK_METADATA = /* @__PURE__ */ Symbol.for("@cadenza.io/core/actor-task-meta");
|
|
5886
5894
|
function getActorTaskRuntimeMetadata(taskFunction) {
|
|
5887
5895
|
if (typeof taskFunction !== "function") {
|
|
@@ -6019,17 +6027,21 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6019
6027
|
if (!targetTask) {
|
|
6020
6028
|
return false;
|
|
6021
6029
|
}
|
|
6022
|
-
return targetTask.
|
|
6023
|
-
{
|
|
6030
|
+
return targetTask.execute(
|
|
6031
|
+
new import_core5.GraphContext({
|
|
6024
6032
|
...ctx,
|
|
6025
6033
|
queryData: buildSyncInsertQueryData(
|
|
6026
6034
|
ctx,
|
|
6027
6035
|
queryData
|
|
6028
6036
|
)
|
|
6029
|
-
},
|
|
6037
|
+
}),
|
|
6030
6038
|
emit,
|
|
6031
6039
|
inquire,
|
|
6032
|
-
progressCallback
|
|
6040
|
+
progressCallback,
|
|
6041
|
+
{
|
|
6042
|
+
nodeId: ctx.__previousTaskExecutionId ?? ctx.__metadata?.__previousTaskExecutionId ?? `graph-sync-${tableName}`,
|
|
6043
|
+
routineExecId: ctx.__routineExecId ?? ctx.__metadata?.__routineExecId ?? ctx.__metadata?.__localRoutineExecId ?? "graph-sync"
|
|
6044
|
+
}
|
|
6033
6045
|
);
|
|
6034
6046
|
},
|
|
6035
6047
|
`Routes graph sync inserts for ${tableName} through the local authority task when available.`,
|
|
@@ -7333,12 +7345,12 @@ var CadenzaService = class {
|
|
|
7333
7345
|
static bootstrap() {
|
|
7334
7346
|
if (this.isBootstrapped) return;
|
|
7335
7347
|
this.isBootstrapped = true;
|
|
7336
|
-
|
|
7337
|
-
this.signalBroker =
|
|
7338
|
-
this.inquiryBroker =
|
|
7339
|
-
this.runner =
|
|
7340
|
-
this.metaRunner =
|
|
7341
|
-
this.registry =
|
|
7348
|
+
import_core6.default.bootstrap();
|
|
7349
|
+
this.signalBroker = import_core6.default.signalBroker;
|
|
7350
|
+
this.inquiryBroker = import_core6.default.inquiryBroker;
|
|
7351
|
+
this.runner = import_core6.default.runner;
|
|
7352
|
+
this.metaRunner = import_core6.default.metaRunner;
|
|
7353
|
+
this.registry = import_core6.default.registry;
|
|
7342
7354
|
this.serviceRegistry = ServiceRegistry.instance;
|
|
7343
7355
|
RestController.instance;
|
|
7344
7356
|
SocketController.instance;
|
|
@@ -7372,8 +7384,8 @@ var CadenzaService = class {
|
|
|
7372
7384
|
return;
|
|
7373
7385
|
}
|
|
7374
7386
|
this.frontendSyncScheduled = true;
|
|
7375
|
-
|
|
7376
|
-
|
|
7387
|
+
import_core6.default.interval("meta.sync_requested", { __syncing: false }, 18e4);
|
|
7388
|
+
import_core6.default.schedule("meta.sync_requested", { __syncing: false }, 250);
|
|
7377
7389
|
}
|
|
7378
7390
|
static normalizeDeclaredTransports(transports, serviceId) {
|
|
7379
7391
|
return (transports ?? []).map((transport) => normalizeServiceTransportConfig(transport)).filter(
|
|
@@ -7430,7 +7442,7 @@ var CadenzaService = class {
|
|
|
7430
7442
|
* @return {void} Does not return any value.
|
|
7431
7443
|
*/
|
|
7432
7444
|
static validateName(name) {
|
|
7433
|
-
|
|
7445
|
+
import_core6.default.validateName(name);
|
|
7434
7446
|
}
|
|
7435
7447
|
/**
|
|
7436
7448
|
* Gets the current run strategy from the Cadenza configuration.
|
|
@@ -7438,7 +7450,7 @@ var CadenzaService = class {
|
|
|
7438
7450
|
* @return {Function} The run strategy function defined in the Cadenza configuration.
|
|
7439
7451
|
*/
|
|
7440
7452
|
static get runStrategy() {
|
|
7441
|
-
return
|
|
7453
|
+
return import_core6.default.runStrategy;
|
|
7442
7454
|
}
|
|
7443
7455
|
/**
|
|
7444
7456
|
* Sets the mode for the Cadenza application.
|
|
@@ -7447,7 +7459,7 @@ var CadenzaService = class {
|
|
|
7447
7459
|
* @return {void} This method does not return a value.
|
|
7448
7460
|
*/
|
|
7449
7461
|
static setMode(mode) {
|
|
7450
|
-
|
|
7462
|
+
import_core6.default.setMode(mode);
|
|
7451
7463
|
}
|
|
7452
7464
|
/**
|
|
7453
7465
|
* Emits a signal with the specified data using the associated broker.
|
|
@@ -7465,16 +7477,16 @@ var CadenzaService = class {
|
|
|
7465
7477
|
* ```
|
|
7466
7478
|
*/
|
|
7467
7479
|
static emit(signal, data = {}, options = {}) {
|
|
7468
|
-
|
|
7480
|
+
import_core6.default.emit(signal, data, options);
|
|
7469
7481
|
}
|
|
7470
7482
|
static debounce(signal, context = {}, delayMs = 500) {
|
|
7471
|
-
|
|
7483
|
+
import_core6.default.debounce(signal, context, delayMs);
|
|
7472
7484
|
}
|
|
7473
7485
|
static schedule(signal, context, timeoutMs, exactDateTime) {
|
|
7474
|
-
|
|
7486
|
+
import_core6.default.schedule(signal, context, timeoutMs, exactDateTime);
|
|
7475
7487
|
}
|
|
7476
7488
|
static interval(signal, context, intervalMs, leading = false, startDateTime) {
|
|
7477
|
-
|
|
7489
|
+
import_core6.default.interval(signal, context, intervalMs, leading, startDateTime);
|
|
7478
7490
|
}
|
|
7479
7491
|
static defineIntent(intent) {
|
|
7480
7492
|
this.inquiryBroker?.addIntent(intent);
|
|
@@ -7736,7 +7748,7 @@ var CadenzaService = class {
|
|
|
7736
7748
|
});
|
|
7737
7749
|
}
|
|
7738
7750
|
static get(taskName) {
|
|
7739
|
-
return
|
|
7751
|
+
return import_core6.default.get(taskName);
|
|
7740
7752
|
}
|
|
7741
7753
|
static getLocalCadenzaDBTask(tableName, operation) {
|
|
7742
7754
|
const generatedTaskName = this.buildGeneratedLocalCadenzaDBTaskName(
|
|
@@ -7747,7 +7759,7 @@ var CadenzaService = class {
|
|
|
7747
7759
|
tableName,
|
|
7748
7760
|
operation
|
|
7749
7761
|
);
|
|
7750
|
-
return
|
|
7762
|
+
return import_core6.default.get(generatedTaskName) ?? import_core6.default.get(legacyTaskName);
|
|
7751
7763
|
}
|
|
7752
7764
|
static getLocalCadenzaDBInsertTask(tableName) {
|
|
7753
7765
|
return this.getLocalCadenzaDBTask(tableName, "insert");
|
|
@@ -7756,15 +7768,15 @@ var CadenzaService = class {
|
|
|
7756
7768
|
return this.getLocalCadenzaDBTask(tableName, "query");
|
|
7757
7769
|
}
|
|
7758
7770
|
static getActor(actorName) {
|
|
7759
|
-
const cadenzaWithActors =
|
|
7771
|
+
const cadenzaWithActors = import_core6.default;
|
|
7760
7772
|
return cadenzaWithActors.getActor?.(actorName);
|
|
7761
7773
|
}
|
|
7762
7774
|
static getAllActors() {
|
|
7763
|
-
const cadenzaWithActors =
|
|
7775
|
+
const cadenzaWithActors = import_core6.default;
|
|
7764
7776
|
return cadenzaWithActors.getAllActors?.() ?? [];
|
|
7765
7777
|
}
|
|
7766
7778
|
static getRoutine(routineName) {
|
|
7767
|
-
return
|
|
7779
|
+
return import_core6.default.getRoutine(routineName);
|
|
7768
7780
|
}
|
|
7769
7781
|
/**
|
|
7770
7782
|
* Creates a new DeputyTask instance based on the provided routine name, service name, and options.
|
|
@@ -8292,7 +8304,7 @@ var CadenzaService = class {
|
|
|
8292
8304
|
return true;
|
|
8293
8305
|
}).doOn("meta.service_registry.instance_inserted");
|
|
8294
8306
|
if (!options.cadenzaDB?.connect && isFrontend) {
|
|
8295
|
-
|
|
8307
|
+
import_core6.default.schedule(
|
|
8296
8308
|
"meta.service_registry.instance_registration_requested",
|
|
8297
8309
|
{
|
|
8298
8310
|
data: {
|
|
@@ -8553,11 +8565,11 @@ var CadenzaService = class {
|
|
|
8553
8565
|
}
|
|
8554
8566
|
static createActor(spec, options = {}) {
|
|
8555
8567
|
this.bootstrap();
|
|
8556
|
-
return
|
|
8568
|
+
return import_core6.default.createActor(spec, options);
|
|
8557
8569
|
}
|
|
8558
8570
|
static createActorFromDefinition(definition, options = {}) {
|
|
8559
8571
|
this.bootstrap();
|
|
8560
|
-
return
|
|
8572
|
+
return import_core6.default.createActorFromDefinition(definition, options);
|
|
8561
8573
|
}
|
|
8562
8574
|
/**
|
|
8563
8575
|
* Creates and registers a new task with the provided name, function, and optional details.
|
|
@@ -8631,7 +8643,7 @@ var CadenzaService = class {
|
|
|
8631
8643
|
*/
|
|
8632
8644
|
static createTask(name, func, description, options = {}) {
|
|
8633
8645
|
this.bootstrap();
|
|
8634
|
-
return
|
|
8646
|
+
return import_core6.default.createTask(name, func, description, options);
|
|
8635
8647
|
}
|
|
8636
8648
|
/**
|
|
8637
8649
|
* Creates a meta task with the specified name, functionality, description, and options.
|
|
@@ -8647,7 +8659,7 @@ var CadenzaService = class {
|
|
|
8647
8659
|
*/
|
|
8648
8660
|
static createMetaTask(name, func, description, options = {}) {
|
|
8649
8661
|
this.bootstrap();
|
|
8650
|
-
return
|
|
8662
|
+
return import_core6.default.createMetaTask(name, func, description, options);
|
|
8651
8663
|
}
|
|
8652
8664
|
/**
|
|
8653
8665
|
* Creates a unique task by wrapping the provided task function with a uniqueness constraint.
|
|
@@ -8697,7 +8709,7 @@ var CadenzaService = class {
|
|
|
8697
8709
|
*/
|
|
8698
8710
|
static createUniqueTask(name, func, description, options = {}) {
|
|
8699
8711
|
this.bootstrap();
|
|
8700
|
-
return
|
|
8712
|
+
return import_core6.default.createUniqueTask(name, func, description, options);
|
|
8701
8713
|
}
|
|
8702
8714
|
/**
|
|
8703
8715
|
* Creates a unique meta task with the specified name, function, description, and options.
|
|
@@ -8711,7 +8723,7 @@ var CadenzaService = class {
|
|
|
8711
8723
|
*/
|
|
8712
8724
|
static createUniqueMetaTask(name, func, description, options = {}) {
|
|
8713
8725
|
this.bootstrap();
|
|
8714
|
-
return
|
|
8726
|
+
return import_core6.default.createUniqueMetaTask(name, func, description, options);
|
|
8715
8727
|
}
|
|
8716
8728
|
/**
|
|
8717
8729
|
* Creates a throttled task with a concurrency limit of 1, ensuring that only one instance of the task can run at a time for a specific throttle tag.
|
|
@@ -8744,7 +8756,7 @@ var CadenzaService = class {
|
|
|
8744
8756
|
*/
|
|
8745
8757
|
static createThrottledTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
8746
8758
|
this.bootstrap();
|
|
8747
|
-
return
|
|
8759
|
+
return import_core6.default.createThrottledTask(
|
|
8748
8760
|
name,
|
|
8749
8761
|
func,
|
|
8750
8762
|
throttledIdGetter,
|
|
@@ -8765,7 +8777,7 @@ var CadenzaService = class {
|
|
|
8765
8777
|
*/
|
|
8766
8778
|
static createThrottledMetaTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
8767
8779
|
this.bootstrap();
|
|
8768
|
-
return
|
|
8780
|
+
return import_core6.default.createThrottledMetaTask(
|
|
8769
8781
|
name,
|
|
8770
8782
|
func,
|
|
8771
8783
|
throttledIdGetter,
|
|
@@ -8808,7 +8820,7 @@ var CadenzaService = class {
|
|
|
8808
8820
|
*/
|
|
8809
8821
|
static createDebounceTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
8810
8822
|
this.bootstrap();
|
|
8811
|
-
return
|
|
8823
|
+
return import_core6.default.createDebounceTask(
|
|
8812
8824
|
name,
|
|
8813
8825
|
func,
|
|
8814
8826
|
description,
|
|
@@ -8829,7 +8841,7 @@ var CadenzaService = class {
|
|
|
8829
8841
|
*/
|
|
8830
8842
|
static createDebounceMetaTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
8831
8843
|
this.bootstrap();
|
|
8832
|
-
return
|
|
8844
|
+
return import_core6.default.createDebounceMetaTask(
|
|
8833
8845
|
name,
|
|
8834
8846
|
func,
|
|
8835
8847
|
description,
|
|
@@ -8899,7 +8911,7 @@ var CadenzaService = class {
|
|
|
8899
8911
|
*/
|
|
8900
8912
|
static createEphemeralTask(name, func, description, options = {}) {
|
|
8901
8913
|
this.bootstrap();
|
|
8902
|
-
return
|
|
8914
|
+
return import_core6.default.createEphemeralTask(name, func, description, options);
|
|
8903
8915
|
}
|
|
8904
8916
|
/**
|
|
8905
8917
|
* Creates an ephemeral meta-task with the specified name, function, description, and options.
|
|
@@ -8913,7 +8925,7 @@ var CadenzaService = class {
|
|
|
8913
8925
|
*/
|
|
8914
8926
|
static createEphemeralMetaTask(name, func, description, options = {}) {
|
|
8915
8927
|
this.bootstrap();
|
|
8916
|
-
return
|
|
8928
|
+
return import_core6.default.createEphemeralMetaTask(name, func, description, options);
|
|
8917
8929
|
}
|
|
8918
8930
|
/**
|
|
8919
8931
|
* Creates a new routine with the specified name, tasks, and an optional description.
|
|
@@ -8945,7 +8957,7 @@ var CadenzaService = class {
|
|
|
8945
8957
|
*/
|
|
8946
8958
|
static createRoutine(name, tasks, description = "") {
|
|
8947
8959
|
this.bootstrap();
|
|
8948
|
-
return
|
|
8960
|
+
return import_core6.default.createRoutine(name, tasks, description);
|
|
8949
8961
|
}
|
|
8950
8962
|
/**
|
|
8951
8963
|
* Creates a meta routine with a given name, tasks, and optional description.
|
|
@@ -8960,10 +8972,10 @@ var CadenzaService = class {
|
|
|
8960
8972
|
*/
|
|
8961
8973
|
static createMetaRoutine(name, tasks, description = "") {
|
|
8962
8974
|
this.bootstrap();
|
|
8963
|
-
return
|
|
8975
|
+
return import_core6.default.createMetaRoutine(name, tasks, description);
|
|
8964
8976
|
}
|
|
8965
8977
|
static reset() {
|
|
8966
|
-
|
|
8978
|
+
import_core6.default.reset();
|
|
8967
8979
|
this.serviceRegistry?.reset();
|
|
8968
8980
|
this.isBootstrapped = false;
|
|
8969
8981
|
this.serviceCreated = false;
|
|
@@ -8981,7 +8993,7 @@ CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
|
|
|
8981
8993
|
CadenzaService.frontendSyncScheduled = false;
|
|
8982
8994
|
|
|
8983
8995
|
// src/index.ts
|
|
8984
|
-
var
|
|
8996
|
+
var import_core7 = require("@cadenza.io/core");
|
|
8985
8997
|
|
|
8986
8998
|
// src/ssr/createSSRInquiryBridge.ts
|
|
8987
8999
|
var import_uuid5 = require("uuid");
|