@cadenza.io/service 2.17.63 → 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.
@@ -6185,6 +6185,16 @@ function didSyncInsertSucceed(ctx) {
6185
6185
  }
6186
6186
  return true;
6187
6187
  }
6188
+ function buildMinimalSyncSignalContext(ctx, extra = {}) {
6189
+ const nextContext = {
6190
+ __syncing: ctx.__syncing === true,
6191
+ ...extra
6192
+ };
6193
+ if (typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0) {
6194
+ nextContext.__reason = ctx.__reason;
6195
+ }
6196
+ return nextContext;
6197
+ }
6188
6198
  function buildSyncInsertQueryData(ctx, queryData = {}) {
6189
6199
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
6190
6200
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
@@ -6689,10 +6699,10 @@ var GraphSyncController = class _GraphSyncController {
6689
6699
  const shouldEmit = !this.tasksSynced;
6690
6700
  this.tasksSynced = true;
6691
6701
  if (shouldEmit) {
6692
- emit("meta.sync_controller.synced_tasks", {
6693
- __syncing: true,
6694
- ...ctx
6695
- });
6702
+ emit(
6703
+ "meta.sync_controller.synced_tasks",
6704
+ buildMinimalSyncSignalContext(ctx)
6705
+ );
6696
6706
  }
6697
6707
  return true;
6698
6708
  };
@@ -6707,10 +6717,10 @@ var GraphSyncController = class _GraphSyncController {
6707
6717
  const shouldEmit = !this.routinesSynced;
6708
6718
  this.routinesSynced = true;
6709
6719
  if (shouldEmit) {
6710
- emit("meta.sync_controller.synced_routines", {
6711
- __syncing: true,
6712
- ...ctx
6713
- });
6720
+ emit(
6721
+ "meta.sync_controller.synced_routines",
6722
+ buildMinimalSyncSignalContext(ctx)
6723
+ );
6714
6724
  }
6715
6725
  return true;
6716
6726
  };
@@ -6725,10 +6735,10 @@ var GraphSyncController = class _GraphSyncController {
6725
6735
  const shouldEmit = !this.signalsSynced;
6726
6736
  this.signalsSynced = true;
6727
6737
  if (shouldEmit) {
6728
- emit("meta.sync_controller.synced_signals", {
6729
- __syncing: true,
6730
- ...ctx
6731
- });
6738
+ emit(
6739
+ "meta.sync_controller.synced_signals",
6740
+ buildMinimalSyncSignalContext(ctx)
6741
+ );
6732
6742
  }
6733
6743
  return true;
6734
6744
  };
@@ -6743,10 +6753,10 @@ var GraphSyncController = class _GraphSyncController {
6743
6753
  const shouldEmit = !this.intentsSynced;
6744
6754
  this.intentsSynced = true;
6745
6755
  if (shouldEmit) {
6746
- emit("meta.sync_controller.synced_intents", {
6747
- __syncing: true,
6748
- ...ctx
6749
- });
6756
+ emit(
6757
+ "meta.sync_controller.synced_intents",
6758
+ buildMinimalSyncSignalContext(ctx)
6759
+ );
6750
6760
  }
6751
6761
  return true;
6752
6762
  };
@@ -6764,10 +6774,10 @@ var GraphSyncController = class _GraphSyncController {
6764
6774
  const shouldEmit = !this.actorsSynced;
6765
6775
  this.actorsSynced = true;
6766
6776
  if (shouldEmit) {
6767
- emit("meta.sync_controller.synced_actors", {
6768
- __syncing: true,
6769
- ...ctx
6770
- });
6777
+ emit(
6778
+ "meta.sync_controller.synced_actors",
6779
+ buildMinimalSyncSignalContext(ctx)
6780
+ );
6771
6781
  }
6772
6782
  return true;
6773
6783
  };
@@ -7114,10 +7124,12 @@ var GraphSyncController = class _GraphSyncController {
7114
7124
  delayMs: 3e3
7115
7125
  });
7116
7126
  CadenzaService.get(ctx.__taskName).registered = true;
7117
- emit("meta.sync_controller.task_registered", {
7118
- ...ctx,
7119
- task: CadenzaService.get(ctx.__taskName)
7120
- });
7127
+ emit(
7128
+ "meta.sync_controller.task_registered",
7129
+ buildMinimalSyncSignalContext(ctx, {
7130
+ __taskName: ctx.__taskName
7131
+ })
7132
+ );
7121
7133
  return true;
7122
7134
  }
7123
7135
  ).then(gatherTaskRegistrationTask);