@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/dist/index.d.cts CHANGED
@@ -1195,6 +1195,22 @@ declare class SmartEnrichmentResource {
1195
1195
  * apart from "found nothing". Empty for every other status.
1196
1196
  */
1197
1197
  readonly rejectedCandidates: SmartEnrichmentRejectedCandidate[];
1198
+ /**
1199
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1200
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1201
+ */
1202
+ readonly sourceUrl: string | undefined;
1203
+ /**
1204
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1205
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1206
+ * the trading name.
1207
+ */
1208
+ readonly registeredOwner: string | undefined;
1209
+ /**
1210
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1211
+ * pass that found the same number contributes its page. At most 5.
1212
+ */
1213
+ readonly sourceUrls: string[];
1198
1214
  constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
1199
1215
  /** Official/registered address of the matched company, when available. */
1200
1216
  matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
@@ -1211,7 +1227,23 @@ declare class SmartEnrichmentResource {
1211
1227
  * e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
1212
1228
  * apart from "found nothing". Empty for every other status.
1213
1229
  */
1214
- rejectedCandidates?: SmartEnrichmentRejectedCandidate[]);
1230
+ rejectedCandidates?: SmartEnrichmentRejectedCandidate[],
1231
+ /**
1232
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1233
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1234
+ */
1235
+ sourceUrl?: string | undefined,
1236
+ /**
1237
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1238
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1239
+ * the trading name.
1240
+ */
1241
+ registeredOwner?: string | undefined,
1242
+ /**
1243
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1244
+ * pass that found the same number contributes its page. At most 5.
1245
+ */
1246
+ sourceUrls?: string[]);
1215
1247
  /** True when a VAT number was found but rejected by the official check. */
1216
1248
  hasRejectedCandidates(): boolean;
1217
1249
  static fromArray(data: Record<string, unknown>): SmartEnrichmentResource;
package/dist/index.d.ts CHANGED
@@ -1195,6 +1195,22 @@ declare class SmartEnrichmentResource {
1195
1195
  * apart from "found nothing". Empty for every other status.
1196
1196
  */
1197
1197
  readonly rejectedCandidates: SmartEnrichmentRejectedCandidate[];
1198
+ /**
1199
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1200
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1201
+ */
1202
+ readonly sourceUrl: string | undefined;
1203
+ /**
1204
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1205
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1206
+ * the trading name.
1207
+ */
1208
+ readonly registeredOwner: string | undefined;
1209
+ /**
1210
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1211
+ * pass that found the same number contributes its page. At most 5.
1212
+ */
1213
+ readonly sourceUrls: string[];
1198
1214
  constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
1199
1215
  /** Official/registered address of the matched company, when available. */
1200
1216
  matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
@@ -1211,7 +1227,23 @@ declare class SmartEnrichmentResource {
1211
1227
  * e.g. one the tax authority reports as invalid. Lets you tell "found one, it is invalid"
1212
1228
  * apart from "found nothing". Empty for every other status.
1213
1229
  */
1214
- rejectedCandidates?: SmartEnrichmentRejectedCandidate[]);
1230
+ rejectedCandidates?: SmartEnrichmentRejectedCandidate[],
1231
+ /**
1232
+ * Only on `found`: the web page the VAT number was read from — usually the company's own
1233
+ * Impressum / legal notice. Undefined when it came from Taxora's own data or a register.
1234
+ */
1235
+ sourceUrl?: string | undefined,
1236
+ /**
1237
+ * Only on `found`: the PERSON the tax authority has the VAT ID under, when that is not the
1238
+ * trading name — typical for a German sole proprietorship (e.K.). `matchedCompanyName` stays
1239
+ * the trading name.
1240
+ */
1241
+ registeredOwner?: string | undefined,
1242
+ /**
1243
+ * Only on `found`: every page the VAT number was read from, `sourceUrl` first — each research
1244
+ * pass that found the same number contributes its page. At most 5.
1245
+ */
1246
+ sourceUrls?: string[]);
1215
1247
  /** True when a VAT number was found but rejected by the official check. */
1216
1248
  hasRejectedCandidates(): boolean;
1217
1249
  static fromArray(data: Record<string, unknown>): SmartEnrichmentResource;
package/dist/index.js CHANGED
@@ -2316,7 +2316,7 @@ function toRejectedCandidates(value) {
2316
2316
  return candidates;
2317
2317
  }
2318
2318
  var SmartEnrichmentResource = class _SmartEnrichmentResource {
2319
- constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = []) {
2319
+ constructor(status, vatNumber, vatType, confidence, matchedCompanyName, matchedAddress, country, source, mode = void 0, providerVerdicts = [], addressQuality = void 0, rejectedCandidates = [], sourceUrl = void 0, registeredOwner = void 0, sourceUrls = []) {
2320
2320
  this.status = status;
2321
2321
  this.vatNumber = vatNumber;
2322
2322
  this.vatType = vatType;
@@ -2329,6 +2329,9 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2329
2329
  this.providerVerdicts = providerVerdicts;
2330
2330
  this.addressQuality = addressQuality;
2331
2331
  this.rejectedCandidates = rejectedCandidates;
2332
+ this.sourceUrl = sourceUrl;
2333
+ this.registeredOwner = registeredOwner;
2334
+ this.sourceUrls = sourceUrls;
2332
2335
  }
2333
2336
  status;
2334
2337
  vatNumber;
@@ -2342,6 +2345,9 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2342
2345
  providerVerdicts;
2343
2346
  addressQuality;
2344
2347
  rejectedCandidates;
2348
+ sourceUrl;
2349
+ registeredOwner;
2350
+ sourceUrls;
2345
2351
  /** True when a VAT number was found but rejected by the official check. */
2346
2352
  hasRejectedCandidates() {
2347
2353
  return this.rejectedCandidates.length > 0;
@@ -2351,6 +2357,13 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2351
2357
  const v = data[key];
2352
2358
  return typeof v === "string" ? v : void 0;
2353
2359
  };
2360
+ const text = (key) => {
2361
+ const v = str(key)?.trim();
2362
+ return v ? v : void 0;
2363
+ };
2364
+ const isWebUrl = (value) => typeof value === "string" && /^https?:\/\/\S+$/i.test(value.trim());
2365
+ const url = text("sourceUrl");
2366
+ const urls = data["sourceUrls"];
2354
2367
  const num = (key) => {
2355
2368
  const v = data[key];
2356
2369
  return typeof v === "number" ? v : void 0;
@@ -2369,7 +2382,10 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2369
2382
  toSmartEnrichmentMode(data["mode"]),
2370
2383
  Array.isArray(verdicts) ? verdicts.filter((v) => typeof v === "object" && v !== null) : [],
2371
2384
  typeof quality === "object" && quality !== null ? quality : void 0,
2372
- toRejectedCandidates(data["rejectedCandidates"])
2385
+ toRejectedCandidates(data["rejectedCandidates"]),
2386
+ url && isWebUrl(url) ? url : void 0,
2387
+ text("registeredOwner"),
2388
+ Array.isArray(urls) ? [...new Set(urls.filter(isWebUrl).map((u) => u.trim()))] : []
2373
2389
  );
2374
2390
  }
2375
2391
  toArray() {
@@ -2385,7 +2401,10 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
2385
2401
  mode: this.mode ?? null,
2386
2402
  providerVerdicts: this.providerVerdicts,
2387
2403
  addressQuality: this.addressQuality ?? null,
2388
- rejectedCandidates: this.rejectedCandidates.map((c) => ({ vatNumber: c.vatNumber, reason: c.reason }))
2404
+ rejectedCandidates: this.rejectedCandidates.map((c) => ({ vatNumber: c.vatNumber, reason: c.reason })),
2405
+ sourceUrl: this.sourceUrl ?? null,
2406
+ registeredOwner: this.registeredOwner ?? null,
2407
+ sourceUrls: this.sourceUrls
2389
2408
  };
2390
2409
  }
2391
2410
  };
@@ -3663,7 +3682,7 @@ var AuthRetryHttpClient = class {
3663
3682
  };
3664
3683
 
3665
3684
  // src/version.ts
3666
- var SDK_VERSION = "1.4.0";
3685
+ var SDK_VERSION = "1.5.0";
3667
3686
 
3668
3687
  // src/http/SdkVersionHttpClient.ts
3669
3688
  var SDK_VERSION_HEADER = "X-Taxora-SDK-Version";