@cadenza.io/service 2.5.0 → 2.6.0
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 +50 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -238,7 +238,7 @@ declare class ServiceRegistry {
|
|
|
238
238
|
handleGlobalSignalRegistrationTask: Task;
|
|
239
239
|
handleGlobalIntentRegistrationTask: Task;
|
|
240
240
|
handleSocketStatusUpdateTask: Task;
|
|
241
|
-
fullSyncTask: GraphRoutine;
|
|
241
|
+
fullSyncTask: GraphRoutine | Task;
|
|
242
242
|
getAllInstances: Task;
|
|
243
243
|
doForEachInstance: Task;
|
|
244
244
|
deleteInstance: Task;
|
package/dist/index.d.ts
CHANGED
|
@@ -238,7 +238,7 @@ declare class ServiceRegistry {
|
|
|
238
238
|
handleGlobalSignalRegistrationTask: Task;
|
|
239
239
|
handleGlobalIntentRegistrationTask: Task;
|
|
240
240
|
handleSocketStatusUpdateTask: Task;
|
|
241
|
-
fullSyncTask: GraphRoutine;
|
|
241
|
+
fullSyncTask: GraphRoutine | Task;
|
|
242
242
|
getAllInstances: Task;
|
|
243
243
|
doForEachInstance: Task;
|
|
244
244
|
deleteInstance: Task;
|
package/dist/index.js
CHANGED
|
@@ -362,6 +362,7 @@ function summarizeResponderStatuses(statuses) {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
// src/registry/ServiceRegistry.ts
|
|
365
|
+
var META_SERVICE_REGISTRY_FULL_SYNC_INTENT = "meta-service-registry-full-sync";
|
|
365
366
|
var ServiceRegistry = class _ServiceRegistry {
|
|
366
367
|
/**
|
|
367
368
|
* Initializes a private constructor for managing service instances, remote signals,
|
|
@@ -680,57 +681,58 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
680
681
|
},
|
|
681
682
|
"Handles status update from socket broadcast"
|
|
682
683
|
).doOn("meta.socket_client.status_received");
|
|
683
|
-
|
|
684
|
-
"
|
|
685
|
-
(ctx) => {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
684
|
+
this.fullSyncTask = CadenzaService.createMetaTask(
|
|
685
|
+
"Full sync",
|
|
686
|
+
async (ctx) => {
|
|
687
|
+
const inquiryResult = await CadenzaService.inquire(
|
|
688
|
+
META_SERVICE_REGISTRY_FULL_SYNC_INTENT,
|
|
689
|
+
{
|
|
690
|
+
syncScope: "service-registry-full-sync"
|
|
691
|
+
},
|
|
692
|
+
ctx.inquiryOptions ?? ctx.__inquiryOptions ?? {}
|
|
693
|
+
);
|
|
694
|
+
const signalToTaskMaps = (inquiryResult.signalToTaskMaps ?? []).filter((m) => !!m.isGlobal).map((m) => ({
|
|
695
|
+
signalName: m.signalName,
|
|
696
|
+
serviceName: m.serviceName,
|
|
697
|
+
deleted: !!m.deleted
|
|
698
|
+
}));
|
|
699
|
+
const intentToTaskMaps = (inquiryResult.intentToTaskMaps ?? []).map(
|
|
700
|
+
(m) => ({
|
|
701
|
+
intentName: m.intentName,
|
|
702
|
+
taskName: m.taskName,
|
|
703
|
+
taskVersion: m.taskVersion ?? 1,
|
|
704
|
+
serviceName: m.serviceName,
|
|
705
|
+
deleted: !!m.deleted
|
|
706
|
+
})
|
|
707
|
+
);
|
|
708
|
+
const serviceInstances = (inquiryResult.serviceInstances ?? []).filter(
|
|
709
|
+
(instance) => !instance.deleted && !!instance.isActive && !instance.isNonResponsive && !instance.isBlocked
|
|
710
|
+
).map((instance) => ({
|
|
711
|
+
uuid: instance.uuid,
|
|
712
|
+
address: instance.address,
|
|
713
|
+
port: instance.port,
|
|
714
|
+
serviceName: instance.serviceName,
|
|
715
|
+
isActive: !!instance.isActive,
|
|
716
|
+
isNonResponsive: !!instance.isNonResponsive,
|
|
717
|
+
isBlocked: !!instance.isBlocked,
|
|
718
|
+
health: instance.health ?? {},
|
|
719
|
+
exposed: !!instance.exposed,
|
|
720
|
+
created: instance.created,
|
|
721
|
+
isFrontend: !!instance.isFrontend
|
|
722
|
+
}));
|
|
723
|
+
return {
|
|
724
|
+
...ctx,
|
|
725
|
+
signalToTaskMaps,
|
|
726
|
+
intentToTaskMaps,
|
|
727
|
+
serviceInstances,
|
|
728
|
+
__inquiryMeta: inquiryResult.__inquiryMeta
|
|
729
|
+
};
|
|
730
|
+
},
|
|
731
|
+
"Runs service registry full sync through one distributed inquiry intent."
|
|
732
|
+
).doOn("meta.sync_requested").emits("meta.service_registry.initial_sync_complete").then(
|
|
693
733
|
this.handleGlobalSignalRegistrationTask,
|
|
694
734
|
this.handleGlobalIntentRegistrationTask
|
|
695
735
|
);
|
|
696
|
-
this.fullSyncTask = CadenzaService.createMetaRoutine("Full sync", [
|
|
697
|
-
CadenzaService.createCadenzaDBQueryTask("signal_to_task_map", {
|
|
698
|
-
filter: {
|
|
699
|
-
isGlobal: true
|
|
700
|
-
},
|
|
701
|
-
fields: ["signal_name", "service_name", "deleted"]
|
|
702
|
-
}).then(mergeSyncDataTask),
|
|
703
|
-
CadenzaService.createCadenzaDBQueryTask("intent_to_task_map", {
|
|
704
|
-
fields: [
|
|
705
|
-
"intent_name",
|
|
706
|
-
"task_name",
|
|
707
|
-
"task_version",
|
|
708
|
-
"service_name",
|
|
709
|
-
"deleted"
|
|
710
|
-
]
|
|
711
|
-
}).then(mergeSyncDataTask),
|
|
712
|
-
CadenzaService.createCadenzaDBQueryTask("service_instance", {
|
|
713
|
-
filter: {
|
|
714
|
-
deleted: false,
|
|
715
|
-
is_active: true,
|
|
716
|
-
is_non_responsive: false,
|
|
717
|
-
is_blocked: false
|
|
718
|
-
},
|
|
719
|
-
fields: [
|
|
720
|
-
"uuid",
|
|
721
|
-
"address",
|
|
722
|
-
"port",
|
|
723
|
-
"service_name",
|
|
724
|
-
"is_active",
|
|
725
|
-
"is_non_responsive",
|
|
726
|
-
"is_blocked",
|
|
727
|
-
"health",
|
|
728
|
-
"exposed",
|
|
729
|
-
"created",
|
|
730
|
-
"is_frontend"
|
|
731
|
-
]
|
|
732
|
-
}).then(mergeSyncDataTask)
|
|
733
|
-
]).doOn("meta.sync_requested");
|
|
734
736
|
this.getInstanceById = CadenzaService.createMetaTask(
|
|
735
737
|
"Get instance by id",
|
|
736
738
|
(context) => {
|