@orpc/zod 0.0.0-next.854b646 → 0.0.0-next.85df466

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 ADDED
@@ -0,0 +1,132 @@
1
+ <div align="center">
2
+ <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
3
+ </div>
4
+
5
+ <h1></h1>
6
+
7
+ <div align="center">
8
+ <a href="https://codecov.io/gh/unnoq/orpc">
9
+ <img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/@orpc/zod">
12
+ <img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fzod?logo=npm" />
13
+ </a>
14
+ <a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
15
+ <img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
16
+ </a>
17
+ <a href="https://discord.gg/TXEbwRBvQn">
18
+ <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
19
+ </a>
20
+ </div>
21
+
22
+ <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
23
+
24
+ **oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards, ensuring a smooth and enjoyable developer experience.
25
+
26
+ ---
27
+
28
+ ## Highlights
29
+
30
+ - **End-to-End Type Safety 🔒**: Ensure complete type safety from inputs to outputs and errors, bridging server and client seamlessly.
31
+ - **First-Class OpenAPI 📄**: Adheres to the OpenAPI standard out of the box, ensuring seamless integration and comprehensive API documentation.
32
+ - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
+ - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
+ - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
+ - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
36
+ - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
+ - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
+ - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
39
+ - **Native Types 📦**: Enjoy built-in support for Date, File, Blob, BigInt, URL and more with no extra setup.
40
+ - **Lazy Router ⏱️**: Improve cold start times with our lazy routing feature.
41
+ - **SSE & Streaming 📡**: Provides SSE and streaming features – perfect for real-time notifications and AI-powered streaming responses.
42
+ - **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
43
+ - **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
44
+ - **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
45
+ - **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
46
+
47
+ ## Documentation
48
+
49
+ You can find the full documentation [here](https://orpc.unnoq.com).
50
+
51
+ ## Packages
52
+
53
+ - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
+ - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
+ - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
+ - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
57
+ - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
58
+ - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
+ - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
60
+ - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
61
+
62
+ ## `@orpc/zod`
63
+
64
+ More schemas that [Zod](https://zod.dev/) doesn't support yet, and provides `ZodToJsonSchemaConverter` for generating OpenAPI specs.
65
+
66
+ ### More Schemas
67
+
68
+ - `oz.url`: Zod schema for [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) instance.
69
+ - `oz.blob`: Zod schema for [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) instance.
70
+ - `oz.file`: Zod schema for [File](https://developer.mozilla.org/en-US/docs/Web/API/File) instance.
71
+ - `oz.regexp`: Zod schema for [RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instance.
72
+
73
+ ```ts
74
+ import { oz } from '@orpc/zod'
75
+ import { z } from 'zod'
76
+
77
+ const Example = z.object({
78
+ url: oz.url(),
79
+ blob: oz.blob(),
80
+ file: oz.file().type('image/png'),
81
+ regexp: oz.regexp(),
82
+ })
83
+ ```
84
+
85
+ ### Generate OpenAPI Spec
86
+
87
+ ```ts
88
+ import { OpenAPIGenerator } from '@orpc/openapi'
89
+ import { ZodToJsonSchemaConverter } from '@orpc/zod'
90
+
91
+ const openAPIGenerator = new OpenAPIGenerator({
92
+ schemaConverters: [new ZodToJsonSchemaConverter()],
93
+ })
94
+
95
+ const specFromContract = await openAPIGenerator.generate(contract, {
96
+ info: {
97
+ title: 'My App',
98
+ version: '0.0.0',
99
+ },
100
+ })
101
+
102
+ const specFromRouter = await openAPIGenerator.generate(router, {
103
+ info: {
104
+ title: 'My App',
105
+ version: '0.0.0',
106
+ },
107
+ })
108
+ ```
109
+
110
+ ### Extending the Specification
111
+
112
+ ```ts
113
+ import { oz } from '@orpc/zod'
114
+ import { z } from 'zod'
115
+
116
+ const InputSchema = oz.openapi(
117
+ z.object({
118
+ name: z.string(),
119
+ }),
120
+ {
121
+ examples: [
122
+ { name: 'Earth' },
123
+ { name: 'Mars' },
124
+ ],
125
+ // additional options...
126
+ }
127
+ )
128
+ ```
129
+
130
+ ## License
131
+
132
+ Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
@@ -0,0 +1,89 @@
1
+ import { Context } from '@orpc/server';
2
+ import { Plugin } from '@orpc/server/plugins';
3
+ import { StandardHandlerOptions } from '@orpc/server/standard';
4
+ import { Schema } from '@orpc/contract';
5
+ import { JSONSchema, SchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
6
+ import { StandardSchemaV1 } from '@standard-schema/spec';
7
+ import { JSONSchema as JSONSchema$1 } from 'json-schema-typed/draft-2020-12';
8
+ import { ZodTypeDef, CustomErrorParams, ZodType, ZodEffects, ZodTypeAny, input, output } from 'zod';
9
+
10
+ declare class ZodSmartCoercionPlugin<TContext extends Context> implements Plugin<TContext> {
11
+ init(options: StandardHandlerOptions<TContext>): void;
12
+ }
13
+
14
+ declare const NON_LOGIC_KEYWORDS: ("default" | "$anchor" | "$comment" | "$defs" | "$dynamicAnchor" | "$dynamicRef" | "$id" | "$schema" | "$vocabulary" | "definitions" | "deprecated" | "description" | "examples" | "format" | "readOnly" | "title" | "writeOnly" | "contentEncoding" | "contentMediaType")[];
15
+ declare const UNSUPPORTED_JSON_SCHEMA: {
16
+ not: {};
17
+ };
18
+ declare const UNDEFINED_JSON_SCHEMA: {
19
+ const: string;
20
+ };
21
+ interface ZodToJsonSchemaOptions {
22
+ /**
23
+ * Max depth of lazy type, if it exceeds.
24
+ *
25
+ * Used `{}` when reach max depth
26
+ *
27
+ * @default 5
28
+ */
29
+ maxLazyDepth?: number;
30
+ /**
31
+ * The length used to track the depth of lazy type
32
+ *
33
+ * @internal
34
+ */
35
+ lazyDepth?: number;
36
+ /**
37
+ * The expected json schema for input or output zod schema
38
+ *
39
+ * @default input
40
+ */
41
+ mode?: 'input' | 'output';
42
+ /**
43
+ * Track if current level schema is handled custom json schema to prevent recursive
44
+ *
45
+ * @internal
46
+ */
47
+ isHandledCustomJSONSchema?: boolean;
48
+ /**
49
+ * Track if current level schema is handled zod description to prevent recursive
50
+ *
51
+ * @internal
52
+ */
53
+ isHandledZodDescription?: boolean;
54
+ }
55
+ declare function zodToJsonSchema(schema: StandardSchemaV1, options?: ZodToJsonSchemaOptions): Exclude<JSONSchema.JSONSchema, boolean>;
56
+ declare class ZodToJsonSchemaConverter implements SchemaConverter {
57
+ condition(schema: Schema): boolean;
58
+ convert(schema: Schema, options: SchemaConvertOptions): JSONSchema.JSONSchema;
59
+ }
60
+
61
+ type CustomZodType = 'File' | 'Blob' | 'Invalid Date' | 'RegExp' | 'URL';
62
+ type CustomParams = CustomErrorParams & {
63
+ fatal?: boolean;
64
+ };
65
+ declare function getCustomZodType(def: ZodTypeDef): CustomZodType | undefined;
66
+ declare function getCustomZodFileMimeType(def: ZodTypeDef): string | undefined;
67
+ declare function getCustomJSONSchema(def: ZodTypeDef, options?: {
68
+ mode?: 'input' | 'output';
69
+ }): Exclude<JSONSchema$1, boolean> | undefined;
70
+ declare function file(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>> & {
71
+ type(mimeType: string, params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodEffects<ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>>, InstanceType<typeof File>, InstanceType<typeof File>>;
72
+ };
73
+ declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof Blob>, ZodTypeDef, InstanceType<typeof Blob>>;
74
+ declare function invalidDate(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Date, ZodTypeDef, Date>;
75
+ declare function regexp(options?: CustomParams): ZodType<RegExp, ZodTypeDef, RegExp>;
76
+ declare function url(options?: CustomParams): ZodType<URL, ZodTypeDef, URL>;
77
+ declare function openapi<T extends ZodTypeAny, TMode extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema$1<TMode extends 'input' ? input<T> : TMode extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
78
+ mode: TMode;
79
+ }): ReturnType<T['refine']>;
80
+ declare const oz: {
81
+ openapi: typeof openapi;
82
+ file: typeof file;
83
+ blob: typeof blob;
84
+ invalidDate: typeof invalidDate;
85
+ regexp: typeof regexp;
86
+ url: typeof url;
87
+ };
88
+
89
+ export { type CustomZodType, NON_LOGIC_KEYWORDS, UNDEFINED_JSON_SCHEMA, UNSUPPORTED_JSON_SCHEMA, ZodSmartCoercionPlugin as ZodAutoCoercePlugin, ZodSmartCoercionPlugin, ZodToJsonSchemaConverter, type ZodToJsonSchemaOptions, blob, file, getCustomJSONSchema, getCustomZodFileMimeType, getCustomZodType, invalidDate, openapi, oz, regexp, url, zodToJsonSchema };
@@ -0,0 +1,89 @@
1
+ import { Context } from '@orpc/server';
2
+ import { Plugin } from '@orpc/server/plugins';
3
+ import { StandardHandlerOptions } from '@orpc/server/standard';
4
+ import { Schema } from '@orpc/contract';
5
+ import { JSONSchema, SchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
6
+ import { StandardSchemaV1 } from '@standard-schema/spec';
7
+ import { JSONSchema as JSONSchema$1 } from 'json-schema-typed/draft-2020-12';
8
+ import { ZodTypeDef, CustomErrorParams, ZodType, ZodEffects, ZodTypeAny, input, output } from 'zod';
9
+
10
+ declare class ZodSmartCoercionPlugin<TContext extends Context> implements Plugin<TContext> {
11
+ init(options: StandardHandlerOptions<TContext>): void;
12
+ }
13
+
14
+ declare const NON_LOGIC_KEYWORDS: ("default" | "$anchor" | "$comment" | "$defs" | "$dynamicAnchor" | "$dynamicRef" | "$id" | "$schema" | "$vocabulary" | "definitions" | "deprecated" | "description" | "examples" | "format" | "readOnly" | "title" | "writeOnly" | "contentEncoding" | "contentMediaType")[];
15
+ declare const UNSUPPORTED_JSON_SCHEMA: {
16
+ not: {};
17
+ };
18
+ declare const UNDEFINED_JSON_SCHEMA: {
19
+ const: string;
20
+ };
21
+ interface ZodToJsonSchemaOptions {
22
+ /**
23
+ * Max depth of lazy type, if it exceeds.
24
+ *
25
+ * Used `{}` when reach max depth
26
+ *
27
+ * @default 5
28
+ */
29
+ maxLazyDepth?: number;
30
+ /**
31
+ * The length used to track the depth of lazy type
32
+ *
33
+ * @internal
34
+ */
35
+ lazyDepth?: number;
36
+ /**
37
+ * The expected json schema for input or output zod schema
38
+ *
39
+ * @default input
40
+ */
41
+ mode?: 'input' | 'output';
42
+ /**
43
+ * Track if current level schema is handled custom json schema to prevent recursive
44
+ *
45
+ * @internal
46
+ */
47
+ isHandledCustomJSONSchema?: boolean;
48
+ /**
49
+ * Track if current level schema is handled zod description to prevent recursive
50
+ *
51
+ * @internal
52
+ */
53
+ isHandledZodDescription?: boolean;
54
+ }
55
+ declare function zodToJsonSchema(schema: StandardSchemaV1, options?: ZodToJsonSchemaOptions): Exclude<JSONSchema.JSONSchema, boolean>;
56
+ declare class ZodToJsonSchemaConverter implements SchemaConverter {
57
+ condition(schema: Schema): boolean;
58
+ convert(schema: Schema, options: SchemaConvertOptions): JSONSchema.JSONSchema;
59
+ }
60
+
61
+ type CustomZodType = 'File' | 'Blob' | 'Invalid Date' | 'RegExp' | 'URL';
62
+ type CustomParams = CustomErrorParams & {
63
+ fatal?: boolean;
64
+ };
65
+ declare function getCustomZodType(def: ZodTypeDef): CustomZodType | undefined;
66
+ declare function getCustomZodFileMimeType(def: ZodTypeDef): string | undefined;
67
+ declare function getCustomJSONSchema(def: ZodTypeDef, options?: {
68
+ mode?: 'input' | 'output';
69
+ }): Exclude<JSONSchema$1, boolean> | undefined;
70
+ declare function file(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>> & {
71
+ type(mimeType: string, params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodEffects<ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>>, InstanceType<typeof File>, InstanceType<typeof File>>;
72
+ };
73
+ declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof Blob>, ZodTypeDef, InstanceType<typeof Blob>>;
74
+ declare function invalidDate(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Date, ZodTypeDef, Date>;
75
+ declare function regexp(options?: CustomParams): ZodType<RegExp, ZodTypeDef, RegExp>;
76
+ declare function url(options?: CustomParams): ZodType<URL, ZodTypeDef, URL>;
77
+ declare function openapi<T extends ZodTypeAny, TMode extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema$1<TMode extends 'input' ? input<T> : TMode extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
78
+ mode: TMode;
79
+ }): ReturnType<T['refine']>;
80
+ declare const oz: {
81
+ openapi: typeof openapi;
82
+ file: typeof file;
83
+ blob: typeof blob;
84
+ invalidDate: typeof invalidDate;
85
+ regexp: typeof regexp;
86
+ url: typeof url;
87
+ };
88
+
89
+ export { type CustomZodType, NON_LOGIC_KEYWORDS, UNDEFINED_JSON_SCHEMA, UNSUPPORTED_JSON_SCHEMA, ZodSmartCoercionPlugin as ZodAutoCoercePlugin, ZodSmartCoercionPlugin, ZodToJsonSchemaConverter, type ZodToJsonSchemaOptions, blob, file, getCustomJSONSchema, getCustomZodFileMimeType, getCustomZodType, invalidDate, openapi, oz, regexp, url, zodToJsonSchema };
@@ -1,49 +1,23 @@
1
- // ../../node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/getType.js
2
- function getType(payload) {
3
- return Object.prototype.toString.call(payload).slice(8, -1);
4
- }
5
-
6
- // ../../node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/isPlainObject.js
7
- function isPlainObject(payload) {
8
- if (getType(payload) !== "Object")
9
- return false;
10
- const prototype = Object.getPrototypeOf(payload);
11
- return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
12
- }
13
-
14
- // ../../node_modules/.pnpm/radash@12.1.0/node_modules/radash/dist/esm/async.mjs
15
- var guard = (func, shouldGuard) => {
16
- const _guard = (err) => {
17
- if (shouldGuard && !shouldGuard(err))
18
- throw err;
19
- return void 0;
20
- };
21
- const isPromise2 = (result) => result instanceof Promise;
22
- try {
23
- const result = func();
24
- return isPromise2(result) ? result.catch(_guard) : result;
25
- } catch (err) {
26
- return _guard(err);
27
- }
28
- };
1
+ import { guard, isObject } from '@orpc/shared';
2
+ import { getCustomZodType as getCustomZodType$1 } from '@orpc/zod';
3
+ import { ZodFirstPartyTypeKind, custom } from 'zod';
4
+ import { JSONSchemaFormat } from '@orpc/openapi';
5
+ import escapeStringRegexp from 'escape-string-regexp';
6
+ import wcmatch from 'wildcard-match';
29
7
 
30
- // src/coercer.ts
31
- import {
32
- ZodFirstPartyTypeKind
33
- } from "zod";
34
- var ZodAutoCoercePlugin = class {
35
- beforeCreateProcedureClient(clientOptions) {
36
- clientOptions.interceptors ??= [];
37
- clientOptions.interceptors.unshift((options) => {
38
- const inputSchema = options.procedure["~orpc"].inputSchema;
8
+ class ZodSmartCoercionPlugin {
9
+ init(options) {
10
+ options.clientInterceptors ??= [];
11
+ options.clientInterceptors.unshift((options2) => {
12
+ const inputSchema = options2.procedure["~orpc"].inputSchema;
39
13
  if (!inputSchema || inputSchema["~standard"].vendor !== "zod") {
40
- return options.next();
14
+ return options2.next();
41
15
  }
42
- const coercedInput = zodCoerceInternal(inputSchema, options.input, { bracketNotation: true });
43
- return options.next({ ...options, input: coercedInput });
16
+ const coercedInput = zodCoerceInternal(inputSchema, options2.input, { bracketNotation: true });
17
+ return options2.next({ ...options2, input: coercedInput });
44
18
  });
45
19
  }
46
- };
20
+ }
47
21
  function zodCoerceInternal(schema, value, options) {
48
22
  const isRoot = options?.isRoot ?? true;
49
23
  const options_ = { ...options, isRoot: false };
@@ -54,7 +28,7 @@ function zodCoerceInternal(schema, value, options) {
54
28
  }
55
29
  return zodCoerceInternal(schema, value, options_);
56
30
  }
57
- const customType = getCustomZodType(schema._def);
31
+ const customType = getCustomZodType$1(schema._def);
58
32
  if (customType === "Invalid Date") {
59
33
  if (typeof value === "string" && value.toLocaleLowerCase() === "invalid date") {
60
34
  return /* @__PURE__ */ new Date("Invalid Date");
@@ -69,9 +43,9 @@ function zodCoerceInternal(schema, value, options) {
69
43
  }
70
44
  } else if (customType === "URL") {
71
45
  if (typeof value === "string") {
72
- const url2 = guard(() => new URL(value));
73
- if (url2 !== void 0) {
74
- return url2;
46
+ const url = guard(() => new URL(value));
47
+ if (url !== void 0) {
48
+ return url;
75
49
  }
76
50
  }
77
51
  }
@@ -128,7 +102,7 @@ function zodCoerceInternal(schema, value, options) {
128
102
  if (value === void 0) {
129
103
  return [];
130
104
  }
131
- if (isPlainObject(value) && Object.keys(value).every((k) => /^[1-9]\d*$/.test(k) || k === "0")) {
105
+ if (isObject(value) && Object.keys(value).every((k) => /^[1-9]\d*$/.test(k) || k === "0")) {
132
106
  const indexes = Object.keys(value).map((k) => Number(k)).sort((a, b) => a - b);
133
107
  const arr = Array.from({ length: (indexes.at(-1) ?? -1) + 1 });
134
108
  for (const i of indexes) {
@@ -139,7 +113,7 @@ function zodCoerceInternal(schema, value, options) {
139
113
  }
140
114
  } else if (typeName === ZodFirstPartyTypeKind.ZodObject) {
141
115
  const schema_ = schema;
142
- if (isPlainObject(value)) {
116
+ if (isObject(value)) {
143
117
  const newObj = {};
144
118
  const keys = /* @__PURE__ */ new Set([
145
119
  ...Object.keys(value),
@@ -177,7 +151,7 @@ function zodCoerceInternal(schema, value, options) {
177
151
  if (value === void 0) {
178
152
  return /* @__PURE__ */ new Set();
179
153
  }
180
- if (isPlainObject(value) && Object.keys(value).every((k) => /^[1-9]\d*$/.test(k) || k === "0")) {
154
+ if (isObject(value) && Object.keys(value).every((k) => /^[1-9]\d*$/.test(k) || k === "0")) {
181
155
  const indexes = Object.keys(value).map((k) => Number(k)).sort((a, b) => a - b);
182
156
  const arr = Array.from({ length: (indexes.at(-1) ?? -1) + 1 });
183
157
  for (const i of indexes) {
@@ -200,9 +174,9 @@ function zodCoerceInternal(schema, value, options) {
200
174
  if (value === void 0) {
201
175
  return /* @__PURE__ */ new Map();
202
176
  }
203
- if (isPlainObject(value)) {
177
+ if (isObject(value)) {
204
178
  const arr = Array.from({ length: Object.keys(value).length }).fill(void 0).map(
205
- (_, i) => isPlainObject(value[i]) && Object.keys(value[i]).length === 2 && "0" in value[i] && "1" in value[i] ? [value[i]["0"], value[i]["1"]] : void 0
179
+ (_, i) => isObject(value[i]) && Object.keys(value[i]).length === 2 && "0" in value[i] && "1" in value[i] ? [value[i]["0"], value[i]["1"]] : void 0
206
180
  );
207
181
  if (arr.every((v) => !!v)) {
208
182
  return new Map(
@@ -216,7 +190,7 @@ function zodCoerceInternal(schema, value, options) {
216
190
  }
217
191
  } else if (typeName === ZodFirstPartyTypeKind.ZodRecord) {
218
192
  const schema_ = schema;
219
- if (isPlainObject(value)) {
193
+ if (isObject(value)) {
220
194
  const newObj = {};
221
195
  for (const [k, v] of Object.entries(value)) {
222
196
  const key = zodCoerceInternal(schema_._def.keyType, k, options_);
@@ -337,38 +311,15 @@ function zodCoerceInternal(schema, value, options) {
337
311
  }
338
312
  }
339
313
  }
340
- } else {
341
- const _expected = typeName;
342
- }
314
+ } else ;
343
315
  return value;
344
316
  }
345
317
 
346
- // src/converter.ts
347
- import { JSONSchemaFormat } from "@orpc/openapi";
348
-
349
- // ../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
350
- function escapeStringRegexp(string) {
351
- if (typeof string !== "string") {
352
- throw new TypeError("Expected a string");
353
- }
354
- return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
355
- }
356
-
357
- // src/converter.ts
358
- import {
359
- ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2
360
- } from "zod";
361
-
362
- // src/schemas.ts
363
- import wcmatch from "wildcard-match";
364
- import {
365
- custom
366
- } from "zod";
367
- var customZodTypeSymbol = Symbol("customZodTypeSymbol");
368
- var customZodFileMimeTypeSymbol = Symbol("customZodFileMimeTypeSymbol");
369
- var CUSTOM_JSON_SCHEMA_SYMBOL = Symbol("CUSTOM_JSON_SCHEMA");
370
- var CUSTOM_JSON_SCHEMA_INPUT_SYMBOL = Symbol("CUSTOM_JSON_SCHEMA_INPUT");
371
- var CUSTOM_JSON_SCHEMA_OUTPUT_SYMBOL = Symbol("CUSTOM_JSON_SCHEMA_OUTPUT");
318
+ const customZodTypeSymbol = Symbol("customZodTypeSymbol");
319
+ const customZodFileMimeTypeSymbol = Symbol("customZodFileMimeTypeSymbol");
320
+ const CUSTOM_JSON_SCHEMA_SYMBOL = Symbol("CUSTOM_JSON_SCHEMA");
321
+ const CUSTOM_JSON_SCHEMA_INPUT_SYMBOL = Symbol("CUSTOM_JSON_SCHEMA_INPUT");
322
+ const CUSTOM_JSON_SCHEMA_OUTPUT_SYMBOL = Symbol("CUSTOM_JSON_SCHEMA_OUTPUT");
372
323
  function getCustomZodType(def) {
373
324
  return customZodTypeSymbol in def ? def[customZodTypeSymbol] : void 0;
374
325
  }
@@ -486,7 +437,7 @@ function openapi(schema, custom2, options) {
486
437
  });
487
438
  return newSchema;
488
439
  }
489
- var oz = {
440
+ const oz = {
490
441
  openapi,
491
442
  file,
492
443
  blob,
@@ -495,8 +446,7 @@ var oz = {
495
446
  url
496
447
  };
497
448
 
498
- // src/converter.ts
499
- var NON_LOGIC_KEYWORDS = [
449
+ const NON_LOGIC_KEYWORDS = [
500
450
  // Core Documentation Keywords
501
451
  "$anchor",
502
452
  "$comment",
@@ -523,8 +473,8 @@ var NON_LOGIC_KEYWORDS = [
523
473
  "$dynamicAnchor",
524
474
  "$dynamicRef"
525
475
  ];
526
- var UNSUPPORTED_JSON_SCHEMA = { not: {} };
527
- var UNDEFINED_JSON_SCHEMA = { const: "undefined" };
476
+ const UNSUPPORTED_JSON_SCHEMA = { not: {} };
477
+ const UNDEFINED_JSON_SCHEMA = { const: "undefined" };
528
478
  function zodToJsonSchema(schema, options) {
529
479
  if (schema["~standard"].vendor !== "zod") {
530
480
  console.warn(`Generate JSON schema not support ${schema["~standard"].vendor} yet`);
@@ -577,10 +527,9 @@ function zodToJsonSchema(schema, options) {
577
527
  return { type: "string", format: JSONSchemaFormat.URI };
578
528
  }
579
529
  }
580
- const _expectedCustomType = customType;
581
530
  const typeName = schema__._def.typeName;
582
531
  switch (typeName) {
583
- case ZodFirstPartyTypeKind2.ZodString: {
532
+ case ZodFirstPartyTypeKind.ZodString: {
584
533
  const schema_ = schema__;
585
534
  const json = { type: "string" };
586
535
  for (const check of schema_._def.checks) {
@@ -656,13 +605,13 @@ function zodToJsonSchema(schema, options) {
656
605
  json.pattern = "^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$";
657
606
  break;
658
607
  default: {
659
- const _expect = check.kind;
608
+ check.kind;
660
609
  }
661
610
  }
662
611
  }
663
612
  return json;
664
613
  }
665
- case ZodFirstPartyTypeKind2.ZodNumber: {
614
+ case ZodFirstPartyTypeKind.ZodNumber: {
666
615
  const schema_ = schema__;
667
616
  const json = { type: "number" };
668
617
  for (const check of schema_._def.checks) {
@@ -680,50 +629,50 @@ function zodToJsonSchema(schema, options) {
680
629
  json.multipleOf = check.value;
681
630
  break;
682
631
  default: {
683
- const _expect = check.kind;
632
+ check.kind;
684
633
  }
685
634
  }
686
635
  }
687
636
  return json;
688
637
  }
689
- case ZodFirstPartyTypeKind2.ZodNaN: {
638
+ case ZodFirstPartyTypeKind.ZodNaN: {
690
639
  return { const: "NaN" };
691
640
  }
692
- case ZodFirstPartyTypeKind2.ZodBigInt: {
641
+ case ZodFirstPartyTypeKind.ZodBigInt: {
693
642
  const json = { type: "string", pattern: "^-?[0-9]+$" };
694
643
  return json;
695
644
  }
696
- case ZodFirstPartyTypeKind2.ZodBoolean: {
645
+ case ZodFirstPartyTypeKind.ZodBoolean: {
697
646
  return { type: "boolean" };
698
647
  }
699
- case ZodFirstPartyTypeKind2.ZodDate: {
648
+ case ZodFirstPartyTypeKind.ZodDate: {
700
649
  const schema2 = { type: "string", format: JSONSchemaFormat.Date };
701
650
  return schema2;
702
651
  }
703
- case ZodFirstPartyTypeKind2.ZodNull: {
652
+ case ZodFirstPartyTypeKind.ZodNull: {
704
653
  return { type: "null" };
705
654
  }
706
- case ZodFirstPartyTypeKind2.ZodVoid:
707
- case ZodFirstPartyTypeKind2.ZodUndefined: {
655
+ case ZodFirstPartyTypeKind.ZodVoid:
656
+ case ZodFirstPartyTypeKind.ZodUndefined: {
708
657
  return UNDEFINED_JSON_SCHEMA;
709
658
  }
710
- case ZodFirstPartyTypeKind2.ZodLiteral: {
659
+ case ZodFirstPartyTypeKind.ZodLiteral: {
711
660
  const schema_ = schema__;
712
661
  return { const: schema_._def.value };
713
662
  }
714
- case ZodFirstPartyTypeKind2.ZodEnum: {
663
+ case ZodFirstPartyTypeKind.ZodEnum: {
715
664
  const schema_ = schema__;
716
665
  return {
717
666
  enum: schema_._def.values
718
667
  };
719
668
  }
720
- case ZodFirstPartyTypeKind2.ZodNativeEnum: {
669
+ case ZodFirstPartyTypeKind.ZodNativeEnum: {
721
670
  const schema_ = schema__;
722
671
  return {
723
672
  enum: Object.values(schema_._def.values)
724
673
  };
725
674
  }
726
- case ZodFirstPartyTypeKind2.ZodArray: {
675
+ case ZodFirstPartyTypeKind.ZodArray: {
727
676
  const schema_ = schema__;
728
677
  const def = schema_._def;
729
678
  const json = { type: "array" };
@@ -740,7 +689,7 @@ function zodToJsonSchema(schema, options) {
740
689
  }
741
690
  return json;
742
691
  }
743
- case ZodFirstPartyTypeKind2.ZodTuple: {
692
+ case ZodFirstPartyTypeKind.ZodTuple: {
744
693
  const schema_ = schema__;
745
694
  const prefixItems = [];
746
695
  const json = { type: "array" };
@@ -758,7 +707,7 @@ function zodToJsonSchema(schema, options) {
758
707
  }
759
708
  return json;
760
709
  }
761
- case ZodFirstPartyTypeKind2.ZodObject: {
710
+ case ZodFirstPartyTypeKind.ZodObject: {
762
711
  const schema_ = schema__;
763
712
  const json = { type: "object" };
764
713
  const properties = {};
@@ -794,7 +743,7 @@ function zodToJsonSchema(schema, options) {
794
743
  }
795
744
  return json;
796
745
  }
797
- case ZodFirstPartyTypeKind2.ZodRecord: {
746
+ case ZodFirstPartyTypeKind.ZodRecord: {
798
747
  const schema_ = schema__;
799
748
  const json = { type: "object" };
800
749
  json.additionalProperties = zodToJsonSchema(
@@ -803,14 +752,14 @@ function zodToJsonSchema(schema, options) {
803
752
  );
804
753
  return json;
805
754
  }
806
- case ZodFirstPartyTypeKind2.ZodSet: {
755
+ case ZodFirstPartyTypeKind.ZodSet: {
807
756
  const schema_ = schema__;
808
757
  return {
809
758
  type: "array",
810
759
  items: zodToJsonSchema(schema_._def.valueType, childOptions)
811
760
  };
812
761
  }
813
- case ZodFirstPartyTypeKind2.ZodMap: {
762
+ case ZodFirstPartyTypeKind.ZodMap: {
814
763
  const schema_ = schema__;
815
764
  return {
816
765
  type: "array",
@@ -825,8 +774,8 @@ function zodToJsonSchema(schema, options) {
825
774
  }
826
775
  };
827
776
  }
828
- case ZodFirstPartyTypeKind2.ZodUnion:
829
- case ZodFirstPartyTypeKind2.ZodDiscriminatedUnion: {
777
+ case ZodFirstPartyTypeKind.ZodUnion:
778
+ case ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
830
779
  const schema_ = schema__;
831
780
  const anyOf = [];
832
781
  for (const s of schema_._def.options) {
@@ -834,7 +783,7 @@ function zodToJsonSchema(schema, options) {
834
783
  }
835
784
  return { anyOf };
836
785
  }
837
- case ZodFirstPartyTypeKind2.ZodIntersection: {
786
+ case ZodFirstPartyTypeKind.ZodIntersection: {
838
787
  const schema_ = schema__;
839
788
  const allOf = [];
840
789
  for (const s of [schema_._def.left, schema_._def.right]) {
@@ -842,7 +791,7 @@ function zodToJsonSchema(schema, options) {
842
791
  }
843
792
  return { allOf };
844
793
  }
845
- case ZodFirstPartyTypeKind2.ZodLazy: {
794
+ case ZodFirstPartyTypeKind.ZodLazy: {
846
795
  const schema_ = schema__;
847
796
  const maxLazyDepth = childOptions?.maxLazyDepth ?? 5;
848
797
  const lazyDepth = childOptions?.lazyDepth ?? 0;
@@ -854,49 +803,49 @@ function zodToJsonSchema(schema, options) {
854
803
  lazyDepth: lazyDepth + 1
855
804
  });
856
805
  }
857
- case ZodFirstPartyTypeKind2.ZodUnknown:
858
- case ZodFirstPartyTypeKind2.ZodAny:
806
+ case ZodFirstPartyTypeKind.ZodUnknown:
807
+ case ZodFirstPartyTypeKind.ZodAny:
859
808
  case void 0: {
860
809
  return {};
861
810
  }
862
- case ZodFirstPartyTypeKind2.ZodOptional: {
811
+ case ZodFirstPartyTypeKind.ZodOptional: {
863
812
  const schema_ = schema__;
864
813
  const inner = zodToJsonSchema(schema_._def.innerType, childOptions);
865
814
  return {
866
815
  anyOf: [UNDEFINED_JSON_SCHEMA, inner]
867
816
  };
868
817
  }
869
- case ZodFirstPartyTypeKind2.ZodReadonly: {
818
+ case ZodFirstPartyTypeKind.ZodReadonly: {
870
819
  const schema_ = schema__;
871
820
  return zodToJsonSchema(schema_._def.innerType, childOptions);
872
821
  }
873
- case ZodFirstPartyTypeKind2.ZodDefault: {
822
+ case ZodFirstPartyTypeKind.ZodDefault: {
874
823
  const schema_ = schema__;
875
824
  return zodToJsonSchema(schema_._def.innerType, childOptions);
876
825
  }
877
- case ZodFirstPartyTypeKind2.ZodEffects: {
826
+ case ZodFirstPartyTypeKind.ZodEffects: {
878
827
  const schema_ = schema__;
879
828
  if (schema_._def.effect.type === "transform" && childOptions?.mode === "output") {
880
829
  return {};
881
830
  }
882
831
  return zodToJsonSchema(schema_._def.schema, childOptions);
883
832
  }
884
- case ZodFirstPartyTypeKind2.ZodCatch: {
833
+ case ZodFirstPartyTypeKind.ZodCatch: {
885
834
  const schema_ = schema__;
886
835
  return zodToJsonSchema(schema_._def.innerType, childOptions);
887
836
  }
888
- case ZodFirstPartyTypeKind2.ZodBranded: {
837
+ case ZodFirstPartyTypeKind.ZodBranded: {
889
838
  const schema_ = schema__;
890
839
  return zodToJsonSchema(schema_._def.type, childOptions);
891
840
  }
892
- case ZodFirstPartyTypeKind2.ZodPipeline: {
841
+ case ZodFirstPartyTypeKind.ZodPipeline: {
893
842
  const schema_ = schema__;
894
843
  return zodToJsonSchema(
895
844
  childOptions?.mode === "output" ? schema_._def.out : schema_._def.in,
896
845
  childOptions
897
846
  );
898
847
  }
899
- case ZodFirstPartyTypeKind2.ZodNullable: {
848
+ case ZodFirstPartyTypeKind.ZodNullable: {
900
849
  const schema_ = schema__;
901
850
  const inner = zodToJsonSchema(schema_._def.innerType, childOptions);
902
851
  return {
@@ -904,7 +853,6 @@ function zodToJsonSchema(schema, options) {
904
853
  };
905
854
  }
906
855
  }
907
- const _expected = typeName;
908
856
  return UNSUPPORTED_JSON_SCHEMA;
909
857
  }
910
858
  function extractJSONSchema(schema, check, matches = []) {
@@ -947,7 +895,7 @@ function extractJSONSchema(schema, check, matches = []) {
947
895
  }
948
896
  return { schema, matches };
949
897
  }
950
- var ZodToJsonSchemaConverter = class {
898
+ class ZodToJsonSchemaConverter {
951
899
  condition(schema) {
952
900
  return Boolean(schema && schema["~standard"].vendor === "zod");
953
901
  }
@@ -955,23 +903,6 @@ var ZodToJsonSchemaConverter = class {
955
903
  const jsonSchema = schema;
956
904
  return zodToJsonSchema(jsonSchema, { mode: options.strategy });
957
905
  }
958
- };
959
- export {
960
- NON_LOGIC_KEYWORDS,
961
- UNDEFINED_JSON_SCHEMA,
962
- UNSUPPORTED_JSON_SCHEMA,
963
- ZodAutoCoercePlugin,
964
- ZodToJsonSchemaConverter,
965
- blob,
966
- file,
967
- getCustomJSONSchema,
968
- getCustomZodFileMimeType,
969
- getCustomZodType,
970
- invalidDate,
971
- openapi,
972
- oz,
973
- regexp,
974
- url,
975
- zodToJsonSchema
976
- };
977
- //# sourceMappingURL=index.js.map
906
+ }
907
+
908
+ export { NON_LOGIC_KEYWORDS, UNDEFINED_JSON_SCHEMA, UNSUPPORTED_JSON_SCHEMA, ZodSmartCoercionPlugin as ZodAutoCoercePlugin, ZodSmartCoercionPlugin, ZodToJsonSchemaConverter, blob, file, getCustomJSONSchema, getCustomZodFileMimeType, getCustomZodType, invalidDate, openapi, oz, regexp, url, zodToJsonSchema };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/zod",
3
3
  "type": "module",
4
- "version": "0.0.0-next.854b646",
4
+ "version": "0.0.0-next.85df466",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -15,31 +15,29 @@
15
15
  ],
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/src/index.d.ts",
19
- "import": "./dist/index.js",
20
- "default": "./dist/index.js"
21
- },
22
- "./🔒/*": {
23
- "types": "./dist/src/*.d.ts"
18
+ "types": "./dist/index.d.mts",
19
+ "import": "./dist/index.mjs",
20
+ "default": "./dist/index.mjs"
24
21
  }
25
22
  },
26
23
  "files": [
27
- "!**/*.map",
28
- "!**/*.tsbuildinfo",
29
24
  "dist"
30
25
  ],
31
26
  "peerDependencies": {
32
- "@orpc/openapi": "0.0.0-next.854b646",
33
- "@orpc/server": "0.0.0-next.854b646"
27
+ "@orpc/contract": "0.0.0-next.85df466",
28
+ "@orpc/openapi": "0.0.0-next.85df466",
29
+ "@orpc/server": "0.0.0-next.85df466"
34
30
  },
35
31
  "dependencies": {
36
32
  "@standard-schema/spec": "^1.0.0",
33
+ "escape-string-regexp": "^5.0.0",
37
34
  "json-schema-typed": "^8.0.1",
38
35
  "wildcard-match": "^5.1.3",
39
- "zod": "^3.24.1"
36
+ "zod": "^3.24.1",
37
+ "@orpc/shared": "0.0.0-next.85df466"
40
38
  },
41
39
  "scripts": {
42
- "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
40
+ "build": "unbuild",
43
41
  "build:watch": "pnpm run build --watch",
44
42
  "type:check": "tsc -b"
45
43
  }
@@ -1,7 +0,0 @@
1
- import type { Context } from '@orpc/server';
2
- import type { Plugin } from '@orpc/server/plugins';
3
- import type { WellCreateProcedureClientOptions } from '@orpc/server/standard';
4
- export declare class ZodAutoCoercePlugin<TContext extends Context> implements Plugin<TContext> {
5
- beforeCreateProcedureClient(clientOptions: WellCreateProcedureClientOptions<TContext>): void;
6
- }
7
- //# sourceMappingURL=coercer.d.ts.map
@@ -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
@@ -1,4 +0,0 @@
1
- export * from './coercer';
2
- export * from './converter';
3
- export * from './schemas';
4
- //# sourceMappingURL=index.d.ts.map
@@ -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