Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
727af63
FAC-2305 Hydrate response dates to match SDK types
javorosas Sep 22, 2026
98345d0
FAC-2305 Prepare SDK 5.1.1 release
javorosas Sep 22, 2026
b6ea489
FAC-2305 Preserve string-valued response dates
javorosas Sep 22, 2026
f700987
FAC-2305 Complete date contract audit for SDK 6.0
javorosas Sep 22, 2026
d8a90a4
FAC-2305 Cover cancellation status check date
javorosas Sep 23, 2026
57f387c
fix: allow nullable customer response dates
javorosas Sep 28, 2026
ed39200
chore: update SDK tooling and patch vulnerable dependencies
javorosas Sep 29, 2026
43e8c38
fix: publish explicit ESM and CommonJS package exports
javorosas Sep 29, 2026
7bea28b
chore: move release and tooling changes to a separate PR
javorosas Sep 29, 2026
7a149f8
chore: remove generated test output
javorosas Sep 29, 2026
322a440
chore: prepare SDK 6 release with modern tooling and package exports
javorosas Sep 29, 2026
dec6ffb
chore: use Rolldown for declaration bundling and remove unused hooks
javorosas Sep 29, 2026
7abfd33
docs: improve SDK onboarding and CommonJS examples
javorosas Sep 29, 2026
d3fd965
docs: guide upgrades from SDK 3 through 5 and focus release notes on …
javorosas Sep 29, 2026
e3a245c
fix: parse webhook events after remote signature validation
javorosas Sep 30, 2026
4fa6981
docs: simplify first invoice example
javorosas Sep 30, 2026
5040e6a
docs: preserve published changelog entries
javorosas Sep 30, 2026
eee0409
docs: preserve historical changelog policy
javorosas Sep 30, 2026
7dd2d4f
feat: generate SDK contracts and resource methods from OpenAPI
javorosas Sep 30, 2026
6655e58
chore: update YAML parser security fixes
javorosas Sep 30, 2026
639ebdc
feat: refine generated CFDI input relationships
javorosas Sep 30, 2026
de7cce4
fix: align optional invoice inputs and simplify release notes
javorosas Sep 30, 2026
a8f330a
fix: align generated draft customer response types
javorosas Sep 30, 2026
5ed43a8
chore: mark generated SDK artifacts for focused reviews
javorosas Sep 30, 2026
f6c73a3
refactor: derive SDK operation bindings from OpenAPI
javorosas Sep 30, 2026
f898526
refactor: verify OpenAPI by hash and improve generated method docs
javorosas Oct 1, 2026
d367e3a
refactor: pin OpenAPI generation to a documentation commit
javorosas Oct 1, 2026
7c609ef
fix: type invoice creation responses and hydrate their dates
javorosas Oct 1, 2026
2ebc9da
chore: sync specification with invoice variant labels
javorosas Oct 1, 2026
e1da518
chore: sync grouped invoice creation schemas
javorosas Oct 1, 2026
6e926bc
test: cover invoice status discrimination in public types
javorosas Oct 1, 2026
a10dc5c
fix: align date formats and improve generated method documentation
javorosas Oct 1, 2026
914e0f5
fix: preserve CommonJS types and align payment contracts
javorosas Oct 1, 2026
39724da
docs: clarify download objects and add local SDK playground
javorosas Oct 1, 2026
465ccb6
fix: emit plain JSDoc descriptions for union autocomplete
javorosas Oct 1, 2026
9146680
fix: allow incomplete customers when requesting an edit link
javorosas Oct 1, 2026
9ac8d35
fix: align conditional customer, cancellation and global invoice types
javorosas Oct 1, 2026
f73b4a6
feat: add typed customer creation methods
javorosas Oct 2, 2026
fa64706
docs: highlight v6 developer experience and migration cases
javorosas Oct 2, 2026
32b048a
docs: describe current JavaScript SDK capabilities
javorosas Oct 2, 2026
d53f026
docs: clarify compatibility version references
javorosas Oct 2, 2026
f1ba639
fix: align partial updates, stream uploads and payment summary types
javorosas Oct 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Keep generated artifacts tracked, but collapse their diffs on GitHub.
src/generated/contracts.ts linguist-generated=true
src/generated/dates.ts linguist-generated=true
src/generated/input.ts linguist-generated=true
src/generated/models.ts linguist-generated=true
src/generated/output.ts linguist-generated=true
src/resources/customers.ts linguist-generated=true
src/resources/invoices.ts linguist-generated=true
src/resources/organizations.ts linguist-generated=true
src/resources/products.ts linguist-generated=true
src/resources/receipts.ts linguist-generated=true
src/resources/retentions.ts linguist-generated=true
src/tools/cartaPorteCatalogs.ts linguist-generated=true
src/tools/catalogs.ts linguist-generated=true
src/tools/comercioExteriorCatalogs.ts linguist-generated=true
src/tools/tools.ts linguist-generated=true
src/tools/webhooks.ts linguist-generated=true
src/types/common.ts linguist-generated=true
src/types/complements.ts linguist-generated=true
src/types/customer.ts linguist-generated=true
src/types/invoice.ts linguist-generated=true
src/types/organization.ts linguist-generated=true
src/types/product.ts linguist-generated=true
src/types/receipt.ts linguist-generated=true
src/types/retention.ts linguist-generated=true
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Build package
run: pnpm run build

- name: Verify generated SDK
run: pnpm run generate:sdk:check

- name: Upload dist artifact
uses: actions/upload-artifact@v7
with:
Expand Down Expand Up @@ -56,7 +59,7 @@ jobs:
path: dist

- name: Run Node 18 runtime compatibility smoke
run: node --test test/compat/node18-compat.test.cjs
run: node --test test/compat/*.test.cjs test/compat/*.test.mjs

node-runtime:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -125,6 +128,9 @@ jobs:
- name: Run type contract tests
run: pnpm run test:types

- name: Lint
run: pnpm run lint

browser-smoke:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
test.js
lib/
dist/
test-results/
playwright-report/

# Created by https://www.gitignore.io/api/node,macos,linux,windows,visualstudiocode

Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
coverage/
test-results/
playwright-report/
30 changes: 30 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributor instructions

## Consumer documentation

- Write `CHANGELOG.md` for developers who consume the SDK. Document observable behavior, public API and type changes, compatibility requirements, fixes, and any action required to upgrade.
- Keep build tools, bundlers, test runners, lint/format configuration, CI setup, and development-only dependency updates out of the changelog. Explain those in pull request descriptions instead.
- Summarize type changes by consumer capability or correction, not by individual fields or implementation steps. Put detailed upgrade cases in the README migration guide.
- Keep changelog entries factual and concise. Use a friendly, task-oriented tone in the README; occasional emojis belong there, not in new changelog entries.
- Preserve published changelog entries as written. Apply editorial changes only to new entries; correct historical entries only when a concrete factual error has been verified.
- Keep migration guidance in the README. State which integrations need no code changes as explicitly as those that do. Verify historical behavior against released source before documenting a migration; do not infer a breaking change from a version number alone.

## OpenAPI generation

- Generate resource methods, request/response types, model aliases, and response date plans with `pnpm generate:sdk`. Do not edit files carrying a generation banner.
- `openapi/source.json` pins a complete public FacturAPI/facturapi-docs commit SHA. `pnpm sync:openapi` resolves docs `main` to its current commit, downloads the spec from that exact commit, and records it only after parsing succeeds. An explicit public branch, tag or full SHA is supported for coordinated PRs. Run `pnpm generate:sdk` after syncing.
- Generation always downloads the YAML from the recorded commit into memory; it never follows a moving branch or writes a spec snapshot. Builds and runtime tests use tracked generated files and need no spec download. Commit public documentation changes and sync their public ref before generating; do not record local filesystem paths or pin unpublished local changes.
- Generate method summaries, argument descriptions and return documentation from OpenAPI. Keep SDK-specific binary upload/download and local webhook verification guidance in the generator; attach documentation to every public overload and use absolute documentation links.
- `openapi-typescript` resolves the OpenAPI contract; the TypeScript compiler resolves the resulting types for date plans. Do not add a second JSON Schema interpreter or a handwritten date-path inventory.
- `scripts/sdk/resources.json` maps public resource/method names to operation IDs. Use a string operation ID for normal endpoints; HTTP bindings and signatures are derived from the spec. Add overrides only for established argument names, optionality/nullability, fixed download formats, multipart/local-signature behavior, or response overloads. Do not repeat inferred path/body/query bindings. Every public HTTP operation must have a binding; adding an operation intentionally fails generation until its public method is chosen.
- Use `bodySchema` for an explicit SDK convenience method that selects a specific input variant from the public spec while preserving the original HTTP operation. Keep `create()` available for dynamic or incomplete customer inputs; do not add runtime validation or rewrite the supplied body.
- Use `querySchema` to bind a grouped query contract from the public spec when separate OpenAPI query parameters cannot express dependencies between them. Keep conditional values and required fields in that schema rather than repeating them in generator code. TypeScript cannot express arbitrary string exclusions (`not`); do not invent a narrower country catalog to work around that limitation.
- Use `bodyByQueryFlag` only for a verified relationship between a query flag and an input schema that OpenAPI cannot express across parameters and request bodies. Keep both input schemas in the public spec; require a literal `true` to select the incomplete body and preserve the normal input for dynamic booleans.
- Preserve the SDK convention that a declared request body is a required method argument unless the operation explicitly marks it optional (`required: false`) or a compatibility override says otherwise. Optional query objects accept null by default; explicit overrides preserve existing exceptions.
- `scripts/sdk/models.json` preserves public model names. `scripts/sdk/enums.json` binds existing runtime enums to their semantic schema locations; never bind enums merely because their numeric/string values happen to match. Named enum drift must be corrected explicitly.
- Preserve the real HTTP transport, binary behavior, and local cryptography. Test external HTTP boundaries with fixtures; do not replace these implementations with mocks.
- Run `pnpm generate:sdk:check`, `pnpm test`, `pnpm lint`, and browser tests for generation changes. Cover input strings/Date values, nullable dates, complement discriminants, opaque metadata/XML, and additions to the contract.
- This repository is public. Never copy private implementation sources, paths, identifiers, diagnostics, or planning context into generated files, tests, commits, PR descriptions, or review replies.
- Keep the source commit metadata and generated sources tracked; do not commit a downloaded spec. Mark generated artifacts with `linguist-generated` in `.gitattributes` so reviews focus on the generator, bindings, runtime, and tests; keep handwritten configuration visible. Update the attributes when adding generated output files.

- Describe current SDK capabilities in the README without release announcements ; version references are appropriate when they explain verified compatibility or when a capability became available. Put release improvements in the changelog. The SDK supports Node.js and browsers; keep titles and summaries accurate for both.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [6.0.0] Unreleased

### Breaking

- Response timestamps are consistently returned as `Date` objects. SAT stamp timestamps and calendar dates remain strings.
- Request and response types now follow the API contract, with more precise CFDI and complement inputs. TypeScript integrations may need adjustments; see the [migration guide from v3, v4, and v5](README.md#actualizar-desde-v3-v4-o-v5).
- Import from `facturapi`; direct imports into internal package files such as `facturapi/dist/...` are no longer supported.

### Fixed

- Correct request typing for partial product updates and native Node.js file uploads.
- Webhook signature validation consistently returns parsed events with converted dates in Node.js and browsers.

### Added

- Autocompletion and editor documentation for request fields, method arguments, and responses across SDK operations.
- More precise input types for CFDI variants, drafts, structured complements, and customer creation. Related fields are checked by TypeScript in supported cases, helping catch incomplete or incompatible inputs before sending a request.
- Receipt invoicing distinguishes invoice creation from `dry_run` summaries in its return types.
- Methods to create national, foreign, and generic RFC customers with specific input types; assign receipt customers; upload FIEL certificates; and check API health.
- CommonJS supports `const Facturapi = require('facturapi')` directly, while retaining `.default` compatibility. CommonJS and ESM include matching TypeScript definitions.

## [5.1.0] 2026-09-12

### Added
Expand Down
Loading
Loading