@kubb/plugin-client 5.0.0-beta.64 → 5.7.0-canary.20260930T095256

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +8 -61
  2. package/dist/index.cjs +753 -1749
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +168 -347
  5. package/dist/index.js +729 -1734
  6. package/dist/index.js.map +1 -1
  7. package/package.json +12 -64
  8. package/src/generators/clientGenerator.tsx +9 -0
  9. package/src/index.ts +2 -0
  10. package/src/plugin.ts +71 -0
  11. package/src/types.ts +54 -0
  12. package/dist/chunk-Bx3C2hgW.cjs +0 -38
  13. package/dist/clients/axios.cjs +0 -68
  14. package/dist/clients/axios.cjs.map +0 -1
  15. package/dist/clients/axios.d.ts +0 -49
  16. package/dist/clients/axios.js +0 -58
  17. package/dist/clients/axios.js.map +0 -1
  18. package/dist/clients/fetch.cjs +0 -128
  19. package/dist/clients/fetch.cjs.map +0 -1
  20. package/dist/clients/fetch.d.ts +0 -50
  21. package/dist/clients/fetch.js +0 -120
  22. package/dist/clients/fetch.js.map +0 -1
  23. package/dist/templates/clients/axios.source.cjs +0 -7
  24. package/dist/templates/clients/axios.source.cjs.map +0 -1
  25. package/dist/templates/clients/axios.source.d.ts +0 -7
  26. package/dist/templates/clients/axios.source.js +0 -6
  27. package/dist/templates/clients/axios.source.js.map +0 -1
  28. package/dist/templates/clients/fetch.source.cjs +0 -7
  29. package/dist/templates/clients/fetch.source.cjs.map +0 -1
  30. package/dist/templates/clients/fetch.source.d.ts +0 -7
  31. package/dist/templates/clients/fetch.source.js +0 -6
  32. package/dist/templates/clients/fetch.source.js.map +0 -1
  33. package/dist/templates/config.source.cjs +0 -7
  34. package/dist/templates/config.source.cjs.map +0 -1
  35. package/dist/templates/config.source.d.ts +0 -7
  36. package/dist/templates/config.source.js +0 -6
  37. package/dist/templates/config.source.js.map +0 -1
  38. /package/dist/{chunk-C0LytTxp.js → rolldown-runtime-C0LytTxp.js} +0 -0
package/package.json CHANGED
@@ -1,19 +1,17 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "5.0.0-beta.64",
4
- "description": "Generate type-safe HTTP clients from your OpenAPI specification. Supports Axios, Fetch, and custom client adapters with full TypeScript inference and zero boilerplate.",
3
+ "version": "5.7.0-canary.20260930T095256",
4
+ "description": "Generate typed API operations against your own client module.",
5
5
  "keywords": [
6
6
  "api-client",
7
- "axios",
8
7
  "code-generation",
9
- "codegen",
10
- "fetch",
11
8
  "http-client",
12
9
  "kubb",
13
10
  "openapi",
14
11
  "swagger",
15
12
  "typescript"
16
13
  ],
14
+ "homepage": "https://kubb.dev/plugins/plugin-client",
17
15
  "license": "MIT",
18
16
  "author": "stijnvanhulle",
19
17
  "repository": {
@@ -22,9 +20,8 @@
22
20
  "directory": "packages/plugin-client"
23
21
  },
24
22
  "files": [
23
+ "src",
25
24
  "dist",
26
- "*.d.ts",
27
- "*.d.cts",
28
25
  "!/**/**.test.**",
29
26
  "!/**/__tests__/**",
30
27
  "!/**/__snapshots__/**"
@@ -34,50 +31,12 @@
34
31
  "main": "./dist/index.cjs",
35
32
  "module": "./dist/index.js",
36
33
  "types": "./dist/index.d.ts",
37
- "typesVersions": {
38
- "*": {
39
- "clients/axios": [
40
- "./dist/clients/axios.d.ts"
41
- ],
42
- "clients/fetch": [
43
- "./dist/clients/fetch.d.ts"
44
- ],
45
- "templates/config.source": [
46
- "./dist/templates/config.source.d.ts"
47
- ],
48
- "templates/clients/axios.source": [
49
- "./dist/templates/clients/axios.source.d.ts"
50
- ],
51
- "templates/clients/fetch.source": [
52
- "./dist/templates/clients/fetch.source.d.ts"
53
- ]
54
- }
55
- },
56
34
  "exports": {
57
35
  ".": {
36
+ "types": "./dist/index.d.ts",
58
37
  "import": "./dist/index.js",
59
38
  "require": "./dist/index.cjs"
60
39
  },
61
- "./clients/axios": {
62
- "import": "./dist/clients/axios.js",
63
- "require": "./dist/clients/axios.cjs"
64
- },
65
- "./clients/fetch": {
66
- "import": "./dist/clients/fetch.js",
67
- "require": "./dist/clients/fetch.cjs"
68
- },
69
- "./templates/clients/axios.source": {
70
- "import": "./dist/templates/clients/axios.source.js",
71
- "require": "./dist/templates/clients/axios.source.cjs"
72
- },
73
- "./templates/clients/fetch.source": {
74
- "import": "./dist/templates/clients/fetch.source.js",
75
- "require": "./dist/templates/clients/fetch.source.cjs"
76
- },
77
- "./templates/config.source": {
78
- "import": "./dist/templates/config.source.js",
79
- "require": "./dist/templates/config.source.cjs"
80
- },
81
40
  "./package.json": "./package.json"
82
41
  },
83
42
  "publishConfig": {
@@ -85,25 +44,17 @@
85
44
  "registry": "https://registry.npmjs.org/"
86
45
  },
87
46
  "dependencies": {
88
- "@kubb/ast": "5.0.0-beta.63",
89
- "@kubb/core": "5.0.0-beta.63",
90
- "@kubb/renderer-jsx": "5.0.0-beta.63",
91
- "@kubb/plugin-ts": "5.0.0-beta.64",
92
- "@kubb/plugin-zod": "5.0.0-beta.64"
47
+ "@kubb/plugin-ts": "^5.1.0-canary.20260930T095256",
48
+ "@kubb/plugin-zod": "^5.5.0-canary.20260930T095256"
93
49
  },
94
50
  "devDependencies": {
95
- "axios": "^1.17.0",
96
- "@internals/shared": "0.0.0",
97
- "@internals/utils": "0.0.0"
51
+ "@internals/client": "0.1.0-canary.20260930T095256",
52
+ "@internals/shared": "0.1.0-canary.20260930T095256",
53
+ "kubb": "^5.4.0",
54
+ "typescript": "^6.0.3"
98
55
  },
99
56
  "peerDependencies": {
100
- "@kubb/renderer-jsx": "5.0.0-beta.63",
101
- "axios": "^1.7.2"
102
- },
103
- "peerDependenciesMeta": {
104
- "axios": {
105
- "optional": true
106
- }
57
+ "kubb": "^5.4.0"
107
58
  },
108
59
  "engines": {
109
60
  "node": ">=22"
@@ -113,9 +64,6 @@
113
64
  "clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
114
65
  "lint": "oxlint .",
115
66
  "lint:fix": "oxlint --fix .",
116
- "release": "pnpm publish --no-git-check",
117
- "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
118
- "release:stage": "pnpm stage publish --no-git-check",
119
67
  "start": "tsdown --watch",
120
68
  "test": "vitest --passWithNoTests",
121
69
  "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
@@ -0,0 +1,9 @@
1
+ import { createClientGenerator } from '@internals/client'
2
+ import type { PluginClient } from '../types.ts'
3
+
4
+ /**
5
+ * Built-in operation generator for `@kubb/plugin-client`. Emits one async function per OpenAPI
6
+ * operation using the shared `Operation` component: a grouped `<Name>Request` type and a function
7
+ * that forwards a single `options` object to the user-provided client module and returns the `RequestResult`.
8
+ */
9
+ export const clientGenerator = createClientGenerator<PluginClient>('client', (options) => options.importPath)
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default, pluginClient, pluginClientName } from './plugin.ts'
2
+ export type { Options, PluginClient, ResolvedOptions, ResolverClient } from './types.ts'
package/src/plugin.ts ADDED
@@ -0,0 +1,71 @@
1
+ import { createGroupConfig } from '@internals/shared'
2
+ import { definePlugin, Resolver } from 'kubb/kit'
3
+ import { pluginTsName } from '@kubb/plugin-ts'
4
+ import { pluginZodName } from '@kubb/plugin-zod'
5
+ import { clientGenerator } from './generators/clientGenerator.tsx'
6
+ import { defaultMacros, resolverClient } from '@internals/client'
7
+ import type { PluginClient, ResolvedOptions, ResolverClient } from './types.ts'
8
+
9
+ /**
10
+ * Canonical plugin name for `@kubb/plugin-client`.
11
+ */
12
+ export const pluginClientName = 'plugin-client' satisfies PluginClient['name']
13
+
14
+ /**
15
+ * Generates typed operations that call a client module owned by your application.
16
+ * The module at `importPath` must export the runtime helpers and types used by generated operations.
17
+ * Kubb does not copy or inject a transport implementation.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * pluginClient({ importPath: '../api/client' })
22
+ * ```
23
+ */
24
+ export const pluginClient = definePlugin<PluginClient>((options) => {
25
+ const {
26
+ output = { path: 'clients', barrel: { type: 'named' } },
27
+ exclude = [],
28
+ include,
29
+ override = [],
30
+ importPath,
31
+ throwOnErrorDefault = true,
32
+ validator = false,
33
+ group,
34
+ resolver: userResolver,
35
+ } = options
36
+
37
+ const resolved: ResolvedOptions = {
38
+ output,
39
+ exclude,
40
+ include,
41
+ override,
42
+ group: createGroupConfig(group),
43
+ importPath,
44
+ baseURL: undefined,
45
+ throwOnErrorDefault,
46
+ validator,
47
+ returnType: 'plain',
48
+ sdk: undefined,
49
+ resolver: userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient,
50
+ }
51
+
52
+ return {
53
+ name: pluginClientName,
54
+ options,
55
+ dependencies: [pluginTsName, pluginZodName],
56
+ hooks: {
57
+ 'kubb:plugin:setup'(ctx) {
58
+ if (validator && !ctx.config.plugins?.some((plugin) => plugin.name === pluginZodName)) {
59
+ throw new Error(`${pluginClientName}: \`validator\` needs ${pluginZodName}. Add pluginZod() to the plugins or set \`validator: false\`.`)
60
+ }
61
+
62
+ ctx.setOptions(resolved)
63
+ ctx.setResolver(resolved.resolver)
64
+ ctx.setMacros([...defaultMacros, ...(options.macros ?? [])])
65
+ ctx.addGenerator(clientGenerator)
66
+ },
67
+ },
68
+ }
69
+ })
70
+
71
+ export default pluginClient
package/src/types.ts ADDED
@@ -0,0 +1,54 @@
1
+ import type { Override, PluginFactoryOptions } from 'kubb/kit'
2
+ import type { Options as ClientOptions, ResolvedOptions as ClientResolvedOptions, ResolverClient } from '@internals/client'
3
+
4
+ export type { ResolverClient } from '@internals/client'
5
+
6
+ /**
7
+ * Omits keys from every member of a union, where the built-in `Omit` would collapse the union into one shape.
8
+ */
9
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never
10
+
11
+ /**
12
+ * Options for `pluginClient`. It takes the shared client options, without the ones this plugin does not use,
13
+ * plus the required `importPath`.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * pluginClient({ importPath: '../../../client' })
18
+ * ```
19
+ */
20
+ export type Options = DistributiveOmit<ClientOptions, 'sdk' | 'returnType' | 'baseURL' | 'override'> & {
21
+ /**
22
+ * Applies different options to operations that match a pattern.
23
+ * `sdk`, `returnType`, and `baseURL` are not available, because this plugin generates standalone operations and your client module owns the base URL.
24
+ */
25
+ override?: Array<Override<Omit<ResolvedOptions, 'throwOnErrorDefault' | 'sdk' | 'returnType' | 'baseURL'>>>
26
+ /**
27
+ * Import specifier of your own client module, written into every generated import exactly as given.
28
+ * It must resolve from the generated file, so use a relative path, a package name, or an alias.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * pluginClient({ importPath: '../../../client' }) // relative to src/gen/clients/<tag>/
33
+ * pluginClient({ importPath: '@my-org/api-client' }) // a package
34
+ * ```
35
+ */
36
+ importPath: string
37
+ }
38
+
39
+ /**
40
+ * Options after `pluginClient` applies its defaults.
41
+ */
42
+ export type ResolvedOptions = ClientResolvedOptions & { importPath: string }
43
+ /**
44
+ * Plugin type of `@kubb/plugin-client`, registered in the Kubb plugin registry.
45
+ */
46
+ export type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, ResolverClient>
47
+
48
+ declare global {
49
+ namespace Kubb {
50
+ interface PluginRegistry {
51
+ 'plugin-client': PluginClient
52
+ }
53
+ }
54
+ }
@@ -1,38 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", {
5
- value,
6
- configurable: true
7
- });
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
- key = keys[i];
15
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: ((k) => from[k]).bind(null, key),
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
- //#endregion
27
- Object.defineProperty(exports, "__name", {
28
- enumerable: true,
29
- get: function() {
30
- return __name;
31
- }
32
- });
33
- Object.defineProperty(exports, "__toESM", {
34
- enumerable: true,
35
- get: function() {
36
- return __toESM;
37
- }
38
- });
@@ -1,68 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- const require_chunk = require("../chunk-Bx3C2hgW.cjs");
6
- let axios = require("axios");
7
- axios = require_chunk.__toESM(axios, 1);
8
- //#region src/clients/axios.ts
9
- let _config = {
10
- baseURL: typeof AXIOS_BASE !== "undefined" ? AXIOS_BASE : void 0,
11
- headers: typeof AXIOS_HEADERS !== "undefined" ? JSON.parse(AXIOS_HEADERS) : void 0
12
- };
13
- const getConfig = () => _config;
14
- const setConfig = (config) => {
15
- _config = config;
16
- return getConfig();
17
- };
18
- const mergeConfig = (...configs) => {
19
- return configs.reduce((merged, config) => {
20
- return {
21
- ...merged,
22
- ...config,
23
- headers: {
24
- ...Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers,
25
- ...Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers
26
- }
27
- };
28
- }, {});
29
- };
30
- /**
31
- * Serializes header values into the string form axios ultimately puts on the wire.
32
- * Objects (including arrays) are JSON-stringified so spec-defined object headers like `X-Filter`
33
- * are sent in their canonical JSON-string form rather than `[object Object]`.
34
- */
35
- function serializeHeaders(headers) {
36
- if (!headers) return {};
37
- const entries = Array.isArray(headers) ? headers : Object.entries(headers);
38
- const result = {};
39
- for (const [key, value] of entries) {
40
- if (value === void 0 || value === null) continue;
41
- result[key] = typeof value === "string" ? value : typeof value === "object" ? JSON.stringify(value) : String(value);
42
- }
43
- return result;
44
- }
45
- const axiosInstance = axios.default.create(getConfig());
46
- const client = async (config, _request) => {
47
- const { contentType, headers, ...axiosConfig } = mergeConfig(getConfig(), config);
48
- return axiosInstance.request({
49
- ...axiosConfig,
50
- headers: {
51
- ...contentType && contentType !== "multipart/form-data" ? { "Content-Type": contentType } : {},
52
- ...serializeHeaders(headers)
53
- }
54
- }).catch((e) => {
55
- throw e;
56
- });
57
- };
58
- client.getConfig = getConfig;
59
- client.setConfig = setConfig;
60
- //#endregion
61
- exports.axiosInstance = axiosInstance;
62
- exports.client = client;
63
- exports.default = client;
64
- exports.getConfig = getConfig;
65
- exports.mergeConfig = mergeConfig;
66
- exports.setConfig = setConfig;
67
-
68
- //# sourceMappingURL=axios.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios.cjs","names":[],"sources":["../../src/clients/axios.ts"],"sourcesContent":["import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport axios from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Header values may be objects (e.g. JSON-encoded headers like `X-Filter` in the Linode API).\n * Non-string values are JSON-serialized before the request is sent.\n */\nexport type HeaderValue = string | number | boolean | null | undefined | object\nexport type HeadersInit = Array<[string, HeaderValue]> | Record<string, HeaderValue>\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n validateStatus?: (status: number) => boolean\n headers?: HeadersInit\n paramsSerializer?: AxiosRequestConfig['paramsSerializer']\n contentType?: string\n}\n\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers: AxiosResponse['headers']\n}\n\nexport type ResponseErrorConfig<TError = unknown> = AxiosError<TError>\n\nexport type Client = <TResponseData, _TError = unknown, TRequestData = unknown>(\n config: RequestConfig<TRequestData>,\n request?: unknown,\n) => Promise<ResponseConfig<TResponseData>>\n\nlet _config: Partial<RequestConfig> = {\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? JSON.parse(AXIOS_HEADERS) : undefined,\n}\n\nexport const getConfig = () => _config\n\nexport const setConfig = (config: RequestConfig) => {\n _config = config\n return getConfig()\n}\n\nexport const mergeConfig = <T extends RequestConfig>(...configs: Array<Partial<T>>): Partial<T> => {\n return configs.reduce<Partial<T>>((merged, config) => {\n return {\n ...merged,\n ...config,\n headers: {\n ...(Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers),\n ...(Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers),\n },\n }\n }, {})\n}\n\n/**\n * Serializes header values into the string form axios ultimately puts on the wire.\n * Objects (including arrays) are JSON-stringified so spec-defined object headers like `X-Filter`\n * are sent in their canonical JSON-string form rather than `[object Object]`.\n */\nfunction serializeHeaders(headers: HeadersInit | undefined): Record<string, string> {\n if (!headers) return {}\n const entries = Array.isArray(headers) ? headers : Object.entries(headers)\n const result: Record<string, string> = {}\n for (const [key, value] of entries) {\n if (value === undefined || value === null) continue\n result[key] = typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : String(value)\n }\n return result\n}\n\nexport const axiosInstance = axios.create(getConfig() as AxiosRequestConfig)\n\nexport const client = async <TResponseData, TError = unknown, TRequestData = unknown>(\n config: RequestConfig<TRequestData>,\n _request?: unknown,\n): Promise<ResponseConfig<TResponseData>> => {\n const requestConfig = mergeConfig(getConfig(), config)\n const { contentType, headers, ...axiosConfig } = requestConfig\n return axiosInstance\n .request<TResponseData, ResponseConfig<TResponseData>>({\n ...axiosConfig,\n headers: {\n ...(contentType && contentType !== 'multipart/form-data' ? { 'Content-Type': contentType } : {}),\n ...serializeHeaders(headers),\n },\n })\n .catch((e: AxiosError<TError>) => {\n throw e\n })\n}\n\nclient.getConfig = getConfig\nclient.setConfig = setConfig\n\nexport default client\n"],"mappings":";;;;;;;;AA+CA,IAAI,UAAkC;CACpC,SAAS,OAAO,eAAe,cAAc,aAAa,KAAA;CAC1D,SAAS,OAAO,kBAAkB,cAAc,KAAK,MAAM,aAAa,IAAI,KAAA;AAC9E;AAEA,MAAa,kBAAkB;AAE/B,MAAa,aAAa,WAA0B;CAClD,UAAU;CACV,OAAO,UAAU;AACnB;AAEA,MAAa,eAAwC,GAAG,YAA2C;CACjG,OAAO,QAAQ,QAAoB,QAAQ,WAAW;EACpD,OAAO;GACL,GAAG;GACH,GAAG;GACH,SAAS;IACP,GAAI,MAAM,QAAQ,OAAO,OAAO,IAAI,OAAO,YAAY,OAAO,OAAO,IAAI,OAAO;IAChF,GAAI,MAAM,QAAQ,OAAO,OAAO,IAAI,OAAO,YAAY,OAAO,OAAO,IAAI,OAAO;GAClF;EACF;CACF,GAAG,CAAC,CAAC;AACP;;;;;;AAOA,SAAS,iBAAiB,SAA0D;CAClF,IAAI,CAAC,SAAS,OAAO,CAAC;CACtB,MAAM,UAAU,MAAM,QAAQ,OAAO,IAAI,UAAU,OAAO,QAAQ,OAAO;CACzE,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,CAAC,KAAK,UAAU,SAAS;EAClC,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM;EAC3C,OAAO,OAAO,OAAO,UAAU,WAAW,QAAQ,OAAO,UAAU,WAAW,KAAK,UAAU,KAAK,IAAI,OAAO,KAAK;CACpH;CACA,OAAO;AACT;AAEA,MAAa,gBAAgB,MAAA,QAAM,OAAO,UAAU,CAAuB;AAE3E,MAAa,SAAS,OACpB,QACA,aAC2C;CAE3C,MAAM,EAAE,aAAa,SAAS,GAAG,gBADX,YAAY,UAAU,GAAG,MACc;CAC7D,OAAO,cACJ,QAAsD;EACrD,GAAG;EACH,SAAS;GACP,GAAI,eAAe,gBAAgB,wBAAwB,EAAE,gBAAgB,YAAY,IAAI,CAAC;GAC9F,GAAG,iBAAiB,OAAO;EAC7B;CACF,CAAC,CAAC,CACD,OAAO,MAA0B;EAChC,MAAM;CACR,CAAC;AACL;AAEA,OAAO,YAAY;AACnB,OAAO,YAAY"}
@@ -1,49 +0,0 @@
1
- import { t as __name } from "../chunk-C0LytTxp.js";
2
- import { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios";
3
-
4
- //#region src/clients/axios.d.ts
5
- /**
6
- * Header values may be objects (e.g. JSON-encoded headers like `X-Filter` in the Linode API).
7
- * Non-string values are JSON-serialized before the request is sent.
8
- */
9
- type HeaderValue = string | number | boolean | null | undefined | object;
10
- type HeadersInit = Array<[string, HeaderValue]> | Record<string, HeaderValue>;
11
- /**
12
- * Subset of AxiosRequestConfig
13
- */
14
- type RequestConfig<TData = unknown> = {
15
- baseURL?: string;
16
- url?: string;
17
- method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD';
18
- params?: unknown;
19
- data?: TData | FormData;
20
- responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
21
- signal?: AbortSignal;
22
- validateStatus?: (status: number) => boolean;
23
- headers?: HeadersInit;
24
- paramsSerializer?: AxiosRequestConfig['paramsSerializer'];
25
- contentType?: string;
26
- };
27
- /**
28
- * Subset of AxiosResponse
29
- */
30
- type ResponseConfig<TData = unknown> = {
31
- data: TData;
32
- status: number;
33
- statusText: string;
34
- headers: AxiosResponse['headers'];
35
- };
36
- type ResponseErrorConfig<TError = unknown> = AxiosError<TError>;
37
- type Client = <TResponseData, _TError = unknown, TRequestData = unknown>(config: RequestConfig<TRequestData>, request?: unknown) => Promise<ResponseConfig<TResponseData>>;
38
- declare const getConfig: () => Partial<RequestConfig<unknown>>;
39
- declare const setConfig: (config: RequestConfig) => Partial<RequestConfig<unknown>>;
40
- declare const mergeConfig: <T extends RequestConfig>(...configs: Array<Partial<T>>) => Partial<T>;
41
- declare const axiosInstance: import("axios").AxiosInstance;
42
- declare const client: {
43
- <TResponseData, TError = unknown, TRequestData = unknown>(config: RequestConfig<TRequestData>, _request?: unknown): Promise<ResponseConfig<TResponseData>>;
44
- getConfig: () => Partial<RequestConfig<unknown>>;
45
- setConfig: (config: RequestConfig) => Partial<RequestConfig<unknown>>;
46
- };
47
- //#endregion
48
- export { Client, HeaderValue, HeadersInit, RequestConfig, ResponseConfig, ResponseErrorConfig, axiosInstance, client, client as default, getConfig, mergeConfig, setConfig };
49
- //# sourceMappingURL=axios.d.ts.map
@@ -1,58 +0,0 @@
1
- import "../chunk-C0LytTxp.js";
2
- import axios from "axios";
3
- //#region src/clients/axios.ts
4
- let _config = {
5
- baseURL: typeof AXIOS_BASE !== "undefined" ? AXIOS_BASE : void 0,
6
- headers: typeof AXIOS_HEADERS !== "undefined" ? JSON.parse(AXIOS_HEADERS) : void 0
7
- };
8
- const getConfig = () => _config;
9
- const setConfig = (config) => {
10
- _config = config;
11
- return getConfig();
12
- };
13
- const mergeConfig = (...configs) => {
14
- return configs.reduce((merged, config) => {
15
- return {
16
- ...merged,
17
- ...config,
18
- headers: {
19
- ...Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers,
20
- ...Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers
21
- }
22
- };
23
- }, {});
24
- };
25
- /**
26
- * Serializes header values into the string form axios ultimately puts on the wire.
27
- * Objects (including arrays) are JSON-stringified so spec-defined object headers like `X-Filter`
28
- * are sent in their canonical JSON-string form rather than `[object Object]`.
29
- */
30
- function serializeHeaders(headers) {
31
- if (!headers) return {};
32
- const entries = Array.isArray(headers) ? headers : Object.entries(headers);
33
- const result = {};
34
- for (const [key, value] of entries) {
35
- if (value === void 0 || value === null) continue;
36
- result[key] = typeof value === "string" ? value : typeof value === "object" ? JSON.stringify(value) : String(value);
37
- }
38
- return result;
39
- }
40
- const axiosInstance = axios.create(getConfig());
41
- const client = async (config, _request) => {
42
- const { contentType, headers, ...axiosConfig } = mergeConfig(getConfig(), config);
43
- return axiosInstance.request({
44
- ...axiosConfig,
45
- headers: {
46
- ...contentType && contentType !== "multipart/form-data" ? { "Content-Type": contentType } : {},
47
- ...serializeHeaders(headers)
48
- }
49
- }).catch((e) => {
50
- throw e;
51
- });
52
- };
53
- client.getConfig = getConfig;
54
- client.setConfig = setConfig;
55
- //#endregion
56
- export { axiosInstance, client, client as default, getConfig, mergeConfig, setConfig };
57
-
58
- //# sourceMappingURL=axios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios.js","names":[],"sources":["../../src/clients/axios.ts"],"sourcesContent":["import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport axios from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Header values may be objects (e.g. JSON-encoded headers like `X-Filter` in the Linode API).\n * Non-string values are JSON-serialized before the request is sent.\n */\nexport type HeaderValue = string | number | boolean | null | undefined | object\nexport type HeadersInit = Array<[string, HeaderValue]> | Record<string, HeaderValue>\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n validateStatus?: (status: number) => boolean\n headers?: HeadersInit\n paramsSerializer?: AxiosRequestConfig['paramsSerializer']\n contentType?: string\n}\n\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers: AxiosResponse['headers']\n}\n\nexport type ResponseErrorConfig<TError = unknown> = AxiosError<TError>\n\nexport type Client = <TResponseData, _TError = unknown, TRequestData = unknown>(\n config: RequestConfig<TRequestData>,\n request?: unknown,\n) => Promise<ResponseConfig<TResponseData>>\n\nlet _config: Partial<RequestConfig> = {\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? JSON.parse(AXIOS_HEADERS) : undefined,\n}\n\nexport const getConfig = () => _config\n\nexport const setConfig = (config: RequestConfig) => {\n _config = config\n return getConfig()\n}\n\nexport const mergeConfig = <T extends RequestConfig>(...configs: Array<Partial<T>>): Partial<T> => {\n return configs.reduce<Partial<T>>((merged, config) => {\n return {\n ...merged,\n ...config,\n headers: {\n ...(Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers),\n ...(Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers),\n },\n }\n }, {})\n}\n\n/**\n * Serializes header values into the string form axios ultimately puts on the wire.\n * Objects (including arrays) are JSON-stringified so spec-defined object headers like `X-Filter`\n * are sent in their canonical JSON-string form rather than `[object Object]`.\n */\nfunction serializeHeaders(headers: HeadersInit | undefined): Record<string, string> {\n if (!headers) return {}\n const entries = Array.isArray(headers) ? headers : Object.entries(headers)\n const result: Record<string, string> = {}\n for (const [key, value] of entries) {\n if (value === undefined || value === null) continue\n result[key] = typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : String(value)\n }\n return result\n}\n\nexport const axiosInstance = axios.create(getConfig() as AxiosRequestConfig)\n\nexport const client = async <TResponseData, TError = unknown, TRequestData = unknown>(\n config: RequestConfig<TRequestData>,\n _request?: unknown,\n): Promise<ResponseConfig<TResponseData>> => {\n const requestConfig = mergeConfig(getConfig(), config)\n const { contentType, headers, ...axiosConfig } = requestConfig\n return axiosInstance\n .request<TResponseData, ResponseConfig<TResponseData>>({\n ...axiosConfig,\n headers: {\n ...(contentType && contentType !== 'multipart/form-data' ? { 'Content-Type': contentType } : {}),\n ...serializeHeaders(headers),\n },\n })\n .catch((e: AxiosError<TError>) => {\n throw e\n })\n}\n\nclient.getConfig = getConfig\nclient.setConfig = setConfig\n\nexport default client\n"],"mappings":";;;AA+CA,IAAI,UAAkC;CACpC,SAAS,OAAO,eAAe,cAAc,aAAa,KAAA;CAC1D,SAAS,OAAO,kBAAkB,cAAc,KAAK,MAAM,aAAa,IAAI,KAAA;AAC9E;AAEA,MAAa,kBAAkB;AAE/B,MAAa,aAAa,WAA0B;CAClD,UAAU;CACV,OAAO,UAAU;AACnB;AAEA,MAAa,eAAwC,GAAG,YAA2C;CACjG,OAAO,QAAQ,QAAoB,QAAQ,WAAW;EACpD,OAAO;GACL,GAAG;GACH,GAAG;GACH,SAAS;IACP,GAAI,MAAM,QAAQ,OAAO,OAAO,IAAI,OAAO,YAAY,OAAO,OAAO,IAAI,OAAO;IAChF,GAAI,MAAM,QAAQ,OAAO,OAAO,IAAI,OAAO,YAAY,OAAO,OAAO,IAAI,OAAO;GAClF;EACF;CACF,GAAG,CAAC,CAAC;AACP;;;;;;AAOA,SAAS,iBAAiB,SAA0D;CAClF,IAAI,CAAC,SAAS,OAAO,CAAC;CACtB,MAAM,UAAU,MAAM,QAAQ,OAAO,IAAI,UAAU,OAAO,QAAQ,OAAO;CACzE,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,CAAC,KAAK,UAAU,SAAS;EAClC,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM;EAC3C,OAAO,OAAO,OAAO,UAAU,WAAW,QAAQ,OAAO,UAAU,WAAW,KAAK,UAAU,KAAK,IAAI,OAAO,KAAK;CACpH;CACA,OAAO;AACT;AAEA,MAAa,gBAAgB,MAAM,OAAO,UAAU,CAAuB;AAE3E,MAAa,SAAS,OACpB,QACA,aAC2C;CAE3C,MAAM,EAAE,aAAa,SAAS,GAAG,gBADX,YAAY,UAAU,GAAG,MACc;CAC7D,OAAO,cACJ,QAAsD;EACrD,GAAG;EACH,SAAS;GACP,GAAI,eAAe,gBAAgB,wBAAwB,EAAE,gBAAgB,YAAY,IAAI,CAAC;GAC9F,GAAG,iBAAiB,OAAO;EAC7B;CACF,CAAC,CAAC,CACD,OAAO,MAA0B;EAChC,MAAM;CACR,CAAC;AACL;AAEA,OAAO,YAAY;AACnB,OAAO,YAAY"}
@@ -1,128 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- require("../chunk-Bx3C2hgW.cjs");
6
- //#region src/clients/fetch.ts
7
- let _config = {};
8
- const getConfig = () => _config;
9
- const setConfig = (config) => {
10
- _config = config;
11
- return getConfig();
12
- };
13
- const mergeConfig = (...configs) => {
14
- return configs.reduce((merged, config) => {
15
- return {
16
- ...merged,
17
- ...config,
18
- headers: {
19
- ...Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers,
20
- ...Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers
21
- }
22
- };
23
- }, {});
24
- };
25
- /**
26
- * Serializes header values into the string form `fetch` expects.
27
- * Objects (including arrays) are JSON-stringified so spec-defined object
28
- * headers like `X-Filter` are sent in their canonical JSON-string form.
29
- */
30
- function serializeHeaders(headers) {
31
- if (!headers) return {};
32
- const entries = Array.isArray(headers) ? headers : Object.entries(headers);
33
- const result = {};
34
- for (const [key, value] of entries) {
35
- if (value === void 0 || value === null) continue;
36
- result[key] = typeof value === "string" ? value : typeof value === "object" ? JSON.stringify(value) : String(value);
37
- }
38
- return result;
39
- }
40
- /**
41
- * Serializes the request body into the form `fetch` expects.
42
- * `FormData`, `URLSearchParams`, `Blob`, `ArrayBuffer` and string bodies are passed through
43
- * untouched. Plain objects are encoded as `URLSearchParams` for `application/x-www-form-urlencoded`
44
- * and JSON-serialized otherwise.
45
- */
46
- function serializeBody(data, contentType) {
47
- if (data === void 0 || data === null) return void 0;
48
- if (data instanceof FormData || data instanceof URLSearchParams || data instanceof Blob || data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return data;
49
- if (typeof data === "string") return data;
50
- if (contentType?.includes("application/x-www-form-urlencoded")) return new URLSearchParams(data);
51
- return JSON.stringify(data);
52
- }
53
- /**
54
- * Picks a `responseType` from a `Content-Type` header, or `undefined` when it is not recognized.
55
- */
56
- function detectResponseType(contentType) {
57
- if (!contentType) return void 0;
58
- if (contentType.includes("application/json") || contentType.includes("text/json")) return "json";
59
- if (contentType.includes("text/")) return "text";
60
- if (contentType.includes("image/") || contentType.includes("application/octet-stream")) return "blob";
61
- }
62
- /**
63
- * Parses a `fetch` response body.
64
- *
65
- * - Empty responses (204/205/304 or no body) resolve to `{}`.
66
- * - An explicit `responseType` (or one detected from the `Content-Type` header) forces the matching
67
- * `Response` method.
68
- * - As a last resort the body is read as text and `JSON.parse`d, falling back to the raw text.
69
- */
70
- async function parseResponse(response, responseType) {
71
- if ([
72
- 204,
73
- 205,
74
- 304
75
- ].includes(response.status) || !response.body) return {};
76
- switch (responseType ?? detectResponseType(response.headers.get("Content-Type"))) {
77
- case "text":
78
- case "document": return await response.text();
79
- case "blob": return await response.blob();
80
- case "arraybuffer": return await response.arrayBuffer();
81
- case "stream": return response.body;
82
- case "json": return await response.json();
83
- }
84
- if (responseType) return await response.json();
85
- const text = await response.text();
86
- if (!text) return {};
87
- try {
88
- return JSON.parse(text);
89
- } catch {
90
- return text;
91
- }
92
- }
93
- const client = async (paramsConfig, _request) => {
94
- const normalizedParams = new URLSearchParams();
95
- const config = mergeConfig(getConfig(), paramsConfig);
96
- Object.entries(config.params || {}).forEach(([key, value]) => {
97
- if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
98
- });
99
- let targetUrl = [config.baseURL, config.url].filter(Boolean).join("");
100
- if (config.params) targetUrl += `?${normalizedParams}`;
101
- const headers = {
102
- ...config.contentType && config.contentType !== "multipart/form-data" ? { "Content-Type": config.contentType } : {},
103
- ...serializeHeaders(config.headers)
104
- };
105
- const response = await globalThis.fetch(targetUrl, {
106
- credentials: config.credentials || "same-origin",
107
- method: config.method?.toUpperCase(),
108
- body: serializeBody(config.data, headers["Content-Type"] ?? headers["content-type"]),
109
- signal: config.signal,
110
- headers
111
- });
112
- return {
113
- data: await parseResponse(response, config.responseType),
114
- status: response.status,
115
- statusText: response.statusText,
116
- headers: response.headers
117
- };
118
- };
119
- client.getConfig = getConfig;
120
- client.setConfig = setConfig;
121
- //#endregion
122
- exports.client = client;
123
- exports.default = client;
124
- exports.getConfig = getConfig;
125
- exports.mergeConfig = mergeConfig;
126
- exports.setConfig = setConfig;
127
-
128
- //# sourceMappingURL=fetch.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.cjs","names":[],"sources":["../../src/clients/fetch.ts"],"sourcesContent":["/**\n * RequestCredentials\n */\nexport type RequestCredentials = 'omit' | 'same-origin' | 'include'\n\n/**\n * Header values may be objects (e.g. JSON-encoded filter headers like `X-Filter`).\n * Non-string values are JSON-serialized before the request is sent.\n */\nexport type HeaderValue = string | number | boolean | null | undefined | object\nexport type HeadersInit = Array<[string, HeaderValue]> | Record<string, HeaderValue>\n\n/**\n * Subset of FetchRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n headers?: HeadersInit\n credentials?: RequestCredentials\n contentType?: string\n}\n\n/**\n * Subset of FetchResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers: Headers\n}\n\nlet _config: Partial<RequestConfig> = {}\n\nexport const getConfig = () => _config\n\nexport const setConfig = (config: Partial<RequestConfig>) => {\n _config = config\n return getConfig()\n}\n\nexport const mergeConfig = <T extends RequestConfig>(...configs: Array<Partial<T>>): Partial<T> => {\n return configs.reduce<Partial<T>>((merged, config) => {\n return {\n ...merged,\n ...config,\n headers: {\n ...(Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers),\n ...(Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers),\n },\n }\n }, {})\n}\n\n/**\n * Serializes header values into the string form `fetch` expects.\n * Objects (including arrays) are JSON-stringified so spec-defined object\n * headers like `X-Filter` are sent in their canonical JSON-string form.\n */\nfunction serializeHeaders(headers: HeadersInit | undefined): Record<string, string> {\n if (!headers) return {}\n const entries = Array.isArray(headers) ? headers : Object.entries(headers)\n const result: Record<string, string> = {}\n for (const [key, value] of entries) {\n if (value === undefined || value === null) continue\n result[key] = typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : String(value)\n }\n return result\n}\n\n/**\n * Serializes the request body into the form `fetch` expects.\n * `FormData`, `URLSearchParams`, `Blob`, `ArrayBuffer` and string bodies are passed through\n * untouched. Plain objects are encoded as `URLSearchParams` for `application/x-www-form-urlencoded`\n * and JSON-serialized otherwise.\n */\nfunction serializeBody(data: unknown, contentType?: string): BodyInit | undefined {\n if (data === undefined || data === null) return undefined\n if (data instanceof FormData || data instanceof URLSearchParams || data instanceof Blob || data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {\n return data as BodyInit\n }\n if (typeof data === 'string') return data\n if (contentType?.includes('application/x-www-form-urlencoded')) {\n return new URLSearchParams(data as Record<string, string>)\n }\n return JSON.stringify(data)\n}\n\n/**\n * Picks a `responseType` from a `Content-Type` header, or `undefined` when it is not recognized.\n */\nfunction detectResponseType(contentType: string | null): RequestConfig['responseType'] {\n if (!contentType) return undefined\n if (contentType.includes('application/json') || contentType.includes('text/json')) return 'json'\n if (contentType.includes('text/')) return 'text'\n if (contentType.includes('image/') || contentType.includes('application/octet-stream')) return 'blob'\n return undefined\n}\n\n/**\n * Parses a `fetch` response body.\n *\n * - Empty responses (204/205/304 or no body) resolve to `{}`.\n * - An explicit `responseType` (or one detected from the `Content-Type` header) forces the matching\n * `Response` method.\n * - As a last resort the body is read as text and `JSON.parse`d, falling back to the raw text.\n */\nasync function parseResponse<TData>(response: Response, responseType?: RequestConfig['responseType']): Promise<TData> {\n if ([204, 205, 304].includes(response.status) || !response.body) {\n return {} as TData\n }\n\n switch (responseType ?? detectResponseType(response.headers.get('Content-Type'))) {\n case 'text':\n case 'document':\n return (await response.text()) as TData\n case 'blob':\n return (await response.blob()) as TData\n case 'arraybuffer':\n return (await response.arrayBuffer()) as TData\n case 'stream':\n return response.body as TData\n case 'json':\n return (await response.json()) as TData\n }\n\n // Explicit but unrecognized responseType keeps the JSON default; otherwise read text and parse it.\n if (responseType) {\n return (await response.json()) as TData\n }\n const text = await response.text()\n if (!text) {\n return {} as TData\n }\n try {\n return JSON.parse(text) as TData\n } catch {\n return text as TData\n }\n}\n\nexport type ResponseErrorConfig<TError = unknown> = TError\n\nexport type Client = <TResponseData, _TError = unknown, TRequestData = unknown>(\n config: RequestConfig<TRequestData>,\n request?: unknown,\n) => Promise<ResponseConfig<TResponseData>>\n\nexport const client = async <TResponseData, _TError = unknown, RequestData = unknown>(\n paramsConfig: RequestConfig<RequestData>,\n _request?: unknown,\n): Promise<ResponseConfig<TResponseData>> => {\n const normalizedParams = new URLSearchParams()\n\n const config = mergeConfig(getConfig(), paramsConfig)\n\n Object.entries(config.params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : value.toString())\n }\n })\n\n let targetUrl = [config.baseURL, config.url].filter(Boolean).join('')\n\n if (config.params) {\n targetUrl += `?${normalizedParams}`\n }\n\n const headers: Record<string, string> = {\n ...(config.contentType && config.contentType !== 'multipart/form-data' ? { 'Content-Type': config.contentType } : {}),\n ...serializeHeaders(config.headers),\n }\n\n const response = await globalThis.fetch(targetUrl, {\n credentials: config.credentials || 'same-origin',\n method: config.method?.toUpperCase(),\n body: serializeBody(config.data, headers['Content-Type'] ?? headers['content-type']),\n signal: config.signal,\n headers,\n })\n\n const data = await parseResponse<TResponseData>(response, config.responseType)\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: response.headers as Headers,\n }\n}\n\nclient.getConfig = getConfig\nclient.setConfig = setConfig\n\nexport default client\n"],"mappings":"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"}