@orpc/zod 0.0.0-next.3afb521 → 0.0.0-next.3b1dac3

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/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodE
3
3
  import { Context } from '@orpc/server';
4
4
  import { HandlerPlugin } from '@orpc/server/plugins';
5
5
  import { StandardHandlerOptions } from '@orpc/server/standard';
6
- import { Schema } from '@orpc/contract';
6
+ import { AnySchema } from '@orpc/contract';
7
7
 
8
8
  declare function getCustomJsonSchema(def: ZodTypeDef, options: {
9
9
  strategy: 'input' | 'output' | 'both';
@@ -67,8 +67,8 @@ declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
67
67
  private readonly unsupportedJsonSchema;
68
68
  private readonly anyJsonSchema;
69
69
  constructor(options?: ZodToJsonSchemaOptions);
70
- condition(schema: Schema): boolean;
71
- convert(schema: Schema, options: SchemaConvertOptions, lazyDepth?: number, isHandledCustomJSONSchema?: boolean, isHandledZodDescription?: boolean): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
70
+ condition(schema: AnySchema | undefined): boolean;
71
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions, lazyDepth?: number, isHandledCustomJSONSchema?: boolean, isHandledZodDescription?: boolean): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
72
72
  }
73
73
 
74
74
  declare const oz: {
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodE
3
3
  import { Context } from '@orpc/server';
4
4
  import { HandlerPlugin } from '@orpc/server/plugins';
5
5
  import { StandardHandlerOptions } from '@orpc/server/standard';
6
- import { Schema } from '@orpc/contract';
6
+ import { AnySchema } from '@orpc/contract';
7
7
 
8
8
  declare function getCustomJsonSchema(def: ZodTypeDef, options: {
9
9
  strategy: 'input' | 'output' | 'both';
@@ -67,8 +67,8 @@ declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
67
67
  private readonly unsupportedJsonSchema;
68
68
  private readonly anyJsonSchema;
69
69
  constructor(options?: ZodToJsonSchemaOptions);
70
- condition(schema: Schema): boolean;
71
- convert(schema: Schema, options: SchemaConvertOptions, lazyDepth?: number, isHandledCustomJSONSchema?: boolean, isHandledZodDescription?: boolean): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
70
+ condition(schema: AnySchema | undefined): boolean;
71
+ convert(schema: AnySchema | undefined, options: SchemaConvertOptions, lazyDepth?: number, isHandledCustomJSONSchema?: boolean, isHandledZodDescription?: boolean): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
72
72
  }
73
73
 
74
74
  declare const oz: {
package/dist/index.mjs CHANGED
@@ -398,7 +398,7 @@ class ZodToJsonSchemaConverter {
398
398
  this.anyJsonSchema = options.anyJsonSchema ?? {};
399
399
  }
400
400
  condition(schema) {
401
- return Boolean(schema && schema["~standard"].vendor === "zod");
401
+ return schema !== void 0 && schema["~standard"].vendor === "zod";
402
402
  }
403
403
  convert(schema, options, lazyDepth = 0, isHandledCustomJSONSchema = false, isHandledZodDescription = false) {
404
404
  const def = schema._def;
@@ -656,9 +656,8 @@ class ZodToJsonSchemaConverter {
656
656
  case ZodFirstPartyTypeKind.ZodRecord: {
657
657
  const schema_ = schema;
658
658
  const json = { type: "object" };
659
- const keyTypeName = this.#getZodTypeName(schema_._def.keyType._def);
660
- if (keyTypeName !== ZodFirstPartyTypeKind.ZodString) {
661
- const [_2, keyJson] = this.convert(schema_._def.keyType, options, lazyDepth, false, false);
659
+ const [__, keyJson] = this.convert(schema_._def.keyType, options, lazyDepth, false, false);
660
+ if (Object.entries(keyJson).some(([k, v]) => k !== "type" || v !== "string")) {
662
661
  json.propertyNames = keyJson;
663
662
  }
664
663
  const [_, itemJson] = this.convert(schema_._def.valueType, options, lazyDepth, false, false);
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.3afb521",
4
+ "version": "0.0.0-next.3b1dac3",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -24,15 +24,15 @@
24
24
  "dist"
25
25
  ],
26
26
  "peerDependencies": {
27
- "@orpc/contract": "0.0.0-next.3afb521",
28
- "@orpc/server": "0.0.0-next.3afb521"
27
+ "@orpc/contract": "0.0.0-next.3b1dac3",
28
+ "@orpc/server": "0.0.0-next.3b1dac3"
29
29
  },
30
30
  "dependencies": {
31
31
  "escape-string-regexp": "^5.0.0",
32
32
  "wildcard-match": "^5.1.3",
33
33
  "zod": "^3.24.2",
34
- "@orpc/openapi": "0.0.0-next.3afb521",
35
- "@orpc/shared": "0.0.0-next.3afb521"
34
+ "@orpc/shared": "0.0.0-next.3b1dac3",
35
+ "@orpc/openapi": "0.0.0-next.3b1dac3"
36
36
  },
37
37
  "devDependencies": {
38
38
  "zod-to-json-schema": "^3.24.3"