Socket
Socket
Sign inDemoInstall

@api-ts/io-ts-http

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@api-ts/io-ts-http - npm Package Compare versions

Comparing version 2.4.1-beta.1 to 2.4.1

2

dist/src/combinators.d.ts

@@ -5,3 +5,3 @@ import * as t from 'io-ts';

export declare const optionalized: <P extends t.Props>(props: P, name?: string) => OptionalizedC<P>;
export declare const flattened: <Props extends NestedProps>(name: string, props: Props) => t.Type<Simplify<Flattened<NestedType<Props>>>, Simplify<NestedOutputType<Props>>, unknown>;
export declare const flattened: <Props extends NestedProps>(name: string, props: Props) => t.Type<Simplify<(NestedType<Props>[keyof Props] extends infer T ? T extends NestedType<Props>[keyof Props] ? T extends any ? (x: T) => any : never : never : never) extends (x: infer R) => any ? R : never>, Simplify<NestedOutputType<Props>>, unknown>;
//# sourceMappingURL=combinators.d.ts.map

@@ -44,2 +44,5 @@ "use strict";

const result = partialCodec.encode(a);
if (result === undefined) {
return result;
}
for (const key of Object.keys(result)) {

@@ -46,0 +49,0 @@ if (result[key] === void 0) {

@@ -9,4 +9,4 @@ import * as t from 'io-ts';

}>;
export type HttpRequestCodec<T> = t.Type<T, t.OutputOf<typeof GenericHttpRequest>, unknown>;
export type HttpRequestCombinatorProps = {
export declare type HttpRequestCodec<T> = t.Type<T, t.OutputOf<typeof GenericHttpRequest>, unknown>;
export declare type HttpRequestCombinatorProps = {
params?: NonNullable<t.Props>;

@@ -17,9 +17,9 @@ query?: NonNullable<t.Props>;

};
type EmitOutputTypeErrors<P extends t.Props | undefined, O, OName extends string> = P extends undefined ? P : {
declare type EmitOutputTypeErrors<P extends t.Props | undefined, O, OName extends string> = P extends undefined ? P : {
[K in keyof P & string]: P[K] extends t.Type<any, O, any> ? P[K] : `Codec's output type is not assignable to \`${OName}\`. Try using one like \`NumberFromString\``;
};
type QueryValue = string | string[] | undefined;
type ParamValue = string | undefined;
type HeaderValue = string | undefined;
type EmitPropsErrors<P extends HttpRequestCombinatorProps> = {
declare type QueryValue = string | string[] | undefined;
declare type ParamValue = string | undefined;
declare type HeaderValue = string | undefined;
declare type EmitPropsErrors<P extends HttpRequestCombinatorProps> = {
params?: EmitOutputTypeErrors<P['params'], ParamValue, 'string | undefined'>;

@@ -26,0 +26,0 @@ query?: EmitOutputTypeErrors<P['query'], QueryValue, 'string | string[] | undefined'>;

import * as t from 'io-ts';
export type HttpResponse = {
export declare type HttpResponse = {
[K: number | string]: t.Mixed;

@@ -247,3 +247,3 @@ };

};
export type ResponseTypeForStatus<Response extends HttpResponse, S extends keyof Response> = Response[S] extends t.Mixed ? t.TypeOf<Response[S]> : never;
export declare type ResponseTypeForStatus<Response extends HttpResponse, S extends keyof Response> = Response[S] extends t.Mixed ? t.TypeOf<Response[S]> : never;
//# sourceMappingURL=httpResponse.d.ts.map

@@ -11,4 +11,4 @@ import * as t from 'io-ts';

}>;
export type Method = t.TypeOf<typeof Method>;
export type HttpRoute<M extends Method = Method> = {
export declare type Method = t.TypeOf<typeof Method>;
export declare type HttpRoute<M extends Method = Method> = {
readonly path: string;

@@ -19,4 +19,4 @@ readonly method: Uppercase<M>;

};
export type RequestType<T extends HttpRoute> = t.TypeOf<T['request']>;
export type ResponseType<T extends HttpRoute> = {
export declare type RequestType<T extends HttpRoute> = t.TypeOf<T['request']>;
export declare type ResponseType<T extends HttpRoute> = {
[K in keyof T['response']]: T['response'][K] extends t.Mixed ? {

@@ -27,3 +27,3 @@ type: K;

}[keyof T['response']];
export type ApiSpec = {
export declare type ApiSpec = {
[ApiAction: string]: {

@@ -33,3 +33,3 @@ [M in Method]?: HttpRoute<M>;

};
type UnknownKeysToError<Spec extends ApiSpec> = {
declare type UnknownKeysToError<Spec extends ApiSpec> = {
[ApiAction in keyof Spec]: {

@@ -36,0 +36,0 @@ [M in keyof Spec[ApiAction]]: M extends Method ? Spec[ApiAction][M] : `Unsupported HTTP Method. Use "get" | "post" | "put" | "delete" | "patch"`;

@@ -63,3 +63,3 @@ export declare const HttpToKeyStatus: {

};
export type HttpToKeyStatus = typeof HttpToKeyStatus;
export declare type HttpToKeyStatus = typeof HttpToKeyStatus;
export declare const KeyToHttpStatus: {

@@ -127,3 +127,3 @@ readonly continue: 100;

};
export type KeyToHttpStatus = typeof KeyToHttpStatus;
export declare type KeyToHttpStatus = typeof KeyToHttpStatus;
//# sourceMappingURL=statusCode.d.ts.map
import type * as t from 'io-ts';
type Defined<T> = T extends undefined ? never : T;
export type DefinedValues<T> = {
declare type Defined<T> = T extends undefined ? never : T;
export declare type DefinedValues<T> = {
[K in keyof T]: Defined<T[K]>;
};
type DefinedProps<Props extends t.Props> = {
declare type DefinedProps<Props extends t.Props> = {
[K in keyof Props]: Props[K] extends t.Type<infer A, infer O, infer I> ? t.Type<Defined<A>, O, I> : never;
};
type PossiblyUndefinedKeys<T> = {
declare type PossiblyUndefinedKeys<T> = {
[K in keyof T]: undefined extends T[K] ? K : never;
}[keyof T];
export type PossiblyUndefinedProps<T extends t.Props> = {
export declare type PossiblyUndefinedProps<T extends t.Props> = {
[K in keyof T]: undefined extends t.TypeOf<T[K]> ? K : never;
}[keyof T];
type Optionalized<T> = Simplify<Omit<T, PossiblyUndefinedKeys<T>> & Partial<DefinedValues<Pick<T, PossiblyUndefinedKeys<T>>>>>;
export type OptionalProps<Props extends t.Props> = DefinedProps<Pick<Props, PossiblyUndefinedProps<Props>>>;
export type RequiredProps<Props extends t.Props> = Omit<Props, PossiblyUndefinedProps<Props>>;
export type OptionalizedC<Props extends t.Props> = t.IntersectionC<[
declare type Optionalized<T> = Simplify<Omit<T, PossiblyUndefinedKeys<T>> & Partial<DefinedValues<Pick<T, PossiblyUndefinedKeys<T>>>>>;
export declare type OptionalProps<Props extends t.Props> = DefinedProps<Pick<Props, PossiblyUndefinedProps<Props>>>;
export declare type RequiredProps<Props extends t.Props> = Omit<Props, PossiblyUndefinedProps<Props>>;
export declare type OptionalizedC<Props extends t.Props> = t.IntersectionC<[
t.TypeC<RequiredProps<Props>>,
t.PartialC<OptionalProps<Props>>
]>;
export type NestedProps = {
export declare type NestedProps = {
[K: string]: t.Props;
};
export type NestedType<Props extends NestedProps> = {
export declare type NestedType<Props extends NestedProps> = {
[K in keyof Props]: Optionalized<t.TypeOfProps<Props[K]>>;
};
export type NestedOutputType<Props extends NestedProps> = {
export declare type NestedOutputType<Props extends NestedProps> = {
[K in keyof Props]: Optionalized<t.OutputOfProps<Props[K]>>;
};
export type Flattened<T> = UnionToIntersection<T[keyof T]>;
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
export type Simplify<T> = T extends unknown ? {
export declare type Flattened<T> = UnionToIntersection<T[keyof T]>;
declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
export declare type Simplify<T> = T extends unknown ? {
[K in keyof T]: T[K];

@@ -35,0 +35,0 @@ } : never;

{
"name": "@api-ts/io-ts-http",
"version": "2.4.1-beta.1",
"version": "2.4.1",
"description": "Types for (de)serializing HTTP requests from both the client and server side",

@@ -22,3 +22,3 @@ "author": "Patrick McLaughlin <patrickmclaughlin@bitgo.com>",

"dependencies": {
"@api-ts/response": "2.1.1-beta.1",
"@api-ts/response": "2.1.0",
"fp-ts": "^2.0.0",

@@ -29,5 +29,5 @@ "io-ts": "2.1.3",

"devDependencies": {
"@swc-node/register": "1.6.8",
"c8": "8.0.1",
"typescript": "5.2.2"
"@swc-node/register": "1.9.0",
"c8": "9.1.0",
"typescript": "4.7.4"
},

@@ -34,0 +34,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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