ksef-client-ts 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli.js +1014 -128
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +695 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +199 -1
- package/dist/index.d.ts +199 -1
- package/dist/index.js +684 -78
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2396,6 +2396,19 @@ interface UpoPotwierdzenie {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
declare function parseUpoXml(xml: string | Buffer): UpoPotwierdzenie;
|
|
2398
2398
|
|
|
2399
|
+
interface InvoiceFields {
|
|
2400
|
+
invoiceNumber: string;
|
|
2401
|
+
invoiceDate: string;
|
|
2402
|
+
}
|
|
2403
|
+
/**
|
|
2404
|
+
* Extracts invoice number and date from KSeF invoice XML.
|
|
2405
|
+
*
|
|
2406
|
+
* Supports:
|
|
2407
|
+
* - FA formats (FA_2, FA_3, FA_3_SELF): `Faktura > Fa > P_2` (number), `P_1` (date)
|
|
2408
|
+
* - FA_RR format: `Faktura > FakturaRR > P_4C` (number), `P_4B` (date)
|
|
2409
|
+
*/
|
|
2410
|
+
declare function extractInvoiceFields(xml: string): InvoiceFields;
|
|
2411
|
+
|
|
2399
2412
|
interface PollOptions {
|
|
2400
2413
|
intervalMs?: number;
|
|
2401
2414
|
maxAttempts?: number;
|
|
@@ -2455,6 +2468,140 @@ declare function pollUntil<T>(action: () => Promise<T>, condition: (result: T) =
|
|
|
2455
2468
|
description?: string;
|
|
2456
2469
|
}): Promise<T>;
|
|
2457
2470
|
|
|
2471
|
+
interface OfflineInvoiceFilter {
|
|
2472
|
+
status?: OfflineInvoiceStatus | OfflineInvoiceStatus[];
|
|
2473
|
+
mode?: OfflineMode;
|
|
2474
|
+
expiringBefore?: Date | string;
|
|
2475
|
+
sellerNip?: string;
|
|
2476
|
+
}
|
|
2477
|
+
type OfflineInvoiceUpdates = Omit<Partial<OfflineInvoiceMetadata>, 'id'>;
|
|
2478
|
+
interface OfflineInvoiceStorage {
|
|
2479
|
+
save(invoice: OfflineInvoiceMetadata): Promise<void>;
|
|
2480
|
+
get(id: string): Promise<OfflineInvoiceMetadata | null>;
|
|
2481
|
+
list(filter?: OfflineInvoiceFilter): Promise<OfflineInvoiceMetadata[]>;
|
|
2482
|
+
update(id: string, updates: OfflineInvoiceUpdates): Promise<void>;
|
|
2483
|
+
delete(id: string): Promise<void>;
|
|
2484
|
+
}
|
|
2485
|
+
declare class InMemoryOfflineInvoiceStorage implements OfflineInvoiceStorage {
|
|
2486
|
+
private readonly store;
|
|
2487
|
+
save(invoice: OfflineInvoiceMetadata): Promise<void>;
|
|
2488
|
+
get(id: string): Promise<OfflineInvoiceMetadata | null>;
|
|
2489
|
+
list(filter?: OfflineInvoiceFilter): Promise<OfflineInvoiceMetadata[]>;
|
|
2490
|
+
update(id: string, updates: OfflineInvoiceUpdates): Promise<void>;
|
|
2491
|
+
delete(id: string): Promise<void>;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
/** Offline invoice modes per KSeF docs (art. 106nda/106nh/106nf) */
|
|
2495
|
+
type OfflineMode = 'offline24' | 'offline' | 'awaryjny' | 'awaria_calkowita';
|
|
2496
|
+
/** Why this invoice was issued offline */
|
|
2497
|
+
type OfflineReason = 'PLANNED' | 'SYSTEM_UNAVAILABLE' | 'EMERGENCY' | 'TOTAL_FAILURE';
|
|
2498
|
+
/**
|
|
2499
|
+
* Offline invoice lifecycle state machine:
|
|
2500
|
+
* GENERATED → QUEUED → SUBMITTED → ACCEPTED | REJECTED
|
|
2501
|
+
* Any non-terminal → EXPIRED
|
|
2502
|
+
*/
|
|
2503
|
+
type OfflineInvoiceStatus = 'GENERATED' | 'QUEUED' | 'SUBMITTED' | 'ACCEPTED' | 'REJECTED' | 'CORRECTED' | 'EXPIRED';
|
|
2504
|
+
interface OfflineInvoiceInputData {
|
|
2505
|
+
invoiceNumber: string;
|
|
2506
|
+
invoiceDate: string;
|
|
2507
|
+
invoiceXml: string;
|
|
2508
|
+
sellerNip: string;
|
|
2509
|
+
sellerIdentifier: ContextIdentifier;
|
|
2510
|
+
buyerIdentifier?: ContextIdentifier;
|
|
2511
|
+
totalAmount?: number;
|
|
2512
|
+
currency?: string;
|
|
2513
|
+
}
|
|
2514
|
+
interface OfflineCertificate {
|
|
2515
|
+
privateKeyPem: string;
|
|
2516
|
+
certificateSerial: string;
|
|
2517
|
+
password?: string;
|
|
2518
|
+
}
|
|
2519
|
+
interface MaintenanceWindow {
|
|
2520
|
+
id: string;
|
|
2521
|
+
startTime: string;
|
|
2522
|
+
endTime?: string;
|
|
2523
|
+
active: boolean;
|
|
2524
|
+
planned: boolean;
|
|
2525
|
+
reason?: string;
|
|
2526
|
+
}
|
|
2527
|
+
interface OfflineInvoiceMetadata {
|
|
2528
|
+
id: string;
|
|
2529
|
+
mode: OfflineMode;
|
|
2530
|
+
reason: OfflineReason;
|
|
2531
|
+
status: OfflineInvoiceStatus;
|
|
2532
|
+
invoiceNumber: string;
|
|
2533
|
+
invoiceDate: string;
|
|
2534
|
+
invoiceXml: string;
|
|
2535
|
+
sellerNip: string;
|
|
2536
|
+
sellerIdentifier: ContextIdentifier;
|
|
2537
|
+
buyerIdentifier?: ContextIdentifier;
|
|
2538
|
+
totalAmount?: number;
|
|
2539
|
+
currency?: string;
|
|
2540
|
+
kod1Url: string;
|
|
2541
|
+
kod2Url?: string;
|
|
2542
|
+
generatedAt: string;
|
|
2543
|
+
submitBy: string;
|
|
2544
|
+
submittedAt?: string;
|
|
2545
|
+
acceptedAt?: string;
|
|
2546
|
+
ksefReferenceNumber?: string;
|
|
2547
|
+
error?: {
|
|
2548
|
+
code: number;
|
|
2549
|
+
message: string;
|
|
2550
|
+
details?: string[];
|
|
2551
|
+
};
|
|
2552
|
+
maintenanceWindowId?: string;
|
|
2553
|
+
correctedInvoiceId?: string;
|
|
2554
|
+
correctedBy?: string;
|
|
2555
|
+
}
|
|
2556
|
+
interface OfflineInvoiceOptions {
|
|
2557
|
+
mode?: OfflineMode;
|
|
2558
|
+
certificate?: OfflineCertificate;
|
|
2559
|
+
maintenanceWindow?: MaintenanceWindow;
|
|
2560
|
+
customDeadline?: Date | string;
|
|
2561
|
+
storage?: OfflineInvoiceStorage;
|
|
2562
|
+
}
|
|
2563
|
+
interface OfflineBatchResult {
|
|
2564
|
+
total: number;
|
|
2565
|
+
submitted: number;
|
|
2566
|
+
accepted: number;
|
|
2567
|
+
rejected: number;
|
|
2568
|
+
failed: number;
|
|
2569
|
+
expired: number;
|
|
2570
|
+
results: OfflineSubmissionResult[];
|
|
2571
|
+
}
|
|
2572
|
+
interface OfflineSubmissionResult {
|
|
2573
|
+
invoiceId: string;
|
|
2574
|
+
invoiceNumber: string;
|
|
2575
|
+
status: OfflineInvoiceStatus;
|
|
2576
|
+
ksefReferenceNumber?: string;
|
|
2577
|
+
error?: {
|
|
2578
|
+
code: number;
|
|
2579
|
+
message: string;
|
|
2580
|
+
details?: string[];
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
interface SubmitOfflineInvoicesOptions {
|
|
2585
|
+
storage: OfflineInvoiceStorage;
|
|
2586
|
+
invoiceIds?: string[];
|
|
2587
|
+
checkExpiry?: boolean;
|
|
2588
|
+
formCode?: FormCode;
|
|
2589
|
+
}
|
|
2590
|
+
interface TechnicalCorrectionOptions {
|
|
2591
|
+
rejectedInvoiceId: string;
|
|
2592
|
+
correctedInvoiceXml: string;
|
|
2593
|
+
storage: OfflineInvoiceStorage;
|
|
2594
|
+
formCode?: FormCode;
|
|
2595
|
+
certificate?: OfflineCertificate;
|
|
2596
|
+
}
|
|
2597
|
+
declare class OfflineInvoiceWorkflow {
|
|
2598
|
+
private readonly qrService;
|
|
2599
|
+
constructor(qrService: VerificationLinkService);
|
|
2600
|
+
generate(input: OfflineInvoiceInputData, options?: OfflineInvoiceOptions): Promise<OfflineInvoiceMetadata>;
|
|
2601
|
+
submit(client: KSeFClient, options: SubmitOfflineInvoicesOptions): Promise<OfflineBatchResult>;
|
|
2602
|
+
correct(client: KSeFClient, options: TechnicalCorrectionOptions): Promise<OfflineSubmissionResult>;
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2458
2605
|
declare class KSeFClient {
|
|
2459
2606
|
readonly auth: AuthService;
|
|
2460
2607
|
readonly activeSessions: ActiveSessionsService;
|
|
@@ -2473,7 +2620,9 @@ declare class KSeFClient {
|
|
|
2473
2620
|
readonly qr: VerificationLinkService;
|
|
2474
2621
|
readonly options: ResolvedOptions;
|
|
2475
2622
|
readonly authManager: AuthManager;
|
|
2623
|
+
private _offline?;
|
|
2476
2624
|
constructor(options?: KSeFClientOptions);
|
|
2625
|
+
get offline(): OfflineInvoiceWorkflow;
|
|
2477
2626
|
loginWithToken(token: string, nip: string): Promise<void>;
|
|
2478
2627
|
loginWithCertificate(certPem: string, keyPem: string, nip: string, keyPassword?: string): Promise<void>;
|
|
2479
2628
|
loginWithPkcs12(p12: Buffer | Uint8Array, password: string, nip: string): Promise<void>;
|
|
@@ -2615,4 +2764,53 @@ interface ExternalSignatureAuthOptions {
|
|
|
2615
2764
|
declare function authenticateWithExternalSignature(client: KSeFClient, options: ExternalSignatureAuthOptions): Promise<AuthResult>;
|
|
2616
2765
|
declare function authenticateWithPkcs12(client: KSeFClient, options: Pkcs12AuthOptions): Promise<AuthResult>;
|
|
2617
2766
|
|
|
2618
|
-
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, type ForbiddenProblemDetails, type ForbiddenReasonCode, type FormCode, type FormType, type GrantPermissionsAuthorizationRequest, type GrantPermissionsEntityRequest, type GrantPermissionsEuEntityAdminRequest, type GrantPermissionsEuEntityRepresentativeRequest, type GrantPermissionsEuEntityRequest, type GrantPermissionsIndirectRequest, type GrantPermissionsPersonRequest, type GrantPermissionsSubunitRequest, type HttpMethod, type HwmStore, INVOICE_TYPES_BY_SYSTEM_CODE, type IdDocument, InMemoryHwmStore, type IncrementalExportOptions, type IncrementalExportResult, type IndirectPermissionType, type IndirectPermissionsSubjectIdentifier, type IndirectPermissionsSubjectIdentifierType, type IndirectPermissionsTargetIdentifier, type IndirectPermissionsTargetIdentifierType, InternalId, InvoiceDownloadService, type InvoiceExportPackage, type InvoiceExportPackagePart, type InvoiceExportRequest, type InvoiceExportStatusResponse, type InvoiceMetadata, type InvoiceMetadataAuthorizedSubject, type InvoiceMetadataBuyer, type InvoiceMetadataBuyerIdentifier, type InvoiceMetadataSeller, type InvoiceMetadataThirdSubject, type InvoiceMetadataThirdSubjectIdentifier, type InvoicePermissionType, type InvoiceQueryAmount, type InvoiceQueryBuyerIdentifier, type InvoiceQueryDateRange, type InvoiceQueryDateType, InvoiceQueryFilterBuilder, type InvoiceQueryFilters, type InvoiceStatusInfo, type InvoiceSubjectType, type InvoiceType, type InvoiceValidationError, type InvoiceValidationErrorCode, type InvoiceValidationResult, type InvoicingMode, Ip4Address, Ip4Mask, Ip4Range, KSEF_FEATURE_HEADER, KSeFApiError, KSeFAuthStatusError, KSeFClient, type KSeFClientOptions, KSeFError, KSeFForbiddenError, KSeFRateLimitError, KSeFSessionExpiredError, type KSeFTokenContext, KSeFUnauthorizedError, KSeFValidationError, type KsefMessagesResponse, KsefNumber, KsefNumberV35, KsefNumberV36, type KsefStatusResponse, type KsefSystemStatus, type KsefTokenPermissionType, type KsefTokenRequest, type KsefTokenResponse, type KsefTokenStatus, type LighthouseMessage, LighthouseService, LimitsService, Nip, NipVatUe, type OnlineSessionContextLimitsOverride, type OnlineSessionEffectiveContextLimits, type OnlineSessionFormCode, type OnlineSessionHandle, OnlineSessionService, type OpenBatchSessionRequest, type OpenBatchSessionResponse, type OpenOnlineSessionOptions, type OpenOnlineSessionRequest, type OpenOnlineSessionResponse, type OperationResponse, type OperationStatusInfo, PERMISSION_DESCRIPTION_MAX_LENGTH, PERMISSION_DESCRIPTION_MIN_LENGTH, type PagedAuthorizationsResponse, type PagedPermissionsResponse, type PagedRolesResponse, type ParsedBatchUploadResult, type ParsedUpoInfo, type PartUploadRequest, PeppolId, type PeppolProvider, PeppolService, type PermissionState, type PermissionSubjectIdentifierType, type PermissionWithDelegate, type PermissionsAttachmentAllowedResponse, type PermissionsEuEntityDetails, type PermissionsOperationStatusResponse, PermissionsService, type PermissionsSubjectEntityByFingerprintDetails, type PermissionsSubjectEntityByIdentifierDetails, type PermissionsSubjectEntityDetails, type PermissionsSubjectPersonByFingerprintDetails, type PermissionsSubjectPersonDetails, type PersonByFingerprintWithIdentifierDetails, type PersonByFingerprintWithoutIdentifierDetails, type PersonByIdentifierDetails, type PersonCreateRequest, type PersonIdentifier, type PersonIdentifierType, type PersonPermission, PersonPermissionGrantBuilder, type PersonPermissionSubjectDetails, type PersonPermissionType, type PersonPermissionsAuthorIdentifier, type PersonPermissionsAuthorIdentifierType, type PersonPermissionsAuthorizedIdentifier, type PersonPermissionsAuthorizedIdentifierType, type PersonPermissionsContextIdentifier, type PersonPermissionsContextIdentifierType, type PersonPermissionsQueryType, type PersonPermissionsTargetIdentifier, type PersonPermissionsTargetIdentifierType, type PersonRemoveRequest, type PersonSubjectByFingerprintDetailsType, type PersonSubjectDetailsType, type PersonSubjectIdentifier, type PersonalPermission, type PersonalPermissionScopeType, type PersonalPermissionsAuthorizedIdentifier, type PersonalPermissionsAuthorizedIdentifierType, type PersonalPermissionsContextIdentifier, type PersonalPermissionsContextIdentifierType, type PersonalPermissionsTargetIdentifier, type PersonalPermissionsTargetIdentifierType, Pesel, type Pkcs12AuthOptions, Pkcs12Loader, type Pkcs12Result, type PollOptions, type PresignedUrlPolicy, type PublicKeyCertificate, type PublicKeyCertificateUsage, type QRCodeContextIdentifierType, type QrCodeOptions, type QrCodeResult, QrCodeService, type QueryAuthorizationsGrantsRequest, type QueryCertificatesRequest, type QueryCertificatesResponse, type QueryEntitiesGrantsRequest, type QueryEntitiesRolesRequest, type QueryEuEntitiesGrantsRequest, type QueryInvoicesMetadataResponse, type QueryKsefTokensOptions, type QueryKsefTokensResponse, type QueryPeppolProvidersResponse, type QueryPersonalGrantsRequest, type QueryPersonsGrantsRequest, type QuerySubordinateEntitiesRolesRequest, type QuerySubunitsGrantsRequest, type QueryTokensResponseItem, REQUIRED_CHALLENGE_LENGTH, type RateLimitConfig, RateLimitPolicy, ReferenceNumber, type ResolvedOptions, RestClient, RestRequest, type RestResponse, type RetrieveCertificatesListItem, type RetrieveCertificatesRequest, type RetrieveCertificatesResponse, type RetryPolicy, type RevokeCertificateRequest, RouteBuilder, Routes, SUBUNIT_NAME_MAX_LENGTH, SUBUNIT_NAME_MIN_LENGTH, SchemaRegistry, type SelfSignedCertificateResult, type SendAndCloseOptions, type SendInvoiceRequest, type SendInvoiceResponse, type SessionInvoiceStatusResponse, type SessionInvoicesResponse, type SessionStatus, type SessionStatusResponse, SessionStatusService, type SessionType, type SessionsFilter, type SessionsQueryResponse, type SessionsQueryResponseItem, type SetRateLimitsRequest, type SetSessionLimitsRequest, type SetSubjectLimitsRequest, Sha256Base64, SignatureService, type SortOrder, type StatusInfo, type SubjectCreateRequest, type SubjectRemoveRequest, type SubjectType, type SubordinateEntityRole, type SubordinateEntityRoleType, type SubordinateRoleSubordinateEntityIdentifier, type SubordinateRoleSubordinateEntityIdentifierType, type Subunit, type SubunitPermission, type SubunitPermissionScope, type SubunitPermissionsAuthorIdentifier, type SubunitPermissionsAuthorIdentifierType, type SubunitPermissionsAuthorizedIdentifier, type SubunitPermissionsContextIdentifier, type SubunitPermissionsContextIdentifierType, type SubunitPermissionsSubjectIdentifier, type SubunitPermissionsSubjectIdentifierType, type SubunitPermissionsSubunitIdentifier, type SubunitPermissionsSubunitIdentifierType, SystemCode, type TestDataAuthenticationContextIdentifier, type TestDataAuthenticationContextIdentifierType, type TestDataAuthorizedIdentifier, type TestDataAuthorizedIdentifierType, type TestDataContextIdentifier, type TestDataContextIdentifierType, type TestDataPermission, type TestDataPermissionType, type TestDataPermissionsGrantRequest, type TestDataPermissionsRevokeRequest, TestDataService, type ThirdSubjectIdentifierType, type TokenAuthOptions, type TokenAuthorIdentifier, type TokenAuthorIdentifierType, type TokenContextIdentifier, type TokenContextIdentifierType, type TokenInfo, TokenService, type TokenStatusResponse, type TransportFn, type UnauthorizedProblemDetails, type UnblockContextAuthenticationRequest, type UnzipOptions, type UpoAuthProof, type UpoContextId, type UpoDokument, type UpoInfo, type UpoOpisPotwierdzenia, type UpoPage, type UpoPotwierdzenie, type UpoResponse, type UpoResult, type UpoUwierzytelnienie, UpoVersion, UpoVersion as UpoVersionType, type ValidateOptions, type ValidationDetail, VatUe, VerificationLinkService, type X500NameFields, type XadesSubjectIdentifierType, type XmlConversionResult, type ZipEntryInput, authenticateWithCertificate, authenticateWithExternalSignature, authenticateWithPkcs12, authenticateWithToken, batchValidationDetails, buildUnsignedAuthTokenRequestXml, calculateBackoff, createZip, decodeJwtPayload, deduplicateByKsefNumber, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, getEffectiveStartDate, getFormCode, incrementalExportAndDownload, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, openOnlineSession, openSendAndClose, parseFormCode, parseKSeFTokenContext, parseRetryAfter, parseUpoXml, pollUntil, resolveOptions, sleep, unzip, updateContinuationPoint, uploadBatch, uploadBatchParsed, uploadBatchStream, uploadBatchStreamParsed, validate, validateBatch, validateBusinessRules, validateFormCodeForSession, validatePresignedUrl, validateSchema, validateWellFormedness, xmlToObject };
|
|
2767
|
+
/**
|
|
2768
|
+
* Offline invoice deadline calculation.
|
|
2769
|
+
*
|
|
2770
|
+
* All business-day arithmetic uses UTC methods (getUTCDay, setUTCDate).
|
|
2771
|
+
* KSeF deadlines are specified as calendar dates, not wall-clock times,
|
|
2772
|
+
* so UTC produces correct results for date-only calculations regardless
|
|
2773
|
+
* of the caller's timezone. The endOfDay() helper sets 23:59:59.999 UTC
|
|
2774
|
+
* as a conservative cutoff.
|
|
2775
|
+
*/
|
|
2776
|
+
|
|
2777
|
+
declare function getDefaultReason(mode: OfflineMode): OfflineReason;
|
|
2778
|
+
declare function nextBusinessDay(from: Date): Date;
|
|
2779
|
+
declare function addBusinessDays(from: Date, days: number): Date;
|
|
2780
|
+
/**
|
|
2781
|
+
* Calculate submission deadline for offline invoice.
|
|
2782
|
+
*
|
|
2783
|
+
* - offline24: next business day after invoiceDate
|
|
2784
|
+
* - offline: next business day after maintenance window ends
|
|
2785
|
+
* - awaryjny: 7 business days after maintenance window ends
|
|
2786
|
+
* - awaria_calkowita: far-future (obligation suspended)
|
|
2787
|
+
*/
|
|
2788
|
+
declare function calculateOfflineDeadline(mode: OfflineMode, invoiceDate: Date | string, maintenanceWindow?: MaintenanceWindow): Date;
|
|
2789
|
+
/**
|
|
2790
|
+
* Extend deadline when a new maintenance window cascades.
|
|
2791
|
+
* Returns the new deadline if maintenance ends after current deadline, otherwise keeps current.
|
|
2792
|
+
*/
|
|
2793
|
+
declare function extendDeadlineForMaintenance(currentDeadline: Date | string, maintenanceWindow: MaintenanceWindow, mode?: OfflineMode): Date;
|
|
2794
|
+
declare function isExpired(submitBy: Date | string): boolean;
|
|
2795
|
+
declare function getTimeUntilDeadline(submitBy: Date | string): number;
|
|
2796
|
+
|
|
2797
|
+
declare class FileOfflineInvoiceStorage implements OfflineInvoiceStorage {
|
|
2798
|
+
private readonly dir;
|
|
2799
|
+
constructor(directory?: string);
|
|
2800
|
+
private ensureDir;
|
|
2801
|
+
private filePath;
|
|
2802
|
+
save(invoice: OfflineInvoiceMetadata): Promise<void>;
|
|
2803
|
+
get(id: string): Promise<OfflineInvoiceMetadata | null>;
|
|
2804
|
+
list(filter?: OfflineInvoiceFilter): Promise<OfflineInvoiceMetadata[]>;
|
|
2805
|
+
/**
|
|
2806
|
+
* Update invoice metadata (read-modify-write).
|
|
2807
|
+
*
|
|
2808
|
+
* Note: No file locking — concurrent updates to the same ID may cause
|
|
2809
|
+
* lost writes. Acceptable for CLI (single process). Library consumers
|
|
2810
|
+
* running parallel operations should use external locking.
|
|
2811
|
+
*/
|
|
2812
|
+
update(id: string, updates: OfflineInvoiceUpdates): Promise<void>;
|
|
2813
|
+
delete(id: string): Promise<void>;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -2396,6 +2396,19 @@ interface UpoPotwierdzenie {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
declare function parseUpoXml(xml: string | Buffer): UpoPotwierdzenie;
|
|
2398
2398
|
|
|
2399
|
+
interface InvoiceFields {
|
|
2400
|
+
invoiceNumber: string;
|
|
2401
|
+
invoiceDate: string;
|
|
2402
|
+
}
|
|
2403
|
+
/**
|
|
2404
|
+
* Extracts invoice number and date from KSeF invoice XML.
|
|
2405
|
+
*
|
|
2406
|
+
* Supports:
|
|
2407
|
+
* - FA formats (FA_2, FA_3, FA_3_SELF): `Faktura > Fa > P_2` (number), `P_1` (date)
|
|
2408
|
+
* - FA_RR format: `Faktura > FakturaRR > P_4C` (number), `P_4B` (date)
|
|
2409
|
+
*/
|
|
2410
|
+
declare function extractInvoiceFields(xml: string): InvoiceFields;
|
|
2411
|
+
|
|
2399
2412
|
interface PollOptions {
|
|
2400
2413
|
intervalMs?: number;
|
|
2401
2414
|
maxAttempts?: number;
|
|
@@ -2455,6 +2468,140 @@ declare function pollUntil<T>(action: () => Promise<T>, condition: (result: T) =
|
|
|
2455
2468
|
description?: string;
|
|
2456
2469
|
}): Promise<T>;
|
|
2457
2470
|
|
|
2471
|
+
interface OfflineInvoiceFilter {
|
|
2472
|
+
status?: OfflineInvoiceStatus | OfflineInvoiceStatus[];
|
|
2473
|
+
mode?: OfflineMode;
|
|
2474
|
+
expiringBefore?: Date | string;
|
|
2475
|
+
sellerNip?: string;
|
|
2476
|
+
}
|
|
2477
|
+
type OfflineInvoiceUpdates = Omit<Partial<OfflineInvoiceMetadata>, 'id'>;
|
|
2478
|
+
interface OfflineInvoiceStorage {
|
|
2479
|
+
save(invoice: OfflineInvoiceMetadata): Promise<void>;
|
|
2480
|
+
get(id: string): Promise<OfflineInvoiceMetadata | null>;
|
|
2481
|
+
list(filter?: OfflineInvoiceFilter): Promise<OfflineInvoiceMetadata[]>;
|
|
2482
|
+
update(id: string, updates: OfflineInvoiceUpdates): Promise<void>;
|
|
2483
|
+
delete(id: string): Promise<void>;
|
|
2484
|
+
}
|
|
2485
|
+
declare class InMemoryOfflineInvoiceStorage implements OfflineInvoiceStorage {
|
|
2486
|
+
private readonly store;
|
|
2487
|
+
save(invoice: OfflineInvoiceMetadata): Promise<void>;
|
|
2488
|
+
get(id: string): Promise<OfflineInvoiceMetadata | null>;
|
|
2489
|
+
list(filter?: OfflineInvoiceFilter): Promise<OfflineInvoiceMetadata[]>;
|
|
2490
|
+
update(id: string, updates: OfflineInvoiceUpdates): Promise<void>;
|
|
2491
|
+
delete(id: string): Promise<void>;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
/** Offline invoice modes per KSeF docs (art. 106nda/106nh/106nf) */
|
|
2495
|
+
type OfflineMode = 'offline24' | 'offline' | 'awaryjny' | 'awaria_calkowita';
|
|
2496
|
+
/** Why this invoice was issued offline */
|
|
2497
|
+
type OfflineReason = 'PLANNED' | 'SYSTEM_UNAVAILABLE' | 'EMERGENCY' | 'TOTAL_FAILURE';
|
|
2498
|
+
/**
|
|
2499
|
+
* Offline invoice lifecycle state machine:
|
|
2500
|
+
* GENERATED → QUEUED → SUBMITTED → ACCEPTED | REJECTED
|
|
2501
|
+
* Any non-terminal → EXPIRED
|
|
2502
|
+
*/
|
|
2503
|
+
type OfflineInvoiceStatus = 'GENERATED' | 'QUEUED' | 'SUBMITTED' | 'ACCEPTED' | 'REJECTED' | 'CORRECTED' | 'EXPIRED';
|
|
2504
|
+
interface OfflineInvoiceInputData {
|
|
2505
|
+
invoiceNumber: string;
|
|
2506
|
+
invoiceDate: string;
|
|
2507
|
+
invoiceXml: string;
|
|
2508
|
+
sellerNip: string;
|
|
2509
|
+
sellerIdentifier: ContextIdentifier;
|
|
2510
|
+
buyerIdentifier?: ContextIdentifier;
|
|
2511
|
+
totalAmount?: number;
|
|
2512
|
+
currency?: string;
|
|
2513
|
+
}
|
|
2514
|
+
interface OfflineCertificate {
|
|
2515
|
+
privateKeyPem: string;
|
|
2516
|
+
certificateSerial: string;
|
|
2517
|
+
password?: string;
|
|
2518
|
+
}
|
|
2519
|
+
interface MaintenanceWindow {
|
|
2520
|
+
id: string;
|
|
2521
|
+
startTime: string;
|
|
2522
|
+
endTime?: string;
|
|
2523
|
+
active: boolean;
|
|
2524
|
+
planned: boolean;
|
|
2525
|
+
reason?: string;
|
|
2526
|
+
}
|
|
2527
|
+
interface OfflineInvoiceMetadata {
|
|
2528
|
+
id: string;
|
|
2529
|
+
mode: OfflineMode;
|
|
2530
|
+
reason: OfflineReason;
|
|
2531
|
+
status: OfflineInvoiceStatus;
|
|
2532
|
+
invoiceNumber: string;
|
|
2533
|
+
invoiceDate: string;
|
|
2534
|
+
invoiceXml: string;
|
|
2535
|
+
sellerNip: string;
|
|
2536
|
+
sellerIdentifier: ContextIdentifier;
|
|
2537
|
+
buyerIdentifier?: ContextIdentifier;
|
|
2538
|
+
totalAmount?: number;
|
|
2539
|
+
currency?: string;
|
|
2540
|
+
kod1Url: string;
|
|
2541
|
+
kod2Url?: string;
|
|
2542
|
+
generatedAt: string;
|
|
2543
|
+
submitBy: string;
|
|
2544
|
+
submittedAt?: string;
|
|
2545
|
+
acceptedAt?: string;
|
|
2546
|
+
ksefReferenceNumber?: string;
|
|
2547
|
+
error?: {
|
|
2548
|
+
code: number;
|
|
2549
|
+
message: string;
|
|
2550
|
+
details?: string[];
|
|
2551
|
+
};
|
|
2552
|
+
maintenanceWindowId?: string;
|
|
2553
|
+
correctedInvoiceId?: string;
|
|
2554
|
+
correctedBy?: string;
|
|
2555
|
+
}
|
|
2556
|
+
interface OfflineInvoiceOptions {
|
|
2557
|
+
mode?: OfflineMode;
|
|
2558
|
+
certificate?: OfflineCertificate;
|
|
2559
|
+
maintenanceWindow?: MaintenanceWindow;
|
|
2560
|
+
customDeadline?: Date | string;
|
|
2561
|
+
storage?: OfflineInvoiceStorage;
|
|
2562
|
+
}
|
|
2563
|
+
interface OfflineBatchResult {
|
|
2564
|
+
total: number;
|
|
2565
|
+
submitted: number;
|
|
2566
|
+
accepted: number;
|
|
2567
|
+
rejected: number;
|
|
2568
|
+
failed: number;
|
|
2569
|
+
expired: number;
|
|
2570
|
+
results: OfflineSubmissionResult[];
|
|
2571
|
+
}
|
|
2572
|
+
interface OfflineSubmissionResult {
|
|
2573
|
+
invoiceId: string;
|
|
2574
|
+
invoiceNumber: string;
|
|
2575
|
+
status: OfflineInvoiceStatus;
|
|
2576
|
+
ksefReferenceNumber?: string;
|
|
2577
|
+
error?: {
|
|
2578
|
+
code: number;
|
|
2579
|
+
message: string;
|
|
2580
|
+
details?: string[];
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
interface SubmitOfflineInvoicesOptions {
|
|
2585
|
+
storage: OfflineInvoiceStorage;
|
|
2586
|
+
invoiceIds?: string[];
|
|
2587
|
+
checkExpiry?: boolean;
|
|
2588
|
+
formCode?: FormCode;
|
|
2589
|
+
}
|
|
2590
|
+
interface TechnicalCorrectionOptions {
|
|
2591
|
+
rejectedInvoiceId: string;
|
|
2592
|
+
correctedInvoiceXml: string;
|
|
2593
|
+
storage: OfflineInvoiceStorage;
|
|
2594
|
+
formCode?: FormCode;
|
|
2595
|
+
certificate?: OfflineCertificate;
|
|
2596
|
+
}
|
|
2597
|
+
declare class OfflineInvoiceWorkflow {
|
|
2598
|
+
private readonly qrService;
|
|
2599
|
+
constructor(qrService: VerificationLinkService);
|
|
2600
|
+
generate(input: OfflineInvoiceInputData, options?: OfflineInvoiceOptions): Promise<OfflineInvoiceMetadata>;
|
|
2601
|
+
submit(client: KSeFClient, options: SubmitOfflineInvoicesOptions): Promise<OfflineBatchResult>;
|
|
2602
|
+
correct(client: KSeFClient, options: TechnicalCorrectionOptions): Promise<OfflineSubmissionResult>;
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2458
2605
|
declare class KSeFClient {
|
|
2459
2606
|
readonly auth: AuthService;
|
|
2460
2607
|
readonly activeSessions: ActiveSessionsService;
|
|
@@ -2473,7 +2620,9 @@ declare class KSeFClient {
|
|
|
2473
2620
|
readonly qr: VerificationLinkService;
|
|
2474
2621
|
readonly options: ResolvedOptions;
|
|
2475
2622
|
readonly authManager: AuthManager;
|
|
2623
|
+
private _offline?;
|
|
2476
2624
|
constructor(options?: KSeFClientOptions);
|
|
2625
|
+
get offline(): OfflineInvoiceWorkflow;
|
|
2477
2626
|
loginWithToken(token: string, nip: string): Promise<void>;
|
|
2478
2627
|
loginWithCertificate(certPem: string, keyPem: string, nip: string, keyPassword?: string): Promise<void>;
|
|
2479
2628
|
loginWithPkcs12(p12: Buffer | Uint8Array, password: string, nip: string): Promise<void>;
|
|
@@ -2615,4 +2764,53 @@ interface ExternalSignatureAuthOptions {
|
|
|
2615
2764
|
declare function authenticateWithExternalSignature(client: KSeFClient, options: ExternalSignatureAuthOptions): Promise<AuthResult>;
|
|
2616
2765
|
declare function authenticateWithPkcs12(client: KSeFClient, options: Pkcs12AuthOptions): Promise<AuthResult>;
|
|
2617
2766
|
|
|
2618
|
-
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, type ForbiddenProblemDetails, type ForbiddenReasonCode, type FormCode, type FormType, type GrantPermissionsAuthorizationRequest, type GrantPermissionsEntityRequest, type GrantPermissionsEuEntityAdminRequest, type GrantPermissionsEuEntityRepresentativeRequest, type GrantPermissionsEuEntityRequest, type GrantPermissionsIndirectRequest, type GrantPermissionsPersonRequest, type GrantPermissionsSubunitRequest, type HttpMethod, type HwmStore, INVOICE_TYPES_BY_SYSTEM_CODE, type IdDocument, InMemoryHwmStore, type IncrementalExportOptions, type IncrementalExportResult, type IndirectPermissionType, type IndirectPermissionsSubjectIdentifier, type IndirectPermissionsSubjectIdentifierType, type IndirectPermissionsTargetIdentifier, type IndirectPermissionsTargetIdentifierType, InternalId, InvoiceDownloadService, type InvoiceExportPackage, type InvoiceExportPackagePart, type InvoiceExportRequest, type InvoiceExportStatusResponse, type InvoiceMetadata, type InvoiceMetadataAuthorizedSubject, type InvoiceMetadataBuyer, type InvoiceMetadataBuyerIdentifier, type InvoiceMetadataSeller, type InvoiceMetadataThirdSubject, type InvoiceMetadataThirdSubjectIdentifier, type InvoicePermissionType, type InvoiceQueryAmount, type InvoiceQueryBuyerIdentifier, type InvoiceQueryDateRange, type InvoiceQueryDateType, InvoiceQueryFilterBuilder, type InvoiceQueryFilters, type InvoiceStatusInfo, type InvoiceSubjectType, type InvoiceType, type InvoiceValidationError, type InvoiceValidationErrorCode, type InvoiceValidationResult, type InvoicingMode, Ip4Address, Ip4Mask, Ip4Range, KSEF_FEATURE_HEADER, KSeFApiError, KSeFAuthStatusError, KSeFClient, type KSeFClientOptions, KSeFError, KSeFForbiddenError, KSeFRateLimitError, KSeFSessionExpiredError, type KSeFTokenContext, KSeFUnauthorizedError, KSeFValidationError, type KsefMessagesResponse, KsefNumber, KsefNumberV35, KsefNumberV36, type KsefStatusResponse, type KsefSystemStatus, type KsefTokenPermissionType, type KsefTokenRequest, type KsefTokenResponse, type KsefTokenStatus, type LighthouseMessage, LighthouseService, LimitsService, Nip, NipVatUe, type OnlineSessionContextLimitsOverride, type OnlineSessionEffectiveContextLimits, type OnlineSessionFormCode, type OnlineSessionHandle, OnlineSessionService, type OpenBatchSessionRequest, type OpenBatchSessionResponse, type OpenOnlineSessionOptions, type OpenOnlineSessionRequest, type OpenOnlineSessionResponse, type OperationResponse, type OperationStatusInfo, PERMISSION_DESCRIPTION_MAX_LENGTH, PERMISSION_DESCRIPTION_MIN_LENGTH, type PagedAuthorizationsResponse, type PagedPermissionsResponse, type PagedRolesResponse, type ParsedBatchUploadResult, type ParsedUpoInfo, type PartUploadRequest, PeppolId, type PeppolProvider, PeppolService, type PermissionState, type PermissionSubjectIdentifierType, type PermissionWithDelegate, type PermissionsAttachmentAllowedResponse, type PermissionsEuEntityDetails, type PermissionsOperationStatusResponse, PermissionsService, type PermissionsSubjectEntityByFingerprintDetails, type PermissionsSubjectEntityByIdentifierDetails, type PermissionsSubjectEntityDetails, type PermissionsSubjectPersonByFingerprintDetails, type PermissionsSubjectPersonDetails, type PersonByFingerprintWithIdentifierDetails, type PersonByFingerprintWithoutIdentifierDetails, type PersonByIdentifierDetails, type PersonCreateRequest, type PersonIdentifier, type PersonIdentifierType, type PersonPermission, PersonPermissionGrantBuilder, type PersonPermissionSubjectDetails, type PersonPermissionType, type PersonPermissionsAuthorIdentifier, type PersonPermissionsAuthorIdentifierType, type PersonPermissionsAuthorizedIdentifier, type PersonPermissionsAuthorizedIdentifierType, type PersonPermissionsContextIdentifier, type PersonPermissionsContextIdentifierType, type PersonPermissionsQueryType, type PersonPermissionsTargetIdentifier, type PersonPermissionsTargetIdentifierType, type PersonRemoveRequest, type PersonSubjectByFingerprintDetailsType, type PersonSubjectDetailsType, type PersonSubjectIdentifier, type PersonalPermission, type PersonalPermissionScopeType, type PersonalPermissionsAuthorizedIdentifier, type PersonalPermissionsAuthorizedIdentifierType, type PersonalPermissionsContextIdentifier, type PersonalPermissionsContextIdentifierType, type PersonalPermissionsTargetIdentifier, type PersonalPermissionsTargetIdentifierType, Pesel, type Pkcs12AuthOptions, Pkcs12Loader, type Pkcs12Result, type PollOptions, type PresignedUrlPolicy, type PublicKeyCertificate, type PublicKeyCertificateUsage, type QRCodeContextIdentifierType, type QrCodeOptions, type QrCodeResult, QrCodeService, type QueryAuthorizationsGrantsRequest, type QueryCertificatesRequest, type QueryCertificatesResponse, type QueryEntitiesGrantsRequest, type QueryEntitiesRolesRequest, type QueryEuEntitiesGrantsRequest, type QueryInvoicesMetadataResponse, type QueryKsefTokensOptions, type QueryKsefTokensResponse, type QueryPeppolProvidersResponse, type QueryPersonalGrantsRequest, type QueryPersonsGrantsRequest, type QuerySubordinateEntitiesRolesRequest, type QuerySubunitsGrantsRequest, type QueryTokensResponseItem, REQUIRED_CHALLENGE_LENGTH, type RateLimitConfig, RateLimitPolicy, ReferenceNumber, type ResolvedOptions, RestClient, RestRequest, type RestResponse, type RetrieveCertificatesListItem, type RetrieveCertificatesRequest, type RetrieveCertificatesResponse, type RetryPolicy, type RevokeCertificateRequest, RouteBuilder, Routes, SUBUNIT_NAME_MAX_LENGTH, SUBUNIT_NAME_MIN_LENGTH, SchemaRegistry, type SelfSignedCertificateResult, type SendAndCloseOptions, type SendInvoiceRequest, type SendInvoiceResponse, type SessionInvoiceStatusResponse, type SessionInvoicesResponse, type SessionStatus, type SessionStatusResponse, SessionStatusService, type SessionType, type SessionsFilter, type SessionsQueryResponse, type SessionsQueryResponseItem, type SetRateLimitsRequest, type SetSessionLimitsRequest, type SetSubjectLimitsRequest, Sha256Base64, SignatureService, type SortOrder, type StatusInfo, type SubjectCreateRequest, type SubjectRemoveRequest, type SubjectType, type SubordinateEntityRole, type SubordinateEntityRoleType, type SubordinateRoleSubordinateEntityIdentifier, type SubordinateRoleSubordinateEntityIdentifierType, type Subunit, type SubunitPermission, type SubunitPermissionScope, type SubunitPermissionsAuthorIdentifier, type SubunitPermissionsAuthorIdentifierType, type SubunitPermissionsAuthorizedIdentifier, type SubunitPermissionsContextIdentifier, type SubunitPermissionsContextIdentifierType, type SubunitPermissionsSubjectIdentifier, type SubunitPermissionsSubjectIdentifierType, type SubunitPermissionsSubunitIdentifier, type SubunitPermissionsSubunitIdentifierType, SystemCode, type TestDataAuthenticationContextIdentifier, type TestDataAuthenticationContextIdentifierType, type TestDataAuthorizedIdentifier, type TestDataAuthorizedIdentifierType, type TestDataContextIdentifier, type TestDataContextIdentifierType, type TestDataPermission, type TestDataPermissionType, type TestDataPermissionsGrantRequest, type TestDataPermissionsRevokeRequest, TestDataService, type ThirdSubjectIdentifierType, type TokenAuthOptions, type TokenAuthorIdentifier, type TokenAuthorIdentifierType, type TokenContextIdentifier, type TokenContextIdentifierType, type TokenInfo, TokenService, type TokenStatusResponse, type TransportFn, type UnauthorizedProblemDetails, type UnblockContextAuthenticationRequest, type UnzipOptions, type UpoAuthProof, type UpoContextId, type UpoDokument, type UpoInfo, type UpoOpisPotwierdzenia, type UpoPage, type UpoPotwierdzenie, type UpoResponse, type UpoResult, type UpoUwierzytelnienie, UpoVersion, UpoVersion as UpoVersionType, type ValidateOptions, type ValidationDetail, VatUe, VerificationLinkService, type X500NameFields, type XadesSubjectIdentifierType, type XmlConversionResult, type ZipEntryInput, authenticateWithCertificate, authenticateWithExternalSignature, authenticateWithPkcs12, authenticateWithToken, batchValidationDetails, buildUnsignedAuthTokenRequestXml, calculateBackoff, createZip, decodeJwtPayload, deduplicateByKsefNumber, defaultPresignedUrlPolicy, defaultRateLimitPolicy, defaultRetryPolicy, defaultTransport, exportAndDownload, exportInvoices, getEffectiveStartDate, getFormCode, incrementalExportAndDownload, isRetryableError, isRetryableStatus, isValidBase64, isValidCertificateFingerprint, isValidCertificateName, isValidInternalId, isValidIp4Address, isValidKsefNumber, isValidKsefNumberV35, isValidKsefNumberV36, isValidNip, isValidNipVatUe, isValidPeppolId, isValidPesel, isValidReferenceNumber, isValidSha256Base64, isValidVatUe, openOnlineSession, openSendAndClose, parseFormCode, parseKSeFTokenContext, parseRetryAfter, parseUpoXml, pollUntil, resolveOptions, sleep, unzip, updateContinuationPoint, uploadBatch, uploadBatchParsed, uploadBatchStream, uploadBatchStreamParsed, validate, validateBatch, validateBusinessRules, validateFormCodeForSession, validatePresignedUrl, validateSchema, validateWellFormedness, xmlToObject };
|
|
2767
|
+
/**
|
|
2768
|
+
* Offline invoice deadline calculation.
|
|
2769
|
+
*
|
|
2770
|
+
* All business-day arithmetic uses UTC methods (getUTCDay, setUTCDate).
|
|
2771
|
+
* KSeF deadlines are specified as calendar dates, not wall-clock times,
|
|
2772
|
+
* so UTC produces correct results for date-only calculations regardless
|
|
2773
|
+
* of the caller's timezone. The endOfDay() helper sets 23:59:59.999 UTC
|
|
2774
|
+
* as a conservative cutoff.
|
|
2775
|
+
*/
|
|
2776
|
+
|
|
2777
|
+
declare function getDefaultReason(mode: OfflineMode): OfflineReason;
|
|
2778
|
+
declare function nextBusinessDay(from: Date): Date;
|
|
2779
|
+
declare function addBusinessDays(from: Date, days: number): Date;
|
|
2780
|
+
/**
|
|
2781
|
+
* Calculate submission deadline for offline invoice.
|
|
2782
|
+
*
|
|
2783
|
+
* - offline24: next business day after invoiceDate
|
|
2784
|
+
* - offline: next business day after maintenance window ends
|
|
2785
|
+
* - awaryjny: 7 business days after maintenance window ends
|
|
2786
|
+
* - awaria_calkowita: far-future (obligation suspended)
|
|
2787
|
+
*/
|
|
2788
|
+
declare function calculateOfflineDeadline(mode: OfflineMode, invoiceDate: Date | string, maintenanceWindow?: MaintenanceWindow): Date;
|
|
2789
|
+
/**
|
|
2790
|
+
* Extend deadline when a new maintenance window cascades.
|
|
2791
|
+
* Returns the new deadline if maintenance ends after current deadline, otherwise keeps current.
|
|
2792
|
+
*/
|
|
2793
|
+
declare function extendDeadlineForMaintenance(currentDeadline: Date | string, maintenanceWindow: MaintenanceWindow, mode?: OfflineMode): Date;
|
|
2794
|
+
declare function isExpired(submitBy: Date | string): boolean;
|
|
2795
|
+
declare function getTimeUntilDeadline(submitBy: Date | string): number;
|
|
2796
|
+
|
|
2797
|
+
declare class FileOfflineInvoiceStorage implements OfflineInvoiceStorage {
|
|
2798
|
+
private readonly dir;
|
|
2799
|
+
constructor(directory?: string);
|
|
2800
|
+
private ensureDir;
|
|
2801
|
+
private filePath;
|
|
2802
|
+
save(invoice: OfflineInvoiceMetadata): Promise<void>;
|
|
2803
|
+
get(id: string): Promise<OfflineInvoiceMetadata | null>;
|
|
2804
|
+
list(filter?: OfflineInvoiceFilter): Promise<OfflineInvoiceMetadata[]>;
|
|
2805
|
+
/**
|
|
2806
|
+
* Update invoice metadata (read-modify-write).
|
|
2807
|
+
*
|
|
2808
|
+
* Note: No file locking — concurrent updates to the same ID may cause
|
|
2809
|
+
* lost writes. Acceptable for CLI (single process). Library consumers
|
|
2810
|
+
* running parallel operations should use external locking.
|
|
2811
|
+
*/
|
|
2812
|
+
update(id: string, updates: OfflineInvoiceUpdates): Promise<void>;
|
|
2813
|
+
delete(id: string): Promise<void>;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
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 };
|