@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.js
CHANGED
|
@@ -8730,15 +8730,10 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8730
8730
|
const executionFailedSignal = `meta.sync_controller.insert_execution_failed:${tableName}`;
|
|
8731
8731
|
const pendingResolverContexts = /* @__PURE__ */ new Map();
|
|
8732
8732
|
const prepareExecutionTask = CadenzaService.createMetaTask(
|
|
8733
|
-
`Prepare graph sync insert
|
|
8733
|
+
`Prepare graph sync insert for ${tableName}`,
|
|
8734
8734
|
(ctx) => {
|
|
8735
|
-
const originalContext = {
|
|
8736
|
-
|
|
8737
|
-
};
|
|
8738
|
-
const originalQueryData = buildSyncInsertQueryData(
|
|
8739
|
-
ctx,
|
|
8740
|
-
queryData
|
|
8741
|
-
);
|
|
8735
|
+
const originalContext = { ...ctx };
|
|
8736
|
+
const originalQueryData = buildSyncInsertQueryData(ctx, queryData);
|
|
8742
8737
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
8743
8738
|
pendingResolverContexts.set(ctx.__resolverRequestId, {
|
|
8744
8739
|
originalContext,
|
|
@@ -8763,6 +8758,17 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8763
8758
|
CadenzaService.createMetaTask(
|
|
8764
8759
|
`Log prepared graph sync insert execution for ${tableName}`,
|
|
8765
8760
|
(ctx) => {
|
|
8761
|
+
if (tableName === "task") {
|
|
8762
|
+
if (!shouldDebugTaskSyncPayload(ctx)) {
|
|
8763
|
+
return ctx;
|
|
8764
|
+
}
|
|
8765
|
+
logSyncDebug("insert_prepare", {
|
|
8766
|
+
tableName,
|
|
8767
|
+
targetTaskName: targetTask.name,
|
|
8768
|
+
payload: buildTaskSyncDebugPayload(ctx)
|
|
8769
|
+
});
|
|
8770
|
+
return ctx;
|
|
8771
|
+
}
|
|
8766
8772
|
logSyncDebug("insert_prepare", {
|
|
8767
8773
|
tableName,
|
|
8768
8774
|
targetTaskName: targetTask.name,
|
|
@@ -8779,7 +8785,7 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8779
8785
|
);
|
|
8780
8786
|
}
|
|
8781
8787
|
const finalizeExecutionTask = CadenzaService.createMetaTask(
|
|
8782
|
-
`Finalize graph sync insert
|
|
8788
|
+
`Finalize graph sync insert for ${tableName}`,
|
|
8783
8789
|
(ctx, emit) => {
|
|
8784
8790
|
if (!ctx.__resolverRequestId) {
|
|
8785
8791
|
return false;
|
|
@@ -8795,18 +8801,29 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8795
8801
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : originalQueryData
|
|
8796
8802
|
};
|
|
8797
8803
|
if (debugTable) {
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
+
if (tableName === "task") {
|
|
8805
|
+
if (shouldDebugTaskSyncPayload(normalizedContext)) {
|
|
8806
|
+
logSyncDebug("insert_finalize", {
|
|
8807
|
+
tableName,
|
|
8808
|
+
targetTaskName: targetTask.name,
|
|
8809
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
8810
|
+
payload: buildTaskSyncDebugPayload(normalizedContext)
|
|
8811
|
+
});
|
|
8812
|
+
}
|
|
8813
|
+
} else {
|
|
8814
|
+
logSyncDebug("insert_finalize", {
|
|
8815
|
+
tableName,
|
|
8816
|
+
targetTaskName: targetTask.name,
|
|
8817
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
8818
|
+
ctx: normalizedContext
|
|
8819
|
+
});
|
|
8820
|
+
}
|
|
8804
8821
|
}
|
|
8805
8822
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
8806
8823
|
emit(executionResolvedSignal, normalizedContext);
|
|
8807
8824
|
return normalizedContext;
|
|
8808
8825
|
},
|
|
8809
|
-
`
|
|
8826
|
+
`Finalizes ${tableName} graph-sync insert execution after the authority task finishes.`,
|
|
8810
8827
|
{
|
|
8811
8828
|
register: false,
|
|
8812
8829
|
isHidden: true
|
|
@@ -8818,11 +8835,24 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8818
8835
|
CadenzaService.createMetaTask(
|
|
8819
8836
|
`Log failed graph sync insert execution for ${tableName}`,
|
|
8820
8837
|
(ctx) => {
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8838
|
+
if (tableName === "task") {
|
|
8839
|
+
if (shouldDebugTaskSyncPayload(ctx) || shouldDebugSyncTaskName(ctx.__taskName)) {
|
|
8840
|
+
logSyncDebug("insert_failed", {
|
|
8841
|
+
tableName,
|
|
8842
|
+
targetTaskName: targetTask.name,
|
|
8843
|
+
payload: buildTaskSyncDebugPayload({
|
|
8844
|
+
...ctx,
|
|
8845
|
+
__taskName: ctx.__taskName
|
|
8846
|
+
})
|
|
8847
|
+
});
|
|
8848
|
+
}
|
|
8849
|
+
} else {
|
|
8850
|
+
logSyncDebug("insert_failed", {
|
|
8851
|
+
tableName,
|
|
8852
|
+
targetTaskName: targetTask.name,
|
|
8853
|
+
ctx
|
|
8854
|
+
});
|
|
8855
|
+
}
|
|
8826
8856
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
8827
8857
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
8828
8858
|
}
|
|
@@ -8839,6 +8869,27 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8839
8869
|
`Resolve graph sync insert for ${tableName}`,
|
|
8840
8870
|
(ctx, emit) => new Promise((resolve) => {
|
|
8841
8871
|
const resolverRequestId = (0, import_uuid6.v4)();
|
|
8872
|
+
const resolvedContext = {
|
|
8873
|
+
...ctx,
|
|
8874
|
+
__resolverRequestId: resolverRequestId
|
|
8875
|
+
};
|
|
8876
|
+
if (debugTable) {
|
|
8877
|
+
if (tableName === "task") {
|
|
8878
|
+
if (shouldDebugTaskSyncPayload(resolvedContext)) {
|
|
8879
|
+
logSyncDebug("insert_resolver_request", {
|
|
8880
|
+
tableName,
|
|
8881
|
+
targetTaskName: targetTask.name,
|
|
8882
|
+
payload: buildTaskSyncDebugPayload(resolvedContext)
|
|
8883
|
+
});
|
|
8884
|
+
}
|
|
8885
|
+
} else {
|
|
8886
|
+
logSyncDebug("insert_resolver_request", {
|
|
8887
|
+
tableName,
|
|
8888
|
+
targetTaskName: targetTask.name,
|
|
8889
|
+
ctx: resolvedContext
|
|
8890
|
+
});
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8842
8893
|
CadenzaService.createEphemeralMetaTask(
|
|
8843
8894
|
`Resolve graph sync insert execution for ${tableName} (${resolverRequestId})`,
|
|
8844
8895
|
(resultCtx) => {
|
|
@@ -8853,15 +8904,12 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
8853
8904
|
resolve(normalizedResult);
|
|
8854
8905
|
return normalizedResult;
|
|
8855
8906
|
},
|
|
8856
|
-
`Waits for
|
|
8907
|
+
`Waits for ${tableName} graph-sync insert execution.`,
|
|
8857
8908
|
{
|
|
8858
8909
|
register: false
|
|
8859
8910
|
}
|
|
8860
8911
|
).doOn(executionResolvedSignal, executionFailedSignal);
|
|
8861
|
-
emit(executionRequestedSignal,
|
|
8862
|
-
...ctx,
|
|
8863
|
-
__resolverRequestId: resolverRequestId
|
|
8864
|
-
});
|
|
8912
|
+
emit(executionRequestedSignal, resolvedContext);
|
|
8865
8913
|
}),
|
|
8866
8914
|
`Routes graph sync inserts for ${tableName} through the local authority task when available.`,
|
|
8867
8915
|
{
|
|
@@ -8988,6 +9036,37 @@ function summarizeSyncDebugValue(value, depth = 0) {
|
|
|
8988
9036
|
function logSyncDebug(event, payload) {
|
|
8989
9037
|
console.log(`${SYNC_DEBUG_PREFIX} ${event}`, summarizeSyncDebugValue(payload));
|
|
8990
9038
|
}
|
|
9039
|
+
function buildTaskSyncDebugPayload(ctx) {
|
|
9040
|
+
const data = ctx.data && typeof ctx.data === "object" ? ctx.data : {};
|
|
9041
|
+
const queryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {};
|
|
9042
|
+
const queryDataData = queryData.data && typeof queryData.data === "object" ? queryData.data : {};
|
|
9043
|
+
const taskPayload = Object.keys(queryDataData).length > 0 ? queryDataData : data;
|
|
9044
|
+
const functionString = typeof taskPayload.functionString === "string" ? taskPayload.functionString : typeof taskPayload.function_string === "string" ? taskPayload.function_string : void 0;
|
|
9045
|
+
const tagIdGetter = typeof taskPayload.tagIdGetter === "string" ? taskPayload.tagIdGetter : typeof taskPayload.tag_id_getter === "string" ? taskPayload.tag_id_getter : void 0;
|
|
9046
|
+
const signals = taskPayload.signals && typeof taskPayload.signals === "object" ? taskPayload.signals : {};
|
|
9047
|
+
const intents = taskPayload.intents && typeof taskPayload.intents === "object" ? taskPayload.intents : {};
|
|
9048
|
+
return {
|
|
9049
|
+
taskName: taskPayload.name ?? taskPayload.taskName ?? taskPayload.task_name ?? ctx.__taskName ?? null,
|
|
9050
|
+
serviceName: taskPayload.service_name ?? taskPayload.serviceName ?? ctx.__syncServiceName ?? null,
|
|
9051
|
+
functionStringLength: functionString?.length ?? null,
|
|
9052
|
+
tagIdGetterLength: tagIdGetter?.length ?? null,
|
|
9053
|
+
isMeta: taskPayload.isMeta ?? taskPayload.is_meta ?? null,
|
|
9054
|
+
isSubMeta: taskPayload.isSubMeta ?? taskPayload.is_sub_meta ?? null,
|
|
9055
|
+
isHidden: taskPayload.isHidden ?? taskPayload.is_hidden ?? null,
|
|
9056
|
+
signalsEmitsCount: Array.isArray(signals.emits) ? signals.emits.length : null,
|
|
9057
|
+
signalsObservedCount: Array.isArray(signals.observed) ? signals.observed.length : null,
|
|
9058
|
+
intentHandlesCount: Array.isArray(intents.handles) ? intents.handles.length : null,
|
|
9059
|
+
intentInquiresCount: Array.isArray(intents.inquires) ? intents.inquires.length : null,
|
|
9060
|
+
rowCount: ctx.rowCount ?? null,
|
|
9061
|
+
errored: ctx.errored ?? false,
|
|
9062
|
+
success: ctx.__success ?? null,
|
|
9063
|
+
error: ctx.__error ?? null
|
|
9064
|
+
};
|
|
9065
|
+
}
|
|
9066
|
+
function shouldDebugTaskSyncPayload(ctx) {
|
|
9067
|
+
const payload = buildTaskSyncDebugPayload(ctx);
|
|
9068
|
+
return shouldDebugSyncTaskName(payload.taskName);
|
|
9069
|
+
}
|
|
8991
9070
|
function resolveSyncQueryRows(ctx, tableName) {
|
|
8992
9071
|
const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
|
|
8993
9072
|
const rows = ctx?.[resultKey];
|
|
@@ -9518,6 +9597,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
9518
9597
|
register: task.register,
|
|
9519
9598
|
registered: task.registered,
|
|
9520
9599
|
hidden: task.hidden,
|
|
9600
|
+
exportFunctionLength: __functionString?.length ?? null,
|
|
9601
|
+
exportTagGetterLength: __getTagCallback?.length ?? null,
|
|
9521
9602
|
observedSignals: Array.from(task.observedSignals),
|
|
9522
9603
|
handledIntents: Array.from(task.handlesIntents)
|
|
9523
9604
|
});
|