diff --git a/.changeset/ninety-hornets-prove.md b/.changeset/ninety-hornets-prove.md new file mode 100644 index 000000000..9a08d2758 --- /dev/null +++ b/.changeset/ninety-hornets-prove.md @@ -0,0 +1,5 @@ +--- +"@shaggytools/nhtsa-api-wrapper": patch +--- + +Refactor useNHTSA, rename cacheUrl -> createCachedUrl diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53cf820ac..eec95b26e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,10 +4,10 @@ on: pull_request: env: - PATH_BUILD_DOCS: ./apps/docs/src/.vitepress/dist + PATH_BUILD_DOCS: ./apps/docs/.vitepress/dist PATH_BUILD_LIB: ./packages/lib/dist CACHE_PATHS_BUILD: | - ./apps/docs/pages/.vitepress/dist + ./apps/docs/.vitepress/dist ./packages/lib/dist CACHE_KEY_BUILD: build-${{ github.sha }} # To use Remote Caching, uncomment the next lines and follow the steps below. diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml deleted file mode 100644 index 8ef0960b9..000000000 --- a/.github/workflows/deploy-docs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Deploy Packages and Documentation - -on: - push: - branches: - - main - -jobs: - deploy-docs: - name: Deploy docs from main branch to github pages - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/workflows/setup - - - name: Build - run: pnpm build - - - name: Deploy to Github Pages - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: apps/docs/src/.vitepress/dist -# TODO - -# Deploy new versions via changesets publish diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml deleted file mode 100644 index 18227b398..000000000 --- a/.github/workflows/deployment.yml +++ /dev/null @@ -1,56 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Push Master - -on: - push: - branches: - - 'master' - -jobs: - deploy-to-gh-pages: - - runs-on: ubuntu-20.04 - - strategy: - matrix: - node-version: [14.x] - - steps: - - name: Checkout - uses: actions/checkout@v2.7.0 - - - name: Setup Node and Install Depedencies - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - run: yarn --frozen-lockfile - - - name: Lint and Test - run: | - yarn lint - yarn test - - - name: Build Package - run: yarn build - - - name: Build Docs - run: yarn build-docs - - - name: Upload Coverage - uses: codecov/codecov-action@v3 - with: - flags: unittests, master, push # optional - - - name: Deploy Docs to gh-pages branch - uses: JamesIves/github-pages-deploy-action@v4.4.1 - with: - BRANCH: gh-pages # The branch the action should deploy to. - FOLDER: docs # The folder the action should deploy. - - - name: Semantic Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx semantic-release \ No newline at end of file diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml deleted file mode 100644 index 49e0dd5dd..000000000 --- a/.github/workflows/development.yml +++ /dev/null @@ -1,50 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Push/Pull Development - -on: - push: - branches: - - "**" # matches every branch - - "!main" # excludes master - - "!next" # excludes next - pull_request: - branches: - - "**" # matches every branch - - "!main" # excludes master - - "!next" # excludes next - -jobs: - lint-test-build: - runs-on: ubuntu-20.04 - - strategy: - matrix: - node-version: [14.x] - - steps: - - name: Checkout - uses: actions/checkout@v2.7.0 - - - name: Setup Node and Install Depedencies - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - run: yarn --frozen-lockfile - - - name: Lint and Test - run: | - yarn lint - yarn test - - - name: Build Package - run: yarn build - - - name: Build Docs - run: yarn build-docs - - - name: Upload Coverage - uses: codecov/codecov-action@v3 - with: - flags: unittests, dev, push, pull # optional diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index ed7751dca..000000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,44 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Pull Master - -on: - pull_request: - branches: - - 'master' - -jobs: - lint-test-build: - - runs-on: ubuntu-20.04 - - strategy: - matrix: - node-version: [14.x] - - steps: - - name: Checkout - uses: actions/checkout@v2.7.0 - - - name: Setup Node and Install Depedencies - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - run: yarn --frozen-lockfile - - - name: Lint and Test - run: | - yarn lint - yarn test - - - name: Build Package - run: yarn build - - - name: Build Docs - run: yarn build-docs - - - name: Upload Coverage - uses: codecov/codecov-action@v3 - with: - flags: unittests, master, pull # optional \ No newline at end of file diff --git a/.gitignore b/.gitignore index e87a3f434..56ba89f95 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,5 @@ typings/ .yarn-integrity # dotenv environment variables file -.env \ No newline at end of file +.env +.vercel diff --git a/README.md b/README.md index 511023516..a6f2dc351 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,22 @@ -# @shaggytools/nhtsa-api-wrapper +# @shaggytools/nhtsa-api-wrapper Monorepo -[![npm](https://img.shields.io/npm/v/@shaggytools/nhtsa-api-wrapper)](https://www.npmjs.com/package/@shaggytools/nhtsa-api-wrapper) -[![codecov](https://codecov.io/gh/ShaggyTech/nhtsa-api-wrapper/branch/master/graph/badge.svg)](https://codecov.io/gh/ShaggyTech/nhtsa-api-wrapper) -[![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@shaggytools/nhtsa-api-wrapper)](https://bundlephobia.com/result?p=@shaggytools/nhtsa-api-wrapper) -[![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@shaggytools/nhtsa-api-wrapper)](https://bundlephobia.com/result?p=@shaggytools/nhtsa-api-wrapper) -[![](https://data.jsdelivr.com/v1/package/npm/@shaggytools/nhtsa-api-wrapper/badge)](https://www.jsdelivr.com/package/npm/@shaggytools/nhtsa-api-wrapper) +

+ + + + + + + + + + + + + + + +

--- @@ -17,11 +29,159 @@ The VPIC API is primarily used for decoding useful information from a Vehicle Id (VIN) in the United States and Canada. It can also be used to get all models of a make, to decode WMIs, get all makes for a certain year, and more. -## Documentation +--- + +
Built With:
+
+

+ + + + + + + + + + + + + + + +

+ +--- + +## Full Documentation + +### [https://vpic.shaggytech.com/](https://vpic.shaggytech.com/) + +- [Introduction](https://vpic.shaggytech.com/guide) +- [Install](https://vpic.shaggytech.com/guide/getting-started#install) +- [Quick Start](https://vpic.shaggytech.com//guide/getting-started#quick-start) +- [API Reference](https://vpic.shaggytech.com/api/) + +## Mono Repo Structure + +```sh +├── apps +│ ├── docs (Package Documentation) +| +├── config (Shared Configs) +│ ├── eslint-config-custom +│ ├── prettier-config +│ ├── tsconfig +│ ├── typedoc-config +| +├── packages +│ ├── lib (@shaggytools/nhtsa-api-wrapper) + +``` + +## Install + +### Node Package Managers + +#### [NPM](https://www.npmjs.com/package/@shaggytools/nhtsa-api-wrapper) + +```sh [npm] +$ npm install @shaggytools/nhtsa-api-wrapper +``` + +#### Yarn + +```sh [yarn] +$ yarn add @shaggytools/nhtsa-api-wrapper +``` + +#### Pnpm + +```sh [pnpm] +$ pnpm add @shaggytools/nhtsa-api-wrapper +``` + +### Browser CDNs + +Browser global variable: `NHTSA` + +#### [jsDelivr](https://www.jsdelivr.com/package/npm/@shaggytools/nhtsa-api-wrapper) + +```html [jsDelivr] + +``` + +#### UNPKG + +```html [UNPKG] + +``` + +## List of Exported Functions + +```javascript +import { + // NHTSA API Endpoints + DecodeVin, + DecodeVinExtended, + DecodeVinValues, + DecodeVinValuesBatch, + DecodeVinValuesExtended, + DecodeWMI, + GetAllMakes, + GetAllManufacturers, + GetCanadianVehicleSpecifications, + GetEquipmentPlantCodes, + GetMakeForManufacturer, + GetMakesForManufacturerAndYear, + GetMakesForVehicleType, + GetManufacturerDetails, + GetModelsForMake, + GetModelsForMakeId, + GetModelsForMakeIdYear, + GetModelsForMakeYear, + GetParts, + GetVehicleTypesForMake, + GetVehicleTypesForMakeId, + GetVehicleVariableList, + GetVehicleVariableValuesList, + GetWMIsForManufacturer, + // composable function returning helper functions for NHTSA API + useNHTSA, + // function for offline VIN validation + isValidVin, +} from "@shaggytools/nhtsa-api-wrapper"; +``` + +## Quick Start + +Decoding a VIN is as easy as importing the `DecodeVinValues` function and calling it +with a VIN. + +Make sure to first install via your favorite package manager or use a CDN. + +```javascript +import { DecodeVinValues } from "@shaggytools/nhtsa-api-wrapper"; + +const results = await DecodeVinValues("WA1A4AFY2J2008189"); + +/* +results = { + Count: 136, - number of Results objects returned + Message: 'Results returned successfully ...', + SearchCriteria: 'VIN:WA1A4AFY2J2008189', + Results: [ {...} ] - an array with single object of type DecodeVinValuesResults +} +*/ + +/* You can also use destructuring to get the Results object */ +const { Results } = await DecodeVinValues("WA1A4AFY2J2008189"); + +/* This endpoint only returns a single object in the Results array + The first object in the array is the decoded vin data */ +const decodedVehicle = Results[0]; // equals an object of type DecodeVinValuesResults +``` -### [https://shaggytech.com/nhtsa-api-wrapper](https://shaggytech.com/nhtsa-api-wrapper/) +For a full example response see: [DecodeVinValues](https://vpic.shaggytech.com/api/endpoints/decode-vin-values#returns) -- [Introduction](https://www.shaggytech.com/nhtsa-api-wrapper/guide) -- [Install](https://www.shaggytech.com/nhtsa-api-wrapper/guide/getting-started#install) -- [Quick Start](https://www.shaggytech.com/nhtsa-api-wrapper/guide/getting-started#quick-start) -- [API Reference](https://www.shaggytech.com/nhtsa-api-wrapper/api/) +All available endpoints can be found here: [VPIC API Endpoints](https://vpic.shaggytech.com/api/#vpic-api-endpoints) diff --git a/apps/README.md b/apps/README.md index 5cf7175e8..bc8dd273a 100644 --- a/apps/README.md +++ b/apps/README.md @@ -8,8 +8,6 @@ Apps are published to GitHub Pages, Vercel, Netlify, etc. ## Contents ---- - ### `apps/docs` Contains the source code for the `@shaggytools/nhtsa-api-wrapper` documentation. diff --git a/apps/docs/.vitepress/config.ts b/apps/docs/.vitepress/config.ts new file mode 100644 index 000000000..7ad8c5408 --- /dev/null +++ b/apps/docs/.vitepress/config.ts @@ -0,0 +1,133 @@ +import { createWriteStream } from 'node:fs' +import { resolve } from 'node:path' +import { SitemapStream } from 'sitemap' +// import { generateSitemap } from 'sitemap-ts' +import { defineConfig, type HeadConfig } from 'vitepress' +import { nav, sidebar } from './menu' + +const { VITEPRESS_BASE = '/' } = process.env + +interface SiteMapLink { + url: string + lastmod?: number +} + +const sitemapLinks: SiteMapLink[] = [] + +export default defineConfig({ + srcDir: 'src', + base: VITEPRESS_BASE, + lang: 'en-US', + title: '@shaggytools/nhtsa-api-wrapper', + description: + 'A thin Javascript wrapper for the NHTSA VPIC API. Decode a VIN and more with ease.', + head: getHeadTags(), + + appearance: 'dark', + lastUpdated: true, + cleanUrls: true, + + markdown: { + theme: 'one-dark-pro', + }, + + themeConfig: { + outline: 'deep', + nav: nav(), + sidebar: sidebar(), + + editLink: { + pattern: + 'https://github.com/shaggytech/nhtsa-api-wrapper/edit/main/apps/docs/src/:path', + text: 'Suggest changes to this page', + }, + + socialLinks: [ + { + icon: 'github', + link: 'https://github.com/shaggytech/nhtsa-api-wrapper', + }, + ], + + footer: { + message: 'Released under the MIT License.', + copyright: 'Copyright © 2017-present Brandon Eichler', + }, + }, + + transformHtml: (_, id, { pageData }) => { + if (!/[\\/]404\.html$/.test(id)) + sitemapLinks.push({ + // you might need to change this if not using clean urls mode + url: pageData.relativePath.replace(/((^|\/)index)?\.md$/, '$2'), + lastmod: pageData.lastUpdated, + }) + }, + + buildEnd: async ({ outDir }) => { + const sitemap = new SitemapStream({ + hostname: 'https://vpic.shaggytech.com/', + }) + const writeStream = createWriteStream(resolve(outDir, 'sitemap.xml')) + sitemap.pipe(writeStream) + sitemapLinks.forEach((link) => sitemap.write(link)) + sitemap.end() + await new Promise((r) => writeStream.on('finish', r)) + }, +}) + +function getHeadTags(): HeadConfig[] { + const tags: HeadConfig[] = [ + ['link', { rel: 'icon', type: 'image/png', href: '/favicon.png' }], + ['meta', { name: 'author', content: 'Brandon Eichler' }], + [ + 'meta', + { property: 'og:title', content: '@shaggytools/nhtsa-api-wrapper' }, + ], + [ + 'meta', + { + property: 'og:image', + content: 'https://vpic.shaggytech.com/og-image.png', + }, + ], + [ + 'meta', + { + property: 'og:description', + content: + 'A thin Javascript wrapper for the NHTSA VPIC API. Decode a VIN and more with ease.', + }, + ], + ['meta', { name: 'twitter:card', content: 'summary_large_image' }], + [ + 'meta', + { name: 'twitter:creator', content: '@shaggytools/nhtsa-api-wrapper' }, + ], + [ + 'meta', + { + name: 'twitter:image', + content: 'https://vpic.shaggytech.com/og-image.png', + }, + ], + ['link', { rel: 'dns-prefetch', href: 'https://fonts.gstatic.com' }], + [ + 'link', + { + rel: 'preconnect', + crossorigin: 'anonymous', + href: 'https://fonts.gstatic.com', + }, + ], + [ + 'link', + { + href: 'https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@200;400;500&family=Inter:wght@200;400;500;600', + rel: 'stylesheet', + }, + ], + ] + + return tags +} diff --git a/apps/docs/src/.vitepress/menu.ts b/apps/docs/.vitepress/menu-links.ts similarity index 70% rename from apps/docs/src/.vitepress/menu.ts rename to apps/docs/.vitepress/menu-links.ts index fdb1f7c4b..8cb9a0841 100644 --- a/apps/docs/src/.vitepress/menu.ts +++ b/apps/docs/.vitepress/menu-links.ts @@ -1,78 +1,78 @@ -export const vpicEndpointLinks = [ - { text: 'DecodeVin', link: '/api/decode-vin' }, - { text: 'DecodeVinExtended', link: '/api/decode-vin-extended' }, - { text: 'DecodeVinValues', link: '/api/decode-vin-values' }, +const vpicEndpointLinks = [ + { text: 'DecodeVin', link: '/api/endpoints/decode-vin' }, + { text: 'DecodeVinExtended', link: '/api/endpoints/decode-vin-extended' }, + { text: 'DecodeVinValues', link: '/api/endpoints/decode-vin-values' }, { text: 'DecodeVinValuesBatch', - link: '/api/decode-vin-values-batch', + link: '/api/endpoints/decode-vin-values-batch', }, { text: 'DecodeVinValuesExtended', - link: '/api/decode-vin-values-extended', + link: '/api/endpoints/decode-vin-values-extended', }, - { text: 'DecodeWMI', link: '/api/decode-wmi' }, - { text: 'GetAllMakes', link: '/api/get-all-makes' }, - { text: 'GetAllManufacturers', link: '/api/get-all-manufacturers' }, + { text: 'DecodeWMI', link: '/api/endpoints/decode-wmi' }, + { text: 'GetAllMakes', link: '/api/endpoints/get-all-makes' }, + { text: 'GetAllManufacturers', link: '/api/endpoints/get-all-manufacturers' }, { text: 'GetCanadianVehicleSpecifications', - link: '/api/get-canadian-vehicle-specifications', + link: '/api/endpoints/get-canadian-vehicle-specifications', }, { text: 'GetEquipmentPlantCodes', - link: '/api/get-equipment-plant-codes', + link: '/api/endpoints/get-equipment-plant-codes', }, { text: 'GetMakeForManufacturer', - link: '/api/get-make-for-manufacturer', + link: '/api/endpoints/get-make-for-manufacturer', }, { text: 'GetMakesForManufacturerAndYear', - link: '/api/get-makes-for-manufacturer-and-year', + link: '/api/endpoints/get-makes-for-manufacturer-and-year', }, { text: 'GetMakesForVehicleType', - link: '/api/get-makes-for-vehicle-type', + link: '/api/endpoints/get-makes-for-vehicle-type', }, { text: 'GetManufacturerDetails', - link: '/api/get-manufacturer-details', + link: '/api/endpoints/get-manufacturer-details', }, - { text: 'GetModelsForMake', link: '/api/get-models-for-make' }, - { text: 'GetModelsForMakeId', link: '/api/get-models-for-make-id' }, + { text: 'GetModelsForMake', link: '/api/endpoints/get-models-for-make' }, + { text: 'GetModelsForMakeId', link: '/api/endpoints/get-models-for-make-id' }, { text: 'GetModelsForMakeIdYear', - link: '/api/get-models-for-make-id-year', + link: '/api/endpoints/get-models-for-make-id-year', }, { text: 'GetModelsForMakeYear', - link: '/api/get-models-for-make-year', + link: '/api/endpoints/get-models-for-make-year', }, - { text: 'GetParts', link: '/api/get-parts' }, + { text: 'GetParts', link: '/api/endpoints/get-parts' }, { text: 'GetVehicleTypesForMake', - link: '/api/get-vehicle-types-for-make', + link: '/api/endpoints/get-vehicle-types-for-make', }, { text: 'GetVehicleTypesForMakeId', - link: '/api/get-vehicle-types-for-make-id', + link: '/api/endpoints/get-vehicle-types-for-make-id', }, { text: 'GetVehicleVariableList', - link: '/api/get-vehicle-variable-list', + link: '/api/endpoints/get-vehicle-variable-list', }, { text: 'GetVehicleVariableValuesList', - link: '/api/get-vehicle-variable-values-list', + link: '/api/endpoints/get-vehicle-variable-values-list', }, { text: 'GetWMIsForManufacturer', - link: '/api/get-wmis-for-manufacturer', + link: '/api/endpoints/get-wmis-for-manufacturer', }, ] -export const packageReferenceLinks = [ +const packageReferenceLinks = [ { - text: 'types', + text: 'Types', link: '/typedoc/modules/types', }, { @@ -184,3 +184,5 @@ export const packageReferenceLinks = [ link: '/typedoc/modules/api_endpoints_GetWMIsForManufacturer', }, ] + +export { packageReferenceLinks, vpicEndpointLinks } diff --git a/apps/docs/.vitepress/menu.ts b/apps/docs/.vitepress/menu.ts new file mode 100644 index 000000000..1043d1854 --- /dev/null +++ b/apps/docs/.vitepress/menu.ts @@ -0,0 +1,83 @@ +import { createRequire } from 'module' +import { packageReferenceLinks, vpicEndpointLinks } from './menu-links' + +const require = createRequire(import.meta.url) +const pkg = require('@shaggytools/nhtsa-api-wrapper/package.json') + +function nav() { + return [ + { text: 'Guide', link: '/guide/', activeMatch: '/guide/' }, + { text: 'Docs', link: '/api/', activeMatch: '/api/' }, + { text: 'Pkg Reference', link: '/typedoc/', activeMatch: '/typedoc/' }, + { + text: pkg.version, + items: [ + { + text: 'Changelog', + link: 'https://github.com/shaggytech/nhtsa-api-wrapper/blob/main/CHANGELOG.md', + }, + ], + }, + ] +} + +function sidebar() { + return [ + { + text: 'Guide', + collapsed: true, + items: [ + { text: 'Overview', link: '/guide/' }, + { text: 'Getting Started', link: '/guide/getting-started' }, + { + text: 'Bring Your Own Fetch (BYOF)', + link: '/guide/bring-your-own-fetch', + }, + { + text: 'Support for Node Versions < 18', + link: '/guide/native-fetch', + }, + { text: 'Typescript Support', link: '/guide/typescript' }, + ], + }, + { + text: 'Documentation', + collapsed: true, + items: [ + { + text: 'VPIC API', + collapsed: false, + items: [ + { text: 'Overview', link: '/api/' }, + { + text: 'API Response', + link: '/api/vpic-api-response', + }, + { + text: 'API Functions', + link: '/api/endpoints/', + collapsed: true, + items: vpicEndpointLinks, + }, + ], + }, + { + text: 'Utility Functions', + collapsed: false, + items: [ + { text: 'Overview', link: '/utils/' }, + { text: 'isValidVin', link: '/utils/is-valid-vin' }, + { text: 'useNHTSA', link: '/utils/use-nhtsa-composable' }, + ], + }, + ], + }, + { + text: 'Package Reference', + collapsed: true, + items: [{ text: 'Index', link: '/typedoc/' }, ...packageReferenceLinks], + }, + ] +} + +export { nav, sidebar } diff --git a/apps/docs/src/.vitepress/theme/index.ts b/apps/docs/.vitepress/theme/index.ts similarity index 71% rename from apps/docs/src/.vitepress/theme/index.ts rename to apps/docs/.vitepress/theme/index.ts index 42fe9a936..20de07db8 100644 --- a/apps/docs/src/.vitepress/theme/index.ts +++ b/apps/docs/.vitepress/theme/index.ts @@ -1,4 +1,4 @@ import DefaultTheme from 'vitepress/theme' -import './custom.css' +import './styles/index.scss' export default DefaultTheme diff --git a/apps/docs/.vitepress/theme/styles/colors.scss b/apps/docs/.vitepress/theme/styles/colors.scss new file mode 100644 index 000000000..d35a4d94e --- /dev/null +++ b/apps/docs/.vitepress/theme/styles/colors.scss @@ -0,0 +1,94 @@ +// Adapted from https://github.com/stackblitz/docs/blob/main/.vitepress/theme/styles/colors.scss + +:root { + scroll-padding-top: calc(var(--vp-nav-height-desktop) + 30px); + --content-max-width: 1480px; +} + +:root:not(.dark) { + // Backgrounds + --vp-c-bg: hsl(0, 0%, 100%); + --vp-c-bg-alt: hsl(0, 0%, 90%); + --vp-sidebar-bg-color: hsl(0, 0%, 100%); + + // add subtle background to code surrounded with backticks + --vp-c-mute: hsl(0, 0%, 90%); + --vp-c-text-code: hsl(0, 0%, 0%); + + // Text colors + --vp-c-text-1: hsl(220, 100%, 8%); + --vp-c-text-2: hsl(0, 0%, 4%); + + // Highlight color (links, some borders or hover effects) + --vp-c-brand: hsl(200, 91%, 25%); + --vp-c-brand-light: hsl(195 85% 42%); + --vp-c-brand-lighter: hsl(190 90% 48%); + --vp-c-brand-dark: hsl(200 80% 32%); + --vp-c-brand-darker: hsl(200 70% 24%); + + // Custom highlight colors (used on home page) + --sb-foreground-highlight: hsl(210 90% 50%); + --sb-foreground-highlight-high: hsl(190 100% 50%); + + // Contrast fixes + --vp-custom-block-info-text: hsl(220 10% 36%); + --vp-custom-block-warning-text: hsl(45, 90%, 28%); + + // Buttons + --vp-button-brand-color: var(--vp); + --vp-button-brand-bg: var(--vp-c-brand-darker); + --vp-button-brand-border: var(--vp-c-brand); +} + +:root.dark { + // Tweak the color palette for blacks and dark grays + --vp-c-black: hsl(220 20% 9%); + --vp-c-black-pure: hsl(220, 24%, 4%); + --vp-c-black-soft: hsl(220 16% 13%); + --vp-c-black-mute: hsl(220 14% 17%); + --vp-c-gray: hsl(220 8% 56%); + --vp-c-gray-dark-1: hsl(220 10% 39%); + --vp-c-gray-dark-2: hsl(220 12% 28%); + --vp-c-gray-dark-3: hsl(220 12% 23%); + --vp-c-gray-dark-4: hsl(220 14% 17%); + --vp-c-gray-dark-5: hsl(220 16% 13%); + + // Backgrounds + --vp-c-gutter: hsl(220 20% 9%); + --vp-c-bg: hsl(220 14% 13%); + --vp-c-bg-alt: hsl(222, 29%, 9%); + --vp-c-bg-soft: hsl(220 14% 17%); + --vp-c-bg-mute: hsl(220 12% 23%); + --vp-custom-block-info-bg: hsl(220 14% 17%); + + // Homepage + --vp-home-hero-name-color: hsl(208, 100%, 50%); + + // Highlight color (links, some borders or hover effects) + --vp-c-brand: hsl(208, 100%, 40%); + --vp-c-brand-light: hsl(208, 100%, 50%); + --vp-c-brand-lighter: hsl(208, 86%, 64%); + --vp-c-brand-dark: hsl(208, 100%, 20%); + --vp-c-brand-darker: hsl(208, 100%, 15%); + + // Custom highlight colors (used on home page) + --sb-foreground-highlight: hsl(190, 91%, 69%); + --sb-foreground-highlight-high: hsl(165, 29%, 47%); + + // Contrast fixes + --vp-custom-block-info-text: hsl(220 50% 85%); + --vp-custom-block-danger-text: hsl(340, 100%, 66%); + + // Buttons + --vp-button-brand-bg: var(--vp-c-brand-darker); + --vp-button-brand-border: var(--vp-c-brand); + + // If we want to make the dividers blueish too + //--vp-c-divider: var(--vp-c-divider-light-1); + //--vp-c-divider-light: var(--vp-c-divider-light-2); + //--vp-c-divider-inverse: var(--vp-c-divider-dark-1); + //--vp-c-divider-inverse-light: var(--vp-c-divider-dark-2); + + // Algolia DocSearch UI + --docsearch-container-background: hsl(220 24% 30% / 0.85); +} diff --git a/apps/docs/.vitepress/theme/styles/content.scss b/apps/docs/.vitepress/theme/styles/content.scss new file mode 100644 index 000000000..9091e6482 --- /dev/null +++ b/apps/docs/.vitepress/theme/styles/content.scss @@ -0,0 +1,95 @@ +// Adapted from https://github.com/stackblitz/docs/blob/main/.vitepress/theme/styles/content.scss + +.vp-doc h1 { + margin-bottom: 24px; +} + +.vp-doc h2 { + margin: 44px 0 24px; + border-top: 1px solid var(--vp-c-divider-light); + padding-top: 32px; +} + +// Wrap code examples +.vp-doc [class*='language-'] pre, +.vp-doc [class*='language-'] code { + white-space: pre-wrap; + // break contiguous strings if there was no break opportunity (e.g. whitespace, hyphens or slashes) + word-break: break-word; +} + +.vp-doc td, +.vp-doc th { + font-size: 14px; + line-height: 1.5; + &.no-break { + white-space: nowrap; + } +} + +.vp-doc summary { + cursor: default; +} + +.vp-doc img { + margin: 8px 0; +} + +.vp-doc figure { + margin-top: 1.5rem; + margin-bottom: 1.5rem; +} + +.vp-doc figcaption { + padding: 0.75rem 1.25rem; + font-size: 87%; + border-radius: 8px; + background-color: var(--vp-c-bg-soft); +} + +@media (min-width: 600px) { + .vp-doc .float-left { + float: left; + max-width: 50%; + margin-top: 1rem; + margin-bottom: 1.5rem; + margin-right: 1.5rem; + } + .vp-doc .float-right { + float: right; + max-width: 50%; + margin-top: 1rem; + margin-bottom: 1.5rem; + margin-left: 1.5rem; + } +} + +// Function/variable names in titles +.vp-doc var { + font-family: var(--vp-font-family-mono); + font-weight: inherit; + font-style: inherit; + small { + padding-inline: 0.4ch; + font-weight: normal; + font-size: 90%; + color: var(--vp-c-text-2); + } +} + +.vp-doc .footnotes-sep { + margin: 44px 0 32px; + border-top: 1px solid var(--vp-c-divider-light); +} + +.vp-doc .footnotes { + p { + margin: 0.75em 0; + font-size: 14px; + line-height: 24px; + } +} + +.content-container .VPDocFooter { + margin-top: 30px; +} diff --git a/apps/docs/.vitepress/theme/styles/fixes.scss b/apps/docs/.vitepress/theme/styles/fixes.scss new file mode 100644 index 000000000..420fe2a7e --- /dev/null +++ b/apps/docs/.vitepress/theme/styles/fixes.scss @@ -0,0 +1,697 @@ +// Adapted from https://github.com/stackblitz/docs/tree/main/.vitepress/theme/styles + +:root { + --vp-sidebar-width: 365px; + --vp-font-family-base: 'Inter', apple-system, BlinkMacSystemFont, 'Segoe UI', + Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', + 'Helvetica Neue', sans-serif; + --vp-font-family-mono: 'IBM Plex Mono', source-code-pro, Menlo, Monaco, + Consolas, 'Courier New', monospace; +} + +.VPHero.VPHomeHero { + background-color: var(--vp-c-bg-alt); + padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 60px) + 64px 64px; + + .container .main { + display: flex; + flex-direction: column; + gap: 20px; + + .name { + line-height: 36px; + font-size: 32px; + + @media (min-width: 640px) { + line-height: 48px; + font-size: 42px; + } + } + + @media (min-width: 960px) { + padding-left: 48px; + } + } +} + +.VPFeatures.VPHomeFeatures { + padding-top: 48px; + + .container .items { + row-gap: 16px; + + .item span { + border: 2px solid var(--vp-c-bg-alt); + box-shadow: 0 2px 4px 0 var(--vp-c-bg-alt); + } + } +} + +// Remove nav border +.VPNavBar { + border-bottom: none !important; +} + +// No content-body transition (background-color fix) +.VPNavBar .content-body { + transition: none !important; +} + +// Correct max logo height +.VPNavBarTitle img.logo { + height: 20px; + margin-inline-end: 12px; +} + +// Fix enormous line-height of navbar items +.VPNavBarMenu .VPNavBarMenuLink, +.VPNavBarMenuGroup { + min-height: var(--vp-nav-height-mobile); + line-height: 1.32; + @media (min-width: 960px) { + min-height: var(--vp-nav-height-desktop); + } +} + +// Don't clip text in the outline +.VPDocAsideOutline .outline-link { + white-space: normal; + text-overflow: initial; + padding: 5px 0; + font-size: 13px; + line-height: 18px; +} + +// We would like to have single pages in the sidebar (e.g. API Reference, Enterprise). +// VitPress expects to have you section title text + items and when you only have one item it looks like there are extra spacing. +// These styles are to adjust spacing between groups. +#VPSidebarNav .group { + padding-bottom: 11px; + width: calc(var(--vp-sidebar-width) - 32px); +} + +#VPSidebarNav .group + .group { + margin-top: 0px; +} + +.VPSidebarGroup.collapsed { + margin-bottom: 11px; +} + +.VPSidebarGroup.collapsible.collapsed .items { + margin-bottom: -14px; +} + +// Move search away from logo +.VPNavBarSearch.search { + justify-content: flex-end; + margin-right: 32px; +} + +// -------------------------------- +// Customize Navs +// -------------------------------- +// -- Content + +// Reduce .VPContent's dependency on calculated sizes +.VPContent.has-sidebar { + @media (min-width: 960px) { + padding-left: calc(var(--vp-sidebar-width) + 16px) !important; + } + @media (min-width: 1440px) { + padding-right: 0 !important; + } +} + +// Fill in space to accommodate Sidebar's width changes +.VPDoc.has-sidebar.has-aside { + @media (min-width: 960px) and (max-width: 1500px) { + padding-left: 0; + } +} + +// Increase body content width if space available. +.VPDoc.has-aside .content-container { + max-width: 820px !important; +} + +.VPDoc.has-sidebar.has-aside .container > .content { + @media (min-width: 1500px) { + padding-left: 52px; + padding-right: 52px; + } +} + +// Body styles +.vp-doc p, +.vp-doc li { + font-size: 15px; + line-height: 1.8; +} +.vp-doc p { + margin: 24px 0; +} + +.vp-doc p a { + display: inline-block; +} + +.vp-doc p > img, +.vp-doc > div > img { + margin: 40px 0; + border-radius: 6px; +} + +.vp-doc pre code { + font-size: 12.5px !important; +} + +.vp-code-group .tabs label { + font-size: 13px !important; + font-weight: 600; +} + +.vp-doc div[class*='language-'] { + margin: 32px 0 40px; +} + +.vp-doc .header-anchor { + @media (min-width: 960px) { + position: absolute; + left: -28px; + padding: 0 18px; + transform: scale(0.94); + } +} + +.vp-doc h1, +.vp-doc h2, +.vp-doc h3, +.vp-doc h4, +.vp-doc h5, +.vp-doc h6 { + width: max-content; + max-width: 100%; +} +.vp-doc h1 + p, +.vp-doc h2 + p { + margin-top: 0; +} +.vp-doc h2 { + padding-top: 16px !important; +} +.vp-doc h3 { + margin-top: 40px !important; +} + +.vp-doc p > strong > a, +.vp-doc p > a, +.vp-doc li > strong > a, +.vp-doc li > a, +.vp-doc td > strong > a, +.vp-doc td > a { + text-decoration: underline; + text-underline-offset: 2px; + text-decoration-thickness: 1px; + transition: 0.1s ease; + transition-property: color, text-underline-offset; + :root.dark & { + color: rgb(180, 204, 255); + } + &:hover, + :root.dark &:hover { + color: var(--vp-c-text-1); + text-decoration-thickness: 1px; + text-underline-offset: 4px; + } +} + +// -------------------------------- +// -- Top + +// Remove extraneous fade elements +.VPNavBar .curtain { + display: none; +} + +// Correct width on non-docs pages +.VPNavBar .container { + max-width: unset; +} + +// Size according to Sidebar width to limit zone affected by nav overlay +.VPNavBar.has-sidebar .content { + // padding-left: var(--vp-sidebar-width) !important; + padding-right: 32px !important; + @media (max-width: 960px) { + padding-right: 0 !important; + } +} + +// Position title/logo to hug left +.VPNavBar.has-sidebar .title { + padding-left: 12px !important; + border-bottom: none; + @media (max-width: 960px) { + padding-left: 0 !important; + } +} + +// Restyle top NavBarMenu links +.VPNavBarMenu.menu { + height: calc(100% - 16px); +} + +.VPNavBarMenu.menu a, +.VPNavbarMenu.menu div { + font-size: 13px; + margin: 0 4px; + opacity: 0.8; + transition-duration: 0.1s; + transition-property: color, opacity, box-shadow; + &:hover:not(.active) { + opacity: 1; + color: var(--vp-c-text-1); + } +} + +.VPNavBarMenuLink.active { + color: var(--vp-c-text-1) !important; + box-shadow: inset 0 -1px 0 0 var(--vp-c-brand); + opacity: 1 !important; +} + +.VPFlyout { + display: flex; + align-items: center; + + .item.social-links { + place-content: center; + } +} + +// -------------------------------- +// -- Sidebar + +// Use empty space in docs navs more effectively. +// Using existing default fallback styles where possible to negate calc()-type sizes. +.VPSidebar { + --active-indicator-padding: 8px; + --vp-new-padding: calc(16px - var(--active-indicator-padding)); + padding-left: var(--vp-new-padding) !important; + padding-right: var(--vp-new-padding) !important; + padding-bottom: 32px !important; + width: var(--vp-sidebar-width) !important; + @media (max-width: 1500px) { + --vp-sidebar-width: 308px; + } + @media (max-width: 960px) { + --vp-sidebar-width: 380px; + max-width: 80vw !important; + } +} +// Allow .VPLink to take up all horizontal space available +// #VPSidebarNav .group { +// @media (min-width: 960px) { +// width: unset; +// } +// } +#VPSidebarNav.nav { + margin-top: 8px; +} +// Hide extraneous visual elements when parent group is collapsed +// without messing with individual elements themselves. +.VPSidebarGroup.collapsed .items { + opacity: 0; +} +// Align item group container's collapsed border with child item list's +// first item's top border/box-shadow. +.VPSidebarGroup.collapsible:not(.collapsed) .items { + margin-top: 9px; +} +// Align group title with item links +.VPSidebarGroup .title { + padding-left: var(--active-indicator-padding); +} +// Ignore top nav and mobile nav +.VPLink:not(.VPNavBarMenuLink):not(.VPNavScreenMenuLink):not( + .VPFlyout .VPLink + ) { + line-height: 1.1; + // New link styles + &.link { + margin: 0; + padding: 8px var(--active-indicator-padding) !important; + transition-duration: 0.1s; + transition-property: background-color; + // Only customize top-level active links + .VPSidebarItem.level-1 > .item > & { + &::before { + content: ''; + position: absolute; + width: 2px; + height: 100%; + top: 0; + left: -14px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; + background-color: var(--vp-c-brand); + opacity: 0; + transition-duration: 0.1s; + transition-property: opacity; + :root:not(.dark) & { + left: -14px; + } + } + } + .VPSidebarItem.has-active.level-1 > .item > & { + position: relative; + border-radius: 6px; + background-color: #fff; + :root.dark & { + background-color: var(--vp-c-bg); + } + &::before { + opacity: 1; + } + } + .text { + padding: 0; + font-size: 13px; + line-height: 1.32; + transition: none !important; + .VPSidebarItem.is-active > .item & { + color: var(--vp-c-text-1) !important; + font-weight: bold; + } + } + &:hover .text { + color: var(--vp-c-text-1) !important; + } + } +} +.link-text { + font-size: 13px !important; + line-height: 1.32 !important; +} + +.VPSidebarItem.level-0:not(.collapsed) .item + .items { + margin-block-start: 2px; +} +.VPSidebarItem.level-0:not(.collapsed) > .item + .items { + margin-block-start: 6px; +} + +.VPSidebarItem.level-0 { + padding-bottom: 10px !important; + &.collapsed { + padding: 0 !important; + } +} + +// Link section heading alignment +.VPSidebarItem .item .text, +.VPSidebarItem .item .VPLink .text { + padding-left: 14px !important; + color: var(--vp-c-text-2) !important; + transition: none; +} +.VPSidebarItem .item:hover h2.text, +.VPSidebarItem:not(.collapsed) .item h2.text { + color: var(--vp-c-text-1) !important; +} + +// Smaller, quicker caret +.VPSidebarItem .caret { + transform: scale(0.8); +} +.VPSidebarItem .caret-icon { + transition-duration: 0.16s !important; +} + +// -------------------------------- +// -- Aside / Table of Contents + +// Widen aside +.VPDoc .aside { + padding-left: 0; + @media (min-width: 1380px) { + max-width: 248px; + } + @media (min-width: 1500px) { + max-width: 300px; + } + @media (min-width: 1600px) { + max-width: 328px; + } +} + +// Add gap between title and list, but account for hardcoded `outline-marker` `top` +.VPDocAside .outline-title { + margin-block-end: -1px; + transform: translateY(-6px); +} + +// Space out links without affecting `outline-marker` too much +.VPDocAside .outline-link { + padding: 6px 0; + font-size: 12.5px; + transition-duration: 0.1s; +} + +// -------------------------------- +// Custom Blocks + +.vp-doc .custom-block { + margin: 48px 0; + padding: 28px 28px; + padding-left: 32px; + border: none; + border-radius: 8px; + box-shadow: inset 0 0 0 1px var(--block-border-color); + + @media (max-width: 500px) { + padding-left: 18px; + padding-right: 18px; + } + + &:not(:root.dark &) { + --vp-custom-block-info-bg: rgba(121, 121, 121, 0.117); + --vp-custom-block-tip-bg: rgba(0, 235, 157, 0.083); + --vp-custom-block-tip-border: rgba(0, 136, 120, 0.5); + --vp-custom-block-tip-text: rgb(16, 122, 92); + --vp-custom-block-warning-text: rgb(190, 127, 0); + --vp-custom-block-warning-border: rgb(255, 200, 0); + --vp-custom-block-warning-bg: rgba(255, 200, 0, 0.118); + --vp-custom-block-danger-bg: rgba(255, 0, 0, 0.057); + } + :root.dark & { + --vp-custom-block-tip-text: hsl(132, 79%, 47%); + --vp-custom-block-tip-border: hsl(158, 100%, 19%); + --vp-custom-block-warning-text: rgb(228, 164, 3); + --vp-custom-block-warning-border: rgb(208, 163, 0); + box-shadow: inset 0 0 0 1px var(--block-border-color); + background-color: var(--vp-c-bg-alt); + } + + &.info { + --block-border-color: var(--vp-custom-block-info-border); + --block-icon-color: var(--vp-custom-block-info-text); + } + &.tip { + --block-border-color: var(--vp-custom-block-tip-border); + --block-icon-color: var(--vp-custom-block-tip-text); + } + &.warning { + --block-border-color: var(--vp-custom-block-warning-border); + --block-icon-color: var(--vp-custom-block-warning-text); + } + &.danger { + --block-border-color: var(--vp-custom-block-danger-border); + --block-icon-color: var(--vp-custom-block-danger-text); + } + &.details { + --block-border-color: var(--vp-custom-block-details-border); + --block-icon-color: var(--vp-custom-block-details-text); + } +} + +h2 + .custom-block { + margin-top: 32px !important; +} + +.vp-doc .custom-block p { + margin: 2px 0 0; + font-size: 14px; + line-height: 1.8; + + &.custom-block-title { + position: relative; + margin-bottom: 8px; + @media (max-width: 500px) { + margin-left: 42px; + margin-bottom: 14px; + } + } +} +.vp-doc .custom-block:not(.details) p.custom-block-title::before, +.vp-doc .custom-block:not(.details) summary::before { + content: ''; + position: absolute; + top: 0; + left: -32px; + width: 12px; + height: 24px; + border-end-end-radius: 50%; + border-start-end-radius: 50%; + background-color: var(--block-icon-color); + -webkit-mask-image: var(--block-icon-url); + mask-image: var(--block-icon-url); + -webkit-mask-position: center; + mask-position: center; + -webkit-mask-repeat: no-repeat; + mask-repeat: no-repeat; + -webkit-mask-size: contain; + mask-size: contain; + @media (max-width: 500px) { + left: -40px; + } +} + +.vp-doc .custom-block p:not(.custom-block-title), +.vp-doc .custom-block ol, +.vp-doc .custom-block ul { + color: var(--vp-c-text-1); +} +.vp-doc .custom-block ol, +.vp-doc .custom-block ul { + margin: 12px 0; +} + +.vp-doc .custom-block a { + transition-duration: 0.1s; +} + +.vp-doc .custom-block ul { + margin-bottom: 0; +} + +.vp-doc .custom-block summary { + position: relative; + margin: 0; + &::marker { + content: '▷\a0\a0\a0'; + } +} +.vp-doc .custom-block[open] summary::marker { + content: '▽\a0\a0\a0'; +} + +.vp-doc .custom-block div[class*='language-'] { + margin: 24px 0; + &:last-child { + margin-bottom: 0; + } +} + +// -------------------------------- +// Footer / Above Footer + +.pager .pager-link { + background-color: var(--vp-c-bg-alt); +} + +.VPLink.link.edit-link-button, +.pager-link .title { + gap: 4px; + font-size: 13px; + svg { + transform: scale(0.92); + } + + :root:not(.dark) & { + color: var(--vp-c-brand-dark); + } + + :root.dark & { + color: var(--vp-c-brand-lighter); + } +} + +.content-container footer.VPDocFooter .edit-info { + margin-top: 20px; +} + +.edit-info { + padding-bottom: 24px !important; +} + +// -------------------------------- +// Community Projects + +.community-project-screenshot { + width: 100%; + max-width: 760px; + border-radius: 12px; + overflow: hidden; + img { + max-width: min(100%, 800px); + margin: 0 !important; + } + @media screen and (max-height: 768px) { + max-width: 680px; + max-height: 352px; + } + @media screen and (max-width: 960px) { + max-width: 680px; + max-height: 352px; + } +} + +// -------------------------------- +// Twitter Tweet Embed + +.twitter-tweet { + position: relative; + display: block; + max-width: 640px; + padding: 64px 32px 16px !important; + margin: 52px 0 !important; + color: var(--vp-c-text-2); + font-size: 14px; + font-weight: 500; + @media screen and (max-width: 960px) { + padding: 64px 24px 16px !important; + padding-right: 0 !important; + } + + & > p { + margin-bottom: 16px !important; + color: var(--vp-c-text-1) !important; + font-size: 16px; + @media screen and (max-width: 500px) { + font-size: 14px !important; + } + } + + &::before { + --twitter-icon-mask-size: 26px; + content: ''; + position: absolute; + top: 16px; + left: 32px; + width: var(--twitter-icon-mask-size); + height: var(--twitter-icon-mask-size); + transition: background-color 0.14s ease; + background-color: #1da1f2; + -webkit-mask-image: var(--twitter-icon-img); + mask-image: var(--twitter-icon-img); + -webkit-mask-position: center; + mask-position: center; + -webkit-mask-repeat: no-repeat; + mask-repeat: no-repeat; + -webkit-mask-size: cover; + mask-size: cover; + } +} diff --git a/apps/docs/.vitepress/theme/styles/index.scss b/apps/docs/.vitepress/theme/styles/index.scss new file mode 100644 index 000000000..485128315 --- /dev/null +++ b/apps/docs/.vitepress/theme/styles/index.scss @@ -0,0 +1,5 @@ +@import './colors.scss'; +@import './content.scss'; +@import './fixes.scss'; +@import './scrollbar.scss'; +@import './vars.scss'; diff --git a/apps/docs/.vitepress/theme/styles/scrollbar.scss b/apps/docs/.vitepress/theme/styles/scrollbar.scss new file mode 100644 index 000000000..c3b0f6f93 --- /dev/null +++ b/apps/docs/.vitepress/theme/styles/scrollbar.scss @@ -0,0 +1,27 @@ +// scrollbar +::-webkit-scrollbar { + width: 12px; +} +::-webkit-scrollbar-track { + background: rgb(166, 166, 166); +} +::-webkit-scrollbar-thumb { + border: 2px solid rgb(141, 141, 141); + border-radius: 9999px; + background-color: rgb(57, 57, 57); +} +::-webkit-scrollbar-thumb:hover { + background-color: rgb(41, 41, 41); +} +html.dark { + ::-webkit-scrollbar-track { + background: rgb(7, 11, 21); + } + ::-webkit-scrollbar-thumb { + border-color: rgb(12, 14, 30); + background-color: rgb(53, 53, 53); + } + ::-webkit-scrollbar-thumb:hover { + background-color: rgb(81, 81, 81); + } +} diff --git a/apps/docs/.vitepress/theme/styles/vars.scss b/apps/docs/.vitepress/theme/styles/vars.scss new file mode 100644 index 000000000..93fa00f45 --- /dev/null +++ b/apps/docs/.vitepress/theme/styles/vars.scss @@ -0,0 +1,5 @@ +// adapted from https://github.com/stackblitz/docs/blob/main/.vitepress/theme/styles/vars.scss + +$bp-medium: 680px; +$bp-large: 960px; +$bp-xlarge: 1200px; diff --git a/apps/docs/README.md b/apps/docs/README.md index 58fcef58a..29095b0a0 100644 --- a/apps/docs/README.md +++ b/apps/docs/README.md @@ -1,5 +1,10 @@ -# Documentation App for the `@shaggytools/nhtsa-api-wrapper` Package +# Documentation for the `@shaggytools/nhtsa-api-wrapper` Package -## Built With: +Built With: - Vitepress + +Contains the source code for the `@shaggytools/nhtsa-api-wrapper` documentation. + +- published to GitHub Pages @ + [shaggytech.com/nhtsa-api-wrapper](https://shaggytech.com/nhtsa-api-wrapper/) diff --git a/apps/docs/package.json b/apps/docs/package.json index 321c31647..4089f8893 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -6,14 +6,14 @@ "main": "index.js", "scripts": { "preinstall": "npx only-allow pnpm", - "dev": "vitepress dev src --host", - "build": "vitepress build src", - "preview": "vitepress preview src", + "dev": "vitepress dev --host", + "build": "vitepress build", + "preview": "vitepress preview", "lint": "eslint .", "lint:fix": "eslint --fix", "format": "prettier --write \"src/**/*.{ts,tsx,md}\"", "format:typedoc": "prettier --write \"src/typedoc/**/*.md\"", - "clean": "rimraf src/.vitepress/dist src/.vitepress/cache .turbo", + "clean": "rimraf .vitepress/dist .vitepress/cache .turbo", "clean:all": "pnpm run clean && rimraf node_modules" }, "dependencies": { @@ -26,6 +26,8 @@ "prettier": "2.8.7", "prettier-config": "workspace:*", "rimraf": "4.4.1", + "sass": "1.62.1", + "sitemap": "7.1.1", "tsconfig": "workspace:*", "typescript": "5.0.3", "vitepress": "1.0.0-alpha.64" diff --git a/apps/docs/src/.vitepress/config.ts b/apps/docs/src/.vitepress/config.ts deleted file mode 100644 index 1ef3e53ed..000000000 --- a/apps/docs/src/.vitepress/config.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { createRequire } from 'module' -import { defineConfig } from 'vitepress' -import { packageReferenceLinks, vpicEndpointLinks } from './menu' - -/* Base URL for production deployment on Github Pages = shaggytech.com/nhtsa-api-wrapper */ -/* Set env variable VITEPRESS_BASE to '/' for Vercel deployment previews */ -const { VITEPRESS_BASE = '/nhtsa-api-wrapper/' } = process.env - -const require = createRequire(import.meta.url) -const pkg = require('@shaggytools/nhtsa-api-wrapper/package.json') - -export default defineConfig({ - lang: 'en-US', - title: '@shaggytools/nhtsa-api-wrapper', - description: 'Documentation website for @shaggytools/nhtsa-api-wrapper', - - appearance: 'dark', - lastUpdated: true, - cleanUrls: true, - - head: [['meta', { name: 'theme-color', content: '#3c8772' }]], - - base: VITEPRESS_BASE, - - markdown: { - theme: 'one-dark-pro', - }, - - themeConfig: { - outline: 'deep', - nav: nav(), - - sidebar: { - '/guide/': sidebar(), - '/api/': sidebar(), - '/typedoc/': sidebar(), - }, - - editLink: { - pattern: - 'https://github.com/shaggytech/nhtsa-api-wrapper/edit/main/apps/docs/:path', - text: 'Edit this page on GitHub', - }, - - socialLinks: [ - { - icon: 'github', - link: 'https://github.com/shaggytech/nhtsa-api-wrapper', - }, - ], - - footer: { - message: 'Released under the MIT License.', - copyright: 'Copyright © 2017-present Brandon Eichler', - }, - }, -}) - -function nav() { - return [ - { text: 'Guide', link: '/guide/', activeMatch: '/guide/' }, - { text: 'API Reference', link: '/api/', activeMatch: '/api/' }, - { text: 'Typedocs', link: '/typedoc/', activeMatch: '/typedoc/' }, - { - text: pkg.version, - items: [ - { - text: 'Changelog', - link: 'https://github.com/shaggytech/nhtsa-api-wrapper/blob/main/CHANGELOG.md', - }, - { - text: 'Contributing', - link: 'https://github.com/shaggytech/nhtsa-api-wrapper/blob/main/.github/contributing.md', - }, - ], - }, - ] -} - -function sidebar() { - return [ - { - text: 'Guide', - collapsed: false, - items: [ - { text: 'Introduction', link: '/guide/' }, - { text: 'Getting Started', link: '/guide/getting-started' }, - { - text: 'BYOF - Bring Your Own Fetch', - link: '/guide/bring-your-own-fetch', - }, - { - text: 'Support for Node Versions < 18', - link: '/guide/native-fetch', - }, - { text: 'Typescript Support', link: '/guide/typescript' }, - ], - }, - { - text: 'API Reference', - collapsed: false, - items: [ - { - text: 'Introduction', - link: '/api/', - }, - { - text: 'VPIC API Response', - link: '/api/vpic-api-response', - }, - { - text: 'VPIC API Endpoints', - collapsed: false, - items: vpicEndpointLinks, - }, - ], - }, - { - text: 'Package Reference', - collapsed: false, - items: [ - { - text: 'Introduction', - link: '/typedoc/', - }, - { - text: 'Typedocs', - collapsed: true, - items: packageReferenceLinks, - }, - ], - }, - ] -} diff --git a/apps/docs/src/.vitepress/theme/custom.css b/apps/docs/src/.vitepress/theme/custom.css deleted file mode 100644 index 4dc2c7445..000000000 --- a/apps/docs/src/.vitepress/theme/custom.css +++ /dev/null @@ -1,6 +0,0 @@ -/* .vitepress/theme/custom.css */ -:root { - --vp-c-brand: #3b82f6; - --vp-c-brand-light: #60a5fa; - --vp-sidebar-width: 325px; -} diff --git a/apps/docs/src/api/decode-vin-extended.md b/apps/docs/src/api/endpoints/decode-vin-extended.md similarity index 90% rename from apps/docs/src/api/decode-vin-extended.md rename to apps/docs/src/api/endpoints/decode-vin-extended.md index a29eed060..0e519e9f3 100644 --- a/apps/docs/src/api/decode-vin-extended.md +++ b/apps/docs/src/api/endpoints/decode-vin-extended.md @@ -1,7 +1,5 @@ # DecodeVinExtended -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function DecodeVinExtended ( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_DecodeVinExtended.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_DecodeVinExtended) ::: ## Description @@ -56,7 +54,7 @@ Any `params` that are not listed in the table above will be ignored. As `params` is optional, it also has type `| boolean`, so you can set `doFetch` without having to pass `undefined` in place of intentionally undefined `params`. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -93,7 +91,7 @@ Returns the URL string that can be used to fetch the data, does _not_ fetch the // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVinExtended/WA1A4AFY2J2008189?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type DecodeVinExtendedResults @@ -117,14 +115,16 @@ results. Each object will contain: ## Examples -::: tip :bulb: Examples 1-3: +::: tip Examples 1-3: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Decode VIN @@ -153,15 +153,18 @@ import { DecodeVinExtended } from '@shaggytools/nhtsa-api-wrapper' const response = await DecodeVinExtended('5UXWX7C5*BA') ``` -::: warning :bulb: Examples 4-5: +::: tip Examples 4-5: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 4: Decode VIN and doFetch = false diff --git a/apps/docs/src/api/decode-vin-values-batch.md b/apps/docs/src/api/endpoints/decode-vin-values-batch.md similarity index 88% rename from apps/docs/src/api/decode-vin-values-batch.md rename to apps/docs/src/api/endpoints/decode-vin-values-batch.md index f3f6edea6..1fa4e9e94 100644 --- a/apps/docs/src/api/decode-vin-values-batch.md +++ b/apps/docs/src/api/endpoints/decode-vin-values-batch.md @@ -1,7 +1,5 @@ # DecodeVinValuesBatch -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function DecodeVinValuesBatch( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_DecodeVinValuesBatch.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_DecodeVinValuesBatch) ::: ## Description @@ -55,7 +53,7 @@ the model year if it is known at the time of decoding, but it is not required. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -93,7 +91,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da ``` ::: tip :bulb: See: -[Using doFetch](../guide/bring-your-own-fetch#using-dofetch) for info on how to +[Using doFetch](../../guide/bring-your-own-fetch#using-dofetch) for info on how to use the URL string to fetch the data in a POST request such as this endpoint. ::: @@ -109,14 +107,16 @@ Objects found in the `Results` array of `DecodeVinValuesBatch` endpoint response ## Examples -::: tip :bulb: Examples 1-4: +::: tip Examples 1-4: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Decode Multiple VINs @@ -153,16 +153,20 @@ import { DecodeVinValuesBatch } from '@shaggytools/nhtsa-api-wrapper' const response = await DecodeVinValuesBatch('5UXWX7C5*BA; 5YJSA3DS*EF, 2015') ``` -::: warning :bulb: Example 5: +::: tip Example 5: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- See: [Using with POST Endpoints](../../guide/bring-your-own-fetch#using-with-post-endpoints) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) -- See: [Using with POST Endpoints](../guide/bring-your-own-fetch#using-with-post-endpoints) - ::: ### Example 5: Decode Multiple VINs and doFetch = false diff --git a/apps/docs/src/api/decode-vin-values-extended.md b/apps/docs/src/api/endpoints/decode-vin-values-extended.md similarity index 91% rename from apps/docs/src/api/decode-vin-values-extended.md rename to apps/docs/src/api/endpoints/decode-vin-values-extended.md index 2122db644..a7025515f 100644 --- a/apps/docs/src/api/decode-vin-values-extended.md +++ b/apps/docs/src/api/endpoints/decode-vin-values-extended.md @@ -1,7 +1,5 @@ # DecodeVinValuesExtended -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function DecodeVinValuesExtended( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_DecodeVinValuesExtended.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_DecodeVinValuesExtended) ::: ## Description @@ -66,7 +64,7 @@ Any `params` that are not listed in the table above will be ignored. As `params` is optional, it also has type `| boolean`, so you can set `doFetch` without having to pass `undefined` in place of intentionally undefined `params`. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -103,7 +101,7 @@ Returns the URL string that can be used to fetch the data, does _not_ fetch the // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVinValuesExtended/WA1A4AFY2J2008189?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - DecodeVinValuesExtendedResults @@ -121,14 +119,16 @@ In the return object, `Results` will be an array with a _single_ object of type ## Examples -::: tip :bulb: Examples 1-3: +::: tip Examples 1-3: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Decode VIN @@ -157,15 +157,18 @@ import { DecodeVinValuesExtended } from '@shaggytools/nhtsa-api-wrapper' const response = await DecodeVinValuesExtended('5UXWX7C5*BA') ``` -::: warning :bulb: Examples 4-5: +::: tip Examples 4-5: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 4: Decode VIN and doFetch = false diff --git a/apps/docs/src/api/decode-vin-values.md b/apps/docs/src/api/endpoints/decode-vin-values.md similarity index 91% rename from apps/docs/src/api/decode-vin-values.md rename to apps/docs/src/api/endpoints/decode-vin-values.md index e26fddaed..5f51ea5d1 100644 --- a/apps/docs/src/api/decode-vin-values.md +++ b/apps/docs/src/api/endpoints/decode-vin-values.md @@ -1,7 +1,5 @@ # DecodeVinValues -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function DecodeVinValues( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_DecodeVinValues.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_DecodeVinValues) ::: ## Description @@ -62,7 +60,7 @@ Any `params` that are not listed in the table above will be ignored. As `params` is optional, it also has type `| boolean`, so you can set `doFetch` without having to pass `undefined` in place of intentionally undefined `params`. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -99,7 +97,7 @@ Returns the URL string that can be used to fetch the data, does _not_ fetch the // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVinValues/WA1A4AFY2J2008189?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - DecodeVinValuesResults @@ -117,14 +115,16 @@ In the return object, `Results` will be an array with a _single_ object of type ## Examples -::: tip :bulb: Examples 1-3: +::: tip Examples 1-3: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Decode VIN @@ -151,15 +151,18 @@ import { DecodeVinValues } from '@shaggytools/nhtsa-api-wrapper' const response = await DecodeVinValues('5UXWX7C5*BA') ``` -::: warning :bulb: Examples 4-5: +::: tip Examples 4-5: + +- Does _NOT_ fetch data from VPIC API internally + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 4: Decode VIN and doFetch = false diff --git a/apps/docs/src/api/decode-vin.md b/apps/docs/src/api/endpoints/decode-vin.md similarity index 89% rename from apps/docs/src/api/decode-vin.md rename to apps/docs/src/api/endpoints/decode-vin.md index f17d85d82..e73a56d5f 100644 --- a/apps/docs/src/api/decode-vin.md +++ b/apps/docs/src/api/endpoints/decode-vin.md @@ -1,7 +1,5 @@ # DecodeVin -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function DecodeVin( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_DecodeVin.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_DecodeVin) ::: ## Description @@ -52,7 +50,7 @@ Any `params` that are not listed in the table above will be ignored. As `params` is optional, it also has type `| boolean`, so you can set `doFetch` without having to pass `undefined` in place of intentionally undefined `params`. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -89,7 +87,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVin/WA1A4AFY2J2008189?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - DecodeVinResults @@ -113,14 +111,16 @@ results. Each object will contain: ## Examples -::: tip :bulb: Examples 1-3: +::: tip Examples 1-3: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Decode VIN @@ -147,15 +147,18 @@ import { DecodeVin } from '@shaggytools/nhtsa-api-wrapper' const response = await DecodeVin('5UXWX7C5*BA') ``` -::: warning :bulb: Examples 4-5: +::: tip Examples 4-5: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 4: Decode VIN and doFetch = false diff --git a/apps/docs/src/api/decode-wmi.md b/apps/docs/src/api/endpoints/decode-wmi.md similarity index 84% rename from apps/docs/src/api/decode-wmi.md rename to apps/docs/src/api/endpoints/decode-wmi.md index ee321affd..8a07f2840 100644 --- a/apps/docs/src/api/decode-wmi.md +++ b/apps/docs/src/api/endpoints/decode-wmi.md @@ -1,7 +1,5 @@ # DecodeWMI -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function DecodeWMI( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_DecodeWMI.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_DecodeWMI) ::: ## Description @@ -40,7 +38,7 @@ be available in VPIC data sets. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -77,7 +75,7 @@ Returns the URL string that can be used to fetch the data, does _not_ fetch the // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeWMI/WVW?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - DecodeWMIResults @@ -93,14 +91,16 @@ In the return object, `Results` will be an array with a _single_ object of type ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Decode WMI @@ -119,15 +119,18 @@ import { DecodeWMI } from '@shaggytools/nhtsa-api-wrapper' const response = await DecodeWMI('1CG', true) ``` -::: warning :bulb: Example 3: +::: tip Example 3: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Decode WMI and doFetch = false diff --git a/apps/docs/src/api/get-all-makes.md b/apps/docs/src/api/endpoints/get-all-makes.md similarity index 82% rename from apps/docs/src/api/get-all-makes.md rename to apps/docs/src/api/endpoints/get-all-makes.md index 889400078..09184b7f4 100644 --- a/apps/docs/src/api/get-all-makes.md +++ b/apps/docs/src/api/endpoints/get-all-makes.md @@ -1,7 +1,5 @@ # GetAllMakes -[[toc]] - --- ```typescript @@ -11,7 +9,7 @@ async function GetAllMakes( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetAllMakes.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetAllMakes) ::: ## Description @@ -32,7 +30,7 @@ an individual vehicle Make. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -69,7 +67,7 @@ Returns the URL string that can be used to fetch the data, does _not_ fetch the // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetAllMakes/?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetAllMakesResults @@ -85,14 +83,16 @@ In the return object, `Results` will be an array with multiple objects of type ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get All Makes @@ -111,15 +111,18 @@ import { GetAllMakes } from '@shaggytools/nhtsa-api-wrapper' const response = await GetAllMakes(true) ``` -::: warning :bulb: Example 3: +::: tip Example 3: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Get All Makes and doFetch = false diff --git a/apps/docs/src/api/get-all-manufacturers.md b/apps/docs/src/api/endpoints/get-all-manufacturers.md similarity index 89% rename from apps/docs/src/api/get-all-manufacturers.md rename to apps/docs/src/api/endpoints/get-all-manufacturers.md index efbbab289..77cd300ae 100644 --- a/apps/docs/src/api/get-all-manufacturers.md +++ b/apps/docs/src/api/endpoints/get-all-manufacturers.md @@ -1,7 +1,5 @@ # GetAllManufacturers -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function GetAllManufacturers( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetAllManufacturers.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetAllManufacturers) ::: ## Description @@ -48,7 +46,7 @@ Any `params` that are not listed in the table above will be ignored. As `params` is optional, it also has type `| boolean`, so you can set `doFetch` without having to pass `undefined` in place of intentionally undefined `params`. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -85,7 +83,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetParts?type=565&fromDate=1/1/2015&toDate=5/5/2015&manufacturer=hon&format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetAllManufacturersResults @@ -98,14 +96,15 @@ Objects returned in the `Results` array of `GetAllManufacturers` endpoint respon ## Examples -::: tip :bulb: Examples 1-4: +::: tip Examples 1-4: + +- Fetches data from VPIC API +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get All Manufacturers @@ -145,15 +144,18 @@ const response = await GetAllManufacturers({ }) ``` -::: warning :bulb: Examples 5-6: +::: tip Examples 5-6: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 5: Get All Manufacturers and doFetch = false diff --git a/apps/docs/src/api/get-canadian-vehicle-specifications.md b/apps/docs/src/api/endpoints/get-canadian-vehicle-specifications.md similarity index 91% rename from apps/docs/src/api/get-canadian-vehicle-specifications.md rename to apps/docs/src/api/endpoints/get-canadian-vehicle-specifications.md index 0ba575ecd..569bc9d1c 100644 --- a/apps/docs/src/api/get-canadian-vehicle-specifications.md +++ b/apps/docs/src/api/endpoints/get-canadian-vehicle-specifications.md @@ -1,7 +1,5 @@ # GetCanadianVehicleSpecifications -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function GetCanadianVehicleSpecifications( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetCanadianVehicleSpecifications.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetCanadianVehicleSpecifications) ::: ## Description @@ -58,7 +56,7 @@ Any `params` that are not listed in the table above will be ignored. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -96,7 +94,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetCanadianVehicleSpecifications/?Year=2011&Make=Acura&Model=&units=&format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetCanadianVehicleSpecificationsResults @@ -110,14 +108,16 @@ response. ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Results With Only `year` @@ -141,15 +141,18 @@ const response = await GetCanadianVehicleSpecifications({ }) ``` -::: warning :bulb: Examples 3-4: +::: tip Examples 3-4: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Get Results and doFetch = false diff --git a/apps/docs/src/api/get-equipment-plant-codes.md b/apps/docs/src/api/endpoints/get-equipment-plant-codes.md similarity index 90% rename from apps/docs/src/api/get-equipment-plant-codes.md rename to apps/docs/src/api/endpoints/get-equipment-plant-codes.md index 007adfe5e..27661d59f 100644 --- a/apps/docs/src/api/get-equipment-plant-codes.md +++ b/apps/docs/src/api/endpoints/get-equipment-plant-codes.md @@ -1,7 +1,5 @@ # GetEquipmentPlantCodes -[[toc]] - --- ```typescript @@ -33,7 +31,7 @@ async function GetEquipmentPlantCodes( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetEquipmentPlantCodes.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetEquipmentPlantCodes) ::: ## Description @@ -80,7 +78,7 @@ Any `params` that are not listed in the table above will be ignored. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -118,7 +116,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetEquipmentPlantCodes?year=2015&equipmentType=1&reportType=new&format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetEquipmentPlantCodesParams @@ -140,14 +138,16 @@ response. ## Examples -::: tip :bulb: Example 1: +::: tip Example 1: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Equipment Plant Codes @@ -162,15 +162,18 @@ const response = await GetEquipmentPlantCodes({ }) ``` -::: warning :bulb: Example 2: +::: tip Example 2: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 2: Get Equipment Plant Codes and doFetch = false diff --git a/apps/docs/src/api/get-make-for-manufacturer.md b/apps/docs/src/api/endpoints/get-make-for-manufacturer.md similarity index 86% rename from apps/docs/src/api/get-make-for-manufacturer.md rename to apps/docs/src/api/endpoints/get-make-for-manufacturer.md index 1fc90daf1..9060e4cfa 100644 --- a/apps/docs/src/api/get-make-for-manufacturer.md +++ b/apps/docs/src/api/endpoints/get-make-for-manufacturer.md @@ -1,7 +1,5 @@ # GetMakeForManufacturer -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetMakeForManufacturer( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetMakeForManufacturer.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetMakeForManufacturer) ::: ## Description @@ -38,7 +36,7 @@ that is requested. Multiple results are returned in case of multiple matches. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -75,7 +73,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetMakeForManufacturer/?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetMakeForManufacturerResults @@ -88,14 +86,16 @@ Objects returned in the `Results` array of `GetMakeForManufacturer` endpoint res ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Makes for Manufacturer Name @@ -114,15 +114,18 @@ import { GetMakeForManufacturer } from '@shaggytools/nhtsa-api-wrapper' const response = await GetMakeForManufacturer(988) ``` -::: warning :bulb: Examples 3-4: +::: tip Examples 3-4: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Get Makes for Manufacturer Name with doFetch = false diff --git a/apps/docs/src/api/get-makes-for-manufacturer-and-year.md b/apps/docs/src/api/endpoints/get-makes-for-manufacturer-and-year.md similarity index 89% rename from apps/docs/src/api/get-makes-for-manufacturer-and-year.md rename to apps/docs/src/api/endpoints/get-makes-for-manufacturer-and-year.md index a2c2e703a..14cddd2d8 100644 --- a/apps/docs/src/api/get-makes-for-manufacturer-and-year.md +++ b/apps/docs/src/api/endpoints/get-makes-for-manufacturer-and-year.md @@ -1,7 +1,5 @@ # GetMakesForManufacturerAndYear -[[toc]] - --- ```typescript @@ -15,7 +13,7 @@ async function GetMakesForManufacturerAndYear( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetMakesForManufacturerAndYear.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetMakesForManufacturerAndYear) ::: ## Description @@ -53,7 +51,7 @@ Any `params` that are not listed in the table above will be ignored. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -91,7 +89,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetMakesForManufacturerAndYear/volks?year=2020&format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetMakesForManufacturerAndYearResults @@ -104,14 +102,16 @@ Objects returned in the `Results` array of `GetMakesForManufacturerAndYear` endp ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Makes for Manufacturer Name and Year @@ -130,15 +130,18 @@ import { GetMakesForManufacturerAndYear } from '@shaggytools/nhtsa-api-wrapper' const response = await GetMakesForManufacturerAndYear(1148, { year: 2020 }) ``` -::: warning :bulb: Examples 3-4: +::: tip Examples 3-4: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Get Makes for Manufacturer Name and Year with doFetch = false diff --git a/apps/docs/src/api/get-makes-for-vehicle-type.md b/apps/docs/src/api/endpoints/get-makes-for-vehicle-type.md similarity index 83% rename from apps/docs/src/api/get-makes-for-vehicle-type.md rename to apps/docs/src/api/endpoints/get-makes-for-vehicle-type.md index 14a3e82fe..1e1830243 100644 --- a/apps/docs/src/api/get-makes-for-vehicle-type.md +++ b/apps/docs/src/api/endpoints/get-makes-for-vehicle-type.md @@ -1,7 +1,5 @@ # GetMakesForVehicleType -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetMakesForVehicleType( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetMakesForVehicleType.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetMakesForVehicleType) ::: ## Description @@ -34,7 +32,7 @@ See: [Package Reference](../typedoc/modules/api_endpoints_GetMakesForVehicleType Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -72,7 +70,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetMakesForVehicleType/truck?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetMakesForVehicleTypeResults @@ -85,14 +83,16 @@ Objects returned in the `Results` array of `GetMakesForVehicleTypeResults` endpo ## Examples -::: tip :bulb: Example 1: +::: tip Example 1: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Makes for Vehicle Type @@ -103,15 +103,18 @@ import { GetMakesForVehicleType } from '@shaggytools/nhtsa-api-wrapper' const response = await GetMakesForVehicleType('truck') ``` -::: warning :bulb: Example 2: +::: tip Example 2: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 2: Get Makes for Vehicle Type with doFetch = false diff --git a/apps/docs/src/api/get-manufacturer-details.md b/apps/docs/src/api/endpoints/get-manufacturer-details.md similarity index 86% rename from apps/docs/src/api/get-manufacturer-details.md rename to apps/docs/src/api/endpoints/get-manufacturer-details.md index ae7e9afe8..d222a1f31 100644 --- a/apps/docs/src/api/get-manufacturer-details.md +++ b/apps/docs/src/api/endpoints/get-manufacturer-details.md @@ -1,7 +1,5 @@ # GetManufacturerDetails -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetManufacturerDetails( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetManufacturerDetails.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetManufacturerDetails) ::: ## Description @@ -38,7 +36,7 @@ Multiple results are returned in case of multiple matches. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -76,7 +74,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetManufacturerDetails/tesla?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetManufacturerDetailsResults @@ -89,14 +87,16 @@ Objects returned in the `Results` array of `GetManufacturerDetails` endpoint res ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Manufacturer Details by Name @@ -115,15 +115,18 @@ import { GetManufacturerDetails } from '@shaggytools/nhtsa-api-wrapper' const response = await GetManufacturerDetails(955) ``` -::: warning :bulb: Examples 3-4: +::: tip Examples 3-4: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Get Manufacturer Details by Name and doFetch = false diff --git a/apps/docs/src/api/get-models-for-make-id-year.md b/apps/docs/src/api/endpoints/get-models-for-make-id-year.md similarity index 91% rename from apps/docs/src/api/get-models-for-make-id-year.md rename to apps/docs/src/api/endpoints/get-models-for-make-id-year.md index 900b9bb7d..97293b54c 100644 --- a/apps/docs/src/api/get-models-for-make-id-year.md +++ b/apps/docs/src/api/endpoints/get-models-for-make-id-year.md @@ -1,7 +1,5 @@ # GetModelsForMakeIdYear -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function GetModelsForMakeIdYear( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetModelsForMakeIdYear.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetModelsForMakeIdYear) ::: ## Description @@ -77,7 +75,7 @@ Any `params` that are not listed in the table above will be ignored. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -115,7 +113,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeIdYear/makeId/474/modelyear/2015/vehicleType/car?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetModelsForMakeIdYearResults @@ -128,14 +126,15 @@ Objects returned in the `Results` array of `GetModelsForMakeIdYear` endpoint res ## Examples -::: tip :bulb: Examples 1-3: +::: tip Examples 1-3: + +- Fetches data from VPIC API +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Models for makeId and modelYear @@ -172,15 +171,18 @@ const response = await GetModelsForMakeIdYear({ }) ``` -::: warning :bulb: Examples 4-6: +::: tip Examples 4-6: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 4: Get Models for makeId and modelYear and doFetch = false diff --git a/apps/docs/src/api/get-models-for-make-id.md b/apps/docs/src/api/endpoints/get-models-for-make-id.md similarity index 85% rename from apps/docs/src/api/get-models-for-make-id.md rename to apps/docs/src/api/endpoints/get-models-for-make-id.md index 3a51dc24b..3debf5249 100644 --- a/apps/docs/src/api/get-models-for-make-id.md +++ b/apps/docs/src/api/endpoints/get-models-for-make-id.md @@ -1,7 +1,5 @@ # GetModelsForMakeId -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetModelsForMakeId( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetModelsForMakeId.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetModelsForMakeId) ::: ## Description @@ -51,7 +49,7 @@ endpoint. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -89,7 +87,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeId/582?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetModelsForMakeIdResults @@ -102,14 +100,16 @@ Objects returned in the `Results` array of `GetModelsForMakeId` endpoint respons ## Examples -::: tip :bulb: Example 1: +::: tip Example 1: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Models for Make ID @@ -120,15 +120,18 @@ import { GetModelsForMakeId } from '@shaggytools/nhtsa-api-wrapper' const response = await GetModelsForMakeId(582) ``` -::: warning :bulb: Example 2: +::: tip Example 2: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 2: Get Models for Make ID and doFetch = false diff --git a/apps/docs/src/api/get-models-for-make-year.md b/apps/docs/src/api/endpoints/get-models-for-make-year.md similarity index 90% rename from apps/docs/src/api/get-models-for-make-year.md rename to apps/docs/src/api/endpoints/get-models-for-make-year.md index 3bd4f04ac..419b07349 100644 --- a/apps/docs/src/api/get-models-for-make-year.md +++ b/apps/docs/src/api/endpoints/get-models-for-make-year.md @@ -1,7 +1,5 @@ # GetModelsForMakeYear -[[toc]] - --- ```typescript @@ -17,7 +15,7 @@ async function GetModelsForMakeYear( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetModelsForMakeYear.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetModelsForMakeYear) ::: ## Description @@ -58,7 +56,7 @@ Any `params` that are not listed in the table above will be ignored. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -96,7 +94,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeYear/make/audi/modelyear/2018/vehicleType/car?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetModelsForMakeYearResults @@ -109,14 +107,16 @@ Objects returned in the `Results` array of `GetModelsForMakeYear` endpoint respo ## Examples -::: tip :bulb: Examples 1-3: +::: tip Examples 1-3: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Models for make and modelYear @@ -153,15 +153,18 @@ const response = await GetModelsForMakeYear({ }) ``` -::: warning :bulb: Examples 4-6: +::: tip Examples 4-6: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 4: Get Models for make and modelYear and doFetch = false diff --git a/apps/docs/src/api/get-models-for-make.md b/apps/docs/src/api/endpoints/get-models-for-make.md similarity index 82% rename from apps/docs/src/api/get-models-for-make.md rename to apps/docs/src/api/endpoints/get-models-for-make.md index d588fe339..b53f7ecca 100644 --- a/apps/docs/src/api/get-models-for-make.md +++ b/apps/docs/src/api/endpoints/get-models-for-make.md @@ -1,7 +1,5 @@ # GetModelsForMake -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetModelsForMake( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetModelsForMake.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetModelsForMake) ::: ## Description @@ -34,7 +32,7 @@ whose Name is LIKE the Make in vPIC Dataset. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -72,7 +70,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMake/audi?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetModelsForMakeResults @@ -85,14 +83,16 @@ Objects returned in the `Results` array of `GetModelsForMake` endpoint response. ## Examples -::: tip :bulb: Example 1: +::: tip Example 1: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Models for Make @@ -103,15 +103,18 @@ import { GetModelsForMake } from '@shaggytools/nhtsa-api-wrapper' const response = await GetModelsForMake('audi') ``` -::: warning :bulb: Example 2: +::: tip Example 2: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 2: Get Models for Make and doFetch = false diff --git a/apps/docs/src/api/get-parts.md b/apps/docs/src/api/endpoints/get-parts.md similarity index 90% rename from apps/docs/src/api/get-parts.md rename to apps/docs/src/api/endpoints/get-parts.md index 64f714f6e..804936f1a 100644 --- a/apps/docs/src/api/get-parts.md +++ b/apps/docs/src/api/endpoints/get-parts.md @@ -1,7 +1,5 @@ # GetParts -[[toc]] - --- ```typescript @@ -20,7 +18,7 @@ async function GetParts( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetParts.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetParts) ::: ## Description @@ -79,7 +77,7 @@ Any `params` that are not listed in the table above will be ignored. As `params` is optional, it also has type `| boolean`, so you can set `doFetch` without having to pass `undefined` in place of intentionally undefined `params`. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -116,7 +114,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetParts?type=565&fromDate=1/1/2015&toDate=5/5/2015&manufacturer=honda&page=1format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetPartsResults @@ -129,14 +127,16 @@ Objects returned in the `Results` array of `GetParts` endpoint response. ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Parts @@ -161,15 +161,18 @@ const response = await GetParts({ }) ``` -::: warning :bulb: Examples 3-4: +::: tip Examples 3-4: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Get Parts and doFetch = false diff --git a/apps/docs/src/api/get-vehicle-types-for-make-id.md b/apps/docs/src/api/endpoints/get-vehicle-types-for-make-id.md similarity index 86% rename from apps/docs/src/api/get-vehicle-types-for-make-id.md rename to apps/docs/src/api/endpoints/get-vehicle-types-for-make-id.md index 431cd5a87..fdfd27645 100644 --- a/apps/docs/src/api/get-vehicle-types-for-make-id.md +++ b/apps/docs/src/api/endpoints/get-vehicle-types-for-make-id.md @@ -1,7 +1,5 @@ # GetVehicleTypesForMakeId -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetVehicleTypesForMakeId( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetVehicleTypesForMakeId.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetVehicleTypesForMakeId) ::: ## Description @@ -51,7 +49,7 @@ endpoint. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -89,7 +87,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetVehicleTypesForMakeId/449?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetVehicleTypesForMakeIdResults @@ -102,13 +100,13 @@ Objects returned in the `Results` array of `GetVehicleTypesForMakeId` endpoint r ## Examples -::: tip :bulb: Example 1: +::: tip Example 1: ```typescript => Promise> ``` -- Fetches data from VPIC API internally +- Fetches data from VPIC API ::: @@ -120,15 +118,18 @@ import { GetVehicleTypesForMakeId } from '@shaggytools/nhtsa-api-wrapper' const response = await GetVehicleTypesForMakeId(449) ``` -::: warning :bulb: Example 2: +::: tip Example 2: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 2: Get Vehicle Types for Make ID and doFetch = false diff --git a/apps/docs/src/api/get-vehicle-types-for-make.md b/apps/docs/src/api/endpoints/get-vehicle-types-for-make.md similarity index 83% rename from apps/docs/src/api/get-vehicle-types-for-make.md rename to apps/docs/src/api/endpoints/get-vehicle-types-for-make.md index b38f34cc3..aa9fa700e 100644 --- a/apps/docs/src/api/get-vehicle-types-for-make.md +++ b/apps/docs/src/api/endpoints/get-vehicle-types-for-make.md @@ -1,7 +1,5 @@ # GetVehicleTypesForMake -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetVehicleTypesForMake( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetVehicleTypesForMake.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetVehicleTypesForMake) ::: ## Description @@ -34,7 +32,7 @@ whose name is LIKE the make name in the vPIC Dataset. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -72,7 +70,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetVehicleTypesForMake/merc?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetVehicleTypesForMakeResults @@ -85,14 +83,16 @@ Objects returned in the `Results` array of `GetVehicleTypesForMake` endpoint res ## Examples -::: tip :bulb: Example 1: +::: tip Example 1: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Vehicle Types for Make @@ -103,15 +103,18 @@ import { GetVehicleTypesForMake } from '@shaggytools/nhtsa-api-wrapper' const response = await GetVehicleTypesForMake('merc') ``` -::: warning :bulb: Example 2: +::: tip Example 2: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 2: Get Vehicle Types for Make and doFetch = false diff --git a/apps/docs/src/api/get-vehicle-variable-list.md b/apps/docs/src/api/endpoints/get-vehicle-variable-list.md similarity index 82% rename from apps/docs/src/api/get-vehicle-variable-list.md rename to apps/docs/src/api/endpoints/get-vehicle-variable-list.md index 73765f647..3c4aa4ef0 100644 --- a/apps/docs/src/api/get-vehicle-variable-list.md +++ b/apps/docs/src/api/endpoints/get-vehicle-variable-list.md @@ -1,7 +1,5 @@ # GetVehicleVariableList -[[toc]] - --- ```typescript @@ -11,7 +9,7 @@ async function GetVehicleVariableList( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetVehicleVariableList.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetVehicleVariableList) ::: ## Description @@ -29,7 +27,7 @@ vPIC dataset. Information on the name, description and the type of the variable Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -67,7 +65,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/getvehiclevariablelist?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetVehicleVariableListResults @@ -80,14 +78,16 @@ Objects returned in the `Results` array of `GetVehicleVariableList` endpoint res ## Examples -::: tip :bulb: Example 1: +::: tip Example 1: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Vehicle Variable List @@ -98,15 +98,18 @@ import { GetVehicleVariableList } from '@shaggytools/nhtsa-api-wrapper' const response = await GetVehicleVariableList() ``` -::: warning :bulb: Example 2: +::: tip Example 2: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 2: Get Vehicle Variable List and doFetch = false diff --git a/apps/docs/src/api/get-vehicle-variable-values-list.md b/apps/docs/src/api/endpoints/get-vehicle-variable-values-list.md similarity index 86% rename from apps/docs/src/api/get-vehicle-variable-values-list.md rename to apps/docs/src/api/endpoints/get-vehicle-variable-values-list.md index 2fab1982c..2bb68549c 100644 --- a/apps/docs/src/api/get-vehicle-variable-values-list.md +++ b/apps/docs/src/api/endpoints/get-vehicle-variable-values-list.md @@ -1,7 +1,5 @@ # GetVehicleVariableValuesList -[[toc]] - --- ```typescript @@ -12,7 +10,7 @@ async function GetVehicleVariableValuesList( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetVehicleVariableValuesList.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetVehicleVariableValuesList) ::: ## Description @@ -36,7 +34,7 @@ If `variableValue` is a string, it must use full name, not just part of it, e.g. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -74,7 +72,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetVehicleVariableValuesList/battery%20type?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetVehicleVariableValuesListResults @@ -87,14 +85,16 @@ Objects returned in the `Results` array of `GetVehicleVariableValuesList` endpoi ## Examples -::: tip :bulb: Examples 1-2: +::: tip Examples 1-2: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get Vehicle Variable Values List by Name @@ -113,15 +113,18 @@ import { GetVehicleVariableValuesList } from '@shaggytools/nhtsa-api-wrapper' const response = await GetVehicleVariableValuesList(1) ``` -::: warning :bulb: Examples 3-4: +::: tip Examples 3-4: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 3: Get Vehicle Variable Values List by Name and doFetch = false diff --git a/apps/docs/src/api/get-wmis-for-manufacturer.md b/apps/docs/src/api/endpoints/get-wmis-for-manufacturer.md similarity index 91% rename from apps/docs/src/api/get-wmis-for-manufacturer.md rename to apps/docs/src/api/endpoints/get-wmis-for-manufacturer.md index 0d31a8ed2..bd356c8b1 100644 --- a/apps/docs/src/api/get-wmis-for-manufacturer.md +++ b/apps/docs/src/api/endpoints/get-wmis-for-manufacturer.md @@ -1,7 +1,5 @@ # GetWMIsForManufacturer -[[toc]] - --- ```typescript @@ -15,7 +13,7 @@ async function GetWMIsForManufacturer( ``` ::: tip :bulb: More In Depth -See: [Package Reference](../typedoc/modules/api_endpoints_GetWMIsForManufacturer.md) +See: [Package Reference](../../typedoc/modules/api_endpoints_GetWMIsForManufacturer) ::: ## Description @@ -60,7 +58,7 @@ Any `params` that are not listed in the table above will be ignored. Set `doFetch` to `false` if you want to fetch the data yourself. -- See [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +- See [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) for more info. ::: @@ -98,7 +96,7 @@ Returns a URL string that can be used to fetch the data, does _not_ fetch the da // ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetVehicleVariableValuesList/battery%20type?format=json' ``` -::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) +::: tip :bulb: See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) ::: ## Type - GetWMIsForManufacturerResults @@ -111,14 +109,16 @@ Objects returned in the `Results` array of `GetWMIsForManufacturer` endpoint res ## Examples -::: tip :bulb: Examples 1-3: +::: tip Examples 1-3: + +- Fetches data from VPIC API + +- Returns: ```typescript => Promise> ``` -- Fetches data from VPIC API internally - ::: ### Example 1: Get WMIs for Manufacturer @@ -148,15 +148,18 @@ const response = await GetWMIsForManufacturer({ }) ``` -::: warning :bulb: Examples 4-6: +::: tip Examples 4-6: + +- Does _NOT_ fetch data from VPIC API + +- See: [BYOF - Bring Your Own Fetch](../../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) + +- Returns: ```typescript => Promise ``` -- Does _NOT_ fetch data from VPIC API internally -- See: [BYOF - Bring Your Own Fetch](../guide/bring-your-own-fetch.md#option-1-set-dofetch-to-false) - ::: ### Example 4: Get WMIs for Manufacturer and doFetch = false diff --git a/apps/docs/src/api/endpoints/index.md b/apps/docs/src/api/endpoints/index.md new file mode 100644 index 000000000..b9abeab4b --- /dev/null +++ b/apps/docs/src/api/endpoints/index.md @@ -0,0 +1,35 @@ +# VPIC API Helper Functions + +--- + +There are a total of 24 endpoints available in the VPIC API. Each endpoint returns +a different set of data and has different required inputs. + +## VPIC API Endpoints + +- [DecodeVin](./decode-vin) +- [DecodeVinExtended](./decode-vin-extended) +- [DecodeVinValues](./decode-vin-values) +- [DecodeVinValuesBatch](./decode-vin-values-batch) +- [DecodeVinValuesExtended](./decode-vin-values-extended) +- [DecodeWMI](./decode-wmi) +- [GetAllMakes](./get-all-makes) +- [GetAllManufacturers](./get-all-manufacturers) +- [GetCanadianVehicleSpecifications](./get-canadian-vehicle-specifications) +- [GetEquipmentPlantCodes](./get-equipment-plant-codes) +- [GetMakeForManufacturer](./get-make-for-manufacturer) +- [GetMakesForManufacturerAndYear](./get-makes-for-manufacturer-and-year) +- [GetMakesForVehicleType](./get-makes-for-vehicle-type) +- [GetManufacturerDetails](./get-manufacturer-details) +- [GetModelsForMake](./get-models-for-make) +- [GetModelsForMakeId](./get-models-for-make-id) +- [GetModelsForMakeIdYear](./get-models-for-make-id-year) +- [GetModelsForMakeYear](./get-models-for-make-year) +- [GetParts](./get-parts) +- [GetVehicleTypesForMake](./get-vehicle-types-for-make) +- [GetVehicleTypesForMakeId](./get-vehicle-types-for-make-id) +- [GetVehicleVariableList](./get-vehicle-variable-list) +- [GetVehicleVariableValuesList](./get-vehicle-variable-values-list) +- [GetWMIsForManufacturer](./get-wmis-for-manufacturer) + + diff --git a/apps/docs/src/api/index.md b/apps/docs/src/api/index.md index 584b134c3..90c9af462 100644 --- a/apps/docs/src/api/index.md +++ b/apps/docs/src/api/index.md @@ -2,68 +2,38 @@ --- -This section of the documentation describes the functions exported by this package, as well as the -response format returned by the NHTSA API. Also includes details of the NHTSA API endpoints and -what they return. +This section of the documentation describes the main functions exported by this package, as well as +the response format returned by the NHTSA API. + +You can also find details of the VPIC API endpoints and what they return. ## VPIC API Response -- [VPIC API Response](../api/vpic-api-response.md) +- [VPIC API Response](../api/vpic-api-response) ## VPIC API Endpoints -- [DecodeVin](../api/decode-vin.md) -- [DecodeVinExtended](../api/decode-vin-extended.md) -- [DecodeVinValues](../api/decode-vin-values.md) -- [DecodeVinValuesBatch](../api/decode-vin-values-batch.md) -- [DecodeVinValuesExtended](../api/decode-vin-values-extended.md) -- [DecodeWMI](../api/decode-wmi.md) -- [GetAllMakes](../api/get-all-makes.md) -- [GetAllManufacturers](../api/get-all-manufacturers.md) -- [GetCanadianVehicleSpecifications](../api/get-canadian-vehicle-specifications.md) -- [GetEquipmentPlantCodes](../api/get-equipment-plant-codes.md) -- [GetMakeForManufacturer](../api/get-make-for-manufacturer.md) -- [GetMakesForManufacturerAndYear](../api/get-makes-for-manufacturer-and-year.md) -- [GetMakesForVehicleType](../api/get-makes-for-vehicle-type.md) -- [GetManufacturerDetails](../api/get-manufacturer-details.md) -- [GetModelsForMake](../api/get-models-for-make.md) -- [GetModelsForMakeId](../api/get-models-for-make-id.md) -- [GetModelsForMakeIdYear](../api/get-models-for-make-id-year.md) -- [GetModelsForMakeYear](../api/get-models-for-make-year.md) -- [GetParts](../api/get-parts.md) -- [GetVehicleTypesForMake](../api/get-vehicle-types-for-make.md) -- [GetVehicleTypesForMakeId](../api/get-vehicle-types-for-make-id.md) -- [GetVehicleVariableList](../api/get-vehicle-variable-list.md) -- [GetVehicleVariableValuesList](../api/get-vehicle-variable-values-list.md) -- [GetWMIsForManufacturer](../api/get-wmis-for-manufacturer.md) - -## All Exported VPIC API Functions - -```javascript -import { - DecodeVin, - DecodeVinExtended, - DecodeVinValues, - DecodeVinValuesBatch, - DecodeVinValuesExtended, - DecodeWMI, - GetAllMakes, - GetAllManufacturers, - GetCanadianVehicleSpecifications, - GetEquipmentPlantCodes, - GetMakeForManufacturer, - GetMakesForManufacturerAndYear, - GetMakesForVehicleType, - GetManufacturerDetails, - GetModelsForMake, - GetModelsForMakeId, - GetModelsForMakeIdYear, - GetModelsForMakeYear, - GetParts, - GetVehicleTypesForMake, - GetVehicleTypesForMakeId, - GetVehicleVariableList, - GetVehicleVariableValuesList, - GetWMIsForManufacturer, -} from '@shaggytools/nhtsa-api-wrapper' -``` +- [DecodeVin](../api/endpoints/decode-vin) +- [DecodeVinExtended](../api/endpoints/decode-vin-extended) +- [DecodeVinValues](../api/endpoints/decode-vin-values) +- [DecodeVinValuesBatch](../api/endpoints/decode-vin-values-batch) +- [DecodeVinValuesExtended](../api/endpoints/decode-vin-values-extended) +- [DecodeWMI](../api/endpoints/decode-wmi) +- [GetAllMakes](../api/endpoints/get-all-makes) +- [GetAllManufacturers](../api/endpoints/get-all-manufacturers) +- [GetCanadianVehicleSpecifications](../api/endpoints/get-canadian-vehicle-specifications) +- [GetEquipmentPlantCodes](../api/endpoints/get-equipment-plant-codes) +- [GetMakeForManufacturer](../api/endpoints/get-make-for-manufacturer) +- [GetMakesForManufacturerAndYear](../api/endpoints/get-makes-for-manufacturer-and-year) +- [GetMakesForVehicleType](../api/endpoints/get-makes-for-vehicle-type) +- [GetManufacturerDetails](../api/endpoints/get-manufacturer-details) +- [GetModelsForMake](../api/endpoints/get-models-for-make) +- [GetModelsForMakeId](../api/endpoints/get-models-for-make-id) +- [GetModelsForMakeIdYear](../api/endpoints/get-models-for-make-id-year) +- [GetModelsForMakeYear](../api/endpoints/get-models-for-make-year) +- [GetParts](../api/endpoints/get-parts) +- [GetVehicleTypesForMake](../api/endpoints/get-vehicle-types-for-make) +- [GetVehicleTypesForMakeId](../api/endpoints/get-vehicle-types-for-make-id) +- [GetVehicleVariableList](../api/endpoints/get-vehicle-variable-list) +- [GetVehicleVariableValuesList](../api/endpoints/get-vehicle-variable-values-list) +- [GetWMIsForManufacturer](../api/endpoints/get-wmis-for-manufacturer) diff --git a/apps/docs/src/api/vpic-api-response.md b/apps/docs/src/api/vpic-api-response.md index 13284e9a5..95286128f 100644 --- a/apps/docs/src/api/vpic-api-response.md +++ b/apps/docs/src/api/vpic-api-response.md @@ -134,7 +134,7 @@ type NhtsaApiResponse = { Check out the [Api Reference](/api/) section for specific details on each endpoint's `Results` array types. -Here's [DecodeVinResults](../api/decode-vin#type-decodevinresults) that was mentioned in the above +Here's [DecodeVinResults](../api/endpoints/decode-vin#type-decodevinresults) that was mentioned in the above example. ::: diff --git a/apps/docs/src/guide/bring-your-own-fetch.md b/apps/docs/src/guide/bring-your-own-fetch.md index ad50bbe31..5b76588f5 100644 --- a/apps/docs/src/guide/bring-your-own-fetch.md +++ b/apps/docs/src/guide/bring-your-own-fetch.md @@ -6,25 +6,11 @@ yourself. This package can be used in "_URL Builder_ mode", which means you can use the endpoint helper functions to get the full API endpoint URL string, but skip the `fetch` request. - ::: ---- - -[[toc]] - ## Alternate Use of This Package -There are two ways to use this package in _URL Builder_ mode: - -- [Option 1](#option-1-set-dofetch-to-false) (recommended): - Use the endpoint helper functions (DecodeVin, etc.), but pass `false` as the last - argument of the function to skip internal use of `fetch` and instead return the full VPIC url - string to use how you want. - -- [Option 2](#option-2-using-createurl): - Use the `createUrl` function. You can use it to build a custom VPIC url with any endpoint name, - path, or query params. +There are two ways to use this package as a "_URL Builder_" for the VPIC API. Either option is useful: @@ -36,6 +22,15 @@ Either option is useful: You'll still get automatic query string building, encoding, and `format=json` appended to the URL or body string, but fetching is left up to you. +- [Option 1](#option-1-set-dofetch-to-false) (recommended): + Use the endpoint helper functions (DecodeVin, etc.), but pass `false` as the last + argument of the function to skip internal use of `fetch` and instead return the full VPIC url + string to use how you want. + +- [Option 2](#option-2-using-createurl): + The `useNHTSA` composable function. You can use it to build a custom VPIC url with any endpoint name, + path, or query params. + ::: tip RELATED: - [This Package Uses Native Fetch](../guide/native-fetch.md#this-package-uses-native-fetch) @@ -99,12 +94,12 @@ GetAllManufacturers(undefined, false) // [!code --] GetAllManufacturers(false) // [!code ++] ``` -## Option 2: Using `createUrl` +## Option 2: Using `useNHTSA` Another alternative is a composable function this package exports called `useNHTSA`, which returns an object of helper functions to interact with the API. -Use `createUrl` to get the URL string based on the endpoint name, path, and params. Then use your +Use `useNHTSA.createUrl` to get the URL string based on the endpoint name, path, and params. Then use your own fetch implementation to make the request. See [Using createUrl With GET](#using-with-get-endpoints). @@ -131,25 +126,25 @@ build the request body properly formatted for the API. See [Using createUrl With POST](#using-with-post-endpoints) for more info. There are other helper functions exported by `useNHTSA` but you don't need to use them in this case. -The other available functions are `get`, `post`, `cacheUrl`, and `getCachedUrl`. +The other available functions are `get`, `post`, `createCachedUrl`, and `getCachedUrl`. ### Caveats Using it this way won't make the request for you, nor will it handle the path and params in a smart and consistent way such as when using one of the endpoint methods directly (DecodeVin, etc.). -You will need to have some knowledge of the NHTSA API url structure because each endpoint has a +You will need to have some knowledge of the VPIC API url structure because each endpoint has a different `path` and required/optional `params`. You can see url examples for each endpoint in the -[NHTSA API docs](https://vpic.nhtsa.dot.gov/api/). Also, in the source code of this package, each -endpoint function is documented and typed if you need help with the path and params structure for -each. +[official VPIC docs](https://vpic.nhtsa.dot.gov/api/). The documentation for this package also +includes examples of each endpoint and their required/optional params as well as what each final +url will look like. ::: tip This is why method #1 described above is recommended over this one. It simplifies all of this for you and still ensures runtime type safety and consistency with the VPIC API. ::: -### In Depth +### Options Here are the CreateUrlOptions for `createUrl`: @@ -161,7 +156,7 @@ Here are the CreateUrlOptions for `createUrl`: - `includeQueryString` - If true, the query string will be included in the url (default: true) - `saveUrl` - If true, the url will be cached in the composable instance (default: true) -#### Using With GET Endpoints +### Using With GET Endpoints Here's a simplified example of retrieving data from the NHTSA API using this package as a URL builder ONLY. This example uses axios as the fetch implementation, but you can use any fetch @@ -170,7 +165,7 @@ the URL string from this package and then use your own fetch implementation to m Example (using `axios` as the `fetch` implementation): -```javascript{8,9,10,11,12,13,14} +```javascript import { useNHTSA } from '@shaggytools/nhtsa-api-wrapper' import axios from 'axios' // or any other fetch implementation @@ -181,7 +176,7 @@ const { createUrl } = useNHTSA() const url = createUrl({ endpointName: 'DecodeVin', path: 'WA1A4AFY2J2008189', - params: { modelYear: 2018 } + params: { modelYear: 2018 }, }) // url = 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVin/WA1A4AFY2J2008189?modelYear=2018&format=json' @@ -189,6 +184,8 @@ const url = createUrl({ const results = await axios.get(url) ``` +--- + To explain the above example: - `endpointName` @@ -216,30 +213,36 @@ To explain the above example: In this example `path` is the VIN you are searching. Each endpoint is different, so you will need to know the path for each. You can see examples of the paths for each - endpoint in the [NHTSA API docs](https://vpic.nhtsa.dot.gov/api/). Path is the last part of the + endpoint in the [VPIC API docs](https://vpic.nhtsa.dot.gov/api/). Path is the last part of the url path, before the query string. -- ```javascript - const url = createUrl({ - endpointName: 'DecodeVin', - path: 'WA1A4AFY2J2008189', - params: { modelYear: 2018 }, // [!code focus] - }) - ``` +- `params` - The `params` are query string parameters to use for the endpoint, in this case `modelYear=2011`. - Keep in mind, `params` will be unique to each endpoint, some have required params, some have none. +```javascript +const url = createUrl({ + endpointName: 'DecodeVin', + path: 'WA1A4AFY2J2008189', + params: { modelYear: 2018 }, // [!code focus] +}) +``` -- ```javascript - ㅤ - url = - 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVin/WA1A4AFY2J2008189?modelYear=2018&format=json' +The `params` are query string parameters to use for the endpoint, in this case `modelYear=2011`. +Keep in mind, `params` will be unique to each endpoint, some have required params, some have none. - const results = await axios.get(url) - ``` +--- + +All of the above will result in the following url: + +```javascript +ㅤ +url = + 'https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVin/WA1A4AFY2J2008189?modelYear=2018&format=json' + +const results = await axios.get(url) +``` - The return from `createUrl` will be a full url string similar to the one above. You can then use - your own fetch implementation to make the request. In this example, we use axios. +The return from `createUrl` will be a full url string similar to the one above. You can then use +your own fetch implementation to make the request. In this example, we use axios. Some additional things to note: @@ -249,35 +252,39 @@ Some additional things to note: - If the endpoint doesn't require a `path` or `params` you can omit those keys and just provide `endpointName`. -- You could also get the base url for the VPIC API this way, just use `{ endpointName: "" }`. This - will return the base url for the VPIC API. - -#### Using with POST Endpoints - -Note that POST requests to the NHTSA API requires body to be a string and certain headers set. -The endpoint functions would handle this for you automatically, but if you use createUrl() to get -the URL string and then use your own fetch implementation, you will need to handle this yourself. +### Using with POST Endpoints ::: tip :bulb: TIP `DecodeVinValuesBatch` is the only endpoint that uses a POST request. ::: -Here is a simplified example of how to make a POST request with your own fetch implementation: +VPIC POST requests require the post body to be a specially formatted string and certain headers set. +The helper functions (DecodeVinValuesBatch) would handle this for you automatically, but if you use +createUrl() to get the URL string and then use your own fetch implementation, you will need to +handle this yourself. + +Here is a simplified example of how to make a POST request with your own fetch implementation. -```javascript{7,9,11,12,13} +The differences between this example and the GET example above are highlighted below. + +```javascript{4,8,11,14,15,16,19} import { useNHTSA } from '@shaggytools/nhtsa-api-wrapper' import axios from 'axios' const { createUrl, createPostBody } = useNHTSA() + const url = createUrl({ endpointName: 'DecodeVinValuesBatch', includeQueryString: false }) + const body = createPostBody('5UXWX7C5*BA; 5UXWX7C5*BB') // body = "DATA=5UXWX7C5*BA;%205UXWX7C5*BB&format=json " + const headers = { 'Content-Type': 'application/x-www-form-urlencoded' } + // use your own fetch implementation to make the POST request, axios in this example const response = await axios.post(url, body, { headers }) ``` @@ -285,18 +292,21 @@ const response = await axios.post(url, body, { headers }) It requires a few things: - Create the URL string with `createUrl()` and set `includeQueryString: false` + - Create the POST body with `createPostBody()`, you should give it a string as described in the `DecodeVinValuesBatch` documentation of this package. + - Set the Content-Type header to `application/x-www-form-urlencoded` + - Use your own fetch implementation to make the request, axios in this example -Using `createPostBody` to create the body string will append `'&format=json'`, which is required for +When using `createUrl` in this way for a POST request, you should set `includeQueryString = false`. +This is so that `'&format=json'` will _NOT_ be included in the params, and thus in the url query +string, which would cause the POST request to error. + +Using `createPostBody` will append `'&format=json'` to the final body string, which is required for POST requests to respond in JSON format. It will also perform `encodeURI()` on the body string to ensure it is encoded properly for the request. -When using `createUrl` in this way for a POST request, you should set `includeQueryString: false` so -that `'&format=json'` will _not_ be included in the params, and subsequently in a query string, -which would cause the POST request to fail. - Both of the above are handled for you when using the endpoint methods directly, such as `DecodeVinValuesBatch()`. diff --git a/apps/docs/src/guide/getting-started.md b/apps/docs/src/guide/getting-started.md index 84d850aee..a2f34d66d 100644 --- a/apps/docs/src/guide/getting-started.md +++ b/apps/docs/src/guide/getting-started.md @@ -1,7 +1,5 @@ # Getting Started -[[toc]] - --- ::: warning 🔞 WARNING diff --git a/apps/docs/src/guide/index.md b/apps/docs/src/guide/index.md index a166edf4a..5e19eb060 100644 --- a/apps/docs/src/guide/index.md +++ b/apps/docs/src/guide/index.md @@ -2,7 +2,18 @@ --- -[[toc]] +## Features + +✔️ A thin Javascript client for the [NHTSA VPIC API](https://vpic.nhtsa.dot.gov/api/) + +✔️ Includes a set of helper functions to retrieve data from each of the +[24 VPIC API endpoints](../api/index.md#vpic-api-endpoints) + +✔️ A helper composable function (`useNHTSA`) with tools to interact with the VPIC API at a lower +level. See [useNHTSA](../utils/use-nhtsa-composable.md) + +✔️ Built with TypeScript support in mind. Get full type hints and code +completion. API responses are [fully typed](../guide/typescript.md#nhtsa-api-response-types) ## Overview @@ -13,26 +24,12 @@ It's a thin javascript 'wrapper' or 'client' around the VPIC API. Included are h make interacting with the API and retrieving data less of a chore. You can take a look at the [NHTSA VPIC API Docs](https://vpic.nhtsa.dot.gov/api/) for more -information. - -## Features - -✔️ A set of helper functions to retrieve data from each of the 24 API endpoints. -See: [TODO - NHTSA Endpoints](#nhtsa-api-endpoints) - -✔️ A helper composable function with tools to interact with the VPIC API at a lower level. -See [TODO - useNHTSA](#useNHTSA) - -✔️ All functions and endpoints are typed with TypeScript and have full type hints and code -completion in your IDE. See [NHTSA API Response Types](../guide/typescript.md#nhtsa-api-response-types) - -✔️ Built in runtime type-checking and error handling for all functions, so you can be sure -you'll get back a valid response from the VPIC API. See [TODO - Error Handling](#error-handling) +information on the API itself. ## What is the NHTSA VPIC API? ::: tip :bulb: TIP -When this documentation mentions "API endpoints" it's referring to the 24 `Actions` listed in +When this documentation mentions API "Endpoints" it's referring to the 24 `Methods` listed in the [VPIC API Docs](https://vpic.nhtsa.dot.gov/api/). ::: @@ -41,7 +38,7 @@ The VPIC API is primarily used for decoding useful information from a Vehicle Id (VIN) in the United States and Canada. It can also be used to get all models of a make, to decode WMIs, get all makes for a certain year, and more. -A list of all 24 VPIC endpoints can be found in the [TODO - NHTSA API Endpoints](#nhtsa-api-endpoints) +A list of all 24 VPIC endpoints can be found in the [NHTSA API Endpoints](../api/index.md#vpic-api-endpoints) section. The best part about the VPIC API is that it's free and doesn't require an API key 👍🏽. The diff --git a/apps/docs/src/guide/native-fetch.md b/apps/docs/src/guide/native-fetch.md index bd8e40cd3..c802f068b 100644 --- a/apps/docs/src/guide/native-fetch.md +++ b/apps/docs/src/guide/native-fetch.md @@ -2,10 +2,6 @@ --- -[[toc]] - ---- - ::: warning IMPORTANT This section is likely only applicable if using this package in Node versions < 18 and very old browsers. @@ -118,15 +114,15 @@ From then on, you're free to use the package as you see fit. ## Why no bundled polyfill? -Starting with Node 18, the native Fetch API is available as a built-in function. This means you no -longer need a polyfill to use `fetch()` natively in Node. +Because we are not providing an internal polyfill, there are no external dependencies that this +package relies on and therefore the package size can stay small. Before Node 18 you had to use a polyfill like [node-fetch](https://www.npmjs.com/package/node-fetch) or [cross-fetch](https://www.npmjs.com/package/cross-fetch), otherwise Node would see `fetch()` as an undefined function. -Because we are not providing an internal polyfill, there are no external dependencies that this -package relies on and therefore the package size can stay small. +Starting with Node 18, the native Fetch API is available as a built-in function. This means you no +longer need a polyfill to use `fetch()` natively in Node. This package recently went through a major refactor to be more modern and tree-shakeable. This was the perfect time to "modernize" the codebase and remove the polyfill. The resulting package size is diff --git a/apps/docs/src/guide/typescript.md b/apps/docs/src/guide/typescript.md index daa546f7f..0456b9ad4 100644 --- a/apps/docs/src/guide/typescript.md +++ b/apps/docs/src/guide/typescript.md @@ -1,7 +1,5 @@ # Typescript Support -[[toc]] - --- This package is designed for full typescript support and bundles it's own types. Types can be found diff --git a/apps/docs/src/index.md b/apps/docs/src/index.md index 5b46e4b02..7bbb4aafd 100644 --- a/apps/docs/src/index.md +++ b/apps/docs/src/index.md @@ -17,12 +17,9 @@ hero: - theme: brand text: Learn More link: /guide/ - - theme: brand - text: Getting Started - link: /guide/getting-started - theme: alt - text: View on GitHub - link: https://github.com/shaggytech/nhtsa-api-wrapper + text: VPIC Helper Functions + link: /api/ features: - title: Simplify the VPIC API diff --git a/apps/docs/src/parts/package-exports-endpoint-functions.md b/apps/docs/src/parts/package-exports-endpoint-functions.md new file mode 100644 index 000000000..b16c17f46 --- /dev/null +++ b/apps/docs/src/parts/package-exports-endpoint-functions.md @@ -0,0 +1,37 @@ +## Exported VPIC Endpoint Functions + +The following demonstrates how to import all of the VPIC endpoint functions from this package. + +::: tip :bulb: TIP +Although they are all imported at once in this example, you should import only the functions you are +using. +::: + +```javascript +import { + DecodeVin, + DecodeVinExtended, + DecodeVinValues, + DecodeVinValuesBatch, + DecodeVinValuesExtended, + DecodeWMI, + GetAllMakes, + GetAllManufacturers, + GetCanadianVehicleSpecifications, + GetEquipmentPlantCodes, + GetMakeForManufacturer, + GetMakesForManufacturerAndYear, + GetMakesForVehicleType, + GetManufacturerDetails, + GetModelsForMake, + GetModelsForMakeId, + GetModelsForMakeIdYear, + GetModelsForMakeYear, + GetParts, + GetVehicleTypesForMake, + GetVehicleTypesForMakeId, + GetVehicleVariableList, + GetVehicleVariableValuesList, + GetWMIsForManufacturer, +} from '@shaggytools/nhtsa-api-wrapper' +``` diff --git a/apps/docs/src/parts/package-exports-types.md b/apps/docs/src/parts/package-exports-types.md new file mode 100644 index 000000000..b368395dd --- /dev/null +++ b/apps/docs/src/parts/package-exports-types.md @@ -0,0 +1,62 @@ +## Types This Package Exports + +::: tip :bulb: INFO +All types used by this package can be found in the [Typedoc Section](../typedoc/modules/types). +::: + +Each endpoint function returns a `NhtsaResponse` object where `T` is one of the `Results` types +listed below. + +For example, the `DecodeVin` endpoint returns `NhtsaResponse`. +The `Results` key in the returned object contains the actual relevant data returned by the API. +The number of objects and structure of of the `Results` depends on the endpoint you're using. + +```javascript +import type { + NhtsaResponse, // full response object returned by the VPIC API + + // Results + DecodeVinResults, + DecodeVinExtendedResults, + DecodeVinValuesResults, + DecodeVinValuesBatchResults, + DecodeVinValuesExtendedResults, + DecodeWMIResults, + GetAllMakesResults, + GetAllManufacturersResults, + GetCanadianVehicleSpecificationsResults, + GetEquipmentPlantCodesResults, + GetMakeForManufacturerResults, + GetMakesForManufacturerAndYearResults, + GetMakesForVehicleTypeResults, + GetManufacturerDetailsResults, + GetModelsForMakeResults, + GetModelsForMakeIdResults, + GetModelsForMakeIdYearResults, + GetModelsForMakeYearResults, + GetPartsResults, + GetVehicleTypesForMakeResults, + GetVehicleTypesForMakeIdResults, + GetVehicleVariableListResults, + GetVehicleVariableValuesListResults, + GetWMIsForManufacturerResults, + + // possible string values for results Variables + DecodeVinVariable, + DecodeVinExtendedVariable, + + // useNHTSA + CreateUrlOptions, + + // Query String (internal) + QueryStringParams, + QueryStringParamsEncoded, + QueryStringTypes, +} from '@shaggytools/nhtsa-api-wrapper' +``` + +::: tip :bulb: TIP +You can find specific details on each endpoint's `Results` types on their respective pages. + +See [DecodeVinResults](../api/endpoints/decode-vin#type-decodevinresults) for example. +::: diff --git a/apps/docs/src/parts/package-exports-utility-functions.md b/apps/docs/src/parts/package-exports-utility-functions.md new file mode 100644 index 000000000..8f524c4a7 --- /dev/null +++ b/apps/docs/src/parts/package-exports-utility-functions.md @@ -0,0 +1,15 @@ +## Exported Utility Functions + +The following demonstrates how to import all of the VPIC utility functions from this package. + +::: tip :bulb: TIP +Although they are all imported at once in this example, you should import only the functions you are +using. +::: + +```javascript +import { + isValidVin, // function for offline VIN validation + useNHTSA, // composable function returning helper functions for the VPIC API +} from '@shaggytools/nhtsa-api-wrapper' +``` diff --git a/apps/docs/src/public/favicon.png b/apps/docs/src/public/favicon.png new file mode 100644 index 000000000..93f48ae0f Binary files /dev/null and b/apps/docs/src/public/favicon.png differ diff --git a/apps/docs/src/public/hero.png b/apps/docs/src/public/hero.png new file mode 100644 index 000000000..6a9b22607 Binary files /dev/null and b/apps/docs/src/public/hero.png differ diff --git a/apps/docs/src/public/robots.txt b/apps/docs/src/public/robots.txt new file mode 100644 index 000000000..90c1e48a1 --- /dev/null +++ b/apps/docs/src/public/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Allow: / + +Sitemap: https://vpic.shaggytech.com/sitemap.xml \ No newline at end of file diff --git a/apps/docs/src/snippets/endpoints/index.ts b/apps/docs/src/snippets/endpoints/index.ts deleted file mode 100644 index c36697d56..000000000 --- a/apps/docs/src/snippets/endpoints/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './decode-vin' diff --git a/apps/docs/src/typedoc/index.md b/apps/docs/src/typedoc/index.md index 873ed5910..f76a11475 100644 --- a/apps/docs/src/typedoc/index.md +++ b/apps/docs/src/typedoc/index.md @@ -1,4 +1,4 @@ -@shaggytools/nhtsa-api-wrapper - v3.0.2 / [Exports](modules.md) +@shaggytools/nhtsa-api-wrapper / [Exports](modules.md) ::: tip :bulb: Auto-generated By TypeDoc from package source code ::: diff --git a/apps/docs/src/typedoc/modules.md b/apps/docs/src/typedoc/modules.md index 19192f105..ff781e5b6 100644 --- a/apps/docs/src/typedoc/modules.md +++ b/apps/docs/src/typedoc/modules.md @@ -1,6 +1,6 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](index.md) / Exports +[@shaggytools/nhtsa-api-wrapper](index.md) / Exports -# @shaggytools/nhtsa-api-wrapper - v3.0.2 +# @shaggytools/nhtsa-api-wrapper ## Table of contents @@ -42,6 +42,7 @@ - [constants](modules/constants.md) - [global](modules/global.md) - [index](modules/index.md) +- [vite-env](modules/vite_env.md) ### Types Modules diff --git a/apps/docs/src/typedoc/modules/api.md b/apps/docs/src/typedoc/modules/api.md index f703997a1..66e74905d 100644 --- a/apps/docs/src/typedoc/modules/api.md +++ b/apps/docs/src/typedoc/modules/api.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api # Module: api diff --git a/apps/docs/src/typedoc/modules/api_endpoints.md b/apps/docs/src/typedoc/modules/api_endpoints.md index 8fa99fb63..7891149e9 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints.md +++ b/apps/docs/src/typedoc/modules/api_endpoints.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints # Module: api/endpoints diff --git a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVin.md b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVin.md index bd390dbed..7eada71dd 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVin.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVin.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVin +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVin # Module: api/endpoints/DecodeVin @@ -20,7 +20,7 @@ ▸ **DecodeVin**(`vin`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`DecodeVinResults`](api_endpoints_DecodeVin.md#decodevinresults)\>\> ::: tip :bulb: More Information -See: [DecodeVin Documentation](/api/decode-vin) +See: [DecodeVin Documentation](/api/endpoints/decode-vin) ::: `DecodeVin` decodes a Vehicle Identification Number (VIN) and returns useful information about diff --git a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinExtended.md b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinExtended.md index 48b48a42c..a72af4029 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinExtended.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinExtended.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinExtended +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinExtended # Module: api/endpoints/DecodeVinExtended @@ -20,7 +20,7 @@ ▸ **DecodeVinExtended**(`vin`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`DecodeVinExtendedResults`](api_endpoints_DecodeVinExtended.md#decodevinextendedresults)\>\> ::: tip :bulb: More Information -See: [DecodeVinExtended Documentation](/api/decode-vin-extended) +See: [DecodeVinExtended Documentation](/api/endpoints/decode-vin-extended) ::: `DecodeVinExtended` decodes a Vehicle Identification Number (VIN) and returns useful information diff --git a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValues.md b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValues.md index 3653ba4e4..f278a7254 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValues.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValues.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinValues +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinValues # Module: api/endpoints/DecodeVinValues @@ -20,7 +20,7 @@ ▸ **DecodeVinValues**(`vin`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`DecodeVinValuesResults`](api_endpoints_DecodeVinValues.md#decodevinvaluesresults)\>\> ::: tip :bulb: More Information -See: [DecodeVinValues Documentation](/api/decode-vin-values) +See: [DecodeVinValues Documentation](/api/endpoints/decode-vin-values) ::: `DecodeVinValues` decodes a Vehicle Identification Number (VIN) and returns useful information diff --git a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesBatch.md b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesBatch.md index 7b8bf967b..3c5ff3c78 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesBatch.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesBatch.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinValuesBatch +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinValuesBatch # Module: api/endpoints/DecodeVinValuesBatch @@ -19,7 +19,7 @@ ▸ **DecodeVinValuesBatch**(`inputString`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`DecodeVinValuesBatchResults`](api_endpoints_DecodeVinValuesBatch.md#decodevinvaluesbatchresults)\>\> ::: tip :bulb: More Information -See: [DecodeVinValuesBatch Documentation](/api/decode-vin-values-batch) +See: [DecodeVinValuesBatch Documentation](/api/endpoints/decode-vin-values-batch) ::: `DecodeVinValuesBatch` decodes a batch of Vehicle Identification Numbers (VINs) and returns diff --git a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesExtended.md b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesExtended.md index 22f780d9b..81d979ec6 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesExtended.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_DecodeVinValuesExtended.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinValuesExtended +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeVinValuesExtended # Module: api/endpoints/DecodeVinValuesExtended @@ -19,7 +19,7 @@ ▸ **DecodeVinValuesExtended**(`vin`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`DecodeVinValuesExtendedResults`](api_endpoints_DecodeVinValuesExtended.md#decodevinvaluesextendedresults)\>\> ::: tip :bulb: More Information -See: [DecodeVinValuesExtended Documentation](/api/decode-vin-values-extended) +See: [DecodeVinValuesExtended Documentation](/api/endpoints/decode-vin-values-extended) ::: `DecodeVinValuesExtended` decodes a Vehicle Identification Number (VIN) and returns useful diff --git a/apps/docs/src/typedoc/modules/api_endpoints_DecodeWMI.md b/apps/docs/src/typedoc/modules/api_endpoints_DecodeWMI.md index 65a94613a..88e365d44 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_DecodeWMI.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_DecodeWMI.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeWMI +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/DecodeWMI # Module: api/endpoints/DecodeWMI @@ -19,7 +19,7 @@ ▸ **DecodeWMI**(`WMI`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`DecodeWMIResults`](api_endpoints_DecodeWMI.md#decodewmiresults)\>\> ::: tip :bulb: More Information -See: [DecodeWMI Documentation](/api/decode-wmi) +See: [DecodeWMI Documentation](/api/endpoints/decode-wmi) ::: `DecodeWMI` provides information on the World Manufacturer Identifier for a specific `WMI` code. diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetAllMakes.md b/apps/docs/src/typedoc/modules/api_endpoints_GetAllMakes.md index 42ecc5547..7ddd07b62 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetAllMakes.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetAllMakes.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetAllMakes +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetAllMakes # Module: api/endpoints/GetAllMakes @@ -19,7 +19,7 @@ ▸ **GetAllMakes**(`doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetAllMakesResults`](api_endpoints_GetAllMakes.md#getallmakesresults)\>\> ::: tip :bulb: More Information -See: [GetAllMakes Documentation](/api/get-all-makes) +See: [GetAllMakes Documentation](/api/endpoints/get-all-makes) ::: `GetAllMakes` provides a list of all the Makes available in the vPIC Dataset. diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetAllManufacturers.md b/apps/docs/src/typedoc/modules/api_endpoints_GetAllManufacturers.md index 0b792297b..b077311ac 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetAllManufacturers.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetAllManufacturers.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetAllManufacturers +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetAllManufacturers # Module: api/endpoints/GetAllManufacturers @@ -19,7 +19,7 @@ ▸ **GetAllManufacturers**(`doFetch?`, `_dummy?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetAllManufacturersResults`](api_endpoints_GetAllManufacturers.md#getallmanufacturersresults)\>\> ::: tip :bulb: More Information -See: [GetAllManufacturers Documentation](/api/get-all-manufacturers) +See: [GetAllManufacturers Documentation](/api/endpoints/get-all-manufacturers) ::: `GetAllManufacturers` provides a list of all the Manufacturers available in the vPIC Dataset. diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetCanadianVehicleSpecifications.md b/apps/docs/src/typedoc/modules/api_endpoints_GetCanadianVehicleSpecifications.md index 94f899e56..d9c603071 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetCanadianVehicleSpecifications.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetCanadianVehicleSpecifications.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetCanadianVehicleSpecifications +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetCanadianVehicleSpecifications # Module: api/endpoints/GetCanadianVehicleSpecifications @@ -19,7 +19,7 @@ ▸ **GetCanadianVehicleSpecifications**(`params`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetCanadianVehicleSpecificationsResults`](api_endpoints_GetCanadianVehicleSpecifications.md#getcanadianvehiclespecificationsresults)\>\> ::: tip :bulb: More Information -See: [GetCanadianVehicleSpecifications Documentation](/api/get-canadian-vehicle-specifications) +See: [GetCanadianVehicleSpecifications Documentation](/api/endpoints/get-canadian-vehicle-specifications) ::: `GetCanadianVehicleSpecifications` returns data from the Canadian Vehicle Specifications (CVS). diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetEquipmentPlantCodes.md b/apps/docs/src/typedoc/modules/api_endpoints_GetEquipmentPlantCodes.md index 009b15742..7c8bc5fb1 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetEquipmentPlantCodes.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetEquipmentPlantCodes.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetEquipmentPlantCodes +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetEquipmentPlantCodes # Module: api/endpoints/GetEquipmentPlantCodes @@ -20,7 +20,7 @@ ▸ **GetEquipmentPlantCodes**(`params`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetEquipmentPlantCodesResults`](api_endpoints_GetEquipmentPlantCodes.md#getequipmentplantcodesresults)\>\> ::: tip :bulb: More Information -See: [GetEquipmentPlantCodes Documentation](/api/get-equipment-plant-codes) +See: [GetEquipmentPlantCodes Documentation](/api/endpoints/get-equipment-plant-codes) ::: `GetEquipmentPlantCodes` returns assigned Equipment Plant Codes. Can be filtered by Year, diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetMakeForManufacturer.md b/apps/docs/src/typedoc/modules/api_endpoints_GetMakeForManufacturer.md index e31b1b303..7a04e2b22 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetMakeForManufacturer.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetMakeForManufacturer.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetMakeForManufacturer +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetMakeForManufacturer # Module: api/endpoints/GetMakeForManufacturer @@ -19,7 +19,7 @@ ▸ **GetMakeForManufacturer**(`manufacturer`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetMakeForManufacturerResults`](api_endpoints_GetMakeForManufacturer.md#getmakeformanufacturerresults)\>\> ::: tip :bulb: More Information -See: [GetMakeForManufacturer Documentation](/api/get-make-for-manufacturer) +See: [GetMakeForManufacturer Documentation](/api/endpoints/get-make-for-manufacturer) ::: `GetMakeForManufacturer` returns all the Makes in the vPIC dataset for a specified manufacturer diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForManufacturerAndYear.md b/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForManufacturerAndYear.md index 249e802e4..9aba044dc 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForManufacturerAndYear.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForManufacturerAndYear.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetMakesForManufacturerAndYear +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetMakesForManufacturerAndYear # Module: api/endpoints/GetMakesForManufacturerAndYear @@ -19,7 +19,7 @@ ▸ **GetMakesForManufacturerAndYear**(`manufacturer`, `params`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetMakesForManufacturerAndYearResults`](api_endpoints_GetMakesForManufacturerAndYear.md#getmakesformanufacturerandyearresults)\>\> ::: tip :bulb: More Information -See: [GetMakesForManufacturerAndYear Documentation](/api/get-makes-for-manufacturer-and-year) +See: [GetMakesForManufacturerAndYear Documentation](/api/endpoints/get-makes-for-manufacturer-and-year) ::: `GetMakesForManufacturerAndYear` returns all the Makes in the vPIC dataset for a specified diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForVehicleType.md b/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForVehicleType.md index 5b66923ec..7598792eb 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForVehicleType.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetMakesForVehicleType.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetMakesForVehicleType +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetMakesForVehicleType # Module: api/endpoints/GetMakesForVehicleType @@ -19,7 +19,7 @@ ▸ **GetMakesForVehicleType**(`typeName`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetMakesForVehicleTypeResults`](api_endpoints_GetMakesForVehicleType.md#getmakesforvehicletyperesults)\>\> ::: tip :bulb: More Information -See: [GetMakesForVehicleType Documentation](/api/get-makes-for-vehicle-type) +See: [GetMakesForVehicleType Documentation](/api/endpoints/get-makes-for-vehicle-type) ::: `GetMakesForVehicleType` returns all the Makes in the vPIC dataset for a specified vehicle type diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetManufacturerDetails.md b/apps/docs/src/typedoc/modules/api_endpoints_GetManufacturerDetails.md index f6717d28b..48e0cc8a9 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetManufacturerDetails.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetManufacturerDetails.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetManufacturerDetails +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetManufacturerDetails # Module: api/endpoints/GetManufacturerDetails @@ -19,7 +19,7 @@ ▸ **GetManufacturerDetails**(`manufacturer`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetManufacturerDetailsResults`](api_endpoints_GetManufacturerDetails.md#getmanufacturerdetailsresults)\>\> ::: tip :bulb: More Information -See: [GetMakesForVehicleType Documentation](/api/get-makes-for-vehicle-type) +See: [GetMakesForVehicleType Documentation](/api/endpoints/get-makes-for-vehicle-type) ::: `GetManufacturerDetails` provides the details for a specific manufacturer that is requested. diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMake.md b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMake.md index f68152e54..0b670a5e7 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMake.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMake.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMake +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMake # Module: api/endpoints/GetModelsForMake @@ -19,7 +19,7 @@ ▸ **GetModelsForMake**(`makeName`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetModelsForMakeResults`](api_endpoints_GetModelsForMake.md#getmodelsformakeresults)\>\> ::: tip :bulb: More Information -See: [GetModelsForMake Documentation](/api/get-models-for-make) +See: [GetModelsForMake Documentation](/api/endpoints/get-models-for-make) ::: `GetModelsForMake` returns the Models in the vPIC dataset for a specified `makeName` diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeId.md b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeId.md index b98f0c599..a26bdc37f 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeId.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeId.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMakeId +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMakeId # Module: api/endpoints/GetModelsForMakeId @@ -19,7 +19,7 @@ ▸ **GetModelsForMakeId**(`makeId`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetModelsForMakeIdResults`](api_endpoints_GetModelsForMakeId.md#getmodelsformakeidresults)\>\> ::: tip :bulb: More Information -See: [GetModelsForMakeId Documentation](/api/get-models-for-make-id) +See: [GetModelsForMakeId Documentation](/api/endpoints/get-models-for-make-id) ::: `GetModelsForMakeId` returns the Models in the vPIC dataset for a specified Make whose ID is diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeIdYear.md b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeIdYear.md index c76c85aa9..dcdaf527e 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeIdYear.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeIdYear.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMakeIdYear +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMakeIdYear # Module: api/endpoints/GetModelsForMakeIdYear @@ -19,7 +19,7 @@ ▸ **GetModelsForMakeIdYear**(`params`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetModelsForMakeIdYearResults`](api_endpoints_GetModelsForMakeIdYear.md#getmodelsformakeidyearresults)\>\> ::: tip :bulb: More Information -See: [GetModelsForMakeIdYear Documentation](/api/get-models-for-make-id-year) +See: [GetModelsForMakeIdYear Documentation](/api/endpoints/get-models-for-make-id-year) ::: `GetModelsForMakeIdYear` returns the Models in the vPIC dataset for a specified Model Year diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeYear.md b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeYear.md index a620eeecf..f2276af42 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeYear.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetModelsForMakeYear.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMakeYear +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetModelsForMakeYear # Module: api/endpoints/GetModelsForMakeYear @@ -19,7 +19,7 @@ ▸ **GetModelsForMakeYear**(`params`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetModelsForMakeYearResults`](api_endpoints_GetModelsForMakeYear.md#getmodelsformakeyearresults)\>\> ::: tip :bulb: More Information -See: [GetModelsForMakeYear Documentation](/api/get-models-for-make-year) +See: [GetModelsForMakeYear Documentation](/api/endpoints/get-models-for-make-year) ::: `GetModelsForMakeYear` returns the Models in the vPIC dataset for a specified Model Year and diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetParts.md b/apps/docs/src/typedoc/modules/api_endpoints_GetParts.md index ae98a2957..3d82240e4 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetParts.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetParts.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetParts +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetParts # Module: api/endpoints/GetParts @@ -19,7 +19,7 @@ ▸ **GetParts**(`doFetch?`, `_dummy?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetPartsResults`](api_endpoints_GetParts.md#getpartsresults)\>\> ::: tip :bulb: More Information -See: [GetParts Documentation](/api/get-parts) +See: [GetParts Documentation](/api/endpoints/get-parts) ::: `GetParts` provides a list of ORGs with letter date in the given range of the dates and with diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMake.md b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMake.md index 9deb0fc6b..a7539b6e7 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMake.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMake.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleTypesForMake +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleTypesForMake # Module: api/endpoints/GetVehicleTypesForMake @@ -19,7 +19,7 @@ ▸ **GetVehicleTypesForMake**(`makeName`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetVehicleTypesForMakeResults`](api_endpoints_GetVehicleTypesForMake.md#getvehicletypesformakeresults)\>\> ::: tip :bulb: More Information -See: [GetVehicleTypesForMake Documentation](/api/get-vehicle-types-for-make) +See: [GetVehicleTypesForMake Documentation](/api/endpoints/get-vehicle-types-for-make) ::: `GetVehicleTypesForMake` returns all the Vehicle Types in the vPIC dataset for a specified Make, diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMakeId.md b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMakeId.md index 193c98cec..bc23f4772 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMakeId.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleTypesForMakeId.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleTypesForMakeId +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleTypesForMakeId # Module: api/endpoints/GetVehicleTypesForMakeId @@ -19,7 +19,7 @@ ▸ **GetVehicleTypesForMakeId**(`makeId`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetVehicleTypesForMakeIdResults`](api_endpoints_GetVehicleTypesForMakeId.md#getvehicletypesformakeidresults)\>\> ::: tip :bulb: More Information -See: [GetVehicleTypesForMakeId Documentation](/api/get-vehicle-types-for-make-id) +See: [GetVehicleTypesForMakeId Documentation](/api/endpoints/get-vehicle-types-for-make-id) ::: `GetVehicleTypesForMakeId` returns the Models in the vPIC dataset for a specified Make diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableList.md b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableList.md index 57daa40ac..67b8f40c3 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableList.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableList.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleVariableList +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleVariableList # Module: api/endpoints/GetVehicleVariableList @@ -19,7 +19,7 @@ ▸ **GetVehicleVariableList**(`doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetVehicleVariableListResults`](api_endpoints_GetVehicleVariableList.md#getvehiclevariablelistresults)\>\> ::: tip :bulb: More Information -See: [GetVehicleVariableList Documentation](/api/get-vehicle-variable-list) +See: [GetVehicleVariableList Documentation](/api/endpoints/get-vehicle-variable-list) ::: `GetVehicleVariableList` provides a list of all the Vehicle related variables that are in the diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableValuesList.md b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableValuesList.md index f5a9f4f6a..43302bfd4 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableValuesList.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetVehicleVariableValuesList.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleVariableValuesList +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetVehicleVariableValuesList # Module: api/endpoints/GetVehicleVariableValuesList @@ -19,7 +19,7 @@ ▸ **GetVehicleVariableValuesList**(`variableValue`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetVehicleVariableValuesListResults`](api_endpoints_GetVehicleVariableValuesList.md#getvehiclevariablevalueslistresults)\>\> ::: tip :bulb: More Information -See: [GetVehicleVariableValuesList Documentation](/api/get-vehicle-variable-values-list) +See: [GetVehicleVariableValuesList Documentation](/api/endpoints/get-vehicle-variable-values-list) ::: `GetVehicleVariableValuesList` provides a list of all the accepted values for a given variable diff --git a/apps/docs/src/typedoc/modules/api_endpoints_GetWMIsForManufacturer.md b/apps/docs/src/typedoc/modules/api_endpoints_GetWMIsForManufacturer.md index a9f3a8a70..8d5073c98 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_GetWMIsForManufacturer.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_GetWMIsForManufacturer.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/GetWMIsForManufacturer +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/GetWMIsForManufacturer # Module: api/endpoints/GetWMIsForManufacturer @@ -19,7 +19,7 @@ ▸ **GetWMIsForManufacturer**(`params?`, `doFetch?`): `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<[`GetWMIsForManufacturerResults`](api_endpoints_GetWMIsForManufacturer.md#getwmisformanufacturerresults)\>\> ::: tip :bulb: More Information -See: [GetWMIsForManufacturer Documentation](/api/get-wmis-for-manufacturer) +See: [GetWMIsForManufacturer Documentation](/api/endpoints/get-wmis-for-manufacturer) ::: `GetWMIsForManufacturer` provides information on the World Manufacturer Identifier (WMI) for a @@ -105,4 +105,4 @@ Objects found in the `Results` array of `GetWMIsForManufacturer` endpoint respon #### Defined in -[api/endpoints/GetWMIsForManufacturer.ts:119](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/api/endpoints/GetWMIsForManufacturer.ts#L119) +[api/endpoints/GetWMIsForManufacturer.ts:123](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/api/endpoints/GetWMIsForManufacturer.ts#L123) diff --git a/apps/docs/src/typedoc/modules/api_endpoints_types.md b/apps/docs/src/typedoc/modules/api_endpoints_types.md index 2ce9a2795..d4fc2c428 100644 --- a/apps/docs/src/typedoc/modules/api_endpoints_types.md +++ b/apps/docs/src/typedoc/modules/api_endpoints_types.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/endpoints/types +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/endpoints/types # Module: api/endpoints/types diff --git a/apps/docs/src/typedoc/modules/api_types.md b/apps/docs/src/typedoc/modules/api_types.md index 44a9650fe..4d84ec9ef 100644 --- a/apps/docs/src/typedoc/modules/api_types.md +++ b/apps/docs/src/typedoc/modules/api_types.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/types +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/types # Module: api/types diff --git a/apps/docs/src/typedoc/modules/api_useNHTSA.md b/apps/docs/src/typedoc/modules/api_useNHTSA.md index 3dadbb6b7..8445e68ff 100644 --- a/apps/docs/src/typedoc/modules/api_useNHTSA.md +++ b/apps/docs/src/typedoc/modules/api_useNHTSA.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / api/useNHTSA +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / api/useNHTSA # Module: api/useNHTSA @@ -39,44 +39,45 @@ ▸ **useNHTSA**(): `Object` -This is the main composable function that is used to make requests to the NHTSA API. +`useNHTSA` returns a composable object containing helper functions for working with the VPIC +API. It is used internally by the package and by users to make direct requests to the VPIC API. -`useNHTSA` is a composable function that returns an object containing methods for making HTTP -requests to the NHTSA API. All request methods return a Promise that resolves to an object -containing the response data, see [NhtsaApiResponse](#TODO-LINK-TO-DOCS) type. +It returns an object containing methods for making HTTP requests to the VPIC API. All +request methods return a Promise that resolves to an object containing the full response data. -Pleas see the [`/api` README](https://github.com/shaggytech/nhtsa-api-wrapper/packages/lib/src/api) -for more information on the exported methods and how to use them. +The functions returned by the composable are: ---- +- `createCachedUrl` - Builds the URL string and stores it in internal state -The exported methods are: +- `getCachedUrl` - Gets the URL stored in internal state -- `get` - Makes a GET request, uses the internal url variable if no URL is provided +- `setCachedUrl` - Directly sets the URL internal state, does not check if URL is valid -- `post` - Makes a POST request, uses the internal url variable if no URL is provided +- `clearCachedUrl` - Clears the URL stored in internal state -- `cacheUrl` - Builds the URL string and stores it in internal state +- `createUrl` - Returns a built URL string but does not store it in internal state -- `createUrl` - Builds the URL string but does not store it in internal state +- `createPostBody` - Creates a POST body string from an object of key/value pairs -- `getCachedUrl` - Returns the internal URL string +- `get` - Makes a GET request, uses the internal url variable if no URL is provided + +- `post` - Makes a POST request, uses the internal url variable if no URL is provided #### Returns `Object` -| Name | Type | -| :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cacheUrl` | (`input`: `string` \| [`CreateUrlOptions`](api_useNHTSA.md#createurloptions)) => `string` | -| `clearCachedUrl` | () => `string` | -| `createPostBody` | (`data`: `string`) => `string` | -| `createUrl` | (`options`: [`CreateUrlOptions`](api_useNHTSA.md#createurloptions)) => `string` | -| `get` | (`url?`: `string` \| [`CreateUrlOptions`](api_useNHTSA.md#createurloptions), `options?`: `RequestInit` & { `saveUrl?`: `boolean` }) => `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<`T`\>\> | -| `getCachedUrl` | () => `string` | -| `post` | (`url?`: `string` \| [`CreateUrlOptions`](api_useNHTSA.md#createurloptions), `options?`: `RequestInit` & { `saveUrl?`: `boolean` }) => `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<`T`\>\> | -| `setCachedUrl` | (`url`: `string`) => `string` | +| Name | Type | +| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `clearCachedUrl` | () => `string` | +| `createCachedUrl` | (`input`: `string` \| [`CreateUrlOptions`](api_useNHTSA.md#createurloptions)) => `string` | +| `createPostBody` | (`data`: `string`) => `string` | +| `createUrl` | (`options`: [`CreateUrlOptions`](api_useNHTSA.md#createurloptions)) => `string` | +| `get` | (`url?`: `string` \| [`CreateUrlOptions`](api_useNHTSA.md#createurloptions), `options?`: `RequestInit` & { `saveUrl?`: `boolean` }) => `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<`T`\>\> | +| `getCachedUrl` | () => `string` | +| `post` | (`url?`: `string` \| [`CreateUrlOptions`](api_useNHTSA.md#createurloptions), `options?`: `RequestInit` & { `saveUrl?`: `boolean` }) => `Promise`<[`NhtsaResponse`](api_types.md#nhtsaresponse)<`T`\>\> | +| `setCachedUrl` | (`url`: `string`) => `string` | #### Defined in -[api/useNHTSA.ts:49](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/api/useNHTSA.ts#L49) +[api/useNHTSA.ts:50](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/api/useNHTSA.ts#L50) diff --git a/apps/docs/src/typedoc/modules/constants.md b/apps/docs/src/typedoc/modules/constants.md index b3768231f..e9ad926ac 100644 --- a/apps/docs/src/typedoc/modules/constants.md +++ b/apps/docs/src/typedoc/modules/constants.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / constants +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / constants # Module: constants diff --git a/apps/docs/src/typedoc/modules/global.md b/apps/docs/src/typedoc/modules/global.md index 4b4836082..02e9074ea 100644 --- a/apps/docs/src/typedoc/modules/global.md +++ b/apps/docs/src/typedoc/modules/global.md @@ -1,3 +1,3 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / global +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / global # Module: global diff --git a/apps/docs/src/typedoc/modules/index.md b/apps/docs/src/typedoc/modules/index.md index c48faea8e..45aa073fc 100644 --- a/apps/docs/src/typedoc/modules/index.md +++ b/apps/docs/src/typedoc/modules/index.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / index +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / index # Module: index diff --git a/apps/docs/src/typedoc/modules/types.md b/apps/docs/src/typedoc/modules/types.md index a017ae962..bacf04032 100644 --- a/apps/docs/src/typedoc/modules/types.md +++ b/apps/docs/src/typedoc/modules/types.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / types +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / types # Module: types diff --git a/apps/docs/src/typedoc/modules/utils.md b/apps/docs/src/typedoc/modules/utils.md index f3829c45f..b6e1aab6e 100644 --- a/apps/docs/src/typedoc/modules/utils.md +++ b/apps/docs/src/typedoc/modules/utils.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / utils +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / utils # Module: utils diff --git a/apps/docs/src/typedoc/modules/utils_argHandler.md b/apps/docs/src/typedoc/modules/utils_argHandler.md index f53ed17f5..0095e5f3a 100644 --- a/apps/docs/src/typedoc/modules/utils_argHandler.md +++ b/apps/docs/src/typedoc/modules/utils_argHandler.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / utils/argHandler +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / utils/argHandler # Module: utils/argHandler diff --git a/apps/docs/src/typedoc/modules/utils_errorHandler.md b/apps/docs/src/typedoc/modules/utils_errorHandler.md index 44642cff9..9d9df3359 100644 --- a/apps/docs/src/typedoc/modules/utils_errorHandler.md +++ b/apps/docs/src/typedoc/modules/utils_errorHandler.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / utils/errorHandler +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / utils/errorHandler # Module: utils/errorHandler diff --git a/apps/docs/src/typedoc/modules/utils_getTypeof.md b/apps/docs/src/typedoc/modules/utils_getTypeof.md index d7f6627e0..29f3024f0 100644 --- a/apps/docs/src/typedoc/modules/utils_getTypeof.md +++ b/apps/docs/src/typedoc/modules/utils_getTypeof.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / utils/getTypeof +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / utils/getTypeof # Module: utils/getTypeof diff --git a/apps/docs/src/typedoc/modules/utils_isValidVin.md b/apps/docs/src/typedoc/modules/utils_isValidVin.md index a612d674d..00df83454 100644 --- a/apps/docs/src/typedoc/modules/utils_isValidVin.md +++ b/apps/docs/src/typedoc/modules/utils_isValidVin.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / utils/isValidVin +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / utils/isValidVin # Module: utils/isValidVin diff --git a/apps/docs/src/typedoc/modules/utils_queryString.md b/apps/docs/src/typedoc/modules/utils_queryString.md index 3a407ecd2..4c23c1013 100644 --- a/apps/docs/src/typedoc/modules/utils_queryString.md +++ b/apps/docs/src/typedoc/modules/utils_queryString.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / utils/queryString +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / utils/queryString # Module: utils/queryString @@ -63,22 +63,25 @@ Valid URI component types ▸ **createQueryString**<`T`\>(`params?`, `allowEmptyParams?`): `string` +This function is used internally by other package functions. As a consumer of this package, you +should not need to use this function directly in most cases. + Utility function to generate a query string conforming to URI component standards. Takes an an optional object of search parameters and returns an encoded query string. -The parameter `{ format: 'json' }` is hardcoded and cannot be overridden, this package provides -no support for CSV or XML formats at this time. The default query string will be "?format=json" -even if no `params` are provided by user. +This function will always override `params.format` with `{ format: 'json' }`. This is hardcoded +into the package and cannot be overridden, this package provides no support for CSV or XML +formats at this time. This means the default query string will be `"?format=json"` even if no +`params` are provided by user. - Ignores parameters that are not strings, numbers, or booleans, and also ignores empty strings by default. -- If first argument is not an object then it will be ignored. -- If second argument `allowEmptyParams` is set to `true`, the function will include keys with - empty string values, e.g. 'emptyKey=' -This function is not exported by the package, but is used internally by other -functions. However, it _is_ exported by the package as part of the composable function -`useQueryString`, and renamed to `createString` for less verbose use. +- If you don't provide an object as the first argument, an error will be thrown. Providing an + empty object will not throw an error. + +- If the second argument, `allowEmptyParams`, is set to `true`, the function will include keys + with empty string values in the final query string, e.g. 'emptyKey='. #### Type parameters @@ -101,7 +104,7 @@ functions. However, it _is_ exported by the package as part of the composable fu #### Defined in -[utils/queryString.ts:94](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/utils/queryString.ts#L94) +[utils/queryString.ts:100](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/utils/queryString.ts#L100) --- @@ -109,6 +112,9 @@ functions. However, it _is_ exported by the package as part of the composable fu ▸ **encodeQueryStringParams**<`T`\>(`params`): [`QueryStringParamsEncoded`](utils_queryString.md#querystringparamsencoded)<`T`\> +This function is used internally by other package functions. As a consumer of this package, you +should not need to use this function directly in most cases. + Utility function to perform URI component encoding on all values in an object, for use in URL query strings. @@ -148,4 +154,4 @@ functions. However, it _is_ exported by the package as part of the composable fu #### Defined in -[utils/queryString.ts:41](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/utils/queryString.ts#L41) +[utils/queryString.ts:44](https://github.com/ShaggyTech/nhtsa-api-wrapper/blob/main/packages/lib/src/utils/queryString.ts#L44) diff --git a/apps/docs/src/typedoc/modules/utils_types.md b/apps/docs/src/typedoc/modules/utils_types.md index a06b40603..10fab36d7 100644 --- a/apps/docs/src/typedoc/modules/utils_types.md +++ b/apps/docs/src/typedoc/modules/utils_types.md @@ -1,4 +1,4 @@ -[@shaggytools/nhtsa-api-wrapper - v3.0.2](../index.md) / [Exports](../modules.md) / utils/types +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / utils/types # Module: utils/types diff --git a/apps/docs/src/typedoc/modules/vite_env.md b/apps/docs/src/typedoc/modules/vite_env.md new file mode 100644 index 000000000..76f268ec5 --- /dev/null +++ b/apps/docs/src/typedoc/modules/vite_env.md @@ -0,0 +1,3 @@ +[@shaggytools/nhtsa-api-wrapper](../index.md) / [Exports](../modules.md) / vite-env + +# Module: vite-env diff --git a/apps/docs/src/utils/index.md b/apps/docs/src/utils/index.md new file mode 100644 index 000000000..b8697e14c --- /dev/null +++ b/apps/docs/src/utils/index.md @@ -0,0 +1,10 @@ +# Utility Functions + +--- + +This package exports a number of helper functions for working with VINs and the VPIC API. + +- [isValidVin](./is-valid-vin) - function for offline VIN validation +- [useNHTSA](./use-nhtsa-composable) - composable function returning useful helper functions + + diff --git a/apps/docs/src/utils/is-valid-vin.md b/apps/docs/src/utils/is-valid-vin.md new file mode 100644 index 000000000..e69de29bb diff --git a/apps/docs/src/utils/use-nhtsa-composable.md b/apps/docs/src/utils/use-nhtsa-composable.md new file mode 100644 index 000000000..c53474eaf --- /dev/null +++ b/apps/docs/src/utils/use-nhtsa-composable.md @@ -0,0 +1,54 @@ +# useNHTSA Composable Function + +```typescript +const useNHTSA: () => { + setCachedUrl: (url: string) => string + getCachedUrl: () => string + clearCachedUrl: () => string + createCachedUrl: (input: CreateUrlOptions | string) => string + createUrl: (options: CreateUrlOptions) => string + createPostBody: (data: string) => string + get: ( + url?: string | CreateUrlOptions, + options?: RequestInit & { + saveUrl?: boolean + } + ) => Promise> + post: ( + url?: string | CreateUrlOptions, + options?: RequestInit & { + saveUrl?: boolean + } + ) => Promise> +} +``` + +--- + +`useNHTSA` returns an object containing helper functions for working with the NHTSA VPIC +API. It is used internally by the package and by users to make direct requests to the VPIC API. + +It contains functions for making HTTP requests to the VPIC API. All request methods return a +Promise that resolves to an object containing the full response data. See the +[VPIC API Response](../api/vpic-api-response) page for more info on the full response returned by the +request functions. + +--- + +The functions returned by the composable are: + +- `createCachedUrl` - Builds the URL string and stores it in internal state + +- `getCachedUrl` - Gets the URL stored in internal state```\*\* + +- `setCachedUrl` - Directly sets the URL internal state, does not check if URL is valid + +- `clearCachedUrl` - Clears the URL stored in internal state + +- `createUrl` - Returns a built URL string but does not store it in internal state + +- `createPostBody` - Creates a POST body string from an object of key/value pairs + +- `get` - Makes a GET request, uses the internal url variable if no URL is provided + +- `post` - Makes a POST request, uses the internal url variable if no URL is provided diff --git a/apps/docs/tsconfig.json b/apps/docs/tsconfig.json index 21822f7c1..d84837c69 100644 --- a/apps/docs/tsconfig.json +++ b/apps/docs/tsconfig.json @@ -3,8 +3,8 @@ "extends": "tsconfig/vitepress.json", "include": [ "src/**/*.ts", - "src/.vitepress/**/*.ts", - "src/**/*.d.ts" + "src/**/*.d.ts", + ".vitepress/**/*.ts", ], "exclude": [ "cache", diff --git a/config/README.md b/config/README.md new file mode 100644 index 000000000..f1d2cdba8 --- /dev/null +++ b/config/README.md @@ -0,0 +1,19 @@ +# Shared Configuration folder for the @shaggytools/nhtsa-api-wrapper monorepo + +## Contents + +### `config/eslint-config-custom` + +Shared Eslint configuration + +### `config/prettier-config` + +Shared Prettier configuration + +### `config/tsconfig` + +Shared Typescript configuration + +### `config/typedoc-config` + +Shared Typedoc configuration diff --git a/config/tsconfig/vitepress.json b/config/tsconfig/vitepress.json index 5e955316a..b390c0198 100644 --- a/config/tsconfig/vitepress.json +++ b/config/tsconfig/vitepress.json @@ -3,8 +3,6 @@ "display": "Vite-Library-Mode", "extends": "./vite-library.json", "compilerOptions": { - "preserveValueImports": true, - "importsNotUsedAsValues": "error", "jsx": "preserve" } } diff --git a/config/typedoc-config/package.json b/config/typedoc-config/package.json index 0e6610408..a7b7c75af 100644 --- a/config/typedoc-config/package.json +++ b/config/typedoc-config/package.json @@ -5,8 +5,8 @@ "private": true, "main": "typedoc-config.js", "devDependencies": { - "typedoc": "0.23.28", - "typedoc-plugin-markdown": "3.14.0", + "typedoc": "0.24.4", + "typedoc-plugin-markdown": "3.15.1", "typescript": "5.0.3" } } diff --git a/package.json b/package.json index 2900bf8b4..f9a758bcf 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "build": "turbo run build", "dev": "turbo run dev --parallel", "lint": "turbo run lint", - "format": "turbo run format", "lint:fix": "turbo run lint:fix", + "format": "turbo run format", "test": "turbo run test", "coverage": "pnpm --filter @shaggytools/nhtsa-api-wrapper run coverage", "clean": "turbo run clean" @@ -55,8 +55,5 @@ "*.{js,ts,tsx,vue,md}": [ "eslint --cache --fix" ] - }, - "publishConfig": { - "access": "public" } } diff --git a/packages/README.md b/packages/README.md index 7726831fc..a62e7893c 100644 --- a/packages/README.md +++ b/packages/README.md @@ -2,12 +2,8 @@ This folder contains the packages in the `@shaggytools/nhtsa-api-wrapper` mono-repo. -Packages are published to npmjs.com and are available for use in other projects. - ## Contents ---- - ### `packages/lib` Contains the source code for the `@shaggytools/nhtsa-api-wrapper` library. diff --git a/packages/lib/README.md b/packages/lib/README.md index 5715218e2..82bd788ff 100644 --- a/packages/lib/README.md +++ b/packages/lib/README.md @@ -1,5 +1,25 @@ # @shaggytools/nhtsa-api-wrapper +

+ + + + + + + + + + + + + + + +

+ +--- + ## Javascript Wrapper and Helper Functions for the [NHTSA VPIC API](https://vpic.nhtsa.dot.gov/api/Home) A universal (browser/server) javascript wrapper for the National Highway Traffic @@ -9,11 +29,142 @@ The VPIC API is primarily used for decoding useful information from a Vehicle Id (VIN) in the United States and Canada. It can also be used to get all models of a make, to decode WMIs, get all makes for a certain year, and more. -## Documentation +--- + +
Built With:
+
+

+ + + + + + + + + + + + + + + +

+ +--- + +## Full Documentation + +### [https://vpic.shaggytech.com/](https://vpic.shaggytech.com/) + +- [Introduction](https://vpic.shaggytech.com/guide) +- [Install](https://vpic.shaggytech.com/guide/getting-started#install) +- [Quick Start](https://vpic.shaggytech.com//guide/getting-started#quick-start) +- [API Reference](https://vpic.shaggytech.com/api/) + +## Install + +### Node Package Managers + +#### [NPM](https://www.npmjs.com/package/@shaggytools/nhtsa-api-wrapper) + +```sh [npm] +$ npm install @shaggytools/nhtsa-api-wrapper +``` + +#### Yarn + +```sh [yarn] +$ yarn add @shaggytools/nhtsa-api-wrapper +``` + +#### Pnpm + +```sh [pnpm] +$ pnpm add @shaggytools/nhtsa-api-wrapper +``` + +### Browser CDNs + +Browser global variable: `NHTSA` + +#### [jsDelivr](https://www.jsdelivr.com/package/npm/@shaggytools/nhtsa-api-wrapper) + +```html [jsDelivr] + +``` + +#### UNPKG + +```html [UNPKG] + +``` + +## List of Exported Functions + +```javascript +import { + // NHTSA API Endpoints + DecodeVin, + DecodeVinExtended, + DecodeVinValues, + DecodeVinValuesBatch, + DecodeVinValuesExtended, + DecodeWMI, + GetAllMakes, + GetAllManufacturers, + GetCanadianVehicleSpecifications, + GetEquipmentPlantCodes, + GetMakeForManufacturer, + GetMakesForManufacturerAndYear, + GetMakesForVehicleType, + GetManufacturerDetails, + GetModelsForMake, + GetModelsForMakeId, + GetModelsForMakeIdYear, + GetModelsForMakeYear, + GetParts, + GetVehicleTypesForMake, + GetVehicleTypesForMakeId, + GetVehicleVariableList, + GetVehicleVariableValuesList, + GetWMIsForManufacturer, + // composable function returning helper functions for NHTSA API + useNHTSA, + // function for offline VIN validation + isValidVin, +} from '@shaggytools/nhtsa-api-wrapper' +``` + +## Quick Start + +Decoding a VIN is as easy as importing the `DecodeVinValues` function and calling it +with a VIN. + +Make sure to first install via your favorite package manager or use a CDN. + +```javascript +import { DecodeVinValues } from '@shaggytools/nhtsa-api-wrapper' + +const results = await DecodeVinValues('WA1A4AFY2J2008189') + +/* +results = { + Count: 136, - number of Results objects returned + Message: 'Results returned successfully ...', + SearchCriteria: 'VIN:WA1A4AFY2J2008189', + Results: [ {...} ] - an array with single object of type DecodeVinValuesResults +} +*/ + +/* You can also use destructuring to get the Results object */ +const { Results } = await DecodeVinValues('WA1A4AFY2J2008189') + +/* This endpoint only returns a single object in the Results array + The first object in the array is the decoded vin data */ +const decodedVehicle = Results[0] // equals an object of type DecodeVinValuesResults +``` -### [https://shaggytech.com/nhtsa-api-wrapper](https://shaggytech.com/nhtsa-api-wrapper/) +For a full example response see: [DecodeVinValues](https://vpic.shaggytech.com/api/endpoints/decode-vin-values#returns) -- [Introduction](https://www.shaggytech.com/nhtsa-api-wrapper/guide) -- [Install](https://www.shaggytech.com/nhtsa-api-wrapper/guide/getting-started#install) -- [Quick Start](https://www.shaggytech.com/nhtsa-api-wrapper/guide/getting-started#quick-start) -- [API Reference](https://www.shaggytech.com/nhtsa-api-wrapper/api/) +All available endpoints can be found here: [VPIC API Endpoints](https://vpic.shaggytech.com/api/#vpic-api-endpoints) diff --git a/packages/lib/package.json b/packages/lib/package.json index bb1d1e054..94ddfc4c1 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -85,7 +85,7 @@ "prettier-config": "workspace:*", "rimraf": "4.4.1", "tsconfig": "workspace:*", - "typedoc": "0.23.28", + "typedoc": "0.24.4", "typedoc-config": "workspace:*", "typescript": "5.0.3", "vite": "4.2.1", diff --git a/packages/lib/src/api/README.md b/packages/lib/src/api/README.md index dcb19db08..e0a3226eb 100644 --- a/packages/lib/src/api/README.md +++ b/packages/lib/src/api/README.md @@ -41,24 +41,24 @@ The exported methods are: - `post` - Makes a POST request, uses the internal url variable if no URL is provided -- `cacheUrl` - Builds the URL string and stores it in internal state +- `createCachedUrl` - Builds the URL string and stores it in internal state - `createUrl` - Builds the URL string but does not store it in internal state - `getCachedUrl` - Returns the internal URL string -`cacheUrl`, `get`, and `post` methods will cache url to internal state if you pass them a url +`createCachedUrl`, `get`, and `post` methods will cache url to internal state if you pass them a url string or options object. They will always overwrite the current cached url and immediately make the request. The only exception to this is when providing option of `saveUrl: false` when using an options object. The above is default behavior, but you can also pass `options.saveUrl = false` when using -an options object with the `cacheUrl`, `createUrl`, `get`, and `post` methods. This will prevent +an options object with the `createCachedUrl`, `createUrl`, `get`, and `post` methods. This will prevent the composable from saving the URL in the composable instance. ### `useNHTSA` Options -Options for `cacheUrl` and `createUrl` are a single `object` of type `CreateUrlOptions`: +Options for `createCachedUrl` and `createUrl` are a single `object` of type `CreateUrlOptions`: - `endpointName` - The name of the endpoint to use, see [NHTSA API Endpoints](https://github.com/shaggytech/nhtsa-api-wrapper#nhtsa-api-endpoints) @@ -80,7 +80,7 @@ Options for `get` and `post`: - `url` - either a full url `string` or an `object` of type `CreateUrlOptions` as described above - `required` if there is no url cached in the composable instance - - if an object is provided, `cacheUrl` will be called with the object to build the url before + - if an object is provided, `createCachedUrl` will be called with the object to build the url before making the request - if a string is provided, it is assumed the string is a full url and it will be stored in the instance as such before making the request @@ -91,7 +91,7 @@ In this example all of the code is using the same composable instance and _{...o object of type `CreateUrlOptions`: ```javascript -const { get, post, cacheUrl createUrl, getCachedUrl } = useNHTSA() +const { get, post, createCachedUrl createUrl, getCachedUrl } = useNHTSA() const urlString = createUrl({ ...options }) // does not cache url @@ -112,10 +112,10 @@ createUrl({ ...options }) get() // uses https://some.api.com/api/endpoint/POST from earlier cache -- OOPS! -cacheUrl({ ...options }) // caches url in composable instance -get() // uses url cached during the preceding cacheUrl() call +createCachedUrl({ ...options }) // caches url in composable instance +get() // uses url cached during the preceding createCachedUrl() call -getCachedUrl() // returns url cached during the preceding cacheUrl() call +getCachedUrl() // returns url cached during the preceding createCachedUrl() call get(urlString) // uses urlString and caches it in composable instance, overwriting previous url get() // uses url cached during the preceding get() call @@ -130,7 +130,7 @@ its own internal state. This is also why you must call `createUrl()` before making a request, so that the URL is stored in the instance's internal state. You can also pass `CreateUrlOptions` directly to `get()` and `post()` -and they will call `cacheUrl()` for you before making the request. +and they will call `createCachedUrl()` for you before making the request. You can either destructure the methods you want to use from the returned object, or you can call them directly on the returned object. If you want to reuse the same instance of the @@ -143,16 +143,16 @@ For example, the following are equivalent in regards to base functionality: import { useNHTSA } from '@shaggytools/nhtsa-api-wrapper' // destructure the methods you want to use from the returned object -const { get, post, cacheUrl, createUrl, getCachedUrl } = useNHTSA() +const { get, post, createCachedUrl, createUrl, getCachedUrl } = useNHTSA() // uses the same instance of the composable each time const getData = get() const postData = post() -const cachedUrl = cacheUrl({ ...options }) +const cachedUrl = createCachedUrl({ ...options }) const ephemeralUrl = createUrl({ ...options }) /* this would be undefined if there was no url cached, but in the flow of this example, there is - a url cached from the preceding call to cacheUrl() and it will return that one */ + a url cached from the preceding call to createCachedUrl() and it will return that one */ const mostRecentUrl = getCachedUrl() ``` @@ -163,17 +163,17 @@ import { useNHTSA } from '@shaggytools/nhtsa-api-wrapper' and knows nothing about the internal state of the other instances */ const getData = useNHTSA().get() const postData = useNHTSA().post() -const cachedUrl = useNHTSA().cacheUrl({ ...options }) +const cachedUrl = useNHTSA().createCachedUrl({ ...options }) const ephemeralUrl = useNHTSA().createUrl({ ...options }) const mostRecentUrl = useNHTSA().getCachedUrl() // this would be undefined, it's a new instance ``` -Note that neither `cacheUrl` nor `createUrl` are called automatically by `get` or `post` methods. +Note that neither `createCachedUrl` nor `createUrl` are called automatically by `get` or `post` methods. You must call them yourself before making a request or provide `get` and `post` with the pre-built url as an argument. -This means if you call `get` or `post` without first calling `cacheUrl` or `createUrl`, or providing +This means if you call `get` or `post` without first calling `createCachedUrl` or `createUrl`, or providing a valid argument to `get` or `post`, an `Error` will be returned saying that the url is undefined. Example usage: @@ -198,10 +198,10 @@ const differentOptions: CreateUrlOptions = { endpointName: 'GetAllMakes', } -cacheUrl({ ...options }) // create a url to fetch DecodeVinValues and cache it +createCachedUrl({ ...options }) // create a url to fetch DecodeVinValues and cache it const results1 = get() // make the request to DecodeVinValues using the url from the cache -cacheUrl({ ...differentOptions }) // create a new url to fetch GetAllMakes and cache it +createCachedUrl({ ...differentOptions }) // create a new url to fetch GetAllMakes and cache it const results2 = get() // make the request to GetAllMakes using the url from the cache ``` @@ -251,11 +251,11 @@ const postResponse = post( ) ``` -Use `cacheUrl` to save the url to the instance state and call `get` or `post` without -arguments. Will use the cached url from the most recent `cacheUrl` call. +Use `createCachedUrl` to save the url to the instance state and call `get` or `post` without +arguments. Will use the cached url from the most recent `createCachedUrl` call. ```javascript -const { createUrl, cacheUrl, get, post } = useNHTSA() +const { createUrl, createCachedUrl, get, post } = useNHTSA() const urlString = createUrl({ ...options }) // doesn't save to internal state @@ -268,7 +268,7 @@ about saving the results to variables. get(urlString, { saveUrl: false }) // uses the url string but doesn't save it to internal state get() // errors because no url is cached -cacheUrl({ ...otherOptions }) // saves url to internal state, also returns the url string +createCachedUrl({ ...otherOptions }) // saves url to internal state, also returns the url string get() // uses the url from the most recent createUrl() call get(urlString) // use the urlString variable, and save it to the internal state diff --git a/packages/lib/src/api/__tests__/useNHTSA.test.ts b/packages/lib/src/api/__tests__/useNHTSA.test.ts index b8a2cd596..5bbf9fb31 100644 --- a/packages/lib/src/api/__tests__/useNHTSA.test.ts +++ b/packages/lib/src/api/__tests__/useNHTSA.test.ts @@ -38,10 +38,10 @@ describe('useNHTSA', () => { expect(clearCachedUrl).toBeInstanceOf(Function) }) - it('returns cacheUrl function', () => { - const { cacheUrl } = useNHTSA() - expect(cacheUrl).toBeDefined() - expect(cacheUrl).toBeInstanceOf(Function) + it('returns createCachedUrl function', () => { + const { createCachedUrl } = useNHTSA() + expect(createCachedUrl).toBeDefined() + expect(createCachedUrl).toBeInstanceOf(Function) }) it('returns createUrl function', () => { @@ -144,15 +144,15 @@ describe('useNHTSA', () => { }) }) - describe('cacheUrl', () => { + describe('createCachedUrl', () => { /*********************** * Returns url string ***********************/ it('caches url when provided an object', () => { - const { cacheUrl, getCachedUrl } = useNHTSA() + const { createCachedUrl, getCachedUrl } = useNHTSA() expect(getCachedUrl()).toBe(undefined) - const url = cacheUrl({ endpointName: 'Test', path: 'path' }) + const url = createCachedUrl({ endpointName: 'Test', path: 'path' }) expect(url).toBe( 'https://vpic.nhtsa.dot.gov/api/vehicles/Test/path?format=json' ) @@ -160,31 +160,31 @@ describe('useNHTSA', () => { 'https://vpic.nhtsa.dot.gov/api/vehicles/Test/path?format=json' ) - cacheUrl({ endpointName: 'Another', path: 'path' }) + createCachedUrl({ endpointName: 'Another', path: 'path' }) expect(getCachedUrl()).toBe( 'https://vpic.nhtsa.dot.gov/api/vehicles/Another/path?format=json' ) }) it('caches url when provided a string', () => { - const { cacheUrl, getCachedUrl } = useNHTSA() + const { createCachedUrl, getCachedUrl } = useNHTSA() expect(getCachedUrl()).toBe(undefined) - let url = cacheUrl('mock url 5') + let url = createCachedUrl('mock url 5') expect(url).toBe('mock url 5') expect(getCachedUrl()).toBe('mock url 5') - url = cacheUrl('mock url 6') + url = createCachedUrl('mock url 6') expect(url).toBe('mock url 6') expect(getCachedUrl()).toBe('mock url 6') }) it('does not cache url when provided an object with saveUrl = false', () => { - const { cacheUrl, getCachedUrl } = useNHTSA() + const { createCachedUrl, getCachedUrl } = useNHTSA() expect(getCachedUrl()).toBe(undefined) - let url = cacheUrl({ + let url = createCachedUrl({ endpointName: 'Test', path: 'path', saveUrl: false, @@ -196,12 +196,12 @@ describe('useNHTSA', () => { expect(getCachedUrl()).toBe(undefined) /* Cache a url */ - cacheUrl({ endpointName: 'Another', path: 'path' }) + createCachedUrl({ endpointName: 'Another', path: 'path' }) expect(getCachedUrl()).toBe( 'https://vpic.nhtsa.dot.gov/api/vehicles/Another/path?format=json' ) - url = cacheUrl({ + url = createCachedUrl({ endpointName: 'Test', path: 'path', saveUrl: false, @@ -216,11 +216,11 @@ describe('useNHTSA', () => { }) it('ignores empty string params by default', () => { - const { cacheUrl, getCachedUrl } = useNHTSA() + const { createCachedUrl, getCachedUrl } = useNHTSA() expect(getCachedUrl()).toBe(undefined) - const url = cacheUrl({ + const url = createCachedUrl({ endpointName: 'DecodeVin', path: 'testVin', params: { page: '', modelYear: 2009 }, @@ -231,11 +231,11 @@ describe('useNHTSA', () => { }) it('uses empty string values when provided an object with allowEmptyParams = true', () => { - const { cacheUrl, getCachedUrl } = useNHTSA() + const { createCachedUrl, getCachedUrl } = useNHTSA() expect(getCachedUrl()).toBe(undefined) - const url = cacheUrl({ + const url = createCachedUrl({ endpointName: 'DecodeVin', params: { page: '', vin: 'testVIN' }, allowEmptyParams: true, @@ -246,11 +246,11 @@ describe('useNHTSA', () => { }) it('does not include default query string when provided an object with includeQueryString = false', () => { - const { cacheUrl, getCachedUrl } = useNHTSA() + const { createCachedUrl, getCachedUrl } = useNHTSA() expect(getCachedUrl()).toBe(undefined) - const url = cacheUrl({ + const url = createCachedUrl({ endpointName: 'DecodeVinValuesBatch', includeQueryString: false, }) @@ -263,10 +263,10 @@ describe('useNHTSA', () => { * rejects with error ***********************/ it('rejects with error if endpointName is not provided in input object', () => { - const { cacheUrl } = useNHTSA() + const { createCachedUrl } = useNHTSA() expect(() => - cacheUrl({ endpointName: undefined as unknown as string }) + createCachedUrl({ endpointName: undefined as unknown as string }) ).toThrowError() }) }) @@ -313,8 +313,8 @@ describe('useNHTSA', () => { it('uses a cached url if not provided one', async () => { fetchMock.mockResolvedValue(createMockResponse(mockResults)) - const { cacheUrl, get } = useNHTSA() - cacheUrl({ + const { createCachedUrl, get } = useNHTSA() + createCachedUrl({ endpointName: endpointName, path: vin, params, @@ -467,8 +467,8 @@ describe('useNHTSA', () => { it('uses a cached url if not provided one', async () => { fetchMock.mockResolvedValue(createMockResponse(mockResults)) - const { cacheUrl, getCachedUrl, post } = useNHTSA() - cacheUrl({ endpointName, includeQueryString: false }) + const { createCachedUrl, getCachedUrl, post } = useNHTSA() + createCachedUrl({ endpointName, includeQueryString: false }) const data = await post(getCachedUrl(), { body }) expect(data).toEqual(mockResults) diff --git a/packages/lib/src/api/endpoints/DecodeVin.ts b/packages/lib/src/api/endpoints/DecodeVin.ts index 528869fd7..764f6fbcc 100644 --- a/packages/lib/src/api/endpoints/DecodeVin.ts +++ b/packages/lib/src/api/endpoints/DecodeVin.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [DecodeVin Documentation](/api/decode-vin) + * See: [DecodeVin Documentation](/api/endpoints/decode-vin) * ::: * * `DecodeVin` decodes a Vehicle Identification Number (VIN) and returns useful information about @@ -88,9 +88,9 @@ async function DecodeVin( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: vin, params }) + createCachedUrl({ endpointName, path: vin, params }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/DecodeVinExtended.ts b/packages/lib/src/api/endpoints/DecodeVinExtended.ts index 60ed11e20..edfe61fba 100644 --- a/packages/lib/src/api/endpoints/DecodeVinExtended.ts +++ b/packages/lib/src/api/endpoints/DecodeVinExtended.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [DecodeVinExtended Documentation](/api/decode-vin-extended) + * See: [DecodeVinExtended Documentation](/api/endpoints/decode-vin-extended) * ::: * * `DecodeVinExtended` decodes a Vehicle Identification Number (VIN) and returns useful information @@ -94,9 +94,9 @@ async function DecodeVinExtended( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: vin, params }) + createCachedUrl({ endpointName, path: vin, params }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/DecodeVinValues.ts b/packages/lib/src/api/endpoints/DecodeVinValues.ts index 4a6bb3420..3c38def68 100644 --- a/packages/lib/src/api/endpoints/DecodeVinValues.ts +++ b/packages/lib/src/api/endpoints/DecodeVinValues.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [DecodeVinValues Documentation](/api/decode-vin-values) + * See: [DecodeVinValues Documentation](/api/endpoints/decode-vin-values) * ::: * * `DecodeVinValues` decodes a Vehicle Identification Number (VIN) and returns useful information @@ -91,9 +91,9 @@ async function DecodeVinValues( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: vin, params }) + createCachedUrl({ endpointName, path: vin, params }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/DecodeVinValuesBatch.ts b/packages/lib/src/api/endpoints/DecodeVinValuesBatch.ts index 5a641e7fa..47f4ad479 100644 --- a/packages/lib/src/api/endpoints/DecodeVinValuesBatch.ts +++ b/packages/lib/src/api/endpoints/DecodeVinValuesBatch.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [DecodeVinValuesBatch Documentation](/api/decode-vin-values-batch) + * See: [DecodeVinValuesBatch Documentation](/api/endpoints/decode-vin-values-batch) * ::: * * `DecodeVinValuesBatch` decodes a batch of Vehicle Identification Numbers (VINs) and returns @@ -68,9 +68,9 @@ async function DecodeVinValuesBatch( ] catchInvalidArguments({ args }) - const { post, cacheUrl, getCachedUrl } = useNHTSA() + const { post, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, includeQueryString: false }) + createCachedUrl({ endpointName, includeQueryString: false }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/DecodeVinValuesExtended.ts b/packages/lib/src/api/endpoints/DecodeVinValuesExtended.ts index faca0049d..f91b622a2 100644 --- a/packages/lib/src/api/endpoints/DecodeVinValuesExtended.ts +++ b/packages/lib/src/api/endpoints/DecodeVinValuesExtended.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [DecodeVinValuesExtended Documentation](/api/decode-vin-values-extended) + * See: [DecodeVinValuesExtended Documentation](/api/endpoints/decode-vin-values-extended) * ::: * * `DecodeVinValuesExtended` decodes a Vehicle Identification Number (VIN) and returns useful @@ -95,9 +95,9 @@ async function DecodeVinValuesExtended( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: vin, params }) + createCachedUrl({ endpointName, path: vin, params }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/DecodeWMI.ts b/packages/lib/src/api/endpoints/DecodeWMI.ts index 2ae770eb0..3c988c4df 100644 --- a/packages/lib/src/api/endpoints/DecodeWMI.ts +++ b/packages/lib/src/api/endpoints/DecodeWMI.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [DecodeWMI Documentation](/api/decode-wmi) + * See: [DecodeWMI Documentation](/api/endpoints/decode-wmi) * ::: * * `DecodeWMI` provides information on the World Manufacturer Identifier for a specific `WMI` code. @@ -54,9 +54,9 @@ async function DecodeWMI( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: WMI }) + createCachedUrl({ endpointName, path: WMI }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetAllMakes.ts b/packages/lib/src/api/endpoints/GetAllMakes.ts index 3a32d1155..b1aae13ac 100644 --- a/packages/lib/src/api/endpoints/GetAllMakes.ts +++ b/packages/lib/src/api/endpoints/GetAllMakes.ts @@ -9,7 +9,7 @@ import type { NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetAllMakes Documentation](/api/get-all-makes) + * See: [GetAllMakes Documentation](/api/endpoints/get-all-makes) * ::: * * `GetAllMakes` provides a list of all the Makes available in the vPIC Dataset. @@ -34,9 +34,9 @@ async function GetAllMakes( const endpointName = 'GetAllMakes' try { - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName }) + createCachedUrl({ endpointName }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetAllManufacturers.ts b/packages/lib/src/api/endpoints/GetAllManufacturers.ts index a0e5edf7b..1ef6de486 100644 --- a/packages/lib/src/api/endpoints/GetAllManufacturers.ts +++ b/packages/lib/src/api/endpoints/GetAllManufacturers.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetAllManufacturers Documentation](/api/get-all-manufacturers) + * See: [GetAllManufacturers Documentation](/api/endpoints/get-all-manufacturers) * ::: * * `GetAllManufacturers` provides a list of all the Manufacturers available in the vPIC Dataset. @@ -89,9 +89,9 @@ async function GetAllManufacturers( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, params }) + createCachedUrl({ endpointName, params }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetCanadianVehicleSpecifications.ts b/packages/lib/src/api/endpoints/GetCanadianVehicleSpecifications.ts index 9c3ee8587..7813e9702 100644 --- a/packages/lib/src/api/endpoints/GetCanadianVehicleSpecifications.ts +++ b/packages/lib/src/api/endpoints/GetCanadianVehicleSpecifications.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetCanadianVehicleSpecifications Documentation](/api/get-canadian-vehicle-specifications) + * See: [GetCanadianVehicleSpecifications Documentation](/api/endpoints/get-canadian-vehicle-specifications) * ::: * * `GetCanadianVehicleSpecifications` returns data from the Canadian Vehicle Specifications (CVS). @@ -89,9 +89,9 @@ async function GetCanadianVehicleSpecifications( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ + createCachedUrl({ endpointName, params: { make: '', diff --git a/packages/lib/src/api/endpoints/GetEquipmentPlantCodes.ts b/packages/lib/src/api/endpoints/GetEquipmentPlantCodes.ts index 1414b3447..8542bffd2 100644 --- a/packages/lib/src/api/endpoints/GetEquipmentPlantCodes.ts +++ b/packages/lib/src/api/endpoints/GetEquipmentPlantCodes.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetEquipmentPlantCodes Documentation](/api/get-equipment-plant-codes) + * See: [GetEquipmentPlantCodes Documentation](/api/endpoints/get-equipment-plant-codes) * ::: * * `GetEquipmentPlantCodes` returns assigned Equipment Plant Codes. Can be filtered by Year, @@ -85,9 +85,9 @@ async function GetEquipmentPlantCodes( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, params }) + createCachedUrl({ endpointName, params }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetMakeForManufacturer.ts b/packages/lib/src/api/endpoints/GetMakeForManufacturer.ts index 7a5199255..3acf0c84b 100644 --- a/packages/lib/src/api/endpoints/GetMakeForManufacturer.ts +++ b/packages/lib/src/api/endpoints/GetMakeForManufacturer.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetMakeForManufacturer Documentation](/api/get-make-for-manufacturer) + * See: [GetMakeForManufacturer Documentation](/api/endpoints/get-make-for-manufacturer) * ::: * * `GetMakeForManufacturer` returns all the Makes in the vPIC dataset for a specified manufacturer @@ -55,9 +55,9 @@ async function GetMakeForManufacturer( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: manufacturer.toString() }) + createCachedUrl({ endpointName, path: manufacturer.toString() }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetMakesForManufacturerAndYear.ts b/packages/lib/src/api/endpoints/GetMakesForManufacturerAndYear.ts index 15f39236e..99f9a3def 100644 --- a/packages/lib/src/api/endpoints/GetMakesForManufacturerAndYear.ts +++ b/packages/lib/src/api/endpoints/GetMakesForManufacturerAndYear.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetMakesForManufacturerAndYear Documentation](/api/get-makes-for-manufacturer-and-year) + * See: [GetMakesForManufacturerAndYear Documentation](/api/endpoints/get-makes-for-manufacturer-and-year) * ::: * * `GetMakesForManufacturerAndYear` returns all the Makes in the vPIC dataset for a specified @@ -79,9 +79,9 @@ async function GetMakesForManufacturerAndYear( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ + createCachedUrl({ endpointName, path: manufacturer.toString(), params, diff --git a/packages/lib/src/api/endpoints/GetMakesForVehicleType.ts b/packages/lib/src/api/endpoints/GetMakesForVehicleType.ts index 5e9374139..af1cd3b4b 100644 --- a/packages/lib/src/api/endpoints/GetMakesForVehicleType.ts +++ b/packages/lib/src/api/endpoints/GetMakesForVehicleType.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetMakesForVehicleType Documentation](/api/get-makes-for-vehicle-type) + * See: [GetMakesForVehicleType Documentation](/api/endpoints/get-makes-for-vehicle-type) * ::: * * `GetMakesForVehicleType` returns all the Makes in the vPIC dataset for a specified vehicle type @@ -51,9 +51,9 @@ async function GetMakesForVehicleType( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: typeName }) + createCachedUrl({ endpointName, path: typeName }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetManufacturerDetails.ts b/packages/lib/src/api/endpoints/GetManufacturerDetails.ts index b57c6aaa2..3864bd2bc 100644 --- a/packages/lib/src/api/endpoints/GetManufacturerDetails.ts +++ b/packages/lib/src/api/endpoints/GetManufacturerDetails.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetMakesForVehicleType Documentation](/api/get-makes-for-vehicle-type) + * See: [GetMakesForVehicleType Documentation](/api/endpoints/get-makes-for-vehicle-type) * ::: * * `GetManufacturerDetails` provides the details for a specific manufacturer that is requested. @@ -55,9 +55,9 @@ async function GetManufacturerDetails( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: manufacturer.toString() }) + createCachedUrl({ endpointName, path: manufacturer.toString() }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetModelsForMake.ts b/packages/lib/src/api/endpoints/GetModelsForMake.ts index 93c193ee6..2c0ca311e 100644 --- a/packages/lib/src/api/endpoints/GetModelsForMake.ts +++ b/packages/lib/src/api/endpoints/GetModelsForMake.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetModelsForMake Documentation](/api/get-models-for-make) + * See: [GetModelsForMake Documentation](/api/endpoints/get-models-for-make) * ::: * * `GetModelsForMake` returns the Models in the vPIC dataset for a specified `makeName` @@ -49,9 +49,9 @@ async function GetModelsForMake( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: makeName }) + createCachedUrl({ endpointName, path: makeName }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetModelsForMakeId.ts b/packages/lib/src/api/endpoints/GetModelsForMakeId.ts index 24d6635d4..a9470d0b9 100644 --- a/packages/lib/src/api/endpoints/GetModelsForMakeId.ts +++ b/packages/lib/src/api/endpoints/GetModelsForMakeId.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetModelsForMakeId Documentation](/api/get-models-for-make-id) + * See: [GetModelsForMakeId Documentation](/api/endpoints/get-models-for-make-id) * ::: * * `GetModelsForMakeId` returns the Models in the vPIC dataset for a specified Make whose ID is @@ -65,9 +65,9 @@ async function GetModelsForMakeId( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: makeId.toString() }) + createCachedUrl({ endpointName, path: makeId.toString() }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetModelsForMakeIdYear.ts b/packages/lib/src/api/endpoints/GetModelsForMakeIdYear.ts index 3234c4768..78a174bd5 100644 --- a/packages/lib/src/api/endpoints/GetModelsForMakeIdYear.ts +++ b/packages/lib/src/api/endpoints/GetModelsForMakeIdYear.ts @@ -13,7 +13,7 @@ import type { IArgToValidate, NhtsaResponse, AtLeastOne } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetModelsForMakeIdYear Documentation](/api/get-models-for-make-id-year) + * See: [GetModelsForMakeIdYear Documentation](/api/endpoints/get-models-for-make-id-year) * ::: * * `GetModelsForMakeIdYear` returns the Models in the vPIC dataset for a specified Model Year @@ -130,9 +130,9 @@ async function GetModelsForMakeIdYear( ? `${modelYear ? '/' : ''}vehicleType/${vehicleType}` : '' - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path }) + createCachedUrl({ endpointName, path }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetModelsForMakeYear.ts b/packages/lib/src/api/endpoints/GetModelsForMakeYear.ts index c5ed529d1..2ec51f5bc 100644 --- a/packages/lib/src/api/endpoints/GetModelsForMakeYear.ts +++ b/packages/lib/src/api/endpoints/GetModelsForMakeYear.ts @@ -13,7 +13,7 @@ import type { NhtsaResponse, IArgToValidate, AtLeastOne } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetModelsForMakeYear Documentation](/api/get-models-for-make-year) + * See: [GetModelsForMakeYear Documentation](/api/endpoints/get-models-for-make-year) * ::: * * `GetModelsForMakeYear` returns the Models in the vPIC dataset for a specified Model Year and @@ -111,9 +111,9 @@ async function GetModelsForMakeYear( ? `${modelYear ? '/' : ''}vehicleType/${vehicleType}` : '' - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path }) + createCachedUrl({ endpointName, path }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetParts.ts b/packages/lib/src/api/endpoints/GetParts.ts index 541dc7aec..7d857a325 100644 --- a/packages/lib/src/api/endpoints/GetParts.ts +++ b/packages/lib/src/api/endpoints/GetParts.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetParts Documentation](/api/get-parts) + * See: [GetParts Documentation](/api/endpoints/get-parts) * ::: * * `GetParts` provides a list of ORGs with letter date in the given range of the dates and with @@ -121,9 +121,9 @@ async function GetParts( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, params }) + createCachedUrl({ endpointName, params }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetVehicleTypesForMake.ts b/packages/lib/src/api/endpoints/GetVehicleTypesForMake.ts index 30b58e062..846dae1fa 100644 --- a/packages/lib/src/api/endpoints/GetVehicleTypesForMake.ts +++ b/packages/lib/src/api/endpoints/GetVehicleTypesForMake.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetVehicleTypesForMake Documentation](/api/get-vehicle-types-for-make) + * See: [GetVehicleTypesForMake Documentation](/api/endpoints/get-vehicle-types-for-make) * ::: * * `GetVehicleTypesForMake` returns all the Vehicle Types in the vPIC dataset for a specified Make, @@ -51,9 +51,9 @@ async function GetVehicleTypesForMake( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: makeName }) + createCachedUrl({ endpointName, path: makeName }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetVehicleTypesForMakeId.ts b/packages/lib/src/api/endpoints/GetVehicleTypesForMakeId.ts index 41c692275..bf27a14d6 100644 --- a/packages/lib/src/api/endpoints/GetVehicleTypesForMakeId.ts +++ b/packages/lib/src/api/endpoints/GetVehicleTypesForMakeId.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetVehicleTypesForMakeId Documentation](/api/get-vehicle-types-for-make-id) + * See: [GetVehicleTypesForMakeId Documentation](/api/endpoints/get-vehicle-types-for-make-id) * ::: * * `GetVehicleTypesForMakeId` returns the Models in the vPIC dataset for a specified Make @@ -65,9 +65,9 @@ async function GetVehicleTypesForMakeId( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: makeId.toString() }) + createCachedUrl({ endpointName, path: makeId.toString() }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetVehicleVariableList.ts b/packages/lib/src/api/endpoints/GetVehicleVariableList.ts index 32d91833e..a8b57a1a0 100644 --- a/packages/lib/src/api/endpoints/GetVehicleVariableList.ts +++ b/packages/lib/src/api/endpoints/GetVehicleVariableList.ts @@ -9,7 +9,7 @@ import type { NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetVehicleVariableList Documentation](/api/get-vehicle-variable-list) + * See: [GetVehicleVariableList Documentation](/api/endpoints/get-vehicle-variable-list) * ::: * * `GetVehicleVariableList` provides a list of all the Vehicle related variables that are in the @@ -32,9 +32,9 @@ async function GetVehicleVariableList( const endpointName = 'GetVehicleVariableList' try { - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName }) + createCachedUrl({ endpointName }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetVehicleVariableValuesList.ts b/packages/lib/src/api/endpoints/GetVehicleVariableValuesList.ts index ebb781939..08349d61a 100644 --- a/packages/lib/src/api/endpoints/GetVehicleVariableValuesList.ts +++ b/packages/lib/src/api/endpoints/GetVehicleVariableValuesList.ts @@ -9,7 +9,7 @@ import type { IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetVehicleVariableValuesList Documentation](/api/get-vehicle-variable-values-list) + * See: [GetVehicleVariableValuesList Documentation](/api/endpoints/get-vehicle-variable-values-list) * ::: * * `GetVehicleVariableValuesList` provides a list of all the accepted values for a given variable @@ -53,9 +53,9 @@ async function GetVehicleVariableValuesList( ] catchInvalidArguments({ args }) - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: variableValue.toString() }) + createCachedUrl({ endpointName, path: variableValue.toString() }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/endpoints/GetWMIsForManufacturer.ts b/packages/lib/src/api/endpoints/GetWMIsForManufacturer.ts index 475845a79..e31e41840 100644 --- a/packages/lib/src/api/endpoints/GetWMIsForManufacturer.ts +++ b/packages/lib/src/api/endpoints/GetWMIsForManufacturer.ts @@ -9,7 +9,7 @@ import type { AtLeastOne, IArgToValidate, NhtsaResponse } from '@/types' /** * ::: tip :bulb: More Information - * See: [GetWMIsForManufacturer Documentation](/api/get-wmis-for-manufacturer) + * See: [GetWMIsForManufacturer Documentation](/api/endpoints/get-wmis-for-manufacturer) * ::: * * `GetWMIsForManufacturer` provides information on the World Manufacturer Identifier (WMI) for a @@ -97,9 +97,13 @@ async function GetWMIsForManufacturer( : '' const vehicleType = params?.vehicleType || '' - const { get, cacheUrl, getCachedUrl } = useNHTSA() + const { get, createCachedUrl, getCachedUrl } = useNHTSA() - cacheUrl({ endpointName, path: manufacturer, params: { vehicleType } }) + createCachedUrl({ + endpointName, + path: manufacturer, + params: { vehicleType }, + }) if (!doFetch) { return getCachedUrl() diff --git a/packages/lib/src/api/useNHTSA.ts b/packages/lib/src/api/useNHTSA.ts index 9ee3c5a26..a5d9de312 100644 --- a/packages/lib/src/api/useNHTSA.ts +++ b/packages/lib/src/api/useNHTSA.ts @@ -22,28 +22,29 @@ export type CreateUrlOptions = { } /** - *This is the main composable function that is used to make requests to the NHTSA API. + * `useNHTSA` returns a composable object containing helper functions for working with the VPIC + * API. It is used internally by the package and by users to make direct requests to the VPIC API. * - * `useNHTSA` is a composable function that returns an object containing methods for making HTTP - * requests to the NHTSA API. All request methods return a Promise that resolves to an object - * containing the response data, see [NhtsaApiResponse](#TODO-LINK-TO-DOCS) type. + * It returns an object containing methods for making HTTP requests to the VPIC API. All + * request methods return a Promise that resolves to an object containing the full response data. * - * Pleas see the [`/api` README](https://github.com/shaggytech/nhtsa-api-wrapper/packages/lib/src/api) - * for more information on the exported methods and how to use them. + * The functions returned by the composable are: * - * --- + * - `createCachedUrl` - Builds the URL string and stores it in internal state * - * The exported methods are: + * - `getCachedUrl` - Gets the URL stored in internal state * - * - `get` - Makes a GET request, uses the internal url variable if no URL is provided + * - `setCachedUrl` - Directly sets the URL internal state, does not check if URL is valid * - * - `post` - Makes a POST request, uses the internal url variable if no URL is provided + * - `clearCachedUrl` - Clears the URL stored in internal state * - * - `cacheUrl` - Builds the URL string and stores it in internal state + * - `createUrl` - Returns a built URL string but does not store it in internal state * - * - `createUrl` - Builds the URL string but does not store it in internal state + * - `createPostBody` - Creates a POST body string from an object of key/value pairs * - * - `getCachedUrl` - Returns the internal URL string + * - `get` - Makes a GET request, uses the internal url variable if no URL is provided + * + * - `post` - Makes a POST request, uses the internal url variable if no URL is provided * */ export const useNHTSA = () => { @@ -95,7 +96,7 @@ export const useNHTSA = () => { * (default: true) * @returns {string} VPIC API URL string */ - const cacheUrl = (input: CreateUrlOptions | string): string => { + const createCachedUrl = (input: CreateUrlOptions | string): string => { if (typeof input === 'string') { setCachedUrl(input) return input @@ -130,12 +131,12 @@ export const useNHTSA = () => { } /** - * Simply a wrapper for `cacheUrl` with `saveUrl` set to false. + * Simply a wrapper for `createCachedUrl` with `saveUrl` set to false. * * Takes an object of type `CreateUrlOptions` as an argument and returns a full VPIC URL string. * * This builds the VPIC URL string but does not set it as a private cached variable of the - * composable. Use `cacheUrl` if you need to save the URL in the composable instance. + * composable. Use `createCachedUrl` if you need to save the URL in the composable instance. * * @param options Object of type `CreateUrlOptions` containing the following properties: * @param {string} options.endpointName - Name of the endpoint to use in the URL (required) @@ -149,7 +150,7 @@ export const useNHTSA = () => { * @returns {string} VPIC API URL string */ const createUrl = (options: CreateUrlOptions) => { - return cacheUrl({ ...options, saveUrl: false }) + return createCachedUrl({ ...options, saveUrl: false }) } /** Function to create final POST body string from a VPIC data string */ @@ -179,8 +180,8 @@ export const useNHTSA = () => { * `url` - either a full url `string` or an `object` of type `CreateUrlOptions` * * - `required` if there is no url cached in the composable instance - * - if a `CreateUrlOptions` object is provided, `cacheUrl` will be called with the object to - * build and cache the url before making the request + * - if a `CreateUrlOptions` object is provided, `createCachedUrl` will be called with the object + * to build and cache the url before making the request * - if a string is provided, it is assumed the string is a full url and it will be cached in the * as such in the composable instance before making the request * @@ -220,7 +221,10 @@ export const useNHTSA = () => { ): Promise> => { /* If url is an object, create and store a url string from it */ if (url && getTypeof(url) === 'object') { - url = cacheUrl({ ...(url as CreateUrlOptions), saveUrl: options.saveUrl }) + url = createCachedUrl({ + ...(url as CreateUrlOptions), + saveUrl: options.saveUrl, + }) } url = getTypeof(url) === 'string' ? url : getCachedUrl() @@ -305,10 +309,10 @@ export const useNHTSA = () => { * `url` - either a full url `string` or an `object` of type `CreateUrlOptions` * * - `required` if there is no url cached in the composable instance - * - if a `CreateUrlOptions` object is provided, `cacheUrl` will be called with the object to - * build and cache the url before making the request - * - if a string is provided, it is assumed the string is a full url and it will be cached in the - * as such in the composable instance before making the request + * - if a `CreateUrlOptions` object is provided, `createCachedUrl` will be called with the object + * to build and cache the url before making the request + * - if a string is provided, it is assumed the string is a full url and it will be cached as such + * in the composable instance before making the request * * ### Options * @@ -346,7 +350,7 @@ export const useNHTSA = () => { /* If url is an object, create and store a url string from it */ if (url && getTypeof(url) === 'object') { /* POST requests should not include query string */ - url = cacheUrl({ + url = createCachedUrl({ ...(url as CreateUrlOptions), saveUrl: options.saveUrl, includeQueryString: false, @@ -389,7 +393,7 @@ export const useNHTSA = () => { setCachedUrl, getCachedUrl, clearCachedUrl, - cacheUrl, + createCachedUrl, createUrl, createPostBody, get, diff --git a/packages/lib/src/utils/queryString.ts b/packages/lib/src/utils/queryString.ts index 66c9a03cd..1aa24f113 100644 --- a/packages/lib/src/utils/queryString.ts +++ b/packages/lib/src/utils/queryString.ts @@ -16,6 +16,9 @@ export type QueryStringParams = Record export type QueryStringParamsEncoded = { [key in keyof T]: string } /** + * This function is used internally by other package functions. As a consumer of this package, you + * should not need to use this function directly in most cases. + * * Utility function to perform URI component encoding on all values in an object, for use in URL * query strings. * @@ -68,22 +71,25 @@ export const encodeQueryStringParams = ( } /** + * This function is used internally by other package functions. As a consumer of this package, you + * should not need to use this function directly in most cases. + * * Utility function to generate a query string conforming to URI component standards. Takes an an * optional object of search parameters and returns an encoded query string. * - * The parameter `{ format: 'json' }` is hardcoded and cannot be overridden, this package provides - * no support for CSV or XML formats at this time. The default query string will be "?format=json" - * even if no `params` are provided by user. + * This function will always override `params.format` with `{ format: 'json' }`. This is hardcoded + * into the package and cannot be overridden, this package provides no support for CSV or XML + * formats at this time. This means the default query string will be `"?format=json"` even if no + * `params` are provided by user. * * - Ignores parameters that are not strings, numbers, or booleans, and also ignores empty strings * by default. - * - If first argument is not an object then it will be ignored. - * - If second argument `allowEmptyParams` is set to `true`, the function will include keys with - * empty string values, e.g. 'emptyKey=' * - * This function is not exported by the package, but is used internally by other - * functions. However, it _is_ exported by the package as part of the composable function - * `useQueryString`, and renamed to `createString` for less verbose use. + * - If you don't provide an object as the first argument, an error will be thrown. Providing an + * empty object will not throw an error. + * + * - If the second argument, `allowEmptyParams`, is set to `true`, the function will include keys + * with empty string values in the final query string, e.g. 'emptyKey='. * * @param {QueryStringParams} params - An object of search parameters to be converted to a query * string. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5d6543ed2..a25131dd2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,6 +51,12 @@ importers: rimraf: specifier: 4.4.1 version: 4.4.1 + sass: + specifier: 1.62.1 + version: 1.62.1 + sitemap: + specifier: 7.1.1 + version: 7.1.1 tsconfig: specifier: workspace:* version: link:../../config/tsconfig @@ -59,7 +65,7 @@ importers: version: 5.0.3 vitepress: specifier: 1.0.0-alpha.64 - version: 1.0.0-alpha.64(@algolia/client-search@4.16.0)(@types/node@18.15.11) + version: 1.0.0-alpha.64(@algolia/client-search@4.16.0)(@types/node@18.15.11)(sass@1.62.1) config/eslint-config-custom: dependencies: @@ -104,11 +110,11 @@ importers: config/typedoc-config: devDependencies: typedoc: - specifier: 0.23.28 - version: 0.23.28(typescript@5.0.3) + specifier: 0.24.4 + version: 0.24.4(typescript@5.0.3) typedoc-plugin-markdown: - specifier: 3.14.0 - version: 3.14.0(typedoc@0.23.28) + specifier: 3.15.1 + version: 3.15.1(typedoc@0.24.4) typescript: specifier: 5.0.3 version: 5.0.3 @@ -140,8 +146,8 @@ importers: specifier: workspace:* version: link:../../config/tsconfig typedoc: - specifier: 0.23.28 - version: 0.23.28(typescript@5.0.3) + specifier: 0.24.4 + version: 0.24.4(typescript@5.0.3) typedoc-config: specifier: workspace:* version: link:../../config/typedoc-config @@ -150,7 +156,7 @@ importers: version: 5.0.3 vite: specifier: 4.2.1 - version: 4.2.1(@types/node@18.15.11) + version: 4.2.1(@types/node@18.15.11)(sass@1.62.1) vite-plugin-dts: specifier: 2.1.0 version: 2.1.0(@types/node@18.15.11)(vite@4.2.1) @@ -1218,12 +1224,22 @@ packages: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: false + /@types/node@17.0.45: + resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} + dev: true + /@types/node@18.15.11: resolution: {integrity: sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==} /@types/normalize-package-data@2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} + /@types/sax@1.2.4: + resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} + dependencies: + '@types/node': 18.15.11 + dev: true + /@types/semver@6.2.3: resolution: {integrity: sha512-KQf+QAMWKMrtBMsB8/24w53tEsxllMj6TuA80TT/5igJalLI/zm0L3oXRbIAl4Ohfc85gyHX/jhMwsVkmhLU4A==} dev: false @@ -1377,7 +1393,7 @@ packages: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.2.1(@types/node@18.15.11) + vite: 4.2.1(@types/node@18.15.11)(sass@1.62.1) vue: 3.2.47 dev: true @@ -1636,10 +1652,22 @@ packages: engines: {node: '>=12'} dev: true + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + /arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} dev: true + /arg@5.0.2: + resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} + dev: true + /argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: @@ -1697,6 +1725,11 @@ packages: is-windows: 1.0.2 dev: false + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + /body-scroll-lock@4.0.0-beta.0: resolution: {integrity: sha512-a7tP5+0Mw3YlUJcGAKUqIBkYYGlYxk2fnCasq/FUph1hadxlTRjF+gAcZksxANnaMnALjxEddmSi/H3OR8ugcQ==} dev: true @@ -1820,6 +1853,21 @@ packages: resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==} dev: true + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.2 + dev: true + /ci-info@3.8.0: resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} engines: {node: '>=8'} @@ -2681,7 +2729,7 @@ packages: engines: {node: '>=0.4.7'} hasBin: true dependencies: - minimist: 1.2.7 + minimist: 1.2.8 neo-async: 2.6.2 source-map: 0.6.1 wordwrap: 1.0.0 @@ -2774,6 +2822,10 @@ packages: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} + /immutable@4.3.0: + resolution: {integrity: sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==} + dev: true + /import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} @@ -2844,6 +2896,13 @@ packages: has-bigints: 1.0.2 dev: false + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + /is-boolean-object@1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} @@ -3345,15 +3404,15 @@ packages: brace-expansion: 2.0.1 dev: true - /minimatch@7.4.4: - resolution: {integrity: sha512-T+8B3kNrLP7jDb5eaC4rUIp6DKoeTSb6f9SwF2phcY2gxJUA0GEf1i29/FHxBMEfx0ppWlr434/D0P+6jb8bOQ==} - engines: {node: '>=10'} + /minimatch@8.0.2: + resolution: {integrity: sha512-ikHGF67ODxj7vS5NKU2wvTsFLbExee+KXVCnBWh8Cg2hVJfBMQIrlo50qru/09E0EifjnU8dZhJ/iHhyXJM6Mw==} + engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 dev: true - /minimatch@8.0.2: - resolution: {integrity: sha512-ikHGF67ODxj7vS5NKU2wvTsFLbExee+KXVCnBWh8Cg2hVJfBMQIrlo50qru/09E0EifjnU8dZhJ/iHhyXJM6Mw==} + /minimatch@9.0.0: + resolution: {integrity: sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==} engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 @@ -3367,10 +3426,6 @@ packages: is-plain-obj: 1.1.0 kind-of: 6.0.3 - /minimist@1.2.7: - resolution: {integrity: sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==} - dev: true - /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} dev: true @@ -3454,6 +3509,11 @@ packages: validate-npm-package-license: 3.0.4 dev: true + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + /npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -3758,6 +3818,13 @@ packages: util-deprecate: 1.0.2 dev: true + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /redent@3.0.0: resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} engines: {node: '>=8'} @@ -3868,6 +3935,20 @@ packages: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: false + /sass@1.62.1: + resolution: {integrity: sha512-NHpxIzN29MXvWiuswfc1W3I0N8SXBd8UR26WntmDlRYf0bSADnwnOjsyMZ3lMezSlArD33Vs3YFhp7dWvL770A==} + engines: {node: '>=14.0.0'} + hasBin: true + dependencies: + chokidar: 3.5.3 + immutable: 4.3.0 + source-map-js: 1.0.2 + dev: true + + /sax@1.2.4: + resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==} + dev: true + /semver@5.7.1: resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} hasBin: true @@ -3943,6 +4024,17 @@ packages: totalist: 3.0.0 dev: true + /sitemap@7.1.1: + resolution: {integrity: sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==} + engines: {node: '>=12.0.0', npm: '>=5.6.0'} + hasBin: true + dependencies: + '@types/node': 17.0.45 + '@types/sax': 1.2.4 + arg: 5.0.2 + sax: 1.2.4 + dev: true + /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -4394,17 +4486,17 @@ packages: is-typed-array: 1.1.10 dev: false - /typedoc-plugin-markdown@3.14.0(typedoc@0.23.28): - resolution: {integrity: sha512-UyQLkLRkfTFhLdhSf3RRpA3nNInGn+k6sll2vRXjflaMNwQAAiB61SYbisNZTg16t4K1dt1bPQMMGLrxS0GZ0Q==} + /typedoc-plugin-markdown@3.15.1(typedoc@0.24.4): + resolution: {integrity: sha512-TaXE8gc8s5YepU1Ogyqfkh+khPE1/n4rV5vaoZCNyXvSLv62jWmHf443lHiQh7r07qAimUOKAndaaufAeIUSiQ==} peerDependencies: - typedoc: '>=0.23.0' + typedoc: '>=0.24.0' dependencies: handlebars: 4.7.7 - typedoc: 0.23.28(typescript@5.0.3) + typedoc: 0.24.4(typescript@5.0.3) dev: true - /typedoc@0.23.28(typescript@5.0.3): - resolution: {integrity: sha512-9x1+hZWTHEQcGoP7qFmlo4unUoVJLB0H/8vfO/7wqTnZxg4kPuji9y3uRzEu0ZKez63OJAUmiGhUrtukC6Uj3w==} + /typedoc@0.24.4(typescript@5.0.3): + resolution: {integrity: sha512-vQuliyGhJEGeKzzCFHbkS3m0gHoIL6cfr0fHf6eX658iGELtq2J9mWe0b+X5McEYgFoMuHFt5Py3Zug6Sxjn/Q==} engines: {node: '>= 14.14'} hasBin: true peerDependencies: @@ -4412,7 +4504,7 @@ packages: dependencies: lunr: 2.3.9 marked: 4.3.0 - minimatch: 7.4.4 + minimatch: 9.0.0 shiki: 0.14.1 typescript: 5.0.3 dev: true @@ -4507,7 +4599,7 @@ packages: mlly: 1.2.0 pathe: 1.1.0 picocolors: 1.0.0 - vite: 4.2.1(@types/node@18.15.11) + vite: 4.2.1(@types/node@18.15.11)(sass@1.62.1) transitivePeerDependencies: - '@types/node' - less @@ -4534,7 +4626,7 @@ packages: kolorist: 1.7.0 magic-string: 0.29.0 ts-morph: 17.0.1 - vite: 4.2.1(@types/node@18.15.11) + vite: 4.2.1(@types/node@18.15.11)(sass@1.62.1) transitivePeerDependencies: - '@types/node' - rollup @@ -4552,13 +4644,13 @@ packages: debug: 4.3.4 globrex: 0.1.2 tsconfck: 2.1.1(typescript@5.0.3) - vite: 4.2.1(@types/node@18.15.11) + vite: 4.2.1(@types/node@18.15.11)(sass@1.62.1) transitivePeerDependencies: - supports-color - typescript dev: true - /vite@4.2.1(@types/node@18.15.11): + /vite@4.2.1(@types/node@18.15.11)(sass@1.62.1): resolution: {integrity: sha512-7MKhqdy0ISo4wnvwtqZkjke6XN4taqQ2TBaTccLIpOKv7Vp2h4Y+NpmWCnGDeSvvn45KxvWgGyb0MkHvY1vgbg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -4588,11 +4680,12 @@ packages: postcss: 8.4.21 resolve: 1.22.1 rollup: 3.20.2 + sass: 1.62.1 optionalDependencies: fsevents: 2.3.2 dev: true - /vitepress@1.0.0-alpha.64(@algolia/client-search@4.16.0)(@types/node@18.15.11): + /vitepress@1.0.0-alpha.64(@algolia/client-search@4.16.0)(@types/node@18.15.11)(sass@1.62.1): resolution: {integrity: sha512-u12wcDH4VzgxxkQfVQWkXumrL3WRetpenz4VuAtiMWXeZSCayWcJtieWOFxmX/RzS2KEuTJpXGbtJAXORyyJBQ==} hasBin: true dependencies: @@ -4603,7 +4696,7 @@ packages: '@vueuse/core': 9.13.0(vue@3.2.47) body-scroll-lock: 4.0.0-beta.0 shiki: 0.14.1 - vite: 4.2.1(@types/node@18.15.11) + vite: 4.2.1(@types/node@18.15.11)(sass@1.62.1) vue: 3.2.47 transitivePeerDependencies: - '@algolia/client-search' @@ -4684,7 +4777,7 @@ packages: tinybench: 2.4.0 tinypool: 0.4.0 tinyspy: 1.1.1 - vite: 4.2.1(@types/node@18.15.11) + vite: 4.2.1(@types/node@18.15.11)(sass@1.62.1) vite-node: 0.29.8(@types/node@18.15.11) why-is-node-running: 2.2.2 transitivePeerDependencies: