@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,44 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import { AutoPaginatingList } from '../pagination.js';
3
+ import type { Quote, QuoteCreateParams, QuoteUpdateParams, QuoteListParams, DocumentUrlResponse, JobResponse, Invoice, RequestOptions } from '../types.js';
4
+ /** Quote lifecycle — create, send, accept or refuse, and convert to invoice. */
5
+ export declare class Quotes {
6
+ private readonly client;
7
+ constructor(client: HttpClient);
8
+ create(params: QuoteCreateParams, options?: RequestOptions): Promise<Quote>;
9
+ list(params?: QuoteListParams): AutoPaginatingList<Quote>;
10
+ get(id: string): Promise<Quote>;
11
+ update(id: string, params: QuoteUpdateParams): Promise<Quote>;
12
+ del(id: string): Promise<void>;
13
+ send(id: string, options?: RequestOptions): Promise<Quote>;
14
+ /**
15
+ * Send the quote to its customer by email with the PDF attached. Returns
16
+ * `{status: 'sent'}` on success or `{status: 'pending'}` if the PDF is
17
+ * still being generated (caller should poll the returned `jobId`).
18
+ */
19
+ email(id: string, params?: {
20
+ recipientEmail?: string;
21
+ customMessage?: string;
22
+ customSubject?: string;
23
+ }, options?: RequestOptions): Promise<{
24
+ status: 'sent';
25
+ quoteId: string;
26
+ recipient: string;
27
+ sentAt: string;
28
+ } | {
29
+ status: 'pending';
30
+ quoteId: string;
31
+ jobId: string;
32
+ pollUrl: string;
33
+ reason: string;
34
+ }>;
35
+ accept(id: string, options?: RequestOptions): Promise<Quote>;
36
+ refuse(id: string, options?: RequestOptions): Promise<Quote>;
37
+ /** Convert accepted quote to draft invoice. */
38
+ convert(id: string, options?: RequestOptions): Promise<Invoice>;
39
+ /** Clone as new draft quote. */
40
+ clone(id: string, options?: RequestOptions): Promise<Quote>;
41
+ getPdf(id: string): Promise<DocumentUrlResponse | JobResponse>;
42
+ /** Retrieve the electronic signature proof for an accepted quote. */
43
+ getSignatureProof(id: string): Promise<DocumentUrlResponse>;
44
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Quotes = void 0;
4
+ const pagination_js_1 = require("../pagination.js");
5
+ /** Quote lifecycle — create, send, accept or refuse, and convert to invoice. */
6
+ class Quotes {
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async create(params, options) {
11
+ return this.client.post('/v1/quotes', params, options);
12
+ }
13
+ list(params) {
14
+ return new pagination_js_1.AutoPaginatingList(this.client, '/v1/quotes', params);
15
+ }
16
+ async get(id) {
17
+ return this.client.get(`/v1/quotes/${id}`);
18
+ }
19
+ async update(id, params) {
20
+ return this.client.patch(`/v1/quotes/${id}`, params);
21
+ }
22
+ async del(id) {
23
+ await this.client.del(`/v1/quotes/${id}`);
24
+ }
25
+ async send(id, options) {
26
+ return this.client.post(`/v1/quotes/${id}/send`, undefined, options);
27
+ }
28
+ /**
29
+ * Send the quote to its customer by email with the PDF attached. Returns
30
+ * `{status: 'sent'}` on success or `{status: 'pending'}` if the PDF is
31
+ * still being generated (caller should poll the returned `jobId`).
32
+ */
33
+ async email(id, params, options) {
34
+ return this.client.post(`/v1/quotes/${id}/email`, params, options);
35
+ }
36
+ async accept(id, options) {
37
+ return this.client.post(`/v1/quotes/${id}/accept`, undefined, options);
38
+ }
39
+ async refuse(id, options) {
40
+ return this.client.post(`/v1/quotes/${id}/refuse`, undefined, options);
41
+ }
42
+ /** Convert accepted quote to draft invoice. */
43
+ async convert(id, options) {
44
+ return this.client.post(`/v1/quotes/${id}/convert`, undefined, options);
45
+ }
46
+ /** Clone as new draft quote. */
47
+ async clone(id, options) {
48
+ return this.client.post(`/v1/quotes/${id}/clone`, undefined, options);
49
+ }
50
+ async getPdf(id) {
51
+ return this.client.get(`/v1/quotes/${id}/pdf`);
52
+ }
53
+ /** Retrieve the electronic signature proof for an accepted quote. */
54
+ async getSignatureProof(id) {
55
+ return this.client.get(`/v1/quotes/${id}/signature-proof`);
56
+ }
57
+ }
58
+ exports.Quotes = Quotes;
@@ -0,0 +1,14 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import { AutoPaginatingList } from '../pagination.js';
3
+ import type { ReceivedInvoice, ReceivedInvoiceListParams, ReceivedInvoiceRefuseParams, ReceivedInvoiceRecordPaymentParams, ReceivedInvoiceActionResponse } from '../types.js';
4
+ /** Received (incoming) invoices from PA — list, retrieve, approve, refuse, suspend, record payment. */
5
+ export declare class ReceivedInvoices {
6
+ private readonly client;
7
+ constructor(client: HttpClient);
8
+ list(params?: ReceivedInvoiceListParams): AutoPaginatingList<ReceivedInvoice>;
9
+ get(id: string): Promise<ReceivedInvoice>;
10
+ approve(id: string): Promise<ReceivedInvoiceActionResponse>;
11
+ refuse(id: string, params: ReceivedInvoiceRefuseParams): Promise<ReceivedInvoiceActionResponse>;
12
+ suspend(id: string): Promise<ReceivedInvoiceActionResponse>;
13
+ recordPayment(id: string, params: ReceivedInvoiceRecordPaymentParams): Promise<ReceivedInvoiceActionResponse>;
14
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReceivedInvoices = void 0;
4
+ const pagination_js_1 = require("../pagination.js");
5
+ /** Received (incoming) invoices from PA — list, retrieve, approve, refuse, suspend, record payment. */
6
+ class ReceivedInvoices {
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ list(params) {
11
+ return new pagination_js_1.AutoPaginatingList(this.client, '/v1/received-invoices', params);
12
+ }
13
+ async get(id) {
14
+ return this.client.get(`/v1/received-invoices/${id}`);
15
+ }
16
+ async approve(id) {
17
+ return this.client.post(`/v1/received-invoices/${id}/approve`);
18
+ }
19
+ async refuse(id, params) {
20
+ return this.client.post(`/v1/received-invoices/${id}/refuse`, params);
21
+ }
22
+ async suspend(id) {
23
+ return this.client.post(`/v1/received-invoices/${id}/suspend`);
24
+ }
25
+ async recordPayment(id, params) {
26
+ return this.client.post(`/v1/received-invoices/${id}/record-payment`, params);
27
+ }
28
+ }
29
+ exports.ReceivedInvoices = ReceivedInvoices;
@@ -0,0 +1,15 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import { AutoPaginatingList } from '../pagination.js';
3
+ import type { RecurringInvoice, RecurringInvoiceCreateParams, RecurringInvoiceUpdateParams, RecurringInvoiceListParams, RequestOptions } from '../types.js';
4
+ /** Scheduled invoice templates that automatically generate invoices on a recurring basis. */
5
+ export declare class RecurringInvoices {
6
+ private readonly client;
7
+ constructor(client: HttpClient);
8
+ create(params: RecurringInvoiceCreateParams, options?: RequestOptions): Promise<RecurringInvoice>;
9
+ list(params?: RecurringInvoiceListParams): AutoPaginatingList<RecurringInvoice>;
10
+ get(id: string): Promise<RecurringInvoice>;
11
+ update(id: string, params: RecurringInvoiceUpdateParams): Promise<RecurringInvoice>;
12
+ del(id: string): Promise<void>;
13
+ resume(id: string): Promise<RecurringInvoice>;
14
+ pause(id: string): Promise<RecurringInvoice>;
15
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecurringInvoices = void 0;
4
+ const pagination_js_1 = require("../pagination.js");
5
+ /** Scheduled invoice templates that automatically generate invoices on a recurring basis. */
6
+ class RecurringInvoices {
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async create(params, options) {
11
+ return this.client.post('/v1/recurring-invoices', params, options);
12
+ }
13
+ list(params) {
14
+ return new pagination_js_1.AutoPaginatingList(this.client, '/v1/recurring-invoices', params);
15
+ }
16
+ async get(id) {
17
+ return this.client.get(`/v1/recurring-invoices/${id}`);
18
+ }
19
+ async update(id, params) {
20
+ return this.client.patch(`/v1/recurring-invoices/${id}`, params);
21
+ }
22
+ async del(id) {
23
+ await this.client.del(`/v1/recurring-invoices/${id}`);
24
+ }
25
+ async resume(id) {
26
+ return this.client.post(`/v1/recurring-invoices/${id}/resume`);
27
+ }
28
+ async pause(id) {
29
+ return this.client.post(`/v1/recurring-invoices/${id}/pause`);
30
+ }
31
+ }
32
+ exports.RecurringInvoices = RecurringInvoices;
@@ -0,0 +1,45 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { LegalForm, NafCode, PaProvider, PaginatedResponse } from '../types.js';
3
+ /**
4
+ * Reference — static lookup tables maintained by INSEE that integrations
5
+ * need to power their own company / customer forms:
6
+ *
7
+ * - `legalForms` — French legal-form codes (SARL, SAS, EI…)
8
+ * - `nafCodes` — French NAF activity codes (Rev. 2, 2008)
9
+ *
10
+ * Both lists are stable and cacheable for the lifetime of the
11
+ * integration's process. The endpoint paginates so the SDK exposes
12
+ * `listLegalForms()` / `listNafCodes()` returning the full server
13
+ * response — callers typically fetch once on app start and keep the
14
+ * result in memory.
15
+ */
16
+ export declare class Reference {
17
+ private readonly client;
18
+ constructor(client: HttpClient);
19
+ /**
20
+ * List INSEE legal forms (4-digit codes + sigles + labels).
21
+ * Filter by `search` to autocomplete a form field.
22
+ */
23
+ listLegalForms(params?: {
24
+ search?: string;
25
+ limit?: number;
26
+ }): Promise<PaginatedResponse<LegalForm>>;
27
+ /**
28
+ * List NAF activity codes (Rev. 2). Filter by `search` to
29
+ * autocomplete on label fragments ("conseil", "transport"…).
30
+ */
31
+ listNafCodes(params?: {
32
+ search?: string;
33
+ limit?: number;
34
+ }): Promise<PaginatedResponse<NafCode>>;
35
+ /**
36
+ * List the supported Plateformes Agréées (PA). Public catalogue — no auth,
37
+ * no filter; fetch once and cache. Use it to render a provider picker and the
38
+ * credential fields each PA requires (Facturino is BYOPA — the customer
39
+ * brings their own PA credentials at connect time).
40
+ */
41
+ listPaProviders(): Promise<{
42
+ object: 'list';
43
+ data: PaProvider[];
44
+ }>;
45
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Reference = void 0;
4
+ /** Encode a flat object as a `?k=v&…` query string (skips undefined/null). */
5
+ function buildQuery(params) {
6
+ const entries = [];
7
+ for (const [k, v] of Object.entries(params)) {
8
+ if (v === undefined || v === null)
9
+ continue;
10
+ entries.push([k, String(v)]);
11
+ }
12
+ return entries.length === 0 ? '' : `?${new URLSearchParams(entries).toString()}`;
13
+ }
14
+ /**
15
+ * Reference — static lookup tables maintained by INSEE that integrations
16
+ * need to power their own company / customer forms:
17
+ *
18
+ * - `legalForms` — French legal-form codes (SARL, SAS, EI…)
19
+ * - `nafCodes` — French NAF activity codes (Rev. 2, 2008)
20
+ *
21
+ * Both lists are stable and cacheable for the lifetime of the
22
+ * integration's process. The endpoint paginates so the SDK exposes
23
+ * `listLegalForms()` / `listNafCodes()` returning the full server
24
+ * response — callers typically fetch once on app start and keep the
25
+ * result in memory.
26
+ */
27
+ class Reference {
28
+ constructor(client) {
29
+ this.client = client;
30
+ }
31
+ /**
32
+ * List INSEE legal forms (4-digit codes + sigles + labels).
33
+ * Filter by `search` to autocomplete a form field.
34
+ */
35
+ async listLegalForms(params) {
36
+ const qs = params ? buildQuery(params) : '';
37
+ return this.client.get(`/v1/reference/legal-forms${qs}`);
38
+ }
39
+ /**
40
+ * List NAF activity codes (Rev. 2). Filter by `search` to
41
+ * autocomplete on label fragments ("conseil", "transport"…).
42
+ */
43
+ async listNafCodes(params) {
44
+ const qs = params ? buildQuery(params) : '';
45
+ return this.client.get(`/v1/reference/naf-codes${qs}`);
46
+ }
47
+ /**
48
+ * List the supported Plateformes Agréées (PA). Public catalogue — no auth,
49
+ * no filter; fetch once and cache. Use it to render a provider picker and the
50
+ * credential fields each PA requires (Facturino is BYOPA — the customer
51
+ * brings their own PA credentials at connect time).
52
+ */
53
+ async listPaProviders() {
54
+ return this.client.get('/v1/pa-providers');
55
+ }
56
+ }
57
+ exports.Reference = Reference;
@@ -0,0 +1,11 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { VatReportParams, VatReport, RevenueReportParams, RevenueReport } from '../types.js';
3
+ /** Financial reporting — VAT and revenue reports (Essential, Pro, Cabinet plans). */
4
+ export declare class Reporting {
5
+ private readonly client;
6
+ constructor(client: HttpClient);
7
+ /** VAT report aggregated by rate for a given period. Amounts in integer centimes. */
8
+ vatReport(params: VatReportParams): Promise<VatReport>;
9
+ /** Revenue report with invoiced, credit notes, payments, and optional breakdown. Amounts in integer centimes. */
10
+ revenueReport(params: RevenueReportParams): Promise<RevenueReport>;
11
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Reporting = void 0;
4
+ /** Financial reporting — VAT and revenue reports (Essential, Pro, Cabinet plans). */
5
+ class Reporting {
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /** VAT report aggregated by rate for a given period. Amounts in integer centimes. */
10
+ async vatReport(params) {
11
+ const qs = new URLSearchParams({
12
+ period_start: params.period_start,
13
+ period_end: params.period_end,
14
+ }).toString();
15
+ return this.client.get(`/v1/reporting/vat?${qs}`);
16
+ }
17
+ /** Revenue report with invoiced, credit notes, payments, and optional breakdown. Amounts in integer centimes. */
18
+ async revenueReport(params) {
19
+ const queryParams = {
20
+ period_start: params.period_start,
21
+ period_end: params.period_end,
22
+ };
23
+ if (params.group_by) {
24
+ queryParams.group_by = params.group_by;
25
+ }
26
+ const qs = new URLSearchParams(queryParams).toString();
27
+ return this.client.get(`/v1/reporting/revenue?${qs}`);
28
+ }
29
+ }
30
+ exports.Reporting = Reporting;
@@ -0,0 +1,12 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { SandboxResetResponse, SimulateStatusParams, SimulateStatusResponse, RequestOptions } from '../types.js';
3
+ /** Test-mode utilities — reset data, simulate PA status transitions, and seed fixtures. */
4
+ export declare class Sandbox {
5
+ private readonly client;
6
+ constructor(client: HttpClient);
7
+ resetData(): Promise<SandboxResetResponse>;
8
+ /** Simulate PA status transition. Triggers webhooks. */
9
+ simulateStatus(invoiceId: string, params: SimulateStatusParams, options?: RequestOptions): Promise<SimulateStatusResponse>;
10
+ /** Alias for resetData(). */
11
+ createFixtures(): Promise<SandboxResetResponse>;
12
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sandbox = void 0;
4
+ /** Test-mode utilities — reset data, simulate PA status transitions, and seed fixtures. */
5
+ class Sandbox {
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ async resetData() {
10
+ return this.client.post('/v1/sandbox/reset');
11
+ }
12
+ /** Simulate PA status transition. Triggers webhooks. */
13
+ async simulateStatus(invoiceId, params, options) {
14
+ return this.client.post(`/v1/sandbox/simulate-status/${invoiceId}`, params, options);
15
+ }
16
+ /** Alias for resetData(). */
17
+ async createFixtures() {
18
+ return this.resetData();
19
+ }
20
+ }
21
+ exports.Sandbox = Sandbox;
@@ -0,0 +1,20 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { UsageSummary } from '../types.js';
3
+ /**
4
+ * Usage — current period consumption metrics for the authenticated
5
+ * account (invoices issued, storage used, PA submissions, API calls).
6
+ *
7
+ * Useful for in-app dashboards and proactive plan-upgrade nudges
8
+ * before a quota hit triggers a 402 from the API.
9
+ */
10
+ export declare class Usage {
11
+ private readonly client;
12
+ constructor(client: HttpClient);
13
+ /**
14
+ * Return the current usage snapshot. The response includes the plan
15
+ * limits and the consumption so far for each metered dimension; no
16
+ * historical data — the dashboard uses `GET /v1/reporting/revenue`
17
+ * for trend lines.
18
+ */
19
+ retrieve(): Promise<UsageSummary>;
20
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Usage = void 0;
4
+ /**
5
+ * Usage — current period consumption metrics for the authenticated
6
+ * account (invoices issued, storage used, PA submissions, API calls).
7
+ *
8
+ * Useful for in-app dashboards and proactive plan-upgrade nudges
9
+ * before a quota hit triggers a 402 from the API.
10
+ */
11
+ class Usage {
12
+ constructor(client) {
13
+ this.client = client;
14
+ }
15
+ /**
16
+ * Return the current usage snapshot. The response includes the plan
17
+ * limits and the consumption so far for each metered dimension; no
18
+ * historical data — the dashboard uses `GET /v1/reporting/revenue`
19
+ * for trend lines.
20
+ */
21
+ async retrieve() {
22
+ return this.client.get('/v1/usage');
23
+ }
24
+ }
25
+ exports.Usage = Usage;
@@ -0,0 +1,18 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { ValidateParams, ValidateResponse } from '../types.js';
3
+ /**
4
+ * Validate — dry-run conformity check of an invoice draft against the same
5
+ * EN16931 / CIUS-FR rules as `invoices.create`, without persisting anything.
6
+ *
7
+ * Call it before `invoices.create` to surface conformity warnings early. To
8
+ * check a customer's SIRET/VAT, use `customers.lookup` (SIRENE/VIES).
9
+ */
10
+ export declare class Validate {
11
+ private readonly client;
12
+ constructor(client: HttpClient);
13
+ /**
14
+ * Validate an invoice payload and return `{ valid, warnings }`. Accepts the
15
+ * same shape as `invoices.create`; nothing is created.
16
+ */
17
+ run(params: ValidateParams): Promise<ValidateResponse>;
18
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Validate = void 0;
4
+ /**
5
+ * Validate — dry-run conformity check of an invoice draft against the same
6
+ * EN16931 / CIUS-FR rules as `invoices.create`, without persisting anything.
7
+ *
8
+ * Call it before `invoices.create` to surface conformity warnings early. To
9
+ * check a customer's SIRET/VAT, use `customers.lookup` (SIRENE/VIES).
10
+ */
11
+ class Validate {
12
+ constructor(client) {
13
+ this.client = client;
14
+ }
15
+ /**
16
+ * Validate an invoice payload and return `{ valid, warnings }`. Accepts the
17
+ * same shape as `invoices.create`; nothing is created.
18
+ */
19
+ async run(params) {
20
+ return this.client.post('/v1/validate', params);
21
+ }
22
+ }
23
+ exports.Validate = Validate;
@@ -0,0 +1,20 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import { AutoPaginatingList } from '../pagination.js';
3
+ import type { WebhookEndpoint, WebhookEndpointCreateParams, WebhookEndpointUpdateParams, PaginationParams, RequestOptions } from '../types.js';
4
+ /** Manages webhook endpoint registrations and their event subscriptions. */
5
+ export declare class WebhookEndpoints {
6
+ private readonly client;
7
+ constructor(client: HttpClient);
8
+ /** Secret only returned on create. */
9
+ create(params: WebhookEndpointCreateParams, options?: RequestOptions): Promise<WebhookEndpoint>;
10
+ list(params?: PaginationParams): AutoPaginatingList<WebhookEndpoint>;
11
+ get(id: string): Promise<WebhookEndpoint>;
12
+ update(id: string, params: WebhookEndpointUpdateParams): Promise<WebhookEndpoint>;
13
+ del(id: string): Promise<void>;
14
+ /** Send a test event to verify the endpoint is reachable. */
15
+ test(id: string): Promise<{
16
+ id: string;
17
+ object: 'webhook_endpoint';
18
+ status: string;
19
+ }>;
20
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebhookEndpoints = void 0;
4
+ const pagination_js_1 = require("../pagination.js");
5
+ /** Manages webhook endpoint registrations and their event subscriptions. */
6
+ class WebhookEndpoints {
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ /** Secret only returned on create. */
11
+ async create(params, options) {
12
+ return this.client.post('/v1/webhook-endpoints', params, options);
13
+ }
14
+ list(params) {
15
+ return new pagination_js_1.AutoPaginatingList(this.client, '/v1/webhook-endpoints', params);
16
+ }
17
+ async get(id) {
18
+ return this.client.get(`/v1/webhook-endpoints/${id}`);
19
+ }
20
+ async update(id, params) {
21
+ return this.client.patch(`/v1/webhook-endpoints/${id}`, params);
22
+ }
23
+ async del(id) {
24
+ await this.client.del(`/v1/webhook-endpoints/${id}`);
25
+ }
26
+ /** Send a test event to verify the endpoint is reachable. */
27
+ async test(id) {
28
+ return this.client.post(`/v1/webhook-endpoints/${id}/test`);
29
+ }
30
+ }
31
+ exports.WebhookEndpoints = WebhookEndpoints;