next-finance-mcp 0.5.2 → 0.5.3
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/dist/client.js +15 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -364,6 +364,18 @@ export async function buscarLancamentos(opts) {
|
|
|
364
364
|
lancamentos = Array.isArray(raw) ? raw
|
|
365
365
|
: (Object.values(raw).find(v => Array.isArray(v)) ?? []);
|
|
366
366
|
}
|
|
367
|
+
// Helpers para verificar plano/centro tanto no lançamento raiz quanto nas divisões
|
|
368
|
+
// (lançamentos rateados têm NomePlanoDeContas vazio no raiz e preenchido em ListaLancamentoDivisao)
|
|
369
|
+
function nomesPlano(l) {
|
|
370
|
+
const raiz = String(l["NomePlanoDeContas"] ?? "");
|
|
371
|
+
const divs = l["ListaLancamentoDivisao"] ?? [];
|
|
372
|
+
return [raiz, ...divs.map(d => String(d["NomePlanoDeContas"] ?? ""))].filter(Boolean);
|
|
373
|
+
}
|
|
374
|
+
function nomesCentro(l) {
|
|
375
|
+
const raiz = String(l["NomeCentroDeCustos"] ?? "");
|
|
376
|
+
const divs = l["ListaLancamentoDivisao"] ?? [];
|
|
377
|
+
return [raiz, ...divs.map(d => String(d["NomeCentroDeCustos"] ?? ""))].filter(Boolean);
|
|
378
|
+
}
|
|
367
379
|
// Filtros client-side (a API não filtra por plano/centro/tipo)
|
|
368
380
|
const excluirTransf = opts.excluirTransferencias !== false; // default: true
|
|
369
381
|
if (excluirTransf)
|
|
@@ -376,11 +388,12 @@ export async function buscarLancamentos(opts) {
|
|
|
376
388
|
lancamentos = lancamentos.filter(l => l["Receita"]);
|
|
377
389
|
if (opts.planoDeContas?.trim()) {
|
|
378
390
|
const t = opts.planoDeContas.trim().toLowerCase();
|
|
379
|
-
|
|
391
|
+
// inclui lançamento se plano bate no raiz OU em qualquer divisão
|
|
392
|
+
lancamentos = lancamentos.filter(l => nomesPlano(l).some(n => n.toLowerCase().includes(t)));
|
|
380
393
|
}
|
|
381
394
|
if (opts.centroDeCusto?.trim()) {
|
|
382
395
|
const t = opts.centroDeCusto.trim().toLowerCase();
|
|
383
|
-
lancamentos = lancamentos.filter(l =>
|
|
396
|
+
lancamentos = lancamentos.filter(l => nomesCentro(l).some(n => n.toLowerCase().includes(t)));
|
|
384
397
|
}
|
|
385
398
|
if (opts.busca?.trim()) {
|
|
386
399
|
const t = opts.busca.trim().toLowerCase();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-finance-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"mcpName": "io.github.paivapiovesan/next-finance",
|
|
5
5
|
"description": "MCP Server para o NEXT Finance (finance.net.br) — login via browser, listagem de carteiras, contas e lançamentos",
|
|
6
6
|
"type": "module",
|