@parseapi/sdk 1.6.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/README.md +74 -13
- package/dist/index.cjs +57 -24
- package/dist/index.d.cts +275 -40
- package/dist/index.d.ts +275 -40
- package/dist/index.js +57 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Get a key at [parseapi.com](https://parseapi.com). The client also reads `PARSEA
|
|
|
17
17
|
|
|
18
18
|
## API versions
|
|
19
19
|
|
|
20
|
-
Version 1.
|
|
20
|
+
Version 1.7.0 explicitly selects the API contract supported by this SDK. It sends `Parse-Version: 2.0.0` on every lookup so responses match the API contract supported by the package. Your key and the team's saved default stay the same.
|
|
21
21
|
|
|
22
22
|
Upgrade the dependency in staging, review the [release notes](https://parseapi.com/docs/releases), and test the application before deploying the same code and dependency version to production. Commit your dependency lockfile so the tested package travels with your deployment. Future major SDK upgrades can select a newer API contract.
|
|
23
23
|
|
|
@@ -87,9 +87,9 @@ await parse.ip('8.8.8.8');
|
|
|
87
87
|
await parse.ip.self();
|
|
88
88
|
await parse.email('hello@gmail.com');
|
|
89
89
|
await parse.vat('DE136695976');
|
|
90
|
-
await parse.
|
|
91
|
-
await parse.
|
|
92
|
-
await parse.
|
|
90
|
+
await parse.bank('DE89370400440532013000');
|
|
91
|
+
await parse.card('424242');
|
|
92
|
+
await parse.provider('1881018208');
|
|
93
93
|
await parse.phone('+14155552671');
|
|
94
94
|
await parse.carrier('+14155552671');
|
|
95
95
|
await parse.caller('+14155552671');
|
|
@@ -143,16 +143,18 @@ await parse.mx('example.com');
|
|
|
143
143
|
await parse.dns('example.com');
|
|
144
144
|
await parse.dns('_dmarc.example.com', { type: 'TXT' });
|
|
145
145
|
await parse.useragent(uaString);
|
|
146
|
-
await parse.
|
|
147
|
-
await parse.
|
|
148
|
-
await parse.
|
|
146
|
+
await parse.vehicle('1HGCM82633A004352');
|
|
147
|
+
await parse.industry('541511');
|
|
148
|
+
await parse.industry.search('coffee shop', { limit: 5 });
|
|
149
149
|
await parse.tariff('8471.30.01.00');
|
|
150
150
|
await parse.tariff.search('sunglasses');
|
|
151
151
|
await parse.emoji('rocket');
|
|
152
152
|
await parse.emoji.search('fire');
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
The existing NAICS lookup and search methods remain available as compatibility names for Industry.
|
|
156
|
+
|
|
157
|
+
Industry paid deep records include classification `deep.exclusions`, each with a description and linked codes. Generic exclusions can have no linked codes. Omitted or null exclusions in older responses remain unknown. Search results also include `match`: the matched `field` (`name`, `term` or `naics`) and `text`, plus `corrections` with `from` and `to` tokens for typo fallback. Corrections are empty for exact, plural and prefix matches. Direct code lookups omit `match`. Older responses may omit it.
|
|
156
158
|
|
|
157
159
|
Responses are typed, plain JSON data. `country.states('US')` requests the states directly; it does not fetch a country first. Optional arguments go in the final options object, so new options can be added without changing your existing calls.
|
|
158
160
|
|
|
@@ -246,6 +248,12 @@ await parse.weather(40.7128, -74.006, { deep: true, date: '2026-08-15' });
|
|
|
246
248
|
|
|
247
249
|
Tariff starts with the general schedule line. Paid deep adds units and the special and other schedule columns. An optional origin then resolves country-specific measures. The three calls below show those successive choices. Without origin, schedule detail is still returned and origin-dependent fields are null. A null effective rate is not a zero rate.
|
|
248
250
|
|
|
251
|
+
Tariff lookup and search accept an optional `edition` fingerprint and `date` (`YYYY-MM-DD`). The edition pins exact immutable source bytes. A date is accepted only when verified source coverage exists. An edition without a date returns undated schedule context (`date: null`). Default requests use today. Paid detail exposes an open-string `reason` when `effective_rate` is null, including `incomplete_coverage`. A null rate never means zero. Explicit selections fail with `tariff_selection_mismatch` if an older server ignores the requested scope.
|
|
252
|
+
|
|
253
|
+
Origin means where the goods originate, not where they ship from. The effective rate covers matched stored schedule measures only. It is not complete duty or landed cost.
|
|
254
|
+
|
|
255
|
+
Codes contain 4, 6, 8 or 10 ASCII digits; dots and whitespace are optional. Search returns up to 20 description matches with parent `lineage` so a result named "Other" has context. Search is not product classification. In deep, `measures: null` means origin-dependent measures were not resolved. `measures: []` means the resolved lookup found none.
|
|
256
|
+
|
|
249
257
|
```ts
|
|
250
258
|
await parse.tariff('8471.30.01.00');
|
|
251
259
|
await parse.tariff('8471.30.01.00', { deep: true });
|
|
@@ -256,6 +264,32 @@ Address search uses context from the form: prefer postal, or city and state. An
|
|
|
256
264
|
|
|
257
265
|
HLR reports status at the last check. `live` means assigned and `connected` means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep diagnostics stay within the same metered lookup.
|
|
258
266
|
|
|
267
|
+
Bank returns core `checks` for input, country, length, structure, checksum and national rules, plus an `issues` list. States are `passed`, `failed`, `not_checked` or `not_supported`. Unsupported national checking is not a failure. `valid` covers the implemented format and checksum rules, not account existence, ownership or payment reachability. Directory names and BICs may be null independently. Older responses may omit `checks` and `issues`, and future states and issue codes remain strings. Pass the original input unchanged so the API can report invalid characters. Deep `account` remains the BBAN remainder.
|
|
268
|
+
|
|
269
|
+
Bank inputs use `POST /bank` JSON bodies, keeping IBAN and account values out of request URLs. Pass original strings; the server owns normalization and validation. Avoid logging request bodies. IBAN deep can include `directory` with the immutable `edition`, resolved `country` and actual `match` grain (`bank`, `branch`, `prefix` or `none`); it is absent if no directory lookup ran. A match does not prove complete country coverage or payment reachability.
|
|
270
|
+
|
|
271
|
+
Use country requirements to build supported input fields. US ACH has an explicit helper with no deep option. It checks the routing format/ABA checksum and account-field syntax; `account_checksum` is `not_supported`. It preserves account characters and leading zeros. A nullable bank name is routing-directory identity, not account existence, ownership or ACH eligibility. The examples below are synthetic test inputs, not payment instructions.
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
await parse.bankRequirements('US', { format: 'us_ach' });
|
|
275
|
+
await parse.bankUsAch({ routing: '011000015', account: '0001234567' });
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Provider lookup
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
const provider = await parse.provider('1881018208');
|
|
282
|
+
const profile = await parse.provider('1881018208', { deep: true });
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Pass the original NPI as a string. `valid` checks its format and checksum; `registered` means a match in the stored NPPES snapshot. `active` reflects recorded NPI deactivation, not licensure. `excluded` is an NPI-only OIG LEIE match; `false` is not a complete exclusion clearance. These directory facts do not verify credentials, current practice contact or payment eligibility.
|
|
286
|
+
|
|
287
|
+
Invalid input returns `valid: false` with unknown provider fields. A checksum-valid number missing from the snapshot returns `registered: false`; unavailable storage remains an API error. Preserve `null` as unknown.
|
|
288
|
+
|
|
289
|
+
The default pooled lookup includes provider identity, specialty and practice contact where held. Paid `deep` adds `deactivated_at`, `medicare`, `opt_out` and `enrollments` from stored source files, with no separate check meter or live verification. `enrollments: null` means unavailable; `[]` means no enrollment rows are returned. The API omits unrequested `deep` and returns `{}` when requested on Free.
|
|
290
|
+
|
|
291
|
+
Paid Deep also returns `taxonomies` in published order, with taxonomy code, specialty label, primary flag and provider-reported license number/state, plus `enumerated_at`, `updated_at` and `reactivated_at` record dates. Reported licenses are not verified licenses. Null lists mean unavailable; empty lists mean the edition contains no entries. Core `sources` is available on every plan: NPPES, LEIE, PECOS and opt-out each have nullable edition metadata (`edition`, `published_at`, `through`, `imported_at`). Provider record dates are separate from source publication and completed import dates. Older responses may omit these additions. Edition details remain null until a verified source is served.
|
|
292
|
+
|
|
259
293
|
## Deep
|
|
260
294
|
|
|
261
295
|
Choose enrichment for the question you need answered.
|
|
@@ -266,10 +300,11 @@ Choose enrichment for the question you need answered.
|
|
|
266
300
|
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
267
301
|
| Email | A metered mailbox check with deliverability, catch-all, status, reason and address hints, using included email checks or enabled on-demand usage. |
|
|
268
302
|
| VAT | A metered registry check where supported, using included VAT checks or enabled on-demand usage. |
|
|
269
|
-
| Phone, Time, Date, Currency, Language, Emoji,
|
|
303
|
+
| Phone, Time, Date, Currency, Language, Emoji, Bank, Point | Optional detail in the same pooled request on every plan. |
|
|
270
304
|
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
271
|
-
| Name,
|
|
272
|
-
|
|
|
305
|
+
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
|
|
306
|
+
| NPI | Deactivation date, Medicare enrollment, opt-out and enrollment rows from stored sources on paid plans. Exclusion evidence stays core. |
|
|
307
|
+
| Vehicle, Tariff, Company | The complete product detail bag on paid plans. |
|
|
273
308
|
| Weather | Specialist current measurements and the existing forecast, alert, air and history bag on paid plans. |
|
|
274
309
|
| Carrier, HLR | Optional diagnostic detail within the same metered core unit, including Free allowance units. No second gate or additional check. |
|
|
275
310
|
|
|
@@ -325,16 +360,40 @@ Ordinary lookups retry network failures, 429, and 500/502/503/504 responses twic
|
|
|
325
360
|
|
|
326
361
|
An explicit `retries` setting on the client or call overrides those defaults. Another attempt can consume additional usage if the earlier response was lost. Cancellation stops the request and any retry wait. Automatic redirects are disabled.
|
|
327
362
|
|
|
363
|
+
Automatic retries wait at most five seconds per attempt. A longer valid `Retry-After` returns the original API error immediately without retrying early. Read `retryAfter` on the error for the original header, or null when absent.
|
|
364
|
+
|
|
328
365
|
## Docs
|
|
329
366
|
|
|
330
367
|
Full field reference for every endpoint: [parseapi.com/docs](https://parseapi.com/docs)
|
|
331
368
|
|
|
332
|
-
|
|
369
|
+
## Card
|
|
370
|
+
|
|
371
|
+
Send 2–11 leading digits as a string. Core returns `bin`, `brand`, `brand_name`
|
|
372
|
+
and a CDN SVG `logo`. Brand detection uses reviewed network rules independently
|
|
373
|
+
of issuer records. Unknown or ambiguous prefixes return null brand fields and a
|
|
374
|
+
generic logo; a known network without reviewed artwork also uses the generic logo.
|
|
375
|
+
|
|
376
|
+
Optional Deep adds `prefix`, `issuer`, `country`, `type` and `prepaid`, included
|
|
377
|
+
in the same pooled request on every plan. Six or more digits enable directory
|
|
378
|
+
matching. Fewer digits return all-null Deep fields. Compare `deep.prefix` with
|
|
379
|
+
`bin`: equal is an exact recorded match; shorter is broader; null is no match.
|
|
380
|
+
The longest row wins, including null fields. `prepaid: null` means unknown, not
|
|
381
|
+
false. This is partial reference data, not card validity or payment acceptance.
|
|
382
|
+
|
|
383
|
+
```javascript
|
|
384
|
+
const card = await parse.card('51');
|
|
385
|
+
console.log(card.brand, card.logo);
|
|
386
|
+
const details = await parse.card('43737400', { deep: true });
|
|
387
|
+
console.log(details.deep?.prefix, details.deep?.issuer);
|
|
388
|
+
```
|
|
333
389
|
|
|
390
|
+
Leading zeros are preserved. Only ASCII spaces, tabs, CR, LF and hyphens are
|
|
391
|
+
removed; raw input is limited to 64 characters. Invalid prefixes are rejected
|
|
392
|
+
before dispatch, accepted input is forwarded unchanged. Never send a full card number.
|
|
334
393
|
|
|
335
394
|
## Optional detail
|
|
336
395
|
|
|
337
|
-
The default response answers the common task. Ask for `deep` when you need more detail about that same result. Core fields stay equal. City,
|
|
396
|
+
The default response answers the common task. Ask for `deep` when you need more detail about that same result. Core fields stay equal. City, Industry and Emoji searches put detail inside each result. Postal nearby and distance put metropolitan detail beside the entity it describes. Time conversion keeps target detail in `to.deep`; only the source has `deep.next_dst`.
|
|
338
397
|
|
|
339
398
|
```ts
|
|
340
399
|
const basic = await parse.time('America/New_York');
|
|
@@ -355,3 +414,5 @@ Pass a public hostname without a scheme, path, port or IP address. Stack returns
|
|
|
355
414
|
Successful checks may be reused for up to 24 hours. `pretty` optionally formats the wire JSON. Stack uses your plan's request allowance and API version 2.0.0 selected by this client.
|
|
356
415
|
|
|
357
416
|
Stack defaults to 35 seconds per attempt so a first scan has time to finish. Other lookups retain their 10-second default. An explicit client timeout applies to every operation; JavaScript also supports a per-call `timeoutMs` override.
|
|
417
|
+
|
|
418
|
+
Vehicle lookups use `vin` as the input and response field. Existing VIN methods remain available for compatibility.
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
parseAPI: () => parseAPI
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var VERSION = "1.
|
|
27
|
+
var VERSION = "1.8.0";
|
|
28
28
|
var API_VERSION = "2.0.0";
|
|
29
29
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
30
30
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -40,15 +40,24 @@ var ParseAPIError = class extends Error {
|
|
|
40
40
|
docs;
|
|
41
41
|
/** Send this if you contact support */
|
|
42
42
|
requestId;
|
|
43
|
-
|
|
43
|
+
/** Original Retry-After response header, when supplied. */
|
|
44
|
+
retryAfter;
|
|
45
|
+
constructor(status, code, message, docs, requestId, retryAfter = null) {
|
|
44
46
|
super(message);
|
|
45
47
|
this.name = "ParseAPIError";
|
|
46
48
|
this.status = status;
|
|
47
49
|
this.code = code;
|
|
48
50
|
this.docs = docs;
|
|
49
51
|
this.requestId = requestId;
|
|
52
|
+
this.retryAfter = retryAfter;
|
|
50
53
|
}
|
|
51
54
|
};
|
|
55
|
+
function tariffSelection(result, opts) {
|
|
56
|
+
if ((opts?.edition !== void 0 || opts?.date !== void 0) && (typeof result.edition !== "string" || result.edition.length !== 64 || !/^[a-f0-9]{64}$/.test(result.edition) || opts.edition !== void 0 && result.edition !== opts.edition || (opts.date !== void 0 ? result.date !== opts.date : result.date != null))) {
|
|
57
|
+
throw new ParseAPIError(0, "tariff_selection_mismatch", "Tariff response did not confirm the requested edition/date. The server may not support this selection.", null, null);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
52
61
|
function env(name) {
|
|
53
62
|
return typeof process !== "undefined" ? process.env?.[name] : void 0;
|
|
54
63
|
}
|
|
@@ -85,16 +94,20 @@ function metered(path, query) {
|
|
|
85
94
|
}
|
|
86
95
|
function retryDelayMs(attempt, retryAfter) {
|
|
87
96
|
if (retryAfter) {
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
|
|
97
|
+
const value = retryAfter.trim();
|
|
98
|
+
if (/^[0-9]+(?:\.[0-9]+)?$/.test(value)) {
|
|
99
|
+
const seconds = Number(value);
|
|
100
|
+
return seconds > RETRY_AFTER_CAP_MS / 1e3 ? null : seconds * 1e3;
|
|
91
101
|
}
|
|
92
|
-
if (
|
|
93
|
-
const date = Date.parse(
|
|
94
|
-
if (Number.isFinite(date))
|
|
102
|
+
if (/^[A-Za-z]{3,9},? /.test(value)) {
|
|
103
|
+
const date = Date.parse(value);
|
|
104
|
+
if (Number.isFinite(date)) {
|
|
105
|
+
const delay = Math.max(date - Date.now(), 0);
|
|
106
|
+
return delay > RETRY_AFTER_CAP_MS ? null : delay;
|
|
107
|
+
}
|
|
95
108
|
}
|
|
96
109
|
}
|
|
97
|
-
return Math.random() * 250 * 2 ** attempt;
|
|
110
|
+
return Math.random() * Math.min(250 * 2 ** Math.min(attempt, 16), RETRY_AFTER_CAP_MS);
|
|
98
111
|
}
|
|
99
112
|
function parseAPI(apiKey, options = {}) {
|
|
100
113
|
const key = apiKey || env("PARSEAPI_KEY");
|
|
@@ -127,7 +140,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
127
140
|
const onAbort = () => controller.abort(signal.reason);
|
|
128
141
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
129
142
|
const timer = setTimeout(() => controller.abort(new DOMException("Request timed out", "TimeoutError")), attemptTimeout);
|
|
130
|
-
let
|
|
143
|
+
let retryDelay;
|
|
131
144
|
try {
|
|
132
145
|
let res;
|
|
133
146
|
try {
|
|
@@ -153,8 +166,8 @@ function parseAPI(apiKey, options = {}) {
|
|
|
153
166
|
res = void 0;
|
|
154
167
|
}
|
|
155
168
|
}
|
|
156
|
-
if (res
|
|
157
|
-
|
|
169
|
+
if (res) retryDelay = retryDelayMs(attempt, res.headers.get("Retry-After"));
|
|
170
|
+
if (res && RETRY_STATUS.has(res.status) && attempt < retries && retryDelay !== null) {
|
|
158
171
|
await res.body?.cancel().catch(() => {
|
|
159
172
|
});
|
|
160
173
|
} else if (res) {
|
|
@@ -171,14 +184,15 @@ function parseAPI(apiKey, options = {}) {
|
|
|
171
184
|
typeof body2.code === "string" ? body2.code : "unknown_error",
|
|
172
185
|
typeof body2.message === "string" ? body2.message : `Request failed with status ${res.status}`,
|
|
173
186
|
typeof body2.docs === "string" ? body2.docs : null,
|
|
174
|
-
typeof body2.request_id === "string" ? body2.request_id : null
|
|
187
|
+
typeof body2.request_id === "string" ? body2.request_id : null,
|
|
188
|
+
res.headers.get("Retry-After")
|
|
175
189
|
);
|
|
176
190
|
}
|
|
177
191
|
} finally {
|
|
178
192
|
clearTimeout(timer);
|
|
179
193
|
signal?.removeEventListener("abort", onAbort);
|
|
180
194
|
}
|
|
181
|
-
await sleep(retryDelayMs(attempt,
|
|
195
|
+
await sleep(retryDelay ?? retryDelayMs(attempt, null), signal);
|
|
182
196
|
}
|
|
183
197
|
}
|
|
184
198
|
const enc = encodeURIComponent;
|
|
@@ -192,6 +206,12 @@ function parseAPI(apiKey, options = {}) {
|
|
|
192
206
|
for (const [name, value2] of Object.entries(query)) url.searchParams.set(name, String(value2));
|
|
193
207
|
return !numericJson && url.href.length <= 8e3 ? request("/elevation", query, void 0, opts) : request("/elevation", void 0, void 0, opts, { [selector]: coordinates, ...sampling });
|
|
194
208
|
}
|
|
209
|
+
const industry = Object.assign(
|
|
210
|
+
(code, opts) => request(`/industry/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
211
|
+
{
|
|
212
|
+
search: (query, opts) => request("/industry", { q: query, limit: opts?.limit, ...deepQuery(opts) }, void 0, opts)
|
|
213
|
+
}
|
|
214
|
+
);
|
|
195
215
|
return {
|
|
196
216
|
/** Estimate task access, capacity and additional charges. Requires a secret key. Reserves no units or money and does not enforce the supplied budget. */
|
|
197
217
|
preflight: (task, opts) => request("/preflight", void 0, void 0, opts, task),
|
|
@@ -277,8 +297,16 @@ function parseAPI(apiKey, options = {}) {
|
|
|
277
297
|
from: opts?.from,
|
|
278
298
|
...deepQuery(opts)
|
|
279
299
|
}, void 0, opts),
|
|
300
|
+
// Keep existing callers on their established HTTP contracts.
|
|
280
301
|
iban: (iban, opts) => request(`/iban/${enc(iban)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
302
|
+
bin: (bin, opts) => request(`/bin/${enc(bin)}`, { deep: opts?.deep }, void 0, opts),
|
|
281
303
|
npi: (npi, opts) => request(`/npi/${enc(npi)}`, deepQuery(opts), void 0, opts),
|
|
304
|
+
bank: (iban, opts) => request("/bank", void 0, void 0, opts, { iban, country: opts?.country, deep: opts?.deep }),
|
|
305
|
+
/** Check US routing/account syntax using POST. Does not verify ownership, existence or ACH eligibility. */
|
|
306
|
+
bankUsAch: (input, opts) => request("/bank", void 0, void 0, opts, { format: "us_ach", country: "US", routing: input.routing, account: input.account }),
|
|
307
|
+
/** Describe supported input fields and check scope; this does not establish country directory coverage. */
|
|
308
|
+
bankRequirements: (country, opts) => request("/bank/requirements", { country, format: opts?.format }, void 0, opts),
|
|
309
|
+
provider: (npi, opts) => request(`/provider/${enc(npi)}`, deepQuery(opts), void 0, opts),
|
|
282
310
|
/** Parse a phone number and its formats. Pass country for national numbers when needed. Deep adds numbering-plan geography. */
|
|
283
311
|
phone: (number, opts) => request(`/phone/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
284
312
|
/** Request a metered carrier lookup. No automatic retries by default. */
|
|
@@ -293,8 +321,13 @@ function parseAPI(apiKey, options = {}) {
|
|
|
293
321
|
domain: (domain, opts) => request(`/domain/${enc(domain)}`, deepQuery(opts), void 0, opts),
|
|
294
322
|
asn: (asn, opts) => request(`/asn/${enc(asn)}`, void 0, void 0, opts),
|
|
295
323
|
mac: (mac, opts) => request(`/mac/${enc(mac)}`, void 0, void 0, opts),
|
|
296
|
-
/** Look up a
|
|
297
|
-
|
|
324
|
+
/** Look up a 2-11 digit card prefix. Keep leading zeros in the input string. */
|
|
325
|
+
card: async (bin, opts) => {
|
|
326
|
+
if (typeof bin !== "string" || bin.length > 64 || !/^[0-9]{2,11}$/.test(bin.replace(/[ \t\r\n-]/g, ""))) {
|
|
327
|
+
throw new TypeError("parseAPI: Card requires a string containing 2 to 11 digits. Send a prefix only.");
|
|
328
|
+
}
|
|
329
|
+
return request(`/card/${enc(bin)}`, deepQuery(opts), void 0, opts);
|
|
330
|
+
},
|
|
298
331
|
/** Parse a measurement or convert it to `to`. Without `to`, use its type's canonical unit. Invalid input is plain data with `valid: false`. */
|
|
299
332
|
measure: Object.assign(
|
|
300
333
|
(measure, opts) => request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts),
|
|
@@ -307,19 +340,19 @@ function parseAPI(apiKey, options = {}) {
|
|
|
307
340
|
dns: (domain, opts) => request(`/dns/${enc(domain)}`, { type: opts?.type }, void 0, opts),
|
|
308
341
|
mx: (domain, opts) => request(`/mx/${enc(domain)}`, void 0, void 0, opts),
|
|
309
342
|
useragent: (ua, opts) => request("/useragent", deepQuery(opts), { "User-Agent": ua }, opts),
|
|
343
|
+
/** Identify a vehicle by VIN. Paid deep adds specifications and model-level recall campaigns. */
|
|
344
|
+
vehicle: (vin, opts) => request(`/vehicle/${enc(vin)}`, deepQuery(opts), void 0, opts),
|
|
345
|
+
/** Compatibility entry for VIN callers. */
|
|
310
346
|
vin: (vin, opts) => request(`/vin/${enc(vin)}`, deepQuery(opts), void 0, opts),
|
|
311
347
|
/** US NAICS 2022 definitions and hierarchy. */
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
search: (query, opts) => request("/naics", { q: query, limit: opts?.limit, ...deepQuery(opts) }, void 0, opts)
|
|
316
|
-
}
|
|
317
|
-
),
|
|
348
|
+
industry,
|
|
349
|
+
/** Compatibility name for industry. */
|
|
350
|
+
naics: industry,
|
|
318
351
|
/** Look up the general US duty schedule line. Paid deep adds units and the special and other schedule columns. Add origin with deep to resolve country-specific measures. Without origin, schedule detail remains available and origin-dependent fields are null. A null effective rate is not a zero rate. */
|
|
319
352
|
tariff: Object.assign(
|
|
320
|
-
(code, opts) => request(`/tariff/${enc(code)}`, { origin: opts?.origin, ...deepQuery(opts) }, void 0, opts),
|
|
353
|
+
(code, opts) => request(`/tariff/${enc(code)}`, { origin: opts?.origin, edition: opts?.edition, date: opts?.date, ...deepQuery(opts) }, void 0, opts).then((result) => tariffSelection(result, opts)),
|
|
321
354
|
{
|
|
322
|
-
search: (query, opts) => request("/tariff", { q: query }, void 0, opts)
|
|
355
|
+
search: (query, opts) => request("/tariff", { q: query, edition: opts?.edition, date: opts?.date }, void 0, opts).then((result) => tariffSelection(result, opts))
|
|
323
356
|
}
|
|
324
357
|
),
|
|
325
358
|
currency: Object.assign(
|