@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/index.cjs
CHANGED
|
@@ -14,12 +14,12 @@ var fastify = require('fastify');
|
|
|
14
14
|
var websocketPlugin = require('@fastify/websocket');
|
|
15
15
|
|
|
16
16
|
// This file is auto-generated during build - do not edit manually
|
|
17
|
-
// Generated from package.json version: 0.3.
|
|
17
|
+
// Generated from package.json version: 0.3.7
|
|
18
18
|
/**
|
|
19
19
|
* The package version, injected at build time.
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
const VERSION = '0.3.
|
|
22
|
+
const VERSION = '0.3.7';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -2248,6 +2248,50 @@ function validateKeyCorrelationTtlSec(ttlSec) {
|
|
|
2248
2248
|
});
|
|
2249
2249
|
}
|
|
2250
2250
|
|
|
2251
|
+
function isModuleNotFoundError(error) {
|
|
2252
|
+
if (!(error instanceof Error)) {
|
|
2253
|
+
return false;
|
|
2254
|
+
}
|
|
2255
|
+
const message = error.message || '';
|
|
2256
|
+
if (message.includes('Cannot find module') ||
|
|
2257
|
+
message.includes('ERR_MODULE_NOT_FOUND') ||
|
|
2258
|
+
message.includes('MODULE_NOT_FOUND')) {
|
|
2259
|
+
return true;
|
|
2260
|
+
}
|
|
2261
|
+
const code = error.code;
|
|
2262
|
+
if (typeof code === 'string') {
|
|
2263
|
+
return code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND';
|
|
2264
|
+
}
|
|
2265
|
+
return false;
|
|
2266
|
+
}
|
|
2267
|
+
/**
|
|
2268
|
+
* Wraps a dynamic import loader and enriches "module not found" failures with an actionable error message.
|
|
2269
|
+
*/
|
|
2270
|
+
async function safeImport(loader, dependencyNameOrOptions, maybeOptions) {
|
|
2271
|
+
const options = typeof dependencyNameOrOptions === 'string'
|
|
2272
|
+
? { dependencyName: dependencyNameOrOptions, ...(maybeOptions ?? {}) }
|
|
2273
|
+
: dependencyNameOrOptions;
|
|
2274
|
+
const dependencyName = options.dependencyName;
|
|
2275
|
+
try {
|
|
2276
|
+
return await loader();
|
|
2277
|
+
}
|
|
2278
|
+
catch (error) {
|
|
2279
|
+
if (isModuleNotFoundError(error)) {
|
|
2280
|
+
const message = options.helpMessage ??
|
|
2281
|
+
`Missing optional dependency "${dependencyName}". Install it to enable this feature.`;
|
|
2282
|
+
const enrichedError = new Error(message);
|
|
2283
|
+
try {
|
|
2284
|
+
enrichedError.cause = error;
|
|
2285
|
+
}
|
|
2286
|
+
catch {
|
|
2287
|
+
// Ignore environments that do not support attaching a cause.
|
|
2288
|
+
}
|
|
2289
|
+
throw enrichedError;
|
|
2290
|
+
}
|
|
2291
|
+
throw error;
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2251
2295
|
/**
|
|
2252
2296
|
* flow_controller.ts - credit window management with cooperative back-pressure.
|
|
2253
2297
|
*
|
|
@@ -3452,50 +3496,6 @@ function normalizeSecretSource(value) {
|
|
|
3452
3496
|
return SecretSource.normalize(value);
|
|
3453
3497
|
}
|
|
3454
3498
|
|
|
3455
|
-
function isModuleNotFoundError(error) {
|
|
3456
|
-
if (!(error instanceof Error)) {
|
|
3457
|
-
return false;
|
|
3458
|
-
}
|
|
3459
|
-
const message = error.message || '';
|
|
3460
|
-
if (message.includes('Cannot find module') ||
|
|
3461
|
-
message.includes('ERR_MODULE_NOT_FOUND') ||
|
|
3462
|
-
message.includes('MODULE_NOT_FOUND')) {
|
|
3463
|
-
return true;
|
|
3464
|
-
}
|
|
3465
|
-
const code = error.code;
|
|
3466
|
-
if (typeof code === 'string') {
|
|
3467
|
-
return code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND';
|
|
3468
|
-
}
|
|
3469
|
-
return false;
|
|
3470
|
-
}
|
|
3471
|
-
/**
|
|
3472
|
-
* Wraps a dynamic import loader and enriches "module not found" failures with an actionable error message.
|
|
3473
|
-
*/
|
|
3474
|
-
async function safeImport(loader, dependencyNameOrOptions, maybeOptions) {
|
|
3475
|
-
const options = typeof dependencyNameOrOptions === 'string'
|
|
3476
|
-
? { dependencyName: dependencyNameOrOptions, ...(maybeOptions ?? {}) }
|
|
3477
|
-
: dependencyNameOrOptions;
|
|
3478
|
-
const dependencyName = options.dependencyName;
|
|
3479
|
-
try {
|
|
3480
|
-
return await loader();
|
|
3481
|
-
}
|
|
3482
|
-
catch (error) {
|
|
3483
|
-
if (isModuleNotFoundError(error)) {
|
|
3484
|
-
const message = options.helpMessage ??
|
|
3485
|
-
`Missing optional dependency "${dependencyName}". Install it to enable this feature.`;
|
|
3486
|
-
const enrichedError = new Error(message);
|
|
3487
|
-
try {
|
|
3488
|
-
enrichedError.cause = error;
|
|
3489
|
-
}
|
|
3490
|
-
catch {
|
|
3491
|
-
// Ignore environments that do not support attaching a cause.
|
|
3492
|
-
}
|
|
3493
|
-
throw enrichedError;
|
|
3494
|
-
}
|
|
3495
|
-
throw error;
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
|
|
3499
3499
|
const indexedDBConfigSchema = zod.z
|
|
3500
3500
|
.object({
|
|
3501
3501
|
type: zod.z
|
|
@@ -7091,9 +7091,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7091
7091
|
this.ackDoneSince = new Map();
|
|
7092
7092
|
this.replyDoneSince = new Map();
|
|
7093
7093
|
this.pendingAckDispatches = new Set();
|
|
7094
|
-
this.recentlyHandled = new Map();
|
|
7095
|
-
this.recentlyHandledOrder = [];
|
|
7096
|
-
this.recentlyHandledTtlMs = 60000;
|
|
7097
7094
|
this.isPreparingToStop = false;
|
|
7098
7095
|
this.shutdownRequestedAtMs = null;
|
|
7099
7096
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -7315,22 +7312,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7315
7312
|
}
|
|
7316
7313
|
}
|
|
7317
7314
|
else {
|
|
7318
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
7319
|
-
if (wasRecentlyHandled) {
|
|
7320
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
7321
|
-
envp_id: envelope.id,
|
|
7322
|
-
});
|
|
7323
|
-
return new TrackedEnvelope({
|
|
7324
|
-
timeoutAtMs: 0,
|
|
7325
|
-
overallTimeoutAtMs: 0,
|
|
7326
|
-
expectedResponseType: envelope.rtype ?? core.FameResponseType.NONE,
|
|
7327
|
-
createdAtMs: Date.now(),
|
|
7328
|
-
status: EnvelopeStatus.HANDLED,
|
|
7329
|
-
mailboxType: MailboxType.INBOX,
|
|
7330
|
-
originalEnvelope: envelope,
|
|
7331
|
-
serviceName: inboxName,
|
|
7332
|
-
});
|
|
7333
|
-
}
|
|
7334
7315
|
tracked = new TrackedEnvelope({
|
|
7335
7316
|
timeoutAtMs: 0,
|
|
7336
7317
|
overallTimeoutAtMs: 0,
|
|
@@ -7352,12 +7333,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7352
7333
|
async onEnvelopeHandled(envelope) {
|
|
7353
7334
|
const inbox = this.ensureInbox();
|
|
7354
7335
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
7336
|
+
// Delete the envelope from inbox to prevent growth
|
|
7355
7337
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
7356
|
-
await this.lock.runExclusive(async () => {
|
|
7357
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
7358
|
-
});
|
|
7359
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
7360
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
7361
7338
|
}
|
|
7362
7339
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
7363
7340
|
const inbox = this.ensureInbox();
|
|
@@ -7572,9 +7549,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7572
7549
|
});
|
|
7573
7550
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
7574
7551
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7552
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
7553
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
7554
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
7578
7555
|
for (const handler of this.eventHandlers) {
|
|
7579
7556
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
7580
7557
|
}
|
|
@@ -7724,8 +7701,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7724
7701
|
}
|
|
7725
7702
|
this.streamDone.clear();
|
|
7726
7703
|
this.correlationToEnvelope.clear();
|
|
7727
|
-
this.recentlyHandled.clear();
|
|
7728
|
-
this.recentlyHandledOrder.length = 0;
|
|
7729
7704
|
return values;
|
|
7730
7705
|
});
|
|
7731
7706
|
for (const timer of timers) {
|
|
@@ -8307,39 +8282,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8307
8282
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
8308
8283
|
}
|
|
8309
8284
|
}
|
|
8310
|
-
markRecentlyHandled(envelopeId) {
|
|
8311
|
-
const now = Date.now();
|
|
8312
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
8313
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
8314
|
-
this.trimRecentlyHandled(now);
|
|
8315
|
-
}
|
|
8316
|
-
wasRecentlyHandled(envelopeId) {
|
|
8317
|
-
const now = Date.now();
|
|
8318
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
8319
|
-
if (timestamp === undefined) {
|
|
8320
|
-
return false;
|
|
8321
|
-
}
|
|
8322
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
8323
|
-
this.recentlyHandled.delete(envelopeId);
|
|
8324
|
-
return false;
|
|
8325
|
-
}
|
|
8326
|
-
return true;
|
|
8327
|
-
}
|
|
8328
|
-
trimRecentlyHandled(now) {
|
|
8329
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
8330
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
8331
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
8332
|
-
if (timestamp === undefined) {
|
|
8333
|
-
this.recentlyHandledOrder.shift();
|
|
8334
|
-
continue;
|
|
8335
|
-
}
|
|
8336
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
8337
|
-
break;
|
|
8338
|
-
}
|
|
8339
|
-
this.recentlyHandled.delete(candidate);
|
|
8340
|
-
this.recentlyHandledOrder.shift();
|
|
8341
|
-
}
|
|
8342
|
-
}
|
|
8343
8285
|
getShutdownRetryDeferDelay(nowMs) {
|
|
8344
8286
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
8345
8287
|
return null;
|
|
@@ -9833,7 +9775,8 @@ const ensureBroadcastEnvironment = () => {
|
|
|
9833
9775
|
};
|
|
9834
9776
|
let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
9835
9777
|
static generateConnectorId() {
|
|
9836
|
-
const globalCrypto = globalThis
|
|
9778
|
+
const globalCrypto = globalThis
|
|
9779
|
+
.crypto;
|
|
9837
9780
|
if (globalCrypto?.randomUUID) {
|
|
9838
9781
|
return globalCrypto.randomUUID();
|
|
9839
9782
|
}
|
|
@@ -9888,7 +9831,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9888
9831
|
this.listenerRegistered = false;
|
|
9889
9832
|
this.visibilityChangeListenerRegistered = false;
|
|
9890
9833
|
this.channelName =
|
|
9891
|
-
typeof config.channelName === 'string' &&
|
|
9834
|
+
typeof config.channelName === 'string' &&
|
|
9835
|
+
config.channelName.trim().length > 0
|
|
9892
9836
|
? config.channelName.trim()
|
|
9893
9837
|
: DEFAULT_CHANNEL$7;
|
|
9894
9838
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -9912,6 +9856,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9912
9856
|
local_node_id: this.localNodeId,
|
|
9913
9857
|
target_node_id: this.targetNodeId ?? null,
|
|
9914
9858
|
inbox_capacity: preferredCapacity,
|
|
9859
|
+
passive: config.passive ?? false,
|
|
9915
9860
|
timestamp: new Date().toISOString(),
|
|
9916
9861
|
});
|
|
9917
9862
|
this.onMsg = (event) => {
|
|
@@ -9929,7 +9874,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9929
9874
|
channel: this.channelName,
|
|
9930
9875
|
connector_id: this.connectorId,
|
|
9931
9876
|
message_type: message && typeof message === 'object'
|
|
9932
|
-
? message.constructor
|
|
9877
|
+
? (message.constructor
|
|
9878
|
+
?.name ?? typeof message)
|
|
9933
9879
|
: typeof message,
|
|
9934
9880
|
has_sender_id: Boolean(message?.senderId),
|
|
9935
9881
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -10159,7 +10105,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10159
10105
|
timestamp: new Date().toISOString(),
|
|
10160
10106
|
});
|
|
10161
10107
|
}
|
|
10162
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
10108
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
10109
|
+
this.visibilityChangeHandler &&
|
|
10110
|
+
typeof document !== 'undefined') {
|
|
10163
10111
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
10164
10112
|
this.visibilityChangeListenerRegistered = false;
|
|
10165
10113
|
this.visibilityChangeHandler = undefined;
|
|
@@ -10187,7 +10135,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10187
10135
|
return rawOrEnvelope;
|
|
10188
10136
|
}
|
|
10189
10137
|
_isWildcardTarget() {
|
|
10190
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
10138
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
10191
10139
|
}
|
|
10192
10140
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
10193
10141
|
if (this._isWildcardTarget()) {
|
|
@@ -10207,7 +10155,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10207
10155
|
return true;
|
|
10208
10156
|
}
|
|
10209
10157
|
const expectedSender = this.targetNodeId;
|
|
10210
|
-
if (expectedSender &&
|
|
10158
|
+
if (expectedSender &&
|
|
10159
|
+
expectedSender !== '*' &&
|
|
10160
|
+
senderNodeId !== expectedSender) {
|
|
10211
10161
|
logger$_.debug('broadcast_channel_message_rejected', {
|
|
10212
10162
|
channel: this.channelName,
|
|
10213
10163
|
connector_id: this.connectorId,
|
|
@@ -10426,14 +10376,16 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
10426
10376
|
type,
|
|
10427
10377
|
purpose,
|
|
10428
10378
|
};
|
|
10429
|
-
const channelValue = candidate.channelName ??
|
|
10379
|
+
const channelValue = candidate.channelName ??
|
|
10380
|
+
candidate['channel_name'];
|
|
10430
10381
|
if (channelValue !== undefined) {
|
|
10431
10382
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
10432
10383
|
throw new TypeError('BroadcastChannelConnectionGrant "channelName" must be a non-empty string when provided');
|
|
10433
10384
|
}
|
|
10434
10385
|
result.channelName = channelValue.trim();
|
|
10435
10386
|
}
|
|
10436
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
10387
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
10388
|
+
candidate['inbox_capacity'];
|
|
10437
10389
|
if (inboxValue !== undefined) {
|
|
10438
10390
|
if (typeof inboxValue !== 'number' ||
|
|
10439
10391
|
!Number.isFinite(inboxValue) ||
|
|
@@ -10442,7 +10394,8 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
10442
10394
|
}
|
|
10443
10395
|
result.inboxCapacity = Math.floor(inboxValue);
|
|
10444
10396
|
}
|
|
10445
|
-
const windowValue = candidate.initialWindow ??
|
|
10397
|
+
const windowValue = candidate.initialWindow ??
|
|
10398
|
+
candidate['initial_window'];
|
|
10446
10399
|
if (windowValue !== undefined) {
|
|
10447
10400
|
if (typeof windowValue !== 'number' ||
|
|
10448
10401
|
!Number.isFinite(windowValue) ||
|
|
@@ -10779,25 +10732,56 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10779
10732
|
await connector.start(this.wrappedHandler);
|
|
10780
10733
|
this.connector = connector;
|
|
10781
10734
|
const callbackGrants = this.node.gatherSupportedCallbackGrants();
|
|
10735
|
+
logger$Z.debug('callback_grants_before_augmentation', {
|
|
10736
|
+
count: callbackGrants.length,
|
|
10737
|
+
types: callbackGrants.map((g) => g.type),
|
|
10738
|
+
});
|
|
10739
|
+
// Check if we should create a broadcast callback grant before processing connection grants
|
|
10740
|
+
// This prevents adding duplicate broadcast grants
|
|
10741
|
+
const shouldAddBroadcastGrant = this.shouldAdvertiseBroadcastGrant(grant, callbackGrants);
|
|
10742
|
+
const broadcastCallbackGrant = shouldAddBroadcastGrant
|
|
10743
|
+
? this.createBroadcastCallbackGrant(grant)
|
|
10744
|
+
: null;
|
|
10745
|
+
logger$Z.debug('broadcast_callback_grant_check', {
|
|
10746
|
+
should_add: shouldAddBroadcastGrant,
|
|
10747
|
+
grant_created: !!broadcastCallbackGrant,
|
|
10748
|
+
});
|
|
10782
10749
|
// Include admission client's connection grants as callback grants
|
|
10783
10750
|
// This ensures DirectAdmissionClient grants are available for grant selection
|
|
10784
|
-
if (welcome.frame.connectionGrants &&
|
|
10751
|
+
if (welcome.frame.connectionGrants &&
|
|
10752
|
+
Array.isArray(welcome.frame.connectionGrants)) {
|
|
10785
10753
|
for (const grant of welcome.frame.connectionGrants) {
|
|
10786
10754
|
if (grant && typeof grant === 'object') {
|
|
10787
10755
|
// Avoid duplicates by checking if grant already exists
|
|
10788
|
-
const isDuplicate = callbackGrants.some(existing => JSON.stringify(existing) === JSON.stringify(grant));
|
|
10756
|
+
const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
|
|
10789
10757
|
if (!isDuplicate) {
|
|
10790
10758
|
callbackGrants.push(grant);
|
|
10759
|
+
logger$Z.debug('added_connection_grant_as_callback', {
|
|
10760
|
+
type: grant.type,
|
|
10761
|
+
});
|
|
10762
|
+
}
|
|
10763
|
+
else {
|
|
10764
|
+
logger$Z.debug('skipped_duplicate_connection_grant', {
|
|
10765
|
+
type: grant.type,
|
|
10766
|
+
});
|
|
10791
10767
|
}
|
|
10792
10768
|
}
|
|
10793
10769
|
}
|
|
10794
10770
|
}
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10771
|
+
// Add broadcast grant after connection grants to ensure we don't duplicate
|
|
10772
|
+
// any broadcast grants that may have been in connectionGrants
|
|
10773
|
+
if (broadcastCallbackGrant &&
|
|
10774
|
+
this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
|
|
10775
|
+
callbackGrants.push(broadcastCallbackGrant);
|
|
10776
|
+
logger$Z.debug('added_broadcast_callback_grant');
|
|
10800
10777
|
}
|
|
10778
|
+
else if (broadcastCallbackGrant) {
|
|
10779
|
+
logger$Z.debug('skipped_duplicate_broadcast_callback_grant');
|
|
10780
|
+
}
|
|
10781
|
+
logger$Z.debug('callback_grants_after_augmentation', {
|
|
10782
|
+
count: callbackGrants.length,
|
|
10783
|
+
types: callbackGrants.map((g) => g.type),
|
|
10784
|
+
});
|
|
10801
10785
|
const attachInfo = await this.attachClient.attach(this.node, this.outboundOriginType, connector, welcome.frame, this.wrappedHandler, this.getKeys() ?? undefined, callbackGrants);
|
|
10802
10786
|
this.targetSystemId = attachInfo.targetSystemId ?? null;
|
|
10803
10787
|
if (this.targetSystemId) {
|
|
@@ -11038,7 +11022,8 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11038
11022
|
continue;
|
|
11039
11023
|
}
|
|
11040
11024
|
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
11041
|
-
if (previousState === core.ConnectorState.PAUSED &&
|
|
11025
|
+
if (previousState === core.ConnectorState.PAUSED &&
|
|
11026
|
+
currentState === core.ConnectorState.STARTED) {
|
|
11042
11027
|
logger$Z.debug('connector_just_resumed_resetting_ack_time', {
|
|
11043
11028
|
previous_state: previousState,
|
|
11044
11029
|
current_state: currentState,
|
|
@@ -12595,15 +12580,30 @@ class DefaultNodeAttachClient {
|
|
|
12595
12580
|
constructor(options = {}) {
|
|
12596
12581
|
this.buffer = [];
|
|
12597
12582
|
this.inHandshake = false;
|
|
12583
|
+
this.expectedSystemId = null;
|
|
12598
12584
|
this.timeoutMs = options.timeoutMs ?? 10000;
|
|
12599
12585
|
this.attachmentKeyValidator = options.attachmentKeyValidator;
|
|
12600
12586
|
this.replicaStickinessManager = options.replicaStickinessManager ?? null;
|
|
12601
12587
|
}
|
|
12602
12588
|
async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
|
|
12603
12589
|
this.inHandshake = true;
|
|
12590
|
+
this.expectedSystemId = welcomeFrame.systemId;
|
|
12604
12591
|
const interimHandler = async (envelope, context) => {
|
|
12605
12592
|
if (this.inHandshake) {
|
|
12606
|
-
|
|
12593
|
+
// Filter: only buffer frames related to our systemId or frames without systemId info
|
|
12594
|
+
const frameSystemId = envelope.frame
|
|
12595
|
+
?.systemId;
|
|
12596
|
+
if (!frameSystemId || frameSystemId === this.expectedSystemId) {
|
|
12597
|
+
this.buffer.push(envelope);
|
|
12598
|
+
}
|
|
12599
|
+
else {
|
|
12600
|
+
// Silently ignore frames from other agents during concurrent handshakes
|
|
12601
|
+
logger$W.debug('handshake_ignoring_frame_from_different_system', {
|
|
12602
|
+
frame_type: envelope.frame.type,
|
|
12603
|
+
frame_system_id: frameSystemId,
|
|
12604
|
+
expected_system_id: this.expectedSystemId,
|
|
12605
|
+
});
|
|
12606
|
+
}
|
|
12607
12607
|
return null;
|
|
12608
12608
|
}
|
|
12609
12609
|
return finalHandler(envelope, context);
|
|
@@ -12730,6 +12730,7 @@ class DefaultNodeAttachClient {
|
|
|
12730
12730
|
parent_id: ackFrame.targetSystemId,
|
|
12731
12731
|
});
|
|
12732
12732
|
this.inHandshake = false;
|
|
12733
|
+
this.expectedSystemId = null;
|
|
12733
12734
|
await connector.replaceHandler(finalHandler);
|
|
12734
12735
|
while (this.buffer.length > 0) {
|
|
12735
12736
|
const bufferedEnvelope = this.buffer.shift();
|
|
@@ -12787,7 +12788,8 @@ class DefaultNodeAttachClient {
|
|
|
12787
12788
|
const deadline = Date.now() + this.timeoutMs;
|
|
12788
12789
|
while (Date.now() < deadline) {
|
|
12789
12790
|
// Allow both STARTED and PAUSED states (PAUSED = tab hidden but connection alive)
|
|
12790
|
-
if (connector.state !== core.ConnectorState.STARTED &&
|
|
12791
|
+
if (connector.state !== core.ConnectorState.STARTED &&
|
|
12792
|
+
connector.state !== core.ConnectorState.PAUSED) {
|
|
12791
12793
|
let errorMessage = 'Connector closed while waiting for NodeAttachAck';
|
|
12792
12794
|
if (connector.closeCode !== undefined) {
|
|
12793
12795
|
errorMessage += ` (code=${connector.closeCode}`;
|
|
@@ -12806,9 +12808,21 @@ class DefaultNodeAttachClient {
|
|
|
12806
12808
|
if (envelope.frame.type === 'NodeAttachAck') {
|
|
12807
12809
|
return envelope;
|
|
12808
12810
|
}
|
|
12809
|
-
|
|
12810
|
-
|
|
12811
|
-
|
|
12811
|
+
// NodeAttach frames during handshake are expected in multi-agent scenarios
|
|
12812
|
+
// where multiple agents attach concurrently to the same channel
|
|
12813
|
+
if (envelope.frame.type === 'NodeAttach') {
|
|
12814
|
+
logger$W.debug('handshake_ignoring_concurrent_attach', {
|
|
12815
|
+
frame_type: envelope.frame.type,
|
|
12816
|
+
frame_system_id: envelope.frame?.systemId ??
|
|
12817
|
+
'unknown',
|
|
12818
|
+
});
|
|
12819
|
+
}
|
|
12820
|
+
else {
|
|
12821
|
+
// Other unexpected frames are still logged as errors
|
|
12822
|
+
logger$W.error('unexpected_frame_during_handshake', {
|
|
12823
|
+
frame_type: envelope.frame.type,
|
|
12824
|
+
});
|
|
12825
|
+
}
|
|
12812
12826
|
}
|
|
12813
12827
|
await delay(HANDSHAKE_POLL_INTERVAL_MS);
|
|
12814
12828
|
}
|
|
@@ -13527,7 +13541,8 @@ function createFsShim() {
|
|
|
13527
13541
|
else if (options &&
|
|
13528
13542
|
typeof options === 'object' &&
|
|
13529
13543
|
'encoding' in options &&
|
|
13530
|
-
typeof options.encoding ===
|
|
13544
|
+
typeof options.encoding ===
|
|
13545
|
+
'string') {
|
|
13531
13546
|
encoding = options.encoding;
|
|
13532
13547
|
}
|
|
13533
13548
|
const data = fsBinding.readFileUtf8(pathOrDescriptor, 0);
|
|
@@ -20460,7 +20475,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20460
20475
|
this.listenerRegistered = false;
|
|
20461
20476
|
this.visibilityChangeListenerRegistered = false;
|
|
20462
20477
|
this.channelName =
|
|
20463
|
-
typeof config.channelName === 'string' &&
|
|
20478
|
+
typeof config.channelName === 'string' &&
|
|
20479
|
+
config.channelName.trim().length > 0
|
|
20464
20480
|
? config.channelName.trim()
|
|
20465
20481
|
: DEFAULT_CHANNEL$6;
|
|
20466
20482
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -20499,7 +20515,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20499
20515
|
channel: this.channelName,
|
|
20500
20516
|
connector_id: this.connectorId,
|
|
20501
20517
|
message_type: message && typeof message === 'object'
|
|
20502
|
-
? message.constructor
|
|
20518
|
+
? (message.constructor
|
|
20519
|
+
?.name ?? typeof message)
|
|
20503
20520
|
: typeof message,
|
|
20504
20521
|
has_sender_id: Boolean(message?.senderId),
|
|
20505
20522
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -20508,7 +20525,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20508
20525
|
return;
|
|
20509
20526
|
}
|
|
20510
20527
|
const busMessage = message;
|
|
20511
|
-
const senderId = typeof busMessage.senderId === 'string' &&
|
|
20528
|
+
const senderId = typeof busMessage.senderId === 'string' &&
|
|
20529
|
+
busMessage.senderId.length > 0
|
|
20512
20530
|
? busMessage.senderId
|
|
20513
20531
|
: null;
|
|
20514
20532
|
const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
|
|
@@ -20759,7 +20777,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20759
20777
|
timestamp: new Date().toISOString(),
|
|
20760
20778
|
});
|
|
20761
20779
|
}
|
|
20762
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
20780
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
20781
|
+
this.visibilityChangeHandler &&
|
|
20782
|
+
typeof document !== 'undefined') {
|
|
20763
20783
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
20764
20784
|
this.visibilityChangeListenerRegistered = false;
|
|
20765
20785
|
this.visibilityChangeHandler = undefined;
|
|
@@ -20776,7 +20796,7 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20776
20796
|
return rawOrEnvelope;
|
|
20777
20797
|
}
|
|
20778
20798
|
_isWildcardTarget() {
|
|
20779
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
20799
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
20780
20800
|
}
|
|
20781
20801
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
20782
20802
|
if (this._isWildcardTarget()) {
|
|
@@ -20796,7 +20816,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20796
20816
|
return true;
|
|
20797
20817
|
}
|
|
20798
20818
|
const expectedSender = this.targetNodeId;
|
|
20799
|
-
if (expectedSender &&
|
|
20819
|
+
if (expectedSender &&
|
|
20820
|
+
expectedSender !== '*' &&
|
|
20821
|
+
senderNodeId !== expectedSender) {
|
|
20800
20822
|
logger$G.debug('inpage_message_rejected', {
|
|
20801
20823
|
channel: this.channelName,
|
|
20802
20824
|
connector_id: this.connectorId,
|
|
@@ -21216,8 +21238,8 @@ class CertificateManagerFactory extends factory.AbstractResourceFactory {
|
|
|
21216
21238
|
}
|
|
21217
21239
|
}
|
|
21218
21240
|
|
|
21219
|
-
const DEFAULT_UNCONFIGURED_MESSAGE =
|
|
21220
|
-
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE =
|
|
21241
|
+
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.';
|
|
21242
|
+
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = 'TrustStoreProviderFactory';
|
|
21221
21243
|
class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
|
|
21222
21244
|
createUnconfiguredProvider(reason) {
|
|
21223
21245
|
return new NoopTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
@@ -24945,7 +24967,8 @@ class DefaultSecurityManager {
|
|
|
24945
24967
|
const hasSignature = Boolean(envelope.sec?.sig);
|
|
24946
24968
|
if (!hasSignature) {
|
|
24947
24969
|
const nodeSid = node.sid;
|
|
24948
|
-
const envelopeSid = envelope
|
|
24970
|
+
const envelopeSid = envelope
|
|
24971
|
+
.sid;
|
|
24949
24972
|
const isLocalUnsignedSelfEnvelope = localContext.originType === core.DeliveryOriginType.LOCAL &&
|
|
24950
24973
|
typeof nodeSid === 'string' &&
|
|
24951
24974
|
nodeSid.length > 0 &&
|
|
@@ -28225,14 +28248,16 @@ function normalizeInPageConnectionGrant(candidate) {
|
|
|
28225
28248
|
type,
|
|
28226
28249
|
purpose,
|
|
28227
28250
|
};
|
|
28228
|
-
const channelValue = candidate.channelName ??
|
|
28251
|
+
const channelValue = candidate.channelName ??
|
|
28252
|
+
candidate['channel_name'];
|
|
28229
28253
|
if (channelValue !== undefined) {
|
|
28230
28254
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
28231
28255
|
throw new TypeError('InPageConnectionGrant "channelName" must be a non-empty string when provided');
|
|
28232
28256
|
}
|
|
28233
28257
|
result.channelName = channelValue.trim();
|
|
28234
28258
|
}
|
|
28235
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
28259
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
28260
|
+
candidate['inbox_capacity'];
|
|
28236
28261
|
if (inboxValue !== undefined) {
|
|
28237
28262
|
if (typeof inboxValue !== 'number' ||
|
|
28238
28263
|
!Number.isFinite(inboxValue) ||
|
|
@@ -28838,10 +28863,12 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28838
28863
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
28839
28864
|
};
|
|
28840
28865
|
const channelCandidate = record.channelName ?? record['channel_name'];
|
|
28841
|
-
if (typeof channelCandidate === 'string' &&
|
|
28866
|
+
if (typeof channelCandidate === 'string' &&
|
|
28867
|
+
channelCandidate.trim().length > 0) {
|
|
28842
28868
|
config.channelName = channelCandidate.trim();
|
|
28843
28869
|
}
|
|
28844
|
-
const inboxCandidate = record.inboxCapacity ??
|
|
28870
|
+
const inboxCandidate = record.inboxCapacity ??
|
|
28871
|
+
record['inbox_capacity'];
|
|
28845
28872
|
if (typeof inboxCandidate === 'number' &&
|
|
28846
28873
|
Number.isFinite(inboxCandidate) &&
|
|
28847
28874
|
inboxCandidate > 0) {
|
|
@@ -28865,9 +28892,11 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28865
28892
|
throw new Error('BroadcastChannelConnectorFactory requires a configuration');
|
|
28866
28893
|
}
|
|
28867
28894
|
const normalized = this._normalizeConfig(config);
|
|
28868
|
-
const options = (factoryArgs[0] ??
|
|
28895
|
+
const options = (factoryArgs[0] ??
|
|
28896
|
+
{});
|
|
28869
28897
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
28870
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
28898
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
28899
|
+
normalizedLocalNodeFromConfig;
|
|
28871
28900
|
if (!localNodeId) {
|
|
28872
28901
|
throw new Error('BroadcastChannelConnectorFactory requires a localNodeId from config or create() options');
|
|
28873
28902
|
}
|
|
@@ -28892,6 +28921,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28892
28921
|
inboxCapacity,
|
|
28893
28922
|
localNodeId,
|
|
28894
28923
|
initialTargetNodeId: resolvedTarget,
|
|
28924
|
+
passive: normalized.passive,
|
|
28895
28925
|
};
|
|
28896
28926
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
28897
28927
|
if (options.authorization) {
|
|
@@ -28930,6 +28960,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28930
28960
|
if (normalizedLocalNodeId) {
|
|
28931
28961
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
28932
28962
|
}
|
|
28963
|
+
if (typeof candidate.passive === 'boolean') {
|
|
28964
|
+
normalized.passive = candidate.passive;
|
|
28965
|
+
}
|
|
28933
28966
|
if (typeof candidate.flowControl === 'boolean') {
|
|
28934
28967
|
normalized.flowControl = candidate.flowControl;
|
|
28935
28968
|
}
|
|
@@ -29010,7 +29043,9 @@ function normalizeConfig$r(config) {
|
|
|
29010
29043
|
: DEFAULT_CHANNEL$4;
|
|
29011
29044
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
29012
29045
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY$4;
|
|
29013
|
-
if (typeof rawInbox === 'number' &&
|
|
29046
|
+
if (typeof rawInbox === 'number' &&
|
|
29047
|
+
Number.isFinite(rawInbox) &&
|
|
29048
|
+
rawInbox > 0) {
|
|
29014
29049
|
inboxCapacity = Math.floor(rawInbox);
|
|
29015
29050
|
}
|
|
29016
29051
|
else if (typeof rawInbox === 'string') {
|
|
@@ -29527,7 +29562,8 @@ class InPageConnectorFactory extends ConnectorFactory {
|
|
|
29527
29562
|
const normalized = this._normalizeConfig(config);
|
|
29528
29563
|
const options = (factoryArgs[0] ?? {});
|
|
29529
29564
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
29530
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29565
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29566
|
+
normalizedLocalNodeFromConfig;
|
|
29531
29567
|
if (!localNodeId) {
|
|
29532
29568
|
throw new Error('InPageConnectorFactory requires a localNodeId from config or create() options');
|
|
29533
29569
|
}
|
|
@@ -29677,7 +29713,9 @@ function normalizeConfig$p(config) {
|
|
|
29677
29713
|
: DEFAULT_CHANNEL$2;
|
|
29678
29714
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
29679
29715
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY$2;
|
|
29680
|
-
if (typeof rawInbox === 'number' &&
|
|
29716
|
+
if (typeof rawInbox === 'number' &&
|
|
29717
|
+
Number.isFinite(rawInbox) &&
|
|
29718
|
+
rawInbox > 0) {
|
|
29681
29719
|
inboxCapacity = Math.floor(rawInbox);
|
|
29682
29720
|
}
|
|
29683
29721
|
else if (typeof rawInbox === 'string') {
|
|
@@ -29705,9 +29743,7 @@ class InPageListenerFactory extends TransportListenerFactory {
|
|
|
29705
29743
|
}
|
|
29706
29744
|
async create(config, ...factoryArgs) {
|
|
29707
29745
|
const normalized = normalizeConfig$p(config);
|
|
29708
|
-
const [{ InPageListener }] = await Promise.all([
|
|
29709
|
-
getInPageListenerModule(),
|
|
29710
|
-
]);
|
|
29746
|
+
const [{ InPageListener }] = await Promise.all([getInPageListenerModule()]);
|
|
29711
29747
|
return new InPageListener({
|
|
29712
29748
|
channelName: normalized.channelName,
|
|
29713
29749
|
inboxCapacity: normalized.inboxCapacity,
|
|
@@ -32758,19 +32794,23 @@ function normalizeConfig$a(config) {
|
|
|
32758
32794
|
normalized.clientSecretConfig = normalizeSecretSource(clientSecretSource);
|
|
32759
32795
|
}
|
|
32760
32796
|
const audienceCandidate = candidate.audience ?? candidate.aud;
|
|
32761
|
-
if (typeof audienceCandidate === 'string' &&
|
|
32797
|
+
if (typeof audienceCandidate === 'string' &&
|
|
32798
|
+
audienceCandidate.trim().length > 0) {
|
|
32762
32799
|
normalized.audience = audienceCandidate.trim();
|
|
32763
32800
|
}
|
|
32764
32801
|
const codeChallengeMethod = candidate.codeChallengeMethod ?? candidate.code_challenge_method;
|
|
32765
|
-
if (typeof codeChallengeMethod === 'string' &&
|
|
32802
|
+
if (typeof codeChallengeMethod === 'string' &&
|
|
32803
|
+
codeChallengeMethod.trim().length > 0) {
|
|
32766
32804
|
normalized.codeChallengeMethod = codeChallengeMethod.trim();
|
|
32767
32805
|
}
|
|
32768
32806
|
const codeVerifierLength = candidate.codeVerifierLength ?? candidate.code_verifier_length;
|
|
32769
|
-
if (typeof codeVerifierLength === 'number' &&
|
|
32807
|
+
if (typeof codeVerifierLength === 'number' &&
|
|
32808
|
+
Number.isFinite(codeVerifierLength)) {
|
|
32770
32809
|
normalized.codeVerifierLength = codeVerifierLength;
|
|
32771
32810
|
}
|
|
32772
32811
|
const clockSkewSeconds = candidate.clockSkewSeconds ?? candidate.clock_skew_seconds;
|
|
32773
|
-
if (typeof clockSkewSeconds === 'number' &&
|
|
32812
|
+
if (typeof clockSkewSeconds === 'number' &&
|
|
32813
|
+
Number.isFinite(clockSkewSeconds)) {
|
|
32774
32814
|
normalized.clockSkewSeconds = clockSkewSeconds;
|
|
32775
32815
|
}
|
|
32776
32816
|
const loginHintParam = candidate.loginHintParam ?? candidate.login_hint_param;
|
|
@@ -32815,8 +32855,8 @@ class OAuth2PkceTokenProviderFactory extends TokenProviderFactory {
|
|
|
32815
32855
|
options.audience = normalized.audience;
|
|
32816
32856
|
}
|
|
32817
32857
|
if (normalized.codeChallengeMethod) {
|
|
32818
|
-
options.codeChallengeMethod =
|
|
32819
|
-
.toUpperCase();
|
|
32858
|
+
options.codeChallengeMethod =
|
|
32859
|
+
normalized.codeChallengeMethod.toUpperCase();
|
|
32820
32860
|
}
|
|
32821
32861
|
if (normalized.codeVerifierLength) {
|
|
32822
32862
|
options.codeVerifierLength = normalized.codeVerifierLength;
|
|
@@ -34573,14 +34613,14 @@ var eddsaEnvelopeVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
|
34573
34613
|
|
|
34574
34614
|
const FACTORY_META$d = {
|
|
34575
34615
|
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
34576
|
-
key:
|
|
34616
|
+
key: 'NoopTrustStoreProvider',
|
|
34577
34617
|
isDefault: true,
|
|
34578
34618
|
priority: 10,
|
|
34579
34619
|
};
|
|
34580
34620
|
class NoopTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
34581
34621
|
constructor() {
|
|
34582
34622
|
super(...arguments);
|
|
34583
|
-
this.type =
|
|
34623
|
+
this.type = 'NoopTrustStoreProvider';
|
|
34584
34624
|
this.isDefault = true;
|
|
34585
34625
|
this.priority = 10;
|
|
34586
34626
|
}
|
|
@@ -36283,9 +36323,7 @@ const defaultGrantSelectionPolicy = new GrantSelectionPolicy();
|
|
|
36283
36323
|
const logger$a = getLogger('naylence.fame.connector.broadcast_channel_listener');
|
|
36284
36324
|
const DEFAULT_CHANNEL$1 = 'naylence-fabric';
|
|
36285
36325
|
const DEFAULT_INBOX_CAPACITY$1 = 2048;
|
|
36286
|
-
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK |
|
|
36287
|
-
core.FameResponseType.REPLY |
|
|
36288
|
-
core.FameResponseType.STREAM;
|
|
36326
|
+
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK | core.FameResponseType.REPLY | core.FameResponseType.STREAM;
|
|
36289
36327
|
const isBrowserEnvironment$2 = () => typeof window !== 'undefined' &&
|
|
36290
36328
|
typeof BroadcastChannel !== 'undefined' &&
|
|
36291
36329
|
typeof MessageEvent !== 'undefined';
|
|
@@ -36499,9 +36537,7 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
36499
36537
|
return null;
|
|
36500
36538
|
}
|
|
36501
36539
|
})();
|
|
36502
|
-
if (error instanceof zod.ZodError &&
|
|
36503
|
-
decoded &&
|
|
36504
|
-
decoded.length > 0) {
|
|
36540
|
+
if (error instanceof zod.ZodError && decoded && decoded.length > 0) {
|
|
36505
36541
|
try {
|
|
36506
36542
|
const reparsed = JSON.parse(decoded);
|
|
36507
36543
|
const candidate = reparsed.rtype;
|
|
@@ -36724,11 +36760,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
36724
36760
|
? Math.floor(initialWindowCandidate)
|
|
36725
36761
|
: undefined;
|
|
36726
36762
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
36763
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
36764
|
+
logger$a.debug('broadcast_channel_listener_building_connector_config', {
|
|
36765
|
+
system_id: systemId,
|
|
36766
|
+
channel_name: channelName,
|
|
36767
|
+
passive,
|
|
36768
|
+
has_base_config: !!baseConfig,
|
|
36769
|
+
passive_candidate: passiveCandidate,
|
|
36770
|
+
});
|
|
36727
36771
|
return {
|
|
36728
36772
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
36729
36773
|
channelName,
|
|
36730
36774
|
inboxCapacity,
|
|
36731
|
-
passive
|
|
36775
|
+
passive,
|
|
36732
36776
|
initialWindow,
|
|
36733
36777
|
localNodeId,
|
|
36734
36778
|
initialTargetNodeId,
|
|
@@ -37479,7 +37523,9 @@ class InPageListener extends TransportListener {
|
|
|
37479
37523
|
typeof channelCandidate === 'string' && channelCandidate.trim().length > 0
|
|
37480
37524
|
? channelCandidate.trim()
|
|
37481
37525
|
: DEFAULT_CHANNEL;
|
|
37482
|
-
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
37526
|
+
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
37527
|
+
Number.isFinite(inboxCandidate) &&
|
|
37528
|
+
inboxCandidate > 0
|
|
37483
37529
|
? Math.floor(inboxCandidate)
|
|
37484
37530
|
: DEFAULT_INBOX_CAPACITY;
|
|
37485
37531
|
this._inboxCapacity = normalizedCapacity;
|
|
@@ -37754,7 +37800,8 @@ class InPageListener extends TransportListener {
|
|
|
37754
37800
|
if (grant.type === INPAGE_CONNECTION_GRANT_TYPE) {
|
|
37755
37801
|
return inPageGrantToConnectorConfig(grant);
|
|
37756
37802
|
}
|
|
37757
|
-
if (typeof grant
|
|
37803
|
+
if (typeof grant
|
|
37804
|
+
?.toConnectorConfig === 'function') {
|
|
37758
37805
|
return grant.toConnectorConfig();
|
|
37759
37806
|
}
|
|
37760
37807
|
throw new Error(`Unsupported grant type: ${grant.type}`);
|
|
@@ -39292,8 +39339,7 @@ function normalizeOptions$2(raw) {
|
|
|
39292
39339
|
const scopes = normalizeScopes(camel.scopes) ??
|
|
39293
39340
|
normalizeScopes(snake.scopes ?? snake.scope) ??
|
|
39294
39341
|
DEFAULT_SCOPES.slice();
|
|
39295
|
-
const audience = coerceString(camel.audience) ??
|
|
39296
|
-
coerceString(snake.audience ?? snake.aud);
|
|
39342
|
+
const audience = coerceString(camel.audience) ?? coerceString(snake.audience ?? snake.aud);
|
|
39297
39343
|
const fetchImpl = (camel.fetchImpl ?? snake.fetch_impl);
|
|
39298
39344
|
const clockSkewSeconds = coerceNumber(camel.clockSkewSeconds) ??
|
|
39299
39345
|
coerceNumber(snake.clock_skew_seconds) ??
|
|
@@ -41063,6 +41109,7 @@ exports.registerRuntimeFactories = registerRuntimeFactories;
|
|
|
41063
41109
|
exports.requireCryptoSupport = requireCryptoSupport;
|
|
41064
41110
|
exports.retryWithBackoff = retryWithBackoff;
|
|
41065
41111
|
exports.safeColor = safeColor;
|
|
41112
|
+
exports.safeImport = safeImport;
|
|
41066
41113
|
exports.sealedDecrypt = sealedDecrypt;
|
|
41067
41114
|
exports.sealedEncrypt = sealedEncrypt;
|
|
41068
41115
|
exports.secureDigest = secureDigest;
|