@meterapp/vehicle-db 2.8.0 → 2.9.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 +0 -64
- package/dist/data.d.ts +0 -14
- package/dist/data.js +1 -1
- package/dist/index.d.ts +0 -66
- package/dist/index.js +0 -121
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,10 +29,6 @@ import {
|
|
|
29
29
|
getMakes,
|
|
30
30
|
getModels,
|
|
31
31
|
getAvailableYears,
|
|
32
|
-
getAvailableYearRanges,
|
|
33
|
-
getModelAppearanceRanges,
|
|
34
|
-
getModelRenderGroups,
|
|
35
|
-
getRepresentativeYear,
|
|
36
32
|
} from "@meterapp/vehicle-db";
|
|
37
33
|
|
|
38
34
|
// Inspect provenance and coverage before querying.
|
|
@@ -111,55 +107,6 @@ const years = getAvailableYears({
|
|
|
111
107
|
vehicleTypeId: 2,
|
|
112
108
|
sourceId: "nhtsa-vpic",
|
|
113
109
|
});
|
|
114
|
-
|
|
115
|
-
// Availability and exterior equivalence are intentionally separate.
|
|
116
|
-
const availability = getAvailableYearRanges({ makeId: toyota!.makeId });
|
|
117
|
-
const arteonAppearances = getModelAppearanceRanges({
|
|
118
|
-
makeId: getMakes().find((make) => make.makeName === "VOLKSWAGEN")!.makeId,
|
|
119
|
-
modelName: "Arteon",
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// Safe cache identity: verified ranges share a representative year; unknown
|
|
123
|
-
// and overlapping transition years return the requested year unchanged.
|
|
124
|
-
const renderYear = getRepresentativeYear({
|
|
125
|
-
makeId: arteonAppearances[0].makeId,
|
|
126
|
-
modelName: "Arteon",
|
|
127
|
-
year: 2018,
|
|
128
|
-
}); // 2019
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Appearance ranges and image reuse
|
|
132
|
-
|
|
133
|
-
A model being available in consecutive years does **not** prove that its exterior stayed the
|
|
134
|
-
same. `getAvailableYearRanges()` only compresses catalog availability for display. Sourced
|
|
135
|
-
generation/facelift facts live in `data/appearance-ranges.json` and are returned by
|
|
136
|
-
`getModelAppearanceRanges()` with their body style, market, and evidence URL.
|
|
137
|
-
|
|
138
|
-
`getModelRenderGroups()` turns those facts into a complete cache plan. It groups a year only when
|
|
139
|
-
exactly one verified appearance range covers it. Years with no evidence, and transition years
|
|
140
|
-
covered by two overlapping ranges, remain singleton exact-year groups. `getRepresentativeYear()`
|
|
141
|
-
is the convenience lookup for storage/cache keys and has the same fail-closed behavior.
|
|
142
|
-
|
|
143
|
-
This split is deliberate. NHTSA vPIC provides model-year and body-class data but no global
|
|
144
|
-
generation identifier; Wikidata is CC0 but generation and facelift coverage is sparse. Broad
|
|
145
|
-
third-party generation dumps commonly carry restrictive or share-alike terms and overlapping
|
|
146
|
-
records, so they are useful for research but are not imported automatically. Verified ranges are
|
|
147
|
-
small, reviewable facts linked to first-party or equivalently authoritative public evidence.
|
|
148
|
-
|
|
149
|
-
NHTSA wheelbase, dimensions, doors, series, and truck cab/bed fields can rank possible body-family
|
|
150
|
-
matches. They are candidate evidence only: related platforms and trims can still have visibly
|
|
151
|
-
different bodywork. `appearanceId` is intentionally stricter than a derived `body_family_id` and
|
|
152
|
-
is the only grouping allowed to drive render reuse. See CONTRIBUTING for the review criteria.
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
const volkswagen = getMakes().find((make) => make.makeName === "VOLKSWAGEN")!;
|
|
156
|
-
|
|
157
|
-
getModelAppearanceRanges({ makeId: volkswagen.makeId, modelName: "Arteon" });
|
|
158
|
-
// Original Arteon: 2017–2020, Fastback, with Volkswagen evidence
|
|
159
|
-
// Updated Arteon: 2020–2026, Fastback, with Volkswagen evidence
|
|
160
|
-
|
|
161
|
-
getModelRenderGroups({ makeId: volkswagen.makeId, modelName: "Arteon" });
|
|
162
|
-
// 2017–2019 share one render; overlapping 2020 stays exact; 2021–2026 share one render.
|
|
163
110
|
```
|
|
164
111
|
|
|
165
112
|
## Driver search and autocomplete
|
|
@@ -286,17 +233,6 @@ getAvailableYears({ makeId: 448, vehicleTypeId: 2, sourceId: "nhtsa-vpic" });
|
|
|
286
233
|
getAvailableYears({ modelId: 2469, sourceId: "nhtsa-vpic" });
|
|
287
234
|
```
|
|
288
235
|
|
|
289
|
-
### Appearance and year-range APIs
|
|
290
|
-
|
|
291
|
-
- `getAvailableYearRanges(options?): VehicleYearRange[]` compresses consecutive availability
|
|
292
|
-
years; it makes no exterior-equivalence claim.
|
|
293
|
-
- `getModelAppearanceRanges({ makeId, modelName, year? }): VehicleAppearanceRange[]` returns
|
|
294
|
-
verified generation/facelift periods and evidence. Overlap is preserved.
|
|
295
|
-
- `getModelRenderGroups({ makeId, modelName, vehicleTypeId?, sourceId? }): VehicleRenderGroup[]`
|
|
296
|
-
returns safe, non-overlapping cache groups for every available year.
|
|
297
|
-
- `getRepresentativeYear({ makeId, modelName, year, ... }): number` returns the canonical cache
|
|
298
|
-
year for an unambiguous verified group, otherwise the requested year.
|
|
299
|
-
|
|
300
236
|
### `searchVehicles(query, options?): VehicleSearchResult[]`
|
|
301
237
|
|
|
302
238
|
Import from `@meterapp/vehicle-db/search`. Returns deterministic make and grouped model candidates for free-form input. Options include `year`, `vehicleTypeId`, `sourceId`, `limit` (default 10, maximum 100), and `fuzzy` (default `true`).
|
package/dist/data.d.ts
CHANGED
|
@@ -24,20 +24,6 @@ interface CompactData {
|
|
|
24
24
|
}[];
|
|
25
25
|
modelNames: string[];
|
|
26
26
|
models: [number, number, number, number, number, number][];
|
|
27
|
-
appearanceRanges: {
|
|
28
|
-
id: string;
|
|
29
|
-
make_id: number;
|
|
30
|
-
make_name: string;
|
|
31
|
-
model_name: string;
|
|
32
|
-
label: string;
|
|
33
|
-
body_style: string;
|
|
34
|
-
year_from: number;
|
|
35
|
-
year_to: number;
|
|
36
|
-
representative_year: number;
|
|
37
|
-
regions: string[];
|
|
38
|
-
source_name: string;
|
|
39
|
-
source_url: string;
|
|
40
|
-
}[];
|
|
41
27
|
}
|
|
42
28
|
declare const data: CompactData;
|
|
43
29
|
export default data;
|