@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
@@ -12,23 +12,8 @@
12
12
  * https://openapi-generator.tech
13
13
  * Do not edit the class manually.
14
14
  */
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
15
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.IssuerEventWebhooksApi = exports.IssuerEventWebhooksApiFactory = exports.IssuerEventWebhooksApiFp = exports.IssuerEventWebhooksApiAxiosParamCreator = exports.TokenStatus = exports.TokenRequestor = exports.RiskScore = exports.PinStatus = exports.PinDeliveryType = exports.Locale = exports.CountryCodesAlpha3 = exports.CardholderResponseNationalityEnum = exports.CardholderEventNationalityEnum = exports.CardVersionStatus = exports.CardStatus = exports.CardScheme = exports.CardRole = exports.CardDeliveryType = exports.CardConfigurationType = exports.AuthorizationDecisionColor = void 0;
26
- const axios_1 = require("axios");
27
- // Some imports not used depending on template conditions
28
- // @ts-ignore
29
- const common_1 = require("./common");
30
- // @ts-ignore
31
- const base_1 = require("./base");
16
+ exports.TokenStatus = exports.TokenRequestor = exports.RiskScore = exports.PinStatus = exports.PinDeliveryType = exports.Locale = exports.CountryCodesAlpha3 = exports.CardholderResponseNationalityEnum = exports.CardholderEventNationalityEnum = exports.CardVersionStatus = exports.CardStatus = exports.CardScheme = exports.CardRole = exports.CardDeliveryType = exports.CardConfigurationType = exports.AuthorizationDecisionColor = void 0;
32
17
  /**
33
18
  * The wallets common name for authorization decision.
34
19
  */
@@ -1181,233 +1166,3 @@ exports.TokenStatus = {
1181
1166
  Inactive: 'INACTIVE',
1182
1167
  Suspended: 'SUSPENDED',
1183
1168
  };
1184
- /**
1185
- * IssuerEventWebhooksApi - axios parameter creator
1186
- */
1187
- const IssuerEventWebhooksApiAxiosParamCreator = function (configuration) {
1188
- return {
1189
- /**
1190
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1191
- * @summary Outgoing card event webhook endpoint
1192
- * @param {CardEvent} cardEvent Card event
1193
- * @param {*} [options] Override http request option.
1194
- * @throws {RequiredError}
1195
- */
1196
- cardEvent: (cardEvent_1, ...args_1) => __awaiter(this, [cardEvent_1, ...args_1], void 0, function* (cardEvent, options = {}) {
1197
- // verify required parameter 'cardEvent' is not null or undefined
1198
- (0, common_1.assertParamExists)('cardEvent', 'cardEvent', cardEvent);
1199
- const localVarPath = `/card`;
1200
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1201
- const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
1202
- let baseOptions;
1203
- if (configuration) {
1204
- baseOptions = configuration.baseOptions;
1205
- }
1206
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
1207
- const localVarHeaderParameter = {};
1208
- const localVarQueryParameter = {};
1209
- localVarHeaderParameter['Content-Type'] = 'application/json';
1210
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
1211
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1212
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1213
- localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(cardEvent, localVarRequestOptions, configuration);
1214
- return {
1215
- url: (0, common_1.toPathString)(localVarUrlObj),
1216
- options: localVarRequestOptions,
1217
- };
1218
- }),
1219
- /**
1220
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1221
- * @summary Outgoing cardholder event webhook endpoint
1222
- * @param {CardholderEvent} cardholderEvent Cardholder event
1223
- * @param {*} [options] Override http request option.
1224
- * @throws {RequiredError}
1225
- */
1226
- cardholderEvent: (cardholderEvent_1, ...args_1) => __awaiter(this, [cardholderEvent_1, ...args_1], void 0, function* (cardholderEvent, options = {}) {
1227
- // verify required parameter 'cardholderEvent' is not null or undefined
1228
- (0, common_1.assertParamExists)('cardholderEvent', 'cardholderEvent', cardholderEvent);
1229
- const localVarPath = `/cardholder`;
1230
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1231
- const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
1232
- let baseOptions;
1233
- if (configuration) {
1234
- baseOptions = configuration.baseOptions;
1235
- }
1236
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
1237
- const localVarHeaderParameter = {};
1238
- const localVarQueryParameter = {};
1239
- localVarHeaderParameter['Content-Type'] = 'application/json';
1240
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
1241
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1242
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1243
- localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(cardholderEvent, localVarRequestOptions, configuration);
1244
- return {
1245
- url: (0, common_1.toPathString)(localVarUrlObj),
1246
- options: localVarRequestOptions,
1247
- };
1248
- }),
1249
- /**
1250
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1251
- * @summary Outgoing token event webhook endpoint
1252
- * @param {TokenEvent} tokenEvent Token event
1253
- * @param {*} [options] Override http request option.
1254
- * @throws {RequiredError}
1255
- */
1256
- tokenEvent: (tokenEvent_1, ...args_1) => __awaiter(this, [tokenEvent_1, ...args_1], void 0, function* (tokenEvent, options = {}) {
1257
- // verify required parameter 'tokenEvent' is not null or undefined
1258
- (0, common_1.assertParamExists)('tokenEvent', 'tokenEvent', tokenEvent);
1259
- const localVarPath = `/token`;
1260
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1261
- const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
1262
- let baseOptions;
1263
- if (configuration) {
1264
- baseOptions = configuration.baseOptions;
1265
- }
1266
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
1267
- const localVarHeaderParameter = {};
1268
- const localVarQueryParameter = {};
1269
- localVarHeaderParameter['Content-Type'] = 'application/json';
1270
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
1271
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1272
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1273
- localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(tokenEvent, localVarRequestOptions, configuration);
1274
- return {
1275
- url: (0, common_1.toPathString)(localVarUrlObj),
1276
- options: localVarRequestOptions,
1277
- };
1278
- }),
1279
- };
1280
- };
1281
- exports.IssuerEventWebhooksApiAxiosParamCreator = IssuerEventWebhooksApiAxiosParamCreator;
1282
- /**
1283
- * IssuerEventWebhooksApi - functional programming interface
1284
- */
1285
- const IssuerEventWebhooksApiFp = function (configuration) {
1286
- const localVarAxiosParamCreator = (0, exports.IssuerEventWebhooksApiAxiosParamCreator)(configuration);
1287
- return {
1288
- /**
1289
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1290
- * @summary Outgoing card event webhook endpoint
1291
- * @param {CardEvent} cardEvent Card event
1292
- * @param {*} [options] Override http request option.
1293
- * @throws {RequiredError}
1294
- */
1295
- cardEvent(cardEvent, options) {
1296
- return __awaiter(this, void 0, void 0, function* () {
1297
- var _a, _b, _c;
1298
- const localVarAxiosArgs = yield localVarAxiosParamCreator.cardEvent(cardEvent, options);
1299
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1300
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['IssuerEventWebhooksApi.cardEvent']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1301
- return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1302
- });
1303
- },
1304
- /**
1305
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1306
- * @summary Outgoing cardholder event webhook endpoint
1307
- * @param {CardholderEvent} cardholderEvent Cardholder event
1308
- * @param {*} [options] Override http request option.
1309
- * @throws {RequiredError}
1310
- */
1311
- cardholderEvent(cardholderEvent, options) {
1312
- return __awaiter(this, void 0, void 0, function* () {
1313
- var _a, _b, _c;
1314
- const localVarAxiosArgs = yield localVarAxiosParamCreator.cardholderEvent(cardholderEvent, options);
1315
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1316
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['IssuerEventWebhooksApi.cardholderEvent']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1317
- return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1318
- });
1319
- },
1320
- /**
1321
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1322
- * @summary Outgoing token event webhook endpoint
1323
- * @param {TokenEvent} tokenEvent Token event
1324
- * @param {*} [options] Override http request option.
1325
- * @throws {RequiredError}
1326
- */
1327
- tokenEvent(tokenEvent, options) {
1328
- return __awaiter(this, void 0, void 0, function* () {
1329
- var _a, _b, _c;
1330
- const localVarAxiosArgs = yield localVarAxiosParamCreator.tokenEvent(tokenEvent, options);
1331
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1332
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['IssuerEventWebhooksApi.tokenEvent']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1333
- return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1334
- });
1335
- },
1336
- };
1337
- };
1338
- exports.IssuerEventWebhooksApiFp = IssuerEventWebhooksApiFp;
1339
- /**
1340
- * IssuerEventWebhooksApi - factory interface
1341
- */
1342
- const IssuerEventWebhooksApiFactory = function (configuration, basePath, axios) {
1343
- const localVarFp = (0, exports.IssuerEventWebhooksApiFp)(configuration);
1344
- return {
1345
- /**
1346
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1347
- * @summary Outgoing card event webhook endpoint
1348
- * @param {CardEvent} cardEvent Card event
1349
- * @param {*} [options] Override http request option.
1350
- * @throws {RequiredError}
1351
- */
1352
- cardEvent(cardEvent, options) {
1353
- return localVarFp.cardEvent(cardEvent, options).then((request) => request(axios, basePath));
1354
- },
1355
- /**
1356
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1357
- * @summary Outgoing cardholder event webhook endpoint
1358
- * @param {CardholderEvent} cardholderEvent Cardholder event
1359
- * @param {*} [options] Override http request option.
1360
- * @throws {RequiredError}
1361
- */
1362
- cardholderEvent(cardholderEvent, options) {
1363
- return localVarFp.cardholderEvent(cardholderEvent, options).then((request) => request(axios, basePath));
1364
- },
1365
- /**
1366
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1367
- * @summary Outgoing token event webhook endpoint
1368
- * @param {TokenEvent} tokenEvent Token event
1369
- * @param {*} [options] Override http request option.
1370
- * @throws {RequiredError}
1371
- */
1372
- tokenEvent(tokenEvent, options) {
1373
- return localVarFp.tokenEvent(tokenEvent, options).then((request) => request(axios, basePath));
1374
- },
1375
- };
1376
- };
1377
- exports.IssuerEventWebhooksApiFactory = IssuerEventWebhooksApiFactory;
1378
- /**
1379
- * IssuerEventWebhooksApi - object-oriented interface
1380
- */
1381
- class IssuerEventWebhooksApi extends base_1.BaseAPI {
1382
- /**
1383
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1384
- * @summary Outgoing card event webhook endpoint
1385
- * @param {CardEvent} cardEvent Card event
1386
- * @param {*} [options] Override http request option.
1387
- * @throws {RequiredError}
1388
- */
1389
- cardEvent(cardEvent, options) {
1390
- return (0, exports.IssuerEventWebhooksApiFp)(this.configuration).cardEvent(cardEvent, options).then((request) => request(this.axios, this.basePath));
1391
- }
1392
- /**
1393
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1394
- * @summary Outgoing cardholder event webhook endpoint
1395
- * @param {CardholderEvent} cardholderEvent Cardholder event
1396
- * @param {*} [options] Override http request option.
1397
- * @throws {RequiredError}
1398
- */
1399
- cardholderEvent(cardholderEvent, options) {
1400
- return (0, exports.IssuerEventWebhooksApiFp)(this.configuration).cardholderEvent(cardholderEvent, options).then((request) => request(this.axios, this.basePath));
1401
- }
1402
- /**
1403
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1404
- * @summary Outgoing token event webhook endpoint
1405
- * @param {TokenEvent} tokenEvent Token event
1406
- * @param {*} [options] Override http request option.
1407
- * @throws {RequiredError}
1408
- */
1409
- tokenEvent(tokenEvent, options) {
1410
- return (0, exports.IssuerEventWebhooksApiFp)(this.configuration).tokenEvent(tokenEvent, options).then((request) => request(this.axios, this.basePath));
1411
- }
1412
- }
1413
- exports.IssuerEventWebhooksApi = IssuerEventWebhooksApi;
@@ -11,4 +11,3 @@
11
11
  */
12
12
  export * from "./api";
13
13
  export * from "./configuration";
14
- export * from './client';
@@ -29,4 +29,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  __exportStar(require("./api"), exports);
31
31
  __exportStar(require("./configuration"), exports);
32
- __exportStar(require("./client"), exports);
@@ -1,10 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { TokenManager } from './tokenManager';
2
+ import { OAuthClientCredentialsManager } from './tokenManager';
3
3
  /**
4
4
  * Returns an {@link AxiosInstance} with OAuth bearer-token handling built in:
5
5
  *
6
6
  * - **Proactive:** a request interceptor attaches a fresh bearer token (from the
7
- * {@link TokenManager}) to *every* request. This authenticates API modules whose spec declares no
7
+ * {@link OAuthClientCredentialsManager}) to *every* request. This authenticates API modules whose spec declares no
8
8
  * security scheme (e.g. exchange-rate), so no `accessToken` on the `Configuration` is required.
9
9
  * - **Reactive:** a response interceptor, on a `401`, forces a token refresh and retries the request
10
10
  * exactly once with the new bearer token.
@@ -17,4 +17,4 @@ import { TokenManager } from './tokenManager';
17
17
  * const api = new card.CardApi(config, undefined, http);
18
18
  * ```
19
19
  */
20
- export declare function createOAuthAxios(manager: TokenManager, instance?: AxiosInstance): AxiosInstance;
20
+ export declare function createOAuthAxios(manager: OAuthClientCredentialsManager, instance?: AxiosInstance): AxiosInstance;
@@ -28,7 +28,7 @@ function stripBearer(header) {
28
28
  * Returns an {@link AxiosInstance} with OAuth bearer-token handling built in:
29
29
  *
30
30
  * - **Proactive:** a request interceptor attaches a fresh bearer token (from the
31
- * {@link TokenManager}) to *every* request. This authenticates API modules whose spec declares no
31
+ * {@link OAuthClientCredentialsManager}) to *every* request. This authenticates API modules whose spec declares no
32
32
  * security scheme (e.g. exchange-rate), so no `accessToken` on the `Configuration` is required.
33
33
  * - **Reactive:** a response interceptor, on a `401`, forces a token refresh and retries the request
34
34
  * exactly once with the new bearer token.
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { TokenFetcher, TokenManager } from './tokenManager';
2
+ import { TokenFetcher, OAuthClientCredentialsManager } from './tokenManager';
3
3
  /** Configuration for the OAuth2 `client_credentials` grant. */
4
4
  export interface OAuthConfig {
5
5
  tokenUrl: string;
@@ -14,11 +14,39 @@ export interface OAuthConfig {
14
14
  /** Axios instance used for the token request. Defaults to a fresh instance. */
15
15
  axiosInstance?: AxiosInstance;
16
16
  }
17
+ /**
18
+ * The OAuth2 client-credentials identity — the client id/secret and requested scopes. It carries
19
+ * no URL: pair it with a token URL (e.g. derived from a `TenantEnvironment`) via the
20
+ * `clientCredentials(tokenUrl, credentials)` overload below.
21
+ */
22
+ export interface ClientCredentials {
23
+ clientId: string;
24
+ /** May be omitted for a public client. */
25
+ clientSecret?: string;
26
+ /** Requested scopes; space-joined into a `scope` parameter. */
27
+ scopes?: string[];
28
+ }
17
29
  /**
18
30
  * Builds a {@link TokenFetcher} that performs the OAuth2 `client_credentials`
19
31
  * grant: a form-encoded POST to `config.tokenUrl`, parsing `access_token` and
20
32
  * `expires_in`. Server-side only — never ship a client secret to a browser.
21
33
  */
22
34
  export declare function clientCredentialsFetcher(config: OAuthConfig): TokenFetcher;
23
- /** Convenience: a caching {@link TokenManager} backed by the client-credentials grant. */
24
- export declare function clientCredentials(config: OAuthConfig, skewSeconds?: number): TokenManager;
35
+ /** Convenience: a caching {@link OAuthClientCredentialsManager} backed by the client-credentials grant. */
36
+ export declare function clientCredentials(config: OAuthConfig, skewSeconds?: number): OAuthClientCredentialsManager;
37
+ /** Convenience overload pairing a token URL with a {@link ClientCredentials} identity. */
38
+ export declare function clientCredentials(tokenUrl: string, credentials: ClientCredentials, skewSeconds?: number): OAuthClientCredentialsManager;
39
+ /**
40
+ * Decodes the granted scopes from a JWT access token's `scope` (space-delimited) or `scp` (array)
41
+ * claim, sorted and de-duplicated. Returns an empty array for an empty, opaque (non-JWT), or
42
+ * undecodable token — never throws. Server-side only (uses Node's `Buffer`).
43
+ */
44
+ export declare function scopesOf(accessToken: string): string[];
45
+ /**
46
+ * Discovers the scopes the client is entitled to. Requests a `client_credentials` token with NO
47
+ * `scope` narrowing (any scopes on the config/credentials are ignored) — most authorization servers
48
+ * then grant the client's full default scope set — and returns the granted scopes decoded from the
49
+ * access token, sorted and de-duplicated. Performs a live token request; does not cache.
50
+ */
51
+ export declare function availableScopes(config: OAuthConfig): Promise<string[]>;
52
+ export declare function availableScopes(tokenUrl: string, credentials: ClientCredentials): Promise<string[]>;
@@ -11,6 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.clientCredentialsFetcher = clientCredentialsFetcher;
13
13
  exports.clientCredentials = clientCredentials;
14
+ exports.scopesOf = scopesOf;
15
+ exports.availableScopes = availableScopes;
14
16
  /*
15
17
  * Enfuce nextgen SDK — OAuth token-management helper.
16
18
  *
@@ -57,7 +59,62 @@ function clientCredentialsFetcher(config) {
57
59
  return { accessToken: data.access_token, expiresInSeconds: (_b = data.expires_in) !== null && _b !== void 0 ? _b : 0 };
58
60
  });
59
61
  }
60
- /** Convenience: a caching {@link TokenManager} backed by the client-credentials grant. */
61
- function clientCredentials(config, skewSeconds = 60) {
62
- return new tokenManager_1.TokenManager(clientCredentialsFetcher(config), skewSeconds);
62
+ function clientCredentials(configOrUrl, credsOrSkew, skewSeconds = 60) {
63
+ var _a;
64
+ let config;
65
+ let skew;
66
+ if (typeof configOrUrl === 'string') {
67
+ const creds = credsOrSkew;
68
+ config = {
69
+ tokenUrl: configOrUrl,
70
+ clientId: creds.clientId,
71
+ clientSecret: (_a = creds.clientSecret) !== null && _a !== void 0 ? _a : '',
72
+ scopes: creds.scopes,
73
+ };
74
+ skew = skewSeconds;
75
+ }
76
+ else {
77
+ config = configOrUrl;
78
+ skew = typeof credsOrSkew === 'number' ? credsOrSkew : 60;
79
+ }
80
+ return new tokenManager_1.OAuthClientCredentialsManager(clientCredentialsFetcher(config), skew);
81
+ }
82
+ /**
83
+ * Decodes the granted scopes from a JWT access token's `scope` (space-delimited) or `scp` (array)
84
+ * claim, sorted and de-duplicated. Returns an empty array for an empty, opaque (non-JWT), or
85
+ * undecodable token — never throws. Server-side only (uses Node's `Buffer`).
86
+ */
87
+ function scopesOf(accessToken) {
88
+ const parts = accessToken ? accessToken.split('.') : [];
89
+ if (parts.length < 2)
90
+ return [];
91
+ try {
92
+ const b64 = parts[1].replace(/-/g, '+').replace(/_/g, '/'); // base64url -> base64 ('base64' tolerates missing padding)
93
+ const payload = JSON.parse(Buffer.from(b64, 'base64').toString('utf8'));
94
+ const scopes = new Set();
95
+ if (typeof payload.scope === 'string') {
96
+ for (const s of payload.scope.trim().split(/\s+/))
97
+ if (s)
98
+ scopes.add(s);
99
+ }
100
+ if (Array.isArray(payload.scp)) {
101
+ for (const s of payload.scp)
102
+ if (typeof s === 'string')
103
+ scopes.add(s);
104
+ }
105
+ return [...scopes].sort();
106
+ }
107
+ catch (_a) {
108
+ return [];
109
+ }
110
+ }
111
+ function availableScopes(configOrUrl, credentials) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ var _a;
114
+ const config = typeof configOrUrl === 'string'
115
+ ? { tokenUrl: configOrUrl, clientId: credentials.clientId, clientSecret: (_a = credentials.clientSecret) !== null && _a !== void 0 ? _a : '' }
116
+ : configOrUrl;
117
+ const token = yield clientCredentialsFetcher(Object.assign(Object.assign({}, config), { scopes: [] }))();
118
+ return scopesOf(token.accessToken);
119
+ });
63
120
  }
@@ -1,3 +1,3 @@
1
- export { AccessToken, TokenFetcher, TokenManager } from './tokenManager';
2
- export { OAuthConfig, clientCredentials, clientCredentialsFetcher } from './clientCredentials';
1
+ export { AccessToken, TokenFetcher, OAuthClientCredentialsManager } from './tokenManager';
2
+ export { ClientCredentials, OAuthConfig, clientCredentials, clientCredentialsFetcher, availableScopes, scopesOf, } from './clientCredentials';
3
3
  export { createOAuthAxios } from './axios';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createOAuthAxios = exports.clientCredentialsFetcher = exports.clientCredentials = exports.TokenManager = void 0;
3
+ exports.createOAuthAxios = exports.scopesOf = exports.availableScopes = exports.clientCredentialsFetcher = exports.clientCredentials = exports.OAuthClientCredentialsManager = void 0;
4
4
  /*
5
5
  * Enfuce nextgen SDK — OAuth token-management helper.
6
6
  *
@@ -26,9 +26,11 @@ exports.createOAuthAxios = exports.clientCredentialsFetcher = exports.clientCred
26
26
  * Server-side only — a client secret must never ship to a browser.
27
27
  */
28
28
  var tokenManager_1 = require("./tokenManager");
29
- Object.defineProperty(exports, "TokenManager", { enumerable: true, get: function () { return tokenManager_1.TokenManager; } });
29
+ Object.defineProperty(exports, "OAuthClientCredentialsManager", { enumerable: true, get: function () { return tokenManager_1.OAuthClientCredentialsManager; } });
30
30
  var clientCredentials_1 = require("./clientCredentials");
31
31
  Object.defineProperty(exports, "clientCredentials", { enumerable: true, get: function () { return clientCredentials_1.clientCredentials; } });
32
32
  Object.defineProperty(exports, "clientCredentialsFetcher", { enumerable: true, get: function () { return clientCredentials_1.clientCredentialsFetcher; } });
33
+ Object.defineProperty(exports, "availableScopes", { enumerable: true, get: function () { return clientCredentials_1.availableScopes; } });
34
+ Object.defineProperty(exports, "scopesOf", { enumerable: true, get: function () { return clientCredentials_1.scopesOf; } });
33
35
  var axios_1 = require("./axios");
34
36
  Object.defineProperty(exports, "createOAuthAxios", { enumerable: true, get: function () { return axios_1.createOAuthAxios; } });
@@ -11,14 +11,14 @@ export type TokenFetcher = () => Promise<AccessToken>;
11
11
  * client's `Configuration`:
12
12
  *
13
13
  * ```ts
14
- * const tokens = new TokenManager(fetcher);
14
+ * const tokens = new OAuthClientCredentialsManager(fetcher);
15
15
  * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
16
16
  * ```
17
17
  *
18
18
  * A token is considered expired once the clock passes `expiry - skew`. Concurrent
19
19
  * refreshes share a single in-flight promise, so the token endpoint is hit once.
20
20
  */
21
- export declare class TokenManager {
21
+ export declare class OAuthClientCredentialsManager {
22
22
  private readonly fetcher;
23
23
  private readonly skewSeconds;
24
24
  private readonly now;
@@ -16,20 +16,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
16
16
  });
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.TokenManager = void 0;
19
+ exports.OAuthClientCredentialsManager = void 0;
20
20
  /**
21
21
  * Caches an access token and refreshes it before expiry. Plug it into a generated
22
22
  * client's `Configuration`:
23
23
  *
24
24
  * ```ts
25
- * const tokens = new TokenManager(fetcher);
25
+ * const tokens = new OAuthClientCredentialsManager(fetcher);
26
26
  * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
27
27
  * ```
28
28
  *
29
29
  * A token is considered expired once the clock passes `expiry - skew`. Concurrent
30
30
  * refreshes share a single in-flight promise, so the token endpoint is hit once.
31
31
  */
32
- class TokenManager {
32
+ class OAuthClientCredentialsManager {
33
33
  constructor(fetcher, skewSeconds = 60, now = Date.now) {
34
34
  this.fetcher = fetcher;
35
35
  this.skewSeconds = skewSeconds;
@@ -78,4 +78,4 @@ class TokenManager {
78
78
  return this.inflight;
79
79
  }
80
80
  }
81
- exports.TokenManager = TokenManager;
81
+ exports.OAuthClientCredentialsManager = OAuthClientCredentialsManager;
package/dist/pin/api.d.ts CHANGED
@@ -75,6 +75,22 @@ export interface SetPinRequestBody {
75
75
  */
76
76
  'zpkIndex'?: number;
77
77
  }
78
+ export interface SetPinTzpkRequestBody {
79
+ /**
80
+ * Control ID that was returned in the [Request PIN Control Access Token Endpoint](https://nextgen-docs.enfuce.com/api/cards/post-card/create-pin-control-access-token).
81
+ */
82
+ 'pinControlId': string;
83
+ /**
84
+ * RSA 2048 public key in PEM format (X.509 SubjectPublicKeyInfo). The key may contain: - new lines, - the PEM headers (\"-----BEGIN PUBLIC KEY-----\" and \"-----END PUBLIC KEY-----\") The key must not contain any spaces.
85
+ */
86
+ 'pubKey': string;
87
+ }
88
+ export interface SetTzpkResponseBody {
89
+ /**
90
+ * Base64 encoded encrypted Terminal Zone PIN Key (TZPK), encrypted with the pubKey passed as input.
91
+ */
92
+ 'tzpk': string;
93
+ }
78
94
  export interface ViewPinRequestBody {
79
95
  /**
80
96
  * Control ID that was returned in the [Request PIN Control Access Token Endpoint](https://nextgen-docs.enfuce.com/api/cards/post-card/create-pin-control-access-token).
@@ -99,6 +115,15 @@ export interface ViewPinResponseBody {
99
115
  * PINOperationsUsingPKIApi - axios parameter creator
100
116
  */
101
117
  export declare const PINOperationsUsingPKIApiAxiosParamCreator: (configuration?: Configuration) => {
118
+ /**
119
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
120
+ * @summary Generate Set/Change PIN TZPK
121
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
122
+ * @param {string} [xAuditUser] Optional audit user header
123
+ * @param {*} [options] Override http request option.
124
+ * @throws {RequiredError}
125
+ */
126
+ setPinTzpk: (setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
102
127
  /**
103
128
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
104
129
  * @summary Retrieve Encrypted PIN
@@ -113,6 +138,15 @@ export declare const PINOperationsUsingPKIApiAxiosParamCreator: (configuration?:
113
138
  * PINOperationsUsingPKIApi - functional programming interface
114
139
  */
115
140
  export declare const PINOperationsUsingPKIApiFp: (configuration?: Configuration) => {
141
+ /**
142
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
143
+ * @summary Generate Set/Change PIN TZPK
144
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
145
+ * @param {string} [xAuditUser] Optional audit user header
146
+ * @param {*} [options] Override http request option.
147
+ * @throws {RequiredError}
148
+ */
149
+ setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SetTzpkResponseBody>>;
116
150
  /**
117
151
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
118
152
  * @summary Retrieve Encrypted PIN
@@ -127,6 +161,15 @@ export declare const PINOperationsUsingPKIApiFp: (configuration?: Configuration)
127
161
  * PINOperationsUsingPKIApi - factory interface
128
162
  */
129
163
  export declare const PINOperationsUsingPKIApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
164
+ /**
165
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
166
+ * @summary Generate Set/Change PIN TZPK
167
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
168
+ * @param {string} [xAuditUser] Optional audit user header
169
+ * @param {*} [options] Override http request option.
170
+ * @throws {RequiredError}
171
+ */
172
+ setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): AxiosPromise<SetTzpkResponseBody>;
130
173
  /**
131
174
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
132
175
  * @summary Retrieve Encrypted PIN
@@ -141,6 +184,15 @@ export declare const PINOperationsUsingPKIApiFactory: (configuration?: Configura
141
184
  * PINOperationsUsingPKIApi - object-oriented interface
142
185
  */
143
186
  export declare class PINOperationsUsingPKIApi extends BaseAPI {
187
+ /**
188
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
189
+ * @summary Generate Set/Change PIN TZPK
190
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
191
+ * @param {string} [xAuditUser] Optional audit user header
192
+ * @param {*} [options] Override http request option.
193
+ * @throws {RequiredError}
194
+ */
195
+ setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<SetTzpkResponseBody, any, {}>>;
144
196
  /**
145
197
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
146
198
  * @summary Retrieve Encrypted PIN