@facturino/node 1.0.0

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 (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -0
  3. package/dist/cjs/client.d.ts +24 -0
  4. package/dist/cjs/client.js +203 -0
  5. package/dist/cjs/errors.d.ts +76 -0
  6. package/dist/cjs/errors.js +128 -0
  7. package/dist/cjs/index.d.ts +59 -0
  8. package/dist/cjs/index.js +77 -0
  9. package/dist/cjs/package.json +3 -0
  10. package/dist/cjs/pagination.d.ts +24 -0
  11. package/dist/cjs/pagination.js +68 -0
  12. package/dist/cjs/resources/account.d.ts +58 -0
  13. package/dist/cjs/resources/account.js +48 -0
  14. package/dist/cjs/resources/archives.d.ts +16 -0
  15. package/dist/cjs/resources/archives.js +17 -0
  16. package/dist/cjs/resources/billing.d.ts +30 -0
  17. package/dist/cjs/resources/billing.js +45 -0
  18. package/dist/cjs/resources/companies.d.ts +47 -0
  19. package/dist/cjs/resources/companies.js +45 -0
  20. package/dist/cjs/resources/creditNotes.d.ts +64 -0
  21. package/dist/cjs/resources/creditNotes.js +62 -0
  22. package/dist/cjs/resources/customers.d.ts +17 -0
  23. package/dist/cjs/resources/customers.js +36 -0
  24. package/dist/cjs/resources/ereporting.d.ts +12 -0
  25. package/dist/cjs/resources/ereporting.js +23 -0
  26. package/dist/cjs/resources/events.d.ts +11 -0
  27. package/dist/cjs/resources/events.js +20 -0
  28. package/dist/cjs/resources/exports.d.ts +20 -0
  29. package/dist/cjs/resources/exports.js +31 -0
  30. package/dist/cjs/resources/health.d.ts +13 -0
  31. package/dist/cjs/resources/health.js +18 -0
  32. package/dist/cjs/resources/invoices.d.ts +112 -0
  33. package/dist/cjs/resources/invoices.js +141 -0
  34. package/dist/cjs/resources/jobs.d.ts +10 -0
  35. package/dist/cjs/resources/jobs.js +24 -0
  36. package/dist/cjs/resources/payments.d.ts +16 -0
  37. package/dist/cjs/resources/payments.js +25 -0
  38. package/dist/cjs/resources/products.d.ts +15 -0
  39. package/dist/cjs/resources/products.js +32 -0
  40. package/dist/cjs/resources/quotes.d.ts +44 -0
  41. package/dist/cjs/resources/quotes.js +58 -0
  42. package/dist/cjs/resources/received-invoices.d.ts +14 -0
  43. package/dist/cjs/resources/received-invoices.js +29 -0
  44. package/dist/cjs/resources/recurringInvoices.d.ts +15 -0
  45. package/dist/cjs/resources/recurringInvoices.js +32 -0
  46. package/dist/cjs/resources/reference.d.ts +45 -0
  47. package/dist/cjs/resources/reference.js +57 -0
  48. package/dist/cjs/resources/reporting.d.ts +11 -0
  49. package/dist/cjs/resources/reporting.js +30 -0
  50. package/dist/cjs/resources/sandbox.d.ts +12 -0
  51. package/dist/cjs/resources/sandbox.js +21 -0
  52. package/dist/cjs/resources/usage.d.ts +20 -0
  53. package/dist/cjs/resources/usage.js +25 -0
  54. package/dist/cjs/resources/validate.d.ts +18 -0
  55. package/dist/cjs/resources/validate.js +23 -0
  56. package/dist/cjs/resources/webhookEndpoints.d.ts +20 -0
  57. package/dist/cjs/resources/webhookEndpoints.js +31 -0
  58. package/dist/cjs/types.d.ts +1178 -0
  59. package/dist/cjs/types.js +5 -0
  60. package/dist/cjs/webhooks.d.ts +14 -0
  61. package/dist/cjs/webhooks.js +63 -0
  62. package/dist/esm/client.d.ts +25 -0
  63. package/dist/esm/client.d.ts.map +1 -0
  64. package/dist/esm/client.js +200 -0
  65. package/dist/esm/client.js.map +1 -0
  66. package/dist/esm/errors.d.ts +77 -0
  67. package/dist/esm/errors.d.ts.map +1 -0
  68. package/dist/esm/errors.js +114 -0
  69. package/dist/esm/errors.js.map +1 -0
  70. package/dist/esm/index.d.ts +60 -0
  71. package/dist/esm/index.d.ts.map +1 -0
  72. package/dist/esm/index.js +61 -0
  73. package/dist/esm/index.js.map +1 -0
  74. package/dist/esm/pagination.d.ts +25 -0
  75. package/dist/esm/pagination.d.ts.map +1 -0
  76. package/dist/esm/pagination.js +65 -0
  77. package/dist/esm/pagination.js.map +1 -0
  78. package/dist/esm/resources/account.d.ts +59 -0
  79. package/dist/esm/resources/account.d.ts.map +1 -0
  80. package/dist/esm/resources/account.js +45 -0
  81. package/dist/esm/resources/account.js.map +1 -0
  82. package/dist/esm/resources/archives.d.ts +17 -0
  83. package/dist/esm/resources/archives.d.ts.map +1 -0
  84. package/dist/esm/resources/archives.js +14 -0
  85. package/dist/esm/resources/archives.js.map +1 -0
  86. package/dist/esm/resources/billing.d.ts +31 -0
  87. package/dist/esm/resources/billing.d.ts.map +1 -0
  88. package/dist/esm/resources/billing.js +42 -0
  89. package/dist/esm/resources/billing.js.map +1 -0
  90. package/dist/esm/resources/companies.d.ts +48 -0
  91. package/dist/esm/resources/companies.d.ts.map +1 -0
  92. package/dist/esm/resources/companies.js +42 -0
  93. package/dist/esm/resources/companies.js.map +1 -0
  94. package/dist/esm/resources/creditNotes.d.ts +65 -0
  95. package/dist/esm/resources/creditNotes.d.ts.map +1 -0
  96. package/dist/esm/resources/creditNotes.js +59 -0
  97. package/dist/esm/resources/creditNotes.js.map +1 -0
  98. package/dist/esm/resources/customers.d.ts +18 -0
  99. package/dist/esm/resources/customers.d.ts.map +1 -0
  100. package/dist/esm/resources/customers.js +33 -0
  101. package/dist/esm/resources/customers.js.map +1 -0
  102. package/dist/esm/resources/ereporting.d.ts +13 -0
  103. package/dist/esm/resources/ereporting.d.ts.map +1 -0
  104. package/dist/esm/resources/ereporting.js +20 -0
  105. package/dist/esm/resources/ereporting.js.map +1 -0
  106. package/dist/esm/resources/events.d.ts +12 -0
  107. package/dist/esm/resources/events.d.ts.map +1 -0
  108. package/dist/esm/resources/events.js +17 -0
  109. package/dist/esm/resources/events.js.map +1 -0
  110. package/dist/esm/resources/exports.d.ts +21 -0
  111. package/dist/esm/resources/exports.d.ts.map +1 -0
  112. package/dist/esm/resources/exports.js +28 -0
  113. package/dist/esm/resources/exports.js.map +1 -0
  114. package/dist/esm/resources/health.d.ts +14 -0
  115. package/dist/esm/resources/health.d.ts.map +1 -0
  116. package/dist/esm/resources/health.js +15 -0
  117. package/dist/esm/resources/health.js.map +1 -0
  118. package/dist/esm/resources/invoices.d.ts +113 -0
  119. package/dist/esm/resources/invoices.d.ts.map +1 -0
  120. package/dist/esm/resources/invoices.js +138 -0
  121. package/dist/esm/resources/invoices.js.map +1 -0
  122. package/dist/esm/resources/jobs.d.ts +11 -0
  123. package/dist/esm/resources/jobs.d.ts.map +1 -0
  124. package/dist/esm/resources/jobs.js +21 -0
  125. package/dist/esm/resources/jobs.js.map +1 -0
  126. package/dist/esm/resources/payments.d.ts +17 -0
  127. package/dist/esm/resources/payments.d.ts.map +1 -0
  128. package/dist/esm/resources/payments.js +22 -0
  129. package/dist/esm/resources/payments.js.map +1 -0
  130. package/dist/esm/resources/products.d.ts +16 -0
  131. package/dist/esm/resources/products.d.ts.map +1 -0
  132. package/dist/esm/resources/products.js +29 -0
  133. package/dist/esm/resources/products.js.map +1 -0
  134. package/dist/esm/resources/quotes.d.ts +45 -0
  135. package/dist/esm/resources/quotes.d.ts.map +1 -0
  136. package/dist/esm/resources/quotes.js +55 -0
  137. package/dist/esm/resources/quotes.js.map +1 -0
  138. package/dist/esm/resources/received-invoices.d.ts +15 -0
  139. package/dist/esm/resources/received-invoices.d.ts.map +1 -0
  140. package/dist/esm/resources/received-invoices.js +26 -0
  141. package/dist/esm/resources/received-invoices.js.map +1 -0
  142. package/dist/esm/resources/recurringInvoices.d.ts +16 -0
  143. package/dist/esm/resources/recurringInvoices.d.ts.map +1 -0
  144. package/dist/esm/resources/recurringInvoices.js +29 -0
  145. package/dist/esm/resources/recurringInvoices.js.map +1 -0
  146. package/dist/esm/resources/reference.d.ts +46 -0
  147. package/dist/esm/resources/reference.d.ts.map +1 -0
  148. package/dist/esm/resources/reference.js +54 -0
  149. package/dist/esm/resources/reference.js.map +1 -0
  150. package/dist/esm/resources/reporting.d.ts +12 -0
  151. package/dist/esm/resources/reporting.d.ts.map +1 -0
  152. package/dist/esm/resources/reporting.js +27 -0
  153. package/dist/esm/resources/reporting.js.map +1 -0
  154. package/dist/esm/resources/sandbox.d.ts +13 -0
  155. package/dist/esm/resources/sandbox.d.ts.map +1 -0
  156. package/dist/esm/resources/sandbox.js +18 -0
  157. package/dist/esm/resources/sandbox.js.map +1 -0
  158. package/dist/esm/resources/usage.d.ts +21 -0
  159. package/dist/esm/resources/usage.d.ts.map +1 -0
  160. package/dist/esm/resources/usage.js +22 -0
  161. package/dist/esm/resources/usage.js.map +1 -0
  162. package/dist/esm/resources/validate.d.ts +19 -0
  163. package/dist/esm/resources/validate.d.ts.map +1 -0
  164. package/dist/esm/resources/validate.js +20 -0
  165. package/dist/esm/resources/validate.js.map +1 -0
  166. package/dist/esm/resources/webhookEndpoints.d.ts +21 -0
  167. package/dist/esm/resources/webhookEndpoints.d.ts.map +1 -0
  168. package/dist/esm/resources/webhookEndpoints.js +28 -0
  169. package/dist/esm/resources/webhookEndpoints.js.map +1 -0
  170. package/dist/esm/types.d.ts +1179 -0
  171. package/dist/esm/types.d.ts.map +1 -0
  172. package/dist/esm/types.js +5 -0
  173. package/dist/esm/types.js.map +1 -0
  174. package/dist/esm/webhooks.d.ts +15 -0
  175. package/dist/esm/webhooks.d.ts.map +1 -0
  176. package/dist/esm/webhooks.js +60 -0
  177. package/dist/esm/webhooks.js.map +1 -0
  178. package/package.json +66 -0
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ---------------------------------------------------------------------------
3
+ // Configuration
4
+ // ---------------------------------------------------------------------------
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import type { WebhookEvent } from './types.js';
2
+ export interface WebhookVerifyOptions {
3
+ /** Max event age in seconds (default: 300). */
4
+ tolerance?: number;
5
+ }
6
+ /** HMAC-SHA256 webhook signature verification. Header format: `t=<ts>,v1=<sig>` */
7
+ export declare class Webhooks {
8
+ /** Verify signature and parse the event payload. */
9
+ constructEvent(payload: string | Buffer, signature: string, secret: string, options?: WebhookVerifyOptions): WebhookEvent;
10
+ /** Verify signature without parsing. Throws on mismatch or stale timestamp. */
11
+ verifySignature(payload: string | Buffer, signature: string, secret: string, options?: WebhookVerifyOptions): void;
12
+ /** Generate a test signature header. */
13
+ generateTestSignature(payload: string, secret: string, timestamp?: number): string;
14
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Webhooks = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const errors_js_1 = require("./errors.js");
6
+ const DEFAULT_TOLERANCE_SECONDS = 300; // 5 minutes
7
+ /** HMAC-SHA256 webhook signature verification. Header format: `t=<ts>,v1=<sig>` */
8
+ class Webhooks {
9
+ /** Verify signature and parse the event payload. */
10
+ constructEvent(payload, signature, secret, options) {
11
+ this.verifySignature(payload, signature, secret, options);
12
+ const body = typeof payload === 'string' ? payload : payload.toString('utf-8');
13
+ const event = JSON.parse(body);
14
+ return event;
15
+ }
16
+ /** Verify signature without parsing. Throws on mismatch or stale timestamp. */
17
+ verifySignature(payload, signature, secret, options) {
18
+ if (!signature) {
19
+ throw new errors_js_1.FacturinoError('Missing Facturino-Signature header');
20
+ }
21
+ if (!secret) {
22
+ throw new errors_js_1.FacturinoError('Missing webhook signing secret');
23
+ }
24
+ const tolerance = options?.tolerance ?? DEFAULT_TOLERANCE_SECONDS;
25
+ const parts = signature.split(',');
26
+ const timestampPart = parts.find((p) => p.startsWith('t='));
27
+ const signaturePart = parts.find((p) => p.startsWith('v1='));
28
+ if (!timestampPart || !signaturePart) {
29
+ throw new errors_js_1.FacturinoError('Invalid Facturino-Signature header format. Expected "t=<timestamp>,v1=<signature>".');
30
+ }
31
+ const timestamp = parseInt(timestampPart.slice(2), 10);
32
+ const expectedSignature = signaturePart.slice(3);
33
+ if (Number.isNaN(timestamp)) {
34
+ throw new errors_js_1.FacturinoError('Invalid timestamp in Facturino-Signature header');
35
+ }
36
+ const now = Math.floor(Date.now() / 1000);
37
+ if (Math.abs(now - timestamp) > tolerance) {
38
+ throw new errors_js_1.FacturinoError(`Webhook timestamp is outside tolerance of ${tolerance} seconds. ` +
39
+ `Event timestamp: ${timestamp}, current time: ${now}.`);
40
+ }
41
+ const payloadStr = typeof payload === 'string' ? payload : payload.toString('utf-8');
42
+ const signedPayload = `${timestamp}.${payloadStr}`;
43
+ const computedSignature = (0, node_crypto_1.createHmac)('sha256', secret)
44
+ .update(signedPayload)
45
+ .digest('hex');
46
+ const expectedBuf = Buffer.from(expectedSignature, 'hex');
47
+ const computedBuf = Buffer.from(computedSignature, 'hex');
48
+ if (expectedBuf.length !== computedBuf.length ||
49
+ !(0, node_crypto_1.timingSafeEqual)(expectedBuf, computedBuf)) {
50
+ throw new errors_js_1.FacturinoError('Webhook signature verification failed. The payload may have been tampered with.');
51
+ }
52
+ }
53
+ /** Generate a test signature header. */
54
+ generateTestSignature(payload, secret, timestamp) {
55
+ const ts = timestamp ?? Math.floor(Date.now() / 1000);
56
+ const signedPayload = `${ts}.${payload}`;
57
+ const signature = (0, node_crypto_1.createHmac)('sha256', secret)
58
+ .update(signedPayload)
59
+ .digest('hex');
60
+ return `t=${ts},v1=${signature}`;
61
+ }
62
+ }
63
+ exports.Webhooks = Webhooks;
@@ -0,0 +1,25 @@
1
+ import type { FacturinoConfig, RequestOptions } from './types.js';
2
+ /** HTTP client with retries, exponential backoff, and structured errors. */
3
+ export declare class HttpClient {
4
+ private readonly apiKey;
5
+ private readonly baseUrl;
6
+ private readonly maxRetries;
7
+ private readonly timeout;
8
+ private readonly apiVersion;
9
+ constructor(apiKey: string, config?: FacturinoConfig);
10
+ request<T>(method: string, path: string, body?: unknown, options?: RequestOptions): Promise<T>;
11
+ get<T>(path: string): Promise<T>;
12
+ post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
13
+ patch<T>(path: string, body: unknown): Promise<T>;
14
+ del<T>(path: string, body?: unknown): Promise<T>;
15
+ /**
16
+ * Map an HTTP status + error body to the most specific {@link ApiError}
17
+ * subclass. Both the status and the `error.type` from the body are used:
18
+ * the status decides the primary class (401 → Authentication, 429 →
19
+ * RateLimit…) but for 4xx codes that share a status — notably 422 vs
20
+ * 400 — we look at `body.error.type` to discriminate further.
21
+ */
22
+ private buildError;
23
+ private getRetryDelay;
24
+ }
25
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,cAAc,EAAE,MAAM,YAAY,CAAA;AA0B/E,4EAA4E;AAC5E,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;gBAEvB,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,eAAoB;IAoBlD,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,CAAC;IAqHP,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAI3E,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAItD;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAgDlB,OAAO,CAAC,aAAa;CAStB"}
@@ -0,0 +1,200 @@
1
+ import { ApiError, ApiInternalError, AuthenticationError, ConflictError, ConnectionError, InvalidRequestError, NotFoundError, PermissionError, PlanLimitError, RateLimitError, ValidationError, } from './errors.js';
2
+ const DEFAULT_BASE_URL = 'https://facturino.com/api';
3
+ const DEFAULT_MAX_RETRIES = 3;
4
+ const DEFAULT_TIMEOUT = 30000;
5
+ const DEFAULT_API_VERSION = '2026-03-01';
6
+ const RETRYABLE_STATUS_CODES = new Set([429, 500, 502, 503]);
7
+ const INITIAL_RETRY_DELAY_MS = 500;
8
+ const MAX_RETRY_DELAY_MS = 30000;
9
+ const VERSION = '1.0.0';
10
+ /** HTTP client with retries, exponential backoff, and structured errors. */
11
+ export class HttpClient {
12
+ constructor(apiKey, config = {}) {
13
+ if (!apiKey) {
14
+ throw new Error('No API key provided. Pass your key as the first argument: new Facturino("fac_test_...")');
15
+ }
16
+ if (!apiKey.startsWith('fac_test_') && !apiKey.startsWith('fac_live_')) {
17
+ throw new Error('Invalid API key format. Keys must start with "fac_test_" or "fac_live_".');
18
+ }
19
+ this.apiKey = apiKey;
20
+ this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
21
+ this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
22
+ this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
23
+ this.apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;
24
+ }
25
+ async request(method, path, body, options) {
26
+ const url = `${this.baseUrl}${path}`;
27
+ const headers = {
28
+ 'Authorization': `Bearer ${this.apiKey}`,
29
+ 'Content-Type': 'application/json',
30
+ 'Accept': 'application/json',
31
+ 'Facturino-Version': this.apiVersion,
32
+ 'User-Agent': `facturino-node/${VERSION}`,
33
+ };
34
+ if (options?.idempotencyKey) {
35
+ headers['Idempotency-Key'] = options.idempotencyKey;
36
+ }
37
+ let lastError = null;
38
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
39
+ if (attempt > 0) {
40
+ const delay = this.getRetryDelay(attempt, lastError);
41
+ await sleep(delay);
42
+ }
43
+ const controller = new AbortController();
44
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
45
+ try {
46
+ const fetchOptions = {
47
+ method,
48
+ headers,
49
+ signal: controller.signal,
50
+ };
51
+ if (body !== undefined && method !== 'GET') {
52
+ fetchOptions.body = JSON.stringify(body);
53
+ }
54
+ const response = await fetch(url, fetchOptions);
55
+ clearTimeout(timeoutId);
56
+ if (response.status === 204) {
57
+ return undefined;
58
+ }
59
+ let responseBody;
60
+ const contentType = response.headers.get('content-type') ?? '';
61
+ if (contentType.includes('application/json')) {
62
+ responseBody = await response.json();
63
+ }
64
+ else {
65
+ const text = await response.text();
66
+ responseBody = text;
67
+ }
68
+ if (response.ok) {
69
+ return responseBody;
70
+ }
71
+ const errorBody = responseBody;
72
+ const hasStructuredError = errorBody &&
73
+ typeof errorBody === 'object' &&
74
+ 'error' in errorBody &&
75
+ typeof errorBody.error === 'object';
76
+ if (!hasStructuredError) {
77
+ const syntheticError = {
78
+ error: {
79
+ type: 'api_error',
80
+ code: 'unknown',
81
+ message: typeof responseBody === 'string' ? responseBody : `HTTP ${response.status}`,
82
+ request_id: response.headers.get('x-request-id') ?? 'req_unknown',
83
+ },
84
+ };
85
+ lastError = this.buildError(response.status, syntheticError, response.headers);
86
+ }
87
+ else {
88
+ lastError = this.buildError(response.status, errorBody, response.headers);
89
+ }
90
+ if (RETRYABLE_STATUS_CODES.has(response.status) && attempt < this.maxRetries) {
91
+ continue;
92
+ }
93
+ throw lastError;
94
+ }
95
+ catch (err) {
96
+ clearTimeout(timeoutId);
97
+ if (err instanceof ApiError) {
98
+ throw err;
99
+ }
100
+ if (err instanceof Error && err.name === 'AbortError') {
101
+ lastError = new ConnectionError(`Request to ${method} ${path} timed out after ${this.timeout}ms`);
102
+ if (attempt < this.maxRetries) {
103
+ continue;
104
+ }
105
+ throw lastError;
106
+ }
107
+ if (err instanceof TypeError && (err.message.includes('fetch') || err.message.includes('network'))) {
108
+ lastError = new ConnectionError(`Network error on ${method} ${path}: ${err.message}`);
109
+ if (attempt < this.maxRetries) {
110
+ continue;
111
+ }
112
+ throw lastError;
113
+ }
114
+ throw err;
115
+ }
116
+ }
117
+ throw lastError ?? new ConnectionError('Request failed after all retries');
118
+ }
119
+ async get(path) {
120
+ return this.request('GET', path);
121
+ }
122
+ async post(path, body, options) {
123
+ return this.request('POST', path, body, options);
124
+ }
125
+ async patch(path, body) {
126
+ return this.request('PATCH', path, body);
127
+ }
128
+ async del(path, body) {
129
+ return this.request('DELETE', path, body);
130
+ }
131
+ /**
132
+ * Map an HTTP status + error body to the most specific {@link ApiError}
133
+ * subclass. Both the status and the `error.type` from the body are used:
134
+ * the status decides the primary class (401 → Authentication, 429 →
135
+ * RateLimit…) but for 4xx codes that share a status — notably 422 vs
136
+ * 400 — we look at `body.error.type` to discriminate further.
137
+ */
138
+ buildError(status, body, headers) {
139
+ const type = body?.error?.type;
140
+ switch (status) {
141
+ case 400:
142
+ return new InvalidRequestError(status, body);
143
+ case 401:
144
+ return new AuthenticationError(status, body);
145
+ case 402:
146
+ return new PlanLimitError(status, body);
147
+ case 403:
148
+ return new PermissionError(status, body);
149
+ case 404:
150
+ return new NotFoundError(status, body);
151
+ case 409:
152
+ return new ConflictError(status, body);
153
+ case 422:
154
+ return new ValidationError(status, body);
155
+ case 429: {
156
+ const retryAfterHeader = headers.get('retry-after');
157
+ const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : null;
158
+ return new RateLimitError(status, body, Number.isNaN(retryAfter) ? null : retryAfter);
159
+ }
160
+ case 500:
161
+ case 502:
162
+ case 503:
163
+ case 504:
164
+ return new ApiInternalError(status, body);
165
+ default:
166
+ // Use the body `type` as a fallback for non-standard status codes so
167
+ // a 418 with `type: 'rate_limit_error'` still maps to the right
168
+ // class instead of falling through to the generic `ApiError`.
169
+ if (type === 'validation_error')
170
+ return new ValidationError(status, body);
171
+ if (type === 'authentication_error')
172
+ return new AuthenticationError(status, body);
173
+ if (type === 'permission_error')
174
+ return new PermissionError(status, body);
175
+ if (type === 'conflict_error')
176
+ return new ConflictError(status, body);
177
+ if (type === 'plan_limit_error')
178
+ return new PlanLimitError(status, body);
179
+ if (type === 'rate_limit_error')
180
+ return new RateLimitError(status, body, null);
181
+ if (type === 'not_found_error')
182
+ return new NotFoundError(status, body);
183
+ if (type === 'api_error')
184
+ return new ApiInternalError(status, body);
185
+ return new ApiError(status, body);
186
+ }
187
+ }
188
+ getRetryDelay(attempt, lastError) {
189
+ if (lastError instanceof RateLimitError && lastError.retryAfter !== null) {
190
+ return Math.min(lastError.retryAfter * 1000, MAX_RETRY_DELAY_MS);
191
+ }
192
+ const baseDelay = INITIAL_RETRY_DELAY_MS * Math.pow(2, attempt - 1);
193
+ const jitter = baseDelay * 0.2 * Math.random();
194
+ return Math.min(baseDelay + jitter, MAX_RETRY_DELAY_MS);
195
+ }
196
+ }
197
+ function sleep(ms) {
198
+ return new Promise((resolve) => setTimeout(resolve, ms));
199
+ }
200
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAA;AAEpB,MAAM,gBAAgB,GAAG,2BAA2B,CAAA;AACpD,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAC7B,MAAM,eAAe,GAAG,KAAM,CAAA;AAC9B,MAAM,mBAAmB,GAAG,YAAY,CAAA;AAExC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAA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M,EAAE,IAAI,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;IAEO,aAAa,CAAC,OAAe,EAAE,SAAuB;QAC5D,IAAI,SAAS,YAAY,cAAc,IAAI,SAAS,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YACzE,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAA;QAClE,CAAC;QAED,MAAM,SAAS,GAAG,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAA;QACnE,MAAM,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACzD,CAAC;CACF;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { ApiErrorBody } from './types.js';
2
+ /** Base SDK error. */
3
+ export declare class FacturinoError extends Error {
4
+ constructor(message: string);
5
+ }
6
+ /** Structured API error response. */
7
+ export declare class ApiError extends FacturinoError {
8
+ readonly status: number;
9
+ readonly type: string;
10
+ readonly code: string;
11
+ readonly param?: string;
12
+ readonly docUrl?: string;
13
+ readonly requestId: string;
14
+ readonly hint?: string;
15
+ constructor(status: number, body: ApiErrorBody);
16
+ }
17
+ /**
18
+ * 400 — request payload is malformed, a field is missing or invalid.
19
+ * Inspect `error.param` to identify the offending field.
20
+ */
21
+ export declare class InvalidRequestError extends ApiError {
22
+ constructor(status: number, body: ApiErrorBody);
23
+ }
24
+ /**
25
+ * 422 — Zod schema validation rejected the payload. The offending field is
26
+ * surfaced in `error.param`. Distinct from {@link InvalidRequestError} so
27
+ * callers can differentiate "shape malformed" (400) from "value out of
28
+ * range / wrong type" (422) when re-displaying validation feedback.
29
+ */
30
+ export declare class ValidationError extends ApiError {
31
+ constructor(status: number, body: ApiErrorBody);
32
+ }
33
+ /** 401 — invalid, revoked, or missing API key. */
34
+ export declare class AuthenticationError extends ApiError {
35
+ constructor(status: number, body: ApiErrorBody);
36
+ }
37
+ /**
38
+ * 403 — the API key authenticated successfully but lacks the scope required
39
+ * for the requested operation. The required scope is exposed in
40
+ * `error.param`.
41
+ */
42
+ export declare class PermissionError extends ApiError {
43
+ constructor(status: number, body: ApiErrorBody);
44
+ }
45
+ /** 404 — resource not found, or not visible with this key's livemode. */
46
+ export declare class NotFoundError extends ApiError {
47
+ constructor(status: number, body: ApiErrorBody);
48
+ }
49
+ /**
50
+ * 409 — the request conflicts with the current state of the resource
51
+ * (state-machine transition refused, finalized invoice cannot be edited,
52
+ * idempotency key reused with a different payload).
53
+ */
54
+ export declare class ConflictError extends ApiError {
55
+ constructor(status: number, body: ApiErrorBody);
56
+ }
57
+ /** 429 — rate limit exceeded. `retryAfter` is the recommended back-off in seconds. */
58
+ export declare class RateLimitError extends ApiError {
59
+ readonly retryAfter: number | null;
60
+ constructor(status: number, body: ApiErrorBody, retryAfter: number | null);
61
+ }
62
+ /** 402 — quota or plan limit exceeded. Upgrade or revoke resources to recover. */
63
+ export declare class PlanLimitError extends ApiError {
64
+ constructor(status: number, body: ApiErrorBody);
65
+ }
66
+ /**
67
+ * 500/503 — Facturino is experiencing an internal error. The API is monitored
68
+ * automatically; safe to retry with exponential back-off.
69
+ */
70
+ export declare class ApiInternalError extends ApiError {
71
+ constructor(status: number, body: ApiErrorBody);
72
+ }
73
+ /** Network or timeout error. Not surfaced by the API itself. */
74
+ export declare class ConnectionError extends FacturinoError {
75
+ constructor(message: string);
76
+ }
77
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.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qBAAa,cAAe,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;gBAEtB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;CAK1E;AAED,kFAAkF;AAClF,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;CAI/C;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;gBAChC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;CAI/C;AAED,gEAAgE;AAChE,qBAAa,eAAgB,SAAQ,cAAc;gBACrC,OAAO,EAAE,MAAM;CAI5B"}
@@ -0,0 +1,114 @@
1
+ /** Base SDK error. */
2
+ export class FacturinoError extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = 'FacturinoError';
6
+ Object.setPrototypeOf(this, new.target.prototype);
7
+ }
8
+ }
9
+ /** Structured API error response. */
10
+ export class ApiError extends FacturinoError {
11
+ constructor(status, body) {
12
+ const err = body.error;
13
+ super(err.message);
14
+ this.name = 'ApiError';
15
+ this.status = status;
16
+ this.type = err.type;
17
+ this.code = err.code;
18
+ this.param = err.param;
19
+ this.docUrl = err.doc_url;
20
+ this.requestId = err.request_id;
21
+ this.hint = err.hint;
22
+ }
23
+ }
24
+ /**
25
+ * 400 — request payload is malformed, a field is missing or invalid.
26
+ * Inspect `error.param` to identify the offending field.
27
+ */
28
+ export class InvalidRequestError extends ApiError {
29
+ constructor(status, body) {
30
+ super(status, body);
31
+ this.name = 'InvalidRequestError';
32
+ }
33
+ }
34
+ /**
35
+ * 422 — Zod schema validation rejected the payload. The offending field is
36
+ * surfaced in `error.param`. Distinct from {@link InvalidRequestError} so
37
+ * callers can differentiate "shape malformed" (400) from "value out of
38
+ * range / wrong type" (422) when re-displaying validation feedback.
39
+ */
40
+ export class ValidationError extends ApiError {
41
+ constructor(status, body) {
42
+ super(status, body);
43
+ this.name = 'ValidationError';
44
+ }
45
+ }
46
+ /** 401 — invalid, revoked, or missing API key. */
47
+ export class AuthenticationError extends ApiError {
48
+ constructor(status, body) {
49
+ super(status, body);
50
+ this.name = 'AuthenticationError';
51
+ }
52
+ }
53
+ /**
54
+ * 403 — the API key authenticated successfully but lacks the scope required
55
+ * for the requested operation. The required scope is exposed in
56
+ * `error.param`.
57
+ */
58
+ export class PermissionError extends ApiError {
59
+ constructor(status, body) {
60
+ super(status, body);
61
+ this.name = 'PermissionError';
62
+ }
63
+ }
64
+ /** 404 — resource not found, or not visible with this key's livemode. */
65
+ export class NotFoundError extends ApiError {
66
+ constructor(status, body) {
67
+ super(status, body);
68
+ this.name = 'NotFoundError';
69
+ }
70
+ }
71
+ /**
72
+ * 409 — the request conflicts with the current state of the resource
73
+ * (state-machine transition refused, finalized invoice cannot be edited,
74
+ * idempotency key reused with a different payload).
75
+ */
76
+ export class ConflictError extends ApiError {
77
+ constructor(status, body) {
78
+ super(status, body);
79
+ this.name = 'ConflictError';
80
+ }
81
+ }
82
+ /** 429 — rate limit exceeded. `retryAfter` is the recommended back-off in seconds. */
83
+ export class RateLimitError extends ApiError {
84
+ constructor(status, body, retryAfter) {
85
+ super(status, body);
86
+ this.name = 'RateLimitError';
87
+ this.retryAfter = retryAfter;
88
+ }
89
+ }
90
+ /** 402 — quota or plan limit exceeded. Upgrade or revoke resources to recover. */
91
+ export class PlanLimitError extends ApiError {
92
+ constructor(status, body) {
93
+ super(status, body);
94
+ this.name = 'PlanLimitError';
95
+ }
96
+ }
97
+ /**
98
+ * 500/503 — Facturino is experiencing an internal error. The API is monitored
99
+ * automatically; safe to retry with exponential back-off.
100
+ */
101
+ export class ApiInternalError extends ApiError {
102
+ constructor(status, body) {
103
+ super(status, body);
104
+ this.name = 'ApiInternalError';
105
+ }
106
+ }
107
+ /** Network or timeout error. Not surfaced by the API itself. */
108
+ export class ConnectionError extends FacturinoError {
109
+ constructor(message) {
110
+ super(message);
111
+ this.name = 'ConnectionError';
112
+ }
113
+ }
114
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAEA,sBAAsB;AACtB,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACnD,CAAC;CACF;AAED,qCAAqC;AACrC,MAAM,OAAO,QAAS,SAAQ,cAAc;IAS1C,YAAY,MAAc,EAAE,IAAkB;QAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAA;QACtB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAClB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAA;QACzB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,UAAU,CAAA;QAC/B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACtB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IAC/C,YAAY,MAAc,EAAE,IAAkB;QAC5C,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,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O,cAAe,SAAQ,QAAQ;IAC1C,YAAY,MAAc,EAAE,IAAkB;QAC5C,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,QAAQ;IAC5C,YAAY,MAAc,EAAE,IAAkB;QAC5C,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAChC,CAAC;CACF;AAED,gEAAgE;AAChE,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF"}
@@ -0,0 +1,60 @@
1
+ import { Webhooks } from './webhooks.js';
2
+ import { Invoices } from './resources/invoices.js';
3
+ import { Payments } from './resources/payments.js';
4
+ import { Customers } from './resources/customers.js';
5
+ import { Products } from './resources/products.js';
6
+ import { Quotes } from './resources/quotes.js';
7
+ import { CreditNotes } from './resources/creditNotes.js';
8
+ import { Events } from './resources/events.js';
9
+ import { WebhookEndpoints } from './resources/webhookEndpoints.js';
10
+ import { RecurringInvoices } from './resources/recurringInvoices.js';
11
+ import { Companies } from './resources/companies.js';
12
+ import { Exports } from './resources/exports.js';
13
+ import { EReportingResource } from './resources/ereporting.js';
14
+ import { Jobs } from './resources/jobs.js';
15
+ import { Sandbox } from './resources/sandbox.js';
16
+ import { ReceivedInvoices } from './resources/received-invoices.js';
17
+ import { Reporting } from './resources/reporting.js';
18
+ import { AccountResource } from './resources/account.js';
19
+ import { Billing } from './resources/billing.js';
20
+ import { Usage } from './resources/usage.js';
21
+ import { Validate } from './resources/validate.js';
22
+ import { Reference } from './resources/reference.js';
23
+ import { Archives } from './resources/archives.js';
24
+ import { Health } from './resources/health.js';
25
+ import type { FacturinoConfig } from './types.js';
26
+ /** Facturino API client for French e-invoicing — initialize with your API key to access all resources. */
27
+ declare class Facturino {
28
+ readonly account: AccountResource;
29
+ readonly billing: Billing;
30
+ readonly invoices: Invoices;
31
+ readonly payments: Payments;
32
+ readonly customers: Customers;
33
+ readonly products: Products;
34
+ readonly quotes: Quotes;
35
+ readonly creditNotes: CreditNotes;
36
+ readonly events: Events;
37
+ readonly webhookEndpoints: WebhookEndpoints;
38
+ readonly recurringInvoices: RecurringInvoices;
39
+ readonly companies: Companies;
40
+ readonly exports: Exports;
41
+ readonly ereporting: EReportingResource;
42
+ readonly jobs: Jobs;
43
+ readonly reference: Reference;
44
+ readonly sandbox: Sandbox;
45
+ readonly usage: Usage;
46
+ readonly validate: Validate;
47
+ readonly webhooks: Webhooks;
48
+ readonly receivedInvoices: ReceivedInvoices;
49
+ readonly reporting: Reporting;
50
+ readonly archives: Archives;
51
+ readonly health: Health;
52
+ constructor(apiKey: string, config?: FacturinoConfig);
53
+ }
54
+ export default Facturino;
55
+ export { Facturino };
56
+ export type { FacturinoConfig, RequestOptions, PaginationParams, PaginatedResponse, ApiErrorBody, Address, Contact, ContactRole, LineItem, VatBreakdown, Totals, CustomerRef, CustomerSnapshot, LifecycleEntry, Currency, Unit, VatCode, VatexCode, PaymentMethod, InvoiceType, InvoiceStatus, InvoiceDates, InvoicePaymentTerms, InvoiceEinvoicing, InvoicePortal, InvoiceArchive, InvoiceFiles, Invoice, InvoiceExpandField, InvoiceExpanded, InvoiceRetrieveParams, InvoiceBuyerParam, InvoiceCreateDates, InvoiceCreateParams, InvoiceLineItemParam, InvoiceUpdateParams, InvoiceListParams, IncomingInvoiceCreateParams, InvoiceStatusResponse, InvoiceVerifyResponse, DocumentUrlResponse, JobResponse, PaymentLinkResponse, PaymentLinkCreateParams, PaymentTokenResponse, Payment, PaymentCreateParams, Customer, CustomerCreateParams, CustomerUpdateParams, CustomerListParams, CustomerLookupParams, SireneLookupResponse, SireneCompany, Product, PriceHistoryEntry, ProductCreateParams, ProductUpdateParams, ProductListParams, QuoteStatus, QuoteDates, QuoteSignature, Quote, QuoteCreateParams, QuoteUpdateParams, QuoteListParams, CreditNoteType, CreditNoteStatus, CreditNoteReasonCode, CreditNote, CreditNoteCreateParams, CreditNoteUpdateParams, CreditNoteListParams, WebhookEventType, WebhookEvent, EventListParams, WebhookEndpoint, WebhookEndpointCreateParams, WebhookEndpointUpdateParams, RecurringFrequency, RecurringInvoice, RecurringInvoiceCreateParams, RecurringInvoiceUpdateParams, RecurringInvoiceListParams, BankDetails, InvoiceSettings, CreditNoteSettings, CreditNoteNumberingMode, Company, CompanyUpdateParams, CgvResponse, FecExportParams, EReportingType, EReportingStatus, EReportingLine, EReportingLineResponse, EReporting, EReportingCreateParams, EReportingListParams, JobType, JobStatus, Job, SandboxResetResponse, SimulateStatusParams, SimulateStatusResponse, ReceivedInvoiceStatus, ReceivedInvoice, ReceivedInvoiceListParams, ReceivedInvoiceRefuseParams, ReceivedInvoiceRecordPaymentParams, ReceivedInvoiceActionResponse, VatReportParams, VatReportBreakdown, VatReport, RevenueReportParams, RevenueReportBreakdownItem, RevenueReport, AccountPlan, Account, BillingCycle, BillingSubscription, PlatformInvoice, UsageMeter, UsageSummary, ValidateParams, ValidateResponse, LegalForm, NafCode, LegalFormInput, NafCodeInput, PaProvider, HealthStatus, } from './types.js';
57
+ export { FacturinoError, ApiError, InvalidRequestError, ValidationError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, PlanLimitError, ApiInternalError, ConnectionError, } from './errors.js';
58
+ export { Webhooks } from './webhooks.js';
59
+ export { AutoPaginatingList } from './pagination.js';
60
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAA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