retorna-typescript-sdk 1.0.2

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 (170) hide show
  1. package/README.md +18 -0
  2. package/dist/clients/account/account_client.d.ts +25 -0
  3. package/dist/clients/account/account_client.d.ts.map +1 -0
  4. package/dist/clients/account/account_client.js +52 -0
  5. package/dist/clients/account/account_client.js.map +1 -0
  6. package/dist/clients/account/index.d.ts +3 -0
  7. package/dist/clients/account/index.d.ts.map +1 -0
  8. package/dist/clients/account/index.js +3 -0
  9. package/dist/clients/account/index.js.map +1 -0
  10. package/dist/clients/account/types.d.ts +35 -0
  11. package/dist/clients/account/types.d.ts.map +1 -0
  12. package/dist/clients/account/types.js +2 -0
  13. package/dist/clients/account/types.js.map +1 -0
  14. package/dist/clients/account/validations.d.ts +4 -0
  15. package/dist/clients/account/validations.d.ts.map +1 -0
  16. package/dist/clients/account/validations.js +53 -0
  17. package/dist/clients/account/validations.js.map +1 -0
  18. package/dist/clients/payout-order/index.d.ts +3 -0
  19. package/dist/clients/payout-order/index.d.ts.map +1 -0
  20. package/dist/clients/payout-order/index.js +3 -0
  21. package/dist/clients/payout-order/index.js.map +1 -0
  22. package/dist/clients/payout-order/payout_order_client.d.ts +15 -0
  23. package/dist/clients/payout-order/payout_order_client.d.ts.map +1 -0
  24. package/dist/clients/payout-order/payout_order_client.js +46 -0
  25. package/dist/clients/payout-order/payout_order_client.js.map +1 -0
  26. package/dist/clients/payout-order/types.d.ts +64 -0
  27. package/dist/clients/payout-order/types.d.ts.map +1 -0
  28. package/dist/clients/payout-order/types.js +2 -0
  29. package/dist/clients/payout-order/types.js.map +1 -0
  30. package/dist/core/config/config.d.ts +25 -0
  31. package/dist/core/config/config.d.ts.map +1 -0
  32. package/dist/core/config/config.js +14 -0
  33. package/dist/core/config/config.js.map +1 -0
  34. package/dist/core/config/retry.d.ts +11 -0
  35. package/dist/core/config/retry.d.ts.map +1 -0
  36. package/dist/core/config/retry.js +8 -0
  37. package/dist/core/config/retry.js.map +1 -0
  38. package/dist/core/credentials/auth_service.d.ts +13 -0
  39. package/dist/core/credentials/auth_service.d.ts.map +1 -0
  40. package/dist/core/credentials/auth_service.js +26 -0
  41. package/dist/core/credentials/auth_service.js.map +1 -0
  42. package/dist/core/credentials/credentials.d.ts +12 -0
  43. package/dist/core/credentials/credentials.d.ts.map +1 -0
  44. package/dist/core/credentials/credentials.js +9 -0
  45. package/dist/core/credentials/credentials.js.map +1 -0
  46. package/dist/core/credentials/token_manager.d.ts +15 -0
  47. package/dist/core/credentials/token_manager.d.ts.map +1 -0
  48. package/dist/core/credentials/token_manager.js +43 -0
  49. package/dist/core/credentials/token_manager.js.map +1 -0
  50. package/dist/core/credentials/utils.d.ts +5 -0
  51. package/dist/core/credentials/utils.d.ts.map +1 -0
  52. package/dist/core/credentials/utils.js +7 -0
  53. package/dist/core/credentials/utils.js.map +1 -0
  54. package/dist/core/environment/config.d.ts +11 -0
  55. package/dist/core/environment/config.d.ts.map +1 -0
  56. package/dist/core/environment/config.js +23 -0
  57. package/dist/core/environment/config.js.map +1 -0
  58. package/dist/core/environment/resolver.d.ts +4 -0
  59. package/dist/core/environment/resolver.d.ts.map +1 -0
  60. package/dist/core/environment/resolver.js +35 -0
  61. package/dist/core/environment/resolver.js.map +1 -0
  62. package/dist/core/environment/types.d.ts +6 -0
  63. package/dist/core/environment/types.d.ts.map +1 -0
  64. package/dist/core/environment/types.js +7 -0
  65. package/dist/core/environment/types.js.map +1 -0
  66. package/dist/core/errors/handler.d.ts +22 -0
  67. package/dist/core/errors/handler.d.ts.map +1 -0
  68. package/dist/core/errors/handler.js +207 -0
  69. package/dist/core/errors/handler.js.map +1 -0
  70. package/dist/core/http/client.d.ts +22 -0
  71. package/dist/core/http/client.d.ts.map +1 -0
  72. package/dist/core/http/client.js +127 -0
  73. package/dist/core/http/client.js.map +1 -0
  74. package/dist/core/http/errors.d.ts +15 -0
  75. package/dist/core/http/errors.d.ts.map +1 -0
  76. package/dist/core/http/errors.js +13 -0
  77. package/dist/core/http/errors.js.map +1 -0
  78. package/dist/core/http/signed_client.d.ts +17 -0
  79. package/dist/core/http/signed_client.d.ts.map +1 -0
  80. package/dist/core/http/signed_client.js +66 -0
  81. package/dist/core/http/signed_client.js.map +1 -0
  82. package/dist/core/http/utils.d.ts +3 -0
  83. package/dist/core/http/utils.d.ts.map +1 -0
  84. package/dist/core/http/utils.js +18 -0
  85. package/dist/core/http/utils.js.map +1 -0
  86. package/dist/core/logging/config.d.ts +11 -0
  87. package/dist/core/logging/config.d.ts.map +1 -0
  88. package/dist/core/logging/config.js +9 -0
  89. package/dist/core/logging/config.js.map +1 -0
  90. package/dist/core/logging/factory.d.ts +12 -0
  91. package/dist/core/logging/factory.d.ts.map +1 -0
  92. package/dist/core/logging/factory.js +39 -0
  93. package/dist/core/logging/factory.js.map +1 -0
  94. package/dist/core/logging/types.d.ts +8 -0
  95. package/dist/core/logging/types.d.ts.map +1 -0
  96. package/dist/core/logging/types.js +9 -0
  97. package/dist/core/logging/types.js.map +1 -0
  98. package/dist/core/signature/signature_service.d.ts +10 -0
  99. package/dist/core/signature/signature_service.d.ts.map +1 -0
  100. package/dist/core/signature/signature_service.js +22 -0
  101. package/dist/core/signature/signature_service.js.map +1 -0
  102. package/dist/core/signature/signer.d.ts +6 -0
  103. package/dist/core/signature/signer.d.ts.map +1 -0
  104. package/dist/core/signature/signer.js +17 -0
  105. package/dist/core/signature/signer.js.map +1 -0
  106. package/dist/core/signature/utils.d.ts +4 -0
  107. package/dist/core/signature/utils.d.ts.map +1 -0
  108. package/dist/core/signature/utils.js +17 -0
  109. package/dist/core/signature/utils.js.map +1 -0
  110. package/dist/index.d.ts +9 -0
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +9 -0
  113. package/dist/index.js.map +1 -0
  114. package/dist/models/payout_order/countries_validations/argentina.d.ts +6 -0
  115. package/dist/models/payout_order/countries_validations/argentina.d.ts.map +1 -0
  116. package/dist/models/payout_order/countries_validations/argentina.js +24 -0
  117. package/dist/models/payout_order/countries_validations/argentina.js.map +1 -0
  118. package/dist/models/payout_order/countries_validations/colombia.d.ts +6 -0
  119. package/dist/models/payout_order/countries_validations/colombia.d.ts.map +1 -0
  120. package/dist/models/payout_order/countries_validations/colombia.js +37 -0
  121. package/dist/models/payout_order/countries_validations/colombia.js.map +1 -0
  122. package/dist/models/payout_order/countries_validations/peru.d.ts +6 -0
  123. package/dist/models/payout_order/countries_validations/peru.d.ts.map +1 -0
  124. package/dist/models/payout_order/countries_validations/peru.js +32 -0
  125. package/dist/models/payout_order/countries_validations/peru.js.map +1 -0
  126. package/dist/models/payout_order/countries_validations/registry.d.ts +6 -0
  127. package/dist/models/payout_order/countries_validations/registry.d.ts.map +1 -0
  128. package/dist/models/payout_order/countries_validations/registry.js +21 -0
  129. package/dist/models/payout_order/countries_validations/registry.js.map +1 -0
  130. package/dist/models/payout_order/countries_validations/spain.d.ts +6 -0
  131. package/dist/models/payout_order/countries_validations/spain.d.ts.map +1 -0
  132. package/dist/models/payout_order/countries_validations/spain.js +24 -0
  133. package/dist/models/payout_order/countries_validations/spain.js.map +1 -0
  134. package/dist/models/payout_order/countries_validations/usa.d.ts +6 -0
  135. package/dist/models/payout_order/countries_validations/usa.d.ts.map +1 -0
  136. package/dist/models/payout_order/countries_validations/usa.js +28 -0
  137. package/dist/models/payout_order/countries_validations/usa.js.map +1 -0
  138. package/dist/models/payout_order/countries_validations/utils.d.ts +2 -0
  139. package/dist/models/payout_order/countries_validations/utils.d.ts.map +1 -0
  140. package/dist/models/payout_order/countries_validations/utils.js +11 -0
  141. package/dist/models/payout_order/countries_validations/utils.js.map +1 -0
  142. package/dist/models/payout_order/countries_validations/venezuela.d.ts +6 -0
  143. package/dist/models/payout_order/countries_validations/venezuela.d.ts.map +1 -0
  144. package/dist/models/payout_order/countries_validations/venezuela.js +39 -0
  145. package/dist/models/payout_order/countries_validations/venezuela.js.map +1 -0
  146. package/dist/models/payout_order/payment_instructions.d.ts +20 -0
  147. package/dist/models/payout_order/payment_instructions.d.ts.map +1 -0
  148. package/dist/models/payout_order/payment_instructions.js +42 -0
  149. package/dist/models/payout_order/payment_instructions.js.map +1 -0
  150. package/dist/models/payout_order/payment_purpose.d.ts +12 -0
  151. package/dist/models/payout_order/payment_purpose.d.ts.map +1 -0
  152. package/dist/models/payout_order/payment_purpose.js +13 -0
  153. package/dist/models/payout_order/payment_purpose.js.map +1 -0
  154. package/dist/models/payout_order/payout_order_request.d.ts +49 -0
  155. package/dist/models/payout_order/payout_order_request.d.ts.map +1 -0
  156. package/dist/models/payout_order/payout_order_request.js +107 -0
  157. package/dist/models/payout_order/payout_order_request.js.map +1 -0
  158. package/dist/sdk/builder.d.ts +28 -0
  159. package/dist/sdk/builder.d.ts.map +1 -0
  160. package/dist/sdk/builder.js +98 -0
  161. package/dist/sdk/builder.js.map +1 -0
  162. package/dist/sdk/client.d.ts +34 -0
  163. package/dist/sdk/client.d.ts.map +1 -0
  164. package/dist/sdk/client.js +33 -0
  165. package/dist/sdk/client.js.map +1 -0
  166. package/dist/sdk/index.d.ts +3 -0
  167. package/dist/sdk/index.d.ts.map +1 -0
  168. package/dist/sdk/index.js +3 -0
  169. package/dist/sdk/index.js.map +1 -0
  170. package/package.json +38 -0
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # retorna-typescript-sdk
2
+
3
+ Es un SDK diseñado para integrar de forma sencilla y segura los servicios B2B de Retorna dentro de aplicaciones Node.js y TypeScript. Permite a empresas realizar pagos, cobros, consultas de transacciones, conciliaciones, creación de órdenes y automatización de flujos financieros mediante una interfaz unificada y fácil de usar.
4
+
5
+ ## Estructura del proyecto
6
+ - `src/index.ts`: punto de entrada público del SDK.
7
+ - `src/sdk`: builder (`RetornaTypeScriptSDKConfigBuilder`) y cliente (`RetornaClient`).
8
+ - `src/clients`: clientes HTTP por dominio (`account` y `payout-order`).
9
+ - `src/core`: utilitarios comunes (auth, http firmado, logging, config de entornos y retiros).
10
+ - `src/models`: DTOs y validadores específicos de payout.
11
+ - `examples/full-flow.ts`: ejemplo completo de autenticación, cotización y creación de órdenes.
12
+ - `tests/unit`: pruebas unitarias ejecutables con `ts-node`.
13
+
14
+ ## Scripts útiles
15
+ - `npm run build`: compila a `dist/`.
16
+ - `npm run typecheck`: verifica tipos sin emitir código.
17
+ - `npm test`: ejecuta typecheck y todas las pruebas unitarias.
18
+ - `npm run dev` o `npm run examples:full`: ejecuta el ejemplo completo con `ts-node` (requiere variables de entorno `RETORNA_CLIENT_ID`, `RETORNA_CLIENT_SECRET`, `RETORNA_PRIVATE_KEY` y opcionalmente `RETORNA_ENV`).
@@ -0,0 +1,25 @@
1
+ import { SignedHttpClient } from "../../core/http/signed_client";
2
+ import { QuotationRequest, QuotationResponse } from "./types";
3
+ type Query = Record<string, unknown>;
4
+ export declare class GetBalanceClient {
5
+ private readonly http;
6
+ constructor(http: SignedHttpClient);
7
+ list(params?: Query): Promise<unknown>;
8
+ }
9
+ export declare class GetRoutesClient {
10
+ private readonly http;
11
+ constructor(http: SignedHttpClient);
12
+ list(params?: Query): Promise<unknown>;
13
+ }
14
+ export declare class QuotationClient {
15
+ private readonly http;
16
+ constructor(http: SignedHttpClient);
17
+ create(payload: QuotationRequest): Promise<QuotationResponse>;
18
+ }
19
+ export declare class GetQuotationClient {
20
+ private readonly http;
21
+ constructor(http: SignedHttpClient);
22
+ getById(id: string, params?: Query): Promise<unknown>;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=account_client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account_client.d.ts","sourceRoot":"","sources":["../../../src/clients/account/account_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAc9D,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAcrC,qBAAa,gBAAgB;IACb,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;IAEnD,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;CAKzC;AAED,qBAAa,eAAe;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;IAEnD,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;CAMzC;AAED,qBAAa,eAAe;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;IAEnD,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAMhE;AAED,qBAAa,kBAAkB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;IAEnD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;CAKxD"}
@@ -0,0 +1,52 @@
1
+ import { normalizeAndValidateQuotation, normalizeAndValidateRoutesParams, } from "./validations";
2
+ import { logSdkError } from "../../core/errors/handler";
3
+ const ENDPOINTS = {
4
+ balance: "/balance",
5
+ routes: "/accounts/routes",
6
+ quotations: "/quotations",
7
+ quotationById: (id) => `/quotations/${id}`,
8
+ };
9
+ async function withErrorHandling(context, fn) {
10
+ try {
11
+ return await fn();
12
+ }
13
+ catch (err) {
14
+ logSdkError(err, { context });
15
+ throw err;
16
+ }
17
+ }
18
+ export class GetBalanceClient {
19
+ constructor(http) {
20
+ this.http = http;
21
+ }
22
+ list(params) {
23
+ return withErrorHandling("GetBalanceClient.list", () => this.http.get(ENDPOINTS.balance, params));
24
+ }
25
+ }
26
+ export class GetRoutesClient {
27
+ constructor(http) {
28
+ this.http = http;
29
+ }
30
+ list(params) {
31
+ const normalized = normalizeAndValidateRoutesParams(params);
32
+ return withErrorHandling("GetRoutesClient.list", () => this.http.get(ENDPOINTS.routes, normalized));
33
+ }
34
+ }
35
+ export class QuotationClient {
36
+ constructor(http) {
37
+ this.http = http;
38
+ }
39
+ create(payload) {
40
+ const normalized = normalizeAndValidateQuotation(payload);
41
+ return withErrorHandling("QuotationClient.create", () => this.http.post(ENDPOINTS.quotations, normalized));
42
+ }
43
+ }
44
+ export class GetQuotationClient {
45
+ constructor(http) {
46
+ this.http = http;
47
+ }
48
+ getById(id, params) {
49
+ return withErrorHandling("GetQuotationClient.getById", () => this.http.get(ENDPOINTS.quotationById(id), params));
50
+ }
51
+ }
52
+ //# sourceMappingURL=account_client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account_client.js","sourceRoot":"","sources":["../../../src/clients/account/account_client.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,6BAA6B,EAC7B,gCAAgC,GACnC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,SAAS,GAAG;IACd,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,kBAAkB;IAC1B,UAAU,EAAE,aAAa;IACzB,aAAa,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,eAAe,EAAE,EAAE;CAC5C,CAAC;AAIX,KAAK,UAAU,iBAAiB,CAC5B,OAAe,EACf,EAAoB;IAEpB,IAAI,CAAC;QACD,OAAO,MAAM,EAAE,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,WAAW,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9B,MAAM,GAAG,CAAC;IACd,CAAC;AACL,CAAC;AAED,MAAM,OAAO,gBAAgB;IACzB,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,IAAI,CAAC,MAAc;QACf,OAAO,iBAAiB,CAAC,uBAAuB,EAAE,GAAG,EAAE,CACnD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,CAC3C,CAAC;IACN,CAAC;CACJ;AAED,MAAM,OAAO,eAAe;IACxB,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,IAAI,CAAC,MAAc;QACf,MAAM,UAAU,GAAG,gCAAgC,CAAC,MAAM,CAAC,CAAC;QAC5D,OAAO,iBAAiB,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAClD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAC9C,CAAC;IACN,CAAC;CACJ;AAED,MAAM,OAAO,eAAe;IACxB,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,MAAM,CAAC,OAAyB;QAC5B,MAAM,UAAU,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,iBAAiB,CAAC,wBAAwB,EAAE,GAAG,EAAE,CACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,CACnD,CAAC;IACN,CAAC;CACJ;AAED,MAAM,OAAO,kBAAkB;IAC3B,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,OAAO,CAAC,EAAU,EAAE,MAAc;QAC9B,OAAO,iBAAiB,CAAC,4BAA4B,EAAE,GAAG,EAAE,CACxD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CACrD,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ export * from "./account_client";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/clients/account/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./account_client";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/clients/account/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,35 @@
1
+ export interface QuotationRequest {
2
+ sourceCurrency: string;
3
+ targetCountry: string;
4
+ targetCurrency: string;
5
+ amount: number;
6
+ amountType: string;
7
+ payoutType: string;
8
+ }
9
+ export interface QuotationPricingRule {
10
+ currency?: string;
11
+ backendId?: string;
12
+ pricingRule?: string;
13
+ pricingType?: string;
14
+ appliedValue?: number;
15
+ pricingLabel?: string;
16
+ calculationMethod?: string;
17
+ }
18
+ export interface QuotationResponse {
19
+ id: string | number;
20
+ quotationBackendId?: string;
21
+ rateId?: number;
22
+ b2bClientId?: number;
23
+ value?: number;
24
+ sourceAmount?: number;
25
+ targetAmount?: number;
26
+ convertAmount?: number;
27
+ sourceCurrency?: string;
28
+ targetCurrency?: string;
29
+ payoutTypeBackendId?: string;
30
+ pricingRules?: QuotationPricingRule[];
31
+ createdTime?: string;
32
+ updatedTime?: string;
33
+ [key: string]: any;
34
+ }
35
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/account/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/clients/account/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { QuotationRequest } from "./types";
2
+ export declare function normalizeAndValidateQuotation(payload: QuotationRequest): QuotationRequest;
3
+ export declare function normalizeAndValidateRoutesParams(params?: Record<string, unknown>): Record<string, unknown>;
4
+ //# sourceMappingURL=validations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../../src/clients/account/validations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK3C,wBAAgB,6BAA6B,CACzC,OAAO,EAAE,gBAAgB,GAC1B,gBAAgB,CA8ClB;AAED,wBAAgB,gCAAgC,CAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
@@ -0,0 +1,53 @@
1
+ const ALLOWED_AMOUNT_TYPES = new Set(["SOURCE", "TARGET"]);
2
+ const DEFAULT_SOURCE_CURRENCY = "USDT";
3
+ export function normalizeAndValidateQuotation(payload) {
4
+ const normalized = {
5
+ ...payload,
6
+ sourceCurrency: (payload.sourceCurrency ?? DEFAULT_SOURCE_CURRENCY).trim(),
7
+ targetCountry: (payload.targetCountry ?? "").trim(),
8
+ targetCurrency: (payload.targetCurrency ?? "").trim(),
9
+ payoutType: (payload.payoutType ?? "").trim(),
10
+ amountType: (payload.amountType ?? "").toUpperCase(),
11
+ };
12
+ const errors = [];
13
+ if (!normalized.targetCountry) {
14
+ errors.push("targetCountry is required");
15
+ }
16
+ else if (normalized.targetCountry.length !== 2) {
17
+ errors.push("targetCountry must be a 2-letter code");
18
+ }
19
+ if (!normalized.targetCurrency) {
20
+ errors.push("targetCurrency is required");
21
+ }
22
+ if (!normalized.payoutType) {
23
+ errors.push("payoutType is required");
24
+ }
25
+ if (!normalized.amountType) {
26
+ errors.push("amountType is required");
27
+ }
28
+ else if (!ALLOWED_AMOUNT_TYPES.has(normalized.amountType)) {
29
+ errors.push(`amountType must be one of: ${Array.from(ALLOWED_AMOUNT_TYPES).join(", ")}`);
30
+ }
31
+ const amount = payload.amount;
32
+ if (typeof amount !== "number" || Number.isNaN(amount)) {
33
+ errors.push("amount must be a number");
34
+ }
35
+ else if (amount <= 0) {
36
+ errors.push("amount must be positive");
37
+ }
38
+ if (errors.length > 0) {
39
+ throw new Error(`Invalid quotation request: ${errors.join(" | ")}`);
40
+ }
41
+ return normalized;
42
+ }
43
+ export function normalizeAndValidateRoutesParams(params) {
44
+ if (!params || params.country === undefined) {
45
+ return params ?? {};
46
+ }
47
+ const country = String(params.country ?? "").trim().toUpperCase();
48
+ if (country.length !== 2) {
49
+ throw new Error("country must be a 2-letter code");
50
+ }
51
+ return { ...params, country };
52
+ }
53
+ //# sourceMappingURL=validations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.js","sourceRoot":"","sources":["../../../src/clients/account/validations.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export * from "./payout_order_client";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/clients/payout-order/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./payout_order_client";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/clients/payout-order/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { SignedHttpClient } from "../../core/http/signed_client";
2
+ import { PayoutOrderRequest, PayoutOrderResponse } from "./types";
3
+ type Query = Record<string, unknown>;
4
+ export declare class PayoutOrderClient {
5
+ private readonly http;
6
+ constructor(http: SignedHttpClient);
7
+ create(payload: PayoutOrderRequest, platformName?: string): Promise<PayoutOrderResponse>;
8
+ }
9
+ export declare class GetOrderClient {
10
+ private readonly http;
11
+ constructor(http: SignedHttpClient);
12
+ getById(id: string, params?: Query): Promise<unknown>;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=payout_order_client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payout_order_client.d.ts","sourceRoot":"","sources":["../../../src/clients/payout-order/payout_order_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQlE,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAcrC,qBAAa,iBAAiB;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;IAEnD,MAAM,CACF,OAAO,EAAE,kBAAkB,EAC3B,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,mBAAmB,CAAC;CAoBlC;AAED,qBAAa,cAAc;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;IAEnD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;CAUxD"}
@@ -0,0 +1,46 @@
1
+ import { PLATFORM_VALIDATORS } from "../../models/payout_order/countries_validations/registry";
2
+ import { logSdkError } from "../../core/errors/handler";
3
+ const ENDPOINTS = {
4
+ orders: "/orders",
5
+ orderById: (id) => `/orders/${id}`,
6
+ };
7
+ async function withErrorHandling(context, fn) {
8
+ try {
9
+ return await fn();
10
+ }
11
+ catch (err) {
12
+ logSdkError(err, { context });
13
+ throw err;
14
+ }
15
+ }
16
+ export class PayoutOrderClient {
17
+ constructor(http) {
18
+ this.http = http;
19
+ }
20
+ create(payload, platformName) {
21
+ const platform = platformName ?? payload.payoutType ?? payload.payoutPlatform;
22
+ const normalizedPlatform = String(platform ?? "").trim().toUpperCase();
23
+ if (!normalizedPlatform) {
24
+ throw new Error("payoutType/platformName is required for payout validation");
25
+ }
26
+ const validator = PLATFORM_VALIDATORS[normalizedPlatform];
27
+ if (!validator) {
28
+ throw new Error(`Unsupported payout platform: ${normalizedPlatform}`);
29
+ }
30
+ validator.validate(payload, normalizedPlatform);
31
+ return withErrorHandling("PayoutOrderClient.create", () => this.http.post(ENDPOINTS.orders, payload));
32
+ }
33
+ }
34
+ export class GetOrderClient {
35
+ constructor(http) {
36
+ this.http = http;
37
+ }
38
+ getById(id, params) {
39
+ const orderId = String(id).trim();
40
+ if (!orderId) {
41
+ throw new Error("order id is required");
42
+ }
43
+ return withErrorHandling("GetOrderClient.getById", () => this.http.get(ENDPOINTS.orderById(orderId), params));
44
+ }
45
+ }
46
+ //# sourceMappingURL=payout_order_client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payout_order_client.js","sourceRoot":"","sources":["../../../src/clients/payout-order/payout_order_client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAE/F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,SAAS,GAAG;IACd,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,WAAW,EAAE,EAAE;CACpC,CAAC;AAIX,KAAK,UAAU,iBAAiB,CAC5B,OAAe,EACf,EAAoB;IAEpB,IAAI,CAAC;QACD,OAAO,MAAM,EAAE,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,WAAW,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9B,MAAM,GAAG,CAAC;IACd,CAAC;AACL,CAAC;AAED,MAAM,OAAO,iBAAiB;IAC1B,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,MAAM,CACF,OAA2B,EAC3B,YAAqB;QAErB,MAAM,QAAQ,GACV,YAAY,IAAI,OAAO,CAAC,UAAU,IAAK,OAAe,CAAC,cAAc,CAAC;QAC1E,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAEvE,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QACjF,CAAC;QAED,MAAM,SAAS,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;QAC1D,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,gCAAgC,kBAAkB,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QAEhD,OAAO,iBAAiB,CAAC,0BAA0B,EAAE,GAAG,EAAE,CACtD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAC5C,CAAC;IACN,CAAC;CACJ;AAED,MAAM,OAAO,cAAc;IACvB,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,OAAO,CAAC,EAAU,EAAE,MAAc;QAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,iBAAiB,CAAC,wBAAwB,EAAE,GAAG,EAAE,CACpD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CACtD,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,64 @@
1
+ export interface PaymentInstructions {
2
+ bankName: string;
3
+ phoneNumber?: string;
4
+ accountNumber?: string;
5
+ accountType?: string;
6
+ branchId?: string;
7
+ }
8
+ export interface PayoutOrderRequest {
9
+ pogQuotationId: number;
10
+ externalId: string;
11
+ payoutType?: string;
12
+ senderNames: string;
13
+ senderLastNames: string;
14
+ senderEmail: string;
15
+ senderPhone: string;
16
+ senderDocumentId: string;
17
+ senderDocumentType: string;
18
+ senderCountry: string;
19
+ beneficiaryCountry: string;
20
+ beneficiaryNames: string;
21
+ beneficiaryLastNames: string;
22
+ beneficiaryEmail: string;
23
+ beneficiaryDocumentId: string;
24
+ beneficiaryDocumentType: string;
25
+ purpose: string;
26
+ paymentInstructions: PaymentInstructions;
27
+ }
28
+ export interface PayoutOrderResponse {
29
+ id: string | number;
30
+ externalId?: string;
31
+ currency?: string;
32
+ status?: string;
33
+ payoutOrderBackendId?: string;
34
+ entityBackendId?: string;
35
+ payoutTypeBackendId?: string;
36
+ beneficiaryNames?: string;
37
+ beneficiaryLastNames?: string;
38
+ beneficiaryDocumentId?: string;
39
+ beneficiaryDocumentType?: string;
40
+ beneficiaryCountry?: string;
41
+ senderNames?: string;
42
+ senderLastNames?: string;
43
+ senderDocumentId?: string;
44
+ senderDocumentType?: string;
45
+ senderPhone?: string;
46
+ senderCountry?: string;
47
+ senderEmail?: string;
48
+ purpose?: string;
49
+ rate?: number;
50
+ providerAmount?: number;
51
+ sumFee?: number;
52
+ totalFee?: number;
53
+ taxFee?: number;
54
+ calculatedPercentageFee?: number;
55
+ calculatedFlatFee?: number;
56
+ appliedFloor?: number;
57
+ appliedCeiling?: number;
58
+ paymentInstructions?: PaymentInstructions;
59
+ quotation?: Record<string, any>;
60
+ createdTime?: string;
61
+ updatedTime?: string;
62
+ [key: string]: any;
63
+ }
64
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/payout-order/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uBAAuB,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,mBAAmB,CAAC;CAC5C;AAED,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/clients/payout-order/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { RetryConfig } from "./retry";
2
+ import { SDKCredentials } from "../credentials/credentials";
3
+ import { EnvConfig } from "../environment/config";
4
+ import { RetornaEnvironment } from "../environment/types";
5
+ import { LoggingConfig } from "../logging/config";
6
+ export interface SDKConfigProps {
7
+ environment: RetornaEnvironment | string;
8
+ envConfig: EnvConfig;
9
+ credentials: SDKCredentials;
10
+ loggingConfig: LoggingConfig;
11
+ retryConfig?: RetryConfig;
12
+ baseUrlOverride?: string | null;
13
+ scopeOverride?: string | null;
14
+ }
15
+ export declare class SDKConfig {
16
+ readonly environment: RetornaEnvironment | string;
17
+ readonly envConfig: EnvConfig;
18
+ readonly credentials: SDKCredentials;
19
+ readonly loggingConfig: LoggingConfig;
20
+ readonly retryConfig: RetryConfig;
21
+ readonly baseUrlOverride?: string | null;
22
+ readonly scopeOverride?: string | null;
23
+ constructor(props: SDKConfigProps);
24
+ }
25
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/core/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAAC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,cAAc,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,qBAAa,SAAS;IAClB,SAAgB,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAAC;IACzD,SAAgB,SAAS,EAAE,SAAS,CAAC;IACrC,SAAgB,WAAW,EAAE,cAAc,CAAC;IAC5C,SAAgB,aAAa,EAAE,aAAa,CAAC;IAC7C,SAAgB,WAAW,EAAE,WAAW,CAAC;IAEzC,SAAgB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,SAAgB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;gBAElC,KAAK,EAAE,cAAc;CAYpC"}
@@ -0,0 +1,14 @@
1
+ import { RetryConfig } from "./retry";
2
+ export class SDKConfig {
3
+ constructor(props) {
4
+ this.environment = props.environment;
5
+ this.envConfig = props.envConfig;
6
+ this.credentials = props.credentials;
7
+ this.loggingConfig = props.loggingConfig;
8
+ this.retryConfig = props.retryConfig ?? new RetryConfig();
9
+ this.baseUrlOverride = props.baseUrlOverride ?? null;
10
+ this.scopeOverride = props.scopeOverride ?? null;
11
+ Object.freeze(this);
12
+ }
13
+ }
14
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/core/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAkBtC,MAAM,OAAO,SAAS;IAUlB,YAAY,KAAqB;QAC7B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,IAAI,WAAW,EAAE,CAAC;QAE1D,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,IAAI,CAAC;QACrD,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACJ"}
@@ -0,0 +1,11 @@
1
+ interface RetryConfigProps {
2
+ retries?: number;
3
+ backoffMs?: number;
4
+ }
5
+ export declare class RetryConfig {
6
+ readonly retries: number;
7
+ readonly backoffMs: number;
8
+ constructor(props?: RetryConfigProps);
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/core/config/retry.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,WAAW;IACpB,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAEtB,KAAK,GAAE,gBAAqB;CAM3C"}
@@ -0,0 +1,8 @@
1
+ export class RetryConfig {
2
+ constructor(props = {}) {
3
+ this.retries = props.retries ?? 3;
4
+ this.backoffMs = props.backoffMs ?? 200;
5
+ Object.freeze(this);
6
+ }
7
+ }
8
+ //# sourceMappingURL=retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/core/config/retry.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,WAAW;IAIpB,YAAY,QAA0B,EAAE;QACpC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,GAAG,CAAC;QAExC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACJ"}
@@ -0,0 +1,13 @@
1
+ import { EnvConfig } from "../environment/config";
2
+ import { HttpClient } from "../http/client";
3
+ import { SDKCredentials } from "./credentials";
4
+ import { SdkLogger } from "../logging/factory";
5
+ export declare class AuthService {
6
+ private readonly http;
7
+ private readonly credentials;
8
+ private readonly environment;
9
+ private readonly logger;
10
+ constructor(httpClient: HttpClient, credentials: SDKCredentials, environment: EnvConfig, logger: SdkLogger);
11
+ fetchAccessToken(): Promise<[string, number]>;
12
+ }
13
+ //# sourceMappingURL=auth_service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth_service.d.ts","sourceRoot":"","sources":["../../../src/core/credentials/auth_service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiB;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAY;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAG/B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,cAAc,EAC3B,WAAW,EAAE,SAAS,EACtB,MAAM,EAAE,SAAS;IAQf,gBAAgB,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CA0BtD"}
@@ -0,0 +1,26 @@
1
+ import { buildBasicAuthHeader } from "./utils";
2
+ export class AuthService {
3
+ constructor(httpClient, credentials, environment, logger) {
4
+ this.http = httpClient;
5
+ this.credentials = credentials;
6
+ this.environment = environment;
7
+ this.logger = logger;
8
+ }
9
+ async fetchAccessToken() {
10
+ this.logger.debug("Fetching OAuth2 access token...");
11
+ const authHeader = buildBasicAuthHeader({
12
+ clientId: this.credentials.client_id,
13
+ clientSecret: this.credentials.client_secret,
14
+ });
15
+ const data = await this.http.post("/oauth2/token", {
16
+ grant_type: "client_credentials",
17
+ scope: this.environment.scope,
18
+ }, {
19
+ Authorization: authHeader,
20
+ "Content-Type": "application/json"
21
+ });
22
+ this.logger.debug(`Access token received (expires in ${data?.expires_in}s)`);
23
+ return [data.access_token, data.expires_in];
24
+ }
25
+ }
26
+ //# sourceMappingURL=auth_service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth_service.js","sourceRoot":"","sources":["../../../src/core/credentials/auth_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAM/C,MAAM,OAAO,WAAW;IAMpB,YACI,UAAsB,EACtB,WAA2B,EAC3B,WAAsB,EACtB,MAAiB;QAEjB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,gBAAgB;QAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAErD,MAAM,UAAU,GAAG,oBAAoB,CAAC;YACpC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS;YACpC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,aAAa;SAC/C,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAC7B,eAAe,EACf;YACI,UAAU,EAAE,oBAAoB;YAChC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK;SAChC,EACD;YACI,aAAa,EAAE,UAAU;YACzB,cAAc,EAAE,kBAAkB;SACrC,CACJ,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,qCAAqC,IAAI,EAAE,UAAU,IAAI,CAC5D,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ export interface SDKCredentialsProps {
2
+ clientId: string;
3
+ clientSecret: string;
4
+ privateKey: string;
5
+ }
6
+ export declare class SDKCredentials {
7
+ readonly client_id: string;
8
+ readonly client_secret: string;
9
+ readonly private_key: string;
10
+ constructor(props: SDKCredentialsProps);
11
+ }
12
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/core/credentials/credentials.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,cAAc;IACvB,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,WAAW,EAAE,MAAM,CAAC;gBAExB,KAAK,EAAE,mBAAmB;CAOzC"}
@@ -0,0 +1,9 @@
1
+ export class SDKCredentials {
2
+ constructor(props) {
3
+ this.client_id = props.clientId;
4
+ this.client_secret = props.clientSecret;
5
+ this.private_key = props.privateKey;
6
+ Object.freeze(this);
7
+ }
8
+ }
9
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/core/credentials/credentials.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,cAAc;IAKvB,YAAY,KAA0B;QAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC;QAEpC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACJ"}
@@ -0,0 +1,15 @@
1
+ import { AuthService } from "./auth_service";
2
+ import { SdkLogger } from "../logging/factory";
3
+ export declare class TokenManager {
4
+ private readonly auth;
5
+ private readonly logger;
6
+ private _accessToken;
7
+ private _expiresAt;
8
+ constructor(authService: AuthService, logger: SdkLogger);
9
+ getAccessToken(): Promise<string>;
10
+ refreshToken(force?: boolean): Promise<void>;
11
+ private isTokenValid;
12
+ hasCachedToken(): boolean;
13
+ isTokenExpired(): boolean;
14
+ }
15
+ //# sourceMappingURL=token_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token_manager.d.ts","sourceRoot":"","sources":["../../../src/core/credentials/token_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IAEnC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,UAAU,CAAa;gBAEnB,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS;IAQjD,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAgBjC,YAAY,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BzD,OAAO,CAAC,YAAY;IAQpB,cAAc,IAAI,OAAO;IAIzB,cAAc,IAAI,OAAO;CAI5B"}