kassza 0.18.0 → 0.19.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 (190) hide show
  1. package/README.md +1 -1
  2. package/dist/batch/index.cjs +5 -7
  3. package/dist/batch/index.d.cts +5 -9
  4. package/dist/batch/index.d.ts +5 -9
  5. package/dist/batch/index.js +5 -7
  6. package/dist/{binary-B89HM03_.cjs → binary-CdpKlNNI.cjs} +1 -2
  7. package/dist/{binary-D0M9U2MD.js → binary-DuKBSfH-.js} +1 -2
  8. package/dist/cli.cjs +14 -21
  9. package/dist/cli.js +14 -21
  10. package/dist/{client-DeWWQ-RZ.d.ts → client-BT2odGYl.d.cts} +8 -36
  11. package/dist/{client-SVZu25MB.d.cts → client-C-SYCiOZ.d.ts} +8 -36
  12. package/dist/{client-Cvb9yfxU.cjs → client-I_29IPMh.cjs} +25 -37
  13. package/dist/{client-CdWEA0et.js → client-JZ1M1sZX.js} +25 -37
  14. package/dist/{context-kb33TgzE.d.ts → context-BuX6Eion.d.ts} +6 -24
  15. package/dist/{context-CFNKzStE.d.cts → context-PwqY4JOK.d.cts} +6 -24
  16. package/dist/cookie-stores/index.cjs +2 -2
  17. package/dist/cookie-stores/index.d.cts +3 -3
  18. package/dist/cookie-stores/index.d.ts +3 -3
  19. package/dist/cookie-stores/index.js +2 -2
  20. package/dist/{create-CflXrPip.js → create-BwRslos0.js} +9 -12
  21. package/dist/{create-CvUvLUaT.cjs → create-DH5jiZPA.cjs} +9 -12
  22. package/dist/{create-once-CW0x_yvp.js → create-once-B6cAXyET.js} +16 -22
  23. package/dist/{create-once-VKp0tVow.d.ts → create-once-CiGUjXut.d.ts} +3 -7
  24. package/dist/{create-once-Bh6fOWkW.d.cts → create-once-CyaVT36b.d.cts} +3 -7
  25. package/dist/{create-once-CHhDz0un.cjs → create-once-zeF7GVVP.cjs} +16 -22
  26. package/dist/{crypto-Dpn4FHQ6.cjs → crypto-B0PAHKJB.cjs} +1 -2
  27. package/dist/{crypto-usDg8L2K.js → crypto-BqGn_oGu.js} +1 -2
  28. package/dist/data-link/index.cjs +10 -13
  29. package/dist/data-link/index.d.cts +1 -5
  30. package/dist/data-link/index.d.ts +1 -5
  31. package/dist/data-link/index.js +10 -13
  32. package/dist/{dates-CXyj7Azy.js → dates-DWsZOdaO.js} +1 -2
  33. package/dist/{dates-9zvESP0i.d.cts → dates-nlGEokCf.d.cts} +0 -2
  34. package/dist/{dates-9zvESP0i.d.ts → dates-nlGEokCf.d.ts} +0 -2
  35. package/dist/{dates-CPgBodkP.cjs → dates-oOp3ypPP.cjs} +1 -2
  36. package/dist/delegation/index.cjs +9 -12
  37. package/dist/delegation/index.d.cts +3 -9
  38. package/dist/delegation/index.d.ts +3 -9
  39. package/dist/delegation/index.js +9 -12
  40. package/dist/{errors-EE96_6D_.cjs → errors-Bn6pe6yw.cjs} +12 -3
  41. package/dist/{errors-DtN4g5Z9.js → errors-CGGsW0Y5.js} +12 -3
  42. package/dist/{get-Byc9T5WO.d.cts → get-BL4Fr8-P.d.cts} +0 -2
  43. package/dist/{get-Byc9T5WO.d.ts → get-BL4Fr8-P.d.ts} +0 -2
  44. package/dist/{get-BdMTseh4.cjs → get-DFhT7kOp.cjs} +4 -5
  45. package/dist/{get-CZEShCcj.js → get-HrHwVkVt.js} +4 -5
  46. package/dist/{index-C-7yWV7L.d.cts → index-CinpAhQM.d.cts} +0 -8
  47. package/dist/{index-C-7yWV7L.d.ts → index-CinpAhQM.d.ts} +0 -8
  48. package/dist/{index-BqGgQ4t3.d.ts → index-DqoDUw6X.d.ts} +2 -20
  49. package/dist/{index-BhUPY_EH.d.cts → index-qk62lWr3.d.cts} +2 -20
  50. package/dist/index.cjs +7 -7
  51. package/dist/index.d.cts +11 -13
  52. package/dist/index.d.ts +11 -13
  53. package/dist/index.js +7 -7
  54. package/dist/ipn/index.cjs +4 -6
  55. package/dist/ipn/index.d.cts +0 -4
  56. package/dist/ipn/index.d.ts +0 -4
  57. package/dist/ipn/index.js +4 -6
  58. package/dist/{issue-Bin4tKD_.cjs → issue-DReARZnF.cjs} +12 -18
  59. package/dist/{issue-DMA1Nbr1.js → issue-Dy9zvRK1.js} +12 -18
  60. package/dist/journal/index.cjs +7 -11
  61. package/dist/journal/index.d.cts +2 -6
  62. package/dist/journal/index.d.ts +2 -6
  63. package/dist/journal/index.js +7 -11
  64. package/dist/{journal-Y9qrIB8G.d.ts → journal-BNdo07p5.d.ts} +5 -9
  65. package/dist/{journal-DvI81Kt7.d.cts → journal-DI-hOW6N.d.cts} +5 -9
  66. package/dist/{json-4y4E2xxS.cjs → json-COC9rDwf.cjs} +1 -2
  67. package/dist/json-D3Bx7NhF.d.cts +2 -0
  68. package/dist/json-D3Bx7NhF.d.ts +2 -0
  69. package/dist/{json-DjnqnaJK.js → json-as-6J7d-.js} +1 -2
  70. package/dist/mcp/index.cjs +1 -1
  71. package/dist/mcp/index.d.cts +1 -9
  72. package/dist/mcp/index.d.ts +1 -9
  73. package/dist/mcp/index.js +1 -2
  74. package/dist/money/index.cjs +3 -3
  75. package/dist/money/index.d.cts +1 -1
  76. package/dist/money/index.d.ts +1 -1
  77. package/dist/money/index.js +3 -3
  78. package/dist/{money-K9j0wPit.cjs → money-NtVytaxG.cjs} +5 -7
  79. package/dist/{money-Cw457SD6.js → money-f280VT77.js} +5 -7
  80. package/dist/nav/index.cjs +15 -22
  81. package/dist/nav/index.d.cts +2 -22
  82. package/dist/nav/index.d.ts +2 -22
  83. package/dist/nav/index.js +15 -22
  84. package/dist/{nav-BcCerwWS.js → nav-NvNgaONz.js} +5 -7
  85. package/dist/{nav-BNbc8U0R.cjs → nav-VShZkjg8.cjs} +5 -7
  86. package/dist/node/index.cjs +1 -2
  87. package/dist/node/index.d.cts +1 -3
  88. package/dist/node/index.d.ts +1 -3
  89. package/dist/node/index.js +1 -2
  90. package/dist/observe/index.cjs +3 -5
  91. package/dist/observe/index.d.cts +1 -5
  92. package/dist/observe/index.d.ts +1 -5
  93. package/dist/observe/index.js +3 -5
  94. package/dist/{once-BN_3B5OF.cjs → once-BmXfrNbQ.cjs} +2 -3
  95. package/dist/{once-CqqZxsXG.js → once-CMhDPrs7.js} +2 -3
  96. package/dist/{parse-Cr7yQ3_z.js → parse-1RiSh4vY.js} +5 -7
  97. package/dist/{parse-DOA2XQ3e.cjs → parse-CmM5va-p.cjs} +5 -7
  98. package/dist/payments/barion.cjs +7 -6
  99. package/dist/payments/barion.d.cts +4 -6
  100. package/dist/payments/barion.d.ts +4 -6
  101. package/dist/payments/barion.js +7 -6
  102. package/dist/payments/index.cjs +2 -2
  103. package/dist/payments/index.d.cts +3 -9
  104. package/dist/payments/index.d.ts +3 -9
  105. package/dist/payments/index.js +2 -2
  106. package/dist/payments/paypal.cjs +8 -7
  107. package/dist/payments/paypal.d.cts +4 -6
  108. package/dist/payments/paypal.d.ts +4 -6
  109. package/dist/payments/paypal.js +8 -7
  110. package/dist/payments/revolut.cjs +7 -6
  111. package/dist/payments/revolut.d.cts +4 -6
  112. package/dist/payments/revolut.d.ts +4 -6
  113. package/dist/payments/revolut.js +7 -6
  114. package/dist/payments/simplepay.cjs +9 -8
  115. package/dist/payments/simplepay.d.cts +4 -6
  116. package/dist/payments/simplepay.d.ts +4 -6
  117. package/dist/payments/simplepay.js +9 -8
  118. package/dist/payments/stripe.cjs +6 -6
  119. package/dist/payments/stripe.d.cts +4 -6
  120. package/dist/payments/stripe.d.ts +4 -6
  121. package/dist/payments/stripe.js +6 -6
  122. package/dist/{push-BXj0Sf0Z.d.ts → push-CTxDD3yJ.d.cts} +2 -4
  123. package/dist/{push-D4nNbCNV.d.cts → push-DJh5YkyV.d.ts} +2 -4
  124. package/dist/{reference-B5TATqb5.js → reference-Cxz0m2zF.js} +6 -7
  125. package/dist/{reference-BIdYMK0t.cjs → reference-DoY12fc1.cjs} +6 -7
  126. package/dist/reports/index.cjs +3 -4
  127. package/dist/reports/index.d.cts +1 -7
  128. package/dist/reports/index.d.ts +1 -7
  129. package/dist/reports/index.js +3 -4
  130. package/dist/{request-body-uZHMRlQr.js → request-body-BM4sbsHd.js} +2 -3
  131. package/dist/{request-body-CH6ZGOrq.cjs → request-body-BhfkJhff.cjs} +2 -3
  132. package/dist/{rounding-TxoWy2ww.cjs → rounding-CHmSK5Z2.cjs} +1 -2
  133. package/dist/{rounding-BLyHjjI5.js → rounding-CZLj4DbV.js} +1 -2
  134. package/dist/{serialize-B2eFh3D-.js → serialize-CjymGkJj.js} +2 -4
  135. package/dist/{serialize-CquIsxA-.cjs → serialize-DEU7r6Bk.cjs} +2 -4
  136. package/dist/{server-B9guio75.cjs → server-BZ-ySQGx.cjs} +23 -35
  137. package/dist/{server-yx9eG_8p.js → server-CDwsjBWk.js} +23 -35
  138. package/dist/{session-Ckl5eJhV.d.ts → session-BBbSXlx3.d.cts} +1 -3
  139. package/dist/{session-DeM5vjvC.cjs → session-BYotpR_s.cjs} +2 -4
  140. package/dist/{session-SaEEXu2N.js → session-DZeE1ryt.js} +2 -4
  141. package/dist/{session-YbChChx7.d.cts → session-mKtpAeUB.d.ts} +1 -3
  142. package/dist/{shared-CrxlxI8n.cjs → shared-BOBTXDTo.cjs} +5 -6
  143. package/dist/{shared-D6DLa4b7.js → shared-Dbcfwr8x.js} +5 -6
  144. package/dist/storage/fs.cjs +3 -4
  145. package/dist/storage/fs.d.cts +2 -4
  146. package/dist/storage/fs.d.ts +2 -4
  147. package/dist/storage/fs.js +3 -4
  148. package/dist/storage/index.cjs +16 -25
  149. package/dist/storage/index.d.cts +2 -26
  150. package/dist/storage/index.d.ts +2 -26
  151. package/dist/storage/index.js +16 -25
  152. package/dist/{store-C1rHd9DB.d.cts → store-BkaZ8qkU.d.cts} +0 -2
  153. package/dist/{store-C1rHd9DB.d.ts → store-BkaZ8qkU.d.ts} +0 -2
  154. package/dist/stores/index.cjs +2 -2
  155. package/dist/stores/index.d.cts +3 -3
  156. package/dist/stores/index.d.ts +3 -3
  157. package/dist/stores/index.js +2 -2
  158. package/dist/{stores-DhjGBrl_.js → stores-BUnPNJQl.js} +12 -22
  159. package/dist/{stores-BNrS0dWl.cjs → stores-CH4rYKs_.cjs} +12 -22
  160. package/dist/{tax-number-BdqKsxNR.js → tax-number-C6jySuGR.js} +3 -6
  161. package/dist/{tax-number-BYFkBp4A.cjs → tax-number-XLdM5ETv.cjs} +3 -6
  162. package/dist/testing/index.cjs +20 -30
  163. package/dist/testing/index.d.cts +5 -15
  164. package/dist/testing/index.d.ts +5 -15
  165. package/dist/testing/index.js +20 -30
  166. package/dist/{types-DVRgwcqg.d.cts → types-Bfs08Mrc.d.cts} +0 -2
  167. package/dist/{types-DVRgwcqg.d.ts → types-Bfs08Mrc.d.ts} +0 -2
  168. package/dist/{types-ByAEvGsZ.d.ts → types-DeuUqIvU.d.cts} +2 -4
  169. package/dist/{types-D1zDOH_F.d.ts → types-Z6rQoqHn.d.ts} +1 -3
  170. package/dist/{types-lnKkQdot.d.cts → types-_HKTOCuQ.d.cts} +1 -3
  171. package/dist/{types-B1A8mUIE.d.cts → types-oiDulesz.d.ts} +2 -4
  172. package/dist/url-CRIlLxPE.cjs +23 -0
  173. package/dist/url-DeCMiKVm.js +12 -0
  174. package/dist/validators/index.cjs +6 -10
  175. package/dist/validators/index.d.cts +0 -12
  176. package/dist/validators/index.d.ts +0 -12
  177. package/dist/validators/index.js +6 -10
  178. package/dist/{vat-v_dcWCto.js → vat-B4J5Q0tu.js} +1 -2
  179. package/dist/{vat-g35srbNG.cjs → vat-BkoiiKm4.cjs} +1 -2
  180. package/dist/{warnings-DwTl5J-2.js → warnings-DJ0QvZOp.js} +1 -2
  181. package/dist/{warnings-B3DXnveC.d.cts → warnings-DpuYhn39.d.cts} +0 -4
  182. package/dist/{warnings-B3DXnveC.d.ts → warnings-DpuYhn39.d.ts} +0 -4
  183. package/dist/{warnings-DeIw5RFj.cjs → warnings-ciSzK6Jc.cjs} +1 -2
  184. package/dist/{webhook-Ckj-_hPD.cjs → webhook-BBTebz1x.cjs} +7 -11
  185. package/dist/{webhook-D6lEejob.d.ts → webhook-C9IBUdeT.d.ts} +1 -3
  186. package/dist/{webhook-CmdhGiH5.d.cts → webhook-DF2p_m2Q.d.cts} +1 -3
  187. package/dist/{webhook-CQVShAfI.js → webhook-SFlA_nCf.js} +7 -11
  188. package/package.json +1 -1
  189. package/dist/json-B70TwoX1.d.cts +0 -4
  190. package/dist/json-B70TwoX1.d.ts +0 -4
@@ -1,6 +1,5 @@
1
- import { t as KasszaWarning } from "./warnings-B3DXnveC.js";
2
- import { n as KeyValueStore } from "./store-C1rHd9DB.js";
3
- //#region src/payments/types.d.ts
1
+ import { t as KasszaWarning } from "./warnings-DpuYhn39.cjs";
2
+ import { n as KeyValueStore } from "./store-BkaZ8qkU.cjs";
4
3
  type PaymentProvider = "stripe" | "simplepay" | "barion" | "revolut" | "paypal" | (string & {});
5
4
  type PaymentEventKind = "paid" | "refunded" | "partially-refunded" | "failed" | "other";
6
5
  interface PaymentAmount {
@@ -64,5 +63,4 @@ interface PaymentWebhookBaseOptions {
64
63
  readonly method?: string | undefined;
65
64
  readonly fetch?: typeof globalThis.fetch | undefined;
66
65
  }
67
- //#endregion
68
66
  export { PaymentEventKind as a, PaymentProvider as c, PaymentEvent as i, PaymentRefund as l, PaymentAmount as n, PaymentHandler as o, PaymentCustomer as r, PaymentLineItem as s, PaymentAddress as t, PaymentWebhookBaseOptions as u };
@@ -1,5 +1,4 @@
1
- import { S as VatRate, f as ItemPriceInput } from "./index-C-7yWV7L.js";
2
- //#region src/receipts/types.d.ts
1
+ import { S as VatRate, f as ItemPriceInput } from "./index-CinpAhQM.js";
3
2
  declare const RECEIPT_ONLY_VAT_CODES: readonly ["ÁKK", "MAA", "EU", "EUK"];
4
3
  type ReceiptOnlyVatCode = (typeof RECEIPT_ONLY_VAT_CODES)[number];
5
4
  type ReceiptVatRate = VatRate | ReceiptOnlyVatCode;
@@ -131,5 +130,4 @@ interface Receipt {
131
130
  readonly totals: ReceiptTotals;
132
131
  readonly pdf?: Uint8Array | undefined;
133
132
  }
134
- //#endregion
135
133
  export { ReceiptItem as a, ReceiptPayment as c, ReceiptTotals as d, ReceiptType as f, SendReceiptInput as h, ReceiptDefaults as i, ReceiptPaymentInput as l, ReverseReceiptInput as m, GetReceiptInput as n, ReceiptItemInput as o, ReceiptVatRate as p, Receipt as r, ReceiptOnlyVatCode as s, CreateReceiptInput as t, ReceiptPdfTemplate as u };
@@ -1,5 +1,4 @@
1
- import { S as VatRate, f as ItemPriceInput } from "./index-C-7yWV7L.cjs";
2
- //#region src/receipts/types.d.ts
1
+ import { S as VatRate, f as ItemPriceInput } from "./index-CinpAhQM.cjs";
3
2
  declare const RECEIPT_ONLY_VAT_CODES: readonly ["ÁKK", "MAA", "EU", "EUK"];
4
3
  type ReceiptOnlyVatCode = (typeof RECEIPT_ONLY_VAT_CODES)[number];
5
4
  type ReceiptVatRate = VatRate | ReceiptOnlyVatCode;
@@ -131,5 +130,4 @@ interface Receipt {
131
130
  readonly totals: ReceiptTotals;
132
131
  readonly pdf?: Uint8Array | undefined;
133
132
  }
134
- //#endregion
135
133
  export { ReceiptItem as a, ReceiptPayment as c, ReceiptTotals as d, ReceiptType as f, SendReceiptInput as h, ReceiptDefaults as i, ReceiptPaymentInput as l, ReverseReceiptInput as m, GetReceiptInput as n, ReceiptItemInput as o, ReceiptVatRate as p, Receipt as r, ReceiptOnlyVatCode as s, CreateReceiptInput as t, ReceiptPdfTemplate as u };
@@ -1,6 +1,5 @@
1
- import { t as KasszaWarning } from "./warnings-B3DXnveC.cjs";
2
- import { n as KeyValueStore } from "./store-C1rHd9DB.cjs";
3
- //#region src/payments/types.d.ts
1
+ import { t as KasszaWarning } from "./warnings-DpuYhn39.js";
2
+ import { n as KeyValueStore } from "./store-BkaZ8qkU.js";
4
3
  type PaymentProvider = "stripe" | "simplepay" | "barion" | "revolut" | "paypal" | (string & {});
5
4
  type PaymentEventKind = "paid" | "refunded" | "partially-refunded" | "failed" | "other";
6
5
  interface PaymentAmount {
@@ -64,5 +63,4 @@ interface PaymentWebhookBaseOptions {
64
63
  readonly method?: string | undefined;
65
64
  readonly fetch?: typeof globalThis.fetch | undefined;
66
65
  }
67
- //#endregion
68
66
  export { PaymentEventKind as a, PaymentProvider as c, PaymentEvent as i, PaymentRefund as l, PaymentAmount as n, PaymentHandler as o, PaymentCustomer as r, PaymentLineItem as s, PaymentAddress as t, PaymentWebhookBaseOptions as u };
@@ -0,0 +1,23 @@
1
+ // src/core/url.ts
2
+ function trimTrailingSlashes(value) {
3
+ let end = value.length;
4
+ while (end > 0 && value[end - 1] === "/") end -= 1;
5
+ return value.slice(0, end);
6
+ }
7
+ function trimSlashes(value) {
8
+ let start = 0;
9
+ while (start < value.length && value[start] === "/") start += 1;
10
+ return trimTrailingSlashes(value.slice(start));
11
+ }
12
+ Object.defineProperty(exports, "trimSlashes", {
13
+ enumerable: true,
14
+ get: function() {
15
+ return trimSlashes;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "trimTrailingSlashes", {
19
+ enumerable: true,
20
+ get: function() {
21
+ return trimTrailingSlashes;
22
+ }
23
+ });
@@ -0,0 +1,12 @@
1
+ // src/core/url.ts
2
+ function trimTrailingSlashes(value) {
3
+ let end = value.length;
4
+ while (end > 0 && value[end - 1] === "/") end -= 1;
5
+ return value.slice(0, end);
6
+ }
7
+ function trimSlashes(value) {
8
+ let start = 0;
9
+ while (start < value.length && value[start] === "/") start += 1;
10
+ return trimTrailingSlashes(value.slice(start));
11
+ }
12
+ export { trimTrailingSlashes as n, trimSlashes as t };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_tax_number = require("../tax-number-BYFkBp4A.cjs");
3
- //#region src/validators/address.ts
2
+ const require_tax_number = require("../tax-number-XLdM5ETv.cjs");
3
+ // src/validators/address.ts
4
4
  const MIN_ZIP = 1e3;
5
5
  const MAX_ZIP = 9999;
6
6
  const MAX_BUDAPEST_DISTRICT = 23;
@@ -39,7 +39,7 @@ function matchDistrict(text) {
39
39
  };
40
40
  }
41
41
  function normalizeInput(value) {
42
- return value.replace(/[\r\n]+/g, ", ").replace(/\s+/g, " ").replace(/\s*(?:,\s*)+/g, ", ").replace(/^(?:HU|H)\s*-\s*/i, "").replace(/,?\s*(?:Magyarország|Hungary)\.?$/i, "").replace(/^[\s,]+|[\s,]+$/g, "");
42
+ return value.replace(/[\r\n]+/g, ", ").replace(/\s+/g, " ").replace(/ ?(?:, ?)+/g, ", ").replace(/^(?:HU|H)\s*-\s*/i, "").replace(/,?\s*(?:Magyarország|Hungary)\.?$/i, "").replace(/^[\s,]+|[\s,]+$/g, "");
43
43
  }
44
44
  function isBudapest(city) {
45
45
  return city.toLowerCase() === "budapest";
@@ -99,15 +99,13 @@ function parseHungarianAddress(value) {
99
99
  const zipLast = /^(.+?),\s*(\d{4})\s+([^,\d][^,]*)$/.exec(text);
100
100
  if (zipLast?.[1] && zipLast[2] && zipLast[3]) return buildAddress(zipLast[2], zipLast[3], zipLast[1]);
101
101
  }
102
- //#endregion
103
- //#region src/validators/agent-key.ts
102
+ // src/validators/agent-key.ts
104
103
  function isValidAgentKey(value) {
105
104
  if (typeof value !== "string") return false;
106
105
  const key = value.trim();
107
106
  return key !== "" && !/\s/.test(key) && key === key.toLowerCase();
108
107
  }
109
- //#endregion
110
- //#region src/validators/bank-account.ts
108
+ // src/validators/bank-account.ts
111
109
  const GIRO_WEIGHTS = [
112
110
  9,
113
111
  7,
@@ -156,8 +154,7 @@ function isValidHungarianIban(value) {
156
154
  if (!require_tax_number.isDigits(iban.slice(2), 26)) return false;
157
155
  return ibanMod97(iban) === 1;
158
156
  }
159
- //#endregion
160
- //#region src/validators/eu-vat.ts
157
+ // src/validators/eu-vat.ts
161
158
  const EU_VAT_NUMBER_PATTERNS = {
162
159
  AT: /^U\d{8}$/,
163
160
  BE: /^[01]\d{9}$/,
@@ -201,7 +198,6 @@ function isValidEuVatNumber(value) {
201
198
  if (!isEuVatCountryPrefix(prefix)) return false;
202
199
  return EU_VAT_NUMBER_PATTERNS[prefix].test(normalized.slice(2));
203
200
  }
204
- //#endregion
205
201
  exports.EU_VAT_NUMBER_PATTERNS = EU_VAT_NUMBER_PATTERNS;
206
202
  exports.HUNGARIAN_TAX_COUNTY_CODES = require_tax_number.HUNGARIAN_TAX_COUNTY_CODES;
207
203
  exports.formatHungarianBankAccount = formatHungarianBankAccount;
@@ -1,4 +1,3 @@
1
- //#region src/validators/address.d.ts
2
1
  interface HungarianAddress {
3
2
  readonly zip: string;
4
3
  readonly city: string;
@@ -7,11 +6,7 @@ interface HungarianAddress {
7
6
  }
8
7
  export declare function isValidHungarianZipCode(value: string | number): boolean;
9
8
  export declare function parseHungarianAddress(value: string): HungarianAddress | undefined;
10
- //#endregion
11
- //#region src/validators/agent-key.d.ts
12
9
  export declare function isValidAgentKey(value: string): boolean;
13
- //#endregion
14
- //#region src/validators/bank-account.d.ts
15
10
  interface HungarianBankAccount {
16
11
  readonly digits: string;
17
12
  readonly bankCode: string;
@@ -22,18 +17,12 @@ export declare function parseHungarianBankAccount(value: string): HungarianBankA
22
17
  export declare function isValidHungarianBankAccount(value: string): boolean;
23
18
  export declare function formatHungarianBankAccount(value: string): string | undefined;
24
19
  export declare function isValidHungarianIban(value: string): boolean;
25
- //#endregion
26
- //#region src/validators/email.d.ts
27
20
  export declare function normalizeEmail(value: string): string;
28
21
  export declare function isValidEmail(value: string): boolean;
29
- //#endregion
30
- //#region src/validators/eu-vat.d.ts
31
22
  type EuVatCountryPrefix = "AT" | "BE" | "BG" | "CY" | "CZ" | "DE" | "DK" | "EE" | "EL" | "ES" | "FI" | "FR" | "HR" | "HU" | "IE" | "IT" | "LT" | "LU" | "LV" | "MT" | "NL" | "PL" | "PT" | "RO" | "SE" | "SI" | "SK" | "XI";
32
23
  export declare const EU_VAT_NUMBER_PATTERNS: Readonly<Record<EuVatCountryPrefix, RegExp>>;
33
24
  export declare function normalizeEuVatNumber(value: string): string;
34
25
  export declare function isValidEuVatNumber(value: string): boolean;
35
- //#endregion
36
- //#region src/validators/tax-number.d.ts
37
26
  type HungarianVatCode = "1" | "2" | "3" | "4" | "5";
38
27
  interface HungarianTaxNumber {
39
28
  readonly taxpayerId: string;
@@ -47,5 +36,4 @@ export declare function parseHungarianTaxNumber(value: string): HungarianTaxNumb
47
36
  export declare function isValidHungarianTaxNumber(value: string): boolean;
48
37
  export declare function isValidHungarianGroupTaxNumber(value: string): boolean;
49
38
  export declare function isHungarianVatGroupMemberTaxNumber(value: string): boolean;
50
- //#endregion
51
39
  export type { EuVatCountryPrefix, HungarianAddress, HungarianBankAccount, HungarianTaxNumber, HungarianVatCode };
@@ -1,4 +1,3 @@
1
- //#region src/validators/address.d.ts
2
1
  interface HungarianAddress {
3
2
  readonly zip: string;
4
3
  readonly city: string;
@@ -7,11 +6,7 @@ interface HungarianAddress {
7
6
  }
8
7
  export declare function isValidHungarianZipCode(value: string | number): boolean;
9
8
  export declare function parseHungarianAddress(value: string): HungarianAddress | undefined;
10
- //#endregion
11
- //#region src/validators/agent-key.d.ts
12
9
  export declare function isValidAgentKey(value: string): boolean;
13
- //#endregion
14
- //#region src/validators/bank-account.d.ts
15
10
  interface HungarianBankAccount {
16
11
  readonly digits: string;
17
12
  readonly bankCode: string;
@@ -22,18 +17,12 @@ export declare function parseHungarianBankAccount(value: string): HungarianBankA
22
17
  export declare function isValidHungarianBankAccount(value: string): boolean;
23
18
  export declare function formatHungarianBankAccount(value: string): string | undefined;
24
19
  export declare function isValidHungarianIban(value: string): boolean;
25
- //#endregion
26
- //#region src/validators/email.d.ts
27
20
  export declare function normalizeEmail(value: string): string;
28
21
  export declare function isValidEmail(value: string): boolean;
29
- //#endregion
30
- //#region src/validators/eu-vat.d.ts
31
22
  type EuVatCountryPrefix = "AT" | "BE" | "BG" | "CY" | "CZ" | "DE" | "DK" | "EE" | "EL" | "ES" | "FI" | "FR" | "HR" | "HU" | "IE" | "IT" | "LT" | "LU" | "LV" | "MT" | "NL" | "PL" | "PT" | "RO" | "SE" | "SI" | "SK" | "XI";
32
23
  export declare const EU_VAT_NUMBER_PATTERNS: Readonly<Record<EuVatCountryPrefix, RegExp>>;
33
24
  export declare function normalizeEuVatNumber(value: string): string;
34
25
  export declare function isValidEuVatNumber(value: string): boolean;
35
- //#endregion
36
- //#region src/validators/tax-number.d.ts
37
26
  type HungarianVatCode = "1" | "2" | "3" | "4" | "5";
38
27
  interface HungarianTaxNumber {
39
28
  readonly taxpayerId: string;
@@ -47,5 +36,4 @@ export declare function parseHungarianTaxNumber(value: string): HungarianTaxNumb
47
36
  export declare function isValidHungarianTaxNumber(value: string): boolean;
48
37
  export declare function isValidHungarianGroupTaxNumber(value: string): boolean;
49
38
  export declare function isHungarianVatGroupMemberTaxNumber(value: string): boolean;
50
- //#endregion
51
39
  export type { EuVatCountryPrefix, HungarianAddress, HungarianBankAccount, HungarianTaxNumber, HungarianVatCode };
@@ -1,5 +1,5 @@
1
- import { a as isValidHungarianTaxpayerId, c as normalizeEmail, d as weightedDigitSum, i as isValidHungarianTaxNumber, l as isDigits, n as isHungarianVatGroupMemberTaxNumber, o as parseHungarianTaxNumber, r as isValidHungarianGroupTaxNumber, s as isValidEmail, t as HUNGARIAN_TAX_COUNTY_CODES, u as stripSeparators } from "../tax-number-BdqKsxNR.js";
2
- //#region src/validators/address.ts
1
+ import { a as isValidHungarianTaxpayerId, c as normalizeEmail, d as weightedDigitSum, i as isValidHungarianTaxNumber, l as isDigits, n as isHungarianVatGroupMemberTaxNumber, o as parseHungarianTaxNumber, r as isValidHungarianGroupTaxNumber, s as isValidEmail, t as HUNGARIAN_TAX_COUNTY_CODES, u as stripSeparators } from "../tax-number-C6jySuGR.js";
2
+ // src/validators/address.ts
3
3
  const MIN_ZIP = 1e3;
4
4
  const MAX_ZIP = 9999;
5
5
  const MAX_BUDAPEST_DISTRICT = 23;
@@ -38,7 +38,7 @@ function matchDistrict(text) {
38
38
  };
39
39
  }
40
40
  function normalizeInput(value) {
41
- return value.replace(/[\r\n]+/g, ", ").replace(/\s+/g, " ").replace(/\s*(?:,\s*)+/g, ", ").replace(/^(?:HU|H)\s*-\s*/i, "").replace(/,?\s*(?:Magyarország|Hungary)\.?$/i, "").replace(/^[\s,]+|[\s,]+$/g, "");
41
+ return value.replace(/[\r\n]+/g, ", ").replace(/\s+/g, " ").replace(/ ?(?:, ?)+/g, ", ").replace(/^(?:HU|H)\s*-\s*/i, "").replace(/,?\s*(?:Magyarország|Hungary)\.?$/i, "").replace(/^[\s,]+|[\s,]+$/g, "");
42
42
  }
43
43
  function isBudapest(city) {
44
44
  return city.toLowerCase() === "budapest";
@@ -98,15 +98,13 @@ function parseHungarianAddress(value) {
98
98
  const zipLast = /^(.+?),\s*(\d{4})\s+([^,\d][^,]*)$/.exec(text);
99
99
  if (zipLast?.[1] && zipLast[2] && zipLast[3]) return buildAddress(zipLast[2], zipLast[3], zipLast[1]);
100
100
  }
101
- //#endregion
102
- //#region src/validators/agent-key.ts
101
+ // src/validators/agent-key.ts
103
102
  function isValidAgentKey(value) {
104
103
  if (typeof value !== "string") return false;
105
104
  const key = value.trim();
106
105
  return key !== "" && !/\s/.test(key) && key === key.toLowerCase();
107
106
  }
108
- //#endregion
109
- //#region src/validators/bank-account.ts
107
+ // src/validators/bank-account.ts
110
108
  const GIRO_WEIGHTS = [
111
109
  9,
112
110
  7,
@@ -155,8 +153,7 @@ function isValidHungarianIban(value) {
155
153
  if (!isDigits(iban.slice(2), 26)) return false;
156
154
  return ibanMod97(iban) === 1;
157
155
  }
158
- //#endregion
159
- //#region src/validators/eu-vat.ts
156
+ // src/validators/eu-vat.ts
160
157
  const EU_VAT_NUMBER_PATTERNS = {
161
158
  AT: /^U\d{8}$/,
162
159
  BE: /^[01]\d{9}$/,
@@ -200,5 +197,4 @@ function isValidEuVatNumber(value) {
200
197
  if (!isEuVatCountryPrefix(prefix)) return false;
201
198
  return EU_VAT_NUMBER_PATTERNS[prefix].test(normalized.slice(2));
202
199
  }
203
- //#endregion
204
200
  export { EU_VAT_NUMBER_PATTERNS, HUNGARIAN_TAX_COUNTY_CODES, formatHungarianBankAccount, isHungarianVatGroupMemberTaxNumber, isValidAgentKey, isValidEmail, isValidEuVatNumber, isValidHungarianBankAccount, isValidHungarianGroupTaxNumber, isValidHungarianIban, isValidHungarianTaxNumber, isValidHungarianTaxpayerId, isValidHungarianZipCode, normalizeEmail, normalizeEuVatNumber, parseHungarianAddress, parseHungarianBankAccount, parseHungarianTaxNumber };
@@ -1,4 +1,4 @@
1
- //#region src/money/vat.ts
1
+ // src/money/vat.ts
2
2
  const NUMERIC_VAT_RATES = [
3
3
  0,
4
4
  1,
@@ -77,5 +77,4 @@ const HUF_CURRENCIES = /* @__PURE__ */ new Set([
77
77
  function isHuf(currency) {
78
78
  return currency === void 0 || HUF_CURRENCIES.has(currency.trim());
79
79
  }
80
- //#endregion
81
80
  export { isVatRate as a, isHuf as i, SPECIAL_VAT_CODES as n, vatPercentage as o, formatVatRate as r, NUMERIC_VAT_RATES as t };
@@ -1,4 +1,4 @@
1
- //#region src/money/vat.ts
1
+ // src/money/vat.ts
2
2
  const NUMERIC_VAT_RATES = [
3
3
  0,
4
4
  1,
@@ -77,7 +77,6 @@ const HUF_CURRENCIES = /* @__PURE__ */ new Set([
77
77
  function isHuf(currency) {
78
78
  return currency === void 0 || HUF_CURRENCIES.has(currency.trim());
79
79
  }
80
- //#endregion
81
80
  Object.defineProperty(exports, "NUMERIC_VAT_RATES", {
82
81
  enumerable: true,
83
82
  get: function() {
@@ -1,4 +1,4 @@
1
- //#region src/core/warnings.ts
1
+ // src/core/warnings.ts
2
2
  function emitWarning(hook, warning, fallback = "silent") {
3
3
  if (!hook) {
4
4
  if (fallback === "console") console.warn(`[szamlazz] ${warning.message}`, warning.error);
@@ -11,5 +11,4 @@ function emitWarning(hook, warning, fallback = "silent") {
11
11
  return;
12
12
  }
13
13
  }
14
- //#endregion
15
14
  export { emitWarning as t };
@@ -1,4 +1,3 @@
1
- //#region src/core/actions.d.ts
2
1
  declare const SZAMLAZZ_AGENT_URL = "https://www.szamlazz.hu/szamla/";
3
2
  declare const AGENT_ACTIONS: {
4
3
  readonly createInvoice: "action-xmlagentxmlfile";
@@ -16,8 +15,6 @@ declare const AGENT_ACTIONS: {
16
15
  };
17
16
  type AgentAction = keyof typeof AGENT_ACTIONS;
18
17
  declare const MAX_INVOICE_ATTACHMENTS = 5;
19
- //#endregion
20
- //#region src/core/warnings.d.ts
21
18
  type KasszaWarningKind = "session" | "ledger" | "hook" | "document" | "lock" | "dedupe" | "cache";
22
19
  interface KasszaWarning {
23
20
  readonly kind: KasszaWarningKind;
@@ -27,5 +24,4 @@ interface KasszaWarning {
27
24
  readonly operation?: string | undefined;
28
25
  }
29
26
  type WarningHook = (warning: KasszaWarning) => void;
30
- //#endregion
31
27
  export { AgentAction as a, AGENT_ACTIONS as i, KasszaWarningKind as n, MAX_INVOICE_ATTACHMENTS as o, WarningHook as r, SZAMLAZZ_AGENT_URL as s, KasszaWarning as t };
@@ -1,4 +1,3 @@
1
- //#region src/core/actions.d.ts
2
1
  declare const SZAMLAZZ_AGENT_URL = "https://www.szamlazz.hu/szamla/";
3
2
  declare const AGENT_ACTIONS: {
4
3
  readonly createInvoice: "action-xmlagentxmlfile";
@@ -16,8 +15,6 @@ declare const AGENT_ACTIONS: {
16
15
  };
17
16
  type AgentAction = keyof typeof AGENT_ACTIONS;
18
17
  declare const MAX_INVOICE_ATTACHMENTS = 5;
19
- //#endregion
20
- //#region src/core/warnings.d.ts
21
18
  type KasszaWarningKind = "session" | "ledger" | "hook" | "document" | "lock" | "dedupe" | "cache";
22
19
  interface KasszaWarning {
23
20
  readonly kind: KasszaWarningKind;
@@ -27,5 +24,4 @@ interface KasszaWarning {
27
24
  readonly operation?: string | undefined;
28
25
  }
29
26
  type WarningHook = (warning: KasszaWarning) => void;
30
- //#endregion
31
27
  export { AgentAction as a, AGENT_ACTIONS as i, KasszaWarningKind as n, MAX_INVOICE_ATTACHMENTS as o, WarningHook as r, SZAMLAZZ_AGENT_URL as s, KasszaWarning as t };
@@ -1,4 +1,4 @@
1
- //#region src/core/warnings.ts
1
+ // src/core/warnings.ts
2
2
  function emitWarning(hook, warning, fallback = "silent") {
3
3
  if (!hook) {
4
4
  if (fallback === "console") console.warn(`[szamlazz] ${warning.message}`, warning.error);
@@ -11,7 +11,6 @@ function emitWarning(hook, warning, fallback = "silent") {
11
11
  return;
12
12
  }
13
13
  }
14
- //#endregion
15
14
  Object.defineProperty(exports, "emitWarning", {
16
15
  enumerable: true,
17
16
  get: function() {
@@ -1,7 +1,7 @@
1
- const require_warnings = require("./warnings-DeIw5RFj.cjs");
2
- const require_rounding = require("./rounding-TxoWy2ww.cjs");
3
- const require_request_body = require("./request-body-CH6ZGOrq.cjs");
4
- //#region src/payments/amounts.ts
1
+ const require_warnings = require("./warnings-ciSzK6Jc.cjs");
2
+ const require_rounding = require("./rounding-CHmSK5Z2.cjs");
3
+ const require_request_body = require("./request-body-BhfkJhff.cjs");
4
+ // src/payments/amounts.ts
5
5
  const ISO_ZERO_DECIMAL = /* @__PURE__ */ new Set([
6
6
  "BIF",
7
7
  "CLP",
@@ -80,8 +80,7 @@ function parseDecimalAmount(value) {
80
80
  function normalizeCurrency(currency) {
81
81
  return currency.trim().toUpperCase();
82
82
  }
83
- //#endregion
84
- //#region src/payments/errors.ts
83
+ // src/payments/errors.ts
85
84
  var WebhookVerificationError = class extends Error {
86
85
  name = "WebhookVerificationError";
87
86
  provider;
@@ -105,8 +104,7 @@ var PaymentProviderError = class extends Error {
105
104
  function isWebhookVerificationError(error) {
106
105
  return error instanceof WebhookVerificationError;
107
106
  }
108
- //#endregion
109
- //#region src/payments/body.ts
107
+ // src/payments/body.ts
110
108
  const DEFAULT_MAX_WEBHOOK_BYTES = 1048576;
111
109
  function tooLarge(provider, maxBytes) {
112
110
  return new WebhookVerificationError(provider, "payload_too_large", `A webhook törzse nagyobb a megengedett ${maxBytes} bájtnál.`);
@@ -130,8 +128,7 @@ function plainResponse(status, body) {
130
128
  headers: { "content-type": "text/plain; charset=utf-8" }
131
129
  });
132
130
  }
133
- //#endregion
134
- //#region src/payments/webhook.ts
131
+ // src/payments/webhook.ts
135
132
  const WEBHOOK_DEDUPE_KEY_PREFIX = "szamlazz:evt:";
136
133
  const DEFAULT_DEDUPE_TTL_SECONDS = 604800;
137
134
  function reportError(onError, error) {
@@ -191,7 +188,6 @@ async function deliverPayment(options, payment, prepare = (value) => value) {
191
188
  }
192
189
  return true;
193
190
  }
194
- //#endregion
195
191
  Object.defineProperty(exports, "DEFAULT_DEDUPE_TTL_SECONDS", {
196
192
  enumerable: true,
197
193
  get: function() {
@@ -1,5 +1,4 @@
1
- import { i as PaymentEvent, u as PaymentWebhookBaseOptions } from "./types-ByAEvGsZ.js";
2
- //#region src/payments/webhook.d.ts
1
+ import { i as PaymentEvent, u as PaymentWebhookBaseOptions } from "./types-oiDulesz.js";
3
2
  declare const WEBHOOK_DEDUPE_KEY_PREFIX = "szamlazz:evt:";
4
3
  declare const DEFAULT_DEDUPE_TTL_SECONDS: number;
5
4
  type WebhookHandler = (request: Request) => Promise<Response>;
@@ -7,5 +6,4 @@ declare function respondToWebhook(options: Pick<PaymentWebhookBaseOptions, "onEr
7
6
  type DedupeOptions = Pick<PaymentWebhookBaseOptions, "onPayment" | "onWarning" | "dedupe" | "dedupeTtlSeconds">;
8
7
  declare function webhookDedupeKey(payment: Pick<PaymentEvent, "provider" | "eventId">): string;
9
8
  declare function deliverPayment(options: DedupeOptions, payment: PaymentEvent, prepare?: (payment: PaymentEvent) => PaymentEvent | Promise<PaymentEvent>): Promise<boolean>;
10
- //#endregion
11
9
  export { respondToWebhook as a, deliverPayment as i, WEBHOOK_DEDUPE_KEY_PREFIX as n, webhookDedupeKey as o, WebhookHandler as r, DEFAULT_DEDUPE_TTL_SECONDS as t };
@@ -1,5 +1,4 @@
1
- import { i as PaymentEvent, u as PaymentWebhookBaseOptions } from "./types-B1A8mUIE.cjs";
2
- //#region src/payments/webhook.d.ts
1
+ import { i as PaymentEvent, u as PaymentWebhookBaseOptions } from "./types-DeuUqIvU.cjs";
3
2
  declare const WEBHOOK_DEDUPE_KEY_PREFIX = "szamlazz:evt:";
4
3
  declare const DEFAULT_DEDUPE_TTL_SECONDS: number;
5
4
  type WebhookHandler = (request: Request) => Promise<Response>;
@@ -7,5 +6,4 @@ declare function respondToWebhook(options: Pick<PaymentWebhookBaseOptions, "onEr
7
6
  type DedupeOptions = Pick<PaymentWebhookBaseOptions, "onPayment" | "onWarning" | "dedupe" | "dedupeTtlSeconds">;
8
7
  declare function webhookDedupeKey(payment: Pick<PaymentEvent, "provider" | "eventId">): string;
9
8
  declare function deliverPayment(options: DedupeOptions, payment: PaymentEvent, prepare?: (payment: PaymentEvent) => PaymentEvent | Promise<PaymentEvent>): Promise<boolean>;
10
- //#endregion
11
9
  export { respondToWebhook as a, deliverPayment as i, WEBHOOK_DEDUPE_KEY_PREFIX as n, webhookDedupeKey as o, WebhookHandler as r, DEFAULT_DEDUPE_TTL_SECONDS as t };
@@ -1,7 +1,7 @@
1
- import { t as emitWarning } from "./warnings-DwTl5J-2.js";
2
- import { r as roundMoney } from "./rounding-BLyHjjI5.js";
3
- import { t as readRequestText } from "./request-body-uZHMRlQr.js";
4
- //#region src/payments/amounts.ts
1
+ import { t as emitWarning } from "./warnings-DJ0QvZOp.js";
2
+ import { r as roundMoney } from "./rounding-CZLj4DbV.js";
3
+ import { t as readRequestText } from "./request-body-BM4sbsHd.js";
4
+ // src/payments/amounts.ts
5
5
  const ISO_ZERO_DECIMAL = /* @__PURE__ */ new Set([
6
6
  "BIF",
7
7
  "CLP",
@@ -80,8 +80,7 @@ function parseDecimalAmount(value) {
80
80
  function normalizeCurrency(currency) {
81
81
  return currency.trim().toUpperCase();
82
82
  }
83
- //#endregion
84
- //#region src/payments/errors.ts
83
+ // src/payments/errors.ts
85
84
  var WebhookVerificationError = class extends Error {
86
85
  name = "WebhookVerificationError";
87
86
  provider;
@@ -105,8 +104,7 @@ var PaymentProviderError = class extends Error {
105
104
  function isWebhookVerificationError(error) {
106
105
  return error instanceof WebhookVerificationError;
107
106
  }
108
- //#endregion
109
- //#region src/payments/body.ts
107
+ // src/payments/body.ts
110
108
  const DEFAULT_MAX_WEBHOOK_BYTES = 1048576;
111
109
  function tooLarge(provider, maxBytes) {
112
110
  return new WebhookVerificationError(provider, "payload_too_large", `A webhook törzse nagyobb a megengedett ${maxBytes} bájtnál.`);
@@ -130,8 +128,7 @@ function plainResponse(status, body) {
130
128
  headers: { "content-type": "text/plain; charset=utf-8" }
131
129
  });
132
130
  }
133
- //#endregion
134
- //#region src/payments/webhook.ts
131
+ // src/payments/webhook.ts
135
132
  const WEBHOOK_DEDUPE_KEY_PREFIX = "szamlazz:evt:";
136
133
  const DEFAULT_DEDUPE_TTL_SECONDS = 604800;
137
134
  function reportError(onError, error) {
@@ -191,5 +188,4 @@ async function deliverPayment(options, payment, prepare = (value) => value) {
191
188
  }
192
189
  return true;
193
190
  }
194
- //#endregion
195
191
  export { webhookDedupeKey as a, plainResponse as c, WebhookVerificationError as d, isWebhookVerificationError as f, parseDecimalAmount as g, normalizeCurrency as h, respondToWebhook as i, readRawBody as l, fromMinorUnits as m, WEBHOOK_DEDUPE_KEY_PREFIX as n, DEFAULT_MAX_WEBHOOK_BYTES as o, currencyExponent as p, deliverPayment as r, parseJsonObject as s, DEFAULT_DEDUPE_TTL_SECONDS as t, PaymentProviderError as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kassza",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "author": {
5
5
  "name": "futozs",
6
6
  "url": "https://github.com/futozs",
@@ -1,4 +0,0 @@
1
- //#region src/payments/json.d.ts
2
- type JsonRecord = Readonly<Record<string, unknown>>;
3
- //#endregion
4
- export { JsonRecord as t };
@@ -1,4 +0,0 @@
1
- //#region src/payments/json.d.ts
2
- type JsonRecord = Readonly<Record<string, unknown>>;
3
- //#endregion
4
- export { JsonRecord as t };