@dereekb/firebase-server 13.12.8 → 13.13.0

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 (31) hide show
  1. package/mailgun/package.json +9 -9
  2. package/mcp/index.cjs.js +3 -3
  3. package/mcp/index.esm.js +3 -3
  4. package/mcp/package.json +11 -11
  5. package/model/index.cjs.js +209 -0
  6. package/model/index.esm.js +208 -2
  7. package/model/package.json +9 -9
  8. package/model/src/lib/storagefile/storagefile.action.server.d.ts +61 -1
  9. package/oidc/index.cjs.js +1025 -283
  10. package/oidc/index.esm.js +1016 -285
  11. package/oidc/package.json +10 -10
  12. package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +4 -1
  13. package/oidc/src/lib/controller/oidc.provider.controller.d.ts +17 -0
  14. package/oidc/src/lib/oidc.config.d.ts +60 -0
  15. package/oidc/src/lib/service/analytics/index.d.ts +4 -0
  16. package/oidc/src/lib/service/analytics/oidc.analytics.config.d.ts +46 -0
  17. package/oidc/src/lib/service/analytics/oidc.analytics.handler.d.ts +116 -0
  18. package/oidc/src/lib/service/analytics/oidc.analytics.module.d.ts +35 -0
  19. package/oidc/src/lib/service/analytics/oidc.analytics.service.d.ts +23 -0
  20. package/oidc/src/lib/service/index.d.ts +1 -0
  21. package/oidc/src/lib/service/oidc.account.service.d.ts +15 -0
  22. package/oidc/src/lib/service/oidc.client.service.d.ts +4 -0
  23. package/oidc/src/lib/service/oidc.interaction.service.d.ts +2 -2
  24. package/oidc/src/lib/service/oidc.service.d.ts +23 -1
  25. package/oidc/src/lib/service/oidc.session-ttl.d.ts +114 -0
  26. package/package.json +10 -10
  27. package/test/index.cjs.js +11 -3
  28. package/test/index.esm.js +11 -3
  29. package/test/package.json +11 -11
  30. package/twilio/package.json +8 -8
  31. package/zoho/package.json +9 -9
package/oidc/index.cjs.js CHANGED
@@ -29,13 +29,13 @@ var config = require('@nestjs/config');
29
29
  return req.auth;
30
30
  });
31
31
 
32
- function _type_of$1(obj) {
32
+ function _type_of$2(obj) {
33
33
  "@swc/helpers - typeof";
34
34
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
35
35
  }
36
36
  function __decorate(decorators, target, key, desc) {
37
37
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38
- if ((typeof Reflect === "undefined" ? "undefined" : _type_of$1(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38
+ if ((typeof Reflect === "undefined" ? "undefined" : _type_of$2(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39
39
  else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
40
40
  return c > 3 && r && Object.defineProperty(target, key, r), r;
41
41
  }
@@ -49,12 +49,12 @@ typeof SuppressedError === "function" ? SuppressedError : function(error, suppre
49
49
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
50
50
  };
51
51
 
52
- function _class_call_check$g(instance, Constructor) {
52
+ function _class_call_check$i(instance, Constructor) {
53
53
  if (!(instance instanceof Constructor)) {
54
54
  throw new TypeError("Cannot call a class as a function");
55
55
  }
56
56
  }
57
- function _defineProperties$d(target, props) {
57
+ function _defineProperties$e(target, props) {
58
58
  for(var i = 0; i < props.length; i++){
59
59
  var descriptor = props[i];
60
60
  descriptor.enumerable = descriptor.enumerable || false;
@@ -63,11 +63,11 @@ function _defineProperties$d(target, props) {
63
63
  Object.defineProperty(target, descriptor.key, descriptor);
64
64
  }
65
65
  }
66
- function _create_class$d(Constructor, protoProps, staticProps) {
67
- if (staticProps) _defineProperties$d(Constructor, staticProps);
66
+ function _create_class$e(Constructor, protoProps, staticProps) {
67
+ if (staticProps) _defineProperties$e(Constructor, staticProps);
68
68
  return Constructor;
69
69
  }
70
- function _define_property$f(obj, key, value) {
70
+ function _define_property$g(obj, key, value) {
71
71
  if (key in obj) {
72
72
  Object.defineProperty(obj, key, {
73
73
  value: value,
@@ -111,6 +111,23 @@ function _define_property$f(obj, key, value) {
111
111
  /**
112
112
  * Default global floor for a client-requested login duration, in seconds. 1 hour.
113
113
  */ var DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS = 60 * util.SECONDS_IN_MINUTE;
114
+ /**
115
+ * Default ceiling (seconds) on a login duration for a non-admin user. 45 days.
116
+ *
117
+ * Tier 1 of the tiered ceiling resolved by `resolveTieredServerMaxSeconds`.
118
+ */ var DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS = 45 * util.SECONDS_IN_DAY;
119
+ /**
120
+ * Default ceiling (seconds) on a normal (non-service-token) login duration for an admin user. 90 days.
121
+ *
122
+ * Tier 2 of the tiered ceiling resolved by `resolveTieredServerMaxSeconds`.
123
+ */ var DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS = 90 * util.SECONDS_IN_DAY;
124
+ /**
125
+ * Default ceiling (seconds) on a login duration carrying an admin-only service-token scope. 365 days.
126
+ *
127
+ * Tier 3 of the tiered ceiling resolved by `resolveTieredServerMaxSeconds`. Also matches
128
+ * node-oidc-provider's absolute refresh-token rotation cap (`totalLifetime >= 365.25d`), so a
129
+ * service token issued at this ceiling never rotates.
130
+ */ var DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS = 365 * util.SECONDS_IN_DAY;
114
131
  /**
115
132
  * Default token lifetimes: 15 min access tokens, 30-day refresh tokens, 30-day sessions/grants, 60 s auth codes.
116
133
  */ var DEFAULT_OIDC_TOKEN_LIFETIMES = {
@@ -128,32 +145,32 @@ function _define_property$f(obj, key, value) {
128
145
  * Used as an abstract class so it can serve as both a type and a NestJS DI token.
129
146
  */ var OidcModuleConfig = /*#__PURE__*/ function() {
130
147
  function OidcModuleConfig() {
131
- _class_call_check$g(this, OidcModuleConfig);
148
+ _class_call_check$i(this, OidcModuleConfig);
132
149
  /**
133
150
  * The OIDC issuer URL (e.g., 'https://accounts.example.com').
134
151
  * Must be the canonical URL where the OIDC provider is accessible.
135
- */ _define_property$f(this, "issuer", void 0);
152
+ */ _define_property$g(this, "issuer", void 0);
136
153
  /**
137
154
  * The path prefix used for OIDC interaction endpoints (login/consent).
138
155
  *
139
156
  * Appended to the base appUrl this is the base frontend interaction path.
140
157
  *
141
158
  * Defaults to '/oauth'.
142
- */ _define_property$f(this, "appOAuthInteractionPath", void 0);
159
+ */ _define_property$g(this, "appOAuthInteractionPath", void 0);
143
160
  /**
144
161
  * Frontend URL for the login interaction page.
145
162
  * The interaction uid will be appended as a query parameter.
146
163
  *
147
164
  * Defaults to `<appOAuthInteractionPath>/login`.
148
- */ _define_property$f(this, "appOAuthLoginUrlPart", void 0);
165
+ */ _define_property$g(this, "appOAuthLoginUrlPart", void 0);
149
166
  /**
150
167
  * Frontend URL for the consent interaction page.
151
168
  *
152
169
  * Defaults to `<appOAuthInteractionPath>/consent`.
153
- */ _define_property$f(this, "appOAuthConsentUrlPart", void 0);
170
+ */ _define_property$g(this, "appOAuthConsentUrlPart", void 0);
154
171
  /**
155
172
  * Token lifetime configuration.
156
- */ _define_property$f(this, "tokenLifetimes", void 0);
173
+ */ _define_property$g(this, "tokenLifetimes", void 0);
157
174
  /**
158
175
  * Maximum login duration (seconds) a client may request via the `dbx_session_ttl` auth-URL param.
159
176
  *
@@ -162,24 +179,43 @@ function _define_property$f(obj, key, value) {
162
179
  * `min(client.dbx_max_session_ttl, this)`.
163
180
  *
164
181
  * Defaults to {@link DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS} (90 days).
165
- */ _define_property$f(this, "maxRequestedLoginDuration", void 0);
182
+ */ _define_property$g(this, "maxRequestedLoginDuration", void 0);
166
183
  /**
167
184
  * Minimum login duration (seconds) a client may request via the `dbx_session_ttl` auth-URL param.
168
185
  *
169
186
  * Requested values below this floor are clamped up. Prevents pathological 30-second sessions.
170
187
  *
171
188
  * Defaults to {@link DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS} (1 hour).
172
- */ _define_property$f(this, "minRequestedLoginDuration", void 0);
189
+ */ _define_property$g(this, "minRequestedLoginDuration", void 0);
173
190
  /**
174
191
  * Default login duration (seconds) used when a client does NOT pass the `dbx_session_ttl`
175
192
  * auth-URL param. When undefined, falls back to {@link OidcTokenLifetimes.refreshToken}.
176
- */ _define_property$f(this, "defaultRequestedLoginDuration", void 0);
193
+ */ _define_property$g(this, "defaultRequestedLoginDuration", void 0);
194
+ /**
195
+ * Tiered ceiling (seconds) on the requested login duration for a non-admin user.
196
+ *
197
+ * Used by `resolveTieredServerMaxSeconds` when the resolving user is not an admin; the resolved
198
+ * tier value is used as the `serverMaxSeconds` ceiling (it replaces the flat
199
+ * {@link maxRequestedLoginDuration}, since service-token tokens intentionally exceed it).
200
+ *
201
+ * Defaults to {@link DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS} (45 days).
202
+ */ _define_property$g(this, "maxRequestedLoginDurationNonAdmin", void 0);
203
+ /**
204
+ * Tiered ceiling (seconds) on a normal (non-service-token) requested login duration for an admin user.
205
+ *
206
+ * Defaults to {@link DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS} (90 days).
207
+ */ _define_property$g(this, "maxRequestedLoginDurationAdmin", void 0);
208
+ /**
209
+ * Tiered ceiling (seconds) on a requested login duration carrying an admin-only service-token scope.
210
+ *
211
+ * Defaults to {@link DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS} (365 days).
212
+ */ _define_property$g(this, "maxRequestedLoginDurationServiceToken", void 0);
177
213
  /**
178
214
  * JWKS service configuration (encryption secret, rotated key max age).
179
- */ _define_property$f(this, "jwksServiceConfig", void 0);
215
+ */ _define_property$g(this, "jwksServiceConfig", void 0);
180
216
  /**
181
217
  * JWKS key converter configuration (encryption secret for Firestore field encryption).
182
- */ _define_property$f(this, "jwksKeyConverterConfig", void 0);
218
+ */ _define_property$g(this, "jwksKeyConverterConfig", void 0);
183
219
  /**
184
220
  * Custom error rendering function for the oidc-provider.
185
221
  *
@@ -189,7 +225,7 @@ function _define_property$f(obj, key, value) {
189
225
  * errors are presented (e.g. redirect to an error page).
190
226
  *
191
227
  * The function signature matches oidc-provider's `renderError` configuration option.
192
- */ _define_property$f(this, "renderError", void 0);
228
+ */ _define_property$g(this, "renderError", void 0);
193
229
  /**
194
230
  * Whether to suppress the oidc-provider "already parsed request body" warning.
195
231
  *
@@ -198,7 +234,7 @@ function _define_property$f(obj, key, value) {
198
234
  * this correctly by falling back to `req.body`, but emits a one-time warning.
199
235
  *
200
236
  * Defaults to `false`.
201
- */ _define_property$f(this, "suppressBodyParserWarning", void 0);
237
+ */ _define_property$g(this, "suppressBodyParserWarning", void 0);
202
238
  /**
203
239
  * Path prefixes that require OAuth bearer token verification.
204
240
  *
@@ -208,7 +244,7 @@ function _define_property$f(obj, key, value) {
208
244
  *
209
245
  * Paths under the global API route prefix should not be included
210
246
  * since those are typically protected by AppCheck.
211
- */ _define_property$f(this, "protectedPaths", void 0);
247
+ */ _define_property$g(this, "protectedPaths", void 0);
212
248
  /**
213
249
  * Map of recognized OAuth resource indicator URLs (RFC 8707) to their
214
250
  * {@link OidcResourceServerInfo}. When non-empty, oidc-provider's
@@ -230,7 +266,7 @@ function _define_property$f(obj, key, value) {
230
266
  * }
231
267
  * }
232
268
  * ```
233
- */ _define_property$f(this, "resourceServers", void 0);
269
+ */ _define_property$g(this, "resourceServers", void 0);
234
270
  /**
235
271
  * When `true`, {@link oidcModuleMetadata} automatically derives a resource-server
236
272
  * entry from `envService.appMcpUrl` and the registered {@link OidcAccountService}'s
@@ -246,7 +282,7 @@ function _define_property$f(obj, key, value) {
246
282
  * Defaults to `false`.
247
283
  *
248
284
  * @see buildFirebaseServerMcpResourceServer
249
- */ _define_property$f(this, "configureMcpResourceServer", void 0);
285
+ */ _define_property$g(this, "configureMcpResourceServer", void 0);
250
286
  /**
251
287
  * Absolute URL of the OAuth 2.0 Protected Resource Metadata document
252
288
  * (RFC 9728) for the resources guarded by {@link protectedPaths}.
@@ -264,7 +300,7 @@ function _define_property$f(obj, key, value) {
264
300
  *
265
301
  * @example
266
302
  * resourceMetadataUrl: 'http://localhost:9902/dereekb-components/us-central1/api/.well-known/oauth-protected-resource'
267
- */ _define_property$f(this, "resourceMetadataUrl", void 0);
303
+ */ _define_property$g(this, "resourceMetadataUrl", void 0);
268
304
  /**
269
305
  * Supported token endpoint authentication methods.
270
306
  *
@@ -272,7 +308,7 @@ function _define_property$f(obj, key, value) {
272
308
  * in the discovery metadata document.
273
309
  *
274
310
  * @see DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS
275
- */ _define_property$f(this, "tokenEndpointAuthMethods", void 0);
311
+ */ _define_property$g(this, "tokenEndpointAuthMethods", void 0);
276
312
  /**
277
313
  * Whether to enable the OIDC dynamic client registration endpoint (`/reg`).
278
314
  *
@@ -280,7 +316,7 @@ function _define_property$f(obj, key, value) {
280
316
  * and manage their registrations via the registration management feature.
281
317
  *
282
318
  * Defaults to `false`.
283
- */ _define_property$f(this, "registrationEnabled", void 0);
319
+ */ _define_property$g(this, "registrationEnabled", void 0);
284
320
  /**
285
321
  * Whether the oidc-provider should trust upstream proxy headers
286
322
  * (`X-Forwarded-Host`, `X-Forwarded-Proto`) when computing the request URL
@@ -299,7 +335,7 @@ function _define_property$f(obj, key, value) {
299
335
  * (which is the Koa `app.proxy` setting).
300
336
  *
301
337
  * Defaults to `'prod_only'` if the environment is `production`, otherwise `false`.
302
- */ _define_property$f(this, "trustProxy", void 0);
338
+ */ _define_property$g(this, "trustProxy", void 0);
303
339
  /**
304
340
  * Whether to trust proxy headers in a non-production environment, such as the local environment.
305
341
  *
@@ -307,9 +343,9 @@ function _define_property$f(obj, key, value) {
307
343
  * `true` will result in errors.
308
344
  *
309
345
  * Defaults to `false`.
310
- */ _define_property$f(this, "trustProxyInNonProduction", void 0);
346
+ */ _define_property$g(this, "trustProxyInNonProduction", void 0);
311
347
  }
312
- _create_class$d(OidcModuleConfig, null, [
348
+ _create_class$e(OidcModuleConfig, null, [
313
349
  {
314
350
  key: "assertValidConfig",
315
351
  value: /**
@@ -353,6 +389,17 @@ function _define_property$f(obj, key, value) {
353
389
  /**
354
390
  * Custom oidc-provider client metadata field for a client's maximum requestable login duration (seconds).
355
391
  */ var DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA = 'dbx_max_session_ttl';
392
+ /**
393
+ * Access-token `extra` claim carrying the grant's resolved expiry as unix seconds.
394
+ *
395
+ * Baked on at issuance (`extraTokenClaims`) and read back by `verifyAccessToken` and the
396
+ * `GET /oidc/session` route so clients can surface the session lifetime without decoding the token.
397
+ */ var DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM = 'dbx_session_expires_at';
398
+ /**
399
+ * Access-token `extra` claim flagging whether the grant's refresh token rotation is disabled.
400
+ *
401
+ * `true` when the token's scope set intersects {@link OidcProviderConfig.nonRotatingScopes}.
402
+ */ var DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM = 'dbx_rotation_disabled';
356
403
  /**
357
404
  * Clamps a requested login duration into the allowed range.
358
405
  *
@@ -380,6 +427,77 @@ function _define_property$f(obj, key, value) {
380
427
  var ceiling = Math.min(input.serverMaxSeconds, (_input_clientMaxSeconds = input.clientMaxSeconds) !== null && _input_clientMaxSeconds !== void 0 ? _input_clientMaxSeconds : Infinity);
381
428
  return Math.max(input.serverMinSeconds, Math.min(raw, ceiling));
382
429
  }
430
+ /**
431
+ * Resolves the tiered server-max ceiling (seconds) used as `serverMaxSeconds` for a login duration.
432
+ *
433
+ * Tiers, highest to lowest priority:
434
+ * 1. Admin + service-token scope → `serviceTokenMax`.
435
+ * 2. Admin (normal) → `adminMax`.
436
+ * 3. Non-admin → `nonAdminMax`.
437
+ *
438
+ * A non-admin should never reach the service-token branch — the consent flow hard-rejects a
439
+ * non-admin requesting a service-token scope before this resolves — but the tiering is defensive:
440
+ * a non-admin always resolves to `nonAdminMax` regardless of `hasServiceScope`.
441
+ *
442
+ * @param input - The tier inputs (admin flag, service-scope flag, and the three tier ceilings).
443
+ * @returns The resolved ceiling in seconds.
444
+ */ function resolveTieredServerMaxSeconds(input) {
445
+ var isAdmin = input.isAdmin, hasServiceScope = input.hasServiceScope, nonAdminMax = input.nonAdminMax, adminMax = input.adminMax, serviceTokenMax = input.serviceTokenMax;
446
+ var result;
447
+ if (!isAdmin) {
448
+ result = nonAdminMax;
449
+ } else if (hasServiceScope) {
450
+ result = serviceTokenMax;
451
+ } else {
452
+ result = adminMax;
453
+ }
454
+ return result;
455
+ }
456
+ // MARK: Refresh token rotation
457
+ /**
458
+ * Absolute cap (seconds) on how long a refresh token may be rotated, after which its TTL is final.
459
+ *
460
+ * Mirrors node-oidc-provider's default `rotateRefreshToken` cap of `365.25 * 24 * 60 * 60`.
461
+ */ var REFRESH_TOKEN_ROTATION_MAX_LIFETIME_SECONDS = 365.25 * 24 * 60 * 60;
462
+ /**
463
+ * Percentage of a refresh token's lifetime that must elapse before the library-default branch rotates it.
464
+ *
465
+ * Mirrors node-oidc-provider's default `rotateRefreshToken` threshold of `70`.
466
+ */ var REFRESH_TOKEN_ROTATION_TTL_PERCENTAGE_THRESHOLD = 70;
467
+ /**
468
+ * Decides whether a refresh token should rotate on exchange.
469
+ *
470
+ * Returns `false` (no rotation) whenever the token's scope set intersects `nonRotatingScopes` — the
471
+ * dbx-components extension point that makes service tokens stable for server env consumption.
472
+ *
473
+ * For every other token this **replicates node-oidc-provider's default `rotateRefreshToken`**
474
+ * (because setting the option disables the library's built-in default, we must reproduce it):
475
+ * 1. `totalLifetime >= 365.25d` → `false` (rotation cap reached; TTL is final).
476
+ * 2. public client (`clientAuthMethod === 'none'`) and not sender-constrained → `true`.
477
+ * 3. otherwise → `ttlPercentagePassed >= 70`.
478
+ *
479
+ * Keep this in sync with `node_modules/oidc-provider/lib/helpers/defaults.js` (`rotateRefreshToken`)
480
+ * across oidc-provider upgrades.
481
+ *
482
+ * @param input - The rotation inputs.
483
+ * @returns Whether the refresh token should rotate.
484
+ */ function shouldRotateRefreshToken(input) {
485
+ var scope = input.scope, nonRotatingScopes = input.nonRotatingScopes, totalLifetimeSeconds = input.totalLifetimeSeconds, clientAuthMethod = input.clientAuthMethod, isSenderConstrained = input.isSenderConstrained, ttlPercentagePassed = input.ttlPercentagePassed;
486
+ var scopeSet = new Set((scope !== null && scope !== void 0 ? scope : '').split(' ').filter(Boolean));
487
+ var result;
488
+ if (nonRotatingScopes.some(function(nonRotatingScope) {
489
+ return scopeSet.has(nonRotatingScope);
490
+ })) {
491
+ result = false;
492
+ } else if (totalLifetimeSeconds >= REFRESH_TOKEN_ROTATION_MAX_LIFETIME_SECONDS) {
493
+ result = false;
494
+ } else if (clientAuthMethod === 'none' && !isSenderConstrained) {
495
+ result = true;
496
+ } else {
497
+ result = ttlPercentagePassed >= REFRESH_TOKEN_ROTATION_TTL_PERCENTAGE_THRESHOLD;
498
+ }
499
+ return result;
500
+ }
383
501
  // MARK: Param parsing
384
502
  /**
385
503
  * Parses a raw `dbx_session_ttl` value (string or number, from URL query / form / persisted interaction params)
@@ -477,7 +595,7 @@ function _define_property$f(obj, key, value) {
477
595
  return jwksKeysWithStatusQuery('rotated');
478
596
  }
479
597
 
480
- function _class_call_check$f(instance, Constructor) {
598
+ function _class_call_check$h(instance, Constructor) {
481
599
  if (!(instance instanceof Constructor)) {
482
600
  throw new TypeError("Cannot call a class as a function");
483
601
  }
@@ -489,7 +607,7 @@ function _class_call_check$f(instance, Constructor) {
489
607
  * Extends both {@link JwksFirestoreCollections} (server-only JWKS keys) and
490
608
  * {@link OidcModelFirestoreCollections} (shared adapter entries).
491
609
  */ var OidcServerFirestoreCollections = function OidcServerFirestoreCollections() {
492
- _class_call_check$f(this, OidcServerFirestoreCollections);
610
+ _class_call_check$h(this, OidcServerFirestoreCollections);
493
611
  }
494
612
  ;
495
613
 
@@ -522,12 +640,12 @@ function _async_to_generator$a(fn) {
522
640
  });
523
641
  };
524
642
  }
525
- function _class_call_check$e(instance, Constructor) {
643
+ function _class_call_check$g(instance, Constructor) {
526
644
  if (!(instance instanceof Constructor)) {
527
645
  throw new TypeError("Cannot call a class as a function");
528
646
  }
529
647
  }
530
- function _defineProperties$c(target, props) {
648
+ function _defineProperties$d(target, props) {
531
649
  for(var i = 0; i < props.length; i++){
532
650
  var descriptor = props[i];
533
651
  descriptor.enumerable = descriptor.enumerable || false;
@@ -536,11 +654,11 @@ function _defineProperties$c(target, props) {
536
654
  Object.defineProperty(target, descriptor.key, descriptor);
537
655
  }
538
656
  }
539
- function _create_class$c(Constructor, protoProps, staticProps) {
540
- if (protoProps) _defineProperties$c(Constructor.prototype, protoProps);
657
+ function _create_class$d(Constructor, protoProps, staticProps) {
658
+ if (protoProps) _defineProperties$d(Constructor.prototype, protoProps);
541
659
  return Constructor;
542
660
  }
543
- function _define_property$e(obj, key, value) {
661
+ function _define_property$f(obj, key, value) {
544
662
  if (key in obj) {
545
663
  Object.defineProperty(obj, key, {
546
664
  value: value,
@@ -553,7 +671,7 @@ function _define_property$e(obj, key, value) {
553
671
  }
554
672
  return obj;
555
673
  }
556
- function _object_spread$6(target) {
674
+ function _object_spread$7(target) {
557
675
  for(var i = 1; i < arguments.length; i++){
558
676
  var source = arguments[i] != null ? arguments[i] : {};
559
677
  var ownKeys = Object.keys(source);
@@ -563,7 +681,7 @@ function _object_spread$6(target) {
563
681
  }));
564
682
  }
565
683
  ownKeys.forEach(function(key) {
566
- _define_property$e(target, key, source[key]);
684
+ _define_property$f(target, key, source[key]);
567
685
  });
568
686
  }
569
687
  return target;
@@ -688,24 +806,24 @@ function _ts_generator$a(thisArg, body) {
688
806
  }
689
807
  // MARK: Config
690
808
  var JwksServiceConfig = function JwksServiceConfig() {
691
- _class_call_check$e(this, JwksServiceConfig);
809
+ _class_call_check$g(this, JwksServiceConfig);
692
810
  };
693
811
  /**
694
812
  * If provided, the JwksService will write the JWKS to this file when keys are rotated.
695
813
  */ var JwksServiceStorageConfig = function JwksServiceStorageConfig() {
696
- _class_call_check$e(this, JwksServiceStorageConfig);
814
+ _class_call_check$g(this, JwksServiceStorageConfig);
697
815
  };
698
816
  var DEFAULT_ROTATED_KEY_MAX_AGE = 30 * 24 * 60 * 60; // 30 days
699
817
  // MARK: Service
700
818
  exports.JwksService = /*#__PURE__*/ function() {
701
819
  function JwksService(config, collections, storageConfig) {
702
820
  var _this = this;
703
- _class_call_check$e(this, JwksService);
821
+ _class_call_check$g(this, JwksService);
704
822
  var _config_rotatedKeyMaxAge, _config_enableSaveJwksToStorage, _config_serveJwksFromStorage;
705
- _define_property$e(this, "config", void 0);
706
- _define_property$e(this, "collections", void 0);
707
- _define_property$e(this, "storageConfig", void 0);
708
- _define_property$e(this, "_jwksStoragePublicUrl", util.cachedGetter(function() {
823
+ _define_property$f(this, "config", void 0);
824
+ _define_property$f(this, "collections", void 0);
825
+ _define_property$f(this, "storageConfig", void 0);
826
+ _define_property$f(this, "_jwksStoragePublicUrl", util.cachedGetter(function() {
709
827
  return _async_to_generator$a(function() {
710
828
  var _this, _this_storageConfig, result, _file;
711
829
  return _ts_generator$a(this, function(_state) {
@@ -754,13 +872,13 @@ exports.JwksService = /*#__PURE__*/ function() {
754
872
  });
755
873
  }).call(_this);
756
874
  }));
757
- _define_property$e(this, "rotatedKeyMaxAge", void 0);
875
+ _define_property$f(this, "rotatedKeyMaxAge", void 0);
758
876
  /**
759
877
  * Whether the JWKS is served from a public storage URL rather than the built-in endpoint.
760
- */ _define_property$e(this, "serveJwksFromStorage", void 0);
878
+ */ _define_property$f(this, "serveJwksFromStorage", void 0);
761
879
  /**
762
880
  * Whether the JWKS should be saved to storage when keys are rotated.
763
- */ _define_property$e(this, "saveJwksToStorage", void 0);
881
+ */ _define_property$f(this, "saveJwksToStorage", void 0);
764
882
  this.config = config;
765
883
  this.collections = collections;
766
884
  this.storageConfig = storageConfig;
@@ -769,7 +887,7 @@ exports.JwksService = /*#__PURE__*/ function() {
769
887
  this.saveJwksToStorage = (_config_enableSaveJwksToStorage = config.enableSaveJwksToStorage) !== null && _config_enableSaveJwksToStorage !== void 0 ? _config_enableSaveJwksToStorage : hasStorageFile;
770
888
  this.serveJwksFromStorage = (_config_serveJwksFromStorage = config.serveJwksFromStorage) !== null && _config_serveJwksFromStorage !== void 0 ? _config_serveJwksFromStorage : this.saveJwksToStorage;
771
889
  }
772
- _create_class$c(JwksService, [
890
+ _create_class$d(JwksService, [
773
891
  {
774
892
  key: "jwksKeyCollection",
775
893
  get: function get() {
@@ -804,13 +922,13 @@ exports.JwksService = /*#__PURE__*/ function() {
804
922
  }
805
923
  }), publicKey = _generateKeyPairSync.publicKey, privateKey = _generateKeyPairSync.privateKey;
806
924
  kid = node_crypto.randomBytes(16).toString('hex');
807
- publicJwk = _object_spread_props$3(_object_spread$6({}, publicKey), {
925
+ publicJwk = _object_spread_props$3(_object_spread$7({}, publicKey), {
808
926
  kid: kid,
809
927
  kty: 'RSA',
810
928
  alg: 'RS256',
811
929
  use: 'sig'
812
930
  });
813
- privateJwk = _object_spread_props$3(_object_spread$6({}, privateKey), {
931
+ privateJwk = _object_spread_props$3(_object_spread$7({}, privateKey), {
814
932
  kid: kid,
815
933
  kty: 'RSA',
816
934
  alg: 'RS256',
@@ -1228,12 +1346,12 @@ function _async_to_generator$9(fn) {
1228
1346
  });
1229
1347
  };
1230
1348
  }
1231
- function _class_call_check$d(instance, Constructor) {
1349
+ function _class_call_check$f(instance, Constructor) {
1232
1350
  if (!(instance instanceof Constructor)) {
1233
1351
  throw new TypeError("Cannot call a class as a function");
1234
1352
  }
1235
1353
  }
1236
- function _defineProperties$b(target, props) {
1354
+ function _defineProperties$c(target, props) {
1237
1355
  for(var i = 0; i < props.length; i++){
1238
1356
  var descriptor = props[i];
1239
1357
  descriptor.enumerable = descriptor.enumerable || false;
@@ -1242,11 +1360,11 @@ function _defineProperties$b(target, props) {
1242
1360
  Object.defineProperty(target, descriptor.key, descriptor);
1243
1361
  }
1244
1362
  }
1245
- function _create_class$b(Constructor, protoProps, staticProps) {
1246
- if (protoProps) _defineProperties$b(Constructor.prototype, protoProps);
1363
+ function _create_class$c(Constructor, protoProps, staticProps) {
1364
+ if (protoProps) _defineProperties$c(Constructor.prototype, protoProps);
1247
1365
  return Constructor;
1248
1366
  }
1249
- function _define_property$d(obj, key, value) {
1367
+ function _define_property$e(obj, key, value) {
1250
1368
  if (key in obj) {
1251
1369
  Object.defineProperty(obj, key, {
1252
1370
  value: value,
@@ -1401,7 +1519,7 @@ function _ts_generator$9(thisArg, body) {
1401
1519
  * };
1402
1520
  * ```
1403
1521
  */ var OidcAccountServiceDelegate = function OidcAccountServiceDelegate() {
1404
- _class_call_check$d(this, OidcAccountServiceDelegate);
1522
+ _class_call_check$f(this, OidcAccountServiceDelegate);
1405
1523
  };
1406
1524
  // MARK: User Context
1407
1525
  /**
@@ -1410,15 +1528,15 @@ function _ts_generator$9(thisArg, body) {
1410
1528
  * Created by {@link OidcAccountService.userContext} for a specific user ID.
1411
1529
  */ var OidcAccountServiceUserContext = /*#__PURE__*/ function() {
1412
1530
  function OidcAccountServiceUserContext(_service, _uid) {
1413
- _class_call_check$d(this, OidcAccountServiceUserContext);
1414
- _define_property$d(this, "_service", void 0);
1415
- _define_property$d(this, "_uid", void 0);
1416
- _define_property$d(this, "authUserContext", void 0);
1531
+ _class_call_check$f(this, OidcAccountServiceUserContext);
1532
+ _define_property$e(this, "_service", void 0);
1533
+ _define_property$e(this, "_uid", void 0);
1534
+ _define_property$e(this, "authUserContext", void 0);
1417
1535
  this._service = _service;
1418
1536
  this._uid = _uid;
1419
1537
  this.authUserContext = this._service.authService.userContext(this._uid);
1420
1538
  }
1421
- _create_class$b(OidcAccountServiceUserContext, [
1539
+ _create_class$c(OidcAccountServiceUserContext, [
1422
1540
  {
1423
1541
  key: "uid",
1424
1542
  get: function get() {
@@ -1493,13 +1611,13 @@ function _ts_generator$9(thisArg, body) {
1493
1611
  * Register it as a provider using the `OidcAccountService` class as the injection token.
1494
1612
  */ var OidcAccountService = /*#__PURE__*/ function() {
1495
1613
  function OidcAccountService(authService, delegate) {
1496
- _class_call_check$d(this, OidcAccountService);
1497
- _define_property$d(this, "authService", void 0);
1498
- _define_property$d(this, "delegate", void 0);
1614
+ _class_call_check$f(this, OidcAccountService);
1615
+ _define_property$e(this, "authService", void 0);
1616
+ _define_property$e(this, "delegate", void 0);
1499
1617
  this.authService = authService;
1500
1618
  this.delegate = delegate;
1501
1619
  }
1502
- _create_class$b(OidcAccountService, [
1620
+ _create_class$c(OidcAccountService, [
1503
1621
  {
1504
1622
  key: "providerConfig",
1505
1623
  get: /**
@@ -1526,22 +1644,22 @@ function _ts_generator$9(thisArg, body) {
1526
1644
  }
1527
1645
  ();
1528
1646
 
1529
- function _assert_this_initialized(self) {
1647
+ function _assert_this_initialized$1(self) {
1530
1648
  if (self === void 0) {
1531
1649
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1532
1650
  }
1533
1651
  return self;
1534
1652
  }
1535
- function _call_super(_this, derived, args) {
1536
- derived = _get_prototype_of(derived);
1537
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
1653
+ function _call_super$1(_this, derived, args) {
1654
+ derived = _get_prototype_of$1(derived);
1655
+ return _possible_constructor_return$1(_this, _is_native_reflect_construct$1() ? Reflect.construct(derived, args || [], _get_prototype_of$1(_this).constructor) : derived.apply(_this, args));
1538
1656
  }
1539
- function _class_call_check$c(instance, Constructor) {
1657
+ function _class_call_check$e(instance, Constructor) {
1540
1658
  if (!(instance instanceof Constructor)) {
1541
1659
  throw new TypeError("Cannot call a class as a function");
1542
1660
  }
1543
1661
  }
1544
- function _defineProperties$a(target, props) {
1662
+ function _defineProperties$b(target, props) {
1545
1663
  for(var i = 0; i < props.length; i++){
1546
1664
  var descriptor = props[i];
1547
1665
  descriptor.enumerable = descriptor.enumerable || false;
@@ -1550,17 +1668,17 @@ function _defineProperties$a(target, props) {
1550
1668
  Object.defineProperty(target, descriptor.key, descriptor);
1551
1669
  }
1552
1670
  }
1553
- function _create_class$a(Constructor, protoProps, staticProps) {
1554
- if (protoProps) _defineProperties$a(Constructor.prototype, protoProps);
1671
+ function _create_class$b(Constructor, protoProps, staticProps) {
1672
+ if (protoProps) _defineProperties$b(Constructor.prototype, protoProps);
1555
1673
  return Constructor;
1556
1674
  }
1557
- function _get_prototype_of(o) {
1558
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1675
+ function _get_prototype_of$1(o) {
1676
+ _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1559
1677
  return o.__proto__ || Object.getPrototypeOf(o);
1560
1678
  };
1561
- return _get_prototype_of(o);
1679
+ return _get_prototype_of$1(o);
1562
1680
  }
1563
- function _inherits(subClass, superClass) {
1681
+ function _inherits$1(subClass, superClass) {
1564
1682
  if (typeof superClass !== "function" && superClass !== null) {
1565
1683
  throw new TypeError("Super expression must either be null or a function");
1566
1684
  }
@@ -1571,30 +1689,30 @@ function _inherits(subClass, superClass) {
1571
1689
  configurable: true
1572
1690
  }
1573
1691
  });
1574
- if (superClass) _set_prototype_of(subClass, superClass);
1692
+ if (superClass) _set_prototype_of$1(subClass, superClass);
1575
1693
  }
1576
- function _possible_constructor_return(self, call) {
1577
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
1694
+ function _possible_constructor_return$1(self, call) {
1695
+ if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
1578
1696
  return call;
1579
1697
  }
1580
- return _assert_this_initialized(self);
1698
+ return _assert_this_initialized$1(self);
1581
1699
  }
1582
- function _set_prototype_of(o, p) {
1583
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1700
+ function _set_prototype_of$1(o, p) {
1701
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1584
1702
  o.__proto__ = p;
1585
1703
  return o;
1586
1704
  };
1587
- return _set_prototype_of(o, p);
1705
+ return _set_prototype_of$1(o, p);
1588
1706
  }
1589
- function _type_of(obj) {
1707
+ function _type_of$1(obj) {
1590
1708
  "@swc/helpers - typeof";
1591
1709
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1592
1710
  }
1593
- function _is_native_reflect_construct() {
1711
+ function _is_native_reflect_construct$1() {
1594
1712
  try {
1595
1713
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1596
1714
  } catch (_) {}
1597
- return (_is_native_reflect_construct = function() {
1715
+ return (_is_native_reflect_construct$1 = function() {
1598
1716
  return !!result;
1599
1717
  })();
1600
1718
  }
@@ -1604,7 +1722,7 @@ function _is_native_reflect_construct() {
1604
1722
  *
1605
1723
  * Implementations provide concrete collection instances wired to a specific {@link FirestoreContext}.
1606
1724
  */ var JwksFirestoreCollections = function JwksFirestoreCollections() {
1607
- _class_call_check$c(this, JwksFirestoreCollections);
1725
+ _class_call_check$e(this, JwksFirestoreCollections);
1608
1726
  };
1609
1727
  // MARK: Identity
1610
1728
  /**
@@ -1615,12 +1733,12 @@ function _is_native_reflect_construct() {
1615
1733
  /**
1616
1734
  * Firestore document wrapper for {@link JwksKey}.
1617
1735
  */ var JwksKeyDocument = /*#__PURE__*/ function(AbstractFirestoreDocument) {
1618
- _inherits(JwksKeyDocument, AbstractFirestoreDocument);
1736
+ _inherits$1(JwksKeyDocument, AbstractFirestoreDocument);
1619
1737
  function JwksKeyDocument() {
1620
- _class_call_check$c(this, JwksKeyDocument);
1621
- return _call_super(this, JwksKeyDocument, arguments);
1738
+ _class_call_check$e(this, JwksKeyDocument);
1739
+ return _call_super$1(this, JwksKeyDocument, arguments);
1622
1740
  }
1623
- _create_class$a(JwksKeyDocument, [
1741
+ _create_class$b(JwksKeyDocument, [
1624
1742
  {
1625
1743
  key: "modelIdentity",
1626
1744
  get: function get() {
@@ -1712,7 +1830,7 @@ function _async_to_generator$8(fn) {
1712
1830
  });
1713
1831
  };
1714
1832
  }
1715
- function _class_call_check$b(instance, Constructor) {
1833
+ function _class_call_check$d(instance, Constructor) {
1716
1834
  if (!(instance instanceof Constructor)) {
1717
1835
  throw new TypeError("Cannot call a class as a function");
1718
1836
  }
@@ -1822,7 +1940,7 @@ function _ts_generator$8(thisArg, body) {
1822
1940
  *
1823
1941
  * @see {@link oidcModelServerActions} for the concrete implementation factory.
1824
1942
  */ var OidcModelServerActions = function OidcModelServerActions() {
1825
- _class_call_check$b(this, OidcModelServerActions);
1943
+ _class_call_check$d(this, OidcModelServerActions);
1826
1944
  };
1827
1945
  /**
1828
1946
  * Creates a concrete {@link OidcModelServerActions} implementation wired to the provided context.
@@ -2064,12 +2182,12 @@ function _async_to_generator$7(fn) {
2064
2182
  });
2065
2183
  };
2066
2184
  }
2067
- function _class_call_check$a(instance, Constructor) {
2185
+ function _class_call_check$c(instance, Constructor) {
2068
2186
  if (!(instance instanceof Constructor)) {
2069
2187
  throw new TypeError("Cannot call a class as a function");
2070
2188
  }
2071
2189
  }
2072
- function _defineProperties$9(target, props) {
2190
+ function _defineProperties$a(target, props) {
2073
2191
  for(var i = 0; i < props.length; i++){
2074
2192
  var descriptor = props[i];
2075
2193
  descriptor.enumerable = descriptor.enumerable || false;
@@ -2078,11 +2196,11 @@ function _defineProperties$9(target, props) {
2078
2196
  Object.defineProperty(target, descriptor.key, descriptor);
2079
2197
  }
2080
2198
  }
2081
- function _create_class$9(Constructor, protoProps, staticProps) {
2082
- if (protoProps) _defineProperties$9(Constructor.prototype, protoProps);
2199
+ function _create_class$a(Constructor, protoProps, staticProps) {
2200
+ if (protoProps) _defineProperties$a(Constructor.prototype, protoProps);
2083
2201
  return Constructor;
2084
2202
  }
2085
- function _define_property$c(obj, key, value) {
2203
+ function _define_property$d(obj, key, value) {
2086
2204
  if (key in obj) {
2087
2205
  Object.defineProperty(obj, key, {
2088
2206
  value: value,
@@ -2095,7 +2213,7 @@ function _define_property$c(obj, key, value) {
2095
2213
  }
2096
2214
  return obj;
2097
2215
  }
2098
- function _object_spread$5(target) {
2216
+ function _object_spread$6(target) {
2099
2217
  for(var i = 1; i < arguments.length; i++){
2100
2218
  var source = arguments[i] != null ? arguments[i] : {};
2101
2219
  var ownKeys = Object.keys(source);
@@ -2105,7 +2223,7 @@ function _object_spread$5(target) {
2105
2223
  }));
2106
2224
  }
2107
2225
  ownKeys.forEach(function(key) {
2108
- _define_property$c(target, key, source[key]);
2226
+ _define_property$d(target, key, source[key]);
2109
2227
  });
2110
2228
  }
2111
2229
  return target;
@@ -2234,13 +2352,17 @@ function _ts_generator$7(thisArg, body) {
2234
2352
  *
2235
2353
  * Mirrors the oidc-provider `registration.js` flow to ensure all provider
2236
2354
  * validation and lifecycle hooks run.
2355
+ *
2356
+ * Client create/update/rotate/delete are driven by callModel functions, so their
2357
+ * analytics are captured by the callModel analytics layer (`OnCallModelAnalyticsService`)
2358
+ * with the acting user — not by the OIDC analytics service.
2237
2359
  */ var OidcClientService = /*#__PURE__*/ function() {
2238
2360
  function OidcClientService(oidcService) {
2239
- _class_call_check$a(this, OidcClientService);
2240
- _define_property$c(this, "oidcService", void 0);
2361
+ _class_call_check$c(this, OidcClientService);
2362
+ _define_property$d(this, "oidcService", void 0);
2241
2363
  this.oidcService = oidcService;
2242
2364
  }
2243
- _create_class$9(OidcClientService, [
2365
+ _create_class$a(OidcClientService, [
2244
2366
  {
2245
2367
  key: "createClient",
2246
2368
  value: /**
@@ -2378,7 +2500,7 @@ function _ts_generator$7(thisArg, body) {
2378
2500
  if (!existing) {
2379
2501
  throw new Error('Client not found.');
2380
2502
  }
2381
- updatedMetadata = _object_spread$5({}, existing);
2503
+ updatedMetadata = _object_spread$6({}, existing);
2382
2504
  updatedMetadata.client_name = params.client_name;
2383
2505
  updatedMetadata.redirect_uris = params.redirect_uris;
2384
2506
  if (params.logo_uri !== undefined) {
@@ -2452,7 +2574,7 @@ function _ts_generator$7(thisArg, body) {
2452
2574
  throw new Error('Cannot rotate a client secret for a public PKCE client (token_endpoint_auth_method "none"). Public clients have no secret.');
2453
2575
  }
2454
2576
  newSecret = node_crypto.randomBytes(64).toString('base64url');
2455
- updatedMetadata = _object_spread_props$2(_object_spread$5({}, existing), {
2577
+ updatedMetadata = _object_spread_props$2(_object_spread$6({}, existing), {
2456
2578
  client_secret: newSecret,
2457
2579
  client_secret_expires_at: 0
2458
2580
  });
@@ -2529,7 +2651,7 @@ function _ts_generator$7(thisArg, body) {
2529
2651
  }
2530
2652
  ();
2531
2653
 
2532
- function _define_property$b(obj, key, value) {
2654
+ function _define_property$c(obj, key, value) {
2533
2655
  if (key in obj) {
2534
2656
  Object.defineProperty(obj, key, {
2535
2657
  value: value,
@@ -2542,7 +2664,7 @@ function _define_property$b(obj, key, value) {
2542
2664
  }
2543
2665
  return obj;
2544
2666
  }
2545
- function _object_spread$4(target) {
2667
+ function _object_spread$5(target) {
2546
2668
  for(var i = 1; i < arguments.length; i++){
2547
2669
  var source = arguments[i] != null ? arguments[i] : {};
2548
2670
  var ownKeys = Object.keys(source);
@@ -2552,7 +2674,7 @@ function _object_spread$4(target) {
2552
2674
  }));
2553
2675
  }
2554
2676
  ownKeys.forEach(function(key) {
2555
- _define_property$b(target, key, source[key]);
2677
+ _define_property$c(target, key, source[key]);
2556
2678
  });
2557
2679
  }
2558
2680
  return target;
@@ -2584,7 +2706,7 @@ function _object_spread_props$1(target, source) {
2584
2706
  * @param oidcService - The core OIDC service for grant revocation.
2585
2707
  * @returns The configured OidcModelServerActions instance.
2586
2708
  */ function oidcModelServerActionsFactory(oidcClientService, oidcService) {
2587
- var context = _object_spread_props$1(_object_spread$4({}, firebaseServer.firebaseServerActionsContext()), {
2709
+ var context = _object_spread_props$1(_object_spread$5({}, firebaseServer.firebaseServerActionsContext()), {
2588
2710
  oidcClientService: oidcClientService,
2589
2711
  oidcService: oidcService
2590
2712
  });
@@ -2649,12 +2771,12 @@ function _async_to_generator$6(fn) {
2649
2771
  });
2650
2772
  };
2651
2773
  }
2652
- function _class_call_check$9(instance, Constructor) {
2774
+ function _class_call_check$b(instance, Constructor) {
2653
2775
  if (!(instance instanceof Constructor)) {
2654
2776
  throw new TypeError("Cannot call a class as a function");
2655
2777
  }
2656
2778
  }
2657
- function _defineProperties$8(target, props) {
2779
+ function _defineProperties$9(target, props) {
2658
2780
  for(var i = 0; i < props.length; i++){
2659
2781
  var descriptor = props[i];
2660
2782
  descriptor.enumerable = descriptor.enumerable || false;
@@ -2663,11 +2785,11 @@ function _defineProperties$8(target, props) {
2663
2785
  Object.defineProperty(target, descriptor.key, descriptor);
2664
2786
  }
2665
2787
  }
2666
- function _create_class$8(Constructor, protoProps, staticProps) {
2667
- if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
2788
+ function _create_class$9(Constructor, protoProps, staticProps) {
2789
+ if (protoProps) _defineProperties$9(Constructor.prototype, protoProps);
2668
2790
  return Constructor;
2669
2791
  }
2670
- function _define_property$a(obj, key, value) {
2792
+ function _define_property$b(obj, key, value) {
2671
2793
  if (key in obj) {
2672
2794
  Object.defineProperty(obj, key, {
2673
2795
  value: value,
@@ -2688,7 +2810,7 @@ function _instanceof$2(left, right) {
2688
2810
  return left instanceof right;
2689
2811
  }
2690
2812
  }
2691
- function _object_spread$3(target) {
2813
+ function _object_spread$4(target) {
2692
2814
  for(var i = 1; i < arguments.length; i++){
2693
2815
  var source = arguments[i] != null ? arguments[i] : {};
2694
2816
  var ownKeys = Object.keys(source);
@@ -2698,7 +2820,7 @@ function _object_spread$3(target) {
2698
2820
  }));
2699
2821
  }
2700
2822
  ownKeys.forEach(function(key) {
2701
- _define_property$a(target, key, source[key]);
2823
+ _define_property$b(target, key, source[key]);
2702
2824
  });
2703
2825
  }
2704
2826
  return target;
@@ -2832,13 +2954,13 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
2832
2954
  */ function createAdapterFactory(collections, encryptionService) {
2833
2955
  var FirestoreAdapter = /*#__PURE__*/ function() {
2834
2956
  function FirestoreAdapter(name) {
2835
- _class_call_check$9(this, FirestoreAdapter);
2836
- _define_property$a(this, "name", void 0);
2837
- _define_property$a(this, "collection", void 0);
2957
+ _class_call_check$b(this, FirestoreAdapter);
2958
+ _define_property$b(this, "name", void 0);
2959
+ _define_property$b(this, "collection", void 0);
2838
2960
  this.name = name;
2839
2961
  this.collection = collections.oidcEntryCollection;
2840
2962
  }
2841
- _create_class$8(FirestoreAdapter, [
2963
+ _create_class$9(FirestoreAdapter, [
2842
2964
  {
2843
2965
  key: "upsert",
2844
2966
  value: function upsert(id, payload, expiresIn) {
@@ -2869,7 +2991,7 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
2869
2991
  } else if (createdAtIso) {
2870
2992
  createdAt = date.safeToJsDate(createdAtIso);
2871
2993
  }
2872
- data = _object_spread$3({
2994
+ data = _object_spread$4({
2873
2995
  type: this.name,
2874
2996
  payload: encryptionService.encryptAdapterPayload(payload),
2875
2997
  o: o,
@@ -3103,20 +3225,20 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
3103
3225
  return FirestoreAdapter;
3104
3226
  }
3105
3227
 
3106
- function _array_like_to_array$4(arr, len) {
3228
+ function _array_like_to_array$5(arr, len) {
3107
3229
  if (len == null || len > arr.length) len = arr.length;
3108
3230
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3109
3231
  return arr2;
3110
3232
  }
3111
- function _array_without_holes$3(arr) {
3112
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
3233
+ function _array_without_holes$5(arr) {
3234
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
3113
3235
  }
3114
- function _class_call_check$8(instance, Constructor) {
3236
+ function _class_call_check$a(instance, Constructor) {
3115
3237
  if (!(instance instanceof Constructor)) {
3116
3238
  throw new TypeError("Cannot call a class as a function");
3117
3239
  }
3118
3240
  }
3119
- function _defineProperties$7(target, props) {
3241
+ function _defineProperties$8(target, props) {
3120
3242
  for(var i = 0; i < props.length; i++){
3121
3243
  var descriptor = props[i];
3122
3244
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3125,11 +3247,11 @@ function _defineProperties$7(target, props) {
3125
3247
  Object.defineProperty(target, descriptor.key, descriptor);
3126
3248
  }
3127
3249
  }
3128
- function _create_class$7(Constructor, protoProps, staticProps) {
3129
- if (protoProps) _defineProperties$7(Constructor.prototype, protoProps);
3250
+ function _create_class$8(Constructor, protoProps, staticProps) {
3251
+ if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
3130
3252
  return Constructor;
3131
3253
  }
3132
- function _define_property$9(obj, key, value) {
3254
+ function _define_property$a(obj, key, value) {
3133
3255
  if (key in obj) {
3134
3256
  Object.defineProperty(obj, key, {
3135
3257
  value: value,
@@ -3142,22 +3264,22 @@ function _define_property$9(obj, key, value) {
3142
3264
  }
3143
3265
  return obj;
3144
3266
  }
3145
- function _iterable_to_array$3(iter) {
3267
+ function _iterable_to_array$5(iter) {
3146
3268
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3147
3269
  }
3148
- function _non_iterable_spread$3() {
3270
+ function _non_iterable_spread$5() {
3149
3271
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3150
3272
  }
3151
- function _to_consumable_array$3(arr) {
3152
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
3273
+ function _to_consumable_array$5(arr) {
3274
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$5();
3153
3275
  }
3154
- function _unsupported_iterable_to_array$4(o, minLen) {
3276
+ function _unsupported_iterable_to_array$5(o, minLen) {
3155
3277
  if (!o) return;
3156
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
3278
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
3157
3279
  var n = Object.prototype.toString.call(o).slice(8, -1);
3158
3280
  if (n === "Object" && o.constructor) n = o.constructor.name;
3159
3281
  if (n === "Map" || n === "Set") return Array.from(n);
3160
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
3282
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
3161
3283
  }
3162
3284
  // MARK: Encrypted Fields
3163
3285
  /**
@@ -3179,16 +3301,16 @@ function _unsupported_iterable_to_array$4(o, minLen) {
3179
3301
  * the OIDC model server actions.
3180
3302
  */ exports.OidcEncryptionService = /*#__PURE__*/ function() {
3181
3303
  function OidcEncryptionService(config) {
3182
- _class_call_check$8(this, OidcEncryptionService);
3183
- _define_property$9(this, "provider", void 0);
3184
- _define_property$9(this, "adapterPayloadEncryptor", void 0);
3304
+ _class_call_check$a(this, OidcEncryptionService);
3305
+ _define_property$a(this, "provider", void 0);
3306
+ _define_property$a(this, "adapterPayloadEncryptor", void 0);
3185
3307
  this.provider = nestjs.createAesStringEncryptionProvider(config.jwksKeyConverterConfig.encryptionSecret);
3186
3308
  this.adapterPayloadEncryptor = util.selectiveFieldEncryptor({
3187
3309
  provider: this.provider,
3188
- fields: _to_consumable_array$3(OIDC_ENCRYPTED_PAYLOAD_FIELDS)
3310
+ fields: _to_consumable_array$5(OIDC_ENCRYPTED_PAYLOAD_FIELDS)
3189
3311
  });
3190
3312
  }
3191
- _create_class$7(OidcEncryptionService, [
3313
+ _create_class$8(OidcEncryptionService, [
3192
3314
  {
3193
3315
  /**
3194
3316
  * Encrypts sensitive fields in an adapter payload and returns it as a {@link JsonSerializableObject}
@@ -3221,20 +3343,20 @@ exports.OidcEncryptionService = __decorate([
3221
3343
  __param(0, common.Inject(OidcModuleConfig))
3222
3344
  ], exports.OidcEncryptionService);
3223
3345
 
3224
- function _array_like_to_array$3(arr, len) {
3346
+ function _array_like_to_array$4(arr, len) {
3225
3347
  if (len == null || len > arr.length) len = arr.length;
3226
3348
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3227
3349
  return arr2;
3228
3350
  }
3229
- function _array_without_holes$2(arr) {
3230
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
3351
+ function _array_without_holes$4(arr) {
3352
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
3231
3353
  }
3232
- function _class_call_check$7(instance, Constructor) {
3354
+ function _class_call_check$9(instance, Constructor) {
3233
3355
  if (!(instance instanceof Constructor)) {
3234
3356
  throw new TypeError("Cannot call a class as a function");
3235
3357
  }
3236
3358
  }
3237
- function _defineProperties$6(target, props) {
3359
+ function _defineProperties$7(target, props) {
3238
3360
  for(var i = 0; i < props.length; i++){
3239
3361
  var descriptor = props[i];
3240
3362
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3243,11 +3365,11 @@ function _defineProperties$6(target, props) {
3243
3365
  Object.defineProperty(target, descriptor.key, descriptor);
3244
3366
  }
3245
3367
  }
3246
- function _create_class$6(Constructor, protoProps, staticProps) {
3247
- if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
3368
+ function _create_class$7(Constructor, protoProps, staticProps) {
3369
+ if (protoProps) _defineProperties$7(Constructor.prototype, protoProps);
3248
3370
  return Constructor;
3249
3371
  }
3250
- function _define_property$8(obj, key, value) {
3372
+ function _define_property$9(obj, key, value) {
3251
3373
  if (key in obj) {
3252
3374
  Object.defineProperty(obj, key, {
3253
3375
  value: value,
@@ -3260,22 +3382,22 @@ function _define_property$8(obj, key, value) {
3260
3382
  }
3261
3383
  return obj;
3262
3384
  }
3263
- function _iterable_to_array$2(iter) {
3385
+ function _iterable_to_array$4(iter) {
3264
3386
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3265
3387
  }
3266
- function _non_iterable_spread$2() {
3388
+ function _non_iterable_spread$4() {
3267
3389
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3268
3390
  }
3269
- function _to_consumable_array$2(arr) {
3270
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$2();
3391
+ function _to_consumable_array$4(arr) {
3392
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$4();
3271
3393
  }
3272
- function _unsupported_iterable_to_array$3(o, minLen) {
3394
+ function _unsupported_iterable_to_array$4(o, minLen) {
3273
3395
  if (!o) return;
3274
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
3396
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
3275
3397
  var n = Object.prototype.toString.call(o).slice(8, -1);
3276
3398
  if (n === "Object" && o.constructor) n = o.constructor.name;
3277
3399
  if (n === "Map" || n === "Set") return Array.from(n);
3278
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
3400
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
3279
3401
  }
3280
3402
  // MARK: Routes
3281
3403
  /**
@@ -3323,36 +3445,36 @@ var DEFAULT_OIDC_CODE_CHALLENGE_METHODS = [
3323
3445
  * Injected into {@link OidcService} and {@link OidcWellKnownController}.
3324
3446
  */ exports.OidcProviderConfigService = /*#__PURE__*/ function() {
3325
3447
  function OidcProviderConfigService(config, accountService, envService) {
3326
- _class_call_check$7(this, OidcProviderConfigService);
3448
+ _class_call_check$9(this, OidcProviderConfigService);
3327
3449
  var _this_config_tokenEndpointAuthMethods;
3328
- _define_property$8(this, "config", void 0);
3329
- _define_property$8(this, "routes", DEFAULT_OIDC_ROUTES);
3450
+ _define_property$9(this, "config", void 0);
3451
+ _define_property$9(this, "routes", DEFAULT_OIDC_ROUTES);
3330
3452
  /**
3331
3453
  * If the OIDC registration route is enabled.
3332
- */ _define_property$8(this, "oidcRegistrationRouteEnabled", void 0);
3454
+ */ _define_property$9(this, "oidcRegistrationRouteEnabled", void 0);
3333
3455
  /**
3334
3456
  * The url to the front-end login page.
3335
- */ _define_property$8(this, "appLoginUrl", void 0);
3457
+ */ _define_property$9(this, "appLoginUrl", void 0);
3336
3458
  /**
3337
3459
  * The url to the front-end consent page.
3338
- */ _define_property$8(this, "appConsentUrl", void 0);
3460
+ */ _define_property$9(this, "appConsentUrl", void 0);
3339
3461
  /**
3340
3462
  * The app-provided provider config from the delegate.
3341
- */ _define_property$8(this, "providerConfig", void 0);
3463
+ */ _define_property$9(this, "providerConfig", void 0);
3342
3464
  /**
3343
3465
  * Scopes derived from the claims configuration keys.
3344
- */ _define_property$8(this, "scopesSupported", void 0);
3466
+ */ _define_property$9(this, "scopesSupported", void 0);
3345
3467
  /**
3346
3468
  * Flat list of all unique claim names from the claims configuration.
3347
- */ _define_property$8(this, "claimsSupported", void 0);
3469
+ */ _define_property$9(this, "claimsSupported", void 0);
3348
3470
  /**
3349
3471
  * Token endpoint authentication methods from config or defaults.
3350
- */ _define_property$8(this, "tokenEndpointAuthMethodsSupported", void 0);
3472
+ */ _define_property$9(this, "tokenEndpointAuthMethodsSupported", void 0);
3351
3473
  this.config = config;
3352
3474
  this.providerConfig = accountService.providerConfig;
3353
3475
  this.scopesSupported = Object.keys(this.providerConfig.claims);
3354
3476
  this.claimsSupported = Array.from(new Set(Object.values(this.providerConfig.claims).flat()));
3355
- this.tokenEndpointAuthMethodsSupported = (_this_config_tokenEndpointAuthMethods = this.config.tokenEndpointAuthMethods) !== null && _this_config_tokenEndpointAuthMethods !== void 0 ? _this_config_tokenEndpointAuthMethods : _to_consumable_array$2(DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS);
3477
+ this.tokenEndpointAuthMethodsSupported = (_this_config_tokenEndpointAuthMethods = this.config.tokenEndpointAuthMethods) !== null && _this_config_tokenEndpointAuthMethods !== void 0 ? _this_config_tokenEndpointAuthMethods : _to_consumable_array$4(DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS);
3356
3478
  var appUrl = envService.appUrl;
3357
3479
  this.appLoginUrl = util.websiteUrlFromPaths(appUrl, [
3358
3480
  this.config.appOAuthInteractionPath,
@@ -3364,7 +3486,7 @@ var DEFAULT_OIDC_CODE_CHALLENGE_METHODS = [
3364
3486
  ]);
3365
3487
  this.oidcRegistrationRouteEnabled = config.registrationEnabled === true;
3366
3488
  }
3367
- _create_class$6(OidcProviderConfigService, [
3489
+ _create_class$7(OidcProviderConfigService, [
3368
3490
  {
3369
3491
  /**
3370
3492
  * Builds the OpenID Connect Discovery metadata document.
@@ -3385,16 +3507,16 @@ var DEFAULT_OIDC_CODE_CHALLENGE_METHODS = [
3385
3507
  jwks_uri: jwksUri !== null && jwksUri !== void 0 ? jwksUri : "".concat(issuer).concat(routes.jwks),
3386
3508
  registration_endpoint: this.oidcRegistrationRouteEnabled ? "".concat(issuer).concat(routes.registration) : undefined,
3387
3509
  scopes_supported: this.scopesSupported,
3388
- response_types_supported: _to_consumable_array$2(providerConfig.responseTypes),
3510
+ response_types_supported: _to_consumable_array$4(providerConfig.responseTypes),
3389
3511
  response_modes_supported: [
3390
3512
  'query'
3391
3513
  ],
3392
- grant_types_supported: _to_consumable_array$2(providerConfig.grantTypes),
3393
- subject_types_supported: _to_consumable_array$2(DEFAULT_OIDC_SUBJECT_TYPES),
3394
- id_token_signing_alg_values_supported: _to_consumable_array$2(DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES),
3395
- token_endpoint_auth_methods_supported: _to_consumable_array$2(this.tokenEndpointAuthMethodsSupported),
3514
+ grant_types_supported: _to_consumable_array$4(providerConfig.grantTypes),
3515
+ subject_types_supported: _to_consumable_array$4(DEFAULT_OIDC_SUBJECT_TYPES),
3516
+ id_token_signing_alg_values_supported: _to_consumable_array$4(DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES),
3517
+ token_endpoint_auth_methods_supported: _to_consumable_array$4(this.tokenEndpointAuthMethodsSupported),
3396
3518
  claims_supported: this.claimsSupported,
3397
- code_challenge_methods_supported: _to_consumable_array$2(DEFAULT_OIDC_CODE_CHALLENGE_METHODS)
3519
+ code_challenge_methods_supported: _to_consumable_array$4(DEFAULT_OIDC_CODE_CHALLENGE_METHODS)
3398
3520
  };
3399
3521
  }
3400
3522
  }
@@ -3408,13 +3530,13 @@ exports.OidcProviderConfigService = __decorate([
3408
3530
  __param(2, common.Inject(firebaseServer.FirebaseServerEnvService))
3409
3531
  ], exports.OidcProviderConfigService);
3410
3532
 
3411
- function _array_like_to_array$2(arr, len) {
3533
+ function _array_like_to_array$3(arr, len) {
3412
3534
  if (len == null || len > arr.length) len = arr.length;
3413
3535
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3414
3536
  return arr2;
3415
3537
  }
3416
- function _array_without_holes$1(arr) {
3417
- if (Array.isArray(arr)) return _array_like_to_array$2(arr);
3538
+ function _array_without_holes$3(arr) {
3539
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
3418
3540
  }
3419
3541
  function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
3420
3542
  try {
@@ -3445,12 +3567,12 @@ function _async_to_generator$5(fn) {
3445
3567
  });
3446
3568
  };
3447
3569
  }
3448
- function _class_call_check$6(instance, Constructor) {
3570
+ function _class_call_check$8(instance, Constructor) {
3449
3571
  if (!(instance instanceof Constructor)) {
3450
3572
  throw new TypeError("Cannot call a class as a function");
3451
3573
  }
3452
3574
  }
3453
- function _defineProperties$5(target, props) {
3575
+ function _defineProperties$6(target, props) {
3454
3576
  for(var i = 0; i < props.length; i++){
3455
3577
  var descriptor = props[i];
3456
3578
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3459,11 +3581,11 @@ function _defineProperties$5(target, props) {
3459
3581
  Object.defineProperty(target, descriptor.key, descriptor);
3460
3582
  }
3461
3583
  }
3462
- function _create_class$5(Constructor, protoProps, staticProps) {
3463
- if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
3584
+ function _create_class$6(Constructor, protoProps, staticProps) {
3585
+ if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
3464
3586
  return Constructor;
3465
3587
  }
3466
- function _define_property$7(obj, key, value) {
3588
+ function _define_property$8(obj, key, value) {
3467
3589
  if (key in obj) {
3468
3590
  Object.defineProperty(obj, key, {
3469
3591
  value: value,
@@ -3476,13 +3598,13 @@ function _define_property$7(obj, key, value) {
3476
3598
  }
3477
3599
  return obj;
3478
3600
  }
3479
- function _iterable_to_array$1(iter) {
3601
+ function _iterable_to_array$3(iter) {
3480
3602
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3481
3603
  }
3482
- function _non_iterable_spread$1() {
3604
+ function _non_iterable_spread$3() {
3483
3605
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3484
3606
  }
3485
- function _object_spread$2(target) {
3607
+ function _object_spread$3(target) {
3486
3608
  for(var i = 1; i < arguments.length; i++){
3487
3609
  var source = arguments[i] != null ? arguments[i] : {};
3488
3610
  var ownKeys = Object.keys(source);
@@ -3492,7 +3614,7 @@ function _object_spread$2(target) {
3492
3614
  }));
3493
3615
  }
3494
3616
  ownKeys.forEach(function(key) {
3495
- _define_property$7(target, key, source[key]);
3617
+ _define_property$8(target, key, source[key]);
3496
3618
  });
3497
3619
  }
3498
3620
  return target;
@@ -3552,16 +3674,16 @@ function _object_without_properties_loose(source, excluded) {
3552
3674
  }
3553
3675
  return target;
3554
3676
  }
3555
- function _to_consumable_array$1(arr) {
3556
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$1();
3677
+ function _to_consumable_array$3(arr) {
3678
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$3();
3557
3679
  }
3558
- function _unsupported_iterable_to_array$2(o, minLen) {
3680
+ function _unsupported_iterable_to_array$3(o, minLen) {
3559
3681
  if (!o) return;
3560
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
3682
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
3561
3683
  var n = Object.prototype.toString.call(o).slice(8, -1);
3562
3684
  if (n === "Object" && o.constructor) n = o.constructor.name;
3563
3685
  if (n === "Map" || n === "Set") return Array.from(n);
3564
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
3686
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
3565
3687
  }
3566
3688
  function _ts_generator$5(thisArg, body) {
3567
3689
  var f, y, t, _ = {
@@ -3669,14 +3791,14 @@ function _ts_generator$5(thisArg, body) {
3669
3791
  */ exports.OidcService = /*#__PURE__*/ function() {
3670
3792
  function OidcService(config, providerConfigService, jwksService, accountService, collections, encryptionService) {
3671
3793
  var _this = this;
3672
- _class_call_check$6(this, OidcService);
3673
- _define_property$7(this, "config", void 0);
3674
- _define_property$7(this, "providerConfigService", void 0);
3675
- _define_property$7(this, "jwksService", void 0);
3676
- _define_property$7(this, "accountService", void 0);
3677
- _define_property$7(this, "collections", void 0);
3678
- _define_property$7(this, "encryptionService", void 0);
3679
- _define_property$7(this, "_getProvider", util.cachedGetter(function() {
3794
+ _class_call_check$8(this, OidcService);
3795
+ _define_property$8(this, "config", void 0);
3796
+ _define_property$8(this, "providerConfigService", void 0);
3797
+ _define_property$8(this, "jwksService", void 0);
3798
+ _define_property$8(this, "accountService", void 0);
3799
+ _define_property$8(this, "collections", void 0);
3800
+ _define_property$8(this, "encryptionService", void 0);
3801
+ _define_property$8(this, "_getProvider", util.cachedGetter(function() {
3680
3802
  return _this._buildProvider();
3681
3803
  }));
3682
3804
  this.config = config;
@@ -3686,7 +3808,7 @@ function _ts_generator$5(thisArg, body) {
3686
3808
  this.collections = collections;
3687
3809
  this.encryptionService = encryptionService;
3688
3810
  }
3689
- _create_class$5(OidcService, [
3811
+ _create_class$6(OidcService, [
3690
3812
  {
3691
3813
  /**
3692
3814
  * Returns the oidc-provider instance, initializing it on first access.
@@ -3708,14 +3830,27 @@ function _ts_generator$5(thisArg, body) {
3708
3830
  *
3709
3831
  * Mirrors the resolution used by the `Grant`/`Session` TTL functions in {@link buildProviderConfiguration}.
3710
3832
  *
3833
+ * The `serverMaxSeconds` ceiling is tiered by {@link resolveTieredServerMaxSeconds}: a non-admin
3834
+ * caps at the non-admin tier, an admin at the admin tier, and an admin whose grant carries a
3835
+ * service-token scope at the (highest) service-token tier. This tiered value replaces the flat
3836
+ * {@link OidcModuleConfig.maxRequestedLoginDuration} ceiling so a service token can intentionally
3837
+ * exceed it.
3838
+ *
3711
3839
  * @param requestedRawTtl - The raw `dbx_session_ttl` value from `interaction.params`, if any.
3712
3840
  * @param clientPayload - The persisted client metadata, used to read the per-client `dbx_max_session_ttl` cap.
3841
+ * @param tier - Whether the resolving user is an admin and whether the grant carries a service-token scope.
3713
3842
  * @returns The resolved Grant TTL in seconds.
3714
3843
  */ key: "resolveLoginDurationForGrant",
3715
- value: function resolveLoginDurationForGrant(requestedRawTtl, clientPayload) {
3716
- var _config_maxRequestedLoginDuration, _config_minRequestedLoginDuration, _config_defaultRequestedLoginDuration;
3844
+ value: function resolveLoginDurationForGrant(requestedRawTtl, clientPayload, tier) {
3845
+ var _config_maxRequestedLoginDurationNonAdmin, _config_maxRequestedLoginDurationAdmin, _config_maxRequestedLoginDurationServiceToken, _config_minRequestedLoginDuration, _config_defaultRequestedLoginDuration;
3717
3846
  var config = this.config;
3718
- var serverMaxSeconds = (_config_maxRequestedLoginDuration = config.maxRequestedLoginDuration) !== null && _config_maxRequestedLoginDuration !== void 0 ? _config_maxRequestedLoginDuration : DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS;
3847
+ var serverMaxSeconds = resolveTieredServerMaxSeconds({
3848
+ isAdmin: tier.isAdmin,
3849
+ hasServiceScope: tier.hasServiceScope,
3850
+ nonAdminMax: (_config_maxRequestedLoginDurationNonAdmin = config.maxRequestedLoginDurationNonAdmin) !== null && _config_maxRequestedLoginDurationNonAdmin !== void 0 ? _config_maxRequestedLoginDurationNonAdmin : DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS,
3851
+ adminMax: (_config_maxRequestedLoginDurationAdmin = config.maxRequestedLoginDurationAdmin) !== null && _config_maxRequestedLoginDurationAdmin !== void 0 ? _config_maxRequestedLoginDurationAdmin : DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS,
3852
+ serviceTokenMax: (_config_maxRequestedLoginDurationServiceToken = config.maxRequestedLoginDurationServiceToken) !== null && _config_maxRequestedLoginDurationServiceToken !== void 0 ? _config_maxRequestedLoginDurationServiceToken : DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS
3853
+ });
3719
3854
  var serverMinSeconds = (_config_minRequestedLoginDuration = config.minRequestedLoginDuration) !== null && _config_minRequestedLoginDuration !== void 0 ? _config_minRequestedLoginDuration : DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS;
3720
3855
  var defaultSeconds = (_config_defaultRequestedLoginDuration = config.defaultRequestedLoginDuration) !== null && _config_defaultRequestedLoginDuration !== void 0 ? _config_defaultRequestedLoginDuration : config.tokenLifetimes.grant;
3721
3856
  return resolveLoginDurationSeconds({
@@ -3762,7 +3897,7 @@ function _ts_generator$5(thisArg, body) {
3762
3897
  // (e.g., `a` for admin, `o` for onboarded) based on the granted scopes.
3763
3898
  // Read the account claims baked into the token at issuance time via extraAccessTokenClaims.
3764
3899
  accountClaims = (_accessToken_extra = accessToken.extra) !== null && _accessToken_extra !== void 0 ? _accessToken_extra : {};
3765
- token = _object_spread_props(_object_spread$2({}, accountClaims), {
3900
+ token = _object_spread_props(_object_spread$3({}, accountClaims), {
3766
3901
  // Standard JWT claims — sourced from the access token
3767
3902
  aud: util.firstValue(accessToken.aud),
3768
3903
  iss: this.config.issuer,
@@ -3785,7 +3920,7 @@ function _ts_generator$5(thisArg, body) {
3785
3920
  uid: accessToken.accountId,
3786
3921
  token: token,
3787
3922
  rawToken: rawToken,
3788
- oidcValidatedToken: _object_spread$2({
3923
+ oidcValidatedToken: _object_spread$3({
3789
3924
  sub: accessToken.accountId,
3790
3925
  scope: accessToken.scope,
3791
3926
  client_id: accessToken.clientId
@@ -3939,10 +4074,10 @@ function _ts_generator$5(thisArg, body) {
3939
4074
  defaultSeconds: overrideDefaultSeconds !== null && overrideDefaultSeconds !== void 0 ? overrideDefaultSeconds : perModelDefaultSeconds
3940
4075
  });
3941
4076
  };
3942
- return _object_spread_props(_object_spread$2({
3943
- routes: _object_spread$2({}, this.providerConfigService.routes),
3944
- claims: _object_spread$2({}, providerConfig.claims),
3945
- responseTypes: _to_consumable_array$1(providerConfig.responseTypes),
4077
+ return _object_spread_props(_object_spread$3({
4078
+ routes: _object_spread$3({}, this.providerConfigService.routes),
4079
+ claims: _object_spread$3({}, providerConfig.claims),
4080
+ responseTypes: _to_consumable_array$3(providerConfig.responseTypes),
3946
4081
  pkce: {
3947
4082
  required: function required() {
3948
4083
  return true;
@@ -3977,7 +4112,7 @@ function _ts_generator$5(thisArg, body) {
3977
4112
  }
3978
4113
  return [
3979
4114
  2,
3980
- _object_spread$2({
4115
+ _object_spread$3({
3981
4116
  scope: info.scope
3982
4117
  }, info.audience === undefined ? {} : {
3983
4118
  audience: info.audience
@@ -4071,7 +4206,7 @@ function _ts_generator$5(thisArg, body) {
4071
4206
  logo_uri: client.logo_uri,
4072
4207
  scopes: scopes
4073
4208
  };
4074
- paramsToEncode = _object_spread$2({}, paramsToEncode, interactionLoginDetails);
4209
+ paramsToEncode = _object_spread$3({}, paramsToEncode, interactionLoginDetails);
4075
4210
  }
4076
4211
  _state.label = 3;
4077
4212
  case 3:
@@ -4093,11 +4228,29 @@ function _ts_generator$5(thisArg, body) {
4093
4228
  }, config.renderError ? {
4094
4229
  renderError: config.renderError
4095
4230
  } : {}), {
4231
+ // Setting `rotateRefreshToken` disables oidc-provider's built-in default, so we both honor the
4232
+ // dbx-components `nonRotatingScopes` extension (service tokens never rotate, keeping a stable
4233
+ // refresh token for server env consumption) AND replicate the library default for every other
4234
+ // grant. See `shouldRotateRefreshToken` — keep it in sync on oidc-provider upgrades.
4235
+ rotateRefreshToken: function rotateRefreshToken(ctx) {
4236
+ var _providerConfig_nonRotatingScopes, _ref, _ref1, _ref2;
4237
+ var _refreshToken_totalLifetime, _refreshToken_isSenderConstrained, _refreshToken_ttlPercentagePassed;
4238
+ var refreshToken = ctx.oidc.entities.RefreshToken;
4239
+ var client = ctx.oidc.entities.Client;
4240
+ return shouldRotateRefreshToken({
4241
+ scope: refreshToken === null || refreshToken === void 0 ? void 0 : refreshToken.scope,
4242
+ nonRotatingScopes: (_providerConfig_nonRotatingScopes = providerConfig.nonRotatingScopes) !== null && _providerConfig_nonRotatingScopes !== void 0 ? _providerConfig_nonRotatingScopes : [],
4243
+ totalLifetimeSeconds: (_ref = refreshToken === null || refreshToken === void 0 ? void 0 : (_refreshToken_totalLifetime = refreshToken.totalLifetime) === null || _refreshToken_totalLifetime === void 0 ? void 0 : _refreshToken_totalLifetime.call(refreshToken)) !== null && _ref !== void 0 ? _ref : 0,
4244
+ clientAuthMethod: client === null || client === void 0 ? void 0 : client.clientAuthMethod,
4245
+ isSenderConstrained: (_ref1 = refreshToken === null || refreshToken === void 0 ? void 0 : (_refreshToken_isSenderConstrained = refreshToken.isSenderConstrained) === null || _refreshToken_isSenderConstrained === void 0 ? void 0 : _refreshToken_isSenderConstrained.call(refreshToken)) !== null && _ref1 !== void 0 ? _ref1 : false,
4246
+ ttlPercentagePassed: (_ref2 = refreshToken === null || refreshToken === void 0 ? void 0 : (_refreshToken_ttlPercentagePassed = refreshToken.ttlPercentagePassed) === null || _refreshToken_ttlPercentagePassed === void 0 ? void 0 : _refreshToken_ttlPercentagePassed.call(refreshToken)) !== null && _ref2 !== void 0 ? _ref2 : 0
4247
+ });
4248
+ },
4096
4249
  // Bake account claims into the access token at issuance time so they're
4097
4250
  // available via `accessToken.extra` during verification without an extra DB call.
4098
4251
  extraTokenClaims: function extraTokenClaims(_ctx, token) {
4099
4252
  return _async_to_generator$5(function() {
4100
- var accountId, scope, result, account, claims, extraClaims;
4253
+ var accountId, scope, result, account, claims, extraClaims, _providerConfig_nonRotatingScopes, nonRotatingScopes, scopeSet, provider, grant;
4101
4254
  return _ts_generator$5(this, function(_state) {
4102
4255
  switch(_state.label){
4103
4256
  case 0:
@@ -4128,9 +4281,40 @@ function _ts_generator$5(thisArg, body) {
4128
4281
  "sub"
4129
4282
  ]);
4130
4283
  // Filter out undefined values — the Firestore adapter cannot serialize them.
4131
- result = util.filterUndefinedValues(extraClaims);
4284
+ Object.assign(result, util.filterUndefinedValues(extraClaims));
4132
4285
  _state.label = 3;
4133
4286
  case 3:
4287
+ // Surface the resolved session lifetime + rotation status so clients (e.g. the CLI) can show
4288
+ // "valid until <date>, rotation: disabled" without decoding the opaque access token. These ride
4289
+ // on `accessToken.extra` and are read back by `verifyAccessToken` and the `GET /oidc/session` route.
4290
+ if (scope != null) {
4291
+ nonRotatingScopes = (_providerConfig_nonRotatingScopes = providerConfig.nonRotatingScopes) !== null && _providerConfig_nonRotatingScopes !== void 0 ? _providerConfig_nonRotatingScopes : [];
4292
+ scopeSet = new Set(scope.split(' ').filter(Boolean));
4293
+ result[DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM] = nonRotatingScopes.some(function(nonRotatingScope) {
4294
+ return scopeSet.has(nonRotatingScope);
4295
+ });
4296
+ }
4297
+ if (!token.grantId) return [
4298
+ 3,
4299
+ 6
4300
+ ];
4301
+ return [
4302
+ 4,
4303
+ this.getProvider()
4304
+ ];
4305
+ case 4:
4306
+ provider = _state.sent();
4307
+ return [
4308
+ 4,
4309
+ provider.Grant.find(token.grantId)
4310
+ ];
4311
+ case 5:
4312
+ grant = _state.sent();
4313
+ if ((grant === null || grant === void 0 ? void 0 : grant.exp) != null && Number.isFinite(grant.exp)) {
4314
+ result[DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM] = grant.exp;
4315
+ }
4316
+ _state.label = 6;
4317
+ case 6:
4134
4318
  return [
4135
4319
  2,
4136
4320
  result
@@ -4189,7 +4373,7 @@ function _ts_generator$5(thisArg, body) {
4189
4373
  ];
4190
4374
  case 4:
4191
4375
  _ref = _state.sent(), ProviderClass = _ref.default;
4192
- provider = new ProviderClass(config.issuer, _object_spread_props(_object_spread$2({}, providerConfiguration), {
4376
+ provider = new ProviderClass(config.issuer, _object_spread_props(_object_spread$3({}, providerConfiguration), {
4193
4377
  adapter: adapterFactory,
4194
4378
  findAccount: findAccount,
4195
4379
  jwks: {
@@ -4227,12 +4411,12 @@ exports.OidcService = __decorate([
4227
4411
  __param(5, common.Inject(exports.OidcEncryptionService))
4228
4412
  ], exports.OidcService);
4229
4413
 
4230
- function _class_call_check$5(instance, Constructor) {
4414
+ function _class_call_check$7(instance, Constructor) {
4231
4415
  if (!(instance instanceof Constructor)) {
4232
4416
  throw new TypeError("Cannot call a class as a function");
4233
4417
  }
4234
4418
  }
4235
- function _define_property$6(obj, key, value) {
4419
+ function _define_property$7(obj, key, value) {
4236
4420
  if (key in obj) {
4237
4421
  Object.defineProperty(obj, key, {
4238
4422
  value: value,
@@ -4270,14 +4454,14 @@ function _define_property$6(obj, key, value) {
4270
4454
  * export class MyApiModule {}
4271
4455
  * ```
4272
4456
  */ var OidcAuthMiddlewareConfig = function OidcAuthMiddlewareConfig() {
4273
- _class_call_check$5(this, OidcAuthMiddlewareConfig);
4457
+ _class_call_check$7(this, OidcAuthMiddlewareConfig);
4274
4458
  /**
4275
4459
  * Path prefixes that require OAuth bearer token verification.
4276
4460
  *
4277
4461
  * Only requests matching one of these prefixes will be checked.
4278
4462
  * Paths under the global API route prefix should not be included
4279
4463
  * since those are protected by AppCheck.
4280
- */ _define_property$6(this, "protectedPaths", void 0);
4464
+ */ _define_property$7(this, "protectedPaths", void 0);
4281
4465
  /**
4282
4466
  * Absolute URL of the OAuth 2.0 Protected Resource Metadata document
4283
4467
  * (RFC 9728). When set, included as the `resource_metadata` parameter
@@ -4285,7 +4469,7 @@ function _define_property$6(obj, key, value) {
4285
4469
  * clients can locate the discovery doc explicitly rather than relying on
4286
4470
  * origin-rooted path-walkback (which fails when the function isn't
4287
4471
  * mounted at `/` — e.g. behind the Firebase Functions emulator URL prefix).
4288
- */ _define_property$6(this, "resourceMetadataUrl", void 0);
4472
+ */ _define_property$7(this, "resourceMetadataUrl", void 0);
4289
4473
  };
4290
4474
  // MARK: WWW-Authenticate
4291
4475
  /**
@@ -4425,12 +4609,12 @@ function _async_to_generator$4(fn) {
4425
4609
  });
4426
4610
  };
4427
4611
  }
4428
- function _class_call_check$4(instance, Constructor) {
4612
+ function _class_call_check$6(instance, Constructor) {
4429
4613
  if (!(instance instanceof Constructor)) {
4430
4614
  throw new TypeError("Cannot call a class as a function");
4431
4615
  }
4432
4616
  }
4433
- function _defineProperties$4(target, props) {
4617
+ function _defineProperties$5(target, props) {
4434
4618
  for(var i = 0; i < props.length; i++){
4435
4619
  var descriptor = props[i];
4436
4620
  descriptor.enumerable = descriptor.enumerable || false;
@@ -4439,11 +4623,11 @@ function _defineProperties$4(target, props) {
4439
4623
  Object.defineProperty(target, descriptor.key, descriptor);
4440
4624
  }
4441
4625
  }
4442
- function _create_class$4(Constructor, protoProps, staticProps) {
4443
- if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
4626
+ function _create_class$5(Constructor, protoProps, staticProps) {
4627
+ if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
4444
4628
  return Constructor;
4445
4629
  }
4446
- function _define_property$5(obj, key, value) {
4630
+ function _define_property$6(obj, key, value) {
4447
4631
  if (key in obj) {
4448
4632
  Object.defineProperty(obj, key, {
4449
4633
  value: value,
@@ -4593,14 +4777,14 @@ function _ts_generator$4(thisArg, body) {
4593
4777
  * @throws {UnauthorizedException} When the Authorization header is missing, malformed, or the token is invalid/expired.
4594
4778
  */ exports.OidcAuthBearerTokenMiddleware = /*#__PURE__*/ function() {
4595
4779
  function OidcAuthBearerTokenMiddleware(oidcService, config) {
4596
- _class_call_check$4(this, OidcAuthBearerTokenMiddleware);
4597
- _define_property$5(this, "oidcService", void 0);
4598
- _define_property$5(this, "config", void 0);
4599
- _define_property$5(this, "logger", new common.Logger('OidcAuthBearerTokenMiddleware'));
4780
+ _class_call_check$6(this, OidcAuthBearerTokenMiddleware);
4781
+ _define_property$6(this, "oidcService", void 0);
4782
+ _define_property$6(this, "config", void 0);
4783
+ _define_property$6(this, "logger", new common.Logger('OidcAuthBearerTokenMiddleware'));
4600
4784
  this.oidcService = oidcService;
4601
4785
  this.config = config;
4602
4786
  }
4603
- _create_class$4(OidcAuthBearerTokenMiddleware, [
4787
+ _create_class$5(OidcAuthBearerTokenMiddleware, [
4604
4788
  {
4605
4789
  key: "use",
4606
4790
  value: function use(req, res, next) {
@@ -4721,19 +4905,328 @@ exports.OidcAuthBearerTokenMiddleware = __decorate([
4721
4905
  });
4722
4906
  }
4723
4907
 
4724
- // MARK: Scopes
4725
4908
  /**
4726
- * Reads the set of OIDC scopes carried by a callable request's bearer token.
4909
+ * Default prefix prepended to every resolved OIDC analytics event name forwarded
4910
+ * to the downstream analytics pipeline (e.g. `'OIDC ' + 'Login'` → `'OIDC Login'`).
4911
+ */ var DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX = 'OIDC ';
4912
+ /**
4913
+ * Default per-type downstream event name parts (the {@link DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX}
4914
+ * is prepended at send time).
4915
+ */ var DEFAULT_OIDC_ANALYTICS_EVENT_NAMES = {
4916
+ login: 'Login',
4917
+ consent: 'Consent'
4918
+ };
4919
+ /**
4920
+ * NestJS injection token for the optional {@link FirebaseServerOidcAnalyticsConfig} provider.
4727
4921
  *
4728
- * The `ModelApiCallModelDispatchService` builds a synthetic `CallableRequest` with
4729
- * `auth.token = oidcValidatedToken ?? {}`, so the OIDC scope string lives at
4730
- * `request.auth.token.scope` for OIDC callers and is `undefined` for non-OIDC
4731
- * (regular Firebase ID-token) callers.
4922
+ * @example
4923
+ * ```typescript
4924
+ * @Module(appOidcAnalyticsModuleMetadata({ oidcAnalyticsConfig: { eventNamePrefix: 'OIDC ', logEvents: true } }))
4925
+ * export class AppOidcAnalyticsModule {}
4926
+ * ```
4927
+ */ var FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG = 'FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG';
4928
+
4929
+ function _class_call_check$5(instance, Constructor) {
4930
+ if (!(instance instanceof Constructor)) {
4931
+ throw new TypeError("Cannot call a class as a function");
4932
+ }
4933
+ }
4934
+ /**
4935
+ * Abstract analytics service that apps implement to process OIDC analytics events.
4732
4936
  *
4733
- * Returning `undefined` for non-OIDC callers lets callers (e.g. `oidcCallModelScopePreAssert`)
4734
- * skip scope enforcement instead of falsely treating the missing claim as "no scopes granted".
4937
+ * Analogous to the MCP `McpAnalyticsService` but scoped to the OIDC/OAuth transport.
4938
+ * Apps extend this class and provide it via {@link OIDC_ANALYTICS_SERVICE}.
4939
+ */ var OidcAnalyticsService = function OidcAnalyticsService() {
4940
+ _class_call_check$5(this, OidcAnalyticsService);
4941
+ };
4942
+ /**
4943
+ * Injection token for the OIDC analytics service.
4735
4944
  *
4736
- * The parameter is intentionally typed as `unknown` because `DecodedIdToken` (Firebase
4945
+ * Apps provide this (typically via {@link appOidcAnalyticsModuleMetadata} on a `@Global()`
4946
+ * module) to enable analytics in the OIDC dispatch chain. When absent, the OIDC emitters
4947
+ * fall back to {@link noopOidcAnalyticsService}.
4948
+ */ var OIDC_ANALYTICS_SERVICE = 'OIDC_ANALYTICS_SERVICE';
4949
+ /**
4950
+ * Creates a no-op {@link OidcAnalyticsService} that silently discards all events.
4951
+ *
4952
+ * Used as the default fallback by the OIDC emitters when no analytics service is registered.
4953
+ *
4954
+ * @returns An {@link OidcAnalyticsService} that discards all analytics events.
4955
+ * @__NO_SIDE_EFFECTS__
4956
+ */ function noopOidcAnalyticsService() {
4957
+ return {
4958
+ handleOidcAnalyticsEvent: function handleOidcAnalyticsEvent() {
4959
+ return undefined;
4960
+ }
4961
+ };
4962
+ }
4963
+ /**
4964
+ * Forwards an {@link OidcAnalyticsEvent} to the given service, fail-soft.
4965
+ *
4966
+ * A throwing analytics handler must never break the underlying OIDC operation, so the
4967
+ * handler invocation is wrapped — on error a warning is logged and the error is swallowed.
4968
+ * Mirrors the MCP `_emitMcpAnalytics` discipline, factored to a free function because the
4969
+ * OIDC events fire from several emitters.
4970
+ *
4971
+ * @param service - The analytics service to forward to.
4972
+ * @param event - The event to emit.
4973
+ * @param logger - The emitter's logger, used to warn when the handler throws.
4974
+ */ function emitOidcAnalyticsEvent(service, event, logger) {
4975
+ try {
4976
+ service.handleOidcAnalyticsEvent(event);
4977
+ } catch (error) {
4978
+ logger.warn("OIDC analytics handler threw for event ".concat(event.type, "; ignoring: ").concat(error));
4979
+ }
4980
+ }
4981
+
4982
+ function _assert_this_initialized(self) {
4983
+ if (self === void 0) {
4984
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4985
+ }
4986
+ return self;
4987
+ }
4988
+ function _call_super(_this, derived, args) {
4989
+ derived = _get_prototype_of(derived);
4990
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
4991
+ }
4992
+ function _class_call_check$4(instance, Constructor) {
4993
+ if (!(instance instanceof Constructor)) {
4994
+ throw new TypeError("Cannot call a class as a function");
4995
+ }
4996
+ }
4997
+ function _defineProperties$4(target, props) {
4998
+ for(var i = 0; i < props.length; i++){
4999
+ var descriptor = props[i];
5000
+ descriptor.enumerable = descriptor.enumerable || false;
5001
+ descriptor.configurable = true;
5002
+ if ("value" in descriptor) descriptor.writable = true;
5003
+ Object.defineProperty(target, descriptor.key, descriptor);
5004
+ }
5005
+ }
5006
+ function _create_class$4(Constructor, protoProps, staticProps) {
5007
+ if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
5008
+ return Constructor;
5009
+ }
5010
+ function _define_property$5(obj, key, value) {
5011
+ if (key in obj) {
5012
+ Object.defineProperty(obj, key, {
5013
+ value: value,
5014
+ enumerable: true,
5015
+ configurable: true,
5016
+ writable: true
5017
+ });
5018
+ } else {
5019
+ obj[key] = value;
5020
+ }
5021
+ return obj;
5022
+ }
5023
+ function _get_prototype_of(o) {
5024
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
5025
+ return o.__proto__ || Object.getPrototypeOf(o);
5026
+ };
5027
+ return _get_prototype_of(o);
5028
+ }
5029
+ function _inherits(subClass, superClass) {
5030
+ if (typeof superClass !== "function" && superClass !== null) {
5031
+ throw new TypeError("Super expression must either be null or a function");
5032
+ }
5033
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
5034
+ constructor: {
5035
+ value: subClass,
5036
+ writable: true,
5037
+ configurable: true
5038
+ }
5039
+ });
5040
+ if (superClass) _set_prototype_of(subClass, superClass);
5041
+ }
5042
+ function _object_spread$2(target) {
5043
+ for(var i = 1; i < arguments.length; i++){
5044
+ var source = arguments[i] != null ? arguments[i] : {};
5045
+ var ownKeys = Object.keys(source);
5046
+ if (typeof Object.getOwnPropertySymbols === "function") {
5047
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
5048
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
5049
+ }));
5050
+ }
5051
+ ownKeys.forEach(function(key) {
5052
+ _define_property$5(target, key, source[key]);
5053
+ });
5054
+ }
5055
+ return target;
5056
+ }
5057
+ function _possible_constructor_return(self, call) {
5058
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
5059
+ return call;
5060
+ }
5061
+ return _assert_this_initialized(self);
5062
+ }
5063
+ function _set_prototype_of(o, p) {
5064
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
5065
+ o.__proto__ = p;
5066
+ return o;
5067
+ };
5068
+ return _set_prototype_of(o, p);
5069
+ }
5070
+ function _type_of(obj) {
5071
+ "@swc/helpers - typeof";
5072
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5073
+ }
5074
+ function _is_native_reflect_construct() {
5075
+ try {
5076
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
5077
+ } catch (_) {}
5078
+ return (_is_native_reflect_construct = function() {
5079
+ return !!result;
5080
+ })();
5081
+ }
5082
+ var FirebaseServerOidcAnalyticsService_1;
5083
+ /**
5084
+ * Reusable {@link OidcAnalyticsService} that forwards each high-level OIDC event to the app's
5085
+ * {@link FirebaseServerAnalyticsService}, so OIDC-transport analytics feed the same downstream
5086
+ * pipeline (e.g. Segment) as model and MCP analytics.
5087
+ *
5088
+ * Each {@link OidcAnalyticsEvent.type} resolves to a distinct downstream event name
5089
+ * (`eventNamePrefix` + per-type name, e.g. `'OIDC Login'`). Registered globally via
5090
+ * {@link appOidcAnalyticsModuleMetadata}; tuned via {@link FirebaseServerOidcAnalyticsConfig}.
5091
+ * When no analytics service is available the call is a no-op aside from the optional log line.
5092
+ */ exports.FirebaseServerOidcAnalyticsService = FirebaseServerOidcAnalyticsService_1 = /*#__PURE__*/ function(OidcAnalyticsService) {
5093
+ _inherits(FirebaseServerOidcAnalyticsService, OidcAnalyticsService);
5094
+ function FirebaseServerOidcAnalyticsService(firebaseServerEnvService, analyticsService, config) {
5095
+ _class_call_check$4(this, FirebaseServerOidcAnalyticsService);
5096
+ var _this;
5097
+ var _ref, _ref1;
5098
+ _this = _call_super(this, FirebaseServerOidcAnalyticsService), _define_property$5(_this, "firebaseServerEnvService", void 0), _define_property$5(_this, "analyticsService", void 0), _define_property$5(_this, "_logger", new common.Logger(FirebaseServerOidcAnalyticsService_1.name)), _define_property$5(_this, "_eventNamePrefix", void 0), _define_property$5(_this, "_eventNames", void 0), _define_property$5(_this, "_logEvents", void 0);
5099
+ _this.firebaseServerEnvService = firebaseServerEnvService;
5100
+ _this.analyticsService = analyticsService;
5101
+ _this._eventNamePrefix = (_ref = config === null || config === void 0 ? void 0 : config.eventNamePrefix) !== null && _ref !== void 0 ? _ref : DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX;
5102
+ _this._eventNames = _object_spread$2({}, DEFAULT_OIDC_ANALYTICS_EVENT_NAMES, config === null || config === void 0 ? void 0 : config.eventNames);
5103
+ _this._logEvents = (_ref1 = config === null || config === void 0 ? void 0 : config.logEvents) !== null && _ref1 !== void 0 ? _ref1 : !_this.firebaseServerEnvService.isProduction;
5104
+ return _this;
5105
+ }
5106
+ _create_class$4(FirebaseServerOidcAnalyticsService, [
5107
+ {
5108
+ key: "handleOidcAnalyticsEvent",
5109
+ value: function handleOidcAnalyticsEvent(event) {
5110
+ var _this__eventNames_event_type;
5111
+ var name = "".concat(this._eventNamePrefix).concat((_this__eventNames_event_type = this._eventNames[event.type]) !== null && _this__eventNames_event_type !== void 0 ? _this__eventNames_event_type : event.type);
5112
+ if (this._logEvents) {
5113
+ var uidSuffix = event.uid ? " uid=".concat(event.uid) : '';
5114
+ var durationSuffix = event.durationMs != null ? " (".concat(event.durationMs, "ms)") : '';
5115
+ var outcome = event.isSuccessful ? 'Succeeded' : 'Failed';
5116
+ var reasonSuffix = event.reason ? " reason=".concat(event.reason) : '';
5117
+ this._logger.log("".concat(name, " ").concat(outcome).concat(uidSuffix).concat(reasonSuffix).concat(durationSuffix));
5118
+ }
5119
+ if (this.analyticsService != null) {
5120
+ var _event_clientId, _event_serviceToken, _event_isAdmin, _event_denied, _event_reason;
5121
+ // Drop undefined values so the downstream payload stays clean.
5122
+ var data = util.filterUndefinedValues({
5123
+ clientId: (_event_clientId = event.clientId) !== null && _event_clientId !== void 0 ? _event_clientId : undefined,
5124
+ scopes: event.scopes != null && event.scopes.length > 0 ? event.scopes.join(' ') : undefined,
5125
+ serviceToken: (_event_serviceToken = event.serviceToken) !== null && _event_serviceToken !== void 0 ? _event_serviceToken : undefined,
5126
+ isAdmin: (_event_isAdmin = event.isAdmin) !== null && _event_isAdmin !== void 0 ? _event_isAdmin : undefined,
5127
+ denied: (_event_denied = event.denied) !== null && _event_denied !== void 0 ? _event_denied : undefined,
5128
+ reason: (_event_reason = event.reason) !== null && _event_reason !== void 0 ? _event_reason : undefined,
5129
+ success: event.isSuccessful
5130
+ });
5131
+ this.analyticsService.sendEventData(event.uid, name, data);
5132
+ }
5133
+ }
5134
+ }
5135
+ ]);
5136
+ return FirebaseServerOidcAnalyticsService;
5137
+ }(OidcAnalyticsService);
5138
+ exports.FirebaseServerOidcAnalyticsService = FirebaseServerOidcAnalyticsService_1 = __decorate([
5139
+ common.Injectable(),
5140
+ __param(0, common.Inject(firebaseServer.FirebaseServerEnvService)),
5141
+ __param(1, common.Optional()),
5142
+ __param(1, common.Inject(firebaseServer.FirebaseServerAnalyticsService)),
5143
+ __param(2, common.Optional()),
5144
+ __param(2, common.Inject(FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG))
5145
+ ], exports.FirebaseServerOidcAnalyticsService);
5146
+
5147
+ function _array_like_to_array$2(arr, len) {
5148
+ if (len == null || len > arr.length) len = arr.length;
5149
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5150
+ return arr2;
5151
+ }
5152
+ function _array_without_holes$2(arr) {
5153
+ if (Array.isArray(arr)) return _array_like_to_array$2(arr);
5154
+ }
5155
+ function _iterable_to_array$2(iter) {
5156
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5157
+ }
5158
+ function _non_iterable_spread$2() {
5159
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5160
+ }
5161
+ function _to_consumable_array$2(arr) {
5162
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
5163
+ }
5164
+ function _unsupported_iterable_to_array$2(o, minLen) {
5165
+ if (!o) return;
5166
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
5167
+ var n = Object.prototype.toString.call(o).slice(8, -1);
5168
+ if (n === "Object" && o.constructor) n = o.constructor.name;
5169
+ if (n === "Map" || n === "Set") return Array.from(n);
5170
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
5171
+ }
5172
+ /**
5173
+ * Generates NestJS module metadata that registers {@link FirebaseServerOidcAnalyticsService} as the
5174
+ * OIDC analytics consumer, aliased to {@link OIDC_ANALYTICS_SERVICE}.
5175
+ *
5176
+ * Mirrors the convention used by `appMcpAnalyticsModuleMetadata`. Requires no dependency module —
5177
+ * `FirebaseServerAnalyticsService` is resolved optionally and is expected to be supplied globally by
5178
+ * the app's analytics module.
5179
+ *
5180
+ * Decorate a `@Global()` module with the result so the `OIDC_ANALYTICS_SERVICE` token is visible to
5181
+ * the OIDC controllers and services provided by the app's OIDC module.
5182
+ *
5183
+ * @param config - Optional metadata + analytics config to merge in.
5184
+ * @returns NestJS module metadata providing + exporting the OIDC analytics service and token.
5185
+ *
5186
+ * @example
5187
+ * ```typescript
5188
+ * @Global()
5189
+ * @Module(appOidcAnalyticsModuleMetadata())
5190
+ * export class AppOidcAnalyticsModule {}
5191
+ * ```
5192
+ */ function appOidcAnalyticsModuleMetadata() {
5193
+ var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
5194
+ var oidcAnalyticsConfig = config.oidcAnalyticsConfig, imports = config.imports, exports$1 = config.exports, providers = config.providers;
5195
+ var configProviders = oidcAnalyticsConfig ? [
5196
+ {
5197
+ provide: FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG,
5198
+ useValue: oidcAnalyticsConfig
5199
+ }
5200
+ ] : [];
5201
+ return {
5202
+ imports: _to_consumable_array$2(imports !== null && imports !== void 0 ? imports : []),
5203
+ exports: [
5204
+ OIDC_ANALYTICS_SERVICE,
5205
+ exports.FirebaseServerOidcAnalyticsService
5206
+ ].concat(_to_consumable_array$2(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
5207
+ providers: [
5208
+ exports.FirebaseServerOidcAnalyticsService,
5209
+ {
5210
+ provide: OIDC_ANALYTICS_SERVICE,
5211
+ useExisting: exports.FirebaseServerOidcAnalyticsService
5212
+ }
5213
+ ].concat(_to_consumable_array$2(configProviders), _to_consumable_array$2(providers !== null && providers !== void 0 ? providers : []))
5214
+ };
5215
+ }
5216
+
5217
+ // MARK: Scopes
5218
+ /**
5219
+ * Reads the set of OIDC scopes carried by a callable request's bearer token.
5220
+ *
5221
+ * The `ModelApiCallModelDispatchService` builds a synthetic `CallableRequest` with
5222
+ * `auth.token = oidcValidatedToken ?? {}`, so the OIDC scope string lives at
5223
+ * `request.auth.token.scope` for OIDC callers and is `undefined` for non-OIDC
5224
+ * (regular Firebase ID-token) callers.
5225
+ *
5226
+ * Returning `undefined` for non-OIDC callers lets callers (e.g. `oidcCallModelScopePreAssert`)
5227
+ * skip scope enforcement instead of falsely treating the missing claim as "no scopes granted".
5228
+ *
5229
+ * The parameter is intentionally typed as `unknown` because `DecodedIdToken` (Firebase
4737
5230
  * Auth's typed token shape) does not declare a `scope` field, while OIDC bearer-token
4738
5231
  * callers attach one at runtime. Reading is done defensively.
4739
5232
  *
@@ -5019,7 +5512,7 @@ function _ts_generator$3(thisArg, body) {
5019
5512
  * @param result - The interaction results to apply.
5020
5513
  * @param options - Optional settings for merging with the last submission.
5021
5514
  * @param options.mergeWithLastSubmission - Whether to merge with the last submission (defaults to true)
5022
- * @returns The `returnTo` URL that the client should redirect to.
5515
+ * @returns The interaction that was completed. It includes the returnTo property for the next step of the interaction.
5023
5516
  */ function finishInteractionByUid(uid, result, options) {
5024
5517
  return _async_to_generator$3(function() {
5025
5518
  var _ref, interaction, mergeWithLastSubmission;
@@ -5046,7 +5539,7 @@ function _ts_generator$3(thisArg, body) {
5046
5539
  _state.sent();
5047
5540
  return [
5048
5541
  2,
5049
- interaction.returnTo
5542
+ interaction
5050
5543
  ];
5051
5544
  }
5052
5545
  });
@@ -5136,6 +5629,9 @@ function _array_like_to_array$1(arr, len) {
5136
5629
  function _array_with_holes(arr) {
5137
5630
  if (Array.isArray(arr)) return arr;
5138
5631
  }
5632
+ function _array_without_holes$1(arr) {
5633
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
5634
+ }
5139
5635
  function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
5140
5636
  try {
5141
5637
  var info = gen[key](arg);
@@ -5204,6 +5700,9 @@ function _instanceof(left, right) {
5204
5700
  return left instanceof right;
5205
5701
  }
5206
5702
  }
5703
+ function _iterable_to_array$1(iter) {
5704
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5705
+ }
5207
5706
  function _iterable_to_array_limit(arr, i) {
5208
5707
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5209
5708
  if (_i == null) return;
@@ -5231,9 +5730,15 @@ function _iterable_to_array_limit(arr, i) {
5231
5730
  function _non_iterable_rest() {
5232
5731
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5233
5732
  }
5733
+ function _non_iterable_spread$1() {
5734
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5735
+ }
5234
5736
  function _sliced_to_array(arr, i) {
5235
5737
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest();
5236
5738
  }
5739
+ function _to_consumable_array$1(arr) {
5740
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
5741
+ }
5237
5742
  function _unsupported_iterable_to_array$1(o, minLen) {
5238
5743
  if (!o) return;
5239
5744
  if (typeof o === "string") return _array_like_to_array$1(o, minLen);
@@ -5341,6 +5846,7 @@ function _ts_generator$2(thisArg, body) {
5341
5846
  };
5342
5847
  }
5343
5848
  }
5849
+ var OidcInteractionController_1;
5344
5850
  /**
5345
5851
  * OIDC scopes that the server always grants on consent when they were
5346
5852
  * requested, regardless of whether the frontend included them in
@@ -5359,17 +5865,20 @@ function _ts_generator$2(thisArg, body) {
5359
5865
  * The POST endpoints are called by the frontend app. They verify the user's
5360
5866
  * Firebase Auth ID token and bypass the oidc-provider interaction cookie
5361
5867
  * (which is scoped to the frontend path set by `interactions.url`).
5362
- */ exports.OidcInteractionController = /*#__PURE__*/ function() {
5363
- function OidcInteractionController(oidcInteractionService, oidcProviderConfigService, accountService, oidcService) {
5868
+ */ exports.OidcInteractionController = OidcInteractionController_1 = /*#__PURE__*/ function() {
5869
+ function OidcInteractionController(oidcInteractionService, oidcProviderConfigService, accountService, oidcService, analytics) {
5364
5870
  _class_call_check$2(this, OidcInteractionController);
5365
5871
  _define_property$3(this, "oidcInteractionService", void 0);
5366
5872
  _define_property$3(this, "oidcProviderConfigService", void 0);
5367
5873
  _define_property$3(this, "accountService", void 0);
5368
5874
  _define_property$3(this, "oidcService", void 0);
5875
+ _define_property$3(this, "_logger", new common.Logger(OidcInteractionController_1.name));
5876
+ _define_property$3(this, "_analytics", void 0);
5369
5877
  this.oidcInteractionService = oidcInteractionService;
5370
5878
  this.oidcProviderConfigService = oidcProviderConfigService;
5371
5879
  this.accountService = accountService;
5372
5880
  this.oidcService = oidcService;
5881
+ this._analytics = analytics !== null && analytics !== void 0 ? analytics : noopOidcAnalyticsService();
5373
5882
  }
5374
5883
  _create_class$2(OidcInteractionController, [
5375
5884
  {
@@ -5435,23 +5944,45 @@ function _ts_generator$2(thisArg, body) {
5435
5944
  * @throws {HttpException} HTTP 400 when the login interaction cannot be completed.
5436
5945
  */ function postLogin(uid, body, res) {
5437
5946
  return _async_to_generator$2(function() {
5438
- var accountId, redirectTo;
5947
+ var startedAt, accountId, err, interaction, err1;
5439
5948
  return _ts_generator$2(this, function(_state) {
5440
5949
  switch(_state.label){
5441
5950
  case 0:
5951
+ startedAt = Date.now();
5952
+ _state.label = 1;
5953
+ case 1:
5954
+ _state.trys.push([
5955
+ 1,
5956
+ 3,
5957
+ ,
5958
+ 4
5959
+ ]);
5442
5960
  return [
5443
5961
  4,
5444
5962
  this._verifyIdToken(body.idToken)
5445
5963
  ];
5446
- case 1:
5447
- accountId = _state.sent();
5448
- _state.label = 2;
5449
5964
  case 2:
5965
+ accountId = _state.sent();
5966
+ return [
5967
+ 3,
5968
+ 4
5969
+ ];
5970
+ case 3:
5971
+ err = _state.sent();
5972
+ emitOidcAnalyticsEvent(this._analytics, {
5973
+ type: 'login',
5974
+ isSuccessful: false,
5975
+ reason: 'invalid_id_token',
5976
+ error: err,
5977
+ durationMs: Date.now() - startedAt
5978
+ }, this._logger);
5979
+ throw err;
5980
+ case 4:
5450
5981
  _state.trys.push([
5451
- 2,
5452
5982
  4,
5983
+ 6,
5453
5984
  ,
5454
- 5
5985
+ 7
5455
5986
  ]);
5456
5987
  return [
5457
5988
  4,
@@ -5463,19 +5994,33 @@ function _ts_generator$2(thisArg, body) {
5463
5994
  mergeWithLastSubmission: false
5464
5995
  })
5465
5996
  ];
5466
- case 3:
5467
- redirectTo = _state.sent();
5997
+ case 5:
5998
+ interaction = _state.sent();
5999
+ emitOidcAnalyticsEvent(this._analytics, {
6000
+ type: 'login',
6001
+ isSuccessful: true,
6002
+ uid: accountId,
6003
+ durationMs: Date.now() - startedAt
6004
+ }, this._logger);
5468
6005
  res.json({
5469
- redirectTo: redirectTo
6006
+ redirectTo: interaction.returnTo
5470
6007
  });
5471
6008
  return [
5472
6009
  3,
5473
- 5
6010
+ 7
5474
6011
  ];
5475
- case 4:
5476
- _state.sent();
6012
+ case 6:
6013
+ err1 = _state.sent();
6014
+ emitOidcAnalyticsEvent(this._analytics, {
6015
+ type: 'login',
6016
+ isSuccessful: false,
6017
+ uid: accountId,
6018
+ reason: 'login_interaction_failed',
6019
+ error: err1,
6020
+ durationMs: Date.now() - startedAt
6021
+ }, this._logger);
5477
6022
  throw new common.HttpException('Login interaction failed', common.HttpStatus.BAD_REQUEST);
5478
- case 5:
6023
+ case 7:
5479
6024
  return [
5480
6025
  2
5481
6026
  ];
@@ -5498,10 +6043,11 @@ function _ts_generator$2(thisArg, body) {
5498
6043
  * @throws {HttpException} HTTP 400 when the consent interaction cannot be completed.
5499
6044
  */ function postConsent(uid, body, res) {
5500
6045
  return _async_to_generator$2(function() {
5501
- var _ref, _ref1, _prompt_details_missingOIDCScope, _prompt_details_missingOIDCClaims, _prompt_details_missingResourceScopes, redirectTo, interaction, prompt, params, session, clientId, requestedRawTtl, clientPayload, clientMaxSessionTtl, expiresInSeconds, grant, encounteredOIDCScopes, missingOIDCScope, _resolveEffectiveSubset, granted, rejected, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, value, encounteredOIDCClaims, missingOIDCClaims, _resolveEffectiveSubset1, granted1, rejected1, missingResourceScopes, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, indicator, scopes, _body_grantedResourceScopes, requestedSubset, encounteredResourceScopes, _resolveEffectiveSubset2, granted2, rejected2, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, value1, grantId, redirectTo1, err;
6046
+ var startedAt, clientId, accountId, _ref, _prompt_details_missingOIDCScope, _this_accountService_providerConfig_adminOnlyScopes, _ref1, _ref2, _prompt_details_missingOIDCClaims, _prompt_details_missingResourceScopes, _this_accountService_delegate_isAdminUser, _this_accountService_delegate, _ref3, redirectTo, interaction, prompt, params, session, missingOIDCScope, existingGrant, _tmp, encounteredOIDCScopes, requestedOIDCScopeSet, adminOnlyScopes, requestsServiceToken, isAdmin, _tmp1, _ref4, redirectTo1, requestedRawTtl, clientPayload, clientMaxSessionTtl, expiresInSeconds, grant, _tmp2, _resolveEffectiveSubset, granted, rejected, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, value, encounteredOIDCClaims, missingOIDCClaims, _resolveEffectiveSubset1, granted1, rejected1, missingResourceScopes, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, indicator, scopes, _body_grantedResourceScopes, requestedSubset, encounteredResourceScopes, _resolveEffectiveSubset2, granted2, rejected2, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, value1, grantId, _ref5, redirectTo2, err;
5502
6047
  return _ts_generator$2(this, function(_state) {
5503
6048
  switch(_state.label){
5504
6049
  case 0:
6050
+ startedAt = Date.now();
5505
6051
  return [
5506
6052
  4,
5507
6053
  this._verifyIdToken(body.idToken)
@@ -5512,9 +6058,9 @@ function _ts_generator$2(thisArg, body) {
5512
6058
  case 2:
5513
6059
  _state.trys.push([
5514
6060
  2,
5515
- 10,
6061
+ 20,
5516
6062
  ,
5517
- 11
6063
+ 21
5518
6064
  ]);
5519
6065
  if (!!body.approved) return [
5520
6066
  3,
@@ -5530,7 +6076,7 @@ function _ts_generator$2(thisArg, body) {
5530
6076
  })
5531
6077
  ];
5532
6078
  case 3:
5533
- redirectTo = _state.sent();
6079
+ _ref3 = _state.sent(), redirectTo = _ref3.returnTo;
5534
6080
  res.json({
5535
6081
  redirectTo: redirectTo
5536
6082
  });
@@ -5546,35 +6092,131 @@ function _ts_generator$2(thisArg, body) {
5546
6092
  interaction = _state.sent();
5547
6093
  prompt = interaction.prompt, params = interaction.params, session = interaction.session;
5548
6094
  clientId = params.client_id;
6095
+ accountId = (_ref = session === null || session === void 0 ? void 0 : session.accountId) !== null && _ref !== void 0 ? _ref : '';
6096
+ missingOIDCScope = (_prompt_details_missingOIDCScope = prompt.details.missingOIDCScope) !== null && _prompt_details_missingOIDCScope !== void 0 ? _prompt_details_missingOIDCScope : [];
6097
+ if (!interaction.grantId) return [
6098
+ 3,
6099
+ 7
6100
+ ];
6101
+ return [
6102
+ 4,
6103
+ this.oidcInteractionService.findOrCreateGrant(interaction.grantId, accountId, clientId)
6104
+ ];
6105
+ case 6:
6106
+ _tmp = _state.sent();
6107
+ return [
6108
+ 3,
6109
+ 8
6110
+ ];
6111
+ case 7:
6112
+ _tmp = undefined;
6113
+ _state.label = 8;
6114
+ case 8:
6115
+ existingGrant = _tmp;
6116
+ // Encountered = scopes/claims already granted (or rejected) on the existing Grant. oidc-provider
6117
+ // excludes these from `missingOIDCScope` etc. when the consent prompt is re-shown via `prompt=consent`,
6118
+ // but the consent UI sources its checkbox list from the auth URL's `scope=` param (the full request set)
6119
+ // and re-submits them all. We accept already-encountered values as silent no-ops so a re-consent on a
6120
+ // client the user has previously authorized doesn't fail validation.
6121
+ encounteredOIDCScopes = existingGrant ? existingGrant.getOIDCScopeEncountered().split(' ').filter(Boolean) : [];
6122
+ // Admin-only scope gate. The requested OIDC scope set is `missingOIDCScope ∪ encounteredOIDCScopes`
6123
+ // (a fresh consent has everything in `missing`; a re-consent may carry already-granted scopes in
6124
+ // `encountered`). If that set intersects the provider's `adminOnlyScopes` and the resolving user is
6125
+ // not an admin, hard-reject with `access_denied` rather than silently dropping the scope.
6126
+ requestedOIDCScopeSet = new Set(_to_consumable_array$1(missingOIDCScope).concat(_to_consumable_array$1(encounteredOIDCScopes)));
6127
+ adminOnlyScopes = (_this_accountService_providerConfig_adminOnlyScopes = this.accountService.providerConfig.adminOnlyScopes) !== null && _this_accountService_providerConfig_adminOnlyScopes !== void 0 ? _this_accountService_providerConfig_adminOnlyScopes : [];
6128
+ requestsServiceToken = adminOnlyScopes.some(function(scope) {
6129
+ return requestedOIDCScopeSet.has(scope);
6130
+ });
6131
+ if (!accountId) return [
6132
+ 3,
6133
+ 10
6134
+ ];
6135
+ return [
6136
+ 4,
6137
+ (_ref1 = (_this_accountService_delegate_isAdminUser = (_this_accountService_delegate = this.accountService.delegate).isAdminUser) === null || _this_accountService_delegate_isAdminUser === void 0 ? void 0 : _this_accountService_delegate_isAdminUser.call(_this_accountService_delegate, this.accountService.userContext(accountId).authUserContext)) !== null && _ref1 !== void 0 ? _ref1 : false
6138
+ ];
6139
+ case 9:
6140
+ _tmp1 = _state.sent();
6141
+ return [
6142
+ 3,
6143
+ 11
6144
+ ];
6145
+ case 10:
6146
+ _tmp1 = false;
6147
+ _state.label = 11;
6148
+ case 11:
6149
+ isAdmin = _tmp1;
6150
+ if (!(requestsServiceToken && !isAdmin)) return [
6151
+ 3,
6152
+ 13
6153
+ ];
6154
+ return [
6155
+ 4,
6156
+ this.oidcInteractionService.finishInteractionByUid(uid, {
6157
+ error: 'access_denied',
6158
+ error_description: 'token.service is restricted to admins.'
6159
+ }, {
6160
+ mergeWithLastSubmission: true
6161
+ })
6162
+ ];
6163
+ case 12:
6164
+ _ref4 = _state.sent(), redirectTo1 = _ref4.returnTo;
6165
+ emitOidcAnalyticsEvent(this._analytics, {
6166
+ type: 'consent',
6167
+ isSuccessful: false,
6168
+ uid: accountId,
6169
+ clientId: clientId,
6170
+ serviceToken: true,
6171
+ isAdmin: false,
6172
+ reason: 'service_token_non_admin',
6173
+ durationMs: Date.now() - startedAt
6174
+ }, this._logger);
6175
+ res.json({
6176
+ redirectTo: redirectTo1
6177
+ });
6178
+ return [
6179
+ 2
6180
+ ];
6181
+ case 13:
5549
6182
  // Resolve the requested login duration up-front. The configured Grant TTL function (in
5550
6183
  // OidcService.buildProviderConfiguration) only fires when oidc-provider's koa middleware
5551
6184
  // drives `grant.save()`, so its `ctx.oidc.params` lookup of `dbx_session_ttl` returns
5552
6185
  // undefined when the consent submit runs in this controller. We pre-set `expiresIn` on
5553
- // newly-created grants so they persist with the correct TTL.
6186
+ // newly-created grants so they persist with the correct (tiered) TTL.
5554
6187
  requestedRawTtl = params[DBX_FIREBASE_SERVER_OIDC_SESSION_TTL_PARAM];
5555
6188
  return [
5556
6189
  4,
5557
6190
  this.oidcService.findClientPayload(clientId)
5558
6191
  ];
5559
- case 6:
6192
+ case 14:
5560
6193
  clientPayload = _state.sent();
5561
- clientMaxSessionTtl = (_ref = clientPayload === null || clientPayload === void 0 ? void 0 : clientPayload.dbx_max_session_ttl) !== null && _ref !== void 0 ? _ref : undefined;
6194
+ clientMaxSessionTtl = (_ref2 = clientPayload === null || clientPayload === void 0 ? void 0 : clientPayload.dbx_max_session_ttl) !== null && _ref2 !== void 0 ? _ref2 : undefined;
5562
6195
  expiresInSeconds = this.oidcService.resolveLoginDurationForGrant(requestedRawTtl, {
5563
6196
  dbx_max_session_ttl: clientMaxSessionTtl
6197
+ }, {
6198
+ isAdmin: isAdmin,
6199
+ hasServiceScope: requestsServiceToken
5564
6200
  });
6201
+ if (!(existingGrant !== null && existingGrant !== void 0)) return [
6202
+ 3,
6203
+ 15
6204
+ ];
6205
+ _tmp2 = existingGrant;
6206
+ return [
6207
+ 3,
6208
+ 17
6209
+ ];
6210
+ case 15:
5565
6211
  return [
5566
6212
  4,
5567
- this.oidcInteractionService.findOrCreateGrant(interaction.grantId, (_ref1 = session === null || session === void 0 ? void 0 : session.accountId) !== null && _ref1 !== void 0 ? _ref1 : '', clientId, expiresInSeconds)
6213
+ this.oidcInteractionService.findOrCreateGrant(interaction.grantId, accountId, clientId, expiresInSeconds)
5568
6214
  ];
5569
- case 7:
5570
- grant = _state.sent();
5571
- // Encountered = scopes/claims already granted (or rejected) on the existing Grant. oidc-provider
5572
- // excludes these from `missingOIDCScope` etc. when the consent prompt is re-shown via `prompt=consent`,
5573
- // but the consent UI sources its checkbox list from the auth URL's `scope=` param (the full request set)
5574
- // and re-submits them all. We accept already-encountered values as silent no-ops so a re-consent on a
5575
- // client the user has previously authorized doesn't fail validation.
5576
- encounteredOIDCScopes = grant.getOIDCScopeEncountered().split(' ').filter(Boolean);
5577
- missingOIDCScope = (_prompt_details_missingOIDCScope = prompt.details.missingOIDCScope) !== null && _prompt_details_missingOIDCScope !== void 0 ? _prompt_details_missingOIDCScope : [];
6215
+ case 16:
6216
+ _tmp2 = _state.sent();
6217
+ _state.label = 17;
6218
+ case 17:
6219
+ grant = _tmp2;
5578
6220
  if (missingOIDCScope.length > 0) {
5579
6221
  _resolveEffectiveSubset = resolveEffectiveSubset({
5580
6222
  missing: missingOIDCScope,
@@ -5676,7 +6318,7 @@ function _ts_generator$2(thisArg, body) {
5676
6318
  4,
5677
6319
  grant.save()
5678
6320
  ];
5679
- case 8:
6321
+ case 18:
5680
6322
  grantId = _state.sent();
5681
6323
  return [
5682
6324
  4,
@@ -5688,22 +6330,41 @@ function _ts_generator$2(thisArg, body) {
5688
6330
  mergeWithLastSubmission: true
5689
6331
  })
5690
6332
  ];
5691
- case 9:
5692
- redirectTo1 = _state.sent();
6333
+ case 19:
6334
+ _ref5 = _state.sent(), redirectTo2 = _ref5.returnTo;
6335
+ emitOidcAnalyticsEvent(this._analytics, {
6336
+ type: 'consent',
6337
+ isSuccessful: true,
6338
+ uid: accountId,
6339
+ clientId: clientId,
6340
+ scopes: Array.from(requestedOIDCScopeSet),
6341
+ serviceToken: requestsServiceToken,
6342
+ isAdmin: isAdmin,
6343
+ durationMs: Date.now() - startedAt
6344
+ }, this._logger);
5693
6345
  res.json({
5694
- redirectTo: redirectTo1
6346
+ redirectTo: redirectTo2
5695
6347
  });
5696
6348
  return [
5697
6349
  3,
5698
- 11
6350
+ 21
5699
6351
  ];
5700
- case 10:
6352
+ case 20:
5701
6353
  err = _state.sent();
6354
+ emitOidcAnalyticsEvent(this._analytics, {
6355
+ type: 'consent',
6356
+ isSuccessful: false,
6357
+ uid: accountId,
6358
+ clientId: clientId,
6359
+ reason: 'consent_interaction_failed',
6360
+ error: err,
6361
+ durationMs: Date.now() - startedAt
6362
+ }, this._logger);
5702
6363
  if (_instanceof(err, common.HttpException)) {
5703
6364
  throw err;
5704
6365
  }
5705
6366
  throw new common.HttpException('Consent interaction failed', common.HttpStatus.BAD_REQUEST);
5706
- case 11:
6367
+ case 21:
5707
6368
  return [
5708
6369
  2
5709
6370
  ];
@@ -5778,12 +6439,14 @@ __decorate([
5778
6439
  __param(1, common.Body()),
5779
6440
  __param(2, common.Res())
5780
6441
  ], exports.OidcInteractionController.prototype, "postConsent", null);
5781
- exports.OidcInteractionController = __decorate([
6442
+ exports.OidcInteractionController = OidcInteractionController_1 = __decorate([
5782
6443
  common.Controller('interaction'),
5783
6444
  __param(0, common.Inject(exports.OidcInteractionService)),
5784
6445
  __param(1, common.Inject(exports.OidcProviderConfigService)),
5785
6446
  __param(2, common.Inject(OidcAccountService)),
5786
- __param(3, common.Inject(exports.OidcService))
6447
+ __param(3, common.Inject(exports.OidcService)),
6448
+ __param(4, common.Optional()),
6449
+ __param(4, common.Inject(OIDC_ANALYTICS_SERVICE))
5787
6450
  ], exports.OidcInteractionController);
5788
6451
  /**
5789
6452
  * Resolves the effective set to grant — and the complementary set to
@@ -6094,6 +6757,69 @@ function _ts_generator$1(thisArg, body) {
6094
6757
  }));
6095
6758
  }
6096
6759
  },
6760
+ {
6761
+ key: "getSession",
6762
+ value: /**
6763
+ * GET /oidc/session.
6764
+ *
6765
+ * Read route that verifies the presented bearer access token and returns its resolved session
6766
+ * lifetime metadata: `{ sub, scope, expiresAt, rotationDisabled }`. `expiresAt` is the grant's
6767
+ * expiry (unix seconds) and `rotationDisabled` flags a non-rotating (service) token. The values
6768
+ * are sourced from the access token's baked-in `extra` claims (see `extraTokenClaims`), so this
6769
+ * does not require decoding the opaque token client-side — cleaner than userinfo, which does not
6770
+ * echo access-token `extra`.
6771
+ *
6772
+ * Declared ahead of the `@All('{*path}')` catch-all so it is matched here rather than proxied to
6773
+ * the oidc-provider callback (mirrors `GET /oidc/login/client`).
6774
+ *
6775
+ * @param req - Inbound request; the `Authorization: Bearer <token>` header is read for the access token.
6776
+ * @param res - Express response used to send the session JSON (401 when the token is missing/invalid).
6777
+ */ function getSession(req, res) {
6778
+ return _async_to_generator$1(function() {
6779
+ var _exec_, _exec, rawAuthHeader, authHeader, bearer, handled, authData, _token_scope, _token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM, _token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM, token;
6780
+ return _ts_generator$1(this, function(_state) {
6781
+ switch(_state.label){
6782
+ case 0:
6783
+ rawAuthHeader = req.headers['authorization'];
6784
+ authHeader = Array.isArray(rawAuthHeader) ? rawAuthHeader[0] : rawAuthHeader;
6785
+ bearer = (_exec = /^Bearer\s+(.+)$/i.exec(authHeader !== null && authHeader !== void 0 ? authHeader : '')) === null || _exec === void 0 ? void 0 : (_exec_ = _exec[1]) === null || _exec_ === void 0 ? void 0 : _exec_.trim();
6786
+ handled = false;
6787
+ if (!bearer) return [
6788
+ 3,
6789
+ 2
6790
+ ];
6791
+ return [
6792
+ 4,
6793
+ this.oidcService.verifyAccessToken(bearer)
6794
+ ];
6795
+ case 1:
6796
+ authData = _state.sent();
6797
+ if (authData) {
6798
+ token = authData.token;
6799
+ res.json({
6800
+ sub: authData.uid,
6801
+ scope: (_token_scope = token['scope']) !== null && _token_scope !== void 0 ? _token_scope : null,
6802
+ expiresAt: (_token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM = token[DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM]) !== null && _token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM !== void 0 ? _token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM : null,
6803
+ rotationDisabled: (_token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM = token[DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM]) !== null && _token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM !== void 0 ? _token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM : false
6804
+ });
6805
+ handled = true;
6806
+ }
6807
+ _state.label = 2;
6808
+ case 2:
6809
+ if (!handled) {
6810
+ res.status(common.HttpStatus.UNAUTHORIZED).json({
6811
+ error: 'invalid_token',
6812
+ error_description: 'Missing or invalid bearer access token.'
6813
+ });
6814
+ }
6815
+ return [
6816
+ 2
6817
+ ];
6818
+ }
6819
+ });
6820
+ }).call(this);
6821
+ }
6822
+ },
6097
6823
  {
6098
6824
  key: "handleOidcRequest",
6099
6825
  value: function handleOidcRequest(req, res) {
@@ -6127,6 +6853,11 @@ __decorate([
6127
6853
  __param(0, common.Req()),
6128
6854
  __param(1, common.Res())
6129
6855
  ], exports.OidcProviderController.prototype, "redirectToClientLogin", null);
6856
+ __decorate([
6857
+ common.Get('session'),
6858
+ __param(0, common.Req()),
6859
+ __param(1, common.Res())
6860
+ ], exports.OidcProviderController.prototype, "getSession", null);
6130
6861
  __decorate([
6131
6862
  common.All('{*path}'),
6132
6863
  __param(0, common.Req()),
@@ -6838,8 +7569,13 @@ function _unsupported_iterable_to_array(o, minLen) {
6838
7569
  exports.DEFAULT_APP_OAUTH_CONSENT_PATH_PART = DEFAULT_APP_OAUTH_CONSENT_PATH_PART;
6839
7570
  exports.DEFAULT_APP_OAUTH_INTERACTION_PATH = DEFAULT_APP_OAUTH_INTERACTION_PATH;
6840
7571
  exports.DEFAULT_APP_OAUTH_LOGIN_PATH_PART = DEFAULT_APP_OAUTH_LOGIN_PATH_PART;
7572
+ exports.DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS = DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS;
7573
+ exports.DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS = DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS;
6841
7574
  exports.DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS = DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS;
7575
+ exports.DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS = DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS;
6842
7576
  exports.DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS = DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS;
7577
+ exports.DEFAULT_OIDC_ANALYTICS_EVENT_NAMES = DEFAULT_OIDC_ANALYTICS_EVENT_NAMES;
7578
+ exports.DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX = DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX;
6843
7579
  exports.DEFAULT_OIDC_CODE_CHALLENGE_METHODS = DEFAULT_OIDC_CODE_CHALLENGE_METHODS;
6844
7580
  exports.DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES = DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES;
6845
7581
  exports.DEFAULT_OIDC_ISSUER_PATH = DEFAULT_OIDC_ISSUER_PATH;
@@ -6848,18 +7584,21 @@ exports.DEFAULT_OIDC_SUBJECT_TYPES = DEFAULT_OIDC_SUBJECT_TYPES;
6848
7584
  exports.DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS = DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS;
6849
7585
  exports.DEFAULT_OIDC_TOKEN_LIFETIMES = DEFAULT_OIDC_TOKEN_LIFETIMES;
6850
7586
  exports.DEFAULT_ROTATED_KEY_MAX_AGE = DEFAULT_ROTATED_KEY_MAX_AGE;
7587
+ exports.FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG = FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG;
6851
7588
  exports.FIREBASE_SERVER_OIDC_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE = FIREBASE_SERVER_OIDC_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE;
6852
7589
  exports.GRANTABLE_MODEL_NAMES = GRANTABLE_MODEL_NAMES;
6853
7590
  exports.JwksFirestoreCollections = JwksFirestoreCollections;
6854
7591
  exports.JwksKeyDocument = JwksKeyDocument;
6855
7592
  exports.JwksServiceConfig = JwksServiceConfig;
6856
7593
  exports.JwksServiceStorageConfig = JwksServiceStorageConfig;
7594
+ exports.OIDC_ANALYTICS_SERVICE = OIDC_ANALYTICS_SERVICE;
6857
7595
  exports.OIDC_ENCRYPTED_PAYLOAD_FIELDS = OIDC_ENCRYPTED_PAYLOAD_FIELDS;
6858
7596
  exports.OIDC_JSON_RENDER_ERROR_FUNCTION = OIDC_JSON_RENDER_ERROR_FUNCTION;
6859
7597
  exports.OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY = OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY;
6860
7598
  exports.OidcAccountService = OidcAccountService;
6861
7599
  exports.OidcAccountServiceDelegate = OidcAccountServiceDelegate;
6862
7600
  exports.OidcAccountServiceUserContext = OidcAccountServiceUserContext;
7601
+ exports.OidcAnalyticsService = OidcAnalyticsService;
6863
7602
  exports.OidcAuth = OidcAuth;
6864
7603
  exports.OidcAuthMiddlewareConfig = OidcAuthMiddlewareConfig;
6865
7604
  exports.OidcClientService = OidcClientService;
@@ -6868,6 +7607,7 @@ exports.OidcModuleConfig = OidcModuleConfig;
6868
7607
  exports.OidcServerFirestoreCollections = OidcServerFirestoreCollections;
6869
7608
  exports.activeJwksKeysQuery = activeJwksKeysQuery;
6870
7609
  exports.allOidcScopesStringForProviderConfig = allOidcScopesStringForProviderConfig;
7610
+ exports.appOidcAnalyticsModuleMetadata = appOidcAnalyticsModuleMetadata;
6871
7611
  exports.appOidcModelModuleMetadata = appOidcModelModuleMetadata;
6872
7612
  exports.applyOidcAuthMiddleware = applyOidcAuthMiddleware;
6873
7613
  exports.applyOidcCorsMiddleware = applyOidcCorsMiddleware;
@@ -6878,6 +7618,7 @@ exports.createOidcClientFactory = createOidcClientFactory;
6878
7618
  exports.deleteOidcClientFactory = deleteOidcClientFactory;
6879
7619
  exports.deleteOidcTokenFactory = deleteOidcTokenFactory;
6880
7620
  exports.deriveResourceMetadataUrlFromEnv = deriveResourceMetadataUrlFromEnv;
7621
+ exports.emitOidcAnalyticsEvent = emitOidcAnalyticsEvent;
6881
7622
  exports.getOidcScopesFromRequest = getOidcScopesFromRequest;
6882
7623
  exports.jwksKeyCollectionReference = jwksKeyCollectionReference;
6883
7624
  exports.jwksKeyConverter = jwksKeyConverter;
@@ -6885,6 +7626,7 @@ exports.jwksKeyFirestoreCollection = jwksKeyFirestoreCollection;
6885
7626
  exports.jwksKeyIdentity = jwksKeyIdentity;
6886
7627
  exports.jwksKeysWithStatusQuery = jwksKeysWithStatusQuery;
6887
7628
  exports.nonRetiredJwksKeysQuery = nonRetiredJwksKeysQuery;
7629
+ exports.noopOidcAnalyticsService = noopOidcAnalyticsService;
6888
7630
  exports.oidcCallModelScopePreAssert = oidcCallModelScopePreAssert;
6889
7631
  exports.oidcFirestoreCollectionsFactory = oidcFirestoreCollectionsFactory;
6890
7632
  exports.oidcModelServerActions = oidcModelServerActions;