@composio/json-schema-to-zod 0.4.0 → 0.4.1

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.
@@ -1,6 +1,5 @@
1
1
  import { ZodTypeAny } from "zod/v3";
2
- import { RE2JS } from "re2js";
3
- //#region ../../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
2
+ import "re2js";
4
3
  // ==================================================================================================
5
4
  // JSON Schema Draft 07
6
5
  // ==================================================================================================
@@ -138,8 +137,6 @@ interface JSONSchema7 {
138
137
  writeOnly?: boolean | undefined;
139
138
  examples?: JSONSchema7Type | undefined;
140
139
  }
141
- //#endregion
142
- //#region src/context.d.ts
143
140
  type ParserOverrideOf<S> = (schema: JsonSchemaObject, refs: RefsOf<S>) => S | undefined;
144
141
  type OptionsOf<S> = {
145
142
  withoutDefaults?: boolean;
@@ -156,8 +153,6 @@ type RefsOf<S> = OptionsOf<S> & {
156
153
  /** The document that local `$ref` pointers resolve against. */
157
154
  root?: JsonSchema;
158
155
  };
159
- //#endregion
160
- //#region src/types.d.ts
161
156
  type Serializable = {
162
157
  [key: string]: Serializable;
163
158
  } | Serializable[] | string | number | boolean | null;
@@ -192,8 +187,6 @@ type ParserSelector = (schema: JsonSchemaObject, refs: Refs) => ZodTypeAny;
192
187
  type ParserOverride = ParserOverrideOf<ZodTypeAny>;
193
188
  type JsonSchemaToZodOptions = OptionsOf<ZodTypeAny>;
194
189
  type Refs = RefsOf<ZodTypeAny>;
195
- //#endregion
196
- //#region src/utils/compile-pattern.d.ts
197
190
  type InvalidPatternReason = 'syntax' | 'too-long' | 'unsupported';
198
191
  /**
199
192
  * Raised at conversion time when a schema `pattern` cannot be turned into a
@@ -210,5 +203,4 @@ declare class InvalidPatternError extends Error {
210
203
  readonly name = "InvalidPatternError";
211
204
  constructor(keyword: 'pattern' | 'patternProperties', pattern: string, path: ReadonlyArray<string | number>, reason: InvalidPatternReason, detail: string, options?: ErrorOptions);
212
205
  }
213
- //#endregion
214
206
  export { JsonSchemaToZodOptions as a, Refs as c, ParserOverrideOf as d, RefsOf as f, JsonSchemaObject as i, Serializable as l, InvalidPatternReason as n, ParserOverride as o, JsonSchema as r, ParserSelector as s, InvalidPatternError as t, OptionsOf as u };
@@ -2,7 +2,7 @@ import { dequal } from "dequal/lite";
2
2
  import { RE2JS } from "re2js";
3
3
  import { Validator, encodePointer, format, ignoredKeyword, schemaArrayKeyword, schemaMapKeyword } from "@cfworker/json-schema";
4
4
 
5
- //#region src/backend/shared.ts
5
+ // src/backend/shared.ts
6
6
  /** Spreads an optional relative issue path into an issue body. */
7
7
  const withPath = (path) => path === void 0 ? {} : { path: [...path] };
8
8
  /** Runs `guard` first and falls back to the guard already on the schema. */
@@ -30,14 +30,12 @@ const applyObjectPolicy = (base, policy) => {
30
30
  /** Attaches the rest schema to a tuple when the schema declares one. */
31
31
  const buildTuple = (tuple, rest) => rest === void 0 ? tuple : tuple.rest(rest);
32
32
 
33
- //#endregion
34
- //#region src/utils/half.ts
33
+ // src/utils/half.ts
35
34
  const half = (arr) => {
36
35
  return [arr.slice(0, arr.length / 2), arr.slice(arr.length / 2)];
37
36
  };
38
37
 
39
- //#endregion
40
- //#region src/utils/its.ts
38
+ // src/utils/its.ts
41
39
  const its = {
42
40
  an: {
43
41
  object: (x) => x.type === "object" || !x.type && (x.properties !== void 0 || x.additionalProperties !== void 0 || x.patternProperties !== void 0),
@@ -57,8 +55,7 @@ const its = {
57
55
  }
58
56
  };
59
57
 
60
- //#endregion
61
- //#region src/parsers/parse-all-of.ts
58
+ // src/parsers/parse-all-of.ts
62
59
  const originalIndex = Symbol("Original index");
63
60
  const ensureOriginalIndex = (arr) => {
64
61
  const newArr = [];
@@ -109,8 +106,7 @@ function parseAllOf(jsonSchema, ctx) {
109
106
  });
110
107
  }
111
108
 
112
- //#endregion
113
- //#region src/parsers/parse-any-of.ts
109
+ // src/parsers/parse-any-of.ts
114
110
  const parseAnyOf = (jsonSchema, ctx) => {
115
111
  return jsonSchema.anyOf.length ? jsonSchema.anyOf.length === 1 ? parseSchema(jsonSchema.anyOf[0], {
116
112
  ...ctx,
@@ -129,8 +125,7 @@ const parseAnyOf = (jsonSchema, ctx) => {
129
125
  }))) : ctx.backend.any();
130
126
  };
131
127
 
132
- //#endregion
133
- //#region src/utils/extend-schema.ts
128
+ // src/utils/extend-schema.ts
134
129
  function extendSchemaWithMessage(zodSchema, jsonSchema, key, extend) {
135
130
  const value = jsonSchema[key];
136
131
  if (value !== void 0) {
@@ -140,8 +135,7 @@ function extendSchemaWithMessage(zodSchema, jsonSchema, key, extend) {
140
135
  return zodSchema;
141
136
  }
142
137
 
143
- //#endregion
144
- //#region src/parsers/parse-array.ts
138
+ // src/parsers/parse-array.ts
145
139
  const parseArray = (jsonSchema, ctx) => {
146
140
  const { backend } = ctx;
147
141
  if (its.an.anyOf(jsonSchema)) {
@@ -212,14 +206,12 @@ const parseArray = (jsonSchema, ctx) => {
212
206
  return zodSchema;
213
207
  };
214
208
 
215
- //#endregion
216
- //#region src/parsers/parse-boolean.ts
209
+ // src/parsers/parse-boolean.ts
217
210
  const parseBoolean = (_jsonSchema, ctx) => {
218
211
  return ctx.backend.boolean();
219
212
  };
220
213
 
221
- //#endregion
222
- //#region src/parsers/parse-literal-values.ts
214
+ // src/parsers/parse-literal-values.ts
223
215
  const parseLiteralValues = (values, backend) => {
224
216
  if (values.length === 0) return backend.never();
225
217
  if (values.every((value) => value === null || typeof value !== "object")) {
@@ -231,8 +223,7 @@ const parseLiteralValues = (values, backend) => {
231
223
  return backend.predicate((value) => values.some((candidate) => dequal(value, candidate)));
232
224
  };
233
225
 
234
- //#endregion
235
- //#region src/parsers/parse-const.ts
226
+ // src/parsers/parse-const.ts
236
227
  const parseConst = (jsonSchema, ctx) => {
237
228
  const { const: value, ...baseSchema } = jsonSchema;
238
229
  return ctx.backend.intersection(parseSchema(baseSchema, {
@@ -241,14 +232,12 @@ const parseConst = (jsonSchema, ctx) => {
241
232
  }, true), parseLiteralValues([value], ctx.backend));
242
233
  };
243
234
 
244
- //#endregion
245
- //#region src/parsers/parse-default.ts
235
+ // src/parsers/parse-default.ts
246
236
  const parseDefault = (_jsonSchema, ctx) => {
247
237
  return ctx.backend.any();
248
238
  };
249
239
 
250
- //#endregion
251
- //#region src/parsers/parse-enum.ts
240
+ // src/parsers/parse-enum.ts
252
241
  const parseEnum = (jsonSchema, ctx) => {
253
242
  const { enum: values, ...baseSchema } = jsonSchema;
254
243
  return ctx.backend.intersection(parseSchema(baseSchema, {
@@ -257,8 +246,7 @@ const parseEnum = (jsonSchema, ctx) => {
257
246
  }, true), parseLiteralValues(values, ctx.backend));
258
247
  };
259
248
 
260
- //#endregion
261
- //#region src/parsers/parse-if-then-else.ts
249
+ // src/parsers/parse-if-then-else.ts
262
250
  const parseIfThenElse = (jsonSchema, ctx) => {
263
251
  const { backend } = ctx;
264
252
  const $if = parseSchema(jsonSchema.if, {
@@ -279,8 +267,7 @@ const parseIfThenElse = (jsonSchema, ctx) => {
279
267
  });
280
268
  };
281
269
 
282
- //#endregion
283
- //#region src/parsers/parse-multiple-type.ts
270
+ // src/parsers/parse-multiple-type.ts
284
271
  const parseMultipleType = (jsonSchema, ctx) => {
285
272
  return ctx.backend.union(jsonSchema.type.map((type) => parseSchema({
286
273
  ...jsonSchema,
@@ -288,8 +275,7 @@ const parseMultipleType = (jsonSchema, ctx) => {
288
275
  }, ctx)));
289
276
  };
290
277
 
291
- //#endregion
292
- //#region src/parsers/parse-not.ts
278
+ // src/parsers/parse-not.ts
293
279
  const parseNot = (jsonSchema, ctx) => {
294
280
  const { backend } = ctx;
295
281
  return backend.refine(backend.any(), (value) => !backend.run(parseSchema(jsonSchema.not, {
@@ -298,21 +284,18 @@ const parseNot = (jsonSchema, ctx) => {
298
284
  }), value).success, "Invalid input: Should NOT be valid against schema");
299
285
  };
300
286
 
301
- //#endregion
302
- //#region src/parsers/parse-null.ts
287
+ // src/parsers/parse-null.ts
303
288
  const parseNull = (_jsonSchema, ctx) => {
304
289
  return ctx.backend.null();
305
290
  };
306
291
 
307
- //#endregion
308
- //#region src/utils/omit.ts
292
+ // src/utils/omit.ts
309
293
  const omit = (obj, ...keys) => Object.keys(obj).reduce((acc, key) => {
310
294
  if (!keys.includes(key)) acc[key] = obj[key];
311
295
  return acc;
312
296
  }, {});
313
297
 
314
- //#endregion
315
- //#region src/parsers/parse-nullable.ts
298
+ // src/parsers/parse-nullable.ts
316
299
  /**
317
300
  * For compatibility with open api 3.0 nullable
318
301
  */
@@ -323,8 +306,7 @@ const parseNullable = (jsonSchema, ctx) => {
323
306
  return hasNullDefault ? ctx.backend.withDefault(zodSchema, null) : zodSchema;
324
307
  };
325
308
 
326
- //#endregion
327
- //#region src/parsers/parse-number.ts
309
+ // src/parsers/parse-number.ts
328
310
  const toDecimalInteger = (value) => {
329
311
  if (!Number.isFinite(value)) return void 0;
330
312
  const negative = value < 0;
@@ -385,8 +367,7 @@ const parseNumber = (jsonSchema, backend) => {
385
367
  return zodSchema;
386
368
  };
387
369
 
388
- //#endregion
389
- //#region src/parsers/parse-one-of.ts
370
+ // src/parsers/parse-one-of.ts
390
371
  const parseOneOf = (jsonSchema, ctx) => {
391
372
  const { backend } = ctx;
392
373
  if (!jsonSchema.oneOf.length) return backend.any();
@@ -415,8 +396,7 @@ const parseOneOf = (jsonSchema, ctx) => {
415
396
  });
416
397
  };
417
398
 
418
- //#endregion
419
- //#region src/parsers/property-presence.ts
399
+ // src/parsers/property-presence.ts
420
400
  const admitsNull = (branches) => Array.isArray(branches) && branches.some((schema) => typeof schema === "object" && schema !== null && schema.type === "null");
421
401
  /**
422
402
  * Wraps a parsed property for its place in an object: required properties
@@ -437,8 +417,7 @@ const applyPropertyPresence = (backend, propJsonSchema, parsed, required) => {
437
417
  return required ? parsed : backend.optional(parsed);
438
418
  };
439
419
 
440
- //#endregion
441
- //#region src/utils/unicode-pattern.ts
420
+ // src/utils/unicode-pattern.ts
442
421
  const compilesAsUnicode = (pattern) => {
443
422
  try {
444
423
  new RegExp(pattern, "u");
@@ -588,8 +567,7 @@ const toUnicodePattern = (pattern) => {
588
567
  return compilesAsUnicode(rewritten) ? rewritten : void 0;
589
568
  };
590
569
 
591
- //#endregion
592
- //#region src/utils/linear-pattern.ts
570
+ // src/utils/linear-pattern.ts
593
571
  /**
594
572
  * ECMAScript `\s`: the characters it matches, spelled for an RE2 class body.
595
573
  * RE2's own `\s` is ASCII-only, so both `\s` and `\S` are spelled out.
@@ -867,8 +845,7 @@ const patternMatches = (matcher, input) => {
867
845
  }
868
846
  };
869
847
 
870
- //#endregion
871
- //#region src/utils/compile-pattern.ts
848
+ // src/utils/compile-pattern.ts
872
849
  /**
873
850
  * Longest `pattern` / `patternProperties` key this package compiles. Tool
874
851
  * schemas come from third-party toolkit definitions; anything past this is
@@ -963,8 +940,7 @@ const compilePattern = (keyword, pattern, refs) => {
963
940
  return new SchemaPatternRegExp(pattern, matcher);
964
941
  };
965
942
 
966
- //#endregion
967
- //#region src/parsers/parse-object.ts
943
+ // src/parsers/parse-object.ts
968
944
  /**
969
945
  * Build the static part of an object parser, or `undefined` when the schema
970
946
  * declares no named properties.
@@ -1103,8 +1079,7 @@ function parseObject(objectSchema, ctx) {
1103
1079
  return output;
1104
1080
  }
1105
1081
 
1106
- //#endregion
1107
- //#region src/backend/types.ts
1082
+ // src/backend/types.ts
1108
1083
  /** String formats the string parser asserts; every other `format` is an annotation. */
1109
1084
  const ASSERTED_STRING_FORMATS = [
1110
1085
  "email",
@@ -1119,8 +1094,7 @@ const ASSERTED_STRING_FORMATS = [
1119
1094
  "duration"
1120
1095
  ];
1121
1096
 
1122
- //#endregion
1123
- //#region src/annotations.ts
1097
+ // src/annotations.ts
1124
1098
  const ASSERTED_FORMAT_SET = new Set(ASSERTED_STRING_FORMATS);
1125
1099
  const isAssertedStringFormat = (format) => typeof format === "string" && ASSERTED_FORMAT_SET.has(format);
1126
1100
  /**
@@ -1163,8 +1137,7 @@ const collectAnnotations = (jsonSchema) => {
1163
1137
  return Object.keys(annotations).length > 0 ? annotations : void 0;
1164
1138
  };
1165
1139
 
1166
- //#endregion
1167
- //#region src/parsers/parse-string.ts
1140
+ // src/parsers/parse-string.ts
1168
1141
  const parseString = (jsonSchema, ctx) => {
1169
1142
  const { backend } = ctx;
1170
1143
  let zodSchema = backend.string();
@@ -1182,8 +1155,7 @@ const parseString = (jsonSchema, ctx) => {
1182
1155
  const codePointLength = (value) => [...value].length;
1183
1156
  const isBase64Encoding = (encoding) => typeof encoding === "string" && encoding.toLowerCase() === "base64";
1184
1157
 
1185
- //#endregion
1186
- //#region src/parsers/parse-typeless-constraints.ts
1158
+ // src/parsers/parse-typeless-constraints.ts
1187
1159
  const SCALAR_CONSTRAINT_KEYS = [
1188
1160
  "minLength",
1189
1161
  "maxLength",
@@ -1218,8 +1190,7 @@ const parseTypelessConstraints = (schema, ctx) => {
1218
1190
  });
1219
1191
  };
1220
1192
 
1221
- //#endregion
1222
- //#region src/whole-schema-validation.ts
1193
+ // src/whole-schema-validation.ts
1223
1194
  const REQUIRES_WHOLE_SCHEMA_VALIDATION = /* @__PURE__ */ new Set([
1224
1195
  "$ref",
1225
1196
  "additionalItems",
@@ -1662,8 +1633,7 @@ const createWholeSchemaGuard = (jsonSchema) => {
1662
1633
  };
1663
1634
  };
1664
1635
 
1665
- //#endregion
1666
- //#region src/parsers/parse-schema.ts
1636
+ // src/parsers/parse-schema.ts
1667
1637
  const addDecorations = (jsonSchema, zodSchema, ctx) => {
1668
1638
  const description = ctx.withoutDescribes ? void 0 : describeText(jsonSchema);
1669
1639
  const annotations = ctx.withoutAnnotations ? void 0 : collectAnnotations(jsonSchema);
@@ -1735,8 +1705,7 @@ const parseSchema = (jsonSchema, ctx, blockMeta) => {
1735
1705
  return parsedZodSchema;
1736
1706
  };
1737
1707
 
1738
- //#endregion
1739
- //#region src/parsers/parse-object-shape.ts
1708
+ // src/parsers/parse-object-shape.ts
1740
1709
  /**
1741
1710
  * Parses a JSON Schema object and returns the raw shape (property keys mapped to Zod types).
1742
1711
  * This is useful when you need ZodRawShape instead of a complete ZodObject.
@@ -1771,8 +1740,7 @@ function parseObjectShape(objectSchema, ctx) {
1771
1740
  return properties;
1772
1741
  }
1773
1742
 
1774
- //#endregion
1775
- //#region src/convert.ts
1743
+ // src/convert.ts
1776
1744
  /** The two conversion entry points, bound to one backend. */
1777
1745
  const createConverter = (backend) => {
1778
1746
  const contextFor = (root, options) => ({
@@ -1797,5 +1765,4 @@ const createConverter = (backend) => {
1797
1765
  };
1798
1766
  };
1799
1767
 
1800
- //#endregion
1801
1768
  export { composeGuards as a, buildTuple as i, InvalidPatternError as n, run as o, applyObjectPolicy as r, withPath as s, createConverter as t };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { a as JsonSchemaToZodOptions, c as Refs, i as JsonSchemaObject, l as Serializable, n as InvalidPatternReason, o as ParserOverride, r as JsonSchema, s as ParserSelector, t as InvalidPatternError } from "./compile-pattern-blQMRxo5.mjs";
1
+ import { a as JsonSchemaToZodOptions, c as Refs, i as JsonSchemaObject, l as Serializable, n as InvalidPatternReason, o as ParserOverride, r as JsonSchema, s as ParserSelector, t as InvalidPatternError } from "./compile-pattern-D-zr7Yui.mjs";
2
2
  import { ZodType, ZodTypeAny } from "zod/v3";
3
- //#region src/json-schema-to-zod.d.ts
4
3
  export declare const jsonSchemaToZod: (schema: JsonSchema, options?: JsonSchemaToZodOptions) => ZodType;
5
4
  /**
6
5
  * A simplified type for Zod raw shapes that avoids deep type instantiation issues.
@@ -20,5 +19,4 @@ type SimpleZodRawShape = Record<string, ZodTypeAny>;
20
19
  * @returns A Zod raw shape object with property keys mapped to Zod types
21
20
  */
22
21
  export declare const jsonSchemaToZodShape: (schema: JsonSchema, options?: JsonSchemaToZodOptions) => SimpleZodRawShape;
23
- //#endregion
24
22
  export { InvalidPatternError, type InvalidPatternReason, type JsonSchema, type JsonSchemaObject, type JsonSchemaToZodOptions, type ParserOverride, type ParserSelector, type Refs, type Serializable };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { a as composeGuards, i as buildTuple, n as InvalidPatternError, o as run, r as applyObjectPolicy, s as withPath, t as createConverter } from "./convert-CqEY5vMX.mjs";
1
+ import { a as composeGuards, i as buildTuple, n as InvalidPatternError, o as run, r as applyObjectPolicy, s as withPath, t as createConverter } from "./convert-Cte4lEaK.mjs";
2
2
  import * as z from "zod/v3";
3
3
 
4
- //#region src/backend/zod-v3.ts
4
+ // src/backend/zod-v3.ts
5
5
  const guardedSchemaClasses = /* @__PURE__ */ new WeakMap();
6
6
  /**
7
7
  * A subclass of the parsed schema's own class that checks the source value
@@ -129,8 +129,7 @@ const zodV3Backend = {
129
129
  attachGuard
130
130
  };
131
131
 
132
- //#endregion
133
- //#region src/json-schema-to-zod.ts
132
+ // src/json-schema-to-zod.ts
134
133
  const converter = createConverter(zodV3Backend);
135
134
  const jsonSchemaToZod = (schema, options = {}) => converter.jsonSchemaToZod(schema, options);
136
135
  /**
@@ -147,5 +146,4 @@ const jsonSchemaToZod = (schema, options = {}) => converter.jsonSchemaToZod(sche
147
146
  */
148
147
  const jsonSchemaToZodShape = (schema, options = {}) => converter.jsonSchemaToZodShape(schema, options);
149
148
 
150
- //#endregion
151
149
  export { InvalidPatternError, jsonSchemaToZod, jsonSchemaToZodShape };
package/dist/v4.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { d as ParserOverrideOf, f as RefsOf, i as JsonSchemaObject, l as Serializable, n as InvalidPatternReason, r as JsonSchema, t as InvalidPatternError, u as OptionsOf } from "./compile-pattern-blQMRxo5.mjs";
1
+ import { d as ParserOverrideOf, f as RefsOf, i as JsonSchemaObject, l as Serializable, n as InvalidPatternReason, r as JsonSchema, t as InvalidPatternError, u as OptionsOf } from "./compile-pattern-D-zr7Yui.mjs";
2
2
  import { ZodType } from "zod/v4";
3
- //#region src/v4.d.ts
4
3
  export type ParserSelector = (schema: JsonSchemaObject, refs: Refs) => ZodType;
5
4
  export type ParserOverride = ParserOverrideOf<ZodType>;
6
5
  export type JsonSchemaToZodOptions = OptionsOf<ZodType> & {
@@ -12,5 +11,4 @@ export type Refs = RefsOf<ZodType>;
12
11
  export type SimpleZodRawShape = Record<string, ZodType>;
13
12
  export declare const jsonSchemaToZod: (schema: JsonSchema, options?: JsonSchemaToZodOptions) => ZodType;
14
13
  export declare const jsonSchemaToZodShape: (schema: JsonSchema, options?: JsonSchemaToZodOptions) => SimpleZodRawShape;
15
- //#endregion
16
14
  export { InvalidPatternError, type InvalidPatternReason, type JsonSchema, type JsonSchemaObject, type Serializable };
package/dist/v4.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { a as composeGuards, i as buildTuple, n as InvalidPatternError, o as run, r as applyObjectPolicy, s as withPath, t as createConverter } from "./convert-CqEY5vMX.mjs";
1
+ import { a as composeGuards, i as buildTuple, n as InvalidPatternError, o as run, r as applyObjectPolicy, s as withPath, t as createConverter } from "./convert-Cte4lEaK.mjs";
2
2
  import { version } from "zod/v4/core";
3
3
  import * as z from "zod/v4";
4
4
 
5
- //#region src/backend/zod-v4.ts
5
+ // src/backend/zod-v4.ts
6
6
  const internals = (schema) => schema._zod;
7
7
  const isUnmergeable = (error) => error instanceof Error && error.message.startsWith("Unmergable intersection");
8
8
  const instrumentedClasses = /* @__PURE__ */ new WeakMap();
@@ -222,8 +222,7 @@ const zodV4Backend = {
222
222
  attachGuard
223
223
  };
224
224
 
225
- //#endregion
226
- //#region src/backend/zod-v4-floor.ts
225
+ // src/backend/zod-v4-floor.ts
227
226
  /**
228
227
  * The first zod release whose `zod/v4` shares its metadata registry through
229
228
  * `globalThis.__zod_globalRegistry`. Below it, two copies of zod in one
@@ -238,12 +237,10 @@ const ZOD_V4_FLOOR = {
238
237
  const formatZodVersion = (version) => `${version.major}.${version.minor}.${version.patch}`;
239
238
  const meetsZodV4Floor = (version) => version.major !== ZOD_V4_FLOOR.major ? version.major > ZOD_V4_FLOOR.major : version.minor !== ZOD_V4_FLOOR.minor ? version.minor > ZOD_V4_FLOOR.minor : version.patch >= ZOD_V4_FLOOR.patch;
240
239
 
241
- //#endregion
242
- //#region src/v4.ts
240
+ // src/v4.ts
243
241
  if (!meetsZodV4Floor(version)) throw new Error(`@composio/json-schema-to-zod/v4 requires zod >= ${formatZodVersion(ZOD_V4_FLOOR)}; found ${formatZodVersion(version)}`);
244
242
  const converter = createConverter(zodV4Backend);
245
243
  const jsonSchemaToZod = (schema, options = {}) => converter.jsonSchemaToZod(schema, options);
246
244
  const jsonSchemaToZodShape = (schema, options = {}) => converter.jsonSchemaToZodShape(schema, options);
247
245
 
248
- //#endregion
249
246
  export { InvalidPatternError, jsonSchemaToZod, jsonSchemaToZodShape };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@composio/json-schema-to-zod",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",
@@ -40,16 +40,16 @@
40
40
  ],
41
41
  "license": "ISC",
42
42
  "devDependencies": {
43
- "@ai-sdk/provider-utils": "^5.0.58",
44
- "@langchain/core": "^1.2.17",
43
+ "@ai-sdk/provider-utils": "^5.0.76",
44
+ "@langchain/core": "^1.3.6",
45
45
  "@types/json-schema": "^7.0.15",
46
- "@types/node": "^26.6.4",
46
+ "@types/node": "^26.6.6",
47
47
  "ajv": "^8.20.0",
48
48
  "fast-check": "^4.10.2",
49
- "tsdown": "^0.23.1",
49
+ "tsdown": "^0.23.7",
50
50
  "typescript": "^7.0.2",
51
- "vitest": "^5.0.3",
52
- "zod": "^4.5.4",
51
+ "vitest": "^5.1.0",
52
+ "zod": "^4.6.7",
53
53
  "zod-3-25": "npm:zod@3.25.76",
54
54
  "zod-floor": "npm:zod@4.1.13",
55
55
  "zod-to-json-schema": "^3.25.2"
@@ -58,9 +58,9 @@
58
58
  "zod": ">=3.25.76 <5"
59
59
  },
60
60
  "dependencies": {
61
- "@cfworker/json-schema": "^4.1.1",
61
+ "@cfworker/json-schema": "^4.1.6",
62
62
  "dequal": "^2.0.3",
63
- "re2js": "^2.8.6"
63
+ "re2js": "^2.9.1"
64
64
  },
65
65
  "scripts": {
66
66
  "clean": "git clean -xdf node_modules",