@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.
@@ -6234,6 +6234,16 @@ function didSyncInsertSucceed(ctx) {
6234
6234
  }
6235
6235
  return true;
6236
6236
  }
6237
+ function buildMinimalSyncSignalContext(ctx, extra = {}) {
6238
+ const nextContext = {
6239
+ __syncing: ctx.__syncing === true,
6240
+ ...extra
6241
+ };
6242
+ if (typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0) {
6243
+ nextContext.__reason = ctx.__reason;
6244
+ }
6245
+ return nextContext;
6246
+ }
6237
6247
  function buildSyncInsertQueryData(ctx, queryData = {}) {
6238
6248
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
6239
6249
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
@@ -6738,10 +6748,10 @@ var GraphSyncController = class _GraphSyncController {
6738
6748
  const shouldEmit = !this.tasksSynced;
6739
6749
  this.tasksSynced = true;
6740
6750
  if (shouldEmit) {
6741
- emit("meta.sync_controller.synced_tasks", {
6742
- __syncing: true,
6743
- ...ctx
6744
- });
6751
+ emit(
6752
+ "meta.sync_controller.synced_tasks",
6753
+ buildMinimalSyncSignalContext(ctx)
6754
+ );
6745
6755
  }
6746
6756
  return true;
6747
6757
  };
@@ -6756,10 +6766,10 @@ var GraphSyncController = class _GraphSyncController {
6756
6766
  const shouldEmit = !this.routinesSynced;
6757
6767
  this.routinesSynced = true;
6758
6768
  if (shouldEmit) {
6759
- emit("meta.sync_controller.synced_routines", {
6760
- __syncing: true,
6761
- ...ctx
6762
- });
6769
+ emit(
6770
+ "meta.sync_controller.synced_routines",
6771
+ buildMinimalSyncSignalContext(ctx)
6772
+ );
6763
6773
  }
6764
6774
  return true;
6765
6775
  };
@@ -6774,10 +6784,10 @@ var GraphSyncController = class _GraphSyncController {
6774
6784
  const shouldEmit = !this.signalsSynced;
6775
6785
  this.signalsSynced = true;
6776
6786
  if (shouldEmit) {
6777
- emit("meta.sync_controller.synced_signals", {
6778
- __syncing: true,
6779
- ...ctx
6780
- });
6787
+ emit(
6788
+ "meta.sync_controller.synced_signals",
6789
+ buildMinimalSyncSignalContext(ctx)
6790
+ );
6781
6791
  }
6782
6792
  return true;
6783
6793
  };
@@ -6792,10 +6802,10 @@ var GraphSyncController = class _GraphSyncController {
6792
6802
  const shouldEmit = !this.intentsSynced;
6793
6803
  this.intentsSynced = true;
6794
6804
  if (shouldEmit) {
6795
- emit("meta.sync_controller.synced_intents", {
6796
- __syncing: true,
6797
- ...ctx
6798
- });
6805
+ emit(
6806
+ "meta.sync_controller.synced_intents",
6807
+ buildMinimalSyncSignalContext(ctx)
6808
+ );
6799
6809
  }
6800
6810
  return true;
6801
6811
  };
@@ -6813,10 +6823,10 @@ var GraphSyncController = class _GraphSyncController {
6813
6823
  const shouldEmit = !this.actorsSynced;
6814
6824
  this.actorsSynced = true;
6815
6825
  if (shouldEmit) {
6816
- emit("meta.sync_controller.synced_actors", {
6817
- __syncing: true,
6818
- ...ctx
6819
- });
6826
+ emit(
6827
+ "meta.sync_controller.synced_actors",
6828
+ buildMinimalSyncSignalContext(ctx)
6829
+ );
6820
6830
  }
6821
6831
  return true;
6822
6832
  };
@@ -7163,10 +7173,12 @@ var GraphSyncController = class _GraphSyncController {
7163
7173
  delayMs: 3e3
7164
7174
  });
7165
7175
  CadenzaService.get(ctx.__taskName).registered = true;
7166
- emit("meta.sync_controller.task_registered", {
7167
- ...ctx,
7168
- task: CadenzaService.get(ctx.__taskName)
7169
- });
7176
+ emit(
7177
+ "meta.sync_controller.task_registered",
7178
+ buildMinimalSyncSignalContext(ctx, {
7179
+ __taskName: ctx.__taskName
7180
+ })
7181
+ );
7170
7182
  return true;
7171
7183
  }
7172
7184
  ).then(gatherTaskRegistrationTask);