@enfuce/nextgen-sdk 0.0.5 → 0.0.7

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 (119) hide show
  1. package/README.md +28 -3
  2. package/dist/authorisation-control/client.d.ts +47 -0
  3. package/dist/authorisation-control/client.js +80 -0
  4. package/dist/authorisation-control/index.d.ts +1 -0
  5. package/dist/authorisation-control/index.js +1 -0
  6. package/dist/card/client.d.ts +57 -0
  7. package/dist/card/client.js +100 -0
  8. package/dist/card/index.d.ts +1 -0
  9. package/dist/card/index.js +1 -0
  10. package/dist/cardholder/client.d.ts +53 -0
  11. package/dist/cardholder/client.js +92 -0
  12. package/dist/cardholder/index.d.ts +1 -0
  13. package/dist/cardholder/index.js +1 -0
  14. package/dist/cards/client.d.ts +47 -0
  15. package/dist/cards/client.js +80 -0
  16. package/dist/cards/index.d.ts +1 -0
  17. package/dist/cards/index.js +1 -0
  18. package/dist/config/enfuceUrls.d.ts +20 -0
  19. package/dist/config/enfuceUrls.js +47 -0
  20. package/dist/config/index.d.ts +1 -0
  21. package/dist/config/index.js +22 -0
  22. package/dist/esm/authorisation-control/client.d.ts +47 -0
  23. package/dist/esm/authorisation-control/client.js +75 -0
  24. package/dist/esm/authorisation-control/index.d.ts +1 -0
  25. package/dist/esm/authorisation-control/index.js +1 -0
  26. package/dist/esm/card/client.d.ts +57 -0
  27. package/dist/esm/card/client.js +95 -0
  28. package/dist/esm/card/index.d.ts +1 -0
  29. package/dist/esm/card/index.js +1 -0
  30. package/dist/esm/cardholder/client.d.ts +53 -0
  31. package/dist/esm/cardholder/client.js +87 -0
  32. package/dist/esm/cardholder/index.d.ts +1 -0
  33. package/dist/esm/cardholder/index.js +1 -0
  34. package/dist/esm/cards/client.d.ts +47 -0
  35. package/dist/esm/cards/client.js +75 -0
  36. package/dist/esm/cards/index.d.ts +1 -0
  37. package/dist/esm/cards/index.js +1 -0
  38. package/dist/esm/config/enfuceUrls.d.ts +20 -0
  39. package/dist/esm/config/enfuceUrls.js +40 -0
  40. package/dist/esm/config/index.d.ts +1 -0
  41. package/dist/esm/config/index.js +14 -0
  42. package/dist/esm/exchange-rate/client.d.ts +51 -0
  43. package/dist/esm/exchange-rate/client.js +83 -0
  44. package/dist/esm/exchange-rate/index.d.ts +1 -0
  45. package/dist/esm/exchange-rate/index.js +1 -0
  46. package/dist/esm/index.d.ts +1 -0
  47. package/dist/esm/index.js +1 -0
  48. package/dist/esm/issuer-events/client.d.ts +47 -0
  49. package/dist/esm/issuer-events/client.js +75 -0
  50. package/dist/esm/issuer-events/index.d.ts +1 -0
  51. package/dist/esm/issuer-events/index.js +1 -0
  52. package/dist/esm/pin/client.d.ts +49 -0
  53. package/dist/esm/pin/client.js +79 -0
  54. package/dist/esm/pin/index.d.ts +1 -0
  55. package/dist/esm/pin/index.js +1 -0
  56. package/dist/esm/threeds/client.d.ts +47 -0
  57. package/dist/esm/threeds/client.js +75 -0
  58. package/dist/esm/threeds/index.d.ts +1 -0
  59. package/dist/esm/threeds/index.js +1 -0
  60. package/dist/esm/threeds-oob/client.d.ts +47 -0
  61. package/dist/esm/threeds-oob/client.js +75 -0
  62. package/dist/esm/threeds-oob/index.d.ts +1 -0
  63. package/dist/esm/threeds-oob/index.js +1 -0
  64. package/dist/esm/wallet/client.d.ts +61 -0
  65. package/dist/esm/wallet/client.js +103 -0
  66. package/dist/esm/wallet/index.d.ts +1 -0
  67. package/dist/esm/wallet/index.js +1 -0
  68. package/dist/exchange-rate/client.d.ts +51 -0
  69. package/dist/exchange-rate/client.js +88 -0
  70. package/dist/exchange-rate/index.d.ts +1 -0
  71. package/dist/exchange-rate/index.js +1 -0
  72. package/dist/index.d.ts +1 -0
  73. package/dist/index.js +2 -1
  74. package/dist/issuer-events/client.d.ts +47 -0
  75. package/dist/issuer-events/client.js +80 -0
  76. package/dist/issuer-events/index.d.ts +1 -0
  77. package/dist/issuer-events/index.js +1 -0
  78. package/dist/pin/client.d.ts +49 -0
  79. package/dist/pin/client.js +84 -0
  80. package/dist/pin/index.d.ts +1 -0
  81. package/dist/pin/index.js +1 -0
  82. package/dist/threeds/client.d.ts +47 -0
  83. package/dist/threeds/client.js +80 -0
  84. package/dist/threeds/index.d.ts +1 -0
  85. package/dist/threeds/index.js +1 -0
  86. package/dist/threeds-oob/client.d.ts +47 -0
  87. package/dist/threeds-oob/client.js +80 -0
  88. package/dist/threeds-oob/index.d.ts +1 -0
  89. package/dist/threeds-oob/index.js +1 -0
  90. package/dist/wallet/client.d.ts +61 -0
  91. package/dist/wallet/client.js +108 -0
  92. package/dist/wallet/index.d.ts +1 -0
  93. package/dist/wallet/index.js +1 -0
  94. package/package.json +1 -1
  95. package/src/authorisation-control/client.ts +86 -0
  96. package/src/authorisation-control/index.ts +2 -0
  97. package/src/card/client.ts +116 -0
  98. package/src/card/index.ts +2 -0
  99. package/src/cardholder/client.ts +104 -0
  100. package/src/cardholder/index.ts +2 -0
  101. package/src/cards/client.ts +86 -0
  102. package/src/cards/index.ts +2 -0
  103. package/src/config/enfuceUrls.ts +57 -0
  104. package/src/config/index.ts +21 -0
  105. package/src/exchange-rate/client.ts +98 -0
  106. package/src/exchange-rate/index.ts +2 -0
  107. package/src/index.ts +1 -0
  108. package/src/issuer-events/client.ts +86 -0
  109. package/src/issuer-events/index.ts +2 -0
  110. package/src/pin/client.ts +92 -0
  111. package/src/pin/index.ts +2 -0
  112. package/src/threeds/client.ts +86 -0
  113. package/src/threeds/index.ts +2 -0
  114. package/src/threeds-oob/client.ts +86 -0
  115. package/src/threeds-oob/index.ts +2 -0
  116. package/src/wallet/client.ts +128 -0
  117. package/src/wallet/index.ts +2 -0
  118. package/test/config.test.ts +33 -0
  119. package/test/exchange-rate-client.test.ts +36 -0
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletClientBuilder = exports.WalletClient = void 0;
4
+ /*
5
+ * Enfuce nextgen SDK — fluent module client.
6
+ *
7
+ * GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
8
+ * API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
9
+ * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
10
+ */
11
+ const axios_1 = require("axios");
12
+ const oauth_1 = require("../oauth");
13
+ const configuration_1 = require("./configuration");
14
+ const api_1 = require("./api");
15
+ /**
16
+ * Fluent entry point for this module. Build one with {@link WalletClient.builder}:
17
+ *
18
+ * ```ts
19
+ * const client = WalletClient.builder()
20
+ * .baseUrl('https://api.example.com/...')
21
+ * .oauth(tokens)
22
+ * .build();
23
+ * ```
24
+ */
25
+ class WalletClient {
26
+ constructor(
27
+ /** The axios instance — OAuth interceptors and any customizations already applied. */
28
+ http,
29
+ /** The module configuration — base path applied. */
30
+ configuration) {
31
+ this.http = http;
32
+ this.configuration = configuration;
33
+ }
34
+ /** Build any API in this module bound to this client (for APIs without a named getter). */
35
+ api(factory) {
36
+ return factory(this.configuration, this.http);
37
+ }
38
+ /** {@link ActivateTokenApi} bound to this client. */
39
+ activateTokenApi() {
40
+ return new api_1.ActivateTokenApi(this.configuration, undefined, this.http);
41
+ }
42
+ /** {@link DeactivateTokenApi} bound to this client. */
43
+ deactivateTokenApi() {
44
+ return new api_1.DeactivateTokenApi(this.configuration, undefined, this.http);
45
+ }
46
+ /** {@link EligibleTokenRequestorsApi} bound to this client. */
47
+ eligibleTokenRequestorsApi() {
48
+ return new api_1.EligibleTokenRequestorsApi(this.configuration, undefined, this.http);
49
+ }
50
+ /** {@link GetTokensApi} bound to this client. */
51
+ getTokensApi() {
52
+ return new api_1.GetTokensApi(this.configuration, undefined, this.http);
53
+ }
54
+ /** {@link PushCardsApi} bound to this client. */
55
+ pushCardsApi() {
56
+ return new api_1.PushCardsApi(this.configuration, undefined, this.http);
57
+ }
58
+ /** {@link PushProvisionApi} bound to this client. */
59
+ pushProvisionApi() {
60
+ return new api_1.PushProvisionApi(this.configuration, undefined, this.http);
61
+ }
62
+ /** {@link SuspendTokenApi} bound to this client. */
63
+ suspendTokenApi() {
64
+ return new api_1.SuspendTokenApi(this.configuration, undefined, this.http);
65
+ }
66
+ /** {@link UnsuspendTokenApi} bound to this client. */
67
+ unsuspendTokenApi() {
68
+ return new api_1.UnsuspendTokenApi(this.configuration, undefined, this.http);
69
+ }
70
+ static builder() {
71
+ return new WalletClientBuilder();
72
+ }
73
+ }
74
+ exports.WalletClient = WalletClient;
75
+ /** Builds a {@link WalletClient}: base URL + optional OAuth + transport customization. */
76
+ class WalletClientBuilder {
77
+ constructor() {
78
+ this._customizers = [];
79
+ }
80
+ /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
81
+ baseUrl(baseUrl) {
82
+ this._baseUrl = baseUrl;
83
+ return this;
84
+ }
85
+ /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
86
+ oauth(tokens) {
87
+ this._tokens = tokens;
88
+ return this;
89
+ }
90
+ /**
91
+ * Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
92
+ * default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
93
+ * calls run in order.
94
+ */
95
+ configure(customizer) {
96
+ this._customizers.push(customizer);
97
+ return this;
98
+ }
99
+ build() {
100
+ const http = this._tokens ? (0, oauth_1.createOAuthAxios)(this._tokens) : axios_1.default.create();
101
+ for (const customizer of this._customizers) {
102
+ customizer(http);
103
+ }
104
+ const configuration = new configuration_1.Configuration({ basePath: this._baseUrl });
105
+ return new WalletClient(http, configuration);
106
+ }
107
+ }
108
+ exports.WalletClientBuilder = WalletClientBuilder;
@@ -11,3 +11,4 @@
11
11
  */
12
12
  export * from "./api";
13
13
  export * from "./configuration";
14
+ export * from './client';
@@ -29,3 +29,4 @@ 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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfuce/nextgen-sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Enfuce nextgen client SDK (TypeScript). One namespaced export per API.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,86 @@
1
+ /*
2
+ * Enfuce nextgen SDK — fluent module client.
3
+ *
4
+ * GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
5
+ * API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
6
+ * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
+ */
8
+ import globalAxios, { type AxiosInstance } from 'axios';
9
+ import { createOAuthAxios, type TokenManager } from '../oauth';
10
+ import { Configuration } from './configuration';
11
+ import {
12
+ AuthorisationRequestAPIApi,
13
+ } from './api';
14
+
15
+ /**
16
+ * Fluent entry point for this module. Build one with {@link AuthorisationControlClient.builder}:
17
+ *
18
+ * ```ts
19
+ * const client = AuthorisationControlClient.builder()
20
+ * .baseUrl('https://api.example.com/...')
21
+ * .oauth(tokens)
22
+ * .build();
23
+ * ```
24
+ */
25
+ export class AuthorisationControlClient {
26
+
27
+ constructor(
28
+ /** The axios instance — OAuth interceptors and any customizations already applied. */
29
+ readonly http: AxiosInstance,
30
+ /** The module configuration — base path applied. */
31
+ readonly configuration: Configuration,
32
+ ) {}
33
+
34
+ /** Build any API in this module bound to this client (for APIs without a named getter). */
35
+ api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T {
36
+ return factory(this.configuration, this.http);
37
+ }
38
+
39
+ /** {@link AuthorisationRequestAPIApi} bound to this client. */
40
+ authorisationRequestAPIApi(): AuthorisationRequestAPIApi {
41
+ return new AuthorisationRequestAPIApi(this.configuration, undefined, this.http);
42
+ }
43
+
44
+ static builder(): AuthorisationControlClientBuilder {
45
+ return new AuthorisationControlClientBuilder();
46
+ }
47
+ }
48
+
49
+ /** Builds a {@link AuthorisationControlClient}: base URL + optional OAuth + transport customization. */
50
+ export class AuthorisationControlClientBuilder {
51
+
52
+ private _baseUrl?: string;
53
+ private _tokens?: TokenManager;
54
+ private _customizers: Array<(http: AxiosInstance) => void> = [];
55
+
56
+ /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
57
+ baseUrl(baseUrl: string): this {
58
+ this._baseUrl = baseUrl;
59
+ return this;
60
+ }
61
+
62
+ /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
63
+ oauth(tokens: TokenManager): this {
64
+ this._tokens = tokens;
65
+ return this;
66
+ }
67
+
68
+ /**
69
+ * Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
70
+ * default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
71
+ * calls run in order.
72
+ */
73
+ configure(customizer: (http: AxiosInstance) => void): this {
74
+ this._customizers.push(customizer);
75
+ return this;
76
+ }
77
+
78
+ build(): AuthorisationControlClient {
79
+ const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
80
+ for (const customizer of this._customizers) {
81
+ customizer(http);
82
+ }
83
+ const configuration = new Configuration({ basePath: this._baseUrl });
84
+ return new AuthorisationControlClient(http, configuration);
85
+ }
86
+ }
@@ -16,3 +16,5 @@
16
16
  export * from "./api";
17
17
  export * from "./configuration";
18
18
 
19
+
20
+ export * from './client';
@@ -0,0 +1,116 @@
1
+ /*
2
+ * Enfuce nextgen SDK — fluent module client.
3
+ *
4
+ * GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
5
+ * API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
6
+ * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
+ */
8
+ import globalAxios, { type AxiosInstance } from 'axios';
9
+ import { createOAuthAxios, type TokenManager } from '../oauth';
10
+ import { Configuration } from './configuration';
11
+ import {
12
+ CreateCardApi,
13
+ CreatePINControlAccessTokenApi,
14
+ GetCardApi,
15
+ GetCardPaymentInfoApi,
16
+ GetPlasticManufacturingHistoryApi,
17
+ UpdateCardApi,
18
+ } from './api';
19
+
20
+ /**
21
+ * Fluent entry point for this module. Build one with {@link CardClient.builder}:
22
+ *
23
+ * ```ts
24
+ * const client = CardClient.builder()
25
+ * .baseUrl('https://api.example.com/...')
26
+ * .oauth(tokens)
27
+ * .build();
28
+ * ```
29
+ */
30
+ export class CardClient {
31
+
32
+ constructor(
33
+ /** The axios instance — OAuth interceptors and any customizations already applied. */
34
+ readonly http: AxiosInstance,
35
+ /** The module configuration — base path applied. */
36
+ readonly configuration: Configuration,
37
+ ) {}
38
+
39
+ /** Build any API in this module bound to this client (for APIs without a named getter). */
40
+ api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T {
41
+ return factory(this.configuration, this.http);
42
+ }
43
+
44
+ /** {@link CreateCardApi} bound to this client. */
45
+ createCardApi(): CreateCardApi {
46
+ return new CreateCardApi(this.configuration, undefined, this.http);
47
+ }
48
+
49
+ /** {@link CreatePINControlAccessTokenApi} bound to this client. */
50
+ createPINControlAccessTokenApi(): CreatePINControlAccessTokenApi {
51
+ return new CreatePINControlAccessTokenApi(this.configuration, undefined, this.http);
52
+ }
53
+
54
+ /** {@link GetCardApi} bound to this client. */
55
+ getCardApi(): GetCardApi {
56
+ return new GetCardApi(this.configuration, undefined, this.http);
57
+ }
58
+
59
+ /** {@link GetCardPaymentInfoApi} bound to this client. */
60
+ getCardPaymentInfoApi(): GetCardPaymentInfoApi {
61
+ return new GetCardPaymentInfoApi(this.configuration, undefined, this.http);
62
+ }
63
+
64
+ /** {@link GetPlasticManufacturingHistoryApi} bound to this client. */
65
+ getPlasticManufacturingHistoryApi(): GetPlasticManufacturingHistoryApi {
66
+ return new GetPlasticManufacturingHistoryApi(this.configuration, undefined, this.http);
67
+ }
68
+
69
+ /** {@link UpdateCardApi} bound to this client. */
70
+ updateCardApi(): UpdateCardApi {
71
+ return new UpdateCardApi(this.configuration, undefined, this.http);
72
+ }
73
+
74
+ static builder(): CardClientBuilder {
75
+ return new CardClientBuilder();
76
+ }
77
+ }
78
+
79
+ /** Builds a {@link CardClient}: base URL + optional OAuth + transport customization. */
80
+ export class CardClientBuilder {
81
+
82
+ private _baseUrl?: string;
83
+ private _tokens?: TokenManager;
84
+ private _customizers: Array<(http: AxiosInstance) => void> = [];
85
+
86
+ /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
87
+ baseUrl(baseUrl: string): this {
88
+ this._baseUrl = baseUrl;
89
+ return this;
90
+ }
91
+
92
+ /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
93
+ oauth(tokens: TokenManager): this {
94
+ this._tokens = tokens;
95
+ return this;
96
+ }
97
+
98
+ /**
99
+ * Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
100
+ * default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
101
+ * calls run in order.
102
+ */
103
+ configure(customizer: (http: AxiosInstance) => void): this {
104
+ this._customizers.push(customizer);
105
+ return this;
106
+ }
107
+
108
+ build(): CardClient {
109
+ const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
110
+ for (const customizer of this._customizers) {
111
+ customizer(http);
112
+ }
113
+ const configuration = new Configuration({ basePath: this._baseUrl });
114
+ return new CardClient(http, configuration);
115
+ }
116
+ }
package/src/card/index.ts CHANGED
@@ -16,3 +16,5 @@
16
16
  export * from "./api";
17
17
  export * from "./configuration";
18
18
 
19
+
20
+ export * from './client';
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Enfuce nextgen SDK — fluent module client.
3
+ *
4
+ * GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
5
+ * API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
6
+ * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
+ */
8
+ import globalAxios, { type AxiosInstance } from 'axios';
9
+ import { createOAuthAxios, type TokenManager } from '../oauth';
10
+ import { Configuration } from './configuration';
11
+ import {
12
+ CreateCardholderApi,
13
+ GetCardholderApi,
14
+ GetCardsByCardholderIdApi,
15
+ UpdateCardholderApi,
16
+ } from './api';
17
+
18
+ /**
19
+ * Fluent entry point for this module. Build one with {@link CardholderClient.builder}:
20
+ *
21
+ * ```ts
22
+ * const client = CardholderClient.builder()
23
+ * .baseUrl('https://api.example.com/...')
24
+ * .oauth(tokens)
25
+ * .build();
26
+ * ```
27
+ */
28
+ export class CardholderClient {
29
+
30
+ constructor(
31
+ /** The axios instance — OAuth interceptors and any customizations already applied. */
32
+ readonly http: AxiosInstance,
33
+ /** The module configuration — base path applied. */
34
+ readonly configuration: Configuration,
35
+ ) {}
36
+
37
+ /** Build any API in this module bound to this client (for APIs without a named getter). */
38
+ api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T {
39
+ return factory(this.configuration, this.http);
40
+ }
41
+
42
+ /** {@link CreateCardholderApi} bound to this client. */
43
+ createCardholderApi(): CreateCardholderApi {
44
+ return new CreateCardholderApi(this.configuration, undefined, this.http);
45
+ }
46
+
47
+ /** {@link GetCardholderApi} bound to this client. */
48
+ getCardholderApi(): GetCardholderApi {
49
+ return new GetCardholderApi(this.configuration, undefined, this.http);
50
+ }
51
+
52
+ /** {@link GetCardsByCardholderIdApi} bound to this client. */
53
+ getCardsByCardholderIdApi(): GetCardsByCardholderIdApi {
54
+ return new GetCardsByCardholderIdApi(this.configuration, undefined, this.http);
55
+ }
56
+
57
+ /** {@link UpdateCardholderApi} bound to this client. */
58
+ updateCardholderApi(): UpdateCardholderApi {
59
+ return new UpdateCardholderApi(this.configuration, undefined, this.http);
60
+ }
61
+
62
+ static builder(): CardholderClientBuilder {
63
+ return new CardholderClientBuilder();
64
+ }
65
+ }
66
+
67
+ /** Builds a {@link CardholderClient}: base URL + optional OAuth + transport customization. */
68
+ export class CardholderClientBuilder {
69
+
70
+ private _baseUrl?: string;
71
+ private _tokens?: TokenManager;
72
+ private _customizers: Array<(http: AxiosInstance) => void> = [];
73
+
74
+ /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
75
+ baseUrl(baseUrl: string): this {
76
+ this._baseUrl = baseUrl;
77
+ return this;
78
+ }
79
+
80
+ /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
81
+ oauth(tokens: TokenManager): this {
82
+ this._tokens = tokens;
83
+ return this;
84
+ }
85
+
86
+ /**
87
+ * Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
88
+ * default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
89
+ * calls run in order.
90
+ */
91
+ configure(customizer: (http: AxiosInstance) => void): this {
92
+ this._customizers.push(customizer);
93
+ return this;
94
+ }
95
+
96
+ build(): CardholderClient {
97
+ const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
98
+ for (const customizer of this._customizers) {
99
+ customizer(http);
100
+ }
101
+ const configuration = new Configuration({ basePath: this._baseUrl });
102
+ return new CardholderClient(http, configuration);
103
+ }
104
+ }
@@ -16,3 +16,5 @@
16
16
  export * from "./api";
17
17
  export * from "./configuration";
18
18
 
19
+
20
+ export * from './client';
@@ -0,0 +1,86 @@
1
+ /*
2
+ * Enfuce nextgen SDK — fluent module client.
3
+ *
4
+ * GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
5
+ * API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
6
+ * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
+ */
8
+ import globalAxios, { type AxiosInstance } from 'axios';
9
+ import { createOAuthAxios, type TokenManager } from '../oauth';
10
+ import { Configuration } from './configuration';
11
+ import {
12
+ CardsApi,
13
+ } from './api';
14
+
15
+ /**
16
+ * Fluent entry point for this module. Build one with {@link CardsClient.builder}:
17
+ *
18
+ * ```ts
19
+ * const client = CardsClient.builder()
20
+ * .baseUrl('https://api.example.com/...')
21
+ * .oauth(tokens)
22
+ * .build();
23
+ * ```
24
+ */
25
+ export class CardsClient {
26
+
27
+ constructor(
28
+ /** The axios instance — OAuth interceptors and any customizations already applied. */
29
+ readonly http: AxiosInstance,
30
+ /** The module configuration — base path applied. */
31
+ readonly configuration: Configuration,
32
+ ) {}
33
+
34
+ /** Build any API in this module bound to this client (for APIs without a named getter). */
35
+ api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T {
36
+ return factory(this.configuration, this.http);
37
+ }
38
+
39
+ /** {@link CardsApi} bound to this client. */
40
+ cardsApi(): CardsApi {
41
+ return new CardsApi(this.configuration, undefined, this.http);
42
+ }
43
+
44
+ static builder(): CardsClientBuilder {
45
+ return new CardsClientBuilder();
46
+ }
47
+ }
48
+
49
+ /** Builds a {@link CardsClient}: base URL + optional OAuth + transport customization. */
50
+ export class CardsClientBuilder {
51
+
52
+ private _baseUrl?: string;
53
+ private _tokens?: TokenManager;
54
+ private _customizers: Array<(http: AxiosInstance) => void> = [];
55
+
56
+ /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
57
+ baseUrl(baseUrl: string): this {
58
+ this._baseUrl = baseUrl;
59
+ return this;
60
+ }
61
+
62
+ /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
63
+ oauth(tokens: TokenManager): this {
64
+ this._tokens = tokens;
65
+ return this;
66
+ }
67
+
68
+ /**
69
+ * Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
70
+ * default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
71
+ * calls run in order.
72
+ */
73
+ configure(customizer: (http: AxiosInstance) => void): this {
74
+ this._customizers.push(customizer);
75
+ return this;
76
+ }
77
+
78
+ build(): CardsClient {
79
+ const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
80
+ for (const customizer of this._customizers) {
81
+ customizer(http);
82
+ }
83
+ const configuration = new Configuration({ basePath: this._baseUrl });
84
+ return new CardsClient(http, configuration);
85
+ }
86
+ }
@@ -16,3 +16,5 @@
16
16
  export * from "./api";
17
17
  export * from "./configuration";
18
18
 
19
+
20
+ export * from './client';
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
5
+ * preserved across SDK regeneration (see scripts/generate.sh). Do not expect
6
+ * OpenAPI Generator to (re)produce it.
7
+ */
8
+
9
+ /**
10
+ * Identifies a single Enfuce deployment by its `tenant` and `environment` — the two variable
11
+ * segments of every Enfuce host, e.g. `api.<tenant>.<environment>.mycore.enfuce.com`.
12
+ */
13
+ export interface TenantEnvironment {
14
+ /** Tenant segment, e.g. `swile`, `shine`, `cad`. */
15
+ tenant: string;
16
+ /** Environment segment, e.g. `ext-uat1-sandbox`, `eu.live.prod`. */
17
+ environment: string;
18
+ }
19
+
20
+ const DOMAIN_SUFFIX = 'mycore.enfuce.com';
21
+
22
+ function hostSuffix(te: TenantEnvironment): string {
23
+ const tenant = te?.tenant?.trim();
24
+ const environment = te?.environment?.trim();
25
+ if (!tenant) {
26
+ throw new Error('tenant must not be empty');
27
+ }
28
+ if (!environment) {
29
+ throw new Error('environment must not be empty');
30
+ }
31
+ return `${tenant}.${environment}.${DOMAIN_SUFFIX}`;
32
+ }
33
+
34
+ /** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
35
+ export function apiBaseUrl(te: TenantEnvironment): string {
36
+ return `https://api.${hostSuffix(te)}`;
37
+ }
38
+
39
+ /** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
40
+ export function issuerBaseUrl(te: TenantEnvironment): string {
41
+ return `${apiBaseUrl(te)}/issuer`;
42
+ }
43
+
44
+ /** `.../processor` — processor domain (transactions, 3DS). */
45
+ export function processorBaseUrl(te: TenantEnvironment): string {
46
+ return `${apiBaseUrl(te)}/processor`;
47
+ }
48
+
49
+ /** `.../exchange-rates-api` — exchange-rate domain. */
50
+ export function exchangeRateBaseUrl(te: TenantEnvironment): string {
51
+ return `${apiBaseUrl(te)}/exchange-rates-api`;
52
+ }
53
+
54
+ /** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
55
+ export function tokenUrl(te: TenantEnvironment): string {
56
+ return `https://auth.${hostSuffix(te)}/oauth2/token`;
57
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
5
+ * preserved across SDK regeneration (see scripts/generate.sh). It is re-exported
6
+ * from the package barrel as `config`:
7
+ *
8
+ * import { config, cardholder, oauth } from '@enfuce/nextgen-sdk';
9
+ *
10
+ * const te = { tenant: 'swile', environment: 'ext-uat1-sandbox' };
11
+ * const conf = new cardholder.Configuration({ basePath: config.issuerBaseUrl(te) });
12
+ * const tokens = oauth.clientCredentials({ tokenUrl: config.tokenUrl(te), clientId, clientSecret });
13
+ */
14
+ export {
15
+ TenantEnvironment,
16
+ apiBaseUrl,
17
+ issuerBaseUrl,
18
+ processorBaseUrl,
19
+ exchangeRateBaseUrl,
20
+ tokenUrl,
21
+ } from './enfuceUrls';