ksef-client-ts 0.6.0 → 0.6.1

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.cts CHANGED
@@ -845,6 +845,37 @@ interface UpoResult {
845
845
  hash?: string;
846
846
  }
847
847
 
848
+ /**
849
+ * Serializable state of an online session. All binary data is Base64-encoded.
850
+ *
851
+ * **Security:** contains AES encryption keys in plaintext. Treat serialized
852
+ * state as sensitive data — encrypt at rest or store in a secure vault.
853
+ */
854
+ interface OnlineSessionState {
855
+ referenceNumber: string;
856
+ /** AES-256 cipher key, Base64-encoded. */
857
+ aesKey: string;
858
+ /** AES-256 initialization vector, Base64-encoded. */
859
+ iv: string;
860
+ accessToken: string;
861
+ formCode: FormCode;
862
+ /** Session expiration time, ISO 8601. */
863
+ validUntil: string;
864
+ /** Whether invoices are validated against XSD before sending. */
865
+ validate?: boolean;
866
+ }
867
+ /** Serializable state of a batch session. */
868
+ interface BatchSessionState {
869
+ referenceNumber: string;
870
+ /** AES-256 cipher key, Base64-encoded. */
871
+ aesKey: string;
872
+ /** AES-256 initialization vector, Base64-encoded. */
873
+ iv: string;
874
+ accessToken: string;
875
+ formCode: FormCode;
876
+ partUploadRequests: PartUploadRequest[];
877
+ }
878
+
848
879
  /**
849
880
  * Invoice subject type — defines the taxpayer's role in the invoice.
850
881
  * - `Subject1` — seller (invoices issued by us)
@@ -944,6 +975,11 @@ interface QueryInvoicesMetadataResponse {
944
975
  invoices: InvoiceMetadata[];
945
976
  permanentStorageHwmDate?: string;
946
977
  }
978
+ interface InvoiceResult {
979
+ xml: string;
980
+ /** SHA-256 base64 hash from the `x-ms-meta-hash` response header, if present. */
981
+ hash?: string;
982
+ }
947
983
  interface InvoiceExportRequest {
948
984
  encryption: EncryptionInfo;
949
985
  filters: InvoiceQueryFilters;
@@ -1883,13 +1919,13 @@ declare class BatchSessionService {
1883
1919
  private readonly restClient;
1884
1920
  constructor(restClient: RestClient);
1885
1921
  openSession(request: OpenBatchSessionRequest, upoVersion?: UpoVersion | string): Promise<OpenBatchSessionResponse>;
1886
- sendParts(openResponse: OpenBatchSessionResponse, parts: BatchPartSendingInfo[]): Promise<void>;
1922
+ sendParts(openResponse: OpenBatchSessionResponse, parts: BatchPartSendingInfo[], parallelism?: number): Promise<void>;
1887
1923
  /**
1888
- * Upload parts sequentially (not in parallel) because each part uses a
1889
- * streaming body (`duplex: 'half'`). Parallel streaming uploads can cause
1890
- * backpressure issues and exceed memory limits for large payloads.
1924
+ * Upload parts using streaming bodies (`duplex: 'half'`).
1925
+ * By default uploads sequentially to avoid backpressure issues.
1926
+ * Pass `parallelism` to enable bounded concurrent uploads.
1891
1927
  */
1892
- sendPartsWithStream(openResponse: OpenBatchSessionResponse, parts: BatchPartStreamSendingInfo[]): Promise<void>;
1928
+ sendPartsWithStream(openResponse: OpenBatchSessionResponse, parts: BatchPartStreamSendingInfo[], parallelism?: number): Promise<void>;
1893
1929
  closeSession(batchRef: string): Promise<void>;
1894
1930
  }
1895
1931
 
@@ -1909,7 +1945,7 @@ declare class SessionStatusService {
1909
1945
  declare class InvoiceDownloadService {
1910
1946
  private readonly restClient;
1911
1947
  constructor(restClient: RestClient);
1912
- getInvoice(ksefNumber: string): Promise<string>;
1948
+ getInvoice(ksefNumber: string): Promise<InvoiceResult>;
1913
1949
  queryInvoiceMetadata(filters: InvoiceQueryFilters, pageOffset?: number, pageSize?: number, sortOrder?: SortOrder): Promise<QueryInvoicesMetadataResponse>;
1914
1950
  exportInvoices(request: InvoiceExportRequest): Promise<OperationResponse>;
1915
1951
  getInvoiceExportStatus(ref: string): Promise<InvoiceExportStatusResponse>;
@@ -2344,6 +2380,26 @@ interface KSeFTokenContext {
2344
2380
  declare function decodeJwtPayload(token: string): Record<string, unknown> | null;
2345
2381
  declare function parseKSeFTokenContext(token: string): KSeFTokenContext | null;
2346
2382
 
2383
+ /** Compute SHA-256 hash of data, returned as base64 string. */
2384
+ declare function sha256Base64(data: Uint8Array): string;
2385
+ /** Returns true if SHA-256 base64 of `data` matches `expectedHash`. */
2386
+ declare function verifyHash(data: Uint8Array, expectedHash: string): boolean;
2387
+
2388
+ /**
2389
+ * Execute async tasks with bounded concurrency using a worker-pool pattern.
2390
+ *
2391
+ * Creates `parallelism` workers that pull from a shared task queue.
2392
+ * Safe in single-threaded JS — index read+increment is atomic between await points.
2393
+ *
2394
+ * On first failure the shared AbortController is triggered so that:
2395
+ * 1. No new tasks are dequeued.
2396
+ * 2. In-flight tasks receive the abort signal (e.g. to cancel fetch requests).
2397
+ *
2398
+ * @param tasks - Array of async thunks that receive an AbortSignal
2399
+ * @param parallelism - Maximum number of concurrent workers (clamped to [1, tasks.length])
2400
+ */
2401
+ declare function runWithConcurrency(tasks: Array<(signal: AbortSignal) => Promise<void>>, parallelism: number): Promise<void>;
2402
+
2347
2403
  type UpoContextId = {
2348
2404
  kind: 'Nip';
2349
2405
  nip: string;
@@ -2421,6 +2477,8 @@ interface OnlineSessionHandle {
2421
2477
  close(): Promise<void>;
2422
2478
  waitForUpo(options?: PollOptions): Promise<UpoInfo>;
2423
2479
  waitForUpoParsed(options?: PollOptions): Promise<ParsedUpoInfo>;
2480
+ /** Serialize session state for persistence. Restore with `resumeOnlineSession()`. */
2481
+ getState(): OnlineSessionState;
2424
2482
  }
2425
2483
  interface UpoInfo {
2426
2484
  pages: Array<{
@@ -2448,6 +2506,7 @@ interface ExportResult {
2448
2506
  url: string;
2449
2507
  method: string;
2450
2508
  partSize: number;
2509
+ partHash: string;
2451
2510
  encryptedPartSize: number;
2452
2511
  encryptedPartHash: string;
2453
2512
  expirationDate: string;
@@ -2620,9 +2679,12 @@ declare class KSeFClient {
2620
2679
  readonly qr: VerificationLinkService;
2621
2680
  readonly options: ResolvedOptions;
2622
2681
  readonly authManager: AuthManager;
2682
+ private readonly _baseRestClientConfig;
2623
2683
  private _offline?;
2624
2684
  constructor(options?: KSeFClientOptions);
2625
2685
  get offline(): OfflineInvoiceWorkflow;
2686
+ /** @internal Create a RestClient with a different AuthManager, preserving transport/retry/rateLimit config. */
2687
+ createScopedRestClient(authManager: AuthManager): RestClient;
2626
2688
  loginWithToken(token: string, nip: string): Promise<void>;
2627
2689
  loginWithCertificate(certPem: string, keyPem: string, nip: string, keyPassword?: string): Promise<void>;
2628
2690
  loginWithPkcs12(p12: Buffer | Uint8Array, password: string, nip: string): Promise<void>;
@@ -2640,6 +2702,7 @@ interface SendAndCloseOptions extends OpenOnlineSessionOptions {
2640
2702
  pollOptions?: PollOptions;
2641
2703
  }
2642
2704
  declare function openOnlineSession(client: KSeFClient, options?: OpenOnlineSessionOptions): Promise<OnlineSessionHandle>;
2705
+ declare function resumeOnlineSession(client: KSeFClient, state: OnlineSessionState, options?: Pick<OpenOnlineSessionOptions, 'validate'>): OnlineSessionHandle;
2643
2706
  declare function openSendAndClose(client: KSeFClient, invoices: Array<string | Uint8Array>, options?: SendAndCloseOptions): Promise<UpoInfo>;
2644
2707
 
2645
2708
  interface BatchUploadOptions {
@@ -2652,6 +2715,8 @@ interface BatchUploadOptions {
2652
2715
  offlineMode?: boolean;
2653
2716
  /** Validate each invoice XML in the ZIP before uploading. */
2654
2717
  validate?: boolean;
2718
+ /** Number of concurrent part uploads. Omit for default behavior (buffer: all parallel, stream: sequential). */
2719
+ parallelism?: number;
2655
2720
  }
2656
2721
  declare function uploadBatch(client: KSeFClient, zipData: Uint8Array, options?: BatchUploadOptions): Promise<BatchUploadResult>;
2657
2722
 
@@ -2670,6 +2735,8 @@ interface ExportAndDownloadOptions extends ExportOptions {
2670
2735
  extract?: boolean;
2671
2736
  /** Options for ZIP extraction safety limits (only used when extract is true). */
2672
2737
  unzipOptions?: UnzipOptions;
2738
+ /** Verify SHA-256 hash of encrypted parts after download. Defaults to true. */
2739
+ verifyHash?: boolean;
2673
2740
  }
2674
2741
  declare function exportInvoices(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportOptions): Promise<ExportResult>;
2675
2742
  declare function exportAndDownload(client: KSeFClient, filters: InvoiceQueryFilters, options: ExportAndDownloadOptions & {
@@ -2710,6 +2777,8 @@ interface IncrementalExportOptions {
2710
2777
  pollOptions?: PollOptions;
2711
2778
  onlyMetadata?: boolean;
2712
2779
  transport?: typeof fetch;
2780
+ /** Verify SHA-256 hash of encrypted parts after download. Defaults to true. */
2781
+ verifyHash?: boolean;
2713
2782
  store?: HwmStore;
2714
2783
  onIterationComplete?: (iteration: number, result: ExportResult) => void;
2715
2784
  }
@@ -2794,6 +2863,39 @@ declare function extendDeadlineForMaintenance(currentDeadline: Date | string, ma
2794
2863
  declare function isExpired(submitBy: Date | string): boolean;
2795
2864
  declare function getTimeUntilDeadline(submitBy: Date | string): number;
2796
2865
 
2866
+ /**
2867
+ * Get all Polish statutory holidays for a given year.
2868
+ * Returns a Set of ISO date strings ('YYYY-MM-DD').
2869
+ *
2870
+ * Source: Ustawa z dnia 18 stycznia 1951 r. o dniach wolnych od pracy
2871
+ * (Dz.U. z 2025 r., poz. 296)
2872
+ *
2873
+ * Fixed holidays:
2874
+ * Jan 1 — Nowy Rok
2875
+ * Jan 6 — Święto Trzech Króli (Epiphany)
2876
+ * May 1 — Święto Państwowe
2877
+ * May 3 — Święto Narodowe Trzeciego Maja
2878
+ * Aug 15 — Wniebowzięcie NMP
2879
+ * Nov 1 — Wszystkich Świętych
2880
+ * Nov 11 — Narodowe Święto Niepodległości
2881
+ * Dec 24 — Wigilia Bożego Narodzenia (since 2025, Dz.U. 2024 poz. 1965)
2882
+ * Dec 25 — Boże Narodzenie (1st day)
2883
+ * Dec 26 — Boże Narodzenie (2nd day)
2884
+ *
2885
+ * Moveable holidays (Easter-based):
2886
+ * Easter Sunday — Wielkanoc
2887
+ * Easter Monday — Poniedziałek Wielkanocny (Easter + 1)
2888
+ * Pentecost Sunday — Zielone Świątki (Easter + 49, always Sunday)
2889
+ * Corpus Christi — Boże Ciało (Easter + 60)
2890
+ *
2891
+ * Count: 14 (year >= 2025), 13 (year <= 2024)
2892
+ */
2893
+ declare function getPolishHolidays(year: number): ReadonlySet<string>;
2894
+ /**
2895
+ * Check if a UTC date falls on a Polish statutory holiday.
2896
+ */
2897
+ declare function isPolishHoliday(date: Date): boolean;
2898
+
2797
2899
  declare class FileOfflineInvoiceStorage implements OfflineInvoiceStorage {
2798
2900
  private readonly dir;
2799
2901
  constructor(directory?: string);
@@ -2813,4 +2915,4 @@ declare class FileOfflineInvoiceStorage implements OfflineInvoiceStorage {
2813
2915
  delete(id: string): Promise<void>;
2814
2916
  }
2815
2917
 
2816
- 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 BatchValidationResult, 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, FileOfflineInvoiceStorage, 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, InMemoryOfflineInvoiceStorage, 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 InvoiceFields, 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, type MaintenanceWindow, Nip, NipVatUe, type OfflineBatchResult, type OfflineCertificate, type OfflineInvoiceFilter, type OfflineInvoiceInputData, type OfflineInvoiceMetadata, type OfflineInvoiceOptions, type OfflineInvoiceStatus, type OfflineInvoiceStorage, type OfflineInvoiceUpdates, OfflineInvoiceWorkflow, type OfflineMode, type OfflineReason, type OfflineSubmissionResult, 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 SubmitOfflineInvoicesOptions, 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 TechnicalCorrectionOptions, 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, addBusinessDays, authenticateWithCertificate, authenticateWithExternalSignature, authenticateWithPkcs12, authenticateWithToken, batchValidationDetails, buildUnsignedAuthTokenRequestXml, calculateBackoff, calculateOfflineDeadline, createZip, decodeJwtPayload, deduplicateByKsefNumber, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, extendDeadlineForMaintenance, extractInvoiceFields, getDefaultReason, getEffectiveStartDate, getFormCode, getTimeUntilDeadline, incrementalExportAndDownload, isExpired, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, nextBusinessDay, openOnlineSession, openSendAndClose, parseFormCode, parseKSeFTokenContext, parseRetryAfter, parseUpoXml, pollUntil, resolveOptions, sleep, unzip, updateContinuationPoint, uploadBatch, uploadBatchParsed, uploadBatchStream, uploadBatchStreamParsed, validate, validateBatch, validateBusinessRules, validateFormCodeForSession, validatePresignedUrl, validateSchema, validateWellFormedness, xmlToObject };
2918
+ 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 BatchSessionState, type BatchStreamBuildResult, type BatchUploadOptions, type BatchUploadResult, type BatchValidationResult, 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, FileOfflineInvoiceStorage, 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, InMemoryOfflineInvoiceStorage, 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 InvoiceFields, 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 InvoiceResult, 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, type MaintenanceWindow, Nip, NipVatUe, type OfflineBatchResult, type OfflineCertificate, type OfflineInvoiceFilter, type OfflineInvoiceInputData, type OfflineInvoiceMetadata, type OfflineInvoiceOptions, type OfflineInvoiceStatus, type OfflineInvoiceStorage, type OfflineInvoiceUpdates, OfflineInvoiceWorkflow, type OfflineMode, type OfflineReason, type OfflineSubmissionResult, type OnlineSessionContextLimitsOverride, type OnlineSessionEffectiveContextLimits, type OnlineSessionFormCode, type OnlineSessionHandle, OnlineSessionService, type OnlineSessionState, 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 SubmitOfflineInvoicesOptions, 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 TechnicalCorrectionOptions, 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, addBusinessDays, authenticateWithCertificate, authenticateWithExternalSignature, authenticateWithPkcs12, authenticateWithToken, batchValidationDetails, buildUnsignedAuthTokenRequestXml, calculateBackoff, calculateOfflineDeadline, createZip, decodeJwtPayload, deduplicateByKsefNumber, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, extendDeadlineForMaintenance, extractInvoiceFields, getDefaultReason, getEffectiveStartDate, getFormCode, getPolishHolidays, getTimeUntilDeadline, incrementalExportAndDownload, isExpired, isPolishHoliday, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, nextBusinessDay, openOnlineSession, openSendAndClose, parseFormCode, parseKSeFTokenContext, parseRetryAfter, parseUpoXml, pollUntil, resolveOptions, resumeOnlineSession, runWithConcurrency, sha256Base64, sleep, unzip, updateContinuationPoint, uploadBatch, uploadBatchParsed, uploadBatchStream, uploadBatchStreamParsed, validate, validateBatch, validateBusinessRules, validateFormCodeForSession, validatePresignedUrl, validateSchema, validateWellFormedness, verifyHash, xmlToObject };
package/dist/index.d.ts CHANGED
@@ -845,6 +845,37 @@ interface UpoResult {
845
845
  hash?: string;
846
846
  }
847
847
 
848
+ /**
849
+ * Serializable state of an online session. All binary data is Base64-encoded.
850
+ *
851
+ * **Security:** contains AES encryption keys in plaintext. Treat serialized
852
+ * state as sensitive data — encrypt at rest or store in a secure vault.
853
+ */
854
+ interface OnlineSessionState {
855
+ referenceNumber: string;
856
+ /** AES-256 cipher key, Base64-encoded. */
857
+ aesKey: string;
858
+ /** AES-256 initialization vector, Base64-encoded. */
859
+ iv: string;
860
+ accessToken: string;
861
+ formCode: FormCode;
862
+ /** Session expiration time, ISO 8601. */
863
+ validUntil: string;
864
+ /** Whether invoices are validated against XSD before sending. */
865
+ validate?: boolean;
866
+ }
867
+ /** Serializable state of a batch session. */
868
+ interface BatchSessionState {
869
+ referenceNumber: string;
870
+ /** AES-256 cipher key, Base64-encoded. */
871
+ aesKey: string;
872
+ /** AES-256 initialization vector, Base64-encoded. */
873
+ iv: string;
874
+ accessToken: string;
875
+ formCode: FormCode;
876
+ partUploadRequests: PartUploadRequest[];
877
+ }
878
+
848
879
  /**
849
880
  * Invoice subject type — defines the taxpayer's role in the invoice.
850
881
  * - `Subject1` — seller (invoices issued by us)
@@ -944,6 +975,11 @@ interface QueryInvoicesMetadataResponse {
944
975
  invoices: InvoiceMetadata[];
945
976
  permanentStorageHwmDate?: string;
946
977
  }
978
+ interface InvoiceResult {
979
+ xml: string;
980
+ /** SHA-256 base64 hash from the `x-ms-meta-hash` response header, if present. */
981
+ hash?: string;
982
+ }
947
983
  interface InvoiceExportRequest {
948
984
  encryption: EncryptionInfo;
949
985
  filters: InvoiceQueryFilters;
@@ -1883,13 +1919,13 @@ declare class BatchSessionService {
1883
1919
  private readonly restClient;
1884
1920
  constructor(restClient: RestClient);
1885
1921
  openSession(request: OpenBatchSessionRequest, upoVersion?: UpoVersion | string): Promise<OpenBatchSessionResponse>;
1886
- sendParts(openResponse: OpenBatchSessionResponse, parts: BatchPartSendingInfo[]): Promise<void>;
1922
+ sendParts(openResponse: OpenBatchSessionResponse, parts: BatchPartSendingInfo[], parallelism?: number): Promise<void>;
1887
1923
  /**
1888
- * Upload parts sequentially (not in parallel) because each part uses a
1889
- * streaming body (`duplex: 'half'`). Parallel streaming uploads can cause
1890
- * backpressure issues and exceed memory limits for large payloads.
1924
+ * Upload parts using streaming bodies (`duplex: 'half'`).
1925
+ * By default uploads sequentially to avoid backpressure issues.
1926
+ * Pass `parallelism` to enable bounded concurrent uploads.
1891
1927
  */
1892
- sendPartsWithStream(openResponse: OpenBatchSessionResponse, parts: BatchPartStreamSendingInfo[]): Promise<void>;
1928
+ sendPartsWithStream(openResponse: OpenBatchSessionResponse, parts: BatchPartStreamSendingInfo[], parallelism?: number): Promise<void>;
1893
1929
  closeSession(batchRef: string): Promise<void>;
1894
1930
  }
1895
1931
 
@@ -1909,7 +1945,7 @@ declare class SessionStatusService {
1909
1945
  declare class InvoiceDownloadService {
1910
1946
  private readonly restClient;
1911
1947
  constructor(restClient: RestClient);
1912
- getInvoice(ksefNumber: string): Promise<string>;
1948
+ getInvoice(ksefNumber: string): Promise<InvoiceResult>;
1913
1949
  queryInvoiceMetadata(filters: InvoiceQueryFilters, pageOffset?: number, pageSize?: number, sortOrder?: SortOrder): Promise<QueryInvoicesMetadataResponse>;
1914
1950
  exportInvoices(request: InvoiceExportRequest): Promise<OperationResponse>;
1915
1951
  getInvoiceExportStatus(ref: string): Promise<InvoiceExportStatusResponse>;
@@ -2344,6 +2380,26 @@ interface KSeFTokenContext {
2344
2380
  declare function decodeJwtPayload(token: string): Record<string, unknown> | null;
2345
2381
  declare function parseKSeFTokenContext(token: string): KSeFTokenContext | null;
2346
2382
 
2383
+ /** Compute SHA-256 hash of data, returned as base64 string. */
2384
+ declare function sha256Base64(data: Uint8Array): string;
2385
+ /** Returns true if SHA-256 base64 of `data` matches `expectedHash`. */
2386
+ declare function verifyHash(data: Uint8Array, expectedHash: string): boolean;
2387
+
2388
+ /**
2389
+ * Execute async tasks with bounded concurrency using a worker-pool pattern.
2390
+ *
2391
+ * Creates `parallelism` workers that pull from a shared task queue.
2392
+ * Safe in single-threaded JS — index read+increment is atomic between await points.
2393
+ *
2394
+ * On first failure the shared AbortController is triggered so that:
2395
+ * 1. No new tasks are dequeued.
2396
+ * 2. In-flight tasks receive the abort signal (e.g. to cancel fetch requests).
2397
+ *
2398
+ * @param tasks - Array of async thunks that receive an AbortSignal
2399
+ * @param parallelism - Maximum number of concurrent workers (clamped to [1, tasks.length])
2400
+ */
2401
+ declare function runWithConcurrency(tasks: Array<(signal: AbortSignal) => Promise<void>>, parallelism: number): Promise<void>;
2402
+
2347
2403
  type UpoContextId = {
2348
2404
  kind: 'Nip';
2349
2405
  nip: string;
@@ -2421,6 +2477,8 @@ interface OnlineSessionHandle {
2421
2477
  close(): Promise<void>;
2422
2478
  waitForUpo(options?: PollOptions): Promise<UpoInfo>;
2423
2479
  waitForUpoParsed(options?: PollOptions): Promise<ParsedUpoInfo>;
2480
+ /** Serialize session state for persistence. Restore with `resumeOnlineSession()`. */
2481
+ getState(): OnlineSessionState;
2424
2482
  }
2425
2483
  interface UpoInfo {
2426
2484
  pages: Array<{
@@ -2448,6 +2506,7 @@ interface ExportResult {
2448
2506
  url: string;
2449
2507
  method: string;
2450
2508
  partSize: number;
2509
+ partHash: string;
2451
2510
  encryptedPartSize: number;
2452
2511
  encryptedPartHash: string;
2453
2512
  expirationDate: string;
@@ -2620,9 +2679,12 @@ declare class KSeFClient {
2620
2679
  readonly qr: VerificationLinkService;
2621
2680
  readonly options: ResolvedOptions;
2622
2681
  readonly authManager: AuthManager;
2682
+ private readonly _baseRestClientConfig;
2623
2683
  private _offline?;
2624
2684
  constructor(options?: KSeFClientOptions);
2625
2685
  get offline(): OfflineInvoiceWorkflow;
2686
+ /** @internal Create a RestClient with a different AuthManager, preserving transport/retry/rateLimit config. */
2687
+ createScopedRestClient(authManager: AuthManager): RestClient;
2626
2688
  loginWithToken(token: string, nip: string): Promise<void>;
2627
2689
  loginWithCertificate(certPem: string, keyPem: string, nip: string, keyPassword?: string): Promise<void>;
2628
2690
  loginWithPkcs12(p12: Buffer | Uint8Array, password: string, nip: string): Promise<void>;
@@ -2640,6 +2702,7 @@ interface SendAndCloseOptions extends OpenOnlineSessionOptions {
2640
2702
  pollOptions?: PollOptions;
2641
2703
  }
2642
2704
  declare function openOnlineSession(client: KSeFClient, options?: OpenOnlineSessionOptions): Promise<OnlineSessionHandle>;
2705
+ declare function resumeOnlineSession(client: KSeFClient, state: OnlineSessionState, options?: Pick<OpenOnlineSessionOptions, 'validate'>): OnlineSessionHandle;
2643
2706
  declare function openSendAndClose(client: KSeFClient, invoices: Array<string | Uint8Array>, options?: SendAndCloseOptions): Promise<UpoInfo>;
2644
2707
 
2645
2708
  interface BatchUploadOptions {
@@ -2652,6 +2715,8 @@ interface BatchUploadOptions {
2652
2715
  offlineMode?: boolean;
2653
2716
  /** Validate each invoice XML in the ZIP before uploading. */
2654
2717
  validate?: boolean;
2718
+ /** Number of concurrent part uploads. Omit for default behavior (buffer: all parallel, stream: sequential). */
2719
+ parallelism?: number;
2655
2720
  }
2656
2721
  declare function uploadBatch(client: KSeFClient, zipData: Uint8Array, options?: BatchUploadOptions): Promise<BatchUploadResult>;
2657
2722
 
@@ -2670,6 +2735,8 @@ interface ExportAndDownloadOptions extends ExportOptions {
2670
2735
  extract?: boolean;
2671
2736
  /** Options for ZIP extraction safety limits (only used when extract is true). */
2672
2737
  unzipOptions?: UnzipOptions;
2738
+ /** Verify SHA-256 hash of encrypted parts after download. Defaults to true. */
2739
+ verifyHash?: boolean;
2673
2740
  }
2674
2741
  declare function exportInvoices(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportOptions): Promise<ExportResult>;
2675
2742
  declare function exportAndDownload(client: KSeFClient, filters: InvoiceQueryFilters, options: ExportAndDownloadOptions & {
@@ -2710,6 +2777,8 @@ interface IncrementalExportOptions {
2710
2777
  pollOptions?: PollOptions;
2711
2778
  onlyMetadata?: boolean;
2712
2779
  transport?: typeof fetch;
2780
+ /** Verify SHA-256 hash of encrypted parts after download. Defaults to true. */
2781
+ verifyHash?: boolean;
2713
2782
  store?: HwmStore;
2714
2783
  onIterationComplete?: (iteration: number, result: ExportResult) => void;
2715
2784
  }
@@ -2794,6 +2863,39 @@ declare function extendDeadlineForMaintenance(currentDeadline: Date | string, ma
2794
2863
  declare function isExpired(submitBy: Date | string): boolean;
2795
2864
  declare function getTimeUntilDeadline(submitBy: Date | string): number;
2796
2865
 
2866
+ /**
2867
+ * Get all Polish statutory holidays for a given year.
2868
+ * Returns a Set of ISO date strings ('YYYY-MM-DD').
2869
+ *
2870
+ * Source: Ustawa z dnia 18 stycznia 1951 r. o dniach wolnych od pracy
2871
+ * (Dz.U. z 2025 r., poz. 296)
2872
+ *
2873
+ * Fixed holidays:
2874
+ * Jan 1 — Nowy Rok
2875
+ * Jan 6 — Święto Trzech Króli (Epiphany)
2876
+ * May 1 — Święto Państwowe
2877
+ * May 3 — Święto Narodowe Trzeciego Maja
2878
+ * Aug 15 — Wniebowzięcie NMP
2879
+ * Nov 1 — Wszystkich Świętych
2880
+ * Nov 11 — Narodowe Święto Niepodległości
2881
+ * Dec 24 — Wigilia Bożego Narodzenia (since 2025, Dz.U. 2024 poz. 1965)
2882
+ * Dec 25 — Boże Narodzenie (1st day)
2883
+ * Dec 26 — Boże Narodzenie (2nd day)
2884
+ *
2885
+ * Moveable holidays (Easter-based):
2886
+ * Easter Sunday — Wielkanoc
2887
+ * Easter Monday — Poniedziałek Wielkanocny (Easter + 1)
2888
+ * Pentecost Sunday — Zielone Świątki (Easter + 49, always Sunday)
2889
+ * Corpus Christi — Boże Ciało (Easter + 60)
2890
+ *
2891
+ * Count: 14 (year >= 2025), 13 (year <= 2024)
2892
+ */
2893
+ declare function getPolishHolidays(year: number): ReadonlySet<string>;
2894
+ /**
2895
+ * Check if a UTC date falls on a Polish statutory holiday.
2896
+ */
2897
+ declare function isPolishHoliday(date: Date): boolean;
2898
+
2797
2899
  declare class FileOfflineInvoiceStorage implements OfflineInvoiceStorage {
2798
2900
  private readonly dir;
2799
2901
  constructor(directory?: string);
@@ -2813,4 +2915,4 @@ declare class FileOfflineInvoiceStorage implements OfflineInvoiceStorage {
2813
2915
  delete(id: string): Promise<void>;
2814
2916
  }
2815
2917
 
2816
- 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 BatchValidationResult, 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, FileOfflineInvoiceStorage, 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, InMemoryOfflineInvoiceStorage, 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 InvoiceFields, 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, type MaintenanceWindow, Nip, NipVatUe, type OfflineBatchResult, type OfflineCertificate, type OfflineInvoiceFilter, type OfflineInvoiceInputData, type OfflineInvoiceMetadata, type OfflineInvoiceOptions, type OfflineInvoiceStatus, type OfflineInvoiceStorage, type OfflineInvoiceUpdates, OfflineInvoiceWorkflow, type OfflineMode, type OfflineReason, type OfflineSubmissionResult, 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 SubmitOfflineInvoicesOptions, 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 TechnicalCorrectionOptions, 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, addBusinessDays, authenticateWithCertificate, authenticateWithExternalSignature, authenticateWithPkcs12, authenticateWithToken, batchValidationDetails, buildUnsignedAuthTokenRequestXml, calculateBackoff, calculateOfflineDeadline, createZip, decodeJwtPayload, deduplicateByKsefNumber, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, extendDeadlineForMaintenance, extractInvoiceFields, getDefaultReason, getEffectiveStartDate, getFormCode, getTimeUntilDeadline, incrementalExportAndDownload, isExpired, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, nextBusinessDay, openOnlineSession, openSendAndClose, parseFormCode, parseKSeFTokenContext, parseRetryAfter, parseUpoXml, pollUntil, resolveOptions, sleep, unzip, updateContinuationPoint, uploadBatch, uploadBatchParsed, uploadBatchStream, uploadBatchStreamParsed, validate, validateBatch, validateBusinessRules, validateFormCodeForSession, validatePresignedUrl, validateSchema, validateWellFormedness, xmlToObject };
2918
+ 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 BatchSessionState, type BatchStreamBuildResult, type BatchUploadOptions, type BatchUploadResult, type BatchValidationResult, 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, FileOfflineInvoiceStorage, 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, InMemoryOfflineInvoiceStorage, 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 InvoiceFields, 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 InvoiceResult, 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, type MaintenanceWindow, Nip, NipVatUe, type OfflineBatchResult, type OfflineCertificate, type OfflineInvoiceFilter, type OfflineInvoiceInputData, type OfflineInvoiceMetadata, type OfflineInvoiceOptions, type OfflineInvoiceStatus, type OfflineInvoiceStorage, type OfflineInvoiceUpdates, OfflineInvoiceWorkflow, type OfflineMode, type OfflineReason, type OfflineSubmissionResult, type OnlineSessionContextLimitsOverride, type OnlineSessionEffectiveContextLimits, type OnlineSessionFormCode, type OnlineSessionHandle, OnlineSessionService, type OnlineSessionState, 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 SubmitOfflineInvoicesOptions, 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 TechnicalCorrectionOptions, 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, addBusinessDays, authenticateWithCertificate, authenticateWithExternalSignature, authenticateWithPkcs12, authenticateWithToken, batchValidationDetails, buildUnsignedAuthTokenRequestXml, calculateBackoff, calculateOfflineDeadline, createZip, decodeJwtPayload, deduplicateByKsefNumber, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, extendDeadlineForMaintenance, extractInvoiceFields, getDefaultReason, getEffectiveStartDate, getFormCode, getPolishHolidays, getTimeUntilDeadline, incrementalExportAndDownload, isExpired, isPolishHoliday, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, nextBusinessDay, openOnlineSession, openSendAndClose, parseFormCode, parseKSeFTokenContext, parseRetryAfter, parseUpoXml, pollUntil, resolveOptions, resumeOnlineSession, runWithConcurrency, sha256Base64, sleep, unzip, updateContinuationPoint, uploadBatch, uploadBatchParsed, uploadBatchStream, uploadBatchStreamParsed, validate, validateBatch, validateBusinessRules, validateFormCodeForSession, validatePresignedUrl, validateSchema, validateWellFormedness, verifyHash, xmlToObject };