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
|
@@ -1,126 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_parse = require("./parse-BJj-aqKy.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
|
|
1
|
+
const require_serialize = require("./serialize-CquIsxA-.cjs");
|
|
2
|
+
const require_parse = require("./parse-DOA2XQ3e.cjs");
|
|
3
|
+
const require_reference = require("./reference-BIdYMK0t.cjs");
|
|
124
4
|
//#region src/invoices/get.ts
|
|
125
5
|
const INVOICE_DOCUMENT_TYPE_CODES = {
|
|
126
6
|
invoice: "SZ",
|
|
@@ -132,17 +12,17 @@ const INVOICE_DOCUMENT_TYPE_CODES = {
|
|
|
132
12
|
deliveryNote: "SL"
|
|
133
13
|
};
|
|
134
14
|
function buildGetInvoiceXml(credentials, reference, query = {}) {
|
|
135
|
-
const resolved = resolveInvoiceReference(reference);
|
|
15
|
+
const resolved = require_reference.resolveInvoiceReference(reference);
|
|
136
16
|
return require_serialize.buildXmlDocument({
|
|
137
17
|
root: "xmlszamlaxml",
|
|
138
18
|
namespace: "http://www.szamlazz.hu/xmlszamlaxml",
|
|
139
|
-
schemaLocation: `${AGENT_XSD_BASE_URL}agentxml/xmlszamlaxml.xsd`,
|
|
19
|
+
schemaLocation: `${require_reference.AGENT_XSD_BASE_URL}agentxml/xmlszamlaxml.xsd`,
|
|
140
20
|
children: [
|
|
141
21
|
...credentials,
|
|
142
|
-
require_serialize.optionalEl("szamlaszam", referenceValue(resolved, "invoiceNumber")),
|
|
143
|
-
require_serialize.optionalEl("rendelesSzam", referenceValue(resolved, "orderNumber")),
|
|
22
|
+
require_serialize.optionalEl("szamlaszam", require_reference.referenceValue(resolved, "invoiceNumber")),
|
|
23
|
+
require_serialize.optionalEl("rendelesSzam", require_reference.referenceValue(resolved, "orderNumber")),
|
|
144
24
|
require_serialize.optionalEl("pdf", query.includePdf),
|
|
145
|
-
require_serialize.optionalEl("szamlaKulsoAzon", referenceValue(resolved, "externalId"))
|
|
25
|
+
require_serialize.optionalEl("szamlaKulsoAzon", require_reference.referenceValue(resolved, "externalId"))
|
|
146
26
|
]
|
|
147
27
|
});
|
|
148
28
|
}
|
|
@@ -355,7 +235,7 @@ function parseInvoiceDetailsXml(root, response) {
|
|
|
355
235
|
labels: readLabels(require_serialize.findChild(root, "cimkek")),
|
|
356
236
|
totals: readTotals(root, reader),
|
|
357
237
|
payments: require_serialize.findChildren(require_serialize.findChild(root, "kifizetesek"), "kifizetes").map((payment) => readPayment(payment, reader)),
|
|
358
|
-
pdf: decodeResponsePdf(root, response)
|
|
238
|
+
pdf: require_reference.decodeResponsePdf(root, response)
|
|
359
239
|
};
|
|
360
240
|
}
|
|
361
241
|
function parseGetInvoiceResponse(response) {
|
|
@@ -377,69 +257,15 @@ async function getInvoice(ctx, reference, query = {}, options = {}) {
|
|
|
377
257
|
}, parseGetInvoiceResponse);
|
|
378
258
|
}
|
|
379
259
|
//#endregion
|
|
380
|
-
Object.defineProperty(exports, "AGENT_XSD_BASE_URL", {
|
|
381
|
-
enumerable: true,
|
|
382
|
-
get: function() {
|
|
383
|
-
return AGENT_XSD_BASE_URL;
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
Object.defineProperty(exports, "agentDate", {
|
|
387
|
-
enumerable: true,
|
|
388
|
-
get: function() {
|
|
389
|
-
return agentDate;
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
260
|
Object.defineProperty(exports, "getInvoice", {
|
|
393
261
|
enumerable: true,
|
|
394
262
|
get: function() {
|
|
395
263
|
return getInvoice;
|
|
396
264
|
}
|
|
397
265
|
});
|
|
398
|
-
Object.defineProperty(exports, "optionalAgentDate", {
|
|
399
|
-
enumerable: true,
|
|
400
|
-
get: function() {
|
|
401
|
-
return optionalAgentDate;
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
Object.defineProperty(exports, "optionalText", {
|
|
405
|
-
enumerable: true,
|
|
406
|
-
get: function() {
|
|
407
|
-
return optionalText;
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
266
|
Object.defineProperty(exports, "parseInvoiceDetailsXml", {
|
|
411
267
|
enumerable: true,
|
|
412
268
|
get: function() {
|
|
413
269
|
return parseInvoiceDetailsXml;
|
|
414
270
|
}
|
|
415
271
|
});
|
|
416
|
-
Object.defineProperty(exports, "parseInvoiceResult", {
|
|
417
|
-
enumerable: true,
|
|
418
|
-
get: function() {
|
|
419
|
-
return parseInvoiceResult;
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
Object.defineProperty(exports, "referenceValue", {
|
|
423
|
-
enumerable: true,
|
|
424
|
-
get: function() {
|
|
425
|
-
return referenceValue;
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
Object.defineProperty(exports, "requireText", {
|
|
429
|
-
enumerable: true,
|
|
430
|
-
get: function() {
|
|
431
|
-
return requireText;
|
|
432
|
-
}
|
|
433
|
-
});
|
|
434
|
-
Object.defineProperty(exports, "resolveInvoiceReference", {
|
|
435
|
-
enumerable: true,
|
|
436
|
-
get: function() {
|
|
437
|
-
return resolveInvoiceReference;
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
Object.defineProperty(exports, "validationError", {
|
|
441
|
-
enumerable: true,
|
|
442
|
-
get: function() {
|
|
443
|
-
return validationError;
|
|
444
|
-
}
|
|
445
|
-
});
|
|
@@ -1,126 +1,6 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as looksLikeXml, c as readDocumentHeaders, d as throwIfHeaderError, f as throwIfHttpError, h as unexpectedResponse, l as readHeader$1, m as throwIfXmlFailure, o as parseDoneText, p as throwIfTextError, s as parseResponseXml } from "./parse-C608ehqM.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$1(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
|
|
1
|
+
import { a as optionalEl, c as childNumber, d as findChildren, l as childText, n as buildXmlDocument, s as childBoolean, u as findChild } from "./serialize-B2eFh3D-.js";
|
|
2
|
+
import { d as throwIfHeaderError, f as throwIfHttpError, h as unexpectedResponse, m as throwIfXmlFailure, p as throwIfTextError, s as parseResponseXml } from "./parse-Cr7yQ3_z.js";
|
|
3
|
+
import { l as resolveInvoiceReference, r as decodeResponsePdf, s as referenceValue, t as AGENT_XSD_BASE_URL } from "./reference-B5TATqb5.js";
|
|
124
4
|
//#region src/invoices/get.ts
|
|
125
5
|
const INVOICE_DOCUMENT_TYPE_CODES = {
|
|
126
6
|
invoice: "SZ",
|
|
@@ -377,4 +257,4 @@ async function getInvoice(ctx, reference, query = {}, options = {}) {
|
|
|
377
257
|
}, parseGetInvoiceResponse);
|
|
378
258
|
}
|
|
379
259
|
//#endregion
|
|
380
|
-
export {
|
|
260
|
+
export { parseInvoiceDetailsXml as n, getInvoice as t };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { n as KeyValueStore, r as StoreCapabilities } from "./store-C1rHd9DB.cjs";
|
|
2
|
+
import { t as CookieStore } from "./session-YbChChx7.cjs";
|
|
3
|
+
//#region src/cookie-stores/resilient.d.ts
|
|
4
|
+
type CookieStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
|
|
5
|
+
interface CookieStoreErrorEvent {
|
|
6
|
+
readonly operation: CookieStoreOperation;
|
|
7
|
+
readonly key: string;
|
|
8
|
+
readonly error: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface ResilientCookieStoreOptions {
|
|
11
|
+
readonly onError?: ((event: CookieStoreErrorEvent) => void) | undefined;
|
|
12
|
+
readonly timeoutMs?: number | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare function resilientCookieStore(store: CookieStore, options?: ResilientCookieStoreOptions): CookieStore;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/cookie-stores/shared.d.ts
|
|
17
|
+
interface CookieStoreAdapterOptions extends ResilientCookieStoreOptions {
|
|
18
|
+
readonly prefix?: string | undefined;
|
|
19
|
+
readonly resilient?: boolean | undefined;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/cookie-stores/cloudflare-kv.d.ts
|
|
23
|
+
declare const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
|
|
24
|
+
interface CloudflareKvNamespaceLike {
|
|
25
|
+
get(key: string): Promise<string | null>;
|
|
26
|
+
put(key: string, value: string, options: {
|
|
27
|
+
expirationTtl: number;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
delete(key: string): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
declare function cloudflareKvCookieStore(namespace: CloudflareKvNamespaceLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/cookie-stores/custom.d.ts
|
|
34
|
+
declare function customCookieStore(store: CookieStore, options?: CookieStoreAdapterOptions): CookieStore;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/cookie-stores/ioredis.d.ts
|
|
37
|
+
interface IoRedisLike {
|
|
38
|
+
get(key: string): Promise<unknown>;
|
|
39
|
+
set(key: string, value: string, expiryMode: "EX", seconds: number): Promise<unknown>;
|
|
40
|
+
del(key: string): Promise<unknown>;
|
|
41
|
+
eval?(script: string, numKeys: number, ...args: string[]): Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
declare function ioredisCookieStore(redis: IoRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/cookie-stores/node-redis.d.ts
|
|
46
|
+
interface NodeRedisLike {
|
|
47
|
+
get(key: string): Promise<unknown>;
|
|
48
|
+
set(key: string, value: string, options: {
|
|
49
|
+
EX: number;
|
|
50
|
+
}): Promise<unknown>;
|
|
51
|
+
del(key: string): Promise<unknown>;
|
|
52
|
+
eval?(script: string, options: {
|
|
53
|
+
keys: string[];
|
|
54
|
+
arguments: string[];
|
|
55
|
+
}): Promise<unknown>;
|
|
56
|
+
}
|
|
57
|
+
declare function nodeRedisCookieStore(client: NodeRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/cookie-stores/upstash.d.ts
|
|
60
|
+
interface UpstashRedisLike {
|
|
61
|
+
get(key: string): Promise<unknown>;
|
|
62
|
+
set(key: string, value: string, options: {
|
|
63
|
+
ex: number;
|
|
64
|
+
}): Promise<unknown>;
|
|
65
|
+
del(key: string): Promise<unknown>;
|
|
66
|
+
eval?(script: string, keys: string[], args: string[]): Promise<unknown>;
|
|
67
|
+
}
|
|
68
|
+
declare function upstashRedisCookieStore(redis: UpstashRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/stores/diagnose.d.ts
|
|
71
|
+
interface StoreSuitability {
|
|
72
|
+
readonly session: boolean;
|
|
73
|
+
readonly attemptLedger: boolean;
|
|
74
|
+
readonly createOnceLock: boolean;
|
|
75
|
+
readonly journal: boolean;
|
|
76
|
+
readonly webhookDedupe: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface StoreDiagnosis {
|
|
79
|
+
readonly ok: boolean;
|
|
80
|
+
readonly capabilities: StoreCapabilities;
|
|
81
|
+
readonly suitableFor: StoreSuitability;
|
|
82
|
+
readonly latencyMs: number;
|
|
83
|
+
readonly problems: readonly string[];
|
|
84
|
+
}
|
|
85
|
+
interface DiagnoseStoreOptions {
|
|
86
|
+
readonly keyPrefix?: string | undefined;
|
|
87
|
+
readonly now?: (() => number) | undefined;
|
|
88
|
+
}
|
|
89
|
+
declare function diagnoseStore(store: KeyValueStore, options?: DiagnoseStoreOptions): Promise<StoreDiagnosis>;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/stores/durable-object.d.ts
|
|
92
|
+
interface DurableObjectStorageLike {
|
|
93
|
+
get(key: string): Promise<unknown>;
|
|
94
|
+
put(key: string, value: DurableObjectStoreEntry): Promise<void>;
|
|
95
|
+
delete(key: string): Promise<boolean>;
|
|
96
|
+
}
|
|
97
|
+
interface DurableObjectStubLike {
|
|
98
|
+
fetch(input: string, init: RequestInit): Promise<Response>;
|
|
99
|
+
}
|
|
100
|
+
interface DurableObjectStoreEntry {
|
|
101
|
+
readonly value: string;
|
|
102
|
+
readonly expiresAt: number;
|
|
103
|
+
}
|
|
104
|
+
type DurableObjectStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
|
|
105
|
+
declare const DURABLE_OBJECT_STORE_URL = "https://kassza-store.internal/";
|
|
106
|
+
declare function handleDurableObjectStoreRequest(storage: DurableObjectStorageLike, request: Request): Promise<Response>;
|
|
107
|
+
declare function durableObjectStore(stub: DurableObjectStubLike): KeyValueStore;
|
|
108
|
+
//#endregion
|
|
109
|
+
export { CookieStoreErrorEvent as C, resilientCookieStore as E, CookieStoreAdapterOptions as S, ResilientCookieStoreOptions as T, ioredisCookieStore as _, DurableObjectStubLike as a, CloudflareKvNamespaceLike as b, DiagnoseStoreOptions as c, diagnoseStore as d, UpstashRedisLike as f, IoRedisLike as g, nodeRedisCookieStore as h, DurableObjectStoreOperation as i, StoreDiagnosis as l, NodeRedisLike as m, DurableObjectStorageLike as n, durableObjectStore as o, upstashRedisCookieStore as p, DurableObjectStoreEntry as r, handleDurableObjectStoreRequest as s, DURABLE_OBJECT_STORE_URL as t, StoreSuitability as u, customCookieStore as v, CookieStoreOperation as w, cloudflareKvCookieStore as x, CLOUDFLARE_KV_MIN_TTL_SECONDS as y };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { n as KeyValueStore, r as StoreCapabilities } from "./store-C1rHd9DB.js";
|
|
2
|
+
import { t as CookieStore } from "./session-Ckl5eJhV.js";
|
|
3
|
+
//#region src/cookie-stores/resilient.d.ts
|
|
4
|
+
type CookieStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
|
|
5
|
+
interface CookieStoreErrorEvent {
|
|
6
|
+
readonly operation: CookieStoreOperation;
|
|
7
|
+
readonly key: string;
|
|
8
|
+
readonly error: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface ResilientCookieStoreOptions {
|
|
11
|
+
readonly onError?: ((event: CookieStoreErrorEvent) => void) | undefined;
|
|
12
|
+
readonly timeoutMs?: number | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare function resilientCookieStore(store: CookieStore, options?: ResilientCookieStoreOptions): CookieStore;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/cookie-stores/shared.d.ts
|
|
17
|
+
interface CookieStoreAdapterOptions extends ResilientCookieStoreOptions {
|
|
18
|
+
readonly prefix?: string | undefined;
|
|
19
|
+
readonly resilient?: boolean | undefined;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/cookie-stores/cloudflare-kv.d.ts
|
|
23
|
+
declare const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
|
|
24
|
+
interface CloudflareKvNamespaceLike {
|
|
25
|
+
get(key: string): Promise<string | null>;
|
|
26
|
+
put(key: string, value: string, options: {
|
|
27
|
+
expirationTtl: number;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
delete(key: string): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
declare function cloudflareKvCookieStore(namespace: CloudflareKvNamespaceLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/cookie-stores/custom.d.ts
|
|
34
|
+
declare function customCookieStore(store: CookieStore, options?: CookieStoreAdapterOptions): CookieStore;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/cookie-stores/ioredis.d.ts
|
|
37
|
+
interface IoRedisLike {
|
|
38
|
+
get(key: string): Promise<unknown>;
|
|
39
|
+
set(key: string, value: string, expiryMode: "EX", seconds: number): Promise<unknown>;
|
|
40
|
+
del(key: string): Promise<unknown>;
|
|
41
|
+
eval?(script: string, numKeys: number, ...args: string[]): Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
declare function ioredisCookieStore(redis: IoRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/cookie-stores/node-redis.d.ts
|
|
46
|
+
interface NodeRedisLike {
|
|
47
|
+
get(key: string): Promise<unknown>;
|
|
48
|
+
set(key: string, value: string, options: {
|
|
49
|
+
EX: number;
|
|
50
|
+
}): Promise<unknown>;
|
|
51
|
+
del(key: string): Promise<unknown>;
|
|
52
|
+
eval?(script: string, options: {
|
|
53
|
+
keys: string[];
|
|
54
|
+
arguments: string[];
|
|
55
|
+
}): Promise<unknown>;
|
|
56
|
+
}
|
|
57
|
+
declare function nodeRedisCookieStore(client: NodeRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/cookie-stores/upstash.d.ts
|
|
60
|
+
interface UpstashRedisLike {
|
|
61
|
+
get(key: string): Promise<unknown>;
|
|
62
|
+
set(key: string, value: string, options: {
|
|
63
|
+
ex: number;
|
|
64
|
+
}): Promise<unknown>;
|
|
65
|
+
del(key: string): Promise<unknown>;
|
|
66
|
+
eval?(script: string, keys: string[], args: string[]): Promise<unknown>;
|
|
67
|
+
}
|
|
68
|
+
declare function upstashRedisCookieStore(redis: UpstashRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/stores/diagnose.d.ts
|
|
71
|
+
interface StoreSuitability {
|
|
72
|
+
readonly session: boolean;
|
|
73
|
+
readonly attemptLedger: boolean;
|
|
74
|
+
readonly createOnceLock: boolean;
|
|
75
|
+
readonly journal: boolean;
|
|
76
|
+
readonly webhookDedupe: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface StoreDiagnosis {
|
|
79
|
+
readonly ok: boolean;
|
|
80
|
+
readonly capabilities: StoreCapabilities;
|
|
81
|
+
readonly suitableFor: StoreSuitability;
|
|
82
|
+
readonly latencyMs: number;
|
|
83
|
+
readonly problems: readonly string[];
|
|
84
|
+
}
|
|
85
|
+
interface DiagnoseStoreOptions {
|
|
86
|
+
readonly keyPrefix?: string | undefined;
|
|
87
|
+
readonly now?: (() => number) | undefined;
|
|
88
|
+
}
|
|
89
|
+
declare function diagnoseStore(store: KeyValueStore, options?: DiagnoseStoreOptions): Promise<StoreDiagnosis>;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/stores/durable-object.d.ts
|
|
92
|
+
interface DurableObjectStorageLike {
|
|
93
|
+
get(key: string): Promise<unknown>;
|
|
94
|
+
put(key: string, value: DurableObjectStoreEntry): Promise<void>;
|
|
95
|
+
delete(key: string): Promise<boolean>;
|
|
96
|
+
}
|
|
97
|
+
interface DurableObjectStubLike {
|
|
98
|
+
fetch(input: string, init: RequestInit): Promise<Response>;
|
|
99
|
+
}
|
|
100
|
+
interface DurableObjectStoreEntry {
|
|
101
|
+
readonly value: string;
|
|
102
|
+
readonly expiresAt: number;
|
|
103
|
+
}
|
|
104
|
+
type DurableObjectStoreOperation = "get" | "set" | "delete" | "setIfAbsent" | "increment" | "deleteIfEquals";
|
|
105
|
+
declare const DURABLE_OBJECT_STORE_URL = "https://kassza-store.internal/";
|
|
106
|
+
declare function handleDurableObjectStoreRequest(storage: DurableObjectStorageLike, request: Request): Promise<Response>;
|
|
107
|
+
declare function durableObjectStore(stub: DurableObjectStubLike): KeyValueStore;
|
|
108
|
+
//#endregion
|
|
109
|
+
export { CookieStoreErrorEvent as C, resilientCookieStore as E, CookieStoreAdapterOptions as S, ResilientCookieStoreOptions as T, ioredisCookieStore as _, DurableObjectStubLike as a, CloudflareKvNamespaceLike as b, DiagnoseStoreOptions as c, diagnoseStore as d, UpstashRedisLike as f, IoRedisLike as g, nodeRedisCookieStore as h, DurableObjectStoreOperation as i, StoreDiagnosis as l, NodeRedisLike as m, DurableObjectStorageLike as n, durableObjectStore as o, upstashRedisCookieStore as p, DurableObjectStoreEntry as r, handleDurableObjectStoreRequest as s, DURABLE_OBJECT_STORE_URL as t, StoreSuitability as u, customCookieStore as v, CookieStoreOperation as w, cloudflareKvCookieStore as x, CLOUDFLARE_KV_MIN_TTL_SECONDS as y };
|
|
@@ -48,9 +48,32 @@ interface DocumentTotals {
|
|
|
48
48
|
}
|
|
49
49
|
declare function summarizeItems(items: readonly ItemAmounts[]): DocumentTotals;
|
|
50
50
|
//#endregion
|
|
51
|
+
//#region src/money/refund.d.ts
|
|
52
|
+
type RefundVat = string | number;
|
|
53
|
+
interface RefundableItem<V extends RefundVat = VatRate> {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly vat: V;
|
|
56
|
+
readonly grossAmount: number;
|
|
57
|
+
readonly unit?: string | undefined;
|
|
58
|
+
readonly identifier?: string | undefined;
|
|
59
|
+
}
|
|
60
|
+
interface RefundAllocation<V extends RefundVat = VatRate> {
|
|
61
|
+
readonly index: number;
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly vat: V;
|
|
64
|
+
readonly grossAmount: number;
|
|
65
|
+
readonly unit?: string | undefined;
|
|
66
|
+
readonly identifier?: string | undefined;
|
|
67
|
+
}
|
|
68
|
+
interface AllocateRefundOptions {
|
|
69
|
+
readonly decimals?: number | undefined;
|
|
70
|
+
readonly refundedBefore?: number | undefined;
|
|
71
|
+
}
|
|
72
|
+
declare function allocateRefund<V extends RefundVat = VatRate>(items: readonly RefundableItem<V>[], refundGross: number, options?: AllocateRefundOptions): RefundAllocation<V>[];
|
|
73
|
+
//#endregion
|
|
51
74
|
//#region src/money/rounding.d.ts
|
|
52
75
|
declare function roundMoney(value: number, decimals?: number): number;
|
|
53
76
|
declare function decimalPlaces(value: number): number;
|
|
54
77
|
declare function addMoney(...values: number[]): number;
|
|
55
78
|
//#endregion
|
|
56
|
-
export { VatRate as _,
|
|
79
|
+
export { formatVatRate as C, vatPercentage as E, VatRate as S, isVatRate as T, summarizeItems as _, RefundAllocation as a, SPECIAL_VAT_CODES as b, allocateRefund as c, ItemAmounts as d, ItemPriceInput as f, calculateReceiptItem as g, calculateItemAmounts as h, AllocateRefundOptions as i, DocumentKind as l, calculateInvoiceItem as m, decimalPlaces as n, RefundVat as o, VatBreakdown as p, roundMoney as r, RefundableItem as s, addMoney as t, DocumentTotals as u, NUMERIC_VAT_RATES as v, isHuf as w, SpecialVatCode as x, NumericVatRate as y };
|
|
@@ -48,9 +48,32 @@ interface DocumentTotals {
|
|
|
48
48
|
}
|
|
49
49
|
declare function summarizeItems(items: readonly ItemAmounts[]): DocumentTotals;
|
|
50
50
|
//#endregion
|
|
51
|
+
//#region src/money/refund.d.ts
|
|
52
|
+
type RefundVat = string | number;
|
|
53
|
+
interface RefundableItem<V extends RefundVat = VatRate> {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly vat: V;
|
|
56
|
+
readonly grossAmount: number;
|
|
57
|
+
readonly unit?: string | undefined;
|
|
58
|
+
readonly identifier?: string | undefined;
|
|
59
|
+
}
|
|
60
|
+
interface RefundAllocation<V extends RefundVat = VatRate> {
|
|
61
|
+
readonly index: number;
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly vat: V;
|
|
64
|
+
readonly grossAmount: number;
|
|
65
|
+
readonly unit?: string | undefined;
|
|
66
|
+
readonly identifier?: string | undefined;
|
|
67
|
+
}
|
|
68
|
+
interface AllocateRefundOptions {
|
|
69
|
+
readonly decimals?: number | undefined;
|
|
70
|
+
readonly refundedBefore?: number | undefined;
|
|
71
|
+
}
|
|
72
|
+
declare function allocateRefund<V extends RefundVat = VatRate>(items: readonly RefundableItem<V>[], refundGross: number, options?: AllocateRefundOptions): RefundAllocation<V>[];
|
|
73
|
+
//#endregion
|
|
51
74
|
//#region src/money/rounding.d.ts
|
|
52
75
|
declare function roundMoney(value: number, decimals?: number): number;
|
|
53
76
|
declare function decimalPlaces(value: number): number;
|
|
54
77
|
declare function addMoney(...values: number[]): number;
|
|
55
78
|
//#endregion
|
|
56
|
-
export { VatRate as _,
|
|
79
|
+
export { formatVatRate as C, vatPercentage as E, VatRate as S, isVatRate as T, summarizeItems as _, RefundAllocation as a, SPECIAL_VAT_CODES as b, allocateRefund as c, ItemAmounts as d, ItemPriceInput as f, calculateReceiptItem as g, calculateItemAmounts as h, AllocateRefundOptions as i, DocumentKind as l, calculateInvoiceItem as m, decimalPlaces as n, RefundVat as o, VatBreakdown as p, roundMoney as r, RefundableItem as s, addMoney as t, DocumentTotals as u, NUMERIC_VAT_RATES as v, isHuf as w, SpecialVatCode as x, NumericVatRate as y };
|