@dereekb/firebase-server 13.11.14 → 13.11.16

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 (102) hide show
  1. package/index.cjs.js +229 -199
  2. package/index.esm.js +230 -200
  3. package/mailgun/package.json +9 -9
  4. package/model/index.cjs.js +259 -270
  5. package/model/index.esm.js +259 -270
  6. package/model/package.json +9 -9
  7. package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +3 -3
  8. package/model/src/lib/notification/notification.action.server.d.ts +34 -34
  9. package/model/src/lib/notification/notification.action.server.init.d.ts +17 -17
  10. package/model/src/lib/notification/notification.config.service.d.ts +7 -7
  11. package/model/src/lib/notification/notification.create.run.d.ts +3 -3
  12. package/model/src/lib/notification/notification.error.d.ts +14 -14
  13. package/model/src/lib/notification/notification.expedite.service.d.ts +7 -7
  14. package/model/src/lib/notification/notification.module.d.ts +13 -13
  15. package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +2 -2
  16. package/model/src/lib/notification/notification.send.service.text.d.ts +1 -1
  17. package/model/src/lib/notification/notification.task.service.handler.d.ts +2 -2
  18. package/model/src/lib/notification/notification.task.service.util.d.ts +3 -3
  19. package/model/src/lib/notification/notification.task.subtask.handler.d.ts +3 -3
  20. package/model/src/lib/notification/notification.util.d.ts +8 -8
  21. package/model/src/lib/storagefile/storagefile.action.server.d.ts +43 -44
  22. package/model/src/lib/storagefile/storagefile.action.server.init.d.ts +11 -11
  23. package/model/src/lib/storagefile/storagefile.error.d.ts +15 -15
  24. package/model/src/lib/storagefile/storagefile.module.d.ts +10 -10
  25. package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +6 -6
  26. package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +5 -5
  27. package/model/src/lib/storagefile/storagefile.util.d.ts +2 -2
  28. package/oidc/index.cjs.js +225 -219
  29. package/oidc/index.esm.js +225 -219
  30. package/oidc/package.json +10 -10
  31. package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +44 -25
  32. package/oidc/src/lib/controller/oidc.provider.controller.d.ts +1 -1
  33. package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +3 -3
  34. package/oidc/src/lib/middleware/oauth-cors.module.d.ts +1 -1
  35. package/oidc/src/lib/model/jwks/jwks.d.ts +6 -6
  36. package/oidc/src/lib/model/jwks/jwks.query.d.ts +11 -5
  37. package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +12 -12
  38. package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +5 -5
  39. package/oidc/src/lib/oidc.config.d.ts +1 -1
  40. package/oidc/src/lib/oidc.module.d.ts +8 -8
  41. package/oidc/src/lib/service/oidc.account.service.d.ts +4 -4
  42. package/oidc/src/lib/service/oidc.adapter.service.d.ts +4 -4
  43. package/oidc/src/lib/service/oidc.client.service.d.ts +3 -3
  44. package/oidc/src/lib/service/oidc.config.service.d.ts +1 -1
  45. package/oidc/src/lib/service/oidc.encryption.service.d.ts +4 -4
  46. package/oidc/src/lib/service/oidc.interaction.service.d.ts +14 -14
  47. package/oidc/src/lib/service/oidc.jwks.service.d.ts +6 -6
  48. package/oidc/src/lib/service/oidc.service.d.ts +5 -5
  49. package/package.json +10 -10
  50. package/src/lib/auth/auth.service.d.ts +8 -8
  51. package/src/lib/auth/auth.util.d.ts +1 -1
  52. package/src/lib/env/env.config.d.ts +5 -4
  53. package/src/lib/firestore/driver.accessor.batch.d.ts +2 -1
  54. package/src/lib/firestore/driver.accessor.d.ts +1 -1
  55. package/src/lib/firestore/driver.accessor.default.d.ts +2 -1
  56. package/src/lib/firestore/driver.accessor.transaction.d.ts +2 -1
  57. package/src/lib/firestore/snapshot/snapshot.field.encrypt.d.ts +10 -6
  58. package/src/lib/function/type.d.ts +4 -4
  59. package/src/lib/nest/analytics/analytics.module.d.ts +6 -5
  60. package/src/lib/nest/app.d.ts +4 -4
  61. package/src/lib/nest/app.module.d.ts +3 -2
  62. package/src/lib/nest/auth/auth.module.d.ts +4 -3
  63. package/src/lib/nest/controller/model/model.api.controller.d.ts +1 -0
  64. package/src/lib/nest/controller/model/model.api.get.service.d.ts +1 -1
  65. package/src/lib/nest/controller/model/model.api.module.d.ts +4 -3
  66. package/src/lib/nest/development/development.function.d.ts +1 -1
  67. package/src/lib/nest/development/development.schedule.function.error.d.ts +2 -2
  68. package/src/lib/nest/env/env.util.d.ts +2 -2
  69. package/src/lib/nest/firestore/firestore.module.d.ts +16 -15
  70. package/src/lib/nest/function/call.d.ts +6 -6
  71. package/src/lib/nest/function/context.d.ts +7 -6
  72. package/src/lib/nest/function/v2/blocking.d.ts +8 -6
  73. package/src/lib/nest/function/v2/call.d.ts +7 -5
  74. package/src/lib/nest/function/v2/event.d.ts +3 -2
  75. package/src/lib/nest/function/v2/schedule.d.ts +3 -2
  76. package/src/lib/nest/function/v2/taskqueue.d.ts +2 -1
  77. package/src/lib/nest/model/analytics.emit.d.ts +5 -5
  78. package/src/lib/nest/model/api.details.d.ts +4 -4
  79. package/src/lib/nest/model/query.model.function.d.ts +3 -3
  80. package/src/lib/nest/nest.provider.d.ts +7 -7
  81. package/src/lib/nest/storage/storage.module.d.ts +6 -5
  82. package/src/lib/storage/driver.accessor.d.ts +10 -10
  83. package/test/index.cjs.js +48 -57
  84. package/test/index.esm.js +48 -57
  85. package/test/package.json +11 -11
  86. package/test/src/lib/firebase/firebase.admin.auth.d.ts +18 -18
  87. package/test/src/lib/firebase/firebase.admin.collection.d.ts +7 -7
  88. package/test/src/lib/firebase/firebase.admin.d.ts +2 -2
  89. package/test/src/lib/firebase/firebase.admin.function.d.ts +2 -2
  90. package/test/src/lib/firebase/firebase.admin.nest.function.callable.context.d.ts +1 -1
  91. package/test/src/lib/firebase/firebase.admin.nest.function.cloud.context.d.ts +3 -3
  92. package/test/src/lib/firebase/firebase.d.ts +6 -5
  93. package/test/src/lib/firebase/firebase.function.d.ts +31 -31
  94. package/test/src/lib/firestore/firestore.d.ts +2 -2
  95. package/test/src/lib/oidc/oidc.test.fixture.d.ts +1 -1
  96. package/test/src/lib/oidc/oidc.test.flow.d.ts +1 -1
  97. package/test/src/lib/storage/storage.d.ts +2 -2
  98. package/zoho/index.cjs.js +2 -2
  99. package/zoho/index.esm.js +2 -2
  100. package/zoho/package.json +9 -9
  101. package/zoho/src/lib/zoho.accounts.firebase.d.ts +1 -1
  102. package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +1 -1
package/oidc/index.cjs.js CHANGED
@@ -234,7 +234,7 @@ function _define_property$f(obj, key, value) {
234
234
  *
235
235
  * Called by {@link oidcModuleConfigFactory} after building the config from environment variables.
236
236
  *
237
- * @param config - the config object to validate
237
+ * @param config - The config object to validate.
238
238
  * @throws {Error} When any required field (`issuer`, `appInteractionPath`, `appLoginUrlPart`, `appConsentUrlPart`, `jwksServiceConfig`, `jwksKeyConverterConfig`) is missing.
239
239
  */ function assertValidConfig(config) {
240
240
  if (!config.issuer) {
@@ -354,8 +354,11 @@ function _define_property$f(obj, key, value) {
354
354
  /**
355
355
  * Query for JwksKey documents with a specific status.
356
356
  *
357
- * @param status - the lifecycle status to filter by
358
- * @returns Firestore query constraints filtering by the given status
357
+ * @param status - The lifecycle status to filter by.
358
+ * @returns Firestore query constraints filtering by the given status.
359
+ *
360
+ * @dbxModelFirebaseIndex
361
+ * @dbxModelFirebaseIndexModel JwksKey
359
362
  */ function jwksKeysWithStatusQuery(status) {
360
363
  return [
361
364
  firebase.where('status', '==', status)
@@ -364,14 +367,17 @@ function _define_property$f(obj, key, value) {
364
367
  /**
365
368
  * Query for active JwksKey documents.
366
369
  *
367
- * @returns Firestore query constraints filtering for active keys
370
+ * @returns Firestore query constraints filtering for active keys.
368
371
  */ function activeJwksKeysQuery() {
369
372
  return jwksKeysWithStatusQuery('active');
370
373
  }
371
374
  /**
372
375
  * Query for non-retired JwksKey documents (active + rotated).
373
376
  *
374
- * @returns Firestore query constraints filtering for non-retired keys
377
+ * @returns Firestore query constraints filtering for non-retired keys.
378
+ *
379
+ * @dbxModelFirebaseIndex
380
+ * @dbxModelFirebaseIndexModel JwksKey
375
381
  */ function nonRetiredJwksKeysQuery() {
376
382
  return [
377
383
  firebase.where('status', 'in', [
@@ -383,7 +389,7 @@ function _define_property$f(obj, key, value) {
383
389
  /**
384
390
  * Query for rotated JwksKey documents.
385
391
  *
386
- * @returns Firestore query constraints filtering for rotated keys
392
+ * @returns Firestore query constraints filtering for rotated keys.
387
393
  */ function rotatedJwksKeysQuery() {
388
394
  return jwksKeysWithStatusQuery('rotated');
389
395
  }
@@ -696,7 +702,7 @@ exports.JwksService = /*#__PURE__*/ function() {
696
702
  * Returns both the stored {@link JwksKey} and the unencrypted private JWK
697
703
  * so callers can use the signing key immediately without a decryption round-trip.
698
704
  *
699
- * @returns the generated key pair result containing the stored JwksKey and signing key
705
+ * @returns The generated key pair result containing the stored JwksKey and signing key.
700
706
  */ function generateKeyPair() {
701
707
  return _async_to_generator$a(function() {
702
708
  var _generateKeyPairSync, publicKey, privateKey, kid, publicJwk, privateJwk, getKey, encryptedPrivateKey, data, doc;
@@ -759,7 +765,7 @@ exports.JwksService = /*#__PURE__*/ function() {
759
765
  value: /**
760
766
  * Returns the currently active signing key's private JWK.
761
767
  *
762
- * @returns the active signing key's private JWK, or undefined if no active key exists
768
+ * @returns The active signing key's private JWK, or undefined if no active key exists.
763
769
  */ function getActiveSigningKey() {
764
770
  return _async_to_generator$a(function() {
765
771
  var results, result, data, getKey;
@@ -797,7 +803,7 @@ exports.JwksService = /*#__PURE__*/ function() {
797
803
  * Returns undefined if storage is not configured or `serveJwksFromStorage` is false.
798
804
  * Returns null if an error occured while trying to setup.
799
805
  *
800
- * @returns the public URL, or null/undefined if unavailable
806
+ * @returns The public URL, or null/undefined if unavailable.
801
807
  */ function getJwksStoragePublicUrl() {
802
808
  return _async_to_generator$a(function() {
803
809
  return _ts_generator$a(this, function(_state) {
@@ -814,7 +820,7 @@ exports.JwksService = /*#__PURE__*/ function() {
814
820
  value: /**
815
821
  * Returns the public JWKS (all non-retired keys) by querying Firestore.
816
822
  *
817
- * @returns the public JWKS containing all non-retired signing keys
823
+ * @returns The public JWKS containing all non-retired signing keys.
818
824
  */ function getLatestPublicJwks() {
819
825
  return _async_to_generator$a(function() {
820
826
  var keys;
@@ -860,7 +866,7 @@ exports.JwksService = /*#__PURE__*/ function() {
860
866
  value: /**
861
867
  * Rotates keys: marks the current active key as rotated and generates a new active key.
862
868
  *
863
- * @returns the newly generated active JwksKey
869
+ * @returns The newly generated active JwksKey.
864
870
  */ function rotateKeys() {
865
871
  return _async_to_generator$a(function() {
866
872
  var now, expiresAt, _ref, newKey;
@@ -1040,7 +1046,7 @@ exports.JwksService = /*#__PURE__*/ function() {
1040
1046
  value: /**
1041
1047
  * Retires rotated keys whose expiresAt has passed.
1042
1048
  *
1043
- * @returns the number of keys retired
1049
+ * @returns The number of keys retired.
1044
1050
  */ function retireExpiredKeys() {
1045
1051
  return _async_to_generator$a(function() {
1046
1052
  var now, count;
@@ -1350,10 +1356,10 @@ function _ts_generator$9(thisArg, body) {
1350
1356
  * Returns an {@link OidcAccount} compatible with oidc-provider's `findAccount` interface,
1351
1357
  * or `undefined` if the user does not exist in Firebase Auth.
1352
1358
  *
1353
- * @returns the OIDC account for this user, or undefined if the user does not exist
1359
+ * @returns The OIDC account for this user, or undefined if the user does not exist.
1354
1360
  */ function findAccount() {
1355
1361
  return _async_to_generator$9(function() {
1356
- var authUserContext, exists, delegate;
1362
+ var authUserContext, exists, result, delegate;
1357
1363
  return _ts_generator$9(this, function(_state) {
1358
1364
  switch(_state.label){
1359
1365
  case 0:
@@ -1364,16 +1370,9 @@ function _ts_generator$9(thisArg, body) {
1364
1370
  ];
1365
1371
  case 1:
1366
1372
  exists = _state.sent();
1367
- if (!exists) {
1368
- return [
1369
- 2,
1370
- undefined
1371
- ];
1372
- }
1373
- delegate = this._service.delegate;
1374
- return [
1375
- 2,
1376
- {
1373
+ if (exists) {
1374
+ delegate = this._service.delegate;
1375
+ result = {
1377
1376
  accountId: this._uid,
1378
1377
  claims: function claims(_use, scope) {
1379
1378
  return _async_to_generator$9(function() {
@@ -1387,7 +1386,11 @@ function _ts_generator$9(thisArg, body) {
1387
1386
  });
1388
1387
  })();
1389
1388
  }
1390
- }
1389
+ };
1390
+ }
1391
+ return [
1392
+ 2,
1393
+ result
1391
1394
  ];
1392
1395
  }
1393
1396
  });
@@ -1419,7 +1422,7 @@ function _ts_generator$9(thisArg, body) {
1419
1422
  get: /**
1420
1423
  * The provider config from the delegate.
1421
1424
  *
1422
- * @returns the OIDC provider configuration from the delegate
1425
+ * @returns The OIDC provider configuration from the delegate.
1423
1426
  */ function get() {
1424
1427
  return this.delegate.providerConfig;
1425
1428
  }
@@ -1428,8 +1431,8 @@ function _ts_generator$9(thisArg, body) {
1428
1431
  /**
1429
1432
  * Creates a user context for the given user ID.
1430
1433
  *
1431
- * @param uid - the Firebase Auth user ID
1432
- * @returns a new user context bound to the given user
1434
+ * @param uid - The Firebase Auth user ID.
1435
+ * @returns A new user context bound to the given user.
1433
1436
  */ key: "userContext",
1434
1437
  value: function userContext(uid) {
1435
1438
  return new OidcAccountServiceUserContext(this, uid);
@@ -1549,8 +1552,8 @@ function _is_native_reflect_construct() {
1549
1552
  *
1550
1553
  * Requires runtime encryption config since the private key field is encrypted at rest.
1551
1554
  *
1552
- * @param config - encryption configuration for the private key field
1553
- * @returns snapshot converter functions for JwksKey documents
1555
+ * @param config - Encryption configuration for the private key field.
1556
+ * @returns Snapshot converter functions for JwksKey documents.
1554
1557
  */ function jwksKeyConverter(config) {
1555
1558
  return firebase.snapshotConverterFunctions({
1556
1559
  fields: {
@@ -1574,16 +1577,16 @@ function _is_native_reflect_construct() {
1574
1577
  /**
1575
1578
  * Returns the Firestore {@link CollectionReference} for {@link JwksKey} documents.
1576
1579
  *
1577
- * @param context - the Firestore context to create the collection reference from
1578
- * @returns the typed collection reference for JwksKey documents
1580
+ * @param context - The Firestore context to create the collection reference from.
1581
+ * @returns The typed collection reference for JwksKey documents.
1579
1582
  */ function jwksKeyCollectionReference(context) {
1580
1583
  return context.collection(jwksKeyIdentity.collectionName);
1581
1584
  }
1582
1585
  /**
1583
1586
  * Creates a {@link JwksKeyFirestoreCollection} with encrypted private key field support.
1584
1587
  *
1585
- * @param config - configuration including the Firestore context and encryption settings
1586
- * @returns the configured JwksKey Firestore collection
1588
+ * @param config - Configuration including the Firestore context and encryption settings.
1589
+ * @returns The configured JwksKey Firestore collection.
1587
1590
  */ function jwksKeyFirestoreCollection(config) {
1588
1591
  var firestoreContext = config.firestoreContext;
1589
1592
  return firestoreContext.firestoreCollection({
@@ -1741,8 +1744,8 @@ function _ts_generator$8(thisArg, body) {
1741
1744
  /**
1742
1745
  * Creates a concrete {@link OidcModelServerActions} implementation wired to the provided context.
1743
1746
  *
1744
- * @param context - the fully assembled OIDC model server actions context
1745
- * @returns the concrete OidcModelServerActions instance
1747
+ * @param context - The fully assembled OIDC model server actions context.
1748
+ * @returns The concrete OidcModelServerActions instance.
1746
1749
  *
1747
1750
  * @example
1748
1751
  * ```ts
@@ -1766,8 +1769,8 @@ function _ts_generator$8(thisArg, body) {
1766
1769
  * Delegates to {@link OidcClientService.createClient} to generate a `client_id` and `client_secret`,
1767
1770
  * create the adapter entry, and return the secret in plaintext (only returned once).
1768
1771
  *
1769
- * @param context - the OIDC model server actions context
1770
- * @returns a transform function factory for creating OIDC clients
1772
+ * @param context - The OIDC model server actions context.
1773
+ * @returns A transform function factory for creating OIDC clients.
1771
1774
  */ function createOidcClientFactory(context) {
1772
1775
  var oidcClientService = context.oidcClientService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
1773
1776
  return firebaseServerActionTransformFunctionFactory(firebase.createOidcClientParamsType, function(params) {
@@ -1795,8 +1798,8 @@ function _ts_generator$8(thisArg, body) {
1795
1798
  *
1796
1799
  * Delegates to {@link OidcClientService.updateClient} to apply plaintext field updates.
1797
1800
  *
1798
- * @param context - the OIDC model server actions context
1799
- * @returns a transform function factory for updating OIDC clients
1801
+ * @param context - The OIDC model server actions context.
1802
+ * @returns A transform function factory for updating OIDC clients.
1800
1803
  */ function updateOidcClientFactory(context) {
1801
1804
  var oidcClientService = context.oidcClientService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
1802
1805
  return firebaseServerActionTransformFunctionFactory(firebase.updateOidcClientParamsType, function(params) {
@@ -1834,8 +1837,8 @@ function _ts_generator$8(thisArg, body) {
1834
1837
  * Delegates to {@link OidcClientService.rotateClientSecret} to generate a new secret
1835
1838
  * and return it in plaintext (only returned once).
1836
1839
  *
1837
- * @param context - the OIDC model server actions context
1838
- * @returns a transform function factory for rotating OIDC client secrets
1840
+ * @param context - The OIDC model server actions context.
1841
+ * @returns A transform function factory for rotating OIDC client secrets.
1839
1842
  */ function rotateOidcClientSecretFactory(context) {
1840
1843
  var oidcClientService = context.oidcClientService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
1841
1844
  return firebaseServerActionTransformFunctionFactory(firebase.rotateOidcClientSecretParamsType, function(_params) {
@@ -1863,8 +1866,8 @@ function _ts_generator$8(thisArg, body) {
1863
1866
  *
1864
1867
  * Delegates to {@link OidcClientService.deleteClient}.
1865
1868
  *
1866
- * @param context - the OIDC model server actions context
1867
- * @returns a transform function factory for deleting OIDC clients
1869
+ * @param context - The OIDC model server actions context.
1870
+ * @returns A transform function factory for deleting OIDC clients.
1868
1871
  */ function deleteOidcClientFactory(context) {
1869
1872
  var oidcClientService = context.oidcClientService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
1870
1873
  return firebaseServerActionTransformFunctionFactory(firebase.deleteOidcClientParamsType, function(_params) {
@@ -1906,8 +1909,8 @@ function _ts_generator$8(thisArg, body) {
1906
1909
  * Per-user authorization (this user owns this Grant) is enforced upstream via the
1907
1910
  * model permission service before this action runs.
1908
1911
  *
1909
- * @param context - the OIDC model server actions context
1910
- * @returns a transform function factory for revoking OIDC grants
1912
+ * @param context - The OIDC model server actions context.
1913
+ * @returns A transform function factory for revoking OIDC grants.
1911
1914
  */ function deleteOidcTokenFactory(context) {
1912
1915
  var oidcService = context.oidcService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
1913
1916
  return firebaseServerActionTransformFunctionFactory(firebase.deleteOidcTokenParamsType, function(_params) {
@@ -2264,7 +2267,7 @@ function _ts_generator$7(thisArg, body) {
2264
2267
  *
2265
2268
  * @param clientId - The client's document/adapter entry ID.
2266
2269
  * @param params - The fields to update.
2267
- * @throws When the client is not found.
2270
+ * @throws {Error} When the client is not found.
2268
2271
  */ function updateClient(clientId, params) {
2269
2272
  return _async_to_generator$7(function() {
2270
2273
  var provider, ProviderClient, existing, updatedMetadata, _params_logo_uri, _params_client_uri, _params_dbx_max_session_ttl, client;
@@ -2331,7 +2334,7 @@ function _ts_generator$7(thisArg, body) {
2331
2334
  *
2332
2335
  * @param clientId - The client's document/adapter entry ID.
2333
2336
  * @returns The client ID and new secret (plaintext, returned only once).
2334
- * @throws When the client is not found.
2337
+ * @throws {Error} When the client is not found.
2335
2338
  */ function rotateClientSecret(clientId) {
2336
2339
  return _async_to_generator$7(function() {
2337
2340
  var provider, ProviderClient, existing, newSecret, updatedMetadata, client;
@@ -2390,7 +2393,7 @@ function _ts_generator$7(thisArg, body) {
2390
2393
  * Deletes an OIDC client through the oidc-provider adapter.
2391
2394
  *
2392
2395
  * @param clientId - The client's document/adapter entry ID.
2393
- * @throws When the client is not found.
2396
+ * @throws {Error} When the client is not found.
2394
2397
  */ function deleteClient(clientId) {
2395
2398
  return _async_to_generator$7(function() {
2396
2399
  var provider, ProviderClient, existing;
@@ -2483,9 +2486,9 @@ function _object_spread_props$1(target, source) {
2483
2486
  /**
2484
2487
  * Factory that creates an {@link OidcModelServerActions} instance from the injected services.
2485
2488
  *
2486
- * @param oidcClientService - the OIDC client service for client CRUD actions
2487
- * @param oidcService - the core OIDC service for grant revocation
2488
- * @returns the configured OidcModelServerActions instance
2489
+ * @param oidcClientService - The OIDC client service for client CRUD actions.
2490
+ * @param oidcService - The core OIDC service for grant revocation.
2491
+ * @returns The configured OidcModelServerActions instance.
2489
2492
  */ function oidcModelServerActionsFactory(oidcClientService, oidcService) {
2490
2493
  var context = _object_spread_props$1(_object_spread$4({}, firebaseServer.firebaseServerActionsContext()), {
2491
2494
  oidcClientService: oidcClientService,
@@ -2499,8 +2502,8 @@ function _object_spread_props$1(target, source) {
2499
2502
  * By default this module exports:
2500
2503
  * - OidcModelServerActions
2501
2504
  *
2502
- * @param config - the configuration specifying the OIDC module dependency
2503
- * @returns the NestJS module metadata for the OidcModel module
2505
+ * @param config - The configuration specifying the OIDC module dependency.
2506
+ * @returns The NestJS module metadata for the OidcModel module.
2504
2507
  */ function appOidcModelModuleMetadata(config) {
2505
2508
  var oidcModule = config.oidcModule;
2506
2509
  return {
@@ -2723,15 +2726,15 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
2723
2726
  * Sensitive payload fields (`client_secret`, `registration_access_token`) are selectively
2724
2727
  * encrypted via the {@link OidcEncryptionService}.
2725
2728
  *
2729
+ * @param collections - Firestore collection access for adapter entries.
2730
+ * @param encryptionService - Encryption service for sensitive payload fields.
2731
+ * @returns An oidc-provider adapter constructor backed by Firestore.
2732
+ *
2726
2733
  * @example
2727
2734
  * ```ts
2728
2735
  * const adapter = createAdapterFactory(collections, encryptionService);
2729
2736
  * new Provider('issuer', { adapter });
2730
2737
  * ```
2731
- *
2732
- * @param collections - Firestore collection access for adapter entries.
2733
- * @param encryptionService - Encryption service for sensitive payload fields.
2734
- * @returns an oidc-provider adapter constructor backed by Firestore
2735
2738
  */ function createAdapterFactory(collections, encryptionService) {
2736
2739
  var FirestoreAdapter = /*#__PURE__*/ function() {
2737
2740
  function FirestoreAdapter(name) {
@@ -2988,8 +2991,8 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
2988
2991
  * Converts a Firestore document into an oidc-provider payload,
2989
2992
  * returning `undefined` if the entry has expired.
2990
2993
  *
2991
- * @param data - the Firestore document data to convert
2992
- * @returns the decrypted adapter payload, or undefined if the entry has expired
2994
+ * @param data - The Firestore document data to convert.
2995
+ * @returns The decrypted adapter payload, or undefined if the entry has expired.
2993
2996
  */ key: "_toPayload",
2994
2997
  value: function _toPayload(data) {
2995
2998
  var expiresDate;
@@ -3097,8 +3100,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
3097
3100
  * Encrypts sensitive fields in an adapter payload and returns it as a {@link JsonSerializableObject}
3098
3101
  * suitable for storing directly in Firestore.
3099
3102
  *
3100
- * @param payload - the adapter payload to encrypt
3101
- * @returns the encrypted payload as a JSON-serializable object
3103
+ * @param payload - The adapter payload to encrypt.
3104
+ * @returns The encrypted payload as a JSON-serializable object.
3102
3105
  */ key: "encryptAdapterPayload",
3103
3106
  value: function encryptAdapterPayload(payload) {
3104
3107
  var filtered = util.filterUndefinedValues(payload);
@@ -3109,8 +3112,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
3109
3112
  /**
3110
3113
  * Decrypts sensitive fields in a Firestore-stored payload object back to an {@link AdapterPayload}.
3111
3114
  *
3112
- * @param payload - the encrypted Firestore-stored payload
3113
- * @returns the decrypted adapter payload
3115
+ * @param payload - The encrypted Firestore-stored payload.
3116
+ * @returns The decrypted adapter payload.
3114
3117
  */ key: "decryptAdapterPayload",
3115
3118
  value: function decryptAdapterPayload(payload) {
3116
3119
  return this.adapterPayloadEncryptor.decrypt(payload);
@@ -3274,7 +3277,7 @@ var DEFAULT_OIDC_CODE_CHALLENGE_METHODS = [
3274
3277
  *
3275
3278
  * @param jwksUri - Optional override for the JWKS URI (e.g., from cloud storage).
3276
3279
  * Falls back to `{issuer}{routes.jwks}`.
3277
- * @returns the fully constructed OIDC discovery metadata
3280
+ * @returns The fully constructed OIDC discovery metadata.
3278
3281
  */ key: "buildDiscoveryMetadata",
3279
3282
  value: function buildDiscoveryMetadata(jwksUri) {
3280
3283
  var issuer = this.config.issuer;
@@ -3594,7 +3597,7 @@ function _ts_generator$5(thisArg, body) {
3594
3597
  /**
3595
3598
  * Returns the oidc-provider instance, initializing it on first access.
3596
3599
  *
3597
- * @returns the lazily-initialized oidc-provider instance
3600
+ * @returns The lazily-initialized oidc-provider instance.
3598
3601
  */ key: "getProvider",
3599
3602
  value: function getProvider() {
3600
3603
  return this._getProvider();
@@ -3643,7 +3646,7 @@ function _ts_generator$5(thisArg, body) {
3643
3646
  * @returns The auth context, or `undefined` if the token is invalid or expired.
3644
3647
  */ function verifyAccessToken(rawToken) {
3645
3648
  return _async_to_generator$5(function() {
3646
- var _accessToken_extra, _accessToken_exp, provider, accessToken, accountClaims, token;
3649
+ var provider, accessToken, result, _accessToken_extra, _accessToken_exp, accountClaims, token;
3647
3650
  return _ts_generator$5(this, function(_state) {
3648
3651
  switch(_state.label){
3649
3652
  case 0:
@@ -3659,39 +3662,32 @@ function _ts_generator$5(thisArg, body) {
3659
3662
  ];
3660
3663
  case 2:
3661
3664
  accessToken = _state.sent();
3662
- if (!accessToken) {
3663
- return [
3664
- 2,
3665
- undefined
3666
- ];
3667
- }
3668
- // Extract account claims baked into the access token at issuance time.
3669
- // These are the claims built by OidcAccountServiceDelegate.buildClaimsForUser()
3670
- // (e.g., `a` for admin, `o` for onboarded) based on the granted scopes.
3671
- // Read the account claims baked into the token at issuance time via extraAccessTokenClaims.
3672
- accountClaims = (_accessToken_extra = accessToken.extra) !== null && _accessToken_extra !== void 0 ? _accessToken_extra : {};
3673
- token = _object_spread_props(_object_spread$2({}, accountClaims), {
3674
- // Standard JWT claims — sourced from the access token
3675
- aud: util.firstValue(accessToken.aud),
3676
- iss: this.config.issuer,
3677
- sub: accessToken.accountId,
3678
- iat: accessToken.iat,
3679
- exp: (_accessToken_exp = accessToken.exp) !== null && _accessToken_exp !== void 0 ? _accessToken_exp : util.unixDateTimeSecondsNumberForNow() + accessToken.expiration,
3680
- auth_time: accessToken.iat,
3681
- // Firebase UID (copied from sub)
3682
- uid: accessToken.accountId,
3683
- // OIDC-specific claims carried on the token
3684
- scope: accessToken.scope,
3685
- client_id: accessToken.clientId,
3686
- // Firebase sign-in info — marked as OIDC provider
3687
- firebase: {
3688
- identities: {},
3689
- sign_in_provider: 'dbx_oidc'
3690
- }
3691
- });
3692
- return [
3693
- 2,
3694
- {
3665
+ if (accessToken) {
3666
+ // Extract account claims baked into the access token at issuance time.
3667
+ // These are the claims built by OidcAccountServiceDelegate.buildClaimsForUser()
3668
+ // (e.g., `a` for admin, `o` for onboarded) based on the granted scopes.
3669
+ // Read the account claims baked into the token at issuance time via extraAccessTokenClaims.
3670
+ accountClaims = (_accessToken_extra = accessToken.extra) !== null && _accessToken_extra !== void 0 ? _accessToken_extra : {};
3671
+ token = _object_spread_props(_object_spread$2({}, accountClaims), {
3672
+ // Standard JWT claims — sourced from the access token
3673
+ aud: util.firstValue(accessToken.aud),
3674
+ iss: this.config.issuer,
3675
+ sub: accessToken.accountId,
3676
+ iat: accessToken.iat,
3677
+ exp: (_accessToken_exp = accessToken.exp) !== null && _accessToken_exp !== void 0 ? _accessToken_exp : util.unixDateTimeSecondsNumberForNow() + accessToken.expiration,
3678
+ auth_time: accessToken.iat,
3679
+ // Firebase UID (copied from sub)
3680
+ uid: accessToken.accountId,
3681
+ // OIDC-specific claims carried on the token
3682
+ scope: accessToken.scope,
3683
+ client_id: accessToken.clientId,
3684
+ // Firebase sign-in info — marked as OIDC provider
3685
+ firebase: {
3686
+ identities: {},
3687
+ sign_in_provider: 'dbx_oidc'
3688
+ }
3689
+ });
3690
+ result = {
3695
3691
  uid: accessToken.accountId,
3696
3692
  token: token,
3697
3693
  rawToken: rawToken,
@@ -3700,7 +3696,11 @@ function _ts_generator$5(thisArg, body) {
3700
3696
  scope: accessToken.scope,
3701
3697
  client_id: accessToken.clientId
3702
3698
  }, accountClaims)
3703
- }
3699
+ };
3700
+ }
3701
+ return [
3702
+ 2,
3703
+ result
3704
3704
  ];
3705
3705
  }
3706
3706
  });
@@ -3720,8 +3720,8 @@ function _ts_generator$5(thisArg, body) {
3720
3720
  * referencing the grant is gone — `verifyAccessToken` returns `undefined`
3721
3721
  * and a `grant_type=refresh_token` exchange fails with `invalid_grant`.
3722
3722
  *
3723
- * @param grantId - the grant id (and Grant adapter entry id) to revoke
3724
- * @throws when the Grant entry does not exist
3723
+ * @param grantId - The grant id (and Grant adapter entry id) to revoke.
3724
+ * @throws {Error} When the Grant entry does not exist.
3725
3725
  */ function revokeGrant(grantId) {
3726
3726
  return _async_to_generator$5(function() {
3727
3727
  var provider, ProviderGrant, existing;
@@ -3825,8 +3825,8 @@ function _ts_generator$5(thisArg, body) {
3825
3825
  * Does NOT include `adapter`, `findAccount`, or `jwks` — those require async
3826
3826
  * setup and are handled by {@link OidcService}.
3827
3827
  *
3828
- * @param cookieKeys - the signing keys for oidc-provider session cookies
3829
- * @returns the oidc-provider configuration options
3828
+ * @param cookieKeys - The signing keys for oidc-provider session cookies.
3829
+ * @returns The oidc-provider configuration options.
3830
3830
  */ key: "buildProviderConfiguration",
3831
3831
  value: function buildProviderConfiguration(cookieKeys) {
3832
3832
  var _this = this;
@@ -3873,17 +3873,13 @@ function _ts_generator$5(thisArg, body) {
3873
3873
  DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA
3874
3874
  ],
3875
3875
  validator: function validator(_ctx, key, value) {
3876
- if (key !== DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA) {
3877
- return;
3878
- }
3879
- if (value === undefined || value === null) {
3880
- return;
3881
- }
3882
- if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0) {
3883
- throw new oidcProvider.errors.InvalidClientMetadata("".concat(DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA, " must be a positive integer (seconds)."));
3884
- }
3885
- if (value > serverMaxSeconds) {
3886
- throw new oidcProvider.errors.InvalidClientMetadata("".concat(DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA, " cannot exceed the server max of ").concat(serverMaxSeconds, " seconds."));
3876
+ if (key === DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA && value !== undefined && value !== null) {
3877
+ if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0) {
3878
+ throw new oidcProvider.errors.InvalidClientMetadata("".concat(DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA, " must be a positive integer (seconds)."));
3879
+ }
3880
+ if (value > serverMaxSeconds) {
3881
+ throw new oidcProvider.errors.InvalidClientMetadata("".concat(DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA, " cannot exceed the server max of ").concat(serverMaxSeconds, " seconds."));
3882
+ }
3887
3883
  }
3888
3884
  }
3889
3885
  },
@@ -3972,12 +3968,13 @@ function _ts_generator$5(thisArg, body) {
3972
3968
  // available via `accessToken.extra` during verification without an extra DB call.
3973
3969
  extraTokenClaims: function extraTokenClaims(_ctx, token) {
3974
3970
  return _async_to_generator$5(function() {
3975
- var accountId, scope, account, claims, extraClaims;
3971
+ var accountId, scope, result, account, claims, extraClaims;
3976
3972
  return _ts_generator$5(this, function(_state) {
3977
3973
  switch(_state.label){
3978
3974
  case 0:
3979
3975
  accountId = token.accountId;
3980
3976
  scope = token.scope;
3977
+ result = {};
3981
3978
  if (!(accountId && scope)) return [
3982
3979
  3,
3983
3980
  3
@@ -4002,14 +3999,12 @@ function _ts_generator$5(thisArg, body) {
4002
3999
  "sub"
4003
4000
  ]);
4004
4001
  // Filter out undefined values — the Firestore adapter cannot serialize them.
4005
- return [
4006
- 2,
4007
- util.filterUndefinedValues(extraClaims)
4008
- ];
4002
+ result = util.filterUndefinedValues(extraClaims);
4003
+ _state.label = 3;
4009
4004
  case 3:
4010
4005
  return [
4011
4006
  2,
4012
- {}
4007
+ result
4013
4008
  ];
4014
4009
  }
4015
4010
  });
@@ -4422,35 +4417,36 @@ var _logger = new common.Logger('applyOidcAuthMiddleware');
4422
4417
  var isProtected = protectedPaths.some(function(prefix) {
4423
4418
  return req.path.startsWith(prefix);
4424
4419
  });
4425
- if (!isProtected) {
4426
- return next();
4427
- }
4428
- var authHeader = req.headers.authorization;
4429
- if (!(authHeader === null || authHeader === void 0 ? void 0 : authHeader.startsWith('Bearer '))) {
4430
- res.status(401).json({
4431
- statusCode: 401,
4432
- message: 'Missing or invalid Authorization header'
4433
- });
4434
- return;
4435
- }
4436
- var token = authHeader.slice(7);
4437
- oidcService.verifyAccessToken(token).then(function(oauthAuth) {
4438
- if (!oauthAuth) {
4420
+ if (isProtected) {
4421
+ var authHeader = req.headers.authorization;
4422
+ if (authHeader === null || authHeader === void 0 ? void 0 : authHeader.startsWith('Bearer ')) {
4423
+ var token = authHeader.slice(7);
4424
+ oidcService.verifyAccessToken(token).then(function(oauthAuth) {
4425
+ if (oauthAuth) {
4426
+ req.auth = oauthAuth;
4427
+ next();
4428
+ } else {
4429
+ res.status(401).json({
4430
+ statusCode: 401,
4431
+ message: 'Invalid or expired access token'
4432
+ });
4433
+ }
4434
+ }).catch(function(err) {
4435
+ logger.error('Bearer token verification failed', err);
4436
+ res.status(401).json({
4437
+ statusCode: 401,
4438
+ message: 'Token verification failed'
4439
+ });
4440
+ });
4441
+ } else {
4439
4442
  res.status(401).json({
4440
4443
  statusCode: 401,
4441
- message: 'Invalid or expired access token'
4444
+ message: 'Missing or invalid Authorization header'
4442
4445
  });
4443
- return;
4444
4446
  }
4445
- req.auth = oauthAuth;
4447
+ } else {
4446
4448
  next();
4447
- }).catch(function(err) {
4448
- logger.error('Bearer token verification failed', err);
4449
- res.status(401).json({
4450
- statusCode: 401,
4451
- message: 'Token verification failed'
4452
- });
4453
- });
4449
+ }
4454
4450
  });
4455
4451
  _logger.debug("Applied OAuth bearer token middleware for paths: ".concat(protectedPaths.join(', ')));
4456
4452
  }
@@ -4476,7 +4472,7 @@ var _logger = new common.Logger('applyOidcAuthMiddleware');
4476
4472
  * `/interaction/{uid}/*` POSTs carry the Firebase ID token in the JSON body, not in cookies, so
4477
4473
  * we keep the CORS surface minimal.
4478
4474
  *
4479
- * @param nestApp - the NestJS application to configure.
4475
+ * @param nestApp - The NestJS application to configure.
4480
4476
  *
4481
4477
  * @example
4482
4478
  * ```ts
@@ -4724,9 +4720,9 @@ function _ts_generator$3(thisArg, body) {
4724
4720
  *
4725
4721
  * Requires the oidc-provider interaction cookie to be present on the request.
4726
4722
  *
4727
- * @param req - the Express request containing the interaction cookie
4728
- * @param res - the Express response
4729
- * @returns the oidc-provider interaction details
4723
+ * @param req - The Express request containing the interaction cookie.
4724
+ * @param res - The Express response.
4725
+ * @returns The oidc-provider interaction details.
4730
4726
  */ function getInteractionDetails(req, res) {
4731
4727
  return _async_to_generator$3(function() {
4732
4728
  var provider;
@@ -4757,8 +4753,8 @@ function _ts_generator$3(thisArg, body) {
4757
4753
  * This is necessary when the interaction cookie is scoped to a different path
4758
4754
  * (e.g., the frontend) and is not sent with backend API requests.
4759
4755
  *
4760
- * @param uid - the interaction UID to look up
4761
- * @returns the interaction details for the given UID
4756
+ * @param uid - The interaction UID to look up.
4757
+ * @returns The interaction details for the given UID.
4762
4758
  * @throws {Error} When the interaction is not found or has expired.
4763
4759
  */ function findInteractionByUid(uid) {
4764
4760
  return _async_to_generator$3(function() {
@@ -4798,10 +4794,10 @@ function _ts_generator$3(thisArg, body) {
4798
4794
  * Looks up the interaction directly by UID, applies the result, saves it,
4799
4795
  * and returns the `returnTo` URL for the client to redirect to.
4800
4796
  *
4801
- * @param uid - the interaction UID to complete
4802
- * @param result - the interaction results to apply
4803
- * @param options - optional settings for merging with the last submission
4804
- * @param options.mergeWithLastSubmission - whether to merge with the last submission (defaults to true)
4797
+ * @param uid - The interaction UID to complete.
4798
+ * @param result - The interaction results to apply.
4799
+ * @param options - Optional settings for merging with the last submission.
4800
+ * @param options.mergeWithLastSubmission - Whether to merge with the last submission (defaults to true)
4805
4801
  * @returns The `returnTo` URL that the client should redirect to.
4806
4802
  */ function finishInteractionByUid(uid, result, options) {
4807
4803
  return _async_to_generator$3(function() {
@@ -4846,11 +4842,11 @@ function _ts_generator$3(thisArg, body) {
4846
4842
  * `dbx_session_ttl` request param when save is driven from a NestJS controller — see
4847
4843
  * {@link OidcService#resolveLoginDurationForGrant}).
4848
4844
  *
4849
- * @param grantId - the existing grant ID to look up, or undefined to create a new grant
4850
- * @param accountId - the account ID for creating a new grant
4851
- * @param clientId - the client ID for creating a new grant
4852
- * @param expiresInSeconds - optional TTL (seconds) to assign to a newly-created grant
4853
- * @returns the found or newly created grant
4845
+ * @param grantId - The existing grant ID to look up, or undefined to create a new grant.
4846
+ * @param accountId - The account ID for creating a new grant.
4847
+ * @param clientId - The client ID for creating a new grant.
4848
+ * @param expiresInSeconds - Optional TTL (seconds) to assign to a newly-created grant.
4849
+ * @returns The found or newly created grant.
4854
4850
  */ // eslint-disable-next-line @typescript-eslint/max-params -- positional args mirror the existing call sites
4855
4851
  function findOrCreateGrant(grantId, accountId, clientId, expiresInSeconds) {
4856
4852
  return _async_to_generator$3(function() {
@@ -5158,18 +5154,18 @@ function _ts_generator$2(thisArg, body) {
5158
5154
  {
5159
5155
  key: "getInteraction",
5160
5156
  value: /**
5161
- * GET /interaction/:uid
5157
+ * GET /interaction/:uid.
5162
5158
  *
5163
5159
  * Detects the interaction type and redirects to the appropriate frontend page.
5164
5160
  *
5165
- * @param uid - the interaction UID from the URL path
5166
- * @param req - the incoming Express request
5167
- * @param res - the Express response used for redirecting
5168
- * @returns a redirect response to the appropriate frontend page
5169
- * @throws {HttpException} 404 when the interaction UID is not found or has expired.
5161
+ * @param uid - The interaction UID from the URL path.
5162
+ * @param req - The incoming Express request.
5163
+ * @param res - The Express response used for redirecting.
5164
+ * @returns A redirect response to the appropriate frontend page.
5165
+ * @throws {HttpException} HTTP 404 when the interaction UID is not found or has expired.
5170
5166
  */ function getInteraction(uid, req, res) {
5171
5167
  return _async_to_generator$2(function() {
5172
- var interaction, prompt;
5168
+ var interaction, prompt, redirectUrl;
5173
5169
  return _ts_generator$2(this, function(_state) {
5174
5170
  switch(_state.label){
5175
5171
  case 0:
@@ -5186,15 +5182,10 @@ function _ts_generator$2(thisArg, body) {
5186
5182
  case 1:
5187
5183
  interaction = _state.sent();
5188
5184
  prompt = interaction.prompt;
5189
- if (prompt.name === 'login') {
5190
- return [
5191
- 2,
5192
- res.redirect("".concat(this.oidcProviderConfigService.appLoginUrl, "?uid=").concat(uid))
5193
- ];
5194
- }
5185
+ redirectUrl = prompt.name === 'login' ? "".concat(this.oidcProviderConfigService.appLoginUrl, "?uid=").concat(uid) : "".concat(this.oidcProviderConfigService.appConsentUrl, "?uid=").concat(uid);
5195
5186
  return [
5196
5187
  2,
5197
- res.redirect("".concat(this.oidcProviderConfigService.appConsentUrl, "?uid=").concat(uid))
5188
+ res.redirect(redirectUrl)
5198
5189
  ];
5199
5190
  case 2:
5200
5191
  _state.sent();
@@ -5211,16 +5202,16 @@ function _ts_generator$2(thisArg, body) {
5211
5202
  {
5212
5203
  key: "postLogin",
5213
5204
  value: /**
5214
- * POST /interaction/:uid/login
5205
+ * POST /interaction/:uid/login.
5215
5206
  *
5216
5207
  * Verifies the Firebase Auth ID token sent by the frontend, extracts the
5217
5208
  * user's UID, and completes the oidc-provider login interaction.
5218
5209
  *
5219
- * @param uid - the interaction UID from the URL path
5220
- * @param body - the login request containing the Firebase ID token
5221
- * @param res - the Express response used for sending JSON
5222
- * @throws {HttpException} 401 when the Firebase ID token is invalid.
5223
- * @throws {HttpException} 400 when the login interaction cannot be completed.
5210
+ * @param uid - The interaction UID from the URL path.
5211
+ * @param body - The login request containing the Firebase ID token.
5212
+ * @param res - The Express response used for sending JSON.
5213
+ * @throws {HttpException} HTTP 401 when the Firebase ID token is invalid.
5214
+ * @throws {HttpException} HTTP 400 when the login interaction cannot be completed.
5224
5215
  */ function postLogin(uid, body, res) {
5225
5216
  return _async_to_generator$2(function() {
5226
5217
  var accountId, redirectTo;
@@ -5275,15 +5266,15 @@ function _ts_generator$2(thisArg, body) {
5275
5266
  {
5276
5267
  key: "postConsent",
5277
5268
  value: /**
5278
- * POST /interaction/:uid/consent
5269
+ * POST /interaction/:uid/consent.
5279
5270
  *
5280
5271
  * Receives consent decision from frontend. Grants missing OIDC scopes and claims
5281
5272
  * when approved, or returns `access_denied` when rejected.
5282
5273
  *
5283
- * @param uid - the interaction UID from the URL path
5284
- * @param body - the consent request containing approval decision and Firebase ID token
5285
- * @param res - the Express response used for sending JSON
5286
- * @throws {HttpException} 400 when the consent interaction cannot be completed.
5274
+ * @param uid - The interaction UID from the URL path.
5275
+ * @param body - The consent request containing approval decision and Firebase ID token.
5276
+ * @param res - The Express response used for sending JSON.
5277
+ * @throws {HttpException} HTTP 400 when the consent interaction cannot be completed.
5287
5278
  */ function postConsent(uid, body, res) {
5288
5279
  return _async_to_generator$2(function() {
5289
5280
  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;
@@ -5364,7 +5355,12 @@ function _ts_generator$2(thisArg, body) {
5364
5355
  encounteredOIDCScopes = grant.getOIDCScopeEncountered().split(' ').filter(Boolean);
5365
5356
  missingOIDCScope = (_prompt_details_missingOIDCScope = prompt.details.missingOIDCScope) !== null && _prompt_details_missingOIDCScope !== void 0 ? _prompt_details_missingOIDCScope : [];
5366
5357
  if (missingOIDCScope.length > 0) {
5367
- _resolveEffectiveSubset = resolveEffectiveSubset(missingOIDCScope, body.grantedOIDCScopes, ALWAYS_GRANTED_OIDC_SCOPES, encounteredOIDCScopes), granted = _resolveEffectiveSubset.granted, rejected = _resolveEffectiveSubset.rejected;
5358
+ _resolveEffectiveSubset = resolveEffectiveSubset({
5359
+ missing: missingOIDCScope,
5360
+ requestedSubset: body.grantedOIDCScopes,
5361
+ alwaysGranted: ALWAYS_GRANTED_OIDC_SCOPES,
5362
+ alreadyEncountered: encounteredOIDCScopes
5363
+ }), granted = _resolveEffectiveSubset.granted, rejected = _resolveEffectiveSubset.rejected;
5368
5364
  if (granted.length > 0) {
5369
5365
  grant.addOIDCScope(granted.join(' '));
5370
5366
  }
@@ -5392,7 +5388,11 @@ function _ts_generator$2(thisArg, body) {
5392
5388
  encounteredOIDCClaims = grant.getOIDCClaimsEncountered();
5393
5389
  missingOIDCClaims = (_prompt_details_missingOIDCClaims = prompt.details.missingOIDCClaims) !== null && _prompt_details_missingOIDCClaims !== void 0 ? _prompt_details_missingOIDCClaims : [];
5394
5390
  if (missingOIDCClaims.length > 0) {
5395
- _resolveEffectiveSubset1 = resolveEffectiveSubset(missingOIDCClaims, body.grantedOIDCClaims, [], encounteredOIDCClaims), granted1 = _resolveEffectiveSubset1.granted, rejected1 = _resolveEffectiveSubset1.rejected;
5391
+ _resolveEffectiveSubset1 = resolveEffectiveSubset({
5392
+ missing: missingOIDCClaims,
5393
+ requestedSubset: body.grantedOIDCClaims,
5394
+ alreadyEncountered: encounteredOIDCClaims
5395
+ }), granted1 = _resolveEffectiveSubset1.granted, rejected1 = _resolveEffectiveSubset1.rejected;
5396
5396
  if (granted1.length > 0) {
5397
5397
  grant.addOIDCClaims(granted1);
5398
5398
  }
@@ -5408,7 +5408,11 @@ function _ts_generator$2(thisArg, body) {
5408
5408
  ;
5409
5409
  requestedSubset = (_body_grantedResourceScopes = body.grantedResourceScopes) === null || _body_grantedResourceScopes === void 0 ? void 0 : _body_grantedResourceScopes[indicator];
5410
5410
  encounteredResourceScopes = grant.getResourceScopeEncountered(indicator).split(' ').filter(Boolean);
5411
- _resolveEffectiveSubset2 = resolveEffectiveSubset(scopes, requestedSubset, [], encounteredResourceScopes), granted2 = _resolveEffectiveSubset2.granted, rejected2 = _resolveEffectiveSubset2.rejected;
5411
+ _resolveEffectiveSubset2 = resolveEffectiveSubset({
5412
+ missing: scopes,
5413
+ requestedSubset: requestedSubset,
5414
+ alreadyEncountered: encounteredResourceScopes
5415
+ }), granted2 = _resolveEffectiveSubset2.granted, rejected2 = _resolveEffectiveSubset2.rejected;
5412
5416
  if (granted2.length > 0) {
5413
5417
  grant.addResourceScope(indicator, granted2.join(' '));
5414
5418
  }
@@ -5493,9 +5497,9 @@ function _ts_generator$2(thisArg, body) {
5493
5497
  /**
5494
5498
  * Verifies a Firebase Auth ID token and returns the user's UID.
5495
5499
  *
5496
- * @param idToken - the Firebase Auth ID token to verify
5497
- * @returns the user's UID extracted from the decoded token
5498
- * @throws {HttpException} 401 when the token is invalid or expired.
5500
+ * @param idToken - The Firebase Auth ID token to verify.
5501
+ * @returns The user's UID extracted from the decoded token.
5502
+ * @throws {HttpException} HTTP 401 when the token is invalid or expired.
5499
5503
  */ function _verifyIdToken(idToken) {
5500
5504
  return _async_to_generator$2(function() {
5501
5505
  var decodedToken;
@@ -5576,13 +5580,11 @@ exports.OidcInteractionController = __decorate([
5576
5580
  * are not re-applied to the grant (no-op).
5577
5581
  * - Always-granted entries are union'd into `granted` (clamped to `missing`).
5578
5582
  *
5579
- * @param missing - Entries the OIDC prompt indicated were missing for this consent.
5580
- * @param requestedSubset - Optional subset the caller wants to grant; each value must be in `missing` or `alreadyEncountered`.
5581
- * @param alwaysGranted - Entries that must be granted whenever they appear in `missing`, regardless of `requestedSubset`.
5582
- * @param alreadyEncountered - Entries the existing Grant has previously granted or rejected. Tolerated as no-ops on re-consent.
5583
+ * @param input - Missing entries plus optional subset, always-granted, and already-encountered lists.
5583
5584
  * @returns `granted` to add to the grant and `rejected` to record on the grant.
5584
- */ function resolveEffectiveSubset(missing, requestedSubset) {
5585
- var alwaysGranted = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [], alreadyEncountered = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
5585
+ * @throws {HttpException} `400 BAD_REQUEST` when `requestedSubset` includes a value that is neither missing nor already-encountered.
5586
+ */ function resolveEffectiveSubset(input) {
5587
+ var missing = input.missing, requestedSubset = input.requestedSubset, _input_alwaysGranted = input.alwaysGranted, alwaysGranted = _input_alwaysGranted === void 0 ? [] : _input_alwaysGranted, _input_alreadyEncountered = input.alreadyEncountered, alreadyEncountered = _input_alreadyEncountered === void 0 ? [] : _input_alreadyEncountered;
5586
5588
  var missingSet = new Set(missing);
5587
5589
  var encounteredSet = new Set(alreadyEncountered);
5588
5590
  var baseSelection;
@@ -5853,7 +5855,7 @@ function _ts_generator$1(thisArg, body) {
5853
5855
  _create_class$1(OidcProviderController, [
5854
5856
  {
5855
5857
  /**
5856
- * GET /oidc/login/client
5858
+ * GET /oidc/login/client.
5857
5859
  *
5858
5860
  * Convenience redirect from the API issuer path back to the frontend app's
5859
5861
  * OAuth login page. Lets a user who lands on the API host get bounced to the
@@ -5925,16 +5927,20 @@ exports.OidcProviderController = __decorate([
5925
5927
  * @returns The base URL with the original URL's query string appended using the appropriate `?`/`&` separator.
5926
5928
  */ function mergeQueryParamsFromOriginalUrl(input) {
5927
5929
  var queryIndex = input.originalUrl.indexOf('?');
5930
+ var result;
5928
5931
  if (queryIndex < 0) {
5929
- return input.baseUrl;
5930
- }
5931
- var incomingSearch = input.originalUrl.slice(queryIndex + 1);
5932
- if (incomingSearch.length === 0) {
5933
- return input.baseUrl;
5932
+ result = input.baseUrl;
5933
+ } else {
5934
+ var incomingSearch = input.originalUrl.slice(queryIndex + 1);
5935
+ if (incomingSearch.length === 0) {
5936
+ result = input.baseUrl;
5937
+ } else {
5938
+ var baseQueryIndex = input.baseUrl.indexOf('?');
5939
+ var separator = baseQueryIndex < 0 ? '?' : '&';
5940
+ result = "".concat(input.baseUrl).concat(separator).concat(incomingSearch);
5941
+ }
5934
5942
  }
5935
- var baseQueryIndex = input.baseUrl.indexOf('?');
5936
- var separator = baseQueryIndex < 0 ? '?' : '&';
5937
- return "".concat(input.baseUrl).concat(separator).concat(incomingSearch);
5943
+ return result;
5938
5944
  }
5939
5945
 
5940
5946
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -6118,7 +6124,7 @@ function _ts_generator(thisArg, body) {
6118
6124
  * Returns the provider metadata so clients can auto-discover endpoints,
6119
6125
  * supported scopes, signing algorithms, etc.
6120
6126
  *
6121
- * @returns the OIDC discovery metadata document
6127
+ * @returns The OIDC discovery metadata document.
6122
6128
  */ function getOpenIdConfiguration() {
6123
6129
  return _async_to_generator(function() {
6124
6130
  var _ref, jwksUri;
@@ -6147,7 +6153,7 @@ function _ts_generator(thisArg, body) {
6147
6153
  *
6148
6154
  * This endpoint is typically skipped if the JwksServiceStorageConfig is provided.
6149
6155
  *
6150
- * @returns the public JWKS containing all non-retired signing keys
6156
+ * @returns The public JWKS containing all non-retired signing keys.
6151
6157
  */ function getJwks() {
6152
6158
  return _async_to_generator(function() {
6153
6159
  return _ts_generator(this, function(_state) {
@@ -6166,7 +6172,7 @@ function _ts_generator(thisArg, body) {
6166
6172
  * Returns the authorization server(s) that protect this resource,
6167
6173
  * allowing clients to discover which authorization server to use.
6168
6174
  *
6169
- * @returns the protected resource metadata with authorization server URLs
6175
+ * @returns The protected resource metadata with authorization server URLs.
6170
6176
  */ key: "getProtectedResource",
6171
6177
  value: function getProtectedResource() {
6172
6178
  return {
@@ -6311,7 +6317,7 @@ function _unsupported_iterable_to_array(o, minLen) {
6311
6317
  * caller then falls back to `appUrl` (the single-origin default). The compare is on the parsed
6312
6318
  * URL origin so a default `appApiUrl = "${appUrl}/api"` is treated as the same origin.
6313
6319
  *
6314
- * @param envService - the Firebase server environment service.
6320
+ * @param envService - The Firebase server environment service.
6315
6321
  * @returns The API origin (no trailing slash) when distinct from the frontend origin, otherwise `undefined`.
6316
6322
  *
6317
6323
  * @example
@@ -6350,9 +6356,9 @@ function _unsupported_iterable_to_array(o, minLen) {
6350
6356
  * The issuer can also be overridden directly by passing `issuer` on the `config` block to
6351
6357
  * {@link oidcModuleMetadata}; the override wins over the factory-derived value.
6352
6358
  *
6353
- * @param configService - the NestJS ConfigService for reading environment variables
6354
- * @param envService - the Firebase server environment service for app URL and env detection
6355
- * @returns the constructed OidcModuleConfig
6359
+ * @param configService - The NestJS ConfigService for reading environment variables.
6360
+ * @param envService - The Firebase server environment service for app URL and env detection.
6361
+ * @returns The constructed OidcModuleConfig.
6356
6362
  * @throws {Error} When `appUrl` is missing, the resolved issuer lacks an HTTP prefix, or the encryption secret is invalid.
6357
6363
  */ function oidcModuleConfigFactory(configService, envService) {
6358
6364
  var _resolveOidcIssuerOriginFromEnv, _configService_get;
@@ -6403,9 +6409,9 @@ function _unsupported_iterable_to_array(o, minLen) {
6403
6409
  * Factory that creates {@link OidcServerFirestoreCollections} using the provided Firestore context
6404
6410
  * and JWKS encryption config from {@link OidcModuleConfig}.
6405
6411
  *
6406
- * @param firestoreContext - the Firestore context for collection creation
6407
- * @param oidcModuleConfig - the OIDC module config containing JWKS encryption settings
6408
- * @returns the configured OidcServerFirestoreCollections
6412
+ * @param firestoreContext - The Firestore context for collection creation.
6413
+ * @param oidcModuleConfig - The OIDC module config containing JWKS encryption settings.
6414
+ * @returns The configured OidcServerFirestoreCollections.
6409
6415
  */ function oidcFirestoreCollectionsFactory(firestoreContext, oidcModuleConfig) {
6410
6416
  return {
6411
6417
  jwksKeyCollection: jwksKeyFirestoreCollection(_object_spread({
@@ -6426,8 +6432,8 @@ function _unsupported_iterable_to_array(o, minLen) {
6426
6432
  * Additionally, the following may be optionally provided:
6427
6433
  * - JwksServiceStorageConfig
6428
6434
  *
6429
- * @param metadataConfig - the configuration for generating the OIDC module metadata
6430
- * @returns the NestJS module metadata for the OIDC module
6435
+ * @param metadataConfig - The configuration for generating the OIDC module metadata.
6436
+ * @returns The NestJS module metadata for the OIDC module.
6431
6437
  */ function oidcModuleMetadata(metadataConfig) {
6432
6438
  var dependencyModule = metadataConfig.dependencyModule, config$1 = metadataConfig.config, imports = metadataConfig.imports, exports$1 = metadataConfig.exports, providers = metadataConfig.providers;
6433
6439
  var dependencyModuleImport = [