@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/browser/index.mjs
CHANGED
|
@@ -480,6 +480,9 @@ function normalizeServiceInstanceDescriptor(value) {
|
|
|
480
480
|
health: raw.health ?? {},
|
|
481
481
|
isFrontend: Boolean(raw.isFrontend ?? raw.is_frontend ?? false),
|
|
482
482
|
isDatabase: Boolean(raw.isDatabase ?? raw.is_database ?? false),
|
|
483
|
+
isBootstrapPlaceholder: Boolean(
|
|
484
|
+
raw.isBootstrapPlaceholder ?? raw.is_bootstrap_placeholder ?? false
|
|
485
|
+
),
|
|
483
486
|
transports,
|
|
484
487
|
clientCreatedTransportIds: Array.isArray(raw.clientCreatedTransportIds) ? raw.clientCreatedTransportIds.map((entry) => normalizeString2(entry)).filter((entry) => entry.length > 0) : void 0
|
|
485
488
|
};
|
|
@@ -893,6 +896,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
893
896
|
health: ctx.health ?? ctx.__health ?? {},
|
|
894
897
|
numberOfRunningGraphs: ctx.numberOfRunningGraphs ?? ctx.__numberOfRunningGraphs ?? 0,
|
|
895
898
|
isPrimary: false,
|
|
899
|
+
isBootstrapPlaceholder: !!ctx.isBootstrapPlaceholder,
|
|
896
900
|
transports: ctx.transports ?? []
|
|
897
901
|
} : void 0)
|
|
898
902
|
);
|
|
@@ -947,6 +951,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
947
951
|
trackedInstance.acceptingWork = snapshot.acceptingWork;
|
|
948
952
|
trackedInstance.reportedAt = trackedInstance.reportedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
949
953
|
}
|
|
954
|
+
if (!serviceInstance.isBootstrapPlaceholder) {
|
|
955
|
+
this.reconcileBootstrapPlaceholderInstance(serviceName, uuid5, emit);
|
|
956
|
+
}
|
|
950
957
|
if (this.serviceName === serviceName) {
|
|
951
958
|
return false;
|
|
952
959
|
}
|
|
@@ -2310,6 +2317,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2310
2317
|
reportedAt: instance?.reportedAt ?? null,
|
|
2311
2318
|
isDatabase: instance?.isDatabase,
|
|
2312
2319
|
isFrontend: instance?.isFrontend,
|
|
2320
|
+
isBootstrapPlaceholder: instance?.isBootstrapPlaceholder,
|
|
2313
2321
|
transports: (instance?.transports ?? []).map((transport) => ({
|
|
2314
2322
|
uuid: transport.uuid,
|
|
2315
2323
|
role: transport.role,
|
|
@@ -2476,6 +2484,39 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2476
2484
|
this.missedHeartbeatsByInstance.delete(serviceInstanceId);
|
|
2477
2485
|
this.runtimeStatusFallbackInFlightByInstance.delete(serviceInstanceId);
|
|
2478
2486
|
}
|
|
2487
|
+
reconcileBootstrapPlaceholderInstance(serviceName, resolvedInstanceId, emit) {
|
|
2488
|
+
const instances = this.instances.get(serviceName);
|
|
2489
|
+
if (!instances?.length) {
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
const placeholders = instances.filter(
|
|
2493
|
+
(instance) => instance.uuid !== resolvedInstanceId && instance.isBootstrapPlaceholder
|
|
2494
|
+
);
|
|
2495
|
+
if (!placeholders.length) {
|
|
2496
|
+
return;
|
|
2497
|
+
}
|
|
2498
|
+
for (const placeholder of placeholders) {
|
|
2499
|
+
const wasDependee = this.dependeeByInstance.has(placeholder.uuid);
|
|
2500
|
+
const requiredForReadiness = this.readinessDependeeByInstance.has(
|
|
2501
|
+
placeholder.uuid
|
|
2502
|
+
);
|
|
2503
|
+
for (const transport of placeholder.transports) {
|
|
2504
|
+
const transportKey = buildTransportClientKey(transport);
|
|
2505
|
+
emit(`meta.socket_shutdown_requested:${transportKey}`, {});
|
|
2506
|
+
emit(`meta.fetch.destroy_requested:${transportKey}`, {});
|
|
2507
|
+
}
|
|
2508
|
+
this.unregisterDependee(placeholder.uuid, serviceName);
|
|
2509
|
+
if (wasDependee) {
|
|
2510
|
+
this.registerDependee(serviceName, resolvedInstanceId, {
|
|
2511
|
+
requiredForReadiness
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
this.instances.set(
|
|
2516
|
+
serviceName,
|
|
2517
|
+
instances.filter((instance) => !instance.isBootstrapPlaceholder)
|
|
2518
|
+
);
|
|
2519
|
+
}
|
|
2479
2520
|
getHeartbeatMisses(serviceInstanceId, now = Date.now()) {
|
|
2480
2521
|
const observedMisses = this.missedHeartbeatsByInstance.get(serviceInstanceId) ?? 0;
|
|
2481
2522
|
const lastHeartbeatAt = this.lastHeartbeatAtByInstance.get(serviceInstanceId) ?? 0;
|
|
@@ -7178,6 +7219,7 @@ var CadenzaService = class {
|
|
|
7178
7219
|
isBlocked: false,
|
|
7179
7220
|
health: {},
|
|
7180
7221
|
isFrontend: false,
|
|
7222
|
+
isBootstrapPlaceholder: true,
|
|
7181
7223
|
transports: resolvedBootstrapEndpoint ? [
|
|
7182
7224
|
this.createBootstrapTransport(
|
|
7183
7225
|
"cadenza-db",
|
|
@@ -7205,6 +7247,7 @@ var CadenzaService = class {
|
|
|
7205
7247
|
isBlocked: false,
|
|
7206
7248
|
health: {},
|
|
7207
7249
|
isFrontend: false,
|
|
7250
|
+
isBootstrapPlaceholder: true,
|
|
7208
7251
|
transports: relatedTransport ? [
|
|
7209
7252
|
{
|
|
7210
7253
|
uuid: `${service[0]}-${relatedTransport.role}`,
|