@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.
@@ -6200,24 +6200,63 @@ function buildMinimalSyncSignalContext(ctx, extra = {}) {
6200
6200
  return nextContext;
6201
6201
  }
6202
6202
  function buildSyncInsertQueryData(ctx, queryData = {}) {
6203
+ const pickQueryData = (source, allowedKeys) => {
6204
+ const next = {};
6205
+ for (const key of allowedKeys) {
6206
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
6207
+ next[key] = source[key];
6208
+ }
6209
+ }
6210
+ return next;
6211
+ };
6203
6212
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
6204
6213
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
6205
6214
  const nextQueryData = {
6206
- ...existingQueryData,
6215
+ ...pickQueryData(existingQueryData, ["transaction"]),
6207
6216
  ...queryData
6208
6217
  };
6209
6218
  const resolvedData = Object.prototype.hasOwnProperty.call(ctx, "data") || ctx.data !== void 0 ? ctx.data : getJoinedContextValue(ctx, "data");
6210
6219
  const resolvedBatch = Object.prototype.hasOwnProperty.call(ctx, "batch") || ctx.batch !== void 0 ? ctx.batch : getJoinedContextValue(ctx, "batch");
6211
6220
  if (resolvedData !== void 0) {
6212
6221
  nextQueryData.data = resolvedData && typeof resolvedData === "object" && !Array.isArray(resolvedData) ? { ...resolvedData } : resolvedData;
6222
+ } else {
6223
+ delete nextQueryData.data;
6213
6224
  }
6214
6225
  if (resolvedBatch !== void 0) {
6215
6226
  nextQueryData.batch = Array.isArray(resolvedBatch) ? resolvedBatch.map(
6216
6227
  (row) => row && typeof row === "object" ? { ...row } : row
6217
6228
  ) : resolvedBatch;
6229
+ } else {
6230
+ delete nextQueryData.batch;
6218
6231
  }
6219
6232
  return nextQueryData;
6220
6233
  }
6234
+ function buildSyncQueryQueryData(ctx, queryData = {}) {
6235
+ const joinedQueryData = getJoinedContextValue(ctx, "queryData");
6236
+ const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
6237
+ const nextQueryData = {};
6238
+ const allowedKeys = [
6239
+ "transaction",
6240
+ "filter",
6241
+ "fields",
6242
+ "joins",
6243
+ "sort",
6244
+ "limit",
6245
+ "offset",
6246
+ "queryMode",
6247
+ "aggregates",
6248
+ "groupBy"
6249
+ ];
6250
+ for (const key of allowedKeys) {
6251
+ if (Object.prototype.hasOwnProperty.call(existingQueryData, key)) {
6252
+ nextQueryData[key] = existingQueryData[key];
6253
+ }
6254
+ }
6255
+ return {
6256
+ ...nextQueryData,
6257
+ ...queryData
6258
+ };
6259
+ }
6221
6260
  var REMOTE_AUTHORITY_SYNC_INSERT_CONCURRENCY = 5;
6222
6261
  var REMOTE_AUTHORITY_SYNC_QUERY_CONCURRENCY = 3;
6223
6262
  function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
@@ -6535,10 +6574,10 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
6535
6574
  });
6536
6575
  const prepareQueryTask = CadenzaService.createMetaTask(
6537
6576
  `Prepare graph sync query for ${tableName}`,
6538
- (ctx) => buildSyncExecutionEnvelope(ctx, {
6539
- ...ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {},
6540
- ...queryData
6541
- }),
6577
+ (ctx) => buildSyncExecutionEnvelope(
6578
+ ctx,
6579
+ buildSyncQueryQueryData(ctx, queryData)
6580
+ ),
6542
6581
  `Prepares ${tableName} graph-sync query payloads.`,
6543
6582
  {
6544
6583
  register: false,