@formfeed/engine 0.3.10 → 0.3.12
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.
- package/index.cjs +4728 -438
- package/index.js +4728 -438
- package/package.json +3 -2
- package/types/frame/fit.d.cts +13 -0
- package/types/frame/fit.d.ts +13 -0
- package/types/frame/fit.entry.d.cts +1 -0
- package/types/frame/fit.entry.d.ts +1 -0
- package/types/frame/stage.d.cts +22 -0
- package/types/frame/stage.d.ts +22 -0
- package/types/frame/stage.entry.d.cts +1 -0
- package/types/frame/stage.entry.d.ts +1 -0
- package/types/frame/text-edit.d.cts +82 -0
- package/types/frame/text-edit.d.ts +82 -0
- package/types/frame/text-edit.entry.d.cts +1 -0
- package/types/frame/text-edit.entry.d.ts +1 -0
- package/types/index.d.cts +23 -14
- package/types/index.d.ts +23 -14
- package/types/lib/assemble.d.cts +13 -0
- package/types/lib/assemble.d.ts +13 -0
- package/types/lib/design/emit.d.cts +20 -0
- package/types/lib/design/emit.d.ts +20 -0
- package/types/lib/design/fonts.d.cts +27 -0
- package/types/lib/design/fonts.d.ts +27 -0
- package/types/lib/design/hash.d.cts +6 -0
- package/types/lib/design/hash.d.ts +6 -0
- package/types/lib/design/index.d.cts +12 -0
- package/types/lib/design/index.d.ts +12 -0
- package/types/lib/design/layers.d.cts +12 -0
- package/types/lib/design/layers.d.ts +12 -0
- package/types/lib/design/parse.d.cts +25 -0
- package/types/lib/design/parse.d.ts +25 -0
- package/types/lib/design/starters.d.cts +14 -0
- package/types/lib/design/starters.d.ts +14 -0
- package/types/lib/design/types.d.cts +171 -0
- package/types/lib/design/types.d.ts +171 -0
- package/types/lib/dialect.d.cts +32 -0
- package/types/lib/dialect.d.ts +32 -0
- package/types/lib/einvoice/check.d.cts +181 -0
- package/types/lib/einvoice/check.d.ts +181 -0
- package/types/lib/einvoice/cii.d.cts +18 -0
- package/types/lib/einvoice/cii.d.ts +18 -0
- package/types/lib/einvoice/codes.generated.d.cts +14 -0
- package/types/lib/einvoice/codes.generated.d.ts +14 -0
- package/types/lib/einvoice/decimal.d.cts +29 -0
- package/types/lib/einvoice/decimal.d.ts +29 -0
- package/types/lib/einvoice/display.d.cts +43 -0
- package/types/lib/einvoice/display.d.ts +43 -0
- package/types/lib/einvoice/html-text.d.cts +17 -0
- package/types/lib/einvoice/html-text.d.ts +17 -0
- package/types/lib/einvoice/index.d.cts +45 -0
- package/types/lib/einvoice/index.d.ts +45 -0
- package/types/lib/einvoice/locate.d.cts +21 -0
- package/types/lib/einvoice/locate.d.ts +21 -0
- package/types/lib/einvoice/report.d.cts +59 -0
- package/types/lib/einvoice/report.d.ts +59 -0
- package/types/lib/einvoice/schema.d.cts +293 -0
- package/types/lib/einvoice/schema.d.ts +293 -0
- package/types/lib/einvoice/skeleton.d.cts +10 -0
- package/types/lib/einvoice/skeleton.d.ts +10 -0
- package/types/lib/generated/frames.d.cts +6 -0
- package/types/lib/generated/frames.d.ts +6 -0
- package/types/lib/preview.d.cts +22 -2
- package/types/lib/preview.d.ts +22 -2
- package/types/lib/source-edit.d.cts +117 -0
- package/types/lib/source-edit.d.ts +117 -0
- package/types/lib/source-positions.d.cts +12 -3
- package/types/lib/source-positions.d.ts +12 -3
- package/types/lib/source-scan.d.cts +61 -0
- package/types/lib/source-scan.d.ts +61 -0
- package/types/lib/translation.d.cts +17 -0
- package/types/lib/translation.d.ts +17 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { DisplayCheck } from './display.js';
|
|
2
|
+
import type { EinvoiceFlavour, EinvoiceOptions, EinvoiceProfile } from './schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a render says about its e-invoice (spec 17 §4.1, §5): the validator's report and the display
|
|
5
|
+
* check. One shape for the render-worker that builds it, the database row that keeps it, the API
|
|
6
|
+
* that returns it, the render log and the CLI that show it.
|
|
7
|
+
*/
|
|
8
|
+
/** One finding of the validator: a rule of the XML (schematron, XSD) or of PDF/A (veraPDF). */
|
|
9
|
+
export interface EinvoiceMessage {
|
|
10
|
+
part: 'xml' | 'pdf';
|
|
11
|
+
severity: 'error' | 'warning';
|
|
12
|
+
/** `BR-CO-15`, `CII-SR-465`, or a clause of PDF/A such as `6.2.11.4.1-1`. */
|
|
13
|
+
rule: string | null;
|
|
14
|
+
message: string;
|
|
15
|
+
/** Where: an XPath into the XML, or the object of the PDF. */
|
|
16
|
+
location: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface EinvoiceValidation {
|
|
19
|
+
valid: boolean;
|
|
20
|
+
/** The rule set the XML was held to, as the validator names it. */
|
|
21
|
+
schematron: string;
|
|
22
|
+
/** `PDF/A-3b` once the file was checked; `null` when validation ended at the XML. */
|
|
23
|
+
pdfa: string | null;
|
|
24
|
+
messages: EinvoiceMessage[];
|
|
25
|
+
/** More findings than the render keeps. */
|
|
26
|
+
truncated?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface EinvoiceDisplay {
|
|
29
|
+
/** The business terms looked for in the text of the PDF (`BT-1`, `BT-112`). */
|
|
30
|
+
checked: string[];
|
|
31
|
+
/** Those the text does not show. */
|
|
32
|
+
missing: string[];
|
|
33
|
+
}
|
|
34
|
+
/** `einvoice` of a render as the row keeps it; the API adds `xml_url`. */
|
|
35
|
+
export interface EinvoiceResult {
|
|
36
|
+
profile: EinvoiceProfile;
|
|
37
|
+
flavour: EinvoiceFlavour;
|
|
38
|
+
/** The release of the specification under the flavour's name: `1.09` or `2.5`. */
|
|
39
|
+
spec_version: string;
|
|
40
|
+
validation: EinvoiceValidation | null;
|
|
41
|
+
display: EinvoiceDisplay | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A render row travels in every list and webhook, so it keeps this many findings and says when there
|
|
45
|
+
* were more. Errors go first: a report cut short must not lose the reason it failed to warnings.
|
|
46
|
+
*/
|
|
47
|
+
export declare const EINVOICE_MAX_MESSAGES = 50;
|
|
48
|
+
export declare function capMessages(messages: readonly EinvoiceMessage[], max?: number): Pick<EinvoiceValidation, 'messages' | 'truncated'>;
|
|
49
|
+
/** The result of a render that got as far as `validation` and `display` say. */
|
|
50
|
+
export declare function einvoiceResult(options: Pick<EinvoiceOptions, 'profile' | 'flavour'>, specVersion: string, validation: EinvoiceValidation | null, display: DisplayCheck | null): EinvoiceResult;
|
|
51
|
+
/** The names a person reads: `Factur-X` and `EN 16931` for `factur-x` and `en16931`. */
|
|
52
|
+
export declare const EINVOICE_FLAVOUR_NAMES: Record<EinvoiceFlavour, string>;
|
|
53
|
+
export declare const EINVOICE_PROFILE_NAMES: Record<EinvoiceProfile, string>;
|
|
54
|
+
/**
|
|
55
|
+
* Where in the invoice a finding of the XML sits, for a reader who knows `_invoice` and not CII:
|
|
56
|
+
* `line 2` for anything inside the second line item, `null` where the path names no line. The XPath
|
|
57
|
+
* itself stays beside it; this only spares the reader counting brackets.
|
|
58
|
+
*/
|
|
59
|
+
export declare function invoiceLineOf(location: string | null): number | null;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** VAT categories of UNCL 5305 as EN 16931 uses them (spec 17 §4.3). */
|
|
3
|
+
export declare const VAT_CATEGORIES: readonly ["S", "Z", "E", "AE", "K", "G", "O"];
|
|
4
|
+
export type VatCategory = (typeof VAT_CATEGORIES)[number];
|
|
5
|
+
export declare const invoiceSchema: z.ZodObject<{
|
|
6
|
+
number: z.ZodString;
|
|
7
|
+
issue_date: z.ZodString;
|
|
8
|
+
type_code: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
9
|
+
currency: z.ZodString;
|
|
10
|
+
accounting_currency: z.ZodOptional<z.ZodString>;
|
|
11
|
+
buyer_reference: z.ZodOptional<z.ZodString>;
|
|
12
|
+
order_reference: z.ZodOptional<z.ZodString>;
|
|
13
|
+
contract_reference: z.ZodOptional<z.ZodString>;
|
|
14
|
+
note: z.ZodOptional<z.ZodString>;
|
|
15
|
+
notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
16
|
+
text: z.ZodString;
|
|
17
|
+
subject_code: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
period: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
start: z.ZodOptional<z.ZodString>;
|
|
21
|
+
end: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
preceding_invoices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
number: z.ZodString;
|
|
25
|
+
issue_date: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>>>;
|
|
27
|
+
operation: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
goods: "goods";
|
|
29
|
+
services: "services";
|
|
30
|
+
mixed: "mixed";
|
|
31
|
+
}>>;
|
|
32
|
+
operation_code: z.ZodOptional<z.ZodString>;
|
|
33
|
+
seller: z.ZodObject<{
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
trading_name: z.ZodOptional<z.ZodString>;
|
|
36
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
37
|
+
value: z.ZodString;
|
|
38
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>]>>;
|
|
40
|
+
legal_registration: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
41
|
+
value: z.ZodString;
|
|
42
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>]>>;
|
|
44
|
+
vat_id: z.ZodOptional<z.ZodString>;
|
|
45
|
+
address: z.ZodObject<{
|
|
46
|
+
street: z.ZodOptional<z.ZodString>;
|
|
47
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
48
|
+
street3: z.ZodOptional<z.ZodString>;
|
|
49
|
+
postcode: z.ZodOptional<z.ZodString>;
|
|
50
|
+
city: z.ZodOptional<z.ZodString>;
|
|
51
|
+
country: z.ZodString;
|
|
52
|
+
subdivision: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
name: z.ZodOptional<z.ZodString>;
|
|
56
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
57
|
+
email: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
electronic_address: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
60
|
+
value: z.ZodString;
|
|
61
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>]>>;
|
|
63
|
+
tax_number: z.ZodOptional<z.ZodString>;
|
|
64
|
+
legal_info: z.ZodOptional<z.ZodString>;
|
|
65
|
+
vat_on_debits: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
buyer: z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
trading_name: z.ZodOptional<z.ZodString>;
|
|
70
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
71
|
+
value: z.ZodString;
|
|
72
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>]>>;
|
|
74
|
+
legal_registration: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
75
|
+
value: z.ZodString;
|
|
76
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>]>>;
|
|
78
|
+
vat_id: z.ZodOptional<z.ZodString>;
|
|
79
|
+
address: z.ZodObject<{
|
|
80
|
+
street: z.ZodOptional<z.ZodString>;
|
|
81
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
82
|
+
street3: z.ZodOptional<z.ZodString>;
|
|
83
|
+
postcode: z.ZodOptional<z.ZodString>;
|
|
84
|
+
city: z.ZodOptional<z.ZodString>;
|
|
85
|
+
country: z.ZodString;
|
|
86
|
+
subdivision: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
name: z.ZodOptional<z.ZodString>;
|
|
90
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
91
|
+
email: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
electronic_address: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
94
|
+
value: z.ZodString;
|
|
95
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>]>>;
|
|
97
|
+
siren: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
delivery: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
name: z.ZodOptional<z.ZodString>;
|
|
101
|
+
date: z.ZodOptional<z.ZodString>;
|
|
102
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
street: z.ZodOptional<z.ZodString>;
|
|
104
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
105
|
+
street3: z.ZodOptional<z.ZodString>;
|
|
106
|
+
postcode: z.ZodOptional<z.ZodString>;
|
|
107
|
+
city: z.ZodOptional<z.ZodString>;
|
|
108
|
+
country: z.ZodString;
|
|
109
|
+
subdivision: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
113
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
description: z.ZodOptional<z.ZodString>;
|
|
116
|
+
quantity: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
117
|
+
unit_code: z.ZodDefault<z.ZodString>;
|
|
118
|
+
net_price: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
119
|
+
price_base_quantity: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
120
|
+
net_amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
121
|
+
tax: z.ZodObject<{
|
|
122
|
+
category: z.ZodEnum<{
|
|
123
|
+
Z: "Z";
|
|
124
|
+
E: "E";
|
|
125
|
+
G: "G";
|
|
126
|
+
S: "S";
|
|
127
|
+
AE: "AE";
|
|
128
|
+
K: "K";
|
|
129
|
+
O: "O";
|
|
130
|
+
}>;
|
|
131
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
period: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
start: z.ZodOptional<z.ZodString>;
|
|
135
|
+
end: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
allowances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
138
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
139
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
140
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
141
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
142
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
143
|
+
}, z.core.$strip>>>;
|
|
144
|
+
charges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
145
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
146
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
147
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
148
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
149
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
150
|
+
}, z.core.$strip>>>;
|
|
151
|
+
buyer_accounting_reference: z.ZodOptional<z.ZodString>;
|
|
152
|
+
note: z.ZodOptional<z.ZodString>;
|
|
153
|
+
seller_item_id: z.ZodOptional<z.ZodString>;
|
|
154
|
+
buyer_item_id: z.ZodOptional<z.ZodString>;
|
|
155
|
+
standard_item_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
156
|
+
value: z.ZodString;
|
|
157
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, z.core.$strip>]>>;
|
|
159
|
+
order_line_reference: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
allowances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
162
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
163
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
164
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
165
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
166
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
167
|
+
tax: z.ZodObject<{
|
|
168
|
+
category: z.ZodEnum<{
|
|
169
|
+
Z: "Z";
|
|
170
|
+
E: "E";
|
|
171
|
+
G: "G";
|
|
172
|
+
S: "S";
|
|
173
|
+
AE: "AE";
|
|
174
|
+
K: "K";
|
|
175
|
+
O: "O";
|
|
176
|
+
}>;
|
|
177
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
}, z.core.$strip>>>;
|
|
180
|
+
charges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
181
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
182
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
183
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
184
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
185
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
186
|
+
tax: z.ZodObject<{
|
|
187
|
+
category: z.ZodEnum<{
|
|
188
|
+
Z: "Z";
|
|
189
|
+
E: "E";
|
|
190
|
+
G: "G";
|
|
191
|
+
S: "S";
|
|
192
|
+
AE: "AE";
|
|
193
|
+
K: "K";
|
|
194
|
+
O: "O";
|
|
195
|
+
}>;
|
|
196
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
}, z.core.$strip>>>;
|
|
199
|
+
tax: z.ZodObject<{
|
|
200
|
+
breakdown: z.ZodArray<z.ZodObject<{
|
|
201
|
+
category: z.ZodEnum<{
|
|
202
|
+
Z: "Z";
|
|
203
|
+
E: "E";
|
|
204
|
+
G: "G";
|
|
205
|
+
S: "S";
|
|
206
|
+
AE: "AE";
|
|
207
|
+
K: "K";
|
|
208
|
+
O: "O";
|
|
209
|
+
}>;
|
|
210
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
211
|
+
basis: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
212
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
213
|
+
exemption_reason: z.ZodOptional<z.ZodString>;
|
|
214
|
+
exemption_reason_code: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
totals: z.ZodObject<{
|
|
218
|
+
line_net: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
219
|
+
allowances: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
220
|
+
charges: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
221
|
+
tax_basis: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
222
|
+
tax_total: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
223
|
+
tax_total_accounting: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
224
|
+
grand: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
225
|
+
prepaid: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
226
|
+
rounding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
227
|
+
due: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
payment: z.ZodOptional<z.ZodObject<{
|
|
230
|
+
means_code: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
231
|
+
iban: z.ZodOptional<z.ZodString>;
|
|
232
|
+
bic: z.ZodOptional<z.ZodString>;
|
|
233
|
+
account_name: z.ZodOptional<z.ZodString>;
|
|
234
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
235
|
+
terms: z.ZodOptional<z.ZodString>;
|
|
236
|
+
due_date: z.ZodOptional<z.ZodString>;
|
|
237
|
+
mandate_id: z.ZodOptional<z.ZodString>;
|
|
238
|
+
creditor_id: z.ZodOptional<z.ZodString>;
|
|
239
|
+
debited_iban: z.ZodOptional<z.ZodString>;
|
|
240
|
+
}, z.core.$strip>>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
/** The block as a caller writes it. */
|
|
243
|
+
export type InvoiceInput = z.input<typeof invoiceSchema>;
|
|
244
|
+
/** The block once parsed: defaults filled in, numbers still as they came. */
|
|
245
|
+
export type ParsedInvoice = z.output<typeof invoiceSchema>;
|
|
246
|
+
export type ParsedParty = ParsedInvoice['seller'] | ParsedInvoice['buyer'];
|
|
247
|
+
export type ParsedLine = ParsedInvoice['lines'][number];
|
|
248
|
+
export declare const EINVOICE_PROFILES: readonly ["basic", "en16931"];
|
|
249
|
+
export type EinvoiceProfile = (typeof EINVOICE_PROFILES)[number];
|
|
250
|
+
export declare const EINVOICE_FLAVOURS: readonly ["factur-x", "zugferd"];
|
|
251
|
+
export type EinvoiceFlavour = (typeof EINVOICE_FLAVOURS)[number];
|
|
252
|
+
/**
|
|
253
|
+
* `post.einvoice` of a request and `settings.einvoice` of a template (spec 17 §4.1). `profile` and
|
|
254
|
+
* `flavour` are text here on purpose: a profile we do not emit (`minimum`, `xrechnung`) is answered
|
|
255
|
+
* with `einvoice_profile_unsupported` and its own explanation, not as a malformed request.
|
|
256
|
+
*/
|
|
257
|
+
export declare const einvoiceOptionsSchema: z.ZodObject<{
|
|
258
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
259
|
+
flavour: z.ZodOptional<z.ZodString>;
|
|
260
|
+
xml: z.ZodOptional<z.ZodEnum<{
|
|
261
|
+
embedded: "embedded";
|
|
262
|
+
both: "both";
|
|
263
|
+
}>>;
|
|
264
|
+
display_check: z.ZodOptional<z.ZodEnum<{
|
|
265
|
+
warn: "warn";
|
|
266
|
+
strict: "strict";
|
|
267
|
+
}>>;
|
|
268
|
+
}, z.core.$strict>;
|
|
269
|
+
export type EinvoiceOptionsInput = z.infer<typeof einvoiceOptionsSchema>;
|
|
270
|
+
/** The options with every default filled in: what the worker acts on and the render records. */
|
|
271
|
+
export interface EinvoiceOptions {
|
|
272
|
+
profile: EinvoiceProfile;
|
|
273
|
+
flavour: EinvoiceFlavour;
|
|
274
|
+
xml: 'embedded' | 'both';
|
|
275
|
+
display_check: 'warn' | 'strict';
|
|
276
|
+
}
|
|
277
|
+
export declare const defaultEinvoiceOptions: EinvoiceOptions;
|
|
278
|
+
export type ResolvedEinvoice = {
|
|
279
|
+
ok: true;
|
|
280
|
+
options: EinvoiceOptions | null;
|
|
281
|
+
} | {
|
|
282
|
+
ok: false;
|
|
283
|
+
field: 'profile' | 'flavour';
|
|
284
|
+
value: string;
|
|
285
|
+
reason: string;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* One e-invoice declaration out of its layers, earliest first (the template's settings, the
|
|
289
|
+
* request's settings, `post.einvoice`). Fields merge one by one with the later layer winning, like
|
|
290
|
+
* every other setting; `false` drops whatever was declared before it, so a request can switch a
|
|
291
|
+
* template's declaration off; `null` when nothing declares an e-invoice.
|
|
292
|
+
*/
|
|
293
|
+
export declare function resolveEinvoiceOptions(...layers: Array<EinvoiceOptionsInput | false | null | undefined>): ResolvedEinvoice;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** VAT categories of UNCL 5305 as EN 16931 uses them (spec 17 §4.3). */
|
|
3
|
+
export declare const VAT_CATEGORIES: readonly ["S", "Z", "E", "AE", "K", "G", "O"];
|
|
4
|
+
export type VatCategory = (typeof VAT_CATEGORIES)[number];
|
|
5
|
+
export declare const invoiceSchema: z.ZodObject<{
|
|
6
|
+
number: z.ZodString;
|
|
7
|
+
issue_date: z.ZodString;
|
|
8
|
+
type_code: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
9
|
+
currency: z.ZodString;
|
|
10
|
+
accounting_currency: z.ZodOptional<z.ZodString>;
|
|
11
|
+
buyer_reference: z.ZodOptional<z.ZodString>;
|
|
12
|
+
order_reference: z.ZodOptional<z.ZodString>;
|
|
13
|
+
contract_reference: z.ZodOptional<z.ZodString>;
|
|
14
|
+
note: z.ZodOptional<z.ZodString>;
|
|
15
|
+
notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
16
|
+
text: z.ZodString;
|
|
17
|
+
subject_code: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
period: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
start: z.ZodOptional<z.ZodString>;
|
|
21
|
+
end: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
preceding_invoices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
number: z.ZodString;
|
|
25
|
+
issue_date: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>>>;
|
|
27
|
+
operation: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
goods: "goods";
|
|
29
|
+
services: "services";
|
|
30
|
+
mixed: "mixed";
|
|
31
|
+
}>>;
|
|
32
|
+
operation_code: z.ZodOptional<z.ZodString>;
|
|
33
|
+
seller: z.ZodObject<{
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
trading_name: z.ZodOptional<z.ZodString>;
|
|
36
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
37
|
+
value: z.ZodString;
|
|
38
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>]>>;
|
|
40
|
+
legal_registration: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
41
|
+
value: z.ZodString;
|
|
42
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>]>>;
|
|
44
|
+
vat_id: z.ZodOptional<z.ZodString>;
|
|
45
|
+
address: z.ZodObject<{
|
|
46
|
+
street: z.ZodOptional<z.ZodString>;
|
|
47
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
48
|
+
street3: z.ZodOptional<z.ZodString>;
|
|
49
|
+
postcode: z.ZodOptional<z.ZodString>;
|
|
50
|
+
city: z.ZodOptional<z.ZodString>;
|
|
51
|
+
country: z.ZodString;
|
|
52
|
+
subdivision: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
name: z.ZodOptional<z.ZodString>;
|
|
56
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
57
|
+
email: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
electronic_address: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
60
|
+
value: z.ZodString;
|
|
61
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>]>>;
|
|
63
|
+
tax_number: z.ZodOptional<z.ZodString>;
|
|
64
|
+
legal_info: z.ZodOptional<z.ZodString>;
|
|
65
|
+
vat_on_debits: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
buyer: z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
trading_name: z.ZodOptional<z.ZodString>;
|
|
70
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
71
|
+
value: z.ZodString;
|
|
72
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>]>>;
|
|
74
|
+
legal_registration: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
75
|
+
value: z.ZodString;
|
|
76
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>]>>;
|
|
78
|
+
vat_id: z.ZodOptional<z.ZodString>;
|
|
79
|
+
address: z.ZodObject<{
|
|
80
|
+
street: z.ZodOptional<z.ZodString>;
|
|
81
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
82
|
+
street3: z.ZodOptional<z.ZodString>;
|
|
83
|
+
postcode: z.ZodOptional<z.ZodString>;
|
|
84
|
+
city: z.ZodOptional<z.ZodString>;
|
|
85
|
+
country: z.ZodString;
|
|
86
|
+
subdivision: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
name: z.ZodOptional<z.ZodString>;
|
|
90
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
91
|
+
email: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
electronic_address: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
94
|
+
value: z.ZodString;
|
|
95
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>]>>;
|
|
97
|
+
siren: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
delivery: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
name: z.ZodOptional<z.ZodString>;
|
|
101
|
+
date: z.ZodOptional<z.ZodString>;
|
|
102
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
street: z.ZodOptional<z.ZodString>;
|
|
104
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
105
|
+
street3: z.ZodOptional<z.ZodString>;
|
|
106
|
+
postcode: z.ZodOptional<z.ZodString>;
|
|
107
|
+
city: z.ZodOptional<z.ZodString>;
|
|
108
|
+
country: z.ZodString;
|
|
109
|
+
subdivision: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
113
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
description: z.ZodOptional<z.ZodString>;
|
|
116
|
+
quantity: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
117
|
+
unit_code: z.ZodDefault<z.ZodString>;
|
|
118
|
+
net_price: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
119
|
+
price_base_quantity: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
120
|
+
net_amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
121
|
+
tax: z.ZodObject<{
|
|
122
|
+
category: z.ZodEnum<{
|
|
123
|
+
Z: "Z";
|
|
124
|
+
E: "E";
|
|
125
|
+
G: "G";
|
|
126
|
+
S: "S";
|
|
127
|
+
AE: "AE";
|
|
128
|
+
K: "K";
|
|
129
|
+
O: "O";
|
|
130
|
+
}>;
|
|
131
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
period: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
start: z.ZodOptional<z.ZodString>;
|
|
135
|
+
end: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
allowances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
138
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
139
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
140
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
141
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
142
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
143
|
+
}, z.core.$strip>>>;
|
|
144
|
+
charges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
145
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
146
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
147
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
148
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
149
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
150
|
+
}, z.core.$strip>>>;
|
|
151
|
+
buyer_accounting_reference: z.ZodOptional<z.ZodString>;
|
|
152
|
+
note: z.ZodOptional<z.ZodString>;
|
|
153
|
+
seller_item_id: z.ZodOptional<z.ZodString>;
|
|
154
|
+
buyer_item_id: z.ZodOptional<z.ZodString>;
|
|
155
|
+
standard_item_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
156
|
+
value: z.ZodString;
|
|
157
|
+
scheme: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, z.core.$strip>]>>;
|
|
159
|
+
order_line_reference: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
allowances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
162
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
163
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
164
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
165
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
166
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
167
|
+
tax: z.ZodObject<{
|
|
168
|
+
category: z.ZodEnum<{
|
|
169
|
+
Z: "Z";
|
|
170
|
+
E: "E";
|
|
171
|
+
G: "G";
|
|
172
|
+
S: "S";
|
|
173
|
+
AE: "AE";
|
|
174
|
+
K: "K";
|
|
175
|
+
O: "O";
|
|
176
|
+
}>;
|
|
177
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
}, z.core.$strip>>>;
|
|
180
|
+
charges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
181
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
182
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
183
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
184
|
+
base_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
185
|
+
percent: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
186
|
+
tax: z.ZodObject<{
|
|
187
|
+
category: z.ZodEnum<{
|
|
188
|
+
Z: "Z";
|
|
189
|
+
E: "E";
|
|
190
|
+
G: "G";
|
|
191
|
+
S: "S";
|
|
192
|
+
AE: "AE";
|
|
193
|
+
K: "K";
|
|
194
|
+
O: "O";
|
|
195
|
+
}>;
|
|
196
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
}, z.core.$strip>>>;
|
|
199
|
+
tax: z.ZodObject<{
|
|
200
|
+
breakdown: z.ZodArray<z.ZodObject<{
|
|
201
|
+
category: z.ZodEnum<{
|
|
202
|
+
Z: "Z";
|
|
203
|
+
E: "E";
|
|
204
|
+
G: "G";
|
|
205
|
+
S: "S";
|
|
206
|
+
AE: "AE";
|
|
207
|
+
K: "K";
|
|
208
|
+
O: "O";
|
|
209
|
+
}>;
|
|
210
|
+
rate: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
211
|
+
basis: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
212
|
+
amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
213
|
+
exemption_reason: z.ZodOptional<z.ZodString>;
|
|
214
|
+
exemption_reason_code: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
totals: z.ZodObject<{
|
|
218
|
+
line_net: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
219
|
+
allowances: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
220
|
+
charges: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
221
|
+
tax_basis: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
222
|
+
tax_total: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
223
|
+
tax_total_accounting: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
224
|
+
grand: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
225
|
+
prepaid: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
226
|
+
rounding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
227
|
+
due: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
payment: z.ZodOptional<z.ZodObject<{
|
|
230
|
+
means_code: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
231
|
+
iban: z.ZodOptional<z.ZodString>;
|
|
232
|
+
bic: z.ZodOptional<z.ZodString>;
|
|
233
|
+
account_name: z.ZodOptional<z.ZodString>;
|
|
234
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
235
|
+
terms: z.ZodOptional<z.ZodString>;
|
|
236
|
+
due_date: z.ZodOptional<z.ZodString>;
|
|
237
|
+
mandate_id: z.ZodOptional<z.ZodString>;
|
|
238
|
+
creditor_id: z.ZodOptional<z.ZodString>;
|
|
239
|
+
debited_iban: z.ZodOptional<z.ZodString>;
|
|
240
|
+
}, z.core.$strip>>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
/** The block as a caller writes it. */
|
|
243
|
+
export type InvoiceInput = z.input<typeof invoiceSchema>;
|
|
244
|
+
/** The block once parsed: defaults filled in, numbers still as they came. */
|
|
245
|
+
export type ParsedInvoice = z.output<typeof invoiceSchema>;
|
|
246
|
+
export type ParsedParty = ParsedInvoice['seller'] | ParsedInvoice['buyer'];
|
|
247
|
+
export type ParsedLine = ParsedInvoice['lines'][number];
|
|
248
|
+
export declare const EINVOICE_PROFILES: readonly ["basic", "en16931"];
|
|
249
|
+
export type EinvoiceProfile = (typeof EINVOICE_PROFILES)[number];
|
|
250
|
+
export declare const EINVOICE_FLAVOURS: readonly ["factur-x", "zugferd"];
|
|
251
|
+
export type EinvoiceFlavour = (typeof EINVOICE_FLAVOURS)[number];
|
|
252
|
+
/**
|
|
253
|
+
* `post.einvoice` of a request and `settings.einvoice` of a template (spec 17 §4.1). `profile` and
|
|
254
|
+
* `flavour` are text here on purpose: a profile we do not emit (`minimum`, `xrechnung`) is answered
|
|
255
|
+
* with `einvoice_profile_unsupported` and its own explanation, not as a malformed request.
|
|
256
|
+
*/
|
|
257
|
+
export declare const einvoiceOptionsSchema: z.ZodObject<{
|
|
258
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
259
|
+
flavour: z.ZodOptional<z.ZodString>;
|
|
260
|
+
xml: z.ZodOptional<z.ZodEnum<{
|
|
261
|
+
embedded: "embedded";
|
|
262
|
+
both: "both";
|
|
263
|
+
}>>;
|
|
264
|
+
display_check: z.ZodOptional<z.ZodEnum<{
|
|
265
|
+
warn: "warn";
|
|
266
|
+
strict: "strict";
|
|
267
|
+
}>>;
|
|
268
|
+
}, z.core.$strict>;
|
|
269
|
+
export type EinvoiceOptionsInput = z.infer<typeof einvoiceOptionsSchema>;
|
|
270
|
+
/** The options with every default filled in: what the worker acts on and the render records. */
|
|
271
|
+
export interface EinvoiceOptions {
|
|
272
|
+
profile: EinvoiceProfile;
|
|
273
|
+
flavour: EinvoiceFlavour;
|
|
274
|
+
xml: 'embedded' | 'both';
|
|
275
|
+
display_check: 'warn' | 'strict';
|
|
276
|
+
}
|
|
277
|
+
export declare const defaultEinvoiceOptions: EinvoiceOptions;
|
|
278
|
+
export type ResolvedEinvoice = {
|
|
279
|
+
ok: true;
|
|
280
|
+
options: EinvoiceOptions | null;
|
|
281
|
+
} | {
|
|
282
|
+
ok: false;
|
|
283
|
+
field: 'profile' | 'flavour';
|
|
284
|
+
value: string;
|
|
285
|
+
reason: string;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* One e-invoice declaration out of its layers, earliest first (the template's settings, the
|
|
289
|
+
* request's settings, `post.einvoice`). Fields merge one by one with the later layer winning, like
|
|
290
|
+
* every other setting; `false` drops whatever was declared before it, so a request can switch a
|
|
291
|
+
* template's declaration off; `null` when nothing declares an e-invoice.
|
|
292
|
+
*/
|
|
293
|
+
export declare function resolveEinvoiceOptions(...layers: Array<EinvoiceOptionsInput | false | null | undefined>): ResolvedEinvoice;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InvoiceInput } from './schema.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* A complete `_invoice` block with placeholder values, for a data set that has none yet: the editor
|
|
4
|
+
* inserts it, and the docs show it. Every value is one to replace; it is valid as it stands, so the
|
|
5
|
+
* first preview of a template that reads it renders, and passes the check.
|
|
6
|
+
*
|
|
7
|
+
* The names are the placeholders every published sample of ours uses. `issueDate` is a parameter
|
|
8
|
+
* because the engine has no clock of its own.
|
|
9
|
+
*/
|
|
10
|
+
export declare function invoiceSkeleton(issueDate?: string): InvoiceInput;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InvoiceInput } from './schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* A complete `_invoice` block with placeholder values, for a data set that has none yet: the editor
|
|
4
|
+
* inserts it, and the docs show it. Every value is one to replace; it is valid as it stands, so the
|
|
5
|
+
* first preview of a template that reads it renders, and passes the check.
|
|
6
|
+
*
|
|
7
|
+
* The names are the placeholders every published sample of ours uses. `issueDate` is a parameter
|
|
8
|
+
* because the engine has no clock of its own.
|
|
9
|
+
*/
|
|
10
|
+
export declare function invoiceSkeleton(issueDate?: string): InvoiceInput;
|