@cadenza.io/service 2.17.58 → 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 +15 -87
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +15 -87
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +15 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -6263,93 +6263,23 @@ function wireSyncTaskGraph(predecessorTask, graph, ...completionTasks) {
|
|
|
6263
6263
|
}
|
|
6264
6264
|
return graph.completionTask;
|
|
6265
6265
|
}
|
|
6266
|
-
function resolveLocalDatabaseTaskIntent(task, operation, tableName) {
|
|
6267
|
-
if (!task) {
|
|
6268
|
-
return void 0;
|
|
6269
|
-
}
|
|
6270
|
-
const expectedPrefix = `${operation}-pg-`;
|
|
6271
|
-
const expectedSuffix = `-${tableName}`;
|
|
6272
|
-
const handledIntents = Array.from(task.handlesIntents ?? []);
|
|
6273
|
-
const directMatch = handledIntents.find(
|
|
6274
|
-
(intent) => typeof intent === "string" && intent.startsWith(expectedPrefix) && intent.endsWith(expectedSuffix)
|
|
6275
|
-
);
|
|
6276
|
-
if (directMatch) {
|
|
6277
|
-
return directMatch;
|
|
6278
|
-
}
|
|
6279
|
-
return handledIntents.find(
|
|
6280
|
-
(intent) => typeof intent === "string" && intent.startsWith(expectedPrefix)
|
|
6281
|
-
);
|
|
6282
|
-
}
|
|
6283
|
-
function buildAuthoritySyncIntentName(operation, tableName) {
|
|
6284
|
-
return `${operation}-pg-CadenzaDBPostgresActor-${tableName}`;
|
|
6285
|
-
}
|
|
6286
|
-
function createDatabaseInquiryTask(intentName, operation, tableName, options = {}) {
|
|
6287
|
-
return CadenzaService.createMetaTask(
|
|
6288
|
-
`Execute graph sync ${operation} for ${tableName}`,
|
|
6289
|
-
async (ctx, _emit, inquire) => {
|
|
6290
|
-
if (!intentName) {
|
|
6291
|
-
return {
|
|
6292
|
-
...ctx,
|
|
6293
|
-
errored: true,
|
|
6294
|
-
__success: false,
|
|
6295
|
-
__error: `No ${operation} intent found for ${tableName}`
|
|
6296
|
-
};
|
|
6297
|
-
}
|
|
6298
|
-
const inquiryContext = {
|
|
6299
|
-
...ctx,
|
|
6300
|
-
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {}
|
|
6301
|
-
};
|
|
6302
|
-
const result = await inquire(intentName, inquiryContext, {});
|
|
6303
|
-
const normalizedResult = result && typeof result === "object" ? result : {};
|
|
6304
|
-
if (Object.keys(normalizedResult).length === 0 && normalizedResult.errored !== true && normalizedResult.__success !== true && normalizedResult.__inquiryMeta === void 0) {
|
|
6305
|
-
return {
|
|
6306
|
-
...ctx,
|
|
6307
|
-
errored: true,
|
|
6308
|
-
__success: false,
|
|
6309
|
-
__error: `No responders available for ${intentName}`,
|
|
6310
|
-
__inquiryMeta: {
|
|
6311
|
-
inquiry: intentName,
|
|
6312
|
-
eligibleResponders: 0,
|
|
6313
|
-
responded: 0,
|
|
6314
|
-
failed: 0,
|
|
6315
|
-
timedOut: 0,
|
|
6316
|
-
pending: 0
|
|
6317
|
-
}
|
|
6318
|
-
};
|
|
6319
|
-
}
|
|
6320
|
-
return {
|
|
6321
|
-
...ctx,
|
|
6322
|
-
...normalizedResult
|
|
6323
|
-
};
|
|
6324
|
-
},
|
|
6325
|
-
`Executes the ${tableName} ${operation} operation through the generated database intent.`,
|
|
6326
|
-
{
|
|
6327
|
-
...options,
|
|
6328
|
-
register: false,
|
|
6329
|
-
isHidden: true
|
|
6330
|
-
}
|
|
6331
|
-
);
|
|
6332
|
-
}
|
|
6333
6266
|
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
6334
6267
|
const localInsertTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName);
|
|
6335
6268
|
const debugTable = shouldDebugSyncTable(tableName);
|
|
6336
6269
|
if (!localInsertTask && !isCadenzaDBReady) {
|
|
6337
6270
|
return void 0;
|
|
6338
6271
|
}
|
|
6339
|
-
const
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
options
|
|
6345
|
-
);
|
|
6272
|
+
const targetTask = localInsertTask ?? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, {
|
|
6273
|
+
...options,
|
|
6274
|
+
register: false,
|
|
6275
|
+
isHidden: true
|
|
6276
|
+
});
|
|
6346
6277
|
if (debugTable) {
|
|
6347
6278
|
logSyncDebug("insert_task_resolved", {
|
|
6348
6279
|
tableName,
|
|
6349
6280
|
localInsertTaskName: localInsertTask?.name ?? null,
|
|
6350
|
-
remoteInsertTaskName: isCadenzaDBReady ?
|
|
6281
|
+
remoteInsertTaskName: isCadenzaDBReady ? targetTask.name : null,
|
|
6351
6282
|
targetTaskName: targetTask.name,
|
|
6352
|
-
targetIntentName,
|
|
6353
6283
|
queryData,
|
|
6354
6284
|
options
|
|
6355
6285
|
});
|
|
@@ -6508,10 +6438,10 @@ var SYNC_DEBUG_INTENT_NAMES = /* @__PURE__ */ new Set([
|
|
|
6508
6438
|
"iot-anomaly-runtime-get",
|
|
6509
6439
|
"iot-prediction-compute",
|
|
6510
6440
|
"iot-db-telemetry-insert",
|
|
6511
|
-
"query-pg-
|
|
6512
|
-
"query-pg-
|
|
6513
|
-
"query-pg-
|
|
6514
|
-
"query-pg-
|
|
6441
|
+
"query-pg-cadenza-db-postgres-actor-service_instance",
|
|
6442
|
+
"query-pg-cadenza-db-postgres-actor-service_instance_transport",
|
|
6443
|
+
"query-pg-cadenza-db-postgres-actor-intent_to_task_map",
|
|
6444
|
+
"query-pg-cadenza-db-postgres-actor-signal_to_task_map"
|
|
6515
6445
|
]);
|
|
6516
6446
|
function shouldDebugSyncTable(tableName) {
|
|
6517
6447
|
return SYNC_DEBUG_TABLES.has(tableName);
|
|
@@ -6620,13 +6550,11 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
|
|
|
6620
6550
|
if (!localQueryTask && !isCadenzaDBReady) {
|
|
6621
6551
|
return void 0;
|
|
6622
6552
|
}
|
|
6623
|
-
const
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
options
|
|
6629
|
-
);
|
|
6553
|
+
const targetTask = localQueryTask ?? CadenzaService.createCadenzaDBQueryTask(tableName, queryData, {
|
|
6554
|
+
...options,
|
|
6555
|
+
register: false,
|
|
6556
|
+
isHidden: true
|
|
6557
|
+
});
|
|
6630
6558
|
const prepareQueryTask = CadenzaService.createMetaTask(
|
|
6631
6559
|
`Prepare graph sync query for ${tableName}`,
|
|
6632
6560
|
(ctx) => ({
|