ksef-client-ts 0.3.0 → 0.5.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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ZodType } from 'zod';
1
2
  import * as crypto from 'node:crypto';
2
3
 
3
4
  interface EnvironmentConfig {
@@ -459,6 +460,123 @@ declare const SUBUNIT_NAME_MAX_LENGTH = 256;
459
460
  declare const PERMISSION_DESCRIPTION_MIN_LENGTH = 5;
460
461
  declare const PERMISSION_DESCRIPTION_MAX_LENGTH = 256;
461
462
 
463
+ /**
464
+ * XML-to-Object converter for Zod schema validation.
465
+ *
466
+ * Converts XML string → plain JS object matching the shape expected by
467
+ * generated Zod schemas (element children → properties, repeated elements → arrays,
468
+ * attributes → @-prefixed keys, namespace prefixes stripped).
469
+ */
470
+ /** Result of XML-to-object conversion. */
471
+ interface XmlConversionResult {
472
+ /** The converted root object (null if parsing failed). */
473
+ object: Record<string, unknown> | null;
474
+ /** Detected root element local name (e.g. "Faktura"). */
475
+ rootElement: string | null;
476
+ /** Detected namespace URI from the root element. */
477
+ namespace: string | null;
478
+ /** Parse errors, if any. */
479
+ errors: string[];
480
+ }
481
+ /**
482
+ * Convert an XML string to a plain JS object suitable for Zod validation.
483
+ *
484
+ * - Element children become object properties
485
+ * - Repeated elements with the same name become arrays
486
+ * - Attributes are prefixed with `@` (e.g. `@kodSystemowy`)
487
+ * - Namespace prefixes are stripped from element and attribute names
488
+ * - Text-only elements become string values
489
+ * - Mixed content (text + children) puts text in `#text` key
490
+ */
491
+ declare function xmlToObject(xml: string): XmlConversionResult;
492
+
493
+ /** Schema type identifiers */
494
+ type SchemaType = 'FA3' | 'FA2' | 'RR1_V11E' | 'RR1_V10E' | 'PEF3' | 'PEF_KOR3';
495
+
496
+ /**
497
+ * Schema Registry — lazy-loads generated Zod schemas and provides
498
+ * auto-detection of schema type from XML namespace or root element.
499
+ */
500
+
501
+ declare const SchemaRegistry: {
502
+ /**
503
+ * Get a Zod schema by type. Lazy-loads the module on first access.
504
+ */
505
+ get(type: SchemaType): Promise<ZodType>;
506
+ /**
507
+ * List all available schema types.
508
+ */
509
+ availableSchemas(): SchemaType[];
510
+ /**
511
+ * Detect schema type from XML namespace URI and/or root element name.
512
+ *
513
+ * Detection priority:
514
+ * 1. Namespace URI match (unique per FA/RR schemas)
515
+ * 2. Root element name match (for PEF/PEF_KOR which use UBL namespaces)
516
+ */
517
+ detect(namespace: string | null, rootElement: string | null): SchemaType | null;
518
+ };
519
+
520
+ /**
521
+ * Invoice XML validation service.
522
+ *
523
+ * Three independent validation levels:
524
+ * - Level 1: XML well-formedness (xmldom parse)
525
+ * - Level 2: Schema validation (xml→object→Zod safeParse)
526
+ * - Level 3: Business rules (NIP/PESEL checksum verification)
527
+ */
528
+
529
+ type InvoiceValidationErrorCode = 'MALFORMED_XML' | 'MISSING_REQUIRED_ELEMENT' | 'INVALID_VALUE' | 'INVALID_ENUM_VALUE' | 'PATTERN_MISMATCH' | 'MAX_OCCURS_EXCEEDED' | 'UNKNOWN_SCHEMA' | 'SCHEMA_VALIDATION_ERROR' | 'INVALID_NIP_CHECKSUM' | 'INVALID_PESEL_CHECKSUM';
530
+ interface InvoiceValidationError {
531
+ /** Error classification code. */
532
+ code: InvoiceValidationErrorCode;
533
+ /** Human-readable error message. */
534
+ message: string;
535
+ /** XPath-like path to the invalid element (e.g. "/Faktura/Podmiot1/NIP"). */
536
+ path?: string;
537
+ }
538
+ interface InvoiceValidationResult {
539
+ /** Whether the invoice passed all requested validation levels. */
540
+ valid: boolean;
541
+ /** Detected or overridden schema type. */
542
+ schemaType: SchemaType | null;
543
+ /** Validation errors from all levels. */
544
+ errors: InvoiceValidationError[];
545
+ }
546
+ interface ValidateOptions {
547
+ /** Explicit schema type override (skip auto-detection). */
548
+ schema?: SchemaType;
549
+ }
550
+ /**
551
+ * Check that the XML string is well-formed (parseable).
552
+ *
553
+ * @param xml - Raw XML string.
554
+ * @param _parsed - Pre-parsed XML result (internal optimisation, avoids re-parsing in `validate()`).
555
+ */
556
+ declare function validateWellFormedness(xml: string, _parsed?: XmlConversionResult): InvoiceValidationResult;
557
+ /**
558
+ * Validate XML against its Zod schema (auto-detected or explicit).
559
+ *
560
+ * @param xml - Raw XML string.
561
+ * @param options - Validation options (e.g. explicit schema type override).
562
+ * @param _parsed - Pre-parsed XML result (internal optimisation, avoids re-parsing in `validate()`).
563
+ */
564
+ declare function validateSchema(xml: string, options?: ValidateOptions, _parsed?: XmlConversionResult): Promise<InvoiceValidationResult>;
565
+ /**
566
+ * Validate business rules: NIP/PESEL checksum verification on Podmiot elements.
567
+ *
568
+ * @param xml - Raw XML string.
569
+ * @param _parsed - Pre-parsed XML result (internal optimisation, avoids re-parsing in `validate()`).
570
+ */
571
+ declare function validateBusinessRules(xml: string, _parsed?: XmlConversionResult): InvoiceValidationResult;
572
+ /**
573
+ * Run all three validation levels (well-formedness → schema → business rules).
574
+ * Short-circuits on first failing level.
575
+ *
576
+ * XML is parsed once and the result is reused across all three levels.
577
+ */
578
+ declare function validate(xml: string, options?: ValidateOptions): Promise<InvoiceValidationResult>;
579
+
462
580
  interface OperationResponse {
463
581
  referenceNumber: string;
464
582
  }
@@ -625,6 +743,11 @@ interface BatchPartSendingInfo {
625
743
  metadata: FileMetadata;
626
744
  ordinalNumber: number;
627
745
  }
746
+ interface BatchPartStreamSendingInfo {
747
+ dataStream: ReadableStream<Uint8Array>;
748
+ metadata: FileMetadata;
749
+ ordinalNumber: number;
750
+ }
628
751
 
629
752
  interface SessionsFilter {
630
753
  referenceNumber?: string;
@@ -1634,6 +1757,78 @@ interface QrCodeOptions {
1634
1757
  errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
1635
1758
  }
1636
1759
 
1760
+ declare const SystemCode: {
1761
+ readonly FA_2: "FA (2)";
1762
+ readonly FA_3: "FA (3)";
1763
+ readonly PEF_3: "PEF (3)";
1764
+ readonly PEF_KOR_3: "PEF_KOR (3)";
1765
+ readonly FA_RR_1: "FA_RR (1)";
1766
+ };
1767
+ type SystemCode = (typeof SystemCode)[keyof typeof SystemCode];
1768
+ declare const FORM_CODES: {
1769
+ readonly FA_2: {
1770
+ readonly systemCode: "FA (2)";
1771
+ readonly schemaVersion: "1-0E";
1772
+ readonly value: "FA";
1773
+ };
1774
+ readonly FA_3: {
1775
+ readonly systemCode: "FA (3)";
1776
+ readonly schemaVersion: "1-0E";
1777
+ readonly value: "FA";
1778
+ };
1779
+ readonly PEF_3: {
1780
+ readonly systemCode: "PEF (3)";
1781
+ readonly schemaVersion: "2-1";
1782
+ readonly value: "PEF";
1783
+ };
1784
+ readonly PEF_KOR_3: {
1785
+ readonly systemCode: "PEF_KOR (3)";
1786
+ readonly schemaVersion: "2-1";
1787
+ readonly value: "PEF";
1788
+ };
1789
+ readonly FA_RR_1_LEGACY: {
1790
+ readonly systemCode: "FA_RR (1)";
1791
+ readonly schemaVersion: "1-0E";
1792
+ readonly value: "RR";
1793
+ };
1794
+ readonly FA_RR_1_TRANSITION: {
1795
+ readonly systemCode: "FA_RR (1)";
1796
+ readonly schemaVersion: "1-1E";
1797
+ readonly value: "RR";
1798
+ };
1799
+ readonly FA_RR_1: {
1800
+ readonly systemCode: "FA_RR (1)";
1801
+ readonly schemaVersion: "1-1E";
1802
+ readonly value: "FA_RR";
1803
+ };
1804
+ };
1805
+ /** Default form code for sessions and CLI commands (FA(3) since 2026-02-01). */
1806
+ declare const DEFAULT_FORM_CODE: {
1807
+ readonly systemCode: "FA (3)";
1808
+ readonly schemaVersion: "1-0E";
1809
+ readonly value: "FA";
1810
+ };
1811
+ type OnlineSessionFormCode = (typeof FORM_CODES)[keyof typeof FORM_CODES];
1812
+ type BatchSessionFormCode = typeof FORM_CODES.FA_2 | typeof FORM_CODES.FA_3 | typeof FORM_CODES.FA_RR_1_LEGACY | typeof FORM_CODES.FA_RR_1_TRANSITION | typeof FORM_CODES.FA_RR_1;
1813
+ declare const INVOICE_TYPES_BY_SYSTEM_CODE: Record<SystemCode, readonly InvoiceType[]>;
1814
+ declare const FORM_CODE_KEYS: Record<string, FormCode>;
1815
+
1816
+ /**
1817
+ * Returns the default FormCode constant for a given SystemCode.
1818
+ * For FA_RR_1, returns the current variant (schemaVersion 1-1E, value FA_RR).
1819
+ */
1820
+ declare function getFormCode(systemCode: SystemCode): FormCode;
1821
+ /**
1822
+ * Matches a raw FormCode from an API response to the closest typed constant.
1823
+ * Returns the raw object unchanged if no exact match is found.
1824
+ */
1825
+ declare function parseFormCode(raw: FormCode): FormCode;
1826
+ /**
1827
+ * Validates whether a FormCode is valid for the given session type.
1828
+ * Batch sessions do not support PEF or PEF_KOR document types.
1829
+ */
1830
+ declare function validateFormCodeForSession(formCode: FormCode, sessionType: 'online' | 'batch'): boolean;
1831
+
1637
1832
  declare class AuthService {
1638
1833
  private readonly restClient;
1639
1834
  constructor(restClient: RestClient);
@@ -1666,6 +1861,12 @@ declare class BatchSessionService {
1666
1861
  constructor(restClient: RestClient);
1667
1862
  openSession(request: OpenBatchSessionRequest, upoVersion?: UpoVersion | string): Promise<OpenBatchSessionResponse>;
1668
1863
  sendParts(openResponse: OpenBatchSessionResponse, parts: BatchPartSendingInfo[]): Promise<void>;
1864
+ /**
1865
+ * Upload parts sequentially (not in parallel) because each part uses a
1866
+ * streaming body (`duplex: 'half'`). Parallel streaming uploads can cause
1867
+ * backpressure issues and exceed memory limits for large payloads.
1868
+ */
1869
+ sendPartsWithStream(openResponse: OpenBatchSessionResponse, parts: BatchPartStreamSendingInfo[]): Promise<void>;
1669
1870
  closeSession(batchRef: string): Promise<void>;
1670
1871
  }
1671
1872
 
@@ -1902,6 +2103,12 @@ interface BatchFileBuildResult {
1902
2103
  /** Encrypted parts ready for upload, indexed 0..N-1. */
1903
2104
  encryptedParts: Uint8Array[];
1904
2105
  }
2106
+ interface BatchStreamBuildResult {
2107
+ /** Metadata for OpenBatchSessionRequest.batchFile. */
2108
+ batchFile: BatchFileInfo;
2109
+ /** Stream-based encrypted parts ready for upload. */
2110
+ streamParts: BatchPartStreamSendingInfo[];
2111
+ }
1905
2112
  /**
1906
2113
  * Splits a ZIP file into parts, encrypts each part, and computes
1907
2114
  * all SHA-256 hashes required by the KSeF batch API.
@@ -1915,6 +2122,19 @@ declare class BatchFileBuilder {
1915
2122
  * @param options - Optional configuration
1916
2123
  */
1917
2124
  static build(zipBytes: Uint8Array, encryptFn: (part: Uint8Array) => Uint8Array, options?: BatchFileBuildOptions): BatchFileBuildResult;
2125
+ /**
2126
+ * Stream-based variant: two-pass build from a stream factory.
2127
+ *
2128
+ * Pass 1: consume stream to compute ZIP hash.
2129
+ * Pass 2: re-create stream, split into parts, encrypt each, compute per-part metadata.
2130
+ *
2131
+ * @param zipStreamFactory - Factory that creates a fresh ReadableStream of the ZIP data
2132
+ * @param zipSize - Total ZIP byte size (from fs.stat or known in advance)
2133
+ * @param encryptStreamFn - Stream-to-stream AES-256-CBC encryption function
2134
+ * @param hashStreamFn - Stream-to-FileMetadata hashing function
2135
+ * @param options - Optional configuration
2136
+ */
2137
+ static buildFromStream(zipStreamFactory: () => ReadableStream<Uint8Array>, zipSize: number, encryptStreamFn: (stream: ReadableStream<Uint8Array>) => ReadableStream<Uint8Array>, hashStreamFn: (stream: ReadableStream<Uint8Array>) => Promise<FileMetadata>, options?: BatchFileBuildOptions): Promise<BatchStreamBuildResult>;
1918
2138
  }
1919
2139
 
1920
2140
  declare class CertificateFetcher {
@@ -1945,6 +2165,11 @@ declare class CryptographyService {
1945
2165
  init(): Promise<void>;
1946
2166
  /** Encrypt with AES-256-CBC (PKCS7 padding is automatic in Node). */
1947
2167
  encryptAES256(content: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array;
2168
+ /**
2169
+ * Encrypt with AES-256-CBC as a streaming transform.
2170
+ * Returns a ReadableStream that yields encrypted chunks as the input is read.
2171
+ */
2172
+ encryptAES256Stream(input: ReadableStream<Uint8Array>, key: Uint8Array, iv: Uint8Array): ReadableStream<Uint8Array>;
1948
2173
  /** Decrypt with AES-256-CBC. */
1949
2174
  decryptAES256(content: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array;
1950
2175
  /**
@@ -1968,6 +2193,8 @@ declare class CryptographyService {
1968
2193
  encryptKsefToken(token: string, challengeTimestamp: string): Uint8Array;
1969
2194
  /** Compute SHA-256 hash (base64) and byte length. */
1970
2195
  getFileMetadata(file: Uint8Array): FileMetadata;
2196
+ /** Compute SHA-256 hash (base64) and byte length from a ReadableStream. */
2197
+ getFileMetadataFromStream(stream: ReadableStream<Uint8Array>): Promise<FileMetadata>;
1971
2198
  /** Generate an RSA-2048 CSR (PKCS#10, DER) and return it together with the private key PEM. */
1972
2199
  generateCsrRsa(fields: X500NameFields): Promise<CsrResult>;
1973
2200
  /** Generate an ECDSA P-256 CSR (PKCS#10, DER) and return it together with the private key PEM. */
@@ -2005,9 +2232,10 @@ declare class SignatureService {
2005
2232
  * @param xml - The XML document to sign (string).
2006
2233
  * @param certPem - The signing certificate in PEM format.
2007
2234
  * @param privateKeyPem - The private key in PEM format.
2235
+ * @param passphrase - Optional passphrase for encrypted PEM private keys.
2008
2236
  * @returns The signed XML document as a string.
2009
2237
  */
2010
- static sign(xml: string, certPem: string, privateKeyPem: string): string;
2238
+ static sign(xml: string, certPem: string, privateKeyPem: string, passphrase?: string): string;
2011
2239
  }
2012
2240
 
2013
2241
  declare class CertificateService {
@@ -2024,6 +2252,20 @@ declare class Pkcs12Loader {
2024
2252
  static load(p12: Buffer | Uint8Array, password: string): Pkcs12Result;
2025
2253
  }
2026
2254
 
2255
+ interface AuthTokenRequestXmlOptions {
2256
+ challenge: string;
2257
+ contextIdentifier: ContextIdentifier;
2258
+ subjectIdentifierType?: XadesSubjectIdentifierType;
2259
+ }
2260
+ /**
2261
+ * Build an unsigned KSeF auth token request XML document.
2262
+ *
2263
+ * Supports all four context identifier types: Nip, InternalId, NipVatUe, PeppolId.
2264
+ * The returned XML is ready for external signing (e.g. HSM, EPUAP, smart cards)
2265
+ * or can be signed internally via {@link SignatureService.sign}.
2266
+ */
2267
+ declare function buildUnsignedAuthTokenRequestXml(options: AuthTokenRequestXmlOptions): string;
2268
+
2027
2269
  declare class VerificationLinkService {
2028
2270
  private readonly baseQrUrl;
2029
2271
  constructor(baseQrUrl: string);
@@ -2048,6 +2290,89 @@ declare class QrCodeService {
2048
2290
  static generateResult(url: string, options?: QrCodeOptions): Promise<QrCodeResult>;
2049
2291
  }
2050
2292
 
2293
+ interface ZipEntryInput {
2294
+ fileName: string;
2295
+ content: Buffer | Uint8Array;
2296
+ }
2297
+ interface UnzipOptions {
2298
+ maxFiles?: number;
2299
+ maxTotalUncompressedSize?: number;
2300
+ maxFileUncompressedSize?: number;
2301
+ maxCompressionRatio?: number | null;
2302
+ }
2303
+ declare function createZip(entries: ZipEntryInput[]): Promise<Buffer>;
2304
+ declare function unzip(buffer: Buffer, options?: UnzipOptions): Promise<Map<string, Buffer>>;
2305
+
2306
+ interface KSeFTokenContext {
2307
+ type?: string;
2308
+ contextIdentifierType?: string;
2309
+ contextIdentifierValue?: string;
2310
+ authMethod?: string;
2311
+ permissions?: string[];
2312
+ subjectDetails?: Record<string, unknown>;
2313
+ authorSubjectIdentifier?: Record<string, unknown>;
2314
+ issuedAt?: number;
2315
+ expiresAt?: number;
2316
+ }
2317
+ /**
2318
+ * Decodes the payload of a JWT token without verifying its signature.
2319
+ * Intended for display purposes only (e.g., the `whoami` command).
2320
+ */
2321
+ declare function decodeJwtPayload(token: string): Record<string, unknown> | null;
2322
+ declare function parseKSeFTokenContext(token: string): KSeFTokenContext | null;
2323
+
2324
+ type UpoContextId = {
2325
+ kind: 'Nip';
2326
+ nip: string;
2327
+ } | {
2328
+ kind: 'IdWewnetrzny';
2329
+ idWewnetrzny: string;
2330
+ } | {
2331
+ kind: 'IdZlozonyVatUE';
2332
+ idZlozonyVatUE: string;
2333
+ } | {
2334
+ kind: 'IdDostawcyUslugPeppol';
2335
+ idDostawcyUslugPeppol: string;
2336
+ };
2337
+ type UpoAuthProof = {
2338
+ kind: 'NumerReferencyjnyTokenaKSeF';
2339
+ numerReferencyjnyTokenaKSeF: string;
2340
+ } | {
2341
+ kind: 'SkrotDokumentuUwierzytelniajacego';
2342
+ skrotDokumentuUwierzytelniajacego: string;
2343
+ };
2344
+ interface UpoUwierzytelnienie {
2345
+ idKontekstu: UpoContextId;
2346
+ proof: UpoAuthProof;
2347
+ }
2348
+ interface UpoOpisPotwierdzenia {
2349
+ strona: number;
2350
+ liczbaStron: number;
2351
+ zakresDokumentowOd: number;
2352
+ zakresDokumentowDo: number;
2353
+ calkowitaLiczbaDokumentow: number;
2354
+ }
2355
+ interface UpoDokument {
2356
+ nipSprzedawcy: string;
2357
+ numerKSeFDokumentu: string;
2358
+ numerFaktury: string;
2359
+ dataWystawieniaFaktury: string;
2360
+ dataPrzeslaniaDokumentu: string;
2361
+ dataNadaniaNumeruKSeF: string;
2362
+ skrotDokumentu: string;
2363
+ trybWysylki: string;
2364
+ }
2365
+ interface UpoPotwierdzenie {
2366
+ nazwaPodmiotuPrzyjmujacego: string;
2367
+ numerReferencyjnySesji: string;
2368
+ uwierzytelnienie: UpoUwierzytelnienie;
2369
+ opisPotwierdzenia?: UpoOpisPotwierdzenia;
2370
+ nazwaStrukturyLogicznej: string;
2371
+ kodFormularza: string;
2372
+ dokumenty: UpoDokument[];
2373
+ }
2374
+ declare function parseUpoXml(xml: string | Buffer): UpoPotwierdzenie;
2375
+
2051
2376
  interface PollOptions {
2052
2377
  intervalMs?: number;
2053
2378
  maxAttempts?: number;
@@ -2059,6 +2384,7 @@ interface OnlineSessionHandle {
2059
2384
  sendInvoice(invoiceXml: string | Uint8Array): Promise<string>;
2060
2385
  close(): Promise<void>;
2061
2386
  waitForUpo(options?: PollOptions): Promise<UpoInfo>;
2387
+ waitForUpoParsed(options?: PollOptions): Promise<ParsedUpoInfo>;
2062
2388
  }
2063
2389
  interface UpoInfo {
2064
2390
  pages: Array<{
@@ -2069,10 +2395,17 @@ interface UpoInfo {
2069
2395
  successfulInvoiceCount?: number;
2070
2396
  failedInvoiceCount?: number;
2071
2397
  }
2398
+ interface ParsedUpoInfo extends UpoInfo {
2399
+ parsed: UpoPotwierdzenie[];
2400
+ }
2072
2401
  interface BatchUploadResult {
2073
2402
  sessionRef: string;
2074
2403
  upo: UpoInfo;
2075
2404
  }
2405
+ interface ParsedBatchUploadResult {
2406
+ sessionRef: string;
2407
+ upo: ParsedUpoInfo;
2408
+ }
2076
2409
  interface ExportResult {
2077
2410
  parts: Array<{
2078
2411
  ordinalNumber: number;
@@ -2086,10 +2419,14 @@ interface ExportResult {
2086
2419
  invoiceCount: number;
2087
2420
  isTruncated: boolean;
2088
2421
  permanentStorageHwmDate?: string;
2422
+ lastPermanentStorageDate?: string;
2089
2423
  }
2090
2424
  interface ExportDownloadResult extends ExportResult {
2091
2425
  decryptedParts: Uint8Array[];
2092
2426
  }
2427
+ interface ExportExtractedResult extends ExportResult {
2428
+ files: Map<string, Buffer>;
2429
+ }
2093
2430
 
2094
2431
  declare function pollUntil<T>(action: () => Promise<T>, condition: (result: T) => boolean, options?: PollOptions & {
2095
2432
  description?: string;
@@ -2115,7 +2452,7 @@ declare class KSeFClient {
2115
2452
  readonly authManager: AuthManager;
2116
2453
  constructor(options?: KSeFClientOptions);
2117
2454
  loginWithToken(token: string, nip: string): Promise<void>;
2118
- loginWithCertificate(certPem: string, keyPem: string, nip: string): Promise<void>;
2455
+ loginWithCertificate(certPem: string, keyPem: string, nip: string, keyPassword?: string): Promise<void>;
2119
2456
  loginWithPkcs12(p12: Buffer | Uint8Array, password: string, nip: string): Promise<void>;
2120
2457
  private awaitAuthReady;
2121
2458
  logout(): Promise<void>;
@@ -2124,6 +2461,8 @@ declare class KSeFClient {
2124
2461
  interface OpenOnlineSessionOptions {
2125
2462
  formCode?: FormCode;
2126
2463
  upoVersion?: UpoVersion | string;
2464
+ /** Validate invoices against XSD schema before sending. Default: false. */
2465
+ validate?: boolean;
2127
2466
  }
2128
2467
  interface SendAndCloseOptions extends OpenOnlineSessionOptions {
2129
2468
  pollOptions?: PollOptions;
@@ -2142,6 +2481,10 @@ interface BatchUploadOptions {
2142
2481
  }
2143
2482
  declare function uploadBatch(client: KSeFClient, zipData: Uint8Array, options?: BatchUploadOptions): Promise<BatchUploadResult>;
2144
2483
 
2484
+ declare function uploadBatchStream(client: KSeFClient, zipStreamFactory: () => ReadableStream<Uint8Array>, zipSize: number, options?: BatchUploadOptions): Promise<BatchUploadResult>;
2485
+ declare function uploadBatchStreamParsed(client: KSeFClient, zipStreamFactory: () => ReadableStream<Uint8Array>, zipSize: number, options?: BatchUploadOptions): Promise<ParsedBatchUploadResult>;
2486
+ declare function uploadBatchParsed(client: KSeFClient, zipData: Uint8Array, options?: BatchUploadOptions): Promise<ParsedBatchUploadResult>;
2487
+
2145
2488
  interface ExportOptions {
2146
2489
  onlyMetadata?: boolean;
2147
2490
  pollOptions?: PollOptions;
@@ -2149,10 +2492,63 @@ interface ExportOptions {
2149
2492
  interface ExportAndDownloadOptions extends ExportOptions {
2150
2493
  /** Custom fetch function for downloading parts (defaults to global fetch). */
2151
2494
  transport?: typeof fetch;
2495
+ /** When true, concatenate and extract the ZIP, returning named files. */
2496
+ extract?: boolean;
2497
+ /** Options for ZIP extraction safety limits (only used when extract is true). */
2498
+ unzipOptions?: UnzipOptions;
2152
2499
  }
2153
2500
  declare function exportInvoices(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportOptions): Promise<ExportResult>;
2501
+ declare function exportAndDownload(client: KSeFClient, filters: InvoiceQueryFilters, options: ExportAndDownloadOptions & {
2502
+ extract: true;
2503
+ }): Promise<ExportExtractedResult>;
2154
2504
  declare function exportAndDownload(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportAndDownloadOptions): Promise<ExportDownloadResult>;
2155
2505
 
2506
+ type ContinuationPoints = Record<string, string | undefined>;
2507
+ declare function updateContinuationPoint(points: ContinuationPoints, subjectType: string, pkg: Pick<InvoiceExportPackage, 'isTruncated' | 'lastPermanentStorageDate' | 'permanentStorageHwmDate'>): void;
2508
+ declare function getEffectiveStartDate(points: ContinuationPoints, subjectType: string, windowFrom: string): string;
2509
+ declare function deduplicateByKsefNumber<T extends {
2510
+ ksefNumber: string;
2511
+ }>(entries: T[]): T[];
2512
+
2513
+ interface HwmStore {
2514
+ load(): Promise<ContinuationPoints>;
2515
+ save(points: ContinuationPoints): Promise<void>;
2516
+ }
2517
+ declare class InMemoryHwmStore implements HwmStore {
2518
+ private points;
2519
+ load(): Promise<ContinuationPoints>;
2520
+ save(points: ContinuationPoints): Promise<void>;
2521
+ }
2522
+ declare class FileHwmStore implements HwmStore {
2523
+ private readonly filePath;
2524
+ constructor(filePath: string);
2525
+ load(): Promise<ContinuationPoints>;
2526
+ save(points: ContinuationPoints): Promise<void>;
2527
+ }
2528
+
2529
+ interface IncrementalExportOptions {
2530
+ subjectType: InvoiceSubjectType;
2531
+ windowFrom: string;
2532
+ windowTo: string;
2533
+ continuationPoints: ContinuationPoints;
2534
+ maxIterations?: number;
2535
+ filtersFactory?: (from: string, to: string) => InvoiceQueryFilters;
2536
+ pollOptions?: PollOptions;
2537
+ onlyMetadata?: boolean;
2538
+ transport?: typeof fetch;
2539
+ store?: HwmStore;
2540
+ onIterationComplete?: (iteration: number, result: ExportResult) => void;
2541
+ }
2542
+ interface IncrementalExportResult {
2543
+ referenceNumbers: string[];
2544
+ /** Deduplicated invoice metadata. Empty until P3.2 (UPO Parsing) integrates metadata extraction. */
2545
+ invoices: InvoiceMetadata[];
2546
+ decryptedParts: Uint8Array[];
2547
+ continuationPoints: ContinuationPoints;
2548
+ iterationCount: number;
2549
+ }
2550
+ declare function incrementalExportAndDownload(client: KSeFClient, options: IncrementalExportOptions): Promise<IncrementalExportResult>;
2551
+
2156
2552
  interface AuthResult {
2157
2553
  accessToken: string;
2158
2554
  accessTokenValidUntil: string;
@@ -2169,6 +2565,7 @@ interface CertificateAuthOptions {
2169
2565
  nip: string;
2170
2566
  certPem: string;
2171
2567
  keyPem: string;
2568
+ keyPassword?: string;
2172
2569
  verifyCertificateChain?: boolean;
2173
2570
  enforceXadesCompliance?: boolean;
2174
2571
  pollOptions?: PollOptions;
@@ -2183,6 +2580,14 @@ interface Pkcs12AuthOptions {
2183
2580
  }
2184
2581
  declare function authenticateWithToken(client: KSeFClient, options: TokenAuthOptions): Promise<AuthResult>;
2185
2582
  declare function authenticateWithCertificate(client: KSeFClient, options: CertificateAuthOptions): Promise<AuthResult>;
2583
+ interface ExternalSignatureAuthOptions {
2584
+ contextIdentifier: ContextIdentifier;
2585
+ signXml: (unsignedXml: string) => Promise<string> | string;
2586
+ verifyCertificateChain?: boolean;
2587
+ enforceXadesCompliance?: boolean;
2588
+ pollOptions?: PollOptions;
2589
+ }
2590
+ declare function authenticateWithExternalSignature(client: KSeFClient, options: ExternalSignatureAuthOptions): Promise<AuthResult>;
2186
2591
  declare function authenticateWithPkcs12(client: KSeFClient, options: Pkcs12AuthOptions): Promise<AuthResult>;
2187
2592
 
2188
- export { ActiveSessionsService, type AllowedIps, type AmountType, type ApiErrorResponse, type ApiRateLimitValuesOverride, type ApiRateLimitsOverride, type AttachmentPermissionGrantRequest, type AttachmentPermissionRevokeRequest, type AuthChallengeResponse, type AuthKsefTokenRequest, AuthKsefTokenRequestBuilder, type AuthManager, type AuthResult, AuthService, type AuthSessionInfo, type AuthTokenRequest, AuthTokenRequestBuilder, type AuthenticationInitResponse, type AuthenticationKsefToken, type AuthenticationListResponse, type AuthenticationMethod, type AuthenticationMethodInfo, type AuthenticationMethodInfoCategory, type AuthenticationOperationStatusResponse, type AuthenticationTokenRefreshResponse, type AuthenticationTokensResponse, type AuthorizationGrant, AuthorizationPermissionGrantBuilder, type AuthorizationPolicy, BATCH_MAX_PARTS, BATCH_MAX_PART_SIZE, BATCH_MAX_TOTAL_SIZE, Base64String, type BatchFileBuildOptions, type BatchFileBuildResult, BatchFileBuilder, type BatchFileInfo, type BatchFilePartInfo, type BatchPartSendingInfo, type BatchSessionContextLimitsOverride, type BatchSessionEffectiveContextLimits, BatchSessionService, type BatchUploadOptions, type BatchUploadResult, type BlockContextAuthenticationRequest, type BuyerIdentifierType, CERTIFICATE_NAME_MAX_LENGTH, CERTIFICATE_NAME_MIN_LENGTH, CertificateApiService, type CertificateAuthOptions, type CertificateEffectiveSubjectLimits, type CertificateEnrollmentDataResponse, type CertificateEnrollmentStatusResponse, CertificateFetcher, CertificateFingerprint, type CertificateLimit, type CertificateLimitsResponse, type CertificateListItem, CertificateName, type CertificateRevocationReason, CertificateService, type CertificateStatus, type CertificateSubjectIdentifier, type CertificateSubjectIdentifierType, type CertificateSubjectLimitsOverride, type CertificateType, type ContextIdentifier, type ContextIdentifierType, type CryptoEncryptionMethod, CryptographyService, type CsrResult, DefaultAuthManager, ENFORCE_XADES_COMPLIANCE, type EffectiveApiRateLimitValues, type EffectiveApiRateLimits, type EffectiveContextLimits, type EffectiveSubjectLimits, type EncryptionData, type EncryptionInfo, type EnrollCertificateRequest, type EnrollCertificateResponse, type EnrollmentEffectiveSubjectLimits, type EnrollmentSubjectLimitsOverride, type EntityAuthorizationGrant, type EntityAuthorizationPermissionType, type EntityAuthorizationPermissionsSubjectIdentifierType, type EntityAuthorizationSubjectIdentifier, type EntityAuthorizationsAuthorIdentifier, type EntityAuthorizationsAuthorIdentifierType, type EntityAuthorizationsAuthorizedEntityIdentifier, type EntityAuthorizationsAuthorizedEntityIdentifierType, type EntityAuthorizationsAuthorizingEntityIdentifier, type EntityAuthorizationsAuthorizingEntityIdentifierType, type EntityAuthorizationsQueryType, type EntityByFingerprintDetails, type EntityDetails, type EntityPermission, EntityPermissionGrantBuilder, type EntityPermissionItem, type EntityPermissionItemType, type EntityPermissionsContextIdentifier, type EntityPermissionsContextIdentifierType, type EntityRole, type EntityRoleType, type EntityRolesParentEntityIdentifier, type EntityRolesParentEntityIdentifierType, type EntitySubjectByFingerprintDetailsType, type EntitySubjectByIdentifierDetailsType, type EntitySubjectDetailsType, type EntitySubjectIdentifier, Environment, type EnvironmentConfig, type EnvironmentName, type EuEntityAdministrationContextIdentifier, type EuEntityAdministrationPermissionsContextIdentifierType, type EuEntityAdministrationPermissionsSubjectIdentifierType, type EuEntityAdministrationSubjectIdentifier, type EuEntityDetails, type EuEntityPermission, type EuEntityPermissionSubjectDetails, type EuEntityPermissionSubjectDetailsType, type EuEntityPermissionType, type EuEntityPermissionsAuthorIdentifier, type EuEntityPermissionsAuthorIdentifierType, type EuEntityPermissionsQueryPermissionType, type EuEntityPermissionsSubjectIdentifier, type EuEntityPermissionsSubjectIdentifierType, type ExceptionDetails, type ExportAndDownloadOptions, type ExportDownloadResult, type ExportOptions, type ExportResult, type FileMetadata, type ForbiddenProblemDetails, type ForbiddenReasonCode, type FormCode, type FormType, type GrantPermissionsAuthorizationRequest, type GrantPermissionsEntityRequest, type GrantPermissionsEuEntityAdminRequest, type GrantPermissionsEuEntityRepresentativeRequest, type GrantPermissionsEuEntityRequest, type GrantPermissionsIndirectRequest, type GrantPermissionsPersonRequest, type GrantPermissionsSubunitRequest, type HttpMethod, type IdDocument, type IndirectPermissionType, type IndirectPermissionsSubjectIdentifier, type IndirectPermissionsSubjectIdentifierType, type IndirectPermissionsTargetIdentifier, type IndirectPermissionsTargetIdentifierType, InternalId, InvoiceDownloadService, type InvoiceExportPackage, type InvoiceExportPackagePart, type InvoiceExportRequest, type InvoiceExportStatusResponse, type InvoiceMetadata, type InvoiceMetadataAuthorizedSubject, type InvoiceMetadataBuyer, type InvoiceMetadataBuyerIdentifier, type InvoiceMetadataSeller, type InvoiceMetadataThirdSubject, type InvoiceMetadataThirdSubjectIdentifier, type InvoicePermissionType, type InvoiceQueryAmount, type InvoiceQueryBuyerIdentifier, type InvoiceQueryDateRange, type InvoiceQueryDateType, InvoiceQueryFilterBuilder, type InvoiceQueryFilters, type InvoiceStatusInfo, type InvoiceSubjectType, type InvoiceType, type InvoicingMode, Ip4Address, Ip4Mask, Ip4Range, KSEF_FEATURE_HEADER, KSeFApiError, KSeFAuthStatusError, KSeFClient, type KSeFClientOptions, KSeFError, KSeFForbiddenError, KSeFRateLimitError, KSeFSessionExpiredError, KSeFUnauthorizedError, KSeFValidationError, type KsefMessagesResponse, KsefNumber, KsefNumberV35, KsefNumberV36, type KsefStatusResponse, type KsefSystemStatus, type KsefTokenPermissionType, type KsefTokenRequest, type KsefTokenResponse, type KsefTokenStatus, type LighthouseMessage, LighthouseService, LimitsService, Nip, NipVatUe, type OnlineSessionContextLimitsOverride, type OnlineSessionEffectiveContextLimits, type OnlineSessionHandle, OnlineSessionService, type OpenBatchSessionRequest, type OpenBatchSessionResponse, type OpenOnlineSessionOptions, type OpenOnlineSessionRequest, type OpenOnlineSessionResponse, type OperationResponse, type OperationStatusInfo, PERMISSION_DESCRIPTION_MAX_LENGTH, PERMISSION_DESCRIPTION_MIN_LENGTH, type PagedAuthorizationsResponse, type PagedPermissionsResponse, type PagedRolesResponse, type PartUploadRequest, PeppolId, type PeppolProvider, PeppolService, type PermissionState, type PermissionSubjectIdentifierType, type PermissionWithDelegate, type PermissionsAttachmentAllowedResponse, type PermissionsEuEntityDetails, type PermissionsOperationStatusResponse, PermissionsService, type PermissionsSubjectEntityByFingerprintDetails, type PermissionsSubjectEntityByIdentifierDetails, type PermissionsSubjectEntityDetails, type PermissionsSubjectPersonByFingerprintDetails, type PermissionsSubjectPersonDetails, type PersonByFingerprintWithIdentifierDetails, type PersonByFingerprintWithoutIdentifierDetails, type PersonByIdentifierDetails, type PersonCreateRequest, type PersonIdentifier, type PersonIdentifierType, type PersonPermission, PersonPermissionGrantBuilder, type PersonPermissionSubjectDetails, type PersonPermissionType, type PersonPermissionsAuthorIdentifier, type PersonPermissionsAuthorIdentifierType, type PersonPermissionsAuthorizedIdentifier, type PersonPermissionsAuthorizedIdentifierType, type PersonPermissionsContextIdentifier, type PersonPermissionsContextIdentifierType, type PersonPermissionsQueryType, type PersonPermissionsTargetIdentifier, type PersonPermissionsTargetIdentifierType, type PersonRemoveRequest, type PersonSubjectByFingerprintDetailsType, type PersonSubjectDetailsType, type PersonSubjectIdentifier, type PersonalPermission, type PersonalPermissionScopeType, type PersonalPermissionsAuthorizedIdentifier, type PersonalPermissionsAuthorizedIdentifierType, type PersonalPermissionsContextIdentifier, type PersonalPermissionsContextIdentifierType, type PersonalPermissionsTargetIdentifier, type PersonalPermissionsTargetIdentifierType, Pesel, type Pkcs12AuthOptions, Pkcs12Loader, type Pkcs12Result, type PollOptions, type PresignedUrlPolicy, type PublicKeyCertificate, type PublicKeyCertificateUsage, type QRCodeContextIdentifierType, type QrCodeOptions, type QrCodeResult, QrCodeService, type QueryAuthorizationsGrantsRequest, type QueryCertificatesRequest, type QueryCertificatesResponse, type QueryEntitiesGrantsRequest, type QueryEntitiesRolesRequest, type QueryEuEntitiesGrantsRequest, type QueryInvoicesMetadataResponse, type QueryKsefTokensOptions, type QueryKsefTokensResponse, type QueryPeppolProvidersResponse, type QueryPersonalGrantsRequest, type QueryPersonsGrantsRequest, type QuerySubordinateEntitiesRolesRequest, type QuerySubunitsGrantsRequest, type QueryTokensResponseItem, REQUIRED_CHALLENGE_LENGTH, type RateLimitConfig, RateLimitPolicy, ReferenceNumber, type ResolvedOptions, RestClient, RestRequest, type RestResponse, type RetrieveCertificatesListItem, type RetrieveCertificatesRequest, type RetrieveCertificatesResponse, type RetryPolicy, type RevokeCertificateRequest, RouteBuilder, Routes, SUBUNIT_NAME_MAX_LENGTH, SUBUNIT_NAME_MIN_LENGTH, type SelfSignedCertificateResult, type SendAndCloseOptions, type SendInvoiceRequest, type SendInvoiceResponse, type SessionInvoiceStatusResponse, type SessionInvoicesResponse, type SessionStatus, type SessionStatusResponse, SessionStatusService, type SessionType, type SessionsFilter, type SessionsQueryResponse, type SessionsQueryResponseItem, type SetRateLimitsRequest, type SetSessionLimitsRequest, type SetSubjectLimitsRequest, Sha256Base64, SignatureService, type SortOrder, type StatusInfo, type SubjectCreateRequest, type SubjectRemoveRequest, type SubjectType, type SubordinateEntityRole, type SubordinateEntityRoleType, type SubordinateRoleSubordinateEntityIdentifier, type SubordinateRoleSubordinateEntityIdentifierType, type Subunit, type SubunitPermission, type SubunitPermissionScope, type SubunitPermissionsAuthorIdentifier, type SubunitPermissionsAuthorIdentifierType, type SubunitPermissionsAuthorizedIdentifier, type SubunitPermissionsContextIdentifier, type SubunitPermissionsContextIdentifierType, type SubunitPermissionsSubjectIdentifier, type SubunitPermissionsSubjectIdentifierType, type SubunitPermissionsSubunitIdentifier, type SubunitPermissionsSubunitIdentifierType, type TestDataAuthenticationContextIdentifier, type TestDataAuthenticationContextIdentifierType, type TestDataAuthorizedIdentifier, type TestDataAuthorizedIdentifierType, type TestDataContextIdentifier, type TestDataContextIdentifierType, type TestDataPermission, type TestDataPermissionType, type TestDataPermissionsGrantRequest, type TestDataPermissionsRevokeRequest, TestDataService, type ThirdSubjectIdentifierType, type TokenAuthOptions, type TokenAuthorIdentifier, type TokenAuthorIdentifierType, type TokenContextIdentifier, type TokenContextIdentifierType, type TokenInfo, TokenService, type TokenStatusResponse, type TransportFn, type UnauthorizedProblemDetails, type UnblockContextAuthenticationRequest, type UpoInfo, type UpoPage, type UpoResponse, type UpoResult, UpoVersion, UpoVersion as UpoVersionType, type ValidationDetail, VatUe, VerificationLinkService, type X500NameFields, type XadesSubjectIdentifierType, authenticateWithCertificate, authenticateWithPkcs12, authenticateWithToken, calculateBackoff, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, openOnlineSession, openSendAndClose, parseRetryAfter, pollUntil, resolveOptions, sleep, uploadBatch, validatePresignedUrl };
2593
+ export { ActiveSessionsService, type AllowedIps, type AmountType, type ApiErrorResponse, type ApiRateLimitValuesOverride, type ApiRateLimitsOverride, type AttachmentPermissionGrantRequest, type AttachmentPermissionRevokeRequest, type AuthChallengeResponse, type AuthKsefTokenRequest, AuthKsefTokenRequestBuilder, type AuthManager, type AuthResult, AuthService, type AuthSessionInfo, type AuthTokenRequest, AuthTokenRequestBuilder, type AuthTokenRequestXmlOptions, type AuthenticationInitResponse, type AuthenticationKsefToken, type AuthenticationListResponse, type AuthenticationMethod, type AuthenticationMethodInfo, type AuthenticationMethodInfoCategory, type AuthenticationOperationStatusResponse, type AuthenticationTokenRefreshResponse, type AuthenticationTokensResponse, type AuthorizationGrant, AuthorizationPermissionGrantBuilder, type AuthorizationPolicy, BATCH_MAX_PARTS, BATCH_MAX_PART_SIZE, BATCH_MAX_TOTAL_SIZE, Base64String, type BatchFileBuildOptions, type BatchFileBuildResult, BatchFileBuilder, type BatchFileInfo, type BatchFilePartInfo, type BatchPartSendingInfo, type BatchPartStreamSendingInfo, type BatchSessionContextLimitsOverride, type BatchSessionEffectiveContextLimits, type BatchSessionFormCode, BatchSessionService, type BatchStreamBuildResult, type BatchUploadOptions, type BatchUploadResult, type BlockContextAuthenticationRequest, type BuyerIdentifierType, CERTIFICATE_NAME_MAX_LENGTH, CERTIFICATE_NAME_MIN_LENGTH, CertificateApiService, type CertificateAuthOptions, type CertificateEffectiveSubjectLimits, type CertificateEnrollmentDataResponse, type CertificateEnrollmentStatusResponse, CertificateFetcher, CertificateFingerprint, type CertificateLimit, type CertificateLimitsResponse, type CertificateListItem, CertificateName, type CertificateRevocationReason, CertificateService, type CertificateStatus, type CertificateSubjectIdentifier, type CertificateSubjectIdentifierType, type CertificateSubjectLimitsOverride, type CertificateType, type ContextIdentifier, type ContextIdentifierType, type ContinuationPoints, type CryptoEncryptionMethod, CryptographyService, type CsrResult, DEFAULT_FORM_CODE, DefaultAuthManager, ENFORCE_XADES_COMPLIANCE, type EffectiveApiRateLimitValues, type EffectiveApiRateLimits, type EffectiveContextLimits, type EffectiveSubjectLimits, type EncryptionData, type EncryptionInfo, type EnrollCertificateRequest, type EnrollCertificateResponse, type EnrollmentEffectiveSubjectLimits, type EnrollmentSubjectLimitsOverride, type EntityAuthorizationGrant, type EntityAuthorizationPermissionType, type EntityAuthorizationPermissionsSubjectIdentifierType, type EntityAuthorizationSubjectIdentifier, type EntityAuthorizationsAuthorIdentifier, type EntityAuthorizationsAuthorIdentifierType, type EntityAuthorizationsAuthorizedEntityIdentifier, type EntityAuthorizationsAuthorizedEntityIdentifierType, type EntityAuthorizationsAuthorizingEntityIdentifier, type EntityAuthorizationsAuthorizingEntityIdentifierType, type EntityAuthorizationsQueryType, type EntityByFingerprintDetails, type EntityDetails, type EntityPermission, EntityPermissionGrantBuilder, type EntityPermissionItem, type EntityPermissionItemType, type EntityPermissionsContextIdentifier, type EntityPermissionsContextIdentifierType, type EntityRole, type EntityRoleType, type EntityRolesParentEntityIdentifier, type EntityRolesParentEntityIdentifierType, type EntitySubjectByFingerprintDetailsType, type EntitySubjectByIdentifierDetailsType, type EntitySubjectDetailsType, type EntitySubjectIdentifier, Environment, type EnvironmentConfig, type EnvironmentName, type EuEntityAdministrationContextIdentifier, type EuEntityAdministrationPermissionsContextIdentifierType, type EuEntityAdministrationPermissionsSubjectIdentifierType, type EuEntityAdministrationSubjectIdentifier, type EuEntityDetails, type EuEntityPermission, type EuEntityPermissionSubjectDetails, type EuEntityPermissionSubjectDetailsType, type EuEntityPermissionType, type EuEntityPermissionsAuthorIdentifier, type EuEntityPermissionsAuthorIdentifierType, type EuEntityPermissionsQueryPermissionType, type EuEntityPermissionsSubjectIdentifier, type EuEntityPermissionsSubjectIdentifierType, type ExceptionDetails, type ExportAndDownloadOptions, type ExportDownloadResult, type ExportExtractedResult, type ExportOptions, type ExportResult, type ExternalSignatureAuthOptions, FORM_CODES, FORM_CODE_KEYS, FileHwmStore, type FileMetadata, type ForbiddenProblemDetails, type ForbiddenReasonCode, type FormCode, type FormType, type GrantPermissionsAuthorizationRequest, type GrantPermissionsEntityRequest, type GrantPermissionsEuEntityAdminRequest, type GrantPermissionsEuEntityRepresentativeRequest, type GrantPermissionsEuEntityRequest, type GrantPermissionsIndirectRequest, type GrantPermissionsPersonRequest, type GrantPermissionsSubunitRequest, type HttpMethod, type HwmStore, INVOICE_TYPES_BY_SYSTEM_CODE, type IdDocument, InMemoryHwmStore, type IncrementalExportOptions, type IncrementalExportResult, type IndirectPermissionType, type IndirectPermissionsSubjectIdentifier, type IndirectPermissionsSubjectIdentifierType, type IndirectPermissionsTargetIdentifier, type IndirectPermissionsTargetIdentifierType, InternalId, InvoiceDownloadService, type InvoiceExportPackage, type InvoiceExportPackagePart, type InvoiceExportRequest, type InvoiceExportStatusResponse, type InvoiceMetadata, type InvoiceMetadataAuthorizedSubject, type InvoiceMetadataBuyer, type InvoiceMetadataBuyerIdentifier, type InvoiceMetadataSeller, type InvoiceMetadataThirdSubject, type InvoiceMetadataThirdSubjectIdentifier, type InvoicePermissionType, type InvoiceQueryAmount, type InvoiceQueryBuyerIdentifier, type InvoiceQueryDateRange, type InvoiceQueryDateType, InvoiceQueryFilterBuilder, type InvoiceQueryFilters, type InvoiceStatusInfo, type InvoiceSubjectType, type InvoiceType, type InvoiceValidationError, type InvoiceValidationErrorCode, type InvoiceValidationResult, type InvoicingMode, Ip4Address, Ip4Mask, Ip4Range, KSEF_FEATURE_HEADER, KSeFApiError, KSeFAuthStatusError, KSeFClient, type KSeFClientOptions, KSeFError, KSeFForbiddenError, KSeFRateLimitError, KSeFSessionExpiredError, type KSeFTokenContext, KSeFUnauthorizedError, KSeFValidationError, type KsefMessagesResponse, KsefNumber, KsefNumberV35, KsefNumberV36, type KsefStatusResponse, type KsefSystemStatus, type KsefTokenPermissionType, type KsefTokenRequest, type KsefTokenResponse, type KsefTokenStatus, type LighthouseMessage, LighthouseService, LimitsService, Nip, NipVatUe, type OnlineSessionContextLimitsOverride, type OnlineSessionEffectiveContextLimits, type OnlineSessionFormCode, type OnlineSessionHandle, OnlineSessionService, type OpenBatchSessionRequest, type OpenBatchSessionResponse, type OpenOnlineSessionOptions, type OpenOnlineSessionRequest, type OpenOnlineSessionResponse, type OperationResponse, type OperationStatusInfo, PERMISSION_DESCRIPTION_MAX_LENGTH, PERMISSION_DESCRIPTION_MIN_LENGTH, type PagedAuthorizationsResponse, type PagedPermissionsResponse, type PagedRolesResponse, type ParsedBatchUploadResult, type ParsedUpoInfo, type PartUploadRequest, PeppolId, type PeppolProvider, PeppolService, type PermissionState, type PermissionSubjectIdentifierType, type PermissionWithDelegate, type PermissionsAttachmentAllowedResponse, type PermissionsEuEntityDetails, type PermissionsOperationStatusResponse, PermissionsService, type PermissionsSubjectEntityByFingerprintDetails, type PermissionsSubjectEntityByIdentifierDetails, type PermissionsSubjectEntityDetails, type PermissionsSubjectPersonByFingerprintDetails, type PermissionsSubjectPersonDetails, type PersonByFingerprintWithIdentifierDetails, type PersonByFingerprintWithoutIdentifierDetails, type PersonByIdentifierDetails, type PersonCreateRequest, type PersonIdentifier, type PersonIdentifierType, type PersonPermission, PersonPermissionGrantBuilder, type PersonPermissionSubjectDetails, type PersonPermissionType, type PersonPermissionsAuthorIdentifier, type PersonPermissionsAuthorIdentifierType, type PersonPermissionsAuthorizedIdentifier, type PersonPermissionsAuthorizedIdentifierType, type PersonPermissionsContextIdentifier, type PersonPermissionsContextIdentifierType, type PersonPermissionsQueryType, type PersonPermissionsTargetIdentifier, type PersonPermissionsTargetIdentifierType, type PersonRemoveRequest, type PersonSubjectByFingerprintDetailsType, type PersonSubjectDetailsType, type PersonSubjectIdentifier, type PersonalPermission, type PersonalPermissionScopeType, type PersonalPermissionsAuthorizedIdentifier, type PersonalPermissionsAuthorizedIdentifierType, type PersonalPermissionsContextIdentifier, type PersonalPermissionsContextIdentifierType, type PersonalPermissionsTargetIdentifier, type PersonalPermissionsTargetIdentifierType, Pesel, type Pkcs12AuthOptions, Pkcs12Loader, type Pkcs12Result, type PollOptions, type PresignedUrlPolicy, type PublicKeyCertificate, type PublicKeyCertificateUsage, type QRCodeContextIdentifierType, type QrCodeOptions, type QrCodeResult, QrCodeService, type QueryAuthorizationsGrantsRequest, type QueryCertificatesRequest, type QueryCertificatesResponse, type QueryEntitiesGrantsRequest, type QueryEntitiesRolesRequest, type QueryEuEntitiesGrantsRequest, type QueryInvoicesMetadataResponse, type QueryKsefTokensOptions, type QueryKsefTokensResponse, type QueryPeppolProvidersResponse, type QueryPersonalGrantsRequest, type QueryPersonsGrantsRequest, type QuerySubordinateEntitiesRolesRequest, type QuerySubunitsGrantsRequest, type QueryTokensResponseItem, REQUIRED_CHALLENGE_LENGTH, type RateLimitConfig, RateLimitPolicy, ReferenceNumber, type ResolvedOptions, RestClient, RestRequest, type RestResponse, type RetrieveCertificatesListItem, type RetrieveCertificatesRequest, type RetrieveCertificatesResponse, type RetryPolicy, type RevokeCertificateRequest, RouteBuilder, Routes, SUBUNIT_NAME_MAX_LENGTH, SUBUNIT_NAME_MIN_LENGTH, SchemaRegistry, type SelfSignedCertificateResult, type SendAndCloseOptions, type SendInvoiceRequest, type SendInvoiceResponse, type SessionInvoiceStatusResponse, type SessionInvoicesResponse, type SessionStatus, type SessionStatusResponse, SessionStatusService, type SessionType, type SessionsFilter, type SessionsQueryResponse, type SessionsQueryResponseItem, type SetRateLimitsRequest, type SetSessionLimitsRequest, type SetSubjectLimitsRequest, Sha256Base64, SignatureService, type SortOrder, type StatusInfo, type SubjectCreateRequest, type SubjectRemoveRequest, type SubjectType, type SubordinateEntityRole, type SubordinateEntityRoleType, type SubordinateRoleSubordinateEntityIdentifier, type SubordinateRoleSubordinateEntityIdentifierType, type Subunit, type SubunitPermission, type SubunitPermissionScope, type SubunitPermissionsAuthorIdentifier, type SubunitPermissionsAuthorIdentifierType, type SubunitPermissionsAuthorizedIdentifier, type SubunitPermissionsContextIdentifier, type SubunitPermissionsContextIdentifierType, type SubunitPermissionsSubjectIdentifier, type SubunitPermissionsSubjectIdentifierType, type SubunitPermissionsSubunitIdentifier, type SubunitPermissionsSubunitIdentifierType, SystemCode, type TestDataAuthenticationContextIdentifier, type TestDataAuthenticationContextIdentifierType, type TestDataAuthorizedIdentifier, type TestDataAuthorizedIdentifierType, type TestDataContextIdentifier, type TestDataContextIdentifierType, type TestDataPermission, type TestDataPermissionType, type TestDataPermissionsGrantRequest, type TestDataPermissionsRevokeRequest, TestDataService, type ThirdSubjectIdentifierType, type TokenAuthOptions, type TokenAuthorIdentifier, type TokenAuthorIdentifierType, type TokenContextIdentifier, type TokenContextIdentifierType, type TokenInfo, TokenService, type TokenStatusResponse, type TransportFn, type UnauthorizedProblemDetails, type UnblockContextAuthenticationRequest, type UnzipOptions, type UpoAuthProof, type UpoContextId, type UpoDokument, type UpoInfo, type UpoOpisPotwierdzenia, type UpoPage, type UpoPotwierdzenie, type UpoResponse, type UpoResult, type UpoUwierzytelnienie, UpoVersion, UpoVersion as UpoVersionType, type ValidateOptions, type ValidationDetail, VatUe, VerificationLinkService, type X500NameFields, type XadesSubjectIdentifierType, type XmlConversionResult, type ZipEntryInput, authenticateWithCertificate, authenticateWithExternalSignature, authenticateWithPkcs12, authenticateWithToken, buildUnsignedAuthTokenRequestXml, calculateBackoff, createZip, decodeJwtPayload, deduplicateByKsefNumber, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, getEffectiveStartDate, getFormCode, incrementalExportAndDownload, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, openOnlineSession, openSendAndClose, parseFormCode, parseKSeFTokenContext, parseRetryAfter, parseUpoXml, pollUntil, resolveOptions, sleep, unzip, updateContinuationPoint, uploadBatch, uploadBatchParsed, uploadBatchStream, uploadBatchStreamParsed, validate, validateBusinessRules, validateFormCodeForSession, validatePresignedUrl, validateSchema, validateWellFormedness, xmlToObject };