@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.
- 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/config/enfuceUrls.d.ts +20 -0
- package/dist/config/enfuceUrls.js +47 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +22 -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/config/enfuceUrls.d.ts +20 -0
- package/dist/esm/config/enfuceUrls.js +40 -0
- package/dist/esm/config/index.d.ts +1 -0
- package/dist/esm/config/index.js +14 -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/index.d.ts +1 -0
- package/dist/esm/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/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/index.d.ts +1 -0
- package/dist/index.js +2 -1
- 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/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/config/enfuceUrls.ts +57 -0
- package/src/config/index.ts +21 -0
- package/src/exchange-rate/client.ts +98 -0
- package/src/exchange-rate/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/issuer-events/client.ts +86 -0
- package/src/issuer-events/index.ts +2 -0
- 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/config.test.ts +33 -0
- package/test/exchange-rate-client.test.ts +36 -0
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
GetECBExchangeRateApi,
|
|
13
|
+
GetECBSupportedCurrenciesApi,
|
|
14
|
+
GetFXExchangeRatesApi,
|
|
15
|
+
} from './api';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Fluent entry point for this module. Build one with {@link ExchangeRateClient.builder}:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const client = ExchangeRateClient.builder()
|
|
22
|
+
* .baseUrl('https://api.example.com/...')
|
|
23
|
+
* .oauth(tokens)
|
|
24
|
+
* .build();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export class ExchangeRateClient {
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
31
|
+
readonly http: AxiosInstance,
|
|
32
|
+
/** The module configuration — base path applied. */
|
|
33
|
+
readonly configuration: Configuration,
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
37
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T {
|
|
38
|
+
return factory(this.configuration, this.http);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** {@link GetECBExchangeRateApi} bound to this client. */
|
|
42
|
+
getECBExchangeRateApi(): GetECBExchangeRateApi {
|
|
43
|
+
return new GetECBExchangeRateApi(this.configuration, undefined, this.http);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** {@link GetECBSupportedCurrenciesApi} bound to this client. */
|
|
47
|
+
getECBSupportedCurrenciesApi(): GetECBSupportedCurrenciesApi {
|
|
48
|
+
return new GetECBSupportedCurrenciesApi(this.configuration, undefined, this.http);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** {@link GetFXExchangeRatesApi} bound to this client. */
|
|
52
|
+
getFXExchangeRatesApi(): GetFXExchangeRatesApi {
|
|
53
|
+
return new GetFXExchangeRatesApi(this.configuration, undefined, this.http);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static builder(): ExchangeRateClientBuilder {
|
|
57
|
+
return new ExchangeRateClientBuilder();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Builds a {@link ExchangeRateClient}: base URL + optional OAuth + transport customization. */
|
|
62
|
+
export class ExchangeRateClientBuilder {
|
|
63
|
+
|
|
64
|
+
private _baseUrl?: string;
|
|
65
|
+
private _tokens?: TokenManager;
|
|
66
|
+
private _customizers: Array<(http: AxiosInstance) => void> = [];
|
|
67
|
+
|
|
68
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
69
|
+
baseUrl(baseUrl: string): this {
|
|
70
|
+
this._baseUrl = baseUrl;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
75
|
+
oauth(tokens: TokenManager): this {
|
|
76
|
+
this._tokens = tokens;
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
82
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
83
|
+
* calls run in order.
|
|
84
|
+
*/
|
|
85
|
+
configure(customizer: (http: AxiosInstance) => void): this {
|
|
86
|
+
this._customizers.push(customizer);
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
build(): ExchangeRateClient {
|
|
91
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
92
|
+
for (const customizer of this._customizers) {
|
|
93
|
+
customizer(http);
|
|
94
|
+
}
|
|
95
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
96
|
+
return new ExchangeRateClient(http, configuration);
|
|
97
|
+
}
|
|
98
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -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
|
+
IssuerEventWebhooksApi,
|
|
13
|
+
} from './api';
|
|
14
|
+
|
|
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
|
+
export class IssuerEventsClient {
|
|
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 IssuerEventWebhooksApi} bound to this client. */
|
|
40
|
+
issuerEventWebhooksApi(): IssuerEventWebhooksApi {
|
|
41
|
+
return new IssuerEventWebhooksApi(this.configuration, undefined, this.http);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static builder(): IssuerEventsClientBuilder {
|
|
45
|
+
return new IssuerEventsClientBuilder();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Builds a {@link IssuerEventsClient}: base URL + optional OAuth + transport customization. */
|
|
50
|
+
export class IssuerEventsClientBuilder {
|
|
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(): IssuerEventsClient {
|
|
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 IssuerEventsClient(http, configuration);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
PINOperationsUsingPKIApi,
|
|
13
|
+
PINOperationsWithPreSharedKeyApi,
|
|
14
|
+
} from './api';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Fluent entry point for this module. Build one with {@link PinClient.builder}:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const client = PinClient.builder()
|
|
21
|
+
* .baseUrl('https://api.example.com/...')
|
|
22
|
+
* .oauth(tokens)
|
|
23
|
+
* .build();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class PinClient {
|
|
27
|
+
|
|
28
|
+
constructor(
|
|
29
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
30
|
+
readonly http: AxiosInstance,
|
|
31
|
+
/** The module configuration — base path applied. */
|
|
32
|
+
readonly configuration: Configuration,
|
|
33
|
+
) {}
|
|
34
|
+
|
|
35
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
36
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T {
|
|
37
|
+
return factory(this.configuration, this.http);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** {@link PINOperationsUsingPKIApi} bound to this client. */
|
|
41
|
+
pINOperationsUsingPKIApi(): PINOperationsUsingPKIApi {
|
|
42
|
+
return new PINOperationsUsingPKIApi(this.configuration, undefined, this.http);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** {@link PINOperationsWithPreSharedKeyApi} bound to this client. */
|
|
46
|
+
pINOperationsWithPreSharedKeyApi(): PINOperationsWithPreSharedKeyApi {
|
|
47
|
+
return new PINOperationsWithPreSharedKeyApi(this.configuration, undefined, this.http);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static builder(): PinClientBuilder {
|
|
51
|
+
return new PinClientBuilder();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Builds a {@link PinClient}: base URL + optional OAuth + transport customization. */
|
|
56
|
+
export class PinClientBuilder {
|
|
57
|
+
|
|
58
|
+
private _baseUrl?: string;
|
|
59
|
+
private _tokens?: TokenManager;
|
|
60
|
+
private _customizers: Array<(http: AxiosInstance) => void> = [];
|
|
61
|
+
|
|
62
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
63
|
+
baseUrl(baseUrl: string): this {
|
|
64
|
+
this._baseUrl = baseUrl;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
69
|
+
oauth(tokens: TokenManager): this {
|
|
70
|
+
this._tokens = tokens;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
76
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
77
|
+
* calls run in order.
|
|
78
|
+
*/
|
|
79
|
+
configure(customizer: (http: AxiosInstance) => void): this {
|
|
80
|
+
this._customizers.push(customizer);
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
build(): PinClient {
|
|
85
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
86
|
+
for (const customizer of this._customizers) {
|
|
87
|
+
customizer(http);
|
|
88
|
+
}
|
|
89
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
90
|
+
return new PinClient(http, configuration);
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/pin/index.ts
CHANGED
|
@@ -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
|
+
ThreeDSApi,
|
|
13
|
+
} from './api';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Fluent entry point for this module. Build one with {@link ThreedsClient.builder}:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const client = ThreedsClient.builder()
|
|
20
|
+
* .baseUrl('https://api.example.com/...')
|
|
21
|
+
* .oauth(tokens)
|
|
22
|
+
* .build();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class ThreedsClient {
|
|
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 ThreeDSApi} bound to this client. */
|
|
40
|
+
threeDSApi(): ThreeDSApi {
|
|
41
|
+
return new ThreeDSApi(this.configuration, undefined, this.http);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static builder(): ThreedsClientBuilder {
|
|
45
|
+
return new ThreedsClientBuilder();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Builds a {@link ThreedsClient}: base URL + optional OAuth + transport customization. */
|
|
50
|
+
export class ThreedsClientBuilder {
|
|
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(): ThreedsClient {
|
|
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 ThreedsClient(http, configuration);
|
|
85
|
+
}
|
|
86
|
+
}
|
package/src/threeds/index.ts
CHANGED
|
@@ -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
|
+
OOBAuthenticationChallengeWebhookNotificationApi,
|
|
13
|
+
} from './api';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Fluent entry point for this module. Build one with {@link ThreedsOobClient.builder}:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const client = ThreedsOobClient.builder()
|
|
20
|
+
* .baseUrl('https://api.example.com/...')
|
|
21
|
+
* .oauth(tokens)
|
|
22
|
+
* .build();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class ThreedsOobClient {
|
|
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 OOBAuthenticationChallengeWebhookNotificationApi} bound to this client. */
|
|
40
|
+
oOBAuthenticationChallengeWebhookNotificationApi(): OOBAuthenticationChallengeWebhookNotificationApi {
|
|
41
|
+
return new OOBAuthenticationChallengeWebhookNotificationApi(this.configuration, undefined, this.http);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static builder(): ThreedsOobClientBuilder {
|
|
45
|
+
return new ThreedsOobClientBuilder();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Builds a {@link ThreedsOobClient}: base URL + optional OAuth + transport customization. */
|
|
50
|
+
export class ThreedsOobClientBuilder {
|
|
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(): ThreedsOobClient {
|
|
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 ThreedsOobClient(http, configuration);
|
|
85
|
+
}
|
|
86
|
+
}
|
package/src/threeds-oob/index.ts
CHANGED
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
ActivateTokenApi,
|
|
13
|
+
DeactivateTokenApi,
|
|
14
|
+
EligibleTokenRequestorsApi,
|
|
15
|
+
GetTokensApi,
|
|
16
|
+
PushCardsApi,
|
|
17
|
+
PushProvisionApi,
|
|
18
|
+
SuspendTokenApi,
|
|
19
|
+
UnsuspendTokenApi,
|
|
20
|
+
} from './api';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Fluent entry point for this module. Build one with {@link WalletClient.builder}:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const client = WalletClient.builder()
|
|
27
|
+
* .baseUrl('https://api.example.com/...')
|
|
28
|
+
* .oauth(tokens)
|
|
29
|
+
* .build();
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export class WalletClient {
|
|
33
|
+
|
|
34
|
+
constructor(
|
|
35
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
36
|
+
readonly http: AxiosInstance,
|
|
37
|
+
/** The module configuration — base path applied. */
|
|
38
|
+
readonly configuration: Configuration,
|
|
39
|
+
) {}
|
|
40
|
+
|
|
41
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
42
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T {
|
|
43
|
+
return factory(this.configuration, this.http);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** {@link ActivateTokenApi} bound to this client. */
|
|
47
|
+
activateTokenApi(): ActivateTokenApi {
|
|
48
|
+
return new ActivateTokenApi(this.configuration, undefined, this.http);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** {@link DeactivateTokenApi} bound to this client. */
|
|
52
|
+
deactivateTokenApi(): DeactivateTokenApi {
|
|
53
|
+
return new DeactivateTokenApi(this.configuration, undefined, this.http);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** {@link EligibleTokenRequestorsApi} bound to this client. */
|
|
57
|
+
eligibleTokenRequestorsApi(): EligibleTokenRequestorsApi {
|
|
58
|
+
return new EligibleTokenRequestorsApi(this.configuration, undefined, this.http);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** {@link GetTokensApi} bound to this client. */
|
|
62
|
+
getTokensApi(): GetTokensApi {
|
|
63
|
+
return new GetTokensApi(this.configuration, undefined, this.http);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** {@link PushCardsApi} bound to this client. */
|
|
67
|
+
pushCardsApi(): PushCardsApi {
|
|
68
|
+
return new PushCardsApi(this.configuration, undefined, this.http);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** {@link PushProvisionApi} bound to this client. */
|
|
72
|
+
pushProvisionApi(): PushProvisionApi {
|
|
73
|
+
return new PushProvisionApi(this.configuration, undefined, this.http);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** {@link SuspendTokenApi} bound to this client. */
|
|
77
|
+
suspendTokenApi(): SuspendTokenApi {
|
|
78
|
+
return new SuspendTokenApi(this.configuration, undefined, this.http);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** {@link UnsuspendTokenApi} bound to this client. */
|
|
82
|
+
unsuspendTokenApi(): UnsuspendTokenApi {
|
|
83
|
+
return new UnsuspendTokenApi(this.configuration, undefined, this.http);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static builder(): WalletClientBuilder {
|
|
87
|
+
return new WalletClientBuilder();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Builds a {@link WalletClient}: base URL + optional OAuth + transport customization. */
|
|
92
|
+
export class WalletClientBuilder {
|
|
93
|
+
|
|
94
|
+
private _baseUrl?: string;
|
|
95
|
+
private _tokens?: TokenManager;
|
|
96
|
+
private _customizers: Array<(http: AxiosInstance) => void> = [];
|
|
97
|
+
|
|
98
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
99
|
+
baseUrl(baseUrl: string): this {
|
|
100
|
+
this._baseUrl = baseUrl;
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
105
|
+
oauth(tokens: TokenManager): this {
|
|
106
|
+
this._tokens = tokens;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
112
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
113
|
+
* calls run in order.
|
|
114
|
+
*/
|
|
115
|
+
configure(customizer: (http: AxiosInstance) => void): this {
|
|
116
|
+
this._customizers.push(customizer);
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
build(): WalletClient {
|
|
121
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
122
|
+
for (const customizer of this._customizers) {
|
|
123
|
+
customizer(http);
|
|
124
|
+
}
|
|
125
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
126
|
+
return new WalletClient(http, configuration);
|
|
127
|
+
}
|
|
128
|
+
}
|
package/src/wallet/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the hand-written tenant/environment URL helper (src/config).
|
|
3
|
+
*/
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { config } from '../src';
|
|
6
|
+
|
|
7
|
+
const sandbox: config.TenantEnvironment = { tenant: 'swile', environment: 'ext-uat1-sandbox' };
|
|
8
|
+
|
|
9
|
+
describe('config URL helpers', () => {
|
|
10
|
+
it('derives per-domain base URLs as api.<tenant>.<environment>.mycore.enfuce.com/<domain>', () => {
|
|
11
|
+
expect(config.apiBaseUrl(sandbox)).toBe('https://api.swile.ext-uat1-sandbox.mycore.enfuce.com');
|
|
12
|
+
expect(config.issuerBaseUrl(sandbox)).toBe('https://api.swile.ext-uat1-sandbox.mycore.enfuce.com/issuer');
|
|
13
|
+
expect(config.processorBaseUrl(sandbox)).toBe('https://api.swile.ext-uat1-sandbox.mycore.enfuce.com/processor');
|
|
14
|
+
expect(config.exchangeRateBaseUrl(sandbox)).toBe(
|
|
15
|
+
'https://api.swile.ext-uat1-sandbox.mycore.enfuce.com/exchange-rates-api',
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('derives the token URL from the auth host', () => {
|
|
20
|
+
expect(config.tokenUrl(sandbox)).toBe('https://auth.swile.ext-uat1-sandbox.mycore.enfuce.com/oauth2/token');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('places a multi-segment environment verbatim', () => {
|
|
24
|
+
expect(config.issuerBaseUrl({ tenant: 'swile', environment: 'eu.live.prod' })).toBe(
|
|
25
|
+
'https://api.swile.eu.live.prod.mycore.enfuce.com/issuer',
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('rejects an empty tenant or environment', () => {
|
|
30
|
+
expect(() => config.issuerBaseUrl({ tenant: ' ', environment: 'env' })).toThrow();
|
|
31
|
+
expect(() => config.tokenUrl({ tenant: 'swile', environment: '' })).toThrow();
|
|
32
|
+
});
|
|
33
|
+
});
|