Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openapi-fetch

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-fetch - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

6

CHANGELOG.md
# openapi-fetch
## 0.1.3
### Patch Changes
- 8c01480: Fix querySerializer signature
## 0.1.2

@@ -4,0 +10,0 @@

14

dist/index.d.ts

@@ -51,10 +51,10 @@ /** options for each client instance */

};
export type QuerySerializer<O> = {
querySerializer?: (query: O extends {
parameters: {
query: any;
};
} ? O['parameters']['query'] : Record<string, unknown>) => string;
export type QuerySerializer<O> = (query: O extends {
parameters: {
query: any;
};
} ? O['parameters']['query'] : Record<string, unknown>) => string;
export type FetchOptions<T> = Params<T> & RequestBody<T> & Omit<RequestInit, 'body'> & {
querySerializer?: QuerySerializer<T>;
};
export type FetchOptions<T> = Params<T> & RequestBody<T> & Omit<RequestInit, 'body'> & QuerySerializer<T>;
export type Success<O> = FilterKeys<FilterKeys<O, OkStatus>, 'content'>;

@@ -61,0 +61,0 @@ export type Error<O> = FilterKeys<FilterKeys<O, ErrorStatus>, 'content'>;

@@ -11,3 +11,3 @@ // settings

async function coreFetch(url, fetchOptions) {
let { headers, body: requestBody, params = {}, querySerializer = (q) => new URLSearchParams(q).toString(), ...init } = fetchOptions || {};
const { headers, body: requestBody, params = {}, querySerializer = (q) => new URLSearchParams(q).toString(), ...init } = fetchOptions || {};
// URL

@@ -14,0 +14,0 @@ let finalURL = `${options?.baseUrl ?? ''}${url}`;

@@ -51,10 +51,10 @@ /** options for each client instance */

};
export type QuerySerializer<O> = {
querySerializer?: (query: O extends {
parameters: {
query: any;
};
} ? O['parameters']['query'] : Record<string, unknown>) => string;
export type QuerySerializer<O> = (query: O extends {
parameters: {
query: any;
};
} ? O['parameters']['query'] : Record<string, unknown>) => string;
export type FetchOptions<T> = Params<T> & RequestBody<T> & Omit<RequestInit, 'body'> & {
querySerializer?: QuerySerializer<T>;
};
export type FetchOptions<T> = Params<T> & RequestBody<T> & Omit<RequestInit, 'body'> & QuerySerializer<T>;
export type Success<O> = FilterKeys<FilterKeys<O, OkStatus>, 'content'>;

@@ -61,0 +61,0 @@ export type Error<O> = FilterKeys<FilterKeys<O, ErrorStatus>, 'content'>;

{
"name": "openapi-fetch",
"version": "0.1.2",
"version": "0.1.3",
"author": {

@@ -5,0 +5,0 @@ "name": "Drew Powers",

@@ -43,4 +43,4 @@ // settings

export type RequestBody<O> = undefined extends RequestBodyJSON<O> ? { body?: RequestBodyJSON<O> } : { body: RequestBodyJSON<O> };
export type QuerySerializer<O> = { querySerializer?: (query: O extends { parameters: { query: any } } ? O['parameters']['query'] : Record<string, unknown>) => string };
export type FetchOptions<T> = Params<T> & RequestBody<T> & Omit<RequestInit, 'body'> & QuerySerializer<T>;
export type QuerySerializer<O> = (query: O extends { parameters: { query: any } } ? O['parameters']['query'] : Record<string, unknown>) => string;
export type FetchOptions<T> = Params<T> & RequestBody<T> & Omit<RequestInit, 'body'> & { querySerializer?: QuerySerializer<T> };
export type Success<O> = FilterKeys<FilterKeys<O, OkStatus>, 'content'>;

@@ -59,3 +59,3 @@ export type Error<O> = FilterKeys<FilterKeys<O, ErrorStatus>, 'content'>;

async function coreFetch<P extends keyof Paths, M extends HttpMethod>(url: P, fetchOptions: FetchOptions<M extends keyof Paths[P] ? Paths[P][M] : never>): Promise<FetchResponse<M extends keyof Paths[P] ? Paths[P][M] : unknown>> {
let { headers, body: requestBody, params = {}, querySerializer = (q: QuerySerializer<M extends keyof Paths[P] ? Paths[P][M] : never>) => new URLSearchParams(q as any).toString(), ...init } = fetchOptions || {};
const { headers, body: requestBody, params = {}, querySerializer = (q: QuerySerializer<M extends keyof Paths[P] ? Paths[P][M] : never>) => new URLSearchParams(q as any).toString(), ...init } = fetchOptions || {};

@@ -62,0 +62,0 @@ // URL

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc