kassza 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +283 -18
  2. package/agents/README.md +20 -5
  3. package/agents/api.md +165 -2
  4. package/agents/pitfalls.md +16 -3
  5. package/agents/recipes.md +215 -45
  6. package/agents/skills/kassza/SKILL.md +11 -8
  7. package/dist/cli.cjs +552 -0
  8. package/dist/cli.d.cts +1 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +552 -0
  11. package/dist/client-6MkeuFqD.d.ts +268 -0
  12. package/dist/client-B5FryKxJ.d.cts +268 -0
  13. package/dist/{client-CsmGIFRS.cjs → client-C-PdfL_P.cjs} +235 -597
  14. package/dist/{client-CL3fuH6A.js → client-CfaS1-Jx.js} +35 -403
  15. package/dist/context-BxQlIlug.d.ts +425 -0
  16. package/dist/context-DXNbTPwz.d.cts +425 -0
  17. package/dist/{create-once-CqdYmQD8.js → create-once-Cz621l8r.js} +3 -3
  18. package/dist/{create-once-D0pwuenl.cjs → create-once-DgMtKKcG.cjs} +8 -2
  19. package/dist/{crypto-B8lERvR1.cjs → crypto-Dpn4FHQ6.cjs} +9 -0
  20. package/dist/{crypto-DK_osBVy.js → crypto-usDg8L2K.js} +4 -1
  21. package/dist/data-link/index.cjs +232 -0
  22. package/dist/data-link/index.d.cts +79 -0
  23. package/dist/data-link/index.d.ts +79 -0
  24. package/dist/data-link/index.js +224 -0
  25. package/dist/delegation/index.cjs +34 -33
  26. package/dist/delegation/index.d.cts +2 -1
  27. package/dist/delegation/index.d.ts +2 -1
  28. package/dist/delegation/index.js +3 -2
  29. package/dist/get-Byc9T5WO.d.cts +151 -0
  30. package/dist/get-Byc9T5WO.d.ts +151 -0
  31. package/dist/get-Csm2n0rZ.cjs +445 -0
  32. package/dist/get-DT3JEgQ6.js +380 -0
  33. package/dist/index.cjs +3 -3
  34. package/dist/index.d.cts +4 -2
  35. package/dist/index.d.ts +4 -2
  36. package/dist/index.js +3 -3
  37. package/dist/{issue-BsyYdrIG.cjs → issue-AGRohSm7.cjs} +48 -665
  38. package/dist/{issue-C6Fcjvln.js → issue-DtSLpVdJ.js} +5 -502
  39. package/dist/mcp/index.cjs +10 -0
  40. package/dist/mcp/index.d.cts +71 -0
  41. package/dist/mcp/index.d.ts +71 -0
  42. package/dist/mcp/index.js +2 -0
  43. package/dist/money/index.cjs +1 -1
  44. package/dist/money/index.js +1 -1
  45. package/dist/{money-DrhGkWHW.cjs → money-BxytJW6f.cjs} +25 -9
  46. package/dist/{money-DAA7OwiO.js → money-t7uy1n91.js} +25 -9
  47. package/dist/nav/index.cjs +1046 -0
  48. package/dist/nav/index.d.cts +247 -0
  49. package/dist/nav/index.d.ts +247 -0
  50. package/dist/nav/index.js +1012 -0
  51. package/dist/nav-BEwcX7-N.cjs +203 -0
  52. package/dist/nav-CK1WgYo7.js +156 -0
  53. package/dist/parse-BJj-aqKy.cjs +380 -0
  54. package/dist/parse-C608ehqM.js +291 -0
  55. package/dist/payments/barion.cjs +1 -1
  56. package/dist/payments/barion.d.cts +2 -2
  57. package/dist/payments/barion.d.ts +2 -2
  58. package/dist/payments/barion.js +1 -1
  59. package/dist/payments/index.cjs +2 -2
  60. package/dist/payments/index.d.cts +3 -3
  61. package/dist/payments/index.d.ts +3 -3
  62. package/dist/payments/index.js +2 -2
  63. package/dist/payments/paypal.cjs +1 -1
  64. package/dist/payments/paypal.d.cts +2 -2
  65. package/dist/payments/paypal.d.ts +2 -2
  66. package/dist/payments/paypal.js +1 -1
  67. package/dist/payments/revolut.cjs +2 -2
  68. package/dist/payments/revolut.d.cts +2 -2
  69. package/dist/payments/revolut.d.ts +2 -2
  70. package/dist/payments/revolut.js +2 -2
  71. package/dist/payments/simplepay.cjs +2 -2
  72. package/dist/payments/simplepay.d.cts +2 -2
  73. package/dist/payments/simplepay.d.ts +2 -2
  74. package/dist/payments/simplepay.js +2 -2
  75. package/dist/payments/stripe.cjs +2 -2
  76. package/dist/payments/stripe.d.cts +2 -2
  77. package/dist/payments/stripe.d.ts +2 -2
  78. package/dist/payments/stripe.js +2 -2
  79. package/dist/reports/index.cjs +11 -164
  80. package/dist/reports/index.js +1 -154
  81. package/dist/request-body-CH6ZGOrq.cjs +34 -0
  82. package/dist/request-body-uZHMRlQr.js +29 -0
  83. package/dist/serialize-BXOww1Uq.cjs +286 -0
  84. package/dist/serialize-DSE_o9RK.js +215 -0
  85. package/dist/server-C6PoNkdD.cjs +1557 -0
  86. package/dist/server-Cd8HB661.js +1504 -0
  87. package/dist/testing/index.cjs +1476 -3
  88. package/dist/testing/index.d.cts +194 -2
  89. package/dist/testing/index.d.ts +194 -2
  90. package/dist/testing/index.js +1477 -6
  91. package/dist/{types-COf1LAD-.d.cts → types-BVeR7KyU.d.cts} +1 -1
  92. package/dist/{types-COf1LAD-.d.ts → types-BVeR7KyU.d.ts} +1 -1
  93. package/dist/{webhook-C76bV-4R.cjs → webhook-81giRMdQ.cjs} +3 -25
  94. package/dist/{webhook-q2OzNwd7.d.ts → webhook-CpCMHhn2.d.ts} +1 -1
  95. package/dist/{webhook-CfaDgcL0.d.cts → webhook-CpMJuP6c.d.cts} +1 -1
  96. package/dist/{webhook-D4lvtex1.js → webhook-CrEGohbg.js} +3 -25
  97. package/llms.txt +4 -4
  98. package/package.json +43 -1
  99. package/dist/client-CickRRFr.d.ts +0 -838
  100. package/dist/client-DvWZoX_E.d.cts +0 -838
@@ -0,0 +1,425 @@
1
+ import { t as CookieStore } from "./session-Dm_45x8K.js";
2
+ import { t as DateInput } from "./dates-9zvESP0i.js";
3
+ import { o as ItemAmounts, s as ItemPriceInput } from "./index-CYAGCdKJ.js";
4
+ import { r as Receipt } from "./types-k--zHf4l.js";
5
+ //#region src/core/actions.d.ts
6
+ declare const SZAMLAZZ_AGENT_URL = "https://www.szamlazz.hu/szamla/";
7
+ declare const AGENT_ACTIONS: {
8
+ readonly createInvoice: "action-xmlagentxmlfile";
9
+ readonly reverseInvoice: "action-szamla_agent_st";
10
+ readonly registerPayment: "action-szamla_agent_kifiz";
11
+ readonly getInvoicePdf: "action-szamla_agent_pdf";
12
+ readonly getInvoiceXml: "action-szamla_agent_xml";
13
+ readonly deleteProforma: "action-szamla_agent_dijbekero_torlese";
14
+ readonly createReceipt: "action-szamla_agent_nyugta_create";
15
+ readonly reverseReceipt: "action-szamla_agent_nyugta_storno";
16
+ readonly getReceipt: "action-szamla_agent_nyugta_get";
17
+ readonly sendReceipt: "action-szamla_agent_nyugta_send";
18
+ readonly queryTaxpayer: "action-szamla_agent_taxpayer";
19
+ readonly connectPrincipal: "action-agent_ceg_mb";
20
+ };
21
+ type AgentAction = keyof typeof AGENT_ACTIONS;
22
+ declare const MAX_INVOICE_ATTACHMENTS = 5;
23
+ //#endregion
24
+ //#region src/invoices/create-types.d.ts
25
+ type InvoiceType = "invoice" | "proforma" | "advance" | "final" | "corrective" | "deliveryNote";
26
+ declare const INVOICE_LANGUAGES: readonly ["hu", "en", "de", "it", "ro", "sk", "hr", "fr", "es", "cz", "pl", "bg", "nl", "ru", "si"];
27
+ type InvoiceLanguage = (typeof INVOICE_LANGUAGES)[number];
28
+ declare const INVOICE_TEMPLATES: readonly ["SzlaMost", "SzlaAlap", "SzlaNoEnv", "Szla8cm", "SzlaTomb", "SzlaFuvarlevelesAlap"];
29
+ type InvoiceTemplate = (typeof INVOICE_TEMPLATES)[number];
30
+ 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"];
31
+ type Currency = (typeof CURRENCIES)[number] | (string & {});
32
+ type TaxpayerType = "nonEuBusiness" | "euBusiness" | "hungarianTaxNumber" | "unknown" | "noTaxNumber";
33
+ type CourierService = "TOF" | "PPP" | "SPRINTER" | "FOXPOST" | "MPL" | "GLS" | "EMPTY" | (string & {});
34
+ interface InvoiceSeller {
35
+ readonly bank?: string | undefined;
36
+ readonly bankAccount?: string | undefined;
37
+ readonly emailReplyTo?: string | undefined;
38
+ readonly emailSubject?: string | undefined;
39
+ readonly emailText?: string | undefined;
40
+ readonly signatoryName?: string | undefined;
41
+ }
42
+ interface InvoicePostalAddress {
43
+ readonly name?: string | undefined;
44
+ readonly country?: string | undefined;
45
+ readonly zip?: string | undefined;
46
+ readonly city?: string | undefined;
47
+ readonly address?: string | undefined;
48
+ }
49
+ interface BuyerLedger {
50
+ readonly bookingDate?: DateInput | undefined;
51
+ readonly buyerId?: string | undefined;
52
+ readonly ledgerAccount?: string | undefined;
53
+ readonly continuousFulfillment?: boolean | undefined;
54
+ readonly settlementPeriodStart?: DateInput | undefined;
55
+ readonly settlementPeriodEnd?: DateInput | undefined;
56
+ }
57
+ interface InvoiceBuyer {
58
+ readonly name: string;
59
+ readonly country?: string | undefined;
60
+ readonly zip: string;
61
+ readonly city: string;
62
+ readonly address: string;
63
+ readonly email?: string | undefined;
64
+ readonly sendEmail?: boolean | undefined;
65
+ readonly taxpayerType?: TaxpayerType | undefined;
66
+ readonly taxNumber?: string | undefined;
67
+ readonly groupTaxNumber?: string | undefined;
68
+ readonly euTaxNumber?: string | undefined;
69
+ readonly postal?: InvoicePostalAddress | undefined;
70
+ readonly ledger?: BuyerLedger | undefined;
71
+ readonly identifier?: string | undefined;
72
+ readonly signatoryName?: string | undefined;
73
+ readonly phone?: string | undefined;
74
+ readonly comment?: string | undefined;
75
+ }
76
+ interface ItemLedger {
77
+ readonly economicEvent?: string | undefined;
78
+ readonly vatEconomicEvent?: string | undefined;
79
+ readonly revenueLedgerAccount?: string | undefined;
80
+ readonly vatLedgerAccount?: string | undefined;
81
+ readonly settlementPeriodStart?: DateInput | undefined;
82
+ readonly settlementPeriodEnd?: DateInput | undefined;
83
+ }
84
+ type InvoiceItemInput = ItemPriceInput & {
85
+ readonly name: string;
86
+ readonly identifier?: string | undefined;
87
+ readonly unit?: string | undefined;
88
+ readonly comment?: string | undefined;
89
+ readonly ledger?: ItemLedger | undefined;
90
+ readonly dataDeletionCode?: number | undefined;
91
+ readonly marginVatBase?: number | undefined;
92
+ };
93
+ interface TransOFlexWaybill {
94
+ readonly id?: string | undefined;
95
+ readonly shipmentId?: string | undefined;
96
+ readonly packageCount?: number | undefined;
97
+ readonly countryCode?: string | undefined;
98
+ readonly zip?: string | undefined;
99
+ readonly service?: string | undefined;
100
+ }
101
+ interface PickPackPointWaybill {
102
+ readonly barcodePrefix?: string | undefined;
103
+ readonly barcodePostfix?: string | undefined;
104
+ }
105
+ interface SprinterWaybill {
106
+ readonly id?: string | undefined;
107
+ readonly senderCode?: string | undefined;
108
+ readonly directionCode?: string | undefined;
109
+ readonly packageCount?: number | undefined;
110
+ readonly barcodePostfix?: string | undefined;
111
+ readonly deliveryTime?: string | undefined;
112
+ }
113
+ interface MplWaybill {
114
+ readonly customerCode: string;
115
+ readonly barcode: string;
116
+ readonly weight: string | number;
117
+ readonly services?: string | undefined;
118
+ readonly declaredValue?: number | undefined;
119
+ }
120
+ interface Waybill {
121
+ readonly courier?: CourierService | undefined;
122
+ readonly barcode?: string | undefined;
123
+ readonly comment?: string | undefined;
124
+ readonly transOFlex?: TransOFlexWaybill | undefined;
125
+ readonly pickPackPoint?: PickPackPointWaybill | undefined;
126
+ readonly sprinter?: SprinterWaybill | undefined;
127
+ readonly mpl?: MplWaybill | undefined;
128
+ }
129
+ interface InvoiceDefaults {
130
+ readonly seller?: InvoiceSeller | undefined;
131
+ readonly prefix?: string | undefined;
132
+ readonly language?: InvoiceLanguage | undefined;
133
+ readonly currency?: Currency | undefined;
134
+ readonly exchangeBank?: string | undefined;
135
+ readonly paymentMethod?: string | undefined;
136
+ readonly paymentDueInDays?: number | undefined;
137
+ readonly eInvoice?: boolean | undefined;
138
+ readonly downloadPdf?: boolean | undefined;
139
+ readonly template?: InvoiceTemplate | undefined;
140
+ readonly sendEmail?: boolean | undefined;
141
+ readonly logoExtra?: string | undefined;
142
+ readonly simpleItems?: boolean | undefined;
143
+ readonly euVat?: boolean | undefined;
144
+ readonly aggregator?: string | undefined;
145
+ readonly guardian?: boolean | undefined;
146
+ readonly articleIdentifierInvoice?: boolean | undefined;
147
+ }
148
+ interface CreateInvoiceBase {
149
+ readonly buyer: InvoiceBuyer;
150
+ readonly items: readonly InvoiceItemInput[];
151
+ readonly seller?: InvoiceSeller | undefined;
152
+ readonly issueDate?: DateInput | undefined;
153
+ readonly fulfillmentDate?: DateInput | undefined;
154
+ readonly dueDate?: DateInput | undefined;
155
+ readonly paymentDueInDays?: number | undefined;
156
+ readonly paymentMethod?: string | undefined;
157
+ readonly currency?: Currency | undefined;
158
+ readonly exchangeRate?: number | undefined;
159
+ readonly exchangeBank?: string | undefined;
160
+ readonly language?: InvoiceLanguage | undefined;
161
+ readonly comment?: string | undefined;
162
+ readonly orderNumber?: string | undefined;
163
+ readonly proformaNumber?: string | undefined;
164
+ readonly prefix?: string | undefined;
165
+ readonly paid?: boolean | undefined;
166
+ readonly eInvoice?: boolean | undefined;
167
+ readonly downloadPdf?: boolean | undefined;
168
+ readonly externalId?: string | undefined;
169
+ readonly template?: InvoiceTemplate | undefined;
170
+ readonly simpleItems?: boolean | undefined;
171
+ readonly logoExtra?: string | undefined;
172
+ readonly paymentCorrection?: number | undefined;
173
+ readonly marginVat?: boolean | undefined;
174
+ readonly euVat?: boolean | undefined;
175
+ readonly aggregator?: string | undefined;
176
+ readonly guardian?: boolean | undefined;
177
+ readonly articleIdentifierInvoice?: boolean | undefined;
178
+ readonly waybill?: Waybill | undefined;
179
+ readonly attachments?: readonly AgentAttachment[] | undefined;
180
+ }
181
+ interface StandardInvoiceInput extends CreateInvoiceBase {
182
+ readonly type?: "invoice" | "proforma" | "advance" | "deliveryNote" | undefined;
183
+ }
184
+ interface FinalInvoiceInput extends CreateInvoiceBase {
185
+ readonly type: "final";
186
+ readonly advanceInvoiceNumber?: string | undefined;
187
+ }
188
+ interface CorrectiveInvoiceInput extends CreateInvoiceBase {
189
+ readonly type: "corrective";
190
+ readonly correctedInvoiceNumber: string;
191
+ }
192
+ type CreateInvoiceInput = StandardInvoiceInput | FinalInvoiceInput | CorrectiveInvoiceInput;
193
+ type CreatedInvoiceItem = ItemAmounts & {
194
+ readonly name: string;
195
+ };
196
+ interface CreatedInvoice {
197
+ readonly number: string;
198
+ readonly netTotal: number;
199
+ readonly grossTotal: number;
200
+ readonly outstanding?: number | undefined;
201
+ readonly buyerAccountUrl?: string | undefined;
202
+ readonly pdf?: Uint8Array | undefined;
203
+ readonly items: readonly CreatedInvoiceItem[];
204
+ }
205
+ interface InvoicePreview {
206
+ readonly pdf: Uint8Array;
207
+ readonly netTotal: number;
208
+ readonly grossTotal: number;
209
+ readonly items: readonly CreatedInvoiceItem[];
210
+ }
211
+ //#endregion
212
+ //#region src/core/errors.d.ts
213
+ type SzamlazzErrorCategory = "auth" | "account" | "validation" | "duplicate" | "partial_success" | "not_found" | "maintenance" | "rate_limit" | "attempt_limit" | "network" | "timeout" | "configuration" | "unexpected_response" | "unknown";
214
+ interface AgentErrorCodeInfo {
215
+ readonly message: string;
216
+ readonly category: SzamlazzErrorCategory;
217
+ readonly hint?: string;
218
+ }
219
+ declare const AGENT_ERROR_CODES: Readonly<Record<number, AgentErrorCodeInfo>>;
220
+ interface SzamlazzErrorOptions {
221
+ readonly category: SzamlazzErrorCategory;
222
+ readonly code?: number | undefined;
223
+ readonly hint?: string | undefined;
224
+ readonly action?: AgentAction | undefined;
225
+ readonly httpStatus?: number | undefined;
226
+ readonly rawResponse?: string | undefined;
227
+ readonly details?: Readonly<Record<string, string>> | undefined;
228
+ readonly cause?: unknown;
229
+ }
230
+ declare class SzamlazzError extends Error {
231
+ override readonly name: string;
232
+ readonly code: number | undefined;
233
+ readonly category: SzamlazzErrorCategory;
234
+ readonly retryable: boolean;
235
+ readonly hint: string | undefined;
236
+ readonly action: AgentAction | undefined;
237
+ readonly httpStatus: number | undefined;
238
+ readonly rawResponse: string | undefined;
239
+ readonly details: Readonly<Record<string, string>> | undefined;
240
+ constructor(message: string, options: SzamlazzErrorOptions);
241
+ get isDuplicate(): boolean;
242
+ get isNotFound(): boolean;
243
+ }
244
+ declare function isSzamlazzError(error: unknown): error is SzamlazzError;
245
+ declare function suggestedPrefix(error: unknown): string | undefined;
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
+ //#endregion
370
+ //#region src/core/context.d.ts
371
+ interface AgentAttachment {
372
+ readonly filename: string;
373
+ readonly content: Uint8Array | ArrayBuffer | Blob | string;
374
+ readonly contentType?: string;
375
+ }
376
+ interface AgentRequestEvent {
377
+ readonly action: AgentAction;
378
+ readonly attempt: number;
379
+ }
380
+ interface AgentResponseEvent extends AgentRequestEvent {
381
+ readonly status: number;
382
+ readonly durationMs: number;
383
+ }
384
+ interface AgentErrorEvent extends AgentRequestEvent {
385
+ readonly error: SzamlazzError;
386
+ readonly willRetry: boolean;
387
+ }
388
+ interface SzamlazzHooks {
389
+ readonly onRequest?: (event: AgentRequestEvent) => void;
390
+ readonly onResponse?: (event: AgentResponseEvent) => void;
391
+ readonly onError?: (event: AgentErrorEvent) => void;
392
+ readonly onDocument?: DocumentHook;
393
+ }
394
+ interface SzamlazzOptions {
395
+ readonly agentKey?: string;
396
+ readonly username?: string;
397
+ readonly password?: string;
398
+ readonly endpoint?: string;
399
+ readonly fetch?: typeof globalThis.fetch;
400
+ readonly timeoutMs?: number;
401
+ readonly maxAttempts?: number;
402
+ readonly retryDelayMs?: number;
403
+ readonly cookieStore?: CookieStore | false;
404
+ readonly attemptLedger?: CookieStore | undefined;
405
+ readonly maintenanceCooldownMs?: number | undefined;
406
+ readonly hooks?: SzamlazzHooks;
407
+ }
408
+ interface RequestOptions {
409
+ readonly signal?: AbortSignal | undefined;
410
+ }
411
+ interface AgentRequest {
412
+ readonly action: AgentAction;
413
+ readonly xml: string;
414
+ readonly attachments?: readonly AgentAttachment[];
415
+ readonly signal?: AbortSignal | undefined;
416
+ readonly safeToRetry?: boolean;
417
+ }
418
+ interface AgentContext {
419
+ readonly credentials: readonly XmlNode[];
420
+ execute<T>(request: AgentRequest, parse: (response: AgentResponse) => T | Promise<T>): Promise<T>;
421
+ resetSession(): Promise<void>;
422
+ resetAttempts(key: string): Promise<void>;
423
+ }
424
+ //#endregion
425
+ export { TransOFlexWaybill as $, BuyerLedger as A, InvoiceItemInput as B, AgentResponse as C, SzamlazzErrorCategory as D, SzamlazzError as E, CreatedInvoiceItem as F, InvoiceTemplate as G, InvoicePostalAddress as H, Currency as I, MplWaybill as J, InvoiceType as K, FinalInvoiceInput as L, CourierService as M, CreateInvoiceInput as N, isSzamlazzError as O, CreatedInvoice as P, TaxpayerType as Q, InvoiceBuyer as R, XmlNode as S, AgentErrorCodeInfo as T, InvoicePreview as U, InvoiceLanguage as V, InvoiceSeller as W, SprinterWaybill as X, PickPackPointWaybill as Y, StandardInvoiceInput as Z, ReversedInvoice as _, AgentResponseEvent as a, RegisterPaymentInput as b, SzamlazzOptions as c, InvoiceCreatedEvent as d, Waybill as et, InvoicePaymentEvent as f, ReverseInvoiceInput as g, ReceiptReversedEvent as h, AgentRequestEvent as i, SZAMLAZZ_AGENT_URL as it, CorrectiveInvoiceInput as j, suggestedPrefix as k, DocumentEvent as l, ReceiptCreatedEvent as m, AgentContext as n, AgentAction as nt, RequestOptions as o, InvoiceReversedEvent as p, ItemLedger as q, AgentErrorEvent as r, MAX_INVOICE_ATTACHMENTS as rt, SzamlazzHooks as s, AgentAttachment as t, AGENT_ACTIONS as tt, DocumentHook as u, ClearPaymentsInput as v, AGENT_ERROR_CODES as w, RegisteredPayment as x, PaymentEntry as y, InvoiceDefaults as z };