@cadenza.io/service 2.21.1 → 2.21.2
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 +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 -2
- package/dist/index.d.ts +2 -2
- 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/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
package/dist/browser/index.mjs
CHANGED
|
@@ -204,6 +204,16 @@ var DELEGATION_FAILURE_CONTEXT_KEYS = [
|
|
|
204
204
|
"transportProtocols",
|
|
205
205
|
"transportProtocol"
|
|
206
206
|
];
|
|
207
|
+
var ACTOR_SESSION_STATE_REMOTE_ROUTINE = "Insert actor_session_state";
|
|
208
|
+
var ACTOR_SESSION_SNAPSHOT_ROOT_KEYS = [
|
|
209
|
+
"__remoteRoutineName",
|
|
210
|
+
"__serviceName",
|
|
211
|
+
"__localTaskName",
|
|
212
|
+
"__localTaskVersion",
|
|
213
|
+
"__localServiceName",
|
|
214
|
+
"__timeout",
|
|
215
|
+
...ROOT_METADATA_PASSTHROUGH_KEYS
|
|
216
|
+
];
|
|
207
217
|
function isPlainObject(value) {
|
|
208
218
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
209
219
|
return false;
|
|
@@ -228,6 +238,9 @@ function cloneDelegationValue(value) {
|
|
|
228
238
|
return value;
|
|
229
239
|
}
|
|
230
240
|
function buildDelegationRequestSnapshot(context) {
|
|
241
|
+
if (typeof context.__remoteRoutineName === "string" && context.__remoteRoutineName.trim() === ACTOR_SESSION_STATE_REMOTE_ROUTINE) {
|
|
242
|
+
return buildActorSessionDelegationSnapshot(context);
|
|
243
|
+
}
|
|
231
244
|
const snapshot = {};
|
|
232
245
|
for (const [key, value] of Object.entries(context)) {
|
|
233
246
|
if (key === DELEGATION_REQUEST_SNAPSHOT_KEY || key === "task" || key === "routine") {
|
|
@@ -237,6 +250,21 @@ function buildDelegationRequestSnapshot(context) {
|
|
|
237
250
|
}
|
|
238
251
|
return snapshot;
|
|
239
252
|
}
|
|
253
|
+
function buildActorSessionDelegationSnapshot(context) {
|
|
254
|
+
const snapshot = {};
|
|
255
|
+
for (const key of ACTOR_SESSION_SNAPSHOT_ROOT_KEYS) {
|
|
256
|
+
if (context[key] !== void 0) {
|
|
257
|
+
snapshot[key] = cloneDelegationValue(context[key]);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (context.data !== void 0) {
|
|
261
|
+
snapshot.data = cloneDelegationValue(context.data);
|
|
262
|
+
}
|
|
263
|
+
if (context.queryData !== void 0) {
|
|
264
|
+
snapshot.queryData = cloneDelegationValue(context.queryData);
|
|
265
|
+
}
|
|
266
|
+
return snapshot;
|
|
267
|
+
}
|
|
240
268
|
function hoistDelegationMetadataFields(input, metadataInput) {
|
|
241
269
|
const context = input && typeof input === "object" ? { ...input } : {};
|
|
242
270
|
const mutableContext = context;
|
|
@@ -4063,6 +4091,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
4063
4091
|
this.authorityBootstrapHandshakeRetryIndex = 0;
|
|
4064
4092
|
this.authorityBootstrapHandshakeRetryGeneration = 0;
|
|
4065
4093
|
this.authorityBootstrapHandshakeRetryReason = null;
|
|
4094
|
+
this.authorityBootstrapRecoveryActive = false;
|
|
4066
4095
|
this.authorityFullSyncResponderTask = null;
|
|
4067
4096
|
this.authorityServiceCommunicationPersistenceTask = null;
|
|
4068
4097
|
this.localLifecycleFlushActor = CadenzaService.createActor(
|
|
@@ -4637,6 +4666,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
4637
4666
|
if (serviceName === "CadenzaDB" && (isFetchHandshakeFailure && recoverableFetchHandshakeFailure || isFetchDelegateFailure && recoverableFetchDelegateFailure)) {
|
|
4638
4667
|
return false;
|
|
4639
4668
|
}
|
|
4669
|
+
if (serviceName === "CadenzaDB" && this.authorityBootstrapRecoveryActive) {
|
|
4670
|
+
return false;
|
|
4671
|
+
}
|
|
4640
4672
|
const serviceInstances = this.instances.get(serviceName);
|
|
4641
4673
|
const instances = serviceInstances?.filter((instance) => {
|
|
4642
4674
|
if (serviceInstanceId && instance.uuid === serviceInstanceId) {
|
|
@@ -4929,6 +4961,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
4929
4961
|
return false;
|
|
4930
4962
|
}
|
|
4931
4963
|
}
|
|
4964
|
+
if (this.authorityBootstrapRecoveryActive) {
|
|
4965
|
+
return false;
|
|
4966
|
+
}
|
|
4932
4967
|
this.restartAuthorityBootstrapRecovery("cadenza_db_unreachable");
|
|
4933
4968
|
return true;
|
|
4934
4969
|
},
|
|
@@ -7610,6 +7645,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
7610
7645
|
this.clearAuthorityBootstrapHandshakeRetryTimer();
|
|
7611
7646
|
this.authorityBootstrapHandshakeRetryIndex = AUTHORITY_BOOTSTRAP_HANDSHAKE_RETRY_DELAYS_MS.length;
|
|
7612
7647
|
this.authorityBootstrapHandshakeRetryReason = null;
|
|
7648
|
+
this.authorityBootstrapRecoveryActive = false;
|
|
7613
7649
|
}
|
|
7614
7650
|
buildJitteredAuthorityBootstrapHandshakeRetryDelayMs(baseDelayMs, attempt) {
|
|
7615
7651
|
return buildDeterministicJitteredDelayMs(
|
|
@@ -7666,6 +7702,13 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
7666
7702
|
return this.scheduleAuthorityBootstrapHandshakeRetry(reason);
|
|
7667
7703
|
}
|
|
7668
7704
|
restartAuthorityBootstrapRecovery(reason) {
|
|
7705
|
+
if (this.authorityBootstrapRecoveryActive) {
|
|
7706
|
+
if (typeof reason === "string" && reason.trim()) {
|
|
7707
|
+
this.authorityBootstrapHandshakeRetryReason = reason.trim();
|
|
7708
|
+
}
|
|
7709
|
+
return false;
|
|
7710
|
+
}
|
|
7711
|
+
this.authorityBootstrapRecoveryActive = true;
|
|
7669
7712
|
this.invalidateAuthorityBootstrapHandshake();
|
|
7670
7713
|
this.invalidateBootstrapFullSyncRetryState(reason);
|
|
7671
7714
|
return this.restartAuthorityBootstrapHandshakeRetryChain(reason);
|