@cadenza.io/service 2.17.69 → 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/browser/index.js +72 -17
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +72 -17
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +72 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8812,24 +8812,65 @@ 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
|
+
}
|
|
8872
|
+
var REMOTE_AUTHORITY_SYNC_INSERT_CONCURRENCY = 5;
|
|
8873
|
+
var REMOTE_AUTHORITY_SYNC_QUERY_CONCURRENCY = 3;
|
|
8833
8874
|
function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
|
|
8834
8875
|
if (!graph) {
|
|
8835
8876
|
return void 0;
|
|
@@ -8840,6 +8881,20 @@ function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
|
|
|
8840
8881
|
}
|
|
8841
8882
|
return graph.completionTask;
|
|
8842
8883
|
}
|
|
8884
|
+
function buildSyncExecutionEnvelope(ctx, queryData) {
|
|
8885
|
+
const originalContext = { ...ctx };
|
|
8886
|
+
const nextContext = {
|
|
8887
|
+
__syncing: ctx.__syncing === true || ctx.__metadata?.__syncing === true || false,
|
|
8888
|
+
__preferredTransportProtocol: "rest",
|
|
8889
|
+
__resolverOriginalContext: originalContext,
|
|
8890
|
+
__resolverQueryData: queryData,
|
|
8891
|
+
queryData
|
|
8892
|
+
};
|
|
8893
|
+
if (typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0) {
|
|
8894
|
+
nextContext.__reason = ctx.__reason;
|
|
8895
|
+
}
|
|
8896
|
+
return nextContext;
|
|
8897
|
+
}
|
|
8843
8898
|
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
8844
8899
|
const localInsertTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName);
|
|
8845
8900
|
const debugTable = shouldDebugSyncTable(tableName);
|
|
@@ -8848,6 +8903,10 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8848
8903
|
}
|
|
8849
8904
|
const targetTask = localInsertTask ?? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, {
|
|
8850
8905
|
...options,
|
|
8906
|
+
concurrency: Number(options.concurrency) > 0 ? Math.min(
|
|
8907
|
+
Number(options.concurrency),
|
|
8908
|
+
REMOTE_AUTHORITY_SYNC_INSERT_CONCURRENCY
|
|
8909
|
+
) : REMOTE_AUTHORITY_SYNC_INSERT_CONCURRENCY,
|
|
8851
8910
|
register: false,
|
|
8852
8911
|
isHidden: true
|
|
8853
8912
|
});
|
|
@@ -8864,18 +8923,14 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8864
8923
|
const prepareExecutionTask = CadenzaService.createMetaTask(
|
|
8865
8924
|
`Prepare graph sync insert for ${tableName}`,
|
|
8866
8925
|
(ctx) => {
|
|
8867
|
-
const originalContext = { ...ctx };
|
|
8868
8926
|
const originalQueryData = buildSyncInsertQueryData(
|
|
8869
8927
|
ctx,
|
|
8870
8928
|
queryData
|
|
8871
8929
|
);
|
|
8872
|
-
return
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
__resolverQueryData: originalQueryData,
|
|
8877
|
-
queryData: originalQueryData
|
|
8878
|
-
};
|
|
8930
|
+
return buildSyncExecutionEnvelope(
|
|
8931
|
+
ctx,
|
|
8932
|
+
originalQueryData
|
|
8933
|
+
);
|
|
8879
8934
|
},
|
|
8880
8935
|
`Prepares ${tableName} graph-sync insert payloads for runner execution.`,
|
|
8881
8936
|
{
|
|
@@ -9122,19 +9177,19 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
|
|
|
9122
9177
|
}
|
|
9123
9178
|
const targetTask = localQueryTask ?? CadenzaService.createCadenzaDBQueryTask(tableName, queryData, {
|
|
9124
9179
|
...options,
|
|
9180
|
+
concurrency: Number(options.concurrency) > 0 ? Math.min(
|
|
9181
|
+
Number(options.concurrency),
|
|
9182
|
+
REMOTE_AUTHORITY_SYNC_QUERY_CONCURRENCY
|
|
9183
|
+
) : REMOTE_AUTHORITY_SYNC_QUERY_CONCURRENCY,
|
|
9125
9184
|
register: false,
|
|
9126
9185
|
isHidden: true
|
|
9127
9186
|
});
|
|
9128
9187
|
const prepareQueryTask = CadenzaService.createMetaTask(
|
|
9129
9188
|
`Prepare graph sync query for ${tableName}`,
|
|
9130
|
-
(ctx) => (
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
...ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {},
|
|
9135
|
-
...queryData
|
|
9136
|
-
}
|
|
9137
|
-
}),
|
|
9189
|
+
(ctx) => buildSyncExecutionEnvelope(
|
|
9190
|
+
ctx,
|
|
9191
|
+
buildSyncQueryQueryData(ctx, queryData)
|
|
9192
|
+
),
|
|
9138
9193
|
`Prepares ${tableName} graph-sync query payloads.`,
|
|
9139
9194
|
{
|
|
9140
9195
|
register: false,
|