@cadenza.io/service 2.17.48 → 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 +212 -129
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +212 -129
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +212 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +212 -129
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -6552,6 +6552,31 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
|
|
|
6552
6552
|
}
|
|
6553
6553
|
).then(targetTask);
|
|
6554
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
|
+
}
|
|
6555
6580
|
var GraphSyncController = class _GraphSyncController {
|
|
6556
6581
|
constructor() {
|
|
6557
6582
|
this.registeredActors = /* @__PURE__ */ new Set();
|
|
@@ -6676,22 +6701,158 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6676
6701
|
{},
|
|
6677
6702
|
{ concurrency: 10 }
|
|
6678
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
|
+
);
|
|
6679
6840
|
this.splitRoutinesTask = CadenzaService.createMetaTask(
|
|
6680
6841
|
"Split routines for registration",
|
|
6681
|
-
(ctx
|
|
6842
|
+
function* (ctx) {
|
|
6682
6843
|
const { routines } = ctx;
|
|
6683
|
-
if (!routines) return
|
|
6844
|
+
if (!routines) return;
|
|
6684
6845
|
const serviceName2 = resolveSyncServiceName();
|
|
6685
6846
|
if (!serviceName2) {
|
|
6686
|
-
return
|
|
6847
|
+
return;
|
|
6687
6848
|
}
|
|
6688
6849
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6689
6850
|
delayMs: 2e3
|
|
6690
6851
|
});
|
|
6691
|
-
let emittedCount = 0;
|
|
6692
6852
|
for (const routine of routines) {
|
|
6693
6853
|
if (routine.registered) continue;
|
|
6694
|
-
|
|
6854
|
+
this.routinesSynced = false;
|
|
6855
|
+
yield {
|
|
6695
6856
|
__syncing: ctx.__syncing,
|
|
6696
6857
|
data: {
|
|
6697
6858
|
name: routine.name,
|
|
@@ -6701,13 +6862,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6701
6862
|
isMeta: routine.isMeta
|
|
6702
6863
|
},
|
|
6703
6864
|
__routineName: routine.name
|
|
6704
|
-
}
|
|
6705
|
-
emittedCount += 1;
|
|
6865
|
+
};
|
|
6706
6866
|
}
|
|
6707
|
-
|
|
6708
|
-
}
|
|
6867
|
+
}.bind(this)
|
|
6709
6868
|
);
|
|
6710
|
-
|
|
6869
|
+
this.splitRoutinesTask.then(
|
|
6711
6870
|
resolveSyncInsertTask(
|
|
6712
6871
|
this.isCadenzaDBReady,
|
|
6713
6872
|
"routine",
|
|
@@ -6729,22 +6888,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6729
6888
|
delayMs: 3e3
|
|
6730
6889
|
});
|
|
6731
6890
|
CadenzaService.getRoutine(ctx.__routineName).registered = true;
|
|
6732
|
-
CadenzaService.debounce(
|
|
6733
|
-
"meta.sync_controller.routine_registration_settled",
|
|
6734
|
-
{ __syncing: true },
|
|
6735
|
-
300
|
|
6736
|
-
);
|
|
6737
6891
|
return true;
|
|
6738
|
-
})
|
|
6892
|
+
}).then(gatherRoutineRegistrationTask)
|
|
6739
6893
|
)
|
|
6740
6894
|
);
|
|
6741
|
-
CadenzaService.createUniqueMetaTask(
|
|
6742
|
-
"Gather routine registration",
|
|
6743
|
-
() => {
|
|
6744
|
-
this.routinesSynced = true;
|
|
6745
|
-
return true;
|
|
6746
|
-
}
|
|
6747
|
-
).doOn("meta.sync_controller.routine_registration_settled").emits("meta.sync_controller.synced_routines");
|
|
6748
6895
|
this.splitTasksInRoutines = CadenzaService.createMetaTask(
|
|
6749
6896
|
"Split tasks in routines",
|
|
6750
6897
|
function* (ctx) {
|
|
@@ -6833,18 +6980,19 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6833
6980
|
}
|
|
6834
6981
|
this.splitSignalsTask = CadenzaService.createMetaTask(
|
|
6835
6982
|
"Split signals for registration",
|
|
6836
|
-
(ctx
|
|
6983
|
+
function* (ctx) {
|
|
6837
6984
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6838
6985
|
delayMs: 3e3
|
|
6839
6986
|
});
|
|
6840
6987
|
const { signals } = ctx;
|
|
6841
|
-
if (!signals) return
|
|
6988
|
+
if (!signals) return;
|
|
6842
6989
|
const filteredSignals = signals.filter(
|
|
6843
6990
|
(signal) => !signal.data.registered
|
|
6844
6991
|
).map((signal) => signal.signal);
|
|
6845
6992
|
for (const signal of filteredSignals) {
|
|
6846
6993
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signal);
|
|
6847
|
-
|
|
6994
|
+
this.signalsSynced = false;
|
|
6995
|
+
yield {
|
|
6848
6996
|
__syncing: ctx.__syncing,
|
|
6849
6997
|
data: {
|
|
6850
6998
|
name: signal,
|
|
@@ -6854,12 +7002,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6854
7002
|
isMeta
|
|
6855
7003
|
},
|
|
6856
7004
|
__signal: signal
|
|
6857
|
-
}
|
|
7005
|
+
};
|
|
6858
7006
|
}
|
|
6859
|
-
|
|
6860
|
-
}
|
|
7007
|
+
}.bind(this)
|
|
6861
7008
|
);
|
|
6862
|
-
|
|
7009
|
+
this.splitSignalsTask.then(
|
|
6863
7010
|
resolveSyncInsertTask(
|
|
6864
7011
|
this.isCadenzaDBReady,
|
|
6865
7012
|
"signal_registry",
|
|
@@ -6880,22 +7027,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6880
7027
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6881
7028
|
delayMs: 3e3
|
|
6882
7029
|
});
|
|
6883
|
-
CadenzaService.debounce(
|
|
6884
|
-
"meta.sync_controller.signal_registration_settled",
|
|
6885
|
-
{ __syncing: true },
|
|
6886
|
-
300
|
|
6887
|
-
);
|
|
6888
7030
|
return { signalName: ctx.__signal };
|
|
6889
|
-
}).then(CadenzaService.signalBroker.registerSignalTask)
|
|
7031
|
+
}).then(CadenzaService.signalBroker.registerSignalTask).then(gatherSignalRegistrationTask)
|
|
6890
7032
|
)
|
|
6891
7033
|
);
|
|
6892
|
-
CadenzaService.createUniqueMetaTask(
|
|
6893
|
-
"Gather signal registration",
|
|
6894
|
-
() => {
|
|
6895
|
-
this.signalsSynced = true;
|
|
6896
|
-
return true;
|
|
6897
|
-
}
|
|
6898
|
-
).doOn("meta.sync_controller.signal_registration_settled").emits("meta.sync_controller.synced_signals");
|
|
6899
7034
|
this.splitTasksForRegistration = CadenzaService.createMetaTask(
|
|
6900
7035
|
"Split tasks for registration",
|
|
6901
7036
|
function* (ctx) {
|
|
@@ -6910,6 +7045,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6910
7045
|
for (const task of tasks) {
|
|
6911
7046
|
if (task.registered) continue;
|
|
6912
7047
|
const { __functionString, __getTagCallback } = task.export();
|
|
7048
|
+
this.tasksSynced = false;
|
|
6913
7049
|
if (shouldDebugSyncTaskName(task.name)) {
|
|
6914
7050
|
logSyncDebug("task_registration_split", {
|
|
6915
7051
|
taskName: task.name,
|
|
@@ -6958,7 +7094,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6958
7094
|
__taskName: task.name
|
|
6959
7095
|
};
|
|
6960
7096
|
}
|
|
6961
|
-
}
|
|
7097
|
+
}.bind(this)
|
|
6962
7098
|
);
|
|
6963
7099
|
const registerTaskTask = resolveSyncInsertTask(
|
|
6964
7100
|
this.isCadenzaDBReady,
|
|
@@ -6992,13 +7128,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6992
7128
|
...ctx,
|
|
6993
7129
|
task: CadenzaService.get(ctx.__taskName)
|
|
6994
7130
|
});
|
|
6995
|
-
CadenzaService.debounce(
|
|
6996
|
-
"meta.sync_controller.task_registration_settled",
|
|
6997
|
-
{ __syncing: true },
|
|
6998
|
-
300
|
|
6999
|
-
);
|
|
7000
7131
|
return true;
|
|
7001
|
-
})
|
|
7132
|
+
}).then(gatherTaskRegistrationTask)
|
|
7002
7133
|
);
|
|
7003
7134
|
if (registerTaskTask) {
|
|
7004
7135
|
this.splitTasksForRegistration.then(registerTaskTask);
|
|
@@ -7031,13 +7162,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7031
7162
|
isHidden: true
|
|
7032
7163
|
}
|
|
7033
7164
|
).doOn("meta.task.created").then(this.splitTasksForRegistration);
|
|
7034
|
-
CadenzaService.createUniqueMetaTask(
|
|
7035
|
-
"Gather task registration",
|
|
7036
|
-
() => {
|
|
7037
|
-
this.tasksSynced = true;
|
|
7038
|
-
return true;
|
|
7039
|
-
}
|
|
7040
|
-
).doOn("meta.sync_controller.task_registration_settled").emits("meta.sync_controller.synced_tasks");
|
|
7041
7165
|
this.splitActorsForRegistration = CadenzaService.createMetaTask(
|
|
7042
7166
|
"Split actors for registration",
|
|
7043
7167
|
function* (ctx) {
|
|
@@ -7061,6 +7185,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7061
7185
|
if (this.registeredActors.has(registrationKey)) {
|
|
7062
7186
|
continue;
|
|
7063
7187
|
}
|
|
7188
|
+
this.actorsSynced = false;
|
|
7064
7189
|
yield {
|
|
7065
7190
|
data,
|
|
7066
7191
|
__actorRegistrationKey: registrationKey
|
|
@@ -7089,22 +7214,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7089
7214
|
delayMs: 3e3
|
|
7090
7215
|
});
|
|
7091
7216
|
this.registeredActors.add(ctx.__actorRegistrationKey);
|
|
7092
|
-
CadenzaService.debounce(
|
|
7093
|
-
"meta.sync_controller.actor_registration_settled",
|
|
7094
|
-
{ __syncing: true },
|
|
7095
|
-
300
|
|
7096
|
-
);
|
|
7097
7217
|
return true;
|
|
7098
|
-
})
|
|
7218
|
+
}).then(gatherActorRegistrationTask)
|
|
7099
7219
|
)
|
|
7100
7220
|
);
|
|
7101
|
-
CadenzaService.createUniqueMetaTask(
|
|
7102
|
-
"Gather actor registration",
|
|
7103
|
-
() => {
|
|
7104
|
-
this.actorsSynced = true;
|
|
7105
|
-
return true;
|
|
7106
|
-
}
|
|
7107
|
-
).doOn("meta.sync_controller.actor_registration_settled").emits("meta.sync_controller.synced_actors");
|
|
7108
7221
|
this.registerActorTaskMapTask = CadenzaService.createMetaTask(
|
|
7109
7222
|
"Split actor task maps",
|
|
7110
7223
|
function* (ctx) {
|
|
@@ -7251,12 +7364,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7251
7364
|
);
|
|
7252
7365
|
this.splitIntentsTask = CadenzaService.createMetaTask(
|
|
7253
7366
|
"Split intents for registration",
|
|
7254
|
-
function(ctx
|
|
7367
|
+
function* (ctx) {
|
|
7255
7368
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
7256
7369
|
delayMs: 3e3
|
|
7257
7370
|
});
|
|
7258
7371
|
const intents = Array.isArray(ctx.intents) ? ctx.intents : Array.from(CadenzaService.inquiryBroker.intents.values());
|
|
7259
|
-
let emittedCount = 0;
|
|
7260
7372
|
for (const intent of intents) {
|
|
7261
7373
|
const intentData = buildIntentRegistryData(intent);
|
|
7262
7374
|
if (!intentData) {
|
|
@@ -7265,17 +7377,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7265
7377
|
if (this.registeredIntentDefinitions.has(intentData.name)) {
|
|
7266
7378
|
continue;
|
|
7267
7379
|
}
|
|
7268
|
-
|
|
7380
|
+
this.intentsSynced = false;
|
|
7381
|
+
yield {
|
|
7269
7382
|
__syncing: ctx.__syncing,
|
|
7270
7383
|
data: intentData,
|
|
7271
7384
|
__intentName: intentData.name
|
|
7272
|
-
}
|
|
7273
|
-
emittedCount += 1;
|
|
7385
|
+
};
|
|
7274
7386
|
}
|
|
7275
|
-
return emittedCount > 0;
|
|
7276
7387
|
}.bind(this)
|
|
7277
7388
|
);
|
|
7278
|
-
|
|
7389
|
+
this.splitIntentsTask.then(
|
|
7279
7390
|
insertIntentRegistryTask?.then(
|
|
7280
7391
|
CadenzaService.createMetaTask("Record intent definition registration", (ctx) => {
|
|
7281
7392
|
if (!didSyncInsertSucceed(ctx)) {
|
|
@@ -7285,22 +7396,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7285
7396
|
delayMs: 3e3
|
|
7286
7397
|
});
|
|
7287
7398
|
this.registeredIntentDefinitions.add(ctx.__intentName);
|
|
7288
|
-
CadenzaService.debounce(
|
|
7289
|
-
"meta.sync_controller.intent_registration_settled",
|
|
7290
|
-
{ __syncing: true },
|
|
7291
|
-
300
|
|
7292
|
-
);
|
|
7293
7399
|
return true;
|
|
7294
|
-
})
|
|
7400
|
+
}).then(gatherIntentRegistrationTask)
|
|
7295
7401
|
)
|
|
7296
7402
|
);
|
|
7297
|
-
CadenzaService.createUniqueMetaTask(
|
|
7298
|
-
"Gather intent registration",
|
|
7299
|
-
() => {
|
|
7300
|
-
this.intentsSynced = true;
|
|
7301
|
-
return true;
|
|
7302
|
-
}
|
|
7303
|
-
).doOn("meta.sync_controller.intent_registration_settled").emits("meta.sync_controller.synced_intents");
|
|
7304
7403
|
const registerIntentTask = CadenzaService.createMetaTask(
|
|
7305
7404
|
"Record intent registration",
|
|
7306
7405
|
(ctx) => {
|
|
@@ -7594,15 +7693,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7594
7693
|
__authoritativeReconciliation: true
|
|
7595
7694
|
});
|
|
7596
7695
|
}
|
|
7597
|
-
if (authoritativeTasks.length > 0) {
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
__authoritativeReconciliation: true
|
|
7603
|
-
},
|
|
7604
|
-
300
|
|
7605
|
-
);
|
|
7696
|
+
if (authoritativeTasks.length > 0 || changed) {
|
|
7697
|
+
finalizeTaskSync(emit, {
|
|
7698
|
+
...ctx,
|
|
7699
|
+
__authoritativeReconciliation: true
|
|
7700
|
+
});
|
|
7606
7701
|
}
|
|
7607
7702
|
return changed;
|
|
7608
7703
|
},
|
|
@@ -7614,7 +7709,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7614
7709
|
);
|
|
7615
7710
|
const reconcileRoutineRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7616
7711
|
"Reconcile routine registration from authority",
|
|
7617
|
-
(ctx) => {
|
|
7712
|
+
(ctx, emit) => {
|
|
7618
7713
|
const authoritativeRoutines = resolveSyncQueryRows(ctx, "routine");
|
|
7619
7714
|
let changed = false;
|
|
7620
7715
|
for (const row of authoritativeRoutines) {
|
|
@@ -7629,15 +7724,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7629
7724
|
routine.registered = true;
|
|
7630
7725
|
changed = true;
|
|
7631
7726
|
}
|
|
7632
|
-
if (authoritativeRoutines.length > 0) {
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
__authoritativeReconciliation: true
|
|
7638
|
-
},
|
|
7639
|
-
300
|
|
7640
|
-
);
|
|
7727
|
+
if (authoritativeRoutines.length > 0 || changed) {
|
|
7728
|
+
finalizeRoutineSync(emit, {
|
|
7729
|
+
...ctx,
|
|
7730
|
+
__authoritativeReconciliation: true
|
|
7731
|
+
});
|
|
7641
7732
|
}
|
|
7642
7733
|
return changed;
|
|
7643
7734
|
},
|
|
@@ -7649,7 +7740,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7649
7740
|
);
|
|
7650
7741
|
const reconcileSignalRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7651
7742
|
"Reconcile signal registration from authority",
|
|
7652
|
-
(ctx) => {
|
|
7743
|
+
(ctx, emit) => {
|
|
7653
7744
|
const authoritativeSignals = resolveSyncQueryRows(ctx, "signal_registry");
|
|
7654
7745
|
const signalObservers = CadenzaService.signalBroker.signalObservers;
|
|
7655
7746
|
let changed = false;
|
|
@@ -7665,15 +7756,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7665
7756
|
observer.registered = true;
|
|
7666
7757
|
changed = true;
|
|
7667
7758
|
}
|
|
7668
|
-
if (authoritativeSignals.length > 0) {
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
__authoritativeReconciliation: true
|
|
7674
|
-
},
|
|
7675
|
-
300
|
|
7676
|
-
);
|
|
7759
|
+
if (authoritativeSignals.length > 0 || changed) {
|
|
7760
|
+
finalizeSignalSync(emit, {
|
|
7761
|
+
...ctx,
|
|
7762
|
+
__authoritativeReconciliation: true
|
|
7763
|
+
});
|
|
7677
7764
|
}
|
|
7678
7765
|
return changed;
|
|
7679
7766
|
},
|
|
@@ -7685,7 +7772,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7685
7772
|
);
|
|
7686
7773
|
const reconcileIntentRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7687
7774
|
"Reconcile intent registration from authority",
|
|
7688
|
-
(ctx) => {
|
|
7775
|
+
(ctx, emit) => {
|
|
7689
7776
|
const authoritativeIntents = resolveSyncQueryRows(ctx, "intent_registry");
|
|
7690
7777
|
let changed = false;
|
|
7691
7778
|
for (const row of authoritativeIntents) {
|
|
@@ -7699,15 +7786,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7699
7786
|
this.registeredIntentDefinitions.add(intentName);
|
|
7700
7787
|
changed = true;
|
|
7701
7788
|
}
|
|
7702
|
-
if (authoritativeIntents.length > 0) {
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
__authoritativeReconciliation: true
|
|
7708
|
-
},
|
|
7709
|
-
300
|
|
7710
|
-
);
|
|
7789
|
+
if (authoritativeIntents.length > 0 || changed) {
|
|
7790
|
+
finalizeIntentSync(emit, {
|
|
7791
|
+
...ctx,
|
|
7792
|
+
__authoritativeReconciliation: true
|
|
7793
|
+
});
|
|
7711
7794
|
}
|
|
7712
7795
|
return changed;
|
|
7713
7796
|
},
|