@dereekb/firebase-server 13.11.13 → 13.11.15

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