@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/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: () => import_core6.Actor,
33
+ Actor: () => import_core7.Actor,
34
34
  DatabaseController: () => DatabaseController,
35
35
  DatabaseTask: () => DatabaseTask,
36
- DebounceTask: () => import_core6.DebounceTask,
36
+ DebounceTask: () => import_core7.DebounceTask,
37
37
  DeputyTask: () => DeputyTask,
38
- EphemeralTask: () => import_core6.EphemeralTask,
38
+ EphemeralTask: () => import_core7.EphemeralTask,
39
39
  GraphMetadataController: () => GraphMetadataController,
40
- GraphRoutine: () => import_core6.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: () => import_core6.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 import_core5 = __toESM(require("@cadenza.io/core"));
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.taskFunction(
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 import_core2 = require("@cadenza.io/core");
3435
+ var import_core3 = require("@cadenza.io/core");
3429
3436
  var import_uuid3 = require("uuid");
3430
- var SignalTransmissionTask = class extends import_core2.Task {
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 import_core3 = require("@cadenza.io/core");
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(import_core3.META_ACTOR_SESSION_STATE_PERSIST_INTENT);
6065
+ ).then(insertAndValidateActorSessionStateTask).respondsTo(import_core4.META_ACTOR_SESSION_STATE_PERSIST_INTENT);
6059
6066
  }
6060
6067
 
6061
6068
  // src/graph/controllers/GraphMetadataController.ts
@@ -8340,7 +8347,7 @@ function tableFieldTypeToSchemaType(type) {
8340
8347
  var import_uuid5 = require("uuid");
8341
8348
 
8342
8349
  // src/graph/controllers/GraphSyncController.ts
8343
- var import_core4 = require("@cadenza.io/core");
8350
+ var import_core5 = require("@cadenza.io/core");
8344
8351
  var ACTOR_TASK_METADATA = /* @__PURE__ */ Symbol.for("@cadenza.io/core/actor-task-meta");
8345
8352
  function getActorTaskRuntimeMetadata(taskFunction) {
8346
8353
  if (typeof taskFunction !== "function") {
@@ -8479,7 +8486,7 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
8479
8486
  return false;
8480
8487
  }
8481
8488
  return targetTask.execute(
8482
- new import_core4.GraphContext({
8489
+ new import_core5.GraphContext({
8483
8490
  ...ctx,
8484
8491
  queryData: buildSyncInsertQueryData(
8485
8492
  ctx,
@@ -9796,12 +9803,12 @@ var CadenzaService = class {
9796
9803
  static bootstrap() {
9797
9804
  if (this.isBootstrapped) return;
9798
9805
  this.isBootstrapped = true;
9799
- import_core5.default.bootstrap();
9800
- this.signalBroker = import_core5.default.signalBroker;
9801
- this.inquiryBroker = import_core5.default.inquiryBroker;
9802
- this.runner = import_core5.default.runner;
9803
- this.metaRunner = import_core5.default.metaRunner;
9804
- this.registry = import_core5.default.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;
9805
9812
  this.serviceRegistry = ServiceRegistry.instance;
9806
9813
  RestController.instance;
9807
9814
  SocketController.instance;
@@ -9835,8 +9842,8 @@ var CadenzaService = class {
9835
9842
  return;
9836
9843
  }
9837
9844
  this.frontendSyncScheduled = true;
9838
- import_core5.default.interval("meta.sync_requested", { __syncing: false }, 18e4);
9839
- import_core5.default.schedule("meta.sync_requested", { __syncing: false }, 250);
9845
+ import_core6.default.interval("meta.sync_requested", { __syncing: false }, 18e4);
9846
+ import_core6.default.schedule("meta.sync_requested", { __syncing: false }, 250);
9840
9847
  }
9841
9848
  static normalizeDeclaredTransports(transports, serviceId) {
9842
9849
  return (transports ?? []).map((transport) => normalizeServiceTransportConfig(transport)).filter(
@@ -9893,7 +9900,7 @@ var CadenzaService = class {
9893
9900
  * @return {void} Does not return any value.
9894
9901
  */
9895
9902
  static validateName(name) {
9896
- import_core5.default.validateName(name);
9903
+ import_core6.default.validateName(name);
9897
9904
  }
9898
9905
  /**
9899
9906
  * Gets the current run strategy from the Cadenza configuration.
@@ -9901,7 +9908,7 @@ var CadenzaService = class {
9901
9908
  * @return {Function} The run strategy function defined in the Cadenza configuration.
9902
9909
  */
9903
9910
  static get runStrategy() {
9904
- return import_core5.default.runStrategy;
9911
+ return import_core6.default.runStrategy;
9905
9912
  }
9906
9913
  /**
9907
9914
  * Sets the mode for the Cadenza application.
@@ -9910,7 +9917,7 @@ var CadenzaService = class {
9910
9917
  * @return {void} This method does not return a value.
9911
9918
  */
9912
9919
  static setMode(mode) {
9913
- import_core5.default.setMode(mode);
9920
+ import_core6.default.setMode(mode);
9914
9921
  }
9915
9922
  /**
9916
9923
  * Emits a signal with the specified data using the associated broker.
@@ -9928,16 +9935,16 @@ var CadenzaService = class {
9928
9935
  * ```
9929
9936
  */
9930
9937
  static emit(signal, data = {}, options = {}) {
9931
- import_core5.default.emit(signal, data, options);
9938
+ import_core6.default.emit(signal, data, options);
9932
9939
  }
9933
9940
  static debounce(signal, context = {}, delayMs = 500) {
9934
- import_core5.default.debounce(signal, context, delayMs);
9941
+ import_core6.default.debounce(signal, context, delayMs);
9935
9942
  }
9936
9943
  static schedule(signal, context, timeoutMs, exactDateTime) {
9937
- import_core5.default.schedule(signal, context, timeoutMs, exactDateTime);
9944
+ import_core6.default.schedule(signal, context, timeoutMs, exactDateTime);
9938
9945
  }
9939
9946
  static interval(signal, context, intervalMs, leading = false, startDateTime) {
9940
- import_core5.default.interval(signal, context, intervalMs, leading, startDateTime);
9947
+ import_core6.default.interval(signal, context, intervalMs, leading, startDateTime);
9941
9948
  }
9942
9949
  static defineIntent(intent) {
9943
9950
  this.inquiryBroker?.addIntent(intent);
@@ -10199,7 +10206,7 @@ var CadenzaService = class {
10199
10206
  });
10200
10207
  }
10201
10208
  static get(taskName) {
10202
- return import_core5.default.get(taskName);
10209
+ return import_core6.default.get(taskName);
10203
10210
  }
10204
10211
  static getLocalCadenzaDBTask(tableName, operation) {
10205
10212
  const generatedTaskName = this.buildGeneratedLocalCadenzaDBTaskName(
@@ -10210,7 +10217,7 @@ var CadenzaService = class {
10210
10217
  tableName,
10211
10218
  operation
10212
10219
  );
10213
- return import_core5.default.get(generatedTaskName) ?? import_core5.default.get(legacyTaskName);
10220
+ return import_core6.default.get(generatedTaskName) ?? import_core6.default.get(legacyTaskName);
10214
10221
  }
10215
10222
  static getLocalCadenzaDBInsertTask(tableName) {
10216
10223
  return this.getLocalCadenzaDBTask(tableName, "insert");
@@ -10219,15 +10226,15 @@ var CadenzaService = class {
10219
10226
  return this.getLocalCadenzaDBTask(tableName, "query");
10220
10227
  }
10221
10228
  static getActor(actorName) {
10222
- const cadenzaWithActors = import_core5.default;
10229
+ const cadenzaWithActors = import_core6.default;
10223
10230
  return cadenzaWithActors.getActor?.(actorName);
10224
10231
  }
10225
10232
  static getAllActors() {
10226
- const cadenzaWithActors = import_core5.default;
10233
+ const cadenzaWithActors = import_core6.default;
10227
10234
  return cadenzaWithActors.getAllActors?.() ?? [];
10228
10235
  }
10229
10236
  static getRoutine(routineName) {
10230
- return import_core5.default.getRoutine(routineName);
10237
+ return import_core6.default.getRoutine(routineName);
10231
10238
  }
10232
10239
  /**
10233
10240
  * Creates a new DeputyTask instance based on the provided routine name, service name, and options.
@@ -10755,7 +10762,7 @@ var CadenzaService = class {
10755
10762
  return true;
10756
10763
  }).doOn("meta.service_registry.instance_inserted");
10757
10764
  if (!options.cadenzaDB?.connect && isFrontend) {
10758
- import_core5.default.schedule(
10765
+ import_core6.default.schedule(
10759
10766
  "meta.service_registry.instance_registration_requested",
10760
10767
  {
10761
10768
  data: {
@@ -11016,11 +11023,11 @@ var CadenzaService = class {
11016
11023
  }
11017
11024
  static createActor(spec, options = {}) {
11018
11025
  this.bootstrap();
11019
- return import_core5.default.createActor(spec, options);
11026
+ return import_core6.default.createActor(spec, options);
11020
11027
  }
11021
11028
  static createActorFromDefinition(definition, options = {}) {
11022
11029
  this.bootstrap();
11023
- return import_core5.default.createActorFromDefinition(definition, options);
11030
+ return import_core6.default.createActorFromDefinition(definition, options);
11024
11031
  }
11025
11032
  /**
11026
11033
  * Creates and registers a new task with the provided name, function, and optional details.
@@ -11094,7 +11101,7 @@ var CadenzaService = class {
11094
11101
  */
11095
11102
  static createTask(name, func, description, options = {}) {
11096
11103
  this.bootstrap();
11097
- return import_core5.default.createTask(name, func, description, options);
11104
+ return import_core6.default.createTask(name, func, description, options);
11098
11105
  }
11099
11106
  /**
11100
11107
  * Creates a meta task with the specified name, functionality, description, and options.
@@ -11110,7 +11117,7 @@ var CadenzaService = class {
11110
11117
  */
11111
11118
  static createMetaTask(name, func, description, options = {}) {
11112
11119
  this.bootstrap();
11113
- return import_core5.default.createMetaTask(name, func, description, options);
11120
+ return import_core6.default.createMetaTask(name, func, description, options);
11114
11121
  }
11115
11122
  /**
11116
11123
  * Creates a unique task by wrapping the provided task function with a uniqueness constraint.
@@ -11160,7 +11167,7 @@ var CadenzaService = class {
11160
11167
  */
11161
11168
  static createUniqueTask(name, func, description, options = {}) {
11162
11169
  this.bootstrap();
11163
- return import_core5.default.createUniqueTask(name, func, description, options);
11170
+ return import_core6.default.createUniqueTask(name, func, description, options);
11164
11171
  }
11165
11172
  /**
11166
11173
  * Creates a unique meta task with the specified name, function, description, and options.
@@ -11174,7 +11181,7 @@ var CadenzaService = class {
11174
11181
  */
11175
11182
  static createUniqueMetaTask(name, func, description, options = {}) {
11176
11183
  this.bootstrap();
11177
- return import_core5.default.createUniqueMetaTask(name, func, description, options);
11184
+ return import_core6.default.createUniqueMetaTask(name, func, description, options);
11178
11185
  }
11179
11186
  /**
11180
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.
@@ -11207,7 +11214,7 @@ var CadenzaService = class {
11207
11214
  */
11208
11215
  static createThrottledTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
11209
11216
  this.bootstrap();
11210
- return import_core5.default.createThrottledTask(
11217
+ return import_core6.default.createThrottledTask(
11211
11218
  name,
11212
11219
  func,
11213
11220
  throttledIdGetter,
@@ -11228,7 +11235,7 @@ var CadenzaService = class {
11228
11235
  */
11229
11236
  static createThrottledMetaTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
11230
11237
  this.bootstrap();
11231
- return import_core5.default.createThrottledMetaTask(
11238
+ return import_core6.default.createThrottledMetaTask(
11232
11239
  name,
11233
11240
  func,
11234
11241
  throttledIdGetter,
@@ -11271,7 +11278,7 @@ var CadenzaService = class {
11271
11278
  */
11272
11279
  static createDebounceTask(name, func, description, debounceTime = 1e3, options = {}) {
11273
11280
  this.bootstrap();
11274
- return import_core5.default.createDebounceTask(
11281
+ return import_core6.default.createDebounceTask(
11275
11282
  name,
11276
11283
  func,
11277
11284
  description,
@@ -11292,7 +11299,7 @@ var CadenzaService = class {
11292
11299
  */
11293
11300
  static createDebounceMetaTask(name, func, description, debounceTime = 1e3, options = {}) {
11294
11301
  this.bootstrap();
11295
- return import_core5.default.createDebounceMetaTask(
11302
+ return import_core6.default.createDebounceMetaTask(
11296
11303
  name,
11297
11304
  func,
11298
11305
  description,
@@ -11362,7 +11369,7 @@ var CadenzaService = class {
11362
11369
  */
11363
11370
  static createEphemeralTask(name, func, description, options = {}) {
11364
11371
  this.bootstrap();
11365
- return import_core5.default.createEphemeralTask(name, func, description, options);
11372
+ return import_core6.default.createEphemeralTask(name, func, description, options);
11366
11373
  }
11367
11374
  /**
11368
11375
  * Creates an ephemeral meta-task with the specified name, function, description, and options.
@@ -11376,7 +11383,7 @@ var CadenzaService = class {
11376
11383
  */
11377
11384
  static createEphemeralMetaTask(name, func, description, options = {}) {
11378
11385
  this.bootstrap();
11379
- return import_core5.default.createEphemeralMetaTask(name, func, description, options);
11386
+ return import_core6.default.createEphemeralMetaTask(name, func, description, options);
11380
11387
  }
11381
11388
  /**
11382
11389
  * Creates a new routine with the specified name, tasks, and an optional description.
@@ -11408,7 +11415,7 @@ var CadenzaService = class {
11408
11415
  */
11409
11416
  static createRoutine(name, tasks, description = "") {
11410
11417
  this.bootstrap();
11411
- return import_core5.default.createRoutine(name, tasks, description);
11418
+ return import_core6.default.createRoutine(name, tasks, description);
11412
11419
  }
11413
11420
  /**
11414
11421
  * Creates a meta routine with a given name, tasks, and optional description.
@@ -11423,10 +11430,10 @@ var CadenzaService = class {
11423
11430
  */
11424
11431
  static createMetaRoutine(name, tasks, description = "") {
11425
11432
  this.bootstrap();
11426
- return import_core5.default.createMetaRoutine(name, tasks, description);
11433
+ return import_core6.default.createMetaRoutine(name, tasks, description);
11427
11434
  }
11428
11435
  static reset() {
11429
- import_core5.default.reset();
11436
+ import_core6.default.reset();
11430
11437
  this.serviceRegistry?.reset();
11431
11438
  this.isBootstrapped = false;
11432
11439
  this.serviceCreated = false;
@@ -11444,7 +11451,7 @@ CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
11444
11451
  CadenzaService.frontendSyncScheduled = false;
11445
11452
 
11446
11453
  // src/index.ts
11447
- var import_core6 = require("@cadenza.io/core");
11454
+ var import_core7 = require("@cadenza.io/core");
11448
11455
 
11449
11456
  // src/ssr/createSSRInquiryBridge.ts
11450
11457
  var import_uuid6 = require("uuid");