Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ on:
workflow_dispatch:

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Setup pnpm
uses: pnpm/action-setup@v6

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check formatting
run: pnpm run format:check

- name: Run linter
run: pnpm run lint

build-dist:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
node-version: '24'
registry-url: 'https://registry.npmjs.org'
cache: pnpm

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"singleQuote": true,
"semi": false
"semi": true
}
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"eslint.enable": true
"eslint.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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).

## [5.2.0] 2026-10-07

### Added

- Add `nominaCatalogs.searchDeductions` and `nominaCatalogs.searchPerceptions` to search the SAT payroll deduction and perception catalogs.

## [5.1.0] 2026-09-12

### Added
Expand Down Expand Up @@ -53,38 +59,53 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add draft support methods for retentions: `retentions.updateDraft`, `retentions.copyToDraft`, and `retentions.stampDraft`.

## [4.18.0] 2026-06-06

### Added

- Expose structured API error metadata through `FacturapiError`, including `status`, `code`, `path`, `location`, `errors`, `logId`, and response `headers`.

## [4.17.0] 2026-04-27

### Added

- Add support for custom request headers through the `Facturapi` constructor options.
- Add `receipts.toInvoice` to create customer invoices from multiple receipt keys.
- Add `receipts.previewToInvoicePdf` to generate PDF previews for to-invoice payloads.

## [4.16.0] 2026-04-23

### Added

- Add new export catalogs for customs regimes, transport keys, SCT permits, COFEPRIS sectors, pharmaceutical forms, special transport conditions, customs documents, transport types, transport figures, ISTMO registry, loading keys, maritime configurations, rail traffic, containers, rail cars, rail service types, transfer reasons, incoterms, and customs units.
- Expose the new enums on the `Facturapi` class as static getters for namespace-style access.

## [4.15.0] 2026-04-13

### Added

- Add `organizations.updateDefaultSeries` to set an organization default series by type.

### Fixed
- Return blob if content-type is octet-stream. This is the coverage for zip files

- Return blob if content-type is octet-stream. This is the coverage for zip files

## [4.14.2] 2026-03-31

### Fixed

- Add `TaxFactor.EXENTO` (`"Exento"`) to align SDK enums with the API/OpenAPI allowed tax factor values.

## [4.14.1] 2026-03-31

### Fixed

- Fix `organizations.checkDomainIsAvailable` to call `GET /organizations/domain-check` with query params (instead of an unsupported `PUT` payload flow).
- Align method input naming to query semantics for clearer usage (`query`).

## [4.14.0] 2026-03-04

### Added

- Add `facturapi.comercioExteriorCatalogs.searchTariffFractions` method for Fracción Arancelaria SAT catalog
- Add organization team/access management methods under `organizations`:
`listTeamAccess`, `retrieveTeamAccess`, `removeTeamAccess`,
Expand All @@ -99,6 +120,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Include `rfc_provider_cert` in stamp-related invoice typings and responses (thanks to @tetexxr).

### Changed

- Use `PUT` for role reassignment/update methods:
`organizations.updateTeamAccessRole` and `organizations.updateTeamRole`.
- Use `Authorization: Bearer <apiKey>` by default in SDK requests (API supports this scheme).
Expand All @@ -107,6 +129,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Pin `npm` to `10.9.2` in CI/deploy workflows for deterministic lockfile validation across Node versions.

### Fixed

- Improve non-OK HTTP error handling fallback when JSON error bodies are malformed or missing, returning clearer text/status errors.
- Handle `ReadableStream` read failures during binary download conversion to Node streams to avoid unhandled rejections.
- Strengthen WebCrypto webhook signature validation by using `subtle.verify` and explicit hex signature validation.
Expand Down Expand Up @@ -138,7 +161,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

- Add new catalogs for cartaporte
- Add new catalogs for cartaporte
- `searchAirTransportCodes`, `searchTransportConfigs`,`searchRightsOfPassage`,`searchCustomsDocuments`,`searchPackagingTypes`,`searchTrailerTypes`, `searchHazardousMaterials`, `searchNavalAuthorizations`, `searchPortStations`, `searchMarineContainers`

## [4.10.0] 2025-09-04
Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ If you've used [Stripe](https://stripe.com) or [Conekta](https://conekta.io), yo

## Compatibility

| Runtime | Support |
| --- | --- |
| Node.js | `>=18` (CI tested on 18, 20, 22, 24) |
| Browser | Environments with `fetch`, `FormData`, and `Blob` |
| Runtime | Support |
| ------------ | ------------------------------------------------------------ |
| Node.js | `>=18` (CI tested on 18, 20, 22, 24) |
| Browser | Environments with `fetch`, `FormData`, and `Blob` |
| React Native | Versions that provide global `fetch`, `FormData`, and `Blob` |

## Install
Expand Down Expand Up @@ -44,6 +44,17 @@ CommonJS:
const Facturapi = require('facturapi').default;
```

### Payroll catalogs

```ts
const deductions = await facturapi.nominaCatalogs.searchDeductions({
q: '001',
});
const perceptions = await facturapi.nominaCatalogs.searchPerceptions({
q: '001',
});
```

### Create a customer

```ts
Expand Down Expand Up @@ -76,6 +87,7 @@ const invoice = await facturapi.invoices.create({
#### Download your invoice

`downloadZip`, `downloadPdf` and `downloadXml` return a binary result:

- Node.js: stream-like object
- Browser: `Blob`

Expand Down
17 changes: 11 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const js = require('@eslint/js')
const tseslint = require('typescript-eslint')
const globals = require('globals')
const eslintConfigPrettier = require('eslint-config-prettier')
const js = require('@eslint/js');
const tseslint = require('typescript-eslint');
const globals = require('globals');
const eslintConfigPrettier = require('eslint-config-prettier');

module.exports = [
{
Expand All @@ -18,7 +18,6 @@ module.exports = [
},
},
rules: {
semi: ['error', 'never'],
quotes: ['error', 'single', { avoidEscape: true }],
curly: ['error', 'multi-line'],
'space-before-function-paren': ['error', 'always'],
Expand All @@ -30,4 +29,10 @@ module.exports = [
},
},
eslintConfigPrettier,
]
{
files: ['**/*.{js,cjs,mjs,ts}'],
rules: {
semi: ['error', 'always'],
},
},
];
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "facturapi",
"version": "5.1.0",
"description": "SDK oficial de Facturapi para Node.js y navegadores. Integra facturaci\u00f3n electr\u00f3nica en M\u00e9xico (CFDI) de forma simple y obt\u00e9n una perspectiva fiscal completa de tu operaci\u00f3n, con b\u00fasquedas indexadas, env\u00edo de documentos y trazabilidad.",
"version": "5.2.0",
"description": "SDK oficial de Facturapi para Node.js y navegadores. Integra facturación electrónica en México (CFDI) de forma simple y obtén una perspectiva fiscal completa de tu operación, con búsquedas indexadas, envío de documentos y trazabilidad.",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -49,13 +49,13 @@
"sat-mexico",
"mexico",
"sat",
"facturaci\u00f3n",
"facturación",
"facturapi"
],
"author": "Facturaci\u00f3n Espacial <contacto@facturapi.io>",
"author": "Facturación Espacial <contacto@facturapi.io>",
"contributors": [
{
"name": "Ra\u00fal S\u00e1nchez"
"name": "Raúl Sánchez"
},
{
"name": "Javier Rosas"
Expand Down
Loading
Loading