@frihet/mcp-server 1.14.1 → 1.14.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/README.md +1 -1
- package/dist/__tests__/contract.test.d.ts +33 -0
- package/dist/__tests__/contract.test.d.ts.map +1 -0
- package/dist/__tests__/contract.test.js +208 -0
- package/dist/__tests__/contract.test.js.map +1 -0
- package/dist/__tests__/einvoice-day4-tools.test.js +33 -73
- package/dist/__tests__/einvoice-day4-tools.test.js.map +1 -1
- package/dist/__tests__/einvoice-tools.test.js +70 -107
- package/dist/__tests__/einvoice-tools.test.js.map +1 -1
- package/dist/__tests__/tool-exposure.test.js +4 -1
- package/dist/__tests__/tool-exposure.test.js.map +1 -1
- package/dist/client.d.ts +18 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +42 -2
- package/dist/client.js.map +1 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/observability.d.ts +21 -0
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +79 -4
- package/dist/observability.js.map +1 -1
- package/dist/tools/accountingClose.d.ts.map +1 -1
- package/dist/tools/accountingClose.js +17 -12
- package/dist/tools/accountingClose.js.map +1 -1
- package/dist/tools/audit_gl.d.ts.map +1 -1
- package/dist/tools/audit_gl.js +7 -6
- package/dist/tools/audit_gl.js.map +1 -1
- package/dist/tools/backend-availability.d.ts +73 -0
- package/dist/tools/backend-availability.d.ts.map +1 -0
- package/dist/tools/backend-availability.js +94 -0
- package/dist/tools/backend-availability.js.map +1 -0
- package/dist/tools/bank_rules.d.ts.map +1 -1
- package/dist/tools/bank_rules.js +5 -4
- package/dist/tools/bank_rules.js.map +1 -1
- package/dist/tools/einvoice.d.ts +25 -41
- package/dist/tools/einvoice.d.ts.map +1 -1
- package/dist/tools/einvoice.js +160 -259
- package/dist/tools/einvoice.js.map +1 -1
- package/dist/tools/fiscal.d.ts.map +1 -1
- package/dist/tools/fiscal.js +20 -17
- package/dist/tools/fiscal.js.map +1 -1
- package/dist/tools/gestoria.d.ts.map +1 -1
- package/dist/tools/gestoria.js +11 -10
- package/dist/tools/gestoria.js.map +1 -1
- package/dist/tools/hr.d.ts.map +1 -1
- package/dist/tools/hr.js +19 -18
- package/dist/tools/hr.js.map +1 -1
- package/dist/tools/igic.d.ts.map +1 -1
- package/dist/tools/igic.js +9 -8
- package/dist/tools/igic.js.map +1 -1
- package/dist/tools/impuesto_sociedades.d.ts.map +1 -1
- package/dist/tools/impuesto_sociedades.js +5 -4
- package/dist/tools/impuesto_sociedades.js.map +1 -1
- package/dist/tools/onboard_vies.d.ts.map +1 -1
- package/dist/tools/onboard_vies.js +5 -4
- package/dist/tools/onboard_vies.js.map +1 -1
- package/dist/tools/onboarding.d.ts.map +1 -1
- package/dist/tools/onboarding.js +5 -4
- package/dist/tools/onboarding.js.map +1 -1
- package/dist/tools/payroll.d.ts.map +1 -1
- package/dist/tools/payroll.js +5 -4
- package/dist/tools/payroll.js.map +1 -1
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/permissions.js +5 -4
- package/dist/tools/permissions.js.map +1 -1
- package/dist/tools/portal_domain.d.ts.map +1 -1
- package/dist/tools/portal_domain.js +7 -6
- package/dist/tools/portal_domain.js.map +1 -1
- package/dist/tools/shared.d.ts +53 -1
- package/dist/tools/shared.d.ts.map +1 -1
- package/dist/tools/shared.js +68 -2
- package/dist/tools/shared.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_gl.js","sourceRoot":"","sources":["../../src/tools/audit_gl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"audit_gl.js","sour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BAA0B,EAAE,KAAK,IAAI,EAAE;QACnF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACxD,OAAO;YACL,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,0BAA0B,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;YAChF,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-availability guard for MCP tool handlers.
|
|
3
|
+
*
|
|
4
|
+
* PROBLEM (the bug this prevents): several tool families are wired here AHEAD of
|
|
5
|
+
* their Frihet-ERP backend Cloud Functions shipping (fiscal `/v1/fiscal/*`, bank
|
|
6
|
+
* rules `/v1/banking/rules`, gestoria `/v1/gestoria/*`, GL audit `/v1/gl/*`,
|
|
7
|
+
* portal domain/onboard, IGIC, IS, VIES onboarding, payroll prep, permissions,
|
|
8
|
+
* HR leaves/anomalies, accounting periods, webhook test). Until the CF deploys,
|
|
9
|
+
* the API returns a genuine HTTP 404.
|
|
10
|
+
*
|
|
11
|
+
* If that raw 404 reaches `handleToolError` it is mapped to the generic message
|
|
12
|
+
* "Resource not found. / Recurso no encontrado." — which an LLM reads as "the
|
|
13
|
+
* thing you asked about does not exist" and then HALLUCINATES a confident answer
|
|
14
|
+
* ("you have no Modelo 303 to file", "this workspace has no permissions matrix").
|
|
15
|
+
* That is a Trust-Area failure: the model invents fiscal/compliance facts.
|
|
16
|
+
*
|
|
17
|
+
* FIX: wrap the client call in `withBackendGuard`. A genuine 404 is converted into
|
|
18
|
+
* an explicit STRUCTURED tool error that names the tool and states the backend is
|
|
19
|
+
* not available yet — never a value the LLM can mistake for real business data.
|
|
20
|
+
* Any other error (401/403/429/5xx/network) is RE-THROWN unchanged so the normal
|
|
21
|
+
* `withToolLogging` → `handleToolError` path still surfaces it.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: this is intentionally a SEPARATE module from `shared.ts` (owned elsewhere)
|
|
24
|
+
* and `client.ts`. It only depends on the public content-block shape.
|
|
25
|
+
*/
|
|
26
|
+
import { type AnnotatedTextContent } from "./shared.js";
|
|
27
|
+
/** Structured-content payload returned alongside a backend-unavailable error. */
|
|
28
|
+
export interface BackendUnavailableStructured {
|
|
29
|
+
error: "backend_unavailable";
|
|
30
|
+
tool: string;
|
|
31
|
+
message: string;
|
|
32
|
+
/** The planned REST endpoint, if known — aids ops/debugging, not the LLM. */
|
|
33
|
+
endpoint?: string;
|
|
34
|
+
/** Machine flag so downstream agents can branch without parsing prose. */
|
|
35
|
+
_backendUnavailable: true;
|
|
36
|
+
}
|
|
37
|
+
export interface BackendGuardErrorResult {
|
|
38
|
+
/** Index signature mirrors the MCP `ToolResult` shape so this is assignable to it. */
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
content: AnnotatedTextContent[];
|
|
41
|
+
structuredContent: Record<string, unknown>;
|
|
42
|
+
isError: true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* True when an error is a genuine HTTP 404 (FrihetApiError-like or fetch-shaped).
|
|
46
|
+
* Duck-typed so it works regardless of which client implementation threw.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isBackendNotFound(error: unknown): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Builds the explicit, LLM-safe "backend not available" tool error.
|
|
51
|
+
*/
|
|
52
|
+
export declare function backendUnavailableError(toolName: string, endpoint?: string): BackendGuardErrorResult;
|
|
53
|
+
/**
|
|
54
|
+
* Wraps a tool's client call. On a genuine 404 (backend not deployed) returns a
|
|
55
|
+
* structured backend-unavailable error instead of letting the raw 404 surface as
|
|
56
|
+
* a generic "resource not found" that the LLM would treat as real data. Any other
|
|
57
|
+
* error is re-thrown so `withToolLogging`/`handleToolError` handle it normally.
|
|
58
|
+
*
|
|
59
|
+
* Usage:
|
|
60
|
+
* ```ts
|
|
61
|
+
* async ({ period }) => withToolLogging("get_modelo_303_summary", () =>
|
|
62
|
+
* withBackendGuard("get_modelo_303_summary", "/v1/fiscal/303", async () => {
|
|
63
|
+
* const result = await client.getFiscalModeloSummary("303", period);
|
|
64
|
+
* return { content: [getContent(formatRecord("Modelo 303 Summary", result))],
|
|
65
|
+
* structuredContent: result as unknown as Record<string, unknown> };
|
|
66
|
+
* }),
|
|
67
|
+
* )
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function withBackendGuard<T extends {
|
|
71
|
+
content: unknown[];
|
|
72
|
+
}>(toolName: string, endpoint: string | undefined, fn: () => Promise<T>): Promise<T | BackendGuardErrorResult>;
|
|
73
|
+
//# sourceMappingURL=backend-availability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-availability.d.ts","sourceRoot":"","sources":["../../src/tools/backend-availability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAA6B,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnF,iFAAiF;AACjF,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,qBAAqB,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,mBAAmB,EAAE,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,sFAAsF;IACtF,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrB,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,OAAO,EAAE,IAAI,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOzD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,uBAAuB,CAwBzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,OAAO,EAAE,CAAA;CAAE,EACrE,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAStC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-availability guard for MCP tool handlers.
|
|
3
|
+
*
|
|
4
|
+
* PROBLEM (the bug this prevents): several tool families are wired here AHEAD of
|
|
5
|
+
* their Frihet-ERP backend Cloud Functions shipping (fiscal `/v1/fiscal/*`, bank
|
|
6
|
+
* rules `/v1/banking/rules`, gestoria `/v1/gestoria/*`, GL audit `/v1/gl/*`,
|
|
7
|
+
* portal domain/onboard, IGIC, IS, VIES onboarding, payroll prep, permissions,
|
|
8
|
+
* HR leaves/anomalies, accounting periods, webhook test). Until the CF deploys,
|
|
9
|
+
* the API returns a genuine HTTP 404.
|
|
10
|
+
*
|
|
11
|
+
* If that raw 404 reaches `handleToolError` it is mapped to the generic message
|
|
12
|
+
* "Resource not found. / Recurso no encontrado." — which an LLM reads as "the
|
|
13
|
+
* thing you asked about does not exist" and then HALLUCINATES a confident answer
|
|
14
|
+
* ("you have no Modelo 303 to file", "this workspace has no permissions matrix").
|
|
15
|
+
* That is a Trust-Area failure: the model invents fiscal/compliance facts.
|
|
16
|
+
*
|
|
17
|
+
* FIX: wrap the client call in `withBackendGuard`. A genuine 404 is converted into
|
|
18
|
+
* an explicit STRUCTURED tool error that names the tool and states the backend is
|
|
19
|
+
* not available yet — never a value the LLM can mistake for real business data.
|
|
20
|
+
* Any other error (401/403/429/5xx/network) is RE-THROWN unchanged so the normal
|
|
21
|
+
* `withToolLogging` → `handleToolError` path still surfaces it.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: this is intentionally a SEPARATE module from `shared.ts` (owned elsewhere)
|
|
24
|
+
* and `client.ts`. It only depends on the public content-block shape.
|
|
25
|
+
*/
|
|
26
|
+
import { ERROR_CONTENT_ANNOTATIONS } from "./shared.js";
|
|
27
|
+
/**
|
|
28
|
+
* True when an error is a genuine HTTP 404 (FrihetApiError-like or fetch-shaped).
|
|
29
|
+
* Duck-typed so it works regardless of which client implementation threw.
|
|
30
|
+
*/
|
|
31
|
+
export function isBackendNotFound(error) {
|
|
32
|
+
if (error && typeof error === "object") {
|
|
33
|
+
const e = error;
|
|
34
|
+
if (e["statusCode"] === 404)
|
|
35
|
+
return true;
|
|
36
|
+
if (e["status"] === 404)
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Builds the explicit, LLM-safe "backend not available" tool error.
|
|
43
|
+
*/
|
|
44
|
+
export function backendUnavailableError(toolName, endpoint) {
|
|
45
|
+
const message = `The backend for "${toolName}" is not available yet, so no data could be retrieved. ` +
|
|
46
|
+
`This is NOT an empty or zero result — the underlying Frihet ERP endpoint ` +
|
|
47
|
+
(endpoint ? `(${endpoint}) ` : "") +
|
|
48
|
+
`is not deployed in your workspace. ` +
|
|
49
|
+
`Do NOT infer or invent a value (e.g. "no records", "0 due", "no permissions"). ` +
|
|
50
|
+
`Tell the user this feature is not enabled yet and to contact Frihet support / check feature availability. ` +
|
|
51
|
+
`/ El backend de "${toolName}" aun no esta disponible: el endpoint de Frihet ERP no esta desplegado en este workspace. ` +
|
|
52
|
+
`NO es un resultado vacio ni cero — no inventes un valor. Indica al usuario que la funcion aun no esta activa.`;
|
|
53
|
+
const structured = {
|
|
54
|
+
error: "backend_unavailable",
|
|
55
|
+
tool: toolName,
|
|
56
|
+
message,
|
|
57
|
+
...(endpoint ? { endpoint } : {}),
|
|
58
|
+
_backendUnavailable: true,
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
content: [{ type: "text", text: `Error: ${message}`, annotations: ERROR_CONTENT_ANNOTATIONS }],
|
|
62
|
+
structuredContent: structured,
|
|
63
|
+
isError: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Wraps a tool's client call. On a genuine 404 (backend not deployed) returns a
|
|
68
|
+
* structured backend-unavailable error instead of letting the raw 404 surface as
|
|
69
|
+
* a generic "resource not found" that the LLM would treat as real data. Any other
|
|
70
|
+
* error is re-thrown so `withToolLogging`/`handleToolError` handle it normally.
|
|
71
|
+
*
|
|
72
|
+
* Usage:
|
|
73
|
+
* ```ts
|
|
74
|
+
* async ({ period }) => withToolLogging("get_modelo_303_summary", () =>
|
|
75
|
+
* withBackendGuard("get_modelo_303_summary", "/v1/fiscal/303", async () => {
|
|
76
|
+
* const result = await client.getFiscalModeloSummary("303", period);
|
|
77
|
+
* return { content: [getContent(formatRecord("Modelo 303 Summary", result))],
|
|
78
|
+
* structuredContent: result as unknown as Record<string, unknown> };
|
|
79
|
+
* }),
|
|
80
|
+
* )
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export async function withBackendGuard(toolName, endpoint, fn) {
|
|
84
|
+
try {
|
|
85
|
+
return await fn();
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
if (isBackendNotFound(err)) {
|
|
89
|
+
return backendUnavailableError(toolName, endpoint);
|
|
90
|
+
}
|
|
91
|
+
throw err;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=backend-availability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-availability.js","sourceRoot":"","sources":["../../src/tools/backend-availability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,yBAAyB,EAA6B,MAAM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OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank_rules.d.ts","sourceRoot":"","sources":["../../src/tools/bank_rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"bank_rules.d.ts","sourceRoot":"","sources":["../../src/tools/bank_rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAgC5D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CA+ErF"}
|
package/dist/tools/bank_rules.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { z } from "zod/v4";
|
|
21
21
|
import { withToolLogging, formatPaginatedResponse, formatRecord, listContent, mutateContent, READ_ONLY_ANNOTATIONS, CREATE_ANNOTATIONS, paginatedOutput, } from "./shared.js";
|
|
22
|
+
import { withBackendGuard } from "./backend-availability.js";
|
|
22
23
|
const bankRuleItemOutput = z.object({
|
|
23
24
|
id: z.string(),
|
|
24
25
|
name: z.string(),
|
|
@@ -52,13 +53,13 @@ export function registerBankRulesTools(server, client) {
|
|
|
52
53
|
offset: z.number().int().min(0).optional().describe("Offset / Desplazamiento"),
|
|
53
54
|
},
|
|
54
55
|
outputSchema: paginatedOutput(bankRuleItemOutput),
|
|
55
|
-
}, async ({ isActive, limit, offset }) => withToolLogging("frihet_bank_rules_list", async () => {
|
|
56
|
+
}, async ({ isActive, limit, offset }) => withToolLogging("frihet_bank_rules_list", () => withBackendGuard("frihet_bank_rules_list", "/v1/banking/rules", async () => {
|
|
56
57
|
const result = await client.listBankRules({ isActive, limit, offset });
|
|
57
58
|
return {
|
|
58
59
|
content: [listContent(formatPaginatedResponse("bank_rules", result))],
|
|
59
60
|
structuredContent: result,
|
|
60
61
|
};
|
|
61
|
-
}));
|
|
62
|
+
})));
|
|
62
63
|
// -- frihet_bank_rule_create ----------------------------------------------
|
|
63
64
|
server.registerTool("frihet_bank_rule_create", {
|
|
64
65
|
title: "Create Bank Categorization Rule",
|
|
@@ -83,7 +84,7 @@ export function registerBankRulesTools(server, client) {
|
|
|
83
84
|
})).min(1).describe("Actions to apply when rule matches / Acciones a aplicar cuando la regla se cumple"),
|
|
84
85
|
isActive: z.boolean().optional().describe("Whether the rule is active (default true) / Si la regla esta activa (por defecto true)"),
|
|
85
86
|
},
|
|
86
|
-
}, async ({ name, conditions, actions, isActive }) => withToolLogging("frihet_bank_rule_create", async () => {
|
|
87
|
+
}, async ({ name, conditions, actions, isActive }) => withToolLogging("frihet_bank_rule_create", () => withBackendGuard("frihet_bank_rule_create", "/v1/banking/rules", async () => {
|
|
87
88
|
const result = await client.createBankRule({ name, conditions, actions, isActive });
|
|
88
89
|
return {
|
|
89
90
|
content: [
|
|
@@ -91,6 +92,6 @@ export function registerBankRulesTools(server, client) {
|
|
|
91
92
|
],
|
|
92
93
|
structuredContent: result,
|
|
93
94
|
};
|
|
94
|
-
}));
|
|
95
|
+
})));
|
|
95
96
|
}
|
|
96
97
|
//# sourceMappingURL=bank_rules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank_rules.js","sourceRoot":"","sources":["../../src/tools/bank_rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"bank_rules.js","sourceRoot":"","sources":["../../src/tools/bank_rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KAClB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACd,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KAClB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACd,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,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,CAAC,QAAQ,CAAC,2EAA2E,CAAC;aACxG,CAAC,CACH,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mFAAmF,CAAC;YACtG,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wFAAwF,CAAC;SACpI;KACF,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,yBAAyB,EAAE,GAAG,EAAE,CACjG,gBAAgB,CAAC,yBAAyB,EAAE,mBAAmB,EAAE,KAAK,IAAI,EAAE;QAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpF,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,CACX,YAAY,CAAC,sBAAsB,IAAI,EAAE,EAAE,MAAM,CAAC,CACnD;aACF;YACD,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/einvoice.d.ts
CHANGED
|
@@ -104,57 +104,41 @@ export declare const exportDatevOutput: z.ZodObject<{
|
|
|
104
104
|
encoding: z.ZodLiteral<"cp1252">;
|
|
105
105
|
}, z.core.$loose>;
|
|
106
106
|
export declare const einvoiceExportOutput: z.ZodObject<{
|
|
107
|
-
|
|
107
|
+
xml: z.ZodString;
|
|
108
|
+
contentType: z.ZodString;
|
|
108
109
|
filename: z.ZodString;
|
|
109
|
-
format: z.ZodString;
|
|
110
110
|
signed: z.ZodBoolean;
|
|
111
|
+
format: z.ZodString;
|
|
111
112
|
}, z.core.$loose>;
|
|
112
113
|
export declare const faceSubmitOutput: z.ZodObject<{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
submittedAt: z.ZodString;
|
|
119
|
-
mode: z.ZodString;
|
|
114
|
+
status: z.ZodLiteral<"submitted">;
|
|
115
|
+
numeroRegistro: z.ZodString;
|
|
116
|
+
codigo: z.ZodString;
|
|
117
|
+
descripcion: z.ZodString;
|
|
118
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
120
119
|
}, z.core.$loose>;
|
|
121
120
|
export declare const faceStatusOutput: z.ZodObject<{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
numeroRegistro: z.ZodString;
|
|
122
|
+
estadoTramitacion: z.ZodNullable<z.ZodString>;
|
|
123
|
+
codigo: z.ZodNullable<z.ZodString>;
|
|
124
|
+
descripcion: z.ZodNullable<z.ZodString>;
|
|
125
|
+
motivo: z.ZodNullable<z.ZodString>;
|
|
126
126
|
}, z.core.$loose>;
|
|
127
127
|
export declare const ticketbaiSubmitOutput: z.ZodObject<{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}>;
|
|
134
|
-
status: z.ZodEnum<{
|
|
135
|
-
submitted: "submitted";
|
|
136
|
-
error: "error";
|
|
137
|
-
accepted: "accepted";
|
|
138
|
-
rejected: "rejected";
|
|
139
|
-
}>;
|
|
140
|
-
sandbox: z.ZodBoolean;
|
|
141
|
-
qrUrl: z.ZodOptional<z.ZodString>;
|
|
128
|
+
accepted: z.ZodBoolean;
|
|
129
|
+
csv: z.ZodString;
|
|
130
|
+
tbaiIdentifier: z.ZodString;
|
|
131
|
+
qrUrl: z.ZodString;
|
|
132
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
142
133
|
}, z.core.$loose>;
|
|
143
134
|
export declare const ticketbaiStatusOutput: z.ZodObject<{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
submitted: "submitted";
|
|
152
|
-
error: "error";
|
|
153
|
-
accepted: "accepted";
|
|
154
|
-
rejected: "rejected";
|
|
155
|
-
}>;
|
|
156
|
-
rejectionReason: z.ZodOptional<z.ZodString>;
|
|
157
|
-
error: z.ZodOptional<z.ZodString>;
|
|
135
|
+
accepted: z.ZodBoolean;
|
|
136
|
+
csv: z.ZodString;
|
|
137
|
+
tbaiIdentifier: z.ZodString;
|
|
138
|
+
estado: z.ZodString;
|
|
139
|
+
qrUrl: z.ZodNullable<z.ZodString>;
|
|
140
|
+
submittedAt: z.ZodNullable<z.ZodString>;
|
|
141
|
+
errors: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
158
142
|
}, z.core.$loose>;
|
|
159
143
|
export declare const kSeFSubmitOutput: z.ZodObject<{
|
|
160
144
|
_notImplemented: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"einvoice.d.ts","sourceRoot":"","sources":["../../src/tools/einvoice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"einvoice.d.ts","sourceRoot":"","sources":["../../src/tools/einvoice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA8D5D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAY/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,C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