kassza 0.12.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 +427 -32
- package/agents/README.md +26 -6
- package/agents/api.md +218 -3
- package/agents/pitfalls.md +27 -3
- package/agents/recipes.md +280 -51
- package/agents/skills/kassza/SKILL.md +14 -8
- 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 +643 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +643 -0
- package/dist/client-CLFvJCVW.cjs +1452 -0
- package/dist/{client-CL3fuH6A.js → client-Cvf-hTz_.js} +306 -515
- package/dist/client-DeWWQ-RZ.d.ts +341 -0
- package/dist/client-SVZu25MB.d.cts +341 -0
- package/dist/context-CFNKzStE.d.cts +449 -0
- package/dist/context-kb33TgzE.d.ts +449 -0
- 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-D0pwuenl.cjs → create-once-9yxR_Er_.cjs} +291 -33
- package/dist/create-once-Bh6fOWkW.d.cts +20 -0
- package/dist/{create-once-CqdYmQD8.js → create-once-Ca2gMk1h.js} +250 -34
- package/dist/create-once-VKp0tVow.d.ts +20 -0
- package/dist/{crypto-B8lERvR1.cjs → crypto-Dpn4FHQ6.cjs} +9 -0
- package/dist/{crypto-DK_osBVy.js → crypto-usDg8L2K.js} +4 -1
- package/dist/data-link/index.cjs +232 -0
- package/dist/data-link/index.d.cts +29 -0
- package/dist/data-link/index.d.ts +29 -0
- package/dist/data-link/index.js +224 -0
- package/dist/delegation/index.cjs +35 -34
- package/dist/delegation/index.d.cts +2 -1
- package/dist/delegation/index.d.ts +2 -1
- package/dist/delegation/index.js +4 -3
- package/dist/{errors-DLrb0g64.js → errors-DtN4g5Z9.js} +9 -1
- package/dist/{errors-DxeuTslP.cjs → errors-EE96_6D_.cjs} +20 -0
- package/dist/get-BdMTseh4.cjs +271 -0
- package/dist/get-Byc9T5WO.d.cts +151 -0
- package/dist/get-Byc9T5WO.d.ts +151 -0
- package/dist/get-CZEShCcj.js +260 -0
- 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 +11 -19
- package/dist/index.d.ts +11 -19
- 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-Bin4tKD_.cjs +988 -0
- package/dist/issue-DMA1Nbr1.js +905 -0
- 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 +10 -0
- package/dist/mcp/index.d.cts +71 -0
- package/dist/mcp/index.d.ts +71 -0
- package/dist/mcp/index.js +2 -0
- 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-DAA7OwiO.js → money-Cw457SD6.js} +120 -12
- package/dist/{money-DrhGkWHW.cjs → money-K9j0wPit.cjs} +124 -10
- package/dist/nav/index.cjs +1046 -0
- package/dist/nav/index.d.cts +247 -0
- package/dist/nav/index.d.ts +247 -0
- package/dist/nav/index.js +1012 -0
- package/dist/nav-BNbc8U0R.cjs +203 -0
- package/dist/nav-BcCerwWS.js +156 -0
- 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-Cr7yQ3_z.js +291 -0
- package/dist/parse-DOA2XQ3e.cjs +380 -0
- 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 +17 -3
- package/dist/payments/revolut.d.cts +2 -2
- package/dist/payments/revolut.d.ts +2 -2
- package/dist/payments/revolut.js +17 -3
- package/dist/payments/simplepay.cjs +37 -5
- package/dist/payments/simplepay.d.cts +2 -2
- package/dist/payments/simplepay.d.ts +2 -2
- package/dist/payments/simplepay.js +37 -5
- package/dist/payments/stripe.cjs +20 -3
- package/dist/payments/stripe.d.cts +2 -2
- package/dist/payments/stripe.d.ts +2 -2
- package/dist/payments/stripe.js +20 -3
- 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 +11 -164
- package/dist/reports/index.d.cts +1 -1
- package/dist/reports/index.d.ts +1 -1
- package/dist/reports/index.js +1 -154
- package/dist/request-body-CH6ZGOrq.cjs +34 -0
- package/dist/request-body-uZHMRlQr.js +29 -0
- package/dist/serialize-B2eFh3D-.js +219 -0
- package/dist/serialize-CquIsxA-.cjs +290 -0
- package/dist/server-BrJUbXs7.js +1505 -0
- package/dist/server-Dw9j8Mnd.cjs +1558 -0
- 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 +1500 -15
- package/dist/testing/index.d.cts +198 -3
- package/dist/testing/index.d.ts +198 -3
- package/dist/testing/index.js +1498 -15
- package/dist/{types-COf1LAD-.d.ts → types-B1A8mUIE.d.cts} +14 -2
- package/dist/{types-COf1LAD-.d.cts → types-ByAEvGsZ.d.ts} +14 -2
- 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-D4lvtex1.js → webhook-CQVShAfI.js} +47 -26
- package/dist/{webhook-C76bV-4R.cjs → webhook-Ckj-_hPD.cjs} +70 -25
- package/dist/webhook-CmdhGiH5.d.cts +11 -0
- package/dist/webhook-D6lEejob.d.ts +11 -0
- package/llms.txt +6 -5
- package/package.json +134 -4
- package/dist/client-CickRRFr.d.ts +0 -838
- package/dist/client-CsmGIFRS.cjs +0 -1637
- package/dist/client-DvWZoX_E.d.cts +0 -838
- package/dist/issue-BsyYdrIG.cjs +0 -1531
- package/dist/issue-C6Fcjvln.js +0 -1274
- package/dist/session-Dm_45x8K.d.cts +0 -11
- package/dist/session-Dm_45x8K.d.ts +0 -11
- package/dist/webhook-CfaDgcL0.d.cts +0 -6
- package/dist/webhook-q2OzNwd7.d.ts +0 -6
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { t as DateInput } from "./dates-9zvESP0i.cjs";
|
|
2
|
+
import { a as AgentAction, r as WarningHook, t as KasszaWarning } from "./warnings-B3DXnveC.cjs";
|
|
3
|
+
import { n as KeyValueStore } from "./store-C1rHd9DB.cjs";
|
|
4
|
+
import { d as ItemAmounts, f as ItemPriceInput } from "./index-C-7yWV7L.cjs";
|
|
5
|
+
import { r as Receipt } from "./types-lnKkQdot.cjs";
|
|
6
|
+
import { t as CookieStore } from "./session-YbChChx7.cjs";
|
|
7
|
+
//#region src/core/errors.d.ts
|
|
8
|
+
type SzamlazzErrorCategory = "auth" | "account" | "validation" | "duplicate" | "partial_success" | "not_found" | "maintenance" | "rate_limit" | "attempt_limit" | "in_progress" | "store_unavailable" | "network" | "timeout" | "configuration" | "unexpected_response" | "unknown";
|
|
9
|
+
interface AgentErrorCodeInfo {
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly category: SzamlazzErrorCategory;
|
|
12
|
+
readonly hint?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const AGENT_ERROR_CODES: Readonly<Record<number, AgentErrorCodeInfo>>;
|
|
15
|
+
declare const KASSZA_ERROR_DOCS_URL = "https://kasszajs.hu/docs/hibakodok";
|
|
16
|
+
declare function errorCodeDocsUrl(code: number | undefined): string | undefined;
|
|
17
|
+
interface SzamlazzErrorOptions {
|
|
18
|
+
readonly category: SzamlazzErrorCategory;
|
|
19
|
+
readonly code?: number | undefined;
|
|
20
|
+
readonly hint?: string | undefined;
|
|
21
|
+
readonly action?: AgentAction | undefined;
|
|
22
|
+
readonly httpStatus?: number | undefined;
|
|
23
|
+
readonly rawResponse?: string | undefined;
|
|
24
|
+
readonly details?: Readonly<Record<string, string>> | undefined;
|
|
25
|
+
readonly cause?: unknown;
|
|
26
|
+
}
|
|
27
|
+
declare class SzamlazzError extends Error {
|
|
28
|
+
override readonly name: string;
|
|
29
|
+
readonly code: number | undefined;
|
|
30
|
+
readonly category: SzamlazzErrorCategory;
|
|
31
|
+
readonly retryable: boolean;
|
|
32
|
+
readonly hint: string | undefined;
|
|
33
|
+
readonly action: AgentAction | undefined;
|
|
34
|
+
readonly httpStatus: number | undefined;
|
|
35
|
+
readonly rawResponse: string | undefined;
|
|
36
|
+
readonly details: Readonly<Record<string, string>> | undefined;
|
|
37
|
+
constructor(message: string, options: SzamlazzErrorOptions);
|
|
38
|
+
get docsUrl(): string | undefined;
|
|
39
|
+
get isDuplicate(): boolean;
|
|
40
|
+
get isNotFound(): boolean;
|
|
41
|
+
}
|
|
42
|
+
declare function isSzamlazzError(error: unknown): error is SzamlazzError;
|
|
43
|
+
declare function suggestedPrefix(error: unknown): string | undefined;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/core/attempt-ledger.d.ts
|
|
46
|
+
declare const ATTEMPT_LEDGER_TTL_SECONDS = 86400;
|
|
47
|
+
declare const ATTEMPT_LEDGER_KEY_PREFIX = "szamlazz:attempts:";
|
|
48
|
+
interface AttemptLedgerRequest {
|
|
49
|
+
readonly action: AgentAction;
|
|
50
|
+
readonly xml: string;
|
|
51
|
+
readonly attachments?: readonly {
|
|
52
|
+
readonly filename: string;
|
|
53
|
+
readonly size: number;
|
|
54
|
+
}[];
|
|
55
|
+
}
|
|
56
|
+
declare function attemptLedgerKey(request: AttemptLedgerRequest): Promise<string>;
|
|
57
|
+
type AttemptLedgerMode = "fail-open" | "fail-closed";
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/invoices/create-types.d.ts
|
|
60
|
+
type InvoiceType = "invoice" | "proforma" | "advance" | "final" | "corrective" | "deliveryNote";
|
|
61
|
+
declare const INVOICE_LANGUAGES: readonly ["hu", "en", "de", "it", "ro", "sk", "hr", "fr", "es", "cz", "pl", "bg", "nl", "ru", "si"];
|
|
62
|
+
type InvoiceLanguage = (typeof INVOICE_LANGUAGES)[number];
|
|
63
|
+
declare const INVOICE_TEMPLATES: readonly ["SzlaMost", "SzlaAlap", "SzlaNoEnv", "Szla8cm", "SzlaTomb", "SzlaFuvarlevelesAlap"];
|
|
64
|
+
type InvoiceTemplate = (typeof INVOICE_TEMPLATES)[number];
|
|
65
|
+
declare const CURRENCIES: readonly ["HUF", "Ft", "EUR", "CHF", "USD", "AED", "ALL", "AUD", "BAM", "BGN", "BRL", "CAD", "CNY", "CZK", "DKK", "EEK", "GBP", "HKD", "HRK", "IDR", "ILS", "INR", "ISK", "JPY", "KRW", "KWD", "KSH", "KZT", "LTL", "LVL", "MXN", "MYR", "NOK", "NZD", "PHP", "PLN", "RON", "RSD", "RUB", "SEK", "SGD", "THB", "TRY", "TWD", "UAH", "VND", "ZAR"];
|
|
66
|
+
type Currency = (typeof CURRENCIES)[number] | (string & {});
|
|
67
|
+
type TaxpayerType = "nonEuBusiness" | "euBusiness" | "hungarianTaxNumber" | "unknown" | "noTaxNumber";
|
|
68
|
+
type CourierService = "TOF" | "PPP" | "SPRINTER" | "FOXPOST" | "MPL" | "GLS" | "EMPTY" | (string & {});
|
|
69
|
+
interface InvoiceSeller {
|
|
70
|
+
readonly bank?: string | undefined;
|
|
71
|
+
readonly bankAccount?: string | undefined;
|
|
72
|
+
readonly emailReplyTo?: string | undefined;
|
|
73
|
+
readonly emailSubject?: string | undefined;
|
|
74
|
+
readonly emailText?: string | undefined;
|
|
75
|
+
readonly signatoryName?: string | undefined;
|
|
76
|
+
}
|
|
77
|
+
interface InvoicePostalAddress {
|
|
78
|
+
readonly name?: string | undefined;
|
|
79
|
+
readonly country?: string | undefined;
|
|
80
|
+
readonly zip?: string | undefined;
|
|
81
|
+
readonly city?: string | undefined;
|
|
82
|
+
readonly address?: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
interface BuyerLedger {
|
|
85
|
+
readonly bookingDate?: DateInput | undefined;
|
|
86
|
+
readonly buyerId?: string | undefined;
|
|
87
|
+
readonly ledgerAccount?: string | undefined;
|
|
88
|
+
readonly continuousFulfillment?: boolean | undefined;
|
|
89
|
+
readonly settlementPeriodStart?: DateInput | undefined;
|
|
90
|
+
readonly settlementPeriodEnd?: DateInput | undefined;
|
|
91
|
+
}
|
|
92
|
+
interface InvoiceBuyer {
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly country?: string | undefined;
|
|
95
|
+
readonly zip: string;
|
|
96
|
+
readonly city: string;
|
|
97
|
+
readonly address: string;
|
|
98
|
+
readonly email?: string | undefined;
|
|
99
|
+
readonly sendEmail?: boolean | undefined;
|
|
100
|
+
readonly taxpayerType?: TaxpayerType | undefined;
|
|
101
|
+
readonly taxNumber?: string | undefined;
|
|
102
|
+
readonly groupTaxNumber?: string | undefined;
|
|
103
|
+
readonly euTaxNumber?: string | undefined;
|
|
104
|
+
readonly postal?: InvoicePostalAddress | undefined;
|
|
105
|
+
readonly ledger?: BuyerLedger | undefined;
|
|
106
|
+
readonly identifier?: string | undefined;
|
|
107
|
+
readonly signatoryName?: string | undefined;
|
|
108
|
+
readonly phone?: string | undefined;
|
|
109
|
+
readonly comment?: string | undefined;
|
|
110
|
+
}
|
|
111
|
+
interface ItemLedger {
|
|
112
|
+
readonly economicEvent?: string | undefined;
|
|
113
|
+
readonly vatEconomicEvent?: string | undefined;
|
|
114
|
+
readonly revenueLedgerAccount?: string | undefined;
|
|
115
|
+
readonly vatLedgerAccount?: string | undefined;
|
|
116
|
+
readonly settlementPeriodStart?: DateInput | undefined;
|
|
117
|
+
readonly settlementPeriodEnd?: DateInput | undefined;
|
|
118
|
+
}
|
|
119
|
+
type InvoiceItemInput = ItemPriceInput & {
|
|
120
|
+
readonly name: string;
|
|
121
|
+
readonly identifier?: string | undefined;
|
|
122
|
+
readonly unit?: string | undefined;
|
|
123
|
+
readonly comment?: string | undefined;
|
|
124
|
+
readonly ledger?: ItemLedger | undefined;
|
|
125
|
+
readonly dataDeletionCode?: number | undefined;
|
|
126
|
+
readonly marginVatBase?: number | undefined;
|
|
127
|
+
};
|
|
128
|
+
interface TransOFlexWaybill {
|
|
129
|
+
readonly id?: string | undefined;
|
|
130
|
+
readonly shipmentId?: string | undefined;
|
|
131
|
+
readonly packageCount?: number | undefined;
|
|
132
|
+
readonly countryCode?: string | undefined;
|
|
133
|
+
readonly zip?: string | undefined;
|
|
134
|
+
readonly service?: string | undefined;
|
|
135
|
+
}
|
|
136
|
+
interface PickPackPointWaybill {
|
|
137
|
+
readonly barcodePrefix?: string | undefined;
|
|
138
|
+
readonly barcodePostfix?: string | undefined;
|
|
139
|
+
}
|
|
140
|
+
interface SprinterWaybill {
|
|
141
|
+
readonly id?: string | undefined;
|
|
142
|
+
readonly senderCode?: string | undefined;
|
|
143
|
+
readonly directionCode?: string | undefined;
|
|
144
|
+
readonly packageCount?: number | undefined;
|
|
145
|
+
readonly barcodePostfix?: string | undefined;
|
|
146
|
+
readonly deliveryTime?: string | undefined;
|
|
147
|
+
}
|
|
148
|
+
interface MplWaybill {
|
|
149
|
+
readonly customerCode: string;
|
|
150
|
+
readonly barcode: string;
|
|
151
|
+
readonly weight: string | number;
|
|
152
|
+
readonly services?: string | undefined;
|
|
153
|
+
readonly declaredValue?: number | undefined;
|
|
154
|
+
}
|
|
155
|
+
interface Waybill {
|
|
156
|
+
readonly courier?: CourierService | undefined;
|
|
157
|
+
readonly barcode?: string | undefined;
|
|
158
|
+
readonly comment?: string | undefined;
|
|
159
|
+
readonly transOFlex?: TransOFlexWaybill | undefined;
|
|
160
|
+
readonly pickPackPoint?: PickPackPointWaybill | undefined;
|
|
161
|
+
readonly sprinter?: SprinterWaybill | undefined;
|
|
162
|
+
readonly mpl?: MplWaybill | undefined;
|
|
163
|
+
}
|
|
164
|
+
interface InvoiceDefaults {
|
|
165
|
+
readonly seller?: InvoiceSeller | undefined;
|
|
166
|
+
readonly prefix?: string | undefined;
|
|
167
|
+
readonly language?: InvoiceLanguage | undefined;
|
|
168
|
+
readonly currency?: Currency | undefined;
|
|
169
|
+
readonly exchangeBank?: string | undefined;
|
|
170
|
+
readonly paymentMethod?: string | undefined;
|
|
171
|
+
readonly paymentDueInDays?: number | undefined;
|
|
172
|
+
readonly eInvoice?: boolean | undefined;
|
|
173
|
+
readonly downloadPdf?: boolean | undefined;
|
|
174
|
+
readonly template?: InvoiceTemplate | undefined;
|
|
175
|
+
readonly sendEmail?: boolean | undefined;
|
|
176
|
+
readonly logoExtra?: string | undefined;
|
|
177
|
+
readonly simpleItems?: boolean | undefined;
|
|
178
|
+
readonly euVat?: boolean | undefined;
|
|
179
|
+
readonly aggregator?: string | undefined;
|
|
180
|
+
readonly guardian?: boolean | undefined;
|
|
181
|
+
readonly articleIdentifierInvoice?: boolean | undefined;
|
|
182
|
+
}
|
|
183
|
+
interface CreateInvoiceBase {
|
|
184
|
+
readonly buyer: InvoiceBuyer;
|
|
185
|
+
readonly items: readonly InvoiceItemInput[];
|
|
186
|
+
readonly seller?: InvoiceSeller | undefined;
|
|
187
|
+
readonly issueDate?: DateInput | undefined;
|
|
188
|
+
readonly fulfillmentDate?: DateInput | undefined;
|
|
189
|
+
readonly dueDate?: DateInput | undefined;
|
|
190
|
+
readonly paymentDueInDays?: number | undefined;
|
|
191
|
+
readonly paymentMethod?: string | undefined;
|
|
192
|
+
readonly currency?: Currency | undefined;
|
|
193
|
+
readonly exchangeRate?: number | undefined;
|
|
194
|
+
readonly exchangeBank?: string | undefined;
|
|
195
|
+
readonly language?: InvoiceLanguage | undefined;
|
|
196
|
+
readonly comment?: string | undefined;
|
|
197
|
+
readonly orderNumber?: string | undefined;
|
|
198
|
+
readonly proformaNumber?: string | undefined;
|
|
199
|
+
readonly prefix?: string | undefined;
|
|
200
|
+
readonly paid?: boolean | undefined;
|
|
201
|
+
readonly eInvoice?: boolean | undefined;
|
|
202
|
+
readonly downloadPdf?: boolean | undefined;
|
|
203
|
+
readonly externalId?: string | undefined;
|
|
204
|
+
readonly template?: InvoiceTemplate | undefined;
|
|
205
|
+
readonly simpleItems?: boolean | undefined;
|
|
206
|
+
readonly logoExtra?: string | undefined;
|
|
207
|
+
readonly paymentCorrection?: number | undefined;
|
|
208
|
+
readonly marginVat?: boolean | undefined;
|
|
209
|
+
readonly euVat?: boolean | undefined;
|
|
210
|
+
readonly aggregator?: string | undefined;
|
|
211
|
+
readonly guardian?: boolean | undefined;
|
|
212
|
+
readonly articleIdentifierInvoice?: boolean | undefined;
|
|
213
|
+
readonly waybill?: Waybill | undefined;
|
|
214
|
+
readonly attachments?: readonly AgentAttachment[] | undefined;
|
|
215
|
+
}
|
|
216
|
+
interface StandardInvoiceInput extends CreateInvoiceBase {
|
|
217
|
+
readonly type?: "invoice" | "proforma" | "advance" | "deliveryNote" | undefined;
|
|
218
|
+
}
|
|
219
|
+
interface FinalInvoiceInput extends CreateInvoiceBase {
|
|
220
|
+
readonly type: "final";
|
|
221
|
+
readonly advanceInvoiceNumber?: string | undefined;
|
|
222
|
+
}
|
|
223
|
+
interface CorrectiveInvoiceInput extends CreateInvoiceBase {
|
|
224
|
+
readonly type: "corrective";
|
|
225
|
+
readonly correctedInvoiceNumber: string;
|
|
226
|
+
}
|
|
227
|
+
type CreateInvoiceInput = StandardInvoiceInput | FinalInvoiceInput | CorrectiveInvoiceInput;
|
|
228
|
+
type CreatedInvoiceItem = ItemAmounts & {
|
|
229
|
+
readonly name: string;
|
|
230
|
+
};
|
|
231
|
+
interface CreatedInvoice {
|
|
232
|
+
readonly number: string;
|
|
233
|
+
readonly netTotal: number;
|
|
234
|
+
readonly grossTotal: number;
|
|
235
|
+
readonly outstanding?: number | undefined;
|
|
236
|
+
readonly buyerAccountUrl?: string | undefined;
|
|
237
|
+
readonly pdf?: Uint8Array | undefined;
|
|
238
|
+
readonly items: readonly CreatedInvoiceItem[];
|
|
239
|
+
}
|
|
240
|
+
interface InvoicePreview {
|
|
241
|
+
readonly pdf: Uint8Array;
|
|
242
|
+
readonly netTotal: number;
|
|
243
|
+
readonly grossTotal: number;
|
|
244
|
+
readonly items: readonly CreatedInvoiceItem[];
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/core/response.d.ts
|
|
248
|
+
interface AgentResponse {
|
|
249
|
+
readonly action: AgentAction;
|
|
250
|
+
readonly status: number;
|
|
251
|
+
readonly headers: Headers;
|
|
252
|
+
readonly body: Uint8Array;
|
|
253
|
+
readonly isPdf: boolean;
|
|
254
|
+
text(): string;
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/core/xml/serialize.d.ts
|
|
258
|
+
type XmlScalar = string | number | boolean;
|
|
259
|
+
type XmlContent = XmlScalar | null | undefined | readonly XmlChild[];
|
|
260
|
+
type XmlChild = XmlNode | false | null | undefined;
|
|
261
|
+
type XmlAttributes = Readonly<Record<string, string>>;
|
|
262
|
+
interface XmlNode {
|
|
263
|
+
readonly name: string;
|
|
264
|
+
readonly content: XmlContent;
|
|
265
|
+
readonly attributes?: XmlAttributes | undefined;
|
|
266
|
+
}
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/invoices/payment.d.ts
|
|
269
|
+
interface PaymentEntry {
|
|
270
|
+
readonly date?: DateInput | undefined;
|
|
271
|
+
readonly method: string;
|
|
272
|
+
readonly amount: number;
|
|
273
|
+
readonly description?: string | undefined;
|
|
274
|
+
}
|
|
275
|
+
interface PaymentTarget {
|
|
276
|
+
readonly invoiceNumber: string;
|
|
277
|
+
readonly taxNumber?: string | undefined;
|
|
278
|
+
}
|
|
279
|
+
interface RegisterPaymentsInput extends PaymentTarget {
|
|
280
|
+
readonly additive?: boolean | undefined;
|
|
281
|
+
readonly payments: readonly PaymentEntry[];
|
|
282
|
+
}
|
|
283
|
+
interface RegisterSinglePaymentInput extends PaymentTarget {
|
|
284
|
+
readonly additive?: boolean | undefined;
|
|
285
|
+
readonly amount: number;
|
|
286
|
+
readonly method?: string | undefined;
|
|
287
|
+
readonly date?: DateInput | undefined;
|
|
288
|
+
readonly description?: string | undefined;
|
|
289
|
+
}
|
|
290
|
+
type RegisterPaymentInput = RegisterPaymentsInput | RegisterSinglePaymentInput;
|
|
291
|
+
type ClearPaymentsInput = string | PaymentTarget;
|
|
292
|
+
interface RegisteredPayment {
|
|
293
|
+
readonly invoiceNumber: string;
|
|
294
|
+
readonly netTotal?: number | undefined;
|
|
295
|
+
readonly grossTotal?: number | undefined;
|
|
296
|
+
readonly outstanding?: number | undefined;
|
|
297
|
+
readonly buyerAccountUrl?: string | undefined;
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/invoices/reverse.d.ts
|
|
301
|
+
interface ReverseInvoiceEmail {
|
|
302
|
+
readonly replyTo?: string | undefined;
|
|
303
|
+
readonly subject?: string | undefined;
|
|
304
|
+
readonly text?: string | undefined;
|
|
305
|
+
}
|
|
306
|
+
interface ReverseInvoiceBuyer {
|
|
307
|
+
readonly email?: string | undefined;
|
|
308
|
+
readonly taxNumber?: string | undefined;
|
|
309
|
+
readonly euTaxNumber?: string | undefined;
|
|
310
|
+
}
|
|
311
|
+
interface ReverseInvoiceOptions {
|
|
312
|
+
readonly invoiceNumber: string;
|
|
313
|
+
readonly issueDate?: DateInput | undefined;
|
|
314
|
+
readonly fulfillmentDate?: DateInput | undefined;
|
|
315
|
+
readonly comment?: string | undefined;
|
|
316
|
+
readonly template?: InvoiceTemplate | undefined;
|
|
317
|
+
readonly eInvoice?: boolean | undefined;
|
|
318
|
+
readonly downloadPdf?: boolean | undefined;
|
|
319
|
+
readonly externalId?: string | undefined;
|
|
320
|
+
readonly email?: ReverseInvoiceEmail | undefined;
|
|
321
|
+
readonly buyer?: ReverseInvoiceBuyer | undefined;
|
|
322
|
+
}
|
|
323
|
+
type ReverseInvoiceInput = string | ReverseInvoiceOptions;
|
|
324
|
+
interface ReversedInvoice {
|
|
325
|
+
readonly number: string;
|
|
326
|
+
readonly netTotal?: number | undefined;
|
|
327
|
+
readonly grossTotal?: number | undefined;
|
|
328
|
+
readonly outstanding?: number | undefined;
|
|
329
|
+
readonly buyerAccountUrl?: string | undefined;
|
|
330
|
+
readonly pdf?: Uint8Array | undefined;
|
|
331
|
+
}
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/core/document-events.d.ts
|
|
334
|
+
interface InvoiceCreatedEvent {
|
|
335
|
+
readonly kind: "invoice";
|
|
336
|
+
readonly action: "created";
|
|
337
|
+
readonly number: string;
|
|
338
|
+
readonly document: CreatedInvoice;
|
|
339
|
+
readonly input: CreateInvoiceInput;
|
|
340
|
+
}
|
|
341
|
+
interface InvoiceReversedEvent {
|
|
342
|
+
readonly kind: "invoice";
|
|
343
|
+
readonly action: "reversed";
|
|
344
|
+
readonly number: string;
|
|
345
|
+
readonly reversedNumber: string;
|
|
346
|
+
readonly document: ReversedInvoice;
|
|
347
|
+
}
|
|
348
|
+
interface InvoicePaymentEvent {
|
|
349
|
+
readonly kind: "invoice";
|
|
350
|
+
readonly action: "payment";
|
|
351
|
+
readonly number: string;
|
|
352
|
+
readonly document: RegisteredPayment;
|
|
353
|
+
}
|
|
354
|
+
interface ReceiptCreatedEvent {
|
|
355
|
+
readonly kind: "receipt";
|
|
356
|
+
readonly action: "created";
|
|
357
|
+
readonly number: string;
|
|
358
|
+
readonly document: Receipt;
|
|
359
|
+
}
|
|
360
|
+
interface ReceiptReversedEvent {
|
|
361
|
+
readonly kind: "receipt";
|
|
362
|
+
readonly action: "reversed";
|
|
363
|
+
readonly number: string;
|
|
364
|
+
readonly reversedNumber: string;
|
|
365
|
+
readonly document: Receipt;
|
|
366
|
+
}
|
|
367
|
+
type DocumentEvent = InvoiceCreatedEvent | InvoiceReversedEvent | InvoicePaymentEvent | ReceiptCreatedEvent | ReceiptReversedEvent;
|
|
368
|
+
type DocumentHook = (event: DocumentEvent) => void | Promise<void>;
|
|
369
|
+
type DocumentErrorHandler = (error: unknown, event: DocumentEvent) => void | Promise<void>;
|
|
370
|
+
type DocumentErrorMode = "warn" | "throw" | DocumentErrorHandler;
|
|
371
|
+
declare class DocumentHookError extends Error {
|
|
372
|
+
override readonly name: string;
|
|
373
|
+
readonly event: DocumentEvent;
|
|
374
|
+
constructor(event: DocumentEvent, cause: unknown);
|
|
375
|
+
get number(): string;
|
|
376
|
+
get document(): DocumentEvent["document"];
|
|
377
|
+
}
|
|
378
|
+
declare function isDocumentHookError(error: unknown): error is DocumentHookError;
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/core/context.d.ts
|
|
381
|
+
interface AgentAttachment {
|
|
382
|
+
readonly filename: string;
|
|
383
|
+
readonly content: Uint8Array | ArrayBuffer | Blob | string;
|
|
384
|
+
readonly contentType?: string;
|
|
385
|
+
}
|
|
386
|
+
interface AgentRequestEvent {
|
|
387
|
+
readonly action: AgentAction;
|
|
388
|
+
readonly attempt: number;
|
|
389
|
+
readonly requestId: string;
|
|
390
|
+
}
|
|
391
|
+
interface AgentResponseEvent extends AgentRequestEvent {
|
|
392
|
+
readonly status: number;
|
|
393
|
+
readonly durationMs: number;
|
|
394
|
+
readonly responseBytes: number;
|
|
395
|
+
readonly sessionReused: boolean;
|
|
396
|
+
}
|
|
397
|
+
interface AgentErrorEvent extends AgentRequestEvent {
|
|
398
|
+
readonly error: SzamlazzError;
|
|
399
|
+
readonly willRetry: boolean;
|
|
400
|
+
}
|
|
401
|
+
interface AgentCompleteEvent extends AgentRequestEvent {
|
|
402
|
+
readonly outcome: "success" | "error";
|
|
403
|
+
readonly durationMs: number;
|
|
404
|
+
readonly error?: SzamlazzError | undefined;
|
|
405
|
+
readonly willRetry: boolean;
|
|
406
|
+
}
|
|
407
|
+
interface SzamlazzHooks {
|
|
408
|
+
readonly onRequest?: (event: AgentRequestEvent) => void;
|
|
409
|
+
readonly onResponse?: (event: AgentResponseEvent) => void;
|
|
410
|
+
readonly onError?: (event: AgentErrorEvent) => void;
|
|
411
|
+
readonly onComplete?: (event: AgentCompleteEvent) => void;
|
|
412
|
+
readonly onDocument?: DocumentHook;
|
|
413
|
+
readonly onDocumentError?: DocumentErrorMode;
|
|
414
|
+
readonly onWarning?: (warning: KasszaWarning) => void;
|
|
415
|
+
}
|
|
416
|
+
interface SzamlazzOptions {
|
|
417
|
+
readonly agentKey?: string;
|
|
418
|
+
readonly username?: string;
|
|
419
|
+
readonly password?: string;
|
|
420
|
+
readonly endpoint?: string;
|
|
421
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
422
|
+
readonly timeoutMs?: number;
|
|
423
|
+
readonly maxAttempts?: number;
|
|
424
|
+
readonly retryDelayMs?: number;
|
|
425
|
+
readonly cookieStore?: CookieStore | false;
|
|
426
|
+
readonly attemptLedger?: KeyValueStore | undefined;
|
|
427
|
+
readonly attemptLedgerMode?: AttemptLedgerMode | undefined;
|
|
428
|
+
readonly maintenanceCooldownMs?: number | undefined;
|
|
429
|
+
readonly hooks?: SzamlazzHooks;
|
|
430
|
+
}
|
|
431
|
+
interface RequestOptions {
|
|
432
|
+
readonly signal?: AbortSignal | undefined;
|
|
433
|
+
}
|
|
434
|
+
interface AgentRequest {
|
|
435
|
+
readonly action: AgentAction;
|
|
436
|
+
readonly xml: string;
|
|
437
|
+
readonly attachments?: readonly AgentAttachment[];
|
|
438
|
+
readonly signal?: AbortSignal | undefined;
|
|
439
|
+
readonly safeToRetry?: boolean;
|
|
440
|
+
}
|
|
441
|
+
interface AgentContext {
|
|
442
|
+
readonly credentials: readonly XmlNode[];
|
|
443
|
+
readonly warn?: WarningHook | undefined;
|
|
444
|
+
execute<T>(request: AgentRequest, parse: (response: AgentResponse) => T | Promise<T>): Promise<T>;
|
|
445
|
+
resetSession(): Promise<void>;
|
|
446
|
+
resetAttempts(key: string): Promise<void>;
|
|
447
|
+
}
|
|
448
|
+
//#endregion
|
|
449
|
+
export { Waybill as $, CorrectiveInvoiceInput as A, InvoiceLanguage as B, ClearPaymentsInput as C, XmlNode as D, RegisteredPayment as E, Currency as F, InvoiceType as G, InvoicePreview as H, FinalInvoiceInput as I, PickPackPointWaybill as J, ItemLedger as K, InvoiceBuyer as L, CreateInvoiceInput as M, CreatedInvoice as N, AgentResponse as O, CreatedInvoiceItem as P, TransOFlexWaybill as Q, InvoiceDefaults as R, ReversedInvoice as S, RegisterPaymentInput as T, InvoiceSeller as U, InvoicePostalAddress as V, InvoiceTemplate as W, StandardInvoiceInput as X, SprinterWaybill as Y, TaxpayerType as Z, InvoiceReversedEvent as _, AgentRequestEvent as a, AgentErrorCodeInfo as at, isDocumentHookError as b, SzamlazzHooks as c, SzamlazzErrorCategory as ct, DocumentErrorMode as d, suggestedPrefix as dt, ATTEMPT_LEDGER_KEY_PREFIX as et, DocumentEvent as f, InvoicePaymentEvent as g, InvoiceCreatedEvent as h, AgentErrorEvent as i, AGENT_ERROR_CODES as it, CourierService as j, BuyerLedger as k, SzamlazzOptions as l, errorCodeDocsUrl as lt, DocumentHookError as m, AgentCompleteEvent as n, AttemptLedgerMode as nt, AgentResponseEvent as o, KASSZA_ERROR_DOCS_URL as ot, DocumentHook as p, MplWaybill as q, AgentContext as r, attemptLedgerKey as rt, RequestOptions as s, SzamlazzError as st, AgentAttachment as t, ATTEMPT_LEDGER_TTL_SECONDS as tt, DocumentErrorHandler as u, isSzamlazzError as ut, ReceiptCreatedEvent as v, PaymentEntry as w, ReverseInvoiceInput as x, ReceiptReversedEvent as y, InvoiceItemInput as z };
|