@formfeed/sdk 0.3.12 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -147,7 +147,8 @@ var Formfeed = class {
147
147
  `render ${target.id} has no output (${target.status})`,
148
148
  0
149
149
  );
150
- const res = await this.fetchImpl(target.download_url, {
150
+ const fetchImpl = this.fetchImpl;
151
+ const res = await fetchImpl(target.download_url, {
151
152
  signal: options.signal
152
153
  });
153
154
  if (!res.ok)
@@ -663,8 +664,9 @@ var Formfeed = class {
663
664
  () => controller.abort(options.signal?.reason)
664
665
  );
665
666
  let res;
667
+ const fetchImpl = this.fetchImpl;
666
668
  try {
667
- res = await this.fetchImpl(url, {
669
+ res = await fetchImpl(url, {
668
670
  method,
669
671
  headers,
670
672
  body: body === void 0 ? void 0 : isForm ? body : JSON.stringify(body),
package/index.js CHANGED
@@ -118,7 +118,8 @@ var Formfeed = class {
118
118
  `render ${target.id} has no output (${target.status})`,
119
119
  0
120
120
  );
121
- const res = await this.fetchImpl(target.download_url, {
121
+ const fetchImpl = this.fetchImpl;
122
+ const res = await fetchImpl(target.download_url, {
122
123
  signal: options.signal
123
124
  });
124
125
  if (!res.ok)
@@ -634,8 +635,9 @@ var Formfeed = class {
634
635
  () => controller.abort(options.signal?.reason)
635
636
  );
636
637
  let res;
638
+ const fetchImpl = this.fetchImpl;
637
639
  try {
638
- res = await this.fetchImpl(url, {
640
+ res = await fetchImpl(url, {
639
641
  method,
640
642
  headers,
641
643
  body: body === void 0 ? void 0 : isForm ? body : JSON.stringify(body),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formfeed/sdk",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "Formfeed API client: renders, templates, webhooks. No dependencies, Web APIs only.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/types/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Formfeed, FormfeedError } from './lib/client.cjs';
2
- export type { Template, TemplateCreate, TemplateFiles, TemplateKind, TemplateListOptions, TemplateValidation, VersionRef, TemplateVersion, TemplateVersionCreate, TemplateFile, OfficeTemplateKind, OfficeTemplateCreate, OfficeVersionCreate, OfficeFileUpload, ConvertOptions, VersionStatus, BatchRequest, Channel, ChannelList, ChannelMove, Brand, SharedPartial, SharedPartialPut, SharedPartialPutResult, Diagnostic, Engine, FileListOptions, FileUpload, FormfeedOptions, FormfeedTemplates, Job, LibraryFile, OutputFormat, PdfInfo, PdfOutputOptions, PdfPermission, PostProcessing, Einvoice, EinvoiceMessage, EinvoiceOptions, Problem, StorageDelivery, StorageDeliveryEvent, StorageError, StorageOption, WebhookEventType, ProtectOptions, Region, Render, RenderListOptions, RenderRequest, RenderStatus, TemplateData, TypedRenderRequest, RequestOptions, SchemaChange, SchemaCheck, SchemaGuardOptions, Usage, WaitOptions, WatermarkOptions, WebhookEndpoint, WebhookEndpointCreate, WebhookEndpointUpdate, WebhookEnvironment, WebhookResend, ListenSession, ListenSessionOptions, RenderInput, } from './lib/client.cjs';
2
+ export type { Template, TemplateCreate, TemplateFiles, TemplateKind, TemplateListOptions, TemplateValidation, VersionRef, TemplateVersion, TemplateVersionCreate, TemplateFile, OfficeTemplateKind, OfficeTemplateCreate, OfficeVersionCreate, OfficeFileUpload, ConvertOptions, VersionStatus, BatchRequest, Channel, ChannelList, ChannelMove, Brand, SharedPartial, SharedPartialPut, SharedPartialPutResult, Diagnostic, Engine, FileListOptions, FileUpload, FormfeedOptions, FormfeedTemplates, Job, LibraryFile, OutputFormat, PdfInfo, PdfOutputOptions, PdfPermission, PostProcessing, Einvoice, EinvoiceMessage, EinvoiceOptions, Accessibility, AccessibilityFailure, AccessibilityWarning, PdfUaOptions, Problem, StorageDelivery, StorageDeliveryEvent, StorageError, StorageOption, WebhookEventType, ProtectOptions, Region, Render, RenderListOptions, RenderRequest, RenderStatus, TemplateData, TypedRenderRequest, RequestOptions, SchemaChange, SchemaCheck, SchemaGuardOptions, Usage, WaitOptions, WatermarkOptions, WebhookEndpoint, WebhookEndpointCreate, WebhookEndpointUpdate, WebhookEnvironment, WebhookResend, ListenSession, ListenSessionOptions, RenderInput, } from './lib/client.cjs';
3
3
  export { parseWebhookEvent, verifyWebhookSignature } from './lib/webhooks.cjs';
4
4
  export type { VerifyOptions } from './lib/webhooks.cjs';
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Formfeed, FormfeedError } from './lib/client.js';
2
- export type { Template, TemplateCreate, TemplateFiles, TemplateKind, TemplateListOptions, TemplateValidation, VersionRef, TemplateVersion, TemplateVersionCreate, TemplateFile, OfficeTemplateKind, OfficeTemplateCreate, OfficeVersionCreate, OfficeFileUpload, ConvertOptions, VersionStatus, BatchRequest, Channel, ChannelList, ChannelMove, Brand, SharedPartial, SharedPartialPut, SharedPartialPutResult, Diagnostic, Engine, FileListOptions, FileUpload, FormfeedOptions, FormfeedTemplates, Job, LibraryFile, OutputFormat, PdfInfo, PdfOutputOptions, PdfPermission, PostProcessing, Einvoice, EinvoiceMessage, EinvoiceOptions, Problem, StorageDelivery, StorageDeliveryEvent, StorageError, StorageOption, WebhookEventType, ProtectOptions, Region, Render, RenderListOptions, RenderRequest, RenderStatus, TemplateData, TypedRenderRequest, RequestOptions, SchemaChange, SchemaCheck, SchemaGuardOptions, Usage, WaitOptions, WatermarkOptions, WebhookEndpoint, WebhookEndpointCreate, WebhookEndpointUpdate, WebhookEnvironment, WebhookResend, ListenSession, ListenSessionOptions, RenderInput, } from './lib/client.js';
2
+ export type { Template, TemplateCreate, TemplateFiles, TemplateKind, TemplateListOptions, TemplateValidation, VersionRef, TemplateVersion, TemplateVersionCreate, TemplateFile, OfficeTemplateKind, OfficeTemplateCreate, OfficeVersionCreate, OfficeFileUpload, ConvertOptions, VersionStatus, BatchRequest, Channel, ChannelList, ChannelMove, Brand, SharedPartial, SharedPartialPut, SharedPartialPutResult, Diagnostic, Engine, FileListOptions, FileUpload, FormfeedOptions, FormfeedTemplates, Job, LibraryFile, OutputFormat, PdfInfo, PdfOutputOptions, PdfPermission, PostProcessing, Einvoice, EinvoiceMessage, EinvoiceOptions, Accessibility, AccessibilityFailure, AccessibilityWarning, PdfUaOptions, Problem, StorageDelivery, StorageDeliveryEvent, StorageError, StorageOption, WebhookEventType, ProtectOptions, Region, Render, RenderListOptions, RenderRequest, RenderStatus, TemplateData, TypedRenderRequest, RequestOptions, SchemaChange, SchemaCheck, SchemaGuardOptions, Usage, WaitOptions, WatermarkOptions, WebhookEndpoint, WebhookEndpointCreate, WebhookEndpointUpdate, WebhookEnvironment, WebhookResend, ListenSession, ListenSessionOptions, RenderInput, } from './lib/client.js';
3
3
  export { parseWebhookEvent, verifyWebhookSignature } from './lib/webhooks.js';
4
4
  export type { VerifyOptions } from './lib/webhooks.js';
@@ -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;
@@ -200,6 +204,54 @@ export interface Einvoice {
200
204
  missing: string[];
201
205
  } | null;
202
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;
254
+ }
203
255
  /** Where the result of a PDF tool is stored, as for a render. */
204
256
  export interface PdfOutputOptions {
205
257
  filename?: string;
@@ -259,6 +311,12 @@ export interface Render {
259
311
  * render keeps it too, which is where it says why. Absent from renders made before the feature.
260
312
  */
261
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;
262
320
  timings: Record<string, number> | null;
263
321
  error: {
264
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;
@@ -200,6 +204,54 @@ export interface Einvoice {
200
204
  missing: string[];
201
205
  } | null;
202
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;
254
+ }
203
255
  /** Where the result of a PDF tool is stored, as for a render. */
204
256
  export interface PdfOutputOptions {
205
257
  filename?: string;
@@ -259,6 +311,12 @@ export interface Render {
259
311
  * render keeps it too, which is where it says why. Absent from renders made before the feature.
260
312
  */
261
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;
262
320
  timings: Record<string, number> | null;
263
321
  error: {
264
322
  code?: string;