@taxora/sdk 1.7.0 → 1.8.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 +23 -0
- package/README.md +20 -0
- package/dist/index.cjs +124 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -3
- package/dist/index.d.ts +87 -3
- package/dist/index.js +122 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1092,6 +1092,63 @@ type SmartEnrichmentMode = (typeof SmartEnrichmentMode)[keyof typeof SmartEnrich
|
|
|
1092
1092
|
declare function toSmartEnrichmentMode(value: unknown): SmartEnrichmentMode | undefined;
|
|
1093
1093
|
declare function describeSmartEnrichmentMode(mode: SmartEnrichmentMode): string;
|
|
1094
1094
|
|
|
1095
|
+
/** Why a row was left out of a recheck. */
|
|
1096
|
+
type SmartEnrichmentRecheckSkipReason = 'resolved' | 'no_vat_exists' | 'limit_reached' | 'cooldown' | 'running' | 'pending';
|
|
1097
|
+
type SmartEnrichmentRecheckRunState = 'queued' | 'running' | 'finished' | 'failed';
|
|
1098
|
+
interface SmartEnrichmentRecheckRun {
|
|
1099
|
+
state: SmartEnrichmentRecheckRunState;
|
|
1100
|
+
/** Set once a finished recheck found a usable number (`true`) or did not (`false`). */
|
|
1101
|
+
resolved?: boolean;
|
|
1102
|
+
}
|
|
1103
|
+
interface SmartEnrichmentRecheckOptions {
|
|
1104
|
+
/** 0-based row indexes of the lookup; omit to recheck every row that qualifies. */
|
|
1105
|
+
rows?: number[];
|
|
1106
|
+
/** Only report which rows would run and what they cost — nothing is started. */
|
|
1107
|
+
dryRun?: boolean;
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* What a recheck started (or, for a dry run, would start) and what it costs. Every recheck counts
|
|
1111
|
+
* as a check like a new lookup (Deep Verify ×2), whether a VAT number is found or not.
|
|
1112
|
+
*/
|
|
1113
|
+
declare class SmartEnrichmentRecheck {
|
|
1114
|
+
readonly jobId: string;
|
|
1115
|
+
/** Row indexes that are (or would be) rechecked. */
|
|
1116
|
+
readonly rows: number[];
|
|
1117
|
+
/** Checks these rechecks use. */
|
|
1118
|
+
readonly checks: number;
|
|
1119
|
+
/** Rows left out, by reason. */
|
|
1120
|
+
readonly skipped: Partial<Record<SmartEnrichmentRecheckSkipReason, number>>;
|
|
1121
|
+
readonly dryRun: boolean;
|
|
1122
|
+
constructor(jobId: string,
|
|
1123
|
+
/** Row indexes that are (or would be) rechecked. */
|
|
1124
|
+
rows: number[],
|
|
1125
|
+
/** Checks these rechecks use. */
|
|
1126
|
+
checks: number,
|
|
1127
|
+
/** Rows left out, by reason. */
|
|
1128
|
+
skipped: Partial<Record<SmartEnrichmentRecheckSkipReason, number>>, dryRun: boolean);
|
|
1129
|
+
static fromArray(data: Record<string, unknown>): SmartEnrichmentRecheck;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* "Check again" state of a lookup, as `smartEnrichment.get()` reports it: the rows that can be
|
|
1133
|
+
* rechecked right now, the rechecks of the last week, and the limits behind both.
|
|
1134
|
+
*/
|
|
1135
|
+
declare class SmartEnrichmentRecheckState {
|
|
1136
|
+
/** Row indexes that can be rechecked now. */
|
|
1137
|
+
readonly eligible: number[];
|
|
1138
|
+
/** Rechecks of the last week, by row index. */
|
|
1139
|
+
readonly runs: Record<number, SmartEnrichmentRecheckRun>;
|
|
1140
|
+
readonly maxPerRow: number;
|
|
1141
|
+
readonly cooldownDays: number;
|
|
1142
|
+
constructor(
|
|
1143
|
+
/** Row indexes that can be rechecked now. */
|
|
1144
|
+
eligible: number[],
|
|
1145
|
+
/** Rechecks of the last week, by row index. */
|
|
1146
|
+
runs: Record<number, SmartEnrichmentRecheckRun>, maxPerRow: number, cooldownDays: number);
|
|
1147
|
+
static fromArray(data: Record<string, unknown>): SmartEnrichmentRecheckState;
|
|
1148
|
+
/** True while any recheck of this lookup is queued or running. */
|
|
1149
|
+
isActive(): boolean;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1095
1152
|
/**
|
|
1096
1153
|
* Why a VAT number the research DID find was not returned as the result.
|
|
1097
1154
|
*
|
|
@@ -1251,6 +1308,10 @@ declare class SmartEnrichmentResource {
|
|
|
1251
1308
|
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1252
1309
|
*/
|
|
1253
1310
|
readonly taxNumberSource: SmartEnrichmentTaxNumberSource | undefined;
|
|
1311
|
+
/** How often this row was checked again (`smartEnrichment.recheck()`); undefined when never. */
|
|
1312
|
+
readonly recheckCount: number | undefined;
|
|
1313
|
+
/** When it was last checked again (ISO 8601). */
|
|
1314
|
+
readonly lastRecheckedAt: string | undefined;
|
|
1254
1315
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
1255
1316
|
/** Official/registered address of the matched company, when available. */
|
|
1256
1317
|
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
@@ -1314,7 +1375,11 @@ declare class SmartEnrichmentResource {
|
|
|
1314
1375
|
* Where `taxNumber` comes from: 'vat_id' (read off the VAT ID the tax authority confirmed — exact)
|
|
1315
1376
|
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1316
1377
|
*/
|
|
1317
|
-
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined
|
|
1378
|
+
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined,
|
|
1379
|
+
/** How often this row was checked again (`smartEnrichment.recheck()`); undefined when never. */
|
|
1380
|
+
recheckCount?: number | undefined,
|
|
1381
|
+
/** When it was last checked again (ISO 8601). */
|
|
1382
|
+
lastRecheckedAt?: string | undefined);
|
|
1318
1383
|
/** True when the register knows the number under a different name than the one requested. */
|
|
1319
1384
|
nameMismatch(): boolean;
|
|
1320
1385
|
/** True when a VAT number was found but rejected by the official check. */
|
|
@@ -1335,7 +1400,11 @@ declare class SmartEnrichmentJob {
|
|
|
1335
1400
|
readonly completedCount: number | undefined;
|
|
1336
1401
|
readonly foundCount: number | undefined;
|
|
1337
1402
|
readonly results: SmartEnrichmentResource[];
|
|
1338
|
-
|
|
1403
|
+
/** Which rows can be checked again and which are being rechecked (undefined on older API versions). */
|
|
1404
|
+
readonly recheck: SmartEnrichmentRecheckState | undefined;
|
|
1405
|
+
constructor(jobId: string, status: SmartEnrichmentStatus, itemCount: number | undefined, completedCount: number | undefined, foundCount: number | undefined, results: SmartEnrichmentResource[],
|
|
1406
|
+
/** Which rows can be checked again and which are being rechecked (undefined on older API versions). */
|
|
1407
|
+
recheck?: SmartEnrichmentRecheckState | undefined);
|
|
1339
1408
|
static fromArray(data: Record<string, unknown>): SmartEnrichmentJob;
|
|
1340
1409
|
isProcessing(): boolean;
|
|
1341
1410
|
/** Convenience for single lookups: the first (or only) result, if any. */
|
|
@@ -1544,6 +1613,21 @@ declare class SmartEnrichmentEndpoint {
|
|
|
1544
1613
|
bulkLookup(items: SmartEnrichmentInput[], mode?: SmartEnrichmentMode): Promise<SmartEnrichmentJob>;
|
|
1545
1614
|
/** Poll a job (single or bulk) by its id. */
|
|
1546
1615
|
get(jobId: string): Promise<SmartEnrichmentJob>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Search again for rows of a finished lookup that have no usable answer (`not_found`, or a
|
|
1618
|
+
* number registered to another company). Without `rows` every row that qualifies is rechecked.
|
|
1619
|
+
*
|
|
1620
|
+
* Every recheck counts as a check like a new lookup (Deep Verify ×2), whether a VAT number is
|
|
1621
|
+
* found or not. A row can be rechecked up to 3 times, with 7 days between two rechecks;
|
|
1622
|
+
* `no_vat_exists` and found rows are never rechecked. Pass `dryRun` to see which rows would run
|
|
1623
|
+
* and what they cost without starting anything. Improved rows arrive via the
|
|
1624
|
+
* `enrichment.updated` webhook; `get(jobId).recheck` shows the progress.
|
|
1625
|
+
*
|
|
1626
|
+
* Throws a ValidationException when nothing can be rechecked, the lookup is still running, or
|
|
1627
|
+
* rechecks are not available (sandbox, flat-fee import), and an HttpException (429) when the
|
|
1628
|
+
* start credit or monthly hard cap does not cover it.
|
|
1629
|
+
*/
|
|
1630
|
+
recheck(jobId: string, options?: SmartEnrichmentRecheckOptions): Promise<SmartEnrichmentRecheck>;
|
|
1547
1631
|
/**
|
|
1548
1632
|
* Poll get(jobId) until the job is no longer processing (completed, failed or resolved).
|
|
1549
1633
|
* Throws a TaxoraException when the job does not finish within `timeoutMs`.
|
|
@@ -2126,4 +2210,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
2126
2210
|
private injectAuthHeader;
|
|
2127
2211
|
}
|
|
2128
2212
|
|
|
2129
|
-
export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, type LocalTaxNumberReportOptions, LocalTaxNumberRow, type LocalTaxNumberSummary, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTaxNumberSource, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, type VatStateChangedEvent, type VatValidatedEvent, VatValidationAddressInput, type VatWebhookObject, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEventEnvelope, type WebhookEventType, type WebhookRawBody, type WebhookSignatureErrorReason, type WebhookSignatureHeaderInput, WebhookSignatureVerificationError, type WebhookTestEvent, type WebhookVerifyOptions, computeWebhookSignature, constructWebhookEvent, describeApiError, describeComplianceDocumentType, describeComplianceEnrollmentStatus, describeComplianceService, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describePeppolLookupStatus, describeSmartEnrichmentMode, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseLocalTaxNumbersCsv, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|
|
2213
|
+
export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, type LocalTaxNumberReportOptions, LocalTaxNumberRow, type LocalTaxNumberSummary, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, SmartEnrichmentRecheck, type SmartEnrichmentRecheckOptions, type SmartEnrichmentRecheckRun, type SmartEnrichmentRecheckRunState, type SmartEnrichmentRecheckSkipReason, SmartEnrichmentRecheckState, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTaxNumberSource, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, type VatStateChangedEvent, type VatValidatedEvent, VatValidationAddressInput, type VatWebhookObject, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEventEnvelope, type WebhookEventType, type WebhookRawBody, type WebhookSignatureErrorReason, type WebhookSignatureHeaderInput, WebhookSignatureVerificationError, type WebhookTestEvent, type WebhookVerifyOptions, computeWebhookSignature, constructWebhookEvent, describeApiError, describeComplianceDocumentType, describeComplianceEnrollmentStatus, describeComplianceService, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describePeppolLookupStatus, describeSmartEnrichmentMode, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseLocalTaxNumbersCsv, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -1092,6 +1092,63 @@ type SmartEnrichmentMode = (typeof SmartEnrichmentMode)[keyof typeof SmartEnrich
|
|
|
1092
1092
|
declare function toSmartEnrichmentMode(value: unknown): SmartEnrichmentMode | undefined;
|
|
1093
1093
|
declare function describeSmartEnrichmentMode(mode: SmartEnrichmentMode): string;
|
|
1094
1094
|
|
|
1095
|
+
/** Why a row was left out of a recheck. */
|
|
1096
|
+
type SmartEnrichmentRecheckSkipReason = 'resolved' | 'no_vat_exists' | 'limit_reached' | 'cooldown' | 'running' | 'pending';
|
|
1097
|
+
type SmartEnrichmentRecheckRunState = 'queued' | 'running' | 'finished' | 'failed';
|
|
1098
|
+
interface SmartEnrichmentRecheckRun {
|
|
1099
|
+
state: SmartEnrichmentRecheckRunState;
|
|
1100
|
+
/** Set once a finished recheck found a usable number (`true`) or did not (`false`). */
|
|
1101
|
+
resolved?: boolean;
|
|
1102
|
+
}
|
|
1103
|
+
interface SmartEnrichmentRecheckOptions {
|
|
1104
|
+
/** 0-based row indexes of the lookup; omit to recheck every row that qualifies. */
|
|
1105
|
+
rows?: number[];
|
|
1106
|
+
/** Only report which rows would run and what they cost — nothing is started. */
|
|
1107
|
+
dryRun?: boolean;
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* What a recheck started (or, for a dry run, would start) and what it costs. Every recheck counts
|
|
1111
|
+
* as a check like a new lookup (Deep Verify ×2), whether a VAT number is found or not.
|
|
1112
|
+
*/
|
|
1113
|
+
declare class SmartEnrichmentRecheck {
|
|
1114
|
+
readonly jobId: string;
|
|
1115
|
+
/** Row indexes that are (or would be) rechecked. */
|
|
1116
|
+
readonly rows: number[];
|
|
1117
|
+
/** Checks these rechecks use. */
|
|
1118
|
+
readonly checks: number;
|
|
1119
|
+
/** Rows left out, by reason. */
|
|
1120
|
+
readonly skipped: Partial<Record<SmartEnrichmentRecheckSkipReason, number>>;
|
|
1121
|
+
readonly dryRun: boolean;
|
|
1122
|
+
constructor(jobId: string,
|
|
1123
|
+
/** Row indexes that are (or would be) rechecked. */
|
|
1124
|
+
rows: number[],
|
|
1125
|
+
/** Checks these rechecks use. */
|
|
1126
|
+
checks: number,
|
|
1127
|
+
/** Rows left out, by reason. */
|
|
1128
|
+
skipped: Partial<Record<SmartEnrichmentRecheckSkipReason, number>>, dryRun: boolean);
|
|
1129
|
+
static fromArray(data: Record<string, unknown>): SmartEnrichmentRecheck;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* "Check again" state of a lookup, as `smartEnrichment.get()` reports it: the rows that can be
|
|
1133
|
+
* rechecked right now, the rechecks of the last week, and the limits behind both.
|
|
1134
|
+
*/
|
|
1135
|
+
declare class SmartEnrichmentRecheckState {
|
|
1136
|
+
/** Row indexes that can be rechecked now. */
|
|
1137
|
+
readonly eligible: number[];
|
|
1138
|
+
/** Rechecks of the last week, by row index. */
|
|
1139
|
+
readonly runs: Record<number, SmartEnrichmentRecheckRun>;
|
|
1140
|
+
readonly maxPerRow: number;
|
|
1141
|
+
readonly cooldownDays: number;
|
|
1142
|
+
constructor(
|
|
1143
|
+
/** Row indexes that can be rechecked now. */
|
|
1144
|
+
eligible: number[],
|
|
1145
|
+
/** Rechecks of the last week, by row index. */
|
|
1146
|
+
runs: Record<number, SmartEnrichmentRecheckRun>, maxPerRow: number, cooldownDays: number);
|
|
1147
|
+
static fromArray(data: Record<string, unknown>): SmartEnrichmentRecheckState;
|
|
1148
|
+
/** True while any recheck of this lookup is queued or running. */
|
|
1149
|
+
isActive(): boolean;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1095
1152
|
/**
|
|
1096
1153
|
* Why a VAT number the research DID find was not returned as the result.
|
|
1097
1154
|
*
|
|
@@ -1251,6 +1308,10 @@ declare class SmartEnrichmentResource {
|
|
|
1251
1308
|
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1252
1309
|
*/
|
|
1253
1310
|
readonly taxNumberSource: SmartEnrichmentTaxNumberSource | undefined;
|
|
1311
|
+
/** How often this row was checked again (`smartEnrichment.recheck()`); undefined when never. */
|
|
1312
|
+
readonly recheckCount: number | undefined;
|
|
1313
|
+
/** When it was last checked again (ISO 8601). */
|
|
1314
|
+
readonly lastRecheckedAt: string | undefined;
|
|
1254
1315
|
constructor(status: SmartEnrichmentStatus, vatNumber: string | undefined, vatType: string | undefined, confidence: number | undefined, matchedCompanyName: string | undefined,
|
|
1255
1316
|
/** Official/registered address of the matched company, when available. */
|
|
1256
1317
|
matchedAddress: string | undefined, country: string | undefined, source: string | undefined,
|
|
@@ -1314,7 +1375,11 @@ declare class SmartEnrichmentResource {
|
|
|
1314
1375
|
* Where `taxNumber` comes from: 'vat_id' (read off the VAT ID the tax authority confirmed — exact)
|
|
1315
1376
|
* or 'company_website' (published by the company itself, not officially confirmable).
|
|
1316
1377
|
*/
|
|
1317
|
-
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined
|
|
1378
|
+
taxNumberSource?: SmartEnrichmentTaxNumberSource | undefined,
|
|
1379
|
+
/** How often this row was checked again (`smartEnrichment.recheck()`); undefined when never. */
|
|
1380
|
+
recheckCount?: number | undefined,
|
|
1381
|
+
/** When it was last checked again (ISO 8601). */
|
|
1382
|
+
lastRecheckedAt?: string | undefined);
|
|
1318
1383
|
/** True when the register knows the number under a different name than the one requested. */
|
|
1319
1384
|
nameMismatch(): boolean;
|
|
1320
1385
|
/** True when a VAT number was found but rejected by the official check. */
|
|
@@ -1335,7 +1400,11 @@ declare class SmartEnrichmentJob {
|
|
|
1335
1400
|
readonly completedCount: number | undefined;
|
|
1336
1401
|
readonly foundCount: number | undefined;
|
|
1337
1402
|
readonly results: SmartEnrichmentResource[];
|
|
1338
|
-
|
|
1403
|
+
/** Which rows can be checked again and which are being rechecked (undefined on older API versions). */
|
|
1404
|
+
readonly recheck: SmartEnrichmentRecheckState | undefined;
|
|
1405
|
+
constructor(jobId: string, status: SmartEnrichmentStatus, itemCount: number | undefined, completedCount: number | undefined, foundCount: number | undefined, results: SmartEnrichmentResource[],
|
|
1406
|
+
/** Which rows can be checked again and which are being rechecked (undefined on older API versions). */
|
|
1407
|
+
recheck?: SmartEnrichmentRecheckState | undefined);
|
|
1339
1408
|
static fromArray(data: Record<string, unknown>): SmartEnrichmentJob;
|
|
1340
1409
|
isProcessing(): boolean;
|
|
1341
1410
|
/** Convenience for single lookups: the first (or only) result, if any. */
|
|
@@ -1544,6 +1613,21 @@ declare class SmartEnrichmentEndpoint {
|
|
|
1544
1613
|
bulkLookup(items: SmartEnrichmentInput[], mode?: SmartEnrichmentMode): Promise<SmartEnrichmentJob>;
|
|
1545
1614
|
/** Poll a job (single or bulk) by its id. */
|
|
1546
1615
|
get(jobId: string): Promise<SmartEnrichmentJob>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Search again for rows of a finished lookup that have no usable answer (`not_found`, or a
|
|
1618
|
+
* number registered to another company). Without `rows` every row that qualifies is rechecked.
|
|
1619
|
+
*
|
|
1620
|
+
* Every recheck counts as a check like a new lookup (Deep Verify ×2), whether a VAT number is
|
|
1621
|
+
* found or not. A row can be rechecked up to 3 times, with 7 days between two rechecks;
|
|
1622
|
+
* `no_vat_exists` and found rows are never rechecked. Pass `dryRun` to see which rows would run
|
|
1623
|
+
* and what they cost without starting anything. Improved rows arrive via the
|
|
1624
|
+
* `enrichment.updated` webhook; `get(jobId).recheck` shows the progress.
|
|
1625
|
+
*
|
|
1626
|
+
* Throws a ValidationException when nothing can be rechecked, the lookup is still running, or
|
|
1627
|
+
* rechecks are not available (sandbox, flat-fee import), and an HttpException (429) when the
|
|
1628
|
+
* start credit or monthly hard cap does not cover it.
|
|
1629
|
+
*/
|
|
1630
|
+
recheck(jobId: string, options?: SmartEnrichmentRecheckOptions): Promise<SmartEnrichmentRecheck>;
|
|
1547
1631
|
/**
|
|
1548
1632
|
* Poll get(jobId) until the job is no longer processing (completed, failed or resolved).
|
|
1549
1633
|
* Throws a TaxoraException when the job does not finish within `timeoutMs`.
|
|
@@ -2126,4 +2210,4 @@ declare class AuthRetryHttpClient implements HttpClientInterface {
|
|
|
2126
2210
|
private injectAuthHeader;
|
|
2127
2211
|
}
|
|
2128
2212
|
|
|
2129
|
-
export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, type LocalTaxNumberReportOptions, LocalTaxNumberRow, type LocalTaxNumberSummary, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTaxNumberSource, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, type VatStateChangedEvent, type VatValidatedEvent, VatValidationAddressInput, type VatWebhookObject, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEventEnvelope, type WebhookEventType, type WebhookRawBody, type WebhookSignatureErrorReason, type WebhookSignatureHeaderInput, WebhookSignatureVerificationError, type WebhookTestEvent, type WebhookVerifyOptions, computeWebhookSignature, constructWebhookEvent, describeApiError, describeComplianceDocumentType, describeComplianceEnrollmentStatus, describeComplianceService, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describePeppolLookupStatus, describeSmartEnrichmentMode, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseLocalTaxNumbersCsv, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|
|
2213
|
+
export { ApiVersion, AuthEndpoint, AuthRetryHttpClient, AuthenticationException, CompanyAddress, CompanyEndpoint, type CompanyResource, ComplianceDocumentType, ComplianceEnrollment, ComplianceEnrollmentPage, ComplianceEnrollmentStatus, type ComplianceEnterpriseSize, type ComplianceInvoiceLineInput, type ComplianceInvoiceTaxInput, type ComplianceLedgerStateChangedEvent, type ComplianceLedgerWebhookObject, type ComplianceRequestService, ComplianceService, ComplianceTaxReport, ComplianceTaxReportPage, type ComplianceTaxReportRequestState, ComplianceTaxReportState, ComplianceTransaction, type ComplianceTransactionBuyerInput, type ComplianceTransactionFilters, type ComplianceTransactionInvoiceLine, type ComplianceTransactionInvoiceLineTax, ComplianceTransactionPage, type ComplianceTransactionRequestState, type ComplianceTransactionRequestType, ComplianceTransactionState, type ComplianceTransactionStateChangedEvent, ComplianceTransactionType, type ComplianceTransactionWebhookObject, type ComplianceTypeOperation, type CreateComplianceEnrollmentInput, type CreateComplianceTransactionInput, type CreateNorwayEnrollmentInput, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EReportingAccessRequestInput, EReportingEndpoint, type EReportingInterval, type EnrichmentCompletedEvent, type EnrichmentCompletedWebhookObject, type EnrichmentUpdatedEvent, type EnrichmentUpdatedWebhookObject, Environment, Environment as EnvironmentType, FetchHttpClient, type HttpClientInterface, HttpException, ImportResult, InMemoryTokenStorage, Language, type LocalTaxNumberReportOptions, LocalTaxNumberRow, type LocalTaxNumberSummary, LoginIdentifier, type NorwayEnrollmentInput, NorwegianOrgNumber, type ParsedWebhookSignatureHeader, PeppolLookupResult, PeppolLookupStatus, ProviderDocument, ProviderDocumentLine, RegistryCompany, RetryPolicy, type RetryPolicyOptions, type RevenueCountryBreakdown, type RevenueCurrencyBreakdown, type RevenueStateBreakdown, RevenueStatistics, type RevenueStatisticsFilters, type RevenueTimeBucket, type RevenueTotals, type RevenueTypeBreakdown, ScoreBreakdown, SireneLookupResult, type SmartEnrichmentAddressQuality, type SmartEnrichmentConfidenceBucket, SmartEnrichmentEndpoint, type SmartEnrichmentExportOptions, type SmartEnrichmentHistoryInput, SmartEnrichmentHistoryPage, SmartEnrichmentHistoryRow, type SmartEnrichmentHistoryStats, type SmartEnrichmentInput, SmartEnrichmentJob, SmartEnrichmentMode, type SmartEnrichmentOfficialAddress, type SmartEnrichmentOutcomeBreakdown, type SmartEnrichmentProviderVerdict, SmartEnrichmentRecheck, type SmartEnrichmentRecheckOptions, type SmartEnrichmentRecheckRun, type SmartEnrichmentRecheckRunState, type SmartEnrichmentRecheckSkipReason, SmartEnrichmentRecheckState, type SmartEnrichmentRejectedCandidate, SmartEnrichmentRejectionReason, SmartEnrichmentResource, type SmartEnrichmentSourceBreakdown, SmartEnrichmentStatistics, type SmartEnrichmentStatisticsInterval, type SmartEnrichmentStatisticsOptions, type SmartEnrichmentStatisticsRange, type SmartEnrichmentStatisticsTotals, SmartEnrichmentStatus, type SmartEnrichmentTaxNumberSource, type SmartEnrichmentTimeBucket, type SmartEnrichmentUsage, type SmartEnrichmentUsageHistoryEntry, type SmartEnrichmentWaitOptions, TaxoraClient, TaxoraClientFactory, type TaxoraClientOptions, TaxoraException, type TaxoraWebhookEvent, type TestWebhookObject, Token, type TokenStorageInterface, type UpdateComplianceTransactionInput, ValidationException, VatCertificateExport, VatCollection, VatEndpoint, type VatRate, VatRates, VatResource, VatState, type VatStateChangedEvent, type VatValidatedEvent, VatValidationAddressInput, type VatWebhookObject, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEventEnvelope, type WebhookEventType, type WebhookRawBody, type WebhookSignatureErrorReason, type WebhookSignatureHeaderInput, WebhookSignatureVerificationError, type WebhookTestEvent, type WebhookVerifyOptions, computeWebhookSignature, constructWebhookEvent, describeApiError, describeComplianceDocumentType, describeComplianceEnrollmentStatus, describeComplianceService, describeComplianceTaxReportState, describeComplianceTransactionState, describeComplianceTransactionType, describePeppolLookupStatus, describeSmartEnrichmentMode, describeSmartEnrichmentRejectionReason, describeSmartEnrichmentStatus, describeVatState, generateWebhookSignatureHeader, getBaseUrl, getFailedVatStates, parseLocalTaxNumbersCsv, parseWebhookSignatureHeader, toComplianceDocumentType, toComplianceEnrollmentStatus, toComplianceService, toComplianceTaxReportState, toComplianceTransactionState, toComplianceTransactionType, toPeppolLookupStatus, toSmartEnrichmentMode, toSmartEnrichmentRejectionReason, toSmartEnrichmentStatus, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -2201,6 +2201,73 @@ var EReportingEndpoint = class {
|
|
|
2201
2201
|
}
|
|
2202
2202
|
};
|
|
2203
2203
|
|
|
2204
|
+
// src/dto/SmartEnrichmentRecheck.ts
|
|
2205
|
+
var toIndexes = (value) => Array.isArray(value) ? value.filter((v) => typeof v === "number" && Number.isInteger(v)) : [];
|
|
2206
|
+
var SmartEnrichmentRecheck = class _SmartEnrichmentRecheck {
|
|
2207
|
+
constructor(jobId, rows, checks, skipped, dryRun) {
|
|
2208
|
+
this.jobId = jobId;
|
|
2209
|
+
this.rows = rows;
|
|
2210
|
+
this.checks = checks;
|
|
2211
|
+
this.skipped = skipped;
|
|
2212
|
+
this.dryRun = dryRun;
|
|
2213
|
+
}
|
|
2214
|
+
jobId;
|
|
2215
|
+
rows;
|
|
2216
|
+
checks;
|
|
2217
|
+
skipped;
|
|
2218
|
+
dryRun;
|
|
2219
|
+
static fromArray(data) {
|
|
2220
|
+
const skipped = {};
|
|
2221
|
+
const rawSkipped = data["skipped"];
|
|
2222
|
+
if (typeof rawSkipped === "object" && rawSkipped !== null && !Array.isArray(rawSkipped)) {
|
|
2223
|
+
for (const [reason, count] of Object.entries(rawSkipped)) {
|
|
2224
|
+
if (typeof count === "number") skipped[reason] = count;
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
return new _SmartEnrichmentRecheck(
|
|
2228
|
+
typeof data["jobId"] === "string" ? data["jobId"] : "",
|
|
2229
|
+
toIndexes(data["rows"]),
|
|
2230
|
+
typeof data["checks"] === "number" ? data["checks"] : 0,
|
|
2231
|
+
skipped,
|
|
2232
|
+
data["dryRun"] === true
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2235
|
+
};
|
|
2236
|
+
var SmartEnrichmentRecheckState = class _SmartEnrichmentRecheckState {
|
|
2237
|
+
constructor(eligible, runs, maxPerRow, cooldownDays) {
|
|
2238
|
+
this.eligible = eligible;
|
|
2239
|
+
this.runs = runs;
|
|
2240
|
+
this.maxPerRow = maxPerRow;
|
|
2241
|
+
this.cooldownDays = cooldownDays;
|
|
2242
|
+
}
|
|
2243
|
+
eligible;
|
|
2244
|
+
runs;
|
|
2245
|
+
maxPerRow;
|
|
2246
|
+
cooldownDays;
|
|
2247
|
+
static fromArray(data) {
|
|
2248
|
+
const runs = {};
|
|
2249
|
+
const rawRuns = data["runs"];
|
|
2250
|
+
if (typeof rawRuns === "object" && rawRuns !== null && !Array.isArray(rawRuns)) {
|
|
2251
|
+
for (const [index, run] of Object.entries(rawRuns)) {
|
|
2252
|
+
if (!/^\d+$/.test(index) || typeof run !== "object" || run === null) continue;
|
|
2253
|
+
const { state, resolved } = run;
|
|
2254
|
+
if (state !== "queued" && state !== "running" && state !== "finished" && state !== "failed") continue;
|
|
2255
|
+
runs[Number(index)] = typeof resolved === "boolean" ? { state, resolved } : { state };
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
return new _SmartEnrichmentRecheckState(
|
|
2259
|
+
toIndexes(data["eligible"]),
|
|
2260
|
+
runs,
|
|
2261
|
+
typeof data["maxPerRow"] === "number" ? data["maxPerRow"] : 3,
|
|
2262
|
+
typeof data["cooldownDays"] === "number" ? data["cooldownDays"] : 7
|
|
2263
|
+
);
|
|
2264
|
+
}
|
|
2265
|
+
/** True while any recheck of this lookup is queued or running. */
|
|
2266
|
+
isActive() {
|
|
2267
|
+
return Object.values(this.runs).some((run) => run.state === "queued" || run.state === "running");
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
|
|
2204
2271
|
// src/enums/SmartEnrichmentMode.ts
|
|
2205
2272
|
var SmartEnrichmentMode = {
|
|
2206
2273
|
DEFAULT: "default",
|
|
@@ -2330,7 +2397,7 @@ function toOfficialAddress(value) {
|
|
|
2330
2397
|
return Object.keys(address).length > 0 ? address : void 0;
|
|
2331
2398
|
}
|
|
2332
2399
|
var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
2333
|
-
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, taxNumberType = void 0, taxNumberLabel = void 0, taxNumberSource = void 0) {
|
|
2400
|
+
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, taxNumberType = void 0, taxNumberLabel = void 0, taxNumberSource = void 0, recheckCount = void 0, lastRecheckedAt = void 0) {
|
|
2334
2401
|
this.status = status;
|
|
2335
2402
|
this.vatNumber = vatNumber;
|
|
2336
2403
|
this.vatType = vatType;
|
|
@@ -2355,6 +2422,8 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2355
2422
|
this.taxNumberType = taxNumberType;
|
|
2356
2423
|
this.taxNumberLabel = taxNumberLabel;
|
|
2357
2424
|
this.taxNumberSource = taxNumberSource;
|
|
2425
|
+
this.recheckCount = recheckCount;
|
|
2426
|
+
this.lastRecheckedAt = lastRecheckedAt;
|
|
2358
2427
|
}
|
|
2359
2428
|
status;
|
|
2360
2429
|
vatNumber;
|
|
@@ -2380,6 +2449,8 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2380
2449
|
taxNumberType;
|
|
2381
2450
|
taxNumberLabel;
|
|
2382
2451
|
taxNumberSource;
|
|
2452
|
+
recheckCount;
|
|
2453
|
+
lastRecheckedAt;
|
|
2383
2454
|
/** True when the register knows the number under a different name than the one requested. */
|
|
2384
2455
|
nameMismatch() {
|
|
2385
2456
|
return this.nameMatch === "mismatch";
|
|
@@ -2430,7 +2501,9 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2430
2501
|
toOfficialAddress(data["officialAddress"]),
|
|
2431
2502
|
text("taxNumberType"),
|
|
2432
2503
|
text("taxNumberLabel"),
|
|
2433
|
-
data["taxNumberSource"] === "vat_id" || data["taxNumberSource"] === "company_website" ? data["taxNumberSource"] : void 0
|
|
2504
|
+
data["taxNumberSource"] === "vat_id" || data["taxNumberSource"] === "company_website" ? data["taxNumberSource"] : void 0,
|
|
2505
|
+
num("recheckCount"),
|
|
2506
|
+
text("lastRecheckedAt")
|
|
2434
2507
|
);
|
|
2435
2508
|
}
|
|
2436
2509
|
toArray() {
|
|
@@ -2458,20 +2531,23 @@ var SmartEnrichmentResource = class _SmartEnrichmentResource {
|
|
|
2458
2531
|
officialAddress: this.officialAddress ?? null,
|
|
2459
2532
|
taxNumberType: this.taxNumberType ?? null,
|
|
2460
2533
|
taxNumberLabel: this.taxNumberLabel ?? null,
|
|
2461
|
-
taxNumberSource: this.taxNumberSource ?? null
|
|
2534
|
+
taxNumberSource: this.taxNumberSource ?? null,
|
|
2535
|
+
recheckCount: this.recheckCount ?? null,
|
|
2536
|
+
lastRecheckedAt: this.lastRecheckedAt ?? null
|
|
2462
2537
|
};
|
|
2463
2538
|
}
|
|
2464
2539
|
};
|
|
2465
2540
|
|
|
2466
2541
|
// src/dto/SmartEnrichmentJob.ts
|
|
2467
2542
|
var SmartEnrichmentJob = class _SmartEnrichmentJob {
|
|
2468
|
-
constructor(jobId, status, itemCount, completedCount, foundCount, results) {
|
|
2543
|
+
constructor(jobId, status, itemCount, completedCount, foundCount, results, recheck = void 0) {
|
|
2469
2544
|
this.jobId = jobId;
|
|
2470
2545
|
this.status = status;
|
|
2471
2546
|
this.itemCount = itemCount;
|
|
2472
2547
|
this.completedCount = completedCount;
|
|
2473
2548
|
this.foundCount = foundCount;
|
|
2474
2549
|
this.results = results;
|
|
2550
|
+
this.recheck = recheck;
|
|
2475
2551
|
}
|
|
2476
2552
|
jobId;
|
|
2477
2553
|
status;
|
|
@@ -2479,6 +2555,7 @@ var SmartEnrichmentJob = class _SmartEnrichmentJob {
|
|
|
2479
2555
|
completedCount;
|
|
2480
2556
|
foundCount;
|
|
2481
2557
|
results;
|
|
2558
|
+
recheck;
|
|
2482
2559
|
static fromArray(data) {
|
|
2483
2560
|
const num = (key) => {
|
|
2484
2561
|
const v = data[key];
|
|
@@ -2496,7 +2573,8 @@ var SmartEnrichmentJob = class _SmartEnrichmentJob {
|
|
|
2496
2573
|
num("itemCount"),
|
|
2497
2574
|
num("completedCount"),
|
|
2498
2575
|
num("foundCount"),
|
|
2499
|
-
results
|
|
2576
|
+
results,
|
|
2577
|
+
typeof data["recheck"] === "object" && data["recheck"] !== null && !Array.isArray(data["recheck"]) ? SmartEnrichmentRecheckState.fromArray(data["recheck"]) : void 0
|
|
2500
2578
|
);
|
|
2501
2579
|
}
|
|
2502
2580
|
isProcessing() {
|
|
@@ -2742,6 +2820,41 @@ var SmartEnrichmentEndpoint = class {
|
|
|
2742
2820
|
const data = await this.parseJsonResponse(response);
|
|
2743
2821
|
return SmartEnrichmentJob.fromArray(data);
|
|
2744
2822
|
}
|
|
2823
|
+
/**
|
|
2824
|
+
* Search again for rows of a finished lookup that have no usable answer (`not_found`, or a
|
|
2825
|
+
* number registered to another company). Without `rows` every row that qualifies is rechecked.
|
|
2826
|
+
*
|
|
2827
|
+
* Every recheck counts as a check like a new lookup (Deep Verify ×2), whether a VAT number is
|
|
2828
|
+
* found or not. A row can be rechecked up to 3 times, with 7 days between two rechecks;
|
|
2829
|
+
* `no_vat_exists` and found rows are never rechecked. Pass `dryRun` to see which rows would run
|
|
2830
|
+
* and what they cost without starting anything. Improved rows arrive via the
|
|
2831
|
+
* `enrichment.updated` webhook; `get(jobId).recheck` shows the progress.
|
|
2832
|
+
*
|
|
2833
|
+
* Throws a ValidationException when nothing can be rechecked, the lookup is still running, or
|
|
2834
|
+
* rechecks are not available (sandbox, flat-fee import), and an HttpException (429) when the
|
|
2835
|
+
* start credit or monthly hard cap does not cover it.
|
|
2836
|
+
*/
|
|
2837
|
+
async recheck(jobId, options = {}) {
|
|
2838
|
+
this.validateJobId(jobId);
|
|
2839
|
+
const body = {};
|
|
2840
|
+
if (options.rows !== void 0) {
|
|
2841
|
+
if (options.rows.length === 0) {
|
|
2842
|
+
throw new TaxoraException("rows must not be empty; omit it to recheck every row that qualifies.");
|
|
2843
|
+
}
|
|
2844
|
+
if (options.rows.some((index) => !Number.isInteger(index) || index < 0)) {
|
|
2845
|
+
throw new TaxoraException("rows must contain 0-based row indexes (integers >= 0).");
|
|
2846
|
+
}
|
|
2847
|
+
body["rows"] = [...new Set(options.rows)];
|
|
2848
|
+
}
|
|
2849
|
+
if (options.dryRun) body["dryRun"] = true;
|
|
2850
|
+
const response = await this.sendRequest(
|
|
2851
|
+
"POST",
|
|
2852
|
+
`${this.baseUrl}/smart-enrichment/${encodeURIComponent(jobId)}/recheck`,
|
|
2853
|
+
body
|
|
2854
|
+
);
|
|
2855
|
+
const data = await this.parseJsonResponse(response, [200, 202]);
|
|
2856
|
+
return SmartEnrichmentRecheck.fromArray(data);
|
|
2857
|
+
}
|
|
2745
2858
|
/**
|
|
2746
2859
|
* Poll get(jobId) until the job is no longer processing (completed, failed or resolved).
|
|
2747
2860
|
* Throws a TaxoraException when the job does not finish within `timeoutMs`.
|
|
@@ -2946,7 +3059,7 @@ var SmartEnrichmentEndpoint = class {
|
|
|
2946
3059
|
* verbatim (text/csv) instead of parsing JSON.
|
|
2947
3060
|
*/
|
|
2948
3061
|
async parseCsvResponse(response) {
|
|
2949
|
-
const responseText = await response.
|
|
3062
|
+
const responseText = new TextDecoder("utf-8", { ignoreBOM: true }).decode(await response.arrayBuffer());
|
|
2950
3063
|
if (response.status === 422) {
|
|
2951
3064
|
throw new ValidationException(
|
|
2952
3065
|
jsonErrorMessage(responseText) ?? "Validation failed",
|
|
@@ -3916,7 +4029,7 @@ var AuthRetryHttpClient = class {
|
|
|
3916
4029
|
};
|
|
3917
4030
|
|
|
3918
4031
|
// src/version.ts
|
|
3919
|
-
var SDK_VERSION = "1.
|
|
4032
|
+
var SDK_VERSION = "1.8.0";
|
|
3920
4033
|
|
|
3921
4034
|
// src/http/SdkVersionHttpClient.ts
|
|
3922
4035
|
var SDK_VERSION_HEADER = "X-Taxora-SDK-Version";
|
|
@@ -4146,6 +4259,8 @@ export {
|
|
|
4146
4259
|
SmartEnrichmentHistoryRow,
|
|
4147
4260
|
SmartEnrichmentJob,
|
|
4148
4261
|
SmartEnrichmentMode,
|
|
4262
|
+
SmartEnrichmentRecheck,
|
|
4263
|
+
SmartEnrichmentRecheckState,
|
|
4149
4264
|
SmartEnrichmentRejectionReason,
|
|
4150
4265
|
SmartEnrichmentResource,
|
|
4151
4266
|
SmartEnrichmentStatistics,
|