facturas 0.13.0 → 0.14.0

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/README.md CHANGED
@@ -1,13 +1,17 @@
1
- # facturas
1
+ <div align="center">
2
+ <h1>facturas</h1>
2
3
 
3
- [![npm version](https://img.shields.io/npm/v/facturas.svg)](https://www.npmjs.com/package/facturas)
4
- [![CI](https://github.com/LaPyme/facturas/actions/workflows/ci.yml/badge.svg)](https://github.com/LaPyme/facturas/actions/workflows/ci.yml)
5
- [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](https://github.com/LaPyme/facturas/blob/main/LICENSE)
4
+ <a href="https://lapyme.com.ar"><img alt="Creado por LaPyme" src="https://img.shields.io/badge/Creado%20por%20LaPyme-000000.svg?style=for-the-badge&labelColor=000000"></a>
5
+ <a href="https://www.npmjs.com/package/facturas"><img alt="Versión en npm" src="https://img.shields.io/npm/v/facturas.svg?style=for-the-badge&labelColor=000000"></a>
6
+ <a href="https://github.com/LaPyme/facturas/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/LaPyme/facturas/ci.yml?branch=main&style=for-the-badge&label=CI&labelColor=000000"></a>
7
+ <a href="https://github.com/LaPyme/facturas/blob/main/LICENSE"><img alt="Licencia" src="https://img.shields.io/npm/l/facturas.svg?style=for-the-badge&labelColor=000000"></a>
8
+
9
+ </div>
6
10
 
7
11
  SDK de Node.js para facturación electrónica con ARCA / AFIP. Emití facturas,
8
12
  notas de crédito y notas de débito, y consultá el Padrón con una sola API.
9
13
 
10
- - **Solo ESM**, Node.js **>= 20**
14
+ - **Solo ESM**, Node.js **>= 22**
11
15
  - **CLI incluido**: `npx facturas init` genera la clave y el CSR, y
12
16
  `npx facturas check` nombra la capa de ARCA que falla
13
17
  - **Integración directa con ARCA**, sin proxy ni dependencia alojada
@@ -73,10 +77,12 @@ repetir esa clave, consulta el número reservado en vez de empezar otra emisión
73
77
 
74
78
  ```ts
75
79
  import { createArcaClient, createPostgresStore } from "facturas";
76
- import { sql } from "@vercel/postgres";
80
+ import { Pool } from "pg";
81
+
82
+ const pool = new Pool({ connectionString: process.env.DATABASE_URL });
77
83
 
78
84
  const arca = createArcaClient({
79
- store: createPostgresStore({ query: (text, params) => sql.query(text, params) }),
85
+ store: createPostgresStore({ query: (text, params) => pool.query(text, params) }),
80
86
  });
81
87
 
82
88
  const factura = await arca.issue(input, { idempotencyKey: venta.id });
@@ -133,14 +139,25 @@ una reserva sin emitir.
133
139
  seguridad.
134
140
  - [Ejemplos](./docs/reference/examples.mdx): índice de [examples/](./examples).
135
141
 
142
+ ## Contribuir
143
+
144
+ Las contribuciones son bienvenidas. [CONTRIBUTING.md](./CONTRIBUTING.md)
145
+ explica cómo levantar el repositorio y proponer un cambio. Usá los
146
+ [issues](https://github.com/LaPyme/facturas/issues) para reportar errores y
147
+ conversar propuestas.
148
+
149
+ ## Seguridad
150
+
151
+ No abras issues públicos para reportar vulnerabilidades. Seguí
152
+ [SECURITY.md](./SECURITY.md) y escribinos a
153
+ [tomas@lapyme.com.ar](mailto:tomas@lapyme.com.ar).
154
+
136
155
  ## Estado del proyecto
137
156
 
138
157
  Pre-1.0. Mientras la versión empiece en `0.`, un minor puede cambiar o quitar
139
158
  partes de la API pública. Fijá la versión exacta y leé el
140
159
  [changelog](./packages/arca/CHANGELOG.md) antes de actualizar.
141
160
 
142
- Para contribuir, mirá [CONTRIBUTING.md](./CONTRIBUTING.md).
143
-
144
161
  ## Licencia
145
162
 
146
163
  Apache-2.0
@@ -3678,7 +3678,7 @@ async function recordConflict(store, key, outcome) {
3678
3678
  function readSettledRecord(json) {
3679
3679
  try {
3680
3680
  const record = JSON.parse(json);
3681
- if (!record || record.v !== 1 || !Number.isSafeInteger(record.number) || (record.kind === "conflict" ? !record.found || typeof record.found !== "object" : record.kind !== "superseded" || typeof record.by !== "string")) {
3681
+ if (record?.v !== 1 || !Number.isSafeInteger(record.number) || (record.kind === "conflict" ? !record.found || typeof record.found !== "object" : record.kind !== "superseded" || typeof record.by !== "string")) {
3682
3682
  throw new Error("Invalid settled structure");
3683
3683
  }
3684
3684
  return record;
@@ -4497,7 +4497,7 @@ async function runSequenceBarrier({
4497
4497
  function readSequenceRecord(json) {
4498
4498
  try {
4499
4499
  const record = JSON.parse(json);
4500
- if (!record || record.v !== 1 || typeof record.key !== "string" || !Number.isSafeInteger(record.number)) {
4500
+ if (record?.v !== 1 || typeof record.key !== "string" || !Number.isSafeInteger(record.number)) {
4501
4501
  throw new Error("Invalid sequence structure");
4502
4502
  }
4503
4503
  return record;
@@ -4943,4 +4943,4 @@ export {
4943
4943
  withLease,
4944
4944
  createFileStore
4945
4945
  };
4946
- //# sourceMappingURL=chunk-KPWAQMR5.mjs.map
4946
+ //# sourceMappingURL=chunk-65C5ZQOB.mjs.map