@12-apps/fiscal 0.0.0-stage → 1.1.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.
Files changed (155) hide show
  1. package/README.md +269 -2
  2. package/dist/chunk-27B4HNO6.js +574 -0
  3. package/dist/chunk-27B4HNO6.js.map +1 -0
  4. package/dist/chunk-3SDXLSG4.js +24 -0
  5. package/dist/chunk-3SDXLSG4.js.map +1 -0
  6. package/dist/chunk-7QVYU63E.js +7 -0
  7. package/dist/chunk-7QVYU63E.js.map +1 -0
  8. package/dist/chunk-ALABGVPO.js +247 -0
  9. package/dist/chunk-ALABGVPO.js.map +1 -0
  10. package/dist/chunk-FOFIN5M7.js +14 -0
  11. package/dist/chunk-FOFIN5M7.js.map +1 -0
  12. package/dist/chunk-HQ2NXSTX.js +85 -0
  13. package/dist/chunk-HQ2NXSTX.js.map +1 -0
  14. package/dist/chunk-PNTKG3DZ.js +47 -0
  15. package/dist/chunk-PNTKG3DZ.js.map +1 -0
  16. package/dist/chunk-RRFKYVLZ.js +192 -0
  17. package/dist/chunk-RRFKYVLZ.js.map +1 -0
  18. package/dist/chunk-V5ZQAAJT.js +210 -0
  19. package/dist/chunk-V5ZQAAJT.js.map +1 -0
  20. package/dist/chunk-X6MRDUYH.js +21 -0
  21. package/dist/chunk-X6MRDUYH.js.map +1 -0
  22. package/dist/chunk-XQGW5HUG.js +30 -0
  23. package/dist/chunk-XQGW5HUG.js.map +1 -0
  24. package/dist/context-ChnWR4Kb.d.ts +455 -0
  25. package/dist/danfe/en-US.d.ts +12 -0
  26. package/dist/danfe/en-US.js +51 -0
  27. package/dist/danfe/en-US.js.map +1 -0
  28. package/dist/danfe/index.d.ts +50 -0
  29. package/dist/danfe/index.js +18 -0
  30. package/dist/danfe/index.js.map +1 -0
  31. package/dist/danfe/pt-BR.d.ts +11 -0
  32. package/dist/danfe/pt-BR.js +51 -0
  33. package/dist/danfe/pt-BR.js.map +1 -0
  34. package/dist/documents/index.d.ts +169 -0
  35. package/dist/documents/index.js +1228 -0
  36. package/dist/documents/index.js.map +1 -0
  37. package/dist/engine/index.d.ts +118 -0
  38. package/dist/engine/index.js +591 -0
  39. package/dist/engine/index.js.map +1 -0
  40. package/dist/http.d.ts +73 -0
  41. package/dist/http.js +16 -0
  42. package/dist/http.js.map +1 -0
  43. package/dist/issuer/index.d.ts +43 -0
  44. package/dist/issuer/index.js +131 -0
  45. package/dist/issuer/index.js.map +1 -0
  46. package/dist/jobs.d.ts +74 -0
  47. package/dist/jobs.js +22 -0
  48. package/dist/jobs.js.map +1 -0
  49. package/dist/labels-BNvflT0h.d.ts +44 -0
  50. package/dist/manifest/index.d.ts +97 -0
  51. package/dist/manifest/index.js +27 -0
  52. package/dist/manifest/index.js.map +1 -0
  53. package/dist/manifest/server.d.ts +57 -0
  54. package/dist/manifest/server.js +25 -0
  55. package/dist/manifest/server.js.map +1 -0
  56. package/dist/notifications.d.ts +93 -0
  57. package/dist/notifications.js +41 -0
  58. package/dist/notifications.js.map +1 -0
  59. package/dist/port-DpRFK56U.d.ts +238 -0
  60. package/dist/sale/index.d.ts +243 -0
  61. package/dist/sale/index.js +1 -0
  62. package/dist/sale/index.js.map +1 -0
  63. package/dist/service-KTjH7AxW.d.ts +139 -0
  64. package/dist/sidecar/index.d.ts +216 -0
  65. package/dist/sidecar/index.js +8 -0
  66. package/dist/sidecar/index.js.map +1 -0
  67. package/dist/types-B1b8LIWX.d.ts +247 -0
  68. package/package.json +126 -4
  69. package/prisma/fiscal.prisma +158 -0
  70. package/prisma/migrations/20261113220000_fiscal_documents/migration.sql +201 -0
  71. package/sidecar/.dockerignore +5 -0
  72. package/sidecar/Dockerfile +68 -0
  73. package/sidecar/README.md +149 -0
  74. package/sidecar/composer.json +30 -0
  75. package/sidecar/composer.lock +2224 -0
  76. package/sidecar/docker/apache.conf +14 -0
  77. package/sidecar/docker/icp-brasil.pem +8031 -0
  78. package/sidecar/docker/mpm.conf +17 -0
  79. package/sidecar/docker/openssl.cnf +16 -0
  80. package/sidecar/docker/php.ini +19 -0
  81. package/sidecar/public/index.php +15 -0
  82. package/sidecar/schema/sale-for-document.schema.json +401 -0
  83. package/sidecar/src/ErrorClass.php +31 -0
  84. package/sidecar/src/Http/Request.php +48 -0
  85. package/sidecar/src/Http/Response.php +32 -0
  86. package/sidecar/src/Http/Router.php +59 -0
  87. package/sidecar/src/Kernel.php +99 -0
  88. package/sidecar/src/Module.php +31 -0
  89. package/sidecar/src/Nfe/Classifier.php +89 -0
  90. package/sidecar/src/Nfe/Credentials.php +52 -0
  91. package/sidecar/src/Nfe/DocumentMapper.php +383 -0
  92. package/sidecar/src/Nfe/DocumentSchema.php +39 -0
  93. package/sidecar/src/Nfe/Input.php +125 -0
  94. package/sidecar/src/Nfe/Model.php +17 -0
  95. package/sidecar/src/Nfe/NfeModule.php +62 -0
  96. package/sidecar/src/Nfe/NfeService.php +504 -0
  97. package/sidecar/src/Nfe/Sefaz.php +49 -0
  98. package/sidecar/src/Nfe/SefazReply.php +81 -0
  99. package/sidecar/src/Nfe/Transport/CurlTransport.php +198 -0
  100. package/sidecar/src/Nfe/Transport/SoapAdapter.php +57 -0
  101. package/sidecar/src/Nfe/Transport/Transport.php +20 -0
  102. package/sidecar/src/Nfe/Transport/TransportFailure.php +42 -0
  103. package/sidecar/src/RequestLog.php +54 -0
  104. package/sidecar/src/ServiceError.php +69 -0
  105. package/src/danfe/en-US.ts +53 -0
  106. package/src/danfe/index.ts +11 -0
  107. package/src/danfe/labels.ts +49 -0
  108. package/src/danfe/pt-BR.ts +52 -0
  109. package/src/danfe/render.ts +265 -0
  110. package/src/danfe/xml.ts +45 -0
  111. package/src/documents/context.ts +260 -0
  112. package/src/documents/errors.ts +41 -0
  113. package/src/documents/helpers.ts +128 -0
  114. package/src/documents/index.ts +39 -0
  115. package/src/documents/lines.ts +63 -0
  116. package/src/documents/machine-steps.ts +260 -0
  117. package/src/documents/machine.ts +128 -0
  118. package/src/documents/memory.ts +138 -0
  119. package/src/documents/nfe-proc.ts +51 -0
  120. package/src/documents/ports.ts +130 -0
  121. package/src/documents/profile-input.ts +168 -0
  122. package/src/documents/profile.ts +98 -0
  123. package/src/documents/service-profile.ts +104 -0
  124. package/src/documents/service.ts +296 -0
  125. package/src/documents/settle.ts +121 -0
  126. package/src/documents/signing.ts +61 -0
  127. package/src/documents/sql-rows.ts +180 -0
  128. package/src/documents/sql-store.ts +242 -0
  129. package/src/documents/sql.ts +18 -0
  130. package/src/documents/steps.ts +173 -0
  131. package/src/documents/tests/integration/pglite.ts +73 -0
  132. package/src/documents/types.ts +193 -0
  133. package/src/engine/compare.ts +68 -0
  134. package/src/engine/compute.ts +40 -0
  135. package/src/engine/errors.ts +28 -0
  136. package/src/engine/index.ts +20 -0
  137. package/src/engine/oracle.ts +81 -0
  138. package/src/engine/plan.ts +268 -0
  139. package/src/engine/rounding.ts +81 -0
  140. package/src/engine/types.ts +270 -0
  141. package/src/engine/validate.ts +222 -0
  142. package/src/http.ts +264 -0
  143. package/src/issuer/index.ts +9 -0
  144. package/src/issuer/port.ts +109 -0
  145. package/src/issuer/sidecar.ts +171 -0
  146. package/src/jobs.ts +115 -0
  147. package/src/manifest/index.ts +46 -0
  148. package/src/manifest/permissions.ts +28 -0
  149. package/src/manifest/server.ts +20 -0
  150. package/src/notifications.ts +120 -0
  151. package/src/sale/index.ts +8 -0
  152. package/src/sale/types.ts +292 -0
  153. package/src/sidecar/index.ts +9 -0
  154. package/src/sidecar/types.ts +243 -0
  155. package/tables/ibs-cbs-2026-11-13.json +156 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The package's permissions, declared HERE and nowhere else (the owner's
3
+ * decision on FUT-2237): a host composes them into its RBAC catalog and
4
+ * decides which roles hold them. The ids are mechanism; the words a picker
5
+ * shows are the host's, so no `labels` ship.
6
+ */
7
+ /** See the fiscal settings and the documents issued. */
8
+ declare const FISCAL_READ = "fiscal:read";
9
+ /** Edit the emitter profile and its certificate. */
10
+ declare const FISCAL_MANAGE = "fiscal:manage";
11
+ /** Issue a fiscal document. */
12
+ declare const FISCAL_ISSUE = "fiscal:issue";
13
+ /** Cancel an issued fiscal document. */
14
+ declare const FISCAL_CANCEL = "fiscal:cancel";
15
+ declare const FISCAL_PERMISSIONS: {
16
+ readonly source: "@12-apps/fiscal";
17
+ readonly ids: readonly ["fiscal:read", "fiscal:manage", "fiscal:issue", "fiscal:cancel"];
18
+ readonly permissions: {
19
+ readonly "fiscal:read": {
20
+ readonly kind: "class";
21
+ };
22
+ readonly "fiscal:manage": {
23
+ readonly kind: "class";
24
+ };
25
+ readonly "fiscal:issue": {
26
+ readonly kind: "class";
27
+ };
28
+ readonly "fiscal:cancel": {
29
+ readonly kind: "class";
30
+ };
31
+ };
32
+ };
33
+
34
+ /**
35
+ * `@12-apps/fiscal/manifest` — the SHARED wiring manifest.
36
+ *
37
+ * - `permissions` — `fiscal:read`, `fiscal:manage`, `fiscal:issue`,
38
+ * `fiscal:cancel`, declared here and nowhere else; every route in
39
+ * `../http` names the one it needs.
40
+ * - `db` — the Prisma partial (`prisma/fiscal.prisma`: the emitter profile,
41
+ * issuing points, one number counter per series, documents and their
42
+ * events) and its migrations.
43
+ * - `observability` — `fiscal`: the sweeps log under it.
44
+ * - `server: ["http", "jobs"]` — `./manifest/server`.
45
+ *
46
+ * Narrowings, each argued in `.wiring-conformance.json`:
47
+ *
48
+ * - **No static `notifications`.** The two alerts (certificate expiring,
49
+ * document rejected) are host words, so they ship as the factory
50
+ * `createFiscalNotificationBlueprints(copy)` (`@12-apps/fiscal/notifications`),
51
+ * which the host feeds to its own mount.
52
+ * - **No `web` surface yet.** The fiscal settings screen and the documents
53
+ * list are built with their screen tickets (FUT-2231, FUT-2238) from the
54
+ * owner's approved prototypes, over these routes.
55
+ * - **No NFS-e.** Only the platform's own NFS-e is planned (FUT-2242).
56
+ * - **No register blocks.** An offline register signing on a reserved block of
57
+ * the contingency series, and the voiding of a finished block's known rest,
58
+ * are FUT-4717's; the port is declared (`ContingencyBlockSource`) and not
59
+ * implemented.
60
+ *
61
+ * `@12-apps/wiring` is a TYPE-ONLY dependency: the manifest is a plain
62
+ * `satisfies`-checked value, and the producer's assertions run in this
63
+ * package's own test suite.
64
+ */
65
+
66
+ declare const fiscalManifest: {
67
+ readonly name: "@12-apps/fiscal";
68
+ readonly contract: 1;
69
+ readonly permissions: {
70
+ readonly source: "@12-apps/fiscal";
71
+ readonly ids: readonly ["fiscal:read", "fiscal:manage", "fiscal:issue", "fiscal:cancel"];
72
+ readonly permissions: {
73
+ readonly "fiscal:read": {
74
+ readonly kind: "class";
75
+ };
76
+ readonly "fiscal:manage": {
77
+ readonly kind: "class";
78
+ };
79
+ readonly "fiscal:issue": {
80
+ readonly kind: "class";
81
+ };
82
+ readonly "fiscal:cancel": {
83
+ readonly kind: "class";
84
+ };
85
+ };
86
+ };
87
+ readonly db: {
88
+ readonly partial: "prisma/fiscal.prisma";
89
+ readonly migrations: "prisma/migrations";
90
+ };
91
+ readonly observability: {
92
+ readonly namespace: "fiscal";
93
+ };
94
+ readonly server: readonly ["http", "jobs"];
95
+ };
96
+
97
+ export { FISCAL_CANCEL, FISCAL_ISSUE, FISCAL_MANAGE, FISCAL_PERMISSIONS, FISCAL_READ, fiscalManifest };
@@ -0,0 +1,27 @@
1
+ import {
2
+ FISCAL_CANCEL,
3
+ FISCAL_ISSUE,
4
+ FISCAL_MANAGE,
5
+ FISCAL_PERMISSIONS,
6
+ FISCAL_READ
7
+ } from "../chunk-3SDXLSG4.js";
8
+ import "../chunk-7QVYU63E.js";
9
+
10
+ // src/manifest/index.ts
11
+ var fiscalManifest = {
12
+ name: "@12-apps/fiscal",
13
+ contract: 1,
14
+ permissions: FISCAL_PERMISSIONS,
15
+ db: { partial: "prisma/fiscal.prisma", migrations: "prisma/migrations" },
16
+ observability: { namespace: "fiscal" },
17
+ server: ["http", "jobs"]
18
+ };
19
+ export {
20
+ FISCAL_CANCEL,
21
+ FISCAL_ISSUE,
22
+ FISCAL_MANAGE,
23
+ FISCAL_PERMISSIONS,
24
+ FISCAL_READ,
25
+ fiscalManifest
26
+ };
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 blocks.** An offline register signing on a reserved block of\n * the contingency series, and the voiding of a finished block's known rest,\n * are FUT-4717's; the port is declared (`ContingencyBlockSource`) and not\n * implemented.\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":";;;;;;;;;;AAsCO,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":[]}
@@ -0,0 +1,57 @@
1
+ import * as _12_apps_wiring from '@12-apps/wiring';
2
+ import { FiscalJobDeps } from '../jobs.js';
3
+ import { createApiFiscal } from '../http.js';
4
+ import '../context-ChnWR4Kb.js';
5
+ import '../port-DpRFK56U.js';
6
+ import '../sale/index.js';
7
+ import '../sidecar/index.js';
8
+ import '../types-B1b8LIWX.js';
9
+ import '../service-KTjH7AxW.js';
10
+ import '../labels-BNvflT0h.js';
11
+
12
+ declare const fiscalServerManifest: {
13
+ readonly name: "@12-apps/fiscal";
14
+ readonly http: {
15
+ readonly create: typeof createApiFiscal;
16
+ };
17
+ readonly jobs: {
18
+ namespace: string;
19
+ blueprints: {
20
+ sweep: {
21
+ name: string;
22
+ schedule: {
23
+ pattern: string;
24
+ };
25
+ lease: {
26
+ ttlMs: number;
27
+ };
28
+ attempts: number;
29
+ handle(_payload: never, deps: FiscalJobDeps, context: _12_apps_wiring.WireJobContext): Promise<void>;
30
+ };
31
+ transmitContingency: {
32
+ name: string;
33
+ schedule: {
34
+ pattern: string;
35
+ };
36
+ lease: {
37
+ ttlMs: number;
38
+ };
39
+ attempts: number;
40
+ handle(_payload: never, deps: FiscalJobDeps, context: _12_apps_wiring.WireJobContext): Promise<void>;
41
+ };
42
+ certificateExpiry: {
43
+ name: string;
44
+ schedule: {
45
+ pattern: string;
46
+ };
47
+ lease: {
48
+ ttlMs: number;
49
+ };
50
+ attempts: number;
51
+ handle(_payload: never, deps: FiscalJobDeps, context: _12_apps_wiring.WireJobContext): Promise<void>;
52
+ };
53
+ };
54
+ };
55
+ };
56
+
57
+ export { fiscalServerManifest };
@@ -0,0 +1,25 @@
1
+ import {
2
+ createApiFiscal
3
+ } from "../chunk-V5ZQAAJT.js";
4
+ import "../chunk-ALABGVPO.js";
5
+ import "../chunk-RRFKYVLZ.js";
6
+ import "../chunk-PNTKG3DZ.js";
7
+ import {
8
+ FISCAL_JOBS
9
+ } from "../chunk-HQ2NXSTX.js";
10
+ import "../chunk-27B4HNO6.js";
11
+ import "../chunk-XQGW5HUG.js";
12
+ import "../chunk-3SDXLSG4.js";
13
+ import "../chunk-X6MRDUYH.js";
14
+ import "../chunk-7QVYU63E.js";
15
+
16
+ // src/manifest/server.ts
17
+ var fiscalServerManifest = {
18
+ name: "@12-apps/fiscal",
19
+ http: { create: createApiFiscal },
20
+ jobs: FISCAL_JOBS
21
+ };
22
+ export {
23
+ fiscalServerManifest
24
+ };
25
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/manifest/server.ts"],"sourcesContent":["/**\n * `@12-apps/fiscal/manifest/server` — the server capabilities.\n *\n * `http.create` IS `createApiFiscal` (`../http`): profile, certificate upload,\n * issuing points, issue, cancel, look up and the DANFE, each route declaring\n * the package permission it needs. `jobs` is `FISCAL_JOBS` (`../jobs`): the\n * retry sweep, the contingency transmission and the certificate-expiry\n * warning. A host binds both or declines each in writing.\n */\n\nimport type { AnyServerManifest } from \"@12-apps/wiring\";\n\nimport { createApiFiscal } from \"../http\";\nimport { FISCAL_JOBS } from \"../jobs\";\n\nexport const fiscalServerManifest = {\n name: \"@12-apps/fiscal\",\n http: { create: createApiFiscal },\n jobs: FISCAL_JOBS,\n} as const satisfies AnyServerManifest;\n"],"mappings":";;;;;;;;;;;;;;;;AAeO,IAAM,uBAAuB;AAAA,EAClC,MAAM;AAAA,EACN,MAAM,EAAE,QAAQ,gBAAgB;AAAA,EAChC,MAAM;AACR;","names":[]}
@@ -0,0 +1,93 @@
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-ChnWR4Kb.js';
2
+ import { F as FiscalDocumentModel, g as FiscalDocumentStatus, N as NumberVoid } from './port-DpRFK56U.js';
3
+ import './sale/index.js';
4
+ import './sidecar/index.js';
5
+ import './types-B1b8LIWX.js';
6
+
7
+ /**
8
+ * `@12-apps/fiscal/notifications` — what the package tells people about,
9
+ * as notification blueprints over the HOST's words (the estate's sanctioned
10
+ * shape for a package alert: a factory over copy, never pre-worded here).
11
+ *
12
+ * - `fiscal.certificate-expiring`, emitted by the `certificate-expiry` job to
13
+ * holders of `fiscal:manage`;
14
+ * - `fiscal.document-rejected`, emitted by the document service to holders of
15
+ * `fiscal:issue` when SEFAZ (or the fiscal service) refuses a document;
16
+ * - `fiscal.document-needs-attention`, to holders of `fiscal:issue` when a
17
+ * document stops being retried: a settlement SEFAZ refused (241, 256, 501, a
18
+ * certificate refused) or too many failures in a row;
19
+ * - `fiscal.contingency-deadline`, to holders of `fiscal:issue` when an NFC-e
20
+ * is still offline 20 hours after it was signed (the deadline is 24).
21
+ *
22
+ * Each blueprint is a structural twin of the wiring contract's
23
+ * `WireNotificationBlueprint`; the host feeds them to its notifications mount.
24
+ */
25
+
26
+ interface CertificateExpiringPayload {
27
+ readonly ownerId: string;
28
+ readonly expiresAt: string;
29
+ /** Whole days left; 0 is today, negative is expired. */
30
+ readonly daysLeft: number;
31
+ }
32
+ interface DocumentRejectedPayload {
33
+ readonly documentId: string;
34
+ readonly subjectId: string;
35
+ readonly model: FiscalDocumentModel;
36
+ readonly series: number;
37
+ readonly number: number;
38
+ /** SEFAZ's `cStat`, or the fiscal service's named code. */
39
+ readonly code: string | null;
40
+ /** SEFAZ's own reason, as the service read it. */
41
+ readonly reason: string;
42
+ }
43
+ interface DocumentNeedsAttentionPayload {
44
+ readonly documentId: string;
45
+ readonly subjectId: string;
46
+ readonly model: FiscalDocumentModel;
47
+ readonly status: FiscalDocumentStatus;
48
+ readonly numberVoid: NumberVoid | null;
49
+ readonly series: number;
50
+ readonly number: number;
51
+ readonly code: string | null;
52
+ readonly reason: string;
53
+ readonly failures: number;
54
+ }
55
+ interface ContingencyDeadlinePayload {
56
+ readonly documentId: string;
57
+ readonly subjectId: string;
58
+ readonly series: number;
59
+ readonly number: number;
60
+ /** When it was signed offline, local time with offset. */
61
+ readonly since: string;
62
+ }
63
+ interface FiscalNotificationContent {
64
+ title: string;
65
+ body: string;
66
+ link?: string;
67
+ data?: Readonly<Record<string, unknown>>;
68
+ }
69
+ interface FiscalNotificationContext {
70
+ readonly locale?: string | null;
71
+ }
72
+ /** The host's words for each event, per recipient. */
73
+ interface FiscalNotificationCopy {
74
+ certificateExpiring(payload: CertificateExpiringPayload, context?: FiscalNotificationContext): FiscalNotificationContent;
75
+ documentRejected(payload: DocumentRejectedPayload, context?: FiscalNotificationContext): FiscalNotificationContent;
76
+ documentNeedsAttention(payload: DocumentNeedsAttentionPayload, context?: FiscalNotificationContext): FiscalNotificationContent;
77
+ contingencyDeadline(payload: ContingencyDeadlinePayload, context?: FiscalNotificationContext): FiscalNotificationContent;
78
+ }
79
+ interface FiscalNotificationBlueprint<TPayload> {
80
+ type: string;
81
+ category: string;
82
+ generate(payload: TPayload, context?: FiscalNotificationContext): FiscalNotificationContent;
83
+ }
84
+ /** The suggested preference category; the host's taxonomy decides. */
85
+ declare const FISCAL_NOTIFICATION_CATEGORY = "fiscal";
86
+ declare function createFiscalNotificationBlueprints(copy: FiscalNotificationCopy): readonly [
87
+ FiscalNotificationBlueprint<CertificateExpiringPayload>,
88
+ FiscalNotificationBlueprint<DocumentRejectedPayload>,
89
+ FiscalNotificationBlueprint<DocumentNeedsAttentionPayload>,
90
+ FiscalNotificationBlueprint<ContingencyDeadlinePayload>
91
+ ];
92
+
93
+ export { type CertificateExpiringPayload, type ContingencyDeadlinePayload, type DocumentNeedsAttentionPayload, type DocumentRejectedPayload, FISCAL_NOTIFICATION_CATEGORY, type FiscalNotificationBlueprint, type FiscalNotificationContent, type FiscalNotificationContext, type FiscalNotificationCopy, createFiscalNotificationBlueprints };
@@ -0,0 +1,41 @@
1
+ import {
2
+ FISCAL_CERTIFICATE_EXPIRING,
3
+ FISCAL_CONTINGENCY_DEADLINE,
4
+ FISCAL_DOCUMENT_NEEDS_ATTENTION,
5
+ FISCAL_DOCUMENT_REJECTED
6
+ } from "./chunk-27B4HNO6.js";
7
+ import "./chunk-XQGW5HUG.js";
8
+ import "./chunk-3SDXLSG4.js";
9
+ import "./chunk-X6MRDUYH.js";
10
+ import {
11
+ __name
12
+ } from "./chunk-7QVYU63E.js";
13
+
14
+ // src/notifications.ts
15
+ var FISCAL_NOTIFICATION_CATEGORY = "fiscal";
16
+ var COPY_KEYS = ["certificateExpiring", "documentRejected", "documentNeedsAttention", "contingencyDeadline"];
17
+ function createFiscalNotificationBlueprints(copy) {
18
+ const missing = COPY_KEYS.filter((key) => typeof copy?.[key] !== "function");
19
+ if (missing.length > 0) throw new TypeError(`createFiscalNotificationBlueprints needs ${missing.join(", ")}.`);
20
+ const blueprint = /* @__PURE__ */ __name((type, render) => ({
21
+ type,
22
+ category: FISCAL_NOTIFICATION_CATEGORY,
23
+ generate: /* @__PURE__ */ __name((payload, context) => render(payload, context), "generate")
24
+ }), "blueprint");
25
+ return [
26
+ blueprint(FISCAL_CERTIFICATE_EXPIRING, copy.certificateExpiring),
27
+ blueprint(FISCAL_DOCUMENT_REJECTED, copy.documentRejected),
28
+ blueprint(FISCAL_DOCUMENT_NEEDS_ATTENTION, copy.documentNeedsAttention),
29
+ blueprint(FISCAL_CONTINGENCY_DEADLINE, copy.contingencyDeadline)
30
+ ];
31
+ }
32
+ __name(createFiscalNotificationBlueprints, "createFiscalNotificationBlueprints");
33
+ export {
34
+ FISCAL_CERTIFICATE_EXPIRING,
35
+ FISCAL_CONTINGENCY_DEADLINE,
36
+ FISCAL_DOCUMENT_NEEDS_ATTENTION,
37
+ FISCAL_DOCUMENT_REJECTED,
38
+ FISCAL_NOTIFICATION_CATEGORY,
39
+ createFiscalNotificationBlueprints
40
+ };
41
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/notifications.ts"],"sourcesContent":["/**\n * `@12-apps/fiscal/notifications` — what the package tells people about,\n * as notification blueprints over the HOST's words (the estate's sanctioned\n * shape for a package alert: a factory over copy, never pre-worded here).\n *\n * - `fiscal.certificate-expiring`, emitted by the `certificate-expiry` job to\n * holders of `fiscal:manage`;\n * - `fiscal.document-rejected`, emitted by the document service to holders of\n * `fiscal:issue` when SEFAZ (or the fiscal service) refuses a document;\n * - `fiscal.document-needs-attention`, to holders of `fiscal:issue` when a\n * document stops being retried: a settlement SEFAZ refused (241, 256, 501, a\n * certificate refused) or too many failures in a row;\n * - `fiscal.contingency-deadline`, to holders of `fiscal:issue` when an NFC-e\n * is still offline 20 hours after it was signed (the deadline is 24).\n *\n * Each blueprint is a structural twin of the wiring contract's\n * `WireNotificationBlueprint`; the host feeds them to its notifications mount.\n */\n\nimport {\n FISCAL_CERTIFICATE_EXPIRING,\n FISCAL_CONTINGENCY_DEADLINE,\n FISCAL_DOCUMENT_NEEDS_ATTENTION,\n FISCAL_DOCUMENT_REJECTED,\n} from \"./documents/context\";\nimport type { FiscalDocumentModel, FiscalDocumentStatus, NumberVoid } from \"./documents/types\";\n\nexport { FISCAL_CERTIFICATE_EXPIRING, FISCAL_CONTINGENCY_DEADLINE, FISCAL_DOCUMENT_NEEDS_ATTENTION, FISCAL_DOCUMENT_REJECTED };\n\nexport interface CertificateExpiringPayload {\n readonly ownerId: string;\n readonly expiresAt: string;\n /** Whole days left; 0 is today, negative is expired. */\n readonly daysLeft: number;\n}\n\nexport interface DocumentRejectedPayload {\n readonly documentId: string;\n readonly subjectId: string;\n readonly model: FiscalDocumentModel;\n readonly series: number;\n readonly number: number;\n /** SEFAZ's `cStat`, or the fiscal service's named code. */\n readonly code: string | null;\n /** SEFAZ's own reason, as the service read it. */\n readonly reason: string;\n}\n\nexport interface DocumentNeedsAttentionPayload {\n readonly documentId: string;\n readonly subjectId: string;\n readonly model: FiscalDocumentModel;\n readonly status: FiscalDocumentStatus;\n readonly numberVoid: NumberVoid | null;\n readonly series: number;\n readonly number: number;\n readonly code: string | null;\n readonly reason: string;\n readonly failures: number;\n}\n\nexport interface ContingencyDeadlinePayload {\n readonly documentId: string;\n readonly subjectId: string;\n readonly series: number;\n readonly number: number;\n /** When it was signed offline, local time with offset. */\n readonly since: string;\n}\n\nexport interface FiscalNotificationContent {\n title: string;\n body: string;\n link?: string;\n data?: Readonly<Record<string, unknown>>;\n}\n\nexport interface FiscalNotificationContext {\n readonly locale?: string | null;\n}\n\n/** The host's words for each event, per recipient. */\nexport interface FiscalNotificationCopy {\n certificateExpiring(payload: CertificateExpiringPayload, context?: FiscalNotificationContext): FiscalNotificationContent;\n documentRejected(payload: DocumentRejectedPayload, context?: FiscalNotificationContext): FiscalNotificationContent;\n documentNeedsAttention(payload: DocumentNeedsAttentionPayload, context?: FiscalNotificationContext): FiscalNotificationContent;\n contingencyDeadline(payload: ContingencyDeadlinePayload, context?: FiscalNotificationContext): FiscalNotificationContent;\n}\n\nexport interface FiscalNotificationBlueprint<TPayload> {\n type: string;\n category: string;\n generate(payload: TPayload, context?: FiscalNotificationContext): FiscalNotificationContent;\n}\n\n/** The suggested preference category; the host's taxonomy decides. */\nexport const FISCAL_NOTIFICATION_CATEGORY = \"fiscal\";\n\nconst COPY_KEYS = [\"certificateExpiring\", \"documentRejected\", \"documentNeedsAttention\", \"contingencyDeadline\"] as const;\n\nexport function createFiscalNotificationBlueprints(copy: FiscalNotificationCopy): readonly [\n FiscalNotificationBlueprint<CertificateExpiringPayload>,\n FiscalNotificationBlueprint<DocumentRejectedPayload>,\n FiscalNotificationBlueprint<DocumentNeedsAttentionPayload>,\n FiscalNotificationBlueprint<ContingencyDeadlinePayload>,\n] {\n const missing = COPY_KEYS.filter((key) => typeof copy?.[key] !== \"function\");\n if (missing.length > 0) throw new TypeError(`createFiscalNotificationBlueprints needs ${missing.join(\", \")}.`);\n const blueprint = <T>(type: string, render: (payload: T, context?: FiscalNotificationContext) => FiscalNotificationContent) => ({\n type,\n category: FISCAL_NOTIFICATION_CATEGORY,\n generate: (payload: T, context?: FiscalNotificationContext) => render(payload, context),\n });\n return [\n blueprint(FISCAL_CERTIFICATE_EXPIRING, copy.certificateExpiring),\n blueprint(FISCAL_DOCUMENT_REJECTED, copy.documentRejected),\n blueprint(FISCAL_DOCUMENT_NEEDS_ATTENTION, copy.documentNeedsAttention),\n blueprint(FISCAL_CONTINGENCY_DEADLINE, copy.contingencyDeadline),\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;AAgGO,IAAM,+BAA+B;AAE5C,IAAM,YAAY,CAAC,uBAAuB,oBAAoB,0BAA0B,qBAAqB;AAEtG,SAAS,mCAAmC,MAKjD;AACA,QAAM,UAAU,UAAU,OAAO,CAAC,QAAQ,OAAO,OAAO,GAAG,MAAM,UAAU;AAC3E,MAAI,QAAQ,SAAS,EAAG,OAAM,IAAI,UAAU,4CAA4C,QAAQ,KAAK,IAAI,CAAC,GAAG;AAC7G,QAAM,YAAY,wBAAI,MAAc,YAA4F;AAAA,IAC9H;AAAA,IACA,UAAU;AAAA,IACV,UAAU,wBAAC,SAAY,YAAwC,OAAO,SAAS,OAAO,GAA5E;AAAA,EACZ,IAJkB;AAKlB,SAAO;AAAA,IACL,UAAU,6BAA6B,KAAK,mBAAmB;AAAA,IAC/D,UAAU,0BAA0B,KAAK,gBAAgB;AAAA,IACzD,UAAU,iCAAiC,KAAK,sBAAsB;AAAA,IACtE,UAAU,6BAA6B,KAAK,mBAAmB;AAAA,EACjE;AACF;AAnBgB;","names":[]}
@@ -0,0 +1,238 @@
1
+ import { SaleForDocument } from './sale/index.js';
2
+ import { SefazEnvironment, SidecarErrorClass, SigningCertificate, Csc, SidecarErrorBody, IssuedDocument, ContingencyEntry, ContingencySignedDocument, CancelledDocument, LookedUpDocument, InutilizedRange, SidecarHealth } from './sidecar/index.js';
3
+
4
+ /**
5
+ * The fiscal document record and its event log — the shape the package's
6
+ * Prisma partial stores (`prisma/fiscal.prisma`, `FiscalDocument` and
7
+ * `FiscalDocumentEvent`) and the state machine (`./machine`) transitions.
8
+ *
9
+ * A document is ONE number: one issuing point, one series, one `nNF`. A sale
10
+ * that goes offline is a second document on the issuing point's contingency
11
+ * series, and the first one is `REPLACED` (see `./machine`). The record is
12
+ * keyed by an opaque `subjectId`: what the subject is (an order, a payment,
13
+ * several orders) is the host's to know, never this package's.
14
+ */
15
+
16
+ /** The document model: NF-e (55) or NFC-e (65). NFS-e is not a model of this package yet (FUT-2242). */
17
+ type FiscalDocumentModel = "NFE" | "NFCE";
18
+ declare const FISCAL_DOCUMENT_MODELS: readonly FiscalDocumentModel[];
19
+ /**
20
+ * - `PENDING`: numbered and stored, not yet handed to the issuer.
21
+ * - `SUBMITTED`: handed to the issuer; no final answer yet (a retry is owed).
22
+ * - `AUTHORIZED`: SEFAZ authorised it. The only state a cancel leaves.
23
+ * - `REJECTED`: refused (SEFAZ's `cStat`, or a request the service refuses as
24
+ * malformed). Final; its number was not spent at SEFAZ and is inutilized.
25
+ * - `DENIED`: a denial of use. Final; the number IS spent.
26
+ * - `CONTINGENCY`: signed offline (`tpEmis = 9`), owed a transmission.
27
+ * - `CANCELLED`: an authorised document cancelled at SEFAZ.
28
+ * - `REPLACED`: its sale moved to another document (the contingency one);
29
+ * its number is settled apart (`numberVoid`).
30
+ */
31
+ type FiscalDocumentStatus = "PENDING" | "SUBMITTED" | "AUTHORIZED" | "REJECTED" | "DENIED" | "CONTINGENCY" | "CANCELLED" | "REPLACED";
32
+ declare const FISCAL_DOCUMENT_STATUSES: readonly FiscalDocumentStatus[];
33
+ /** Which of the issuing point's series the number came from. */
34
+ type SeriesKind = "ONLINE" | "CONTINGENCY";
35
+ /**
36
+ * What is still owed on a number SEFAZ never used, so the sequence has no
37
+ * unexplained gap:
38
+ *
39
+ * - `null`: nothing — the number is a document (authorised, denied, owed a
40
+ * transmission) or still in flight.
41
+ * - `LOOKUP_FIRST`: a request went out with no answer before the sale moved
42
+ * to contingency; look the key up before deciding.
43
+ * - `INUTILIZE`: never used at SEFAZ; inutilize it.
44
+ * - `CANCEL`: the lookup found it authorised after all; cancel it.
45
+ * - `INUTILIZED` / `CANCELLED`: settled.
46
+ * - `DENIED`: settled — the lookup found the number denied, which spends it.
47
+ */
48
+ type NumberVoid = "LOOKUP_FIRST" | "INUTILIZE" | "CANCEL" | "INUTILIZED" | "CANCELLED" | "DENIED";
49
+ /** The `numberVoid` values that still owe the sweep a call. */
50
+ declare const OWED_VOIDS: readonly NumberVoid[];
51
+ /** The order figures a document carries, in integer cents. */
52
+ interface DocumentTotals {
53
+ /** What the buyer pays: Σ line values − Σ discounts. */
54
+ readonly totalCents: number;
55
+ readonly discountCents: number;
56
+ readonly cbsCents: number;
57
+ readonly ibsUfCents: number;
58
+ readonly ibsMunCents: number;
59
+ }
60
+ /**
61
+ * Whether the document is the one its subject stands on. At most one live
62
+ * document per (owner, subject, model): a REPLACED one is not, nor an online
63
+ * one SEFAZ rejected (its number is voided and the sale is issued again) —
64
+ * unless a lookup had found it authorised (its protocol is kept). A
65
+ * REJECTED contingency NFC-e stays live: the buyer holds its DANFE, and the
66
+ * store corrects and resends it under the same number.
67
+ */
68
+ declare function isLive(document: Pick<FiscalDocument, "status" | "seriesKind" | "protocol">): boolean;
69
+ /** One fiscal document. */
70
+ interface FiscalDocument {
71
+ readonly id: string;
72
+ /** The emitter profile's owner: an opaque id the host maps (a store, a company). */
73
+ readonly ownerId: string;
74
+ /** The issuer's CNPJ: SEFAZ numbers by CNPJ, model and series, so the counters do too. */
75
+ readonly issuerCnpj: string;
76
+ /** What the document is FOR, opaque: the host links it to its orders. */
77
+ readonly subjectId: string;
78
+ readonly issuingPointId: string;
79
+ readonly model: FiscalDocumentModel;
80
+ readonly environment: SefazEnvironment;
81
+ readonly seriesKind: SeriesKind;
82
+ readonly series: number;
83
+ readonly number: number;
84
+ /** `cNF`, drawn once: a retried call yields the same key. */
85
+ readonly keyCode: string;
86
+ readonly status: FiscalDocumentStatus;
87
+ /** The sale as sent, issuer and number filled in. Never a secret. */
88
+ readonly sale: SaleForDocument;
89
+ readonly totals: DocumentTotals;
90
+ /** The buyer's CPF/CNPJ at issue time, or `null`. */
91
+ readonly buyerTaxId: string | null;
92
+ readonly accessKey: string | null;
93
+ /** The authorisation (or denial) protocol. */
94
+ readonly protocol: string | null;
95
+ /** The last SEFAZ `cStat`, or the service's named code. */
96
+ readonly statusCode: string | null;
97
+ readonly statusReason: string | null;
98
+ /** The class of the last failed call, or `null`. */
99
+ readonly lastErrorClass: SidecarErrorClass | null;
100
+ /** A request went out and neither it nor its lookup was answered. */
101
+ readonly outcomeUnknown: boolean;
102
+ /** `dhEmi`. */
103
+ readonly issuedAt: string;
104
+ readonly authorizedAt: string | null;
105
+ readonly contingency: {
106
+ readonly since: string;
107
+ readonly reason: string;
108
+ } | null;
109
+ readonly cancelledAt: string | null;
110
+ readonly cancelReason: string | null;
111
+ readonly cancelProtocol: string | null;
112
+ /** The document this one's sale moved to. */
113
+ readonly replacedById: string | null;
114
+ readonly numberVoid: NumberVoid | null;
115
+ /** Storage keys: the signed or authorised XML, and the cancel or inutilization event's XML. */
116
+ readonly xmlKey: string | null;
117
+ readonly eventXmlKey: string | null;
118
+ /** Calls made to the issuer for this document. */
119
+ readonly attempts: number;
120
+ /** Failed steps in a row (a retry, a deferred settlement); any progress resets it. */
121
+ readonly failures: number;
122
+ /** When the sweep (or the contingency transmission) may take it again; `null` when nothing is owed. */
123
+ readonly nextAttemptAt: string | null;
124
+ /**
125
+ * A person must look: a settlement SEFAZ refused, or too many failures in a
126
+ * row. The sweep leaves it alone until someone releases it.
127
+ */
128
+ readonly attention: boolean;
129
+ /** When the 24-hour contingency deadline warning went out. */
130
+ readonly deadlineWarnedAt: string | null;
131
+ readonly createdAt: string;
132
+ readonly updatedAt: string;
133
+ }
134
+ /** What the state machine was fed: the kind of the input that made the event. */
135
+ type DocumentEventKind = "SUBMIT" | "AUTHORIZE" | "DENY" | "REJECT" | "RETRY" | "SIGN_OFFLINE" | "REPLACE" | "CANCEL" | "LOOKUP" | "INUTILIZE" | "DEFER" | "RESIGN" | "RELEASE" | "WARN";
136
+ /**
137
+ * One transition, as stored. `answer` is what the fiscal service answered,
138
+ * verbatim but for any secret-named key (`scrubSecrets`), so the record is the
139
+ * evidence of what SEFAZ said, the `MarketplaceInboxEvent.payload` habit.
140
+ */
141
+ interface FiscalDocumentEvent {
142
+ readonly documentId: string;
143
+ readonly kind: DocumentEventKind;
144
+ readonly fromStatus: FiscalDocumentStatus;
145
+ readonly toStatus: FiscalDocumentStatus;
146
+ readonly at: string;
147
+ readonly errorClass: SidecarErrorClass | null;
148
+ readonly code: string | null;
149
+ readonly answer: unknown;
150
+ }
151
+
152
+ /**
153
+ * The Issuer port: what the document service asks of whoever talks to SEFAZ.
154
+ * The first (and today only) adapter is the fiscal service in this package's
155
+ * `sidecar/` folder (`./sidecar`). A call never throws for a failure the
156
+ * service classified: it answers `{ ok: false, error }` with the service's
157
+ * class (`REJECTED`, `RETRYABLE`, `CONTINGENCY`, `AUTH`, `INVALID`,
158
+ * `INTERNAL`), and the document service maps that onto the state machine.
159
+ *
160
+ * The certificate and the CSC travel with each call (the service is
161
+ * stateless) inside {@link SigningMaterial}, built by the signing identity
162
+ * for this one call and dropped with it.
163
+ */
164
+
165
+ /** What signs one call: the A1 and, for an NFC-e, the CSC. Never stored, never logged. */
166
+ interface SigningMaterial {
167
+ readonly certificate: SigningCertificate;
168
+ readonly csc: Csc | null;
169
+ }
170
+ /** A failed call, classified. The service's error body, verbatim. */
171
+ type IssuerFailure = SidecarErrorBody["error"];
172
+ type IssuerOutcome<T> = {
173
+ readonly ok: true;
174
+ readonly answer: T;
175
+ } | {
176
+ readonly ok: false;
177
+ readonly error: IssuerFailure;
178
+ };
179
+ interface Call {
180
+ readonly environment: SefazEnvironment;
181
+ readonly signing: SigningMaterial;
182
+ }
183
+ interface IssueCall extends Call {
184
+ readonly model: FiscalDocumentModel;
185
+ readonly document: SaleForDocument;
186
+ }
187
+ interface SignContingencyCall extends Call {
188
+ readonly document: SaleForDocument;
189
+ readonly contingency: ContingencyEntry;
190
+ }
191
+ interface TransmitCall extends Call {
192
+ readonly model: FiscalDocumentModel;
193
+ readonly signedXml: string;
194
+ }
195
+ interface CancelCall extends Call {
196
+ readonly model: FiscalDocumentModel;
197
+ readonly accessKey: string;
198
+ readonly protocol: string;
199
+ readonly reason: string;
200
+ }
201
+ /** NFC-e only: cancel an online document whose sale was issued again in contingency (event 110112). */
202
+ interface CancelBySubstitutionCall extends Call {
203
+ readonly accessKey: string;
204
+ readonly protocol: string;
205
+ readonly reason: string;
206
+ readonly substituteAccessKey: string;
207
+ }
208
+ interface LookupCall extends Call {
209
+ readonly model: FiscalDocumentModel;
210
+ readonly accessKey: string;
211
+ }
212
+ interface InutilizeCall extends Call {
213
+ readonly model: FiscalDocumentModel;
214
+ readonly uf: string;
215
+ readonly cnpj: string;
216
+ readonly year: number;
217
+ readonly series: number;
218
+ readonly from: number;
219
+ readonly to: number;
220
+ readonly reason: string;
221
+ }
222
+ interface Issuer {
223
+ /** Build, sign and transmit. `AUTHORIZED` or `DENIED`. */
224
+ issue(call: IssueCall): Promise<IssuerOutcome<IssuedDocument>>;
225
+ /** NFC-e only: build and sign offline (`tpEmis = 9`); nothing is sent. */
226
+ signContingency(call: SignContingencyCall): Promise<IssuerOutcome<ContingencySignedDocument>>;
227
+ /** Send an already signed XML (a contingency document). */
228
+ transmit(call: TransmitCall): Promise<IssuerOutcome<IssuedDocument>>;
229
+ cancel(call: CancelCall): Promise<IssuerOutcome<CancelledDocument>>;
230
+ cancelBySubstitution(call: CancelBySubstitutionCall): Promise<IssuerOutcome<CancelledDocument>>;
231
+ lookup(call: LookupCall): Promise<IssuerOutcome<LookedUpDocument>>;
232
+ inutilize(call: InutilizeCall): Promise<IssuerOutcome<InutilizedRange>>;
233
+ health(): Promise<SidecarHealth>;
234
+ }
235
+ /** The path segment of a model on the service's routes. */
236
+ declare function modelPath(model: FiscalDocumentModel): "nfe" | "nfce";
237
+
238
+ export { type CancelBySubstitutionCall as C, type DocumentEventKind as D, type FiscalDocumentModel as F, type Issuer as I, type LookupCall as L, type NumberVoid as N, OWED_VOIDS as O, type SignContingencyCall as S, type TransmitCall as T, type CancelCall as a, type InutilizeCall as b, type IssueCall as c, type IssuerFailure as d, type IssuerOutcome as e, type SigningMaterial as f, type FiscalDocumentStatus as g, type FiscalDocument as h, type FiscalDocumentEvent as i, type SeriesKind as j, type DocumentTotals as k, FISCAL_DOCUMENT_MODELS as l, modelPath as m, FISCAL_DOCUMENT_STATUSES as n, isLive as o };