@cadenza.io/service 2.0.19 → 2.0.21
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +48 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -21950,7 +21950,7 @@ declare class CadenzaService {
|
|
|
21950
21950
|
* ```
|
|
21951
21951
|
*/
|
|
21952
21952
|
static emit(signal: string, data?: AnyObject): void;
|
|
21953
|
-
static debounce(signal: string, context
|
|
21953
|
+
static debounce(signal: string, context?: any, delayMs?: number): void;
|
|
21954
21954
|
/**
|
|
21955
21955
|
* Executes the given task or graph routine within the provided context using the configured runner.
|
|
21956
21956
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -21950,7 +21950,7 @@ declare class CadenzaService {
|
|
|
21950
21950
|
* ```
|
|
21951
21951
|
*/
|
|
21952
21952
|
static emit(signal: string, data?: AnyObject): void;
|
|
21953
|
-
static debounce(signal: string, context
|
|
21953
|
+
static debounce(signal: string, context?: any, delayMs?: number): void;
|
|
21954
21954
|
/**
|
|
21955
21955
|
* Executes the given task or graph routine within the provided context using the configured runner.
|
|
21956
21956
|
*
|
package/dist/index.js
CHANGED
|
@@ -3711,6 +3711,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3711
3711
|
function* (ctx, emit) {
|
|
3712
3712
|
console.log("SPLITTING ROUTINES FOR REGISTRATION");
|
|
3713
3713
|
const { routines } = ctx;
|
|
3714
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3714
3715
|
if (!routines) return;
|
|
3715
3716
|
for (const routine of routines) {
|
|
3716
3717
|
if (routine.registered) continue;
|
|
@@ -3754,7 +3755,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3754
3755
|
}
|
|
3755
3756
|
}
|
|
3756
3757
|
).attachSignal("global.meta.sync_controller.routine_added").then(
|
|
3757
|
-
|
|
3758
|
+
this.isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(
|
|
3758
3759
|
"task_to_routine_map",
|
|
3759
3760
|
{
|
|
3760
3761
|
onConflict: {
|
|
@@ -3771,27 +3772,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3771
3772
|
}
|
|
3772
3773
|
},
|
|
3773
3774
|
{ concurrency: 50 }
|
|
3774
|
-
) : CadenzaService.get("dbInsertTaskToRoutineMap")
|
|
3775
|
-
CadenzaService.createUniqueMetaTask("Finish sync", (ctx, emit) => {
|
|
3776
|
-
emit("global.meta.sync_controller.synced", {
|
|
3777
|
-
data: {
|
|
3778
|
-
is_active: true,
|
|
3779
|
-
is_non_responsive: false,
|
|
3780
|
-
is_blocked: false,
|
|
3781
|
-
last_active: formatTimestamp(Date.now())
|
|
3782
|
-
},
|
|
3783
|
-
filter: {
|
|
3784
|
-
uuid: CadenzaService.serviceRegistry.serviceInstanceId
|
|
3785
|
-
}
|
|
3786
|
-
});
|
|
3787
|
-
CadenzaService.log("Synced resources...");
|
|
3788
|
-
}).attachSignal("global.meta.sync_controller.synced")
|
|
3789
|
-
)
|
|
3775
|
+
) : CadenzaService.get("dbInsertTaskToRoutineMap")
|
|
3790
3776
|
);
|
|
3791
3777
|
this.splitSignalsTask = CadenzaService.createMetaTask(
|
|
3792
3778
|
"Split signals for registration",
|
|
3793
3779
|
function* (ctx) {
|
|
3794
3780
|
console.log("Splitting signals for registration...");
|
|
3781
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3795
3782
|
const { signals } = ctx;
|
|
3796
3783
|
if (!signals) return;
|
|
3797
3784
|
const filteredSignals = signals.filter(
|
|
@@ -3799,6 +3786,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3799
3786
|
).map((signal) => signal.signal);
|
|
3800
3787
|
for (const signal of filteredSignals) {
|
|
3801
3788
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signal);
|
|
3789
|
+
console.log("REGISTERING SIGNAL", signal);
|
|
3802
3790
|
yield {
|
|
3803
3791
|
data: {
|
|
3804
3792
|
name: signal,
|
|
@@ -3828,8 +3816,9 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3828
3816
|
if (!ctx.__syncing) {
|
|
3829
3817
|
return;
|
|
3830
3818
|
}
|
|
3831
|
-
console.log("REGISTERING SIGNAL", ctx.
|
|
3832
|
-
|
|
3819
|
+
console.log("REGISTERING SIGNAL", ctx.signalRegistry?.name);
|
|
3820
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3821
|
+
return { signalName: ctx.signalRegistry?.name };
|
|
3833
3822
|
}).then(CadenzaService.broker.registerSignalTask)
|
|
3834
3823
|
)
|
|
3835
3824
|
);
|
|
@@ -3837,6 +3826,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3837
3826
|
"Split tasks for registration",
|
|
3838
3827
|
function* (ctx) {
|
|
3839
3828
|
console.log("SPLITTING TASKS FOR REGISTRATION");
|
|
3829
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3840
3830
|
const tasks = ctx.tasks;
|
|
3841
3831
|
for (const task of tasks) {
|
|
3842
3832
|
if (task.registered) continue;
|
|
@@ -3897,6 +3887,12 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3897
3887
|
if (!ctx.__syncing) {
|
|
3898
3888
|
return;
|
|
3899
3889
|
}
|
|
3890
|
+
console.log(
|
|
3891
|
+
"REGISTERING TASK",
|
|
3892
|
+
ctx.__name,
|
|
3893
|
+
!!CadenzaService.get(ctx.__name)
|
|
3894
|
+
);
|
|
3895
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3900
3896
|
CadenzaService.get(ctx.__name).registered = true;
|
|
3901
3897
|
})
|
|
3902
3898
|
)
|
|
@@ -3907,6 +3903,12 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3907
3903
|
if (!ctx.__syncing) {
|
|
3908
3904
|
return;
|
|
3909
3905
|
}
|
|
3906
|
+
console.log(
|
|
3907
|
+
"REGISTERING TASK SIGNAL",
|
|
3908
|
+
ctx.__name,
|
|
3909
|
+
ctx.signalName,
|
|
3910
|
+
!!CadenzaService.get(ctx.__name)
|
|
3911
|
+
);
|
|
3910
3912
|
CadenzaService.get(ctx.__name)?.registeredSignals.add(ctx.signalName);
|
|
3911
3913
|
}
|
|
3912
3914
|
);
|
|
@@ -3956,6 +3958,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3956
3958
|
"Register task map to DB",
|
|
3957
3959
|
function* (ctx) {
|
|
3958
3960
|
const task = ctx.task;
|
|
3961
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3959
3962
|
if (task.hidden || !task.register) return;
|
|
3960
3963
|
for (const t of task.nextTasks) {
|
|
3961
3964
|
if (task.taskMapRegistration.has(t.name) || t.hidden || !t.register) {
|
|
@@ -4000,6 +4003,12 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4000
4003
|
if (!ctx.__syncing) {
|
|
4001
4004
|
return;
|
|
4002
4005
|
}
|
|
4006
|
+
console.log(
|
|
4007
|
+
"REGISTERING TASK MAP",
|
|
4008
|
+
ctx.__name,
|
|
4009
|
+
ctx.__nextTaskName,
|
|
4010
|
+
!!CadenzaService.get(ctx.__name)
|
|
4011
|
+
);
|
|
4003
4012
|
CadenzaService.get(ctx.__name)?.taskMapRegistration.add(ctx.__nextTaskName);
|
|
4004
4013
|
})
|
|
4005
4014
|
)
|
|
@@ -4056,6 +4065,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4056
4065
|
if (!ctx.__syncing) {
|
|
4057
4066
|
return;
|
|
4058
4067
|
}
|
|
4068
|
+
console.log(
|
|
4069
|
+
"REGISTERING DEPUTY MAP",
|
|
4070
|
+
ctx.__name,
|
|
4071
|
+
!!CadenzaService.get(ctx.__name)
|
|
4072
|
+
);
|
|
4059
4073
|
CadenzaService.get(ctx.__name).registeredDeputyMap = true;
|
|
4060
4074
|
}
|
|
4061
4075
|
)
|
|
@@ -4075,6 +4089,20 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4075
4089
|
)
|
|
4076
4090
|
)
|
|
4077
4091
|
);
|
|
4092
|
+
CadenzaService.createMetaTask("Finish sync", (ctx, emit) => {
|
|
4093
|
+
emit("global.meta.sync_controller.synced", {
|
|
4094
|
+
data: {
|
|
4095
|
+
is_active: true,
|
|
4096
|
+
is_non_responsive: false,
|
|
4097
|
+
is_blocked: false,
|
|
4098
|
+
last_active: formatTimestamp(Date.now())
|
|
4099
|
+
},
|
|
4100
|
+
filter: {
|
|
4101
|
+
uuid: CadenzaService.serviceRegistry.serviceInstanceId
|
|
4102
|
+
}
|
|
4103
|
+
});
|
|
4104
|
+
CadenzaService.log("Synced resources...");
|
|
4105
|
+
}).attachSignal("global.meta.sync_controller.synced").doOn("sync_controller.synced_resource");
|
|
4078
4106
|
console.log("Sync controller init", this.isCadenzaDBReady);
|
|
4079
4107
|
if (!this.isCadenzaDBReady) {
|
|
4080
4108
|
CadenzaService.throttle(
|
|
@@ -4188,7 +4216,7 @@ var CadenzaService = class {
|
|
|
4188
4216
|
static emit(signal, data = {}) {
|
|
4189
4217
|
this.broker?.emit(signal, data);
|
|
4190
4218
|
}
|
|
4191
|
-
static debounce(signal, context, delayMs = 500) {
|
|
4219
|
+
static debounce(signal, context = {}, delayMs = 500) {
|
|
4192
4220
|
this.broker?.debounce(signal, context, delayMs);
|
|
4193
4221
|
}
|
|
4194
4222
|
/**
|