@kubb/plugin-axios 5.10.0-canary.20261025T193221 → 5.10.0

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.
@@ -1,7 +1,6 @@
1
1
  import { HeadersInit, Serializers, Styles } from "./serializers.js";
2
2
  import { ParseError, StandardSchemaValidator } from "./standardSchema.js";
3
3
  import { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from "axios";
4
- //#region templates/axios.d.ts
5
4
  /**
6
5
  * HTTP status codes treated as a success, everything else is an error.
7
6
  */
@@ -358,5 +357,4 @@ export declare function toEventStream<TData = unknown>(result: Promise<{
358
357
  response: AxiosResponse;
359
358
  }>): Promise<EventStreamResult<TData>>;
360
359
  export declare const client: ClientInstance<AxiosRequestConfig<any, any>, AxiosResponse<any, any, {}, any>>;
361
- export declare const createClient: (config?: Parameters<typeof client.createClient>[0]) => ClientInstance<AxiosRequestConfig<any, any>, AxiosResponse<any, any, {}, any>>;
362
- //#endregion
360
+ export declare const createClient: (config?: Parameters<typeof client.createClient>[0]) => ClientInstance<AxiosRequestConfig<any, any>, AxiosResponse<any, any, {}, any>>;
@@ -1,4 +1,3 @@
1
- //#region templates/serializers.d.ts
2
1
  export type HeaderValue = string | number | boolean | null | undefined | object;
3
2
  export type HeadersInit = Array<[string, HeaderValue]> | Record<string, HeaderValue>;
4
3
  /**
@@ -177,5 +176,4 @@ export declare const defaultPathSerializer: PathSerializer;
177
176
  * merged. Header values are not URL-encoded. Primitive values and headers without metadata pass
178
177
  * through untouched.
179
178
  */
180
- export declare function applyHeaderStyles(headers: HeadersInit | undefined, styles: Record<string, HeaderParamStyle> | undefined): HeadersInit | undefined;
181
- //#endregion
179
+ export declare function applyHeaderStyles(headers: HeadersInit | undefined, styles: Record<string, HeaderParamStyle> | undefined): HeadersInit | undefined;
@@ -1,4 +1,3 @@
1
- //#region templates/standardSchema.d.ts
2
1
  /**
3
2
  * A Standard Schema-compatible validator: a minimal duck-type covering Zod v3/v4, valibot, and
4
3
  * arktype schemas. Only the `~standard.validate` method is required at runtime.
@@ -61,5 +60,4 @@ export declare function validateStandardSchema<TOutput>(schema: StandardSchemaVa
61
60
  * validator: { headers: toHeadersStandardSchema(putEventHeadersSchema, putEventHeadersSchema.shape) }
62
61
  * ```
63
62
  */
64
- export declare function toHeadersStandardSchema(schema: StandardSchemaValidator, entries: Record<string, unknown>): StandardSchemaValidator;
65
- //#endregion
63
+ export declare function toHeadersStandardSchema(schema: StandardSchemaValidator, entries: Record<string, unknown>): StandardSchemaValidator;
@@ -20,7 +20,7 @@
20
20
  "dependencies": ["plugin-ts"],
21
21
  "optionalDependencies": ["plugin-zod"],
22
22
  "compatibility": {
23
- "kubb": ">=5.8.3",
23
+ "kubb": ">=5.14.6",
24
24
  "node": ">=22.22"
25
25
  },
26
26
  "role": "client",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-axios",
3
- "version": "5.10.0-canary.20261025T193221",
3
+ "version": "5.10.0",
4
4
  "description": "Generate a slim, type-safe HTTP client with Kubb based on axios.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -80,19 +80,19 @@
80
80
  "registry": "https://registry.npmjs.org/"
81
81
  },
82
82
  "dependencies": {
83
- "@kubb/plugin-ts": "^5.3.0-canary.20261025T193221",
84
- "@kubb/plugin-zod": "^5.8.0-canary.20261025T193221"
83
+ "@kubb/plugin-ts": "^5.3.0",
84
+ "@kubb/plugin-zod": "^5.7.3"
85
85
  },
86
86
  "devDependencies": {
87
- "@internals/client": "0.1.0-canary.20261025T193221",
88
- "@internals/shared": "0.1.0-canary.20261025T193221",
87
+ "@internals/client": "0.0.0",
88
+ "@internals/shared": "0.0.0",
89
89
  "axios": "^1.20.0",
90
- "kubb": "^5.14.2",
90
+ "kubb": "^5.14.6",
91
91
  "typescript": "^7.0.2"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "axios": "^1.20.0",
95
- "kubb": "^5.14.2"
95
+ "kubb": "^5.14.6"
96
96
  },
97
97
  "peerDependenciesMeta": {
98
98
  "axios": {
@@ -469,7 +469,7 @@ export async function resolveAuth(params: {
469
469
 
470
470
  if (scheme.type !== 'apiKey') {
471
471
  if (getHeader(headers, 'Authorization') === undefined) {
472
- headers['Authorization'] = scheme.scheme === 'basic' ? `Basic ${btoa(token)}` : `Bearer ${token}`
472
+ headers['Authorization'] = scheme.scheme === 'basic' ? `Basic ${btoa(String.fromCharCode(...new TextEncoder().encode(token)))}` : `Bearer ${token}`
473
473
  }
474
474
  return
475
475
  }
@@ -179,8 +179,10 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData:
179
179
  */
180
180
  export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => {
181
181
  if (body === undefined || body === null) return undefined
182
+ if (typeof body === 'string' && isJsonMediaType(contentType)) return JSON.stringify(body)
182
183
  if (isFormBody(body)) return body as RequestBody
183
- if (contentType?.includes('multipart/form-data')) {
184
+ const normalizedContentType = contentType?.toLowerCase()
185
+ if (normalizedContentType?.includes('multipart/form-data')) {
184
186
  const formData = new FormData()
185
187
  for (const [key, value] of Object.entries(body as Record<string, unknown>)) {
186
188
  const partContentType = encoding?.[key]?.contentType
@@ -192,9 +194,9 @@ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encod
192
194
  }
193
195
  return formData
194
196
  }
195
- if (contentType?.includes('application/x-www-form-urlencoded')) {
197
+ if (normalizedContentType?.includes('application/x-www-form-urlencoded')) {
196
198
  if (encoding) return serializeUrlencodedBody(body as Record<string, unknown>, encoding)
197
- return new URLSearchParams(body as Record<string, string>)
199
+ return new URLSearchParams(serializeUrlencodedBody(body as Record<string, unknown>, {}))
198
200
  }
199
201
  return JSON.stringify(body, jsonReplacer)
200
202
  }