@naylence/runtime 0.3.5-test.930 → 0.3.5-test.933
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 +1808 -1782
- package/dist/browser/index.mjs +1808 -1782
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +26 -0
- package/dist/cjs/naylence/fame/telemetry/trace-emitter-factory.js +4 -37
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +26 -0
- package/dist/esm/naylence/fame/telemetry/trace-emitter-factory.js +4 -4
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +1868 -1842
- package/dist/node/index.mjs +1868 -1842
- package/dist/node/node.cjs +1504 -1478
- package/dist/node/node.mjs +1504 -1478
- package/dist/types/naylence/fame/connector/broadcast-channel-connector.browser.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/node.cjs
CHANGED
|
@@ -5386,12 +5386,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5386
5386
|
}
|
|
5387
5387
|
|
|
5388
5388
|
// This file is auto-generated during build - do not edit manually
|
|
5389
|
-
// Generated from package.json version: 0.3.5-test.
|
|
5389
|
+
// Generated from package.json version: 0.3.5-test.933
|
|
5390
5390
|
/**
|
|
5391
5391
|
* The package version, injected at build time.
|
|
5392
5392
|
* @internal
|
|
5393
5393
|
*/
|
|
5394
|
-
const VERSION = '0.3.5-test.
|
|
5394
|
+
const VERSION = '0.3.5-test.933';
|
|
5395
5395
|
|
|
5396
5396
|
/**
|
|
5397
5397
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -11431,6 +11431,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11431
11431
|
this.ackDedupTtlMs = 30000;
|
|
11432
11432
|
this.ackDedupMaxEntries = 4096;
|
|
11433
11433
|
this.textDecoder = new TextDecoder();
|
|
11434
|
+
this.visibilityChangeListenerRegistered = false;
|
|
11434
11435
|
this.channelName =
|
|
11435
11436
|
typeof config.channelName === 'string' && config.channelName.trim().length > 0
|
|
11436
11437
|
? config.channelName.trim()
|
|
@@ -11511,6 +11512,26 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11511
11512
|
};
|
|
11512
11513
|
this.channel.addEventListener('message', this.onMsg);
|
|
11513
11514
|
this.listenerRegistered = true;
|
|
11515
|
+
// Setup visibility change monitoring
|
|
11516
|
+
this.visibilityChangeHandler = () => {
|
|
11517
|
+
const isHidden = document.hidden;
|
|
11518
|
+
logger$10.info('broadcast_channel_visibility_changed', {
|
|
11519
|
+
channel: this.channelName,
|
|
11520
|
+
connector_id: this.connectorId,
|
|
11521
|
+
visibility: isHidden ? 'hidden' : 'visible',
|
|
11522
|
+
timestamp: new Date().toISOString(),
|
|
11523
|
+
});
|
|
11524
|
+
};
|
|
11525
|
+
if (typeof document !== 'undefined') {
|
|
11526
|
+
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
11527
|
+
this.visibilityChangeListenerRegistered = true;
|
|
11528
|
+
// Log initial state
|
|
11529
|
+
logger$10.info('broadcast_channel_initial_visibility', {
|
|
11530
|
+
channel: this.channelName,
|
|
11531
|
+
connector_id: this.connectorId,
|
|
11532
|
+
visibility: document.hidden ? 'hidden' : 'visible',
|
|
11533
|
+
});
|
|
11534
|
+
}
|
|
11514
11535
|
}
|
|
11515
11536
|
async pushToReceive(rawOrEnvelope) {
|
|
11516
11537
|
const item = this._normalizeInboxItem(rawOrEnvelope);
|
|
@@ -11559,6 +11580,11 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11559
11580
|
this.channel.removeEventListener('message', this.onMsg);
|
|
11560
11581
|
this.listenerRegistered = false;
|
|
11561
11582
|
}
|
|
11583
|
+
if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
|
|
11584
|
+
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
11585
|
+
this.visibilityChangeListenerRegistered = false;
|
|
11586
|
+
this.visibilityChangeHandler = undefined;
|
|
11587
|
+
}
|
|
11562
11588
|
this.channel.close();
|
|
11563
11589
|
const closeCode = typeof code === 'number' ? code : 1000;
|
|
11564
11590
|
const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
|
|
@@ -14176,10 +14202,10 @@ class TraceEmitterFactory extends factory.AbstractResourceFactory {
|
|
|
14176
14202
|
return traceEmitter;
|
|
14177
14203
|
}
|
|
14178
14204
|
}
|
|
14179
|
-
// Ensure default factories are registered lazily to avoid circular ESM initialization issues
|
|
14180
|
-
void
|
|
14181
|
-
void
|
|
14182
|
-
void
|
|
14205
|
+
// // Ensure default factories are registered lazily to avoid circular ESM initialization issues
|
|
14206
|
+
// void import('./noop-trace-emitter-factory.js');
|
|
14207
|
+
// void import('./open-telemetry-trace-emitter-factory.js');
|
|
14208
|
+
// void import('./trace-emitter-profile-factory.js');
|
|
14183
14209
|
|
|
14184
14210
|
const BINDING_STORE_NAMESPACE = '__binding_store';
|
|
14185
14211
|
const logger$X = getLogger('naylence.fame.node.factory_commons');
|
|
@@ -34181,839 +34207,217 @@ async function main() {
|
|
|
34181
34207
|
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
34182
34208
|
}
|
|
34183
34209
|
|
|
34184
|
-
|
|
34185
|
-
|
|
34186
|
-
|
|
34187
|
-
|
|
34188
|
-
|
|
34189
|
-
|
|
34190
|
-
|
|
34191
|
-
}
|
|
34192
|
-
|
|
34193
|
-
|
|
34194
|
-
|
|
34195
|
-
|
|
34196
|
-
|
|
34197
|
-
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
|
|
34202
|
-
|
|
34203
|
-
|
|
34204
|
-
'env.frame_type': envelope.frame
|
|
34205
|
-
? (envelope.frame.type ?? null)
|
|
34206
|
-
: null,
|
|
34207
|
-
'env.is_signed': Boolean(envelope.sec?.sig),
|
|
34208
|
-
'env.sign_kid': envelope.sec?.sig?.kid ?? null,
|
|
34209
|
-
'env.is_encrypted': Boolean(envelope.sec?.enc),
|
|
34210
|
-
'env.enc_kid': envelope.sec?.enc?.kid ?? null,
|
|
34211
|
-
};
|
|
34210
|
+
/**
|
|
34211
|
+
* Base abstraction for message delivery policies.
|
|
34212
|
+
*/
|
|
34213
|
+
class DeliveryPolicy {
|
|
34214
|
+
constructor(options = {}) {
|
|
34215
|
+
this.senderPolicy = options.senderRetryPolicy;
|
|
34216
|
+
this.receiverPolicy = options.receiverRetryPolicy;
|
|
34217
|
+
}
|
|
34218
|
+
/**
|
|
34219
|
+
* Determine if the policy requires an acknowledgement for the envelope.
|
|
34220
|
+
*/
|
|
34221
|
+
isAckRequired(_envelope) {
|
|
34222
|
+
return false;
|
|
34223
|
+
}
|
|
34224
|
+
get senderRetryPolicy() {
|
|
34225
|
+
return this.senderPolicy;
|
|
34226
|
+
}
|
|
34227
|
+
get receiverRetryPolicy() {
|
|
34228
|
+
return this.receiverPolicy;
|
|
34229
|
+
}
|
|
34212
34230
|
}
|
|
34213
|
-
|
|
34214
|
-
|
|
34215
|
-
|
|
34216
|
-
|
|
34217
|
-
|
|
34231
|
+
|
|
34232
|
+
/**
|
|
34233
|
+
* Message delivery policy that ensures envelopes are delivered at least once.
|
|
34234
|
+
*/
|
|
34235
|
+
class AtLeastOnceDeliveryPolicy extends DeliveryPolicy {
|
|
34236
|
+
constructor(options = {}) {
|
|
34237
|
+
super(options);
|
|
34238
|
+
}
|
|
34239
|
+
isAckRequired(envelope) {
|
|
34240
|
+
const frame = envelope?.frame;
|
|
34241
|
+
const frameType = typeof frame?.type === 'string' ? frame.type : null;
|
|
34242
|
+
if (!frameType) {
|
|
34243
|
+
return false;
|
|
34218
34244
|
}
|
|
34245
|
+
return frameType === 'Data' || frameType === 'DataFrame';
|
|
34219
34246
|
}
|
|
34220
|
-
return filtered;
|
|
34221
34247
|
}
|
|
34222
|
-
|
|
34223
|
-
|
|
34224
|
-
|
|
34248
|
+
|
|
34249
|
+
/**
|
|
34250
|
+
* Configuration and helper for retry backoff behaviour.
|
|
34251
|
+
*/
|
|
34252
|
+
class RetryPolicy {
|
|
34253
|
+
constructor(options = {}) {
|
|
34254
|
+
this.maxRetries = Math.max(0, Math.trunc(options.maxRetries ?? 0));
|
|
34255
|
+
this.baseDelayMs = Math.max(0, Math.trunc(options.baseDelayMs ?? 200));
|
|
34256
|
+
this.maxDelayMs = Math.max(this.baseDelayMs, Math.trunc(options.maxDelayMs ?? 10000));
|
|
34257
|
+
this.jitterMs = Math.max(0, Math.trunc(options.jitterMs ?? 50));
|
|
34258
|
+
this.backoffFactor = Math.max(0, options.backoffFactor ?? 2.0);
|
|
34225
34259
|
}
|
|
34226
|
-
|
|
34227
|
-
|
|
34228
|
-
|
|
34229
|
-
|
|
34230
|
-
|
|
34231
|
-
|
|
34232
|
-
|
|
34233
|
-
|
|
34260
|
+
/**
|
|
34261
|
+
* Calculate the next retry delay based on attempt number (0-indexed).
|
|
34262
|
+
*/
|
|
34263
|
+
nextDelayMs(attempt) {
|
|
34264
|
+
const normalizedAttempt = Number.isFinite(attempt)
|
|
34265
|
+
? Math.max(0, Math.trunc(attempt))
|
|
34266
|
+
: 0;
|
|
34267
|
+
const base = normalizedAttempt <= 0
|
|
34268
|
+
? this.baseDelayMs
|
|
34269
|
+
: Math.round(this.baseDelayMs * this.backoffFactor ** normalizedAttempt);
|
|
34270
|
+
const jitter = this.jitterMs > 0
|
|
34271
|
+
? Math.round((Math.random() * 2 - 1) * this.jitterMs)
|
|
34272
|
+
: 0;
|
|
34273
|
+
const withJitter = base + jitter;
|
|
34274
|
+
return Math.min(this.maxDelayMs, Math.max(0, withJitter));
|
|
34234
34275
|
}
|
|
34235
|
-
return undefined;
|
|
34236
34276
|
}
|
|
34237
|
-
|
|
34277
|
+
|
|
34278
|
+
const LEGACY_POLICY_KEYS = {
|
|
34279
|
+
senderRetryPolicy: ['sender_retry_policy', 'sender_retryPolicy'],
|
|
34280
|
+
receiverRetryPolicy: ['receiver_retry_policy', 'receiver_retryPolicy'],
|
|
34281
|
+
};
|
|
34282
|
+
class AtLeastOnceDeliveryPolicyFactory extends DeliveryPolicyFactory {
|
|
34238
34283
|
constructor() {
|
|
34239
34284
|
super(...arguments);
|
|
34240
|
-
this.
|
|
34241
|
-
this.
|
|
34242
|
-
this.priority = 10000;
|
|
34285
|
+
this.type = 'AtLeastOnceDeliveryPolicy';
|
|
34286
|
+
this.isDefault = true;
|
|
34243
34287
|
}
|
|
34244
|
-
|
|
34245
|
-
|
|
34288
|
+
async create(config) {
|
|
34289
|
+
const normalized = normalizeAtLeastOnceConfig(config);
|
|
34290
|
+
const options = {
|
|
34291
|
+
...(normalized.senderRetryPolicy
|
|
34292
|
+
? { senderRetryPolicy: normalized.senderRetryPolicy }
|
|
34293
|
+
: {}),
|
|
34294
|
+
...(normalized.receiverRetryPolicy
|
|
34295
|
+
? { receiverRetryPolicy: normalized.receiverRetryPolicy }
|
|
34296
|
+
: {}),
|
|
34297
|
+
};
|
|
34298
|
+
return new AtLeastOnceDeliveryPolicy(options);
|
|
34246
34299
|
}
|
|
34247
|
-
|
|
34248
|
-
|
|
34249
|
-
|
|
34250
|
-
|
|
34251
|
-
if (previous) {
|
|
34252
|
-
this.inflight.delete(key);
|
|
34253
|
-
try {
|
|
34254
|
-
previous.scope.exit();
|
|
34255
|
-
}
|
|
34256
|
-
catch (cleanupError) {
|
|
34257
|
-
logTelemetryFailure('trace_span_scope_exit_failed', cleanupError, {
|
|
34258
|
-
operation: operationName,
|
|
34259
|
-
span_key: key,
|
|
34260
|
-
});
|
|
34261
|
-
}
|
|
34262
|
-
}
|
|
34263
|
-
const attributes = buildEnvelopeAttributes(envelope);
|
|
34264
|
-
if (additionalAttributes) {
|
|
34265
|
-
for (const [attrKey, attrValue] of Object.entries(additionalAttributes)) {
|
|
34266
|
-
attributes[attrKey] = attrValue;
|
|
34267
|
-
}
|
|
34268
|
-
}
|
|
34269
|
-
const effectiveNode = node ?? this.node;
|
|
34270
|
-
if (effectiveNode) {
|
|
34271
|
-
attributes['node.id'] = effectiveNode.id;
|
|
34272
|
-
attributes['node.sid'] = effectiveNode.sid ?? null;
|
|
34273
|
-
}
|
|
34274
|
-
const scope = this.startSpan(operationName, {
|
|
34275
|
-
attributes: filterAttributes(attributes),
|
|
34276
|
-
});
|
|
34277
|
-
const span = scope.enter();
|
|
34278
|
-
this.inflight.set(key, { scope, span });
|
|
34279
|
-
}
|
|
34280
|
-
catch (error) {
|
|
34281
|
-
logTelemetryFailure('trace_span_start_failed', error, {
|
|
34282
|
-
operation: operationName,
|
|
34283
|
-
envelope_id: envelope.id,
|
|
34284
|
-
});
|
|
34285
|
-
}
|
|
34286
|
-
return envelope;
|
|
34300
|
+
}
|
|
34301
|
+
function normalizeAtLeastOnceConfig(config) {
|
|
34302
|
+
if (!config) {
|
|
34303
|
+
return {};
|
|
34287
34304
|
}
|
|
34288
|
-
|
|
34289
|
-
|
|
34290
|
-
|
|
34291
|
-
|
|
34292
|
-
|
|
34293
|
-
|
|
34294
|
-
|
|
34295
|
-
|
|
34296
|
-
|
|
34297
|
-
|
|
34298
|
-
|
|
34299
|
-
|
|
34300
|
-
|
|
34301
|
-
attributes['node.id'] = effectiveNode.id;
|
|
34302
|
-
attributes['node.sid'] = effectiveNode.sid ?? null;
|
|
34303
|
-
}
|
|
34304
|
-
const scope = this.startSpan(operationName, {
|
|
34305
|
-
attributes: filterAttributes(attributes),
|
|
34306
|
-
});
|
|
34307
|
-
const span = scope.enter();
|
|
34308
|
-
active = { scope, span };
|
|
34309
|
-
}
|
|
34310
|
-
else {
|
|
34311
|
-
this.inflight.delete(key);
|
|
34312
|
-
}
|
|
34313
|
-
if (error !== null && error !== undefined) {
|
|
34314
|
-
try {
|
|
34315
|
-
active.span.recordException(error);
|
|
34316
|
-
}
|
|
34317
|
-
catch (recordError) {
|
|
34318
|
-
logTelemetryFailure('trace_span_record_exception_failed', recordError, {
|
|
34319
|
-
operation: operationName,
|
|
34320
|
-
envelope_id: envelope.id,
|
|
34321
|
-
});
|
|
34322
|
-
}
|
|
34323
|
-
try {
|
|
34324
|
-
const description = error instanceof Error ? error.message : String(error);
|
|
34325
|
-
active.span.setStatusError(description);
|
|
34326
|
-
}
|
|
34327
|
-
catch (statusError) {
|
|
34328
|
-
logTelemetryFailure('trace_span_set_status_failed', statusError, {
|
|
34329
|
-
operation: operationName,
|
|
34330
|
-
envelope_id: envelope.id,
|
|
34331
|
-
});
|
|
34332
|
-
}
|
|
34333
|
-
}
|
|
34334
|
-
try {
|
|
34335
|
-
active.scope.exit();
|
|
34336
|
-
}
|
|
34337
|
-
catch (exitError) {
|
|
34338
|
-
logTelemetryFailure('trace_span_scope_exit_failed', exitError, {
|
|
34339
|
-
operation: operationName,
|
|
34340
|
-
envelope_id: envelope.id,
|
|
34341
|
-
});
|
|
34342
|
-
}
|
|
34343
|
-
}
|
|
34344
|
-
catch (error) {
|
|
34345
|
-
logTelemetryFailure('trace_span_complete_failed', error, {
|
|
34346
|
-
operation: operationName,
|
|
34347
|
-
envelope_id: envelope.id,
|
|
34348
|
-
});
|
|
34349
|
-
}
|
|
34350
|
-
return envelope;
|
|
34305
|
+
const candidate = config;
|
|
34306
|
+
const senderPolicyInput = getRetryPolicyInput(candidate, 'senderRetryPolicy');
|
|
34307
|
+
const receiverPolicyInput = getRetryPolicyInput(candidate, 'receiverRetryPolicy');
|
|
34308
|
+
return {
|
|
34309
|
+
senderRetryPolicy: resolveRetryPolicy(senderPolicyInput),
|
|
34310
|
+
receiverRetryPolicy: resolveRetryPolicy(receiverPolicyInput),
|
|
34311
|
+
};
|
|
34312
|
+
}
|
|
34313
|
+
function getRetryPolicyInput(candidate, key) {
|
|
34314
|
+
const camelKey = key;
|
|
34315
|
+
const primary = candidate[camelKey];
|
|
34316
|
+
if (primary !== undefined) {
|
|
34317
|
+
return primary;
|
|
34351
34318
|
}
|
|
34352
|
-
|
|
34353
|
-
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
'fromSystemId',
|
|
34359
|
-
'from_system_id',
|
|
34360
|
-
'fromNodeId',
|
|
34361
|
-
'from_node_id',
|
|
34362
|
-
]);
|
|
34363
|
-
if (fromNodeId !== undefined && fromNodeId !== null) {
|
|
34364
|
-
attributes['from.node_id'] = String(fromNodeId);
|
|
34365
|
-
}
|
|
34366
|
-
const originType = extractContextValue(context, [
|
|
34367
|
-
'originType',
|
|
34368
|
-
'origin_type',
|
|
34369
|
-
]);
|
|
34370
|
-
if (originType !== undefined && originType !== null) {
|
|
34371
|
-
attributes['from.origin_type'] = String(originType);
|
|
34372
|
-
}
|
|
34373
|
-
const scope = this.startSpan('env.received', {
|
|
34374
|
-
attributes: filterAttributes(attributes),
|
|
34375
|
-
});
|
|
34376
|
-
scope.enter();
|
|
34377
|
-
scope.exit();
|
|
34378
|
-
}
|
|
34379
|
-
catch (error) {
|
|
34380
|
-
logTelemetryFailure('trace_span_received_failed', error, {
|
|
34381
|
-
envelope_id: envelope.id,
|
|
34382
|
-
});
|
|
34319
|
+
const legacyKeys = LEGACY_POLICY_KEYS[key] ?? [];
|
|
34320
|
+
for (const legacyKey of legacyKeys) {
|
|
34321
|
+
const value = candidate[legacyKey];
|
|
34322
|
+
if (value !== undefined) {
|
|
34323
|
+
candidate[camelKey] = value;
|
|
34324
|
+
return value;
|
|
34383
34325
|
}
|
|
34384
|
-
return envelope;
|
|
34385
|
-
}
|
|
34386
|
-
async onForwardToRoute(node, nextSegment, envelope, _context) {
|
|
34387
|
-
return this.startEnvelopeOperationSpan(node, 'env.fwd_to_route', envelope, nextSegment, {
|
|
34388
|
-
'route.segment': nextSegment,
|
|
34389
|
-
});
|
|
34390
|
-
}
|
|
34391
|
-
async onForwardToRouteComplete(node, nextSegment, envelope, result, error, _context) {
|
|
34392
|
-
return this.completeEnvelopeOperationSpan(node, 'env.fwd_to_route', envelope, nextSegment, result, error, {
|
|
34393
|
-
'route.segment': nextSegment,
|
|
34394
|
-
});
|
|
34395
|
-
}
|
|
34396
|
-
async onForwardUpstream(node, envelope, _context) {
|
|
34397
|
-
return this.startEnvelopeOperationSpan(node, 'env.fwd_upstream', envelope, 'upstream', {
|
|
34398
|
-
direction: 'upstream',
|
|
34399
|
-
});
|
|
34400
|
-
}
|
|
34401
|
-
async onForwardUpstreamComplete(node, envelope, result, error, _context) {
|
|
34402
|
-
return this.completeEnvelopeOperationSpan(node, 'env.fwd_upstream', envelope, 'upstream', result, error, {
|
|
34403
|
-
direction: 'upstream',
|
|
34404
|
-
});
|
|
34405
|
-
}
|
|
34406
|
-
async onForwardToPeer(node, peerSegment, envelope, _context) {
|
|
34407
|
-
return this.startEnvelopeOperationSpan(node, 'env.fwd_to_peer', envelope, peerSegment, {
|
|
34408
|
-
'peer.segment': peerSegment,
|
|
34409
|
-
});
|
|
34410
|
-
}
|
|
34411
|
-
async onForwardToPeerComplete(node, peerSegment, envelope, result, error, _context) {
|
|
34412
|
-
return this.completeEnvelopeOperationSpan(node, 'env.fwd_to_peer', envelope, peerSegment, result, error, {
|
|
34413
|
-
'peer.segment': peerSegment,
|
|
34414
|
-
});
|
|
34415
34326
|
}
|
|
34416
|
-
|
|
34417
|
-
|
|
34418
|
-
|
|
34419
|
-
|
|
34420
|
-
|
|
34421
|
-
});
|
|
34422
|
-
}
|
|
34423
|
-
async onDeliverLocalComplete(node, address, envelope, _context) {
|
|
34424
|
-
const addressKey = address ? String(address) : 'unknown';
|
|
34425
|
-
return this.completeEnvelopeOperationSpan(node, 'env.deliver_local', envelope, addressKey, null, null, {
|
|
34426
|
-
'delivery.address': addressKey,
|
|
34427
|
-
'delivery.type': 'local',
|
|
34428
|
-
});
|
|
34327
|
+
return undefined;
|
|
34328
|
+
}
|
|
34329
|
+
function resolveRetryPolicy(input) {
|
|
34330
|
+
if (!input) {
|
|
34331
|
+
return undefined;
|
|
34429
34332
|
}
|
|
34430
|
-
|
|
34431
|
-
|
|
34333
|
+
if (input instanceof RetryPolicy) {
|
|
34334
|
+
return input;
|
|
34432
34335
|
}
|
|
34433
|
-
|
|
34434
|
-
|
|
34435
|
-
|
|
34436
|
-
|
|
34336
|
+
const record = input;
|
|
34337
|
+
const options = {
|
|
34338
|
+
...(withOption(record, ['maxRetries', 'max_retries']) ?? {}),
|
|
34339
|
+
...(withOption(record, ['baseDelayMs', 'base_delay_ms']) ?? {}),
|
|
34340
|
+
...(withOption(record, ['maxDelayMs', 'max_delay_ms']) ?? {}),
|
|
34341
|
+
...(withOption(record, ['jitterMs', 'jitter_ms']) ?? {}),
|
|
34342
|
+
...(withOption(record, ['backoffFactor', 'backoff_factor']) ?? {}),
|
|
34343
|
+
};
|
|
34344
|
+
return new RetryPolicy(options);
|
|
34345
|
+
}
|
|
34346
|
+
function extractNumber(source, keys) {
|
|
34347
|
+
for (const key of keys) {
|
|
34348
|
+
if (key in source) {
|
|
34349
|
+
const value = source[key];
|
|
34350
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
34351
|
+
return value;
|
|
34437
34352
|
}
|
|
34438
|
-
if (typeof
|
|
34439
|
-
|
|
34353
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
34354
|
+
const parsed = Number(value);
|
|
34355
|
+
if (!Number.isNaN(parsed)) {
|
|
34356
|
+
return parsed;
|
|
34357
|
+
}
|
|
34440
34358
|
}
|
|
34441
34359
|
}
|
|
34442
|
-
catch (error) {
|
|
34443
|
-
logTelemetryFailure('trace_span_shutdown_failed', error);
|
|
34444
|
-
}
|
|
34445
|
-
}
|
|
34446
|
-
async flush() {
|
|
34447
|
-
// Default implementation: no-op
|
|
34448
|
-
}
|
|
34449
|
-
async shutdown() {
|
|
34450
|
-
// Default implementation: no-op
|
|
34451
|
-
}
|
|
34452
|
-
}
|
|
34453
|
-
|
|
34454
|
-
class NoopTraceSpan {
|
|
34455
|
-
setAttribute() { }
|
|
34456
|
-
recordException() { }
|
|
34457
|
-
setStatusError() { }
|
|
34458
|
-
}
|
|
34459
|
-
class NoopTraceSpanScope {
|
|
34460
|
-
constructor(span) {
|
|
34461
|
-
this.span = span;
|
|
34462
|
-
}
|
|
34463
|
-
enter() {
|
|
34464
|
-
return this.span;
|
|
34465
34360
|
}
|
|
34466
|
-
|
|
34361
|
+
return undefined;
|
|
34467
34362
|
}
|
|
34468
|
-
|
|
34469
|
-
|
|
34470
|
-
|
|
34471
|
-
return
|
|
34363
|
+
function withOption(source, keys) {
|
|
34364
|
+
const value = extractNumber(source, keys);
|
|
34365
|
+
if (value === undefined) {
|
|
34366
|
+
return undefined;
|
|
34472
34367
|
}
|
|
34368
|
+
const camelKey = keys[0];
|
|
34369
|
+
return {
|
|
34370
|
+
[camelKey]: value,
|
|
34371
|
+
};
|
|
34473
34372
|
}
|
|
34474
|
-
|
|
34475
34373
|
const FACTORY_META$R = {
|
|
34476
|
-
base:
|
|
34477
|
-
key: '
|
|
34374
|
+
base: DELIVERY_POLICY_FACTORY_BASE_TYPE,
|
|
34375
|
+
key: 'AtLeastOnceDeliveryPolicy',
|
|
34478
34376
|
};
|
|
34479
|
-
class NoopTraceEmitterFactory extends TraceEmitterFactory {
|
|
34480
|
-
constructor() {
|
|
34481
|
-
super(...arguments);
|
|
34482
|
-
this.type = 'NoopTraceEmitter';
|
|
34483
|
-
this.isDefault = true;
|
|
34484
|
-
this.priority = 100;
|
|
34485
|
-
}
|
|
34486
|
-
async create() {
|
|
34487
|
-
return new NoopTraceEmitter();
|
|
34488
|
-
}
|
|
34489
|
-
}
|
|
34490
34377
|
|
|
34491
|
-
var
|
|
34378
|
+
var atLeastOnceDeliveryPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
34492
34379
|
__proto__: null,
|
|
34380
|
+
AtLeastOnceDeliveryPolicyFactory: AtLeastOnceDeliveryPolicyFactory,
|
|
34493
34381
|
FACTORY_META: FACTORY_META$R,
|
|
34494
|
-
|
|
34495
|
-
default: NoopTraceEmitterFactory
|
|
34382
|
+
default: AtLeastOnceDeliveryPolicyFactory
|
|
34496
34383
|
});
|
|
34497
34384
|
|
|
34498
|
-
|
|
34499
|
-
|
|
34500
|
-
|
|
34501
|
-
|
|
34502
|
-
|
|
34503
|
-
|
|
34504
|
-
if (!openTelemetryTraceEmitterModulePromise) {
|
|
34505
|
-
openTelemetryTraceEmitterModulePromise = safeImport(() => Promise.resolve().then(function () { return openTelemetryTraceEmitter; }), '@opentelemetry/api', {
|
|
34506
|
-
helpMessage: MISSING_OTEL_HELP_MESSAGE,
|
|
34507
|
-
});
|
|
34385
|
+
/**
|
|
34386
|
+
* Message delivery policy that ensures envelopes are delivered at most once.
|
|
34387
|
+
*/
|
|
34388
|
+
class AtMostOnceDeliveryPolicy extends DeliveryPolicy {
|
|
34389
|
+
constructor() {
|
|
34390
|
+
super();
|
|
34508
34391
|
}
|
|
34509
|
-
|
|
34510
|
-
|
|
34511
|
-
function getOtelApiModule() {
|
|
34512
|
-
if (!otelApiModulePromise) {
|
|
34513
|
-
otelApiModulePromise = safeImport(() => import('@opentelemetry/api'), '@opentelemetry/api', {
|
|
34514
|
-
helpMessage: MISSING_OTEL_HELP_MESSAGE,
|
|
34515
|
-
});
|
|
34392
|
+
isAckRequired(_envelope) {
|
|
34393
|
+
return false;
|
|
34516
34394
|
}
|
|
34517
|
-
return otelApiModulePromise;
|
|
34518
34395
|
}
|
|
34519
|
-
|
|
34520
|
-
|
|
34521
|
-
|
|
34522
|
-
|
|
34523
|
-
|
|
34396
|
+
|
|
34397
|
+
class AtMostOnceDeliveryPolicyFactory extends DeliveryPolicyFactory {
|
|
34398
|
+
constructor() {
|
|
34399
|
+
super(...arguments);
|
|
34400
|
+
this.type = 'AtMostOnceDeliveryPolicy';
|
|
34401
|
+
}
|
|
34402
|
+
async create(_config) {
|
|
34403
|
+
return new AtMostOnceDeliveryPolicy();
|
|
34524
34404
|
}
|
|
34525
|
-
return otelSetupModulePromise;
|
|
34526
34405
|
}
|
|
34406
|
+
registerDeliveryPolicyFactory('AtMostOnceDeliveryPolicy', AtMostOnceDeliveryPolicyFactory);
|
|
34407
|
+
registerDeliveryPolicyFactory('AtMostOnceMessageDeliveryPolicy', AtMostOnceDeliveryPolicyFactory);
|
|
34527
34408
|
const FACTORY_META$Q = {
|
|
34528
|
-
base:
|
|
34529
|
-
key: '
|
|
34530
|
-
};
|
|
34531
|
-
class OpenTelemetryTraceEmitterFactory extends TraceEmitterFactory {
|
|
34532
|
-
constructor() {
|
|
34533
|
-
super(...arguments);
|
|
34534
|
-
this.type = 'OpenTelemetryTraceEmitter';
|
|
34535
|
-
}
|
|
34536
|
-
async create(config, ...factoryArgs) {
|
|
34537
|
-
const options = (factoryArgs[0] ??
|
|
34538
|
-
{});
|
|
34539
|
-
const normalized = normalizeConfig$n(config);
|
|
34540
|
-
const mergedHeaders = {
|
|
34541
|
-
...normalized.headers,
|
|
34542
|
-
...(options.headers ?? {}),
|
|
34543
|
-
};
|
|
34544
|
-
let authStrategy = null;
|
|
34545
|
-
if (normalized.auth) {
|
|
34546
|
-
authStrategy =
|
|
34547
|
-
await AuthInjectionStrategyFactory.createAuthInjectionStrategy(normalized.auth);
|
|
34548
|
-
try {
|
|
34549
|
-
await authStrategy.apply(mergedHeaders);
|
|
34550
|
-
logger$h.info('trace_emitter_auth_applied', {
|
|
34551
|
-
service_name: normalized.serviceName,
|
|
34552
|
-
});
|
|
34553
|
-
}
|
|
34554
|
-
catch (error) {
|
|
34555
|
-
try {
|
|
34556
|
-
await authStrategy.cleanup();
|
|
34557
|
-
}
|
|
34558
|
-
catch {
|
|
34559
|
-
// Ignore cleanup errors while propagating original failure
|
|
34560
|
-
}
|
|
34561
|
-
throw error;
|
|
34562
|
-
}
|
|
34563
|
-
}
|
|
34564
|
-
let lifecycle = null;
|
|
34565
|
-
try {
|
|
34566
|
-
const { setupOtel } = await getOtelSetupModule();
|
|
34567
|
-
lifecycle = await setupOtel({
|
|
34568
|
-
serviceName: normalized.serviceName,
|
|
34569
|
-
endpoint: normalized.endpoint,
|
|
34570
|
-
environment: normalized.environment,
|
|
34571
|
-
sampler: normalized.sampler,
|
|
34572
|
-
headers: Object.keys(mergedHeaders).length > 0 ? mergedHeaders : undefined,
|
|
34573
|
-
});
|
|
34574
|
-
logger$h.debug('trace_emitter_lifecycle_acquired', {
|
|
34575
|
-
service_name: normalized.serviceName,
|
|
34576
|
-
lifecycle_available: Boolean(lifecycle),
|
|
34577
|
-
});
|
|
34578
|
-
}
|
|
34579
|
-
catch (error) {
|
|
34580
|
-
if (authStrategy) {
|
|
34581
|
-
try {
|
|
34582
|
-
await authStrategy.cleanup();
|
|
34583
|
-
}
|
|
34584
|
-
catch {
|
|
34585
|
-
// Ignore cleanup errors while propagating original failure
|
|
34586
|
-
}
|
|
34587
|
-
}
|
|
34588
|
-
throw error;
|
|
34589
|
-
}
|
|
34590
|
-
const [{ OpenTelemetryTraceEmitter }, otelModule] = await Promise.all([
|
|
34591
|
-
getOpenTelemetryTraceEmitterModule(),
|
|
34592
|
-
getOtelApiModule(),
|
|
34593
|
-
]);
|
|
34594
|
-
const emitterOptions = {
|
|
34595
|
-
serviceName: normalized.serviceName,
|
|
34596
|
-
otelApi: {
|
|
34597
|
-
trace: otelModule.trace,
|
|
34598
|
-
SpanStatusCode: otelModule.SpanStatusCode,
|
|
34599
|
-
},
|
|
34600
|
-
};
|
|
34601
|
-
if (options.tracer) {
|
|
34602
|
-
emitterOptions.tracer = options.tracer;
|
|
34603
|
-
}
|
|
34604
|
-
if (lifecycle) {
|
|
34605
|
-
emitterOptions.lifecycle = lifecycle;
|
|
34606
|
-
}
|
|
34607
|
-
if (authStrategy) {
|
|
34608
|
-
emitterOptions.authStrategy = authStrategy;
|
|
34609
|
-
}
|
|
34610
|
-
try {
|
|
34611
|
-
const emitter = new OpenTelemetryTraceEmitter(emitterOptions);
|
|
34612
|
-
logger$h.debug('trace_emitter_created', {
|
|
34613
|
-
service_name: normalized.serviceName,
|
|
34614
|
-
has_lifecycle: Boolean(lifecycle),
|
|
34615
|
-
has_auth_strategy: Boolean(authStrategy),
|
|
34616
|
-
});
|
|
34617
|
-
return emitter;
|
|
34618
|
-
}
|
|
34619
|
-
catch (error) {
|
|
34620
|
-
if (authStrategy) {
|
|
34621
|
-
try {
|
|
34622
|
-
await authStrategy.cleanup();
|
|
34623
|
-
}
|
|
34624
|
-
catch {
|
|
34625
|
-
// Best effort cleanup
|
|
34626
|
-
}
|
|
34627
|
-
}
|
|
34628
|
-
throw error;
|
|
34629
|
-
}
|
|
34630
|
-
}
|
|
34631
|
-
}
|
|
34632
|
-
function normalizeConfig$n(config) {
|
|
34633
|
-
if (!config) {
|
|
34634
|
-
return {
|
|
34635
|
-
serviceName: 'naylence-service',
|
|
34636
|
-
endpoint: null,
|
|
34637
|
-
environment: null,
|
|
34638
|
-
sampler: null,
|
|
34639
|
-
headers: {},
|
|
34640
|
-
auth: null,
|
|
34641
|
-
};
|
|
34642
|
-
}
|
|
34643
|
-
const candidate = config;
|
|
34644
|
-
const serviceName = extractString(pickFirst$2(candidate, ['serviceName', 'service_name'])) ??
|
|
34645
|
-
'naylence-service';
|
|
34646
|
-
const endpoint = extractString(pickFirst$2(candidate, ['endpoint', 'otlpEndpoint', 'otlp_endpoint'])) ?? null;
|
|
34647
|
-
const environment = extractString(pickFirst$2(candidate, [
|
|
34648
|
-
'environment',
|
|
34649
|
-
'deploymentEnvironment',
|
|
34650
|
-
'deployment_environment',
|
|
34651
|
-
])) ?? null;
|
|
34652
|
-
const sampler = extractString(pickFirst$2(candidate, ['sampler', 'samplingStrategy', 'sampling_strategy'])) ?? null;
|
|
34653
|
-
const headersFromConfig = extractHeaders$1(pickFirst$2(candidate, ['headers', 'otlpHeaders', 'otlp_headers']));
|
|
34654
|
-
const authConfig = pickFirst$2(candidate, [
|
|
34655
|
-
'auth',
|
|
34656
|
-
]);
|
|
34657
|
-
return {
|
|
34658
|
-
serviceName,
|
|
34659
|
-
endpoint,
|
|
34660
|
-
environment,
|
|
34661
|
-
sampler,
|
|
34662
|
-
headers: headersFromConfig ?? {},
|
|
34663
|
-
auth: authConfig ?? null,
|
|
34664
|
-
};
|
|
34665
|
-
}
|
|
34666
|
-
function extractString(value) {
|
|
34667
|
-
if (typeof value === 'string' && value.trim().length > 0) {
|
|
34668
|
-
return value;
|
|
34669
|
-
}
|
|
34670
|
-
return undefined;
|
|
34671
|
-
}
|
|
34672
|
-
function pickFirst$2(source, keys) {
|
|
34673
|
-
for (const key of keys) {
|
|
34674
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
34675
|
-
const value = source[key];
|
|
34676
|
-
if (value !== undefined) {
|
|
34677
|
-
return value;
|
|
34678
|
-
}
|
|
34679
|
-
}
|
|
34680
|
-
}
|
|
34681
|
-
return undefined;
|
|
34682
|
-
}
|
|
34683
|
-
function extractHeaders$1(value) {
|
|
34684
|
-
if (!value || typeof value !== 'object') {
|
|
34685
|
-
return null;
|
|
34686
|
-
}
|
|
34687
|
-
const headers = {};
|
|
34688
|
-
for (const [key, raw] of Object.entries(value)) {
|
|
34689
|
-
if (typeof raw === 'string') {
|
|
34690
|
-
headers[key] = raw;
|
|
34691
|
-
}
|
|
34692
|
-
}
|
|
34693
|
-
return Object.keys(headers).length > 0 ? headers : null;
|
|
34694
|
-
}
|
|
34695
|
-
|
|
34696
|
-
var openTelemetryTraceEmitterFactory = /*#__PURE__*/Object.freeze({
|
|
34697
|
-
__proto__: null,
|
|
34698
|
-
FACTORY_META: FACTORY_META$Q,
|
|
34699
|
-
OpenTelemetryTraceEmitterFactory: OpenTelemetryTraceEmitterFactory,
|
|
34700
|
-
default: OpenTelemetryTraceEmitterFactory
|
|
34701
|
-
});
|
|
34702
|
-
|
|
34703
|
-
const logger$g = getLogger('naylence.fame.telemetry.trace_emitter_profile_factory');
|
|
34704
|
-
const PROFILE_NAME_NOOP$1 = 'noop';
|
|
34705
|
-
const PROFILE_NAME_OPEN_TELEMETRY = 'open-telemetry';
|
|
34706
|
-
const ENV_VAR_TELEMETRY_SERVICE_NAME = 'FAME_TELEMETRY_SERVICE_NAME';
|
|
34707
|
-
const NOOP_PROFILE$1 = {
|
|
34708
|
-
type: 'NoopTraceEmitter',
|
|
34709
|
-
};
|
|
34710
|
-
const OPEN_TELEMETRY_PROFILE = {
|
|
34711
|
-
type: 'OpenTelemetryTraceEmitter',
|
|
34712
|
-
serviceName: factory.Expressions.env(ENV_VAR_TELEMETRY_SERVICE_NAME, 'naylence-service'),
|
|
34713
|
-
headers: {},
|
|
34714
|
-
};
|
|
34715
|
-
const PROFILE_MAP$3 = {
|
|
34716
|
-
[PROFILE_NAME_NOOP$1]: NOOP_PROFILE$1,
|
|
34717
|
-
[PROFILE_NAME_OPEN_TELEMETRY]: OPEN_TELEMETRY_PROFILE,
|
|
34718
|
-
};
|
|
34719
|
-
const FACTORY_META$P = {
|
|
34720
|
-
base: TRACE_EMITTER_FACTORY_BASE_TYPE,
|
|
34721
|
-
key: 'TraceEmitterProfile',
|
|
34722
|
-
};
|
|
34723
|
-
class TraceEmitterProfileFactory extends TraceEmitterFactory {
|
|
34724
|
-
constructor() {
|
|
34725
|
-
super(...arguments);
|
|
34726
|
-
this.type = 'TraceEmitterProfile';
|
|
34727
|
-
}
|
|
34728
|
-
async create(config, ...factoryArgs) {
|
|
34729
|
-
const normalized = normalizeTraceEmitterProfileConfig(config);
|
|
34730
|
-
const profileConfig = resolveProfileConfig$2(normalized.profile);
|
|
34731
|
-
logger$g.debug('enabling_trace_emitter_profile', {
|
|
34732
|
-
profile: normalized.profile,
|
|
34733
|
-
});
|
|
34734
|
-
const traceEmitter = await TraceEmitterFactory.createTraceEmitter(profileConfig, {
|
|
34735
|
-
factoryArgs,
|
|
34736
|
-
});
|
|
34737
|
-
if (!traceEmitter) {
|
|
34738
|
-
throw new Error(`Failed to instantiate trace emitter profile: ${normalized.profile}`);
|
|
34739
|
-
}
|
|
34740
|
-
return traceEmitter;
|
|
34741
|
-
}
|
|
34742
|
-
}
|
|
34743
|
-
function normalizeTraceEmitterProfileConfig(config) {
|
|
34744
|
-
if (!config) {
|
|
34745
|
-
return { profile: PROFILE_NAME_NOOP$1 };
|
|
34746
|
-
}
|
|
34747
|
-
const candidate = config;
|
|
34748
|
-
const profileValue = resolveProfileName$1(candidate);
|
|
34749
|
-
const canonicalProfile = canonicalizeProfileName(profileValue);
|
|
34750
|
-
candidate.profile = canonicalProfile;
|
|
34751
|
-
return { profile: canonicalProfile };
|
|
34752
|
-
}
|
|
34753
|
-
function resolveProfileName$1(candidate) {
|
|
34754
|
-
const direct = coerceProfileString$1(candidate.profile);
|
|
34755
|
-
if (direct) {
|
|
34756
|
-
return direct;
|
|
34757
|
-
}
|
|
34758
|
-
const legacyKeys = ['profile_name', 'profileName'];
|
|
34759
|
-
for (const legacyKey of legacyKeys) {
|
|
34760
|
-
const legacyValue = coerceProfileString$1(candidate[legacyKey]);
|
|
34761
|
-
if (legacyValue) {
|
|
34762
|
-
return legacyValue;
|
|
34763
|
-
}
|
|
34764
|
-
}
|
|
34765
|
-
return PROFILE_NAME_NOOP$1;
|
|
34766
|
-
}
|
|
34767
|
-
function coerceProfileString$1(value) {
|
|
34768
|
-
if (typeof value !== 'string') {
|
|
34769
|
-
return null;
|
|
34770
|
-
}
|
|
34771
|
-
const trimmed = value.trim();
|
|
34772
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
34773
|
-
}
|
|
34774
|
-
const PROFILE_ALIASES = {
|
|
34775
|
-
noop: PROFILE_NAME_NOOP$1,
|
|
34776
|
-
'no-op': PROFILE_NAME_NOOP$1,
|
|
34777
|
-
no_op: PROFILE_NAME_NOOP$1,
|
|
34778
|
-
'open-telemetry': PROFILE_NAME_OPEN_TELEMETRY,
|
|
34779
|
-
open_telemetry: PROFILE_NAME_OPEN_TELEMETRY,
|
|
34780
|
-
opentelemetry: PROFILE_NAME_OPEN_TELEMETRY,
|
|
34781
|
-
};
|
|
34782
|
-
function canonicalizeProfileName(value) {
|
|
34783
|
-
const normalized = value.replace(/[\s_]+/g, '-').toLowerCase();
|
|
34784
|
-
return PROFILE_ALIASES[normalized] ?? normalized;
|
|
34785
|
-
}
|
|
34786
|
-
function resolveProfileConfig$2(profileName) {
|
|
34787
|
-
const profile = PROFILE_MAP$3[profileName];
|
|
34788
|
-
if (!profile) {
|
|
34789
|
-
throw new Error(`Unknown trace emitter profile: ${profileName}`);
|
|
34790
|
-
}
|
|
34791
|
-
return deepClone$2(profile);
|
|
34792
|
-
}
|
|
34793
|
-
function deepClone$2(value) {
|
|
34794
|
-
return JSON.parse(JSON.stringify(value));
|
|
34795
|
-
}
|
|
34796
|
-
|
|
34797
|
-
var traceEmitterProfileFactory = /*#__PURE__*/Object.freeze({
|
|
34798
|
-
__proto__: null,
|
|
34799
|
-
FACTORY_META: FACTORY_META$P,
|
|
34800
|
-
PROFILE_NAME_NOOP: PROFILE_NAME_NOOP$1,
|
|
34801
|
-
PROFILE_NAME_OPEN_TELEMETRY: PROFILE_NAME_OPEN_TELEMETRY,
|
|
34802
|
-
TraceEmitterProfileFactory: TraceEmitterProfileFactory,
|
|
34803
|
-
default: TraceEmitterProfileFactory
|
|
34804
|
-
});
|
|
34805
|
-
|
|
34806
|
-
/**
|
|
34807
|
-
* Base abstraction for message delivery policies.
|
|
34808
|
-
*/
|
|
34809
|
-
class DeliveryPolicy {
|
|
34810
|
-
constructor(options = {}) {
|
|
34811
|
-
this.senderPolicy = options.senderRetryPolicy;
|
|
34812
|
-
this.receiverPolicy = options.receiverRetryPolicy;
|
|
34813
|
-
}
|
|
34814
|
-
/**
|
|
34815
|
-
* Determine if the policy requires an acknowledgement for the envelope.
|
|
34816
|
-
*/
|
|
34817
|
-
isAckRequired(_envelope) {
|
|
34818
|
-
return false;
|
|
34819
|
-
}
|
|
34820
|
-
get senderRetryPolicy() {
|
|
34821
|
-
return this.senderPolicy;
|
|
34822
|
-
}
|
|
34823
|
-
get receiverRetryPolicy() {
|
|
34824
|
-
return this.receiverPolicy;
|
|
34825
|
-
}
|
|
34826
|
-
}
|
|
34827
|
-
|
|
34828
|
-
/**
|
|
34829
|
-
* Message delivery policy that ensures envelopes are delivered at least once.
|
|
34830
|
-
*/
|
|
34831
|
-
class AtLeastOnceDeliveryPolicy extends DeliveryPolicy {
|
|
34832
|
-
constructor(options = {}) {
|
|
34833
|
-
super(options);
|
|
34834
|
-
}
|
|
34835
|
-
isAckRequired(envelope) {
|
|
34836
|
-
const frame = envelope?.frame;
|
|
34837
|
-
const frameType = typeof frame?.type === 'string' ? frame.type : null;
|
|
34838
|
-
if (!frameType) {
|
|
34839
|
-
return false;
|
|
34840
|
-
}
|
|
34841
|
-
return frameType === 'Data' || frameType === 'DataFrame';
|
|
34842
|
-
}
|
|
34843
|
-
}
|
|
34844
|
-
|
|
34845
|
-
/**
|
|
34846
|
-
* Configuration and helper for retry backoff behaviour.
|
|
34847
|
-
*/
|
|
34848
|
-
class RetryPolicy {
|
|
34849
|
-
constructor(options = {}) {
|
|
34850
|
-
this.maxRetries = Math.max(0, Math.trunc(options.maxRetries ?? 0));
|
|
34851
|
-
this.baseDelayMs = Math.max(0, Math.trunc(options.baseDelayMs ?? 200));
|
|
34852
|
-
this.maxDelayMs = Math.max(this.baseDelayMs, Math.trunc(options.maxDelayMs ?? 10000));
|
|
34853
|
-
this.jitterMs = Math.max(0, Math.trunc(options.jitterMs ?? 50));
|
|
34854
|
-
this.backoffFactor = Math.max(0, options.backoffFactor ?? 2.0);
|
|
34855
|
-
}
|
|
34856
|
-
/**
|
|
34857
|
-
* Calculate the next retry delay based on attempt number (0-indexed).
|
|
34858
|
-
*/
|
|
34859
|
-
nextDelayMs(attempt) {
|
|
34860
|
-
const normalizedAttempt = Number.isFinite(attempt)
|
|
34861
|
-
? Math.max(0, Math.trunc(attempt))
|
|
34862
|
-
: 0;
|
|
34863
|
-
const base = normalizedAttempt <= 0
|
|
34864
|
-
? this.baseDelayMs
|
|
34865
|
-
: Math.round(this.baseDelayMs * this.backoffFactor ** normalizedAttempt);
|
|
34866
|
-
const jitter = this.jitterMs > 0
|
|
34867
|
-
? Math.round((Math.random() * 2 - 1) * this.jitterMs)
|
|
34868
|
-
: 0;
|
|
34869
|
-
const withJitter = base + jitter;
|
|
34870
|
-
return Math.min(this.maxDelayMs, Math.max(0, withJitter));
|
|
34871
|
-
}
|
|
34872
|
-
}
|
|
34873
|
-
|
|
34874
|
-
const LEGACY_POLICY_KEYS = {
|
|
34875
|
-
senderRetryPolicy: ['sender_retry_policy', 'sender_retryPolicy'],
|
|
34876
|
-
receiverRetryPolicy: ['receiver_retry_policy', 'receiver_retryPolicy'],
|
|
34877
|
-
};
|
|
34878
|
-
class AtLeastOnceDeliveryPolicyFactory extends DeliveryPolicyFactory {
|
|
34879
|
-
constructor() {
|
|
34880
|
-
super(...arguments);
|
|
34881
|
-
this.type = 'AtLeastOnceDeliveryPolicy';
|
|
34882
|
-
this.isDefault = true;
|
|
34883
|
-
}
|
|
34884
|
-
async create(config) {
|
|
34885
|
-
const normalized = normalizeAtLeastOnceConfig(config);
|
|
34886
|
-
const options = {
|
|
34887
|
-
...(normalized.senderRetryPolicy
|
|
34888
|
-
? { senderRetryPolicy: normalized.senderRetryPolicy }
|
|
34889
|
-
: {}),
|
|
34890
|
-
...(normalized.receiverRetryPolicy
|
|
34891
|
-
? { receiverRetryPolicy: normalized.receiverRetryPolicy }
|
|
34892
|
-
: {}),
|
|
34893
|
-
};
|
|
34894
|
-
return new AtLeastOnceDeliveryPolicy(options);
|
|
34895
|
-
}
|
|
34896
|
-
}
|
|
34897
|
-
function normalizeAtLeastOnceConfig(config) {
|
|
34898
|
-
if (!config) {
|
|
34899
|
-
return {};
|
|
34900
|
-
}
|
|
34901
|
-
const candidate = config;
|
|
34902
|
-
const senderPolicyInput = getRetryPolicyInput(candidate, 'senderRetryPolicy');
|
|
34903
|
-
const receiverPolicyInput = getRetryPolicyInput(candidate, 'receiverRetryPolicy');
|
|
34904
|
-
return {
|
|
34905
|
-
senderRetryPolicy: resolveRetryPolicy(senderPolicyInput),
|
|
34906
|
-
receiverRetryPolicy: resolveRetryPolicy(receiverPolicyInput),
|
|
34907
|
-
};
|
|
34908
|
-
}
|
|
34909
|
-
function getRetryPolicyInput(candidate, key) {
|
|
34910
|
-
const camelKey = key;
|
|
34911
|
-
const primary = candidate[camelKey];
|
|
34912
|
-
if (primary !== undefined) {
|
|
34913
|
-
return primary;
|
|
34914
|
-
}
|
|
34915
|
-
const legacyKeys = LEGACY_POLICY_KEYS[key] ?? [];
|
|
34916
|
-
for (const legacyKey of legacyKeys) {
|
|
34917
|
-
const value = candidate[legacyKey];
|
|
34918
|
-
if (value !== undefined) {
|
|
34919
|
-
candidate[camelKey] = value;
|
|
34920
|
-
return value;
|
|
34921
|
-
}
|
|
34922
|
-
}
|
|
34923
|
-
return undefined;
|
|
34924
|
-
}
|
|
34925
|
-
function resolveRetryPolicy(input) {
|
|
34926
|
-
if (!input) {
|
|
34927
|
-
return undefined;
|
|
34928
|
-
}
|
|
34929
|
-
if (input instanceof RetryPolicy) {
|
|
34930
|
-
return input;
|
|
34931
|
-
}
|
|
34932
|
-
const record = input;
|
|
34933
|
-
const options = {
|
|
34934
|
-
...(withOption(record, ['maxRetries', 'max_retries']) ?? {}),
|
|
34935
|
-
...(withOption(record, ['baseDelayMs', 'base_delay_ms']) ?? {}),
|
|
34936
|
-
...(withOption(record, ['maxDelayMs', 'max_delay_ms']) ?? {}),
|
|
34937
|
-
...(withOption(record, ['jitterMs', 'jitter_ms']) ?? {}),
|
|
34938
|
-
...(withOption(record, ['backoffFactor', 'backoff_factor']) ?? {}),
|
|
34939
|
-
};
|
|
34940
|
-
return new RetryPolicy(options);
|
|
34941
|
-
}
|
|
34942
|
-
function extractNumber(source, keys) {
|
|
34943
|
-
for (const key of keys) {
|
|
34944
|
-
if (key in source) {
|
|
34945
|
-
const value = source[key];
|
|
34946
|
-
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
34947
|
-
return value;
|
|
34948
|
-
}
|
|
34949
|
-
if (typeof value === 'string' && value.trim().length > 0) {
|
|
34950
|
-
const parsed = Number(value);
|
|
34951
|
-
if (!Number.isNaN(parsed)) {
|
|
34952
|
-
return parsed;
|
|
34953
|
-
}
|
|
34954
|
-
}
|
|
34955
|
-
}
|
|
34956
|
-
}
|
|
34957
|
-
return undefined;
|
|
34958
|
-
}
|
|
34959
|
-
function withOption(source, keys) {
|
|
34960
|
-
const value = extractNumber(source, keys);
|
|
34961
|
-
if (value === undefined) {
|
|
34962
|
-
return undefined;
|
|
34963
|
-
}
|
|
34964
|
-
const camelKey = keys[0];
|
|
34965
|
-
return {
|
|
34966
|
-
[camelKey]: value,
|
|
34967
|
-
};
|
|
34968
|
-
}
|
|
34969
|
-
const FACTORY_META$O = {
|
|
34970
|
-
base: DELIVERY_POLICY_FACTORY_BASE_TYPE,
|
|
34971
|
-
key: 'AtLeastOnceDeliveryPolicy',
|
|
34972
|
-
};
|
|
34973
|
-
|
|
34974
|
-
var atLeastOnceDeliveryPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
34975
|
-
__proto__: null,
|
|
34976
|
-
AtLeastOnceDeliveryPolicyFactory: AtLeastOnceDeliveryPolicyFactory,
|
|
34977
|
-
FACTORY_META: FACTORY_META$O,
|
|
34978
|
-
default: AtLeastOnceDeliveryPolicyFactory
|
|
34979
|
-
});
|
|
34980
|
-
|
|
34981
|
-
/**
|
|
34982
|
-
* Message delivery policy that ensures envelopes are delivered at most once.
|
|
34983
|
-
*/
|
|
34984
|
-
class AtMostOnceDeliveryPolicy extends DeliveryPolicy {
|
|
34985
|
-
constructor() {
|
|
34986
|
-
super();
|
|
34987
|
-
}
|
|
34988
|
-
isAckRequired(_envelope) {
|
|
34989
|
-
return false;
|
|
34990
|
-
}
|
|
34991
|
-
}
|
|
34992
|
-
|
|
34993
|
-
class AtMostOnceDeliveryPolicyFactory extends DeliveryPolicyFactory {
|
|
34994
|
-
constructor() {
|
|
34995
|
-
super(...arguments);
|
|
34996
|
-
this.type = 'AtMostOnceDeliveryPolicy';
|
|
34997
|
-
}
|
|
34998
|
-
async create(_config) {
|
|
34999
|
-
return new AtMostOnceDeliveryPolicy();
|
|
35000
|
-
}
|
|
35001
|
-
}
|
|
35002
|
-
registerDeliveryPolicyFactory('AtMostOnceDeliveryPolicy', AtMostOnceDeliveryPolicyFactory);
|
|
35003
|
-
registerDeliveryPolicyFactory('AtMostOnceMessageDeliveryPolicy', AtMostOnceDeliveryPolicyFactory);
|
|
35004
|
-
const FACTORY_META$N = {
|
|
35005
|
-
base: DELIVERY_POLICY_FACTORY_BASE_TYPE,
|
|
35006
|
-
key: 'AtMostOnceDeliveryPolicy',
|
|
34409
|
+
base: DELIVERY_POLICY_FACTORY_BASE_TYPE,
|
|
34410
|
+
key: 'AtMostOnceDeliveryPolicy',
|
|
35007
34411
|
};
|
|
35008
34412
|
|
|
35009
34413
|
var atMostOnceDeliveryPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
35010
34414
|
__proto__: null,
|
|
35011
34415
|
AtMostOnceDeliveryPolicyFactory: AtMostOnceDeliveryPolicyFactory,
|
|
35012
|
-
FACTORY_META: FACTORY_META$
|
|
34416
|
+
FACTORY_META: FACTORY_META$Q,
|
|
35013
34417
|
default: AtMostOnceDeliveryPolicyFactory
|
|
35014
34418
|
});
|
|
35015
34419
|
|
|
35016
|
-
const logger$
|
|
34420
|
+
const logger$h = getLogger('naylence.fame.delivery.delivery_profile_factory');
|
|
35017
34421
|
const PROFILE_NAME_AT_LEAST_ONCE = 'at-least-once';
|
|
35018
34422
|
const PROFILE_NAME_AT_MOST_ONCE = 'at-most-once';
|
|
35019
34423
|
const ENV_VAR_FAME_DELIVERY_MAX_RETRIES = 'FAME_DELIVERY_MAX_RETRIES';
|
|
@@ -35041,7 +34445,7 @@ const AT_LEAST_ONCE_PROFILE = {
|
|
|
35041
34445
|
const AT_MOST_ONCE_PROFILE = {
|
|
35042
34446
|
type: 'AtMostOnceDeliveryPolicy',
|
|
35043
34447
|
};
|
|
35044
|
-
const PROFILE_MAP$
|
|
34448
|
+
const PROFILE_MAP$3 = {
|
|
35045
34449
|
[PROFILE_NAME_AT_LEAST_ONCE]: AT_LEAST_ONCE_PROFILE,
|
|
35046
34450
|
[PROFILE_NAME_AT_MOST_ONCE]: AT_MOST_ONCE_PROFILE,
|
|
35047
34451
|
};
|
|
@@ -35052,8 +34456,8 @@ class DeliveryProfileFactory extends DeliveryPolicyFactory {
|
|
|
35052
34456
|
}
|
|
35053
34457
|
async create(config) {
|
|
35054
34458
|
const normalized = normalizeDeliveryProfileConfig(config);
|
|
35055
|
-
const profileConfig = resolveProfileConfig$
|
|
35056
|
-
logger$
|
|
34459
|
+
const profileConfig = resolveProfileConfig$2(normalized.profile);
|
|
34460
|
+
logger$h.debug('enabling_delivery_profile', { profile: normalized.profile });
|
|
35057
34461
|
const policy = await DeliveryPolicyFactory.createDeliveryPolicy(profileConfig);
|
|
35058
34462
|
if (!policy) {
|
|
35059
34463
|
throw new Error(`Failed to create delivery policy for profile: ${normalized.profile}`);
|
|
@@ -35066,18 +34470,18 @@ function normalizeDeliveryProfileConfig(config) {
|
|
|
35066
34470
|
return { profile: PROFILE_NAME_AT_LEAST_ONCE };
|
|
35067
34471
|
}
|
|
35068
34472
|
const candidate = config;
|
|
35069
|
-
const profileValue = resolveProfileName(candidate);
|
|
34473
|
+
const profileValue = resolveProfileName$1(candidate);
|
|
35070
34474
|
candidate.profile = profileValue;
|
|
35071
34475
|
return { profile: profileValue.toLowerCase() };
|
|
35072
34476
|
}
|
|
35073
|
-
function resolveProfileName(candidate) {
|
|
35074
|
-
const value = coerceProfileString(candidate.profile);
|
|
34477
|
+
function resolveProfileName$1(candidate) {
|
|
34478
|
+
const value = coerceProfileString$1(candidate.profile);
|
|
35075
34479
|
if (value) {
|
|
35076
34480
|
return value;
|
|
35077
34481
|
}
|
|
35078
34482
|
const legacyKeys = ['profile_name', 'profileName'];
|
|
35079
34483
|
for (const legacyKey of legacyKeys) {
|
|
35080
|
-
const legacyValue = coerceProfileString(candidate[legacyKey]);
|
|
34484
|
+
const legacyValue = coerceProfileString$1(candidate[legacyKey]);
|
|
35081
34485
|
if (legacyValue) {
|
|
35082
34486
|
candidate.profile = legacyValue;
|
|
35083
34487
|
return legacyValue;
|
|
@@ -35085,24 +34489,24 @@ function resolveProfileName(candidate) {
|
|
|
35085
34489
|
}
|
|
35086
34490
|
return PROFILE_NAME_AT_LEAST_ONCE;
|
|
35087
34491
|
}
|
|
35088
|
-
function coerceProfileString(value) {
|
|
34492
|
+
function coerceProfileString$1(value) {
|
|
35089
34493
|
if (typeof value !== 'string') {
|
|
35090
34494
|
return null;
|
|
35091
34495
|
}
|
|
35092
34496
|
const trimmed = value.trim();
|
|
35093
34497
|
return trimmed.length > 0 ? trimmed : null;
|
|
35094
34498
|
}
|
|
35095
|
-
function resolveProfileConfig$
|
|
35096
|
-
const profile = PROFILE_MAP$
|
|
34499
|
+
function resolveProfileConfig$2(profileName) {
|
|
34500
|
+
const profile = PROFILE_MAP$3[profileName];
|
|
35097
34501
|
if (!profile) {
|
|
35098
34502
|
throw new Error(`Unknown delivery profile: ${profileName}`);
|
|
35099
34503
|
}
|
|
35100
|
-
return deepClone$
|
|
34504
|
+
return deepClone$2(profile);
|
|
35101
34505
|
}
|
|
35102
|
-
function deepClone$
|
|
34506
|
+
function deepClone$2(value) {
|
|
35103
34507
|
return JSON.parse(JSON.stringify(value));
|
|
35104
34508
|
}
|
|
35105
|
-
const FACTORY_META$
|
|
34509
|
+
const FACTORY_META$P = {
|
|
35106
34510
|
base: DELIVERY_POLICY_FACTORY_BASE_TYPE,
|
|
35107
34511
|
key: 'DeliveryProfile',
|
|
35108
34512
|
};
|
|
@@ -35110,13 +34514,13 @@ const FACTORY_META$M = {
|
|
|
35110
34514
|
var deliveryProfileFactory = /*#__PURE__*/Object.freeze({
|
|
35111
34515
|
__proto__: null,
|
|
35112
34516
|
DeliveryProfileFactory: DeliveryProfileFactory,
|
|
35113
|
-
FACTORY_META: FACTORY_META$
|
|
34517
|
+
FACTORY_META: FACTORY_META$P,
|
|
35114
34518
|
PROFILE_NAME_AT_LEAST_ONCE: PROFILE_NAME_AT_LEAST_ONCE,
|
|
35115
34519
|
PROFILE_NAME_AT_MOST_ONCE: PROFILE_NAME_AT_MOST_ONCE,
|
|
35116
34520
|
default: DeliveryProfileFactory
|
|
35117
34521
|
});
|
|
35118
34522
|
|
|
35119
|
-
const logger$
|
|
34523
|
+
const logger$g = getLogger('naylence.fame.node.admission.admission_profile_factory');
|
|
35120
34524
|
const ENV_VAR_IS_ROOT = 'FAME_ROOT';
|
|
35121
34525
|
const ENV_VAR_JWT_AUDIENCE = 'FAME_JWT_AUDIENCE';
|
|
35122
34526
|
const ENV_VAR_ADMISSION_TOKEN_URL = 'FAME_ADMISSION_TOKEN_URL';
|
|
@@ -35140,7 +34544,7 @@ const PROFILE_NAME_DIRECT_HTTP = 'direct-http';
|
|
|
35140
34544
|
const PROFILE_NAME_DIRECT_INPAGE = 'direct-inpage';
|
|
35141
34545
|
const PROFILE_NAME_DIRECT_PKCE = 'direct-pkce';
|
|
35142
34546
|
const PROFILE_NAME_OPEN = 'open';
|
|
35143
|
-
const PROFILE_NAME_NOOP = 'noop';
|
|
34547
|
+
const PROFILE_NAME_NOOP$1 = 'noop';
|
|
35144
34548
|
const PROFILE_NAME_NONE = 'none';
|
|
35145
34549
|
const PROFILE_NAME_DIRECT_INPAGE_ALIAS = 'direct_inpage';
|
|
35146
34550
|
const PROFILE_NAME_DIRECT_PKCE_ALIAS = 'direct_pkce';
|
|
@@ -35320,12 +34724,12 @@ const OPEN_PROFILE = {
|
|
|
35320
34724
|
},
|
|
35321
34725
|
],
|
|
35322
34726
|
};
|
|
35323
|
-
const NOOP_PROFILE = {
|
|
34727
|
+
const NOOP_PROFILE$1 = {
|
|
35324
34728
|
type: 'NoopAdmissionClient',
|
|
35325
34729
|
auto_accept_logicals: true,
|
|
35326
34730
|
autoAcceptLogicals: true,
|
|
35327
34731
|
};
|
|
35328
|
-
const PROFILE_MAP$
|
|
34732
|
+
const PROFILE_MAP$2 = {
|
|
35329
34733
|
[PROFILE_NAME_WELCOME]: WELCOME_SERVICE_PROFILE,
|
|
35330
34734
|
[PROFILE_NAME_WELCOME_PKCE]: WELCOME_SERVICE_PKCE_PROFILE,
|
|
35331
34735
|
[PROFILE_NAME_WELCOME_PKCE_ALIAS]: WELCOME_SERVICE_PKCE_PROFILE,
|
|
@@ -35336,10 +34740,10 @@ const PROFILE_MAP$1 = {
|
|
|
35336
34740
|
[PROFILE_NAME_DIRECT_INPAGE]: DIRECT_INPAGE_PROFILE,
|
|
35337
34741
|
[PROFILE_NAME_DIRECT_INPAGE_ALIAS]: DIRECT_INPAGE_PROFILE,
|
|
35338
34742
|
[PROFILE_NAME_OPEN]: OPEN_PROFILE,
|
|
35339
|
-
[PROFILE_NAME_NOOP]: NOOP_PROFILE,
|
|
35340
|
-
[PROFILE_NAME_NONE]: NOOP_PROFILE,
|
|
34743
|
+
[PROFILE_NAME_NOOP$1]: NOOP_PROFILE$1,
|
|
34744
|
+
[PROFILE_NAME_NONE]: NOOP_PROFILE$1,
|
|
35341
34745
|
};
|
|
35342
|
-
const FACTORY_META$
|
|
34746
|
+
const FACTORY_META$O = {
|
|
35343
34747
|
base: ADMISSION_CLIENT_FACTORY_BASE_TYPE,
|
|
35344
34748
|
key: 'AdmissionProfile',
|
|
35345
34749
|
};
|
|
@@ -35349,13 +34753,13 @@ class AdmissionProfileFactory extends AdmissionClientFactory {
|
|
|
35349
34753
|
this.type = 'AdmissionProfile';
|
|
35350
34754
|
}
|
|
35351
34755
|
async create(config) {
|
|
35352
|
-
const normalized = normalizeConfig$
|
|
35353
|
-
const profileConfig = resolveProfileConfig(normalized.profile);
|
|
35354
|
-
logger$
|
|
34756
|
+
const normalized = normalizeConfig$n(config);
|
|
34757
|
+
const profileConfig = resolveProfileConfig$1(normalized.profile);
|
|
34758
|
+
logger$g.debug('enabling_admission_profile', { profile: normalized.profile });
|
|
35355
34759
|
return AdmissionClientFactory.createAdmissionClient(profileConfig);
|
|
35356
34760
|
}
|
|
35357
34761
|
}
|
|
35358
|
-
function normalizeConfig$
|
|
34762
|
+
function normalizeConfig$n(config) {
|
|
35359
34763
|
if (!config) {
|
|
35360
34764
|
return { profile: PROFILE_NAME_DIRECT };
|
|
35361
34765
|
}
|
|
@@ -35372,25 +34776,25 @@ function normalizeConfig$m(config) {
|
|
|
35372
34776
|
const normalizedProfile = profileValue.trim().toLowerCase();
|
|
35373
34777
|
return { profile: normalizedProfile };
|
|
35374
34778
|
}
|
|
35375
|
-
function resolveProfileConfig(profileName) {
|
|
35376
|
-
const profile = PROFILE_MAP$
|
|
34779
|
+
function resolveProfileConfig$1(profileName) {
|
|
34780
|
+
const profile = PROFILE_MAP$2[profileName];
|
|
35377
34781
|
if (!profile) {
|
|
35378
34782
|
throw new Error(`Unknown admission profile: ${profileName}`);
|
|
35379
34783
|
}
|
|
35380
|
-
return deepClone(profile);
|
|
34784
|
+
return deepClone$1(profile);
|
|
35381
34785
|
}
|
|
35382
|
-
function deepClone(value) {
|
|
34786
|
+
function deepClone$1(value) {
|
|
35383
34787
|
return JSON.parse(JSON.stringify(value));
|
|
35384
34788
|
}
|
|
35385
34789
|
|
|
35386
34790
|
var admissionProfileFactory = /*#__PURE__*/Object.freeze({
|
|
35387
34791
|
__proto__: null,
|
|
35388
34792
|
AdmissionProfileFactory: AdmissionProfileFactory,
|
|
35389
|
-
FACTORY_META: FACTORY_META$
|
|
34793
|
+
FACTORY_META: FACTORY_META$O,
|
|
35390
34794
|
default: AdmissionProfileFactory
|
|
35391
34795
|
});
|
|
35392
34796
|
|
|
35393
|
-
const logger$
|
|
34797
|
+
const logger$f = getLogger('naylence.fame.node.admission.direct_admission_client');
|
|
35394
34798
|
class DirectAdmissionClient {
|
|
35395
34799
|
constructor(options) {
|
|
35396
34800
|
this.hasUpstream = true;
|
|
@@ -35415,7 +34819,7 @@ class DirectAdmissionClient {
|
|
|
35415
34819
|
}
|
|
35416
34820
|
}
|
|
35417
34821
|
async hello(systemId, instanceId, requestedLogicals) {
|
|
35418
|
-
logger$
|
|
34822
|
+
logger$f.debug('direct_admission_hello_start', {
|
|
35419
34823
|
providedSystemId: systemId,
|
|
35420
34824
|
instanceId,
|
|
35421
34825
|
requestedLogicals,
|
|
@@ -35423,7 +34827,7 @@ class DirectAdmissionClient {
|
|
|
35423
34827
|
const effectiveSystemId = systemId && systemId.trim().length > 0
|
|
35424
34828
|
? systemId
|
|
35425
34829
|
: await core.generateIdAsync({ mode: 'fingerprint' }).catch(async () => {
|
|
35426
|
-
logger$
|
|
34830
|
+
logger$f.debug('direct_admission_fingerprint_generation_failed', {
|
|
35427
34831
|
reason: 'falling back to random id',
|
|
35428
34832
|
});
|
|
35429
34833
|
return core.generateIdAsync({ mode: 'random' });
|
|
@@ -35445,7 +34849,7 @@ class DirectAdmissionClient {
|
|
|
35445
34849
|
const envelope = core.createFameEnvelope({
|
|
35446
34850
|
frame: welcomeFrame,
|
|
35447
34851
|
});
|
|
35448
|
-
logger$
|
|
34852
|
+
logger$f.debug('direct_admission_hello_success', {
|
|
35449
34853
|
systemId: welcomeFrame.systemId,
|
|
35450
34854
|
instanceId: welcomeFrame.instanceId,
|
|
35451
34855
|
acceptedLogicals: welcomeFrame.acceptedLogicals,
|
|
@@ -35468,7 +34872,7 @@ function cloneGrant(grant) {
|
|
|
35468
34872
|
return JSON.parse(JSON.stringify(grant));
|
|
35469
34873
|
}
|
|
35470
34874
|
|
|
35471
|
-
const FACTORY_META$
|
|
34875
|
+
const FACTORY_META$N = {
|
|
35472
34876
|
base: ADMISSION_CLIENT_FACTORY_BASE_TYPE,
|
|
35473
34877
|
key: 'DirectAdmissionClient',
|
|
35474
34878
|
};
|
|
@@ -35481,7 +34885,7 @@ class DirectAdmissionClientFactory extends AdmissionClientFactory {
|
|
|
35481
34885
|
if (!config) {
|
|
35482
34886
|
throw new Error('DirectAdmissionClient configuration is required');
|
|
35483
34887
|
}
|
|
35484
|
-
const normalized = normalizeConfig$
|
|
34888
|
+
const normalized = normalizeConfig$m(config);
|
|
35485
34889
|
const evaluatedGrants = normalized.connectionGrants.map((grant) => {
|
|
35486
34890
|
const evaluated = ConnectorFactory.evaluateGrant({
|
|
35487
34891
|
...grant,
|
|
@@ -35494,7 +34898,7 @@ class DirectAdmissionClientFactory extends AdmissionClientFactory {
|
|
|
35494
34898
|
});
|
|
35495
34899
|
}
|
|
35496
34900
|
}
|
|
35497
|
-
function normalizeConfig$
|
|
34901
|
+
function normalizeConfig$m(config) {
|
|
35498
34902
|
const source = config;
|
|
35499
34903
|
const connectionGrantsRaw = source.connectionGrants ?? source.connection_grants;
|
|
35500
34904
|
if (!Array.isArray(connectionGrantsRaw) || connectionGrantsRaw.length === 0) {
|
|
@@ -35520,11 +34924,11 @@ function normalizeConfig$l(config) {
|
|
|
35520
34924
|
var directAdmissionClientFactory = /*#__PURE__*/Object.freeze({
|
|
35521
34925
|
__proto__: null,
|
|
35522
34926
|
DirectAdmissionClientFactory: DirectAdmissionClientFactory,
|
|
35523
|
-
FACTORY_META: FACTORY_META$
|
|
34927
|
+
FACTORY_META: FACTORY_META$N,
|
|
35524
34928
|
default: DirectAdmissionClientFactory
|
|
35525
34929
|
});
|
|
35526
34930
|
|
|
35527
|
-
const FACTORY_META$
|
|
34931
|
+
const FACTORY_META$M = {
|
|
35528
34932
|
base: ADMISSION_CLIENT_FACTORY_BASE_TYPE,
|
|
35529
34933
|
key: 'NoopAdmissionClient',
|
|
35530
34934
|
};
|
|
@@ -35536,11 +34940,11 @@ class NoopAdmissionClientFactory extends AdmissionClientFactory {
|
|
|
35536
34940
|
this.priority = 0;
|
|
35537
34941
|
}
|
|
35538
34942
|
async create(config, ...factoryArgs) {
|
|
35539
|
-
const resolved = normalizeConfig$
|
|
34943
|
+
const resolved = normalizeConfig$l(config, factoryArgs);
|
|
35540
34944
|
return new NoopAdmissionClient(resolved);
|
|
35541
34945
|
}
|
|
35542
34946
|
}
|
|
35543
|
-
function normalizeConfig$
|
|
34947
|
+
function normalizeConfig$l(config, factoryArgs) {
|
|
35544
34948
|
const fromArgs = factoryArgs[0] && typeof factoryArgs[0] === 'object'
|
|
35545
34949
|
? factoryArgs[0]
|
|
35546
34950
|
: {};
|
|
@@ -35573,7 +34977,7 @@ function normalizeConfig$k(config, factoryArgs) {
|
|
|
35573
34977
|
|
|
35574
34978
|
var noopAdmissionClientFactory = /*#__PURE__*/Object.freeze({
|
|
35575
34979
|
__proto__: null,
|
|
35576
|
-
FACTORY_META: FACTORY_META$
|
|
34980
|
+
FACTORY_META: FACTORY_META$M,
|
|
35577
34981
|
NoopAdmissionClientFactory: NoopAdmissionClientFactory,
|
|
35578
34982
|
default: NoopAdmissionClientFactory
|
|
35579
34983
|
});
|
|
@@ -35588,7 +34992,7 @@ class NoAuthInjectionStrategy {
|
|
|
35588
34992
|
}
|
|
35589
34993
|
}
|
|
35590
34994
|
|
|
35591
|
-
const FACTORY_META$
|
|
34995
|
+
const FACTORY_META$L = {
|
|
35592
34996
|
base: AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE,
|
|
35593
34997
|
key: 'NoAuth',
|
|
35594
34998
|
};
|
|
@@ -35598,11 +35002,11 @@ class NoAuthInjectionStrategyFactory extends AuthInjectionStrategyFactory {
|
|
|
35598
35002
|
this.type = 'NoAuth';
|
|
35599
35003
|
}
|
|
35600
35004
|
async create(config) {
|
|
35601
|
-
const preparedConfig = normalizeConfig$
|
|
35005
|
+
const preparedConfig = normalizeConfig$k(config);
|
|
35602
35006
|
return new NoAuthInjectionStrategy(preparedConfig);
|
|
35603
35007
|
}
|
|
35604
35008
|
}
|
|
35605
|
-
function normalizeConfig$
|
|
35009
|
+
function normalizeConfig$k(config) {
|
|
35606
35010
|
const defaultConfig = { type: 'NoAuth' };
|
|
35607
35011
|
if (!config) {
|
|
35608
35012
|
return defaultConfig;
|
|
@@ -35617,12 +35021,12 @@ function normalizeConfig$j(config) {
|
|
|
35617
35021
|
|
|
35618
35022
|
var noAuthInjectionStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
35619
35023
|
__proto__: null,
|
|
35620
|
-
FACTORY_META: FACTORY_META$
|
|
35024
|
+
FACTORY_META: FACTORY_META$L,
|
|
35621
35025
|
NoAuthInjectionStrategyFactory: NoAuthInjectionStrategyFactory,
|
|
35622
35026
|
default: NoAuthInjectionStrategyFactory
|
|
35623
35027
|
});
|
|
35624
35028
|
|
|
35625
|
-
const logger$
|
|
35029
|
+
const logger$e = getLogger('naylence.fame.node.admission.welcome_service_client');
|
|
35626
35030
|
class WelcomeServiceClient {
|
|
35627
35031
|
constructor(options) {
|
|
35628
35032
|
this.hasUpstream = options.hasUpstream ?? options.has_upstream ?? false;
|
|
@@ -35671,7 +35075,7 @@ class WelcomeServiceClient {
|
|
|
35671
35075
|
'Content-Type': 'application/json',
|
|
35672
35076
|
...authHeaders,
|
|
35673
35077
|
};
|
|
35674
|
-
logger$
|
|
35078
|
+
logger$e.debug('welcome_service_hello_request', {
|
|
35675
35079
|
url: this.url,
|
|
35676
35080
|
systemId,
|
|
35677
35081
|
instanceId,
|
|
@@ -35707,7 +35111,7 @@ class WelcomeServiceClient {
|
|
|
35707
35111
|
parsedEnvelope.frame.type !== 'NodeWelcome') {
|
|
35708
35112
|
throw new Error(`Unexpected frame type '${parsedEnvelope.frame?.type ?? 'unknown'}'`);
|
|
35709
35113
|
}
|
|
35710
|
-
logger$
|
|
35114
|
+
logger$e.debug('welcome_service_hello_success', {
|
|
35711
35115
|
systemId: parsedEnvelope.frame.systemId,
|
|
35712
35116
|
targetSystemId: parsedEnvelope.frame.targetSystemId,
|
|
35713
35117
|
assignedPath: parsedEnvelope.frame.assignedPath,
|
|
@@ -35766,7 +35170,7 @@ function convertKeysToCamelCase(value) {
|
|
|
35766
35170
|
return result;
|
|
35767
35171
|
}
|
|
35768
35172
|
|
|
35769
|
-
const FACTORY_META$
|
|
35173
|
+
const FACTORY_META$K = {
|
|
35770
35174
|
base: ADMISSION_CLIENT_FACTORY_BASE_TYPE,
|
|
35771
35175
|
key: 'WelcomeServiceClient',
|
|
35772
35176
|
};
|
|
@@ -35779,7 +35183,7 @@ class WelcomeServiceClientFactory extends AdmissionClientFactory {
|
|
|
35779
35183
|
if (!config) {
|
|
35780
35184
|
throw new Error('WelcomeServiceClient configuration is required');
|
|
35781
35185
|
}
|
|
35782
|
-
const normalized = normalizeConfig$
|
|
35186
|
+
const normalized = normalizeConfig$j(config);
|
|
35783
35187
|
const clientOptions = {
|
|
35784
35188
|
hasUpstream: !normalized.isRoot,
|
|
35785
35189
|
url: normalized.url,
|
|
@@ -35794,7 +35198,7 @@ class WelcomeServiceClientFactory extends AdmissionClientFactory {
|
|
|
35794
35198
|
return new WelcomeServiceClient(clientOptions);
|
|
35795
35199
|
}
|
|
35796
35200
|
}
|
|
35797
|
-
function normalizeConfig$
|
|
35201
|
+
function normalizeConfig$j(config) {
|
|
35798
35202
|
const source = config;
|
|
35799
35203
|
const urlCandidate = typeof source.url === 'string' ? source.url.trim() : '';
|
|
35800
35204
|
if (!urlCandidate) {
|
|
@@ -35836,7 +35240,7 @@ async function createAuthStrategy(config) {
|
|
|
35836
35240
|
|
|
35837
35241
|
var welcomeServiceClientFactory = /*#__PURE__*/Object.freeze({
|
|
35838
35242
|
__proto__: null,
|
|
35839
|
-
FACTORY_META: FACTORY_META$
|
|
35243
|
+
FACTORY_META: FACTORY_META$K,
|
|
35840
35244
|
WelcomeServiceClientFactory: WelcomeServiceClientFactory,
|
|
35841
35245
|
default: WelcomeServiceClientFactory
|
|
35842
35246
|
});
|
|
@@ -35912,7 +35316,7 @@ const staticNodePlacementConfigSchema = zod.z
|
|
|
35912
35316
|
.min(1, { message: 'targetPhysicalPath cannot be empty' }),
|
|
35913
35317
|
})
|
|
35914
35318
|
.passthrough();
|
|
35915
|
-
function normalizeConfig$
|
|
35319
|
+
function normalizeConfig$i(config) {
|
|
35916
35320
|
const candidate = {
|
|
35917
35321
|
...config,
|
|
35918
35322
|
};
|
|
@@ -35947,14 +35351,14 @@ class StaticNodePlacementStrategyFactory extends NodePlacementStrategyFactory {
|
|
|
35947
35351
|
if (!config) {
|
|
35948
35352
|
throw new Error('StaticNodePlacementStrategy requires configuration');
|
|
35949
35353
|
}
|
|
35950
|
-
const normalized = normalizeConfig$
|
|
35354
|
+
const normalized = normalizeConfig$i(config);
|
|
35951
35355
|
return new StaticNodePlacementStrategy({
|
|
35952
35356
|
targetSystemId: normalized.targetSystemId,
|
|
35953
35357
|
targetPhysicalPath: normalized.targetPhysicalPath,
|
|
35954
35358
|
});
|
|
35955
35359
|
}
|
|
35956
35360
|
}
|
|
35957
|
-
const FACTORY_META$
|
|
35361
|
+
const FACTORY_META$J = {
|
|
35958
35362
|
base: NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE,
|
|
35959
35363
|
key: 'StaticNodePlacementStrategy',
|
|
35960
35364
|
};
|
|
@@ -35964,7 +35368,7 @@ registerNodePlacementStrategyFactory('StaticNodePlacementStrategy', StaticNodePl
|
|
|
35964
35368
|
|
|
35965
35369
|
var staticNodePlacementStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
35966
35370
|
__proto__: null,
|
|
35967
|
-
FACTORY_META: FACTORY_META$
|
|
35371
|
+
FACTORY_META: FACTORY_META$J,
|
|
35968
35372
|
StaticNodePlacementStrategyFactory: StaticNodePlacementStrategyFactory,
|
|
35969
35373
|
default: StaticNodePlacementStrategyFactory
|
|
35970
35374
|
});
|
|
@@ -36123,7 +35527,7 @@ function connectorTypeName(connector) {
|
|
|
36123
35527
|
return typeof connector;
|
|
36124
35528
|
}
|
|
36125
35529
|
|
|
36126
|
-
const FACTORY_META$
|
|
35530
|
+
const FACTORY_META$I = {
|
|
36127
35531
|
base: AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE,
|
|
36128
35532
|
key: 'BearerTokenHeaderAuth',
|
|
36129
35533
|
};
|
|
@@ -36133,11 +35537,11 @@ class BearerTokenHeaderAuthInjectionStrategyFactory extends AuthInjectionStrateg
|
|
|
36133
35537
|
this.type = 'BearerTokenHeaderAuth';
|
|
36134
35538
|
}
|
|
36135
35539
|
async create(config) {
|
|
36136
|
-
const normalized = normalizeConfig$
|
|
35540
|
+
const normalized = normalizeConfig$h(config);
|
|
36137
35541
|
return new BearerTokenHeaderAuthInjectionStrategy(normalized);
|
|
36138
35542
|
}
|
|
36139
35543
|
}
|
|
36140
|
-
function normalizeConfig$
|
|
35544
|
+
function normalizeConfig$h(config) {
|
|
36141
35545
|
if (!config) {
|
|
36142
35546
|
throw new Error('BearerTokenHeaderAuthInjectionStrategy requires configuration');
|
|
36143
35547
|
}
|
|
@@ -36164,7 +35568,7 @@ function normalizeConfig$g(config) {
|
|
|
36164
35568
|
var bearerTokenHeaderAuthInjectionStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
36165
35569
|
__proto__: null,
|
|
36166
35570
|
BearerTokenHeaderAuthInjectionStrategyFactory: BearerTokenHeaderAuthInjectionStrategyFactory,
|
|
36167
|
-
FACTORY_META: FACTORY_META$
|
|
35571
|
+
FACTORY_META: FACTORY_META$I,
|
|
36168
35572
|
default: BearerTokenHeaderAuthInjectionStrategyFactory
|
|
36169
35573
|
});
|
|
36170
35574
|
|
|
@@ -36175,7 +35579,7 @@ async function getDefaultAuthorizerModule() {
|
|
|
36175
35579
|
}
|
|
36176
35580
|
return defaultAuthorizerModulePromise;
|
|
36177
35581
|
}
|
|
36178
|
-
function normalizeConfig$
|
|
35582
|
+
function normalizeConfig$g(config) {
|
|
36179
35583
|
if (!config) {
|
|
36180
35584
|
return {};
|
|
36181
35585
|
}
|
|
@@ -36191,7 +35595,7 @@ function normalizeConfig$f(config) {
|
|
|
36191
35595
|
function isTokenVerifier(candidate) {
|
|
36192
35596
|
return Boolean(candidate && typeof candidate.verify === 'function');
|
|
36193
35597
|
}
|
|
36194
|
-
const FACTORY_META$
|
|
35598
|
+
const FACTORY_META$H = {
|
|
36195
35599
|
base: AUTHORIZER_FACTORY_BASE_TYPE,
|
|
36196
35600
|
key: 'DefaultAuthorizer',
|
|
36197
35601
|
};
|
|
@@ -36203,7 +35607,7 @@ class DefaultAuthorizerFactory extends AuthorizerFactory {
|
|
|
36203
35607
|
}
|
|
36204
35608
|
async create(config, ...factoryArgs) {
|
|
36205
35609
|
let tokenVerifier = factoryArgs.find(isTokenVerifier);
|
|
36206
|
-
const normalized = normalizeConfig$
|
|
35610
|
+
const normalized = normalizeConfig$g(config);
|
|
36207
35611
|
if (!tokenVerifier) {
|
|
36208
35612
|
if (!normalized.verifier) {
|
|
36209
35613
|
throw new Error('DefaultAuthorizer requires a verifier configuration or instance');
|
|
@@ -36221,7 +35625,7 @@ class DefaultAuthorizerFactory extends AuthorizerFactory {
|
|
|
36221
35625
|
var defaultAuthorizerFactory = /*#__PURE__*/Object.freeze({
|
|
36222
35626
|
__proto__: null,
|
|
36223
35627
|
DefaultAuthorizerFactory: DefaultAuthorizerFactory,
|
|
36224
|
-
FACTORY_META: FACTORY_META$
|
|
35628
|
+
FACTORY_META: FACTORY_META$H,
|
|
36225
35629
|
default: DefaultAuthorizerFactory
|
|
36226
35630
|
});
|
|
36227
35631
|
|
|
@@ -36232,7 +35636,7 @@ function getJwksJwtTokenVerifierModule() {
|
|
|
36232
35636
|
}
|
|
36233
35637
|
return jwksJwtTokenVerifierModulePromise;
|
|
36234
35638
|
}
|
|
36235
|
-
const FACTORY_META$
|
|
35639
|
+
const FACTORY_META$G = {
|
|
36236
35640
|
base: TOKEN_VERIFIER_FACTORY_BASE_TYPE,
|
|
36237
35641
|
key: 'JWKSJWTTokenVerifier',
|
|
36238
35642
|
};
|
|
@@ -36245,7 +35649,7 @@ class JWKSTokenVerifierFactory extends TokenVerifierFactory {
|
|
|
36245
35649
|
if (!config) {
|
|
36246
35650
|
throw new Error('JWKSJWTTokenVerifier requires configuration');
|
|
36247
35651
|
}
|
|
36248
|
-
const normalized = normalizeConfig$
|
|
35652
|
+
const normalized = normalizeConfig$f(config);
|
|
36249
35653
|
const cacheTtlCandidate = validateCacheTtlSec(normalized.cacheTtlSec);
|
|
36250
35654
|
const cacheTtlSec = typeof cacheTtlCandidate === 'number'
|
|
36251
35655
|
? cacheTtlCandidate
|
|
@@ -36259,7 +35663,7 @@ class JWKSTokenVerifierFactory extends TokenVerifierFactory {
|
|
|
36259
35663
|
});
|
|
36260
35664
|
}
|
|
36261
35665
|
}
|
|
36262
|
-
function normalizeConfig$
|
|
35666
|
+
function normalizeConfig$f(config) {
|
|
36263
35667
|
const source = config;
|
|
36264
35668
|
const issuer = typeof source.issuer === 'string' && source.issuer.trim().length > 0
|
|
36265
35669
|
? source.issuer
|
|
@@ -36294,12 +35698,12 @@ function normalizeConfig$e(config) {
|
|
|
36294
35698
|
|
|
36295
35699
|
var jwksJwtTokenVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
36296
35700
|
__proto__: null,
|
|
36297
|
-
FACTORY_META: FACTORY_META$
|
|
35701
|
+
FACTORY_META: FACTORY_META$G,
|
|
36298
35702
|
JWKSTokenVerifierFactory: JWKSTokenVerifierFactory,
|
|
36299
35703
|
default: JWKSTokenVerifierFactory
|
|
36300
35704
|
});
|
|
36301
35705
|
|
|
36302
|
-
const FACTORY_META$
|
|
35706
|
+
const FACTORY_META$F = {
|
|
36303
35707
|
base: TOKEN_ISSUER_FACTORY_BASE_TYPE,
|
|
36304
35708
|
key: 'JWTTokenIssuer',
|
|
36305
35709
|
};
|
|
@@ -36313,7 +35717,7 @@ class JWTTokenIssuerFactory extends TokenIssuerFactory {
|
|
|
36313
35717
|
if (!config) {
|
|
36314
35718
|
throw new Error('JWTTokenIssuerFactory requires configuration');
|
|
36315
35719
|
}
|
|
36316
|
-
const normalized = normalizeConfig$
|
|
35720
|
+
const normalized = normalizeConfig$e(config);
|
|
36317
35721
|
// Extract crypto provider from factory args
|
|
36318
35722
|
let cryptoProvider1 = null;
|
|
36319
35723
|
for (const arg of factoryArgs) {
|
|
@@ -36370,7 +35774,7 @@ function getJwtTokenIssuerModule() {
|
|
|
36370
35774
|
}
|
|
36371
35775
|
return jwtTokenIssuerModulePromise;
|
|
36372
35776
|
}
|
|
36373
|
-
function normalizeConfig$
|
|
35777
|
+
function normalizeConfig$e(config) {
|
|
36374
35778
|
const source = config;
|
|
36375
35779
|
const issuer = typeof source.issuer === 'string' && source.issuer.trim() !== ''
|
|
36376
35780
|
? source.issuer
|
|
@@ -36496,12 +35900,12 @@ function getProviderKeyId(provider) {
|
|
|
36496
35900
|
|
|
36497
35901
|
var jwtTokenIssuerFactory = /*#__PURE__*/Object.freeze({
|
|
36498
35902
|
__proto__: null,
|
|
36499
|
-
FACTORY_META: FACTORY_META$
|
|
35903
|
+
FACTORY_META: FACTORY_META$F,
|
|
36500
35904
|
JWTTokenIssuerFactory: JWTTokenIssuerFactory,
|
|
36501
35905
|
default: JWTTokenIssuerFactory
|
|
36502
35906
|
});
|
|
36503
35907
|
|
|
36504
|
-
const FACTORY_META$
|
|
35908
|
+
const FACTORY_META$E = {
|
|
36505
35909
|
base: TOKEN_VERIFIER_FACTORY_BASE_TYPE,
|
|
36506
35910
|
key: 'JWTTokenVerifier',
|
|
36507
35911
|
};
|
|
@@ -36515,7 +35919,7 @@ class JWTTokenVerifierFactory extends TokenVerifierFactory {
|
|
|
36515
35919
|
if (!config) {
|
|
36516
35920
|
throw new Error('JWTTokenVerifierFactory requires configuration');
|
|
36517
35921
|
}
|
|
36518
|
-
const normalized = normalizeConfig$
|
|
35922
|
+
const normalized = normalizeConfig$d(config);
|
|
36519
35923
|
const cryptoProvider1 = cryptoProvider ?? null;
|
|
36520
35924
|
let verificationKey;
|
|
36521
35925
|
if (normalized.hmacSecret !== undefined) {
|
|
@@ -36552,7 +35956,7 @@ function getJwtTokenVerifierModule() {
|
|
|
36552
35956
|
}
|
|
36553
35957
|
return jwtTokenVerifierModulePromise;
|
|
36554
35958
|
}
|
|
36555
|
-
function normalizeConfig$
|
|
35959
|
+
function normalizeConfig$d(config) {
|
|
36556
35960
|
const source = config;
|
|
36557
35961
|
const issuer = typeof source.issuer === 'string' && source.issuer.trim() !== ''
|
|
36558
35962
|
? source.issuer
|
|
@@ -36669,7 +36073,7 @@ function getProviderVerificationKey(provider) {
|
|
|
36669
36073
|
|
|
36670
36074
|
var jwtTokenVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
36671
36075
|
__proto__: null,
|
|
36672
|
-
FACTORY_META: FACTORY_META$
|
|
36076
|
+
FACTORY_META: FACTORY_META$E,
|
|
36673
36077
|
JWTTokenVerifierFactory: JWTTokenVerifierFactory,
|
|
36674
36078
|
default: JWTTokenVerifierFactory
|
|
36675
36079
|
});
|
|
@@ -36685,7 +36089,7 @@ class NoneTokenProvider {
|
|
|
36685
36089
|
}
|
|
36686
36090
|
}
|
|
36687
36091
|
|
|
36688
|
-
const FACTORY_META$
|
|
36092
|
+
const FACTORY_META$D = {
|
|
36689
36093
|
base: TOKEN_PROVIDER_FACTORY_BASE_TYPE,
|
|
36690
36094
|
key: 'NoneTokenProvider',
|
|
36691
36095
|
};
|
|
@@ -36702,7 +36106,7 @@ class NoneTokenProviderFactory extends TokenProviderFactory {
|
|
|
36702
36106
|
|
|
36703
36107
|
var noneTokenProviderFactory = /*#__PURE__*/Object.freeze({
|
|
36704
36108
|
__proto__: null,
|
|
36705
|
-
FACTORY_META: FACTORY_META$
|
|
36109
|
+
FACTORY_META: FACTORY_META$D,
|
|
36706
36110
|
NoneTokenProviderFactory: NoneTokenProviderFactory,
|
|
36707
36111
|
default: NoneTokenProviderFactory
|
|
36708
36112
|
});
|
|
@@ -36754,7 +36158,7 @@ class NoopAuthorizer {
|
|
|
36754
36158
|
}
|
|
36755
36159
|
}
|
|
36756
36160
|
|
|
36757
|
-
const FACTORY_META$
|
|
36161
|
+
const FACTORY_META$C = {
|
|
36758
36162
|
base: AUTHORIZER_FACTORY_BASE_TYPE,
|
|
36759
36163
|
key: 'NoopAuthorizer',
|
|
36760
36164
|
};
|
|
@@ -36770,7 +36174,7 @@ class NoopAuthorizerFactory extends AuthorizerFactory {
|
|
|
36770
36174
|
|
|
36771
36175
|
var noopAuthorizerFactory = /*#__PURE__*/Object.freeze({
|
|
36772
36176
|
__proto__: null,
|
|
36773
|
-
FACTORY_META: FACTORY_META$
|
|
36177
|
+
FACTORY_META: FACTORY_META$C,
|
|
36774
36178
|
NoopAuthorizerFactory: NoopAuthorizerFactory,
|
|
36775
36179
|
default: NoopAuthorizerFactory
|
|
36776
36180
|
});
|
|
@@ -36784,7 +36188,7 @@ class NoopTokenIssuer {
|
|
|
36784
36188
|
}
|
|
36785
36189
|
}
|
|
36786
36190
|
|
|
36787
|
-
const FACTORY_META$
|
|
36191
|
+
const FACTORY_META$B = {
|
|
36788
36192
|
base: TOKEN_ISSUER_FACTORY_BASE_TYPE,
|
|
36789
36193
|
key: 'NoopTokenIssuer',
|
|
36790
36194
|
};
|
|
@@ -36800,7 +36204,7 @@ class NoopTokenIssuerFactory extends TokenIssuerFactory {
|
|
|
36800
36204
|
|
|
36801
36205
|
var noopTokenIssuerFactory = /*#__PURE__*/Object.freeze({
|
|
36802
36206
|
__proto__: null,
|
|
36803
|
-
FACTORY_META: FACTORY_META$
|
|
36207
|
+
FACTORY_META: FACTORY_META$B,
|
|
36804
36208
|
NoopTokenIssuerFactory: NoopTokenIssuerFactory,
|
|
36805
36209
|
default: NoopTokenIssuerFactory
|
|
36806
36210
|
});
|
|
@@ -36822,7 +36226,7 @@ class NoopTokenVerifier {
|
|
|
36822
36226
|
}
|
|
36823
36227
|
}
|
|
36824
36228
|
|
|
36825
|
-
const FACTORY_META$
|
|
36229
|
+
const FACTORY_META$A = {
|
|
36826
36230
|
base: TOKEN_VERIFIER_FACTORY_BASE_TYPE,
|
|
36827
36231
|
key: 'NoopTokenVerifier',
|
|
36828
36232
|
};
|
|
@@ -36838,12 +36242,12 @@ class NoopTokenVerifierFactory extends TokenVerifierFactory {
|
|
|
36838
36242
|
|
|
36839
36243
|
var noopTokenVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
36840
36244
|
__proto__: null,
|
|
36841
|
-
FACTORY_META: FACTORY_META$
|
|
36245
|
+
FACTORY_META: FACTORY_META$A,
|
|
36842
36246
|
NoopTokenVerifierFactory: NoopTokenVerifierFactory,
|
|
36843
36247
|
default: NoopTokenVerifierFactory
|
|
36844
36248
|
});
|
|
36845
36249
|
|
|
36846
|
-
const logger$
|
|
36250
|
+
const logger$d = getLogger('naylence.fame.security.auth.oauth2_authorizer_factory');
|
|
36847
36251
|
let oauth2AuthorizerModulePromise = null;
|
|
36848
36252
|
function getOAuth2AuthorizerModule() {
|
|
36849
36253
|
if (!oauth2AuthorizerModulePromise) {
|
|
@@ -36851,7 +36255,7 @@ function getOAuth2AuthorizerModule() {
|
|
|
36851
36255
|
}
|
|
36852
36256
|
return oauth2AuthorizerModulePromise;
|
|
36853
36257
|
}
|
|
36854
|
-
const FACTORY_META$
|
|
36258
|
+
const FACTORY_META$z = {
|
|
36855
36259
|
base: AUTHORIZER_FACTORY_BASE_TYPE,
|
|
36856
36260
|
key: 'OAuth2Authorizer',
|
|
36857
36261
|
};
|
|
@@ -36864,18 +36268,18 @@ class OAuth2AuthorizerFactory extends AuthorizerFactory {
|
|
|
36864
36268
|
if (!config) {
|
|
36865
36269
|
throw new Error('OAuth2Authorizer requires configuration');
|
|
36866
36270
|
}
|
|
36867
|
-
const normalized = normalizeConfig$
|
|
36271
|
+
const normalized = normalizeConfig$c(config);
|
|
36868
36272
|
const tokenVerifier = await TokenVerifierFactory.createTokenVerifier(normalized.tokenVerifierConfig);
|
|
36869
36273
|
let tokenIssuer;
|
|
36870
36274
|
if (normalized.tokenIssuerConfig) {
|
|
36871
36275
|
try {
|
|
36872
36276
|
tokenIssuer = await TokenIssuerFactory.createTokenIssuer(normalized.tokenIssuerConfig);
|
|
36873
|
-
logger$
|
|
36277
|
+
logger$d.debug('token_issuer_created_for_reverse_auth', {
|
|
36874
36278
|
issuer_type: normalized.tokenIssuerConfig.type,
|
|
36875
36279
|
});
|
|
36876
36280
|
}
|
|
36877
36281
|
catch (error) {
|
|
36878
|
-
logger$
|
|
36282
|
+
logger$d.warning('failed_to_create_token_issuer_for_reverse_auth', {
|
|
36879
36283
|
error: error instanceof Error ? error.message : String(error),
|
|
36880
36284
|
issuer_config: normalized.tokenIssuerConfig,
|
|
36881
36285
|
});
|
|
@@ -36899,7 +36303,7 @@ class OAuth2AuthorizerFactory extends AuthorizerFactory {
|
|
|
36899
36303
|
return new OAuth2Authorizer(authorizerOptions);
|
|
36900
36304
|
}
|
|
36901
36305
|
}
|
|
36902
|
-
function normalizeConfig$
|
|
36306
|
+
function normalizeConfig$c(config) {
|
|
36903
36307
|
const source = config;
|
|
36904
36308
|
const issuer = typeof source.issuer === 'string' && source.issuer.trim().length > 0
|
|
36905
36309
|
? source.issuer.trim()
|
|
@@ -36996,7 +36400,7 @@ function normalizeTokenVerifierConfig({ config, issuer, jwksUrl, algorithm, }) {
|
|
|
36996
36400
|
|
|
36997
36401
|
var oauth2AuthorizerFactory = /*#__PURE__*/Object.freeze({
|
|
36998
36402
|
__proto__: null,
|
|
36999
|
-
FACTORY_META: FACTORY_META$
|
|
36403
|
+
FACTORY_META: FACTORY_META$z,
|
|
37000
36404
|
OAuth2AuthorizerFactory: OAuth2AuthorizerFactory,
|
|
37001
36405
|
default: OAuth2AuthorizerFactory
|
|
37002
36406
|
});
|
|
@@ -37008,7 +36412,7 @@ async function getOAuth2ClientCredentialsTokenProviderModule() {
|
|
|
37008
36412
|
}
|
|
37009
36413
|
return oauth2ClientCredentialsTokenProviderModulePromise;
|
|
37010
36414
|
}
|
|
37011
|
-
function normalizeConfig$
|
|
36415
|
+
function normalizeConfig$b(config) {
|
|
37012
36416
|
if (!config) {
|
|
37013
36417
|
throw new Error('OAuth2ClientCredentialsTokenProvider requires configuration');
|
|
37014
36418
|
}
|
|
@@ -37036,7 +36440,7 @@ function normalizeConfig$a(config) {
|
|
|
37036
36440
|
}
|
|
37037
36441
|
return normalized;
|
|
37038
36442
|
}
|
|
37039
|
-
const FACTORY_META$
|
|
36443
|
+
const FACTORY_META$y = {
|
|
37040
36444
|
base: TOKEN_PROVIDER_FACTORY_BASE_TYPE,
|
|
37041
36445
|
key: 'OAuth2ClientCredentialsTokenProvider',
|
|
37042
36446
|
};
|
|
@@ -37046,7 +36450,7 @@ class OAuth2ClientCredentialsTokenProviderFactory extends TokenProviderFactory {
|
|
|
37046
36450
|
this.type = 'OAuth2ClientCredentialsTokenProvider';
|
|
37047
36451
|
}
|
|
37048
36452
|
async create(config) {
|
|
37049
|
-
const normalized = normalizeConfig$
|
|
36453
|
+
const normalized = normalizeConfig$b(config);
|
|
37050
36454
|
const [clientIdProvider, clientSecretProvider] = await Promise.all([
|
|
37051
36455
|
CredentialProviderFactory.createCredentialProvider(normalized.clientIdConfig),
|
|
37052
36456
|
CredentialProviderFactory.createCredentialProvider(normalized.clientSecretConfig),
|
|
@@ -37067,7 +36471,7 @@ class OAuth2ClientCredentialsTokenProviderFactory extends TokenProviderFactory {
|
|
|
37067
36471
|
|
|
37068
36472
|
var oauth2ClientCredentialsTokenProviderFactory = /*#__PURE__*/Object.freeze({
|
|
37069
36473
|
__proto__: null,
|
|
37070
|
-
FACTORY_META: FACTORY_META$
|
|
36474
|
+
FACTORY_META: FACTORY_META$y,
|
|
37071
36475
|
OAuth2ClientCredentialsTokenProviderFactory: OAuth2ClientCredentialsTokenProviderFactory,
|
|
37072
36476
|
default: OAuth2ClientCredentialsTokenProviderFactory
|
|
37073
36477
|
});
|
|
@@ -37100,7 +36504,7 @@ function normalizeScopes$1(value) {
|
|
|
37100
36504
|
}
|
|
37101
36505
|
return [];
|
|
37102
36506
|
}
|
|
37103
|
-
function normalizeConfig$
|
|
36507
|
+
function normalizeConfig$a(config) {
|
|
37104
36508
|
if (!config) {
|
|
37105
36509
|
throw new Error('OAuth2PkceTokenProvider requires configuration');
|
|
37106
36510
|
}
|
|
@@ -37149,7 +36553,7 @@ function normalizeConfig$9(config) {
|
|
|
37149
36553
|
}
|
|
37150
36554
|
return normalized;
|
|
37151
36555
|
}
|
|
37152
|
-
const FACTORY_META$
|
|
36556
|
+
const FACTORY_META$x = {
|
|
37153
36557
|
base: TOKEN_PROVIDER_FACTORY_BASE_TYPE,
|
|
37154
36558
|
key: 'OAuth2PkceTokenProvider',
|
|
37155
36559
|
};
|
|
@@ -37159,7 +36563,7 @@ class OAuth2PkceTokenProviderFactory extends TokenProviderFactory {
|
|
|
37159
36563
|
this.type = 'OAuth2PkceTokenProvider';
|
|
37160
36564
|
}
|
|
37161
36565
|
async create(config) {
|
|
37162
|
-
const normalized = normalizeConfig$
|
|
36566
|
+
const normalized = normalizeConfig$a(config);
|
|
37163
36567
|
const [usernameProvider, clientSecretProvider] = await Promise.all([
|
|
37164
36568
|
normalized.usernameConfig
|
|
37165
36569
|
? CredentialProviderFactory.createCredentialProvider(normalized.usernameConfig)
|
|
@@ -37204,7 +36608,7 @@ class OAuth2PkceTokenProviderFactory extends TokenProviderFactory {
|
|
|
37204
36608
|
|
|
37205
36609
|
var oauth2PkceTokenProviderFactory = /*#__PURE__*/Object.freeze({
|
|
37206
36610
|
__proto__: null,
|
|
37207
|
-
FACTORY_META: FACTORY_META$
|
|
36611
|
+
FACTORY_META: FACTORY_META$x,
|
|
37208
36612
|
OAuth2PkceTokenProviderFactory: OAuth2PkceTokenProviderFactory,
|
|
37209
36613
|
default: OAuth2PkceTokenProviderFactory
|
|
37210
36614
|
});
|
|
@@ -37254,7 +36658,7 @@ class QueryParamAuthInjectionStrategy {
|
|
|
37254
36658
|
}
|
|
37255
36659
|
}
|
|
37256
36660
|
|
|
37257
|
-
const FACTORY_META$
|
|
36661
|
+
const FACTORY_META$w = {
|
|
37258
36662
|
base: AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE,
|
|
37259
36663
|
key: 'QueryParamAuth',
|
|
37260
36664
|
};
|
|
@@ -37264,11 +36668,11 @@ class QueryParamAuthInjectionStrategyFactory extends AuthInjectionStrategyFactor
|
|
|
37264
36668
|
this.type = 'QueryParamAuth';
|
|
37265
36669
|
}
|
|
37266
36670
|
async create(config) {
|
|
37267
|
-
const normalized = normalizeConfig$
|
|
36671
|
+
const normalized = normalizeConfig$9(config);
|
|
37268
36672
|
return new QueryParamAuthInjectionStrategy(normalized);
|
|
37269
36673
|
}
|
|
37270
36674
|
}
|
|
37271
|
-
function normalizeConfig$
|
|
36675
|
+
function normalizeConfig$9(config) {
|
|
37272
36676
|
if (!config) {
|
|
37273
36677
|
throw new Error('QueryParamAuthInjectionStrategy requires configuration');
|
|
37274
36678
|
}
|
|
@@ -37294,7 +36698,7 @@ function normalizeConfig$8(config) {
|
|
|
37294
36698
|
|
|
37295
36699
|
var queryParamAuthInjectionStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
37296
36700
|
__proto__: null,
|
|
37297
|
-
FACTORY_META: FACTORY_META$
|
|
36701
|
+
FACTORY_META: FACTORY_META$w,
|
|
37298
36702
|
QueryParamAuthInjectionStrategyFactory: QueryParamAuthInjectionStrategyFactory,
|
|
37299
36703
|
default: QueryParamAuthInjectionStrategyFactory
|
|
37300
36704
|
});
|
|
@@ -37306,7 +36710,7 @@ async function getSharedSecretAuthorizerModule() {
|
|
|
37306
36710
|
}
|
|
37307
36711
|
return sharedSecretAuthorizerModulePromise;
|
|
37308
36712
|
}
|
|
37309
|
-
function normalizeConfig$
|
|
36713
|
+
function normalizeConfig$8(config) {
|
|
37310
36714
|
if (!config) {
|
|
37311
36715
|
throw new Error('SharedSecretAuthorizer requires configuration');
|
|
37312
36716
|
}
|
|
@@ -37330,7 +36734,7 @@ function normalizeConfig$7(config) {
|
|
|
37330
36734
|
secretConfig: normalizeSecretSource(secretSource),
|
|
37331
36735
|
};
|
|
37332
36736
|
}
|
|
37333
|
-
const FACTORY_META$
|
|
36737
|
+
const FACTORY_META$v = {
|
|
37334
36738
|
base: AUTHORIZER_FACTORY_BASE_TYPE,
|
|
37335
36739
|
key: 'SharedSecretAuthorizer',
|
|
37336
36740
|
};
|
|
@@ -37340,7 +36744,7 @@ class SharedSecretAuthorizerFactory extends AuthorizerFactory {
|
|
|
37340
36744
|
this.type = 'SharedSecretAuthorizer';
|
|
37341
36745
|
}
|
|
37342
36746
|
async create(config) {
|
|
37343
|
-
const normalized = normalizeConfig$
|
|
36747
|
+
const normalized = normalizeConfig$8(config);
|
|
37344
36748
|
const credentialProvider = await CredentialProviderFactory.createCredentialProvider(normalized.secretConfig);
|
|
37345
36749
|
const { SharedSecretAuthorizer } = await getSharedSecretAuthorizerModule();
|
|
37346
36750
|
return new SharedSecretAuthorizer(credentialProvider);
|
|
@@ -37349,7 +36753,7 @@ class SharedSecretAuthorizerFactory extends AuthorizerFactory {
|
|
|
37349
36753
|
|
|
37350
36754
|
var sharedSecretAuthorizerFactory = /*#__PURE__*/Object.freeze({
|
|
37351
36755
|
__proto__: null,
|
|
37352
|
-
FACTORY_META: FACTORY_META$
|
|
36756
|
+
FACTORY_META: FACTORY_META$v,
|
|
37353
36757
|
SharedSecretAuthorizerFactory: SharedSecretAuthorizerFactory,
|
|
37354
36758
|
default: SharedSecretAuthorizerFactory
|
|
37355
36759
|
});
|
|
@@ -37361,7 +36765,7 @@ async function getSharedSecretTokenProviderModule() {
|
|
|
37361
36765
|
}
|
|
37362
36766
|
return sharedSecretTokenProviderModulePromise;
|
|
37363
36767
|
}
|
|
37364
|
-
function normalizeConfig$
|
|
36768
|
+
function normalizeConfig$7(config) {
|
|
37365
36769
|
if (!config) {
|
|
37366
36770
|
throw new Error('SharedSecretTokenProvider requires configuration');
|
|
37367
36771
|
}
|
|
@@ -37385,7 +36789,7 @@ function normalizeConfig$6(config) {
|
|
|
37385
36789
|
secretConfig: normalizeSecretSource(secretSource),
|
|
37386
36790
|
};
|
|
37387
36791
|
}
|
|
37388
|
-
const FACTORY_META$
|
|
36792
|
+
const FACTORY_META$u = {
|
|
37389
36793
|
base: TOKEN_PROVIDER_FACTORY_BASE_TYPE,
|
|
37390
36794
|
key: 'SharedSecretTokenProvider',
|
|
37391
36795
|
};
|
|
@@ -37395,7 +36799,7 @@ class SharedSecretTokenProviderFactory extends TokenProviderFactory {
|
|
|
37395
36799
|
this.type = 'SharedSecretTokenProvider';
|
|
37396
36800
|
}
|
|
37397
36801
|
async create(config) {
|
|
37398
|
-
const normalized = normalizeConfig$
|
|
36802
|
+
const normalized = normalizeConfig$7(config);
|
|
37399
36803
|
const credentialProvider = await CredentialProviderFactory.createCredentialProvider(normalized.secretConfig);
|
|
37400
36804
|
const { SharedSecretTokenProvider } = await getSharedSecretTokenProviderModule();
|
|
37401
36805
|
return new SharedSecretTokenProvider(credentialProvider);
|
|
@@ -37404,7 +36808,7 @@ class SharedSecretTokenProviderFactory extends TokenProviderFactory {
|
|
|
37404
36808
|
|
|
37405
36809
|
var sharedSecretTokenProviderFactory = /*#__PURE__*/Object.freeze({
|
|
37406
36810
|
__proto__: null,
|
|
37407
|
-
FACTORY_META: FACTORY_META$
|
|
36811
|
+
FACTORY_META: FACTORY_META$u,
|
|
37408
36812
|
SharedSecretTokenProviderFactory: SharedSecretTokenProviderFactory,
|
|
37409
36813
|
default: SharedSecretTokenProviderFactory
|
|
37410
36814
|
});
|
|
@@ -37416,7 +36820,7 @@ async function getSharedSecretTokenVerifierModule() {
|
|
|
37416
36820
|
}
|
|
37417
36821
|
return sharedSecretTokenVerifierModulePromise;
|
|
37418
36822
|
}
|
|
37419
|
-
function normalizeConfig$
|
|
36823
|
+
function normalizeConfig$6(config) {
|
|
37420
36824
|
const candidate = (config ?? {});
|
|
37421
36825
|
const record = candidate;
|
|
37422
36826
|
let secretSource = candidate.secret;
|
|
@@ -37448,7 +36852,7 @@ function normalizeConfig$5(config) {
|
|
|
37448
36852
|
}
|
|
37449
36853
|
return normalized;
|
|
37450
36854
|
}
|
|
37451
|
-
const FACTORY_META$
|
|
36855
|
+
const FACTORY_META$t = {
|
|
37452
36856
|
base: TOKEN_VERIFIER_FACTORY_BASE_TYPE,
|
|
37453
36857
|
key: 'SharedSecretTokenVerifier',
|
|
37454
36858
|
};
|
|
@@ -37458,7 +36862,7 @@ class SharedSecretTokenVerifierFactory extends TokenVerifierFactory {
|
|
|
37458
36862
|
this.type = 'SharedSecretTokenVerifier';
|
|
37459
36863
|
}
|
|
37460
36864
|
async create(config) {
|
|
37461
|
-
const normalized = normalizeConfig$
|
|
36865
|
+
const normalized = normalizeConfig$6(config);
|
|
37462
36866
|
const credentialProvider = (await CredentialProviderFactory.createCredentialProvider(normalized.secretConfig));
|
|
37463
36867
|
const options = {
|
|
37464
36868
|
credentialProvider,
|
|
@@ -37473,7 +36877,7 @@ class SharedSecretTokenVerifierFactory extends TokenVerifierFactory {
|
|
|
37473
36877
|
|
|
37474
36878
|
var sharedSecretTokenVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
37475
36879
|
__proto__: null,
|
|
37476
|
-
FACTORY_META: FACTORY_META$
|
|
36880
|
+
FACTORY_META: FACTORY_META$t,
|
|
37477
36881
|
SharedSecretTokenVerifierFactory: SharedSecretTokenVerifierFactory,
|
|
37478
36882
|
default: SharedSecretTokenVerifierFactory
|
|
37479
36883
|
});
|
|
@@ -37563,7 +36967,7 @@ function normalizeOptions$8(input) {
|
|
|
37563
36967
|
};
|
|
37564
36968
|
}
|
|
37565
36969
|
|
|
37566
|
-
function normalizeConfig$
|
|
36970
|
+
function normalizeConfig$5(config) {
|
|
37567
36971
|
if (!config) {
|
|
37568
36972
|
throw new Error('StaticTokenProvider requires configuration');
|
|
37569
36973
|
}
|
|
@@ -37588,7 +36992,7 @@ function normalizeConfig$4(config) {
|
|
|
37588
36992
|
}
|
|
37589
36993
|
return options;
|
|
37590
36994
|
}
|
|
37591
|
-
const FACTORY_META$
|
|
36995
|
+
const FACTORY_META$s = {
|
|
37592
36996
|
base: TOKEN_PROVIDER_FACTORY_BASE_TYPE,
|
|
37593
36997
|
key: 'StaticTokenProvider',
|
|
37594
36998
|
};
|
|
@@ -37598,14 +37002,14 @@ class StaticTokenProviderFactory extends TokenProviderFactory {
|
|
|
37598
37002
|
this.type = 'StaticTokenProvider';
|
|
37599
37003
|
}
|
|
37600
37004
|
async create(config) {
|
|
37601
|
-
const options = normalizeConfig$
|
|
37005
|
+
const options = normalizeConfig$5(config);
|
|
37602
37006
|
return new StaticTokenProvider(options);
|
|
37603
37007
|
}
|
|
37604
37008
|
}
|
|
37605
37009
|
|
|
37606
37010
|
var staticTokenProviderFactory = /*#__PURE__*/Object.freeze({
|
|
37607
37011
|
__proto__: null,
|
|
37608
|
-
FACTORY_META: FACTORY_META$
|
|
37012
|
+
FACTORY_META: FACTORY_META$s,
|
|
37609
37013
|
StaticTokenProviderFactory: StaticTokenProviderFactory,
|
|
37610
37014
|
default: StaticTokenProviderFactory
|
|
37611
37015
|
});
|
|
@@ -37656,7 +37060,7 @@ class WebSocketSubprotocolAuthInjectionStrategy {
|
|
|
37656
37060
|
}
|
|
37657
37061
|
}
|
|
37658
37062
|
|
|
37659
|
-
const FACTORY_META$
|
|
37063
|
+
const FACTORY_META$r = {
|
|
37660
37064
|
base: AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE,
|
|
37661
37065
|
key: 'WebSocketSubprotocolAuth',
|
|
37662
37066
|
};
|
|
@@ -37666,11 +37070,11 @@ class WebSocketSubprotocolAuthInjectionStrategyFactory extends AuthInjectionStra
|
|
|
37666
37070
|
this.type = 'WebSocketSubprotocolAuth';
|
|
37667
37071
|
}
|
|
37668
37072
|
async create(config) {
|
|
37669
|
-
const normalized = normalizeConfig$
|
|
37073
|
+
const normalized = normalizeConfig$4(config);
|
|
37670
37074
|
return new WebSocketSubprotocolAuthInjectionStrategy(normalized);
|
|
37671
37075
|
}
|
|
37672
37076
|
}
|
|
37673
|
-
function normalizeConfig$
|
|
37077
|
+
function normalizeConfig$4(config) {
|
|
37674
37078
|
if (!config) {
|
|
37675
37079
|
throw new Error('WebSocketSubprotocolAuthInjectionStrategy requires configuration');
|
|
37676
37080
|
}
|
|
@@ -37698,7 +37102,7 @@ function normalizeConfig$3(config) {
|
|
|
37698
37102
|
|
|
37699
37103
|
var websocketSubprotocolAuthInjectionStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
37700
37104
|
__proto__: null,
|
|
37701
|
-
FACTORY_META: FACTORY_META$
|
|
37105
|
+
FACTORY_META: FACTORY_META$r,
|
|
37702
37106
|
WebSocketSubprotocolAuthInjectionStrategyFactory: WebSocketSubprotocolAuthInjectionStrategyFactory,
|
|
37703
37107
|
default: WebSocketSubprotocolAuthInjectionStrategyFactory
|
|
37704
37108
|
});
|
|
@@ -37746,7 +37150,7 @@ class DevFixedKeyCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
37746
37150
|
throw new Error('DevFixedKeyCredentialProvider requires keyHex or keyBase64');
|
|
37747
37151
|
}
|
|
37748
37152
|
}
|
|
37749
|
-
const FACTORY_META$
|
|
37153
|
+
const FACTORY_META$q = {
|
|
37750
37154
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
37751
37155
|
key: 'DevFixedKeyCredentialProvider',
|
|
37752
37156
|
};
|
|
@@ -37754,7 +37158,7 @@ const FACTORY_META$n = {
|
|
|
37754
37158
|
var devFixedKeyCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
37755
37159
|
__proto__: null,
|
|
37756
37160
|
DevFixedKeyCredentialProviderFactory: DevFixedKeyCredentialProviderFactory,
|
|
37757
|
-
FACTORY_META: FACTORY_META$
|
|
37161
|
+
FACTORY_META: FACTORY_META$q,
|
|
37758
37162
|
default: DevFixedKeyCredentialProviderFactory,
|
|
37759
37163
|
normalizeDevFixedConfig: normalizeDevFixedConfig
|
|
37760
37164
|
});
|
|
@@ -37770,14 +37174,14 @@ class NoneCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
37770
37174
|
return new NoneCredentialProvider();
|
|
37771
37175
|
}
|
|
37772
37176
|
}
|
|
37773
|
-
const FACTORY_META$
|
|
37177
|
+
const FACTORY_META$p = {
|
|
37774
37178
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
37775
37179
|
key: 'NoneCredentialProvider',
|
|
37776
37180
|
};
|
|
37777
37181
|
|
|
37778
37182
|
var noneCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
37779
37183
|
__proto__: null,
|
|
37780
|
-
FACTORY_META: FACTORY_META$
|
|
37184
|
+
FACTORY_META: FACTORY_META$p,
|
|
37781
37185
|
NoneCredentialProviderFactory: NoneCredentialProviderFactory,
|
|
37782
37186
|
default: NoneCredentialProviderFactory
|
|
37783
37187
|
});
|
|
@@ -37815,20 +37219,20 @@ class SessionKeyCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
37815
37219
|
return new SessionKeyCredentialProvider(resolved.length);
|
|
37816
37220
|
}
|
|
37817
37221
|
}
|
|
37818
|
-
const FACTORY_META$
|
|
37222
|
+
const FACTORY_META$o = {
|
|
37819
37223
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
37820
37224
|
key: 'SessionKeyCredentialProvider',
|
|
37821
37225
|
};
|
|
37822
37226
|
|
|
37823
37227
|
var sessionKeyCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
37824
37228
|
__proto__: null,
|
|
37825
|
-
FACTORY_META: FACTORY_META$
|
|
37229
|
+
FACTORY_META: FACTORY_META$o,
|
|
37826
37230
|
SessionKeyCredentialProviderFactory: SessionKeyCredentialProviderFactory,
|
|
37827
37231
|
default: SessionKeyCredentialProviderFactory,
|
|
37828
37232
|
normalizeSessionKeyConfig: normalizeSessionKeyConfig
|
|
37829
37233
|
});
|
|
37830
37234
|
|
|
37831
|
-
const logger$
|
|
37235
|
+
const logger$c = getLogger('naylence.fame.security.default_security_manager_factory');
|
|
37832
37236
|
function normalizeDefaultSecurityManagerConfig(config) {
|
|
37833
37237
|
if (!config) {
|
|
37834
37238
|
return null;
|
|
@@ -37863,7 +37267,7 @@ function normalizeDefaultSecurityManagerConfig(config) {
|
|
|
37863
37267
|
ensureAlias('trustStoreProvider', 'trust_store_provider');
|
|
37864
37268
|
return normalized;
|
|
37865
37269
|
}
|
|
37866
|
-
const FACTORY_META$
|
|
37270
|
+
const FACTORY_META$n = {
|
|
37867
37271
|
base: SECURITY_MANAGER_FACTORY_BASE_TYPE,
|
|
37868
37272
|
key: 'DefaultSecurityManager',
|
|
37869
37273
|
};
|
|
@@ -37996,7 +37400,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
37996
37400
|
return await KeyStoreFactory.createKeyStore(value, createOptions ?? undefined);
|
|
37997
37401
|
}
|
|
37998
37402
|
catch (error) {
|
|
37999
|
-
logger$
|
|
37403
|
+
logger$c.error('failed_to_create_key_store_from_config', {
|
|
38000
37404
|
error: error instanceof Error ? error.message : String(error),
|
|
38001
37405
|
});
|
|
38002
37406
|
return null;
|
|
@@ -38032,7 +37436,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38032
37436
|
return null;
|
|
38033
37437
|
}
|
|
38034
37438
|
const cryptoProvider = cryptoProviderOverride ?? null;
|
|
38035
|
-
logger$
|
|
37439
|
+
logger$c.debug('auto_create_envelope_signer', {
|
|
38036
37440
|
has_crypto_override: Boolean(cryptoProviderOverride),
|
|
38037
37441
|
override_constructor: cryptoProviderOverride
|
|
38038
37442
|
? (cryptoProviderOverride.constructor?.name ?? 'unknown')
|
|
@@ -38053,7 +37457,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38053
37457
|
});
|
|
38054
37458
|
}
|
|
38055
37459
|
catch (error) {
|
|
38056
|
-
logger$
|
|
37460
|
+
logger$c.error('failed_to_auto_create_envelope_signer', {
|
|
38057
37461
|
error: error instanceof Error ? error.message : String(error),
|
|
38058
37462
|
exc_info: true,
|
|
38059
37463
|
});
|
|
@@ -38088,7 +37492,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38088
37492
|
});
|
|
38089
37493
|
}
|
|
38090
37494
|
catch (error) {
|
|
38091
|
-
logger$
|
|
37495
|
+
logger$c.error('failed_to_auto_create_envelope_verifier', {
|
|
38092
37496
|
error: error instanceof Error ? error.message : String(error),
|
|
38093
37497
|
exc_info: true,
|
|
38094
37498
|
});
|
|
@@ -38100,7 +37504,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38100
37504
|
if (encryptionConfig &&
|
|
38101
37505
|
DefaultSecurityManagerFactory.isConfigLike(encryptionConfig)) {
|
|
38102
37506
|
if (!keyManager) {
|
|
38103
|
-
logger$
|
|
37507
|
+
logger$c.warning('encryption_manager_config_requires_key_manager');
|
|
38104
37508
|
return { encryptionManager: null, secureChannelManager };
|
|
38105
37509
|
}
|
|
38106
37510
|
const manager = await EncryptionManagerFactory.createEncryptionManager(encryptionConfig, {
|
|
@@ -38137,7 +37541,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38137
37541
|
return { encryptionManager: manager, secureChannelManager };
|
|
38138
37542
|
}
|
|
38139
37543
|
catch (error) {
|
|
38140
|
-
logger$
|
|
37544
|
+
logger$c.error('failed_to_auto_create_encryption_manager', {
|
|
38141
37545
|
error: error instanceof Error ? error.message : String(error),
|
|
38142
37546
|
exc_info: true,
|
|
38143
37547
|
});
|
|
@@ -38180,7 +37584,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38180
37584
|
});
|
|
38181
37585
|
}
|
|
38182
37586
|
catch (error) {
|
|
38183
|
-
logger$
|
|
37587
|
+
logger$c.error('failed_to_auto_create_key_manager', {
|
|
38184
37588
|
error: error instanceof Error ? error.message : String(error),
|
|
38185
37589
|
exc_info: true,
|
|
38186
37590
|
});
|
|
@@ -38229,7 +37633,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38229
37633
|
})) ?? null);
|
|
38230
37634
|
}
|
|
38231
37635
|
catch (error) {
|
|
38232
|
-
logger$
|
|
37636
|
+
logger$c.error('failed_to_auto_create_authorizer', {
|
|
38233
37637
|
error: error instanceof Error ? error.message : String(error),
|
|
38234
37638
|
exc_info: true,
|
|
38235
37639
|
});
|
|
@@ -38258,7 +37662,7 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38258
37662
|
});
|
|
38259
37663
|
}
|
|
38260
37664
|
catch (error) {
|
|
38261
|
-
logger$
|
|
37665
|
+
logger$c.error('failed_to_auto_create_certificate_manager', {
|
|
38262
37666
|
error: error instanceof Error ? error.message : String(error),
|
|
38263
37667
|
exc_info: true,
|
|
38264
37668
|
});
|
|
@@ -38329,11 +37733,11 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
|
|
|
38329
37733
|
var defaultSecurityManagerFactory = /*#__PURE__*/Object.freeze({
|
|
38330
37734
|
__proto__: null,
|
|
38331
37735
|
DefaultSecurityManagerFactory: DefaultSecurityManagerFactory,
|
|
38332
|
-
FACTORY_META: FACTORY_META$
|
|
37736
|
+
FACTORY_META: FACTORY_META$n,
|
|
38333
37737
|
default: DefaultSecurityManagerFactory
|
|
38334
37738
|
});
|
|
38335
37739
|
|
|
38336
|
-
const FACTORY_META$
|
|
37740
|
+
const FACTORY_META$m = {
|
|
38337
37741
|
base: ENCRYPTION_MANAGER_FACTORY_BASE_TYPE,
|
|
38338
37742
|
key: 'NoopEncryptionManager',
|
|
38339
37743
|
};
|
|
@@ -38390,7 +37794,7 @@ class NoopEncryptionManagerFactory extends EncryptionManagerFactory {
|
|
|
38390
37794
|
|
|
38391
37795
|
var noopEncryptionManagerFactory = /*#__PURE__*/Object.freeze({
|
|
38392
37796
|
__proto__: null,
|
|
38393
|
-
FACTORY_META: FACTORY_META$
|
|
37797
|
+
FACTORY_META: FACTORY_META$m,
|
|
38394
37798
|
NoopEncryptionManagerFactory: NoopEncryptionManagerFactory,
|
|
38395
37799
|
default: NoopEncryptionManagerFactory
|
|
38396
37800
|
});
|
|
@@ -38462,7 +37866,7 @@ class NoopSecureChannelManager {
|
|
|
38462
37866
|
}
|
|
38463
37867
|
}
|
|
38464
37868
|
|
|
38465
|
-
const FACTORY_META$
|
|
37869
|
+
const FACTORY_META$l = {
|
|
38466
37870
|
base: SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE,
|
|
38467
37871
|
key: 'NoopSecureChannelManager',
|
|
38468
37872
|
};
|
|
@@ -38479,12 +37883,12 @@ class NoopSecureChannelManagerFactory extends SecureChannelManagerFactory {
|
|
|
38479
37883
|
|
|
38480
37884
|
var noopSecureChannelManagerFactory = /*#__PURE__*/Object.freeze({
|
|
38481
37885
|
__proto__: null,
|
|
38482
|
-
FACTORY_META: FACTORY_META$
|
|
37886
|
+
FACTORY_META: FACTORY_META$l,
|
|
38483
37887
|
NoopSecureChannelManagerFactory: NoopSecureChannelManagerFactory,
|
|
38484
37888
|
default: NoopSecureChannelManagerFactory
|
|
38485
37889
|
});
|
|
38486
37890
|
|
|
38487
|
-
const FACTORY_META$
|
|
37891
|
+
const FACTORY_META$k = {
|
|
38488
37892
|
base: KEY_MANAGER_FACTORY_BASE_TYPE,
|
|
38489
37893
|
key: 'DefaultKeyManager',
|
|
38490
37894
|
};
|
|
@@ -38513,11 +37917,11 @@ class DefaultKeyManagerFactory extends KeyManagerFactory {
|
|
|
38513
37917
|
var defaultKeyManagerFactory = /*#__PURE__*/Object.freeze({
|
|
38514
37918
|
__proto__: null,
|
|
38515
37919
|
DefaultKeyManagerFactory: DefaultKeyManagerFactory,
|
|
38516
|
-
FACTORY_META: FACTORY_META$
|
|
37920
|
+
FACTORY_META: FACTORY_META$k,
|
|
38517
37921
|
default: DefaultKeyManagerFactory
|
|
38518
37922
|
});
|
|
38519
37923
|
|
|
38520
|
-
const logger$
|
|
37924
|
+
const logger$b = getLogger('naylence.fame.security.keys.in_memory_key_store');
|
|
38521
37925
|
class InMemoryKeyStore extends KeyStore {
|
|
38522
37926
|
constructor(initialKeys = null) {
|
|
38523
37927
|
super();
|
|
@@ -38539,7 +37943,7 @@ class InMemoryKeyStore extends KeyStore {
|
|
|
38539
37943
|
}
|
|
38540
37944
|
catch (error) {
|
|
38541
37945
|
if (error instanceof JWKValidationError) {
|
|
38542
|
-
logger$
|
|
37946
|
+
logger$b.warning('rejected_invalid_jwk_individual', {
|
|
38543
37947
|
kid,
|
|
38544
37948
|
error: error.message,
|
|
38545
37949
|
});
|
|
@@ -38583,7 +37987,7 @@ class InMemoryKeyStore extends KeyStore {
|
|
|
38583
37987
|
}
|
|
38584
37988
|
}
|
|
38585
37989
|
if (staleKeys.length > 0) {
|
|
38586
|
-
logger$
|
|
37990
|
+
logger$b.debug('removing_stale_keys_before_adding_new_key', {
|
|
38587
37991
|
new_kid: kid,
|
|
38588
37992
|
physical_path: physicalPath,
|
|
38589
37993
|
base_path: basePath,
|
|
@@ -38611,7 +38015,7 @@ class InMemoryKeyStore extends KeyStore {
|
|
|
38611
38015
|
}
|
|
38612
38016
|
keysByPath[path].push(existingKid);
|
|
38613
38017
|
}
|
|
38614
|
-
logger$
|
|
38018
|
+
logger$b.debug('key_lookup_failed', {
|
|
38615
38019
|
missing_kid: kid,
|
|
38616
38020
|
available_kids: Array.from(this.keys.keys()),
|
|
38617
38021
|
keys_by_path: keysByPath,
|
|
@@ -38660,7 +38064,7 @@ class InMemoryKeyStore extends KeyStore {
|
|
|
38660
38064
|
this.keys.delete(kid);
|
|
38661
38065
|
}
|
|
38662
38066
|
if (keysToRemove.length > 0) {
|
|
38663
|
-
logger$
|
|
38067
|
+
logger$b.debug('removed_keys_for_path', {
|
|
38664
38068
|
physical_path: physicalPath,
|
|
38665
38069
|
removed_key_ids: keysToRemove,
|
|
38666
38070
|
count: keysToRemove.length,
|
|
@@ -38671,7 +38075,7 @@ class InMemoryKeyStore extends KeyStore {
|
|
|
38671
38075
|
async removeKey(kid) {
|
|
38672
38076
|
const removed = this.keys.delete(kid);
|
|
38673
38077
|
if (removed) {
|
|
38674
|
-
logger$
|
|
38078
|
+
logger$b.debug('removed_individual_key', { kid });
|
|
38675
38079
|
}
|
|
38676
38080
|
return removed;
|
|
38677
38081
|
}
|
|
@@ -38698,7 +38102,7 @@ class InMemoryKeyStore extends KeyStore {
|
|
|
38698
38102
|
}
|
|
38699
38103
|
registerDefaultKeyStoreFactory(() => new InMemoryKeyStore());
|
|
38700
38104
|
|
|
38701
|
-
const FACTORY_META$
|
|
38105
|
+
const FACTORY_META$j = {
|
|
38702
38106
|
base: KEY_STORE_FACTORY_BASE_TYPE,
|
|
38703
38107
|
key: 'InMemoryKeyStore',
|
|
38704
38108
|
};
|
|
@@ -38733,12 +38137,12 @@ class InMemoryKeyStoreFactory extends KeyStoreFactory {
|
|
|
38733
38137
|
|
|
38734
38138
|
var inMemoryKeyStoreFactory = /*#__PURE__*/Object.freeze({
|
|
38735
38139
|
__proto__: null,
|
|
38736
|
-
FACTORY_META: FACTORY_META$
|
|
38140
|
+
FACTORY_META: FACTORY_META$j,
|
|
38737
38141
|
InMemoryKeyStoreFactory: InMemoryKeyStoreFactory,
|
|
38738
38142
|
default: InMemoryKeyStoreFactory
|
|
38739
38143
|
});
|
|
38740
38144
|
|
|
38741
|
-
const FACTORY_META$
|
|
38145
|
+
const FACTORY_META$i = {
|
|
38742
38146
|
base: ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE,
|
|
38743
38147
|
key: 'NoopKeyValidator',
|
|
38744
38148
|
};
|
|
@@ -38756,12 +38160,12 @@ class NoopKeyValidatorFactory extends AttachmentKeyValidatorFactory {
|
|
|
38756
38160
|
|
|
38757
38161
|
var noopKeyValidatorFactory = /*#__PURE__*/Object.freeze({
|
|
38758
38162
|
__proto__: null,
|
|
38759
|
-
FACTORY_META: FACTORY_META$
|
|
38163
|
+
FACTORY_META: FACTORY_META$i,
|
|
38760
38164
|
NoopKeyValidatorFactory: NoopKeyValidatorFactory,
|
|
38761
38165
|
default: NoopKeyValidatorFactory
|
|
38762
38166
|
});
|
|
38763
38167
|
|
|
38764
|
-
const FACTORY_META$
|
|
38168
|
+
const FACTORY_META$h = {
|
|
38765
38169
|
base: SECURITY_POLICY_FACTORY_BASE_TYPE,
|
|
38766
38170
|
key: 'DefaultSecurityPolicy',
|
|
38767
38171
|
};
|
|
@@ -38779,7 +38183,7 @@ class DefaultSecurityPolicyFactory extends SecurityPolicyFactory {
|
|
|
38779
38183
|
* - factoryArgs[0]: KeyProvider | null (optional) - Key provider for key lookups
|
|
38780
38184
|
*/
|
|
38781
38185
|
async create(config, ...factoryArgs) {
|
|
38782
|
-
const prepared = normalizeConfig$
|
|
38186
|
+
const prepared = normalizeConfig$3(config);
|
|
38783
38187
|
const options = {};
|
|
38784
38188
|
// Extract keyProvider from factoryArgs[0] (matches Python's key_provider kwarg)
|
|
38785
38189
|
const keyProvider = factoryArgs[0];
|
|
@@ -38796,7 +38200,7 @@ class DefaultSecurityPolicyFactory extends SecurityPolicyFactory {
|
|
|
38796
38200
|
return new DefaultSecurityPolicy(options);
|
|
38797
38201
|
}
|
|
38798
38202
|
}
|
|
38799
|
-
function normalizeConfig$
|
|
38203
|
+
function normalizeConfig$3(config) {
|
|
38800
38204
|
if (!config) {
|
|
38801
38205
|
return { type: 'DefaultSecurityPolicy' };
|
|
38802
38206
|
}
|
|
@@ -38822,11 +38226,11 @@ function normalizeConfig$2(config) {
|
|
|
38822
38226
|
var defaultSecurityPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
38823
38227
|
__proto__: null,
|
|
38824
38228
|
DefaultSecurityPolicyFactory: DefaultSecurityPolicyFactory,
|
|
38825
|
-
FACTORY_META: FACTORY_META$
|
|
38229
|
+
FACTORY_META: FACTORY_META$h,
|
|
38826
38230
|
default: DefaultSecurityPolicyFactory
|
|
38827
38231
|
});
|
|
38828
38232
|
|
|
38829
|
-
const FACTORY_META$
|
|
38233
|
+
const FACTORY_META$g = {
|
|
38830
38234
|
base: SECURITY_POLICY_FACTORY_BASE_TYPE,
|
|
38831
38235
|
key: 'NoSecurityPolicy',
|
|
38832
38236
|
};
|
|
@@ -38836,11 +38240,11 @@ class NoSecurityPolicyFactory extends SecurityPolicyFactory {
|
|
|
38836
38240
|
this.type = 'NoSecurityPolicy';
|
|
38837
38241
|
}
|
|
38838
38242
|
async create(config) {
|
|
38839
|
-
void normalizeConfig$
|
|
38243
|
+
void normalizeConfig$2(config);
|
|
38840
38244
|
return new NoSecurityPolicy();
|
|
38841
38245
|
}
|
|
38842
38246
|
}
|
|
38843
|
-
function normalizeConfig$
|
|
38247
|
+
function normalizeConfig$2(config) {
|
|
38844
38248
|
if (!config) {
|
|
38845
38249
|
return { type: 'NoSecurityPolicy' };
|
|
38846
38250
|
}
|
|
@@ -38854,7 +38258,7 @@ function normalizeConfig$1(config) {
|
|
|
38854
38258
|
|
|
38855
38259
|
var noSecurityPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
38856
38260
|
__proto__: null,
|
|
38857
|
-
FACTORY_META: FACTORY_META$
|
|
38261
|
+
FACTORY_META: FACTORY_META$g,
|
|
38858
38262
|
NoSecurityPolicyFactory: NoSecurityPolicyFactory,
|
|
38859
38263
|
default: NoSecurityPolicyFactory
|
|
38860
38264
|
});
|
|
@@ -38869,7 +38273,7 @@ async function getEdDSAEnvelopeSignerModule() {
|
|
|
38869
38273
|
}
|
|
38870
38274
|
return eddsaEnvelopeSignerModulePromise;
|
|
38871
38275
|
}
|
|
38872
|
-
const FACTORY_META$
|
|
38276
|
+
const FACTORY_META$f = {
|
|
38873
38277
|
base: ENVELOPE_SIGNER_FACTORY_BASE_TYPE,
|
|
38874
38278
|
key: 'EdDSAEnvelopeSigner',
|
|
38875
38279
|
};
|
|
@@ -38898,7 +38302,7 @@ class EdDSAEnvelopeSignerFactory extends EnvelopeSignerFactory {
|
|
|
38898
38302
|
var eddsaEnvelopeSignerFactory = /*#__PURE__*/Object.freeze({
|
|
38899
38303
|
__proto__: null,
|
|
38900
38304
|
EdDSAEnvelopeSignerFactory: EdDSAEnvelopeSignerFactory,
|
|
38901
|
-
FACTORY_META: FACTORY_META$
|
|
38305
|
+
FACTORY_META: FACTORY_META$f,
|
|
38902
38306
|
default: EdDSAEnvelopeSignerFactory
|
|
38903
38307
|
});
|
|
38904
38308
|
|
|
@@ -38912,7 +38316,7 @@ async function getEdDSAEnvelopeVerifierModule() {
|
|
|
38912
38316
|
}
|
|
38913
38317
|
return eddsaEnvelopeVerifierModulePromise;
|
|
38914
38318
|
}
|
|
38915
|
-
const FACTORY_META$
|
|
38319
|
+
const FACTORY_META$e = {
|
|
38916
38320
|
base: ENVELOPE_VERIFIER_FACTORY_BASE_TYPE,
|
|
38917
38321
|
key: 'EdDSAEnvelopeVerifier',
|
|
38918
38322
|
};
|
|
@@ -38938,11 +38342,11 @@ class EdDSAEnvelopeVerifierFactory extends EnvelopeVerifierFactory {
|
|
|
38938
38342
|
var eddsaEnvelopeVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
38939
38343
|
__proto__: null,
|
|
38940
38344
|
EdDSAEnvelopeVerifierFactory: EdDSAEnvelopeVerifierFactory,
|
|
38941
|
-
FACTORY_META: FACTORY_META$
|
|
38345
|
+
FACTORY_META: FACTORY_META$e,
|
|
38942
38346
|
default: EdDSAEnvelopeVerifierFactory
|
|
38943
38347
|
});
|
|
38944
38348
|
|
|
38945
|
-
const FACTORY_META$
|
|
38349
|
+
const FACTORY_META$d = {
|
|
38946
38350
|
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
38947
38351
|
key: "NoopTrustStoreProvider",
|
|
38948
38352
|
isDefault: true,
|
|
@@ -38962,12 +38366,12 @@ class NoopTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
|
38962
38366
|
|
|
38963
38367
|
var noopTrustStoreProviderFactory = /*#__PURE__*/Object.freeze({
|
|
38964
38368
|
__proto__: null,
|
|
38965
|
-
FACTORY_META: FACTORY_META$
|
|
38369
|
+
FACTORY_META: FACTORY_META$d,
|
|
38966
38370
|
NoopTrustStoreProviderFactory: NoopTrustStoreProviderFactory,
|
|
38967
38371
|
default: NoopTrustStoreProviderFactory
|
|
38968
38372
|
});
|
|
38969
38373
|
|
|
38970
|
-
const FACTORY_META$
|
|
38374
|
+
const FACTORY_META$c = {
|
|
38971
38375
|
base: ROUTING_POLICY_FACTORY_BASE,
|
|
38972
38376
|
key: 'CapabilityAwareRoutingPolicy',
|
|
38973
38377
|
};
|
|
@@ -39033,12 +38437,12 @@ class CapabilityAwareRoutingPolicyFactory extends RoutingPolicyFactory {
|
|
|
39033
38437
|
var capabilityAwareRoutingPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
39034
38438
|
__proto__: null,
|
|
39035
38439
|
CapabilityAwareRoutingPolicyFactory: CapabilityAwareRoutingPolicyFactory,
|
|
39036
|
-
FACTORY_META: FACTORY_META$
|
|
38440
|
+
FACTORY_META: FACTORY_META$c,
|
|
39037
38441
|
default: CapabilityAwareRoutingPolicyFactory
|
|
39038
38442
|
});
|
|
39039
38443
|
|
|
39040
|
-
const logger$
|
|
39041
|
-
const FACTORY_META$
|
|
38444
|
+
const logger$a = getLogger('naylence.fame.sentinel.composite_routing_policy_factory');
|
|
38445
|
+
const FACTORY_META$b = {
|
|
39042
38446
|
base: ROUTING_POLICY_FACTORY_BASE,
|
|
39043
38447
|
key: 'CompositeRoutingPolicy',
|
|
39044
38448
|
};
|
|
@@ -39063,13 +38467,13 @@ class CompositeRoutingPolicyFactory extends RoutingPolicyFactory {
|
|
|
39063
38467
|
policies.push(policy);
|
|
39064
38468
|
}
|
|
39065
38469
|
else {
|
|
39066
|
-
logger$
|
|
38470
|
+
logger$a.warning('composite_policy_null_child', {
|
|
39067
38471
|
config: policyConfig,
|
|
39068
38472
|
});
|
|
39069
38473
|
}
|
|
39070
38474
|
}
|
|
39071
38475
|
catch (error) {
|
|
39072
|
-
logger$
|
|
38476
|
+
logger$a.warning('composite_policy_child_error', {
|
|
39073
38477
|
error: error instanceof Error ? error.message : String(error),
|
|
39074
38478
|
config: policyConfig,
|
|
39075
38479
|
});
|
|
@@ -39162,11 +38566,11 @@ function getFirstDefined(record, keys) {
|
|
|
39162
38566
|
var compositeRoutingPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
39163
38567
|
__proto__: null,
|
|
39164
38568
|
CompositeRoutingPolicyFactory: CompositeRoutingPolicyFactory,
|
|
39165
|
-
FACTORY_META: FACTORY_META$
|
|
38569
|
+
FACTORY_META: FACTORY_META$b,
|
|
39166
38570
|
default: CompositeRoutingPolicyFactory
|
|
39167
38571
|
});
|
|
39168
38572
|
|
|
39169
|
-
const FACTORY_META$
|
|
38573
|
+
const FACTORY_META$a = {
|
|
39170
38574
|
base: ROUTING_POLICY_FACTORY_BASE,
|
|
39171
38575
|
key: 'HybridPathRoutingPolicy',
|
|
39172
38576
|
};
|
|
@@ -39228,12 +38632,12 @@ class HybridPathRoutingPolicyFactory extends RoutingPolicyFactory {
|
|
|
39228
38632
|
|
|
39229
38633
|
var hybridPathRoutingPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
39230
38634
|
__proto__: null,
|
|
39231
|
-
FACTORY_META: FACTORY_META$
|
|
38635
|
+
FACTORY_META: FACTORY_META$a,
|
|
39232
38636
|
HybridPathRoutingPolicyFactory: HybridPathRoutingPolicyFactory,
|
|
39233
38637
|
default: HybridPathRoutingPolicyFactory
|
|
39234
38638
|
});
|
|
39235
38639
|
|
|
39236
|
-
const FACTORY_META$
|
|
38640
|
+
const FACTORY_META$9 = {
|
|
39237
38641
|
base: LOAD_BALANCING_STRATEGY_FACTORY_BASE,
|
|
39238
38642
|
key: 'CompositeLoadBalancingStrategy',
|
|
39239
38643
|
};
|
|
@@ -39292,11 +38696,11 @@ class CompositeLoadBalancingStrategyFactory extends LoadBalancingStrategyFactory
|
|
|
39292
38696
|
var compositeLoadBalancingStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
39293
38697
|
__proto__: null,
|
|
39294
38698
|
CompositeLoadBalancingStrategyFactory: CompositeLoadBalancingStrategyFactory,
|
|
39295
|
-
FACTORY_META: FACTORY_META$
|
|
38699
|
+
FACTORY_META: FACTORY_META$9,
|
|
39296
38700
|
default: CompositeLoadBalancingStrategyFactory
|
|
39297
38701
|
});
|
|
39298
38702
|
|
|
39299
|
-
const FACTORY_META$
|
|
38703
|
+
const FACTORY_META$8 = {
|
|
39300
38704
|
base: LOAD_BALANCING_STRATEGY_FACTORY_BASE,
|
|
39301
38705
|
key: 'HRWLoadBalancingStrategy',
|
|
39302
38706
|
};
|
|
@@ -39359,13 +38763,13 @@ async function createDefaultHRWStrategy(config) {
|
|
|
39359
38763
|
|
|
39360
38764
|
var hrwLoadBalancingStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
39361
38765
|
__proto__: null,
|
|
39362
|
-
FACTORY_META: FACTORY_META$
|
|
38766
|
+
FACTORY_META: FACTORY_META$8,
|
|
39363
38767
|
HRWLoadBalancingStrategyFactory: HRWLoadBalancingStrategyFactory,
|
|
39364
38768
|
createDefaultHRWStrategy: createDefaultHRWStrategy,
|
|
39365
38769
|
default: HRWLoadBalancingStrategyFactory
|
|
39366
38770
|
});
|
|
39367
38771
|
|
|
39368
|
-
const logger$
|
|
38772
|
+
const logger$9 = getLogger('naylence.fame.sentinel.load_balancing.load_balancing_profile_factory');
|
|
39369
38773
|
const PROFILE_NAME_RANDOM = 'random';
|
|
39370
38774
|
const PROFILE_NAME_ROUND_ROBIN = 'round_robin';
|
|
39371
38775
|
const PROFILE_NAME_HRW = 'hrw';
|
|
@@ -39387,7 +38791,7 @@ const STICKY_HRW_PROFILE = {
|
|
|
39387
38791
|
const DEVELOPMENT_PROFILE$1 = {
|
|
39388
38792
|
type: 'RoundRobinLoadBalancingStrategy',
|
|
39389
38793
|
};
|
|
39390
|
-
const FACTORY_META$
|
|
38794
|
+
const FACTORY_META$7 = {
|
|
39391
38795
|
base: LOAD_BALANCING_STRATEGY_FACTORY_BASE,
|
|
39392
38796
|
key: 'LoadBalancingProfile',
|
|
39393
38797
|
};
|
|
@@ -39399,7 +38803,7 @@ class LoadBalancingProfileFactory extends LoadBalancingStrategyFactory {
|
|
|
39399
38803
|
async create(config, ...factoryArgs) {
|
|
39400
38804
|
const finalConfig = this.normalizeConfig(config);
|
|
39401
38805
|
const profileName = finalConfig.profile ?? PROFILE_NAME_DEVELOPMENT$1;
|
|
39402
|
-
logger$
|
|
38806
|
+
logger$9.debug('enabling_load_balancing_profile', { profile: profileName });
|
|
39403
38807
|
const strategyConfig = this.resolveProfile(profileName);
|
|
39404
38808
|
const strategy = await factory.createResource(LOAD_BALANCING_STRATEGY_FACTORY_BASE, strategyConfig, { factoryArgs });
|
|
39405
38809
|
if (!strategy) {
|
|
@@ -39460,7 +38864,7 @@ class LoadBalancingProfileFactory extends LoadBalancingStrategyFactory {
|
|
|
39460
38864
|
|
|
39461
38865
|
var loadBalancingProfileFactory = /*#__PURE__*/Object.freeze({
|
|
39462
38866
|
__proto__: null,
|
|
39463
|
-
FACTORY_META: FACTORY_META$
|
|
38867
|
+
FACTORY_META: FACTORY_META$7,
|
|
39464
38868
|
LoadBalancingProfileFactory: LoadBalancingProfileFactory,
|
|
39465
38869
|
PROFILE_NAME_DEVELOPMENT: PROFILE_NAME_DEVELOPMENT$1,
|
|
39466
38870
|
PROFILE_NAME_HRW: PROFILE_NAME_HRW,
|
|
@@ -39487,7 +38891,7 @@ class RandomLoadBalancingStrategy {
|
|
|
39487
38891
|
}
|
|
39488
38892
|
}
|
|
39489
38893
|
|
|
39490
|
-
const FACTORY_META$
|
|
38894
|
+
const FACTORY_META$6 = {
|
|
39491
38895
|
base: LOAD_BALANCING_STRATEGY_FACTORY_BASE,
|
|
39492
38896
|
key: 'RandomLoadBalancingStrategy',
|
|
39493
38897
|
};
|
|
@@ -39503,7 +38907,7 @@ class RandomLoadBalancingStrategyFactory extends LoadBalancingStrategyFactory {
|
|
|
39503
38907
|
|
|
39504
38908
|
var randomLoadBalancingStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
39505
38909
|
__proto__: null,
|
|
39506
|
-
FACTORY_META: FACTORY_META$
|
|
38910
|
+
FACTORY_META: FACTORY_META$6,
|
|
39507
38911
|
RandomLoadBalancingStrategyFactory: RandomLoadBalancingStrategyFactory,
|
|
39508
38912
|
default: RandomLoadBalancingStrategyFactory
|
|
39509
38913
|
});
|
|
@@ -39523,7 +38927,7 @@ class RoundRobinLoadBalancingStrategy {
|
|
|
39523
38927
|
}
|
|
39524
38928
|
}
|
|
39525
38929
|
|
|
39526
|
-
const FACTORY_META$
|
|
38930
|
+
const FACTORY_META$5 = {
|
|
39527
38931
|
base: LOAD_BALANCING_STRATEGY_FACTORY_BASE,
|
|
39528
38932
|
key: 'RoundRobinLoadBalancingStrategy',
|
|
39529
38933
|
};
|
|
@@ -39539,12 +38943,12 @@ class RoundRobinLoadBalancingStrategyFactory extends LoadBalancingStrategyFactor
|
|
|
39539
38943
|
|
|
39540
38944
|
var roundRobinLoadBalancingStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
39541
38945
|
__proto__: null,
|
|
39542
|
-
FACTORY_META: FACTORY_META$
|
|
38946
|
+
FACTORY_META: FACTORY_META$5,
|
|
39543
38947
|
RoundRobinLoadBalancingStrategyFactory: RoundRobinLoadBalancingStrategyFactory,
|
|
39544
38948
|
default: RoundRobinLoadBalancingStrategyFactory
|
|
39545
38949
|
});
|
|
39546
38950
|
|
|
39547
|
-
const FACTORY_META$
|
|
38951
|
+
const FACTORY_META$4 = {
|
|
39548
38952
|
base: LOAD_BALANCING_STRATEGY_FACTORY_BASE,
|
|
39549
38953
|
key: 'StickyLoadBalancingStrategy',
|
|
39550
38954
|
};
|
|
@@ -39585,12 +38989,12 @@ class StickyLoadBalancingStrategyFactory extends LoadBalancingStrategyFactory {
|
|
|
39585
38989
|
|
|
39586
38990
|
var stickyLoadBalancingStrategyFactory = /*#__PURE__*/Object.freeze({
|
|
39587
38991
|
__proto__: null,
|
|
39588
|
-
FACTORY_META: FACTORY_META$
|
|
38992
|
+
FACTORY_META: FACTORY_META$4,
|
|
39589
38993
|
StickyLoadBalancingStrategyFactory: StickyLoadBalancingStrategyFactory,
|
|
39590
38994
|
default: StickyLoadBalancingStrategyFactory
|
|
39591
38995
|
});
|
|
39592
38996
|
|
|
39593
|
-
const logger$
|
|
38997
|
+
const logger$8 = getLogger('naylence.fame.sentinel.routing_profile_factory');
|
|
39594
38998
|
const PROFILE_NAME_DEVELOPMENT = 'development';
|
|
39595
38999
|
const PROFILE_NAME_PRODUCTION = 'production';
|
|
39596
39000
|
const PROFILE_NAME_BASIC = 'basic';
|
|
@@ -39623,14 +39027,14 @@ const HYBRID_ONLY_PROFILE = {
|
|
|
39623
39027
|
type: 'HybridPathRoutingPolicy',
|
|
39624
39028
|
loadBalancingStrategy: { type: 'HRWLoadBalancingStrategy' },
|
|
39625
39029
|
};
|
|
39626
|
-
const PROFILE_MAP = {
|
|
39030
|
+
const PROFILE_MAP$1 = {
|
|
39627
39031
|
[PROFILE_NAME_DEVELOPMENT]: DEVELOPMENT_PROFILE,
|
|
39628
39032
|
[PROFILE_NAME_PRODUCTION]: PRODUCTION_PROFILE,
|
|
39629
39033
|
[PROFILE_NAME_BASIC]: BASIC_PROFILE,
|
|
39630
39034
|
[PROFILE_NAME_CAPABILITY_AWARE]: CAPABILITY_AWARE_PROFILE,
|
|
39631
39035
|
[PROFILE_NAME_HYBRID_ONLY]: HYBRID_ONLY_PROFILE,
|
|
39632
39036
|
};
|
|
39633
|
-
const FACTORY_META = {
|
|
39037
|
+
const FACTORY_META$3 = {
|
|
39634
39038
|
base: ROUTING_POLICY_FACTORY_BASE,
|
|
39635
39039
|
key: 'RoutingProfile',
|
|
39636
39040
|
};
|
|
@@ -39641,7 +39045,7 @@ class RoutingProfileFactory extends RoutingPolicyFactory {
|
|
|
39641
39045
|
}
|
|
39642
39046
|
async create(config, ...kwargs) {
|
|
39643
39047
|
const normalized = this.normalizeConfig(config);
|
|
39644
|
-
logger$
|
|
39048
|
+
logger$8.debug('enabling_routing_profile', { profile: normalized.profile });
|
|
39645
39049
|
const routingConfig = this.getProfileConfig(normalized.profile);
|
|
39646
39050
|
const policy = await factory.createResource(ROUTING_POLICY_FACTORY_BASE, routingConfig, {
|
|
39647
39051
|
factoryArgs: kwargs,
|
|
@@ -39684,7 +39088,7 @@ class RoutingProfileFactory extends RoutingPolicyFactory {
|
|
|
39684
39088
|
return undefined;
|
|
39685
39089
|
}
|
|
39686
39090
|
getProfileConfig(profile) {
|
|
39687
|
-
const routingConfig = PROFILE_MAP[profile];
|
|
39091
|
+
const routingConfig = PROFILE_MAP$1[profile];
|
|
39688
39092
|
if (!routingConfig) {
|
|
39689
39093
|
throw new Error('Unknown routing profile');
|
|
39690
39094
|
}
|
|
@@ -39694,7 +39098,7 @@ class RoutingProfileFactory extends RoutingPolicyFactory {
|
|
|
39694
39098
|
|
|
39695
39099
|
var routingProfileFactory = /*#__PURE__*/Object.freeze({
|
|
39696
39100
|
__proto__: null,
|
|
39697
|
-
FACTORY_META: FACTORY_META,
|
|
39101
|
+
FACTORY_META: FACTORY_META$3,
|
|
39698
39102
|
PROFILE_NAME_BASIC: PROFILE_NAME_BASIC,
|
|
39699
39103
|
PROFILE_NAME_CAPABILITY_AWARE: PROFILE_NAME_CAPABILITY_AWARE,
|
|
39700
39104
|
PROFILE_NAME_DEVELOPMENT: PROFILE_NAME_DEVELOPMENT,
|
|
@@ -39704,470 +39108,495 @@ var routingProfileFactory = /*#__PURE__*/Object.freeze({
|
|
|
39704
39108
|
default: RoutingProfileFactory
|
|
39705
39109
|
});
|
|
39706
39110
|
|
|
39707
|
-
|
|
39708
|
-
|
|
39709
|
-
|
|
39710
|
-
|
|
39711
|
-
|
|
39712
|
-
|
|
39713
|
-
|
|
39714
|
-
// console.log('[naylence:runtime] already initialized, skipping');
|
|
39715
|
-
return;
|
|
39716
|
-
}
|
|
39717
|
-
initialized = true;
|
|
39718
|
-
// console.log('[naylence:runtime] registering runtime factories...');
|
|
39719
|
-
// Register factories from manifest
|
|
39720
|
-
await registerRuntimeFactories();
|
|
39721
|
-
// Import modules with side-effect registrations (not in manifest)
|
|
39722
|
-
await Promise.resolve().then(function () { return websocketTransportProvisioner; });
|
|
39723
|
-
// console.log('[naylence:runtime] runtime factories registered');
|
|
39724
|
-
},
|
|
39725
|
-
};
|
|
39726
|
-
const RUNTIME_PLUGIN_SPECIFIER = runtimePlugin.name;
|
|
39727
|
-
|
|
39728
|
-
var plugin = /*#__PURE__*/Object.freeze({
|
|
39729
|
-
__proto__: null,
|
|
39730
|
-
RUNTIME_PLUGIN_SPECIFIER: RUNTIME_PLUGIN_SPECIFIER,
|
|
39731
|
-
default: runtimePlugin
|
|
39732
|
-
});
|
|
39733
|
-
|
|
39734
|
-
let currentTraceId = null;
|
|
39735
|
-
let currentSpanId = null;
|
|
39736
|
-
function getOtelTraceId() {
|
|
39737
|
-
return currentTraceId;
|
|
39738
|
-
}
|
|
39739
|
-
function getOtelSpanId() {
|
|
39740
|
-
return currentSpanId;
|
|
39741
|
-
}
|
|
39742
|
-
function setOtelTraceId(traceId) {
|
|
39743
|
-
const previous = currentTraceId;
|
|
39744
|
-
currentTraceId = traceId;
|
|
39745
|
-
return previous;
|
|
39111
|
+
const telemetryLogger = getLogger('naylence.fame.telemetry.base_trace_emitter');
|
|
39112
|
+
function logTelemetryFailure(event, error, context = {}) {
|
|
39113
|
+
telemetryLogger.warning(event, {
|
|
39114
|
+
...context,
|
|
39115
|
+
error: error instanceof Error ? error.message : String(error),
|
|
39116
|
+
stack: error instanceof Error && error.stack ? error.stack : undefined,
|
|
39117
|
+
});
|
|
39746
39118
|
}
|
|
39747
|
-
function
|
|
39748
|
-
|
|
39749
|
-
|
|
39750
|
-
|
|
39119
|
+
function buildEnvelopeAttributes(envelope) {
|
|
39120
|
+
return {
|
|
39121
|
+
'env.id': envelope.id,
|
|
39122
|
+
'env.trace_id': envelope.traceId,
|
|
39123
|
+
'env.corr_id': envelope.corrId,
|
|
39124
|
+
'env.flow_id': envelope.flowId,
|
|
39125
|
+
'env.seq_id': envelope.seqId,
|
|
39126
|
+
'env.to': envelope.to ?? null,
|
|
39127
|
+
'env.priority': envelope.priority ?? null,
|
|
39128
|
+
'env.sid': envelope.sid ?? null,
|
|
39129
|
+
'env.reply_to': envelope.replyTo ?? null,
|
|
39130
|
+
'env.ts': envelope.ts?.toISOString?.() ?? null,
|
|
39131
|
+
'env.frame_type': envelope.frame
|
|
39132
|
+
? (envelope.frame.type ?? null)
|
|
39133
|
+
: null,
|
|
39134
|
+
'env.is_signed': Boolean(envelope.sec?.sig),
|
|
39135
|
+
'env.sign_kid': envelope.sec?.sig?.kid ?? null,
|
|
39136
|
+
'env.is_encrypted': Boolean(envelope.sec?.enc),
|
|
39137
|
+
'env.enc_kid': envelope.sec?.enc?.kid ?? null,
|
|
39138
|
+
};
|
|
39751
39139
|
}
|
|
39752
|
-
function
|
|
39753
|
-
|
|
39140
|
+
function filterAttributes(attributes) {
|
|
39141
|
+
const filtered = {};
|
|
39142
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
39143
|
+
if (value !== undefined && value !== null) {
|
|
39144
|
+
filtered[key] = value;
|
|
39145
|
+
}
|
|
39146
|
+
}
|
|
39147
|
+
return filtered;
|
|
39754
39148
|
}
|
|
39755
|
-
function
|
|
39756
|
-
|
|
39149
|
+
function extractContextValue(context, keys) {
|
|
39150
|
+
if (!context) {
|
|
39151
|
+
return undefined;
|
|
39152
|
+
}
|
|
39153
|
+
const source = context;
|
|
39154
|
+
for (const key of keys) {
|
|
39155
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
39156
|
+
const value = source[key];
|
|
39157
|
+
if (value !== undefined) {
|
|
39158
|
+
return value;
|
|
39159
|
+
}
|
|
39160
|
+
}
|
|
39161
|
+
}
|
|
39162
|
+
return undefined;
|
|
39757
39163
|
}
|
|
39758
|
-
|
|
39759
|
-
|
|
39760
|
-
|
|
39761
|
-
this.
|
|
39762
|
-
this.
|
|
39164
|
+
class BaseTraceEmitter extends BaseNodeEventListener {
|
|
39165
|
+
constructor() {
|
|
39166
|
+
super(...arguments);
|
|
39167
|
+
this.node = null;
|
|
39168
|
+
this.inflight = new Map();
|
|
39169
|
+
this.priority = 10000;
|
|
39763
39170
|
}
|
|
39764
|
-
|
|
39171
|
+
getSpanKey(envelope, operationKey) {
|
|
39172
|
+
return `${envelope.id}:${operationKey}`;
|
|
39173
|
+
}
|
|
39174
|
+
startEnvelopeOperationSpan(node, operationName, envelope, operationKey, additionalAttributes = null) {
|
|
39765
39175
|
try {
|
|
39766
|
-
this.
|
|
39176
|
+
const key = this.getSpanKey(envelope, operationKey);
|
|
39177
|
+
const previous = this.inflight.get(key);
|
|
39178
|
+
if (previous) {
|
|
39179
|
+
this.inflight.delete(key);
|
|
39180
|
+
try {
|
|
39181
|
+
previous.scope.exit();
|
|
39182
|
+
}
|
|
39183
|
+
catch (cleanupError) {
|
|
39184
|
+
logTelemetryFailure('trace_span_scope_exit_failed', cleanupError, {
|
|
39185
|
+
operation: operationName,
|
|
39186
|
+
span_key: key,
|
|
39187
|
+
});
|
|
39188
|
+
}
|
|
39189
|
+
}
|
|
39190
|
+
const attributes = buildEnvelopeAttributes(envelope);
|
|
39191
|
+
if (additionalAttributes) {
|
|
39192
|
+
for (const [attrKey, attrValue] of Object.entries(additionalAttributes)) {
|
|
39193
|
+
attributes[attrKey] = attrValue;
|
|
39194
|
+
}
|
|
39195
|
+
}
|
|
39196
|
+
const effectiveNode = node ?? this.node;
|
|
39197
|
+
if (effectiveNode) {
|
|
39198
|
+
attributes['node.id'] = effectiveNode.id;
|
|
39199
|
+
attributes['node.sid'] = effectiveNode.sid ?? null;
|
|
39200
|
+
}
|
|
39201
|
+
const scope = this.startSpan(operationName, {
|
|
39202
|
+
attributes: filterAttributes(attributes),
|
|
39203
|
+
});
|
|
39204
|
+
const span = scope.enter();
|
|
39205
|
+
this.inflight.set(key, { scope, span });
|
|
39767
39206
|
}
|
|
39768
|
-
catch {
|
|
39769
|
-
|
|
39207
|
+
catch (error) {
|
|
39208
|
+
logTelemetryFailure('trace_span_start_failed', error, {
|
|
39209
|
+
operation: operationName,
|
|
39210
|
+
envelope_id: envelope.id,
|
|
39211
|
+
});
|
|
39770
39212
|
}
|
|
39213
|
+
return envelope;
|
|
39771
39214
|
}
|
|
39772
|
-
|
|
39215
|
+
completeEnvelopeOperationSpan(node, operationName, envelope, operationKey, _result = null, error = null, additionalAttributes = null) {
|
|
39773
39216
|
try {
|
|
39774
|
-
|
|
39775
|
-
|
|
39217
|
+
const key = this.getSpanKey(envelope, operationKey);
|
|
39218
|
+
let active = this.inflight.get(key);
|
|
39219
|
+
if (!active) {
|
|
39220
|
+
const attributes = buildEnvelopeAttributes(envelope);
|
|
39221
|
+
if (additionalAttributes) {
|
|
39222
|
+
for (const [attrKey, attrValue] of Object.entries(additionalAttributes)) {
|
|
39223
|
+
attributes[attrKey] = attrValue;
|
|
39224
|
+
}
|
|
39225
|
+
}
|
|
39226
|
+
const effectiveNode = node ?? this.node;
|
|
39227
|
+
if (effectiveNode) {
|
|
39228
|
+
attributes['node.id'] = effectiveNode.id;
|
|
39229
|
+
attributes['node.sid'] = effectiveNode.sid ?? null;
|
|
39230
|
+
}
|
|
39231
|
+
const scope = this.startSpan(operationName, {
|
|
39232
|
+
attributes: filterAttributes(attributes),
|
|
39233
|
+
});
|
|
39234
|
+
const span = scope.enter();
|
|
39235
|
+
active = { scope, span };
|
|
39776
39236
|
}
|
|
39777
39237
|
else {
|
|
39778
|
-
this.
|
|
39238
|
+
this.inflight.delete(key);
|
|
39239
|
+
}
|
|
39240
|
+
if (error !== null && error !== undefined) {
|
|
39241
|
+
try {
|
|
39242
|
+
active.span.recordException(error);
|
|
39243
|
+
}
|
|
39244
|
+
catch (recordError) {
|
|
39245
|
+
logTelemetryFailure('trace_span_record_exception_failed', recordError, {
|
|
39246
|
+
operation: operationName,
|
|
39247
|
+
envelope_id: envelope.id,
|
|
39248
|
+
});
|
|
39249
|
+
}
|
|
39250
|
+
try {
|
|
39251
|
+
const description = error instanceof Error ? error.message : String(error);
|
|
39252
|
+
active.span.setStatusError(description);
|
|
39253
|
+
}
|
|
39254
|
+
catch (statusError) {
|
|
39255
|
+
logTelemetryFailure('trace_span_set_status_failed', statusError, {
|
|
39256
|
+
operation: operationName,
|
|
39257
|
+
envelope_id: envelope.id,
|
|
39258
|
+
});
|
|
39259
|
+
}
|
|
39260
|
+
}
|
|
39261
|
+
try {
|
|
39262
|
+
active.scope.exit();
|
|
39263
|
+
}
|
|
39264
|
+
catch (exitError) {
|
|
39265
|
+
logTelemetryFailure('trace_span_scope_exit_failed', exitError, {
|
|
39266
|
+
operation: operationName,
|
|
39267
|
+
envelope_id: envelope.id,
|
|
39268
|
+
});
|
|
39779
39269
|
}
|
|
39780
39270
|
}
|
|
39781
|
-
catch {
|
|
39782
|
-
|
|
39271
|
+
catch (error) {
|
|
39272
|
+
logTelemetryFailure('trace_span_complete_failed', error, {
|
|
39273
|
+
operation: operationName,
|
|
39274
|
+
envelope_id: envelope.id,
|
|
39275
|
+
});
|
|
39783
39276
|
}
|
|
39277
|
+
return envelope;
|
|
39784
39278
|
}
|
|
39785
|
-
|
|
39279
|
+
async onEnvelopeReceived(node, envelope, context) {
|
|
39786
39280
|
try {
|
|
39787
|
-
const
|
|
39788
|
-
|
|
39789
|
-
|
|
39790
|
-
|
|
39791
|
-
|
|
39281
|
+
const attributes = buildEnvelopeAttributes(envelope);
|
|
39282
|
+
attributes['node.id'] = node.id;
|
|
39283
|
+
attributes['node.sid'] = node.sid ?? null;
|
|
39284
|
+
const fromNodeId = extractContextValue(context, [
|
|
39285
|
+
'fromSystemId',
|
|
39286
|
+
'from_system_id',
|
|
39287
|
+
'fromNodeId',
|
|
39288
|
+
'from_node_id',
|
|
39289
|
+
]);
|
|
39290
|
+
if (fromNodeId !== undefined && fromNodeId !== null) {
|
|
39291
|
+
attributes['from.node_id'] = String(fromNodeId);
|
|
39792
39292
|
}
|
|
39793
|
-
|
|
39293
|
+
const originType = extractContextValue(context, [
|
|
39294
|
+
'originType',
|
|
39295
|
+
'origin_type',
|
|
39296
|
+
]);
|
|
39297
|
+
if (originType !== undefined && originType !== null) {
|
|
39298
|
+
attributes['from.origin_type'] = String(originType);
|
|
39299
|
+
}
|
|
39300
|
+
const scope = this.startSpan('env.received', {
|
|
39301
|
+
attributes: filterAttributes(attributes),
|
|
39302
|
+
});
|
|
39303
|
+
scope.enter();
|
|
39304
|
+
scope.exit();
|
|
39794
39305
|
}
|
|
39795
|
-
catch {
|
|
39796
|
-
|
|
39306
|
+
catch (error) {
|
|
39307
|
+
logTelemetryFailure('trace_span_received_failed', error, {
|
|
39308
|
+
envelope_id: envelope.id,
|
|
39309
|
+
});
|
|
39797
39310
|
}
|
|
39311
|
+
return envelope;
|
|
39798
39312
|
}
|
|
39799
|
-
|
|
39800
|
-
|
|
39801
|
-
|
|
39802
|
-
|
|
39803
|
-
this.entered = false;
|
|
39804
|
-
this.wrapper = new OpenTelemetryTraceSpan(span, api);
|
|
39313
|
+
async onForwardToRoute(node, nextSegment, envelope, _context) {
|
|
39314
|
+
return this.startEnvelopeOperationSpan(node, 'env.fwd_to_route', envelope, nextSegment, {
|
|
39315
|
+
'route.segment': nextSegment,
|
|
39316
|
+
});
|
|
39805
39317
|
}
|
|
39806
|
-
|
|
39807
|
-
|
|
39808
|
-
|
|
39809
|
-
|
|
39810
|
-
this.traceToken = setOtelTraceId(spanContext?.traceId ?? null);
|
|
39811
|
-
this.spanToken = setOtelSpanId(spanContext?.spanId ?? null);
|
|
39812
|
-
}
|
|
39813
|
-
return this.wrapper;
|
|
39318
|
+
async onForwardToRouteComplete(node, nextSegment, envelope, result, error, _context) {
|
|
39319
|
+
return this.completeEnvelopeOperationSpan(node, 'env.fwd_to_route', envelope, nextSegment, result, error, {
|
|
39320
|
+
'route.segment': nextSegment,
|
|
39321
|
+
});
|
|
39814
39322
|
}
|
|
39815
|
-
|
|
39816
|
-
|
|
39817
|
-
|
|
39818
|
-
}
|
|
39819
|
-
catch {
|
|
39820
|
-
// Ignore span termination errors
|
|
39821
|
-
}
|
|
39822
|
-
finally {
|
|
39823
|
-
if (this.traceToken !== undefined) {
|
|
39824
|
-
resetOtelTraceId(this.traceToken);
|
|
39825
|
-
this.traceToken = undefined;
|
|
39826
|
-
}
|
|
39827
|
-
if (this.spanToken !== undefined) {
|
|
39828
|
-
resetOtelSpanId(this.spanToken);
|
|
39829
|
-
this.spanToken = undefined;
|
|
39830
|
-
}
|
|
39831
|
-
}
|
|
39323
|
+
async onForwardUpstream(node, envelope, _context) {
|
|
39324
|
+
return this.startEnvelopeOperationSpan(node, 'env.fwd_upstream', envelope, 'upstream', {
|
|
39325
|
+
direction: 'upstream',
|
|
39326
|
+
});
|
|
39832
39327
|
}
|
|
39833
|
-
|
|
39834
|
-
|
|
39835
|
-
|
|
39836
|
-
|
|
39837
|
-
this.shutdownInvoked = false;
|
|
39838
|
-
const normalized = normalizeOpenTelemetryTraceEmitterOptions(options);
|
|
39839
|
-
this.otelApi = normalized.otelApi;
|
|
39840
|
-
this.tracer =
|
|
39841
|
-
normalized.tracer ?? this.otelApi.trace.getTracer(normalized.serviceName);
|
|
39842
|
-
this.lifecycle = normalized.lifecycle ?? null;
|
|
39843
|
-
this.authStrategy = normalized.authStrategy ?? null;
|
|
39328
|
+
async onForwardUpstreamComplete(node, envelope, result, error, _context) {
|
|
39329
|
+
return this.completeEnvelopeOperationSpan(node, 'env.fwd_upstream', envelope, 'upstream', result, error, {
|
|
39330
|
+
direction: 'upstream',
|
|
39331
|
+
});
|
|
39844
39332
|
}
|
|
39845
|
-
|
|
39846
|
-
|
|
39847
|
-
|
|
39848
|
-
|
|
39849
|
-
spanOptions.attributes = attributes;
|
|
39850
|
-
}
|
|
39851
|
-
if (options?.links) {
|
|
39852
|
-
spanOptions.links = options.links;
|
|
39853
|
-
}
|
|
39854
|
-
const span = this.tracer.startSpan(name, spanOptions);
|
|
39855
|
-
const envelopeTraceId = options?.attributes?.['env.trace_id'];
|
|
39856
|
-
if (typeof envelopeTraceId === 'string') {
|
|
39857
|
-
this.applyEnvelopeTraceId(span, envelopeTraceId);
|
|
39858
|
-
}
|
|
39859
|
-
return new OpenTelemetrySpanScope(span, this.otelApi);
|
|
39333
|
+
async onForwardToPeer(node, peerSegment, envelope, _context) {
|
|
39334
|
+
return this.startEnvelopeOperationSpan(node, 'env.fwd_to_peer', envelope, peerSegment, {
|
|
39335
|
+
'peer.segment': peerSegment,
|
|
39336
|
+
});
|
|
39860
39337
|
}
|
|
39861
|
-
async
|
|
39862
|
-
|
|
39863
|
-
|
|
39864
|
-
|
|
39865
|
-
return;
|
|
39866
|
-
}
|
|
39867
|
-
catch {
|
|
39868
|
-
// fall through to global flush fallback
|
|
39869
|
-
}
|
|
39870
|
-
}
|
|
39871
|
-
try {
|
|
39872
|
-
const provider = this.otelApi.trace.getTracerProvider();
|
|
39873
|
-
if (provider && typeof provider.forceFlush === 'function') {
|
|
39874
|
-
await provider.forceFlush();
|
|
39875
|
-
}
|
|
39876
|
-
}
|
|
39877
|
-
catch {
|
|
39878
|
-
// Ignore flush errors
|
|
39879
|
-
}
|
|
39338
|
+
async onForwardToPeerComplete(node, peerSegment, envelope, result, error, _context) {
|
|
39339
|
+
return this.completeEnvelopeOperationSpan(node, 'env.fwd_to_peer', envelope, peerSegment, result, error, {
|
|
39340
|
+
'peer.segment': peerSegment,
|
|
39341
|
+
});
|
|
39880
39342
|
}
|
|
39881
|
-
async
|
|
39882
|
-
|
|
39883
|
-
|
|
39884
|
-
|
|
39885
|
-
|
|
39886
|
-
|
|
39887
|
-
const strategy = this.authStrategy;
|
|
39888
|
-
if (strategy) {
|
|
39889
|
-
this.authStrategy = null;
|
|
39890
|
-
cleanupTasks.push(strategy.cleanup().catch(() => {
|
|
39891
|
-
// Ignore auth cleanup failures
|
|
39892
|
-
}));
|
|
39893
|
-
}
|
|
39894
|
-
if (this.lifecycle?.shutdown) {
|
|
39895
|
-
try {
|
|
39896
|
-
await this.lifecycle.shutdown();
|
|
39897
|
-
this.lifecycle = null;
|
|
39898
|
-
await Promise.all(cleanupTasks);
|
|
39899
|
-
return;
|
|
39900
|
-
}
|
|
39901
|
-
catch {
|
|
39902
|
-
// fall through to global shutdown fallback
|
|
39903
|
-
this.lifecycle = null;
|
|
39904
|
-
}
|
|
39905
|
-
}
|
|
39906
|
-
try {
|
|
39907
|
-
const provider = this.otelApi.trace.getTracerProvider();
|
|
39908
|
-
if (provider && typeof provider.shutdown === 'function') {
|
|
39909
|
-
await provider.shutdown();
|
|
39910
|
-
}
|
|
39911
|
-
}
|
|
39912
|
-
catch {
|
|
39913
|
-
// Ignore shutdown errors
|
|
39914
|
-
}
|
|
39915
|
-
finally {
|
|
39916
|
-
if (cleanupTasks.length > 0) {
|
|
39917
|
-
await Promise.all(cleanupTasks);
|
|
39918
|
-
}
|
|
39919
|
-
}
|
|
39343
|
+
async onDeliverLocal(node, address, envelope, _context) {
|
|
39344
|
+
const addressKey = address ? String(address) : 'unknown';
|
|
39345
|
+
return this.startEnvelopeOperationSpan(node, 'env.deliver_local', envelope, addressKey, {
|
|
39346
|
+
'delivery.address': addressKey,
|
|
39347
|
+
'delivery.type': 'local',
|
|
39348
|
+
});
|
|
39920
39349
|
}
|
|
39921
|
-
|
|
39350
|
+
async onDeliverLocalComplete(node, address, envelope, _context) {
|
|
39351
|
+
const addressKey = address ? String(address) : 'unknown';
|
|
39352
|
+
return this.completeEnvelopeOperationSpan(node, 'env.deliver_local', envelope, addressKey, null, null, {
|
|
39353
|
+
'delivery.address': addressKey,
|
|
39354
|
+
'delivery.type': 'local',
|
|
39355
|
+
});
|
|
39356
|
+
}
|
|
39357
|
+
async onNodeInitialized(node) {
|
|
39358
|
+
this.node = node;
|
|
39359
|
+
}
|
|
39360
|
+
async onNodeStopped(_node) {
|
|
39922
39361
|
try {
|
|
39923
|
-
|
|
39924
|
-
|
|
39925
|
-
|
|
39926
|
-
|
|
39362
|
+
if (typeof this.flush === 'function') {
|
|
39363
|
+
await this.flush();
|
|
39364
|
+
}
|
|
39365
|
+
if (typeof this.shutdown === 'function') {
|
|
39366
|
+
await this.shutdown();
|
|
39927
39367
|
}
|
|
39928
39368
|
}
|
|
39929
|
-
catch {
|
|
39930
|
-
|
|
39369
|
+
catch (error) {
|
|
39370
|
+
logTelemetryFailure('trace_span_shutdown_failed', error);
|
|
39931
39371
|
}
|
|
39932
39372
|
}
|
|
39933
|
-
|
|
39934
|
-
|
|
39935
|
-
let hex = '';
|
|
39936
|
-
for (let i = 0; i < 16; i += 1) {
|
|
39937
|
-
const code = normalized.charCodeAt(i);
|
|
39938
|
-
const byte = Number.isNaN(code) ? 0 : code & 0xff;
|
|
39939
|
-
hex += byte.toString(16).padStart(2, '0');
|
|
39940
|
-
}
|
|
39941
|
-
return hex;
|
|
39373
|
+
async flush() {
|
|
39374
|
+
// Default implementation: no-op
|
|
39942
39375
|
}
|
|
39943
|
-
|
|
39944
|
-
|
|
39945
|
-
const source = (input ?? {});
|
|
39946
|
-
const serviceName = extractNonEmptyString$1(pickFirst$1(source, ['serviceName', 'service_name'])) ?? 'naylence-service';
|
|
39947
|
-
const tracer = pickFirst$1(source, ['tracer']);
|
|
39948
|
-
const otelApi = pickFirst$1(source, [
|
|
39949
|
-
'otelApi',
|
|
39950
|
-
'otel_api',
|
|
39951
|
-
]);
|
|
39952
|
-
if (!otelApi) {
|
|
39953
|
-
throw new Error('OpenTelemetryTraceEmitter requires OpenTelemetry API bindings. Provide otelApi via options.');
|
|
39376
|
+
async shutdown() {
|
|
39377
|
+
// Default implementation: no-op
|
|
39954
39378
|
}
|
|
39955
|
-
const lifecycle = pickFirst$1(source, [
|
|
39956
|
-
'lifecycle',
|
|
39957
|
-
'lifeCycle',
|
|
39958
|
-
'life_cycle',
|
|
39959
|
-
]) ?? null;
|
|
39960
|
-
const authStrategy = pickFirst$1(source, [
|
|
39961
|
-
'authStrategy',
|
|
39962
|
-
'auth_strategy',
|
|
39963
|
-
]) ?? null;
|
|
39964
|
-
return {
|
|
39965
|
-
serviceName,
|
|
39966
|
-
tracer,
|
|
39967
|
-
otelApi,
|
|
39968
|
-
lifecycle,
|
|
39969
|
-
authStrategy,
|
|
39970
|
-
};
|
|
39971
39379
|
}
|
|
39972
|
-
|
|
39973
|
-
|
|
39974
|
-
|
|
39975
|
-
|
|
39976
|
-
|
|
39977
|
-
return value;
|
|
39978
|
-
}
|
|
39979
|
-
}
|
|
39980
|
-
}
|
|
39981
|
-
return undefined;
|
|
39380
|
+
|
|
39381
|
+
class NoopTraceSpan {
|
|
39382
|
+
setAttribute() { }
|
|
39383
|
+
recordException() { }
|
|
39384
|
+
setStatusError() { }
|
|
39982
39385
|
}
|
|
39983
|
-
|
|
39984
|
-
|
|
39985
|
-
|
|
39986
|
-
if (trimmed.length > 0) {
|
|
39987
|
-
return trimmed;
|
|
39988
|
-
}
|
|
39386
|
+
class NoopTraceSpanScope {
|
|
39387
|
+
constructor(span) {
|
|
39388
|
+
this.span = span;
|
|
39989
39389
|
}
|
|
39990
|
-
|
|
39991
|
-
|
|
39992
|
-
function normalizeAttributeValue(value) {
|
|
39993
|
-
if (Array.isArray(value)) {
|
|
39994
|
-
return value.map((item) => String(normalizePrimitiveAttribute(item, true)));
|
|
39390
|
+
enter() {
|
|
39391
|
+
return this.span;
|
|
39995
39392
|
}
|
|
39996
|
-
|
|
39393
|
+
exit() { }
|
|
39997
39394
|
}
|
|
39998
|
-
|
|
39999
|
-
|
|
40000
|
-
|
|
40001
|
-
|
|
40002
|
-
typeof value === 'boolean') {
|
|
40003
|
-
return value;
|
|
40004
|
-
}
|
|
40005
|
-
if (value instanceof Date) {
|
|
40006
|
-
return value.toISOString();
|
|
40007
|
-
}
|
|
40008
|
-
}
|
|
40009
|
-
if (value instanceof Date) {
|
|
40010
|
-
return value.toISOString();
|
|
40011
|
-
}
|
|
40012
|
-
if (typeof value === 'boolean') {
|
|
40013
|
-
return value;
|
|
40014
|
-
}
|
|
40015
|
-
if (!forceString && typeof value === 'number') {
|
|
40016
|
-
return value;
|
|
39395
|
+
class NoopTraceEmitter extends BaseTraceEmitter {
|
|
39396
|
+
startSpan(_name, _options) {
|
|
39397
|
+
void _options;
|
|
39398
|
+
return new NoopTraceSpanScope(new NoopTraceSpan());
|
|
40017
39399
|
}
|
|
40018
|
-
return String(value);
|
|
40019
39400
|
}
|
|
40020
|
-
|
|
40021
|
-
|
|
40022
|
-
|
|
39401
|
+
|
|
39402
|
+
const FACTORY_META$2 = {
|
|
39403
|
+
base: TRACE_EMITTER_FACTORY_BASE_TYPE,
|
|
39404
|
+
key: 'NoopTraceEmitter',
|
|
39405
|
+
};
|
|
39406
|
+
class NoopTraceEmitterFactory extends TraceEmitterFactory {
|
|
39407
|
+
constructor() {
|
|
39408
|
+
super(...arguments);
|
|
39409
|
+
this.type = 'NoopTraceEmitter';
|
|
39410
|
+
this.isDefault = true;
|
|
39411
|
+
this.priority = 100;
|
|
40023
39412
|
}
|
|
40024
|
-
|
|
40025
|
-
|
|
40026
|
-
entries.push([key, normalizeAttributeValue(raw)]);
|
|
39413
|
+
async create() {
|
|
39414
|
+
return new NoopTraceEmitter();
|
|
40027
39415
|
}
|
|
40028
|
-
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
40029
39416
|
}
|
|
40030
39417
|
|
|
40031
|
-
var
|
|
39418
|
+
var noopTraceEmitterFactory = /*#__PURE__*/Object.freeze({
|
|
40032
39419
|
__proto__: null,
|
|
40033
|
-
|
|
39420
|
+
FACTORY_META: FACTORY_META$2,
|
|
39421
|
+
NoopTraceEmitterFactory: NoopTraceEmitterFactory,
|
|
39422
|
+
default: NoopTraceEmitterFactory
|
|
40034
39423
|
});
|
|
40035
39424
|
|
|
40036
|
-
|
|
40037
|
-
|
|
40038
|
-
|
|
40039
|
-
const
|
|
40040
|
-
const
|
|
40041
|
-
|
|
40042
|
-
|
|
40043
|
-
|
|
40044
|
-
|
|
40045
|
-
async function setupOtel(options) {
|
|
40046
|
-
const normalized = normalizeSetupOtelOptions(options);
|
|
40047
|
-
try {
|
|
40048
|
-
if (registeredOtel) {
|
|
40049
|
-
logger$5.debug('open_telemetry_reusing_provider', {
|
|
40050
|
-
service_name: normalized.serviceName,
|
|
40051
|
-
});
|
|
40052
|
-
return registeredOtel.control;
|
|
40053
|
-
}
|
|
40054
|
-
const [apiModule, resourcesModule, nodeModule, traceBaseModule] = await Promise.all([
|
|
40055
|
-
import(OTEL_API_SPEC),
|
|
40056
|
-
import(OTEL_RESOURCES_SPEC),
|
|
40057
|
-
import(OTEL_TRACE_NODE_SPEC),
|
|
40058
|
-
import(OTEL_TRACE_BASE_SPEC),
|
|
40059
|
-
]);
|
|
40060
|
-
const { trace } = apiModule;
|
|
40061
|
-
const { defaultResource, resourceFromAttributes } = resourcesModule;
|
|
40062
|
-
const { NodeTracerProvider } = nodeModule;
|
|
40063
|
-
const { BatchSpanProcessor, ConsoleSpanExporter, ParentBasedSampler, AlwaysOnSampler, AlwaysOffSampler, TraceIdRatioBasedSampler, } = traceBaseModule;
|
|
40064
|
-
const currentProvider = trace.getTracerProvider();
|
|
40065
|
-
if (currentProvider && currentProvider instanceof NodeTracerProvider) {
|
|
40066
|
-
return null;
|
|
40067
|
-
}
|
|
40068
|
-
if (currentProvider &&
|
|
40069
|
-
currentProvider.constructor?.name === 'NodeTracerProvider') {
|
|
40070
|
-
logger$5.debug('open_telemetry_existing_node_provider', {
|
|
40071
|
-
service_name: normalized.serviceName,
|
|
40072
|
-
});
|
|
40073
|
-
return null;
|
|
40074
|
-
}
|
|
40075
|
-
logger$5.debug('open_telemetry_initializing', {
|
|
40076
|
-
service_name: normalized.serviceName,
|
|
40077
|
-
endpoint: normalized.endpoint ?? null,
|
|
40078
|
-
environment: normalized.environment ?? null,
|
|
40079
|
-
sampler: normalized.sampler ?? null,
|
|
40080
|
-
headers_present: Boolean(normalized.headers && Object.keys(normalized.headers).length),
|
|
40081
|
-
});
|
|
40082
|
-
const sampler = resolveSampler(normalized.sampler, {
|
|
40083
|
-
ParentBasedSampler,
|
|
40084
|
-
AlwaysOnSampler,
|
|
40085
|
-
AlwaysOffSampler,
|
|
40086
|
-
TraceIdRatioBasedSampler,
|
|
40087
|
-
});
|
|
40088
|
-
const baseResource = defaultResource();
|
|
40089
|
-
const mergedResource = resourceFromAttributes({
|
|
40090
|
-
'service.name': normalized.serviceName,
|
|
40091
|
-
'service.instance.id': generateInstanceId(),
|
|
40092
|
-
'deployment.environment': normalized.environment ?? 'dev',
|
|
39425
|
+
let openTelemetryTraceEmitterModulePromise = null;
|
|
39426
|
+
let otelApiModulePromise = null;
|
|
39427
|
+
let otelSetupModulePromise = null;
|
|
39428
|
+
const logger$7 = getLogger('naylence.fame.telemetry.open_telemetry_trace_emitter_factory');
|
|
39429
|
+
const MISSING_OTEL_HELP_MESSAGE = 'Missing optional OpenTelemetry dependency. Install @opentelemetry/api (and related packages) to enable trace emission.';
|
|
39430
|
+
function getOpenTelemetryTraceEmitterModule() {
|
|
39431
|
+
if (!openTelemetryTraceEmitterModulePromise) {
|
|
39432
|
+
openTelemetryTraceEmitterModulePromise = safeImport(() => Promise.resolve().then(function () { return openTelemetryTraceEmitter; }), '@opentelemetry/api', {
|
|
39433
|
+
helpMessage: MISSING_OTEL_HELP_MESSAGE,
|
|
40093
39434
|
});
|
|
40094
|
-
|
|
40095
|
-
|
|
40096
|
-
|
|
40097
|
-
|
|
40098
|
-
|
|
40099
|
-
|
|
40100
|
-
|
|
39435
|
+
}
|
|
39436
|
+
return openTelemetryTraceEmitterModulePromise;
|
|
39437
|
+
}
|
|
39438
|
+
function getOtelApiModule() {
|
|
39439
|
+
if (!otelApiModulePromise) {
|
|
39440
|
+
otelApiModulePromise = safeImport(() => import('@opentelemetry/api'), '@opentelemetry/api', {
|
|
39441
|
+
helpMessage: MISSING_OTEL_HELP_MESSAGE,
|
|
40101
39442
|
});
|
|
40102
|
-
|
|
40103
|
-
|
|
40104
|
-
|
|
40105
|
-
|
|
39443
|
+
}
|
|
39444
|
+
return otelApiModulePromise;
|
|
39445
|
+
}
|
|
39446
|
+
function getOtelSetupModule() {
|
|
39447
|
+
if (!otelSetupModulePromise) {
|
|
39448
|
+
otelSetupModulePromise = safeImport(() => Promise.resolve().then(function () { return otelSetup; }), '@opentelemetry/api', {
|
|
39449
|
+
helpMessage: MISSING_OTEL_HELP_MESSAGE,
|
|
40106
39450
|
});
|
|
40107
|
-
|
|
40108
|
-
|
|
39451
|
+
}
|
|
39452
|
+
return otelSetupModulePromise;
|
|
39453
|
+
}
|
|
39454
|
+
const FACTORY_META$1 = {
|
|
39455
|
+
base: TRACE_EMITTER_FACTORY_BASE_TYPE,
|
|
39456
|
+
key: 'OpenTelemetryTraceEmitter',
|
|
39457
|
+
};
|
|
39458
|
+
class OpenTelemetryTraceEmitterFactory extends TraceEmitterFactory {
|
|
39459
|
+
constructor() {
|
|
39460
|
+
super(...arguments);
|
|
39461
|
+
this.type = 'OpenTelemetryTraceEmitter';
|
|
39462
|
+
}
|
|
39463
|
+
async create(config, ...factoryArgs) {
|
|
39464
|
+
const options = (factoryArgs[0] ??
|
|
39465
|
+
{});
|
|
39466
|
+
const normalized = normalizeConfig$1(config);
|
|
39467
|
+
const mergedHeaders = {
|
|
39468
|
+
...normalized.headers,
|
|
39469
|
+
...(options.headers ?? {}),
|
|
39470
|
+
};
|
|
39471
|
+
let authStrategy = null;
|
|
39472
|
+
if (normalized.auth) {
|
|
39473
|
+
authStrategy =
|
|
39474
|
+
await AuthInjectionStrategyFactory.createAuthInjectionStrategy(normalized.auth);
|
|
39475
|
+
try {
|
|
39476
|
+
await authStrategy.apply(mergedHeaders);
|
|
39477
|
+
logger$7.info('trace_emitter_auth_applied', {
|
|
39478
|
+
service_name: normalized.serviceName,
|
|
39479
|
+
});
|
|
39480
|
+
}
|
|
39481
|
+
catch (error) {
|
|
40109
39482
|
try {
|
|
40110
|
-
await
|
|
39483
|
+
await authStrategy.cleanup();
|
|
40111
39484
|
}
|
|
40112
|
-
catch
|
|
40113
|
-
|
|
40114
|
-
error: flushError instanceof Error
|
|
40115
|
-
? flushError.message
|
|
40116
|
-
: String(flushError),
|
|
40117
|
-
});
|
|
39485
|
+
catch {
|
|
39486
|
+
// Ignore cleanup errors while propagating original failure
|
|
40118
39487
|
}
|
|
40119
|
-
|
|
40120
|
-
|
|
39488
|
+
throw error;
|
|
39489
|
+
}
|
|
39490
|
+
}
|
|
39491
|
+
let lifecycle = null;
|
|
39492
|
+
try {
|
|
39493
|
+
const { setupOtel } = await getOtelSetupModule();
|
|
39494
|
+
lifecycle = await setupOtel({
|
|
39495
|
+
serviceName: normalized.serviceName,
|
|
39496
|
+
endpoint: normalized.endpoint,
|
|
39497
|
+
environment: normalized.environment,
|
|
39498
|
+
sampler: normalized.sampler,
|
|
39499
|
+
headers: Object.keys(mergedHeaders).length > 0 ? mergedHeaders : undefined,
|
|
39500
|
+
});
|
|
39501
|
+
logger$7.debug('trace_emitter_lifecycle_acquired', {
|
|
39502
|
+
service_name: normalized.serviceName,
|
|
39503
|
+
lifecycle_available: Boolean(lifecycle),
|
|
39504
|
+
});
|
|
39505
|
+
}
|
|
39506
|
+
catch (error) {
|
|
39507
|
+
if (authStrategy) {
|
|
40121
39508
|
try {
|
|
40122
|
-
await
|
|
40123
|
-
}
|
|
40124
|
-
catch (shutdownError) {
|
|
40125
|
-
logger$5.warning('open_telemetry_shutdown_failed', {
|
|
40126
|
-
error: shutdownError instanceof Error
|
|
40127
|
-
? shutdownError.message
|
|
40128
|
-
: String(shutdownError),
|
|
40129
|
-
});
|
|
39509
|
+
await authStrategy.cleanup();
|
|
40130
39510
|
}
|
|
40131
|
-
|
|
40132
|
-
|
|
39511
|
+
catch {
|
|
39512
|
+
// Ignore cleanup errors while propagating original failure
|
|
40133
39513
|
}
|
|
39514
|
+
}
|
|
39515
|
+
throw error;
|
|
39516
|
+
}
|
|
39517
|
+
const [{ OpenTelemetryTraceEmitter }, otelModule] = await Promise.all([
|
|
39518
|
+
getOpenTelemetryTraceEmitterModule(),
|
|
39519
|
+
getOtelApiModule(),
|
|
39520
|
+
]);
|
|
39521
|
+
const emitterOptions = {
|
|
39522
|
+
serviceName: normalized.serviceName,
|
|
39523
|
+
otelApi: {
|
|
39524
|
+
trace: otelModule.trace,
|
|
39525
|
+
SpanStatusCode: otelModule.SpanStatusCode,
|
|
40134
39526
|
},
|
|
40135
39527
|
};
|
|
40136
|
-
|
|
40137
|
-
|
|
40138
|
-
|
|
40139
|
-
|
|
40140
|
-
|
|
40141
|
-
|
|
40142
|
-
|
|
40143
|
-
|
|
40144
|
-
|
|
40145
|
-
|
|
40146
|
-
|
|
40147
|
-
|
|
39528
|
+
if (options.tracer) {
|
|
39529
|
+
emitterOptions.tracer = options.tracer;
|
|
39530
|
+
}
|
|
39531
|
+
if (lifecycle) {
|
|
39532
|
+
emitterOptions.lifecycle = lifecycle;
|
|
39533
|
+
}
|
|
39534
|
+
if (authStrategy) {
|
|
39535
|
+
emitterOptions.authStrategy = authStrategy;
|
|
39536
|
+
}
|
|
39537
|
+
try {
|
|
39538
|
+
const emitter = new OpenTelemetryTraceEmitter(emitterOptions);
|
|
39539
|
+
logger$7.debug('trace_emitter_created', {
|
|
39540
|
+
service_name: normalized.serviceName,
|
|
39541
|
+
has_lifecycle: Boolean(lifecycle),
|
|
39542
|
+
has_auth_strategy: Boolean(authStrategy),
|
|
39543
|
+
});
|
|
39544
|
+
return emitter;
|
|
39545
|
+
}
|
|
39546
|
+
catch (error) {
|
|
39547
|
+
if (authStrategy) {
|
|
39548
|
+
try {
|
|
39549
|
+
await authStrategy.cleanup();
|
|
39550
|
+
}
|
|
39551
|
+
catch {
|
|
39552
|
+
// Best effort cleanup
|
|
39553
|
+
}
|
|
39554
|
+
}
|
|
39555
|
+
throw error;
|
|
39556
|
+
}
|
|
40148
39557
|
}
|
|
40149
39558
|
}
|
|
40150
|
-
function
|
|
40151
|
-
|
|
40152
|
-
|
|
39559
|
+
function normalizeConfig$1(config) {
|
|
39560
|
+
if (!config) {
|
|
39561
|
+
return {
|
|
39562
|
+
serviceName: 'naylence-service',
|
|
39563
|
+
endpoint: null,
|
|
39564
|
+
environment: null,
|
|
39565
|
+
sampler: null,
|
|
39566
|
+
headers: {},
|
|
39567
|
+
auth: null,
|
|
39568
|
+
};
|
|
39569
|
+
}
|
|
39570
|
+
const candidate = config;
|
|
39571
|
+
const serviceName = extractString(pickFirst$2(candidate, ['serviceName', 'service_name'])) ??
|
|
40153
39572
|
'naylence-service';
|
|
40154
|
-
const endpoint =
|
|
40155
|
-
const environment =
|
|
39573
|
+
const endpoint = extractString(pickFirst$2(candidate, ['endpoint', 'otlpEndpoint', 'otlp_endpoint'])) ?? null;
|
|
39574
|
+
const environment = extractString(pickFirst$2(candidate, [
|
|
40156
39575
|
'environment',
|
|
40157
39576
|
'deploymentEnvironment',
|
|
40158
39577
|
'deployment_environment',
|
|
40159
39578
|
])) ?? null;
|
|
40160
|
-
const sampler =
|
|
40161
|
-
const
|
|
39579
|
+
const sampler = extractString(pickFirst$2(candidate, ['sampler', 'samplingStrategy', 'sampling_strategy'])) ?? null;
|
|
39580
|
+
const headersFromConfig = extractHeaders$1(pickFirst$2(candidate, ['headers', 'otlpHeaders', 'otlp_headers']));
|
|
39581
|
+
const authConfig = pickFirst$2(candidate, [
|
|
39582
|
+
'auth',
|
|
39583
|
+
]);
|
|
40162
39584
|
return {
|
|
40163
39585
|
serviceName,
|
|
40164
39586
|
endpoint,
|
|
40165
39587
|
environment,
|
|
40166
39588
|
sampler,
|
|
40167
|
-
headers:
|
|
39589
|
+
headers: headersFromConfig ?? {},
|
|
39590
|
+
auth: authConfig ?? null,
|
|
40168
39591
|
};
|
|
40169
39592
|
}
|
|
40170
|
-
function
|
|
39593
|
+
function extractString(value) {
|
|
39594
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
39595
|
+
return value;
|
|
39596
|
+
}
|
|
39597
|
+
return undefined;
|
|
39598
|
+
}
|
|
39599
|
+
function pickFirst$2(source, keys) {
|
|
40171
39600
|
for (const key of keys) {
|
|
40172
39601
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
40173
39602
|
const value = source[key];
|
|
@@ -40178,16 +39607,7 @@ function pickFirst(source, keys) {
|
|
|
40178
39607
|
}
|
|
40179
39608
|
return undefined;
|
|
40180
39609
|
}
|
|
40181
|
-
function
|
|
40182
|
-
if (typeof value === 'string') {
|
|
40183
|
-
const trimmed = value.trim();
|
|
40184
|
-
if (trimmed.length > 0) {
|
|
40185
|
-
return trimmed;
|
|
40186
|
-
}
|
|
40187
|
-
}
|
|
40188
|
-
return undefined;
|
|
40189
|
-
}
|
|
40190
|
-
function extractHeaders(value) {
|
|
39610
|
+
function extractHeaders$1(value) {
|
|
40191
39611
|
if (!value || typeof value !== 'object') {
|
|
40192
39612
|
return null;
|
|
40193
39613
|
}
|
|
@@ -40199,76 +39619,145 @@ function extractHeaders(value) {
|
|
|
40199
39619
|
}
|
|
40200
39620
|
return Object.keys(headers).length > 0 ? headers : null;
|
|
40201
39621
|
}
|
|
40202
|
-
|
|
40203
|
-
|
|
40204
|
-
|
|
40205
|
-
|
|
40206
|
-
|
|
40207
|
-
|
|
39622
|
+
|
|
39623
|
+
var openTelemetryTraceEmitterFactory = /*#__PURE__*/Object.freeze({
|
|
39624
|
+
__proto__: null,
|
|
39625
|
+
FACTORY_META: FACTORY_META$1,
|
|
39626
|
+
OpenTelemetryTraceEmitterFactory: OpenTelemetryTraceEmitterFactory,
|
|
39627
|
+
default: OpenTelemetryTraceEmitterFactory
|
|
39628
|
+
});
|
|
39629
|
+
|
|
39630
|
+
const logger$6 = getLogger('naylence.fame.telemetry.trace_emitter_profile_factory');
|
|
39631
|
+
const PROFILE_NAME_NOOP = 'noop';
|
|
39632
|
+
const PROFILE_NAME_OPEN_TELEMETRY = 'open-telemetry';
|
|
39633
|
+
const ENV_VAR_TELEMETRY_SERVICE_NAME = 'FAME_TELEMETRY_SERVICE_NAME';
|
|
39634
|
+
const NOOP_PROFILE = {
|
|
39635
|
+
type: 'NoopTraceEmitter',
|
|
39636
|
+
};
|
|
39637
|
+
const OPEN_TELEMETRY_PROFILE = {
|
|
39638
|
+
type: 'OpenTelemetryTraceEmitter',
|
|
39639
|
+
serviceName: factory.Expressions.env(ENV_VAR_TELEMETRY_SERVICE_NAME, 'naylence-service'),
|
|
39640
|
+
headers: {},
|
|
39641
|
+
};
|
|
39642
|
+
const PROFILE_MAP = {
|
|
39643
|
+
[PROFILE_NAME_NOOP]: NOOP_PROFILE,
|
|
39644
|
+
[PROFILE_NAME_OPEN_TELEMETRY]: OPEN_TELEMETRY_PROFILE,
|
|
39645
|
+
};
|
|
39646
|
+
const FACTORY_META = {
|
|
39647
|
+
base: TRACE_EMITTER_FACTORY_BASE_TYPE,
|
|
39648
|
+
key: 'TraceEmitterProfile',
|
|
39649
|
+
};
|
|
39650
|
+
class TraceEmitterProfileFactory extends TraceEmitterFactory {
|
|
39651
|
+
constructor() {
|
|
39652
|
+
super(...arguments);
|
|
39653
|
+
this.type = 'TraceEmitterProfile';
|
|
40208
39654
|
}
|
|
40209
|
-
|
|
40210
|
-
|
|
39655
|
+
async create(config, ...factoryArgs) {
|
|
39656
|
+
const normalized = normalizeTraceEmitterProfileConfig(config);
|
|
39657
|
+
const profileConfig = resolveProfileConfig(normalized.profile);
|
|
39658
|
+
logger$6.debug('enabling_trace_emitter_profile', {
|
|
39659
|
+
profile: normalized.profile,
|
|
39660
|
+
});
|
|
39661
|
+
const traceEmitter = await TraceEmitterFactory.createTraceEmitter(profileConfig, {
|
|
39662
|
+
factoryArgs,
|
|
39663
|
+
});
|
|
39664
|
+
if (!traceEmitter) {
|
|
39665
|
+
throw new Error(`Failed to instantiate trace emitter profile: ${normalized.profile}`);
|
|
39666
|
+
}
|
|
39667
|
+
return traceEmitter;
|
|
40211
39668
|
}
|
|
40212
|
-
const random = Math.random().toString(16).slice(2);
|
|
40213
|
-
return random.padEnd(32, '0').slice(0, 32);
|
|
40214
39669
|
}
|
|
40215
|
-
function
|
|
40216
|
-
|
|
40217
|
-
|
|
40218
|
-
if (normalized === 'always_off') {
|
|
40219
|
-
base = new samplers.AlwaysOffSampler();
|
|
39670
|
+
function normalizeTraceEmitterProfileConfig(config) {
|
|
39671
|
+
if (!config) {
|
|
39672
|
+
return { profile: PROFILE_NAME_NOOP };
|
|
40220
39673
|
}
|
|
40221
|
-
|
|
40222
|
-
|
|
40223
|
-
|
|
39674
|
+
const candidate = config;
|
|
39675
|
+
const profileValue = resolveProfileName(candidate);
|
|
39676
|
+
const canonicalProfile = canonicalizeProfileName(profileValue);
|
|
39677
|
+
candidate.profile = canonicalProfile;
|
|
39678
|
+
return { profile: canonicalProfile };
|
|
39679
|
+
}
|
|
39680
|
+
function resolveProfileName(candidate) {
|
|
39681
|
+
const direct = coerceProfileString(candidate.profile);
|
|
39682
|
+
if (direct) {
|
|
39683
|
+
return direct;
|
|
40224
39684
|
}
|
|
40225
|
-
|
|
40226
|
-
|
|
40227
|
-
const
|
|
40228
|
-
|
|
40229
|
-
|
|
40230
|
-
|
|
39685
|
+
const legacyKeys = ['profile_name', 'profileName'];
|
|
39686
|
+
for (const legacyKey of legacyKeys) {
|
|
39687
|
+
const legacyValue = coerceProfileString(candidate[legacyKey]);
|
|
39688
|
+
if (legacyValue) {
|
|
39689
|
+
return legacyValue;
|
|
39690
|
+
}
|
|
40231
39691
|
}
|
|
40232
|
-
|
|
40233
|
-
|
|
39692
|
+
return PROFILE_NAME_NOOP;
|
|
39693
|
+
}
|
|
39694
|
+
function coerceProfileString(value) {
|
|
39695
|
+
if (typeof value !== 'string') {
|
|
39696
|
+
return null;
|
|
40234
39697
|
}
|
|
40235
|
-
|
|
39698
|
+
const trimmed = value.trim();
|
|
39699
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
40236
39700
|
}
|
|
40237
|
-
|
|
40238
|
-
|
|
40239
|
-
|
|
40240
|
-
|
|
40241
|
-
|
|
40242
|
-
|
|
40243
|
-
|
|
40244
|
-
|
|
40245
|
-
|
|
40246
|
-
|
|
40247
|
-
|
|
40248
|
-
|
|
40249
|
-
|
|
40250
|
-
|
|
40251
|
-
|
|
40252
|
-
|
|
40253
|
-
return new OTLPTraceExporter(exporterOptions);
|
|
40254
|
-
}
|
|
40255
|
-
}
|
|
40256
|
-
catch (error) {
|
|
40257
|
-
logger$5.error('open_telemetry_exporter_not_available', {
|
|
40258
|
-
error: error instanceof Error ? error.message : String(error),
|
|
40259
|
-
});
|
|
40260
|
-
}
|
|
39701
|
+
const PROFILE_ALIASES = {
|
|
39702
|
+
noop: PROFILE_NAME_NOOP,
|
|
39703
|
+
'no-op': PROFILE_NAME_NOOP,
|
|
39704
|
+
no_op: PROFILE_NAME_NOOP,
|
|
39705
|
+
'open-telemetry': PROFILE_NAME_OPEN_TELEMETRY,
|
|
39706
|
+
open_telemetry: PROFILE_NAME_OPEN_TELEMETRY,
|
|
39707
|
+
opentelemetry: PROFILE_NAME_OPEN_TELEMETRY,
|
|
39708
|
+
};
|
|
39709
|
+
function canonicalizeProfileName(value) {
|
|
39710
|
+
const normalized = value.replace(/[\s_]+/g, '-').toLowerCase();
|
|
39711
|
+
return PROFILE_ALIASES[normalized] ?? normalized;
|
|
39712
|
+
}
|
|
39713
|
+
function resolveProfileConfig(profileName) {
|
|
39714
|
+
const profile = PROFILE_MAP[profileName];
|
|
39715
|
+
if (!profile) {
|
|
39716
|
+
throw new Error(`Unknown trace emitter profile: ${profileName}`);
|
|
40261
39717
|
}
|
|
40262
|
-
|
|
40263
|
-
|
|
39718
|
+
return deepClone(profile);
|
|
39719
|
+
}
|
|
39720
|
+
function deepClone(value) {
|
|
39721
|
+
return JSON.parse(JSON.stringify(value));
|
|
40264
39722
|
}
|
|
40265
39723
|
|
|
40266
|
-
var
|
|
39724
|
+
var traceEmitterProfileFactory = /*#__PURE__*/Object.freeze({
|
|
40267
39725
|
__proto__: null,
|
|
40268
|
-
|
|
39726
|
+
FACTORY_META: FACTORY_META,
|
|
39727
|
+
PROFILE_NAME_NOOP: PROFILE_NAME_NOOP,
|
|
39728
|
+
PROFILE_NAME_OPEN_TELEMETRY: PROFILE_NAME_OPEN_TELEMETRY,
|
|
39729
|
+
TraceEmitterProfileFactory: TraceEmitterProfileFactory,
|
|
39730
|
+
default: TraceEmitterProfileFactory
|
|
40269
39731
|
});
|
|
40270
39732
|
|
|
40271
|
-
|
|
39733
|
+
let initialized = false;
|
|
39734
|
+
const runtimePlugin = {
|
|
39735
|
+
name: 'naylence:runtime',
|
|
39736
|
+
version: VERSION,
|
|
39737
|
+
async register() {
|
|
39738
|
+
// console.log('[naylence:runtime] register() called, initialized=', initialized);
|
|
39739
|
+
if (initialized) {
|
|
39740
|
+
// console.log('[naylence:runtime] already initialized, skipping');
|
|
39741
|
+
return;
|
|
39742
|
+
}
|
|
39743
|
+
initialized = true;
|
|
39744
|
+
// console.log('[naylence:runtime] registering runtime factories...');
|
|
39745
|
+
// Register factories from manifest
|
|
39746
|
+
await registerRuntimeFactories();
|
|
39747
|
+
// Import modules with side-effect registrations (not in manifest)
|
|
39748
|
+
await Promise.resolve().then(function () { return websocketTransportProvisioner; });
|
|
39749
|
+
// console.log('[naylence:runtime] runtime factories registered');
|
|
39750
|
+
},
|
|
39751
|
+
};
|
|
39752
|
+
const RUNTIME_PLUGIN_SPECIFIER = runtimePlugin.name;
|
|
39753
|
+
|
|
39754
|
+
var plugin = /*#__PURE__*/Object.freeze({
|
|
39755
|
+
__proto__: null,
|
|
39756
|
+
RUNTIME_PLUGIN_SPECIFIER: RUNTIME_PLUGIN_SPECIFIER,
|
|
39757
|
+
default: runtimePlugin
|
|
39758
|
+
});
|
|
39759
|
+
|
|
39760
|
+
const logger$5 = getLogger('naylence.fame.security.auth.default_authorizer');
|
|
40272
39761
|
function decodeCredentials$1(credentials) {
|
|
40273
39762
|
if (typeof TextDecoder !== 'undefined') {
|
|
40274
39763
|
return new TextDecoder().decode(credentials);
|
|
@@ -40402,7 +39891,7 @@ class DefaultAuthorizer {
|
|
|
40402
39891
|
});
|
|
40403
39892
|
}
|
|
40404
39893
|
catch (error) {
|
|
40405
|
-
logger$
|
|
39894
|
+
logger$5.warning('token_verification_failed', {
|
|
40406
39895
|
error: error instanceof Error ? error.message : String(error),
|
|
40407
39896
|
});
|
|
40408
39897
|
return undefined;
|
|
@@ -40493,7 +39982,7 @@ var defaultAuthorizer = /*#__PURE__*/Object.freeze({
|
|
|
40493
39982
|
DefaultAuthorizer: DefaultAuthorizer
|
|
40494
39983
|
});
|
|
40495
39984
|
|
|
40496
|
-
const logger$
|
|
39985
|
+
const logger$4 = getLogger('naylence.fame.security.auth.jwks_jwt_token_verifier');
|
|
40497
39986
|
const DEFAULT_ALGORITHMS = ['RS256', 'ES256', 'EdDSA'];
|
|
40498
39987
|
function normalizeOptions$5(options) {
|
|
40499
39988
|
if (!options || typeof options !== 'object') {
|
|
@@ -40543,7 +40032,7 @@ class JWKSJWTTokenVerifier {
|
|
|
40543
40032
|
this.algorithms = (normalized.algorithms && normalized.algorithms.length > 0
|
|
40544
40033
|
? normalized.algorithms
|
|
40545
40034
|
: Array.from(DEFAULT_ALGORITHMS)).map((alg) => alg.toString().trim());
|
|
40546
|
-
logger$
|
|
40035
|
+
logger$4.debug('jwks_jwt_token_verifier_initialized', {
|
|
40547
40036
|
issuer: this.issuer,
|
|
40548
40037
|
jwks_url: this.jwksUrl.toString(),
|
|
40549
40038
|
cache_ttl_ms: this.cacheTtlMs,
|
|
@@ -40565,7 +40054,7 @@ class JWKSJWTTokenVerifier {
|
|
|
40565
40054
|
return buildAuthorizationContext$1(payload, protectedHeader?.kid);
|
|
40566
40055
|
}
|
|
40567
40056
|
catch (error) {
|
|
40568
|
-
logger$
|
|
40057
|
+
logger$4.warning('jwks_jwt_token_verifier_failed', {
|
|
40569
40058
|
error: error instanceof Error ? error.message : String(error),
|
|
40570
40059
|
});
|
|
40571
40060
|
throw this.normalizeJoseError(error);
|
|
@@ -40616,7 +40105,7 @@ var jwksJwtTokenVerifier = /*#__PURE__*/Object.freeze({
|
|
|
40616
40105
|
JWKSJWTTokenVerifier: JWKSJWTTokenVerifier
|
|
40617
40106
|
});
|
|
40618
40107
|
|
|
40619
|
-
const logger$
|
|
40108
|
+
const logger$3 = getLogger('naylence.fame.security.auth.oauth2_authorizer');
|
|
40620
40109
|
function normalizeOptions$4(raw) {
|
|
40621
40110
|
const camel = raw;
|
|
40622
40111
|
const snake = raw;
|
|
@@ -40681,12 +40170,12 @@ class OAuth2Authorizer {
|
|
|
40681
40170
|
async authenticate(credentials) {
|
|
40682
40171
|
const token = this.normalizeBearerToken(credentials);
|
|
40683
40172
|
if (!token) {
|
|
40684
|
-
logger$
|
|
40173
|
+
logger$3.debug('oauth2_authenticate_missing_token');
|
|
40685
40174
|
return undefined;
|
|
40686
40175
|
}
|
|
40687
40176
|
try {
|
|
40688
40177
|
const expectedAudience = this.audience ?? this.node?.physicalPath;
|
|
40689
|
-
logger$
|
|
40178
|
+
logger$3.debug('oauth2_authenticate_start', {
|
|
40690
40179
|
expected_audience: expectedAudience,
|
|
40691
40180
|
});
|
|
40692
40181
|
const context = expectedAudience !== undefined
|
|
@@ -40698,7 +40187,7 @@ class OAuth2Authorizer {
|
|
|
40698
40187
|
if (this.requireScope &&
|
|
40699
40188
|
this.requiredScopes.size > 0 &&
|
|
40700
40189
|
!this.hasRequiredScope(grantedScopes)) {
|
|
40701
|
-
logger$
|
|
40190
|
+
logger$3.warning('oauth2_token_missing_required_scope', {
|
|
40702
40191
|
required_scopes: Array.from(this.requiredScopes),
|
|
40703
40192
|
token_scopes: Array.from(scopes),
|
|
40704
40193
|
});
|
|
@@ -40712,13 +40201,13 @@ class OAuth2Authorizer {
|
|
|
40712
40201
|
grantedScopes,
|
|
40713
40202
|
authMethod: context.authMethod ?? 'oauth2_jwt',
|
|
40714
40203
|
});
|
|
40715
|
-
logger$
|
|
40204
|
+
logger$3.debug('oauth2_authenticate_success', {
|
|
40716
40205
|
granted_scopes: Array.from(grantedScopes),
|
|
40717
40206
|
});
|
|
40718
40207
|
return normalized;
|
|
40719
40208
|
}
|
|
40720
40209
|
catch (error) {
|
|
40721
|
-
logger$
|
|
40210
|
+
logger$3.warning('oauth2_token_verification_failed', {
|
|
40722
40211
|
error: error instanceof Error ? error.message : String(error),
|
|
40723
40212
|
});
|
|
40724
40213
|
return undefined;
|
|
@@ -40760,7 +40249,7 @@ class OAuth2Authorizer {
|
|
|
40760
40249
|
instance_id: node.instanceId ?? null,
|
|
40761
40250
|
capabilities: Array.from(this.requiredScopes),
|
|
40762
40251
|
});
|
|
40763
|
-
logger$
|
|
40252
|
+
logger$3.debug('reverse_authorization_token_generated', {
|
|
40764
40253
|
node_id: node.id,
|
|
40765
40254
|
expires_at: expiresAt.toISOString(),
|
|
40766
40255
|
capabilities: Array.from(this.requiredScopes),
|
|
@@ -40777,7 +40266,7 @@ class OAuth2Authorizer {
|
|
|
40777
40266
|
return result;
|
|
40778
40267
|
}
|
|
40779
40268
|
catch (error) {
|
|
40780
|
-
logger$
|
|
40269
|
+
logger$3.warning('failed_to_generate_reverse_auth_token', {
|
|
40781
40270
|
node_id: node.id,
|
|
40782
40271
|
error: error instanceof Error ? error.message : String(error),
|
|
40783
40272
|
});
|
|
@@ -40794,7 +40283,7 @@ class OAuth2Authorizer {
|
|
|
40794
40283
|
if (this.requireScope &&
|
|
40795
40284
|
this.requiredScopes.size > 0 &&
|
|
40796
40285
|
!this.hasRequiredScope(grantedScopes)) {
|
|
40797
|
-
logger$
|
|
40286
|
+
logger$3.warning('oauth2_attach_missing_required_scope', {
|
|
40798
40287
|
required_scopes: Array.from(this.requiredScopes),
|
|
40799
40288
|
token_scopes: Array.from(scopes),
|
|
40800
40289
|
});
|
|
@@ -40884,7 +40373,7 @@ var oauth2Authorizer = /*#__PURE__*/Object.freeze({
|
|
|
40884
40373
|
OAuth2Authorizer: OAuth2Authorizer
|
|
40885
40374
|
});
|
|
40886
40375
|
|
|
40887
|
-
const logger$
|
|
40376
|
+
const logger$2 = getLogger('naylence.fame.security.auth.oauth2_client_credentials_token_provider');
|
|
40888
40377
|
function normalizeOptions$3(raw) {
|
|
40889
40378
|
const camel = raw;
|
|
40890
40379
|
const snake = raw;
|
|
@@ -40950,7 +40439,7 @@ class OAuth2ClientCredentialsTokenProvider {
|
|
|
40950
40439
|
}
|
|
40951
40440
|
async getToken() {
|
|
40952
40441
|
if (this.cachedToken && this.isTokenFresh(this.cachedToken)) {
|
|
40953
|
-
logger$
|
|
40442
|
+
logger$2.debug('using_cached_oauth2_token', {
|
|
40954
40443
|
token_url: this.options.tokenUrl,
|
|
40955
40444
|
});
|
|
40956
40445
|
return { ...this.cachedToken };
|
|
@@ -41005,7 +40494,7 @@ class OAuth2ClientCredentialsTokenProvider {
|
|
|
41005
40494
|
}
|
|
41006
40495
|
const expiresInSeconds = this.resolveExpiresIn(payload);
|
|
41007
40496
|
const expiresAt = Date.now() + expiresInSeconds * 1000;
|
|
41008
|
-
logger$
|
|
40497
|
+
logger$2.debug('oauth2_token_fetched', {
|
|
41009
40498
|
token_url: this.options.tokenUrl,
|
|
41010
40499
|
scopes: this.options.scopes,
|
|
41011
40500
|
audience: this.options.audience,
|
|
@@ -41040,7 +40529,7 @@ var oauth2ClientCredentialsTokenProvider = /*#__PURE__*/Object.freeze({
|
|
|
41040
40529
|
OAuth2ClientCredentialsTokenProvider: OAuth2ClientCredentialsTokenProvider
|
|
41041
40530
|
});
|
|
41042
40531
|
|
|
41043
|
-
const logger = getLogger('naylence.fame.security.auth.oauth2_pkce_token_provider');
|
|
40532
|
+
const logger$1 = getLogger('naylence.fame.security.auth.oauth2_pkce_token_provider');
|
|
41044
40533
|
const DEFAULT_SCOPES = [];
|
|
41045
40534
|
const DEFAULT_CLOCK_SKEW_SECONDS = 30;
|
|
41046
40535
|
const DEFAULT_CODE_VERIFIER_LENGTH = 48; // bytes before base64url encoding
|
|
@@ -41215,7 +40704,7 @@ function readPendingAuthorization(clientId) {
|
|
|
41215
40704
|
return parsed;
|
|
41216
40705
|
}
|
|
41217
40706
|
catch (error) {
|
|
41218
|
-
logger.debug('pkce_storage_read_failed', {
|
|
40707
|
+
logger$1.debug('pkce_storage_read_failed', {
|
|
41219
40708
|
error: error instanceof Error ? error.message : String(error),
|
|
41220
40709
|
});
|
|
41221
40710
|
return null;
|
|
@@ -41234,7 +40723,7 @@ function writePendingAuthorization(clientId, pending) {
|
|
|
41234
40723
|
window.sessionStorage.setItem(key, JSON.stringify(pending));
|
|
41235
40724
|
}
|
|
41236
40725
|
catch (error) {
|
|
41237
|
-
logger.debug('pkce_storage_write_failed', {
|
|
40726
|
+
logger$1.debug('pkce_storage_write_failed', {
|
|
41238
40727
|
error: error instanceof Error ? error.message : String(error),
|
|
41239
40728
|
});
|
|
41240
40729
|
}
|
|
@@ -41280,7 +40769,7 @@ function clearOAuthParamsFromUrl(url) {
|
|
|
41280
40769
|
window.history.replaceState(window.history.state, '', finalUrl);
|
|
41281
40770
|
}
|
|
41282
40771
|
catch (error) {
|
|
41283
|
-
logger.debug('pkce_replace_state_failed', {
|
|
40772
|
+
logger$1.debug('pkce_replace_state_failed', {
|
|
41284
40773
|
error: error instanceof Error ? error.message : String(error),
|
|
41285
40774
|
});
|
|
41286
40775
|
}
|
|
@@ -41321,7 +40810,7 @@ class OAuth2PkceTokenProvider {
|
|
|
41321
40810
|
if (persisted) {
|
|
41322
40811
|
if (this.isTokenCompatible(persisted.scopes, persisted.audience)) {
|
|
41323
40812
|
if (!persisted.expiresAt || this.isTokenFresh(persisted)) {
|
|
41324
|
-
logger.debug('using_persisted_oauth2_pkce_token', {
|
|
40813
|
+
logger$1.debug('using_persisted_oauth2_pkce_token', {
|
|
41325
40814
|
authorize_url: this.options.authorizeUrl,
|
|
41326
40815
|
});
|
|
41327
40816
|
const cached = {
|
|
@@ -41342,7 +40831,7 @@ class OAuth2PkceTokenProvider {
|
|
|
41342
40831
|
}
|
|
41343
40832
|
}
|
|
41344
40833
|
if (this.cachedToken && this.isTokenFresh(this.cachedToken)) {
|
|
41345
|
-
logger.debug('using_cached_oauth2_pkce_token', {
|
|
40834
|
+
logger$1.debug('using_cached_oauth2_pkce_token', {
|
|
41346
40835
|
authorize_url: this.options.authorizeUrl,
|
|
41347
40836
|
});
|
|
41348
40837
|
return { ...this.cachedToken };
|
|
@@ -41365,7 +40854,7 @@ class OAuth2PkceTokenProvider {
|
|
|
41365
40854
|
async beginBrowserAuthorization() {
|
|
41366
40855
|
const existing = readPendingAuthorization(this.options.clientId);
|
|
41367
40856
|
if (existing) {
|
|
41368
|
-
logger.debug('pkce_redirect_in_progress', {
|
|
40857
|
+
logger$1.debug('pkce_redirect_in_progress', {
|
|
41369
40858
|
authorize_url: this.options.authorizeUrl,
|
|
41370
40859
|
});
|
|
41371
40860
|
this.navigate(existing.authorizeUrl);
|
|
@@ -41395,7 +40884,7 @@ class OAuth2PkceTokenProvider {
|
|
|
41395
40884
|
};
|
|
41396
40885
|
writePersistedToken(this.options.clientId, null);
|
|
41397
40886
|
writePendingAuthorization(this.options.clientId, pending);
|
|
41398
|
-
logger.debug('pkce_redirect_start', {
|
|
40887
|
+
logger$1.debug('pkce_redirect_start', {
|
|
41399
40888
|
authorize_url: this.options.authorizeUrl,
|
|
41400
40889
|
redirect_uri: this.options.redirectUri,
|
|
41401
40890
|
});
|
|
@@ -41409,7 +40898,7 @@ class OAuth2PkceTokenProvider {
|
|
|
41409
40898
|
window.location.assign(url);
|
|
41410
40899
|
}
|
|
41411
40900
|
catch (error) {
|
|
41412
|
-
logger.error('pkce_navigation_failed', {
|
|
40901
|
+
logger$1.error('pkce_navigation_failed', {
|
|
41413
40902
|
authorize_url: url,
|
|
41414
40903
|
error: error instanceof Error ? error.message : String(error),
|
|
41415
40904
|
});
|
|
@@ -41553,7 +41042,7 @@ class OAuth2PkceTokenProvider {
|
|
|
41553
41042
|
value: accessToken,
|
|
41554
41043
|
expiresAt: Date.now() + expiresInSeconds * 1000,
|
|
41555
41044
|
};
|
|
41556
|
-
logger.debug('oauth2_pkce_token_fetched', {
|
|
41045
|
+
logger$1.debug('oauth2_pkce_token_fetched', {
|
|
41557
41046
|
authorize_url: this.options.authorizeUrl,
|
|
41558
41047
|
token_url: this.options.tokenUrl,
|
|
41559
41048
|
expires_in: expiresInSeconds,
|
|
@@ -41569,7 +41058,7 @@ class OAuth2PkceTokenProvider {
|
|
|
41569
41058
|
clearToken() {
|
|
41570
41059
|
this.cachedToken = undefined;
|
|
41571
41060
|
writePersistedToken(this.options.clientId, null);
|
|
41572
|
-
logger.debug('oauth2_pkce_token_cleared', {
|
|
41061
|
+
logger$1.debug('oauth2_pkce_token_cleared', {
|
|
41573
41062
|
authorize_url: this.options.authorizeUrl,
|
|
41574
41063
|
});
|
|
41575
41064
|
}
|
|
@@ -41966,6 +41455,543 @@ var eddsaEnvelopeVerifier = /*#__PURE__*/Object.freeze({
|
|
|
41966
41455
|
EdDSAEnvelopeVerifier: EdDSAEnvelopeVerifier
|
|
41967
41456
|
});
|
|
41968
41457
|
|
|
41458
|
+
let currentTraceId = null;
|
|
41459
|
+
let currentSpanId = null;
|
|
41460
|
+
function getOtelTraceId() {
|
|
41461
|
+
return currentTraceId;
|
|
41462
|
+
}
|
|
41463
|
+
function getOtelSpanId() {
|
|
41464
|
+
return currentSpanId;
|
|
41465
|
+
}
|
|
41466
|
+
function setOtelTraceId(traceId) {
|
|
41467
|
+
const previous = currentTraceId;
|
|
41468
|
+
currentTraceId = traceId;
|
|
41469
|
+
return previous;
|
|
41470
|
+
}
|
|
41471
|
+
function setOtelSpanId(spanId) {
|
|
41472
|
+
const previous = currentSpanId;
|
|
41473
|
+
currentSpanId = spanId;
|
|
41474
|
+
return previous;
|
|
41475
|
+
}
|
|
41476
|
+
function resetOtelTraceId(previous) {
|
|
41477
|
+
currentTraceId = previous;
|
|
41478
|
+
}
|
|
41479
|
+
function resetOtelSpanId(previous) {
|
|
41480
|
+
currentSpanId = previous;
|
|
41481
|
+
}
|
|
41482
|
+
|
|
41483
|
+
class OpenTelemetryTraceSpan {
|
|
41484
|
+
constructor(span, api) {
|
|
41485
|
+
this.span = span;
|
|
41486
|
+
this.api = api;
|
|
41487
|
+
}
|
|
41488
|
+
setAttribute(key, value) {
|
|
41489
|
+
try {
|
|
41490
|
+
this.span.setAttribute(key, normalizeAttributeValue(value));
|
|
41491
|
+
}
|
|
41492
|
+
catch {
|
|
41493
|
+
// Ignore telemetry attribute errors
|
|
41494
|
+
}
|
|
41495
|
+
}
|
|
41496
|
+
recordException(error) {
|
|
41497
|
+
try {
|
|
41498
|
+
if (error instanceof Error) {
|
|
41499
|
+
this.span.recordException(error);
|
|
41500
|
+
}
|
|
41501
|
+
else {
|
|
41502
|
+
this.span.recordException(new Error(String(error)));
|
|
41503
|
+
}
|
|
41504
|
+
}
|
|
41505
|
+
catch {
|
|
41506
|
+
// Ignore telemetry recording errors
|
|
41507
|
+
}
|
|
41508
|
+
}
|
|
41509
|
+
setStatusError(description) {
|
|
41510
|
+
try {
|
|
41511
|
+
const status = {
|
|
41512
|
+
code: this.api.SpanStatusCode.ERROR,
|
|
41513
|
+
};
|
|
41514
|
+
if (description !== undefined) {
|
|
41515
|
+
status.message = description;
|
|
41516
|
+
}
|
|
41517
|
+
this.span.setStatus(status);
|
|
41518
|
+
}
|
|
41519
|
+
catch {
|
|
41520
|
+
// Ignore telemetry status errors
|
|
41521
|
+
}
|
|
41522
|
+
}
|
|
41523
|
+
}
|
|
41524
|
+
class OpenTelemetrySpanScope {
|
|
41525
|
+
constructor(span, api) {
|
|
41526
|
+
this.span = span;
|
|
41527
|
+
this.entered = false;
|
|
41528
|
+
this.wrapper = new OpenTelemetryTraceSpan(span, api);
|
|
41529
|
+
}
|
|
41530
|
+
enter() {
|
|
41531
|
+
if (!this.entered) {
|
|
41532
|
+
this.entered = true;
|
|
41533
|
+
const spanContext = this.span.spanContext();
|
|
41534
|
+
this.traceToken = setOtelTraceId(spanContext?.traceId ?? null);
|
|
41535
|
+
this.spanToken = setOtelSpanId(spanContext?.spanId ?? null);
|
|
41536
|
+
}
|
|
41537
|
+
return this.wrapper;
|
|
41538
|
+
}
|
|
41539
|
+
exit() {
|
|
41540
|
+
try {
|
|
41541
|
+
this.span.end();
|
|
41542
|
+
}
|
|
41543
|
+
catch {
|
|
41544
|
+
// Ignore span termination errors
|
|
41545
|
+
}
|
|
41546
|
+
finally {
|
|
41547
|
+
if (this.traceToken !== undefined) {
|
|
41548
|
+
resetOtelTraceId(this.traceToken);
|
|
41549
|
+
this.traceToken = undefined;
|
|
41550
|
+
}
|
|
41551
|
+
if (this.spanToken !== undefined) {
|
|
41552
|
+
resetOtelSpanId(this.spanToken);
|
|
41553
|
+
this.spanToken = undefined;
|
|
41554
|
+
}
|
|
41555
|
+
}
|
|
41556
|
+
}
|
|
41557
|
+
}
|
|
41558
|
+
class OpenTelemetryTraceEmitter extends BaseTraceEmitter {
|
|
41559
|
+
constructor(options) {
|
|
41560
|
+
super();
|
|
41561
|
+
this.shutdownInvoked = false;
|
|
41562
|
+
const normalized = normalizeOpenTelemetryTraceEmitterOptions(options);
|
|
41563
|
+
this.otelApi = normalized.otelApi;
|
|
41564
|
+
this.tracer =
|
|
41565
|
+
normalized.tracer ?? this.otelApi.trace.getTracer(normalized.serviceName);
|
|
41566
|
+
this.lifecycle = normalized.lifecycle ?? null;
|
|
41567
|
+
this.authStrategy = normalized.authStrategy ?? null;
|
|
41568
|
+
}
|
|
41569
|
+
startSpan(name, options) {
|
|
41570
|
+
const attributes = normalizeAttributes(options?.attributes);
|
|
41571
|
+
const spanOptions = {};
|
|
41572
|
+
if (attributes) {
|
|
41573
|
+
spanOptions.attributes = attributes;
|
|
41574
|
+
}
|
|
41575
|
+
if (options?.links) {
|
|
41576
|
+
spanOptions.links = options.links;
|
|
41577
|
+
}
|
|
41578
|
+
const span = this.tracer.startSpan(name, spanOptions);
|
|
41579
|
+
const envelopeTraceId = options?.attributes?.['env.trace_id'];
|
|
41580
|
+
if (typeof envelopeTraceId === 'string') {
|
|
41581
|
+
this.applyEnvelopeTraceId(span, envelopeTraceId);
|
|
41582
|
+
}
|
|
41583
|
+
return new OpenTelemetrySpanScope(span, this.otelApi);
|
|
41584
|
+
}
|
|
41585
|
+
async flush() {
|
|
41586
|
+
if (this.lifecycle?.forceFlush) {
|
|
41587
|
+
try {
|
|
41588
|
+
await this.lifecycle.forceFlush();
|
|
41589
|
+
return;
|
|
41590
|
+
}
|
|
41591
|
+
catch {
|
|
41592
|
+
// fall through to global flush fallback
|
|
41593
|
+
}
|
|
41594
|
+
}
|
|
41595
|
+
try {
|
|
41596
|
+
const provider = this.otelApi.trace.getTracerProvider();
|
|
41597
|
+
if (provider && typeof provider.forceFlush === 'function') {
|
|
41598
|
+
await provider.forceFlush();
|
|
41599
|
+
}
|
|
41600
|
+
}
|
|
41601
|
+
catch {
|
|
41602
|
+
// Ignore flush errors
|
|
41603
|
+
}
|
|
41604
|
+
}
|
|
41605
|
+
async shutdown() {
|
|
41606
|
+
if (this.shutdownInvoked) {
|
|
41607
|
+
return;
|
|
41608
|
+
}
|
|
41609
|
+
this.shutdownInvoked = true;
|
|
41610
|
+
const cleanupTasks = [];
|
|
41611
|
+
const strategy = this.authStrategy;
|
|
41612
|
+
if (strategy) {
|
|
41613
|
+
this.authStrategy = null;
|
|
41614
|
+
cleanupTasks.push(strategy.cleanup().catch(() => {
|
|
41615
|
+
// Ignore auth cleanup failures
|
|
41616
|
+
}));
|
|
41617
|
+
}
|
|
41618
|
+
if (this.lifecycle?.shutdown) {
|
|
41619
|
+
try {
|
|
41620
|
+
await this.lifecycle.shutdown();
|
|
41621
|
+
this.lifecycle = null;
|
|
41622
|
+
await Promise.all(cleanupTasks);
|
|
41623
|
+
return;
|
|
41624
|
+
}
|
|
41625
|
+
catch {
|
|
41626
|
+
// fall through to global shutdown fallback
|
|
41627
|
+
this.lifecycle = null;
|
|
41628
|
+
}
|
|
41629
|
+
}
|
|
41630
|
+
try {
|
|
41631
|
+
const provider = this.otelApi.trace.getTracerProvider();
|
|
41632
|
+
if (provider && typeof provider.shutdown === 'function') {
|
|
41633
|
+
await provider.shutdown();
|
|
41634
|
+
}
|
|
41635
|
+
}
|
|
41636
|
+
catch {
|
|
41637
|
+
// Ignore shutdown errors
|
|
41638
|
+
}
|
|
41639
|
+
finally {
|
|
41640
|
+
if (cleanupTasks.length > 0) {
|
|
41641
|
+
await Promise.all(cleanupTasks);
|
|
41642
|
+
}
|
|
41643
|
+
}
|
|
41644
|
+
}
|
|
41645
|
+
applyEnvelopeTraceId(span, envelopeTraceId) {
|
|
41646
|
+
try {
|
|
41647
|
+
const targetTraceId = this.convertEnvTraceIdToOtel(envelopeTraceId);
|
|
41648
|
+
const internalSpan = span;
|
|
41649
|
+
if (internalSpan?._spanContext) {
|
|
41650
|
+
internalSpan._spanContext.traceId = targetTraceId;
|
|
41651
|
+
}
|
|
41652
|
+
}
|
|
41653
|
+
catch {
|
|
41654
|
+
// Ignore trace-id coercion errors
|
|
41655
|
+
}
|
|
41656
|
+
}
|
|
41657
|
+
convertEnvTraceIdToOtel(envTraceId) {
|
|
41658
|
+
const normalized = envTraceId.slice(0, 16).padEnd(16, '0');
|
|
41659
|
+
let hex = '';
|
|
41660
|
+
for (let i = 0; i < 16; i += 1) {
|
|
41661
|
+
const code = normalized.charCodeAt(i);
|
|
41662
|
+
const byte = Number.isNaN(code) ? 0 : code & 0xff;
|
|
41663
|
+
hex += byte.toString(16).padStart(2, '0');
|
|
41664
|
+
}
|
|
41665
|
+
return hex;
|
|
41666
|
+
}
|
|
41667
|
+
}
|
|
41668
|
+
function normalizeOpenTelemetryTraceEmitterOptions(input) {
|
|
41669
|
+
const source = (input ?? {});
|
|
41670
|
+
const serviceName = extractNonEmptyString$1(pickFirst$1(source, ['serviceName', 'service_name'])) ?? 'naylence-service';
|
|
41671
|
+
const tracer = pickFirst$1(source, ['tracer']);
|
|
41672
|
+
const otelApi = pickFirst$1(source, [
|
|
41673
|
+
'otelApi',
|
|
41674
|
+
'otel_api',
|
|
41675
|
+
]);
|
|
41676
|
+
if (!otelApi) {
|
|
41677
|
+
throw new Error('OpenTelemetryTraceEmitter requires OpenTelemetry API bindings. Provide otelApi via options.');
|
|
41678
|
+
}
|
|
41679
|
+
const lifecycle = pickFirst$1(source, [
|
|
41680
|
+
'lifecycle',
|
|
41681
|
+
'lifeCycle',
|
|
41682
|
+
'life_cycle',
|
|
41683
|
+
]) ?? null;
|
|
41684
|
+
const authStrategy = pickFirst$1(source, [
|
|
41685
|
+
'authStrategy',
|
|
41686
|
+
'auth_strategy',
|
|
41687
|
+
]) ?? null;
|
|
41688
|
+
return {
|
|
41689
|
+
serviceName,
|
|
41690
|
+
tracer,
|
|
41691
|
+
otelApi,
|
|
41692
|
+
lifecycle,
|
|
41693
|
+
authStrategy,
|
|
41694
|
+
};
|
|
41695
|
+
}
|
|
41696
|
+
function pickFirst$1(source, keys) {
|
|
41697
|
+
for (const key of keys) {
|
|
41698
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
41699
|
+
const value = source[key];
|
|
41700
|
+
if (value !== undefined) {
|
|
41701
|
+
return value;
|
|
41702
|
+
}
|
|
41703
|
+
}
|
|
41704
|
+
}
|
|
41705
|
+
return undefined;
|
|
41706
|
+
}
|
|
41707
|
+
function extractNonEmptyString$1(value) {
|
|
41708
|
+
if (typeof value === 'string') {
|
|
41709
|
+
const trimmed = value.trim();
|
|
41710
|
+
if (trimmed.length > 0) {
|
|
41711
|
+
return trimmed;
|
|
41712
|
+
}
|
|
41713
|
+
}
|
|
41714
|
+
return undefined;
|
|
41715
|
+
}
|
|
41716
|
+
function normalizeAttributeValue(value) {
|
|
41717
|
+
if (Array.isArray(value)) {
|
|
41718
|
+
return value.map((item) => String(normalizePrimitiveAttribute(item, true)));
|
|
41719
|
+
}
|
|
41720
|
+
return normalizePrimitiveAttribute(value, false);
|
|
41721
|
+
}
|
|
41722
|
+
function normalizePrimitiveAttribute(value, forceString) {
|
|
41723
|
+
if (!forceString) {
|
|
41724
|
+
if (typeof value === 'string' ||
|
|
41725
|
+
typeof value === 'number' ||
|
|
41726
|
+
typeof value === 'boolean') {
|
|
41727
|
+
return value;
|
|
41728
|
+
}
|
|
41729
|
+
if (value instanceof Date) {
|
|
41730
|
+
return value.toISOString();
|
|
41731
|
+
}
|
|
41732
|
+
}
|
|
41733
|
+
if (value instanceof Date) {
|
|
41734
|
+
return value.toISOString();
|
|
41735
|
+
}
|
|
41736
|
+
if (typeof value === 'boolean') {
|
|
41737
|
+
return value;
|
|
41738
|
+
}
|
|
41739
|
+
if (!forceString && typeof value === 'number') {
|
|
41740
|
+
return value;
|
|
41741
|
+
}
|
|
41742
|
+
return String(value);
|
|
41743
|
+
}
|
|
41744
|
+
function normalizeAttributes(source) {
|
|
41745
|
+
if (!source) {
|
|
41746
|
+
return undefined;
|
|
41747
|
+
}
|
|
41748
|
+
const entries = [];
|
|
41749
|
+
for (const [key, raw] of Object.entries(source)) {
|
|
41750
|
+
entries.push([key, normalizeAttributeValue(raw)]);
|
|
41751
|
+
}
|
|
41752
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
41753
|
+
}
|
|
41754
|
+
|
|
41755
|
+
var openTelemetryTraceEmitter = /*#__PURE__*/Object.freeze({
|
|
41756
|
+
__proto__: null,
|
|
41757
|
+
OpenTelemetryTraceEmitter: OpenTelemetryTraceEmitter
|
|
41758
|
+
});
|
|
41759
|
+
|
|
41760
|
+
const logger = getLogger('naylence.fame.telemetry.otel_setup');
|
|
41761
|
+
const stringFrom = (...codes) => String.fromCharCode(...codes);
|
|
41762
|
+
const OTEL_PREFIX = `${stringFrom(64, 111, 112, 101, 110, 116, 101, 108, 101, 109, 101, 116, 114, 121)}${stringFrom(47)}`;
|
|
41763
|
+
const OTEL_API_SPEC = `${OTEL_PREFIX}${stringFrom(97, 112, 105)}`;
|
|
41764
|
+
const OTEL_RESOURCES_SPEC = `${OTEL_PREFIX}${stringFrom(114, 101, 115, 111, 117, 114, 99, 101, 115)}`;
|
|
41765
|
+
const OTEL_TRACE_NODE_SPEC = `${OTEL_PREFIX}${stringFrom(115, 100, 107, 45, 116, 114, 97, 99, 101, 45, 110, 111, 100, 101)}`;
|
|
41766
|
+
const OTEL_TRACE_BASE_SPEC = `${OTEL_PREFIX}${stringFrom(115, 100, 107, 45, 116, 114, 97, 99, 101, 45, 98, 97, 115, 101)}`;
|
|
41767
|
+
const OTEL_EXPORTER_HTTP_SPEC = `${OTEL_PREFIX}${stringFrom(101, 120, 112, 111, 114, 116, 101, 114, 45, 116, 114, 97, 99, 101, 45, 111, 116, 108, 112, 45, 104, 116, 116, 112)}`;
|
|
41768
|
+
let registeredOtel = null;
|
|
41769
|
+
async function setupOtel(options) {
|
|
41770
|
+
const normalized = normalizeSetupOtelOptions(options);
|
|
41771
|
+
try {
|
|
41772
|
+
if (registeredOtel) {
|
|
41773
|
+
logger.debug('open_telemetry_reusing_provider', {
|
|
41774
|
+
service_name: normalized.serviceName,
|
|
41775
|
+
});
|
|
41776
|
+
return registeredOtel.control;
|
|
41777
|
+
}
|
|
41778
|
+
const [apiModule, resourcesModule, nodeModule, traceBaseModule] = await Promise.all([
|
|
41779
|
+
import(OTEL_API_SPEC),
|
|
41780
|
+
import(OTEL_RESOURCES_SPEC),
|
|
41781
|
+
import(OTEL_TRACE_NODE_SPEC),
|
|
41782
|
+
import(OTEL_TRACE_BASE_SPEC),
|
|
41783
|
+
]);
|
|
41784
|
+
const { trace } = apiModule;
|
|
41785
|
+
const { defaultResource, resourceFromAttributes } = resourcesModule;
|
|
41786
|
+
const { NodeTracerProvider } = nodeModule;
|
|
41787
|
+
const { BatchSpanProcessor, ConsoleSpanExporter, ParentBasedSampler, AlwaysOnSampler, AlwaysOffSampler, TraceIdRatioBasedSampler, } = traceBaseModule;
|
|
41788
|
+
const currentProvider = trace.getTracerProvider();
|
|
41789
|
+
if (currentProvider && currentProvider instanceof NodeTracerProvider) {
|
|
41790
|
+
return null;
|
|
41791
|
+
}
|
|
41792
|
+
if (currentProvider &&
|
|
41793
|
+
currentProvider.constructor?.name === 'NodeTracerProvider') {
|
|
41794
|
+
logger.debug('open_telemetry_existing_node_provider', {
|
|
41795
|
+
service_name: normalized.serviceName,
|
|
41796
|
+
});
|
|
41797
|
+
return null;
|
|
41798
|
+
}
|
|
41799
|
+
logger.debug('open_telemetry_initializing', {
|
|
41800
|
+
service_name: normalized.serviceName,
|
|
41801
|
+
endpoint: normalized.endpoint ?? null,
|
|
41802
|
+
environment: normalized.environment ?? null,
|
|
41803
|
+
sampler: normalized.sampler ?? null,
|
|
41804
|
+
headers_present: Boolean(normalized.headers && Object.keys(normalized.headers).length),
|
|
41805
|
+
});
|
|
41806
|
+
const sampler = resolveSampler(normalized.sampler, {
|
|
41807
|
+
ParentBasedSampler,
|
|
41808
|
+
AlwaysOnSampler,
|
|
41809
|
+
AlwaysOffSampler,
|
|
41810
|
+
TraceIdRatioBasedSampler,
|
|
41811
|
+
});
|
|
41812
|
+
const baseResource = defaultResource();
|
|
41813
|
+
const mergedResource = resourceFromAttributes({
|
|
41814
|
+
'service.name': normalized.serviceName,
|
|
41815
|
+
'service.instance.id': generateInstanceId(),
|
|
41816
|
+
'deployment.environment': normalized.environment ?? 'dev',
|
|
41817
|
+
});
|
|
41818
|
+
const resource = baseResource.merge(mergedResource);
|
|
41819
|
+
const exporter = await resolveExporter(normalized.endpoint ?? undefined, normalized.headers, ConsoleSpanExporter);
|
|
41820
|
+
const spanProcessor = new BatchSpanProcessor(exporter);
|
|
41821
|
+
const provider = new NodeTracerProvider({
|
|
41822
|
+
resource,
|
|
41823
|
+
sampler,
|
|
41824
|
+
spanProcessors: [spanProcessor],
|
|
41825
|
+
});
|
|
41826
|
+
provider.register();
|
|
41827
|
+
logger.debug('open_telemetry_initialized', {
|
|
41828
|
+
service_name: normalized.serviceName,
|
|
41829
|
+
exporter: exporter.constructor?.name ?? 'unknown_exporter',
|
|
41830
|
+
});
|
|
41831
|
+
const control = {
|
|
41832
|
+
forceFlush: async () => {
|
|
41833
|
+
try {
|
|
41834
|
+
await provider.forceFlush();
|
|
41835
|
+
}
|
|
41836
|
+
catch (flushError) {
|
|
41837
|
+
logger.warning('open_telemetry_force_flush_failed', {
|
|
41838
|
+
error: flushError instanceof Error
|
|
41839
|
+
? flushError.message
|
|
41840
|
+
: String(flushError),
|
|
41841
|
+
});
|
|
41842
|
+
}
|
|
41843
|
+
},
|
|
41844
|
+
shutdown: async () => {
|
|
41845
|
+
try {
|
|
41846
|
+
await provider.shutdown();
|
|
41847
|
+
}
|
|
41848
|
+
catch (shutdownError) {
|
|
41849
|
+
logger.warning('open_telemetry_shutdown_failed', {
|
|
41850
|
+
error: shutdownError instanceof Error
|
|
41851
|
+
? shutdownError.message
|
|
41852
|
+
: String(shutdownError),
|
|
41853
|
+
});
|
|
41854
|
+
}
|
|
41855
|
+
finally {
|
|
41856
|
+
registeredOtel = null;
|
|
41857
|
+
}
|
|
41858
|
+
},
|
|
41859
|
+
};
|
|
41860
|
+
registeredOtel = {
|
|
41861
|
+
provider,
|
|
41862
|
+
control,
|
|
41863
|
+
};
|
|
41864
|
+
return control;
|
|
41865
|
+
}
|
|
41866
|
+
catch (error) {
|
|
41867
|
+
logger.error('open_telemetry_not_available', {
|
|
41868
|
+
error: error instanceof Error ? error.message : String(error),
|
|
41869
|
+
stack: error instanceof Error && error.stack ? error.stack : undefined,
|
|
41870
|
+
});
|
|
41871
|
+
return null;
|
|
41872
|
+
}
|
|
41873
|
+
}
|
|
41874
|
+
function normalizeSetupOtelOptions(options) {
|
|
41875
|
+
const source = (options ?? {});
|
|
41876
|
+
const serviceName = extractNonEmptyString(pickFirst(source, ['serviceName', 'service_name'])) ??
|
|
41877
|
+
'naylence-service';
|
|
41878
|
+
const endpoint = extractNonEmptyString(pickFirst(source, ['endpoint', 'otlpEndpoint', 'otlp_endpoint'])) ?? null;
|
|
41879
|
+
const environment = extractNonEmptyString(pickFirst(source, [
|
|
41880
|
+
'environment',
|
|
41881
|
+
'deploymentEnvironment',
|
|
41882
|
+
'deployment_environment',
|
|
41883
|
+
])) ?? null;
|
|
41884
|
+
const sampler = extractNonEmptyString(pickFirst(source, ['sampler', 'samplingStrategy', 'sampling_strategy'])) ?? null;
|
|
41885
|
+
const headers = extractHeaders(pickFirst(source, ['headers', 'otlpHeaders', 'otlp_headers']));
|
|
41886
|
+
return {
|
|
41887
|
+
serviceName,
|
|
41888
|
+
endpoint,
|
|
41889
|
+
environment,
|
|
41890
|
+
sampler,
|
|
41891
|
+
headers: headers ?? undefined,
|
|
41892
|
+
};
|
|
41893
|
+
}
|
|
41894
|
+
function pickFirst(source, keys) {
|
|
41895
|
+
for (const key of keys) {
|
|
41896
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
41897
|
+
const value = source[key];
|
|
41898
|
+
if (value !== undefined) {
|
|
41899
|
+
return value;
|
|
41900
|
+
}
|
|
41901
|
+
}
|
|
41902
|
+
}
|
|
41903
|
+
return undefined;
|
|
41904
|
+
}
|
|
41905
|
+
function extractNonEmptyString(value) {
|
|
41906
|
+
if (typeof value === 'string') {
|
|
41907
|
+
const trimmed = value.trim();
|
|
41908
|
+
if (trimmed.length > 0) {
|
|
41909
|
+
return trimmed;
|
|
41910
|
+
}
|
|
41911
|
+
}
|
|
41912
|
+
return undefined;
|
|
41913
|
+
}
|
|
41914
|
+
function extractHeaders(value) {
|
|
41915
|
+
if (!value || typeof value !== 'object') {
|
|
41916
|
+
return null;
|
|
41917
|
+
}
|
|
41918
|
+
const headers = {};
|
|
41919
|
+
for (const [key, raw] of Object.entries(value)) {
|
|
41920
|
+
if (typeof raw === 'string') {
|
|
41921
|
+
headers[key] = raw;
|
|
41922
|
+
}
|
|
41923
|
+
}
|
|
41924
|
+
return Object.keys(headers).length > 0 ? headers : null;
|
|
41925
|
+
}
|
|
41926
|
+
function generateInstanceId() {
|
|
41927
|
+
try {
|
|
41928
|
+
if (typeof crypto !== 'undefined' &&
|
|
41929
|
+
typeof crypto.randomUUID === 'function') {
|
|
41930
|
+
return crypto.randomUUID().replace(/-/g, '');
|
|
41931
|
+
}
|
|
41932
|
+
}
|
|
41933
|
+
catch {
|
|
41934
|
+
// Ignore crypto availability errors
|
|
41935
|
+
}
|
|
41936
|
+
const random = Math.random().toString(16).slice(2);
|
|
41937
|
+
return random.padEnd(32, '0').slice(0, 32);
|
|
41938
|
+
}
|
|
41939
|
+
function resolveSampler(samplerSetting, samplers) {
|
|
41940
|
+
const normalized = (samplerSetting ?? 'parentbased_always_on').toLowerCase();
|
|
41941
|
+
let base;
|
|
41942
|
+
if (normalized === 'always_off') {
|
|
41943
|
+
base = new samplers.AlwaysOffSampler();
|
|
41944
|
+
}
|
|
41945
|
+
else if (normalized === 'always_on' ||
|
|
41946
|
+
normalized === 'parentbased_always_on') {
|
|
41947
|
+
base = new samplers.AlwaysOnSampler();
|
|
41948
|
+
}
|
|
41949
|
+
else if (normalized.startsWith('ratio:')) {
|
|
41950
|
+
const ratioValue = Number.parseFloat(normalized.slice('ratio:'.length));
|
|
41951
|
+
const ratio = Number.isFinite(ratioValue)
|
|
41952
|
+
? Math.min(Math.max(ratioValue, 0), 1)
|
|
41953
|
+
: 1;
|
|
41954
|
+
base = new samplers.TraceIdRatioBasedSampler(ratio);
|
|
41955
|
+
}
|
|
41956
|
+
else {
|
|
41957
|
+
base = new samplers.AlwaysOnSampler();
|
|
41958
|
+
}
|
|
41959
|
+
return new samplers.ParentBasedSampler({ root: base });
|
|
41960
|
+
}
|
|
41961
|
+
async function resolveExporter(endpoint, headers, ConsoleSpanExporter) {
|
|
41962
|
+
if (endpoint) {
|
|
41963
|
+
try {
|
|
41964
|
+
const exporterModule = await import(OTEL_EXPORTER_HTTP_SPEC);
|
|
41965
|
+
if ('OTLPTraceExporter' in exporterModule) {
|
|
41966
|
+
const { OTLPTraceExporter } = exporterModule;
|
|
41967
|
+
const exporterOptions = {
|
|
41968
|
+
url: endpoint,
|
|
41969
|
+
};
|
|
41970
|
+
if (headers && Object.keys(headers).length > 0) {
|
|
41971
|
+
exporterOptions.headers = headers;
|
|
41972
|
+
}
|
|
41973
|
+
logger.debug('open_telemetry_using_otlp_http_exporter', {
|
|
41974
|
+
endpoint,
|
|
41975
|
+
headers_present: Boolean(headers && Object.keys(headers).length),
|
|
41976
|
+
});
|
|
41977
|
+
return new OTLPTraceExporter(exporterOptions);
|
|
41978
|
+
}
|
|
41979
|
+
}
|
|
41980
|
+
catch (error) {
|
|
41981
|
+
logger.error('open_telemetry_exporter_not_available', {
|
|
41982
|
+
error: error instanceof Error ? error.message : String(error),
|
|
41983
|
+
});
|
|
41984
|
+
}
|
|
41985
|
+
}
|
|
41986
|
+
logger.warning('open_telemetry_falling_back_to_console_exporter');
|
|
41987
|
+
return new ConsoleSpanExporter();
|
|
41988
|
+
}
|
|
41989
|
+
|
|
41990
|
+
var otelSetup = /*#__PURE__*/Object.freeze({
|
|
41991
|
+
__proto__: null,
|
|
41992
|
+
setupOtel: setupOtel
|
|
41993
|
+
});
|
|
41994
|
+
|
|
41969
41995
|
class WebSocketTransportProvisioner {
|
|
41970
41996
|
constructor(options) {
|
|
41971
41997
|
this.url = options.url;
|