@taxora/sdk 1.5.0 → 1.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/CHANGELOG.md +14 -0
- package/README.md +11 -0
- package/dist/index.cjs +46 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.6.0] — 2026-10-22
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Smart Enrichment: `taxNumber`** — a domestic tax number (e.g. a German Steuernummer) a company's page shows
|
|
10
|
+
instead of a VAT ID. It is not a VAT ID; the lookup stays `not_found`.
|
|
11
|
+
- **Smart Enrichment: the official VAT check behind a found number** — `vatValid`, `aiScore`, `nameMatch`
|
|
12
|
+
(`'ok' | 'mismatch'`, plus `nameMismatch()`), `officialName` and `officialAddress`
|
|
13
|
+
(`SmartEnrichmentOfficialAddress`). Lets you write the register's name and address back into your records.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Bundled OpenAPI specs (`resources/`) refreshed from the current API.
|
|
18
|
+
|
|
5
19
|
## [1.5.0] — 2026-10-22
|
|
6
20
|
|
|
7
21
|
### Added
|
package/README.md
CHANGED
|
@@ -370,6 +370,17 @@ console.log(result?.sourceUrl ?? '—'); // e.g. 'https://example.de/impressum'
|
|
|
370
370
|
console.log(result?.sourceUrls.join(', ')); // every page it was found on, main one first
|
|
371
371
|
console.log(result?.registeredOwner ?? '—'); // e.g. 'Kevin Seibel'
|
|
372
372
|
|
|
373
|
+
// The official VAT check behind a found number. nameMatch 'mismatch' means the register has the
|
|
374
|
+
// number under a different name — another company, unless `registeredOwner` is set (an e.K. filed
|
|
375
|
+
// under its owner): then write officialName / officialAddress into your own records.
|
|
376
|
+
if (result?.nameMismatch()) {
|
|
377
|
+
console.log(result.officialName, result.officialAddress);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// A page that shows a tax number (Steuernummer) under the VAT ID heading is not a VAT ID:
|
|
381
|
+
// the lookup stays 'not_found' and the number comes back as `taxNumber`.
|
|
382
|
+
console.log(result?.taxNumber ?? '—');
|
|
383
|
+
|
|
373
384
|
// 'not_found' doesn't always mean nothing turned up. When the research found a VAT number but
|
|
374
385
|
// the official check threw it out (e.g. the tax authority reports it as invalid), the number
|
|
375
386
|
// and the reason are in `rejectedCandidates` — no need to re-check it yourself.
|
package/dist/index.cjs
CHANGED
|
@@ -2430,8 +2430,22 @@ function toRejectedCandidates(value) {
|
|
|
2430
2430
|
}
|
|
2431
2431
|
return candidates;
|
|
2432
2432
|
}
|
|
2433
|
+
function toOfficialAddress(value) {
|
|
2434
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
2435
|
+
return void 0;
|
|
2436
|
+
}
|
|
2437
|
+
const record = value;
|
|
2438
|
+
const address = {};
|
|
2439
|
+
for (const key of ["street", "postal_code", "city", "country"]) {
|
|
2440
|
+
const part = typeof record[key] === "string" ? record[key].trim() : "";
|
|
2441
|
+
if (part !== "") {
|
|
2442
|
+
address[key] = part;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
return Object.keys(address).length > 0 ? address : void 0;
|
|
2446
|
+
}
|
|
2433
2447
|
var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
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 = []) {
|
|
2448
|
+
constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = [], sourceUrl = void 0, registeredOwner = void 0, sourceUrls = [], taxNumber = void 0, vatValid = void 0, aiScore = void 0, nameMatch = void 0, officialName = void 0, officialAddress = void 0) {
|
|
2435
2449
|
this.status = status;
|
|
2436
2450
|
this.vatNumber = vatNumber;
|
|
2437
2451
|
this.vatType = vatType;
|
|
@@ -2447,6 +2461,12 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2447
2461
|
this.sourceUrl = sourceUrl;
|
|
2448
2462
|
this.registeredOwner = registeredOwner;
|
|
2449
2463
|
this.sourceUrls = sourceUrls;
|
|
2464
|
+
this.taxNumber = taxNumber;
|
|
2465
|
+
this.vatValid = vatValid;
|
|
2466
|
+
this.aiScore = aiScore;
|
|
2467
|
+
this.nameMatch = nameMatch;
|
|
2468
|
+
this.officialName = officialName;
|
|
2469
|
+
this.officialAddress = officialAddress;
|
|
2450
2470
|
}
|
|
2451
2471
|
status;
|
|
2452
2472
|
vatNumber;
|
|
@@ -2463,6 +2483,16 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2463
2483
|
sourceUrl;
|
|
2464
2484
|
registeredOwner;
|
|
2465
2485
|
sourceUrls;
|
|
2486
|
+
taxNumber;
|
|
2487
|
+
vatValid;
|
|
2488
|
+
aiScore;
|
|
2489
|
+
nameMatch;
|
|
2490
|
+
officialName;
|
|
2491
|
+
officialAddress;
|
|
2492
|
+
/** True when the register knows the number under a different name than the one requested. */
|
|
2493
|
+
nameMismatch() {
|
|
2494
|
+
return this.nameMatch === "mismatch";
|
|
2495
|
+
}
|
|
2466
2496
|
/** True when a VAT number was found but rejected by the official check. */
|
|
2467
2497
|
hasRejectedCandidates() {
|
|
2468
2498
|
return this.rejectedCandidates.length > 0;
|
|
@@ -2500,7 +2530,13 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2500
2530
|
toRejectedCandidates(data["rejectedCandidates"]),
|
|
2501
2531
|
url && isWebUrl(url) ? url : void 0,
|
|
2502
2532
|
text("registeredOwner"),
|
|
2503
|
-
Array.isArray(urls) ? [...new Set(urls.filter(isWebUrl).map((u) => u.trim()))] : []
|
|
2533
|
+
Array.isArray(urls) ? [...new Set(urls.filter(isWebUrl).map((u) => u.trim()))] : [],
|
|
2534
|
+
text("taxNumber"),
|
|
2535
|
+
typeof data["vatValid"] === "boolean" ? data["vatValid"] : void 0,
|
|
2536
|
+
num("aiScore"),
|
|
2537
|
+
data["nameMatch"] === "ok" || data["nameMatch"] === "mismatch" ? data["nameMatch"] : void 0,
|
|
2538
|
+
text("officialName"),
|
|
2539
|
+
toOfficialAddress(data["officialAddress"])
|
|
2504
2540
|
);
|
|
2505
2541
|
}
|
|
2506
2542
|
toArray() {
|
|
@@ -2519,7 +2555,13 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2519
2555
|
rejectedCandidates: this.rejectedCandidates.map((c) => ({ vatNumber: c.vatNumber, reason: c.reason })),
|
|
2520
2556
|
sourceUrl: this.sourceUrl ?? null,
|
|
2521
2557
|
registeredOwner: this.registeredOwner ?? null,
|
|
2522
|
-
sourceUrls: this.sourceUrls
|
|
2558
|
+
sourceUrls: this.sourceUrls,
|
|
2559
|
+
taxNumber: this.taxNumber ?? null,
|
|
2560
|
+
vatValid: this.vatValid ?? null,
|
|
2561
|
+
aiScore: this.aiScore ?? null,
|
|
2562
|
+
nameMatch: this.nameMatch ?? null,
|
|
2563
|
+
officialName: this.officialName ?? null,
|
|
2564
|
+
officialAddress: this.officialAddress ?? null
|
|
2523
2565
|
};
|
|
2524
2566
|
}
|
|
2525
2567
|
};
|
|
@@ -3797,7 +3839,7 @@ var AuthRetryHttpClient = class {
|
|
|
3797
3839
|
};
|
|
3798
3840
|
|
|
3799
3841
|
// src/version.ts
|
|
3800
|
-
var SDK_VERSION = "1.
|
|
3842
|
+
var SDK_VERSION = "1.6.0";
|
|
3801
3843
|
|
|
3802
3844
|
// src/http/SdkVersionHttpClient.ts
|
|
3803
3845
|
var SDK_VERSION_HEADER = "X-Taxora-SDK-Version";
|