Repository navigation
Expose signed invoice download URLs - #118
Merged
Merged
Conversation
The new methods are additive, so this is a minor release. The bump is not optional here. `deploy.yml` publishes only when `npm view <package>@<version>` misses, so merging the signed-URL work while package.json still said 5.0.0 would have skipped the publish silently, and the Slack notification is gated on the same condition, so nothing would have reported it either. It is also what unblocks the consumers that need these methods.
Add `receipts.getDownloadUrl(id)` and `retentions.getDownloadUrl(id, format)` alongside the invoice methods, so a caller can hand a short-lived URL to its own user or client instead of receiving the file itself. A receipt has one representation — a nota de venta is not stamped, so there is no XML — which is why its method takes no format. `SignedDownloadUrl` moves in with the other shared types now that three resources return it, and the tests for the whole surface live in one file.
The escaped unicode sequences in the description, keywords, author and contributors are equivalent to the literal characters a previous edit replaced them with, and the change had nothing to do with this feature. Restore the file so the diff only carries the work it is about.
javorosas
requested review from
raul-facturapi
and
a lite review from Copilot
September 14, 2026 17:26
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved requests remain for compile-time API assertions and broader PDF/XML/cancellation URL test coverage.
Pull request overview
Adds signed download URL APIs and metadata across invoice, receipt, retention, preview, and ZIP-request resources.
Changes:
- Adds
SignedDownloadUrland URL-based resource methods. - Corrects the receipts-to-invoice preview endpoint and validates resource IDs.
- Updates tests, documentation, changelog, and version to 5.1.0.
File summaries
| File | Summary |
|---|---|
test/web/runtime-compat.web.test.ts |
Updates the preview endpoint expectation. |
test/node/signed-download-urls.node.test.ts |
Tests signed URL requests and validation. |
test/node/runtime-compat.node.test.ts |
Updates the preview endpoint expectation. |
test/node/invoices-zip-requests.node.test.ts |
Tests ZIP-request URL support. |
src/types/common.ts |
Defines the SignedDownloadUrl type. |
src/resources/retentions.ts |
Adds retention URL methods. |
src/resources/receipts.ts |
Adds receipt URL support and corrects preview routing. |
src/resources/invoices.ts |
Adds invoice, cancellation, preview, and ZIP-request URL methods. |
README.md |
Documents signed URL usage. |
package.json |
Bumps the version to 5.1.0. |
CHANGELOG.md |
Records the 5.1.0 release changes. |
Review details
Suppressed comments (3)
src/types/common.ts:157
- This adds a public
SignedDownloadUrlcontract, but the repository's compile-time API suite (test-d/runtime-types.test-d.ts) has no assertion for this type or any of the new URL methods. The runtime tests do not verify the generated declaration shape, so a wrong export or return type could still passtest:types; add tsd assertions forSignedDownloadUrland representative URL methods (including the preview and ZIP-request variants).
export interface SignedDownloadUrl {
url: string;
expires_at: string;
content_type: string;
filename: string;
test/node/signed-download-urls.node.test.ts:88
- Only
retentions.downloadXmlUrlis exercised here; the new PDF and ZIP URL methods are untested, so a typo in either route would not be caught. Add successful-request assertions for all three retention formats, preferably by parameterizing the cases.
const result = await client.retentions.downloadXmlUrl('ret_123')
test/node/signed-download-urls.node.test.ts:38
- The added suite only exercises
downloadZipUrlfor invoice downloads, so regressions in the new PDF/XML URL paths—and the successful cancellation XML URL path—would still pass. Add successful-request cases for each newly exposed invoice format (or a table-driven test) with their expected URLs.
const result = await client.invoices.downloadZipUrl('inv_123')
- Files reviewed: 11/11 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
downloadPdfUrl,downloadXmlUrl, anddownloadZipUrlwhere each representation is availabledownloadZipRequestUrl,previewPdfUrl, andpreviewToInvoicePdfUrlalongside their binary counterpartsurl,expires_at,content_type, andfilenameFormat compaction remains a concern of the MCP server; the public SDK preserves its established per-operation method design.
Depends on FacturAPI/facturapi#2285. Public API documentation is in FacturAPI/facturapi-docs#299.
Verification
pnpm run buildpnpm run test:unit(48 passed: 38 Node + 10 web)pnpm run test:types