Repository navigation
Releases: pdfmonkey/pdfmonkey-node
Release list
v1.4.0
Highlights
verifyWebhook()works with real PDFMonkey webhooks. It used to reject every delivery after a valid signature, because it expected a{ type, data, timestamp }envelope the API never sends. It now returns the body PDFMonkey actually delivers. (#21)- Search and filter by several statuses in
documentCards.list(). (#19) waitForGeneration()respects its timeout, even when a poll is slow or being retried. (#18)
Upgrading
Webhooks
verifyWebhook() now returns a WebhookPayload:
{ document }fordocuments.generation.successanddocuments.generation.failure, wheredocumentis aDocumentCard{ period_start, period_end, available_documents, threshold }forquota.warning
The event type isn't part of the body, so narrow on its shape and check the status:
const payload = await verifyWebhook(rawBody, headers, secret);
if ('document' in payload) {
if (payload.document.status === 'success') {
console.log(payload.document.download_url);
} else {
console.log(payload.document.failure_cause);
}
} else {
console.log(`${payload.available_documents} documents left`);
}These types were removed because they never matched what the API sends: WebhookEvent, WebhookEventType, DocumentDoneEvent, DocumentDoneEventData, DocumentErrorEvent, DocumentErrorEventData and UnknownWebhookEvent.
meta arrives as a JSON-encoded string, so JSON.parse() it before reading its keys.
DocumentStatus
'error' is no longer a DocumentStatus value: the API only returns 'draft', 'pending', 'generating', 'success' and 'failure'. Code that compares a status to 'error' will no longer compile. Remove those branches, since they could never match.
What's new
documentCards.list()acceptssearch: an exact document ID, or part of the filename (case-sensitive).documentCards.list()accepts several statuses:status: ['pending', 'generating']. An empty array applies no status filter.- Query values can be arrays and are sent as
key[]=a&key[]=b. - The accepted
foldersandsortvalues ondocumentTemplates.list()are now documented.
const page = await client.documentCards.list({
search: 'invoice',
status: ['pending', 'generating'],
});Fixes
verifyWebhook()returns the real webhook payloads instead of rejecting them. (#21)workspaceCards.update()sendsPUTinstead ofPATCH, matching the API and the other update endpoints. (#19)documents.waitForGeneration()treatstimeoutas a total time limit. When it runs out, in-flight polls and their retries are aborted, instead of returning a late success or reporting the timeout only after a slow response came back. (#18)
Full changelog: v1.3.0...v1.4.0
v1.3.0
Minor Changes
- 44349df: Adding
client.workspaceCardsto call theworkspace_cardsendpoint:list()/listAll()return workspace summaries including the admin'scurrent_plan, andupdate()renames a workspace.
v1.2.0
Minor Changes
- 2c03f6d: Fixing endpoints that never worked against the live API:
workspaces.list()/listAll()/get()now read theapps/apppayload keys,documentTemplates.create()andtemplateFolders.create()take a requiredworkspace_id, andrestHooks.create()sends theevent/platformfields the API expects (events are nowdocuments.generation.success/documents.generation.failure). Adding a live-API integration suite runnable withpnpm test:integration.
v1.1.0
Minor Changes
- df48ead: Adding a required
workspace_idtosnippets.list()andtemplateFolders.list()(the API returns nothing without it), and alistAll()method on workspaces, document templates, snippets and template folders that fetches every item in a singlepage=allrequest.
v1.0.0
Initial public release of the PDFMonkey Node.js SDK. See CHANGELOG.md. Published to npm: https://www.npmjs.com/package/pdfmonkey