@12-apps/fiscal 1.5.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-HMTPJWXM.js → chunk-2JVTHJAU.js} +2 -2
- package/dist/{chunk-3E3NBXSW.js → chunk-CEK2GDRY.js} +5 -3
- package/dist/chunk-CEK2GDRY.js.map +1 -0
- package/dist/{chunk-MGTROA7K.js → chunk-OAQSGDZ7.js} +11 -7
- package/dist/chunk-OAQSGDZ7.js.map +1 -0
- package/dist/{chunk-G6QNU4FD.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-TJCUO6D6.js → chunk-YHSO3476.js} +6 -5
- package/dist/chunk-YHSO3476.js.map +1 -0
- package/dist/{context-CwZiHLnY.d.ts → context-Cyvfr2YB.d.ts} +155 -19
- package/dist/danfe/index.d.ts +7 -0
- package/dist/danfe/index.js +2 -2
- package/dist/documents/index.d.ts +152 -34
- package/dist/documents/index.js +1103 -305
- 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 +4 -4
- package/dist/issuer/index.d.ts +10 -3
- package/dist/issuer/index.js +18 -3
- package/dist/issuer/index.js.map +1 -1
- package/dist/jobs.d.ts +5 -5
- package/dist/jobs.js +3 -3
- 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 +6 -6
- package/dist/notifications.d.ts +4 -4
- package/dist/notifications.js +2 -2
- package/dist/{service-Cz2O84Xr.d.ts → service-BCK9aXop.d.ts} +64 -5
- package/dist/sidecar/index.d.ts +38 -249
- package/dist/sidecar/index.js +29 -1
- package/dist/sidecar/index.js.map +1 -1
- package/dist/{types-B1b8LIWX.d.ts → types-BLdkww6G.d.ts} +1 -1
- package/dist/{types-DSYwap42.d.ts → types-Sk010Em2.d.ts} +2 -2
- package/dist/types-Z5E14EPw.d.ts +254 -0
- package/package.json +2 -1
- package/prisma/fiscal.prisma +50 -1
- package/prisma/migrations/20261118180000_fiscal_contingency_blocks/migration.sql +64 -0
- package/sidecar/README.md +52 -1
- package/sidecar/bin/check-platform.php +29 -0
- package/sidecar/extensions.json +12 -0
- package/sidecar/src/Http/Request.php +6 -1
- package/sidecar/src/Kernel.php +39 -1
- 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 +3 -0
- package/src/documents/index.ts +23 -1
- package/src/documents/memory-blocks.ts +118 -0
- package/src/documents/memory.ts +6 -2
- package/src/documents/ports.ts +163 -13
- package/src/documents/service.ts +10 -0
- package/src/documents/sql-blocks.ts +202 -0
- package/src/documents/sql-store.ts +4 -3
- package/src/http.ts +1 -0
- package/src/issuer/sidecar.ts +27 -3
- package/src/manifest/index.ts +6 -4
- package/src/sidecar/index.ts +2 -0
- package/src/sidecar/platform.ts +55 -0
- package/dist/chunk-3E3NBXSW.js.map +0 -1
- package/dist/chunk-MGTROA7K.js.map +0 -1
- package/dist/chunk-TJCUO6D6.js.map +0 -1
- /package/dist/{chunk-HMTPJWXM.js.map → chunk-2JVTHJAU.js.map} +0 -0
- /package/dist/{chunk-G6QNU4FD.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
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 LinkPaymentCall, f as LookupCall, S as SignContingencyCall, g as SigningMaterial, T as TransmitCall, m as modelPath } from '../types-
|
|
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
|
@@ -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);
|
|
@@ -123,7 +138,7 @@ function createSidecarIssuer(config) {
|
|
|
123
138
|
async health() {
|
|
124
139
|
const response = await config.fetch(`${base}/health`, {
|
|
125
140
|
method: "GET",
|
|
126
|
-
headers: { accept: "application/json" },
|
|
141
|
+
headers: headersOf(config, { accept: "application/json" }),
|
|
127
142
|
signal: AbortSignal.timeout(config.timeoutMs)
|
|
128
143
|
});
|
|
129
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 { 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\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 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: { 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;;;AClFhB,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,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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,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;AAUT,SAAS,UAAU,QAA6B,MAAsD;AACpG,SAAO,OAAO,UAAU,SAAY,OAAO,EAAE,GAAG,MAAM,eAAe,UAAU,OAAO,KAAK,GAAG;AAChG;AAFS;AAIT,eAAe,KAAQ,QAA6B,MAAc,MAAc,MAA0C;AACxH,MAAI;AACJ,MAAI;AACJ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;AAAA,MACA;AAAA,IACF,CAAuC,GARnB;AAAA,IAStB,aAAa,wBAAC,EAAE,OAAO,aAAa,SAAS,WAAW,UAAU,UAAU,SAAS,MACnF,KAAK,IAAI,UAAU,KAAK,CAAC,iBAAiB;AAAA,MACxC;AAAA,MACA,aAAa,QAAQ;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAA8B,GARnB;AAAA,IASb,QAAQ,wBAAC,EAAE,OAAO,aAAa,SAAS,UAAU,MAChD,KAAK,IAAI,UAAU,KAAK,CAAC,WAAW,EAAE,aAAa,aAAa,QAAQ,aAAa,UAAU,CAAyB,GADlH;AAAA,IAER,WAAW,wBAAC,EAAE,OAAO,aAAa,SAAS,IAAI,MAAM,MAAM,QAAQ,MAAM,IAAI,OAAO,MAClF,KAAK,cAAc;AAAA,MACjB;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,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-
|
|
8
|
+
} from "./chunk-P7CRGZGO.js";
|
|
9
|
+
import "./chunk-CEK2GDRY.js";
|
|
10
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-
|
|
9
|
+
} from "../chunk-P7CRGZGO.js";
|
|
10
|
+
import "../chunk-CEK2GDRY.js";
|
|
11
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, h as FiscalDocumentStatus, N as NumberVoid } from './types-
|
|
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-
|
|
6
|
+
} from "./chunk-CEK2GDRY.js";
|
|
7
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";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
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';
|
|
2
3
|
import { IssuerTaxRegime, Address, LinkedTransaction } from './sale/index.js';
|
|
3
|
-
import { T as TaxRegime } from './types-
|
|
4
|
-
import { SefazEnvironment, LookedUpDocument } from './
|
|
5
|
-
import { f as DocumentPolicy, S as SigningIdentityKind, g as FiscalDocumentsConfig, C as Cipher, E as EmitterProfile, I as IssuingPoint } from './context-CwZiHLnY.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,24 @@ 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
|
+
|
|
75
93
|
/**
|
|
76
94
|
* The event 110300 "Vinculação Pagamento" (NT 2026.006 v1.00 §5.1): a payment
|
|
77
95
|
* transaction linked to an authorised document after the fact — a Pix QR whose
|
|
@@ -180,9 +198,50 @@ declare function createFiscalDocuments(config: FiscalDocumentsServiceConfig): {
|
|
|
180
198
|
listEvents(ownerId: string, documentId: string): Promise<FiscalDocumentEvent[]>;
|
|
181
199
|
/** One pass of the retry sweep: PENDING/SUBMITTED documents and owed numbers whose next attempt has come. */
|
|
182
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>;
|
|
183
242
|
/** One pass of the contingency transmission, then the 20-hour deadline warnings. */
|
|
184
243
|
transmitContingency(limit: number): Promise<SweepReport>;
|
|
185
244
|
};
|
|
186
245
|
type FiscalDocuments = ReturnType<typeof createFiscalDocuments>;
|
|
187
246
|
|
|
188
|
-
export { CONTINGENCY_WARNING_AFTER_MS as C, type EmitterProfileInput as E, type FiscalDocuments as F, 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 };
|
|
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 };
|