nexusflex-mcp 3.69.1 → 3.71.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/api.mjs +13 -2
- package/docs.mjs +508 -510
- package/package.json +1 -1
- package/server.mjs +49 -48
package/api.mjs
CHANGED
|
@@ -47,8 +47,19 @@ if (EMAIL && PASSWORD && !/^https:\/\//i.test(API_URL)) {
|
|
|
47
47
|
log("ADVERTENCIA: NEXUSFLEX_API_URL no es HTTPS y hay email/contraseña — viajarían sin cifrar.");
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
// Operaciones habilitadas dentro de rutas financieras (decisión del dueño, 29/09), con su
|
|
51
|
+
// MÉTODO exacto — mismas que RUTAS_MCP_OPERACION_OK en backend/src/middleware/auth.ts.
|
|
52
|
+
// Ninguna paga, cobra ni transfiere: excluir/reincluir un envío de una liquidación (con
|
|
53
|
+
// motivo) y ver/preparar los datos de facturación de un cliente (no emite comprobantes).
|
|
54
|
+
const OPERACIONES_OK = [
|
|
55
|
+
{ metodo: "POST", ruta: /^\/liquidaciones\/anteriores\/\d+\/(excluir|reincluir)\/?$/i },
|
|
56
|
+
{ metodo: "GET", ruta: /^\/afip\/estado\/?$/i },
|
|
57
|
+
{ metodo: "POST", ruta: /^\/afip\/preparar-cliente\/?$/i },
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
function guard(method, path) {
|
|
51
61
|
const clean = path.split("?")[0];
|
|
62
|
+
if (OPERACIONES_OK.some((o) => o.metodo === String(method).toUpperCase() && o.ruta.test(clean))) return;
|
|
52
63
|
if (RUTAS_PROHIBIDAS.some((re) => re.test(clean))) {
|
|
53
64
|
throw new Error(`Ruta bloqueada por política del MCP (endpoints de dinero deshabilitados): ${clean}`);
|
|
54
65
|
}
|
|
@@ -96,7 +107,7 @@ async function ensureToken() {
|
|
|
96
107
|
|
|
97
108
|
/** Llamada autenticada a la API. Reintenta UNA vez si el token venció/se revocó. */
|
|
98
109
|
export async function api(method, path, body) {
|
|
99
|
-
guard(path);
|
|
110
|
+
guard(method, path);
|
|
100
111
|
let token = await ensureToken();
|
|
101
112
|
const doFetch = (t) =>
|
|
102
113
|
fetch(`${API_URL}${path}`, {
|