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,224 @@
1
+ import { r as SzamlazzError } from "../errors-DtN4g5Z9.js";
2
+ import { i as encodeUtf8 } from "../binary-D0M9U2MD.js";
3
+ import { a as optionalEl, c as childNumber, d as findChildren, f as parseXml, l as childText, n as buildXmlDocument, o as XmlParseError, r as el, s as childBoolean, u as findChild } from "../serialize-B2eFh3D-.js";
4
+ import { r as createAgentResponse, t as parseReceiptElement } from "../parse-Cr7yQ3_z.js";
5
+ import { n as parseInvoiceDetailsXml } from "../get-CZEShCcj.js";
6
+ import { a as timingSafeEqual } from "../crypto-usDg8L2K.js";
7
+ import { t as readRequestText } from "../request-body-uZHMRlQr.js";
8
+ //#region src/data-link/push.ts
9
+ var DataLinkError = class extends Error {
10
+ name = "DataLinkError";
11
+ reason;
12
+ constructor(reason, message, cause) {
13
+ super(message, cause === void 0 ? void 0 : { cause });
14
+ this.reason = reason;
15
+ }
16
+ };
17
+ const ROOT_KINDS = /* @__PURE__ */ new Map([
18
+ ["szamla", "invoice"],
19
+ ["szamlabe", "incoming-invoice"],
20
+ ["banktranz", "bank-transaction"],
21
+ ["xmlnyugtaarchiv", "receipts"]
22
+ ]);
23
+ function invalid(message, cause) {
24
+ return new DataLinkError("invalid_payload", message, cause);
25
+ }
26
+ function requiredText(element, name, path) {
27
+ const value = childText(element, name);
28
+ if (value === void 0) throw invalid(`Hiányzik a(z) <${path}/${name}> elem.`);
29
+ return value;
30
+ }
31
+ function requiredInteger(element, name, path) {
32
+ const value = Number(requiredText(element, name, path));
33
+ if (!Number.isInteger(value)) throw invalid(`A(z) <${path}/${name}> nem egész szám.`);
34
+ return value;
35
+ }
36
+ function wrapSzamlazzError(read) {
37
+ try {
38
+ return read();
39
+ } catch (error) {
40
+ if (error instanceof SzamlazzError) throw invalid(error.message, error);
41
+ throw error;
42
+ }
43
+ }
44
+ function invoicePush(kind, root, raw, key) {
45
+ const header = findChild(root, "alap");
46
+ const id = requiredInteger(header, "id", "alap");
47
+ const response = createAgentResponse("getInvoiceXml", 200, new Headers(), encodeUtf8(raw));
48
+ return {
49
+ kind,
50
+ key,
51
+ raw,
52
+ id,
53
+ invoice: wrapSzamlazzError(() => parseInvoiceDetailsXml(root, response)),
54
+ deleted: childBoolean(header, "dobdel") === true
55
+ };
56
+ }
57
+ function bankTransactionPush(root, raw, key) {
58
+ const direction = requiredText(root, "irany", "banktranz");
59
+ if (direction !== "BE" && direction !== "KI") throw invalid(`Ismeretlen banki tranzakció irány: ${direction}.`);
60
+ const amount = childNumber(root, "osszeg");
61
+ if (amount === void 0) throw invalid("Hiányzik a(z) <banktranz/osszeg> elem.");
62
+ const partner = findChild(root, "partner");
63
+ return {
64
+ kind: "bank-transaction",
65
+ key,
66
+ raw,
67
+ transaction: {
68
+ id: requiredInteger(root, "id", "banktranz"),
69
+ accountNumber: requiredText(root, "bankszamla", "banktranz"),
70
+ valueDate: requiredText(root, "erteknap", "banktranz"),
71
+ direction: direction === "BE" ? "in" : "out",
72
+ type: childText(root, "tipus"),
73
+ technical: childBoolean(root, "technikai") === true,
74
+ amount,
75
+ currency: requiredText(root, "devizanem", "banktranz"),
76
+ partner: partner && {
77
+ name: childText(partner, "nev"),
78
+ accountNumber: childText(partner, "bankszamla")
79
+ },
80
+ reference: childText(root, "kozlemeny")
81
+ }
82
+ };
83
+ }
84
+ function receiptsPush(root, raw, key) {
85
+ const response = createAgentResponse("getReceipt", 200, new Headers(), encodeUtf8(raw));
86
+ const receipts = findChildren(root, "nyugta").map((element) => ({
87
+ receipt: wrapSzamlazzError(() => parseReceiptElement(element, response)),
88
+ issuerTaxNumber: childText(findChild(element, "alap"), "adoszam")
89
+ }));
90
+ if (receipts.length === 0) throw invalid("A nyugtaarchívum nem tartalmaz <nyugta> elemet.");
91
+ return {
92
+ kind: "receipts",
93
+ key,
94
+ raw,
95
+ receipts
96
+ };
97
+ }
98
+ function parseDataLinkPush(xml, key) {
99
+ if (xml.trim() === "") throw invalid("Üres adatkapcsolati üzenet érkezett.");
100
+ let root;
101
+ try {
102
+ root = parseXml(xml);
103
+ } catch (error) {
104
+ if (error instanceof XmlParseError) throw invalid(`Az üzenet nem érvényes XML: ${error.message}`, error);
105
+ throw error;
106
+ }
107
+ const kind = ROOT_KINDS.get(root.name);
108
+ const normalizedKey = key?.trim() || void 0;
109
+ switch (kind) {
110
+ case "invoice":
111
+ case "incoming-invoice": return invoicePush(kind, root, xml, normalizedKey);
112
+ case "bank-transaction": return bankTransactionPush(root, xml, normalizedKey);
113
+ case "receipts": return receiptsPush(root, xml, normalizedKey);
114
+ default: throw new DataLinkError("unknown_document", `Ismeretlen adatkapcsolati bizonylattípus: <${root.name}>.`);
115
+ }
116
+ }
117
+ //#endregion
118
+ //#region src/data-link/response.ts
119
+ const DATA_LINK_RESPONSE_ROOTS = {
120
+ invoice: {
121
+ root: "szamlavalasz",
122
+ namespace: "http://www.szamlazz.hu/szamlavalasz"
123
+ },
124
+ "incoming-invoice": {
125
+ root: "szamlabevalasz",
126
+ namespace: "http://www.szamlazz.hu/szamlabevalasz"
127
+ },
128
+ "bank-transaction": {
129
+ root: "banktranzvalasz",
130
+ namespace: "http://www.szamlazz.hu/banktranzvalasz"
131
+ },
132
+ receipts: {
133
+ root: "nyugtavalasz",
134
+ namespace: "http://www.szamlazz.hu/nyugtavalasz"
135
+ }
136
+ };
137
+ function keyErrorOf(acknowledgement) {
138
+ const keyError = acknowledgement.keyError;
139
+ if (keyError === void 0 || keyError === "KEY_ERR" || keyError === "KEY_DEL") return keyError;
140
+ throw new TypeError(`Ismeretlen kulcshiba: ${String(keyError)}. Csak KEY_ERR vagy KEY_DEL adható.`);
141
+ }
142
+ function registrationNumberOf(push, value) {
143
+ if (value !== void 0 && typeof value !== "string") throw new TypeError("Az iktatószám (registrationNumber) szöveg legyen.");
144
+ const registrationNumber = value?.trim();
145
+ if (!registrationNumber) return void 0;
146
+ if (push.kind !== "invoice" && push.kind !== "incoming-invoice") throw new TypeError("Iktatószámot csak számla (kimenő vagy bejövő) válaszában lehet visszaadni.");
147
+ return registrationNumber;
148
+ }
149
+ function dataLinkResponseXml(push, acknowledgement = {}) {
150
+ const target = DATA_LINK_RESPONSE_ROOTS[push.kind];
151
+ const keyError = keyErrorOf(acknowledgement);
152
+ const registrationNumber = registrationNumberOf(push, acknowledgement.registrationNumber);
153
+ const children = [];
154
+ if (push.kind === "invoice" || push.kind === "incoming-invoice") children.push(el("alap", [el("id", push.id), optionalEl("iktatoszam", registrationNumber)]));
155
+ if (keyError !== void 0) children.push(el("hibakod", keyError));
156
+ return buildXmlDocument({
157
+ root: target.root,
158
+ namespace: target.namespace,
159
+ children
160
+ });
161
+ }
162
+ function dataLinkResponse(push, acknowledgement = {}) {
163
+ return new Response(dataLinkResponseXml(push, acknowledgement), {
164
+ status: 200,
165
+ headers: { "content-type": "application/xml; charset=UTF-8" }
166
+ });
167
+ }
168
+ //#endregion
169
+ //#region src/data-link/handler.ts
170
+ const DATA_LINK_KEY_HEADER = "x-szamlazzhu-key";
171
+ const DEFAULT_DATA_LINK_MAX_BYTES = 67108864;
172
+ function plain(status, body) {
173
+ return new Response(body, {
174
+ status,
175
+ headers: { "content-type": "text/plain; charset=utf-8" }
176
+ });
177
+ }
178
+ function reportError(onError, error) {
179
+ try {
180
+ if (onError) onError(error);
181
+ else console.error("[kassza] Az adatkapcsolati üzenet feldolgozása nem sikerült.", error);
182
+ } catch {
183
+ return;
184
+ }
185
+ }
186
+ function acknowledgementOf(value) {
187
+ if (value === void 0 || value === null) return {};
188
+ if (typeof value !== "object") throw new TypeError("Az onPush csak DataLinkAcknowledgement objektumot (registrationNumber, keyError) vagy semmit adhat vissza.");
189
+ return value;
190
+ }
191
+ function configuredKeys(keys) {
192
+ if (keys === void 0) return void 0;
193
+ const trimmed = keys.map((key) => typeof key === "string" ? key.trim() : "");
194
+ if (trimmed.length === 0 || trimmed.some((key) => key === "")) throw new TypeError("A keys lista nem lehet üres, és nem tartalmazhat üres kulcsot.");
195
+ return trimmed;
196
+ }
197
+ async function checkKey(options, keys, push) {
198
+ const key = push.key;
199
+ if (key === void 0) return "KEY_ERR";
200
+ if (keys !== void 0 && !keys.some((candidate) => timingSafeEqual(candidate, key))) return "KEY_ERR";
201
+ if (!options.verifyKey) return true;
202
+ const result = await options.verifyKey(key, push);
203
+ return result === false ? "KEY_ERR" : result;
204
+ }
205
+ function dataLinkHandler(options) {
206
+ if (typeof options.onPush !== "function") throw new TypeError("Add meg az onPush függvényt.");
207
+ const keys = configuredKeys(options.keys);
208
+ if (keys === void 0 && typeof options.verifyKey !== "function") throw new TypeError("Add meg az elfogadott azonosító kulcsokat (keys) vagy a verifyKey függvényt: az adatkapcsolati üzenetnek nincs aláírása, csak a kulcs azonosítja a küldőt.");
209
+ const maxBytes = options.maxBodyBytes ?? 67108864;
210
+ return async (request) => {
211
+ try {
212
+ const push = parseDataLinkPush(await readRequestText(request, maxBytes, () => new DataLinkError("payload_too_large", `Az adatkapcsolati üzenet nagyobb a megengedett ${maxBytes} bájtnál.`)), request.headers.get("x-szamlazzhu-key") ?? void 0);
213
+ const keyCheck = await checkKey(options, keys, push);
214
+ if (keyCheck !== true) return dataLinkResponse(push, { keyError: keyCheck });
215
+ return dataLinkResponse(push, acknowledgementOf(await options.onPush(push)));
216
+ } catch (error) {
217
+ if (error instanceof DataLinkError) return plain(400, error.message);
218
+ reportError(options.onError, error);
219
+ return plain(500, "Az adatkapcsolati üzenet feldolgozása nem sikerült.");
220
+ }
221
+ };
222
+ }
223
+ //#endregion
224
+ export { DATA_LINK_KEY_HEADER, DATA_LINK_RESPONSE_ROOTS, DEFAULT_DATA_LINK_MAX_BYTES, DataLinkError, dataLinkHandler, dataLinkResponse, dataLinkResponseXml, parseDataLinkPush };
@@ -1,7 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("../errors-DxeuTslP.cjs");
3
- const require_client = require("../client-CsmGIFRS.cjs");
4
- const require_issue = require("../issue-BsyYdrIG.cjs");
2
+ const require_errors = require("../errors-EE96_6D_.cjs");
3
+ const require_client = require("../client-CLFvJCVW.cjs");
4
+ const require_serialize = require("../serialize-CquIsxA-.cjs");
5
+ const require_parse = require("../parse-DOA2XQ3e.cjs");
5
6
  const require_dates = require("../dates-CPgBodkP.cjs");
6
7
  const require_tax_number = require("../tax-number-BYFkBp4A.cjs");
7
8
  //#region src/delegation/connect.ts
@@ -107,52 +108,52 @@ function loginNodes(credentials) {
107
108
  return node === void 0 ? void 0 : String(node.content);
108
109
  };
109
110
  const agentKey = value("szamlaagentkulcs");
110
- if (agentKey !== void 0) return [require_issue.el("szamlaagentkulcs", agentKey)];
111
+ if (agentKey !== void 0) return [require_serialize.el("szamlaagentkulcs", agentKey)];
111
112
  const username = value("felhasznalo");
112
113
  const password = value("jelszo");
113
114
  if (username === void 0 || password === void 0) throw new require_errors.SzamlazzError("A megbízotti fiók azonosításához Agent kulcs vagy felhasználónév és jelszó kell.", {
114
115
  category: "configuration",
115
116
  action: "connectPrincipal"
116
117
  });
117
- return [require_issue.el("loginname", username), require_issue.el("password", password)];
118
+ return [require_serialize.el("loginname", username), require_serialize.el("password", password)];
118
119
  }
119
120
  function principalNodes(input) {
120
121
  const { principal } = input;
121
- return require_issue.el("cegMb", [
122
- require_issue.el("cegcompanyname", principal.name.trim()),
123
- require_issue.el("cegtaxnumber", input.taxNumber),
124
- require_issue.el("cegszamlaszamelotag", input.invoicePrefix),
125
- require_issue.el("cegirsz", principal.zip.trim()),
126
- require_issue.el("cegcity", principal.city.trim()),
127
- require_issue.el("cegaddr", principal.address.trim()),
128
- require_issue.optionalEl("cegpostirsz", optionalText(principal.postalAddress?.zip)),
129
- require_issue.optionalEl("cegpostcity", optionalText(principal.postalAddress?.city)),
130
- require_issue.optionalEl("cegpostaddr", optionalText(principal.postalAddress?.address)),
131
- require_issue.el("cegbank", optionalText(principal.bankName) ?? ""),
132
- require_issue.el("cegbankaccount", optionalText(principal.bankAccount) ?? ""),
133
- require_issue.el("cegemail", principal.email.trim()),
134
- require_issue.el("cegemailreplyto", optionalText(principal.replyToEmail) ?? ""),
135
- require_issue.optionalEl("cegpenzforgdattol", input.cashAccountingFrom),
136
- require_issue.optionalEl("cegpenzforgdatig", input.cashAccountingTo),
137
- require_issue.optionalEl("cegkatadattol", input.kataFrom),
138
- require_issue.optionalEl("cegkatadatig", input.kataTo)
122
+ return require_serialize.el("cegMb", [
123
+ require_serialize.el("cegcompanyname", principal.name.trim()),
124
+ require_serialize.el("cegtaxnumber", input.taxNumber),
125
+ require_serialize.el("cegszamlaszamelotag", input.invoicePrefix),
126
+ require_serialize.el("cegirsz", principal.zip.trim()),
127
+ require_serialize.el("cegcity", principal.city.trim()),
128
+ require_serialize.el("cegaddr", principal.address.trim()),
129
+ require_serialize.optionalEl("cegpostirsz", optionalText(principal.postalAddress?.zip)),
130
+ require_serialize.optionalEl("cegpostcity", optionalText(principal.postalAddress?.city)),
131
+ require_serialize.optionalEl("cegpostaddr", optionalText(principal.postalAddress?.address)),
132
+ require_serialize.el("cegbank", optionalText(principal.bankName) ?? ""),
133
+ require_serialize.el("cegbankaccount", optionalText(principal.bankAccount) ?? ""),
134
+ require_serialize.el("cegemail", principal.email.trim()),
135
+ require_serialize.el("cegemailreplyto", optionalText(principal.replyToEmail) ?? ""),
136
+ require_serialize.optionalEl("cegpenzforgdattol", input.cashAccountingFrom),
137
+ require_serialize.optionalEl("cegpenzforgdatig", input.cashAccountingTo),
138
+ require_serialize.optionalEl("cegkatadattol", input.kataFrom),
139
+ require_serialize.optionalEl("cegkatadatig", input.kataTo)
139
140
  ]);
140
141
  }
141
142
  function userNodes(input) {
142
- return require_issue.el("usrMb", [
143
- require_issue.el("usremail", input.userEmail),
144
- require_issue.el("usrpassword", input.user.password),
145
- require_issue.optionalEl("usrvezeteknev", optionalText(input.user.lastName)),
146
- require_issue.el("usrkeresztnev", input.user.firstName.trim())
143
+ return require_serialize.el("usrMb", [
144
+ require_serialize.el("usremail", input.userEmail),
145
+ require_serialize.el("usrpassword", input.user.password),
146
+ require_serialize.optionalEl("usrvezeteknev", optionalText(input.user.lastName)),
147
+ require_serialize.el("usrkeresztnev", input.user.firstName.trim())
147
148
  ]);
148
149
  }
149
150
  function buildXml(credentials, input) {
150
- return require_issue.buildXmlDocument({
151
+ return require_serialize.buildXmlDocument({
151
152
  root: "XmlCegMb",
152
153
  namespace: CONNECT_PRINCIPAL_NAMESPACE,
153
154
  schemaLocation: CONNECT_PRINCIPAL_SCHEMA_LOCATION,
154
155
  children: [
155
- require_issue.el("login", loginNodes(credentials)),
156
+ require_serialize.el("login", loginNodes(credentials)),
156
157
  principalNodes(input),
157
158
  userNodes(input)
158
159
  ]
@@ -192,16 +193,16 @@ function repairMojibake(value) {
192
193
  }
193
194
  }
194
195
  function agentResponseMessage(response) {
195
- const header = require_issue.readHeader(response.headers, AGENT_RESPONSE_HEADER, true);
196
+ const header = require_parse.readHeader(response.headers, AGENT_RESPONSE_HEADER, true);
196
197
  if (header !== void 0) return repairMojibake(header);
197
198
  const match = AGENT_RESPONSE_TEXT.exec(response.text());
198
- const body = match?.[1] ? require_issue.decodeHeaderValue(match[1]).trim() : void 0;
199
+ const body = match?.[1] ? require_parse.decodeHeaderValue(match[1]).trim() : void 0;
199
200
  return body ? body : void 0;
200
201
  }
201
202
  function parseConnectPrincipalResponse(response) {
202
- require_issue.throwIfAnyError(response);
203
+ require_parse.throwIfAnyError(response);
203
204
  const message = agentResponseMessage(response);
204
- if (message === void 0) throw require_issue.unexpectedResponse(response, "Hiányzik az XML_AGENT_RESPONSE válasz.");
205
+ if (message === void 0) throw require_parse.unexpectedResponse(response, "Hiányzik az XML_AGENT_RESPONSE válasz.");
205
206
  return {
206
207
  status: connectPrincipalStatus(message),
207
208
  message
@@ -1,5 +1,6 @@
1
- import { J as AgentContext, Kt as suggestedPrefix, Q as RequestOptions, Ut as SzamlazzError, et as SzamlazzOptions, ht as AgentResponse, i as KasszaOptions, mt as XmlNode, n as Kassza, r as KasszaDefaults } from "../client-DvWZoX_E.cjs";
2
1
  import { t as DateInput } from "../dates-9zvESP0i.cjs";
2
+ import { D as XmlNode, O as AgentResponse, dt as suggestedPrefix, l as SzamlazzOptions, r as AgentContext, s as RequestOptions, st as SzamlazzError } from "../context-CFNKzStE.cjs";
3
+ import { i as KasszaOptions, n as Kassza, r as KasszaDefaults } from "../client-SVZu25MB.cjs";
3
4
  //#region src/delegation/connect.d.ts
4
5
  export declare const CONNECT_PRINCIPAL_NAMESPACE = "http://www.szamlazz.hu/xmlcegmb";
5
6
  export declare const CONNECT_PRINCIPAL_SCHEMA_LOCATION = "http://www.szamlazz.hu/docs/xsds/agentmb/xmlcegmb.xsd";
@@ -1,5 +1,6 @@
1
- import { J as AgentContext, Kt as suggestedPrefix, Q as RequestOptions, Ut as SzamlazzError, et as SzamlazzOptions, ht as AgentResponse, i as KasszaOptions, mt as XmlNode, n as Kassza, r as KasszaDefaults } from "../client-CickRRFr.js";
2
1
  import { t as DateInput } from "../dates-9zvESP0i.js";
2
+ import { D as XmlNode, O as AgentResponse, dt as suggestedPrefix, l as SzamlazzOptions, r as AgentContext, s as RequestOptions, st as SzamlazzError } from "../context-kb33TgzE.js";
3
+ import { i as KasszaOptions, n as Kassza, r as KasszaDefaults } from "../client-DeWWQ-RZ.js";
3
4
  //#region src/delegation/connect.d.ts
4
5
  export declare const CONNECT_PRINCIPAL_NAMESPACE = "http://www.szamlazz.hu/xmlcegmb";
5
6
  export declare const CONNECT_PRINCIPAL_SCHEMA_LOCATION = "http://www.szamlazz.hu/docs/xsds/agentmb/xmlcegmb.xsd";
@@ -1,6 +1,7 @@
1
- import { i as isSzamlazzError, n as SzamlazzError, o as suggestedPrefix } from "../errors-DLrb0g64.js";
2
- import { i as createAgentContext, n as queryTaxpayer, r as getInvoicePdf, t as createKassza } from "../client-CL3fuH6A.js";
3
- import { C as buildXmlDocument, D as decodeHeaderValue, M as readHeader, N as throwIfAnyError, R as unexpectedResponse, T as optionalEl, w as el } from "../issue-C6Fcjvln.js";
1
+ import { c as suggestedPrefix, o as isSzamlazzError, r as SzamlazzError } from "../errors-DtN4g5Z9.js";
2
+ import { a as queryTaxpayer, c as createAgentContext, o as getInvoicePdf, t as createKassza } from "../client-Cvf-hTz_.js";
3
+ import { a as optionalEl, n as buildXmlDocument, r as el } from "../serialize-B2eFh3D-.js";
4
+ import { h as unexpectedResponse, i as decodeHeaderValue, l as readHeader, u as throwIfAnyError } from "../parse-Cr7yQ3_z.js";
4
5
  import { n as toAgentDate } from "../dates-CXyj7Azy.js";
5
6
  import { o as parseHungarianTaxNumber, s as isValidEmail } from "../tax-number-BdqKsxNR.js";
6
7
  //#region src/delegation/connect.ts
@@ -327,6 +327,11 @@ const AGENT_ERROR_CODES = {
327
327
  hint: SIMPLE_ITEMS_HINT
328
328
  }
329
329
  };
330
+ const KASSZA_ERROR_DOCS_URL = "https://kasszajs.hu/docs/hibakodok";
331
+ function errorCodeDocsUrl(code) {
332
+ if (code === void 0 || AGENT_ERROR_CODES[code] === void 0) return void 0;
333
+ return `${KASSZA_ERROR_DOCS_URL}/${code}`;
334
+ }
330
335
  const RETRYABLE_CATEGORIES = /* @__PURE__ */ new Set([
331
336
  "maintenance",
332
337
  "network",
@@ -353,6 +358,9 @@ var SzamlazzError = class extends Error {
353
358
  this.rawResponse = options.rawResponse;
354
359
  this.details = options.details;
355
360
  }
361
+ get docsUrl() {
362
+ return errorCodeDocsUrl(this.code);
363
+ }
356
364
  get isDuplicate() {
357
365
  return this.category === "duplicate";
358
366
  }
@@ -387,4 +395,4 @@ function parseErrorCode(value) {
387
395
  return Number(trimmed);
388
396
  }
389
397
  //#endregion
390
- export { parseErrorCode as a, isSzamlazzError as i, SzamlazzError as n, suggestedPrefix as o, createAgentError as r, AGENT_ERROR_CODES as t };
398
+ export { errorCodeDocsUrl as a, suggestedPrefix as c, createAgentError as i, KASSZA_ERROR_DOCS_URL as n, isSzamlazzError as o, SzamlazzError as r, parseErrorCode as s, AGENT_ERROR_CODES as t };
@@ -327,6 +327,11 @@ const AGENT_ERROR_CODES = {
327
327
  hint: SIMPLE_ITEMS_HINT
328
328
  }
329
329
  };
330
+ const KASSZA_ERROR_DOCS_URL = "https://kasszajs.hu/docs/hibakodok";
331
+ function errorCodeDocsUrl(code) {
332
+ if (code === void 0 || AGENT_ERROR_CODES[code] === void 0) return void 0;
333
+ return `${KASSZA_ERROR_DOCS_URL}/${code}`;
334
+ }
330
335
  const RETRYABLE_CATEGORIES = /* @__PURE__ */ new Set([
331
336
  "maintenance",
332
337
  "network",
@@ -353,6 +358,9 @@ var SzamlazzError = class extends Error {
353
358
  this.rawResponse = options.rawResponse;
354
359
  this.details = options.details;
355
360
  }
361
+ get docsUrl() {
362
+ return errorCodeDocsUrl(this.code);
363
+ }
356
364
  get isDuplicate() {
357
365
  return this.category === "duplicate";
358
366
  }
@@ -393,6 +401,12 @@ Object.defineProperty(exports, "AGENT_ERROR_CODES", {
393
401
  return AGENT_ERROR_CODES;
394
402
  }
395
403
  });
404
+ Object.defineProperty(exports, "KASSZA_ERROR_DOCS_URL", {
405
+ enumerable: true,
406
+ get: function() {
407
+ return KASSZA_ERROR_DOCS_URL;
408
+ }
409
+ });
396
410
  Object.defineProperty(exports, "SzamlazzError", {
397
411
  enumerable: true,
398
412
  get: function() {
@@ -405,6 +419,12 @@ Object.defineProperty(exports, "createAgentError", {
405
419
  return createAgentError;
406
420
  }
407
421
  });
422
+ Object.defineProperty(exports, "errorCodeDocsUrl", {
423
+ enumerable: true,
424
+ get: function() {
425
+ return errorCodeDocsUrl;
426
+ }
427
+ });
408
428
  Object.defineProperty(exports, "isSzamlazzError", {
409
429
  enumerable: true,
410
430
  get: function() {