@cadenza.io/service 2.21.1 → 2.21.3
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/{Cadenza-gGtFW_Y-.d.mts → Cadenza-CRVK2HUv.d.mts} +1 -0
- package/dist/{Cadenza-gGtFW_Y-.d.ts → Cadenza-CRVK2HUv.d.ts} +1 -0
- package/dist/browser/index.js +59 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +59 -0
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -0
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt/index.d.mts +2 -2
- package/dist/nuxt/index.d.ts +2 -2
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/vue/index.d.mts +2 -2
- package/dist/vue/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -375,6 +375,7 @@ declare class ServiceRegistry {
|
|
|
375
375
|
private authorityBootstrapHandshakeRetryIndex;
|
|
376
376
|
private authorityBootstrapHandshakeRetryGeneration;
|
|
377
377
|
private authorityBootstrapHandshakeRetryReason;
|
|
378
|
+
private authorityBootstrapRecoveryActive;
|
|
378
379
|
handleInstanceUpdateTask: Task;
|
|
379
380
|
handleTransportUpdateTask: Task;
|
|
380
381
|
handleGlobalSignalRegistrationTask: Task;
|
|
@@ -375,6 +375,7 @@ declare class ServiceRegistry {
|
|
|
375
375
|
private authorityBootstrapHandshakeRetryIndex;
|
|
376
376
|
private authorityBootstrapHandshakeRetryGeneration;
|
|
377
377
|
private authorityBootstrapHandshakeRetryReason;
|
|
378
|
+
private authorityBootstrapRecoveryActive;
|
|
378
379
|
handleInstanceUpdateTask: Task;
|
|
379
380
|
handleTransportUpdateTask: Task;
|
|
380
381
|
handleGlobalSignalRegistrationTask: Task;
|
package/dist/browser/index.js
CHANGED
|
@@ -294,6 +294,16 @@ var DELEGATION_FAILURE_CONTEXT_KEYS = [
|
|
|
294
294
|
"transportProtocols",
|
|
295
295
|
"transportProtocol"
|
|
296
296
|
];
|
|
297
|
+
var ACTOR_SESSION_STATE_REMOTE_ROUTINE = "Insert actor_session_state";
|
|
298
|
+
var ACTOR_SESSION_SNAPSHOT_ROOT_KEYS = [
|
|
299
|
+
"__remoteRoutineName",
|
|
300
|
+
"__serviceName",
|
|
301
|
+
"__localTaskName",
|
|
302
|
+
"__localTaskVersion",
|
|
303
|
+
"__localServiceName",
|
|
304
|
+
"__timeout",
|
|
305
|
+
...ROOT_METADATA_PASSTHROUGH_KEYS
|
|
306
|
+
];
|
|
297
307
|
function isPlainObject(value) {
|
|
298
308
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
299
309
|
return false;
|
|
@@ -318,6 +328,9 @@ function cloneDelegationValue(value) {
|
|
|
318
328
|
return value;
|
|
319
329
|
}
|
|
320
330
|
function buildDelegationRequestSnapshot(context) {
|
|
331
|
+
if (typeof context.__remoteRoutineName === "string" && context.__remoteRoutineName.trim() === ACTOR_SESSION_STATE_REMOTE_ROUTINE) {
|
|
332
|
+
return buildActorSessionDelegationSnapshot(context);
|
|
333
|
+
}
|
|
321
334
|
const snapshot = {};
|
|
322
335
|
for (const [key, value] of Object.entries(context)) {
|
|
323
336
|
if (key === DELEGATION_REQUEST_SNAPSHOT_KEY || key === "task" || key === "routine") {
|
|
@@ -327,6 +340,21 @@ function buildDelegationRequestSnapshot(context) {
|
|
|
327
340
|
}
|
|
328
341
|
return snapshot;
|
|
329
342
|
}
|
|
343
|
+
function buildActorSessionDelegationSnapshot(context) {
|
|
344
|
+
const snapshot = {};
|
|
345
|
+
for (const key of ACTOR_SESSION_SNAPSHOT_ROOT_KEYS) {
|
|
346
|
+
if (context[key] !== void 0) {
|
|
347
|
+
snapshot[key] = cloneDelegationValue(context[key]);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (context.data !== void 0) {
|
|
351
|
+
snapshot.data = cloneDelegationValue(context.data);
|
|
352
|
+
}
|
|
353
|
+
if (context.queryData !== void 0) {
|
|
354
|
+
snapshot.queryData = cloneDelegationValue(context.queryData);
|
|
355
|
+
}
|
|
356
|
+
return snapshot;
|
|
357
|
+
}
|
|
330
358
|
function hoistDelegationMetadataFields(input, metadataInput) {
|
|
331
359
|
const context = input && typeof input === "object" ? { ...input } : {};
|
|
332
360
|
const mutableContext = context;
|
|
@@ -4153,6 +4181,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
4153
4181
|
this.authorityBootstrapHandshakeRetryIndex = 0;
|
|
4154
4182
|
this.authorityBootstrapHandshakeRetryGeneration = 0;
|
|
4155
4183
|
this.authorityBootstrapHandshakeRetryReason = null;
|
|
4184
|
+
this.authorityBootstrapRecoveryActive = false;
|
|
4156
4185
|
this.authorityFullSyncResponderTask = null;
|
|
4157
4186
|
this.authorityServiceCommunicationPersistenceTask = null;
|
|
4158
4187
|
this.localLifecycleFlushActor = CadenzaService.createActor(
|
|
@@ -4713,6 +4742,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
4713
4742
|
const signalName = String(
|
|
4714
4743
|
ctx.__signalName ?? ctx.__signalEmission?.fullSignalName ?? ""
|
|
4715
4744
|
).trim();
|
|
4745
|
+
const isRuntimeStatusUnreachableSignal = signalName === "meta.service_registry.runtime_status_unreachable" || signalName.startsWith("meta.service_registry.runtime_status_unreachable.");
|
|
4716
4746
|
const isFetchHandshakeFailure = signalName === "meta.fetch.handshake_failed" || signalName.startsWith("meta.fetch.handshake_failed:");
|
|
4717
4747
|
const hardFetchHandshakeFailure = isFetchHandshakeFailure && isHardFetchHandshakeFailure(ctx);
|
|
4718
4748
|
const recoverableFetchHandshakeFailure = isFetchHandshakeFailure && isRecoverableFetchTransportFailure(ctx, {
|
|
@@ -4724,9 +4754,21 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
4724
4754
|
if (isFetchDelegateFailure && !hardFetchDelegateFailure) {
|
|
4725
4755
|
return false;
|
|
4726
4756
|
}
|
|
4757
|
+
if (serviceName === "CadenzaDB") {
|
|
4758
|
+
if (!this.authorityBootstrapRecoveryActive) {
|
|
4759
|
+
this.restartAuthorityBootstrapRecovery("cadenza_db_unreachable");
|
|
4760
|
+
}
|
|
4761
|
+
return false;
|
|
4762
|
+
}
|
|
4727
4763
|
if (serviceName === "CadenzaDB" && (isFetchHandshakeFailure && recoverableFetchHandshakeFailure || isFetchDelegateFailure && recoverableFetchDelegateFailure)) {
|
|
4728
4764
|
return false;
|
|
4729
4765
|
}
|
|
4766
|
+
if (serviceName === "CadenzaDB" && isRuntimeStatusUnreachableSignal) {
|
|
4767
|
+
return false;
|
|
4768
|
+
}
|
|
4769
|
+
if (serviceName === "CadenzaDB" && this.authorityBootstrapRecoveryActive) {
|
|
4770
|
+
return false;
|
|
4771
|
+
}
|
|
4730
4772
|
const serviceInstances = this.instances.get(serviceName);
|
|
4731
4773
|
const instances = serviceInstances?.filter((instance) => {
|
|
4732
4774
|
if (serviceInstanceId && instance.uuid === serviceInstanceId) {
|
|
@@ -5019,6 +5061,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5019
5061
|
return false;
|
|
5020
5062
|
}
|
|
5021
5063
|
}
|
|
5064
|
+
if (this.authorityBootstrapRecoveryActive) {
|
|
5065
|
+
return false;
|
|
5066
|
+
}
|
|
5022
5067
|
this.restartAuthorityBootstrapRecovery("cadenza_db_unreachable");
|
|
5023
5068
|
return true;
|
|
5024
5069
|
},
|
|
@@ -6177,6 +6222,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
6177
6222
|
if (!instance || !instance.isActive || instance.isBlocked) {
|
|
6178
6223
|
continue;
|
|
6179
6224
|
}
|
|
6225
|
+
if (instance.serviceName === "CadenzaDB") {
|
|
6226
|
+
continue;
|
|
6227
|
+
}
|
|
6180
6228
|
if (this.hasReadyClientTransportForProtocol(instance, "socket")) {
|
|
6181
6229
|
this.lastHeartbeatAtByInstance.set(serviceInstanceId, now);
|
|
6182
6230
|
this.missedHeartbeatsByInstance.set(serviceInstanceId, 0);
|
|
@@ -7700,6 +7748,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
7700
7748
|
this.clearAuthorityBootstrapHandshakeRetryTimer();
|
|
7701
7749
|
this.authorityBootstrapHandshakeRetryIndex = AUTHORITY_BOOTSTRAP_HANDSHAKE_RETRY_DELAYS_MS.length;
|
|
7702
7750
|
this.authorityBootstrapHandshakeRetryReason = null;
|
|
7751
|
+
this.authorityBootstrapRecoveryActive = false;
|
|
7703
7752
|
}
|
|
7704
7753
|
buildJitteredAuthorityBootstrapHandshakeRetryDelayMs(baseDelayMs, attempt) {
|
|
7705
7754
|
return buildDeterministicJitteredDelayMs(
|
|
@@ -7756,6 +7805,13 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
7756
7805
|
return this.scheduleAuthorityBootstrapHandshakeRetry(reason);
|
|
7757
7806
|
}
|
|
7758
7807
|
restartAuthorityBootstrapRecovery(reason) {
|
|
7808
|
+
if (this.authorityBootstrapRecoveryActive) {
|
|
7809
|
+
if (typeof reason === "string" && reason.trim()) {
|
|
7810
|
+
this.authorityBootstrapHandshakeRetryReason = reason.trim();
|
|
7811
|
+
}
|
|
7812
|
+
return false;
|
|
7813
|
+
}
|
|
7814
|
+
this.authorityBootstrapRecoveryActive = true;
|
|
7759
7815
|
this.invalidateAuthorityBootstrapHandshake();
|
|
7760
7816
|
this.invalidateBootstrapFullSyncRetryState(reason);
|
|
7761
7817
|
return this.restartAuthorityBootstrapHandshakeRetryChain(reason);
|
|
@@ -10857,6 +10913,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
10857
10913
|
if (!instance.isActive || instance.isBlocked) {
|
|
10858
10914
|
return false;
|
|
10859
10915
|
}
|
|
10916
|
+
if (instance.serviceName === "CadenzaDB") {
|
|
10917
|
+
return false;
|
|
10918
|
+
}
|
|
10860
10919
|
if (this.hasReadyClientTransportForProtocol(instance, "socket")) {
|
|
10861
10920
|
return false;
|
|
10862
10921
|
}
|