Skip to content

Commit 73e5587

Browse files
chore(deps): upgrade dev deps to fix audit and bump 3.2.0 (#27)
* chore(deps): upgrade dev deps to fix audit and bump 3.2.0 Resolves all 14 npm audit vulnerabilities (7 high, 7 moderate) by upgrading devDependencies. Runtime behavior unchanged — vulnerabilities were only in build/test tooling, not distributed in the published package. Upgrades: - @typescript-eslint/{eslint-plugin,parser}: ^6.21.0 → ^8.59.0 - vitest, @vitest/coverage-v8, @vitest/ui: ^1.6.1 → ^4.1.5 - openapi-typescript: ^6.7.0 → ^7.13.0 Adapts scripts/generate-types.ts to openapi-typescript v7 (AST output via astToString, URL input, Redocly config to tolerate legacy specs). Renames duplicate operationId in nf-servico-v1.yaml — v6 silently merged the two distinct operations under /external/{id} and /{id}; v7 correctly keeps them separate. Migrates test signatures for vitest 4 (it() options arg moved to second position, FormData mock uses function instead of arrow). Bumps version 3.1.0 → 3.2.0 (minor) and adds CHANGELOG entry. * fix(ci): downgrade vitest to 3.x to keep Node 18 supported CI on Node 18 failed because vitest 4 depends on rolldown, which imports `styleText` from node:util — only available in Node 20+. Downgrade vitest, @vitest/coverage-v8 and @vitest/ui from ^4.1.5 to ^3.2.4. Vitest 3.2.4 supports Node 18 ^ 20 ^ >=22 and already ships with the patched esbuild via Vite, so npm audit remains at 0 vulnerabilities. Existing test changes (it(name, opts, fn) signature, FormData function mock) are forward-compatible with both 3.x and 4.x. Validated full pipeline (validate:spec, generate, lint, typecheck, build, test) under Node 18.20.8 and Node 24.13.1. * ci: grant pull-requests:write to openapi-validation job The job uses actions/github-script to post a PR comment with spec validation info, but failed with HTTP 403 "Resource not accessible by integration" because the default GITHUB_TOKEN permissions for the workflow were read-only. Scope the new permissions to this job only (least privilege) and keep `contents: read` for checkout — adding a `permissions:` block implicitly drops all other defaults to none.
1 parent ff49f72 commit 73e5587

19 files changed

Lines changed: 23677 additions & 20644 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ jobs:
127127
openapi-validation:
128128
name: OpenAPI Validation
129129
runs-on: ubuntu-latest
130+
permissions:
131+
contents: read
132+
pull-requests: write
130133

131134
steps:
132135
- name: Checkout code

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,59 @@ Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.
55
O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/),
66
e este projeto adere ao [Versionamento Semântico](https://semver.org/lang/pt-BR/).
77

8+
## [3.2.0] - 2026-04-25
9+
10+
### 🔒 Correções de Segurança
11+
12+
Atualização de dependências de desenvolvimento para resolver vulnerabilidades reportadas pelo `npm audit`. **Nenhuma alteração no comportamento em runtime** — todas as vulnerabilidades estavam em ferramentas de build/teste, não distribuídas no pacote publicado.
13+
14+
- **Resolvidas 14 vulnerabilidades** (7 high, 7 moderate) em devDependencies:
15+
- `undici` (alto): GHSA-g9mf-h72j-4rw9, GHSA-2mjp-6q6p-2qxm, GHSA-vrm6-8vpv-qv8q, GHSA-v9p9-hfj2-hcw8, GHSA-4992-7rv2-5pvq (via `openapi-typescript`)
16+
- `minimatch` (alto): GHSA-3ppc-4f35-3m26, GHSA-7r86-cg39-jmmj, GHSA-23c5-xmqv-rm74 (via `@typescript-eslint`)
17+
- `esbuild` (moderado): GHSA-67mh-4wv8-2f99 (via `vitest`)
18+
- **Resultado**: `npm audit` agora reporta **0 vulnerabilidades**
19+
20+
### 🔧 Atualizações de Dependências (devDependencies)
21+
22+
- `@typescript-eslint/eslint-plugin`: `^6.21.0``^8.59.0`
23+
- `@typescript-eslint/parser`: `^6.21.0``^8.59.0`
24+
- `vitest`: `^1.6.1``^3.2.4`
25+
- `@vitest/coverage-v8`: `^1.6.1``^3.2.4`
26+
- `@vitest/ui`: `^1.6.1``^3.2.4`
27+
- `openapi-typescript`: `^6.7.0``^7.13.0`
28+
29+
> **Nota**: Vitest foi atualizado para 3.2.4 (não 4.x) para manter compatibilidade com Node 18 — vitest 4 depende do `rolldown`, que requer Node 20+. O esbuild patcheado já está disponível na linha 3.x via Vite.
30+
31+
### 🛠️ Pipeline de Geração de Tipos
32+
33+
Adaptação do script `scripts/generate-types.ts` para a nova API do `openapi-typescript` v7:
34+
35+
- Migração para nova assinatura: `openapiTS()` agora retorna AST e usa `astToString()` para conversão
36+
- Input convertido para `URL` via `pathToFileURL` (exigência do v7)
37+
- Opção `immutableTypes` renomeada para `immutable`; opção `exportType` removida (agora é padrão)
38+
- Adicionada configuração Redocly (`createConfig`) para tolerar specs legados que falhariam na validação estrita do v7
39+
40+
### 🧪 Testes
41+
42+
Ajustes em testes (nenhum teste foi adicionado/removido):
43+
44+
- 30 chamadas em testes de integração migradas da assinatura `it(name, fn, opts)` para a nova `it(name, opts, fn)` (compatível com vitest 3.x e futura migração para 4.x)
45+
- Mock de `FormData` em `tests/unit/companies.test.ts` ajustado para usar `function` ao invés de arrow function (boa prática de mock de construtor)
46+
- **606 testes passando**, 47 skipped (mesma cobertura de antes), validados em Node 18, 20 e 22
47+
48+
### 📝 Spec OpenAPI
49+
50+
- **`openapi/spec/nf-servico-v1.yaml`**: `operationId` do endpoint `GET /v1/companies/{company_id}/serviceinvoices/external/{id}` renomeado de `ServiceInvoices_idGet` para `ServiceInvoices_externalIdGet`. Resolve duplicata real no spec — `openapi-typescript` v6 silenciosamente fundia as duas operações distintas em uma só. Esta mudança é apenas em metadata de geração de código, **não afeta o comportamento da API**.
51+
52+
### ⚠️ Possível Impacto em Tipos Gerados
53+
54+
Usuários que referenciam tipos gerados internos (ex.: `operations["ServiceInvoices_idGet"]` em `src/generated/`) podem precisar de pequenos ajustes:
55+
56+
- Para o endpoint `/serviceinvoices/external/{id}`: usar `operations["ServiceInvoices_externalIdGet"]` (anteriormente fundido com `ServiceInvoices_idGet`)
57+
- A maioria dos consumidores que usa apenas `NfeClient` e seus métodos públicos **não é afetada**
58+
59+
---
60+
861
## [3.1.0] - 2026-02-22
962

1063
### 🎉 Expansão Massiva de Recursos - 10 Novos Recursos Implementados

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0
1+
3.2.0

openapi/spec/nf-servico-v1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4063,7 +4063,7 @@ paths:
40634063
- ServiceInvoices
40644064
summary: Obter os detalhes de uma Nota Fiscal de Serviço (NFSE) através do ID externo (externalId)
40654065
description: Você precisará do API Key da Empresa
4066-
operationId: ServiceInvoices_idGet
4066+
operationId: ServiceInvoices_externalIdGet
40674067
parameters:
40684068
- name: company_id
40694069
in: path

0 commit comments

Comments
 (0)