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,260 @@
1
+ import { a as optionalEl, c as childNumber, d as findChildren, l as childText, n as buildXmlDocument, s as childBoolean, u as findChild } from "./serialize-B2eFh3D-.js";
2
+ import { d as throwIfHeaderError, f as throwIfHttpError, h as unexpectedResponse, m as throwIfXmlFailure, p as throwIfTextError, s as parseResponseXml } from "./parse-Cr7yQ3_z.js";
3
+ import { l as resolveInvoiceReference, r as decodeResponsePdf, s as referenceValue, t as AGENT_XSD_BASE_URL } from "./reference-B5TATqb5.js";
4
+ //#region src/invoices/get.ts
5
+ const INVOICE_DOCUMENT_TYPE_CODES = {
6
+ invoice: "SZ",
7
+ proforma: "D",
8
+ advance: "ES",
9
+ final: "VS",
10
+ corrective: "HS",
11
+ reversal: "SS",
12
+ deliveryNote: "SL"
13
+ };
14
+ function buildGetInvoiceXml(credentials, reference, query = {}) {
15
+ const resolved = resolveInvoiceReference(reference);
16
+ return buildXmlDocument({
17
+ root: "xmlszamlaxml",
18
+ namespace: "http://www.szamlazz.hu/xmlszamlaxml",
19
+ schemaLocation: `${AGENT_XSD_BASE_URL}agentxml/xmlszamlaxml.xsd`,
20
+ children: [
21
+ ...credentials,
22
+ optionalEl("szamlaszam", referenceValue(resolved, "invoiceNumber")),
23
+ optionalEl("rendelesSzam", referenceValue(resolved, "orderNumber")),
24
+ optionalEl("pdf", query.includePdf),
25
+ optionalEl("szamlaKulsoAzon", referenceValue(resolved, "externalId"))
26
+ ]
27
+ });
28
+ }
29
+ var InvoiceReader = class {
30
+ response;
31
+ constructor(response) {
32
+ this.response = response;
33
+ }
34
+ missing(path) {
35
+ return unexpectedResponse(this.response, `Hiányzik a(z) <${path}> elem a számla XML-ből.`);
36
+ }
37
+ element(parent, name, path) {
38
+ const child = findChild(parent, name);
39
+ if (!child) throw this.missing(path);
40
+ return child;
41
+ }
42
+ text(parent, name, path) {
43
+ const value = childText(parent, name);
44
+ if (value === void 0) throw this.missing(`${path}/${name}`);
45
+ return value;
46
+ }
47
+ number(parent, name, path) {
48
+ const value = childNumber(parent, name);
49
+ if (value === void 0) throw this.missing(`${path}/${name}`);
50
+ return value;
51
+ }
52
+ };
53
+ function readAddress(element) {
54
+ if (!element) return void 0;
55
+ return {
56
+ name: childText(element, "nev"),
57
+ country: childText(element, "orszag"),
58
+ zip: childText(element, "irsz"),
59
+ city: childText(element, "telepules"),
60
+ address: childText(element, "cim")
61
+ };
62
+ }
63
+ function readSeller(root, reader) {
64
+ const seller = reader.element(root, "szallito", "szallito");
65
+ const bank = findChild(seller, "bank");
66
+ return {
67
+ id: childNumber(seller, "id"),
68
+ name: reader.text(seller, "nev", "szallito"),
69
+ address: readAddress(findChild(seller, "cim")),
70
+ postalAddress: readAddress(findChild(seller, "postacim")),
71
+ taxNumber: childText(seller, "adoszam"),
72
+ groupTaxNumber: childText(seller, "csoportazonosito"),
73
+ euTaxNumber: childText(seller, "adoszameu"),
74
+ bank: bank && {
75
+ name: childText(bank, "nev"),
76
+ accountNumber: childText(bank, "bankszamla")
77
+ }
78
+ };
79
+ }
80
+ const DOCUMENT_TYPES_BY_CODE = new Map(Object.entries(INVOICE_DOCUMENT_TYPE_CODES).map(([type, code]) => [code, type]));
81
+ const E_INVOICE_CODES = /* @__PURE__ */ new Set([2, 3]);
82
+ function readHeader(root, reader) {
83
+ const header = reader.element(root, "alap", "alap");
84
+ const typeCode = reader.text(header, "tipus", "alap");
85
+ const appearanceCode = childNumber(header, "eszamla");
86
+ return {
87
+ id: childNumber(header, "id"),
88
+ number: reader.text(header, "szamlaszam", "alap"),
89
+ economicEventId: childNumber(header, "gazdEsemAzon"),
90
+ sourceSystem: childNumber(header, "forras"),
91
+ registrationNumber: childText(header, "iktatoszam"),
92
+ type: DOCUMENT_TYPES_BY_CODE.get(typeCode) ?? "unknown",
93
+ typeCode,
94
+ eInvoice: appearanceCode !== void 0 && E_INVOICE_CODES.has(appearanceCode),
95
+ appearanceCode,
96
+ referencedInvoiceNumber: childText(header, "hivszamlaszam"),
97
+ referencedProformaNumber: childText(header, "hivdijbekszam"),
98
+ issueDate: reader.text(header, "kelt", "alap"),
99
+ fulfillmentDate: childText(header, "telj"),
100
+ dueDate: childText(header, "fizh"),
101
+ paymentMethod: childText(header, "fizmod"),
102
+ unifiedPaymentMethod: childText(header, "fizmodunified"),
103
+ cash: childBoolean(header, "keszpenz"),
104
+ orderNumber: childText(header, "rendelesszam"),
105
+ language: childText(header, "nyelv"),
106
+ currency: childText(header, "devizanem"),
107
+ exchangeBank: childText(header, "devizabank"),
108
+ exchangeRate: childNumber(header, "devizaarf"),
109
+ comment: childText(header, "megjegyzes"),
110
+ vatType: childText(header, "afatipus"),
111
+ cashAccounting: childBoolean(header, "penzforg"),
112
+ kata: childBoolean(header, "kata"),
113
+ kataLedger: childBoolean(header, "katafokonyv"),
114
+ email: childText(header, "email"),
115
+ test: childBoolean(header, "teszt"),
116
+ reversed: childBoolean(header, "sztornozott")
117
+ };
118
+ }
119
+ function readBuyerLedger(element) {
120
+ if (!element) return void 0;
121
+ return {
122
+ ledgerAccount: childText(element, "vevo"),
123
+ buyerId: childText(element, "vevoazon"),
124
+ bookingDate: childText(element, "datum"),
125
+ continuousFulfillment: childBoolean(element, "folyamatostelj"),
126
+ settlementPeriodStart: childText(element, "elszDatTol") ?? childText(element, "elszdattol"),
127
+ settlementPeriodEnd: childText(element, "elszDatIg") ?? childText(element, "elszdatig")
128
+ };
129
+ }
130
+ function readBuyer(root, reader) {
131
+ const buyer = reader.element(root, "vevo", "vevo");
132
+ return {
133
+ id: childNumber(buyer, "id"),
134
+ name: reader.text(buyer, "nev", "vevo"),
135
+ identifier: childText(buyer, "azonosito"),
136
+ address: readAddress(findChild(buyer, "cim")),
137
+ postalAddress: readAddress(findChild(buyer, "postacim")),
138
+ email: childText(buyer, "email"),
139
+ taxNumber: childText(buyer, "adoszam"),
140
+ groupTaxNumber: childText(buyer, "csoportazonosito"),
141
+ euTaxNumber: childText(buyer, "adoszameu"),
142
+ location: childNumber(buyer, "lokacio"),
143
+ privatePerson: childBoolean(buyer, "privatePersonIndicator"),
144
+ ledger: readBuyerLedger(findChild(buyer, "fokonyv"))
145
+ };
146
+ }
147
+ function readItemLedger(element) {
148
+ if (!element) return void 0;
149
+ return {
150
+ revenueLedgerAccount: childText(element, "arbevetel"),
151
+ vatLedgerAccount: childText(element, "afa"),
152
+ economicEvent: childText(element, "gazdasagiesemeny"),
153
+ vatEconomicEvent: childText(element, "gazdasagiesemenyafa"),
154
+ settlementPeriodStart: childText(element, "elszdattol"),
155
+ settlementPeriodEnd: childText(element, "elszdatig")
156
+ };
157
+ }
158
+ function readItem(item, reader) {
159
+ const path = "tetelek/tetel";
160
+ return {
161
+ name: reader.text(item, "nev", path),
162
+ identifier: childText(item, "azonosito"),
163
+ quantity: reader.number(item, "mennyiseg", path),
164
+ unit: childText(item, "mennyisegiegyseg"),
165
+ netUnitPrice: reader.number(item, "nettoegysegar", path),
166
+ vat: reader.number(item, "afakulcs", path),
167
+ vatCode: childText(item, "afatipus"),
168
+ netAmount: reader.number(item, "netto", path),
169
+ marginVatBase: childNumber(item, "arresafaalap"),
170
+ vatAmount: reader.number(item, "afa", path),
171
+ grossAmount: reader.number(item, "brutto", path),
172
+ comment: childText(item, "megjegyzes"),
173
+ position: childNumber(item, "sztetordering"),
174
+ ledger: readItemLedger(findChild(item, "fokonyv"))
175
+ };
176
+ }
177
+ function readLabels(element) {
178
+ return findChildren(element, "cimke").flatMap((label) => {
179
+ const value = label.text.trim();
180
+ return value === "" ? [] : [value];
181
+ });
182
+ }
183
+ function readFinancialItem(item, reader) {
184
+ const path = "qutetek/qutet";
185
+ return {
186
+ name: reader.text(item, "nev", path),
187
+ vat: reader.number(item, "afakulcs", path),
188
+ vatCode: childText(item, "afatipus"),
189
+ netAmount: reader.number(item, "netto", path),
190
+ vatAmount: reader.number(item, "afa", path),
191
+ grossAmount: reader.number(item, "brutto", path),
192
+ settlementPeriodStart: childText(item, "elszdattol"),
193
+ settlementPeriodEnd: childText(item, "elszdatig"),
194
+ vatDeduction: childNumber(item, "afalevon"),
195
+ labels: readLabels(findChild(item, "cimkek"))
196
+ };
197
+ }
198
+ function readTotals(root, reader) {
199
+ const totals = reader.element(root, "osszegek", "osszegek");
200
+ const total = reader.element(totals, "totalossz", "osszegek/totalossz");
201
+ const path = "osszegek/totalossz";
202
+ return {
203
+ netAmount: reader.number(total, "netto", path),
204
+ vatAmount: reader.number(total, "afa", path),
205
+ grossAmount: reader.number(total, "brutto", path),
206
+ byVat: findChildren(totals, "afakulcsossz").map((entry) => ({
207
+ vat: reader.number(entry, "afakulcs", "osszegek/afakulcsossz"),
208
+ vatCode: childText(entry, "afatipus"),
209
+ netAmount: reader.number(entry, "netto", "osszegek/afakulcsossz"),
210
+ vatAmount: reader.number(entry, "afa", "osszegek/afakulcsossz"),
211
+ grossAmount: reader.number(entry, "brutto", "osszegek/afakulcsossz")
212
+ }))
213
+ };
214
+ }
215
+ function readPayment(payment, reader) {
216
+ const path = "kifizetesek/kifizetes";
217
+ return {
218
+ date: reader.text(payment, "datum", path),
219
+ method: reader.text(payment, "jogcim", path),
220
+ amount: reader.number(payment, "osszeg", path),
221
+ comment: childText(payment, "megjegyzes"),
222
+ bankAccountNumber: childText(payment, "bankszamlaszam"),
223
+ bankTransactionId: childNumber(payment, "banktranzid"),
224
+ exchangeRate: childNumber(payment, "devizaarf")
225
+ };
226
+ }
227
+ function parseInvoiceDetailsXml(root, response) {
228
+ const reader = new InvoiceReader(response);
229
+ return {
230
+ seller: readSeller(root, reader),
231
+ header: readHeader(root, reader),
232
+ buyer: readBuyer(root, reader),
233
+ items: findChildren(findChild(root, "tetelek"), "tetel").map((item) => readItem(item, reader)),
234
+ financialItems: findChildren(findChild(root, "qutetek"), "qutet").map((item) => readFinancialItem(item, reader)),
235
+ labels: readLabels(findChild(root, "cimkek")),
236
+ totals: readTotals(root, reader),
237
+ payments: findChildren(findChild(root, "kifizetesek"), "kifizetes").map((payment) => readPayment(payment, reader)),
238
+ pdf: decodeResponsePdf(root, response)
239
+ };
240
+ }
241
+ function parseGetInvoiceResponse(response) {
242
+ throwIfHeaderError(response);
243
+ throwIfTextError(response);
244
+ throwIfHttpError(response);
245
+ const root = parseResponseXml(response);
246
+ throwIfXmlFailure(root, response);
247
+ if (root.name !== "szamla") throw unexpectedResponse(response, "A számla XML (<szamla>) helyett más válasz érkezett.");
248
+ return parseInvoiceDetailsXml(root, response);
249
+ }
250
+ async function getInvoice(ctx, reference, query = {}, options = {}) {
251
+ const xml = buildGetInvoiceXml(ctx.credentials, reference, query);
252
+ return ctx.execute({
253
+ action: "getInvoiceXml",
254
+ xml,
255
+ signal: options.signal,
256
+ safeToRetry: true
257
+ }, parseGetInvoiceResponse);
258
+ }
259
+ //#endregion
260
+ export { parseInvoiceDetailsXml as n, getInvoice as t };
@@ -0,0 +1,109 @@
1
+ import { n as KeyValueStore, r as StoreCapabilities } from "./store-C1rHd9DB.cjs";
2
+ import { t as CookieStore } from "./session-YbChChx7.cjs";
3
+ //#region src/cookie-stores/resilient.d.ts
4
+ type CookieStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
5
+ interface CookieStoreErrorEvent {
6
+ readonly operation: CookieStoreOperation;
7
+ readonly key: string;
8
+ readonly error: unknown;
9
+ }
10
+ interface ResilientCookieStoreOptions {
11
+ readonly onError?: ((event: CookieStoreErrorEvent) => void) | undefined;
12
+ readonly timeoutMs?: number | undefined;
13
+ }
14
+ declare function resilientCookieStore(store: CookieStore, options?: ResilientCookieStoreOptions): CookieStore;
15
+ //#endregion
16
+ //#region src/cookie-stores/shared.d.ts
17
+ interface CookieStoreAdapterOptions extends ResilientCookieStoreOptions {
18
+ readonly prefix?: string | undefined;
19
+ readonly resilient?: boolean | undefined;
20
+ }
21
+ //#endregion
22
+ //#region src/cookie-stores/cloudflare-kv.d.ts
23
+ declare const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
24
+ interface CloudflareKvNamespaceLike {
25
+ get(key: string): Promise<string | null>;
26
+ put(key: string, value: string, options: {
27
+ expirationTtl: number;
28
+ }): Promise<void>;
29
+ delete(key: string): Promise<void>;
30
+ }
31
+ declare function cloudflareKvCookieStore(namespace: CloudflareKvNamespaceLike, options?: CookieStoreAdapterOptions): CookieStore;
32
+ //#endregion
33
+ //#region src/cookie-stores/custom.d.ts
34
+ declare function customCookieStore(store: CookieStore, options?: CookieStoreAdapterOptions): CookieStore;
35
+ //#endregion
36
+ //#region src/cookie-stores/ioredis.d.ts
37
+ interface IoRedisLike {
38
+ get(key: string): Promise<unknown>;
39
+ set(key: string, value: string, expiryMode: "EX", seconds: number): Promise<unknown>;
40
+ del(key: string): Promise<unknown>;
41
+ eval?(script: string, numKeys: number, ...args: string[]): Promise<unknown>;
42
+ }
43
+ declare function ioredisCookieStore(redis: IoRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
44
+ //#endregion
45
+ //#region src/cookie-stores/node-redis.d.ts
46
+ interface NodeRedisLike {
47
+ get(key: string): Promise<unknown>;
48
+ set(key: string, value: string, options: {
49
+ EX: number;
50
+ }): Promise<unknown>;
51
+ del(key: string): Promise<unknown>;
52
+ eval?(script: string, options: {
53
+ keys: string[];
54
+ arguments: string[];
55
+ }): Promise<unknown>;
56
+ }
57
+ declare function nodeRedisCookieStore(client: NodeRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
58
+ //#endregion
59
+ //#region src/cookie-stores/upstash.d.ts
60
+ interface UpstashRedisLike {
61
+ get(key: string): Promise<unknown>;
62
+ set(key: string, value: string, options: {
63
+ ex: number;
64
+ }): Promise<unknown>;
65
+ del(key: string): Promise<unknown>;
66
+ eval?(script: string, keys: string[], args: string[]): Promise<unknown>;
67
+ }
68
+ declare function upstashRedisCookieStore(redis: UpstashRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
69
+ //#endregion
70
+ //#region src/stores/diagnose.d.ts
71
+ interface StoreSuitability {
72
+ readonly session: boolean;
73
+ readonly attemptLedger: boolean;
74
+ readonly createOnceLock: boolean;
75
+ readonly journal: boolean;
76
+ readonly webhookDedupe: boolean;
77
+ }
78
+ interface StoreDiagnosis {
79
+ readonly ok: boolean;
80
+ readonly capabilities: StoreCapabilities;
81
+ readonly suitableFor: StoreSuitability;
82
+ readonly latencyMs: number;
83
+ readonly problems: readonly string[];
84
+ }
85
+ interface DiagnoseStoreOptions {
86
+ readonly keyPrefix?: string | undefined;
87
+ readonly now?: (() => number) | undefined;
88
+ }
89
+ declare function diagnoseStore(store: KeyValueStore, options?: DiagnoseStoreOptions): Promise<StoreDiagnosis>;
90
+ //#endregion
91
+ //#region src/stores/durable-object.d.ts
92
+ interface DurableObjectStorageLike {
93
+ get(key: string): Promise<unknown>;
94
+ put(key: string, value: DurableObjectStoreEntry): Promise<void>;
95
+ delete(key: string): Promise<boolean>;
96
+ }
97
+ interface DurableObjectStubLike {
98
+ fetch(input: string, init: RequestInit): Promise<Response>;
99
+ }
100
+ interface DurableObjectStoreEntry {
101
+ readonly value: string;
102
+ readonly expiresAt: number;
103
+ }
104
+ type DurableObjectStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
105
+ declare const DURABLE_OBJECT_STORE_URL = "https://kassza-store.internal/";
106
+ declare function handleDurableObjectStoreRequest(storage: DurableObjectStorageLike, request: Request): Promise<Response>;
107
+ declare function durableObjectStore(stub: DurableObjectStubLike): KeyValueStore;
108
+ //#endregion
109
+ export { CookieStoreErrorEvent as C, resilientCookieStore as E, CookieStoreAdapterOptions as S, ResilientCookieStoreOptions as T, ioredisCookieStore as _, DurableObjectStubLike as a, CloudflareKvNamespaceLike as b, DiagnoseStoreOptions as c, diagnoseStore as d, UpstashRedisLike as f, IoRedisLike as g, nodeRedisCookieStore as h, DurableObjectStoreOperation as i, StoreDiagnosis as l, NodeRedisLike as m, DurableObjectStorageLike as n, durableObjectStore as o, upstashRedisCookieStore as p, DurableObjectStoreEntry as r, handleDurableObjectStoreRequest as s, DURABLE_OBJECT_STORE_URL as t, StoreSuitability as u, customCookieStore as v, CookieStoreOperation as w, cloudflareKvCookieStore as x, CLOUDFLARE_KV_MIN_TTL_SECONDS as y };
@@ -0,0 +1,109 @@
1
+ import { n as KeyValueStore, r as StoreCapabilities } from "./store-C1rHd9DB.js";
2
+ import { t as CookieStore } from "./session-Ckl5eJhV.js";
3
+ //#region src/cookie-stores/resilient.d.ts
4
+ type CookieStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
5
+ interface CookieStoreErrorEvent {
6
+ readonly operation: CookieStoreOperation;
7
+ readonly key: string;
8
+ readonly error: unknown;
9
+ }
10
+ interface ResilientCookieStoreOptions {
11
+ readonly onError?: ((event: CookieStoreErrorEvent) => void) | undefined;
12
+ readonly timeoutMs?: number | undefined;
13
+ }
14
+ declare function resilientCookieStore(store: CookieStore, options?: ResilientCookieStoreOptions): CookieStore;
15
+ //#endregion
16
+ //#region src/cookie-stores/shared.d.ts
17
+ interface CookieStoreAdapterOptions extends ResilientCookieStoreOptions {
18
+ readonly prefix?: string | undefined;
19
+ readonly resilient?: boolean | undefined;
20
+ }
21
+ //#endregion
22
+ //#region src/cookie-stores/cloudflare-kv.d.ts
23
+ declare const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
24
+ interface CloudflareKvNamespaceLike {
25
+ get(key: string): Promise<string | null>;
26
+ put(key: string, value: string, options: {
27
+ expirationTtl: number;
28
+ }): Promise<void>;
29
+ delete(key: string): Promise<void>;
30
+ }
31
+ declare function cloudflareKvCookieStore(namespace: CloudflareKvNamespaceLike, options?: CookieStoreAdapterOptions): CookieStore;
32
+ //#endregion
33
+ //#region src/cookie-stores/custom.d.ts
34
+ declare function customCookieStore(store: CookieStore, options?: CookieStoreAdapterOptions): CookieStore;
35
+ //#endregion
36
+ //#region src/cookie-stores/ioredis.d.ts
37
+ interface IoRedisLike {
38
+ get(key: string): Promise<unknown>;
39
+ set(key: string, value: string, expiryMode: "EX", seconds: number): Promise<unknown>;
40
+ del(key: string): Promise<unknown>;
41
+ eval?(script: string, numKeys: number, ...args: string[]): Promise<unknown>;
42
+ }
43
+ declare function ioredisCookieStore(redis: IoRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
44
+ //#endregion
45
+ //#region src/cookie-stores/node-redis.d.ts
46
+ interface NodeRedisLike {
47
+ get(key: string): Promise<unknown>;
48
+ set(key: string, value: string, options: {
49
+ EX: number;
50
+ }): Promise<unknown>;
51
+ del(key: string): Promise<unknown>;
52
+ eval?(script: string, options: {
53
+ keys: string[];
54
+ arguments: string[];
55
+ }): Promise<unknown>;
56
+ }
57
+ declare function nodeRedisCookieStore(client: NodeRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
58
+ //#endregion
59
+ //#region src/cookie-stores/upstash.d.ts
60
+ interface UpstashRedisLike {
61
+ get(key: string): Promise<unknown>;
62
+ set(key: string, value: string, options: {
63
+ ex: number;
64
+ }): Promise<unknown>;
65
+ del(key: string): Promise<unknown>;
66
+ eval?(script: string, keys: string[], args: string[]): Promise<unknown>;
67
+ }
68
+ declare function upstashRedisCookieStore(redis: UpstashRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
69
+ //#endregion
70
+ //#region src/stores/diagnose.d.ts
71
+ interface StoreSuitability {
72
+ readonly session: boolean;
73
+ readonly attemptLedger: boolean;
74
+ readonly createOnceLock: boolean;
75
+ readonly journal: boolean;
76
+ readonly webhookDedupe: boolean;
77
+ }
78
+ interface StoreDiagnosis {
79
+ readonly ok: boolean;
80
+ readonly capabilities: StoreCapabilities;
81
+ readonly suitableFor: StoreSuitability;
82
+ readonly latencyMs: number;
83
+ readonly problems: readonly string[];
84
+ }
85
+ interface DiagnoseStoreOptions {
86
+ readonly keyPrefix?: string | undefined;
87
+ readonly now?: (() => number) | undefined;
88
+ }
89
+ declare function diagnoseStore(store: KeyValueStore, options?: DiagnoseStoreOptions): Promise<StoreDiagnosis>;
90
+ //#endregion
91
+ //#region src/stores/durable-object.d.ts
92
+ interface DurableObjectStorageLike {
93
+ get(key: string): Promise<unknown>;
94
+ put(key: string, value: DurableObjectStoreEntry): Promise<void>;
95
+ delete(key: string): Promise<boolean>;
96
+ }
97
+ interface DurableObjectStubLike {
98
+ fetch(input: string, init: RequestInit): Promise<Response>;
99
+ }
100
+ interface DurableObjectStoreEntry {
101
+ readonly value: string;
102
+ readonly expiresAt: number;
103
+ }
104
+ type DurableObjectStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
105
+ declare const DURABLE_OBJECT_STORE_URL = "https://kassza-store.internal/";
106
+ declare function handleDurableObjectStoreRequest(storage: DurableObjectStorageLike, request: Request): Promise<Response>;
107
+ declare function durableObjectStore(stub: DurableObjectStubLike): KeyValueStore;
108
+ //#endregion
109
+ export { CookieStoreErrorEvent as C, resilientCookieStore as E, CookieStoreAdapterOptions as S, ResilientCookieStoreOptions as T, ioredisCookieStore as _, DurableObjectStubLike as a, CloudflareKvNamespaceLike as b, DiagnoseStoreOptions as c, diagnoseStore as d, UpstashRedisLike as f, IoRedisLike as g, nodeRedisCookieStore as h, DurableObjectStoreOperation as i, StoreDiagnosis as l, NodeRedisLike as m, DurableObjectStorageLike as n, durableObjectStore as o, upstashRedisCookieStore as p, DurableObjectStoreEntry as r, handleDurableObjectStoreRequest as s, DURABLE_OBJECT_STORE_URL as t, StoreSuitability as u, customCookieStore as v, CookieStoreOperation as w, cloudflareKvCookieStore as x, CLOUDFLARE_KV_MIN_TTL_SECONDS as y };
@@ -48,9 +48,32 @@ interface DocumentTotals {
48
48
  }
49
49
  declare function summarizeItems(items: readonly ItemAmounts[]): DocumentTotals;
50
50
  //#endregion
51
+ //#region src/money/refund.d.ts
52
+ type RefundVat = string | number;
53
+ interface RefundableItem<V extends RefundVat = VatRate> {
54
+ readonly name: string;
55
+ readonly vat: V;
56
+ readonly grossAmount: number;
57
+ readonly unit?: string | undefined;
58
+ readonly identifier?: string | undefined;
59
+ }
60
+ interface RefundAllocation<V extends RefundVat = VatRate> {
61
+ readonly index: number;
62
+ readonly name: string;
63
+ readonly vat: V;
64
+ readonly grossAmount: number;
65
+ readonly unit?: string | undefined;
66
+ readonly identifier?: string | undefined;
67
+ }
68
+ interface AllocateRefundOptions {
69
+ readonly decimals?: number | undefined;
70
+ readonly refundedBefore?: number | undefined;
71
+ }
72
+ declare function allocateRefund<V extends RefundVat = VatRate>(items: readonly RefundableItem<V>[], refundGross: number, options?: AllocateRefundOptions): RefundAllocation<V>[];
73
+ //#endregion
51
74
  //#region src/money/rounding.d.ts
52
75
  declare function roundMoney(value: number, decimals?: number): number;
53
76
  declare function decimalPlaces(value: number): number;
54
77
  declare function addMoney(...values: number[]): number;
55
78
  //#endregion
56
- export { VatRate as _, DocumentTotals as a, isVatRate as b, VatBreakdown as c, calculateReceiptItem as d, summarizeItems as f, SpecialVatCode as g, SPECIAL_VAT_CODES as h, DocumentKind as i, calculateInvoiceItem as l, NumericVatRate as m, decimalPlaces as n, ItemAmounts as o, NUMERIC_VAT_RATES as p, roundMoney as r, ItemPriceInput as s, addMoney as t, calculateItemAmounts as u, formatVatRate as v, vatPercentage as x, isHuf as y };
79
+ export { formatVatRate as C, vatPercentage as E, VatRate as S, isVatRate as T, summarizeItems as _, RefundAllocation as a, SPECIAL_VAT_CODES as b, allocateRefund as c, ItemAmounts as d, ItemPriceInput as f, calculateReceiptItem as g, calculateItemAmounts as h, AllocateRefundOptions as i, DocumentKind as l, calculateInvoiceItem as m, decimalPlaces as n, RefundVat as o, VatBreakdown as p, roundMoney as r, RefundableItem as s, addMoney as t, DocumentTotals as u, NUMERIC_VAT_RATES as v, isHuf as w, SpecialVatCode as x, NumericVatRate as y };
@@ -48,9 +48,32 @@ interface DocumentTotals {
48
48
  }
49
49
  declare function summarizeItems(items: readonly ItemAmounts[]): DocumentTotals;
50
50
  //#endregion
51
+ //#region src/money/refund.d.ts
52
+ type RefundVat = string | number;
53
+ interface RefundableItem<V extends RefundVat = VatRate> {
54
+ readonly name: string;
55
+ readonly vat: V;
56
+ readonly grossAmount: number;
57
+ readonly unit?: string | undefined;
58
+ readonly identifier?: string | undefined;
59
+ }
60
+ interface RefundAllocation<V extends RefundVat = VatRate> {
61
+ readonly index: number;
62
+ readonly name: string;
63
+ readonly vat: V;
64
+ readonly grossAmount: number;
65
+ readonly unit?: string | undefined;
66
+ readonly identifier?: string | undefined;
67
+ }
68
+ interface AllocateRefundOptions {
69
+ readonly decimals?: number | undefined;
70
+ readonly refundedBefore?: number | undefined;
71
+ }
72
+ declare function allocateRefund<V extends RefundVat = VatRate>(items: readonly RefundableItem<V>[], refundGross: number, options?: AllocateRefundOptions): RefundAllocation<V>[];
73
+ //#endregion
51
74
  //#region src/money/rounding.d.ts
52
75
  declare function roundMoney(value: number, decimals?: number): number;
53
76
  declare function decimalPlaces(value: number): number;
54
77
  declare function addMoney(...values: number[]): number;
55
78
  //#endregion
56
- export { VatRate as _, DocumentTotals as a, isVatRate as b, VatBreakdown as c, calculateReceiptItem as d, summarizeItems as f, SpecialVatCode as g, SPECIAL_VAT_CODES as h, DocumentKind as i, calculateInvoiceItem as l, NumericVatRate as m, decimalPlaces as n, ItemAmounts as o, NUMERIC_VAT_RATES as p, roundMoney as r, ItemPriceInput as s, addMoney as t, calculateItemAmounts as u, formatVatRate as v, vatPercentage as x, isHuf as y };
79
+ export { formatVatRate as C, vatPercentage as E, VatRate as S, isVatRate as T, summarizeItems as _, RefundAllocation as a, SPECIAL_VAT_CODES as b, allocateRefund as c, ItemAmounts as d, ItemPriceInput as f, calculateReceiptItem as g, calculateItemAmounts as h, AllocateRefundOptions as i, DocumentKind as l, calculateInvoiceItem as m, decimalPlaces as n, RefundVat as o, VatBreakdown as p, roundMoney as r, RefundableItem as s, addMoney as t, DocumentTotals as u, NUMERIC_VAT_RATES as v, isHuf as w, SpecialVatCode as x, NumericVatRate as y };
package/dist/index.cjs CHANGED
@@ -1,31 +1,45 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_once = require("./create-once-D0pwuenl.cjs");
3
- const require_errors = require("./errors-DxeuTslP.cjs");
4
- const require_client = require("./client-CsmGIFRS.cjs");
2
+ const require_create_once = require("./create-once-9yxR_Er_.cjs");
3
+ const require_errors = require("./errors-EE96_6D_.cjs");
4
+ const require_client = require("./client-CLFvJCVW.cjs");
5
5
  const require_binary = require("./binary-B89HM03_.cjs");
6
- const require_issue = require("./issue-BsyYdrIG.cjs");
7
- const require_session = require("./session-CKOuE6Jc.cjs");
6
+ const require_session = require("./session-DeM5vjvC.cjs");
7
+ const require_issue = require("./issue-Bin4tKD_.cjs");
8
8
  const require_dates = require("./dates-CPgBodkP.cjs");
9
9
  exports.AGENT_ACTIONS = require_create_once.AGENT_ACTIONS;
10
10
  exports.AGENT_ERROR_CODES = require_errors.AGENT_ERROR_CODES;
11
11
  exports.ATTEMPT_LEDGER_KEY_PREFIX = require_client.ATTEMPT_LEDGER_KEY_PREFIX;
12
12
  exports.ATTEMPT_LEDGER_TTL_SECONDS = require_client.ATTEMPT_LEDGER_TTL_SECONDS;
13
+ exports.DEFAULT_LOCK_TTL_SECONDS = require_issue.DEFAULT_LOCK_TTL_SECONDS;
14
+ exports.DEFAULT_LOCK_WAIT_MS = require_issue.DEFAULT_LOCK_WAIT_MS;
15
+ exports.DEFAULT_TAXPAYER_INVALID_TTL_SECONDS = require_client.DEFAULT_TAXPAYER_INVALID_TTL_SECONDS;
16
+ exports.DEFAULT_TAXPAYER_TTL_SECONDS = require_client.DEFAULT_TAXPAYER_TTL_SECONDS;
17
+ exports.DocumentHookError = require_create_once.DocumentHookError;
18
+ exports.KASSZA_ERROR_DOCS_URL = require_errors.KASSZA_ERROR_DOCS_URL;
13
19
  exports.MAX_INVOICE_ATTACHMENTS = require_create_once.MAX_INVOICE_ATTACHMENTS;
20
+ exports.ONCE_LOCK_KEY_PREFIX = require_issue.ONCE_LOCK_KEY_PREFIX;
14
21
  exports.RECEIPT_MAX_GROSS_HUF = require_issue.RECEIPT_MAX_GROSS_HUF;
15
22
  exports.SZAMLAZZ_AGENT_URL = require_create_once.SZAMLAZZ_AGENT_URL;
16
23
  exports.SzamlazzError = require_errors.SzamlazzError;
24
+ exports.TAXPAYER_CACHE_KEY_PREFIX = require_client.TAXPAYER_CACHE_KEY_PREFIX;
17
25
  exports.addBudapestDays = require_dates.addBudapestDays;
18
26
  exports.attemptLedgerKey = require_client.attemptLedgerKey;
19
27
  exports.buyerFromCustomer = require_issue.buyerFromCustomer;
20
28
  exports.bytesToBase64 = require_binary.bytesToBase64;
21
29
  exports.chooseDocument = require_issue.chooseDocument;
22
30
  exports.conversionExternalId = require_issue.conversionExternalId;
31
+ exports.correctionExternalId = require_issue.correctionExternalId;
23
32
  exports.createKassza = require_client.createKassza;
33
+ exports.errorCodeDocsUrl = require_errors.errorCodeDocsUrl;
24
34
  exports.invoiceOnceExternalId = require_issue.invoiceOnceExternalId;
35
+ exports.isDocumentHookError = require_create_once.isDocumentHookError;
25
36
  exports.isSzamlazzError = require_errors.isSzamlazzError;
26
37
  exports.issueForPayment = require_issue.issueForPayment;
27
38
  exports.memoryCookieStore = require_session.memoryCookieStore;
39
+ exports.memoryStore = require_session.memoryStore;
40
+ exports.paymentMarker = require_create_once.paymentMarker;
28
41
  exports.paymentOrderNumber = require_issue.paymentOrderNumber;
42
+ exports.storeCapabilities = require_session.storeCapabilities;
29
43
  exports.suggestedPrefix = require_errors.suggestedPrefix;
30
44
  exports.toBudapestDate = require_dates.toBudapestDate;
31
45
  exports.toBudapestTimestamp = require_dates.toBudapestTimestamp;