@enfuce/nextgen-sdk 0.0.7 → 0.0.9

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 (107) hide show
  1. package/README.md +209 -27
  2. package/dist/authorisation-control/api.d.ts +0 -56
  3. package/dist/authorisation-control/api.js +1 -115
  4. package/dist/authorisation-control/index.d.ts +0 -1
  5. package/dist/authorisation-control/index.js +0 -1
  6. package/dist/card/api.js +12 -12
  7. package/dist/card/client.d.ts +2 -2
  8. package/dist/cardholder/api.js +5 -5
  9. package/dist/cardholder/client.d.ts +2 -2
  10. package/dist/cards/client.d.ts +2 -2
  11. package/dist/esm/authorisation-control/api.d.ts +0 -56
  12. package/dist/esm/authorisation-control/api.js +0 -110
  13. package/dist/esm/authorisation-control/index.d.ts +0 -1
  14. package/dist/esm/authorisation-control/index.js +0 -1
  15. package/dist/esm/card/api.js +12 -12
  16. package/dist/esm/card/client.d.ts +2 -2
  17. package/dist/esm/cardholder/api.js +5 -5
  18. package/dist/esm/cardholder/client.d.ts +2 -2
  19. package/dist/esm/cards/client.d.ts +2 -2
  20. package/dist/esm/exchange-rate/client.d.ts +2 -2
  21. package/dist/esm/issuer-events/api.d.ts +0 -120
  22. package/dist/esm/issuer-events/api.js +0 -241
  23. package/dist/esm/issuer-events/index.d.ts +0 -1
  24. package/dist/esm/issuer-events/index.js +0 -1
  25. package/dist/esm/oauth/axios.d.ts +3 -3
  26. package/dist/esm/oauth/axios.js +1 -1
  27. package/dist/esm/oauth/clientCredentials.d.ts +31 -3
  28. package/dist/esm/oauth/clientCredentials.js +59 -4
  29. package/dist/esm/oauth/index.d.ts +2 -2
  30. package/dist/esm/oauth/index.js +2 -2
  31. package/dist/esm/oauth/tokenManager.d.ts +2 -2
  32. package/dist/esm/oauth/tokenManager.js +2 -2
  33. package/dist/esm/pin/api.d.ts +52 -0
  34. package/dist/esm/pin/api.js +80 -3
  35. package/dist/esm/pin/client.d.ts +2 -2
  36. package/dist/esm/threeds/client.d.ts +2 -2
  37. package/dist/esm/threeds-oob/api.d.ts +0 -56
  38. package/dist/esm/threeds-oob/api.js +0 -112
  39. package/dist/esm/threeds-oob/index.d.ts +0 -1
  40. package/dist/esm/threeds-oob/index.js +0 -1
  41. package/dist/esm/wallet/api.js +12 -12
  42. package/dist/esm/wallet/client.d.ts +2 -2
  43. package/dist/exchange-rate/client.d.ts +2 -2
  44. package/dist/issuer-events/api.d.ts +0 -120
  45. package/dist/issuer-events/api.js +1 -246
  46. package/dist/issuer-events/index.d.ts +0 -1
  47. package/dist/issuer-events/index.js +0 -1
  48. package/dist/oauth/axios.d.ts +3 -3
  49. package/dist/oauth/axios.js +1 -1
  50. package/dist/oauth/clientCredentials.d.ts +31 -3
  51. package/dist/oauth/clientCredentials.js +60 -3
  52. package/dist/oauth/index.d.ts +2 -2
  53. package/dist/oauth/index.js +4 -2
  54. package/dist/oauth/tokenManager.d.ts +2 -2
  55. package/dist/oauth/tokenManager.js +4 -4
  56. package/dist/pin/api.d.ts +52 -0
  57. package/dist/pin/api.js +80 -3
  58. package/dist/pin/client.d.ts +2 -2
  59. package/dist/threeds/client.d.ts +2 -2
  60. package/dist/threeds-oob/api.d.ts +0 -56
  61. package/dist/threeds-oob/api.js +1 -117
  62. package/dist/threeds-oob/index.d.ts +0 -1
  63. package/dist/threeds-oob/index.js +0 -1
  64. package/dist/wallet/api.js +12 -12
  65. package/dist/wallet/client.d.ts +2 -2
  66. package/package.json +1 -1
  67. package/src/authorisation-control/api.ts +0 -102
  68. package/src/authorisation-control/index.ts +0 -2
  69. package/src/card/api.ts +12 -12
  70. package/src/card/client.ts +3 -3
  71. package/src/cardholder/api.ts +5 -5
  72. package/src/cardholder/client.ts +3 -3
  73. package/src/cards/client.ts +3 -3
  74. package/src/exchange-rate/client.ts +3 -3
  75. package/src/issuer-events/api.ts +0 -237
  76. package/src/issuer-events/index.ts +0 -2
  77. package/src/oauth/axios.ts +3 -3
  78. package/src/oauth/clientCredentials.ts +87 -4
  79. package/src/oauth/index.ts +9 -2
  80. package/src/oauth/tokenManager.ts +2 -2
  81. package/src/pin/api.ts +99 -3
  82. package/src/pin/client.ts +3 -3
  83. package/src/threeds/client.ts +3 -3
  84. package/src/threeds-oob/api.ts +0 -105
  85. package/src/threeds-oob/index.ts +0 -2
  86. package/src/wallet/api.ts +12 -12
  87. package/src/wallet/client.ts +3 -3
  88. package/test/clientCredentials.test.ts +20 -0
  89. package/test/oauth.test.ts +12 -12
  90. package/dist/authorisation-control/client.d.ts +0 -47
  91. package/dist/authorisation-control/client.js +0 -80
  92. package/dist/esm/authorisation-control/client.d.ts +0 -47
  93. package/dist/esm/authorisation-control/client.js +0 -75
  94. package/dist/esm/issuer-events/client.d.ts +0 -47
  95. package/dist/esm/issuer-events/client.js +0 -75
  96. package/dist/esm/threeds-oob/client.d.ts +0 -47
  97. package/dist/esm/threeds-oob/client.js +0 -75
  98. package/dist/issuer-events/client.d.ts +0 -47
  99. package/dist/issuer-events/client.js +0 -80
  100. package/dist/threeds-oob/client.d.ts +0 -47
  101. package/dist/threeds-oob/client.js +0 -80
  102. package/src/authorisation-control/client.ts +0 -86
  103. package/src/issuer-events/client.ts +0 -86
  104. package/src/threeds-oob/client.ts +0 -86
  105. package/test/authorisation-control.test.ts +0 -71
  106. package/test/issuer-events.test.ts +0 -55
  107. package/test/threeds-oob.test.ts +0 -90
package/src/card/api.ts CHANGED
@@ -891,7 +891,7 @@ export const CreateCardApiAxiosParamCreator = function (configuration?: Configur
891
891
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
892
892
 
893
893
  localVarHeaderParameter['Content-Type'] = 'application/json';
894
- localVarHeaderParameter['Accept'] = 'application/json';
894
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
895
895
 
896
896
  if (xAuditUser != null) {
897
897
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1014,7 +1014,7 @@ export const CreatePINControlAccessTokenApiAxiosParamCreator = function (configu
1014
1014
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1015
1015
 
1016
1016
  localVarHeaderParameter['Content-Type'] = 'application/json';
1017
- localVarHeaderParameter['Accept'] = 'application/json';
1017
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1018
1018
 
1019
1019
  if (xAuditUser != null) {
1020
1020
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1130,7 +1130,7 @@ export const GetCardApiAxiosParamCreator = function (configuration?: Configurati
1130
1130
  // http bearer authentication required
1131
1131
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1132
1132
 
1133
- localVarHeaderParameter['Accept'] = 'application/json';
1133
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1134
1134
 
1135
1135
  if (xAuditUser != null) {
1136
1136
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1174,7 +1174,7 @@ export const GetCardApiAxiosParamCreator = function (configuration?: Configurati
1174
1174
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1175
1175
 
1176
1176
  localVarHeaderParameter['Content-Type'] = 'application/json';
1177
- localVarHeaderParameter['Accept'] = 'application/json';
1177
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1178
1178
 
1179
1179
  if (xAuditUser != null) {
1180
1180
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1220,7 +1220,7 @@ export const GetCardApiAxiosParamCreator = function (configuration?: Configurati
1220
1220
  localVarQueryParameter['mainCardId'] = mainCardId;
1221
1221
  }
1222
1222
 
1223
- localVarHeaderParameter['Accept'] = 'application/json';
1223
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1224
1224
 
1225
1225
  if (xAuditUser != null) {
1226
1226
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1413,7 +1413,7 @@ export const GetCardPaymentInfoApiAxiosParamCreator = function (configuration?:
1413
1413
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1414
1414
 
1415
1415
  localVarHeaderParameter['Content-Type'] = 'application/json';
1416
- localVarHeaderParameter['Accept'] = 'application/json';
1416
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1417
1417
 
1418
1418
  if (xAuditUser != null) {
1419
1419
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1529,7 +1529,7 @@ export const GetPlasticManufacturingHistoryApiAxiosParamCreator = function (conf
1529
1529
  // http bearer authentication required
1530
1530
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1531
1531
 
1532
- localVarHeaderParameter['Accept'] = 'application/json';
1532
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1533
1533
 
1534
1534
  if (xAuditUser != null) {
1535
1535
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1642,7 +1642,7 @@ export const UpdateCardApiAxiosParamCreator = function (configuration?: Configur
1642
1642
  // http bearer authentication required
1643
1643
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1644
1644
 
1645
- localVarHeaderParameter['Accept'] = 'application/json';
1645
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1646
1646
 
1647
1647
  if (xIdempotencyKey != null) {
1648
1648
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -1691,7 +1691,7 @@ export const UpdateCardApiAxiosParamCreator = function (configuration?: Configur
1691
1691
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1692
1692
 
1693
1693
  localVarHeaderParameter['Content-Type'] = 'application/json';
1694
- localVarHeaderParameter['Accept'] = 'application/json';
1694
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1695
1695
 
1696
1696
  if (xAuditUser != null) {
1697
1697
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1737,7 +1737,7 @@ export const UpdateCardApiAxiosParamCreator = function (configuration?: Configur
1737
1737
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1738
1738
 
1739
1739
  localVarHeaderParameter['Content-Type'] = 'application/json';
1740
- localVarHeaderParameter['Accept'] = 'application/json';
1740
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1741
1741
 
1742
1742
  if (xIdempotencyKey != null) {
1743
1743
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -1784,7 +1784,7 @@ export const UpdateCardApiAxiosParamCreator = function (configuration?: Configur
1784
1784
  // http bearer authentication required
1785
1785
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1786
1786
 
1787
- localVarHeaderParameter['Accept'] = 'application/json';
1787
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1788
1788
 
1789
1789
  if (xIdempotencyKey != null) {
1790
1790
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -1832,7 +1832,7 @@ export const UpdateCardApiAxiosParamCreator = function (configuration?: Configur
1832
1832
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1833
1833
 
1834
1834
  localVarHeaderParameter['Content-Type'] = 'application/json';
1835
- localVarHeaderParameter['Accept'] = 'application/json';
1835
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1836
1836
 
1837
1837
  if (xIdempotencyKey != null) {
1838
1838
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -6,7 +6,7 @@
6
6
  * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
7
  */
8
8
  import globalAxios, { type AxiosInstance } from 'axios';
9
- import { createOAuthAxios, type TokenManager } from '../oauth';
9
+ import { createOAuthAxios, type OAuthClientCredentialsManager } from '../oauth';
10
10
  import { Configuration } from './configuration';
11
11
  import {
12
12
  CreateCardApi,
@@ -80,7 +80,7 @@ export class CardClient {
80
80
  export class CardClientBuilder {
81
81
 
82
82
  private _baseUrl?: string;
83
- private _tokens?: TokenManager;
83
+ private _tokens?: OAuthClientCredentialsManager;
84
84
  private _customizers: Array<(http: AxiosInstance) => void> = [];
85
85
 
86
86
  /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
@@ -90,7 +90,7 @@ export class CardClientBuilder {
90
90
  }
91
91
 
92
92
  /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
93
- oauth(tokens: TokenManager): this {
93
+ oauth(tokens: OAuthClientCredentialsManager): this {
94
94
  this._tokens = tokens;
95
95
  return this;
96
96
  }
@@ -1987,7 +1987,7 @@ export const CreateCardholderApiAxiosParamCreator = function (configuration?: Co
1987
1987
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1988
1988
 
1989
1989
  localVarHeaderParameter['Content-Type'] = 'application/json';
1990
- localVarHeaderParameter['Accept'] = 'application/json';
1990
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1991
1991
 
1992
1992
  if (xIdempotencyKey != null) {
1993
1993
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -2106,7 +2106,7 @@ export const GetCardholderApiAxiosParamCreator = function (configuration?: Confi
2106
2106
  // http bearer authentication required
2107
2107
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
2108
2108
 
2109
- localVarHeaderParameter['Accept'] = 'application/json';
2109
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
2110
2110
 
2111
2111
  if (xAuditUser != null) {
2112
2112
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -2151,7 +2151,7 @@ export const GetCardholderApiAxiosParamCreator = function (configuration?: Confi
2151
2151
  localVarQueryParameter['customerNumber'] = customerNumber;
2152
2152
  }
2153
2153
 
2154
- localVarHeaderParameter['Accept'] = 'application/json';
2154
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
2155
2155
 
2156
2156
  if (xAuditUser != null) {
2157
2157
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -2310,7 +2310,7 @@ export const GetCardsByCardholderIdApiAxiosParamCreator = function (configuratio
2310
2310
  localVarQueryParameter['size'] = size;
2311
2311
  }
2312
2312
 
2313
- localVarHeaderParameter['Accept'] = 'application/json';
2313
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
2314
2314
 
2315
2315
  if (xAuditUser != null) {
2316
2316
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -2432,7 +2432,7 @@ export const UpdateCardholderApiAxiosParamCreator = function (configuration?: Co
2432
2432
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
2433
2433
 
2434
2434
  localVarHeaderParameter['Content-Type'] = 'application/json';
2435
- localVarHeaderParameter['Accept'] = 'application/json';
2435
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
2436
2436
 
2437
2437
  if (xAuditUser != null) {
2438
2438
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -6,7 +6,7 @@
6
6
  * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
7
  */
8
8
  import globalAxios, { type AxiosInstance } from 'axios';
9
- import { createOAuthAxios, type TokenManager } from '../oauth';
9
+ import { createOAuthAxios, type OAuthClientCredentialsManager } from '../oauth';
10
10
  import { Configuration } from './configuration';
11
11
  import {
12
12
  CreateCardholderApi,
@@ -68,7 +68,7 @@ export class CardholderClient {
68
68
  export class CardholderClientBuilder {
69
69
 
70
70
  private _baseUrl?: string;
71
- private _tokens?: TokenManager;
71
+ private _tokens?: OAuthClientCredentialsManager;
72
72
  private _customizers: Array<(http: AxiosInstance) => void> = [];
73
73
 
74
74
  /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
@@ -78,7 +78,7 @@ export class CardholderClientBuilder {
78
78
  }
79
79
 
80
80
  /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
81
- oauth(tokens: TokenManager): this {
81
+ oauth(tokens: OAuthClientCredentialsManager): this {
82
82
  this._tokens = tokens;
83
83
  return this;
84
84
  }
@@ -6,7 +6,7 @@
6
6
  * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
7
  */
8
8
  import globalAxios, { type AxiosInstance } from 'axios';
9
- import { createOAuthAxios, type TokenManager } from '../oauth';
9
+ import { createOAuthAxios, type OAuthClientCredentialsManager } from '../oauth';
10
10
  import { Configuration } from './configuration';
11
11
  import {
12
12
  CardsApi,
@@ -50,7 +50,7 @@ export class CardsClient {
50
50
  export class CardsClientBuilder {
51
51
 
52
52
  private _baseUrl?: string;
53
- private _tokens?: TokenManager;
53
+ private _tokens?: OAuthClientCredentialsManager;
54
54
  private _customizers: Array<(http: AxiosInstance) => void> = [];
55
55
 
56
56
  /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
@@ -60,7 +60,7 @@ export class CardsClientBuilder {
60
60
  }
61
61
 
62
62
  /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
63
- oauth(tokens: TokenManager): this {
63
+ oauth(tokens: OAuthClientCredentialsManager): this {
64
64
  this._tokens = tokens;
65
65
  return this;
66
66
  }
@@ -6,7 +6,7 @@
6
6
  * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
7
  */
8
8
  import globalAxios, { type AxiosInstance } from 'axios';
9
- import { createOAuthAxios, type TokenManager } from '../oauth';
9
+ import { createOAuthAxios, type OAuthClientCredentialsManager } from '../oauth';
10
10
  import { Configuration } from './configuration';
11
11
  import {
12
12
  GetECBExchangeRateApi,
@@ -62,7 +62,7 @@ export class ExchangeRateClient {
62
62
  export class ExchangeRateClientBuilder {
63
63
 
64
64
  private _baseUrl?: string;
65
- private _tokens?: TokenManager;
65
+ private _tokens?: OAuthClientCredentialsManager;
66
66
  private _customizers: Array<(http: AxiosInstance) => void> = [];
67
67
 
68
68
  /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
@@ -72,7 +72,7 @@ export class ExchangeRateClientBuilder {
72
72
  }
73
73
 
74
74
  /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
75
- oauth(tokens: TokenManager): this {
75
+ oauth(tokens: OAuthClientCredentialsManager): this {
76
76
  this._tokens = tokens;
77
77
  return this;
78
78
  }
@@ -1720,240 +1720,3 @@ export type TokenStatus = typeof TokenStatus[keyof typeof TokenStatus];
1720
1720
 
1721
1721
 
1722
1722
 
1723
- /**
1724
- * IssuerEventWebhooksApi - axios parameter creator
1725
- */
1726
- export const IssuerEventWebhooksApiAxiosParamCreator = function (configuration?: Configuration) {
1727
- return {
1728
- /**
1729
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1730
- * @summary Outgoing card event webhook endpoint
1731
- * @param {CardEvent} cardEvent Card event
1732
- * @param {*} [options] Override http request option.
1733
- * @throws {RequiredError}
1734
- */
1735
- cardEvent: async (cardEvent: CardEvent, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
1736
- // verify required parameter 'cardEvent' is not null or undefined
1737
- assertParamExists('cardEvent', 'cardEvent', cardEvent)
1738
- const localVarPath = `/card`;
1739
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1740
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1741
- let baseOptions;
1742
- if (configuration) {
1743
- baseOptions = configuration.baseOptions;
1744
- }
1745
-
1746
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1747
- const localVarHeaderParameter = {} as any;
1748
- const localVarQueryParameter = {} as any;
1749
-
1750
- localVarHeaderParameter['Content-Type'] = 'application/json';
1751
-
1752
- setSearchParams(localVarUrlObj, localVarQueryParameter);
1753
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1754
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1755
- localVarRequestOptions.data = serializeDataIfNeeded(cardEvent, localVarRequestOptions, configuration)
1756
-
1757
- return {
1758
- url: toPathString(localVarUrlObj),
1759
- options: localVarRequestOptions,
1760
- };
1761
- },
1762
- /**
1763
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1764
- * @summary Outgoing cardholder event webhook endpoint
1765
- * @param {CardholderEvent} cardholderEvent Cardholder event
1766
- * @param {*} [options] Override http request option.
1767
- * @throws {RequiredError}
1768
- */
1769
- cardholderEvent: async (cardholderEvent: CardholderEvent, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
1770
- // verify required parameter 'cardholderEvent' is not null or undefined
1771
- assertParamExists('cardholderEvent', 'cardholderEvent', cardholderEvent)
1772
- const localVarPath = `/cardholder`;
1773
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1774
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1775
- let baseOptions;
1776
- if (configuration) {
1777
- baseOptions = configuration.baseOptions;
1778
- }
1779
-
1780
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1781
- const localVarHeaderParameter = {} as any;
1782
- const localVarQueryParameter = {} as any;
1783
-
1784
- localVarHeaderParameter['Content-Type'] = 'application/json';
1785
-
1786
- setSearchParams(localVarUrlObj, localVarQueryParameter);
1787
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1788
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1789
- localVarRequestOptions.data = serializeDataIfNeeded(cardholderEvent, localVarRequestOptions, configuration)
1790
-
1791
- return {
1792
- url: toPathString(localVarUrlObj),
1793
- options: localVarRequestOptions,
1794
- };
1795
- },
1796
- /**
1797
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1798
- * @summary Outgoing token event webhook endpoint
1799
- * @param {TokenEvent} tokenEvent Token event
1800
- * @param {*} [options] Override http request option.
1801
- * @throws {RequiredError}
1802
- */
1803
- tokenEvent: async (tokenEvent: TokenEvent, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
1804
- // verify required parameter 'tokenEvent' is not null or undefined
1805
- assertParamExists('tokenEvent', 'tokenEvent', tokenEvent)
1806
- const localVarPath = `/token`;
1807
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1808
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1809
- let baseOptions;
1810
- if (configuration) {
1811
- baseOptions = configuration.baseOptions;
1812
- }
1813
-
1814
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1815
- const localVarHeaderParameter = {} as any;
1816
- const localVarQueryParameter = {} as any;
1817
-
1818
- localVarHeaderParameter['Content-Type'] = 'application/json';
1819
-
1820
- setSearchParams(localVarUrlObj, localVarQueryParameter);
1821
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1822
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1823
- localVarRequestOptions.data = serializeDataIfNeeded(tokenEvent, localVarRequestOptions, configuration)
1824
-
1825
- return {
1826
- url: toPathString(localVarUrlObj),
1827
- options: localVarRequestOptions,
1828
- };
1829
- },
1830
- }
1831
- };
1832
-
1833
- /**
1834
- * IssuerEventWebhooksApi - functional programming interface
1835
- */
1836
- export const IssuerEventWebhooksApiFp = function(configuration?: Configuration) {
1837
- const localVarAxiosParamCreator = IssuerEventWebhooksApiAxiosParamCreator(configuration)
1838
- return {
1839
- /**
1840
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1841
- * @summary Outgoing card event webhook endpoint
1842
- * @param {CardEvent} cardEvent Card event
1843
- * @param {*} [options] Override http request option.
1844
- * @throws {RequiredError}
1845
- */
1846
- async cardEvent(cardEvent: CardEvent, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
1847
- const localVarAxiosArgs = await localVarAxiosParamCreator.cardEvent(cardEvent, options);
1848
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1849
- const localVarOperationServerBasePath = operationServerMap['IssuerEventWebhooksApi.cardEvent']?.[localVarOperationServerIndex]?.url;
1850
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1851
- },
1852
- /**
1853
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1854
- * @summary Outgoing cardholder event webhook endpoint
1855
- * @param {CardholderEvent} cardholderEvent Cardholder event
1856
- * @param {*} [options] Override http request option.
1857
- * @throws {RequiredError}
1858
- */
1859
- async cardholderEvent(cardholderEvent: CardholderEvent, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
1860
- const localVarAxiosArgs = await localVarAxiosParamCreator.cardholderEvent(cardholderEvent, options);
1861
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1862
- const localVarOperationServerBasePath = operationServerMap['IssuerEventWebhooksApi.cardholderEvent']?.[localVarOperationServerIndex]?.url;
1863
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1864
- },
1865
- /**
1866
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1867
- * @summary Outgoing token event webhook endpoint
1868
- * @param {TokenEvent} tokenEvent Token event
1869
- * @param {*} [options] Override http request option.
1870
- * @throws {RequiredError}
1871
- */
1872
- async tokenEvent(tokenEvent: TokenEvent, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
1873
- const localVarAxiosArgs = await localVarAxiosParamCreator.tokenEvent(tokenEvent, options);
1874
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1875
- const localVarOperationServerBasePath = operationServerMap['IssuerEventWebhooksApi.tokenEvent']?.[localVarOperationServerIndex]?.url;
1876
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1877
- },
1878
- }
1879
- };
1880
-
1881
- /**
1882
- * IssuerEventWebhooksApi - factory interface
1883
- */
1884
- export const IssuerEventWebhooksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
1885
- const localVarFp = IssuerEventWebhooksApiFp(configuration)
1886
- return {
1887
- /**
1888
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1889
- * @summary Outgoing card event webhook endpoint
1890
- * @param {CardEvent} cardEvent Card event
1891
- * @param {*} [options] Override http request option.
1892
- * @throws {RequiredError}
1893
- */
1894
- cardEvent(cardEvent: CardEvent, options?: RawAxiosRequestConfig): AxiosPromise<void> {
1895
- return localVarFp.cardEvent(cardEvent, options).then((request) => request(axios, basePath));
1896
- },
1897
- /**
1898
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1899
- * @summary Outgoing cardholder event webhook endpoint
1900
- * @param {CardholderEvent} cardholderEvent Cardholder event
1901
- * @param {*} [options] Override http request option.
1902
- * @throws {RequiredError}
1903
- */
1904
- cardholderEvent(cardholderEvent: CardholderEvent, options?: RawAxiosRequestConfig): AxiosPromise<void> {
1905
- return localVarFp.cardholderEvent(cardholderEvent, options).then((request) => request(axios, basePath));
1906
- },
1907
- /**
1908
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1909
- * @summary Outgoing token event webhook endpoint
1910
- * @param {TokenEvent} tokenEvent Token event
1911
- * @param {*} [options] Override http request option.
1912
- * @throws {RequiredError}
1913
- */
1914
- tokenEvent(tokenEvent: TokenEvent, options?: RawAxiosRequestConfig): AxiosPromise<void> {
1915
- return localVarFp.tokenEvent(tokenEvent, options).then((request) => request(axios, basePath));
1916
- },
1917
- };
1918
- };
1919
-
1920
- /**
1921
- * IssuerEventWebhooksApi - object-oriented interface
1922
- */
1923
- export class IssuerEventWebhooksApi extends BaseAPI {
1924
- /**
1925
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1926
- * @summary Outgoing card event webhook endpoint
1927
- * @param {CardEvent} cardEvent Card event
1928
- * @param {*} [options] Override http request option.
1929
- * @throws {RequiredError}
1930
- */
1931
- public cardEvent(cardEvent: CardEvent, options?: RawAxiosRequestConfig) {
1932
- return IssuerEventWebhooksApiFp(this.configuration).cardEvent(cardEvent, options).then((request) => request(this.axios, this.basePath));
1933
- }
1934
-
1935
- /**
1936
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1937
- * @summary Outgoing cardholder event webhook endpoint
1938
- * @param {CardholderEvent} cardholderEvent Cardholder event
1939
- * @param {*} [options] Override http request option.
1940
- * @throws {RequiredError}
1941
- */
1942
- public cardholderEvent(cardholderEvent: CardholderEvent, options?: RawAxiosRequestConfig) {
1943
- return IssuerEventWebhooksApiFp(this.configuration).cardholderEvent(cardholderEvent, options).then((request) => request(this.axios, this.basePath));
1944
- }
1945
-
1946
- /**
1947
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1948
- * @summary Outgoing token event webhook endpoint
1949
- * @param {TokenEvent} tokenEvent Token event
1950
- * @param {*} [options] Override http request option.
1951
- * @throws {RequiredError}
1952
- */
1953
- public tokenEvent(tokenEvent: TokenEvent, options?: RawAxiosRequestConfig) {
1954
- return IssuerEventWebhooksApiFp(this.configuration).tokenEvent(tokenEvent, options).then((request) => request(this.axios, this.basePath));
1955
- }
1956
- }
1957
-
1958
-
1959
-
@@ -16,5 +16,3 @@
16
16
  export * from "./api";
17
17
  export * from "./configuration";
18
18
 
19
-
20
- export * from './client';
@@ -6,7 +6,7 @@
6
6
  * OpenAPI Generator to (re)produce it.
7
7
  */
8
8
  import axios, { AxiosError, AxiosInstance, InternalAxiosRequestConfig } from 'axios';
9
- import { TokenManager } from './tokenManager';
9
+ import { OAuthClientCredentialsManager } from './tokenManager';
10
10
 
11
11
  const BEARER_PREFIX = 'Bearer ';
12
12
 
@@ -22,7 +22,7 @@ function stripBearer(header: string): string {
22
22
  * Returns an {@link AxiosInstance} with OAuth bearer-token handling built in:
23
23
  *
24
24
  * - **Proactive:** a request interceptor attaches a fresh bearer token (from the
25
- * {@link TokenManager}) to *every* request. This authenticates API modules whose spec declares no
25
+ * {@link OAuthClientCredentialsManager}) to *every* request. This authenticates API modules whose spec declares no
26
26
  * security scheme (e.g. exchange-rate), so no `accessToken` on the `Configuration` is required.
27
27
  * - **Reactive:** a response interceptor, on a `401`, forces a token refresh and retries the request
28
28
  * exactly once with the new bearer token.
@@ -35,7 +35,7 @@ function stripBearer(header: string): string {
35
35
  * const api = new card.CardApi(config, undefined, http);
36
36
  * ```
37
37
  */
38
- export function createOAuthAxios(manager: TokenManager, instance?: AxiosInstance): AxiosInstance {
38
+ export function createOAuthAxios(manager: OAuthClientCredentialsManager, instance?: AxiosInstance): AxiosInstance {
39
39
  const http = instance ?? axios.create();
40
40
 
41
41
  // Proactive: attach a fresh bearer token to every outgoing request.
@@ -6,7 +6,7 @@
6
6
  * OpenAPI Generator to (re)produce it.
7
7
  */
8
8
  import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
9
- import { AccessToken, TokenFetcher, TokenManager } from './tokenManager';
9
+ import { AccessToken, TokenFetcher, OAuthClientCredentialsManager } from './tokenManager';
10
10
 
11
11
  /** Configuration for the OAuth2 `client_credentials` grant. */
12
12
  export interface OAuthConfig {
@@ -23,6 +23,19 @@ export interface OAuthConfig {
23
23
  axiosInstance?: AxiosInstance;
24
24
  }
25
25
 
26
+ /**
27
+ * The OAuth2 client-credentials identity — the client id/secret and requested scopes. It carries
28
+ * no URL: pair it with a token URL (e.g. derived from a `TenantEnvironment`) via the
29
+ * `clientCredentials(tokenUrl, credentials)` overload below.
30
+ */
31
+ export interface ClientCredentials {
32
+ clientId: string;
33
+ /** May be omitted for a public client. */
34
+ clientSecret?: string;
35
+ /** Requested scopes; space-joined into a `scope` parameter. */
36
+ scopes?: string[];
37
+ }
38
+
26
39
  interface TokenResponse {
27
40
  access_token?: string;
28
41
  expires_in?: number;
@@ -66,7 +79,77 @@ export function clientCredentialsFetcher(config: OAuthConfig): TokenFetcher {
66
79
  };
67
80
  }
68
81
 
69
- /** Convenience: a caching {@link TokenManager} backed by the client-credentials grant. */
70
- export function clientCredentials(config: OAuthConfig, skewSeconds: number = 60): TokenManager {
71
- return new TokenManager(clientCredentialsFetcher(config), skewSeconds);
82
+ /** Convenience: a caching {@link OAuthClientCredentialsManager} backed by the client-credentials grant. */
83
+ export function clientCredentials(config: OAuthConfig, skewSeconds?: number): OAuthClientCredentialsManager;
84
+ /** Convenience overload pairing a token URL with a {@link ClientCredentials} identity. */
85
+ export function clientCredentials(
86
+ tokenUrl: string,
87
+ credentials: ClientCredentials,
88
+ skewSeconds?: number,
89
+ ): OAuthClientCredentialsManager;
90
+ export function clientCredentials(
91
+ configOrUrl: OAuthConfig | string,
92
+ credsOrSkew?: ClientCredentials | number,
93
+ skewSeconds = 60,
94
+ ): OAuthClientCredentialsManager {
95
+ let config: OAuthConfig;
96
+ let skew: number;
97
+ if (typeof configOrUrl === 'string') {
98
+ const creds = credsOrSkew as ClientCredentials;
99
+ config = {
100
+ tokenUrl: configOrUrl,
101
+ clientId: creds.clientId,
102
+ clientSecret: creds.clientSecret ?? '',
103
+ scopes: creds.scopes,
104
+ };
105
+ skew = skewSeconds;
106
+ } else {
107
+ config = configOrUrl;
108
+ skew = typeof credsOrSkew === 'number' ? credsOrSkew : 60;
109
+ }
110
+ return new OAuthClientCredentialsManager(clientCredentialsFetcher(config), skew);
111
+ }
112
+
113
+ /**
114
+ * Decodes the granted scopes from a JWT access token's `scope` (space-delimited) or `scp` (array)
115
+ * claim, sorted and de-duplicated. Returns an empty array for an empty, opaque (non-JWT), or
116
+ * undecodable token — never throws. Server-side only (uses Node's `Buffer`).
117
+ */
118
+ export function scopesOf(accessToken: string): string[] {
119
+ const parts = accessToken ? accessToken.split('.') : [];
120
+ if (parts.length < 2) return [];
121
+ try {
122
+ const b64 = parts[1].replace(/-/g, '+').replace(/_/g, '/'); // base64url -> base64 ('base64' tolerates missing padding)
123
+ const payload = JSON.parse(Buffer.from(b64, 'base64').toString('utf8'));
124
+ const scopes = new Set<string>();
125
+ if (typeof payload.scope === 'string') {
126
+ for (const s of payload.scope.trim().split(/\s+/)) if (s) scopes.add(s);
127
+ }
128
+ if (Array.isArray(payload.scp)) {
129
+ for (const s of payload.scp) if (typeof s === 'string') scopes.add(s);
130
+ }
131
+ return [...scopes].sort();
132
+ } catch {
133
+ return [];
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Discovers the scopes the client is entitled to. Requests a `client_credentials` token with NO
139
+ * `scope` narrowing (any scopes on the config/credentials are ignored) — most authorization servers
140
+ * then grant the client's full default scope set — and returns the granted scopes decoded from the
141
+ * access token, sorted and de-duplicated. Performs a live token request; does not cache.
142
+ */
143
+ export function availableScopes(config: OAuthConfig): Promise<string[]>;
144
+ export function availableScopes(tokenUrl: string, credentials: ClientCredentials): Promise<string[]>;
145
+ export async function availableScopes(
146
+ configOrUrl: OAuthConfig | string,
147
+ credentials?: ClientCredentials,
148
+ ): Promise<string[]> {
149
+ const config: OAuthConfig =
150
+ typeof configOrUrl === 'string'
151
+ ? { tokenUrl: configOrUrl, clientId: credentials!.clientId, clientSecret: credentials!.clientSecret ?? '' }
152
+ : configOrUrl;
153
+ const token = await clientCredentialsFetcher({ ...config, scopes: [] })();
154
+ return scopesOf(token.accessToken);
72
155
  }
@@ -22,6 +22,13 @@
22
22
  *
23
23
  * Server-side only — a client secret must never ship to a browser.
24
24
  */
25
- export { AccessToken, TokenFetcher, TokenManager } from './tokenManager';
26
- export { OAuthConfig, clientCredentials, clientCredentialsFetcher } from './clientCredentials';
25
+ export { AccessToken, TokenFetcher, OAuthClientCredentialsManager } from './tokenManager';
26
+ export {
27
+ ClientCredentials,
28
+ OAuthConfig,
29
+ clientCredentials,
30
+ clientCredentialsFetcher,
31
+ availableScopes,
32
+ scopesOf,
33
+ } from './clientCredentials';
27
34
  export { createOAuthAxios } from './axios';