@formfeed/sdk 0.3.11 → 0.3.13

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.
@@ -38,6 +38,10 @@ export interface RenderRequest {
38
38
  data?: Record<string, unknown>;
39
39
  /** Left out, the template decides: PDF, or an image template's `settings.image.format`. */
40
40
  output?: OutputFormat;
41
+ /**
42
+ * Merged over the template's settings. `{ pdf: { ua: true } }` makes the file a PDF/UA-1 document
43
+ * and the render carry the validator's verdict as `accessibility`; see `PdfUaOptions`.
44
+ */
41
45
  settings?: Record<string, unknown>;
42
46
  filename?: string;
43
47
  expires_in?: number | null;
@@ -151,6 +155,102 @@ export interface PostProcessing {
151
155
  owner?: string;
152
156
  permissions?: PdfPermission[];
153
157
  };
158
+ /**
159
+ * Makes the PDF a ZUGFeRD / Factur-X e-invoice, built from the `_invoice` block of `data`. `{}`
160
+ * takes the defaults; `false` switches off what the template's settings declare. Not together
161
+ * with `password`. Starter plan and above; one unit on top of the render.
162
+ */
163
+ einvoice?: EinvoiceOptions | false;
164
+ }
165
+ /** What kind of e-invoice a render makes; every field has a default. */
166
+ export interface EinvoiceOptions {
167
+ /** `en16931` (default) carries the whole European standard, `basic` the smallest full invoice. */
168
+ profile?: 'basic' | 'en16931';
169
+ /** One specification under two names; decides the name and release the render reports. */
170
+ flavour?: 'factur-x' | 'zugferd';
171
+ /** `both` stores the XML as a file of its own beside the PDF (`einvoice.xml_url`). */
172
+ xml?: 'embedded' | 'both';
173
+ /** What a value of the XML that the PDF does not show does: a warning, or a failed render. */
174
+ display_check?: 'warn' | 'strict';
175
+ }
176
+ /** One finding of the validator: a rule of the XML, or a clause of PDF/A. */
177
+ export interface EinvoiceMessage {
178
+ part: 'xml' | 'pdf';
179
+ severity: 'error' | 'warning';
180
+ rule: string | null;
181
+ message: string;
182
+ /** An XPath into the XML, or the object of the PDF. */
183
+ location: string | null;
184
+ }
185
+ /** The e-invoice of a render: what was made, what the validator said, what the PDF shows. */
186
+ export interface Einvoice {
187
+ profile: 'basic' | 'en16931';
188
+ flavour: 'factur-x' | 'zugferd';
189
+ /** The release under the flavour's name: Factur-X `1.09` is ZUGFeRD `2.5`. */
190
+ spec_version: string;
191
+ /** A signed link to the XML when the render asked for `xml: "both"`; null otherwise. */
192
+ xml_url: string | null;
193
+ validation: {
194
+ valid: boolean;
195
+ schematron: string;
196
+ pdfa: string | null;
197
+ /** At most 50, errors first. */
198
+ messages: EinvoiceMessage[];
199
+ truncated?: boolean;
200
+ } | null;
201
+ /** The business terms of the XML looked for in the PDF's text, and those it does not show. */
202
+ display: {
203
+ checked: string[];
204
+ missing: string[];
205
+ } | null;
206
+ }
207
+ /**
208
+ * `settings.pdf.ua` as an object; `true` is `{ check: 'strict' }`. `strict` fails a render whose
209
+ * file does not pass validation (422 `pdfua_validation_failed`) and delivers nothing; `report`
210
+ * delivers the file without the PDF/UA identifier and says so in `accessibility.conformant`.
211
+ */
212
+ export interface PdfUaOptions {
213
+ check?: 'strict' | 'report';
214
+ }
215
+ /** One rule of PDF/UA-1 a file failed. */
216
+ export interface AccessibilityFailure {
217
+ /** Clause and test number of the rule in veraPDF's PDF/UA-1 profile, `7.4.2-1`. */
218
+ rule: string;
219
+ /** What in the template the rule is about (`heading-order`, `image-alt`, …), where that is known. */
220
+ code?: string;
221
+ /** How many checks of the rule failed. */
222
+ count: number;
223
+ /** What to change in the template, else the validator's own description of the rule. */
224
+ message: string;
225
+ /** The start tags of the elements concerned, at most five. */
226
+ elements: string[];
227
+ }
228
+ /** What a reader will stumble over although no rule fails for it. */
229
+ export interface AccessibilityWarning {
230
+ code: string;
231
+ count: number;
232
+ /** Start tags, or the text itself for `running-text` and `generated-text`. */
233
+ elements: string[];
234
+ }
235
+ /**
236
+ * What the validator said about a file as PDF/UA-1: its verdict on the machine-checkable rules of
237
+ * the standard, and no more than that. A passed check does not make a document accessible.
238
+ */
239
+ export interface Accessibility {
240
+ standard: 'PDF/UA-1';
241
+ check: 'strict' | 'report';
242
+ /** The file passed every rule the validator checks; only then does it carry the PDF/UA identifier. */
243
+ conformant: boolean;
244
+ /** The validator and its version, `veraPDF 1.30.2`. */
245
+ validator: string;
246
+ rules: {
247
+ passed: number;
248
+ failed: number;
249
+ };
250
+ /** At most 20. */
251
+ failures: AccessibilityFailure[];
252
+ warnings: AccessibilityWarning[];
253
+ truncated?: boolean;
154
254
  }
155
255
  /** Where the result of a PDF tool is stored, as for a render. */
156
256
  export interface PdfOutputOptions {
@@ -206,6 +306,17 @@ export interface Render {
206
306
  deduplicated: boolean;
207
307
  /** The copy in the workspace's own bucket; null when none applies. */
208
308
  storage: StorageDelivery | null;
309
+ /**
310
+ * The e-invoice the render made, with the validator's report; null when it made none. A failed
311
+ * render keeps it too, which is where it says why. Absent from renders made before the feature.
312
+ */
313
+ einvoice?: Einvoice | null;
314
+ /**
315
+ * The validator's verdict on the file as PDF/UA-1; null unless the render set `settings.pdf.ua`.
316
+ * A strict render that failed keeps it too, which is where it names the rules. Absent from
317
+ * renders made before the feature.
318
+ */
319
+ accessibility?: Accessibility | null;
209
320
  timings: Record<string, number> | null;
210
321
  error: {
211
322
  code?: string;
@@ -38,6 +38,10 @@ export interface RenderRequest {
38
38
  data?: Record<string, unknown>;
39
39
  /** Left out, the template decides: PDF, or an image template's `settings.image.format`. */
40
40
  output?: OutputFormat;
41
+ /**
42
+ * Merged over the template's settings. `{ pdf: { ua: true } }` makes the file a PDF/UA-1 document
43
+ * and the render carry the validator's verdict as `accessibility`; see `PdfUaOptions`.
44
+ */
41
45
  settings?: Record<string, unknown>;
42
46
  filename?: string;
43
47
  expires_in?: number | null;
@@ -151,6 +155,102 @@ export interface PostProcessing {
151
155
  owner?: string;
152
156
  permissions?: PdfPermission[];
153
157
  };
158
+ /**
159
+ * Makes the PDF a ZUGFeRD / Factur-X e-invoice, built from the `_invoice` block of `data`. `{}`
160
+ * takes the defaults; `false` switches off what the template's settings declare. Not together
161
+ * with `password`. Starter plan and above; one unit on top of the render.
162
+ */
163
+ einvoice?: EinvoiceOptions | false;
164
+ }
165
+ /** What kind of e-invoice a render makes; every field has a default. */
166
+ export interface EinvoiceOptions {
167
+ /** `en16931` (default) carries the whole European standard, `basic` the smallest full invoice. */
168
+ profile?: 'basic' | 'en16931';
169
+ /** One specification under two names; decides the name and release the render reports. */
170
+ flavour?: 'factur-x' | 'zugferd';
171
+ /** `both` stores the XML as a file of its own beside the PDF (`einvoice.xml_url`). */
172
+ xml?: 'embedded' | 'both';
173
+ /** What a value of the XML that the PDF does not show does: a warning, or a failed render. */
174
+ display_check?: 'warn' | 'strict';
175
+ }
176
+ /** One finding of the validator: a rule of the XML, or a clause of PDF/A. */
177
+ export interface EinvoiceMessage {
178
+ part: 'xml' | 'pdf';
179
+ severity: 'error' | 'warning';
180
+ rule: string | null;
181
+ message: string;
182
+ /** An XPath into the XML, or the object of the PDF. */
183
+ location: string | null;
184
+ }
185
+ /** The e-invoice of a render: what was made, what the validator said, what the PDF shows. */
186
+ export interface Einvoice {
187
+ profile: 'basic' | 'en16931';
188
+ flavour: 'factur-x' | 'zugferd';
189
+ /** The release under the flavour's name: Factur-X `1.09` is ZUGFeRD `2.5`. */
190
+ spec_version: string;
191
+ /** A signed link to the XML when the render asked for `xml: "both"`; null otherwise. */
192
+ xml_url: string | null;
193
+ validation: {
194
+ valid: boolean;
195
+ schematron: string;
196
+ pdfa: string | null;
197
+ /** At most 50, errors first. */
198
+ messages: EinvoiceMessage[];
199
+ truncated?: boolean;
200
+ } | null;
201
+ /** The business terms of the XML looked for in the PDF's text, and those it does not show. */
202
+ display: {
203
+ checked: string[];
204
+ missing: string[];
205
+ } | null;
206
+ }
207
+ /**
208
+ * `settings.pdf.ua` as an object; `true` is `{ check: 'strict' }`. `strict` fails a render whose
209
+ * file does not pass validation (422 `pdfua_validation_failed`) and delivers nothing; `report`
210
+ * delivers the file without the PDF/UA identifier and says so in `accessibility.conformant`.
211
+ */
212
+ export interface PdfUaOptions {
213
+ check?: 'strict' | 'report';
214
+ }
215
+ /** One rule of PDF/UA-1 a file failed. */
216
+ export interface AccessibilityFailure {
217
+ /** Clause and test number of the rule in veraPDF's PDF/UA-1 profile, `7.4.2-1`. */
218
+ rule: string;
219
+ /** What in the template the rule is about (`heading-order`, `image-alt`, …), where that is known. */
220
+ code?: string;
221
+ /** How many checks of the rule failed. */
222
+ count: number;
223
+ /** What to change in the template, else the validator's own description of the rule. */
224
+ message: string;
225
+ /** The start tags of the elements concerned, at most five. */
226
+ elements: string[];
227
+ }
228
+ /** What a reader will stumble over although no rule fails for it. */
229
+ export interface AccessibilityWarning {
230
+ code: string;
231
+ count: number;
232
+ /** Start tags, or the text itself for `running-text` and `generated-text`. */
233
+ elements: string[];
234
+ }
235
+ /**
236
+ * What the validator said about a file as PDF/UA-1: its verdict on the machine-checkable rules of
237
+ * the standard, and no more than that. A passed check does not make a document accessible.
238
+ */
239
+ export interface Accessibility {
240
+ standard: 'PDF/UA-1';
241
+ check: 'strict' | 'report';
242
+ /** The file passed every rule the validator checks; only then does it carry the PDF/UA identifier. */
243
+ conformant: boolean;
244
+ /** The validator and its version, `veraPDF 1.30.2`. */
245
+ validator: string;
246
+ rules: {
247
+ passed: number;
248
+ failed: number;
249
+ };
250
+ /** At most 20. */
251
+ failures: AccessibilityFailure[];
252
+ warnings: AccessibilityWarning[];
253
+ truncated?: boolean;
154
254
  }
155
255
  /** Where the result of a PDF tool is stored, as for a render. */
156
256
  export interface PdfOutputOptions {
@@ -206,6 +306,17 @@ export interface Render {
206
306
  deduplicated: boolean;
207
307
  /** The copy in the workspace's own bucket; null when none applies. */
208
308
  storage: StorageDelivery | null;
309
+ /**
310
+ * The e-invoice the render made, with the validator's report; null when it made none. A failed
311
+ * render keeps it too, which is where it says why. Absent from renders made before the feature.
312
+ */
313
+ einvoice?: Einvoice | null;
314
+ /**
315
+ * The validator's verdict on the file as PDF/UA-1; null unless the render set `settings.pdf.ua`.
316
+ * A strict render that failed keeps it too, which is where it names the rules. Absent from
317
+ * renders made before the feature.
318
+ */
319
+ accessibility?: Accessibility | null;
209
320
  timings: Record<string, number> | null;
210
321
  error: {
211
322
  code?: string;