@12-apps/fiscal 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,4 +11,4 @@ var SIDECAR_ERROR_CLASSES = [
11
11
  export {
12
12
  SIDECAR_ERROR_CLASSES
13
13
  };
14
- //# sourceMappingURL=chunk-ZKWVKCGJ.js.map
14
+ //# sourceMappingURL=chunk-P5EDTNWE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sidecar/types.ts"],"sourcesContent":["/**\n * The wire contract of the fiscal service (`sidecar/` in this package): a\n * stateless HTTP door in front of sped-nfe. JSON in, JSON out.\n *\n * Stateless means every call carries what it needs: the signing certificate\n * (an A1 `.pfx` as base64 and its password) and, for an NFC-e, the CSC. The\n * service keeps nothing between calls, writes nothing to disk and never logs\n * any of the three.\n */\n\nimport type { SaleForDocument } from \"../sale/types\";\n\n/** The path segment of a document model: `nfe` is model 55, `nfce` model 65. */\nexport type DocumentModelPath = \"nfe\" | \"nfce\";\n\n/** The SEFAZ environment (`tpAmb` 2 and 1). */\nexport type SefazEnvironment = \"homologacao\" | \"producao\";\n\n/** The A1 certificate, per call. */\nexport interface SigningCertificate {\n /** The `.pfx` (PKCS#12) bytes, base64. */\n readonly pfxBase64: string;\n readonly password: string;\n}\n\n/** The NFC-e's Código de Segurança do Contribuinte and its id. */\nexport interface Csc {\n readonly id: string;\n readonly token: string;\n}\n\ninterface Authenticated {\n readonly environment: SefazEnvironment;\n readonly certificate: SigningCertificate;\n}\n\n/**\n * `POST /<model>/issue`: builds, signs and transmits. `csc` is required for\n * `nfce` and refused for `nfe`.\n */\nexport interface IssueRequest extends Authenticated {\n readonly csc: Csc | null;\n readonly document: SaleForDocument;\n}\n\n/** Why and since when the caixa issues offline (`dhCont`, `xJust`). */\nexport interface ContingencyEntry {\n /** ISO 8601 with the UTC offset. */\n readonly since: string;\n /** 15–256 characters. */\n readonly reason: string;\n}\n\n/** `POST /nfce/sign-contingency`: builds and signs with `tpEmis = 9`; does NOT transmit. */\nexport interface SignContingencyRequest extends IssueRequest {\n readonly contingency: ContingencyEntry;\n}\n\n/** `POST /<model>/transmit`: an already signed XML (from `/nfce/sign-contingency`, say). */\nexport interface TransmitRequest extends Authenticated {\n readonly signedXml: string;\n}\n\n/** `POST /<model>/cancel`: the UF and the issuer come from the access key. */\nexport interface CancelRequest extends Authenticated {\n readonly accessKey: string;\n /** The authorisation protocol (`nProt`). */\n readonly protocol: string;\n /** 15–255 characters. */\n readonly reason: string;\n}\n\n/**\n * `POST /nfce/cancel-substitution`: the NFC-e \"cancelamento por substituição\"\n * (event 110112) — an online NFC-e found authorised after its sale was issued\n * again in contingency, cancelled naming the substitute. Answers as `/cancel`.\n */\nexport interface CancelBySubstitutionRequest extends CancelRequest {\n /** The contingency document that replaced it (`chNFeRef`). */\n readonly substituteAccessKey: string;\n}\n\n/** `POST /<model>/link-payment`: the event 110300 for one transaction (NT 2026.006 v1.00). */\nexport interface LinkPaymentRequest extends Authenticated {\n readonly accessKey: string;\n /** The authorisation protocol (`nProt`). */\n readonly protocol: string;\n /** `nSeqEvento`, 1–20: this document's how-manieth 110300. */\n readonly sequence: number;\n /** Exactly one entry: the event's schema carries a single `gPgto`. */\n readonly payments: ReadonlyArray<{\n readonly transactionId: string;\n readonly meansCode: string;\n readonly pspCnpjBase: string;\n readonly receiverCnpj: string;\n }>;\n}\n\n/** `POST /<model>/lookup`. */\nexport interface LookupRequest extends Authenticated {\n readonly accessKey: string;\n}\n\n/** `POST /inutilize`: voids a range of unused numbers. */\nexport interface InutilizeRequest extends Authenticated {\n readonly model: DocumentModelPath;\n readonly uf: string;\n readonly cnpj: string;\n /** The year of the numbers, four digits. */\n readonly year: number;\n readonly series: number;\n readonly from: number;\n readonly to: number;\n /** 15–255 characters. */\n readonly reason: string;\n}\n\n/** What SEFAZ answered, as the service read it. */\nexport interface SefazAnswer {\n /** `cStat`. */\n readonly statusCode: string;\n /** `xMotivo`. */\n readonly statusReason: string;\n /** The SOAP body SEFAZ returned, verbatim. */\n readonly sefazReply: string;\n}\n\n/**\n * `/issue` and `/transmit`: SEFAZ's final answer on the document.\n *\n * - `AUTHORIZED` (100, 120, 150).\n * - `DENIED` (110, 301, 302, 303): a denial of use. The number is SPENT and\n * the denial is kept like an authorisation (its `authorizedXml` carries the\n * denial protocol); it is not a rejection, which leaves the number free.\n *\n * A retried call answers the same: SEFAZ's \"already authorised\" (204) and\n * \"already denied\" (205), and a request sent with no answer, are settled by\n * looking the key up, so a retry never turns an authorised document into an error.\n */\nexport interface IssuedDocument extends SefazAnswer {\n readonly status: \"AUTHORIZED\" | \"DENIED\";\n readonly accessKey: string;\n readonly protocol: string;\n /** `dhRecbto` of the protocol. */\n readonly authorizedAt: string;\n readonly signedXml: string;\n /** The `nfeProc`: the signed XML with its protocol (of authorisation or of denial), what is stored. */\n readonly authorizedXml: string;\n}\n\n/** `/nfce/sign-contingency`. */\nexport interface ContingencySignedDocument {\n readonly status: \"SIGNED\";\n readonly accessKey: string;\n /** Carries `tpEmis = 9` and the QR code; transmit it later through `/nfce/transmit`. */\n readonly signedXml: string;\n}\n\n/**\n * `/cancel`. A retried cancel (SEFAZ's 218 \"already cancelled\" or 573\n * \"duplicate event\", or a cancel sent with no answer) is settled by looking\n * the key up, and answers CANCELLED with what the lookup carries: the event's\n * protocol and XML when SEFAZ returns them, `null` when it does not.\n */\nexport interface CancelledDocument extends SefazAnswer {\n readonly status: \"CANCELLED\";\n readonly accessKey: string;\n /** The event's protocol. */\n readonly protocol: string | null;\n readonly registeredAt: string | null;\n /** The `procEventoNFe`. */\n readonly eventXml: string | null;\n}\n\n/**\n * `/link-payment`: the event registered. On 573 \"Duplicidade de Evento\" the\n * service looks the key up and answers the event SEFAZ already holds at that\n * `nSeqEvento`, with its own XML and the transaction it carries — which may be\n * another transaction than the one sent (`statusCode` \"573\" tells the two apart).\n */\nexport interface RegisteredPaymentLink extends SefazAnswer {\n readonly status: \"REGISTERED\";\n readonly accessKey: string;\n readonly protocol: string | null;\n readonly registeredAt: string | null;\n /** The `procEventoNFe`. */\n readonly eventXml: string | null;\n /** The `gPgto` SEFAZ registered at this `nSeqEvento`. */\n readonly transaction: {\n readonly transactionId: string;\n readonly meansCode: string;\n readonly pspCnpjBase: string;\n readonly receiverCnpj: string;\n };\n}\n\n/** `/lookup`: what SEFAZ knows of the key. `NOT_FOUND` is an answer, not an error. */\nexport interface LookedUpDocument extends SefazAnswer {\n readonly status: \"AUTHORIZED\" | \"CANCELLED\" | \"DENIED\" | \"NOT_FOUND\";\n readonly accessKey: string;\n readonly protocol: string | null;\n}\n\n/**\n * `/inutilize`. A retried inutilização (563, \"a request for the same range\n * already exists\") answers INUTILIZED too, with `protocol` and\n * `inutilizationXml` `null`: the range is void at SEFAZ, and SEFAZ offers no\n * query that would return the first protocol.\n */\nexport interface InutilizedRange extends SefazAnswer {\n readonly status: \"INUTILIZED\";\n readonly protocol: string | null;\n readonly registeredAt: string | null;\n /** The signed request with its reply (`procInutNFe`). */\n readonly inutilizationXml: string | null;\n}\n\n/**\n * How a failed call is classified — the issuer port's own classes:\n *\n * - `REJECTED`: SEFAZ refused the document or the event; `code` is its `cStat`.\n * The number is NOT spent (a denial is not an error: it answers `DENIED`).\n * - `RETRYABLE`: try the same call again later. When `outcomeUnknown` is true\n * the request went out and neither it nor the lookup that would settle it\n * was answered: look the key up before sending it again.\n * - `CONTINGENCY`: SEFAZ is unavailable. For an NFC-e being issued, nothing\n * reached SEFAZ (or the lookup after an unanswered request could not reach\n * it): go offline through `/nfce/sign-contingency`. For an NF-e (model 55)\n * the service has no offline path (no SVC, no EPEC): treat it as RETRYABLE.\n * - `AUTH`: the certificate is unreadable, the password wrong, the certificate\n * expired, or SEFAZ refused it.\n * - `INVALID`: the request itself is malformed (the schema, a missing CSC, an\n * XML the layout refuses, a document the layout version cannot express).\n * Fix the input; never retry it as is.\n * - `INTERNAL`: a defect of the service, or a 4xx other than 403/408/429 from\n * the verified SEFAZ host (a wrong web-service address). A retry would only repeat it.\n */\nexport type SidecarErrorClass = \"REJECTED\" | \"RETRYABLE\" | \"CONTINGENCY\" | \"AUTH\" | \"INVALID\" | \"INTERNAL\";\n\nexport const SIDECAR_ERROR_CLASSES: readonly SidecarErrorClass[] = [\n \"REJECTED\",\n \"RETRYABLE\",\n \"CONTINGENCY\",\n \"AUTH\",\n \"INVALID\",\n \"INTERNAL\",\n];\n\n/** The body of every non-2xx answer. */\nexport interface SidecarErrorBody {\n readonly error: {\n readonly class: SidecarErrorClass;\n /**\n * The SEFAZ `cStat` when SEFAZ answered (always for `REJECTED`); for\n * `INVALID`, a named code where one applies (`NT_2026_008_NOT_SUPPORTED`:\n * a document issued on or after 2027-01-01, which needs NT 2026.008's\n * `vProdLiq`; `RETURN_ON_NFCE`: a return asked of an NFC-e, which has no\n * return purpose; `RETURN_NEEDS_REFERENCE`: a return quoting no\n * `referencedDocuments`); `null` otherwise.\n */\n readonly code: string | null;\n readonly message: string;\n /** Per-field problems of an `INVALID` request. */\n readonly details: readonly string[];\n /** When the call got as far as building and signing: keep it, the key is now spoken for. */\n readonly accessKey: string | null;\n readonly signedXml: string | null;\n readonly sefazReply: string | null;\n /** The request went out and its outcome is still unknown: look the key up before sending it again. */\n readonly outcomeUnknown: boolean;\n };\n}\n\n/** `GET /health`. */\nexport interface SidecarHealth {\n readonly status: \"ok\";\n /** The libraries the service runs, by name, with the version installed. */\n readonly libraries: Readonly<Record<string, string>>;\n /** The schema package the NF-e layout is validated against. */\n readonly nfeSchemas: string;\n /** Whether SEFAZ's server certificate is verified; `false` only with `FISCAL_SEFAZ_TLS_VERIFY=off`. */\n readonly sefazTlsVerify: boolean;\n}\n"],"mappings":";AA+OO,IAAM,wBAAsD;AAAA,EACjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/sidecar/types.ts"],"sourcesContent":["/**\n * The wire contract of the fiscal service (`sidecar/` in this package): a\n * stateless HTTP door in front of sped-nfe. JSON in, JSON out.\n *\n * Stateless means every call carries what it needs: the signing certificate\n * (an A1 `.pfx` as base64 and its password) and, for an NFC-e, the CSC. The\n * service keeps nothing between calls, writes nothing to disk and never logs\n * any of the three.\n */\n\nimport type { SaleForDocument } from \"../sale/types\";\n\n/** The path segment of a document model: `nfe` is model 55, `nfce` model 65. */\nexport type DocumentModelPath = \"nfe\" | \"nfce\";\n\n/** The SEFAZ environment (`tpAmb` 2 and 1). */\nexport type SefazEnvironment = \"homologacao\" | \"producao\";\n\n/** The A1 certificate, per call. */\nexport interface SigningCertificate {\n /** The `.pfx` (PKCS#12) bytes, base64. */\n readonly pfxBase64: string;\n readonly password: string;\n}\n\n/** The NFC-e's Código de Segurança do Contribuinte and its id. */\nexport interface Csc {\n readonly id: string;\n readonly token: string;\n}\n\ninterface Authenticated {\n readonly environment: SefazEnvironment;\n readonly certificate: SigningCertificate;\n}\n\n/**\n * `POST /<model>/issue`: builds, signs and transmits. `csc` is required for\n * `nfce` and refused for `nfe`.\n */\nexport interface IssueRequest extends Authenticated {\n readonly csc: Csc | null;\n readonly document: SaleForDocument;\n}\n\n/** Why and since when the caixa issues offline (`dhCont`, `xJust`). */\nexport interface ContingencyEntry {\n /** ISO 8601 with the UTC offset. */\n readonly since: string;\n /** 15–256 characters. */\n readonly reason: string;\n}\n\n/** `POST /nfce/sign-contingency`: builds and signs with `tpEmis = 9`; does NOT transmit. */\nexport interface SignContingencyRequest extends IssueRequest {\n readonly contingency: ContingencyEntry;\n}\n\n/** `POST /<model>/transmit`: an already signed XML (from `/nfce/sign-contingency`, say). */\nexport interface TransmitRequest extends Authenticated {\n readonly signedXml: string;\n}\n\n/** `POST /<model>/cancel`: the UF and the issuer come from the access key. */\nexport interface CancelRequest extends Authenticated {\n readonly accessKey: string;\n /** The authorisation protocol (`nProt`). */\n readonly protocol: string;\n /** 15–255 characters. */\n readonly reason: string;\n}\n\n/**\n * `POST /nfce/cancel-substitution`: the NFC-e \"cancelamento por substituição\"\n * (event 110112) — an online NFC-e found authorised after its sale was issued\n * again in contingency, cancelled naming the substitute. Answers as `/cancel`.\n */\nexport interface CancelBySubstitutionRequest extends CancelRequest {\n /** The contingency document that replaced it (`chNFeRef`). */\n readonly substituteAccessKey: string;\n}\n\n/** `POST /<model>/link-payment`: the event 110300 for one transaction (NT 2026.006 v1.00). */\nexport interface LinkPaymentRequest extends Authenticated {\n readonly accessKey: string;\n /** The authorisation protocol (`nProt`). */\n readonly protocol: string;\n /** `nSeqEvento`, 1–20: this document's how-manieth 110300. */\n readonly sequence: number;\n /** Exactly one entry: the event's schema carries a single `gPgto`. */\n readonly payments: ReadonlyArray<{\n readonly transactionId: string;\n readonly meansCode: string;\n readonly pspCnpjBase: string;\n readonly receiverCnpj: string;\n }>;\n}\n\n/** `POST /<model>/lookup`. */\nexport interface LookupRequest extends Authenticated {\n readonly accessKey: string;\n}\n\n/** `POST /inutilize`: voids a range of unused numbers. */\nexport interface InutilizeRequest extends Authenticated {\n readonly model: DocumentModelPath;\n readonly uf: string;\n readonly cnpj: string;\n /** The year of the numbers, four digits. */\n readonly year: number;\n readonly series: number;\n readonly from: number;\n readonly to: number;\n /** 15–255 characters. */\n readonly reason: string;\n}\n\n/** What SEFAZ answered, as the service read it. */\nexport interface SefazAnswer {\n /** `cStat`. */\n readonly statusCode: string;\n /** `xMotivo`. */\n readonly statusReason: string;\n /** The SOAP body SEFAZ returned, verbatim. */\n readonly sefazReply: string;\n}\n\n/**\n * `/issue` and `/transmit`: SEFAZ's final answer on the document.\n *\n * - `AUTHORIZED` (100, 120, 150).\n * - `DENIED` (110, 301, 302, 303): a denial of use. The number is SPENT and\n * the denial is kept like an authorisation (its `authorizedXml` carries the\n * denial protocol); it is not a rejection, which leaves the number free.\n *\n * A retried call answers the same: SEFAZ's \"already authorised\" (204) and\n * \"already denied\" (205), and a request sent with no answer, are settled by\n * looking the key up, so a retry never turns an authorised document into an error.\n */\nexport interface IssuedDocument extends SefazAnswer {\n readonly status: \"AUTHORIZED\" | \"DENIED\";\n readonly accessKey: string;\n readonly protocol: string;\n /** `dhRecbto` of the protocol. */\n readonly authorizedAt: string;\n readonly signedXml: string;\n /** The `nfeProc`: the signed XML with its protocol (of authorisation or of denial), what is stored. */\n readonly authorizedXml: string;\n}\n\n/** `/nfce/sign-contingency`. */\nexport interface ContingencySignedDocument {\n readonly status: \"SIGNED\";\n readonly accessKey: string;\n /** Carries `tpEmis = 9` and the QR code; transmit it later through `/nfce/transmit`. */\n readonly signedXml: string;\n}\n\n/**\n * `/cancel`. A retried cancel (SEFAZ's 218 \"already cancelled\" or 573\n * \"duplicate event\", or a cancel sent with no answer) is settled by looking\n * the key up, and answers CANCELLED with what the lookup carries: the event's\n * protocol and XML when SEFAZ returns them, `null` when it does not.\n */\nexport interface CancelledDocument extends SefazAnswer {\n readonly status: \"CANCELLED\";\n readonly accessKey: string;\n /** The event's protocol. */\n readonly protocol: string | null;\n readonly registeredAt: string | null;\n /** The `procEventoNFe`. */\n readonly eventXml: string | null;\n}\n\n/**\n * `/link-payment`: the event registered. On 573 \"Duplicidade de Evento\" the\n * service looks the key up and answers the event SEFAZ already holds at that\n * `nSeqEvento`, with its own XML and the transaction it carries — which may be\n * another transaction than the one sent (`statusCode` \"573\" tells the two apart).\n */\nexport interface RegisteredPaymentLink extends SefazAnswer {\n readonly status: \"REGISTERED\";\n readonly accessKey: string;\n readonly protocol: string | null;\n readonly registeredAt: string | null;\n /** The `procEventoNFe`. */\n readonly eventXml: string | null;\n /** The `gPgto` SEFAZ registered at this `nSeqEvento`. */\n readonly transaction: {\n readonly transactionId: string;\n readonly meansCode: string;\n readonly pspCnpjBase: string;\n readonly receiverCnpj: string;\n };\n}\n\n/** `/lookup`: what SEFAZ knows of the key. `NOT_FOUND` is an answer, not an error. */\nexport interface LookedUpDocument extends SefazAnswer {\n readonly status: \"AUTHORIZED\" | \"CANCELLED\" | \"DENIED\" | \"NOT_FOUND\";\n readonly accessKey: string;\n readonly protocol: string | null;\n}\n\n/**\n * `/inutilize`. A retried inutilização (563, \"a request for the same range\n * already exists\") answers INUTILIZED too, with `protocol` and\n * `inutilizationXml` `null`: the range is void at SEFAZ, and SEFAZ offers no\n * query that would return the first protocol.\n */\nexport interface InutilizedRange extends SefazAnswer {\n readonly status: \"INUTILIZED\";\n readonly protocol: string | null;\n readonly registeredAt: string | null;\n /** The signed request with its reply (`procInutNFe`). */\n readonly inutilizationXml: string | null;\n}\n\n/**\n * How a failed call is classified — the issuer port's own classes:\n *\n * - `REJECTED`: SEFAZ refused the document or the event; `code` is its `cStat`.\n * The number is NOT spent (a denial is not an error: it answers `DENIED`).\n * - `RETRYABLE`: try the same call again later. When `outcomeUnknown` is true\n * the request went out and neither it nor the lookup that would settle it\n * was answered: look the key up before sending it again.\n * - `CONTINGENCY`: SEFAZ is unavailable. For an NFC-e being issued, nothing\n * reached SEFAZ (or the lookup after an unanswered request could not reach\n * it): go offline through `/nfce/sign-contingency`. For an NF-e (model 55)\n * the service has no offline path (no SVC, no EPEC): treat it as RETRYABLE.\n * - `AUTH`: the certificate is unreadable, the password wrong, the certificate\n * expired, or SEFAZ refused it.\n * - `INVALID`: the request itself is malformed (the schema, a missing CSC, an\n * XML the layout refuses, a document the layout version cannot express).\n * Fix the input; never retry it as is.\n * - `INTERNAL`: a defect of the service, or a 4xx other than 403/408/429 from\n * the verified SEFAZ host (a wrong web-service address). A retry would only repeat it.\n */\nexport type SidecarErrorClass = \"REJECTED\" | \"RETRYABLE\" | \"CONTINGENCY\" | \"AUTH\" | \"INVALID\" | \"INTERNAL\";\n\nexport const SIDECAR_ERROR_CLASSES: readonly SidecarErrorClass[] = [\n \"REJECTED\",\n \"RETRYABLE\",\n \"CONTINGENCY\",\n \"AUTH\",\n \"INVALID\",\n \"INTERNAL\",\n];\n\n/** The body of every non-2xx answer. */\nexport interface SidecarErrorBody {\n readonly error: {\n readonly class: SidecarErrorClass;\n /**\n * The SEFAZ `cStat` when SEFAZ answered (always for `REJECTED`); for\n * `INVALID`, a named code where one applies (`RETURN_ON_NFCE`: a return asked of an NFC-e, which has no\n * return purpose; `RETURN_NEEDS_REFERENCE`: a return quoting no\n * `referencedDocuments`); `null` otherwise.\n */\n readonly code: string | null;\n readonly message: string;\n /** Per-field problems of an `INVALID` request. */\n readonly details: readonly string[];\n /** When the call got as far as building and signing: keep it, the key is now spoken for. */\n readonly accessKey: string | null;\n readonly signedXml: string | null;\n readonly sefazReply: string | null;\n /** The request went out and its outcome is still unknown: look the key up before sending it again. */\n readonly outcomeUnknown: boolean;\n };\n}\n\n/** `GET /health`. */\nexport interface SidecarHealth {\n readonly status: \"ok\";\n /** The libraries the service runs, by name, with the version installed. */\n readonly libraries: Readonly<Record<string, string>>;\n /** The schema package the NF-e layout is validated against. */\n readonly nfeSchemas: string;\n /** Whether SEFAZ's server certificate is verified; `false` only with `FISCAL_SEFAZ_TLS_VERIFY=off`. */\n readonly sefazTlsVerify: boolean;\n}\n"],"mappings":";AA+OO,IAAM,wBAAsD;AAAA,EACjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
- import { F as FiscalDocumentModel, D as DocumentTotals, n as DocumentEventKind, h as FiscalDocumentStatus, i as FiscalDocument, l as FiscalDocumentEvent, o as SeriesKind, g as SigningMaterial, I as Issuer } from './types-Sk010Em2.js';
1
+ import { F as FiscalDocumentModel, D as DocumentTotals, n as DocumentEventKind, h as FiscalDocumentStatus, i as FiscalDocument, l as FiscalDocumentEvent, o as SeriesKind, g as SigningMaterial, I as Issuer } from './types-6OiBrmZy.js';
2
2
  import { IssuerTaxRegime, Address, SaleForDocument, LinkedTransaction } from './sale/index.js';
3
- import { l as SefazEnvironment, h as IssuedDocument, m as SidecarErrorBody, d as ContingencySignedDocument, c as ContingencyEntry, b as CancelledDocument, i as LookedUpDocument, f as InutilizedRange, R as RegisteredPaymentLink } from './types-Z5E14EPw.js';
3
+ import { l as SefazEnvironment, h as IssuedDocument, m as SidecarErrorBody, d as ContingencySignedDocument, c as ContingencyEntry, b as CancelledDocument, i as LookedUpDocument, f as InutilizedRange, R as RegisteredPaymentLink } from './types-BbTxBzsv.js';
4
4
  import { T as TaxRegime } from './types-BLdkww6G.js';
5
5
 
6
6
  /**
@@ -1,9 +1,9 @@
1
- import { F as FiscalDocumentModel, o as SeriesKind, i as FiscalDocument, l as FiscalDocumentEvent } from '../types-Sk010Em2.js';
2
- export { j as CancelOrReturnInput, k as CancelOrReturnResult, n as DocumentEventKind, D as DocumentTotals, p as FISCAL_DOCUMENT_MODELS, q as FISCAL_DOCUMENT_STATUSES, h as FiscalDocumentStatus, N as NumberVoid, O as OWED_VOIDS, r as isLive } from '../types-Sk010Em2.js';
3
- import { j as SaleDraft, N as NumberRange, l as ContingencyBlockState, F as FiscalStore, m as ContingencyBlockStore, i as ContingencyBlock } from '../context-Cyvfr2YB.js';
4
- export { n as CONTINGENCY_BLOCK_FATES, C as Cipher, k as ContingencyBlockFate, o as ContingencyBlockSource, h as ContingencyGap, p as DOCUMENT_POLICIES, q as DOCUMENT_TRANSITIONS, r as DocumentInput, f as DocumentPolicy, D as DocumentStorage, E as EmitterProfile, s as EmitterProfileView, t as FINAL_STATUSES, b as FISCAL_CERTIFICATE_EXPIRING, c as FISCAL_CONTINGENCY_DEADLINE, d as FISCAL_DOCUMENT_NEEDS_ATTENTION, e as FISCAL_DOCUMENT_REJECTED, g as FiscalDocumentsConfig, a as FiscalNotifyPort, u as FiscalReasons, I as IssuingPoint, M as MAX_FAILURES, v as NumberRequest, w as SIGNING_IDENTITY_KINDS, x as SaleSource, y as SigningIdentities, z as SigningIdentity, S as SigningIdentityKind, T as Transition, A as canTransition, B as createPlatformIdentity, G as createSigningIdentities, H as createStoreCertificateIdentity, J as scrubSecrets, K as transition, L as viewOf } from '../context-Cyvfr2YB.js';
5
- import { l as SefazEnvironment } from '../types-Z5E14EPw.js';
6
- export { C as CONTINGENCY_WARNING_AFTER_MS, a as CertificateFacts, b as CertificateUpload, E as EmitterProfileInput, F as FiscalDocuments, c as FiscalDocumentsServiceConfig, G as GapVoidReport, I as IssueInput, d as IssuingPointInput, L as LATE_CANCEL_CODES, e as LinkPaymentInput, f as LinkPaymentResult, M as MAX_PAYMENT_LINKS, S as SweepReport, g as createFiscalDocuments, p as parseCertificateUpload, h as parseIssuingPointInput, i as parseProfileInput } from '../service-BCK9aXop.js';
1
+ import { F as FiscalDocumentModel, o as SeriesKind, i as FiscalDocument, l as FiscalDocumentEvent } from '../types-6OiBrmZy.js';
2
+ export { j as CancelOrReturnInput, k as CancelOrReturnResult, n as DocumentEventKind, D as DocumentTotals, p as FISCAL_DOCUMENT_MODELS, q as FISCAL_DOCUMENT_STATUSES, h as FiscalDocumentStatus, N as NumberVoid, O as OWED_VOIDS, r as isLive } from '../types-6OiBrmZy.js';
3
+ import { j as SaleDraft, N as NumberRange, l as ContingencyBlockState, F as FiscalStore, m as ContingencyBlockStore, i as ContingencyBlock } from '../context-D71ETH--.js';
4
+ export { n as CONTINGENCY_BLOCK_FATES, C as Cipher, k as ContingencyBlockFate, o as ContingencyBlockSource, h as ContingencyGap, p as DOCUMENT_POLICIES, q as DOCUMENT_TRANSITIONS, r as DocumentInput, f as DocumentPolicy, D as DocumentStorage, E as EmitterProfile, s as EmitterProfileView, t as FINAL_STATUSES, b as FISCAL_CERTIFICATE_EXPIRING, c as FISCAL_CONTINGENCY_DEADLINE, d as FISCAL_DOCUMENT_NEEDS_ATTENTION, e as FISCAL_DOCUMENT_REJECTED, g as FiscalDocumentsConfig, a as FiscalNotifyPort, u as FiscalReasons, I as IssuingPoint, M as MAX_FAILURES, v as NumberRequest, w as SIGNING_IDENTITY_KINDS, x as SaleSource, y as SigningIdentities, z as SigningIdentity, S as SigningIdentityKind, T as Transition, A as canTransition, B as createPlatformIdentity, G as createSigningIdentities, H as createStoreCertificateIdentity, J as scrubSecrets, K as transition, L as viewOf } from '../context-D71ETH--.js';
5
+ import { l as SefazEnvironment } from '../types-BbTxBzsv.js';
6
+ export { C as CONTINGENCY_WARNING_AFTER_MS, a as CertificateFacts, b as CertificateUpload, E as EmitterProfileInput, F as FiscalDocuments, c as FiscalDocumentsServiceConfig, G as GapVoidReport, I as IssueInput, d as IssuingPointInput, L as LATE_CANCEL_CODES, e as LinkPaymentInput, f as LinkPaymentResult, M as MAX_PAYMENT_LINKS, S as SweepReport, g as createFiscalDocuments, p as parseCertificateUpload, h as parseIssuingPointInput, i as parseProfileInput } from '../service-DyA64Jc6.js';
7
7
  import { b as TaxBreakdown } from '../types-BLdkww6G.js';
8
8
  import { SaleForDocument, SaleLine } from '../sale/index.js';
9
9
 
@@ -293,7 +293,10 @@ declare const FISCAL_NEXT_NUMBER_SQL = "UPDATE \"fiscal_number_counters\"\nSET \
293
293
  * taxed item under the class the host passed;
294
294
  * - the IBS/CBS group from the line's figures (`vBC`, the nominal rates, the
295
295
  * reduction, the amounts), or no group at all where the engine answered
296
- * `NONE` (MEI, não contribuinte).
296
+ * `NONE` (MEI, não contribuinte);
297
+ * - the net value (`vProdLiq`, NT 2026.008) where the period puts the tax
298
+ * inside the price (from 2027), and no key at all where it does not, so a
299
+ * 2026 document is the one it was before the field existed.
297
300
  *
298
301
  * What the engine does not know — the product code, NCM, CFOP, unit, the
299
302
  * ICMS, PIS and COFINS — arrives per line id from the host. A breakdown line
@@ -301,7 +304,7 @@ declare const FISCAL_NEXT_NUMBER_SQL = "UPDATE \"fiscal_number_counters\"\nSET \
301
304
  */
302
305
 
303
306
  /** Everything a document line needs that the breakdown does not carry. */
304
- type LineDetails = Omit<SaleLine, "id" | "quantity" | "valueCents" | "ibsCbs">;
307
+ type LineDetails = Omit<SaleLine, "id" | "quantity" | "valueCents" | "netValueCents" | "ibsCbs">;
305
308
  declare function documentLines(breakdown: TaxBreakdown, details: Readonly<Record<string, LineDetails>>): SaleLine[];
306
309
 
307
310
  export { type BlockAccount, ContingencyBlock, ContingencyBlockState, ContingencyBlockStore, DEFAULT_CONTINGENCY_BLOCK_SIZE, FISCAL_NEXT_NUMBER_SQL, FISCAL_RESERVE_BLOCK_SQL, FiscalDocument, FiscalDocumentError, type FiscalDocumentErrorCode, FiscalDocumentEvent, FiscalDocumentModel, type FiscalPrismaClient, type FiscalSqlClient, FiscalStore, type LineDetails, MAX_CONTINGENCY_BLOCK_SIZE, type MemoryFiscalStore, NumberRange, SaleDraft, SeriesKind, type SignedContingencyNote, accountFor as accountForContingencyBlock, computeAccessKey, createMemoryFiscalStore, createPrismaFiscalStore, documentLines, draftOf, drawKeyCode, isValidAccessKey, localIso, parseSignedContingencyNote, xmlKeys };
@@ -2176,6 +2176,7 @@ function documentLines(breakdown, details) {
2176
2176
  id: line.lineId,
2177
2177
  quantity: line.quantity,
2178
2178
  valueCents: line.valueCents,
2179
+ ...line.netValueCents === null ? {} : { netValueCents: line.netValueCents },
2179
2180
  ibsCbs: ibsCbsOf(line, breakdown)
2180
2181
  };
2181
2182
  });