@formancy/report-spec 0.1.0 → 0.3.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.
- package/NOTICE +8 -0
- package/README.md +912 -6
- package/dist/index.d.mts +2531 -174
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11543 -1395
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/version.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The format's name. A canonical hash of a report is taken over an envelope
|
|
4
3
|
* that names it, so a report and a form whose JSON bodies happen to be equal
|
|
@@ -33,8 +32,6 @@ type SpecVersionCheck = {
|
|
|
33
32
|
* hides a row or changes a total.
|
|
34
33
|
*/
|
|
35
34
|
export declare function checkSpecVersion(document: unknown): SpecVersionCheck;
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/types.d.ts
|
|
38
35
|
export declare const PAGE_SIZE_NAMES: readonly ["A4", "Letter"];
|
|
39
36
|
type PageSizeName = (typeof PAGE_SIZE_NAMES)[number];
|
|
40
37
|
export declare const ORIENTATIONS: readonly ["portrait", "landscape"];
|
|
@@ -50,28 +47,107 @@ interface PageSettings {
|
|
|
50
47
|
readonly orientation: Orientation;
|
|
51
48
|
readonly margins: Margins;
|
|
52
49
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
interface PageDimensions {
|
|
51
|
+
readonly width: number;
|
|
52
|
+
readonly height: number;
|
|
53
|
+
}
|
|
57
54
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
55
|
+
* Portrait sizes in points. A4 is ISO 216's 210 x 297 mm, converted and
|
|
56
|
+
* rounded like any other length (595.28 x 841.89, the values PDF engines
|
|
57
|
+
* use); Letter is 8.5 x 11 inches, exactly 612 x 792.
|
|
58
|
+
*/
|
|
59
|
+
export declare const PAGE_SIZES: { readonly [S in PageSizeName]: PageDimensions; };
|
|
60
|
+
/** The page's width and height as oriented: landscape swaps the sides. */
|
|
61
|
+
export declare function pageDimensions(page: {
|
|
62
|
+
readonly size: PageSizeName;
|
|
63
|
+
readonly orientation: Orientation;
|
|
64
|
+
}): PageDimensions;
|
|
65
|
+
/** What the margins leave of the oriented page, to the hundredth of a point that lengths are stored at. */
|
|
66
|
+
export declare function printableArea(page: PageSettings): PageDimensions;
|
|
67
|
+
/**
|
|
68
|
+
* The largest square `area` holds: the length of its shorter side, and
|
|
69
|
+
* which side that is, the width when the two are equal. The validator
|
|
70
|
+
* measures a QR code's square against it and refuses one that overruns it
|
|
71
|
+
* on that side; the builders size a new code by it and name it as the room
|
|
72
|
+
* a refused size lacks.
|
|
73
|
+
*/
|
|
74
|
+
export declare function squareRoom(area: PageDimensions): {
|
|
75
|
+
readonly side: 'width' | 'height';
|
|
76
|
+
readonly length: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The data a report reads: the datasets it names by the contract each
|
|
80
|
+
* promises, the one way the format refers to one of their fields, and the
|
|
81
|
+
* parameters a person supplies before it renders. The template names them;
|
|
82
|
+
* the deployment supplies what each resolves to.
|
|
61
83
|
*/
|
|
62
|
-
interface PrintStyle {
|
|
63
|
-
readonly id: string;
|
|
64
|
-
readonly font?: FontFamily;
|
|
65
|
-
/** Points. */
|
|
66
|
-
readonly size?: number;
|
|
67
|
-
readonly bold?: boolean;
|
|
68
|
-
readonly italic?: boolean;
|
|
69
|
-
/** Lower-case `#rrggbb`. */
|
|
70
|
-
readonly color?: string;
|
|
71
|
-
readonly align?: Alignment;
|
|
72
|
-
}
|
|
73
84
|
export declare const FIELD_TYPES: readonly ["string", "integer", "decimal", "boolean", "date", "datetime", "instant", "image"];
|
|
74
85
|
type FieldType = (typeof FIELD_TYPES)[number];
|
|
86
|
+
/**
|
|
87
|
+
* How a choice's answer prints, where it does not print its label (0042):
|
|
88
|
+
* the value the submission stores. Its label -- the one its option has in
|
|
89
|
+
* the form version that collected it, in the locale the render names, the
|
|
90
|
+
* report's own when it names none (0063) -- is what it prints when `read`
|
|
91
|
+
* is left out, and has no spelling of its own, so that one binding has
|
|
92
|
+
* one hash.
|
|
93
|
+
*/
|
|
94
|
+
export declare const FORM_READS: readonly ["value"];
|
|
95
|
+
type FormRead = (typeof FORM_READS)[number];
|
|
96
|
+
/**
|
|
97
|
+
* Where a formancy form's submission holds a field's answer (0042): its
|
|
98
|
+
* data path in the dataset's scope, as formancy writes one -- field keys
|
|
99
|
+
* joined by dots, a group's child `address.street`; a page scopes nothing
|
|
100
|
+
* and has no key in it. The header's scope and one row per submission's is
|
|
101
|
+
* the submission's; a repeater's rows' is the row's.
|
|
102
|
+
*/
|
|
103
|
+
interface FieldFormBinding {
|
|
104
|
+
readonly path: string;
|
|
105
|
+
/** A matrix row's value, whose chosen column the field prints, or a selectboxes option's value, whether it is ticked. */
|
|
106
|
+
readonly member?: string;
|
|
107
|
+
/** How a choice prints -- a select, a radio, a matrix row's column: `value`, its stored value; absent, its label. Only a string field reads a choice. */
|
|
108
|
+
readonly read?: FormRead;
|
|
109
|
+
/**
|
|
110
|
+
* What a review decided for a form version (0048), keyed by the
|
|
111
|
+
* version's `schemaHash`: where that version holds the field -- `path`
|
|
112
|
+
* itself, for the version a followed rename moved `path` to -- or that
|
|
113
|
+
* the report prints nothing of it from that version. Every version not
|
|
114
|
+
* named is read at `path`.
|
|
115
|
+
*/
|
|
116
|
+
readonly overrides?: Readonly<Record<string, FieldFormOverride>>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* How one form version's submissions fill a field, where it is not as the
|
|
120
|
+
* binding says (0048): from another data path in the same scope, the
|
|
121
|
+
* member and the reading kept; or not at all, null in every submission of
|
|
122
|
+
* that version, which only a field that may be null takes.
|
|
123
|
+
*/
|
|
124
|
+
type FieldFormOverride = {
|
|
125
|
+
readonly path: string;
|
|
126
|
+
} | {
|
|
127
|
+
readonly omit: true;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* What of a formancy form's submissions a dataset reads (0042): the header
|
|
131
|
+
* one submission's answers; the detail one of its repeater's rows, or one
|
|
132
|
+
* row for each submission of a report of many, which has no header. Which
|
|
133
|
+
* version of which form is the render's input, never the report's: each
|
|
134
|
+
* submission is read against the version that collected it.
|
|
135
|
+
*/
|
|
136
|
+
export declare const DATASET_FORM_KINDS: readonly ["submission", "repeater", "submissions"];
|
|
137
|
+
type DatasetFormKind = (typeof DATASET_FORM_KINDS)[number];
|
|
138
|
+
type DatasetFormBinding = {
|
|
139
|
+
readonly kind: 'submission';
|
|
140
|
+
} | {
|
|
141
|
+
readonly kind: 'repeater';
|
|
142
|
+
/** The repeater's data path in the submission's scope. */
|
|
143
|
+
readonly repeater: string;
|
|
144
|
+
/** Where a form version holds the rows, keyed by its `schemaHash`, as a review decided (0048) -- `repeater` itself, for the version a followed rename moved it to; its rows' fields are read at their own paths in them. Every version not named reads `repeater`. */
|
|
145
|
+
readonly overrides?: Readonly<Record<string, {
|
|
146
|
+
readonly repeater: string;
|
|
147
|
+
}>>;
|
|
148
|
+
} | {
|
|
149
|
+
readonly kind: 'submissions';
|
|
150
|
+
};
|
|
75
151
|
/**
|
|
76
152
|
* A field a dataset contract promises.
|
|
77
153
|
*
|
|
@@ -91,6 +167,8 @@ interface FieldContract {
|
|
|
91
167
|
readonly nullable: boolean;
|
|
92
168
|
/** Digits after the decimal point; decimal fields only. */
|
|
93
169
|
readonly scale?: number;
|
|
170
|
+
/** Where a formancy form's submission holds it, in a dataset read from one; absent in any other. */
|
|
171
|
+
readonly form?: FieldFormBinding;
|
|
94
172
|
}
|
|
95
173
|
/**
|
|
96
174
|
* A dataset the report reads, by the logical id a deployment's binding set
|
|
@@ -101,6 +179,8 @@ interface FieldContract {
|
|
|
101
179
|
interface DatasetContract {
|
|
102
180
|
readonly id: string;
|
|
103
181
|
readonly fields: readonly FieldContract[];
|
|
182
|
+
/** What of a formancy form's submissions it reads; absent, the host hands its data over as it captured it. */
|
|
183
|
+
readonly form?: DatasetFormBinding;
|
|
104
184
|
}
|
|
105
185
|
/** The two datasets a version-0 report can read: one row of header data, and the one primary detail dataset. */
|
|
106
186
|
export declare const DATASET_ROLES: readonly ["header", "detail"];
|
|
@@ -109,6 +189,11 @@ interface Datasets {
|
|
|
109
189
|
readonly header?: DatasetContract;
|
|
110
190
|
readonly detail?: DatasetContract;
|
|
111
191
|
}
|
|
192
|
+
/** A field of the header or the detail dataset: the one way the format refers to one. */
|
|
193
|
+
interface FieldRef {
|
|
194
|
+
readonly dataset: DatasetRole;
|
|
195
|
+
readonly field: string;
|
|
196
|
+
}
|
|
112
197
|
export declare const PARAMETER_TYPES: readonly ["string", "integer", "decimal", "boolean", "date"];
|
|
113
198
|
type ParameterType = (typeof PARAMETER_TYPES)[number];
|
|
114
199
|
/** A value a person supplies before rendering, on a formancy form whose field key is the parameter's id (plan 12.4). */
|
|
@@ -121,38 +206,29 @@ interface ParameterDef {
|
|
|
121
206
|
/** A boolean for a boolean parameter; for every other type, the exact value as a string. */
|
|
122
207
|
readonly default?: string | boolean;
|
|
123
208
|
}
|
|
124
|
-
export declare const ASSET_MEDIA_TYPES: readonly ["image/png", "image/jpeg"];
|
|
125
|
-
type AssetMediaType = (typeof ASSET_MEDIA_TYPES)[number];
|
|
126
|
-
/**
|
|
127
|
-
* An approved asset, named by id and pinned by digest. The bytes never live
|
|
128
|
-
* in the definition, and rendering never follows a mutable "latest" asset
|
|
129
|
-
* (plan 17): a new logo is a new digest and a new template release.
|
|
130
|
-
*/
|
|
131
|
-
interface AssetRef {
|
|
132
|
-
readonly id: string;
|
|
133
|
-
readonly mediaType: AssetMediaType;
|
|
134
|
-
/** `sha256:` and 64 lower-case hex digits. */
|
|
135
|
-
readonly digest: string;
|
|
136
|
-
}
|
|
137
209
|
/** A CEL expression, compiled and bounded by the runtime, not here. */
|
|
138
210
|
interface Expression {
|
|
139
211
|
readonly cel: string;
|
|
140
212
|
}
|
|
141
213
|
/**
|
|
142
214
|
* Where a value is read, which decides what it can name (plan 15's "current
|
|
143
|
-
* row, group or report"): `row` in a table cell
|
|
144
|
-
* `group` in a group header or footer,
|
|
145
|
-
*
|
|
215
|
+
* row, group or report"): `row` in a table cell and a table's row
|
|
216
|
+
* condition, once per detail row; `group` in a group header or footer,
|
|
217
|
+
* once per group; `table` in a table's total rows, once per table (0062);
|
|
218
|
+
* `report` everywhere else.
|
|
146
219
|
*/
|
|
147
|
-
export declare const VALUE_SCOPES: readonly ["report", "group", "row"];
|
|
220
|
+
export declare const VALUE_SCOPES: readonly ["report", "table", "group", "row"];
|
|
148
221
|
type ValueScope = (typeof VALUE_SCOPES)[number];
|
|
149
222
|
/**
|
|
150
223
|
* The names an expression reads in each scope, and nothing else: the
|
|
151
224
|
* runtime binds exactly these. `params` maps parameter ids to values,
|
|
152
225
|
* `header` the header dataset's fields, `row` the current detail row's,
|
|
153
|
-
* `totals` each aggregate over every detail row,
|
|
154
|
-
* over the
|
|
155
|
-
*
|
|
226
|
+
* `totals` each aggregate over every detail row, `table` each aggregate
|
|
227
|
+
* over the rows the table prints (0062), and `group` each aggregate over
|
|
228
|
+
* the current group's rows and, as `GROUP_KEY`, the value the group is
|
|
229
|
+
* keyed by. A table's row condition is read in the row's scope, so it
|
|
230
|
+
* reads neither `table` nor `group`, which are totalled and made from the
|
|
231
|
+
* rows it selects.
|
|
156
232
|
*
|
|
157
233
|
* Whether an expression names only these is checked when the runtime
|
|
158
234
|
* compiles it (plan 15's second level), not here: a second, partial CEL
|
|
@@ -162,16 +238,12 @@ export declare const EXPRESSION_NAMES: { readonly [S in ValueScope]: readonly st
|
|
|
162
238
|
/**
|
|
163
239
|
* The member of `group` that is the value the group is keyed by: in a group
|
|
164
240
|
* header, `group.key` is the site a group of rows by site is for, of the
|
|
165
|
-
* type of the field
|
|
241
|
+
* type of the field the group's own table groups by, and null for the
|
|
242
|
+
* group of rows without one.
|
|
166
243
|
* An aggregate may not take the name (`reserved-id`), so `group.key` never
|
|
167
244
|
* reads one.
|
|
168
245
|
*/
|
|
169
246
|
export declare const GROUP_KEY = "key";
|
|
170
|
-
/** A field of the header or the detail dataset: the one way the format refers to one. */
|
|
171
|
-
interface FieldRef {
|
|
172
|
-
readonly dataset: DatasetRole;
|
|
173
|
-
readonly field: string;
|
|
174
|
-
}
|
|
175
247
|
export declare const FORMAT_KINDS: readonly ["number", "currency", "date", "text"];
|
|
176
248
|
type FormatKind = (typeof FORMAT_KINDS)[number];
|
|
177
249
|
export declare const DATE_STYLES: readonly ["short", "medium", "long"];
|
|
@@ -211,27 +283,44 @@ interface TextFormat {
|
|
|
211
283
|
}
|
|
212
284
|
/** How a value is displayed. Display only: calculation precision is the runtime's, with its declared rounding. */
|
|
213
285
|
type Format = NumberFormat | CurrencyFormat | DateFormat | TextFormat;
|
|
286
|
+
/**
|
|
287
|
+
* Where a run of a paragraph stands against its line (0061): set below it,
|
|
288
|
+
* a formula's digit, or above it, a unit's power, an exponent or a
|
|
289
|
+
* footnote's mark, smaller than the paragraph's text and moved, in any
|
|
290
|
+
* character its face draws. Absent, the run stands on the line. Only a
|
|
291
|
+
* text component's runs take one; a page counter takes none, and what a
|
|
292
|
+
* code encodes and a table's cells refuse one as `misplaced-baseline`.
|
|
293
|
+
*/
|
|
294
|
+
export declare const BASELINE_SHIFTS: readonly ["subscript", "superscript"];
|
|
295
|
+
type BaselineShift = (typeof BASELINE_SHIFTS)[number];
|
|
214
296
|
interface TextInline {
|
|
215
297
|
readonly kind: 'text';
|
|
216
298
|
readonly text: string;
|
|
299
|
+
readonly baseline?: BaselineShift;
|
|
217
300
|
}
|
|
218
301
|
interface FieldInline {
|
|
219
302
|
readonly kind: 'field';
|
|
220
303
|
readonly field: FieldRef;
|
|
221
304
|
readonly format?: Format;
|
|
305
|
+
readonly baseline?: BaselineShift;
|
|
222
306
|
}
|
|
223
307
|
interface ParameterInline {
|
|
224
308
|
readonly kind: 'parameter';
|
|
225
309
|
readonly parameter: string;
|
|
226
310
|
readonly format?: Format;
|
|
311
|
+
readonly baseline?: BaselineShift;
|
|
227
312
|
}
|
|
228
313
|
interface ExpressionInline {
|
|
229
314
|
readonly kind: 'expression';
|
|
230
315
|
readonly expression: Expression;
|
|
231
316
|
readonly format?: Format;
|
|
317
|
+
readonly baseline?: BaselineShift;
|
|
232
318
|
}
|
|
233
|
-
/**
|
|
234
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Whose rows an aggregate is taken over where it is printed: the current
|
|
321
|
+
* group's, the rows its table prints (0062), or every detail row.
|
|
322
|
+
*/
|
|
323
|
+
export declare const AGGREGATE_SCOPES: readonly ["group", "table", "report"];
|
|
235
324
|
type AggregateScope = (typeof AGGREGATE_SCOPES)[number];
|
|
236
325
|
interface AggregateInline {
|
|
237
326
|
readonly kind: 'aggregate';
|
|
@@ -239,10 +328,13 @@ interface AggregateInline {
|
|
|
239
328
|
readonly aggregate: string;
|
|
240
329
|
readonly over: AggregateScope;
|
|
241
330
|
readonly format?: Format;
|
|
331
|
+
readonly baseline?: BaselineShift;
|
|
242
332
|
}
|
|
333
|
+
/** The page's number, which the engine fills on each page; it takes no baseline. */
|
|
243
334
|
interface PageNumberInline {
|
|
244
335
|
readonly kind: 'pageNumber';
|
|
245
336
|
}
|
|
337
|
+
/** How many pages the document has, which the engine fills; it takes no baseline. */
|
|
246
338
|
interface PageCountInline {
|
|
247
339
|
readonly kind: 'pageCount';
|
|
248
340
|
}
|
|
@@ -254,6 +346,139 @@ type InlineKind = (typeof INLINE_KINDS)[number];
|
|
|
254
346
|
* header. Null prints as nothing.
|
|
255
347
|
*/
|
|
256
348
|
type Inline = TextInline | FieldInline | ParameterInline | ExpressionInline | AggregateInline | PageNumberInline | PageCountInline;
|
|
349
|
+
export declare const FONT_FAMILIES: readonly ["sans", "serif", "mono"];
|
|
350
|
+
type FontFamily = (typeof FONT_FAMILIES)[number];
|
|
351
|
+
export declare const ALIGNMENTS: readonly ["left", "center", "right"];
|
|
352
|
+
type Alignment = (typeof ALIGNMENTS)[number];
|
|
353
|
+
/**
|
|
354
|
+
* A print style: serialisable report tokens, never CSS. Nothing from the
|
|
355
|
+
* editor's or the host's stylesheet reaches a printed page; what prints is
|
|
356
|
+
* what these say (plan 11.4). An absent property is the renderer's default.
|
|
357
|
+
*/
|
|
358
|
+
interface PrintStyle {
|
|
359
|
+
readonly id: string;
|
|
360
|
+
readonly font?: FontFamily;
|
|
361
|
+
/** Points. */
|
|
362
|
+
readonly size?: number;
|
|
363
|
+
readonly bold?: boolean;
|
|
364
|
+
readonly italic?: boolean;
|
|
365
|
+
/** Lower-case `#rrggbb`. */
|
|
366
|
+
readonly color?: string;
|
|
367
|
+
readonly align?: Alignment;
|
|
368
|
+
}
|
|
369
|
+
/** A style applied when a condition holds: each rule that holds applies its style over the base one, in order, a later rule's property winning. */
|
|
370
|
+
interface StyleRule {
|
|
371
|
+
readonly when: Expression;
|
|
372
|
+
/** A `PrintStyle` id. */
|
|
373
|
+
readonly style: string;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* The assets a report shows or prints in, each named by its id and pinned
|
|
377
|
+
* by its digest; the bytes are the deployment's. What a PNG's or a JPEG's
|
|
378
|
+
* bytes may be, `image-header.ts` reads, an SVG's, `svg.ts`, and a font's,
|
|
379
|
+
* `font.ts` (0040, 0043).
|
|
380
|
+
*/
|
|
381
|
+
/** An image asset's bytes are a PNG, a JPEG, or an SVG in the form report-spec's `cleanSvg` writes (0030). */
|
|
382
|
+
export declare const ASSET_MEDIA_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml"];
|
|
383
|
+
type AssetMediaType = (typeof ASSET_MEDIA_TYPES)[number];
|
|
384
|
+
/**
|
|
385
|
+
* A font asset's bytes are a TrueType font (`font/ttf`, RFC 8081), read by
|
|
386
|
+
* `readFont` (0040). An OpenType CFF font (`font/otf`) is not admitted:
|
|
387
|
+
* `readFont` reads no CFF outlines and refuses `OTTO` bytes, and the
|
|
388
|
+
* e-invoice gate has not proved a CFF face embeds in a PDF/A-3b (FT-Q15,
|
|
389
|
+
* 0043).
|
|
390
|
+
*/
|
|
391
|
+
export declare const FONT_MEDIA_TYPES: readonly ["font/ttf"];
|
|
392
|
+
type FontMediaType = (typeof FONT_MEDIA_TYPES)[number];
|
|
393
|
+
/** Every media type an asset may declare: an image's, or a font's. */
|
|
394
|
+
export declare const ASSET_AND_FONT_MEDIA_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "font/ttf"];
|
|
395
|
+
type AnyAssetMediaType = AssetMediaType | FontMediaType;
|
|
396
|
+
/** Whether `mediaType` is a font's, not an image's. */
|
|
397
|
+
export declare function isFontMediaType(mediaType: string): mediaType is FontMediaType;
|
|
398
|
+
/**
|
|
399
|
+
* An approved asset, named by id and pinned by digest. The bytes never live
|
|
400
|
+
* in the definition, and rendering never follows a mutable "latest" asset
|
|
401
|
+
* (plan 17): a new logo, or a new typeface, is a new digest and a new
|
|
402
|
+
* template release.
|
|
403
|
+
*/
|
|
404
|
+
interface AssetRef {
|
|
405
|
+
readonly id: string;
|
|
406
|
+
readonly mediaType: AnyAssetMediaType;
|
|
407
|
+
/** `sha256:` and 64 lower-case hex digits. */
|
|
408
|
+
readonly digest: string;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* The faces of one family a report may map, as pdfmake draws text in each
|
|
412
|
+
* weight and slant: `normal` always, and `bold`, `italic` and `boldItalic`
|
|
413
|
+
* where the report prints text in them. A face is never synthesised from
|
|
414
|
+
* another -- pdfmake's own faux bold and oblique are a substitution nobody
|
|
415
|
+
* sees until the PDF is read (plan 20) -- so a report that prints bold text
|
|
416
|
+
* in a mapped family maps that family's bold face, or the renderer refuses
|
|
417
|
+
* it.
|
|
418
|
+
*/
|
|
419
|
+
export declare const FONT_FACE_KEYS: readonly ["normal", "bold", "italic", "boldItalic"];
|
|
420
|
+
type FontFaceKey = (typeof FONT_FACE_KEYS)[number];
|
|
421
|
+
/** The approved font assets a family's faces print in, each named by its asset id; `normal` is required, the rest are mapped where the report prints them. */
|
|
422
|
+
interface FontFaces {
|
|
423
|
+
readonly normal: string;
|
|
424
|
+
readonly bold?: string;
|
|
425
|
+
readonly italic?: string;
|
|
426
|
+
readonly boldItalic?: string;
|
|
427
|
+
}
|
|
428
|
+
/** A report's font map: the token-to-faces mapping for whichever of the three families it maps. Absent, or a token left out, the renderer prints that token in its own face. */
|
|
429
|
+
type FontMap = { readonly [F in FontFamily]?: FontFaces; };
|
|
430
|
+
/** The face a run of text in this weight and slant prints in. */
|
|
431
|
+
export declare function faceKey(bold: boolean, italic: boolean): FontFaceKey;
|
|
432
|
+
/**
|
|
433
|
+
* The characters a report prints, by code point (0043, FT-Q16).
|
|
434
|
+
*
|
|
435
|
+
* pdfmake lays text out left to right and reorders nothing, and the
|
|
436
|
+
* renderer removes a host face's layout tables before it embeds it
|
|
437
|
+
* (report-render-pdf's `strip-layout.ts`), so fontkit substitutes and
|
|
438
|
+
* positions nothing at print either: each character prints as the glyph
|
|
439
|
+
* its face maps it to. That prints Latin, Greek and Cyrillic, and the
|
|
440
|
+
* punctuation, symbols and combining marks written with them, which the
|
|
441
|
+
* corpus proves on the PDF. It does not print a right-to-left script, a
|
|
442
|
+
* script whose letters join or reorder, or CJK, and nothing here has proved
|
|
443
|
+
* any other. So the list is of what prints, not of what is refused: a
|
|
444
|
+
* character prints only where it lies in one of `PRINTED_BLOCKS` and is not
|
|
445
|
+
* one of `BIDI_CONTROLS`, and every other is refused, in any face, Roboto's
|
|
446
|
+
* included, until a fixture proves its script.
|
|
447
|
+
*
|
|
448
|
+
* The bounds are Unicode's blocks, read from `Blocks.txt` 18.0.0, and the
|
|
449
|
+
* controls are its `PropList.txt`'s Bidi_Control; 0043 gives both files'
|
|
450
|
+
* addresses and digests. Seven entries take part of a block and say so in
|
|
451
|
+
* their names: Spacing Modifier Letters and Greek and Coptic each in two,
|
|
452
|
+
* around the Bopomofo tone marks and the Coptic letters they hold; the
|
|
453
|
+
* Latin ligatures of Alphabetic Presentation Forms, whose rest is Armenian
|
|
454
|
+
* and Hebrew; the byte-order mark alone of Arabic Presentation Forms-B; and
|
|
455
|
+
* the two replacement characters of Specials.
|
|
456
|
+
* `font-scripts.test.ts` holds each entry's bounds and order, and
|
|
457
|
+
* report-render-pdf's `scripts.test.ts` every character of every entry to
|
|
458
|
+
* the script fontkit's own Unicode data gives it; that the bounds are
|
|
459
|
+
* Blocks.txt's is review-held.
|
|
460
|
+
*/
|
|
461
|
+
/** The Unicode version the blocks and the controls were read from. */
|
|
462
|
+
export declare const UNICODE_VERSION = "18.0.0";
|
|
463
|
+
/** A run of code points that prints: a block, or the named part of one, with its inclusive bounds. */
|
|
464
|
+
interface PrintedBlock {
|
|
465
|
+
readonly block: string;
|
|
466
|
+
readonly from: number;
|
|
467
|
+
readonly to: number;
|
|
468
|
+
}
|
|
469
|
+
/** What prints, in code-point order, every entry in the Basic Multilingual Plane. */
|
|
470
|
+
export declare const PRINTED_BLOCKS: readonly PrintedBlock[];
|
|
471
|
+
/**
|
|
472
|
+
* The bidirectional controls in the blocks that print, PropList.txt's
|
|
473
|
+
* Bidi_Control but for U+061C, the Arabic letter mark, which is in no
|
|
474
|
+
* printed block. pdfmake reorders nothing and fontkit draws a control as a
|
|
475
|
+
* space, so each is refused rather than printed as one.
|
|
476
|
+
*/
|
|
477
|
+
export declare const BIDI_CONTROLS: ReadonlySet<number>;
|
|
478
|
+
/** Why a report does not print a character: its script is one nothing here prints, or it is a bidirectional control. */
|
|
479
|
+
type CharacterRefusal = 'script' | 'bidi-control';
|
|
480
|
+
/** Why `point` does not print, or undefined where it does; a binary search of `PRINTED_BLOCKS`. */
|
|
481
|
+
export declare function refusedCharacter(point: number): CharacterRefusal | undefined;
|
|
257
482
|
/** What an aggregate reads from each detail row: a detail field, or an expression over the row. */
|
|
258
483
|
type RowValue = {
|
|
259
484
|
readonly kind: 'field';
|
|
@@ -298,11 +523,176 @@ interface AggregateDef {
|
|
|
298
523
|
readonly of?: RowValue;
|
|
299
524
|
readonly rounding?: Rounding;
|
|
300
525
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
526
|
+
export declare const CHART_KINDS: readonly ["bar", "line", "pie"];
|
|
527
|
+
type ChartKind = (typeof CHART_KINDS)[number];
|
|
528
|
+
/** The order a chart lists its categories in: as the rows first have them, or sorted by the category, least or greatest first. */
|
|
529
|
+
export declare const CHART_ORDERS: readonly ["data", "asc", "desc"];
|
|
530
|
+
type ChartOrder = (typeof CHART_ORDERS)[number];
|
|
531
|
+
/** The types a category may be: text, a date, or a number. A boolean, a moment or an image names no group a reader would look for. Held by the validator. */
|
|
532
|
+
export declare const CHART_CATEGORY_TYPES: readonly FieldType[];
|
|
533
|
+
/** What a pie may total: a share of an average, a minimum or a maximum is no share of a whole. Held by the validator. */
|
|
534
|
+
export declare const PIE_FUNCTIONS: readonly AggregateFunction[];
|
|
535
|
+
/**
|
|
536
|
+
* The colours a series is drawn in, by its place in the chart (a pie's
|
|
537
|
+
* slices by the category's): eight, each at least 3:1 against white paper
|
|
538
|
+
* (WCAG 2.2 1.4.11), the least `#1b9e77` at 3.39. A chart's own `palette`
|
|
539
|
+
* overrides them. Held by `chart.test.ts`.
|
|
540
|
+
*/
|
|
541
|
+
export declare const CHART_PALETTE: readonly ["#1f77b4", "#d95f02", "#1b9e77", "#7570b3", "#e7298a", "#5a8f1a", "#a6761d", "#666666"];
|
|
542
|
+
/** What the chart groups the detail rows by: one group, one category, for each value the field takes. */
|
|
543
|
+
interface ChartCategory {
|
|
544
|
+
readonly field: FieldRef;
|
|
545
|
+
readonly order: ChartOrder;
|
|
546
|
+
/** How the category prints; it must display the field's type. */
|
|
547
|
+
readonly format?: Format;
|
|
548
|
+
/** The label of the rows whose category is null, never blank; asked of a field that may be null. */
|
|
549
|
+
readonly nullLabel?: string;
|
|
550
|
+
}
|
|
551
|
+
/** One thing a chart totals for each category: a function over a detail field, as an aggregate's, with `avg` declaring its rounding. */
|
|
552
|
+
interface ChartSeries {
|
|
553
|
+
/** Unique in the chart. */
|
|
554
|
+
readonly id: string;
|
|
555
|
+
/** The legend's entry. */
|
|
556
|
+
readonly label: string;
|
|
557
|
+
readonly fn: AggregateFunction;
|
|
558
|
+
/** Absent only for `count`, which then counts rows. */
|
|
559
|
+
readonly of?: FieldRef;
|
|
560
|
+
readonly rounding?: Rounding;
|
|
561
|
+
}
|
|
562
|
+
/** A chart drawn in a box of fixed size; the width and the height bound it whatever its data holds. */
|
|
563
|
+
interface ChartComponent extends ComponentBase {
|
|
564
|
+
readonly kind: 'chart';
|
|
565
|
+
readonly chart: ChartKind;
|
|
566
|
+
readonly dataset: 'detail';
|
|
567
|
+
readonly width: number;
|
|
568
|
+
readonly height: number;
|
|
569
|
+
readonly category: ChartCategory;
|
|
570
|
+
readonly series: readonly ChartSeries[];
|
|
571
|
+
/**
|
|
572
|
+
* How every value prints: each tick, each value label, and a pie's values.
|
|
573
|
+
* A pie's shares, printed beside its values where it labels them, are not
|
|
574
|
+
* this format's: each is the exact ratio rounded once, half away from zero,
|
|
575
|
+
* to a percentage of one place, written as the locale writes one (the
|
|
576
|
+
* runtime's `SHARE_PLACES`).
|
|
577
|
+
*/
|
|
578
|
+
readonly valueFormat: NumberFormat | CurrencyFormat;
|
|
579
|
+
/** What prints in place of a chart with nothing to draw. */
|
|
580
|
+
readonly emptyText: string;
|
|
581
|
+
readonly title?: string;
|
|
582
|
+
readonly categoryTitle?: string;
|
|
583
|
+
readonly valueTitle?: string;
|
|
584
|
+
readonly valueLabels?: boolean;
|
|
585
|
+
/** Replaces `CHART_PALETTE`: one to eight distinct colours, and in a bar or a line chart at least one for each series. */
|
|
586
|
+
readonly palette?: readonly string[];
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* What a code may be framed and captioned with: Austria's frame and the
|
|
590
|
+
* words "Zahlen mit Code" (PSA v3.0 5), drawn inside the code's square.
|
|
591
|
+
* Absent, the code is printed alone, as a QR code is.
|
|
592
|
+
*/
|
|
593
|
+
export declare const EPC_CAPTIONS: readonly ["zahlenMitCode"];
|
|
594
|
+
type EpcCaption = (typeof EPC_CAPTIONS)[number];
|
|
595
|
+
/**
|
|
596
|
+
* An EPC QR code. Each text is runs, one at least where it is present; an
|
|
597
|
+
* optional one absent is an element the code leaves empty, never an empty
|
|
598
|
+
* list of runs, so that one code has one spelling and one hash.
|
|
599
|
+
*/
|
|
600
|
+
interface EpcQrCodeComponent extends ComponentBase {
|
|
601
|
+
readonly kind: 'epcQrCode';
|
|
602
|
+
/** The side of the square in points: the quiet zone, and the frame and caption when there are any, inside it. */
|
|
603
|
+
readonly size: number;
|
|
604
|
+
/** The beneficiary's name (AT-E001): at most 70 characters. */
|
|
605
|
+
readonly beneficiary: readonly Inline[];
|
|
606
|
+
/** The beneficiary's IBAN (AT-C001), of a country of SEPA. Spaces are for reading, and are dropped. */
|
|
607
|
+
readonly iban: readonly Inline[];
|
|
608
|
+
/** The BIC of the beneficiary's bank (AT-C002): needed for an account outside the EEA, and may be left out for one inside it. */
|
|
609
|
+
readonly bic?: readonly Inline[];
|
|
610
|
+
/** The amount in euro, a decimal of at most two places. Absent, or null, leaves the amount for the payer to fill in. */
|
|
611
|
+
readonly amount?: Expression;
|
|
612
|
+
/** The purpose code (AT-T007): four capital letters, written into the template. */
|
|
613
|
+
readonly purpose?: string;
|
|
614
|
+
/** A creditor reference (AT-T009, structured): RF and its check digits. Never with `text`. */
|
|
615
|
+
readonly reference?: readonly Inline[];
|
|
616
|
+
/** The remittance text (AT-T009, unstructured): at most 140 characters. Never with `reference`. */
|
|
617
|
+
readonly text?: readonly Inline[];
|
|
618
|
+
/** Information for the payer, shown by the banking app and not sent with the transfer: at most 70 characters. */
|
|
619
|
+
readonly information?: readonly Inline[];
|
|
620
|
+
readonly caption?: EpcCaption;
|
|
621
|
+
}
|
|
622
|
+
export declare const SORT_DIRECTIONS: readonly ["asc", "desc"];
|
|
623
|
+
type SortDirection = (typeof SORT_DIRECTIONS)[number];
|
|
624
|
+
interface SortKey {
|
|
625
|
+
/** A detail field. */
|
|
626
|
+
readonly field: FieldRef;
|
|
627
|
+
readonly direction: SortDirection;
|
|
628
|
+
}
|
|
629
|
+
interface TableColumn {
|
|
630
|
+
/** Unique within its table. */
|
|
631
|
+
readonly id: string;
|
|
632
|
+
/** Its title in the header row, a literal; where every shown column's is empty or white space, the table has no header row (0078). */
|
|
633
|
+
readonly header: string;
|
|
634
|
+
readonly width: Width;
|
|
635
|
+
readonly align: Alignment;
|
|
636
|
+
/** Read once per detail row. */
|
|
637
|
+
readonly value: Inline;
|
|
638
|
+
/** Read once per report: a hidden column gives its width to the fill columns, and its footer cells hide with it. */
|
|
639
|
+
readonly visibleWhen?: Expression;
|
|
640
|
+
readonly style?: string;
|
|
641
|
+
/** Read once per detail row. */
|
|
642
|
+
readonly styleWhen?: readonly StyleRule[];
|
|
643
|
+
}
|
|
644
|
+
interface TableFooterCell {
|
|
645
|
+
/** A column id of the same table. */
|
|
646
|
+
readonly column: string;
|
|
647
|
+
readonly value: Inline;
|
|
648
|
+
}
|
|
649
|
+
/** A row under a group or under the table: a subtotal, a tax line, a total. One under the table is read in the `table` scope, where `table` totals the rows the table prints. */
|
|
650
|
+
interface TableFooterRow {
|
|
651
|
+
readonly cells: readonly TableFooterCell[];
|
|
652
|
+
readonly style?: string;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* One grouping level, the only one version 0 has. Rows are ordered by the
|
|
656
|
+
* group's key first, then by the table's sort keys; rows whose keys are all
|
|
657
|
+
* equal keep the order the provider gave them.
|
|
658
|
+
*/
|
|
659
|
+
interface TableGroup {
|
|
660
|
+
/** A detail field. */
|
|
661
|
+
readonly by: FieldRef;
|
|
662
|
+
readonly direction: SortDirection;
|
|
663
|
+
/** One line across the table, read once per group. */
|
|
664
|
+
readonly header: readonly Inline[];
|
|
665
|
+
readonly headerStyle?: string;
|
|
666
|
+
/**
|
|
667
|
+
* How many of the group's first rows its header is kept on its page
|
|
668
|
+
* with, from 1 to `MAX_KEEP_WITH_ROWS`; absent, one, the rule every group
|
|
669
|
+
* header has had. The group's own, so that each level of a later nesting
|
|
670
|
+
* states its own (0059).
|
|
671
|
+
*/
|
|
672
|
+
readonly keepWithRows?: number;
|
|
673
|
+
readonly footer: readonly TableFooterRow[];
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* A table over the report's one detail dataset. Its header repeats on every
|
|
677
|
+
* page it reaches; version 0 has no other choice. A table none of whose
|
|
678
|
+
* shown columns' titles prints anything has no header row (0078).
|
|
679
|
+
*/
|
|
680
|
+
interface TableComponent extends ComponentBase {
|
|
681
|
+
readonly kind: 'table';
|
|
682
|
+
readonly dataset: 'detail';
|
|
683
|
+
/**
|
|
684
|
+
* Read once per detail row, in its scope, in the provider's order and
|
|
685
|
+
* before anything is ordered: the table prints, orders, groups and
|
|
686
|
+
* totals the rows for which it holds. Absent, every row (0062).
|
|
687
|
+
*/
|
|
688
|
+
readonly rowsWhen?: Expression;
|
|
689
|
+
readonly columns: readonly TableColumn[];
|
|
690
|
+
readonly headerStyle?: string;
|
|
691
|
+
readonly sort?: readonly SortKey[];
|
|
692
|
+
readonly group?: TableGroup;
|
|
693
|
+
readonly totals?: readonly TableFooterRow[];
|
|
694
|
+
readonly emptyText: string;
|
|
695
|
+
readonly repeatHeader: true;
|
|
306
696
|
}
|
|
307
697
|
/** What every component has: a stable id, and optionally a condition and print styles. */
|
|
308
698
|
interface ComponentBase {
|
|
@@ -338,6 +728,26 @@ interface ImageComponent extends ComponentBase {
|
|
|
338
728
|
readonly height: number;
|
|
339
729
|
readonly fit: ImageFit;
|
|
340
730
|
}
|
|
731
|
+
/**
|
|
732
|
+
* How much of a QR code may be lost and its content still read: ISO/IEC
|
|
733
|
+
* 18004's four levels, which restore about 7, 15, 25 and 30 % of the
|
|
734
|
+
* codewords. A higher level holds less content in the same square.
|
|
735
|
+
*/
|
|
736
|
+
export declare const QR_ERROR_CORRECTION: readonly ["L", "M", "Q", "H"];
|
|
737
|
+
type QrErrorCorrection = (typeof QR_ERROR_CORRECTION)[number];
|
|
738
|
+
/**
|
|
739
|
+
* A QR code of the text its content prints, drawn as a square of fixed
|
|
740
|
+
* size. The content is read once, as a paragraph's in the same place is,
|
|
741
|
+
* and resolved whole before there are pages: it never holds a page number
|
|
742
|
+
* or count, in any region.
|
|
743
|
+
*/
|
|
744
|
+
interface QrCodeComponent extends ComponentBase {
|
|
745
|
+
readonly kind: 'qrCode';
|
|
746
|
+
readonly content: readonly Inline[];
|
|
747
|
+
/** The side of the square in points, the quiet zone around the modules included. */
|
|
748
|
+
readonly size: number;
|
|
749
|
+
readonly errorCorrection: QrErrorCorrection;
|
|
750
|
+
}
|
|
341
751
|
interface LineComponent extends ComponentBase {
|
|
342
752
|
readonly kind: 'line';
|
|
343
753
|
readonly thickness: number;
|
|
@@ -383,81 +793,478 @@ interface SectionComponent extends ComponentBase {
|
|
|
383
793
|
/** Points between the border and the content. */
|
|
384
794
|
readonly padding?: number;
|
|
385
795
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
interface SortKey {
|
|
389
|
-
/** A detail field. */
|
|
390
|
-
readonly field: FieldRef;
|
|
391
|
-
readonly direction: SortDirection;
|
|
392
|
-
}
|
|
393
|
-
interface TableColumn {
|
|
394
|
-
/** Unique within its table. */
|
|
395
|
-
readonly id: string;
|
|
396
|
-
readonly header: string;
|
|
397
|
-
readonly width: Width;
|
|
398
|
-
readonly align: Alignment;
|
|
399
|
-
/** Read once per detail row. */
|
|
400
|
-
readonly value: Inline;
|
|
401
|
-
/** Read once per report: a hidden column gives its width to the fill columns, and its footer cells hide with it. */
|
|
402
|
-
readonly visibleWhen?: Expression;
|
|
403
|
-
readonly style?: string;
|
|
404
|
-
/** Read once per detail row. */
|
|
405
|
-
readonly styleWhen?: readonly StyleRule[];
|
|
796
|
+
interface PageBreakComponent extends ComponentBase {
|
|
797
|
+
readonly kind: 'pageBreak';
|
|
406
798
|
}
|
|
407
|
-
interface
|
|
408
|
-
|
|
409
|
-
readonly
|
|
410
|
-
readonly value: Inline;
|
|
799
|
+
interface KeepTogetherComponent extends ComponentBase {
|
|
800
|
+
readonly kind: 'keepTogether';
|
|
801
|
+
readonly components: readonly Component[];
|
|
411
802
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
803
|
+
export declare const COMPONENT_KINDS: readonly ["text", "image", "qrCode", "epcQrCode", "line", "rectangle", "spacer", "columns", "section", "table", "chart", "pageBreak", "keepTogether"];
|
|
804
|
+
type ComponentKind = (typeof COMPONENT_KINDS)[number];
|
|
805
|
+
type Component = TextComponent | ImageComponent | QrCodeComponent | EpcQrCodeComponent | LineComponent | RectangleComponent | SpacerComponent | ColumnsComponent | SectionComponent | TableComponent | ChartComponent | PageBreakComponent | KeepTogetherComponent;
|
|
806
|
+
/** The kinds of e-invoice. A kind this version does not know is refused, never skipped. */
|
|
807
|
+
export declare const E_INVOICE_KINDS: readonly ["facturX", "xrechnung"];
|
|
808
|
+
type EInvoiceKind = (typeof E_INVOICE_KINDS)[number];
|
|
809
|
+
/** The XRechnung versions this version writes: 3.0, the major and minor version its BT-24 names, of which KoSIT's 3.0.2 is the release the e-invoice gate's configuration pins. 4.0 is not backward compatible, and waits. */
|
|
810
|
+
export declare const XRECHNUNG_VERSIONS: readonly ["3.0"];
|
|
811
|
+
type XRechnungVersion = (typeof XRECHNUNG_VERSIONS)[number];
|
|
812
|
+
/** What names each XRechnung version: its specification identifier (BT-24), the release of KoSIT's it is read from, and the syntax it is written in. */
|
|
813
|
+
interface XRechnungTerms {
|
|
814
|
+
/** BT-24: `XR-CIUS-ID` of KoSIT's XRechnung schematron, which its scenario `EN16931 XRechnung (CII)` matches the XML by. */
|
|
815
|
+
readonly guideline: string;
|
|
816
|
+
/** The release of KoSIT's XRechnung the gate's configuration pins (`docs/release/e-invoice-tools.json`), which the e-invoice gate holds it to on every run. */
|
|
817
|
+
readonly release: string;
|
|
818
|
+
/** CII, the one syntax the runtime writes: UBL, which KoSIT takes too, would be a second writer of one invoice (0027, 0038). */
|
|
819
|
+
readonly syntax: 'cii';
|
|
416
820
|
}
|
|
417
821
|
/**
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
822
|
+
* Each version's names. A table over every version, so a version added to
|
|
823
|
+
* `XRECHNUNG_VERSIONS` without them does not compile. BT-24 is
|
|
824
|
+
* `XR-CIUS-ID` as `resources/xrechnung/3.0.2/xsl/XRechnung-CII-validation.xsl`
|
|
825
|
+
* of KoSIT's configuration of 2026-08-31 builds it, read on 21 October
|
|
826
|
+
* 2026; the e-invoice gate holds it to that file on every run, and KoSIT
|
|
827
|
+
* matches the XRechnung sample to its scenario by it.
|
|
421
828
|
*/
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
829
|
+
export declare const XRECHNUNG: { readonly [V in XRechnungVersion]: XRechnungTerms; };
|
|
830
|
+
/** The Factur-X profiles this version writes: EN 16931 alone, which Germany counts as an e-invoice and FeRD recommends. */
|
|
831
|
+
export declare const E_INVOICE_PROFILES: readonly ["en16931"];
|
|
832
|
+
type EInvoiceProfile = (typeof E_INVOICE_PROFILES)[number];
|
|
833
|
+
/** The invoice type codes (BT-3, UNTDID 1001) this version writes: 380, a commercial invoice. No credit note yet. */
|
|
834
|
+
export declare const INVOICE_TYPE_CODES: readonly ["380"];
|
|
835
|
+
type InvoiceTypeCode = (typeof INVOICE_TYPE_CODES)[number];
|
|
836
|
+
/** The currencies (BT-5, ISO 4217) this version writes: EUR. A second would bring BT-6 and BT-111 with it. */
|
|
837
|
+
export declare const E_INVOICE_CURRENCIES: readonly ["EUR"];
|
|
838
|
+
type EInvoiceCurrency = (typeof E_INVOICE_CURRENCIES)[number];
|
|
839
|
+
/**
|
|
840
|
+
* The VAT categories (BT-118, BT-151; UNCL 5305) this version writes:
|
|
841
|
+
* standard rated, exempt from VAT, and reverse charge. CEN's BR-CL-17 and
|
|
842
|
+
* BR-CL-18 take seven more, Z, K, G, O, L, M and B, which wait.
|
|
843
|
+
*/
|
|
844
|
+
export declare const VAT_CATEGORY_CODES: readonly ["S", "E", "AE"];
|
|
845
|
+
type VatCategoryCode = (typeof VAT_CATEGORY_CODES)[number];
|
|
846
|
+
/** The payment means (BT-81, UNTDID 4461) this version writes: 58, a SEPA credit transfer, and 30, a credit transfer. */
|
|
847
|
+
export declare const PAYMENT_MEANS_CODES: readonly ["58", "30"];
|
|
848
|
+
type PaymentMeansCode = (typeof PAYMENT_MEANS_CODES)[number];
|
|
849
|
+
/**
|
|
850
|
+
* The units of measure (BT-130; UN/ECE Recommendation 20, revision 11e) a
|
|
851
|
+
* line's quantity may be in, and no other (BR-CL-23): the counted, time,
|
|
852
|
+
* mass, length, area, volume and energy units a German invoice is written
|
|
853
|
+
* in. CEN takes 2,162; the packaging codes of Recommendation 21 among them
|
|
854
|
+
* wait.
|
|
855
|
+
*/
|
|
856
|
+
export declare const UNIT_CODES: readonly ["C62", "H87", "SET", "PR", "LS", "MIN", "HUR", "DAY", "WEE", "MON", "ANN", "GRM", "KGM", "TNE", "MTR", "KMT", "MTK", "MTQ", "MLT", "LTR", "KWH"];
|
|
857
|
+
type UnitCode = (typeof UNIT_CODES)[number];
|
|
858
|
+
/**
|
|
859
|
+
* The countries (BT-40, BT-55; ISO 3166-1 alpha-2) a seller or a buyer may
|
|
860
|
+
* be in, and no other (BR-CL-14): the 27 member states of the EU, the EEA's
|
|
861
|
+
* Iceland, Liechtenstein and Norway, Switzerland, and the United Kingdom.
|
|
862
|
+
* CEN takes 251. Greece is GR here, and EL only as a VAT prefix.
|
|
863
|
+
*/
|
|
864
|
+
export declare const COUNTRY_CODES: readonly ["AT", "BE", "BG", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GR", "HR", "HU", "IE", "IT", "LT", "LU", "LV", "MT", "NL", "PL", "PT", "RO", "SE", "SI", "SK", "IS", "LI", "NO", "CH", "GB"];
|
|
865
|
+
type CountryCode = (typeof COUNTRY_CODES)[number];
|
|
866
|
+
/**
|
|
867
|
+
* The prefixes a VAT identifier (BT-31, BT-48) may begin with (BR-CO-09):
|
|
868
|
+
* a country of `COUNTRY_CODES`, or EL, which Greece writes its VAT
|
|
869
|
+
* identifiers with. BR-CO-09's message allows EL in both releases, but only
|
|
870
|
+
* 1.3.16's test, which the pinned validators run, holds it; 1.3.17's does
|
|
871
|
+
* not. EL is taken while the pinned oracle takes it, and the gate fails on
|
|
872
|
+
* the release that does not.
|
|
873
|
+
*/
|
|
874
|
+
export declare const VAT_PREFIXES: readonly string[];
|
|
875
|
+
/**
|
|
876
|
+
* The schemes (BT-30-1, BT-47-1; ISO 6523 ICD) a legal registration
|
|
877
|
+
* identifier may be given in, and no other (BR-CL-11). An identifier may be
|
|
878
|
+
* given without one, as a German commercial register number is. France's
|
|
879
|
+
* SIREN and SIRET, since a French buyer's SIREN is the one detail of
|
|
880
|
+
* France's the XML holds; and the two that name a company anywhere. CEN
|
|
881
|
+
* takes 246. The Leitweg-ID, 0204, which routes an invoice to a German
|
|
882
|
+
* public buyer, is no legal registration: an XRechnung names it as the
|
|
883
|
+
* buyer's reference (BT-10) and as an electronic address
|
|
884
|
+
* (`ADDRESS_SCHEMES`, 0038).
|
|
885
|
+
*/
|
|
886
|
+
export declare const SCHEME_IDS: readonly ["0002", "0009", "0060", "0088"];
|
|
887
|
+
type SchemeId = (typeof SCHEME_IDS)[number];
|
|
888
|
+
/**
|
|
889
|
+
* The schemes (BT-34-1, BT-49-1; the CEF's Electronic Address Scheme code
|
|
890
|
+
* list) an electronic address may be given in, and no other (BR-CL-25),
|
|
891
|
+
* each code found on 20 October 2026 in BR-CL-25's list of the CEN 1.3.16
|
|
892
|
+
* schematron KoSIT's configuration of 2026-08-31 runs and in list 17 of
|
|
893
|
+
* FeRD's code database in Mustang 2.26.0, which the e-invoice gate holds
|
|
894
|
+
* them to on every run (0037). CEN's list holds 104 codes and FeRD's 102,
|
|
895
|
+
* counted that day; these are the five a German or a French invoice is
|
|
896
|
+
* addressed by, their meanings as Peppol's EAS code list gives them:
|
|
897
|
+
*/
|
|
898
|
+
export declare const ADDRESS_SCHEMES: readonly ["EM", "0204", "0225", "9930", "0088"];
|
|
899
|
+
type AddressScheme = (typeof ADDRESS_SCHEMES)[number];
|
|
900
|
+
/** What names each profile, in the XML and in the PDF that carries it. */
|
|
901
|
+
interface FacturXProfileTerms {
|
|
902
|
+
/** The specification identifier (BT-24), which the XML opens with. */
|
|
903
|
+
readonly guideline: string;
|
|
904
|
+
/** The XMP's `fx:ConformanceLevel` [S]. */
|
|
905
|
+
readonly conformanceLevel: string;
|
|
906
|
+
/** The embedded file's `/AFRelationship` [S]. */
|
|
907
|
+
readonly relationship: 'Alternative';
|
|
430
908
|
}
|
|
431
|
-
/**
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
909
|
+
/**
|
|
910
|
+
* Each profile's names. A table over every profile, so a profile added to
|
|
911
|
+
* `E_INVOICE_PROFILES` without them does not compile.
|
|
912
|
+
* - BT-24 is the EN 16931 profile's identifier as the Factur-X 1.09.2
|
|
913
|
+
* schematron's code list 1 gives it (`FACTUR-X_EN16931_codedb.xml`, read
|
|
914
|
+
* in akretion's copy). Mustang refuses the old `urn:factur-x.eu:1p0:en16931`.
|
|
915
|
+
* - `Alternative` is Germany's relationship for EN 16931, and one of the
|
|
916
|
+
* three France allows [S].
|
|
917
|
+
*/
|
|
918
|
+
export declare const FACTUR_X_PROFILES: { readonly [P in EInvoiceProfile]: FacturXProfileTerms; };
|
|
919
|
+
/**
|
|
920
|
+
* The file a Factur-X PDF embeds, and the XMP that describes it [S]: the
|
|
921
|
+
* name, the media type, the fx extension's namespace (its trailing `#`
|
|
922
|
+
* required) and prefix, and the document type and the version it states.
|
|
923
|
+
* The namespace is the transcription's section 6.3.1; its BR-HYBRID-04
|
|
924
|
+
* gives it without `:invoice`, an inconsistency the transcription resolves
|
|
925
|
+
* for section 6.3.1, as akretion's generator and PDFlib's sample do (0031).
|
|
926
|
+
* No validator checks the namespace: Mustang reads the four properties by
|
|
927
|
+
* local name, and veraPDF checks only that the extension schema describes
|
|
928
|
+
* them. The renderer embeds what these say (0031), and its test holds the
|
|
929
|
+
* PDF to the transcription's values, written there and not read from here;
|
|
930
|
+
* the official package's XMP example, which would hold them to more, waits
|
|
931
|
+
* for a registration with FeRD nobody here has made.
|
|
932
|
+
*/
|
|
933
|
+
export declare const FACTUR_X: {
|
|
934
|
+
readonly fileName: "factur-x.xml";
|
|
935
|
+
readonly mediaType: "text/xml";
|
|
936
|
+
readonly xmpNamespace: "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#";
|
|
937
|
+
readonly xmpPrefix: "fx";
|
|
938
|
+
readonly documentType: "INVOICE";
|
|
939
|
+
readonly version: "1.0";
|
|
940
|
+
};
|
|
941
|
+
/**
|
|
942
|
+
* The names an expression reads in a report that is an e-invoice, beside
|
|
943
|
+
* `EXPRESSION_NAMES`'s, and in no other report (0027, an addition to
|
|
944
|
+
* 0007's names): `invoice` holds the document's totals (BG-22), and
|
|
945
|
+
* `vatBasis` and `vatAmount` each declared VAT category's taxable and tax
|
|
946
|
+
* amount (BG-23) by the category's id, null when no line is in it. The
|
|
947
|
+
* runtime computes each once, from the lines, for the page and the XML
|
|
948
|
+
* alike. They are read wherever `totals` is, except where they are
|
|
949
|
+
* computed from: an aggregate's expression, the e-invoice's own, and the
|
|
950
|
+
* columns that print a line's terms. The editing core refuses a read
|
|
951
|
+
* there, and in any other report.
|
|
952
|
+
*/
|
|
953
|
+
export declare const E_INVOICE_NAMES: readonly ["invoice", "vatBasis", "vatAmount"];
|
|
954
|
+
type EInvoiceName = (typeof E_INVOICE_NAMES)[number];
|
|
955
|
+
/**
|
|
956
|
+
* The members of `invoice`, each one of the document's totals (BG-22), as a
|
|
957
|
+
* refusal names it: every one a decimal of two places in the invoice's
|
|
958
|
+
* currency. With no allowances and no charges, the total without VAT is
|
|
959
|
+
* the sum of the lines. `paid` is a member only of an invoice that
|
|
960
|
+
* declares a paid amount, and is what that gives; with none, the amount
|
|
961
|
+
* due is the total with VAT.
|
|
962
|
+
*/
|
|
963
|
+
export declare const INVOICE_TOTALS: {
|
|
964
|
+
readonly lineTotal: "the sum of the invoice line net amounts (BT-106)";
|
|
965
|
+
readonly taxBasisTotal: "the invoice total amount without VAT (BT-109)";
|
|
966
|
+
readonly taxTotal: "the invoice total VAT amount (BT-110)";
|
|
967
|
+
readonly grandTotal: "the invoice total amount with VAT (BT-112)";
|
|
968
|
+
readonly paid: "the paid amount (BT-113)";
|
|
969
|
+
readonly duePayable: "the amount due for payment (BT-115)";
|
|
970
|
+
};
|
|
971
|
+
type InvoiceTotal = keyof typeof INVOICE_TOTALS;
|
|
972
|
+
/** What `vatBasis` and `vatAmount` hold of each declared category, as a refusal names it. */
|
|
973
|
+
export declare const VAT_BREAKDOWN: { readonly [N in Exclude<EInvoiceName, 'invoice'>]: string; };
|
|
974
|
+
/**
|
|
975
|
+
* A postal address (BG-5, BG-8): the first line, the post code, the city
|
|
976
|
+
* and the country are needed, the second line may be left out. Each is
|
|
977
|
+
* runs; the country is a code of `COUNTRY_CODES`.
|
|
978
|
+
*/
|
|
979
|
+
interface EInvoiceAddress {
|
|
980
|
+
readonly line1: readonly Inline[];
|
|
981
|
+
readonly line2?: readonly Inline[];
|
|
982
|
+
readonly postalCode: readonly Inline[];
|
|
983
|
+
readonly city: readonly Inline[];
|
|
984
|
+
readonly country: readonly Inline[];
|
|
442
985
|
}
|
|
443
|
-
|
|
444
|
-
|
|
986
|
+
/** A legal registration identifier (BT-30, BT-47), and the scheme it is given in, if one. */
|
|
987
|
+
interface LegalIdentifier {
|
|
988
|
+
readonly id: readonly Inline[];
|
|
989
|
+
readonly scheme?: SchemeId;
|
|
445
990
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
991
|
+
/**
|
|
992
|
+
* An electronic address (BT-34, BT-49), where the party is sent the
|
|
993
|
+
* invoice, and the scheme it is given in (BT-34-1, BT-49-1), which EN
|
|
994
|
+
* 16931 needs with it (BR-62, BR-63): a code of `ADDRESS_SCHEMES`.
|
|
995
|
+
*/
|
|
996
|
+
interface ElectronicAddress {
|
|
997
|
+
readonly id: readonly Inline[];
|
|
998
|
+
readonly scheme: AddressScheme;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* The seller's contact (BG-6): its contact point (BT-41), a person or a
|
|
1002
|
+
* department, its telephone number (BT-42) and its email address (BT-43).
|
|
1003
|
+
* EN 16931 lets each be left out; a contact here gives all three, as
|
|
1004
|
+
* XRechnung asks (BR-DE-5, -6, -7), so that one contact serves either.
|
|
1005
|
+
*/
|
|
1006
|
+
interface SellerContact {
|
|
1007
|
+
readonly name: readonly Inline[];
|
|
1008
|
+
readonly telephone: readonly Inline[];
|
|
1009
|
+
readonly email: readonly Inline[];
|
|
1010
|
+
}
|
|
1011
|
+
/** The seller (BG-4): its name (BT-27), its VAT identifier (BT-31), its tax number (BT-32), its legal registration (BT-30), its electronic address (BT-34), its contact (BG-6) and its address (BG-5). */
|
|
1012
|
+
interface EInvoiceSeller {
|
|
1013
|
+
readonly name: readonly Inline[];
|
|
1014
|
+
readonly vatId?: readonly Inline[];
|
|
1015
|
+
readonly taxNumber?: readonly Inline[];
|
|
1016
|
+
readonly legalId?: LegalIdentifier;
|
|
1017
|
+
readonly electronicAddress?: ElectronicAddress;
|
|
1018
|
+
readonly contact?: SellerContact;
|
|
1019
|
+
readonly address: EInvoiceAddress;
|
|
1020
|
+
}
|
|
1021
|
+
/** The buyer (BG-7): its name (BT-44), its VAT identifier (BT-48), its legal registration (BT-47), its electronic address (BT-49) and its address (BG-8). A buyer has no BT-32, and its contact (BG-9) is not written. */
|
|
1022
|
+
interface EInvoiceBuyer {
|
|
1023
|
+
readonly name: readonly Inline[];
|
|
1024
|
+
readonly vatId?: readonly Inline[];
|
|
1025
|
+
readonly legalId?: LegalIdentifier;
|
|
1026
|
+
readonly electronicAddress?: ElectronicAddress;
|
|
1027
|
+
readonly address: EInvoiceAddress;
|
|
449
1028
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
1029
|
+
/**
|
|
1030
|
+
* A VAT category the invoice's lines are in, one VAT breakdown (BG-23) each
|
|
1031
|
+
* when a line uses it.
|
|
1032
|
+
*/
|
|
1033
|
+
interface VatCategory {
|
|
1034
|
+
/** A field key: what the page reads its basis and its amount as, `vatBasis.<id>` and `vatAmount.<id>`, and what a line names it by. */
|
|
1035
|
+
readonly id: string;
|
|
1036
|
+
readonly code: VatCategoryCode;
|
|
1037
|
+
/** The rate in per cent (BT-119, BT-152), an exact decimal: more than 0 when standard rated, 0 otherwise. */
|
|
1038
|
+
readonly rate: string;
|
|
1039
|
+
/** The exemption reason (BT-120): needed for E and AE, never for S. */
|
|
1040
|
+
readonly reason?: readonly Inline[];
|
|
1041
|
+
}
|
|
1042
|
+
/** The invoicing period (BG-14): its start (BT-73), its end (BT-74), or both. */
|
|
1043
|
+
interface InvoicingPeriod {
|
|
1044
|
+
readonly start?: Expression;
|
|
1045
|
+
readonly end?: Expression;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* The lines (BG-25), one per row of the table over the detail dataset. The
|
|
1049
|
+
* name, the quantity, the net price and the net amount are column ids of
|
|
1050
|
+
* that table: what each column prints, once per row, is what the line
|
|
1051
|
+
* holds. The identifier, the unit and the VAT category are read from each
|
|
1052
|
+
* row, as an aggregate reads it.
|
|
1053
|
+
*/
|
|
1054
|
+
interface EInvoiceLines {
|
|
1055
|
+
/** The id of the table over the detail dataset. */
|
|
1056
|
+
readonly table: string;
|
|
1057
|
+
/** The column that prints the item name (BT-153). */
|
|
1058
|
+
readonly name: string;
|
|
1059
|
+
/** The column that prints the invoiced quantity (BT-129). */
|
|
1060
|
+
readonly quantity: string;
|
|
1061
|
+
/** The column that prints the item net price (BT-146). */
|
|
1062
|
+
readonly netPrice: string;
|
|
1063
|
+
/** The column that prints the line net amount (BT-131), a whole number of cents. */
|
|
1064
|
+
readonly netAmount: string;
|
|
1065
|
+
/** The line identifier (BT-126). */
|
|
1066
|
+
readonly id: RowValue;
|
|
1067
|
+
/** The unit of measure (BT-130), a code of `UNIT_CODES`. */
|
|
1068
|
+
readonly unit: RowValue;
|
|
1069
|
+
/** The id of the line's VAT category (BT-151, BT-152): one the invoice declares. */
|
|
1070
|
+
readonly vat: RowValue;
|
|
1071
|
+
}
|
|
1072
|
+
/** The payment instructions (BG-16): how the invoice is paid, and to which account. */
|
|
1073
|
+
interface PaymentInstructions {
|
|
1074
|
+
/** BT-81. */
|
|
1075
|
+
readonly means: PaymentMeansCode;
|
|
1076
|
+
/** The payment account (BT-84): an IBAN. Spaces are for reading, and are dropped. */
|
|
1077
|
+
readonly iban: readonly Inline[];
|
|
1078
|
+
/** The BIC of the account's bank (BT-86). */
|
|
1079
|
+
readonly bic?: readonly Inline[];
|
|
1080
|
+
/** The account's name (BT-85). */
|
|
1081
|
+
readonly accountName?: readonly Inline[];
|
|
1082
|
+
/** The remittance information (BT-83): what a payer writes on the transfer. */
|
|
1083
|
+
readonly remittance?: readonly Inline[];
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* What an invoice of either kind holds: EN 16931's terms, as 0027 and 0037
|
|
1087
|
+
* give them. Each text is runs, one at least where it is present; an
|
|
1088
|
+
* optional one absent is a term the XML leaves out, never an empty list of
|
|
1089
|
+
* runs, so that one invoice has one spelling and one hash. Each expression
|
|
1090
|
+
* is compiled and typed by the editing core: the dates are dates, the paid
|
|
1091
|
+
* amount a decimal.
|
|
1092
|
+
*/
|
|
1093
|
+
interface EInvoiceTerms {
|
|
1094
|
+
/** BT-3. */
|
|
1095
|
+
readonly type: InvoiceTypeCode;
|
|
1096
|
+
/** BT-5. */
|
|
1097
|
+
readonly currency: EInvoiceCurrency;
|
|
1098
|
+
/** The invoice number (BT-1). */
|
|
1099
|
+
readonly number: readonly Inline[];
|
|
1100
|
+
/** The issue date (BT-2). */
|
|
1101
|
+
readonly issued: Expression;
|
|
1102
|
+
/** The business process (BT-23): the context the buyer's system routes the invoice in, an identifier such as Peppol's `urn:fdc:peppol.eu:2017:poacc:billing:01:1.0`. */
|
|
1103
|
+
readonly businessProcess?: readonly Inline[];
|
|
1104
|
+
readonly seller: EInvoiceSeller;
|
|
1105
|
+
readonly buyer: EInvoiceBuyer;
|
|
1106
|
+
/** The buyer's reference (BT-10). */
|
|
1107
|
+
readonly buyerReference?: readonly Inline[];
|
|
1108
|
+
/** The actual delivery date (BT-72). A delivery date, a period or both: a German invoice says when it was supplied. */
|
|
1109
|
+
readonly delivered?: Expression;
|
|
1110
|
+
readonly period?: InvoicingPeriod;
|
|
1111
|
+
/** The VAT categories its lines may be in, one at least. */
|
|
1112
|
+
readonly vat: readonly VatCategory[];
|
|
1113
|
+
readonly lines: EInvoiceLines;
|
|
1114
|
+
readonly payment?: PaymentInstructions;
|
|
1115
|
+
/** The payment due date (BT-9). */
|
|
1116
|
+
readonly due?: Expression;
|
|
1117
|
+
/** The payment terms (BT-20), where a Skonto is written. */
|
|
1118
|
+
readonly terms?: readonly Inline[];
|
|
1119
|
+
/** The amount already paid (BT-113), a whole number of cents. */
|
|
1120
|
+
readonly paid?: Expression;
|
|
1121
|
+
}
|
|
1122
|
+
/** A Factur-X invoice in the EN 16931 profile: the hybrid whose XML a PDF/A-3b embeds (0031). */
|
|
1123
|
+
interface FacturXInvoice extends EInvoiceTerms {
|
|
1124
|
+
readonly kind: 'facturX';
|
|
1125
|
+
readonly profile: EInvoiceProfile;
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* An XRechnung (0038): EN 16931's terms in KoSIT's CIUS, written as CII,
|
|
1129
|
+
* with what its schematron needs past EN 16931 -- the business process
|
|
1130
|
+
* (PEPPOL-EN16931-R001), the buyer's reference (BR-DE-15), the payment
|
|
1131
|
+
* instructions (BR-DE-1), the seller's contact (BR-DE-2) and both
|
|
1132
|
+
* electronic addresses (PEPPOL-EN16931-R020, -R010) -- each needed here.
|
|
1133
|
+
* Its XML is the invoice; a PDF of it is a copy, and says so on every page.
|
|
1134
|
+
*/
|
|
1135
|
+
interface XRechnungInvoice extends EInvoiceTerms {
|
|
1136
|
+
readonly kind: 'xrechnung';
|
|
1137
|
+
readonly version: XRechnungVersion;
|
|
1138
|
+
readonly businessProcess: readonly Inline[];
|
|
1139
|
+
readonly seller: EInvoiceSeller & {
|
|
1140
|
+
readonly electronicAddress: ElectronicAddress;
|
|
1141
|
+
readonly contact: SellerContact;
|
|
1142
|
+
};
|
|
1143
|
+
readonly buyer: EInvoiceBuyer & {
|
|
1144
|
+
readonly electronicAddress: ElectronicAddress;
|
|
1145
|
+
};
|
|
1146
|
+
/** A public buyer's Leitweg-ID, or the reference a business buyer asks for. */
|
|
1147
|
+
readonly buyerReference: readonly Inline[];
|
|
1148
|
+
readonly payment: PaymentInstructions;
|
|
1149
|
+
}
|
|
1150
|
+
type EInvoice = FacturXInvoice | XRechnungInvoice;
|
|
1151
|
+
/**
|
|
1152
|
+
* The languages a QR-bill's headings may be printed in: German, French,
|
|
1153
|
+
* Italian, English, and Romansh since 1 January 2026 (IG 2.4, Annex C). A
|
|
1154
|
+
* report in any other language prints its slip in one of these.
|
|
1155
|
+
*/
|
|
1156
|
+
export declare const QR_BILL_LANGUAGES: readonly ["de", "fr", "it", "en", "rm"];
|
|
1157
|
+
type QrBillLanguage = (typeof QR_BILL_LANGUAGES)[number];
|
|
1158
|
+
/** The currencies a QR-bill pays in, and the only ones (IG Table 8, Ccy). */
|
|
1159
|
+
export declare const QR_BILL_CURRENCIES: readonly ["CHF", "EUR"];
|
|
1160
|
+
type QrBillCurrency = (typeof QR_BILL_CURRENCIES)[number];
|
|
1161
|
+
/**
|
|
1162
|
+
* A party's address, structured: the one address type SIX has taken since
|
|
1163
|
+
* version 2.3 removed the combined one. Each part is runs of text; what
|
|
1164
|
+
* each may hold is `QR_BILL_ADDRESS_RULES`.
|
|
1165
|
+
*/
|
|
1166
|
+
interface QrBillAddress {
|
|
1167
|
+
/** A person's first and last name, or a company's: 70 characters. */
|
|
1168
|
+
readonly name: readonly Inline[];
|
|
1169
|
+
/** The street or post office box, without the building number: 70 characters. */
|
|
1170
|
+
readonly street?: readonly Inline[];
|
|
1171
|
+
readonly buildingNumber?: readonly Inline[];
|
|
1172
|
+
/** Without a country prefix. */
|
|
1173
|
+
readonly postalCode: readonly Inline[];
|
|
1174
|
+
readonly town: readonly Inline[];
|
|
1175
|
+
/** ISO 3166-1's two capital letters: CH. */
|
|
1176
|
+
readonly country: readonly Inline[];
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* A Swiss QR-bill. Each text is runs, one at least where it is present; an
|
|
1180
|
+
* optional one absent is a field the bill leaves empty, never an empty
|
|
1181
|
+
* list of runs, so that one bill has one spelling and one hash.
|
|
1182
|
+
*/
|
|
1183
|
+
interface SwissQrBill {
|
|
1184
|
+
readonly kind: 'swissQrBill';
|
|
1185
|
+
/** The language of the slip's headings, which may differ from the report's. */
|
|
1186
|
+
readonly language: QrBillLanguage;
|
|
1187
|
+
/** The creditor's IBAN or QR-IBAN, of Switzerland or Liechtenstein. Spaces are for reading, and are dropped. */
|
|
1188
|
+
readonly account: readonly Inline[];
|
|
1189
|
+
readonly creditor: QrBillAddress;
|
|
1190
|
+
readonly currency: QrBillCurrency;
|
|
1191
|
+
/** A decimal of at most two places. Absent, or null, leaves the amount for the payer to fill in. */
|
|
1192
|
+
readonly amount?: Expression;
|
|
1193
|
+
/** Who pays. Absent leaves a field for the payer's name and address. */
|
|
1194
|
+
readonly debtor?: QrBillAddress;
|
|
1195
|
+
/** A QR reference, with a QR-IBAN, or a creditor reference, with an IBAN. Absent, the bill has none. */
|
|
1196
|
+
readonly reference?: readonly Inline[];
|
|
1197
|
+
/** The unstructured message: what the payment is for. */
|
|
1198
|
+
readonly message?: readonly Inline[];
|
|
1199
|
+
/** Coded information for the payer's software, beginning with `//`. */
|
|
1200
|
+
readonly billingInformation?: readonly Inline[];
|
|
1201
|
+
}
|
|
1202
|
+
/** The kinds of payment part. A kind this version does not know is refused, never skipped. */
|
|
1203
|
+
export declare const PAYMENT_PART_KINDS: readonly ["swissQrBill"];
|
|
1204
|
+
type PaymentPartKind = (typeof PAYMENT_PART_KINDS)[number];
|
|
1205
|
+
type PaymentPart = SwissQrBill;
|
|
1206
|
+
/** A word of the report, exactly as it stands in the report's own language, and what prints for it in a translation's. */
|
|
1207
|
+
interface TranslatedWord {
|
|
1208
|
+
readonly word: string;
|
|
1209
|
+
readonly text: string;
|
|
1210
|
+
}
|
|
1211
|
+
/** An expression that prints words, by its source exactly, and the expression that prints in its place in a translation's language. */
|
|
1212
|
+
interface TranslatedExpression {
|
|
1213
|
+
readonly cel: string;
|
|
1214
|
+
readonly expression: Expression;
|
|
1215
|
+
}
|
|
1216
|
+
/** The report's words in one language besides its own. */
|
|
1217
|
+
interface Translation {
|
|
1218
|
+
/** A BCP 47 tag, written as the report's `locale` is; never the report's own. */
|
|
1219
|
+
readonly locale: string;
|
|
1220
|
+
/** Each word once; a language just added holds none yet. */
|
|
1221
|
+
readonly words: readonly TranslatedWord[];
|
|
1222
|
+
readonly expressions: readonly TranslatedExpression[];
|
|
1223
|
+
}
|
|
1224
|
+
/** A literal string where a word stands, and where it is. */
|
|
1225
|
+
interface WordPlace {
|
|
1226
|
+
/** The JSON Pointer to the string: a run's `text`, a column's `header`, the report's `title`. */
|
|
1227
|
+
readonly path: string;
|
|
1228
|
+
readonly text: string;
|
|
1229
|
+
/** The innermost component it stands in; none for the title or the payment part's message. */
|
|
1230
|
+
readonly componentId?: string;
|
|
1231
|
+
/** For a table column's header and its value, the column's id. */
|
|
1232
|
+
readonly columnId?: string;
|
|
1233
|
+
}
|
|
1234
|
+
/** An expression run where a word stands: a word where it prints text and its source holds a quote, which only the core can tell (0063). */
|
|
1235
|
+
interface WordExpressionSite {
|
|
1236
|
+
/** The JSON Pointer to the expression's `cel`, as report-core names the site it compiles. */
|
|
1237
|
+
readonly path: string;
|
|
1238
|
+
readonly cel: string;
|
|
1239
|
+
readonly componentId?: string;
|
|
1240
|
+
readonly columnId?: string;
|
|
1241
|
+
}
|
|
1242
|
+
/** Whether `text` is a word: whether it holds a letter, of any script. A separator, a number or a sign prints as written in every language. */
|
|
1243
|
+
export declare function isWord(text: string): boolean;
|
|
1244
|
+
/** Every word of `report`, at each place it stands, in document order: a word in several places is yielded at each. */
|
|
1245
|
+
export declare function reportWords(report: ReportDefinition): readonly WordPlace[];
|
|
1246
|
+
/** Every expression run where a word stands, in document order: report-core says which of them print words. */
|
|
1247
|
+
export declare function wordExpressionSites(report: ReportDefinition): readonly WordExpressionSite[];
|
|
453
1248
|
/**
|
|
454
1249
|
* The report's regions, in the order a reader meets them. The body is flow
|
|
455
1250
|
* only in version 0: ordered blocks, so a growing table pushes what follows
|
|
456
1251
|
* down. Positioned elements in the page regions are deferred.
|
|
1252
|
+
*
|
|
1253
|
+
* The first page header stands beside the header it replaces: page 1
|
|
1254
|
+
* prints it in place of the page header, which then prints from page 2 on
|
|
1255
|
+
* ([0060](../../../docs/decisions/0060-a-reports-first-page-may-print-a-header-of-its-own-or-none-in-place-of-the-page-header.md)).
|
|
457
1256
|
*/
|
|
458
|
-
export declare const REGION_NAMES: readonly ["reportHeader", "pageHeader", "body", "pageFooter", "summary"];
|
|
1257
|
+
export declare const REGION_NAMES: readonly ["reportHeader", "firstPageHeader", "pageHeader", "body", "pageFooter", "summary"];
|
|
459
1258
|
type RegionName = (typeof REGION_NAMES)[number];
|
|
460
|
-
|
|
1259
|
+
/**
|
|
1260
|
+
* The regions a report may leave out, and what leaving one out means: the
|
|
1261
|
+
* first page header absent, page 1 prints the page header as every page
|
|
1262
|
+
* does; present and empty, page 1 prints no header (0060). Every other
|
|
1263
|
+
* region every report holds.
|
|
1264
|
+
*/
|
|
1265
|
+
export declare const OPTIONAL_REGIONS: readonly ["firstPageHeader"];
|
|
1266
|
+
type OptionalRegionName = (typeof OPTIONAL_REGIONS)[number];
|
|
1267
|
+
type Regions = { readonly [R in Exclude<RegionName, OptionalRegionName>]: readonly Component[]; } & { readonly [R in OptionalRegionName]?: readonly Component[]; };
|
|
461
1268
|
export declare const PROVENANCE_KINDS: readonly ["blank", "form", "dataset"];
|
|
462
1269
|
type ProvenanceKind = (typeof PROVENANCE_KINDS)[number];
|
|
463
1270
|
/**
|
|
@@ -480,7 +1287,7 @@ interface ReportDefinition {
|
|
|
480
1287
|
readonly reportSpecVersion: typeof REPORT_SPEC_VERSION;
|
|
481
1288
|
readonly id: string;
|
|
482
1289
|
readonly title: string;
|
|
483
|
-
/** A BCP 47 tag: language, optional script, optional region. */
|
|
1290
|
+
/** A BCP 47 tag: language, optional script, optional region. The report's own language: the one its words are written in, and the one a render that names none prints in (0063). */
|
|
484
1291
|
readonly locale: string;
|
|
485
1292
|
readonly page: PageSettings;
|
|
486
1293
|
readonly styles: readonly PrintStyle[];
|
|
@@ -488,11 +1295,885 @@ interface ReportDefinition {
|
|
|
488
1295
|
readonly parameters: readonly ParameterDef[];
|
|
489
1296
|
readonly assets: readonly AssetRef[];
|
|
490
1297
|
readonly aggregates: readonly AggregateDef[];
|
|
1298
|
+
/** Which font assets each font token prints in, face by face; absent, and a token left out, the renderer prints that token in its own face (0043). */
|
|
1299
|
+
readonly fonts?: FontMap;
|
|
491
1300
|
readonly regions: Regions;
|
|
1301
|
+
/** A slip to pay the report by, printed at the foot of its last page: a Swiss QR-bill. Absent, the report has none. */
|
|
1302
|
+
readonly paymentPart?: PaymentPart;
|
|
1303
|
+
/** The EN 16931 invoice the report is, written as Factur-X from what its page prints. Absent, the report is none. */
|
|
1304
|
+
readonly eInvoice?: EInvoice;
|
|
492
1305
|
readonly provenance?: Provenance;
|
|
1306
|
+
/**
|
|
1307
|
+
* The report's words in each language besides its own, one translation
|
|
1308
|
+
* a language, each word looked up by its exact text in the report's own
|
|
1309
|
+
* (0063). Absent, the report is written in its own language alone; never
|
|
1310
|
+
* an empty list.
|
|
1311
|
+
*/
|
|
1312
|
+
readonly translations?: readonly Translation[];
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* What every payment code a report prints shares: ISO 7064's check modulo
|
|
1316
|
+
* 97, which ISO 13616 checks an IBAN with and ISO 11649 a creditor
|
|
1317
|
+
* reference, and a Leitweg-ID's check digits are computed by; the
|
|
1318
|
+
* creditor reference itself; and what a check says.
|
|
1319
|
+
*
|
|
1320
|
+
* One check, read by the QR-bill's rules (`qr-bill.ts`) and the EPC QR
|
|
1321
|
+
* code's (`epc-payload.ts`): two copies could disagree about which account
|
|
1322
|
+
* is typed right, and nobody would find out until a bank refused a payment.
|
|
1323
|
+
* What only one code allows -- the QR-bill's accounts of Switzerland and
|
|
1324
|
+
* Liechtenstein, its QR reference, the EPC's countries of SEPA -- stays
|
|
1325
|
+
* with that code's rules.
|
|
1326
|
+
*
|
|
1327
|
+
* A rule broken is said without the value that broke it: an IBAN or a
|
|
1328
|
+
* reference may be a person's.
|
|
1329
|
+
*/
|
|
1330
|
+
/** What a check made of a text it accepts, or the rule the text breaks. */
|
|
1331
|
+
type PaymentCheck<T> = {
|
|
1332
|
+
readonly ok: true;
|
|
1333
|
+
readonly value: T;
|
|
1334
|
+
} | {
|
|
1335
|
+
readonly ok: false;
|
|
1336
|
+
readonly rule: string;
|
|
1337
|
+
};
|
|
1338
|
+
/** What a check made of a text it accepts, or the rule the text breaks: every payment code's `PaymentCheck`. */
|
|
1339
|
+
type QrBillCheck<T> = PaymentCheck<T>;
|
|
1340
|
+
/**
|
|
1341
|
+
* The slip: the receipt and the payment part, 210 by 105 mm (IG 3.1),
|
|
1342
|
+
* across the foot of an A4 page in portrait. The builders' band and the
|
|
1343
|
+
* renderer's slip are this size.
|
|
1344
|
+
*/
|
|
1345
|
+
export declare const QR_BILL_SIZE: PageDimensions;
|
|
1346
|
+
/**
|
|
1347
|
+
* How far down its page the slip starts, in points from the paper's top:
|
|
1348
|
+
* 105 mm above the foot of the A4 page (IG 3.1), stored as every length
|
|
1349
|
+
* is. The renderer draws the slip from here, and `qrBillPageBreak` keeps
|
|
1350
|
+
* what the page prints above it out of it.
|
|
1351
|
+
*/
|
|
1352
|
+
export declare const QR_BILL_TOP: number;
|
|
1353
|
+
/** A rule a page breaks by carrying a QR-bill, and what it is said of: the page's size and orientation, or its top margin. */
|
|
1354
|
+
interface QrBillPageBreak {
|
|
1355
|
+
readonly field: 'page' | 'topMargin';
|
|
1356
|
+
readonly rule: string;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* The rule `page` breaks by carrying a QR-bill's slip, or undefined. The
|
|
1360
|
+
* slip is printed across the foot of an A4 page in portrait (IG 3.1), and
|
|
1361
|
+
* what the page prints above it ends at its top, `QR_BILL_TOP`: the page
|
|
1362
|
+
* header and the body, which start at the top margin. The page footer
|
|
1363
|
+
* never meets it: the slip stands in its place on the last page, and the
|
|
1364
|
+
* footers of the pages before it are on pages of their own.
|
|
1365
|
+
*
|
|
1366
|
+
* `above` is what stands between the top margin and the slip that only a
|
|
1367
|
+
* render measures: the page header's height, and the instruction to
|
|
1368
|
+
* separate that a PDF prints over the slip's top line (IG 3.7). The
|
|
1369
|
+
* validator knows neither and passes none, so it refuses what the top
|
|
1370
|
+
* margin alone decides; the renderer passes both, and the same rule
|
|
1371
|
+
* refuses the rest. One rule, so that where the slip starts and what
|
|
1372
|
+
* reaching into it is are decided once.
|
|
1373
|
+
*/
|
|
1374
|
+
export declare function qrBillPageBreak(page: PageSettings, above?: number): QrBillPageBreak | undefined;
|
|
1375
|
+
interface QrBillAccount {
|
|
1376
|
+
/** The IBAN as the code holds it: 21 characters, no spaces. */
|
|
1377
|
+
readonly iban: string;
|
|
1378
|
+
/** Whether its institution is a QR-IID, so that it is paid to with a QR reference. */
|
|
1379
|
+
readonly qrIban: boolean;
|
|
1380
|
+
}
|
|
1381
|
+
/** The account: an IBAN or a QR-IBAN of Switzerland or Liechtenstein (IG Table 8, IBAN), its spaces dropped. */
|
|
1382
|
+
export declare function checkQrBillAccount(text: string): QrBillCheck<QrBillAccount>;
|
|
1383
|
+
/**
|
|
1384
|
+
* The accounts of SIX's examples (IG 2.4, Annex A: examples 1, 2 and 3,
|
|
1385
|
+
* and 4, 5 and 6, which share one), as the code holds them: two QR-IBANs
|
|
1386
|
+
* and two IBANs. SIX publishes them to test with, and they are no
|
|
1387
|
+
* creditor's: a bill that pays one never reaches the creditor it names. A
|
|
1388
|
+
* new bill in a builder starts from example 3's, and report-core warns of
|
|
1389
|
+
* a bill whose account, written in the report, is one of these (0039).
|
|
1390
|
+
*/
|
|
1391
|
+
export declare const QR_BILL_EXAMPLE_ACCOUNTS: readonly ["CH6431961000004421557", "CH4431999123000889012", "CH5204835012345671000", "CH5800791123000889012"];
|
|
1392
|
+
/**
|
|
1393
|
+
* What a builder starts a bill from, SIX's own example values (IG 2.4,
|
|
1394
|
+
* Annex A), as SIX prints them: example 3's account and creditor (Table
|
|
1395
|
+
* 19), the bill a builder adds, with no amount, debtor or reference;
|
|
1396
|
+
* example 1's debtor (Table 17), the debtor it adds; and example 1's QR
|
|
1397
|
+
* reference, which it gives a bill whose account is made a QR-IBAN, as a
|
|
1398
|
+
* QR-IBAN is paid to with nothing else. They are no one's, and
|
|
1399
|
+
* report-core warns of a bill that holds one of them, written in the
|
|
1400
|
+
* report, as it warns of an example account (0039): one list, so that
|
|
1401
|
+
* what a builder puts in and what is warned of cannot drift apart.
|
|
1402
|
+
*/
|
|
1403
|
+
export declare const QR_BILL_EXAMPLE: {
|
|
1404
|
+
readonly account: "CH52 0483 5012 3456 7100 0";
|
|
1405
|
+
readonly creditor: {
|
|
1406
|
+
readonly name: "Muster Stiftung (sample foundation)";
|
|
1407
|
+
readonly street: "P.O. box";
|
|
1408
|
+
readonly postalCode: "3001";
|
|
1409
|
+
readonly town: "Bern";
|
|
1410
|
+
readonly country: "CH";
|
|
1411
|
+
};
|
|
1412
|
+
readonly debtor: {
|
|
1413
|
+
readonly name: "Simon Muster";
|
|
1414
|
+
readonly street: "Musterstrasse";
|
|
1415
|
+
readonly buildingNumber: "1";
|
|
1416
|
+
readonly postalCode: "8000";
|
|
1417
|
+
readonly town: "Seldwyla";
|
|
1418
|
+
readonly country: "CH";
|
|
1419
|
+
};
|
|
1420
|
+
readonly reference: "00 00082 07791 22585 74212 86694";
|
|
1421
|
+
};
|
|
1422
|
+
/** The kinds of reference a bill holds (IG Table 8, Tp): a QR reference, a creditor reference, or none. */
|
|
1423
|
+
type QrBillReferenceType = 'QRR' | 'SCOR' | 'NON';
|
|
1424
|
+
interface QrBillReference {
|
|
1425
|
+
readonly type: 'QRR' | 'SCOR';
|
|
1426
|
+
/** The reference as the code holds it: no spaces, in the case it was written. */
|
|
1427
|
+
readonly reference: string;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* The reference: a QR reference of 27 digits, the last its check digit
|
|
1431
|
+
* (IG 2.12.1, Annex B), or a creditor reference (IG Table 8, Ref), its
|
|
1432
|
+
* spaces dropped.
|
|
1433
|
+
*/
|
|
1434
|
+
export declare function checkQrBillReference(text: string): QrBillCheck<QrBillReference>;
|
|
1435
|
+
/** What a text of the bill may hold: whether it must, how many characters, and a syntax it must have when it is not empty. */
|
|
1436
|
+
interface QrBillTextRule {
|
|
1437
|
+
/** What a person calls it, for a message: "postal code". */
|
|
1438
|
+
readonly said: string;
|
|
1439
|
+
readonly required: boolean;
|
|
1440
|
+
/** Characters, as SIX counts them: every character it allows is one UTF-16 unit. */
|
|
1441
|
+
readonly max: number;
|
|
1442
|
+
readonly syntax?: {
|
|
1443
|
+
readonly pattern: RegExp;
|
|
1444
|
+
readonly rule: string;
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Each part of an address, in the order the code holds them, with what it
|
|
1449
|
+
* may hold (IG Table 8, Cdtr and UltmtDbtr). The name, the postal code,
|
|
1450
|
+
* the town and the country "must be filled in" (IG 4.3.1). A table over
|
|
1451
|
+
* every part, so a part added to `QrBillAddress` without its rule does not
|
|
1452
|
+
* compile, and what reads an address reads it in this order.
|
|
1453
|
+
*/
|
|
1454
|
+
export declare const QR_BILL_ADDRESS_RULES: { readonly [P in keyof QrBillAddress]-?: QrBillTextRule; };
|
|
1455
|
+
/** The most characters the message and the billing information hold together (IG Table 8, AddInf). */
|
|
1456
|
+
export declare const MAX_QR_BILL_ADDITIONAL_INFORMATION = 140;
|
|
1457
|
+
/** The unstructured message (IG Table 8, Ustrd). */
|
|
1458
|
+
export declare const QR_BILL_MESSAGE_RULE: QrBillTextRule;
|
|
1459
|
+
/**
|
|
1460
|
+
* The billing information (IG Table 8, StrdBkgInf; 4.3.3): it begins with
|
|
1461
|
+
* `//` and the two letters or digits that name its syntax, as SIX's own,
|
|
1462
|
+
* `S1`. What follows is the syntax's, which SIX does not standardise.
|
|
1463
|
+
*/
|
|
1464
|
+
export declare const QR_BILL_BILLING_RULE: QrBillTextRule;
|
|
1465
|
+
/**
|
|
1466
|
+
* A text of the bill, without the blanks around it, which SIX never sends
|
|
1467
|
+
* (IG 4.1.3), checked against `rule` and the characters SIX allows. The
|
|
1468
|
+
* first character outside them is named by its position in the text as
|
|
1469
|
+
* written, counted in characters from 1, and never quoted.
|
|
1470
|
+
*/
|
|
1471
|
+
export declare function checkQrBillText(text: string, rule: QrBillTextRule): QrBillCheck<string>;
|
|
1472
|
+
/** The rule the message and the billing information break together, each already checked on its own, or undefined. */
|
|
1473
|
+
export declare function checkQrBillAdditionalInformation(message: string, billingInformation: string): string | undefined;
|
|
1474
|
+
/** A rule an account, a reference and a currency break together, and the field it is reported on. */
|
|
1475
|
+
interface QrBillPairingBreak {
|
|
1476
|
+
readonly field: 'reference' | 'currency';
|
|
1477
|
+
readonly rule: string;
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* The rules an account, a reference and a currency break together. A
|
|
1481
|
+
* QR-IBAN is paid to with a QR reference and nothing else; a QR reference
|
|
1482
|
+
* only to a QR-IBAN (IG Table 8, Tp); and from version 2.4 both are for
|
|
1483
|
+
* CHF only (IG 2.4, 2.10). An account or a reference that is not known --
|
|
1484
|
+
* read from data, before a render -- is undefined, and nothing is said of
|
|
1485
|
+
* it.
|
|
1486
|
+
*/
|
|
1487
|
+
export declare function qrBillPairing(account: 'iban' | 'qrIban' | undefined, reference: QrBillReferenceType | undefined, currency: QrBillCurrency): readonly QrBillPairingBreak[];
|
|
1488
|
+
/**
|
|
1489
|
+
* The amount as the code writes it: the exact decimal's own digits, a
|
|
1490
|
+
* point and two decimals (IG Table 8, Amt), from 0.01 to 999 999 999.99.
|
|
1491
|
+
* `DECIMAL` admits no leading zero, so none is written. Never rounded: an
|
|
1492
|
+
* amount written with more than two decimals is refused, a third decimal
|
|
1493
|
+
* of zero among them, so that a template that does not round is refused
|
|
1494
|
+
* on its first render.
|
|
1495
|
+
*/
|
|
1496
|
+
export declare function checkQrBillAmount(decimal: string): QrBillCheck<string>;
|
|
1497
|
+
/** The most bytes the whole payload may take (EPC 2.2): what a version 13 code holds at level M (EPC 2.1). */
|
|
1498
|
+
export declare const EPC_MAX_BYTES = 331;
|
|
1499
|
+
/**
|
|
1500
|
+
* The account (EPC 2.2, AT-C001: "Only IBAN is allowed"): an IBAN of a
|
|
1501
|
+
* country of SEPA, of that country's length, its check digits right. Its
|
|
1502
|
+
* spaces are dropped and its letters made capitals, as the electronic form
|
|
1503
|
+
* writes it -- after its letters are known to be A to Z, so that no letter
|
|
1504
|
+
* becomes two.
|
|
1505
|
+
*
|
|
1506
|
+
* And no QR-IBAN, which SIX keeps for a QR-bill in francs paid with a QR
|
|
1507
|
+
* reference (SIX's QR-bill guidelines 2.8, 2.10): a transfer in euro with
|
|
1508
|
+
* a creditor reference or none is not one it is credited by. That rule is
|
|
1509
|
+
* SIX's, not the EPC's, and its range is the QR-bill's (`isQrIban`).
|
|
1510
|
+
*
|
|
1511
|
+
* An e-invoice's payment account (BT-84) is held by this rule too
|
|
1512
|
+
* (`en16931.ts`): every credit transfer it writes is paid in euro, and an
|
|
1513
|
+
* invoice that prints an EPC QR code beside it names one account.
|
|
1514
|
+
*/
|
|
1515
|
+
export declare function checkEpcIban(text: string): PaymentCheck<string>;
|
|
1516
|
+
/** The BIC of the beneficiary's bank (EPC 2.2, AT-C002), of a bank in SEPA. */
|
|
1517
|
+
export declare function checkEpcBic(text: string): PaymentCheck<string>;
|
|
1518
|
+
/** A rule an IBAN and a BIC break together, reported on the BIC. */
|
|
1519
|
+
interface EpcPairingBreak {
|
|
1520
|
+
readonly field: 'bic';
|
|
1521
|
+
readonly rule: string;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* The rules an IBAN and a BIC break together. An account outside the EEA
|
|
1525
|
+
* is paid to with its bank's BIC: version 002 lets a code leave the BIC
|
|
1526
|
+
* out, and "the BIC will continue to be mandatory for SEPA payment
|
|
1527
|
+
* transactions involving SCT scheme participants from non-EEA countries"
|
|
1528
|
+
* (EPC 2.2). Those participants are the payer's bank as well as the
|
|
1529
|
+
* beneficiary's, and the payer is not known here: only the account's side
|
|
1530
|
+
* is held.
|
|
1531
|
+
*
|
|
1532
|
+
* And a BIC is of the account's country, by the territory codes EPC409-09
|
|
1533
|
+
* gives each country's BICs and IBANs (5). That pairing is this module's
|
|
1534
|
+
* inference, so that a BIC typed for the wrong country is refused: neither
|
|
1535
|
+
* EPC document says an account's bank has a BIC of the account's country,
|
|
1536
|
+
* and one whose bank's BIC is another country's is refused too. `bic` is
|
|
1537
|
+
* null when the code has none; an IBAN or a BIC that is not known -- read
|
|
1538
|
+
* from data, before a render, or already refused -- is undefined, and
|
|
1539
|
+
* nothing is said of it.
|
|
1540
|
+
*/
|
|
1541
|
+
export declare function epcPairing(iban: string | undefined, bic: string | null | undefined): readonly EpcPairingBreak[];
|
|
1542
|
+
/**
|
|
1543
|
+
* The structured remittance information (EPC 2.2, AT-T009): "ISO 11649 RF
|
|
1544
|
+
* Creditor Reference may be used", and it is the one structured reference
|
|
1545
|
+
* this code takes. Checked as a QR-bill's creditor reference is, and then
|
|
1546
|
+
* made capitals, as the IBAN's letters are -- after they are known to be A
|
|
1547
|
+
* to Z. The EPC marks the reference as one the payer should not change
|
|
1548
|
+
* (2.2, "Fixed") and says nothing of its case, so it is written in one
|
|
1549
|
+
* case, not left to each banking app; a QR-bill keeps the case it was
|
|
1550
|
+
* written in, as SIX says banks draw no distinction.
|
|
1551
|
+
*/
|
|
1552
|
+
export declare function checkEpcReference(text: string): PaymentCheck<string>;
|
|
1553
|
+
/** What a free text of the code may hold: how many characters. */
|
|
1554
|
+
interface EpcTextRule {
|
|
1555
|
+
/** Characters, as the EPC counts them: code points, whatever their bytes. */
|
|
1556
|
+
readonly max: number;
|
|
1557
|
+
}
|
|
1558
|
+
/** The beneficiary's name (EPC 2.2, AT-E001): at most 70 characters. */
|
|
1559
|
+
export declare const EPC_BENEFICIARY_RULE: EpcTextRule;
|
|
1560
|
+
/** The unstructured remittance information (EPC 2.2, AT-T009): at most 140 characters. */
|
|
1561
|
+
export declare const EPC_TEXT_RULE: EpcTextRule;
|
|
1562
|
+
/** The beneficiary to originator information (EPC 2.2): at most 70 characters, shown to the payer and not sent on (PSA 3, note 8). */
|
|
1563
|
+
export declare const EPC_INFORMATION_RULE: EpcTextRule;
|
|
1564
|
+
/**
|
|
1565
|
+
* A free text of the code, checked against `rule`: its characters and its
|
|
1566
|
+
* length. The EPC names character sets (2.1) and no narrower one, so in
|
|
1567
|
+
* UTF-8 any character is taken but a control character, a line break or
|
|
1568
|
+
* half of one: any of them would end the text's element early, or be
|
|
1569
|
+
* written as something else. The first is named by its position, counted
|
|
1570
|
+
* in characters from 1, and never quoted. A text is not trimmed: the EPC
|
|
1571
|
+
* asks for nothing of the kind. Whether it may be blank is its field's
|
|
1572
|
+
* question (`checkEpcField`).
|
|
1573
|
+
*/
|
|
1574
|
+
export declare function checkEpcText(text: string, rule: EpcTextRule): PaymentCheck<string>;
|
|
1575
|
+
/** The texts a code holds, by their names in its component, in the order its payload holds them. */
|
|
1576
|
+
type EpcTextField = 'bic' | 'beneficiary' | 'iban' | 'reference' | 'text' | 'information';
|
|
1577
|
+
/** How a text of the code is held: what a refusal calls it, whether the code may leave its element unused, and the rule it is held to when it holds one. */
|
|
1578
|
+
interface EpcTextFieldRule {
|
|
1579
|
+
readonly what: string;
|
|
1580
|
+
readonly optional: boolean;
|
|
1581
|
+
readonly check: (text: string) => PaymentCheck<string>;
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Each text of the code (EPC 2.2): the name and the IBAN mandatory, the
|
|
1585
|
+
* BIC, the reference, the text and the information optional. One table,
|
|
1586
|
+
* which the validator reads for a literal text and the runtime for one the
|
|
1587
|
+
* data resolved: two could call a field two things, or disagree about
|
|
1588
|
+
* which one a code may leave out, and nobody would find out.
|
|
1589
|
+
*/
|
|
1590
|
+
export declare const EPC_TEXT_FIELDS: { readonly [K in EpcTextField]: EpcTextFieldRule; };
|
|
1591
|
+
/** Whether a text prints nothing a payer reads: empty, or white space alone. */
|
|
1592
|
+
export declare function epcBlank(text: string): boolean;
|
|
1593
|
+
/**
|
|
1594
|
+
* The text of `field`, held to its rule. An element the code holds has one
|
|
1595
|
+
* character at least (EPC 2.2: "1..70an", "1..140an"), so a blank text is
|
|
1596
|
+
* refused: a required one as needed, an optional one as the element left
|
|
1597
|
+
* out, written a second way. That is what the validator says of a literal;
|
|
1598
|
+
* an optional text the data resolves to blank is its element unused
|
|
1599
|
+
* instead, which the runtime decides by `epcBlank` before it asks here.
|
|
1600
|
+
*/
|
|
1601
|
+
export declare function checkEpcField(field: EpcTextField, text: string): PaymentCheck<string>;
|
|
1602
|
+
/**
|
|
1603
|
+
* The purpose of the transfer (EPC 2.2, AT-T007): a purpose code, four
|
|
1604
|
+
* capital letters, as ISO 20022 writes one and the EPC's sample, GDDS, is.
|
|
1605
|
+
*/
|
|
1606
|
+
export declare function checkEpcPurpose(code: string): PaymentCheck<string>;
|
|
1607
|
+
/**
|
|
1608
|
+
* The amount in euro (EPC 2.2, AT-T002), as the code writes it after `EUR`:
|
|
1609
|
+
* from 0.01 to 999999999.99, a point and at most two decimals, and "as
|
|
1610
|
+
* short as possible" (PSA 3, note 5) -- no trailing zero after the point,
|
|
1611
|
+
* no point without a decimal after it, and no leading zero, which `DECIMAL`
|
|
1612
|
+
* admits none of. Written from the exact decimal's own digits, never a
|
|
1613
|
+
* JavaScript number. Never rounded: an amount written with more than two
|
|
1614
|
+
* decimals is refused, a third decimal of zero among them, so that a
|
|
1615
|
+
* template that does not round is refused on its first render.
|
|
1616
|
+
*/
|
|
1617
|
+
export declare function checkEpcAmount(decimal: string): PaymentCheck<string>;
|
|
1618
|
+
/**
|
|
1619
|
+
* What a payload holds, each already checked: absent, undefined or empty is
|
|
1620
|
+
* an element the code leaves unused. A reference and a text are never both
|
|
1621
|
+
* given: only one of the two may be populated (EPC 2.2, {Or}), which the
|
|
1622
|
+
* validator holds a code to.
|
|
1623
|
+
*/
|
|
1624
|
+
interface EpcPayloadFields {
|
|
1625
|
+
readonly bic?: string | undefined;
|
|
1626
|
+
readonly beneficiary: string;
|
|
1627
|
+
readonly iban: string;
|
|
1628
|
+
/** As `checkEpcAmount` writes it, without `EUR`. */
|
|
1629
|
+
readonly amount?: string | undefined;
|
|
1630
|
+
readonly purpose?: string | undefined;
|
|
1631
|
+
readonly reference?: string | undefined;
|
|
1632
|
+
readonly text?: string | undefined;
|
|
1633
|
+
readonly information?: string | undefined;
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* The text the code encodes (EPC 2.2): the service tag `BCD`, the version,
|
|
1637
|
+
* the character set `1` for UTF-8, the identification `SCT`, then the
|
|
1638
|
+
* BIC, the name, the IBAN, the amount in euro, the purpose, the reference,
|
|
1639
|
+
* the text and the information, each on its own line, separated by a line
|
|
1640
|
+
* feed. Every element up to the last the code holds is a line, empty when
|
|
1641
|
+
* it is unused, and "the last populated element is not followed by any
|
|
1642
|
+
* character or element separator" (EPC 2.2; PSA 3).
|
|
1643
|
+
*
|
|
1644
|
+
* A code with a BIC is written as version 001, as the EPC's first sample
|
|
1645
|
+
* is, and one without as 002, the version that lets the BIC be left empty.
|
|
1646
|
+
* That a reader of either version takes 001 is a reading of the two
|
|
1647
|
+
* versions (0025), not something a test here shows.
|
|
1648
|
+
*/
|
|
1649
|
+
export declare function epcPayload(fields: EpcPayloadFields): string;
|
|
1650
|
+
/** How many bytes UTF-8 writes `text` in: one to four for each code point. */
|
|
1651
|
+
export declare function utf8Length(text: string): number;
|
|
1652
|
+
/** A whole payload, held to the 331 bytes the EPC allows (2.2), counted in UTF-8's bytes and not in characters. */
|
|
1653
|
+
export declare function checkEpcPayload(payload: string): PaymentCheck<string>;
|
|
1654
|
+
/** The largest version a code may have: 69 modules a side, which holds 331 bytes at level M (EPC069-12 2.1). */
|
|
1655
|
+
export declare const EPC_MAX_VERSION = 13;
|
|
1656
|
+
/** The modules a side of a symbol of `version` has: "QR-Code Version*4+17" (PSA 2; ISO/IEC 18004). */
|
|
1657
|
+
export declare function qrSymbolModules(version: number): number;
|
|
1658
|
+
/**
|
|
1659
|
+
* The frame around a captioned code, in modules (PSA 5's figure): four
|
|
1660
|
+
* between the symbol and the frame -- "Distance = 4 * m" -- and between
|
|
1661
|
+
* the symbol and the caption, which the figure asks "min. 3 * m" of: four
|
|
1662
|
+
* meets both, and keeps ISO/IEC 18004's quiet zone of four clear of the
|
|
1663
|
+
* caption. The corner's radius is "r = 2 * m". The line is at most "0,8 *
|
|
1664
|
+
* m" wide; half a module is drawn, clearly within it.
|
|
1665
|
+
*/
|
|
1666
|
+
export declare const EPC_FRAME: {
|
|
1667
|
+
readonly distance: 4;
|
|
1668
|
+
readonly radius: 2;
|
|
1669
|
+
readonly line: 0.5;
|
|
1670
|
+
};
|
|
1671
|
+
/**
|
|
1672
|
+
* The caption (PSA 5): "Zahlen mit Code", "to the right from bottom to
|
|
1673
|
+
* top", at "Font size min. 7pt" in "Arial o.s. non-serifs" -- Liberation
|
|
1674
|
+
* Sans, the QR-bill's face, here. Its band, in points, is the room to the
|
|
1675
|
+
* right of the symbol's distance, to the square's edge: one em of the
|
|
1676
|
+
* caption's size. It holds the caption's letters, which reach 0.725 em
|
|
1677
|
+
* above their baseline and 0.01 em below it in Liberation Sans 2.1.5, and
|
|
1678
|
+
* the frame's right line, which runs along the caption's baseline and is
|
|
1679
|
+
* broken where the caption stands, as in the PSA's figure.
|
|
1680
|
+
*
|
|
1681
|
+
* Its advance, in ems, is its fifteen glyphs' in Liberation Sans 2.1.5:
|
|
1682
|
+
* 15026 of the face's 2048 units per em, as fontkit lays them out for
|
|
1683
|
+
* PDFKit, with no kerning between these letters -- 51.36 pt at 7 pt,
|
|
1684
|
+
* measured on 17 October 2026, and held to the PDF the renderer draws by
|
|
1685
|
+
* report-render-pdf's `epc-qr-code.test.ts`. The caption stands beside the
|
|
1686
|
+
* symbol, centred on it, and no longer than the symbol is tall, as in the
|
|
1687
|
+
* figure, so that the frame's right line is drawn above and below it.
|
|
1688
|
+
*/
|
|
1689
|
+
export declare const EPC_CAPTION: {
|
|
1690
|
+
readonly words: "Zahlen mit Code";
|
|
1691
|
+
readonly size: 7;
|
|
1692
|
+
readonly band: 7;
|
|
1693
|
+
readonly advance: number;
|
|
1694
|
+
};
|
|
1695
|
+
/**
|
|
1696
|
+
* The modules' widths the PSA prints, in millimetres: "minimal ... 15 mil",
|
|
1697
|
+
* "shall not exceed 20 mil" (PSA 5), a mil 0.0254 mm (PSA 2). They are
|
|
1698
|
+
* 1.08 and 1.44 points exactly, `MODULE_HUNDREDTHS`.
|
|
1699
|
+
*/
|
|
1700
|
+
export declare const EPC_CAPTION_MODULE: {
|
|
1701
|
+
readonly least: 0.381;
|
|
1702
|
+
readonly most: 0.508;
|
|
1703
|
+
};
|
|
1704
|
+
/**
|
|
1705
|
+
* The side, in points, of one module of a code of `version` in a square of
|
|
1706
|
+
* `size`. Without a caption, the square holds the symbol and its quiet zone
|
|
1707
|
+
* of four modules a side, as a QR code's does (0020). With one, it holds,
|
|
1708
|
+
* from the left, the frame's line, the distance, the symbol, the distance
|
|
1709
|
+
* and the caption's band; down, the frame and the distance alone, which
|
|
1710
|
+
* take less room than the band does across.
|
|
1711
|
+
*/
|
|
1712
|
+
export declare function epcModule(size: number, version: number, caption: EpcCaption | undefined): number;
|
|
1713
|
+
/**
|
|
1714
|
+
* The least version a code is drawn at in a square of `size`. Without the
|
|
1715
|
+
* caption, 1: the encoder takes the smallest that holds the payload, as
|
|
1716
|
+
* for a QR code. With it, the least whose modules are at most 20 mil and
|
|
1717
|
+
* whose symbol is as tall as the caption, so that a payload too short for
|
|
1718
|
+
* the square is drawn in a larger version of itself, at the same level,
|
|
1719
|
+
* rather than refused; none where even version 13's modules are over 20
|
|
1720
|
+
* mil. Whether the version the payload then needs has modules of 15 mil
|
|
1721
|
+
* or more is `epcCaptionBreak`'s to say.
|
|
1722
|
+
*/
|
|
1723
|
+
export declare function epcLeastVersion(size: number, caption: EpcCaption | undefined): number | undefined;
|
|
1724
|
+
/**
|
|
1725
|
+
* The rule a captioned code in a square of `size` breaks, or undefined. A
|
|
1726
|
+
* render passes the version the encoder chose, and the rules are that
|
|
1727
|
+
* version's: modules from 15 to 20 mil, and a symbol as tall as the
|
|
1728
|
+
* caption. The validator knows no version and passes none, and refuses
|
|
1729
|
+
* only a size in which no version from 1 to 13 prints, naming the run of
|
|
1730
|
+
* sizes some version does. Sizes are compared in the hundredths of a point
|
|
1731
|
+
* they are stored in, exactly.
|
|
1732
|
+
*/
|
|
1733
|
+
export declare function epcCaptionBreak(size: number, version?: number): string | undefined;
|
|
1734
|
+
/**
|
|
1735
|
+
* What KoSIT's XRechnung 3.0.2 asks of an e-invoice past EN 16931, as
|
|
1736
|
+
* report-spec holds it: of either kind, the shapes of the seller's contact
|
|
1737
|
+
* telephone number (BT-42) and email address (BT-43), each a warning of
|
|
1738
|
+
* KoSIT's XRechnung scenario, BR-DE-27 and BR-DE-28, which a file of either
|
|
1739
|
+
* kind is held to so that none earns it (0037); of an XRechnung (0038), the
|
|
1740
|
+
* terms its schematron needs that EN 16931 lets an invoice leave out
|
|
1741
|
+
* (`XRECHNUNG_NEEDS`, `XRECHNUNG_TEXT_NEEDS`) and the payment terms that
|
|
1742
|
+
* hold no Skonto line (`skontoBreak`, BR-DE-18); and of an electronic
|
|
1743
|
+
* address under 0204 in either, the Leitweg-ID's shape and check digits
|
|
1744
|
+
* (`leitwegIdBreak`), which no rule of XRechnung's checks. The rules the
|
|
1745
|
+
* plan names that nothing the format can say breaks are listed apart, with
|
|
1746
|
+
* what holds each (`XRECHNUNG_HELD`).
|
|
1747
|
+
*
|
|
1748
|
+
* Each shape is the pinned schematron's own expression, written here as
|
|
1749
|
+
* its variable writes it -- `XR-TELEPHONE-REGEX` and `XR-EMAIL-REGEX` in
|
|
1750
|
+
* `resources/xrechnung/3.0.2/xsl/XRechnung-CII-validation.xsl` of KoSIT's
|
|
1751
|
+
* configuration of 2026-08-31, read on 20 October 2026 -- and read as
|
|
1752
|
+
* XPath 2.0 reads it (`xpathRegExp`), after `normalize-space`, as the
|
|
1753
|
+
* rule's test reads it. The e-invoice gate holds each string, and the test
|
|
1754
|
+
* that reads it, to that file, and each id of `XRECHNUNG_RULES` to a rule
|
|
1755
|
+
* of it, on every run. The telephone number's expression is not run as
|
|
1756
|
+
* written: its digits are counted, which is what it asks, in time in
|
|
1757
|
+
* proportion to the text's length (`telephoneBreak`).
|
|
1758
|
+
*/
|
|
1759
|
+
/**
|
|
1760
|
+
* Every rule of XRechnung's a refusal of report-spec names, and no other:
|
|
1761
|
+
* Peppol's three that KoSIT's XRechnung schematron runs among them. The
|
|
1762
|
+
* gate reads this list and holds each id to a rule of the pinned XRechnung
|
|
1763
|
+
* schematron; `en16931.test.ts` and `xrechnung.test.ts` hold it to the ids
|
|
1764
|
+
* the rules say.
|
|
1765
|
+
*/
|
|
1766
|
+
export declare const XRECHNUNG_RULES: readonly ["BR-DE-1", "BR-DE-2", "BR-DE-5", "BR-DE-6", "BR-DE-7", "BR-DE-15", "BR-DE-18", "BR-DE-27", "BR-DE-28", "PEPPOL-EN16931-R001", "PEPPOL-EN16931-R010", "PEPPOL-EN16931-R020"];
|
|
1767
|
+
type XRechnungRule = (typeof XRECHNUNG_RULES)[number];
|
|
1768
|
+
/** A rule of XRechnung's that needs a term, and what a refusal says of the term when it is not given. */
|
|
1769
|
+
interface XRechnungNeed {
|
|
1770
|
+
readonly rule: XRechnungRule;
|
|
1771
|
+
readonly said: string;
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* What an XRechnung needs that EN 16931 lets an invoice leave out, by the
|
|
1775
|
+
* place it stands in under the e-invoice, each fatal in the pinned
|
|
1776
|
+
* XRechnung schematron: the validator refuses an XRechnung without it,
|
|
1777
|
+
* where it is missing. The gate holds each rule's test to the element the
|
|
1778
|
+
* runtime writes the term as.
|
|
1779
|
+
*/
|
|
1780
|
+
export declare const XRECHNUNG_NEEDS: {
|
|
1781
|
+
readonly businessProcess: {
|
|
1782
|
+
readonly rule: "PEPPOL-EN16931-R001";
|
|
1783
|
+
readonly said: "the business process (BT-23) is not given, and an XRechnung needs it";
|
|
1784
|
+
};
|
|
1785
|
+
readonly buyerReference: {
|
|
1786
|
+
readonly rule: "BR-DE-15";
|
|
1787
|
+
readonly said: "the buyer's reference (BT-10), a public buyer's Leitweg-ID, is not given, and an XRechnung needs it";
|
|
1788
|
+
};
|
|
1789
|
+
readonly payment: {
|
|
1790
|
+
readonly rule: "BR-DE-1";
|
|
1791
|
+
readonly said: "the payment instructions (BG-16) are not given, and an XRechnung needs them";
|
|
1792
|
+
};
|
|
1793
|
+
readonly 'seller/contact': {
|
|
1794
|
+
readonly rule: "BR-DE-2";
|
|
1795
|
+
readonly said: "the seller's contact (BG-6) is not given, and an XRechnung needs it";
|
|
1796
|
+
};
|
|
1797
|
+
readonly 'seller/electronicAddress': {
|
|
1798
|
+
readonly rule: "PEPPOL-EN16931-R020";
|
|
1799
|
+
readonly said: "the seller's electronic address (BT-34) is not given, and an XRechnung needs it";
|
|
1800
|
+
};
|
|
1801
|
+
readonly 'buyer/electronicAddress': {
|
|
1802
|
+
readonly rule: "PEPPOL-EN16931-R010";
|
|
1803
|
+
readonly said: "the buyer's electronic address (BT-49) is not given, and an XRechnung needs it";
|
|
1804
|
+
};
|
|
1805
|
+
};
|
|
1806
|
+
/**
|
|
1807
|
+
* The texts an XRechnung needs to say something, by business term, and the
|
|
1808
|
+
* rule of XRechnung's that needs each: those of `XRECHNUNG_NEEDS`, and the
|
|
1809
|
+
* contact's three, which BR-DE-5 to -7 read through normalize-space. An
|
|
1810
|
+
* XRechnung's texts are EN 16931's with these needed
|
|
1811
|
+
* (`E_INVOICE_KIND_TEXTS`), so that a blank one is refused by its rule, a
|
|
1812
|
+
* literal where it is written and one from data at the render.
|
|
1813
|
+
*/
|
|
1814
|
+
export declare const XRECHNUNG_TEXT_NEEDS: {
|
|
1815
|
+
readonly 'BT-10': "BR-DE-15";
|
|
1816
|
+
readonly 'BT-23': "PEPPOL-EN16931-R001";
|
|
1817
|
+
readonly 'BT-34': "PEPPOL-EN16931-R020";
|
|
1818
|
+
readonly 'BT-41': "BR-DE-5";
|
|
1819
|
+
readonly 'BT-42': "BR-DE-6";
|
|
1820
|
+
readonly 'BT-43': "BR-DE-7";
|
|
1821
|
+
readonly 'BT-49': "PEPPOL-EN16931-R010";
|
|
1822
|
+
};
|
|
1823
|
+
/**
|
|
1824
|
+
* The rules of XRechnung's the plan for 0.3.0 names, or that hold the terms
|
|
1825
|
+
* it does, that nothing the format can say breaks, so that no refusal of
|
|
1826
|
+
* report-spec names them: each is held by another rule or by what the
|
|
1827
|
+
* format and the writer leave out, as said. The gate holds each id to a
|
|
1828
|
+
* rule of the pinned XRechnung schematron, and the rule's context and test,
|
|
1829
|
+
* white space aside, to the ones the reason was read against
|
|
1830
|
+
* (`XRECHNUNG_HELD_RULES` in `scripts/e-invoice/oracle.mjs`), so that a
|
|
1831
|
+
* rule KoSIT renames, drops or rewrites is seen; that each holds of a file
|
|
1832
|
+
* is the XRechnung sample's, which KoSIT's XRechnung scenario judges.
|
|
1833
|
+
*/
|
|
1834
|
+
export declare const XRECHNUNG_HELD: {
|
|
1835
|
+
readonly [id: string]: string;
|
|
1836
|
+
};
|
|
1837
|
+
/** What a rule of XRechnung's says, with its id: the one way a message names one, so that every id is a listed one. */
|
|
1838
|
+
export declare function xrechnungRule(id: XRechnungRule, said: string): string;
|
|
1839
|
+
/** Whether a rule id is one of XRechnung's, rather than CEN's or the UStG's. */
|
|
1840
|
+
export declare function isXRechnungRule(id: string): id is XRechnungRule;
|
|
1841
|
+
/** A shape XRechnung holds a term to: the rule that holds it, and its XPath regular expression as the pinned schematron writes it. */
|
|
1842
|
+
interface XRechnungPattern {
|
|
1843
|
+
readonly rule: XRechnungRule;
|
|
1844
|
+
readonly pattern: string;
|
|
1845
|
+
}
|
|
1846
|
+
/** The shapes, by what they shape. */
|
|
1847
|
+
export declare const XRECHNUNG_PATTERNS: {
|
|
1848
|
+
readonly telephone: XRechnungPattern;
|
|
1849
|
+
readonly email: XRechnungPattern;
|
|
1850
|
+
};
|
|
1851
|
+
/**
|
|
1852
|
+
* The rule an XRechnung's payment terms (BT-20) break, or undefined: no
|
|
1853
|
+
* line led by # (0038, Q4). BR-DE-18 reads every line of the terms --
|
|
1854
|
+
* `tokenize(. , '(\r?\n)')`, so a line ends at a line feed, a carriage
|
|
1855
|
+
* return before it going with it -- whose `normalize-space` begins with #,
|
|
1856
|
+
* as a Skonto line of XRechnung's own syntax, fatal where it is not one;
|
|
1857
|
+
* this release writes no Skonto, and refuses every such line, a
|
|
1858
|
+
* well-formed one too. The white space normalize-space drops before the #
|
|
1859
|
+
* is XPath's four characters. Found in one pass over the text.
|
|
1860
|
+
*/
|
|
1861
|
+
export declare function skontoBreak(text: string): string | undefined;
|
|
1862
|
+
/**
|
|
1863
|
+
* The rule an electronic address under scheme 0204 breaks as a Leitweg-ID,
|
|
1864
|
+
* or undefined (0038, Q3): its shape, and check digits that are 98 less
|
|
1865
|
+
* the remainder modulo 97 of its coarse and fine addresses with 00 after
|
|
1866
|
+
* them, each letter, in either case, the two digits ISO/IEC 7064 gives it
|
|
1867
|
+
* (MOD 97-10, as an IBAN's). The format specification itself, KoSIT's
|
|
1868
|
+
* Leitweg-ID-Formatspezifikation 2.0.2, could not be read here; the shape
|
|
1869
|
+
* and the computation are as FeRD's data sheet describes them, and every
|
|
1870
|
+
* Leitweg-ID of KoSIT's XRechnung 3.0.2 test suite with right digits
|
|
1871
|
+
* passes it, and every one with wrong digits is refused
|
|
1872
|
+
* (`xrechnung.test.ts`). No rule of XRechnung's or CEN's checks one, so
|
|
1873
|
+
* this names none.
|
|
1874
|
+
*/
|
|
1875
|
+
export declare function leitwegIdBreak(text: string): string | undefined;
|
|
1876
|
+
/**
|
|
1877
|
+
* Every rule of EN 16931 a refusal of these checks names, and no other.
|
|
1878
|
+
* The gate reads this list; `en16931.test.ts` holds it to the ids the
|
|
1879
|
+
* rules say.
|
|
1880
|
+
*/
|
|
1881
|
+
export declare const EN16931_RULES: readonly ["BR-02", "BR-03", "BR-06", "BR-07", "BR-09", "BR-11", "BR-16", "BR-21", "BR-22", "BR-23", "BR-24", "BR-25", "BR-26", "BR-27", "BR-29", "BR-61", "BR-CL-11", "BR-CL-14", "BR-CL-23", "BR-CL-25", "BR-CO-04", "BR-CO-09", "BR-CO-17", "BR-CO-18", "BR-CO-19", "BR-CO-26", "BR-DEC-16", "BR-DEC-23", "BR-S-02", "BR-S-05", "BR-S-08", "BR-S-10", "BR-E-01", "BR-E-02", "BR-E-05", "BR-E-10", "BR-AE-01", "BR-AE-02", "BR-AE-05", "BR-AE-10"];
|
|
1882
|
+
type En16931Rule = (typeof EN16931_RULES)[number];
|
|
1883
|
+
/** What a rule says, with the ids of the rules it is: the one way a message of these checks names one, so that every id is a listed one. */
|
|
1884
|
+
export declare function en16931Rule(id: En16931Rule | readonly En16931Rule[], said: string): string;
|
|
1885
|
+
/**
|
|
1886
|
+
* The section of the UStG that asks a German invoice for "die vollständige
|
|
1887
|
+
* Anschrift" of the seller and of the buyer (§ 14 Abs. 4 Satz 1 Nr. 1,
|
|
1888
|
+
* read on gesetze-im-internet.de on 17 October 2026): their street, post
|
|
1889
|
+
* code and city, which no rule of CEN's asks for. BR-08 and BR-10 need
|
|
1890
|
+
* only that each party has a postal address (BG-5, BG-8), and BR-09 and
|
|
1891
|
+
* BR-11 its country. It is the law's, not one of CEN's rules, and so not
|
|
1892
|
+
* in `EN16931_RULES`.
|
|
1893
|
+
*/
|
|
1894
|
+
export declare const FULL_ADDRESS = "§ 14 Abs. 4 Satz 1 Nr. 1 UStG";
|
|
1895
|
+
/** What asks for a term an e-invoice cannot leave out: one of EN 16931's rules, the UStG's full address, or, in an XRechnung, one of XRechnung's rules (0038). */
|
|
1896
|
+
type EInvoiceNeed = En16931Rule | typeof FULL_ADDRESS | XRechnungRule;
|
|
1897
|
+
/** What a refusal says of a term `need` asks for that is `said` -- empty, or without a value -- and what asks for it: a rule of CEN's or XRechnung's by its id, the UStG by its section and what it asks. */
|
|
1898
|
+
export declare function neededBy(need: EInvoiceNeed, said: string): string;
|
|
1899
|
+
/** Whether a text says nothing: empty, or white space alone. */
|
|
1900
|
+
export declare function eInvoiceBlank(text: string): boolean;
|
|
1901
|
+
/**
|
|
1902
|
+
* The rule a text breaks by holding a character XML 1.0 cannot write, or
|
|
1903
|
+
* undefined. A file that held one would not be XML, and dropping it would
|
|
1904
|
+
* change what the invoice says, so it is refused, named by its position,
|
|
1905
|
+
* counted in characters from 1, never quoted.
|
|
1906
|
+
*/
|
|
1907
|
+
export declare function xmlCharacterBreak(text: string): string | undefined;
|
|
1908
|
+
/** A country (BT-40, BT-55) of `COUNTRY_CODES`, its blanks dropped. */
|
|
1909
|
+
export declare function checkCountryCode(text: string): PaymentCheck<CountryCode>;
|
|
1910
|
+
/** A unit of measure (BT-130) of `UNIT_CODES`, its blanks dropped. */
|
|
1911
|
+
export declare function checkUnitCode(text: string): PaymentCheck<UnitCode>;
|
|
1912
|
+
/** A scheme (BT-30-1, BT-47-1) of `SCHEME_IDS`: a literal the template writes, taken as written. */
|
|
1913
|
+
export declare function checkSchemeId(code: string): PaymentCheck<SchemeId>;
|
|
1914
|
+
/** An electronic address's scheme (BT-34-1, BT-49-1) of `ADDRESS_SCHEMES`: a literal the template writes, taken as written. */
|
|
1915
|
+
export declare function checkAddressScheme(code: string): PaymentCheck<AddressScheme>;
|
|
1916
|
+
/**
|
|
1917
|
+
* A VAT identifier (BT-31, BT-48): a prefix of `VAT_PREFIXES`, which names
|
|
1918
|
+
* the country that issued it (BR-CO-09), and then the number it gives. The
|
|
1919
|
+
* spaces a person writes to read one are dropped, as an IBAN's are; what
|
|
1920
|
+
* follows the prefix is the issuing country's to define, and not checked.
|
|
1921
|
+
*/
|
|
1922
|
+
export declare function checkVatIdentifier(text: string): PaymentCheck<string>;
|
|
1923
|
+
/** How a text term of the e-invoice is held: what a refusal calls it, the rule its absence breaks, and its own rule. */
|
|
1924
|
+
interface EInvoiceTextRule {
|
|
1925
|
+
/** What a refusal calls it, its business term named: "the seller's name (BT-27)". */
|
|
1926
|
+
readonly what: string;
|
|
1927
|
+
/** What an empty one breaks, when the e-invoice needs it; absent, it may be left out. */
|
|
1928
|
+
readonly required?: EInvoiceNeed;
|
|
1929
|
+
/**
|
|
1930
|
+
* Whether the XML writes it as a token: the Factur-X EN 16931 XSD types
|
|
1931
|
+
* an identifier and a code (udt:IDType, udt:CodeType) as xs:token, which
|
|
1932
|
+
* a schema-aware reader collapses -- each tab and line break a space, two
|
|
1933
|
+
* spaces one, none at either end. Such a text holds none of that, or a
|
|
1934
|
+
* reader would read another identifier than the page prints.
|
|
1935
|
+
*/
|
|
1936
|
+
readonly token?: true;
|
|
1937
|
+
/** What it holds when it holds something, past its characters: the value the XML writes, or the rule it breaks. */
|
|
1938
|
+
readonly check?: (text: string) => PaymentCheck<string>;
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Each text term of the e-invoice, by its business term. One table, which
|
|
1942
|
+
* the validator reads for a literal text and the runtime for one the data
|
|
1943
|
+
* resolved: two could call a term two things, or disagree about which an
|
|
1944
|
+
* invoice may leave out, and nobody would find out.
|
|
1945
|
+
*
|
|
1946
|
+
* - The address lines, post codes and cities are needed by the UStG's
|
|
1947
|
+
* full address (`FULL_ADDRESS`), past EN 16931, which asks only for the
|
|
1948
|
+
* country.
|
|
1949
|
+
* - An identifier or a code the XML writes as a token holds no white
|
|
1950
|
+
* space a token collapses (`token`).
|
|
1951
|
+
* - The payment account (BT-84) is held by the one rule an EPC QR code's
|
|
1952
|
+
* account is (`checkEpcIban`): an IBAN of a country of SEPA, of its
|
|
1953
|
+
* length, its check digits right (`payment-reference.ts`), and no
|
|
1954
|
+
* QR-IBAN; and its BIC (BT-86) by the EPC QR code's BIC rule
|
|
1955
|
+
* (`checkEpcBic`). Every credit transfer this version writes is paid in
|
|
1956
|
+
* euro, and an invoice that prints both cannot hold two rules for one
|
|
1957
|
+
* account or one bank.
|
|
1958
|
+
* - The exemption reason (BT-120) is needed by its category's code
|
|
1959
|
+
* (`vatReasonBreak`); a line's VAT category (BT-151) is one the invoice
|
|
1960
|
+
* declares (`checkLineCategory`).
|
|
1961
|
+
* - The business process (BT-23), the electronic addresses (BT-34, BT-49)
|
|
1962
|
+
* and the seller's contact (BT-41 to BT-43) are needed by no rule a
|
|
1963
|
+
* German B2B invoice is held to (0037). The telephone number and the
|
|
1964
|
+
* email address are held to the shapes XRechnung's KoSIT warns of
|
|
1965
|
+
* (`xrechnung.ts`), so that no file earns the warning; the business
|
|
1966
|
+
* process and an address, identifiers of no shape CEN or XRechnung asks,
|
|
1967
|
+
* are tokens alone.
|
|
1968
|
+
*/
|
|
1969
|
+
type EInvoiceTextTerm = 'BT-1' | 'BT-10' | 'BT-20' | 'BT-23' | 'BT-27' | 'BT-30' | 'BT-31' | 'BT-32' | 'BT-34' | 'BT-35' | 'BT-36' | 'BT-37' | 'BT-38' | 'BT-40' | 'BT-41' | 'BT-42' | 'BT-43' | 'BT-44' | 'BT-47' | 'BT-48' | 'BT-49' | 'BT-50' | 'BT-51' | 'BT-52' | 'BT-53' | 'BT-55' | 'BT-83' | 'BT-84' | 'BT-85' | 'BT-86' | 'BT-120' | 'BT-126' | 'BT-130' | 'BT-151' | 'BT-153';
|
|
1970
|
+
export declare const E_INVOICE_TEXTS: { readonly [T in EInvoiceTextTerm]: EInvoiceTextRule; };
|
|
1971
|
+
/** How each text term is held, by its business term: a table over every term. */
|
|
1972
|
+
type EInvoiceTextRules = { readonly [T in EInvoiceTextTerm]: EInvoiceTextRule; };
|
|
1973
|
+
/**
|
|
1974
|
+
* Each kind's text rules, one table per kind over every term (0038): the
|
|
1975
|
+
* validator reads a literal by its kind's, the runtime what the data
|
|
1976
|
+
* resolved, so the two cannot hold one term of one kind to two rules. A
|
|
1977
|
+
* kind without a table does not compile.
|
|
1978
|
+
*/
|
|
1979
|
+
export declare const E_INVOICE_KIND_TEXTS: { readonly [K in EInvoiceKind]: EInvoiceTextRules; };
|
|
1980
|
+
/** Each part of an address, by its business term. */
|
|
1981
|
+
type AddressTerms = { readonly [A in keyof EInvoiceAddress]-?: EInvoiceTextTerm; };
|
|
1982
|
+
/** Each part of the seller's contact, by its business term. */
|
|
1983
|
+
type ContactTerms = { readonly [C in keyof SellerContact]-?: EInvoiceTextTerm; };
|
|
1984
|
+
/**
|
|
1985
|
+
* Which term each text of an e-invoice is, by where it stands in it: the
|
|
1986
|
+
* type of `E_INVOICE_TEXT_TERMS`, over every text the format has. A legal
|
|
1987
|
+
* registration and an electronic address are named by their identifier's
|
|
1988
|
+
* term; their schemes are codes, not texts.
|
|
1989
|
+
*/
|
|
1990
|
+
interface EInvoiceTextTerms {
|
|
1991
|
+
readonly number: EInvoiceTextTerm;
|
|
1992
|
+
readonly businessProcess: EInvoiceTextTerm;
|
|
1993
|
+
readonly buyerReference: EInvoiceTextTerm;
|
|
1994
|
+
readonly terms: EInvoiceTextTerm;
|
|
1995
|
+
readonly seller: { readonly [K in Exclude<keyof EInvoiceSeller, 'address' | 'contact'>]-?: EInvoiceTextTerm; } & {
|
|
1996
|
+
readonly contact: ContactTerms;
|
|
1997
|
+
readonly address: AddressTerms;
|
|
1998
|
+
};
|
|
1999
|
+
readonly buyer: { readonly [K in Exclude<keyof EInvoiceBuyer, 'address'>]-?: EInvoiceTextTerm; } & {
|
|
2000
|
+
readonly address: AddressTerms;
|
|
2001
|
+
};
|
|
2002
|
+
/** A VAT category's exemption reason. */
|
|
2003
|
+
readonly reason: EInvoiceTextTerm;
|
|
2004
|
+
readonly payment: { readonly [K in Exclude<keyof PaymentInstructions, 'means'>]-?: EInvoiceTextTerm; };
|
|
2005
|
+
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Which business term each text of an e-invoice is, by where it stands:
|
|
2008
|
+
* the validator reads a literal by it and the runtime what the data
|
|
2009
|
+
* resolved, so the two cannot call one text two terms. A line's texts are
|
|
2010
|
+
* not here: the columns and the row that give them are `E_INVOICE_LINE_COLUMNS`'
|
|
2011
|
+
* and `E_INVOICE_LINE_CODES`'.
|
|
2012
|
+
*/
|
|
2013
|
+
export declare const E_INVOICE_TEXT_TERMS: EInvoiceTextTerms;
|
|
2014
|
+
/**
|
|
2015
|
+
* The text of `term`, held to its rule: one that says nothing is refused,
|
|
2016
|
+
* as needed where the e-invoice needs it and as the term left out where it
|
|
2017
|
+
* may be, a second spelling of one absent; then its characters, which XML
|
|
2018
|
+
* 1.0 must be able to write; then, for a term the XML writes as a token,
|
|
2019
|
+
* its white space; then its own rule. That is what the validator says of a
|
|
2020
|
+
* literal; an optional term the data resolves to blank is left out of the
|
|
2021
|
+
* XML instead, which the runtime decides by `eInvoiceBlank` before it asks
|
|
2022
|
+
* here. `kind` is the e-invoice's, whose rules the term is held to.
|
|
2023
|
+
*/
|
|
2024
|
+
export declare function checkEInvoiceText(term: EInvoiceTextTerm, text: string, kind?: EInvoiceKind): PaymentCheck<string>;
|
|
2025
|
+
/**
|
|
2026
|
+
* The identifier of an electronic address (BT-34, BT-49), `term`, given in
|
|
2027
|
+
* `scheme`: held to its term's rule, and, under 0204, which says it is a
|
|
2028
|
+
* Leitweg-ID, to a Leitweg-ID's shape and check digits (`leitwegIdBreak`,
|
|
2029
|
+
* 0038), in an e-invoice of either kind. What a value under another
|
|
2030
|
+
* scheme must be is not checked (0037).
|
|
2031
|
+
*/
|
|
2032
|
+
export declare function checkElectronicAddress(term: EInvoiceTextTerm, scheme: AddressScheme, text: string, kind?: EInvoiceKind): PaymentCheck<string>;
|
|
2033
|
+
/** How a decimal term of the e-invoice is held: what a refusal calls it, the rule a null breaks, and what it may be. */
|
|
2034
|
+
interface EInvoiceDecimalRule {
|
|
2035
|
+
readonly what: string;
|
|
2036
|
+
/** The rule a final render's null breaks; absent, the term may be left out. */
|
|
2037
|
+
readonly required?: En16931Rule;
|
|
2038
|
+
/** The rule more than two decimals break, for a term the XML writes as an amount with two. */
|
|
2039
|
+
readonly cents?: En16931Rule;
|
|
2040
|
+
/** The rule a negative value breaks, for a term that may not be one. */
|
|
2041
|
+
readonly least?: En16931Rule;
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* Each decimal term the runtime reads from data, by its business term:
|
|
2045
|
+
* the line's quantity, net price and net amount, and the paid amount. The
|
|
2046
|
+
* totals and the breakdown are not here: the runtime computes them.
|
|
2047
|
+
*/
|
|
2048
|
+
type EInvoiceDecimalTerm = 'BT-129' | 'BT-146' | 'BT-131' | 'BT-113';
|
|
2049
|
+
export declare const E_INVOICE_DECIMALS: { readonly [T in EInvoiceDecimalTerm]: EInvoiceDecimalRule; };
|
|
2050
|
+
/**
|
|
2051
|
+
* The decimal of `term`, an exact decimal as a string, as the XML writes
|
|
2052
|
+
* it: an amount with exactly two decimals, from its own digits; a quantity
|
|
2053
|
+
* or a price as written. Never rounded, and never read through a
|
|
2054
|
+
* JavaScript number: an amount of 10.505 is refused, so that a template
|
|
2055
|
+
* that does not round where it computes a line is refused on its first
|
|
2056
|
+
* render, rather than writing another amount than its page prints. 10.500
|
|
2057
|
+
* is the same number of cents, and is written 10.50.
|
|
2058
|
+
*/
|
|
2059
|
+
export declare function checkEInvoiceDecimal(term: EInvoiceDecimalTerm, decimal: string): PaymentCheck<string>;
|
|
2060
|
+
/** A date term of the e-invoice: what a refusal calls it, and the rule a final render's null breaks where the e-invoice needs it. */
|
|
2061
|
+
interface EInvoiceDateRule {
|
|
2062
|
+
readonly what: string;
|
|
2063
|
+
readonly required?: En16931Rule;
|
|
493
2064
|
}
|
|
494
|
-
|
|
495
|
-
|
|
2065
|
+
type EInvoiceDateTerm = 'BT-2' | 'BT-9' | 'BT-72' | 'BT-73' | 'BT-74';
|
|
2066
|
+
/** Each date term, by its business term. */
|
|
2067
|
+
export declare const E_INVOICE_DATES: { readonly [T in EInvoiceDateTerm]: EInvoiceDateRule; };
|
|
2068
|
+
/**
|
|
2069
|
+
* A date term the data resolved, held to a day on the calendar written
|
|
2070
|
+
* YYYY-MM-DD, as the runtime holds a date. The editing core types a date
|
|
2071
|
+
* term as the ISO string a date field is read as, so any text passes it;
|
|
2072
|
+
* one that is not a day -- a name, 2026-02-29, a moment with its time --
|
|
2073
|
+
* would be written as a date no validator reads as one.
|
|
2074
|
+
*/
|
|
2075
|
+
export declare function checkEInvoiceDate(text: string): PaymentCheck<string>;
|
|
2076
|
+
/**
|
|
2077
|
+
* The rule an invoicing period breaks whose dates the data resolved, or
|
|
2078
|
+
* undefined: it ends no earlier than it starts (BR-29). Both are calendar
|
|
2079
|
+
* dates written YYYY-MM-DD, as the runtime's dates are, so they compare as
|
|
2080
|
+
* text.
|
|
2081
|
+
*/
|
|
2082
|
+
export declare function checkInvoicingPeriod(start: string, end: string): string | undefined;
|
|
2083
|
+
/** The rule an invoicing period breaks by holding neither date (BR-CO-19), or undefined: `start` and `end` say which it holds. */
|
|
2084
|
+
export declare function periodBreak(start: boolean, end: boolean): string | undefined;
|
|
2085
|
+
/**
|
|
2086
|
+
* The rule an invoice breaks that says nothing of when it was supplied, or
|
|
2087
|
+
* undefined: § 14 (4) 1 no. 6 UStG asks a German invoice for the time of
|
|
2088
|
+
* supply, which the XML gives as a delivery date or an invoicing period.
|
|
2089
|
+
* Not one of CEN's rules: FeRD's BR-FX-DE-04, as the specification is
|
|
2090
|
+
* transcribed [S], only warns of an invoice without one.
|
|
2091
|
+
*/
|
|
2092
|
+
export declare function supplyBreak(delivered: boolean, period: boolean): string | undefined;
|
|
2093
|
+
/** What a line's term is read from: its business term, whose rule holds it, what a refusal calls it, and the types of field that can give it. */
|
|
2094
|
+
interface EInvoiceLineTerm {
|
|
2095
|
+
readonly term: EInvoiceTextTerm | EInvoiceDecimalTerm;
|
|
2096
|
+
readonly what: string;
|
|
2097
|
+
readonly types: readonly FieldType[];
|
|
2098
|
+
}
|
|
2099
|
+
type EInvoiceLineColumn = 'name' | 'quantity' | 'netPrice' | 'netAmount';
|
|
2100
|
+
type EInvoiceLineCode = 'id' | 'unit' | 'vat';
|
|
2101
|
+
/**
|
|
2102
|
+
* Each term a column of the lines' table prints, in the order the XML
|
|
2103
|
+
* holds a line's. A column prints a detail field of one of these types, or
|
|
2104
|
+
* an expression the editing core holds to what it reads them as: one
|
|
2105
|
+
* table, so the validator and the core cannot take a column for two
|
|
2106
|
+
* things.
|
|
2107
|
+
*/
|
|
2108
|
+
export declare const E_INVOICE_LINE_COLUMNS: { readonly [K in EInvoiceLineColumn]: EInvoiceLineTerm; };
|
|
2109
|
+
/** Each code read from a line's row, a detail field of one of these types or an expression held to them in the same way. */
|
|
2110
|
+
export declare const E_INVOICE_LINE_CODES: { readonly [K in EInvoiceLineCode]: EInvoiceLineTerm; };
|
|
2111
|
+
/**
|
|
2112
|
+
* The rules the seller's identifiers break, `has` saying which it holds,
|
|
2113
|
+
* for an invoice whose lines are in categories of `codes`:
|
|
2114
|
+
* - BR-CO-26: a buyer identifies a seller by its VAT identifier or its
|
|
2115
|
+
* legal registration (BT-29, the third way, this version does not write);
|
|
2116
|
+
* - BR-S-02, BR-E-02, BR-AE-02: a line in any of the three categories needs
|
|
2117
|
+
* the seller's VAT identifier or its tax number.
|
|
2118
|
+
*
|
|
2119
|
+
* The validator passes what the template declares: every line is in a
|
|
2120
|
+
* category the invoice declares, and every invoice has a line, so a rule
|
|
2121
|
+
* of a declared category is one some render breaks. The runtime passes
|
|
2122
|
+
* the categories its lines use and the identifiers that print.
|
|
2123
|
+
*/
|
|
2124
|
+
export declare function sellerIdentificationBreaks(has: {
|
|
2125
|
+
readonly vatId: boolean;
|
|
2126
|
+
readonly taxNumber: boolean;
|
|
2127
|
+
readonly legalId: boolean;
|
|
2128
|
+
}, codes: readonly VatCategoryCode[]): readonly string[];
|
|
2129
|
+
/**
|
|
2130
|
+
* The rule the buyer's identifiers break, or undefined: a reverse-charged
|
|
2131
|
+
* line moves the tax to the buyer, and needs it named by its VAT identifier
|
|
2132
|
+
* or its legal registration (BR-AE-02).
|
|
2133
|
+
*/
|
|
2134
|
+
export declare function buyerIdentificationBreak(has: {
|
|
2135
|
+
readonly vatId: boolean;
|
|
2136
|
+
readonly legalId: boolean;
|
|
2137
|
+
}, codes: readonly VatCategoryCode[]): string | undefined;
|
|
2138
|
+
/**
|
|
2139
|
+
* The rate of a category of `code`, by value, without the trailing zeros
|
|
2140
|
+
* that do not change it: more than 0 when standard rated (BR-S-05), 0 when
|
|
2141
|
+
* exempt or reverse-charged (BR-E-05, BR-AE-05). Compared as text, never
|
|
2142
|
+
* as a JavaScript number: report-spec has no decimal, and needs none.
|
|
2143
|
+
*
|
|
2144
|
+
* And a standard rate of 0.5 or more (BR-CO-17). CEN's rule rounds the
|
|
2145
|
+
* rate first, and XPath's round(0.4) is 0: a breakdown whose rate rounds
|
|
2146
|
+
* to 0 must then hold a tax that rounds to 0, which a standard rated
|
|
2147
|
+
* category's tax does not past a small basis -- at 0.4, one of 125 or
|
|
2148
|
+
* more. No rate of the EU's is that low.
|
|
2149
|
+
*/
|
|
2150
|
+
export declare function checkVatRate(code: VatCategoryCode, rate: string): PaymentCheck<string>;
|
|
2151
|
+
/**
|
|
2152
|
+
* The rule a category's exemption reason (BT-120) breaks, or undefined:
|
|
2153
|
+
* exempt and reverse-charged categories say why (BR-E-10, BR-AE-10), and a
|
|
2154
|
+
* standard rated one has no reason to give (BR-S-10).
|
|
2155
|
+
*/
|
|
2156
|
+
export declare function vatReasonBreak(code: VatCategoryCode, hasReason: boolean): string | undefined;
|
|
2157
|
+
/** A rule a list of categories breaks, and the category and field it is said of. */
|
|
2158
|
+
interface VatCategoryBreak {
|
|
2159
|
+
readonly index: number;
|
|
2160
|
+
readonly field: 'code' | 'rate';
|
|
2161
|
+
readonly rule: string;
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* The rules a list of categories, each with a rate `checkVatRate` took,
|
|
2165
|
+
* breaks together: each is one VAT breakdown (BG-23), so standard rated
|
|
2166
|
+
* categories have distinct rates by value (BR-S-08), and there is one
|
|
2167
|
+
* exempt and one reverse-charged category at most (BR-E-01, BR-AE-01). Two
|
|
2168
|
+
* that would be one breakdown would each claim every one of its lines, and
|
|
2169
|
+
* the XML would fail. The later of the two is refused.
|
|
2170
|
+
*/
|
|
2171
|
+
export declare function vatCategoryBreaks(categories: readonly {
|
|
2172
|
+
readonly code: VatCategoryCode;
|
|
2173
|
+
readonly rate: string;
|
|
2174
|
+
}[]): readonly VatCategoryBreak[];
|
|
2175
|
+
/** The category a line names by `id`, a category the invoice declares (BR-CO-04). */
|
|
2176
|
+
export declare function checkLineCategory(id: string, categories: readonly VatCategory[]): PaymentCheck<VatCategory>;
|
|
496
2177
|
/**
|
|
497
2178
|
* What validation can say is wrong with a report, as stable codes.
|
|
498
2179
|
*
|
|
@@ -501,7 +2182,7 @@ interface ReportDefinition {
|
|
|
501
2182
|
* reworded once released; a new rule gets a new code. Each has a refusal
|
|
502
2183
|
* test in `validate.test.ts`, which does not compile while one is missing.
|
|
503
2184
|
*/
|
|
504
|
-
export declare const REPORT_ERROR_CODES: readonly ["not-a-report", "unsupported-version", "not-json", "too-many-errors", "wrong-type", "missing-property", "unknown-property", "unknown-kind", "not-one-of", "out-of-range", "not-an-integer", "too-precise", "too-long", "too-many", "too-few", "empty-expression", "invalid-id", "invalid-locale", "invalid-color", "invalid-currency", "invalid-digest", "invalid-default", "invalid-decimal", "printable-area-too-small", "scale-on-non-decimal", "duplicate-id", "reserved-id", "unknown-style", "unknown-dataset", "unknown-field", "unknown-parameter", "unknown-asset", "unknown-aggregate", "unknown-column", "misplaced-flow-component", "nested-flow-component", "misplaced-page-counter", "misplaced-detail-field", "misplaced-group-aggregate", "second-detail-table", "nesting-too-deep", "duplicate-component-id", "duplicate-column-id", "duplicate-footer-cell", "duplicate-sort-key", "exceeds-printable-area", "aggregate-type-mismatch", "format-type-mismatch", "binding-type-mismatch"];
|
|
2185
|
+
export declare const REPORT_ERROR_CODES: readonly ["not-a-report", "unsupported-version", "not-json", "too-many-errors", "wrong-type", "missing-property", "unknown-property", "unknown-kind", "not-one-of", "out-of-range", "not-an-integer", "too-precise", "too-long", "too-many", "too-few", "empty-expression", "invalid-id", "invalid-locale", "invalid-color", "invalid-currency", "invalid-digest", "invalid-default", "invalid-form-path", "invalid-decimal", "invalid-qr-bill", "invalid-epc-qr-code", "invalid-e-invoice", "invalid-chart", "printable-area-too-small", "scale-on-non-decimal", "duplicate-id", "reserved-id", "incomplete-form-binding", "misplaced-form-binding", "invalid-form-override", "unknown-style", "unknown-dataset", "unknown-field", "unknown-parameter", "unknown-asset", "unknown-aggregate", "unknown-column", "asset-not-a-font", "asset-not-an-image", "missing-face", "misplaced-flow-component", "nested-flow-component", "misplaced-page-counter", "misplaced-detail-field", "misplaced-group-aggregate", "misplaced-table-aggregate", "misplaced-baseline", "second-detail-table", "nesting-too-deep", "duplicate-component-id", "duplicate-column-id", "duplicate-footer-cell", "duplicate-sort-key", "exceeds-printable-area", "payment-part-page", "aggregate-type-mismatch", "format-type-mismatch", "binding-type-mismatch", "duplicate-language", "not-a-word", "duplicate-word", "blank-translation"];
|
|
505
2186
|
type ReportErrorCode = (typeof REPORT_ERROR_CODES)[number];
|
|
506
2187
|
interface ReportError {
|
|
507
2188
|
/** A JSON Pointer (RFC 6901) to what is wrong; '' is the whole document. */
|
|
@@ -511,8 +2192,6 @@ interface ReportError {
|
|
|
511
2192
|
/** The innermost component the error is inside, when it is inside one whose id could be read. */
|
|
512
2193
|
readonly componentId?: string;
|
|
513
2194
|
}
|
|
514
|
-
//#endregion
|
|
515
|
-
//#region src/validate.d.ts
|
|
516
2195
|
type ReportValidation = {
|
|
517
2196
|
readonly valid: true;
|
|
518
2197
|
readonly report: ReportDefinition;
|
|
@@ -537,23 +2216,6 @@ type ReportValidation = {
|
|
|
537
2216
|
* message and no path grows with what the document holds.
|
|
538
2217
|
*/
|
|
539
2218
|
export declare function validateReport(document: unknown): ReportValidation;
|
|
540
|
-
//#endregion
|
|
541
|
-
//#region src/limits.d.ts
|
|
542
|
-
/**
|
|
543
|
-
* The bounds a report definition is held to, and why each exists.
|
|
544
|
-
*
|
|
545
|
-
* A template is untrusted input, even when an administrator wrote it. Every
|
|
546
|
-
* array, string and number in it is bounded, so that validating, hashing,
|
|
547
|
-
* editing and later laying one out costs work that does not grow with
|
|
548
|
-
* whatever a broken or hostile document holds. An array is measured before
|
|
549
|
-
* any element of it is read.
|
|
550
|
-
*
|
|
551
|
-
* The numbers are chosen, not measured: each sits well above what the three
|
|
552
|
-
* starter reports need (plan 7) and low enough to keep that work small. Two
|
|
553
|
-
* are not chosen, and say where they come from. Raising a bound is safe;
|
|
554
|
-
* lowering one refuses reports that were valid, which once the format is
|
|
555
|
-
* frozen means a new reportSpecVersion.
|
|
556
|
-
*/
|
|
557
2219
|
/**
|
|
558
2220
|
* Errors listed per validation. Past it, one `too-many-errors` entry says
|
|
559
2221
|
* the list was cut short, so a caller never mistakes a partial list for a
|
|
@@ -580,10 +2242,38 @@ export declare const MIN_COLUMNS = 2;
|
|
|
580
2242
|
export declare const MAX_COLUMNS = 4;
|
|
581
2243
|
/** Columns in a table: wider than a landscape page can show legibly, and a bound on per-row work. */
|
|
582
2244
|
export declare const MAX_TABLE_COLUMNS = 32;
|
|
2245
|
+
/**
|
|
2246
|
+
* Tables in a report, counting those inside containers (0062). Chosen, not
|
|
2247
|
+
* measured: each table orders the rows its condition selects, work no step
|
|
2248
|
+
* budget counts, and reads its condition once per detail row, which the
|
|
2249
|
+
* render's budget does; a report of more lists than eight is several
|
|
2250
|
+
* reports. Ordering the runtime's `MAX_DETAIL_ROWS` once, by two keys,
|
|
2251
|
+
* took a median of 0.5 seconds (Node 24.21, an Intel i9-10900K, 15 October
|
|
2252
|
+
* 2026, as measured beside that bound). What eight cost at that bound was
|
|
2253
|
+
* measured on the same machine and Node on 15 November 2026, the median of
|
|
2254
|
+
* five runs of the built runtime's `resolveReport` after one that warmed
|
|
2255
|
+
* it, each table of two columns grouped by one field, sorted by another
|
|
2256
|
+
* and totalling one sum over its rows: one table without a condition
|
|
2257
|
+
* resolved in 1.4 seconds, eight each selecting an eighth of the rows by a
|
|
2258
|
+
* condition of one read in 4.0, and eight each selecting every row,
|
|
2259
|
+
* 800,000 rows lowered, in 12.2. A condition of one read is charged two
|
|
2260
|
+
* steps, so eight read over every row spend 1,600,000 of the runtime's
|
|
2261
|
+
* `RENDER_STEP_BUDGET`.
|
|
2262
|
+
*/
|
|
2263
|
+
export declare const MAX_TABLES = 8;
|
|
583
2264
|
/** Sort keys on a table. Each one costs a comparison per row pair; a longer sort is usually a missing key. */
|
|
584
2265
|
export declare const MAX_SORT_KEYS = 8;
|
|
585
2266
|
/** Rows under a group or under the table: a subtotal, a discount, two tax lines and a total fit with room to spare. */
|
|
586
2267
|
export declare const MAX_FOOTER_ROWS = 8;
|
|
2268
|
+
/**
|
|
2269
|
+
* The most of its group's first rows a group header may be kept on its
|
|
2270
|
+
* page with (0059). Chosen, not measured: well above the two or three rows
|
|
2271
|
+
* that keep a group from starting at the foot of a page. A count past what
|
|
2272
|
+
* a page holds keeps what fits, so the bound protects no page: it refuses
|
|
2273
|
+
* a count nobody means, and bounds what the renderer adds up for each
|
|
2274
|
+
* group header.
|
|
2275
|
+
*/
|
|
2276
|
+
export declare const MAX_KEEP_WITH_ROWS = 32;
|
|
587
2277
|
/** Fields in one dataset contract: a report prints a fraction of any source table's columns. */
|
|
588
2278
|
export declare const MAX_DATASET_FIELDS = 64;
|
|
589
2279
|
/** Print styles in one report. A report's look is a handful of tokens; this is many handfuls. */
|
|
@@ -594,8 +2284,60 @@ export declare const MAX_STYLE_RULES = 8;
|
|
|
594
2284
|
export declare const MAX_PARAMETERS = 32;
|
|
595
2285
|
/** Asset references: each is a lookup and a byte budget at render time. */
|
|
596
2286
|
export declare const MAX_ASSETS = 64;
|
|
597
|
-
/**
|
|
2287
|
+
/**
|
|
2288
|
+
* The most bytes one image asset may have: 20 MB, the renderer trial's
|
|
2289
|
+
* limit, the plan's "enforced limits" made a number to test, and chosen, not
|
|
2290
|
+
* measured. A builder refuses a file past it before reading it, the runtime
|
|
2291
|
+
* a host's answer past it before copying it, and the renderer bytes past it
|
|
2292
|
+
* before decoding them, from this one constant; an SVG is held to
|
|
2293
|
+
* `MAX_SVG_BYTES` besides.
|
|
2294
|
+
*/
|
|
2295
|
+
export declare const MAX_ASSET_BYTES: number;
|
|
2296
|
+
/**
|
|
2297
|
+
* The most bytes a report may have as a draft: the UTF-8 length of its
|
|
2298
|
+
* JSON, which is what a client sends and a server can count before it
|
|
2299
|
+
* parses anything, so a route can bound its body by this one constant.
|
|
2300
|
+
* 256 KiB, the least power of two that is at least sixteen times the
|
|
2301
|
+
* largest report definition the corpus exports, starters, samples and the
|
|
2302
|
+
* site visit's report among them. That is the XRechnung sample, 16,254
|
|
2303
|
+
* bytes, an e-invoice being the report with the most terms to state; the
|
|
2304
|
+
* next is 16,027 and the smallest 3,956 (measured on 2026-10-28 on an
|
|
2305
|
+
* Apple M2 under Node 22.23.3, as
|
|
2306
|
+
* `new TextEncoder().encode(JSON.stringify(report)).byteLength`). A
|
|
2307
|
+
* report sixteen times the richest one is a document that should be
|
|
2308
|
+
* several, and the limit is a quarter of the mebibyte Fastify reads by
|
|
2309
|
+
* default, which a draft's request should not need to exceed.
|
|
2310
|
+
*
|
|
2311
|
+
* The factor is chosen, and the bounds above allow far more: one region of
|
|
2312
|
+
* `MAX_REGION_COMPONENTS` text components that each hold `MAX_TEXT_LENGTH`
|
|
2313
|
+
* characters holds five million characters. A report of that kind
|
|
2314
|
+
* validates and is not kept as a draft. Raising the limit is safe;
|
|
2315
|
+
* lowering it refuses reports that were kept. The corpus's
|
|
2316
|
+
* `report-size.test.ts` holds every report there to the limit, and the
|
|
2317
|
+
* limit to this factor.
|
|
2318
|
+
*/
|
|
2319
|
+
export declare const MAX_REPORT_BYTES = 262144;
|
|
2320
|
+
/**
|
|
2321
|
+
* Pixels a side of a PNG or a JPEG asset: the renderer trial's limit too,
|
|
2322
|
+
* and as chosen. What pictures of this size cost the renderer to embed is
|
|
2323
|
+
* measured beside report-render-pdf's `MAX_IMAGE_DATA`, which bounds a
|
|
2324
|
+
* render by them. `imageHeader` holds a picture to it, where a person adds
|
|
2325
|
+
* one and where it prints.
|
|
2326
|
+
*/
|
|
2327
|
+
export declare const MAX_ASSET_SIDE = 4096;
|
|
2328
|
+
/** Series in a chart: a colour each from the palette, so that the legend tells every one apart. Derived, not chosen. */
|
|
2329
|
+
export declare const MAX_CHART_SERIES: 8;
|
|
2330
|
+
/** The least a chart's side: under an inch (72 points) holds no plot beneath its title and its labels. Chosen, not measured. */
|
|
2331
|
+
export declare const MIN_CHART_SIDE = 72;
|
|
2332
|
+
/** Aggregates: each is a pass over the detail rows, per group, once per table that selects its rows (0062), and once overall. */
|
|
598
2333
|
export declare const MAX_AGGREGATES = 32;
|
|
2334
|
+
/**
|
|
2335
|
+
* VAT categories an e-invoice declares, each a VAT breakdown (BG-23) its
|
|
2336
|
+
* XML writes and a basis and an amount its page reads. Germany's two rates,
|
|
2337
|
+
* an exempt category and a reverse-charged one take four; eight is twice
|
|
2338
|
+
* that, and a list of breakdowns no invoice prints is refused unread.
|
|
2339
|
+
*/
|
|
2340
|
+
export declare const MAX_VAT_CATEGORIES = 8;
|
|
599
2341
|
/** Inline runs in one paragraph or group header. A paragraph with more bindings than this is a table. */
|
|
600
2342
|
export declare const MAX_INLINES = 64;
|
|
601
2343
|
/**
|
|
@@ -609,6 +2351,55 @@ export declare const MAX_KEY_LENGTH = 64;
|
|
|
609
2351
|
export declare const MAX_TEXT_LENGTH = 10000;
|
|
610
2352
|
/** Characters in a title, label, column header, empty-state text or parameter default: one line, generously. */
|
|
611
2353
|
export declare const MAX_LABEL_LENGTH = 200;
|
|
2354
|
+
/**
|
|
2355
|
+
* Keys in a formancy data path a dataset field is read from (0042): a
|
|
2356
|
+
* field in a group in a group, sixteen deep. Chosen, not measured: formancy
|
|
2357
|
+
* bounds no nesting, and a person filling in a form does not follow one
|
|
2358
|
+
* deeper than a few groups. It bounds a path to 1,039 characters, so no
|
|
2359
|
+
* path a message names grows with what a document holds.
|
|
2360
|
+
*/
|
|
2361
|
+
export declare const MAX_FORM_PATH_KEYS = 16;
|
|
2362
|
+
/**
|
|
2363
|
+
* Characters in a member a dataset field is read from: a matrix row's
|
|
2364
|
+
* value or a selectboxes option's (0042). Not chosen: formancy's schema
|
|
2365
|
+
* writes both from 1 to 200 characters, so a longer one names nothing a
|
|
2366
|
+
* form could hold.
|
|
2367
|
+
*/
|
|
2368
|
+
export declare const MAX_FORM_MEMBER_LENGTH = 200;
|
|
2369
|
+
/**
|
|
2370
|
+
* Form versions one binding is read differently in (0048): the overrides
|
|
2371
|
+
* a review writes on a field, or on the detail's repeater, one for each
|
|
2372
|
+
* version that moved or removed it. Chosen, not measured: a field moved
|
|
2373
|
+
* by 64 versions of its form is read from a form that has become another
|
|
2374
|
+
* one, and a report better started again from it (0045). It bounds a
|
|
2375
|
+
* binding to 64 hashes, so no binding grows with what a document holds.
|
|
2376
|
+
*/
|
|
2377
|
+
export declare const MAX_FORM_OVERRIDES = 64;
|
|
2378
|
+
/**
|
|
2379
|
+
* Languages a report is written in, its own among them (0063). Chosen, not
|
|
2380
|
+
* measured: the European Union's official languages are twenty-four, and a
|
|
2381
|
+
* report is validated once for each language it declares.
|
|
2382
|
+
*/
|
|
2383
|
+
export declare const MAX_LANGUAGES = 24;
|
|
2384
|
+
/**
|
|
2385
|
+
* Words one translation holds, and expressions that print words: each list
|
|
2386
|
+
* bounded by it (0063). 1,024, the least power of two that is at least
|
|
2387
|
+
* sixteen times the most a report the corpus exports holds of both: the
|
|
2388
|
+
* XRechnung sample, 36 distinct words and 13 expression runs where words
|
|
2389
|
+
* stand, 49 (measured on 2026-11-15 on an Intel i9-10900K under Windows 11
|
|
2390
|
+
* and Node 24.21.0, as the distinct texts `reportWords` gives and the
|
|
2391
|
+
* distinct sources `wordExpressionSites` gives). That sample written in
|
|
2392
|
+
* `MAX_LANGUAGES` languages, each translation as long as its word, is
|
|
2393
|
+
* 91,113 bytes, inside `MAX_REPORT_BYTES`.
|
|
2394
|
+
*
|
|
2395
|
+
* The format admits far more words than this: every region may hold
|
|
2396
|
+
* `MAX_REGION_COMPONENTS` texts of `MAX_INLINES` runs. Such a report
|
|
2397
|
+
* validates and cannot be translated whole: each word past the bound stays
|
|
2398
|
+
* missing in that language, said as report-core's `word-missing`, and a
|
|
2399
|
+
* render in it is refused. The corpus's `report-size.test.ts` holds the
|
|
2400
|
+
* bound to this factor.
|
|
2401
|
+
*/
|
|
2402
|
+
export declare const MAX_WORDS = 1024;
|
|
612
2403
|
/** Characters in a CEL expression. An expression is a formula, not a program; the runtime bounds its evaluation too. */
|
|
613
2404
|
export declare const MAX_EXPRESSION_LENGTH = 1024;
|
|
614
2405
|
/** Digits after the decimal point, for fields, formats and rounding. Covers every currency's minor unit and unit prices to many places. */
|
|
@@ -628,22 +2419,572 @@ export declare const MAX_LENGTH_PT = 14400;
|
|
|
628
2419
|
* not hold a word of body text.
|
|
629
2420
|
*/
|
|
630
2421
|
export declare const MIN_PRINTABLE_PT = 72;
|
|
631
|
-
//#endregion
|
|
632
|
-
//#region src/syntax.d.ts
|
|
633
2422
|
/**
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
2423
|
+
* Bytes in an SVG asset, both as the file comes and as `cleanSvg` writes it:
|
|
2424
|
+
* the written form can be several times its input -- a relative path written
|
|
2425
|
+
* as absolute coordinates, a colour name as `#rrggbb` -- so a drawing whose
|
|
2426
|
+
* cleaned form would pass this is refused when it is approved, not at every
|
|
2427
|
+
* print after. A logo is kilobytes; the exporters' invented samples were
|
|
2428
|
+
* 545-2,520 bytes in and 483-994 out. At the bound the cleaner itself took
|
|
2429
|
+
* at most 179 ms in Node on the costliest it accepts (`MAX_SVG_CASCADE`'s
|
|
2430
|
+
* worst; 3,000 moves, each styled with every property and turned, written
|
|
2431
|
+
* to 1.04 MB, 141-162 ms), 35-120 ms on a mebibyte of each shape of value
|
|
2432
|
+
* `svg-threats.test.ts` holds it to, and 292-331 ms to refuse a mebibyte of
|
|
2433
|
+
* path past MAX_SVG_SEGMENTS (Node alone, on the day these were measured
|
|
2434
|
+
* again); a page of rectangles of that size takes the renderer 0.94 s to
|
|
2435
|
+
* draw.
|
|
2436
|
+
*/
|
|
2437
|
+
export declare const MAX_SVG_BYTES = 1048576;
|
|
2438
|
+
/**
|
|
2439
|
+
* Element levels in a drawing, the root's included, as the file nests them
|
|
2440
|
+
* and as `cleanSvg` writes them; also the longest chain of gradients that
|
|
2441
|
+
* name each other. pdfmake's XML reader and svg-to-pdfkit both recurse once
|
|
2442
|
+
* per level, and 5,000 levels overflowed the stack in a probe. 32 and 64
|
|
2443
|
+
* levels with a transform each cost the same as none (122 ms to render, 59-65
|
|
2444
|
+
* ms to pixels), so this bounds recursion, not time. The deepest exporter
|
|
2445
|
+
* sample nests four.
|
|
2446
|
+
*/
|
|
2447
|
+
export declare const MAX_SVG_DEPTH = 32;
|
|
2448
|
+
/**
|
|
2449
|
+
* Elements in a cleaned drawing. svg-to-pdfkit re-reads and draws every one
|
|
2450
|
+
* on every page it is drawn on, at about 34 microseconds an element: 10,000
|
|
2451
|
+
* one-unit rectangles took 545 ms of the renderer's final pass against 55
|
|
2452
|
+
* without them, and 234 ms (DPR 1) and 198 ms (DPR 2) to pixels.
|
|
2453
|
+
*/
|
|
2454
|
+
export declare const MAX_SVG_ELEMENTS = 10000;
|
|
2455
|
+
/**
|
|
2456
|
+
* What one drawing costs a reader to paint, in weighted segments. Each
|
|
2457
|
+
* command the converter draws counts: a move, a line or a close 1, a curve
|
|
2458
|
+
* 3 (10,000 short crossing cubics cost about what 30,000 such lines do, in
|
|
2459
|
+
* Node and in Chromium; a cubic spanning the box costs less than three
|
|
2460
|
+
* lines that do, 10,000 of them 238 ms against 933 ms for 30,000 lines,
|
|
2461
|
+
* as review measured the same day), an arc 3 for each curve svg-to-pdfkit splits it
|
|
2462
|
+
* into (one per 60 degrees, `source.js:1054` at its default precision), and
|
|
2463
|
+
* an arc that ends where it starts, which draws nothing, 1. A stroked shape
|
|
2464
|
+
* counts its commands twice more, three times in all when it is also filled
|
|
2465
|
+
* (10,000 lines filled and stroked cost about what 30,000 filled do). A clip
|
|
2466
|
+
* path's commands count once for every element it clips, a gradient's stops
|
|
2467
|
+
* once for every shape painted with it, and a dashed stroke one more for
|
|
2468
|
+
* each dash it could draw.
|
|
637
2469
|
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
2470
|
+
* A rasteriser's worst is a path whose every segment crosses the whole
|
|
2471
|
+
* box: it pays for each segment on every row of pixels the segment spans,
|
|
2472
|
+
* so the cost grows faster than the count. A zigzag of such lines took 121
|
|
2473
|
+
* ms to pixels at DPR 1 and 132 ms at DPR 2 in a 15 mm box at this bound,
|
|
2474
|
+
* 268-276 ms at 15,000, 490-500 ms at 20,000 and 1.15-1.27 s at 30,000; the
|
|
2475
|
+
* worst accepted -- that zigzag in a clipped group, with three more clipped
|
|
2476
|
+
* shapes, every group the bounds allow -- took 190 and 392 ms at 15 mm and
|
|
2477
|
+
* 269 and 550 ms page-wide, against 63 to 89 ms for a starter page (on
|
|
2478
|
+
* 2026-10-18, in the Chromium and pdfjs-dist above, medians of five). The
|
|
2479
|
+
* same count of 30,000 in paths whose segments were a seventh of the box
|
|
2480
|
+
* long took 184-295 ms, and spanning the box 1.15 to 1.84 s. A logo whose
|
|
2481
|
+
* curves are short costs far less than its count says, and one of more
|
|
2482
|
+
* than this is refused, to be simplified in the drawing program.
|
|
640
2483
|
*/
|
|
2484
|
+
export declare const MAX_SVG_SEGMENTS = 10000;
|
|
2485
|
+
/**
|
|
2486
|
+
* Transparency groups in one drawing, in units: a clip-path reference 1, a
|
|
2487
|
+
* group with an opacity under 1 1, and a shape painted with a gradient
|
|
2488
|
+
* whose stops come out translucent 2. svg-to-pdfkit makes every one a
|
|
2489
|
+
* group the size of the whole page, whatever the size of the logo, and a
|
|
2490
|
+
* translucent gradient two page-sized objects, so the cost is the page's
|
|
2491
|
+
* pixels: about 15 ms a clip at DPR 1 and 59 ms at DPR 2, 30 ms and 117 ms
|
|
2492
|
+
* a translucent gradient, 1.4 ms and 5.2 ms a group opacity. Four units keep
|
|
2493
|
+
* the worst accepted at about 60 ms more than a starter page at DPR 1 and
|
|
2494
|
+
* 240 ms at DPR 2, and admit every exporter sample: Figma's clipped frame is
|
|
2495
|
+
* 1, Figma's fade with a layer at 80 % is 3, Canva's two shapes 2. A
|
|
2496
|
+
* translucent stop is kept because a bound this small admits them; a Canva
|
|
2497
|
+
* logo of five shapes or more, each clipped, is refused.
|
|
2498
|
+
*/
|
|
2499
|
+
export declare const MAX_SVG_GROUPS = 4;
|
|
2500
|
+
/**
|
|
2501
|
+
* Stops in one gradient. Each use of a 64-stop gradient writes 10.9 kB into
|
|
2502
|
+
* the PDF and costs a reader about half a millisecond; `MAX_SVG_SEGMENTS`
|
|
2503
|
+
* bounds the uses, counting a gradient's stops once each. A logo's
|
|
2504
|
+
* gradients have two to five.
|
|
2505
|
+
*/
|
|
2506
|
+
export declare const MAX_SVG_STOPS = 64;
|
|
2507
|
+
/**
|
|
2508
|
+
* Entries in a stroke's dash array, after an odd list is doubled as SVG
|
|
2509
|
+
* doubles it. Every dash it draws counts against `MAX_SVG_SEGMENTS` too: a
|
|
2510
|
+
* spiral of 4,096 segments dashed at a period of 0.01 units, about 900,000
|
|
2511
|
+
* dashes, cost 219-265 ms to pixels against 70-102 ms dashed at a period of
|
|
2512
|
+
* one unit. Skia gives up at a count of its own; another reader may not.
|
|
2513
|
+
*/
|
|
2514
|
+
export declare const MAX_SVG_DASHES = 32;
|
|
2515
|
+
/**
|
|
2516
|
+
* The largest magnitude of any number in a drawing; of every entry of the
|
|
2517
|
+
* transform composed from the root down to each element, and of its
|
|
2518
|
+
* inverse, which svg-to-pdfkit computes for every clip and group opacity;
|
|
2519
|
+
* and of the matrix a gradient is drawn under, its shape's and its box's
|
|
2520
|
+
* composed with its own. With a point and a matrix both at it in a viewBox
|
|
2521
|
+
* one unit wide, the renderer drew in 115 ms with no warning, and the
|
|
2522
|
+
* device coordinates stayed near 10^13 points, far below the 10^21 at
|
|
2523
|
+
* which PDFKit throws; past it, two groups shrinking a millionfold each
|
|
2524
|
+
* under a clip, or a gradient composed to a million cubed, threw from
|
|
2525
|
+
* inside PDFKit. An e-invoice's PDF/A-3 keeps none of PDF/A-1's 32,767 for
|
|
2526
|
+
* a real: veraPDF 1.30.3's PDF/A-3b profile holds a real to 3.403 × 10^38
|
|
2527
|
+
* (its rule 6.1.13-2), past PDFKit's 10^21, and an integer to 2,147,483,647
|
|
2528
|
+
* (6.1.13-1), which the numbers the converter computes from these bounds can
|
|
2529
|
+
* pass -- a group's box under a shrink of 10^6 in a box of a point reached
|
|
2530
|
+
* 7.85 × 10^10 -- so the renderer holds an SVG in an e-invoice to that by
|
|
2531
|
+
* the extent `cleanSvg` measures (`svg-extent.ts`; report-render-pdf's
|
|
2532
|
+
* `svg-pdfa.ts`), and no bound here is lowered for it.
|
|
2533
|
+
*/
|
|
2534
|
+
export declare const MAX_SVG_COORDINATE = 1000000;
|
|
2535
|
+
/**
|
|
2536
|
+
* Simple selectors -- a type, a class or an id -- in all of a drawing's
|
|
2537
|
+
* stylesheets together, after comma lists are split. Indexing the rules by
|
|
2538
|
+
* id, class and type makes matching linear in the rules that could match,
|
|
2539
|
+
* but rules that all match every element cannot be shortened that way, so
|
|
2540
|
+
* the work is this bound times the combinations of classes elements hold.
|
|
2541
|
+
* The rules one combination matches are merged once: 256 one-class rules,
|
|
2542
|
+
* each declaring every kept property, all matching 10,000 elements, took
|
|
2543
|
+
* the cleaner 85-102 ms in Node and 63-81 ms in Chromium, against 1.9 s
|
|
2544
|
+
* when every element read every rule. Elements of combinations of their
|
|
2545
|
+
* own are bounded by `MAX_SVG_CASCADE`. Illustrator's samples hold three.
|
|
2546
|
+
*/
|
|
2547
|
+
export declare const MAX_SVG_RULES = 256;
|
|
2548
|
+
/**
|
|
2549
|
+
* The cascade's work, in all: each rule compared with a combination of
|
|
2550
|
+
* type, id and classes an element holds, and each declaration merged for it.
|
|
2551
|
+
* Merging once per combination makes ten thousand elements of one class one
|
|
2552
|
+
* merge, but elements that each hold a combination of their own are one
|
|
2553
|
+
* merge each: 9,990 elements, each of its own set of fourteen classes, under
|
|
2554
|
+
* 242 type rules declaring every kept property took the cleaner 1.8 s in
|
|
2555
|
+
* Node. At this bound the costliest shape measured -- 5,000 elements each
|
|
2556
|
+
* of its own pair of 101 classes, under 98 type rules of one declaration --
|
|
2557
|
+
* took 179 ms (158-271), within what the worst file `MAX_SVG_BYTES` admits
|
|
2558
|
+
* costs, and that shape of 9,990 elements is refused in 136 ms. An
|
|
2559
|
+
* Illustrator export, one class an element from a few dozen, merges a few
|
|
2560
|
+
* hundred times. Measured on 2026-10-18 under Node 24.21.0, medians of five,
|
|
2561
|
+
* on the machine and the terms above.
|
|
2562
|
+
*/
|
|
2563
|
+
export declare const MAX_SVG_CASCADE = 1000000;
|
|
2564
|
+
/**
|
|
2565
|
+
* Distinct names `cleanSvg` lists among what it removed; removals of every
|
|
2566
|
+
* further name are counted, not named, so that the list a person is shown
|
|
2567
|
+
* does not grow with what a file holds. Chosen, not measured: the Inkscape
|
|
2568
|
+
* sample, the most any exporter's sample removes, lists 26 names -- its
|
|
2569
|
+
* editor's attributes, namespaces, layers and text properties -- and a
|
|
2570
|
+
* bound of 16 would have cut it short.
|
|
2571
|
+
*/
|
|
2572
|
+
export declare const MAX_SVG_REMOVED_NAMES = 32;
|
|
2573
|
+
/**
|
|
2574
|
+
* The bounds of a font asset (0040), each measured on 21 October 2026 on
|
|
2575
|
+
* an Intel i9-10900K under Windows 11 and Node 24.21.0, shared with another
|
|
2576
|
+
* workflow's builds (8 to 11 % load), medians of seven reads: on the
|
|
2577
|
+
* costliest font these three admit, made in code; on the 447 `.ttf` and
|
|
2578
|
+
* `.ttc` files of the machine's Windows fonts directory, never copied into
|
|
2579
|
+
* the repository; and on the faces the renderer ships. The reads, and the
|
|
2580
|
+
* tally of the machine's fonts, were measured again on 22 October 2026, on
|
|
2581
|
+
* the reader as review left it, at 1 to 12 % load.
|
|
2582
|
+
*/
|
|
2583
|
+
/**
|
|
2584
|
+
* Bytes in a font: an image asset's 20 MB (`MAX_ASSET_BYTES`), which a
|
|
2585
|
+
* builder, the runtime and the renderer already hold an asset to. The
|
|
2586
|
+
* costliest font it admits -- 65,534 glyphs each walked flag by flag, a
|
|
2587
|
+
* format 12 map of 131,066 characters -- read in 60 ms (57-65); Malgun
|
|
2588
|
+
* Gothic, 13.5 MB and 28,215 glyphs, in 16 to 17 ms, Liberation Sans in
|
|
2589
|
+
* 0.8.
|
|
2590
|
+
* What subsetting a large font costs a render is bounded by the outlines'
|
|
2591
|
+
* points and work together (`MAX_FONT_POINTS`, `MAX_FONT_OUTLINE_WORK`),
|
|
2592
|
+
* not by its bytes; of the machine's fonts, two collections and
|
|
2593
|
+
* SimSun-ExtB, 21.9 MB, are past it.
|
|
2594
|
+
*/
|
|
2595
|
+
export declare const MAX_FONT_BYTES: number;
|
|
2596
|
+
/**
|
|
2597
|
+
* Characters one font may map: 131,072, twice the BMP. A kilobyte of
|
|
2598
|
+
* format 12 can map every code point there is, a Set of 1,114,112 entries
|
|
2599
|
+
* that took 150 ms and 60 to 80 MiB of heap to build; at this bound the Set
|
|
2600
|
+
* takes 8 ms and 5 MiB. Of the 412 fonts on the machine the reader
|
|
2601
|
+
* accepts, the most a font maps is 28,530 (HP Simplified Hans); Roboto maps
|
|
2602
|
+
* 927, Liberation Sans 2,327. Chosen, at more than four times the most
|
|
2603
|
+
* measured.
|
|
2604
|
+
*/
|
|
2605
|
+
export declare const MAX_FONT_CHARACTERS = 131072;
|
|
2606
|
+
/**
|
|
2607
|
+
* A simple glyph's points times its contours. fontkit, through which
|
|
2608
|
+
* PDFKit subsets a font, looks every point up among the glyph's contour
|
|
2609
|
+
* ends: one glyph of 32,767 contours and 65,534 points, 66 KB of a font
|
|
2610
|
+
* the reader otherwise accepts, took PDFKit 1.6 s to embed, and 16,000
|
|
2611
|
+
* contours of 32,000 points 0.4 s, four times as long for each doubling.
|
|
2612
|
+
* At this bound a glyph costs it under a millisecond: 200 such glyphs
|
|
2613
|
+
* embedded in 168 ms. The most of any glyph in the machine's fonts is
|
|
2614
|
+
* 160,000 (200 contours of 800 points, Lucida Sans Unicode); Liberation
|
|
2615
|
+
* Sans's is 28,224, Roboto's 3,549.
|
|
2616
|
+
*/
|
|
2617
|
+
export declare const MAX_FONT_GLYPH_WORK = 1048576;
|
|
2618
|
+
/**
|
|
2619
|
+
* The points of every simple glyph of a font, together: 2,097,152 (2^21).
|
|
2620
|
+
* A subset holds every glyph a printed character reaches -- a composite's
|
|
2621
|
+
* components among them, which may be every glyph the font has -- and
|
|
2622
|
+
* fontkit decodes each point of each into an object of its own when PDFKit
|
|
2623
|
+
* subsets. A font this reader accepted under the bounds above, one 'A'
|
|
2624
|
+
* composed of 36,733 glyphs of 16 contours and 65,536 points, took PDFKit
|
|
2625
|
+
* 162 s to embed (0043). Of the 412 fonts on the machine the reader
|
|
2626
|
+
* accepts, the most points a font holds is 1,886,654 (Malgun Gothic Bold,
|
|
2627
|
+
* a Hangul font whose script no report prints), Noto Sans 65,560 and
|
|
2628
|
+
* Liberation Sans 35,285. Chosen just past the most measured, since the
|
|
2629
|
+
* cost is what a render waits for, and the fonts that come near it hold
|
|
2630
|
+
* Hangul, Han or a dozen scripts, which no report prints. At this bound
|
|
2631
|
+
* and the next, the costliest subset found -- 31 glyphs of 8 contours and
|
|
2632
|
+
* 65,536 points of one-byte coordinates and 65,500 glyphs of one point,
|
|
2633
|
+
* one composite made of them all -- took PDFKit 1.3 to 1.4 s to embed,
|
|
2634
|
+
* over three runs.
|
|
2635
|
+
* Measured on 22 October 2026 on an Intel i9-10900K under Windows 11 and
|
|
2636
|
+
* Node 24.21.0, shared with two other workflows' builds.
|
|
2637
|
+
*/
|
|
2638
|
+
export declare const MAX_FONT_POINTS = 2097152;
|
|
2639
|
+
/**
|
|
2640
|
+
* Every simple glyph's points times its contours, together: 16,777,216
|
|
2641
|
+
* (2^24), sixteen glyphs at `MAX_FONT_GLYPH_WORK`. fontkit looks each point
|
|
2642
|
+
* up among its glyph's contour ends, so a font of fewer points than the
|
|
2643
|
+
* bound above can still cost a subset this much; sixteen glyphs at the
|
|
2644
|
+
* bound took PDFKit 44 ms to embed. The most of the machine's fonts is
|
|
2645
|
+
* 12,342,110 (Malgun Gothic), Liberation Sans's 123,704. Chosen past the
|
|
2646
|
+
* most measured, as above. Measured as above.
|
|
2647
|
+
*/
|
|
2648
|
+
export declare const MAX_FONT_OUTLINE_WORK = 16777216;
|
|
2649
|
+
/**
|
|
2650
|
+
* The components of every composite glyph of a font, together: 262,144
|
|
2651
|
+
* (2^18). PDFKit's subset decodes a composite's components into a list,
|
|
2652
|
+
* however many of them name the same glyph: one composite of 3,490,000
|
|
2653
|
+
* components, what 20 MiB holds, took PDFKit 1.0 s and 431 MiB of heap to
|
|
2654
|
+
* embed for one 'A'. The most of the machine's fonts is 68,743 (HP
|
|
2655
|
+
* Simplified Hans Light), and the most in one glyph 15; Liberation Sans
|
|
2656
|
+
* holds 2,131, Roboto 1,321. Chosen at nearly four times the most measured.
|
|
2657
|
+
* Measured as above.
|
|
2658
|
+
*/
|
|
2659
|
+
export declare const MAX_FONT_COMPONENTS = 262144;
|
|
2660
|
+
/**
|
|
2661
|
+
* A font's line, in ems: its horizontal header's ascender less its
|
|
2662
|
+
* descender, over its units to the em, which is how tall pdfmake lays out
|
|
2663
|
+
* each line of it (PDFKit's `lineHeight`, from fontkit's `hhea.ascent`,
|
|
2664
|
+
* `hhea.descent` and `head.unitsPerEm`; the line gap unread), its
|
|
2665
|
+
* baseline the ascender below the line's top. The renderer counts a line
|
|
2666
|
+
* of text as its size times this when it refuses a report too long for its
|
|
2667
|
+
* page limit before laying it out (`bound.ts`), so the floor bounds how
|
|
2668
|
+
* many lines a limit admits: at 0.5, 2.3 times what Roboto's 1.172 does.
|
|
2669
|
+
* Unbounded, a face of a line of nothing printed a report of 20,000 lines,
|
|
2670
|
+
* limited to one page, on one spot of that page, in 921 ms, and one of 4
|
|
2671
|
+
* units to the em 2,000 lines within 35 points, each over the last (0040).
|
|
2672
|
+
* The ceiling refuses metrics no font measured comes near; a line too tall
|
|
2673
|
+
* for the page is refused at print besides.
|
|
2674
|
+
* Measured on 22 October 2026 on the machine above, over the 425 fonts the
|
|
2675
|
+
* reader accepts of Roboto 3.014's four faces, Liberation Sans, Serif and
|
|
2676
|
+
* Mono 2.1.5's eight, Noto Sans Regular (0043's Sources) and the 447 files
|
|
2677
|
+
* of the machine's Windows fonts directory: the shortest line is Ink
|
|
2678
|
+
* Free's, 0.864, then Footlight MT Light's, 0.915 and Palace Script MT's,
|
|
2679
|
+
* 0.926; the tallest Sans Serif Collection's, 2.651, then Javanese Text's,
|
|
2680
|
+
* 2.271 and Myanmar Text Bold's, 1.904; Liberation's are 1.107 to 1.133,
|
|
2681
|
+
* Roboto's 1.172 and Noto Sans's 1.362. fontkit read every one's ascender,
|
|
2682
|
+
* descender and units as the reader does. Chosen with a margin: the floor
|
|
2683
|
+
* half the shortest line, rounded up to half an em, 42 % below it; the
|
|
2684
|
+
* ceiling one and a half times the tallest, rounded to a whole em, 51 %
|
|
2685
|
+
* above it.
|
|
2686
|
+
*/
|
|
2687
|
+
export declare const MIN_FONT_LINE = 0.5;
|
|
2688
|
+
export declare const MAX_FONT_LINE = 4;
|
|
641
2689
|
/** Whether `value` is an identifier a report can use for a component, style, dataset, asset or table column. */
|
|
642
2690
|
export declare function isIdentifier(value: unknown): value is string;
|
|
643
2691
|
/** Whether `value` is a field key: the id of a dataset field, a parameter or an aggregate. */
|
|
644
2692
|
export declare function isFieldKey(value: unknown): value is string;
|
|
645
|
-
|
|
646
|
-
|
|
2693
|
+
/**
|
|
2694
|
+
* Whether `value` is a formancy data path in one scope, as a dataset field
|
|
2695
|
+
* is read from a submission (0042): field keys joined by dots, as
|
|
2696
|
+
* `modelDataPaths` writes a group's child, `address.street`, and at most
|
|
2697
|
+
* `MAX_FORM_PATH_KEYS` of them. A repeater's `[]` is not in it, since a
|
|
2698
|
+
* path is read in the submission's scope or a row's, never across both.
|
|
2699
|
+
*/
|
|
2700
|
+
export declare function isFormPath(value: unknown): value is string;
|
|
2701
|
+
/** Whether `value` is a formancy form's id: what a report's provenance names, and the runtime's data source (0041). */
|
|
2702
|
+
export declare function isFormId(value: unknown): value is string;
|
|
2703
|
+
/** Whether `value` is a locale as a report writes one: what the runtime holds the locale a form source's labels were read in to (0063), so that the two cannot read a locale differently. */
|
|
2704
|
+
export declare function isLocale(value: unknown): value is string;
|
|
2705
|
+
/**
|
|
2706
|
+
* Whether `value` is an asset's digest as a report declares one, `sha256:`
|
|
2707
|
+
* and 64 lower-case hex digits: the one rule for it, which the report
|
|
2708
|
+
* server judges a path's digest by, with `sha256:` before it, and its store
|
|
2709
|
+
* names a file by (0049).
|
|
2710
|
+
*/
|
|
2711
|
+
export declare function isDigest(value: unknown): value is string;
|
|
2712
|
+
/** Whether `value` is a form version's hash as `schemaHash` writes one: what a report's provenance pins, and the runtime's data source (0041). */
|
|
2713
|
+
export declare function isSchemaHash(value: unknown): value is string;
|
|
2714
|
+
/** `sha256:` and the lower-case hex SHA-256 of exactly `bytes`; @noble/hashes' TypeError for anything that is not a Uint8Array. */
|
|
2715
|
+
export declare function assetDigest(bytes: Uint8Array): string;
|
|
2716
|
+
/** A PNG's header, as the renderer needs it to check the image data: its scanlines follow from the size, the bits a pixel and the interlace. */
|
|
2717
|
+
interface PngHeader {
|
|
2718
|
+
readonly ok: true;
|
|
2719
|
+
readonly mediaType: 'image/png';
|
|
2720
|
+
readonly width: number;
|
|
2721
|
+
readonly height: number;
|
|
2722
|
+
readonly bitsPerPixel: number;
|
|
2723
|
+
/** Adam7, the one interlace method PNG defines. */
|
|
2724
|
+
readonly interlaced: boolean;
|
|
2725
|
+
/** The image data, every IDAT chunk's joined in order: compressed, and not inflated here. */
|
|
2726
|
+
readonly data: Uint8Array<ArrayBuffer>;
|
|
2727
|
+
}
|
|
2728
|
+
/** A JPEG's frame, as it is shown. */
|
|
2729
|
+
interface JpegHeader {
|
|
2730
|
+
readonly ok: true;
|
|
2731
|
+
readonly mediaType: 'image/jpeg';
|
|
2732
|
+
readonly width: number;
|
|
2733
|
+
readonly height: number;
|
|
2734
|
+
/** Grey, RGB or CMYK, as PDFKit draws a JPEG of one, three or four components (pdfkit.js 3808-3812). */
|
|
2735
|
+
readonly components: 1 | 3 | 4;
|
|
2736
|
+
/**
|
|
2737
|
+
* How its first Exif block turns or mirrors it, 2 to 8, as PDFKit reads
|
|
2738
|
+
* the tag and draws it; absent where the picture is upright -- the block
|
|
2739
|
+
* says 1, says nothing, or is not there. `width` and `height` are
|
|
2740
|
+
* already the turned picture's. A writer that embeds the bytes as they
|
|
2741
|
+
* are and cannot say what its reader does with the tag refuses one that
|
|
2742
|
+
* has it (0068).
|
|
2743
|
+
*/
|
|
2744
|
+
readonly orientation?: 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
2745
|
+
}
|
|
2746
|
+
type RasterHeader = PngHeader | JpegHeader;
|
|
2747
|
+
/** Why a PNG's or a JPEG's bytes are refused, each the first thing found wrong with them. */
|
|
2748
|
+
export declare const IMAGE_REFUSAL_CODES: readonly ["not-raster", "malformed", "no-pixels", "too-large"];
|
|
2749
|
+
type ImageRefusalCode = (typeof IMAGE_REFUSAL_CODES)[number];
|
|
2750
|
+
/** A refusal, said in English after the image's name -- the renderer says `the image asset logo ${message}` -- and, for one of its size, the size, for a person's own language. */
|
|
2751
|
+
type ImageRefusal = {
|
|
2752
|
+
readonly ok: false;
|
|
2753
|
+
readonly code: 'not-raster' | 'malformed';
|
|
2754
|
+
readonly message: string;
|
|
2755
|
+
} | {
|
|
2756
|
+
readonly ok: false;
|
|
2757
|
+
readonly code: 'no-pixels' | 'too-large';
|
|
2758
|
+
readonly message: string;
|
|
2759
|
+
readonly width: number;
|
|
2760
|
+
readonly height: number;
|
|
2761
|
+
};
|
|
2762
|
+
/**
|
|
2763
|
+
* What an image's bytes are, from their first bytes alone, never a file's
|
|
2764
|
+
* name or a type a browser guessed: a PNG by its signature, a JPEG by its
|
|
2765
|
+
* start of image, and an SVG to be cleaned by `<` after an optional UTF-8
|
|
2766
|
+
* byte order mark and white space, or by a UTF-16 or UTF-32 byte order
|
|
2767
|
+
* mark, so that a person who saved one so is told to save it as UTF-8.
|
|
2768
|
+
* Undefined for anything else. A sniff is no check: the bytes are read
|
|
2769
|
+
* whole by `imageHeader` or by `cleanSvg` next.
|
|
2770
|
+
*/
|
|
2771
|
+
export declare function sniffImage(bytes: Uint8Array): AssetMediaType | undefined;
|
|
2772
|
+
/** A PNG's or a JPEG's header, read as the renderer reads it, or the first thing wrong with it. */
|
|
2773
|
+
export declare function imageHeader(bytes: Uint8Array): RasterHeader | ImageRefusal;
|
|
2774
|
+
/**
|
|
2775
|
+
* What an approved SVG may hold, as tables: the elements kept and the
|
|
2776
|
+
* geometry each is written with, the properties kept and the order they are
|
|
2777
|
+
* written in, and what is removed or refused instead (0030).
|
|
2778
|
+
*
|
|
2779
|
+
* Tables, not switches, so that the tests derive what they check from them:
|
|
2780
|
+
* the differential test reads every cleaned drawing back with another
|
|
2781
|
+
* parser and finds each element and attribute here, never by searching the
|
|
2782
|
+
* output for a phrase. Anything a table does not name is refused, named:
|
|
2783
|
+
* an SVG is untrusted input, and a construct this file has not decided
|
|
2784
|
+
* about fails closed (formancy.ai 0022).
|
|
2785
|
+
*
|
|
2786
|
+
* The lists are svg-to-pdfkit's subset, the converter pdfmake 0.3.11
|
|
2787
|
+
* vendors, cut down to what it draws as a browser draws it. Where the two
|
|
2788
|
+
* disagree -- text in a font pdfmake picks, a filter drawn as nothing -- the
|
|
2789
|
+
* construct is refused rather than drawn otherwise than its author saw it.
|
|
2790
|
+
* Every `source.js:N` cited in the SVG reader's files is a line of pdfmake
|
|
2791
|
+
* 0.3.11's `src/3rd-party/svg-to-pdfkit/source.js`; Node runs a transpiled
|
|
2792
|
+
* copy of it under `js/`, and the browser build bundles it.
|
|
2793
|
+
*/
|
|
2794
|
+
/** The elements a cleaned drawing is written with. */
|
|
2795
|
+
declare const KEPT_ELEMENTS: readonly ["svg", "g", "defs", "path", "rect", "circle", "ellipse", "line", "polyline", "polygon", "linearGradient", "radialGradient", "stop", "clipPath"];
|
|
2796
|
+
/** Why an SVG is refused, each the first thing found that is wrong with it. */
|
|
2797
|
+
export declare const SVG_REFUSAL_CODES: readonly ["not-svg", "not-well-formed", "encoding", "doctype", "text", "raster", "reference", "unsupported", "out-of-range", "too-large", "too-deep"];
|
|
2798
|
+
type SvgRefusalCode = (typeof SVG_REFUSAL_CODES)[number];
|
|
2799
|
+
interface SvgRefusal {
|
|
2800
|
+
readonly ok: false;
|
|
2801
|
+
readonly code: SvgRefusalCode;
|
|
2802
|
+
/** English, for a log or a person: what was found and where, by element path (`svg/g[2]/text`), never a value, then what to do (`SVG_ADVICE`). */
|
|
2803
|
+
readonly message: string;
|
|
2804
|
+
}
|
|
2805
|
+
/** What cleaning removed: names only, never a value. */
|
|
2806
|
+
interface SvgRemoval {
|
|
2807
|
+
readonly kind: SvgRemovalKind;
|
|
2808
|
+
/** The element, attribute or property name as written (`sodipodi:namedview`, `onclick`, `-inkscape-stroke`); for a comment, a declaration or a DOCTYPE, the kind again. */
|
|
2809
|
+
readonly name: string;
|
|
2810
|
+
readonly count: number;
|
|
2811
|
+
}
|
|
2812
|
+
type SvgRemovalKind = 'element' | 'attribute' | 'property' | 'comment' | 'declaration' | 'doctype';
|
|
2813
|
+
interface ViewBox {
|
|
2814
|
+
readonly x: number;
|
|
2815
|
+
readonly y: number;
|
|
2816
|
+
readonly width: number;
|
|
2817
|
+
readonly height: number;
|
|
2818
|
+
}
|
|
2819
|
+
interface SvgExtent {
|
|
2820
|
+
/** The page-sized groups': the largest row sum of the inverse of the linear part of a matrix one is drawn under, and the largest coordinate that inverse takes the viewBox's origin to. */
|
|
2821
|
+
readonly groups: {
|
|
2822
|
+
readonly inverse: number;
|
|
2823
|
+
readonly origin: number;
|
|
2824
|
+
};
|
|
2825
|
+
/** The gradients' painted outside every group: the largest entry of the linear part of a matrix one may be drawn under, its shape's box and its own transform included, and the largest coordinate of that matrix's translation less the viewBox's origin. */
|
|
2826
|
+
readonly patterns: {
|
|
2827
|
+
readonly linear: number;
|
|
2828
|
+
readonly offset: number;
|
|
2829
|
+
};
|
|
2830
|
+
/** The largest entry of a matrix the converter may write in a group's own coordinates: a gradient's inside a group, and the box of what a clip in objectBoundingBox units clips. */
|
|
2831
|
+
readonly local: number;
|
|
2832
|
+
/** The largest coordinate of a point the converter draws an outline with, in the outline's own coordinates, a clip path's included. */
|
|
2833
|
+
readonly own: number;
|
|
2834
|
+
/** The deepest the converter nests the graphics state in one content stream: once as it starts, once for the svg, once for every group and every shape, a group's own stream starting again. A clip path's stream nests two, its own save and its shape's (`source.js:2207-2219`), below any shape in the svg's. */
|
|
2835
|
+
readonly nesting: number;
|
|
2836
|
+
}
|
|
2837
|
+
interface CleanSvg {
|
|
2838
|
+
readonly ok: true;
|
|
2839
|
+
/** The canonical drawing: ASCII, what the approved asset holds. */
|
|
2840
|
+
readonly bytes: Uint8Array;
|
|
2841
|
+
/** The drawing's own coordinates: what `contain` and `cover` keep the proportions of. */
|
|
2842
|
+
readonly viewBox: ViewBox;
|
|
2843
|
+
/** What it costs a reader to paint, in the weighted segments `MAX_SVG_SEGMENTS` bounds. */
|
|
2844
|
+
readonly segments: number;
|
|
2845
|
+
/** The transparency groups it makes, in the units `MAX_SVG_GROUPS` bounds. */
|
|
2846
|
+
readonly groups: number;
|
|
2847
|
+
/** What the converter draws each time it draws it -- moves, lines and closes; curves; elements read, a clip path's for every element it clips; gradient stops written, a gradient's for every shape painted with it -- for the renderer's budget across pages. */
|
|
2848
|
+
readonly drawn: {
|
|
2849
|
+
readonly lines: number;
|
|
2850
|
+
readonly curves: number;
|
|
2851
|
+
readonly elements: number;
|
|
2852
|
+
readonly stops: number;
|
|
2853
|
+
};
|
|
2854
|
+
/** How far the numbers svg-to-pdfkit writes for it reach wherever it is placed, and how deep it nests the graphics state: what the renderer holds an image of it to in an e-invoice's PDF/A-3 (`svg-extent.ts`). */
|
|
2855
|
+
readonly extent: SvgExtent;
|
|
2856
|
+
/** What cleaning removed, by kind and name with a count: names only, never a value; the first `MAX_SVG_REMOVED_NAMES` names. */
|
|
2857
|
+
readonly removed: readonly SvgRemoval[];
|
|
2858
|
+
/** Removals of names past those listed, counted. */
|
|
2859
|
+
readonly removedMore: number;
|
|
2860
|
+
}
|
|
2861
|
+
/** What `checkSvg` accepts: the drawing, which cleaning would not change. */
|
|
2862
|
+
type CheckedSvg = Omit<CleanSvg, 'removed' | 'removedMore'>;
|
|
2863
|
+
export declare function cleanSvg(bytes: Uint8Array): CleanSvg | SvgRefusal;
|
|
2864
|
+
/** The renderer's check: the drawing, when `bytes` are already what `cleanSvg` writes; refused naming the first difference otherwise. */
|
|
2865
|
+
export declare function checkSvg(bytes: Uint8Array): CheckedSvg | SvgRefusal;
|
|
2866
|
+
/**
|
|
2867
|
+
* How a font is refused: the codes, what a person can do about each, and
|
|
2868
|
+
* the refusal the reader throws where it finds a fault and catches once, at
|
|
2869
|
+
* its edge (0040).
|
|
2870
|
+
*
|
|
2871
|
+
* A refusal names what was found and where, by the name of a table this
|
|
2872
|
+
* reader knows, never a byte of the font: no name string, no tag a font
|
|
2873
|
+
* invented, no text of its licence. Numbers the reader decoded -- a
|
|
2874
|
+
* version, a format, the offset where a table runs out -- are said in the
|
|
2875
|
+
* reader's own digits, so a message holds nothing a font chose but a
|
|
2876
|
+
* number.
|
|
2877
|
+
*/
|
|
2878
|
+
/** Why a font is refused, each the first thing found that is wrong with it. */
|
|
2879
|
+
export declare const FONT_REFUSAL_CODES: readonly ["not-a-font", "format", "cff", "variable", "colour", "no-outlines", "embedding", "character-map", "malformed", "too-large"];
|
|
2880
|
+
type FontRefusalCode = (typeof FONT_REFUSAL_CODES)[number];
|
|
2881
|
+
/** The font formats a `format` refusal names. */
|
|
2882
|
+
export declare const FONT_FORMATS: readonly ["collection", "woff", "woff2", "eot", "type-1"];
|
|
2883
|
+
type FontFormat = (typeof FONT_FORMATS)[number];
|
|
2884
|
+
/** Why an fsType refuses embedding, each the first found, in this order. */
|
|
2885
|
+
export declare const FONT_EMBEDDING_REFUSALS: readonly ["invalid", "restricted", "bitmap-only", "no-subsetting"];
|
|
2886
|
+
type FontEmbeddingRefusal = (typeof FONT_EMBEDDING_REFUSALS)[number];
|
|
2887
|
+
/** A refusal, said in English after the font's name -- the renderer says `the font ${message}` -- with, for a format or an embedding, which one, for a person's own language. */
|
|
2888
|
+
type FontRefusal = {
|
|
2889
|
+
readonly ok: false;
|
|
2890
|
+
readonly code: Exclude<FontRefusalCode, 'format' | 'embedding'>;
|
|
2891
|
+
readonly message: string;
|
|
2892
|
+
} | {
|
|
2893
|
+
readonly ok: false;
|
|
2894
|
+
readonly code: 'format';
|
|
2895
|
+
readonly message: string;
|
|
2896
|
+
readonly format: FontFormat;
|
|
2897
|
+
} | {
|
|
2898
|
+
readonly ok: false;
|
|
2899
|
+
readonly code: 'embedding';
|
|
2900
|
+
readonly message: string;
|
|
2901
|
+
readonly embedding: FontEmbeddingRefusal;
|
|
2902
|
+
};
|
|
2903
|
+
/** What a font says it is called, and what it says of its licence, as it says it. */
|
|
2904
|
+
interface FontNames {
|
|
2905
|
+
/** The typographic family (name ID 16), or the family (1). */
|
|
2906
|
+
readonly family: string;
|
|
2907
|
+
/**
|
|
2908
|
+
* The family of name ID 1, where the font states a typographic family
|
|
2909
|
+
* (16) before it and `family` is that one; absent where `family` is name
|
|
2910
|
+
* ID 1 itself. It is the name an application that lists four faces to a
|
|
2911
|
+
* family knows the face by -- Word among them, to which "Probe Sans
|
|
2912
|
+
* Light" is a family and "Probe Sans" another -- so a writer that names
|
|
2913
|
+
* a face for such a reader names `legacyFamily ?? family` (0068).
|
|
2914
|
+
*/
|
|
2915
|
+
readonly legacyFamily?: string;
|
|
2916
|
+
/** The typographic subfamily (17), or the subfamily (2). */
|
|
2917
|
+
readonly subfamily: string;
|
|
2918
|
+
/** The PostScript name (6), which the PDF names the font by: PDFKit writes it after a subset tag, each space as an underscore. */
|
|
2919
|
+
readonly postScriptName: string;
|
|
2920
|
+
/**
|
|
2921
|
+
* Every PostScript name the font's records of name ID 6 hold, each once,
|
|
2922
|
+
* in table order, `postScriptName` among them: fontkit returns one of
|
|
2923
|
+
* them, the last English record's, so a renderer that tells one face from
|
|
2924
|
+
* another by the name PDFKit keeps it by reads them all (0043).
|
|
2925
|
+
*/
|
|
2926
|
+
readonly postScriptNames: readonly string[];
|
|
2927
|
+
/** The full name (4). */
|
|
2928
|
+
readonly fullName?: string;
|
|
2929
|
+
/** The version string (5). */
|
|
2930
|
+
readonly version?: string;
|
|
2931
|
+
/** The copyright notice (0). */
|
|
2932
|
+
readonly copyright?: string;
|
|
2933
|
+
/** The licence description (13), as the font states it. */
|
|
2934
|
+
readonly licence?: string;
|
|
2935
|
+
/** The licence information address (14), as the font states it, never opened. */
|
|
2936
|
+
readonly licenceUrl?: string;
|
|
2937
|
+
}
|
|
2938
|
+
/** What a font's fsType allows, where it allows embedding a subset of its outlines. */
|
|
2939
|
+
type FontEmbedding = 'installable' | 'preview-print' | 'editable';
|
|
2940
|
+
/** The metrics PDFKit lays a line out by, in font units: `unitsPerEm`, and the horizontal header's ascender, descender and line gap. A line is `ascender - descender` units, as `style.ts` says of Roboto's: in a font this accepts, the ascender above 0, the descender at or below 0, and the line `MIN_FONT_LINE` to `MAX_FONT_LINE` ems. */
|
|
2941
|
+
interface FontMetrics {
|
|
2942
|
+
readonly unitsPerEm: number;
|
|
2943
|
+
readonly ascender: number;
|
|
2944
|
+
readonly descender: number;
|
|
2945
|
+
readonly lineGap: number;
|
|
2946
|
+
}
|
|
2947
|
+
/** What the OS/2 table says of the face, for a person to choose which face it is: a builder proposes, and the person decides, since Roboto Medium, which pdfmake prints as bold, says it is regular. */
|
|
2948
|
+
interface FontStyle {
|
|
2949
|
+
readonly weight: number;
|
|
2950
|
+
readonly italic: boolean;
|
|
2951
|
+
readonly bold: boolean;
|
|
2952
|
+
readonly regular: boolean;
|
|
2953
|
+
}
|
|
2954
|
+
/** A font this reader accepts. */
|
|
2955
|
+
interface Font {
|
|
2956
|
+
readonly ok: true;
|
|
2957
|
+
readonly names: FontNames;
|
|
2958
|
+
/** What its fsType allows: installable, preview and print, or editable embedding. */
|
|
2959
|
+
readonly embedding: FontEmbedding;
|
|
2960
|
+
/** The OS/2 fsType as the font states it, for a record of what was read. */
|
|
2961
|
+
readonly fsType: number;
|
|
2962
|
+
readonly metrics: FontMetrics;
|
|
2963
|
+
readonly style: FontStyle;
|
|
2964
|
+
/** The glyph count, glyph 0 among them. */
|
|
2965
|
+
readonly glyphs: number;
|
|
2966
|
+
/** The code points it maps to a glyph other than glyph 0, as fontkit maps them (`characterMap`). */
|
|
2967
|
+
readonly characters: ReadonlySet<number>;
|
|
2968
|
+
}
|
|
2969
|
+
/** A font's bytes, read whole, or the first thing that is wrong with them. */
|
|
2970
|
+
export declare function readFont(bytes: Uint8Array): Font | FontRefusal;
|
|
2971
|
+
/** The code points a font maps to a glyph, as `characterMap` reads them. */
|
|
2972
|
+
interface FontCharacters {
|
|
2973
|
+
readonly ok: true;
|
|
2974
|
+
readonly characters: ReadonlySet<number>;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* The code points a font maps to a glyph other than glyph 0, from the
|
|
2978
|
+
* character map alone: the table directory and the 'cmap' table, of any
|
|
2979
|
+
* sfnt, and nothing else of the font. `readFont` reads the same map and
|
|
2980
|
+
* holds the rest of the font besides; this is what the renderer reads of
|
|
2981
|
+
* the faces it ships, whose embedding nothing needs to judge again. It
|
|
2982
|
+
* holds no glyph index to the glyph count, which it does not read, and
|
|
2983
|
+
* reads the character map whatever length the directory records for it,
|
|
2984
|
+
* which fontkit does not: a font a host brings is held to `readFont`'s
|
|
2985
|
+
* characters, which hold both.
|
|
2986
|
+
*/
|
|
2987
|
+
export declare function characterMap(bytes: Uint8Array): FontCharacters | FontRefusal;
|
|
647
2988
|
/**
|
|
648
2989
|
* A 64-character lower-case hex SHA-256 of the report's canonical JSON,
|
|
649
2990
|
* taken over an envelope that names the format and its version, so a
|
|
@@ -662,8 +3003,6 @@ export declare function isFieldKey(value: unknown): value is string;
|
|
|
662
3003
|
* refuses such a key first.
|
|
663
3004
|
*/
|
|
664
3005
|
export declare function reportHash(report: ReportDefinition): string;
|
|
665
|
-
//#endregion
|
|
666
|
-
//#region src/empty.d.ts
|
|
667
3006
|
/**
|
|
668
3007
|
* A valid, empty A4 portrait report with 20 mm margins, nothing declared and
|
|
669
3008
|
* nothing in any region, recorded as started blank.
|
|
@@ -673,8 +3012,6 @@ export declare function reportHash(report: ReportDefinition): string;
|
|
|
673
3012
|
* would refuse.
|
|
674
3013
|
*/
|
|
675
3014
|
export declare function emptyReport(id: string, title: string, locale: string): ReportDefinition;
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region src/walk.d.ts
|
|
678
3015
|
interface ComponentLocation {
|
|
679
3016
|
readonly component: Component;
|
|
680
3017
|
readonly region: RegionName;
|
|
@@ -685,10 +3022,50 @@ interface ComponentLocation {
|
|
|
685
3022
|
}
|
|
686
3023
|
/** Every component in the report: regions in the order a reader meets them, each depth-first, a container before what it holds. */
|
|
687
3024
|
export declare function walkComponents(report: ReportDefinition): readonly ComponentLocation[];
|
|
3025
|
+
/**
|
|
3026
|
+
* The regions `regions` holds, each with its components, in the order a
|
|
3027
|
+
* reader meets them: every region but an optional one the report leaves
|
|
3028
|
+
* out, which holds nothing to visit or put a component in (0060).
|
|
3029
|
+
*/
|
|
3030
|
+
export declare function heldRegions(regions: Regions): readonly (readonly [RegionName, readonly Component[]])[];
|
|
688
3031
|
/** The component with `id`, where it is, or undefined when the report has none. Ids are unique in a valid report. */
|
|
689
3032
|
export declare function componentAt(report: ReportDefinition, id: string): ComponentLocation | undefined;
|
|
690
|
-
|
|
691
|
-
|
|
3033
|
+
/** The locales `report` is written in: its own first, then each translation's, in the order declared. */
|
|
3034
|
+
export declare function declaredLocales(report: ReportDefinition): readonly string[];
|
|
3035
|
+
type LocaleChoice = {
|
|
3036
|
+
readonly ok: true;
|
|
3037
|
+
readonly locale: string;
|
|
3038
|
+
} | {
|
|
3039
|
+
readonly ok: false;
|
|
3040
|
+
readonly message: string;
|
|
3041
|
+
};
|
|
3042
|
+
/**
|
|
3043
|
+
* The locale a render of `report` prints in: `requested` where the report
|
|
3044
|
+
* is written in it, the report's own where nothing is requested. A locale
|
|
3045
|
+
* the report does not declare is refused, never matched to a near one:
|
|
3046
|
+
* de-DE is not de-CH, and de is neither.
|
|
3047
|
+
*/
|
|
3048
|
+
export declare function renderLocale(report: ReportDefinition, requested?: string): LocaleChoice;
|
|
3049
|
+
/**
|
|
3050
|
+
* `report` -- one the validator accepts -- written in `locale` as far as
|
|
3051
|
+
* its translations go: each word and each word expression the language
|
|
3052
|
+
* translates replaced, every other left in the report's own; what the
|
|
3053
|
+
* validator checks each language by, and what the core diagnoses it by.
|
|
3054
|
+
* In the report's own locale, the report without its translations.
|
|
3055
|
+
* `locale` is one `renderLocale` accepted; another is a caller's mistake,
|
|
3056
|
+
* and throws a RangeError.
|
|
3057
|
+
*/
|
|
3058
|
+
export declare function writtenIn(report: ReportDefinition, locale: string): ReportDefinition;
|
|
3059
|
+
/**
|
|
3060
|
+
* `report` -- one the validator accepts -- written in `locale`, whole:
|
|
3061
|
+
* what a render in that locale prints. A word the language does not
|
|
3062
|
+
* translate is never printed in another, so one missing throws a
|
|
3063
|
+
* RangeError, as an undeclared locale does: a caller asks `renderLocale`
|
|
3064
|
+
* first, and report-core's `languageDiagnostics`, which says each word
|
|
3065
|
+
* missing, and each expression that prints words, before anything is
|
|
3066
|
+
* written. Neither throw is reached from a check that was made.
|
|
3067
|
+
*/
|
|
3068
|
+
export declare function reportIn(report: ReportDefinition, locale: string): ReportDefinition;
|
|
692
3069
|
/**
|
|
693
3070
|
* Lengths: the one conversion between points and millimetres, and the one
|
|
694
3071
|
* rounding every stored length goes through (plan 9).
|
|
@@ -716,25 +3093,5 @@ export declare function mmToPt(millimetres: number): number;
|
|
|
716
3093
|
* well inside the 0.005 mm that would change the displayed hundredth.
|
|
717
3094
|
*/
|
|
718
3095
|
export declare function ptToMm(points: number): number;
|
|
719
|
-
|
|
720
|
-
//#region src/page.d.ts
|
|
721
|
-
interface PageDimensions {
|
|
722
|
-
readonly width: number;
|
|
723
|
-
readonly height: number;
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* Portrait sizes in points. A4 is ISO 216's 210 x 297 mm, converted and
|
|
727
|
-
* rounded like any other length (595.28 x 841.89, the values PDF engines
|
|
728
|
-
* use); Letter is 8.5 x 11 inches, exactly 612 x 792.
|
|
729
|
-
*/
|
|
730
|
-
export declare const PAGE_SIZES: { readonly [S in PageSizeName]: PageDimensions; };
|
|
731
|
-
/** The page's width and height as oriented: landscape swaps the sides. */
|
|
732
|
-
export declare function pageDimensions(page: {
|
|
733
|
-
readonly size: PageSizeName;
|
|
734
|
-
readonly orientation: Orientation;
|
|
735
|
-
}): PageDimensions;
|
|
736
|
-
/** What the margins leave of the oriented page, to the hundredth of a point that lengths are stored at. */
|
|
737
|
-
export declare function printableArea(page: PageSettings): PageDimensions;
|
|
738
|
-
//#endregion
|
|
739
|
-
export type { AggregateDef, AggregateFunction, AggregateInline, AggregateScope, Alignment, AssetMediaType, AssetRef, Border, ColumnSlot, ColumnsComponent, Component, ComponentBase, ComponentKind, ComponentLocation, CurrencyFormat, CurrencySource, CurrencySourceKind, DatasetContract, DatasetRole, Datasets, DateFormat, DateStyle, Expression, ExpressionInline, FieldContract, FieldInline, FieldRef, FieldType, FontFamily, Format, FormatKind, ImageComponent, ImageFit, ImageSource, ImageSourceKind, Inline, InlineKind, KeepTogetherComponent, LineComponent, Margins, NumberFormat, Orientation, PageBreakComponent, PageCountInline, PageDimensions, PageNumberInline, PageSettings, PageSizeName, ParameterDef, ParameterInline, ParameterType, PrintStyle, Provenance, ProvenanceKind, RectangleComponent, RegionName, Regions, ReportDefinition, ReportError, ReportErrorCode, ReportValidation, Rounding, RoundingMode, RowValue, SectionComponent, SortDirection, SortKey, SpacerComponent, SpecVersionCheck, StyleRule, TableColumn, TableComponent, TableFooterCell, TableFooterRow, TableGroup, TextComponent, TextFormat, TextInline, TextTransform, ValueScope, Width };
|
|
3096
|
+
export { type AddressScheme, type AggregateDef, type AggregateFunction, type AggregateInline, type AggregateScope, type Alignment, type AnyAssetMediaType, type AssetMediaType, type AssetRef, type BaselineShift, type Border, type CharacterRefusal, type ChartCategory, type ChartComponent, type ChartKind, type ChartOrder, type ChartSeries, type CheckedSvg, type CleanSvg, type ColumnSlot, type ColumnsComponent, type Component, type ComponentBase, type ComponentKind, type ComponentLocation, type CountryCode, type CurrencyFormat, type CurrencySource, type CurrencySourceKind, type DatasetContract, type DatasetFormBinding, type DatasetFormKind, type DatasetRole, type Datasets, type DateFormat, type DateStyle, type EInvoice, type EInvoiceAddress, type EInvoiceBuyer, type EInvoiceCurrency, type EInvoiceDateRule, type EInvoiceDateTerm, type EInvoiceDecimalRule, type EInvoiceDecimalTerm, type EInvoiceKind, type EInvoiceLineCode, type EInvoiceLineColumn, type EInvoiceLineTerm, type EInvoiceLines, type EInvoiceName, type EInvoiceNeed, type EInvoiceProfile, type EInvoiceSeller, type EInvoiceTerms, type EInvoiceTextRule, type EInvoiceTextRules, type EInvoiceTextTerm, type EInvoiceTextTerms, type ElectronicAddress, type En16931Rule, type EpcCaption, type EpcPairingBreak, type EpcPayloadFields, type EpcQrCodeComponent, type EpcTextField, type EpcTextFieldRule, type EpcTextRule, type Expression, type ExpressionInline, type FacturXInvoice, type FacturXProfileTerms, type FieldContract, type FieldFormBinding, type FieldFormOverride, type FieldInline, type FieldRef, type FieldType, type Font, type FontCharacters, type FontEmbedding, type FontEmbeddingRefusal, type FontFaceKey, type FontFaces, type FontFamily, type FontFormat, type FontMap, type FontMediaType, type FontMetrics, type FontNames, type FontRefusal, type FontRefusalCode, type FontStyle, type FormRead, type Format, type FormatKind, type ImageComponent, type ImageFit, type ImageRefusal, type ImageRefusalCode, type ImageSource, type ImageSourceKind, type Inline, type InlineKind, type InvoiceTotal, type InvoiceTypeCode, type InvoicingPeriod, type JpegHeader, type KeepTogetherComponent, type LegalIdentifier, type LineComponent, type LocaleChoice, type Margins, type NumberFormat, type OptionalRegionName, type Orientation, type PageBreakComponent, type PageCountInline, type PageDimensions, type PageNumberInline, type PageSettings, type PageSizeName, type ParameterDef, type ParameterInline, type ParameterType, type PaymentCheck, type PaymentInstructions, type PaymentMeansCode, type PaymentPart, type PaymentPartKind, type PngHeader, type PrintStyle, type PrintedBlock, type Provenance, type ProvenanceKind, type QrBillAccount, type QrBillAddress, type QrBillCheck, type QrBillCurrency, type QrBillLanguage, type QrBillPageBreak, type QrBillPairingBreak, type QrBillReference, type QrBillReferenceType, type QrBillTextRule, type QrCodeComponent, type QrErrorCorrection, type RasterHeader, type RectangleComponent, type RegionName, type Regions, type ReportDefinition, type ReportError, type ReportErrorCode, type ReportValidation, type Rounding, type RoundingMode, type RowValue, KEPT_ELEMENTS as SVG_ELEMENTS, type SchemeId, type SectionComponent, type SellerContact, type SortDirection, type SortKey, type SpacerComponent, type SpecVersionCheck, type StyleRule, type SvgExtent, type SvgRefusal, type SvgRefusalCode, type SvgRemoval, type SvgRemovalKind, type ViewBox as SvgViewBox, type SwissQrBill, type TableColumn, type TableComponent, type TableFooterCell, type TableFooterRow, type TableGroup, type TextComponent, type TextFormat, type TextInline, type TextTransform, type TranslatedExpression, type TranslatedWord, type Translation, type UnitCode, type ValueScope, type VatCategory, type VatCategoryBreak, type VatCategoryCode, type Width, type WordExpressionSite, type WordPlace, type XRechnungInvoice, type XRechnungNeed, type XRechnungPattern, type XRechnungRule, type XRechnungTerms, type XRechnungVersion };
|
|
740
3097
|
//# sourceMappingURL=index.d.mts.map
|