@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.mjs CHANGED
@@ -8748,6 +8748,16 @@ function didSyncInsertSucceed(ctx) {
8748
8748
  }
8749
8749
  return true;
8750
8750
  }
8751
+ function buildMinimalSyncSignalContext(ctx, extra = {}) {
8752
+ const nextContext = {
8753
+ __syncing: ctx.__syncing === true,
8754
+ ...extra
8755
+ };
8756
+ if (typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0) {
8757
+ nextContext.__reason = ctx.__reason;
8758
+ }
8759
+ return nextContext;
8760
+ }
8751
8761
  function buildSyncInsertQueryData(ctx, queryData = {}) {
8752
8762
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
8753
8763
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
@@ -9252,10 +9262,10 @@ var GraphSyncController = class _GraphSyncController {
9252
9262
  const shouldEmit = !this.tasksSynced;
9253
9263
  this.tasksSynced = true;
9254
9264
  if (shouldEmit) {
9255
- emit("meta.sync_controller.synced_tasks", {
9256
- __syncing: true,
9257
- ...ctx
9258
- });
9265
+ emit(
9266
+ "meta.sync_controller.synced_tasks",
9267
+ buildMinimalSyncSignalContext(ctx)
9268
+ );
9259
9269
  }
9260
9270
  return true;
9261
9271
  };
@@ -9270,10 +9280,10 @@ var GraphSyncController = class _GraphSyncController {
9270
9280
  const shouldEmit = !this.routinesSynced;
9271
9281
  this.routinesSynced = true;
9272
9282
  if (shouldEmit) {
9273
- emit("meta.sync_controller.synced_routines", {
9274
- __syncing: true,
9275
- ...ctx
9276
- });
9283
+ emit(
9284
+ "meta.sync_controller.synced_routines",
9285
+ buildMinimalSyncSignalContext(ctx)
9286
+ );
9277
9287
  }
9278
9288
  return true;
9279
9289
  };
@@ -9288,10 +9298,10 @@ var GraphSyncController = class _GraphSyncController {
9288
9298
  const shouldEmit = !this.signalsSynced;
9289
9299
  this.signalsSynced = true;
9290
9300
  if (shouldEmit) {
9291
- emit("meta.sync_controller.synced_signals", {
9292
- __syncing: true,
9293
- ...ctx
9294
- });
9301
+ emit(
9302
+ "meta.sync_controller.synced_signals",
9303
+ buildMinimalSyncSignalContext(ctx)
9304
+ );
9295
9305
  }
9296
9306
  return true;
9297
9307
  };
@@ -9306,10 +9316,10 @@ var GraphSyncController = class _GraphSyncController {
9306
9316
  const shouldEmit = !this.intentsSynced;
9307
9317
  this.intentsSynced = true;
9308
9318
  if (shouldEmit) {
9309
- emit("meta.sync_controller.synced_intents", {
9310
- __syncing: true,
9311
- ...ctx
9312
- });
9319
+ emit(
9320
+ "meta.sync_controller.synced_intents",
9321
+ buildMinimalSyncSignalContext(ctx)
9322
+ );
9313
9323
  }
9314
9324
  return true;
9315
9325
  };
@@ -9327,10 +9337,10 @@ var GraphSyncController = class _GraphSyncController {
9327
9337
  const shouldEmit = !this.actorsSynced;
9328
9338
  this.actorsSynced = true;
9329
9339
  if (shouldEmit) {
9330
- emit("meta.sync_controller.synced_actors", {
9331
- __syncing: true,
9332
- ...ctx
9333
- });
9340
+ emit(
9341
+ "meta.sync_controller.synced_actors",
9342
+ buildMinimalSyncSignalContext(ctx)
9343
+ );
9334
9344
  }
9335
9345
  return true;
9336
9346
  };
@@ -9677,10 +9687,12 @@ var GraphSyncController = class _GraphSyncController {
9677
9687
  delayMs: 3e3
9678
9688
  });
9679
9689
  CadenzaService.get(ctx.__taskName).registered = true;
9680
- emit("meta.sync_controller.task_registered", {
9681
- ...ctx,
9682
- task: CadenzaService.get(ctx.__taskName)
9683
- });
9690
+ emit(
9691
+ "meta.sync_controller.task_registered",
9692
+ buildMinimalSyncSignalContext(ctx, {
9693
+ __taskName: ctx.__taskName
9694
+ })
9695
+ );
9684
9696
  return true;
9685
9697
  }
9686
9698
  ).then(gatherTaskRegistrationTask);