@kubb/plugin-fetch 5.10.0-canary.20261025T201031 → 5.10.1

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,6 +1,5 @@
1
1
  import { HeadersInit, RequestBody, Serializers, Styles } from "./serializers.js";
2
2
  import { ParseError, StandardSchemaValidator } from "./standardSchema.js";
3
- //#region templates/fetch.d.ts
4
3
  /**
5
4
  * HTTP status codes treated as a success, everything else is an error.
6
5
  */
@@ -391,5 +390,4 @@ export declare function toEventStream<TData = unknown>(result: Promise<{
391
390
  response: Response;
392
391
  }>): Promise<EventStreamResult<TData>>;
393
392
  export declare const client: ClientInstance<Request, Response>;
394
- export declare const createClient: (config?: Parameters<typeof client.createClient>[0]) => ClientInstance<Request, Response>;
395
- //#endregion
393
+ export declare const createClient: (config?: Parameters<typeof client.createClient>[0]) => ClientInstance<Request, Response>;
@@ -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-fetch",
3
- "version": "5.10.0-canary.20261025T201031",
3
+ "version": "5.10.1",
4
4
  "description": "Generate a slim, type-safe HTTP client with Kubb based on the native Fetch api.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -80,17 +80,17 @@
80
80
  "registry": "https://registry.npmjs.org/"
81
81
  },
82
82
  "dependencies": {
83
- "@kubb/plugin-ts": "^5.3.0-canary.20261025T201031",
84
- "@kubb/plugin-zod": "^5.8.0-canary.20261025T201031"
83
+ "@kubb/plugin-ts": "^5.3.3",
84
+ "@kubb/plugin-zod": "^5.7.4"
85
85
  },
86
86
  "devDependencies": {
87
- "@internals/client": "0.1.0-canary.20261025T201031",
88
- "@internals/shared": "0.1.0-canary.20261025T201031",
89
- "kubb": "^5.14.2",
87
+ "@internals/client": "0.0.0",
88
+ "@internals/shared": "0.0.0",
89
+ "kubb": "^5.15.0",
90
90
  "typescript": "^7.0.2"
91
91
  },
92
92
  "peerDependencies": {
93
- "kubb": "^5.14.2"
93
+ "kubb": "^5.15.0"
94
94
  },
95
95
  "engines": {
96
96
  "node": ">=22.22"
@@ -474,7 +474,7 @@ export async function resolveAuth(params: {
474
474
 
475
475
  if (scheme.type !== 'apiKey') {
476
476
  if (getHeader(headers, 'Authorization') === undefined) {
477
- headers['Authorization'] = scheme.scheme === 'basic' ? `Basic ${btoa(token)}` : `Bearer ${token}`
477
+ headers['Authorization'] = scheme.scheme === 'basic' ? `Basic ${btoa(String.fromCharCode(...new TextEncoder().encode(token)))}` : `Bearer ${token}`
478
478
  }
479
479
  return
480
480
  }
@@ -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
  }