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

openapi-typescript-helpers

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-typescript-helpers - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

46

index.d.ts

@@ -119,21 +119,43 @@ // HTTP types

/** Return first 2XX response from a Response Object Map */
export type SuccessResponse<T, Media extends MediaType = MediaType> = FilterKeys<
ResponseContent<FilterKeys<T, OkStatus>>,
Media
>;
/** Return all 2XX responses from a Response Object Map */
export type SuccessResponse<
T extends Record<string | number, any>,
Media extends MediaType = MediaType,
> = GetResponseContent<T, Media, OkStatus>;
type GetResponseContent<
T extends Record<string | number, any>,
Media extends MediaType = MediaType,
ResponseCode extends keyof T = keyof T,
> = ResponseCode extends keyof T
? {
[K in ResponseCode]: T[K]["content"] extends Record<string, any>
? FilterKeys<T[K]["content"], Media> extends never
? T[K]["content"]
: FilterKeys<T[K]["content"], Media>
: K extends keyof T
? T[K]["content"]
: never;
}[ResponseCode]
: never;
/**
* Return first 5XX or 4XX response (in that order) from a Response Object Map
* Return all 5XX and 4XX responses (in that order) from a Response Object Map
*/
export type ErrorResponse<T, Media extends MediaType = MediaType> = FilterKeys<
ResponseContent<FirstErrorStatus<T>>,
Media
>;
export type ErrorResponse<
T extends Record<string | number, any>,
Media extends MediaType = MediaType,
> = GetResponseContent<T, Media, ErrorStatus>;
/** Return first JSON-like 2XX response from a path + HTTP method */
export type SuccessResponseJSON<PathMethod> = SuccessResponse<ResponseObjectMap<PathMethod>, `${string}/json`>;
export type SuccessResponseJSON<PathMethod extends Record<string | number, any>> = SuccessResponse<
ResponseObjectMap<PathMethod>,
`${string}/json`
>;
/** Return first JSON-like 5XX or 4XX response from a path + HTTP method */
export type ErrorResponseJSON<PathMethod> = ErrorResponse<ResponseObjectMap<PathMethod>, `${string}/json`>;
export type ErrorResponseJSON<PathMethod extends Record<string | number, any>> = ErrorResponse<
ResponseObjectMap<PathMethod>,
`${string}/json`
>;

@@ -140,0 +162,0 @@ /** Return JSON-like request body from a path + HTTP method */

{
"name": "openapi-typescript-helpers",
"description": "TypeScript helpers for consuming openapi-typescript types",
"version": "0.0.14",
"version": "0.0.15",
"author": {

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

Sorry, the diff of this file is not supported yet

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