@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/index.js
CHANGED
|
@@ -8836,17 +8836,19 @@ function resolveLocalDatabaseTaskIntent(task, operation, tableName) {
|
|
|
8836
8836
|
(intent) => typeof intent === "string" && intent.startsWith(expectedPrefix)
|
|
8837
8837
|
);
|
|
8838
8838
|
}
|
|
8839
|
-
function
|
|
8840
|
-
|
|
8839
|
+
function buildAuthoritySyncIntentName(operation, tableName) {
|
|
8840
|
+
return `${operation}-pg-cadenza-db-postgres-actor-${tableName}`;
|
|
8841
|
+
}
|
|
8842
|
+
function createDatabaseInquiryTask(intentName, operation, tableName, options = {}) {
|
|
8841
8843
|
return CadenzaService.createMetaTask(
|
|
8842
|
-
`Execute
|
|
8844
|
+
`Execute graph sync ${operation} for ${tableName}`,
|
|
8843
8845
|
async (ctx, _emit, inquire) => {
|
|
8844
8846
|
if (!intentName) {
|
|
8845
8847
|
return {
|
|
8846
8848
|
...ctx,
|
|
8847
8849
|
errored: true,
|
|
8848
8850
|
__success: false,
|
|
8849
|
-
__error: `No
|
|
8851
|
+
__error: `No ${operation} intent found for ${tableName}`
|
|
8850
8852
|
};
|
|
8851
8853
|
}
|
|
8852
8854
|
const inquiryContext = {
|
|
@@ -8854,12 +8856,29 @@ function createLocalDatabaseInquiryTask(localTask, operation, tableName, options
|
|
|
8854
8856
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {}
|
|
8855
8857
|
};
|
|
8856
8858
|
const result = await inquire(intentName, inquiryContext, {});
|
|
8859
|
+
const normalizedResult = result && typeof result === "object" ? result : {};
|
|
8860
|
+
if (Object.keys(normalizedResult).length === 0 && normalizedResult.errored !== true && normalizedResult.__success !== true && normalizedResult.__inquiryMeta === void 0) {
|
|
8861
|
+
return {
|
|
8862
|
+
...ctx,
|
|
8863
|
+
errored: true,
|
|
8864
|
+
__success: false,
|
|
8865
|
+
__error: `No responders available for ${intentName}`,
|
|
8866
|
+
__inquiryMeta: {
|
|
8867
|
+
inquiry: intentName,
|
|
8868
|
+
eligibleResponders: 0,
|
|
8869
|
+
responded: 0,
|
|
8870
|
+
failed: 0,
|
|
8871
|
+
timedOut: 0,
|
|
8872
|
+
pending: 0
|
|
8873
|
+
}
|
|
8874
|
+
};
|
|
8875
|
+
}
|
|
8857
8876
|
return {
|
|
8858
8877
|
...ctx,
|
|
8859
|
-
...
|
|
8878
|
+
...normalizedResult
|
|
8860
8879
|
};
|
|
8861
8880
|
},
|
|
8862
|
-
`Executes the
|
|
8881
|
+
`Executes the ${tableName} ${operation} operation through the generated database intent.`,
|
|
8863
8882
|
{
|
|
8864
8883
|
...options,
|
|
8865
8884
|
register: false,
|
|
@@ -8869,18 +8888,24 @@ function createLocalDatabaseInquiryTask(localTask, operation, tableName, options
|
|
|
8869
8888
|
}
|
|
8870
8889
|
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
8871
8890
|
const localInsertTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName);
|
|
8872
|
-
const remoteInsertTask = isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, options) : void 0;
|
|
8873
8891
|
const debugTable = shouldDebugSyncTable(tableName);
|
|
8874
|
-
if (!localInsertTask && !
|
|
8892
|
+
if (!localInsertTask && !isCadenzaDBReady) {
|
|
8875
8893
|
return void 0;
|
|
8876
8894
|
}
|
|
8877
|
-
const
|
|
8895
|
+
const targetIntentName = resolveLocalDatabaseTaskIntent(localInsertTask, "insert", tableName) ?? buildAuthoritySyncIntentName("insert", tableName);
|
|
8896
|
+
const targetTask = createDatabaseInquiryTask(
|
|
8897
|
+
targetIntentName,
|
|
8898
|
+
"insert",
|
|
8899
|
+
tableName,
|
|
8900
|
+
options
|
|
8901
|
+
);
|
|
8878
8902
|
if (debugTable) {
|
|
8879
8903
|
logSyncDebug("insert_task_resolved", {
|
|
8880
8904
|
tableName,
|
|
8881
8905
|
localInsertTaskName: localInsertTask?.name ?? null,
|
|
8882
|
-
remoteInsertTaskName:
|
|
8906
|
+
remoteInsertTaskName: isCadenzaDBReady ? targetIntentName : null,
|
|
8883
8907
|
targetTaskName: targetTask.name,
|
|
8908
|
+
targetIntentName,
|
|
8884
8909
|
queryData,
|
|
8885
8910
|
options
|
|
8886
8911
|
});
|
|
@@ -9039,10 +9064,10 @@ var SYNC_DEBUG_INTENT_NAMES = /* @__PURE__ */ new Set([
|
|
|
9039
9064
|
"iot-anomaly-runtime-get",
|
|
9040
9065
|
"iot-prediction-compute",
|
|
9041
9066
|
"iot-db-telemetry-insert",
|
|
9042
|
-
"query-pg-
|
|
9043
|
-
"query-pg-
|
|
9044
|
-
"query-pg-
|
|
9045
|
-
"query-pg-
|
|
9067
|
+
"query-pg-cadenza-db-postgres-actor-service_instance",
|
|
9068
|
+
"query-pg-cadenza-db-postgres-actor-service_instance_transport",
|
|
9069
|
+
"query-pg-cadenza-db-postgres-actor-intent_to_task_map",
|
|
9070
|
+
"query-pg-cadenza-db-postgres-actor-signal_to_task_map"
|
|
9046
9071
|
]);
|
|
9047
9072
|
function shouldDebugSyncTable(tableName) {
|
|
9048
9073
|
return SYNC_DEBUG_TABLES.has(tableName);
|
|
@@ -9148,11 +9173,16 @@ function resolveSyncQueryRows(ctx, tableName) {
|
|
|
9148
9173
|
}
|
|
9149
9174
|
function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
9150
9175
|
const localQueryTask = CadenzaService.getLocalCadenzaDBQueryTask(tableName);
|
|
9151
|
-
|
|
9152
|
-
if (!localQueryTask && !remoteQueryTask) {
|
|
9176
|
+
if (!localQueryTask && !isCadenzaDBReady) {
|
|
9153
9177
|
return void 0;
|
|
9154
9178
|
}
|
|
9155
|
-
const
|
|
9179
|
+
const targetIntentName = resolveLocalDatabaseTaskIntent(localQueryTask, "query", tableName) ?? buildAuthoritySyncIntentName("query", tableName);
|
|
9180
|
+
const targetTask = createDatabaseInquiryTask(
|
|
9181
|
+
targetIntentName,
|
|
9182
|
+
"query",
|
|
9183
|
+
tableName,
|
|
9184
|
+
options
|
|
9185
|
+
);
|
|
9156
9186
|
const prepareQueryTask = CadenzaService.createMetaTask(
|
|
9157
9187
|
`Prepare graph sync query for ${tableName}`,
|
|
9158
9188
|
(ctx) => ({
|