@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.js
CHANGED
|
@@ -6266,15 +6266,10 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6266
6266
|
const executionFailedSignal = `meta.sync_controller.insert_execution_failed:${tableName}`;
|
|
6267
6267
|
const pendingResolverContexts = /* @__PURE__ */ new Map();
|
|
6268
6268
|
const prepareExecutionTask = CadenzaService.createMetaTask(
|
|
6269
|
-
`Prepare graph sync insert
|
|
6269
|
+
`Prepare graph sync insert for ${tableName}`,
|
|
6270
6270
|
(ctx) => {
|
|
6271
|
-
const originalContext = {
|
|
6272
|
-
|
|
6273
|
-
};
|
|
6274
|
-
const originalQueryData = buildSyncInsertQueryData(
|
|
6275
|
-
ctx,
|
|
6276
|
-
queryData
|
|
6277
|
-
);
|
|
6271
|
+
const originalContext = { ...ctx };
|
|
6272
|
+
const originalQueryData = buildSyncInsertQueryData(ctx, queryData);
|
|
6278
6273
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
6279
6274
|
pendingResolverContexts.set(ctx.__resolverRequestId, {
|
|
6280
6275
|
originalContext,
|
|
@@ -6299,6 +6294,17 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6299
6294
|
CadenzaService.createMetaTask(
|
|
6300
6295
|
`Log prepared graph sync insert execution for ${tableName}`,
|
|
6301
6296
|
(ctx) => {
|
|
6297
|
+
if (tableName === "task") {
|
|
6298
|
+
if (!shouldDebugTaskSyncPayload(ctx)) {
|
|
6299
|
+
return ctx;
|
|
6300
|
+
}
|
|
6301
|
+
logSyncDebug("insert_prepare", {
|
|
6302
|
+
tableName,
|
|
6303
|
+
targetTaskName: targetTask.name,
|
|
6304
|
+
payload: buildTaskSyncDebugPayload(ctx)
|
|
6305
|
+
});
|
|
6306
|
+
return ctx;
|
|
6307
|
+
}
|
|
6302
6308
|
logSyncDebug("insert_prepare", {
|
|
6303
6309
|
tableName,
|
|
6304
6310
|
targetTaskName: targetTask.name,
|
|
@@ -6315,7 +6321,7 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6315
6321
|
);
|
|
6316
6322
|
}
|
|
6317
6323
|
const finalizeExecutionTask = CadenzaService.createMetaTask(
|
|
6318
|
-
`Finalize graph sync insert
|
|
6324
|
+
`Finalize graph sync insert for ${tableName}`,
|
|
6319
6325
|
(ctx, emit) => {
|
|
6320
6326
|
if (!ctx.__resolverRequestId) {
|
|
6321
6327
|
return false;
|
|
@@ -6331,18 +6337,29 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6331
6337
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : originalQueryData
|
|
6332
6338
|
};
|
|
6333
6339
|
if (debugTable) {
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
+
if (tableName === "task") {
|
|
6341
|
+
if (shouldDebugTaskSyncPayload(normalizedContext)) {
|
|
6342
|
+
logSyncDebug("insert_finalize", {
|
|
6343
|
+
tableName,
|
|
6344
|
+
targetTaskName: targetTask.name,
|
|
6345
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
6346
|
+
payload: buildTaskSyncDebugPayload(normalizedContext)
|
|
6347
|
+
});
|
|
6348
|
+
}
|
|
6349
|
+
} else {
|
|
6350
|
+
logSyncDebug("insert_finalize", {
|
|
6351
|
+
tableName,
|
|
6352
|
+
targetTaskName: targetTask.name,
|
|
6353
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
6354
|
+
ctx: normalizedContext
|
|
6355
|
+
});
|
|
6356
|
+
}
|
|
6340
6357
|
}
|
|
6341
6358
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6342
6359
|
emit(executionResolvedSignal, normalizedContext);
|
|
6343
6360
|
return normalizedContext;
|
|
6344
6361
|
},
|
|
6345
|
-
`
|
|
6362
|
+
`Finalizes ${tableName} graph-sync insert execution after the authority task finishes.`,
|
|
6346
6363
|
{
|
|
6347
6364
|
register: false,
|
|
6348
6365
|
isHidden: true
|
|
@@ -6354,11 +6371,24 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6354
6371
|
CadenzaService.createMetaTask(
|
|
6355
6372
|
`Log failed graph sync insert execution for ${tableName}`,
|
|
6356
6373
|
(ctx) => {
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6374
|
+
if (tableName === "task") {
|
|
6375
|
+
if (shouldDebugTaskSyncPayload(ctx) || shouldDebugSyncTaskName(ctx.__taskName)) {
|
|
6376
|
+
logSyncDebug("insert_failed", {
|
|
6377
|
+
tableName,
|
|
6378
|
+
targetTaskName: targetTask.name,
|
|
6379
|
+
payload: buildTaskSyncDebugPayload({
|
|
6380
|
+
...ctx,
|
|
6381
|
+
__taskName: ctx.__taskName
|
|
6382
|
+
})
|
|
6383
|
+
});
|
|
6384
|
+
}
|
|
6385
|
+
} else {
|
|
6386
|
+
logSyncDebug("insert_failed", {
|
|
6387
|
+
tableName,
|
|
6388
|
+
targetTaskName: targetTask.name,
|
|
6389
|
+
ctx
|
|
6390
|
+
});
|
|
6391
|
+
}
|
|
6362
6392
|
if (typeof ctx.__resolverRequestId === "string") {
|
|
6363
6393
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6364
6394
|
}
|
|
@@ -6375,6 +6405,27 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6375
6405
|
`Resolve graph sync insert for ${tableName}`,
|
|
6376
6406
|
(ctx, emit) => new Promise((resolve) => {
|
|
6377
6407
|
const resolverRequestId = (0, import_uuid5.v4)();
|
|
6408
|
+
const resolvedContext = {
|
|
6409
|
+
...ctx,
|
|
6410
|
+
__resolverRequestId: resolverRequestId
|
|
6411
|
+
};
|
|
6412
|
+
if (debugTable) {
|
|
6413
|
+
if (tableName === "task") {
|
|
6414
|
+
if (shouldDebugTaskSyncPayload(resolvedContext)) {
|
|
6415
|
+
logSyncDebug("insert_resolver_request", {
|
|
6416
|
+
tableName,
|
|
6417
|
+
targetTaskName: targetTask.name,
|
|
6418
|
+
payload: buildTaskSyncDebugPayload(resolvedContext)
|
|
6419
|
+
});
|
|
6420
|
+
}
|
|
6421
|
+
} else {
|
|
6422
|
+
logSyncDebug("insert_resolver_request", {
|
|
6423
|
+
tableName,
|
|
6424
|
+
targetTaskName: targetTask.name,
|
|
6425
|
+
ctx: resolvedContext
|
|
6426
|
+
});
|
|
6427
|
+
}
|
|
6428
|
+
}
|
|
6378
6429
|
CadenzaService.createEphemeralMetaTask(
|
|
6379
6430
|
`Resolve graph sync insert execution for ${tableName} (${resolverRequestId})`,
|
|
6380
6431
|
(resultCtx) => {
|
|
@@ -6389,15 +6440,12 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6389
6440
|
resolve(normalizedResult);
|
|
6390
6441
|
return normalizedResult;
|
|
6391
6442
|
},
|
|
6392
|
-
`Waits for
|
|
6443
|
+
`Waits for ${tableName} graph-sync insert execution.`,
|
|
6393
6444
|
{
|
|
6394
6445
|
register: false
|
|
6395
6446
|
}
|
|
6396
6447
|
).doOn(executionResolvedSignal, executionFailedSignal);
|
|
6397
|
-
emit(executionRequestedSignal,
|
|
6398
|
-
...ctx,
|
|
6399
|
-
__resolverRequestId: resolverRequestId
|
|
6400
|
-
});
|
|
6448
|
+
emit(executionRequestedSignal, resolvedContext);
|
|
6401
6449
|
}),
|
|
6402
6450
|
`Routes graph sync inserts for ${tableName} through the local authority task when available.`,
|
|
6403
6451
|
{
|
|
@@ -6524,6 +6572,37 @@ function summarizeSyncDebugValue(value, depth = 0) {
|
|
|
6524
6572
|
function logSyncDebug(event, payload) {
|
|
6525
6573
|
console.log(`${SYNC_DEBUG_PREFIX} ${event}`, summarizeSyncDebugValue(payload));
|
|
6526
6574
|
}
|
|
6575
|
+
function buildTaskSyncDebugPayload(ctx) {
|
|
6576
|
+
const data = ctx.data && typeof ctx.data === "object" ? ctx.data : {};
|
|
6577
|
+
const queryData = ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {};
|
|
6578
|
+
const queryDataData = queryData.data && typeof queryData.data === "object" ? queryData.data : {};
|
|
6579
|
+
const taskPayload = Object.keys(queryDataData).length > 0 ? queryDataData : data;
|
|
6580
|
+
const functionString = typeof taskPayload.functionString === "string" ? taskPayload.functionString : typeof taskPayload.function_string === "string" ? taskPayload.function_string : void 0;
|
|
6581
|
+
const tagIdGetter = typeof taskPayload.tagIdGetter === "string" ? taskPayload.tagIdGetter : typeof taskPayload.tag_id_getter === "string" ? taskPayload.tag_id_getter : void 0;
|
|
6582
|
+
const signals = taskPayload.signals && typeof taskPayload.signals === "object" ? taskPayload.signals : {};
|
|
6583
|
+
const intents = taskPayload.intents && typeof taskPayload.intents === "object" ? taskPayload.intents : {};
|
|
6584
|
+
return {
|
|
6585
|
+
taskName: taskPayload.name ?? taskPayload.taskName ?? taskPayload.task_name ?? ctx.__taskName ?? null,
|
|
6586
|
+
serviceName: taskPayload.service_name ?? taskPayload.serviceName ?? ctx.__syncServiceName ?? null,
|
|
6587
|
+
functionStringLength: functionString?.length ?? null,
|
|
6588
|
+
tagIdGetterLength: tagIdGetter?.length ?? null,
|
|
6589
|
+
isMeta: taskPayload.isMeta ?? taskPayload.is_meta ?? null,
|
|
6590
|
+
isSubMeta: taskPayload.isSubMeta ?? taskPayload.is_sub_meta ?? null,
|
|
6591
|
+
isHidden: taskPayload.isHidden ?? taskPayload.is_hidden ?? null,
|
|
6592
|
+
signalsEmitsCount: Array.isArray(signals.emits) ? signals.emits.length : null,
|
|
6593
|
+
signalsObservedCount: Array.isArray(signals.observed) ? signals.observed.length : null,
|
|
6594
|
+
intentHandlesCount: Array.isArray(intents.handles) ? intents.handles.length : null,
|
|
6595
|
+
intentInquiresCount: Array.isArray(intents.inquires) ? intents.inquires.length : null,
|
|
6596
|
+
rowCount: ctx.rowCount ?? null,
|
|
6597
|
+
errored: ctx.errored ?? false,
|
|
6598
|
+
success: ctx.__success ?? null,
|
|
6599
|
+
error: ctx.__error ?? null
|
|
6600
|
+
};
|
|
6601
|
+
}
|
|
6602
|
+
function shouldDebugTaskSyncPayload(ctx) {
|
|
6603
|
+
const payload = buildTaskSyncDebugPayload(ctx);
|
|
6604
|
+
return shouldDebugSyncTaskName(payload.taskName);
|
|
6605
|
+
}
|
|
6527
6606
|
function resolveSyncQueryRows(ctx, tableName) {
|
|
6528
6607
|
const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
|
|
6529
6608
|
const rows = ctx?.[resultKey];
|
|
@@ -7054,6 +7133,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7054
7133
|
register: task.register,
|
|
7055
7134
|
registered: task.registered,
|
|
7056
7135
|
hidden: task.hidden,
|
|
7136
|
+
exportFunctionLength: __functionString?.length ?? null,
|
|
7137
|
+
exportTagGetterLength: __getTagCallback?.length ?? null,
|
|
7057
7138
|
observedSignals: Array.from(task.observedSignals),
|
|
7058
7139
|
handledIntents: Array.from(task.handlesIntents)
|
|
7059
7140
|
});
|