@parseapi/sdk 1.10.1 → 1.10.3
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 +3 -1
- package/dist/index.cjs +10 -5
- package/dist/index.d.cts +18 -16
- package/dist/index.d.ts +18 -16
- package/dist/index.js +10 -5
- package/dist/offline.cjs +3 -3
- package/dist/offline.d.cts +1 -1
- package/dist/offline.d.ts +1 -1
- package/dist/offline.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -258,6 +258,8 @@ const units = await parse.measure.units({ unit: 'm' });
|
|
|
258
258
|
|
|
259
259
|
`amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
|
|
260
260
|
|
|
261
|
+
Successful HTTP JSON contains `measure`, `valid`, `type`, `amount`, and `unit`. Invalid input adds `reason`. `choices` appears only when unit alternatives are available. The typed client keeps `reason` readable as `null` and `choices` as `[]` when omitted, while JSON serialization retains the API response shape.
|
|
262
|
+
|
|
261
263
|
Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
|
|
262
264
|
|
|
263
265
|
## Place statistics and optional detail
|
|
@@ -323,7 +325,7 @@ Invalid input returns `valid: false` with unknown provider fields. A checksum-va
|
|
|
323
325
|
|
|
324
326
|
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.
|
|
325
327
|
|
|
326
|
-
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.
|
|
328
|
+
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. Provider record dates describe the provider record. Unknown dates stay null.
|
|
327
329
|
|
|
328
330
|
## Deep
|
|
329
331
|
|
package/dist/index.cjs
CHANGED
|
@@ -63,7 +63,7 @@ var EmojiCatalog = class {
|
|
|
63
63
|
compareNames;
|
|
64
64
|
segmenter;
|
|
65
65
|
constructor(data) {
|
|
66
|
-
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !data.metadata?.source_version) {
|
|
66
|
+
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !(data.metadata?.source_version || data.metadata?.edition)) {
|
|
67
67
|
throw new EmojiCatalogError("invalid_catalog", "Use the JSON response from GET /emoji/catalog.");
|
|
68
68
|
}
|
|
69
69
|
this.data = structuredClone(data);
|
|
@@ -252,7 +252,7 @@ var EmojiCatalog = class {
|
|
|
252
252
|
for (const [key, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
253
253
|
if (options[key] !== void 0 && (!options[key].trim() || !known.has(filterKey(options[key])))) invalid(`Unknown emoji ${key}. Use categories() to find supported values.`);
|
|
254
254
|
}
|
|
255
|
-
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version) > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
255
|
+
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
256
256
|
let rows = this.filtered(options);
|
|
257
257
|
if (query) {
|
|
258
258
|
this.ensureSearch();
|
|
@@ -272,7 +272,7 @@ var EmojiCatalog = class {
|
|
|
272
272
|
for (const [key2, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
273
273
|
if (options[key2] !== void 0 && (!options[key2].trim() || !known.has(filterKey(options[key2])))) invalid(`Unknown emoji ${key2}. Use categories() to find supported values.`);
|
|
274
274
|
}
|
|
275
|
-
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version) > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
275
|
+
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
276
276
|
if (options.includeSkinTones !== false && options.category === void 0 && options.subcategory === void 0 && options.version === void 0 && options.maxVersion === void 0) return this.data.emojis;
|
|
277
277
|
const key = JSON.stringify([options.includeSkinTones === false, options.category === void 0 ? null : filterKey(options.category), options.subcategory === void 0 ? null : filterKey(options.subcategory), options.version, options.maxVersion]);
|
|
278
278
|
const cached = this.filterCache.get(key);
|
|
@@ -285,7 +285,7 @@ var EmojiCatalog = class {
|
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
// src/index.ts
|
|
288
|
-
var VERSION = "1.10.
|
|
288
|
+
var VERSION = "1.10.2";
|
|
289
289
|
var API_VERSION = "2.0.0";
|
|
290
290
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
291
291
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -612,7 +612,12 @@ function parseAPI(apiKey, options = {}) {
|
|
|
612
612
|
},
|
|
613
613
|
/** Parse a measurement or convert it to `to`. Without `to`, use its type's canonical unit. Invalid input is plain data with `valid: false`. */
|
|
614
614
|
measure: Object.assign(
|
|
615
|
-
(measure, opts) =>
|
|
615
|
+
async (measure, opts) => {
|
|
616
|
+
const result = await request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts);
|
|
617
|
+
if (!Object.prototype.hasOwnProperty.call(result, "reason")) Object.defineProperty(result, "reason", { value: null, writable: true, configurable: true });
|
|
618
|
+
if (!Object.prototype.hasOwnProperty.call(result, "choices")) Object.defineProperty(result, "choices", { value: [], writable: true, configurable: true });
|
|
619
|
+
return result;
|
|
620
|
+
},
|
|
616
621
|
{
|
|
617
622
|
/** Discover reviewed units. Pass `unit` to find compatible conversion targets. */
|
|
618
623
|
units: (opts) => request("/measure/units", { q: opts?.query, type: opts?.type, unit: opts?.unit }, void 0, opts)
|
package/dist/index.d.cts
CHANGED
|
@@ -19,7 +19,9 @@ interface Measure {
|
|
|
19
19
|
type: string | null;
|
|
20
20
|
amount: string | null;
|
|
21
21
|
unit: string | null;
|
|
22
|
+
/** Failure reason. Omitted wire fields remain readable as null. */
|
|
22
23
|
reason: string | null;
|
|
24
|
+
/** Unit alternatives. Omitted wire fields remain readable as an empty array. */
|
|
23
25
|
choices: MeasureChoice[];
|
|
24
26
|
}
|
|
25
27
|
interface MeasureUnit {
|
|
@@ -499,8 +501,8 @@ interface Tariff {
|
|
|
499
501
|
lineage: string[];
|
|
500
502
|
/** Column 1 general rate, verbatim. */
|
|
501
503
|
general: string | null;
|
|
502
|
-
/**
|
|
503
|
-
revision
|
|
504
|
+
/** @deprecated Omitted from current API responses. */
|
|
505
|
+
revision?: string;
|
|
504
506
|
deep?: Deep<TariffDeep>;
|
|
505
507
|
}
|
|
506
508
|
interface TariffSearchHit {
|
|
@@ -516,7 +518,7 @@ interface TariffSearch {
|
|
|
516
518
|
/** Answering date, or null for an undated edition query. */
|
|
517
519
|
date?: string | null;
|
|
518
520
|
q: string;
|
|
519
|
-
revision
|
|
521
|
+
revision?: string;
|
|
520
522
|
/** Up to 20 tariff lines, best match first. */
|
|
521
523
|
lines: TariffSearchHit[];
|
|
522
524
|
}
|
|
@@ -811,9 +813,9 @@ interface Time extends Timezone {
|
|
|
811
813
|
/** With targets only. Order and duplicates are preserved. Null means the source timezone is unresolved. */
|
|
812
814
|
targets?: TimezoneConversionTarget[] | null;
|
|
813
815
|
}
|
|
814
|
-
/**
|
|
816
|
+
/** Available timezone identifiers. */
|
|
815
817
|
interface TimeZones {
|
|
816
|
-
timezone_database_version
|
|
818
|
+
timezone_database_version?: string;
|
|
817
819
|
timezones: string[];
|
|
818
820
|
/** Present with details=true. The one instant used for all rows. */
|
|
819
821
|
at?: string;
|
|
@@ -1113,7 +1115,7 @@ interface EmojiArtworkSource {
|
|
|
1113
1115
|
interface EmojiMetadata {
|
|
1114
1116
|
edition: string;
|
|
1115
1117
|
max_version: string | null;
|
|
1116
|
-
source_version
|
|
1118
|
+
source_version?: string;
|
|
1117
1119
|
total: number;
|
|
1118
1120
|
sources: EmojiSource[];
|
|
1119
1121
|
artwork_sources: EmojiArtworkSource[];
|
|
@@ -1299,7 +1301,7 @@ interface CompanyProfileEmployees {
|
|
|
1299
1301
|
/** Open string, currently legal_entity or consolidated_group. */
|
|
1300
1302
|
scope: string;
|
|
1301
1303
|
/** Open string, currently reported. */
|
|
1302
|
-
method
|
|
1304
|
+
method?: string;
|
|
1303
1305
|
approximate: boolean;
|
|
1304
1306
|
}
|
|
1305
1307
|
/** Legal form recorded by a register; codes remain open strings. */
|
|
@@ -1421,7 +1423,7 @@ interface CompanyCoverage {
|
|
|
1421
1423
|
scope: string;
|
|
1422
1424
|
label: string;
|
|
1423
1425
|
description: string;
|
|
1424
|
-
snapshot_at
|
|
1426
|
+
snapshot_at?: string;
|
|
1425
1427
|
companies: number;
|
|
1426
1428
|
countries: string[];
|
|
1427
1429
|
with_website: number;
|
|
@@ -1771,20 +1773,20 @@ interface TimeLocationInput {
|
|
|
1771
1773
|
value: string;
|
|
1772
1774
|
}
|
|
1773
1775
|
interface TimeLocationCandidate {
|
|
1774
|
-
id
|
|
1775
|
-
name
|
|
1776
|
-
country
|
|
1777
|
-
state
|
|
1778
|
-
timezone
|
|
1779
|
-
latitude
|
|
1780
|
-
longitude
|
|
1776
|
+
id?: string | null;
|
|
1777
|
+
name?: string | null;
|
|
1778
|
+
country?: string | null;
|
|
1779
|
+
state?: string | null;
|
|
1780
|
+
timezone?: string | null;
|
|
1781
|
+
latitude?: number | null;
|
|
1782
|
+
longitude?: number | null;
|
|
1781
1783
|
}
|
|
1782
1784
|
interface TimeLocation {
|
|
1783
1785
|
input: TimeLocationInput;
|
|
1784
1786
|
status: string;
|
|
1785
1787
|
candidates: TimeLocationCandidate[];
|
|
1786
1788
|
truncated: boolean;
|
|
1787
|
-
source
|
|
1789
|
+
source?: string;
|
|
1788
1790
|
}
|
|
1789
1791
|
type Industry = Naics;
|
|
1790
1792
|
type IndustryChild = NaicsChild;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ interface Measure {
|
|
|
19
19
|
type: string | null;
|
|
20
20
|
amount: string | null;
|
|
21
21
|
unit: string | null;
|
|
22
|
+
/** Failure reason. Omitted wire fields remain readable as null. */
|
|
22
23
|
reason: string | null;
|
|
24
|
+
/** Unit alternatives. Omitted wire fields remain readable as an empty array. */
|
|
23
25
|
choices: MeasureChoice[];
|
|
24
26
|
}
|
|
25
27
|
interface MeasureUnit {
|
|
@@ -499,8 +501,8 @@ interface Tariff {
|
|
|
499
501
|
lineage: string[];
|
|
500
502
|
/** Column 1 general rate, verbatim. */
|
|
501
503
|
general: string | null;
|
|
502
|
-
/**
|
|
503
|
-
revision
|
|
504
|
+
/** @deprecated Omitted from current API responses. */
|
|
505
|
+
revision?: string;
|
|
504
506
|
deep?: Deep<TariffDeep>;
|
|
505
507
|
}
|
|
506
508
|
interface TariffSearchHit {
|
|
@@ -516,7 +518,7 @@ interface TariffSearch {
|
|
|
516
518
|
/** Answering date, or null for an undated edition query. */
|
|
517
519
|
date?: string | null;
|
|
518
520
|
q: string;
|
|
519
|
-
revision
|
|
521
|
+
revision?: string;
|
|
520
522
|
/** Up to 20 tariff lines, best match first. */
|
|
521
523
|
lines: TariffSearchHit[];
|
|
522
524
|
}
|
|
@@ -811,9 +813,9 @@ interface Time extends Timezone {
|
|
|
811
813
|
/** With targets only. Order and duplicates are preserved. Null means the source timezone is unresolved. */
|
|
812
814
|
targets?: TimezoneConversionTarget[] | null;
|
|
813
815
|
}
|
|
814
|
-
/**
|
|
816
|
+
/** Available timezone identifiers. */
|
|
815
817
|
interface TimeZones {
|
|
816
|
-
timezone_database_version
|
|
818
|
+
timezone_database_version?: string;
|
|
817
819
|
timezones: string[];
|
|
818
820
|
/** Present with details=true. The one instant used for all rows. */
|
|
819
821
|
at?: string;
|
|
@@ -1113,7 +1115,7 @@ interface EmojiArtworkSource {
|
|
|
1113
1115
|
interface EmojiMetadata {
|
|
1114
1116
|
edition: string;
|
|
1115
1117
|
max_version: string | null;
|
|
1116
|
-
source_version
|
|
1118
|
+
source_version?: string;
|
|
1117
1119
|
total: number;
|
|
1118
1120
|
sources: EmojiSource[];
|
|
1119
1121
|
artwork_sources: EmojiArtworkSource[];
|
|
@@ -1299,7 +1301,7 @@ interface CompanyProfileEmployees {
|
|
|
1299
1301
|
/** Open string, currently legal_entity or consolidated_group. */
|
|
1300
1302
|
scope: string;
|
|
1301
1303
|
/** Open string, currently reported. */
|
|
1302
|
-
method
|
|
1304
|
+
method?: string;
|
|
1303
1305
|
approximate: boolean;
|
|
1304
1306
|
}
|
|
1305
1307
|
/** Legal form recorded by a register; codes remain open strings. */
|
|
@@ -1421,7 +1423,7 @@ interface CompanyCoverage {
|
|
|
1421
1423
|
scope: string;
|
|
1422
1424
|
label: string;
|
|
1423
1425
|
description: string;
|
|
1424
|
-
snapshot_at
|
|
1426
|
+
snapshot_at?: string;
|
|
1425
1427
|
companies: number;
|
|
1426
1428
|
countries: string[];
|
|
1427
1429
|
with_website: number;
|
|
@@ -1771,20 +1773,20 @@ interface TimeLocationInput {
|
|
|
1771
1773
|
value: string;
|
|
1772
1774
|
}
|
|
1773
1775
|
interface TimeLocationCandidate {
|
|
1774
|
-
id
|
|
1775
|
-
name
|
|
1776
|
-
country
|
|
1777
|
-
state
|
|
1778
|
-
timezone
|
|
1779
|
-
latitude
|
|
1780
|
-
longitude
|
|
1776
|
+
id?: string | null;
|
|
1777
|
+
name?: string | null;
|
|
1778
|
+
country?: string | null;
|
|
1779
|
+
state?: string | null;
|
|
1780
|
+
timezone?: string | null;
|
|
1781
|
+
latitude?: number | null;
|
|
1782
|
+
longitude?: number | null;
|
|
1781
1783
|
}
|
|
1782
1784
|
interface TimeLocation {
|
|
1783
1785
|
input: TimeLocationInput;
|
|
1784
1786
|
status: string;
|
|
1785
1787
|
candidates: TimeLocationCandidate[];
|
|
1786
1788
|
truncated: boolean;
|
|
1787
|
-
source
|
|
1789
|
+
source?: string;
|
|
1788
1790
|
}
|
|
1789
1791
|
type Industry = Naics;
|
|
1790
1792
|
type IndustryChild = NaicsChild;
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var EmojiCatalog = class {
|
|
|
34
34
|
compareNames;
|
|
35
35
|
segmenter;
|
|
36
36
|
constructor(data) {
|
|
37
|
-
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !data.metadata?.source_version) {
|
|
37
|
+
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !(data.metadata?.source_version || data.metadata?.edition)) {
|
|
38
38
|
throw new EmojiCatalogError("invalid_catalog", "Use the JSON response from GET /emoji/catalog.");
|
|
39
39
|
}
|
|
40
40
|
this.data = structuredClone(data);
|
|
@@ -223,7 +223,7 @@ var EmojiCatalog = class {
|
|
|
223
223
|
for (const [key, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
224
224
|
if (options[key] !== void 0 && (!options[key].trim() || !known.has(filterKey(options[key])))) invalid(`Unknown emoji ${key}. Use categories() to find supported values.`);
|
|
225
225
|
}
|
|
226
|
-
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version) > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
226
|
+
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
227
227
|
let rows = this.filtered(options);
|
|
228
228
|
if (query) {
|
|
229
229
|
this.ensureSearch();
|
|
@@ -243,7 +243,7 @@ var EmojiCatalog = class {
|
|
|
243
243
|
for (const [key2, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
244
244
|
if (options[key2] !== void 0 && (!options[key2].trim() || !known.has(filterKey(options[key2])))) invalid(`Unknown emoji ${key2}. Use categories() to find supported values.`);
|
|
245
245
|
}
|
|
246
|
-
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version) > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
246
|
+
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
247
247
|
if (options.includeSkinTones !== false && options.category === void 0 && options.subcategory === void 0 && options.version === void 0 && options.maxVersion === void 0) return this.data.emojis;
|
|
248
248
|
const key = JSON.stringify([options.includeSkinTones === false, options.category === void 0 ? null : filterKey(options.category), options.subcategory === void 0 ? null : filterKey(options.subcategory), options.version, options.maxVersion]);
|
|
249
249
|
const cached = this.filterCache.get(key);
|
|
@@ -256,7 +256,7 @@ var EmojiCatalog = class {
|
|
|
256
256
|
};
|
|
257
257
|
|
|
258
258
|
// src/index.ts
|
|
259
|
-
var VERSION = "1.10.
|
|
259
|
+
var VERSION = "1.10.2";
|
|
260
260
|
var API_VERSION = "2.0.0";
|
|
261
261
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
262
262
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -583,7 +583,12 @@ function parseAPI(apiKey, options = {}) {
|
|
|
583
583
|
},
|
|
584
584
|
/** Parse a measurement or convert it to `to`. Without `to`, use its type's canonical unit. Invalid input is plain data with `valid: false`. */
|
|
585
585
|
measure: Object.assign(
|
|
586
|
-
(measure, opts) =>
|
|
586
|
+
async (measure, opts) => {
|
|
587
|
+
const result = await request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts);
|
|
588
|
+
if (!Object.prototype.hasOwnProperty.call(result, "reason")) Object.defineProperty(result, "reason", { value: null, writable: true, configurable: true });
|
|
589
|
+
if (!Object.prototype.hasOwnProperty.call(result, "choices")) Object.defineProperty(result, "choices", { value: [], writable: true, configurable: true });
|
|
590
|
+
return result;
|
|
591
|
+
},
|
|
587
592
|
{
|
|
588
593
|
/** Discover reviewed units. Pass `unit` to find compatible conversion targets. */
|
|
589
594
|
units: (opts) => request("/measure/units", { q: opts?.query, type: opts?.type, unit: opts?.unit }, void 0, opts)
|
package/dist/offline.cjs
CHANGED
|
@@ -61,7 +61,7 @@ var EmojiCatalog = class {
|
|
|
61
61
|
compareNames;
|
|
62
62
|
segmenter;
|
|
63
63
|
constructor(data) {
|
|
64
|
-
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !data.metadata?.source_version) {
|
|
64
|
+
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !(data.metadata?.source_version || data.metadata?.edition)) {
|
|
65
65
|
throw new EmojiCatalogError("invalid_catalog", "Use the JSON response from GET /emoji/catalog.");
|
|
66
66
|
}
|
|
67
67
|
this.data = structuredClone(data);
|
|
@@ -250,7 +250,7 @@ var EmojiCatalog = class {
|
|
|
250
250
|
for (const [key, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
251
251
|
if (options[key] !== void 0 && (!options[key].trim() || !known.has(filterKey(options[key])))) invalid(`Unknown emoji ${key}. Use categories() to find supported values.`);
|
|
252
252
|
}
|
|
253
|
-
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version) > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
253
|
+
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
254
254
|
let rows = this.filtered(options);
|
|
255
255
|
if (query) {
|
|
256
256
|
this.ensureSearch();
|
|
@@ -270,7 +270,7 @@ var EmojiCatalog = class {
|
|
|
270
270
|
for (const [key2, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
271
271
|
if (options[key2] !== void 0 && (!options[key2].trim() || !known.has(filterKey(options[key2])))) invalid(`Unknown emoji ${key2}. Use categories() to find supported values.`);
|
|
272
272
|
}
|
|
273
|
-
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version) > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
273
|
+
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
274
274
|
if (options.includeSkinTones !== false && options.category === void 0 && options.subcategory === void 0 && options.version === void 0 && options.maxVersion === void 0) return this.data.emojis;
|
|
275
275
|
const key = JSON.stringify([options.includeSkinTones === false, options.category === void 0 ? null : filterKey(options.category), options.subcategory === void 0 ? null : filterKey(options.subcategory), options.version, options.maxVersion]);
|
|
276
276
|
const cached = this.filterCache.get(key);
|
package/dist/offline.d.cts
CHANGED
package/dist/offline.d.ts
CHANGED
package/dist/offline.js
CHANGED
|
@@ -34,7 +34,7 @@ var EmojiCatalog = class {
|
|
|
34
34
|
compareNames;
|
|
35
35
|
segmenter;
|
|
36
36
|
constructor(data) {
|
|
37
|
-
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !data.metadata?.source_version) {
|
|
37
|
+
if (!data || !Array.isArray(data.emojis) || !data.forms || !data.shortcodes || !data.legacy || !(data.metadata?.source_version || data.metadata?.edition)) {
|
|
38
38
|
throw new EmojiCatalogError("invalid_catalog", "Use the JSON response from GET /emoji/catalog.");
|
|
39
39
|
}
|
|
40
40
|
this.data = structuredClone(data);
|
|
@@ -223,7 +223,7 @@ var EmojiCatalog = class {
|
|
|
223
223
|
for (const [key, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
224
224
|
if (options[key] !== void 0 && (!options[key].trim() || !known.has(filterKey(options[key])))) invalid(`Unknown emoji ${key}. Use categories() to find supported values.`);
|
|
225
225
|
}
|
|
226
|
-
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version) > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
226
|
+
for (const key of ["version", "maxVersion"]) if (options[key] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key]) || versionCompare(options[key], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
227
227
|
let rows = this.filtered(options);
|
|
228
228
|
if (query) {
|
|
229
229
|
this.ensureSearch();
|
|
@@ -243,7 +243,7 @@ var EmojiCatalog = class {
|
|
|
243
243
|
for (const [key2, known] of [["category", this.categoryKeys], ["subcategory", this.subcategoryKeys]]) {
|
|
244
244
|
if (options[key2] !== void 0 && (!options[key2].trim() || !known.has(filterKey(options[key2])))) invalid(`Unknown emoji ${key2}. Use categories() to find supported values.`);
|
|
245
245
|
}
|
|
246
|
-
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version) > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version}.`);
|
|
246
|
+
for (const key2 of ["version", "maxVersion"]) if (options[key2] !== void 0 && (!/^\d{1,2}\.\d{1,2}$/.test(options[key2]) || versionCompare(options[key2], this.data.metadata.source_version || this.data.metadata.max_version || "0.0") > 0)) invalid(`${key2} must be an Emoji version no newer than ${this.data.metadata.source_version || this.data.metadata.max_version || "0.0"}.`);
|
|
247
247
|
if (options.includeSkinTones !== false && options.category === void 0 && options.subcategory === void 0 && options.version === void 0 && options.maxVersion === void 0) return this.data.emojis;
|
|
248
248
|
const key = JSON.stringify([options.includeSkinTones === false, options.category === void 0 ? null : filterKey(options.category), options.subcategory === void 0 ? null : filterKey(options.subcategory), options.version, options.maxVersion]);
|
|
249
249
|
const cached = this.filterCache.get(key);
|