@naylence/runtime 0.3.6 → 0.3.7
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 +220 -172
- package/dist/browser/index.mjs +220 -173
- package/dist/cjs/_env-shim.js +2 -1
- package/dist/cjs/naylence/fame/config/extended-fame-config.js +2 -1
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector-factory.js +12 -4
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +14 -6
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +11 -7
- package/dist/cjs/naylence/fame/connector/index.js +2 -1
- package/dist/cjs/naylence/fame/connector/inpage-connector-factory.js +2 -1
- package/dist/cjs/naylence/fame/connector/inpage-connector.js +13 -6
- package/dist/cjs/naylence/fame/connector/inpage-listener-factory.js +4 -4
- package/dist/cjs/naylence/fame/connector/inpage-listener.js +5 -2
- package/dist/cjs/naylence/fame/delivery/default-delivery-tracker.js +4 -62
- package/dist/cjs/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
- package/dist/cjs/naylence/fame/grants/inpage-connection-grant.js +4 -2
- package/dist/cjs/naylence/fame/http/oauth2-token-router.js +9 -9
- package/dist/cjs/naylence/fame/node/admission/default-node-attach-client.js +34 -5
- package/dist/cjs/naylence/fame/node/upstream-session-manager.js +40 -8
- package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
- package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
- package/dist/cjs/naylence/fame/security/default-security-manager.js +2 -1
- package/dist/cjs/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +2 -2
- package/dist/cjs/naylence/fame/security/trust-store/trust-store-provider-factory.js +2 -2
- package/dist/cjs/naylence/fame/util/index.js +3 -1
- package/dist/cjs/node.js +4 -1
- package/dist/cjs/version.js +2 -2
- package/dist/esm/_env-shim.js +2 -1
- package/dist/esm/browser.js +2 -2
- package/dist/esm/naylence/fame/config/extended-fame-config.js +2 -1
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector-factory.js +12 -4
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +14 -6
- package/dist/esm/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
- package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +11 -7
- package/dist/esm/naylence/fame/connector/index.js +2 -2
- package/dist/esm/naylence/fame/connector/inpage-connector-factory.js +2 -1
- package/dist/esm/naylence/fame/connector/inpage-connector.js +13 -6
- package/dist/esm/naylence/fame/connector/inpage-listener-factory.js +4 -4
- package/dist/esm/naylence/fame/connector/inpage-listener.js +5 -2
- package/dist/esm/naylence/fame/delivery/default-delivery-tracker.js +4 -62
- package/dist/esm/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
- package/dist/esm/naylence/fame/grants/inpage-connection-grant.js +4 -2
- package/dist/esm/naylence/fame/http/oauth2-token-router.js +9 -9
- package/dist/esm/naylence/fame/node/admission/default-node-attach-client.js +34 -5
- package/dist/esm/naylence/fame/node/upstream-session-manager.js +40 -8
- package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
- package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
- package/dist/esm/naylence/fame/security/default-security-manager.js +2 -1
- package/dist/esm/naylence/fame/security/index.js +1 -1
- package/dist/esm/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +3 -3
- package/dist/esm/naylence/fame/security/trust-store/trust-store-provider-factory.js +3 -3
- package/dist/esm/naylence/fame/util/index.js +1 -0
- package/dist/esm/node.js +2 -1
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +218 -171
- package/dist/node/index.mjs +218 -172
- package/dist/node/node.cjs +184 -136
- package/dist/node/node.mjs +183 -137
- package/dist/types/browser.d.ts +2 -2
- package/dist/types/naylence/fame/connector/broadcast-channel-connector-factory.d.ts +1 -0
- package/dist/types/naylence/fame/connector/index.d.ts +3 -3
- package/dist/types/naylence/fame/delivery/default-delivery-tracker.d.ts +0 -6
- package/dist/types/naylence/fame/node/admission/default-node-attach-client.d.ts +1 -0
- package/dist/types/naylence/fame/security/index.d.ts +1 -1
- package/dist/types/naylence/fame/security/trust-store/noop-trust-store-provider-factory.d.ts +3 -3
- package/dist/types/naylence/fame/security/trust-store/trust-store-provider-factory.d.ts +4 -4
- package/dist/types/naylence/fame/security/trust-store/trust-store-provider.d.ts +5 -5
- package/dist/types/naylence/fame/util/index.d.ts +1 -0
- package/dist/types/node.d.ts +2 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/node.cjs
CHANGED
|
@@ -5563,12 +5563,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5563
5563
|
}
|
|
5564
5564
|
|
|
5565
5565
|
// This file is auto-generated during build - do not edit manually
|
|
5566
|
-
// Generated from package.json version: 0.3.
|
|
5566
|
+
// Generated from package.json version: 0.3.7
|
|
5567
5567
|
/**
|
|
5568
5568
|
* The package version, injected at build time.
|
|
5569
5569
|
* @internal
|
|
5570
5570
|
*/
|
|
5571
|
-
const VERSION = '0.3.
|
|
5571
|
+
const VERSION = '0.3.7';
|
|
5572
5572
|
|
|
5573
5573
|
/**
|
|
5574
5574
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -9727,9 +9727,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
9727
9727
|
this.ackDoneSince = new Map();
|
|
9728
9728
|
this.replyDoneSince = new Map();
|
|
9729
9729
|
this.pendingAckDispatches = new Set();
|
|
9730
|
-
this.recentlyHandled = new Map();
|
|
9731
|
-
this.recentlyHandledOrder = [];
|
|
9732
|
-
this.recentlyHandledTtlMs = 60000;
|
|
9733
9730
|
this.isPreparingToStop = false;
|
|
9734
9731
|
this.shutdownRequestedAtMs = null;
|
|
9735
9732
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -9965,22 +9962,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
9965
9962
|
}
|
|
9966
9963
|
}
|
|
9967
9964
|
else {
|
|
9968
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
9969
|
-
if (wasRecentlyHandled) {
|
|
9970
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
9971
|
-
envp_id: envelope.id,
|
|
9972
|
-
});
|
|
9973
|
-
return new TrackedEnvelope({
|
|
9974
|
-
timeoutAtMs: 0,
|
|
9975
|
-
overallTimeoutAtMs: 0,
|
|
9976
|
-
expectedResponseType: envelope.rtype ?? core.FameResponseType.NONE,
|
|
9977
|
-
createdAtMs: Date.now(),
|
|
9978
|
-
status: EnvelopeStatus.HANDLED,
|
|
9979
|
-
mailboxType: MailboxType.INBOX,
|
|
9980
|
-
originalEnvelope: envelope,
|
|
9981
|
-
serviceName: inboxName,
|
|
9982
|
-
});
|
|
9983
|
-
}
|
|
9984
9965
|
tracked = new TrackedEnvelope({
|
|
9985
9966
|
timeoutAtMs: 0,
|
|
9986
9967
|
overallTimeoutAtMs: 0,
|
|
@@ -10002,12 +9983,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10002
9983
|
async onEnvelopeHandled(envelope) {
|
|
10003
9984
|
const inbox = this.ensureInbox();
|
|
10004
9985
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
9986
|
+
// Delete the envelope from inbox to prevent growth
|
|
10005
9987
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
10006
|
-
await this.lock.runExclusive(async () => {
|
|
10007
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
10008
|
-
});
|
|
10009
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
10010
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
10011
9988
|
}
|
|
10012
9989
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
10013
9990
|
void context;
|
|
@@ -10226,9 +10203,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10226
10203
|
});
|
|
10227
10204
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
10228
10205
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10206
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
10207
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
10208
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
10232
10209
|
for (const handler of this.eventHandlers) {
|
|
10233
10210
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
10234
10211
|
}
|
|
@@ -10378,8 +10355,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10378
10355
|
}
|
|
10379
10356
|
this.streamDone.clear();
|
|
10380
10357
|
this.correlationToEnvelope.clear();
|
|
10381
|
-
this.recentlyHandled.clear();
|
|
10382
|
-
this.recentlyHandledOrder.length = 0;
|
|
10383
10358
|
return values;
|
|
10384
10359
|
});
|
|
10385
10360
|
for (const timer of timers) {
|
|
@@ -10961,39 +10936,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10961
10936
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
10962
10937
|
}
|
|
10963
10938
|
}
|
|
10964
|
-
markRecentlyHandled(envelopeId) {
|
|
10965
|
-
const now = Date.now();
|
|
10966
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
10967
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
10968
|
-
this.trimRecentlyHandled(now);
|
|
10969
|
-
}
|
|
10970
|
-
wasRecentlyHandled(envelopeId) {
|
|
10971
|
-
const now = Date.now();
|
|
10972
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
10973
|
-
if (timestamp === undefined) {
|
|
10974
|
-
return false;
|
|
10975
|
-
}
|
|
10976
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
10977
|
-
this.recentlyHandled.delete(envelopeId);
|
|
10978
|
-
return false;
|
|
10979
|
-
}
|
|
10980
|
-
return true;
|
|
10981
|
-
}
|
|
10982
|
-
trimRecentlyHandled(now) {
|
|
10983
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
10984
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
10985
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
10986
|
-
if (timestamp === undefined) {
|
|
10987
|
-
this.recentlyHandledOrder.shift();
|
|
10988
|
-
continue;
|
|
10989
|
-
}
|
|
10990
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
10991
|
-
break;
|
|
10992
|
-
}
|
|
10993
|
-
this.recentlyHandled.delete(candidate);
|
|
10994
|
-
this.recentlyHandledOrder.shift();
|
|
10995
|
-
}
|
|
10996
|
-
}
|
|
10997
10939
|
getShutdownRetryDeferDelay(nowMs) {
|
|
10998
10940
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
10999
10941
|
return null;
|
|
@@ -11570,7 +11512,8 @@ const ensureBroadcastEnvironment = () => {
|
|
|
11570
11512
|
};
|
|
11571
11513
|
let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
11572
11514
|
static generateConnectorId() {
|
|
11573
|
-
const globalCrypto = globalThis
|
|
11515
|
+
const globalCrypto = globalThis
|
|
11516
|
+
.crypto;
|
|
11574
11517
|
if (globalCrypto?.randomUUID) {
|
|
11575
11518
|
return globalCrypto.randomUUID();
|
|
11576
11519
|
}
|
|
@@ -11625,7 +11568,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11625
11568
|
this.listenerRegistered = false;
|
|
11626
11569
|
this.visibilityChangeListenerRegistered = false;
|
|
11627
11570
|
this.channelName =
|
|
11628
|
-
typeof config.channelName === 'string' &&
|
|
11571
|
+
typeof config.channelName === 'string' &&
|
|
11572
|
+
config.channelName.trim().length > 0
|
|
11629
11573
|
? config.channelName.trim()
|
|
11630
11574
|
: DEFAULT_CHANNEL$7;
|
|
11631
11575
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -11649,6 +11593,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11649
11593
|
local_node_id: this.localNodeId,
|
|
11650
11594
|
target_node_id: this.targetNodeId ?? null,
|
|
11651
11595
|
inbox_capacity: preferredCapacity,
|
|
11596
|
+
passive: config.passive ?? false,
|
|
11652
11597
|
timestamp: new Date().toISOString(),
|
|
11653
11598
|
});
|
|
11654
11599
|
this.onMsg = (event) => {
|
|
@@ -11666,7 +11611,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11666
11611
|
channel: this.channelName,
|
|
11667
11612
|
connector_id: this.connectorId,
|
|
11668
11613
|
message_type: message && typeof message === 'object'
|
|
11669
|
-
? message.constructor
|
|
11614
|
+
? (message.constructor
|
|
11615
|
+
?.name ?? typeof message)
|
|
11670
11616
|
: typeof message,
|
|
11671
11617
|
has_sender_id: Boolean(message?.senderId),
|
|
11672
11618
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -11896,7 +11842,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11896
11842
|
timestamp: new Date().toISOString(),
|
|
11897
11843
|
});
|
|
11898
11844
|
}
|
|
11899
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
11845
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
11846
|
+
this.visibilityChangeHandler &&
|
|
11847
|
+
typeof document !== 'undefined') {
|
|
11900
11848
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
11901
11849
|
this.visibilityChangeListenerRegistered = false;
|
|
11902
11850
|
this.visibilityChangeHandler = undefined;
|
|
@@ -11924,7 +11872,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11924
11872
|
return rawOrEnvelope;
|
|
11925
11873
|
}
|
|
11926
11874
|
_isWildcardTarget() {
|
|
11927
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
11875
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
11928
11876
|
}
|
|
11929
11877
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
11930
11878
|
if (this._isWildcardTarget()) {
|
|
@@ -11944,7 +11892,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11944
11892
|
return true;
|
|
11945
11893
|
}
|
|
11946
11894
|
const expectedSender = this.targetNodeId;
|
|
11947
|
-
if (expectedSender &&
|
|
11895
|
+
if (expectedSender &&
|
|
11896
|
+
expectedSender !== '*' &&
|
|
11897
|
+
senderNodeId !== expectedSender) {
|
|
11948
11898
|
logger$10.debug('broadcast_channel_message_rejected', {
|
|
11949
11899
|
channel: this.channelName,
|
|
11950
11900
|
connector_id: this.connectorId,
|
|
@@ -12118,14 +12068,16 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
12118
12068
|
type,
|
|
12119
12069
|
purpose,
|
|
12120
12070
|
};
|
|
12121
|
-
const channelValue = candidate.channelName ??
|
|
12071
|
+
const channelValue = candidate.channelName ??
|
|
12072
|
+
candidate['channel_name'];
|
|
12122
12073
|
if (channelValue !== undefined) {
|
|
12123
12074
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
12124
12075
|
throw new TypeError('BroadcastChannelConnectionGrant "channelName" must be a non-empty string when provided');
|
|
12125
12076
|
}
|
|
12126
12077
|
result.channelName = channelValue.trim();
|
|
12127
12078
|
}
|
|
12128
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
12079
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
12080
|
+
candidate['inbox_capacity'];
|
|
12129
12081
|
if (inboxValue !== undefined) {
|
|
12130
12082
|
if (typeof inboxValue !== 'number' ||
|
|
12131
12083
|
!Number.isFinite(inboxValue) ||
|
|
@@ -12134,7 +12086,8 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
12134
12086
|
}
|
|
12135
12087
|
result.inboxCapacity = Math.floor(inboxValue);
|
|
12136
12088
|
}
|
|
12137
|
-
const windowValue = candidate.initialWindow ??
|
|
12089
|
+
const windowValue = candidate.initialWindow ??
|
|
12090
|
+
candidate['initial_window'];
|
|
12138
12091
|
if (windowValue !== undefined) {
|
|
12139
12092
|
if (typeof windowValue !== 'number' ||
|
|
12140
12093
|
!Number.isFinite(windowValue) ||
|
|
@@ -12471,25 +12424,56 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12471
12424
|
await connector.start(this.wrappedHandler);
|
|
12472
12425
|
this.connector = connector;
|
|
12473
12426
|
const callbackGrants = this.node.gatherSupportedCallbackGrants();
|
|
12427
|
+
logger$$.debug('callback_grants_before_augmentation', {
|
|
12428
|
+
count: callbackGrants.length,
|
|
12429
|
+
types: callbackGrants.map((g) => g.type),
|
|
12430
|
+
});
|
|
12431
|
+
// Check if we should create a broadcast callback grant before processing connection grants
|
|
12432
|
+
// This prevents adding duplicate broadcast grants
|
|
12433
|
+
const shouldAddBroadcastGrant = this.shouldAdvertiseBroadcastGrant(grant, callbackGrants);
|
|
12434
|
+
const broadcastCallbackGrant = shouldAddBroadcastGrant
|
|
12435
|
+
? this.createBroadcastCallbackGrant(grant)
|
|
12436
|
+
: null;
|
|
12437
|
+
logger$$.debug('broadcast_callback_grant_check', {
|
|
12438
|
+
should_add: shouldAddBroadcastGrant,
|
|
12439
|
+
grant_created: !!broadcastCallbackGrant,
|
|
12440
|
+
});
|
|
12474
12441
|
// Include admission client's connection grants as callback grants
|
|
12475
12442
|
// This ensures DirectAdmissionClient grants are available for grant selection
|
|
12476
|
-
if (welcome.frame.connectionGrants &&
|
|
12443
|
+
if (welcome.frame.connectionGrants &&
|
|
12444
|
+
Array.isArray(welcome.frame.connectionGrants)) {
|
|
12477
12445
|
for (const grant of welcome.frame.connectionGrants) {
|
|
12478
12446
|
if (grant && typeof grant === 'object') {
|
|
12479
12447
|
// Avoid duplicates by checking if grant already exists
|
|
12480
|
-
const isDuplicate = callbackGrants.some(existing => JSON.stringify(existing) === JSON.stringify(grant));
|
|
12448
|
+
const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
|
|
12481
12449
|
if (!isDuplicate) {
|
|
12482
12450
|
callbackGrants.push(grant);
|
|
12451
|
+
logger$$.debug('added_connection_grant_as_callback', {
|
|
12452
|
+
type: grant.type,
|
|
12453
|
+
});
|
|
12454
|
+
}
|
|
12455
|
+
else {
|
|
12456
|
+
logger$$.debug('skipped_duplicate_connection_grant', {
|
|
12457
|
+
type: grant.type,
|
|
12458
|
+
});
|
|
12483
12459
|
}
|
|
12484
12460
|
}
|
|
12485
12461
|
}
|
|
12486
12462
|
}
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12490
|
-
|
|
12491
|
-
|
|
12463
|
+
// Add broadcast grant after connection grants to ensure we don't duplicate
|
|
12464
|
+
// any broadcast grants that may have been in connectionGrants
|
|
12465
|
+
if (broadcastCallbackGrant &&
|
|
12466
|
+
this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
|
|
12467
|
+
callbackGrants.push(broadcastCallbackGrant);
|
|
12468
|
+
logger$$.debug('added_broadcast_callback_grant');
|
|
12492
12469
|
}
|
|
12470
|
+
else if (broadcastCallbackGrant) {
|
|
12471
|
+
logger$$.debug('skipped_duplicate_broadcast_callback_grant');
|
|
12472
|
+
}
|
|
12473
|
+
logger$$.debug('callback_grants_after_augmentation', {
|
|
12474
|
+
count: callbackGrants.length,
|
|
12475
|
+
types: callbackGrants.map((g) => g.type),
|
|
12476
|
+
});
|
|
12493
12477
|
const attachInfo = await this.attachClient.attach(this.node, this.outboundOriginType, connector, welcome.frame, this.wrappedHandler, this.getKeys() ?? undefined, callbackGrants);
|
|
12494
12478
|
this.targetSystemId = attachInfo.targetSystemId ?? null;
|
|
12495
12479
|
if (this.targetSystemId) {
|
|
@@ -12730,7 +12714,8 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12730
12714
|
continue;
|
|
12731
12715
|
}
|
|
12732
12716
|
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
12733
|
-
if (previousState === core.ConnectorState.PAUSED &&
|
|
12717
|
+
if (previousState === core.ConnectorState.PAUSED &&
|
|
12718
|
+
currentState === core.ConnectorState.STARTED) {
|
|
12734
12719
|
logger$$.debug('connector_just_resumed_resetting_ack_time', {
|
|
12735
12720
|
previous_state: previousState,
|
|
12736
12721
|
current_state: currentState,
|
|
@@ -14287,15 +14272,30 @@ class DefaultNodeAttachClient {
|
|
|
14287
14272
|
constructor(options = {}) {
|
|
14288
14273
|
this.buffer = [];
|
|
14289
14274
|
this.inHandshake = false;
|
|
14275
|
+
this.expectedSystemId = null;
|
|
14290
14276
|
this.timeoutMs = options.timeoutMs ?? 10000;
|
|
14291
14277
|
this.attachmentKeyValidator = options.attachmentKeyValidator;
|
|
14292
14278
|
this.replicaStickinessManager = options.replicaStickinessManager ?? null;
|
|
14293
14279
|
}
|
|
14294
14280
|
async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
|
|
14295
14281
|
this.inHandshake = true;
|
|
14282
|
+
this.expectedSystemId = welcomeFrame.systemId;
|
|
14296
14283
|
const interimHandler = async (envelope, context) => {
|
|
14297
14284
|
if (this.inHandshake) {
|
|
14298
|
-
|
|
14285
|
+
// Filter: only buffer frames related to our systemId or frames without systemId info
|
|
14286
|
+
const frameSystemId = envelope.frame
|
|
14287
|
+
?.systemId;
|
|
14288
|
+
if (!frameSystemId || frameSystemId === this.expectedSystemId) {
|
|
14289
|
+
this.buffer.push(envelope);
|
|
14290
|
+
}
|
|
14291
|
+
else {
|
|
14292
|
+
// Silently ignore frames from other agents during concurrent handshakes
|
|
14293
|
+
logger$Y.debug('handshake_ignoring_frame_from_different_system', {
|
|
14294
|
+
frame_type: envelope.frame.type,
|
|
14295
|
+
frame_system_id: frameSystemId,
|
|
14296
|
+
expected_system_id: this.expectedSystemId,
|
|
14297
|
+
});
|
|
14298
|
+
}
|
|
14299
14299
|
return null;
|
|
14300
14300
|
}
|
|
14301
14301
|
return finalHandler(envelope, context);
|
|
@@ -14422,6 +14422,7 @@ class DefaultNodeAttachClient {
|
|
|
14422
14422
|
parent_id: ackFrame.targetSystemId,
|
|
14423
14423
|
});
|
|
14424
14424
|
this.inHandshake = false;
|
|
14425
|
+
this.expectedSystemId = null;
|
|
14425
14426
|
await connector.replaceHandler(finalHandler);
|
|
14426
14427
|
while (this.buffer.length > 0) {
|
|
14427
14428
|
const bufferedEnvelope = this.buffer.shift();
|
|
@@ -14479,7 +14480,8 @@ class DefaultNodeAttachClient {
|
|
|
14479
14480
|
const deadline = Date.now() + this.timeoutMs;
|
|
14480
14481
|
while (Date.now() < deadline) {
|
|
14481
14482
|
// Allow both STARTED and PAUSED states (PAUSED = tab hidden but connection alive)
|
|
14482
|
-
if (connector.state !== core.ConnectorState.STARTED &&
|
|
14483
|
+
if (connector.state !== core.ConnectorState.STARTED &&
|
|
14484
|
+
connector.state !== core.ConnectorState.PAUSED) {
|
|
14483
14485
|
let errorMessage = 'Connector closed while waiting for NodeAttachAck';
|
|
14484
14486
|
if (connector.closeCode !== undefined) {
|
|
14485
14487
|
errorMessage += ` (code=${connector.closeCode}`;
|
|
@@ -14498,9 +14500,21 @@ class DefaultNodeAttachClient {
|
|
|
14498
14500
|
if (envelope.frame.type === 'NodeAttachAck') {
|
|
14499
14501
|
return envelope;
|
|
14500
14502
|
}
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14503
|
+
// NodeAttach frames during handshake are expected in multi-agent scenarios
|
|
14504
|
+
// where multiple agents attach concurrently to the same channel
|
|
14505
|
+
if (envelope.frame.type === 'NodeAttach') {
|
|
14506
|
+
logger$Y.debug('handshake_ignoring_concurrent_attach', {
|
|
14507
|
+
frame_type: envelope.frame.type,
|
|
14508
|
+
frame_system_id: envelope.frame?.systemId ??
|
|
14509
|
+
'unknown',
|
|
14510
|
+
});
|
|
14511
|
+
}
|
|
14512
|
+
else {
|
|
14513
|
+
// Other unexpected frames are still logged as errors
|
|
14514
|
+
logger$Y.error('unexpected_frame_during_handshake', {
|
|
14515
|
+
frame_type: envelope.frame.type,
|
|
14516
|
+
});
|
|
14517
|
+
}
|
|
14504
14518
|
}
|
|
14505
14519
|
await delay(HANDSHAKE_POLL_INTERVAL_MS);
|
|
14506
14520
|
}
|
|
@@ -15219,7 +15233,8 @@ function createFsShim() {
|
|
|
15219
15233
|
else if (options &&
|
|
15220
15234
|
typeof options === 'object' &&
|
|
15221
15235
|
'encoding' in options &&
|
|
15222
|
-
typeof options.encoding ===
|
|
15236
|
+
typeof options.encoding ===
|
|
15237
|
+
'string') {
|
|
15223
15238
|
encoding = options.encoding;
|
|
15224
15239
|
}
|
|
15225
15240
|
const data = fsBinding.readFileUtf8(pathOrDescriptor, 0);
|
|
@@ -21638,7 +21653,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
21638
21653
|
this.listenerRegistered = false;
|
|
21639
21654
|
this.visibilityChangeListenerRegistered = false;
|
|
21640
21655
|
this.channelName =
|
|
21641
|
-
typeof config.channelName === 'string' &&
|
|
21656
|
+
typeof config.channelName === 'string' &&
|
|
21657
|
+
config.channelName.trim().length > 0
|
|
21642
21658
|
? config.channelName.trim()
|
|
21643
21659
|
: DEFAULT_CHANNEL$6;
|
|
21644
21660
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -21677,7 +21693,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
21677
21693
|
channel: this.channelName,
|
|
21678
21694
|
connector_id: this.connectorId,
|
|
21679
21695
|
message_type: message && typeof message === 'object'
|
|
21680
|
-
? message.constructor
|
|
21696
|
+
? (message.constructor
|
|
21697
|
+
?.name ?? typeof message)
|
|
21681
21698
|
: typeof message,
|
|
21682
21699
|
has_sender_id: Boolean(message?.senderId),
|
|
21683
21700
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -21686,7 +21703,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
21686
21703
|
return;
|
|
21687
21704
|
}
|
|
21688
21705
|
const busMessage = message;
|
|
21689
|
-
const senderId = typeof busMessage.senderId === 'string' &&
|
|
21706
|
+
const senderId = typeof busMessage.senderId === 'string' &&
|
|
21707
|
+
busMessage.senderId.length > 0
|
|
21690
21708
|
? busMessage.senderId
|
|
21691
21709
|
: null;
|
|
21692
21710
|
const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
|
|
@@ -21937,7 +21955,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
21937
21955
|
timestamp: new Date().toISOString(),
|
|
21938
21956
|
});
|
|
21939
21957
|
}
|
|
21940
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
21958
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
21959
|
+
this.visibilityChangeHandler &&
|
|
21960
|
+
typeof document !== 'undefined') {
|
|
21941
21961
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
21942
21962
|
this.visibilityChangeListenerRegistered = false;
|
|
21943
21963
|
this.visibilityChangeHandler = undefined;
|
|
@@ -21954,7 +21974,7 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
21954
21974
|
return rawOrEnvelope;
|
|
21955
21975
|
}
|
|
21956
21976
|
_isWildcardTarget() {
|
|
21957
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
21977
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
21958
21978
|
}
|
|
21959
21979
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
21960
21980
|
if (this._isWildcardTarget()) {
|
|
@@ -21974,7 +21994,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
21974
21994
|
return true;
|
|
21975
21995
|
}
|
|
21976
21996
|
const expectedSender = this.targetNodeId;
|
|
21977
|
-
if (expectedSender &&
|
|
21997
|
+
if (expectedSender &&
|
|
21998
|
+
expectedSender !== '*' &&
|
|
21999
|
+
senderNodeId !== expectedSender) {
|
|
21978
22000
|
logger$J.debug('inpage_message_rejected', {
|
|
21979
22001
|
channel: this.channelName,
|
|
21980
22002
|
connector_id: this.connectorId,
|
|
@@ -22376,8 +22398,8 @@ class CertificateManagerFactory extends factory.AbstractResourceFactory {
|
|
|
22376
22398
|
}
|
|
22377
22399
|
}
|
|
22378
22400
|
|
|
22379
|
-
const DEFAULT_UNCONFIGURED_MESSAGE =
|
|
22380
|
-
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE =
|
|
22401
|
+
const DEFAULT_UNCONFIGURED_MESSAGE = 'Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.';
|
|
22402
|
+
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = 'TrustStoreProviderFactory';
|
|
22381
22403
|
class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
|
|
22382
22404
|
createUnconfiguredProvider(reason) {
|
|
22383
22405
|
return new NoopTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
@@ -26106,7 +26128,8 @@ class DefaultSecurityManager {
|
|
|
26106
26128
|
const hasSignature = Boolean(envelope.sec?.sig);
|
|
26107
26129
|
if (!hasSignature) {
|
|
26108
26130
|
const nodeSid = node.sid;
|
|
26109
|
-
const envelopeSid = envelope
|
|
26131
|
+
const envelopeSid = envelope
|
|
26132
|
+
.sid;
|
|
26110
26133
|
const isLocalUnsignedSelfEnvelope = localContext.originType === core.DeliveryOriginType.LOCAL &&
|
|
26111
26134
|
typeof nodeSid === 'string' &&
|
|
26112
26135
|
nodeSid.length > 0 &&
|
|
@@ -29350,14 +29373,16 @@ function normalizeInPageConnectionGrant(candidate) {
|
|
|
29350
29373
|
type,
|
|
29351
29374
|
purpose,
|
|
29352
29375
|
};
|
|
29353
|
-
const channelValue = candidate.channelName ??
|
|
29376
|
+
const channelValue = candidate.channelName ??
|
|
29377
|
+
candidate['channel_name'];
|
|
29354
29378
|
if (channelValue !== undefined) {
|
|
29355
29379
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
29356
29380
|
throw new TypeError('InPageConnectionGrant "channelName" must be a non-empty string when provided');
|
|
29357
29381
|
}
|
|
29358
29382
|
result.channelName = channelValue.trim();
|
|
29359
29383
|
}
|
|
29360
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
29384
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
29385
|
+
candidate['inbox_capacity'];
|
|
29361
29386
|
if (inboxValue !== undefined) {
|
|
29362
29387
|
if (typeof inboxValue !== 'number' ||
|
|
29363
29388
|
!Number.isFinite(inboxValue) ||
|
|
@@ -30163,7 +30188,9 @@ function normalizeConfig$p(config) {
|
|
|
30163
30188
|
: DEFAULT_CHANNEL$5;
|
|
30164
30189
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
30165
30190
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY$5;
|
|
30166
|
-
if (typeof rawInbox === 'number' &&
|
|
30191
|
+
if (typeof rawInbox === 'number' &&
|
|
30192
|
+
Number.isFinite(rawInbox) &&
|
|
30193
|
+
rawInbox > 0) {
|
|
30167
30194
|
inboxCapacity = Math.floor(rawInbox);
|
|
30168
30195
|
}
|
|
30169
30196
|
else if (typeof rawInbox === 'string') {
|
|
@@ -30191,9 +30218,7 @@ class InPageListenerFactory extends TransportListenerFactory {
|
|
|
30191
30218
|
}
|
|
30192
30219
|
async create(config, ...factoryArgs) {
|
|
30193
30220
|
const normalized = normalizeConfig$p(config);
|
|
30194
|
-
const [{ InPageListener }] = await Promise.all([
|
|
30195
|
-
getInPageListenerModule(),
|
|
30196
|
-
]);
|
|
30221
|
+
const [{ InPageListener }] = await Promise.all([getInPageListenerModule()]);
|
|
30197
30222
|
void factoryArgs;
|
|
30198
30223
|
return new InPageListener({
|
|
30199
30224
|
channelName: normalized.channelName,
|
|
@@ -30226,7 +30251,9 @@ function normalizeConfig$o(config) {
|
|
|
30226
30251
|
: DEFAULT_CHANNEL$4;
|
|
30227
30252
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
30228
30253
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY$4;
|
|
30229
|
-
if (typeof rawInbox === 'number' &&
|
|
30254
|
+
if (typeof rawInbox === 'number' &&
|
|
30255
|
+
Number.isFinite(rawInbox) &&
|
|
30256
|
+
rawInbox > 0) {
|
|
30230
30257
|
inboxCapacity = Math.floor(rawInbox);
|
|
30231
30258
|
}
|
|
30232
30259
|
else if (typeof rawInbox === 'string') {
|
|
@@ -30631,7 +30658,8 @@ class InPageConnectorFactory extends ConnectorFactory {
|
|
|
30631
30658
|
const normalized = this._normalizeConfig(config);
|
|
30632
30659
|
const options = (factoryArgs[0] ?? {});
|
|
30633
30660
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
30634
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
30661
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
30662
|
+
normalizedLocalNodeFromConfig;
|
|
30635
30663
|
if (!localNodeId) {
|
|
30636
30664
|
throw new Error('InPageConnectorFactory requires a localNodeId from config or create() options');
|
|
30637
30665
|
}
|
|
@@ -30807,10 +30835,12 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30807
30835
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
|
|
30808
30836
|
};
|
|
30809
30837
|
const channelCandidate = record.channelName ?? record['channel_name'];
|
|
30810
|
-
if (typeof channelCandidate === 'string' &&
|
|
30838
|
+
if (typeof channelCandidate === 'string' &&
|
|
30839
|
+
channelCandidate.trim().length > 0) {
|
|
30811
30840
|
config.channelName = channelCandidate.trim();
|
|
30812
30841
|
}
|
|
30813
|
-
const inboxCandidate = record.inboxCapacity ??
|
|
30842
|
+
const inboxCandidate = record.inboxCapacity ??
|
|
30843
|
+
record['inbox_capacity'];
|
|
30814
30844
|
if (typeof inboxCandidate === 'number' &&
|
|
30815
30845
|
Number.isFinite(inboxCandidate) &&
|
|
30816
30846
|
inboxCandidate > 0) {
|
|
@@ -30834,9 +30864,11 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30834
30864
|
throw new Error('BroadcastChannelConnectorFactory requires a configuration');
|
|
30835
30865
|
}
|
|
30836
30866
|
const normalized = this._normalizeConfig(config);
|
|
30837
|
-
const options = (factoryArgs[0] ??
|
|
30867
|
+
const options = (factoryArgs[0] ??
|
|
30868
|
+
{});
|
|
30838
30869
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
30839
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
30870
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
30871
|
+
normalizedLocalNodeFromConfig;
|
|
30840
30872
|
if (!localNodeId) {
|
|
30841
30873
|
throw new Error('BroadcastChannelConnectorFactory requires a localNodeId from config or create() options');
|
|
30842
30874
|
}
|
|
@@ -30861,6 +30893,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30861
30893
|
inboxCapacity,
|
|
30862
30894
|
localNodeId,
|
|
30863
30895
|
initialTargetNodeId: resolvedTarget,
|
|
30896
|
+
passive: normalized.passive,
|
|
30864
30897
|
};
|
|
30865
30898
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
30866
30899
|
if (options.authorization) {
|
|
@@ -30899,6 +30932,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30899
30932
|
if (normalizedLocalNodeId) {
|
|
30900
30933
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
30901
30934
|
}
|
|
30935
|
+
if (typeof candidate.passive === 'boolean') {
|
|
30936
|
+
normalized.passive = candidate.passive;
|
|
30937
|
+
}
|
|
30902
30938
|
if (typeof candidate.flowControl === 'boolean') {
|
|
30903
30939
|
normalized.flowControl = candidate.flowControl;
|
|
30904
30940
|
}
|
|
@@ -32440,7 +32476,9 @@ class InPageListener extends TransportListener {
|
|
|
32440
32476
|
typeof channelCandidate === 'string' && channelCandidate.trim().length > 0
|
|
32441
32477
|
? channelCandidate.trim()
|
|
32442
32478
|
: DEFAULT_CHANNEL$1;
|
|
32443
|
-
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
32479
|
+
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
32480
|
+
Number.isFinite(inboxCandidate) &&
|
|
32481
|
+
inboxCandidate > 0
|
|
32444
32482
|
? Math.floor(inboxCandidate)
|
|
32445
32483
|
: DEFAULT_INBOX_CAPACITY$1;
|
|
32446
32484
|
this._inboxCapacity = normalizedCapacity;
|
|
@@ -32715,7 +32753,8 @@ class InPageListener extends TransportListener {
|
|
|
32715
32753
|
if (grant.type === INPAGE_CONNECTION_GRANT_TYPE) {
|
|
32716
32754
|
return inPageGrantToConnectorConfig(grant);
|
|
32717
32755
|
}
|
|
32718
|
-
if (typeof grant
|
|
32756
|
+
if (typeof grant
|
|
32757
|
+
?.toConnectorConfig === 'function') {
|
|
32719
32758
|
return grant.toConnectorConfig();
|
|
32720
32759
|
}
|
|
32721
32760
|
throw new Error(`Unsupported grant type: ${grant.type}`);
|
|
@@ -32855,9 +32894,7 @@ var inpageListener = /*#__PURE__*/Object.freeze({
|
|
|
32855
32894
|
const logger$n = getLogger('naylence.fame.connector.broadcast_channel_listener');
|
|
32856
32895
|
const DEFAULT_CHANNEL = 'naylence-fabric';
|
|
32857
32896
|
const DEFAULT_INBOX_CAPACITY = 2048;
|
|
32858
|
-
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK |
|
|
32859
|
-
core.FameResponseType.REPLY |
|
|
32860
|
-
core.FameResponseType.STREAM;
|
|
32897
|
+
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK | core.FameResponseType.REPLY | core.FameResponseType.STREAM;
|
|
32861
32898
|
const isBrowserEnvironment$1 = () => typeof window !== 'undefined' &&
|
|
32862
32899
|
typeof BroadcastChannel !== 'undefined' &&
|
|
32863
32900
|
typeof MessageEvent !== 'undefined';
|
|
@@ -33071,9 +33108,7 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
33071
33108
|
return null;
|
|
33072
33109
|
}
|
|
33073
33110
|
})();
|
|
33074
|
-
if (error instanceof zod.ZodError &&
|
|
33075
|
-
decoded &&
|
|
33076
|
-
decoded.length > 0) {
|
|
33111
|
+
if (error instanceof zod.ZodError && decoded && decoded.length > 0) {
|
|
33077
33112
|
try {
|
|
33078
33113
|
const reparsed = JSON.parse(decoded);
|
|
33079
33114
|
const candidate = reparsed.rtype;
|
|
@@ -33296,11 +33331,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
33296
33331
|
? Math.floor(initialWindowCandidate)
|
|
33297
33332
|
: undefined;
|
|
33298
33333
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
33334
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
33335
|
+
logger$n.debug('broadcast_channel_listener_building_connector_config', {
|
|
33336
|
+
system_id: systemId,
|
|
33337
|
+
channel_name: channelName,
|
|
33338
|
+
passive,
|
|
33339
|
+
has_base_config: !!baseConfig,
|
|
33340
|
+
passive_candidate: passiveCandidate,
|
|
33341
|
+
});
|
|
33299
33342
|
return {
|
|
33300
33343
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
|
|
33301
33344
|
channelName,
|
|
33302
33345
|
inboxCapacity,
|
|
33303
|
-
passive
|
|
33346
|
+
passive,
|
|
33304
33347
|
initialWindow,
|
|
33305
33348
|
localNodeId,
|
|
33306
33349
|
initialTargetNodeId,
|
|
@@ -34170,7 +34213,9 @@ function parseCookies(cookieHeader) {
|
|
|
34170
34213
|
if (!cookieHeader) {
|
|
34171
34214
|
return {};
|
|
34172
34215
|
}
|
|
34173
|
-
return cookieHeader
|
|
34216
|
+
return cookieHeader
|
|
34217
|
+
.split(';')
|
|
34218
|
+
.reduce((acc, entry) => {
|
|
34174
34219
|
const [rawName, ...rawValueParts] = entry.split('=');
|
|
34175
34220
|
const name = rawName?.trim();
|
|
34176
34221
|
if (!name) {
|
|
@@ -34318,10 +34363,7 @@ function setNoCacheHeaders(res) {
|
|
|
34318
34363
|
res.set('Pragma', 'no-cache');
|
|
34319
34364
|
}
|
|
34320
34365
|
function respondInvalidClient(res) {
|
|
34321
|
-
res
|
|
34322
|
-
.status(401)
|
|
34323
|
-
.set('WWW-Authenticate', 'Basic')
|
|
34324
|
-
.json({
|
|
34366
|
+
res.status(401).set('WWW-Authenticate', 'Basic').json({
|
|
34325
34367
|
error: 'invalid_client',
|
|
34326
34368
|
error_description: 'Invalid client credentials',
|
|
34327
34369
|
});
|
|
@@ -34358,10 +34400,10 @@ function createOAuth2TokenRouter(options) {
|
|
|
34358
34400
|
DEFAULT_JWT_ALGORITHM$1;
|
|
34359
34401
|
const allowedScopes = getAllowedScopes$1(configAllowedScopes);
|
|
34360
34402
|
const resolvedTokenTtlSec = tokenTtlSec ?? 3600;
|
|
34361
|
-
const enablePkce = coerceBoolean(process.env[ENV_VAR_ENABLE_PKCE]) ??
|
|
34362
|
-
(configEnablePkce ?? true);
|
|
34403
|
+
const enablePkce = coerceBoolean(process.env[ENV_VAR_ENABLE_PKCE]) ?? configEnablePkce ?? true;
|
|
34363
34404
|
const allowPublicClients = coerceBoolean(process.env[ENV_VAR_ALLOW_PUBLIC_CLIENTS]) ??
|
|
34364
|
-
|
|
34405
|
+
configAllowPublicClients ??
|
|
34406
|
+
true;
|
|
34365
34407
|
const authorizationCodeTtlSec = ensurePositiveInteger(coerceNumber$1(process.env[ENV_VAR_AUTHORIZATION_CODE_TTL]) ??
|
|
34366
34408
|
configAuthorizationCodeTtlSec) ?? DEFAULT_AUTHORIZATION_CODE_TTL_SEC;
|
|
34367
34409
|
const devLoginExplicitlyEnabled = coerceBoolean(process.env[ENV_VAR_ENABLE_DEV_LOGIN]) ??
|
|
@@ -34376,7 +34418,8 @@ function createOAuth2TokenRouter(options) {
|
|
|
34376
34418
|
configDevLoginCookieName ??
|
|
34377
34419
|
DEFAULT_SESSION_COOKIE_NAME;
|
|
34378
34420
|
const devLoginSecureCookie = coerceBoolean(process.env[ENV_VAR_SESSION_SECURE_COOKIE]) ??
|
|
34379
|
-
|
|
34421
|
+
configDevLoginSecureCookie ??
|
|
34422
|
+
false;
|
|
34380
34423
|
const devLoginTitle = coerceString$2(process.env[ENV_VAR_LOGIN_TITLE]) ??
|
|
34381
34424
|
configDevLoginTitle ??
|
|
34382
34425
|
DEFAULT_LOGIN_TITLE;
|
|
@@ -37443,19 +37486,23 @@ function normalizeConfig$a(config) {
|
|
|
37443
37486
|
normalized.clientSecretConfig = normalizeSecretSource(clientSecretSource);
|
|
37444
37487
|
}
|
|
37445
37488
|
const audienceCandidate = candidate.audience ?? candidate.aud;
|
|
37446
|
-
if (typeof audienceCandidate === 'string' &&
|
|
37489
|
+
if (typeof audienceCandidate === 'string' &&
|
|
37490
|
+
audienceCandidate.trim().length > 0) {
|
|
37447
37491
|
normalized.audience = audienceCandidate.trim();
|
|
37448
37492
|
}
|
|
37449
37493
|
const codeChallengeMethod = candidate.codeChallengeMethod ?? candidate.code_challenge_method;
|
|
37450
|
-
if (typeof codeChallengeMethod === 'string' &&
|
|
37494
|
+
if (typeof codeChallengeMethod === 'string' &&
|
|
37495
|
+
codeChallengeMethod.trim().length > 0) {
|
|
37451
37496
|
normalized.codeChallengeMethod = codeChallengeMethod.trim();
|
|
37452
37497
|
}
|
|
37453
37498
|
const codeVerifierLength = candidate.codeVerifierLength ?? candidate.code_verifier_length;
|
|
37454
|
-
if (typeof codeVerifierLength === 'number' &&
|
|
37499
|
+
if (typeof codeVerifierLength === 'number' &&
|
|
37500
|
+
Number.isFinite(codeVerifierLength)) {
|
|
37455
37501
|
normalized.codeVerifierLength = codeVerifierLength;
|
|
37456
37502
|
}
|
|
37457
37503
|
const clockSkewSeconds = candidate.clockSkewSeconds ?? candidate.clock_skew_seconds;
|
|
37458
|
-
if (typeof clockSkewSeconds === 'number' &&
|
|
37504
|
+
if (typeof clockSkewSeconds === 'number' &&
|
|
37505
|
+
Number.isFinite(clockSkewSeconds)) {
|
|
37459
37506
|
normalized.clockSkewSeconds = clockSkewSeconds;
|
|
37460
37507
|
}
|
|
37461
37508
|
const loginHintParam = candidate.loginHintParam ?? candidate.login_hint_param;
|
|
@@ -37500,8 +37547,8 @@ class OAuth2PkceTokenProviderFactory extends TokenProviderFactory {
|
|
|
37500
37547
|
options.audience = normalized.audience;
|
|
37501
37548
|
}
|
|
37502
37549
|
if (normalized.codeChallengeMethod) {
|
|
37503
|
-
options.codeChallengeMethod =
|
|
37504
|
-
.toUpperCase();
|
|
37550
|
+
options.codeChallengeMethod =
|
|
37551
|
+
normalized.codeChallengeMethod.toUpperCase();
|
|
37505
37552
|
}
|
|
37506
37553
|
if (normalized.codeVerifierLength) {
|
|
37507
37554
|
options.codeVerifierLength = normalized.codeVerifierLength;
|
|
@@ -39259,14 +39306,14 @@ var eddsaEnvelopeVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
|
39259
39306
|
|
|
39260
39307
|
const FACTORY_META$d = {
|
|
39261
39308
|
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
39262
|
-
key:
|
|
39309
|
+
key: 'NoopTrustStoreProvider',
|
|
39263
39310
|
isDefault: true,
|
|
39264
39311
|
priority: 10,
|
|
39265
39312
|
};
|
|
39266
39313
|
class NoopTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
39267
39314
|
constructor() {
|
|
39268
39315
|
super(...arguments);
|
|
39269
|
-
this.type =
|
|
39316
|
+
this.type = 'NoopTrustStoreProvider';
|
|
39270
39317
|
this.isDefault = true;
|
|
39271
39318
|
this.priority = 10;
|
|
39272
39319
|
}
|
|
@@ -41504,8 +41551,7 @@ function normalizeOptions$2(raw) {
|
|
|
41504
41551
|
const scopes = normalizeScopes(camel.scopes) ??
|
|
41505
41552
|
normalizeScopes(snake.scopes ?? snake.scope) ??
|
|
41506
41553
|
DEFAULT_SCOPES.slice();
|
|
41507
|
-
const audience = coerceString(camel.audience) ??
|
|
41508
|
-
coerceString(snake.audience ?? snake.aud);
|
|
41554
|
+
const audience = coerceString(camel.audience) ?? coerceString(snake.audience ?? snake.aud);
|
|
41509
41555
|
const fetchImpl = (camel.fetchImpl ?? snake.fetch_impl);
|
|
41510
41556
|
const clockSkewSeconds = coerceNumber(camel.clockSkewSeconds) ??
|
|
41511
41557
|
coerceNumber(snake.clock_skew_seconds) ??
|
|
@@ -43167,6 +43213,7 @@ exports.TokenIssuerFactory = TokenIssuerFactory;
|
|
|
43167
43213
|
exports.TokenProviderFactory = TokenProviderFactory;
|
|
43168
43214
|
exports.TokenVerifierFactory = TokenVerifierFactory;
|
|
43169
43215
|
exports.TransportListener = TransportListener;
|
|
43216
|
+
exports.TransportListenerFactory = TransportListenerFactory;
|
|
43170
43217
|
exports.TransportProvisionerFactory = TransportProvisionerFactory;
|
|
43171
43218
|
exports.TrustStoreProviderFactory = TrustStoreProviderFactory;
|
|
43172
43219
|
exports.TtlValidationError = TtlValidationError;
|
|
@@ -43303,6 +43350,7 @@ exports.requireCryptoSupport = requireCryptoSupport;
|
|
|
43303
43350
|
exports.retryWithBackoff = retryWithBackoff;
|
|
43304
43351
|
exports.runOAuth2Server = main;
|
|
43305
43352
|
exports.safeColor = safeColor;
|
|
43353
|
+
exports.safeImport = safeImport;
|
|
43306
43354
|
exports.sealedDecrypt = sealedDecrypt;
|
|
43307
43355
|
exports.sealedEncrypt = sealedEncrypt;
|
|
43308
43356
|
exports.secureDigest = secureDigest;
|