@oliver_nexro/zod_api
Advanced tools
Comparing version 0.7.5 to 0.7.6
@@ -1,2 +0,2 @@ | ||
import type { TypeOf, ZodBigInt, ZodBoolean, ZodDate, ZodDefault, ZodEnum, ZodLiteral, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRawShape, ZodString, ZodType, ZodUnion } from "zod"; | ||
import type { input, TypeOf, ZodBigInt, ZodBoolean, ZodDate, ZodDefault, ZodEnum, ZodLiteral, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRawShape, ZodString, ZodType, ZodUnion } from "zod"; | ||
/********************/ | ||
@@ -107,8 +107,2 @@ /********************/ | ||
/*********************/ | ||
export type InferZodParams<T extends ZodType> = T extends ZodDefault<infer Z extends ZodType> ? ((Z extends ZodObject<ZodRawShape> ? InferZodParams<Z> : TypeOf<Z>) | undefined) : T extends ZodObject<infer U> ? ZodObjectInputModel<U> : TypeOf<T>; | ||
export type ZodObjectInputModel<T extends ZodRawShape> = { | ||
[K in KeysOfThatExtend<T, ZodDefault<ZodType>>]?: InferZodParams<T[K]>; | ||
} & { | ||
[K in KeysOfThatDontExtend<T, ZodDefault<ZodType>>]: InferZodParams<T[K]>; | ||
}; | ||
export type BodylessApiActionMethod = "get" | "head"; | ||
@@ -139,8 +133,8 @@ export type BodyfullApiActionMethod = "post" | "put" | "patch" | "delete" | "options"; | ||
}; | ||
export type ParseParams<T, P extends keyof T, K extends string, AllowOptional = true> = T[P] extends ZodType ? (IsEmptyObject<T[P]> extends false ? (IsOptionalObject<InferZodParams<T[P]>> extends true ? (AllowOptional extends true ? { | ||
[key in K]?: InferZodParams<T[P]>; | ||
export type ParseParams<T, P extends keyof T, K extends string, AllowOptional = true> = T[P] extends ZodType ? (IsEmptyObject<T[P]> extends false ? (IsOptionalObject<input<T[P]>> extends true ? (AllowOptional extends true ? { | ||
[key in K]?: input<T[P]>; | ||
} : { | ||
[key in K]: InferZodParams<T[P]>; | ||
[key in K]: input<T[P]>; | ||
}) : { | ||
[key in K]: InferZodParams<T[P]>; | ||
[key in K]: input<T[P]>; | ||
}) : object) : object; | ||
@@ -147,0 +141,0 @@ export type RequestParams<T extends Fetcher> = Required<Parameters<T>>["1"]; |
@@ -0,0 +0,0 @@ import { createBody, createRequestParams, createUrl, parseParams, } from "./request_params.js"; |
@@ -5,3 +5,3 @@ { | ||
"name": "@oliver_nexro/zod_api", | ||
"version": "0.7.5", | ||
"version": "0.7.6", | ||
"description": "Configure API clients using Zod schemas for type-safety and interpreted action methods.", | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
import type { TypeOf, ZodBigInt, ZodBoolean, ZodDate, ZodDefault, ZodEnum, ZodLiteral, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRawShape, ZodString, ZodType, ZodUnion } from "zod"; | ||
import type { input, TypeOf, ZodBigInt, ZodBoolean, ZodDate, ZodDefault, ZodEnum, ZodLiteral, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRawShape, ZodString, ZodType, ZodUnion } from "zod"; | ||
/********************/ | ||
@@ -107,8 +107,2 @@ /********************/ | ||
/*********************/ | ||
export type InferZodParams<T extends ZodType> = T extends ZodDefault<infer Z extends ZodType> ? ((Z extends ZodObject<ZodRawShape> ? InferZodParams<Z> : TypeOf<Z>) | undefined) : T extends ZodObject<infer U> ? ZodObjectInputModel<U> : TypeOf<T>; | ||
export type ZodObjectInputModel<T extends ZodRawShape> = { | ||
[K in KeysOfThatExtend<T, ZodDefault<ZodType>>]?: InferZodParams<T[K]>; | ||
} & { | ||
[K in KeysOfThatDontExtend<T, ZodDefault<ZodType>>]: InferZodParams<T[K]>; | ||
}; | ||
export type BodylessApiActionMethod = "get" | "head"; | ||
@@ -139,8 +133,8 @@ export type BodyfullApiActionMethod = "post" | "put" | "patch" | "delete" | "options"; | ||
}; | ||
export type ParseParams<T, P extends keyof T, K extends string, AllowOptional = true> = T[P] extends ZodType ? (IsEmptyObject<T[P]> extends false ? (IsOptionalObject<InferZodParams<T[P]>> extends true ? (AllowOptional extends true ? { | ||
[key in K]?: InferZodParams<T[P]>; | ||
export type ParseParams<T, P extends keyof T, K extends string, AllowOptional = true> = T[P] extends ZodType ? (IsEmptyObject<T[P]> extends false ? (IsOptionalObject<input<T[P]>> extends true ? (AllowOptional extends true ? { | ||
[key in K]?: input<T[P]>; | ||
} : { | ||
[key in K]: InferZodParams<T[P]>; | ||
[key in K]: input<T[P]>; | ||
}) : { | ||
[key in K]: InferZodParams<T[P]>; | ||
[key in K]: input<T[P]>; | ||
}) : object) : object; | ||
@@ -147,0 +141,0 @@ export type RequestParams<T extends Fetcher> = Required<Parameters<T>>["1"]; |
@@ -0,0 +0,0 @@ "use strict"; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72557
1737