diff --git a/database/parkingDB/getLicencePlateOwner.d.ts b/database/parkingDB/getLicencePlateOwner.d.ts index 07c233fe..c6f12c59 100644 --- a/database/parkingDB/getLicencePlateOwner.d.ts +++ b/database/parkingDB/getLicencePlateOwner.d.ts @@ -1,5 +1,5 @@ import sqlite from 'better-sqlite3'; -import { LicencePlateOwner } from '../../types/recordTypes.js'; +import type { LicencePlateOwner } from '../../types/recordTypes.js'; export declare function getLicencePlateOwnerWithDB(database: sqlite.Database, licencePlateCountry: string, licencePlateProvince: string, licencePlateNumber: string, recordDateOrBefore: number): LicencePlateOwner | undefined; export declare function getLicencePlateOwner(licencePlateCountry: string, licencePlateProvince: string, licencePlateNumber: string, recordDateOrBefore: number): LicencePlateOwner | undefined; export default getLicencePlateOwner; diff --git a/database/parkingDB/getLicencePlateOwner.js b/database/parkingDB/getLicencePlateOwner.js index e9488d90..c8bd52fd 100644 --- a/database/parkingDB/getLicencePlateOwner.js +++ b/database/parkingDB/getLicencePlateOwner.js @@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js'; import * as vehicleFunctions from '../../helpers/functions.vehicle.js'; export function getLicencePlateOwnerWithDB(database, licencePlateCountry, licencePlateProvince, licencePlateNumber, recordDateOrBefore) { const licencePlateCountryAlias = configFunctions.getProperty('licencePlateCountryAliases')[licencePlateCountry] || licencePlateCountry; - const licencePlateProvinceAlias = (configFunctions.getProperty('licencePlateProvinceAliases')[licencePlateCountryAlias] || {})[licencePlateProvince] || licencePlateProvince; + const licencePlateProvinceAlias = configFunctions.getProperty('licencePlateProvinceAliases')[licencePlateCountryAlias]?.[licencePlateProvince] || licencePlateProvince; const possibleOwners = database .prepare('select * from LicencePlateOwners' + ' where recordDelete_timeMillis is null' + @@ -15,7 +15,7 @@ export function getLicencePlateOwnerWithDB(database, licencePlateCountry, licenc .all(licencePlateNumber, recordDateOrBefore); for (const possibleOwnerObject of possibleOwners) { const ownerPlateCountryAlias = configFunctions.getProperty('licencePlateCountryAliases')[possibleOwnerObject.licencePlateCountry] || possibleOwnerObject.licencePlateCountry; - const ownerPlateProvinceAlias = (configFunctions.getProperty('licencePlateProvinceAliases')[ownerPlateCountryAlias] || {})[possibleOwnerObject.licencePlateProvince] || + const ownerPlateProvinceAlias = configFunctions.getProperty('licencePlateProvinceAliases')[ownerPlateCountryAlias]?.[possibleOwnerObject.licencePlateProvince] || possibleOwnerObject.licencePlateProvince; if (licencePlateCountryAlias === ownerPlateCountryAlias && licencePlateProvinceAlias === ownerPlateProvinceAlias) { diff --git a/database/parkingDB/getLicencePlateOwner.ts b/database/parkingDB/getLicencePlateOwner.ts index ce477da3..f81d6f56 100644 --- a/database/parkingDB/getLicencePlateOwner.ts +++ b/database/parkingDB/getLicencePlateOwner.ts @@ -4,7 +4,7 @@ import sqlite from 'better-sqlite3' import { parkingDB as databasePath } from '../../data/databasePaths.js' import * as configFunctions from '../../helpers/functions.config.js' import * as vehicleFunctions from '../../helpers/functions.vehicle.js' -import { LicencePlateOwner } from '../../types/recordTypes.js' +import type { LicencePlateOwner } from '../../types/recordTypes.js' export function getLicencePlateOwnerWithDB( database: sqlite.Database, @@ -19,9 +19,9 @@ export function getLicencePlateOwnerWithDB( ] || licencePlateCountry const licencePlateProvinceAlias = - (configFunctions.getProperty('licencePlateProvinceAliases')[ + configFunctions.getProperty('licencePlateProvinceAliases')[ licencePlateCountryAlias - ] || {})[licencePlateProvince] || licencePlateProvince + ]?.[licencePlateProvince] || licencePlateProvince const possibleOwners = database .prepare( @@ -31,7 +31,7 @@ export function getLicencePlateOwnerWithDB( ' and recordDate >= ?' + ' order by recordDate' ) - .all(licencePlateNumber, recordDateOrBefore) as pts.LicencePlateOwner[] + .all(licencePlateNumber, recordDateOrBefore) as LicencePlateOwner[] for (const possibleOwnerObject of possibleOwners) { const ownerPlateCountryAlias = @@ -40,9 +40,9 @@ export function getLicencePlateOwnerWithDB( ] || possibleOwnerObject.licencePlateCountry const ownerPlateProvinceAlias = - (configFunctions.getProperty('licencePlateProvinceAliases')[ + configFunctions.getProperty('licencePlateProvinceAliases')[ ownerPlateCountryAlias - ] || {})[possibleOwnerObject.licencePlateProvince] || + ]?.[possibleOwnerObject.licencePlateProvince] || possibleOwnerObject.licencePlateProvince if ( diff --git a/helpers/functions.config.d.ts b/helpers/functions.config.d.ts index 32924f48..02b741c7 100644 --- a/helpers/functions.config.d.ts +++ b/helpers/functions.config.d.ts @@ -19,12 +19,7 @@ export declare function getProperty(propertyName: 'session.cookieName'): string; export declare function getProperty(propertyName: 'session.doKeepAlive'): boolean; export declare function getProperty(propertyName: 'session.maxAgeMillis'): number; export declare function getProperty(propertyName: 'session.secret'): string; -export declare function getProperty(propertyName: 'users.testing'): string[]; -export declare function getProperty(propertyName: 'users.canLogin'): string[]; -export declare function getProperty(propertyName: 'users.canUpdate'): string[]; -export declare function getProperty(propertyName: 'users.isAdmin'): string[]; -export declare function getProperty(propertyName: 'users.isOperator'): string[]; -export declare function getProperty(propertyName: 'users.createUpdateWindowMillis'): number; +export declare function getProperty(propertyName: 'users.testing' | 'users.canLogin' | 'users.canUpdate' | 'users.isAdmin' | 'users.isOperator'): string[]; export declare function getProperty(propertyName: 'application.feature_mtoExportImport'): boolean; export declare function getProperty(propertyName: 'mtoExportImport.authorizedUser'): string; export declare function getProperty(propertyName: 'application.task_nhtsa.runTask'): boolean; diff --git a/helpers/functions.config.ts b/helpers/functions.config.ts index 0471c48e..f80af561 100644 --- a/helpers/functions.config.ts +++ b/helpers/functions.config.ts @@ -158,14 +158,14 @@ export function getProperty(propertyName: 'session.doKeepAlive'): boolean export function getProperty(propertyName: 'session.maxAgeMillis'): number export function getProperty(propertyName: 'session.secret'): string -export function getProperty(propertyName: 'users.testing'): string[] -export function getProperty(propertyName: 'users.canLogin'): string[] -export function getProperty(propertyName: 'users.canUpdate'): string[] -export function getProperty(propertyName: 'users.isAdmin'): string[] -export function getProperty(propertyName: 'users.isOperator'): string[] export function getProperty( - propertyName: 'users.createUpdateWindowMillis' -): number + propertyName: + | 'users.testing' + | 'users.canLogin' + | 'users.canUpdate' + | 'users.isAdmin' + | 'users.isOperator' +): string[] export function getProperty( propertyName: 'application.feature_mtoExportImport' diff --git a/helpers/functions.vehicle.d.ts b/helpers/functions.vehicle.d.ts index 4501aacc..facf2b72 100644 --- a/helpers/functions.vehicle.d.ts +++ b/helpers/functions.vehicle.d.ts @@ -1,5 +1,5 @@ -import type { NHTSAMakeModel } from '../types/recordTypes'; -export declare const getModelsByMakeFromCache: (makeSearchStringOriginal: string) => NHTSAMakeModel[]; -export declare const getModelsByMake: (makeSearchStringOriginal: string) => Promise<NHTSAMakeModel[]>; +import type { NHTSAMakeModel } from '../types/recordTypes.js'; +export declare function getModelsByMakeFromCache(makeSearchStringOriginal: string): NHTSAMakeModel[]; +export declare function getModelsByMake(makeSearchStringOriginal: string): Promise<NHTSAMakeModel[]>; export declare const getMakeFromNCIC: (vehicleNCIC: string) => string; export declare const isNCICExclusivelyTrailer: (vehicleNCIC: string) => boolean; diff --git a/helpers/functions.vehicle.js b/helpers/functions.vehicle.js index fa5c1278..22d4e6c4 100644 --- a/helpers/functions.vehicle.js +++ b/helpers/functions.vehicle.js @@ -1,27 +1,28 @@ -import sqlite from 'better-sqlite3'; import nhtsa from '@shaggytools/nhtsa-api-wrapper'; +import sqlite from 'better-sqlite3'; import { nhtsaDB as databasePath } from '../data/databasePaths.js'; -import * as ncic from '../data/ncicCodes.js'; import { trailerNCIC } from '../data/ncicCodes/trailer.js'; +import * as ncic from '../data/ncicCodes.js'; const { GetModelsForMake } = nhtsa; +const nhtsaGetModelsForMake = new GetModelsForMake(); const nhtsaSearchExpiryDurationMillis = 14 * 86400 * 1000; -const getModelsByMakeFromDB = (makeSearchString, database) => { +function getModelsByMakeFromDB(makeSearchString, database) { return database - .prepare('select makeID, makeName, modelID, modelName' + - ' from MakeModel' + - ' where instr(lower(makeName), ?)' + - ' and recordDelete_timeMillis is null' + - ' order by makeName, modelName') + .prepare(`select makeID, makeName, modelID, modelName + from MakeModel + where instr(lower(makeName), ?) + and recordDelete_timeMillis is null + order by makeName, modelName`) .all(makeSearchString); -}; -export const getModelsByMakeFromCache = (makeSearchStringOriginal) => { +} +export function getModelsByMakeFromCache(makeSearchStringOriginal) { const makeSearchString = makeSearchStringOriginal.trim().toLowerCase(); const database = sqlite(databasePath); const makeModelResults = getModelsByMakeFromDB(makeSearchString, database); database.close(); return makeModelResults; -}; -export const getModelsByMake = async (makeSearchStringOriginal) => { +} +export async function getModelsByMake(makeSearchStringOriginal) { const makeSearchString = makeSearchStringOriginal.trim().toLowerCase(); const database = sqlite(databasePath); const queryCloseCallbackFunction = () => { @@ -32,41 +33,43 @@ export const getModelsByMake = async (makeSearchStringOriginal) => { let useAPI = false; const nowMillis = Date.now(); const searchRecord = database - .prepare('select searchExpiryMillis from MakeModelSearchHistory' + - ' where searchString = ?') + .prepare(`select searchExpiryMillis + from MakeModelSearchHistory + where searchString = ?`) .get(makeSearchString); - if (searchRecord) { + if (searchRecord === undefined) { + useAPI = true; + database + .prepare(`insert into MakeModelSearchHistory ( + searchString, resultCount, searchExpiryMillis) + values (?, ?, ?)`) + .run(makeSearchString, 0, nowMillis + nhtsaSearchExpiryDurationMillis); + } + else { if (searchRecord.searchExpiryMillis < nowMillis) { useAPI = true; database - .prepare('update MakeModelSearchHistory' + - ' set searchExpiryMillis = ?' + - ' where searchString = ?') + .prepare(`update MakeModelSearchHistory + set searchExpiryMillis = ? + where searchString = ?`) .run(nowMillis + nhtsaSearchExpiryDurationMillis, makeSearchString); } } - else { - useAPI = true; - database - .prepare('insert into MakeModelSearchHistory' + - ' (searchString, resultCount, searchExpiryMillis)' + - ' values (?, ?, ?)') - .run(makeSearchString, 0, nowMillis + nhtsaSearchExpiryDurationMillis); - } if (useAPI) { - const data = await GetModelsForMake(makeSearchString); + const data = await nhtsaGetModelsForMake.GetModelsForMake(makeSearchString); database - .prepare('update MakeModelSearchHistory' + - ' set resultCount = ?' + - 'where searchString = ?') + .prepare(`update MakeModelSearchHistory + set resultCount = ? + where searchString = ?`) .run(data.Count, makeSearchString); - const insertSQL = 'insert or ignore into MakeModel (makeID, makeName, modelID, modelName,' + - ' recordCreate_timeMillis, recordUpdate_timeMillis)' + - ' values (?, ?, ?, ?, ?, ?)'; - const updateSQL = 'update MakeModel' + - ' set recordUpdate_timeMillis = ?' + - ' where makeName = ?' + - ' and modelName = ?'; + const insertSQL = `insert or ignore into MakeModel ( + makeID, makeName, modelID, modelName, + recordCreate_timeMillis, recordUpdate_timeMillis) + values (?, ?, ?, ?, ?, ?)`; + const updateSQL = `update MakeModel + set recordUpdate_timeMillis = ? + where makeName = ? + and modelName = ?`; for (const record of data.Results) { const info = database .prepare(insertSQL) @@ -79,7 +82,7 @@ export const getModelsByMake = async (makeSearchStringOriginal) => { } } return queryCloseCallbackFunction(); -}; +} export const getMakeFromNCIC = (vehicleNCIC) => { return ncic.allNCIC[vehicleNCIC] || vehicleNCIC; }; diff --git a/helpers/functions.vehicle.ts b/helpers/functions.vehicle.ts index 47f8e595..e41518a0 100644 --- a/helpers/functions.vehicle.ts +++ b/helpers/functions.vehicle.ts @@ -1,19 +1,17 @@ -import sqlite from 'better-sqlite3' - import nhtsa from '@shaggytools/nhtsa-api-wrapper' +import sqlite from 'better-sqlite3' import { nhtsaDB as databasePath } from '../data/databasePaths.js' - -import * as ncic from '../data/ncicCodes.js' import { trailerNCIC } from '../data/ncicCodes/trailer.js' - -import type { NHTSAMakeModel } from '../types/recordTypes' +import * as ncic from '../data/ncicCodes.js' +import type { NHTSAMakeModel } from '../types/recordTypes.js' /* * API */ const { GetModelsForMake } = nhtsa +const nhtsaGetModelsForMake = new GetModelsForMake() const nhtsaSearchExpiryDurationMillis = 14 * 86_400 * 1000 @@ -21,24 +19,24 @@ const nhtsaSearchExpiryDurationMillis = 14 * 86_400 * 1000 * More Data */ -const getModelsByMakeFromDB = ( +function getModelsByMakeFromDB( makeSearchString: string, database: sqlite.Database -): NHTSAMakeModel[] => { +): NHTSAMakeModel[] { return database .prepare( - 'select makeID, makeName, modelID, modelName' + - ' from MakeModel' + - ' where instr(lower(makeName), ?)' + - ' and recordDelete_timeMillis is null' + - ' order by makeName, modelName' + `select makeID, makeName, modelID, modelName + from MakeModel + where instr(lower(makeName), ?) + and recordDelete_timeMillis is null + order by makeName, modelName` ) .all(makeSearchString) as NHTSAMakeModel[] } -export const getModelsByMakeFromCache = ( +export function getModelsByMakeFromCache( makeSearchStringOriginal: string -): NHTSAMakeModel[] => { +): NHTSAMakeModel[] { const makeSearchString = makeSearchStringOriginal.trim().toLowerCase() const database = sqlite(databasePath) @@ -50,14 +48,14 @@ export const getModelsByMakeFromCache = ( return makeModelResults } -export const getModelsByMake = async ( +export async function getModelsByMake( makeSearchStringOriginal: string -): Promise<NHTSAMakeModel[]> => { +): Promise<NHTSAMakeModel[]> { const makeSearchString = makeSearchStringOriginal.trim().toLowerCase() const database = sqlite(databasePath) - const queryCloseCallbackFunction = () => { + const queryCloseCallbackFunction = (): NHTSAMakeModel[] => { const makeModelResults = getModelsByMakeFromDB(makeSearchString, database) database.close() return makeModelResults @@ -71,12 +69,23 @@ export const getModelsByMake = async ( const searchRecord = database .prepare( - 'select searchExpiryMillis from MakeModelSearchHistory' + - ' where searchString = ?' + `select searchExpiryMillis + from MakeModelSearchHistory + where searchString = ?` ) - .get(makeSearchString) as { searchExpiryMillis: number } + .get(makeSearchString) as { searchExpiryMillis: number } | undefined + + if (searchRecord === undefined) { + useAPI = true - if (searchRecord) { + database + .prepare( + `insert into MakeModelSearchHistory ( + searchString, resultCount, searchExpiryMillis) + values (?, ?, ?)` + ) + .run(makeSearchString, 0, nowMillis + nhtsaSearchExpiryDurationMillis) + } else { if (searchRecord.searchExpiryMillis < nowMillis) { // expired // update searchExpiryMillis to avoid multiple queries @@ -85,45 +94,34 @@ export const getModelsByMake = async ( database .prepare( - 'update MakeModelSearchHistory' + - ' set searchExpiryMillis = ?' + - ' where searchString = ?' + `update MakeModelSearchHistory + set searchExpiryMillis = ? + where searchString = ?` ) .run(nowMillis + nhtsaSearchExpiryDurationMillis, makeSearchString) } - } else { - useAPI = true - - database - .prepare( - 'insert into MakeModelSearchHistory' + - ' (searchString, resultCount, searchExpiryMillis)' + - ' values (?, ?, ?)' - ) - .run(makeSearchString, 0, nowMillis + nhtsaSearchExpiryDurationMillis) } if (useAPI) { - const data = await GetModelsForMake(makeSearchString) + const data = await nhtsaGetModelsForMake.GetModelsForMake(makeSearchString) database .prepare( - 'update MakeModelSearchHistory' + - ' set resultCount = ?' + - 'where searchString = ?' + `update MakeModelSearchHistory + set resultCount = ? + where searchString = ?` ) .run(data.Count, makeSearchString) - const insertSQL = - 'insert or ignore into MakeModel (makeID, makeName, modelID, modelName,' + - ' recordCreate_timeMillis, recordUpdate_timeMillis)' + - ' values (?, ?, ?, ?, ?, ?)' + const insertSQL = `insert or ignore into MakeModel ( + makeID, makeName, modelID, modelName, + recordCreate_timeMillis, recordUpdate_timeMillis) + values (?, ?, ?, ?, ?, ?)` - const updateSQL = - 'update MakeModel' + - ' set recordUpdate_timeMillis = ?' + - ' where makeName = ?' + - ' and modelName = ?' + const updateSQL = `update MakeModel + set recordUpdate_timeMillis = ? + where makeName = ? + and modelName = ?` for (const record of data.Results) { const info = database diff --git a/package-lock.json b/package-lock.json index a1208d37..2ac3756f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@cityssm/expressjs-server-js": "^2.3.2", "@fontsource/pt-mono": "^5.0.8", "@fortawesome/fontawesome-free": "^5.15.4", - "@shaggytools/nhtsa-api-wrapper": "^3.0.4", + "@shaggytools/nhtsa-api-wrapper": "^2.0.3", "activedirectory2": "^2.2.0", "better-sqlite3": "^8.7.0", "compression": "^1.7.4", @@ -265,6 +265,17 @@ "node": ">=4" } }, + "node_modules/@babel/runtime": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz", + "integrity": "sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA==", + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@cityssm/bulma-a11y": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@cityssm/bulma-a11y/-/bulma-a11y-0.4.0.tgz", @@ -553,10 +564,17 @@ } }, "node_modules/@shaggytools/nhtsa-api-wrapper": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@shaggytools/nhtsa-api-wrapper/-/nhtsa-api-wrapper-3.0.4.tgz", - "integrity": "sha512-fRDKMK+Wl27qk45Rfg5w4BhS62ubxcnBEHE+WFmIo5Dnl4f3Q89EvLDIwC8RUQpPYBaaW5L43I2U6BXpN4RbDw==", - "hasInstallScript": true + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@shaggytools/nhtsa-api-wrapper/-/nhtsa-api-wrapper-2.0.3.tgz", + "integrity": "sha512-R1wFX+Mwbk0yLA109Y3hwFX7Z4Qi+eIvQi6VgSSTqPoalKi1faeo3LOY8WJYrbYMSQYLA3bqkpsLWkfSMSXlDg==", + "dependencies": { + "@babel/runtime": "7.16.5", + "isomorphic-unfetch": "3.1.0" + }, + "engines": { + "node": ">=12.22.1", + "npm": ">=6.0.0" + } }, "node_modules/@types/activedirectory2": { "version": "1.2.4", @@ -6858,6 +6876,34 @@ "node": ">=0.10.0" } }, + "node_modules/isomorphic-unfetch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz", + "integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==", + "dependencies": { + "node-fetch": "^2.6.1", + "unfetch": "^4.2.0" + } + }, + "node_modules/isomorphic-unfetch/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -9110,6 +9156,11 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, "node_modules/regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -10735,6 +10786,11 @@ "node": ">= 4.0.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -11010,6 +11066,11 @@ "integrity": "sha1-5qdUzI8V5YmHqpy9J69m/W9OWvk=", "dev": true }, + "node_modules/unfetch": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", + "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==" + }, "node_modules/union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -11347,6 +11408,20 @@ "node": ">= 8" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -11794,6 +11869,14 @@ } } }, + "@babel/runtime": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz", + "integrity": "sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@cityssm/bulma-a11y": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@cityssm/bulma-a11y/-/bulma-a11y-0.4.0.tgz", @@ -12024,9 +12107,13 @@ } }, "@shaggytools/nhtsa-api-wrapper": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@shaggytools/nhtsa-api-wrapper/-/nhtsa-api-wrapper-3.0.4.tgz", - "integrity": "sha512-fRDKMK+Wl27qk45Rfg5w4BhS62ubxcnBEHE+WFmIo5Dnl4f3Q89EvLDIwC8RUQpPYBaaW5L43I2U6BXpN4RbDw==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@shaggytools/nhtsa-api-wrapper/-/nhtsa-api-wrapper-2.0.3.tgz", + "integrity": "sha512-R1wFX+Mwbk0yLA109Y3hwFX7Z4Qi+eIvQi6VgSSTqPoalKi1faeo3LOY8WJYrbYMSQYLA3bqkpsLWkfSMSXlDg==", + "requires": { + "@babel/runtime": "7.16.5", + "isomorphic-unfetch": "3.1.0" + } }, "@types/activedirectory2": { "version": "1.2.4", @@ -16865,6 +16952,25 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, + "isomorphic-unfetch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz", + "integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==", + "requires": { + "node-fetch": "^2.6.1", + "unfetch": "^4.2.0" + }, + "dependencies": { + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + } + } + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -18572,6 +18678,11 @@ "@eslint-community/regexpp": "^4.5.0" } }, + "regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -19862,6 +19973,11 @@ } } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -20077,6 +20193,11 @@ "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=", "dev": true }, + "unfetch": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", + "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==" + }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -20355,6 +20476,20 @@ "integrity": "sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==", "dev": true }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 4f41c5ff..fa89723e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@cityssm/expressjs-server-js": "^2.3.2", "@fontsource/pt-mono": "^5.0.8", "@fortawesome/fontawesome-free": "^5.15.4", - "@shaggytools/nhtsa-api-wrapper": "^3.0.4", + "@shaggytools/nhtsa-api-wrapper": "^2.0.3", "activedirectory2": "^2.2.0", "better-sqlite3": "^8.7.0", "compression": "^1.7.4",