@orpc/zod 0.0.0-next.f17a1a0 → 0.0.0-next.f4d410a
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.
- package/README.md +4 -2
- package/dist/index.d.mts +82 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.mjs +822 -0
- package/package.json +14 -17
- package/dist/index.js +0 -980
- package/dist/src/coercer.d.ts +0 -12
- package/dist/src/converter.d.ts +0 -50
- package/dist/src/index.d.ts +0 -4
- package/dist/src/schemas.d.ts +0 -31
package/dist/src/coercer.d.ts
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
import type { Context } from '@orpc/server';
|
2
|
-
import type { Plugin } from '@orpc/server/plugins';
|
3
|
-
import type { StandardHandlerOptions } from '@orpc/server/standard';
|
4
|
-
export declare class ZodSmartCoercionPlugin<TContext extends Context> implements Plugin<TContext> {
|
5
|
-
init(options: StandardHandlerOptions<TContext>): void;
|
6
|
-
}
|
7
|
-
export {
|
8
|
-
/**
|
9
|
-
* @deprecated ZodAutoCoercePlugin has renamed to ZodSmartCoercionPlugin
|
10
|
-
*/
|
11
|
-
ZodSmartCoercionPlugin as ZodAutoCoercePlugin, };
|
12
|
-
//# sourceMappingURL=coercer.d.ts.map
|
package/dist/src/converter.d.ts
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
import type { Schema } from '@orpc/contract';
|
2
|
-
import type { JSONSchema, SchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
3
|
-
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
4
|
-
export declare const NON_LOGIC_KEYWORDS: ("$anchor" | "$comment" | "$defs" | "$dynamicAnchor" | "$dynamicRef" | "$id" | "$schema" | "$vocabulary" | "contentEncoding" | "contentMediaType" | "default" | "definitions" | "deprecated" | "description" | "examples" | "format" | "readOnly" | "title" | "writeOnly")[];
|
5
|
-
export declare const UNSUPPORTED_JSON_SCHEMA: {
|
6
|
-
not: {};
|
7
|
-
};
|
8
|
-
export declare const UNDEFINED_JSON_SCHEMA: {
|
9
|
-
const: string;
|
10
|
-
};
|
11
|
-
export interface ZodToJsonSchemaOptions {
|
12
|
-
/**
|
13
|
-
* Max depth of lazy type, if it exceeds.
|
14
|
-
*
|
15
|
-
* Used `{}` when reach max depth
|
16
|
-
*
|
17
|
-
* @default 5
|
18
|
-
*/
|
19
|
-
maxLazyDepth?: number;
|
20
|
-
/**
|
21
|
-
* The length used to track the depth of lazy type
|
22
|
-
*
|
23
|
-
* @internal
|
24
|
-
*/
|
25
|
-
lazyDepth?: number;
|
26
|
-
/**
|
27
|
-
* The expected json schema for input or output zod schema
|
28
|
-
*
|
29
|
-
* @default input
|
30
|
-
*/
|
31
|
-
mode?: 'input' | 'output';
|
32
|
-
/**
|
33
|
-
* Track if current level schema is handled custom json schema to prevent recursive
|
34
|
-
*
|
35
|
-
* @internal
|
36
|
-
*/
|
37
|
-
isHandledCustomJSONSchema?: boolean;
|
38
|
-
/**
|
39
|
-
* Track if current level schema is handled zod description to prevent recursive
|
40
|
-
*
|
41
|
-
* @internal
|
42
|
-
*/
|
43
|
-
isHandledZodDescription?: boolean;
|
44
|
-
}
|
45
|
-
export declare function zodToJsonSchema(schema: StandardSchemaV1, options?: ZodToJsonSchemaOptions): Exclude<JSONSchema.JSONSchema, boolean>;
|
46
|
-
export declare class ZodToJsonSchemaConverter implements SchemaConverter {
|
47
|
-
condition(schema: Schema): boolean;
|
48
|
-
convert(schema: Schema, options: SchemaConvertOptions): JSONSchema.JSONSchema;
|
49
|
-
}
|
50
|
-
//# sourceMappingURL=converter.d.ts.map
|
package/dist/src/index.d.ts
DELETED
package/dist/src/schemas.d.ts
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
import type { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
2
|
-
import { type CustomErrorParams, type input, type output, type ZodEffects, type ZodType, type ZodTypeAny, type ZodTypeDef } from 'zod';
|
3
|
-
export type CustomZodType = 'File' | 'Blob' | 'Invalid Date' | 'RegExp' | 'URL';
|
4
|
-
type CustomParams = CustomErrorParams & {
|
5
|
-
fatal?: boolean;
|
6
|
-
};
|
7
|
-
export declare function getCustomZodType(def: ZodTypeDef): CustomZodType | undefined;
|
8
|
-
export declare function getCustomZodFileMimeType(def: ZodTypeDef): string | undefined;
|
9
|
-
export declare function getCustomJSONSchema(def: ZodTypeDef, options?: {
|
10
|
-
mode?: 'input' | 'output';
|
11
|
-
}): Exclude<JSONSchema, boolean> | undefined;
|
12
|
-
export declare function file(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>> & {
|
13
|
-
type(mimeType: string, params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodEffects<ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>>, InstanceType<typeof File>, InstanceType<typeof File>>;
|
14
|
-
};
|
15
|
-
export declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof Blob>, ZodTypeDef, InstanceType<typeof Blob>>;
|
16
|
-
export declare function invalidDate(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Date, ZodTypeDef, Date>;
|
17
|
-
export declare function regexp(options?: CustomParams): ZodType<RegExp, ZodTypeDef, RegExp>;
|
18
|
-
export declare function url(options?: CustomParams): ZodType<URL, ZodTypeDef, URL>;
|
19
|
-
export declare function openapi<T extends ZodTypeAny, TMode extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema<TMode extends 'input' ? input<T> : TMode extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
|
20
|
-
mode: TMode;
|
21
|
-
}): ReturnType<T['refine']>;
|
22
|
-
export declare const oz: {
|
23
|
-
openapi: typeof openapi;
|
24
|
-
file: typeof file;
|
25
|
-
blob: typeof blob;
|
26
|
-
invalidDate: typeof invalidDate;
|
27
|
-
regexp: typeof regexp;
|
28
|
-
url: typeof url;
|
29
|
-
};
|
30
|
-
export {};
|
31
|
-
//# sourceMappingURL=schemas.d.ts.map
|