@enfuce/nextgen-sdk 0.0.5 → 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.
Files changed (103) 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/esm/authorisation-control/client.d.ts +47 -0
  19. package/dist/esm/authorisation-control/client.js +75 -0
  20. package/dist/esm/authorisation-control/index.d.ts +1 -0
  21. package/dist/esm/authorisation-control/index.js +1 -0
  22. package/dist/esm/card/client.d.ts +57 -0
  23. package/dist/esm/card/client.js +95 -0
  24. package/dist/esm/card/index.d.ts +1 -0
  25. package/dist/esm/card/index.js +1 -0
  26. package/dist/esm/cardholder/client.d.ts +53 -0
  27. package/dist/esm/cardholder/client.js +87 -0
  28. package/dist/esm/cardholder/index.d.ts +1 -0
  29. package/dist/esm/cardholder/index.js +1 -0
  30. package/dist/esm/cards/client.d.ts +47 -0
  31. package/dist/esm/cards/client.js +75 -0
  32. package/dist/esm/cards/index.d.ts +1 -0
  33. package/dist/esm/cards/index.js +1 -0
  34. package/dist/esm/exchange-rate/client.d.ts +51 -0
  35. package/dist/esm/exchange-rate/client.js +83 -0
  36. package/dist/esm/exchange-rate/index.d.ts +1 -0
  37. package/dist/esm/exchange-rate/index.js +1 -0
  38. package/dist/esm/issuer-events/client.d.ts +47 -0
  39. package/dist/esm/issuer-events/client.js +75 -0
  40. package/dist/esm/issuer-events/index.d.ts +1 -0
  41. package/dist/esm/issuer-events/index.js +1 -0
  42. package/dist/esm/pin/client.d.ts +49 -0
  43. package/dist/esm/pin/client.js +79 -0
  44. package/dist/esm/pin/index.d.ts +1 -0
  45. package/dist/esm/pin/index.js +1 -0
  46. package/dist/esm/threeds/client.d.ts +47 -0
  47. package/dist/esm/threeds/client.js +75 -0
  48. package/dist/esm/threeds/index.d.ts +1 -0
  49. package/dist/esm/threeds/index.js +1 -0
  50. package/dist/esm/threeds-oob/client.d.ts +47 -0
  51. package/dist/esm/threeds-oob/client.js +75 -0
  52. package/dist/esm/threeds-oob/index.d.ts +1 -0
  53. package/dist/esm/threeds-oob/index.js +1 -0
  54. package/dist/esm/wallet/client.d.ts +61 -0
  55. package/dist/esm/wallet/client.js +103 -0
  56. package/dist/esm/wallet/index.d.ts +1 -0
  57. package/dist/esm/wallet/index.js +1 -0
  58. package/dist/exchange-rate/client.d.ts +51 -0
  59. package/dist/exchange-rate/client.js +88 -0
  60. package/dist/exchange-rate/index.d.ts +1 -0
  61. package/dist/exchange-rate/index.js +1 -0
  62. package/dist/issuer-events/client.d.ts +47 -0
  63. package/dist/issuer-events/client.js +80 -0
  64. package/dist/issuer-events/index.d.ts +1 -0
  65. package/dist/issuer-events/index.js +1 -0
  66. package/dist/pin/client.d.ts +49 -0
  67. package/dist/pin/client.js +84 -0
  68. package/dist/pin/index.d.ts +1 -0
  69. package/dist/pin/index.js +1 -0
  70. package/dist/threeds/client.d.ts +47 -0
  71. package/dist/threeds/client.js +80 -0
  72. package/dist/threeds/index.d.ts +1 -0
  73. package/dist/threeds/index.js +1 -0
  74. package/dist/threeds-oob/client.d.ts +47 -0
  75. package/dist/threeds-oob/client.js +80 -0
  76. package/dist/threeds-oob/index.d.ts +1 -0
  77. package/dist/threeds-oob/index.js +1 -0
  78. package/dist/wallet/client.d.ts +61 -0
  79. package/dist/wallet/client.js +108 -0
  80. package/dist/wallet/index.d.ts +1 -0
  81. package/dist/wallet/index.js +1 -0
  82. package/package.json +1 -1
  83. package/src/authorisation-control/client.ts +86 -0
  84. package/src/authorisation-control/index.ts +2 -0
  85. package/src/card/client.ts +116 -0
  86. package/src/card/index.ts +2 -0
  87. package/src/cardholder/client.ts +104 -0
  88. package/src/cardholder/index.ts +2 -0
  89. package/src/cards/client.ts +86 -0
  90. package/src/cards/index.ts +2 -0
  91. package/src/exchange-rate/client.ts +98 -0
  92. package/src/exchange-rate/index.ts +2 -0
  93. package/src/issuer-events/client.ts +86 -0
  94. package/src/issuer-events/index.ts +2 -0
  95. package/src/pin/client.ts +92 -0
  96. package/src/pin/index.ts +2 -0
  97. package/src/threeds/client.ts +86 -0
  98. package/src/threeds/index.ts +2 -0
  99. package/src/threeds-oob/client.ts +86 -0
  100. package/src/threeds-oob/index.ts +2 -0
  101. package/src/wallet/client.ts +128 -0
  102. package/src/wallet/index.ts +2 -0
  103. package/test/exchange-rate-client.test.ts +36 -0
@@ -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
+ }
@@ -16,3 +16,5 @@
16
16
  export * from "./api";
17
17
  export * from "./configuration";
18
18
 
19
+
20
+ export * from './client';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The generated fluent module client (exchangeRate.ExchangeRateClient) — a representative check that
3
+ * the client.mustache template wires the builder, base path, API getters and the configure() seam.
4
+ * Built without OAuth (no token manager) so the test needs no network.
5
+ */
6
+ import { describe, expect, it } from 'vitest';
7
+ import { exchangeRate } from '../src';
8
+
9
+ describe('ExchangeRateClient (generated facade)', () => {
10
+ it('builder applies the base path and exposes the module APIs', () => {
11
+ const client = exchangeRate.ExchangeRateClient.builder()
12
+ .baseUrl('http://localhost/exchange-rate')
13
+ .build();
14
+
15
+ expect(client.configuration.basePath).toBe('http://localhost/exchange-rate');
16
+ expect(client.getECBExchangeRateApi()).toBeInstanceOf(exchangeRate.GetECBExchangeRateApi);
17
+ expect(client.getECBSupportedCurrenciesApi()).toBeInstanceOf(exchangeRate.GetECBSupportedCurrenciesApi);
18
+ expect(client.getFXExchangeRatesApi()).toBeInstanceOf(exchangeRate.GetFXExchangeRatesApi);
19
+
20
+ // Generic escape hatch for any API bound to the same client.
21
+ expect(client.api((c, http) => new exchangeRate.GetECBExchangeRateApi(c, undefined, http)))
22
+ .toBeInstanceOf(exchangeRate.GetECBExchangeRateApi);
23
+ });
24
+
25
+ it('configure() runs against the axios instance and composes (e.g. a timeout)', () => {
26
+ let calls = 0;
27
+ const client = exchangeRate.ExchangeRateClient.builder()
28
+ .baseUrl('http://x')
29
+ .configure(() => { calls += 1; })
30
+ .configure((http) => { http.defaults.timeout = 1234; })
31
+ .build();
32
+
33
+ expect(calls).toBe(1);
34
+ expect(client.http.defaults.timeout).toBe(1234);
35
+ });
36
+ });