@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/browser/index.cjs
CHANGED
|
@@ -30,7 +30,8 @@ function installProcessEnvShim() {
|
|
|
30
30
|
if (g.__ENV__ && typeof g.__ENV__ === 'object')
|
|
31
31
|
Object.assign(out, g.__ENV__);
|
|
32
32
|
try {
|
|
33
|
-
//
|
|
33
|
+
// import.meta is only available in ESM builds
|
|
34
|
+
// @ts-ignore
|
|
34
35
|
const ie = (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== 'undefined' && undefined) || undefined;
|
|
35
36
|
if (ie && typeof ie === 'object')
|
|
36
37
|
Object.assign(out, ie);
|
|
@@ -98,12 +99,12 @@ installProcessEnvShim();
|
|
|
98
99
|
// --- END ENV SHIM ---
|
|
99
100
|
|
|
100
101
|
// This file is auto-generated during build - do not edit manually
|
|
101
|
-
// Generated from package.json version: 0.3.
|
|
102
|
+
// Generated from package.json version: 0.3.7
|
|
102
103
|
/**
|
|
103
104
|
* The package version, injected at build time.
|
|
104
105
|
* @internal
|
|
105
106
|
*/
|
|
106
|
-
const VERSION = '0.3.
|
|
107
|
+
const VERSION = '0.3.7';
|
|
107
108
|
|
|
108
109
|
/**
|
|
109
110
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -2332,6 +2333,50 @@ function validateKeyCorrelationTtlSec(ttlSec) {
|
|
|
2332
2333
|
});
|
|
2333
2334
|
}
|
|
2334
2335
|
|
|
2336
|
+
function isModuleNotFoundError(error) {
|
|
2337
|
+
if (!(error instanceof Error)) {
|
|
2338
|
+
return false;
|
|
2339
|
+
}
|
|
2340
|
+
const message = error.message || '';
|
|
2341
|
+
if (message.includes('Cannot find module') ||
|
|
2342
|
+
message.includes('ERR_MODULE_NOT_FOUND') ||
|
|
2343
|
+
message.includes('MODULE_NOT_FOUND')) {
|
|
2344
|
+
return true;
|
|
2345
|
+
}
|
|
2346
|
+
const code = error.code;
|
|
2347
|
+
if (typeof code === 'string') {
|
|
2348
|
+
return code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND';
|
|
2349
|
+
}
|
|
2350
|
+
return false;
|
|
2351
|
+
}
|
|
2352
|
+
/**
|
|
2353
|
+
* Wraps a dynamic import loader and enriches "module not found" failures with an actionable error message.
|
|
2354
|
+
*/
|
|
2355
|
+
async function safeImport(loader, dependencyNameOrOptions, maybeOptions) {
|
|
2356
|
+
const options = typeof dependencyNameOrOptions === 'string'
|
|
2357
|
+
? { dependencyName: dependencyNameOrOptions, ...(maybeOptions ?? {}) }
|
|
2358
|
+
: dependencyNameOrOptions;
|
|
2359
|
+
const dependencyName = options.dependencyName;
|
|
2360
|
+
try {
|
|
2361
|
+
return await loader();
|
|
2362
|
+
}
|
|
2363
|
+
catch (error) {
|
|
2364
|
+
if (isModuleNotFoundError(error)) {
|
|
2365
|
+
const message = options.helpMessage ??
|
|
2366
|
+
`Missing optional dependency "${dependencyName}". Install it to enable this feature.`;
|
|
2367
|
+
const enrichedError = new Error(message);
|
|
2368
|
+
try {
|
|
2369
|
+
enrichedError.cause = error;
|
|
2370
|
+
}
|
|
2371
|
+
catch {
|
|
2372
|
+
// Ignore environments that do not support attaching a cause.
|
|
2373
|
+
}
|
|
2374
|
+
throw enrichedError;
|
|
2375
|
+
}
|
|
2376
|
+
throw error;
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2335
2380
|
/**
|
|
2336
2381
|
* flow_controller.ts - credit window management with cooperative back-pressure.
|
|
2337
2382
|
*
|
|
@@ -3536,50 +3581,6 @@ function normalizeSecretSource(value) {
|
|
|
3536
3581
|
return SecretSource.normalize(value);
|
|
3537
3582
|
}
|
|
3538
3583
|
|
|
3539
|
-
function isModuleNotFoundError(error) {
|
|
3540
|
-
if (!(error instanceof Error)) {
|
|
3541
|
-
return false;
|
|
3542
|
-
}
|
|
3543
|
-
const message = error.message || '';
|
|
3544
|
-
if (message.includes('Cannot find module') ||
|
|
3545
|
-
message.includes('ERR_MODULE_NOT_FOUND') ||
|
|
3546
|
-
message.includes('MODULE_NOT_FOUND')) {
|
|
3547
|
-
return true;
|
|
3548
|
-
}
|
|
3549
|
-
const code = error.code;
|
|
3550
|
-
if (typeof code === 'string') {
|
|
3551
|
-
return code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND';
|
|
3552
|
-
}
|
|
3553
|
-
return false;
|
|
3554
|
-
}
|
|
3555
|
-
/**
|
|
3556
|
-
* Wraps a dynamic import loader and enriches "module not found" failures with an actionable error message.
|
|
3557
|
-
*/
|
|
3558
|
-
async function safeImport(loader, dependencyNameOrOptions, maybeOptions) {
|
|
3559
|
-
const options = typeof dependencyNameOrOptions === 'string'
|
|
3560
|
-
? { dependencyName: dependencyNameOrOptions, ...(maybeOptions ?? {}) }
|
|
3561
|
-
: dependencyNameOrOptions;
|
|
3562
|
-
const dependencyName = options.dependencyName;
|
|
3563
|
-
try {
|
|
3564
|
-
return await loader();
|
|
3565
|
-
}
|
|
3566
|
-
catch (error) {
|
|
3567
|
-
if (isModuleNotFoundError(error)) {
|
|
3568
|
-
const message = options.helpMessage ??
|
|
3569
|
-
`Missing optional dependency "${dependencyName}". Install it to enable this feature.`;
|
|
3570
|
-
const enrichedError = new Error(message);
|
|
3571
|
-
try {
|
|
3572
|
-
enrichedError.cause = error;
|
|
3573
|
-
}
|
|
3574
|
-
catch {
|
|
3575
|
-
// Ignore environments that do not support attaching a cause.
|
|
3576
|
-
}
|
|
3577
|
-
throw enrichedError;
|
|
3578
|
-
}
|
|
3579
|
-
throw error;
|
|
3580
|
-
}
|
|
3581
|
-
}
|
|
3582
|
-
|
|
3583
3584
|
const indexedDBConfigSchema = zod.z
|
|
3584
3585
|
.object({
|
|
3585
3586
|
type: zod.z
|
|
@@ -7175,9 +7176,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7175
7176
|
this.ackDoneSince = new Map();
|
|
7176
7177
|
this.replyDoneSince = new Map();
|
|
7177
7178
|
this.pendingAckDispatches = new Set();
|
|
7178
|
-
this.recentlyHandled = new Map();
|
|
7179
|
-
this.recentlyHandledOrder = [];
|
|
7180
|
-
this.recentlyHandledTtlMs = 60000;
|
|
7181
7179
|
this.isPreparingToStop = false;
|
|
7182
7180
|
this.shutdownRequestedAtMs = null;
|
|
7183
7181
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -7399,22 +7397,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7399
7397
|
}
|
|
7400
7398
|
}
|
|
7401
7399
|
else {
|
|
7402
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
7403
|
-
if (wasRecentlyHandled) {
|
|
7404
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
7405
|
-
envp_id: envelope.id,
|
|
7406
|
-
});
|
|
7407
|
-
return new TrackedEnvelope({
|
|
7408
|
-
timeoutAtMs: 0,
|
|
7409
|
-
overallTimeoutAtMs: 0,
|
|
7410
|
-
expectedResponseType: envelope.rtype ?? core.FameResponseType.NONE,
|
|
7411
|
-
createdAtMs: Date.now(),
|
|
7412
|
-
status: EnvelopeStatus.HANDLED,
|
|
7413
|
-
mailboxType: MailboxType.INBOX,
|
|
7414
|
-
originalEnvelope: envelope,
|
|
7415
|
-
serviceName: inboxName,
|
|
7416
|
-
});
|
|
7417
|
-
}
|
|
7418
7400
|
tracked = new TrackedEnvelope({
|
|
7419
7401
|
timeoutAtMs: 0,
|
|
7420
7402
|
overallTimeoutAtMs: 0,
|
|
@@ -7436,12 +7418,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7436
7418
|
async onEnvelopeHandled(envelope) {
|
|
7437
7419
|
const inbox = this.ensureInbox();
|
|
7438
7420
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
7421
|
+
// Delete the envelope from inbox to prevent growth
|
|
7439
7422
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
7440
|
-
await this.lock.runExclusive(async () => {
|
|
7441
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
7442
|
-
});
|
|
7443
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
7444
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
7445
7423
|
}
|
|
7446
7424
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
7447
7425
|
const inbox = this.ensureInbox();
|
|
@@ -7656,9 +7634,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7656
7634
|
});
|
|
7657
7635
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
7658
7636
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7637
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
7638
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
7639
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
7662
7640
|
for (const handler of this.eventHandlers) {
|
|
7663
7641
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
7664
7642
|
}
|
|
@@ -7808,8 +7786,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7808
7786
|
}
|
|
7809
7787
|
this.streamDone.clear();
|
|
7810
7788
|
this.correlationToEnvelope.clear();
|
|
7811
|
-
this.recentlyHandled.clear();
|
|
7812
|
-
this.recentlyHandledOrder.length = 0;
|
|
7813
7789
|
return values;
|
|
7814
7790
|
});
|
|
7815
7791
|
for (const timer of timers) {
|
|
@@ -8391,39 +8367,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8391
8367
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
8392
8368
|
}
|
|
8393
8369
|
}
|
|
8394
|
-
markRecentlyHandled(envelopeId) {
|
|
8395
|
-
const now = Date.now();
|
|
8396
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
8397
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
8398
|
-
this.trimRecentlyHandled(now);
|
|
8399
|
-
}
|
|
8400
|
-
wasRecentlyHandled(envelopeId) {
|
|
8401
|
-
const now = Date.now();
|
|
8402
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
8403
|
-
if (timestamp === undefined) {
|
|
8404
|
-
return false;
|
|
8405
|
-
}
|
|
8406
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
8407
|
-
this.recentlyHandled.delete(envelopeId);
|
|
8408
|
-
return false;
|
|
8409
|
-
}
|
|
8410
|
-
return true;
|
|
8411
|
-
}
|
|
8412
|
-
trimRecentlyHandled(now) {
|
|
8413
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
8414
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
8415
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
8416
|
-
if (timestamp === undefined) {
|
|
8417
|
-
this.recentlyHandledOrder.shift();
|
|
8418
|
-
continue;
|
|
8419
|
-
}
|
|
8420
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
8421
|
-
break;
|
|
8422
|
-
}
|
|
8423
|
-
this.recentlyHandled.delete(candidate);
|
|
8424
|
-
this.recentlyHandledOrder.shift();
|
|
8425
|
-
}
|
|
8426
|
-
}
|
|
8427
8370
|
getShutdownRetryDeferDelay(nowMs) {
|
|
8428
8371
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
8429
8372
|
return null;
|
|
@@ -9917,7 +9860,8 @@ const ensureBroadcastEnvironment = () => {
|
|
|
9917
9860
|
};
|
|
9918
9861
|
let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
9919
9862
|
static generateConnectorId() {
|
|
9920
|
-
const globalCrypto = globalThis
|
|
9863
|
+
const globalCrypto = globalThis
|
|
9864
|
+
.crypto;
|
|
9921
9865
|
if (globalCrypto?.randomUUID) {
|
|
9922
9866
|
return globalCrypto.randomUUID();
|
|
9923
9867
|
}
|
|
@@ -9972,7 +9916,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9972
9916
|
this.listenerRegistered = false;
|
|
9973
9917
|
this.visibilityChangeListenerRegistered = false;
|
|
9974
9918
|
this.channelName =
|
|
9975
|
-
typeof config.channelName === 'string' &&
|
|
9919
|
+
typeof config.channelName === 'string' &&
|
|
9920
|
+
config.channelName.trim().length > 0
|
|
9976
9921
|
? config.channelName.trim()
|
|
9977
9922
|
: DEFAULT_CHANNEL$7;
|
|
9978
9923
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -9996,6 +9941,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9996
9941
|
local_node_id: this.localNodeId,
|
|
9997
9942
|
target_node_id: this.targetNodeId ?? null,
|
|
9998
9943
|
inbox_capacity: preferredCapacity,
|
|
9944
|
+
passive: config.passive ?? false,
|
|
9999
9945
|
timestamp: new Date().toISOString(),
|
|
10000
9946
|
});
|
|
10001
9947
|
this.onMsg = (event) => {
|
|
@@ -10013,7 +9959,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10013
9959
|
channel: this.channelName,
|
|
10014
9960
|
connector_id: this.connectorId,
|
|
10015
9961
|
message_type: message && typeof message === 'object'
|
|
10016
|
-
? message.constructor
|
|
9962
|
+
? (message.constructor
|
|
9963
|
+
?.name ?? typeof message)
|
|
10017
9964
|
: typeof message,
|
|
10018
9965
|
has_sender_id: Boolean(message?.senderId),
|
|
10019
9966
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -10243,7 +10190,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10243
10190
|
timestamp: new Date().toISOString(),
|
|
10244
10191
|
});
|
|
10245
10192
|
}
|
|
10246
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
10193
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
10194
|
+
this.visibilityChangeHandler &&
|
|
10195
|
+
typeof document !== 'undefined') {
|
|
10247
10196
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
10248
10197
|
this.visibilityChangeListenerRegistered = false;
|
|
10249
10198
|
this.visibilityChangeHandler = undefined;
|
|
@@ -10271,7 +10220,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10271
10220
|
return rawOrEnvelope;
|
|
10272
10221
|
}
|
|
10273
10222
|
_isWildcardTarget() {
|
|
10274
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
10223
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
10275
10224
|
}
|
|
10276
10225
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
10277
10226
|
if (this._isWildcardTarget()) {
|
|
@@ -10291,7 +10240,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10291
10240
|
return true;
|
|
10292
10241
|
}
|
|
10293
10242
|
const expectedSender = this.targetNodeId;
|
|
10294
|
-
if (expectedSender &&
|
|
10243
|
+
if (expectedSender &&
|
|
10244
|
+
expectedSender !== '*' &&
|
|
10245
|
+
senderNodeId !== expectedSender) {
|
|
10295
10246
|
logger$_.debug('broadcast_channel_message_rejected', {
|
|
10296
10247
|
channel: this.channelName,
|
|
10297
10248
|
connector_id: this.connectorId,
|
|
@@ -10510,14 +10461,16 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
10510
10461
|
type,
|
|
10511
10462
|
purpose,
|
|
10512
10463
|
};
|
|
10513
|
-
const channelValue = candidate.channelName ??
|
|
10464
|
+
const channelValue = candidate.channelName ??
|
|
10465
|
+
candidate['channel_name'];
|
|
10514
10466
|
if (channelValue !== undefined) {
|
|
10515
10467
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
10516
10468
|
throw new TypeError('BroadcastChannelConnectionGrant "channelName" must be a non-empty string when provided');
|
|
10517
10469
|
}
|
|
10518
10470
|
result.channelName = channelValue.trim();
|
|
10519
10471
|
}
|
|
10520
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
10472
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
10473
|
+
candidate['inbox_capacity'];
|
|
10521
10474
|
if (inboxValue !== undefined) {
|
|
10522
10475
|
if (typeof inboxValue !== 'number' ||
|
|
10523
10476
|
!Number.isFinite(inboxValue) ||
|
|
@@ -10526,7 +10479,8 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
10526
10479
|
}
|
|
10527
10480
|
result.inboxCapacity = Math.floor(inboxValue);
|
|
10528
10481
|
}
|
|
10529
|
-
const windowValue = candidate.initialWindow ??
|
|
10482
|
+
const windowValue = candidate.initialWindow ??
|
|
10483
|
+
candidate['initial_window'];
|
|
10530
10484
|
if (windowValue !== undefined) {
|
|
10531
10485
|
if (typeof windowValue !== 'number' ||
|
|
10532
10486
|
!Number.isFinite(windowValue) ||
|
|
@@ -10863,25 +10817,56 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10863
10817
|
await connector.start(this.wrappedHandler);
|
|
10864
10818
|
this.connector = connector;
|
|
10865
10819
|
const callbackGrants = this.node.gatherSupportedCallbackGrants();
|
|
10820
|
+
logger$Z.debug('callback_grants_before_augmentation', {
|
|
10821
|
+
count: callbackGrants.length,
|
|
10822
|
+
types: callbackGrants.map((g) => g.type),
|
|
10823
|
+
});
|
|
10824
|
+
// Check if we should create a broadcast callback grant before processing connection grants
|
|
10825
|
+
// This prevents adding duplicate broadcast grants
|
|
10826
|
+
const shouldAddBroadcastGrant = this.shouldAdvertiseBroadcastGrant(grant, callbackGrants);
|
|
10827
|
+
const broadcastCallbackGrant = shouldAddBroadcastGrant
|
|
10828
|
+
? this.createBroadcastCallbackGrant(grant)
|
|
10829
|
+
: null;
|
|
10830
|
+
logger$Z.debug('broadcast_callback_grant_check', {
|
|
10831
|
+
should_add: shouldAddBroadcastGrant,
|
|
10832
|
+
grant_created: !!broadcastCallbackGrant,
|
|
10833
|
+
});
|
|
10866
10834
|
// Include admission client's connection grants as callback grants
|
|
10867
10835
|
// This ensures DirectAdmissionClient grants are available for grant selection
|
|
10868
|
-
if (welcome.frame.connectionGrants &&
|
|
10836
|
+
if (welcome.frame.connectionGrants &&
|
|
10837
|
+
Array.isArray(welcome.frame.connectionGrants)) {
|
|
10869
10838
|
for (const grant of welcome.frame.connectionGrants) {
|
|
10870
10839
|
if (grant && typeof grant === 'object') {
|
|
10871
10840
|
// Avoid duplicates by checking if grant already exists
|
|
10872
|
-
const isDuplicate = callbackGrants.some(existing => JSON.stringify(existing) === JSON.stringify(grant));
|
|
10841
|
+
const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
|
|
10873
10842
|
if (!isDuplicate) {
|
|
10874
10843
|
callbackGrants.push(grant);
|
|
10844
|
+
logger$Z.debug('added_connection_grant_as_callback', {
|
|
10845
|
+
type: grant.type,
|
|
10846
|
+
});
|
|
10847
|
+
}
|
|
10848
|
+
else {
|
|
10849
|
+
logger$Z.debug('skipped_duplicate_connection_grant', {
|
|
10850
|
+
type: grant.type,
|
|
10851
|
+
});
|
|
10875
10852
|
}
|
|
10876
10853
|
}
|
|
10877
10854
|
}
|
|
10878
10855
|
}
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10856
|
+
// Add broadcast grant after connection grants to ensure we don't duplicate
|
|
10857
|
+
// any broadcast grants that may have been in connectionGrants
|
|
10858
|
+
if (broadcastCallbackGrant &&
|
|
10859
|
+
this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
|
|
10860
|
+
callbackGrants.push(broadcastCallbackGrant);
|
|
10861
|
+
logger$Z.debug('added_broadcast_callback_grant');
|
|
10884
10862
|
}
|
|
10863
|
+
else if (broadcastCallbackGrant) {
|
|
10864
|
+
logger$Z.debug('skipped_duplicate_broadcast_callback_grant');
|
|
10865
|
+
}
|
|
10866
|
+
logger$Z.debug('callback_grants_after_augmentation', {
|
|
10867
|
+
count: callbackGrants.length,
|
|
10868
|
+
types: callbackGrants.map((g) => g.type),
|
|
10869
|
+
});
|
|
10885
10870
|
const attachInfo = await this.attachClient.attach(this.node, this.outboundOriginType, connector, welcome.frame, this.wrappedHandler, this.getKeys() ?? undefined, callbackGrants);
|
|
10886
10871
|
this.targetSystemId = attachInfo.targetSystemId ?? null;
|
|
10887
10872
|
if (this.targetSystemId) {
|
|
@@ -11122,7 +11107,8 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11122
11107
|
continue;
|
|
11123
11108
|
}
|
|
11124
11109
|
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
11125
|
-
if (previousState === core.ConnectorState.PAUSED &&
|
|
11110
|
+
if (previousState === core.ConnectorState.PAUSED &&
|
|
11111
|
+
currentState === core.ConnectorState.STARTED) {
|
|
11126
11112
|
logger$Z.debug('connector_just_resumed_resetting_ack_time', {
|
|
11127
11113
|
previous_state: previousState,
|
|
11128
11114
|
current_state: currentState,
|
|
@@ -12679,15 +12665,30 @@ class DefaultNodeAttachClient {
|
|
|
12679
12665
|
constructor(options = {}) {
|
|
12680
12666
|
this.buffer = [];
|
|
12681
12667
|
this.inHandshake = false;
|
|
12668
|
+
this.expectedSystemId = null;
|
|
12682
12669
|
this.timeoutMs = options.timeoutMs ?? 10000;
|
|
12683
12670
|
this.attachmentKeyValidator = options.attachmentKeyValidator;
|
|
12684
12671
|
this.replicaStickinessManager = options.replicaStickinessManager ?? null;
|
|
12685
12672
|
}
|
|
12686
12673
|
async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
|
|
12687
12674
|
this.inHandshake = true;
|
|
12675
|
+
this.expectedSystemId = welcomeFrame.systemId;
|
|
12688
12676
|
const interimHandler = async (envelope, context) => {
|
|
12689
12677
|
if (this.inHandshake) {
|
|
12690
|
-
|
|
12678
|
+
// Filter: only buffer frames related to our systemId or frames without systemId info
|
|
12679
|
+
const frameSystemId = envelope.frame
|
|
12680
|
+
?.systemId;
|
|
12681
|
+
if (!frameSystemId || frameSystemId === this.expectedSystemId) {
|
|
12682
|
+
this.buffer.push(envelope);
|
|
12683
|
+
}
|
|
12684
|
+
else {
|
|
12685
|
+
// Silently ignore frames from other agents during concurrent handshakes
|
|
12686
|
+
logger$W.debug('handshake_ignoring_frame_from_different_system', {
|
|
12687
|
+
frame_type: envelope.frame.type,
|
|
12688
|
+
frame_system_id: frameSystemId,
|
|
12689
|
+
expected_system_id: this.expectedSystemId,
|
|
12690
|
+
});
|
|
12691
|
+
}
|
|
12691
12692
|
return null;
|
|
12692
12693
|
}
|
|
12693
12694
|
return finalHandler(envelope, context);
|
|
@@ -12814,6 +12815,7 @@ class DefaultNodeAttachClient {
|
|
|
12814
12815
|
parent_id: ackFrame.targetSystemId,
|
|
12815
12816
|
});
|
|
12816
12817
|
this.inHandshake = false;
|
|
12818
|
+
this.expectedSystemId = null;
|
|
12817
12819
|
await connector.replaceHandler(finalHandler);
|
|
12818
12820
|
while (this.buffer.length > 0) {
|
|
12819
12821
|
const bufferedEnvelope = this.buffer.shift();
|
|
@@ -12871,7 +12873,8 @@ class DefaultNodeAttachClient {
|
|
|
12871
12873
|
const deadline = Date.now() + this.timeoutMs;
|
|
12872
12874
|
while (Date.now() < deadline) {
|
|
12873
12875
|
// Allow both STARTED and PAUSED states (PAUSED = tab hidden but connection alive)
|
|
12874
|
-
if (connector.state !== core.ConnectorState.STARTED &&
|
|
12876
|
+
if (connector.state !== core.ConnectorState.STARTED &&
|
|
12877
|
+
connector.state !== core.ConnectorState.PAUSED) {
|
|
12875
12878
|
let errorMessage = 'Connector closed while waiting for NodeAttachAck';
|
|
12876
12879
|
if (connector.closeCode !== undefined) {
|
|
12877
12880
|
errorMessage += ` (code=${connector.closeCode}`;
|
|
@@ -12890,9 +12893,21 @@ class DefaultNodeAttachClient {
|
|
|
12890
12893
|
if (envelope.frame.type === 'NodeAttachAck') {
|
|
12891
12894
|
return envelope;
|
|
12892
12895
|
}
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
+
// NodeAttach frames during handshake are expected in multi-agent scenarios
|
|
12897
|
+
// where multiple agents attach concurrently to the same channel
|
|
12898
|
+
if (envelope.frame.type === 'NodeAttach') {
|
|
12899
|
+
logger$W.debug('handshake_ignoring_concurrent_attach', {
|
|
12900
|
+
frame_type: envelope.frame.type,
|
|
12901
|
+
frame_system_id: envelope.frame?.systemId ??
|
|
12902
|
+
'unknown',
|
|
12903
|
+
});
|
|
12904
|
+
}
|
|
12905
|
+
else {
|
|
12906
|
+
// Other unexpected frames are still logged as errors
|
|
12907
|
+
logger$W.error('unexpected_frame_during_handshake', {
|
|
12908
|
+
frame_type: envelope.frame.type,
|
|
12909
|
+
});
|
|
12910
|
+
}
|
|
12896
12911
|
}
|
|
12897
12912
|
await delay(HANDSHAKE_POLL_INTERVAL_MS);
|
|
12898
12913
|
}
|
|
@@ -13611,7 +13626,8 @@ function createFsShim() {
|
|
|
13611
13626
|
else if (options &&
|
|
13612
13627
|
typeof options === 'object' &&
|
|
13613
13628
|
'encoding' in options &&
|
|
13614
|
-
typeof options.encoding ===
|
|
13629
|
+
typeof options.encoding ===
|
|
13630
|
+
'string') {
|
|
13615
13631
|
encoding = options.encoding;
|
|
13616
13632
|
}
|
|
13617
13633
|
const data = fsBinding.readFileUtf8(pathOrDescriptor, 0);
|
|
@@ -20544,7 +20560,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20544
20560
|
this.listenerRegistered = false;
|
|
20545
20561
|
this.visibilityChangeListenerRegistered = false;
|
|
20546
20562
|
this.channelName =
|
|
20547
|
-
typeof config.channelName === 'string' &&
|
|
20563
|
+
typeof config.channelName === 'string' &&
|
|
20564
|
+
config.channelName.trim().length > 0
|
|
20548
20565
|
? config.channelName.trim()
|
|
20549
20566
|
: DEFAULT_CHANNEL$6;
|
|
20550
20567
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -20583,7 +20600,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20583
20600
|
channel: this.channelName,
|
|
20584
20601
|
connector_id: this.connectorId,
|
|
20585
20602
|
message_type: message && typeof message === 'object'
|
|
20586
|
-
? message.constructor
|
|
20603
|
+
? (message.constructor
|
|
20604
|
+
?.name ?? typeof message)
|
|
20587
20605
|
: typeof message,
|
|
20588
20606
|
has_sender_id: Boolean(message?.senderId),
|
|
20589
20607
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -20592,7 +20610,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20592
20610
|
return;
|
|
20593
20611
|
}
|
|
20594
20612
|
const busMessage = message;
|
|
20595
|
-
const senderId = typeof busMessage.senderId === 'string' &&
|
|
20613
|
+
const senderId = typeof busMessage.senderId === 'string' &&
|
|
20614
|
+
busMessage.senderId.length > 0
|
|
20596
20615
|
? busMessage.senderId
|
|
20597
20616
|
: null;
|
|
20598
20617
|
const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
|
|
@@ -20843,7 +20862,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20843
20862
|
timestamp: new Date().toISOString(),
|
|
20844
20863
|
});
|
|
20845
20864
|
}
|
|
20846
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
20865
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
20866
|
+
this.visibilityChangeHandler &&
|
|
20867
|
+
typeof document !== 'undefined') {
|
|
20847
20868
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
20848
20869
|
this.visibilityChangeListenerRegistered = false;
|
|
20849
20870
|
this.visibilityChangeHandler = undefined;
|
|
@@ -20860,7 +20881,7 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20860
20881
|
return rawOrEnvelope;
|
|
20861
20882
|
}
|
|
20862
20883
|
_isWildcardTarget() {
|
|
20863
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
20884
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
20864
20885
|
}
|
|
20865
20886
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
20866
20887
|
if (this._isWildcardTarget()) {
|
|
@@ -20880,7 +20901,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20880
20901
|
return true;
|
|
20881
20902
|
}
|
|
20882
20903
|
const expectedSender = this.targetNodeId;
|
|
20883
|
-
if (expectedSender &&
|
|
20904
|
+
if (expectedSender &&
|
|
20905
|
+
expectedSender !== '*' &&
|
|
20906
|
+
senderNodeId !== expectedSender) {
|
|
20884
20907
|
logger$G.debug('inpage_message_rejected', {
|
|
20885
20908
|
channel: this.channelName,
|
|
20886
20909
|
connector_id: this.connectorId,
|
|
@@ -21300,8 +21323,8 @@ class CertificateManagerFactory extends factory.AbstractResourceFactory {
|
|
|
21300
21323
|
}
|
|
21301
21324
|
}
|
|
21302
21325
|
|
|
21303
|
-
const DEFAULT_UNCONFIGURED_MESSAGE =
|
|
21304
|
-
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE =
|
|
21326
|
+
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.';
|
|
21327
|
+
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = 'TrustStoreProviderFactory';
|
|
21305
21328
|
class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
|
|
21306
21329
|
createUnconfiguredProvider(reason) {
|
|
21307
21330
|
return new NoopTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
@@ -25029,7 +25052,8 @@ class DefaultSecurityManager {
|
|
|
25029
25052
|
const hasSignature = Boolean(envelope.sec?.sig);
|
|
25030
25053
|
if (!hasSignature) {
|
|
25031
25054
|
const nodeSid = node.sid;
|
|
25032
|
-
const envelopeSid = envelope
|
|
25055
|
+
const envelopeSid = envelope
|
|
25056
|
+
.sid;
|
|
25033
25057
|
const isLocalUnsignedSelfEnvelope = localContext.originType === core.DeliveryOriginType.LOCAL &&
|
|
25034
25058
|
typeof nodeSid === 'string' &&
|
|
25035
25059
|
nodeSid.length > 0 &&
|
|
@@ -28309,14 +28333,16 @@ function normalizeInPageConnectionGrant(candidate) {
|
|
|
28309
28333
|
type,
|
|
28310
28334
|
purpose,
|
|
28311
28335
|
};
|
|
28312
|
-
const channelValue = candidate.channelName ??
|
|
28336
|
+
const channelValue = candidate.channelName ??
|
|
28337
|
+
candidate['channel_name'];
|
|
28313
28338
|
if (channelValue !== undefined) {
|
|
28314
28339
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
28315
28340
|
throw new TypeError('InPageConnectionGrant "channelName" must be a non-empty string when provided');
|
|
28316
28341
|
}
|
|
28317
28342
|
result.channelName = channelValue.trim();
|
|
28318
28343
|
}
|
|
28319
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
28344
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
28345
|
+
candidate['inbox_capacity'];
|
|
28320
28346
|
if (inboxValue !== undefined) {
|
|
28321
28347
|
if (typeof inboxValue !== 'number' ||
|
|
28322
28348
|
!Number.isFinite(inboxValue) ||
|
|
@@ -28944,7 +28970,8 @@ class InPageConnectorFactory extends ConnectorFactory {
|
|
|
28944
28970
|
const normalized = this._normalizeConfig(config);
|
|
28945
28971
|
const options = (factoryArgs[0] ?? {});
|
|
28946
28972
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
28947
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
28973
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
28974
|
+
normalizedLocalNodeFromConfig;
|
|
28948
28975
|
if (!localNodeId) {
|
|
28949
28976
|
throw new Error('InPageConnectorFactory requires a localNodeId from config or create() options');
|
|
28950
28977
|
}
|
|
@@ -29120,10 +29147,12 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29120
29147
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
29121
29148
|
};
|
|
29122
29149
|
const channelCandidate = record.channelName ?? record['channel_name'];
|
|
29123
|
-
if (typeof channelCandidate === 'string' &&
|
|
29150
|
+
if (typeof channelCandidate === 'string' &&
|
|
29151
|
+
channelCandidate.trim().length > 0) {
|
|
29124
29152
|
config.channelName = channelCandidate.trim();
|
|
29125
29153
|
}
|
|
29126
|
-
const inboxCandidate = record.inboxCapacity ??
|
|
29154
|
+
const inboxCandidate = record.inboxCapacity ??
|
|
29155
|
+
record['inbox_capacity'];
|
|
29127
29156
|
if (typeof inboxCandidate === 'number' &&
|
|
29128
29157
|
Number.isFinite(inboxCandidate) &&
|
|
29129
29158
|
inboxCandidate > 0) {
|
|
@@ -29147,9 +29176,11 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29147
29176
|
throw new Error('BroadcastChannelConnectorFactory requires a configuration');
|
|
29148
29177
|
}
|
|
29149
29178
|
const normalized = this._normalizeConfig(config);
|
|
29150
|
-
const options = (factoryArgs[0] ??
|
|
29179
|
+
const options = (factoryArgs[0] ??
|
|
29180
|
+
{});
|
|
29151
29181
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
29152
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29182
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29183
|
+
normalizedLocalNodeFromConfig;
|
|
29153
29184
|
if (!localNodeId) {
|
|
29154
29185
|
throw new Error('BroadcastChannelConnectorFactory requires a localNodeId from config or create() options');
|
|
29155
29186
|
}
|
|
@@ -29174,6 +29205,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29174
29205
|
inboxCapacity,
|
|
29175
29206
|
localNodeId,
|
|
29176
29207
|
initialTargetNodeId: resolvedTarget,
|
|
29208
|
+
passive: normalized.passive,
|
|
29177
29209
|
};
|
|
29178
29210
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
29179
29211
|
if (options.authorization) {
|
|
@@ -29212,6 +29244,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29212
29244
|
if (normalizedLocalNodeId) {
|
|
29213
29245
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
29214
29246
|
}
|
|
29247
|
+
if (typeof candidate.passive === 'boolean') {
|
|
29248
|
+
normalized.passive = candidate.passive;
|
|
29249
|
+
}
|
|
29215
29250
|
if (typeof candidate.flowControl === 'boolean') {
|
|
29216
29251
|
normalized.flowControl = candidate.flowControl;
|
|
29217
29252
|
}
|
|
@@ -29637,7 +29672,9 @@ class InPageListener extends TransportListener {
|
|
|
29637
29672
|
typeof channelCandidate === 'string' && channelCandidate.trim().length > 0
|
|
29638
29673
|
? channelCandidate.trim()
|
|
29639
29674
|
: DEFAULT_CHANNEL$3;
|
|
29640
|
-
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
29675
|
+
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
29676
|
+
Number.isFinite(inboxCandidate) &&
|
|
29677
|
+
inboxCandidate > 0
|
|
29641
29678
|
? Math.floor(inboxCandidate)
|
|
29642
29679
|
: DEFAULT_INBOX_CAPACITY$3;
|
|
29643
29680
|
this._inboxCapacity = normalizedCapacity;
|
|
@@ -29912,7 +29949,8 @@ class InPageListener extends TransportListener {
|
|
|
29912
29949
|
if (grant.type === INPAGE_CONNECTION_GRANT_TYPE) {
|
|
29913
29950
|
return inPageGrantToConnectorConfig(grant);
|
|
29914
29951
|
}
|
|
29915
|
-
if (typeof grant
|
|
29952
|
+
if (typeof grant
|
|
29953
|
+
?.toConnectorConfig === 'function') {
|
|
29916
29954
|
return grant.toConnectorConfig();
|
|
29917
29955
|
}
|
|
29918
29956
|
throw new Error(`Unsupported grant type: ${grant.type}`);
|
|
@@ -30066,7 +30104,9 @@ function normalizeConfig$r(config) {
|
|
|
30066
30104
|
: DEFAULT_CHANNEL$2;
|
|
30067
30105
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
30068
30106
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY$2;
|
|
30069
|
-
if (typeof rawInbox === 'number' &&
|
|
30107
|
+
if (typeof rawInbox === 'number' &&
|
|
30108
|
+
Number.isFinite(rawInbox) &&
|
|
30109
|
+
rawInbox > 0) {
|
|
30070
30110
|
inboxCapacity = Math.floor(rawInbox);
|
|
30071
30111
|
}
|
|
30072
30112
|
else if (typeof rawInbox === 'string') {
|
|
@@ -30094,9 +30134,7 @@ class InPageListenerFactory extends TransportListenerFactory {
|
|
|
30094
30134
|
}
|
|
30095
30135
|
async create(config, ...factoryArgs) {
|
|
30096
30136
|
const normalized = normalizeConfig$r(config);
|
|
30097
|
-
const [{ InPageListener }] = await Promise.all([
|
|
30098
|
-
getInPageListenerModule(),
|
|
30099
|
-
]);
|
|
30137
|
+
const [{ InPageListener }] = await Promise.all([getInPageListenerModule()]);
|
|
30100
30138
|
return new InPageListener({
|
|
30101
30139
|
channelName: normalized.channelName,
|
|
30102
30140
|
inboxCapacity: normalized.inboxCapacity,
|
|
@@ -30114,9 +30152,7 @@ var inpageListenerFactory = /*#__PURE__*/Object.freeze({
|
|
|
30114
30152
|
const logger$o = getLogger('naylence.fame.connector.broadcast_channel_listener');
|
|
30115
30153
|
const DEFAULT_CHANNEL$1 = 'naylence-fabric';
|
|
30116
30154
|
const DEFAULT_INBOX_CAPACITY$1 = 2048;
|
|
30117
|
-
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK |
|
|
30118
|
-
core.FameResponseType.REPLY |
|
|
30119
|
-
core.FameResponseType.STREAM;
|
|
30155
|
+
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK | core.FameResponseType.REPLY | core.FameResponseType.STREAM;
|
|
30120
30156
|
const isBrowserEnvironment$1 = () => typeof window !== 'undefined' &&
|
|
30121
30157
|
typeof BroadcastChannel !== 'undefined' &&
|
|
30122
30158
|
typeof MessageEvent !== 'undefined';
|
|
@@ -30330,9 +30366,7 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
30330
30366
|
return null;
|
|
30331
30367
|
}
|
|
30332
30368
|
})();
|
|
30333
|
-
if (error instanceof zod.ZodError &&
|
|
30334
|
-
decoded &&
|
|
30335
|
-
decoded.length > 0) {
|
|
30369
|
+
if (error instanceof zod.ZodError && decoded && decoded.length > 0) {
|
|
30336
30370
|
try {
|
|
30337
30371
|
const reparsed = JSON.parse(decoded);
|
|
30338
30372
|
const candidate = reparsed.rtype;
|
|
@@ -30555,11 +30589,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
30555
30589
|
? Math.floor(initialWindowCandidate)
|
|
30556
30590
|
: undefined;
|
|
30557
30591
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
30592
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
30593
|
+
logger$o.debug('broadcast_channel_listener_building_connector_config', {
|
|
30594
|
+
system_id: systemId,
|
|
30595
|
+
channel_name: channelName,
|
|
30596
|
+
passive,
|
|
30597
|
+
has_base_config: !!baseConfig,
|
|
30598
|
+
passive_candidate: passiveCandidate,
|
|
30599
|
+
});
|
|
30558
30600
|
return {
|
|
30559
30601
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
30560
30602
|
channelName,
|
|
30561
30603
|
inboxCapacity,
|
|
30562
|
-
passive
|
|
30604
|
+
passive,
|
|
30563
30605
|
initialWindow,
|
|
30564
30606
|
localNodeId,
|
|
30565
30607
|
initialTargetNodeId,
|
|
@@ -30672,7 +30714,9 @@ function normalizeConfig$q(config) {
|
|
|
30672
30714
|
: DEFAULT_CHANNEL;
|
|
30673
30715
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
30674
30716
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY;
|
|
30675
|
-
if (typeof rawInbox === 'number' &&
|
|
30717
|
+
if (typeof rawInbox === 'number' &&
|
|
30718
|
+
Number.isFinite(rawInbox) &&
|
|
30719
|
+
rawInbox > 0) {
|
|
30676
30720
|
inboxCapacity = Math.floor(rawInbox);
|
|
30677
30721
|
}
|
|
30678
30722
|
else if (typeof rawInbox === 'string') {
|
|
@@ -34162,19 +34206,23 @@ function normalizeConfig$a(config) {
|
|
|
34162
34206
|
normalized.clientSecretConfig = normalizeSecretSource(clientSecretSource);
|
|
34163
34207
|
}
|
|
34164
34208
|
const audienceCandidate = candidate.audience ?? candidate.aud;
|
|
34165
|
-
if (typeof audienceCandidate === 'string' &&
|
|
34209
|
+
if (typeof audienceCandidate === 'string' &&
|
|
34210
|
+
audienceCandidate.trim().length > 0) {
|
|
34166
34211
|
normalized.audience = audienceCandidate.trim();
|
|
34167
34212
|
}
|
|
34168
34213
|
const codeChallengeMethod = candidate.codeChallengeMethod ?? candidate.code_challenge_method;
|
|
34169
|
-
if (typeof codeChallengeMethod === 'string' &&
|
|
34214
|
+
if (typeof codeChallengeMethod === 'string' &&
|
|
34215
|
+
codeChallengeMethod.trim().length > 0) {
|
|
34170
34216
|
normalized.codeChallengeMethod = codeChallengeMethod.trim();
|
|
34171
34217
|
}
|
|
34172
34218
|
const codeVerifierLength = candidate.codeVerifierLength ?? candidate.code_verifier_length;
|
|
34173
|
-
if (typeof codeVerifierLength === 'number' &&
|
|
34219
|
+
if (typeof codeVerifierLength === 'number' &&
|
|
34220
|
+
Number.isFinite(codeVerifierLength)) {
|
|
34174
34221
|
normalized.codeVerifierLength = codeVerifierLength;
|
|
34175
34222
|
}
|
|
34176
34223
|
const clockSkewSeconds = candidate.clockSkewSeconds ?? candidate.clock_skew_seconds;
|
|
34177
|
-
if (typeof clockSkewSeconds === 'number' &&
|
|
34224
|
+
if (typeof clockSkewSeconds === 'number' &&
|
|
34225
|
+
Number.isFinite(clockSkewSeconds)) {
|
|
34178
34226
|
normalized.clockSkewSeconds = clockSkewSeconds;
|
|
34179
34227
|
}
|
|
34180
34228
|
const loginHintParam = candidate.loginHintParam ?? candidate.login_hint_param;
|
|
@@ -34219,8 +34267,8 @@ class OAuth2PkceTokenProviderFactory extends TokenProviderFactory {
|
|
|
34219
34267
|
options.audience = normalized.audience;
|
|
34220
34268
|
}
|
|
34221
34269
|
if (normalized.codeChallengeMethod) {
|
|
34222
|
-
options.codeChallengeMethod =
|
|
34223
|
-
.toUpperCase();
|
|
34270
|
+
options.codeChallengeMethod =
|
|
34271
|
+
normalized.codeChallengeMethod.toUpperCase();
|
|
34224
34272
|
}
|
|
34225
34273
|
if (normalized.codeVerifierLength) {
|
|
34226
34274
|
options.codeVerifierLength = normalized.codeVerifierLength;
|
|
@@ -35977,14 +36025,14 @@ var eddsaEnvelopeVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
|
35977
36025
|
|
|
35978
36026
|
const FACTORY_META$d = {
|
|
35979
36027
|
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
35980
|
-
key:
|
|
36028
|
+
key: 'NoopTrustStoreProvider',
|
|
35981
36029
|
isDefault: true,
|
|
35982
36030
|
priority: 10,
|
|
35983
36031
|
};
|
|
35984
36032
|
class NoopTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
35985
36033
|
constructor() {
|
|
35986
36034
|
super(...arguments);
|
|
35987
|
-
this.type =
|
|
36035
|
+
this.type = 'NoopTrustStoreProvider';
|
|
35988
36036
|
this.isDefault = true;
|
|
35989
36037
|
this.priority = 10;
|
|
35990
36038
|
}
|
|
@@ -39378,8 +39426,7 @@ function normalizeOptions$2(raw) {
|
|
|
39378
39426
|
const scopes = normalizeScopes(camel.scopes) ??
|
|
39379
39427
|
normalizeScopes(snake.scopes ?? snake.scope) ??
|
|
39380
39428
|
DEFAULT_SCOPES.slice();
|
|
39381
|
-
const audience = coerceString(camel.audience) ??
|
|
39382
|
-
coerceString(snake.audience ?? snake.aud);
|
|
39429
|
+
const audience = coerceString(camel.audience) ?? coerceString(snake.audience ?? snake.aud);
|
|
39383
39430
|
const fetchImpl = (camel.fetchImpl ?? snake.fetch_impl);
|
|
39384
39431
|
const clockSkewSeconds = coerceNumber(camel.clockSkewSeconds) ??
|
|
39385
39432
|
coerceNumber(snake.clock_skew_seconds) ??
|
|
@@ -41161,6 +41208,7 @@ exports.registerRuntimeFactories = registerRuntimeFactories;
|
|
|
41161
41208
|
exports.requireCryptoSupport = requireCryptoSupport;
|
|
41162
41209
|
exports.retryWithBackoff = retryWithBackoff;
|
|
41163
41210
|
exports.safeColor = safeColor;
|
|
41211
|
+
exports.safeImport = safeImport;
|
|
41164
41212
|
exports.sealedDecrypt = sealedDecrypt;
|
|
41165
41213
|
exports.sealedEncrypt = sealedEncrypt;
|
|
41166
41214
|
exports.secureDigest = secureDigest;
|