@oliveiratco1/n8n-nodes-grid402 1.0.1 → 1.1.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,6 +1,6 @@
|
|
|
1
1
|
# @oliveiratco1/n8n-nodes-grid402 ⚡
|
|
2
2
|
|
|
3
|
-
Conector oficial de **Community Node para n8n** do **Grid402** (`https://grid402.online`) — Hub de
|
|
3
|
+
Conector oficial de **Community Node para n8n** do **Grid402** (`https://grid402.online`) — Hub de 31 Micro-Serviços de Dados Públicos Abertos, KYB Brasil (Receita Federal CNPJ, Simples/MEI, Sanções CGU CEIS/CNEP, Dossiê 360º com Veredito IA), Segurança Web3 (Token Safety, Chain Telemetry), SEC EDGAR, Auditoria CVE/OSV, Mercados Preditivos, Execução em Lote (Batch), Dias Úteis Bancários ANBIMA, Extração Web-to-Markdown e Verificação Zero-PII de E-mails Corporativos (via `POST`).
|
|
4
4
|
|
|
5
5
|
100% em conformidade com a **LGPD (Art. 1º)**, **GDPR (Recital 14)** e **Lei de Acesso à Informação (Lei nº 12.527/2011 - LAI)**: processa exclusivamente registros públicos de Pessoas Jurídicas e fatos técnicos de rede, com descarte estrito de dados pessoais (Zero-PII e Zero-Retention) e assinatura criptográfica de autenticidade (`_oracle_proof` ECDSA `secp256k1`).
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@ No painel do seu n8n:
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
-
## 🛠️ Operações Incluídas (
|
|
28
|
+
## 🛠️ Operações Incluídas (31 Operações: Micro-Serviços + Gestão de Saldo)
|
|
29
29
|
|
|
30
30
|
- **KYB Brasil e Compliance Corporativo (Zero-PII):**
|
|
31
31
|
- `Dossiê 360º KYB Brasil + Veredito IA` (`APPROVED`, `FLAGGED`, `REJECTED` + Score 0-100 + Receita Federal + Simples/MEI + CGU CEIS/CNEP)
|
|
@@ -34,8 +34,16 @@ No painel do seu n8n:
|
|
|
34
34
|
- `Sanções CGU CEIS e CNEP por CNPJ`
|
|
35
35
|
- `Compliance Score 360 por CNPJ`
|
|
36
36
|
- `Auditoria KYB Global (CNPJ + OFAC + GLEIF LEI)`
|
|
37
|
-
- **
|
|
38
|
-
- `
|
|
37
|
+
- **Web3 Security, DeFi Guardrails e Telemetria Multi-Chain:**
|
|
38
|
+
- `Auditoria de Segurança de Token Multi-Chain` (`token-safety`: score 0-100, veredito, honeypot e liquidez DEX via GoPlus + DexScreener em Base, Ethereum, Polygon, Arbitrum e Solana)
|
|
39
|
+
- `Telemetria Multi-Chain` (`chain-telemetry`: bloco/slot, gas/priority fees, latência RPC e TVL DeFiLlama)
|
|
40
|
+
- **Mercados Financeiros, SEC EDGAR, Previsões e DevSecOps:**
|
|
41
|
+
- `Empresa & Filings SEC EDGAR EUA` (`sec-company`: CIK/Ticker, formulários 10-K/10-Q/8-K e fatos XBRL opcionais)
|
|
42
|
+
- `Mercados de Previsão Normalizados` (`prediction-markets`: Polymarket + Kalshi)
|
|
43
|
+
- `Auditoria de Vulnerabilidades OSV + CISA KEV` (`vuln-audit`: pacotes npm/PyPI/Go/Maven/Packagist/crates.io ou IDs CVE/GHSA)
|
|
44
|
+
- **Automação B2B, Batch, IA e RAG:**
|
|
45
|
+
- `Execução em Lote Multi-Serviço (POST /api/v1/batch)` (1 a 5 consultas em 1 chamada, cobrança exata por item e estorno automático no Session Pass em falhas)
|
|
46
|
+
- `Verificar E-mail Corporativo B2B Zero-PII (POST /api/v1/email-verify)` (Sintaxe RFC, MX, SPF, DMARC, disposable e score 0-100 via JSON body sem query string)
|
|
39
47
|
- `Extrair Site para Markdown Limpo / RAG` (Conversão anti-SSRF de páginas web para Markdown)
|
|
40
48
|
- **Financeiro, Calendário Bancário ANBIMA e Endereçamento:**
|
|
41
49
|
- `Dias Úteis Bancários ANBIMA (D+N)`
|
|
@@ -49,4 +57,17 @@ No painel do seu n8n:
|
|
|
49
57
|
- **Rede, Segurança e Identidade Global:**
|
|
50
58
|
- `Resolução DNS Autoritativa`, `Inspeção TLS/SSL`, `Inteligência BGP/ASN`, `Auditoria Completa de Domínio`, `GLEIF LEI`, `OFAC SDN / ONU` e `Notarização Criptográfica SHA-256 + ECDSA`.
|
|
51
59
|
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 📦 Workflows Prontos para Importar no n8n (Copiar / Importar JSON)
|
|
63
|
+
|
|
64
|
+
No n8n, clique em **Workflows → Import from URL** (ou baixe o `.json` e use **Import from File**):
|
|
65
|
+
|
|
66
|
+
1. **Enriquecimento B2B + Dossiê KYB 360º (`email-verify` + `dossier` + `extract`):**
|
|
67
|
+
- Arquivo: [`examples/n8n/grid402_b2b_lead_kyb_enrichment_workflow.json`](https://github.com/oliveiratc/Grid402/blob/main/examples/n8n/grid402_b2b_lead_kyb_enrichment_workflow.json)
|
|
68
|
+
- Valida o e-mail corporativo (Zero-PII), consulta o Dossiê 360º com Veredito IA (`APPROVED`/`FLAGGED`/`REJECTED`) e extrai o site do lead em Markdown limpo.
|
|
69
|
+
2. **Compliance CNPJ + Endereçamento CEP (`compliance` + `cep`):**
|
|
70
|
+
- Arquivo: [`examples/n8n/grid402_cnpj_compliance_workflow.json`](https://github.com/oliveiratc/Grid402/blob/main/examples/n8n/grid402_cnpj_compliance_workflow.json)
|
|
71
|
+
- Cruza Receita Federal + Sanções CGU (CEIS/CNEP) + consulta CEP com código IBGE.
|
|
72
|
+
|
|
52
73
|
Licença MIT • Grid402 Network Intelligence (`https://grid402.online`)
|
|
@@ -60,6 +60,18 @@ class Grid402Api {
|
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'RapidAPI Host',
|
|
65
|
+
name: 'rapidApiHost',
|
|
66
|
+
type: 'string',
|
|
67
|
+
default: 'grid402-open-data-kyb-ai-utilities.p.rapidapi.com',
|
|
68
|
+
description: 'Host proxy da API assinada no RapidAPI Hub (ex.: grid402-open-data-kyb-ai-utilities.p.rapidapi.com)',
|
|
69
|
+
displayOptions: {
|
|
70
|
+
show: {
|
|
71
|
+
authMode: ['rapidApi'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
63
75
|
{
|
|
64
76
|
displayName: 'Endpoint Base',
|
|
65
77
|
name: 'baseUrl',
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
class Grid402 {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.description = {
|
|
6
|
-
displayName: 'Grid402 (CNPJ, KYB 360,
|
|
6
|
+
displayName: 'Grid402 (CNPJ, KYB 360, Web3, SEC, Vuln & Batch)',
|
|
7
7
|
name: 'grid402',
|
|
8
8
|
icon: 'file:grid402.svg',
|
|
9
9
|
group: ['transform'],
|
|
10
10
|
version: 1,
|
|
11
11
|
subtitle: '={{$parameter["operation"]}}',
|
|
12
|
-
description: '
|
|
12
|
+
description: '31 APIs públicas verificáveis (Zero-PII): Token Safety, Prediction Markets, SEC EDGAR, Vuln Audit (OSV+KEV), Chain Telemetry, Multi-Service Batch, Dossiê KYB 360 IA, Receita Federal CNPJ, Simples/MEI, Sanções CGU, ANBIMA, Web-to-Markdown, Email Verify POST, GLEIF LEI, OFAC e DNS/SSL.',
|
|
13
13
|
defaults: {
|
|
14
14
|
name: 'Grid402',
|
|
15
15
|
},
|
|
@@ -53,8 +53,14 @@ class Grid402 {
|
|
|
53
53
|
{ name: 'Identidade Corporativa Global GLEIF LEI (2 cr)', value: 'lei', description: 'Consulta código ISO 17442 LEI em 200+ jurisdições (CC0 1.0)' },
|
|
54
54
|
{ name: 'Triagem Global OFAC SDN / ONU e AML Web3 (4 cr)', value: 'ofac', description: 'Triagem de sanções internacionais para carteiras 0x ou entidades' },
|
|
55
55
|
{ name: 'Notarização Criptográfica SHA-256 + ECDSA (1 cr)', value: 'notarize', description: 'Carimbo do tempo M2M e prova de existência Zero-Retention' },
|
|
56
|
+
{ name: 'Auditoria de Segurança de Token Multi-Chain (3 cr)', value: 'token-safety', description: 'Score de risco 0-100, veredito (SAFE/CAUTION/HIGH_RISK/CRITICAL), honeypot e liquidez DEX via GoPlus + DexScreener (Base, Ethereum, Polygon, Arbitrum, Solana)' },
|
|
57
|
+
{ name: 'Mercados de Previsão: Polymarket + Kalshi (2 cr)', value: 'prediction-markets', description: 'Probabilidades implícitas 0-100%, volume 24h e liquidez agregados do Polymarket e Kalshi' },
|
|
58
|
+
{ name: 'Empresa & Filings SEC EDGAR EUA (2 cr)', value: 'sec-company', description: 'Perfil corporativo SEC EDGAR (CIK/Ticker), formulários 10-K/10-Q/8-K e fatos financeiros XBRL opcionais' },
|
|
59
|
+
{ name: 'Auditoria de Vulnerabilidades OSV + CISA KEV (1 cr)', value: 'vuln-audit', description: 'Auditoria determinística de pacotes (npm, PyPI, Go, Maven, Packagist, crates.io) ou CVE/GHSA com CISA KEV' },
|
|
60
|
+
{ name: 'Telemetria Multi-Chain: RPC + TVL DeFiLlama (1 cr)', value: 'chain-telemetry', description: 'Altura de bloco/slot, gas/priority fees, latência RPC e TVL DeFiLlama (Base, Ethereum, Polygon, Arbitrum, Solana)' },
|
|
61
|
+
{ name: 'Execução em Lote Multi-Serviço: 1-5 Itens (Soma)', value: 'batch', description: 'Executa até 5 consultas Grid402 em 1 chamada POST (máx. 2 no sandbox) com cobrança exata e estorno automático por falha' },
|
|
56
62
|
{ name: 'Consultar Saldo do Session Pass (Gratuito)', value: 'pass-balance', description: 'Verifica créditos restantes, validade e Spend Controls do seu pass_g402_...' },
|
|
57
|
-
{ name: 'Status Geral dos
|
|
63
|
+
{ name: 'Status Geral dos 31 Serviços (Gratuito)', value: 'summary', description: 'Resumo de saúde e latência de todos os 31 serviços do Grid402' },
|
|
58
64
|
],
|
|
59
65
|
},
|
|
60
66
|
{
|
|
@@ -245,6 +251,216 @@ class Grid402 {
|
|
|
245
251
|
},
|
|
246
252
|
},
|
|
247
253
|
},
|
|
254
|
+
{
|
|
255
|
+
displayName: 'Endereço do Token (EVM 0x ou Solana Base58)',
|
|
256
|
+
name: 'tokenAddress',
|
|
257
|
+
type: 'string',
|
|
258
|
+
default: '',
|
|
259
|
+
placeholder: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
260
|
+
description: 'Contrato do token EVM (0x + 40 hex) ou mint Solana Base58',
|
|
261
|
+
displayOptions: {
|
|
262
|
+
show: {
|
|
263
|
+
operation: ['token-safety'],
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
displayName: 'Rede Blockchain (Chain)',
|
|
269
|
+
name: 'chain',
|
|
270
|
+
type: 'string',
|
|
271
|
+
default: '',
|
|
272
|
+
placeholder: 'base (ou ethereum, polygon, arbitrum, solana)',
|
|
273
|
+
description: 'Rede alvo (base, ethereum, polygon, arbitrum ou solana; deixe vazio para autodetecção em Token Safety ou padrão base em Chain Telemetry)',
|
|
274
|
+
displayOptions: {
|
|
275
|
+
show: {
|
|
276
|
+
operation: ['token-safety', 'chain-telemetry'],
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
displayName: 'Busca (Keyword)',
|
|
282
|
+
name: 'query',
|
|
283
|
+
type: 'string',
|
|
284
|
+
default: '',
|
|
285
|
+
placeholder: 'bitcoin',
|
|
286
|
+
description: 'Filtro opcional de busca por palavra-chave (parâmetro q)',
|
|
287
|
+
displayOptions: {
|
|
288
|
+
show: {
|
|
289
|
+
operation: ['prediction-markets'],
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
displayName: 'Fonte de Mercados',
|
|
295
|
+
name: 'pmSource',
|
|
296
|
+
type: 'options',
|
|
297
|
+
default: 'all',
|
|
298
|
+
options: [
|
|
299
|
+
{ name: 'Todas (Polymarket + Kalshi)', value: 'all' },
|
|
300
|
+
{ name: 'Polymarket', value: 'polymarket' },
|
|
301
|
+
{ name: 'Kalshi', value: 'kalshi' },
|
|
302
|
+
],
|
|
303
|
+
displayOptions: {
|
|
304
|
+
show: {
|
|
305
|
+
operation: ['prediction-markets'],
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
displayName: 'Status do Mercado',
|
|
311
|
+
name: 'pmStatus',
|
|
312
|
+
type: 'options',
|
|
313
|
+
default: 'active',
|
|
314
|
+
options: [
|
|
315
|
+
{ name: 'Ativos', value: 'active' },
|
|
316
|
+
{ name: 'Encerrados', value: 'closed' },
|
|
317
|
+
],
|
|
318
|
+
displayOptions: {
|
|
319
|
+
show: {
|
|
320
|
+
operation: ['prediction-markets'],
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
displayName: 'Ticker da Ação (EUA)',
|
|
326
|
+
name: 'ticker',
|
|
327
|
+
type: 'string',
|
|
328
|
+
default: '',
|
|
329
|
+
placeholder: 'AAPL',
|
|
330
|
+
description: 'Símbolo do ticker negociado nos EUA (ex.: AAPL, MSFT). Informe Ticker ou CIK.',
|
|
331
|
+
displayOptions: {
|
|
332
|
+
show: {
|
|
333
|
+
operation: ['sec-company'],
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
displayName: 'CIK SEC EDGAR (Opcional se Ticker informado)',
|
|
339
|
+
name: 'cik',
|
|
340
|
+
type: 'string',
|
|
341
|
+
default: '',
|
|
342
|
+
placeholder: '0000320193',
|
|
343
|
+
description: 'Central Index Key de 1 a 10 dígitos na SEC',
|
|
344
|
+
displayOptions: {
|
|
345
|
+
show: {
|
|
346
|
+
operation: ['sec-company'],
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
displayName: 'Formulários SEC (Opcional)',
|
|
352
|
+
name: 'forms',
|
|
353
|
+
type: 'string',
|
|
354
|
+
default: '',
|
|
355
|
+
placeholder: '10-K,10-Q,8-K',
|
|
356
|
+
description: 'Lista separada por vírgula de tipos de formulário SEC',
|
|
357
|
+
displayOptions: {
|
|
358
|
+
show: {
|
|
359
|
+
operation: ['sec-company'],
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
displayName: 'Limite de Resultados',
|
|
365
|
+
name: 'limit',
|
|
366
|
+
type: 'number',
|
|
367
|
+
default: 10,
|
|
368
|
+
description: 'Quantidade máxima de itens retornados (1-20 em Prediction Markets, 1-25 em SEC EDGAR)',
|
|
369
|
+
displayOptions: {
|
|
370
|
+
show: {
|
|
371
|
+
operation: ['prediction-markets', 'sec-company'],
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
displayName: 'Incluir Fatos XBRL (US-GAAP)',
|
|
377
|
+
name: 'includeFacts',
|
|
378
|
+
type: 'boolean',
|
|
379
|
+
default: false,
|
|
380
|
+
description: 'Quando ativo, inclui métricas financeiras XBRL US-GAAP limitadas a 8 MB',
|
|
381
|
+
displayOptions: {
|
|
382
|
+
show: {
|
|
383
|
+
operation: ['sec-company'],
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
displayName: 'ID da Vulnerabilidade (CVE / GHSA — Opcional)',
|
|
389
|
+
name: 'vulnId',
|
|
390
|
+
type: 'string',
|
|
391
|
+
default: '',
|
|
392
|
+
placeholder: 'CVE-2021-44228',
|
|
393
|
+
description: 'Consulte por ID direto (CVE/GHSA) OU informe Ecossistema + Pacote',
|
|
394
|
+
displayOptions: {
|
|
395
|
+
show: {
|
|
396
|
+
operation: ['vuln-audit'],
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
displayName: 'Ecossistema do Pacote',
|
|
402
|
+
name: 'ecosystem',
|
|
403
|
+
type: 'string',
|
|
404
|
+
default: 'npm',
|
|
405
|
+
placeholder: 'npm, PyPI, Go, Maven, Packagist, crates.io, NuGet, RubyGems',
|
|
406
|
+
description: 'Ecossistema do pacote para consulta no OSV.dev',
|
|
407
|
+
displayOptions: {
|
|
408
|
+
show: {
|
|
409
|
+
operation: ['vuln-audit'],
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
displayName: 'Nome do Pacote',
|
|
415
|
+
name: 'packageName',
|
|
416
|
+
type: 'string',
|
|
417
|
+
default: '',
|
|
418
|
+
placeholder: 'lodash',
|
|
419
|
+
description: 'Nome do pacote a auditar (ex.: lodash, requests)',
|
|
420
|
+
displayOptions: {
|
|
421
|
+
show: {
|
|
422
|
+
operation: ['vuln-audit'],
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
displayName: 'Versão do Pacote (Opcional)',
|
|
428
|
+
name: 'packageVersion',
|
|
429
|
+
type: 'string',
|
|
430
|
+
default: '',
|
|
431
|
+
placeholder: '4.17.20',
|
|
432
|
+
description: 'Versão específica para filtrar vulnerabilidades aplicáveis',
|
|
433
|
+
displayOptions: {
|
|
434
|
+
show: {
|
|
435
|
+
operation: ['vuln-audit'],
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
displayName: 'Itens do Lote (JSON Array, 1-5 itens)',
|
|
441
|
+
name: 'batchItems',
|
|
442
|
+
type: 'json',
|
|
443
|
+
default: '[\n {"service": "dns", "params": {"domain": "base.org"}},\n {"service": "chain-telemetry", "params": {"chain": "base"}}\n]',
|
|
444
|
+
description: 'Array JSON com 1 a 5 objetos {"service":"...","params":{...}} (máx. 2 itens em modo sandbox)',
|
|
445
|
+
displayOptions: {
|
|
446
|
+
show: {
|
|
447
|
+
operation: ['batch'],
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
displayName: 'Idempotency-Key (Opcional)',
|
|
453
|
+
name: 'idempotencyKey',
|
|
454
|
+
type: 'string',
|
|
455
|
+
default: '',
|
|
456
|
+
placeholder: 'batch-kyb-2026-001',
|
|
457
|
+
description: 'Chave opcional de idempotência para evitar cobrança duplicada em retries (TTL 300s)',
|
|
458
|
+
displayOptions: {
|
|
459
|
+
show: {
|
|
460
|
+
operation: ['batch'],
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
},
|
|
248
464
|
],
|
|
249
465
|
};
|
|
250
466
|
}
|
|
@@ -263,7 +479,13 @@ class Grid402 {
|
|
|
263
479
|
}
|
|
264
480
|
|
|
265
481
|
const baseUrl = String(creds.baseUrl || 'https://grid402.online').replace(/\/$/, '');
|
|
266
|
-
const
|
|
482
|
+
const defaultRapidApiHost = 'grid402-open-data-kyb-ai-utilities.p.rapidapi.com';
|
|
483
|
+
const rapidApiHost = String(creds.rapidApiHost || defaultRapidApiHost)
|
|
484
|
+
.replace(/^https?:\/\//i, '')
|
|
485
|
+
.replace(/\/.*$/, '')
|
|
486
|
+
.trim() || defaultRapidApiHost;
|
|
487
|
+
const authMode = creds.authMode || '';
|
|
488
|
+
const canContinueOnFail = () => Boolean(typeof this.continueOnFail === 'function' && this.continueOnFail());
|
|
267
489
|
|
|
268
490
|
for (let i = 0; i < items.length; i++) {
|
|
269
491
|
const getParam = (name, fallback = '') => {
|
|
@@ -278,8 +500,16 @@ class Grid402 {
|
|
|
278
500
|
};
|
|
279
501
|
|
|
280
502
|
const operation = getParam('operation', 'dossier');
|
|
503
|
+
const isFreeOperation = operation === 'summary' || operation === 'pass-balance';
|
|
281
504
|
const qs = new URLSearchParams();
|
|
282
505
|
let path = `/api/v1/${operation}`;
|
|
506
|
+
let httpMethod = 'GET';
|
|
507
|
+
let requestBody;
|
|
508
|
+
|
|
509
|
+
const headers = {
|
|
510
|
+
'Accept': 'application/json',
|
|
511
|
+
'User-Agent': 'n8n-nodes-grid402/1.1.0',
|
|
512
|
+
};
|
|
283
513
|
|
|
284
514
|
if (operation === 'summary') {
|
|
285
515
|
path = '/status';
|
|
@@ -290,7 +520,9 @@ class Grid402 {
|
|
|
290
520
|
const cleanCnpj = String(getParam('cnpj', '')).replace(/\D/g, '');
|
|
291
521
|
qs.set('cnpj', cleanCnpj);
|
|
292
522
|
} else if (operation === 'email-verify') {
|
|
293
|
-
|
|
523
|
+
httpMethod = 'POST';
|
|
524
|
+
headers['Content-Type'] = 'application/json';
|
|
525
|
+
requestBody = JSON.stringify({ email: String(getParam('email', '')).trim() });
|
|
294
526
|
} else if (operation === 'extract') {
|
|
295
527
|
qs.set('url', String(getParam('url', '')).trim());
|
|
296
528
|
const maxChars = getParam('maxChars', 12000);
|
|
@@ -325,25 +557,136 @@ class Grid402 {
|
|
|
325
557
|
qs.set('content', String(getParam('content', '')));
|
|
326
558
|
} else if (operation === 'global-markets') {
|
|
327
559
|
qs.set('market', String(getParam('market', 'US')).trim());
|
|
560
|
+
} else if (operation === 'token-safety') {
|
|
561
|
+
const tokenAddress = String(getParam('tokenAddress', '') || getParam('address', '')).trim();
|
|
562
|
+
const chain = String(getParam('chain', '')).trim();
|
|
563
|
+
if (tokenAddress) qs.set('address', tokenAddress);
|
|
564
|
+
if (chain) qs.set('chain', chain);
|
|
565
|
+
} else if (operation === 'prediction-markets') {
|
|
566
|
+
const qVal = String(getParam('query', '') || getParam('q', '')).trim();
|
|
567
|
+
const sourceVal = String(getParam('pmSource', '') || getParam('source', 'all')).trim();
|
|
568
|
+
const statusVal = String(getParam('pmStatus', '') || getParam('status', 'active')).trim();
|
|
569
|
+
const limitVal = getParam('limit', 10);
|
|
570
|
+
if (qVal) qs.set('q', qVal);
|
|
571
|
+
if (sourceVal) qs.set('source', sourceVal);
|
|
572
|
+
if (statusVal) qs.set('status', statusVal);
|
|
573
|
+
if (limitVal !== '' && limitVal !== null && limitVal !== undefined) qs.set('limit', String(limitVal));
|
|
574
|
+
} else if (operation === 'sec-company') {
|
|
575
|
+
const tickerVal = String(getParam('ticker', '')).trim();
|
|
576
|
+
const cikVal = String(getParam('cik', '')).trim();
|
|
577
|
+
const formsVal = String(getParam('forms', '')).trim();
|
|
578
|
+
const limitVal = getParam('limit', 10);
|
|
579
|
+
const includeFactsVal = getParam('includeFacts', getParam('include_facts', false));
|
|
580
|
+
if (tickerVal) qs.set('ticker', tickerVal);
|
|
581
|
+
if (cikVal) qs.set('cik', cikVal);
|
|
582
|
+
if (formsVal) qs.set('forms', formsVal);
|
|
583
|
+
if (limitVal !== '' && limitVal !== null && limitVal !== undefined) qs.set('limit', String(limitVal));
|
|
584
|
+
if (includeFactsVal === true || includeFactsVal === 'true' || includeFactsVal === 1 || includeFactsVal === '1') {
|
|
585
|
+
qs.set('include_facts', 'true');
|
|
586
|
+
}
|
|
587
|
+
} else if (operation === 'vuln-audit') {
|
|
588
|
+
const vulnIdVal = String(getParam('vulnId', '') || getParam('id', '')).trim();
|
|
589
|
+
const ecoVal = String(getParam('ecosystem', '')).trim();
|
|
590
|
+
const pkgVal = String(getParam('packageName', '') || getParam('package', '')).trim();
|
|
591
|
+
const verVal = String(getParam('packageVersion', '') || getParam('version', '')).trim();
|
|
592
|
+
if (vulnIdVal && !pkgVal) {
|
|
593
|
+
qs.set('id', vulnIdVal);
|
|
594
|
+
} else {
|
|
595
|
+
if (ecoVal) qs.set('ecosystem', ecoVal);
|
|
596
|
+
if (pkgVal) qs.set('package', pkgVal);
|
|
597
|
+
if (verVal) qs.set('version', verVal);
|
|
598
|
+
if (vulnIdVal) qs.set('id', vulnIdVal);
|
|
599
|
+
}
|
|
600
|
+
} else if (operation === 'chain-telemetry') {
|
|
601
|
+
const chainVal = String(getParam('chain', 'base')).trim() || 'base';
|
|
602
|
+
qs.set('chain', chainVal);
|
|
603
|
+
} else if (operation === 'batch') {
|
|
604
|
+
httpMethod = 'POST';
|
|
605
|
+
headers['Content-Type'] = 'application/json';
|
|
606
|
+
const rawBatch = getParam('batchItems', getParam('items', '[]'));
|
|
607
|
+
let parsedItems;
|
|
608
|
+
try {
|
|
609
|
+
const decoded = typeof rawBatch === 'string' ? JSON.parse(rawBatch) : rawBatch;
|
|
610
|
+
parsedItems = Array.isArray(decoded) ? decoded : (decoded && Array.isArray(decoded.items) ? decoded.items : null);
|
|
611
|
+
} catch (parseErr) {
|
|
612
|
+
const errMsg = `JSON inválido em batchItems: ${parseErr.message}`;
|
|
613
|
+
if (canContinueOnFail()) {
|
|
614
|
+
returnData.push({ json: { error: 'InvalidBatchJSON', message: errMsg }, pairedItem: { item: i } });
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
throw new Error(errMsg);
|
|
618
|
+
}
|
|
619
|
+
if (!Array.isArray(parsedItems) || parsedItems.length === 0 || parsedItems.length > 5) {
|
|
620
|
+
const errMsg = 'Operação batch requer entre 1 e 5 itens em batchItems.';
|
|
621
|
+
if (canContinueOnFail()) {
|
|
622
|
+
returnData.push({ json: { error: 'InvalidBatchItems', message: errMsg }, pairedItem: { item: i } });
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
throw new Error(errMsg);
|
|
626
|
+
}
|
|
627
|
+
const idempKey = String(getParam('idempotencyKey', '') || getParam('idempotency_key', '')).trim();
|
|
628
|
+
if (idempKey) {
|
|
629
|
+
headers['Idempotency-Key'] = idempKey;
|
|
630
|
+
}
|
|
631
|
+
requestBody = JSON.stringify({ items: parsedItems });
|
|
328
632
|
}
|
|
329
633
|
|
|
330
|
-
|
|
331
|
-
const fullUrl = `${baseUrl}${path}${queryString ? '?' + queryString : ''}`;
|
|
332
|
-
|
|
333
|
-
const headers = {
|
|
334
|
-
'Accept': 'application/json',
|
|
335
|
-
'User-Agent': 'n8n-nodes-grid402/1.0.0',
|
|
336
|
-
};
|
|
634
|
+
let effectiveBaseUrl = baseUrl;
|
|
337
635
|
|
|
338
|
-
if (
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
636
|
+
if (!isFreeOperation) {
|
|
637
|
+
if (authMode === 'sessionPass') {
|
|
638
|
+
const token = String(creds.sessionPass || '').trim();
|
|
639
|
+
if (!token) {
|
|
640
|
+
const errMsg = 'Credencial Grid402 incompleta: modo Session Pass selecionado, mas o token pass_g402_... está vazio. Adquira via Pix/Cartão em https://grid402.online/pass?tier=starter&autopix=1 ou selecione explicitamente o modo Sandbox.';
|
|
641
|
+
if (canContinueOnFail()) {
|
|
642
|
+
returnData.push({ json: { error: 'MissingSessionPass', message: errMsg }, pairedItem: { item: i } });
|
|
643
|
+
continue;
|
|
644
|
+
}
|
|
645
|
+
throw new Error(errMsg);
|
|
646
|
+
}
|
|
647
|
+
headers['X-Payment'] = token;
|
|
648
|
+
} else if (authMode === 'rapidApi') {
|
|
649
|
+
const key = String(creds.rapidApiKey || '').trim();
|
|
650
|
+
if (!key) {
|
|
651
|
+
const errMsg = 'Credencial Grid402 incompleta: modo RapidAPI selecionado, mas a X-RapidAPI-Key está vazia. Informe sua chave RapidAPI Hub ou troque o modo de autenticação.';
|
|
652
|
+
if (canContinueOnFail()) {
|
|
653
|
+
returnData.push({ json: { error: 'MissingRapidApiKey', message: errMsg }, pairedItem: { item: i } });
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
throw new Error(errMsg);
|
|
657
|
+
}
|
|
658
|
+
let hostHeader = rapidApiHost;
|
|
659
|
+
if (baseUrl.includes('.p.rapidapi.com')) {
|
|
660
|
+
try {
|
|
661
|
+
hostHeader = new URL(baseUrl).host;
|
|
662
|
+
} catch (_) {
|
|
663
|
+
hostHeader = rapidApiHost;
|
|
664
|
+
}
|
|
665
|
+
} else {
|
|
666
|
+
effectiveBaseUrl = `https://${rapidApiHost}`;
|
|
667
|
+
}
|
|
668
|
+
headers['X-RapidAPI-Key'] = key;
|
|
669
|
+
headers['X-RapidAPI-Host'] = hostHeader;
|
|
670
|
+
} else if (authMode === 'sandbox') {
|
|
671
|
+
headers['X-Payment'] = 'demo';
|
|
672
|
+
} else {
|
|
673
|
+
const errMsg = 'Credencial Grid402 não configurada para operação paga. Configure Grid402 API com Session Pass (https://grid402.online/pass), RapidAPI Hub ou selecione explicitamente o modo Sandbox (3 req/dia).';
|
|
674
|
+
if (canContinueOnFail()) {
|
|
675
|
+
returnData.push({ json: { error: 'MissingCredentials', message: errMsg }, pairedItem: { item: i } });
|
|
676
|
+
continue;
|
|
677
|
+
}
|
|
678
|
+
throw new Error(errMsg);
|
|
679
|
+
}
|
|
344
680
|
}
|
|
345
681
|
|
|
346
|
-
const
|
|
682
|
+
const queryString = qs.toString();
|
|
683
|
+
const fullUrl = `${effectiveBaseUrl}${path}${queryString ? '?' + queryString : ''}`;
|
|
684
|
+
|
|
685
|
+
const fetchOpts = { method: httpMethod, headers };
|
|
686
|
+
if (requestBody !== undefined) {
|
|
687
|
+
fetchOpts.body = requestBody;
|
|
688
|
+
}
|
|
689
|
+
const response = await fetch(fullUrl, fetchOpts);
|
|
347
690
|
const data = await response.json().catch(() => ({ status: response.status }));
|
|
348
691
|
|
|
349
692
|
if (response.status === 402 || response.status === 429) {
|
|
@@ -352,9 +695,25 @@ class Grid402 {
|
|
|
352
695
|
rapidapi_card_usd: 'https://rapidapi.com/oliveiratc/api/grid402-open-data-kyb-ai-utilities',
|
|
353
696
|
how_to_configure: 'Copie seu token pass_g402_... após pagar o Pix e cole na credencial Grid402 API do n8n.',
|
|
354
697
|
};
|
|
698
|
+
const statusLabel = response.status === 402 ? 'HTTP 402 Payment Required' : 'HTTP 429 Rate Limit Exceeded';
|
|
699
|
+
const actionableMsg = `[Grid402 ${statusLabel}] ${data.message || data.reason || data.error || 'Créditos ou assinatura necessários.'} — Adquira Session Pass via Pix/Cartão em https://grid402.online/pass?tier=starter&autopix=1 ou assine no RapidAPI Hub.`;
|
|
700
|
+
if (canContinueOnFail()) {
|
|
701
|
+
returnData.push({ json: { ...data, http_status: response.status, error_message: actionableMsg }, pairedItem: { item: i } });
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
throw new Error(actionableMsg);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
if (response.status >= 400) {
|
|
708
|
+
const errMsg = `[Grid402 HTTP ${response.status}] ${data.message || data.error || 'Falha na requisição'}`;
|
|
709
|
+
if (canContinueOnFail()) {
|
|
710
|
+
returnData.push({ json: { ...data, http_status: response.status, error_message: errMsg }, pairedItem: { item: i } });
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
713
|
+
throw new Error(errMsg);
|
|
355
714
|
}
|
|
356
715
|
|
|
357
|
-
returnData.push({ json: data });
|
|
716
|
+
returnData.push({ json: data, pairedItem: { item: i } });
|
|
358
717
|
}
|
|
359
718
|
|
|
360
719
|
return [returnData];
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliveiratco1/n8n-nodes-grid402",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"description": "Official n8n Community Node for Grid402 -
|
|
7
|
+
"description": "Official n8n Community Node for Grid402 - 31 Verifiable Public Data, Token Safety, Prediction Markets, SEC EDGAR, Vuln Audit (OSV+CISA KEV), Chain Telemetry, Multi-Service Batch, Brazil KYB 360 (CNPJ, Simples/MEI, CGU Sanctions), ANBIMA Workdays, Web-to-Markdown, Zero-PII POST Email Verify, GLEIF LEI, OFAC and Network Utility APIs with Session Pass (Pix/Card/USDC) and ECDSA Oracle Proof.",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"n8n-community-node-package",
|
|
10
10
|
"n8n",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
|
+
"build": "node --check index.js && node --check dist/nodes/Grid402/Grid402.node.js && node --check dist/credentials/Grid402Api.credentials.js",
|
|
43
44
|
"test": "node test_n8n_node.cjs"
|
|
44
45
|
},
|
|
45
46
|
"n8n": {
|