kassza 1.0.0 → 1.0.2
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.
- package/README.md +7 -6
- package/agents/api.md +4 -4
- package/agents/pitfalls.md +3 -0
- package/dist/batch/index.d.cts +2 -2
- package/dist/batch/index.d.ts +2 -2
- package/dist/cli.cjs +2 -2
- package/dist/cli.js +2 -2
- package/dist/{client-JZ1M1sZX.js → client-8ElbVwSO.js} +2 -2
- package/dist/{client-B00WZ3FK.d.cts → client-CXjvVevB.d.cts} +11 -3
- package/dist/{client-I_29IPMh.cjs → client-CYS1_Xaz.cjs} +2 -2
- package/dist/{client-BJfeFjCM.d.ts → client-CvojBxd9.d.ts} +11 -3
- package/dist/cookie-stores/index.cjs +1 -1
- package/dist/cookie-stores/index.js +1 -1
- package/dist/{create-once-zeF7GVVP.cjs → create-once-BKUhF1Ov.cjs} +1 -1
- package/dist/{create-once-B6cAXyET.js → create-once-DcEjO8QH.js} +1 -1
- package/dist/delegation/index.cjs +1 -1
- package/dist/delegation/index.d.cts +1 -1
- package/dist/delegation/index.d.ts +1 -1
- package/dist/delegation/index.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{issue-Dy9zvRK1.js → issue-CUiDvJhQ.js} +92 -3
- package/dist/{issue-DReARZnF.cjs → issue-bLLBTt9j.cjs} +92 -3
- package/dist/journal/index.cjs +22 -2
- package/dist/journal/index.d.cts +1 -1
- package/dist/journal/index.d.ts +1 -1
- package/dist/journal/index.js +22 -2
- package/dist/{journal-JwiYpBui.d.ts → journal-9pfg0if1.d.ts} +1 -0
- package/dist/{journal-D_ypAW50.d.cts → journal-Cp_OMWlI.d.cts} +1 -0
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.cts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/payments/barion.d.cts +2 -2
- package/dist/payments/barion.d.ts +2 -2
- package/dist/payments/index.cjs +1 -1
- package/dist/payments/index.d.cts +4 -4
- package/dist/payments/index.d.ts +4 -4
- package/dist/payments/index.js +1 -1
- package/dist/payments/paypal.d.cts +2 -2
- package/dist/payments/paypal.d.ts +2 -2
- package/dist/payments/revolut.cjs +7 -1
- package/dist/payments/revolut.d.cts +2 -2
- package/dist/payments/revolut.d.ts +2 -2
- package/dist/payments/revolut.js +7 -1
- package/dist/payments/simplepay.cjs +1 -1
- package/dist/payments/simplepay.d.cts +2 -2
- package/dist/payments/simplepay.d.ts +2 -2
- package/dist/payments/simplepay.js +1 -1
- package/dist/payments/stripe.cjs +37 -2
- package/dist/payments/stripe.d.cts +2 -2
- package/dist/payments/stripe.d.ts +2 -2
- package/dist/payments/stripe.js +37 -2
- package/dist/{server-CifvB-FX.js → server-CZTJ3562.js} +59 -14
- package/dist/{server-CGIY7U8C.cjs → server-CrmxXPV-.cjs} +59 -14
- package/dist/{shared-BOBTXDTo.cjs → shared-1HiN8LBf.cjs} +5 -1
- package/dist/{shared-Dbcfwr8x.js → shared-DF7m3lM7.js} +5 -1
- package/dist/storage/fs.cjs +21 -4
- package/dist/storage/fs.js +22 -5
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/stores/index.cjs +1 -1
- package/dist/stores/index.js +1 -1
- package/dist/{stores-BUnPNJQl.js → stores-BHBPYrWE.js} +1 -1
- package/dist/{stores-CH4rYKs_.cjs → stores-GFAEgthh.cjs} +1 -1
- package/dist/testing/index.cjs +2 -2
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +2 -2
- package/dist/{types-DeuUqIvU.d.cts → types-DGJiVNxr.d.cts} +1 -1
- package/dist/{types-oiDulesz.d.ts → types-DPnHIwQ_.d.ts} +1 -1
- package/dist/{webhook-C9IBUdeT.d.ts → webhook-BY7437wx.d.ts} +1 -1
- package/dist/{webhook-DF2p_m2Q.d.cts → webhook-CwDbGvSn.d.cts} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as PaymentEvent, s as PaymentLineItem, u as PaymentWebhookBaseOptions } from "../types-
|
|
1
|
+
import { i as PaymentEvent, s as PaymentLineItem, u as PaymentWebhookBaseOptions } from "../types-DPnHIwQ_.js";
|
|
2
2
|
import { t as JsonRecord } from "../json-D3Bx7NhF.js";
|
|
3
|
-
import { r as WebhookHandler } from "../webhook-
|
|
3
|
+
import { r as WebhookHandler } from "../webhook-BY7437wx.js";
|
|
4
4
|
export declare const STRIPE_DEFAULT_TOLERANCE_SECONDS = 300;
|
|
5
5
|
export declare const STRIPE_API_URL = "https://api.stripe.com";
|
|
6
6
|
export declare const STRIPE_DEFAULT_METHOD = "bankkártya";
|
package/dist/payments/stripe.js
CHANGED
|
@@ -17,6 +17,11 @@ const ORDER_REF_KEYS = [
|
|
|
17
17
|
"order"
|
|
18
18
|
];
|
|
19
19
|
const INACTIVE_REFUND_STATUSES = /* @__PURE__ */ new Set(["failed", "canceled"]);
|
|
20
|
+
const REFUND_UPDATE_EVENTS = /* @__PURE__ */ new Set([
|
|
21
|
+
"charge.refund.updated",
|
|
22
|
+
"refund.updated",
|
|
23
|
+
"refund.failed"
|
|
24
|
+
]);
|
|
20
25
|
function parseStripeSignatureHeader(header) {
|
|
21
26
|
let timestamp;
|
|
22
27
|
const signatures = [];
|
|
@@ -39,12 +44,17 @@ function secretsOf(secret) {
|
|
|
39
44
|
if (list.length === 0 || list.some((value) => value === "")) throw new TypeError("Add meg a Stripe webhook titkát (whsec_...).");
|
|
40
45
|
return list;
|
|
41
46
|
}
|
|
47
|
+
function resolveTolerance(value) {
|
|
48
|
+
if (value === void 0) return 300;
|
|
49
|
+
if (!Number.isFinite(value) || value < 0) throw new TypeError(`A toleranceSeconds nemnegatív véges szám legyen (a 0 kikapcsolja az időbélyeg-ellenőrzést), kapott: ${String(value)}`);
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
42
52
|
async function verifyStripeSignature(payload, header, secret, options = {}) {
|
|
43
53
|
const secrets = secretsOf(secret);
|
|
54
|
+
const tolerance = resolveTolerance(options.toleranceSeconds);
|
|
44
55
|
if (!header) throw new WebhookVerificationError("stripe", "missing_signature", "Hiányzik a Stripe-Signature fejléc.");
|
|
45
56
|
const parsed = parseStripeSignatureHeader(header);
|
|
46
57
|
if (!parsed) throw new WebhookVerificationError("stripe", "invalid_signature", "A Stripe-Signature fejléc formátuma hibás.");
|
|
47
|
-
const tolerance = options.toleranceSeconds ?? 300;
|
|
48
58
|
const nowSeconds = Math.floor((options.now?.() ?? Date.now()) / 1e3);
|
|
49
59
|
if (tolerance > 0 && nowSeconds - parsed.timestamp > tolerance) throw new WebhookVerificationError("stripe", "timestamp_out_of_range", `A Stripe esemény időbélyege régebbi ${tolerance} másodpercnél.`);
|
|
50
60
|
for (const key of secrets) {
|
|
@@ -179,6 +189,30 @@ function fromRefundedCharge(event, options) {
|
|
|
179
189
|
raw: event
|
|
180
190
|
};
|
|
181
191
|
}
|
|
192
|
+
function fromFailedRefund(event, options) {
|
|
193
|
+
const refund = event.object;
|
|
194
|
+
if (text(refund.object) !== "refund") return void 0;
|
|
195
|
+
if (!INACTIVE_REFUND_STATUSES.has(text(refund.status) ?? "")) return void 0;
|
|
196
|
+
const refundId = text(refund.id);
|
|
197
|
+
const amount = amountOf(refund, "amount");
|
|
198
|
+
return {
|
|
199
|
+
provider: "stripe",
|
|
200
|
+
kind: "refund-failed",
|
|
201
|
+
id: text(refund.payment_intent) ?? text(path(refund, "payment_intent", "id")) ?? text(refund.charge) ?? text(path(refund, "charge", "id")) ?? event.id,
|
|
202
|
+
eventId: event.id,
|
|
203
|
+
eventType: event.type,
|
|
204
|
+
orderRef: orderRefOf(refund),
|
|
205
|
+
refundedAmount: amount,
|
|
206
|
+
refunds: refundId && amount ? [{
|
|
207
|
+
id: refundId,
|
|
208
|
+
amount,
|
|
209
|
+
createdAt: paidAtOf(event)
|
|
210
|
+
}] : void 0,
|
|
211
|
+
paidAt: paidAtOf(event),
|
|
212
|
+
method: options.method ?? "bankkártya",
|
|
213
|
+
raw: event
|
|
214
|
+
};
|
|
215
|
+
}
|
|
182
216
|
function stripePaymentEvent(event, options = {}) {
|
|
183
217
|
switch (event.type) {
|
|
184
218
|
case "checkout.session.completed": {
|
|
@@ -192,7 +226,7 @@ function stripePaymentEvent(event, options = {}) {
|
|
|
192
226
|
case "payment_intent.succeeded": return fromPaymentIntent(event, "paid", options);
|
|
193
227
|
case "payment_intent.payment_failed": return fromPaymentIntent(event, "failed", options);
|
|
194
228
|
case "charge.refunded": return fromRefundedCharge(event, options);
|
|
195
|
-
default: return;
|
|
229
|
+
default: return REFUND_UPDATE_EVENTS.has(event.type) ? fromFailedRefund(event, options) : void 0;
|
|
196
230
|
}
|
|
197
231
|
}
|
|
198
232
|
async function stripeGet(url, options, what) {
|
|
@@ -305,6 +339,7 @@ async function enrich(payment, event, options) {
|
|
|
305
339
|
}
|
|
306
340
|
function stripeWebhook(options) {
|
|
307
341
|
secretsOf(options.secret);
|
|
342
|
+
resolveTolerance(options.toleranceSeconds);
|
|
308
343
|
return (request) => respondToWebhook(options, async () => {
|
|
309
344
|
const payload = await readRawBody(request, "stripe", options.maxBodyBytes);
|
|
310
345
|
await verifyStripeSignature(payload, request.headers.get("stripe-signature"), options.secret, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as resolveInvoice, l as INVOICE_LANGUAGES } from "./create-once-
|
|
1
|
+
import { c as resolveInvoice, l as INVOICE_LANGUAGES } from "./create-once-DcEjO8QH.js";
|
|
2
2
|
import { o as isSzamlazzError, r as SzamlazzError } from "./errors-CGGsW0Y5.js";
|
|
3
|
-
import { t as createKassza } from "./client-
|
|
3
|
+
import { t as createKassza } from "./client-8ElbVwSO.js";
|
|
4
4
|
import { i as resolveRecoveryDelay, n as isUncertainOutcome, r as recoverAfterFailure } from "./once-CMhDPrs7.js";
|
|
5
5
|
import { r as toBudapestDate } from "./dates-DWsZOdaO.js";
|
|
6
6
|
import { a as isVatRate } from "./vat-B4J5Q0tu.js";
|
|
@@ -207,13 +207,14 @@ function resolveTtl(ttlMs) {
|
|
|
207
207
|
function createConfirmations(options) {
|
|
208
208
|
const secret = options.secret ?? randomSecret();
|
|
209
209
|
const ttlMs = resolveTtl(options.ttlMs);
|
|
210
|
-
const sign = async (action, expiresAt, payload) => {
|
|
211
|
-
return (await hmacHex("SHA-256", secret, `${action}\n${expiresAt}\n${canonicalJson(payload)}`)).slice(0, SIGNATURE_LENGTH);
|
|
210
|
+
const sign = async (action, expiresAt, day, payload) => {
|
|
211
|
+
return (await hmacHex("SHA-256", secret, `${action}\n${expiresAt}\n${day}\n${canonicalJson(payload)}`)).slice(0, SIGNATURE_LENGTH);
|
|
212
212
|
};
|
|
213
213
|
return {
|
|
214
214
|
async issue(action, payload) {
|
|
215
|
-
const
|
|
216
|
-
const
|
|
215
|
+
const now = options.now();
|
|
216
|
+
const expiresAt = now.getTime() + ttlMs;
|
|
217
|
+
const signature = await sign(action, expiresAt, toBudapestDate(now), payload);
|
|
217
218
|
return {
|
|
218
219
|
token: `${expiresAt.toString(36)}.${signature}`,
|
|
219
220
|
expiresAt: new Date(expiresAt).toISOString()
|
|
@@ -225,14 +226,20 @@ function createConfirmations(options) {
|
|
|
225
226
|
const match = TOKEN_PATTERN.exec(token.trim());
|
|
226
227
|
const expiresAt = match?.[1] === void 0 ? NaN : Number.parseInt(match[1], 36);
|
|
227
228
|
if (!match?.[2] || !Number.isSafeInteger(expiresAt)) throw new ToolInputError(`A megerősítő kód formátuma érvénytelen. ${again}`);
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
const now = options.now();
|
|
230
|
+
if (now.getTime() > expiresAt) throw new ToolInputError(`A megerősítő kód lejárt. ${again}`);
|
|
231
|
+
const today = toBudapestDate(now);
|
|
232
|
+
const expected = await sign(action, expiresAt, today, payload);
|
|
233
|
+
if (!timingSafeEqual(expected, match[2])) {
|
|
234
|
+
const previewDay = toBudapestDate(new Date(expiresAt - ttlMs));
|
|
235
|
+
if (previewDay !== today && timingSafeEqual(await sign(action, expiresAt, previewDay, payload), match[2])) throw new ToolInputError(`A megerősítő kód egy előző napi (${previewDay}) előnézethez tartozik, budapesti idő szerint éjfél után nem érvényes. ${again}`);
|
|
236
|
+
throw new ToolInputError(`A megerősítő kód nem ehhez a kéréshez tartozik (az adatok eltérnek az előnézettől). ${again}`);
|
|
237
|
+
}
|
|
231
238
|
}
|
|
232
239
|
};
|
|
233
240
|
}
|
|
234
241
|
// src/core/version.ts
|
|
235
|
-
const KASSZA_VERSION = "0.
|
|
242
|
+
const KASSZA_VERSION = "1.0.1";
|
|
236
243
|
// src/mcp/tool-kit.ts
|
|
237
244
|
const LOCAL_READ = {
|
|
238
245
|
readOnlyHint: true,
|
|
@@ -666,6 +673,17 @@ function documentLabel(resolved) {
|
|
|
666
673
|
function resolve(input, context) {
|
|
667
674
|
return resolveInvoice(context.defaults.invoice ?? {}, input, context.now());
|
|
668
675
|
}
|
|
676
|
+
function signedInvoice(args, resolved) {
|
|
677
|
+
const { issueDate, fulfillmentDate, dueDate } = resolved;
|
|
678
|
+
return {
|
|
679
|
+
...args,
|
|
680
|
+
resolved: {
|
|
681
|
+
issueDate,
|
|
682
|
+
fulfillmentDate,
|
|
683
|
+
dueDate
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
}
|
|
669
687
|
function previewData(input, resolved) {
|
|
670
688
|
const totals = summarizeItems(resolved.items.map((item) => item.amounts));
|
|
671
689
|
return {
|
|
@@ -706,7 +724,7 @@ async function previewInvoice(args, context) {
|
|
|
706
724
|
const resolved = resolve(input, context);
|
|
707
725
|
const data = previewData(input, resolved);
|
|
708
726
|
const totals = summarizeItems(resolved.items.map((item) => item.amounts));
|
|
709
|
-
const confirmation = await context.confirmations.issue(CREATE_INVOICE, args);
|
|
727
|
+
const confirmation = await context.confirmations.issue(CREATE_INVOICE, signedInvoice(args, resolved));
|
|
710
728
|
return {
|
|
711
729
|
summary: lines(`${documentLabel(resolved)} előnézete (még NEM készült el): ${input.buyer.name}, nettó ${money(totals.netAmount, resolved.currency)}, bruttó ${money(totals.grossAmount, resolved.currency)}.`, `Kelt: ${resolved.issueDate}, teljesítés: ${resolved.fulfillmentDate}, fizetési határidő: ${resolved.dueDate}, fizetési mód: ${resolved.paymentMethod}.`, resolved.sendEmail ? "A Számlázz.hu e-mailben elküldi a vevőnek." : "A vevő nem kap e-mailt a Számlázz.hu-tól.", `Mutasd meg az előnézetet a felhasználónak. Ha jóváhagyja, hívd meg a ${CREATE_INVOICE} eszközt pontosan ugyanezekkel az adatokkal, a confirmation mezőben ezzel a kóddal: ${confirmation.token} (lejár: ${confirmation.expiresAt}).`),
|
|
712
730
|
data: {
|
|
@@ -732,9 +750,9 @@ function existingOutput(details, externalId, created) {
|
|
|
732
750
|
}
|
|
733
751
|
async function createInvoice(args, context) {
|
|
734
752
|
const { payload, confirmation } = splitConfirmation(args);
|
|
735
|
-
await context.confirmations.verify(CREATE_INVOICE, payload, confirmation, PREVIEW_INVOICE);
|
|
736
753
|
const input = invoiceInputOf(payload);
|
|
737
754
|
const resolved = resolve(input, context);
|
|
755
|
+
await context.confirmations.verify(CREATE_INVOICE, signedInvoice(payload, resolved), confirmation, PREVIEW_INVOICE);
|
|
738
756
|
const externalId = input.externalId ?? `MCP-${await idempotencyKey("create_invoice", resolved.issueDate, payload)}`;
|
|
739
757
|
const kassza = context.client();
|
|
740
758
|
const lookup = () => kassza.invoices.find({ externalId }, { includePdf: false });
|
|
@@ -1025,9 +1043,15 @@ function previewOf(input, context) {
|
|
|
1025
1043
|
}
|
|
1026
1044
|
};
|
|
1027
1045
|
}
|
|
1046
|
+
function signedReceipt(args, day) {
|
|
1047
|
+
return {
|
|
1048
|
+
...args,
|
|
1049
|
+
resolved: { day }
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1028
1052
|
async function previewReceipt(args, context) {
|
|
1029
1053
|
const preview = previewOf(receiptInputOf(args), context);
|
|
1030
|
-
const confirmation = await context.confirmations.issue(CREATE_RECEIPT, args);
|
|
1054
|
+
const confirmation = await context.confirmations.issue(CREATE_RECEIPT, signedReceipt(args, toBudapestDate(context.now())));
|
|
1031
1055
|
return {
|
|
1032
1056
|
summary: lines(`Nyugta előnézete (még NEM készült el): bruttó ${money(preview.grossAmount, preview.currency)}.`, `Mutasd meg az előnézetet a felhasználónak. Ha jóváhagyja, hívd meg a ${CREATE_RECEIPT} eszközt pontosan ugyanezekkel az adatokkal, a confirmation mezőben ezzel a kóddal: ${confirmation.token} (lejár: ${confirmation.expiresAt}).`),
|
|
1033
1057
|
data: {
|
|
@@ -1064,10 +1088,10 @@ function duplicateCallIdError(error, callId) {
|
|
|
1064
1088
|
}
|
|
1065
1089
|
async function createReceipt(args, context) {
|
|
1066
1090
|
const { payload, confirmation } = splitConfirmation(args);
|
|
1067
|
-
await context.confirmations.verify(CREATE_RECEIPT, payload, confirmation, PREVIEW_RECEIPT);
|
|
1068
1091
|
const input = receiptInputOf(payload);
|
|
1069
1092
|
previewOf(input, context);
|
|
1070
1093
|
const day = toBudapestDate(context.now());
|
|
1094
|
+
await context.confirmations.verify(CREATE_RECEIPT, signedReceipt(payload, day), confirmation, PREVIEW_RECEIPT);
|
|
1071
1095
|
const callId = `MCP-${await idempotencyKey(CREATE_RECEIPT, day, payload)}`;
|
|
1072
1096
|
const kassza = context.client();
|
|
1073
1097
|
if (input.orderNumber !== void 0) {
|
|
@@ -1179,10 +1203,28 @@ function reversalOutput(document, reversedNumber, number, created) {
|
|
|
1179
1203
|
}
|
|
1180
1204
|
};
|
|
1181
1205
|
}
|
|
1206
|
+
const reversalsInFlight = /* @__PURE__ */ new Map();
|
|
1207
|
+
async function oneReversalAtATime(key, run) {
|
|
1208
|
+
for (;;) {
|
|
1209
|
+
const pending = reversalsInFlight.get(key);
|
|
1210
|
+
if (!pending) break;
|
|
1211
|
+
await pending.catch(() => void 0);
|
|
1212
|
+
}
|
|
1213
|
+
const current = run();
|
|
1214
|
+
reversalsInFlight.set(key, current);
|
|
1215
|
+
try {
|
|
1216
|
+
return await current;
|
|
1217
|
+
} finally {
|
|
1218
|
+
if (reversalsInFlight.get(key) === current) reversalsInFlight.delete(key);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1182
1221
|
async function reverseInvoice(args, context) {
|
|
1183
1222
|
assertKnownKeys(args, ["invoiceNumber", "confirmation"], "");
|
|
1184
1223
|
const invoiceNumber = requiredString(args, "invoiceNumber", "");
|
|
1185
1224
|
await context.confirmations.verify(REVERSE_INVOICE, { invoiceNumber }, args.confirmation, PREVIEW_REVERSAL);
|
|
1225
|
+
return oneReversalAtATime(`invoice:${invoiceNumber}`, () => reverseInvoiceOnce(invoiceNumber, context));
|
|
1226
|
+
}
|
|
1227
|
+
async function reverseInvoiceOnce(invoiceNumber, context) {
|
|
1186
1228
|
const kassza = context.client();
|
|
1187
1229
|
const externalId = `${invoiceNumber}/SS`;
|
|
1188
1230
|
const lookup = () => kassza.invoices.find({ externalId }, { includePdf: false });
|
|
@@ -1208,6 +1250,9 @@ async function reverseReceipt(args, context) {
|
|
|
1208
1250
|
assertKnownKeys(args, ["receiptNumber", "confirmation"], "");
|
|
1209
1251
|
const receiptNumber = requiredString(args, "receiptNumber", "");
|
|
1210
1252
|
await context.confirmations.verify(REVERSE_RECEIPT, { receiptNumber }, args.confirmation, PREVIEW_REVERSAL);
|
|
1253
|
+
return oneReversalAtATime(`receipt:${receiptNumber}`, () => reverseReceiptOnce(receiptNumber, context));
|
|
1254
|
+
}
|
|
1255
|
+
async function reverseReceiptOnce(receiptNumber, context) {
|
|
1211
1256
|
const kassza = context.client();
|
|
1212
1257
|
const original = await kassza.receipts.get({
|
|
1213
1258
|
receiptNumber,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_create_once = require("./create-once-
|
|
1
|
+
const require_create_once = require("./create-once-BKUhF1Ov.cjs");
|
|
2
2
|
const require_errors = require("./errors-Bn6pe6yw.cjs");
|
|
3
|
-
const require_client = require("./client-
|
|
3
|
+
const require_client = require("./client-CYS1_Xaz.cjs");
|
|
4
4
|
const require_once = require("./once-BmXfrNbQ.cjs");
|
|
5
5
|
const require_dates = require("./dates-oOp3ypPP.cjs");
|
|
6
6
|
const require_vat = require("./vat-BkoiiKm4.cjs");
|
|
@@ -207,13 +207,14 @@ function resolveTtl(ttlMs) {
|
|
|
207
207
|
function createConfirmations(options) {
|
|
208
208
|
const secret = options.secret ?? randomSecret();
|
|
209
209
|
const ttlMs = resolveTtl(options.ttlMs);
|
|
210
|
-
const sign = async (action, expiresAt, payload) => {
|
|
211
|
-
return (await require_crypto.hmacHex("SHA-256", secret, `${action}\n${expiresAt}\n${canonicalJson(payload)}`)).slice(0, SIGNATURE_LENGTH);
|
|
210
|
+
const sign = async (action, expiresAt, day, payload) => {
|
|
211
|
+
return (await require_crypto.hmacHex("SHA-256", secret, `${action}\n${expiresAt}\n${day}\n${canonicalJson(payload)}`)).slice(0, SIGNATURE_LENGTH);
|
|
212
212
|
};
|
|
213
213
|
return {
|
|
214
214
|
async issue(action, payload) {
|
|
215
|
-
const
|
|
216
|
-
const
|
|
215
|
+
const now = options.now();
|
|
216
|
+
const expiresAt = now.getTime() + ttlMs;
|
|
217
|
+
const signature = await sign(action, expiresAt, require_dates.toBudapestDate(now), payload);
|
|
217
218
|
return {
|
|
218
219
|
token: `${expiresAt.toString(36)}.${signature}`,
|
|
219
220
|
expiresAt: new Date(expiresAt).toISOString()
|
|
@@ -225,14 +226,20 @@ function createConfirmations(options) {
|
|
|
225
226
|
const match = TOKEN_PATTERN.exec(token.trim());
|
|
226
227
|
const expiresAt = match?.[1] === void 0 ? NaN : Number.parseInt(match[1], 36);
|
|
227
228
|
if (!match?.[2] || !Number.isSafeInteger(expiresAt)) throw new ToolInputError(`A megerősítő kód formátuma érvénytelen. ${again}`);
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
const now = options.now();
|
|
230
|
+
if (now.getTime() > expiresAt) throw new ToolInputError(`A megerősítő kód lejárt. ${again}`);
|
|
231
|
+
const today = require_dates.toBudapestDate(now);
|
|
232
|
+
const expected = await sign(action, expiresAt, today, payload);
|
|
233
|
+
if (!require_crypto.timingSafeEqual(expected, match[2])) {
|
|
234
|
+
const previewDay = require_dates.toBudapestDate(new Date(expiresAt - ttlMs));
|
|
235
|
+
if (previewDay !== today && require_crypto.timingSafeEqual(await sign(action, expiresAt, previewDay, payload), match[2])) throw new ToolInputError(`A megerősítő kód egy előző napi (${previewDay}) előnézethez tartozik, budapesti idő szerint éjfél után nem érvényes. ${again}`);
|
|
236
|
+
throw new ToolInputError(`A megerősítő kód nem ehhez a kéréshez tartozik (az adatok eltérnek az előnézettől). ${again}`);
|
|
237
|
+
}
|
|
231
238
|
}
|
|
232
239
|
};
|
|
233
240
|
}
|
|
234
241
|
// src/core/version.ts
|
|
235
|
-
const KASSZA_VERSION = "0.
|
|
242
|
+
const KASSZA_VERSION = "1.0.1";
|
|
236
243
|
// src/mcp/tool-kit.ts
|
|
237
244
|
const LOCAL_READ = {
|
|
238
245
|
readOnlyHint: true,
|
|
@@ -666,6 +673,17 @@ function documentLabel(resolved) {
|
|
|
666
673
|
function resolve(input, context) {
|
|
667
674
|
return require_create_once.resolveInvoice(context.defaults.invoice ?? {}, input, context.now());
|
|
668
675
|
}
|
|
676
|
+
function signedInvoice(args, resolved) {
|
|
677
|
+
const { issueDate, fulfillmentDate, dueDate } = resolved;
|
|
678
|
+
return {
|
|
679
|
+
...args,
|
|
680
|
+
resolved: {
|
|
681
|
+
issueDate,
|
|
682
|
+
fulfillmentDate,
|
|
683
|
+
dueDate
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
}
|
|
669
687
|
function previewData(input, resolved) {
|
|
670
688
|
const totals = require_money.summarizeItems(resolved.items.map((item) => item.amounts));
|
|
671
689
|
return {
|
|
@@ -706,7 +724,7 @@ async function previewInvoice(args, context) {
|
|
|
706
724
|
const resolved = resolve(input, context);
|
|
707
725
|
const data = previewData(input, resolved);
|
|
708
726
|
const totals = require_money.summarizeItems(resolved.items.map((item) => item.amounts));
|
|
709
|
-
const confirmation = await context.confirmations.issue(CREATE_INVOICE, args);
|
|
727
|
+
const confirmation = await context.confirmations.issue(CREATE_INVOICE, signedInvoice(args, resolved));
|
|
710
728
|
return {
|
|
711
729
|
summary: lines(`${documentLabel(resolved)} előnézete (még NEM készült el): ${input.buyer.name}, nettó ${money(totals.netAmount, resolved.currency)}, bruttó ${money(totals.grossAmount, resolved.currency)}.`, `Kelt: ${resolved.issueDate}, teljesítés: ${resolved.fulfillmentDate}, fizetési határidő: ${resolved.dueDate}, fizetési mód: ${resolved.paymentMethod}.`, resolved.sendEmail ? "A Számlázz.hu e-mailben elküldi a vevőnek." : "A vevő nem kap e-mailt a Számlázz.hu-tól.", `Mutasd meg az előnézetet a felhasználónak. Ha jóváhagyja, hívd meg a ${CREATE_INVOICE} eszközt pontosan ugyanezekkel az adatokkal, a confirmation mezőben ezzel a kóddal: ${confirmation.token} (lejár: ${confirmation.expiresAt}).`),
|
|
712
730
|
data: {
|
|
@@ -732,9 +750,9 @@ function existingOutput(details, externalId, created) {
|
|
|
732
750
|
}
|
|
733
751
|
async function createInvoice(args, context) {
|
|
734
752
|
const { payload, confirmation } = splitConfirmation(args);
|
|
735
|
-
await context.confirmations.verify(CREATE_INVOICE, payload, confirmation, PREVIEW_INVOICE);
|
|
736
753
|
const input = invoiceInputOf(payload);
|
|
737
754
|
const resolved = resolve(input, context);
|
|
755
|
+
await context.confirmations.verify(CREATE_INVOICE, signedInvoice(payload, resolved), confirmation, PREVIEW_INVOICE);
|
|
738
756
|
const externalId = input.externalId ?? `MCP-${await idempotencyKey("create_invoice", resolved.issueDate, payload)}`;
|
|
739
757
|
const kassza = context.client();
|
|
740
758
|
const lookup = () => kassza.invoices.find({ externalId }, { includePdf: false });
|
|
@@ -1025,9 +1043,15 @@ function previewOf(input, context) {
|
|
|
1025
1043
|
}
|
|
1026
1044
|
};
|
|
1027
1045
|
}
|
|
1046
|
+
function signedReceipt(args, day) {
|
|
1047
|
+
return {
|
|
1048
|
+
...args,
|
|
1049
|
+
resolved: { day }
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1028
1052
|
async function previewReceipt(args, context) {
|
|
1029
1053
|
const preview = previewOf(receiptInputOf(args), context);
|
|
1030
|
-
const confirmation = await context.confirmations.issue(CREATE_RECEIPT, args);
|
|
1054
|
+
const confirmation = await context.confirmations.issue(CREATE_RECEIPT, signedReceipt(args, require_dates.toBudapestDate(context.now())));
|
|
1031
1055
|
return {
|
|
1032
1056
|
summary: lines(`Nyugta előnézete (még NEM készült el): bruttó ${money(preview.grossAmount, preview.currency)}.`, `Mutasd meg az előnézetet a felhasználónak. Ha jóváhagyja, hívd meg a ${CREATE_RECEIPT} eszközt pontosan ugyanezekkel az adatokkal, a confirmation mezőben ezzel a kóddal: ${confirmation.token} (lejár: ${confirmation.expiresAt}).`),
|
|
1033
1057
|
data: {
|
|
@@ -1064,10 +1088,10 @@ function duplicateCallIdError(error, callId) {
|
|
|
1064
1088
|
}
|
|
1065
1089
|
async function createReceipt(args, context) {
|
|
1066
1090
|
const { payload, confirmation } = splitConfirmation(args);
|
|
1067
|
-
await context.confirmations.verify(CREATE_RECEIPT, payload, confirmation, PREVIEW_RECEIPT);
|
|
1068
1091
|
const input = receiptInputOf(payload);
|
|
1069
1092
|
previewOf(input, context);
|
|
1070
1093
|
const day = require_dates.toBudapestDate(context.now());
|
|
1094
|
+
await context.confirmations.verify(CREATE_RECEIPT, signedReceipt(payload, day), confirmation, PREVIEW_RECEIPT);
|
|
1071
1095
|
const callId = `MCP-${await idempotencyKey(CREATE_RECEIPT, day, payload)}`;
|
|
1072
1096
|
const kassza = context.client();
|
|
1073
1097
|
if (input.orderNumber !== void 0) {
|
|
@@ -1179,10 +1203,28 @@ function reversalOutput(document, reversedNumber, number, created) {
|
|
|
1179
1203
|
}
|
|
1180
1204
|
};
|
|
1181
1205
|
}
|
|
1206
|
+
const reversalsInFlight = /* @__PURE__ */ new Map();
|
|
1207
|
+
async function oneReversalAtATime(key, run) {
|
|
1208
|
+
for (;;) {
|
|
1209
|
+
const pending = reversalsInFlight.get(key);
|
|
1210
|
+
if (!pending) break;
|
|
1211
|
+
await pending.catch(() => void 0);
|
|
1212
|
+
}
|
|
1213
|
+
const current = run();
|
|
1214
|
+
reversalsInFlight.set(key, current);
|
|
1215
|
+
try {
|
|
1216
|
+
return await current;
|
|
1217
|
+
} finally {
|
|
1218
|
+
if (reversalsInFlight.get(key) === current) reversalsInFlight.delete(key);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1182
1221
|
async function reverseInvoice(args, context) {
|
|
1183
1222
|
assertKnownKeys(args, ["invoiceNumber", "confirmation"], "");
|
|
1184
1223
|
const invoiceNumber = requiredString(args, "invoiceNumber", "");
|
|
1185
1224
|
await context.confirmations.verify(REVERSE_INVOICE, { invoiceNumber }, args.confirmation, PREVIEW_REVERSAL);
|
|
1225
|
+
return oneReversalAtATime(`invoice:${invoiceNumber}`, () => reverseInvoiceOnce(invoiceNumber, context));
|
|
1226
|
+
}
|
|
1227
|
+
async function reverseInvoiceOnce(invoiceNumber, context) {
|
|
1186
1228
|
const kassza = context.client();
|
|
1187
1229
|
const externalId = `${invoiceNumber}/SS`;
|
|
1188
1230
|
const lookup = () => kassza.invoices.find({ externalId }, { includePdf: false });
|
|
@@ -1208,6 +1250,9 @@ async function reverseReceipt(args, context) {
|
|
|
1208
1250
|
assertKnownKeys(args, ["receiptNumber", "confirmation"], "");
|
|
1209
1251
|
const receiptNumber = requiredString(args, "receiptNumber", "");
|
|
1210
1252
|
await context.confirmations.verify(REVERSE_RECEIPT, { receiptNumber }, args.confirmation, PREVIEW_REVERSAL);
|
|
1253
|
+
return oneReversalAtATime(`receipt:${receiptNumber}`, () => reverseReceiptOnce(receiptNumber, context));
|
|
1254
|
+
}
|
|
1255
|
+
async function reverseReceiptOnce(receiptNumber, context) {
|
|
1211
1256
|
const kassza = context.client();
|
|
1212
1257
|
const original = await kassza.receipts.get({
|
|
1213
1258
|
receiptNumber,
|
|
@@ -37,6 +37,10 @@ const DEFAULT_URL_EXPIRES_SECONDS = 3600;
|
|
|
37
37
|
const S3_MAX_PRESIGN_SECONDS = 604800;
|
|
38
38
|
const MAX_KEY_LENGTH = 1024;
|
|
39
39
|
const CONTROL_CHARACTERS = /[\p{Cc}]/u;
|
|
40
|
+
function isDotSegment(segment) {
|
|
41
|
+
const decoded = segment.replace(/%2e/gi, ".");
|
|
42
|
+
return decoded === "." || decoded === "..";
|
|
43
|
+
}
|
|
40
44
|
function assertStorageKey(key) {
|
|
41
45
|
const invalid = (reason) => new StorageError(`Érvénytelen tárhelykulcs (${reason}): ${JSON.stringify(key)}`, {
|
|
42
46
|
operation: "key",
|
|
@@ -47,7 +51,7 @@ function assertStorageKey(key) {
|
|
|
47
51
|
if (key.startsWith("/")) throw invalid("nem kezdődhet perjellel");
|
|
48
52
|
if (key.includes("\\")) throw invalid("visszaperjel nem lehet benne");
|
|
49
53
|
if (CONTROL_CHARACTERS.test(key)) throw invalid("vezérlőkaraktert tartalmaz");
|
|
50
|
-
for (const segment of key.split("/")) if (segment === "" || segment
|
|
54
|
+
for (const segment of key.split("/")) if (segment === "" || isDotSegment(segment)) throw invalid("üres, \".\" vagy \"..\" útvonalszakaszt tartalmaz, akár %2e kódolással");
|
|
51
55
|
return key;
|
|
52
56
|
}
|
|
53
57
|
function normalizePrefix(prefix) {
|
|
@@ -37,6 +37,10 @@ const DEFAULT_URL_EXPIRES_SECONDS = 3600;
|
|
|
37
37
|
const S3_MAX_PRESIGN_SECONDS = 604800;
|
|
38
38
|
const MAX_KEY_LENGTH = 1024;
|
|
39
39
|
const CONTROL_CHARACTERS = /[\p{Cc}]/u;
|
|
40
|
+
function isDotSegment(segment) {
|
|
41
|
+
const decoded = segment.replace(/%2e/gi, ".");
|
|
42
|
+
return decoded === "." || decoded === "..";
|
|
43
|
+
}
|
|
40
44
|
function assertStorageKey(key) {
|
|
41
45
|
const invalid = (reason) => new StorageError(`Érvénytelen tárhelykulcs (${reason}): ${JSON.stringify(key)}`, {
|
|
42
46
|
operation: "key",
|
|
@@ -47,7 +51,7 @@ function assertStorageKey(key) {
|
|
|
47
51
|
if (key.startsWith("/")) throw invalid("nem kezdődhet perjellel");
|
|
48
52
|
if (key.includes("\\")) throw invalid("visszaperjel nem lehet benne");
|
|
49
53
|
if (CONTROL_CHARACTERS.test(key)) throw invalid("vezérlőkaraktert tartalmaz");
|
|
50
|
-
for (const segment of key.split("/")) if (segment === "" || segment
|
|
54
|
+
for (const segment of key.split("/")) if (segment === "" || isDotSegment(segment)) throw invalid("üres, \".\" vagy \"..\" útvonalszakaszt tartalmaz, akár %2e kódolással");
|
|
51
55
|
return key;
|
|
52
56
|
}
|
|
53
57
|
function normalizePrefix(prefix) {
|
package/dist/storage/fs.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_errors = require("../errors-Bn6pe6yw.cjs");
|
|
3
|
-
const require_shared = require("../shared-
|
|
3
|
+
const require_shared = require("../shared-1HiN8LBf.cjs");
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
// src/storage/fs.ts
|
|
@@ -30,14 +30,25 @@ function fsStorage(options) {
|
|
|
30
30
|
const [realRoot, realTarget] = await Promise.all([(0, node_fs_promises.realpath)(root), (0, node_fs_promises.realpath)(path)]);
|
|
31
31
|
if (realTarget !== realRoot && !isInside(realRoot, realTarget)) throw traversal(operation, key);
|
|
32
32
|
}
|
|
33
|
+
async function createDirectory(directory, key) {
|
|
34
|
+
await require_shared.guardStorageCall("Fájlrendszer", "put", key, () => (0, node_fs_promises.mkdir)(root, { recursive: true }));
|
|
35
|
+
let current = root;
|
|
36
|
+
for (const segment of (0, node_path.relative)(root, directory).split(node_path.sep)) {
|
|
37
|
+
if (segment === "") continue;
|
|
38
|
+
const next = (0, node_path.join)(current, segment);
|
|
39
|
+
await require_shared.guardStorageCall("Fájlrendszer", "put", key, () => (0, node_fs_promises.mkdir)(next).catch((error) => {
|
|
40
|
+
if (!hasCode(error, "EEXIST")) throw error;
|
|
41
|
+
}));
|
|
42
|
+
await assertRealPathInside(next, "put", key);
|
|
43
|
+
current = next;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
33
46
|
return {
|
|
34
47
|
directory: root,
|
|
35
48
|
pathFor: (key) => pathFor(key),
|
|
36
49
|
async put(key, body, putOptions) {
|
|
37
50
|
const target = pathFor(key, "put");
|
|
38
|
-
|
|
39
|
-
await require_shared.guardStorageCall("Fájlrendszer", "put", key, () => (0, node_fs_promises.mkdir)(directory, { recursive: true }));
|
|
40
|
-
await assertRealPathInside(directory, "put", key);
|
|
51
|
+
await createDirectory((0, node_path.dirname)(target), key);
|
|
41
52
|
const temporary = `${target}.${crypto.randomUUID()}.tmp`;
|
|
42
53
|
try {
|
|
43
54
|
await (0, node_fs_promises.writeFile)(temporary, body);
|
|
@@ -74,6 +85,12 @@ function fsStorage(options) {
|
|
|
74
85
|
},
|
|
75
86
|
async delete(key) {
|
|
76
87
|
const target = pathFor(key, "delete");
|
|
88
|
+
try {
|
|
89
|
+
await assertRealPathInside((0, node_path.dirname)(target), "delete", key);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (hasCode(error, "ENOENT")) return;
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
77
94
|
await require_shared.guardStorageCall("Fájlrendszer", "delete", key, () => (0, node_fs_promises.rm)(target, { force: true }));
|
|
78
95
|
},
|
|
79
96
|
async getUrl(key, urlOptions = {}) {
|
package/dist/storage/fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as SzamlazzError } from "../errors-CGGsW0Y5.js";
|
|
2
|
-
import { _ as guardStorageCall, d as normalizePrefix, f as resolveKey, h as StorageError, l as joinPublicUrl, m as unsupportedSignedUrl, u as missingPublicBaseUrl } from "../shared-
|
|
2
|
+
import { _ as guardStorageCall, d as normalizePrefix, f as resolveKey, h as StorageError, l as joinPublicUrl, m as unsupportedSignedUrl, u as missingPublicBaseUrl } from "../shared-DF7m3lM7.js";
|
|
3
3
|
import { mkdir, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
4
|
-
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
4
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
// src/storage/fs.ts
|
|
6
6
|
function isInside(root, target) {
|
|
7
7
|
const path = relative(root, target);
|
|
@@ -29,14 +29,25 @@ function fsStorage(options) {
|
|
|
29
29
|
const [realRoot, realTarget] = await Promise.all([realpath(root), realpath(path)]);
|
|
30
30
|
if (realTarget !== realRoot && !isInside(realRoot, realTarget)) throw traversal(operation, key);
|
|
31
31
|
}
|
|
32
|
+
async function createDirectory(directory, key) {
|
|
33
|
+
await guardStorageCall("Fájlrendszer", "put", key, () => mkdir(root, { recursive: true }));
|
|
34
|
+
let current = root;
|
|
35
|
+
for (const segment of relative(root, directory).split(sep)) {
|
|
36
|
+
if (segment === "") continue;
|
|
37
|
+
const next = join(current, segment);
|
|
38
|
+
await guardStorageCall("Fájlrendszer", "put", key, () => mkdir(next).catch((error) => {
|
|
39
|
+
if (!hasCode(error, "EEXIST")) throw error;
|
|
40
|
+
}));
|
|
41
|
+
await assertRealPathInside(next, "put", key);
|
|
42
|
+
current = next;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
32
45
|
return {
|
|
33
46
|
directory: root,
|
|
34
47
|
pathFor: (key) => pathFor(key),
|
|
35
48
|
async put(key, body, putOptions) {
|
|
36
49
|
const target = pathFor(key, "put");
|
|
37
|
-
|
|
38
|
-
await guardStorageCall("Fájlrendszer", "put", key, () => mkdir(directory, { recursive: true }));
|
|
39
|
-
await assertRealPathInside(directory, "put", key);
|
|
50
|
+
await createDirectory(dirname(target), key);
|
|
40
51
|
const temporary = `${target}.${crypto.randomUUID()}.tmp`;
|
|
41
52
|
try {
|
|
42
53
|
await writeFile(temporary, body);
|
|
@@ -73,6 +84,12 @@ function fsStorage(options) {
|
|
|
73
84
|
},
|
|
74
85
|
async delete(key) {
|
|
75
86
|
const target = pathFor(key, "delete");
|
|
87
|
+
try {
|
|
88
|
+
await assertRealPathInside(dirname(target), "delete", key);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if (hasCode(error, "ENOENT")) return;
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
76
93
|
await guardStorageCall("Fájlrendszer", "delete", key, () => rm(target, { force: true }));
|
|
77
94
|
},
|
|
78
95
|
async getUrl(key, urlOptions = {}) {
|
package/dist/storage/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_errors = require("../errors-Bn6pe6yw.cjs");
|
|
3
3
|
const require_binary = require("../binary-CdpKlNNI.cjs");
|
|
4
4
|
const require_dates = require("../dates-oOp3ypPP.cjs");
|
|
5
|
-
const require_shared = require("../shared-
|
|
5
|
+
const require_shared = require("../shared-1HiN8LBf.cjs");
|
|
6
6
|
const require_url = require("../url-CRIlLxPE.cjs");
|
|
7
7
|
// src/storage/keys.ts
|
|
8
8
|
const DEFAULT_INVOICE_KEY_PREFIX = "szamlak";
|
package/dist/storage/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as SzamlazzError } from "../errors-CGGsW0Y5.js";
|
|
2
2
|
import { a as isPdf } from "../binary-DuKBSfH-.js";
|
|
3
3
|
import { a as todayInBudapest, n as toAgentDate } from "../dates-DWsZOdaO.js";
|
|
4
|
-
import { _ as guardStorageCall, a as assertStorageKey, c as encodeRfc3986, d as normalizePrefix, f as resolveKey, g as describeError, h as StorageError, i as assertExpires, l as joinPublicUrl, m as unsupportedSignedUrl, n as PDF_CONTENT_TYPE, o as basename, p as toArrayBuffer, r as S3_MAX_PRESIGN_SECONDS, s as encodeKeyPath, u as missingPublicBaseUrl, v as isStorageError } from "../shared-
|
|
4
|
+
import { _ as guardStorageCall, a as assertStorageKey, c as encodeRfc3986, d as normalizePrefix, f as resolveKey, g as describeError, h as StorageError, i as assertExpires, l as joinPublicUrl, m as unsupportedSignedUrl, n as PDF_CONTENT_TYPE, o as basename, p as toArrayBuffer, r as S3_MAX_PRESIGN_SECONDS, s as encodeKeyPath, u as missingPublicBaseUrl, v as isStorageError } from "../shared-DF7m3lM7.js";
|
|
5
5
|
import { n as trimTrailingSlashes } from "../url-DeCMiKVm.js";
|
|
6
6
|
// src/storage/keys.ts
|
|
7
7
|
const DEFAULT_INVOICE_KEY_PREFIX = "szamlak";
|
package/dist/stores/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_session = require("../session-BYotpR_s.cjs");
|
|
3
|
-
const require_stores = require("../stores-
|
|
3
|
+
const require_stores = require("../stores-GFAEgthh.cjs");
|
|
4
4
|
exports.CLOUDFLARE_KV_MIN_TTL_SECONDS = require_stores.CLOUDFLARE_KV_MIN_TTL_SECONDS;
|
|
5
5
|
exports.DURABLE_OBJECT_STORE_URL = require_stores.DURABLE_OBJECT_STORE_URL;
|
|
6
6
|
exports.SESSION_TTL_SECONDS = require_session.SESSION_TTL_SECONDS;
|
package/dist/stores/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as memoryStore, n as memoryCookieStore, o as storeCapabilities, t as SESSION_TTL_SECONDS } from "../session-DZeE1ryt.js";
|
|
2
|
-
import { a as upstashRedisCookieStore, c as customCookieStore, d as resilientCookieStore, i as diagnoseStore, l as CLOUDFLARE_KV_MIN_TTL_SECONDS, n as durableObjectStore, o as nodeRedisCookieStore, r as handleDurableObjectStoreRequest, s as ioredisCookieStore, t as DURABLE_OBJECT_STORE_URL, u as cloudflareKvCookieStore } from "../stores-
|
|
2
|
+
import { a as upstashRedisCookieStore, c as customCookieStore, d as resilientCookieStore, i as diagnoseStore, l as CLOUDFLARE_KV_MIN_TTL_SECONDS, n as durableObjectStore, o as nodeRedisCookieStore, r as handleDurableObjectStoreRequest, s as ioredisCookieStore, t as DURABLE_OBJECT_STORE_URL, u as cloudflareKvCookieStore } from "../stores-BHBPYrWE.js";
|
|
3
3
|
export { CLOUDFLARE_KV_MIN_TTL_SECONDS, DURABLE_OBJECT_STORE_URL, SESSION_TTL_SECONDS, cloudflareKvCookieStore, cloudflareKvCookieStore as cloudflareKvStore, customCookieStore, customCookieStore as customStore, diagnoseStore, durableObjectStore, handleDurableObjectStoreRequest, ioredisCookieStore, ioredisCookieStore as ioredisStore, memoryCookieStore, memoryStore, nodeRedisCookieStore, nodeRedisCookieStore as nodeRedisStore, resilientCookieStore, resilientCookieStore as resilientStore, storeCapabilities, upstashRedisCookieStore, upstashRedisCookieStore as upstashRedisStore };
|
|
@@ -254,7 +254,7 @@ async function diagnoseStore(store, options = {}) {
|
|
|
254
254
|
if (first !== 1 || second !== 2) throw new Error(`a számláló értékei: ${first}, ${second}`);
|
|
255
255
|
await store.delete(key);
|
|
256
256
|
});
|
|
257
|
-
await Promise.resolve(store.delete(key)).catch(() => void 0);
|
|
257
|
+
await Promise.resolve().then(() => store.delete(key)).catch(() => void 0);
|
|
258
258
|
if (!capabilities.setIfAbsent) problems.push("Nincs setIfAbsent: createOnce zárnak nem alkalmas (például Cloudflare KV).");
|
|
259
259
|
if (!capabilities.increment) problems.push("Nincs increment: naplónak nem alkalmas, a próbálkozás-napló nem atomikus.");
|
|
260
260
|
return {
|
|
@@ -254,7 +254,7 @@ async function diagnoseStore(store, options = {}) {
|
|
|
254
254
|
if (first !== 1 || second !== 2) throw new Error(`a számláló értékei: ${first}, ${second}`);
|
|
255
255
|
await store.delete(key);
|
|
256
256
|
});
|
|
257
|
-
await Promise.resolve(store.delete(key)).catch(() => void 0);
|
|
257
|
+
await Promise.resolve().then(() => store.delete(key)).catch(() => void 0);
|
|
258
258
|
if (!capabilities.setIfAbsent) problems.push("Nincs setIfAbsent: createOnce zárnak nem alkalmas (például Cloudflare KV).");
|
|
259
259
|
if (!capabilities.increment) problems.push("Nincs increment: naplónak nem alkalmas, a próbálkozás-napló nem atomikus.");
|
|
260
260
|
return {
|
package/dist/testing/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_create_once = require("../create-once-
|
|
2
|
+
const require_create_once = require("../create-once-BKUhF1Ov.cjs");
|
|
3
3
|
const require_errors = require("../errors-Bn6pe6yw.cjs");
|
|
4
4
|
const require_binary = require("../binary-CdpKlNNI.cjs");
|
|
5
5
|
const require_serialize = require("../serialize-DEU7r6Bk.cjs");
|
|
6
|
-
const require_issue = require("../issue-
|
|
6
|
+
const require_issue = require("../issue-bLLBTt9j.cjs");
|
|
7
7
|
const require_dates = require("../dates-oOp3ypPP.cjs");
|
|
8
8
|
const require_rounding = require("../rounding-CHmSK5Z2.cjs");
|
|
9
9
|
const require_vat = require("../vat-BkoiiKm4.cjs");
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as AgentAction, t as KasszaWarning } from "../warnings-DpuYhn39.cjs";
|
|
2
2
|
import { G as InvoiceType, M as CreateInvoiceInput, d as DocumentErrorMode, p as DocumentHook, st as SzamlazzError } from "../context-zGthvNo2.cjs";
|
|
3
3
|
import { r as Receipt } from "../types-_HKTOCuQ.cjs";
|
|
4
|
-
import { f as TaxpayerInfo, n as Kassza, r as KasszaDefaults } from "../client-
|
|
4
|
+
import { f as TaxpayerInfo, n as Kassza, r as KasszaDefaults } from "../client-CXjvVevB.cjs";
|
|
5
5
|
import { n as InvoiceDetails, o as InvoiceDetailsPayment } from "../get-BL4Fr8-P.cjs";
|
|
6
6
|
type FakeInvoiceTypeCode = "SZ" | "D" | "ES" | "VS" | "HS" | "SS" | "SL";
|
|
7
7
|
interface FakeAgentSeller {
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as AgentAction, t as KasszaWarning } from "../warnings-DpuYhn39.js";
|
|
2
2
|
import { G as InvoiceType, M as CreateInvoiceInput, d as DocumentErrorMode, p as DocumentHook, st as SzamlazzError } from "../context-BROX7Krw.js";
|
|
3
3
|
import { r as Receipt } from "../types-Z6rQoqHn.js";
|
|
4
|
-
import { f as TaxpayerInfo, n as Kassza, r as KasszaDefaults } from "../client-
|
|
4
|
+
import { f as TaxpayerInfo, n as Kassza, r as KasszaDefaults } from "../client-CvojBxd9.js";
|
|
5
5
|
import { n as InvoiceDetails, o as InvoiceDetailsPayment } from "../get-BL4Fr8-P.js";
|
|
6
6
|
type FakeInvoiceTypeCode = "SZ" | "D" | "ES" | "VS" | "HS" | "SS" | "SL";
|
|
7
7
|
interface FakeAgentSeller {
|