ksef-client-ts 0.9.1 → 0.10.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.cjs CHANGED
@@ -30,13 +30,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // node_modules/tsup/assets/cjs_shims.js
34
- var getImportMetaUrl, importMetaUrl;
33
+ // ../../node_modules/tsup/assets/cjs_shims.js
35
34
  var init_cjs_shims = __esm({
36
- "node_modules/tsup/assets/cjs_shims.js"() {
35
+ "../../node_modules/tsup/assets/cjs_shims.js"() {
37
36
  "use strict";
38
- getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
39
- importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
40
37
  }
41
38
  });
42
39
 
@@ -610,21 +607,21 @@ var init_rest_request = __esm({
610
607
  _query = [];
611
608
  _presigned = false;
612
609
  _skipAuthRetry = false;
613
- constructor(method, path3) {
610
+ constructor(method, path) {
614
611
  this.method = method;
615
- this.path = path3;
612
+ this.path = path;
616
613
  }
617
- static get(path3) {
618
- return new _RestRequest("GET", path3);
614
+ static get(path) {
615
+ return new _RestRequest("GET", path);
619
616
  }
620
- static post(path3) {
621
- return new _RestRequest("POST", path3);
617
+ static post(path) {
618
+ return new _RestRequest("POST", path);
622
619
  }
623
- static put(path3) {
624
- return new _RestRequest("PUT", path3);
620
+ static put(path) {
621
+ return new _RestRequest("PUT", path);
625
622
  }
626
- static delete(path3) {
627
- return new _RestRequest("DELETE", path3);
623
+ static delete(path) {
624
+ return new _RestRequest("DELETE", path);
628
625
  }
629
626
  body(data) {
630
627
  this._body = data;
@@ -988,13 +985,13 @@ var init_rest_client = __esm({
988
985
  }
989
986
  throw lastError;
990
987
  }
991
- recordCircuitOutcome(path3, status) {
988
+ recordCircuitOutcome(path, status) {
992
989
  if (!this.circuitBreakerPolicy) return;
993
990
  if (status >= 500) {
994
- this.circuitBreakerPolicy.recordFailure(path3);
991
+ this.circuitBreakerPolicy.recordFailure(path);
995
992
  return;
996
993
  }
997
- this.circuitBreakerPolicy.recordSuccess(path3);
994
+ this.circuitBreakerPolicy.recordSuccess(path);
998
995
  }
999
996
  async doRequest(request, url, overrideToken) {
1000
997
  const headers = {
@@ -1031,9 +1028,9 @@ var init_rest_client = __esm({
1031
1028
  return response;
1032
1029
  }
1033
1030
  buildUrl(request) {
1034
- const path3 = this.routeBuilder.build(request.path);
1031
+ const path = this.routeBuilder.build(request.path);
1035
1032
  const base = this.options.baseUrl;
1036
- const url = new URL(`${base}${path3}`);
1033
+ const url = new URL(`${base}${path}`);
1037
1034
  const query = request.getQuery();
1038
1035
  for (const [key, value] of query) {
1039
1036
  url.searchParams.append(key, value);
@@ -2885,11 +2882,6 @@ var init_schemas = __esm({
2885
2882
  "src/validation/schemas/index.ts"() {
2886
2883
  "use strict";
2887
2884
  init_cjs_shims();
2888
- init_fa3();
2889
- init_fa2();
2890
- init_fa_rr1();
2891
- init_pef3();
2892
- init_pef_kor3();
2893
2885
  NAMESPACE_MAP = {
2894
2886
  "http://crd.gov.pl/wzor/2025/06/25/13775/": "FA3",
2895
2887
  "http://crd.gov.pl/wzor/2023/06/29/12648/": "FA2",
@@ -3145,11 +3137,11 @@ async function validateSchema(xml, options, _parsed) {
3145
3137
  const prefix = rootElement ? `/${rootElement}/` : "/";
3146
3138
  const validationErrors = result.error.issues.map((issue) => {
3147
3139
  const zodPath = issue.path.join("/");
3148
- const path3 = zodPath ? `${prefix}${zodPath}` : rootElement ? `/${rootElement}` : void 0;
3140
+ const path = zodPath ? `${prefix}${zodPath}` : rootElement ? `/${rootElement}` : void 0;
3149
3141
  return {
3150
3142
  code: mapZodErrorCode(issue),
3151
3143
  message: issue.message,
3152
- path: path3
3144
+ path
3153
3145
  };
3154
3146
  });
3155
3147
  return { valid: false, schemaType, errors: validationErrors };
@@ -3189,9 +3181,9 @@ function validateBusinessRules(xml, _parsed) {
3189
3181
  collectDateErrors(object, rootElement, errors);
3190
3182
  return { valid: errors.length === 0, schemaType, errors };
3191
3183
  }
3192
- function collectNipPeselErrors(obj, path3, errors) {
3184
+ function collectNipPeselErrors(obj, path, errors) {
3193
3185
  for (const [key, value] of Object.entries(obj)) {
3194
- const currentPath = path3 ? `${path3}/${key}` : key;
3186
+ const currentPath = path ? `${path}/${key}` : key;
3195
3187
  if (key === "NIP" && typeof value === "string") {
3196
3188
  if (!isValidNip(value)) {
3197
3189
  errors.push({
@@ -4146,20 +4138,20 @@ var init_lighthouse = __esm({
4146
4138
  this.lighthouseUrl = options.lighthouseUrl;
4147
4139
  this.timeout = options.timeout;
4148
4140
  }
4149
- async fetchJson(path3) {
4141
+ async fetchJson(path) {
4150
4142
  if (!this.lighthouseUrl) {
4151
4143
  throw new KSeFError(
4152
4144
  "Lighthouse API is not available for the DEMO environment. Use TEST or PROD instead."
4153
4145
  );
4154
4146
  }
4155
- const response = await fetch(`${this.lighthouseUrl}${path3}`, {
4147
+ const response = await fetch(`${this.lighthouseUrl}${path}`, {
4156
4148
  headers: { Accept: "application/json" },
4157
4149
  signal: AbortSignal.timeout(this.timeout)
4158
4150
  });
4159
4151
  if (!response.ok) {
4160
4152
  const body = await response.text();
4161
4153
  throw new KSeFError(
4162
- `Lighthouse ${path3} failed: HTTP ${response.status} \u2014 ${body}`
4154
+ `Lighthouse ${path} failed: HTTP ${response.status} \u2014 ${body}`
4163
4155
  );
4164
4156
  }
4165
4157
  return await response.json();
@@ -5130,6 +5122,7 @@ var init_verification_link_service = __esm({
5130
5122
  constructor(baseQrUrl) {
5131
5123
  this.baseQrUrl = baseQrUrl;
5132
5124
  }
5125
+ baseQrUrl;
5133
5126
  /**
5134
5127
  * Build invoice verification URL (Code I).
5135
5128
  * Format: {baseQrUrl}/invoice/{NIP}/{DD-MM-YYYY}/{hash_base64url}
@@ -5610,6 +5603,7 @@ var init_offline_invoice_workflow = __esm({
5610
5603
  constructor(qrService) {
5611
5604
  this.qrService = qrService;
5612
5605
  }
5606
+ qrService;
5613
5607
  async generate(input, options) {
5614
5608
  if (!input.invoiceXml || input.invoiceXml.trim().length === 0) {
5615
5609
  throw new Error("invoiceXml must not be empty");
@@ -6115,11 +6109,8 @@ __export(index_exports, {
6115
6109
  EntityPermissionGrantBuilder: () => EntityPermissionGrantBuilder,
6116
6110
  Environment: () => Environment,
6117
6111
  FAKTURA_NAMESPACE: () => FAKTURA_NAMESPACE,
6118
- FA_XSD_PATHS: () => FA_XSD_PATHS,
6119
6112
  FORM_CODES: () => FORM_CODES,
6120
6113
  FORM_CODE_KEYS: () => FORM_CODE_KEYS,
6121
- FileHwmStore: () => FileHwmStore,
6122
- FileOfflineInvoiceStorage: () => FileOfflineInvoiceStorage,
6123
6114
  INVOICE_TYPES_BY_SYSTEM_CODE: () => INVOICE_TYPES_BY_SYSTEM_CODE,
6124
6115
  InMemoryHwmStore: () => InMemoryHwmStore,
6125
6116
  InMemoryOfflineInvoiceStorage: () => InMemoryOfflineInvoiceStorage,
@@ -6158,7 +6149,6 @@ __export(index_exports, {
6158
6149
  OfflineInvoiceWorkflow: () => OfflineInvoiceWorkflow,
6159
6150
  OnlineSessionService: () => OnlineSessionService,
6160
6151
  PEF_NAMESPACE: () => PEF_NAMESPACE,
6161
- PEF_XSD_PATHS: () => PEF_XSD_PATHS,
6162
6152
  PERMISSION_DESCRIPTION_MAX_LENGTH: () => PERMISSION_DESCRIPTION_MAX_LENGTH,
6163
6153
  PERMISSION_DESCRIPTION_MIN_LENGTH: () => PERMISSION_DESCRIPTION_MIN_LENGTH,
6164
6154
  PeppolId: () => PeppolId,
@@ -6227,7 +6217,6 @@ __export(index_exports, {
6227
6217
  isExpired: () => isExpired,
6228
6218
  isFakturaInput: () => isFakturaInput,
6229
6219
  isFormCodeShape: () => isFormCodeShape,
6230
- isMissingLibxmljsError: () => isMissingLibxmljsError,
6231
6220
  isPefUblDocumentInput: () => isPefUblDocumentInput,
6232
6221
  isPolishHoliday: () => isPolishHoliday,
6233
6222
  isRetryableError: () => isRetryableError,
@@ -6248,7 +6237,6 @@ __export(index_exports, {
6248
6237
  isValidReferenceNumber: () => isValidReferenceNumber,
6249
6238
  isValidSha256Base64: () => isValidSha256Base64,
6250
6239
  isValidVatUe: () => isValidVatUe,
6251
- libxmljsAvailable: () => libxmljsAvailable,
6252
6240
  nextBusinessDay: () => nextBusinessDay,
6253
6241
  openOnlineSession: () => openOnlineSession,
6254
6242
  openSendAndClose: () => openSendAndClose,
@@ -6261,7 +6249,6 @@ __export(index_exports, {
6261
6249
  pollUntil: () => pollUntil,
6262
6250
  queryAllInvoiceMetadata: () => queryAllInvoiceMetadata,
6263
6251
  resolveOptions: () => resolveOptions,
6264
- resolveXsdFor: () => resolveXsdFor,
6265
6252
  resumeOnlineSession: () => resumeOnlineSession,
6266
6253
  runWithConcurrency: () => runWithConcurrency,
6267
6254
  serializeInvoiceXml: () => serializeInvoiceXml,
@@ -6276,7 +6263,6 @@ __export(index_exports, {
6276
6263
  uploadBatchStream: () => uploadBatchStream,
6277
6264
  uploadBatchStreamParsed: () => uploadBatchStreamParsed,
6278
6265
  validate: () => validate,
6279
- validateAgainstXsd: () => validateAgainstXsd,
6280
6266
  validateBatch: () => validateBatch,
6281
6267
  validateBusinessRules: () => validateBusinessRules,
6282
6268
  validateCharValidity: () => validateCharValidity,
@@ -6326,219 +6312,6 @@ init_schema_registry();
6326
6312
  init_invoice_validator();
6327
6313
  init_char_validity();
6328
6314
 
6329
- // src/validation/xsd-validator.ts
6330
- init_cjs_shims();
6331
- var import_node_module = require("node:module");
6332
- var fs = __toESM(require("node:fs"), 1);
6333
- var path = __toESM(require("node:path"), 1);
6334
- var import_node_url = require("node:url");
6335
- var cachedPkgRoot = null;
6336
- function locatePackageRoot() {
6337
- if (cachedPkgRoot !== null) return cachedPkgRoot;
6338
- let dir = path.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
6339
- const root = path.parse(dir).root;
6340
- while (dir !== root) {
6341
- const candidate = path.join(dir, "docs", "schemas");
6342
- if (fs.existsSync(candidate)) {
6343
- cachedPkgRoot = dir;
6344
- return dir;
6345
- }
6346
- dir = path.dirname(dir);
6347
- }
6348
- throw new Error("Could not locate ksef-client-ts package root (docs/schemas not found).");
6349
- }
6350
- var XSD_RELATIVE = {
6351
- FA2: ["FA", "schemat_FA(2)_v1-0E.xsd"],
6352
- FA3: ["FA", "schemat_FA(3)_v1-0E.xsd"],
6353
- PEF: ["PEF", "Schemat_PEF(3)_v2-1.xsd"],
6354
- PEF_KOR: ["PEF", "Schemat_PEF_KOR(3)_v2-1.xsd"]
6355
- };
6356
- var FA_XSD_PATHS = {
6357
- get FA2() {
6358
- return resolveXsdFor("FA2");
6359
- },
6360
- get FA3() {
6361
- return resolveXsdFor("FA3");
6362
- }
6363
- };
6364
- var PEF_XSD_PATHS = {
6365
- get PEF() {
6366
- return resolveXsdFor("PEF");
6367
- },
6368
- get PEF_KOR() {
6369
- return resolveXsdFor("PEF_KOR");
6370
- }
6371
- };
6372
- function resolveXsdFor(schema) {
6373
- const rel = XSD_RELATIVE[schema];
6374
- if (!rel) throw new Error(`Unknown invoice schema: ${String(schema)}`);
6375
- return path.join(locatePackageRoot(), "docs", "schemas", ...rel);
6376
- }
6377
- var requireModule = (0, import_node_module.createRequire)(importMetaUrl);
6378
- var libxmljs = null;
6379
- var libxmljsLoadError = null;
6380
- try {
6381
- libxmljs = requireModule("libxmljs2");
6382
- } catch (err) {
6383
- const code = err?.code;
6384
- if (code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND") {
6385
- libxmljs = null;
6386
- } else {
6387
- libxmljs = null;
6388
- libxmljsLoadError = err instanceof Error ? err : new Error(String(err));
6389
- }
6390
- }
6391
- var libxmljsAvailable = libxmljs !== null;
6392
- var MISSING_LIBXMLJS_MESSAGE_PREFIX = "libxmljs2 is not installed";
6393
- function isMissingLibxmljsError(err) {
6394
- return err instanceof Error && err.message.startsWith(MISSING_LIBXMLJS_MESSAGE_PREFIX);
6395
- }
6396
- var EXTERNAL_STRUKTURY_DANYCH_URL = /schemaLocation="http:\/\/crd\.gov\.pl\/xml\/schematy\/dziedzinowe\/mf\/2022\/01\/05\/eD\/DefinicjeTypy\/StrukturyDanych_v10-0E\.xsd"/;
6397
- function rewriteSchemaLocations(xsdContent) {
6398
- if (!EXTERNAL_STRUKTURY_DANYCH_URL.test(xsdContent)) {
6399
- return xsdContent;
6400
- }
6401
- const bazoweStrukturyPath = path.join(
6402
- locatePackageRoot(),
6403
- "docs",
6404
- "schemas",
6405
- "FA",
6406
- "bazowe",
6407
- "StrukturyDanych_v10-0E.xsd"
6408
- );
6409
- const bazoweStrukturyUrl = (0, import_node_url.pathToFileURL)(bazoweStrukturyPath).href;
6410
- const rewritten = xsdContent.replace(
6411
- EXTERNAL_STRUKTURY_DANYCH_URL,
6412
- `schemaLocation="${bazoweStrukturyUrl}"`
6413
- );
6414
- if (rewritten === xsdContent) {
6415
- throw new Error(
6416
- "FA XSD schemaLocation rewrite produced no replacement despite URL being present; regex likely out of sync with docs/schemas/FA/. Re-check after `yarn sync-schemas`."
6417
- );
6418
- }
6419
- return rewritten;
6420
- }
6421
- function validateAgainstXsd(xml, xsdPath) {
6422
- if (!libxmljs) {
6423
- const loadSuffix = libxmljsLoadError ? ` (load failed: ${libxmljsLoadError.message})` : "";
6424
- throw new Error(
6425
- `${MISSING_LIBXMLJS_MESSAGE_PREFIX}${loadSuffix}; cannot run XSD validation. Install it as an optional peer dependency (e.g. \`yarn add -O libxmljs2\` or \`npm i -O libxmljs2\`).`
6426
- );
6427
- }
6428
- const xsdDir = path.dirname(xsdPath);
6429
- const rawXsd = fs.readFileSync(xsdPath, "utf8");
6430
- const rewrittenXsd = rewriteSchemaLocations(rawXsd);
6431
- const baseUrl = (0, import_node_url.pathToFileURL)(xsdDir + path.sep).href;
6432
- let schemaDoc;
6433
- try {
6434
- schemaDoc = libxmljs.parseXml(rewrittenXsd, { baseUrl });
6435
- } catch (err) {
6436
- return { valid: false, errors: [`XSD parse failed: ${err.message}`] };
6437
- }
6438
- let xmlDoc;
6439
- try {
6440
- xmlDoc = libxmljs.parseXml(xml);
6441
- } catch (err) {
6442
- return { valid: false, errors: [`XML parse failed: ${err.message}`] };
6443
- }
6444
- const valid = xmlDoc.validate(schemaDoc);
6445
- const errors = valid ? [] : xmlDoc.validationErrors.map((err) => err.message.trim());
6446
- return { valid, errors };
6447
- }
6448
-
6449
- // src/models/index.ts
6450
- init_cjs_shims();
6451
-
6452
- // src/models/common.ts
6453
- init_cjs_shims();
6454
-
6455
- // src/models/auth/index.ts
6456
- init_cjs_shims();
6457
-
6458
- // src/models/auth/types.ts
6459
- init_cjs_shims();
6460
-
6461
- // src/models/auth/active-sessions-types.ts
6462
- init_cjs_shims();
6463
-
6464
- // src/models/sessions/index.ts
6465
- init_cjs_shims();
6466
-
6467
- // src/models/sessions/online-types.ts
6468
- init_cjs_shims();
6469
-
6470
- // src/models/sessions/batch-types.ts
6471
- init_cjs_shims();
6472
-
6473
- // src/models/sessions/status-types.ts
6474
- init_cjs_shims();
6475
-
6476
- // src/models/sessions/session-state.ts
6477
- init_cjs_shims();
6478
-
6479
- // src/models/invoices/index.ts
6480
- init_cjs_shims();
6481
-
6482
- // src/models/invoices/types.ts
6483
- init_cjs_shims();
6484
-
6485
- // src/models/permissions/index.ts
6486
- init_cjs_shims();
6487
-
6488
- // src/models/permissions/types.ts
6489
- init_cjs_shims();
6490
-
6491
- // src/models/tokens/index.ts
6492
- init_cjs_shims();
6493
-
6494
- // src/models/tokens/types.ts
6495
- init_cjs_shims();
6496
-
6497
- // src/models/certificates/index.ts
6498
- init_cjs_shims();
6499
-
6500
- // src/models/certificates/types.ts
6501
- init_cjs_shims();
6502
-
6503
- // src/models/lighthouse/index.ts
6504
- init_cjs_shims();
6505
-
6506
- // src/models/lighthouse/types.ts
6507
- init_cjs_shims();
6508
-
6509
- // src/models/limits/index.ts
6510
- init_cjs_shims();
6511
-
6512
- // src/models/limits/types.ts
6513
- init_cjs_shims();
6514
-
6515
- // src/models/peppol/index.ts
6516
- init_cjs_shims();
6517
-
6518
- // src/models/peppol/types.ts
6519
- init_cjs_shims();
6520
-
6521
- // src/models/test-data/index.ts
6522
- init_cjs_shims();
6523
-
6524
- // src/models/test-data/types.ts
6525
- init_cjs_shims();
6526
-
6527
- // src/models/crypto/index.ts
6528
- init_cjs_shims();
6529
-
6530
- // src/models/crypto/types.ts
6531
- init_cjs_shims();
6532
-
6533
- // src/models/qrcode/index.ts
6534
- init_cjs_shims();
6535
-
6536
- // src/models/qrcode/types.ts
6537
- init_cjs_shims();
6538
-
6539
- // src/models/index.ts
6540
- init_document_structures();
6541
-
6542
6315
  // src/services/index.ts
6543
6316
  init_cjs_shims();
6544
6317
  init_auth();
@@ -8456,7 +8229,6 @@ function buildDefaultFilters(subjectType, from, to) {
8456
8229
 
8457
8230
  // src/workflows/hwm-storage.ts
8458
8231
  init_cjs_shims();
8459
- var fs2 = __toESM(require("node:fs/promises"), 1);
8460
8232
  var InMemoryHwmStore = class {
8461
8233
  points = {};
8462
8234
  async load() {
@@ -8466,25 +8238,6 @@ var InMemoryHwmStore = class {
8466
8238
  this.points = { ...points };
8467
8239
  }
8468
8240
  };
8469
- var FileHwmStore = class {
8470
- constructor(filePath) {
8471
- this.filePath = filePath;
8472
- }
8473
- async load() {
8474
- try {
8475
- const data = await fs2.readFile(this.filePath, "utf-8");
8476
- return JSON.parse(data);
8477
- } catch (err) {
8478
- if (err.code === "ENOENT") {
8479
- return {};
8480
- }
8481
- throw err;
8482
- }
8483
- }
8484
- async save(points) {
8485
- await fs2.writeFile(this.filePath, JSON.stringify(points, null, 2), "utf-8");
8486
- }
8487
- };
8488
8241
 
8489
8242
  // src/workflows/auth-workflow.ts
8490
8243
  init_cjs_shims();
@@ -8708,98 +8461,6 @@ var InMemoryOfflineInvoiceStorage = class {
8708
8461
  }
8709
8462
  };
8710
8463
 
8711
- // src/offline/file-storage.ts
8712
- init_cjs_shims();
8713
- var fs3 = __toESM(require("node:fs/promises"), 1);
8714
- var path2 = __toESM(require("node:path"), 1);
8715
- var os = __toESM(require("node:os"), 1);
8716
- function resolveDir(dir) {
8717
- if (dir === "~" || dir.startsWith("~/")) {
8718
- return path2.join(os.homedir(), dir.slice(1));
8719
- }
8720
- return dir;
8721
- }
8722
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
8723
- function validateId(id) {
8724
- if (!UUID_RE.test(id)) {
8725
- throw new Error(`Invalid invoice ID: ${id}`);
8726
- }
8727
- }
8728
- var FileOfflineInvoiceStorage = class {
8729
- dir;
8730
- constructor(directory) {
8731
- this.dir = resolveDir(directory ?? "~/.ksef/offline");
8732
- }
8733
- async ensureDir() {
8734
- await fs3.mkdir(this.dir, { recursive: true });
8735
- }
8736
- filePath(id) {
8737
- validateId(id);
8738
- return path2.join(this.dir, `${id}.json`);
8739
- }
8740
- async save(invoice) {
8741
- await this.ensureDir();
8742
- const file = this.filePath(invoice.id);
8743
- const tmp = `${file}.tmp`;
8744
- await fs3.writeFile(tmp, JSON.stringify(invoice, null, 2));
8745
- await fs3.rename(tmp, file);
8746
- }
8747
- async get(id) {
8748
- const file = this.filePath(id);
8749
- try {
8750
- return JSON.parse(await fs3.readFile(file, "utf-8"));
8751
- } catch (err) {
8752
- if (err instanceof Error && "code" in err && err.code === "ENOENT") {
8753
- return null;
8754
- }
8755
- console.warn(`Warning: Failed to read offline invoice ${id}: ${err instanceof Error ? err.message : String(err)}`);
8756
- return null;
8757
- }
8758
- }
8759
- async list(filter) {
8760
- let files;
8761
- try {
8762
- files = (await fs3.readdir(this.dir)).filter((f) => f.endsWith(".json"));
8763
- } catch {
8764
- return [];
8765
- }
8766
- const results = [];
8767
- for (const file of files) {
8768
- try {
8769
- const data = JSON.parse(
8770
- await fs3.readFile(path2.join(this.dir, file), "utf-8")
8771
- );
8772
- if (!filter || matchesFilter(data, filter)) {
8773
- results.push(data);
8774
- }
8775
- } catch (err) {
8776
- console.warn(`Warning: Skipping corrupt offline invoice file ${file}: ${err instanceof Error ? err.message : String(err)}`);
8777
- }
8778
- }
8779
- return results;
8780
- }
8781
- /**
8782
- * Update invoice metadata (read-modify-write).
8783
- *
8784
- * Note: No file locking — concurrent updates to the same ID may cause
8785
- * lost writes. Acceptable for CLI (single process). Library consumers
8786
- * running parallel operations should use external locking.
8787
- */
8788
- async update(id, updates) {
8789
- const existing = await this.get(id);
8790
- if (!existing) throw new Error(`Offline invoice not found: ${id}`);
8791
- await this.save({ ...existing, ...updates });
8792
- }
8793
- async delete(id) {
8794
- const file = this.filePath(id);
8795
- try {
8796
- await fs3.unlink(file);
8797
- } catch (e) {
8798
- if (e instanceof Error && "code" in e && e.code !== "ENOENT") throw e;
8799
- }
8800
- }
8801
- };
8802
-
8803
8464
  // src/index.ts
8804
8465
  init_offline_invoice_workflow();
8805
8466
  init_client();
@@ -8834,11 +8495,8 @@ init_client();
8834
8495
  EntityPermissionGrantBuilder,
8835
8496
  Environment,
8836
8497
  FAKTURA_NAMESPACE,
8837
- FA_XSD_PATHS,
8838
8498
  FORM_CODES,
8839
8499
  FORM_CODE_KEYS,
8840
- FileHwmStore,
8841
- FileOfflineInvoiceStorage,
8842
8500
  INVOICE_TYPES_BY_SYSTEM_CODE,
8843
8501
  InMemoryHwmStore,
8844
8502
  InMemoryOfflineInvoiceStorage,
@@ -8877,7 +8535,6 @@ init_client();
8877
8535
  OfflineInvoiceWorkflow,
8878
8536
  OnlineSessionService,
8879
8537
  PEF_NAMESPACE,
8880
- PEF_XSD_PATHS,
8881
8538
  PERMISSION_DESCRIPTION_MAX_LENGTH,
8882
8539
  PERMISSION_DESCRIPTION_MIN_LENGTH,
8883
8540
  PeppolId,
@@ -8946,7 +8603,6 @@ init_client();
8946
8603
  isExpired,
8947
8604
  isFakturaInput,
8948
8605
  isFormCodeShape,
8949
- isMissingLibxmljsError,
8950
8606
  isPefUblDocumentInput,
8951
8607
  isPolishHoliday,
8952
8608
  isRetryableError,
@@ -8967,7 +8623,6 @@ init_client();
8967
8623
  isValidReferenceNumber,
8968
8624
  isValidSha256Base64,
8969
8625
  isValidVatUe,
8970
- libxmljsAvailable,
8971
8626
  nextBusinessDay,
8972
8627
  openOnlineSession,
8973
8628
  openSendAndClose,
@@ -8980,7 +8635,6 @@ init_client();
8980
8635
  pollUntil,
8981
8636
  queryAllInvoiceMetadata,
8982
8637
  resolveOptions,
8983
- resolveXsdFor,
8984
8638
  resumeOnlineSession,
8985
8639
  runWithConcurrency,
8986
8640
  serializeInvoiceXml,
@@ -8995,7 +8649,6 @@ init_client();
8995
8649
  uploadBatchStream,
8996
8650
  uploadBatchStreamParsed,
8997
8651
  validate,
8998
- validateAgainstXsd,
8999
8652
  validateBatch,
9000
8653
  validateBusinessRules,
9001
8654
  validateCharValidity,