@12-apps/fiscal 1.4.0 → 1.6.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 +46 -4
- package/dist/{chunk-EDEGIADD.js → chunk-2JVTHJAU.js} +3 -3
- package/dist/{chunk-2ISYBTCE.js → chunk-CEK2GDRY.js} +15 -6
- package/dist/chunk-CEK2GDRY.js.map +1 -0
- package/dist/{chunk-GF3DXCD2.js → chunk-GH452ITO.js} +1 -1
- package/dist/{chunk-GF3DXCD2.js.map → chunk-GH452ITO.js.map} +1 -1
- package/dist/{chunk-MGTROA7K.js → chunk-OAQSGDZ7.js} +11 -7
- package/dist/chunk-OAQSGDZ7.js.map +1 -0
- package/dist/{chunk-OSYB7CVT.js → chunk-P7CRGZGO.js} +2 -2
- package/dist/{chunk-H33BK623.js → chunk-WRYCYXRA.js} +1 -1
- package/dist/{chunk-H33BK623.js.map → chunk-WRYCYXRA.js.map} +1 -1
- package/dist/{chunk-F2PGQVWL.js → chunk-YHSO3476.js} +7 -6
- package/dist/chunk-YHSO3476.js.map +1 -0
- package/dist/{chunk-JVQKJNOC.js → chunk-ZKWVKCGJ.js} +1 -1
- package/dist/chunk-ZKWVKCGJ.js.map +1 -0
- package/dist/{context-CLSMOSuf.d.ts → context-Cyvfr2YB.d.ts} +167 -20
- package/dist/danfe/index.d.ts +7 -0
- package/dist/danfe/index.js +2 -2
- package/dist/documents/index.d.ts +154 -34
- package/dist/documents/index.js +1193 -306
- package/dist/documents/index.js.map +1 -1
- package/dist/engine/index.d.ts +2 -2
- package/dist/http.d.ts +6 -5
- package/dist/http.js +5 -5
- package/dist/issuer/index.d.ts +10 -3
- package/dist/issuer/index.js +27 -4
- package/dist/issuer/index.js.map +1 -1
- package/dist/jobs.d.ts +5 -5
- package/dist/jobs.js +4 -4
- package/dist/manifest/index.d.ts +6 -4
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/server.d.ts +5 -5
- package/dist/manifest/server.js +7 -7
- package/dist/notifications.d.ts +4 -4
- package/dist/notifications.js +3 -3
- package/dist/sale/index.d.ts +29 -1
- package/dist/sale/index.js +7 -0
- package/dist/sale/index.js.map +1 -1
- package/dist/{service-hR3tgLpO.d.ts → service-BCK9aXop.d.ts} +99 -6
- package/dist/sidecar/index.d.ts +35 -210
- package/dist/sidecar/index.js +30 -2
- package/dist/sidecar/index.js.map +1 -1
- package/dist/{types-B1b8LIWX.d.ts → types-BLdkww6G.d.ts} +1 -1
- package/dist/{types-BIJqm5GM.d.ts → types-Sk010Em2.d.ts} +25 -4
- package/dist/types-Z5E14EPw.d.ts +254 -0
- package/package.json +2 -1
- package/prisma/fiscal.prisma +50 -1
- package/prisma/migrations/20261118120000_fiscal_link_payment_event/migration.sql +9 -0
- package/prisma/migrations/20261118180000_fiscal_contingency_blocks/migration.sql +64 -0
- package/sidecar/README.md +53 -1
- package/sidecar/bin/check-platform.php +29 -0
- package/sidecar/composer.json +1 -1
- package/sidecar/composer.lock +7 -7
- package/sidecar/extensions.json +12 -0
- package/sidecar/schema/sale-for-document.schema.json +18 -1
- package/sidecar/src/Http/Request.php +6 -1
- package/sidecar/src/Kernel.php +39 -1
- package/sidecar/src/Nfe/DocumentMapper.php +27 -0
- package/sidecar/src/Nfe/Input.php +10 -0
- package/sidecar/src/Nfe/NfeModule.php +1 -0
- package/sidecar/src/Nfe/NfeService.php +120 -0
- package/sidecar/src/Nfe/SefazReply.php +21 -0
- package/sidecar/src/Platform.php +84 -0
- package/src/danfe/render.ts +16 -5
- package/src/documents/contingency-gaps.ts +88 -0
- package/src/documents/contingency-pass.ts +157 -0
- package/src/documents/contingency-xml.ts +136 -0
- package/src/documents/contingency.ts +257 -0
- package/src/documents/errors.ts +8 -1
- package/src/documents/helpers.ts +5 -0
- package/src/documents/index.ts +25 -2
- package/src/documents/machine-steps.ts +12 -2
- package/src/documents/machine.ts +7 -0
- package/src/documents/memory-blocks.ts +118 -0
- package/src/documents/memory.ts +6 -2
- package/src/documents/payment-link.ts +156 -0
- package/src/documents/ports.ts +163 -13
- package/src/documents/service.ts +14 -0
- package/src/documents/sql-blocks.ts +202 -0
- package/src/documents/sql-store.ts +4 -3
- package/src/documents/types.ts +2 -1
- package/src/http.ts +1 -0
- package/src/issuer/port.ts +24 -1
- package/src/issuer/sidecar.ts +37 -3
- package/src/manifest/index.ts +6 -4
- package/src/sale/index.ts +1 -0
- package/src/sale/types.ts +30 -0
- package/src/sidecar/index.ts +2 -0
- package/src/sidecar/platform.ts +55 -0
- package/src/sidecar/types.ts +38 -0
- package/dist/chunk-2ISYBTCE.js.map +0 -1
- package/dist/chunk-F2PGQVWL.js.map +0 -1
- package/dist/chunk-JVQKJNOC.js.map +0 -1
- package/dist/chunk-MGTROA7K.js.map +0 -1
- /package/dist/{chunk-EDEGIADD.js.map → chunk-2JVTHJAU.js.map} +0 -0
- /package/dist/{chunk-OSYB7CVT.js.map → chunk-P7CRGZGO.js.map} +0 -0
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { I as IbsMunRates, d as IbsSphereRates, e as IbsUfRates, f as IsoDate, g as LineSource, h as LineTax, i as RegimeEspecifico, j as RetainedIntermediationInput, S as SellerProfile, k as ServiceChargeInput, l as TaxClass, m as TaxClassCode, n as TaxExclusions, o as TaxLineInput, T as TaxRegime, p as TaxTreatment } from '../types-
|
|
1
|
+
import { a as TaxInput, b as TaxBreakdown, R as RatePeriod, L as LineFigures, c as RateTables } from '../types-BLdkww6G.js';
|
|
2
|
+
export { I as IbsMunRates, d as IbsSphereRates, e as IbsUfRates, f as IsoDate, g as LineSource, h as LineTax, i as RegimeEspecifico, j as RetainedIntermediationInput, S as SellerProfile, k as ServiceChargeInput, l as TaxClass, m as TaxClassCode, n as TaxExclusions, o as TaxLineInput, T as TaxRegime, p as TaxTreatment } from '../types-BLdkww6G.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `computeTax` — the table mode. Pure: no I/O, no clock, no defaults. The
|
package/dist/http.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { D as DanfeNfceLabels } from './labels-BNvflT0h.js';
|
|
2
|
-
import { D as DocumentStorage } from './context-
|
|
3
|
-
import { F as FiscalDocuments } from './service-
|
|
4
|
-
import './types-
|
|
2
|
+
import { D as DocumentStorage } from './context-Cyvfr2YB.js';
|
|
3
|
+
import { F as FiscalDocuments } from './service-BCK9aXop.js';
|
|
4
|
+
import './types-Sk010Em2.js';
|
|
5
5
|
import './sale/index.js';
|
|
6
|
-
import './
|
|
7
|
-
import './types-
|
|
6
|
+
import './types-Z5E14EPw.js';
|
|
7
|
+
import './types-BLdkww6G.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* `createApiFiscal` — the fiscal HTTP surface as framework-neutral route
|
|
@@ -68,6 +68,7 @@ declare const FISCAL_ERROR_STATUS: {
|
|
|
68
68
|
readonly RETURN_NEEDS_REFERENCE: 422;
|
|
69
69
|
readonly RETURN_ON_NFCE: 422;
|
|
70
70
|
readonly RETURN_OF_NFCE_ONLY: 422;
|
|
71
|
+
readonly CONTINGENCY_XML_REFUSED: 422;
|
|
71
72
|
};
|
|
72
73
|
declare function createApiFiscal(config: FiscalApiConfig): {
|
|
73
74
|
routes: readonly FiscalRoute[];
|
package/dist/http.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FISCAL_ERROR_STATUS,
|
|
3
3
|
createApiFiscal
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-YHSO3476.js";
|
|
5
|
+
import "./chunk-OAQSGDZ7.js";
|
|
6
|
+
import "./chunk-2JVTHJAU.js";
|
|
7
7
|
import "./chunk-PNTKG3DZ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-GH452ITO.js";
|
|
9
9
|
import "./chunk-3SDXLSG4.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-WRYCYXRA.js";
|
|
11
11
|
import "./chunk-7QVYU63E.js";
|
|
12
12
|
export {
|
|
13
13
|
FISCAL_ERROR_STATUS,
|
package/dist/issuer/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as Issuer } from '../types-
|
|
2
|
-
export { C as CancelBySubstitutionCall, a as CancelCall, b as InutilizeCall, c as IssueCall, d as IssuerFailure, e as IssuerOutcome, L as LookupCall, S as SignContingencyCall,
|
|
1
|
+
import { I as Issuer } from '../types-Sk010Em2.js';
|
|
2
|
+
export { C as CancelBySubstitutionCall, a as CancelCall, b as InutilizeCall, c as IssueCall, d as IssuerFailure, e as IssuerOutcome, L as LinkPaymentCall, f as LookupCall, S as SignContingencyCall, g as SigningMaterial, T as TransmitCall, m as modelPath } from '../types-Sk010Em2.js';
|
|
3
3
|
import '../sale/index.js';
|
|
4
|
-
import '../
|
|
4
|
+
import '../types-Z5E14EPw.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The Issuer adapter over the fiscal service in this package's `sidecar/`
|
|
@@ -37,6 +37,13 @@ interface SidecarIssuerConfig {
|
|
|
37
37
|
* both; a shorter one turns answered calls into unknown outcomes.
|
|
38
38
|
*/
|
|
39
39
|
readonly timeoutMs: number;
|
|
40
|
+
/**
|
|
41
|
+
* The service's launch token (`FISCAL_SIDECAR_TOKEN`, FUT-4717), sent as
|
|
42
|
+
* `Authorization: Bearer <token>` on every call: a service started with one
|
|
43
|
+
* answers nothing but `/health` without it. Absent: no header (a service
|
|
44
|
+
* reached only on a private network, started without a token).
|
|
45
|
+
*/
|
|
46
|
+
readonly token?: string;
|
|
40
47
|
}
|
|
41
48
|
declare function createSidecarIssuer(config: SidecarIssuerConfig): Issuer;
|
|
42
49
|
|
package/dist/issuer/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SIDECAR_ERROR_CLASSES
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZKWVKCGJ.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "../chunk-7QVYU63E.js";
|
|
@@ -39,13 +39,17 @@ function parse(text) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
__name(parse, "parse");
|
|
42
|
+
function headersOf(config, base) {
|
|
43
|
+
return config.token === void 0 ? base : { ...base, authorization: `Bearer ${config.token}` };
|
|
44
|
+
}
|
|
45
|
+
__name(headersOf, "headersOf");
|
|
42
46
|
async function post(config, base, path, body) {
|
|
43
47
|
let status;
|
|
44
48
|
let text;
|
|
45
49
|
try {
|
|
46
50
|
const response = await config.fetch(`${base}${path}`, {
|
|
47
51
|
method: "POST",
|
|
48
|
-
headers: { "content-type": "application/json", accept: "application/json" },
|
|
52
|
+
headers: headersOf(config, { "content-type": "application/json", accept: "application/json" }),
|
|
49
53
|
body: JSON.stringify(body),
|
|
50
54
|
signal: AbortSignal.timeout(config.timeoutMs)
|
|
51
55
|
});
|
|
@@ -61,10 +65,21 @@ async function post(config, base, path, body) {
|
|
|
61
65
|
return { ok: false, error: unanswered(`POST ${path} answered HTTP ${status} without the service's error body.`) };
|
|
62
66
|
}
|
|
63
67
|
__name(post, "post");
|
|
64
|
-
function
|
|
68
|
+
function assertIssuerConfig(config) {
|
|
65
69
|
if (typeof config?.baseUrl !== "string" || config.baseUrl === "") throw new TypeError("createSidecarIssuer needs baseUrl.");
|
|
66
70
|
if (typeof config.fetch !== "function") throw new TypeError("createSidecarIssuer needs fetch.");
|
|
67
71
|
if (!Number.isInteger(config.timeoutMs) || config.timeoutMs <= 0) throw new TypeError("createSidecarIssuer needs a positive timeoutMs.");
|
|
72
|
+
assertToken(config.token);
|
|
73
|
+
}
|
|
74
|
+
__name(assertIssuerConfig, "assertIssuerConfig");
|
|
75
|
+
function assertToken(token) {
|
|
76
|
+
if (token !== void 0 && (typeof token !== "string" || token.length < 32 || /\s/.test(token))) {
|
|
77
|
+
throw new TypeError("createSidecarIssuer's token must be at least 32 characters, with no whitespace.");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
__name(assertToken, "assertToken");
|
|
81
|
+
function createSidecarIssuer(config) {
|
|
82
|
+
assertIssuerConfig(config);
|
|
68
83
|
let baseEnd = config.baseUrl.length;
|
|
69
84
|
while (baseEnd > 0 && config.baseUrl[baseEnd - 1] === "/") baseEnd -= 1;
|
|
70
85
|
const base = config.baseUrl.slice(0, baseEnd);
|
|
@@ -99,6 +114,14 @@ function createSidecarIssuer(config) {
|
|
|
99
114
|
reason,
|
|
100
115
|
substituteAccessKey
|
|
101
116
|
}), "cancelBySubstitution"),
|
|
117
|
+
linkPayment: /* @__PURE__ */ __name(({ model, environment, signing, accessKey, protocol, sequence, payments }) => call(`/${modelPath(model)}/link-payment`, {
|
|
118
|
+
environment,
|
|
119
|
+
certificate: signing.certificate,
|
|
120
|
+
accessKey,
|
|
121
|
+
protocol,
|
|
122
|
+
sequence,
|
|
123
|
+
payments
|
|
124
|
+
}), "linkPayment"),
|
|
102
125
|
lookup: /* @__PURE__ */ __name(({ model, environment, signing, accessKey }) => call(`/${modelPath(model)}/lookup`, { environment, certificate: signing.certificate, accessKey }), "lookup"),
|
|
103
126
|
inutilize: /* @__PURE__ */ __name(({ model, environment, signing, uf, cnpj, year, series, from, to, reason }) => call("/inutilize", {
|
|
104
127
|
environment,
|
|
@@ -115,7 +138,7 @@ function createSidecarIssuer(config) {
|
|
|
115
138
|
async health() {
|
|
116
139
|
const response = await config.fetch(`${base}/health`, {
|
|
117
140
|
method: "GET",
|
|
118
|
-
headers: { accept: "application/json" },
|
|
141
|
+
headers: headersOf(config, { accept: "application/json" }),
|
|
119
142
|
signal: AbortSignal.timeout(config.timeoutMs)
|
|
120
143
|
});
|
|
121
144
|
if (response.status !== 200) throw new Error(`The fiscal service's /health answered HTTP ${response.status}.`);
|
package/dist/issuer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/issuer/port.ts","../../src/issuer/sidecar.ts"],"sourcesContent":["/**\n * The Issuer port: what the document service asks of whoever talks to SEFAZ.\n * The first (and today only) adapter is the fiscal service in this package's\n * `sidecar/` folder (`./sidecar`). A call never throws for a failure the\n * service classified: it answers `{ ok: false, error }` with the service's\n * class (`REJECTED`, `RETRYABLE`, `CONTINGENCY`, `AUTH`, `INVALID`,\n * `INTERNAL`), and the document service maps that onto the state machine.\n *\n * The certificate and the CSC travel with each call (the service is\n * stateless) inside {@link SigningMaterial}, built by the signing identity\n * for this one call and dropped with it.\n */\n\nimport type { FiscalDocumentModel } from \"../documents/types\";\nimport type { SaleForDocument } from \"../sale/types\";\nimport type {\n CancelledDocument,\n ContingencyEntry,\n ContingencySignedDocument,\n Csc,\n InutilizedRange,\n IssuedDocument,\n LookedUpDocument,\n SefazEnvironment,\n SidecarErrorBody,\n SidecarHealth,\n SigningCertificate,\n} from \"../sidecar/types\";\n\n/** What signs one call: the A1 and, for an NFC-e, the CSC. Never stored, never logged. */\nexport interface SigningMaterial {\n readonly certificate: SigningCertificate;\n readonly csc: Csc | null;\n}\n\n/** A failed call, classified. The service's error body, verbatim. */\nexport type IssuerFailure = SidecarErrorBody[\"error\"];\n\nexport type IssuerOutcome<T> = { readonly ok: true; readonly answer: T } | { readonly ok: false; readonly error: IssuerFailure };\n\ninterface Call {\n readonly environment: SefazEnvironment;\n readonly signing: SigningMaterial;\n}\n\nexport interface IssueCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly document: SaleForDocument;\n}\n\nexport interface SignContingencyCall extends Call {\n readonly document: SaleForDocument;\n readonly contingency: ContingencyEntry;\n}\n\nexport interface TransmitCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly signedXml: string;\n}\n\nexport interface CancelCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly accessKey: string;\n readonly protocol: string;\n readonly reason: string;\n}\n\n/** NFC-e only: cancel an online document whose sale was issued again in contingency (event 110112). */\nexport interface CancelBySubstitutionCall extends Call {\n readonly accessKey: string;\n readonly protocol: string;\n readonly reason: string;\n readonly substituteAccessKey: string;\n}\n\nexport interface LookupCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly accessKey: string;\n}\n\nexport interface InutilizeCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly uf: string;\n readonly cnpj: string;\n readonly year: number;\n readonly series: number;\n readonly from: number;\n readonly to: number;\n readonly reason: string;\n}\n\nexport interface Issuer {\n /** Build, sign and transmit. `AUTHORIZED` or `DENIED`. */\n issue(call: IssueCall): Promise<IssuerOutcome<IssuedDocument>>;\n /** NFC-e only: build and sign offline (`tpEmis = 9`); nothing is sent. */\n signContingency(call: SignContingencyCall): Promise<IssuerOutcome<ContingencySignedDocument>>;\n /** Send an already signed XML (a contingency document). */\n transmit(call: TransmitCall): Promise<IssuerOutcome<IssuedDocument>>;\n cancel(call: CancelCall): Promise<IssuerOutcome<CancelledDocument>>;\n cancelBySubstitution(call: CancelBySubstitutionCall): Promise<IssuerOutcome<CancelledDocument>>;\n lookup(call: LookupCall): Promise<IssuerOutcome<LookedUpDocument>>;\n inutilize(call: InutilizeCall): Promise<IssuerOutcome<InutilizedRange>>;\n health(): Promise<SidecarHealth>;\n}\n\n/** The path segment of a model on the service's routes. */\nexport function modelPath(model: FiscalDocumentModel): \"nfe\" | \"nfce\" {\n return model === \"NFE\" ? \"nfe\" : \"nfce\";\n}\n","/**\n * The Issuer adapter over the fiscal service in this package's `sidecar/`\n * folder, speaking exactly its wire contract (`../sidecar/types`). JSON in,\n * JSON out; a non-2xx answer carries `{ error }` and is handed back\n * classified, never thrown.\n *\n * What the service cannot classify because it never answered — the fetch\n * failed, timed out or got something that is not the service's JSON — is\n * `RETRYABLE` with `outcomeUnknown: true`: the call may have reached SEFAZ, so\n * the next attempt is a retry of the SAME call, which the service settles by\n * looking the key up first. The message names the path and the HTTP status,\n * never the request: the request carries the certificate.\n */\n\nimport type {\n CancelBySubstitutionRequest,\n CancelRequest,\n InutilizeRequest,\n IssueRequest,\n LookupRequest,\n SidecarErrorBody,\n SidecarHealth,\n SignContingencyRequest,\n TransmitRequest,\n} from \"../sidecar/types\";\nimport { SIDECAR_ERROR_CLASSES } from \"../sidecar/types\";\nimport { type Issuer, type IssuerFailure, type IssuerOutcome, modelPath } from \"./port\";\n\n/** The `fetch` the adapter calls: the global one fits. */\nexport type SidecarFetch = (url: string, init: { method: string; headers: Record<string, string>; body?: string; signal?: AbortSignal }) => Promise<{\n readonly status: number;\n text(): Promise<string>;\n}>;\n\nexport interface SidecarIssuerConfig {\n /** Where the service listens, `http://fiscal-sidecar:8080`. No default. */\n readonly baseUrl: string;\n readonly fetch: SidecarFetch;\n /**\n * How long one call may take, in ms. The service gives SEFAZ its connect\n * timeout plus 20 s and may then look the key up, so this is longer than\n * both; a shorter one turns answered calls into unknown outcomes.\n */\n readonly timeoutMs: number;\n}\n\nfunction unanswered(message: string): IssuerFailure {\n return {\n class: \"RETRYABLE\",\n code: null,\n message,\n details: [],\n accessKey: null,\n signedXml: null,\n sefazReply: null,\n outcomeUnknown: true,\n };\n}\n\nfunction isErrorBody(value: unknown): value is SidecarErrorBody {\n if (value === null || typeof value !== \"object\" || !(\"error\" in value)) return false;\n const error = (value as { error: unknown }).error;\n return (\n error !== null &&\n typeof error === \"object\" &&\n SIDECAR_ERROR_CLASSES.includes((error as { class: IssuerFailure[\"class\"] }).class)\n );\n}\n\nfunction parse(text: string): unknown {\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return undefined;\n }\n}\n\n/** One POST to the service, its answer classified; never throws. */\nasync function post<T>(config: SidecarIssuerConfig, base: string, path: string, body: unknown): Promise<IssuerOutcome<T>> {\n let status: number;\n let text: string;\n try {\n const response = await config.fetch(`${base}${path}`, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", accept: \"application/json\" },\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(config.timeoutMs),\n });\n status = response.status;\n text = await response.text();\n } catch (error) {\n const why = error instanceof Error ? error.name : \"unknown\";\n return { ok: false, error: unanswered(`POST ${path} got no answer from the fiscal service (${why}).`) };\n }\n const parsed = parse(text);\n if (status >= 200 && status < 300 && parsed !== undefined && !isErrorBody(parsed)) return { ok: true, answer: parsed as T };\n if (isErrorBody(parsed)) return { ok: false, error: parsed.error };\n return { ok: false, error: unanswered(`POST ${path} answered HTTP ${status} without the service's error body.`) };\n}\n\nexport function createSidecarIssuer(config: SidecarIssuerConfig): Issuer {\n if (typeof config?.baseUrl !== \"string\" || config.baseUrl === \"\") throw new TypeError(\"createSidecarIssuer needs baseUrl.\");\n if (typeof config.fetch !== \"function\") throw new TypeError(\"createSidecarIssuer needs fetch.\");\n if (!Number.isInteger(config.timeoutMs) || config.timeoutMs <= 0) throw new TypeError(\"createSidecarIssuer needs a positive timeoutMs.\");\n let baseEnd = config.baseUrl.length;\n while (baseEnd > 0 && config.baseUrl[baseEnd - 1] === \"/\") baseEnd -= 1;\n const base = config.baseUrl.slice(0, baseEnd);\n\n const call = <T>(path: string, body: unknown) => post<T>(config, base, path, body);\n\n return {\n issue: ({ model, environment, signing, document }) =>\n call(`/${modelPath(model)}/issue`, {\n environment,\n certificate: signing.certificate,\n csc: model === \"NFCE\" ? signing.csc : null,\n document,\n } satisfies IssueRequest),\n signContingency: ({ environment, signing, document, contingency }) =>\n call(\"/nfce/sign-contingency\", {\n environment,\n certificate: signing.certificate,\n csc: signing.csc,\n document,\n contingency,\n } satisfies SignContingencyRequest),\n transmit: ({ model, environment, signing, signedXml }) =>\n call(`/${modelPath(model)}/transmit`, { environment, certificate: signing.certificate, signedXml } satisfies TransmitRequest),\n cancel: ({ model, environment, signing, accessKey, protocol, reason }) =>\n call(`/${modelPath(model)}/cancel`, {\n environment,\n certificate: signing.certificate,\n accessKey,\n protocol,\n reason,\n } satisfies CancelRequest),\n cancelBySubstitution: ({ environment, signing, accessKey, protocol, reason, substituteAccessKey }) =>\n call(\"/nfce/cancel-substitution\", {\n environment,\n certificate: signing.certificate,\n accessKey,\n protocol,\n reason,\n substituteAccessKey,\n } satisfies CancelBySubstitutionRequest),\n lookup: ({ model, environment, signing, accessKey }) =>\n call(`/${modelPath(model)}/lookup`, { environment, certificate: signing.certificate, accessKey } satisfies LookupRequest),\n inutilize: ({ model, environment, signing, uf, cnpj, year, series, from, to, reason }) =>\n call(\"/inutilize\", {\n environment,\n certificate: signing.certificate,\n model: modelPath(model),\n uf,\n cnpj,\n year,\n series,\n from,\n to,\n reason,\n } satisfies InutilizeRequest),\n async health() {\n const response = await config.fetch(`${base}/health`, {\n method: \"GET\",\n headers: { accept: \"application/json\" },\n signal: AbortSignal.timeout(config.timeoutMs),\n });\n if (response.status !== 200) throw new Error(`The fiscal service's /health answered HTTP ${response.status}.`);\n return JSON.parse(await response.text()) as SidecarHealth;\n },\n };\n}\n"],"mappings":";;;;;;;;AA0GO,SAAS,UAAU,OAA4C;AACpE,SAAO,UAAU,QAAQ,QAAQ;AACnC;AAFgB;;;AC5DhB,SAAS,WAAW,SAAgC;AAClD,SAAO;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN;AAAA,IACA,SAAS,CAAC;AAAA,IACV,WAAW;AAAA,IACX,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAClB;AACF;AAXS;AAaT,SAAS,YAAY,OAA2C;AAC9D,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,EAAE,WAAW,OAAQ,QAAO;AAC/E,QAAM,QAAS,MAA6B;AAC5C,SACE,UAAU,QACV,OAAO,UAAU,YACjB,sBAAsB,SAAU,MAA4C,KAAK;AAErF;AARS;AAUT,SAAS,MAAM,MAAuB;AACpC,MAAI;AACF,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AANS;AAST,eAAe,KAAQ,QAA6B,MAAc,MAAc,MAA0C;AACxH,MAAI;AACJ,MAAI;AACJ,MAAI;AACF,UAAM,WAAW,MAAM,OAAO,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;AAAA,MACA,aAAa,QAAQ;AAAA,MACrB,OAAO,UAAU,KAAK;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAA4B,GAZnB;AAAA,IAaX,MAAM,SAAS;AACb,YAAM,WAAW,MAAM,OAAO,MAAM,GAAG,IAAI,WAAW;AAAA,QACpD,QAAQ;AAAA,QACR,SAAS,EAAE,QAAQ,mBAAmB;AAAA,QACtC,QAAQ,YAAY,QAAQ,OAAO,SAAS;AAAA,MAC9C,CAAC;AACD,UAAI,SAAS,WAAW,IAAK,OAAM,IAAI,MAAM,8CAA8C,SAAS,MAAM,GAAG;AAC7G,aAAO,KAAK,MAAM,MAAM,SAAS,KAAK,CAAC;AAAA,IACzC;AAAA,EACF;AACF;AAtEgB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/issuer/port.ts","../../src/issuer/sidecar.ts"],"sourcesContent":["/**\n * The Issuer port: what the document service asks of whoever talks to SEFAZ.\n * The first (and today only) adapter is the fiscal service in this package's\n * `sidecar/` folder (`./sidecar`). A call never throws for a failure the\n * service classified: it answers `{ ok: false, error }` with the service's\n * class (`REJECTED`, `RETRYABLE`, `CONTINGENCY`, `AUTH`, `INVALID`,\n * `INTERNAL`), and the document service maps that onto the state machine.\n *\n * The certificate and the CSC travel with each call (the service is\n * stateless) inside {@link SigningMaterial}, built by the signing identity\n * for this one call and dropped with it.\n */\n\nimport type { FiscalDocumentModel } from \"../documents/types\";\nimport type { LinkedTransaction, SaleForDocument } from \"../sale/types\";\nimport type {\n CancelledDocument,\n ContingencyEntry,\n ContingencySignedDocument,\n Csc,\n InutilizedRange,\n IssuedDocument,\n LookedUpDocument,\n RegisteredPaymentLink,\n SefazEnvironment,\n SidecarErrorBody,\n SidecarHealth,\n SigningCertificate,\n} from \"../sidecar/types\";\n\n/** What signs one call: the A1 and, for an NFC-e, the CSC. Never stored, never logged. */\nexport interface SigningMaterial {\n readonly certificate: SigningCertificate;\n readonly csc: Csc | null;\n}\n\n/** A failed call, classified. The service's error body, verbatim. */\nexport type IssuerFailure = SidecarErrorBody[\"error\"];\n\nexport type IssuerOutcome<T> = { readonly ok: true; readonly answer: T } | { readonly ok: false; readonly error: IssuerFailure };\n\ninterface Call {\n readonly environment: SefazEnvironment;\n readonly signing: SigningMaterial;\n}\n\nexport interface IssueCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly document: SaleForDocument;\n}\n\nexport interface SignContingencyCall extends Call {\n readonly document: SaleForDocument;\n readonly contingency: ContingencyEntry;\n}\n\nexport interface TransmitCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly signedXml: string;\n}\n\nexport interface CancelCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly accessKey: string;\n readonly protocol: string;\n readonly reason: string;\n}\n\n/** NFC-e only: cancel an online document whose sale was issued again in contingency (event 110112). */\nexport interface CancelBySubstitutionCall extends Call {\n readonly accessKey: string;\n readonly protocol: string;\n readonly reason: string;\n readonly substituteAccessKey: string;\n}\n\n/** The event 110300 \"Vinculação Pagamento\" (NT 2026.006 v1.00): one transaction linked to an authorised document. */\nexport interface LinkPaymentCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly accessKey: string;\n readonly protocol: string;\n /** `nSeqEvento`, 1–20. */\n readonly sequence: number;\n /**\n * The transactions the event links. Exactly ONE today: the event's schema\n * (`e110300_v1.00.xsd`) carries a single `gPgto`, so the service refuses any\n * other count as INVALID; the list is the NT group's own shape.\n */\n readonly payments: readonly LinkedTransaction[];\n}\n\nexport interface LookupCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly accessKey: string;\n}\n\nexport interface InutilizeCall extends Call {\n readonly model: FiscalDocumentModel;\n readonly uf: string;\n readonly cnpj: string;\n readonly year: number;\n readonly series: number;\n readonly from: number;\n readonly to: number;\n readonly reason: string;\n}\n\nexport interface Issuer {\n /** Build, sign and transmit. `AUTHORIZED` or `DENIED`. */\n issue(call: IssueCall): Promise<IssuerOutcome<IssuedDocument>>;\n /** NFC-e only: build and sign offline (`tpEmis = 9`); nothing is sent. */\n signContingency(call: SignContingencyCall): Promise<IssuerOutcome<ContingencySignedDocument>>;\n /** Send an already signed XML (a contingency document). */\n transmit(call: TransmitCall): Promise<IssuerOutcome<IssuedDocument>>;\n cancel(call: CancelCall): Promise<IssuerOutcome<CancelledDocument>>;\n cancelBySubstitution(call: CancelBySubstitutionCall): Promise<IssuerOutcome<CancelledDocument>>;\n lookup(call: LookupCall): Promise<IssuerOutcome<LookedUpDocument>>;\n /**\n * The event 110300. Optional on the port so an issuer written before it\n * still satisfies the type; one that lacks it cannot link (the document\n * service answers `NOT_SUPPORTED`), and a host may read its presence as\n * \"this issuer writes `gPgtoVinc`\".\n */\n linkPayment?(call: LinkPaymentCall): Promise<IssuerOutcome<RegisteredPaymentLink>>;\n inutilize(call: InutilizeCall): Promise<IssuerOutcome<InutilizedRange>>;\n health(): Promise<SidecarHealth>;\n}\n\n/** The path segment of a model on the service's routes. */\nexport function modelPath(model: FiscalDocumentModel): \"nfe\" | \"nfce\" {\n return model === \"NFE\" ? \"nfe\" : \"nfce\";\n}\n","/**\n * The Issuer adapter over the fiscal service in this package's `sidecar/`\n * folder, speaking exactly its wire contract (`../sidecar/types`). JSON in,\n * JSON out; a non-2xx answer carries `{ error }` and is handed back\n * classified, never thrown.\n *\n * What the service cannot classify because it never answered — the fetch\n * failed, timed out or got something that is not the service's JSON — is\n * `RETRYABLE` with `outcomeUnknown: true`: the call may have reached SEFAZ, so\n * the next attempt is a retry of the SAME call, which the service settles by\n * looking the key up first. The message names the path and the HTTP status,\n * never the request: the request carries the certificate.\n */\n\nimport type {\n CancelBySubstitutionRequest,\n CancelRequest,\n InutilizeRequest,\n IssueRequest,\n LinkPaymentRequest,\n LookupRequest,\n SidecarErrorBody,\n SidecarHealth,\n SignContingencyRequest,\n TransmitRequest,\n} from \"../sidecar/types\";\nimport { SIDECAR_ERROR_CLASSES } from \"../sidecar/types\";\nimport { type Issuer, type IssuerFailure, type IssuerOutcome, modelPath } from \"./port\";\n\n/** The `fetch` the adapter calls: the global one fits. */\nexport type SidecarFetch = (url: string, init: { method: string; headers: Record<string, string>; body?: string; signal?: AbortSignal }) => Promise<{\n readonly status: number;\n text(): Promise<string>;\n}>;\n\nexport interface SidecarIssuerConfig {\n /** Where the service listens, `http://fiscal-sidecar:8080`. No default. */\n readonly baseUrl: string;\n readonly fetch: SidecarFetch;\n /**\n * How long one call may take, in ms. The service gives SEFAZ its connect\n * timeout plus 20 s and may then look the key up, so this is longer than\n * both; a shorter one turns answered calls into unknown outcomes.\n */\n readonly timeoutMs: number;\n /**\n * The service's launch token (`FISCAL_SIDECAR_TOKEN`, FUT-4717), sent as\n * `Authorization: Bearer <token>` on every call: a service started with one\n * answers nothing but `/health` without it. Absent: no header (a service\n * reached only on a private network, started without a token).\n */\n readonly token?: string;\n}\n\nfunction unanswered(message: string): IssuerFailure {\n return {\n class: \"RETRYABLE\",\n code: null,\n message,\n details: [],\n accessKey: null,\n signedXml: null,\n sefazReply: null,\n outcomeUnknown: true,\n };\n}\n\nfunction isErrorBody(value: unknown): value is SidecarErrorBody {\n if (value === null || typeof value !== \"object\" || !(\"error\" in value)) return false;\n const error = (value as { error: unknown }).error;\n return (\n error !== null &&\n typeof error === \"object\" &&\n SIDECAR_ERROR_CLASSES.includes((error as { class: IssuerFailure[\"class\"] }).class)\n );\n}\n\nfunction parse(text: string): unknown {\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return undefined;\n }\n}\n\n/** One POST to the service, its answer classified; never throws. */\n/** The headers every call carries: the bearer only when the service has a token. */\nfunction headersOf(config: SidecarIssuerConfig, base: Record<string, string>): Record<string, string> {\n return config.token === undefined ? base : { ...base, authorization: `Bearer ${config.token}` };\n}\n\nasync function post<T>(config: SidecarIssuerConfig, base: string, path: string, body: unknown): Promise<IssuerOutcome<T>> {\n let status: number;\n let text: string;\n try {\n const response = await config.fetch(`${base}${path}`, {\n method: \"POST\",\n headers: headersOf(config, { \"content-type\": \"application/json\", accept: \"application/json\" }),\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(config.timeoutMs),\n });\n status = response.status;\n text = await response.text();\n } catch (error) {\n const why = error instanceof Error ? error.name : \"unknown\";\n return { ok: false, error: unanswered(`POST ${path} got no answer from the fiscal service (${why}).`) };\n }\n const parsed = parse(text);\n if (status >= 200 && status < 300 && parsed !== undefined && !isErrorBody(parsed)) return { ok: true, answer: parsed as T };\n if (isErrorBody(parsed)) return { ok: false, error: parsed.error };\n return { ok: false, error: unanswered(`POST ${path} answered HTTP ${status} without the service's error body.`) };\n}\n\nfunction assertIssuerConfig(config: SidecarIssuerConfig): void {\n if (typeof config?.baseUrl !== \"string\" || config.baseUrl === \"\") throw new TypeError(\"createSidecarIssuer needs baseUrl.\");\n if (typeof config.fetch !== \"function\") throw new TypeError(\"createSidecarIssuer needs fetch.\");\n if (!Number.isInteger(config.timeoutMs) || config.timeoutMs <= 0) throw new TypeError(\"createSidecarIssuer needs a positive timeoutMs.\");\n assertToken(config.token);\n}\n\nfunction assertToken(token: unknown): void {\n if (token !== undefined && (typeof token !== \"string\" || token.length < 32 || /\\s/.test(token))) {\n // Never quoted: the message names the rule, not the value.\n throw new TypeError(\"createSidecarIssuer's token must be at least 32 characters, with no whitespace.\");\n }\n}\n\nexport function createSidecarIssuer(config: SidecarIssuerConfig): Issuer {\n assertIssuerConfig(config);\n let baseEnd = config.baseUrl.length;\n while (baseEnd > 0 && config.baseUrl[baseEnd - 1] === \"/\") baseEnd -= 1;\n const base = config.baseUrl.slice(0, baseEnd);\n\n const call = <T>(path: string, body: unknown) => post<T>(config, base, path, body);\n\n return {\n issue: ({ model, environment, signing, document }) =>\n call(`/${modelPath(model)}/issue`, {\n environment,\n certificate: signing.certificate,\n csc: model === \"NFCE\" ? signing.csc : null,\n document,\n } satisfies IssueRequest),\n signContingency: ({ environment, signing, document, contingency }) =>\n call(\"/nfce/sign-contingency\", {\n environment,\n certificate: signing.certificate,\n csc: signing.csc,\n document,\n contingency,\n } satisfies SignContingencyRequest),\n transmit: ({ model, environment, signing, signedXml }) =>\n call(`/${modelPath(model)}/transmit`, { environment, certificate: signing.certificate, signedXml } satisfies TransmitRequest),\n cancel: ({ model, environment, signing, accessKey, protocol, reason }) =>\n call(`/${modelPath(model)}/cancel`, {\n environment,\n certificate: signing.certificate,\n accessKey,\n protocol,\n reason,\n } satisfies CancelRequest),\n cancelBySubstitution: ({ environment, signing, accessKey, protocol, reason, substituteAccessKey }) =>\n call(\"/nfce/cancel-substitution\", {\n environment,\n certificate: signing.certificate,\n accessKey,\n protocol,\n reason,\n substituteAccessKey,\n } satisfies CancelBySubstitutionRequest),\n linkPayment: ({ model, environment, signing, accessKey, protocol, sequence, payments }) =>\n call(`/${modelPath(model)}/link-payment`, {\n environment,\n certificate: signing.certificate,\n accessKey,\n protocol,\n sequence,\n payments,\n } satisfies LinkPaymentRequest),\n lookup: ({ model, environment, signing, accessKey }) =>\n call(`/${modelPath(model)}/lookup`, { environment, certificate: signing.certificate, accessKey } satisfies LookupRequest),\n inutilize: ({ model, environment, signing, uf, cnpj, year, series, from, to, reason }) =>\n call(\"/inutilize\", {\n environment,\n certificate: signing.certificate,\n model: modelPath(model),\n uf,\n cnpj,\n year,\n series,\n from,\n to,\n reason,\n } satisfies InutilizeRequest),\n async health() {\n const response = await config.fetch(`${base}/health`, {\n method: \"GET\",\n headers: headersOf(config, { accept: \"application/json\" }),\n signal: AbortSignal.timeout(config.timeoutMs),\n });\n if (response.status !== 200) throw new Error(`The fiscal service's /health answered HTTP ${response.status}.`);\n return JSON.parse(await response.text()) as SidecarHealth;\n },\n };\n}\n"],"mappings":";;;;;;;;AAiIO,SAAS,UAAU,OAA4C;AACpE,SAAO,UAAU,QAAQ,QAAQ;AACnC;AAFgB;;;AC3EhB,SAAS,WAAW,SAAgC;AAClD,SAAO;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN;AAAA,IACA,SAAS,CAAC;AAAA,IACV,WA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A,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAA4B,GAZnB;AAAA,IAaX,MAAM,SAAS;AACb,YAAM,WAAW,MAAM,OAAO,MAAM,GAAG,IAAI,WAAW;AAAA,QACpD,QAAQ;AAAA,QACR,SAAS,UAAU,QAAQ,EAAE,QAAQ,mBAAmB,CAAC;AAAA,QACzD,QAAQ,YAAY,QAAQ,OAAO,SAAS;AAAA,MAC9C,CAAC;AACD,UAAI,SAAS,WAAW,IAAK,OAAM,IAAI,MAAM,8CAA8C,SAAS,MAAM,GAAG;AAC7G,aAAO,KAAK,MAAM,MAAM,SAAS,KAAK,CAAC;AAAA,IACzC;AAAA,EACF;AACF;AA7EgB;","names":[]}
|
package/dist/jobs.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _12_apps_wiring from '@12-apps/wiring';
|
|
2
|
-
import { F as FiscalStore, a as FiscalNotifyPort } from './context-
|
|
3
|
-
import { F as FiscalDocuments } from './service-
|
|
4
|
-
import './types-
|
|
2
|
+
import { F as FiscalStore, a as FiscalNotifyPort } from './context-Cyvfr2YB.js';
|
|
3
|
+
import { F as FiscalDocuments } from './service-BCK9aXop.js';
|
|
4
|
+
import './types-Sk010Em2.js';
|
|
5
5
|
import './sale/index.js';
|
|
6
|
-
import './
|
|
7
|
-
import './types-
|
|
6
|
+
import './types-Z5E14EPw.js';
|
|
7
|
+
import './types-BLdkww6G.js';
|
|
8
8
|
|
|
9
9
|
interface FiscalJobDeps {
|
|
10
10
|
readonly documents: Pick<FiscalDocuments, "sweep" | "transmitContingency">;
|
package/dist/jobs.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
FISCAL_SWEEP_BATCH,
|
|
6
6
|
FISCAL_WORST_STEP_MS,
|
|
7
7
|
daysLeft
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-P7CRGZGO.js";
|
|
9
|
+
import "./chunk-CEK2GDRY.js";
|
|
10
|
+
import "./chunk-GH452ITO.js";
|
|
11
11
|
import "./chunk-3SDXLSG4.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-WRYCYXRA.js";
|
|
13
13
|
import "./chunk-7QVYU63E.js";
|
|
14
14
|
export {
|
|
15
15
|
CERTIFICATE_WARNING_DAYS,
|
package/dist/manifest/index.d.ts
CHANGED
|
@@ -53,10 +53,12 @@ declare const FISCAL_PERMISSIONS: {
|
|
|
53
53
|
* list are built with their screen tickets (FUT-2231, FUT-2238) from the
|
|
54
54
|
* owner's approved prototypes, over these routes.
|
|
55
55
|
* - **No NFS-e.** Only the platform's own NFS-e is planned (FUT-2242).
|
|
56
|
-
* - **No register
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
56
|
+
* - **No register-block routes or job.** Contingency blocks are implemented
|
|
57
|
+
* (FUT-4717): `createFiscalDocuments` is the `ContingencyBlockSource`
|
|
58
|
+
* (reserve, record a signed note, close, abandon) and runs the gap pass
|
|
59
|
+
* (`voidKnownGaps`, `listUnknownRanges`). The host wires them: the routes a
|
|
60
|
+
* register calls, the monthly void job, and the store's flag of unknown
|
|
61
|
+
* ranges.
|
|
60
62
|
*
|
|
61
63
|
* `@12-apps/wiring` is a TYPE-ONLY dependency: the manifest is a plain
|
|
62
64
|
* `satisfies`-checked value, and the producer's assertions run in this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/manifest/index.ts"],"sourcesContent":["/**\n * `@12-apps/fiscal/manifest` — the SHARED wiring manifest.\n *\n * - `permissions` — `fiscal:read`, `fiscal:manage`, `fiscal:issue`,\n * `fiscal:cancel`, declared here and nowhere else; every route in\n * `../http` names the one it needs.\n * - `db` — the Prisma partial (`prisma/fiscal.prisma`: the emitter profile,\n * issuing points, one number counter per series, documents and their\n * events) and its migrations.\n * - `observability` — `fiscal`: the sweeps log under it.\n * - `server: [\"http\", \"jobs\"]` — `./manifest/server`.\n *\n * Narrowings, each argued in `.wiring-conformance.json`:\n *\n * - **No static `notifications`.** The two alerts (certificate expiring,\n * document rejected) are host words, so they ship as the factory\n * `createFiscalNotificationBlueprints(copy)` (`@12-apps/fiscal/notifications`),\n * which the host feeds to its own mount.\n * - **No `web` surface yet.** The fiscal settings screen and the documents\n * list are built with their screen tickets (FUT-2231, FUT-2238) from the\n * owner's approved prototypes, over these routes.\n * - **No NFS-e.** Only the platform's own NFS-e is planned (FUT-2242).\n * - **No register
|
|
1
|
+
{"version":3,"sources":["../../src/manifest/index.ts"],"sourcesContent":["/**\n * `@12-apps/fiscal/manifest` — the SHARED wiring manifest.\n *\n * - `permissions` — `fiscal:read`, `fiscal:manage`, `fiscal:issue`,\n * `fiscal:cancel`, declared here and nowhere else; every route in\n * `../http` names the one it needs.\n * - `db` — the Prisma partial (`prisma/fiscal.prisma`: the emitter profile,\n * issuing points, one number counter per series, documents and their\n * events) and its migrations.\n * - `observability` — `fiscal`: the sweeps log under it.\n * - `server: [\"http\", \"jobs\"]` — `./manifest/server`.\n *\n * Narrowings, each argued in `.wiring-conformance.json`:\n *\n * - **No static `notifications`.** The two alerts (certificate expiring,\n * document rejected) are host words, so they ship as the factory\n * `createFiscalNotificationBlueprints(copy)` (`@12-apps/fiscal/notifications`),\n * which the host feeds to its own mount.\n * - **No `web` surface yet.** The fiscal settings screen and the documents\n * list are built with their screen tickets (FUT-2231, FUT-2238) from the\n * owner's approved prototypes, over these routes.\n * - **No NFS-e.** Only the platform's own NFS-e is planned (FUT-2242).\n * - **No register-block routes or job.** Contingency blocks are implemented\n * (FUT-4717): `createFiscalDocuments` is the `ContingencyBlockSource`\n * (reserve, record a signed note, close, abandon) and runs the gap pass\n * (`voidKnownGaps`, `listUnknownRanges`). The host wires them: the routes a\n * register calls, the monthly void job, and the store's flag of unknown\n * ranges.\n *\n * `@12-apps/wiring` is a TYPE-ONLY dependency: the manifest is a plain\n * `satisfies`-checked value, and the producer's assertions run in this\n * package's own test suite.\n */\n\nimport type { PackageManifest } from \"@12-apps/wiring\";\n\nimport { FISCAL_PERMISSIONS } from \"./permissions\";\n\nexport { FISCAL_CANCEL, FISCAL_ISSUE, FISCAL_MANAGE, FISCAL_PERMISSIONS, FISCAL_READ } from \"./permissions\";\n\nexport const fiscalManifest = {\n name: \"@12-apps/fiscal\",\n contract: 1,\n permissions: FISCAL_PERMISSIONS,\n db: { partial: \"prisma/fiscal.prisma\", migrations: \"prisma/migrations\" },\n observability: { namespace: \"fiscal\" },\n server: [\"http\", \"jobs\"],\n} as const satisfies PackageManifest;\n"],"mappings":";;;;;;;;;;AAwCO,IAAM,iBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,IAAI,EAAE,SAAS,wBAAwB,YAAY,oBAAoB;AAAA,EACvE,eAAe,EAAE,WAAW,SAAS;AAAA,EACrC,QAAQ,CAAC,QAAQ,MAAM;AACzB;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _12_apps_wiring from '@12-apps/wiring';
|
|
2
2
|
import { FiscalJobDeps } from '../jobs.js';
|
|
3
3
|
import { createApiFiscal } from '../http.js';
|
|
4
|
-
import '../context-
|
|
5
|
-
import '../types-
|
|
4
|
+
import '../context-Cyvfr2YB.js';
|
|
5
|
+
import '../types-Sk010Em2.js';
|
|
6
6
|
import '../sale/index.js';
|
|
7
|
-
import '../
|
|
8
|
-
import '../types-
|
|
9
|
-
import '../service-
|
|
7
|
+
import '../types-Z5E14EPw.js';
|
|
8
|
+
import '../types-BLdkww6G.js';
|
|
9
|
+
import '../service-BCK9aXop.js';
|
|
10
10
|
import '../labels-BNvflT0h.js';
|
|
11
11
|
|
|
12
12
|
declare const fiscalServerManifest: {
|
package/dist/manifest/server.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiFiscal
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-YHSO3476.js";
|
|
4
|
+
import "../chunk-OAQSGDZ7.js";
|
|
5
|
+
import "../chunk-2JVTHJAU.js";
|
|
6
6
|
import "../chunk-PNTKG3DZ.js";
|
|
7
7
|
import {
|
|
8
8
|
FISCAL_JOBS
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-P7CRGZGO.js";
|
|
10
|
+
import "../chunk-CEK2GDRY.js";
|
|
11
|
+
import "../chunk-GH452ITO.js";
|
|
12
12
|
import "../chunk-3SDXLSG4.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-WRYCYXRA.js";
|
|
14
14
|
import "../chunk-7QVYU63E.js";
|
|
15
15
|
|
|
16
16
|
// src/manifest/server.ts
|
package/dist/notifications.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { b as FISCAL_CERTIFICATE_EXPIRING, c as FISCAL_CONTINGENCY_DEADLINE, d as FISCAL_DOCUMENT_NEEDS_ATTENTION, e as FISCAL_DOCUMENT_REJECTED } from './context-
|
|
2
|
-
import { F as FiscalDocumentModel,
|
|
1
|
+
export { b as FISCAL_CERTIFICATE_EXPIRING, c as FISCAL_CONTINGENCY_DEADLINE, d as FISCAL_DOCUMENT_NEEDS_ATTENTION, e as FISCAL_DOCUMENT_REJECTED } from './context-Cyvfr2YB.js';
|
|
2
|
+
import { F as FiscalDocumentModel, h as FiscalDocumentStatus, N as NumberVoid } from './types-Sk010Em2.js';
|
|
3
3
|
import './sale/index.js';
|
|
4
|
-
import './
|
|
5
|
-
import './types-
|
|
4
|
+
import './types-Z5E14EPw.js';
|
|
5
|
+
import './types-BLdkww6G.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* `@12-apps/fiscal/notifications` — what the package tells people about,
|
package/dist/notifications.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
FISCAL_CONTINGENCY_DEADLINE,
|
|
4
4
|
FISCAL_DOCUMENT_NEEDS_ATTENTION,
|
|
5
5
|
FISCAL_DOCUMENT_REJECTED
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-CEK2GDRY.js";
|
|
7
|
+
import "./chunk-GH452ITO.js";
|
|
8
8
|
import "./chunk-3SDXLSG4.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-WRYCYXRA.js";
|
|
10
10
|
import {
|
|
11
11
|
__name
|
|
12
12
|
} from "./chunk-7QVYU63E.js";
|
package/dist/sale/index.d.ts
CHANGED
|
@@ -173,6 +173,27 @@ interface CardDetails {
|
|
|
173
173
|
/** `cAut`. */
|
|
174
174
|
readonly authorizationCode: string | null;
|
|
175
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* `tpMeioPgto` (Informe Técnico 2026.001 v1.01): the means a linked payment
|
|
178
|
+
* transaction moved by — 15 boleto, 17 Pix QR dinâmico, 18 TED, 20 Pix by key
|
|
179
|
+
* or static QR, 23 Pix automático, 24 TEF. A card and cash have none.
|
|
180
|
+
*/
|
|
181
|
+
declare const PAYMENT_LINK_MEANS: readonly ["15", "17", "18", "20", "23", "24"];
|
|
182
|
+
type PaymentLinkMeans = (typeof PAYMENT_LINK_MEANS)[number];
|
|
183
|
+
/**
|
|
184
|
+
* `gPgtoVinc/gPgto` (NT 2026.006 v1.00): a payment transaction started before
|
|
185
|
+
* the document — a Pix QR raised, a boleto generated — linked by its id, so the
|
|
186
|
+
* split payment can find the document. The event 110300 links one after the fact.
|
|
187
|
+
*/
|
|
188
|
+
interface LinkedTransaction {
|
|
189
|
+
/** `idTransacao`, 2–35 characters: the Pix txid, the boleto's or the transfer's id. */
|
|
190
|
+
readonly transactionId: string;
|
|
191
|
+
readonly meansCode: PaymentLinkMeans;
|
|
192
|
+
/** `CNPJBasePSP`: the 8-character CNPJ base of the receiver's payment institution. */
|
|
193
|
+
readonly pspCnpjBase: string;
|
|
194
|
+
/** `CNPJReceb`: who receives the money (the issuer, or a platform receiving for it). */
|
|
195
|
+
readonly receiverCnpj: string;
|
|
196
|
+
}
|
|
176
197
|
interface SalePayment {
|
|
177
198
|
readonly method: PaymentMethod;
|
|
178
199
|
readonly amountCents: number;
|
|
@@ -180,6 +201,13 @@ interface SalePayment {
|
|
|
180
201
|
readonly card: CardDetails | null;
|
|
181
202
|
/** `xPag`: required when `method` is `OTHER`. */
|
|
182
203
|
readonly description: string | null;
|
|
204
|
+
/**
|
|
205
|
+
* The transaction this payment was started as, written in `gPgtoVinc` with
|
|
206
|
+
* `nPag` = its position. Absent or `null`: no link. The host decides whether
|
|
207
|
+
* the environment accepts the group (optional in the layout; its production
|
|
208
|
+
* activation is the fisco's).
|
|
209
|
+
*/
|
|
210
|
+
readonly linkedTransaction?: LinkedTransaction | null;
|
|
183
211
|
}
|
|
184
212
|
/** `finNFe` 1–4. */
|
|
185
213
|
type DocumentPurpose = "NORMAL" | "COMPLEMENTARY" | "ADJUSTMENT" | "RETURN";
|
|
@@ -266,4 +294,4 @@ interface SaleForDocument {
|
|
|
266
294
|
readonly technicalResponsible: TechnicalResponsible | null;
|
|
267
295
|
}
|
|
268
296
|
|
|
269
|
-
export type
|
|
297
|
+
export { type Address, type BuyerDocument, type BuyerPresence, type CardDetails, type ContributionCst, type DocumentBuyer, type DocumentIssuer, type DocumentOperation, type DocumentPurpose, type FreightMode, type GoodsOrigin, type IbsCbsFigures, type IcmsSimples, type IcmsSimplesWithCredit, type IcmsTaxed, type IcmsUntaxed, type IssuerTaxRegime, type LineContribution, type LineIbsCbs, type LineIcms, type LinkedTransaction, type OperationDestination, PAYMENT_LINK_MEANS, type PaymentLinkMeans, type PaymentMethod, type ReferencedDocument, type SaleForDocument, type SaleIntermediary, type SaleLine, type SalePayment, type StateRegistrationStatus, type TechnicalResponsible, type Uf };
|
package/dist/sale/index.js
CHANGED
package/dist/sale/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/sale/types.ts"],"sourcesContent":["/**\n * The neutral document shape: one sale, host-agnostic, as the fiscal service\n * (`sidecar/`) accepts it and as the issuer port maps a host's sale into it.\n *\n * Money is integer CENTS, rates integer BASIS POINTS (1 bp = 0.01%) — the\n * engine's conventions (`@12-apps/fiscal/engine`) — and quantities carry at\n * most four decimals. Every field is required; an absent value is `null`,\n * never a missing key, so a host cannot forget one silently. The two\n * exceptions came with the return document (FUT-2238), `operation` and\n * `referencedDocuments`: they are optional so that a document built before\n * them stays valid and yields the same XML, byte for byte.\n *\n * The JSON schema the service validates against is\n * `@12-apps/fiscal/sidecar/schema/sale-for-document.schema.json`; a test keeps\n * it and these types in step. Whether the sale becomes an NF-e (model 55) or\n * an NFC-e (model 65) is the request path's choice, never this document's.\n */\n\n/** The 27 federative units. */\nexport type Uf =\n | \"AC\" | \"AL\" | \"AM\" | \"AP\" | \"BA\" | \"CE\" | \"DF\" | \"ES\" | \"GO\" | \"MA\" | \"MG\" | \"MS\" | \"MT\" | \"PA\"\n | \"PB\" | \"PE\" | \"PI\" | \"PR\" | \"RJ\" | \"RN\" | \"RO\" | \"RR\" | \"RS\" | \"SC\" | \"SE\" | \"SP\" | \"TO\";\n\n/** A postal address. `postalCode` is required on the issuer's. */\nexport interface Address {\n readonly street: string;\n readonly number: string;\n readonly complement: string | null;\n readonly district: string;\n /** The 7-digit IBGE municipality code. */\n readonly municipalityIbge: string;\n readonly municipalityName: string;\n readonly uf: Uf;\n /** CEP, 8 digits. */\n readonly postalCode: string | null;\n readonly phone: string | null;\n}\n\n/** The issuer's tax regime on the document (`CRT` 1, 2, 3, 4). */\nexport type IssuerTaxRegime = \"SIMPLES\" | \"SIMPLES_EXCESS\" | \"NORMAL\" | \"MEI\";\n\nexport interface DocumentIssuer {\n /** 14 characters; the 2026 alphanumeric CNPJ is accepted. */\n readonly cnpj: string;\n /** IE digits, or `ISENTO`. */\n readonly stateRegistration: string;\n readonly legalName: string;\n readonly tradeName: string | null;\n readonly taxRegime: IssuerTaxRegime;\n readonly address: Address & { readonly postalCode: string };\n}\n\nexport type BuyerDocument =\n | { readonly kind: \"CPF\"; readonly number: string }\n | { readonly kind: \"CNPJ\"; readonly number: string }\n | { readonly kind: \"FOREIGN\"; readonly number: string };\n\n/** `indIEDest` 1, 2, 9. */\nexport type StateRegistrationStatus = \"CONTRIBUTOR\" | \"EXEMPT\" | \"NON_CONTRIBUTOR\";\n\nexport interface DocumentBuyer {\n readonly document: BuyerDocument;\n readonly name: string | null;\n readonly stateRegistrationStatus: StateRegistrationStatus;\n readonly stateRegistration: string | null;\n readonly email: string | null;\n readonly address: Address | null;\n}\n\n/** The goods' origin (`orig`), 0–8. */\nexport type GoodsOrigin = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;\n\n/** ICMS of a Simples Nacional issuer, without a credit. */\nexport interface IcmsSimples {\n readonly regime: \"SIMPLES\";\n readonly origin: GoodsOrigin;\n readonly csosn: \"102\" | \"103\" | \"300\" | \"400\" | \"500\";\n}\n\n/** ICMS of a Simples Nacional issuer that grants the buyer a credit (CSOSN 101). */\nexport interface IcmsSimplesWithCredit {\n readonly regime: \"SIMPLES\";\n readonly origin: GoodsOrigin;\n readonly csosn: \"101\";\n readonly creditRateBp: number;\n readonly creditCents: number;\n}\n\n/** ICMS fully taxed (CST 00). */\nexport interface IcmsTaxed {\n readonly regime: \"NORMAL\";\n readonly origin: GoodsOrigin;\n readonly cst: \"00\";\n readonly baseCents: number;\n readonly rateBp: number;\n readonly amountCents: number;\n}\n\n/** ICMS exempt, not taxed, suspended (40, 41, 50) or collected before by substitution (60). */\nexport interface IcmsUntaxed {\n readonly regime: \"NORMAL\";\n readonly origin: GoodsOrigin;\n readonly cst: \"40\" | \"41\" | \"50\" | \"60\";\n}\n\nexport type LineIcms = IcmsSimples | IcmsSimplesWithCredit | IcmsTaxed | IcmsUntaxed;\n\n/** The PIS and COFINS situation codes the layout accepts on an outgoing document. */\nexport type ContributionCst =\n | \"01\" | \"02\" | \"04\" | \"05\" | \"06\" | \"07\" | \"08\" | \"09\" | \"49\" | \"50\" | \"51\" | \"52\" | \"53\" | \"54\"\n | \"55\" | \"56\" | \"60\" | \"61\" | \"62\" | \"63\" | \"64\" | \"65\" | \"66\" | \"67\" | \"70\" | \"71\" | \"72\" | \"73\"\n | \"74\" | \"75\" | \"98\" | \"99\";\n\n/**\n * PIS or COFINS. CST 01/02 write the base, the rate and the amount; 04–09\n * write none (send zeros); 49–99 write all three.\n */\nexport interface LineContribution {\n readonly cst: ContributionCst;\n readonly baseCents: number;\n readonly rateBp: number;\n readonly amountCents: number;\n}\n\n/**\n * The IBS/CBS figures of one line — what the engine's `LineTax` carries:\n * `vBC` and, per tax, the NOMINAL rate and the amount. `reductionBp` applies\n * to all three rates (`pRedAliq`; the effective rate is written beside it).\n */\nexport interface IbsCbsFigures {\n readonly baseCents: number;\n readonly reductionBp: number;\n readonly cbsRateBp: number;\n readonly cbsCents: number;\n readonly ibsUfRateBp: number;\n readonly ibsUfCents: number;\n readonly ibsMunRateBp: number;\n readonly ibsMunCents: number;\n}\n\n/** The IBS/CBS group of a line. `figures: null` writes the CST and class only (immunity, say). */\nexport interface LineIbsCbs {\n /** `CST` of the IBS/CBS, 3 digits. */\n readonly cst: string;\n /** `cClassTrib`, 6 digits. */\n readonly classCode: string;\n readonly figures: IbsCbsFigures | null;\n}\n\n/** One item of the document. */\nexport interface SaleLine {\n /** The host's id; quoted back in a mapping error. */\n readonly id: string;\n /** `cProd`. */\n readonly code: string;\n /** GTIN/EAN, or `null` for \"SEM GTIN\". */\n readonly gtin: string | null;\n readonly description: string;\n readonly ncm: string;\n readonly cest: string | null;\n readonly cfop: string;\n /** `uCom` and `uTrib`. */\n readonly unit: string;\n /** `qCom` and `qTrib`: positive, at most four decimals. */\n readonly quantity: number;\n /** `vProd`: every unit, BEFORE the line's discount. The unit value is derived. */\n readonly valueCents: number;\n /** `vDesc`. */\n readonly discountCents: number;\n /** `vTotTrib` (the approximate tax of the transparency law), or `null`. */\n readonly approximateTaxCents: number | null;\n /** `infAdProd`. */\n readonly additionalInfo: string | null;\n readonly icms: LineIcms;\n readonly pis: LineContribution;\n readonly cofins: LineContribution;\n /** `null` writes no IBS/CBS group — a regime the engine answered `NONE` for. */\n readonly ibsCbs: LineIbsCbs | null;\n}\n\n/** `tPag`. */\nexport type PaymentMethod =\n | \"CASH\"\n | \"CHECK\"\n | \"CREDIT_CARD\"\n | \"DEBIT_CARD\"\n | \"STORE_CREDIT\"\n | \"FOOD_VOUCHER\"\n | \"MEAL_VOUCHER\"\n | \"GIFT_VOUCHER\"\n | \"FUEL_VOUCHER\"\n | \"BANK_SLIP\"\n | \"BANK_DEPOSIT\"\n | \"PIX_DYNAMIC\"\n | \"TRANSFER\"\n | \"LOYALTY\"\n | \"PIX_STATIC\"\n | \"NO_PAYMENT\"\n | \"OTHER\";\n\nexport interface CardDetails {\n /** `tpIntegra`: whether the payment went through an integrated terminal. */\n readonly integrated: boolean;\n readonly acquirerCnpj: string | null;\n /** `tBand`, 2 digits. */\n readonly brand: string | null;\n /** `cAut`. */\n readonly authorizationCode: string | null;\n}\n\n/**\n * `tpMeioPgto` (Informe Técnico 2026.001 v1.01): the means a linked payment\n * transaction moved by — 15 boleto, 17 Pix QR dinâmico, 18 TED, 20 Pix by key\n * or static QR, 23 Pix automático, 24 TEF. A card and cash have none.\n */\nexport const PAYMENT_LINK_MEANS = [\"15\", \"17\", \"18\", \"20\", \"23\", \"24\"] as const;\nexport type PaymentLinkMeans = (typeof PAYMENT_LINK_MEANS)[number];\n\n/**\n * `gPgtoVinc/gPgto` (NT 2026.006 v1.00): a payment transaction started before\n * the document — a Pix QR raised, a boleto generated — linked by its id, so the\n * split payment can find the document. The event 110300 links one after the fact.\n */\nexport interface LinkedTransaction {\n /** `idTransacao`, 2–35 characters: the Pix txid, the boleto's or the transfer's id. */\n readonly transactionId: string;\n readonly meansCode: PaymentLinkMeans;\n /** `CNPJBasePSP`: the 8-character CNPJ base of the receiver's payment institution. */\n readonly pspCnpjBase: string;\n /** `CNPJReceb`: who receives the money (the issuer, or a platform receiving for it). */\n readonly receiverCnpj: string;\n}\n\nexport interface SalePayment {\n readonly method: PaymentMethod;\n readonly amountCents: number;\n /** Required by the layout for a card and for a Pix; `null` otherwise. */\n readonly card: CardDetails | null;\n /** `xPag`: required when `method` is `OTHER`. */\n readonly description: string | null;\n /**\n * The transaction this payment was started as, written in `gPgtoVinc` with\n * `nPag` = its position. Absent or `null`: no link. The host decides whether\n * the environment accepts the group (optional in the layout; its production\n * activation is the fisco's).\n */\n readonly linkedTransaction?: LinkedTransaction | null;\n}\n\n/** `finNFe` 1–4. */\nexport type DocumentPurpose = \"NORMAL\" | \"COMPLEMENTARY\" | \"ADJUSTMENT\" | \"RETURN\";\n/**\n * `tpNF`: `OUT` (1) a sale or any outgoing document; `IN` (0) an entry, such as\n * a buyer's goods coming back. An NFC-e is always `OUT`.\n */\nexport type DocumentOperation = \"OUT\" | \"IN\";\n/** `NFref/refNFe`: an earlier NF-e or NFC-e this document refers to. */\nexport interface ReferencedDocument {\n /** The 44-character access key (`isValidAccessKey` in `@12-apps/fiscal/documents`). */\n readonly accessKey: string;\n}\n/** `idDest` 1–3. */\nexport type OperationDestination = \"INTERNAL\" | \"INTERSTATE\" | \"FOREIGN\";\n/** `indPres` 1, 2, 3, 4, 5, 9. */\nexport type BuyerPresence =\n | \"IN_PERSON\"\n | \"INTERNET\"\n | \"TELEPHONE\"\n | \"HOME_DELIVERY\"\n | \"IN_PERSON_OFF_PREMISES\"\n | \"OTHER\";\n/** `modFrete` 0, 1, 2, 3, 4, 9. */\nexport type FreightMode =\n | \"BY_ISSUER\"\n | \"BY_RECIPIENT\"\n | \"BY_THIRD_PARTY\"\n | \"OWN_BY_ISSUER\"\n | \"OWN_BY_RECIPIENT\"\n | \"NONE\";\n\n/** `infIntermed`: the third-party platform the sale went through. */\nexport interface SaleIntermediary {\n readonly cnpj: string;\n /** `idCadIntTran`: the seller's id on that platform. */\n readonly userId: string;\n}\n\n/** `infRespTec`: the software house responsible for the issuing system. */\nexport interface TechnicalResponsible {\n readonly cnpj: string;\n readonly contactName: string;\n readonly email: string;\n readonly phone: string;\n}\n\n/** One sale, ready to become an NF-e or an NFC-e. */\nexport interface SaleForDocument {\n readonly version: 1;\n /** `serie`, 0–999. */\n readonly series: number;\n /** `nNF`, 1–999999999. The package's counter owns it. */\n readonly number: number;\n /**\n * `cNF`: the 8-digit code inside the access key. The caller draws it ONCE and\n * keeps it with the document, so a retried call yields the same key.\n */\n readonly keyCode: string;\n /** `dhEmi`: ISO 8601 with the UTC offset, `2026-11-20T12:30:00-03:00`. */\n readonly issuedAt: string;\n /** `natOp`. */\n readonly operationNature: string;\n readonly purpose: DocumentPurpose;\n /**\n * `tpNF`. Absent is `OUT`. A buyer's return is an NF-e (model 55) with\n * `purpose: \"RETURN\"` and `operation: \"IN\"`; an NFC-e has neither.\n */\n readonly operation?: DocumentOperation;\n /**\n * `NFref`, at most 500, in order. Absent is none. A `RETURN` quotes the\n * document it returns here, or it is refused (`RETURN_NEEDS_REFERENCE`); an\n * NFC-e quotes none (SEFAZ 708). For a buyer's return the host sets CFOP\n * 1202 (within the state) or 2202 (between states) on every line, and a\n * single `NO_PAYMENT` payment; the package checks neither.\n */\n readonly referencedDocuments?: readonly ReferencedDocument[];\n readonly destination: OperationDestination;\n readonly presence: BuyerPresence;\n /** `indFinal`. */\n readonly finalConsumer: boolean;\n readonly intermediary: SaleIntermediary | null;\n readonly issuer: DocumentIssuer;\n /** `null` on an NFC-e with no identified buyer. */\n readonly buyer: DocumentBuyer | null;\n /** 1–990 items. */\n readonly lines: readonly SaleLine[];\n readonly freight: FreightMode;\n /** 1–100 payments. */\n readonly payments: readonly SalePayment[];\n /** `vTroco`. */\n readonly changeCents: number;\n readonly additionalInfo: {\n /** `infCpl`. */\n readonly forTaxpayer: string | null;\n /** `infAdFisco`. */\n readonly forTaxAuthority: string | null;\n };\n readonly technicalResponsible: TechnicalResponsible | null;\n}\n"],"mappings":";;;AAuNO,IAAM,qBAAqB,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { IssuerTaxRegime, Address } from './sale/index.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { f as DocumentPolicy, S as SigningIdentityKind, g as FiscalDocumentsConfig, C as Cipher, h as ContingencyGap, E as EmitterProfile, I as IssuingPoint, i as ContingencyBlock, j as SaleDraft, k as ContingencyBlockFate, l as ContingencyBlockState } from './context-Cyvfr2YB.js';
|
|
2
|
+
import { F as FiscalDocumentModel, d as IssuerFailure, i as FiscalDocument, j as CancelOrReturnInput, k as CancelOrReturnResult, l as FiscalDocumentEvent } from './types-Sk010Em2.js';
|
|
3
|
+
import { IssuerTaxRegime, Address, LinkedTransaction } from './sale/index.js';
|
|
4
|
+
import { T as TaxRegime } from './types-BLdkww6G.js';
|
|
5
|
+
import { l as SefazEnvironment, i as LookedUpDocument } from './types-Z5E14EPw.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Reading the emitter profile and the certificate upload off a request body:
|
|
@@ -72,6 +72,56 @@ interface FiscalDocumentsServiceConfig extends FiscalDocumentsConfig {
|
|
|
72
72
|
readonly readCertificate: (certificate: CertificateUpload) => Promise<CertificateFacts>;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The gap pass over contingency blocks (FUT-4717): every block read in keyset
|
|
77
|
+
* pages to the end (a block that never settles — an OPEN one, an ABANDONED
|
|
78
|
+
* one with an unknown rest — must not hide the ones reserved after it), its
|
|
79
|
+
* KNOWN unused ranges voided at SEFAZ once, its UNKNOWN ones only reported.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
interface GapVoidReport {
|
|
83
|
+
readonly voided: ReadonlyArray<ContingencyGap & {
|
|
84
|
+
readonly protocol: string | null;
|
|
85
|
+
}>;
|
|
86
|
+
readonly failures: ReadonlyArray<ContingencyGap & {
|
|
87
|
+
readonly class: string;
|
|
88
|
+
readonly code: string | null;
|
|
89
|
+
readonly message: string;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The event 110300 "Vinculação Pagamento" (NT 2026.006 v1.00 §5.1): a payment
|
|
95
|
+
* transaction linked to an authorised document after the fact — a Pix QR whose
|
|
96
|
+
* txid was learnt only once the note was out, say. One event per transaction
|
|
97
|
+
* (the event's single `gPgto`), numbered per document (`nSeqEvento`).
|
|
98
|
+
*
|
|
99
|
+
* Idempotent per `(document, transactionId)`: a transaction the document
|
|
100
|
+
* already carries in its own `gPgtoVinc`, or already linked by an earlier
|
|
101
|
+
* event, is skipped with no call to SEFAZ. A refusal answers the issuer's
|
|
102
|
+
* failure and records nothing; the caller may ask again. `nSeqEvento` is the
|
|
103
|
+
* next after the document's own recorded events; a 573 at it is settled by the
|
|
104
|
+
* event SEFAZ holds there (its XML kept, its transaction recorded as its own),
|
|
105
|
+
* and the payment is then sent at the next sequence.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/** `nSeqEvento` runs 1–20 per event type and document. */
|
|
109
|
+
declare const MAX_PAYMENT_LINKS = 20;
|
|
110
|
+
interface LinkPaymentInput {
|
|
111
|
+
readonly ownerId: string;
|
|
112
|
+
readonly documentId: string;
|
|
113
|
+
readonly payments: readonly LinkedTransaction[];
|
|
114
|
+
}
|
|
115
|
+
interface LinkPaymentResult {
|
|
116
|
+
/** The transaction ids SEFAZ registered in this call. */
|
|
117
|
+
readonly linked: readonly string[];
|
|
118
|
+
/** Those the document already carried or an earlier event linked: nothing was sent. */
|
|
119
|
+
readonly alreadyLinked: readonly string[];
|
|
120
|
+
/** The first refusal, if any; the transactions after it were not sent. */
|
|
121
|
+
readonly failure: IssuerFailure | null;
|
|
122
|
+
readonly document: FiscalDocument;
|
|
123
|
+
}
|
|
124
|
+
|
|
75
125
|
interface SweepReport {
|
|
76
126
|
readonly advanced: Array<{
|
|
77
127
|
readonly documentId: string;
|
|
@@ -127,6 +177,8 @@ declare function createFiscalDocuments(config: FiscalDocumentsServiceConfig): {
|
|
|
127
177
|
* (501) — issue the buyer's return NF-e of entry quoting it. Idempotent.
|
|
128
178
|
*/
|
|
129
179
|
cancelOrReturn: (input: CancelOrReturnInput) => Promise<CancelOrReturnResult>;
|
|
180
|
+
/** Link payment transactions to an authorised document (event 110300), once each. Idempotent. */
|
|
181
|
+
linkPayment: (input: LinkPaymentInput) => Promise<LinkPaymentResult>;
|
|
130
182
|
/** Ask SEFAZ what it knows of the key; a state the answer moves is recorded. */
|
|
131
183
|
lookup: (input: {
|
|
132
184
|
ownerId: string;
|
|
@@ -146,9 +198,50 @@ declare function createFiscalDocuments(config: FiscalDocumentsServiceConfig): {
|
|
|
146
198
|
listEvents(ownerId: string, documentId: string): Promise<FiscalDocumentEvent[]>;
|
|
147
199
|
/** One pass of the retry sweep: PENDING/SUBMITTED documents and owed numbers whose next attempt has come. */
|
|
148
200
|
sweep: (limit: number) => Promise<SweepReport>;
|
|
201
|
+
/** Contingency blocks (FUT-4717), the ContingencyBlockSource; `NOT_SUPPORTED` over a store without them. */
|
|
202
|
+
reserveBlock: (input: {
|
|
203
|
+
readonly ownerId: string;
|
|
204
|
+
readonly issuingPointId: string;
|
|
205
|
+
readonly holder: string;
|
|
206
|
+
readonly size?: number;
|
|
207
|
+
}) => Promise<ContingencyBlock>;
|
|
208
|
+
recordSigned: (input: {
|
|
209
|
+
readonly ownerId: string;
|
|
210
|
+
readonly subjectId: string;
|
|
211
|
+
readonly signedXml: string;
|
|
212
|
+
readonly holder: string;
|
|
213
|
+
readonly sale?: SaleDraft;
|
|
214
|
+
}) => Promise<FiscalDocument>;
|
|
215
|
+
closeBlock: (input: {
|
|
216
|
+
readonly ownerId: string;
|
|
217
|
+
readonly holder: string;
|
|
218
|
+
readonly series: number;
|
|
219
|
+
readonly from: number;
|
|
220
|
+
readonly sequenceUsed: number;
|
|
221
|
+
}) => Promise<ContingencyBlock>;
|
|
222
|
+
abandonBlocks: (input: {
|
|
223
|
+
ownerId: string;
|
|
224
|
+
holder: string;
|
|
225
|
+
}) => Promise<ContingencyBlock[]>;
|
|
226
|
+
listBlocks: (input: {
|
|
227
|
+
ownerId: string;
|
|
228
|
+
holder?: string;
|
|
229
|
+
fates?: readonly ContingencyBlockFate[];
|
|
230
|
+
}) => Promise<ContingencyBlockState[]>;
|
|
231
|
+
listKnownGaps: (input: {
|
|
232
|
+
before: string;
|
|
233
|
+
ownerId?: string;
|
|
234
|
+
}) => Promise<ContingencyGap[]>;
|
|
235
|
+
listUnknownRanges: (input: {
|
|
236
|
+
ownerId?: string;
|
|
237
|
+
}) => Promise<ContingencyGap[]>;
|
|
238
|
+
voidKnownGaps: (input: {
|
|
239
|
+
before: string;
|
|
240
|
+
ownerId?: string;
|
|
241
|
+
}) => Promise<GapVoidReport>;
|
|
149
242
|
/** One pass of the contingency transmission, then the 20-hour deadline warnings. */
|
|
150
243
|
transmitContingency(limit: number): Promise<SweepReport>;
|
|
151
244
|
};
|
|
152
245
|
type FiscalDocuments = ReturnType<typeof createFiscalDocuments>;
|
|
153
246
|
|
|
154
|
-
export { CONTINGENCY_WARNING_AFTER_MS as C, type EmitterProfileInput as E, type FiscalDocuments as F, type IssueInput as I, LATE_CANCEL_CODES as L, type SweepReport as S, type CertificateFacts as a, type CertificateUpload as b, type FiscalDocumentsServiceConfig as c, type IssuingPointInput as d,
|
|
247
|
+
export { CONTINGENCY_WARNING_AFTER_MS as C, type EmitterProfileInput as E, type FiscalDocuments as F, type GapVoidReport as G, type IssueInput as I, LATE_CANCEL_CODES as L, MAX_PAYMENT_LINKS as M, type SweepReport as S, type CertificateFacts as a, type CertificateUpload as b, type FiscalDocumentsServiceConfig as c, type IssuingPointInput as d, type LinkPaymentInput as e, type LinkPaymentResult as f, createFiscalDocuments as g, parseIssuingPointInput as h, parseProfileInput as i, parseCertificateUpload as p };
|