@cadenza.io/service 2.17.49 → 2.17.51
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 +107 -26
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +107 -26
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +107 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8681,15 +8681,10 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8681
8681
|
const executionFailedSignal = `meta.sync_controller.insert_execution_failed:${tableName}`;
|
|
8682
8682
|
const pendingResolverContexts = /* @__PURE__ */ new Map();
|
|
8683
8683
|
const prepareExecutionTask = CadenzaService.createMetaTask(
|
|
8684
|
-
`Prepare graph sync insert
|
|
8684
|
+
`Prepare graph sync insert for ${tableName}`,
|
|
8685
8685
|
(ctx) => {
|
|
8686
|
-
const originalContext = {
|
|
8687
|
-
|
|
8688
|
-
};
|
|
8689
|
-
const originalQueryData = buildSyncInsertQueryData(
|
|
8690
|
-
ctx,
|
|
8691
|
-
queryData
|
|
8692
|
-
);
|
|
8686
|
+
const originalContext = { ...ctx };
|
|
8687
|
+
const originalQueryData = buildSyncInsertQueryData(ctx, queryData);
|
|
8693
8688
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
8694
8689
|
pendingResolverContexts.set(ctx.__resolverRequestId, {
|
|
8695
8690
|
originalContext,
|
|
@@ -8714,6 +8709,17 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8714
8709
|
CadenzaService.createMetaTask(
|
|
8715
8710
|
`Log prepared graph sync insert execution for ${tableName}`,
|
|
8716
8711
|
(ctx) => {
|
|
8712
|
+
if (tableName === "task") {
|
|
8713
|
+
if (!shouldDebugTaskSyncPayload(ctx)) {
|
|
8714
|
+
return ctx;
|
|
8715
|
+
}
|
|
8716
|
+
logSyncDebug("insert_prepare", {
|
|
8717
|
+
tableName,
|
|
8718
|
+
targetTaskName: targetTask.name,
|
|
8719
|
+
payload: buildTaskSyncDebugPayload(ctx)
|
|
8720
|
+
});
|
|
8721
|
+
return ctx;
|
|
8722
|
+
}
|
|
8717
8723
|
logSyncDebug("insert_prepare", {
|
|
8718
8724
|
tableName,
|
|
8719
8725
|
targetTaskName: targetTask.name,
|
|
@@ -8730,7 +8736,7 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8730
8736
|
);
|
|
8731
8737
|
}
|
|
8732
8738
|
const finalizeExecutionTask = CadenzaService.createMetaTask(
|
|
8733
|
-
`Finalize graph sync insert
|
|
8739
|
+
`Finalize graph sync insert for ${tableName}`,
|
|
8734
8740
|
(ctx, emit) => {
|
|
8735
8741
|
if (!ctx.__resolverRequestId) {
|
|
8736
8742
|
return false;
|
|
@@ -8746,18 +8752,29 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8746
8752
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : originalQueryData
|
|
8747
8753
|
};
|
|
8748
8754
|
if (debugTable) {
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
+
if (tableName === "task") {
|
|
8756
|
+
if (shouldDebugTaskSyncPayload(normalizedContext)) {
|
|
8757
|
+
logSyncDebug("insert_finalize", {
|
|
8758
|
+
tableName,
|
|
8759
|
+
targetTaskName: targetTask.name,
|
|
8760
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
8761
|
+
payload: buildTaskSyncDebugPayload(normalizedContext)
|
|
8762
|
+
});
|
|
8763
|
+
}
|
|
8764
|
+
} else {
|
|
8765
|
+
logSyncDebug("insert_finalize", {
|
|
8766
|
+
tableName,
|
|
8767
|
+
targetTaskName: targetTask.name,
|
|
8768
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
8769
|
+
ctx: normalizedContext
|
|
8770
|
+
});
|
|
8771
|
+
}
|
|
8755
8772
|
}
|
|
8756
8773
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
8757
8774
|
emit(executionResolvedSignal, normalizedContext);
|
|
8758
8775
|
return normalizedContext;
|
|
8759
8776
|
},
|
|
8760
|
-
`
|
|
8777
|
+
`Finalizes ${tableName} graph-sync insert execution after the authority task finishes.`,
|
|
8761
8778
|
{
|
|
8762
8779
|
register: false,
|
|
8763
8780
|
isHidden: true
|
|
@@ -8769,11 +8786,24 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8769
8786
|
CadenzaService.createMetaTask(
|
|
8770
8787
|
`Log failed graph sync insert execution for ${tableName}`,
|
|
8771
8788
|
(ctx) => {
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8789
|
+
if (tableName === "task") {
|
|
8790
|
+
if (shouldDebugTaskSyncPayload(ctx) || shouldDebugSyncTaskName(ctx.__taskName)) {
|
|
8791
|
+
logSyncDebug("insert_failed", {
|
|
8792
|
+
tableName,
|
|
8793
|
+
targetTaskName: targetTask.name,
|
|
8794
|
+
payload: buildTaskSyncDebugPayload({
|
|
8795
|
+
...ctx,
|
|
8796
|
+
__taskName: ctx.__taskName
|
|
8797
|
+
})
|
|
8798
|
+
});
|
|
8799
|
+
}
|
|
8800
|
+
} else {
|
|
8801
|
+
logSyncDebug("insert_failed", {
|
|
8802
|
+
tableName,
|
|
8803
|
+
targetTaskName: targetTask.name,
|
|
8804
|
+
ctx
|
|
8805
|
+
});
|
|
8806
|
+
}
|
|
8777
8807
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
8778
8808
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
8779
8809
|
}
|
|
@@ -8790,6 +8820,27 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8790
8820
|
`Resolve graph sync insert for ${tableName}`,
|
|
8791
8821
|
(ctx, emit) => new Promise((resolve) => {
|
|
8792
8822
|
const resolverRequestId = uuid6();
|
|
8823
|
+
const resolvedContext = {
|
|
8824
|
+
...ctx,
|
|
8825
|
+
__resolverRequestId: resolverRequestId
|
|
8826
|
+
};
|
|
8827
|
+
if (debugTable) {
|
|
8828
|
+
if (tableName === "task") {
|
|
8829
|
+
if (shouldDebugTaskSyncPayload(resolvedContext)) {
|
|
8830
|
+
logSyncDebug("insert_resolver_request", {
|
|
8831
|
+
tableName,
|
|
8832
|
+
targetTaskName: targetTask.name,
|
|
8833
|
+
payload: buildTaskSyncDebugPayload(resolvedContext)
|
|
8834
|
+
});
|
|
8835
|
+
}
|
|
8836
|
+
} else {
|
|
8837
|
+
logSyncDebug("insert_resolver_request", {
|
|
8838
|
+
tableName,
|
|
8839
|
+
targetTaskName: targetTask.name,
|
|
8840
|
+
ctx: resolvedContext
|
|
8841
|
+
});
|
|
8842
|
+
}
|
|
8843
|
+
}
|
|
8793
8844
|
CadenzaService.createEphemeralMetaTask(
|
|
8794
8845
|
`Resolve graph sync insert execution for ${tableName} (${resolverRequestId})`,
|
|
8795
8846
|
(resultCtx) => {
|
|
@@ -8804,15 +8855,12 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8804
8855
|
resolve(normalizedResult);
|
|
8805
8856
|
return normalizedResult;
|
|
8806
8857
|
},
|
|
8807
|
-
`Waits for
|
|
8858
|
+
`Waits for ${tableName} graph-sync insert execution.`,
|
|
8808
8859
|
{
|
|
8809
8860
|
register: false
|
|
8810
8861
|
}
|
|
8811
8862
|
).doOn(executionResolvedSignal, executionFailedSignal);
|
|
8812
|
-
emit(executionRequestedSignal,
|
|
8813
|
-
...ctx,
|
|
8814
|
-
__resolverRequestId: resolverRequestId
|
|
8815
|
-
});
|
|
8863
|
+
emit(executionRequestedSignal, resolvedContext);
|
|
8816
8864
|
}),
|
|
8817
8865
|
`Routes graph sync inserts for ${tableName} through the local authority task when available.`,
|
|
8818
8866
|
{
|
|
@@ -8939,6 +8987,37 @@ function summarizeSyncDebugValue(value, depth = 0) {
|
|
|
8939
8987
|
function logSyncDebug(event, payload) {
|
|
8940
8988
|
console.log(`${SYNC_DEBUG_PREFIX} ${event}`, summarizeSyncDebugValue(payload));
|
|
8941
8989
|
}
|
|
8990
|
+
function buildTaskSyncDebugPayload(ctx) {
|
|
8991
|
+
const data = ctx.data && typeof ctx.data === "object" ? ctx.data : {};
|
|
8992
|
+
const queryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {};
|
|
8993
|
+
const queryDataData = queryData.data && typeof queryData.data === "object" ? queryData.data : {};
|
|
8994
|
+
const taskPayload = Object.keys(queryDataData).length > 0 ? queryDataData : data;
|
|
8995
|
+
const functionString = typeof taskPayload.functionString === "string" ? taskPayload.functionString : typeof taskPayload.function_string === "string" ? taskPayload.function_string : void 0;
|
|
8996
|
+
const tagIdGetter = typeof taskPayload.tagIdGetter === "string" ? taskPayload.tagIdGetter : typeof taskPayload.tag_id_getter === "string" ? taskPayload.tag_id_getter : void 0;
|
|
8997
|
+
const signals = taskPayload.signals && typeof taskPayload.signals === "object" ? taskPayload.signals : {};
|
|
8998
|
+
const intents = taskPayload.intents && typeof taskPayload.intents === "object" ? taskPayload.intents : {};
|
|
8999
|
+
return {
|
|
9000
|
+
taskName: taskPayload.name ?? taskPayload.taskName ?? taskPayload.task_name ?? ctx.__taskName ?? null,
|
|
9001
|
+
serviceName: taskPayload.service_name ?? taskPayload.serviceName ?? ctx.__syncServiceName ?? null,
|
|
9002
|
+
functionStringLength: functionString?.length ?? null,
|
|
9003
|
+
tagIdGetterLength: tagIdGetter?.length ?? null,
|
|
9004
|
+
isMeta: taskPayload.isMeta ?? taskPayload.is_meta ?? null,
|
|
9005
|
+
isSubMeta: taskPayload.isSubMeta ?? taskPayload.is_sub_meta ?? null,
|
|
9006
|
+
isHidden: taskPayload.isHidden ?? taskPayload.is_hidden ?? null,
|
|
9007
|
+
signalsEmitsCount: Array.isArray(signals.emits) ? signals.emits.length : null,
|
|
9008
|
+
signalsObservedCount: Array.isArray(signals.observed) ? signals.observed.length : null,
|
|
9009
|
+
intentHandlesCount: Array.isArray(intents.handles) ? intents.handles.length : null,
|
|
9010
|
+
intentInquiresCount: Array.isArray(intents.inquires) ? intents.inquires.length : null,
|
|
9011
|
+
rowCount: ctx.rowCount ?? null,
|
|
9012
|
+
errored: ctx.errored ?? false,
|
|
9013
|
+
success: ctx.__success ?? null,
|
|
9014
|
+
error: ctx.__error ?? null
|
|
9015
|
+
};
|
|
9016
|
+
}
|
|
9017
|
+
function shouldDebugTaskSyncPayload(ctx) {
|
|
9018
|
+
const payload = buildTaskSyncDebugPayload(ctx);
|
|
9019
|
+
return shouldDebugSyncTaskName(payload.taskName);
|
|
9020
|
+
}
|
|
8942
9021
|
function resolveSyncQueryRows(ctx, tableName) {
|
|
8943
9022
|
const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
|
|
8944
9023
|
const rows = ctx?.[resultKey];
|
|
@@ -9469,6 +9548,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
9469
9548
|
register: task.register,
|
|
9470
9549
|
registered: task.registered,
|
|
9471
9550
|
hidden: task.hidden,
|
|
9551
|
+
exportFunctionLength: __functionString?.length ?? null,
|
|
9552
|
+
exportTagGetterLength: __getTagCallback?.length ?? null,
|
|
9472
9553
|
observedSignals: Array.from(task.observedSignals),
|
|
9473
9554
|
handledIntents: Array.from(task.handlesIntents)
|
|
9474
9555
|
});
|