kassza 0.12.0 → 0.14.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 (177) hide show
  1. package/README.en.md +48 -0
  2. package/README.md +427 -32
  3. package/agents/README.md +26 -6
  4. package/agents/api.md +218 -3
  5. package/agents/pitfalls.md +27 -3
  6. package/agents/recipes.md +280 -51
  7. package/agents/skills/kassza/SKILL.md +14 -8
  8. package/agents/skills/migrate-from-szamlazz-js/SKILL.md +39 -0
  9. package/dist/batch/index.cjs +346 -0
  10. package/dist/batch/index.d.cts +91 -0
  11. package/dist/batch/index.d.ts +91 -0
  12. package/dist/batch/index.js +339 -0
  13. package/dist/cli.cjs +643 -0
  14. package/dist/cli.d.cts +1 -0
  15. package/dist/cli.d.ts +1 -0
  16. package/dist/cli.js +643 -0
  17. package/dist/client-CLFvJCVW.cjs +1452 -0
  18. package/dist/{client-CL3fuH6A.js → client-Cvf-hTz_.js} +306 -515
  19. package/dist/client-DeWWQ-RZ.d.ts +341 -0
  20. package/dist/client-SVZu25MB.d.cts +341 -0
  21. package/dist/context-CFNKzStE.d.cts +449 -0
  22. package/dist/context-kb33TgzE.d.ts +449 -0
  23. package/dist/cookie-stores/index.cjs +21 -150
  24. package/dist/cookie-stores/index.d.cts +4 -63
  25. package/dist/cookie-stores/index.d.ts +4 -63
  26. package/dist/cookie-stores/index.js +3 -144
  27. package/dist/create-CflXrPip.js +204 -0
  28. package/dist/create-CvUvLUaT.cjs +257 -0
  29. package/dist/{create-once-D0pwuenl.cjs → create-once-9yxR_Er_.cjs} +291 -33
  30. package/dist/create-once-Bh6fOWkW.d.cts +20 -0
  31. package/dist/{create-once-CqdYmQD8.js → create-once-Ca2gMk1h.js} +250 -34
  32. package/dist/create-once-VKp0tVow.d.ts +20 -0
  33. package/dist/{crypto-B8lERvR1.cjs → crypto-Dpn4FHQ6.cjs} +9 -0
  34. package/dist/{crypto-DK_osBVy.js → crypto-usDg8L2K.js} +4 -1
  35. package/dist/data-link/index.cjs +232 -0
  36. package/dist/data-link/index.d.cts +29 -0
  37. package/dist/data-link/index.d.ts +29 -0
  38. package/dist/data-link/index.js +224 -0
  39. package/dist/delegation/index.cjs +35 -34
  40. package/dist/delegation/index.d.cts +2 -1
  41. package/dist/delegation/index.d.ts +2 -1
  42. package/dist/delegation/index.js +4 -3
  43. package/dist/{errors-DLrb0g64.js → errors-DtN4g5Z9.js} +9 -1
  44. package/dist/{errors-DxeuTslP.cjs → errors-EE96_6D_.cjs} +20 -0
  45. package/dist/get-BdMTseh4.cjs +271 -0
  46. package/dist/get-Byc9T5WO.d.cts +151 -0
  47. package/dist/get-Byc9T5WO.d.ts +151 -0
  48. package/dist/get-CZEShCcj.js +260 -0
  49. package/dist/index-BhUPY_EH.d.cts +109 -0
  50. package/dist/index-BqGgQ4t3.d.ts +109 -0
  51. package/dist/{index-CYAGCdKJ.d.cts → index-C-7yWV7L.d.cts} +24 -1
  52. package/dist/{index-CYAGCdKJ.d.ts → index-C-7yWV7L.d.ts} +24 -1
  53. package/dist/index.cjs +19 -5
  54. package/dist/index.d.cts +11 -19
  55. package/dist/index.d.ts +11 -19
  56. package/dist/index.js +6 -6
  57. package/dist/ipn/index.cjs +26 -5
  58. package/dist/ipn/index.d.cts +12 -1
  59. package/dist/ipn/index.d.ts +12 -1
  60. package/dist/ipn/index.js +26 -6
  61. package/dist/issue-Bin4tKD_.cjs +988 -0
  62. package/dist/issue-DMA1Nbr1.js +905 -0
  63. package/dist/journal/index.cjs +454 -0
  64. package/dist/journal/index.d.cts +18 -0
  65. package/dist/journal/index.d.ts +18 -0
  66. package/dist/journal/index.js +445 -0
  67. package/dist/journal-DvI81Kt7.d.cts +114 -0
  68. package/dist/journal-Y9qrIB8G.d.ts +114 -0
  69. package/dist/mcp/index.cjs +10 -0
  70. package/dist/mcp/index.d.cts +71 -0
  71. package/dist/mcp/index.d.ts +71 -0
  72. package/dist/mcp/index.js +2 -0
  73. package/dist/money/index.cjs +2 -1
  74. package/dist/money/index.d.cts +2 -2
  75. package/dist/money/index.d.ts +2 -2
  76. package/dist/money/index.js +2 -2
  77. package/dist/{money-DAA7OwiO.js → money-Cw457SD6.js} +120 -12
  78. package/dist/{money-DrhGkWHW.cjs → money-K9j0wPit.cjs} +124 -10
  79. package/dist/nav/index.cjs +1046 -0
  80. package/dist/nav/index.d.cts +247 -0
  81. package/dist/nav/index.d.ts +247 -0
  82. package/dist/nav/index.js +1012 -0
  83. package/dist/nav-BNbc8U0R.cjs +203 -0
  84. package/dist/nav-BcCerwWS.js +156 -0
  85. package/dist/node/index.cjs +124 -0
  86. package/dist/node/index.d.cts +35 -0
  87. package/dist/node/index.d.ts +35 -0
  88. package/dist/node/index.js +120 -0
  89. package/dist/observe/index.cjs +311 -0
  90. package/dist/observe/index.d.cts +53 -0
  91. package/dist/observe/index.d.ts +53 -0
  92. package/dist/observe/index.js +303 -0
  93. package/dist/once-BN_3B5OF.cjs +103 -0
  94. package/dist/once-CqqZxsXG.js +74 -0
  95. package/dist/parse-Cr7yQ3_z.js +291 -0
  96. package/dist/parse-DOA2XQ3e.cjs +380 -0
  97. package/dist/payments/barion.cjs +26 -2
  98. package/dist/payments/barion.d.cts +2 -2
  99. package/dist/payments/barion.d.ts +2 -2
  100. package/dist/payments/barion.js +26 -2
  101. package/dist/payments/index.cjs +7 -2
  102. package/dist/payments/index.d.cts +4 -4
  103. package/dist/payments/index.d.ts +4 -4
  104. package/dist/payments/index.js +3 -3
  105. package/dist/payments/paypal.cjs +16 -2
  106. package/dist/payments/paypal.d.cts +2 -2
  107. package/dist/payments/paypal.d.ts +2 -2
  108. package/dist/payments/paypal.js +16 -2
  109. package/dist/payments/revolut.cjs +17 -3
  110. package/dist/payments/revolut.d.cts +2 -2
  111. package/dist/payments/revolut.d.ts +2 -2
  112. package/dist/payments/revolut.js +17 -3
  113. package/dist/payments/simplepay.cjs +37 -5
  114. package/dist/payments/simplepay.d.cts +2 -2
  115. package/dist/payments/simplepay.d.ts +2 -2
  116. package/dist/payments/simplepay.js +37 -5
  117. package/dist/payments/stripe.cjs +20 -3
  118. package/dist/payments/stripe.d.cts +2 -2
  119. package/dist/payments/stripe.d.ts +2 -2
  120. package/dist/payments/stripe.js +20 -3
  121. package/dist/push-BXj0Sf0Z.d.ts +52 -0
  122. package/dist/push-D4nNbCNV.d.cts +52 -0
  123. package/dist/reference-B5TATqb5.js +124 -0
  124. package/dist/reference-BIdYMK0t.cjs +183 -0
  125. package/dist/reports/index.cjs +11 -164
  126. package/dist/reports/index.d.cts +1 -1
  127. package/dist/reports/index.d.ts +1 -1
  128. package/dist/reports/index.js +1 -154
  129. package/dist/request-body-CH6ZGOrq.cjs +34 -0
  130. package/dist/request-body-uZHMRlQr.js +29 -0
  131. package/dist/serialize-B2eFh3D-.js +219 -0
  132. package/dist/serialize-CquIsxA-.cjs +290 -0
  133. package/dist/server-BrJUbXs7.js +1505 -0
  134. package/dist/server-Dw9j8Mnd.cjs +1558 -0
  135. package/dist/session-Ckl5eJhV.d.ts +7 -0
  136. package/dist/{session-CKOuE6Jc.cjs → session-DeM5vjvC.cjs} +69 -13
  137. package/dist/{session-rMKaJcmq.js → session-SaEEXu2N.js} +58 -14
  138. package/dist/session-YbChChx7.d.cts +7 -0
  139. package/dist/storage/fs.cjs +1 -1
  140. package/dist/storage/fs.js +1 -1
  141. package/dist/storage/index.cjs +1 -1
  142. package/dist/storage/index.js +1 -1
  143. package/dist/store-C1rHd9DB.d.cts +19 -0
  144. package/dist/store-C1rHd9DB.d.ts +19 -0
  145. package/dist/stores/index.cjs +24 -0
  146. package/dist/stores/index.d.cts +4 -0
  147. package/dist/stores/index.d.ts +4 -0
  148. package/dist/stores/index.js +3 -0
  149. package/dist/stores-BNrS0dWl.cjs +506 -0
  150. package/dist/stores-DhjGBrl_.js +441 -0
  151. package/dist/testing/index.cjs +1500 -15
  152. package/dist/testing/index.d.cts +198 -3
  153. package/dist/testing/index.d.ts +198 -3
  154. package/dist/testing/index.js +1498 -15
  155. package/dist/{types-COf1LAD-.d.ts → types-B1A8mUIE.d.cts} +14 -2
  156. package/dist/{types-COf1LAD-.d.cts → types-ByAEvGsZ.d.ts} +14 -2
  157. package/dist/{types-k--zHf4l.d.ts → types-D1zDOH_F.d.ts} +1 -1
  158. package/dist/{types-DH8QoNZK.d.cts → types-lnKkQdot.d.cts} +1 -1
  159. package/dist/warnings-B3DXnveC.d.cts +31 -0
  160. package/dist/warnings-B3DXnveC.d.ts +31 -0
  161. package/dist/warnings-DeIw5RFj.cjs +20 -0
  162. package/dist/warnings-DwTl5J-2.js +15 -0
  163. package/dist/{webhook-D4lvtex1.js → webhook-CQVShAfI.js} +47 -26
  164. package/dist/{webhook-C76bV-4R.cjs → webhook-Ckj-_hPD.cjs} +70 -25
  165. package/dist/webhook-CmdhGiH5.d.cts +11 -0
  166. package/dist/webhook-D6lEejob.d.ts +11 -0
  167. package/llms.txt +6 -5
  168. package/package.json +134 -4
  169. package/dist/client-CickRRFr.d.ts +0 -838
  170. package/dist/client-CsmGIFRS.cjs +0 -1637
  171. package/dist/client-DvWZoX_E.d.cts +0 -838
  172. package/dist/issue-BsyYdrIG.cjs +0 -1531
  173. package/dist/issue-C6Fcjvln.js +0 -1274
  174. package/dist/session-Dm_45x8K.d.cts +0 -11
  175. package/dist/session-Dm_45x8K.d.ts +0 -11
  176. package/dist/webhook-CfaDgcL0.d.cts +0 -6
  177. package/dist/webhook-q2OzNwd7.d.ts +0 -6
@@ -0,0 +1,247 @@
1
+ import { t as DateInput } from "../dates-9zvESP0i.cjs";
2
+ import { s as RequestOptions } from "../context-CFNKzStE.cjs";
3
+ //#region src/core/xml/parse.d.ts
4
+ interface XmlElement {
5
+ readonly name: string;
6
+ readonly attributes: Readonly<Record<string, string>>;
7
+ readonly children: readonly XmlElement[];
8
+ readonly text: string;
9
+ }
10
+ //#endregion
11
+ //#region src/nav/types.d.ts
12
+ interface NavVatCategoryAmounts {
13
+ readonly vat: string;
14
+ readonly saleDocument: number;
15
+ readonly modifyingDocument: number;
16
+ }
17
+ interface NavReceiptData {
18
+ readonly applicableDate: string;
19
+ readonly serialNumber: string;
20
+ readonly currency: string;
21
+ readonly exchangeRate: number | null;
22
+ readonly vatCategories: readonly NavVatCategoryAmounts[];
23
+ readonly total: number;
24
+ readonly numberOfSaleDocument: number;
25
+ readonly numberOfModifyingDocument: number;
26
+ }
27
+ type NavReportStatus = "RECORDED" | "INVALIDATED";
28
+ interface NavReportListItem {
29
+ readonly id: string;
30
+ readonly applicableDate: string;
31
+ readonly serialNumber: string;
32
+ readonly numberOfSaleDocument: number;
33
+ readonly numberOfModifyingDocument: number;
34
+ readonly totalAmount: number;
35
+ readonly totalAmountInForint: number;
36
+ readonly status: NavReportStatus;
37
+ readonly softwareName: string;
38
+ }
39
+ interface NavReportPage {
40
+ readonly items: readonly NavReportListItem[];
41
+ readonly page: number;
42
+ readonly pageSize: number;
43
+ readonly totalRowCount: number;
44
+ }
45
+ interface NavReportDetail extends NavReceiptData {
46
+ readonly id: string;
47
+ readonly status: NavReportStatus;
48
+ readonly softwareName: string;
49
+ readonly totalAmountInForint: number;
50
+ }
51
+ interface NavVatCategoryInfo {
52
+ readonly name: string;
53
+ readonly validFrom: string;
54
+ readonly validTo?: string | undefined;
55
+ }
56
+ interface NavCurrencyInfo {
57
+ readonly code: string;
58
+ readonly name: string;
59
+ }
60
+ interface NavAuthToken {
61
+ readonly token: string;
62
+ readonly validTo: string;
63
+ }
64
+ type NavReportOrderProperty = "ID" | "APPLICABLE_DATE" | "CREATED_DATE" | "SERIAL_NUMBER" | "NUM_SALE_DOC" | "NUM_MODIFY_DOC" | "TOTAL" | "TOTAL_IN_FT" | "STATE" | "SOFTWARE";
65
+ type NavOrderDirection = "ASC" | "DESC";
66
+ interface NavReportQuery {
67
+ readonly from: string;
68
+ readonly to: string;
69
+ readonly page?: number | undefined;
70
+ readonly pageSize?: number | undefined;
71
+ readonly orderBy?: NavReportOrderProperty | undefined;
72
+ readonly direction?: NavOrderDirection | undefined;
73
+ }
74
+ //#endregion
75
+ //#region src/nav/client.d.ts
76
+ export declare const NAV_RECEIPT_URLS: {
77
+ readonly test: "https://bv-receipt-if.enyugta.nav.gov.hu/v1";
78
+ readonly production: "https://receipt-if.enyugta.nav.gov.hu/v1";
79
+ };
80
+ type NavEnvironment = keyof typeof NAV_RECEIPT_URLS;
81
+ export declare const NAV_DEFAULT_TIMEOUT_MS = 15e3;
82
+ export declare const NAV_MAX_LIST_PAGES = 1e3;
83
+ export declare function navPasswordHash(password: string): Promise<string>;
84
+ export declare function navSignatureTimestamp(timestamp: string): string;
85
+ export declare function navRequestSignature(requestId: string, timestamp: string, signatureKey: string): string;
86
+ export declare function navLegacyRequestId(): string;
87
+ interface NavReceiptClientOptions {
88
+ readonly environment: NavEnvironment;
89
+ readonly login: string;
90
+ readonly password?: string | undefined;
91
+ readonly passwordHash?: string | undefined;
92
+ readonly signatureKey: string;
93
+ readonly taxNumber: string;
94
+ readonly predecessorTaxNumber?: string | undefined;
95
+ readonly softwareName?: string | undefined;
96
+ readonly allowWrite?: boolean | undefined;
97
+ readonly baseUrl?: string | undefined;
98
+ readonly fetch?: typeof globalThis.fetch | undefined;
99
+ readonly timeoutMs?: number | undefined;
100
+ readonly now?: (() => Date) | undefined;
101
+ }
102
+ interface NavSubmitOptions extends RequestOptions {
103
+ readonly softwareName?: string | undefined;
104
+ }
105
+ interface NavSubmitResult {
106
+ readonly id: string;
107
+ readonly created: boolean;
108
+ readonly softwareName: string;
109
+ }
110
+ type NavListAllQuery = Omit<NavReportQuery, "page" | "pageSize">;
111
+ interface NavReceiptClient {
112
+ readonly environment: NavEnvironment;
113
+ readonly taxPayerId: string;
114
+ readonly canWrite: boolean;
115
+ authenticate(options?: RequestOptions): Promise<NavAuthToken>;
116
+ listReports(query: NavReportQuery, options?: RequestOptions): Promise<NavReportPage>;
117
+ listAllReports(query: NavListAllQuery, options?: RequestOptions): Promise<NavReportListItem[]>;
118
+ getReport(id: string, options?: RequestOptions): Promise<NavReportDetail>;
119
+ submitReport(data: NavReceiptData, options?: NavSubmitOptions): Promise<NavSubmitResult>;
120
+ modifyReport(id: string, data: NavReceiptData, options?: NavSubmitOptions): Promise<{
121
+ readonly id: string;
122
+ }>;
123
+ invalidateReport(id: string, options?: RequestOptions): Promise<void>;
124
+ registerSoftware(name?: string, options?: RequestOptions): Promise<{
125
+ readonly created: boolean;
126
+ }>;
127
+ listSoftware(options?: RequestOptions): Promise<string[]>;
128
+ vatCategories(options?: RequestOptions): Promise<NavVatCategoryInfo[]>;
129
+ currencies(options?: RequestOptions): Promise<NavCurrencyInfo[]>;
130
+ }
131
+ export declare function createNavReceiptClient(options: NavReceiptClientOptions): NavReceiptClient;
132
+ //#endregion
133
+ //#region src/nav/errors.d.ts
134
+ type NavOperation = "authToken" | "listReceipts" | "createReceipt" | "receiptDetail" | "modifyReceipt" | "invalidateReceipt" | "createIssuingSoftware" | "listIssuingSoftware" | "vatCategories" | "currencies";
135
+ type NavReceiptErrorCategory = "auth" | "validation" | "business" | "technical" | "network" | "timeout" | "unexpected_response" | "write_blocked" | "conflict" | "configuration";
136
+ interface NavFieldError {
137
+ readonly field?: string | undefined;
138
+ readonly error?: string | undefined;
139
+ }
140
+ interface NavErrorCodeInfo {
141
+ readonly name: string;
142
+ readonly message: string;
143
+ readonly category: NavReceiptErrorCategory;
144
+ readonly hint?: string;
145
+ }
146
+ export declare const NAV_RECEIPT_ERROR_CODES: Readonly<Record<string, NavErrorCodeInfo>>;
147
+ interface NavReceiptErrorOptions {
148
+ readonly category: NavReceiptErrorCategory;
149
+ readonly code?: string | undefined;
150
+ readonly operation?: NavOperation | undefined;
151
+ readonly httpStatus?: number | undefined;
152
+ readonly fieldErrors?: readonly NavFieldError[] | undefined;
153
+ readonly hint?: string | undefined;
154
+ readonly rawResponse?: string | undefined;
155
+ readonly details?: Readonly<Record<string, string>> | undefined;
156
+ readonly cause?: unknown;
157
+ }
158
+ export declare class NavReceiptError extends Error {
159
+ override readonly name: string;
160
+ readonly category: NavReceiptErrorCategory;
161
+ readonly code: string | undefined;
162
+ readonly operation: NavOperation | undefined;
163
+ readonly httpStatus: number | undefined;
164
+ readonly fieldErrors: readonly NavFieldError[];
165
+ readonly hint: string | undefined;
166
+ readonly rawResponse: string | undefined;
167
+ readonly details: Readonly<Record<string, string>> | undefined;
168
+ constructor(message: string, options: NavReceiptErrorOptions);
169
+ get retryable(): boolean;
170
+ }
171
+ export declare function isNavReceiptError(error: unknown): error is NavReceiptError;
172
+ //#endregion
173
+ //#region src/nav/paper.d.ts
174
+ interface PaperReceiptEntry {
175
+ readonly number: string;
176
+ readonly vat: string;
177
+ readonly gross: number;
178
+ readonly modifying?: boolean | undefined;
179
+ }
180
+ interface PaperReceiptDay {
181
+ readonly applicableDate: DateInput;
182
+ readonly currency?: string | undefined;
183
+ readonly exchangeRate?: number | null | undefined;
184
+ readonly entries: readonly PaperReceiptEntry[];
185
+ }
186
+ export declare function paperReceiptReport(day: PaperReceiptDay): NavReceiptData;
187
+ //#endregion
188
+ //#region src/nav/parse.d.ts
189
+ export declare function parseNavResponse(operation: NavOperation, expectedRoot: string, status: number, body: string): XmlElement;
190
+ //#endregion
191
+ //#region src/nav/reconcile.d.ts
192
+ interface NavReconciledPair {
193
+ readonly local: NavReceiptData;
194
+ readonly remote: NavReportListItem;
195
+ }
196
+ interface NavMismatch extends NavReconciledPair {
197
+ readonly differences: readonly string[];
198
+ }
199
+ interface NavReconciliation {
200
+ readonly matched: readonly NavReconciledPair[];
201
+ readonly mismatched: readonly NavMismatch[];
202
+ readonly missing: readonly NavReceiptData[];
203
+ readonly unexpected: readonly NavReportListItem[];
204
+ }
205
+ export declare function reconcileNavReports(local: readonly NavReceiptData[], remote: readonly NavReportListItem[]): NavReconciliation;
206
+ //#endregion
207
+ //#region src/nav/sha3.d.ts
208
+ export declare function sha3_512(data: Uint8Array): Uint8Array;
209
+ export declare function sha3_512Hex(input: string | Uint8Array): string;
210
+ //#endregion
211
+ //#region src/nav/validate.d.ts
212
+ export declare const NAV_SERIAL_NUMBER_PATTERN: RegExp;
213
+ export declare const NAV_SOFTWARE_NAME_PATTERN: RegExp;
214
+ export declare const NAV_VAT_CATEGORY_PATTERN: RegExp;
215
+ export declare const NAV_REPORT_ID_PATTERN: RegExp;
216
+ export declare function navTaxpayerId(taxNumber: string): string;
217
+ interface ValidateNavReceiptOptions {
218
+ readonly today?: string | undefined;
219
+ }
220
+ export declare function validateNavReceiptData(data: NavReceiptData, options?: ValidateNavReceiptOptions): void;
221
+ //#endregion
222
+ //#region src/nav/xml.d.ts
223
+ export declare const NAV_RECEIPT_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/1.0/receipt";
224
+ export declare const NAV_SERVICE_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/2.0/common/service";
225
+ export declare const NAV_AUTH_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/2.0/common/authservice";
226
+ export declare const NAV_PAGING_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/2.0/common/paging";
227
+ interface NavRequestContext {
228
+ readonly requestId: string;
229
+ readonly timestamp: string;
230
+ }
231
+ interface NavAuthFields {
232
+ readonly login: string;
233
+ readonly passwordHash: string;
234
+ readonly taxPayerId: string;
235
+ readonly predecessorTaxPayerId?: string | undefined;
236
+ readonly requestSignature: string;
237
+ }
238
+ export declare function buildAuthTokenXml(context: NavRequestContext, auth: NavAuthFields): string;
239
+ export declare function buildCreateReceiptXml(context: NavRequestContext, taxPayerId: string, softwareName: string, data: NavReceiptData): string;
240
+ export declare function buildModifyReceiptXml(context: NavRequestContext, id: string, taxPayerId: string, softwareName: string, data: NavReceiptData): string;
241
+ export declare function buildReceiptListXml(context: NavRequestContext, taxPayerId: string, query: NavReportQuery): string;
242
+ export declare function buildReceiptIdXml(root: "ReceiptDetailRequest" | "InvalidateReceiptRequest", context: NavRequestContext, id: string, taxPayerId: string): string;
243
+ export declare function buildCreateIssuingSoftwareXml(context: NavRequestContext, taxPayerId: string, name: string): string;
244
+ export declare function buildIssuingSoftwareListXml(context: NavRequestContext, taxPayerId: string): string;
245
+ export declare function buildContextOnlyXml(root: "VatCategoryRequest" | "CurrencyRequest", context: NavRequestContext): string;
246
+ //#endregion
247
+ export type { NavAuthFields, NavAuthToken, NavCurrencyInfo, NavEnvironment, NavErrorCodeInfo, NavFieldError, NavListAllQuery, NavMismatch, NavOperation, NavOrderDirection, NavReceiptClient, NavReceiptClientOptions, NavReceiptData, NavReceiptErrorCategory, NavReconciledPair, NavReconciliation, NavReportDetail, NavReportListItem, NavReportOrderProperty, NavReportPage, NavReportQuery, NavReportStatus, NavRequestContext, NavSubmitOptions, NavSubmitResult, NavVatCategoryAmounts, NavVatCategoryInfo, PaperReceiptDay, PaperReceiptEntry, ValidateNavReceiptOptions };
@@ -0,0 +1,247 @@
1
+ import { t as DateInput } from "../dates-9zvESP0i.js";
2
+ import { s as RequestOptions } from "../context-kb33TgzE.js";
3
+ //#region src/core/xml/parse.d.ts
4
+ interface XmlElement {
5
+ readonly name: string;
6
+ readonly attributes: Readonly<Record<string, string>>;
7
+ readonly children: readonly XmlElement[];
8
+ readonly text: string;
9
+ }
10
+ //#endregion
11
+ //#region src/nav/types.d.ts
12
+ interface NavVatCategoryAmounts {
13
+ readonly vat: string;
14
+ readonly saleDocument: number;
15
+ readonly modifyingDocument: number;
16
+ }
17
+ interface NavReceiptData {
18
+ readonly applicableDate: string;
19
+ readonly serialNumber: string;
20
+ readonly currency: string;
21
+ readonly exchangeRate: number | null;
22
+ readonly vatCategories: readonly NavVatCategoryAmounts[];
23
+ readonly total: number;
24
+ readonly numberOfSaleDocument: number;
25
+ readonly numberOfModifyingDocument: number;
26
+ }
27
+ type NavReportStatus = "RECORDED" | "INVALIDATED";
28
+ interface NavReportListItem {
29
+ readonly id: string;
30
+ readonly applicableDate: string;
31
+ readonly serialNumber: string;
32
+ readonly numberOfSaleDocument: number;
33
+ readonly numberOfModifyingDocument: number;
34
+ readonly totalAmount: number;
35
+ readonly totalAmountInForint: number;
36
+ readonly status: NavReportStatus;
37
+ readonly softwareName: string;
38
+ }
39
+ interface NavReportPage {
40
+ readonly items: readonly NavReportListItem[];
41
+ readonly page: number;
42
+ readonly pageSize: number;
43
+ readonly totalRowCount: number;
44
+ }
45
+ interface NavReportDetail extends NavReceiptData {
46
+ readonly id: string;
47
+ readonly status: NavReportStatus;
48
+ readonly softwareName: string;
49
+ readonly totalAmountInForint: number;
50
+ }
51
+ interface NavVatCategoryInfo {
52
+ readonly name: string;
53
+ readonly validFrom: string;
54
+ readonly validTo?: string | undefined;
55
+ }
56
+ interface NavCurrencyInfo {
57
+ readonly code: string;
58
+ readonly name: string;
59
+ }
60
+ interface NavAuthToken {
61
+ readonly token: string;
62
+ readonly validTo: string;
63
+ }
64
+ type NavReportOrderProperty = "ID" | "APPLICABLE_DATE" | "CREATED_DATE" | "SERIAL_NUMBER" | "NUM_SALE_DOC" | "NUM_MODIFY_DOC" | "TOTAL" | "TOTAL_IN_FT" | "STATE" | "SOFTWARE";
65
+ type NavOrderDirection = "ASC" | "DESC";
66
+ interface NavReportQuery {
67
+ readonly from: string;
68
+ readonly to: string;
69
+ readonly page?: number | undefined;
70
+ readonly pageSize?: number | undefined;
71
+ readonly orderBy?: NavReportOrderProperty | undefined;
72
+ readonly direction?: NavOrderDirection | undefined;
73
+ }
74
+ //#endregion
75
+ //#region src/nav/client.d.ts
76
+ export declare const NAV_RECEIPT_URLS: {
77
+ readonly test: "https://bv-receipt-if.enyugta.nav.gov.hu/v1";
78
+ readonly production: "https://receipt-if.enyugta.nav.gov.hu/v1";
79
+ };
80
+ type NavEnvironment = keyof typeof NAV_RECEIPT_URLS;
81
+ export declare const NAV_DEFAULT_TIMEOUT_MS = 15e3;
82
+ export declare const NAV_MAX_LIST_PAGES = 1e3;
83
+ export declare function navPasswordHash(password: string): Promise<string>;
84
+ export declare function navSignatureTimestamp(timestamp: string): string;
85
+ export declare function navRequestSignature(requestId: string, timestamp: string, signatureKey: string): string;
86
+ export declare function navLegacyRequestId(): string;
87
+ interface NavReceiptClientOptions {
88
+ readonly environment: NavEnvironment;
89
+ readonly login: string;
90
+ readonly password?: string | undefined;
91
+ readonly passwordHash?: string | undefined;
92
+ readonly signatureKey: string;
93
+ readonly taxNumber: string;
94
+ readonly predecessorTaxNumber?: string | undefined;
95
+ readonly softwareName?: string | undefined;
96
+ readonly allowWrite?: boolean | undefined;
97
+ readonly baseUrl?: string | undefined;
98
+ readonly fetch?: typeof globalThis.fetch | undefined;
99
+ readonly timeoutMs?: number | undefined;
100
+ readonly now?: (() => Date) | undefined;
101
+ }
102
+ interface NavSubmitOptions extends RequestOptions {
103
+ readonly softwareName?: string | undefined;
104
+ }
105
+ interface NavSubmitResult {
106
+ readonly id: string;
107
+ readonly created: boolean;
108
+ readonly softwareName: string;
109
+ }
110
+ type NavListAllQuery = Omit<NavReportQuery, "page" | "pageSize">;
111
+ interface NavReceiptClient {
112
+ readonly environment: NavEnvironment;
113
+ readonly taxPayerId: string;
114
+ readonly canWrite: boolean;
115
+ authenticate(options?: RequestOptions): Promise<NavAuthToken>;
116
+ listReports(query: NavReportQuery, options?: RequestOptions): Promise<NavReportPage>;
117
+ listAllReports(query: NavListAllQuery, options?: RequestOptions): Promise<NavReportListItem[]>;
118
+ getReport(id: string, options?: RequestOptions): Promise<NavReportDetail>;
119
+ submitReport(data: NavReceiptData, options?: NavSubmitOptions): Promise<NavSubmitResult>;
120
+ modifyReport(id: string, data: NavReceiptData, options?: NavSubmitOptions): Promise<{
121
+ readonly id: string;
122
+ }>;
123
+ invalidateReport(id: string, options?: RequestOptions): Promise<void>;
124
+ registerSoftware(name?: string, options?: RequestOptions): Promise<{
125
+ readonly created: boolean;
126
+ }>;
127
+ listSoftware(options?: RequestOptions): Promise<string[]>;
128
+ vatCategories(options?: RequestOptions): Promise<NavVatCategoryInfo[]>;
129
+ currencies(options?: RequestOptions): Promise<NavCurrencyInfo[]>;
130
+ }
131
+ export declare function createNavReceiptClient(options: NavReceiptClientOptions): NavReceiptClient;
132
+ //#endregion
133
+ //#region src/nav/errors.d.ts
134
+ type NavOperation = "authToken" | "listReceipts" | "createReceipt" | "receiptDetail" | "modifyReceipt" | "invalidateReceipt" | "createIssuingSoftware" | "listIssuingSoftware" | "vatCategories" | "currencies";
135
+ type NavReceiptErrorCategory = "auth" | "validation" | "business" | "technical" | "network" | "timeout" | "unexpected_response" | "write_blocked" | "conflict" | "configuration";
136
+ interface NavFieldError {
137
+ readonly field?: string | undefined;
138
+ readonly error?: string | undefined;
139
+ }
140
+ interface NavErrorCodeInfo {
141
+ readonly name: string;
142
+ readonly message: string;
143
+ readonly category: NavReceiptErrorCategory;
144
+ readonly hint?: string;
145
+ }
146
+ export declare const NAV_RECEIPT_ERROR_CODES: Readonly<Record<string, NavErrorCodeInfo>>;
147
+ interface NavReceiptErrorOptions {
148
+ readonly category: NavReceiptErrorCategory;
149
+ readonly code?: string | undefined;
150
+ readonly operation?: NavOperation | undefined;
151
+ readonly httpStatus?: number | undefined;
152
+ readonly fieldErrors?: readonly NavFieldError[] | undefined;
153
+ readonly hint?: string | undefined;
154
+ readonly rawResponse?: string | undefined;
155
+ readonly details?: Readonly<Record<string, string>> | undefined;
156
+ readonly cause?: unknown;
157
+ }
158
+ export declare class NavReceiptError extends Error {
159
+ override readonly name: string;
160
+ readonly category: NavReceiptErrorCategory;
161
+ readonly code: string | undefined;
162
+ readonly operation: NavOperation | undefined;
163
+ readonly httpStatus: number | undefined;
164
+ readonly fieldErrors: readonly NavFieldError[];
165
+ readonly hint: string | undefined;
166
+ readonly rawResponse: string | undefined;
167
+ readonly details: Readonly<Record<string, string>> | undefined;
168
+ constructor(message: string, options: NavReceiptErrorOptions);
169
+ get retryable(): boolean;
170
+ }
171
+ export declare function isNavReceiptError(error: unknown): error is NavReceiptError;
172
+ //#endregion
173
+ //#region src/nav/paper.d.ts
174
+ interface PaperReceiptEntry {
175
+ readonly number: string;
176
+ readonly vat: string;
177
+ readonly gross: number;
178
+ readonly modifying?: boolean | undefined;
179
+ }
180
+ interface PaperReceiptDay {
181
+ readonly applicableDate: DateInput;
182
+ readonly currency?: string | undefined;
183
+ readonly exchangeRate?: number | null | undefined;
184
+ readonly entries: readonly PaperReceiptEntry[];
185
+ }
186
+ export declare function paperReceiptReport(day: PaperReceiptDay): NavReceiptData;
187
+ //#endregion
188
+ //#region src/nav/parse.d.ts
189
+ export declare function parseNavResponse(operation: NavOperation, expectedRoot: string, status: number, body: string): XmlElement;
190
+ //#endregion
191
+ //#region src/nav/reconcile.d.ts
192
+ interface NavReconciledPair {
193
+ readonly local: NavReceiptData;
194
+ readonly remote: NavReportListItem;
195
+ }
196
+ interface NavMismatch extends NavReconciledPair {
197
+ readonly differences: readonly string[];
198
+ }
199
+ interface NavReconciliation {
200
+ readonly matched: readonly NavReconciledPair[];
201
+ readonly mismatched: readonly NavMismatch[];
202
+ readonly missing: readonly NavReceiptData[];
203
+ readonly unexpected: readonly NavReportListItem[];
204
+ }
205
+ export declare function reconcileNavReports(local: readonly NavReceiptData[], remote: readonly NavReportListItem[]): NavReconciliation;
206
+ //#endregion
207
+ //#region src/nav/sha3.d.ts
208
+ export declare function sha3_512(data: Uint8Array): Uint8Array;
209
+ export declare function sha3_512Hex(input: string | Uint8Array): string;
210
+ //#endregion
211
+ //#region src/nav/validate.d.ts
212
+ export declare const NAV_SERIAL_NUMBER_PATTERN: RegExp;
213
+ export declare const NAV_SOFTWARE_NAME_PATTERN: RegExp;
214
+ export declare const NAV_VAT_CATEGORY_PATTERN: RegExp;
215
+ export declare const NAV_REPORT_ID_PATTERN: RegExp;
216
+ export declare function navTaxpayerId(taxNumber: string): string;
217
+ interface ValidateNavReceiptOptions {
218
+ readonly today?: string | undefined;
219
+ }
220
+ export declare function validateNavReceiptData(data: NavReceiptData, options?: ValidateNavReceiptOptions): void;
221
+ //#endregion
222
+ //#region src/nav/xml.d.ts
223
+ export declare const NAV_RECEIPT_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/1.0/receipt";
224
+ export declare const NAV_SERVICE_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/2.0/common/service";
225
+ export declare const NAV_AUTH_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/2.0/common/authservice";
226
+ export declare const NAV_PAGING_NAMESPACE = "http://schemas.nav.gov.hu/NTCA/2.0/common/paging";
227
+ interface NavRequestContext {
228
+ readonly requestId: string;
229
+ readonly timestamp: string;
230
+ }
231
+ interface NavAuthFields {
232
+ readonly login: string;
233
+ readonly passwordHash: string;
234
+ readonly taxPayerId: string;
235
+ readonly predecessorTaxPayerId?: string | undefined;
236
+ readonly requestSignature: string;
237
+ }
238
+ export declare function buildAuthTokenXml(context: NavRequestContext, auth: NavAuthFields): string;
239
+ export declare function buildCreateReceiptXml(context: NavRequestContext, taxPayerId: string, softwareName: string, data: NavReceiptData): string;
240
+ export declare function buildModifyReceiptXml(context: NavRequestContext, id: string, taxPayerId: string, softwareName: string, data: NavReceiptData): string;
241
+ export declare function buildReceiptListXml(context: NavRequestContext, taxPayerId: string, query: NavReportQuery): string;
242
+ export declare function buildReceiptIdXml(root: "ReceiptDetailRequest" | "InvalidateReceiptRequest", context: NavRequestContext, id: string, taxPayerId: string): string;
243
+ export declare function buildCreateIssuingSoftwareXml(context: NavRequestContext, taxPayerId: string, name: string): string;
244
+ export declare function buildIssuingSoftwareListXml(context: NavRequestContext, taxPayerId: string): string;
245
+ export declare function buildContextOnlyXml(root: "VatCategoryRequest" | "CurrencyRequest", context: NavRequestContext): string;
246
+ //#endregion
247
+ export type { NavAuthFields, NavAuthToken, NavCurrencyInfo, NavEnvironment, NavErrorCodeInfo, NavFieldError, NavListAllQuery, NavMismatch, NavOperation, NavOrderDirection, NavReceiptClient, NavReceiptClientOptions, NavReceiptData, NavReceiptErrorCategory, NavReconciledPair, NavReconciliation, NavReportDetail, NavReportListItem, NavReportOrderProperty, NavReportPage, NavReportQuery, NavReportStatus, NavRequestContext, NavSubmitOptions, NavSubmitResult, NavVatCategoryAmounts, NavVatCategoryInfo, PaperReceiptDay, PaperReceiptEntry, ValidateNavReceiptOptions };