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