From 6250114d04ab3b34f5ab98d37c91ba24a9733f1b Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Fri, 9 Oct 2026 20:32:55 -0500 Subject: [PATCH] Add a generated API reference to the docs site Generate Markdown API docs from the JSDoc in src/ with TypeDoc, typedoc-plugin-markdown, and typedoc-vitepress-theme on every docs build, and add them to the VitePress nav and sidebar. TypeDoc does not support TypeScript 7 yet, so it lives in its own workspace package (docs/typedoc) with TypeScript 6. Installing it in the docs package would create a second Vite+ core instance for VitePress and its plugins. - Export public types that appear in signatures but were not importable: GetRequestOptions, GroupRateLimiterOptions, CacheEntry, Counter, IObjectEvent, Link, and Links - Inline the internal Fetch alias in FetchClientOptions - Fix stale @param tags and name the two entry-point modules - Fix the VitePress 2 peer rule so it matches prereleases Co-Authored-By: Claude Opus 5.5 --- docs/.gitignore | 1 + docs/.vitepress/config.ts | 10 +- docs/guide/configuration.md | 4 +- docs/guide/contributing.md | 3 + docs/package.json | 6 +- docs/typedoc/package.json | 16 +++ docs/typedoc/tsconfig.json | 4 + docs/typedoc/typedoc.json | 15 +++ pnpm-lock.yaml | 207 +++++++++++++++++++++++++++++------- pnpm-workspace.yaml | 3 +- src/FetchClient.ts | 2 +- src/FetchClientCache.ts | 2 +- src/FetchClientOptions.ts | 4 +- src/RateLimiter.ts | 1 - src/index.ts | 27 ++++- src/mocks/index.ts | 2 +- 16 files changed, 255 insertions(+), 52 deletions(-) create mode 100644 docs/typedoc/package.json create mode 100644 docs/typedoc/tsconfig.json create mode 100644 docs/typedoc/typedoc.json diff --git a/docs/.gitignore b/docs/.gitignore index c76bc00..c87570d 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,3 +1,4 @@ node_modules/ .vitepress/cache/ .vitepress/dist/ +api/ diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 35c70f9..6d40bc8 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,7 +1,13 @@ -import { defineConfig } from "vitepress"; +import { readFileSync } from "node:fs"; +import { type DefaultTheme, defineConfig } from "vitepress"; import llmstxt from "vitepress-plugin-llms"; import { withMermaid } from "vitepress-plugin-mermaid"; +// Generated by docs/typedoc before every docs build. +const typedocSidebar: DefaultTheme.SidebarItem[] = JSON.parse( + readFileSync(new URL("../api/typedoc-sidebar.json", import.meta.url), "utf8"), +); + export default withMermaid( defineConfig({ title: "Foundatio FetchClient", @@ -38,9 +44,11 @@ export default withMermaid( siteTitle: "FetchClient", nav: [ { text: "Guide", link: "/guide/what-is-fetchclient" }, + { text: "API", link: "/api/" }, { text: "GitHub", link: "https://github.com/FoundatioFx/FetchClient" }, ], sidebar: { + "/api/": [{ text: "API Reference", link: "/api/", items: typedocSidebar }], "/guide/": [ { text: "Introduction", diff --git a/docs/guide/configuration.md b/docs/guide/configuration.md index 7774531..744a0d4 100644 --- a/docs/guide/configuration.md +++ b/docs/guide/configuration.md @@ -260,4 +260,6 @@ export async function deleteUser(id: number) { For advanced use cases like connecting to multiple APIs with different configurations, you can create separate `FetchClientProvider` instances. Each provider has its own options, middleware, and cache, and -`provider.getFetchClient()` returns clients that use them. +`provider.getFetchClient()` returns clients that use them. See the +[`FetchClientProvider` API reference](/api/@foundatiofx/fetchclient/classes/FetchClientProvider) +for details. diff --git a/docs/guide/contributing.md b/docs/guide/contributing.md index 0af91eb..a1c7a55 100644 --- a/docs/guide/contributing.md +++ b/docs/guide/contributing.md @@ -22,6 +22,9 @@ The docs site in `docs/` is part of the pnpm workspace: - Dev: `vp run docs:dev` - Build: `vp run docs:build` +The [API reference](/api/) is generated from the JSDoc comments in `src/` by +TypeDoc on every docs build, so document public APIs in the source. + ## License MIT © Foundatio diff --git a/docs/package.json b/docs/package.json index b576aa0..35cb11b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,11 +5,13 @@ "description": "FetchClient Documentation", "type": "module", "scripts": { - "dev": "vitepress dev", - "build": "vitepress build", + "api": "vp run @foundatiofx/fetchclient-typedoc#build", + "dev": "vp run api && vitepress dev", + "build": "vp run api && vitepress build", "preview": "vitepress preview" }, "devDependencies": { + "@types/node": "^24.19.1", "mermaid": "^11.16.0", "vitepress": "^2.0.0-alpha.18", "vitepress-plugin-llms": "^1.13.4", diff --git a/docs/typedoc/package.json b/docs/typedoc/package.json new file mode 100644 index 0000000..a3f13bd --- /dev/null +++ b/docs/typedoc/package.json @@ -0,0 +1,16 @@ +{ + "name": "@foundatiofx/fetchclient-typedoc", + "version": "1.0.0", + "private": true, + "description": "Generates the FetchClient API reference for the docs site", + "type": "module", + "scripts": { + "build": "typedoc" + }, + "devDependencies": { + "typedoc": "^0.28.20", + "typedoc-plugin-markdown": "^4.13.1", + "typedoc-vitepress-theme": "^1.1.4", + "typescript": "~6.0.3" + } +} diff --git a/docs/typedoc/tsconfig.json b/docs/typedoc/tsconfig.json new file mode 100644 index 0000000..955761a --- /dev/null +++ b/docs/typedoc/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["../../src"] +} diff --git a/docs/typedoc/typedoc.json b/docs/typedoc/typedoc.json new file mode 100644 index 0000000..63695a4 --- /dev/null +++ b/docs/typedoc/typedoc.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "name": "API Reference", + "entryPoints": ["../../src/index.ts", "../../src/mocks/index.ts"], + "tsconfig": "./tsconfig.json", + "out": "../api", + "docsRoot": "..", + "plugin": ["typedoc-plugin-markdown", "typedoc-vitepress-theme"], + "readme": "none", + "excludePrivate": true, + "excludeInternal": true, + "disableGit": true, + "gitRevision": "main", + "sourceLinkTemplate": "https://github.com/FoundatioFx/FetchClient/blob/{gitRevision}/src/{path}#L{line}" +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bad493f..45ea817 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -189,25 +189,43 @@ importers: version: 7.0.2 vite-plus: specifier: 'catalog:' - version: 1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2) + version: 1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) zod: specifier: ^4.6.5 version: 4.6.5 docs: devDependencies: + '@types/node': + specifier: ^24.19.1 + version: 24.19.1 mermaid: specifier: ^11.16.0 version: 11.17.2 vitepress: specifier: ^2.0.0-alpha.18 - version: 2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2) + version: 2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) vitepress-plugin-llms: specifier: ^1.13.4 version: 1.14.0 vitepress-plugin-mermaid: specifier: ^2.0.17 - version: 2.0.17(mermaid@11.17.2)(vitepress@2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2)) + version: 2.0.17(mermaid@11.17.2)(vitepress@2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)) + + docs/typedoc: + devDependencies: + typedoc: + specifier: ^0.28.20 + version: 0.28.20(typescript@6.0.3) + typedoc-plugin-markdown: + specifier: ^4.13.1 + version: 4.13.1(typedoc@0.28.20(typescript@6.0.3)) + typedoc-vitepress-theme: + specifier: ^1.1.4 + version: 1.1.4(typedoc-plugin-markdown@4.13.1(typedoc@0.28.20(typescript@6.0.3)))(typedoc@0.28.20(typescript@6.0.3)) + typescript: + specifier: ~6.0.3 + version: 6.0.3 packages: @@ -278,6 +296,9 @@ packages: '@docsearch/sidepanel-js@4.7.1': resolution: {integrity: sha512-uyOKbC6rjHCZBVbLCSZVb1NDWzjbD27WqxTuRYnkTW717laEj2dX+W8Ho1fNHSyG4dqssIlPWlXdg+McGxxxxg==} + '@gerrit0/mini-shiki@3.23.0': + resolution: {integrity: sha512-bEMORlG0cqdjVyCEuU0cDQbORWX+kYCeo0kV1lbxF5bt4r7SID2l9bqsxJEM0zndaxpOUT7riCyIVEuqq/Ynxg==} + '@iconify-json/simple-icons@1.2.99': resolution: {integrity: sha512-kouZhqvUoNdxEe+lZksbJJZMCZv4b4Ob62O1GW3fcpz/I0mVPzM+9/Qf/DUuv5ns8l6c46D8M/ubhJjjbLp9HQ==} @@ -609,10 +630,16 @@ packages: resolution: {integrity: sha512-Ed6UdEj84LyYkwnxM5CvSMWAD+id9ExTYri0/+x41U9zrgNifPSS9lZm0JqBP0VfYI8yr8tY5nbNq9+p9R0kFA==} engines: {node: '>=20'} + '@shikijs/engine-oniguruma@3.23.0': + resolution: {integrity: sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==} + '@shikijs/engine-oniguruma@4.5.0': resolution: {integrity: sha512-dKVmbJecVdB9recl8a/CU4jdpNXyjJQrIcesIkpS70s5HS02ohpnCSpMUbotPnEUzbAcLQ+S4hwZYbkBBiTcJw==} engines: {node: '>=20'} + '@shikijs/langs@3.23.0': + resolution: {integrity: sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==} + '@shikijs/langs@4.5.0': resolution: {integrity: sha512-wwBTqwduXSz0X4v9Qa2EWeFaYJEw1clCncWjoRNQRbVDu3SPRTRWucnouYapKj3b8Q+sk/41Vbc4B5c8nuYzLA==} engines: {node: '>=20'} @@ -621,6 +648,9 @@ packages: resolution: {integrity: sha512-UM7ShlA8oz0OWxLLO8BmO9Ip6fVqdkt8yF0EH7nOCqHfrx1eEAzF0ZUVK7L+I8NEgeu1PEWSRlxaiPPeCb4iDg==} engines: {node: '>=20'} + '@shikijs/themes@3.23.0': + resolution: {integrity: sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==} + '@shikijs/themes@4.5.0': resolution: {integrity: sha512-zGb87H3UBbpuI4yoh5UguB1XbU+2BDU3kflM7UfZ+Cy2hWo9lBtqjSVK20gmLY6ukYl040hAypGXMgud9vul8Q==} engines: {node: '>=20'} @@ -629,6 +659,9 @@ packages: resolution: {integrity: sha512-LM7twi043qCC3gRyGQfjoC2/sowzbEltWuruyRtT3RlBlk1hKzWk9ETnU7RcDBoVWQBmC8Mebnr7p28W7kPoaA==} engines: {node: '>=20'} + '@shikijs/types@3.23.0': + resolution: {integrity: sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==} + '@shikijs/types@4.5.0': resolution: {integrity: sha512-drtPrtD8N0DENyD2cyt6Ajy+IWsiCLgMxODwLTpvH1UsN6a9jf90tNTPjqwHvA+0Lzu9e0txk8DjfqH1p9UJRw==} engines: {node: '>=20'} @@ -775,6 +808,9 @@ packages: '@types/ms@2.1.0': resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} + '@types/node@24.19.1': + resolution: {integrity: sha512-aS3/DG0oM05K0RIXXP+hKjinGG5IgSSVGzswZxW3O0sS3pH4/fycXundUC9XsszgKCk4gHXylTEK6hyFxVxnoQ==} + '@types/trusted-types@2.0.7': resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} @@ -1857,6 +1893,9 @@ packages: resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==} engines: {node: 20 || >=22} + lunr@2.3.9: + resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} + lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true @@ -2233,11 +2272,36 @@ packages: resolution: {integrity: sha512-JfJeIHke7y2egdGGgRAvpCwYFUsHlM2gPcrVOxFkznt/4uzQ7HFmvE63iFHVLBJNDuyDOQgijDK/tXH/f6Msjg==} engines: {node: '>=6.10'} + typedoc-plugin-markdown@4.13.1: + resolution: {integrity: sha512-d3jchJ4CyIrV9w9uozTSkfMYG8IEM1RvvGOaybJ/3rRporzoX7p0lprffo95GOGUviQqP0phjHJE3bY8PQbilA==} + engines: {node: '>= 18'} + peerDependencies: + typedoc: 0.28.x + + typedoc-vitepress-theme@1.1.4: + resolution: {integrity: sha512-RDFWSuFUYgHv8UYZnHRaTaep53+Tl/4dsl5EN+6laSdTFKp920KHdDNovHD1OKGqnJr47kXNwOM7LFj3IWMrtw==} + engines: {node: '>= 18'} + peerDependencies: + typedoc: 0.28.x + typedoc-plugin-markdown: '>=4.11.0' + + typedoc@0.28.20: + resolution: {integrity: sha512-uSKqkh8Cr48vllnEy+jdaAgOeR6Y+QCBW7usgUsKj7gJEfR7stw9U/fE49LBnj2tPRKPY0c0EBJSWe9Appmplg==} + engines: {node: '>= 18', pnpm: '>= 10'} + hasBin: true + peerDependencies: + typescript: 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x || 5.9.x || 6.0.x + typescript@5.6.1-rc: resolution: {integrity: sha512-E3b2+1zEFu84jB0YQi9BORDjz9+jGbwwy1Zi3G0LUNw7a7cePUrHMRNy8aPh53nXpkFGVHSxIZo5vKTfYaFiBQ==} engines: {node: '>=14.17'} hasBin: true + typescript@6.0.3: + resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} + engines: {node: '>=14.17'} + hasBin: true + typescript@7.0.2: resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==} engines: {node: '>=16.20.0'} @@ -2246,6 +2310,9 @@ packages: uc.micro@2.1.0: resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} @@ -2393,6 +2460,11 @@ packages: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} + yaml@2.9.1: + resolution: {integrity: sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==} + engines: {node: '>= 14.6'} + hasBin: true + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} @@ -2481,6 +2553,14 @@ snapshots: '@docsearch/sidepanel-js@4.7.1': {} + '@gerrit0/mini-shiki@3.23.0': + dependencies: + '@shikijs/engine-oniguruma': 3.23.0 + '@shikijs/langs': 3.23.0 + '@shikijs/themes': 3.23.0 + '@shikijs/types': 3.23.0 + '@shikijs/vscode-textmate': 10.0.2 + '@iconify-json/simple-icons@1.2.99': dependencies: '@iconify/types': 2.0.0 @@ -2681,11 +2761,20 @@ snapshots: '@shikijs/vscode-textmate': 10.0.2 oniguruma-to-es: 4.3.6 + '@shikijs/engine-oniguruma@3.23.0': + dependencies: + '@shikijs/types': 3.23.0 + '@shikijs/vscode-textmate': 10.0.2 + '@shikijs/engine-oniguruma@4.5.0': dependencies: '@shikijs/types': 4.5.0 '@shikijs/vscode-textmate': 10.0.2 + '@shikijs/langs@3.23.0': + dependencies: + '@shikijs/types': 3.23.0 + '@shikijs/langs@4.5.0': dependencies: '@shikijs/types': 4.5.0 @@ -2696,6 +2785,10 @@ snapshots: '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.5 + '@shikijs/themes@3.23.0': + dependencies: + '@shikijs/types': 3.23.0 + '@shikijs/themes@4.5.0': dependencies: '@shikijs/types': 4.5.0 @@ -2705,6 +2798,11 @@ snapshots: '@shikijs/core': 4.5.0 '@shikijs/types': 4.5.0 + '@shikijs/types@3.23.0': + dependencies: + '@shikijs/vscode-textmate': 10.0.2 + '@types/hast': 3.0.5 + '@shikijs/types@4.5.0': dependencies: '@shikijs/vscode-textmate': 10.0.2 @@ -2880,6 +2978,10 @@ snapshots: '@types/ms@2.1.0': {} + '@types/node@24.19.1': + dependencies: + undici-types: 7.24.6 + '@types/trusted-types@2.0.7': optional: true @@ -2954,18 +3056,18 @@ snapshots: d3-selection: 3.0.0 d3-transition: 3.0.1(d3-selection@3.0.0) - '@vitejs/plugin-vue@6.0.9(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(vue@3.5.43(typescript@7.0.2))': + '@vitejs/plugin-vue@6.0.9(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(vue@3.5.43(typescript@7.0.2))': dependencies: '@rolldown/pluginutils': 1.0.1 - vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)' + vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)' vue: 3.5.43(typescript@7.0.2) - '@vitest/browser-preview@5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)': + '@vitest/browser-preview@5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)(yaml@2.9.1)': dependencies: '@testing-library/dom': 10.4.2 '@testing-library/user-event': 14.6.7(@testing-library/dom@10.4.2) - '@vitest/browser': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3) - vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(publint@0.3.25)(typescript@7.0.2) + '@vitest/browser': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)(yaml@2.9.1) + vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) transitivePeerDependencies: - '@arethetypeswrong/core' - '@types/node' @@ -2992,17 +3094,17 @@ snapshots: - vue-tsc - yaml - '@vitest/browser@5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)': + '@vitest/browser@5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)(yaml@2.9.1)': dependencies: '@blazediff/core': 1.10.0 - '@vitest/mocker': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2) + '@vitest/mocker': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) '@vitest/ui': 5.0.3(vitest@5.0.3) '@vitest/utils': 5.0.3 magic-string: 1.4.3 pngjs: 7.0.0 sirv: 3.0.2 tinyrainbow: 3.2.0 - vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(publint@0.3.25)(typescript@7.0.2) + vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) ws: 8.22.0 transitivePeerDependencies: - '@arethetypeswrong/core' @@ -3040,9 +3142,9 @@ snapshots: obug: 2.2.1 std-env: 4.3.0 tinyrainbow: 3.2.0 - vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(publint@0.3.25)(typescript@7.0.2) + vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) optionalDependencies: - '@vitest/browser': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3) + '@vitest/browser': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)(yaml@2.9.1) '@vitest/istanbul-lib-coverage@1.0.2': {} @@ -3050,13 +3152,13 @@ snapshots: dependencies: '@vitest/istanbul-lib-coverage': 1.0.2 - '@vitest/mocker@5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)': + '@vitest/mocker@5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)': dependencies: '@jridgewell/trace-mapping': 0.3.31 '@vitest/spy': 5.0.3 estree-walker: 3.0.3 magic-string: 1.4.3 - vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)' + vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)' transitivePeerDependencies: - '@arethetypeswrong/core' - '@types/node' @@ -3101,7 +3203,7 @@ snapshots: pathe: 2.0.3 sirv: 3.0.2 tinyrainbow: 3.2.0 - vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(publint@0.3.25)(typescript@7.0.2) + vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) '@vitest/utils@5.0.3': dependencies: @@ -3109,7 +3211,7 @@ snapshots: convert-source-map: 2.0.0 tinyrainbow: 3.2.0 - '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)': + '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)': dependencies: '@oxc-project/runtime': 0.153.0 '@oxc-project/types': 0.153.0 @@ -3119,6 +3221,7 @@ snapshots: yuku-parser: 0.9.5 optionalDependencies: '@arethetypeswrong/core': 0.18.5 + '@types/node': 24.19.1 '@voidzero-dev/vite-plus-darwin-arm64': 1.1.0 '@voidzero-dev/vite-plus-darwin-x64': 1.1.0 '@voidzero-dev/vite-plus-linux-arm64-gnu': 1.1.0 @@ -3130,6 +3233,7 @@ snapshots: fsevents: 2.3.3 publint: 0.3.25 typescript: 7.0.2 + yaml: 2.9.1 '@voidzero-dev/vite-plus-darwin-arm64@1.1.0': optional: true @@ -3777,6 +3881,8 @@ snapshots: lru-cache@11.5.3: {} + lunr@2.3.9: {} + lz-string@1.5.0: {} magic-string@0.30.21: @@ -4075,7 +4181,7 @@ snapshots: regex: 6.1.0 regex-recursion: 6.0.2 - oxfmt@0.72.0(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)): + oxfmt@0.72.0(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)): dependencies: tinypool: 2.2.0 optionalDependencies: @@ -4098,7 +4204,7 @@ snapshots: '@oxfmt/binding-win32-arm64-msvc': 0.72.0 '@oxfmt/binding-win32-ia32-msvc': 0.72.0 '@oxfmt/binding-win32-x64-msvc': 0.72.0 - vite-plus: 1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2) + vite-plus: 1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) oxlint-tsgolint@7.0.2003: optionalDependencies: @@ -4109,7 +4215,7 @@ snapshots: '@oxlint-tsgolint/win32-arm64': 7.0.2003 '@oxlint-tsgolint/win32-x64': 7.0.2003 - oxlint@1.87.0(oxlint-tsgolint@7.0.2003)(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)): + oxlint@1.87.0(oxlint-tsgolint@7.0.2003)(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)): optionalDependencies: '@oxlint/binding-android-arm-eabi': 1.87.0 '@oxlint/binding-android-arm64': 1.87.0 @@ -4131,7 +4237,7 @@ snapshots: '@oxlint/binding-win32-ia32-msvc': 1.87.0 '@oxlint/binding-win32-x64-msvc': 1.87.0 oxlint-tsgolint: 7.0.2003 - vite-plus: 1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2) + vite-plus: 1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) package-manager-detector@1.9.0: {} @@ -4319,8 +4425,28 @@ snapshots: ts-dedent@2.3.0: {} + typedoc-plugin-markdown@4.13.1(typedoc@0.28.20(typescript@6.0.3)): + dependencies: + typedoc: 0.28.20(typescript@6.0.3) + + typedoc-vitepress-theme@1.1.4(typedoc-plugin-markdown@4.13.1(typedoc@0.28.20(typescript@6.0.3)))(typedoc@0.28.20(typescript@6.0.3)): + dependencies: + typedoc: 0.28.20(typescript@6.0.3) + typedoc-plugin-markdown: 4.13.1(typedoc@0.28.20(typescript@6.0.3)) + + typedoc@0.28.20(typescript@6.0.3): + dependencies: + '@gerrit0/mini-shiki': 3.23.0 + lunr: 2.3.9 + markdown-it: 14.3.2 + minimatch: 10.2.6 + typescript: 6.0.3 + yaml: 2.9.1 + typescript@5.6.1-rc: {} + typescript@6.0.3: {} + typescript@7.0.2: optionalDependencies: '@typescript/typescript-aix-ppc64': 7.0.2 @@ -4346,6 +4472,8 @@ snapshots: uc.micro@2.1.0: {} + undici-types@7.24.6: {} + unified@11.0.5: dependencies: '@types/unist': 3.0.3 @@ -4399,22 +4527,22 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.3 - vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2): + vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1): dependencies: '@oxc-project/types': 0.153.0 '@oxlint/plugins': 1.79.0 - '@vitest/browser': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3) - '@vitest/browser-preview': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3) - '@vitest/mocker': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2) + '@vitest/browser': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)(yaml@2.9.1) + '@vitest/browser-preview': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)(yaml@2.9.1) + '@vitest/mocker': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) '@vitest/pretty-format': 5.0.3 '@vitest/snapshot': 5.0.3 '@vitest/spy': 5.0.3 '@vitest/utils': 5.0.3 - oxfmt: 0.72.0(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)) - oxlint: 1.87.0(oxlint-tsgolint@7.0.2003)(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)) + oxfmt: 0.72.0(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)) + oxlint: 1.87.0(oxlint-tsgolint@7.0.2003)(vite-plus@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)) oxlint-tsgolint: 7.0.2003 - vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)' - vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(publint@0.3.25)(typescript@7.0.2) + vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)' + vitest: 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) optionalDependencies: '@voidzero-dev/vite-plus-darwin-arm64': 1.1.0 '@voidzero-dev/vite-plus-darwin-x64': 1.1.0 @@ -4477,14 +4605,14 @@ snapshots: transitivePeerDependencies: - supports-color - vitepress-plugin-mermaid@2.0.17(mermaid@11.17.2)(vitepress@2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2)): + vitepress-plugin-mermaid@2.0.17(mermaid@11.17.2)(vitepress@2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)): dependencies: mermaid: 11.17.2 - vitepress: 2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2) + vitepress: 2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) optionalDependencies: '@mermaid-js/mermaid-mindmap': 9.3.0 - vitepress@2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2): + vitepress@2.0.0-alpha.20(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(postcss@8.5.29)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1): dependencies: '@docsearch/css': 4.7.1 '@docsearch/js': 4.7.1 @@ -4492,7 +4620,7 @@ snapshots: '@iconify-json/simple-icons': 1.2.99 '@shikijs/transformers': 4.5.0 '@types/markdown-it': 14.2.0 - '@vitejs/plugin-vue': 6.0.9(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(vue@3.5.43(typescript@7.0.2)) + '@vitejs/plugin-vue': 6.0.9(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(vue@3.5.43(typescript@7.0.2)) '@vue/devtools-api': 8.2.1 '@vue/shared': 3.5.43 '@vueuse/core': 14.4.0(vue@3.5.43(typescript@7.0.2)) @@ -4501,7 +4629,7 @@ snapshots: mark.js: 8.11.1 minisearch: 7.2.0 shiki: 4.5.0 - vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)' + vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)' vue: 3.5.43(typescript@7.0.2) optionalDependencies: postcss: 8.5.29 @@ -4539,10 +4667,10 @@ snapshots: - vue-tsc - yaml - vitest@5.0.3(@arethetypeswrong/core@0.18.5)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2))(publint@0.3.25)(typescript@7.0.2): + vitest@5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(@vitest/browser-preview@5.0.3)(@vitest/coverage-v8@5.0.3)(@vitest/ui@5.0.3)(@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1))(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1): dependencies: '@types/chai': 5.2.3 - '@vitest/mocker': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2) + '@vitest/mocker': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1) chai: 6.3.0 es-module-lexer: 2.3.2 expect-type: 1.4.0 @@ -4553,10 +4681,11 @@ snapshots: tinybench: 6.2.1 tinyexec: 1.3.1 tinyglobby: 0.2.17 - vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)' + vite: '@voidzero-dev/vite-plus-core@1.1.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(yaml@2.9.1)' why-is-node-running: 3.2.1 optionalDependencies: - '@vitest/browser-preview': 5.0.3(@arethetypeswrong/core@0.18.5)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3) + '@types/node': 24.19.1 + '@vitest/browser-preview': 5.0.3(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@7.0.2)(vitest@5.0.3)(yaml@2.9.1) '@vitest/coverage-v8': 5.0.3(@vitest/browser@5.0.3)(vitest@5.0.3) '@vitest/ui': 5.0.3(vitest@5.0.3) transitivePeerDependencies: @@ -4604,6 +4733,8 @@ snapshots: y18n@5.0.8: {} + yaml@2.9.1: {} + yargs-parser@21.1.1: {} yargs@17.7.3: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 154f477..e211755 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,6 @@ packages: - docs + - docs/typedoc catalog: vite: npm:@voidzero-dev/vite-plus-core@1.1.0 vite-plus: 1.1.0 @@ -11,4 +12,4 @@ peerDependencyRules: allowedVersions: vite: "*" # vitepress-plugin-mermaid has not declared VitePress 2 support yet. - vitepress-plugin-mermaid>vitepress: "2" + vitepress-plugin-mermaid>vitepress: ">=2.0.0-alpha.0" diff --git a/src/FetchClient.ts b/src/FetchClient.ts index 868d275..40729b0 100644 --- a/src/FetchClient.ts +++ b/src/FetchClient.ts @@ -31,7 +31,7 @@ export class FetchClient { /** * Represents a FetchClient that handles HTTP requests using the Fetch API. - * @param options - The options to use for the FetchClient. + * @param optionsOrProvider - Client options, or the provider to inherit defaults from. */ constructor(optionsOrProvider?: FetchClientOptions | FetchClientProvider) { if (optionsOrProvider instanceof FetchClientProvider) { diff --git a/src/FetchClientCache.ts b/src/FetchClientCache.ts index 6aaefe9..d12e59d 100644 --- a/src/FetchClientCache.ts +++ b/src/FetchClientCache.ts @@ -11,7 +11,7 @@ export type CacheTag = string; /** * Represents an entry in the FetchClientCache. */ -type CacheEntry = { +export type CacheEntry = { key: CacheKey; tags: CacheTag[]; lastAccess: Date; diff --git a/src/FetchClientOptions.ts b/src/FetchClientOptions.ts index d671421..da0926f 100644 --- a/src/FetchClientOptions.ts +++ b/src/FetchClientOptions.ts @@ -5,8 +5,6 @@ import type { FetchClientProvider } from "./FetchClientProvider.ts"; import type { ProblemDetails } from "./ProblemDetails.ts"; import type { RequestOptions } from "./RequestOptions.ts"; -type Fetch = typeof globalThis.fetch; - /** * Fetch client options to use for making HTTP requests. */ @@ -31,7 +29,7 @@ export type FetchClientOptions = { * The fetch implementation to use for making HTTP requests. * If not provided, the global fetch function will be used. */ - fetch?: Fetch; + fetch?: typeof globalThis.fetch; /** * An array of middleware functions to be applied to the request. diff --git a/src/RateLimiter.ts b/src/RateLimiter.ts index 07dbf93..e3f0f00 100644 --- a/src/RateLimiter.ts +++ b/src/RateLimiter.ts @@ -240,7 +240,6 @@ export class RateLimiter { /** * Updates rate limit options for a request based on standard rate limit headers. * @param url - The request URL - * @param method - The HTTP method * @param headers - The response headers containing rate limit information */ public updateFromHeadersForRequest(url: string, headers: Headers): void { diff --git a/src/index.ts b/src/index.ts index 8c15198..ad7447f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,17 @@ +/** + * A typed JSON fetch client with middleware, caching, rate limiting, circuit + * breaking, and provider-based configuration. + * + * @example + * ```typescript + * import { FetchClient } from "@foundatiofx/fetchclient"; + * + * const client = new FetchClient({ baseUrl: "https://api.example.com" }); + * const response = await client.getJSON<{ id: number }>("/todos/1"); + * ``` + * + * @module @foundatiofx/fetchclient + */ export { FetchClient } from "./FetchClient.ts"; export type { FetchClientOptions } from "./FetchClientOptions.ts"; export type { FetchClientResponse } from "./FetchClientResponse.ts"; @@ -5,8 +19,16 @@ export { FetchClientDeserializationError, FetchClientError } from "./FetchClient export { getStatusText } from "./HttpStatusText.ts"; export { ResponsePromise } from "./ResponsePromise.ts"; export { ProblemDetails } from "./ProblemDetails.ts"; -export { type CacheKey, type CacheTag, FetchClientCache } from "./FetchClientCache.ts"; -export type { QueryRequestOptions, RequestOptions } from "./RequestOptions.ts"; +export { + type CacheEntry, + type CacheKey, + type CacheTag, + FetchClientCache, +} from "./FetchClientCache.ts"; +export type { GetRequestOptions, QueryRequestOptions, RequestOptions } from "./RequestOptions.ts"; +export type { Counter } from "./Counter.ts"; +export type { IObjectEvent } from "./ObjectEvent.ts"; +export type { Link, Links } from "./LinkHeader.ts"; export type { FetchClientMiddleware } from "./FetchClientMiddleware.ts"; export type { FetchClientContext } from "./FetchClientContext.ts"; export { @@ -42,6 +64,7 @@ export { } from "./RateLimitMiddleware.ts"; export { groupByDomain as rateLimiterGroupByDomain, + type GroupRateLimiterOptions, RateLimiter, type RateLimiterOptions, } from "./RateLimiter.ts"; diff --git a/src/mocks/index.ts b/src/mocks/index.ts index a7d0b4a..8746e61 100644 --- a/src/mocks/index.ts +++ b/src/mocks/index.ts @@ -18,7 +18,7 @@ * mocks.restore(); * ``` * - * @module + * @module @foundatiofx/fetchclient/mocks */ export { MockRegistry } from "./MockRegistry.ts";