@cadenza.io/service 2.17.47 → 2.17.49
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 +443 -129
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +443 -129
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +443 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +443 -129
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -6197,10 +6197,21 @@ function buildSyncInsertQueryData(ctx, queryData = {}) {
|
|
|
6197
6197
|
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
6198
6198
|
const localInsertTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName);
|
|
6199
6199
|
const remoteInsertTask = isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, options) : void 0;
|
|
6200
|
+
const debugTable = shouldDebugSyncTable(tableName);
|
|
6200
6201
|
if (!localInsertTask && !remoteInsertTask) {
|
|
6201
6202
|
return void 0;
|
|
6202
6203
|
}
|
|
6203
6204
|
const targetTask = localInsertTask ?? remoteInsertTask;
|
|
6205
|
+
if (debugTable) {
|
|
6206
|
+
logSyncDebug("insert_task_resolved", {
|
|
6207
|
+
tableName,
|
|
6208
|
+
localInsertTaskName: localInsertTask?.name ?? null,
|
|
6209
|
+
remoteInsertTaskName: remoteInsertTask?.name ?? null,
|
|
6210
|
+
targetTaskName: targetTask.name,
|
|
6211
|
+
queryData,
|
|
6212
|
+
options
|
|
6213
|
+
});
|
|
6214
|
+
}
|
|
6204
6215
|
const executionRequestedSignal = `meta.sync_controller.insert_execution_requested:${tableName}`;
|
|
6205
6216
|
const executionResolvedSignal = `meta.sync_controller.insert_execution_resolved:${tableName}`;
|
|
6206
6217
|
const executionFailedSignal = `meta.sync_controller.insert_execution_failed:${tableName}`;
|
|
@@ -6234,6 +6245,26 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6234
6245
|
isHidden: true
|
|
6235
6246
|
}
|
|
6236
6247
|
).doOn(executionRequestedSignal).emitsOnFail(executionFailedSignal);
|
|
6248
|
+
if (debugTable) {
|
|
6249
|
+
prepareExecutionTask.then(
|
|
6250
|
+
CadenzaService.createMetaTask(
|
|
6251
|
+
`Log prepared graph sync insert execution for ${tableName}`,
|
|
6252
|
+
(ctx) => {
|
|
6253
|
+
logSyncDebug("insert_prepare", {
|
|
6254
|
+
tableName,
|
|
6255
|
+
targetTaskName: targetTask.name,
|
|
6256
|
+
ctx
|
|
6257
|
+
});
|
|
6258
|
+
return ctx;
|
|
6259
|
+
},
|
|
6260
|
+
`Logs prepared ${tableName} sync insert payloads.`,
|
|
6261
|
+
{
|
|
6262
|
+
register: false,
|
|
6263
|
+
isHidden: true
|
|
6264
|
+
}
|
|
6265
|
+
)
|
|
6266
|
+
);
|
|
6267
|
+
}
|
|
6237
6268
|
const finalizeExecutionTask = CadenzaService.createMetaTask(
|
|
6238
6269
|
`Finalize graph sync insert execution for ${tableName}`,
|
|
6239
6270
|
(ctx, emit) => {
|
|
@@ -6250,6 +6281,14 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6250
6281
|
...ctx,
|
|
6251
6282
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : originalQueryData
|
|
6252
6283
|
};
|
|
6284
|
+
if (debugTable) {
|
|
6285
|
+
logSyncDebug("insert_finalize", {
|
|
6286
|
+
tableName,
|
|
6287
|
+
targetTaskName: targetTask.name,
|
|
6288
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
6289
|
+
ctx: normalizedContext
|
|
6290
|
+
});
|
|
6291
|
+
}
|
|
6253
6292
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6254
6293
|
emit(executionResolvedSignal, normalizedContext);
|
|
6255
6294
|
return normalizedContext;
|
|
@@ -6262,6 +6301,27 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6262
6301
|
);
|
|
6263
6302
|
targetTask.then(finalizeExecutionTask).emitsOnFail(executionFailedSignal);
|
|
6264
6303
|
prepareExecutionTask.then(targetTask);
|
|
6304
|
+
if (debugTable) {
|
|
6305
|
+
CadenzaService.createMetaTask(
|
|
6306
|
+
`Log failed graph sync insert execution for ${tableName}`,
|
|
6307
|
+
(ctx) => {
|
|
6308
|
+
logSyncDebug("insert_failed", {
|
|
6309
|
+
tableName,
|
|
6310
|
+
targetTaskName: targetTask.name,
|
|
6311
|
+
ctx
|
|
6312
|
+
});
|
|
6313
|
+
if (typeof ctx.__resolverRequestId === "string") {
|
|
6314
|
+
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6315
|
+
}
|
|
6316
|
+
return false;
|
|
6317
|
+
},
|
|
6318
|
+
`Logs failed ${tableName} sync insert executions.`,
|
|
6319
|
+
{
|
|
6320
|
+
register: false,
|
|
6321
|
+
isHidden: true
|
|
6322
|
+
}
|
|
6323
|
+
).doOn(executionFailedSignal);
|
|
6324
|
+
}
|
|
6265
6325
|
return CadenzaService.createMetaTask(
|
|
6266
6326
|
`Resolve graph sync insert for ${tableName}`,
|
|
6267
6327
|
(ctx, emit) => new Promise((resolve) => {
|
|
@@ -6317,6 +6377,104 @@ var AUTHORITY_QUERY_RESULT_KEYS = {
|
|
|
6317
6377
|
intent_registry: "intentRegistrys"
|
|
6318
6378
|
};
|
|
6319
6379
|
var EARLY_SYNC_REQUEST_DELAYS_MS = [2e3, 1e4, 3e4];
|
|
6380
|
+
var SYNC_DEBUG_PREFIX = "[CADENZA_SYNC_DEBUG]";
|
|
6381
|
+
var SYNC_DEBUG_TABLES = /* @__PURE__ */ new Set([
|
|
6382
|
+
"task",
|
|
6383
|
+
"routine",
|
|
6384
|
+
"task_to_routine_map",
|
|
6385
|
+
"signal_registry",
|
|
6386
|
+
"intent_registry",
|
|
6387
|
+
"signal_to_task_map",
|
|
6388
|
+
"intent_to_task_map"
|
|
6389
|
+
]);
|
|
6390
|
+
var SYNC_DEBUG_TASK_NAMES = /* @__PURE__ */ new Set([
|
|
6391
|
+
"Query service_instance",
|
|
6392
|
+
"Query service_instance_transport",
|
|
6393
|
+
"Query intent_to_task_map",
|
|
6394
|
+
"Query signal_to_task_map",
|
|
6395
|
+
"Prepare for signal sync",
|
|
6396
|
+
"Compile sync data and broadcast",
|
|
6397
|
+
"Forward service instance sync",
|
|
6398
|
+
"Forward service transport sync",
|
|
6399
|
+
"Forward intent to task map sync",
|
|
6400
|
+
"Forward signal to task map sync"
|
|
6401
|
+
]);
|
|
6402
|
+
var SYNC_DEBUG_ROUTINE_NAMES = /* @__PURE__ */ new Set(["Sync services"]);
|
|
6403
|
+
var SYNC_DEBUG_INTENT_NAMES = /* @__PURE__ */ new Set([
|
|
6404
|
+
"meta-service-registry-full-sync",
|
|
6405
|
+
"runner-traffic-runtime-get",
|
|
6406
|
+
"iot-telemetry-ingest",
|
|
6407
|
+
"query-pg-CadenzaDBPostgresActor-service_instance",
|
|
6408
|
+
"query-pg-CadenzaDBPostgresActor-service_instance_transport",
|
|
6409
|
+
"query-pg-CadenzaDBPostgresActor-intent_to_task_map",
|
|
6410
|
+
"query-pg-CadenzaDBPostgresActor-signal_to_task_map"
|
|
6411
|
+
]);
|
|
6412
|
+
function shouldDebugSyncTable(tableName) {
|
|
6413
|
+
return SYNC_DEBUG_TABLES.has(tableName);
|
|
6414
|
+
}
|
|
6415
|
+
function shouldDebugSyncTaskName(taskName) {
|
|
6416
|
+
return typeof taskName === "string" && SYNC_DEBUG_TASK_NAMES.has(taskName);
|
|
6417
|
+
}
|
|
6418
|
+
function shouldDebugSyncRoutineName(routineName) {
|
|
6419
|
+
return typeof routineName === "string" && SYNC_DEBUG_ROUTINE_NAMES.has(routineName);
|
|
6420
|
+
}
|
|
6421
|
+
function shouldDebugSyncIntentName(intentName) {
|
|
6422
|
+
return typeof intentName === "string" && SYNC_DEBUG_INTENT_NAMES.has(intentName);
|
|
6423
|
+
}
|
|
6424
|
+
function summarizeSyncDebugValue(value, depth = 0) {
|
|
6425
|
+
if (value === null || value === void 0) {
|
|
6426
|
+
return value;
|
|
6427
|
+
}
|
|
6428
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
6429
|
+
return value;
|
|
6430
|
+
}
|
|
6431
|
+
if (value instanceof Set) {
|
|
6432
|
+
return {
|
|
6433
|
+
__type: "Set",
|
|
6434
|
+
size: value.size,
|
|
6435
|
+
values: Array.from(value).slice(0, 8).map((item) => summarizeSyncDebugValue(item, depth + 1))
|
|
6436
|
+
};
|
|
6437
|
+
}
|
|
6438
|
+
if (value instanceof Map) {
|
|
6439
|
+
return {
|
|
6440
|
+
__type: "Map",
|
|
6441
|
+
size: value.size
|
|
6442
|
+
};
|
|
6443
|
+
}
|
|
6444
|
+
if (Array.isArray(value)) {
|
|
6445
|
+
return {
|
|
6446
|
+
__type: "Array",
|
|
6447
|
+
length: value.length,
|
|
6448
|
+
items: value.slice(0, 5).map((item) => summarizeSyncDebugValue(item, depth + 1))
|
|
6449
|
+
};
|
|
6450
|
+
}
|
|
6451
|
+
if (typeof value === "object") {
|
|
6452
|
+
if (depth >= 2) {
|
|
6453
|
+
return "[object]";
|
|
6454
|
+
}
|
|
6455
|
+
const output = {};
|
|
6456
|
+
const entries = Object.entries(value).filter(
|
|
6457
|
+
([key]) => ![
|
|
6458
|
+
"functionString",
|
|
6459
|
+
"tagIdGetter",
|
|
6460
|
+
"__functionString",
|
|
6461
|
+
"__getTagCallback",
|
|
6462
|
+
"joinedContexts",
|
|
6463
|
+
"task",
|
|
6464
|
+
"taskInstance",
|
|
6465
|
+
"tasks"
|
|
6466
|
+
].includes(key)
|
|
6467
|
+
).slice(0, 12);
|
|
6468
|
+
for (const [key, nestedValue] of entries) {
|
|
6469
|
+
output[key] = summarizeSyncDebugValue(nestedValue, depth + 1);
|
|
6470
|
+
}
|
|
6471
|
+
return output;
|
|
6472
|
+
}
|
|
6473
|
+
return String(value);
|
|
6474
|
+
}
|
|
6475
|
+
function logSyncDebug(event, payload) {
|
|
6476
|
+
console.log(`${SYNC_DEBUG_PREFIX} ${event}`, summarizeSyncDebugValue(payload));
|
|
6477
|
+
}
|
|
6320
6478
|
function resolveSyncQueryRows(ctx, tableName) {
|
|
6321
6479
|
const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
|
|
6322
6480
|
const rows = ctx?.[resultKey];
|
|
@@ -6345,6 +6503,31 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
|
|
|
6345
6503
|
}
|
|
6346
6504
|
).then(targetTask);
|
|
6347
6505
|
}
|
|
6506
|
+
function getRegistrableTasks() {
|
|
6507
|
+
return Array.from(CadenzaService.registry.tasks.values()).filter(
|
|
6508
|
+
(task) => task.register && !task.isHidden
|
|
6509
|
+
);
|
|
6510
|
+
}
|
|
6511
|
+
function getRegistrableRoutines() {
|
|
6512
|
+
return Array.from(CadenzaService.registry.routines.values());
|
|
6513
|
+
}
|
|
6514
|
+
function getRegistrableSignalObservers() {
|
|
6515
|
+
const signalObservers = CadenzaService.signalBroker.signalObservers;
|
|
6516
|
+
return signalObservers ? Array.from(signalObservers.values()) : [];
|
|
6517
|
+
}
|
|
6518
|
+
function getRegistrableIntentNames() {
|
|
6519
|
+
return Array.from(CadenzaService.inquiryBroker.intents.values()).map((intent) => buildIntentRegistryData(intent)).filter(
|
|
6520
|
+
(intentDefinition) => intentDefinition !== null
|
|
6521
|
+
).map((intentDefinition) => String(intentDefinition.name));
|
|
6522
|
+
}
|
|
6523
|
+
function buildActorRegistrationKey(actor, serviceName) {
|
|
6524
|
+
const data = buildActorRegistrationData(actor);
|
|
6525
|
+
const name = typeof data.name === "string" && data.name.trim().length > 0 ? data.name.trim() : "";
|
|
6526
|
+
if (!name) {
|
|
6527
|
+
return null;
|
|
6528
|
+
}
|
|
6529
|
+
return `${name}|${data.version}|${serviceName}`;
|
|
6530
|
+
}
|
|
6348
6531
|
var GraphSyncController = class _GraphSyncController {
|
|
6349
6532
|
constructor() {
|
|
6350
6533
|
this.registeredActors = /* @__PURE__ */ new Set();
|
|
@@ -6469,22 +6652,158 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6469
6652
|
{},
|
|
6470
6653
|
{ concurrency: 10 }
|
|
6471
6654
|
);
|
|
6655
|
+
const finalizeTaskSync = (emit, ctx) => {
|
|
6656
|
+
const pendingTasks = getRegistrableTasks().filter((task) => !task.registered);
|
|
6657
|
+
if (pendingTasks.length > 0) {
|
|
6658
|
+
this.tasksSynced = false;
|
|
6659
|
+
return false;
|
|
6660
|
+
}
|
|
6661
|
+
const shouldEmit = !this.tasksSynced;
|
|
6662
|
+
this.tasksSynced = true;
|
|
6663
|
+
if (shouldEmit) {
|
|
6664
|
+
emit("meta.sync_controller.synced_tasks", {
|
|
6665
|
+
__syncing: true,
|
|
6666
|
+
...ctx
|
|
6667
|
+
});
|
|
6668
|
+
}
|
|
6669
|
+
return true;
|
|
6670
|
+
};
|
|
6671
|
+
const finalizeRoutineSync = (emit, ctx) => {
|
|
6672
|
+
const pendingRoutines = getRegistrableRoutines().filter(
|
|
6673
|
+
(routine) => !routine.registered
|
|
6674
|
+
);
|
|
6675
|
+
if (pendingRoutines.length > 0) {
|
|
6676
|
+
this.routinesSynced = false;
|
|
6677
|
+
return false;
|
|
6678
|
+
}
|
|
6679
|
+
const shouldEmit = !this.routinesSynced;
|
|
6680
|
+
this.routinesSynced = true;
|
|
6681
|
+
if (shouldEmit) {
|
|
6682
|
+
emit("meta.sync_controller.synced_routines", {
|
|
6683
|
+
__syncing: true,
|
|
6684
|
+
...ctx
|
|
6685
|
+
});
|
|
6686
|
+
}
|
|
6687
|
+
return true;
|
|
6688
|
+
};
|
|
6689
|
+
const finalizeSignalSync = (emit, ctx) => {
|
|
6690
|
+
const pendingSignals = getRegistrableSignalObservers().filter(
|
|
6691
|
+
(observer) => observer?.registered !== true
|
|
6692
|
+
);
|
|
6693
|
+
if (pendingSignals.length > 0) {
|
|
6694
|
+
this.signalsSynced = false;
|
|
6695
|
+
return false;
|
|
6696
|
+
}
|
|
6697
|
+
const shouldEmit = !this.signalsSynced;
|
|
6698
|
+
this.signalsSynced = true;
|
|
6699
|
+
if (shouldEmit) {
|
|
6700
|
+
emit("meta.sync_controller.synced_signals", {
|
|
6701
|
+
__syncing: true,
|
|
6702
|
+
...ctx
|
|
6703
|
+
});
|
|
6704
|
+
}
|
|
6705
|
+
return true;
|
|
6706
|
+
};
|
|
6707
|
+
const finalizeIntentSync = (emit, ctx) => {
|
|
6708
|
+
const pendingIntentNames = getRegistrableIntentNames().filter(
|
|
6709
|
+
(intentName) => !this.registeredIntentDefinitions.has(intentName)
|
|
6710
|
+
);
|
|
6711
|
+
if (pendingIntentNames.length > 0) {
|
|
6712
|
+
this.intentsSynced = false;
|
|
6713
|
+
return false;
|
|
6714
|
+
}
|
|
6715
|
+
const shouldEmit = !this.intentsSynced;
|
|
6716
|
+
this.intentsSynced = true;
|
|
6717
|
+
if (shouldEmit) {
|
|
6718
|
+
emit("meta.sync_controller.synced_intents", {
|
|
6719
|
+
__syncing: true,
|
|
6720
|
+
...ctx
|
|
6721
|
+
});
|
|
6722
|
+
}
|
|
6723
|
+
return true;
|
|
6724
|
+
};
|
|
6725
|
+
const finalizeActorSync = (emit, ctx) => {
|
|
6726
|
+
const syncServiceName = resolveSyncServiceName();
|
|
6727
|
+
if (!syncServiceName) {
|
|
6728
|
+
this.actorsSynced = false;
|
|
6729
|
+
return false;
|
|
6730
|
+
}
|
|
6731
|
+
const pendingActorKeys = CadenzaService.getAllActors().map((actor) => buildActorRegistrationKey(actor, syncServiceName)).filter((registrationKey) => Boolean(registrationKey)).filter((registrationKey) => !this.registeredActors.has(registrationKey));
|
|
6732
|
+
if (pendingActorKeys.length > 0) {
|
|
6733
|
+
this.actorsSynced = false;
|
|
6734
|
+
return false;
|
|
6735
|
+
}
|
|
6736
|
+
const shouldEmit = !this.actorsSynced;
|
|
6737
|
+
this.actorsSynced = true;
|
|
6738
|
+
if (shouldEmit) {
|
|
6739
|
+
emit("meta.sync_controller.synced_actors", {
|
|
6740
|
+
__syncing: true,
|
|
6741
|
+
...ctx
|
|
6742
|
+
});
|
|
6743
|
+
}
|
|
6744
|
+
return true;
|
|
6745
|
+
};
|
|
6746
|
+
const gatherTaskRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6747
|
+
"Gather task registration",
|
|
6748
|
+
(ctx, emit) => finalizeTaskSync(emit, ctx),
|
|
6749
|
+
"Completes task registration when all registrable tasks are marked registered.",
|
|
6750
|
+
{
|
|
6751
|
+
register: false,
|
|
6752
|
+
isHidden: true
|
|
6753
|
+
}
|
|
6754
|
+
);
|
|
6755
|
+
const gatherRoutineRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6756
|
+
"Gather routine registration",
|
|
6757
|
+
(ctx, emit) => finalizeRoutineSync(emit, ctx),
|
|
6758
|
+
"Completes routine registration when all registrable routines are marked registered.",
|
|
6759
|
+
{
|
|
6760
|
+
register: false,
|
|
6761
|
+
isHidden: true
|
|
6762
|
+
}
|
|
6763
|
+
);
|
|
6764
|
+
const gatherSignalRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6765
|
+
"Gather signal registration",
|
|
6766
|
+
(ctx, emit) => finalizeSignalSync(emit, ctx),
|
|
6767
|
+
"Completes signal registration when all signal observers are marked registered.",
|
|
6768
|
+
{
|
|
6769
|
+
register: false,
|
|
6770
|
+
isHidden: true
|
|
6771
|
+
}
|
|
6772
|
+
);
|
|
6773
|
+
const gatherIntentRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6774
|
+
"Gather intent registration",
|
|
6775
|
+
(ctx, emit) => finalizeIntentSync(emit, ctx),
|
|
6776
|
+
"Completes intent registration when all registrable intents are marked registered.",
|
|
6777
|
+
{
|
|
6778
|
+
register: false,
|
|
6779
|
+
isHidden: true
|
|
6780
|
+
}
|
|
6781
|
+
);
|
|
6782
|
+
const gatherActorRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6783
|
+
"Gather actor registration",
|
|
6784
|
+
(ctx, emit) => finalizeActorSync(emit, ctx),
|
|
6785
|
+
"Completes actor registration when all registrable actors are marked registered.",
|
|
6786
|
+
{
|
|
6787
|
+
register: false,
|
|
6788
|
+
isHidden: true
|
|
6789
|
+
}
|
|
6790
|
+
);
|
|
6472
6791
|
this.splitRoutinesTask = CadenzaService.createMetaTask(
|
|
6473
6792
|
"Split routines for registration",
|
|
6474
|
-
(ctx
|
|
6793
|
+
function* (ctx) {
|
|
6475
6794
|
const { routines } = ctx;
|
|
6476
|
-
if (!routines) return
|
|
6795
|
+
if (!routines) return;
|
|
6477
6796
|
const serviceName2 = resolveSyncServiceName();
|
|
6478
6797
|
if (!serviceName2) {
|
|
6479
|
-
return
|
|
6798
|
+
return;
|
|
6480
6799
|
}
|
|
6481
6800
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6482
6801
|
delayMs: 2e3
|
|
6483
6802
|
});
|
|
6484
|
-
let emittedCount = 0;
|
|
6485
6803
|
for (const routine of routines) {
|
|
6486
6804
|
if (routine.registered) continue;
|
|
6487
|
-
|
|
6805
|
+
this.routinesSynced = false;
|
|
6806
|
+
yield {
|
|
6488
6807
|
__syncing: ctx.__syncing,
|
|
6489
6808
|
data: {
|
|
6490
6809
|
name: routine.name,
|
|
@@ -6494,13 +6813,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6494
6813
|
isMeta: routine.isMeta
|
|
6495
6814
|
},
|
|
6496
6815
|
__routineName: routine.name
|
|
6497
|
-
}
|
|
6498
|
-
emittedCount += 1;
|
|
6816
|
+
};
|
|
6499
6817
|
}
|
|
6500
|
-
|
|
6501
|
-
}
|
|
6818
|
+
}.bind(this)
|
|
6502
6819
|
);
|
|
6503
|
-
|
|
6820
|
+
this.splitRoutinesTask.then(
|
|
6504
6821
|
resolveSyncInsertTask(
|
|
6505
6822
|
this.isCadenzaDBReady,
|
|
6506
6823
|
"routine",
|
|
@@ -6522,22 +6839,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6522
6839
|
delayMs: 3e3
|
|
6523
6840
|
});
|
|
6524
6841
|
CadenzaService.getRoutine(ctx.__routineName).registered = true;
|
|
6525
|
-
CadenzaService.debounce(
|
|
6526
|
-
"meta.sync_controller.routine_registration_settled",
|
|
6527
|
-
{ __syncing: true },
|
|
6528
|
-
300
|
|
6529
|
-
);
|
|
6530
6842
|
return true;
|
|
6531
|
-
})
|
|
6843
|
+
}).then(gatherRoutineRegistrationTask)
|
|
6532
6844
|
)
|
|
6533
6845
|
);
|
|
6534
|
-
CadenzaService.createUniqueMetaTask(
|
|
6535
|
-
"Gather routine registration",
|
|
6536
|
-
() => {
|
|
6537
|
-
this.routinesSynced = true;
|
|
6538
|
-
return true;
|
|
6539
|
-
}
|
|
6540
|
-
).doOn("meta.sync_controller.routine_registration_settled").emits("meta.sync_controller.synced_routines");
|
|
6541
6846
|
this.splitTasksInRoutines = CadenzaService.createMetaTask(
|
|
6542
6847
|
"Split tasks in routines",
|
|
6543
6848
|
function* (ctx) {
|
|
@@ -6563,6 +6868,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6563
6868
|
if (!nextTask?.registered) {
|
|
6564
6869
|
continue;
|
|
6565
6870
|
}
|
|
6871
|
+
if (shouldDebugSyncRoutineName(routine.name) || shouldDebugSyncTaskName(nextTask.name)) {
|
|
6872
|
+
logSyncDebug("task_to_routine_split", {
|
|
6873
|
+
routineName: routine.name,
|
|
6874
|
+
routineVersion: routine.version,
|
|
6875
|
+
taskName: nextTask.name,
|
|
6876
|
+
taskVersion: nextTask.version,
|
|
6877
|
+
serviceName: serviceName2,
|
|
6878
|
+
registered: nextTask.registered
|
|
6879
|
+
});
|
|
6880
|
+
}
|
|
6566
6881
|
yield {
|
|
6567
6882
|
__syncing: ctx.__syncing,
|
|
6568
6883
|
data: {
|
|
@@ -6616,18 +6931,19 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6616
6931
|
}
|
|
6617
6932
|
this.splitSignalsTask = CadenzaService.createMetaTask(
|
|
6618
6933
|
"Split signals for registration",
|
|
6619
|
-
(ctx
|
|
6934
|
+
function* (ctx) {
|
|
6620
6935
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6621
6936
|
delayMs: 3e3
|
|
6622
6937
|
});
|
|
6623
6938
|
const { signals } = ctx;
|
|
6624
|
-
if (!signals) return
|
|
6939
|
+
if (!signals) return;
|
|
6625
6940
|
const filteredSignals = signals.filter(
|
|
6626
6941
|
(signal) => !signal.data.registered
|
|
6627
6942
|
).map((signal) => signal.signal);
|
|
6628
6943
|
for (const signal of filteredSignals) {
|
|
6629
6944
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signal);
|
|
6630
|
-
|
|
6945
|
+
this.signalsSynced = false;
|
|
6946
|
+
yield {
|
|
6631
6947
|
__syncing: ctx.__syncing,
|
|
6632
6948
|
data: {
|
|
6633
6949
|
name: signal,
|
|
@@ -6637,12 +6953,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6637
6953
|
isMeta
|
|
6638
6954
|
},
|
|
6639
6955
|
__signal: signal
|
|
6640
|
-
}
|
|
6956
|
+
};
|
|
6641
6957
|
}
|
|
6642
|
-
|
|
6643
|
-
}
|
|
6958
|
+
}.bind(this)
|
|
6644
6959
|
);
|
|
6645
|
-
|
|
6960
|
+
this.splitSignalsTask.then(
|
|
6646
6961
|
resolveSyncInsertTask(
|
|
6647
6962
|
this.isCadenzaDBReady,
|
|
6648
6963
|
"signal_registry",
|
|
@@ -6663,22 +6978,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6663
6978
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6664
6979
|
delayMs: 3e3
|
|
6665
6980
|
});
|
|
6666
|
-
CadenzaService.debounce(
|
|
6667
|
-
"meta.sync_controller.signal_registration_settled",
|
|
6668
|
-
{ __syncing: true },
|
|
6669
|
-
300
|
|
6670
|
-
);
|
|
6671
6981
|
return { signalName: ctx.__signal };
|
|
6672
|
-
}).then(CadenzaService.signalBroker.registerSignalTask)
|
|
6982
|
+
}).then(CadenzaService.signalBroker.registerSignalTask).then(gatherSignalRegistrationTask)
|
|
6673
6983
|
)
|
|
6674
6984
|
);
|
|
6675
|
-
CadenzaService.createUniqueMetaTask(
|
|
6676
|
-
"Gather signal registration",
|
|
6677
|
-
() => {
|
|
6678
|
-
this.signalsSynced = true;
|
|
6679
|
-
return true;
|
|
6680
|
-
}
|
|
6681
|
-
).doOn("meta.sync_controller.signal_registration_settled").emits("meta.sync_controller.synced_signals");
|
|
6682
6985
|
this.splitTasksForRegistration = CadenzaService.createMetaTask(
|
|
6683
6986
|
"Split tasks for registration",
|
|
6684
6987
|
function* (ctx) {
|
|
@@ -6693,6 +6996,19 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6693
6996
|
for (const task of tasks) {
|
|
6694
6997
|
if (task.registered) continue;
|
|
6695
6998
|
const { __functionString, __getTagCallback } = task.export();
|
|
6999
|
+
this.tasksSynced = false;
|
|
7000
|
+
if (shouldDebugSyncTaskName(task.name)) {
|
|
7001
|
+
logSyncDebug("task_registration_split", {
|
|
7002
|
+
taskName: task.name,
|
|
7003
|
+
taskVersion: task.version,
|
|
7004
|
+
serviceName: serviceName2,
|
|
7005
|
+
register: task.register,
|
|
7006
|
+
registered: task.registered,
|
|
7007
|
+
hidden: task.hidden,
|
|
7008
|
+
observedSignals: Array.from(task.observedSignals),
|
|
7009
|
+
handledIntents: Array.from(task.handlesIntents)
|
|
7010
|
+
});
|
|
7011
|
+
}
|
|
6696
7012
|
yield {
|
|
6697
7013
|
__syncing: ctx.__syncing,
|
|
6698
7014
|
data: {
|
|
@@ -6729,7 +7045,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6729
7045
|
__taskName: task.name
|
|
6730
7046
|
};
|
|
6731
7047
|
}
|
|
6732
|
-
}
|
|
7048
|
+
}.bind(this)
|
|
6733
7049
|
);
|
|
6734
7050
|
const registerTaskTask = resolveSyncInsertTask(
|
|
6735
7051
|
this.isCadenzaDBReady,
|
|
@@ -6745,6 +7061,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6745
7061
|
{ concurrency: 30 }
|
|
6746
7062
|
)?.then(
|
|
6747
7063
|
CadenzaService.createMetaTask("Record registration", (ctx, emit) => {
|
|
7064
|
+
if (shouldDebugSyncTaskName(ctx.__taskName)) {
|
|
7065
|
+
logSyncDebug("task_registration_result", {
|
|
7066
|
+
taskName: ctx.__taskName,
|
|
7067
|
+
success: didSyncInsertSucceed(ctx),
|
|
7068
|
+
ctx
|
|
7069
|
+
});
|
|
7070
|
+
}
|
|
6748
7071
|
if (!didSyncInsertSucceed(ctx)) {
|
|
6749
7072
|
return;
|
|
6750
7073
|
}
|
|
@@ -6756,13 +7079,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6756
7079
|
...ctx,
|
|
6757
7080
|
task: CadenzaService.get(ctx.__taskName)
|
|
6758
7081
|
});
|
|
6759
|
-
CadenzaService.debounce(
|
|
6760
|
-
"meta.sync_controller.task_registration_settled",
|
|
6761
|
-
{ __syncing: true },
|
|
6762
|
-
300
|
|
6763
|
-
);
|
|
6764
7082
|
return true;
|
|
6765
|
-
})
|
|
7083
|
+
}).then(gatherTaskRegistrationTask)
|
|
6766
7084
|
);
|
|
6767
7085
|
if (registerTaskTask) {
|
|
6768
7086
|
this.splitTasksForRegistration.then(registerTaskTask);
|
|
@@ -6771,6 +7089,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6771
7089
|
"Prepare created task for immediate sync",
|
|
6772
7090
|
(ctx) => {
|
|
6773
7091
|
const task = ctx.taskInstance ?? (ctx.data?.name ? CadenzaService.get(String(ctx.data.name)) : void 0);
|
|
7092
|
+
if (shouldDebugSyncTaskName(task?.name ?? ctx?.data?.name)) {
|
|
7093
|
+
logSyncDebug("task_created_for_immediate_sync", {
|
|
7094
|
+
incomingTaskName: ctx?.data?.name ?? null,
|
|
7095
|
+
resolvedTaskName: task?.name ?? null,
|
|
7096
|
+
exists: Boolean(task),
|
|
7097
|
+
hidden: task?.hidden ?? null,
|
|
7098
|
+
register: task?.register ?? null,
|
|
7099
|
+
registered: task?.registered ?? null
|
|
7100
|
+
});
|
|
7101
|
+
}
|
|
6774
7102
|
if (!task || task.hidden || !task.register || task.registered) {
|
|
6775
7103
|
return false;
|
|
6776
7104
|
}
|
|
@@ -6785,13 +7113,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6785
7113
|
isHidden: true
|
|
6786
7114
|
}
|
|
6787
7115
|
).doOn("meta.task.created").then(this.splitTasksForRegistration);
|
|
6788
|
-
CadenzaService.createUniqueMetaTask(
|
|
6789
|
-
"Gather task registration",
|
|
6790
|
-
() => {
|
|
6791
|
-
this.tasksSynced = true;
|
|
6792
|
-
return true;
|
|
6793
|
-
}
|
|
6794
|
-
).doOn("meta.sync_controller.task_registration_settled").emits("meta.sync_controller.synced_tasks");
|
|
6795
7116
|
this.splitActorsForRegistration = CadenzaService.createMetaTask(
|
|
6796
7117
|
"Split actors for registration",
|
|
6797
7118
|
function* (ctx) {
|
|
@@ -6815,6 +7136,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6815
7136
|
if (this.registeredActors.has(registrationKey)) {
|
|
6816
7137
|
continue;
|
|
6817
7138
|
}
|
|
7139
|
+
this.actorsSynced = false;
|
|
6818
7140
|
yield {
|
|
6819
7141
|
data,
|
|
6820
7142
|
__actorRegistrationKey: registrationKey
|
|
@@ -6843,22 +7165,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6843
7165
|
delayMs: 3e3
|
|
6844
7166
|
});
|
|
6845
7167
|
this.registeredActors.add(ctx.__actorRegistrationKey);
|
|
6846
|
-
CadenzaService.debounce(
|
|
6847
|
-
"meta.sync_controller.actor_registration_settled",
|
|
6848
|
-
{ __syncing: true },
|
|
6849
|
-
300
|
|
6850
|
-
);
|
|
6851
7168
|
return true;
|
|
6852
|
-
})
|
|
7169
|
+
}).then(gatherActorRegistrationTask)
|
|
6853
7170
|
)
|
|
6854
7171
|
);
|
|
6855
|
-
CadenzaService.createUniqueMetaTask(
|
|
6856
|
-
"Gather actor registration",
|
|
6857
|
-
() => {
|
|
6858
|
-
this.actorsSynced = true;
|
|
6859
|
-
return true;
|
|
6860
|
-
}
|
|
6861
|
-
).doOn("meta.sync_controller.actor_registration_settled").emits("meta.sync_controller.synced_actors");
|
|
6862
7172
|
this.registerActorTaskMapTask = CadenzaService.createMetaTask(
|
|
6863
7173
|
"Split actor task maps",
|
|
6864
7174
|
function* (ctx) {
|
|
@@ -6955,6 +7265,17 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6955
7265
|
continue;
|
|
6956
7266
|
}
|
|
6957
7267
|
const { isGlobal } = decomposeSignalName(_signal);
|
|
7268
|
+
if (shouldDebugSyncTaskName(task.name)) {
|
|
7269
|
+
logSyncDebug("signal_to_task_map_split", {
|
|
7270
|
+
taskName: task.name,
|
|
7271
|
+
signalName: _signal,
|
|
7272
|
+
rawSignal: signal,
|
|
7273
|
+
serviceName: serviceName2,
|
|
7274
|
+
observerRegistered: CadenzaService.signalBroker.signalObservers?.get(
|
|
7275
|
+
_signal
|
|
7276
|
+
)?.registered
|
|
7277
|
+
});
|
|
7278
|
+
}
|
|
6958
7279
|
emit("meta.sync_controller.signal_task_map_split", {
|
|
6959
7280
|
__syncing: ctx.__syncing,
|
|
6960
7281
|
data: {
|
|
@@ -6994,12 +7315,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6994
7315
|
);
|
|
6995
7316
|
this.splitIntentsTask = CadenzaService.createMetaTask(
|
|
6996
7317
|
"Split intents for registration",
|
|
6997
|
-
function(ctx
|
|
7318
|
+
function* (ctx) {
|
|
6998
7319
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6999
7320
|
delayMs: 3e3
|
|
7000
7321
|
});
|
|
7001
7322
|
const intents = Array.isArray(ctx.intents) ? ctx.intents : Array.from(CadenzaService.inquiryBroker.intents.values());
|
|
7002
|
-
let emittedCount = 0;
|
|
7003
7323
|
for (const intent of intents) {
|
|
7004
7324
|
const intentData = buildIntentRegistryData(intent);
|
|
7005
7325
|
if (!intentData) {
|
|
@@ -7008,17 +7328,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7008
7328
|
if (this.registeredIntentDefinitions.has(intentData.name)) {
|
|
7009
7329
|
continue;
|
|
7010
7330
|
}
|
|
7011
|
-
|
|
7331
|
+
this.intentsSynced = false;
|
|
7332
|
+
yield {
|
|
7012
7333
|
__syncing: ctx.__syncing,
|
|
7013
7334
|
data: intentData,
|
|
7014
7335
|
__intentName: intentData.name
|
|
7015
|
-
}
|
|
7016
|
-
emittedCount += 1;
|
|
7336
|
+
};
|
|
7017
7337
|
}
|
|
7018
|
-
return emittedCount > 0;
|
|
7019
7338
|
}.bind(this)
|
|
7020
7339
|
);
|
|
7021
|
-
|
|
7340
|
+
this.splitIntentsTask.then(
|
|
7022
7341
|
insertIntentRegistryTask?.then(
|
|
7023
7342
|
CadenzaService.createMetaTask("Record intent definition registration", (ctx) => {
|
|
7024
7343
|
if (!didSyncInsertSucceed(ctx)) {
|
|
@@ -7028,22 +7347,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7028
7347
|
delayMs: 3e3
|
|
7029
7348
|
});
|
|
7030
7349
|
this.registeredIntentDefinitions.add(ctx.__intentName);
|
|
7031
|
-
CadenzaService.debounce(
|
|
7032
|
-
"meta.sync_controller.intent_registration_settled",
|
|
7033
|
-
{ __syncing: true },
|
|
7034
|
-
300
|
|
7035
|
-
);
|
|
7036
7350
|
return true;
|
|
7037
|
-
})
|
|
7351
|
+
}).then(gatherIntentRegistrationTask)
|
|
7038
7352
|
)
|
|
7039
7353
|
);
|
|
7040
|
-
CadenzaService.createUniqueMetaTask(
|
|
7041
|
-
"Gather intent registration",
|
|
7042
|
-
() => {
|
|
7043
|
-
this.intentsSynced = true;
|
|
7044
|
-
return true;
|
|
7045
|
-
}
|
|
7046
|
-
).doOn("meta.sync_controller.intent_registration_settled").emits("meta.sync_controller.synced_intents");
|
|
7047
7354
|
const registerIntentTask = CadenzaService.createMetaTask(
|
|
7048
7355
|
"Record intent registration",
|
|
7049
7356
|
(ctx) => {
|
|
@@ -7093,6 +7400,15 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7093
7400
|
if (!intentDefinition) {
|
|
7094
7401
|
continue;
|
|
7095
7402
|
}
|
|
7403
|
+
if (shouldDebugSyncTaskName(task.name) || shouldDebugSyncIntentName(intent)) {
|
|
7404
|
+
logSyncDebug("intent_to_task_map_split", {
|
|
7405
|
+
taskName: task.name,
|
|
7406
|
+
taskVersion: task.version,
|
|
7407
|
+
intentName: intent,
|
|
7408
|
+
serviceName: serviceName2,
|
|
7409
|
+
intentDefinition
|
|
7410
|
+
});
|
|
7411
|
+
}
|
|
7096
7412
|
emit("meta.sync_controller.intent_task_map_split", {
|
|
7097
7413
|
__syncing: ctx.__syncing,
|
|
7098
7414
|
data: {
|
|
@@ -7122,6 +7438,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7122
7438
|
if (!ctx.__intentDefinition || !ctx.__intentMapData) {
|
|
7123
7439
|
return false;
|
|
7124
7440
|
}
|
|
7441
|
+
if (shouldDebugSyncTaskName(ctx.__taskName) || shouldDebugSyncIntentName(ctx.__intent)) {
|
|
7442
|
+
logSyncDebug("intent_definition_prepare", {
|
|
7443
|
+
taskName: ctx.__taskName,
|
|
7444
|
+
intentName: ctx.__intent,
|
|
7445
|
+
intentDefinition: ctx.__intentDefinition
|
|
7446
|
+
});
|
|
7447
|
+
}
|
|
7125
7448
|
return {
|
|
7126
7449
|
...ctx,
|
|
7127
7450
|
data: ctx.__intentDefinition
|
|
@@ -7135,6 +7458,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7135
7458
|
if (!ctx.__intentMapData) {
|
|
7136
7459
|
return false;
|
|
7137
7460
|
}
|
|
7461
|
+
if (shouldDebugSyncTaskName(ctx.__taskName) || shouldDebugSyncIntentName(ctx.__intent)) {
|
|
7462
|
+
logSyncDebug("intent_map_payload_restore", {
|
|
7463
|
+
taskName: ctx.__taskName,
|
|
7464
|
+
intentName: ctx.__intent,
|
|
7465
|
+
intentMapData: ctx.__intentMapData
|
|
7466
|
+
});
|
|
7467
|
+
}
|
|
7138
7468
|
return {
|
|
7139
7469
|
...ctx,
|
|
7140
7470
|
data: ctx.__intentMapData
|
|
@@ -7314,15 +7644,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7314
7644
|
__authoritativeReconciliation: true
|
|
7315
7645
|
});
|
|
7316
7646
|
}
|
|
7317
|
-
if (authoritativeTasks.length > 0) {
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
__authoritativeReconciliation: true
|
|
7323
|
-
},
|
|
7324
|
-
300
|
|
7325
|
-
);
|
|
7647
|
+
if (authoritativeTasks.length > 0 || changed) {
|
|
7648
|
+
finalizeTaskSync(emit, {
|
|
7649
|
+
...ctx,
|
|
7650
|
+
__authoritativeReconciliation: true
|
|
7651
|
+
});
|
|
7326
7652
|
}
|
|
7327
7653
|
return changed;
|
|
7328
7654
|
},
|
|
@@ -7334,7 +7660,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7334
7660
|
);
|
|
7335
7661
|
const reconcileRoutineRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7336
7662
|
"Reconcile routine registration from authority",
|
|
7337
|
-
(ctx) => {
|
|
7663
|
+
(ctx, emit) => {
|
|
7338
7664
|
const authoritativeRoutines = resolveSyncQueryRows(ctx, "routine");
|
|
7339
7665
|
let changed = false;
|
|
7340
7666
|
for (const row of authoritativeRoutines) {
|
|
@@ -7349,15 +7675,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7349
7675
|
routine.registered = true;
|
|
7350
7676
|
changed = true;
|
|
7351
7677
|
}
|
|
7352
|
-
if (authoritativeRoutines.length > 0) {
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
__authoritativeReconciliation: true
|
|
7358
|
-
},
|
|
7359
|
-
300
|
|
7360
|
-
);
|
|
7678
|
+
if (authoritativeRoutines.length > 0 || changed) {
|
|
7679
|
+
finalizeRoutineSync(emit, {
|
|
7680
|
+
...ctx,
|
|
7681
|
+
__authoritativeReconciliation: true
|
|
7682
|
+
});
|
|
7361
7683
|
}
|
|
7362
7684
|
return changed;
|
|
7363
7685
|
},
|
|
@@ -7369,7 +7691,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7369
7691
|
);
|
|
7370
7692
|
const reconcileSignalRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7371
7693
|
"Reconcile signal registration from authority",
|
|
7372
|
-
(ctx) => {
|
|
7694
|
+
(ctx, emit) => {
|
|
7373
7695
|
const authoritativeSignals = resolveSyncQueryRows(ctx, "signal_registry");
|
|
7374
7696
|
const signalObservers = CadenzaService.signalBroker.signalObservers;
|
|
7375
7697
|
let changed = false;
|
|
@@ -7385,15 +7707,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7385
7707
|
observer.registered = true;
|
|
7386
7708
|
changed = true;
|
|
7387
7709
|
}
|
|
7388
|
-
if (authoritativeSignals.length > 0) {
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
__authoritativeReconciliation: true
|
|
7394
|
-
},
|
|
7395
|
-
300
|
|
7396
|
-
);
|
|
7710
|
+
if (authoritativeSignals.length > 0 || changed) {
|
|
7711
|
+
finalizeSignalSync(emit, {
|
|
7712
|
+
...ctx,
|
|
7713
|
+
__authoritativeReconciliation: true
|
|
7714
|
+
});
|
|
7397
7715
|
}
|
|
7398
7716
|
return changed;
|
|
7399
7717
|
},
|
|
@@ -7405,7 +7723,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7405
7723
|
);
|
|
7406
7724
|
const reconcileIntentRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7407
7725
|
"Reconcile intent registration from authority",
|
|
7408
|
-
(ctx) => {
|
|
7726
|
+
(ctx, emit) => {
|
|
7409
7727
|
const authoritativeIntents = resolveSyncQueryRows(ctx, "intent_registry");
|
|
7410
7728
|
let changed = false;
|
|
7411
7729
|
for (const row of authoritativeIntents) {
|
|
@@ -7419,15 +7737,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7419
7737
|
this.registeredIntentDefinitions.add(intentName);
|
|
7420
7738
|
changed = true;
|
|
7421
7739
|
}
|
|
7422
|
-
if (authoritativeIntents.length > 0) {
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
__authoritativeReconciliation: true
|
|
7428
|
-
},
|
|
7429
|
-
300
|
|
7430
|
-
);
|
|
7740
|
+
if (authoritativeIntents.length > 0 || changed) {
|
|
7741
|
+
finalizeIntentSync(emit, {
|
|
7742
|
+
...ctx,
|
|
7743
|
+
__authoritativeReconciliation: true
|
|
7744
|
+
});
|
|
7431
7745
|
}
|
|
7432
7746
|
return changed;
|
|
7433
7747
|
},
|