@formfeed/sdk 0.3.8 → 0.3.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formfeed/sdk",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
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, Problem, 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, 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, Problem, 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, 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';
@@ -59,6 +59,55 @@ export interface RenderRequest {
59
59
  post?: PostProcessing | null;
60
60
  /** Check `data` against the template's stored schema first; a mismatch throws `data_validation_error`. */
61
61
  validate_data?: boolean;
62
+ /** The copy for the workspace's own bucket (bring your own storage); see `StorageOption`. */
63
+ storage?: StorageOption | null;
64
+ }
65
+ /**
66
+ * The copy for the workspace's own bucket (bring your own storage, Pro and above). Left out, the
67
+ * output is copied under the connection's key template. `false` leaves this document out; `key` names
68
+ * its object below the connection's prefix (relative, no `..`, at most 1024 bytes, overwritten if it
69
+ * exists). A render with its own key is never deduplicated; without a connection it throws
70
+ * `storage_not_configured`.
71
+ */
72
+ export type StorageOption = false | {
73
+ key?: string;
74
+ };
75
+ /** The provider's answer to a failed copy: its code, the HTTP status and the first line of its message. */
76
+ export interface StorageError {
77
+ code: string;
78
+ http_status: number | null;
79
+ message: string;
80
+ }
81
+ /**
82
+ * `storage` of a render or job: where the copy for the workspace's own bucket goes and how far it got.
83
+ * A synchronous render answers `pending`; `storage.delivered` or `storage.failed` follow as events.
84
+ */
85
+ export interface StorageDelivery {
86
+ status: 'pending' | 'delivered' | 'failed';
87
+ bucket: string;
88
+ key: string;
89
+ /** The object below the connection's `public_base_url`; null without one. */
90
+ url: string | null;
91
+ reason: 'permanent' | 'rejected' | 'exhausted' | 'source_gone' | 'connection_deleted' | 'connection_paused' | 'plan' | 'workspace_deleted' | null;
92
+ error: StorageError | null;
93
+ }
94
+ /** Event types a webhook endpoint can subscribe to; the two storage events only when listed. */
95
+ export type WebhookEventType = 'render.completed' | 'render.failed' | 'job.completed' | 'job.failed' | 'quota.warning' | 'quota.exceeded' | 'storage.delivered' | 'storage.failed';
96
+ /** `data` of a `storage.delivered` or `storage.failed` event. */
97
+ export interface StorageDeliveryEvent extends StorageDelivery {
98
+ /** The delivery, `dlv_…`. */
99
+ id: string;
100
+ render_id: string | null;
101
+ /** Set for a batch's items and its zip. */
102
+ job_id: string | null;
103
+ output: string;
104
+ content_type: string;
105
+ bytes: number;
106
+ sha256: string | null;
107
+ etag: string | null;
108
+ attempts: number;
109
+ created_at: string;
110
+ delivered_at: string | null;
62
111
  }
63
112
  /**
64
113
  * Slug → data type of the workspace's templates. Empty here; the file `formfeed types` generates
@@ -109,6 +158,8 @@ export interface PdfOutputOptions {
109
158
  expires_in?: number | null;
110
159
  access?: 'public' | 'signed';
111
160
  meta?: Record<string, unknown>;
161
+ /** The copy for the workspace's own bucket, as on a render. */
162
+ storage?: StorageOption | null;
112
163
  }
113
164
  export interface ProtectOptions extends PdfOutputOptions {
114
165
  /** Needed to open the document. */
@@ -153,6 +204,8 @@ export interface Render {
153
204
  template_checksum: string | null;
154
205
  output_sha256: string | null;
155
206
  deduplicated: boolean;
207
+ /** The copy in the workspace's own bucket; null when none applies. */
208
+ storage: StorageDelivery | null;
156
209
  timings: Record<string, number> | null;
157
210
  error: {
158
211
  code?: string;
@@ -187,6 +240,8 @@ export interface Job {
187
240
  failed: number;
188
241
  zip_url: string | null;
189
242
  zip_expires_at: string | null;
243
+ /** The zip's copy in the workspace's own bucket; each item carries its own. */
244
+ storage?: StorageDelivery | null;
190
245
  items: Render[];
191
246
  meta: Record<string, unknown>;
192
247
  created_at: string;
@@ -59,6 +59,55 @@ export interface RenderRequest {
59
59
  post?: PostProcessing | null;
60
60
  /** Check `data` against the template's stored schema first; a mismatch throws `data_validation_error`. */
61
61
  validate_data?: boolean;
62
+ /** The copy for the workspace's own bucket (bring your own storage); see `StorageOption`. */
63
+ storage?: StorageOption | null;
64
+ }
65
+ /**
66
+ * The copy for the workspace's own bucket (bring your own storage, Pro and above). Left out, the
67
+ * output is copied under the connection's key template. `false` leaves this document out; `key` names
68
+ * its object below the connection's prefix (relative, no `..`, at most 1024 bytes, overwritten if it
69
+ * exists). A render with its own key is never deduplicated; without a connection it throws
70
+ * `storage_not_configured`.
71
+ */
72
+ export type StorageOption = false | {
73
+ key?: string;
74
+ };
75
+ /** The provider's answer to a failed copy: its code, the HTTP status and the first line of its message. */
76
+ export interface StorageError {
77
+ code: string;
78
+ http_status: number | null;
79
+ message: string;
80
+ }
81
+ /**
82
+ * `storage` of a render or job: where the copy for the workspace's own bucket goes and how far it got.
83
+ * A synchronous render answers `pending`; `storage.delivered` or `storage.failed` follow as events.
84
+ */
85
+ export interface StorageDelivery {
86
+ status: 'pending' | 'delivered' | 'failed';
87
+ bucket: string;
88
+ key: string;
89
+ /** The object below the connection's `public_base_url`; null without one. */
90
+ url: string | null;
91
+ reason: 'permanent' | 'rejected' | 'exhausted' | 'source_gone' | 'connection_deleted' | 'connection_paused' | 'plan' | 'workspace_deleted' | null;
92
+ error: StorageError | null;
93
+ }
94
+ /** Event types a webhook endpoint can subscribe to; the two storage events only when listed. */
95
+ export type WebhookEventType = 'render.completed' | 'render.failed' | 'job.completed' | 'job.failed' | 'quota.warning' | 'quota.exceeded' | 'storage.delivered' | 'storage.failed';
96
+ /** `data` of a `storage.delivered` or `storage.failed` event. */
97
+ export interface StorageDeliveryEvent extends StorageDelivery {
98
+ /** The delivery, `dlv_…`. */
99
+ id: string;
100
+ render_id: string | null;
101
+ /** Set for a batch's items and its zip. */
102
+ job_id: string | null;
103
+ output: string;
104
+ content_type: string;
105
+ bytes: number;
106
+ sha256: string | null;
107
+ etag: string | null;
108
+ attempts: number;
109
+ created_at: string;
110
+ delivered_at: string | null;
62
111
  }
63
112
  /**
64
113
  * Slug → data type of the workspace's templates. Empty here; the file `formfeed types` generates
@@ -109,6 +158,8 @@ export interface PdfOutputOptions {
109
158
  expires_in?: number | null;
110
159
  access?: 'public' | 'signed';
111
160
  meta?: Record<string, unknown>;
161
+ /** The copy for the workspace's own bucket, as on a render. */
162
+ storage?: StorageOption | null;
112
163
  }
113
164
  export interface ProtectOptions extends PdfOutputOptions {
114
165
  /** Needed to open the document. */
@@ -153,6 +204,8 @@ export interface Render {
153
204
  template_checksum: string | null;
154
205
  output_sha256: string | null;
155
206
  deduplicated: boolean;
207
+ /** The copy in the workspace's own bucket; null when none applies. */
208
+ storage: StorageDelivery | null;
156
209
  timings: Record<string, number> | null;
157
210
  error: {
158
211
  code?: string;
@@ -187,6 +240,8 @@ export interface Job {
187
240
  failed: number;
188
241
  zip_url: string | null;
189
242
  zip_expires_at: string | null;
243
+ /** The zip's copy in the workspace's own bucket; each item carries its own. */
244
+ storage?: StorageDelivery | null;
190
245
  items: Render[];
191
246
  meta: Record<string, unknown>;
192
247
  created_at: string;