opf-br-mcp 0.6.1 → 0.7.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 +17 -9
- package/dist/index.js +84 -101
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,20 +52,28 @@ bem na janela de contexto de um agente, e despejá-la desperdiça tokens. A solu
|
|
|
52
52
|
apenas o mínimo necessário em cada etapa do funil:
|
|
53
53
|
|
|
54
54
|
1. **`list_domains`** — catálogo barato: quais domínios e filtros existem.
|
|
55
|
-
2. **`search`** — índice **pesquisável e resumido**. Cada resultado traz só
|
|
56
|
-
`id`, `path`, `method`, `summary`/`name
|
|
57
|
-
|
|
58
|
-
e arrays vazios).
|
|
55
|
+
2. **`search`** — índice **pesquisável e resumido**. Cada resultado traz só os
|
|
56
|
+
campos leves (`id`, `type`, `path`, `method`, `summary`/`name`, `required`,
|
|
57
|
+
`in`); o nó pesado da spec (`detail`) e a lista `refs` são removidos do
|
|
58
|
+
resumo, e o retorno ainda é compactado (omite `null` e arrays vazios).
|
|
59
59
|
3. **`get_item`** — só aqui o nó integral da spec é entregue, e apenas para o
|
|
60
60
|
`id` que o agente escolheu.
|
|
61
61
|
|
|
62
62
|
Como o Swagger/OpenAPI vira dados pesquisáveis: o parser "achata" a spec em itens
|
|
63
63
|
com `id` estável — um por endpoint (`type: operation`, ex.
|
|
64
|
-
`payments-v4:POST /pix/payments`) e um por
|
|
65
|
-
`payments-v4:schema:PixPayment`)
|
|
66
|
-
`
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
`payments-v4:POST /pix/payments`) e um por component reutilizável: `type: schema`
|
|
65
|
+
(`payments-v4:schema:PixPayment`), `type: response` (`webhook:response:202Webhook`),
|
|
66
|
+
`type: parameter` (`webhook:parameter:xWebhookInteractionId`) e `type: header`
|
|
67
|
+
(`payments:header:X-V`). O JSON completo de
|
|
68
|
+
cada nó fica retido em `detail` até um `get_item` explícito. Os `id`s não são
|
|
69
|
+
adivinháveis: sempre vêm de um `search`. Assim o agente localiza o endpoint/schema
|
|
70
|
+
certo pagando poucos tokens e só "paga" o payload integral quando pede um item nomeado.
|
|
71
|
+
|
|
72
|
+
Os `$ref` não são expandidos em linha (medimos 3–7x mais tokens por operação):
|
|
73
|
+
em vez disso, o `get_item` de um item traz `refs` com os `id`s dos components que
|
|
74
|
+
ele referencia — todos resolvíveis por `get_item`. Resolver
|
|
75
|
+
`responses.202.$ref: '#/components/responses/202Webhook'` é uma chamada a mais,
|
|
76
|
+
não uma ida ao YAML da fonte.
|
|
69
77
|
|
|
70
78
|
Dados: extraídos das fontes públicas na primeira consulta (lazy), cache em
|
|
71
79
|
`~/.cache/opf-br-mcp/` com TTL de 72h. Sem rede, serve cache expirado com aviso.
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ function isFresh(entry, ttlHours, now = /* @__PURE__ */ new Date()) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// src/core/version.ts
|
|
49
|
-
var PACKAGE_VERSION = "0.
|
|
49
|
+
var PACKAGE_VERSION = "0.7.0";
|
|
50
50
|
|
|
51
51
|
// src/core/data.ts
|
|
52
52
|
async function getDomainData(domain, force = false, ctx) {
|
|
@@ -352,6 +352,33 @@ var pcmDomain = {
|
|
|
352
352
|
// src/domains/_openapi/parser.ts
|
|
353
353
|
import { parse } from "yaml";
|
|
354
354
|
var HTTP_METHODS = ["get", "post", "put", "patch", "delete"];
|
|
355
|
+
var COMPONENT_KINDS = {
|
|
356
|
+
schemas: "schema",
|
|
357
|
+
responses: "response",
|
|
358
|
+
parameters: "parameter",
|
|
359
|
+
headers: "header"
|
|
360
|
+
};
|
|
361
|
+
var REF_PATTERN = /^#\/components\/(schemas|responses|parameters|headers)\/(.+)$/;
|
|
362
|
+
function collectRefs(node, specName, out) {
|
|
363
|
+
if (Array.isArray(node)) {
|
|
364
|
+
for (const child of node) collectRefs(child, specName, out);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (node === null || typeof node !== "object") return;
|
|
368
|
+
for (const [key, value] of Object.entries(node)) {
|
|
369
|
+
if (key === "$ref" && typeof value === "string") {
|
|
370
|
+
const match = REF_PATTERN.exec(value);
|
|
371
|
+
if (match) out.add(`${specName}:${COMPONENT_KINDS[match[1]]}:${match[2]}`);
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
collectRefs(value, specName, out);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function refsOf(node, specName) {
|
|
378
|
+
const out = /* @__PURE__ */ new Set();
|
|
379
|
+
collectRefs(node, specName, out);
|
|
380
|
+
return [...out];
|
|
381
|
+
}
|
|
355
382
|
function parseOpenApiSpec(yamlText, specName) {
|
|
356
383
|
const spec = parse(yamlText);
|
|
357
384
|
const items = [];
|
|
@@ -367,26 +394,38 @@ function parseOpenApiSpec(yamlText, specName) {
|
|
|
367
394
|
summary: op.summary ?? null,
|
|
368
395
|
description: op.description ?? null,
|
|
369
396
|
tags: op.tags ?? [],
|
|
397
|
+
refs: refsOf(op, specName),
|
|
370
398
|
detail: op
|
|
371
399
|
});
|
|
372
400
|
}
|
|
373
401
|
}
|
|
374
|
-
for (const [
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
402
|
+
for (const [section, kind] of Object.entries(COMPONENT_KINDS)) {
|
|
403
|
+
for (const [name, node] of Object.entries(spec.components?.[section] ?? {})) {
|
|
404
|
+
items.push({
|
|
405
|
+
id: `${specName}:${kind}:${name}`,
|
|
406
|
+
type: kind,
|
|
407
|
+
name,
|
|
408
|
+
description: node.description ?? null,
|
|
409
|
+
...kind === "schema" ? { required: node.required ?? [] } : {},
|
|
410
|
+
...kind === "header" ? { required: node.required ?? null } : {},
|
|
411
|
+
// Em parameters a chave do componente (usada no $ref) difere do nome real
|
|
412
|
+
// do header/query; `paramName` e `in` preservam o nome usado na requisição.
|
|
413
|
+
...kind === "parameter" ? { paramName: node.name ?? null, in: node.in ?? null, required: node.required ?? null } : {},
|
|
414
|
+
refs: refsOf(node, specName),
|
|
415
|
+
detail: node
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
const ids = new Set(items.map((i) => i.id));
|
|
420
|
+
for (const item of items) {
|
|
421
|
+
item.refs = item.refs.filter((ref) => ref !== item.id && ids.has(ref));
|
|
383
422
|
}
|
|
384
423
|
return items;
|
|
385
424
|
}
|
|
386
425
|
|
|
387
426
|
// src/domains/_openapi/domain.ts
|
|
388
427
|
function summarize(item) {
|
|
389
|
-
const { detail: _detail, ...rest } = item;
|
|
428
|
+
const { detail: _detail, refs: _refs, ...rest } = item;
|
|
390
429
|
return rest;
|
|
391
430
|
}
|
|
392
431
|
function createOpenApiDomain(config) {
|
|
@@ -398,7 +437,19 @@ function createOpenApiDomain(config) {
|
|
|
398
437
|
filters: [
|
|
399
438
|
{ name: "path", description: `Substring no path do endpoint (ex.: ${config.pathExample})` },
|
|
400
439
|
{ name: "method", description: "Verbo HTTP exato (ex.: POST)" },
|
|
401
|
-
{ name: "schema", description: "Substring no nome do schema (case-insensitive)" }
|
|
440
|
+
{ name: "schema", description: "Substring no nome do schema (case-insensitive)" },
|
|
441
|
+
{
|
|
442
|
+
name: "response",
|
|
443
|
+
description: "Substring no nome do components.responses, a chave usada no $ref (ex.: 202Webhook)"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
name: "parameter",
|
|
447
|
+
description: "Substring no nome do components.parameters, a chave usada no $ref (ex.: xFapiInteractionId)"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
name: "header",
|
|
451
|
+
description: "Substring no nome do components.headers, a chave usada no $ref (ex.: X-V)"
|
|
452
|
+
}
|
|
402
453
|
],
|
|
403
454
|
async extract(ctx) {
|
|
404
455
|
if (ctx?.signal?.aborted) throw new Error("Extra\xE7\xE3o cancelada pelo cliente");
|
|
@@ -414,13 +465,17 @@ function createOpenApiDomain(config) {
|
|
|
414
465
|
search(data, query, filters = {}) {
|
|
415
466
|
const path = filters.path ? normalize(filters.path) : void 0;
|
|
416
467
|
const method = filters.method?.toUpperCase();
|
|
417
|
-
const schema = filters.schema ? normalize(filters.schema) : void 0;
|
|
418
468
|
return data.items.filter((item) => {
|
|
419
469
|
if (path && !normalize(String(item.path ?? "")).includes(path)) return false;
|
|
420
470
|
if (method && item.method !== method) return false;
|
|
421
|
-
|
|
471
|
+
for (const type of ["schema", "response", "parameter", "header"]) {
|
|
472
|
+
const name = filters[type];
|
|
473
|
+
if (!name) continue;
|
|
474
|
+
if (item.type !== type) return false;
|
|
475
|
+
if (!normalize(String(item.name ?? "")).includes(normalize(name))) return false;
|
|
476
|
+
}
|
|
422
477
|
if (query?.trim()) {
|
|
423
|
-
const haystack = [item.path, item.summary, item.description, item.name].map((v) => String(v ?? "")).join(" ");
|
|
478
|
+
const haystack = [item.path, item.summary, item.description, item.name, item.paramName].map((v) => String(v ?? "")).join(" ");
|
|
424
479
|
if (!matchesQuery(haystack, query)) return false;
|
|
425
480
|
}
|
|
426
481
|
return true;
|
|
@@ -436,7 +491,7 @@ function createOpenApiDomain(config) {
|
|
|
436
491
|
var paymentsConfig = {
|
|
437
492
|
id: "payments-v4-openapi",
|
|
438
493
|
title: "API de Pagamentos \u2014 spec OpenAPI 4.1.0",
|
|
439
|
-
description: "Spec OpenAPI oficial da API de Inicia\xE7\xE3o de Pagamentos (Pix) do Open Finance Brasil, vers\xE3o 4. Mesma fam\xEDlia da payments-v5-openapi (major mais recente); escolha o dom\xEDnio pela vers\xE3o que seu caso usa. Itens type=operation (endpoints, um por m\xE9todo+path)
|
|
494
|
+
description: "Spec OpenAPI oficial da API de Inicia\xE7\xE3o de Pagamentos (Pix) do Open Finance Brasil, vers\xE3o 4. Mesma fam\xEDlia da payments-v5-openapi (major mais recente); escolha o dom\xEDnio pela vers\xE3o que seu caso usa. Itens type=operation (endpoints, um por m\xE9todo+path), type=schema (payloads) e os components reutiliz\xE1veis alvos dos $ref: type=response e type=parameter. search devolve resumos; use get_item para o n\xF3 completo da spec \u2014 nas opera\xE7\xF5es o campo `refs` traz os ids dos components referenciados, prontos para get_item.",
|
|
440
495
|
pathExample: "/pix/payments",
|
|
441
496
|
specName: "payments",
|
|
442
497
|
specVersion: "4.1.0",
|
|
@@ -451,7 +506,7 @@ var paymentsDomain = createOpenApiDomain(paymentsConfig);
|
|
|
451
506
|
var paymentsV5Config = {
|
|
452
507
|
id: "payments-v5-openapi",
|
|
453
508
|
title: "API de Pagamentos \u2014 spec OpenAPI 5.0.0",
|
|
454
|
-
description: "Spec OpenAPI oficial da API de Inicia\xE7\xE3o de Pagamentos (Pix) do Open Finance Brasil, vers\xE3o 5 (major mais recente). Mesma fam\xEDlia da payments-v4-openapi; escolha o dom\xEDnio pela vers\xE3o que seu caso usa. Itens type=operation (endpoints, um por m\xE9todo+path)
|
|
509
|
+
description: "Spec OpenAPI oficial da API de Inicia\xE7\xE3o de Pagamentos (Pix) do Open Finance Brasil, vers\xE3o 5 (major mais recente). Mesma fam\xEDlia da payments-v4-openapi; escolha o dom\xEDnio pela vers\xE3o que seu caso usa. Itens type=operation (endpoints, um por m\xE9todo+path), type=schema (payloads) e os components reutiliz\xE1veis alvos dos $ref: type=response, type=parameter e type=header. search devolve resumos; use get_item para o n\xF3 completo da spec \u2014 nas opera\xE7\xF5es o campo `refs` traz os ids dos components referenciados, prontos para get_item.",
|
|
455
510
|
pathExample: "/pix/payments",
|
|
456
511
|
specName: "payments",
|
|
457
512
|
specVersion: "5.0.0",
|
|
@@ -603,7 +658,7 @@ var paymentsV5BusinessRulesDomain = createConfluenceSectionsDomain(paymentsV5Bus
|
|
|
603
658
|
var enrollmentsV2Config = {
|
|
604
659
|
id: "enrollments-v2-openapi",
|
|
605
660
|
title: "API de V\xEDnculo de Dispositivo (Enrollments) \u2014 spec OpenAPI 2.3.0",
|
|
606
|
-
description: "Spec OpenAPI oficial da API de Enrollments (V\xEDnculo de Dispositivo) do Open Finance Brasil, vers\xE3o 2. Cobre o pagamento sem redirecionamento: v\xEDnculo de dispositivos (FIDO), autoriza\xE7\xE3o de consentimentos e Pix Autom\xE1tico. Endpoints /enrollments, /consents/{consentId}/authorise e /recurring-consents/{recurringConsentId}/authorise. Itens type=operation (endpoints, um por m\xE9todo+path)
|
|
661
|
+
description: "Spec OpenAPI oficial da API de Enrollments (V\xEDnculo de Dispositivo) do Open Finance Brasil, vers\xE3o 2. Cobre o pagamento sem redirecionamento: v\xEDnculo de dispositivos (FIDO), autoriza\xE7\xE3o de consentimentos e Pix Autom\xE1tico. Endpoints /enrollments, /consents/{consentId}/authorise e /recurring-consents/{recurringConsentId}/authorise. Itens type=operation (endpoints, um por m\xE9todo+path), type=schema (payloads) e os components reutiliz\xE1veis alvos dos $ref: type=response, type=parameter e type=header. search devolve resumos; use get_item para o n\xF3 completo da spec \u2014 nas opera\xE7\xF5es o campo `refs` traz os ids dos components referenciados, prontos para get_item.",
|
|
607
662
|
pathExample: "/enrollments",
|
|
608
663
|
specName: "enrollments",
|
|
609
664
|
specVersion: "2.3.0",
|
|
@@ -639,7 +694,7 @@ var enrollmentsV2BusinessRulesDomain = createConfluenceSectionsDomain(
|
|
|
639
694
|
var automaticPaymentsV2Config = {
|
|
640
695
|
id: "automatic-payments-v2-openapi",
|
|
641
696
|
title: "API de Pagamentos Autom\xE1ticos (Automatic Payments) \u2014 spec OpenAPI 2.2.0",
|
|
642
|
-
description: "Spec OpenAPI oficial da API de Automatic Payments do Open Finance Brasil, vers\xE3o 2. Cobre a inicia\xE7\xE3o de pagamentos autom\xE1ticos (Pix Autom\xE1tico e Transfer\xEAncias Inteligentes) mediante consentimento recorrente. Endpoints /recurring-consents (cria\xE7\xE3o, consulta e edi\xE7\xE3o/revoga\xE7\xE3o) e /pix/recurring-payments (cria\xE7\xE3o, retry, consulta e cancelamento); scope recurring-payments. Itens type=operation (endpoints, um por m\xE9todo+path)
|
|
697
|
+
description: "Spec OpenAPI oficial da API de Automatic Payments do Open Finance Brasil, vers\xE3o 2. Cobre a inicia\xE7\xE3o de pagamentos autom\xE1ticos (Pix Autom\xE1tico e Transfer\xEAncias Inteligentes) mediante consentimento recorrente. Endpoints /recurring-consents (cria\xE7\xE3o, consulta e edi\xE7\xE3o/revoga\xE7\xE3o) e /pix/recurring-payments (cria\xE7\xE3o, retry, consulta e cancelamento); scope recurring-payments. Itens type=operation (endpoints, um por m\xE9todo+path), type=schema (payloads) e os components reutiliz\xE1veis alvos dos $ref: type=response, type=parameter e type=header. search devolve resumos; use get_item para o n\xF3 completo da spec \u2014 nas opera\xE7\xF5es o campo `refs` traz os ids dos components referenciados, prontos para get_item.",
|
|
643
698
|
pathExample: "/pix/recurring-payments",
|
|
644
699
|
specName: "automatic-payments",
|
|
645
700
|
specVersion: "2.2.0",
|
|
@@ -718,7 +773,7 @@ var paymentsImplementationGuidesDomain = createConfluenceSectionsDomain(
|
|
|
718
773
|
var consentsV3Config = {
|
|
719
774
|
id: "consents-v3-openapi",
|
|
720
775
|
title: "API de Consentimentos \u2014 spec OpenAPI 3.3.1",
|
|
721
|
-
description: "Spec OpenAPI oficial da API de Consentimentos de compartilhamento de dados (Dados Cadastrais e Transacionais) do Open Finance Brasil, vers\xE3o 3.3.1. \xC9 o consentimento de dados \u2014 n\xE3o cobre consentimento de pagamento, que fica em payments-v4/v5-openapi (/consents) e automatic-payments-v2-openapi (/recurring-consents). Cobre cria\xE7\xE3o (POST /consents), consulta (GET /consents/{consentId}), revoga\xE7\xE3o (DELETE /consents/{consentId}), renova\xE7\xE3o (POST /consents/{consentId}/extends) e hist\xF3rico de renova\xE7\xF5es (GET /consents/{consentId}/extensions). Itens type=operation (um por m\xE9todo+path)
|
|
776
|
+
description: "Spec OpenAPI oficial da API de Consentimentos de compartilhamento de dados (Dados Cadastrais e Transacionais) do Open Finance Brasil, vers\xE3o 3.3.1. \xC9 o consentimento de dados \u2014 n\xE3o cobre consentimento de pagamento, que fica em payments-v4/v5-openapi (/consents) e automatic-payments-v2-openapi (/recurring-consents). Cobre cria\xE7\xE3o (POST /consents), consulta (GET /consents/{consentId}), revoga\xE7\xE3o (DELETE /consents/{consentId}), renova\xE7\xE3o (POST /consents/{consentId}/extends) e hist\xF3rico de renova\xE7\xF5es (GET /consents/{consentId}/extensions). Itens type=operation (um por m\xE9todo+path), type=schema (payloads, ex.: CreateConsent, ResponseConsent, LoggedUser, BusinessEntity) e os components reutiliz\xE1veis alvos dos $ref: type=response (BadRequest, UnprocessableEntity, ...) e type=parameter (Authorization, xFapiInteractionId, ...). search devolve resumos; use get_item para o n\xF3 completo da spec \u2014 nas opera\xE7\xF5es o campo `refs` traz os ids dos components referenciados, prontos para get_item.",
|
|
722
777
|
pathExample: "/consents/{consentId}",
|
|
723
778
|
specName: "consents",
|
|
724
779
|
specVersion: "3.3.1",
|
|
@@ -737,86 +792,14 @@ var pcmOpenapiConfig = {
|
|
|
737
792
|
retryDelaysMs: [2e3, 4e3, 8e3, 16e3]
|
|
738
793
|
};
|
|
739
794
|
|
|
740
|
-
// src/domains/pcm-openapi/parser.ts
|
|
741
|
-
import { parse as parse2 } from "yaml";
|
|
742
|
-
var HTTP_METHODS2 = ["get", "post", "put", "patch", "delete"];
|
|
743
|
-
function parseOpenApiSpec2(yamlText, specName) {
|
|
744
|
-
const spec = parse2(yamlText);
|
|
745
|
-
const items = [];
|
|
746
|
-
for (const [path, pathItem] of Object.entries(spec.paths ?? {})) {
|
|
747
|
-
for (const method of HTTP_METHODS2) {
|
|
748
|
-
const op = pathItem[method];
|
|
749
|
-
if (!op) continue;
|
|
750
|
-
items.push({
|
|
751
|
-
id: `${specName}:${method.toUpperCase()} ${path}`,
|
|
752
|
-
type: "operation",
|
|
753
|
-
path,
|
|
754
|
-
method: method.toUpperCase(),
|
|
755
|
-
summary: op.summary ?? null,
|
|
756
|
-
description: op.description ?? null,
|
|
757
|
-
tags: op.tags ?? [],
|
|
758
|
-
detail: op
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
for (const [name, schema] of Object.entries(spec.components?.schemas ?? {})) {
|
|
763
|
-
items.push({
|
|
764
|
-
id: `${specName}:schema:${name}`,
|
|
765
|
-
type: "schema",
|
|
766
|
-
name,
|
|
767
|
-
description: schema.description ?? null,
|
|
768
|
-
required: schema.required ?? [],
|
|
769
|
-
detail: schema
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
return items;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
795
|
// src/domains/pcm-openapi/index.ts
|
|
776
|
-
|
|
777
|
-
const { detail: _detail, ...rest } = item;
|
|
778
|
-
return rest;
|
|
779
|
-
}
|
|
780
|
-
var pcmOpenapiDomain = {
|
|
796
|
+
var pcmOpenapiDomain = createOpenApiDomain({
|
|
781
797
|
id: "pcm-openapi",
|
|
782
798
|
title: `PCM \u2014 spec OpenAPI ${pcmOpenapiConfig.specVersion}`,
|
|
783
|
-
description: "Spec OpenAPI oficial da PCM (Plataforma de Coleta de M\xE9tricas) do Open Finance Brasil \u2014 a faceta swagger. Cobre os endpoints de reporte (report-api v1/v2), hybrid-flow, opendata, consents/stock, credit-portabilities, payments/status e token. Itens type=operation (um por m\xE9todo+path)
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
{ name: "method", description: "Verbo HTTP exato (ex.: POST)" },
|
|
788
|
-
{ name: "schema", description: "Substring no nome do schema (case-insensitive)" }
|
|
789
|
-
],
|
|
790
|
-
async extract(ctx) {
|
|
791
|
-
if (ctx?.signal?.aborted) throw new Error("Extra\xE7\xE3o cancelada pelo cliente");
|
|
792
|
-
ctx?.onProgress?.(0, 1, `Baixando spec ${pcmOpenapiConfig.specName} ${pcmOpenapiConfig.specVersion}`);
|
|
793
|
-
const response = await fetchWithRetry(pcmOpenapiConfig.url, {
|
|
794
|
-
retryDelaysMs: pcmOpenapiConfig.retryDelaysMs,
|
|
795
|
-
signal: ctx?.signal
|
|
796
|
-
});
|
|
797
|
-
const yamlText = await response.text();
|
|
798
|
-
ctx?.onProgress?.(1, 1);
|
|
799
|
-
return { items: parseOpenApiSpec2(yamlText, pcmOpenapiConfig.specName) };
|
|
800
|
-
},
|
|
801
|
-
search(data, query, filters = {}) {
|
|
802
|
-
const path = filters.path ? normalize(filters.path) : void 0;
|
|
803
|
-
const method = filters.method?.toUpperCase();
|
|
804
|
-
const schema = filters.schema ? normalize(filters.schema) : void 0;
|
|
805
|
-
return data.items.filter((item) => {
|
|
806
|
-
if (path && !normalize(String(item.path ?? "")).includes(path)) return false;
|
|
807
|
-
if (method && item.method !== method) return false;
|
|
808
|
-
if (schema && !normalize(String(item.name ?? "")).includes(schema)) return false;
|
|
809
|
-
if (query?.trim()) {
|
|
810
|
-
const haystack = [item.path, item.summary, item.description, item.name].map((v) => String(v ?? "")).join(" ");
|
|
811
|
-
if (!matchesQuery(haystack, query)) return false;
|
|
812
|
-
}
|
|
813
|
-
return true;
|
|
814
|
-
}).map(summarize3);
|
|
815
|
-
},
|
|
816
|
-
getItem(data, id) {
|
|
817
|
-
return data.items.find((i) => i.id === id) ?? null;
|
|
818
|
-
}
|
|
819
|
-
};
|
|
799
|
+
description: "Spec OpenAPI oficial da PCM (Plataforma de Coleta de M\xE9tricas) do Open Finance Brasil \u2014 a faceta swagger. Cobre os endpoints de reporte (report-api v1/v2), hybrid-flow, opendata, consents/stock, credit-portabilities, payments/status e token. Itens type=operation (um por m\xE9todo+path), type=schema (payloads) e type=response (components reutiliz\xE1veis, alvos dos $ref). Outras facetas da PCM: tabelas de obrigatoriedade do campo additionalInfo em pcm-additional-info; regras de neg\xF3cio (reporte, processamento, diverg\xEAncias) em pcm-business-rules. search devolve resumos; use get_item para o n\xF3 completo da spec (opera\xE7\xF5es trazem `refs` com os ids dos components que referenciam).",
|
|
800
|
+
pathExample: "/report-api/v1/private/report",
|
|
801
|
+
...pcmOpenapiConfig
|
|
802
|
+
});
|
|
820
803
|
|
|
821
804
|
// src/domains/pcm-business-rules/config.ts
|
|
822
805
|
var pcmBusinessRulesConfig = {
|
|
@@ -883,7 +866,7 @@ var mqdDomain = createConfluenceSectionsDomain(mqdConfig);
|
|
|
883
866
|
var webhookConfig = {
|
|
884
867
|
id: "webhook-v1-openapi",
|
|
885
868
|
title: "API de Webhook \u2014 spec OpenAPI 1.3.0",
|
|
886
|
-
description: "Spec OpenAPI oficial da API de Webhook do Open Finance Brasil, que notifica mudan\xE7as de estado das demais APIs. 5 opera\xE7\xF5es POST (type=operation): consentNotification e pixPaymentNotification (Pagamentos), enrollmentIdNotification (Enrollments), recurringConsentIdNotification e recurringPaymentIdNotification (Pagamentos Autom\xE1ticos);
|
|
869
|
+
description: "Spec OpenAPI oficial da API de Webhook do Open Finance Brasil, que notifica mudan\xE7as de estado das demais APIs. 5 opera\xE7\xF5es POST (type=operation): consentNotification e pixPaymentNotification (Pagamentos), enrollmentIdNotification (Enrollments), recurringConsentIdNotification e recurringPaymentIdNotification (Pagamentos Autom\xE1ticos); schemas type=schema (RequestBodyWebhook, RequestBodyWebhookEvents, EventType, Timestamp, xWebhookInteractionId); e os components reutiliz\xE1veis alvos dos $ref: type=response (202Webhook, 202WebhookPayments) e type=parameter (consentId, versionApi, xWebhookInteractionId, ...). search devolve resumos; use get_item para o n\xF3 completo da spec \u2014 nas opera\xE7\xF5es o campo `refs` traz os ids dos components referenciados, prontos para get_item.",
|
|
887
870
|
pathExample: "/payments/{versionApi}/consents/{consentId}",
|
|
888
871
|
specName: "webhook",
|
|
889
872
|
specVersion: "1.3.0",
|
|
@@ -964,7 +947,7 @@ function parseParticipants(jsonText) {
|
|
|
964
947
|
}
|
|
965
948
|
|
|
966
949
|
// src/domains/participantes/index.ts
|
|
967
|
-
function
|
|
950
|
+
function summarize3(item) {
|
|
968
951
|
const { detail: _detail, ...rest } = item;
|
|
969
952
|
return rest;
|
|
970
953
|
}
|
|
@@ -1005,7 +988,7 @@ var participantesDomain = {
|
|
|
1005
988
|
if (!matchesQuery(haystack, query)) return false;
|
|
1006
989
|
}
|
|
1007
990
|
return true;
|
|
1008
|
-
}).map(
|
|
991
|
+
}).map(summarize3);
|
|
1009
992
|
},
|
|
1010
993
|
getItem(data, id) {
|
|
1011
994
|
return data.items.find((i) => i.id === id) ?? null;
|
|
@@ -1238,7 +1221,7 @@ function createServer() {
|
|
|
1238
1221
|
"get_item",
|
|
1239
1222
|
{
|
|
1240
1223
|
title: "Detalhar um item",
|
|
1241
|
-
description: "Devolve o registro completo de um item pelo `id` retornado por search (nos dom\xEDnios *-openapi e participantes inclui o n\xF3 integral da spec em `detail`; em pcm-additional-info devolve o registro completo, enquanto search devolve apenas um resumo).",
|
|
1224
|
+
description: "Devolve o registro completo de um item pelo `id` retornado por search (nos dom\xEDnios *-openapi e participantes inclui o n\xF3 integral da spec em `detail`; em pcm-additional-info devolve o registro completo, enquanto search devolve apenas um resumo). Nos dom\xEDnios *-openapi os `$ref` n\xE3o v\xEAm expandidos: o campo `refs` lista os ids dos components referenciados (responses, parameters, schemas) \u2014 chame get_item neles para resolver.",
|
|
1242
1225
|
inputSchema: {
|
|
1243
1226
|
domain: domainIdSchema,
|
|
1244
1227
|
id: z.string().describe("Id do item (vindo de search)")
|