@cadenza.io/service 2.17.29 → 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 +59 -52
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +18 -11
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +59 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -11
- 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,7 +5889,7 @@ var DatabaseController = class _DatabaseController {
|
|
|
5882
5889
|
var import_uuid4 = require("uuid");
|
|
5883
5890
|
|
|
5884
5891
|
// src/graph/controllers/GraphSyncController.ts
|
|
5885
|
-
var
|
|
5892
|
+
var import_core5 = require("@cadenza.io/core");
|
|
5886
5893
|
var ACTOR_TASK_METADATA = /* @__PURE__ */ Symbol.for("@cadenza.io/core/actor-task-meta");
|
|
5887
5894
|
function getActorTaskRuntimeMetadata(taskFunction) {
|
|
5888
5895
|
if (typeof taskFunction !== "function") {
|
|
@@ -6021,7 +6028,7 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6021
6028
|
return false;
|
|
6022
6029
|
}
|
|
6023
6030
|
return targetTask.execute(
|
|
6024
|
-
new
|
|
6031
|
+
new import_core5.GraphContext({
|
|
6025
6032
|
...ctx,
|
|
6026
6033
|
queryData: buildSyncInsertQueryData(
|
|
6027
6034
|
ctx,
|
|
@@ -7338,12 +7345,12 @@ var CadenzaService = class {
|
|
|
7338
7345
|
static bootstrap() {
|
|
7339
7346
|
if (this.isBootstrapped) return;
|
|
7340
7347
|
this.isBootstrapped = true;
|
|
7341
|
-
|
|
7342
|
-
this.signalBroker =
|
|
7343
|
-
this.inquiryBroker =
|
|
7344
|
-
this.runner =
|
|
7345
|
-
this.metaRunner =
|
|
7346
|
-
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;
|
|
7347
7354
|
this.serviceRegistry = ServiceRegistry.instance;
|
|
7348
7355
|
RestController.instance;
|
|
7349
7356
|
SocketController.instance;
|
|
@@ -7377,8 +7384,8 @@ var CadenzaService = class {
|
|
|
7377
7384
|
return;
|
|
7378
7385
|
}
|
|
7379
7386
|
this.frontendSyncScheduled = true;
|
|
7380
|
-
|
|
7381
|
-
|
|
7387
|
+
import_core6.default.interval("meta.sync_requested", { __syncing: false }, 18e4);
|
|
7388
|
+
import_core6.default.schedule("meta.sync_requested", { __syncing: false }, 250);
|
|
7382
7389
|
}
|
|
7383
7390
|
static normalizeDeclaredTransports(transports, serviceId) {
|
|
7384
7391
|
return (transports ?? []).map((transport) => normalizeServiceTransportConfig(transport)).filter(
|
|
@@ -7435,7 +7442,7 @@ var CadenzaService = class {
|
|
|
7435
7442
|
* @return {void} Does not return any value.
|
|
7436
7443
|
*/
|
|
7437
7444
|
static validateName(name) {
|
|
7438
|
-
|
|
7445
|
+
import_core6.default.validateName(name);
|
|
7439
7446
|
}
|
|
7440
7447
|
/**
|
|
7441
7448
|
* Gets the current run strategy from the Cadenza configuration.
|
|
@@ -7443,7 +7450,7 @@ var CadenzaService = class {
|
|
|
7443
7450
|
* @return {Function} The run strategy function defined in the Cadenza configuration.
|
|
7444
7451
|
*/
|
|
7445
7452
|
static get runStrategy() {
|
|
7446
|
-
return
|
|
7453
|
+
return import_core6.default.runStrategy;
|
|
7447
7454
|
}
|
|
7448
7455
|
/**
|
|
7449
7456
|
* Sets the mode for the Cadenza application.
|
|
@@ -7452,7 +7459,7 @@ var CadenzaService = class {
|
|
|
7452
7459
|
* @return {void} This method does not return a value.
|
|
7453
7460
|
*/
|
|
7454
7461
|
static setMode(mode) {
|
|
7455
|
-
|
|
7462
|
+
import_core6.default.setMode(mode);
|
|
7456
7463
|
}
|
|
7457
7464
|
/**
|
|
7458
7465
|
* Emits a signal with the specified data using the associated broker.
|
|
@@ -7470,16 +7477,16 @@ var CadenzaService = class {
|
|
|
7470
7477
|
* ```
|
|
7471
7478
|
*/
|
|
7472
7479
|
static emit(signal, data = {}, options = {}) {
|
|
7473
|
-
|
|
7480
|
+
import_core6.default.emit(signal, data, options);
|
|
7474
7481
|
}
|
|
7475
7482
|
static debounce(signal, context = {}, delayMs = 500) {
|
|
7476
|
-
|
|
7483
|
+
import_core6.default.debounce(signal, context, delayMs);
|
|
7477
7484
|
}
|
|
7478
7485
|
static schedule(signal, context, timeoutMs, exactDateTime) {
|
|
7479
|
-
|
|
7486
|
+
import_core6.default.schedule(signal, context, timeoutMs, exactDateTime);
|
|
7480
7487
|
}
|
|
7481
7488
|
static interval(signal, context, intervalMs, leading = false, startDateTime) {
|
|
7482
|
-
|
|
7489
|
+
import_core6.default.interval(signal, context, intervalMs, leading, startDateTime);
|
|
7483
7490
|
}
|
|
7484
7491
|
static defineIntent(intent) {
|
|
7485
7492
|
this.inquiryBroker?.addIntent(intent);
|
|
@@ -7741,7 +7748,7 @@ var CadenzaService = class {
|
|
|
7741
7748
|
});
|
|
7742
7749
|
}
|
|
7743
7750
|
static get(taskName) {
|
|
7744
|
-
return
|
|
7751
|
+
return import_core6.default.get(taskName);
|
|
7745
7752
|
}
|
|
7746
7753
|
static getLocalCadenzaDBTask(tableName, operation) {
|
|
7747
7754
|
const generatedTaskName = this.buildGeneratedLocalCadenzaDBTaskName(
|
|
@@ -7752,7 +7759,7 @@ var CadenzaService = class {
|
|
|
7752
7759
|
tableName,
|
|
7753
7760
|
operation
|
|
7754
7761
|
);
|
|
7755
|
-
return
|
|
7762
|
+
return import_core6.default.get(generatedTaskName) ?? import_core6.default.get(legacyTaskName);
|
|
7756
7763
|
}
|
|
7757
7764
|
static getLocalCadenzaDBInsertTask(tableName) {
|
|
7758
7765
|
return this.getLocalCadenzaDBTask(tableName, "insert");
|
|
@@ -7761,15 +7768,15 @@ var CadenzaService = class {
|
|
|
7761
7768
|
return this.getLocalCadenzaDBTask(tableName, "query");
|
|
7762
7769
|
}
|
|
7763
7770
|
static getActor(actorName) {
|
|
7764
|
-
const cadenzaWithActors =
|
|
7771
|
+
const cadenzaWithActors = import_core6.default;
|
|
7765
7772
|
return cadenzaWithActors.getActor?.(actorName);
|
|
7766
7773
|
}
|
|
7767
7774
|
static getAllActors() {
|
|
7768
|
-
const cadenzaWithActors =
|
|
7775
|
+
const cadenzaWithActors = import_core6.default;
|
|
7769
7776
|
return cadenzaWithActors.getAllActors?.() ?? [];
|
|
7770
7777
|
}
|
|
7771
7778
|
static getRoutine(routineName) {
|
|
7772
|
-
return
|
|
7779
|
+
return import_core6.default.getRoutine(routineName);
|
|
7773
7780
|
}
|
|
7774
7781
|
/**
|
|
7775
7782
|
* Creates a new DeputyTask instance based on the provided routine name, service name, and options.
|
|
@@ -8297,7 +8304,7 @@ var CadenzaService = class {
|
|
|
8297
8304
|
return true;
|
|
8298
8305
|
}).doOn("meta.service_registry.instance_inserted");
|
|
8299
8306
|
if (!options.cadenzaDB?.connect && isFrontend) {
|
|
8300
|
-
|
|
8307
|
+
import_core6.default.schedule(
|
|
8301
8308
|
"meta.service_registry.instance_registration_requested",
|
|
8302
8309
|
{
|
|
8303
8310
|
data: {
|
|
@@ -8558,11 +8565,11 @@ var CadenzaService = class {
|
|
|
8558
8565
|
}
|
|
8559
8566
|
static createActor(spec, options = {}) {
|
|
8560
8567
|
this.bootstrap();
|
|
8561
|
-
return
|
|
8568
|
+
return import_core6.default.createActor(spec, options);
|
|
8562
8569
|
}
|
|
8563
8570
|
static createActorFromDefinition(definition, options = {}) {
|
|
8564
8571
|
this.bootstrap();
|
|
8565
|
-
return
|
|
8572
|
+
return import_core6.default.createActorFromDefinition(definition, options);
|
|
8566
8573
|
}
|
|
8567
8574
|
/**
|
|
8568
8575
|
* Creates and registers a new task with the provided name, function, and optional details.
|
|
@@ -8636,7 +8643,7 @@ var CadenzaService = class {
|
|
|
8636
8643
|
*/
|
|
8637
8644
|
static createTask(name, func, description, options = {}) {
|
|
8638
8645
|
this.bootstrap();
|
|
8639
|
-
return
|
|
8646
|
+
return import_core6.default.createTask(name, func, description, options);
|
|
8640
8647
|
}
|
|
8641
8648
|
/**
|
|
8642
8649
|
* Creates a meta task with the specified name, functionality, description, and options.
|
|
@@ -8652,7 +8659,7 @@ var CadenzaService = class {
|
|
|
8652
8659
|
*/
|
|
8653
8660
|
static createMetaTask(name, func, description, options = {}) {
|
|
8654
8661
|
this.bootstrap();
|
|
8655
|
-
return
|
|
8662
|
+
return import_core6.default.createMetaTask(name, func, description, options);
|
|
8656
8663
|
}
|
|
8657
8664
|
/**
|
|
8658
8665
|
* Creates a unique task by wrapping the provided task function with a uniqueness constraint.
|
|
@@ -8702,7 +8709,7 @@ var CadenzaService = class {
|
|
|
8702
8709
|
*/
|
|
8703
8710
|
static createUniqueTask(name, func, description, options = {}) {
|
|
8704
8711
|
this.bootstrap();
|
|
8705
|
-
return
|
|
8712
|
+
return import_core6.default.createUniqueTask(name, func, description, options);
|
|
8706
8713
|
}
|
|
8707
8714
|
/**
|
|
8708
8715
|
* Creates a unique meta task with the specified name, function, description, and options.
|
|
@@ -8716,7 +8723,7 @@ var CadenzaService = class {
|
|
|
8716
8723
|
*/
|
|
8717
8724
|
static createUniqueMetaTask(name, func, description, options = {}) {
|
|
8718
8725
|
this.bootstrap();
|
|
8719
|
-
return
|
|
8726
|
+
return import_core6.default.createUniqueMetaTask(name, func, description, options);
|
|
8720
8727
|
}
|
|
8721
8728
|
/**
|
|
8722
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.
|
|
@@ -8749,7 +8756,7 @@ var CadenzaService = class {
|
|
|
8749
8756
|
*/
|
|
8750
8757
|
static createThrottledTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
8751
8758
|
this.bootstrap();
|
|
8752
|
-
return
|
|
8759
|
+
return import_core6.default.createThrottledTask(
|
|
8753
8760
|
name,
|
|
8754
8761
|
func,
|
|
8755
8762
|
throttledIdGetter,
|
|
@@ -8770,7 +8777,7 @@ var CadenzaService = class {
|
|
|
8770
8777
|
*/
|
|
8771
8778
|
static createThrottledMetaTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
8772
8779
|
this.bootstrap();
|
|
8773
|
-
return
|
|
8780
|
+
return import_core6.default.createThrottledMetaTask(
|
|
8774
8781
|
name,
|
|
8775
8782
|
func,
|
|
8776
8783
|
throttledIdGetter,
|
|
@@ -8813,7 +8820,7 @@ var CadenzaService = class {
|
|
|
8813
8820
|
*/
|
|
8814
8821
|
static createDebounceTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
8815
8822
|
this.bootstrap();
|
|
8816
|
-
return
|
|
8823
|
+
return import_core6.default.createDebounceTask(
|
|
8817
8824
|
name,
|
|
8818
8825
|
func,
|
|
8819
8826
|
description,
|
|
@@ -8834,7 +8841,7 @@ var CadenzaService = class {
|
|
|
8834
8841
|
*/
|
|
8835
8842
|
static createDebounceMetaTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
8836
8843
|
this.bootstrap();
|
|
8837
|
-
return
|
|
8844
|
+
return import_core6.default.createDebounceMetaTask(
|
|
8838
8845
|
name,
|
|
8839
8846
|
func,
|
|
8840
8847
|
description,
|
|
@@ -8904,7 +8911,7 @@ var CadenzaService = class {
|
|
|
8904
8911
|
*/
|
|
8905
8912
|
static createEphemeralTask(name, func, description, options = {}) {
|
|
8906
8913
|
this.bootstrap();
|
|
8907
|
-
return
|
|
8914
|
+
return import_core6.default.createEphemeralTask(name, func, description, options);
|
|
8908
8915
|
}
|
|
8909
8916
|
/**
|
|
8910
8917
|
* Creates an ephemeral meta-task with the specified name, function, description, and options.
|
|
@@ -8918,7 +8925,7 @@ var CadenzaService = class {
|
|
|
8918
8925
|
*/
|
|
8919
8926
|
static createEphemeralMetaTask(name, func, description, options = {}) {
|
|
8920
8927
|
this.bootstrap();
|
|
8921
|
-
return
|
|
8928
|
+
return import_core6.default.createEphemeralMetaTask(name, func, description, options);
|
|
8922
8929
|
}
|
|
8923
8930
|
/**
|
|
8924
8931
|
* Creates a new routine with the specified name, tasks, and an optional description.
|
|
@@ -8950,7 +8957,7 @@ var CadenzaService = class {
|
|
|
8950
8957
|
*/
|
|
8951
8958
|
static createRoutine(name, tasks, description = "") {
|
|
8952
8959
|
this.bootstrap();
|
|
8953
|
-
return
|
|
8960
|
+
return import_core6.default.createRoutine(name, tasks, description);
|
|
8954
8961
|
}
|
|
8955
8962
|
/**
|
|
8956
8963
|
* Creates a meta routine with a given name, tasks, and optional description.
|
|
@@ -8965,10 +8972,10 @@ var CadenzaService = class {
|
|
|
8965
8972
|
*/
|
|
8966
8973
|
static createMetaRoutine(name, tasks, description = "") {
|
|
8967
8974
|
this.bootstrap();
|
|
8968
|
-
return
|
|
8975
|
+
return import_core6.default.createMetaRoutine(name, tasks, description);
|
|
8969
8976
|
}
|
|
8970
8977
|
static reset() {
|
|
8971
|
-
|
|
8978
|
+
import_core6.default.reset();
|
|
8972
8979
|
this.serviceRegistry?.reset();
|
|
8973
8980
|
this.isBootstrapped = false;
|
|
8974
8981
|
this.serviceCreated = false;
|
|
@@ -8986,7 +8993,7 @@ CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
|
|
|
8986
8993
|
CadenzaService.frontendSyncScheduled = false;
|
|
8987
8994
|
|
|
8988
8995
|
// src/index.ts
|
|
8989
|
-
var
|
|
8996
|
+
var import_core7 = require("@cadenza.io/core");
|
|
8990
8997
|
|
|
8991
8998
|
// src/ssr/createSSRInquiryBridge.ts
|
|
8992
8999
|
var import_uuid5 = require("uuid");
|