@enfuce/nextgen-sdk 0.0.4 → 0.0.6
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.
- package/README.md +28 -3
- package/dist/authorisation-control/client.d.ts +47 -0
- package/dist/authorisation-control/client.js +80 -0
- package/dist/authorisation-control/index.d.ts +1 -0
- package/dist/authorisation-control/index.js +1 -0
- package/dist/card/client.d.ts +57 -0
- package/dist/card/client.js +100 -0
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.js +1 -0
- package/dist/cardholder/client.d.ts +53 -0
- package/dist/cardholder/client.js +92 -0
- package/dist/cardholder/index.d.ts +1 -0
- package/dist/cardholder/index.js +1 -0
- package/dist/cards/client.d.ts +47 -0
- package/dist/cards/client.js +80 -0
- package/dist/cards/index.d.ts +1 -0
- package/dist/cards/index.js +1 -0
- package/dist/esm/authorisation-control/client.d.ts +47 -0
- package/dist/esm/authorisation-control/client.js +75 -0
- package/dist/esm/authorisation-control/index.d.ts +1 -0
- package/dist/esm/authorisation-control/index.js +1 -0
- package/dist/esm/card/client.d.ts +57 -0
- package/dist/esm/card/client.js +95 -0
- package/dist/esm/card/index.d.ts +1 -0
- package/dist/esm/card/index.js +1 -0
- package/dist/esm/cardholder/client.d.ts +53 -0
- package/dist/esm/cardholder/client.js +87 -0
- package/dist/esm/cardholder/index.d.ts +1 -0
- package/dist/esm/cardholder/index.js +1 -0
- package/dist/esm/cards/client.d.ts +47 -0
- package/dist/esm/cards/client.js +75 -0
- package/dist/esm/cards/index.d.ts +1 -0
- package/dist/esm/cards/index.js +1 -0
- package/dist/esm/exchange-rate/client.d.ts +51 -0
- package/dist/esm/exchange-rate/client.js +83 -0
- package/dist/esm/exchange-rate/index.d.ts +1 -0
- package/dist/esm/exchange-rate/index.js +1 -0
- package/dist/esm/issuer-events/client.d.ts +47 -0
- package/dist/esm/issuer-events/client.js +75 -0
- package/dist/esm/issuer-events/index.d.ts +1 -0
- package/dist/esm/issuer-events/index.js +1 -0
- package/dist/esm/oauth/axios.d.ts +10 -4
- package/dist/esm/oauth/axios.js +15 -4
- package/dist/esm/oauth/index.js +5 -2
- package/dist/esm/pin/client.d.ts +49 -0
- package/dist/esm/pin/client.js +79 -0
- package/dist/esm/pin/index.d.ts +1 -0
- package/dist/esm/pin/index.js +1 -0
- package/dist/esm/threeds/client.d.ts +47 -0
- package/dist/esm/threeds/client.js +75 -0
- package/dist/esm/threeds/index.d.ts +1 -0
- package/dist/esm/threeds/index.js +1 -0
- package/dist/esm/threeds-oob/client.d.ts +47 -0
- package/dist/esm/threeds-oob/client.js +75 -0
- package/dist/esm/threeds-oob/index.d.ts +1 -0
- package/dist/esm/threeds-oob/index.js +1 -0
- package/dist/esm/wallet/client.d.ts +61 -0
- package/dist/esm/wallet/client.js +103 -0
- package/dist/esm/wallet/index.d.ts +1 -0
- package/dist/esm/wallet/index.js +1 -0
- package/dist/exchange-rate/client.d.ts +51 -0
- package/dist/exchange-rate/client.js +88 -0
- package/dist/exchange-rate/index.d.ts +1 -0
- package/dist/exchange-rate/index.js +1 -0
- package/dist/issuer-events/client.d.ts +47 -0
- package/dist/issuer-events/client.js +80 -0
- package/dist/issuer-events/index.d.ts +1 -0
- package/dist/issuer-events/index.js +1 -0
- package/dist/oauth/axios.d.ts +10 -4
- package/dist/oauth/axios.js +15 -4
- package/dist/oauth/index.js +5 -2
- package/dist/pin/client.d.ts +49 -0
- package/dist/pin/client.js +84 -0
- package/dist/pin/index.d.ts +1 -0
- package/dist/pin/index.js +1 -0
- package/dist/threeds/client.d.ts +47 -0
- package/dist/threeds/client.js +80 -0
- package/dist/threeds/index.d.ts +1 -0
- package/dist/threeds/index.js +1 -0
- package/dist/threeds-oob/client.d.ts +47 -0
- package/dist/threeds-oob/client.js +80 -0
- package/dist/threeds-oob/index.d.ts +1 -0
- package/dist/threeds-oob/index.js +1 -0
- package/dist/wallet/client.d.ts +61 -0
- package/dist/wallet/client.js +108 -0
- package/dist/wallet/index.d.ts +1 -0
- package/dist/wallet/index.js +1 -0
- package/package.json +1 -1
- package/src/authorisation-control/client.ts +86 -0
- package/src/authorisation-control/index.ts +2 -0
- package/src/card/client.ts +116 -0
- package/src/card/index.ts +2 -0
- package/src/cardholder/client.ts +104 -0
- package/src/cardholder/index.ts +2 -0
- package/src/cards/client.ts +86 -0
- package/src/cards/index.ts +2 -0
- package/src/exchange-rate/client.ts +98 -0
- package/src/exchange-rate/index.ts +2 -0
- package/src/issuer-events/client.ts +86 -0
- package/src/issuer-events/index.ts +2 -0
- package/src/oauth/axios.ts +16 -4
- package/src/oauth/index.ts +5 -2
- package/src/pin/client.ts +92 -0
- package/src/pin/index.ts +2 -0
- package/src/threeds/client.ts +86 -0
- package/src/threeds/index.ts +2 -0
- package/src/threeds-oob/client.ts +86 -0
- package/src/threeds-oob/index.ts +2 -0
- package/src/wallet/client.ts +128 -0
- package/src/wallet/index.ts +2 -0
- package/test/exchange-rate-client.test.ts +36 -0
- package/test/oauth.test.ts +19 -0
|
@@ -0,0 +1,75 @@
|
|
|
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 from 'axios';
|
|
9
|
+
import { createOAuthAxios } from '../oauth';
|
|
10
|
+
import { Configuration } from './configuration';
|
|
11
|
+
import { OOBAuthenticationChallengeWebhookNotificationApi, } from './api';
|
|
12
|
+
/**
|
|
13
|
+
* Fluent entry point for this module. Build one with {@link ThreedsOobClient.builder}:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const client = ThreedsOobClient.builder()
|
|
17
|
+
* .baseUrl('https://api.example.com/...')
|
|
18
|
+
* .oauth(tokens)
|
|
19
|
+
* .build();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class ThreedsOobClient {
|
|
23
|
+
constructor(
|
|
24
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
25
|
+
http,
|
|
26
|
+
/** The module configuration — base path applied. */
|
|
27
|
+
configuration) {
|
|
28
|
+
this.http = http;
|
|
29
|
+
this.configuration = configuration;
|
|
30
|
+
}
|
|
31
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
32
|
+
api(factory) {
|
|
33
|
+
return factory(this.configuration, this.http);
|
|
34
|
+
}
|
|
35
|
+
/** {@link OOBAuthenticationChallengeWebhookNotificationApi} bound to this client. */
|
|
36
|
+
oOBAuthenticationChallengeWebhookNotificationApi() {
|
|
37
|
+
return new OOBAuthenticationChallengeWebhookNotificationApi(this.configuration, undefined, this.http);
|
|
38
|
+
}
|
|
39
|
+
static builder() {
|
|
40
|
+
return new ThreedsOobClientBuilder();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Builds a {@link ThreedsOobClient}: base URL + optional OAuth + transport customization. */
|
|
44
|
+
export class ThreedsOobClientBuilder {
|
|
45
|
+
constructor() {
|
|
46
|
+
this._customizers = [];
|
|
47
|
+
}
|
|
48
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
49
|
+
baseUrl(baseUrl) {
|
|
50
|
+
this._baseUrl = baseUrl;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
54
|
+
oauth(tokens) {
|
|
55
|
+
this._tokens = tokens;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
60
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
61
|
+
* calls run in order.
|
|
62
|
+
*/
|
|
63
|
+
configure(customizer) {
|
|
64
|
+
this._customizers.push(customizer);
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
build() {
|
|
68
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
69
|
+
for (const customizer of this._customizers) {
|
|
70
|
+
customizer(http);
|
|
71
|
+
}
|
|
72
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
73
|
+
return new ThreedsOobClient(http, configuration);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
import { type TokenManager } from '../oauth';
|
|
3
|
+
import { Configuration } from './configuration';
|
|
4
|
+
import { ActivateTokenApi, DeactivateTokenApi, EligibleTokenRequestorsApi, GetTokensApi, PushCardsApi, PushProvisionApi, SuspendTokenApi, UnsuspendTokenApi } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Fluent entry point for this module. Build one with {@link WalletClient.builder}:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = WalletClient.builder()
|
|
10
|
+
* .baseUrl('https://api.example.com/...')
|
|
11
|
+
* .oauth(tokens)
|
|
12
|
+
* .build();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class WalletClient {
|
|
16
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
17
|
+
readonly http: AxiosInstance;
|
|
18
|
+
/** The module configuration — base path applied. */
|
|
19
|
+
readonly configuration: Configuration;
|
|
20
|
+
constructor(
|
|
21
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
22
|
+
http: AxiosInstance,
|
|
23
|
+
/** The module configuration — base path applied. */
|
|
24
|
+
configuration: Configuration);
|
|
25
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
26
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
|
|
27
|
+
/** {@link ActivateTokenApi} bound to this client. */
|
|
28
|
+
activateTokenApi(): ActivateTokenApi;
|
|
29
|
+
/** {@link DeactivateTokenApi} bound to this client. */
|
|
30
|
+
deactivateTokenApi(): DeactivateTokenApi;
|
|
31
|
+
/** {@link EligibleTokenRequestorsApi} bound to this client. */
|
|
32
|
+
eligibleTokenRequestorsApi(): EligibleTokenRequestorsApi;
|
|
33
|
+
/** {@link GetTokensApi} bound to this client. */
|
|
34
|
+
getTokensApi(): GetTokensApi;
|
|
35
|
+
/** {@link PushCardsApi} bound to this client. */
|
|
36
|
+
pushCardsApi(): PushCardsApi;
|
|
37
|
+
/** {@link PushProvisionApi} bound to this client. */
|
|
38
|
+
pushProvisionApi(): PushProvisionApi;
|
|
39
|
+
/** {@link SuspendTokenApi} bound to this client. */
|
|
40
|
+
suspendTokenApi(): SuspendTokenApi;
|
|
41
|
+
/** {@link UnsuspendTokenApi} bound to this client. */
|
|
42
|
+
unsuspendTokenApi(): UnsuspendTokenApi;
|
|
43
|
+
static builder(): WalletClientBuilder;
|
|
44
|
+
}
|
|
45
|
+
/** Builds a {@link WalletClient}: base URL + optional OAuth + transport customization. */
|
|
46
|
+
export declare class WalletClientBuilder {
|
|
47
|
+
private _baseUrl?;
|
|
48
|
+
private _tokens?;
|
|
49
|
+
private _customizers;
|
|
50
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
51
|
+
baseUrl(baseUrl: string): this;
|
|
52
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
53
|
+
oauth(tokens: TokenManager): this;
|
|
54
|
+
/**
|
|
55
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
56
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
57
|
+
* calls run in order.
|
|
58
|
+
*/
|
|
59
|
+
configure(customizer: (http: AxiosInstance) => void): this;
|
|
60
|
+
build(): WalletClient;
|
|
61
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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 from 'axios';
|
|
9
|
+
import { createOAuthAxios } from '../oauth';
|
|
10
|
+
import { Configuration } from './configuration';
|
|
11
|
+
import { ActivateTokenApi, DeactivateTokenApi, EligibleTokenRequestorsApi, GetTokensApi, PushCardsApi, PushProvisionApi, SuspendTokenApi, UnsuspendTokenApi, } from './api';
|
|
12
|
+
/**
|
|
13
|
+
* Fluent entry point for this module. Build one with {@link WalletClient.builder}:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const client = WalletClient.builder()
|
|
17
|
+
* .baseUrl('https://api.example.com/...')
|
|
18
|
+
* .oauth(tokens)
|
|
19
|
+
* .build();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class WalletClient {
|
|
23
|
+
constructor(
|
|
24
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
25
|
+
http,
|
|
26
|
+
/** The module configuration — base path applied. */
|
|
27
|
+
configuration) {
|
|
28
|
+
this.http = http;
|
|
29
|
+
this.configuration = configuration;
|
|
30
|
+
}
|
|
31
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
32
|
+
api(factory) {
|
|
33
|
+
return factory(this.configuration, this.http);
|
|
34
|
+
}
|
|
35
|
+
/** {@link ActivateTokenApi} bound to this client. */
|
|
36
|
+
activateTokenApi() {
|
|
37
|
+
return new ActivateTokenApi(this.configuration, undefined, this.http);
|
|
38
|
+
}
|
|
39
|
+
/** {@link DeactivateTokenApi} bound to this client. */
|
|
40
|
+
deactivateTokenApi() {
|
|
41
|
+
return new DeactivateTokenApi(this.configuration, undefined, this.http);
|
|
42
|
+
}
|
|
43
|
+
/** {@link EligibleTokenRequestorsApi} bound to this client. */
|
|
44
|
+
eligibleTokenRequestorsApi() {
|
|
45
|
+
return new EligibleTokenRequestorsApi(this.configuration, undefined, this.http);
|
|
46
|
+
}
|
|
47
|
+
/** {@link GetTokensApi} bound to this client. */
|
|
48
|
+
getTokensApi() {
|
|
49
|
+
return new GetTokensApi(this.configuration, undefined, this.http);
|
|
50
|
+
}
|
|
51
|
+
/** {@link PushCardsApi} bound to this client. */
|
|
52
|
+
pushCardsApi() {
|
|
53
|
+
return new PushCardsApi(this.configuration, undefined, this.http);
|
|
54
|
+
}
|
|
55
|
+
/** {@link PushProvisionApi} bound to this client. */
|
|
56
|
+
pushProvisionApi() {
|
|
57
|
+
return new PushProvisionApi(this.configuration, undefined, this.http);
|
|
58
|
+
}
|
|
59
|
+
/** {@link SuspendTokenApi} bound to this client. */
|
|
60
|
+
suspendTokenApi() {
|
|
61
|
+
return new SuspendTokenApi(this.configuration, undefined, this.http);
|
|
62
|
+
}
|
|
63
|
+
/** {@link UnsuspendTokenApi} bound to this client. */
|
|
64
|
+
unsuspendTokenApi() {
|
|
65
|
+
return new UnsuspendTokenApi(this.configuration, undefined, this.http);
|
|
66
|
+
}
|
|
67
|
+
static builder() {
|
|
68
|
+
return new WalletClientBuilder();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Builds a {@link WalletClient}: base URL + optional OAuth + transport customization. */
|
|
72
|
+
export class WalletClientBuilder {
|
|
73
|
+
constructor() {
|
|
74
|
+
this._customizers = [];
|
|
75
|
+
}
|
|
76
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
77
|
+
baseUrl(baseUrl) {
|
|
78
|
+
this._baseUrl = baseUrl;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
82
|
+
oauth(tokens) {
|
|
83
|
+
this._tokens = tokens;
|
|
84
|
+
return this;
|
|
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) {
|
|
92
|
+
this._customizers.push(customizer);
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
build() {
|
|
96
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
97
|
+
for (const customizer of this._customizers) {
|
|
98
|
+
customizer(http);
|
|
99
|
+
}
|
|
100
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
101
|
+
return new WalletClient(http, configuration);
|
|
102
|
+
}
|
|
103
|
+
}
|
package/dist/esm/wallet/index.js
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
import { type TokenManager } from '../oauth';
|
|
3
|
+
import { Configuration } from './configuration';
|
|
4
|
+
import { GetECBExchangeRateApi, GetECBSupportedCurrenciesApi, GetFXExchangeRatesApi } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Fluent entry point for this module. Build one with {@link ExchangeRateClient.builder}:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = ExchangeRateClient.builder()
|
|
10
|
+
* .baseUrl('https://api.example.com/...')
|
|
11
|
+
* .oauth(tokens)
|
|
12
|
+
* .build();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class ExchangeRateClient {
|
|
16
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
17
|
+
readonly http: AxiosInstance;
|
|
18
|
+
/** The module configuration — base path applied. */
|
|
19
|
+
readonly configuration: Configuration;
|
|
20
|
+
constructor(
|
|
21
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
22
|
+
http: AxiosInstance,
|
|
23
|
+
/** The module configuration — base path applied. */
|
|
24
|
+
configuration: Configuration);
|
|
25
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
26
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
|
|
27
|
+
/** {@link GetECBExchangeRateApi} bound to this client. */
|
|
28
|
+
getECBExchangeRateApi(): GetECBExchangeRateApi;
|
|
29
|
+
/** {@link GetECBSupportedCurrenciesApi} bound to this client. */
|
|
30
|
+
getECBSupportedCurrenciesApi(): GetECBSupportedCurrenciesApi;
|
|
31
|
+
/** {@link GetFXExchangeRatesApi} bound to this client. */
|
|
32
|
+
getFXExchangeRatesApi(): GetFXExchangeRatesApi;
|
|
33
|
+
static builder(): ExchangeRateClientBuilder;
|
|
34
|
+
}
|
|
35
|
+
/** Builds a {@link ExchangeRateClient}: base URL + optional OAuth + transport customization. */
|
|
36
|
+
export declare class ExchangeRateClientBuilder {
|
|
37
|
+
private _baseUrl?;
|
|
38
|
+
private _tokens?;
|
|
39
|
+
private _customizers;
|
|
40
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
41
|
+
baseUrl(baseUrl: string): this;
|
|
42
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
43
|
+
oauth(tokens: TokenManager): this;
|
|
44
|
+
/**
|
|
45
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
46
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
47
|
+
* calls run in order.
|
|
48
|
+
*/
|
|
49
|
+
configure(customizer: (http: AxiosInstance) => void): this;
|
|
50
|
+
build(): ExchangeRateClient;
|
|
51
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExchangeRateClientBuilder = exports.ExchangeRateClient = 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 ExchangeRateClient.builder}:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const client = ExchangeRateClient.builder()
|
|
20
|
+
* .baseUrl('https://api.example.com/...')
|
|
21
|
+
* .oauth(tokens)
|
|
22
|
+
* .build();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
class ExchangeRateClient {
|
|
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 GetECBExchangeRateApi} bound to this client. */
|
|
39
|
+
getECBExchangeRateApi() {
|
|
40
|
+
return new api_1.GetECBExchangeRateApi(this.configuration, undefined, this.http);
|
|
41
|
+
}
|
|
42
|
+
/** {@link GetECBSupportedCurrenciesApi} bound to this client. */
|
|
43
|
+
getECBSupportedCurrenciesApi() {
|
|
44
|
+
return new api_1.GetECBSupportedCurrenciesApi(this.configuration, undefined, this.http);
|
|
45
|
+
}
|
|
46
|
+
/** {@link GetFXExchangeRatesApi} bound to this client. */
|
|
47
|
+
getFXExchangeRatesApi() {
|
|
48
|
+
return new api_1.GetFXExchangeRatesApi(this.configuration, undefined, this.http);
|
|
49
|
+
}
|
|
50
|
+
static builder() {
|
|
51
|
+
return new ExchangeRateClientBuilder();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ExchangeRateClient = ExchangeRateClient;
|
|
55
|
+
/** Builds a {@link ExchangeRateClient}: base URL + optional OAuth + transport customization. */
|
|
56
|
+
class ExchangeRateClientBuilder {
|
|
57
|
+
constructor() {
|
|
58
|
+
this._customizers = [];
|
|
59
|
+
}
|
|
60
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
61
|
+
baseUrl(baseUrl) {
|
|
62
|
+
this._baseUrl = baseUrl;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
66
|
+
oauth(tokens) {
|
|
67
|
+
this._tokens = tokens;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
72
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
73
|
+
* calls run in order.
|
|
74
|
+
*/
|
|
75
|
+
configure(customizer) {
|
|
76
|
+
this._customizers.push(customizer);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
build() {
|
|
80
|
+
const http = this._tokens ? (0, oauth_1.createOAuthAxios)(this._tokens) : axios_1.default.create();
|
|
81
|
+
for (const customizer of this._customizers) {
|
|
82
|
+
customizer(http);
|
|
83
|
+
}
|
|
84
|
+
const configuration = new configuration_1.Configuration({ basePath: this._baseUrl });
|
|
85
|
+
return new ExchangeRateClient(http, configuration);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.ExchangeRateClientBuilder = ExchangeRateClientBuilder;
|
|
@@ -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);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
import { type TokenManager } from '../oauth';
|
|
3
|
+
import { Configuration } from './configuration';
|
|
4
|
+
import { IssuerEventWebhooksApi } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Fluent entry point for this module. Build one with {@link IssuerEventsClient.builder}:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = IssuerEventsClient.builder()
|
|
10
|
+
* .baseUrl('https://api.example.com/...')
|
|
11
|
+
* .oauth(tokens)
|
|
12
|
+
* .build();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class IssuerEventsClient {
|
|
16
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
17
|
+
readonly http: AxiosInstance;
|
|
18
|
+
/** The module configuration — base path applied. */
|
|
19
|
+
readonly configuration: Configuration;
|
|
20
|
+
constructor(
|
|
21
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
22
|
+
http: AxiosInstance,
|
|
23
|
+
/** The module configuration — base path applied. */
|
|
24
|
+
configuration: Configuration);
|
|
25
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
26
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
|
|
27
|
+
/** {@link IssuerEventWebhooksApi} bound to this client. */
|
|
28
|
+
issuerEventWebhooksApi(): IssuerEventWebhooksApi;
|
|
29
|
+
static builder(): IssuerEventsClientBuilder;
|
|
30
|
+
}
|
|
31
|
+
/** Builds a {@link IssuerEventsClient}: base URL + optional OAuth + transport customization. */
|
|
32
|
+
export declare class IssuerEventsClientBuilder {
|
|
33
|
+
private _baseUrl?;
|
|
34
|
+
private _tokens?;
|
|
35
|
+
private _customizers;
|
|
36
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
37
|
+
baseUrl(baseUrl: string): this;
|
|
38
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
39
|
+
oauth(tokens: TokenManager): this;
|
|
40
|
+
/**
|
|
41
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
42
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
43
|
+
* calls run in order.
|
|
44
|
+
*/
|
|
45
|
+
configure(customizer: (http: AxiosInstance) => void): this;
|
|
46
|
+
build(): IssuerEventsClient;
|
|
47
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IssuerEventsClientBuilder = exports.IssuerEventsClient = 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 IssuerEventsClient.builder}:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const client = IssuerEventsClient.builder()
|
|
20
|
+
* .baseUrl('https://api.example.com/...')
|
|
21
|
+
* .oauth(tokens)
|
|
22
|
+
* .build();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
class IssuerEventsClient {
|
|
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 IssuerEventWebhooksApi} bound to this client. */
|
|
39
|
+
issuerEventWebhooksApi() {
|
|
40
|
+
return new api_1.IssuerEventWebhooksApi(this.configuration, undefined, this.http);
|
|
41
|
+
}
|
|
42
|
+
static builder() {
|
|
43
|
+
return new IssuerEventsClientBuilder();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.IssuerEventsClient = IssuerEventsClient;
|
|
47
|
+
/** Builds a {@link IssuerEventsClient}: base URL + optional OAuth + transport customization. */
|
|
48
|
+
class IssuerEventsClientBuilder {
|
|
49
|
+
constructor() {
|
|
50
|
+
this._customizers = [];
|
|
51
|
+
}
|
|
52
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
53
|
+
baseUrl(baseUrl) {
|
|
54
|
+
this._baseUrl = baseUrl;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
58
|
+
oauth(tokens) {
|
|
59
|
+
this._tokens = tokens;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
64
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
65
|
+
* calls run in order.
|
|
66
|
+
*/
|
|
67
|
+
configure(customizer) {
|
|
68
|
+
this._customizers.push(customizer);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
build() {
|
|
72
|
+
const http = this._tokens ? (0, oauth_1.createOAuthAxios)(this._tokens) : axios_1.default.create();
|
|
73
|
+
for (const customizer of this._customizers) {
|
|
74
|
+
customizer(http);
|
|
75
|
+
}
|
|
76
|
+
const configuration = new configuration_1.Configuration({ basePath: this._baseUrl });
|
|
77
|
+
return new IssuerEventsClient(http, configuration);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.IssuerEventsClientBuilder = IssuerEventsClientBuilder;
|
|
@@ -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/dist/oauth/axios.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { TokenManager } from './tokenManager';
|
|
3
3
|
/**
|
|
4
|
-
* Returns an {@link AxiosInstance} with
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Returns an {@link AxiosInstance} with OAuth bearer-token handling built in:
|
|
5
|
+
*
|
|
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
|
|
8
|
+
* security scheme (e.g. exchange-rate), so no `accessToken` on the `Configuration` is required.
|
|
9
|
+
* - **Reactive:** a response interceptor, on a `401`, forces a token refresh and retries the request
|
|
10
|
+
* exactly once with the new bearer token.
|
|
11
|
+
*
|
|
12
|
+
* Pass it as the third argument of a generated API class:
|
|
7
13
|
*
|
|
8
14
|
* ```ts
|
|
9
15
|
* const http = createOAuthAxios(tokens);
|
|
10
|
-
* const config = new card.Configuration({
|
|
16
|
+
* const config = new card.Configuration({ basePath });
|
|
11
17
|
* const api = new card.CardApi(config, undefined, http);
|
|
12
18
|
* ```
|
|
13
19
|
*/
|
package/dist/oauth/axios.js
CHANGED
|
@@ -25,18 +25,29 @@ function stripBearer(header) {
|
|
|
25
25
|
: header;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Returns an {@link AxiosInstance} with
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Returns an {@link AxiosInstance} with OAuth bearer-token handling built in:
|
|
29
|
+
*
|
|
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
|
|
32
|
+
* security scheme (e.g. exchange-rate), so no `accessToken` on the `Configuration` is required.
|
|
33
|
+
* - **Reactive:** a response interceptor, on a `401`, forces a token refresh and retries the request
|
|
34
|
+
* exactly once with the new bearer token.
|
|
35
|
+
*
|
|
36
|
+
* Pass it as the third argument of a generated API class:
|
|
31
37
|
*
|
|
32
38
|
* ```ts
|
|
33
39
|
* const http = createOAuthAxios(tokens);
|
|
34
|
-
* const config = new card.Configuration({
|
|
40
|
+
* const config = new card.Configuration({ basePath });
|
|
35
41
|
* const api = new card.CardApi(config, undefined, http);
|
|
36
42
|
* ```
|
|
37
43
|
*/
|
|
38
44
|
function createOAuthAxios(manager, instance) {
|
|
39
45
|
const http = instance !== null && instance !== void 0 ? instance : axios_1.default.create();
|
|
46
|
+
// Proactive: attach a fresh bearer token to every outgoing request.
|
|
47
|
+
http.interceptors.request.use((config) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
config.headers.set('Authorization', BEARER_PREFIX + (yield manager.getToken()));
|
|
49
|
+
return config;
|
|
50
|
+
}));
|
|
40
51
|
http.interceptors.response.use(undefined, (error) => __awaiter(this, void 0, void 0, function* () {
|
|
41
52
|
var _a, _b, _c;
|
|
42
53
|
const response = error.response;
|
package/dist/oauth/index.js
CHANGED
|
@@ -16,10 +16,13 @@ exports.createOAuthAxios = exports.clientCredentialsFetcher = exports.clientCred
|
|
|
16
16
|
* clientSecret: 'my-secret',
|
|
17
17
|
* scopes: ['cards:read'],
|
|
18
18
|
* });
|
|
19
|
-
* const http = oauth.createOAuthAxios(tokens);
|
|
20
|
-
* const config = new card.Configuration({
|
|
19
|
+
* const http = oauth.createOAuthAxios(tokens); // attaches the token + retries on 401
|
|
20
|
+
* const config = new card.Configuration({ basePath: 'https://api.example.com' });
|
|
21
21
|
* const api = new card.CardApi(config, undefined, http);
|
|
22
22
|
*
|
|
23
|
+
* The same `http` instance authenticates every API module, including ones whose spec declares no
|
|
24
|
+
* security scheme (e.g. exchange-rate) — no `accessToken` on the `Configuration` is required.
|
|
25
|
+
*
|
|
23
26
|
* Server-side only — a client secret must never ship to a browser.
|
|
24
27
|
*/
|
|
25
28
|
var tokenManager_1 = require("./tokenManager");
|