kassza 0.13.0 → 0.15.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-CqqECkMp.js} +8 -7
- package/dist/{server-C6PoNkdD.cjs → server-DENsDDW9.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,25 +1,60 @@
|
|
|
1
|
-
import { t as CookieStore } from "./session-Dm_45x8K.js";
|
|
2
1
|
import { t as DateInput } from "./dates-9zvESP0i.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
import { a as AgentAction, r as WarningHook, t as KasszaWarning } from "./warnings-B3DXnveC.js";
|
|
3
|
+
import { n as KeyValueStore } from "./store-C1rHd9DB.js";
|
|
4
|
+
import { d as ItemAmounts, f as ItemPriceInput } from "./index-C-7yWV7L.js";
|
|
5
|
+
import { r as Receipt } from "./types-D1zDOH_F.js";
|
|
6
|
+
import { t as CookieStore } from "./session-Ckl5eJhV.js";
|
|
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";
|
|
23
58
|
//#endregion
|
|
24
59
|
//#region src/invoices/create-types.d.ts
|
|
25
60
|
type InvoiceType = "invoice" | "proforma" | "advance" | "final" | "corrective" | "deliveryNote";
|
|
@@ -209,41 +244,6 @@ interface InvoicePreview {
|
|
|
209
244
|
readonly items: readonly CreatedInvoiceItem[];
|
|
210
245
|
}
|
|
211
246
|
//#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
247
|
//#region src/core/response.d.ts
|
|
248
248
|
interface AgentResponse {
|
|
249
249
|
readonly action: AgentAction;
|
|
@@ -366,6 +366,16 @@ interface ReceiptReversedEvent {
|
|
|
366
366
|
}
|
|
367
367
|
type DocumentEvent = InvoiceCreatedEvent | InvoiceReversedEvent | InvoicePaymentEvent | ReceiptCreatedEvent | ReceiptReversedEvent;
|
|
368
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;
|
|
369
379
|
//#endregion
|
|
370
380
|
//#region src/core/context.d.ts
|
|
371
381
|
interface AgentAttachment {
|
|
@@ -376,20 +386,32 @@ interface AgentAttachment {
|
|
|
376
386
|
interface AgentRequestEvent {
|
|
377
387
|
readonly action: AgentAction;
|
|
378
388
|
readonly attempt: number;
|
|
389
|
+
readonly requestId: string;
|
|
379
390
|
}
|
|
380
391
|
interface AgentResponseEvent extends AgentRequestEvent {
|
|
381
392
|
readonly status: number;
|
|
382
393
|
readonly durationMs: number;
|
|
394
|
+
readonly responseBytes: number;
|
|
395
|
+
readonly sessionReused: boolean;
|
|
383
396
|
}
|
|
384
397
|
interface AgentErrorEvent extends AgentRequestEvent {
|
|
385
398
|
readonly error: SzamlazzError;
|
|
386
399
|
readonly willRetry: boolean;
|
|
387
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
|
+
}
|
|
388
407
|
interface SzamlazzHooks {
|
|
389
408
|
readonly onRequest?: (event: AgentRequestEvent) => void;
|
|
390
409
|
readonly onResponse?: (event: AgentResponseEvent) => void;
|
|
391
410
|
readonly onError?: (event: AgentErrorEvent) => void;
|
|
411
|
+
readonly onComplete?: (event: AgentCompleteEvent) => void;
|
|
392
412
|
readonly onDocument?: DocumentHook;
|
|
413
|
+
readonly onDocumentError?: DocumentErrorMode;
|
|
414
|
+
readonly onWarning?: (warning: KasszaWarning) => void;
|
|
393
415
|
}
|
|
394
416
|
interface SzamlazzOptions {
|
|
395
417
|
readonly agentKey?: string;
|
|
@@ -401,7 +423,8 @@ interface SzamlazzOptions {
|
|
|
401
423
|
readonly maxAttempts?: number;
|
|
402
424
|
readonly retryDelayMs?: number;
|
|
403
425
|
readonly cookieStore?: CookieStore | false;
|
|
404
|
-
readonly attemptLedger?:
|
|
426
|
+
readonly attemptLedger?: KeyValueStore | undefined;
|
|
427
|
+
readonly attemptLedgerMode?: AttemptLedgerMode | undefined;
|
|
405
428
|
readonly maintenanceCooldownMs?: number | undefined;
|
|
406
429
|
readonly hooks?: SzamlazzHooks;
|
|
407
430
|
}
|
|
@@ -417,9 +440,10 @@ interface AgentRequest {
|
|
|
417
440
|
}
|
|
418
441
|
interface AgentContext {
|
|
419
442
|
readonly credentials: readonly XmlNode[];
|
|
443
|
+
readonly warn?: WarningHook | undefined;
|
|
420
444
|
execute<T>(request: AgentRequest, parse: (response: AgentResponse) => T | Promise<T>): Promise<T>;
|
|
421
445
|
resetSession(): Promise<void>;
|
|
422
446
|
resetAttempts(key: string): Promise<void>;
|
|
423
447
|
}
|
|
424
448
|
//#endregion
|
|
425
|
-
export {
|
|
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 };
|
|
@@ -1,153 +1,24 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
console.warn(`[szamlazz] A session cookie store "${event.operation}" művelete sikertelen, a kérés session nélkül folytatódik.`, event.error);
|
|
7
|
-
}
|
|
8
|
-
function withTimeout(promise, timeoutMs, operation) {
|
|
9
|
-
if (timeoutMs === void 0) return promise;
|
|
10
|
-
let timer;
|
|
11
|
-
const timeout = new Promise((_, reject) => {
|
|
12
|
-
timer = setTimeout(() => {
|
|
13
|
-
reject(/* @__PURE__ */ new Error(`A session cookie store "${operation}" művelete nem fejeződött be ${timeoutMs} ms alatt.`));
|
|
14
|
-
}, timeoutMs);
|
|
15
|
-
});
|
|
16
|
-
return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
|
|
17
|
-
}
|
|
18
|
-
function resilientCookieStore(store, options = {}) {
|
|
19
|
-
const onError = options.onError ?? warnCookieStoreError;
|
|
20
|
-
if (options.timeoutMs !== void 0 && !(options.timeoutMs > 0)) throw new RangeError(`A timeoutMs pozitív szám legyen, kapott: ${options.timeoutMs}`);
|
|
21
|
-
function report(operation, key, error) {
|
|
22
|
-
try {
|
|
23
|
-
onError({
|
|
24
|
-
operation,
|
|
25
|
-
key,
|
|
26
|
-
error
|
|
27
|
-
});
|
|
28
|
-
} catch {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async function run(operation, key, call) {
|
|
33
|
-
try {
|
|
34
|
-
return await withTimeout(Promise.resolve().then(call), options.timeoutMs, operation);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
report(operation, key, error);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
async get(key) {
|
|
42
|
-
return await run("get", key, () => store.get(key)) ?? void 0;
|
|
43
|
-
},
|
|
44
|
-
async set(key, value, ttlSeconds) {
|
|
45
|
-
await run("set", key, () => store.set(key, value, ttlSeconds));
|
|
46
|
-
},
|
|
47
|
-
async delete(key) {
|
|
48
|
-
await run("delete", key, () => store.delete(key));
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/cookie-stores/shared.ts
|
|
54
|
-
function prefixKey(options, key) {
|
|
55
|
-
const prefix = options?.prefix;
|
|
56
|
-
return prefix ? `${prefix}${key}` : key;
|
|
57
|
-
}
|
|
58
|
-
function finalizeCookieStore(store, options) {
|
|
59
|
-
if (options?.resilient === false) return store;
|
|
60
|
-
return resilientCookieStore(store, {
|
|
61
|
-
onError: options?.onError,
|
|
62
|
-
timeoutMs: options?.timeoutMs
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function readCookieValue(value) {
|
|
66
|
-
if (typeof value === "string") return value === "" ? void 0 : value;
|
|
67
|
-
if (value instanceof Uint8Array) return readCookieValue(require_binary.decodeUtf8(value));
|
|
68
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
69
|
-
}
|
|
70
|
-
function wholeSeconds(ttlSeconds, minimum) {
|
|
71
|
-
if (!Number.isFinite(ttlSeconds)) return minimum;
|
|
72
|
-
return Math.max(minimum, Math.ceil(ttlSeconds));
|
|
73
|
-
}
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/cookie-stores/cloudflare-kv.ts
|
|
76
|
-
const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
|
|
77
|
-
function cloudflareKvCookieStore(namespace, options) {
|
|
78
|
-
return finalizeCookieStore({
|
|
79
|
-
async get(key) {
|
|
80
|
-
return readCookieValue(await namespace.get(prefixKey(options, key)));
|
|
81
|
-
},
|
|
82
|
-
async set(key, value, ttlSeconds) {
|
|
83
|
-
await namespace.put(prefixKey(options, key), value, { expirationTtl: wholeSeconds(ttlSeconds, 60) });
|
|
84
|
-
},
|
|
85
|
-
async delete(key) {
|
|
86
|
-
await namespace.delete(prefixKey(options, key));
|
|
87
|
-
}
|
|
88
|
-
}, options);
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region src/cookie-stores/custom.ts
|
|
92
|
-
function customCookieStore(store, options) {
|
|
93
|
-
return finalizeCookieStore({
|
|
94
|
-
get: (key) => store.get(prefixKey(options, key)),
|
|
95
|
-
set: (key, value, ttlSeconds) => store.set(prefixKey(options, key), value, ttlSeconds),
|
|
96
|
-
delete: (key) => store.delete(prefixKey(options, key))
|
|
97
|
-
}, options);
|
|
98
|
-
}
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/cookie-stores/ioredis.ts
|
|
101
|
-
function ioredisCookieStore(redis, options) {
|
|
102
|
-
return finalizeCookieStore({
|
|
103
|
-
async get(key) {
|
|
104
|
-
return readCookieValue(await redis.get(prefixKey(options, key)));
|
|
105
|
-
},
|
|
106
|
-
async set(key, value, ttlSeconds) {
|
|
107
|
-
await redis.set(prefixKey(options, key), value, "EX", wholeSeconds(ttlSeconds, 1));
|
|
108
|
-
},
|
|
109
|
-
async delete(key) {
|
|
110
|
-
await redis.del(prefixKey(options, key));
|
|
111
|
-
}
|
|
112
|
-
}, options);
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/cookie-stores/node-redis.ts
|
|
116
|
-
function nodeRedisCookieStore(client, options) {
|
|
117
|
-
return finalizeCookieStore({
|
|
118
|
-
async get(key) {
|
|
119
|
-
return readCookieValue(await client.get(prefixKey(options, key)));
|
|
120
|
-
},
|
|
121
|
-
async set(key, value, ttlSeconds) {
|
|
122
|
-
await client.set(prefixKey(options, key), value, { EX: wholeSeconds(ttlSeconds, 1) });
|
|
123
|
-
},
|
|
124
|
-
async delete(key) {
|
|
125
|
-
await client.del(prefixKey(options, key));
|
|
126
|
-
}
|
|
127
|
-
}, options);
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/cookie-stores/upstash.ts
|
|
131
|
-
function upstashRedisCookieStore(redis, options) {
|
|
132
|
-
return finalizeCookieStore({
|
|
133
|
-
async get(key) {
|
|
134
|
-
return readCookieValue(await redis.get(prefixKey(options, key)));
|
|
135
|
-
},
|
|
136
|
-
async set(key, value, ttlSeconds) {
|
|
137
|
-
await redis.set(prefixKey(options, key), value, { ex: wholeSeconds(ttlSeconds, 1) });
|
|
138
|
-
},
|
|
139
|
-
async delete(key) {
|
|
140
|
-
await redis.del(prefixKey(options, key));
|
|
141
|
-
}
|
|
142
|
-
}, options);
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
|
-
exports.CLOUDFLARE_KV_MIN_TTL_SECONDS = CLOUDFLARE_KV_MIN_TTL_SECONDS;
|
|
2
|
+
const require_session = require("../session-DeM5vjvC.cjs");
|
|
3
|
+
const require_stores = require("../stores-BNrS0dWl.cjs");
|
|
4
|
+
exports.CLOUDFLARE_KV_MIN_TTL_SECONDS = require_stores.CLOUDFLARE_KV_MIN_TTL_SECONDS;
|
|
5
|
+
exports.DURABLE_OBJECT_STORE_URL = require_stores.DURABLE_OBJECT_STORE_URL;
|
|
146
6
|
exports.SESSION_TTL_SECONDS = require_session.SESSION_TTL_SECONDS;
|
|
147
|
-
exports.cloudflareKvCookieStore = cloudflareKvCookieStore;
|
|
148
|
-
exports.
|
|
149
|
-
exports.
|
|
7
|
+
exports.cloudflareKvCookieStore = require_stores.cloudflareKvCookieStore;
|
|
8
|
+
exports.cloudflareKvStore = require_stores.cloudflareKvCookieStore;
|
|
9
|
+
exports.customCookieStore = require_stores.customCookieStore;
|
|
10
|
+
exports.customStore = require_stores.customCookieStore;
|
|
11
|
+
exports.diagnoseStore = require_stores.diagnoseStore;
|
|
12
|
+
exports.durableObjectStore = require_stores.durableObjectStore;
|
|
13
|
+
exports.handleDurableObjectStoreRequest = require_stores.handleDurableObjectStoreRequest;
|
|
14
|
+
exports.ioredisCookieStore = require_stores.ioredisCookieStore;
|
|
15
|
+
exports.ioredisStore = require_stores.ioredisCookieStore;
|
|
150
16
|
exports.memoryCookieStore = require_session.memoryCookieStore;
|
|
151
|
-
exports.
|
|
152
|
-
exports.
|
|
153
|
-
exports.
|
|
17
|
+
exports.memoryStore = require_session.memoryStore;
|
|
18
|
+
exports.nodeRedisCookieStore = require_stores.nodeRedisCookieStore;
|
|
19
|
+
exports.nodeRedisStore = require_stores.nodeRedisCookieStore;
|
|
20
|
+
exports.resilientCookieStore = require_stores.resilientCookieStore;
|
|
21
|
+
exports.resilientStore = require_stores.resilientCookieStore;
|
|
22
|
+
exports.storeCapabilities = require_session.storeCapabilities;
|
|
23
|
+
exports.upstashRedisCookieStore = require_stores.upstashRedisCookieStore;
|
|
24
|
+
exports.upstashRedisStore = require_stores.upstashRedisCookieStore;
|
|
@@ -1,63 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
readonly operation: CookieStoreOperation;
|
|
6
|
-
readonly key: string;
|
|
7
|
-
readonly error: unknown;
|
|
8
|
-
}
|
|
9
|
-
interface ResilientCookieStoreOptions {
|
|
10
|
-
readonly onError?: ((event: CookieStoreErrorEvent) => void) | undefined;
|
|
11
|
-
readonly timeoutMs?: number | undefined;
|
|
12
|
-
}
|
|
13
|
-
export declare function resilientCookieStore(store: CookieStore, options?: ResilientCookieStoreOptions): CookieStore;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/cookie-stores/shared.d.ts
|
|
16
|
-
interface CookieStoreAdapterOptions extends ResilientCookieStoreOptions {
|
|
17
|
-
readonly prefix?: string | undefined;
|
|
18
|
-
readonly resilient?: boolean | undefined;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/cookie-stores/cloudflare-kv.d.ts
|
|
22
|
-
export declare const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
|
|
23
|
-
interface CloudflareKvNamespaceLike {
|
|
24
|
-
get(key: string): Promise<string | null>;
|
|
25
|
-
put(key: string, value: string, options: {
|
|
26
|
-
expirationTtl: number;
|
|
27
|
-
}): Promise<void>;
|
|
28
|
-
delete(key: string): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
export declare function cloudflareKvCookieStore(namespace: CloudflareKvNamespaceLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/cookie-stores/custom.d.ts
|
|
33
|
-
export declare function customCookieStore(store: CookieStore, options?: CookieStoreAdapterOptions): CookieStore;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/cookie-stores/ioredis.d.ts
|
|
36
|
-
interface IoRedisLike {
|
|
37
|
-
get(key: string): Promise<unknown>;
|
|
38
|
-
set(key: string, value: string, expiryMode: "EX", seconds: number): Promise<unknown>;
|
|
39
|
-
del(key: string): Promise<unknown>;
|
|
40
|
-
}
|
|
41
|
-
export declare function ioredisCookieStore(redis: IoRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/cookie-stores/node-redis.d.ts
|
|
44
|
-
interface NodeRedisLike {
|
|
45
|
-
get(key: string): Promise<unknown>;
|
|
46
|
-
set(key: string, value: string, options: {
|
|
47
|
-
EX: number;
|
|
48
|
-
}): Promise<unknown>;
|
|
49
|
-
del(key: string): Promise<unknown>;
|
|
50
|
-
}
|
|
51
|
-
export declare function nodeRedisCookieStore(client: NodeRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/cookie-stores/upstash.d.ts
|
|
54
|
-
interface UpstashRedisLike {
|
|
55
|
-
get(key: string): Promise<unknown>;
|
|
56
|
-
set(key: string, value: string, options: {
|
|
57
|
-
ex: number;
|
|
58
|
-
}): Promise<unknown>;
|
|
59
|
-
del(key: string): Promise<unknown>;
|
|
60
|
-
}
|
|
61
|
-
export declare function upstashRedisCookieStore(redis: UpstashRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { type CloudflareKvNamespaceLike, type CookieStore, type CookieStoreAdapterOptions, type CookieStoreErrorEvent, type CookieStoreOperation, type IoRedisLike, type NodeRedisLike, type ResilientCookieStoreOptions, SESSION_TTL_SECONDS, type UpstashRedisLike, memoryCookieStore };
|
|
1
|
+
import { a as storeCapabilities, i as memoryStore, n as KeyValueStore, r as StoreCapabilities, t as Awaitable } from "../store-C1rHd9DB.cjs";
|
|
2
|
+
import { n as SESSION_TTL_SECONDS, r as memoryCookieStore, t as CookieStore } from "../session-YbChChx7.cjs";
|
|
3
|
+
import { C as CookieStoreErrorEvent, E as resilientCookieStore, S as CookieStoreAdapterOptions, T as ResilientCookieStoreOptions, _ as ioredisCookieStore, a as DurableObjectStubLike, b as CloudflareKvNamespaceLike, c as DiagnoseStoreOptions, d as diagnoseStore, f as UpstashRedisLike, g as IoRedisLike, h as nodeRedisCookieStore, i as DurableObjectStoreOperation, l as StoreDiagnosis, m as NodeRedisLike, n as DurableObjectStorageLike, o as durableObjectStore, p as upstashRedisCookieStore, r as DurableObjectStoreEntry, s as handleDurableObjectStoreRequest, t as DURABLE_OBJECT_STORE_URL, u as StoreSuitability, v as customCookieStore, w as CookieStoreOperation, x as cloudflareKvCookieStore, y as CLOUDFLARE_KV_MIN_TTL_SECONDS } from "../index-BhUPY_EH.cjs";
|
|
4
|
+
export { type Awaitable, CLOUDFLARE_KV_MIN_TTL_SECONDS, type CloudflareKvNamespaceLike, type CookieStore, type CookieStoreAdapterOptions, type CookieStoreErrorEvent, type CookieStoreOperation, DURABLE_OBJECT_STORE_URL, type DiagnoseStoreOptions, type DurableObjectStorageLike, type DurableObjectStoreEntry, type DurableObjectStoreOperation, type DurableObjectStubLike, type IoRedisLike, type KeyValueStore, type NodeRedisLike, type ResilientCookieStoreOptions, SESSION_TTL_SECONDS, type StoreCapabilities, type StoreDiagnosis, type StoreSuitability, type UpstashRedisLike, cloudflareKvCookieStore, cloudflareKvCookieStore as cloudflareKvStore, customCookieStore, customCookieStore as customStore, diagnoseStore, durableObjectStore, handleDurableObjectStoreRequest, ioredisCookieStore, ioredisCookieStore as ioredisStore, memoryCookieStore, memoryStore, nodeRedisCookieStore, nodeRedisCookieStore as nodeRedisStore, resilientCookieStore, resilientCookieStore as resilientStore, storeCapabilities, upstashRedisCookieStore, upstashRedisCookieStore as upstashRedisStore };
|
|
@@ -1,63 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
readonly operation: CookieStoreOperation;
|
|
6
|
-
readonly key: string;
|
|
7
|
-
readonly error: unknown;
|
|
8
|
-
}
|
|
9
|
-
interface ResilientCookieStoreOptions {
|
|
10
|
-
readonly onError?: ((event: CookieStoreErrorEvent) => void) | undefined;
|
|
11
|
-
readonly timeoutMs?: number | undefined;
|
|
12
|
-
}
|
|
13
|
-
export declare function resilientCookieStore(store: CookieStore, options?: ResilientCookieStoreOptions): CookieStore;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/cookie-stores/shared.d.ts
|
|
16
|
-
interface CookieStoreAdapterOptions extends ResilientCookieStoreOptions {
|
|
17
|
-
readonly prefix?: string | undefined;
|
|
18
|
-
readonly resilient?: boolean | undefined;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/cookie-stores/cloudflare-kv.d.ts
|
|
22
|
-
export declare const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
|
|
23
|
-
interface CloudflareKvNamespaceLike {
|
|
24
|
-
get(key: string): Promise<string | null>;
|
|
25
|
-
put(key: string, value: string, options: {
|
|
26
|
-
expirationTtl: number;
|
|
27
|
-
}): Promise<void>;
|
|
28
|
-
delete(key: string): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
export declare function cloudflareKvCookieStore(namespace: CloudflareKvNamespaceLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/cookie-stores/custom.d.ts
|
|
33
|
-
export declare function customCookieStore(store: CookieStore, options?: CookieStoreAdapterOptions): CookieStore;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/cookie-stores/ioredis.d.ts
|
|
36
|
-
interface IoRedisLike {
|
|
37
|
-
get(key: string): Promise<unknown>;
|
|
38
|
-
set(key: string, value: string, expiryMode: "EX", seconds: number): Promise<unknown>;
|
|
39
|
-
del(key: string): Promise<unknown>;
|
|
40
|
-
}
|
|
41
|
-
export declare function ioredisCookieStore(redis: IoRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/cookie-stores/node-redis.d.ts
|
|
44
|
-
interface NodeRedisLike {
|
|
45
|
-
get(key: string): Promise<unknown>;
|
|
46
|
-
set(key: string, value: string, options: {
|
|
47
|
-
EX: number;
|
|
48
|
-
}): Promise<unknown>;
|
|
49
|
-
del(key: string): Promise<unknown>;
|
|
50
|
-
}
|
|
51
|
-
export declare function nodeRedisCookieStore(client: NodeRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/cookie-stores/upstash.d.ts
|
|
54
|
-
interface UpstashRedisLike {
|
|
55
|
-
get(key: string): Promise<unknown>;
|
|
56
|
-
set(key: string, value: string, options: {
|
|
57
|
-
ex: number;
|
|
58
|
-
}): Promise<unknown>;
|
|
59
|
-
del(key: string): Promise<unknown>;
|
|
60
|
-
}
|
|
61
|
-
export declare function upstashRedisCookieStore(redis: UpstashRedisLike, options?: CookieStoreAdapterOptions): CookieStore;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { type CloudflareKvNamespaceLike, type CookieStore, type CookieStoreAdapterOptions, type CookieStoreErrorEvent, type CookieStoreOperation, type IoRedisLike, type NodeRedisLike, type ResilientCookieStoreOptions, SESSION_TTL_SECONDS, type UpstashRedisLike, memoryCookieStore };
|
|
1
|
+
import { a as storeCapabilities, i as memoryStore, n as KeyValueStore, r as StoreCapabilities, t as Awaitable } from "../store-C1rHd9DB.js";
|
|
2
|
+
import { n as SESSION_TTL_SECONDS, r as memoryCookieStore, t as CookieStore } from "../session-Ckl5eJhV.js";
|
|
3
|
+
import { C as CookieStoreErrorEvent, E as resilientCookieStore, S as CookieStoreAdapterOptions, T as ResilientCookieStoreOptions, _ as ioredisCookieStore, a as DurableObjectStubLike, b as CloudflareKvNamespaceLike, c as DiagnoseStoreOptions, d as diagnoseStore, f as UpstashRedisLike, g as IoRedisLike, h as nodeRedisCookieStore, i as DurableObjectStoreOperation, l as StoreDiagnosis, m as NodeRedisLike, n as DurableObjectStorageLike, o as durableObjectStore, p as upstashRedisCookieStore, r as DurableObjectStoreEntry, s as handleDurableObjectStoreRequest, t as DURABLE_OBJECT_STORE_URL, u as StoreSuitability, v as customCookieStore, w as CookieStoreOperation, x as cloudflareKvCookieStore, y as CLOUDFLARE_KV_MIN_TTL_SECONDS } from "../index-BqGgQ4t3.js";
|
|
4
|
+
export { type Awaitable, CLOUDFLARE_KV_MIN_TTL_SECONDS, type CloudflareKvNamespaceLike, type CookieStore, type CookieStoreAdapterOptions, type CookieStoreErrorEvent, type CookieStoreOperation, DURABLE_OBJECT_STORE_URL, type DiagnoseStoreOptions, type DurableObjectStorageLike, type DurableObjectStoreEntry, type DurableObjectStoreOperation, type DurableObjectStubLike, type IoRedisLike, type KeyValueStore, type NodeRedisLike, type ResilientCookieStoreOptions, SESSION_TTL_SECONDS, type StoreCapabilities, type StoreDiagnosis, type StoreSuitability, type UpstashRedisLike, cloudflareKvCookieStore, cloudflareKvCookieStore as cloudflareKvStore, customCookieStore, customCookieStore as customStore, diagnoseStore, durableObjectStore, handleDurableObjectStoreRequest, ioredisCookieStore, ioredisCookieStore as ioredisStore, memoryCookieStore, memoryStore, nodeRedisCookieStore, nodeRedisCookieStore as nodeRedisStore, resilientCookieStore, resilientCookieStore as resilientStore, storeCapabilities, upstashRedisCookieStore, upstashRedisCookieStore as upstashRedisStore };
|
|
@@ -1,144 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
|
|
4
|
-
function warnCookieStoreError(event) {
|
|
5
|
-
console.warn(`[szamlazz] A session cookie store "${event.operation}" művelete sikertelen, a kérés session nélkül folytatódik.`, event.error);
|
|
6
|
-
}
|
|
7
|
-
function withTimeout(promise, timeoutMs, operation) {
|
|
8
|
-
if (timeoutMs === void 0) return promise;
|
|
9
|
-
let timer;
|
|
10
|
-
const timeout = new Promise((_, reject) => {
|
|
11
|
-
timer = setTimeout(() => {
|
|
12
|
-
reject(/* @__PURE__ */ new Error(`A session cookie store "${operation}" művelete nem fejeződött be ${timeoutMs} ms alatt.`));
|
|
13
|
-
}, timeoutMs);
|
|
14
|
-
});
|
|
15
|
-
return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
|
|
16
|
-
}
|
|
17
|
-
function resilientCookieStore(store, options = {}) {
|
|
18
|
-
const onError = options.onError ?? warnCookieStoreError;
|
|
19
|
-
if (options.timeoutMs !== void 0 && !(options.timeoutMs > 0)) throw new RangeError(`A timeoutMs pozitív szám legyen, kapott: ${options.timeoutMs}`);
|
|
20
|
-
function report(operation, key, error) {
|
|
21
|
-
try {
|
|
22
|
-
onError({
|
|
23
|
-
operation,
|
|
24
|
-
key,
|
|
25
|
-
error
|
|
26
|
-
});
|
|
27
|
-
} catch {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async function run(operation, key, call) {
|
|
32
|
-
try {
|
|
33
|
-
return await withTimeout(Promise.resolve().then(call), options.timeoutMs, operation);
|
|
34
|
-
} catch (error) {
|
|
35
|
-
report(operation, key, error);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
async get(key) {
|
|
41
|
-
return await run("get", key, () => store.get(key)) ?? void 0;
|
|
42
|
-
},
|
|
43
|
-
async set(key, value, ttlSeconds) {
|
|
44
|
-
await run("set", key, () => store.set(key, value, ttlSeconds));
|
|
45
|
-
},
|
|
46
|
-
async delete(key) {
|
|
47
|
-
await run("delete", key, () => store.delete(key));
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/cookie-stores/shared.ts
|
|
53
|
-
function prefixKey(options, key) {
|
|
54
|
-
const prefix = options?.prefix;
|
|
55
|
-
return prefix ? `${prefix}${key}` : key;
|
|
56
|
-
}
|
|
57
|
-
function finalizeCookieStore(store, options) {
|
|
58
|
-
if (options?.resilient === false) return store;
|
|
59
|
-
return resilientCookieStore(store, {
|
|
60
|
-
onError: options?.onError,
|
|
61
|
-
timeoutMs: options?.timeoutMs
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function readCookieValue(value) {
|
|
65
|
-
if (typeof value === "string") return value === "" ? void 0 : value;
|
|
66
|
-
if (value instanceof Uint8Array) return readCookieValue(decodeUtf8(value));
|
|
67
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
68
|
-
}
|
|
69
|
-
function wholeSeconds(ttlSeconds, minimum) {
|
|
70
|
-
if (!Number.isFinite(ttlSeconds)) return minimum;
|
|
71
|
-
return Math.max(minimum, Math.ceil(ttlSeconds));
|
|
72
|
-
}
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region src/cookie-stores/cloudflare-kv.ts
|
|
75
|
-
const CLOUDFLARE_KV_MIN_TTL_SECONDS = 60;
|
|
76
|
-
function cloudflareKvCookieStore(namespace, options) {
|
|
77
|
-
return finalizeCookieStore({
|
|
78
|
-
async get(key) {
|
|
79
|
-
return readCookieValue(await namespace.get(prefixKey(options, key)));
|
|
80
|
-
},
|
|
81
|
-
async set(key, value, ttlSeconds) {
|
|
82
|
-
await namespace.put(prefixKey(options, key), value, { expirationTtl: wholeSeconds(ttlSeconds, 60) });
|
|
83
|
-
},
|
|
84
|
-
async delete(key) {
|
|
85
|
-
await namespace.delete(prefixKey(options, key));
|
|
86
|
-
}
|
|
87
|
-
}, options);
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/cookie-stores/custom.ts
|
|
91
|
-
function customCookieStore(store, options) {
|
|
92
|
-
return finalizeCookieStore({
|
|
93
|
-
get: (key) => store.get(prefixKey(options, key)),
|
|
94
|
-
set: (key, value, ttlSeconds) => store.set(prefixKey(options, key), value, ttlSeconds),
|
|
95
|
-
delete: (key) => store.delete(prefixKey(options, key))
|
|
96
|
-
}, options);
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/cookie-stores/ioredis.ts
|
|
100
|
-
function ioredisCookieStore(redis, options) {
|
|
101
|
-
return finalizeCookieStore({
|
|
102
|
-
async get(key) {
|
|
103
|
-
return readCookieValue(await redis.get(prefixKey(options, key)));
|
|
104
|
-
},
|
|
105
|
-
async set(key, value, ttlSeconds) {
|
|
106
|
-
await redis.set(prefixKey(options, key), value, "EX", wholeSeconds(ttlSeconds, 1));
|
|
107
|
-
},
|
|
108
|
-
async delete(key) {
|
|
109
|
-
await redis.del(prefixKey(options, key));
|
|
110
|
-
}
|
|
111
|
-
}, options);
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/cookie-stores/node-redis.ts
|
|
115
|
-
function nodeRedisCookieStore(client, options) {
|
|
116
|
-
return finalizeCookieStore({
|
|
117
|
-
async get(key) {
|
|
118
|
-
return readCookieValue(await client.get(prefixKey(options, key)));
|
|
119
|
-
},
|
|
120
|
-
async set(key, value, ttlSeconds) {
|
|
121
|
-
await client.set(prefixKey(options, key), value, { EX: wholeSeconds(ttlSeconds, 1) });
|
|
122
|
-
},
|
|
123
|
-
async delete(key) {
|
|
124
|
-
await client.del(prefixKey(options, key));
|
|
125
|
-
}
|
|
126
|
-
}, options);
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region src/cookie-stores/upstash.ts
|
|
130
|
-
function upstashRedisCookieStore(redis, options) {
|
|
131
|
-
return finalizeCookieStore({
|
|
132
|
-
async get(key) {
|
|
133
|
-
return readCookieValue(await redis.get(prefixKey(options, key)));
|
|
134
|
-
},
|
|
135
|
-
async set(key, value, ttlSeconds) {
|
|
136
|
-
await redis.set(prefixKey(options, key), value, { ex: wholeSeconds(ttlSeconds, 1) });
|
|
137
|
-
},
|
|
138
|
-
async delete(key) {
|
|
139
|
-
await redis.del(prefixKey(options, key));
|
|
140
|
-
}
|
|
141
|
-
}, options);
|
|
142
|
-
}
|
|
143
|
-
//#endregion
|
|
144
|
-
export { CLOUDFLARE_KV_MIN_TTL_SECONDS, SESSION_TTL_SECONDS, cloudflareKvCookieStore, customCookieStore, ioredisCookieStore, memoryCookieStore, nodeRedisCookieStore, resilientCookieStore, upstashRedisCookieStore };
|
|
1
|
+
import { a as memoryStore, n as memoryCookieStore, o as storeCapabilities, t as SESSION_TTL_SECONDS } from "../session-SaEEXu2N.js";
|
|
2
|
+
import { a as upstashRedisCookieStore, c as customCookieStore, d as resilientCookieStore, i as diagnoseStore, l as CLOUDFLARE_KV_MIN_TTL_SECONDS, n as durableObjectStore, o as nodeRedisCookieStore, r as handleDurableObjectStoreRequest, s as ioredisCookieStore, t as DURABLE_OBJECT_STORE_URL, u as cloudflareKvCookieStore } from "../stores-DhjGBrl_.js";
|
|
3
|
+
export { CLOUDFLARE_KV_MIN_TTL_SECONDS, DURABLE_OBJECT_STORE_URL, SESSION_TTL_SECONDS, cloudflareKvCookieStore, cloudflareKvCookieStore as cloudflareKvStore, customCookieStore, customCookieStore as customStore, diagnoseStore, durableObjectStore, handleDurableObjectStoreRequest, ioredisCookieStore, ioredisCookieStore as ioredisStore, memoryCookieStore, memoryStore, nodeRedisCookieStore, nodeRedisCookieStore as nodeRedisStore, resilientCookieStore, resilientCookieStore as resilientStore, storeCapabilities, upstashRedisCookieStore, upstashRedisCookieStore as upstashRedisStore };
|