@cadenza.io/service 2.17.5 → 2.17.6
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 +43 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +43 -0
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -320,6 +320,7 @@ declare class ServiceRegistry {
|
|
|
320
320
|
private markTransportClientCreated;
|
|
321
321
|
private registerDependee;
|
|
322
322
|
private unregisterDependee;
|
|
323
|
+
private reconcileBootstrapPlaceholderInstance;
|
|
323
324
|
private getHeartbeatMisses;
|
|
324
325
|
private shouldRequireReadinessFromCommunicationTypes;
|
|
325
326
|
private resolveRuntimeStatusSnapshot;
|
|
@@ -23166,6 +23167,7 @@ interface ServiceInstanceDescriptor {
|
|
|
23166
23167
|
health: AnyObject;
|
|
23167
23168
|
isFrontend: boolean;
|
|
23168
23169
|
isDatabase?: boolean;
|
|
23170
|
+
isBootstrapPlaceholder?: boolean;
|
|
23169
23171
|
transports: ServiceTransportDescriptor[];
|
|
23170
23172
|
clientCreatedTransportIds?: string[];
|
|
23171
23173
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -320,6 +320,7 @@ declare class ServiceRegistry {
|
|
|
320
320
|
private markTransportClientCreated;
|
|
321
321
|
private registerDependee;
|
|
322
322
|
private unregisterDependee;
|
|
323
|
+
private reconcileBootstrapPlaceholderInstance;
|
|
323
324
|
private getHeartbeatMisses;
|
|
324
325
|
private shouldRequireReadinessFromCommunicationTypes;
|
|
325
326
|
private resolveRuntimeStatusSnapshot;
|
|
@@ -23166,6 +23167,7 @@ interface ServiceInstanceDescriptor {
|
|
|
23166
23167
|
health: AnyObject;
|
|
23167
23168
|
isFrontend: boolean;
|
|
23168
23169
|
isDatabase?: boolean;
|
|
23170
|
+
isBootstrapPlaceholder?: boolean;
|
|
23169
23171
|
transports: ServiceTransportDescriptor[];
|
|
23170
23172
|
clientCreatedTransportIds?: string[];
|
|
23171
23173
|
}
|
package/dist/index.js
CHANGED
|
@@ -531,6 +531,9 @@ function normalizeServiceInstanceDescriptor(value) {
|
|
|
531
531
|
health: raw.health ?? {},
|
|
532
532
|
isFrontend: Boolean(raw.isFrontend ?? raw.is_frontend ?? false),
|
|
533
533
|
isDatabase: Boolean(raw.isDatabase ?? raw.is_database ?? false),
|
|
534
|
+
isBootstrapPlaceholder: Boolean(
|
|
535
|
+
raw.isBootstrapPlaceholder ?? raw.is_bootstrap_placeholder ?? false
|
|
536
|
+
),
|
|
534
537
|
transports,
|
|
535
538
|
clientCreatedTransportIds: Array.isArray(raw.clientCreatedTransportIds) ? raw.clientCreatedTransportIds.map((entry) => normalizeString2(entry)).filter((entry) => entry.length > 0) : void 0
|
|
536
539
|
};
|
|
@@ -944,6 +947,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
944
947
|
health: ctx.health ?? ctx.__health ?? {},
|
|
945
948
|
numberOfRunningGraphs: ctx.numberOfRunningGraphs ?? ctx.__numberOfRunningGraphs ?? 0,
|
|
946
949
|
isPrimary: false,
|
|
950
|
+
isBootstrapPlaceholder: !!ctx.isBootstrapPlaceholder,
|
|
947
951
|
transports: ctx.transports ?? []
|
|
948
952
|
} : void 0)
|
|
949
953
|
);
|
|
@@ -998,6 +1002,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
998
1002
|
trackedInstance.acceptingWork = snapshot.acceptingWork;
|
|
999
1003
|
trackedInstance.reportedAt = trackedInstance.reportedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1000
1004
|
}
|
|
1005
|
+
if (!serviceInstance.isBootstrapPlaceholder) {
|
|
1006
|
+
this.reconcileBootstrapPlaceholderInstance(serviceName, uuid5, emit);
|
|
1007
|
+
}
|
|
1001
1008
|
if (this.serviceName === serviceName) {
|
|
1002
1009
|
return false;
|
|
1003
1010
|
}
|
|
@@ -2361,6 +2368,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2361
2368
|
reportedAt: instance?.reportedAt ?? null,
|
|
2362
2369
|
isDatabase: instance?.isDatabase,
|
|
2363
2370
|
isFrontend: instance?.isFrontend,
|
|
2371
|
+
isBootstrapPlaceholder: instance?.isBootstrapPlaceholder,
|
|
2364
2372
|
transports: (instance?.transports ?? []).map((transport) => ({
|
|
2365
2373
|
uuid: transport.uuid,
|
|
2366
2374
|
role: transport.role,
|
|
@@ -2527,6 +2535,39 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2527
2535
|
this.missedHeartbeatsByInstance.delete(serviceInstanceId);
|
|
2528
2536
|
this.runtimeStatusFallbackInFlightByInstance.delete(serviceInstanceId);
|
|
2529
2537
|
}
|
|
2538
|
+
reconcileBootstrapPlaceholderInstance(serviceName, resolvedInstanceId, emit) {
|
|
2539
|
+
const instances = this.instances.get(serviceName);
|
|
2540
|
+
if (!instances?.length) {
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2543
|
+
const placeholders = instances.filter(
|
|
2544
|
+
(instance) => instance.uuid !== resolvedInstanceId && instance.isBootstrapPlaceholder
|
|
2545
|
+
);
|
|
2546
|
+
if (!placeholders.length) {
|
|
2547
|
+
return;
|
|
2548
|
+
}
|
|
2549
|
+
for (const placeholder of placeholders) {
|
|
2550
|
+
const wasDependee = this.dependeeByInstance.has(placeholder.uuid);
|
|
2551
|
+
const requiredForReadiness = this.readinessDependeeByInstance.has(
|
|
2552
|
+
placeholder.uuid
|
|
2553
|
+
);
|
|
2554
|
+
for (const transport of placeholder.transports) {
|
|
2555
|
+
const transportKey = buildTransportClientKey(transport);
|
|
2556
|
+
emit(`meta.socket_shutdown_requested:${transportKey}`, {});
|
|
2557
|
+
emit(`meta.fetch.destroy_requested:${transportKey}`, {});
|
|
2558
|
+
}
|
|
2559
|
+
this.unregisterDependee(placeholder.uuid, serviceName);
|
|
2560
|
+
if (wasDependee) {
|
|
2561
|
+
this.registerDependee(serviceName, resolvedInstanceId, {
|
|
2562
|
+
requiredForReadiness
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
this.instances.set(
|
|
2567
|
+
serviceName,
|
|
2568
|
+
instances.filter((instance) => !instance.isBootstrapPlaceholder)
|
|
2569
|
+
);
|
|
2570
|
+
}
|
|
2530
2571
|
getHeartbeatMisses(serviceInstanceId, now = Date.now()) {
|
|
2531
2572
|
const observedMisses = this.missedHeartbeatsByInstance.get(serviceInstanceId) ?? 0;
|
|
2532
2573
|
const lastHeartbeatAt = this.lastHeartbeatAtByInstance.get(serviceInstanceId) ?? 0;
|
|
@@ -9615,6 +9656,7 @@ var CadenzaService = class {
|
|
|
9615
9656
|
isBlocked: false,
|
|
9616
9657
|
health: {},
|
|
9617
9658
|
isFrontend: false,
|
|
9659
|
+
isBootstrapPlaceholder: true,
|
|
9618
9660
|
transports: resolvedBootstrapEndpoint ? [
|
|
9619
9661
|
this.createBootstrapTransport(
|
|
9620
9662
|
"cadenza-db",
|
|
@@ -9642,6 +9684,7 @@ var CadenzaService = class {
|
|
|
9642
9684
|
isBlocked: false,
|
|
9643
9685
|
health: {},
|
|
9644
9686
|
isFrontend: false,
|
|
9687
|
+
isBootstrapPlaceholder: true,
|
|
9645
9688
|
transports: relatedTransport ? [
|
|
9646
9689
|
{
|
|
9647
9690
|
uuid: `${service[0]}-${relatedTransport.role}`,
|