@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/browser/index.mjs
CHANGED
|
@@ -6217,15 +6217,10 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6217
6217
|
const executionFailedSignal = `meta.sync_controller.insert_execution_failed:${tableName}`;
|
|
6218
6218
|
const pendingResolverContexts = /* @__PURE__ */ new Map();
|
|
6219
6219
|
const prepareExecutionTask = CadenzaService.createMetaTask(
|
|
6220
|
-
`Prepare graph sync insert
|
|
6220
|
+
`Prepare graph sync insert for ${tableName}`,
|
|
6221
6221
|
(ctx) => {
|
|
6222
|
-
const originalContext = {
|
|
6223
|
-
|
|
6224
|
-
};
|
|
6225
|
-
const originalQueryData = buildSyncInsertQueryData(
|
|
6226
|
-
ctx,
|
|
6227
|
-
queryData
|
|
6228
|
-
);
|
|
6222
|
+
const originalContext = { ...ctx };
|
|
6223
|
+
const originalQueryData = buildSyncInsertQueryData(ctx, queryData);
|
|
6229
6224
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
6230
6225
|
pendingResolverContexts.set(ctx.__resolverRequestId, {
|
|
6231
6226
|
originalContext,
|
|
@@ -6250,6 +6245,17 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6250
6245
|
CadenzaService.createMetaTask(
|
|
6251
6246
|
`Log prepared graph sync insert execution for ${tableName}`,
|
|
6252
6247
|
(ctx) => {
|
|
6248
|
+
if (tableName === "task") {
|
|
6249
|
+
if (!shouldDebugTaskSyncPayload(ctx)) {
|
|
6250
|
+
return ctx;
|
|
6251
|
+
}
|
|
6252
|
+
logSyncDebug("insert_prepare", {
|
|
6253
|
+
tableName,
|
|
6254
|
+
targetTaskName: targetTask.name,
|
|
6255
|
+
payload: buildTaskSyncDebugPayload(ctx)
|
|
6256
|
+
});
|
|
6257
|
+
return ctx;
|
|
6258
|
+
}
|
|
6253
6259
|
logSyncDebug("insert_prepare", {
|
|
6254
6260
|
tableName,
|
|
6255
6261
|
targetTaskName: targetTask.name,
|
|
@@ -6266,7 +6272,7 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6266
6272
|
);
|
|
6267
6273
|
}
|
|
6268
6274
|
const finalizeExecutionTask = CadenzaService.createMetaTask(
|
|
6269
|
-
`Finalize graph sync insert
|
|
6275
|
+
`Finalize graph sync insert for ${tableName}`,
|
|
6270
6276
|
(ctx, emit) => {
|
|
6271
6277
|
if (!ctx.__resolverRequestId) {
|
|
6272
6278
|
return false;
|
|
@@ -6282,18 +6288,29 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6282
6288
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : originalQueryData
|
|
6283
6289
|
};
|
|
6284
6290
|
if (debugTable) {
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
+
if (tableName === "task") {
|
|
6292
|
+
if (shouldDebugTaskSyncPayload(normalizedContext)) {
|
|
6293
|
+
logSyncDebug("insert_finalize", {
|
|
6294
|
+
tableName,
|
|
6295
|
+
targetTaskName: targetTask.name,
|
|
6296
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
6297
|
+
payload: buildTaskSyncDebugPayload(normalizedContext)
|
|
6298
|
+
});
|
|
6299
|
+
}
|
|
6300
|
+
} else {
|
|
6301
|
+
logSyncDebug("insert_finalize", {
|
|
6302
|
+
tableName,
|
|
6303
|
+
targetTaskName: targetTask.name,
|
|
6304
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
6305
|
+
ctx: normalizedContext
|
|
6306
|
+
});
|
|
6307
|
+
}
|
|
6291
6308
|
}
|
|
6292
6309
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6293
6310
|
emit(executionResolvedSignal, normalizedContext);
|
|
6294
6311
|
return normalizedContext;
|
|
6295
6312
|
},
|
|
6296
|
-
`
|
|
6313
|
+
`Finalizes ${tableName} graph-sync insert execution after the authority task finishes.`,
|
|
6297
6314
|
{
|
|
6298
6315
|
register: false,
|
|
6299
6316
|
isHidden: true
|
|
@@ -6305,11 +6322,24 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6305
6322
|
CadenzaService.createMetaTask(
|
|
6306
6323
|
`Log failed graph sync insert execution for ${tableName}`,
|
|
6307
6324
|
(ctx) => {
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6325
|
+
if (tableName === "task") {
|
|
6326
|
+
if (shouldDebugTaskSyncPayload(ctx) || shouldDebugSyncTaskName(ctx.__taskName)) {
|
|
6327
|
+
logSyncDebug("insert_failed", {
|
|
6328
|
+
tableName,
|
|
6329
|
+
targetTaskName: targetTask.name,
|
|
6330
|
+
payload: buildTaskSyncDebugPayload({
|
|
6331
|
+
...ctx,
|
|
6332
|
+
__taskName: ctx.__taskName
|
|
6333
|
+
})
|
|
6334
|
+
});
|
|
6335
|
+
}
|
|
6336
|
+
} else {
|
|
6337
|
+
logSyncDebug("insert_failed", {
|
|
6338
|
+
tableName,
|
|
6339
|
+
targetTaskName: targetTask.name,
|
|
6340
|
+
ctx
|
|
6341
|
+
});
|
|
6342
|
+
}
|
|
6313
6343
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
6314
6344
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6315
6345
|
}
|
|
@@ -6326,6 +6356,27 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6326
6356
|
`Resolve graph sync insert for ${tableName}`,
|
|
6327
6357
|
(ctx, emit) => new Promise((resolve) => {
|
|
6328
6358
|
const resolverRequestId = uuid5();
|
|
6359
|
+
const resolvedContext = {
|
|
6360
|
+
...ctx,
|
|
6361
|
+
__resolverRequestId: resolverRequestId
|
|
6362
|
+
};
|
|
6363
|
+
if (debugTable) {
|
|
6364
|
+
if (tableName === "task") {
|
|
6365
|
+
if (shouldDebugTaskSyncPayload(resolvedContext)) {
|
|
6366
|
+
logSyncDebug("insert_resolver_request", {
|
|
6367
|
+
tableName,
|
|
6368
|
+
targetTaskName: targetTask.name,
|
|
6369
|
+
payload: buildTaskSyncDebugPayload(resolvedContext)
|
|
6370
|
+
});
|
|
6371
|
+
}
|
|
6372
|
+
} else {
|
|
6373
|
+
logSyncDebug("insert_resolver_request", {
|
|
6374
|
+
tableName,
|
|
6375
|
+
targetTaskName: targetTask.name,
|
|
6376
|
+
ctx: resolvedContext
|
|
6377
|
+
});
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6329
6380
|
CadenzaService.createEphemeralMetaTask(
|
|
6330
6381
|
`Resolve graph sync insert execution for ${tableName} (${resolverRequestId})`,
|
|
6331
6382
|
(resultCtx) => {
|
|
@@ -6340,15 +6391,12 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6340
6391
|
resolve(normalizedResult);
|
|
6341
6392
|
return normalizedResult;
|
|
6342
6393
|
},
|
|
6343
|
-
`Waits for
|
|
6394
|
+
`Waits for ${tableName} graph-sync insert execution.`,
|
|
6344
6395
|
{
|
|
6345
6396
|
register: false
|
|
6346
6397
|
}
|
|
6347
6398
|
).doOn(executionResolvedSignal, executionFailedSignal);
|
|
6348
|
-
emit(executionRequestedSignal,
|
|
6349
|
-
...ctx,
|
|
6350
|
-
__resolverRequestId: resolverRequestId
|
|
6351
|
-
});
|
|
6399
|
+
emit(executionRequestedSignal, resolvedContext);
|
|
6352
6400
|
}),
|
|
6353
6401
|
`Routes graph sync inserts for ${tableName} through the local authority task when available.`,
|
|
6354
6402
|
{
|
|
@@ -6475,6 +6523,37 @@ function summarizeSyncDebugValue(value, depth = 0) {
|
|
|
6475
6523
|
function logSyncDebug(event, payload) {
|
|
6476
6524
|
console.log(`${SYNC_DEBUG_PREFIX} ${event}`, summarizeSyncDebugValue(payload));
|
|
6477
6525
|
}
|
|
6526
|
+
function buildTaskSyncDebugPayload(ctx) {
|
|
6527
|
+
const data = ctx.data && typeof ctx.data === "object" ? ctx.data : {};
|
|
6528
|
+
const queryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {};
|
|
6529
|
+
const queryDataData = queryData.data && typeof queryData.data === "object" ? queryData.data : {};
|
|
6530
|
+
const taskPayload = Object.keys(queryDataData).length > 0 ? queryDataData : data;
|
|
6531
|
+
const functionString = typeof taskPayload.functionString === "string" ? taskPayload.functionString : typeof taskPayload.function_string === "string" ? taskPayload.function_string : void 0;
|
|
6532
|
+
const tagIdGetter = typeof taskPayload.tagIdGetter === "string" ? taskPayload.tagIdGetter : typeof taskPayload.tag_id_getter === "string" ? taskPayload.tag_id_getter : void 0;
|
|
6533
|
+
const signals = taskPayload.signals && typeof taskPayload.signals === "object" ? taskPayload.signals : {};
|
|
6534
|
+
const intents = taskPayload.intents && typeof taskPayload.intents === "object" ? taskPayload.intents : {};
|
|
6535
|
+
return {
|
|
6536
|
+
taskName: taskPayload.name ?? taskPayload.taskName ?? taskPayload.task_name ?? ctx.__taskName ?? null,
|
|
6537
|
+
serviceName: taskPayload.service_name ?? taskPayload.serviceName ?? ctx.__syncServiceName ?? null,
|
|
6538
|
+
functionStringLength: functionString?.length ?? null,
|
|
6539
|
+
tagIdGetterLength: tagIdGetter?.length ?? null,
|
|
6540
|
+
isMeta: taskPayload.isMeta ?? taskPayload.is_meta ?? null,
|
|
6541
|
+
isSubMeta: taskPayload.isSubMeta ?? taskPayload.is_sub_meta ?? null,
|
|
6542
|
+
isHidden: taskPayload.isHidden ?? taskPayload.is_hidden ?? null,
|
|
6543
|
+
signalsEmitsCount: Array.isArray(signals.emits) ? signals.emits.length : null,
|
|
6544
|
+
signalsObservedCount: Array.isArray(signals.observed) ? signals.observed.length : null,
|
|
6545
|
+
intentHandlesCount: Array.isArray(intents.handles) ? intents.handles.length : null,
|
|
6546
|
+
intentInquiresCount: Array.isArray(intents.inquires) ? intents.inquires.length : null,
|
|
6547
|
+
rowCount: ctx.rowCount ?? null,
|
|
6548
|
+
errored: ctx.errored ?? false,
|
|
6549
|
+
success: ctx.__success ?? null,
|
|
6550
|
+
error: ctx.__error ?? null
|
|
6551
|
+
};
|
|
6552
|
+
}
|
|
6553
|
+
function shouldDebugTaskSyncPayload(ctx) {
|
|
6554
|
+
const payload = buildTaskSyncDebugPayload(ctx);
|
|
6555
|
+
return shouldDebugSyncTaskName(payload.taskName);
|
|
6556
|
+
}
|
|
6478
6557
|
function resolveSyncQueryRows(ctx, tableName) {
|
|
6479
6558
|
const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
|
|
6480
6559
|
const rows = ctx?.[resultKey];
|
|
@@ -7005,6 +7084,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7005
7084
|
register: task.register,
|
|
7006
7085
|
registered: task.registered,
|
|
7007
7086
|
hidden: task.hidden,
|
|
7087
|
+
exportFunctionLength: __functionString?.length ?? null,
|
|
7088
|
+
exportTagGetterLength: __getTagCallback?.length ?? null,
|
|
7008
7089
|
observedSignals: Array.from(task.observedSignals),
|
|
7009
7090
|
handledIntents: Array.from(task.handlesIntents)
|
|
7010
7091
|
});
|