@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.js
CHANGED
|
@@ -6246,10 +6246,21 @@ function buildSyncInsertQueryData(ctx, queryData = {}) {
|
|
|
6246
6246
|
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
6247
6247
|
const localInsertTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName);
|
|
6248
6248
|
const remoteInsertTask = isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, options) : void 0;
|
|
6249
|
+
const debugTable = shouldDebugSyncTable(tableName);
|
|
6249
6250
|
if (!localInsertTask && !remoteInsertTask) {
|
|
6250
6251
|
return void 0;
|
|
6251
6252
|
}
|
|
6252
6253
|
const targetTask = localInsertTask ?? remoteInsertTask;
|
|
6254
|
+
if (debugTable) {
|
|
6255
|
+
logSyncDebug("insert_task_resolved", {
|
|
6256
|
+
tableName,
|
|
6257
|
+
localInsertTaskName: localInsertTask?.name ?? null,
|
|
6258
|
+
remoteInsertTaskName: remoteInsertTask?.name ?? null,
|
|
6259
|
+
targetTaskName: targetTask.name,
|
|
6260
|
+
queryData,
|
|
6261
|
+
options
|
|
6262
|
+
});
|
|
6263
|
+
}
|
|
6253
6264
|
const executionRequestedSignal = `meta.sync_controller.insert_execution_requested:${tableName}`;
|
|
6254
6265
|
const executionResolvedSignal = `meta.sync_controller.insert_execution_resolved:${tableName}`;
|
|
6255
6266
|
const executionFailedSignal = `meta.sync_controller.insert_execution_failed:${tableName}`;
|
|
@@ -6283,6 +6294,26 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6283
6294
|
isHidden: true
|
|
6284
6295
|
}
|
|
6285
6296
|
).doOn(executionRequestedSignal).emitsOnFail(executionFailedSignal);
|
|
6297
|
+
if (debugTable) {
|
|
6298
|
+
prepareExecutionTask.then(
|
|
6299
|
+
CadenzaService.createMetaTask(
|
|
6300
|
+
`Log prepared graph sync insert execution for ${tableName}`,
|
|
6301
|
+
(ctx) => {
|
|
6302
|
+
logSyncDebug("insert_prepare", {
|
|
6303
|
+
tableName,
|
|
6304
|
+
targetTaskName: targetTask.name,
|
|
6305
|
+
ctx
|
|
6306
|
+
});
|
|
6307
|
+
return ctx;
|
|
6308
|
+
},
|
|
6309
|
+
`Logs prepared ${tableName} sync insert payloads.`,
|
|
6310
|
+
{
|
|
6311
|
+
register: false,
|
|
6312
|
+
isHidden: true
|
|
6313
|
+
}
|
|
6314
|
+
)
|
|
6315
|
+
);
|
|
6316
|
+
}
|
|
6286
6317
|
const finalizeExecutionTask = CadenzaService.createMetaTask(
|
|
6287
6318
|
`Finalize graph sync insert execution for ${tableName}`,
|
|
6288
6319
|
(ctx, emit) => {
|
|
@@ -6299,6 +6330,14 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6299
6330
|
...ctx,
|
|
6300
6331
|
queryData: ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : originalQueryData
|
|
6301
6332
|
};
|
|
6333
|
+
if (debugTable) {
|
|
6334
|
+
logSyncDebug("insert_finalize", {
|
|
6335
|
+
tableName,
|
|
6336
|
+
targetTaskName: targetTask.name,
|
|
6337
|
+
success: didSyncInsertSucceed(normalizedContext),
|
|
6338
|
+
ctx: normalizedContext
|
|
6339
|
+
});
|
|
6340
|
+
}
|
|
6302
6341
|
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6303
6342
|
emit(executionResolvedSignal, normalizedContext);
|
|
6304
6343
|
return normalizedContext;
|
|
@@ -6311,6 +6350,27 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
6311
6350
|
);
|
|
6312
6351
|
targetTask.then(finalizeExecutionTask).emitsOnFail(executionFailedSignal);
|
|
6313
6352
|
prepareExecutionTask.then(targetTask);
|
|
6353
|
+
if (debugTable) {
|
|
6354
|
+
CadenzaService.createMetaTask(
|
|
6355
|
+
`Log failed graph sync insert execution for ${tableName}`,
|
|
6356
|
+
(ctx) => {
|
|
6357
|
+
logSyncDebug("insert_failed", {
|
|
6358
|
+
tableName,
|
|
6359
|
+
targetTaskName: targetTask.name,
|
|
6360
|
+
ctx
|
|
6361
|
+
});
|
|
6362
|
+
if (typeof ctx.__resolverRequestId === "string") {
|
|
6363
|
+
pendingResolverContexts.delete(ctx.__resolverRequestId);
|
|
6364
|
+
}
|
|
6365
|
+
return false;
|
|
6366
|
+
},
|
|
6367
|
+
`Logs failed ${tableName} sync insert executions.`,
|
|
6368
|
+
{
|
|
6369
|
+
register: false,
|
|
6370
|
+
isHidden: true
|
|
6371
|
+
}
|
|
6372
|
+
).doOn(executionFailedSignal);
|
|
6373
|
+
}
|
|
6314
6374
|
return CadenzaService.createMetaTask(
|
|
6315
6375
|
`Resolve graph sync insert for ${tableName}`,
|
|
6316
6376
|
(ctx, emit) => new Promise((resolve) => {
|
|
@@ -6366,6 +6426,104 @@ var AUTHORITY_QUERY_RESULT_KEYS = {
|
|
|
6366
6426
|
intent_registry: "intentRegistrys"
|
|
6367
6427
|
};
|
|
6368
6428
|
var EARLY_SYNC_REQUEST_DELAYS_MS = [2e3, 1e4, 3e4];
|
|
6429
|
+
var SYNC_DEBUG_PREFIX = "[CADENZA_SYNC_DEBUG]";
|
|
6430
|
+
var SYNC_DEBUG_TABLES = /* @__PURE__ */ new Set([
|
|
6431
|
+
"task",
|
|
6432
|
+
"routine",
|
|
6433
|
+
"task_to_routine_map",
|
|
6434
|
+
"signal_registry",
|
|
6435
|
+
"intent_registry",
|
|
6436
|
+
"signal_to_task_map",
|
|
6437
|
+
"intent_to_task_map"
|
|
6438
|
+
]);
|
|
6439
|
+
var SYNC_DEBUG_TASK_NAMES = /* @__PURE__ */ new Set([
|
|
6440
|
+
"Query service_instance",
|
|
6441
|
+
"Query service_instance_transport",
|
|
6442
|
+
"Query intent_to_task_map",
|
|
6443
|
+
"Query signal_to_task_map",
|
|
6444
|
+
"Prepare for signal sync",
|
|
6445
|
+
"Compile sync data and broadcast",
|
|
6446
|
+
"Forward service instance sync",
|
|
6447
|
+
"Forward service transport sync",
|
|
6448
|
+
"Forward intent to task map sync",
|
|
6449
|
+
"Forward signal to task map sync"
|
|
6450
|
+
]);
|
|
6451
|
+
var SYNC_DEBUG_ROUTINE_NAMES = /* @__PURE__ */ new Set(["Sync services"]);
|
|
6452
|
+
var SYNC_DEBUG_INTENT_NAMES = /* @__PURE__ */ new Set([
|
|
6453
|
+
"meta-service-registry-full-sync",
|
|
6454
|
+
"runner-traffic-runtime-get",
|
|
6455
|
+
"iot-telemetry-ingest",
|
|
6456
|
+
"query-pg-CadenzaDBPostgresActor-service_instance",
|
|
6457
|
+
"query-pg-CadenzaDBPostgresActor-service_instance_transport",
|
|
6458
|
+
"query-pg-CadenzaDBPostgresActor-intent_to_task_map",
|
|
6459
|
+
"query-pg-CadenzaDBPostgresActor-signal_to_task_map"
|
|
6460
|
+
]);
|
|
6461
|
+
function shouldDebugSyncTable(tableName) {
|
|
6462
|
+
return SYNC_DEBUG_TABLES.has(tableName);
|
|
6463
|
+
}
|
|
6464
|
+
function shouldDebugSyncTaskName(taskName) {
|
|
6465
|
+
return typeof taskName === "string" && SYNC_DEBUG_TASK_NAMES.has(taskName);
|
|
6466
|
+
}
|
|
6467
|
+
function shouldDebugSyncRoutineName(routineName) {
|
|
6468
|
+
return typeof routineName === "string" && SYNC_DEBUG_ROUTINE_NAMES.has(routineName);
|
|
6469
|
+
}
|
|
6470
|
+
function shouldDebugSyncIntentName(intentName) {
|
|
6471
|
+
return typeof intentName === "string" && SYNC_DEBUG_INTENT_NAMES.has(intentName);
|
|
6472
|
+
}
|
|
6473
|
+
function summarizeSyncDebugValue(value, depth = 0) {
|
|
6474
|
+
if (value === null || value === void 0) {
|
|
6475
|
+
return value;
|
|
6476
|
+
}
|
|
6477
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
6478
|
+
return value;
|
|
6479
|
+
}
|
|
6480
|
+
if (value instanceof Set) {
|
|
6481
|
+
return {
|
|
6482
|
+
__type: "Set",
|
|
6483
|
+
size: value.size,
|
|
6484
|
+
values: Array.from(value).slice(0, 8).map((item) => summarizeSyncDebugValue(item, depth + 1))
|
|
6485
|
+
};
|
|
6486
|
+
}
|
|
6487
|
+
if (value instanceof Map) {
|
|
6488
|
+
return {
|
|
6489
|
+
__type: "Map",
|
|
6490
|
+
size: value.size
|
|
6491
|
+
};
|
|
6492
|
+
}
|
|
6493
|
+
if (Array.isArray(value)) {
|
|
6494
|
+
return {
|
|
6495
|
+
__type: "Array",
|
|
6496
|
+
length: value.length,
|
|
6497
|
+
items: value.slice(0, 5).map((item) => summarizeSyncDebugValue(item, depth + 1))
|
|
6498
|
+
};
|
|
6499
|
+
}
|
|
6500
|
+
if (typeof value === "object") {
|
|
6501
|
+
if (depth >= 2) {
|
|
6502
|
+
return "[object]";
|
|
6503
|
+
}
|
|
6504
|
+
const output = {};
|
|
6505
|
+
const entries = Object.entries(value).filter(
|
|
6506
|
+
([key]) => ![
|
|
6507
|
+
"functionString",
|
|
6508
|
+
"tagIdGetter",
|
|
6509
|
+
"__functionString",
|
|
6510
|
+
"__getTagCallback",
|
|
6511
|
+
"joinedContexts",
|
|
6512
|
+
"task",
|
|
6513
|
+
"taskInstance",
|
|
6514
|
+
"tasks"
|
|
6515
|
+
].includes(key)
|
|
6516
|
+
).slice(0, 12);
|
|
6517
|
+
for (const [key, nestedValue] of entries) {
|
|
6518
|
+
output[key] = summarizeSyncDebugValue(nestedValue, depth + 1);
|
|
6519
|
+
}
|
|
6520
|
+
return output;
|
|
6521
|
+
}
|
|
6522
|
+
return String(value);
|
|
6523
|
+
}
|
|
6524
|
+
function logSyncDebug(event, payload) {
|
|
6525
|
+
console.log(`${SYNC_DEBUG_PREFIX} ${event}`, summarizeSyncDebugValue(payload));
|
|
6526
|
+
}
|
|
6369
6527
|
function resolveSyncQueryRows(ctx, tableName) {
|
|
6370
6528
|
const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
|
|
6371
6529
|
const rows = ctx?.[resultKey];
|
|
@@ -6394,6 +6552,31 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
|
|
|
6394
6552
|
}
|
|
6395
6553
|
).then(targetTask);
|
|
6396
6554
|
}
|
|
6555
|
+
function getRegistrableTasks() {
|
|
6556
|
+
return Array.from(CadenzaService.registry.tasks.values()).filter(
|
|
6557
|
+
(task) => task.register && !task.isHidden
|
|
6558
|
+
);
|
|
6559
|
+
}
|
|
6560
|
+
function getRegistrableRoutines() {
|
|
6561
|
+
return Array.from(CadenzaService.registry.routines.values());
|
|
6562
|
+
}
|
|
6563
|
+
function getRegistrableSignalObservers() {
|
|
6564
|
+
const signalObservers = CadenzaService.signalBroker.signalObservers;
|
|
6565
|
+
return signalObservers ? Array.from(signalObservers.values()) : [];
|
|
6566
|
+
}
|
|
6567
|
+
function getRegistrableIntentNames() {
|
|
6568
|
+
return Array.from(CadenzaService.inquiryBroker.intents.values()).map((intent) => buildIntentRegistryData(intent)).filter(
|
|
6569
|
+
(intentDefinition) => intentDefinition !== null
|
|
6570
|
+
).map((intentDefinition) => String(intentDefinition.name));
|
|
6571
|
+
}
|
|
6572
|
+
function buildActorRegistrationKey(actor, serviceName) {
|
|
6573
|
+
const data = buildActorRegistrationData(actor);
|
|
6574
|
+
const name = typeof data.name === "string" && data.name.trim().length > 0 ? data.name.trim() : "";
|
|
6575
|
+
if (!name) {
|
|
6576
|
+
return null;
|
|
6577
|
+
}
|
|
6578
|
+
return `${name}|${data.version}|${serviceName}`;
|
|
6579
|
+
}
|
|
6397
6580
|
var GraphSyncController = class _GraphSyncController {
|
|
6398
6581
|
constructor() {
|
|
6399
6582
|
this.registeredActors = /* @__PURE__ */ new Set();
|
|
@@ -6518,22 +6701,158 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6518
6701
|
{},
|
|
6519
6702
|
{ concurrency: 10 }
|
|
6520
6703
|
);
|
|
6704
|
+
const finalizeTaskSync = (emit, ctx) => {
|
|
6705
|
+
const pendingTasks = getRegistrableTasks().filter((task) => !task.registered);
|
|
6706
|
+
if (pendingTasks.length > 0) {
|
|
6707
|
+
this.tasksSynced = false;
|
|
6708
|
+
return false;
|
|
6709
|
+
}
|
|
6710
|
+
const shouldEmit = !this.tasksSynced;
|
|
6711
|
+
this.tasksSynced = true;
|
|
6712
|
+
if (shouldEmit) {
|
|
6713
|
+
emit("meta.sync_controller.synced_tasks", {
|
|
6714
|
+
__syncing: true,
|
|
6715
|
+
...ctx
|
|
6716
|
+
});
|
|
6717
|
+
}
|
|
6718
|
+
return true;
|
|
6719
|
+
};
|
|
6720
|
+
const finalizeRoutineSync = (emit, ctx) => {
|
|
6721
|
+
const pendingRoutines = getRegistrableRoutines().filter(
|
|
6722
|
+
(routine) => !routine.registered
|
|
6723
|
+
);
|
|
6724
|
+
if (pendingRoutines.length > 0) {
|
|
6725
|
+
this.routinesSynced = false;
|
|
6726
|
+
return false;
|
|
6727
|
+
}
|
|
6728
|
+
const shouldEmit = !this.routinesSynced;
|
|
6729
|
+
this.routinesSynced = true;
|
|
6730
|
+
if (shouldEmit) {
|
|
6731
|
+
emit("meta.sync_controller.synced_routines", {
|
|
6732
|
+
__syncing: true,
|
|
6733
|
+
...ctx
|
|
6734
|
+
});
|
|
6735
|
+
}
|
|
6736
|
+
return true;
|
|
6737
|
+
};
|
|
6738
|
+
const finalizeSignalSync = (emit, ctx) => {
|
|
6739
|
+
const pendingSignals = getRegistrableSignalObservers().filter(
|
|
6740
|
+
(observer) => observer?.registered !== true
|
|
6741
|
+
);
|
|
6742
|
+
if (pendingSignals.length > 0) {
|
|
6743
|
+
this.signalsSynced = false;
|
|
6744
|
+
return false;
|
|
6745
|
+
}
|
|
6746
|
+
const shouldEmit = !this.signalsSynced;
|
|
6747
|
+
this.signalsSynced = true;
|
|
6748
|
+
if (shouldEmit) {
|
|
6749
|
+
emit("meta.sync_controller.synced_signals", {
|
|
6750
|
+
__syncing: true,
|
|
6751
|
+
...ctx
|
|
6752
|
+
});
|
|
6753
|
+
}
|
|
6754
|
+
return true;
|
|
6755
|
+
};
|
|
6756
|
+
const finalizeIntentSync = (emit, ctx) => {
|
|
6757
|
+
const pendingIntentNames = getRegistrableIntentNames().filter(
|
|
6758
|
+
(intentName) => !this.registeredIntentDefinitions.has(intentName)
|
|
6759
|
+
);
|
|
6760
|
+
if (pendingIntentNames.length > 0) {
|
|
6761
|
+
this.intentsSynced = false;
|
|
6762
|
+
return false;
|
|
6763
|
+
}
|
|
6764
|
+
const shouldEmit = !this.intentsSynced;
|
|
6765
|
+
this.intentsSynced = true;
|
|
6766
|
+
if (shouldEmit) {
|
|
6767
|
+
emit("meta.sync_controller.synced_intents", {
|
|
6768
|
+
__syncing: true,
|
|
6769
|
+
...ctx
|
|
6770
|
+
});
|
|
6771
|
+
}
|
|
6772
|
+
return true;
|
|
6773
|
+
};
|
|
6774
|
+
const finalizeActorSync = (emit, ctx) => {
|
|
6775
|
+
const syncServiceName = resolveSyncServiceName();
|
|
6776
|
+
if (!syncServiceName) {
|
|
6777
|
+
this.actorsSynced = false;
|
|
6778
|
+
return false;
|
|
6779
|
+
}
|
|
6780
|
+
const pendingActorKeys = CadenzaService.getAllActors().map((actor) => buildActorRegistrationKey(actor, syncServiceName)).filter((registrationKey) => Boolean(registrationKey)).filter((registrationKey) => !this.registeredActors.has(registrationKey));
|
|
6781
|
+
if (pendingActorKeys.length > 0) {
|
|
6782
|
+
this.actorsSynced = false;
|
|
6783
|
+
return false;
|
|
6784
|
+
}
|
|
6785
|
+
const shouldEmit = !this.actorsSynced;
|
|
6786
|
+
this.actorsSynced = true;
|
|
6787
|
+
if (shouldEmit) {
|
|
6788
|
+
emit("meta.sync_controller.synced_actors", {
|
|
6789
|
+
__syncing: true,
|
|
6790
|
+
...ctx
|
|
6791
|
+
});
|
|
6792
|
+
}
|
|
6793
|
+
return true;
|
|
6794
|
+
};
|
|
6795
|
+
const gatherTaskRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6796
|
+
"Gather task registration",
|
|
6797
|
+
(ctx, emit) => finalizeTaskSync(emit, ctx),
|
|
6798
|
+
"Completes task registration when all registrable tasks are marked registered.",
|
|
6799
|
+
{
|
|
6800
|
+
register: false,
|
|
6801
|
+
isHidden: true
|
|
6802
|
+
}
|
|
6803
|
+
);
|
|
6804
|
+
const gatherRoutineRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6805
|
+
"Gather routine registration",
|
|
6806
|
+
(ctx, emit) => finalizeRoutineSync(emit, ctx),
|
|
6807
|
+
"Completes routine registration when all registrable routines are marked registered.",
|
|
6808
|
+
{
|
|
6809
|
+
register: false,
|
|
6810
|
+
isHidden: true
|
|
6811
|
+
}
|
|
6812
|
+
);
|
|
6813
|
+
const gatherSignalRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6814
|
+
"Gather signal registration",
|
|
6815
|
+
(ctx, emit) => finalizeSignalSync(emit, ctx),
|
|
6816
|
+
"Completes signal registration when all signal observers are marked registered.",
|
|
6817
|
+
{
|
|
6818
|
+
register: false,
|
|
6819
|
+
isHidden: true
|
|
6820
|
+
}
|
|
6821
|
+
);
|
|
6822
|
+
const gatherIntentRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6823
|
+
"Gather intent registration",
|
|
6824
|
+
(ctx, emit) => finalizeIntentSync(emit, ctx),
|
|
6825
|
+
"Completes intent registration when all registrable intents are marked registered.",
|
|
6826
|
+
{
|
|
6827
|
+
register: false,
|
|
6828
|
+
isHidden: true
|
|
6829
|
+
}
|
|
6830
|
+
);
|
|
6831
|
+
const gatherActorRegistrationTask = CadenzaService.createUniqueMetaTask(
|
|
6832
|
+
"Gather actor registration",
|
|
6833
|
+
(ctx, emit) => finalizeActorSync(emit, ctx),
|
|
6834
|
+
"Completes actor registration when all registrable actors are marked registered.",
|
|
6835
|
+
{
|
|
6836
|
+
register: false,
|
|
6837
|
+
isHidden: true
|
|
6838
|
+
}
|
|
6839
|
+
);
|
|
6521
6840
|
this.splitRoutinesTask = CadenzaService.createMetaTask(
|
|
6522
6841
|
"Split routines for registration",
|
|
6523
|
-
(ctx
|
|
6842
|
+
function* (ctx) {
|
|
6524
6843
|
const { routines } = ctx;
|
|
6525
|
-
if (!routines) return
|
|
6844
|
+
if (!routines) return;
|
|
6526
6845
|
const serviceName2 = resolveSyncServiceName();
|
|
6527
6846
|
if (!serviceName2) {
|
|
6528
|
-
return
|
|
6847
|
+
return;
|
|
6529
6848
|
}
|
|
6530
6849
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6531
6850
|
delayMs: 2e3
|
|
6532
6851
|
});
|
|
6533
|
-
let emittedCount = 0;
|
|
6534
6852
|
for (const routine of routines) {
|
|
6535
6853
|
if (routine.registered) continue;
|
|
6536
|
-
|
|
6854
|
+
this.routinesSynced = false;
|
|
6855
|
+
yield {
|
|
6537
6856
|
__syncing: ctx.__syncing,
|
|
6538
6857
|
data: {
|
|
6539
6858
|
name: routine.name,
|
|
@@ -6543,13 +6862,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6543
6862
|
isMeta: routine.isMeta
|
|
6544
6863
|
},
|
|
6545
6864
|
__routineName: routine.name
|
|
6546
|
-
}
|
|
6547
|
-
emittedCount += 1;
|
|
6865
|
+
};
|
|
6548
6866
|
}
|
|
6549
|
-
|
|
6550
|
-
}
|
|
6867
|
+
}.bind(this)
|
|
6551
6868
|
);
|
|
6552
|
-
|
|
6869
|
+
this.splitRoutinesTask.then(
|
|
6553
6870
|
resolveSyncInsertTask(
|
|
6554
6871
|
this.isCadenzaDBReady,
|
|
6555
6872
|
"routine",
|
|
@@ -6571,22 +6888,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6571
6888
|
delayMs: 3e3
|
|
6572
6889
|
});
|
|
6573
6890
|
CadenzaService.getRoutine(ctx.__routineName).registered = true;
|
|
6574
|
-
CadenzaService.debounce(
|
|
6575
|
-
"meta.sync_controller.routine_registration_settled",
|
|
6576
|
-
{ __syncing: true },
|
|
6577
|
-
300
|
|
6578
|
-
);
|
|
6579
6891
|
return true;
|
|
6580
|
-
})
|
|
6892
|
+
}).then(gatherRoutineRegistrationTask)
|
|
6581
6893
|
)
|
|
6582
6894
|
);
|
|
6583
|
-
CadenzaService.createUniqueMetaTask(
|
|
6584
|
-
"Gather routine registration",
|
|
6585
|
-
() => {
|
|
6586
|
-
this.routinesSynced = true;
|
|
6587
|
-
return true;
|
|
6588
|
-
}
|
|
6589
|
-
).doOn("meta.sync_controller.routine_registration_settled").emits("meta.sync_controller.synced_routines");
|
|
6590
6895
|
this.splitTasksInRoutines = CadenzaService.createMetaTask(
|
|
6591
6896
|
"Split tasks in routines",
|
|
6592
6897
|
function* (ctx) {
|
|
@@ -6612,6 +6917,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6612
6917
|
if (!nextTask?.registered) {
|
|
6613
6918
|
continue;
|
|
6614
6919
|
}
|
|
6920
|
+
if (shouldDebugSyncRoutineName(routine.name) || shouldDebugSyncTaskName(nextTask.name)) {
|
|
6921
|
+
logSyncDebug("task_to_routine_split", {
|
|
6922
|
+
routineName: routine.name,
|
|
6923
|
+
routineVersion: routine.version,
|
|
6924
|
+
taskName: nextTask.name,
|
|
6925
|
+
taskVersion: nextTask.version,
|
|
6926
|
+
serviceName: serviceName2,
|
|
6927
|
+
registered: nextTask.registered
|
|
6928
|
+
});
|
|
6929
|
+
}
|
|
6615
6930
|
yield {
|
|
6616
6931
|
__syncing: ctx.__syncing,
|
|
6617
6932
|
data: {
|
|
@@ -6665,18 +6980,19 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6665
6980
|
}
|
|
6666
6981
|
this.splitSignalsTask = CadenzaService.createMetaTask(
|
|
6667
6982
|
"Split signals for registration",
|
|
6668
|
-
(ctx
|
|
6983
|
+
function* (ctx) {
|
|
6669
6984
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6670
6985
|
delayMs: 3e3
|
|
6671
6986
|
});
|
|
6672
6987
|
const { signals } = ctx;
|
|
6673
|
-
if (!signals) return
|
|
6988
|
+
if (!signals) return;
|
|
6674
6989
|
const filteredSignals = signals.filter(
|
|
6675
6990
|
(signal) => !signal.data.registered
|
|
6676
6991
|
).map((signal) => signal.signal);
|
|
6677
6992
|
for (const signal of filteredSignals) {
|
|
6678
6993
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signal);
|
|
6679
|
-
|
|
6994
|
+
this.signalsSynced = false;
|
|
6995
|
+
yield {
|
|
6680
6996
|
__syncing: ctx.__syncing,
|
|
6681
6997
|
data: {
|
|
6682
6998
|
name: signal,
|
|
@@ -6686,12 +7002,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6686
7002
|
isMeta
|
|
6687
7003
|
},
|
|
6688
7004
|
__signal: signal
|
|
6689
|
-
}
|
|
7005
|
+
};
|
|
6690
7006
|
}
|
|
6691
|
-
|
|
6692
|
-
}
|
|
7007
|
+
}.bind(this)
|
|
6693
7008
|
);
|
|
6694
|
-
|
|
7009
|
+
this.splitSignalsTask.then(
|
|
6695
7010
|
resolveSyncInsertTask(
|
|
6696
7011
|
this.isCadenzaDBReady,
|
|
6697
7012
|
"signal_registry",
|
|
@@ -6712,22 +7027,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6712
7027
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6713
7028
|
delayMs: 3e3
|
|
6714
7029
|
});
|
|
6715
|
-
CadenzaService.debounce(
|
|
6716
|
-
"meta.sync_controller.signal_registration_settled",
|
|
6717
|
-
{ __syncing: true },
|
|
6718
|
-
300
|
|
6719
|
-
);
|
|
6720
7030
|
return { signalName: ctx.__signal };
|
|
6721
|
-
}).then(CadenzaService.signalBroker.registerSignalTask)
|
|
7031
|
+
}).then(CadenzaService.signalBroker.registerSignalTask).then(gatherSignalRegistrationTask)
|
|
6722
7032
|
)
|
|
6723
7033
|
);
|
|
6724
|
-
CadenzaService.createUniqueMetaTask(
|
|
6725
|
-
"Gather signal registration",
|
|
6726
|
-
() => {
|
|
6727
|
-
this.signalsSynced = true;
|
|
6728
|
-
return true;
|
|
6729
|
-
}
|
|
6730
|
-
).doOn("meta.sync_controller.signal_registration_settled").emits("meta.sync_controller.synced_signals");
|
|
6731
7034
|
this.splitTasksForRegistration = CadenzaService.createMetaTask(
|
|
6732
7035
|
"Split tasks for registration",
|
|
6733
7036
|
function* (ctx) {
|
|
@@ -6742,6 +7045,19 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6742
7045
|
for (const task of tasks) {
|
|
6743
7046
|
if (task.registered) continue;
|
|
6744
7047
|
const { __functionString, __getTagCallback } = task.export();
|
|
7048
|
+
this.tasksSynced = false;
|
|
7049
|
+
if (shouldDebugSyncTaskName(task.name)) {
|
|
7050
|
+
logSyncDebug("task_registration_split", {
|
|
7051
|
+
taskName: task.name,
|
|
7052
|
+
taskVersion: task.version,
|
|
7053
|
+
serviceName: serviceName2,
|
|
7054
|
+
register: task.register,
|
|
7055
|
+
registered: task.registered,
|
|
7056
|
+
hidden: task.hidden,
|
|
7057
|
+
observedSignals: Array.from(task.observedSignals),
|
|
7058
|
+
handledIntents: Array.from(task.handlesIntents)
|
|
7059
|
+
});
|
|
7060
|
+
}
|
|
6745
7061
|
yield {
|
|
6746
7062
|
__syncing: ctx.__syncing,
|
|
6747
7063
|
data: {
|
|
@@ -6778,7 +7094,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6778
7094
|
__taskName: task.name
|
|
6779
7095
|
};
|
|
6780
7096
|
}
|
|
6781
|
-
}
|
|
7097
|
+
}.bind(this)
|
|
6782
7098
|
);
|
|
6783
7099
|
const registerTaskTask = resolveSyncInsertTask(
|
|
6784
7100
|
this.isCadenzaDBReady,
|
|
@@ -6794,6 +7110,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6794
7110
|
{ concurrency: 30 }
|
|
6795
7111
|
)?.then(
|
|
6796
7112
|
CadenzaService.createMetaTask("Record registration", (ctx, emit) => {
|
|
7113
|
+
if (shouldDebugSyncTaskName(ctx.__taskName)) {
|
|
7114
|
+
logSyncDebug("task_registration_result", {
|
|
7115
|
+
taskName: ctx.__taskName,
|
|
7116
|
+
success: didSyncInsertSucceed(ctx),
|
|
7117
|
+
ctx
|
|
7118
|
+
});
|
|
7119
|
+
}
|
|
6797
7120
|
if (!didSyncInsertSucceed(ctx)) {
|
|
6798
7121
|
return;
|
|
6799
7122
|
}
|
|
@@ -6805,13 +7128,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6805
7128
|
...ctx,
|
|
6806
7129
|
task: CadenzaService.get(ctx.__taskName)
|
|
6807
7130
|
});
|
|
6808
|
-
CadenzaService.debounce(
|
|
6809
|
-
"meta.sync_controller.task_registration_settled",
|
|
6810
|
-
{ __syncing: true },
|
|
6811
|
-
300
|
|
6812
|
-
);
|
|
6813
7131
|
return true;
|
|
6814
|
-
})
|
|
7132
|
+
}).then(gatherTaskRegistrationTask)
|
|
6815
7133
|
);
|
|
6816
7134
|
if (registerTaskTask) {
|
|
6817
7135
|
this.splitTasksForRegistration.then(registerTaskTask);
|
|
@@ -6820,6 +7138,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6820
7138
|
"Prepare created task for immediate sync",
|
|
6821
7139
|
(ctx) => {
|
|
6822
7140
|
const task = ctx.taskInstance ?? (ctx.data?.name ? CadenzaService.get(String(ctx.data.name)) : void 0);
|
|
7141
|
+
if (shouldDebugSyncTaskName(task?.name ?? ctx?.data?.name)) {
|
|
7142
|
+
logSyncDebug("task_created_for_immediate_sync", {
|
|
7143
|
+
incomingTaskName: ctx?.data?.name ?? null,
|
|
7144
|
+
resolvedTaskName: task?.name ?? null,
|
|
7145
|
+
exists: Boolean(task),
|
|
7146
|
+
hidden: task?.hidden ?? null,
|
|
7147
|
+
register: task?.register ?? null,
|
|
7148
|
+
registered: task?.registered ?? null
|
|
7149
|
+
});
|
|
7150
|
+
}
|
|
6823
7151
|
if (!task || task.hidden || !task.register || task.registered) {
|
|
6824
7152
|
return false;
|
|
6825
7153
|
}
|
|
@@ -6834,13 +7162,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6834
7162
|
isHidden: true
|
|
6835
7163
|
}
|
|
6836
7164
|
).doOn("meta.task.created").then(this.splitTasksForRegistration);
|
|
6837
|
-
CadenzaService.createUniqueMetaTask(
|
|
6838
|
-
"Gather task registration",
|
|
6839
|
-
() => {
|
|
6840
|
-
this.tasksSynced = true;
|
|
6841
|
-
return true;
|
|
6842
|
-
}
|
|
6843
|
-
).doOn("meta.sync_controller.task_registration_settled").emits("meta.sync_controller.synced_tasks");
|
|
6844
7165
|
this.splitActorsForRegistration = CadenzaService.createMetaTask(
|
|
6845
7166
|
"Split actors for registration",
|
|
6846
7167
|
function* (ctx) {
|
|
@@ -6864,6 +7185,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6864
7185
|
if (this.registeredActors.has(registrationKey)) {
|
|
6865
7186
|
continue;
|
|
6866
7187
|
}
|
|
7188
|
+
this.actorsSynced = false;
|
|
6867
7189
|
yield {
|
|
6868
7190
|
data,
|
|
6869
7191
|
__actorRegistrationKey: registrationKey
|
|
@@ -6892,22 +7214,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6892
7214
|
delayMs: 3e3
|
|
6893
7215
|
});
|
|
6894
7216
|
this.registeredActors.add(ctx.__actorRegistrationKey);
|
|
6895
|
-
CadenzaService.debounce(
|
|
6896
|
-
"meta.sync_controller.actor_registration_settled",
|
|
6897
|
-
{ __syncing: true },
|
|
6898
|
-
300
|
|
6899
|
-
);
|
|
6900
7217
|
return true;
|
|
6901
|
-
})
|
|
7218
|
+
}).then(gatherActorRegistrationTask)
|
|
6902
7219
|
)
|
|
6903
7220
|
);
|
|
6904
|
-
CadenzaService.createUniqueMetaTask(
|
|
6905
|
-
"Gather actor registration",
|
|
6906
|
-
() => {
|
|
6907
|
-
this.actorsSynced = true;
|
|
6908
|
-
return true;
|
|
6909
|
-
}
|
|
6910
|
-
).doOn("meta.sync_controller.actor_registration_settled").emits("meta.sync_controller.synced_actors");
|
|
6911
7221
|
this.registerActorTaskMapTask = CadenzaService.createMetaTask(
|
|
6912
7222
|
"Split actor task maps",
|
|
6913
7223
|
function* (ctx) {
|
|
@@ -7004,6 +7314,17 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7004
7314
|
continue;
|
|
7005
7315
|
}
|
|
7006
7316
|
const { isGlobal } = decomposeSignalName(_signal);
|
|
7317
|
+
if (shouldDebugSyncTaskName(task.name)) {
|
|
7318
|
+
logSyncDebug("signal_to_task_map_split", {
|
|
7319
|
+
taskName: task.name,
|
|
7320
|
+
signalName: _signal,
|
|
7321
|
+
rawSignal: signal,
|
|
7322
|
+
serviceName: serviceName2,
|
|
7323
|
+
observerRegistered: CadenzaService.signalBroker.signalObservers?.get(
|
|
7324
|
+
_signal
|
|
7325
|
+
)?.registered
|
|
7326
|
+
});
|
|
7327
|
+
}
|
|
7007
7328
|
emit("meta.sync_controller.signal_task_map_split", {
|
|
7008
7329
|
__syncing: ctx.__syncing,
|
|
7009
7330
|
data: {
|
|
@@ -7043,12 +7364,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7043
7364
|
);
|
|
7044
7365
|
this.splitIntentsTask = CadenzaService.createMetaTask(
|
|
7045
7366
|
"Split intents for registration",
|
|
7046
|
-
function(ctx
|
|
7367
|
+
function* (ctx) {
|
|
7047
7368
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
7048
7369
|
delayMs: 3e3
|
|
7049
7370
|
});
|
|
7050
7371
|
const intents = Array.isArray(ctx.intents) ? ctx.intents : Array.from(CadenzaService.inquiryBroker.intents.values());
|
|
7051
|
-
let emittedCount = 0;
|
|
7052
7372
|
for (const intent of intents) {
|
|
7053
7373
|
const intentData = buildIntentRegistryData(intent);
|
|
7054
7374
|
if (!intentData) {
|
|
@@ -7057,17 +7377,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7057
7377
|
if (this.registeredIntentDefinitions.has(intentData.name)) {
|
|
7058
7378
|
continue;
|
|
7059
7379
|
}
|
|
7060
|
-
|
|
7380
|
+
this.intentsSynced = false;
|
|
7381
|
+
yield {
|
|
7061
7382
|
__syncing: ctx.__syncing,
|
|
7062
7383
|
data: intentData,
|
|
7063
7384
|
__intentName: intentData.name
|
|
7064
|
-
}
|
|
7065
|
-
emittedCount += 1;
|
|
7385
|
+
};
|
|
7066
7386
|
}
|
|
7067
|
-
return emittedCount > 0;
|
|
7068
7387
|
}.bind(this)
|
|
7069
7388
|
);
|
|
7070
|
-
|
|
7389
|
+
this.splitIntentsTask.then(
|
|
7071
7390
|
insertIntentRegistryTask?.then(
|
|
7072
7391
|
CadenzaService.createMetaTask("Record intent definition registration", (ctx) => {
|
|
7073
7392
|
if (!didSyncInsertSucceed(ctx)) {
|
|
@@ -7077,22 +7396,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7077
7396
|
delayMs: 3e3
|
|
7078
7397
|
});
|
|
7079
7398
|
this.registeredIntentDefinitions.add(ctx.__intentName);
|
|
7080
|
-
CadenzaService.debounce(
|
|
7081
|
-
"meta.sync_controller.intent_registration_settled",
|
|
7082
|
-
{ __syncing: true },
|
|
7083
|
-
300
|
|
7084
|
-
);
|
|
7085
7399
|
return true;
|
|
7086
|
-
})
|
|
7400
|
+
}).then(gatherIntentRegistrationTask)
|
|
7087
7401
|
)
|
|
7088
7402
|
);
|
|
7089
|
-
CadenzaService.createUniqueMetaTask(
|
|
7090
|
-
"Gather intent registration",
|
|
7091
|
-
() => {
|
|
7092
|
-
this.intentsSynced = true;
|
|
7093
|
-
return true;
|
|
7094
|
-
}
|
|
7095
|
-
).doOn("meta.sync_controller.intent_registration_settled").emits("meta.sync_controller.synced_intents");
|
|
7096
7403
|
const registerIntentTask = CadenzaService.createMetaTask(
|
|
7097
7404
|
"Record intent registration",
|
|
7098
7405
|
(ctx) => {
|
|
@@ -7142,6 +7449,15 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7142
7449
|
if (!intentDefinition) {
|
|
7143
7450
|
continue;
|
|
7144
7451
|
}
|
|
7452
|
+
if (shouldDebugSyncTaskName(task.name) || shouldDebugSyncIntentName(intent)) {
|
|
7453
|
+
logSyncDebug("intent_to_task_map_split", {
|
|
7454
|
+
taskName: task.name,
|
|
7455
|
+
taskVersion: task.version,
|
|
7456
|
+
intentName: intent,
|
|
7457
|
+
serviceName: serviceName2,
|
|
7458
|
+
intentDefinition
|
|
7459
|
+
});
|
|
7460
|
+
}
|
|
7145
7461
|
emit("meta.sync_controller.intent_task_map_split", {
|
|
7146
7462
|
__syncing: ctx.__syncing,
|
|
7147
7463
|
data: {
|
|
@@ -7171,6 +7487,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7171
7487
|
if (!ctx.__intentDefinition || !ctx.__intentMapData) {
|
|
7172
7488
|
return false;
|
|
7173
7489
|
}
|
|
7490
|
+
if (shouldDebugSyncTaskName(ctx.__taskName) || shouldDebugSyncIntentName(ctx.__intent)) {
|
|
7491
|
+
logSyncDebug("intent_definition_prepare", {
|
|
7492
|
+
taskName: ctx.__taskName,
|
|
7493
|
+
intentName: ctx.__intent,
|
|
7494
|
+
intentDefinition: ctx.__intentDefinition
|
|
7495
|
+
});
|
|
7496
|
+
}
|
|
7174
7497
|
return {
|
|
7175
7498
|
...ctx,
|
|
7176
7499
|
data: ctx.__intentDefinition
|
|
@@ -7184,6 +7507,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7184
7507
|
if (!ctx.__intentMapData) {
|
|
7185
7508
|
return false;
|
|
7186
7509
|
}
|
|
7510
|
+
if (shouldDebugSyncTaskName(ctx.__taskName) || shouldDebugSyncIntentName(ctx.__intent)) {
|
|
7511
|
+
logSyncDebug("intent_map_payload_restore", {
|
|
7512
|
+
taskName: ctx.__taskName,
|
|
7513
|
+
intentName: ctx.__intent,
|
|
7514
|
+
intentMapData: ctx.__intentMapData
|
|
7515
|
+
});
|
|
7516
|
+
}
|
|
7187
7517
|
return {
|
|
7188
7518
|
...ctx,
|
|
7189
7519
|
data: ctx.__intentMapData
|
|
@@ -7363,15 +7693,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7363
7693
|
__authoritativeReconciliation: true
|
|
7364
7694
|
});
|
|
7365
7695
|
}
|
|
7366
|
-
if (authoritativeTasks.length > 0) {
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
__authoritativeReconciliation: true
|
|
7372
|
-
},
|
|
7373
|
-
300
|
|
7374
|
-
);
|
|
7696
|
+
if (authoritativeTasks.length > 0 || changed) {
|
|
7697
|
+
finalizeTaskSync(emit, {
|
|
7698
|
+
...ctx,
|
|
7699
|
+
__authoritativeReconciliation: true
|
|
7700
|
+
});
|
|
7375
7701
|
}
|
|
7376
7702
|
return changed;
|
|
7377
7703
|
},
|
|
@@ -7383,7 +7709,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7383
7709
|
);
|
|
7384
7710
|
const reconcileRoutineRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7385
7711
|
"Reconcile routine registration from authority",
|
|
7386
|
-
(ctx) => {
|
|
7712
|
+
(ctx, emit) => {
|
|
7387
7713
|
const authoritativeRoutines = resolveSyncQueryRows(ctx, "routine");
|
|
7388
7714
|
let changed = false;
|
|
7389
7715
|
for (const row of authoritativeRoutines) {
|
|
@@ -7398,15 +7724,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7398
7724
|
routine.registered = true;
|
|
7399
7725
|
changed = true;
|
|
7400
7726
|
}
|
|
7401
|
-
if (authoritativeRoutines.length > 0) {
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
__authoritativeReconciliation: true
|
|
7407
|
-
},
|
|
7408
|
-
300
|
|
7409
|
-
);
|
|
7727
|
+
if (authoritativeRoutines.length > 0 || changed) {
|
|
7728
|
+
finalizeRoutineSync(emit, {
|
|
7729
|
+
...ctx,
|
|
7730
|
+
__authoritativeReconciliation: true
|
|
7731
|
+
});
|
|
7410
7732
|
}
|
|
7411
7733
|
return changed;
|
|
7412
7734
|
},
|
|
@@ -7418,7 +7740,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7418
7740
|
);
|
|
7419
7741
|
const reconcileSignalRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7420
7742
|
"Reconcile signal registration from authority",
|
|
7421
|
-
(ctx) => {
|
|
7743
|
+
(ctx, emit) => {
|
|
7422
7744
|
const authoritativeSignals = resolveSyncQueryRows(ctx, "signal_registry");
|
|
7423
7745
|
const signalObservers = CadenzaService.signalBroker.signalObservers;
|
|
7424
7746
|
let changed = false;
|
|
@@ -7434,15 +7756,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7434
7756
|
observer.registered = true;
|
|
7435
7757
|
changed = true;
|
|
7436
7758
|
}
|
|
7437
|
-
if (authoritativeSignals.length > 0) {
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
__authoritativeReconciliation: true
|
|
7443
|
-
},
|
|
7444
|
-
300
|
|
7445
|
-
);
|
|
7759
|
+
if (authoritativeSignals.length > 0 || changed) {
|
|
7760
|
+
finalizeSignalSync(emit, {
|
|
7761
|
+
...ctx,
|
|
7762
|
+
__authoritativeReconciliation: true
|
|
7763
|
+
});
|
|
7446
7764
|
}
|
|
7447
7765
|
return changed;
|
|
7448
7766
|
},
|
|
@@ -7454,7 +7772,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7454
7772
|
);
|
|
7455
7773
|
const reconcileIntentRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7456
7774
|
"Reconcile intent registration from authority",
|
|
7457
|
-
(ctx) => {
|
|
7775
|
+
(ctx, emit) => {
|
|
7458
7776
|
const authoritativeIntents = resolveSyncQueryRows(ctx, "intent_registry");
|
|
7459
7777
|
let changed = false;
|
|
7460
7778
|
for (const row of authoritativeIntents) {
|
|
@@ -7468,15 +7786,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7468
7786
|
this.registeredIntentDefinitions.add(intentName);
|
|
7469
7787
|
changed = true;
|
|
7470
7788
|
}
|
|
7471
|
-
if (authoritativeIntents.length > 0) {
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
__authoritativeReconciliation: true
|
|
7477
|
-
},
|
|
7478
|
-
300
|
|
7479
|
-
);
|
|
7789
|
+
if (authoritativeIntents.length > 0 || changed) {
|
|
7790
|
+
finalizeIntentSync(emit, {
|
|
7791
|
+
...ctx,
|
|
7792
|
+
__authoritativeReconciliation: true
|
|
7793
|
+
});
|
|
7480
7794
|
}
|
|
7481
7795
|
return changed;
|
|
7482
7796
|
},
|