@cadenza.io/service 2.17.64 → 2.17.65

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
@@ -8797,6 +8797,16 @@ function didSyncInsertSucceed(ctx) {
8797
8797
  }
8798
8798
  return true;
8799
8799
  }
8800
+ function buildMinimalSyncSignalContext(ctx, extra = {}) {
8801
+ const nextContext = {
8802
+ __syncing: ctx.__syncing === true,
8803
+ ...extra
8804
+ };
8805
+ if (typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0) {
8806
+ nextContext.__reason = ctx.__reason;
8807
+ }
8808
+ return nextContext;
8809
+ }
8800
8810
  function buildSyncInsertQueryData(ctx, queryData = {}) {
8801
8811
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
8802
8812
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
@@ -9301,10 +9311,10 @@ var GraphSyncController = class _GraphSyncController {
9301
9311
  const shouldEmit = !this.tasksSynced;
9302
9312
  this.tasksSynced = true;
9303
9313
  if (shouldEmit) {
9304
- emit("meta.sync_controller.synced_tasks", {
9305
- __syncing: true,
9306
- ...ctx
9307
- });
9314
+ emit(
9315
+ "meta.sync_controller.synced_tasks",
9316
+ buildMinimalSyncSignalContext(ctx)
9317
+ );
9308
9318
  }
9309
9319
  return true;
9310
9320
  };
@@ -9319,10 +9329,10 @@ var GraphSyncController = class _GraphSyncController {
9319
9329
  const shouldEmit = !this.routinesSynced;
9320
9330
  this.routinesSynced = true;
9321
9331
  if (shouldEmit) {
9322
- emit("meta.sync_controller.synced_routines", {
9323
- __syncing: true,
9324
- ...ctx
9325
- });
9332
+ emit(
9333
+ "meta.sync_controller.synced_routines",
9334
+ buildMinimalSyncSignalContext(ctx)
9335
+ );
9326
9336
  }
9327
9337
  return true;
9328
9338
  };
@@ -9337,10 +9347,10 @@ var GraphSyncController = class _GraphSyncController {
9337
9347
  const shouldEmit = !this.signalsSynced;
9338
9348
  this.signalsSynced = true;
9339
9349
  if (shouldEmit) {
9340
- emit("meta.sync_controller.synced_signals", {
9341
- __syncing: true,
9342
- ...ctx
9343
- });
9350
+ emit(
9351
+ "meta.sync_controller.synced_signals",
9352
+ buildMinimalSyncSignalContext(ctx)
9353
+ );
9344
9354
  }
9345
9355
  return true;
9346
9356
  };
@@ -9355,10 +9365,10 @@ var GraphSyncController = class _GraphSyncController {
9355
9365
  const shouldEmit = !this.intentsSynced;
9356
9366
  this.intentsSynced = true;
9357
9367
  if (shouldEmit) {
9358
- emit("meta.sync_controller.synced_intents", {
9359
- __syncing: true,
9360
- ...ctx
9361
- });
9368
+ emit(
9369
+ "meta.sync_controller.synced_intents",
9370
+ buildMinimalSyncSignalContext(ctx)
9371
+ );
9362
9372
  }
9363
9373
  return true;
9364
9374
  };
@@ -9376,10 +9386,10 @@ var GraphSyncController = class _GraphSyncController {
9376
9386
  const shouldEmit = !this.actorsSynced;
9377
9387
  this.actorsSynced = true;
9378
9388
  if (shouldEmit) {
9379
- emit("meta.sync_controller.synced_actors", {
9380
- __syncing: true,
9381
- ...ctx
9382
- });
9389
+ emit(
9390
+ "meta.sync_controller.synced_actors",
9391
+ buildMinimalSyncSignalContext(ctx)
9392
+ );
9383
9393
  }
9384
9394
  return true;
9385
9395
  };
@@ -9726,10 +9736,12 @@ var GraphSyncController = class _GraphSyncController {
9726
9736
  delayMs: 3e3
9727
9737
  });
9728
9738
  CadenzaService.get(ctx.__taskName).registered = true;
9729
- emit("meta.sync_controller.task_registered", {
9730
- ...ctx,
9731
- task: CadenzaService.get(ctx.__taskName)
9732
- });
9739
+ emit(
9740
+ "meta.sync_controller.task_registered",
9741
+ buildMinimalSyncSignalContext(ctx, {
9742
+ __taskName: ctx.__taskName
9743
+ })
9744
+ );
9733
9745
  return true;
9734
9746
  }
9735
9747
  ).then(gatherTaskRegistrationTask);