@zenstackhq/zod 3.4.0-beta.4 → 3.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.
package/dist/index.js CHANGED
@@ -1,31 +1,650 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: true });
6
+ };
7
+
8
+ // src/factory.ts
9
+ import { ExpressionUtils as ExpressionUtils2, SchemaAccessor } from "@zenstackhq/schema";
10
+ import Decimal2 from "decimal.js";
11
+ import z2 from "zod";
12
+
13
+ // src/error.ts
14
+ var SchemaFactoryError = class extends Error {
15
+ static {
16
+ __name(this, "SchemaFactoryError");
17
+ }
18
+ constructor(message) {
19
+ super(message);
20
+ }
21
+ };
3
22
 
4
- // src/index.ts
5
- import { match, P } from "ts-pattern";
23
+ // src/utils.ts
24
+ var utils_exports = {};
25
+ __export(utils_exports, {
26
+ addBigIntValidation: () => addBigIntValidation,
27
+ addCustomValidation: () => addCustomValidation,
28
+ addDecimalValidation: () => addDecimalValidation,
29
+ addListValidation: () => addListValidation,
30
+ addNumberValidation: () => addNumberValidation,
31
+ addStringValidation: () => addStringValidation
32
+ });
33
+ import { ExpressionUtils } from "@zenstackhq/schema";
34
+ import Decimal from "decimal.js";
6
35
  import { z } from "zod";
7
- function makeSelectSchema(schema, model) {
8
- return z.strictObject(mapFields(schema, model));
36
+ function getArgValue(expr) {
37
+ if (!expr || !ExpressionUtils.isLiteral(expr)) {
38
+ return void 0;
39
+ }
40
+ return expr.value;
41
+ }
42
+ __name(getArgValue, "getArgValue");
43
+ function addStringValidation(schema, attributes) {
44
+ if (!attributes || attributes.length === 0) {
45
+ return schema;
46
+ }
47
+ let result = schema;
48
+ for (const attr of attributes) {
49
+ switch (attr.name) {
50
+ case "@length": {
51
+ const min = getArgValue(attr.args?.[0]?.value);
52
+ if (min !== void 0) {
53
+ result = result.min(min);
54
+ }
55
+ const max = getArgValue(attr.args?.[1]?.value);
56
+ if (max !== void 0) {
57
+ result = result.max(max);
58
+ }
59
+ break;
60
+ }
61
+ case "@startsWith": {
62
+ const value = getArgValue(attr.args?.[0]?.value);
63
+ if (value !== void 0) {
64
+ result = result.startsWith(value);
65
+ }
66
+ break;
67
+ }
68
+ case "@endsWith": {
69
+ const value = getArgValue(attr.args?.[0]?.value);
70
+ if (value !== void 0) {
71
+ result = result.endsWith(value);
72
+ }
73
+ break;
74
+ }
75
+ case "@contains": {
76
+ const value = getArgValue(attr.args?.[0]?.value);
77
+ if (value !== void 0) {
78
+ result = result.includes(value);
79
+ }
80
+ break;
81
+ }
82
+ case "@regex": {
83
+ const pattern = getArgValue(attr.args?.[0]?.value);
84
+ if (pattern !== void 0) {
85
+ result = result.regex(new RegExp(pattern));
86
+ }
87
+ break;
88
+ }
89
+ case "@email":
90
+ result = result.email();
91
+ break;
92
+ case "@datetime":
93
+ result = result.datetime();
94
+ break;
95
+ case "@url":
96
+ result = result.url();
97
+ break;
98
+ case "@trim":
99
+ result = result.trim();
100
+ break;
101
+ case "@lower":
102
+ result = result.toLowerCase();
103
+ break;
104
+ case "@upper":
105
+ result = result.toUpperCase();
106
+ break;
107
+ }
108
+ }
109
+ return result;
110
+ }
111
+ __name(addStringValidation, "addStringValidation");
112
+ function addNumberValidation(schema, attributes) {
113
+ if (!attributes || attributes.length === 0) {
114
+ return schema;
115
+ }
116
+ let result = schema;
117
+ for (const attr of attributes) {
118
+ const val = getArgValue(attr.args?.[0]?.value);
119
+ if (val === void 0) {
120
+ continue;
121
+ }
122
+ switch (attr.name) {
123
+ case "@gt":
124
+ result = result.gt(val);
125
+ break;
126
+ case "@gte":
127
+ result = result.gte(val);
128
+ break;
129
+ case "@lt":
130
+ result = result.lt(val);
131
+ break;
132
+ case "@lte":
133
+ result = result.lte(val);
134
+ break;
135
+ }
136
+ }
137
+ return result;
9
138
  }
10
- __name(makeSelectSchema, "makeSelectSchema");
11
- function mapFields(schema, model) {
12
- const modelDef = schema.models[model];
13
- if (!modelDef) {
14
- throw new Error(`Model ${model} not found in schema`);
139
+ __name(addNumberValidation, "addNumberValidation");
140
+ function addBigIntValidation(schema, attributes) {
141
+ if (!attributes || attributes.length === 0) {
142
+ return schema;
15
143
  }
16
- const scalarFields = Object.entries(modelDef.fields).filter(([_, fieldDef]) => !fieldDef.relation);
17
- const result = {};
18
- for (const [field, fieldDef] of scalarFields) {
19
- result[field] = makeScalarSchema(fieldDef);
144
+ let result = schema;
145
+ for (const attr of attributes) {
146
+ const val = getArgValue(attr.args?.[0]?.value);
147
+ if (val === void 0) {
148
+ continue;
149
+ }
150
+ switch (attr.name) {
151
+ case "@gt":
152
+ result = result.gt(BigInt(val));
153
+ break;
154
+ case "@gte":
155
+ result = result.gte(BigInt(val));
156
+ break;
157
+ case "@lt":
158
+ result = result.lt(BigInt(val));
159
+ break;
160
+ case "@lte":
161
+ result = result.lte(BigInt(val));
162
+ break;
163
+ }
20
164
  }
21
165
  return result;
22
166
  }
23
- __name(mapFields, "mapFields");
24
- function makeScalarSchema(fieldDef) {
25
- return match(fieldDef.type).with("String", () => z.string()).with(P.union("Int", "BigInt", "Float", "Decimal"), () => z.number()).with("Boolean", () => z.boolean()).with("DateTime", () => z.string().datetime()).otherwise(() => z.unknown());
167
+ __name(addBigIntValidation, "addBigIntValidation");
168
+ function addDecimalValidation(schema, attributes, addExtraValidation) {
169
+ let result = schema;
170
+ if (schema instanceof z.ZodString) {
171
+ result = schema.superRefine((v, ctx) => {
172
+ try {
173
+ new Decimal(v);
174
+ } catch (err) {
175
+ ctx.addIssue({
176
+ code: "custom",
177
+ message: `Invalid decimal: ${err}`
178
+ });
179
+ }
180
+ }).transform((val) => new Decimal(val));
181
+ }
182
+ function refine(schema2, op, value) {
183
+ return schema2.superRefine((v, ctx) => {
184
+ const base = z.number();
185
+ const { error } = base[op](value).safeParse(v.toNumber());
186
+ error?.issues.forEach((issue) => {
187
+ if (op === "gt" || op === "gte") {
188
+ ctx.addIssue({
189
+ code: "too_small",
190
+ origin: "number",
191
+ minimum: value,
192
+ type: "decimal",
193
+ inclusive: op === "gte",
194
+ message: issue.message
195
+ });
196
+ } else {
197
+ ctx.addIssue({
198
+ code: "too_big",
199
+ origin: "number",
200
+ maximum: value,
201
+ type: "decimal",
202
+ inclusive: op === "lte",
203
+ message: issue.message
204
+ });
205
+ }
206
+ });
207
+ });
208
+ }
209
+ __name(refine, "refine");
210
+ if (attributes && addExtraValidation) {
211
+ for (const attr of attributes) {
212
+ const val = getArgValue(attr.args?.[0]?.value);
213
+ if (val === void 0) {
214
+ continue;
215
+ }
216
+ switch (attr.name) {
217
+ case "@gt":
218
+ result = refine(result, "gt", val);
219
+ break;
220
+ case "@gte":
221
+ result = refine(result, "gte", val);
222
+ break;
223
+ case "@lt":
224
+ result = refine(result, "lt", val);
225
+ break;
226
+ case "@lte":
227
+ result = refine(result, "lte", val);
228
+ break;
229
+ }
230
+ }
231
+ }
232
+ return result;
233
+ }
234
+ __name(addDecimalValidation, "addDecimalValidation");
235
+ function addListValidation(schema, attributes) {
236
+ if (!attributes || attributes.length === 0) {
237
+ return schema;
238
+ }
239
+ let result = schema;
240
+ for (const attr of attributes) {
241
+ if (attr.name === "@length") {
242
+ const min = getArgValue(attr.args?.[0]?.value);
243
+ if (min !== void 0) {
244
+ result = result.min(min);
245
+ }
246
+ const max = getArgValue(attr.args?.[1]?.value);
247
+ if (max !== void 0) {
248
+ result = result.max(max);
249
+ }
250
+ }
251
+ }
252
+ return result;
253
+ }
254
+ __name(addListValidation, "addListValidation");
255
+ function addCustomValidation(schema, attributes) {
256
+ const attrs = attributes?.filter((a) => a.name === "@@validate");
257
+ if (!attrs || attrs.length === 0) {
258
+ return schema;
259
+ }
260
+ let result = schema;
261
+ for (const attr of attrs) {
262
+ const expr = attr.args?.[0]?.value;
263
+ if (!expr) {
264
+ continue;
265
+ }
266
+ const message = getArgValue(attr.args?.[1]?.value);
267
+ const pathExpr = attr.args?.[2]?.value;
268
+ let path = void 0;
269
+ if (pathExpr && ExpressionUtils.isArray(pathExpr)) {
270
+ path = pathExpr.items.map((e) => ExpressionUtils.getLiteralValue(e));
271
+ }
272
+ result = applyValidation(result, expr, message, path);
273
+ }
274
+ return result;
275
+ }
276
+ __name(addCustomValidation, "addCustomValidation");
277
+ function applyValidation(schema, expr, message, path) {
278
+ const options = {};
279
+ if (message) {
280
+ options.error = message;
281
+ }
282
+ if (path) {
283
+ options.path = path;
284
+ }
285
+ return schema.refine((data) => Boolean(evalExpression(data, expr)), options);
286
+ }
287
+ __name(applyValidation, "applyValidation");
288
+ function evalExpression(data, expr) {
289
+ switch (expr.kind) {
290
+ case "literal":
291
+ return expr.value;
292
+ case "array":
293
+ return expr.items.map((item) => evalExpression(data, item));
294
+ case "field":
295
+ return evalField(data, expr);
296
+ case "member":
297
+ return evalMember(data, expr);
298
+ case "unary":
299
+ return evalUnary(data, expr);
300
+ case "binary":
301
+ return evalBinary(data, expr);
302
+ case "call":
303
+ return evalCall(data, expr);
304
+ case "this":
305
+ return data ?? null;
306
+ case "null":
307
+ return null;
308
+ case "binding":
309
+ throw new SchemaFactoryError("Binding expression is not supported in validation expressions");
310
+ }
311
+ }
312
+ __name(evalExpression, "evalExpression");
313
+ function evalField(data, e) {
314
+ return data?.[e.field] ?? null;
315
+ }
316
+ __name(evalField, "evalField");
317
+ function evalUnary(data, expr) {
318
+ const operand = evalExpression(data, expr.operand);
319
+ switch (expr.op) {
320
+ case "!":
321
+ return !operand;
322
+ default:
323
+ throw new SchemaFactoryError(`Unsupported unary operator: ${expr.op}`);
324
+ }
325
+ }
326
+ __name(evalUnary, "evalUnary");
327
+ function evalBinary(data, expr) {
328
+ const left = evalExpression(data, expr.left);
329
+ const right = evalExpression(data, expr.right);
330
+ switch (expr.op) {
331
+ case "&&":
332
+ return Boolean(left) && Boolean(right);
333
+ case "||":
334
+ return Boolean(left) || Boolean(right);
335
+ case "==":
336
+ return left == right;
337
+ case "!=":
338
+ return left != right;
339
+ case "<":
340
+ return left < right;
341
+ case "<=":
342
+ return left <= right;
343
+ case ">":
344
+ return left > right;
345
+ case ">=":
346
+ return left >= right;
347
+ case "?":
348
+ if (!Array.isArray(left)) {
349
+ return false;
350
+ }
351
+ return left.some((item) => item === right);
352
+ case "!":
353
+ if (!Array.isArray(left)) {
354
+ return false;
355
+ }
356
+ return left.every((item) => item === right);
357
+ case "^":
358
+ if (!Array.isArray(left)) {
359
+ return false;
360
+ }
361
+ return !left.some((item) => item === right);
362
+ case "in":
363
+ if (!Array.isArray(right)) {
364
+ return false;
365
+ }
366
+ return right.includes(left);
367
+ default:
368
+ throw new SchemaFactoryError(`Unsupported binary operator: ${expr.op}`);
369
+ }
26
370
  }
27
- __name(makeScalarSchema, "makeScalarSchema");
371
+ __name(evalBinary, "evalBinary");
372
+ function evalMember(data, expr) {
373
+ let result = evalExpression(data, expr.receiver);
374
+ for (const member of expr.members) {
375
+ if (!result || typeof result !== "object") {
376
+ return void 0;
377
+ }
378
+ result = result[member];
379
+ }
380
+ return result ?? null;
381
+ }
382
+ __name(evalMember, "evalMember");
383
+ function evalCall(data, expr) {
384
+ const f = expr.function;
385
+ const fieldArg = expr.args?.[0] ? evalExpression(data, expr.args[0]) : void 0;
386
+ switch (f) {
387
+ // string functions
388
+ case "length": {
389
+ if (fieldArg === void 0 || fieldArg === null) {
390
+ return false;
391
+ }
392
+ invariant(typeof fieldArg === "string" || Array.isArray(fieldArg), `"${f}" first argument must be a string or a list`);
393
+ return fieldArg.length;
394
+ }
395
+ case "startsWith":
396
+ case "endsWith":
397
+ case "contains": {
398
+ if (fieldArg === void 0 || fieldArg === null) {
399
+ return false;
400
+ }
401
+ invariant(typeof fieldArg === "string", `"${f}" first argument must be a string`);
402
+ invariant(expr.args?.[1], `"${f}" requires a search argument`);
403
+ const search = getArgValue(expr.args?.[1]);
404
+ const caseInsensitive = getArgValue(expr.args?.[2]) ?? false;
405
+ const applyStringOp = /* @__PURE__ */ __name((x, y) => {
406
+ switch (f) {
407
+ case "startsWith":
408
+ return x.startsWith(y);
409
+ case "endsWith":
410
+ return x.endsWith(y);
411
+ case "contains":
412
+ return x.includes(y);
413
+ }
414
+ }, "applyStringOp");
415
+ return caseInsensitive ? applyStringOp(fieldArg.toLowerCase(), search.toLowerCase()) : applyStringOp(fieldArg, search);
416
+ }
417
+ case "regex": {
418
+ if (fieldArg === void 0 || fieldArg === null) {
419
+ return false;
420
+ }
421
+ invariant(typeof fieldArg === "string", `"${f}" first argument must be a string`);
422
+ const pattern = getArgValue(expr.args?.[1]);
423
+ invariant(pattern !== void 0, `"${f}" requires a pattern argument`);
424
+ return new RegExp(pattern).test(fieldArg);
425
+ }
426
+ case "isEmail":
427
+ case "isUrl":
428
+ case "isDateTime": {
429
+ if (fieldArg === void 0 || fieldArg === null) {
430
+ return false;
431
+ }
432
+ invariant(typeof fieldArg === "string", `"${f}" first argument must be a string`);
433
+ const fn = f === "isEmail" ? "email" : f === "isUrl" ? "url" : "datetime";
434
+ return z.string()[fn]().safeParse(fieldArg).success;
435
+ }
436
+ // list functions
437
+ case "has":
438
+ case "hasEvery":
439
+ case "hasSome": {
440
+ invariant(expr.args?.[1], `${f} requires a search argument`);
441
+ if (fieldArg === void 0 || fieldArg === null) {
442
+ return false;
443
+ }
444
+ invariant(Array.isArray(fieldArg), `"${f}" first argument must be an array field`);
445
+ const search = evalExpression(data, expr.args?.[1]);
446
+ if (f === "has") {
447
+ return fieldArg.some((item) => item === search);
448
+ } else if (f === "hasEvery") {
449
+ invariant(Array.isArray(search), "hasEvery second argument must be an array");
450
+ return search.every((v) => fieldArg.some((item) => item === v));
451
+ } else {
452
+ invariant(Array.isArray(search), "hasSome second argument must be an array");
453
+ return search.some((v) => fieldArg.some((item) => item === v));
454
+ }
455
+ }
456
+ case "isEmpty": {
457
+ if (fieldArg === void 0 || fieldArg === null) {
458
+ return false;
459
+ }
460
+ invariant(Array.isArray(fieldArg), `"${f}" first argument must be an array field`);
461
+ return fieldArg.length === 0;
462
+ }
463
+ default:
464
+ throw new SchemaFactoryError(`Unsupported function "${f}"`);
465
+ }
466
+ }
467
+ __name(evalCall, "evalCall");
468
+ function invariant(condition, message) {
469
+ if (!condition) {
470
+ throw new SchemaFactoryError(message ?? "Invariant failed");
471
+ }
472
+ }
473
+ __name(invariant, "invariant");
474
+
475
+ // src/factory.ts
476
+ function createSchemaFactory(schema) {
477
+ return new SchemaFactory(schema);
478
+ }
479
+ __name(createSchemaFactory, "createSchemaFactory");
480
+ var SchemaFactory = class SchemaFactory2 {
481
+ static {
482
+ __name(this, "SchemaFactory");
483
+ }
484
+ schema;
485
+ constructor(_schema) {
486
+ this.schema = new SchemaAccessor(_schema);
487
+ }
488
+ makeModelSchema(model) {
489
+ const modelDef = this.schema.requireModel(model);
490
+ const fields = {};
491
+ for (const [fieldName, fieldDef] of Object.entries(modelDef.fields)) {
492
+ if (fieldDef.relation) {
493
+ const relatedModelName = fieldDef.type;
494
+ const lazySchema = z2.lazy(() => this.makeModelSchema(relatedModelName));
495
+ fields[fieldName] = this.applyDescription(this.applyCardinality(lazySchema, fieldDef).optional(), fieldDef.attributes);
496
+ } else {
497
+ fields[fieldName] = this.applyDescription(this.makeScalarFieldSchema(fieldDef), fieldDef.attributes);
498
+ }
499
+ }
500
+ const shape = z2.strictObject(fields);
501
+ return this.applyDescription(addCustomValidation(shape, modelDef.attributes), modelDef.attributes);
502
+ }
503
+ makeModelCreateSchema(model) {
504
+ const modelDef = this.schema.requireModel(model);
505
+ const fields = {};
506
+ for (const [fieldName, fieldDef] of Object.entries(modelDef.fields)) {
507
+ if (fieldDef.relation || fieldDef.computed || fieldDef.isDiscriminator) {
508
+ continue;
509
+ }
510
+ let fieldSchema = this.makeScalarFieldSchema(fieldDef);
511
+ if (fieldDef.optional || fieldDef.default !== void 0 || fieldDef.updatedAt) {
512
+ fieldSchema = fieldSchema.optional();
513
+ }
514
+ fields[fieldName] = this.applyDescription(fieldSchema, fieldDef.attributes);
515
+ }
516
+ const shape = z2.strictObject(fields);
517
+ return this.applyDescription(addCustomValidation(shape, modelDef.attributes), modelDef.attributes);
518
+ }
519
+ makeModelUpdateSchema(model) {
520
+ const modelDef = this.schema.requireModel(model);
521
+ const fields = {};
522
+ for (const [fieldName, fieldDef] of Object.entries(modelDef.fields)) {
523
+ if (fieldDef.relation || fieldDef.computed || fieldDef.isDiscriminator) {
524
+ continue;
525
+ }
526
+ let fieldSchema = this.makeScalarFieldSchema(fieldDef);
527
+ fieldSchema = fieldSchema.optional();
528
+ fields[fieldName] = this.applyDescription(fieldSchema, fieldDef.attributes);
529
+ }
530
+ const shape = z2.strictObject(fields);
531
+ return this.applyDescription(addCustomValidation(shape, modelDef.attributes), modelDef.attributes);
532
+ }
533
+ makeScalarFieldSchema(fieldDef) {
534
+ const { type, attributes } = fieldDef;
535
+ const enumDef = this.schema.getEnum(type);
536
+ if (enumDef) {
537
+ return this.applyCardinality(this.makeEnumSchema(type), fieldDef);
538
+ }
539
+ const typedefDef = this.schema.getTypeDef(type);
540
+ if (typedefDef) {
541
+ return this.applyCardinality(this.makeTypeSchema(type), fieldDef);
542
+ }
543
+ let base;
544
+ switch (type) {
545
+ case "String":
546
+ base = addStringValidation(z2.string(), attributes);
547
+ break;
548
+ case "Int":
549
+ base = addNumberValidation(z2.number().int(), attributes);
550
+ break;
551
+ case "Float":
552
+ base = addNumberValidation(z2.number(), attributes);
553
+ break;
554
+ case "Boolean":
555
+ base = z2.boolean();
556
+ break;
557
+ case "BigInt":
558
+ base = addBigIntValidation(z2.bigint(), attributes);
559
+ break;
560
+ case "Decimal":
561
+ base = z2.union([
562
+ addNumberValidation(z2.number(), attributes),
563
+ addDecimalValidation(z2.string(), attributes, true),
564
+ addDecimalValidation(z2.instanceof(Decimal2), attributes, true)
565
+ ]);
566
+ break;
567
+ case "DateTime":
568
+ base = z2.union([
569
+ z2.date(),
570
+ z2.iso.datetime()
571
+ ]);
572
+ break;
573
+ case "Bytes":
574
+ base = z2.instanceof(Uint8Array);
575
+ break;
576
+ case "Json":
577
+ base = this.makeJsonSchema();
578
+ break;
579
+ case "Unsupported":
580
+ base = z2.unknown();
581
+ break;
582
+ default: {
583
+ const _exhaustive = type;
584
+ throw new SchemaFactoryError(`Unsupported field type: ${_exhaustive}`);
585
+ }
586
+ }
587
+ return this.applyCardinality(base, fieldDef);
588
+ }
589
+ makeJsonSchema() {
590
+ return z2.union([
591
+ z2.string(),
592
+ z2.number(),
593
+ z2.boolean(),
594
+ z2.null(),
595
+ z2.array(z2.lazy(() => this.makeJsonSchema())),
596
+ z2.object({}).catchall(z2.lazy(() => this.makeJsonSchema()))
597
+ ]);
598
+ }
599
+ applyCardinality(schema, fieldDef) {
600
+ let result = schema;
601
+ if (fieldDef.array) {
602
+ result = result.array();
603
+ }
604
+ if (fieldDef.optional) {
605
+ result = result.nullable().optional();
606
+ }
607
+ return result;
608
+ }
609
+ makeTypeSchema(type) {
610
+ const typeDef = this.schema.requireTypeDef(type);
611
+ const fields = {};
612
+ for (const [fieldName, fieldDef] of Object.entries(typeDef.fields)) {
613
+ fields[fieldName] = this.applyDescription(this.makeScalarFieldSchema(fieldDef), fieldDef.attributes);
614
+ }
615
+ const shape = z2.strictObject(fields);
616
+ return this.applyDescription(addCustomValidation(shape, typeDef.attributes), typeDef.attributes);
617
+ }
618
+ makeEnumSchema(_enum) {
619
+ const enumDef = this.schema.requireEnum(_enum);
620
+ const schema = z2.enum(Object.keys(enumDef.values));
621
+ return this.applyDescription(schema, enumDef.attributes);
622
+ }
623
+ getMetaDescription(attributes) {
624
+ if (!attributes) return void 0;
625
+ for (const attr of attributes) {
626
+ if (attr.name !== "@meta" && attr.name !== "@@meta") continue;
627
+ const nameExpr = attr.args?.[0]?.value;
628
+ if (!nameExpr || ExpressionUtils2.getLiteralValue(nameExpr) !== "description") continue;
629
+ const valueExpr = attr.args?.[1]?.value;
630
+ if (valueExpr) {
631
+ return ExpressionUtils2.getLiteralValue(valueExpr);
632
+ }
633
+ }
634
+ return void 0;
635
+ }
636
+ applyDescription(schema, attributes) {
637
+ const description = this.getMetaDescription(attributes);
638
+ if (description) {
639
+ return schema.meta({
640
+ description
641
+ });
642
+ }
643
+ return schema;
644
+ }
645
+ };
28
646
  export {
29
- makeSelectSchema
647
+ utils_exports as ZodUtils,
648
+ createSchemaFactory
30
649
  };
31
650
  //# sourceMappingURL=index.js.map