@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.mjs
CHANGED
|
@@ -6503,6 +6503,31 @@ function resolveSyncQueryTask(isCadenzaDBReady, tableName, queryData = {}, optio
|
|
|
6503
6503
|
}
|
|
6504
6504
|
).then(targetTask);
|
|
6505
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
|
+
}
|
|
6506
6531
|
var GraphSyncController = class _GraphSyncController {
|
|
6507
6532
|
constructor() {
|
|
6508
6533
|
this.registeredActors = /* @__PURE__ */ new Set();
|
|
@@ -6627,22 +6652,158 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6627
6652
|
{},
|
|
6628
6653
|
{ concurrency: 10 }
|
|
6629
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
|
+
);
|
|
6630
6791
|
this.splitRoutinesTask = CadenzaService.createMetaTask(
|
|
6631
6792
|
"Split routines for registration",
|
|
6632
|
-
(ctx
|
|
6793
|
+
function* (ctx) {
|
|
6633
6794
|
const { routines } = ctx;
|
|
6634
|
-
if (!routines) return
|
|
6795
|
+
if (!routines) return;
|
|
6635
6796
|
const serviceName2 = resolveSyncServiceName();
|
|
6636
6797
|
if (!serviceName2) {
|
|
6637
|
-
return
|
|
6798
|
+
return;
|
|
6638
6799
|
}
|
|
6639
6800
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6640
6801
|
delayMs: 2e3
|
|
6641
6802
|
});
|
|
6642
|
-
let emittedCount = 0;
|
|
6643
6803
|
for (const routine of routines) {
|
|
6644
6804
|
if (routine.registered) continue;
|
|
6645
|
-
|
|
6805
|
+
this.routinesSynced = false;
|
|
6806
|
+
yield {
|
|
6646
6807
|
__syncing: ctx.__syncing,
|
|
6647
6808
|
data: {
|
|
6648
6809
|
name: routine.name,
|
|
@@ -6652,13 +6813,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6652
6813
|
isMeta: routine.isMeta
|
|
6653
6814
|
},
|
|
6654
6815
|
__routineName: routine.name
|
|
6655
|
-
}
|
|
6656
|
-
emittedCount += 1;
|
|
6816
|
+
};
|
|
6657
6817
|
}
|
|
6658
|
-
|
|
6659
|
-
}
|
|
6818
|
+
}.bind(this)
|
|
6660
6819
|
);
|
|
6661
|
-
|
|
6820
|
+
this.splitRoutinesTask.then(
|
|
6662
6821
|
resolveSyncInsertTask(
|
|
6663
6822
|
this.isCadenzaDBReady,
|
|
6664
6823
|
"routine",
|
|
@@ -6680,22 +6839,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6680
6839
|
delayMs: 3e3
|
|
6681
6840
|
});
|
|
6682
6841
|
CadenzaService.getRoutine(ctx.__routineName).registered = true;
|
|
6683
|
-
CadenzaService.debounce(
|
|
6684
|
-
"meta.sync_controller.routine_registration_settled",
|
|
6685
|
-
{ __syncing: true },
|
|
6686
|
-
300
|
|
6687
|
-
);
|
|
6688
6842
|
return true;
|
|
6689
|
-
})
|
|
6843
|
+
}).then(gatherRoutineRegistrationTask)
|
|
6690
6844
|
)
|
|
6691
6845
|
);
|
|
6692
|
-
CadenzaService.createUniqueMetaTask(
|
|
6693
|
-
"Gather routine registration",
|
|
6694
|
-
() => {
|
|
6695
|
-
this.routinesSynced = true;
|
|
6696
|
-
return true;
|
|
6697
|
-
}
|
|
6698
|
-
).doOn("meta.sync_controller.routine_registration_settled").emits("meta.sync_controller.synced_routines");
|
|
6699
6846
|
this.splitTasksInRoutines = CadenzaService.createMetaTask(
|
|
6700
6847
|
"Split tasks in routines",
|
|
6701
6848
|
function* (ctx) {
|
|
@@ -6784,18 +6931,19 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6784
6931
|
}
|
|
6785
6932
|
this.splitSignalsTask = CadenzaService.createMetaTask(
|
|
6786
6933
|
"Split signals for registration",
|
|
6787
|
-
(ctx
|
|
6934
|
+
function* (ctx) {
|
|
6788
6935
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6789
6936
|
delayMs: 3e3
|
|
6790
6937
|
});
|
|
6791
6938
|
const { signals } = ctx;
|
|
6792
|
-
if (!signals) return
|
|
6939
|
+
if (!signals) return;
|
|
6793
6940
|
const filteredSignals = signals.filter(
|
|
6794
6941
|
(signal) => !signal.data.registered
|
|
6795
6942
|
).map((signal) => signal.signal);
|
|
6796
6943
|
for (const signal of filteredSignals) {
|
|
6797
6944
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signal);
|
|
6798
|
-
|
|
6945
|
+
this.signalsSynced = false;
|
|
6946
|
+
yield {
|
|
6799
6947
|
__syncing: ctx.__syncing,
|
|
6800
6948
|
data: {
|
|
6801
6949
|
name: signal,
|
|
@@ -6805,12 +6953,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6805
6953
|
isMeta
|
|
6806
6954
|
},
|
|
6807
6955
|
__signal: signal
|
|
6808
|
-
}
|
|
6956
|
+
};
|
|
6809
6957
|
}
|
|
6810
|
-
|
|
6811
|
-
}
|
|
6958
|
+
}.bind(this)
|
|
6812
6959
|
);
|
|
6813
|
-
|
|
6960
|
+
this.splitSignalsTask.then(
|
|
6814
6961
|
resolveSyncInsertTask(
|
|
6815
6962
|
this.isCadenzaDBReady,
|
|
6816
6963
|
"signal_registry",
|
|
@@ -6831,22 +6978,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6831
6978
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
6832
6979
|
delayMs: 3e3
|
|
6833
6980
|
});
|
|
6834
|
-
CadenzaService.debounce(
|
|
6835
|
-
"meta.sync_controller.signal_registration_settled",
|
|
6836
|
-
{ __syncing: true },
|
|
6837
|
-
300
|
|
6838
|
-
);
|
|
6839
6981
|
return { signalName: ctx.__signal };
|
|
6840
|
-
}).then(CadenzaService.signalBroker.registerSignalTask)
|
|
6982
|
+
}).then(CadenzaService.signalBroker.registerSignalTask).then(gatherSignalRegistrationTask)
|
|
6841
6983
|
)
|
|
6842
6984
|
);
|
|
6843
|
-
CadenzaService.createUniqueMetaTask(
|
|
6844
|
-
"Gather signal registration",
|
|
6845
|
-
() => {
|
|
6846
|
-
this.signalsSynced = true;
|
|
6847
|
-
return true;
|
|
6848
|
-
}
|
|
6849
|
-
).doOn("meta.sync_controller.signal_registration_settled").emits("meta.sync_controller.synced_signals");
|
|
6850
6985
|
this.splitTasksForRegistration = CadenzaService.createMetaTask(
|
|
6851
6986
|
"Split tasks for registration",
|
|
6852
6987
|
function* (ctx) {
|
|
@@ -6861,6 +6996,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6861
6996
|
for (const task of tasks) {
|
|
6862
6997
|
if (task.registered) continue;
|
|
6863
6998
|
const { __functionString, __getTagCallback } = task.export();
|
|
6999
|
+
this.tasksSynced = false;
|
|
6864
7000
|
if (shouldDebugSyncTaskName(task.name)) {
|
|
6865
7001
|
logSyncDebug("task_registration_split", {
|
|
6866
7002
|
taskName: task.name,
|
|
@@ -6909,7 +7045,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6909
7045
|
__taskName: task.name
|
|
6910
7046
|
};
|
|
6911
7047
|
}
|
|
6912
|
-
}
|
|
7048
|
+
}.bind(this)
|
|
6913
7049
|
);
|
|
6914
7050
|
const registerTaskTask = resolveSyncInsertTask(
|
|
6915
7051
|
this.isCadenzaDBReady,
|
|
@@ -6943,13 +7079,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6943
7079
|
...ctx,
|
|
6944
7080
|
task: CadenzaService.get(ctx.__taskName)
|
|
6945
7081
|
});
|
|
6946
|
-
CadenzaService.debounce(
|
|
6947
|
-
"meta.sync_controller.task_registration_settled",
|
|
6948
|
-
{ __syncing: true },
|
|
6949
|
-
300
|
|
6950
|
-
);
|
|
6951
7082
|
return true;
|
|
6952
|
-
})
|
|
7083
|
+
}).then(gatherTaskRegistrationTask)
|
|
6953
7084
|
);
|
|
6954
7085
|
if (registerTaskTask) {
|
|
6955
7086
|
this.splitTasksForRegistration.then(registerTaskTask);
|
|
@@ -6982,13 +7113,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6982
7113
|
isHidden: true
|
|
6983
7114
|
}
|
|
6984
7115
|
).doOn("meta.task.created").then(this.splitTasksForRegistration);
|
|
6985
|
-
CadenzaService.createUniqueMetaTask(
|
|
6986
|
-
"Gather task registration",
|
|
6987
|
-
() => {
|
|
6988
|
-
this.tasksSynced = true;
|
|
6989
|
-
return true;
|
|
6990
|
-
}
|
|
6991
|
-
).doOn("meta.sync_controller.task_registration_settled").emits("meta.sync_controller.synced_tasks");
|
|
6992
7116
|
this.splitActorsForRegistration = CadenzaService.createMetaTask(
|
|
6993
7117
|
"Split actors for registration",
|
|
6994
7118
|
function* (ctx) {
|
|
@@ -7012,6 +7136,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7012
7136
|
if (this.registeredActors.has(registrationKey)) {
|
|
7013
7137
|
continue;
|
|
7014
7138
|
}
|
|
7139
|
+
this.actorsSynced = false;
|
|
7015
7140
|
yield {
|
|
7016
7141
|
data,
|
|
7017
7142
|
__actorRegistrationKey: registrationKey
|
|
@@ -7040,22 +7165,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7040
7165
|
delayMs: 3e3
|
|
7041
7166
|
});
|
|
7042
7167
|
this.registeredActors.add(ctx.__actorRegistrationKey);
|
|
7043
|
-
CadenzaService.debounce(
|
|
7044
|
-
"meta.sync_controller.actor_registration_settled",
|
|
7045
|
-
{ __syncing: true },
|
|
7046
|
-
300
|
|
7047
|
-
);
|
|
7048
7168
|
return true;
|
|
7049
|
-
})
|
|
7169
|
+
}).then(gatherActorRegistrationTask)
|
|
7050
7170
|
)
|
|
7051
7171
|
);
|
|
7052
|
-
CadenzaService.createUniqueMetaTask(
|
|
7053
|
-
"Gather actor registration",
|
|
7054
|
-
() => {
|
|
7055
|
-
this.actorsSynced = true;
|
|
7056
|
-
return true;
|
|
7057
|
-
}
|
|
7058
|
-
).doOn("meta.sync_controller.actor_registration_settled").emits("meta.sync_controller.synced_actors");
|
|
7059
7172
|
this.registerActorTaskMapTask = CadenzaService.createMetaTask(
|
|
7060
7173
|
"Split actor task maps",
|
|
7061
7174
|
function* (ctx) {
|
|
@@ -7202,12 +7315,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7202
7315
|
);
|
|
7203
7316
|
this.splitIntentsTask = CadenzaService.createMetaTask(
|
|
7204
7317
|
"Split intents for registration",
|
|
7205
|
-
function(ctx
|
|
7318
|
+
function* (ctx) {
|
|
7206
7319
|
CadenzaService.debounce("meta.sync_controller.synced_resource", {
|
|
7207
7320
|
delayMs: 3e3
|
|
7208
7321
|
});
|
|
7209
7322
|
const intents = Array.isArray(ctx.intents) ? ctx.intents : Array.from(CadenzaService.inquiryBroker.intents.values());
|
|
7210
|
-
let emittedCount = 0;
|
|
7211
7323
|
for (const intent of intents) {
|
|
7212
7324
|
const intentData = buildIntentRegistryData(intent);
|
|
7213
7325
|
if (!intentData) {
|
|
@@ -7216,17 +7328,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7216
7328
|
if (this.registeredIntentDefinitions.has(intentData.name)) {
|
|
7217
7329
|
continue;
|
|
7218
7330
|
}
|
|
7219
|
-
|
|
7331
|
+
this.intentsSynced = false;
|
|
7332
|
+
yield {
|
|
7220
7333
|
__syncing: ctx.__syncing,
|
|
7221
7334
|
data: intentData,
|
|
7222
7335
|
__intentName: intentData.name
|
|
7223
|
-
}
|
|
7224
|
-
emittedCount += 1;
|
|
7336
|
+
};
|
|
7225
7337
|
}
|
|
7226
|
-
return emittedCount > 0;
|
|
7227
7338
|
}.bind(this)
|
|
7228
7339
|
);
|
|
7229
|
-
|
|
7340
|
+
this.splitIntentsTask.then(
|
|
7230
7341
|
insertIntentRegistryTask?.then(
|
|
7231
7342
|
CadenzaService.createMetaTask("Record intent definition registration", (ctx) => {
|
|
7232
7343
|
if (!didSyncInsertSucceed(ctx)) {
|
|
@@ -7236,22 +7347,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7236
7347
|
delayMs: 3e3
|
|
7237
7348
|
});
|
|
7238
7349
|
this.registeredIntentDefinitions.add(ctx.__intentName);
|
|
7239
|
-
CadenzaService.debounce(
|
|
7240
|
-
"meta.sync_controller.intent_registration_settled",
|
|
7241
|
-
{ __syncing: true },
|
|
7242
|
-
300
|
|
7243
|
-
);
|
|
7244
7350
|
return true;
|
|
7245
|
-
})
|
|
7351
|
+
}).then(gatherIntentRegistrationTask)
|
|
7246
7352
|
)
|
|
7247
7353
|
);
|
|
7248
|
-
CadenzaService.createUniqueMetaTask(
|
|
7249
|
-
"Gather intent registration",
|
|
7250
|
-
() => {
|
|
7251
|
-
this.intentsSynced = true;
|
|
7252
|
-
return true;
|
|
7253
|
-
}
|
|
7254
|
-
).doOn("meta.sync_controller.intent_registration_settled").emits("meta.sync_controller.synced_intents");
|
|
7255
7354
|
const registerIntentTask = CadenzaService.createMetaTask(
|
|
7256
7355
|
"Record intent registration",
|
|
7257
7356
|
(ctx) => {
|
|
@@ -7545,15 +7644,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7545
7644
|
__authoritativeReconciliation: true
|
|
7546
7645
|
});
|
|
7547
7646
|
}
|
|
7548
|
-
if (authoritativeTasks.length > 0) {
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
__authoritativeReconciliation: true
|
|
7554
|
-
},
|
|
7555
|
-
300
|
|
7556
|
-
);
|
|
7647
|
+
if (authoritativeTasks.length > 0 || changed) {
|
|
7648
|
+
finalizeTaskSync(emit, {
|
|
7649
|
+
...ctx,
|
|
7650
|
+
__authoritativeReconciliation: true
|
|
7651
|
+
});
|
|
7557
7652
|
}
|
|
7558
7653
|
return changed;
|
|
7559
7654
|
},
|
|
@@ -7565,7 +7660,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7565
7660
|
);
|
|
7566
7661
|
const reconcileRoutineRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7567
7662
|
"Reconcile routine registration from authority",
|
|
7568
|
-
(ctx) => {
|
|
7663
|
+
(ctx, emit) => {
|
|
7569
7664
|
const authoritativeRoutines = resolveSyncQueryRows(ctx, "routine");
|
|
7570
7665
|
let changed = false;
|
|
7571
7666
|
for (const row of authoritativeRoutines) {
|
|
@@ -7580,15 +7675,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7580
7675
|
routine.registered = true;
|
|
7581
7676
|
changed = true;
|
|
7582
7677
|
}
|
|
7583
|
-
if (authoritativeRoutines.length > 0) {
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
__authoritativeReconciliation: true
|
|
7589
|
-
},
|
|
7590
|
-
300
|
|
7591
|
-
);
|
|
7678
|
+
if (authoritativeRoutines.length > 0 || changed) {
|
|
7679
|
+
finalizeRoutineSync(emit, {
|
|
7680
|
+
...ctx,
|
|
7681
|
+
__authoritativeReconciliation: true
|
|
7682
|
+
});
|
|
7592
7683
|
}
|
|
7593
7684
|
return changed;
|
|
7594
7685
|
},
|
|
@@ -7600,7 +7691,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7600
7691
|
);
|
|
7601
7692
|
const reconcileSignalRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7602
7693
|
"Reconcile signal registration from authority",
|
|
7603
|
-
(ctx) => {
|
|
7694
|
+
(ctx, emit) => {
|
|
7604
7695
|
const authoritativeSignals = resolveSyncQueryRows(ctx, "signal_registry");
|
|
7605
7696
|
const signalObservers = CadenzaService.signalBroker.signalObservers;
|
|
7606
7697
|
let changed = false;
|
|
@@ -7616,15 +7707,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7616
7707
|
observer.registered = true;
|
|
7617
7708
|
changed = true;
|
|
7618
7709
|
}
|
|
7619
|
-
if (authoritativeSignals.length > 0) {
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
__authoritativeReconciliation: true
|
|
7625
|
-
},
|
|
7626
|
-
300
|
|
7627
|
-
);
|
|
7710
|
+
if (authoritativeSignals.length > 0 || changed) {
|
|
7711
|
+
finalizeSignalSync(emit, {
|
|
7712
|
+
...ctx,
|
|
7713
|
+
__authoritativeReconciliation: true
|
|
7714
|
+
});
|
|
7628
7715
|
}
|
|
7629
7716
|
return changed;
|
|
7630
7717
|
},
|
|
@@ -7636,7 +7723,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7636
7723
|
);
|
|
7637
7724
|
const reconcileIntentRegistrationFromAuthorityTask = CadenzaService.createMetaTask(
|
|
7638
7725
|
"Reconcile intent registration from authority",
|
|
7639
|
-
(ctx) => {
|
|
7726
|
+
(ctx, emit) => {
|
|
7640
7727
|
const authoritativeIntents = resolveSyncQueryRows(ctx, "intent_registry");
|
|
7641
7728
|
let changed = false;
|
|
7642
7729
|
for (const row of authoritativeIntents) {
|
|
@@ -7650,15 +7737,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
7650
7737
|
this.registeredIntentDefinitions.add(intentName);
|
|
7651
7738
|
changed = true;
|
|
7652
7739
|
}
|
|
7653
|
-
if (authoritativeIntents.length > 0) {
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
__authoritativeReconciliation: true
|
|
7659
|
-
},
|
|
7660
|
-
300
|
|
7661
|
-
);
|
|
7740
|
+
if (authoritativeIntents.length > 0 || changed) {
|
|
7741
|
+
finalizeIntentSync(emit, {
|
|
7742
|
+
...ctx,
|
|
7743
|
+
__authoritativeReconciliation: true
|
|
7744
|
+
});
|
|
7662
7745
|
}
|
|
7663
7746
|
return changed;
|
|
7664
7747
|
},
|