kassza 0.13.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 (164) hide show
  1. package/README.en.md +48 -0
  2. package/README.md +152 -22
  3. package/agents/README.md +6 -1
  4. package/agents/api.md +64 -12
  5. package/agents/pitfalls.md +12 -1
  6. package/agents/recipes.md +67 -8
  7. package/agents/skills/kassza/SKILL.md +3 -0
  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 +105 -14
  14. package/dist/cli.js +104 -13
  15. package/dist/{client-C-PdfL_P.cjs → client-CLFvJCVW.cjs} +358 -181
  16. package/dist/{client-CfaS1-Jx.js → client-Cvf-hTz_.js} +311 -152
  17. package/dist/{client-6MkeuFqD.d.ts → client-DeWWQ-RZ.d.ts} +99 -26
  18. package/dist/{client-B5FryKxJ.d.cts → client-SVZu25MB.d.cts} +99 -26
  19. package/dist/{context-DXNbTPwz.d.cts → context-CFNKzStE.d.cts} +82 -58
  20. package/dist/{context-BxQlIlug.d.ts → context-kb33TgzE.d.ts} +82 -58
  21. package/dist/cookie-stores/index.cjs +21 -150
  22. package/dist/cookie-stores/index.d.cts +4 -63
  23. package/dist/cookie-stores/index.d.ts +4 -63
  24. package/dist/cookie-stores/index.js +3 -144
  25. package/dist/create-CflXrPip.js +204 -0
  26. package/dist/create-CvUvLUaT.cjs +257 -0
  27. package/dist/{create-once-DgMtKKcG.cjs → create-once-9yxR_Er_.cjs} +285 -33
  28. package/dist/create-once-Bh6fOWkW.d.cts +20 -0
  29. package/dist/{create-once-Cz621l8r.js → create-once-Ca2gMk1h.js} +250 -34
  30. package/dist/create-once-VKp0tVow.d.ts +20 -0
  31. package/dist/data-link/index.cjs +4 -4
  32. package/dist/data-link/index.d.cts +2 -52
  33. package/dist/data-link/index.d.ts +2 -52
  34. package/dist/data-link/index.js +4 -4
  35. package/dist/delegation/index.cjs +4 -4
  36. package/dist/delegation/index.d.cts +2 -2
  37. package/dist/delegation/index.d.ts +2 -2
  38. package/dist/delegation/index.js +4 -4
  39. package/dist/{errors-DLrb0g64.js → errors-DtN4g5Z9.js} +9 -1
  40. package/dist/{errors-DxeuTslP.cjs → errors-EE96_6D_.cjs} +20 -0
  41. package/dist/{get-Csm2n0rZ.cjs → get-BdMTseh4.cjs} +9 -183
  42. package/dist/{get-DT3JEgQ6.js → get-CZEShCcj.js} +4 -124
  43. package/dist/index-BhUPY_EH.d.cts +109 -0
  44. package/dist/index-BqGgQ4t3.d.ts +109 -0
  45. package/dist/{index-CYAGCdKJ.d.cts → index-C-7yWV7L.d.cts} +24 -1
  46. package/dist/{index-CYAGCdKJ.d.ts → index-C-7yWV7L.d.ts} +24 -1
  47. package/dist/index.cjs +19 -5
  48. package/dist/index.d.cts +10 -20
  49. package/dist/index.d.ts +10 -20
  50. package/dist/index.js +6 -6
  51. package/dist/ipn/index.cjs +26 -5
  52. package/dist/ipn/index.d.cts +12 -1
  53. package/dist/ipn/index.d.ts +12 -1
  54. package/dist/ipn/index.js +26 -6
  55. package/dist/{issue-AGRohSm7.cjs → issue-Bin4tKD_.cjs} +416 -342
  56. package/dist/{issue-DtSLpVdJ.js → issue-DMA1Nbr1.js} +394 -266
  57. package/dist/journal/index.cjs +454 -0
  58. package/dist/journal/index.d.cts +18 -0
  59. package/dist/journal/index.d.ts +18 -0
  60. package/dist/journal/index.js +445 -0
  61. package/dist/journal-DvI81Kt7.d.cts +114 -0
  62. package/dist/journal-Y9qrIB8G.d.ts +114 -0
  63. package/dist/mcp/index.cjs +1 -1
  64. package/dist/mcp/index.d.cts +1 -1
  65. package/dist/mcp/index.d.ts +1 -1
  66. package/dist/mcp/index.js +1 -1
  67. package/dist/money/index.cjs +2 -1
  68. package/dist/money/index.d.cts +2 -2
  69. package/dist/money/index.d.ts +2 -2
  70. package/dist/money/index.js +2 -2
  71. package/dist/{money-t7uy1n91.js → money-Cw457SD6.js} +95 -3
  72. package/dist/{money-BxytJW6f.cjs → money-K9j0wPit.cjs} +99 -1
  73. package/dist/nav/index.cjs +2 -2
  74. package/dist/nav/index.d.cts +1 -1
  75. package/dist/nav/index.d.ts +1 -1
  76. package/dist/nav/index.js +2 -2
  77. package/dist/{nav-BEwcX7-N.cjs → nav-BNbc8U0R.cjs} +1 -1
  78. package/dist/{nav-CK1WgYo7.js → nav-BcCerwWS.js} +1 -1
  79. package/dist/node/index.cjs +124 -0
  80. package/dist/node/index.d.cts +35 -0
  81. package/dist/node/index.d.ts +35 -0
  82. package/dist/node/index.js +120 -0
  83. package/dist/observe/index.cjs +311 -0
  84. package/dist/observe/index.d.cts +53 -0
  85. package/dist/observe/index.d.ts +53 -0
  86. package/dist/observe/index.js +303 -0
  87. package/dist/once-BN_3B5OF.cjs +103 -0
  88. package/dist/once-CqqZxsXG.js +74 -0
  89. package/dist/{parse-C608ehqM.js → parse-Cr7yQ3_z.js} +2 -2
  90. package/dist/{parse-BJj-aqKy.cjs → parse-DOA2XQ3e.cjs} +2 -2
  91. package/dist/payments/barion.cjs +26 -2
  92. package/dist/payments/barion.d.cts +2 -2
  93. package/dist/payments/barion.d.ts +2 -2
  94. package/dist/payments/barion.js +26 -2
  95. package/dist/payments/index.cjs +7 -2
  96. package/dist/payments/index.d.cts +4 -4
  97. package/dist/payments/index.d.ts +4 -4
  98. package/dist/payments/index.js +3 -3
  99. package/dist/payments/paypal.cjs +16 -2
  100. package/dist/payments/paypal.d.cts +2 -2
  101. package/dist/payments/paypal.d.ts +2 -2
  102. package/dist/payments/paypal.js +16 -2
  103. package/dist/payments/revolut.cjs +16 -2
  104. package/dist/payments/revolut.d.cts +2 -2
  105. package/dist/payments/revolut.d.ts +2 -2
  106. package/dist/payments/revolut.js +16 -2
  107. package/dist/payments/simplepay.cjs +36 -4
  108. package/dist/payments/simplepay.d.cts +2 -2
  109. package/dist/payments/simplepay.d.ts +2 -2
  110. package/dist/payments/simplepay.js +36 -4
  111. package/dist/payments/stripe.cjs +19 -2
  112. package/dist/payments/stripe.d.cts +2 -2
  113. package/dist/payments/stripe.d.ts +2 -2
  114. package/dist/payments/stripe.js +19 -2
  115. package/dist/push-BXj0Sf0Z.d.ts +52 -0
  116. package/dist/push-D4nNbCNV.d.cts +52 -0
  117. package/dist/reference-B5TATqb5.js +124 -0
  118. package/dist/reference-BIdYMK0t.cjs +183 -0
  119. package/dist/reports/index.cjs +1 -1
  120. package/dist/reports/index.d.cts +1 -1
  121. package/dist/reports/index.d.ts +1 -1
  122. package/dist/reports/index.js +1 -1
  123. package/dist/{serialize-DSE_o9RK.js → serialize-B2eFh3D-.js} +5 -1
  124. package/dist/{serialize-BXOww1Uq.cjs → serialize-CquIsxA-.cjs} +5 -1
  125. package/dist/{server-Cd8HB661.js → server-BrJUbXs7.js} +8 -7
  126. package/dist/{server-C6PoNkdD.cjs → server-Dw9j8Mnd.cjs} +17 -16
  127. package/dist/session-Ckl5eJhV.d.ts +7 -0
  128. package/dist/{session-CKOuE6Jc.cjs → session-DeM5vjvC.cjs} +69 -13
  129. package/dist/{session-rMKaJcmq.js → session-SaEEXu2N.js} +58 -14
  130. package/dist/session-YbChChx7.d.cts +7 -0
  131. package/dist/storage/fs.cjs +1 -1
  132. package/dist/storage/fs.js +1 -1
  133. package/dist/storage/index.cjs +1 -1
  134. package/dist/storage/index.js +1 -1
  135. package/dist/store-C1rHd9DB.d.cts +19 -0
  136. package/dist/store-C1rHd9DB.d.ts +19 -0
  137. package/dist/stores/index.cjs +24 -0
  138. package/dist/stores/index.d.cts +4 -0
  139. package/dist/stores/index.d.ts +4 -0
  140. package/dist/stores/index.js +3 -0
  141. package/dist/stores-BNrS0dWl.cjs +506 -0
  142. package/dist/stores-DhjGBrl_.js +441 -0
  143. package/dist/testing/index.cjs +28 -16
  144. package/dist/testing/index.d.cts +6 -3
  145. package/dist/testing/index.d.ts +6 -3
  146. package/dist/testing/index.js +26 -14
  147. package/dist/{types-BVeR7KyU.d.ts → types-B1A8mUIE.d.cts} +13 -1
  148. package/dist/{types-BVeR7KyU.d.cts → types-ByAEvGsZ.d.ts} +13 -1
  149. package/dist/{types-k--zHf4l.d.ts → types-D1zDOH_F.d.ts} +1 -1
  150. package/dist/{types-DH8QoNZK.d.cts → types-lnKkQdot.d.cts} +1 -1
  151. package/dist/warnings-B3DXnveC.d.cts +31 -0
  152. package/dist/warnings-B3DXnveC.d.ts +31 -0
  153. package/dist/warnings-DeIw5RFj.cjs +20 -0
  154. package/dist/warnings-DwTl5J-2.js +15 -0
  155. package/dist/{webhook-CrEGohbg.js → webhook-CQVShAfI.js} +44 -1
  156. package/dist/{webhook-81giRMdQ.cjs → webhook-Ckj-_hPD.cjs} +67 -0
  157. package/dist/webhook-CmdhGiH5.d.cts +11 -0
  158. package/dist/webhook-D6lEejob.d.ts +11 -0
  159. package/llms.txt +4 -3
  160. package/package.json +92 -4
  161. package/dist/session-Dm_45x8K.d.cts +0 -11
  162. package/dist/session-Dm_45x8K.d.ts +0 -11
  163. package/dist/webhook-CpCMHhn2.d.ts +0 -6
  164. package/dist/webhook-CpMJuP6c.d.cts +0 -6
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { i as isSzamlazzError, n as SzamlazzError } from "./errors-DLrb0g64.js";
3
- import { i as buildCreateInvoiceXml, t as createKassza } from "./client-CfaS1-Jx.js";
4
- import { r as el } from "./serialize-DSE_o9RK.js";
5
- import { i as buildCreateReceiptXml } from "./issue-DtSLpVdJ.js";
6
- import { i as navDailyReports, n as describeNavReport } from "./nav-CK1WgYo7.js";
7
- import { n as KASSZA_VERSION, t as createKasszaMcpServer } from "./server-Cd8HB661.js";
2
+ import { o as isSzamlazzError, r as SzamlazzError } from "./errors-DtN4g5Z9.js";
3
+ import { s as buildCreateInvoiceXml, t as createKassza } from "./client-Cvf-hTz_.js";
4
+ import { r as el } from "./serialize-B2eFh3D-.js";
5
+ import { t as buildCreateReceiptXml } from "./create-CflXrPip.js";
6
+ import { i as navDailyReports, n as describeNavReport } from "./nav-BcCerwWS.js";
7
+ import { n as KASSZA_VERSION, t as createKasszaMcpServer } from "./server-BrJUbXs7.js";
8
8
  import { readFile } from "node:fs/promises";
9
9
  import { createInterface } from "node:readline";
10
10
  //#region src/cli/args.ts
@@ -222,6 +222,8 @@ async function navSummaryCommand(io, args) {
222
222
  }
223
223
  //#endregion
224
224
  //#region src/cli/doctor.ts
225
+ const NPM_LATEST_URL = "https://registry.npmjs.org/kassza/latest";
226
+ const USED_BY_URL = "https://github.com/futozs/kassza/issues/new?template=used-by.yml";
225
227
  const MINIMUM_NODE_MAJOR = 22;
226
228
  const CLOCK_OK_SECONDS = 2;
227
229
  const CLOCK_WARN_SECONDS = 30;
@@ -317,6 +319,57 @@ async function accountCheck(kassza, options) {
317
319
  }
318
320
  return check("account", "skip", "Fiók típusa: add meg egy meglévő bizonylat számát (--invoice vagy --receipt), abból kiderül, hogy teszt- vagy éles fiók.");
319
321
  }
322
+ const PROBE_BUYER = {
323
+ name: "Kassza doctor próba",
324
+ zip: "1111",
325
+ city: "Budapest",
326
+ address: "Próba utca 1."
327
+ };
328
+ async function eInvoiceCheck(kassza) {
329
+ try {
330
+ await kassza.invoices.preview({
331
+ buyer: PROBE_BUYER,
332
+ items: [{
333
+ name: "Próba",
334
+ netUnitPrice: 1,
335
+ vat: 27
336
+ }],
337
+ eInvoice: true
338
+ });
339
+ return check("e-invoice", "ok", "E-számla: engedélyezve (előnézettel ellenőrizve, bizonylat nem készült).");
340
+ } catch (error) {
341
+ if (isSzamlazzError(error) && (error.code === 54 || error.code === 55 || error.code === 49)) return check("e-invoice", "warn", `E-számla: nem használható (${error.message}).`);
342
+ return check("e-invoice", "warn", `E-számla: az előnézet nem sikerült. ${error instanceof Error ? error.message : String(error)}`);
343
+ }
344
+ }
345
+ function receiptCapabilityCheck() {
346
+ return check("receipt", "skip", "Nyugta: a nyugtaelőtagot és a jogosultságot csak valódi kiállítás ellenőrzi (524, 8). Próbáld tesztfiókon.");
347
+ }
348
+ function environmentCheck(account, nodeEnv) {
349
+ if (account.status !== "ok" || !account.message.includes("éles fiók")) return void 0;
350
+ if (nodeEnv === "test" || nodeEnv === "development") return check("environment", "warn", `Környezet: NODE_ENV=${nodeEnv}, de az Agent kulcs éles fiókhoz tartozik. A tesztek valódi bizonylatot állíthatnak ki.`);
351
+ }
352
+ function compareVersions(a, b) {
353
+ const parse = (value) => value.replace(/^v/, "").split(/[.-]/).slice(0, 3).map((part) => Number.parseInt(part, 10) || 0);
354
+ const left = parse(a);
355
+ const right = parse(b);
356
+ for (let index = 0; index < 3; index++) {
357
+ const difference = (left[index] ?? 0) - (right[index] ?? 0);
358
+ if (difference !== 0) return difference;
359
+ }
360
+ return 0;
361
+ }
362
+ async function updateCheck(fetchImpl) {
363
+ try {
364
+ const response = await fetchImpl(NPM_LATEST_URL, { headers: { accept: "application/json" } });
365
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
366
+ const latest = String((await response.json()).version ?? "");
367
+ if (!/^\d+\.\d+\.\d+/.test(latest)) throw new Error("nincs verziószám a válaszban");
368
+ return compareVersions(latest, KASSZA_VERSION) > 0 ? check("update", "warn", `Frissítés: elérhető a kassza ${latest} (most: ${KASSZA_VERSION}).`) : check("update", "ok", `Frissítés: a kassza ${KASSZA_VERSION} a legfrissebb.`);
369
+ } catch (error) {
370
+ return check("update", "skip", `Frissítés: az npm nem volt elérhető (${error instanceof Error ? error.message : String(error)}).`);
371
+ }
372
+ }
320
373
  function accountOf(test) {
321
374
  if (test === true) return check("account", "ok", "Fiók típusa: tesztfiók.");
322
375
  if (test === false) return check("account", "ok", "Fiók típusa: éles fiók, a kiállított bizonylatok valódiak.");
@@ -339,12 +392,18 @@ async function runDoctor(io, options = {}) {
339
392
  });
340
393
  const auth = await authCheck(kassza);
341
394
  const account = auth.status === "ok" ? await accountCheck(kassza, options) : check("account", "skip", "Fiók típusa: sikertelen hitelesítés miatt kimaradt.");
395
+ const extra = [];
396
+ const environment = environmentCheck(account, io.env.NODE_ENV);
397
+ if (environment) extra.push(environment);
398
+ if (options.capabilities === true && auth.status === "ok") extra.push(await eInvoiceCheck(kassza), receiptCapabilityCheck());
399
+ if (options.checkUpdate === true) extra.push(await updateCheck(io.fetch ?? globalThis.fetch));
342
400
  return [
343
401
  ...checks,
344
402
  auth,
345
403
  clockCheck(samples),
346
404
  sessionCheck(samples),
347
- account
405
+ account,
406
+ ...extra
348
407
  ];
349
408
  }
350
409
  const SYMBOLS = {
@@ -353,13 +412,34 @@ const SYMBOLS = {
353
412
  fail: "✗",
354
413
  skip: "-"
355
414
  };
415
+ function summary(checks) {
416
+ return `Összegzés: ${checks.filter((entry) => entry.status === "fail").length} hiba, ${checks.filter((entry) => entry.status === "warn").length} figyelmeztetés.`;
417
+ }
356
418
  function formatDoctor(checks) {
357
- const failures = checks.filter((entry) => entry.status === "fail").length;
358
- const warnings = checks.filter((entry) => entry.status === "warn").length;
419
+ const healthy = !checks.some((entry) => entry.status === "fail");
359
420
  return [
360
421
  ...checks.map((entry) => `${SYMBOLS[entry.status]} ${entry.message}`),
361
422
  "",
362
- `Összegzés: ${failures} hiba, ${warnings} figyelmeztetés.`,
423
+ summary(checks),
424
+ ...healthy ? ["", `Használod a kasszát? Két perc, és sokat segít: ${USED_BY_URL}`] : [],
425
+ ""
426
+ ].join("\n");
427
+ }
428
+ function formatDoctorReport(checks, meta) {
429
+ return [
430
+ "## kassza doctor jelentés",
431
+ "",
432
+ `- kassza: ${KASSZA_VERSION}`,
433
+ `- Node.js: ${meta.nodeVersion}`,
434
+ ...meta.platform ? [`- platform: ${meta.platform}`] : [],
435
+ "",
436
+ "| Ellenőrzés | Állapot | Eredmény |",
437
+ "| --- | --- | --- |",
438
+ ...checks.map((entry) => `| ${entry.id} | ${entry.status} | ${entry.message.replace(/\|/g, "\\|")} |`),
439
+ "",
440
+ summary(checks),
441
+ "",
442
+ "A jelentés nem tartalmaz Agent kulcsot, vevői adatot vagy bizonylattartalmat. Átadás előtt nézd át.",
363
443
  ""
364
444
  ].join("\n");
365
445
  }
@@ -401,8 +481,11 @@ const CLI_USAGE = `kassza ${KASSZA_VERSION}: Számlázz.hu Számla Agent parancs
401
481
  Használat: kassza <parancs> [kapcsolók]
402
482
 
403
483
  Parancsok:
404
- doctor [--invoice <szám> | --receipt <szám>] [--json]
484
+ doctor [--invoice <szám> | --receipt <szám>] [--capabilities] [--check-update] [--json | --report]
405
485
  A környezet, az Agent kulcs, az óra és a Számlázz.hu kapcsolat ellenőrzése.
486
+ --capabilities: e-számla engedély előnézettel (bizonylat nem készül)
487
+ --check-update: az npm legfrissebb verziójának lekérdezése (hálózati hívás)
488
+ --report: titokmentes Markdown jelentés hibajegyhez
406
489
  verify
407
490
  Az Agent kulcs ellenőrzése a Számlázz.hu-n.
408
491
  xml preview <fájl.json|-> [--type invoice|receipt] [--defaults <fájl.json>]
@@ -422,7 +505,12 @@ Környezeti változók:
422
505
  `;
423
506
  const SPECS = {
424
507
  doctor: {
425
- booleans: ["json"],
508
+ booleans: [
509
+ "json",
510
+ "report",
511
+ "capabilities",
512
+ "check-update"
513
+ ],
426
514
  values: ["invoice", "receipt"]
427
515
  },
428
516
  verify: {},
@@ -452,9 +540,12 @@ function commandOf(argv) {
452
540
  async function doctorCommand(io, args) {
453
541
  const checks = await runDoctor(io, {
454
542
  invoiceNumber: flagValue(args, "invoice"),
455
- receiptNumber: flagValue(args, "receipt")
543
+ receiptNumber: flagValue(args, "receipt"),
544
+ capabilities: hasFlag(args, "capabilities"),
545
+ checkUpdate: hasFlag(args, "check-update")
456
546
  });
457
547
  if (hasFlag(args, "json")) printJson(io, { checks });
548
+ else if (hasFlag(args, "report")) io.stdout(formatDoctorReport(checks, { nodeVersion: io.nodeVersion }));
458
549
  else io.stdout(`kassza doctor ${KASSZA_VERSION}\n${formatDoctor(checks)}`);
459
550
  return checks.some((check) => check.status === "fail") ? 1 : 0;
460
551
  }