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