@enfuce/nextgen-sdk 0.0.1

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 (313) hide show
  1. package/dist/authorisation-control/api.d.ts +771 -0
  2. package/dist/authorisation-control/api.js +240 -0
  3. package/dist/authorisation-control/base.d.ts +66 -0
  4. package/dist/authorisation-control/base.js +65 -0
  5. package/dist/authorisation-control/common.d.ts +65 -0
  6. package/dist/authorisation-control/common.js +161 -0
  7. package/dist/authorisation-control/configuration.d.ts +91 -0
  8. package/dist/authorisation-control/configuration.js +44 -0
  9. package/dist/authorisation-control/index.d.ts +13 -0
  10. package/dist/authorisation-control/index.js +31 -0
  11. package/dist/card/api.d.ts +2065 -0
  12. package/dist/card/api.js +1406 -0
  13. package/dist/card/base.d.ts +66 -0
  14. package/dist/card/base.js +65 -0
  15. package/dist/card/common.d.ts +65 -0
  16. package/dist/card/common.js +161 -0
  17. package/dist/card/configuration.d.ts +91 -0
  18. package/dist/card/configuration.js +44 -0
  19. package/dist/card/index.d.ts +13 -0
  20. package/dist/card/index.js +31 -0
  21. package/dist/cardholder/api.d.ts +1890 -0
  22. package/dist/cardholder/api.js +1239 -0
  23. package/dist/cardholder/base.d.ts +66 -0
  24. package/dist/cardholder/base.js +65 -0
  25. package/dist/cardholder/common.d.ts +65 -0
  26. package/dist/cardholder/common.js +161 -0
  27. package/dist/cardholder/configuration.d.ts +91 -0
  28. package/dist/cardholder/configuration.js +44 -0
  29. package/dist/cardholder/index.d.ts +13 -0
  30. package/dist/cardholder/index.js +31 -0
  31. package/dist/cards/api.d.ts +78 -0
  32. package/dist/cards/api.js +142 -0
  33. package/dist/cards/base.d.ts +66 -0
  34. package/dist/cards/base.js +65 -0
  35. package/dist/cards/common.d.ts +65 -0
  36. package/dist/cards/common.js +161 -0
  37. package/dist/cards/configuration.d.ts +91 -0
  38. package/dist/cards/configuration.js +44 -0
  39. package/dist/cards/index.d.ts +13 -0
  40. package/dist/cards/index.js +31 -0
  41. package/dist/clearing-file-copy/api.d.ts +1245 -0
  42. package/dist/clearing-file-copy/api.js +139 -0
  43. package/dist/clearing-file-copy/base.d.ts +66 -0
  44. package/dist/clearing-file-copy/base.js +65 -0
  45. package/dist/clearing-file-copy/common.d.ts +65 -0
  46. package/dist/clearing-file-copy/common.js +161 -0
  47. package/dist/clearing-file-copy/configuration.d.ts +91 -0
  48. package/dist/clearing-file-copy/configuration.js +44 -0
  49. package/dist/clearing-file-copy/index.d.ts +13 -0
  50. package/dist/clearing-file-copy/index.js +31 -0
  51. package/dist/esm/authorisation-control/api.d.ts +771 -0
  52. package/dist/esm/authorisation-control/api.js +233 -0
  53. package/dist/esm/authorisation-control/base.d.ts +66 -0
  54. package/dist/esm/authorisation-control/base.js +60 -0
  55. package/dist/esm/authorisation-control/common.d.ts +65 -0
  56. package/dist/esm/authorisation-control/common.js +149 -0
  57. package/dist/esm/authorisation-control/configuration.d.ts +91 -0
  58. package/dist/esm/authorisation-control/configuration.js +40 -0
  59. package/dist/esm/authorisation-control/index.d.ts +13 -0
  60. package/dist/esm/authorisation-control/index.js +15 -0
  61. package/dist/esm/card/api.d.ts +2065 -0
  62. package/dist/esm/card/api.js +1379 -0
  63. package/dist/esm/card/base.d.ts +66 -0
  64. package/dist/esm/card/base.js +60 -0
  65. package/dist/esm/card/common.d.ts +65 -0
  66. package/dist/esm/card/common.js +149 -0
  67. package/dist/esm/card/configuration.d.ts +91 -0
  68. package/dist/esm/card/configuration.js +40 -0
  69. package/dist/esm/card/index.d.ts +13 -0
  70. package/dist/esm/card/index.js +15 -0
  71. package/dist/esm/cardholder/api.d.ts +1890 -0
  72. package/dist/esm/cardholder/api.js +1220 -0
  73. package/dist/esm/cardholder/base.d.ts +66 -0
  74. package/dist/esm/cardholder/base.js +60 -0
  75. package/dist/esm/cardholder/common.d.ts +65 -0
  76. package/dist/esm/cardholder/common.js +149 -0
  77. package/dist/esm/cardholder/configuration.d.ts +91 -0
  78. package/dist/esm/cardholder/configuration.js +40 -0
  79. package/dist/esm/cardholder/index.d.ts +13 -0
  80. package/dist/esm/cardholder/index.js +15 -0
  81. package/dist/esm/cards/api.d.ts +78 -0
  82. package/dist/esm/cards/api.js +135 -0
  83. package/dist/esm/cards/base.d.ts +66 -0
  84. package/dist/esm/cards/base.js +60 -0
  85. package/dist/esm/cards/common.d.ts +65 -0
  86. package/dist/esm/cards/common.js +149 -0
  87. package/dist/esm/cards/configuration.d.ts +91 -0
  88. package/dist/esm/cards/configuration.js +40 -0
  89. package/dist/esm/cards/index.d.ts +13 -0
  90. package/dist/esm/cards/index.js +15 -0
  91. package/dist/esm/clearing-file-copy/api.d.ts +1245 -0
  92. package/dist/esm/clearing-file-copy/api.js +136 -0
  93. package/dist/esm/clearing-file-copy/base.d.ts +66 -0
  94. package/dist/esm/clearing-file-copy/base.js +60 -0
  95. package/dist/esm/clearing-file-copy/common.d.ts +65 -0
  96. package/dist/esm/clearing-file-copy/common.js +149 -0
  97. package/dist/esm/clearing-file-copy/configuration.d.ts +91 -0
  98. package/dist/esm/clearing-file-copy/configuration.js +40 -0
  99. package/dist/esm/clearing-file-copy/index.d.ts +13 -0
  100. package/dist/esm/clearing-file-copy/index.js +15 -0
  101. package/dist/esm/index.d.ts +12 -0
  102. package/dist/esm/index.js +14 -0
  103. package/dist/esm/issuer-events/api.d.ts +1721 -0
  104. package/dist/esm/issuer-events/api.js +940 -0
  105. package/dist/esm/issuer-events/base.d.ts +66 -0
  106. package/dist/esm/issuer-events/base.js +60 -0
  107. package/dist/esm/issuer-events/common.d.ts +65 -0
  108. package/dist/esm/issuer-events/common.js +149 -0
  109. package/dist/esm/issuer-events/configuration.d.ts +91 -0
  110. package/dist/esm/issuer-events/configuration.js +40 -0
  111. package/dist/esm/issuer-events/index.d.ts +13 -0
  112. package/dist/esm/issuer-events/index.js +15 -0
  113. package/dist/esm/oauth/axios.d.ts +14 -0
  114. package/dist/esm/oauth/axios.js +58 -0
  115. package/dist/esm/oauth/clientCredentials.d.ts +24 -0
  116. package/dist/esm/oauth/clientCredentials.js +59 -0
  117. package/dist/esm/oauth/index.d.ts +3 -0
  118. package/dist/esm/oauth/index.js +24 -0
  119. package/dist/esm/oauth/tokenManager.d.ts +38 -0
  120. package/dist/esm/oauth/tokenManager.js +77 -0
  121. package/dist/esm/pin/api.d.ts +329 -0
  122. package/dist/esm/pin/api.js +341 -0
  123. package/dist/esm/pin/base.d.ts +66 -0
  124. package/dist/esm/pin/base.js +60 -0
  125. package/dist/esm/pin/common.d.ts +65 -0
  126. package/dist/esm/pin/common.js +149 -0
  127. package/dist/esm/pin/configuration.d.ts +91 -0
  128. package/dist/esm/pin/configuration.js +40 -0
  129. package/dist/esm/pin/index.d.ts +13 -0
  130. package/dist/esm/pin/index.js +15 -0
  131. package/dist/esm/threeds/api.d.ts +104 -0
  132. package/dist/esm/threeds/api.js +136 -0
  133. package/dist/esm/threeds/base.d.ts +66 -0
  134. package/dist/esm/threeds/base.js +60 -0
  135. package/dist/esm/threeds/common.d.ts +65 -0
  136. package/dist/esm/threeds/common.js +149 -0
  137. package/dist/esm/threeds/configuration.d.ts +91 -0
  138. package/dist/esm/threeds/configuration.js +40 -0
  139. package/dist/esm/threeds/index.d.ts +13 -0
  140. package/dist/esm/threeds/index.js +15 -0
  141. package/dist/esm/threeds-oob/api.d.ts +241 -0
  142. package/dist/esm/threeds-oob/api.js +141 -0
  143. package/dist/esm/threeds-oob/base.d.ts +66 -0
  144. package/dist/esm/threeds-oob/base.js +60 -0
  145. package/dist/esm/threeds-oob/common.d.ts +65 -0
  146. package/dist/esm/threeds-oob/common.js +149 -0
  147. package/dist/esm/threeds-oob/configuration.d.ts +91 -0
  148. package/dist/esm/threeds-oob/configuration.js +40 -0
  149. package/dist/esm/threeds-oob/index.d.ts +13 -0
  150. package/dist/esm/threeds-oob/index.js +15 -0
  151. package/dist/esm/transaction-event/api.d.ts +1082 -0
  152. package/dist/esm/transaction-event/api.js +163 -0
  153. package/dist/esm/transaction-event/base.d.ts +66 -0
  154. package/dist/esm/transaction-event/base.js +60 -0
  155. package/dist/esm/transaction-event/common.d.ts +65 -0
  156. package/dist/esm/transaction-event/common.js +149 -0
  157. package/dist/esm/transaction-event/configuration.d.ts +91 -0
  158. package/dist/esm/transaction-event/configuration.js +40 -0
  159. package/dist/esm/transaction-event/index.d.ts +13 -0
  160. package/dist/esm/transaction-event/index.js +15 -0
  161. package/dist/esm/wallet/api.d.ts +1385 -0
  162. package/dist/esm/wallet/api.js +1342 -0
  163. package/dist/esm/wallet/base.d.ts +66 -0
  164. package/dist/esm/wallet/base.js +60 -0
  165. package/dist/esm/wallet/common.d.ts +65 -0
  166. package/dist/esm/wallet/common.js +149 -0
  167. package/dist/esm/wallet/configuration.d.ts +91 -0
  168. package/dist/esm/wallet/configuration.js +40 -0
  169. package/dist/esm/wallet/index.d.ts +13 -0
  170. package/dist/esm/wallet/index.js +15 -0
  171. package/dist/index.d.ts +12 -0
  172. package/dist/index.js +17 -0
  173. package/dist/issuer-events/api.d.ts +1721 -0
  174. package/dist/issuer-events/api.js +947 -0
  175. package/dist/issuer-events/base.d.ts +66 -0
  176. package/dist/issuer-events/base.js +65 -0
  177. package/dist/issuer-events/common.d.ts +65 -0
  178. package/dist/issuer-events/common.js +161 -0
  179. package/dist/issuer-events/configuration.d.ts +91 -0
  180. package/dist/issuer-events/configuration.js +44 -0
  181. package/dist/issuer-events/index.d.ts +13 -0
  182. package/dist/issuer-events/index.js +31 -0
  183. package/dist/oauth/axios.d.ts +14 -0
  184. package/dist/oauth/axios.js +61 -0
  185. package/dist/oauth/clientCredentials.d.ts +24 -0
  186. package/dist/oauth/clientCredentials.js +63 -0
  187. package/dist/oauth/index.d.ts +3 -0
  188. package/dist/oauth/index.js +31 -0
  189. package/dist/oauth/tokenManager.d.ts +38 -0
  190. package/dist/oauth/tokenManager.js +81 -0
  191. package/dist/pin/api.d.ts +329 -0
  192. package/dist/pin/api.js +352 -0
  193. package/dist/pin/base.d.ts +66 -0
  194. package/dist/pin/base.js +65 -0
  195. package/dist/pin/common.d.ts +65 -0
  196. package/dist/pin/common.js +161 -0
  197. package/dist/pin/configuration.d.ts +91 -0
  198. package/dist/pin/configuration.js +44 -0
  199. package/dist/pin/index.d.ts +13 -0
  200. package/dist/pin/index.js +31 -0
  201. package/dist/threeds/api.d.ts +104 -0
  202. package/dist/threeds/api.js +143 -0
  203. package/dist/threeds/base.d.ts +66 -0
  204. package/dist/threeds/base.js +65 -0
  205. package/dist/threeds/common.d.ts +65 -0
  206. package/dist/threeds/common.js +161 -0
  207. package/dist/threeds/configuration.d.ts +91 -0
  208. package/dist/threeds/configuration.js +44 -0
  209. package/dist/threeds/index.d.ts +13 -0
  210. package/dist/threeds/index.js +31 -0
  211. package/dist/threeds-oob/api.d.ts +241 -0
  212. package/dist/threeds-oob/api.js +148 -0
  213. package/dist/threeds-oob/base.d.ts +66 -0
  214. package/dist/threeds-oob/base.js +65 -0
  215. package/dist/threeds-oob/common.d.ts +65 -0
  216. package/dist/threeds-oob/common.js +161 -0
  217. package/dist/threeds-oob/configuration.d.ts +91 -0
  218. package/dist/threeds-oob/configuration.js +44 -0
  219. package/dist/threeds-oob/index.d.ts +13 -0
  220. package/dist/threeds-oob/index.js +31 -0
  221. package/dist/transaction-event/api.d.ts +1082 -0
  222. package/dist/transaction-event/api.js +166 -0
  223. package/dist/transaction-event/base.d.ts +66 -0
  224. package/dist/transaction-event/base.js +65 -0
  225. package/dist/transaction-event/common.d.ts +65 -0
  226. package/dist/transaction-event/common.js +161 -0
  227. package/dist/transaction-event/configuration.d.ts +91 -0
  228. package/dist/transaction-event/configuration.js +44 -0
  229. package/dist/transaction-event/index.d.ts +13 -0
  230. package/dist/transaction-event/index.js +31 -0
  231. package/dist/wallet/api.d.ts +1385 -0
  232. package/dist/wallet/api.js +1377 -0
  233. package/dist/wallet/base.d.ts +66 -0
  234. package/dist/wallet/base.js +65 -0
  235. package/dist/wallet/common.d.ts +65 -0
  236. package/dist/wallet/common.js +161 -0
  237. package/dist/wallet/configuration.d.ts +91 -0
  238. package/dist/wallet/configuration.js +44 -0
  239. package/dist/wallet/index.d.ts +13 -0
  240. package/dist/wallet/index.js +31 -0
  241. package/package.json +25 -0
  242. package/src/authorisation-control/api.ts +876 -0
  243. package/src/authorisation-control/base.ts +86 -0
  244. package/src/authorisation-control/common.ts +150 -0
  245. package/src/authorisation-control/configuration.ts +115 -0
  246. package/src/authorisation-control/index.ts +18 -0
  247. package/src/card/api.ts +2792 -0
  248. package/src/card/base.ts +86 -0
  249. package/src/card/common.ts +150 -0
  250. package/src/card/configuration.ts +115 -0
  251. package/src/card/index.ts +18 -0
  252. package/src/cardholder/api.ts +2244 -0
  253. package/src/cardholder/base.ts +86 -0
  254. package/src/cardholder/common.ts +150 -0
  255. package/src/cardholder/configuration.ts +115 -0
  256. package/src/cardholder/index.ts +18 -0
  257. package/src/cards/api.ts +141 -0
  258. package/src/cards/base.ts +86 -0
  259. package/src/cards/common.ts +150 -0
  260. package/src/cards/configuration.ts +115 -0
  261. package/src/cards/index.ts +18 -0
  262. package/src/clearing-file-copy/api.ts +1309 -0
  263. package/src/clearing-file-copy/base.ts +86 -0
  264. package/src/clearing-file-copy/common.ts +150 -0
  265. package/src/clearing-file-copy/configuration.ts +115 -0
  266. package/src/clearing-file-copy/index.ts +18 -0
  267. package/src/index.ts +16 -0
  268. package/src/issuer-events/api.ts +1926 -0
  269. package/src/issuer-events/base.ts +86 -0
  270. package/src/issuer-events/common.ts +150 -0
  271. package/src/issuer-events/configuration.ts +115 -0
  272. package/src/issuer-events/index.ts +18 -0
  273. package/src/oauth/axios.ts +60 -0
  274. package/src/oauth/clientCredentials.ts +72 -0
  275. package/src/oauth/index.ts +24 -0
  276. package/src/oauth/tokenManager.ts +85 -0
  277. package/src/pin/api.ts +507 -0
  278. package/src/pin/base.ts +86 -0
  279. package/src/pin/common.ts +150 -0
  280. package/src/pin/configuration.ts +115 -0
  281. package/src/pin/index.ts +18 -0
  282. package/src/threeds/api.ts +173 -0
  283. package/src/threeds/base.ts +86 -0
  284. package/src/threeds/common.ts +150 -0
  285. package/src/threeds/configuration.ts +115 -0
  286. package/src/threeds/index.ts +18 -0
  287. package/src/threeds-oob/api.ts +311 -0
  288. package/src/threeds-oob/base.ts +86 -0
  289. package/src/threeds-oob/common.ts +150 -0
  290. package/src/threeds-oob/configuration.ts +115 -0
  291. package/src/threeds-oob/index.ts +18 -0
  292. package/src/transaction-event/api.ts +1152 -0
  293. package/src/transaction-event/base.ts +86 -0
  294. package/src/transaction-event/common.ts +150 -0
  295. package/src/transaction-event/configuration.ts +115 -0
  296. package/src/transaction-event/index.ts +18 -0
  297. package/src/wallet/api.ts +2083 -0
  298. package/src/wallet/base.ts +86 -0
  299. package/src/wallet/common.ts +150 -0
  300. package/src/wallet/configuration.ts +115 -0
  301. package/src/wallet/index.ts +18 -0
  302. package/test/authorisation-control.test.ts +71 -0
  303. package/test/card.test.ts +39 -0
  304. package/test/cardholder.test.ts +51 -0
  305. package/test/cards.test.ts +35 -0
  306. package/test/issuer-events.test.ts +55 -0
  307. package/test/oauth.test.ts +205 -0
  308. package/test/pin.test.ts +39 -0
  309. package/test/threeds-oob.test.ts +90 -0
  310. package/test/threeds.test.ts +55 -0
  311. package/test/wallet.test.ts +62 -0
  312. package/tsconfig.esm.json +7 -0
  313. package/tsconfig.json +14 -0
@@ -0,0 +1,86 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Issuer Events API
5
+ * All date-time fields adhere to the ISO 8601 standard unless specified otherwise. For example: 2024-05-31T06:55:17Z
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from './configuration';
17
+ // Some imports not used depending on template conditions
18
+ // @ts-ignore
19
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
20
+ import globalAxios from 'axios';
21
+
22
+ export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ */
28
+ export const COLLECTION_FORMATS = {
29
+ csv: ",",
30
+ ssv: " ",
31
+ tsv: "\t",
32
+ pipes: "|",
33
+ };
34
+
35
+ /**
36
+ *
37
+ * @export
38
+ * @interface RequestArgs
39
+ */
40
+ export interface RequestArgs {
41
+ url: string;
42
+ options: RawAxiosRequestConfig;
43
+ }
44
+
45
+ /**
46
+ *
47
+ * @export
48
+ * @class BaseAPI
49
+ */
50
+ export class BaseAPI {
51
+ protected configuration: Configuration | undefined;
52
+
53
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
54
+ if (configuration) {
55
+ this.configuration = configuration;
56
+ this.basePath = configuration.basePath ?? basePath;
57
+ }
58
+ }
59
+ };
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ * @class RequiredError
65
+ * @extends {Error}
66
+ */
67
+ export class RequiredError extends Error {
68
+ constructor(public field: string, msg?: string) {
69
+ super(msg);
70
+ this.name = "RequiredError"
71
+ }
72
+ }
73
+
74
+ interface ServerMap {
75
+ [key: string]: {
76
+ url: string,
77
+ description: string,
78
+ }[];
79
+ }
80
+
81
+ /**
82
+ *
83
+ * @export
84
+ */
85
+ export const operationServerMap: ServerMap = {
86
+ }
@@ -0,0 +1,150 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Issuer Events API
5
+ * All date-time fields adhere to the ISO 8601 standard unless specified otherwise. For example: 2024-05-31T06:55:17Z
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from "./configuration";
17
+ import type { RequestArgs } from "./base";
18
+ import type { AxiosInstance, AxiosResponse } from 'axios';
19
+ import { RequiredError } from "./base";
20
+
21
+ /**
22
+ *
23
+ * @export
24
+ */
25
+ export const DUMMY_BASE_URL = 'https://example.com'
26
+
27
+ /**
28
+ *
29
+ * @throws {RequiredError}
30
+ * @export
31
+ */
32
+ export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
33
+ if (paramValue === null || paramValue === undefined) {
34
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
35
+ }
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @export
41
+ */
42
+ export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
43
+ if (configuration && configuration.apiKey) {
44
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
45
+ ? await configuration.apiKey(keyParamName)
46
+ : await configuration.apiKey;
47
+ object[keyParamName] = localVarApiKeyValue;
48
+ }
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @export
54
+ */
55
+ export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
56
+ if (configuration && (configuration.username || configuration.password)) {
57
+ object["auth"] = { username: configuration.username, password: configuration.password };
58
+ }
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
66
+ if (configuration && configuration.accessToken) {
67
+ const accessToken = typeof configuration.accessToken === 'function'
68
+ ? await configuration.accessToken()
69
+ : await configuration.accessToken;
70
+ object["Authorization"] = "Bearer " + accessToken;
71
+ }
72
+ }
73
+
74
+ /**
75
+ *
76
+ * @export
77
+ */
78
+ export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
79
+ if (configuration && configuration.accessToken) {
80
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
81
+ ? await configuration.accessToken(name, scopes)
82
+ : await configuration.accessToken;
83
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
84
+ }
85
+ }
86
+
87
+ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
88
+ if (parameter == null) return;
89
+ if (typeof parameter === "object") {
90
+ if (Array.isArray(parameter)) {
91
+ (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
92
+ }
93
+ else {
94
+ Object.keys(parameter).forEach(currentKey =>
95
+ setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
96
+ );
97
+ }
98
+ }
99
+ else {
100
+ if (urlSearchParams.has(key)) {
101
+ urlSearchParams.append(key, parameter);
102
+ }
103
+ else {
104
+ urlSearchParams.set(key, parameter);
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @export
112
+ */
113
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
114
+ const searchParams = new URLSearchParams(url.search);
115
+ setFlattenedQueryParams(searchParams, objects);
116
+ url.search = searchParams.toString();
117
+ }
118
+
119
+ /**
120
+ *
121
+ * @export
122
+ */
123
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
124
+ const nonString = typeof value !== 'string';
125
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
126
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
127
+ : nonString;
128
+ return needsSerialization
129
+ ? JSON.stringify(value !== undefined ? value : {})
130
+ : (value || "");
131
+ }
132
+
133
+ /**
134
+ *
135
+ * @export
136
+ */
137
+ export const toPathString = function (url: URL) {
138
+ return url.pathname + url.search + url.hash
139
+ }
140
+
141
+ /**
142
+ *
143
+ * @export
144
+ */
145
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
146
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
147
+ const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
148
+ return axios.request<T, R>(axiosRequestArgs);
149
+ };
150
+ }
@@ -0,0 +1,115 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Issuer Events API
5
+ * All date-time fields adhere to the ISO 8601 standard unless specified otherwise. For example: 2024-05-31T06:55:17Z
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ export interface ConfigurationParameters {
17
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
18
+ username?: string;
19
+ password?: string;
20
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
21
+ basePath?: string;
22
+ serverIndex?: number;
23
+ baseOptions?: any;
24
+ formDataCtor?: new () => any;
25
+ }
26
+
27
+ export class Configuration {
28
+ /**
29
+ * parameter for apiKey security
30
+ * @param name security name
31
+ * @memberof Configuration
32
+ */
33
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
34
+ /**
35
+ * parameter for basic security
36
+ *
37
+ * @type {string}
38
+ * @memberof Configuration
39
+ */
40
+ username?: string;
41
+ /**
42
+ * parameter for basic security
43
+ *
44
+ * @type {string}
45
+ * @memberof Configuration
46
+ */
47
+ password?: string;
48
+ /**
49
+ * parameter for oauth2 security
50
+ * @param name security name
51
+ * @param scopes oauth2 scope
52
+ * @memberof Configuration
53
+ */
54
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
55
+ /**
56
+ * override base path
57
+ *
58
+ * @type {string}
59
+ * @memberof Configuration
60
+ */
61
+ basePath?: string;
62
+ /**
63
+ * override server index
64
+ *
65
+ * @type {number}
66
+ * @memberof Configuration
67
+ */
68
+ serverIndex?: number;
69
+ /**
70
+ * base options for axios calls
71
+ *
72
+ * @type {any}
73
+ * @memberof Configuration
74
+ */
75
+ baseOptions?: any;
76
+ /**
77
+ * The FormData constructor that will be used to create multipart form data
78
+ * requests. You can inject this here so that execution environments that
79
+ * do not support the FormData class can still run the generated client.
80
+ *
81
+ * @type {new () => FormData}
82
+ */
83
+ formDataCtor?: new () => any;
84
+
85
+ constructor(param: ConfigurationParameters = {}) {
86
+ this.apiKey = param.apiKey;
87
+ this.username = param.username;
88
+ this.password = param.password;
89
+ this.accessToken = param.accessToken;
90
+ this.basePath = param.basePath;
91
+ this.serverIndex = param.serverIndex;
92
+ this.baseOptions = {
93
+ ...param.baseOptions,
94
+ headers: {
95
+ ...param.baseOptions?.headers,
96
+ },
97
+ };
98
+ this.formDataCtor = param.formDataCtor;
99
+ }
100
+
101
+ /**
102
+ * Check if the given MIME is a JSON MIME.
103
+ * JSON MIME examples:
104
+ * application/json
105
+ * application/json; charset=UTF8
106
+ * APPLICATION/JSON
107
+ * application/vnd.company+json
108
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
109
+ * @return True if the given MIME is JSON, false otherwise.
110
+ */
111
+ public isJsonMime(mime: string): boolean {
112
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
113
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
114
+ }
115
+ }
@@ -0,0 +1,18 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Issuer Events API
5
+ * All date-time fields adhere to the ISO 8601 standard unless specified otherwise. For example: 2024-05-31T06:55:17Z
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ export * from "./api";
17
+ export * from "./configuration";
18
+
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Enfuce nextgen SDK — OAuth token-management helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/oauth) 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
+ import axios, { AxiosError, AxiosInstance, InternalAxiosRequestConfig } from 'axios';
9
+ import { TokenManager } from './tokenManager';
10
+
11
+ const BEARER_PREFIX = 'Bearer ';
12
+
13
+ type RetriableConfig = InternalAxiosRequestConfig & { _oauthRetried?: boolean };
14
+
15
+ function stripBearer(header: string): string {
16
+ return header.toLowerCase().startsWith(BEARER_PREFIX.toLowerCase())
17
+ ? header.slice(BEARER_PREFIX.length)
18
+ : header;
19
+ }
20
+
21
+ /**
22
+ * Returns an {@link AxiosInstance} with a response interceptor that, on a `401`,
23
+ * forces a token refresh and retries the request exactly once with the new bearer
24
+ * token. Pass it as the third argument of a generated API class:
25
+ *
26
+ * ```ts
27
+ * const http = createOAuthAxios(tokens);
28
+ * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
29
+ * const api = new card.CardApi(config, undefined, http);
30
+ * ```
31
+ */
32
+ export function createOAuthAxios(manager: TokenManager, instance?: AxiosInstance): AxiosInstance {
33
+ const http = instance ?? axios.create();
34
+
35
+ http.interceptors.response.use(undefined, async (error: AxiosError) => {
36
+ const response = error.response;
37
+ const original = error.config as RetriableConfig | undefined;
38
+
39
+ if (!response || response.status !== 401 || !original || original._oauthRetried) {
40
+ return Promise.reject(error);
41
+ }
42
+
43
+ const authHeader = original.headers?.['Authorization'] ?? original.headers?.Authorization;
44
+ const stale = typeof authHeader === 'string' ? stripBearer(authHeader) : undefined;
45
+
46
+ const fresh = await manager.forceRefresh(stale);
47
+ if (stale !== undefined && fresh === stale) {
48
+ // Refresh produced the same token — surface the original 401.
49
+ return Promise.reject(error);
50
+ }
51
+
52
+ original._oauthRetried = true;
53
+ if (original.headers) {
54
+ original.headers['Authorization'] = BEARER_PREFIX + fresh;
55
+ }
56
+ return http.request(original);
57
+ });
58
+
59
+ return http;
60
+ }
@@ -0,0 +1,72 @@
1
+ /*
2
+ * Enfuce nextgen SDK — OAuth token-management helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/oauth) 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
+ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
9
+ import { AccessToken, TokenFetcher, TokenManager } from './tokenManager';
10
+
11
+ /** Configuration for the OAuth2 `client_credentials` grant. */
12
+ export interface OAuthConfig {
13
+ tokenUrl: string;
14
+ clientId: string;
15
+ clientSecret: string;
16
+ /** Requested scopes; space-joined into a `scope` parameter. */
17
+ scopes?: string[];
18
+ /** How client credentials are presented. Defaults to `basic`. */
19
+ authStyle?: 'basic' | 'body';
20
+ /** Extra form parameters to include in the token request. */
21
+ extraParams?: Record<string, string>;
22
+ /** Axios instance used for the token request. Defaults to a fresh instance. */
23
+ axiosInstance?: AxiosInstance;
24
+ }
25
+
26
+ interface TokenResponse {
27
+ access_token?: string;
28
+ expires_in?: number;
29
+ }
30
+
31
+ /**
32
+ * Builds a {@link TokenFetcher} that performs the OAuth2 `client_credentials`
33
+ * grant: a form-encoded POST to `config.tokenUrl`, parsing `access_token` and
34
+ * `expires_in`. Server-side only — never ship a client secret to a browser.
35
+ */
36
+ export function clientCredentialsFetcher(config: OAuthConfig): TokenFetcher {
37
+ const http = config.axiosInstance ?? axios.create();
38
+ const style = config.authStyle ?? 'basic';
39
+
40
+ return async (): Promise<AccessToken> => {
41
+ const form = new URLSearchParams();
42
+ form.set('grant_type', 'client_credentials');
43
+ if (config.scopes && config.scopes.length > 0) {
44
+ form.set('scope', config.scopes.join(' '));
45
+ }
46
+ for (const [key, value] of Object.entries(config.extraParams ?? {})) {
47
+ form.set(key, value);
48
+ }
49
+
50
+ const options: AxiosRequestConfig = {
51
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
52
+ };
53
+ if (style === 'basic') {
54
+ options.auth = { username: config.clientId, password: config.clientSecret };
55
+ } else {
56
+ form.set('client_id', config.clientId);
57
+ form.set('client_secret', config.clientSecret);
58
+ }
59
+
60
+ const response = await http.post<TokenResponse>(config.tokenUrl, form.toString(), options);
61
+ const data = response.data;
62
+ if (!data || !data.access_token) {
63
+ throw new Error('token response has no access_token field');
64
+ }
65
+ return { accessToken: data.access_token, expiresInSeconds: data.expires_in ?? 0 };
66
+ };
67
+ }
68
+
69
+ /** Convenience: a caching {@link TokenManager} backed by the client-credentials grant. */
70
+ export function clientCredentials(config: OAuthConfig, skewSeconds: number = 60): TokenManager {
71
+ return new TokenManager(clientCredentialsFetcher(config), skewSeconds);
72
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Enfuce nextgen SDK — OAuth token-management helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/oauth) is authored by hand and
5
+ * preserved across SDK regeneration (see scripts/generate.sh). It is re-exported
6
+ * from the package barrel as `oauth`:
7
+ *
8
+ * import { oauth, card } from '@enfuce/nextgen-sdk';
9
+ *
10
+ * const tokens = oauth.clientCredentials({
11
+ * tokenUrl: 'https://auth.example.com/oauth/token',
12
+ * clientId: 'my-id',
13
+ * clientSecret: 'my-secret',
14
+ * scopes: ['cards:read'],
15
+ * });
16
+ * const http = oauth.createOAuthAxios(tokens);
17
+ * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
18
+ * const api = new card.CardApi(config, undefined, http);
19
+ *
20
+ * Server-side only — a client secret must never ship to a browser.
21
+ */
22
+ export { AccessToken, TokenFetcher, TokenManager } from './tokenManager';
23
+ export { OAuthConfig, clientCredentials, clientCredentialsFetcher } from './clientCredentials';
24
+ export { createOAuthAxios } from './axios';
@@ -0,0 +1,85 @@
1
+ /*
2
+ * Enfuce nextgen SDK — OAuth token-management helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/oauth) 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
+ /** The result of fetching an access token. */
10
+ export interface AccessToken {
11
+ accessToken: string;
12
+ /** Lifetime in seconds (OAuth2 `expires_in`); <= 0 means unknown → refetch every call. */
13
+ expiresInSeconds: number;
14
+ }
15
+
16
+ /** Fetches a fresh access token. Supply your own to support any grant/source. */
17
+ export type TokenFetcher = () => Promise<AccessToken>;
18
+
19
+ /**
20
+ * Caches an access token and refreshes it before expiry. Plug it into a generated
21
+ * client's `Configuration`:
22
+ *
23
+ * ```ts
24
+ * const tokens = new TokenManager(fetcher);
25
+ * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
26
+ * ```
27
+ *
28
+ * A token is considered expired once the clock passes `expiry - skew`. Concurrent
29
+ * refreshes share a single in-flight promise, so the token endpoint is hit once.
30
+ */
31
+ export class TokenManager {
32
+ private token?: string;
33
+ private expiresAtMs?: number;
34
+ private inflight?: Promise<string>;
35
+
36
+ constructor(
37
+ private readonly fetcher: TokenFetcher,
38
+ private readonly skewSeconds: number = 60,
39
+ private readonly now: () => number = Date.now,
40
+ ) {}
41
+
42
+ /** Returns a valid access token, refreshing first if necessary. */
43
+ async getToken(): Promise<string> {
44
+ if (
45
+ this.token !== undefined &&
46
+ this.expiresAtMs !== undefined &&
47
+ this.now() < this.expiresAtMs - this.skewSeconds * 1000
48
+ ) {
49
+ return this.token;
50
+ }
51
+ return this.refresh();
52
+ }
53
+
54
+ /**
55
+ * Forces a refresh. If `staleToken` is given and the cached token has already
56
+ * changed, returns the current token without refetching — so two concurrent
57
+ * 401s trigger a single refresh.
58
+ */
59
+ forceRefresh(staleToken?: string): Promise<string> {
60
+ if (staleToken !== undefined && this.token !== undefined && this.token !== staleToken) {
61
+ return Promise.resolve(this.token);
62
+ }
63
+ return this.refresh();
64
+ }
65
+
66
+ private refresh(): Promise<string> {
67
+ if (this.inflight !== undefined) {
68
+ return this.inflight;
69
+ }
70
+ this.inflight = (async () => {
71
+ try {
72
+ const fetched = await this.fetcher();
73
+ this.token = fetched.accessToken;
74
+ this.expiresAtMs =
75
+ fetched.expiresInSeconds > 0
76
+ ? this.now() + fetched.expiresInSeconds * 1000
77
+ : undefined;
78
+ return this.token;
79
+ } finally {
80
+ this.inflight = undefined;
81
+ }
82
+ })();
83
+ return this.inflight;
84
+ }
85
+ }