@honestdigital/vehicle-service-types 1.0.13
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 +76 -0
- package/dist/context.d.ts +53 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/repositories/vehicleConfigOptions.d.ts +165 -0
- package/dist/repositories/vehicleConfigOptions.d.ts.map +1 -0
- package/dist/routers/index.d.ts +793 -0
- package/dist/routers/index.d.ts.map +1 -0
- package/dist/schemas/comparison.schema.d.ts +37 -0
- package/dist/schemas/comparison.schema.d.ts.map +1 -0
- package/dist/schemas/externalApi.schema.d.ts +1532 -0
- package/dist/schemas/externalApi.schema.d.ts.map +1 -0
- package/dist/schemas/filters.schema.d.ts +276 -0
- package/dist/schemas/filters.schema.d.ts.map +1 -0
- package/dist/schemas/vehicle.schema.d.ts +1204 -0
- package/dist/schemas/vehicle.schema.d.ts.map +1 -0
- package/dist/services/lenderdesk.d.ts +139 -0
- package/dist/services/lenderdesk.d.ts.map +1 -0
- package/dist/services/mmt.d.ts +52 -0
- package/dist/services/mmt.d.ts.map +1 -0
- package/dist/types/comparison.d.ts +157 -0
- package/dist/types/comparison.d.ts.map +1 -0
- package/dist/types/filters.d.ts +95 -0
- package/dist/types/filters.d.ts.map +1 -0
- package/dist/types/guards.d.ts +32 -0
- package/dist/types/guards.d.ts.map +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/jdp.d.ts +210 -0
- package/dist/types/jdp.d.ts.map +1 -0
- package/dist/types/search.d.ts +475 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/sync.d.ts +102 -0
- package/dist/types/sync.d.ts.map +1 -0
- package/dist/types/vehicle.d.ts +75 -0
- package/dist/types/vehicle.d.ts.map +1 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4213 -0
- package/dist/utilities/error.d.ts +49 -0
- package/dist/utilities/error.d.ts.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,CAAC,CAAA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lenderdesk API client service
|
|
3
|
+
* Handles communication with the Lenderdesk Payment Services API
|
|
4
|
+
* for vehicle payment options and custom quotes
|
|
5
|
+
*/
|
|
6
|
+
import type { Bindings } from '@/context';
|
|
7
|
+
export interface LenderDeskConfig {
|
|
8
|
+
apiUrl: string;
|
|
9
|
+
apiKey: string;
|
|
10
|
+
location?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Disclosure {
|
|
13
|
+
title: string;
|
|
14
|
+
content: string;
|
|
15
|
+
displayOnUI?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface PaymentOption {
|
|
18
|
+
payment: number;
|
|
19
|
+
weeklyPayment: number;
|
|
20
|
+
biWeeklyPayment: number;
|
|
21
|
+
semiMonthlyPayment: number;
|
|
22
|
+
capitalizedCostReduction: number;
|
|
23
|
+
residualValue: number;
|
|
24
|
+
finalBalloonPayment: number;
|
|
25
|
+
dueAtSign: number;
|
|
26
|
+
offerType: 'Loan' | 'Lease' | 'Cash';
|
|
27
|
+
lenderId?: string | null;
|
|
28
|
+
lender?: string | null;
|
|
29
|
+
lenderIsOem: boolean;
|
|
30
|
+
programIsOem?: boolean | null;
|
|
31
|
+
purchasePrice: number;
|
|
32
|
+
securityDeposit: number;
|
|
33
|
+
downPayment: number;
|
|
34
|
+
term: number;
|
|
35
|
+
monthTerm: number;
|
|
36
|
+
dispositionFee: number;
|
|
37
|
+
terminationFee: number;
|
|
38
|
+
totalPayments: number;
|
|
39
|
+
acquisitionFee: number;
|
|
40
|
+
purchaseOptionFee: number;
|
|
41
|
+
retail: number;
|
|
42
|
+
mileageOdometer: number;
|
|
43
|
+
mileageLimit: number;
|
|
44
|
+
maximumResidualizedMSRP: number;
|
|
45
|
+
maximumCapitalizedAmount: number;
|
|
46
|
+
residualPercentage: number;
|
|
47
|
+
totalCapitalization: number;
|
|
48
|
+
beacon: number;
|
|
49
|
+
interestRate: number;
|
|
50
|
+
docFee: number;
|
|
51
|
+
disclosureText?: string | null;
|
|
52
|
+
disclosures?: Disclosure[];
|
|
53
|
+
expirationDate?: string | null;
|
|
54
|
+
rebates?: Rebate[];
|
|
55
|
+
conditionalRebates?: ConditionalRebate[];
|
|
56
|
+
}
|
|
57
|
+
export interface Rebate {
|
|
58
|
+
programId: number;
|
|
59
|
+
programDescription?: string;
|
|
60
|
+
programNumber?: string;
|
|
61
|
+
programName?: string;
|
|
62
|
+
amount: number;
|
|
63
|
+
}
|
|
64
|
+
export interface ConditionalRebate extends Rebate {
|
|
65
|
+
groupAffiliationId: number;
|
|
66
|
+
groupAffiliation?: string;
|
|
67
|
+
previousOwnershipId: number;
|
|
68
|
+
previousOwnership?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface VehicleDetails {
|
|
71
|
+
vin: string;
|
|
72
|
+
type: number;
|
|
73
|
+
year: number;
|
|
74
|
+
make: string;
|
|
75
|
+
model: string;
|
|
76
|
+
trim: string;
|
|
77
|
+
sellingPrice: number;
|
|
78
|
+
msrp: number;
|
|
79
|
+
purchasePrice: number;
|
|
80
|
+
lowestPayment: number;
|
|
81
|
+
lowestLeasePayment: number;
|
|
82
|
+
lowestLoanPayment: number;
|
|
83
|
+
lowestCashPayment: number;
|
|
84
|
+
paymentOptions?: PaymentOption[];
|
|
85
|
+
}
|
|
86
|
+
export interface CustomQuoteParams {
|
|
87
|
+
vin: string;
|
|
88
|
+
downPayment: number;
|
|
89
|
+
beacon: number;
|
|
90
|
+
term?: number | 'all';
|
|
91
|
+
annualMileage?: number;
|
|
92
|
+
offerType?: 'Loan' | 'Lease' | 'Cash';
|
|
93
|
+
tradeIn?: number;
|
|
94
|
+
zipCode?: string;
|
|
95
|
+
miles?: number;
|
|
96
|
+
msrp?: number;
|
|
97
|
+
purchasePrice?: number;
|
|
98
|
+
}
|
|
99
|
+
export declare class LenderdeskService {
|
|
100
|
+
static getInstance: () => LenderdeskService;
|
|
101
|
+
/**
|
|
102
|
+
* Get LenderDesk config for a tenant from the database
|
|
103
|
+
*/
|
|
104
|
+
getTenantConfig(tenantId: number, env: Bindings): Promise<LenderDeskConfig>;
|
|
105
|
+
/**
|
|
106
|
+
* Fetch default payment options for a vehicle (no custom params)
|
|
107
|
+
*/
|
|
108
|
+
getPaymentOptions(vin: string, tenantId: number, env: Bindings): Promise<PaymentOption[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Fetch custom quotes with user-specified params (down payment, term, credit score, etc.)
|
|
111
|
+
* Uses GET /api/vehicles/{vin}/custom-quotes
|
|
112
|
+
*/
|
|
113
|
+
getCustomQuotes(params: CustomQuoteParams, tenantId: number, env: Bindings): Promise<PaymentOption[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Get vehicle details including payment info from Lenderdesk
|
|
116
|
+
*/
|
|
117
|
+
getVehicleDetails(vin: string, tenantId: number, env: Bindings): Promise<VehicleDetails | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Fetch disclosures from LenderDesk for a vehicle and return as {title: content} map.
|
|
120
|
+
* Uses a sample VIN to pull the constant disclosure text that applies to the whole dealer.
|
|
121
|
+
*/
|
|
122
|
+
fetchDisclosures(vin: string, config: LenderDeskConfig): Promise<Record<string, string>>;
|
|
123
|
+
/**
|
|
124
|
+
* Fetch disclosures from LenderDesk API and save to tenant record.
|
|
125
|
+
* Picks a sample VIN from the tenant's inventory to query the API.
|
|
126
|
+
*/
|
|
127
|
+
updateTenantDisclosures(tenantId: number, sampleVin: string, env?: {
|
|
128
|
+
POSTGRES_URL?: string;
|
|
129
|
+
}): Promise<Record<string, string>>;
|
|
130
|
+
/**
|
|
131
|
+
* Find the best (lowest payment) option for each offer type
|
|
132
|
+
*/
|
|
133
|
+
static findBestOptions(paymentOptions: PaymentOption[]): {
|
|
134
|
+
lease: PaymentOption;
|
|
135
|
+
loan: PaymentOption;
|
|
136
|
+
cash: PaymentOption;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=len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AwBjC;;;OAGG;IACG,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IA0C9F;;;OAGG;IACG,uBAAuB,CAC3B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,GAAG,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAiClC;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,aAAa,EAAE;;;;;CAkBvD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for Make-Model-Trim (MMT) hierarchical filtering
|
|
3
|
+
* EXTRACTED FROM CMS - All Payload dependencies removed
|
|
4
|
+
*/
|
|
5
|
+
import type { RangeValue } from '@/types/filters';
|
|
6
|
+
import type { EnvBindings } from '@/types/index';
|
|
7
|
+
export interface MakeModels {
|
|
8
|
+
make: string;
|
|
9
|
+
models: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ModelTrims {
|
|
12
|
+
make: string;
|
|
13
|
+
model: string;
|
|
14
|
+
trims: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ConsolidatedMMT {
|
|
17
|
+
make: string;
|
|
18
|
+
models: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
trims: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
}>;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export declare class MMTService {
|
|
26
|
+
static getInstance: () => MMTService;
|
|
27
|
+
private constructor();
|
|
28
|
+
/** Lightweight performance monitoring wrapper */
|
|
29
|
+
private monitorPerformance;
|
|
30
|
+
/**
|
|
31
|
+
* Gets complete hierarchy (makeModels and modelTrims) in a single query
|
|
32
|
+
* Uses CTEs to fetch both in one HTTP roundtrip (saves ~130ms on Neon)
|
|
33
|
+
* Accepts optional filters to narrow down the hierarchy
|
|
34
|
+
*/
|
|
35
|
+
getCompleteHierarchy(tenantId?: number | null, env?: EnvBindings, filters?: Record<string, string[] | RangeValue>): Promise<{
|
|
36
|
+
makeModels: MakeModels[];
|
|
37
|
+
modelTrims: ModelTrims[];
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Gets consolidated hierarchy
|
|
41
|
+
* Accepts optional filters to narrow down the hierarchy (e.g., status: ['new'])
|
|
42
|
+
*/
|
|
43
|
+
getConsolidatedHierarchy(tenantId?: number | null, env?: EnvBindings, filters?: Record<string, string[] | RangeValue>): Promise<ConsolidatedMMT[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Gets dynamic consolidated hierarchy.
|
|
46
|
+
* Note: currentFilters is accepted for API compatibility but this method returns
|
|
47
|
+
* the full unfiltered hierarchy for the tenant. Callers needing filtered results
|
|
48
|
+
* should use getConsolidatedHierarchy with proper filter support.
|
|
49
|
+
*/
|
|
50
|
+
getDynamicConsolidatedHierarchy(_currentFilters?: Record<string, unknown>, tenantId?: number | null, env?: EnvBindings): Promise<ConsolidatedMMT[]>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=mmt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mmt.d.ts","sourceRoot":"","sources":["../../src/services/mmt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAShD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,KAAK,CAAC;YACX,IAAI,EAAE,MAAM,CAAA;SACb,CAAC,CAAA;KACH,CAAC,CAAA;CACH;AAED,qBAAa,UAAU;IACrB,MAAM,CAAC,WAAW,mBAA0C;IAE5D,OAAO;IAIP,iDAAiD;YACnC,kBAAkB;IAehC;;;;OAIG;IACU,oBAAoB,CAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EACxB,GAAG,CAAC,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAC9C,OAAO,CAAC;QACT,UAAU,EAAE,UAAU,EAAE,CAAA;QACxB,UAAU,EAAE,UAAU,EAAE,CAAA;KACzB,CAAC;IAoEF;;;OAGG;IACU,wBAAwB,CACnC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EACxB,GAAG,CAAC,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAC9C,OAAO,CAAC,eAAe,EAAE,CAAC;IAmC7B;;;;;OAKG;IACU,+BAA+B,CAC1C,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAC7C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EACxB,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,eAAe,EAAE,CAAC;CAkF9B"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the model comparison feature.
|
|
3
|
+
* Used by ModelComparisonQueryBuilder and the getModelAggregation tRPC procedure.
|
|
4
|
+
*/
|
|
5
|
+
/** Numeric range with min/max (e.g., price: $36,350 - $52,050) */
|
|
6
|
+
export interface NumericRange {
|
|
7
|
+
min: number | null;
|
|
8
|
+
max: number | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Feature availability across all vehicles in a model.
|
|
12
|
+
* - standard: ALL vehicles have this feature (bool_and = true)
|
|
13
|
+
* - available: SOME vehicles have it (bool_or = true, bool_and = false)
|
|
14
|
+
* - not_available: NO vehicles have it (bool_or = false)
|
|
15
|
+
* - null: no data available
|
|
16
|
+
*/
|
|
17
|
+
export type FeatureAvailability = 'standard' | 'available' | 'not_available' | null;
|
|
18
|
+
/** Color info for comparison display */
|
|
19
|
+
export interface ModelColor {
|
|
20
|
+
name: string;
|
|
21
|
+
genericName: string | null;
|
|
22
|
+
code: string | null;
|
|
23
|
+
}
|
|
24
|
+
/** Representative image for a model (from cheapest vehicle's Chrome gallery) */
|
|
25
|
+
export interface ModelRepresentativeImage {
|
|
26
|
+
/** Chrome multiView image URLs (generic, uncolored — shot codes 01-10) */
|
|
27
|
+
chromeMultiViewUrls: string[];
|
|
28
|
+
}
|
|
29
|
+
/** Payment type availability flags */
|
|
30
|
+
export interface PaymentAvailability {
|
|
31
|
+
hasLease: boolean;
|
|
32
|
+
hasFinance: boolean;
|
|
33
|
+
hasCash: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Aggregated data for a single model — the main output type */
|
|
36
|
+
export interface ModelAggregation {
|
|
37
|
+
brand: string;
|
|
38
|
+
model: string;
|
|
39
|
+
vehicleCount: number;
|
|
40
|
+
image: ModelRepresentativeImage;
|
|
41
|
+
exteriorColors: ModelColor[];
|
|
42
|
+
interiorColors: ModelColor[];
|
|
43
|
+
payment: PaymentAvailability;
|
|
44
|
+
price: NumericRange;
|
|
45
|
+
msrp: NumericRange;
|
|
46
|
+
hp: NumericRange;
|
|
47
|
+
hpRpm: NumericRange;
|
|
48
|
+
torque: NumericRange;
|
|
49
|
+
torqueRpm: NumericRange;
|
|
50
|
+
cityMpg: NumericRange;
|
|
51
|
+
hwyMpg: NumericRange;
|
|
52
|
+
combMpg: NumericRange;
|
|
53
|
+
length: NumericRange;
|
|
54
|
+
width: NumericRange;
|
|
55
|
+
height: NumericRange;
|
|
56
|
+
wheelbase: NumericRange;
|
|
57
|
+
frontTrack: NumericRange;
|
|
58
|
+
rearTrack: NumericRange;
|
|
59
|
+
curbWeight: NumericRange;
|
|
60
|
+
grossWeight: NumericRange;
|
|
61
|
+
headroomFront: NumericRange;
|
|
62
|
+
headroomRear: NumericRange;
|
|
63
|
+
legroomFront: NumericRange;
|
|
64
|
+
legroomRear: NumericRange;
|
|
65
|
+
shoulderFront: NumericRange;
|
|
66
|
+
shoulderRear: NumericRange;
|
|
67
|
+
hipFront: NumericRange;
|
|
68
|
+
hipRear: NumericRange;
|
|
69
|
+
cargoVol: NumericRange;
|
|
70
|
+
cargoVolDown: NumericRange;
|
|
71
|
+
dimPassengerCap: NumericRange;
|
|
72
|
+
screenSize: NumericRange;
|
|
73
|
+
speakerCount: NumericRange;
|
|
74
|
+
airbagCount: NumericRange;
|
|
75
|
+
lowestMonthly: NumericRange;
|
|
76
|
+
trims: string[];
|
|
77
|
+
years: number[];
|
|
78
|
+
bodyStyles: string[];
|
|
79
|
+
drivetrains: string[];
|
|
80
|
+
fuelTypes: string[];
|
|
81
|
+
doorOptions: number[];
|
|
82
|
+
passengerCaps: number[];
|
|
83
|
+
engineDescs: string[];
|
|
84
|
+
transDescs: string[];
|
|
85
|
+
transSpeedOpts: number[];
|
|
86
|
+
cylinderOpts: number[];
|
|
87
|
+
displacementOpts: number[];
|
|
88
|
+
engineConfigs: string[];
|
|
89
|
+
valvesPerCyl: number[];
|
|
90
|
+
valveGearTypes: string[];
|
|
91
|
+
fuelSystems: string[];
|
|
92
|
+
compressionRatios: string[];
|
|
93
|
+
forcedInduction: string[];
|
|
94
|
+
blockCompositions: string[];
|
|
95
|
+
headCompositions: string[];
|
|
96
|
+
transTypes: string[];
|
|
97
|
+
transSpeeds: number[];
|
|
98
|
+
drivenWheels: string[];
|
|
99
|
+
fourWdTypes: string[];
|
|
100
|
+
wheelSizes: number[];
|
|
101
|
+
wheelTypes: string[];
|
|
102
|
+
tireSizes: string[];
|
|
103
|
+
tireTypes: string[];
|
|
104
|
+
headlightTypes: string[];
|
|
105
|
+
sunroofOpts: string[];
|
|
106
|
+
audioSystems: string[];
|
|
107
|
+
usbPortOpts: number[];
|
|
108
|
+
telematicsOpts: string[];
|
|
109
|
+
parkingSensorOpts: string[];
|
|
110
|
+
autonomyLevels: string[];
|
|
111
|
+
startStop: FeatureAvailability;
|
|
112
|
+
cylDeactivation: FeatureAvailability;
|
|
113
|
+
manualMode: FeatureAvailability;
|
|
114
|
+
paddleShifters: FeatureAvailability;
|
|
115
|
+
runFlat: FeatureAvailability;
|
|
116
|
+
drl: FeatureAvailability;
|
|
117
|
+
fogLights: FeatureAvailability;
|
|
118
|
+
spoiler: FeatureAvailability;
|
|
119
|
+
roofRails: FeatureAvailability;
|
|
120
|
+
rearDefogger: FeatureAvailability;
|
|
121
|
+
heatedMirrors: FeatureAvailability;
|
|
122
|
+
powerMirrors: FeatureAvailability;
|
|
123
|
+
autoFoldMirrors: FeatureAvailability;
|
|
124
|
+
touchscreen: FeatureAvailability;
|
|
125
|
+
subwoofer: FeatureAvailability;
|
|
126
|
+
appleCarplay: FeatureAvailability;
|
|
127
|
+
androidAuto: FeatureAvailability;
|
|
128
|
+
bluetooth: FeatureAvailability;
|
|
129
|
+
wifi: FeatureAvailability;
|
|
130
|
+
wirelessCharging: FeatureAvailability;
|
|
131
|
+
navigation: FeatureAvailability;
|
|
132
|
+
satelliteRadio: FeatureAvailability;
|
|
133
|
+
hdRadio: FeatureAvailability;
|
|
134
|
+
frontAirbags: FeatureAvailability;
|
|
135
|
+
sideAirbags: FeatureAvailability;
|
|
136
|
+
curtainAirbags: FeatureAvailability;
|
|
137
|
+
kneeAirbags: FeatureAvailability;
|
|
138
|
+
abs: FeatureAvailability;
|
|
139
|
+
stabilityCtrl: FeatureAvailability;
|
|
140
|
+
tractionCtrl: FeatureAvailability;
|
|
141
|
+
brakeAssist: FeatureAvailability;
|
|
142
|
+
fcw: FeatureAvailability;
|
|
143
|
+
aeb: FeatureAvailability;
|
|
144
|
+
ldw: FeatureAvailability;
|
|
145
|
+
lka: FeatureAvailability;
|
|
146
|
+
bsm: FeatureAvailability;
|
|
147
|
+
rcta: FeatureAvailability;
|
|
148
|
+
acc: FeatureAvailability;
|
|
149
|
+
rearviewCam: FeatureAvailability;
|
|
150
|
+
surroundCam: FeatureAvailability;
|
|
151
|
+
parkingAssist: FeatureAvailability;
|
|
152
|
+
tpms: FeatureAvailability;
|
|
153
|
+
hillStart: FeatureAvailability;
|
|
154
|
+
standardFeatures: string[];
|
|
155
|
+
availableFeatures: string[];
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=comparison.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../src/types/comparison.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,WAAW,GAAG,eAAe,GAAG,IAAI,CAAA;AAEnF,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED,gFAAgF;AAChF,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,mBAAmB,EAAE,MAAM,EAAE,CAAA;CAC9B;AAED,sCAAsC;AACtC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACj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AE,mBAAmB,CAAA;IACxB,IAAI,EAAE,mBAAmB,CAAA;IACzB,GAAG,EAAE,mBAAmB,CAAA;IACxB,WAAW,EAAE,mBAAmB,CAAA;IAChC,WAAW,EAAE,mBAAmB,CAAA;IAChC,aAAa,EAAE,mBAAmB,CAAA;IAClC,IAAI,EAAE,mBAAmB,CAAA;IACzB,SAAS,EAAE,mBAAmB,CAAA;IAG9B,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC5B"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for filter-related data structures (source of truth)
|
|
3
|
+
*
|
|
4
|
+
* @sync-with payload-app/src/types/filters.ts
|
|
5
|
+
* payload-app defines a consumer subset of these types. FilterState shape,
|
|
6
|
+
* FilterOptionValue, and RangeValue must stay aligned across both packages.
|
|
7
|
+
* payload-app omits FilterOption.count for performance and derives
|
|
8
|
+
* FilterParams/RangeParams from its own FILTER_CONFIG constants.
|
|
9
|
+
*/
|
|
10
|
+
export type SortOption = 'year_desc' | 'year_asc' | 'price_desc' | 'price_asc' | 'mileage_desc' | 'mileage_asc';
|
|
11
|
+
export interface FilterOption {
|
|
12
|
+
value: string;
|
|
13
|
+
count?: number;
|
|
14
|
+
}
|
|
15
|
+
export type FilterOptionValue = FilterOption & {
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export interface RangeValue {
|
|
19
|
+
min: string;
|
|
20
|
+
max: string;
|
|
21
|
+
}
|
|
22
|
+
export type RangeFilter = {
|
|
23
|
+
min?: string;
|
|
24
|
+
max?: string;
|
|
25
|
+
};
|
|
26
|
+
export type OptionsFilter = {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
count: number;
|
|
30
|
+
type: 'options';
|
|
31
|
+
options: readonly string[];
|
|
32
|
+
expanded?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type FilterCategory = RangeFilter | OptionsFilter;
|
|
35
|
+
export interface FilterState {
|
|
36
|
+
brand?: FilterOptionValue[];
|
|
37
|
+
model?: FilterOptionValue[];
|
|
38
|
+
trim?: FilterOptionValue[];
|
|
39
|
+
year?: FilterOptionValue[];
|
|
40
|
+
status?: FilterOptionValue[];
|
|
41
|
+
location?: FilterOptionValue[];
|
|
42
|
+
drivetrain?: FilterOptionValue[];
|
|
43
|
+
doors?: FilterOptionValue[];
|
|
44
|
+
fuelType?: FilterOptionValue[];
|
|
45
|
+
bodyStyle?: FilterOptionValue[];
|
|
46
|
+
exteriorColor?: FilterOptionValue[];
|
|
47
|
+
interiorColor?: FilterOptionValue[];
|
|
48
|
+
exteriorColorGeneric?: FilterOptionValue[];
|
|
49
|
+
interiorColorGeneric?: FilterOptionValue[];
|
|
50
|
+
price?: RangeValue;
|
|
51
|
+
mileage?: RangeValue;
|
|
52
|
+
}
|
|
53
|
+
export type TransformedFilters = {
|
|
54
|
+
brand?: string[];
|
|
55
|
+
model?: string[];
|
|
56
|
+
trim?: string[];
|
|
57
|
+
year?: string[];
|
|
58
|
+
status?: string[];
|
|
59
|
+
location?: string[];
|
|
60
|
+
drivetrain?: string[];
|
|
61
|
+
doors?: string[];
|
|
62
|
+
fuelType?: string[];
|
|
63
|
+
bodyStyle?: string[];
|
|
64
|
+
exteriorColor?: string[];
|
|
65
|
+
interiorColor?: string[];
|
|
66
|
+
exteriorColorGeneric?: string[];
|
|
67
|
+
interiorColorGeneric?: string[];
|
|
68
|
+
price?: RangeValue;
|
|
69
|
+
mileage?: RangeValue;
|
|
70
|
+
};
|
|
71
|
+
export interface HierarchicalFilters extends TransformedFilters {
|
|
72
|
+
selectedMakeModelTrims?: Array<{
|
|
73
|
+
make: string;
|
|
74
|
+
models?: Array<{
|
|
75
|
+
name: string;
|
|
76
|
+
trims?: string[];
|
|
77
|
+
}>;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
export interface MakeModels {
|
|
81
|
+
make: string;
|
|
82
|
+
models: string[];
|
|
83
|
+
}
|
|
84
|
+
export interface ModelTrims {
|
|
85
|
+
model: string;
|
|
86
|
+
trims: string[];
|
|
87
|
+
}
|
|
88
|
+
export interface MMTTransformedFilters extends TransformedFilters {
|
|
89
|
+
make?: string[];
|
|
90
|
+
modelTrimPairs?: Array<{
|
|
91
|
+
model: string;
|
|
92
|
+
trims?: string[];
|
|
93
|
+
}>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/types/filters.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,UAAU,GACV,YAAY,GACZ,WAAW,GACX,cAAc,GACd,aAAa,CAAA;AAGjB,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAGD,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAGD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ;AAGD,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAGD,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAGD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,aAAa,CAAA;AAGxD,MAAM,WAAW,WAAW;IA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AAC,EAAE,MAAM,EAAE,CAAA;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC/B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC/B,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB,CAAA;AAGD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,sBAAsB,CAAC,EAAE,KAAK,CAAC;QAC7B,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,CAAC,EAAE,KAAK,CAAC;YACb,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SACjB,CAAC,CAAA;KACH,CAAC,CAAA;CACH;AAGD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,cAAc,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAC5D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard functions for runtime type checking
|
|
3
|
+
* Provides type-safe narrowing for common types used in the vehicle service
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Type guard for non-null objects
|
|
7
|
+
* Validates that a value is an object and not null
|
|
8
|
+
*/
|
|
9
|
+
export declare function isNonNullObject(value: unknown): value is Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Type guard for Error instances
|
|
12
|
+
* Validates that a value is an Error object
|
|
13
|
+
*/
|
|
14
|
+
export declare function isError(value: unknown): value is Error;
|
|
15
|
+
/**
|
|
16
|
+
* Type guard for PostgreSQL database errors
|
|
17
|
+
* Checks for objects with code and severity properties typical of Postgres errors
|
|
18
|
+
*/
|
|
19
|
+
export interface PostgresError {
|
|
20
|
+
code: string;
|
|
21
|
+
severity: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
detail?: string;
|
|
24
|
+
hint?: string;
|
|
25
|
+
position?: string;
|
|
26
|
+
column?: string;
|
|
27
|
+
table?: string;
|
|
28
|
+
constraint?: string;
|
|
29
|
+
routine?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function isPostgresError(value: unknown): value is PostgresError;
|
|
32
|
+
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/types/guards.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEhF;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEtD;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAItE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central exports for all type definitions
|
|
3
|
+
* Barrel file for the types module
|
|
4
|
+
*/
|
|
5
|
+
/** Environment bindings subset for repository/service methods that accept optional env */
|
|
6
|
+
export type EnvBindings = {
|
|
7
|
+
POSTGRES_URL?: string;
|
|
8
|
+
};
|
|
9
|
+
export type * from './comparison';
|
|
10
|
+
export type * from './filters';
|
|
11
|
+
export type { PostgresError } from './guards';
|
|
12
|
+
export { isError, isNonNullObject, isPostgresError } from './guards';
|
|
13
|
+
export type { SyncError, SyncErrorRecord, SyncHistoryRecord, SyncResult, SyncStats, SyncTrigger, TransformedVehicleData, } from './sync';
|
|
14
|
+
export type { CashOffer, CheapestByTrimInput, CheapestByTrimOutput,
|
|
15
|
+
/** @deprecated Use VehicleImage instead */
|
|
16
|
+
ChromeImage, FinanceOffer, GetTrimsInput, GetTrimsOutput, ImageParams, ImageRequestOptions, InventoryVehicle, LeaseOffer, PaymentOffer, Vehicle, VehicleImage, VehicleRebate, VehicleStatus, } from './vehicle';
|
|
17
|
+
export { CheapestByTrimInputSchema, CheapestByTrimOutputSchema, GetTrimsInputSchema, GetTrimsOutputSchema, } from './vehicle';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0FAA0F;AAC1F,MAAM,MAAM,WAAW,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAGnD,mBAAmB,cAAc,CAAA;AAEjC,mBAAmB,WAAW,CAAA;AAC9B,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEpE,YAAY,EACV,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,sBAAsB,GACvB,MAAM,QAAQ,CAAA;AAEf,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,oBAAoB;AACpB,2CAA2C;AAC3C,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,WAAW,CAAA"}
|