@parseapi/sdk 1.5.0 → 1.7.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 +52 -2
- package/dist/index.cjs +32 -6
- package/dist/index.d.cts +146 -6
- package/dist/index.d.ts +146 -6
- package/dist/index.js +32 -6
- 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
|
|
|
@@ -166,7 +166,51 @@ DNS uses pooled requests on every plan. Omit `type` to check A, AAAA, CNAME, MX,
|
|
|
166
166
|
|
|
167
167
|
## Time
|
|
168
168
|
|
|
169
|
-
`time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
|
|
169
|
+
`time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to` or `targets`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
|
|
170
|
+
|
|
171
|
+
For an offsetless `at` with `to` or `targets`, choose how to handle a clock change with `disambiguation`. It applies to named-zone and coordinate Time calls.
|
|
172
|
+
|
|
173
|
+
| Value | Repeated time | Skipped time |
|
|
174
|
+
| --- | --- | --- |
|
|
175
|
+
| `compatible` (default) | Earlier occurrence | Shift forward by the clock change |
|
|
176
|
+
| `earlier` | Earlier occurrence | Shift backward by the clock change |
|
|
177
|
+
| `later` | Later occurrence | Shift forward by the clock change |
|
|
178
|
+
| `reject` | `400 ambiguous_time` | `400 nonexistent_time` |
|
|
179
|
+
|
|
180
|
+
An explicit UTC offset selects an instant directly. For example, `2026-11-01T01:30:00-04:00` and `2026-11-01T01:30:00-05:00` identify the two New York occurrences. A valid `disambiguation` value has no effect on explicit instants, current-time requests or lookups without `to` or `targets`. For user-entered appointment times, start with `reject`. Handle `ambiguous_time` or `nonexistent_time` by collecting an explicit offset or an earlier/later choice from the user. Other malformed input still uses `invalid_request`.
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const result = await parse.time('America/New_York', {
|
|
184
|
+
at: '2026-11-01T01:30:00', to: 'UTC', disambiguation: 'later',
|
|
185
|
+
});
|
|
186
|
+
console.log(result.to?.at); // 2026-11-01T06:30:00+00:00
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Canonical Time `deep` includes the pinned rule edition in `deep.timezone_database_version` and source-wall resolution in `deep.resolution`. Resolution records `kind` (`unique`, `overlap` or `gap`), the selected policy, signed `adjustment_seconds`, and chronological alternatives with exact `at`, Unix seconds and UTC offset. Unique times have an empty alternatives list. Explicit instants, current time and lookups without conversion have null resolution. Destination detail stays compact.
|
|
190
|
+
|
|
191
|
+
Search serving IANA IDs by city or region, or omit the query to list all (Go and Rust use an empty string). Discovery returns `timezone_database_version` and sorted `timezones`. No search matches returns `timezones: []`.
|
|
192
|
+
|
|
193
|
+
Pass `targets` to convert one instant to 1-10 zones in a single pooled request. The native list preserves order and duplicates. Use `targets` instead of `to`. The response adds `targets`, with optional detail inside each target. Unknown source coordinates return `targets: null`. An unknown destination rejects the whole request with `not_found`. Omission keeps the original response shape.
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
const zones = await parse.time.zones('New York');
|
|
197
|
+
const result = await parse.time('UTC', {
|
|
198
|
+
at: '2026-09-24T12:00:00Z', targets: ['America/New_York', 'Asia/Tokyo'],
|
|
199
|
+
});
|
|
200
|
+
console.log(zones.timezones, result.targets);
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Location inputs and timezone filters
|
|
204
|
+
|
|
205
|
+
`parse.time(undefined, { iata: 'JFK', deep: true })` and `parse.time.zones(undefined, { country: 'US', dst: false, observes_dst: true, details: true })`.
|
|
206
|
+
|
|
207
|
+
Choose one explicit location input: IP, exact city name or stable city ID, country, IATA airport, ICAO airport, port UN/LOCODE, or address. Country and state can narrow a city or address. State requires country. Address lookup requires US country context and a strict address-point match. Port lookup covers the reviewed port subset, not every assigned UN/LOCODE. IP lookup always uses the supplied IP.
|
|
208
|
+
|
|
209
|
+
Location calls add `location` with `status`, `candidates`, `truncated`, `source` and the typed input. Check `status` before using the clock: ambiguous or missing locations retain null time fields. Candidate coordinates and IDs can also be null. A country with multiple timezones does not silently choose one. Named-zone and coordinate calls retain their existing signatures.
|
|
210
|
+
|
|
211
|
+
Timezone discovery accepts country, IANA area, exact signed offset, abbreviation, DST-at-instant and observes-DST-during-year filters. `at` selects the common instant, `sort` selects timezone or offset order, and `details` adds `zones` rows plus the evaluation `at`. The default `timezones` list stays compact. False DST filters are sent explicitly. An abbreviation returns candidate zones rather than choosing one. Observes-DST uses the UTC calendar year containing `at`.
|
|
212
|
+
|
|
213
|
+
Source deep adds `standard_offset`, `standard_offset_seconds`, signed `dst_offset_seconds` and `season`. Seasonal adjustments can be negative. `season` describes the current DST-flag interval, or the next within 400 days, with actual before/after transition facts and signed `change_seconds`. Unknown boundaries remain null. These fields are optional and nullable, and destination deep stays compact.
|
|
170
214
|
|
|
171
215
|
## Measurements
|
|
172
216
|
|
|
@@ -202,6 +246,12 @@ await parse.weather(40.7128, -74.006, { deep: true, date: '2026-08-15' });
|
|
|
202
246
|
|
|
203
247
|
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.
|
|
204
248
|
|
|
249
|
+
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.
|
|
250
|
+
|
|
251
|
+
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.
|
|
252
|
+
|
|
253
|
+
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.
|
|
254
|
+
|
|
205
255
|
```ts
|
|
206
256
|
await parse.tariff('8471.30.01.00');
|
|
207
257
|
await parse.tariff('8471.30.01.00', { deep: true });
|
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.7.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;
|
|
@@ -49,6 +49,12 @@ var ParseAPIError = class extends Error {
|
|
|
49
49
|
this.requestId = requestId;
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
+
function tariffSelection(result, opts) {
|
|
53
|
+
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))) {
|
|
54
|
+
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);
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
52
58
|
function env(name) {
|
|
53
59
|
return typeof process !== "undefined" ? process.env?.[name] : void 0;
|
|
54
60
|
}
|
|
@@ -317,9 +323,9 @@ function parseAPI(apiKey, options = {}) {
|
|
|
317
323
|
),
|
|
318
324
|
/** 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
325
|
tariff: Object.assign(
|
|
320
|
-
(code, opts) => request(`/tariff/${enc(code)}`, { origin: opts?.origin, ...deepQuery(opts) }, void 0, opts),
|
|
326
|
+
(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
327
|
{
|
|
322
|
-
search: (query, opts) => request("/tariff", { q: query }, void 0, opts)
|
|
328
|
+
search: (query, opts) => request("/tariff", { q: query, edition: opts?.edition, date: opts?.date }, void 0, opts).then((result) => tariffSelection(result, opts))
|
|
323
329
|
}
|
|
324
330
|
),
|
|
325
331
|
currency: Object.assign(
|
|
@@ -333,11 +339,13 @@ function parseAPI(apiKey, options = {}) {
|
|
|
333
339
|
),
|
|
334
340
|
language: (code, opts) => request(`/language/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
335
341
|
name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts), name_locale: opts?.name_locale }, void 0, opts),
|
|
336
|
-
/** Current local time, UTC by default. With to, offsetless at is source wall time. */
|
|
342
|
+
/** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
|
|
337
343
|
time: Object.assign(
|
|
338
|
-
(timezone, opts) => request(timezone
|
|
344
|
+
(timezone, opts) => request(timePath(timezone), { ...timeSource(timezone, opts), at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts),
|
|
339
345
|
{
|
|
340
|
-
|
|
346
|
+
/** Search serving timezone IDs. Omit query to list all. */
|
|
347
|
+
zones: (query, opts) => request("/time/zones", { q: query, country: opts?.country, area: opts?.area, offset: opts?.offset, abbreviation: opts?.abbreviation, dst: opts?.dst === void 0 ? void 0 : String(opts.dst), observes_dst: opts?.observes_dst === void 0 ? void 0 : String(opts.observes_dst), at: opts?.at, details: opts?.details, sort: opts?.sort }, void 0, opts),
|
|
348
|
+
at: (lat, lon, opts) => request("/time", { lat, lon, at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts)
|
|
341
349
|
}
|
|
342
350
|
),
|
|
343
351
|
timezone: Object.assign(
|
|
@@ -379,6 +387,24 @@ function parseAPI(apiKey, options = {}) {
|
|
|
379
387
|
)
|
|
380
388
|
};
|
|
381
389
|
}
|
|
390
|
+
function timeSource(timezone, options = {}) {
|
|
391
|
+
const values = { ip: options.ip, city: options.city, country: options.country, state: options.state, iata: options.iata, icao: options.icao, unlocode: options.unlocode, address: options.address };
|
|
392
|
+
const primary = [options.ip, options.city, options.iata, options.icao, options.unlocode, options.address].filter((value) => value !== void 0);
|
|
393
|
+
const present = Object.values(values).some((value) => value !== void 0);
|
|
394
|
+
if (Object.values(values).some((value) => value !== void 0 && (typeof value !== "string" || !value.trim())) || timezone !== void 0 && present || primary.length > 1 || options.country !== void 0 && primary.length > 0 && options.city === void 0 && options.address === void 0 || options.state !== void 0 && (options.city === void 0 && options.address === void 0 || options.country === void 0) || options.address !== void 0 && options.country === void 0) throw new TypeError("Pass one Time source, using country only with city or address and state only with city or address and country.");
|
|
395
|
+
return values;
|
|
396
|
+
}
|
|
397
|
+
function timePath(timezone) {
|
|
398
|
+
if (timezone !== void 0 && ["zones", "help"].includes(timezone.trim().toLowerCase())) throw new TypeError("Time source must be an IANA timezone ID. Use timezone discovery to list IDs.");
|
|
399
|
+
return timezone === void 0 ? "/time" : `/time/${encodeURIComponent(timezone)}`;
|
|
400
|
+
}
|
|
401
|
+
function timeTargets(targets, to) {
|
|
402
|
+
if (targets === void 0) return void 0;
|
|
403
|
+
if (to !== void 0 || !Array.isArray(targets) || targets.length < 1 || targets.length > 10 || Array.from(targets).some((zone) => typeof zone !== "string" || !zone.trim() || zone.includes(","))) {
|
|
404
|
+
throw new TypeError("Time targets requires 1 to 10 timezone IDs and cannot be combined with to.");
|
|
405
|
+
}
|
|
406
|
+
return targets.join(",");
|
|
407
|
+
}
|
|
382
408
|
// Annotate the CommonJS export names for ESM import in node:
|
|
383
409
|
0 && (module.exports = {
|
|
384
410
|
ParseAPIError,
|
package/dist/index.d.cts
CHANGED
|
@@ -377,11 +377,13 @@ interface TariffMeasure {
|
|
|
377
377
|
conditional?: boolean | null;
|
|
378
378
|
}
|
|
379
379
|
interface TariffDeep {
|
|
380
|
+
/** Open-string explanation when effective_rate is null. */
|
|
381
|
+
reason?: string | null;
|
|
380
382
|
/** The origin country the measures were resolved for. */
|
|
381
383
|
origin?: string | null;
|
|
382
|
-
/** Composed ad valorem percent. Null when the components do not compose cleanly. */
|
|
384
|
+
/** Composed ad valorem percent for matched stored measures only, not complete duty or landed cost. Null when the components do not compose cleanly. */
|
|
383
385
|
effective_rate?: number | null;
|
|
384
|
-
/**
|
|
386
|
+
/** Matching stored Chapter 99 schedule measures for this code and goods origin. */
|
|
385
387
|
measures?: TariffMeasure[] | null;
|
|
386
388
|
/** Units of quantity (No., kg). */
|
|
387
389
|
units: string[];
|
|
@@ -391,6 +393,10 @@ interface TariffDeep {
|
|
|
391
393
|
other: string | null;
|
|
392
394
|
}
|
|
393
395
|
interface Tariff {
|
|
396
|
+
/** Exact immutable edition. Older servers may omit it. */
|
|
397
|
+
edition?: string;
|
|
398
|
+
/** Answering date, or null for an undated edition query. */
|
|
399
|
+
date?: string | null;
|
|
394
400
|
/** Normalized code with dots (8471.30.01.00). */
|
|
395
401
|
hts: string;
|
|
396
402
|
/** The schedule line verbatim. */
|
|
@@ -407,8 +413,14 @@ interface TariffSearchHit {
|
|
|
407
413
|
hts: string;
|
|
408
414
|
description: string;
|
|
409
415
|
general: string | null;
|
|
416
|
+
/** Parent descriptions, outermost first. Older responses may omit this context. */
|
|
417
|
+
lineage?: string[] | null;
|
|
410
418
|
}
|
|
411
419
|
interface TariffSearch {
|
|
420
|
+
/** Exact immutable edition. Older servers may omit it. */
|
|
421
|
+
edition?: string;
|
|
422
|
+
/** Answering date, or null for an undated edition query. */
|
|
423
|
+
date?: string | null;
|
|
412
424
|
q: string;
|
|
413
425
|
revision: string;
|
|
414
426
|
/** Up to 20 tariff lines, best match first. */
|
|
@@ -695,8 +707,47 @@ interface Timezone {
|
|
|
695
707
|
to?: TimezoneConversionTarget | null;
|
|
696
708
|
deep?: Deep<TimezoneDeep>;
|
|
697
709
|
}
|
|
698
|
-
/** Current time and timezone facts.
|
|
710
|
+
/** Current time and timezone facts. Unresolved or ambiguous sources keep clock fields null. */
|
|
699
711
|
interface Time extends Timezone {
|
|
712
|
+
/** Present only for explicit location selectors. Ambiguous or missing results retain null clock fields. */
|
|
713
|
+
location?: TimeLocation;
|
|
714
|
+
/** With targets only. Order and duplicates are preserved. Null means the source timezone is unresolved. */
|
|
715
|
+
targets?: TimezoneConversionTarget[] | null;
|
|
716
|
+
}
|
|
717
|
+
/** Serving timezone identifiers and their pinned rule edition. */
|
|
718
|
+
interface TimeZones {
|
|
719
|
+
timezone_database_version: string;
|
|
720
|
+
timezones: string[];
|
|
721
|
+
/** Present with details=true. The one instant used for all rows. */
|
|
722
|
+
at?: string;
|
|
723
|
+
zones?: TimeZoneEntry[];
|
|
724
|
+
}
|
|
725
|
+
interface TimeZoneEntry {
|
|
726
|
+
timezone: string;
|
|
727
|
+
countries: string[];
|
|
728
|
+
area: string | null;
|
|
729
|
+
abbreviation: string;
|
|
730
|
+
offset: string;
|
|
731
|
+
offset_seconds: number;
|
|
732
|
+
dst: boolean;
|
|
733
|
+
observes_dst: boolean;
|
|
734
|
+
}
|
|
735
|
+
interface TimeTransitionState {
|
|
736
|
+
at?: string | null;
|
|
737
|
+
offset?: string | null;
|
|
738
|
+
offset_seconds?: number | null;
|
|
739
|
+
abbreviation?: string | null;
|
|
740
|
+
dst?: boolean | null;
|
|
741
|
+
}
|
|
742
|
+
interface TimeTransition {
|
|
743
|
+
at?: string | null;
|
|
744
|
+
before?: TimeTransitionState | null;
|
|
745
|
+
after?: TimeTransitionState | null;
|
|
746
|
+
change_seconds?: number | null;
|
|
747
|
+
}
|
|
748
|
+
interface TimeSeason {
|
|
749
|
+
start?: TimeTransition | null;
|
|
750
|
+
end?: TimeTransition | null;
|
|
700
751
|
}
|
|
701
752
|
/** The other side of a timezone conversion. `at` is the converted wall time. */
|
|
702
753
|
interface TimezoneConversionTarget {
|
|
@@ -1208,7 +1259,31 @@ interface NameDeep {
|
|
|
1208
1259
|
/** Name initials using CLDR formatting rules. */
|
|
1209
1260
|
initials?: string | null;
|
|
1210
1261
|
}
|
|
1262
|
+
/** How an offsetless source wall time selected an instant. */
|
|
1263
|
+
interface TimeResolution {
|
|
1264
|
+
kind?: string | null;
|
|
1265
|
+
policy?: string | null;
|
|
1266
|
+
/** Signed wall-clock adjustment. Zero for unique and overlapping times. */
|
|
1267
|
+
adjustment_seconds?: number | null;
|
|
1268
|
+
/** Chronological alternatives. Empty means the wall time is unique. */
|
|
1269
|
+
alternatives?: TimeResolutionAlternative[] | null;
|
|
1270
|
+
}
|
|
1271
|
+
interface TimeResolutionAlternative {
|
|
1272
|
+
at?: string | null;
|
|
1273
|
+
unix?: number | null;
|
|
1274
|
+
offset?: string | null;
|
|
1275
|
+
}
|
|
1211
1276
|
interface TimezoneDeep {
|
|
1277
|
+
/** Rule-defined standard offset. Seasonal changes may be negative. */
|
|
1278
|
+
standard_offset?: string | null;
|
|
1279
|
+
standard_offset_seconds?: number | null;
|
|
1280
|
+
dst_offset_seconds?: number | null;
|
|
1281
|
+
/** Current DST-flag interval, or the next within 400 days. */
|
|
1282
|
+
season?: TimeSeason | null;
|
|
1283
|
+
/** Pinned rules used by canonical Time. */
|
|
1284
|
+
timezone_database_version?: string | null;
|
|
1285
|
+
/** Null when no offsetless conversion was resolved. */
|
|
1286
|
+
resolution?: TimeResolution | null;
|
|
1212
1287
|
name: string | null;
|
|
1213
1288
|
/** Whole minutes, truncated toward zero for historical second offsets. */
|
|
1214
1289
|
offset_minutes: number | null;
|
|
@@ -1292,6 +1367,26 @@ interface PropertyTax {
|
|
|
1292
1367
|
/** Reporting period, YYYY-YYYY. Monetary amounts use the final year of this period. */
|
|
1293
1368
|
period: string;
|
|
1294
1369
|
}
|
|
1370
|
+
interface TimeLocationInput {
|
|
1371
|
+
type: string;
|
|
1372
|
+
value: string;
|
|
1373
|
+
}
|
|
1374
|
+
interface TimeLocationCandidate {
|
|
1375
|
+
id: string | null;
|
|
1376
|
+
name: string | null;
|
|
1377
|
+
country: string | null;
|
|
1378
|
+
state: string | null;
|
|
1379
|
+
timezone: string | null;
|
|
1380
|
+
latitude: number | null;
|
|
1381
|
+
longitude: number | null;
|
|
1382
|
+
}
|
|
1383
|
+
interface TimeLocation {
|
|
1384
|
+
input: TimeLocationInput;
|
|
1385
|
+
status: string;
|
|
1386
|
+
candidates: TimeLocationCandidate[];
|
|
1387
|
+
truncated: boolean;
|
|
1388
|
+
source: string;
|
|
1389
|
+
}
|
|
1295
1390
|
|
|
1296
1391
|
/** A proposed task contains operation counts, never lookup inputs. */
|
|
1297
1392
|
interface PreflightOperation {
|
|
@@ -1554,8 +1649,15 @@ type NaicsSearchOptions = {
|
|
|
1554
1649
|
type TariffOptions = {
|
|
1555
1650
|
/** Origin country (ISO2). With paid deep, resolves country-specific measures. */
|
|
1556
1651
|
origin?: string;
|
|
1652
|
+
/** Exact immutable edition fingerprint. */
|
|
1653
|
+
edition?: string;
|
|
1654
|
+
/** YYYY-MM-DD, accepted only with verified source coverage. */
|
|
1655
|
+
date?: string;
|
|
1557
1656
|
} & DeepOption & RequestOptions;
|
|
1558
|
-
type TariffSearchOptions =
|
|
1657
|
+
type TariffSearchOptions = {
|
|
1658
|
+
edition?: string;
|
|
1659
|
+
date?: string;
|
|
1660
|
+
} & RequestOptions;
|
|
1559
1661
|
type CurrencyOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1560
1662
|
type CurrencyRateOptions = {
|
|
1561
1663
|
date?: string;
|
|
@@ -1568,14 +1670,50 @@ type NameOptions = {
|
|
|
1568
1670
|
/** CLDR name-formatting locale, such as en or ja. Defaults to en. */
|
|
1569
1671
|
name_locale?: string;
|
|
1570
1672
|
} & DeepOption & RequestOptions;
|
|
1673
|
+
/** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
|
|
1571
1674
|
type TimeOptions = LanguageOption & {
|
|
1675
|
+
ip?: string;
|
|
1676
|
+
city?: string;
|
|
1677
|
+
country?: string;
|
|
1678
|
+
state?: string;
|
|
1679
|
+
iata?: string;
|
|
1680
|
+
icao?: string;
|
|
1681
|
+
unlocode?: string;
|
|
1682
|
+
address?: string;
|
|
1683
|
+
/** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
|
|
1572
1684
|
at?: string;
|
|
1685
|
+
/** Destination IANA timezone. The target has the same unix instant. */
|
|
1573
1686
|
to?: string;
|
|
1687
|
+
/** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
|
|
1688
|
+
targets?: readonly string[];
|
|
1689
|
+
/** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
|
|
1690
|
+
disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
|
|
1574
1691
|
} & DeepOption & RequestOptions;
|
|
1692
|
+
/** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
|
|
1575
1693
|
type TimeAtOptions = LanguageOption & {
|
|
1694
|
+
/** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
|
|
1576
1695
|
at?: string;
|
|
1696
|
+
/** Destination IANA timezone. The target has the same unix instant. */
|
|
1577
1697
|
to?: string;
|
|
1698
|
+
/** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
|
|
1699
|
+
targets?: readonly string[];
|
|
1700
|
+
/** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
|
|
1701
|
+
disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
|
|
1578
1702
|
} & DeepOption & RequestOptions;
|
|
1703
|
+
/** Filter supported identifiers at one instant. Abbreviations return candidates, never an inferred zone. */
|
|
1704
|
+
type TimeZonesOptions = {
|
|
1705
|
+
country?: string;
|
|
1706
|
+
area?: string;
|
|
1707
|
+
/** Exact signed UTC offset, such as +05:45 or +00:09:21. */
|
|
1708
|
+
offset?: string;
|
|
1709
|
+
abbreviation?: string;
|
|
1710
|
+
dst?: boolean;
|
|
1711
|
+
/** Whether a DST-flagged state occurs in the UTC calendar year containing at. */
|
|
1712
|
+
observes_dst?: boolean;
|
|
1713
|
+
at?: string;
|
|
1714
|
+
details?: boolean;
|
|
1715
|
+
sort?: 'timezone' | 'offset';
|
|
1716
|
+
} & RequestOptions;
|
|
1579
1717
|
type TimezoneOptions = LanguageOption & {
|
|
1580
1718
|
at?: string;
|
|
1581
1719
|
to?: string;
|
|
@@ -1696,8 +1834,10 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1696
1834
|
};
|
|
1697
1835
|
language: (code: string, opts?: LanguageOptions) => Promise<Language>;
|
|
1698
1836
|
name: (name: string, opts?: NameOptions) => Promise<Name>;
|
|
1699
|
-
/** Current local time, UTC by default. With to, offsetless at is source wall time. */
|
|
1837
|
+
/** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
|
|
1700
1838
|
time: ((timezone?: string, opts?: TimeOptions) => Promise<Time>) & {
|
|
1839
|
+
/** Search serving timezone IDs. Omit query to list all. */
|
|
1840
|
+
zones: (query?: string, opts?: TimeZonesOptions) => Promise<TimeZones>;
|
|
1701
1841
|
at: (lat: number, lon: number, opts?: TimeAtOptions) => Promise<Time>;
|
|
1702
1842
|
};
|
|
1703
1843
|
timezone: ((id: string, opts?: TimezoneOptions) => Promise<Timezone>) & {
|
|
@@ -1725,4 +1865,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1725
1865
|
};
|
|
1726
1866
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1727
1867
|
|
|
1728
|
-
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityDeep, type CityIdOptions, type CityNearby, type CityNearbyOptions, type CityNearest, type CityNearestOptions, type CityOptions, type CitySearch, type CitySearchOptions, type Company, type CompanyCountry, type CompanyDeep, type CompanyOptions, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
|
1868
|
+
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityDeep, type CityIdOptions, type CityNearby, type CityNearbyOptions, type CityNearest, type CityNearestOptions, type CityOptions, type CitySearch, type CitySearchOptions, type Company, type CompanyCountry, type CompanyDeep, type CompanyOptions, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeLocation, type TimeLocationCandidate, type TimeLocationInput, type TimeOptions, type TimeResolution, type TimeResolutionAlternative, type TimeSeason, type TimeTransition, type TimeTransitionState, type TimeZoneEntry, type TimeZones, type TimeZonesOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
package/dist/index.d.ts
CHANGED
|
@@ -377,11 +377,13 @@ interface TariffMeasure {
|
|
|
377
377
|
conditional?: boolean | null;
|
|
378
378
|
}
|
|
379
379
|
interface TariffDeep {
|
|
380
|
+
/** Open-string explanation when effective_rate is null. */
|
|
381
|
+
reason?: string | null;
|
|
380
382
|
/** The origin country the measures were resolved for. */
|
|
381
383
|
origin?: string | null;
|
|
382
|
-
/** Composed ad valorem percent. Null when the components do not compose cleanly. */
|
|
384
|
+
/** Composed ad valorem percent for matched stored measures only, not complete duty or landed cost. Null when the components do not compose cleanly. */
|
|
383
385
|
effective_rate?: number | null;
|
|
384
|
-
/**
|
|
386
|
+
/** Matching stored Chapter 99 schedule measures for this code and goods origin. */
|
|
385
387
|
measures?: TariffMeasure[] | null;
|
|
386
388
|
/** Units of quantity (No., kg). */
|
|
387
389
|
units: string[];
|
|
@@ -391,6 +393,10 @@ interface TariffDeep {
|
|
|
391
393
|
other: string | null;
|
|
392
394
|
}
|
|
393
395
|
interface Tariff {
|
|
396
|
+
/** Exact immutable edition. Older servers may omit it. */
|
|
397
|
+
edition?: string;
|
|
398
|
+
/** Answering date, or null for an undated edition query. */
|
|
399
|
+
date?: string | null;
|
|
394
400
|
/** Normalized code with dots (8471.30.01.00). */
|
|
395
401
|
hts: string;
|
|
396
402
|
/** The schedule line verbatim. */
|
|
@@ -407,8 +413,14 @@ interface TariffSearchHit {
|
|
|
407
413
|
hts: string;
|
|
408
414
|
description: string;
|
|
409
415
|
general: string | null;
|
|
416
|
+
/** Parent descriptions, outermost first. Older responses may omit this context. */
|
|
417
|
+
lineage?: string[] | null;
|
|
410
418
|
}
|
|
411
419
|
interface TariffSearch {
|
|
420
|
+
/** Exact immutable edition. Older servers may omit it. */
|
|
421
|
+
edition?: string;
|
|
422
|
+
/** Answering date, or null for an undated edition query. */
|
|
423
|
+
date?: string | null;
|
|
412
424
|
q: string;
|
|
413
425
|
revision: string;
|
|
414
426
|
/** Up to 20 tariff lines, best match first. */
|
|
@@ -695,8 +707,47 @@ interface Timezone {
|
|
|
695
707
|
to?: TimezoneConversionTarget | null;
|
|
696
708
|
deep?: Deep<TimezoneDeep>;
|
|
697
709
|
}
|
|
698
|
-
/** Current time and timezone facts.
|
|
710
|
+
/** Current time and timezone facts. Unresolved or ambiguous sources keep clock fields null. */
|
|
699
711
|
interface Time extends Timezone {
|
|
712
|
+
/** Present only for explicit location selectors. Ambiguous or missing results retain null clock fields. */
|
|
713
|
+
location?: TimeLocation;
|
|
714
|
+
/** With targets only. Order and duplicates are preserved. Null means the source timezone is unresolved. */
|
|
715
|
+
targets?: TimezoneConversionTarget[] | null;
|
|
716
|
+
}
|
|
717
|
+
/** Serving timezone identifiers and their pinned rule edition. */
|
|
718
|
+
interface TimeZones {
|
|
719
|
+
timezone_database_version: string;
|
|
720
|
+
timezones: string[];
|
|
721
|
+
/** Present with details=true. The one instant used for all rows. */
|
|
722
|
+
at?: string;
|
|
723
|
+
zones?: TimeZoneEntry[];
|
|
724
|
+
}
|
|
725
|
+
interface TimeZoneEntry {
|
|
726
|
+
timezone: string;
|
|
727
|
+
countries: string[];
|
|
728
|
+
area: string | null;
|
|
729
|
+
abbreviation: string;
|
|
730
|
+
offset: string;
|
|
731
|
+
offset_seconds: number;
|
|
732
|
+
dst: boolean;
|
|
733
|
+
observes_dst: boolean;
|
|
734
|
+
}
|
|
735
|
+
interface TimeTransitionState {
|
|
736
|
+
at?: string | null;
|
|
737
|
+
offset?: string | null;
|
|
738
|
+
offset_seconds?: number | null;
|
|
739
|
+
abbreviation?: string | null;
|
|
740
|
+
dst?: boolean | null;
|
|
741
|
+
}
|
|
742
|
+
interface TimeTransition {
|
|
743
|
+
at?: string | null;
|
|
744
|
+
before?: TimeTransitionState | null;
|
|
745
|
+
after?: TimeTransitionState | null;
|
|
746
|
+
change_seconds?: number | null;
|
|
747
|
+
}
|
|
748
|
+
interface TimeSeason {
|
|
749
|
+
start?: TimeTransition | null;
|
|
750
|
+
end?: TimeTransition | null;
|
|
700
751
|
}
|
|
701
752
|
/** The other side of a timezone conversion. `at` is the converted wall time. */
|
|
702
753
|
interface TimezoneConversionTarget {
|
|
@@ -1208,7 +1259,31 @@ interface NameDeep {
|
|
|
1208
1259
|
/** Name initials using CLDR formatting rules. */
|
|
1209
1260
|
initials?: string | null;
|
|
1210
1261
|
}
|
|
1262
|
+
/** How an offsetless source wall time selected an instant. */
|
|
1263
|
+
interface TimeResolution {
|
|
1264
|
+
kind?: string | null;
|
|
1265
|
+
policy?: string | null;
|
|
1266
|
+
/** Signed wall-clock adjustment. Zero for unique and overlapping times. */
|
|
1267
|
+
adjustment_seconds?: number | null;
|
|
1268
|
+
/** Chronological alternatives. Empty means the wall time is unique. */
|
|
1269
|
+
alternatives?: TimeResolutionAlternative[] | null;
|
|
1270
|
+
}
|
|
1271
|
+
interface TimeResolutionAlternative {
|
|
1272
|
+
at?: string | null;
|
|
1273
|
+
unix?: number | null;
|
|
1274
|
+
offset?: string | null;
|
|
1275
|
+
}
|
|
1211
1276
|
interface TimezoneDeep {
|
|
1277
|
+
/** Rule-defined standard offset. Seasonal changes may be negative. */
|
|
1278
|
+
standard_offset?: string | null;
|
|
1279
|
+
standard_offset_seconds?: number | null;
|
|
1280
|
+
dst_offset_seconds?: number | null;
|
|
1281
|
+
/** Current DST-flag interval, or the next within 400 days. */
|
|
1282
|
+
season?: TimeSeason | null;
|
|
1283
|
+
/** Pinned rules used by canonical Time. */
|
|
1284
|
+
timezone_database_version?: string | null;
|
|
1285
|
+
/** Null when no offsetless conversion was resolved. */
|
|
1286
|
+
resolution?: TimeResolution | null;
|
|
1212
1287
|
name: string | null;
|
|
1213
1288
|
/** Whole minutes, truncated toward zero for historical second offsets. */
|
|
1214
1289
|
offset_minutes: number | null;
|
|
@@ -1292,6 +1367,26 @@ interface PropertyTax {
|
|
|
1292
1367
|
/** Reporting period, YYYY-YYYY. Monetary amounts use the final year of this period. */
|
|
1293
1368
|
period: string;
|
|
1294
1369
|
}
|
|
1370
|
+
interface TimeLocationInput {
|
|
1371
|
+
type: string;
|
|
1372
|
+
value: string;
|
|
1373
|
+
}
|
|
1374
|
+
interface TimeLocationCandidate {
|
|
1375
|
+
id: string | null;
|
|
1376
|
+
name: string | null;
|
|
1377
|
+
country: string | null;
|
|
1378
|
+
state: string | null;
|
|
1379
|
+
timezone: string | null;
|
|
1380
|
+
latitude: number | null;
|
|
1381
|
+
longitude: number | null;
|
|
1382
|
+
}
|
|
1383
|
+
interface TimeLocation {
|
|
1384
|
+
input: TimeLocationInput;
|
|
1385
|
+
status: string;
|
|
1386
|
+
candidates: TimeLocationCandidate[];
|
|
1387
|
+
truncated: boolean;
|
|
1388
|
+
source: string;
|
|
1389
|
+
}
|
|
1295
1390
|
|
|
1296
1391
|
/** A proposed task contains operation counts, never lookup inputs. */
|
|
1297
1392
|
interface PreflightOperation {
|
|
@@ -1554,8 +1649,15 @@ type NaicsSearchOptions = {
|
|
|
1554
1649
|
type TariffOptions = {
|
|
1555
1650
|
/** Origin country (ISO2). With paid deep, resolves country-specific measures. */
|
|
1556
1651
|
origin?: string;
|
|
1652
|
+
/** Exact immutable edition fingerprint. */
|
|
1653
|
+
edition?: string;
|
|
1654
|
+
/** YYYY-MM-DD, accepted only with verified source coverage. */
|
|
1655
|
+
date?: string;
|
|
1557
1656
|
} & DeepOption & RequestOptions;
|
|
1558
|
-
type TariffSearchOptions =
|
|
1657
|
+
type TariffSearchOptions = {
|
|
1658
|
+
edition?: string;
|
|
1659
|
+
date?: string;
|
|
1660
|
+
} & RequestOptions;
|
|
1559
1661
|
type CurrencyOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1560
1662
|
type CurrencyRateOptions = {
|
|
1561
1663
|
date?: string;
|
|
@@ -1568,14 +1670,50 @@ type NameOptions = {
|
|
|
1568
1670
|
/** CLDR name-formatting locale, such as en or ja. Defaults to en. */
|
|
1569
1671
|
name_locale?: string;
|
|
1570
1672
|
} & DeepOption & RequestOptions;
|
|
1673
|
+
/** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
|
|
1571
1674
|
type TimeOptions = LanguageOption & {
|
|
1675
|
+
ip?: string;
|
|
1676
|
+
city?: string;
|
|
1677
|
+
country?: string;
|
|
1678
|
+
state?: string;
|
|
1679
|
+
iata?: string;
|
|
1680
|
+
icao?: string;
|
|
1681
|
+
unlocode?: string;
|
|
1682
|
+
address?: string;
|
|
1683
|
+
/** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
|
|
1572
1684
|
at?: string;
|
|
1685
|
+
/** Destination IANA timezone. The target has the same unix instant. */
|
|
1573
1686
|
to?: string;
|
|
1687
|
+
/** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
|
|
1688
|
+
targets?: readonly string[];
|
|
1689
|
+
/** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
|
|
1690
|
+
disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
|
|
1574
1691
|
} & DeepOption & RequestOptions;
|
|
1692
|
+
/** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
|
|
1575
1693
|
type TimeAtOptions = LanguageOption & {
|
|
1694
|
+
/** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
|
|
1576
1695
|
at?: string;
|
|
1696
|
+
/** Destination IANA timezone. The target has the same unix instant. */
|
|
1577
1697
|
to?: string;
|
|
1698
|
+
/** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
|
|
1699
|
+
targets?: readonly string[];
|
|
1700
|
+
/** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
|
|
1701
|
+
disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
|
|
1578
1702
|
} & DeepOption & RequestOptions;
|
|
1703
|
+
/** Filter supported identifiers at one instant. Abbreviations return candidates, never an inferred zone. */
|
|
1704
|
+
type TimeZonesOptions = {
|
|
1705
|
+
country?: string;
|
|
1706
|
+
area?: string;
|
|
1707
|
+
/** Exact signed UTC offset, such as +05:45 or +00:09:21. */
|
|
1708
|
+
offset?: string;
|
|
1709
|
+
abbreviation?: string;
|
|
1710
|
+
dst?: boolean;
|
|
1711
|
+
/** Whether a DST-flagged state occurs in the UTC calendar year containing at. */
|
|
1712
|
+
observes_dst?: boolean;
|
|
1713
|
+
at?: string;
|
|
1714
|
+
details?: boolean;
|
|
1715
|
+
sort?: 'timezone' | 'offset';
|
|
1716
|
+
} & RequestOptions;
|
|
1579
1717
|
type TimezoneOptions = LanguageOption & {
|
|
1580
1718
|
at?: string;
|
|
1581
1719
|
to?: string;
|
|
@@ -1696,8 +1834,10 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1696
1834
|
};
|
|
1697
1835
|
language: (code: string, opts?: LanguageOptions) => Promise<Language>;
|
|
1698
1836
|
name: (name: string, opts?: NameOptions) => Promise<Name>;
|
|
1699
|
-
/** Current local time, UTC by default. With to, offsetless at is source wall time. */
|
|
1837
|
+
/** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
|
|
1700
1838
|
time: ((timezone?: string, opts?: TimeOptions) => Promise<Time>) & {
|
|
1839
|
+
/** Search serving timezone IDs. Omit query to list all. */
|
|
1840
|
+
zones: (query?: string, opts?: TimeZonesOptions) => Promise<TimeZones>;
|
|
1701
1841
|
at: (lat: number, lon: number, opts?: TimeAtOptions) => Promise<Time>;
|
|
1702
1842
|
};
|
|
1703
1843
|
timezone: ((id: string, opts?: TimezoneOptions) => Promise<Timezone>) & {
|
|
@@ -1725,4 +1865,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1725
1865
|
};
|
|
1726
1866
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1727
1867
|
|
|
1728
|
-
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityDeep, type CityIdOptions, type CityNearby, type CityNearbyOptions, type CityNearest, type CityNearestOptions, type CityOptions, type CitySearch, type CitySearchOptions, type Company, type CompanyCountry, type CompanyDeep, type CompanyOptions, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
|
1868
|
+
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityDeep, type CityIdOptions, type CityNearby, type CityNearbyOptions, type CityNearest, type CityNearestOptions, type CityOptions, type CitySearch, type CitySearchOptions, type Company, type CompanyCountry, type CompanyDeep, type CompanyOptions, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeLocation, type TimeLocationCandidate, type TimeLocationInput, type TimeOptions, type TimeResolution, type TimeResolutionAlternative, type TimeSeason, type TimeTransition, type TimeTransitionState, type TimeZoneEntry, type TimeZones, type TimeZonesOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
var VERSION = "1.
|
|
2
|
+
var VERSION = "1.7.0";
|
|
3
3
|
var API_VERSION = "2.0.0";
|
|
4
4
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
5
5
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -24,6 +24,12 @@ var ParseAPIError = class extends Error {
|
|
|
24
24
|
this.requestId = requestId;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
+
function tariffSelection(result, opts) {
|
|
28
|
+
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))) {
|
|
29
|
+
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);
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
27
33
|
function env(name) {
|
|
28
34
|
return typeof process !== "undefined" ? process.env?.[name] : void 0;
|
|
29
35
|
}
|
|
@@ -292,9 +298,9 @@ function parseAPI(apiKey, options = {}) {
|
|
|
292
298
|
),
|
|
293
299
|
/** 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. */
|
|
294
300
|
tariff: Object.assign(
|
|
295
|
-
(code, opts) => request(`/tariff/${enc(code)}`, { origin: opts?.origin, ...deepQuery(opts) }, void 0, opts),
|
|
301
|
+
(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)),
|
|
296
302
|
{
|
|
297
|
-
search: (query, opts) => request("/tariff", { q: query }, void 0, opts)
|
|
303
|
+
search: (query, opts) => request("/tariff", { q: query, edition: opts?.edition, date: opts?.date }, void 0, opts).then((result) => tariffSelection(result, opts))
|
|
298
304
|
}
|
|
299
305
|
),
|
|
300
306
|
currency: Object.assign(
|
|
@@ -308,11 +314,13 @@ function parseAPI(apiKey, options = {}) {
|
|
|
308
314
|
),
|
|
309
315
|
language: (code, opts) => request(`/language/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
310
316
|
name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts), name_locale: opts?.name_locale }, void 0, opts),
|
|
311
|
-
/** Current local time, UTC by default. With to, offsetless at is source wall time. */
|
|
317
|
+
/** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
|
|
312
318
|
time: Object.assign(
|
|
313
|
-
(timezone, opts) => request(timezone
|
|
319
|
+
(timezone, opts) => request(timePath(timezone), { ...timeSource(timezone, opts), at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts),
|
|
314
320
|
{
|
|
315
|
-
|
|
321
|
+
/** Search serving timezone IDs. Omit query to list all. */
|
|
322
|
+
zones: (query, opts) => request("/time/zones", { q: query, country: opts?.country, area: opts?.area, offset: opts?.offset, abbreviation: opts?.abbreviation, dst: opts?.dst === void 0 ? void 0 : String(opts.dst), observes_dst: opts?.observes_dst === void 0 ? void 0 : String(opts.observes_dst), at: opts?.at, details: opts?.details, sort: opts?.sort }, void 0, opts),
|
|
323
|
+
at: (lat, lon, opts) => request("/time", { lat, lon, at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts)
|
|
316
324
|
}
|
|
317
325
|
),
|
|
318
326
|
timezone: Object.assign(
|
|
@@ -354,6 +362,24 @@ function parseAPI(apiKey, options = {}) {
|
|
|
354
362
|
)
|
|
355
363
|
};
|
|
356
364
|
}
|
|
365
|
+
function timeSource(timezone, options = {}) {
|
|
366
|
+
const values = { ip: options.ip, city: options.city, country: options.country, state: options.state, iata: options.iata, icao: options.icao, unlocode: options.unlocode, address: options.address };
|
|
367
|
+
const primary = [options.ip, options.city, options.iata, options.icao, options.unlocode, options.address].filter((value) => value !== void 0);
|
|
368
|
+
const present = Object.values(values).some((value) => value !== void 0);
|
|
369
|
+
if (Object.values(values).some((value) => value !== void 0 && (typeof value !== "string" || !value.trim())) || timezone !== void 0 && present || primary.length > 1 || options.country !== void 0 && primary.length > 0 && options.city === void 0 && options.address === void 0 || options.state !== void 0 && (options.city === void 0 && options.address === void 0 || options.country === void 0) || options.address !== void 0 && options.country === void 0) throw new TypeError("Pass one Time source, using country only with city or address and state only with city or address and country.");
|
|
370
|
+
return values;
|
|
371
|
+
}
|
|
372
|
+
function timePath(timezone) {
|
|
373
|
+
if (timezone !== void 0 && ["zones", "help"].includes(timezone.trim().toLowerCase())) throw new TypeError("Time source must be an IANA timezone ID. Use timezone discovery to list IDs.");
|
|
374
|
+
return timezone === void 0 ? "/time" : `/time/${encodeURIComponent(timezone)}`;
|
|
375
|
+
}
|
|
376
|
+
function timeTargets(targets, to) {
|
|
377
|
+
if (targets === void 0) return void 0;
|
|
378
|
+
if (to !== void 0 || !Array.isArray(targets) || targets.length < 1 || targets.length > 10 || Array.from(targets).some((zone) => typeof zone !== "string" || !zone.trim() || zone.includes(","))) {
|
|
379
|
+
throw new TypeError("Time targets requires 1 to 10 timezone IDs and cannot be combined with to.");
|
|
380
|
+
}
|
|
381
|
+
return targets.join(",");
|
|
382
|
+
}
|
|
357
383
|
export {
|
|
358
384
|
ParseAPIError,
|
|
359
385
|
parseAPI
|