@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.
package/dist/index.mjs CHANGED
@@ -8763,24 +8763,63 @@ function buildMinimalSyncSignalContext(ctx, extra = {}) {
8763
8763
  return nextContext;
8764
8764
  }
8765
8765
  function buildSyncInsertQueryData(ctx, queryData = {}) {
8766
+ const pickQueryData = (source, allowedKeys) => {
8767
+ const next = {};
8768
+ for (const key of allowedKeys) {
8769
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
8770
+ next[key] = source[key];
8771
+ }
8772
+ }
8773
+ return next;
8774
+ };
8766
8775
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
8767
8776
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
8768
8777
  const nextQueryData = {
8769
- ...existingQueryData,
8778
+ ...pickQueryData(existingQueryData, ["transaction"]),
8770
8779
  ...queryData
8771
8780
  };
8772
8781
  const resolvedData = Object.prototype.hasOwnProperty.call(ctx, "data") || ctx.data !== void 0 ? ctx.data : getJoinedContextValue(ctx, "data");
8773
8782
  const resolvedBatch = Object.prototype.hasOwnProperty.call(ctx, "batch") || ctx.batch !== void 0 ? ctx.batch : getJoinedContextValue(ctx, "batch");
8774
8783
  if (resolvedData !== void 0) {
8775
8784
  nextQueryData.data = resolvedData && typeof resolvedData === "object" && !Array.isArray(resolvedData) ? { ...resolvedData } : resolvedData;
8785
+ } else {
8786
+ delete nextQueryData.data;
8776
8787
  }
8777
8788
  if (resolvedBatch !== void 0) {
8778
8789
  nextQueryData.batch = Array.isArray(resolvedBatch) ? resolvedBatch.map(
8779
8790
  (row) => row && typeof row === "object" ? { ...row } : row
8780
8791
  ) : resolvedBatch;
8792
+ } else {
8793
+ delete nextQueryData.batch;
8781
8794
  }
8782
8795
  return nextQueryData;
8783
8796
  }
8797
+ function buildSyncQueryQueryData(ctx, queryData = {}) {
8798
+ const joinedQueryData = getJoinedContextValue(ctx, "queryData");
8799
+ const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
8800
+ const nextQueryData = {};
8801
+ const allowedKeys = [
8802
+ "transaction",
8803
+ "filter",
8804
+ "fields",
8805
+ "joins",
8806
+ "sort",
8807
+ "limit",
8808
+ "offset",
8809
+ "queryMode",
8810
+ "aggregates",
8811
+ "groupBy"
8812
+ ];
8813
+ for (const key of allowedKeys) {
8814
+ if (Object.prototype.hasOwnProperty.call(existingQueryData, key)) {
8815
+ nextQueryData[key] = existingQueryData[key];
8816
+ }
8817
+ }
8818
+ return {
8819
+ ...nextQueryData,
8820
+ ...queryData
8821
+ };
8822
+ }
8784
8823
  var REMOTE_AUTHORITY_SYNC_INSERT_CONCURRENCY = 5;
8785
8824
  var REMOTE_AUTHORITY_SYNC_QUERY_CONCURRENCY = 3;
8786
8825
  function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
@@ -9098,10 +9137,10 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
9098
9137
  });
9099
9138
  const prepareQueryTask = CadenzaService.createMetaTask(
9100
9139
  `Prepare graph sync query for ${tableName}`,
9101
- (ctx) => buildSyncExecutionEnvelope(ctx, {
9102
- ...ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {},
9103
- ...queryData
9104
- }),
9140
+ (ctx) => buildSyncExecutionEnvelope(
9141
+ ctx,
9142
+ buildSyncQueryQueryData(ctx, queryData)
9143
+ ),
9105
9144
  `Prepares ${tableName} graph-sync query payloads.`,
9106
9145
  {
9107
9146
  register: false,