@cadenza.io/service 2.17.59 → 2.17.60
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 +11 -83
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +11 -83
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +11 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -6214,93 +6214,23 @@ function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
|
|
|
6214
6214
|
}
|
|
6215
6215
|
return graph.completionTask;
|
|
6216
6216
|
}
|
|
6217
|
-
function resolveLocalDatabaseTaskIntent(task, operation, tableName) {
|
|
6218
|
-
if (!task) {
|
|
6219
|
-
return void 0;
|
|
6220
|
-
}
|
|
6221
|
-
const expectedPrefix = `${operation}-pg-`;
|
|
6222
|
-
const expectedSuffix = `-${tableName}`;
|
|
6223
|
-
const handledIntents = Array.from(task.handlesIntents ?? []);
|
|
6224
|
-
const directMatch = handledIntents.find(
|
|
6225
|
-
(intent) => typeof intent === "string" && intent.startsWith(expectedPrefix) && intent.endsWith(expectedSuffix)
|
|
6226
|
-
);
|
|
6227
|
-
if (directMatch) {
|
|
6228
|
-
return directMatch;
|
|
6229
|
-
}
|
|
6230
|
-
return handledIntents.find(
|
|
6231
|
-
(intent) => typeof intent === "string" && intent.startsWith(expectedPrefix)
|
|
6232
|
-
);
|
|
6233
|
-
}
|
|
6234
|
-
function buildAuthoritySyncIntentName(operation, tableName) {
|
|
6235
|
-
return `${operation}-pg-cadenza-db-postgres-actor-${tableName}`;
|
|
6236
|
-
}
|
|
6237
|
-
function createDatabaseInquiryTask(intentName, operation, tableName, options = {}) {
|
|
6238
|
-
return CadenzaService.createMetaTask(
|
|
6239
|
-
`Execute graph sync ${operation} for ${tableName}`,
|
|
6240
|
-
async (ctx, _emit, inquire) => {
|
|
6241
|
-
if (!intentName) {
|
|
6242
|
-
return {
|
|
6243
|
-
...ctx,
|
|
6244
|
-
errored: true,
|
|
6245
|
-
__success: false,
|
|
6246
|
-
__error: `No ${operation} intent found for ${tableName}`
|
|
6247
|
-
};
|
|
6248
|
-
}
|
|
6249
|
-
const inquiryContext = {
|
|
6250
|
-
...ctx,
|
|
6251
|
-
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {}
|
|
6252
|
-
};
|
|
6253
|
-
const result = await inquire(intentName, inquiryContext, {});
|
|
6254
|
-
const normalizedResult = result && typeof result === "object" ? result : {};
|
|
6255
|
-
if (Object.keys(normalizedResult).length === 0 && normalizedResult.errored !== true && normalizedResult.__success !== true && normalizedResult.__inquiryMeta === void 0) {
|
|
6256
|
-
return {
|
|
6257
|
-
...ctx,
|
|
6258
|
-
errored: true,
|
|
6259
|
-
__success: false,
|
|
6260
|
-
__error: `No responders available for ${intentName}`,
|
|
6261
|
-
__inquiryMeta: {
|
|
6262
|
-
inquiry: intentName,
|
|
6263
|
-
eligibleResponders: 0,
|
|
6264
|
-
responded: 0,
|
|
6265
|
-
failed: 0,
|
|
6266
|
-
timedOut: 0,
|
|
6267
|
-
pending: 0
|
|
6268
|
-
}
|
|
6269
|
-
};
|
|
6270
|
-
}
|
|
6271
|
-
return {
|
|
6272
|
-
...ctx,
|
|
6273
|
-
...normalizedResult
|
|
6274
|
-
};
|
|
6275
|
-
},
|
|
6276
|
-
`Executes the ${tableName} ${operation} operation through the generated database intent.`,
|
|
6277
|
-
{
|
|
6278
|
-
...options,
|
|
6279
|
-
register: false,
|
|
6280
|
-
isHidden: true
|
|
6281
|
-
}
|
|
6282
|
-
);
|
|
6283
|
-
}
|
|
6284
6217
|
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
6285
6218
|
const localInsertTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName);
|
|
6286
6219
|
const debugTable = shouldDebugSyncTable(tableName);
|
|
6287
6220
|
if (!localInsertTask && !isCadenzaDBReady) {
|
|
6288
6221
|
return void 0;
|
|
6289
6222
|
}
|
|
6290
|
-
const
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
options
|
|
6296
|
-
);
|
|
6223
|
+
const targetTask = localInsertTask ?? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, {
|
|
6224
|
+
...options,
|
|
6225
|
+
register: false,
|
|
6226
|
+
isHidden: true
|
|
6227
|
+
});
|
|
6297
6228
|
if (debugTable) {
|
|
6298
6229
|
logSyncDebug("insert_task_resolved", {
|
|
6299
6230
|
tableName,
|
|
6300
6231
|
localInsertTaskName: localInsertTask?.name ?? null,
|
|
6301
|
-
remoteInsertTaskName: isCadenzaDBReady ?
|
|
6232
|
+
remoteInsertTaskName: isCadenzaDBReady ? targetTask.name : null,
|
|
6302
6233
|
targetTaskName: targetTask.name,
|
|
6303
|
-
targetIntentName,
|
|
6304
6234
|
queryData,
|
|
6305
6235
|
options
|
|
6306
6236
|
});
|
|
@@ -6571,13 +6501,11 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
|
|
|
6571
6501
|
if (!localQueryTask && !isCadenzaDBReady) {
|
|
6572
6502
|
return void 0;
|
|
6573
6503
|
}
|
|
6574
|
-
const
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
options
|
|
6580
|
-
);
|
|
6504
|
+
const targetTask = localQueryTask ?? CadenzaService.createCadenzaDBQueryTask(tableName, queryData, {
|
|
6505
|
+
...options,
|
|
6506
|
+
register: false,
|
|
6507
|
+
isHidden: true
|
|
6508
|
+
});
|
|
6581
6509
|
const prepareQueryTask = CadenzaService.createMetaTask(
|
|
6582
6510
|
`Prepare graph sync query for ${tableName}`,
|
|
6583
6511
|
(ctx) => ({
|