ksef-client-ts 0.1.1 → 0.3.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.cts CHANGED
@@ -77,7 +77,18 @@ declare class DefaultAuthManager implements AuthManager {
77
77
  }
78
78
 
79
79
  interface KSeFClientOptions {
80
+ /**
81
+ * Target KSeF environment. Defaults to `'TEST'` when neither `environment`
82
+ * nor `baseUrl` is specified.
83
+ */
80
84
  environment?: EnvironmentName;
85
+ /**
86
+ * Custom base URL for the KSeF API. Overrides the URL from `environment`.
87
+ *
88
+ * **Warning:** When `baseUrl` is set without `environment`, the test environment
89
+ * guard is bypassed — test data APIs will not be blocked. Set `environment`
90
+ * explicitly alongside `baseUrl` if the guard is needed.
91
+ */
81
92
  baseUrl?: string;
82
93
  baseQrUrl?: string;
83
94
  lighthouseUrl?: string;
@@ -97,6 +108,7 @@ interface ResolvedOptions {
97
108
  apiVersion: string;
98
109
  timeout: number;
99
110
  customHeaders: Record<string, string>;
111
+ environmentName?: EnvironmentName;
100
112
  }
101
113
  declare function resolveOptions(options?: KSeFClientOptions): ResolvedOptions;
102
114
 
@@ -122,7 +134,7 @@ interface UnauthorizedProblemDetails {
122
134
  instance?: string;
123
135
  traceId?: string;
124
136
  }
125
- type ForbiddenReasonCode = 'missing-permissions' | 'ip-not-allowed' | 'insufficient-resource-access' | 'auth-method-not-allowed' | 'security-service-blocked' | (string & {});
137
+ type ForbiddenReasonCode = 'missing-permissions' | 'ip-not-allowed' | 'insufficient-resource-access' | 'auth-method-not-allowed' | 'security-service-blocked' | 'context-type-not-allowed' | (string & {});
126
138
  interface ForbiddenProblemDetails {
127
139
  title: string;
128
140
  status: number;
@@ -393,6 +405,19 @@ declare const Routes: {
393
405
  };
394
406
  };
395
407
 
408
+ /** Header name for KSeF feature negotiation. */
409
+ declare const KSEF_FEATURE_HEADER: "X-KSeF-Feature";
410
+ /** Known UPO format versions. */
411
+ declare const UpoVersion: {
412
+ /** UPO v4-2 format (default before 2026-01-05). */
413
+ readonly V4_2: "upo-v4-2";
414
+ /** UPO v4-3 format (default from 2026-01-05, adds InvoicingMode field). */
415
+ readonly V4_3: "upo-v4-3";
416
+ };
417
+ type UpoVersion = (typeof UpoVersion)[keyof typeof UpoVersion];
418
+ /** XAdES compliance enforcement value for X-KSeF-Feature header. */
419
+ declare const ENFORCE_XADES_COMPLIANCE: "enforce-xades-compliance";
420
+
396
421
  declare const Nip: RegExp;
397
422
  declare const VatUe: RegExp;
398
423
  declare const NipVatUe: RegExp;
@@ -417,6 +442,8 @@ declare function isValidInternalId(value: string): boolean;
417
442
  declare function isValidPeppolId(value: string): boolean;
418
443
  declare function isValidReferenceNumber(value: string): boolean;
419
444
  declare function isValidKsefNumber(value: string): boolean;
445
+ declare function isValidKsefNumberV35(value: string): boolean;
446
+ declare function isValidKsefNumberV36(value: string): boolean;
420
447
  declare function isValidPesel(value: string): boolean;
421
448
  declare function isValidCertificateName(value: string): boolean;
422
449
  declare function isValidCertificateFingerprint(value: string): boolean;
@@ -1611,7 +1638,7 @@ declare class AuthService {
1611
1638
  private readonly restClient;
1612
1639
  constructor(restClient: RestClient);
1613
1640
  getChallenge(): Promise<AuthChallengeResponse>;
1614
- submitXadesAuthRequest(signedXml: string, verifyCertificateChain?: boolean): Promise<AuthenticationInitResponse>;
1641
+ submitXadesAuthRequest(signedXml: string, verifyCertificateChain?: boolean, enforceXadesCompliance?: boolean): Promise<AuthenticationInitResponse>;
1615
1642
  submitKsefTokenAuthRequest(payload: AuthKsefTokenRequest): Promise<AuthenticationInitResponse>;
1616
1643
  getAuthStatus(referenceNumber: string, authToken: string): Promise<AuthenticationOperationStatusResponse>;
1617
1644
  getAccessToken(authToken: string): Promise<AuthenticationTokensResponse>;
@@ -1629,7 +1656,7 @@ declare class ActiveSessionsService {
1629
1656
  declare class OnlineSessionService {
1630
1657
  private readonly restClient;
1631
1658
  constructor(restClient: RestClient);
1632
- openSession(request: OpenOnlineSessionRequest, upoVersion?: string): Promise<OpenOnlineSessionResponse>;
1659
+ openSession(request: OpenOnlineSessionRequest, upoVersion?: UpoVersion | string): Promise<OpenOnlineSessionResponse>;
1633
1660
  sendInvoice(sessionRef: string, request: SendInvoiceRequest): Promise<SendInvoiceResponse>;
1634
1661
  closeSession(sessionRef: string): Promise<void>;
1635
1662
  }
@@ -1637,7 +1664,7 @@ declare class OnlineSessionService {
1637
1664
  declare class BatchSessionService {
1638
1665
  private readonly restClient;
1639
1666
  constructor(restClient: RestClient);
1640
- openSession(request: OpenBatchSessionRequest, upoVersion?: string): Promise<OpenBatchSessionResponse>;
1667
+ openSession(request: OpenBatchSessionRequest, upoVersion?: UpoVersion | string): Promise<OpenBatchSessionResponse>;
1641
1668
  sendParts(openResponse: OpenBatchSessionResponse, parts: BatchPartSendingInfo[]): Promise<void>;
1642
1669
  closeSession(batchRef: string): Promise<void>;
1643
1670
  }
@@ -1736,7 +1763,9 @@ declare class PeppolService {
1736
1763
 
1737
1764
  declare class TestDataService {
1738
1765
  private readonly restClient;
1739
- constructor(restClient: RestClient);
1766
+ private readonly environmentName?;
1767
+ constructor(restClient: RestClient, environmentName?: EnvironmentName);
1768
+ private ensureTestEnvironment;
1740
1769
  createSubject(request: SubjectCreateRequest): Promise<void>;
1741
1770
  removeSubject(request: SubjectRemoveRequest): Promise<void>;
1742
1771
  createPerson(request: PersonCreateRequest): Promise<void>;
@@ -1857,6 +1886,37 @@ declare class AuthorizationPermissionGrantBuilder {
1857
1886
  build(): GrantPermissionsAuthorizationRequest;
1858
1887
  }
1859
1888
 
1889
+ /** Maximum size of a single unencrypted batch part (100 MB). */
1890
+ declare const BATCH_MAX_PART_SIZE = 100000000;
1891
+ /** Maximum total unencrypted ZIP size (5 GB). */
1892
+ declare const BATCH_MAX_TOTAL_SIZE = 5000000000;
1893
+ /** Maximum number of batch parts allowed by KSeF API. */
1894
+ declare const BATCH_MAX_PARTS = 50;
1895
+ interface BatchFileBuildOptions {
1896
+ /** Max unencrypted part size in bytes. Default: 100 MB. */
1897
+ maxPartSize?: number;
1898
+ }
1899
+ interface BatchFileBuildResult {
1900
+ /** Metadata for OpenBatchSessionRequest.batchFile. */
1901
+ batchFile: BatchFileInfo;
1902
+ /** Encrypted parts ready for upload, indexed 0..N-1. */
1903
+ encryptedParts: Uint8Array[];
1904
+ }
1905
+ /**
1906
+ * Splits a ZIP file into parts, encrypts each part, and computes
1907
+ * all SHA-256 hashes required by the KSeF batch API.
1908
+ */
1909
+ declare class BatchFileBuilder {
1910
+ /**
1911
+ * Build batch file metadata and encrypted parts from a raw ZIP.
1912
+ *
1913
+ * @param zipBytes - Unencrypted ZIP data
1914
+ * @param encryptFn - AES-256-CBC encryption function (called per part)
1915
+ * @param options - Optional configuration
1916
+ */
1917
+ static build(zipBytes: Uint8Array, encryptFn: (part: Uint8Array) => Uint8Array, options?: BatchFileBuildOptions): BatchFileBuildResult;
1918
+ }
1919
+
1860
1920
  declare class CertificateFetcher {
1861
1921
  private readonly restClient;
1862
1922
  private symmetricKeyPem;
@@ -1988,6 +2048,53 @@ declare class QrCodeService {
1988
2048
  static generateResult(url: string, options?: QrCodeOptions): Promise<QrCodeResult>;
1989
2049
  }
1990
2050
 
2051
+ interface PollOptions {
2052
+ intervalMs?: number;
2053
+ maxAttempts?: number;
2054
+ onProgress?: (attempt: number, maxAttempts: number) => void;
2055
+ }
2056
+ interface OnlineSessionHandle {
2057
+ readonly sessionRef: string;
2058
+ readonly validUntil: string;
2059
+ sendInvoice(invoiceXml: string | Uint8Array): Promise<string>;
2060
+ close(): Promise<void>;
2061
+ waitForUpo(options?: PollOptions): Promise<UpoInfo>;
2062
+ }
2063
+ interface UpoInfo {
2064
+ pages: Array<{
2065
+ referenceNumber: string;
2066
+ downloadUrl: string;
2067
+ }>;
2068
+ invoiceCount?: number;
2069
+ successfulInvoiceCount?: number;
2070
+ failedInvoiceCount?: number;
2071
+ }
2072
+ interface BatchUploadResult {
2073
+ sessionRef: string;
2074
+ upo: UpoInfo;
2075
+ }
2076
+ interface ExportResult {
2077
+ parts: Array<{
2078
+ ordinalNumber: number;
2079
+ url: string;
2080
+ method: string;
2081
+ partSize: number;
2082
+ encryptedPartSize: number;
2083
+ encryptedPartHash: string;
2084
+ expirationDate: string;
2085
+ }>;
2086
+ invoiceCount: number;
2087
+ isTruncated: boolean;
2088
+ permanentStorageHwmDate?: string;
2089
+ }
2090
+ interface ExportDownloadResult extends ExportResult {
2091
+ decryptedParts: Uint8Array[];
2092
+ }
2093
+
2094
+ declare function pollUntil<T>(action: () => Promise<T>, condition: (result: T) => boolean, options?: PollOptions & {
2095
+ description?: string;
2096
+ }): Promise<T>;
2097
+
1991
2098
  declare class KSeFClient {
1992
2099
  readonly auth: AuthService;
1993
2100
  readonly activeSessions: ActiveSessionsService;
@@ -2014,4 +2121,68 @@ declare class KSeFClient {
2014
2121
  logout(): Promise<void>;
2015
2122
  }
2016
2123
 
2017
- export { ActiveSessionsService, type AllowedIps, type AmountType, type ApiErrorResponse, type ApiRateLimitValuesOverride, type ApiRateLimitsOverride, type AttachmentPermissionGrantRequest, type AttachmentPermissionRevokeRequest, type AuthChallengeResponse, type AuthKsefTokenRequest, AuthKsefTokenRequestBuilder, type AuthManager, 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, Base64String, type BatchFileInfo, type BatchFilePartInfo, type BatchPartSendingInfo, type BatchSessionContextLimitsOverride, type BatchSessionEffectiveContextLimits, BatchSessionService, type BlockContextAuthenticationRequest, type BuyerIdentifierType, CERTIFICATE_NAME_MAX_LENGTH, CERTIFICATE_NAME_MIN_LENGTH, CertificateApiService, 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, 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 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, 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, OnlineSessionService, type OpenBatchSessionRequest, type OpenBatchSessionResponse, 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, Pkcs12Loader, type Pkcs12Result, 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 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 TokenAuthorIdentifier, type TokenAuthorIdentifierType, type TokenContextIdentifier, type TokenContextIdentifierType, type TokenInfo, TokenService, type TokenStatusResponse, type TransportFn, type UnauthorizedProblemDetails, type UnblockContextAuthenticationRequest, type UpoPage, type UpoResponse, type UpoResult, type ValidationDetail, VatUe, VerificationLinkService, type X500NameFields, type XadesSubjectIdentifierType, calculateBackoff, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, parseRetryAfter, resolveOptions, sleep, validatePresignedUrl };
2124
+ interface OpenOnlineSessionOptions {
2125
+ formCode?: FormCode;
2126
+ upoVersion?: UpoVersion | string;
2127
+ }
2128
+ interface SendAndCloseOptions extends OpenOnlineSessionOptions {
2129
+ pollOptions?: PollOptions;
2130
+ }
2131
+ declare function openOnlineSession(client: KSeFClient, options?: OpenOnlineSessionOptions): Promise<OnlineSessionHandle>;
2132
+ declare function openSendAndClose(client: KSeFClient, invoices: Array<string | Uint8Array>, options?: SendAndCloseOptions): Promise<UpoInfo>;
2133
+
2134
+ interface BatchUploadOptions {
2135
+ formCode?: FormCode;
2136
+ upoVersion?: UpoVersion | string;
2137
+ pollOptions?: PollOptions;
2138
+ /** Max unencrypted part size in bytes. Default: 100 MB. */
2139
+ maxPartSize?: number;
2140
+ /** Pass-through to KSeF API. */
2141
+ offlineMode?: boolean;
2142
+ }
2143
+ declare function uploadBatch(client: KSeFClient, zipData: Uint8Array, options?: BatchUploadOptions): Promise<BatchUploadResult>;
2144
+
2145
+ interface ExportOptions {
2146
+ onlyMetadata?: boolean;
2147
+ pollOptions?: PollOptions;
2148
+ }
2149
+ interface ExportAndDownloadOptions extends ExportOptions {
2150
+ /** Custom fetch function for downloading parts (defaults to global fetch). */
2151
+ transport?: typeof fetch;
2152
+ }
2153
+ declare function exportInvoices(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportOptions): Promise<ExportResult>;
2154
+ declare function exportAndDownload(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportAndDownloadOptions): Promise<ExportDownloadResult>;
2155
+
2156
+ interface AuthResult {
2157
+ accessToken: string;
2158
+ accessTokenValidUntil: string;
2159
+ refreshToken: string;
2160
+ refreshTokenValidUntil: string;
2161
+ }
2162
+ interface TokenAuthOptions {
2163
+ nip: string;
2164
+ token: string;
2165
+ authorizationPolicy?: AuthorizationPolicy;
2166
+ pollOptions?: PollOptions;
2167
+ }
2168
+ interface CertificateAuthOptions {
2169
+ nip: string;
2170
+ certPem: string;
2171
+ keyPem: string;
2172
+ verifyCertificateChain?: boolean;
2173
+ enforceXadesCompliance?: boolean;
2174
+ pollOptions?: PollOptions;
2175
+ }
2176
+ interface Pkcs12AuthOptions {
2177
+ nip: string;
2178
+ p12: Buffer | Uint8Array;
2179
+ password: string;
2180
+ verifyCertificateChain?: boolean;
2181
+ enforceXadesCompliance?: boolean;
2182
+ pollOptions?: PollOptions;
2183
+ }
2184
+ declare function authenticateWithToken(client: KSeFClient, options: TokenAuthOptions): Promise<AuthResult>;
2185
+ declare function authenticateWithCertificate(client: KSeFClient, options: CertificateAuthOptions): Promise<AuthResult>;
2186
+ declare function authenticateWithPkcs12(client: KSeFClient, options: Pkcs12AuthOptions): Promise<AuthResult>;
2187
+
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 };
package/dist/index.d.ts CHANGED
@@ -77,7 +77,18 @@ declare class DefaultAuthManager implements AuthManager {
77
77
  }
78
78
 
79
79
  interface KSeFClientOptions {
80
+ /**
81
+ * Target KSeF environment. Defaults to `'TEST'` when neither `environment`
82
+ * nor `baseUrl` is specified.
83
+ */
80
84
  environment?: EnvironmentName;
85
+ /**
86
+ * Custom base URL for the KSeF API. Overrides the URL from `environment`.
87
+ *
88
+ * **Warning:** When `baseUrl` is set without `environment`, the test environment
89
+ * guard is bypassed — test data APIs will not be blocked. Set `environment`
90
+ * explicitly alongside `baseUrl` if the guard is needed.
91
+ */
81
92
  baseUrl?: string;
82
93
  baseQrUrl?: string;
83
94
  lighthouseUrl?: string;
@@ -97,6 +108,7 @@ interface ResolvedOptions {
97
108
  apiVersion: string;
98
109
  timeout: number;
99
110
  customHeaders: Record<string, string>;
111
+ environmentName?: EnvironmentName;
100
112
  }
101
113
  declare function resolveOptions(options?: KSeFClientOptions): ResolvedOptions;
102
114
 
@@ -122,7 +134,7 @@ interface UnauthorizedProblemDetails {
122
134
  instance?: string;
123
135
  traceId?: string;
124
136
  }
125
- type ForbiddenReasonCode = 'missing-permissions' | 'ip-not-allowed' | 'insufficient-resource-access' | 'auth-method-not-allowed' | 'security-service-blocked' | (string & {});
137
+ type ForbiddenReasonCode = 'missing-permissions' | 'ip-not-allowed' | 'insufficient-resource-access' | 'auth-method-not-allowed' | 'security-service-blocked' | 'context-type-not-allowed' | (string & {});
126
138
  interface ForbiddenProblemDetails {
127
139
  title: string;
128
140
  status: number;
@@ -393,6 +405,19 @@ declare const Routes: {
393
405
  };
394
406
  };
395
407
 
408
+ /** Header name for KSeF feature negotiation. */
409
+ declare const KSEF_FEATURE_HEADER: "X-KSeF-Feature";
410
+ /** Known UPO format versions. */
411
+ declare const UpoVersion: {
412
+ /** UPO v4-2 format (default before 2026-01-05). */
413
+ readonly V4_2: "upo-v4-2";
414
+ /** UPO v4-3 format (default from 2026-01-05, adds InvoicingMode field). */
415
+ readonly V4_3: "upo-v4-3";
416
+ };
417
+ type UpoVersion = (typeof UpoVersion)[keyof typeof UpoVersion];
418
+ /** XAdES compliance enforcement value for X-KSeF-Feature header. */
419
+ declare const ENFORCE_XADES_COMPLIANCE: "enforce-xades-compliance";
420
+
396
421
  declare const Nip: RegExp;
397
422
  declare const VatUe: RegExp;
398
423
  declare const NipVatUe: RegExp;
@@ -417,6 +442,8 @@ declare function isValidInternalId(value: string): boolean;
417
442
  declare function isValidPeppolId(value: string): boolean;
418
443
  declare function isValidReferenceNumber(value: string): boolean;
419
444
  declare function isValidKsefNumber(value: string): boolean;
445
+ declare function isValidKsefNumberV35(value: string): boolean;
446
+ declare function isValidKsefNumberV36(value: string): boolean;
420
447
  declare function isValidPesel(value: string): boolean;
421
448
  declare function isValidCertificateName(value: string): boolean;
422
449
  declare function isValidCertificateFingerprint(value: string): boolean;
@@ -1611,7 +1638,7 @@ declare class AuthService {
1611
1638
  private readonly restClient;
1612
1639
  constructor(restClient: RestClient);
1613
1640
  getChallenge(): Promise<AuthChallengeResponse>;
1614
- submitXadesAuthRequest(signedXml: string, verifyCertificateChain?: boolean): Promise<AuthenticationInitResponse>;
1641
+ submitXadesAuthRequest(signedXml: string, verifyCertificateChain?: boolean, enforceXadesCompliance?: boolean): Promise<AuthenticationInitResponse>;
1615
1642
  submitKsefTokenAuthRequest(payload: AuthKsefTokenRequest): Promise<AuthenticationInitResponse>;
1616
1643
  getAuthStatus(referenceNumber: string, authToken: string): Promise<AuthenticationOperationStatusResponse>;
1617
1644
  getAccessToken(authToken: string): Promise<AuthenticationTokensResponse>;
@@ -1629,7 +1656,7 @@ declare class ActiveSessionsService {
1629
1656
  declare class OnlineSessionService {
1630
1657
  private readonly restClient;
1631
1658
  constructor(restClient: RestClient);
1632
- openSession(request: OpenOnlineSessionRequest, upoVersion?: string): Promise<OpenOnlineSessionResponse>;
1659
+ openSession(request: OpenOnlineSessionRequest, upoVersion?: UpoVersion | string): Promise<OpenOnlineSessionResponse>;
1633
1660
  sendInvoice(sessionRef: string, request: SendInvoiceRequest): Promise<SendInvoiceResponse>;
1634
1661
  closeSession(sessionRef: string): Promise<void>;
1635
1662
  }
@@ -1637,7 +1664,7 @@ declare class OnlineSessionService {
1637
1664
  declare class BatchSessionService {
1638
1665
  private readonly restClient;
1639
1666
  constructor(restClient: RestClient);
1640
- openSession(request: OpenBatchSessionRequest, upoVersion?: string): Promise<OpenBatchSessionResponse>;
1667
+ openSession(request: OpenBatchSessionRequest, upoVersion?: UpoVersion | string): Promise<OpenBatchSessionResponse>;
1641
1668
  sendParts(openResponse: OpenBatchSessionResponse, parts: BatchPartSendingInfo[]): Promise<void>;
1642
1669
  closeSession(batchRef: string): Promise<void>;
1643
1670
  }
@@ -1736,7 +1763,9 @@ declare class PeppolService {
1736
1763
 
1737
1764
  declare class TestDataService {
1738
1765
  private readonly restClient;
1739
- constructor(restClient: RestClient);
1766
+ private readonly environmentName?;
1767
+ constructor(restClient: RestClient, environmentName?: EnvironmentName);
1768
+ private ensureTestEnvironment;
1740
1769
  createSubject(request: SubjectCreateRequest): Promise<void>;
1741
1770
  removeSubject(request: SubjectRemoveRequest): Promise<void>;
1742
1771
  createPerson(request: PersonCreateRequest): Promise<void>;
@@ -1857,6 +1886,37 @@ declare class AuthorizationPermissionGrantBuilder {
1857
1886
  build(): GrantPermissionsAuthorizationRequest;
1858
1887
  }
1859
1888
 
1889
+ /** Maximum size of a single unencrypted batch part (100 MB). */
1890
+ declare const BATCH_MAX_PART_SIZE = 100000000;
1891
+ /** Maximum total unencrypted ZIP size (5 GB). */
1892
+ declare const BATCH_MAX_TOTAL_SIZE = 5000000000;
1893
+ /** Maximum number of batch parts allowed by KSeF API. */
1894
+ declare const BATCH_MAX_PARTS = 50;
1895
+ interface BatchFileBuildOptions {
1896
+ /** Max unencrypted part size in bytes. Default: 100 MB. */
1897
+ maxPartSize?: number;
1898
+ }
1899
+ interface BatchFileBuildResult {
1900
+ /** Metadata for OpenBatchSessionRequest.batchFile. */
1901
+ batchFile: BatchFileInfo;
1902
+ /** Encrypted parts ready for upload, indexed 0..N-1. */
1903
+ encryptedParts: Uint8Array[];
1904
+ }
1905
+ /**
1906
+ * Splits a ZIP file into parts, encrypts each part, and computes
1907
+ * all SHA-256 hashes required by the KSeF batch API.
1908
+ */
1909
+ declare class BatchFileBuilder {
1910
+ /**
1911
+ * Build batch file metadata and encrypted parts from a raw ZIP.
1912
+ *
1913
+ * @param zipBytes - Unencrypted ZIP data
1914
+ * @param encryptFn - AES-256-CBC encryption function (called per part)
1915
+ * @param options - Optional configuration
1916
+ */
1917
+ static build(zipBytes: Uint8Array, encryptFn: (part: Uint8Array) => Uint8Array, options?: BatchFileBuildOptions): BatchFileBuildResult;
1918
+ }
1919
+
1860
1920
  declare class CertificateFetcher {
1861
1921
  private readonly restClient;
1862
1922
  private symmetricKeyPem;
@@ -1988,6 +2048,53 @@ declare class QrCodeService {
1988
2048
  static generateResult(url: string, options?: QrCodeOptions): Promise<QrCodeResult>;
1989
2049
  }
1990
2050
 
2051
+ interface PollOptions {
2052
+ intervalMs?: number;
2053
+ maxAttempts?: number;
2054
+ onProgress?: (attempt: number, maxAttempts: number) => void;
2055
+ }
2056
+ interface OnlineSessionHandle {
2057
+ readonly sessionRef: string;
2058
+ readonly validUntil: string;
2059
+ sendInvoice(invoiceXml: string | Uint8Array): Promise<string>;
2060
+ close(): Promise<void>;
2061
+ waitForUpo(options?: PollOptions): Promise<UpoInfo>;
2062
+ }
2063
+ interface UpoInfo {
2064
+ pages: Array<{
2065
+ referenceNumber: string;
2066
+ downloadUrl: string;
2067
+ }>;
2068
+ invoiceCount?: number;
2069
+ successfulInvoiceCount?: number;
2070
+ failedInvoiceCount?: number;
2071
+ }
2072
+ interface BatchUploadResult {
2073
+ sessionRef: string;
2074
+ upo: UpoInfo;
2075
+ }
2076
+ interface ExportResult {
2077
+ parts: Array<{
2078
+ ordinalNumber: number;
2079
+ url: string;
2080
+ method: string;
2081
+ partSize: number;
2082
+ encryptedPartSize: number;
2083
+ encryptedPartHash: string;
2084
+ expirationDate: string;
2085
+ }>;
2086
+ invoiceCount: number;
2087
+ isTruncated: boolean;
2088
+ permanentStorageHwmDate?: string;
2089
+ }
2090
+ interface ExportDownloadResult extends ExportResult {
2091
+ decryptedParts: Uint8Array[];
2092
+ }
2093
+
2094
+ declare function pollUntil<T>(action: () => Promise<T>, condition: (result: T) => boolean, options?: PollOptions & {
2095
+ description?: string;
2096
+ }): Promise<T>;
2097
+
1991
2098
  declare class KSeFClient {
1992
2099
  readonly auth: AuthService;
1993
2100
  readonly activeSessions: ActiveSessionsService;
@@ -2014,4 +2121,68 @@ declare class KSeFClient {
2014
2121
  logout(): Promise<void>;
2015
2122
  }
2016
2123
 
2017
- export { ActiveSessionsService, type AllowedIps, type AmountType, type ApiErrorResponse, type ApiRateLimitValuesOverride, type ApiRateLimitsOverride, type AttachmentPermissionGrantRequest, type AttachmentPermissionRevokeRequest, type AuthChallengeResponse, type AuthKsefTokenRequest, AuthKsefTokenRequestBuilder, type AuthManager, 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, Base64String, type BatchFileInfo, type BatchFilePartInfo, type BatchPartSendingInfo, type BatchSessionContextLimitsOverride, type BatchSessionEffectiveContextLimits, BatchSessionService, type BlockContextAuthenticationRequest, type BuyerIdentifierType, CERTIFICATE_NAME_MAX_LENGTH, CERTIFICATE_NAME_MIN_LENGTH, CertificateApiService, 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, 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 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, 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, OnlineSessionService, type OpenBatchSessionRequest, type OpenBatchSessionResponse, 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, Pkcs12Loader, type Pkcs12Result, 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 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 TokenAuthorIdentifier, type TokenAuthorIdentifierType, type TokenContextIdentifier, type TokenContextIdentifierType, type TokenInfo, TokenService, type TokenStatusResponse, type TransportFn, type UnauthorizedProblemDetails, type UnblockContextAuthenticationRequest, type UpoPage, type UpoResponse, type UpoResult, type ValidationDetail, VatUe, VerificationLinkService, type X500NameFields, type XadesSubjectIdentifierType, calculateBackoff, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, parseRetryAfter, resolveOptions, sleep, validatePresignedUrl };
2124
+ interface OpenOnlineSessionOptions {
2125
+ formCode?: FormCode;
2126
+ upoVersion?: UpoVersion | string;
2127
+ }
2128
+ interface SendAndCloseOptions extends OpenOnlineSessionOptions {
2129
+ pollOptions?: PollOptions;
2130
+ }
2131
+ declare function openOnlineSession(client: KSeFClient, options?: OpenOnlineSessionOptions): Promise<OnlineSessionHandle>;
2132
+ declare function openSendAndClose(client: KSeFClient, invoices: Array<string | Uint8Array>, options?: SendAndCloseOptions): Promise<UpoInfo>;
2133
+
2134
+ interface BatchUploadOptions {
2135
+ formCode?: FormCode;
2136
+ upoVersion?: UpoVersion | string;
2137
+ pollOptions?: PollOptions;
2138
+ /** Max unencrypted part size in bytes. Default: 100 MB. */
2139
+ maxPartSize?: number;
2140
+ /** Pass-through to KSeF API. */
2141
+ offlineMode?: boolean;
2142
+ }
2143
+ declare function uploadBatch(client: KSeFClient, zipData: Uint8Array, options?: BatchUploadOptions): Promise<BatchUploadResult>;
2144
+
2145
+ interface ExportOptions {
2146
+ onlyMetadata?: boolean;
2147
+ pollOptions?: PollOptions;
2148
+ }
2149
+ interface ExportAndDownloadOptions extends ExportOptions {
2150
+ /** Custom fetch function for downloading parts (defaults to global fetch). */
2151
+ transport?: typeof fetch;
2152
+ }
2153
+ declare function exportInvoices(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportOptions): Promise<ExportResult>;
2154
+ declare function exportAndDownload(client: KSeFClient, filters: InvoiceQueryFilters, options?: ExportAndDownloadOptions): Promise<ExportDownloadResult>;
2155
+
2156
+ interface AuthResult {
2157
+ accessToken: string;
2158
+ accessTokenValidUntil: string;
2159
+ refreshToken: string;
2160
+ refreshTokenValidUntil: string;
2161
+ }
2162
+ interface TokenAuthOptions {
2163
+ nip: string;
2164
+ token: string;
2165
+ authorizationPolicy?: AuthorizationPolicy;
2166
+ pollOptions?: PollOptions;
2167
+ }
2168
+ interface CertificateAuthOptions {
2169
+ nip: string;
2170
+ certPem: string;
2171
+ keyPem: string;
2172
+ verifyCertificateChain?: boolean;
2173
+ enforceXadesCompliance?: boolean;
2174
+ pollOptions?: PollOptions;
2175
+ }
2176
+ interface Pkcs12AuthOptions {
2177
+ nip: string;
2178
+ p12: Buffer | Uint8Array;
2179
+ password: string;
2180
+ verifyCertificateChain?: boolean;
2181
+ enforceXadesCompliance?: boolean;
2182
+ pollOptions?: PollOptions;
2183
+ }
2184
+ declare function authenticateWithToken(client: KSeFClient, options: TokenAuthOptions): Promise<AuthResult>;
2185
+ declare function authenticateWithCertificate(client: KSeFClient, options: CertificateAuthOptions): Promise<AuthResult>;
2186
+ declare function authenticateWithPkcs12(client: KSeFClient, options: Pkcs12AuthOptions): Promise<AuthResult>;
2187
+
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 };