@naylence/runtime 0.3.6-test.108 → 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.
Files changed (59) hide show
  1. package/dist/browser/index.cjs +98 -61
  2. package/dist/browser/index.mjs +98 -61
  3. package/dist/cjs/_env-shim.js +2 -1
  4. package/dist/cjs/naylence/fame/config/extended-fame-config.js +2 -1
  5. package/dist/cjs/naylence/fame/connector/broadcast-channel-connector-factory.js +8 -4
  6. package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +13 -6
  7. package/dist/cjs/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
  8. package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +2 -6
  9. package/dist/cjs/naylence/fame/connector/inpage-connector-factory.js +2 -1
  10. package/dist/cjs/naylence/fame/connector/inpage-connector.js +13 -6
  11. package/dist/cjs/naylence/fame/connector/inpage-listener-factory.js +4 -4
  12. package/dist/cjs/naylence/fame/connector/inpage-listener.js +5 -2
  13. package/dist/cjs/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
  14. package/dist/cjs/naylence/fame/grants/inpage-connection-grant.js +4 -2
  15. package/dist/cjs/naylence/fame/http/oauth2-token-router.js +9 -9
  16. package/dist/cjs/naylence/fame/node/admission/default-node-attach-client.js +6 -3
  17. package/dist/cjs/naylence/fame/node/upstream-session-manager.js +9 -6
  18. package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
  19. package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
  20. package/dist/cjs/naylence/fame/security/default-security-manager.js +2 -1
  21. package/dist/cjs/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +2 -2
  22. package/dist/cjs/naylence/fame/security/trust-store/trust-store-provider-factory.js +2 -2
  23. package/dist/cjs/version.js +2 -2
  24. package/dist/esm/_env-shim.js +2 -1
  25. package/dist/esm/browser.js +2 -2
  26. package/dist/esm/naylence/fame/config/extended-fame-config.js +2 -1
  27. package/dist/esm/naylence/fame/connector/broadcast-channel-connector-factory.js +8 -4
  28. package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +13 -6
  29. package/dist/esm/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
  30. package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +2 -6
  31. package/dist/esm/naylence/fame/connector/index.js +2 -2
  32. package/dist/esm/naylence/fame/connector/inpage-connector-factory.js +2 -1
  33. package/dist/esm/naylence/fame/connector/inpage-connector.js +13 -6
  34. package/dist/esm/naylence/fame/connector/inpage-listener-factory.js +4 -4
  35. package/dist/esm/naylence/fame/connector/inpage-listener.js +5 -2
  36. package/dist/esm/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
  37. package/dist/esm/naylence/fame/grants/inpage-connection-grant.js +4 -2
  38. package/dist/esm/naylence/fame/http/oauth2-token-router.js +9 -9
  39. package/dist/esm/naylence/fame/node/admission/default-node-attach-client.js +6 -3
  40. package/dist/esm/naylence/fame/node/upstream-session-manager.js +9 -6
  41. package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
  42. package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
  43. package/dist/esm/naylence/fame/security/default-security-manager.js +2 -1
  44. package/dist/esm/naylence/fame/security/index.js +1 -1
  45. package/dist/esm/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +3 -3
  46. package/dist/esm/naylence/fame/security/trust-store/trust-store-provider-factory.js +3 -3
  47. package/dist/esm/version.js +2 -2
  48. package/dist/node/index.cjs +96 -60
  49. package/dist/node/index.mjs +96 -60
  50. package/dist/node/node.cjs +105 -69
  51. package/dist/node/node.mjs +105 -69
  52. package/dist/types/browser.d.ts +2 -2
  53. package/dist/types/naylence/fame/connector/index.d.ts +2 -2
  54. package/dist/types/naylence/fame/security/index.d.ts +1 -1
  55. package/dist/types/naylence/fame/security/trust-store/noop-trust-store-provider-factory.d.ts +3 -3
  56. package/dist/types/naylence/fame/security/trust-store/trust-store-provider-factory.d.ts +4 -4
  57. package/dist/types/naylence/fame/security/trust-store/trust-store-provider.d.ts +5 -5
  58. package/dist/types/version.d.ts +1 -1
  59. package/package.json +1 -1
@@ -90,7 +90,8 @@ class InPageConnector extends base_async_connector_js_1.BaseAsyncConnector {
90
90
  this.listenerRegistered = false;
91
91
  this.visibilityChangeListenerRegistered = false;
92
92
  this.channelName =
93
- typeof config.channelName === 'string' && config.channelName.trim().length > 0
93
+ typeof config.channelName === 'string' &&
94
+ config.channelName.trim().length > 0
94
95
  ? config.channelName.trim()
95
96
  : DEFAULT_CHANNEL;
96
97
  const preferredCapacity = typeof config.inboxCapacity === 'number' &&
@@ -129,7 +130,8 @@ class InPageConnector extends base_async_connector_js_1.BaseAsyncConnector {
129
130
  channel: this.channelName,
130
131
  connector_id: this.connectorId,
131
132
  message_type: message && typeof message === 'object'
132
- ? message.constructor?.name ?? typeof message
133
+ ? (message.constructor
134
+ ?.name ?? typeof message)
133
135
  : typeof message,
134
136
  has_sender_id: Boolean(message?.senderId),
135
137
  has_sender_node_id: Boolean(message?.senderNodeId),
@@ -138,7 +140,8 @@ class InPageConnector extends base_async_connector_js_1.BaseAsyncConnector {
138
140
  return;
139
141
  }
140
142
  const busMessage = message;
141
- const senderId = typeof busMessage.senderId === 'string' && busMessage.senderId.length > 0
143
+ const senderId = typeof busMessage.senderId === 'string' &&
144
+ busMessage.senderId.length > 0
142
145
  ? busMessage.senderId
143
146
  : null;
144
147
  const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
@@ -389,7 +392,9 @@ class InPageConnector extends base_async_connector_js_1.BaseAsyncConnector {
389
392
  timestamp: new Date().toISOString(),
390
393
  });
391
394
  }
392
- if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
395
+ if (this.visibilityChangeListenerRegistered &&
396
+ this.visibilityChangeHandler &&
397
+ typeof document !== 'undefined') {
393
398
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
394
399
  this.visibilityChangeListenerRegistered = false;
395
400
  this.visibilityChangeHandler = undefined;
@@ -406,7 +411,7 @@ class InPageConnector extends base_async_connector_js_1.BaseAsyncConnector {
406
411
  return rawOrEnvelope;
407
412
  }
408
413
  _isWildcardTarget() {
409
- return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
414
+ return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
410
415
  }
411
416
  _shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
412
417
  if (this._isWildcardTarget()) {
@@ -426,7 +431,9 @@ class InPageConnector extends base_async_connector_js_1.BaseAsyncConnector {
426
431
  return true;
427
432
  }
428
433
  const expectedSender = this.targetNodeId;
429
- if (expectedSender && expectedSender !== '*' && senderNodeId !== expectedSender) {
434
+ if (expectedSender &&
435
+ expectedSender !== '*' &&
436
+ senderNodeId !== expectedSender) {
430
437
  logger.debug('inpage_message_rejected', {
431
438
  channel: this.channelName,
432
439
  connector_id: this.connectorId,
@@ -53,7 +53,9 @@ function normalizeConfig(config) {
53
53
  : DEFAULT_CHANNEL;
54
54
  const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
55
55
  let inboxCapacity = DEFAULT_INBOX_CAPACITY;
56
- if (typeof rawInbox === 'number' && Number.isFinite(rawInbox) && rawInbox > 0) {
56
+ if (typeof rawInbox === 'number' &&
57
+ Number.isFinite(rawInbox) &&
58
+ rawInbox > 0) {
57
59
  inboxCapacity = Math.floor(rawInbox);
58
60
  }
59
61
  else if (typeof rawInbox === 'string') {
@@ -81,9 +83,7 @@ class InPageListenerFactory extends transport_listener_factory_js_1.TransportLis
81
83
  }
82
84
  async create(config, ...factoryArgs) {
83
85
  const normalized = normalizeConfig(config);
84
- const [{ InPageListener }] = await Promise.all([
85
- getInPageListenerModule(),
86
- ]);
86
+ const [{ InPageListener }] = await Promise.all([getInPageListenerModule()]);
87
87
  void factoryArgs;
88
88
  return new InPageListener({
89
89
  channelName: normalized.channelName,
@@ -73,7 +73,9 @@ class InPageListener extends transport_listener_js_1.TransportListener {
73
73
  typeof channelCandidate === 'string' && channelCandidate.trim().length > 0
74
74
  ? channelCandidate.trim()
75
75
  : DEFAULT_CHANNEL;
76
- const normalizedCapacity = typeof inboxCandidate === 'number' && Number.isFinite(inboxCandidate) && inboxCandidate > 0
76
+ const normalizedCapacity = typeof inboxCandidate === 'number' &&
77
+ Number.isFinite(inboxCandidate) &&
78
+ inboxCandidate > 0
77
79
  ? Math.floor(inboxCandidate)
78
80
  : DEFAULT_INBOX_CAPACITY;
79
81
  this._inboxCapacity = normalizedCapacity;
@@ -348,7 +350,8 @@ class InPageListener extends transport_listener_js_1.TransportListener {
348
350
  if (grant.type === inpage_connection_grant_js_1.INPAGE_CONNECTION_GRANT_TYPE) {
349
351
  return (0, inpage_connection_grant_js_1.inPageGrantToConnectorConfig)(grant);
350
352
  }
351
- if (typeof grant?.toConnectorConfig === 'function') {
353
+ if (typeof grant
354
+ ?.toConnectorConfig === 'function') {
352
355
  return grant.toConnectorConfig();
353
356
  }
354
357
  throw new Error(`Unsupported grant type: ${grant.type}`);
@@ -47,14 +47,16 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
47
47
  type,
48
48
  purpose,
49
49
  };
50
- const channelValue = candidate.channelName ?? candidate['channel_name'];
50
+ const channelValue = candidate.channelName ??
51
+ candidate['channel_name'];
51
52
  if (channelValue !== undefined) {
52
53
  if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
53
54
  throw new TypeError('BroadcastChannelConnectionGrant "channelName" must be a non-empty string when provided');
54
55
  }
55
56
  result.channelName = channelValue.trim();
56
57
  }
57
- const inboxValue = candidate.inboxCapacity ?? candidate['inbox_capacity'];
58
+ const inboxValue = candidate.inboxCapacity ??
59
+ candidate['inbox_capacity'];
58
60
  if (inboxValue !== undefined) {
59
61
  if (typeof inboxValue !== 'number' ||
60
62
  !Number.isFinite(inboxValue) ||
@@ -63,7 +65,8 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
63
65
  }
64
66
  result.inboxCapacity = Math.floor(inboxValue);
65
67
  }
66
- const windowValue = candidate.initialWindow ?? candidate['initial_window'];
68
+ const windowValue = candidate.initialWindow ??
69
+ candidate['initial_window'];
67
70
  if (windowValue !== undefined) {
68
71
  if (typeof windowValue !== 'number' ||
69
72
  !Number.isFinite(windowValue) ||
@@ -42,14 +42,16 @@ function normalizeInPageConnectionGrant(candidate) {
42
42
  type,
43
43
  purpose,
44
44
  };
45
- const channelValue = candidate.channelName ?? candidate['channel_name'];
45
+ const channelValue = candidate.channelName ??
46
+ candidate['channel_name'];
46
47
  if (channelValue !== undefined) {
47
48
  if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
48
49
  throw new TypeError('InPageConnectionGrant "channelName" must be a non-empty string when provided');
49
50
  }
50
51
  result.channelName = channelValue.trim();
51
52
  }
52
- const inboxValue = candidate.inboxCapacity ?? candidate['inbox_capacity'];
53
+ const inboxValue = candidate.inboxCapacity ??
54
+ candidate['inbox_capacity'];
53
55
  if (inboxValue !== undefined) {
54
56
  if (typeof inboxValue !== 'number' ||
55
57
  !Number.isFinite(inboxValue) ||
@@ -423,7 +423,9 @@ function parseCookies(cookieHeader) {
423
423
  if (!cookieHeader) {
424
424
  return {};
425
425
  }
426
- return cookieHeader.split(';').reduce((acc, entry) => {
426
+ return cookieHeader
427
+ .split(';')
428
+ .reduce((acc, entry) => {
427
429
  const [rawName, ...rawValueParts] = entry.split('=');
428
430
  const name = rawName?.trim();
429
431
  if (!name) {
@@ -571,10 +573,7 @@ function setNoCacheHeaders(res) {
571
573
  res.set('Pragma', 'no-cache');
572
574
  }
573
575
  function respondInvalidClient(res) {
574
- res
575
- .status(401)
576
- .set('WWW-Authenticate', 'Basic')
577
- .json({
576
+ res.status(401).set('WWW-Authenticate', 'Basic').json({
578
577
  error: 'invalid_client',
579
578
  error_description: 'Invalid client credentials',
580
579
  });
@@ -611,10 +610,10 @@ function createOAuth2TokenRouter(options) {
611
610
  DEFAULT_JWT_ALGORITHM;
612
611
  const allowedScopes = getAllowedScopes(configAllowedScopes);
613
612
  const resolvedTokenTtlSec = tokenTtlSec ?? 3600;
614
- const enablePkce = coerceBoolean(process.env[ENV_VAR_ENABLE_PKCE]) ??
615
- (configEnablePkce ?? true);
613
+ const enablePkce = coerceBoolean(process.env[ENV_VAR_ENABLE_PKCE]) ?? configEnablePkce ?? true;
616
614
  const allowPublicClients = coerceBoolean(process.env[ENV_VAR_ALLOW_PUBLIC_CLIENTS]) ??
617
- (configAllowPublicClients ?? true);
615
+ configAllowPublicClients ??
616
+ true;
618
617
  const authorizationCodeTtlSec = ensurePositiveInteger(coerceNumber(process.env[ENV_VAR_AUTHORIZATION_CODE_TTL]) ??
619
618
  configAuthorizationCodeTtlSec) ?? DEFAULT_AUTHORIZATION_CODE_TTL_SEC;
620
619
  const devLoginExplicitlyEnabled = coerceBoolean(process.env[ENV_VAR_ENABLE_DEV_LOGIN]) ??
@@ -629,7 +628,8 @@ function createOAuth2TokenRouter(options) {
629
628
  configDevLoginCookieName ??
630
629
  DEFAULT_SESSION_COOKIE_NAME;
631
630
  const devLoginSecureCookie = coerceBoolean(process.env[ENV_VAR_SESSION_SECURE_COOKIE]) ??
632
- (configDevLoginSecureCookie ?? false);
631
+ configDevLoginSecureCookie ??
632
+ false;
633
633
  const devLoginTitle = coerceString(process.env[ENV_VAR_LOGIN_TITLE]) ??
634
634
  configDevLoginTitle ??
635
635
  DEFAULT_LOGIN_TITLE;
@@ -22,7 +22,8 @@ class DefaultNodeAttachClient {
22
22
  const interimHandler = async (envelope, context) => {
23
23
  if (this.inHandshake) {
24
24
  // Filter: only buffer frames related to our systemId or frames without systemId info
25
- const frameSystemId = envelope.frame?.systemId;
25
+ const frameSystemId = envelope.frame
26
+ ?.systemId;
26
27
  if (!frameSystemId || frameSystemId === this.expectedSystemId) {
27
28
  this.buffer.push(envelope);
28
29
  }
@@ -218,7 +219,8 @@ class DefaultNodeAttachClient {
218
219
  const deadline = Date.now() + this.timeoutMs;
219
220
  while (Date.now() < deadline) {
220
221
  // Allow both STARTED and PAUSED states (PAUSED = tab hidden but connection alive)
221
- if (connector.state !== core_1.ConnectorState.STARTED && connector.state !== core_1.ConnectorState.PAUSED) {
222
+ if (connector.state !== core_1.ConnectorState.STARTED &&
223
+ connector.state !== core_1.ConnectorState.PAUSED) {
222
224
  let errorMessage = 'Connector closed while waiting for NodeAttachAck';
223
225
  if (connector.closeCode !== undefined) {
224
226
  errorMessage += ` (code=${connector.closeCode}`;
@@ -242,7 +244,8 @@ class DefaultNodeAttachClient {
242
244
  if (envelope.frame.type === 'NodeAttach') {
243
245
  logger.debug('handshake_ignoring_concurrent_attach', {
244
246
  frame_type: envelope.frame.type,
245
- frame_system_id: envelope.frame?.systemId ?? 'unknown',
247
+ frame_system_id: envelope.frame?.systemId ??
248
+ 'unknown',
246
249
  });
247
250
  }
248
251
  else {
@@ -323,7 +323,7 @@ class UpstreamSessionManager extends task_spawner_js_1.TaskSpawner {
323
323
  const callbackGrants = this.node.gatherSupportedCallbackGrants();
324
324
  logger.debug('callback_grants_before_augmentation', {
325
325
  count: callbackGrants.length,
326
- types: callbackGrants.map(g => g.type),
326
+ types: callbackGrants.map((g) => g.type),
327
327
  });
328
328
  // Check if we should create a broadcast callback grant before processing connection grants
329
329
  // This prevents adding duplicate broadcast grants
@@ -337,11 +337,12 @@ class UpstreamSessionManager extends task_spawner_js_1.TaskSpawner {
337
337
  });
338
338
  // Include admission client's connection grants as callback grants
339
339
  // This ensures DirectAdmissionClient grants are available for grant selection
340
- if (welcome.frame.connectionGrants && Array.isArray(welcome.frame.connectionGrants)) {
340
+ if (welcome.frame.connectionGrants &&
341
+ Array.isArray(welcome.frame.connectionGrants)) {
341
342
  for (const grant of welcome.frame.connectionGrants) {
342
343
  if (grant && typeof grant === 'object') {
343
344
  // Avoid duplicates by checking if grant already exists
344
- const isDuplicate = callbackGrants.some(existing => JSON.stringify(existing) === JSON.stringify(grant));
345
+ const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
345
346
  if (!isDuplicate) {
346
347
  callbackGrants.push(grant);
347
348
  logger.debug('added_connection_grant_as_callback', {
@@ -358,7 +359,8 @@ class UpstreamSessionManager extends task_spawner_js_1.TaskSpawner {
358
359
  }
359
360
  // Add broadcast grant after connection grants to ensure we don't duplicate
360
361
  // any broadcast grants that may have been in connectionGrants
361
- if (broadcastCallbackGrant && this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
362
+ if (broadcastCallbackGrant &&
363
+ this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
362
364
  callbackGrants.push(broadcastCallbackGrant);
363
365
  logger.debug('added_broadcast_callback_grant');
364
366
  }
@@ -367,7 +369,7 @@ class UpstreamSessionManager extends task_spawner_js_1.TaskSpawner {
367
369
  }
368
370
  logger.debug('callback_grants_after_augmentation', {
369
371
  count: callbackGrants.length,
370
- types: callbackGrants.map(g => g.type),
372
+ types: callbackGrants.map((g) => g.type),
371
373
  });
372
374
  const attachInfo = await this.attachClient.attach(this.node, this.outboundOriginType, connector, welcome.frame, this.wrappedHandler, this.getKeys() ?? undefined, callbackGrants);
373
375
  this.targetSystemId = attachInfo.targetSystemId ?? null;
@@ -609,7 +611,8 @@ class UpstreamSessionManager extends task_spawner_js_1.TaskSpawner {
609
611
  continue;
610
612
  }
611
613
  // Reset ack time if just resumed from pause (prevents immediate timeout)
612
- if (previousState === core_1.ConnectorState.PAUSED && currentState === core_1.ConnectorState.STARTED) {
614
+ if (previousState === core_1.ConnectorState.PAUSED &&
615
+ currentState === core_1.ConnectorState.STARTED) {
613
616
  logger.debug('connector_just_resumed_resetting_ack_time', {
614
617
  previous_state: previousState,
615
618
  current_state: currentState,
@@ -94,19 +94,23 @@ function normalizeConfig(config) {
94
94
  normalized.clientSecretConfig = (0, secret_source_js_1.normalizeSecretSource)(clientSecretSource);
95
95
  }
96
96
  const audienceCandidate = candidate.audience ?? candidate.aud;
97
- if (typeof audienceCandidate === 'string' && audienceCandidate.trim().length > 0) {
97
+ if (typeof audienceCandidate === 'string' &&
98
+ audienceCandidate.trim().length > 0) {
98
99
  normalized.audience = audienceCandidate.trim();
99
100
  }
100
101
  const codeChallengeMethod = candidate.codeChallengeMethod ?? candidate.code_challenge_method;
101
- if (typeof codeChallengeMethod === 'string' && codeChallengeMethod.trim().length > 0) {
102
+ if (typeof codeChallengeMethod === 'string' &&
103
+ codeChallengeMethod.trim().length > 0) {
102
104
  normalized.codeChallengeMethod = codeChallengeMethod.trim();
103
105
  }
104
106
  const codeVerifierLength = candidate.codeVerifierLength ?? candidate.code_verifier_length;
105
- if (typeof codeVerifierLength === 'number' && Number.isFinite(codeVerifierLength)) {
107
+ if (typeof codeVerifierLength === 'number' &&
108
+ Number.isFinite(codeVerifierLength)) {
106
109
  normalized.codeVerifierLength = codeVerifierLength;
107
110
  }
108
111
  const clockSkewSeconds = candidate.clockSkewSeconds ?? candidate.clock_skew_seconds;
109
- if (typeof clockSkewSeconds === 'number' && Number.isFinite(clockSkewSeconds)) {
112
+ if (typeof clockSkewSeconds === 'number' &&
113
+ Number.isFinite(clockSkewSeconds)) {
110
114
  normalized.clockSkewSeconds = clockSkewSeconds;
111
115
  }
112
116
  const loginHintParam = candidate.loginHintParam ?? candidate.login_hint_param;
@@ -151,8 +155,8 @@ class OAuth2PkceTokenProviderFactory extends token_provider_factory_js_1.TokenPr
151
155
  options.audience = normalized.audience;
152
156
  }
153
157
  if (normalized.codeChallengeMethod) {
154
- options.codeChallengeMethod = normalized.codeChallengeMethod
155
- .toUpperCase();
158
+ options.codeChallengeMethod =
159
+ normalized.codeChallengeMethod.toUpperCase();
156
160
  }
157
161
  if (normalized.codeVerifierLength) {
158
162
  options.codeVerifierLength = normalized.codeVerifierLength;
@@ -67,8 +67,7 @@ function normalizeOptions(raw) {
67
67
  const scopes = normalizeScopes(camel.scopes) ??
68
68
  normalizeScopes(snake.scopes ?? snake.scope) ??
69
69
  DEFAULT_SCOPES.slice();
70
- const audience = coerceString(camel.audience) ??
71
- coerceString(snake.audience ?? snake.aud);
70
+ const audience = coerceString(camel.audience) ?? coerceString(snake.audience ?? snake.aud);
72
71
  const fetchImpl = (camel.fetchImpl ?? snake.fetch_impl);
73
72
  const clockSkewSeconds = coerceNumber(camel.clockSkewSeconds) ??
74
73
  coerceNumber(snake.clock_skew_seconds) ??
@@ -507,7 +507,8 @@ class DefaultSecurityManager {
507
507
  const hasSignature = Boolean(envelope.sec?.sig);
508
508
  if (!hasSignature) {
509
509
  const nodeSid = node.sid;
510
- const envelopeSid = envelope.sid;
510
+ const envelopeSid = envelope
511
+ .sid;
511
512
  const isLocalUnsignedSelfEnvelope = localContext.originType === core_1.DeliveryOriginType.LOCAL &&
512
513
  typeof nodeSid === 'string' &&
513
514
  nodeSid.length > 0 &&
@@ -4,14 +4,14 @@ exports.NoopTrustStoreProviderFactory = exports.FACTORY_META = void 0;
4
4
  const trust_store_provider_factory_js_1 = require("./trust-store-provider-factory.js");
5
5
  exports.FACTORY_META = {
6
6
  base: trust_store_provider_factory_js_1.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
7
- key: "NoopTrustStoreProvider",
7
+ key: 'NoopTrustStoreProvider',
8
8
  isDefault: true,
9
9
  priority: 10,
10
10
  };
11
11
  class NoopTrustStoreProviderFactory extends trust_store_provider_factory_js_1.TrustStoreProviderFactory {
12
12
  constructor() {
13
13
  super(...arguments);
14
- this.type = "NoopTrustStoreProvider";
14
+ this.type = 'NoopTrustStoreProvider';
15
15
  this.isDefault = true;
16
16
  this.priority = 10;
17
17
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NoopTrustStoreProvider = exports.TrustStoreProviderFactory = exports.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = void 0;
4
4
  const factory_1 = require("@naylence/factory");
5
- 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.";
6
- exports.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = "TrustStoreProviderFactory";
5
+ 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.';
6
+ exports.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = 'TrustStoreProviderFactory';
7
7
  class TrustStoreProviderFactory extends factory_1.AbstractResourceFactory {
8
8
  createUnconfiguredProvider(reason) {
9
9
  return new NoopTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // This file is auto-generated during build - do not edit manually
3
- // Generated from package.json version: 0.3.6-test.108
3
+ // Generated from package.json version: 0.3.7
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.VERSION = void 0;
6
6
  /**
7
7
  * The package version, injected at build time.
8
8
  * @internal
9
9
  */
10
- exports.VERSION = '0.3.6-test.108';
10
+ exports.VERSION = '0.3.7';
@@ -14,7 +14,8 @@ export function installProcessEnvShim() {
14
14
  if (g.__ENV__ && typeof g.__ENV__ === 'object')
15
15
  Object.assign(out, g.__ENV__);
16
16
  try {
17
- // @ts-ignore -- import.meta is only available in ESM builds
17
+ // import.meta is only available in ESM builds
18
+ // @ts-ignore
18
19
  const ie = (typeof import.meta !== 'undefined' && import.meta.env) || undefined;
19
20
  if (ie && typeof ie === 'object')
20
21
  Object.assign(out, ie);
@@ -6,7 +6,7 @@ export { InPageConnector, INPAGE_CONNECTOR_TYPE, } from './naylence/fame/connect
6
6
  export { BroadcastChannelConnector, BROADCAST_CHANNEL_CONNECTOR_TYPE, } from './naylence/fame/connector/broadcast-channel-connector.js';
7
7
  export { InPageConnectorFactory, FACTORY_META as INPAGE_CONNECTOR_FACTORY_META, } from './naylence/fame/connector/inpage-connector-factory.js';
8
8
  export { BroadcastChannelConnectorFactory, FACTORY_META as BROADCAST_CHANNEL_CONNECTOR_FACTORY_META, } from './naylence/fame/connector/broadcast-channel-connector-factory.js';
9
- export { InPageListener, } from './naylence/fame/connector/inpage-listener.js';
9
+ export { InPageListener } from './naylence/fame/connector/inpage-listener.js';
10
10
  export { InPageListenerFactory, FACTORY_META as INPAGE_LISTENER_FACTORY_META, } from './naylence/fame/connector/inpage-listener-factory.js';
11
- export { BroadcastChannelListener, } from './naylence/fame/connector/broadcast-channel-listener.js';
11
+ export { BroadcastChannelListener } from './naylence/fame/connector/broadcast-channel-listener.js';
12
12
  export { BroadcastChannelListenerFactory, FACTORY_META as BROADCAST_CHANNEL_LISTENER_FACTORY_META, } from './naylence/fame/connector/broadcast-channel-listener-factory.js';
@@ -50,7 +50,8 @@ function createFsShim() {
50
50
  else if (options &&
51
51
  typeof options === 'object' &&
52
52
  'encoding' in options &&
53
- typeof options.encoding === 'string') {
53
+ typeof options.encoding ===
54
+ 'string') {
54
55
  encoding = options.encoding;
55
56
  }
56
57
  const data = fsBinding.readFileUtf8(pathOrDescriptor, 0);
@@ -44,10 +44,12 @@ export class BroadcastChannelConnectorFactory extends ConnectorFactory {
44
44
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
45
45
  };
46
46
  const channelCandidate = record.channelName ?? record['channel_name'];
47
- if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
47
+ if (typeof channelCandidate === 'string' &&
48
+ channelCandidate.trim().length > 0) {
48
49
  config.channelName = channelCandidate.trim();
49
50
  }
50
- const inboxCandidate = record.inboxCapacity ?? record['inbox_capacity'];
51
+ const inboxCandidate = record.inboxCapacity ??
52
+ record['inbox_capacity'];
51
53
  if (typeof inboxCandidate === 'number' &&
52
54
  Number.isFinite(inboxCandidate) &&
53
55
  inboxCandidate > 0) {
@@ -71,9 +73,11 @@ export class BroadcastChannelConnectorFactory extends ConnectorFactory {
71
73
  throw new Error('BroadcastChannelConnectorFactory requires a configuration');
72
74
  }
73
75
  const normalized = this._normalizeConfig(config);
74
- const options = (factoryArgs[0] ?? {});
76
+ const options = (factoryArgs[0] ??
77
+ {});
75
78
  const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
76
- const localNodeId = this._normalizeNodeId(options.localNodeId) ?? normalizedLocalNodeFromConfig;
79
+ const localNodeId = this._normalizeNodeId(options.localNodeId) ??
80
+ normalizedLocalNodeFromConfig;
77
81
  if (!localNodeId) {
78
82
  throw new Error('BroadcastChannelConnectorFactory requires a localNodeId from config or create() options');
79
83
  }
@@ -17,7 +17,8 @@ const ensureBroadcastEnvironment = () => {
17
17
  };
18
18
  export class BroadcastChannelConnector extends BaseAsyncConnector {
19
19
  static generateConnectorId() {
20
- const globalCrypto = globalThis.crypto;
20
+ const globalCrypto = globalThis
21
+ .crypto;
21
22
  if (globalCrypto?.randomUUID) {
22
23
  return globalCrypto.randomUUID();
23
24
  }
@@ -72,7 +73,8 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
72
73
  this.listenerRegistered = false;
73
74
  this.visibilityChangeListenerRegistered = false;
74
75
  this.channelName =
75
- typeof config.channelName === 'string' && config.channelName.trim().length > 0
76
+ typeof config.channelName === 'string' &&
77
+ config.channelName.trim().length > 0
76
78
  ? config.channelName.trim()
77
79
  : DEFAULT_CHANNEL;
78
80
  const preferredCapacity = typeof config.inboxCapacity === 'number' &&
@@ -114,7 +116,8 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
114
116
  channel: this.channelName,
115
117
  connector_id: this.connectorId,
116
118
  message_type: message && typeof message === 'object'
117
- ? message.constructor?.name ?? typeof message
119
+ ? (message.constructor
120
+ ?.name ?? typeof message)
118
121
  : typeof message,
119
122
  has_sender_id: Boolean(message?.senderId),
120
123
  has_sender_node_id: Boolean(message?.senderNodeId),
@@ -344,7 +347,9 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
344
347
  timestamp: new Date().toISOString(),
345
348
  });
346
349
  }
347
- if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
350
+ if (this.visibilityChangeListenerRegistered &&
351
+ this.visibilityChangeHandler &&
352
+ typeof document !== 'undefined') {
348
353
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
349
354
  this.visibilityChangeListenerRegistered = false;
350
355
  this.visibilityChangeHandler = undefined;
@@ -372,7 +377,7 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
372
377
  return rawOrEnvelope;
373
378
  }
374
379
  _isWildcardTarget() {
375
- return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
380
+ return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
376
381
  }
377
382
  _shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
378
383
  if (this._isWildcardTarget()) {
@@ -392,7 +397,9 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
392
397
  return true;
393
398
  }
394
399
  const expectedSender = this.targetNodeId;
395
- if (expectedSender && expectedSender !== '*' && senderNodeId !== expectedSender) {
400
+ if (expectedSender &&
401
+ expectedSender !== '*' &&
402
+ senderNodeId !== expectedSender) {
396
403
  logger.debug('broadcast_channel_message_rejected', {
397
404
  channel: this.channelName,
398
405
  connector_id: this.connectorId,
@@ -17,7 +17,9 @@ function normalizeConfig(config) {
17
17
  : DEFAULT_CHANNEL;
18
18
  const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
19
19
  let inboxCapacity = DEFAULT_INBOX_CAPACITY;
20
- if (typeof rawInbox === 'number' && Number.isFinite(rawInbox) && rawInbox > 0) {
20
+ if (typeof rawInbox === 'number' &&
21
+ Number.isFinite(rawInbox) &&
22
+ rawInbox > 0) {
21
23
  inboxCapacity = Math.floor(rawInbox);
22
24
  }
23
25
  else if (typeof rawInbox === 'string') {
@@ -10,9 +10,7 @@ import { BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, broadcastChannelGrantToConnect
10
10
  const logger = getLogger('naylence.fame.connector.broadcast_channel_listener');
11
11
  const DEFAULT_CHANNEL = 'naylence-fabric';
12
12
  const DEFAULT_INBOX_CAPACITY = 2048;
13
- const RESPONSE_TYPE_MASK = FameResponseType.ACK |
14
- FameResponseType.REPLY |
15
- FameResponseType.STREAM;
13
+ const RESPONSE_TYPE_MASK = FameResponseType.ACK | FameResponseType.REPLY | FameResponseType.STREAM;
16
14
  const isBrowserEnvironment = () => typeof window !== 'undefined' &&
17
15
  typeof BroadcastChannel !== 'undefined' &&
18
16
  typeof MessageEvent !== 'undefined';
@@ -226,9 +224,7 @@ export class BroadcastChannelListener extends TransportListener {
226
224
  return null;
227
225
  }
228
226
  })();
229
- if (error instanceof ZodError &&
230
- decoded &&
231
- decoded.length > 0) {
227
+ if (error instanceof ZodError && decoded && decoded.length > 0) {
232
228
  try {
233
229
  const reparsed = JSON.parse(decoded);
234
230
  const candidate = reparsed.rtype;
@@ -24,9 +24,9 @@ export { BroadcastChannelConnector, BROADCAST_CHANNEL_CONNECTOR_TYPE, } from './
24
24
  export { _NoopFlowController } from './noop-flow-controller.js';
25
25
  // Transport listener
26
26
  export { TransportListener } from './transport-listener.js';
27
- export { TransportListenerFactory, TRANSPORT_LISTENER_FACTORY_BASE_TYPE } from './transport-listener-factory.js';
27
+ export { TransportListenerFactory, TRANSPORT_LISTENER_FACTORY_BASE_TYPE, } from './transport-listener-factory.js';
28
28
  export { DefaultHttpServer } from './default-http-server.js';
29
29
  export { WebSocketListener, getWebsocketListenerInstance, } from './websocket-listener.js';
30
30
  export { HttpListener, getHttpListenerInstance } from './http-listener.js';
31
- export { InPageListener, getInPageListenerInstance } from './inpage-listener.js';
31
+ export { InPageListener, getInPageListenerInstance, } from './inpage-listener.js';
32
32
  export { BroadcastChannelListener, getBroadcastChannelListenerInstance, } from './broadcast-channel-listener.js';
@@ -66,7 +66,8 @@ export class InPageConnectorFactory extends ConnectorFactory {
66
66
  const normalized = this._normalizeConfig(config);
67
67
  const options = (factoryArgs[0] ?? {});
68
68
  const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
69
- const localNodeId = this._normalizeNodeId(options.localNodeId) ?? normalizedLocalNodeFromConfig;
69
+ const localNodeId = this._normalizeNodeId(options.localNodeId) ??
70
+ normalizedLocalNodeFromConfig;
70
71
  if (!localNodeId) {
71
72
  throw new Error('InPageConnectorFactory requires a localNodeId from config or create() options');
72
73
  }
@@ -87,7 +87,8 @@ export class InPageConnector extends BaseAsyncConnector {
87
87
  this.listenerRegistered = false;
88
88
  this.visibilityChangeListenerRegistered = false;
89
89
  this.channelName =
90
- typeof config.channelName === 'string' && config.channelName.trim().length > 0
90
+ typeof config.channelName === 'string' &&
91
+ config.channelName.trim().length > 0
91
92
  ? config.channelName.trim()
92
93
  : DEFAULT_CHANNEL;
93
94
  const preferredCapacity = typeof config.inboxCapacity === 'number' &&
@@ -126,7 +127,8 @@ export class InPageConnector extends BaseAsyncConnector {
126
127
  channel: this.channelName,
127
128
  connector_id: this.connectorId,
128
129
  message_type: message && typeof message === 'object'
129
- ? message.constructor?.name ?? typeof message
130
+ ? (message.constructor
131
+ ?.name ?? typeof message)
130
132
  : typeof message,
131
133
  has_sender_id: Boolean(message?.senderId),
132
134
  has_sender_node_id: Boolean(message?.senderNodeId),
@@ -135,7 +137,8 @@ export class InPageConnector extends BaseAsyncConnector {
135
137
  return;
136
138
  }
137
139
  const busMessage = message;
138
- const senderId = typeof busMessage.senderId === 'string' && busMessage.senderId.length > 0
140
+ const senderId = typeof busMessage.senderId === 'string' &&
141
+ busMessage.senderId.length > 0
139
142
  ? busMessage.senderId
140
143
  : null;
141
144
  const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
@@ -386,7 +389,9 @@ export class InPageConnector extends BaseAsyncConnector {
386
389
  timestamp: new Date().toISOString(),
387
390
  });
388
391
  }
389
- if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
392
+ if (this.visibilityChangeListenerRegistered &&
393
+ this.visibilityChangeHandler &&
394
+ typeof document !== 'undefined') {
390
395
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
391
396
  this.visibilityChangeListenerRegistered = false;
392
397
  this.visibilityChangeHandler = undefined;
@@ -403,7 +408,7 @@ export class InPageConnector extends BaseAsyncConnector {
403
408
  return rawOrEnvelope;
404
409
  }
405
410
  _isWildcardTarget() {
406
- return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
411
+ return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
407
412
  }
408
413
  _shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
409
414
  if (this._isWildcardTarget()) {
@@ -423,7 +428,9 @@ export class InPageConnector extends BaseAsyncConnector {
423
428
  return true;
424
429
  }
425
430
  const expectedSender = this.targetNodeId;
426
- if (expectedSender && expectedSender !== '*' && senderNodeId !== expectedSender) {
431
+ if (expectedSender &&
432
+ expectedSender !== '*' &&
433
+ senderNodeId !== expectedSender) {
427
434
  logger.debug('inpage_message_rejected', {
428
435
  channel: this.channelName,
429
436
  connector_id: this.connectorId,