@cadenza.io/service 2.17.70 → 2.17.71

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.
@@ -6249,24 +6249,63 @@ function buildMinimalSyncSignalContext(ctx, extra = {}) {
6249
6249
  return nextContext;
6250
6250
  }
6251
6251
  function buildSyncInsertQueryData(ctx, queryData = {}) {
6252
+ const pickQueryData = (source, allowedKeys) => {
6253
+ const next = {};
6254
+ for (const key of allowedKeys) {
6255
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
6256
+ next[key] = source[key];
6257
+ }
6258
+ }
6259
+ return next;
6260
+ };
6252
6261
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
6253
6262
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
6254
6263
  const nextQueryData = {
6255
- ...existingQueryData,
6264
+ ...pickQueryData(existingQueryData, ["transaction"]),
6256
6265
  ...queryData
6257
6266
  };
6258
6267
  const resolvedData = Object.prototype.hasOwnProperty.call(ctx, "data") || ctx.data !== void 0 ? ctx.data : getJoinedContextValue(ctx, "data");
6259
6268
  const resolvedBatch = Object.prototype.hasOwnProperty.call(ctx, "batch") || ctx.batch !== void 0 ? ctx.batch : getJoinedContextValue(ctx, "batch");
6260
6269
  if (resolvedData !== void 0) {
6261
6270
  nextQueryData.data = resolvedData && typeof resolvedData === "object" && !Array.isArray(resolvedData) ? { ...resolvedData } : resolvedData;
6271
+ } else {
6272
+ delete nextQueryData.data;
6262
6273
  }
6263
6274
  if (resolvedBatch !== void 0) {
6264
6275
  nextQueryData.batch = Array.isArray(resolvedBatch) ? resolvedBatch.map(
6265
6276
  (row) => row && typeof row === "object" ? { ...row } : row
6266
6277
  ) : resolvedBatch;
6278
+ } else {
6279
+ delete nextQueryData.batch;
6267
6280
  }
6268
6281
  return nextQueryData;
6269
6282
  }
6283
+ function buildSyncQueryQueryData(ctx, queryData = {}) {
6284
+ const joinedQueryData = getJoinedContextValue(ctx, "queryData");
6285
+ const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
6286
+ const nextQueryData = {};
6287
+ const allowedKeys = [
6288
+ "transaction",
6289
+ "filter",
6290
+ "fields",
6291
+ "joins",
6292
+ "sort",
6293
+ "limit",
6294
+ "offset",
6295
+ "queryMode",
6296
+ "aggregates",
6297
+ "groupBy"
6298
+ ];
6299
+ for (const key of allowedKeys) {
6300
+ if (Object.prototype.hasOwnProperty.call(existingQueryData, key)) {
6301
+ nextQueryData[key] = existingQueryData[key];
6302
+ }
6303
+ }
6304
+ return {
6305
+ ...nextQueryData,
6306
+ ...queryData
6307
+ };
6308
+ }
6270
6309
  var REMOTE_AUTHORITY_SYNC_INSERT_CONCURRENCY = 5;
6271
6310
  var REMOTE_AUTHORITY_SYNC_QUERY_CONCURRENCY = 3;
6272
6311
  function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
@@ -6584,10 +6623,10 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
6584
6623
  });
6585
6624
  const prepareQueryTask = CadenzaService.createMetaTask(
6586
6625
  `Prepare graph sync query for ${tableName}`,
6587
- (ctx) => buildSyncExecutionEnvelope(ctx, {
6588
- ...ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {},
6589
- ...queryData
6590
- }),
6626
+ (ctx) => buildSyncExecutionEnvelope(
6627
+ ctx,
6628
+ buildSyncQueryQueryData(ctx, queryData)
6629
+ ),
6591
6630
  `Prepares ${tableName} graph-sync query payloads.`,
6592
6631
  {
6593
6632
  register: false,