@naylence/runtime 0.3.14 → 0.3.16
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.cjs +1160 -977
- package/dist/browser/index.mjs +1157 -979
- package/dist/cjs/browser.js +15 -0
- package/dist/cjs/naylence/fame/factory-manifest.js +2 -0
- package/dist/cjs/naylence/fame/node/connection-retry-policy-factory.js +22 -0
- package/dist/cjs/naylence/fame/node/connection-retry-policy.js +2 -0
- package/dist/cjs/naylence/fame/node/default-connection-retry-policy-factory.js +36 -0
- package/dist/cjs/naylence/fame/node/default-connection-retry-policy.js +51 -0
- package/dist/cjs/naylence/fame/node/factory-commons.js +15 -0
- package/dist/cjs/naylence/fame/node/index.js +6 -1
- package/dist/cjs/naylence/fame/node/node-config.js +4 -0
- package/dist/cjs/naylence/fame/node/node-factory.js +1 -0
- package/dist/cjs/naylence/fame/node/node.js +3 -0
- package/dist/cjs/naylence/fame/node/upstream-session-manager.js +63 -23
- package/dist/cjs/naylence/fame/sentinel/sentinel.js +2 -0
- package/dist/cjs/node.js +12 -1
- package/dist/cjs/version.js +2 -2
- package/dist/esm/browser.js +15 -0
- package/dist/esm/naylence/fame/factory-manifest.js +2 -0
- package/dist/esm/naylence/fame/node/connection-retry-policy-factory.js +18 -0
- package/dist/esm/naylence/fame/node/connection-retry-policy.js +1 -0
- package/dist/esm/naylence/fame/node/default-connection-retry-policy-factory.js +32 -0
- package/dist/esm/naylence/fame/node/default-connection-retry-policy.js +47 -0
- package/dist/esm/naylence/fame/node/factory-commons.js +15 -0
- package/dist/esm/naylence/fame/node/index.js +4 -0
- package/dist/esm/naylence/fame/node/node-config.js +4 -0
- package/dist/esm/naylence/fame/node/node-factory.js +1 -0
- package/dist/esm/naylence/fame/node/node.js +3 -0
- package/dist/esm/naylence/fame/node/upstream-session-manager.js +63 -23
- package/dist/esm/naylence/fame/sentinel/sentinel.js +2 -0
- package/dist/esm/node.js +12 -1
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +615 -442
- package/dist/node/index.mjs +611 -443
- package/dist/node/node.cjs +1191 -1008
- package/dist/node/node.mjs +1188 -1010
- package/dist/types/naylence/fame/factory-manifest.d.ts +1 -1
- package/dist/types/naylence/fame/node/connection-retry-policy-factory.d.ts +20 -0
- package/dist/types/naylence/fame/node/connection-retry-policy.d.ts +44 -0
- package/dist/types/naylence/fame/node/default-connection-retry-policy-factory.d.ts +15 -0
- package/dist/types/naylence/fame/node/default-connection-retry-policy.d.ts +36 -0
- package/dist/types/naylence/fame/node/factory-commons.d.ts +2 -0
- package/dist/types/naylence/fame/node/index.d.ts +4 -0
- package/dist/types/naylence/fame/node/node-config.d.ts +2 -0
- package/dist/types/naylence/fame/node/node.d.ts +3 -0
- package/dist/types/naylence/fame/node/upstream-session-manager.d.ts +13 -0
- package/dist/types/naylence/fame/sentinel/sentinel.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -13,12 +13,12 @@ import fastify from 'fastify';
|
|
|
13
13
|
import websocketPlugin from '@fastify/websocket';
|
|
14
14
|
|
|
15
15
|
// This file is auto-generated during build - do not edit manually
|
|
16
|
-
// Generated from package.json version: 0.3.
|
|
16
|
+
// Generated from package.json version: 0.3.16
|
|
17
17
|
/**
|
|
18
18
|
* The package version, injected at build time.
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
const VERSION = '0.3.
|
|
21
|
+
const VERSION = '0.3.16';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -836,7 +836,7 @@ class TaskCancelledError extends Error {
|
|
|
836
836
|
* Provides functionality similar to Python's asyncio TaskSpawner with proper
|
|
837
837
|
* error handling, cancellation, and graceful shutdown capabilities.
|
|
838
838
|
*/
|
|
839
|
-
const logger$
|
|
839
|
+
const logger$1h = getLogger('naylence.fame.util.task_spawner');
|
|
840
840
|
function firstDefined(source, keys) {
|
|
841
841
|
for (const key of keys) {
|
|
842
842
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
@@ -997,7 +997,7 @@ class TaskSpawner {
|
|
|
997
997
|
const taskId = `task-${++this._taskCounter}`;
|
|
998
998
|
const taskName = normalizedOptions.name || `unnamed-${taskId}`;
|
|
999
999
|
const timeout = normalizedOptions.timeout ?? this._config.defaultTimeout;
|
|
1000
|
-
logger$
|
|
1000
|
+
logger$1h.debug('starting_background_task', {
|
|
1001
1001
|
task_name: taskName,
|
|
1002
1002
|
task_id: taskId,
|
|
1003
1003
|
});
|
|
@@ -1014,7 +1014,7 @@ class TaskSpawner {
|
|
|
1014
1014
|
task.promise
|
|
1015
1015
|
.then(() => {
|
|
1016
1016
|
if (!this._suppressCompletionLogging) {
|
|
1017
|
-
logger$
|
|
1017
|
+
logger$1h.debug('task_completed_successfully', {
|
|
1018
1018
|
task_name: taskName,
|
|
1019
1019
|
task_id: taskId,
|
|
1020
1020
|
duration_ms: Date.now() - task.startTime,
|
|
@@ -1068,7 +1068,7 @@ class TaskSpawner {
|
|
|
1068
1068
|
error.name === 'AbortError' ||
|
|
1069
1069
|
error.message === 'Task cancelled' ||
|
|
1070
1070
|
error.message === 'Aborted') {
|
|
1071
|
-
logger$
|
|
1071
|
+
logger$1h.debug('task_cancelled', {
|
|
1072
1072
|
task_name: taskName,
|
|
1073
1073
|
note: 'Task cancelled as requested',
|
|
1074
1074
|
});
|
|
@@ -1076,7 +1076,7 @@ class TaskSpawner {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
// Handle timeout
|
|
1078
1078
|
if (error instanceof TaskTimeoutError) {
|
|
1079
|
-
logger$
|
|
1079
|
+
logger$1h.warning('task_timed_out', {
|
|
1080
1080
|
task_name: taskName,
|
|
1081
1081
|
error: error.message,
|
|
1082
1082
|
});
|
|
@@ -1088,7 +1088,7 @@ class TaskSpawner {
|
|
|
1088
1088
|
// Handle known WebSocket shutdown race condition (similar to Python version)
|
|
1089
1089
|
if (error.message.includes("await wasn't used with future") ||
|
|
1090
1090
|
error.message.includes('WebSocket closed during receive')) {
|
|
1091
|
-
logger$
|
|
1091
|
+
logger$1h.debug('task_shutdown_race_condition_handled', {
|
|
1092
1092
|
task_name: taskName,
|
|
1093
1093
|
note: 'Normal WebSocket close timing during shutdown - not an error',
|
|
1094
1094
|
});
|
|
@@ -1098,7 +1098,7 @@ class TaskSpawner {
|
|
|
1098
1098
|
if (error.name === 'FameTransportClose' ||
|
|
1099
1099
|
error.message.includes('normal closure') ||
|
|
1100
1100
|
error.message.includes('Connection closed')) {
|
|
1101
|
-
logger$
|
|
1101
|
+
logger$1h.debug('task_shutdown_completed_normally', {
|
|
1102
1102
|
task_name: taskName,
|
|
1103
1103
|
note: 'Task closed normally during shutdown',
|
|
1104
1104
|
});
|
|
@@ -1106,7 +1106,7 @@ class TaskSpawner {
|
|
|
1106
1106
|
}
|
|
1107
1107
|
// Handle PKCE redirect "errors" as info
|
|
1108
1108
|
if (error.name === 'OAuth2PkceRedirectInitiatedError') {
|
|
1109
|
-
logger$
|
|
1109
|
+
logger$1h.debug('background_task_redirecting', {
|
|
1110
1110
|
task_name: taskName,
|
|
1111
1111
|
note: 'Task interrupted for PKCE redirect',
|
|
1112
1112
|
});
|
|
@@ -1119,14 +1119,14 @@ class TaskSpawner {
|
|
|
1119
1119
|
// Log retriable errors as warnings (they'll be retried by upstream logic)
|
|
1120
1120
|
// Log non-retriable errors as errors (fatal failures)
|
|
1121
1121
|
if (isRetriableError) {
|
|
1122
|
-
logger$
|
|
1122
|
+
logger$1h.warning('background_task_failed', {
|
|
1123
1123
|
task_name: taskName,
|
|
1124
1124
|
error: error.message,
|
|
1125
1125
|
retriable: true,
|
|
1126
1126
|
});
|
|
1127
1127
|
}
|
|
1128
1128
|
else {
|
|
1129
|
-
logger$
|
|
1129
|
+
logger$1h.error('background_task_failed', {
|
|
1130
1130
|
task_name: taskName,
|
|
1131
1131
|
error: error.message,
|
|
1132
1132
|
stack: error.stack,
|
|
@@ -1145,11 +1145,11 @@ class TaskSpawner {
|
|
|
1145
1145
|
async shutdownTasks(options = {}) {
|
|
1146
1146
|
const { gracePeriod, cancelHanging, joinTimeout } = normalizeShutdownOptions(options);
|
|
1147
1147
|
if (this._tasks.size === 0) {
|
|
1148
|
-
logger$
|
|
1148
|
+
logger$1h.debug('shutdown_tasks_no_tasks_to_shutdown');
|
|
1149
1149
|
return;
|
|
1150
1150
|
}
|
|
1151
1151
|
this._suppressCompletionLogging = true;
|
|
1152
|
-
logger$
|
|
1152
|
+
logger$1h.debug('shutting_down_tasks', {
|
|
1153
1153
|
task_count: this._tasks.size,
|
|
1154
1154
|
task_names: Array.from(this._tasks.values()).map((t) => t.name),
|
|
1155
1155
|
grace_period_ms: gracePeriod,
|
|
@@ -1164,7 +1164,7 @@ class TaskSpawner {
|
|
|
1164
1164
|
if (cancelHanging) {
|
|
1165
1165
|
const stillRunning = tasks.filter((task) => task.getState() === TaskState.RUNNING && !completed.has(task));
|
|
1166
1166
|
if (stillRunning.length > 0) {
|
|
1167
|
-
logger$
|
|
1167
|
+
logger$1h.debug('tasks_did_not_complete_within_grace_period', {
|
|
1168
1168
|
hanging_count: stillRunning.length,
|
|
1169
1169
|
});
|
|
1170
1170
|
// Wait for them to finish with individual timeouts
|
|
@@ -1174,7 +1174,7 @@ class TaskSpawner {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
catch (error) {
|
|
1176
1176
|
if (error instanceof TaskTimeoutError) {
|
|
1177
|
-
logger$
|
|
1177
|
+
logger$1h.warning('task_did_not_shutdown', {
|
|
1178
1178
|
task_name: task.name || task.id,
|
|
1179
1179
|
join_timeout_ms: joinTimeout,
|
|
1180
1180
|
});
|
|
@@ -1185,7 +1185,7 @@ class TaskSpawner {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
else if (!(error instanceof TaskCancelledError)) {
|
|
1187
1187
|
/* istanbul ignore next - unreachable defensive branch */
|
|
1188
|
-
logger$
|
|
1188
|
+
logger$1h.error('task_raised_during_cancellation', {
|
|
1189
1189
|
task_name: task.name || task.id,
|
|
1190
1190
|
error: error instanceof Error ? error.message : String(error),
|
|
1191
1191
|
});
|
|
@@ -2322,7 +2322,7 @@ async function safeImport(loader, dependencyNameOrOptions, maybeOptions) {
|
|
|
2322
2322
|
* condition/promise and ensure at most one notifier coroutine exists for a
|
|
2323
2323
|
* flow at any time.
|
|
2324
2324
|
*/
|
|
2325
|
-
const logger$
|
|
2325
|
+
const logger$1g = getLogger('naylence.fame.flow.flow_controller');
|
|
2326
2326
|
/**
|
|
2327
2327
|
* Simple condition variable implementation for TypeScript/Node.js
|
|
2328
2328
|
* Similar to Python's asyncio.Condition
|
|
@@ -2456,7 +2456,7 @@ class FlowController {
|
|
|
2456
2456
|
const newBalance = Math.max(0, Math.min(this.initialWindow, prev + delta));
|
|
2457
2457
|
this.credits.set(flowId, newBalance);
|
|
2458
2458
|
const crossedZero = prev <= 0 && newBalance > 0;
|
|
2459
|
-
logger$
|
|
2459
|
+
logger$1g.debug('flow_controller_add_credits', {
|
|
2460
2460
|
flow_id: flowId,
|
|
2461
2461
|
delta,
|
|
2462
2462
|
prev_balance: prev,
|
|
@@ -2476,12 +2476,12 @@ class FlowController {
|
|
|
2476
2476
|
async acquire(flowId) {
|
|
2477
2477
|
this.ensureFlow(flowId);
|
|
2478
2478
|
const condition = this.conditions.get(flowId);
|
|
2479
|
-
logger$
|
|
2479
|
+
logger$1g.debug('flow_controller_acquire_attempt', {
|
|
2480
2480
|
flow_id: flowId,
|
|
2481
2481
|
current_balance: this.credits.get(flowId),
|
|
2482
2482
|
});
|
|
2483
2483
|
while (this.credits.get(flowId) <= 0) {
|
|
2484
|
-
logger$
|
|
2484
|
+
logger$1g.debug('flow_controller_waiting_for_credits', {
|
|
2485
2485
|
flow_id: flowId,
|
|
2486
2486
|
current_balance: this.credits.get(flowId),
|
|
2487
2487
|
});
|
|
@@ -2489,12 +2489,12 @@ class FlowController {
|
|
|
2489
2489
|
}
|
|
2490
2490
|
const newBalance = this.credits.get(flowId) - 1;
|
|
2491
2491
|
this.credits.set(flowId, newBalance);
|
|
2492
|
-
logger$
|
|
2492
|
+
logger$1g.debug('flow_controller_acquire_success', {
|
|
2493
2493
|
flow_id: flowId,
|
|
2494
2494
|
new_balance: newBalance,
|
|
2495
2495
|
});
|
|
2496
2496
|
if (newBalance <= this.lowWatermark) {
|
|
2497
|
-
logger$
|
|
2497
|
+
logger$1g.debug('flow_controller_acquire_below_low_watermark', {
|
|
2498
2498
|
flow_id: flowId,
|
|
2499
2499
|
low_watermark: this.lowWatermark,
|
|
2500
2500
|
});
|
|
@@ -2518,7 +2518,7 @@ class FlowController {
|
|
|
2518
2518
|
const current = this.credits.get(flowId);
|
|
2519
2519
|
const remaining = Math.max(current - credits, 0);
|
|
2520
2520
|
this.credits.set(flowId, remaining);
|
|
2521
|
-
logger$
|
|
2521
|
+
logger$1g.debug('flow_controller_consume', {
|
|
2522
2522
|
flow_id: flowId,
|
|
2523
2523
|
requested: credits,
|
|
2524
2524
|
prev_balance: current,
|
|
@@ -2544,7 +2544,7 @@ class FlowController {
|
|
|
2544
2544
|
this.windowIds.delete(flowId);
|
|
2545
2545
|
this.credits.set(flowId, this.initialWindow);
|
|
2546
2546
|
this.wakeWaiters(flowId);
|
|
2547
|
-
logger$
|
|
2547
|
+
logger$1g.debug('flow_controller_flow_reset', {
|
|
2548
2548
|
flow_id: flowId,
|
|
2549
2549
|
reset_balance: this.initialWindow,
|
|
2550
2550
|
});
|
|
@@ -2832,7 +2832,7 @@ class InMemoryBinding {
|
|
|
2832
2832
|
* TypeScript port of Python's InMemoryFanoutBroker that extends TaskSpawner
|
|
2833
2833
|
* to manage multiple WriteChannel subscribers with concurrent message distribution.
|
|
2834
2834
|
*/
|
|
2835
|
-
const logger$
|
|
2835
|
+
const logger$1f = getLogger('naylence.fame.channel.in_memory.in_memory_fanout_broker');
|
|
2836
2836
|
// Sentinel object for shutdown signaling
|
|
2837
2837
|
const SENTINEL = Symbol('fanout-broker-sentinel');
|
|
2838
2838
|
function isCloseable(obj) {
|
|
@@ -2885,7 +2885,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
2885
2885
|
}
|
|
2886
2886
|
catch (error) {
|
|
2887
2887
|
// Ignore errors when sending sentinel (sink might be closed)
|
|
2888
|
-
logger$
|
|
2888
|
+
logger$1f.debug('error_sending_sentinel', {
|
|
2889
2889
|
error: error.message,
|
|
2890
2890
|
});
|
|
2891
2891
|
}
|
|
@@ -2899,7 +2899,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
2899
2899
|
await sub.close();
|
|
2900
2900
|
}
|
|
2901
2901
|
catch (error) {
|
|
2902
|
-
logger$
|
|
2902
|
+
logger$1f.error('error_closing_subscriber', {
|
|
2903
2903
|
subscriber: sub.toString(),
|
|
2904
2904
|
error: error.message,
|
|
2905
2905
|
});
|
|
@@ -2939,7 +2939,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
2939
2939
|
[envelope, context] = extractEnvelopeAndContext(msg);
|
|
2940
2940
|
}
|
|
2941
2941
|
catch (error) {
|
|
2942
|
-
logger$
|
|
2942
|
+
logger$1f.debug('failed_to_extract_envelope', {
|
|
2943
2943
|
error: error.message,
|
|
2944
2944
|
});
|
|
2945
2945
|
continue;
|
|
@@ -2961,7 +2961,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
2961
2961
|
await sub.send(messageToSend);
|
|
2962
2962
|
}
|
|
2963
2963
|
catch (error) {
|
|
2964
|
-
logger$
|
|
2964
|
+
logger$1f.error('error_sending_to_subscriber', {
|
|
2965
2965
|
subscriber: sub.toString(),
|
|
2966
2966
|
error: error.message,
|
|
2967
2967
|
action: 'unsubscribing',
|
|
@@ -2977,7 +2977,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
2977
2977
|
}
|
|
2978
2978
|
catch (error) {
|
|
2979
2979
|
// Critical broker-level error: log and back off, but keep the loop running
|
|
2980
|
-
logger$
|
|
2980
|
+
logger$1f.critical('receive_loop_failed_unexpectedly', {
|
|
2981
2981
|
error: error.message,
|
|
2982
2982
|
stack: error.stack,
|
|
2983
2983
|
});
|
|
@@ -3195,7 +3195,7 @@ class EnvCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
3195
3195
|
return new EnvCredentialProvider(resolved.varName);
|
|
3196
3196
|
}
|
|
3197
3197
|
}
|
|
3198
|
-
const FACTORY_META$
|
|
3198
|
+
const FACTORY_META$1c = {
|
|
3199
3199
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
3200
3200
|
key: 'EnvCredentialProvider',
|
|
3201
3201
|
};
|
|
@@ -3203,7 +3203,7 @@ const FACTORY_META$1b = {
|
|
|
3203
3203
|
var envCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
3204
3204
|
__proto__: null,
|
|
3205
3205
|
EnvCredentialProviderFactory: EnvCredentialProviderFactory,
|
|
3206
|
-
FACTORY_META: FACTORY_META$
|
|
3206
|
+
FACTORY_META: FACTORY_META$1c,
|
|
3207
3207
|
default: EnvCredentialProviderFactory,
|
|
3208
3208
|
normalizeEnvConfig: normalizeEnvConfig
|
|
3209
3209
|
});
|
|
@@ -3301,14 +3301,14 @@ class PromptCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
3301
3301
|
return new PromptCredentialProvider(resolved.credentialName);
|
|
3302
3302
|
}
|
|
3303
3303
|
}
|
|
3304
|
-
const FACTORY_META$
|
|
3304
|
+
const FACTORY_META$1b = {
|
|
3305
3305
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
3306
3306
|
key: 'PromptCredentialProvider',
|
|
3307
3307
|
};
|
|
3308
3308
|
|
|
3309
3309
|
var promptCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
3310
3310
|
__proto__: null,
|
|
3311
|
-
FACTORY_META: FACTORY_META$
|
|
3311
|
+
FACTORY_META: FACTORY_META$1b,
|
|
3312
3312
|
PromptCredentialProviderFactory: PromptCredentialProviderFactory,
|
|
3313
3313
|
default: PromptCredentialProviderFactory,
|
|
3314
3314
|
normalizePromptConfig: normalizePromptConfig
|
|
@@ -3362,14 +3362,14 @@ class SecretStoreCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
3362
3362
|
return new SecretStoreCredentialProvider(resolved.secretName);
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
3365
|
-
const FACTORY_META$
|
|
3365
|
+
const FACTORY_META$1a = {
|
|
3366
3366
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
3367
3367
|
key: 'SecretStoreCredentialProvider',
|
|
3368
3368
|
};
|
|
3369
3369
|
|
|
3370
3370
|
var secretStoreCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
3371
3371
|
__proto__: null,
|
|
3372
|
-
FACTORY_META: FACTORY_META$
|
|
3372
|
+
FACTORY_META: FACTORY_META$1a,
|
|
3373
3373
|
SecretStoreCredentialProviderFactory: SecretStoreCredentialProviderFactory,
|
|
3374
3374
|
default: SecretStoreCredentialProviderFactory,
|
|
3375
3375
|
normalizeSecretStoreConfig: normalizeSecretStoreConfig
|
|
@@ -3418,14 +3418,14 @@ class StaticCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
3418
3418
|
return new StaticCredentialProvider(resolved.credentialValue);
|
|
3419
3419
|
}
|
|
3420
3420
|
}
|
|
3421
|
-
const FACTORY_META$
|
|
3421
|
+
const FACTORY_META$19 = {
|
|
3422
3422
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
3423
3423
|
key: 'StaticCredentialProvider',
|
|
3424
3424
|
};
|
|
3425
3425
|
|
|
3426
3426
|
var staticCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
3427
3427
|
__proto__: null,
|
|
3428
|
-
FACTORY_META: FACTORY_META$
|
|
3428
|
+
FACTORY_META: FACTORY_META$19,
|
|
3429
3429
|
StaticCredentialProviderFactory: StaticCredentialProviderFactory,
|
|
3430
3430
|
default: StaticCredentialProviderFactory,
|
|
3431
3431
|
normalizeStaticConfig: normalizeStaticConfig
|
|
@@ -4653,7 +4653,7 @@ function normalizeResponseType(value) {
|
|
|
4653
4653
|
return value;
|
|
4654
4654
|
}
|
|
4655
4655
|
|
|
4656
|
-
const logger$
|
|
4656
|
+
const logger$1e = getLogger('naylence.fame.node.binding_manager');
|
|
4657
4657
|
const SYSTEM_INBOX$3 = '__sys__';
|
|
4658
4658
|
const DEFAULT_ACK_TIMEOUT_MS = 20000;
|
|
4659
4659
|
class BindingStoreEntryRecord {
|
|
@@ -4739,7 +4739,7 @@ class BindingManager {
|
|
|
4739
4739
|
if (!this.bindings.has(key)) {
|
|
4740
4740
|
const binding = this.bindingFactory(new FameAddress(key));
|
|
4741
4741
|
this.bindings.set(key, binding);
|
|
4742
|
-
logger$
|
|
4742
|
+
logger$1e.debug('restored_binding', { address: key });
|
|
4743
4743
|
}
|
|
4744
4744
|
}
|
|
4745
4745
|
if (!this.hasUpstream) {
|
|
@@ -4749,13 +4749,13 @@ class BindingManager {
|
|
|
4749
4749
|
await this.readvertiseCapabilitiesUpstream();
|
|
4750
4750
|
}
|
|
4751
4751
|
async bind(participant, capabilities) {
|
|
4752
|
-
logger$
|
|
4752
|
+
logger$1e.debug('binding_participant', { participant });
|
|
4753
4753
|
const { prefixAddress, addresses, propagateAddress, capabilityAddress } = this.computeBindingAddresses(participant);
|
|
4754
4754
|
for (const address of addresses) {
|
|
4755
4755
|
if (!this.bindings.has(address)) {
|
|
4756
4756
|
const binding = this.bindingFactory(new FameAddress(address));
|
|
4757
4757
|
this.bindings.set(address, binding);
|
|
4758
|
-
logger$
|
|
4758
|
+
logger$1e.debug('bound_address', { address, participant });
|
|
4759
4759
|
}
|
|
4760
4760
|
}
|
|
4761
4761
|
let propagatedAddress = null;
|
|
@@ -4784,7 +4784,7 @@ class BindingManager {
|
|
|
4784
4784
|
await this.unbindAddressUpstream(propagatedAddress);
|
|
4785
4785
|
}
|
|
4786
4786
|
catch (rollbackError) {
|
|
4787
|
-
logger$
|
|
4787
|
+
logger$1e.error('bind_rollback_failed', {
|
|
4788
4788
|
address: propagatedAddress.toString(),
|
|
4789
4789
|
error: rollbackError.message,
|
|
4790
4790
|
});
|
|
@@ -4803,7 +4803,7 @@ class BindingManager {
|
|
|
4803
4803
|
physicalPath: null,
|
|
4804
4804
|
});
|
|
4805
4805
|
}
|
|
4806
|
-
logger$
|
|
4806
|
+
logger$1e.debug('bind_success', {
|
|
4807
4807
|
participant,
|
|
4808
4808
|
address: prefixAddress.toString(),
|
|
4809
4809
|
capabilities,
|
|
@@ -4839,7 +4839,7 @@ class BindingManager {
|
|
|
4839
4839
|
await this.bindingStore.delete(address);
|
|
4840
4840
|
}
|
|
4841
4841
|
}
|
|
4842
|
-
logger$
|
|
4842
|
+
logger$1e.debug('unbind_success', {
|
|
4843
4843
|
participant,
|
|
4844
4844
|
address: prefixAddress.toString(),
|
|
4845
4845
|
totalBindings: this.bindings.size,
|
|
@@ -4869,7 +4869,7 @@ class BindingManager {
|
|
|
4869
4869
|
await this.bindAddressUpstream(new FameAddress(address));
|
|
4870
4870
|
}
|
|
4871
4871
|
catch (error) {
|
|
4872
|
-
logger$
|
|
4872
|
+
logger$1e.error('rebind_failed', {
|
|
4873
4873
|
address,
|
|
4874
4874
|
error: error.message,
|
|
4875
4875
|
});
|
|
@@ -4888,7 +4888,7 @@ class BindingManager {
|
|
|
4888
4888
|
await this.advertiseCapabilities(new FameAddress(address), Array.from(capabilities));
|
|
4889
4889
|
}
|
|
4890
4890
|
catch (error) {
|
|
4891
|
-
logger$
|
|
4891
|
+
logger$1e.error('capability_replay_failed', {
|
|
4892
4892
|
address,
|
|
4893
4893
|
error: error.message,
|
|
4894
4894
|
});
|
|
@@ -5155,7 +5155,7 @@ class BindingManager {
|
|
|
5155
5155
|
}
|
|
5156
5156
|
}
|
|
5157
5157
|
|
|
5158
|
-
const logger$
|
|
5158
|
+
const logger$1d = getLogger('naylence.fame.node.response_context_manager');
|
|
5159
5159
|
function cloneSecurityContext(source) {
|
|
5160
5160
|
if (!source) {
|
|
5161
5161
|
return undefined;
|
|
@@ -5183,7 +5183,7 @@ class ResponseContextManager {
|
|
|
5183
5183
|
security: responseSecurity,
|
|
5184
5184
|
expectedResponseType: FameResponseType.NONE,
|
|
5185
5185
|
};
|
|
5186
|
-
logger$
|
|
5186
|
+
logger$1d.debug('created_response_context', {
|
|
5187
5187
|
request_id: requestEnvelope.id,
|
|
5188
5188
|
inherited_crypto_level: responseSecurity?.inboundCryptoLevel ?? null,
|
|
5189
5189
|
channel_id: responseSecurity?.cryptoChannelId ?? null,
|
|
@@ -5203,14 +5203,14 @@ class ResponseContextManager {
|
|
|
5203
5203
|
responseContext.fromSystemId = this.getId();
|
|
5204
5204
|
}
|
|
5205
5205
|
// Envelope-level metadata is intentionally omitted to defer to context usage.
|
|
5206
|
-
logger$
|
|
5206
|
+
logger$1d.debug('ensured_response_metadata', {
|
|
5207
5207
|
response_id: responseEnvelope.id,
|
|
5208
5208
|
request_id: requestEnvelope.id,
|
|
5209
5209
|
});
|
|
5210
5210
|
}
|
|
5211
5211
|
}
|
|
5212
5212
|
|
|
5213
|
-
const logger$
|
|
5213
|
+
const logger$1c = getLogger('naylence.fame.node.streaming_response_handler');
|
|
5214
5214
|
function isObject(value) {
|
|
5215
5215
|
return typeof value === 'object' && value !== null;
|
|
5216
5216
|
}
|
|
@@ -5329,12 +5329,12 @@ class StreamingResponseHandler {
|
|
|
5329
5329
|
}
|
|
5330
5330
|
async handleStreamingFameMessageResponses(responses, requestEnvelope, requestContext) {
|
|
5331
5331
|
const asyncResponses = toAsyncIterable(responses);
|
|
5332
|
-
logger$
|
|
5332
|
+
logger$1c.debug('handling_streaming_fame_message_responses', {
|
|
5333
5333
|
request_id: requestEnvelope.id,
|
|
5334
5334
|
});
|
|
5335
5335
|
for await (const response of asyncResponses) {
|
|
5336
5336
|
if (!response?.envelope) {
|
|
5337
|
-
logger$
|
|
5337
|
+
logger$1c.warning('invalid_streaming_response_type', {
|
|
5338
5338
|
request_id: requestEnvelope.id,
|
|
5339
5339
|
actual_type: typeof response,
|
|
5340
5340
|
});
|
|
@@ -5348,7 +5348,7 @@ class StreamingResponseHandler {
|
|
|
5348
5348
|
}
|
|
5349
5349
|
async handleStreamingResponse(result, requestEnvelope, requestContext, replyTo, requestId) {
|
|
5350
5350
|
const iterable = toAsyncIterable(result);
|
|
5351
|
-
logger$
|
|
5351
|
+
logger$1c.debug('handling_streaming_response', {
|
|
5352
5352
|
request_id: requestId,
|
|
5353
5353
|
reply_to: replyTo,
|
|
5354
5354
|
});
|
|
@@ -5359,7 +5359,7 @@ class StreamingResponseHandler {
|
|
|
5359
5359
|
await this.sendRpcResponse(null, requestEnvelope, requestContext, replyTo, requestId);
|
|
5360
5360
|
}
|
|
5361
5361
|
catch (error) {
|
|
5362
|
-
logger$
|
|
5362
|
+
logger$1c.error('streaming_response_handler_error', {
|
|
5363
5363
|
request_id: requestId,
|
|
5364
5364
|
error: error instanceof Error ? error.message : String(error),
|
|
5365
5365
|
});
|
|
@@ -5386,7 +5386,7 @@ class StreamingResponseHandler {
|
|
|
5386
5386
|
});
|
|
5387
5387
|
const responseContext = this.responseContextManager.createResponseContext(requestEnvelope, requestContext);
|
|
5388
5388
|
this.responseContextManager.ensureResponseMetadata(responseEnvelope, requestEnvelope, responseContext);
|
|
5389
|
-
logger$
|
|
5389
|
+
logger$1c.debug('sending_streaming_rpc_response', {
|
|
5390
5390
|
request_id: requestId,
|
|
5391
5391
|
response_envelope_id: responseEnvelope.id,
|
|
5392
5392
|
reply_to: replyTo,
|
|
@@ -5399,7 +5399,7 @@ class StreamingResponseHandler {
|
|
|
5399
5399
|
}
|
|
5400
5400
|
}
|
|
5401
5401
|
|
|
5402
|
-
const logger$
|
|
5402
|
+
const logger$1b = getLogger('naylence.fame.node.channel_polling_manager');
|
|
5403
5403
|
class ChannelPollingManager {
|
|
5404
5404
|
constructor(deliverWrapper, responseContextManager, streamingResponseHandler) {
|
|
5405
5405
|
this.deliverWrapper = deliverWrapper;
|
|
@@ -5407,7 +5407,7 @@ class ChannelPollingManager {
|
|
|
5407
5407
|
this.streamingResponseHandler = streamingResponseHandler;
|
|
5408
5408
|
}
|
|
5409
5409
|
async startPollingLoop(serviceName, channel, handler, stopState, pollTimeoutMs = DEFAULT_POLLING_TIMEOUT_MS) {
|
|
5410
|
-
logger$
|
|
5410
|
+
logger$1b.debug('poll_loop_started', {
|
|
5411
5411
|
recipient: serviceName,
|
|
5412
5412
|
});
|
|
5413
5413
|
try {
|
|
@@ -5415,7 +5415,7 @@ class ChannelPollingManager {
|
|
|
5415
5415
|
while (true) {
|
|
5416
5416
|
if (this.isStopRequested(stopState) && !draining) {
|
|
5417
5417
|
draining = true;
|
|
5418
|
-
logger$
|
|
5418
|
+
logger$1b.debug('poll_loop_draining_pending_messages', {
|
|
5419
5419
|
recipient: serviceName,
|
|
5420
5420
|
});
|
|
5421
5421
|
}
|
|
@@ -5425,7 +5425,7 @@ class ChannelPollingManager {
|
|
|
5425
5425
|
}
|
|
5426
5426
|
catch (error) {
|
|
5427
5427
|
if (error instanceof FameTransportClose) {
|
|
5428
|
-
logger$
|
|
5428
|
+
logger$1b.debug('channel_closed', {
|
|
5429
5429
|
recipient: serviceName,
|
|
5430
5430
|
message: error.message,
|
|
5431
5431
|
});
|
|
@@ -5438,7 +5438,7 @@ class ChannelPollingManager {
|
|
|
5438
5438
|
continue;
|
|
5439
5439
|
}
|
|
5440
5440
|
if (error instanceof Error && error.name === 'AbortError') {
|
|
5441
|
-
logger$
|
|
5441
|
+
logger$1b.debug('listener_cancelled', {
|
|
5442
5442
|
recipient: serviceName,
|
|
5443
5443
|
});
|
|
5444
5444
|
throw error;
|
|
@@ -5450,13 +5450,13 @@ class ChannelPollingManager {
|
|
|
5450
5450
|
continue;
|
|
5451
5451
|
}
|
|
5452
5452
|
if (error instanceof Error && error.message === 'Channel is closed') {
|
|
5453
|
-
logger$
|
|
5453
|
+
logger$1b.debug('channel_closed', {
|
|
5454
5454
|
recipient: serviceName,
|
|
5455
5455
|
});
|
|
5456
5456
|
break;
|
|
5457
5457
|
}
|
|
5458
5458
|
if (error instanceof Error && error.name === 'TaskCancelledError') {
|
|
5459
|
-
logger$
|
|
5459
|
+
logger$1b.debug('listener_cancelled', {
|
|
5460
5460
|
recipient: serviceName,
|
|
5461
5461
|
});
|
|
5462
5462
|
throw error;
|
|
@@ -5468,12 +5468,12 @@ class ChannelPollingManager {
|
|
|
5468
5468
|
continue;
|
|
5469
5469
|
}
|
|
5470
5470
|
if (error instanceof Error && error.message.includes('closed')) {
|
|
5471
|
-
logger$
|
|
5471
|
+
logger$1b.debug('channel_closed', {
|
|
5472
5472
|
recipient: serviceName,
|
|
5473
5473
|
});
|
|
5474
5474
|
break;
|
|
5475
5475
|
}
|
|
5476
|
-
logger$
|
|
5476
|
+
logger$1b.error('transport_error', {
|
|
5477
5477
|
recipient: serviceName,
|
|
5478
5478
|
error: error instanceof Error ? error.message : String(error),
|
|
5479
5479
|
});
|
|
@@ -5489,7 +5489,7 @@ class ChannelPollingManager {
|
|
|
5489
5489
|
}
|
|
5490
5490
|
}
|
|
5491
5491
|
finally {
|
|
5492
|
-
logger$
|
|
5492
|
+
logger$1b.debug('poll_loop_exiting', {
|
|
5493
5493
|
recipient: serviceName,
|
|
5494
5494
|
});
|
|
5495
5495
|
}
|
|
@@ -5502,7 +5502,7 @@ class ChannelPollingManager {
|
|
|
5502
5502
|
await this.processHandlerResult(result, envelope, deliveryContext, serviceName);
|
|
5503
5503
|
}
|
|
5504
5504
|
catch (error) {
|
|
5505
|
-
logger$
|
|
5505
|
+
logger$1b.error('handler_crashed', {
|
|
5506
5506
|
recipient: serviceName,
|
|
5507
5507
|
error: error instanceof Error ? error.message : String(error),
|
|
5508
5508
|
});
|
|
@@ -5516,7 +5516,7 @@ class ChannelPollingManager {
|
|
|
5516
5516
|
return;
|
|
5517
5517
|
}
|
|
5518
5518
|
if (this.streamingResponseHandler.isStreamingFameMessageResponse(result)) {
|
|
5519
|
-
logger$
|
|
5519
|
+
logger$1b.debug('handling_streaming_fame_message_responses', {
|
|
5520
5520
|
service_name: serviceName,
|
|
5521
5521
|
envelope_id: envelope.id,
|
|
5522
5522
|
});
|
|
@@ -5524,7 +5524,7 @@ class ChannelPollingManager {
|
|
|
5524
5524
|
}
|
|
5525
5525
|
}
|
|
5526
5526
|
async handleMessageResponse(response, requestEnvelope, requestContext, serviceName) {
|
|
5527
|
-
logger$
|
|
5527
|
+
logger$1b.debug('delivering_envelope_response_message', {
|
|
5528
5528
|
service_name: serviceName,
|
|
5529
5529
|
response_envelope_id: response.envelope.id,
|
|
5530
5530
|
});
|
|
@@ -5544,7 +5544,7 @@ class ChannelPollingManager {
|
|
|
5544
5544
|
}
|
|
5545
5545
|
}
|
|
5546
5546
|
|
|
5547
|
-
const logger$
|
|
5547
|
+
const logger$1a = getLogger('naylence.fame.node.rpc_server_handler');
|
|
5548
5548
|
function isPlainRecord$6(value) {
|
|
5549
5549
|
if (typeof value !== 'object' || value === null) {
|
|
5550
5550
|
return false;
|
|
@@ -5588,13 +5588,13 @@ class RPCServerHandler {
|
|
|
5588
5588
|
}
|
|
5589
5589
|
async handleRpcRequest(envelope, handlerContext, handler, serviceName) {
|
|
5590
5590
|
if (!this.isDataFrame(envelope.frame)) {
|
|
5591
|
-
logger$
|
|
5591
|
+
logger$1a.warning('rpc_request_missing_data_frame', {
|
|
5592
5592
|
service_name: serviceName,
|
|
5593
5593
|
envelope_id: envelope.id,
|
|
5594
5594
|
});
|
|
5595
5595
|
return;
|
|
5596
5596
|
}
|
|
5597
|
-
logger$
|
|
5597
|
+
logger$1a.debug('rpc_request_received', {
|
|
5598
5598
|
service_name: serviceName,
|
|
5599
5599
|
envelope_id: envelope.id,
|
|
5600
5600
|
trace_id: envelope.traceId,
|
|
@@ -5606,7 +5606,7 @@ class RPCServerHandler {
|
|
|
5606
5606
|
request = parseRequest(envelope.frame.payload);
|
|
5607
5607
|
params = cloneParams(request.params);
|
|
5608
5608
|
const paramKeys = Object.keys(params);
|
|
5609
|
-
logger$
|
|
5609
|
+
logger$1a.debug('parsed_rpc_request', {
|
|
5610
5610
|
service_name: serviceName,
|
|
5611
5611
|
method: request.method,
|
|
5612
5612
|
request_id: request.id,
|
|
@@ -5615,7 +5615,7 @@ class RPCServerHandler {
|
|
|
5615
5615
|
});
|
|
5616
5616
|
}
|
|
5617
5617
|
catch (error) {
|
|
5618
|
-
logger$
|
|
5618
|
+
logger$1a.warning('request_decode_error', {
|
|
5619
5619
|
service_name: serviceName,
|
|
5620
5620
|
envelope_id: envelope.id,
|
|
5621
5621
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -5623,7 +5623,7 @@ class RPCServerHandler {
|
|
|
5623
5623
|
return;
|
|
5624
5624
|
}
|
|
5625
5625
|
if (request.id == null) {
|
|
5626
|
-
logger$
|
|
5626
|
+
logger$1a.warning('request_missing_id', {
|
|
5627
5627
|
service_name: serviceName,
|
|
5628
5628
|
envelope_id: envelope.id,
|
|
5629
5629
|
});
|
|
@@ -5631,7 +5631,7 @@ class RPCServerHandler {
|
|
|
5631
5631
|
}
|
|
5632
5632
|
const replyTo = this.resolveReplyTo(envelope, params);
|
|
5633
5633
|
if (!replyTo) {
|
|
5634
|
-
logger$
|
|
5634
|
+
logger$1a.warning('missing_reply_to', {
|
|
5635
5635
|
service_name: serviceName,
|
|
5636
5636
|
envelope_id: envelope.id,
|
|
5637
5637
|
request_id: request.id,
|
|
@@ -5640,13 +5640,13 @@ class RPCServerHandler {
|
|
|
5640
5640
|
}
|
|
5641
5641
|
let handlerResult;
|
|
5642
5642
|
try {
|
|
5643
|
-
logger$
|
|
5643
|
+
logger$1a.debug('calling_rpc_handler', {
|
|
5644
5644
|
service_name: serviceName,
|
|
5645
5645
|
method: request.method,
|
|
5646
5646
|
request_id: request.id,
|
|
5647
5647
|
});
|
|
5648
5648
|
handlerResult = await handler(request.method, params);
|
|
5649
|
-
logger$
|
|
5649
|
+
logger$1a.debug('rpc_handler_returned', {
|
|
5650
5650
|
service_name: serviceName,
|
|
5651
5651
|
method: request.method,
|
|
5652
5652
|
request_id: request.id,
|
|
@@ -5655,7 +5655,7 @@ class RPCServerHandler {
|
|
|
5655
5655
|
});
|
|
5656
5656
|
}
|
|
5657
5657
|
catch (error) {
|
|
5658
|
-
logger$
|
|
5658
|
+
logger$1a.error('rpc_handler_error', {
|
|
5659
5659
|
service_name: serviceName,
|
|
5660
5660
|
request_id: request.id,
|
|
5661
5661
|
envelope_id: envelope.id,
|
|
@@ -5665,7 +5665,7 @@ class RPCServerHandler {
|
|
|
5665
5665
|
return this.createTraditionalResponse(response, request.id, envelope, replyTo, handlerContext, serviceName);
|
|
5666
5666
|
}
|
|
5667
5667
|
if (isFameMessageResponse(handlerResult)) {
|
|
5668
|
-
logger$
|
|
5668
|
+
logger$1a.debug('returning_response_message', {
|
|
5669
5669
|
service_name: serviceName,
|
|
5670
5670
|
request_id: request.id,
|
|
5671
5671
|
response_envelope_id: handlerResult.envelope.id,
|
|
@@ -5673,7 +5673,7 @@ class RPCServerHandler {
|
|
|
5673
5673
|
return handlerResult;
|
|
5674
5674
|
}
|
|
5675
5675
|
if (this.streamingResponseHandler.isStreamingResult(handlerResult)) {
|
|
5676
|
-
logger$
|
|
5676
|
+
logger$1a.debug('handling_streaming_response', {
|
|
5677
5677
|
service_name: serviceName,
|
|
5678
5678
|
request_id: request.id,
|
|
5679
5679
|
envelope_id: envelope.id,
|
|
@@ -5702,7 +5702,7 @@ class RPCServerHandler {
|
|
|
5702
5702
|
return null;
|
|
5703
5703
|
}
|
|
5704
5704
|
async createTraditionalResponse(payload, requestId, requestEnvelope, replyTo, handlerContext, serviceName) {
|
|
5705
|
-
logger$
|
|
5705
|
+
logger$1a.debug('creating_traditional_response_envelope', {
|
|
5706
5706
|
service_name: serviceName,
|
|
5707
5707
|
request_id: requestId,
|
|
5708
5708
|
envelope_id: requestEnvelope.id,
|
|
@@ -5726,7 +5726,7 @@ class RPCServerHandler {
|
|
|
5726
5726
|
if (requestEnvelope.id) {
|
|
5727
5727
|
responseContext.meta['response-to-id'] = requestEnvelope.id;
|
|
5728
5728
|
}
|
|
5729
|
-
logger$
|
|
5729
|
+
logger$1a.debug('returning_traditional_response', {
|
|
5730
5730
|
service_name: serviceName,
|
|
5731
5731
|
request_id: requestId,
|
|
5732
5732
|
envelope_id: requestEnvelope.id,
|
|
@@ -5791,7 +5791,7 @@ function normalizeErrorCode(code) {
|
|
|
5791
5791
|
return code;
|
|
5792
5792
|
}
|
|
5793
5793
|
|
|
5794
|
-
const logger$
|
|
5794
|
+
const logger$19 = getLogger('naylence.fame.node.rpc_client_manager');
|
|
5795
5795
|
function isPlainRecord$5(value) {
|
|
5796
5796
|
if (typeof value !== 'object' || value === null) {
|
|
5797
5797
|
return false;
|
|
@@ -6008,7 +6008,7 @@ class RPCClientManager {
|
|
|
6008
6008
|
const metaReason = tracked.meta?.['nack_reason'];
|
|
6009
6009
|
const formattedMessage = formatDeliveryErrorMessage(typeof metaCode === 'string' ? metaCode : 'DELIVERY_ERROR', reason ??
|
|
6010
6010
|
(typeof metaReason === 'string' ? metaReason : undefined));
|
|
6011
|
-
logger$
|
|
6011
|
+
logger$19.debug('pending_request_rejected_by_delivery_nack', {
|
|
6012
6012
|
envelope_id: envelopeId,
|
|
6013
6013
|
request_id: requestId,
|
|
6014
6014
|
code: typeof metaCode === 'string' ? metaCode : 'DELIVERY_ERROR',
|
|
@@ -6031,7 +6031,7 @@ class RPCClientManager {
|
|
|
6031
6031
|
this.trackerWithEvents.removeEventHandler?.(this.trackerEventHandler);
|
|
6032
6032
|
}
|
|
6033
6033
|
catch (error) {
|
|
6034
|
-
logger$
|
|
6034
|
+
logger$19.debug('rpc_tracker_handler_remove_failed', {
|
|
6035
6035
|
error: error instanceof Error ? error.message : String(error),
|
|
6036
6036
|
});
|
|
6037
6037
|
}
|
|
@@ -6074,7 +6074,7 @@ class RPCClientManager {
|
|
|
6074
6074
|
this.rpcListenerAddress = await this.listenCallback(recipient, handler);
|
|
6075
6075
|
this.rpcBound = true;
|
|
6076
6076
|
this.boundPhysicalPath = currentPhysicalPath;
|
|
6077
|
-
logger$
|
|
6077
|
+
logger$19.debug('rpc_reply_listener_bound', {
|
|
6078
6078
|
reply_recipient: recipient,
|
|
6079
6079
|
reply_address: this.rpcReplyAddress?.toString(),
|
|
6080
6080
|
listener_address: this.rpcListenerAddress?.toString(),
|
|
@@ -6168,7 +6168,7 @@ class RPCClientManager {
|
|
|
6168
6168
|
const finalizePromise = this.notifyStreamClosed(envelopeId);
|
|
6169
6169
|
if (finalizePromise) {
|
|
6170
6170
|
finalizePromise.catch((notifyError) => {
|
|
6171
|
-
logger$
|
|
6171
|
+
logger$19.debug('stream_tracker_finalize_failed', {
|
|
6172
6172
|
request_id: requestId,
|
|
6173
6173
|
envelope_id: envelopeId,
|
|
6174
6174
|
error: notifyError instanceof Error
|
|
@@ -6229,7 +6229,7 @@ class RPCClientManager {
|
|
|
6229
6229
|
return iterator;
|
|
6230
6230
|
}
|
|
6231
6231
|
async sendRpcRequest(requestId, envelope, expectedResponseType, timeoutMs) {
|
|
6232
|
-
logger$
|
|
6232
|
+
logger$19.debug('sending_rpc_request', {
|
|
6233
6233
|
envp_id: envelope.id,
|
|
6234
6234
|
corr_id: envelope.corrId,
|
|
6235
6235
|
request_id: requestId,
|
|
@@ -6245,7 +6245,7 @@ class RPCClientManager {
|
|
|
6245
6245
|
}
|
|
6246
6246
|
}
|
|
6247
6247
|
catch (error) {
|
|
6248
|
-
logger$
|
|
6248
|
+
logger$19.warning('delivery_tracker_track_failed', {
|
|
6249
6249
|
request_id: requestId,
|
|
6250
6250
|
error: error instanceof Error ? error.message : String(error),
|
|
6251
6251
|
});
|
|
@@ -6258,14 +6258,14 @@ class RPCClientManager {
|
|
|
6258
6258
|
await this.deliverWrapper()(envelope, context);
|
|
6259
6259
|
}
|
|
6260
6260
|
async handleReplyEnvelope(envelope) {
|
|
6261
|
-
logger$
|
|
6261
|
+
logger$19.debug('handle_reply_envelope_received', {
|
|
6262
6262
|
envelope_id: envelope.id,
|
|
6263
6263
|
corr_id: envelope.corrId,
|
|
6264
6264
|
frame_type: envelope.frame?.['type'],
|
|
6265
6265
|
});
|
|
6266
6266
|
let requestId = envelope.corrId ?? envelope.id;
|
|
6267
6267
|
if (!requestId) {
|
|
6268
|
-
logger$
|
|
6268
|
+
logger$19.warning('reply_envelope_missing_corr_id', {
|
|
6269
6269
|
envelope_id: envelope.id,
|
|
6270
6270
|
});
|
|
6271
6271
|
return;
|
|
@@ -6283,12 +6283,12 @@ class RPCClientManager {
|
|
|
6283
6283
|
}
|
|
6284
6284
|
}
|
|
6285
6285
|
if (!entry) {
|
|
6286
|
-
logger$
|
|
6286
|
+
logger$19.debug('no_pending_request_for_reply', {
|
|
6287
6287
|
request_id: requestId,
|
|
6288
6288
|
});
|
|
6289
6289
|
return;
|
|
6290
6290
|
}
|
|
6291
|
-
logger$
|
|
6291
|
+
logger$19.debug('handle_reply_envelope', {
|
|
6292
6292
|
envelope_id: envelope.id,
|
|
6293
6293
|
request_id: requestId,
|
|
6294
6294
|
corr_id: envelope.corrId,
|
|
@@ -6301,7 +6301,7 @@ class RPCClientManager {
|
|
|
6301
6301
|
const ackIndicatesSuccess = frame.ok === true ||
|
|
6302
6302
|
(frame.ok === undefined && !frame.code && !frame.reason);
|
|
6303
6303
|
if (ackIndicatesSuccess) {
|
|
6304
|
-
logger$
|
|
6304
|
+
logger$19.debug('pending_request_delivery_acknowledged', {
|
|
6305
6305
|
request_id: requestId,
|
|
6306
6306
|
envelope_id: envelope.id,
|
|
6307
6307
|
ref_id: frame.refId ?? null,
|
|
@@ -6329,7 +6329,7 @@ class RPCClientManager {
|
|
|
6329
6329
|
entry.timer = null;
|
|
6330
6330
|
}
|
|
6331
6331
|
if (!this.isDataFrame(envelope.frame)) {
|
|
6332
|
-
logger$
|
|
6332
|
+
logger$19.warning('unexpected_reply_frame_type', {
|
|
6333
6333
|
request_id: requestId,
|
|
6334
6334
|
frame_type: envelope.frame?.['type'],
|
|
6335
6335
|
});
|
|
@@ -6395,7 +6395,7 @@ class RPCClientManager {
|
|
|
6395
6395
|
return;
|
|
6396
6396
|
}
|
|
6397
6397
|
Promise.resolve(this.deliveryTracker.onStreamItem(envelopeId, envelope)).catch((error) => {
|
|
6398
|
-
logger$
|
|
6398
|
+
logger$19.debug('stream_tracker_push_failed', {
|
|
6399
6399
|
envelope_id: envelopeId,
|
|
6400
6400
|
error: error instanceof Error ? error.message : String(error),
|
|
6401
6401
|
});
|
|
@@ -6510,7 +6510,7 @@ function normalizeMailbox(mailbox) {
|
|
|
6510
6510
|
return mailbox;
|
|
6511
6511
|
}
|
|
6512
6512
|
|
|
6513
|
-
const logger$
|
|
6513
|
+
const logger$18 = getLogger('naylence.fame.node.envelope_listener_manager');
|
|
6514
6514
|
const SYSTEM_INBOX$2 = '__sys__';
|
|
6515
6515
|
class EnvelopeListener {
|
|
6516
6516
|
constructor(stopFn, task) {
|
|
@@ -6518,7 +6518,7 @@ class EnvelopeListener {
|
|
|
6518
6518
|
this.task = task;
|
|
6519
6519
|
}
|
|
6520
6520
|
stop() {
|
|
6521
|
-
logger$
|
|
6521
|
+
logger$18.debug('stopping_listener', {
|
|
6522
6522
|
task_name: this.task.name,
|
|
6523
6523
|
});
|
|
6524
6524
|
try {
|
|
@@ -6526,7 +6526,7 @@ class EnvelopeListener {
|
|
|
6526
6526
|
if (maybeCleanup &&
|
|
6527
6527
|
typeof maybeCleanup.then === 'function') {
|
|
6528
6528
|
void maybeCleanup.catch((error) => {
|
|
6529
|
-
logger$
|
|
6529
|
+
logger$18.debug('listener_stop_cleanup_failed', {
|
|
6530
6530
|
task_name: this.task.name,
|
|
6531
6531
|
error: error instanceof Error ? error.message : String(error),
|
|
6532
6532
|
});
|
|
@@ -6534,7 +6534,7 @@ class EnvelopeListener {
|
|
|
6534
6534
|
}
|
|
6535
6535
|
}
|
|
6536
6536
|
catch (error) {
|
|
6537
|
-
logger$
|
|
6537
|
+
logger$18.debug('listener_stop_cleanup_failed', {
|
|
6538
6538
|
task_name: this.task.name,
|
|
6539
6539
|
error: error instanceof Error ? error.message : String(error),
|
|
6540
6540
|
});
|
|
@@ -6564,7 +6564,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6564
6564
|
envelope.replyTo = formatAddress(SYSTEM_INBOX$2, this.nodeLike.physicalPath);
|
|
6565
6565
|
}
|
|
6566
6566
|
catch (error) {
|
|
6567
|
-
logger$
|
|
6567
|
+
logger$18.warning('default_reply_to_assignment_failed', {
|
|
6568
6568
|
envelope_id: envelope.id,
|
|
6569
6569
|
service_name: envelope.capabilities?.[0] ?? null,
|
|
6570
6570
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -6589,7 +6589,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6589
6589
|
if (serviceName === SYSTEM_INBOX$2) {
|
|
6590
6590
|
continue;
|
|
6591
6591
|
}
|
|
6592
|
-
logger$
|
|
6592
|
+
logger$18.debug('stopping_listener_for_service', {
|
|
6593
6593
|
service_name: serviceName,
|
|
6594
6594
|
});
|
|
6595
6595
|
entry.listener.stop();
|
|
@@ -6599,7 +6599,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6599
6599
|
catch (error) {
|
|
6600
6600
|
if (!(error instanceof Error) ||
|
|
6601
6601
|
error.name !== 'TaskCancelledError') {
|
|
6602
|
-
logger$
|
|
6602
|
+
logger$18.debug('listener_task_stopped', {
|
|
6603
6603
|
service_name: serviceName,
|
|
6604
6604
|
error: error instanceof Error ? error.message : String(error),
|
|
6605
6605
|
});
|
|
@@ -6607,7 +6607,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6607
6607
|
}
|
|
6608
6608
|
}
|
|
6609
6609
|
if (systemEntry) {
|
|
6610
|
-
logger$
|
|
6610
|
+
logger$18.debug('stopping_listener_for_service', {
|
|
6611
6611
|
service_name: SYSTEM_INBOX$2,
|
|
6612
6612
|
});
|
|
6613
6613
|
systemEntry.listener.stop();
|
|
@@ -6617,7 +6617,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6617
6617
|
catch (error) {
|
|
6618
6618
|
if (!(error instanceof Error) ||
|
|
6619
6619
|
error.name !== 'TaskCancelledError') {
|
|
6620
|
-
logger$
|
|
6620
|
+
logger$18.debug('listener_task_stopped', {
|
|
6621
6621
|
service_name: SYSTEM_INBOX$2,
|
|
6622
6622
|
error: error instanceof Error ? error.message : String(error),
|
|
6623
6623
|
});
|
|
@@ -6634,13 +6634,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6634
6634
|
}
|
|
6635
6635
|
async recoverUnhandledInboundEnvelopes() {
|
|
6636
6636
|
if (typeof this.deliveryTracker.listInbound !== 'function') {
|
|
6637
|
-
logger$
|
|
6637
|
+
logger$18.debug('delivery_tracker_missing_inbound_listing');
|
|
6638
6638
|
return;
|
|
6639
6639
|
}
|
|
6640
6640
|
const failedInbound = await this.deliveryTracker.listInbound((env) => env.status === EnvelopeStatus.RECEIVED ||
|
|
6641
6641
|
env.status === EnvelopeStatus.FAILED_TO_HANDLE);
|
|
6642
6642
|
if (!failedInbound.length) {
|
|
6643
|
-
logger$
|
|
6643
|
+
logger$18.debug('no_failed_inbound_envelopes_to_recover');
|
|
6644
6644
|
return;
|
|
6645
6645
|
}
|
|
6646
6646
|
const grouped = new Map();
|
|
@@ -6657,7 +6657,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6657
6657
|
this.pendingRecoveryEnvelopes.set(serviceName, envelopes);
|
|
6658
6658
|
}
|
|
6659
6659
|
});
|
|
6660
|
-
logger$
|
|
6660
|
+
logger$18.debug('discovered_failed_inbound_envelopes', {
|
|
6661
6661
|
total: failedInbound.length,
|
|
6662
6662
|
services: Array.from(grouped.keys()),
|
|
6663
6663
|
});
|
|
@@ -6667,7 +6667,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6667
6667
|
const pollTimeoutMs = options.pollTimeoutMs ??
|
|
6668
6668
|
options.poll_timeout_ms ??
|
|
6669
6669
|
DEFAULT_POLLING_TIMEOUT_MS;
|
|
6670
|
-
logger$
|
|
6670
|
+
logger$18.debug('listen_start', {
|
|
6671
6671
|
recipient: serviceName,
|
|
6672
6672
|
poll_timeout_ms: pollTimeoutMs ?? DEFAULT_POLLING_TIMEOUT_MS,
|
|
6673
6673
|
});
|
|
@@ -6698,7 +6698,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6698
6698
|
tracked?.mailboxType === MailboxType.OUTBOX ||
|
|
6699
6699
|
envelope.frame?.['type'] === 'DeliveryAck';
|
|
6700
6700
|
if (!shouldInvoke) {
|
|
6701
|
-
logger$
|
|
6701
|
+
logger$18.debug('skipping_listener_handler', {
|
|
6702
6702
|
recipient: serviceName,
|
|
6703
6703
|
envelope_id: envelope.id,
|
|
6704
6704
|
tracked_status: tracked?.status,
|
|
@@ -6712,13 +6712,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6712
6712
|
? undefined
|
|
6713
6713
|
: (tracked ?? undefined);
|
|
6714
6714
|
if (trackedForHandler && trackedForHandler.attempt > 0) {
|
|
6715
|
-
logger$
|
|
6715
|
+
logger$18.info('resuming_handler_retry_after_restart', {
|
|
6716
6716
|
envelope_id: envelope.id,
|
|
6717
6717
|
current_attempts: trackedForHandler.attempt,
|
|
6718
6718
|
service_name: serviceName,
|
|
6719
6719
|
});
|
|
6720
6720
|
}
|
|
6721
|
-
logger$
|
|
6721
|
+
logger$18.debug('forwarding_to_listener_handler', {
|
|
6722
6722
|
recipient: serviceName,
|
|
6723
6723
|
envelope_id: envelope.id,
|
|
6724
6724
|
frame_type: envelope.frame?.['type'],
|
|
@@ -6737,7 +6737,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6737
6737
|
await channel.send(null);
|
|
6738
6738
|
}
|
|
6739
6739
|
catch (error) {
|
|
6740
|
-
logger$
|
|
6740
|
+
logger$18.debug('listener_stop_signal_failed', {
|
|
6741
6741
|
service_name: serviceName,
|
|
6742
6742
|
error: error instanceof Error ? error.message : String(error),
|
|
6743
6743
|
});
|
|
@@ -6746,7 +6746,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6746
6746
|
await this.listenersLock.runExclusive(async () => {
|
|
6747
6747
|
const existing = this.listeners.get(serviceName);
|
|
6748
6748
|
if (existing) {
|
|
6749
|
-
logger$
|
|
6749
|
+
logger$18.debug('replacing_envelope_listener', { recipient: serviceName });
|
|
6750
6750
|
existing.listener.stop();
|
|
6751
6751
|
try {
|
|
6752
6752
|
await existing.listener.task.promise;
|
|
@@ -6764,13 +6764,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6764
6764
|
return binding.address;
|
|
6765
6765
|
}
|
|
6766
6766
|
async listenRpc(serviceName, handler, options = {}) {
|
|
6767
|
-
logger$
|
|
6767
|
+
logger$18.debug('rpc_listen_start', { service_name: serviceName });
|
|
6768
6768
|
const rpcHandler = async (envelope, context) => {
|
|
6769
6769
|
const result = await this.rpcServerHandler.handleRpcRequest(envelope, context, handler, serviceName);
|
|
6770
6770
|
return result ?? null;
|
|
6771
6771
|
};
|
|
6772
6772
|
const address = await this.listen(serviceName, rpcHandler, options);
|
|
6773
|
-
logger$
|
|
6773
|
+
logger$18.debug('rpc_listen_bound', {
|
|
6774
6774
|
service_name: serviceName,
|
|
6775
6775
|
address: address.toString(),
|
|
6776
6776
|
});
|
|
@@ -6839,12 +6839,12 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6839
6839
|
return cached;
|
|
6840
6840
|
});
|
|
6841
6841
|
if (!envelopes.length) {
|
|
6842
|
-
logger$
|
|
6842
|
+
logger$18.debug('no_cached_recovery_for_service', {
|
|
6843
6843
|
service_name: serviceName,
|
|
6844
6844
|
});
|
|
6845
6845
|
return;
|
|
6846
6846
|
}
|
|
6847
|
-
logger$
|
|
6847
|
+
logger$18.debug('recovering_unhandled_envelopes_on_listen', {
|
|
6848
6848
|
service_name: serviceName,
|
|
6849
6849
|
count: envelopes.length,
|
|
6850
6850
|
envelope_ids: envelopes.map((trackedEnvelope) => trackedEnvelope.envelopeId),
|
|
@@ -6855,7 +6855,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6855
6855
|
async recoverServiceEnvelopes(serviceName, envelopes, handler) {
|
|
6856
6856
|
for (const tracked of envelopes) {
|
|
6857
6857
|
try {
|
|
6858
|
-
logger$
|
|
6858
|
+
logger$18.warning('recovering_unhandled_envelope', {
|
|
6859
6859
|
envelope_id: tracked.envelopeId,
|
|
6860
6860
|
service_name: serviceName,
|
|
6861
6861
|
current_attempts: tracked.attempt,
|
|
@@ -6864,13 +6864,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6864
6864
|
const originalEnvelope = tracked.originalEnvelope;
|
|
6865
6865
|
const receiverPolicy = this.nodeLike.deliveryPolicy?.receiverRetryPolicy ?? undefined;
|
|
6866
6866
|
await this.executeHandlerWithRetries(handler, originalEnvelope, undefined, receiverPolicy, tracked, serviceName);
|
|
6867
|
-
logger$
|
|
6867
|
+
logger$18.debug('envelope_recovery_completed', {
|
|
6868
6868
|
envelope_id: tracked.envelopeId,
|
|
6869
6869
|
service_name: serviceName,
|
|
6870
6870
|
});
|
|
6871
6871
|
}
|
|
6872
6872
|
catch (error) {
|
|
6873
|
-
logger$
|
|
6873
|
+
logger$18.error('envelope_recovery_failed', {
|
|
6874
6874
|
envelope_id: tracked.envelopeId,
|
|
6875
6875
|
service_name: serviceName,
|
|
6876
6876
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -6916,7 +6916,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6916
6916
|
await this.deliveryTracker.onEnvelopeHandled(trackedEnvelope);
|
|
6917
6917
|
}
|
|
6918
6918
|
if (currentAttempt > 0) {
|
|
6919
|
-
logger$
|
|
6919
|
+
logger$18.info('handler_retry_succeeded', {
|
|
6920
6920
|
envelope_id: envelope.id,
|
|
6921
6921
|
attempt: currentAttempt + 1,
|
|
6922
6922
|
total_attempts: currentAttempt + 1,
|
|
@@ -6932,7 +6932,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6932
6932
|
await this.deliveryTracker.onEnvelopeHandleFailed(inboxName, trackedEnvelope, context, error instanceof Error ? error : new Error(String(error)), isFinalAttempt);
|
|
6933
6933
|
}
|
|
6934
6934
|
if (isFinalAttempt) {
|
|
6935
|
-
logger$
|
|
6935
|
+
logger$18.error('handler_execution_failed_exhausted_retries', {
|
|
6936
6936
|
envelope_id: envelope.id,
|
|
6937
6937
|
total_attempts: attemptNumber,
|
|
6938
6938
|
max_retries: retryPolicy?.maxRetries ?? 0,
|
|
@@ -6941,7 +6941,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6941
6941
|
break;
|
|
6942
6942
|
}
|
|
6943
6943
|
const delayMs = retryPolicy?.nextDelayMs(attemptNumber) ?? 0;
|
|
6944
|
-
logger$
|
|
6944
|
+
logger$18.warning('handler_execution_failed_will_retry', {
|
|
6945
6945
|
envelope_id: envelope.id,
|
|
6946
6946
|
attempt: attemptNumber,
|
|
6947
6947
|
max_retries: retryPolicy?.maxRetries ?? 0,
|
|
@@ -6971,7 +6971,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
6971
6971
|
}
|
|
6972
6972
|
}
|
|
6973
6973
|
|
|
6974
|
-
const logger$
|
|
6974
|
+
const logger$17 = getLogger('naylence.fame.delivery.default_delivery_tracker');
|
|
6975
6975
|
const STREAM_END = Symbol('stream-end');
|
|
6976
6976
|
const SWEEPER_TICK = Symbol('tracker-sweeper-tick');
|
|
6977
6977
|
function createDeferred$2() {
|
|
@@ -7190,7 +7190,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7190
7190
|
const expectedResponseType = options.expectedResponseType;
|
|
7191
7191
|
const tracked = await this.lock.runExclusive(async () => {
|
|
7192
7192
|
if (this.ackFutures.has(envelope.id)) {
|
|
7193
|
-
logger$
|
|
7193
|
+
logger$17.debug('tracker_envelope_already_tracked', {
|
|
7194
7194
|
envp_id: envelope.id,
|
|
7195
7195
|
});
|
|
7196
7196
|
return null;
|
|
@@ -7200,7 +7200,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7200
7200
|
if (expectedResponseType & FameResponseType.REPLY ||
|
|
7201
7201
|
expectedResponseType & FameResponseType.STREAM) {
|
|
7202
7202
|
if (existingEnvId && existingEnvId !== envelope.id) {
|
|
7203
|
-
logger$
|
|
7203
|
+
logger$17.debug('envelope_already_tracked_for_replies', {
|
|
7204
7204
|
envp_id: envelope.id,
|
|
7205
7205
|
corr_id: corrId,
|
|
7206
7206
|
expected_response_type: expectedResponseType,
|
|
@@ -7249,7 +7249,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7249
7249
|
return null;
|
|
7250
7250
|
}
|
|
7251
7251
|
await this.scheduleTimer(tracked, options.retryPolicy ?? null, options.retryHandler ?? null);
|
|
7252
|
-
logger$
|
|
7252
|
+
logger$17.debug('tracker_registered_envelope', {
|
|
7253
7253
|
envp_id: envelope.id,
|
|
7254
7254
|
corr_id: tracked.originalEnvelope.corrId,
|
|
7255
7255
|
expected_response: tracked.expectedResponseType,
|
|
@@ -7273,21 +7273,21 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7273
7273
|
return this.awaitEnvelopeFuture(envelopeId, FameResponseType.REPLY | FameResponseType.STREAM, future, timeoutMs);
|
|
7274
7274
|
}
|
|
7275
7275
|
async onEnvelopeDelivered(inboxName, envelope, context) {
|
|
7276
|
-
logger$
|
|
7276
|
+
logger$17.debug('envelope_delivered', {
|
|
7277
7277
|
envp_id: envelope.id,
|
|
7278
7278
|
corr_id: envelope.corrId,
|
|
7279
7279
|
rtype: envelope.rtype ?? FameResponseType.NONE,
|
|
7280
7280
|
frame_type: envelope.frame?.type ?? 'unknown',
|
|
7281
7281
|
});
|
|
7282
7282
|
if (!envelope.corrId) {
|
|
7283
|
-
logger$
|
|
7283
|
+
logger$17.debug('envelope_delivered_no_corr_id', {
|
|
7284
7284
|
envelope_id: envelope.id,
|
|
7285
7285
|
});
|
|
7286
7286
|
return null;
|
|
7287
7287
|
}
|
|
7288
7288
|
if (this.isDeliveryAckFrame(envelope.frame)) {
|
|
7289
7289
|
if (!envelope.frame.refId) {
|
|
7290
|
-
logger$
|
|
7290
|
+
logger$17.debug('envelope_delivered_no_ref_id', {
|
|
7291
7291
|
envelope_id: envelope.id,
|
|
7292
7292
|
});
|
|
7293
7293
|
return null;
|
|
@@ -7324,7 +7324,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7324
7324
|
await inbox.set(envelope.id, tracked);
|
|
7325
7325
|
}
|
|
7326
7326
|
else {
|
|
7327
|
-
logger$
|
|
7327
|
+
logger$17.debug('tracker_duplicate_envelope_already_handled', {
|
|
7328
7328
|
envp_id: envelope.id,
|
|
7329
7329
|
status: tracked.status,
|
|
7330
7330
|
});
|
|
@@ -7366,7 +7366,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7366
7366
|
}
|
|
7367
7367
|
if (isFinalFailure) {
|
|
7368
7368
|
envelope.status = EnvelopeStatus.FAILED_TO_HANDLE;
|
|
7369
|
-
logger$
|
|
7369
|
+
logger$17.error('envelope_handle_failed_final', {
|
|
7370
7370
|
inbox_name: inboxName,
|
|
7371
7371
|
envp_id: envelope.originalEnvelope.id,
|
|
7372
7372
|
error: error?.message ?? 'unknown',
|
|
@@ -7377,7 +7377,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7377
7377
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
7378
7378
|
return;
|
|
7379
7379
|
}
|
|
7380
|
-
logger$
|
|
7380
|
+
logger$17.warning('envelope_handle_failed_retry', {
|
|
7381
7381
|
inbox_name: inboxName,
|
|
7382
7382
|
envp_id: envelope.originalEnvelope.id,
|
|
7383
7383
|
error: error?.message ?? 'unknown',
|
|
@@ -7422,14 +7422,14 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7422
7422
|
if (handledViaFuture) {
|
|
7423
7423
|
await this.markDoneSince(this.ackFutures, refId, this.ackDoneSince);
|
|
7424
7424
|
await this.clearTimer(refId);
|
|
7425
|
-
logger$
|
|
7425
|
+
logger$17.debug('tracker_ack_resolved_without_tracked_envelope', {
|
|
7426
7426
|
envp_id: envelope.id,
|
|
7427
7427
|
ref_id: refId,
|
|
7428
7428
|
corr_id: envelope.corrId,
|
|
7429
7429
|
});
|
|
7430
7430
|
return;
|
|
7431
7431
|
}
|
|
7432
|
-
logger$
|
|
7432
|
+
logger$17.debug('tracker_ack_for_unknown_envelope', {
|
|
7433
7433
|
envp_id: envelope.id,
|
|
7434
7434
|
ref_id: refId,
|
|
7435
7435
|
corr_id: envelope.corrId,
|
|
@@ -7437,7 +7437,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7437
7437
|
return;
|
|
7438
7438
|
}
|
|
7439
7439
|
if (tracked.originalEnvelope.corrId !== envelope.corrId) {
|
|
7440
|
-
logger$
|
|
7440
|
+
logger$17.debug('tracker_ack_corr_id_mismatch', {
|
|
7441
7441
|
envp_id: envelope.id,
|
|
7442
7442
|
expected_corr_id: tracked.originalEnvelope.corrId,
|
|
7443
7443
|
actual_corr_id: envelope.corrId,
|
|
@@ -7462,7 +7462,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7462
7462
|
for (const handler of this.eventHandlers) {
|
|
7463
7463
|
await handler.onEnvelopeAcked?.(tracked);
|
|
7464
7464
|
}
|
|
7465
|
-
logger$
|
|
7465
|
+
logger$17.debug('tracker_envelope_acked', {
|
|
7466
7466
|
envp_id: tracked.originalEnvelope.id,
|
|
7467
7467
|
});
|
|
7468
7468
|
}
|
|
@@ -7479,13 +7479,13 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7479
7479
|
const outbox = this.ensureOutbox();
|
|
7480
7480
|
const tracked = await outbox.get(envelope.frame.refId);
|
|
7481
7481
|
if (!tracked) {
|
|
7482
|
-
logger$
|
|
7482
|
+
logger$17.debug('tracker_nack_for_unknown_envelope', {
|
|
7483
7483
|
envp_id: envelope.id,
|
|
7484
7484
|
});
|
|
7485
7485
|
return;
|
|
7486
7486
|
}
|
|
7487
7487
|
if (tracked.originalEnvelope.corrId !== envelope.corrId) {
|
|
7488
|
-
logger$
|
|
7488
|
+
logger$17.debug('tracker_nack_corr_id_mismatch', {
|
|
7489
7489
|
envp_id: envelope.id,
|
|
7490
7490
|
expected_corr_id: tracked.originalEnvelope.corrId,
|
|
7491
7491
|
actual_corr_id: envelope.corrId,
|
|
@@ -7527,7 +7527,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7527
7527
|
for (const handler of this.eventHandlers) {
|
|
7528
7528
|
await handler.onEnvelopeNacked?.(tracked, ackFrame.reason ?? null);
|
|
7529
7529
|
}
|
|
7530
|
-
logger$
|
|
7530
|
+
logger$17.debug('tracker_envelope_nacked', {
|
|
7531
7531
|
envp_id: tracked.originalEnvelope.id,
|
|
7532
7532
|
reason: ackFrame.reason,
|
|
7533
7533
|
});
|
|
@@ -7574,7 +7574,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7574
7574
|
for (const handler of this.eventHandlers) {
|
|
7575
7575
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
7576
7576
|
}
|
|
7577
|
-
logger$
|
|
7577
|
+
logger$17.debug('tracked_envelope_replied', {
|
|
7578
7578
|
envp_id: trackedEnvelope.originalEnvelope.id,
|
|
7579
7579
|
corr_id: envelope.corrId,
|
|
7580
7580
|
});
|
|
@@ -7648,7 +7648,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7648
7648
|
async addToInboxDlq(trackedEnvelope, reason = null) {
|
|
7649
7649
|
const dlq = this.inboxDlq;
|
|
7650
7650
|
if (!dlq) {
|
|
7651
|
-
logger$
|
|
7651
|
+
logger$17.error('dlq_not_initialized', {
|
|
7652
7652
|
envp_id: trackedEnvelope.originalEnvelope.id,
|
|
7653
7653
|
});
|
|
7654
7654
|
return;
|
|
@@ -7663,7 +7663,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7663
7663
|
const deadLetteredAt = Date.now();
|
|
7664
7664
|
setMetaWithLegacy(trackedEnvelope.meta, 'deadLetteredAtMs', 'dead_lettered_at_ms', deadLetteredAt);
|
|
7665
7665
|
await dlq.set(trackedEnvelope.originalEnvelope.id, trackedEnvelope);
|
|
7666
|
-
logger$
|
|
7666
|
+
logger$17.warning('envelope_moved_to_dlq', {
|
|
7667
7667
|
envp_id: trackedEnvelope.originalEnvelope.id,
|
|
7668
7668
|
service_name: trackedEnvelope.serviceName,
|
|
7669
7669
|
});
|
|
@@ -7692,7 +7692,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7692
7692
|
const toDelete = Object.entries(items).filter(([, value]) => predicate ? predicate(value) : true);
|
|
7693
7693
|
await Promise.all(toDelete.map(([key]) => dlq.delete(key)));
|
|
7694
7694
|
if (toDelete.length) {
|
|
7695
|
-
logger$
|
|
7695
|
+
logger$17.debug('dlq_purged', { count: toDelete.length });
|
|
7696
7696
|
}
|
|
7697
7697
|
return toDelete.length;
|
|
7698
7698
|
}
|
|
@@ -7745,11 +7745,11 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7745
7745
|
}
|
|
7746
7746
|
this.futuresSweeper = null;
|
|
7747
7747
|
}
|
|
7748
|
-
logger$
|
|
7748
|
+
logger$17.debug('tracker_cleanup_completed');
|
|
7749
7749
|
}
|
|
7750
7750
|
async recoverPending() {
|
|
7751
7751
|
const pending = await this.listPending();
|
|
7752
|
-
logger$
|
|
7752
|
+
logger$17.debug('tracker_recovering_pending', { count: pending.length });
|
|
7753
7753
|
await this.lock.runExclusive(async () => {
|
|
7754
7754
|
for (const tracked of pending) {
|
|
7755
7755
|
if (tracked.expectedResponseType & FameResponseType.ACK) {
|
|
@@ -7775,7 +7775,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7775
7775
|
for (const tracked of pending) {
|
|
7776
7776
|
await this.scheduleTimer(tracked, null, null);
|
|
7777
7777
|
}
|
|
7778
|
-
logger$
|
|
7778
|
+
logger$17.debug('tracker_recovery_completed', { count: pending.length });
|
|
7779
7779
|
}
|
|
7780
7780
|
ensureOutbox() {
|
|
7781
7781
|
if (!this.outbox) {
|
|
@@ -7790,7 +7790,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7790
7790
|
return this.inbox;
|
|
7791
7791
|
}
|
|
7792
7792
|
async waitForPendingAcks() {
|
|
7793
|
-
logger$
|
|
7793
|
+
logger$17.debug('tracker_node_preparing_to_stop_waiting_for_pending_acks');
|
|
7794
7794
|
const outbox = this.outbox;
|
|
7795
7795
|
if (!outbox) {
|
|
7796
7796
|
return;
|
|
@@ -7802,7 +7802,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7802
7802
|
continue;
|
|
7803
7803
|
}
|
|
7804
7804
|
if (!future.done) {
|
|
7805
|
-
logger$
|
|
7805
|
+
logger$17.debug('tracker_pending_ack_future_detected', {
|
|
7806
7806
|
envelope_id: envelopeId,
|
|
7807
7807
|
});
|
|
7808
7808
|
pending.push({ envelopeId, future });
|
|
@@ -7810,10 +7810,10 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7810
7810
|
}
|
|
7811
7811
|
});
|
|
7812
7812
|
if (!pending.length) {
|
|
7813
|
-
logger$
|
|
7813
|
+
logger$17.debug('tracker_no_pending_acks_to_wait_for');
|
|
7814
7814
|
return;
|
|
7815
7815
|
}
|
|
7816
|
-
logger$
|
|
7816
|
+
logger$17.debug('tracker_waiting_for_pending_acks', { count: pending.length });
|
|
7817
7817
|
for (const entry of pending) {
|
|
7818
7818
|
if (!entry) {
|
|
7819
7819
|
continue;
|
|
@@ -7830,19 +7830,19 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7830
7830
|
}
|
|
7831
7831
|
try {
|
|
7832
7832
|
await this.awaitWithTimeout(entry.future.promise, remainingMs);
|
|
7833
|
-
logger$
|
|
7833
|
+
logger$17.debug('tracker_received_ack', {
|
|
7834
7834
|
envelope_id: entry.envelopeId,
|
|
7835
7835
|
});
|
|
7836
7836
|
await outbox.delete(entry.envelopeId);
|
|
7837
7837
|
}
|
|
7838
7838
|
catch (error) {
|
|
7839
7839
|
if (error instanceof Error && error.name === 'TimeoutError') {
|
|
7840
|
-
logger$
|
|
7840
|
+
logger$17.debug('tracker_ack_timeout_expired', {
|
|
7841
7841
|
envelope_id: entry.envelopeId,
|
|
7842
7842
|
});
|
|
7843
7843
|
}
|
|
7844
7844
|
else {
|
|
7845
|
-
logger$
|
|
7845
|
+
logger$17.debug('tracker_ack_wait_error', {
|
|
7846
7846
|
envelope_id: entry.envelopeId,
|
|
7847
7847
|
error: error instanceof Error ? error.message : String(error),
|
|
7848
7848
|
});
|
|
@@ -7850,13 +7850,13 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7850
7850
|
}
|
|
7851
7851
|
}
|
|
7852
7852
|
catch (error) {
|
|
7853
|
-
logger$
|
|
7853
|
+
logger$17.error('tracker_error_waiting_for_ack', {
|
|
7854
7854
|
envelope_id: entry.envelopeId,
|
|
7855
7855
|
error: error instanceof Error ? error.message : String(error),
|
|
7856
7856
|
});
|
|
7857
7857
|
}
|
|
7858
7858
|
}
|
|
7859
|
-
logger$
|
|
7859
|
+
logger$17.debug('tracker_finished_waiting_for_pending_acks');
|
|
7860
7860
|
}
|
|
7861
7861
|
async waitForPendingAckDispatches() {
|
|
7862
7862
|
while (this.pendingAckDispatches.size > 0) {
|
|
@@ -7914,7 +7914,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7914
7914
|
for (const handler of this.eventHandlers) {
|
|
7915
7915
|
await handler.onEnvelopeTimeout?.(currentTracked);
|
|
7916
7916
|
}
|
|
7917
|
-
logger$
|
|
7917
|
+
logger$17.debug('tracker_envelope_timed_out', {
|
|
7918
7918
|
envp_id: tracked.originalEnvelope.id,
|
|
7919
7919
|
});
|
|
7920
7920
|
return;
|
|
@@ -7927,7 +7927,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7927
7927
|
currentTracked.timeoutAtMs = nextTimeoutAt;
|
|
7928
7928
|
await outbox.set(tracked.originalEnvelope.id, currentTracked);
|
|
7929
7929
|
await this.scheduleTimer(currentTracked, retryPolicy, retryHandler);
|
|
7930
|
-
logger$
|
|
7930
|
+
logger$17.debug('tracker_retry_deferred_during_shutdown', {
|
|
7931
7931
|
envp_id: tracked.originalEnvelope.id,
|
|
7932
7932
|
defer_ms: shutdownDeferMs,
|
|
7933
7933
|
});
|
|
@@ -7950,7 +7950,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7950
7950
|
});
|
|
7951
7951
|
}
|
|
7952
7952
|
await this.scheduleTimer(currentTracked, retryPolicy, retryHandler);
|
|
7953
|
-
logger$
|
|
7953
|
+
logger$17.debug('envelope_delivery_retry_scheduled', {
|
|
7954
7954
|
envp_id: tracked.originalEnvelope.id,
|
|
7955
7955
|
attempt: currentTracked.attempt,
|
|
7956
7956
|
max_retries: retryPolicy.maxRetries,
|
|
@@ -7962,7 +7962,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7962
7962
|
currentTracked.timeoutAtMs = currentTracked.overallTimeoutAtMs;
|
|
7963
7963
|
await outbox.set(tracked.originalEnvelope.id, currentTracked);
|
|
7964
7964
|
await this.scheduleTimer(currentTracked, retryPolicy, retryHandler);
|
|
7965
|
-
logger$
|
|
7965
|
+
logger$17.debug('envelope_retries_exhausted_waiting_until_overall_timeout', {
|
|
7966
7966
|
envp_id: tracked.originalEnvelope.id,
|
|
7967
7967
|
attempt: currentTracked.attempt,
|
|
7968
7968
|
overall_timeout_at_ms: currentTracked.overallTimeoutAtMs,
|
|
@@ -7982,7 +7982,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7982
7982
|
for (const handler of this.eventHandlers) {
|
|
7983
7983
|
await handler.onEnvelopeTimeout?.(currentTracked);
|
|
7984
7984
|
}
|
|
7985
|
-
logger$
|
|
7985
|
+
logger$17.debug('tracker_envelope_timed_out', {
|
|
7986
7986
|
envp_id: tracked.originalEnvelope.id,
|
|
7987
7987
|
});
|
|
7988
7988
|
}
|
|
@@ -7990,7 +7990,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7990
7990
|
if (error instanceof TaskCancelledError) {
|
|
7991
7991
|
return;
|
|
7992
7992
|
}
|
|
7993
|
-
logger$
|
|
7993
|
+
logger$17.error('tracker_timer_error', {
|
|
7994
7994
|
envp_id: tracked.originalEnvelope.id,
|
|
7995
7995
|
error: error instanceof Error ? error.message : String(error),
|
|
7996
7996
|
});
|
|
@@ -8045,7 +8045,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8045
8045
|
if (timeoutSeconds !== null) {
|
|
8046
8046
|
return await this.awaitWithTimeout(future.promise, timeoutSeconds);
|
|
8047
8047
|
}
|
|
8048
|
-
logger$
|
|
8048
|
+
logger$17.debug('await_envelope_no_timeout_wait', {
|
|
8049
8049
|
envelope_id: envelopeId,
|
|
8050
8050
|
});
|
|
8051
8051
|
return await future.promise;
|
|
@@ -8054,7 +8054,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8054
8054
|
if (error instanceof Error && error.name !== 'TimeoutError') {
|
|
8055
8055
|
throw error;
|
|
8056
8056
|
}
|
|
8057
|
-
logger$
|
|
8057
|
+
logger$17.error('await_envelope_timeout_error', {
|
|
8058
8058
|
envelope_id: envelopeId,
|
|
8059
8059
|
timeout_ms: timeoutSeconds,
|
|
8060
8060
|
future_done: false,
|
|
@@ -8215,7 +8215,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8215
8215
|
this.replyDoneSince.delete(envId);
|
|
8216
8216
|
}
|
|
8217
8217
|
});
|
|
8218
|
-
logger$
|
|
8218
|
+
logger$17.debug('tracker_swept_completed_futures', {
|
|
8219
8219
|
ack_removed: toRemoveAck.length,
|
|
8220
8220
|
reply_removed: toRemoveReply.length,
|
|
8221
8221
|
grace_secs: this.futGcGraceSecs,
|
|
@@ -8229,7 +8229,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8229
8229
|
if (error instanceof Error && error.name === 'TimeoutError') {
|
|
8230
8230
|
continue;
|
|
8231
8231
|
}
|
|
8232
|
-
logger$
|
|
8232
|
+
logger$17.error('tracker_sweeper_error', {
|
|
8233
8233
|
error: error instanceof Error ? error.message : String(error),
|
|
8234
8234
|
});
|
|
8235
8235
|
}
|
|
@@ -8260,14 +8260,14 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8260
8260
|
}
|
|
8261
8261
|
const node = this.node;
|
|
8262
8262
|
if (!envelope.replyTo) {
|
|
8263
|
-
logger$
|
|
8263
|
+
logger$17.error('cannot_send_ack_no_reply_to', { envp_id: envelope.id });
|
|
8264
8264
|
return;
|
|
8265
8265
|
}
|
|
8266
8266
|
if (!envelope.corrId) {
|
|
8267
|
-
logger$
|
|
8267
|
+
logger$17.error('cannot_send_ack_no_corr_id', { envp_id: envelope.id });
|
|
8268
8268
|
return;
|
|
8269
8269
|
}
|
|
8270
|
-
logger$
|
|
8270
|
+
logger$17.debug('tracker_sending_ack', {
|
|
8271
8271
|
envp_id: envelope.id,
|
|
8272
8272
|
ref_id: envelope.id,
|
|
8273
8273
|
to: envelope.replyTo,
|
|
@@ -8287,7 +8287,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8287
8287
|
.send(ackEnvelope)
|
|
8288
8288
|
.then(() => undefined)
|
|
8289
8289
|
.catch((error) => {
|
|
8290
|
-
logger$
|
|
8290
|
+
logger$17.error('tracker_ack_dispatch_failed', {
|
|
8291
8291
|
envp_id: envelope.id,
|
|
8292
8292
|
error: error instanceof Error ? error.message : String(error),
|
|
8293
8293
|
});
|
|
@@ -8373,7 +8373,7 @@ class AsyncEvent {
|
|
|
8373
8373
|
}
|
|
8374
8374
|
}
|
|
8375
8375
|
|
|
8376
|
-
const logger$
|
|
8376
|
+
const logger$16 = getLogger('naylence.fame.node.root_session_manager');
|
|
8377
8377
|
function resolveOption$1(options, primary, ...aliases) {
|
|
8378
8378
|
const record = options;
|
|
8379
8379
|
const primaryKey = primary;
|
|
@@ -8454,7 +8454,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8454
8454
|
this.onAdmissionFailed =
|
|
8455
8455
|
typeof onAdmissionFailed === 'function' ? onAdmissionFailed : undefined;
|
|
8456
8456
|
this.enableContinuousRefresh = enableContinuousRefresh ?? true;
|
|
8457
|
-
logger$
|
|
8457
|
+
logger$16.debug('created_root_session_manager');
|
|
8458
8458
|
}
|
|
8459
8459
|
get isReady() {
|
|
8460
8460
|
return this.readyEvent.isSet();
|
|
@@ -8479,7 +8479,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8479
8479
|
if (this.admissionTask) {
|
|
8480
8480
|
return;
|
|
8481
8481
|
}
|
|
8482
|
-
logger$
|
|
8482
|
+
logger$16.debug('root_session_manager_starting');
|
|
8483
8483
|
this.stopEvent.clear();
|
|
8484
8484
|
this.readyEvent.clear();
|
|
8485
8485
|
const taskName = `root-admission-${this.admissionEpoch}`;
|
|
@@ -8499,10 +8499,10 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8499
8499
|
await this.admissionTask.promise;
|
|
8500
8500
|
throw new FameConnectError('Root session manager failed to become ready');
|
|
8501
8501
|
}
|
|
8502
|
-
logger$
|
|
8502
|
+
logger$16.debug('root_session_manager_started');
|
|
8503
8503
|
}
|
|
8504
8504
|
async stop() {
|
|
8505
|
-
logger$
|
|
8505
|
+
logger$16.debug('root_session_manager_stopping');
|
|
8506
8506
|
this.stopEvent.set();
|
|
8507
8507
|
if (this.admissionTask) {
|
|
8508
8508
|
this.admissionTask.cancel();
|
|
@@ -8514,7 +8514,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8514
8514
|
await this.consumeTask(this.expiryGuardTask);
|
|
8515
8515
|
this.expiryGuardTask = null;
|
|
8516
8516
|
}
|
|
8517
|
-
logger$
|
|
8517
|
+
logger$16.debug('root_session_manager_stopped');
|
|
8518
8518
|
}
|
|
8519
8519
|
async awaitReady(timeoutMs) {
|
|
8520
8520
|
if (this.isReady) {
|
|
@@ -8555,12 +8555,12 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8555
8555
|
await this.onEpochChange(epoch);
|
|
8556
8556
|
}
|
|
8557
8557
|
else {
|
|
8558
|
-
logger$
|
|
8558
|
+
logger$16.debug('epoch_change_ignored_no_handler', { epoch });
|
|
8559
8559
|
}
|
|
8560
8560
|
}
|
|
8561
8561
|
static createForRootSentinel(node, admissionClient, requestedLogicals = [], enableContinuousRefresh = true, onEpochChange) {
|
|
8562
8562
|
const handleWelcome = async (frame) => {
|
|
8563
|
-
logger$
|
|
8563
|
+
logger$16.info('root_admission_successful', {
|
|
8564
8564
|
system_id: frame.systemId,
|
|
8565
8565
|
assigned_path: frame.assignedPath ?? null,
|
|
8566
8566
|
accepted_logicals: frame.acceptedLogicals ?? [],
|
|
@@ -8571,12 +8571,12 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8571
8571
|
? grant.purpose
|
|
8572
8572
|
: undefined;
|
|
8573
8573
|
if (purpose) {
|
|
8574
|
-
logger$
|
|
8574
|
+
logger$16.debug('received_admission_grant', { purpose });
|
|
8575
8575
|
}
|
|
8576
8576
|
}
|
|
8577
8577
|
};
|
|
8578
8578
|
const handleFailure = async (error) => {
|
|
8579
|
-
logger$
|
|
8579
|
+
logger$16.error('root_admission_failed_permanently', {
|
|
8580
8580
|
error: error.message,
|
|
8581
8581
|
});
|
|
8582
8582
|
};
|
|
@@ -8605,10 +8605,10 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8605
8605
|
this.readyEvent.set();
|
|
8606
8606
|
}
|
|
8607
8607
|
if (this.hadSuccessfulAdmission) {
|
|
8608
|
-
logger$
|
|
8608
|
+
logger$16.debug('root_admission_refreshed');
|
|
8609
8609
|
}
|
|
8610
8610
|
else {
|
|
8611
|
-
logger$
|
|
8611
|
+
logger$16.debug('root_admission_completed');
|
|
8612
8612
|
}
|
|
8613
8613
|
this.hadSuccessfulAdmission = true;
|
|
8614
8614
|
delay = RootSessionManager.BACKOFF_INITIAL;
|
|
@@ -8617,7 +8617,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8617
8617
|
await this.startExpiryGuard(welcomeFrame);
|
|
8618
8618
|
const expiryTriggered = await this.waitForExpiryOrStop();
|
|
8619
8619
|
if (expiryTriggered && !this.stopEvent.isSet()) {
|
|
8620
|
-
logger$
|
|
8620
|
+
logger$16.debug('performing_scheduled_re_admission');
|
|
8621
8621
|
continue;
|
|
8622
8622
|
}
|
|
8623
8623
|
}
|
|
@@ -8629,7 +8629,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8629
8629
|
}
|
|
8630
8630
|
const errorObject = error instanceof Error ? error : new Error(String(error));
|
|
8631
8631
|
const willRetry = attempts < RootSessionManager.RETRY_MAX_ATTEMPTS;
|
|
8632
|
-
logger$
|
|
8632
|
+
logger$16.warning('root_admission_failed', {
|
|
8633
8633
|
error: errorObject.message,
|
|
8634
8634
|
attempt: attempts,
|
|
8635
8635
|
will_retry: willRetry,
|
|
@@ -8647,7 +8647,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8647
8647
|
}
|
|
8648
8648
|
}
|
|
8649
8649
|
if (attempts >= RootSessionManager.RETRY_MAX_ATTEMPTS) {
|
|
8650
|
-
logger$
|
|
8650
|
+
logger$16.error('root_admission_max_attempts_exceeded', {
|
|
8651
8651
|
max_attempts: RootSessionManager.RETRY_MAX_ATTEMPTS,
|
|
8652
8652
|
});
|
|
8653
8653
|
}
|
|
@@ -8724,7 +8724,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8724
8724
|
}
|
|
8725
8725
|
async expiryGuard(welcomeFrame, signal) {
|
|
8726
8726
|
if (!welcomeFrame.expiresAt) {
|
|
8727
|
-
logger$
|
|
8727
|
+
logger$16.debug('no_admission_expiry_configured');
|
|
8728
8728
|
await Promise.race([this.stopEvent.wait(), this.waitForAbort(signal)]);
|
|
8729
8729
|
return;
|
|
8730
8730
|
}
|
|
@@ -8733,7 +8733,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8733
8733
|
let delaySeconds = (expiresAt.getTime() - now.getTime()) / 1000 -
|
|
8734
8734
|
RootSessionManager.JWT_REFRESH_SAFETY;
|
|
8735
8735
|
delaySeconds = Math.max(delaySeconds, 0);
|
|
8736
|
-
logger$
|
|
8736
|
+
logger$16.debug('admission_expiry_guard_started', {
|
|
8737
8737
|
welcome_expires_at: expiresAt.toISOString(),
|
|
8738
8738
|
delay_seconds: delaySeconds,
|
|
8739
8739
|
refresh_safety_seconds: RootSessionManager.JWT_REFRESH_SAFETY,
|
|
@@ -8742,7 +8742,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8742
8742
|
if (this.stopEvent.isSet() || signal?.aborted) {
|
|
8743
8743
|
return;
|
|
8744
8744
|
}
|
|
8745
|
-
logger$
|
|
8745
|
+
logger$16.debug('admission_expiry_triggered_refresh', {
|
|
8746
8746
|
expires_at: expiresAt.toISOString(),
|
|
8747
8747
|
current_time: new Date().toISOString(),
|
|
8748
8748
|
seconds_before_expiry: RootSessionManager.JWT_REFRESH_SAFETY,
|
|
@@ -8757,7 +8757,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
8757
8757
|
return;
|
|
8758
8758
|
}
|
|
8759
8759
|
const errorObject = error instanceof Error ? error : new Error(String(error));
|
|
8760
|
-
logger$
|
|
8760
|
+
logger$16.debug('background_task_error', {
|
|
8761
8761
|
task_name: task.name,
|
|
8762
8762
|
error: errorObject.message,
|
|
8763
8763
|
});
|
|
@@ -8798,7 +8798,7 @@ RootSessionManager.JWT_REFRESH_SAFETY = 60.0;
|
|
|
8798
8798
|
* Concrete implementations must define supported grant types and provide grant-to-connector
|
|
8799
8799
|
* conversion logic.
|
|
8800
8800
|
*/
|
|
8801
|
-
const logger$
|
|
8801
|
+
const logger$15 = getLogger('naylence.fame.connector.connector_factory');
|
|
8802
8802
|
const CONNECTOR_FACTORY_BASE_TYPE = 'ConnectorFactory';
|
|
8803
8803
|
/**
|
|
8804
8804
|
* Abstract base class for connector factories
|
|
@@ -8834,7 +8834,7 @@ class ConnectorFactory {
|
|
|
8834
8834
|
}
|
|
8835
8835
|
}
|
|
8836
8836
|
catch (error) {
|
|
8837
|
-
logger$
|
|
8837
|
+
logger$15.warning(`Failed to evaluate grant with factory ${factoryInfo.constructor.name}: ${error}`);
|
|
8838
8838
|
continue;
|
|
8839
8839
|
}
|
|
8840
8840
|
}
|
|
@@ -8877,7 +8877,7 @@ class ConnectorFactory {
|
|
|
8877
8877
|
}
|
|
8878
8878
|
}
|
|
8879
8879
|
catch (error) {
|
|
8880
|
-
logger$
|
|
8880
|
+
logger$15.warning(`Failed to create connector config from grant: ${error}`);
|
|
8881
8881
|
continue;
|
|
8882
8882
|
}
|
|
8883
8883
|
}
|
|
@@ -8944,20 +8944,20 @@ class ConnectorFactory {
|
|
|
8944
8944
|
return existing;
|
|
8945
8945
|
}
|
|
8946
8946
|
if (existing && !this.isGrantAware(existing)) {
|
|
8947
|
-
logger$
|
|
8947
|
+
logger$15.warning(`Factory ${factoryInfo.constructor.name} is registered under ${CONNECTOR_FACTORY_BASE_TYPE} but is missing grant conversion APIs; skipping.`);
|
|
8948
8948
|
return null;
|
|
8949
8949
|
}
|
|
8950
8950
|
try {
|
|
8951
8951
|
const instance = new factoryInfo.constructor();
|
|
8952
8952
|
if (!this.isGrantAware(instance)) {
|
|
8953
|
-
logger$
|
|
8953
|
+
logger$15.warning(`Factory ${factoryInfo.constructor.name} does not implement grant conversion APIs required by ${CONNECTOR_FACTORY_BASE_TYPE}; skipping.`);
|
|
8954
8954
|
return null;
|
|
8955
8955
|
}
|
|
8956
8956
|
factoryInfo.instance = instance;
|
|
8957
8957
|
return instance;
|
|
8958
8958
|
}
|
|
8959
8959
|
catch (error) {
|
|
8960
|
-
logger$
|
|
8960
|
+
logger$15.warning(`Failed to instantiate factory ${factoryInfo.constructor.name} while resolving grant conversion APIs: ${error}`);
|
|
8961
8961
|
return null;
|
|
8962
8962
|
}
|
|
8963
8963
|
}
|
|
@@ -9060,7 +9060,7 @@ class TaskCancellationError extends Error {
|
|
|
9060
9060
|
this.name = 'TaskCancellationError';
|
|
9061
9061
|
}
|
|
9062
9062
|
}
|
|
9063
|
-
const logger$
|
|
9063
|
+
const logger$14 = getLogger('naylence.fame.connector.base_async_connector');
|
|
9064
9064
|
// Environment variables
|
|
9065
9065
|
const ENV_VAR_FAME_FLOW_CONTROL = 'FAME_FLOW_CONTROL';
|
|
9066
9066
|
const FLOW_CONTROL_ENABLED = typeof process !== 'undefined' && process?.env
|
|
@@ -9143,7 +9143,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9143
9143
|
if (this._state !== newState) {
|
|
9144
9144
|
const oldState = this._state;
|
|
9145
9145
|
this._state = newState;
|
|
9146
|
-
logger$
|
|
9146
|
+
logger$14.debug('connector_state_transition', {
|
|
9147
9147
|
connector_id: this._connectorFlowId,
|
|
9148
9148
|
old_state: oldState,
|
|
9149
9149
|
new_state: newState,
|
|
@@ -9182,12 +9182,12 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9182
9182
|
* Stop the connector gracefully
|
|
9183
9183
|
*/
|
|
9184
9184
|
async stop() {
|
|
9185
|
-
logger$
|
|
9185
|
+
logger$14.debug('stopping_connector', {
|
|
9186
9186
|
current_state: this._state,
|
|
9187
9187
|
connector_id: this._connectorFlowId,
|
|
9188
9188
|
});
|
|
9189
9189
|
if (!ConnectorStateUtils.canStop(this._state)) {
|
|
9190
|
-
logger$
|
|
9190
|
+
logger$14.debug('connector_stop_already_stopped', {
|
|
9191
9191
|
current_state: this._state,
|
|
9192
9192
|
connector_id: this._connectorFlowId,
|
|
9193
9193
|
});
|
|
@@ -9198,7 +9198,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9198
9198
|
if (this._lastError) {
|
|
9199
9199
|
throw this._lastError;
|
|
9200
9200
|
}
|
|
9201
|
-
logger$
|
|
9201
|
+
logger$14.debug('connector_stopped', {
|
|
9202
9202
|
current_state: this._state,
|
|
9203
9203
|
connector_id: this._connectorFlowId,
|
|
9204
9204
|
});
|
|
@@ -9207,19 +9207,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9207
9207
|
* Pause the connector (suspends heartbeat and housekeeping, but keeps connection alive)
|
|
9208
9208
|
*/
|
|
9209
9209
|
async pause() {
|
|
9210
|
-
logger$
|
|
9210
|
+
logger$14.debug('pausing_connector', {
|
|
9211
9211
|
current_state: this._state,
|
|
9212
9212
|
connector_id: this._connectorFlowId,
|
|
9213
9213
|
});
|
|
9214
9214
|
if (this._state !== ConnectorState.STARTED) {
|
|
9215
|
-
logger$
|
|
9215
|
+
logger$14.debug('connector_pause_invalid_state', {
|
|
9216
9216
|
current_state: this._state,
|
|
9217
9217
|
connector_id: this._connectorFlowId,
|
|
9218
9218
|
});
|
|
9219
9219
|
return;
|
|
9220
9220
|
}
|
|
9221
9221
|
this._setState(ConnectorState.PAUSED);
|
|
9222
|
-
logger$
|
|
9222
|
+
logger$14.debug('connector_paused', {
|
|
9223
9223
|
current_state: this._state,
|
|
9224
9224
|
connector_id: this._connectorFlowId,
|
|
9225
9225
|
});
|
|
@@ -9228,19 +9228,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9228
9228
|
* Resume the connector from paused state
|
|
9229
9229
|
*/
|
|
9230
9230
|
async resume() {
|
|
9231
|
-
logger$
|
|
9231
|
+
logger$14.debug('resuming_connector', {
|
|
9232
9232
|
current_state: this._state,
|
|
9233
9233
|
connector_id: this._connectorFlowId,
|
|
9234
9234
|
});
|
|
9235
9235
|
if (this._state !== ConnectorState.PAUSED) {
|
|
9236
|
-
logger$
|
|
9236
|
+
logger$14.debug('connector_resume_invalid_state', {
|
|
9237
9237
|
current_state: this._state,
|
|
9238
9238
|
connector_id: this._connectorFlowId,
|
|
9239
9239
|
});
|
|
9240
9240
|
return;
|
|
9241
9241
|
}
|
|
9242
9242
|
this._setState(ConnectorState.STARTED);
|
|
9243
|
-
logger$
|
|
9243
|
+
logger$14.debug('connector_resumed', {
|
|
9244
9244
|
current_state: this._state,
|
|
9245
9245
|
connector_id: this._connectorFlowId,
|
|
9246
9246
|
});
|
|
@@ -9250,7 +9250,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9250
9250
|
*/
|
|
9251
9251
|
async close(code = 1000, reason = 'normal closure') {
|
|
9252
9252
|
if (!ConnectorStateUtils.canClose(this._state)) {
|
|
9253
|
-
logger$
|
|
9253
|
+
logger$14.warning('connector_close_invalid_state', {
|
|
9254
9254
|
current_state: this._state,
|
|
9255
9255
|
connector_id: this._connectorFlowId,
|
|
9256
9256
|
});
|
|
@@ -9331,7 +9331,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9331
9331
|
// Add to queue and notify send loop
|
|
9332
9332
|
this._sendQueue.push(raw);
|
|
9333
9333
|
// Log for debugging
|
|
9334
|
-
logger$
|
|
9334
|
+
logger$14.debug('send_envelope_queued', {
|
|
9335
9335
|
queue_length: this._sendQueue.length,
|
|
9336
9336
|
max_queue_size: this._maxQueueSize,
|
|
9337
9337
|
});
|
|
@@ -9380,14 +9380,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9380
9380
|
const item = this._sendQueue[0];
|
|
9381
9381
|
if (!item)
|
|
9382
9382
|
continue;
|
|
9383
|
-
logger$
|
|
9383
|
+
logger$14.debug('send_loop_processing_item', {
|
|
9384
9384
|
queue_length_before_send: this._sendQueue.length,
|
|
9385
9385
|
});
|
|
9386
9386
|
// Send through transport (this may block)
|
|
9387
9387
|
await this._transportSendBytes(item);
|
|
9388
9388
|
// Only remove from queue after successful send
|
|
9389
9389
|
this._sendQueue.shift();
|
|
9390
|
-
logger$
|
|
9390
|
+
logger$14.debug('send_loop_item_sent', {
|
|
9391
9391
|
queue_length_after_send: this._sendQueue.length,
|
|
9392
9392
|
});
|
|
9393
9393
|
}
|
|
@@ -9400,14 +9400,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9400
9400
|
}
|
|
9401
9401
|
else if (error instanceof TaskCancellationError) {
|
|
9402
9402
|
// Task cancellation is expected during shutdown - log as debug, not critical
|
|
9403
|
-
logger$
|
|
9403
|
+
logger$14.debug('send loop cancelled', {
|
|
9404
9404
|
connector: this.constructor.name,
|
|
9405
9405
|
reason: error.message,
|
|
9406
9406
|
});
|
|
9407
9407
|
// Don't re-throw - this is normal during shutdown
|
|
9408
9408
|
}
|
|
9409
9409
|
else {
|
|
9410
|
-
logger$
|
|
9410
|
+
logger$14.critical('unexpected exception in send loop', {
|
|
9411
9411
|
connector: this.constructor.name,
|
|
9412
9412
|
error: error instanceof Error ? error.message : String(error),
|
|
9413
9413
|
});
|
|
@@ -9448,7 +9448,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9448
9448
|
env = JSON.parse(jsonStr);
|
|
9449
9449
|
}
|
|
9450
9450
|
catch (error) {
|
|
9451
|
-
logger$
|
|
9451
|
+
logger$14.error('Invalid envelope', {
|
|
9452
9452
|
message: message.toString(),
|
|
9453
9453
|
error: error instanceof Error ? error.message : String(error),
|
|
9454
9454
|
});
|
|
@@ -9472,7 +9472,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9472
9472
|
};
|
|
9473
9473
|
await withEnvelopeContextAsync(envelopeContext, async () => {
|
|
9474
9474
|
const prettyEnvelope = prettyModel$1(env);
|
|
9475
|
-
logger$
|
|
9475
|
+
logger$14.trace('connector_received_envelope', {
|
|
9476
9476
|
envelope: env,
|
|
9477
9477
|
pretty: prettyEnvelope,
|
|
9478
9478
|
});
|
|
@@ -9501,7 +9501,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9501
9501
|
if (error instanceof TaskCancellationError) {
|
|
9502
9502
|
throw error;
|
|
9503
9503
|
}
|
|
9504
|
-
logger$
|
|
9504
|
+
logger$14.error('handler_failed', {
|
|
9505
9505
|
error: error instanceof Error ? error.message : String(error),
|
|
9506
9506
|
envelope_id: env.id ?? null,
|
|
9507
9507
|
trace_id: env.traceId ?? null,
|
|
@@ -9522,14 +9522,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9522
9522
|
}
|
|
9523
9523
|
else if (error instanceof TaskCancellationError) {
|
|
9524
9524
|
// Task cancellation is expected during shutdown - log as debug, not critical
|
|
9525
|
-
logger$
|
|
9525
|
+
logger$14.debug('receive loop cancelled', {
|
|
9526
9526
|
connector: this.constructor.name,
|
|
9527
9527
|
reason: error.message,
|
|
9528
9528
|
});
|
|
9529
9529
|
// Don't re-throw - this is normal during shutdown
|
|
9530
9530
|
}
|
|
9531
9531
|
else {
|
|
9532
|
-
logger$
|
|
9532
|
+
logger$14.critical('unexpected_error_in recv_loop', {
|
|
9533
9533
|
error: error instanceof Error ? error.message : String(error),
|
|
9534
9534
|
});
|
|
9535
9535
|
throw error;
|
|
@@ -9545,7 +9545,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9545
9545
|
async _maybeEmitCredit(flowId, traceId) {
|
|
9546
9546
|
const remainingCredits = this._flowCtrl.getCredits(flowId);
|
|
9547
9547
|
const needsRefill = this._flowCtrl.needsRefill(flowId);
|
|
9548
|
-
logger$
|
|
9548
|
+
logger$14.debug('maybe_emit_credit_check', {
|
|
9549
9549
|
connector_id: this._connectorFlowId,
|
|
9550
9550
|
flow_id: flowId,
|
|
9551
9551
|
trace_id: traceId ?? null,
|
|
@@ -9561,7 +9561,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9561
9561
|
}
|
|
9562
9562
|
const delta = this._initialWindow;
|
|
9563
9563
|
this._flowCtrl.addCredits(flowId, delta);
|
|
9564
|
-
logger$
|
|
9564
|
+
logger$14.debug('maybe_emit_credit_emit', {
|
|
9565
9565
|
connector_id: this._connectorFlowId,
|
|
9566
9566
|
flow_id: flowId,
|
|
9567
9567
|
trace_id: traceId ?? null,
|
|
@@ -9581,7 +9581,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9581
9581
|
});
|
|
9582
9582
|
try {
|
|
9583
9583
|
await this.send(ackEnv);
|
|
9584
|
-
logger$
|
|
9584
|
+
logger$14.debug('maybe_emit_credit_sent', {
|
|
9585
9585
|
connector_id: this._connectorFlowId,
|
|
9586
9586
|
flow_id: flowId,
|
|
9587
9587
|
trace_id: traceId ?? null,
|
|
@@ -9589,7 +9589,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9589
9589
|
});
|
|
9590
9590
|
}
|
|
9591
9591
|
catch (error) {
|
|
9592
|
-
logger$
|
|
9592
|
+
logger$14.error('maybe_emit_credit_send_failed', {
|
|
9593
9593
|
connector_id: this._connectorFlowId,
|
|
9594
9594
|
flow_id: flowId,
|
|
9595
9595
|
trace_id: traceId ?? null,
|
|
@@ -9614,13 +9614,13 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9614
9614
|
*/
|
|
9615
9615
|
async _shutdown(code, reason, gracePeriod, exc) {
|
|
9616
9616
|
if (this._closed) {
|
|
9617
|
-
logger$
|
|
9617
|
+
logger$14.debug('shutdown_already_closed', {
|
|
9618
9618
|
connector_id: this._connectorFlowId,
|
|
9619
9619
|
current_state: this._state,
|
|
9620
9620
|
});
|
|
9621
9621
|
return;
|
|
9622
9622
|
}
|
|
9623
|
-
logger$
|
|
9623
|
+
logger$14.debug('connector_shutdown_starting', {
|
|
9624
9624
|
connector_id: this._connectorFlowId,
|
|
9625
9625
|
connector_type: this.constructor.name,
|
|
9626
9626
|
code,
|
|
@@ -9650,19 +9650,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9650
9650
|
this._sendPromiseResolve = undefined;
|
|
9651
9651
|
}
|
|
9652
9652
|
// Close transport
|
|
9653
|
-
logger$
|
|
9653
|
+
logger$14.debug('connector_closing_transport', {
|
|
9654
9654
|
connector_id: this._connectorFlowId,
|
|
9655
9655
|
connector_type: this.constructor.name,
|
|
9656
9656
|
timestamp: new Date().toISOString(),
|
|
9657
9657
|
});
|
|
9658
9658
|
await this._transportClose(code, reason);
|
|
9659
|
-
logger$
|
|
9659
|
+
logger$14.debug('connector_transport_closed', {
|
|
9660
9660
|
connector_id: this._connectorFlowId,
|
|
9661
9661
|
connector_type: this.constructor.name,
|
|
9662
9662
|
timestamp: new Date().toISOString(),
|
|
9663
9663
|
});
|
|
9664
9664
|
// Shutdown spawned tasks
|
|
9665
|
-
logger$
|
|
9665
|
+
logger$14.debug('connector_shutting_down_tasks', {
|
|
9666
9666
|
connector_id: this._connectorFlowId,
|
|
9667
9667
|
connector_type: this.constructor.name,
|
|
9668
9668
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -9674,14 +9674,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9674
9674
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
9675
9675
|
joinTimeout: this._shutdownJoinTimeout,
|
|
9676
9676
|
});
|
|
9677
|
-
logger$
|
|
9677
|
+
logger$14.debug('connector_tasks_shutdown_complete', {
|
|
9678
9678
|
connector_id: this._connectorFlowId,
|
|
9679
9679
|
connector_type: this.constructor.name,
|
|
9680
9680
|
timestamp: new Date().toISOString(),
|
|
9681
9681
|
});
|
|
9682
9682
|
}
|
|
9683
9683
|
catch (error) {
|
|
9684
|
-
logger$
|
|
9684
|
+
logger$14.warning('task_shutdown_error', {
|
|
9685
9685
|
connector_id: this._connectorFlowId,
|
|
9686
9686
|
error: error instanceof Error ? error.message : String(error),
|
|
9687
9687
|
});
|
|
@@ -9694,7 +9694,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9694
9694
|
if (this._closeResolver) {
|
|
9695
9695
|
this._closeResolver();
|
|
9696
9696
|
}
|
|
9697
|
-
logger$
|
|
9697
|
+
logger$14.debug('connector_shutdown_complete', {
|
|
9698
9698
|
connector_id: this._connectorFlowId,
|
|
9699
9699
|
connector_type: this.constructor.name,
|
|
9700
9700
|
final_state: this._state,
|
|
@@ -9770,7 +9770,7 @@ class BoundedAsyncQueue {
|
|
|
9770
9770
|
}
|
|
9771
9771
|
}
|
|
9772
9772
|
|
|
9773
|
-
const logger$
|
|
9773
|
+
const logger$13 = getLogger('naylence.fame.connector.broadcast_channel_connector');
|
|
9774
9774
|
const BROADCAST_CHANNEL_CONNECTOR_TYPE = 'broadcast-channel-connector';
|
|
9775
9775
|
const DEFAULT_CHANNEL$7 = 'naylence-fabric';
|
|
9776
9776
|
const DEFAULT_INBOX_CAPACITY$7 = 2048;
|
|
@@ -9859,7 +9859,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9859
9859
|
this.localNodeId = normalizedLocalNodeId;
|
|
9860
9860
|
this.targetNodeId = BroadcastChannelConnector.normalizeTargetNodeId(config.initialTargetNodeId);
|
|
9861
9861
|
this.channel = new BroadcastChannel(this.channelName);
|
|
9862
|
-
logger$
|
|
9862
|
+
logger$13.debug('broadcast_channel_connector_created', {
|
|
9863
9863
|
channel: this.channelName,
|
|
9864
9864
|
connector_id: this.connectorId,
|
|
9865
9865
|
local_node_id: this.localNodeId,
|
|
@@ -9871,7 +9871,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9871
9871
|
this.onMsg = (event) => {
|
|
9872
9872
|
// Guard: Don't process if listener was unregistered
|
|
9873
9873
|
if (!this.listenerRegistered) {
|
|
9874
|
-
logger$
|
|
9874
|
+
logger$13.warning('broadcast_channel_message_after_unregister', {
|
|
9875
9875
|
channel: this.channelName,
|
|
9876
9876
|
connector_id: this.connectorId,
|
|
9877
9877
|
timestamp: new Date().toISOString(),
|
|
@@ -9879,7 +9879,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9879
9879
|
return;
|
|
9880
9880
|
}
|
|
9881
9881
|
const message = event.data;
|
|
9882
|
-
logger$
|
|
9882
|
+
logger$13.debug('broadcast_channel_raw_event', {
|
|
9883
9883
|
channel: this.channelName,
|
|
9884
9884
|
connector_id: this.connectorId,
|
|
9885
9885
|
message_type: message && typeof message === 'object'
|
|
@@ -9895,7 +9895,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9895
9895
|
const busMessage = message;
|
|
9896
9896
|
const senderNodeId = BroadcastChannelConnector.normalizeNodeId(busMessage.senderNodeId);
|
|
9897
9897
|
if (!senderNodeId) {
|
|
9898
|
-
logger$
|
|
9898
|
+
logger$13.debug('broadcast_channel_message_rejected', {
|
|
9899
9899
|
channel: this.channelName,
|
|
9900
9900
|
connector_id: this.connectorId,
|
|
9901
9901
|
reason: 'missing_sender_node_id',
|
|
@@ -9903,7 +9903,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9903
9903
|
return;
|
|
9904
9904
|
}
|
|
9905
9905
|
if (senderNodeId === this.localNodeId) {
|
|
9906
|
-
logger$
|
|
9906
|
+
logger$13.debug('broadcast_channel_message_rejected', {
|
|
9907
9907
|
channel: this.channelName,
|
|
9908
9908
|
connector_id: this.connectorId,
|
|
9909
9909
|
reason: 'self_echo',
|
|
@@ -9917,14 +9917,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9917
9917
|
}
|
|
9918
9918
|
const payload = BroadcastChannelConnector.coercePayload(busMessage.payload);
|
|
9919
9919
|
if (!payload) {
|
|
9920
|
-
logger$
|
|
9920
|
+
logger$13.debug('broadcast_channel_payload_rejected', {
|
|
9921
9921
|
channel: this.channelName,
|
|
9922
9922
|
connector_id: this.connectorId,
|
|
9923
9923
|
reason: 'unrecognized_payload_type',
|
|
9924
9924
|
});
|
|
9925
9925
|
return;
|
|
9926
9926
|
}
|
|
9927
|
-
logger$
|
|
9927
|
+
logger$13.debug('broadcast_channel_message_received', {
|
|
9928
9928
|
channel: this.channelName,
|
|
9929
9929
|
sender_id: message?.senderId,
|
|
9930
9930
|
sender_node_id: senderNodeId,
|
|
@@ -9953,14 +9953,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9953
9953
|
}
|
|
9954
9954
|
catch (error) {
|
|
9955
9955
|
if (error instanceof QueueFullError) {
|
|
9956
|
-
logger$
|
|
9956
|
+
logger$13.warning('broadcast_channel_receive_queue_full', {
|
|
9957
9957
|
channel: this.channelName,
|
|
9958
9958
|
inbox_capacity: this.inboxCapacity,
|
|
9959
9959
|
inbox_remaining_capacity: this.inbox.remainingCapacity,
|
|
9960
9960
|
});
|
|
9961
9961
|
}
|
|
9962
9962
|
else {
|
|
9963
|
-
logger$
|
|
9963
|
+
logger$13.error('broadcast_channel_receive_error', {
|
|
9964
9964
|
channel: this.channelName,
|
|
9965
9965
|
error: error instanceof Error ? error.message : String(error),
|
|
9966
9966
|
});
|
|
@@ -9974,7 +9974,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9974
9974
|
// Setup visibility change monitoring
|
|
9975
9975
|
this.visibilityChangeHandler = () => {
|
|
9976
9976
|
const isHidden = document.hidden;
|
|
9977
|
-
logger$
|
|
9977
|
+
logger$13.debug('broadcast_channel_visibility_changed', {
|
|
9978
9978
|
channel: this.channelName,
|
|
9979
9979
|
connector_id: this.connectorId,
|
|
9980
9980
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -9983,7 +9983,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9983
9983
|
// Pause/resume connector based on visibility
|
|
9984
9984
|
if (isHidden && this.state === ConnectorState.STARTED) {
|
|
9985
9985
|
this.pause().catch((err) => {
|
|
9986
|
-
logger$
|
|
9986
|
+
logger$13.warning('broadcast_channel_pause_failed', {
|
|
9987
9987
|
channel: this.channelName,
|
|
9988
9988
|
connector_id: this.connectorId,
|
|
9989
9989
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -9992,7 +9992,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9992
9992
|
}
|
|
9993
9993
|
else if (!isHidden && this.state === ConnectorState.PAUSED) {
|
|
9994
9994
|
this.resume().catch((err) => {
|
|
9995
|
-
logger$
|
|
9995
|
+
logger$13.warning('broadcast_channel_resume_failed', {
|
|
9996
9996
|
channel: this.channelName,
|
|
9997
9997
|
connector_id: this.connectorId,
|
|
9998
9998
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -10006,7 +10006,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10006
10006
|
// Track page lifecycle events to detect browser unload/discard
|
|
10007
10007
|
if (typeof window !== 'undefined') {
|
|
10008
10008
|
const lifecycleLogger = (event) => {
|
|
10009
|
-
logger$
|
|
10009
|
+
logger$13.debug('broadcast_channel_page_lifecycle', {
|
|
10010
10010
|
channel: this.channelName,
|
|
10011
10011
|
connector_id: this.connectorId,
|
|
10012
10012
|
event_type: event.type,
|
|
@@ -10022,7 +10022,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10022
10022
|
document.addEventListener('resume', lifecycleLogger);
|
|
10023
10023
|
}
|
|
10024
10024
|
// Log initial state with detailed visibility info
|
|
10025
|
-
logger$
|
|
10025
|
+
logger$13.debug('broadcast_channel_initial_visibility', {
|
|
10026
10026
|
channel: this.channelName,
|
|
10027
10027
|
connector_id: this.connectorId,
|
|
10028
10028
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -10054,14 +10054,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10054
10054
|
}
|
|
10055
10055
|
catch (error) {
|
|
10056
10056
|
if (error instanceof QueueFullError) {
|
|
10057
|
-
logger$
|
|
10057
|
+
logger$13.warning('broadcast_channel_push_queue_full', {
|
|
10058
10058
|
channel: this.channelName,
|
|
10059
10059
|
inbox_capacity: this.inboxCapacity,
|
|
10060
10060
|
inbox_remaining_capacity: this.inbox.remainingCapacity,
|
|
10061
10061
|
});
|
|
10062
10062
|
throw error;
|
|
10063
10063
|
}
|
|
10064
|
-
logger$
|
|
10064
|
+
logger$13.error('broadcast_channel_push_failed', {
|
|
10065
10065
|
channel: this.channelName,
|
|
10066
10066
|
error: error instanceof Error ? error.message : String(error),
|
|
10067
10067
|
});
|
|
@@ -10071,7 +10071,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10071
10071
|
async _transportSendBytes(data) {
|
|
10072
10072
|
ensureBroadcastEnvironment();
|
|
10073
10073
|
const targetNodeId = this.targetNodeId ?? '*';
|
|
10074
|
-
logger$
|
|
10074
|
+
logger$13.debug('broadcast_channel_message_sending', {
|
|
10075
10075
|
channel: this.channelName,
|
|
10076
10076
|
sender_id: this.connectorId,
|
|
10077
10077
|
sender_node_id: this.localNodeId,
|
|
@@ -10092,7 +10092,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10092
10092
|
return item;
|
|
10093
10093
|
}
|
|
10094
10094
|
async _transportClose(code, reason) {
|
|
10095
|
-
logger$
|
|
10095
|
+
logger$13.debug('broadcast_channel_transport_closing', {
|
|
10096
10096
|
channel: this.channelName,
|
|
10097
10097
|
connector_id: this.connectorId,
|
|
10098
10098
|
code,
|
|
@@ -10101,14 +10101,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10101
10101
|
timestamp: new Date().toISOString(),
|
|
10102
10102
|
});
|
|
10103
10103
|
if (this.listenerRegistered) {
|
|
10104
|
-
logger$
|
|
10104
|
+
logger$13.debug('broadcast_channel_removing_listener', {
|
|
10105
10105
|
channel: this.channelName,
|
|
10106
10106
|
connector_id: this.connectorId,
|
|
10107
10107
|
timestamp: new Date().toISOString(),
|
|
10108
10108
|
});
|
|
10109
10109
|
this.channel.removeEventListener('message', this.onMsg);
|
|
10110
10110
|
this.listenerRegistered = false;
|
|
10111
|
-
logger$
|
|
10111
|
+
logger$13.debug('broadcast_channel_listener_removed', {
|
|
10112
10112
|
channel: this.channelName,
|
|
10113
10113
|
connector_id: this.connectorId,
|
|
10114
10114
|
timestamp: new Date().toISOString(),
|
|
@@ -10121,13 +10121,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10121
10121
|
this.visibilityChangeListenerRegistered = false;
|
|
10122
10122
|
this.visibilityChangeHandler = undefined;
|
|
10123
10123
|
}
|
|
10124
|
-
logger$
|
|
10124
|
+
logger$13.debug('broadcast_channel_closing', {
|
|
10125
10125
|
channel: this.channelName,
|
|
10126
10126
|
connector_id: this.connectorId,
|
|
10127
10127
|
timestamp: new Date().toISOString(),
|
|
10128
10128
|
});
|
|
10129
10129
|
this.channel.close();
|
|
10130
|
-
logger$
|
|
10130
|
+
logger$13.debug('broadcast_channel_closed', {
|
|
10131
10131
|
channel: this.channelName,
|
|
10132
10132
|
connector_id: this.connectorId,
|
|
10133
10133
|
timestamp: new Date().toISOString(),
|
|
@@ -10151,7 +10151,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10151
10151
|
if (targetNodeId &&
|
|
10152
10152
|
targetNodeId !== '*' &&
|
|
10153
10153
|
targetNodeId !== this.localNodeId) {
|
|
10154
|
-
logger$
|
|
10154
|
+
logger$13.debug('broadcast_channel_message_rejected', {
|
|
10155
10155
|
channel: this.channelName,
|
|
10156
10156
|
connector_id: this.connectorId,
|
|
10157
10157
|
reason: 'wildcard_target_mismatch',
|
|
@@ -10167,7 +10167,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10167
10167
|
if (expectedSender &&
|
|
10168
10168
|
expectedSender !== '*' &&
|
|
10169
10169
|
senderNodeId !== expectedSender) {
|
|
10170
|
-
logger$
|
|
10170
|
+
logger$13.debug('broadcast_channel_message_rejected', {
|
|
10171
10171
|
channel: this.channelName,
|
|
10172
10172
|
connector_id: this.connectorId,
|
|
10173
10173
|
reason: 'unexpected_sender',
|
|
@@ -10180,7 +10180,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10180
10180
|
if (targetNodeId &&
|
|
10181
10181
|
targetNodeId !== '*' &&
|
|
10182
10182
|
targetNodeId !== this.localNodeId) {
|
|
10183
|
-
logger$
|
|
10183
|
+
logger$13.debug('broadcast_channel_message_rejected', {
|
|
10184
10184
|
channel: this.channelName,
|
|
10185
10185
|
connector_id: this.connectorId,
|
|
10186
10186
|
reason: 'unexpected_target',
|
|
@@ -10205,7 +10205,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10205
10205
|
return 'unknown';
|
|
10206
10206
|
}
|
|
10207
10207
|
logInboxSnapshot(event, extra = {}) {
|
|
10208
|
-
logger$
|
|
10208
|
+
logger$13.debug(event, {
|
|
10209
10209
|
channel: this.channelName,
|
|
10210
10210
|
connector_id: this.connectorId,
|
|
10211
10211
|
connector_state: this.state,
|
|
@@ -10221,7 +10221,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10221
10221
|
await super.start(inboundHandler);
|
|
10222
10222
|
// After transitioning to STARTED, check if tab is already hidden
|
|
10223
10223
|
if (typeof document !== 'undefined' && document.hidden) {
|
|
10224
|
-
logger$
|
|
10224
|
+
logger$13.debug('broadcast_channel_start_in_hidden_tab', {
|
|
10225
10225
|
channel: this.channelName,
|
|
10226
10226
|
connector_id: this.connectorId,
|
|
10227
10227
|
document_hidden: document.hidden,
|
|
@@ -10231,7 +10231,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10231
10231
|
});
|
|
10232
10232
|
// Immediately pause if tab is hidden at start time
|
|
10233
10233
|
await this.pause().catch((err) => {
|
|
10234
|
-
logger$
|
|
10234
|
+
logger$13.warning('broadcast_channel_initial_pause_failed', {
|
|
10235
10235
|
channel: this.channelName,
|
|
10236
10236
|
connector_id: this.connectorId,
|
|
10237
10237
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -10249,7 +10249,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10249
10249
|
return;
|
|
10250
10250
|
}
|
|
10251
10251
|
this.targetNodeId = normalized;
|
|
10252
|
-
logger$
|
|
10252
|
+
logger$13.debug('broadcast_channel_target_updated', {
|
|
10253
10253
|
channel: this.channelName,
|
|
10254
10254
|
connector_id: this.connectorId,
|
|
10255
10255
|
local_node_id: this.localNodeId,
|
|
@@ -10259,7 +10259,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10259
10259
|
}
|
|
10260
10260
|
setWildcardTarget() {
|
|
10261
10261
|
this.targetNodeId = '*';
|
|
10262
|
-
logger$
|
|
10262
|
+
logger$13.debug('broadcast_channel_target_updated', {
|
|
10263
10263
|
channel: this.channelName,
|
|
10264
10264
|
connector_id: this.connectorId,
|
|
10265
10265
|
local_node_id: this.localNodeId,
|
|
@@ -10432,7 +10432,7 @@ function broadcastChannelGrantToConnectorConfig(grant) {
|
|
|
10432
10432
|
return config;
|
|
10433
10433
|
}
|
|
10434
10434
|
|
|
10435
|
-
const logger$
|
|
10435
|
+
const logger$12 = getLogger('naylence.fame.node.upstream_session_manager');
|
|
10436
10436
|
function isPlainRecord$4(value) {
|
|
10437
10437
|
if (typeof value !== 'object' || value === null) {
|
|
10438
10438
|
return false;
|
|
@@ -10505,6 +10505,7 @@ function normalizeOptions$k(options) {
|
|
|
10505
10505
|
const onEpochChangeValue = pickOption$2(record, 'onEpochChange', 'on_epoch_change');
|
|
10506
10506
|
const onEpochChange = typeof onEpochChangeValue === 'function' ? onEpochChangeValue : undefined;
|
|
10507
10507
|
const admissionClient = pickOption$2(record, 'admissionClient', 'admission_client');
|
|
10508
|
+
const retryPolicy = pickOption$2(record, 'retryPolicy', 'retry_policy');
|
|
10508
10509
|
return {
|
|
10509
10510
|
node,
|
|
10510
10511
|
attachClient,
|
|
@@ -10516,6 +10517,7 @@ function normalizeOptions$k(options) {
|
|
|
10516
10517
|
onAttach: validatedOnAttach,
|
|
10517
10518
|
onEpochChange,
|
|
10518
10519
|
admissionClient: admissionClient ?? undefined,
|
|
10520
|
+
retryPolicy: retryPolicy ?? undefined,
|
|
10519
10521
|
};
|
|
10520
10522
|
}
|
|
10521
10523
|
class UpstreamSessionManager extends TaskSpawner {
|
|
@@ -10535,6 +10537,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10535
10537
|
this.hadSuccessfulAttach = false;
|
|
10536
10538
|
this.lastConnectorState = null;
|
|
10537
10539
|
this.connectEpoch = 0;
|
|
10540
|
+
this.initialAttempts = 0;
|
|
10538
10541
|
this._visibilityHandler = null;
|
|
10539
10542
|
const options = normalizeOptions$k(optionsInput);
|
|
10540
10543
|
this.node = options.node;
|
|
@@ -10548,31 +10551,34 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10548
10551
|
this.admissionClient =
|
|
10549
10552
|
options.admissionClient ?? options.node.admissionClient;
|
|
10550
10553
|
this.wrappedHandler = this.makeHeartbeatEnabledHandler(options.inboundHandler);
|
|
10551
|
-
|
|
10554
|
+
// Store the connection retry policy (can be null, in which case default behavior applies)
|
|
10555
|
+
this.connectionRetryPolicy = options.retryPolicy ?? null;
|
|
10556
|
+
logger$12.debug('created_upstream_session_manager', {
|
|
10552
10557
|
target_system_id: this.targetSystemId,
|
|
10558
|
+
has_retry_policy: this.connectionRetryPolicy !== null,
|
|
10553
10559
|
});
|
|
10554
10560
|
}
|
|
10555
10561
|
get systemId() {
|
|
10556
10562
|
return this.targetSystemId;
|
|
10557
10563
|
}
|
|
10558
10564
|
setupVisibilityListener() {
|
|
10559
|
-
logger$
|
|
10565
|
+
logger$12.debug('setup_visibility_listener_called', {
|
|
10560
10566
|
has_document: typeof document !== 'undefined',
|
|
10561
10567
|
});
|
|
10562
10568
|
if (typeof document !== 'undefined' && document.addEventListener) {
|
|
10563
10569
|
this._visibilityHandler = () => {
|
|
10564
|
-
logger$
|
|
10570
|
+
logger$12.debug('visibility_change_event_fired', {
|
|
10565
10571
|
state: document.visibilityState,
|
|
10566
10572
|
});
|
|
10567
10573
|
if (document.visibilityState === 'visible') {
|
|
10568
|
-
logger$
|
|
10574
|
+
logger$12.debug('visibility_change_detected_waking_up');
|
|
10569
10575
|
this.wakeEvent.set();
|
|
10570
10576
|
}
|
|
10571
10577
|
};
|
|
10572
10578
|
document.addEventListener('visibilitychange', this._visibilityHandler);
|
|
10573
10579
|
}
|
|
10574
10580
|
else {
|
|
10575
|
-
logger$
|
|
10581
|
+
logger$12.debug('setup_visibility_listener_skipped_no_document');
|
|
10576
10582
|
}
|
|
10577
10583
|
}
|
|
10578
10584
|
teardownVisibilityListener() {
|
|
@@ -10605,13 +10611,13 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10605
10611
|
}
|
|
10606
10612
|
throw new FameConnectError('Upstream session manager failed to attach');
|
|
10607
10613
|
}
|
|
10608
|
-
logger$
|
|
10614
|
+
logger$12.debug('upstream_session_manager_started');
|
|
10609
10615
|
}
|
|
10610
10616
|
getActiveConnector() {
|
|
10611
10617
|
return this.connector;
|
|
10612
10618
|
}
|
|
10613
10619
|
async stop() {
|
|
10614
|
-
logger$
|
|
10620
|
+
logger$12.debug('upstream_session_manager_stopping');
|
|
10615
10621
|
this.teardownVisibilityListener();
|
|
10616
10622
|
this.stopEvent.set();
|
|
10617
10623
|
this.currentStopSubtasks?.set();
|
|
@@ -10622,7 +10628,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10622
10628
|
}
|
|
10623
10629
|
catch (error) {
|
|
10624
10630
|
if (!(error instanceof TaskCancelledError)) {
|
|
10625
|
-
logger$
|
|
10631
|
+
logger$12.debug('fsm_task_stopped_with_error', {
|
|
10626
10632
|
error: error.message,
|
|
10627
10633
|
});
|
|
10628
10634
|
}
|
|
@@ -10631,13 +10637,13 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10631
10637
|
}
|
|
10632
10638
|
if (this.connector) {
|
|
10633
10639
|
await this.connector.stop().catch((error) => {
|
|
10634
|
-
logger$
|
|
10640
|
+
logger$12.debug('connector_stop_error', {
|
|
10635
10641
|
error: error.message,
|
|
10636
10642
|
});
|
|
10637
10643
|
});
|
|
10638
10644
|
this.connector = null;
|
|
10639
10645
|
}
|
|
10640
|
-
logger$
|
|
10646
|
+
logger$12.debug('upstream_session_manager_stopped');
|
|
10641
10647
|
}
|
|
10642
10648
|
async send(envelope) {
|
|
10643
10649
|
if (this.messageQueue.length >= UpstreamSessionManager.TX_QUEUE_MAX) {
|
|
@@ -10665,11 +10671,14 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10665
10671
|
}
|
|
10666
10672
|
async fsmLoop() {
|
|
10667
10673
|
let delay = UpstreamSessionManager.BACKOFF_INITIAL;
|
|
10674
|
+
this.initialAttempts = 0;
|
|
10668
10675
|
while (!this.stopEvent.isSet()) {
|
|
10669
10676
|
const startTime = Date.now();
|
|
10677
|
+
this.initialAttempts += 1;
|
|
10670
10678
|
try {
|
|
10671
10679
|
await this.connectCycle();
|
|
10672
10680
|
delay = UpstreamSessionManager.BACKOFF_INITIAL;
|
|
10681
|
+
this.initialAttempts = 0; // Reset on success
|
|
10673
10682
|
}
|
|
10674
10683
|
catch (error) {
|
|
10675
10684
|
// Reset backoff if the connection was alive for more than 10 seconds
|
|
@@ -10679,32 +10688,38 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10679
10688
|
if (error instanceof TaskCancelledError) {
|
|
10680
10689
|
throw error;
|
|
10681
10690
|
}
|
|
10691
|
+
// Determine if we should fail-fast or retry
|
|
10692
|
+
const shouldFailFast = this.shouldFailFastOnError(error);
|
|
10682
10693
|
if (error instanceof FameTransportClose ||
|
|
10683
10694
|
error instanceof FameConnectError) {
|
|
10684
|
-
logger$
|
|
10695
|
+
logger$12.warning('upstream_link_closed', {
|
|
10685
10696
|
error: error.message,
|
|
10686
|
-
will_retry:
|
|
10697
|
+
will_retry: !shouldFailFast,
|
|
10698
|
+
attempt: this.initialAttempts,
|
|
10699
|
+
has_retry_policy: this.connectionRetryPolicy !== null,
|
|
10687
10700
|
});
|
|
10688
|
-
if (
|
|
10701
|
+
if (shouldFailFast && error instanceof FameConnectError) {
|
|
10689
10702
|
throw error;
|
|
10690
10703
|
}
|
|
10691
10704
|
}
|
|
10692
10705
|
else {
|
|
10693
10706
|
const err = error;
|
|
10694
10707
|
if (err.name === 'OAuth2PkceRedirectInitiatedError') {
|
|
10695
|
-
logger$
|
|
10708
|
+
logger$12.info('upstream_link_redirecting', {
|
|
10696
10709
|
error: err.message,
|
|
10697
10710
|
will_retry: true,
|
|
10698
10711
|
});
|
|
10699
10712
|
}
|
|
10700
10713
|
else {
|
|
10701
|
-
logger$
|
|
10714
|
+
logger$12.warning('upstream_link_closed', {
|
|
10702
10715
|
error: err.message,
|
|
10703
|
-
will_retry:
|
|
10716
|
+
will_retry: !shouldFailFast,
|
|
10717
|
+
attempt: this.initialAttempts,
|
|
10718
|
+
has_retry_policy: this.connectionRetryPolicy !== null,
|
|
10704
10719
|
exc_info: true,
|
|
10705
10720
|
});
|
|
10706
10721
|
}
|
|
10707
|
-
if (
|
|
10722
|
+
if (shouldFailFast) {
|
|
10708
10723
|
throw error;
|
|
10709
10724
|
}
|
|
10710
10725
|
}
|
|
@@ -10712,52 +10727,77 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10712
10727
|
}
|
|
10713
10728
|
}
|
|
10714
10729
|
}
|
|
10730
|
+
/**
|
|
10731
|
+
* Determine whether to fail immediately or continue retrying.
|
|
10732
|
+
* Returns true if we should throw the error instead of retrying.
|
|
10733
|
+
*/
|
|
10734
|
+
shouldFailFastOnError(error) {
|
|
10735
|
+
// If no policy is configured, use legacy behavior (fail-fast after first attempt)
|
|
10736
|
+
if (!this.connectionRetryPolicy) {
|
|
10737
|
+
// After first successful attach, always retry (existing behavior)
|
|
10738
|
+
if (this.hadSuccessfulAttach) {
|
|
10739
|
+
return false;
|
|
10740
|
+
}
|
|
10741
|
+
// Without a policy, fail on first error
|
|
10742
|
+
return true;
|
|
10743
|
+
}
|
|
10744
|
+
// Delegate decision to the policy
|
|
10745
|
+
const shouldRetry = this.connectionRetryPolicy.shouldRetry({
|
|
10746
|
+
hadSuccessfulAttach: this.hadSuccessfulAttach,
|
|
10747
|
+
attemptNumber: this.initialAttempts,
|
|
10748
|
+
error,
|
|
10749
|
+
});
|
|
10750
|
+
return !shouldRetry;
|
|
10751
|
+
}
|
|
10715
10752
|
async applyBackoff(delay) {
|
|
10716
10753
|
const jitter = Math.random() * delay;
|
|
10717
|
-
await this.sleepWithStop(delay + jitter);
|
|
10754
|
+
const wasWoken = await this.sleepWithStop(delay + jitter);
|
|
10755
|
+
// If sleep was interrupted by visibility change (user returned to tab),
|
|
10756
|
+
// reset backoff to initial delay for immediate retry with fresh backoff
|
|
10757
|
+
if (wasWoken) {
|
|
10758
|
+
logger$12.debug('backoff_reset_on_visibility_change', {
|
|
10759
|
+
previous_delay: delay,
|
|
10760
|
+
new_delay: UpstreamSessionManager.BACKOFF_INITIAL,
|
|
10761
|
+
});
|
|
10762
|
+
return UpstreamSessionManager.BACKOFF_INITIAL;
|
|
10763
|
+
}
|
|
10718
10764
|
return Math.min(delay * 2, UpstreamSessionManager.BACKOFF_CAP);
|
|
10719
10765
|
}
|
|
10766
|
+
/**
|
|
10767
|
+
* Sleep for the specified duration, but can be interrupted by stop or wake events.
|
|
10768
|
+
* @returns true if interrupted by wake event (e.g., visibility change), false otherwise
|
|
10769
|
+
*/
|
|
10720
10770
|
async sleepWithStop(delaySeconds) {
|
|
10721
10771
|
if (delaySeconds <= 0) {
|
|
10722
|
-
return;
|
|
10723
|
-
}
|
|
10724
|
-
// If the document is visible, cap the backoff delay to improve UX
|
|
10725
|
-
// This ensures that if the user is watching, we retry quickly (e.g. 1s)
|
|
10726
|
-
// instead of waiting for the full exponential backoff (up to 30s).
|
|
10727
|
-
let effectiveDelay = delaySeconds;
|
|
10728
|
-
if (typeof document !== 'undefined' &&
|
|
10729
|
-
document.visibilityState === 'visible') {
|
|
10730
|
-
effectiveDelay = Math.min(delaySeconds, 1.0);
|
|
10731
|
-
if (effectiveDelay < delaySeconds) {
|
|
10732
|
-
logger$11.debug('sleep_reduced_document_visible', {
|
|
10733
|
-
original: delaySeconds,
|
|
10734
|
-
new: effectiveDelay,
|
|
10735
|
-
});
|
|
10736
|
-
}
|
|
10772
|
+
return false;
|
|
10737
10773
|
}
|
|
10774
|
+
// Check if wake event is already set (e.g., visibility just changed)
|
|
10738
10775
|
if (this.wakeEvent.isSet()) {
|
|
10739
10776
|
this.wakeEvent.clear();
|
|
10740
|
-
|
|
10777
|
+
logger$12.debug('sleep_skipped_wake_event_pending');
|
|
10778
|
+
return true;
|
|
10741
10779
|
}
|
|
10742
10780
|
let timeout;
|
|
10743
10781
|
const sleepPromise = new Promise((resolve) => {
|
|
10744
10782
|
timeout = setTimeout(() => {
|
|
10745
10783
|
timeout = undefined;
|
|
10746
10784
|
resolve();
|
|
10747
|
-
},
|
|
10785
|
+
}, delaySeconds * 1000);
|
|
10748
10786
|
});
|
|
10749
10787
|
await Promise.race([
|
|
10750
10788
|
sleepPromise,
|
|
10751
10789
|
this.stopEvent.wait(),
|
|
10752
10790
|
this.wakeEvent.wait(),
|
|
10753
10791
|
]);
|
|
10754
|
-
|
|
10755
|
-
|
|
10792
|
+
const wasWoken = this.wakeEvent.isSet();
|
|
10793
|
+
if (wasWoken) {
|
|
10794
|
+
logger$12.debug('sleep_interrupted_by_wake_event');
|
|
10756
10795
|
this.wakeEvent.clear();
|
|
10757
10796
|
}
|
|
10758
10797
|
if (timeout !== undefined) {
|
|
10759
10798
|
clearTimeout(timeout);
|
|
10760
10799
|
}
|
|
10800
|
+
return wasWoken;
|
|
10761
10801
|
}
|
|
10762
10802
|
getNodeAttachGrant(connectionGrants) {
|
|
10763
10803
|
if (!connectionGrants) {
|
|
@@ -10814,7 +10854,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10814
10854
|
await connector.start(this.wrappedHandler);
|
|
10815
10855
|
this.connector = connector;
|
|
10816
10856
|
const callbackGrants = this.node.gatherSupportedCallbackGrants();
|
|
10817
|
-
logger$
|
|
10857
|
+
logger$12.debug('callback_grants_before_augmentation', {
|
|
10818
10858
|
count: callbackGrants.length,
|
|
10819
10859
|
types: callbackGrants.map((g) => g.type),
|
|
10820
10860
|
});
|
|
@@ -10824,7 +10864,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10824
10864
|
const broadcastCallbackGrant = shouldAddBroadcastGrant
|
|
10825
10865
|
? this.createBroadcastCallbackGrant(grant)
|
|
10826
10866
|
: null;
|
|
10827
|
-
logger$
|
|
10867
|
+
logger$12.debug('broadcast_callback_grant_check', {
|
|
10828
10868
|
should_add: shouldAddBroadcastGrant,
|
|
10829
10869
|
grant_created: !!broadcastCallbackGrant,
|
|
10830
10870
|
});
|
|
@@ -10843,12 +10883,12 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10843
10883
|
const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
|
|
10844
10884
|
if (!isDuplicate) {
|
|
10845
10885
|
callbackGrants.push(grant);
|
|
10846
|
-
logger$
|
|
10886
|
+
logger$12.debug('added_connection_grant_as_callback', {
|
|
10847
10887
|
type: grant.type,
|
|
10848
10888
|
});
|
|
10849
10889
|
}
|
|
10850
10890
|
else {
|
|
10851
|
-
logger$
|
|
10891
|
+
logger$12.debug('skipped_duplicate_connection_grant', {
|
|
10852
10892
|
type: grant.type,
|
|
10853
10893
|
});
|
|
10854
10894
|
}
|
|
@@ -10860,12 +10900,12 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10860
10900
|
if (broadcastCallbackGrant &&
|
|
10861
10901
|
this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
|
|
10862
10902
|
callbackGrants.push(broadcastCallbackGrant);
|
|
10863
|
-
logger$
|
|
10903
|
+
logger$12.debug('added_broadcast_callback_grant');
|
|
10864
10904
|
}
|
|
10865
10905
|
else if (broadcastCallbackGrant) {
|
|
10866
|
-
logger$
|
|
10906
|
+
logger$12.debug('skipped_duplicate_broadcast_callback_grant');
|
|
10867
10907
|
}
|
|
10868
|
-
logger$
|
|
10908
|
+
logger$12.debug('callback_grants_after_augmentation', {
|
|
10869
10909
|
count: callbackGrants.length,
|
|
10870
10910
|
types: callbackGrants.map((g) => g.type),
|
|
10871
10911
|
});
|
|
@@ -10878,7 +10918,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10878
10918
|
targetAware.setTargetNodeId(this.targetSystemId);
|
|
10879
10919
|
}
|
|
10880
10920
|
catch (error) {
|
|
10881
|
-
logger$
|
|
10921
|
+
logger$12.warning('broadcast_channel_target_apply_failed', {
|
|
10882
10922
|
error: error instanceof Error ? error.message : String(error),
|
|
10883
10923
|
target_node_id: this.targetSystemId,
|
|
10884
10924
|
});
|
|
@@ -10900,14 +10940,14 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10900
10940
|
});
|
|
10901
10941
|
}
|
|
10902
10942
|
else {
|
|
10903
|
-
logger$
|
|
10943
|
+
logger$12.warning('parent_epoch_changed', { epoch });
|
|
10904
10944
|
}
|
|
10905
10945
|
}
|
|
10906
10946
|
if (!this.readyEvent.isSet()) {
|
|
10907
10947
|
this.readyEvent.set();
|
|
10908
10948
|
}
|
|
10909
10949
|
if (this.messageQueue.length > 0) {
|
|
10910
|
-
logger$
|
|
10950
|
+
logger$12.debug('flushing_buffered_frames', {
|
|
10911
10951
|
queue_size: this.messageQueue.length,
|
|
10912
10952
|
});
|
|
10913
10953
|
this.queueEvent.set();
|
|
@@ -10924,12 +10964,12 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10924
10964
|
name: `expiry-guard-${this.connectEpoch}`,
|
|
10925
10965
|
});
|
|
10926
10966
|
if (this.hadSuccessfulAttach) {
|
|
10927
|
-
logger$
|
|
10967
|
+
logger$12.debug('reconnected_to_upstream', {
|
|
10928
10968
|
attach_expires_at: attachInfo.attachExpiresAt?.toISOString?.() ?? null,
|
|
10929
10969
|
});
|
|
10930
10970
|
}
|
|
10931
10971
|
else {
|
|
10932
|
-
logger$
|
|
10972
|
+
logger$12.debug('connected_to_upstream', {
|
|
10933
10973
|
attach_expires_at: attachInfo.attachExpiresAt?.toISOString?.() ?? null,
|
|
10934
10974
|
});
|
|
10935
10975
|
}
|
|
@@ -10947,18 +10987,18 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10947
10987
|
this.currentStopSubtasks = null;
|
|
10948
10988
|
await Promise.allSettled(tasks.map((task) => task.promise));
|
|
10949
10989
|
if (this.connector) {
|
|
10950
|
-
logger$
|
|
10990
|
+
logger$12.debug('upstream_stopping_old_connector', {
|
|
10951
10991
|
connect_epoch: this.connectEpoch,
|
|
10952
10992
|
target_system_id: this.targetSystemId,
|
|
10953
10993
|
timestamp: new Date().toISOString(),
|
|
10954
10994
|
});
|
|
10955
10995
|
await this.connector.stop().catch((err) => {
|
|
10956
|
-
logger$
|
|
10996
|
+
logger$12.warning('upstream_connector_stop_error', {
|
|
10957
10997
|
connect_epoch: this.connectEpoch,
|
|
10958
10998
|
error: err instanceof Error ? err.message : String(err),
|
|
10959
10999
|
});
|
|
10960
11000
|
});
|
|
10961
|
-
logger$
|
|
11001
|
+
logger$12.debug('upstream_old_connector_stopped', {
|
|
10962
11002
|
connect_epoch: this.connectEpoch,
|
|
10963
11003
|
target_system_id: this.targetSystemId,
|
|
10964
11004
|
timestamp: new Date().toISOString(),
|
|
@@ -11011,7 +11051,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11011
11051
|
});
|
|
11012
11052
|
}
|
|
11013
11053
|
catch (error) {
|
|
11014
|
-
logger$
|
|
11054
|
+
logger$12.debug('broadcast_callback_grant_generation_failed', {
|
|
11015
11055
|
error: error instanceof Error ? error.message : String(error),
|
|
11016
11056
|
});
|
|
11017
11057
|
return null;
|
|
@@ -11066,7 +11106,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11066
11106
|
}
|
|
11067
11107
|
}
|
|
11068
11108
|
async heartbeatLoop(connector, stopEvt, signal) {
|
|
11069
|
-
logger$
|
|
11109
|
+
logger$12.debug('starting_heartbeat_loop');
|
|
11070
11110
|
const intervalMs = UpstreamSessionManager.HEARTBEAT_INTERVAL * 1000;
|
|
11071
11111
|
const graceMs = intervalMs * UpstreamSessionManager.HEARTBEAT_GRACE;
|
|
11072
11112
|
this.lastHeartbeatAckTime = Date.now();
|
|
@@ -11102,7 +11142,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11102
11142
|
// Skip heartbeat if connector is paused (e.g., tab is hidden)
|
|
11103
11143
|
// Keep ack time current so we don't timeout immediately after resuming
|
|
11104
11144
|
if (currentState === ConnectorState.PAUSED) {
|
|
11105
|
-
logger$
|
|
11145
|
+
logger$12.debug('skipping_heartbeat_connector_paused', {
|
|
11106
11146
|
connector_state: currentState,
|
|
11107
11147
|
});
|
|
11108
11148
|
this.lastHeartbeatAckTime = Date.now();
|
|
@@ -11111,14 +11151,14 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11111
11151
|
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
11112
11152
|
if (previousState === ConnectorState.PAUSED &&
|
|
11113
11153
|
currentState === ConnectorState.STARTED) {
|
|
11114
|
-
logger$
|
|
11154
|
+
logger$12.debug('connector_just_resumed_resetting_ack_time', {
|
|
11115
11155
|
previous_state: previousState,
|
|
11116
11156
|
current_state: currentState,
|
|
11117
11157
|
});
|
|
11118
11158
|
this.lastHeartbeatAckTime = Date.now();
|
|
11119
11159
|
}
|
|
11120
11160
|
const envelope = await this.makeHeartbeatEnvelope();
|
|
11121
|
-
logger$
|
|
11161
|
+
logger$12.debug('sending_heartbeat', {
|
|
11122
11162
|
hb_corr_id: envelope.corrId,
|
|
11123
11163
|
hb_env_id: envelope.id,
|
|
11124
11164
|
});
|
|
@@ -11144,7 +11184,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11144
11184
|
throw new FameConnectError('missed heartbeat acknowledgement');
|
|
11145
11185
|
}
|
|
11146
11186
|
}
|
|
11147
|
-
logger$
|
|
11187
|
+
logger$12.debug('completed_heartbeat_loop');
|
|
11148
11188
|
}
|
|
11149
11189
|
async messagePumpLoop(connector, stopEvt, signal) {
|
|
11150
11190
|
while (!stopEvt.isSet() && !signal?.aborted) {
|
|
@@ -11161,19 +11201,19 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11161
11201
|
if (!envelope) {
|
|
11162
11202
|
continue;
|
|
11163
11203
|
}
|
|
11164
|
-
logger$
|
|
11204
|
+
logger$12.debug('upstream_pump_sending_envelope', {
|
|
11165
11205
|
envelopeId: envelope.id,
|
|
11166
11206
|
type: envelope.frame?.type,
|
|
11167
11207
|
});
|
|
11168
11208
|
try {
|
|
11169
11209
|
await connector.send(envelope);
|
|
11170
|
-
logger$
|
|
11210
|
+
logger$12.debug('upstream_pump_sent_envelope', {
|
|
11171
11211
|
envelopeId: envelope.id,
|
|
11172
11212
|
});
|
|
11173
11213
|
}
|
|
11174
11214
|
catch (error) {
|
|
11175
11215
|
if (error instanceof FameMessageTooLarge) {
|
|
11176
|
-
logger$
|
|
11216
|
+
logger$12.error('failed_to_send_message', { error: error.message });
|
|
11177
11217
|
await this.handleMessageTooLarge(envelope, error.message);
|
|
11178
11218
|
}
|
|
11179
11219
|
else if (error instanceof FameTransportClose) {
|
|
@@ -11235,7 +11275,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11235
11275
|
await fabric.send(ackEnvelope);
|
|
11236
11276
|
}
|
|
11237
11277
|
catch (error) {
|
|
11238
|
-
logger$
|
|
11278
|
+
logger$12.warning('failed_to_send_nack', {
|
|
11239
11279
|
error: error.message,
|
|
11240
11280
|
});
|
|
11241
11281
|
}
|
|
@@ -11249,7 +11289,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11249
11289
|
timestamps.push(info.attachExpiresAt);
|
|
11250
11290
|
}
|
|
11251
11291
|
if (!timestamps.length) {
|
|
11252
|
-
logger$
|
|
11292
|
+
logger$12.debug('no_ttl_expiry_configured');
|
|
11253
11293
|
await this.waitEvent(stopEvt, signal);
|
|
11254
11294
|
return;
|
|
11255
11295
|
}
|
|
@@ -11258,7 +11298,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11258
11298
|
let delaySeconds = (earliest.getTime() - now.getTime()) / 1000 -
|
|
11259
11299
|
UpstreamSessionManager.JWT_REFRESH_SAFETY;
|
|
11260
11300
|
delaySeconds = Math.max(delaySeconds, UpstreamSessionManager.JWT_REFRESH_SAFETY);
|
|
11261
|
-
logger$
|
|
11301
|
+
logger$12.debug('ttl_expiry_guard_started', {
|
|
11262
11302
|
welcome_expires_at: welcome.frame.expiresAt ?? null,
|
|
11263
11303
|
attach_expires_at: info.attachExpiresAt?.toISOString?.() ?? null,
|
|
11264
11304
|
earliest_expiry: earliest.toISOString(),
|
|
@@ -11286,7 +11326,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11286
11326
|
}
|
|
11287
11327
|
}
|
|
11288
11328
|
if (!stopEvt.isSet()) {
|
|
11289
|
-
logger$
|
|
11329
|
+
logger$12.debug('ttl_expiry_triggered_reconnect', {
|
|
11290
11330
|
expires_at: earliest.toISOString(),
|
|
11291
11331
|
current_time: new Date().toISOString(),
|
|
11292
11332
|
seconds_before_expiry: UpstreamSessionManager.JWT_REFRESH_SAFETY,
|
|
@@ -11331,7 +11371,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11331
11371
|
}
|
|
11332
11372
|
await this.node.dispatchEnvelopeEvent('onEnvelopeReceived', this.node, env, context);
|
|
11333
11373
|
if (env.frame.type === 'NodeHeartbeatAck') {
|
|
11334
|
-
logger$
|
|
11374
|
+
logger$12.debug('received_heartbeat_ack', {
|
|
11335
11375
|
hb_ack_env_id: env.id,
|
|
11336
11376
|
hb_ack_corr_id: env.corrId,
|
|
11337
11377
|
hb_routing_epoch: env.frame.routingEpoch,
|
|
@@ -11345,7 +11385,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11345
11385
|
await this.onEpochChange(epoch);
|
|
11346
11386
|
}
|
|
11347
11387
|
else {
|
|
11348
|
-
logger$
|
|
11388
|
+
logger$12.warning('parent_epoch_changed', { epoch });
|
|
11349
11389
|
}
|
|
11350
11390
|
}
|
|
11351
11391
|
return;
|
|
@@ -11364,7 +11404,7 @@ UpstreamSessionManager.TX_QUEUE_MAX = 512;
|
|
|
11364
11404
|
UpstreamSessionManager.BACKOFF_INITIAL = 1; // seconds
|
|
11365
11405
|
UpstreamSessionManager.BACKOFF_CAP = 30; // seconds
|
|
11366
11406
|
|
|
11367
|
-
const logger$
|
|
11407
|
+
const logger$11 = getLogger('naylence.fame.node.admission.noop_admission_client');
|
|
11368
11408
|
class NoopAdmissionClient {
|
|
11369
11409
|
constructor(options = {}) {
|
|
11370
11410
|
this.hasUpstream = false;
|
|
@@ -11378,7 +11418,7 @@ class NoopAdmissionClient {
|
|
|
11378
11418
|
const acceptedLogicals = this.autoAcceptLogicals
|
|
11379
11419
|
? [...(requestedLogicals ?? [])]
|
|
11380
11420
|
: [];
|
|
11381
|
-
logger$
|
|
11421
|
+
logger$11.debug('noop_admission_hello', {
|
|
11382
11422
|
systemId: effectiveSystemId,
|
|
11383
11423
|
instanceId,
|
|
11384
11424
|
requestedLogicals,
|
|
@@ -11396,7 +11436,7 @@ class NoopAdmissionClient {
|
|
|
11396
11436
|
});
|
|
11397
11437
|
}
|
|
11398
11438
|
async close() {
|
|
11399
|
-
logger$
|
|
11439
|
+
logger$11.debug('noop_admission_close');
|
|
11400
11440
|
}
|
|
11401
11441
|
}
|
|
11402
11442
|
|
|
@@ -11602,7 +11642,7 @@ class DefaultServiceManager {
|
|
|
11602
11642
|
}
|
|
11603
11643
|
|
|
11604
11644
|
const SYSTEM_INBOX$1 = '__sys__';
|
|
11605
|
-
const logger
|
|
11645
|
+
const logger$10 = getLogger('naylence.fame.node.node');
|
|
11606
11646
|
function isSnakeCase(name) {
|
|
11607
11647
|
return name.includes('_');
|
|
11608
11648
|
}
|
|
@@ -11729,6 +11769,8 @@ class FameNode extends TaskSpawner {
|
|
|
11729
11769
|
this._acceptedLogicals = new Set(acceptedLogicalsOption);
|
|
11730
11770
|
const deliveryPolicyOption = resolveOption(options, 'deliveryPolicy', 'delivery_policy');
|
|
11731
11771
|
this._deliveryPolicy = deliveryPolicyOption ?? null;
|
|
11772
|
+
const connectionRetryPolicyOption = resolveOption(options, 'connectionRetryPolicy', 'connection_retry_policy');
|
|
11773
|
+
this._connectionRetryPolicy = connectionRetryPolicyOption ?? null;
|
|
11732
11774
|
const admissionClientOption = resolveOption(options, 'admissionClient', 'admission_client');
|
|
11733
11775
|
this._admissionClient = admissionClientOption ?? null;
|
|
11734
11776
|
const attachClientOption = resolveOption(options, 'attachClient', 'attach_client');
|
|
@@ -11858,6 +11900,7 @@ class FameNode extends TaskSpawner {
|
|
|
11858
11900
|
onAttach: (info, connector) => this.handleAttach(info, connector),
|
|
11859
11901
|
onEpochChange: (epoch) => this.handleEpochChange(epoch),
|
|
11860
11902
|
admissionClient: this._admissionClient,
|
|
11903
|
+
retryPolicy: this._connectionRetryPolicy,
|
|
11861
11904
|
});
|
|
11862
11905
|
this._sessionManager = manager;
|
|
11863
11906
|
await manager.start();
|
|
@@ -11869,7 +11912,7 @@ class FameNode extends TaskSpawner {
|
|
|
11869
11912
|
confirmIdentity(systemId, source) {
|
|
11870
11913
|
if (this._confirmedId) {
|
|
11871
11914
|
if (this._confirmedId !== systemId) {
|
|
11872
|
-
logger
|
|
11915
|
+
logger$10.error('node_identity_mismatch', {
|
|
11873
11916
|
current_id: this._confirmedId,
|
|
11874
11917
|
new_id: systemId,
|
|
11875
11918
|
source,
|
|
@@ -11881,14 +11924,14 @@ class FameNode extends TaskSpawner {
|
|
|
11881
11924
|
const isReassignment = this._provisionalId !== systemId;
|
|
11882
11925
|
this._confirmedId = systemId;
|
|
11883
11926
|
if (isReassignment) {
|
|
11884
|
-
logger
|
|
11927
|
+
logger$10.debug('node_identity_reassigned', {
|
|
11885
11928
|
system_id: systemId,
|
|
11886
11929
|
previous_id: this._provisionalId,
|
|
11887
11930
|
source,
|
|
11888
11931
|
});
|
|
11889
11932
|
}
|
|
11890
11933
|
else {
|
|
11891
|
-
logger
|
|
11934
|
+
logger$10.debug('node_identity_confirmed', {
|
|
11892
11935
|
system_id: systemId,
|
|
11893
11936
|
source,
|
|
11894
11937
|
});
|
|
@@ -11956,7 +11999,7 @@ class FameNode extends TaskSpawner {
|
|
|
11956
11999
|
return;
|
|
11957
12000
|
}
|
|
11958
12001
|
if (frameType === 'NodeHeartbeat') {
|
|
11959
|
-
logger
|
|
12002
|
+
logger$10.debug('received_heartbeat_frame', {
|
|
11960
12003
|
envelopeId: envelope.id,
|
|
11961
12004
|
corrId: envelope.corrId ?? null,
|
|
11962
12005
|
});
|
|
@@ -11968,7 +12011,7 @@ class FameNode extends TaskSpawner {
|
|
|
11968
12011
|
await this.handleDeliveryAck(envelope, context);
|
|
11969
12012
|
return;
|
|
11970
12013
|
}
|
|
11971
|
-
logger
|
|
12014
|
+
logger$10.debug('unhandled_system_frame', {
|
|
11972
12015
|
envelopeId: envelope.id,
|
|
11973
12016
|
frameType,
|
|
11974
12017
|
});
|
|
@@ -11980,13 +12023,13 @@ class FameNode extends TaskSpawner {
|
|
|
11980
12023
|
}
|
|
11981
12024
|
await this._deliveryTracker.onEnvelopeDelivered(SYSTEM_INBOX$1, envelope, context);
|
|
11982
12025
|
if (frame.ok !== false) {
|
|
11983
|
-
logger
|
|
12026
|
+
logger$10.debug('delivery_ack_received', {
|
|
11984
12027
|
envelopeId: envelope.id,
|
|
11985
12028
|
corrId: envelope.corrId ?? null,
|
|
11986
12029
|
});
|
|
11987
12030
|
return;
|
|
11988
12031
|
}
|
|
11989
|
-
logger
|
|
12032
|
+
logger$10.warning('delivery_nack_received', {
|
|
11990
12033
|
envelopeId: envelope.id,
|
|
11991
12034
|
corrId: envelope.corrId ?? null,
|
|
11992
12035
|
code: frame.code ?? null,
|
|
@@ -11996,7 +12039,7 @@ class FameNode extends TaskSpawner {
|
|
|
11996
12039
|
await this.onDeliveryNack(frame, envelope, context);
|
|
11997
12040
|
}
|
|
11998
12041
|
async onDeliveryNack(frame, envelope, _context) {
|
|
11999
|
-
logger
|
|
12042
|
+
logger$10.debug('delivery_nack_processed', {
|
|
12000
12043
|
envelopeId: envelope.id,
|
|
12001
12044
|
code: frame.code ?? null,
|
|
12002
12045
|
reason: frame.reason ?? null,
|
|
@@ -12111,7 +12154,7 @@ class FameNode extends TaskSpawner {
|
|
|
12111
12154
|
await this._bindingManager.restore();
|
|
12112
12155
|
await this._envelopeListenerManager.start();
|
|
12113
12156
|
this._isStarted = true;
|
|
12114
|
-
logger
|
|
12157
|
+
logger$10.debug('node_started', {
|
|
12115
12158
|
node_id: this.id,
|
|
12116
12159
|
sid: this.sid,
|
|
12117
12160
|
path: this.physicalPath,
|
|
@@ -12143,7 +12186,7 @@ class FameNode extends TaskSpawner {
|
|
|
12143
12186
|
await this._serviceManager.stop();
|
|
12144
12187
|
await this.dispatchEvent('onNodeStopped', this);
|
|
12145
12188
|
this._isStarted = false;
|
|
12146
|
-
logger
|
|
12189
|
+
logger$10.debug('node_stopped', {
|
|
12147
12190
|
node_id: this.id,
|
|
12148
12191
|
});
|
|
12149
12192
|
}
|
|
@@ -12333,20 +12376,20 @@ class FameNode extends TaskSpawner {
|
|
|
12333
12376
|
await this.forwardUpstream(processedEnvelope, context);
|
|
12334
12377
|
}
|
|
12335
12378
|
else {
|
|
12336
|
-
logger
|
|
12379
|
+
logger$10.error('attempted_upstream_loop', {
|
|
12337
12380
|
envelopeId: processedEnvelope.id,
|
|
12338
12381
|
});
|
|
12339
12382
|
}
|
|
12340
12383
|
return;
|
|
12341
12384
|
}
|
|
12342
12385
|
if (!processedEnvelope.to) {
|
|
12343
|
-
logger
|
|
12386
|
+
logger$10.error('dropping_envelope_without_destination', {
|
|
12344
12387
|
envelopeId: processedEnvelope.id,
|
|
12345
12388
|
capabilities: processedEnvelope.capabilities ?? [],
|
|
12346
12389
|
});
|
|
12347
12390
|
return;
|
|
12348
12391
|
}
|
|
12349
|
-
logger
|
|
12392
|
+
logger$10.warning('no_local_handler_for_address', {
|
|
12350
12393
|
address: processedEnvelope.to.toString?.() ?? String(processedEnvelope.to),
|
|
12351
12394
|
originType: context?.originType ?? null,
|
|
12352
12395
|
});
|
|
@@ -12470,7 +12513,7 @@ class FameNode extends TaskSpawner {
|
|
|
12470
12513
|
}
|
|
12471
12514
|
}
|
|
12472
12515
|
catch (error) {
|
|
12473
|
-
logger
|
|
12516
|
+
logger$10.warning('callback_grant_collection_failed', {
|
|
12474
12517
|
error: error instanceof Error ? error.message : String(error),
|
|
12475
12518
|
});
|
|
12476
12519
|
}
|
|
@@ -12533,7 +12576,7 @@ class FameNode extends TaskSpawner {
|
|
|
12533
12576
|
await store.set('self', record);
|
|
12534
12577
|
}
|
|
12535
12578
|
catch (error) {
|
|
12536
|
-
logger
|
|
12579
|
+
logger$10.warning('node_meta_persist_failed', {
|
|
12537
12580
|
error: error instanceof Error ? error.message : String(error),
|
|
12538
12581
|
});
|
|
12539
12582
|
}
|
|
@@ -12564,6 +12607,7 @@ const FameNodeConfigSchemaInternal = z
|
|
|
12564
12607
|
telemetry: z.unknown().optional().nullable(),
|
|
12565
12608
|
requestedCapabilities: z.array(z.string()).optional(),
|
|
12566
12609
|
identityPolicy: z.unknown().optional().nullable(),
|
|
12610
|
+
connectionRetryPolicy: z.unknown().optional().nullable(),
|
|
12567
12611
|
})
|
|
12568
12612
|
.passthrough();
|
|
12569
12613
|
function normalizeFameNodeConfig(input) {
|
|
@@ -12605,6 +12649,9 @@ function normalizeFameNodeConfig(input) {
|
|
|
12605
12649
|
identityPolicy: parsed.identityPolicy === undefined
|
|
12606
12650
|
? null
|
|
12607
12651
|
: parsed.identityPolicy,
|
|
12652
|
+
connectionRetryPolicy: parsed.connectionRetryPolicy === undefined
|
|
12653
|
+
? null
|
|
12654
|
+
: parsed.connectionRetryPolicy,
|
|
12608
12655
|
};
|
|
12609
12656
|
if (parsed.requestedCapabilities) {
|
|
12610
12657
|
normalized.requestedCapabilities = coerceStringArray$1(parsed.requestedCapabilities);
|
|
@@ -12649,6 +12696,24 @@ class AdmissionClientFactory extends AbstractResourceFactory {
|
|
|
12649
12696
|
}
|
|
12650
12697
|
}
|
|
12651
12698
|
|
|
12699
|
+
const CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE = 'ConnectionRetryPolicyFactory';
|
|
12700
|
+
class ConnectionRetryPolicyFactory extends AbstractResourceFactory {
|
|
12701
|
+
static async createConnectionRetryPolicy(config, options = {}) {
|
|
12702
|
+
if (config) {
|
|
12703
|
+
const policy = await createResource$1(CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE, config, options);
|
|
12704
|
+
if (!policy) {
|
|
12705
|
+
throw new Error('Failed to create connection retry policy from configuration');
|
|
12706
|
+
}
|
|
12707
|
+
return policy;
|
|
12708
|
+
}
|
|
12709
|
+
const policy = await createDefaultResource(CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE, null, options);
|
|
12710
|
+
if (!policy) {
|
|
12711
|
+
throw new Error('Failed to create default connection retry policy');
|
|
12712
|
+
}
|
|
12713
|
+
return policy;
|
|
12714
|
+
}
|
|
12715
|
+
}
|
|
12716
|
+
|
|
12652
12717
|
const TOKEN_PROVIDER_FACTORY_BASE_TYPE = 'TokenProviderFactory';
|
|
12653
12718
|
class TokenProviderFactory extends AbstractResourceFactory {
|
|
12654
12719
|
static async createTokenProvider(config, options = {}) {
|
|
@@ -12686,7 +12751,7 @@ function isIdentityExposingTokenProvider(candidate) {
|
|
|
12686
12751
|
'function');
|
|
12687
12752
|
}
|
|
12688
12753
|
|
|
12689
|
-
const logger
|
|
12754
|
+
const logger$$ = getLogger('naylence.fame.node.default_node_identity_policy');
|
|
12690
12755
|
class DefaultNodeIdentityPolicy {
|
|
12691
12756
|
async resolveInitialNodeId(context) {
|
|
12692
12757
|
if (context.configuredId) {
|
|
@@ -12716,7 +12781,7 @@ class DefaultNodeIdentityPolicy {
|
|
|
12716
12781
|
if (isIdentityExposingTokenProvider(provider)) {
|
|
12717
12782
|
const identity = await provider.getIdentity();
|
|
12718
12783
|
if (identity && identity.subject) {
|
|
12719
|
-
logger
|
|
12784
|
+
logger$$.debug('identity_extracted_from_grant', {
|
|
12720
12785
|
identity_id: identity.subject,
|
|
12721
12786
|
grant_type: grant.type,
|
|
12722
12787
|
});
|
|
@@ -12725,7 +12790,7 @@ class DefaultNodeIdentityPolicy {
|
|
|
12725
12790
|
}
|
|
12726
12791
|
}
|
|
12727
12792
|
catch (error) {
|
|
12728
|
-
logger
|
|
12793
|
+
logger$$.warning('identity_extraction_failed', {
|
|
12729
12794
|
error: error instanceof Error ? error.message : String(error),
|
|
12730
12795
|
grant_type: grant.type,
|
|
12731
12796
|
});
|
|
@@ -12809,7 +12874,7 @@ class AttachmentKeyValidator {
|
|
|
12809
12874
|
}
|
|
12810
12875
|
}
|
|
12811
12876
|
|
|
12812
|
-
const logger$
|
|
12877
|
+
const logger$_ = getLogger('naylence.fame.node.admission.default_node_attach_client');
|
|
12813
12878
|
const HANDSHAKE_POLL_INTERVAL_MS = 20;
|
|
12814
12879
|
class DefaultNodeAttachClient {
|
|
12815
12880
|
constructor(options = {}) {
|
|
@@ -12833,7 +12898,7 @@ class DefaultNodeAttachClient {
|
|
|
12833
12898
|
}
|
|
12834
12899
|
else {
|
|
12835
12900
|
// Silently ignore frames from other agents during concurrent handshakes
|
|
12836
|
-
logger$
|
|
12901
|
+
logger$_.debug('handshake_ignoring_frame_from_different_system', {
|
|
12837
12902
|
frame_type: envelope.frame.type,
|
|
12838
12903
|
frame_system_id: frameSystemId,
|
|
12839
12904
|
expected_system_id: this.expectedSystemId,
|
|
@@ -12876,7 +12941,7 @@ class DefaultNodeAttachClient {
|
|
|
12876
12941
|
}
|
|
12877
12942
|
}
|
|
12878
12943
|
catch (error) {
|
|
12879
|
-
logger$
|
|
12944
|
+
logger$_.debug('stickiness_offer_skipped', {
|
|
12880
12945
|
error: error instanceof Error ? error.message : String(error),
|
|
12881
12946
|
});
|
|
12882
12947
|
}
|
|
@@ -12897,7 +12962,7 @@ class DefaultNodeAttachClient {
|
|
|
12897
12962
|
if (!processedEnvelope) {
|
|
12898
12963
|
throw new Error('Envelope was blocked by onForwardUpstream event');
|
|
12899
12964
|
}
|
|
12900
|
-
logger$
|
|
12965
|
+
logger$_.debug('sending_node_attach_envelope', {
|
|
12901
12966
|
envp_id: processedEnvelope.id ?? envelope.id ?? null,
|
|
12902
12967
|
frame_type: processedEnvelope.frame?.type ?? 'unknown',
|
|
12903
12968
|
trace_id: processedEnvelope.traceId ?? envelope.traceId ?? null,
|
|
@@ -12933,7 +12998,7 @@ class DefaultNodeAttachClient {
|
|
|
12933
12998
|
try {
|
|
12934
12999
|
const keyInfos = await this.attachmentKeyValidator.validateKeys(parentKeys);
|
|
12935
13000
|
if (Array.isArray(keyInfos) && keyInfos.length > 0) {
|
|
12936
|
-
logger$
|
|
13001
|
+
logger$_.debug('parent_certificate_validation_passed', {
|
|
12937
13002
|
parent_id: parentId,
|
|
12938
13003
|
correlation_id: corrId,
|
|
12939
13004
|
validated_keys: keyInfos.length,
|
|
@@ -12942,7 +13007,7 @@ class DefaultNodeAttachClient {
|
|
|
12942
13007
|
}
|
|
12943
13008
|
catch (error) {
|
|
12944
13009
|
if (error instanceof KeyValidationError) {
|
|
12945
|
-
logger$
|
|
13010
|
+
logger$_.error('parent_certificate_validation_failed', {
|
|
12946
13011
|
parent_id: parentId,
|
|
12947
13012
|
correlation_id: corrId,
|
|
12948
13013
|
error_code: error.code,
|
|
@@ -12956,12 +13021,12 @@ class DefaultNodeAttachClient {
|
|
|
12956
13021
|
}
|
|
12957
13022
|
}
|
|
12958
13023
|
else {
|
|
12959
|
-
logger$
|
|
13024
|
+
logger$_.debug('parent_certificate_validation_skipped', {
|
|
12960
13025
|
parent_id: parentId,
|
|
12961
13026
|
reason: 'no_validator',
|
|
12962
13027
|
});
|
|
12963
13028
|
}
|
|
12964
|
-
logger$
|
|
13029
|
+
logger$_.debug('processing_node_attach_ack', {
|
|
12965
13030
|
parent_id: ackFrame.targetSystemId,
|
|
12966
13031
|
});
|
|
12967
13032
|
this.inHandshake = false;
|
|
@@ -12992,7 +13057,7 @@ class DefaultNodeAttachClient {
|
|
|
12992
13057
|
}
|
|
12993
13058
|
}
|
|
12994
13059
|
catch (error) {
|
|
12995
|
-
logger$
|
|
13060
|
+
logger$_.debug('stickiness_accept_skipped', {
|
|
12996
13061
|
error: error instanceof Error ? error.message : String(error),
|
|
12997
13062
|
});
|
|
12998
13063
|
}
|
|
@@ -13046,7 +13111,7 @@ class DefaultNodeAttachClient {
|
|
|
13046
13111
|
// NodeAttach frames during handshake are expected in multi-agent scenarios
|
|
13047
13112
|
// where multiple agents attach concurrently to the same channel
|
|
13048
13113
|
if (envelope.frame.type === 'NodeAttach') {
|
|
13049
|
-
logger$
|
|
13114
|
+
logger$_.debug('handshake_ignoring_concurrent_attach', {
|
|
13050
13115
|
frame_type: envelope.frame.type,
|
|
13051
13116
|
frame_system_id: envelope.frame?.systemId ??
|
|
13052
13117
|
'unknown',
|
|
@@ -13054,7 +13119,7 @@ class DefaultNodeAttachClient {
|
|
|
13054
13119
|
}
|
|
13055
13120
|
else {
|
|
13056
13121
|
// Other unexpected frames are still logged as errors
|
|
13057
|
-
logger$
|
|
13122
|
+
logger$_.error('unexpected_frame_during_handshake', {
|
|
13058
13123
|
frame_type: envelope.frame.type,
|
|
13059
13124
|
});
|
|
13060
13125
|
}
|
|
@@ -13189,7 +13254,7 @@ class TraceEmitterFactory extends AbstractResourceFactory {
|
|
|
13189
13254
|
// void import('./trace-emitter-profile-factory.js');
|
|
13190
13255
|
|
|
13191
13256
|
const BINDING_STORE_NAMESPACE = '__binding_store';
|
|
13192
|
-
const logger$
|
|
13257
|
+
const logger$Z = getLogger('naylence.fame.node.factory_commons');
|
|
13193
13258
|
function isPlainRecord$2(value) {
|
|
13194
13259
|
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
13195
13260
|
}
|
|
@@ -13296,6 +13361,7 @@ async function makeCommonOptions(config, rawConfig) {
|
|
|
13296
13361
|
const telemetryConfig = pickOption$1(config.telemetry ?? null, aliasRecord, 'trace_emitter', 'telemetry_config');
|
|
13297
13362
|
const securityConfig = pickOption$1(config.security ?? null, aliasRecord, 'security_manager', 'security_profile');
|
|
13298
13363
|
const identityPolicyConfig = pickOption$1(config.identityPolicy ?? null, aliasRecord, 'identity_policy', 'node_identity_policy');
|
|
13364
|
+
const connectionRetryPolicyConfig = pickOption$1(config.connectionRetryPolicy ?? null, aliasRecord, 'connection_retry_policy', 'retry_policy');
|
|
13299
13365
|
const publicUrl = pickString$2(config.publicUrl ?? null, aliasRecord, 'public_url') ?? null;
|
|
13300
13366
|
const directParentUrl = pickString$2(config.directParentUrl ?? null, aliasRecord, 'direct_parent_url') ?? null;
|
|
13301
13367
|
const hasParentFlag = config.hasParent || Boolean(aliasRecord.has_parent ?? false);
|
|
@@ -13305,6 +13371,7 @@ async function makeCommonOptions(config, rawConfig) {
|
|
|
13305
13371
|
const nodeMetaStore = await storageProvider.getKeyValueStore(NodeMetaRecord, NODE_META_NAMESPACE);
|
|
13306
13372
|
const nodeMeta = await nodeMetaStore.get('self');
|
|
13307
13373
|
const identityPolicy = await resolveNodeIdentityPolicy(identityPolicyConfig ?? null, expressionOptions);
|
|
13374
|
+
const connectionRetryPolicy = await resolveConnectionRetryPolicy(connectionRetryPolicyConfig ?? null, expressionOptions);
|
|
13308
13375
|
const admissionClient = await resolveAdmissionClient(admissionConfig ?? null, expressionOptions, identityPolicy ?? undefined);
|
|
13309
13376
|
const hasParent = determineHasParent(hasParentFlag, directParentUrl, admissionClient);
|
|
13310
13377
|
const replicaStickinessManager = await resolveReplicaStickinessManager(hasParent, requestedLogicals, expressionOptions);
|
|
@@ -13373,6 +13440,7 @@ async function makeCommonOptions(config, rawConfig) {
|
|
|
13373
13440
|
transportListeners,
|
|
13374
13441
|
traceEmitter,
|
|
13375
13442
|
identityPolicy: identityPolicy ?? undefined,
|
|
13443
|
+
connectionRetryPolicy: connectionRetryPolicy ?? undefined,
|
|
13376
13444
|
};
|
|
13377
13445
|
}
|
|
13378
13446
|
async function resolveNodeIdentityPolicy(config, options) {
|
|
@@ -13380,7 +13448,18 @@ async function resolveNodeIdentityPolicy(config, options) {
|
|
|
13380
13448
|
return await NodeIdentityPolicyFactory.createNodeIdentityPolicy(config ?? undefined, cloneCreateOptions(options));
|
|
13381
13449
|
}
|
|
13382
13450
|
catch (error) {
|
|
13383
|
-
logger$
|
|
13451
|
+
logger$Z.warning('node_identity_policy_creation_failed', {
|
|
13452
|
+
error: error instanceof Error ? error.message : String(error),
|
|
13453
|
+
});
|
|
13454
|
+
return null;
|
|
13455
|
+
}
|
|
13456
|
+
}
|
|
13457
|
+
async function resolveConnectionRetryPolicy(config, options) {
|
|
13458
|
+
try {
|
|
13459
|
+
return await ConnectionRetryPolicyFactory.createConnectionRetryPolicy(config ?? undefined, cloneCreateOptions(options));
|
|
13460
|
+
}
|
|
13461
|
+
catch (error) {
|
|
13462
|
+
logger$Z.warning('connection_retry_policy_creation_failed', {
|
|
13384
13463
|
error: error instanceof Error ? error.message : String(error),
|
|
13385
13464
|
});
|
|
13386
13465
|
return null;
|
|
@@ -13392,7 +13471,7 @@ async function resolveStorageProvider(config, options) {
|
|
|
13392
13471
|
return await StorageProviderFactory.createStorageProvider(config, cloneCreateOptions(options));
|
|
13393
13472
|
}
|
|
13394
13473
|
catch (error) {
|
|
13395
|
-
logger$
|
|
13474
|
+
logger$Z.warning('storage_provider_creation_failed', {
|
|
13396
13475
|
error: error instanceof Error ? error.message : String(error),
|
|
13397
13476
|
});
|
|
13398
13477
|
}
|
|
@@ -13414,7 +13493,7 @@ async function resolveAdmissionClient(config, options, identityPolicy) {
|
|
|
13414
13493
|
return await AdmissionClientFactory.createAdmissionClient((config ?? null), createOptions);
|
|
13415
13494
|
}
|
|
13416
13495
|
catch (error) {
|
|
13417
|
-
logger$
|
|
13496
|
+
logger$Z.warning('admission_client_creation_failed', {
|
|
13418
13497
|
error: error instanceof Error ? error.message : String(error),
|
|
13419
13498
|
});
|
|
13420
13499
|
return null;
|
|
@@ -13441,7 +13520,7 @@ async function resolveReplicaStickinessManager(hasParent, requestedLogicals, opt
|
|
|
13441
13520
|
return await ReplicaStickinessManagerFactory.createReplicaStickinessManager(undefined, cloneCreateOptions(options));
|
|
13442
13521
|
}
|
|
13443
13522
|
catch (error) {
|
|
13444
|
-
logger$
|
|
13523
|
+
logger$Z.debug('replica_stickiness_manager_unavailable', { error });
|
|
13445
13524
|
return null;
|
|
13446
13525
|
}
|
|
13447
13526
|
}
|
|
@@ -13450,7 +13529,7 @@ async function resolveAttachmentKeyValidator(config, options) {
|
|
|
13450
13529
|
return await AttachmentKeyValidatorFactory.createAttachmentKeyValidator(config ?? undefined, cloneCreateOptions(options));
|
|
13451
13530
|
}
|
|
13452
13531
|
catch (error) {
|
|
13453
|
-
logger$
|
|
13532
|
+
logger$Z.warning('attachment_key_validator_creation_failed', {
|
|
13454
13533
|
error: error instanceof Error ? error.message : String(error),
|
|
13455
13534
|
});
|
|
13456
13535
|
return null;
|
|
@@ -13468,7 +13547,7 @@ async function resolveDeliveryPolicy(config, options) {
|
|
|
13468
13547
|
return await DeliveryPolicyFactory.createDeliveryPolicy(config ?? undefined, cloneCreateOptions(options));
|
|
13469
13548
|
}
|
|
13470
13549
|
catch (error) {
|
|
13471
|
-
logger$
|
|
13550
|
+
logger$Z.warning('delivery_policy_creation_failed', {
|
|
13472
13551
|
error: error instanceof Error ? error.message : String(error),
|
|
13473
13552
|
});
|
|
13474
13553
|
return null;
|
|
@@ -13482,7 +13561,7 @@ async function resolveTransportListeners(configs, eventListeners, options) {
|
|
|
13482
13561
|
return await TransportListenerFactory.createTransportListeners(configs, eventListeners, cloneCreateOptions(options));
|
|
13483
13562
|
}
|
|
13484
13563
|
catch (error) {
|
|
13485
|
-
logger$
|
|
13564
|
+
logger$Z.warning('transport_listener_creation_failed', {
|
|
13486
13565
|
error: error instanceof Error ? error.message : String(error),
|
|
13487
13566
|
});
|
|
13488
13567
|
return [];
|
|
@@ -13493,7 +13572,7 @@ async function resolveTraceEmitter(config, options) {
|
|
|
13493
13572
|
return await TraceEmitterFactory.createTraceEmitter(config ?? undefined, cloneCreateOptions(options));
|
|
13494
13573
|
}
|
|
13495
13574
|
catch (error) {
|
|
13496
|
-
logger$
|
|
13575
|
+
logger$Z.warning('trace_emitter_creation_failed', {
|
|
13497
13576
|
error: error instanceof Error ? error.message : String(error),
|
|
13498
13577
|
});
|
|
13499
13578
|
return null;
|
|
@@ -13549,7 +13628,7 @@ async function createSecurityManagerFromConfig(config, overrides, options) {
|
|
|
13549
13628
|
return manager ?? null;
|
|
13550
13629
|
}
|
|
13551
13630
|
catch (error) {
|
|
13552
|
-
logger$
|
|
13631
|
+
logger$Z.warning('security_manager_creation_failed', {
|
|
13553
13632
|
error: error instanceof Error ? error.message : String(error),
|
|
13554
13633
|
});
|
|
13555
13634
|
return null;
|
|
@@ -13578,7 +13657,7 @@ async function resolveCryptoProvider(config, options) {
|
|
|
13578
13657
|
// This happens with overlay security profiles that need envelope signing
|
|
13579
13658
|
if (requiresCryptoProvider(config)) {
|
|
13580
13659
|
try {
|
|
13581
|
-
logger$
|
|
13660
|
+
logger$Z.debug('auto_creating_crypto_provider', {
|
|
13582
13661
|
reason: 'overlay_security_requires_signing',
|
|
13583
13662
|
});
|
|
13584
13663
|
// Dynamically import to avoid circular dependencies
|
|
@@ -13598,7 +13677,7 @@ async function resolveCryptoProvider(config, options) {
|
|
|
13598
13677
|
});
|
|
13599
13678
|
}
|
|
13600
13679
|
catch (error) {
|
|
13601
|
-
logger$
|
|
13680
|
+
logger$Z.error('failed_to_auto_create_crypto_provider', {
|
|
13602
13681
|
error: error instanceof Error ? error.message : String(error),
|
|
13603
13682
|
});
|
|
13604
13683
|
throw error;
|
|
@@ -14132,6 +14211,7 @@ const MODULES = [
|
|
|
14132
14211
|
"./node/admission/direct-admission-client-factory.js",
|
|
14133
14212
|
"./node/admission/noop-admission-client-factory.js",
|
|
14134
14213
|
"./node/admission/welcome-service-client-factory.js",
|
|
14214
|
+
"./node/default-connection-retry-policy-factory.js",
|
|
14135
14215
|
"./node/default-node-identity-policy-factory.js",
|
|
14136
14216
|
"./node/node-factory.js",
|
|
14137
14217
|
"./node/node-identity-policy-profile-factory.js",
|
|
@@ -14210,6 +14290,7 @@ const MODULE_LOADERS = {
|
|
|
14210
14290
|
"./node/admission/direct-admission-client-factory.js": () => Promise.resolve().then(function () { return directAdmissionClientFactory; }),
|
|
14211
14291
|
"./node/admission/noop-admission-client-factory.js": () => Promise.resolve().then(function () { return noopAdmissionClientFactory; }),
|
|
14212
14292
|
"./node/admission/welcome-service-client-factory.js": () => Promise.resolve().then(function () { return welcomeServiceClientFactory; }),
|
|
14293
|
+
"./node/default-connection-retry-policy-factory.js": () => Promise.resolve().then(function () { return defaultConnectionRetryPolicyFactory; }),
|
|
14213
14294
|
"./node/default-node-identity-policy-factory.js": () => Promise.resolve().then(function () { return defaultNodeIdentityPolicyFactory; }),
|
|
14214
14295
|
"./node/node-factory.js": () => Promise.resolve().then(function () { return nodeFactory; }),
|
|
14215
14296
|
"./node/node-identity-policy-profile-factory.js": () => Promise.resolve().then(function () { return nodeIdentityPolicyProfileFactory; }),
|
|
@@ -14557,7 +14638,7 @@ class NodeLikeFactory extends AbstractResourceFactory {
|
|
|
14557
14638
|
// registerFactory(NODE_LIKE_FACTORY_BASE_TYPE, type, factory);
|
|
14558
14639
|
// }
|
|
14559
14640
|
|
|
14560
|
-
const FACTORY_META$
|
|
14641
|
+
const FACTORY_META$18 = {
|
|
14561
14642
|
base: NODE_LIKE_FACTORY_BASE_TYPE,
|
|
14562
14643
|
key: 'Node',
|
|
14563
14644
|
};
|
|
@@ -14591,6 +14672,7 @@ class NodeFactory extends NodeLikeFactory {
|
|
|
14591
14672
|
nodeMetaStore: components.nodeMetaStore,
|
|
14592
14673
|
transportListeners: components.transportListeners,
|
|
14593
14674
|
defaultServiceConfigs: serviceConfigs,
|
|
14675
|
+
connectionRetryPolicy: components.connectionRetryPolicy,
|
|
14594
14676
|
});
|
|
14595
14677
|
return node;
|
|
14596
14678
|
}
|
|
@@ -14598,7 +14680,7 @@ class NodeFactory extends NodeLikeFactory {
|
|
|
14598
14680
|
|
|
14599
14681
|
var nodeFactory = /*#__PURE__*/Object.freeze({
|
|
14600
14682
|
__proto__: null,
|
|
14601
|
-
FACTORY_META: FACTORY_META$
|
|
14683
|
+
FACTORY_META: FACTORY_META$18,
|
|
14602
14684
|
NodeFactory: NodeFactory,
|
|
14603
14685
|
default: NodeFactory
|
|
14604
14686
|
});
|
|
@@ -15171,7 +15253,7 @@ function normalizeSecurityRequirements(value) {
|
|
|
15171
15253
|
};
|
|
15172
15254
|
}
|
|
15173
15255
|
|
|
15174
|
-
const logger$
|
|
15256
|
+
const logger$Y = getLogger('naylence.fame.node.envelope_security_handler');
|
|
15175
15257
|
const ENCRYPTION_OPTION_ALIAS_PAIRS = [
|
|
15176
15258
|
['recipKid', 'recip_kid'],
|
|
15177
15259
|
['recipientKeyId', 'recipient_key_id'],
|
|
@@ -15220,7 +15302,7 @@ class EnvelopeSecurityHandler {
|
|
|
15220
15302
|
const shouldSign = this.securityPolicy
|
|
15221
15303
|
? await this.securityPolicy.shouldSignEnvelope(envelope, context, this.node)
|
|
15222
15304
|
: false;
|
|
15223
|
-
logger$
|
|
15305
|
+
logger$Y.debug('checking_signing', {
|
|
15224
15306
|
has_signer: Boolean(this.envelopeSigner),
|
|
15225
15307
|
should_sign: shouldSign,
|
|
15226
15308
|
envp_id: envelope.id,
|
|
@@ -15242,7 +15324,7 @@ class EnvelopeSecurityHandler {
|
|
|
15242
15324
|
const shouldEncrypt = this.securityPolicy
|
|
15243
15325
|
? await this.securityPolicy.shouldEncryptEnvelope(envelope, context, this.node)
|
|
15244
15326
|
: false;
|
|
15245
|
-
logger$
|
|
15327
|
+
logger$Y.debug('checking_encryption', {
|
|
15246
15328
|
has_encryption_manager: Boolean(this.encryptionManager),
|
|
15247
15329
|
should_encrypt: shouldEncrypt,
|
|
15248
15330
|
envp_id: envelope.id,
|
|
@@ -15250,7 +15332,7 @@ class EnvelopeSecurityHandler {
|
|
|
15250
15332
|
});
|
|
15251
15333
|
if (this.encryptionManager && this.securityPolicy) {
|
|
15252
15334
|
if (envelope.sec?.enc) {
|
|
15253
|
-
logger$
|
|
15335
|
+
logger$Y.debug('skipping_encryption_already_encrypted', {
|
|
15254
15336
|
envp_id: envelope.id,
|
|
15255
15337
|
destination: envelope.to ? String(envelope.to) : undefined,
|
|
15256
15338
|
});
|
|
@@ -15263,7 +15345,7 @@ class EnvelopeSecurityHandler {
|
|
|
15263
15345
|
CryptoLevel.PLAINTEXT;
|
|
15264
15346
|
desiredCryptoLevel =
|
|
15265
15347
|
await this.securityPolicy.decideResponseCryptoLevel(requestCryptoLevel, envelope, context);
|
|
15266
|
-
logger$
|
|
15348
|
+
logger$Y.debug('response_crypto_level_decided', {
|
|
15267
15349
|
envp_id: envelope.id,
|
|
15268
15350
|
crypto_level: desiredCryptoLevel,
|
|
15269
15351
|
destination: envelope.to ? String(envelope.to) : undefined,
|
|
@@ -15274,7 +15356,7 @@ class EnvelopeSecurityHandler {
|
|
|
15274
15356
|
else {
|
|
15275
15357
|
desiredCryptoLevel =
|
|
15276
15358
|
await this.securityPolicy.decideOutboundCryptoLevel(envelope, context, this.node);
|
|
15277
|
-
logger$
|
|
15359
|
+
logger$Y.debug('outbound_crypto_level_decided', {
|
|
15278
15360
|
envp_id: envelope.id,
|
|
15279
15361
|
frame_type: envelope.frame.type,
|
|
15280
15362
|
crypto_level: desiredCryptoLevel,
|
|
@@ -15282,11 +15364,11 @@ class EnvelopeSecurityHandler {
|
|
|
15282
15364
|
});
|
|
15283
15365
|
}
|
|
15284
15366
|
if (desiredCryptoLevel === CryptoLevel.SEALED) {
|
|
15285
|
-
logger$
|
|
15367
|
+
logger$Y.debug('applying_sealed_encryption', { envp_id: envelope.id });
|
|
15286
15368
|
return await this.handleSealedEncryption(envelope, context);
|
|
15287
15369
|
}
|
|
15288
15370
|
if (desiredCryptoLevel === CryptoLevel.CHANNEL) {
|
|
15289
|
-
logger$
|
|
15371
|
+
logger$Y.debug('applying_channel_encryption', { envp_id: envelope.id });
|
|
15290
15372
|
return await this.handleChannelEncryption(envelope, context);
|
|
15291
15373
|
}
|
|
15292
15374
|
}
|
|
@@ -15337,7 +15419,7 @@ class EnvelopeSecurityHandler {
|
|
|
15337
15419
|
frameType === 'KeyAnnounce' ||
|
|
15338
15420
|
frameType === 'SecureOpen' ||
|
|
15339
15421
|
frameType === 'SecureAccept') {
|
|
15340
|
-
logger$
|
|
15422
|
+
logger$Y.error('critical_frame_unsigned_rejected', {
|
|
15341
15423
|
envp_id: envelope.id,
|
|
15342
15424
|
frame_type: frameType,
|
|
15343
15425
|
reason: 'critical_frames_must_be_signed',
|
|
@@ -15345,7 +15427,7 @@ class EnvelopeSecurityHandler {
|
|
|
15345
15427
|
return [envelope, false];
|
|
15346
15428
|
}
|
|
15347
15429
|
const action = this.securityPolicy.getUnsignedViolationAction(envelope, context);
|
|
15348
|
-
logger$
|
|
15430
|
+
logger$Y.warning('unsigned_envelope_violation', {
|
|
15349
15431
|
envp_id: envelope.id,
|
|
15350
15432
|
frame_type: frameType,
|
|
15351
15433
|
action,
|
|
@@ -15357,26 +15439,26 @@ class EnvelopeSecurityHandler {
|
|
|
15357
15439
|
return [envelope, true];
|
|
15358
15440
|
}
|
|
15359
15441
|
async handleChannelHandshakeComplete(channelId, destination) {
|
|
15360
|
-
logger$
|
|
15442
|
+
logger$Y.debug('channel_handshake_completed', {
|
|
15361
15443
|
channel_id: channelId,
|
|
15362
15444
|
destination,
|
|
15363
15445
|
});
|
|
15364
15446
|
if (this.encryptionManager?.notifyChannelEstablished) {
|
|
15365
15447
|
await this.encryptionManager.notifyChannelEstablished(channelId);
|
|
15366
|
-
logger$
|
|
15448
|
+
logger$Y.debug('notified_encryption_manager_channel_ready', {
|
|
15367
15449
|
channel_id: channelId,
|
|
15368
15450
|
});
|
|
15369
15451
|
}
|
|
15370
15452
|
}
|
|
15371
15453
|
async handleChannelHandshakeFailed(channelId, destination, reason = 'handshake_failed') {
|
|
15372
|
-
logger$
|
|
15454
|
+
logger$Y.debug('channel_handshake_failed', {
|
|
15373
15455
|
channel_id: channelId,
|
|
15374
15456
|
destination,
|
|
15375
15457
|
reason,
|
|
15376
15458
|
});
|
|
15377
15459
|
if (this.encryptionManager?.notifyChannelFailed) {
|
|
15378
15460
|
await this.encryptionManager.notifyChannelFailed(channelId, reason);
|
|
15379
|
-
logger$
|
|
15461
|
+
logger$Y.debug('notified_encryption_manager_channel_failed', {
|
|
15380
15462
|
channel_id: channelId,
|
|
15381
15463
|
reason,
|
|
15382
15464
|
});
|
|
@@ -15423,7 +15505,7 @@ class EnvelopeSecurityHandler {
|
|
|
15423
15505
|
checkPayload: false,
|
|
15424
15506
|
});
|
|
15425
15507
|
if (verified) {
|
|
15426
|
-
logger$
|
|
15508
|
+
logger$Y.debug('envelope_verified', {
|
|
15427
15509
|
envp_id: envelope.id,
|
|
15428
15510
|
sid: envelope.sid,
|
|
15429
15511
|
kid,
|
|
@@ -15434,7 +15516,7 @@ class EnvelopeSecurityHandler {
|
|
|
15434
15516
|
}
|
|
15435
15517
|
this.keyManagementHandler.queuePendingSignedEnvelope(kid, envelope, context);
|
|
15436
15518
|
await this.keyManagementHandler.maybeRequestSigningKey(kid, context.originType, fromSystemId);
|
|
15437
|
-
logger$
|
|
15519
|
+
logger$Y.debug('queued_envelope_missing_signing_key', {
|
|
15438
15520
|
kid,
|
|
15439
15521
|
envp_id: envelope.id,
|
|
15440
15522
|
});
|
|
@@ -15442,7 +15524,7 @@ class EnvelopeSecurityHandler {
|
|
|
15442
15524
|
}
|
|
15443
15525
|
async handleSealedEncryption(envelope, context) {
|
|
15444
15526
|
if (!envelope.to) {
|
|
15445
|
-
logger$
|
|
15527
|
+
logger$Y.warning('sealed_encryption_requested_but_no_destination', {
|
|
15446
15528
|
envp_id: envelope.id,
|
|
15447
15529
|
});
|
|
15448
15530
|
return true;
|
|
@@ -15454,20 +15536,20 @@ class EnvelopeSecurityHandler {
|
|
|
15454
15536
|
: undefined;
|
|
15455
15537
|
if (options) {
|
|
15456
15538
|
if (options.encryptionType === 'channel') {
|
|
15457
|
-
logger$
|
|
15539
|
+
logger$Y.warning('policy_returned_channel_for_sealed_request', {
|
|
15458
15540
|
envp_id: envelope.id,
|
|
15459
15541
|
});
|
|
15460
15542
|
return await this.handleToBeEncryptedEnvelopeWithOptions(envelope, context, normalizeEncryptionOptions({
|
|
15461
15543
|
requestAddress: envelope.to,
|
|
15462
15544
|
}));
|
|
15463
15545
|
}
|
|
15464
|
-
logger$
|
|
15546
|
+
logger$Y.debug('using_sealed_encryption_options', {
|
|
15465
15547
|
envp_id: envelope.id,
|
|
15466
15548
|
options,
|
|
15467
15549
|
});
|
|
15468
15550
|
return await this.handleToBeEncryptedEnvelopeWithOptions(envelope, context, options);
|
|
15469
15551
|
}
|
|
15470
|
-
logger$
|
|
15552
|
+
logger$Y.debug('no_encryption_options_requesting_key', {
|
|
15471
15553
|
envp_id: envelope.id,
|
|
15472
15554
|
});
|
|
15473
15555
|
return await this.handleToBeEncryptedEnvelopeWithOptions(envelope, context, normalizeEncryptionOptions({
|
|
@@ -15475,7 +15557,7 @@ class EnvelopeSecurityHandler {
|
|
|
15475
15557
|
}));
|
|
15476
15558
|
}
|
|
15477
15559
|
catch (error) {
|
|
15478
|
-
logger$
|
|
15560
|
+
logger$Y.debug('sealed_key_lookup_failed_requesting', {
|
|
15479
15561
|
envp_id: envelope.id,
|
|
15480
15562
|
error: error instanceof Error ? error.message : String(error),
|
|
15481
15563
|
});
|
|
@@ -15486,7 +15568,7 @@ class EnvelopeSecurityHandler {
|
|
|
15486
15568
|
}
|
|
15487
15569
|
async handleChannelEncryption(envelope, context) {
|
|
15488
15570
|
if (!envelope.to) {
|
|
15489
|
-
logger$
|
|
15571
|
+
logger$Y.warning('channel_encryption_requested_but_no_destination', {
|
|
15490
15572
|
envp_id: envelope.id,
|
|
15491
15573
|
});
|
|
15492
15574
|
return true;
|
|
@@ -15501,13 +15583,13 @@ class EnvelopeSecurityHandler {
|
|
|
15501
15583
|
return true;
|
|
15502
15584
|
}
|
|
15503
15585
|
if (context.originType !== DeliveryOriginType.LOCAL) {
|
|
15504
|
-
logger$
|
|
15586
|
+
logger$Y.warning('envelope_encryption_rejected_non_local', {
|
|
15505
15587
|
origin: context.originType,
|
|
15506
15588
|
});
|
|
15507
15589
|
return true;
|
|
15508
15590
|
}
|
|
15509
15591
|
if (!isDataFrame$4(envelope.frame)) {
|
|
15510
|
-
logger$
|
|
15592
|
+
logger$Y.trace('skipping_encryption_non_dataframe', {
|
|
15511
15593
|
envp_id: envelope.id,
|
|
15512
15594
|
frame_type: envelope.frame.type,
|
|
15513
15595
|
});
|
|
@@ -15518,7 +15600,7 @@ class EnvelopeSecurityHandler {
|
|
|
15518
15600
|
? normalizeEncryptionOptions(rawOptions)
|
|
15519
15601
|
: undefined;
|
|
15520
15602
|
if (!options) {
|
|
15521
|
-
logger$
|
|
15603
|
+
logger$Y.warning('no_encryption_options_provided', {
|
|
15522
15604
|
envp_id: envelope.id,
|
|
15523
15605
|
});
|
|
15524
15606
|
return true;
|
|
@@ -15530,13 +15612,13 @@ class EnvelopeSecurityHandler {
|
|
|
15530
15612
|
return true;
|
|
15531
15613
|
}
|
|
15532
15614
|
if (context.originType !== DeliveryOriginType.LOCAL) {
|
|
15533
|
-
logger$
|
|
15615
|
+
logger$Y.warning('envelope_encryption_rejected_non_local', {
|
|
15534
15616
|
origin: context.originType,
|
|
15535
15617
|
});
|
|
15536
15618
|
return true;
|
|
15537
15619
|
}
|
|
15538
15620
|
if (!isDataFrame$4(envelope.frame)) {
|
|
15539
|
-
logger$
|
|
15621
|
+
logger$Y.trace('skipping_encryption_non_dataframe', {
|
|
15540
15622
|
envp_id: envelope.id,
|
|
15541
15623
|
frame_type: envelope.frame.type,
|
|
15542
15624
|
});
|
|
@@ -15553,7 +15635,7 @@ class EnvelopeSecurityHandler {
|
|
|
15553
15635
|
// Skip encryption if envelope is already encrypted
|
|
15554
15636
|
// This prevents re-queuing when replayed envelopes go through security again
|
|
15555
15637
|
if (envelope.sec?.enc) {
|
|
15556
|
-
logger$
|
|
15638
|
+
logger$Y.debug('skipping_encryption_already_encrypted', {
|
|
15557
15639
|
envp_id: envelope.id,
|
|
15558
15640
|
destination: envelope.to ? String(envelope.to) : undefined,
|
|
15559
15641
|
});
|
|
@@ -15562,14 +15644,14 @@ class EnvelopeSecurityHandler {
|
|
|
15562
15644
|
try {
|
|
15563
15645
|
const result = await this.encryptionManager.encryptEnvelope(envelope, normalizedOptions);
|
|
15564
15646
|
if (result.status === EncryptionStatus.QUEUED) {
|
|
15565
|
-
logger$
|
|
15647
|
+
logger$Y.debug('envelope_queued_for_encryption', {
|
|
15566
15648
|
envp_id: envelope.id,
|
|
15567
15649
|
});
|
|
15568
15650
|
await this.handleEncryptionQueueing(envelope, context, normalizedOptions);
|
|
15569
15651
|
return false;
|
|
15570
15652
|
}
|
|
15571
15653
|
if (result.status === EncryptionStatus.OK) {
|
|
15572
|
-
logger$
|
|
15654
|
+
logger$Y.debug('envelope_encrypted', { envp_id: envelope.id });
|
|
15573
15655
|
if (result.envelope) {
|
|
15574
15656
|
envelope.frame = result.envelope.frame;
|
|
15575
15657
|
envelope.sec = result.envelope.sec;
|
|
@@ -15577,17 +15659,17 @@ class EnvelopeSecurityHandler {
|
|
|
15577
15659
|
return true;
|
|
15578
15660
|
}
|
|
15579
15661
|
if (result.status === EncryptionStatus.SKIPPED) {
|
|
15580
|
-
logger$
|
|
15662
|
+
logger$Y.debug('envelope_encryption_skipped', { envp_id: envelope.id });
|
|
15581
15663
|
return true;
|
|
15582
15664
|
}
|
|
15583
|
-
logger$
|
|
15665
|
+
logger$Y.warning('unknown_encryption_status', {
|
|
15584
15666
|
envp_id: envelope.id,
|
|
15585
15667
|
status: result.status,
|
|
15586
15668
|
});
|
|
15587
15669
|
return true;
|
|
15588
15670
|
}
|
|
15589
15671
|
catch (error) {
|
|
15590
|
-
logger$
|
|
15672
|
+
logger$Y.error('encryption_failed', {
|
|
15591
15673
|
envp_id: envelope.id,
|
|
15592
15674
|
error: error instanceof Error ? error.message : String(error),
|
|
15593
15675
|
});
|
|
@@ -15626,7 +15708,7 @@ class EnvelopeSecurityHandler {
|
|
|
15626
15708
|
return;
|
|
15627
15709
|
}
|
|
15628
15710
|
if (normalizedOptions.encryptionType === 'channel') {
|
|
15629
|
-
logger$
|
|
15711
|
+
logger$Y.debug('channel_encryption_queueing_handled_internally', {
|
|
15630
15712
|
envp_id: envelope.id,
|
|
15631
15713
|
destination: normalizedOptions.destination
|
|
15632
15714
|
? String(normalizedOptions.destination)
|
|
@@ -15634,13 +15716,13 @@ class EnvelopeSecurityHandler {
|
|
|
15634
15716
|
});
|
|
15635
15717
|
return;
|
|
15636
15718
|
}
|
|
15637
|
-
logger$
|
|
15719
|
+
logger$Y.warning('unknown_encryption_queueing_options', {
|
|
15638
15720
|
envp_id: envelope.id,
|
|
15639
15721
|
options: normalizedOptions,
|
|
15640
15722
|
});
|
|
15641
15723
|
}
|
|
15642
15724
|
async handleFailedChannelEnvelopeCleanup(destination, reason) {
|
|
15643
|
-
logger$
|
|
15725
|
+
logger$Y.debug('channel_handshake_failure_cleanup_attempted', {
|
|
15644
15726
|
destination,
|
|
15645
15727
|
reason,
|
|
15646
15728
|
note: 'envelope_cleanup_handled_by_encryption_manager',
|
|
@@ -15651,7 +15733,7 @@ class EnvelopeSecurityHandler {
|
|
|
15651
15733
|
}
|
|
15652
15734
|
}
|
|
15653
15735
|
|
|
15654
|
-
const logger$
|
|
15736
|
+
const logger$X = getLogger('naylence.fame.node.secure_channel_frame_handler');
|
|
15655
15737
|
function isPlainRecord$1(value) {
|
|
15656
15738
|
if (typeof value !== 'object' || value === null) {
|
|
15657
15739
|
return false;
|
|
@@ -15741,7 +15823,7 @@ class SecureChannelFrameHandler {
|
|
|
15741
15823
|
assertSecureChannelManager(this.secureChannelManager);
|
|
15742
15824
|
const frame = envelope.frame;
|
|
15743
15825
|
assertFrameType(frame, 'SecureOpen');
|
|
15744
|
-
logger$
|
|
15826
|
+
logger$X.debug('received_secure_open', {
|
|
15745
15827
|
cid: frame.cid,
|
|
15746
15828
|
algorithm: frame.alg,
|
|
15747
15829
|
});
|
|
@@ -15764,13 +15846,13 @@ class SecureChannelFrameHandler {
|
|
|
15764
15846
|
stickySid: envelope.sid ?? undefined,
|
|
15765
15847
|
expectedResponseType: FameResponseType.NONE,
|
|
15766
15848
|
};
|
|
15767
|
-
logger$
|
|
15849
|
+
logger$X.debug('stickiness_requested_for_channel_encryption', {
|
|
15768
15850
|
cid: frame.cid,
|
|
15769
15851
|
reason: 'secure_channel_established',
|
|
15770
15852
|
});
|
|
15771
15853
|
}
|
|
15772
15854
|
await this.sendCallback(responseEnvelope, responseContext);
|
|
15773
|
-
logger$
|
|
15855
|
+
logger$X.debug('sent_secure_accept', { cid: frame.cid, ok: acceptFrame.ok });
|
|
15774
15856
|
if (acceptFrame.ok && this.envelopeSecurityHandler) {
|
|
15775
15857
|
const destination = extractDestinationFromChannelId(frame.cid);
|
|
15776
15858
|
if (destination) {
|
|
@@ -15782,13 +15864,13 @@ class SecureChannelFrameHandler {
|
|
|
15782
15864
|
assertSecureChannelManager(this.secureChannelManager);
|
|
15783
15865
|
const frame = envelope.frame;
|
|
15784
15866
|
assertFrameType(frame, 'SecureAccept');
|
|
15785
|
-
logger$
|
|
15867
|
+
logger$X.debug('received_secure_accept', { cid: frame.cid, ok: frame.ok });
|
|
15786
15868
|
const success = await this.secureChannelManager.handleAcceptFrame(frame);
|
|
15787
15869
|
if (!success) {
|
|
15788
|
-
logger$
|
|
15870
|
+
logger$X.warning('failed_to_complete_channel', { cid: frame.cid });
|
|
15789
15871
|
}
|
|
15790
15872
|
else {
|
|
15791
|
-
logger$
|
|
15873
|
+
logger$X.debug('channel_established', { cid: frame.cid });
|
|
15792
15874
|
if (this.envelopeSecurityHandler) {
|
|
15793
15875
|
const destination = extractDestinationFromChannelId(frame.cid);
|
|
15794
15876
|
if (destination) {
|
|
@@ -15800,7 +15882,7 @@ class SecureChannelFrameHandler {
|
|
|
15800
15882
|
const destination = extractDestinationFromChannelId(frame.cid);
|
|
15801
15883
|
if (destination) {
|
|
15802
15884
|
await this.envelopeSecurityHandler.handleChannelHandshakeFailed(frame.cid, destination, 'negative_secure_accept');
|
|
15803
|
-
logger$
|
|
15885
|
+
logger$X.debug('notified_handshake_failure', {
|
|
15804
15886
|
cid: frame.cid,
|
|
15805
15887
|
destination,
|
|
15806
15888
|
});
|
|
@@ -15811,7 +15893,7 @@ class SecureChannelFrameHandler {
|
|
|
15811
15893
|
assertSecureChannelManager(this.secureChannelManager);
|
|
15812
15894
|
const frame = envelope.frame;
|
|
15813
15895
|
assertFrameType(frame, 'SecureClose');
|
|
15814
|
-
logger$
|
|
15896
|
+
logger$X.debug('received_secure_close', {
|
|
15815
15897
|
cid: frame.cid,
|
|
15816
15898
|
reason: frame.reason,
|
|
15817
15899
|
});
|
|
@@ -15869,7 +15951,7 @@ function createNodeDeliveryContext(options = {}) {
|
|
|
15869
15951
|
class FameEnvironmentContext {
|
|
15870
15952
|
}
|
|
15871
15953
|
|
|
15872
|
-
const FACTORY_META$
|
|
15954
|
+
const FACTORY_META$17 = {
|
|
15873
15955
|
base: NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE,
|
|
15874
15956
|
key: 'DefaultNodeIdentityPolicy',
|
|
15875
15957
|
};
|
|
@@ -15887,11 +15969,11 @@ class DefaultNodeIdentityPolicyFactory extends NodeIdentityPolicyFactory {
|
|
|
15887
15969
|
var defaultNodeIdentityPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
15888
15970
|
__proto__: null,
|
|
15889
15971
|
DefaultNodeIdentityPolicyFactory: DefaultNodeIdentityPolicyFactory,
|
|
15890
|
-
FACTORY_META: FACTORY_META$
|
|
15972
|
+
FACTORY_META: FACTORY_META$17,
|
|
15891
15973
|
default: DefaultNodeIdentityPolicyFactory
|
|
15892
15974
|
});
|
|
15893
15975
|
|
|
15894
|
-
const logger$
|
|
15976
|
+
const logger$W = getLogger('naylence.fame.node.token_subject_node_identity_policy');
|
|
15895
15977
|
class TokenSubjectNodeIdentityPolicy {
|
|
15896
15978
|
async resolveInitialNodeId(context) {
|
|
15897
15979
|
if (context.configuredId) {
|
|
@@ -15903,7 +15985,7 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
15903
15985
|
return generateIdAsync();
|
|
15904
15986
|
}
|
|
15905
15987
|
async resolveAdmissionNodeId(context) {
|
|
15906
|
-
logger$
|
|
15988
|
+
logger$W.debug('resolve_admission_node_id_start', {
|
|
15907
15989
|
grantsCount: context.grants?.length ?? 0,
|
|
15908
15990
|
currentNodeId: context.currentNodeId,
|
|
15909
15991
|
});
|
|
@@ -15912,31 +15994,31 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
15912
15994
|
try {
|
|
15913
15995
|
const auth = grant.auth;
|
|
15914
15996
|
if (!auth) {
|
|
15915
|
-
logger$
|
|
15997
|
+
logger$W.debug('skipping_grant_no_auth', { grantType: grant.type });
|
|
15916
15998
|
continue;
|
|
15917
15999
|
}
|
|
15918
16000
|
const tokenProviderConfig = (auth.tokenProvider ??
|
|
15919
16001
|
auth.token_provider);
|
|
15920
16002
|
if (!tokenProviderConfig ||
|
|
15921
16003
|
typeof tokenProviderConfig.type !== 'string') {
|
|
15922
|
-
logger$
|
|
16004
|
+
logger$W.debug('skipping_grant_invalid_token_provider_config', {
|
|
15923
16005
|
grantType: grant.type,
|
|
15924
16006
|
config: tokenProviderConfig,
|
|
15925
16007
|
});
|
|
15926
16008
|
continue;
|
|
15927
16009
|
}
|
|
15928
|
-
logger$
|
|
16010
|
+
logger$W.debug('creating_token_provider', {
|
|
15929
16011
|
type: tokenProviderConfig.type,
|
|
15930
16012
|
});
|
|
15931
16013
|
const provider = await TokenProviderFactory.createTokenProvider(tokenProviderConfig);
|
|
15932
16014
|
const isExposing = isIdentityExposingTokenProvider(provider);
|
|
15933
|
-
logger$
|
|
16015
|
+
logger$W.debug('token_provider_created', {
|
|
15934
16016
|
type: tokenProviderConfig.type,
|
|
15935
16017
|
isIdentityExposing: isExposing,
|
|
15936
16018
|
});
|
|
15937
16019
|
if (isExposing) {
|
|
15938
16020
|
const identity = await provider.getIdentity();
|
|
15939
|
-
logger$
|
|
16021
|
+
logger$W.debug('retrieved_identity', { identity });
|
|
15940
16022
|
if (identity && identity.subject) {
|
|
15941
16023
|
const hashedSubject = await generateIdAsync({
|
|
15942
16024
|
mode: 'fingerprint',
|
|
@@ -15944,7 +16026,7 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
15944
16026
|
length: 8,
|
|
15945
16027
|
});
|
|
15946
16028
|
const newNodeId = `${hashedSubject}-${context.currentNodeId}`;
|
|
15947
|
-
logger$
|
|
16029
|
+
logger$W.info('resolved_identity_from_token', {
|
|
15948
16030
|
subject: identity.subject,
|
|
15949
16031
|
hashedSubject,
|
|
15950
16032
|
newNodeId,
|
|
@@ -15952,17 +16034,17 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
15952
16034
|
return newNodeId;
|
|
15953
16035
|
}
|
|
15954
16036
|
else {
|
|
15955
|
-
logger$
|
|
16037
|
+
logger$W.debug('identity_missing_subject', { identity });
|
|
15956
16038
|
}
|
|
15957
16039
|
}
|
|
15958
16040
|
}
|
|
15959
16041
|
catch (err) {
|
|
15960
|
-
logger$
|
|
16042
|
+
logger$W.warning('failed_to_extract_identity_from_grant', { error: err });
|
|
15961
16043
|
}
|
|
15962
16044
|
}
|
|
15963
16045
|
}
|
|
15964
16046
|
else {
|
|
15965
|
-
logger$
|
|
16047
|
+
logger$W.debug('no_grants_available');
|
|
15966
16048
|
}
|
|
15967
16049
|
return context.currentNodeId;
|
|
15968
16050
|
}
|
|
@@ -15973,7 +16055,7 @@ var tokenSubjectNodeIdentityPolicy = /*#__PURE__*/Object.freeze({
|
|
|
15973
16055
|
TokenSubjectNodeIdentityPolicy: TokenSubjectNodeIdentityPolicy
|
|
15974
16056
|
});
|
|
15975
16057
|
|
|
15976
|
-
const FACTORY_META$
|
|
16058
|
+
const FACTORY_META$16 = {
|
|
15977
16059
|
base: NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE,
|
|
15978
16060
|
key: 'TokenSubjectNodeIdentityPolicy',
|
|
15979
16061
|
};
|
|
@@ -15992,12 +16074,12 @@ class TokenSubjectNodeIdentityPolicyFactory extends NodeIdentityPolicyFactory {
|
|
|
15992
16074
|
|
|
15993
16075
|
var tokenSubjectNodeIdentityPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
15994
16076
|
__proto__: null,
|
|
15995
|
-
FACTORY_META: FACTORY_META$
|
|
16077
|
+
FACTORY_META: FACTORY_META$16,
|
|
15996
16078
|
TokenSubjectNodeIdentityPolicyFactory: TokenSubjectNodeIdentityPolicyFactory,
|
|
15997
16079
|
default: TokenSubjectNodeIdentityPolicyFactory
|
|
15998
16080
|
});
|
|
15999
16081
|
|
|
16000
|
-
const logger$
|
|
16082
|
+
const logger$V = getLogger('naylence.fame.node.node_identity_policy_profile_factory');
|
|
16001
16083
|
const PROFILE_NAME_DEFAULT = 'default';
|
|
16002
16084
|
const PROFILE_NAME_TOKEN_SUBJECT = 'token-subject';
|
|
16003
16085
|
const PROFILE_NAME_TOKEN_SUBJECT_ALIAS = 'token_subject';
|
|
@@ -16012,7 +16094,7 @@ const PROFILE_MAP$5 = {
|
|
|
16012
16094
|
[PROFILE_NAME_TOKEN_SUBJECT]: TOKEN_SUBJECT_PROFILE,
|
|
16013
16095
|
[PROFILE_NAME_TOKEN_SUBJECT_ALIAS]: TOKEN_SUBJECT_PROFILE,
|
|
16014
16096
|
};
|
|
16015
|
-
const FACTORY_META$
|
|
16097
|
+
const FACTORY_META$15 = {
|
|
16016
16098
|
base: NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE,
|
|
16017
16099
|
key: 'NodeIdentityPolicyProfile',
|
|
16018
16100
|
};
|
|
@@ -16024,7 +16106,7 @@ class NodeIdentityPolicyProfileFactory extends NodeIdentityPolicyFactory {
|
|
|
16024
16106
|
async create(config) {
|
|
16025
16107
|
const normalized = normalizeConfig$t(config);
|
|
16026
16108
|
const profileConfig = resolveProfileConfig$4(normalized.profile);
|
|
16027
|
-
logger$
|
|
16109
|
+
logger$V.debug('enabling_node_identity_policy_profile', {
|
|
16028
16110
|
profile: normalized.profile,
|
|
16029
16111
|
});
|
|
16030
16112
|
return NodeIdentityPolicyFactory.createNodeIdentityPolicy(profileConfig);
|
|
@@ -16060,11 +16142,95 @@ function deepClone$4(value) {
|
|
|
16060
16142
|
|
|
16061
16143
|
var nodeIdentityPolicyProfileFactory = /*#__PURE__*/Object.freeze({
|
|
16062
16144
|
__proto__: null,
|
|
16063
|
-
FACTORY_META: FACTORY_META$
|
|
16145
|
+
FACTORY_META: FACTORY_META$15,
|
|
16064
16146
|
NodeIdentityPolicyProfileFactory: NodeIdentityPolicyProfileFactory,
|
|
16065
16147
|
default: NodeIdentityPolicyProfileFactory
|
|
16066
16148
|
});
|
|
16067
16149
|
|
|
16150
|
+
/**
|
|
16151
|
+
* Environment variable for overriding max initial attempts.
|
|
16152
|
+
*/
|
|
16153
|
+
const ENV_VAR_SESSION_MAX_INITIAL_ATTEMPTS = 'FAME_SESSION_MAX_INITIAL_ATTEMPTS';
|
|
16154
|
+
/**
|
|
16155
|
+
* Default implementation of connection retry policy.
|
|
16156
|
+
*
|
|
16157
|
+
* Before first successful attach:
|
|
16158
|
+
* - Respects maxInitialAttempts configuration
|
|
16159
|
+
* - Uses exponential backoff with jitter
|
|
16160
|
+
*
|
|
16161
|
+
* After first successful attach:
|
|
16162
|
+
* - Always retries (unlimited) to maintain connection
|
|
16163
|
+
* - Resets backoff if connection was stable for >10 seconds
|
|
16164
|
+
*/
|
|
16165
|
+
class DefaultConnectionRetryPolicy {
|
|
16166
|
+
constructor(options = {}) {
|
|
16167
|
+
// Check for environment variable override
|
|
16168
|
+
const envValue = typeof process !== 'undefined'
|
|
16169
|
+
? process.env?.[ENV_VAR_SESSION_MAX_INITIAL_ATTEMPTS]
|
|
16170
|
+
: undefined;
|
|
16171
|
+
if (envValue !== undefined && envValue !== '') {
|
|
16172
|
+
const parsed = parseInt(envValue, 10);
|
|
16173
|
+
this.maxInitialAttempts = isNaN(parsed) ? (options.maxInitialAttempts ?? 1) : parsed;
|
|
16174
|
+
}
|
|
16175
|
+
else {
|
|
16176
|
+
this.maxInitialAttempts = options.maxInitialAttempts ?? 1;
|
|
16177
|
+
}
|
|
16178
|
+
}
|
|
16179
|
+
shouldRetry(context) {
|
|
16180
|
+
// After first successful attach, always retry to maintain connection
|
|
16181
|
+
if (context.hadSuccessfulAttach) {
|
|
16182
|
+
return true;
|
|
16183
|
+
}
|
|
16184
|
+
// maxInitialAttempts = 0 means unlimited retries
|
|
16185
|
+
if (this.maxInitialAttempts === 0) {
|
|
16186
|
+
return true;
|
|
16187
|
+
}
|
|
16188
|
+
// Fail if we've exceeded the configured max attempts
|
|
16189
|
+
return context.attemptNumber < this.maxInitialAttempts;
|
|
16190
|
+
}
|
|
16191
|
+
calculateRetryDelay(_context, baseDelay) {
|
|
16192
|
+
// Add jitter to prevent thundering herd
|
|
16193
|
+
const jitter = Math.random() * baseDelay;
|
|
16194
|
+
return baseDelay + jitter;
|
|
16195
|
+
}
|
|
16196
|
+
}
|
|
16197
|
+
|
|
16198
|
+
const logger$U = getLogger('naylence.fame.node.default-connection-retry-policy-factory');
|
|
16199
|
+
const FACTORY_META$14 = {
|
|
16200
|
+
base: CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE,
|
|
16201
|
+
key: 'DefaultConnectionRetryPolicy',
|
|
16202
|
+
};
|
|
16203
|
+
class DefaultConnectionRetryPolicyFactory extends ConnectionRetryPolicyFactory {
|
|
16204
|
+
constructor() {
|
|
16205
|
+
super(...arguments);
|
|
16206
|
+
this.type = 'DefaultConnectionRetryPolicy';
|
|
16207
|
+
this.isDefault = true;
|
|
16208
|
+
}
|
|
16209
|
+
async create(config) {
|
|
16210
|
+
const options = {};
|
|
16211
|
+
if (config) {
|
|
16212
|
+
const rawMax = config.maxInitialAttempts ??
|
|
16213
|
+
config.max_initial_attempts;
|
|
16214
|
+
if (rawMax !== undefined && rawMax !== null) {
|
|
16215
|
+
options.maxInitialAttempts =
|
|
16216
|
+
typeof rawMax === 'string' ? parseInt(rawMax, 10) : Number(rawMax);
|
|
16217
|
+
}
|
|
16218
|
+
}
|
|
16219
|
+
const policy = new DefaultConnectionRetryPolicy(options);
|
|
16220
|
+
logger$U.debug('connection_retry_policy_created', {
|
|
16221
|
+
maxInitialAttempts: policy.maxInitialAttempts,
|
|
16222
|
+
});
|
|
16223
|
+
return policy;
|
|
16224
|
+
}
|
|
16225
|
+
}
|
|
16226
|
+
|
|
16227
|
+
var defaultConnectionRetryPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
16228
|
+
__proto__: null,
|
|
16229
|
+
DefaultConnectionRetryPolicyFactory: DefaultConnectionRetryPolicyFactory,
|
|
16230
|
+
FACTORY_META: FACTORY_META$14,
|
|
16231
|
+
default: DefaultConnectionRetryPolicyFactory
|
|
16232
|
+
});
|
|
16233
|
+
|
|
16068
16234
|
const LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE = 'LoadBalancerStickinessManagerFactory';
|
|
16069
16235
|
class LoadBalancerStickinessManagerFactory extends AbstractResourceFactory {
|
|
16070
16236
|
static async createLoadBalancerStickinessManager(config, options = {}) {
|
|
@@ -19136,6 +19302,7 @@ class Sentinel extends FameNode {
|
|
|
19136
19302
|
this.maxAttachTtlSec = opts.maxAttachTtlSec ?? null;
|
|
19137
19303
|
this.requestedLogicals = opts.requestedLogicals ?? [];
|
|
19138
19304
|
this.attachClient = opts.attachClient ?? null;
|
|
19305
|
+
this.connectionRetryPolicy = opts.connectionRetryPolicy ?? null;
|
|
19139
19306
|
this.nodeAttachFrameHandler = new NodeAttachFrameHandler({
|
|
19140
19307
|
routingNode: this,
|
|
19141
19308
|
routeManager: this.routeManager,
|
|
@@ -19685,6 +19852,7 @@ class Sentinel extends FameNode {
|
|
|
19685
19852
|
onAttach: (info, connector) => this.onNodeAttachToPeer(info, connector),
|
|
19686
19853
|
onEpochChange: (epoch) => this.onEpochChange(epoch),
|
|
19687
19854
|
onWelcome: async () => undefined,
|
|
19855
|
+
retryPolicy: this.connectionRetryPolicy,
|
|
19688
19856
|
});
|
|
19689
19857
|
await sessionManager.start();
|
|
19690
19858
|
const systemId = sessionManager.systemId;
|
|
@@ -41421,4 +41589,4 @@ var websocketTransportProvisioner = /*#__PURE__*/Object.freeze({
|
|
|
41421
41589
|
WebSocketTransportProvisionerFactory: WebSocketTransportProvisionerFactory
|
|
41422
41590
|
});
|
|
41423
41591
|
|
|
41424
|
-
export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$$ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultKeyManager, DefaultNodeIdentityPolicy, DefaultNodeIdentityPolicyFactory, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$10 as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodeIdentityPolicyFactory, NodeIdentityPolicyProfileFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenSubjectNodeIdentityPolicy, TokenSubjectNodeIdentityPolicyFactory, TokenVerifierFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFabricForNode, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isIdentityExposingTokenProvider, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
|
|
41592
|
+
export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectionRetryPolicyFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$$ as DEFAULT_WELCOME_FACTORY_META, DefaultConnectionRetryPolicy, DefaultConnectionRetryPolicyFactory, DefaultCryptoProvider, DefaultKeyManager, DefaultNodeIdentityPolicy, DefaultNodeIdentityPolicyFactory, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SESSION_MAX_INITIAL_ATTEMPTS, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$10 as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodeIdentityPolicyFactory, NodeIdentityPolicyProfileFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenSubjectNodeIdentityPolicy, TokenSubjectNodeIdentityPolicyFactory, TokenVerifierFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFabricForNode, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isIdentityExposingTokenProvider, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
|