@taxora/sdk 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to `@taxora/sdk` are documented here. Versions follow [SemVer](https://semver.org/).
4
4
 
5
+ ## [1.5.0] — 2026-10-22
6
+
7
+ ### Added
8
+
9
+ - **Smart Enrichment: `sourceUrl` and `registeredOwner`** on `SmartEnrichmentResource`. `sourceUrl` is the page
10
+ the VAT number was read from (usually the company's Impressum; only http(s) addresses are accepted).
11
+ `registeredOwner` names the person the tax authority has the VAT ID under when that is not the trading name —
12
+ typical for a German sole proprietorship (e.K.). `sourceUrls` lists every page the number was read from,
13
+ `sourceUrl` first (each research pass that found the same number contributes its page).
14
+
15
+ ### Changed
16
+
17
+ - Bundled OpenAPI specs (`resources/`) refreshed from the current API.
18
+
5
19
  ## [1.4.0] — 2026-10-21
6
20
 
7
21
  ### Added
package/README.md CHANGED
@@ -363,6 +363,13 @@ if (quality && quality.warnings.length > 0) {
363
363
  console.log(quality.warnings.join(', '), '→', quality.derivedPlace);
364
364
  }
365
365
 
366
+ // Where the number came from, and who it is registered to. `sourceUrl` is the page it was read
367
+ // from (usually the Impressum). `registeredOwner` is set when the tax authority has the VAT ID
368
+ // under a person rather than the trading name — a German e.K. — and confirmed it for them.
369
+ console.log(result?.sourceUrl ?? '—'); // e.g. 'https://example.de/impressum'
370
+ console.log(result?.sourceUrls.join(', ')); // every page it was found on, main one first
371
+ console.log(result?.registeredOwner ?? '—'); // e.g. 'Kevin Seibel'
372
+
366
373
  // 'not_found' doesn't always mean nothing turned up. When the research found a VAT number but
367
374
  // the official check threw it out (e.g. the tax authority reports it as invalid), the number
368
375
  // and the reason are in `rejectedCandidates` — no need to re-check it yourself.
package/dist/index.cjs CHANGED
@@ -2431,7 +2431,7 @@ function toRejectedCandidates(value) {
2431
2431
  return candidates;
2432
2432
  }
2433
2433
  var SmartEnrichmentResource = class _SmartEnrichmentResource {
2434
- constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = []) {
2434
+ constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = [], sourceUrl = void 0, registeredOwner = void 0, sourceUrls = []) {
2435
2435
  this.status = status;
2436
2436
  this.vatNumber = vatNumber;
2437
2437
  this.vatType = vatType;
@@ -2444,6 +2444,9 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2444
2444
  this.providerVerdicts = providerVerdicts;
2445
2445
  this.addressQuality = addressQuality;
2446
2446
  this.rejectedCandidates = rejectedCandidates;
2447
+ this.sourceUrl = sourceUrl;
2448
+ this.registeredOwner = registeredOwner;
2449
+ this.sourceUrls = sourceUrls;
2447
2450
  }
2448
2451
  status;
2449
2452
  vatNumber;
@@ -2457,6 +2460,9 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2457
2460
  providerVerdicts;
2458
2461
  addressQuality;
2459
2462
  rejectedCandidates;
2463
+ sourceUrl;
2464
+ registeredOwner;
2465
+ sourceUrls;
2460
2466
  /** True when a VAT number was found but rejected by the official check. */
2461
2467
  hasRejectedCandidates() {
2462
2468
  return this.rejectedCandidates.length > 0;
@@ -2466,6 +2472,13 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2466
2472
  const v = data[key];
2467
2473
  return typeof v === "string" ? v : void 0;
2468
2474
  };
2475
+ const text = (key) => {
2476
+ const v = str(key)?.trim();
2477
+ return v ? v : void 0;
2478
+ };
2479
+ const isWebUrl = (value) => typeof value === "string" && /^https?:\/\/\S+$/i.test(value.trim());
2480
+ const url = text("sourceUrl");
2481
+ const urls = data["sourceUrls"];
2469
2482
  const num = (key) => {
2470
2483
  const v = data[key];
2471
2484
  return typeof v === "number" ? v : void 0;
@@ -2484,7 +2497,10 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2484
2497
  toSmartEnrichmentMode(data["mode"]),
2485
2498
  Array.isArray(verdicts) ? verdicts.filter((v) => typeof v === "object" && v !== null) : [],
2486
2499
  typeof quality === "object" && quality !== null ? quality : void 0,
2487
- toRejectedCandidates(data["rejectedCandidates"])
2500
+ toRejectedCandidates(data["rejectedCandidates"]),
2501
+ url && isWebUrl(url) ? url : void 0,
2502
+ text("registeredOwner"),
2503
+ Array.isArray(urls) ? [...new Set(urls.filter(isWebUrl).map((u) => u.trim()))] : []
2488
2504
  );
2489
2505
  }
2490
2506
  toArray() {
@@ -2500,7 +2516,10 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2500
2516
  mode: this.mode ?? null,
2501
2517
  providerVerdicts: this.providerVerdicts,
2502
2518
  addressQuality: this.addressQuality ?? null,
2503
- rejectedCandidates: this.rejectedCandidates.map((c) => ({ vatNumber: c.vatNumber, reason: c.reason }))
2519
+ rejectedCandidates: this.rejectedCandidates.map((c) => ({ vatNumber: c.vatNumber, reason: c.reason })),
2520
+ sourceUrl: this.sourceUrl ?? null,
2521
+ registeredOwner: this.registeredOwner ?? null,
2522
+ sourceUrls: this.sourceUrls
2504
2523
  };
2505
2524
  }
2506
2525
  };
@@ -3778,7 +3797,7 @@ var AuthRetryHttpClient = class {
3778
3797
  };
3779
3798
 
3780
3799
  // src/version.ts
3781
- var SDK_VERSION = "1.4.0";
3800
+ var SDK_VERSION = "1.5.0";
3782
3801
 
3783
3802
  // src/http/SdkVersionHttpClient.ts
3784
3803
  var SDK_VERSION_HEADER = "X-Taxora-SDK-Version";