kassza 0.12.0 → 0.13.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 (100) hide show
  1. package/README.md +283 -18
  2. package/agents/README.md +20 -5
  3. package/agents/api.md +165 -2
  4. package/agents/pitfalls.md +16 -3
  5. package/agents/recipes.md +215 -45
  6. package/agents/skills/kassza/SKILL.md +11 -8
  7. package/dist/cli.cjs +552 -0
  8. package/dist/cli.d.cts +1 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +552 -0
  11. package/dist/client-6MkeuFqD.d.ts +268 -0
  12. package/dist/client-B5FryKxJ.d.cts +268 -0
  13. package/dist/{client-CsmGIFRS.cjs → client-C-PdfL_P.cjs} +235 -597
  14. package/dist/{client-CL3fuH6A.js → client-CfaS1-Jx.js} +35 -403
  15. package/dist/context-BxQlIlug.d.ts +425 -0
  16. package/dist/context-DXNbTPwz.d.cts +425 -0
  17. package/dist/{create-once-CqdYmQD8.js → create-once-Cz621l8r.js} +3 -3
  18. package/dist/{create-once-D0pwuenl.cjs → create-once-DgMtKKcG.cjs} +8 -2
  19. package/dist/{crypto-B8lERvR1.cjs → crypto-Dpn4FHQ6.cjs} +9 -0
  20. package/dist/{crypto-DK_osBVy.js → crypto-usDg8L2K.js} +4 -1
  21. package/dist/data-link/index.cjs +232 -0
  22. package/dist/data-link/index.d.cts +79 -0
  23. package/dist/data-link/index.d.ts +79 -0
  24. package/dist/data-link/index.js +224 -0
  25. package/dist/delegation/index.cjs +34 -33
  26. package/dist/delegation/index.d.cts +2 -1
  27. package/dist/delegation/index.d.ts +2 -1
  28. package/dist/delegation/index.js +3 -2
  29. package/dist/get-Byc9T5WO.d.cts +151 -0
  30. package/dist/get-Byc9T5WO.d.ts +151 -0
  31. package/dist/get-Csm2n0rZ.cjs +445 -0
  32. package/dist/get-DT3JEgQ6.js +380 -0
  33. package/dist/index.cjs +3 -3
  34. package/dist/index.d.cts +4 -2
  35. package/dist/index.d.ts +4 -2
  36. package/dist/index.js +3 -3
  37. package/dist/{issue-BsyYdrIG.cjs → issue-AGRohSm7.cjs} +48 -665
  38. package/dist/{issue-C6Fcjvln.js → issue-DtSLpVdJ.js} +5 -502
  39. package/dist/mcp/index.cjs +10 -0
  40. package/dist/mcp/index.d.cts +71 -0
  41. package/dist/mcp/index.d.ts +71 -0
  42. package/dist/mcp/index.js +2 -0
  43. package/dist/money/index.cjs +1 -1
  44. package/dist/money/index.js +1 -1
  45. package/dist/{money-DrhGkWHW.cjs → money-BxytJW6f.cjs} +25 -9
  46. package/dist/{money-DAA7OwiO.js → money-t7uy1n91.js} +25 -9
  47. package/dist/nav/index.cjs +1046 -0
  48. package/dist/nav/index.d.cts +247 -0
  49. package/dist/nav/index.d.ts +247 -0
  50. package/dist/nav/index.js +1012 -0
  51. package/dist/nav-BEwcX7-N.cjs +203 -0
  52. package/dist/nav-CK1WgYo7.js +156 -0
  53. package/dist/parse-BJj-aqKy.cjs +380 -0
  54. package/dist/parse-C608ehqM.js +291 -0
  55. package/dist/payments/barion.cjs +1 -1
  56. package/dist/payments/barion.d.cts +2 -2
  57. package/dist/payments/barion.d.ts +2 -2
  58. package/dist/payments/barion.js +1 -1
  59. package/dist/payments/index.cjs +2 -2
  60. package/dist/payments/index.d.cts +3 -3
  61. package/dist/payments/index.d.ts +3 -3
  62. package/dist/payments/index.js +2 -2
  63. package/dist/payments/paypal.cjs +1 -1
  64. package/dist/payments/paypal.d.cts +2 -2
  65. package/dist/payments/paypal.d.ts +2 -2
  66. package/dist/payments/paypal.js +1 -1
  67. package/dist/payments/revolut.cjs +2 -2
  68. package/dist/payments/revolut.d.cts +2 -2
  69. package/dist/payments/revolut.d.ts +2 -2
  70. package/dist/payments/revolut.js +2 -2
  71. package/dist/payments/simplepay.cjs +2 -2
  72. package/dist/payments/simplepay.d.cts +2 -2
  73. package/dist/payments/simplepay.d.ts +2 -2
  74. package/dist/payments/simplepay.js +2 -2
  75. package/dist/payments/stripe.cjs +2 -2
  76. package/dist/payments/stripe.d.cts +2 -2
  77. package/dist/payments/stripe.d.ts +2 -2
  78. package/dist/payments/stripe.js +2 -2
  79. package/dist/reports/index.cjs +11 -164
  80. package/dist/reports/index.js +1 -154
  81. package/dist/request-body-CH6ZGOrq.cjs +34 -0
  82. package/dist/request-body-uZHMRlQr.js +29 -0
  83. package/dist/serialize-BXOww1Uq.cjs +286 -0
  84. package/dist/serialize-DSE_o9RK.js +215 -0
  85. package/dist/server-C6PoNkdD.cjs +1557 -0
  86. package/dist/server-Cd8HB661.js +1504 -0
  87. package/dist/testing/index.cjs +1476 -3
  88. package/dist/testing/index.d.cts +194 -2
  89. package/dist/testing/index.d.ts +194 -2
  90. package/dist/testing/index.js +1477 -6
  91. package/dist/{types-COf1LAD-.d.cts → types-BVeR7KyU.d.cts} +1 -1
  92. package/dist/{types-COf1LAD-.d.ts → types-BVeR7KyU.d.ts} +1 -1
  93. package/dist/{webhook-C76bV-4R.cjs → webhook-81giRMdQ.cjs} +3 -25
  94. package/dist/{webhook-q2OzNwd7.d.ts → webhook-CpCMHhn2.d.ts} +1 -1
  95. package/dist/{webhook-CfaDgcL0.d.cts → webhook-CpMJuP6c.d.cts} +1 -1
  96. package/dist/{webhook-D4lvtex1.js → webhook-CrEGohbg.js} +3 -25
  97. package/llms.txt +4 -4
  98. package/package.json +43 -1
  99. package/dist/client-CickRRFr.d.ts +0 -838
  100. package/dist/client-DvWZoX_E.d.cts +0 -838
@@ -1,5 +1,5 @@
1
1
  //#region src/payments/types.d.ts
2
- type PaymentProvider = "stripe" | "simplepay" | "barion" | "revolut" | "paypal";
2
+ type PaymentProvider = "stripe" | "simplepay" | "barion" | "revolut" | "paypal" | (string & {});
3
3
  type PaymentEventKind = "paid" | "refunded" | "partially-refunded" | "failed" | "other";
4
4
  interface PaymentAmount {
5
5
  readonly value: number;
@@ -1,5 +1,5 @@
1
1
  //#region src/payments/types.d.ts
2
- type PaymentProvider = "stripe" | "simplepay" | "barion" | "revolut" | "paypal";
2
+ type PaymentProvider = "stripe" | "simplepay" | "barion" | "revolut" | "paypal" | (string & {});
3
3
  type PaymentEventKind = "paid" | "refunded" | "partially-refunded" | "failed" | "other";
4
4
  interface PaymentAmount {
5
5
  readonly value: number;
@@ -1,5 +1,5 @@
1
- const require_binary = require("./binary-B89HM03_.cjs");
2
1
  const require_rounding = require("./rounding-TxoWy2ww.cjs");
2
+ const require_request_body = require("./request-body-CH6ZGOrq.cjs");
3
3
  //#region src/payments/amounts.ts
4
4
  const ISO_ZERO_DECIMAL = /* @__PURE__ */ new Set([
5
5
  "BIF",
@@ -110,30 +110,8 @@ const DEFAULT_MAX_WEBHOOK_BYTES = 1048576;
110
110
  function tooLarge(provider, maxBytes) {
111
111
  return new WebhookVerificationError(provider, "payload_too_large", `A webhook törzse nagyobb a megengedett ${maxBytes} bájtnál.`);
112
112
  }
113
- async function readRawBody(request, provider, maxBytes = DEFAULT_MAX_WEBHOOK_BYTES) {
114
- const declared = Number(request.headers.get("content-length"));
115
- if (Number.isFinite(declared) && declared > maxBytes) throw tooLarge(provider, maxBytes);
116
- if (!request.body) return "";
117
- const reader = request.body.getReader();
118
- const chunks = [];
119
- let total = 0;
120
- for (;;) {
121
- const chunk = await reader.read();
122
- if (chunk.done) break;
123
- total += chunk.value.byteLength;
124
- if (total > maxBytes) {
125
- await reader.cancel().catch(() => void 0);
126
- throw tooLarge(provider, maxBytes);
127
- }
128
- chunks.push(chunk.value);
129
- }
130
- const bytes = new Uint8Array(total);
131
- let offset = 0;
132
- for (const chunk of chunks) {
133
- bytes.set(chunk, offset);
134
- offset += chunk.byteLength;
135
- }
136
- return require_binary.decodeUtf8(bytes);
113
+ function readRawBody(request, provider, maxBytes = DEFAULT_MAX_WEBHOOK_BYTES) {
114
+ return require_request_body.readRequestText(request, maxBytes, () => tooLarge(provider, maxBytes));
137
115
  }
138
116
  function parseJsonObject(provider, payload) {
139
117
  let parsed;
@@ -1,4 +1,4 @@
1
- import { l as PaymentWebhookBaseOptions } from "./types-COf1LAD-.js";
1
+ import { l as PaymentWebhookBaseOptions } from "./types-BVeR7KyU.js";
2
2
  //#region src/payments/webhook.d.ts
3
3
  type WebhookHandler = (request: Request) => Promise<Response>;
4
4
  declare function respondToWebhook(options: Pick<PaymentWebhookBaseOptions, "onError">, run: () => Promise<Response>): Promise<Response>;
@@ -1,4 +1,4 @@
1
- import { l as PaymentWebhookBaseOptions } from "./types-COf1LAD-.cjs";
1
+ import { l as PaymentWebhookBaseOptions } from "./types-BVeR7KyU.cjs";
2
2
  //#region src/payments/webhook.d.ts
3
3
  type WebhookHandler = (request: Request) => Promise<Response>;
4
4
  declare function respondToWebhook(options: Pick<PaymentWebhookBaseOptions, "onError">, run: () => Promise<Response>): Promise<Response>;
@@ -1,5 +1,5 @@
1
- import { r as decodeUtf8 } from "./binary-D0M9U2MD.js";
2
1
  import { r as roundMoney } from "./rounding-BLyHjjI5.js";
2
+ import { t as readRequestText } from "./request-body-uZHMRlQr.js";
3
3
  //#region src/payments/amounts.ts
4
4
  const ISO_ZERO_DECIMAL = /* @__PURE__ */ new Set([
5
5
  "BIF",
@@ -110,30 +110,8 @@ const DEFAULT_MAX_WEBHOOK_BYTES = 1048576;
110
110
  function tooLarge(provider, maxBytes) {
111
111
  return new WebhookVerificationError(provider, "payload_too_large", `A webhook törzse nagyobb a megengedett ${maxBytes} bájtnál.`);
112
112
  }
113
- async function readRawBody(request, provider, maxBytes = DEFAULT_MAX_WEBHOOK_BYTES) {
114
- const declared = Number(request.headers.get("content-length"));
115
- if (Number.isFinite(declared) && declared > maxBytes) throw tooLarge(provider, maxBytes);
116
- if (!request.body) return "";
117
- const reader = request.body.getReader();
118
- const chunks = [];
119
- let total = 0;
120
- for (;;) {
121
- const chunk = await reader.read();
122
- if (chunk.done) break;
123
- total += chunk.value.byteLength;
124
- if (total > maxBytes) {
125
- await reader.cancel().catch(() => void 0);
126
- throw tooLarge(provider, maxBytes);
127
- }
128
- chunks.push(chunk.value);
129
- }
130
- const bytes = new Uint8Array(total);
131
- let offset = 0;
132
- for (const chunk of chunks) {
133
- bytes.set(chunk, offset);
134
- offset += chunk.byteLength;
135
- }
136
- return decodeUtf8(bytes);
113
+ function readRawBody(request, provider, maxBytes = DEFAULT_MAX_WEBHOOK_BYTES) {
114
+ return readRequestText(request, maxBytes, () => tooLarge(provider, maxBytes));
137
115
  }
138
116
  function parseJsonObject(provider, payload) {
139
117
  let parsed;
package/llms.txt CHANGED
@@ -1,13 +1,13 @@
1
1
  # kassza
2
2
 
3
- > Zero-dependency TypeScript client for the Számlázz.hu Számla Agent API (Hungarian invoicing): invoices, proformas, receipts, reversals, payments, PDFs, NAV taxpayer lookup, IPN webhooks. Unofficial.
3
+ > Zero-dependency TypeScript client for the Számlázz.hu Számla Agent API (Hungarian invoicing): invoices, proformas, receipts, reversals, payments, PDFs, NAV taxpayer lookup, IPN webhooks. Also: exactly-once documents from Stripe, SimplePay, Barion, Revolut and PayPal payments, NAV daily receipt reports, delegated invoicing, the Számlázz.hu data link, a fake Számla Agent for tests, a CLI and an MCP server. Unofficial.
4
4
 
5
5
  ## Docs for coding agents
6
6
 
7
7
  - [Start here](agents/README.md): overview, the five rules, vocabulary
8
- - [Pitfalls](agents/pitfalls.md): hard rules and error categories
9
- - [API reference](agents/api.md): every method, input and output
10
- - [Recipes](agents/recipes.md): webhooks, idempotency, receipts, IPN, storage, serverless, tests
8
+ - [Pitfalls](agents/pitfalls.md): hard rules, legal rules for receipts, error categories
9
+ - [API reference](agents/api.md): every method, input and output, all subpath modules
10
+ - [Recipes](agents/recipes.md): webhooks, exactly-once invoicing, receipts, IPN, storage, serverless, tests, payment providers, NAV reports, delegated invoicing, data link, MCP
11
11
  - [Claude Code skill](agents/skills/kassza/SKILL.md)
12
12
 
13
13
  ## Human docs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kassza",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "author": {
5
5
  "name": "futozs",
6
6
  "url": "https://github.com/futozs",
@@ -12,6 +12,9 @@
12
12
  },
13
13
  "main": "./dist/index.cjs",
14
14
  "module": "./dist/index.js",
15
+ "bin": {
16
+ "kassza": "./dist/cli.js"
17
+ },
15
18
  "devDependencies": {
16
19
  "@arethetypeswrong/cli": "^0.18.5",
17
20
  "@biomejs/biome": "^2.5.13",
@@ -184,6 +187,36 @@
184
187
  "default": "./dist/delegation/index.cjs"
185
188
  }
186
189
  },
190
+ "./nav": {
191
+ "import": {
192
+ "types": "./dist/nav/index.d.ts",
193
+ "default": "./dist/nav/index.js"
194
+ },
195
+ "require": {
196
+ "types": "./dist/nav/index.d.cts",
197
+ "default": "./dist/nav/index.cjs"
198
+ }
199
+ },
200
+ "./data-link": {
201
+ "import": {
202
+ "types": "./dist/data-link/index.d.ts",
203
+ "default": "./dist/data-link/index.js"
204
+ },
205
+ "require": {
206
+ "types": "./dist/data-link/index.d.cts",
207
+ "default": "./dist/data-link/index.cjs"
208
+ }
209
+ },
210
+ "./mcp": {
211
+ "import": {
212
+ "types": "./dist/mcp/index.d.ts",
213
+ "default": "./dist/mcp/index.js"
214
+ },
215
+ "require": {
216
+ "types": "./dist/mcp/index.d.cts",
217
+ "default": "./dist/mcp/index.cjs"
218
+ }
219
+ },
187
220
  "./package.json": "./package.json"
188
221
  },
189
222
  "bugs": {
@@ -287,6 +320,15 @@
287
320
  ],
288
321
  "delegation": [
289
322
  "./dist/delegation/index.d.ts"
323
+ ],
324
+ "nav": [
325
+ "./dist/nav/index.d.ts"
326
+ ],
327
+ "data-link": [
328
+ "./dist/data-link/index.d.ts"
329
+ ],
330
+ "mcp": [
331
+ "./dist/mcp/index.d.ts"
290
332
  ]
291
333
  }
292
334
  }