@cadenza.io/service 2.17.57 → 2.17.59
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 +47 -17
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +47 -17
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +47 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -6231,17 +6231,19 @@ function resolveLocalDatabaseTaskIntent(task, operation, tableName) {
|
|
|
6231
6231
|
(intent) => typeof intent === "string" && intent.startsWith(expectedPrefix)
|
|
6232
6232
|
);
|
|
6233
6233
|
}
|
|
6234
|
-
function
|
|
6235
|
-
|
|
6234
|
+
function buildAuthoritySyncIntentName(operation, tableName) {
|
|
6235
|
+
return `${operation}-pg-cadenza-db-postgres-actor-${tableName}`;
|
|
6236
|
+
}
|
|
6237
|
+
function createDatabaseInquiryTask(intentName, operation, tableName, options = {}) {
|
|
6236
6238
|
return CadenzaService.createMetaTask(
|
|
6237
|
-
`Execute
|
|
6239
|
+
`Execute graph sync ${operation} for ${tableName}`,
|
|
6238
6240
|
async (ctx, _emit, inquire) => {
|
|
6239
6241
|
if (!intentName) {
|
|
6240
6242
|
return {
|
|
6241
6243
|
...ctx,
|
|
6242
6244
|
errored: true,
|
|
6243
6245
|
__success: false,
|
|
6244
|
-
__error: `No
|
|
6246
|
+
__error: `No ${operation} intent found for ${tableName}`
|
|
6245
6247
|
};
|
|
6246
6248
|
}
|
|
6247
6249
|
const inquiryContext = {
|
|
@@ -6249,12 +6251,29 @@ function createLocalDatabaseInquiryTask(localTask, operation, tableName, options
|
|
|
6249
6251
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {}
|
|
6250
6252
|
};
|
|
6251
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
|
+
}
|
|
6252
6271
|
return {
|
|
6253
6272
|
...ctx,
|
|
6254
|
-
...
|
|
6273
|
+
...normalizedResult
|
|
6255
6274
|
};
|
|
6256
6275
|
},
|
|
6257
|
-
`Executes the
|
|
6276
|
+
`Executes the ${tableName} ${operation} operation through the generated database intent.`,
|
|
6258
6277
|
{
|
|
6259
6278
|
...options,
|
|
6260
6279
|
register: false,
|
|
@@ -6264,18 +6283,24 @@ function createLocalDatabaseInquiryTask(localTask, operation, tableName, options
|
|
|
6264
6283
|
}
|
|
6265
6284
|
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
6266
6285
|
const localInsertTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName);
|
|
6267
|
-
const remoteInsertTask = isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, options) : void 0;
|
|
6268
6286
|
const debugTable = shouldDebugSyncTable(tableName);
|
|
6269
|
-
if (!localInsertTask && !
|
|
6287
|
+
if (!localInsertTask && !isCadenzaDBReady) {
|
|
6270
6288
|
return void 0;
|
|
6271
6289
|
}
|
|
6272
|
-
const
|
|
6290
|
+
const targetIntentName = resolveLocalDatabaseTaskIntent(localInsertTask, "insert", tableName) ?? buildAuthoritySyncIntentName("insert", tableName);
|
|
6291
|
+
const targetTask = createDatabaseInquiryTask(
|
|
6292
|
+
targetIntentName,
|
|
6293
|
+
"insert",
|
|
6294
|
+
tableName,
|
|
6295
|
+
options
|
|
6296
|
+
);
|
|
6273
6297
|
if (debugTable) {
|
|
6274
6298
|
logSyncDebug("insert_task_resolved", {
|
|
6275
6299
|
tableName,
|
|
6276
6300
|
localInsertTaskName: localInsertTask?.name ?? null,
|
|
6277
|
-
remoteInsertTaskName:
|
|
6301
|
+
remoteInsertTaskName: isCadenzaDBReady ? targetIntentName : null,
|
|
6278
6302
|
targetTaskName: targetTask.name,
|
|
6303
|
+
targetIntentName,
|
|
6279
6304
|
queryData,
|
|
6280
6305
|
options
|
|
6281
6306
|
});
|
|
@@ -6434,10 +6459,10 @@ var SYNC_DEBUG_INTENT_NAMES = /* @__PURE__ */ new Set([
|
|
|
6434
6459
|
"iot-anomaly-runtime-get",
|
|
6435
6460
|
"iot-prediction-compute",
|
|
6436
6461
|
"iot-db-telemetry-insert",
|
|
6437
|
-
"query-pg-
|
|
6438
|
-
"query-pg-
|
|
6439
|
-
"query-pg-
|
|
6440
|
-
"query-pg-
|
|
6462
|
+
"query-pg-cadenza-db-postgres-actor-service_instance",
|
|
6463
|
+
"query-pg-cadenza-db-postgres-actor-service_instance_transport",
|
|
6464
|
+
"query-pg-cadenza-db-postgres-actor-intent_to_task_map",
|
|
6465
|
+
"query-pg-cadenza-db-postgres-actor-signal_to_task_map"
|
|
6441
6466
|
]);
|
|
6442
6467
|
function shouldDebugSyncTable(tableName) {
|
|
6443
6468
|
return SYNC_DEBUG_TABLES.has(tableName);
|
|
@@ -6543,11 +6568,16 @@ function resolveSyncQueryRows(ctx, tableName) {
|
|
|
6543
6568
|
}
|
|
6544
6569
|
function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
6545
6570
|
const localQueryTask = CadenzaService.getLocalCadenzaDBQueryTask(tableName);
|
|
6546
|
-
|
|
6547
|
-
if (!localQueryTask && !remoteQueryTask) {
|
|
6571
|
+
if (!localQueryTask && !isCadenzaDBReady) {
|
|
6548
6572
|
return void 0;
|
|
6549
6573
|
}
|
|
6550
|
-
const
|
|
6574
|
+
const targetIntentName = resolveLocalDatabaseTaskIntent(localQueryTask, "query", tableName) ?? buildAuthoritySyncIntentName("query", tableName);
|
|
6575
|
+
const targetTask = createDatabaseInquiryTask(
|
|
6576
|
+
targetIntentName,
|
|
6577
|
+
"query",
|
|
6578
|
+
tableName,
|
|
6579
|
+
options
|
|
6580
|
+
);
|
|
6551
6581
|
const prepareQueryTask = CadenzaService.createMetaTask(
|
|
6552
6582
|
`Prepare graph sync query for ${tableName}`,
|
|
6553
6583
|
(ctx) => ({
|