@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/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
|
*
|
|
@@ -5934,7 +5941,7 @@ var SignalController = class _SignalController {
|
|
|
5934
5941
|
};
|
|
5935
5942
|
|
|
5936
5943
|
// src/graph/controllers/registerActorSessionPersistence.ts
|
|
5937
|
-
var
|
|
5944
|
+
var import_core4 = require("@cadenza.io/core");
|
|
5938
5945
|
function registerActorSessionPersistenceTasks() {
|
|
5939
5946
|
if (CadenzaService.get("Persist actor session state")) {
|
|
5940
5947
|
return;
|
|
@@ -6055,7 +6062,7 @@ function registerActorSessionPersistenceTasks() {
|
|
|
6055
6062
|
},
|
|
6056
6063
|
"Validates and prepares actor_session_state payload for strict write-through persistence.",
|
|
6057
6064
|
{ isSubMeta: true, concurrency: 100 }
|
|
6058
|
-
).then(insertAndValidateActorSessionStateTask).respondsTo(
|
|
6065
|
+
).then(insertAndValidateActorSessionStateTask).respondsTo(import_core4.META_ACTOR_SESSION_STATE_PERSIST_INTENT);
|
|
6059
6066
|
}
|
|
6060
6067
|
|
|
6061
6068
|
// src/graph/controllers/GraphMetadataController.ts
|
|
@@ -8340,6 +8347,7 @@ function tableFieldTypeToSchemaType(type) {
|
|
|
8340
8347
|
var import_uuid5 = require("uuid");
|
|
8341
8348
|
|
|
8342
8349
|
// src/graph/controllers/GraphSyncController.ts
|
|
8350
|
+
var import_core5 = require("@cadenza.io/core");
|
|
8343
8351
|
var ACTOR_TASK_METADATA = /* @__PURE__ */ Symbol.for("@cadenza.io/core/actor-task-meta");
|
|
8344
8352
|
function getActorTaskRuntimeMetadata(taskFunction) {
|
|
8345
8353
|
if (typeof taskFunction !== "function") {
|
|
@@ -8477,17 +8485,21 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8477
8485
|
if (!targetTask) {
|
|
8478
8486
|
return false;
|
|
8479
8487
|
}
|
|
8480
|
-
return targetTask.
|
|
8481
|
-
{
|
|
8488
|
+
return targetTask.execute(
|
|
8489
|
+
new import_core5.GraphContext({
|
|
8482
8490
|
...ctx,
|
|
8483
8491
|
queryData: buildSyncInsertQueryData(
|
|
8484
8492
|
ctx,
|
|
8485
8493
|
queryData
|
|
8486
8494
|
)
|
|
8487
|
-
},
|
|
8495
|
+
}),
|
|
8488
8496
|
emit,
|
|
8489
8497
|
inquire,
|
|
8490
|
-
progressCallback
|
|
8498
|
+
progressCallback,
|
|
8499
|
+
{
|
|
8500
|
+
nodeId: ctx.__previousTaskExecutionId ?? ctx.__metadata?.__previousTaskExecutionId ?? `graph-sync-${tableName}`,
|
|
8501
|
+
routineExecId: ctx.__routineExecId ?? ctx.__metadata?.__routineExecId ?? ctx.__metadata?.__localRoutineExecId ?? "graph-sync"
|
|
8502
|
+
}
|
|
8491
8503
|
);
|
|
8492
8504
|
},
|
|
8493
8505
|
`Routes graph sync inserts for ${tableName} through the local authority task when available.`,
|
|
@@ -9791,12 +9803,12 @@ var CadenzaService = class {
|
|
|
9791
9803
|
static bootstrap() {
|
|
9792
9804
|
if (this.isBootstrapped) return;
|
|
9793
9805
|
this.isBootstrapped = true;
|
|
9794
|
-
|
|
9795
|
-
this.signalBroker =
|
|
9796
|
-
this.inquiryBroker =
|
|
9797
|
-
this.runner =
|
|
9798
|
-
this.metaRunner =
|
|
9799
|
-
this.registry =
|
|
9806
|
+
import_core6.default.bootstrap();
|
|
9807
|
+
this.signalBroker = import_core6.default.signalBroker;
|
|
9808
|
+
this.inquiryBroker = import_core6.default.inquiryBroker;
|
|
9809
|
+
this.runner = import_core6.default.runner;
|
|
9810
|
+
this.metaRunner = import_core6.default.metaRunner;
|
|
9811
|
+
this.registry = import_core6.default.registry;
|
|
9800
9812
|
this.serviceRegistry = ServiceRegistry.instance;
|
|
9801
9813
|
RestController.instance;
|
|
9802
9814
|
SocketController.instance;
|
|
@@ -9830,8 +9842,8 @@ var CadenzaService = class {
|
|
|
9830
9842
|
return;
|
|
9831
9843
|
}
|
|
9832
9844
|
this.frontendSyncScheduled = true;
|
|
9833
|
-
|
|
9834
|
-
|
|
9845
|
+
import_core6.default.interval("meta.sync_requested", { __syncing: false }, 18e4);
|
|
9846
|
+
import_core6.default.schedule("meta.sync_requested", { __syncing: false }, 250);
|
|
9835
9847
|
}
|
|
9836
9848
|
static normalizeDeclaredTransports(transports, serviceId) {
|
|
9837
9849
|
return (transports ?? []).map((transport) => normalizeServiceTransportConfig(transport)).filter(
|
|
@@ -9888,7 +9900,7 @@ var CadenzaService = class {
|
|
|
9888
9900
|
* @return {void} Does not return any value.
|
|
9889
9901
|
*/
|
|
9890
9902
|
static validateName(name) {
|
|
9891
|
-
|
|
9903
|
+
import_core6.default.validateName(name);
|
|
9892
9904
|
}
|
|
9893
9905
|
/**
|
|
9894
9906
|
* Gets the current run strategy from the Cadenza configuration.
|
|
@@ -9896,7 +9908,7 @@ var CadenzaService = class {
|
|
|
9896
9908
|
* @return {Function} The run strategy function defined in the Cadenza configuration.
|
|
9897
9909
|
*/
|
|
9898
9910
|
static get runStrategy() {
|
|
9899
|
-
return
|
|
9911
|
+
return import_core6.default.runStrategy;
|
|
9900
9912
|
}
|
|
9901
9913
|
/**
|
|
9902
9914
|
* Sets the mode for the Cadenza application.
|
|
@@ -9905,7 +9917,7 @@ var CadenzaService = class {
|
|
|
9905
9917
|
* @return {void} This method does not return a value.
|
|
9906
9918
|
*/
|
|
9907
9919
|
static setMode(mode) {
|
|
9908
|
-
|
|
9920
|
+
import_core6.default.setMode(mode);
|
|
9909
9921
|
}
|
|
9910
9922
|
/**
|
|
9911
9923
|
* Emits a signal with the specified data using the associated broker.
|
|
@@ -9923,16 +9935,16 @@ var CadenzaService = class {
|
|
|
9923
9935
|
* ```
|
|
9924
9936
|
*/
|
|
9925
9937
|
static emit(signal, data = {}, options = {}) {
|
|
9926
|
-
|
|
9938
|
+
import_core6.default.emit(signal, data, options);
|
|
9927
9939
|
}
|
|
9928
9940
|
static debounce(signal, context = {}, delayMs = 500) {
|
|
9929
|
-
|
|
9941
|
+
import_core6.default.debounce(signal, context, delayMs);
|
|
9930
9942
|
}
|
|
9931
9943
|
static schedule(signal, context, timeoutMs, exactDateTime) {
|
|
9932
|
-
|
|
9944
|
+
import_core6.default.schedule(signal, context, timeoutMs, exactDateTime);
|
|
9933
9945
|
}
|
|
9934
9946
|
static interval(signal, context, intervalMs, leading = false, startDateTime) {
|
|
9935
|
-
|
|
9947
|
+
import_core6.default.interval(signal, context, intervalMs, leading, startDateTime);
|
|
9936
9948
|
}
|
|
9937
9949
|
static defineIntent(intent) {
|
|
9938
9950
|
this.inquiryBroker?.addIntent(intent);
|
|
@@ -10194,7 +10206,7 @@ var CadenzaService = class {
|
|
|
10194
10206
|
});
|
|
10195
10207
|
}
|
|
10196
10208
|
static get(taskName) {
|
|
10197
|
-
return
|
|
10209
|
+
return import_core6.default.get(taskName);
|
|
10198
10210
|
}
|
|
10199
10211
|
static getLocalCadenzaDBTask(tableName, operation) {
|
|
10200
10212
|
const generatedTaskName = this.buildGeneratedLocalCadenzaDBTaskName(
|
|
@@ -10205,7 +10217,7 @@ var CadenzaService = class {
|
|
|
10205
10217
|
tableName,
|
|
10206
10218
|
operation
|
|
10207
10219
|
);
|
|
10208
|
-
return
|
|
10220
|
+
return import_core6.default.get(generatedTaskName) ?? import_core6.default.get(legacyTaskName);
|
|
10209
10221
|
}
|
|
10210
10222
|
static getLocalCadenzaDBInsertTask(tableName) {
|
|
10211
10223
|
return this.getLocalCadenzaDBTask(tableName, "insert");
|
|
@@ -10214,15 +10226,15 @@ var CadenzaService = class {
|
|
|
10214
10226
|
return this.getLocalCadenzaDBTask(tableName, "query");
|
|
10215
10227
|
}
|
|
10216
10228
|
static getActor(actorName) {
|
|
10217
|
-
const cadenzaWithActors =
|
|
10229
|
+
const cadenzaWithActors = import_core6.default;
|
|
10218
10230
|
return cadenzaWithActors.getActor?.(actorName);
|
|
10219
10231
|
}
|
|
10220
10232
|
static getAllActors() {
|
|
10221
|
-
const cadenzaWithActors =
|
|
10233
|
+
const cadenzaWithActors = import_core6.default;
|
|
10222
10234
|
return cadenzaWithActors.getAllActors?.() ?? [];
|
|
10223
10235
|
}
|
|
10224
10236
|
static getRoutine(routineName) {
|
|
10225
|
-
return
|
|
10237
|
+
return import_core6.default.getRoutine(routineName);
|
|
10226
10238
|
}
|
|
10227
10239
|
/**
|
|
10228
10240
|
* Creates a new DeputyTask instance based on the provided routine name, service name, and options.
|
|
@@ -10750,7 +10762,7 @@ var CadenzaService = class {
|
|
|
10750
10762
|
return true;
|
|
10751
10763
|
}).doOn("meta.service_registry.instance_inserted");
|
|
10752
10764
|
if (!options.cadenzaDB?.connect && isFrontend) {
|
|
10753
|
-
|
|
10765
|
+
import_core6.default.schedule(
|
|
10754
10766
|
"meta.service_registry.instance_registration_requested",
|
|
10755
10767
|
{
|
|
10756
10768
|
data: {
|
|
@@ -11011,11 +11023,11 @@ var CadenzaService = class {
|
|
|
11011
11023
|
}
|
|
11012
11024
|
static createActor(spec, options = {}) {
|
|
11013
11025
|
this.bootstrap();
|
|
11014
|
-
return
|
|
11026
|
+
return import_core6.default.createActor(spec, options);
|
|
11015
11027
|
}
|
|
11016
11028
|
static createActorFromDefinition(definition, options = {}) {
|
|
11017
11029
|
this.bootstrap();
|
|
11018
|
-
return
|
|
11030
|
+
return import_core6.default.createActorFromDefinition(definition, options);
|
|
11019
11031
|
}
|
|
11020
11032
|
/**
|
|
11021
11033
|
* Creates and registers a new task with the provided name, function, and optional details.
|
|
@@ -11089,7 +11101,7 @@ var CadenzaService = class {
|
|
|
11089
11101
|
*/
|
|
11090
11102
|
static createTask(name, func, description, options = {}) {
|
|
11091
11103
|
this.bootstrap();
|
|
11092
|
-
return
|
|
11104
|
+
return import_core6.default.createTask(name, func, description, options);
|
|
11093
11105
|
}
|
|
11094
11106
|
/**
|
|
11095
11107
|
* Creates a meta task with the specified name, functionality, description, and options.
|
|
@@ -11105,7 +11117,7 @@ var CadenzaService = class {
|
|
|
11105
11117
|
*/
|
|
11106
11118
|
static createMetaTask(name, func, description, options = {}) {
|
|
11107
11119
|
this.bootstrap();
|
|
11108
|
-
return
|
|
11120
|
+
return import_core6.default.createMetaTask(name, func, description, options);
|
|
11109
11121
|
}
|
|
11110
11122
|
/**
|
|
11111
11123
|
* Creates a unique task by wrapping the provided task function with a uniqueness constraint.
|
|
@@ -11155,7 +11167,7 @@ var CadenzaService = class {
|
|
|
11155
11167
|
*/
|
|
11156
11168
|
static createUniqueTask(name, func, description, options = {}) {
|
|
11157
11169
|
this.bootstrap();
|
|
11158
|
-
return
|
|
11170
|
+
return import_core6.default.createUniqueTask(name, func, description, options);
|
|
11159
11171
|
}
|
|
11160
11172
|
/**
|
|
11161
11173
|
* Creates a unique meta task with the specified name, function, description, and options.
|
|
@@ -11169,7 +11181,7 @@ var CadenzaService = class {
|
|
|
11169
11181
|
*/
|
|
11170
11182
|
static createUniqueMetaTask(name, func, description, options = {}) {
|
|
11171
11183
|
this.bootstrap();
|
|
11172
|
-
return
|
|
11184
|
+
return import_core6.default.createUniqueMetaTask(name, func, description, options);
|
|
11173
11185
|
}
|
|
11174
11186
|
/**
|
|
11175
11187
|
* 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.
|
|
@@ -11202,7 +11214,7 @@ var CadenzaService = class {
|
|
|
11202
11214
|
*/
|
|
11203
11215
|
static createThrottledTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
11204
11216
|
this.bootstrap();
|
|
11205
|
-
return
|
|
11217
|
+
return import_core6.default.createThrottledTask(
|
|
11206
11218
|
name,
|
|
11207
11219
|
func,
|
|
11208
11220
|
throttledIdGetter,
|
|
@@ -11223,7 +11235,7 @@ var CadenzaService = class {
|
|
|
11223
11235
|
*/
|
|
11224
11236
|
static createThrottledMetaTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
11225
11237
|
this.bootstrap();
|
|
11226
|
-
return
|
|
11238
|
+
return import_core6.default.createThrottledMetaTask(
|
|
11227
11239
|
name,
|
|
11228
11240
|
func,
|
|
11229
11241
|
throttledIdGetter,
|
|
@@ -11266,7 +11278,7 @@ var CadenzaService = class {
|
|
|
11266
11278
|
*/
|
|
11267
11279
|
static createDebounceTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
11268
11280
|
this.bootstrap();
|
|
11269
|
-
return
|
|
11281
|
+
return import_core6.default.createDebounceTask(
|
|
11270
11282
|
name,
|
|
11271
11283
|
func,
|
|
11272
11284
|
description,
|
|
@@ -11287,7 +11299,7 @@ var CadenzaService = class {
|
|
|
11287
11299
|
*/
|
|
11288
11300
|
static createDebounceMetaTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
11289
11301
|
this.bootstrap();
|
|
11290
|
-
return
|
|
11302
|
+
return import_core6.default.createDebounceMetaTask(
|
|
11291
11303
|
name,
|
|
11292
11304
|
func,
|
|
11293
11305
|
description,
|
|
@@ -11357,7 +11369,7 @@ var CadenzaService = class {
|
|
|
11357
11369
|
*/
|
|
11358
11370
|
static createEphemeralTask(name, func, description, options = {}) {
|
|
11359
11371
|
this.bootstrap();
|
|
11360
|
-
return
|
|
11372
|
+
return import_core6.default.createEphemeralTask(name, func, description, options);
|
|
11361
11373
|
}
|
|
11362
11374
|
/**
|
|
11363
11375
|
* Creates an ephemeral meta-task with the specified name, function, description, and options.
|
|
@@ -11371,7 +11383,7 @@ var CadenzaService = class {
|
|
|
11371
11383
|
*/
|
|
11372
11384
|
static createEphemeralMetaTask(name, func, description, options = {}) {
|
|
11373
11385
|
this.bootstrap();
|
|
11374
|
-
return
|
|
11386
|
+
return import_core6.default.createEphemeralMetaTask(name, func, description, options);
|
|
11375
11387
|
}
|
|
11376
11388
|
/**
|
|
11377
11389
|
* Creates a new routine with the specified name, tasks, and an optional description.
|
|
@@ -11403,7 +11415,7 @@ var CadenzaService = class {
|
|
|
11403
11415
|
*/
|
|
11404
11416
|
static createRoutine(name, tasks, description = "") {
|
|
11405
11417
|
this.bootstrap();
|
|
11406
|
-
return
|
|
11418
|
+
return import_core6.default.createRoutine(name, tasks, description);
|
|
11407
11419
|
}
|
|
11408
11420
|
/**
|
|
11409
11421
|
* Creates a meta routine with a given name, tasks, and optional description.
|
|
@@ -11418,10 +11430,10 @@ var CadenzaService = class {
|
|
|
11418
11430
|
*/
|
|
11419
11431
|
static createMetaRoutine(name, tasks, description = "") {
|
|
11420
11432
|
this.bootstrap();
|
|
11421
|
-
return
|
|
11433
|
+
return import_core6.default.createMetaRoutine(name, tasks, description);
|
|
11422
11434
|
}
|
|
11423
11435
|
static reset() {
|
|
11424
|
-
|
|
11436
|
+
import_core6.default.reset();
|
|
11425
11437
|
this.serviceRegistry?.reset();
|
|
11426
11438
|
this.isBootstrapped = false;
|
|
11427
11439
|
this.serviceCreated = false;
|
|
@@ -11439,7 +11451,7 @@ CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
|
|
|
11439
11451
|
CadenzaService.frontendSyncScheduled = false;
|
|
11440
11452
|
|
|
11441
11453
|
// src/index.ts
|
|
11442
|
-
var
|
|
11454
|
+
var import_core7 = require("@cadenza.io/core");
|
|
11443
11455
|
|
|
11444
11456
|
// src/ssr/createSSRInquiryBridge.ts
|
|
11445
11457
|
var import_uuid6 = require("uuid");
|