@beliq/sdk 0.1.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.
@@ -0,0 +1,985 @@
1
+ import { P as PlainObject, a as DocumentInput } from './constants-bWOXCmJD.js';
2
+ export { D as DEFAULT_BASE_URL, L as LIVE_CONVERT_SOURCE_FORMATS, b as LIVE_CONVERT_TARGET_FORMATS, c as LIVE_GENERATE_STANDARDS, d as LIVE_PARSE_FORMATS, e as LIVE_PROFILES, f as LIVE_VALIDATE_FORMATS } from './constants-bWOXCmJD.js';
3
+
4
+ interface components {
5
+ schemas: {
6
+ InvoiceLine: {
7
+ description: string;
8
+ quantity: number;
9
+ unitCode: string;
10
+ unitPrice: number;
11
+ lineTotal: number;
12
+ vatRate: number;
13
+ vatCategoryCode: string;
14
+ itemId?: string;
15
+ buyerItemId?: string;
16
+ subLines?: components["schemas"]["InvoiceLine"][];
17
+ };
18
+ };
19
+ responses: never;
20
+ parameters: never;
21
+ requestBodies: never;
22
+ headers: never;
23
+ pathItems: never;
24
+ }
25
+ interface operations {
26
+ getAccount: {
27
+ parameters: {
28
+ query?: never;
29
+ header?: never;
30
+ path?: never;
31
+ cookie?: never;
32
+ };
33
+ requestBody?: never;
34
+ responses: {
35
+ /** @description Default Response */
36
+ 200: {
37
+ headers: {
38
+ [name: string]: unknown;
39
+ };
40
+ content: {
41
+ "application/json": {
42
+ success: boolean;
43
+ data?: {
44
+ keyId: string | null;
45
+ keyPrefix: string | null;
46
+ org: {
47
+ id: string;
48
+ name: string;
49
+ };
50
+ plan: {
51
+ id: number | null;
52
+ name: string | null;
53
+ };
54
+ rateLimitPerMinute: number;
55
+ quota: {
56
+ limit: number;
57
+ used: number;
58
+ remaining: number;
59
+ resetsAt: string;
60
+ };
61
+ };
62
+ error?: {
63
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
64
+ message: string;
65
+ details?: {
66
+ [key: string]: unknown;
67
+ };
68
+ };
69
+ };
70
+ };
71
+ };
72
+ /** @description Default Response */
73
+ 401: {
74
+ headers: {
75
+ [name: string]: unknown;
76
+ };
77
+ content: {
78
+ "application/json": {
79
+ /** @enum {boolean} */
80
+ success: false;
81
+ error: {
82
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
83
+ message: string;
84
+ details?: {
85
+ [key: string]: unknown;
86
+ };
87
+ };
88
+ };
89
+ };
90
+ };
91
+ /** @description Default Response */
92
+ 403: {
93
+ headers: {
94
+ [name: string]: unknown;
95
+ };
96
+ content: {
97
+ "application/json": {
98
+ /** @enum {boolean} */
99
+ success: false;
100
+ error: {
101
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
102
+ message: string;
103
+ details?: {
104
+ [key: string]: unknown;
105
+ };
106
+ };
107
+ };
108
+ };
109
+ };
110
+ };
111
+ };
112
+ generateInvoice: {
113
+ parameters: {
114
+ query?: never;
115
+ header?: never;
116
+ path?: never;
117
+ cookie?: never;
118
+ };
119
+ requestBody: {
120
+ content: {
121
+ "application/json": {
122
+ standard: "xrechnung" | "zugferd" | "facturx" | "peppol-bis" | "fatturapa" | "facturae" | "eslog";
123
+ profile?: "minimum" | "basicwl" | "basic" | "en16931" | "extended" | "extended-ctc-fr" | "xrechnung" | "peppol" | "romania-ro-cius" | "netherlands-nlcius" | "ordinaria" | "eracun";
124
+ facturxProfile?: "minimum" | "basicwl" | "basic" | "en16931" | "extended" | "extended-ctc-fr";
125
+ output: "xml" | "pdf";
126
+ invoice: {
127
+ number: string;
128
+ issueDate: string;
129
+ dueDate?: string;
130
+ currencyCode: string;
131
+ documentType?: "invoice" | "creditnote";
132
+ precedingInvoiceReference?: {
133
+ id: string;
134
+ issueDate?: string;
135
+ };
136
+ buyerReference?: string;
137
+ orderReference?: string;
138
+ note?: string;
139
+ seller: {
140
+ name: string;
141
+ vatId?: string;
142
+ taxId?: string;
143
+ registrationId?: string;
144
+ /** Format: email */
145
+ email?: string;
146
+ phone?: string;
147
+ address: {
148
+ street?: string;
149
+ additionalStreet?: string;
150
+ city: string;
151
+ postalCode: string;
152
+ countryCode: string;
153
+ state?: string;
154
+ region?: string;
155
+ province?: string;
156
+ };
157
+ contactName?: string;
158
+ peppol?: {
159
+ schemeId: string;
160
+ id: string;
161
+ };
162
+ };
163
+ buyer: {
164
+ name: string;
165
+ vatId?: string;
166
+ taxId?: string;
167
+ registrationId?: string;
168
+ /** Format: email */
169
+ email?: string;
170
+ phone?: string;
171
+ address: {
172
+ street?: string;
173
+ additionalStreet?: string;
174
+ city: string;
175
+ postalCode: string;
176
+ countryCode: string;
177
+ state?: string;
178
+ region?: string;
179
+ province?: string;
180
+ };
181
+ contactName?: string;
182
+ peppol?: {
183
+ schemeId: string;
184
+ id: string;
185
+ };
186
+ };
187
+ lines: {
188
+ description: string;
189
+ quantity: number;
190
+ unitCode: string;
191
+ unitPrice: number;
192
+ lineTotal: number;
193
+ vatRate: number;
194
+ vatCategoryCode: string;
195
+ itemId?: string;
196
+ buyerItemId?: string;
197
+ subLines?: components["schemas"]["InvoiceLine"][];
198
+ }[];
199
+ taxSummary?: {
200
+ vatCategoryCode: string;
201
+ vatRate: number;
202
+ taxableAmount: number;
203
+ taxAmount: number;
204
+ }[];
205
+ paymentMeans?: {
206
+ typeCode: string;
207
+ iban?: string;
208
+ bic?: string;
209
+ bankName?: string;
210
+ paymentReference?: string;
211
+ };
212
+ paymentTerms?: string;
213
+ totalNetAmount: number;
214
+ totalTaxAmount: number;
215
+ totalGrossAmount: number;
216
+ franceCtc?: boolean;
217
+ businessProcessId?: "S8" | "B8" | "M8";
218
+ italy?: {
219
+ codiceDestinatario?: string;
220
+ regimeFiscale?: string;
221
+ progressivoInvio?: string;
222
+ idTrasmittente?: {
223
+ country: string;
224
+ id: string;
225
+ };
226
+ tipoDocumento?: string;
227
+ condizioniPagamento?: string;
228
+ modalitaPagamento?: string;
229
+ esigibilitaIVA?: string;
230
+ causale?: string[];
231
+ };
232
+ romania?: Record<string, never>;
233
+ netherlands?: Record<string, never>;
234
+ spain?: {
235
+ modality?: "I" | "L";
236
+ invoiceIssuerType?: "EM" | "RE" | "TE";
237
+ invoiceDocumentType?: string;
238
+ invoiceClass?: string;
239
+ taxTypeCode?: string;
240
+ languageName?: string;
241
+ batchIdentifier?: string;
242
+ seller?: {
243
+ personTypeCode?: "J" | "F";
244
+ residenceTypeCode?: "R" | "U" | "E";
245
+ };
246
+ buyer?: {
247
+ personTypeCode?: "J" | "F";
248
+ residenceTypeCode?: "R" | "U" | "E";
249
+ };
250
+ };
251
+ slovenia?: Record<string, never>;
252
+ };
253
+ verify?: boolean;
254
+ /** @enum {string} */
255
+ template?: "standard";
256
+ pdfTemplateId?: string;
257
+ };
258
+ };
259
+ };
260
+ responses: {
261
+ /** @description Default Response */
262
+ 200: {
263
+ headers: {
264
+ [name: string]: unknown;
265
+ };
266
+ content: {
267
+ "application/json": {
268
+ success: boolean;
269
+ data?: {
270
+ invoiceId: string;
271
+ format: string;
272
+ standard: string;
273
+ profile: string;
274
+ validationResult: {
275
+ valid: boolean;
276
+ format: "cii" | "ubl" | "fatturapa" | "facturae" | "eslog" | "sdi_messaggio" | "unknown";
277
+ profileDetected?: string;
278
+ schematronVersion?: string;
279
+ ciusVersion?: string;
280
+ peppolVersion?: string;
281
+ facturxProfile?: string;
282
+ facturxVersion?: string;
283
+ franceCtcApplied?: boolean;
284
+ franceCtcVersion?: string;
285
+ italyFatturapaXsdBundle?: string;
286
+ italyFatturapaRuntimeVersion?: string;
287
+ italySdiMessaggiXsdBundle?: string;
288
+ italySdiMessaggiXsdVersion?: string;
289
+ spainFacturaeXsdBundle?: string;
290
+ spainFacturaeRuntimeVersion?: string;
291
+ sloveniaEslogXsdBundle?: string;
292
+ sloveniaEslogRuntimeVersion?: string;
293
+ romaniaRoCiusVersion?: string;
294
+ netherlandsNlciusVersion?: string;
295
+ errors: {
296
+ ruleId: string;
297
+ severity: "fatal" | "error" | "warning" | "info";
298
+ location?: string;
299
+ message: string;
300
+ }[];
301
+ warnings: {
302
+ ruleId: string;
303
+ severity: "fatal" | "error" | "warning" | "info";
304
+ location?: string;
305
+ message: string;
306
+ }[];
307
+ };
308
+ };
309
+ error?: {
310
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
311
+ message: string;
312
+ details?: {
313
+ [key: string]: unknown;
314
+ };
315
+ };
316
+ };
317
+ };
318
+ };
319
+ /** @description Default Response */
320
+ 400: {
321
+ headers: {
322
+ [name: string]: unknown;
323
+ };
324
+ content: {
325
+ "application/json": {
326
+ /** @enum {boolean} */
327
+ success: false;
328
+ error: {
329
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
330
+ message: string;
331
+ details?: {
332
+ [key: string]: unknown;
333
+ };
334
+ };
335
+ };
336
+ };
337
+ };
338
+ /** @description Default Response */
339
+ 404: {
340
+ headers: {
341
+ [name: string]: unknown;
342
+ };
343
+ content: {
344
+ "application/json": {
345
+ /** @enum {boolean} */
346
+ success: false;
347
+ error: {
348
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
349
+ message: string;
350
+ details?: {
351
+ [key: string]: unknown;
352
+ };
353
+ };
354
+ };
355
+ };
356
+ };
357
+ /** @description Default Response */
358
+ 422: {
359
+ headers: {
360
+ [name: string]: unknown;
361
+ };
362
+ content: {
363
+ "application/json": {
364
+ /** @enum {boolean} */
365
+ success: false;
366
+ error: {
367
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
368
+ message: string;
369
+ details?: {
370
+ [key: string]: unknown;
371
+ };
372
+ };
373
+ };
374
+ };
375
+ };
376
+ /** @description Default Response */
377
+ 503: {
378
+ headers: {
379
+ [name: string]: unknown;
380
+ };
381
+ content: {
382
+ "application/json": {
383
+ /** @enum {boolean} */
384
+ success: false;
385
+ error: {
386
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
387
+ message: string;
388
+ details?: {
389
+ [key: string]: unknown;
390
+ };
391
+ };
392
+ };
393
+ };
394
+ };
395
+ };
396
+ };
397
+ validateInvoice: {
398
+ parameters: {
399
+ query?: {
400
+ format?: "auto" | "cii" | "ubl" | "fatturapa" | "sdi_messaggio" | "facturae" | "eslog";
401
+ franceCtc?: boolean;
402
+ };
403
+ header?: never;
404
+ path?: never;
405
+ cookie?: never;
406
+ };
407
+ requestBody: {
408
+ content: {
409
+ "application/json": unknown;
410
+ };
411
+ };
412
+ responses: {
413
+ /** @description Default Response */
414
+ 200: {
415
+ headers: {
416
+ [name: string]: unknown;
417
+ };
418
+ content: {
419
+ "application/json": {
420
+ success: boolean;
421
+ data?: {
422
+ valid: boolean;
423
+ format: "cii" | "ubl" | "fatturapa" | "facturae" | "eslog" | "sdi_messaggio" | "unknown";
424
+ profileDetected?: string;
425
+ schematronVersion?: string;
426
+ ciusVersion?: string;
427
+ peppolVersion?: string;
428
+ facturxProfile?: string;
429
+ facturxVersion?: string;
430
+ franceCtcApplied?: boolean;
431
+ franceCtcVersion?: string;
432
+ italyFatturapaXsdBundle?: string;
433
+ italyFatturapaRuntimeVersion?: string;
434
+ italySdiMessaggiXsdBundle?: string;
435
+ italySdiMessaggiXsdVersion?: string;
436
+ spainFacturaeXsdBundle?: string;
437
+ spainFacturaeRuntimeVersion?: string;
438
+ sloveniaEslogXsdBundle?: string;
439
+ sloveniaEslogRuntimeVersion?: string;
440
+ romaniaRoCiusVersion?: string;
441
+ netherlandsNlciusVersion?: string;
442
+ errors: {
443
+ ruleId: string;
444
+ severity: "fatal" | "error" | "warning" | "info";
445
+ location?: string;
446
+ message: string;
447
+ }[];
448
+ warnings: {
449
+ ruleId: string;
450
+ severity: "fatal" | "error" | "warning" | "info";
451
+ location?: string;
452
+ message: string;
453
+ }[];
454
+ };
455
+ error?: {
456
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
457
+ message: string;
458
+ details?: {
459
+ [key: string]: unknown;
460
+ };
461
+ };
462
+ };
463
+ };
464
+ };
465
+ /** @description Default Response */
466
+ 400: {
467
+ headers: {
468
+ [name: string]: unknown;
469
+ };
470
+ content: {
471
+ "application/json": {
472
+ /** @enum {boolean} */
473
+ success: false;
474
+ error: {
475
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
476
+ message: string;
477
+ details?: {
478
+ [key: string]: unknown;
479
+ };
480
+ };
481
+ };
482
+ };
483
+ };
484
+ /** @description Default Response */
485
+ 422: {
486
+ headers: {
487
+ [name: string]: unknown;
488
+ };
489
+ content: {
490
+ "application/json": {
491
+ /** @enum {boolean} */
492
+ success: false;
493
+ error: {
494
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
495
+ message: string;
496
+ details?: {
497
+ [key: string]: unknown;
498
+ };
499
+ };
500
+ };
501
+ };
502
+ };
503
+ /** @description Default Response */
504
+ 503: {
505
+ headers: {
506
+ [name: string]: unknown;
507
+ };
508
+ content: {
509
+ "application/json": {
510
+ /** @enum {boolean} */
511
+ success: false;
512
+ error: {
513
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
514
+ message: string;
515
+ details?: {
516
+ [key: string]: unknown;
517
+ };
518
+ };
519
+ };
520
+ };
521
+ };
522
+ };
523
+ };
524
+ parseInvoice: {
525
+ parameters: {
526
+ query?: {
527
+ format?: "auto" | "cii" | "ubl" | "fatturapa" | "sdi_messaggio" | "facturae" | "eslog";
528
+ };
529
+ header?: never;
530
+ path?: never;
531
+ cookie?: never;
532
+ };
533
+ requestBody: {
534
+ content: {
535
+ "application/json": unknown;
536
+ };
537
+ };
538
+ responses: {
539
+ /** @description Default Response */
540
+ 200: {
541
+ headers: {
542
+ [name: string]: unknown;
543
+ };
544
+ content: {
545
+ "application/json": {
546
+ success: boolean;
547
+ data?: {
548
+ format: "cii" | "ubl";
549
+ profileDetected?: string;
550
+ invoice: {
551
+ number: string;
552
+ issueDate: string;
553
+ dueDate?: string;
554
+ currencyCode: string;
555
+ documentType?: "invoice" | "creditnote";
556
+ precedingInvoiceReference?: {
557
+ id: string;
558
+ issueDate?: string;
559
+ };
560
+ buyerReference?: string;
561
+ orderReference?: string;
562
+ note?: string;
563
+ seller: {
564
+ name: string;
565
+ vatId?: string;
566
+ taxId?: string;
567
+ registrationId?: string;
568
+ /** Format: email */
569
+ email?: string;
570
+ phone?: string;
571
+ address: {
572
+ street?: string;
573
+ additionalStreet?: string;
574
+ city: string;
575
+ postalCode: string;
576
+ countryCode: string;
577
+ state?: string;
578
+ region?: string;
579
+ province?: string;
580
+ };
581
+ contactName?: string;
582
+ peppol?: {
583
+ schemeId: string;
584
+ id: string;
585
+ };
586
+ };
587
+ buyer: {
588
+ name: string;
589
+ vatId?: string;
590
+ taxId?: string;
591
+ registrationId?: string;
592
+ /** Format: email */
593
+ email?: string;
594
+ phone?: string;
595
+ address: {
596
+ street?: string;
597
+ additionalStreet?: string;
598
+ city: string;
599
+ postalCode: string;
600
+ countryCode: string;
601
+ state?: string;
602
+ region?: string;
603
+ province?: string;
604
+ };
605
+ contactName?: string;
606
+ peppol?: {
607
+ schemeId: string;
608
+ id: string;
609
+ };
610
+ };
611
+ lines: {
612
+ description: string;
613
+ quantity: number;
614
+ unitCode: string;
615
+ unitPrice: number;
616
+ lineTotal: number;
617
+ vatRate: number;
618
+ vatCategoryCode: string;
619
+ itemId?: string;
620
+ buyerItemId?: string;
621
+ subLines?: components["schemas"]["InvoiceLine"][];
622
+ }[];
623
+ taxSummary?: {
624
+ vatCategoryCode: string;
625
+ vatRate: number;
626
+ taxableAmount: number;
627
+ taxAmount: number;
628
+ }[];
629
+ paymentMeans?: {
630
+ typeCode: string;
631
+ iban?: string;
632
+ bic?: string;
633
+ bankName?: string;
634
+ paymentReference?: string;
635
+ };
636
+ paymentTerms?: string;
637
+ totalNetAmount: number;
638
+ totalTaxAmount: number;
639
+ totalGrossAmount: number;
640
+ franceCtc?: boolean;
641
+ businessProcessId?: "S8" | "B8" | "M8";
642
+ italy?: {
643
+ codiceDestinatario?: string;
644
+ regimeFiscale?: string;
645
+ progressivoInvio?: string;
646
+ idTrasmittente?: {
647
+ country: string;
648
+ id: string;
649
+ };
650
+ tipoDocumento?: string;
651
+ condizioniPagamento?: string;
652
+ modalitaPagamento?: string;
653
+ esigibilitaIVA?: string;
654
+ causale?: string[];
655
+ };
656
+ romania?: Record<string, never>;
657
+ netherlands?: Record<string, never>;
658
+ spain?: {
659
+ modality?: "I" | "L";
660
+ invoiceIssuerType?: "EM" | "RE" | "TE";
661
+ invoiceDocumentType?: string;
662
+ invoiceClass?: string;
663
+ taxTypeCode?: string;
664
+ languageName?: string;
665
+ batchIdentifier?: string;
666
+ seller?: {
667
+ personTypeCode?: "J" | "F";
668
+ residenceTypeCode?: "R" | "U" | "E";
669
+ };
670
+ buyer?: {
671
+ personTypeCode?: "J" | "F";
672
+ residenceTypeCode?: "R" | "U" | "E";
673
+ };
674
+ };
675
+ slovenia?: Record<string, never>;
676
+ };
677
+ };
678
+ error?: {
679
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
680
+ message: string;
681
+ details?: {
682
+ [key: string]: unknown;
683
+ };
684
+ };
685
+ };
686
+ };
687
+ };
688
+ /** @description Default Response */
689
+ 400: {
690
+ headers: {
691
+ [name: string]: unknown;
692
+ };
693
+ content: {
694
+ "application/json": {
695
+ /** @enum {boolean} */
696
+ success: false;
697
+ error: {
698
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
699
+ message: string;
700
+ details?: {
701
+ [key: string]: unknown;
702
+ };
703
+ };
704
+ };
705
+ };
706
+ };
707
+ /** @description Default Response */
708
+ 503: {
709
+ headers: {
710
+ [name: string]: unknown;
711
+ };
712
+ content: {
713
+ "application/json": {
714
+ /** @enum {boolean} */
715
+ success: false;
716
+ error: {
717
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
718
+ message: string;
719
+ details?: {
720
+ [key: string]: unknown;
721
+ };
722
+ };
723
+ };
724
+ };
725
+ };
726
+ };
727
+ };
728
+ convertInvoice: {
729
+ parameters: {
730
+ query: {
731
+ sourceFormat?: "auto" | "cii" | "ubl" | "zugferd" | "facturx" | "xrechnung" | "peppol-bis";
732
+ targetFormat: "cii" | "ubl" | "zugferd" | "facturx" | "xrechnung" | "peppol-bis";
733
+ targetProfile?: "minimum" | "basicwl" | "basic" | "en16931" | "extended" | "extended-ctc-fr";
734
+ dropFranceCtcOverlay?: boolean;
735
+ };
736
+ header?: never;
737
+ path?: never;
738
+ cookie?: never;
739
+ };
740
+ requestBody: {
741
+ content: {
742
+ "application/json": unknown;
743
+ };
744
+ };
745
+ responses: {
746
+ /** @description Default Response */
747
+ 400: {
748
+ headers: {
749
+ [name: string]: unknown;
750
+ };
751
+ content: {
752
+ "application/json": {
753
+ /** @enum {boolean} */
754
+ success: false;
755
+ error: {
756
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
757
+ message: string;
758
+ details?: {
759
+ [key: string]: unknown;
760
+ };
761
+ };
762
+ };
763
+ };
764
+ };
765
+ /** @description Default Response */
766
+ 422: {
767
+ headers: {
768
+ [name: string]: unknown;
769
+ };
770
+ content: {
771
+ "application/json": {
772
+ /** @enum {boolean} */
773
+ success: false;
774
+ error: {
775
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
776
+ message: string;
777
+ details?: {
778
+ [key: string]: unknown;
779
+ };
780
+ };
781
+ };
782
+ };
783
+ };
784
+ /** @description Default Response */
785
+ 500: {
786
+ headers: {
787
+ [name: string]: unknown;
788
+ };
789
+ content: {
790
+ "application/json": {
791
+ /** @enum {boolean} */
792
+ success: false;
793
+ error: {
794
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
795
+ message: string;
796
+ details?: {
797
+ [key: string]: unknown;
798
+ };
799
+ };
800
+ };
801
+ };
802
+ };
803
+ /** @description Default Response */
804
+ 503: {
805
+ headers: {
806
+ [name: string]: unknown;
807
+ };
808
+ content: {
809
+ "application/json": {
810
+ /** @enum {boolean} */
811
+ success: false;
812
+ error: {
813
+ code: "VALIDATION_ERROR" | "INVALID_INVOICE" | "UNSUPPORTED_FORMAT" | "PROFILE_STANDARD_MISMATCH" | "DOCUMENT_TYPE_STANDARD_MISMATCH" | "PARSE_FAILED" | "INVALID_XML" | "AUTHENTICATION_REQUIRED" | "INVALID_API_KEY" | "QUOTA_EXCEEDED" | "RATE_LIMITED" | "ENGINE_UNAVAILABLE" | "INTERNAL_ERROR" | "NOT_FOUND" | "CONVERSION_UNSUPPORTED_PAIR" | "CONVERSION_LOSSY_FAILCLOSED" | "CONVERSION_TOOL_UNAVAILABLE" | "CONVERSION_TOOL_ERROR" | "PDF_TEMPLATE_AUTH_REQUIRED" | "PDF_TEMPLATE_NOT_FOUND" | "PDF_TEMPLATE_INVALID";
814
+ message: string;
815
+ details?: {
816
+ [key: string]: unknown;
817
+ };
818
+ };
819
+ };
820
+ };
821
+ };
822
+ };
823
+ };
824
+ }
825
+
826
+ type Json200Data<Op extends keyof operations> = operations[Op] extends {
827
+ responses: {
828
+ 200: {
829
+ content: {
830
+ 'application/json': {
831
+ data?: infer D;
832
+ };
833
+ };
834
+ };
835
+ };
836
+ } ? NonNullable<D> : never;
837
+ type Error400<Op extends keyof operations> = operations[Op] extends {
838
+ responses: {
839
+ 400: {
840
+ content: {
841
+ 'application/json': {
842
+ error: infer E;
843
+ };
844
+ };
845
+ };
846
+ };
847
+ } ? E : never;
848
+ type RequestJson<Op extends keyof operations> = operations[Op] extends {
849
+ requestBody?: {
850
+ content: {
851
+ 'application/json': infer B;
852
+ };
853
+ };
854
+ } ? B : never;
855
+ type Query<Op extends keyof operations> = NonNullable<operations[Op]['parameters']['query']>;
856
+ /** Account, plan, and quota context for the calling key (GET /v1/me). */
857
+ type AccountInfo = Json200Data<'getAccount'>;
858
+ /** Validation verdict plus the authority versions it was checked against. */
859
+ type ValidationResult = Json200Data<'validateInvoice'>;
860
+ type ValidationIssue = ValidationResult['errors'][number];
861
+ type Severity = ValidationIssue['severity'];
862
+ type ValidationFormat = ValidationResult['format'];
863
+ /** Structured invoice extracted from a document (POST /v1/parse). */
864
+ type ParseResult = Json200Data<'parseInvoice'>;
865
+ /** The EN 16931 invoice generate accepts, and every option it carries. */
866
+ type GenerateBody = RequestJson<'generateInvoice'>;
867
+ type Invoice = GenerateBody['invoice'];
868
+ type Standard = GenerateBody['standard'];
869
+ type GenerateProfile = NonNullable<GenerateBody['profile']>;
870
+ type FacturxProfile = NonNullable<GenerateBody['facturxProfile']>;
871
+ /** The uniform error envelope and its closed code set. */
872
+ type ApiError = Error400<'validateInvoice'>;
873
+ type ApiErrorCode = ApiError['code'];
874
+ /** Query enums, faithful to what each endpoint accepts. */
875
+ type ValidateFormat = NonNullable<Query<'validateInvoice'>['format']>;
876
+ type ParseFormat = NonNullable<Query<'parseInvoice'>['format']>;
877
+ type ConvertSourceFormat = NonNullable<Query<'convertInvoice'>['sourceFormat']>;
878
+ type ConvertTargetFormat = Query<'convertInvoice'>['targetFormat'];
879
+
880
+ interface BeliqOptions {
881
+ /** API key from the beliq dashboard (API Keys). */
882
+ apiKey: string;
883
+ /** Override only for a self-hosted or staging deployment. */
884
+ baseUrl?: string;
885
+ /** How to send the key: 'header' => X-API-Key (default), 'bearer' => Authorization. */
886
+ auth?: 'header' | 'bearer';
887
+ /** Inject a fetch implementation (tests, custom agents). Defaults to global fetch. */
888
+ fetch?: typeof fetch;
889
+ }
890
+ interface GenerateInput {
891
+ standard: Standard;
892
+ invoice: Invoice;
893
+ /** 'xml' (default) or 'pdf' (Factur-X / ZUGFeRD hybrid). */
894
+ output?: 'xml' | 'pdf';
895
+ profile?: GenerateProfile;
896
+ /** Applies only when standard is facturx or zugferd. */
897
+ facturxProfile?: FacturxProfile;
898
+ /** Validate the generated document before returning (fail-closed). */
899
+ verify?: boolean;
900
+ template?: 'standard';
901
+ /** Render the PDF from a saved dashboard template. */
902
+ pdfTemplateId?: string;
903
+ /** Raw JSON deep-merged into the request body. */
904
+ advanced?: PlainObject;
905
+ }
906
+ interface DocumentOptions {
907
+ /** Override the sniffed request content type (application/xml | application/pdf). */
908
+ contentType?: string;
909
+ /** Raw JSON deep-merged into the query. */
910
+ advanced?: PlainObject;
911
+ }
912
+ interface ValidateOptions extends DocumentOptions {
913
+ format?: ValidateFormat;
914
+ franceCtc?: boolean;
915
+ }
916
+ interface ParseOptions extends DocumentOptions {
917
+ format?: ParseFormat;
918
+ }
919
+ interface ConvertOptions extends DocumentOptions {
920
+ targetFormat: ConvertTargetFormat;
921
+ sourceFormat?: ConvertSourceFormat;
922
+ /** Applies only when targetFormat is facturx or zugferd. */
923
+ targetProfile?: FacturxProfile;
924
+ dropFranceCtcOverlay?: boolean;
925
+ }
926
+ /** Header metadata returned alongside a generated document. */
927
+ interface GenerateMeta {
928
+ schematronVersion?: string;
929
+ pdfKind?: string;
930
+ outputEnvelope?: string;
931
+ }
932
+ interface GenerateResult {
933
+ contentType: string;
934
+ bytes: Uint8Array;
935
+ /** UTF-8 decoded body, present only for an XML output. */
936
+ xml?: string;
937
+ meta: GenerateMeta;
938
+ }
939
+ /** Header metadata returned alongside a converted document. */
940
+ interface ConvertMeta {
941
+ sourceFormat?: string;
942
+ targetFormat?: string;
943
+ profileDetected?: string;
944
+ lostElementsCount?: number;
945
+ lostElements?: string[];
946
+ conversionTools?: string;
947
+ }
948
+ interface ConvertResult {
949
+ contentType: string;
950
+ bytes: Uint8Array;
951
+ meta: ConvertMeta;
952
+ }
953
+ /** Typed client for the beliq e-invoicing compliance API. */
954
+ declare class Beliq {
955
+ #private;
956
+ constructor(options: BeliqOptions);
957
+ /** Account, plan, and quota context for the key. Does not consume quota. */
958
+ me(): Promise<AccountInfo>;
959
+ /** Generate a compliant e-invoice from an EN 16931 object. */
960
+ generate(input: GenerateInput): Promise<GenerateResult>;
961
+ /** Validate a document against authority-pinned rules. */
962
+ validate(document: DocumentInput, options?: ValidateOptions): Promise<ValidationResult>;
963
+ /** Parse a document into a structured EN 16931 invoice. */
964
+ parse(document: DocumentInput, options?: ParseOptions): Promise<ParseResult>;
965
+ /** Convert a document between EN 16931 formats. */
966
+ convert(document: DocumentInput, options: ConvertOptions): Promise<ConvertResult>;
967
+ }
968
+
969
+ /**
970
+ * Thrown for any non-2xx beliq response (and for a 2xx body carrying
971
+ * `{ success: false }`). Carries the typed error `code`, HTTP `status`, and any
972
+ * structured `details` from beliq's `{ success: false, error: {...} }` envelope.
973
+ */
974
+ declare class BeliqApiError extends Error {
975
+ readonly code?: ApiErrorCode | string;
976
+ readonly status: number;
977
+ readonly details?: Record<string, unknown>;
978
+ constructor(message: string, opts: {
979
+ code?: ApiErrorCode | string;
980
+ status: number;
981
+ details?: Record<string, unknown>;
982
+ });
983
+ }
984
+
985
+ export { type AccountInfo, type ApiError, type ApiErrorCode, Beliq, BeliqApiError, type BeliqOptions, type ConvertMeta, type ConvertOptions, type ConvertResult, type ConvertSourceFormat, type ConvertTargetFormat, DocumentInput, type DocumentOptions, type FacturxProfile, type GenerateBody, type GenerateInput, type GenerateMeta, type GenerateProfile, type GenerateResult, type Invoice, type ParseFormat, type ParseOptions, type ParseResult, type Severity, type Standard, type ValidateFormat, type ValidateOptions, type ValidationFormat, type ValidationIssue, type ValidationResult };