@formancy/report-core 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 +251 -24
- package/dist/index.d.mts +326 -65
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3323 -1626
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/NOTICE
CHANGED
|
@@ -7,3 +7,11 @@ This product is distributed under the Formancy Report Source-Available Licence
|
|
|
7
7
|
This product includes software developed by the formancy project
|
|
8
8
|
(https://github.com/sharkysan/formancy.ai), licensed under the Apache License,
|
|
9
9
|
Version 2.0. Those packages keep their licence; nothing here changes it.
|
|
10
|
+
|
|
11
|
+
@formancy/report-render-pdf includes the Liberation Sans fonts, version
|
|
12
|
+
2.1.5, Regular and Bold, in its fonts directory and, as base64, in its
|
|
13
|
+
browser build. Digitized data copyright (c) 2010 Google Corporation, with
|
|
14
|
+
Reserved Font Arimo, Tinos and Cousine. Copyright (c) 2012 Red Hat, Inc.,
|
|
15
|
+
with Reserved Font Name Liberation. They are licensed under the SIL Open
|
|
16
|
+
Font License, Version 1.1, whose text travels with them as
|
|
17
|
+
fonts/LICENSE-LiberationSans.txt; nothing here changes it.
|
package/README.md
CHANGED
|
@@ -59,17 +59,121 @@ clamps when what it names is not there:
|
|
|
59
59
|
- **the document:** `setTitle`, `setLocale`, `setPage`, `replaceDocument`;
|
|
60
60
|
- **declarations:** `putStyle`, `removeStyle`, `putDataset`, `removeDataset`,
|
|
61
61
|
`putField`, `removeField`, `putParameter`, `removeParameter`,
|
|
62
|
-
`moveParameter`, `putAsset`, `removeAsset`, `putAggregate`,
|
|
62
|
+
`moveParameter`, `addAsset`, `putAsset`, `removeAsset`, `putAggregate`,
|
|
63
63
|
`removeAggregate`. A put replaces the declaration with that id where it
|
|
64
|
-
stands, or appends it; it cannot rename
|
|
64
|
+
stands, or appends it; it cannot rename. `addAsset` only appends, and
|
|
65
|
+
refuses an id the report already declares as `already-declared`: a
|
|
66
|
+
builder names an image a person adds, a host keeps its bytes under that
|
|
67
|
+
id, and only then is it declared, so a put under an id the report came
|
|
68
|
+
to declare meanwhile would swap another image for it, unseen.
|
|
69
|
+
`nextAssetId(report, base, handed)` names it: `base`, or `base-2`,
|
|
70
|
+
`base-3`, by the rule a new component's id is made by, counting asset
|
|
71
|
+
ids alone and the ids in `handed`, those a builder has handed a host
|
|
72
|
+
already; a base that ends in a number is numbered as it stands, since
|
|
73
|
+
it is a file's name (`img-4711` taken gives `img-4711-2`);
|
|
65
74
|
- **components:** `insertComponent`, `removeComponent`, `moveComponent`,
|
|
66
|
-
`updateComponent` (a patch typed per kind; the id and kind never change
|
|
75
|
+
`updateComponent` (a patch typed per kind; the id and kind never change.
|
|
76
|
+
A chart's kind of chart is a property, so a bar chart becomes a line
|
|
77
|
+
chart through it, and its list of series changes through it too),
|
|
67
78
|
`duplicateComponent` (fresh ids for the copy and all it holds), and
|
|
68
79
|
`nextComponentId`, which also names a new component after its kind:
|
|
69
|
-
`pageBreak` gives `page-break
|
|
70
|
-
|
|
80
|
+
`pageBreak` gives `page-break`, `qrCode` gives `qr-code`, `epcQrCode`
|
|
81
|
+
gives `epc-qr-code`;
|
|
82
|
+
- **a table:** `insertColumn`, `removeColumn` (with its footer cells),
|
|
71
83
|
`moveColumn`, `updateColumn`, `setGroup`, `setSort`, and the footer rows
|
|
72
|
-
under the table and under each group, row by row and cell by cell
|
|
84
|
+
under the table and under each group, row by row and cell by cell; its
|
|
85
|
+
condition, `rowsWhen`, changes through `updateComponent`, and a further
|
|
86
|
+
table comes in by `insertComponent` or `duplicateComponent`, which the
|
|
87
|
+
session refuses in a report that is an e-invoice
|
|
88
|
+
([0062](../../docs/decisions/0062-a-report-holds-several-tables-over-its-detail-rows-each-printing-and-totalling-the-rows-its-condition-selects.md)). How
|
|
89
|
+
many of its first rows a group header is kept with, the group's
|
|
90
|
+
`keepWithRows`, has no command of its own: `setGroup` and
|
|
91
|
+
`updateComponent` carry it with the rest of the group, and the session
|
|
92
|
+
holds it to the validator, as every edit
|
|
93
|
+
([0059](../../docs/decisions/0059-a-group-header-is-kept-on-its-page-with-as-many-of-its-groups-first-rows-as-the-report-states-or-as-fit.md));
|
|
94
|
+
- **the first page header**, which page 1 prints in place of the page
|
|
95
|
+
header: `putFirstPageHeader(report, components)` gives page 1 a header of
|
|
96
|
+
its own, added or in place of the one it has, an empty one printing no
|
|
97
|
+
header; `removeFirstPageHeader` gives page 1 the page header back, what
|
|
98
|
+
its own held with it, and is refused as `not-found` where there is none.
|
|
99
|
+
Every component command works in it once it is there; a location in it
|
|
100
|
+
while it is not is refused as `not-found`
|
|
101
|
+
([0060](../../docs/decisions/0060-a-reports-first-page-may-print-a-header-of-its-own-or-none-in-place-of-the-page-header.md));
|
|
102
|
+
- **the payment part**, the report's Swiss QR-bill: `putPaymentPart` (the
|
|
103
|
+
bill whole, added or in place of one), `updatePaymentPart` (a patch of
|
|
104
|
+
its properties, never its kind) and `removePaymentPart`, which judge
|
|
105
|
+
nothing of the bill: SIX's rules are report-spec's, which the session
|
|
106
|
+
asks
|
|
107
|
+
([0039](../../docs/decisions/0039-a-person-selects-a-reports-qr-bill-and-edits-it-field-by-field-in-either-builder.md));
|
|
108
|
+
- **the e-invoice**, of either kind: `putEInvoice`, `updateEInvoice` (a
|
|
109
|
+
patch of its terms, never its kind) and `removeEInvoice`, which judge
|
|
110
|
+
nothing of it; and `setPaymentAccount(report, account)`, which writes
|
|
111
|
+
the account, as typed, into the e-invoice's BT-84, its QR-bill's account
|
|
112
|
+
and every EPC QR code's IBAN in one edit, since the validator holds each
|
|
113
|
+
code to BT-84 and refuses a change of any one alone. It is refused as
|
|
114
|
+
`not-found` without an e-invoice or an account, and as
|
|
115
|
+
`read-from-data`, naming the place, where one of them reads its account
|
|
116
|
+
from the data, which it would write over -- a builder's field writes its
|
|
117
|
+
own account then; whether each place takes the account is the
|
|
118
|
+
validator's to say, each by its own rule, and no BIC is changed
|
|
119
|
+
([0044](../../docs/decisions/0044-a-person-edits-a-reports-e-invoice-in-either-builder-one-term-a-field-in-groups.md)).
|
|
120
|
+
- **the report's languages** ([0063](../../docs/decisions/0063-a-reports-own-words-are-written-in-each-language-it-declares-and-a-render-names-the-one-it-prints-in.md)): `addLanguage(report,
|
|
121
|
+
locale)`, a language with no words yet, refused as `already-declared`
|
|
122
|
+
for the report's own and one it has; `removeLanguage(report, locale)`,
|
|
123
|
+
with its words, the last leaving the report without translations;
|
|
124
|
+
`translateWord(report, locale, word, text)`, a word of the report's own
|
|
125
|
+
language written in a language it has, or taken back for `null`; and
|
|
126
|
+
`translateExpression(report, locale, cel, expression)`, an expression
|
|
127
|
+
that stands where words do written again in it. A word or a source the
|
|
128
|
+
report prints nowhere a word stands, and a language it has no
|
|
129
|
+
translation in, are refused as `not-found`; a blank translation and a
|
|
130
|
+
locale written otherwise are the validator's, which the session asks;
|
|
131
|
+
- **a field with what reads it:** `removeFieldWithReaders(report, role, id)`
|
|
132
|
+
removes the field and every component, column, footer cell, sort key,
|
|
133
|
+
group and aggregate that reads it, and every reader of such an
|
|
134
|
+
aggregate in turn; a style rule that reads it goes alone, what it
|
|
135
|
+
styled kept, and so does a chart's series that totals it, the chart's
|
|
136
|
+
other series kept; a footer row left with no cell goes whole, and so
|
|
137
|
+
does a table every column of which goes, a table whose condition reads
|
|
138
|
+
it, a chart every series of which goes and a chart whose category it
|
|
139
|
+
is, and what stands in a component that goes goes with it, once. What reads a
|
|
140
|
+
field is what the diagnostics find, from one walk, and in an
|
|
141
|
+
expression what the parser the compiler asks says it reads (an
|
|
142
|
+
expression that does not parse reads nothing). The outcome lists what
|
|
143
|
+
went, as JSON Pointers into the report before it, in `removed`. A field
|
|
144
|
+
the payment part or the e-invoice reads, directly or through an
|
|
145
|
+
aggregate, is refused as `read-by-part`: their own commands change them.
|
|
146
|
+
It is what a review of a form version offers where the version removed
|
|
147
|
+
a field. `fieldReaders(report)` makes that walk and reads every
|
|
148
|
+
expression once, for a review that asks of many fields: its
|
|
149
|
+
`removal(role, id)` is the command's, and its `expressions(role, id)`
|
|
150
|
+
the expressions a change of the field's type, or of whether it may be
|
|
151
|
+
null, reaches -- each that reads it, each that reads an aggregate that
|
|
152
|
+
does, in turn, and, for a field a table is grouped by, each that reads
|
|
153
|
+
that table's group's key, and no other table's (0062)
|
|
154
|
+
([0048](../../docs/decisions/0048-a-form-version-that-removes-moves-or-retypes-a-field-a-report-reads-blocks-that-reports-submissions-of-it-until-reviewed-anything-else-prints.md));
|
|
155
|
+
- **several as one:** `batch(report, steps)` runs command descriptors one
|
|
156
|
+
after the other as one command -- a transaction written down, so that an
|
|
157
|
+
edit of several commands travels as data: one undo step, one
|
|
158
|
+
notification, validated once at its end, and refused whole with the
|
|
159
|
+
first refusal, word for word, nothing after it run. A step that is no
|
|
160
|
+
descriptor, or a batch itself, is refused as `invalid-arguments`, and so
|
|
161
|
+
is a batch of more than `MAX_BATCH_COMMANDS` (1,000) commands, before any
|
|
162
|
+
of it runs; and so is a step that throws on the report the steps before
|
|
163
|
+
it left, which no validator has seen (0048).
|
|
164
|
+
|
|
165
|
+
`PART_COMMANDS` names the commands that may change each part of the report's
|
|
166
|
+
own level -- the payment part's three, the e-invoice's three,
|
|
167
|
+
`setPaymentAccount` for both, and `replaceDocument` and `batch` for both,
|
|
168
|
+
whose document, or whose steps, may hold another part than the one it
|
|
169
|
+
replaces -- and every other command keeps each as it was: the very object,
|
|
170
|
+
through every edit. A review that looks for a change of whom a bill or an
|
|
171
|
+
e-invoice is paid by finds it by these names, and compares the part whole
|
|
172
|
+
for a replacement. An edit that would leave an e-invoice's line with no
|
|
173
|
+
column to print it, or with a column that may be hidden, is refused with the
|
|
174
|
+
validator's reason, and so is an edit of one payment code's account alone in
|
|
175
|
+
a report with an e-invoice, which pays BT-84: `setPaymentAccount` changes
|
|
176
|
+
them together.
|
|
73
177
|
|
|
74
178
|
A patch removes an optional property with `null`, and `setGroup` and `setSort`
|
|
75
179
|
remove theirs with `null`, never with `undefined`: a proposal carries its
|
|
@@ -80,7 +184,9 @@ and an index: where the component ends up. An index outside the list is
|
|
|
80
184
|
refused, so a keyboard move and a pointer drop agree.
|
|
81
185
|
|
|
82
186
|
`COMMANDS` holds every command by name, and a `CommandDescriptor` --
|
|
83
|
-
`{ command, args }` -- is one as data, for a proposal
|
|
187
|
+
`{ command, args }` -- is one as data, for a proposal or a review's
|
|
188
|
+
resolution; a `StepDescriptor` is any of them but a batch, what a batch
|
|
189
|
+
holds. A descriptor read from
|
|
84
190
|
JSON was never type-checked, so `describedCommand` checks its arguments
|
|
85
191
|
against `ARGUMENTS` and refuses too few, too many or the wrong type with
|
|
86
192
|
`invalid-arguments`. A descriptor never throws, whatever it holds. A typed
|
|
@@ -92,10 +198,11 @@ call to a command can pass none of these.
|
|
|
92
198
|
move to it takes: the start of a keyboard move, the place to put focus
|
|
93
199
|
after a deletion.
|
|
94
200
|
- `locations(report)` is every place a component could be put, in reading
|
|
95
|
-
order
|
|
201
|
+
order, in every region the report holds: a first page header's only where
|
|
202
|
+
it has one.
|
|
96
203
|
- `validLocations(report, componentOrId)` is the places the validator
|
|
97
|
-
accepts it in: a page counter only in the page header and footer,
|
|
98
|
-
never inside columns.
|
|
204
|
+
accepts it in: a page counter only in the page header and footer, never
|
|
205
|
+
in the first page's own header, a table never inside columns.
|
|
99
206
|
|
|
100
207
|
The validator decides what may stand where (0007), so `validLocations` asks
|
|
101
208
|
it, place by place, rather than copying its rules. It validates the whole
|
|
@@ -134,21 +241,78 @@ proposal's review shows before Apply.
|
|
|
134
241
|
## Expressions and diagnostics
|
|
135
242
|
|
|
136
243
|
`compileReport(report)` compiles every expression where it stands, with
|
|
137
|
-
`@formancy/expressions`, the compiler the runtime uses
|
|
244
|
+
`@formancy/expressions`, the compiler the runtime uses; `compileReport(report,
|
|
245
|
+
only)` the expressions at the pointers `only` holds alone, with every
|
|
246
|
+
aggregate's, which what they read is computed from -- what a review asks
|
|
247
|
+
of a change to one field's type (0048). It gives:
|
|
138
248
|
|
|
139
249
|
- the programs, keyed by the JSON Pointer to each expression;
|
|
140
250
|
- what each program reads;
|
|
141
|
-
- the members each name holds, typed
|
|
251
|
+
- the members each name holds, typed: `table` the aggregates, as
|
|
252
|
+
`totals` and `group` are, and `groupKeys` the key of each table that
|
|
253
|
+
groups, by the table's id, typed by the field it groups by (0062);
|
|
142
254
|
- the order to compute the aggregates in;
|
|
143
255
|
- its errors.
|
|
144
256
|
|
|
257
|
+
An expression in a QR code's content is compiled as one in a paragraph in
|
|
258
|
+
its place is: in the report's scope, its diagnostics naming the code. An
|
|
259
|
+
EPC QR code's texts are read the same way, in the order its payload holds
|
|
260
|
+
them, and named after the code. A payment part's texts are read the same
|
|
261
|
+
way too, in the report's scope, and its diagnostics name no component,
|
|
262
|
+
only the path: the bill stands in none. A payment code's amount, a
|
|
263
|
+
QR-bill's or an EPC QR code's, is compiled as a value that must give a
|
|
264
|
+
decimal or null, by one rule for both. One that may be null is checked as
|
|
265
|
+
`dyn`, which may be either, and the render checks what it holds. An integer
|
|
266
|
+
or a string is a type error, with `dec()` as the hint.
|
|
267
|
+
|
|
268
|
+
A chart holds no expression
|
|
269
|
+
([0052](../../docs/decisions/0052-a-report-draws-a-bar-line-or-pie-chart-of-its-detail-rows-each-series-a-total-of-one-field-per-category.md)):
|
|
270
|
+
its category and each of its series read a detail field, whose type the
|
|
271
|
+
validator holds, and its formats may read a currency from a header field.
|
|
272
|
+
Each is named after the chart, as a field a text binds is, so a field only
|
|
273
|
+
a chart reads is not unused, and `fieldReaders` and a review find it.
|
|
274
|
+
Nothing of a chart is compiled but its `visibleWhen` and `styleWhen`, as
|
|
275
|
+
of every component.
|
|
276
|
+
|
|
277
|
+
An e-invoice ([0027](../../docs/decisions/0027-a-report-carries-one-en-16931-invoice-written-from-the-values-its-page-prints.md)) is read as a payment part is: its texts in the
|
|
278
|
+
report's scope, named by their paths alone. Its dates and its paid amount
|
|
279
|
+
are values there, and the codes of each line -- its identifier, its unit
|
|
280
|
+
and its VAT category -- are values in each row's scope, as what an
|
|
281
|
+
aggregate reads from a row. Each is held to the term the XML writes it as:
|
|
282
|
+
|
|
283
|
+
- a date is a text, as a date field is read;
|
|
284
|
+
- the paid amount is a decimal;
|
|
285
|
+
- an identifier is a text or an integer, and a unit or a category a text.
|
|
286
|
+
|
|
287
|
+
The four columns that print a line's name, quantity, net price and net
|
|
288
|
+
amount are held to their terms too, wherever they compute one: a text for
|
|
289
|
+
the name, an integer or a decimal for the others. Each type comes from
|
|
290
|
+
report-spec's tables, which the validator holds a field to.
|
|
291
|
+
|
|
292
|
+
In a report that is an e-invoice, and in no other, every place that reads
|
|
293
|
+
`totals` also reads the totals the runtime computes once for the page and
|
|
294
|
+
the XML:
|
|
295
|
+
|
|
296
|
+
- `invoice.lineTotal`, `taxBasisTotal`, `taxTotal`, `grandTotal` and
|
|
297
|
+
`duePayable`, each a decimal, never null;
|
|
298
|
+
- `invoice.paid`, where a paid amount is declared, null where it may be;
|
|
299
|
+
- `vatBasis.<id>` and `vatAmount.<id>` for each declared category, null
|
|
300
|
+
when no line is in it.
|
|
301
|
+
|
|
302
|
+
They are not read where they are computed from, which would be a circle
|
|
303
|
+
no render could close: an aggregate's expression, the e-invoice's own, and
|
|
304
|
+
the columns that print a line. A read there is `expression-unknown-name`,
|
|
305
|
+
as one in any other report is.
|
|
306
|
+
|
|
145
307
|
`diagnose(report)` lists those errors, then the warnings. The runtime refuses
|
|
146
308
|
a report with an error, so the editor and the runtime cannot disagree about
|
|
147
309
|
one.
|
|
148
310
|
|
|
149
311
|
- **Errors:** syntax, limits, types, policy (a condition that is not a
|
|
150
|
-
boolean), a name or member nothing declares, `row` or `
|
|
151
|
-
|
|
312
|
+
boolean), a name or member nothing declares, `row`, `group` or `table`
|
|
313
|
+
where there is none (`table` has a value in a table's total rows and
|
|
314
|
+
its group's header and footer, and a table's condition reads neither),
|
|
315
|
+
an image field read as a value, a name read whole (`size(params)`),
|
|
152
316
|
a call to `now()`, `today()` or `random()`, an aggregate whose expression
|
|
153
317
|
gives what its function cannot total, and aggregates that read their own
|
|
154
318
|
total. And what would make a printed number inexact or a render unbounded:
|
|
@@ -156,15 +320,61 @@ one.
|
|
|
156
320
|
`/`, which on integers drops the remainder (`divide(dec(a), dec(b), places)`
|
|
157
321
|
is the exact one), and a call to `matches()`, whose pattern no step budget
|
|
158
322
|
bounds. Each comes with the component, the table column where it is in
|
|
159
|
-
one, and the position in its source. Two more are about totals
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
323
|
+
one, and the position in its source. Two more are about totals, an
|
|
324
|
+
aggregate's or a chart's series': a rounding declared on one that
|
|
325
|
+
computes an integer, a date or an instant -- a series' count, or its
|
|
326
|
+
sum, least or greatest of integers -- and a number format that prints a
|
|
327
|
+
rounded total at fewer places than its rounding keeps, which would round
|
|
328
|
+
it twice, a series' printed in its chart's `valueFormat`. A series is
|
|
329
|
+
typed as the compiler types an aggregate of its function over its
|
|
330
|
+
field: `seriesType`, exported, is that type, by the one function the
|
|
331
|
+
compiler asks, `fieldTotalType`, and the runtime totals a series in it,
|
|
332
|
+
so the editor and a render cannot type a series apart
|
|
333
|
+
([0055](../../docs/decisions/0055-the-runtime-resolves-a-chart-exactly-its-totals-as-every-total-and-every-word-it-prints.md)).
|
|
334
|
+
And one is about an e-invoice: a total its XML holds that no text or
|
|
335
|
+
table of the page prints (`e-invoice-total-unprinted`). Each of these is
|
|
336
|
+
held: the total
|
|
337
|
+
without VAT, `invoice.taxBasisTotal` or `invoice.lineTotal`; the VAT
|
|
338
|
+
total; the total with VAT; and each declared category's basis and amount.
|
|
339
|
+
The paid amount and the amount due are held too where a paid amount is
|
|
340
|
+
declared. And one prints what the XML holds otherwise
|
|
341
|
+
(`e-invoice-format-differs`): a run that reads a total, or the column of
|
|
342
|
+
a line's net amount, at fewer than two places or in another currency
|
|
343
|
+
than the e-invoice's, named as a code; the column of a net price in
|
|
344
|
+
another currency; the column of an item's name in upper or lower case.
|
|
345
|
+
A quantity's and a price's places are the data's, and the runtime holds
|
|
346
|
+
them row by row.
|
|
163
347
|
- **Warnings:** an unused style, asset, parameter, field or aggregate, an
|
|
164
|
-
empty body, a text that prints nothing
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
348
|
+
empty body, a text that prints nothing, a total of every detail row in
|
|
349
|
+
the total rows of a table that selects its rows -- an aggregate run
|
|
350
|
+
`over: 'report'`, or an expression that reads `totals` and not
|
|
351
|
+
`table` -- since printed there it reads as those rows'
|
|
352
|
+
(`total-of-every-row`, 0062), and a QR-bill that holds SIX's
|
|
353
|
+
examples, written in the report: an account of report-spec's
|
|
354
|
+
`QR_BILL_EXAMPLE_ACCOUNTS`, which pays no creditor, or the creditor, the
|
|
355
|
+
debtor or the QR reference a builder puts in, report-spec's
|
|
356
|
+
`QR_BILL_EXAMPLE` (`example-payment-part`, one warning on `/paymentPart`
|
|
357
|
+
naming each term that is an example).
|
|
358
|
+
- **In each language a report's translations declare**, after the
|
|
359
|
+
report's own and naming it as `language`, `languageDiagnostics(report,
|
|
360
|
+
locale)`'s (0063): each word the language does not translate, and each
|
|
361
|
+
expression that prints words, once where it first stands
|
|
362
|
+
(`word-missing`); a translated expression of another type than its
|
|
363
|
+
source, that reads another member or fails to read one, or that
|
|
364
|
+
translates an expression printing no words (`translation-differs`);
|
|
365
|
+
every diagnostic the report written in that language gives that its
|
|
366
|
+
own does not, a translated expression's at its translation; and a
|
|
367
|
+
translation of what the report no longer prints (`unused-translation`,
|
|
368
|
+
a warning). An expression where a word stands prints words where it
|
|
369
|
+
gives a string or a value the compiler cannot type, its run prints it
|
|
370
|
+
as text, and its source holds a quote. An error that names a language
|
|
371
|
+
refuses a render in that language alone; one that names none refuses
|
|
372
|
+
every render. `wordExpressions(report)` gives those expressions, every
|
|
373
|
+
place each stands, by the same verdict: what the builders mark and edit
|
|
374
|
+
as words, so that they ask for no translation the diagnostics do not.
|
|
375
|
+
|
|
376
|
+
Every member read is checked as its type. `@formancy/expressions` 0.12.0,
|
|
377
|
+
as 0.5.0 to 0.7.0 and 0.11.0 before it, declares a variable only by its whole name, so each read of `row.amount` is
|
|
168
378
|
spliced, by upstream's own `rewritePath`, into a read of `row_amount`, a
|
|
169
379
|
variable declared as a decimal. An exact value is used as what it is,
|
|
170
380
|
`row.amount * dec("1.081")`, and `dec(row.amount)` is a type error. A member
|
|
@@ -186,7 +396,24 @@ What this does not do:
|
|
|
186
396
|
decimal and a `dyn`, so it cannot be written directly; ordering works.
|
|
187
397
|
- **`has()` on a member.** Every member is bound, null when it has no value,
|
|
188
398
|
so `!= null` is the way to ask.
|
|
189
|
-
- **Layout.** Whether a keep-together block fits a page,
|
|
190
|
-
|
|
399
|
+
- **Layout.** Whether a keep-together block fits a page, a column its width,
|
|
400
|
+
or a QR code's content its square, is the renderer's to say.
|
|
401
|
+
- **A payment code's values.** Whether an amount has two decimals at
|
|
402
|
+
most, and whether what a field puts in a QR-bill or an EPC QR code is an
|
|
403
|
+
IBAN, a reference or a name its rules allow, depends on the data. The
|
|
404
|
+
runtime checks them with `@formancy/report-spec`'s rules, the ones the
|
|
405
|
+
validator applies to a literal.
|
|
406
|
+
- **An e-invoice's values.** A date is held to be a text, not to be a
|
|
407
|
+
date: `header.customer` passes where `params.copies` does not. Whether
|
|
408
|
+
each text is a calendar date, an amount a whole number of cents, or a
|
|
409
|
+
line's category one the e-invoice declares, the runtime checks with the
|
|
410
|
+
same rules, once the data has resolved it.
|
|
411
|
+
- **What a page prints beside a total.** `e-invoice-total-unprinted` and
|
|
412
|
+
`e-invoice-format-differs` are the template's, not the data's: a run
|
|
413
|
+
behind a condition counts as printing what it reads, a run that reads a
|
|
414
|
+
total counts whatever it computes from it, and every declared category
|
|
415
|
+
is held, since which ones the lines use is known only at render. A
|
|
416
|
+
condition, a style rule, a QR code and a payment code's amount print
|
|
417
|
+
nothing.
|
|
191
418
|
|
|
192
419
|
Source-available, not open source: see [`LICENSE.md`](../../LICENSE.md).
|