@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.js CHANGED
@@ -8812,24 +8812,63 @@ function buildMinimalSyncSignalContext(ctx, extra = {}) {
8812
8812
  return nextContext;
8813
8813
  }
8814
8814
  function buildSyncInsertQueryData(ctx, queryData = {}) {
8815
+ const pickQueryData = (source, allowedKeys) => {
8816
+ const next = {};
8817
+ for (const key of allowedKeys) {
8818
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
8819
+ next[key] = source[key];
8820
+ }
8821
+ }
8822
+ return next;
8823
+ };
8815
8824
  const joinedQueryData = getJoinedContextValue(ctx, "queryData");
8816
8825
  const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
8817
8826
  const nextQueryData = {
8818
- ...existingQueryData,
8827
+ ...pickQueryData(existingQueryData, ["transaction"]),
8819
8828
  ...queryData
8820
8829
  };
8821
8830
  const resolvedData = Object.prototype.hasOwnProperty.call(ctx, "data") || ctx.data !== void 0 ? ctx.data : getJoinedContextValue(ctx, "data");
8822
8831
  const resolvedBatch = Object.prototype.hasOwnProperty.call(ctx, "batch") || ctx.batch !== void 0 ? ctx.batch : getJoinedContextValue(ctx, "batch");
8823
8832
  if (resolvedData !== void 0) {
8824
8833
  nextQueryData.data = resolvedData && typeof resolvedData === "object" && !Array.isArray(resolvedData) ? { ...resolvedData } : resolvedData;
8834
+ } else {
8835
+ delete nextQueryData.data;
8825
8836
  }
8826
8837
  if (resolvedBatch !== void 0) {
8827
8838
  nextQueryData.batch = Array.isArray(resolvedBatch) ? resolvedBatch.map(
8828
8839
  (row) => row && typeof row === "object" ? { ...row } : row
8829
8840
  ) : resolvedBatch;
8841
+ } else {
8842
+ delete nextQueryData.batch;
8830
8843
  }
8831
8844
  return nextQueryData;
8832
8845
  }
8846
+ function buildSyncQueryQueryData(ctx, queryData = {}) {
8847
+ const joinedQueryData = getJoinedContextValue(ctx, "queryData");
8848
+ const existingQueryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : joinedQueryData && typeof joinedQueryData === "object" ? joinedQueryData : {};
8849
+ const nextQueryData = {};
8850
+ const allowedKeys = [
8851
+ "transaction",
8852
+ "filter",
8853
+ "fields",
8854
+ "joins",
8855
+ "sort",
8856
+ "limit",
8857
+ "offset",
8858
+ "queryMode",
8859
+ "aggregates",
8860
+ "groupBy"
8861
+ ];
8862
+ for (const key of allowedKeys) {
8863
+ if (Object.prototype.hasOwnProperty.call(existingQueryData, key)) {
8864
+ nextQueryData[key] = existingQueryData[key];
8865
+ }
8866
+ }
8867
+ return {
8868
+ ...nextQueryData,
8869
+ ...queryData
8870
+ };
8871
+ }
8833
8872
  var REMOTE_AUTHORITY_SYNC_INSERT_CONCURRENCY = 5;
8834
8873
  var REMOTE_AUTHORITY_SYNC_QUERY_CONCURRENCY = 3;
8835
8874
  function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
@@ -9147,10 +9186,10 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
9147
9186
  });
9148
9187
  const prepareQueryTask = CadenzaService.createMetaTask(
9149
9188
  `Prepare graph sync query for ${tableName}`,
9150
- (ctx) => buildSyncExecutionEnvelope(ctx, {
9151
- ...ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {},
9152
- ...queryData
9153
- }),
9189
+ (ctx) => buildSyncExecutionEnvelope(
9190
+ ctx,
9191
+ buildSyncQueryQueryData(ctx, queryData)
9192
+ ),
9154
9193
  `Prepares ${tableName} graph-sync query payloads.`,
9155
9194
  {
9156
9195
  register: false,