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.
- package/README.en.md +48 -0
- package/README.md +152 -22
- package/agents/README.md +6 -1
- package/agents/api.md +64 -12
- package/agents/pitfalls.md +12 -1
- package/agents/recipes.md +67 -8
- package/agents/skills/kassza/SKILL.md +3 -0
- package/agents/skills/migrate-from-szamlazz-js/SKILL.md +39 -0
- package/dist/batch/index.cjs +346 -0
- package/dist/batch/index.d.cts +91 -0
- package/dist/batch/index.d.ts +91 -0
- package/dist/batch/index.js +339 -0
- package/dist/cli.cjs +105 -14
- package/dist/cli.js +104 -13
- package/dist/{client-C-PdfL_P.cjs → client-CLFvJCVW.cjs} +358 -181
- package/dist/{client-CfaS1-Jx.js → client-Cvf-hTz_.js} +311 -152
- package/dist/{client-6MkeuFqD.d.ts → client-DeWWQ-RZ.d.ts} +99 -26
- package/dist/{client-B5FryKxJ.d.cts → client-SVZu25MB.d.cts} +99 -26
- package/dist/{context-DXNbTPwz.d.cts → context-CFNKzStE.d.cts} +82 -58
- package/dist/{context-BxQlIlug.d.ts → context-kb33TgzE.d.ts} +82 -58
- package/dist/cookie-stores/index.cjs +21 -150
- package/dist/cookie-stores/index.d.cts +4 -63
- package/dist/cookie-stores/index.d.ts +4 -63
- package/dist/cookie-stores/index.js +3 -144
- package/dist/create-CflXrPip.js +204 -0
- package/dist/create-CvUvLUaT.cjs +257 -0
- package/dist/{create-once-DgMtKKcG.cjs → create-once-9yxR_Er_.cjs} +285 -33
- package/dist/create-once-Bh6fOWkW.d.cts +20 -0
- package/dist/{create-once-Cz621l8r.js → create-once-Ca2gMk1h.js} +250 -34
- package/dist/create-once-VKp0tVow.d.ts +20 -0
- package/dist/data-link/index.cjs +4 -4
- package/dist/data-link/index.d.cts +2 -52
- package/dist/data-link/index.d.ts +2 -52
- package/dist/data-link/index.js +4 -4
- package/dist/delegation/index.cjs +4 -4
- package/dist/delegation/index.d.cts +2 -2
- package/dist/delegation/index.d.ts +2 -2
- package/dist/delegation/index.js +4 -4
- package/dist/{errors-DLrb0g64.js → errors-DtN4g5Z9.js} +9 -1
- package/dist/{errors-DxeuTslP.cjs → errors-EE96_6D_.cjs} +20 -0
- package/dist/{get-Csm2n0rZ.cjs → get-BdMTseh4.cjs} +9 -183
- package/dist/{get-DT3JEgQ6.js → get-CZEShCcj.js} +4 -124
- package/dist/index-BhUPY_EH.d.cts +109 -0
- package/dist/index-BqGgQ4t3.d.ts +109 -0
- package/dist/{index-CYAGCdKJ.d.cts → index-C-7yWV7L.d.cts} +24 -1
- package/dist/{index-CYAGCdKJ.d.ts → index-C-7yWV7L.d.ts} +24 -1
- package/dist/index.cjs +19 -5
- package/dist/index.d.cts +10 -20
- package/dist/index.d.ts +10 -20
- package/dist/index.js +6 -6
- package/dist/ipn/index.cjs +26 -5
- package/dist/ipn/index.d.cts +12 -1
- package/dist/ipn/index.d.ts +12 -1
- package/dist/ipn/index.js +26 -6
- package/dist/{issue-AGRohSm7.cjs → issue-Bin4tKD_.cjs} +416 -342
- package/dist/{issue-DtSLpVdJ.js → issue-DMA1Nbr1.js} +394 -266
- package/dist/journal/index.cjs +454 -0
- package/dist/journal/index.d.cts +18 -0
- package/dist/journal/index.d.ts +18 -0
- package/dist/journal/index.js +445 -0
- package/dist/journal-DvI81Kt7.d.cts +114 -0
- package/dist/journal-Y9qrIB8G.d.ts +114 -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/money/index.cjs +2 -1
- package/dist/money/index.d.cts +2 -2
- package/dist/money/index.d.ts +2 -2
- package/dist/money/index.js +2 -2
- package/dist/{money-t7uy1n91.js → money-Cw457SD6.js} +95 -3
- package/dist/{money-BxytJW6f.cjs → money-K9j0wPit.cjs} +99 -1
- package/dist/nav/index.cjs +2 -2
- package/dist/nav/index.d.cts +1 -1
- package/dist/nav/index.d.ts +1 -1
- package/dist/nav/index.js +2 -2
- package/dist/{nav-BEwcX7-N.cjs → nav-BNbc8U0R.cjs} +1 -1
- package/dist/{nav-CK1WgYo7.js → nav-BcCerwWS.js} +1 -1
- package/dist/node/index.cjs +124 -0
- package/dist/node/index.d.cts +35 -0
- package/dist/node/index.d.ts +35 -0
- package/dist/node/index.js +120 -0
- package/dist/observe/index.cjs +311 -0
- package/dist/observe/index.d.cts +53 -0
- package/dist/observe/index.d.ts +53 -0
- package/dist/observe/index.js +303 -0
- package/dist/once-BN_3B5OF.cjs +103 -0
- package/dist/once-CqqZxsXG.js +74 -0
- package/dist/{parse-C608ehqM.js → parse-Cr7yQ3_z.js} +2 -2
- package/dist/{parse-BJj-aqKy.cjs → parse-DOA2XQ3e.cjs} +2 -2
- package/dist/payments/barion.cjs +26 -2
- package/dist/payments/barion.d.cts +2 -2
- package/dist/payments/barion.d.ts +2 -2
- package/dist/payments/barion.js +26 -2
- package/dist/payments/index.cjs +7 -2
- package/dist/payments/index.d.cts +4 -4
- package/dist/payments/index.d.ts +4 -4
- package/dist/payments/index.js +3 -3
- package/dist/payments/paypal.cjs +16 -2
- package/dist/payments/paypal.d.cts +2 -2
- package/dist/payments/paypal.d.ts +2 -2
- package/dist/payments/paypal.js +16 -2
- package/dist/payments/revolut.cjs +16 -2
- package/dist/payments/revolut.d.cts +2 -2
- package/dist/payments/revolut.d.ts +2 -2
- package/dist/payments/revolut.js +16 -2
- package/dist/payments/simplepay.cjs +36 -4
- package/dist/payments/simplepay.d.cts +2 -2
- package/dist/payments/simplepay.d.ts +2 -2
- package/dist/payments/simplepay.js +36 -4
- package/dist/payments/stripe.cjs +19 -2
- package/dist/payments/stripe.d.cts +2 -2
- package/dist/payments/stripe.d.ts +2 -2
- package/dist/payments/stripe.js +19 -2
- package/dist/push-BXj0Sf0Z.d.ts +52 -0
- package/dist/push-D4nNbCNV.d.cts +52 -0
- package/dist/reference-B5TATqb5.js +124 -0
- package/dist/reference-BIdYMK0t.cjs +183 -0
- package/dist/reports/index.cjs +1 -1
- package/dist/reports/index.d.cts +1 -1
- package/dist/reports/index.d.ts +1 -1
- package/dist/reports/index.js +1 -1
- package/dist/{serialize-DSE_o9RK.js → serialize-B2eFh3D-.js} +5 -1
- package/dist/{serialize-BXOww1Uq.cjs → serialize-CquIsxA-.cjs} +5 -1
- package/dist/{server-Cd8HB661.js → server-BrJUbXs7.js} +8 -7
- package/dist/{server-C6PoNkdD.cjs → server-Dw9j8Mnd.cjs} +17 -16
- package/dist/session-Ckl5eJhV.d.ts +7 -0
- package/dist/{session-CKOuE6Jc.cjs → session-DeM5vjvC.cjs} +69 -13
- package/dist/{session-rMKaJcmq.js → session-SaEEXu2N.js} +58 -14
- package/dist/session-YbChChx7.d.cts +7 -0
- package/dist/storage/fs.cjs +1 -1
- package/dist/storage/fs.js +1 -1
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/store-C1rHd9DB.d.cts +19 -0
- package/dist/store-C1rHd9DB.d.ts +19 -0
- package/dist/stores/index.cjs +24 -0
- package/dist/stores/index.d.cts +4 -0
- package/dist/stores/index.d.ts +4 -0
- package/dist/stores/index.js +3 -0
- package/dist/stores-BNrS0dWl.cjs +506 -0
- package/dist/stores-DhjGBrl_.js +441 -0
- package/dist/testing/index.cjs +28 -16
- package/dist/testing/index.d.cts +6 -3
- package/dist/testing/index.d.ts +6 -3
- package/dist/testing/index.js +26 -14
- package/dist/{types-BVeR7KyU.d.ts → types-B1A8mUIE.d.cts} +13 -1
- package/dist/{types-BVeR7KyU.d.cts → types-ByAEvGsZ.d.ts} +13 -1
- package/dist/{types-k--zHf4l.d.ts → types-D1zDOH_F.d.ts} +1 -1
- package/dist/{types-DH8QoNZK.d.cts → types-lnKkQdot.d.cts} +1 -1
- package/dist/warnings-B3DXnveC.d.cts +31 -0
- package/dist/warnings-B3DXnveC.d.ts +31 -0
- package/dist/warnings-DeIw5RFj.cjs +20 -0
- package/dist/warnings-DwTl5J-2.js +15 -0
- package/dist/{webhook-CrEGohbg.js → webhook-CQVShAfI.js} +44 -1
- package/dist/{webhook-81giRMdQ.cjs → webhook-Ckj-_hPD.cjs} +67 -0
- package/dist/webhook-CmdhGiH5.d.cts +11 -0
- package/dist/webhook-D6lEejob.d.ts +11 -0
- package/llms.txt +4 -3
- package/package.json +92 -4
- package/dist/session-Dm_45x8K.d.cts +0 -11
- package/dist/session-Dm_45x8K.d.ts +0 -11
- package/dist/webhook-CpCMHhn2.d.ts +0 -6
- package/dist/webhook-CpMJuP6c.d.cts +0 -6
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { r as Receipt } from "./types-lnKkQdot.cjs";
|
|
2
|
+
import { n as InvoiceDetails } from "./get-Byc9T5WO.cjs";
|
|
3
|
+
//#region src/data-link/push.d.ts
|
|
4
|
+
type DataLinkPushKind = "invoice" | "incoming-invoice" | "bank-transaction" | "receipts";
|
|
5
|
+
type DataLinkErrorReason = "invalid_payload" | "payload_too_large" | "unknown_document" | "missing_key";
|
|
6
|
+
declare class DataLinkError extends Error {
|
|
7
|
+
override readonly name: string;
|
|
8
|
+
readonly reason: DataLinkErrorReason;
|
|
9
|
+
constructor(reason: DataLinkErrorReason, message: string, cause?: unknown);
|
|
10
|
+
}
|
|
11
|
+
interface DataLinkPushBase {
|
|
12
|
+
readonly key: string | undefined;
|
|
13
|
+
readonly raw: string;
|
|
14
|
+
}
|
|
15
|
+
interface DataLinkInvoicePush extends DataLinkPushBase {
|
|
16
|
+
readonly kind: "invoice" | "incoming-invoice";
|
|
17
|
+
readonly id: number;
|
|
18
|
+
readonly invoice: InvoiceDetails;
|
|
19
|
+
readonly deleted: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface DataLinkBankTransactionPartner {
|
|
22
|
+
readonly name?: string | undefined;
|
|
23
|
+
readonly accountNumber?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
interface DataLinkBankTransaction {
|
|
26
|
+
readonly id: number;
|
|
27
|
+
readonly accountNumber: string;
|
|
28
|
+
readonly valueDate: string;
|
|
29
|
+
readonly direction: "in" | "out";
|
|
30
|
+
readonly type?: string | undefined;
|
|
31
|
+
readonly technical: boolean;
|
|
32
|
+
readonly amount: number;
|
|
33
|
+
readonly currency: string;
|
|
34
|
+
readonly partner?: DataLinkBankTransactionPartner | undefined;
|
|
35
|
+
readonly reference?: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
interface DataLinkBankTransactionPush extends DataLinkPushBase {
|
|
38
|
+
readonly kind: "bank-transaction";
|
|
39
|
+
readonly transaction: DataLinkBankTransaction;
|
|
40
|
+
}
|
|
41
|
+
interface DataLinkArchivedReceipt {
|
|
42
|
+
readonly receipt: Receipt;
|
|
43
|
+
readonly issuerTaxNumber?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
interface DataLinkReceiptsPush extends DataLinkPushBase {
|
|
46
|
+
readonly kind: "receipts";
|
|
47
|
+
readonly receipts: readonly DataLinkArchivedReceipt[];
|
|
48
|
+
}
|
|
49
|
+
type DataLinkPush = DataLinkInvoicePush | DataLinkBankTransactionPush | DataLinkReceiptsPush;
|
|
50
|
+
declare function parseDataLinkPush(xml: string, key?: string | undefined): DataLinkPush;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { DataLinkError as a, DataLinkPush as c, parseDataLinkPush as d, DataLinkBankTransactionPush as i, DataLinkPushKind as l, DataLinkBankTransaction as n, DataLinkErrorReason as o, DataLinkBankTransactionPartner as r, DataLinkInvoicePush as s, DataLinkArchivedReceipt as t, DataLinkReceiptsPush as u };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { r as SzamlazzError } from "./errors-DtN4g5Z9.js";
|
|
2
|
+
import { t as base64ToBytes } from "./binary-D0M9U2MD.js";
|
|
3
|
+
import { c as childNumber, l as childText } from "./serialize-B2eFh3D-.js";
|
|
4
|
+
import { a as looksLikeXml, c as readDocumentHeaders, d as throwIfHeaderError, f as throwIfHttpError, h as unexpectedResponse, l as readHeader, m as throwIfXmlFailure, o as parseDoneText, p as throwIfTextError, s as parseResponseXml } from "./parse-Cr7yQ3_z.js";
|
|
5
|
+
import { n as toAgentDate } from "./dates-CXyj7Azy.js";
|
|
6
|
+
//#region src/invoices/reference.ts
|
|
7
|
+
const AGENT_XSD_BASE_URL = "https://www.szamlazz.hu/szamla/docs/xsds/";
|
|
8
|
+
function validationError(message) {
|
|
9
|
+
return new SzamlazzError(message, { category: "validation" });
|
|
10
|
+
}
|
|
11
|
+
function requireText(value, message) {
|
|
12
|
+
const trimmed = typeof value === "string" ? value.trim() : "";
|
|
13
|
+
if (trimmed === "") throw validationError(message);
|
|
14
|
+
return trimmed;
|
|
15
|
+
}
|
|
16
|
+
function optionalText(value) {
|
|
17
|
+
const trimmed = value?.trim();
|
|
18
|
+
return trimmed ? trimmed : void 0;
|
|
19
|
+
}
|
|
20
|
+
function agentDate(input, field) {
|
|
21
|
+
try {
|
|
22
|
+
return toAgentDate(input);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
25
|
+
throw new SzamlazzError(`Érvénytelen dátum (${field}): ${detail}`, {
|
|
26
|
+
category: "validation",
|
|
27
|
+
cause: error
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function optionalAgentDate(input, field) {
|
|
32
|
+
return input === void 0 ? void 0 : agentDate(input, field);
|
|
33
|
+
}
|
|
34
|
+
const REFERENCE_KEYS = [
|
|
35
|
+
"invoiceNumber",
|
|
36
|
+
"orderNumber",
|
|
37
|
+
"externalId"
|
|
38
|
+
];
|
|
39
|
+
const REFERENCE_HINT = "Add meg a számlaszámot szövegként, vagy pontosan egyet ezek közül: { invoiceNumber }, { orderNumber }, { externalId }.";
|
|
40
|
+
function resolveInvoiceReference(reference) {
|
|
41
|
+
if (typeof reference === "string") return {
|
|
42
|
+
kind: "invoiceNumber",
|
|
43
|
+
value: requireText(reference, `Üres számlaszám. ${REFERENCE_HINT}`)
|
|
44
|
+
};
|
|
45
|
+
if (typeof reference !== "object" || reference === null) throw validationError(`Érvénytelen bizonylat-hivatkozás. ${REFERENCE_HINT}`);
|
|
46
|
+
const record = reference;
|
|
47
|
+
const present = REFERENCE_KEYS.filter((key) => record[key] !== void 0);
|
|
48
|
+
const [kind] = present;
|
|
49
|
+
if (kind === void 0 || present.length > 1) throw validationError(`Érvénytelen bizonylat-hivatkozás. ${REFERENCE_HINT}`);
|
|
50
|
+
return {
|
|
51
|
+
kind,
|
|
52
|
+
value: requireText(record[kind], `Üres ${kind} érték. ${REFERENCE_HINT}`)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function referenceValue(reference, kind) {
|
|
56
|
+
return reference.kind === kind ? reference.value : void 0;
|
|
57
|
+
}
|
|
58
|
+
function readNumericHeader(headers, name) {
|
|
59
|
+
const value = readHeader(headers, name);
|
|
60
|
+
if (value === void 0) return void 0;
|
|
61
|
+
const parsed = Number(value.replace(",", "."));
|
|
62
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
63
|
+
}
|
|
64
|
+
function headerSummary(response) {
|
|
65
|
+
const headers = readDocumentHeaders(response.headers);
|
|
66
|
+
return {
|
|
67
|
+
number: headers.number,
|
|
68
|
+
netTotal: headers.netTotal,
|
|
69
|
+
grossTotal: headers.grossTotal,
|
|
70
|
+
outstanding: readNumericHeader(response.headers, "szlahu_kintlevoseg"),
|
|
71
|
+
buyerAccountUrl: headers.buyerAccountUrl
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function decodeResponsePdf(root, response) {
|
|
75
|
+
const encoded = childText(root, "pdf");
|
|
76
|
+
if (encoded === void 0) return void 0;
|
|
77
|
+
try {
|
|
78
|
+
return base64ToBytes(encoded);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
throw new SzamlazzError("A válaszban kapott PDF nem érvényes base64.", {
|
|
81
|
+
category: "unexpected_response",
|
|
82
|
+
action: response.action,
|
|
83
|
+
httpStatus: response.status,
|
|
84
|
+
cause: error
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function readInvoiceResultXml(root, response) {
|
|
89
|
+
const headers = headerSummary(response);
|
|
90
|
+
return {
|
|
91
|
+
number: childText(root, "szamlaszam") ?? headers.number,
|
|
92
|
+
netTotal: childNumber(root, "szamlanetto") ?? headers.netTotal,
|
|
93
|
+
grossTotal: childNumber(root, "szamlabrutto") ?? headers.grossTotal,
|
|
94
|
+
outstanding: childNumber(root, "kintlevoseg") ?? headers.outstanding,
|
|
95
|
+
buyerAccountUrl: childText(root, "vevoifiokurl") ?? headers.buyerAccountUrl,
|
|
96
|
+
pdf: decodeResponsePdf(root, response)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const INVOICE_RESULT_ROOT = "xmlszamlavalasz";
|
|
100
|
+
function parseInvoiceResult(response) {
|
|
101
|
+
throwIfHeaderError(response);
|
|
102
|
+
if (response.isPdf) return {
|
|
103
|
+
...headerSummary(response),
|
|
104
|
+
pdf: response.body
|
|
105
|
+
};
|
|
106
|
+
throwIfTextError(response);
|
|
107
|
+
throwIfHttpError(response);
|
|
108
|
+
if (looksLikeXml(response)) {
|
|
109
|
+
const root = parseResponseXml(response);
|
|
110
|
+
throwIfXmlFailure(root, response);
|
|
111
|
+
if (root.name !== INVOICE_RESULT_ROOT || childText(root, "sikeres")?.toLowerCase() !== "true") throw unexpectedResponse(response, `${INVOICE_RESULT_ROOT} XML választ vártunk.`);
|
|
112
|
+
return readInvoiceResultXml(root, response);
|
|
113
|
+
}
|
|
114
|
+
const headers = headerSummary(response);
|
|
115
|
+
const done = parseDoneText(response.text());
|
|
116
|
+
if (done) return {
|
|
117
|
+
...headers,
|
|
118
|
+
number: done.number ?? headers.number
|
|
119
|
+
};
|
|
120
|
+
if (headers.number !== void 0) return headers;
|
|
121
|
+
throw unexpectedResponse(response);
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { optionalText as a, requireText as c, optionalAgentDate as i, resolveInvoiceReference as l, agentDate as n, parseInvoiceResult as o, decodeResponsePdf as r, referenceValue as s, AGENT_XSD_BASE_URL as t, validationError as u };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
const require_errors = require("./errors-EE96_6D_.cjs");
|
|
2
|
+
const require_binary = require("./binary-B89HM03_.cjs");
|
|
3
|
+
const require_serialize = require("./serialize-CquIsxA-.cjs");
|
|
4
|
+
const require_parse = require("./parse-DOA2XQ3e.cjs");
|
|
5
|
+
const require_dates = require("./dates-CPgBodkP.cjs");
|
|
6
|
+
//#region src/invoices/reference.ts
|
|
7
|
+
const AGENT_XSD_BASE_URL = "https://www.szamlazz.hu/szamla/docs/xsds/";
|
|
8
|
+
function validationError(message) {
|
|
9
|
+
return new require_errors.SzamlazzError(message, { category: "validation" });
|
|
10
|
+
}
|
|
11
|
+
function requireText(value, message) {
|
|
12
|
+
const trimmed = typeof value === "string" ? value.trim() : "";
|
|
13
|
+
if (trimmed === "") throw validationError(message);
|
|
14
|
+
return trimmed;
|
|
15
|
+
}
|
|
16
|
+
function optionalText(value) {
|
|
17
|
+
const trimmed = value?.trim();
|
|
18
|
+
return trimmed ? trimmed : void 0;
|
|
19
|
+
}
|
|
20
|
+
function agentDate(input, field) {
|
|
21
|
+
try {
|
|
22
|
+
return require_dates.toAgentDate(input);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
25
|
+
throw new require_errors.SzamlazzError(`Érvénytelen dátum (${field}): ${detail}`, {
|
|
26
|
+
category: "validation",
|
|
27
|
+
cause: error
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function optionalAgentDate(input, field) {
|
|
32
|
+
return input === void 0 ? void 0 : agentDate(input, field);
|
|
33
|
+
}
|
|
34
|
+
const REFERENCE_KEYS = [
|
|
35
|
+
"invoiceNumber",
|
|
36
|
+
"orderNumber",
|
|
37
|
+
"externalId"
|
|
38
|
+
];
|
|
39
|
+
const REFERENCE_HINT = "Add meg a számlaszámot szövegként, vagy pontosan egyet ezek közül: { invoiceNumber }, { orderNumber }, { externalId }.";
|
|
40
|
+
function resolveInvoiceReference(reference) {
|
|
41
|
+
if (typeof reference === "string") return {
|
|
42
|
+
kind: "invoiceNumber",
|
|
43
|
+
value: requireText(reference, `Üres számlaszám. ${REFERENCE_HINT}`)
|
|
44
|
+
};
|
|
45
|
+
if (typeof reference !== "object" || reference === null) throw validationError(`Érvénytelen bizonylat-hivatkozás. ${REFERENCE_HINT}`);
|
|
46
|
+
const record = reference;
|
|
47
|
+
const present = REFERENCE_KEYS.filter((key) => record[key] !== void 0);
|
|
48
|
+
const [kind] = present;
|
|
49
|
+
if (kind === void 0 || present.length > 1) throw validationError(`Érvénytelen bizonylat-hivatkozás. ${REFERENCE_HINT}`);
|
|
50
|
+
return {
|
|
51
|
+
kind,
|
|
52
|
+
value: requireText(record[kind], `Üres ${kind} érték. ${REFERENCE_HINT}`)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function referenceValue(reference, kind) {
|
|
56
|
+
return reference.kind === kind ? reference.value : void 0;
|
|
57
|
+
}
|
|
58
|
+
function readNumericHeader(headers, name) {
|
|
59
|
+
const value = require_parse.readHeader(headers, name);
|
|
60
|
+
if (value === void 0) return void 0;
|
|
61
|
+
const parsed = Number(value.replace(",", "."));
|
|
62
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
63
|
+
}
|
|
64
|
+
function headerSummary(response) {
|
|
65
|
+
const headers = require_parse.readDocumentHeaders(response.headers);
|
|
66
|
+
return {
|
|
67
|
+
number: headers.number,
|
|
68
|
+
netTotal: headers.netTotal,
|
|
69
|
+
grossTotal: headers.grossTotal,
|
|
70
|
+
outstanding: readNumericHeader(response.headers, "szlahu_kintlevoseg"),
|
|
71
|
+
buyerAccountUrl: headers.buyerAccountUrl
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function decodeResponsePdf(root, response) {
|
|
75
|
+
const encoded = require_serialize.childText(root, "pdf");
|
|
76
|
+
if (encoded === void 0) return void 0;
|
|
77
|
+
try {
|
|
78
|
+
return require_binary.base64ToBytes(encoded);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
throw new require_errors.SzamlazzError("A válaszban kapott PDF nem érvényes base64.", {
|
|
81
|
+
category: "unexpected_response",
|
|
82
|
+
action: response.action,
|
|
83
|
+
httpStatus: response.status,
|
|
84
|
+
cause: error
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function readInvoiceResultXml(root, response) {
|
|
89
|
+
const headers = headerSummary(response);
|
|
90
|
+
return {
|
|
91
|
+
number: require_serialize.childText(root, "szamlaszam") ?? headers.number,
|
|
92
|
+
netTotal: require_serialize.childNumber(root, "szamlanetto") ?? headers.netTotal,
|
|
93
|
+
grossTotal: require_serialize.childNumber(root, "szamlabrutto") ?? headers.grossTotal,
|
|
94
|
+
outstanding: require_serialize.childNumber(root, "kintlevoseg") ?? headers.outstanding,
|
|
95
|
+
buyerAccountUrl: require_serialize.childText(root, "vevoifiokurl") ?? headers.buyerAccountUrl,
|
|
96
|
+
pdf: decodeResponsePdf(root, response)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const INVOICE_RESULT_ROOT = "xmlszamlavalasz";
|
|
100
|
+
function parseInvoiceResult(response) {
|
|
101
|
+
require_parse.throwIfHeaderError(response);
|
|
102
|
+
if (response.isPdf) return {
|
|
103
|
+
...headerSummary(response),
|
|
104
|
+
pdf: response.body
|
|
105
|
+
};
|
|
106
|
+
require_parse.throwIfTextError(response);
|
|
107
|
+
require_parse.throwIfHttpError(response);
|
|
108
|
+
if (require_parse.looksLikeXml(response)) {
|
|
109
|
+
const root = require_parse.parseResponseXml(response);
|
|
110
|
+
require_parse.throwIfXmlFailure(root, response);
|
|
111
|
+
if (root.name !== INVOICE_RESULT_ROOT || require_serialize.childText(root, "sikeres")?.toLowerCase() !== "true") throw require_parse.unexpectedResponse(response, `${INVOICE_RESULT_ROOT} XML választ vártunk.`);
|
|
112
|
+
return readInvoiceResultXml(root, response);
|
|
113
|
+
}
|
|
114
|
+
const headers = headerSummary(response);
|
|
115
|
+
const done = require_parse.parseDoneText(response.text());
|
|
116
|
+
if (done) return {
|
|
117
|
+
...headers,
|
|
118
|
+
number: done.number ?? headers.number
|
|
119
|
+
};
|
|
120
|
+
if (headers.number !== void 0) return headers;
|
|
121
|
+
throw require_parse.unexpectedResponse(response);
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
Object.defineProperty(exports, "AGENT_XSD_BASE_URL", {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function() {
|
|
127
|
+
return AGENT_XSD_BASE_URL;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(exports, "agentDate", {
|
|
131
|
+
enumerable: true,
|
|
132
|
+
get: function() {
|
|
133
|
+
return agentDate;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
Object.defineProperty(exports, "decodeResponsePdf", {
|
|
137
|
+
enumerable: true,
|
|
138
|
+
get: function() {
|
|
139
|
+
return decodeResponsePdf;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(exports, "optionalAgentDate", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function() {
|
|
145
|
+
return optionalAgentDate;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
Object.defineProperty(exports, "optionalText", {
|
|
149
|
+
enumerable: true,
|
|
150
|
+
get: function() {
|
|
151
|
+
return optionalText;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(exports, "parseInvoiceResult", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function() {
|
|
157
|
+
return parseInvoiceResult;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
Object.defineProperty(exports, "referenceValue", {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function() {
|
|
163
|
+
return referenceValue;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(exports, "requireText", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function() {
|
|
169
|
+
return requireText;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(exports, "resolveInvoiceReference", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function() {
|
|
175
|
+
return resolveInvoiceReference;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(exports, "validationError", {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: function() {
|
|
181
|
+
return validationError;
|
|
182
|
+
}
|
|
183
|
+
});
|
package/dist/reports/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rounding = require("../rounding-TxoWy2ww.cjs");
|
|
3
|
-
const require_nav = require("../nav-
|
|
3
|
+
const require_nav = require("../nav-BNbc8U0R.cjs");
|
|
4
4
|
//#region src/reports/close.ts
|
|
5
5
|
function sign(receipt, amount) {
|
|
6
6
|
return receipt.type === "reversal" ? -Math.abs(amount) : amount;
|
package/dist/reports/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ReceiptItem, p as ReceiptVatRate, r as Receipt } from "../types-
|
|
1
|
+
import { a as ReceiptItem, p as ReceiptVatRate, r as Receipt } from "../types-lnKkQdot.cjs";
|
|
2
2
|
//#region src/reports/close.d.ts
|
|
3
3
|
interface DailyClosePaymentTotal {
|
|
4
4
|
readonly method: string;
|
package/dist/reports/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ReceiptItem, p as ReceiptVatRate, r as Receipt } from "../types-
|
|
1
|
+
import { a as ReceiptItem, p as ReceiptVatRate, r as Receipt } from "../types-D1zDOH_F.js";
|
|
2
2
|
//#region src/reports/close.d.ts
|
|
3
3
|
interface DailyClosePaymentTotal {
|
|
4
4
|
readonly method: string;
|
package/dist/reports/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as roundMoney } from "../rounding-BLyHjjI5.js";
|
|
2
|
-
import { a as splitReceiptNumber, c as navVatCategory, i as navDailyReports, n as describeNavReport, o as NAV_VAT_CATEGORIES, r as navCurrencyCode, s as isNavVatCategory, t as compareReceiptNumbers } from "../nav-
|
|
2
|
+
import { a as splitReceiptNumber, c as navVatCategory, i as navDailyReports, n as describeNavReport, o as NAV_VAT_CATEGORIES, r as navCurrencyCode, s as isNavVatCategory, t as compareReceiptNumbers } from "../nav-BcCerwWS.js";
|
|
3
3
|
//#region src/reports/close.ts
|
|
4
4
|
function sign(receipt, amount) {
|
|
5
5
|
return receipt.type === "reversal" ? -Math.abs(amount) : amount;
|
|
@@ -110,7 +110,10 @@ function parseXml(xml) {
|
|
|
110
110
|
if (parent) parent.children.push(element);
|
|
111
111
|
else if (root) throw new XmlParseError("Az XML-nek csak egy gyökéreleme lehet");
|
|
112
112
|
else root = element;
|
|
113
|
-
if (!selfClosing)
|
|
113
|
+
if (!selfClosing) {
|
|
114
|
+
if (stack.length >= 256) throw new XmlParseError(`Az XML túl mélyen ágyazott (legfeljebb 256 szint).`);
|
|
115
|
+
stack.push(element);
|
|
116
|
+
}
|
|
114
117
|
}
|
|
115
118
|
if (stack.length > 0) throw new XmlParseError(`Lezáratlan elem: ${stack.at(-1)?.name}`);
|
|
116
119
|
if (!root) throw new XmlParseError("Üres XML dokumentum");
|
|
@@ -162,6 +165,7 @@ function optionalEl(name, content) {
|
|
|
162
165
|
function isAllowedXmlChar(codePoint) {
|
|
163
166
|
if (codePoint === 9 || codePoint === 10 || codePoint === 13) return true;
|
|
164
167
|
if (codePoint < 32) return false;
|
|
168
|
+
if (codePoint >= 55296 && codePoint <= 57343) return false;
|
|
165
169
|
return codePoint !== 65534 && codePoint !== 65535;
|
|
166
170
|
}
|
|
167
171
|
function stripInvalidXmlChars(value) {
|
|
@@ -110,7 +110,10 @@ function parseXml(xml) {
|
|
|
110
110
|
if (parent) parent.children.push(element);
|
|
111
111
|
else if (root) throw new XmlParseError("Az XML-nek csak egy gyökéreleme lehet");
|
|
112
112
|
else root = element;
|
|
113
|
-
if (!selfClosing)
|
|
113
|
+
if (!selfClosing) {
|
|
114
|
+
if (stack.length >= 256) throw new XmlParseError(`Az XML túl mélyen ágyazott (legfeljebb 256 szint).`);
|
|
115
|
+
stack.push(element);
|
|
116
|
+
}
|
|
114
117
|
}
|
|
115
118
|
if (stack.length > 0) throw new XmlParseError(`Lezáratlan elem: ${stack.at(-1)?.name}`);
|
|
116
119
|
if (!root) throw new XmlParseError("Üres XML dokumentum");
|
|
@@ -162,6 +165,7 @@ function optionalEl(name, content) {
|
|
|
162
165
|
function isAllowedXmlChar(codePoint) {
|
|
163
166
|
if (codePoint === 9 || codePoint === 10 || codePoint === 13) return true;
|
|
164
167
|
if (codePoint < 32) return false;
|
|
168
|
+
if (codePoint >= 55296 && codePoint <= 57343) return false;
|
|
165
169
|
return codePoint !== 65534 && codePoint !== 65535;
|
|
166
170
|
}
|
|
167
171
|
function stripInvalidXmlChars(value) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as createKassza } from "./client-
|
|
1
|
+
import { c as resolveInvoice, l as INVOICE_LANGUAGES } from "./create-once-Ca2gMk1h.js";
|
|
2
|
+
import { o as isSzamlazzError, r as SzamlazzError } from "./errors-DtN4g5Z9.js";
|
|
3
|
+
import { t as createKassza } from "./client-Cvf-hTz_.js";
|
|
4
|
+
import { i as resolveRecoveryDelay, n as isUncertainOutcome, r as recoverAfterFailure } from "./once-CqqZxsXG.js";
|
|
4
5
|
import { r as toBudapestDate } from "./dates-CXyj7Azy.js";
|
|
5
6
|
import { a as isVatRate } from "./vat-v_dcWCto.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { a as summarizeItems } from "./money-Cw457SD6.js";
|
|
8
|
+
import { l as RECEIPT_ONLY_VAT_CODES, n as calculateReceiptItems, t as buildCreateReceiptXml } from "./create-CflXrPip.js";
|
|
8
9
|
import { a as timingSafeEqual, i as hmacHex, n as digestHex } from "./crypto-usDg8L2K.js";
|
|
9
|
-
import { i as navDailyReports, n as describeNavReport } from "./nav-
|
|
10
|
+
import { i as navDailyReports, n as describeNavReport } from "./nav-BcCerwWS.js";
|
|
10
11
|
//#region src/mcp/protocol.ts
|
|
11
12
|
const MCP_MODERN_VERSIONS = ["2026-07-28"];
|
|
12
13
|
const MCP_LEGACY_VERSIONS = [
|
|
@@ -234,7 +235,7 @@ function createConfirmations(options) {
|
|
|
234
235
|
}
|
|
235
236
|
//#endregion
|
|
236
237
|
//#region src/core/version.ts
|
|
237
|
-
const KASSZA_VERSION = "0.
|
|
238
|
+
const KASSZA_VERSION = "0.13.0";
|
|
238
239
|
//#endregion
|
|
239
240
|
//#region src/mcp/tool-kit.ts
|
|
240
241
|
const LOCAL_READ = {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
const require_create_once = require("./create-once-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const require_client = require("./client-
|
|
1
|
+
const require_create_once = require("./create-once-9yxR_Er_.cjs");
|
|
2
|
+
const require_errors = require("./errors-EE96_6D_.cjs");
|
|
3
|
+
const require_client = require("./client-CLFvJCVW.cjs");
|
|
4
|
+
const require_once = require("./once-BN_3B5OF.cjs");
|
|
4
5
|
const require_dates = require("./dates-CPgBodkP.cjs");
|
|
5
6
|
const require_vat = require("./vat-g35srbNG.cjs");
|
|
6
|
-
const require_money = require("./money-
|
|
7
|
-
const
|
|
7
|
+
const require_money = require("./money-K9j0wPit.cjs");
|
|
8
|
+
const require_create = require("./create-CvUvLUaT.cjs");
|
|
8
9
|
const require_crypto = require("./crypto-Dpn4FHQ6.cjs");
|
|
9
|
-
const require_nav = require("./nav-
|
|
10
|
+
const require_nav = require("./nav-BNbc8U0R.cjs");
|
|
10
11
|
//#region src/mcp/protocol.ts
|
|
11
12
|
const MCP_MODERN_VERSIONS = ["2026-07-28"];
|
|
12
13
|
const MCP_LEGACY_VERSIONS = [
|
|
@@ -175,7 +176,7 @@ function invoiceVat(value, path) {
|
|
|
175
176
|
function receiptVat(value, path) {
|
|
176
177
|
const candidate = numericFromText(value);
|
|
177
178
|
if (require_vat.isVatRate(candidate)) return candidate;
|
|
178
|
-
const code =
|
|
179
|
+
const code = require_create.RECEIPT_ONLY_VAT_CODES.find((entry) => entry === candidate);
|
|
179
180
|
if (code !== void 0) return code;
|
|
180
181
|
throw vatFailure(value, path);
|
|
181
182
|
}
|
|
@@ -234,7 +235,7 @@ function createConfirmations(options) {
|
|
|
234
235
|
}
|
|
235
236
|
//#endregion
|
|
236
237
|
//#region src/core/version.ts
|
|
237
|
-
const KASSZA_VERSION = "0.
|
|
238
|
+
const KASSZA_VERSION = "0.13.0";
|
|
238
239
|
//#endregion
|
|
239
240
|
//#region src/mcp/tool-kit.ts
|
|
240
241
|
const LOCAL_READ = {
|
|
@@ -767,8 +768,8 @@ async function createInvoice(args, context) {
|
|
|
767
768
|
}
|
|
768
769
|
};
|
|
769
770
|
} catch (error) {
|
|
770
|
-
if (!
|
|
771
|
-
const recovered = await
|
|
771
|
+
if (!require_once.isUncertainOutcome(error)) throw error;
|
|
772
|
+
const recovered = await require_once.recoverAfterFailure(lookup, context.recoveryDelayMs, void 0);
|
|
772
773
|
if (!recovered) throw error;
|
|
773
774
|
return existingOutput(recovered, externalId, error.category !== "duplicate");
|
|
774
775
|
}
|
|
@@ -998,9 +999,9 @@ const CREATE_RECEIPT = "create_receipt";
|
|
|
998
999
|
const DUPLICATE_CALL_ID = 338;
|
|
999
1000
|
function previewOf(input, context) {
|
|
1000
1001
|
const defaults = context.defaults.receipt ?? {};
|
|
1001
|
-
|
|
1002
|
+
require_create.buildCreateReceiptXml([], defaults, input);
|
|
1002
1003
|
const currency = input.currency ?? defaults.currency ?? "HUF";
|
|
1003
|
-
const items =
|
|
1004
|
+
const items = require_create.calculateReceiptItems(input.items, currency);
|
|
1004
1005
|
const totals = require_money.summarizeItems(items.map((item) => item.amounts));
|
|
1005
1006
|
return {
|
|
1006
1007
|
currency,
|
|
@@ -1206,8 +1207,8 @@ async function reverseInvoice(args, context) {
|
|
|
1206
1207
|
downloadPdf: false
|
|
1207
1208
|
})).number, true);
|
|
1208
1209
|
} catch (error) {
|
|
1209
|
-
if (!
|
|
1210
|
-
const recovered = await
|
|
1210
|
+
if (!require_once.isUncertainOutcome(error)) throw error;
|
|
1211
|
+
const recovered = await require_once.recoverAfterFailure(lookup, context.recoveryDelayMs, void 0);
|
|
1211
1212
|
if (!recovered) throw error;
|
|
1212
1213
|
return reversalOutput("invoice", invoiceNumber, recovered.header.number, error.category !== "duplicate");
|
|
1213
1214
|
}
|
|
@@ -1230,7 +1231,7 @@ async function reverseReceipt(args, context) {
|
|
|
1230
1231
|
downloadPdf: false
|
|
1231
1232
|
})).number, true);
|
|
1232
1233
|
} catch (error) {
|
|
1233
|
-
if (!
|
|
1234
|
+
if (!require_once.isUncertainOutcome(error)) throw error;
|
|
1234
1235
|
if (!(await kassza.receipts.get({
|
|
1235
1236
|
receiptNumber,
|
|
1236
1237
|
downloadPdf: false
|
|
@@ -1338,7 +1339,7 @@ function toolDefinition(tool) {
|
|
|
1338
1339
|
function createKasszaMcpServer(options = {}) {
|
|
1339
1340
|
const allowWrite = options.allowWrite === true;
|
|
1340
1341
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
1341
|
-
const recoveryDelayMs =
|
|
1342
|
+
const recoveryDelayMs = require_once.resolveRecoveryDelay(options.recoveryDelayMs ?? 1e3);
|
|
1342
1343
|
const confirmations = createConfirmations({
|
|
1343
1344
|
secret: options.confirmationSecret,
|
|
1344
1345
|
ttlMs: options.confirmationTtlMs,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { n as KeyValueStore } from "./store-C1rHd9DB.js";
|
|
2
|
+
//#region src/core/session.d.ts
|
|
3
|
+
type CookieStore = KeyValueStore;
|
|
4
|
+
declare const SESSION_TTL_SECONDS: number;
|
|
5
|
+
declare function memoryCookieStore(): CookieStore;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SESSION_TTL_SECONDS as n, memoryCookieStore as r, CookieStore as t };
|
|
@@ -1,28 +1,72 @@
|
|
|
1
|
-
//#region src/core/
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/core/store.ts
|
|
2
|
+
function storeCapabilities(store) {
|
|
3
|
+
return {
|
|
4
|
+
setIfAbsent: typeof store.setIfAbsent === "function",
|
|
5
|
+
increment: typeof store.increment === "function",
|
|
6
|
+
deleteIfEquals: typeof store.deleteIfEquals === "function"
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function expiryOf(ttlSeconds) {
|
|
10
|
+
if (ttlSeconds === Number.POSITIVE_INFINITY) return ttlSeconds;
|
|
11
|
+
if (Number.isNaN(ttlSeconds)) return Date.now() + 1e3;
|
|
12
|
+
return Date.now() + ttlSeconds * 1e3;
|
|
13
|
+
}
|
|
14
|
+
function parseCounter(value) {
|
|
15
|
+
if (value === void 0) return 0;
|
|
16
|
+
const parsed = Number.parseInt(value, 10);
|
|
17
|
+
return Number.isInteger(parsed) ? parsed : 0;
|
|
18
|
+
}
|
|
19
|
+
function memoryStore() {
|
|
4
20
|
const entries = /* @__PURE__ */ new Map();
|
|
21
|
+
const read = (key) => {
|
|
22
|
+
const entry = entries.get(key);
|
|
23
|
+
if (!entry) return void 0;
|
|
24
|
+
if (entry.expiresAt <= Date.now()) {
|
|
25
|
+
entries.delete(key);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
return entry.value;
|
|
29
|
+
};
|
|
5
30
|
return {
|
|
6
|
-
get
|
|
7
|
-
const entry = entries.get(key);
|
|
8
|
-
if (!entry) return void 0;
|
|
9
|
-
if (entry.expiresAt <= Date.now()) {
|
|
10
|
-
entries.delete(key);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
return entry.value;
|
|
14
|
-
},
|
|
31
|
+
get: read,
|
|
15
32
|
set(key, value, ttlSeconds) {
|
|
16
33
|
entries.set(key, {
|
|
17
34
|
value,
|
|
18
|
-
expiresAt:
|
|
35
|
+
expiresAt: expiryOf(ttlSeconds)
|
|
19
36
|
});
|
|
20
37
|
},
|
|
21
38
|
delete(key) {
|
|
22
39
|
entries.delete(key);
|
|
40
|
+
},
|
|
41
|
+
setIfAbsent(key, value, ttlSeconds) {
|
|
42
|
+
if (read(key) !== void 0) return false;
|
|
43
|
+
entries.set(key, {
|
|
44
|
+
value,
|
|
45
|
+
expiresAt: expiryOf(ttlSeconds)
|
|
46
|
+
});
|
|
47
|
+
return true;
|
|
48
|
+
},
|
|
49
|
+
increment(key, ttlSeconds) {
|
|
50
|
+
const next = parseCounter(read(key)) + 1;
|
|
51
|
+
entries.set(key, {
|
|
52
|
+
value: String(next),
|
|
53
|
+
expiresAt: expiryOf(ttlSeconds)
|
|
54
|
+
});
|
|
55
|
+
return next;
|
|
56
|
+
},
|
|
57
|
+
deleteIfEquals(key, value) {
|
|
58
|
+
if (read(key) !== value) return false;
|
|
59
|
+
entries.delete(key);
|
|
60
|
+
return true;
|
|
23
61
|
}
|
|
24
62
|
};
|
|
25
63
|
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/core/session.ts
|
|
66
|
+
const SESSION_TTL_SECONDS = 5100;
|
|
67
|
+
function memoryCookieStore() {
|
|
68
|
+
return memoryStore();
|
|
69
|
+
}
|
|
26
70
|
const SESSION_KEY_PREFIX = "szamlazz:session:";
|
|
27
71
|
const sessionKeyEncoder = new TextEncoder();
|
|
28
72
|
async function sessionKeyFor(secret) {
|
|
@@ -78,6 +122,12 @@ Object.defineProperty(exports, "memoryCookieStore", {
|
|
|
78
122
|
return memoryCookieStore;
|
|
79
123
|
}
|
|
80
124
|
});
|
|
125
|
+
Object.defineProperty(exports, "memoryStore", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function() {
|
|
128
|
+
return memoryStore;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
81
131
|
Object.defineProperty(exports, "mergeSetCookies", {
|
|
82
132
|
enumerable: true,
|
|
83
133
|
get: function() {
|
|
@@ -90,3 +140,9 @@ Object.defineProperty(exports, "sessionKeyFor", {
|
|
|
90
140
|
return sessionKeyFor;
|
|
91
141
|
}
|
|
92
142
|
});
|
|
143
|
+
Object.defineProperty(exports, "storeCapabilities", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function() {
|
|
146
|
+
return storeCapabilities;
|
|
147
|
+
}
|
|
148
|
+
});
|