Skip to content

Instantly share code, notes, and snippets.

@aaronjensen
Last active December 1, 2020 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronjensen/15b4c47ab119b0b73d8d493c4574435d to your computer and use it in GitHub Desktop.
Save aaronjensen/15b4c47ab119b0b73d8d493c4574435d to your computer and use it in GitHub Desktop.
Zod with experimental rollup circular dependency resolution
import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './common/_commonjsHelpers-c6a44736.js';
var cjs = {exports: {}};
var string = {exports: {}};
var base = {exports: {}};
var parser = {exports: {}};
var ZodError = {exports: {}};
var number = {exports: {}};
var bigint = {exports: {}};
var boolean = {exports: {}};
var date = {exports: {}};
var _undefined = {exports: {}};
var _null = {exports: {}};
var any = {exports: {}};
var unknown = {exports: {}};
var never = {exports: {}};
var _void = {exports: {}};
var array = {exports: {}};
var object = {exports: {}};
var intersection = {exports: {}};
var union = {exports: {}};
var tuple = {exports: {}};
var record = {exports: {}};
var map = {exports: {}};
var _function = {exports: {}};
var lazy = {exports: {}};
var literal = {exports: {}};
var _enum = {exports: {}};
var nativeEnum = {exports: {}};
var promise = {exports: {}};
var transformer = {exports: {}};
var optional = {exports: {}};
var nullable = {exports: {}};
var codegen = {exports: {}};
(function (module, exports) {
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodCodeGenerator = exports.ZodParsedType = exports.ZodSchema = exports.Schema = exports.ZodType = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.late = exports.codegen = exports.oboolean = exports.onumber = exports.ostring = exports.nullable = exports.optional = exports.transformer = exports.instanceof = exports.promise = exports.nativeEnum = exports.enum = exports.literal = exports.lazy = exports.function = exports.map = exports.record = exports.tuple = exports.intersection = exports.union = exports.object = exports.array = exports.void = exports.never = exports.unknown = exports.any = exports.null = exports.undefined = exports.date = exports.boolean = exports.bigint = exports.number = exports.string = exports.custom = exports.ZodTypes = void 0;
Object.defineProperty(exports, "ZodString", { enumerable: true, get: function () { return string.exports.ZodString; } });
Object.defineProperty(exports, "ZodNumber", { enumerable: true, get: function () { return number.exports.ZodNumber; } });
Object.defineProperty(exports, "ZodBigInt", { enumerable: true, get: function () { return bigint.exports.ZodBigInt; } });
Object.defineProperty(exports, "ZodBoolean", { enumerable: true, get: function () { return boolean.exports.ZodBoolean; } });
Object.defineProperty(exports, "ZodDate", { enumerable: true, get: function () { return date.exports.ZodDate; } });
Object.defineProperty(exports, "ZodUndefined", { enumerable: true, get: function () { return _undefined.exports.ZodUndefined; } });
Object.defineProperty(exports, "ZodNull", { enumerable: true, get: function () { return _null.exports.ZodNull; } });
Object.defineProperty(exports, "ZodAny", { enumerable: true, get: function () { return any.exports.ZodAny; } });
Object.defineProperty(exports, "ZodUnknown", { enumerable: true, get: function () { return unknown.exports.ZodUnknown; } });
Object.defineProperty(exports, "ZodNever", { enumerable: true, get: function () { return never.exports.ZodNever; } });
Object.defineProperty(exports, "ZodVoid", { enumerable: true, get: function () { return _void.exports.ZodVoid; } });
Object.defineProperty(exports, "ZodArray", { enumerable: true, get: function () { return array.exports.ZodArray; } });
Object.defineProperty(exports, "ZodObject", { enumerable: true, get: function () { return object.exports.ZodObject; } });
Object.defineProperty(exports, "ZodUnion", { enumerable: true, get: function () { return union.exports.ZodUnion; } });
Object.defineProperty(exports, "ZodIntersection", { enumerable: true, get: function () { return intersection.exports.ZodIntersection; } });
Object.defineProperty(exports, "ZodTuple", { enumerable: true, get: function () { return tuple.exports.ZodTuple; } });
Object.defineProperty(exports, "ZodRecord", { enumerable: true, get: function () { return record.exports.ZodRecord; } });
Object.defineProperty(exports, "ZodFunction", { enumerable: true, get: function () { return _function.exports.ZodFunction; } });
Object.defineProperty(exports, "ZodLazy", { enumerable: true, get: function () { return lazy.exports.ZodLazy; } });
Object.defineProperty(exports, "ZodLiteral", { enumerable: true, get: function () { return literal.exports.ZodLiteral; } });
Object.defineProperty(exports, "ZodEnum", { enumerable: true, get: function () { return _enum.exports.ZodEnum; } });
Object.defineProperty(exports, "ZodNativeEnum", { enumerable: true, get: function () { return nativeEnum.exports.ZodNativeEnum; } });
Object.defineProperty(exports, "ZodPromise", { enumerable: true, get: function () { return promise.exports.ZodPromise; } });
Object.defineProperty(exports, "ZodTransformer", { enumerable: true, get: function () { return transformer.exports.ZodTransformer; } });
Object.defineProperty(exports, "ZodOptional", { enumerable: true, get: function () { return optional.exports.ZodOptional; } });
Object.defineProperty(exports, "ZodNullable", { enumerable: true, get: function () { return nullable.exports.ZodNullable; } });
Object.defineProperty(exports, "ZodType", { enumerable: true, get: function () { return base.exports.ZodType; } });
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return base.exports.ZodType; } });
Object.defineProperty(exports, "ZodSchema", { enumerable: true, get: function () { return base.exports.ZodType; } });
Object.defineProperty(exports, "ZodTypes", { enumerable: true, get: function () { return base.exports.ZodTypes; } });
Object.defineProperty(exports, "ZodParsedType", { enumerable: true, get: function () { return parser.exports.ZodParsedType; } });
Object.defineProperty(exports, "ZodCodeGenerator", { enumerable: true, get: function () { return codegen.exports.ZodCodeGenerator; } });
var stringType = string.exports.ZodString.create;
exports.string = stringType;
var numberType = number.exports.ZodNumber.create;
exports.number = numberType;
var bigIntType = bigint.exports.ZodBigInt.create;
exports.bigint = bigIntType;
var booleanType = boolean.exports.ZodBoolean.create;
exports.boolean = booleanType;
var dateType = date.exports.ZodDate.create;
exports.date = dateType;
var undefinedType = _undefined.exports.ZodUndefined.create;
exports.undefined = undefinedType;
var nullType = _null.exports.ZodNull.create;
exports.null = nullType;
var anyType = any.exports.ZodAny.create;
exports.any = anyType;
var unknownType = unknown.exports.ZodUnknown.create;
exports.unknown = unknownType;
var neverType = never.exports.ZodNever.create;
exports.never = neverType;
var voidType = _void.exports.ZodVoid.create;
exports.void = voidType;
var arrayType = array.exports.ZodArray.create;
exports.array = arrayType;
var objectType = object.exports.ZodObject.create;
exports.object = objectType;
var unionType = union.exports.ZodUnion.create;
exports.union = unionType;
var intersectionType = intersection.exports.ZodIntersection.create;
exports.intersection = intersectionType;
var tupleType = tuple.exports.ZodTuple.create;
exports.tuple = tupleType;
var recordType = record.exports.ZodRecord.create;
exports.record = recordType;
var mapType = map.exports.ZodMap.create;
exports.map = mapType;
var functionType = _function.exports.ZodFunction.create;
exports.function = functionType;
var lazyType = lazy.exports.ZodLazy.create;
exports.lazy = lazyType;
var literalType = literal.exports.ZodLiteral.create;
exports.literal = literalType;
var enumType = _enum.exports.ZodEnum.create;
exports.enum = enumType;
var nativeEnumType = nativeEnum.exports.ZodNativeEnum.create;
exports.nativeEnum = nativeEnumType;
var promiseType = promise.exports.ZodPromise.create;
exports.promise = promiseType;
var transformerType = transformer.exports.ZodTransformer.create;
exports.transformer = transformerType;
var optionalType = optional.exports.ZodOptional.create;
exports.optional = optionalType;
var nullableType = nullable.exports.ZodNullable.create;
exports.nullable = nullableType;
var ostring = function () { return stringType().optional(); };
exports.ostring = ostring;
var onumber = function () { return numberType().optional(); };
exports.onumber = onumber;
var oboolean = function () { return booleanType().optional(); };
exports.oboolean = oboolean;
var codegen$1 = codegen.exports.ZodCodeGenerator.create;
exports.codegen = codegen$1;
exports.custom = function (check, params) {
if (check)
return anyType().refine(check, params);
return anyType();
};
var instanceOfType = function (cls, params) {
if (params === void 0) { params = {
message: "Input not instance of " + cls.name,
}; }
return exports.custom(function (data) { return data instanceof cls; }, params);
};
exports.instanceof = instanceOfType;
exports.late = {
object: object.exports.ZodObject.lazycreate,
};
__exportStar(ZodError.exports, exports);
}(cjs, cjs.exports));
var __pika_web_default_export_for_treeshaking__ = /*@__PURE__*/getDefaultExportFromCjs(cjs.exports);
var Schema = cjs.exports.Schema;
var ZodAny = cjs.exports.ZodAny;
var ZodArray = cjs.exports.ZodArray;
var ZodBigInt = cjs.exports.ZodBigInt;
var ZodBoolean = cjs.exports.ZodBoolean;
var ZodCodeGenerator = cjs.exports.ZodCodeGenerator;
var ZodDate = cjs.exports.ZodDate;
var ZodEnum = cjs.exports.ZodEnum;
var ZodError$1 = cjs.exports.ZodError;
var ZodFunction = cjs.exports.ZodFunction;
var ZodIntersection = cjs.exports.ZodIntersection;
var ZodIssueCode = cjs.exports.ZodIssueCode;
var ZodLazy = cjs.exports.ZodLazy;
var ZodLiteral = cjs.exports.ZodLiteral;
var ZodNativeEnum = cjs.exports.ZodNativeEnum;
var ZodNever = cjs.exports.ZodNever;
var ZodNull = cjs.exports.ZodNull;
var ZodNullable = cjs.exports.ZodNullable;
var ZodNumber = cjs.exports.ZodNumber;
var ZodObject = cjs.exports.ZodObject;
var ZodOptional = cjs.exports.ZodOptional;
var ZodParsedType = cjs.exports.ZodParsedType;
var ZodPromise = cjs.exports.ZodPromise;
var ZodRecord = cjs.exports.ZodRecord;
var ZodSchema = cjs.exports.ZodSchema;
var ZodString = cjs.exports.ZodString;
var ZodTransformer = cjs.exports.ZodTransformer;
var ZodTuple = cjs.exports.ZodTuple;
var ZodType = cjs.exports.ZodType;
var ZodTypes = cjs.exports.ZodTypes;
var ZodUndefined = cjs.exports.ZodUndefined;
var ZodUnion = cjs.exports.ZodUnion;
var ZodUnknown = cjs.exports.ZodUnknown;
var ZodVoid = cjs.exports.ZodVoid;
var exports = cjs.exports;
var any$1 = cjs.exports.any;
var array$1 = cjs.exports.array;
var bigint$1 = cjs.exports.bigint;
var boolean$1 = cjs.exports.boolean;
var codegen$1 = cjs.exports.codegen;
var custom = cjs.exports.custom;
var date$1 = cjs.exports.date;
export default __pika_web_default_export_for_treeshaking__;
var function$1 = cjs.exports["function"];
var instanceof$1 = cjs.exports["instanceof"];
var intersection$1 = cjs.exports.intersection;
var late = cjs.exports.late;
var lazy$1 = cjs.exports.lazy;
var literal$1 = cjs.exports.literal;
var map$1 = cjs.exports.map;
var nativeEnum$1 = cjs.exports.nativeEnum;
var never$1 = cjs.exports.never;
var null$1 = cjs.exports["null"];
var nullable$1 = cjs.exports.nullable;
var number$1 = cjs.exports.number;
var object$1 = cjs.exports.object;
var oboolean = cjs.exports.oboolean;
var onumber = cjs.exports.onumber;
var optional$1 = cjs.exports.optional;
var ostring = cjs.exports.ostring;
var promise$1 = cjs.exports.promise;
var quotelessJson = cjs.exports.quotelessJson;
var record$1 = cjs.exports.record;
var string$1 = cjs.exports.string;
var transformer$1 = cjs.exports.transformer;
var tuple$1 = cjs.exports.tuple;
var undefined$1 = cjs.exports["undefined"];
var union$1 = cjs.exports.union;
var unknown$1 = cjs.exports.unknown;
var void$1 = cjs.exports["void"];
export { Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodCodeGenerator, ZodDate, ZodEnum, ZodError$1 as ZodError, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPromise, ZodRecord, ZodSchema, ZodString, ZodTransformer, ZodTuple, ZodType, ZodTypes, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, exports as __moduleExports, any$1 as any, array$1 as array, bigint$1 as bigint, boolean$1 as boolean, codegen$1 as codegen, custom, date$1 as date, function$1 as function, instanceof$1 as instanceof, intersection$1 as intersection, late, lazy$1 as lazy, literal$1 as literal, map$1 as map, nativeEnum$1 as nativeEnum, never$1 as never, null$1 as null, nullable$1 as nullable, number$1 as number, object$1 as object, oboolean, onumber, optional$1 as optional, ostring, promise$1 as promise, quotelessJson, record$1 as record, string$1 as string, transformer$1 as transformer, tuple$1 as tuple, undefined$1 as undefined, union$1 as union, unknown$1 as unknown, void$1 as void };
import { c as createCommonjsModule, a as commonjsGlobal, g as getDefaultExportFromCjs } from './common/_commonjsHelpers-8c19dec8.js';
var util_1 = createCommonjsModule(function (module, exports) {
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.util = exports.INVALID = void 0;
exports.INVALID = Symbol('invalid_data');
var util;
(function (util) {
function assertNever(_x) {
throw new Error();
}
util.assertNever = assertNever;
util.arrayToEnum = function (items) {
var e_1, _a;
var obj = {};
try {
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
var item = items_1_1.value;
obj[item] = item;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
}
finally { if (e_1) throw e_1.error; }
}
return obj;
};
util.getValidEnumValues = function (obj) {
var e_2, _a;
var validKeys = Object.keys(obj).filter(function (k) { return typeof obj[obj[k]] !== 'number'; });
var filtered = {};
try {
for (var validKeys_1 = __values(validKeys), validKeys_1_1 = validKeys_1.next(); !validKeys_1_1.done; validKeys_1_1 = validKeys_1.next()) {
var k = validKeys_1_1.value;
filtered[k] = obj[k];
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (validKeys_1_1 && !validKeys_1_1.done && (_a = validKeys_1.return)) _a.call(validKeys_1);
}
finally { if (e_2) throw e_2.error; }
}
return util.getValues(filtered);
};
util.getValues = function (obj) {
return Object.keys(obj).map(function (e) {
return obj[e];
});
};
util.objectValues = function (obj) {
return Object.keys(obj).map(function (e) {
return obj[e];
});
};
util.find = function (arr, checker) {
var e_3, _a;
try {
for (var arr_1 = __values(arr), arr_1_1 = arr_1.next(); !arr_1_1.done; arr_1_1 = arr_1.next()) {
var item = arr_1_1.value;
if (checker(item))
return item;
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) _a.call(arr_1);
}
finally { if (e_3) throw e_3.error; }
}
return undefined;
};
})(util = exports.util || (exports.util = {}));
});
var ZodError_1 = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (commonjsGlobal && commonjsGlobal.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
exports.ZodIssueCode = util_1.util.arrayToEnum([
'invalid_type',
'nonempty_array_is_empty',
'custom',
'invalid_union',
'invalid_literal_value',
'invalid_enum_value',
'unrecognized_keys',
'invalid_arguments',
'invalid_return_type',
'invalid_date',
'invalid_string',
'too_small',
'too_big',
'invalid_intersection_types',
]);
exports.quotelessJson = function (obj) {
var json = JSON.stringify(obj, null, 2);
return json.replace(/"([^"]+)":/g, '$1:');
};
var ZodError = (function (_super) {
__extends(ZodError, _super);
function ZodError(issues) {
var _newTarget = this.constructor;
var _this = _super.call(this) || this;
_this.issues = [];
_this.addIssue = function (sub) {
_this.issues = __spread(_this.issues, [sub]);
};
_this.addIssues = function (subs) {
if (subs === void 0) { subs = []; }
_this.issues = __spread(_this.issues, subs);
};
_this.flatten = function () {
var e_1, _a;
var fieldErrors = {};
var formErrors = [];
try {
for (var _b = __values(_this.issues), _c = _b.next(); !_c.done; _c = _b.next()) {
var sub = _c.value;
if (sub.path.length > 0) {
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
fieldErrors[sub.path[0]].push(sub.message);
}
else {
formErrors.push(sub.message);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return { formErrors: formErrors, fieldErrors: fieldErrors };
};
var actualProto = _newTarget.prototype;
Object.setPrototypeOf(_this, actualProto);
_this.issues = issues;
return _this;
}
Object.defineProperty(ZodError.prototype, "errors", {
get: function () {
return this.issues;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ZodError.prototype, "message", {
get: function () {
return JSON.stringify(this.issues, null, 2);
},
enumerable: false,
configurable: true
});
Object.defineProperty(ZodError.prototype, "isEmpty", {
get: function () {
return this.issues.length === 0;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ZodError.prototype, "formErrors", {
get: function () {
return this.flatten();
},
enumerable: false,
configurable: true
});
ZodError.create = function (issues) {
var error = new ZodError(issues);
return error;
};
return ZodError;
}(Error));
exports.ZodError = ZodError;
});
var defaultErrorMap = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultErrorMap = void 0;
exports.defaultErrorMap = function (error, _ctx) {
var message;
switch (error.code) {
case ZodError_1.ZodIssueCode.invalid_type:
if (error.received === 'undefined') {
message = 'Required';
}
else {
message = "Expected " + error.expected + ", received " + error.received;
}
break;
case ZodError_1.ZodIssueCode.nonempty_array_is_empty:
message = "List must contain at least one item";
break;
case ZodError_1.ZodIssueCode.unrecognized_keys:
message = "Unrecognized key(s) in object: " + error.keys
.map(function (k) { return "'" + k + "'"; })
.join(', ');
break;
case ZodError_1.ZodIssueCode.invalid_union:
message = "Invalid input";
break;
case ZodError_1.ZodIssueCode.invalid_literal_value:
message = "Input must be \"" + error.expected + "\"";
break;
case ZodError_1.ZodIssueCode.invalid_enum_value:
message = "Input must be one of these values: " + error.options.join(', ');
break;
case ZodError_1.ZodIssueCode.invalid_arguments:
message = "Invalid function arguments";
break;
case ZodError_1.ZodIssueCode.invalid_return_type:
message = "Invalid function return type";
break;
case ZodError_1.ZodIssueCode.invalid_date:
message = "Invalid date";
break;
case ZodError_1.ZodIssueCode.invalid_string:
if (error.validation !== 'regex')
message = "Invalid " + error.validation;
else
message = 'Invalid';
break;
case ZodError_1.ZodIssueCode.too_small:
if (error.type === 'array')
message = "Should have " + (error.inclusive ? "at least" : "more than") + " " + error.minimum + " items";
else if (error.type === 'string')
message = "Should be " + (error.inclusive ? "at least" : "over") + " " + error.minimum + " characters";
else if (error.type === 'number')
message = "Value should be greater than " + (error.inclusive ? "or equal to " : "") + error.minimum;
else
message = 'Invalid input';
break;
case ZodError_1.ZodIssueCode.too_big:
if (error.type === 'array')
message = "Should have " + (error.inclusive ? "at most" : "less than") + " " + error.maximum + " items";
else if (error.type === 'string')
message = "Should be " + (error.inclusive ? "at most" : "under") + " " + error.maximum + " characters long";
else if (error.type === 'number')
message = "Value should be less than " + (error.inclusive ? "or equal to " : "") + error.maximum;
else
message = 'Invalid input';
break;
case ZodError_1.ZodIssueCode.custom:
message = "Invalid input.";
break;
case ZodError_1.ZodIssueCode.invalid_intersection_types:
message = "Intersections only support objects";
break;
default:
message = "Invalid input.";
util_1.util.assertNever(error);
}
return { message: message };
};
});
var PseudoPromise_1 = createCommonjsModule(function (module, exports) {
var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (commonjsGlobal && commonjsGlobal.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PseudoPromise = void 0;
var PseudoPromise = (function () {
function PseudoPromise(funcs) {
var _this = this;
if (funcs === void 0) { funcs = []; }
this.all = function (pps) {
return _this.then(function (_arg, ctx) {
if (ctx.async) {
try {
var allValues = Promise.all(pps.map(function (pp) {
try {
var asdf = pp.getValueAsync();
return asdf;
}
catch (err) {
return util_1.INVALID;
}
})).then(function (vals) {
return vals;
});
return allValues;
}
catch (err) { }
}
else {
try {
return pps.map(function (pp) { return pp.getValueSync(); });
}
catch (err) { }
}
});
};
this.then = function (func) {
return new PseudoPromise(__spread(_this.items, [
{ type: 'function', function: func },
]));
};
this.catch = function (catcher) {
return new PseudoPromise(__spread(_this.items, [{ type: 'catcher', catcher: catcher }]));
};
this.getValueSync = function () {
var val = undefined;
var _loop_1 = function (index) {
try {
var item = _this.items[index];
if (item.type === 'function') {
val = item.function(val, { async: false });
}
}
catch (err) {
var catcherIndex = _this.items.findIndex(function (x, i) { return x.type === 'catcher' && i > index; });
var catcherItem = _this.items[catcherIndex];
if (!catcherItem || catcherItem.type !== 'catcher') {
throw err;
}
else {
val = catcherItem.catcher(err, { async: false });
index = catcherIndex;
}
}
out_index_1 = index;
};
var out_index_1;
for (var index = 0; index < _this.items.length; index++) {
_loop_1(index);
index = out_index_1;
}
return val;
};
this.getValueAsync = function () { return __awaiter(_this, void 0, void 0, function () {
var val, _loop_2, this_1, out_index_2, index;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
val = undefined;
_loop_2 = function (index) {
var item, err_1, catcherIndex, catcherItem;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
item = this_1.items[index];
_a.label = 1;
case 1:
_a.trys.push([1, 4, , 8]);
if (!(item.type === 'function')) return [3, 3];
return [4, item.function(val, { async: true })];
case 2:
val = _a.sent();
_a.label = 3;
case 3: return [3, 8];
case 4:
err_1 = _a.sent();
catcherIndex = this_1.items.findIndex(function (x, i) { return x.type === 'catcher' && i > index; });
catcherItem = this_1.items[catcherIndex];
if (!(!catcherItem || catcherItem.type !== 'catcher')) return [3, 5];
throw err_1;
case 5:
index = catcherIndex;
return [4, catcherItem.catcher(err_1, { async: true })];
case 6:
val = _a.sent();
_a.label = 7;
case 7: return [3, 8];
case 8:
if (val instanceof PseudoPromise) {
throw new Error('ASYNC: DO NOT RETURN PSEUDOPROMISE FROM FUNCTIONS');
}
if (val instanceof Promise) {
throw new Error('ASYNC: DO NOT RETURN PROMISE FROM FUNCTIONS');
}
out_index_2 = index;
return [2];
}
});
};
this_1 = this;
index = 0;
_a.label = 1;
case 1:
if (!(index < this.items.length)) return [3, 4];
return [5, _loop_2(index)];
case 2:
_a.sent();
index = out_index_2;
_a.label = 3;
case 3:
index++;
return [3, 1];
case 4: return [2, val];
}
});
}); };
this.items = funcs;
}
PseudoPromise.all = function (pps) {
return new PseudoPromise().all(pps);
};
PseudoPromise.object = function (pps) {
return new PseudoPromise().then(function (_arg, ctx) {
var e_1, _a;
var value = {};
var zerr = new ZodError_1.ZodError([]);
if (ctx.async) {
var getAsyncObject = function () { return __awaiter(void 0, void 0, void 0, function () {
var items, items_2, items_2_1, item;
var e_2, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4, Promise.all(Object.keys(pps).map(function (k) { return __awaiter(void 0, void 0, void 0, function () {
var v, err_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4, pps[k].getValueAsync()];
case 1:
v = _a.sent();
return [2, [k, v]];
case 2:
err_2 = _a.sent();
if (err_2 instanceof ZodError_1.ZodError) {
zerr.addIssues(err_2.issues);
return [2, [k, util_1.INVALID]];
}
throw err_2;
case 3: return [2];
}
});
}); }))];
case 1:
items = _b.sent();
if (!zerr.isEmpty)
throw zerr;
try {
for (items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
item = items_2_1.value;
value[item[0]] = item[1];
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (items_2_1 && !items_2_1.done && (_a = items_2.return)) _a.call(items_2);
}
finally { if (e_2) throw e_2.error; }
}
return [2, value];
}
});
}); };
return getAsyncObject();
}
else {
var items = Object.keys(pps).map(function (k) {
try {
var v = pps[k].getValueSync();
return [k, v];
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
zerr.addIssues(err.issues);
return [k, util_1.INVALID];
}
throw err;
}
});
if (!zerr.isEmpty)
throw zerr;
try {
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
var item = items_1_1.value;
value[item[0]] = item[1];
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
}
finally { if (e_1) throw e_1.error; }
}
return value;
}
});
};
PseudoPromise.resolve = function (value) {
if (value instanceof PseudoPromise) {
throw new Error('Do not pass PseudoPromise into PseudoPromise.resolve');
}
return new PseudoPromise().then(function () { return value; });
};
return PseudoPromise;
}());
exports.PseudoPromise = PseudoPromise;
});
var parser = createCommonjsModule(function (module, exports) {
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (commonjsGlobal && commonjsGlobal.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodParser = exports.ZodParsedType = exports.getParsedType = void 0;
var z = __importStar(base);
exports.getParsedType = function (data) {
if (typeof data === 'string')
return 'string';
if (typeof data === 'number') {
if (Number.isNaN(data))
return 'nan';
return 'number';
}
if (typeof data === 'boolean')
return 'boolean';
if (typeof data === 'bigint')
return 'bigint';
if (typeof data === 'symbol')
return 'symbol';
if (data instanceof Date)
return 'date';
if (typeof data === 'function')
return 'function';
if (data === undefined)
return 'undefined';
if (typeof data === 'undefined')
return 'undefined';
if (typeof data === 'object') {
if (Array.isArray(data))
return 'array';
if (data === null)
return 'null';
if (data.then &&
typeof data.then === 'function' &&
data.catch &&
typeof data.catch === 'function') {
return 'promise';
}
if (data instanceof Map) {
return 'map';
}
return 'object';
}
return 'unknown';
};
exports.ZodParsedType = util_1.util.arrayToEnum([
'string',
'nan',
'number',
'integer',
'boolean',
'date',
'bigint',
'symbol',
'function',
'undefined',
'null',
'array',
'object',
'unknown',
'promise',
'void',
'never',
'map',
]);
var makeError = function (params, data, errorData) {
var errorArg = __assign(__assign({}, errorData), { path: __spread(params.path, (errorData.path || [])) });
var ctxArg = { data: data };
var defaultError = defaultErrorMap.defaultErrorMap === params.errorMap
? { message: "Invalid value." }
: defaultErrorMap.defaultErrorMap(errorArg, __assign(__assign({}, ctxArg), { defaultError: "Invalid value." }));
return __assign(__assign({}, errorData), { path: __spread(params.path, (errorData.path || [])), message: errorData.message ||
params.errorMap(errorArg, __assign(__assign({}, ctxArg), { defaultError: defaultError.message })).message });
};
exports.ZodParser = function (schema) { return function (data, baseParams) {
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
var _e, _f;
if (baseParams === void 0) { baseParams = { seen: [], errorMap: defaultErrorMap.defaultErrorMap, path: [] }; }
var params = {
seen: baseParams.seen || [],
path: baseParams.path || [],
errorMap: baseParams.errorMap || defaultErrorMap.defaultErrorMap,
async: (_e = baseParams.async) !== null && _e !== void 0 ? _e : false,
runAsyncValidationsInSeries: (_f = baseParams.runAsyncValidationsInSeries) !== null && _f !== void 0 ? _f : false,
};
var def = schema._def;
var PROMISE = new PseudoPromise_1.PseudoPromise();
PROMISE._default = true;
var RESULT = {
input: data,
output: util_1.INVALID,
};
params.seen = params.seen || [];
var ERROR = new ZodError_1.ZodError([]);
var THROW = function () {
RESULT.error = ERROR;
throw ERROR;
};
var HANDLE = function (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
}
throw err;
};
var parsedType = exports.getParsedType(data);
switch (def.t) {
case z.ZodTypes.string:
if (parsedType !== exports.ZodParsedType.string) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.string,
received: parsedType,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.number:
if (parsedType !== exports.ZodParsedType.number) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.number,
received: parsedType,
}));
THROW();
}
if (Number.isNaN(data)) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.number,
received: exports.ZodParsedType.nan,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.bigint:
if (parsedType !== exports.ZodParsedType.bigint) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.bigint,
received: parsedType,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.boolean:
if (parsedType !== exports.ZodParsedType.boolean) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.boolean,
received: parsedType,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.undefined:
if (parsedType !== exports.ZodParsedType.undefined) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.undefined,
received: parsedType,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.null:
if (parsedType !== exports.ZodParsedType.null) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.null,
received: parsedType,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.any:
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.unknown:
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.never:
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.never,
received: parsedType,
}));
PROMISE = PseudoPromise_1.PseudoPromise.resolve(util_1.INVALID);
break;
case z.ZodTypes.void:
if (parsedType !== exports.ZodParsedType.undefined &&
parsedType !== exports.ZodParsedType.null) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.void,
received: parsedType,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.array:
RESULT.output = [];
if (parsedType !== exports.ZodParsedType.array) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.array,
received: parsedType,
}));
THROW();
}
if (def.nonempty === true && data.length === 0) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.nonempty_array_is_empty,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.all(data.map(function (item, i) {
try {
return PseudoPromise_1.PseudoPromise.resolve(def.type.parse(item, __assign(__assign({}, params), { path: __spread(params.path, [i]) })));
}
catch (err) {
if (!(err instanceof ZodError_1.ZodError)) {
throw err;
}
ERROR.addIssues(err.issues);
return PseudoPromise_1.PseudoPromise.resolve(util_1.INVALID);
}
}));
break;
case z.ZodTypes.map:
if (parsedType !== exports.ZodParsedType.map) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.map,
received: parsedType,
}));
THROW();
}
var dataMap = data;
var returnedMap_1 = new Map();
PROMISE = PseudoPromise_1.PseudoPromise.all(__spread(dataMap.entries()).map(function (_a, index) {
var _b = __read(_a, 2), key = _b[0], value = _b[1];
return PseudoPromise_1.PseudoPromise.all([
new PseudoPromise_1.PseudoPromise()
.then(function () {
return def.keyType.parse(key, __assign(__assign({}, params), { path: __spread(params.path, [index, 'key']) }));
})
.catch(function (err) {
if (!(err instanceof ZodError_1.ZodError)) {
throw err;
}
ERROR.addIssues(err.issues);
return util_1.INVALID;
}),
new PseudoPromise_1.PseudoPromise()
.then(function () {
var mapValue = def.valueType.parse(value, __assign(__assign({}, params), { path: __spread(params.path, [index, 'value']) }));
return [key, mapValue];
})
.catch(function (err) {
if (!(err instanceof ZodError_1.ZodError)) {
throw err;
}
ERROR.addIssues(err.issues);
return util_1.INVALID;
}),
])
.then(function (item) {
try {
if (item[0] !== util_1.INVALID && item[1] !== util_1.INVALID) {
returnedMap_1.set(item[0], item[1]);
}
else {
}
}
catch (err) { }
})
.catch(function (err) {
if (!(err instanceof ZodError_1.ZodError)) {
throw err;
}
ERROR.addIssues(err.issues);
return util_1.INVALID;
});
}))
.then(function () {
if (!ERROR.isEmpty) {
throw ERROR;
}
})
.then(function () {
return returnedMap_1;
})
.then(function () {
return returnedMap_1;
});
break;
case z.ZodTypes.object:
RESULT.output = {};
if (parsedType !== exports.ZodParsedType.object) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.object,
received: parsedType,
}));
THROW();
}
var objectPromises = {};
var shape = def.shape();
var shapeKeys_2 = Object.keys(shape);
var dataKeys = Object.keys(data);
var extraKeys = dataKeys.filter(function (k) { return shapeKeys_2.indexOf(k) === -1; });
var _loop_1 = function (key) {
var keyValidator = shapeKeys_2.includes(key)
? shape[key]
: !(def.catchall instanceof cjs.ZodNever)
? def.catchall
: undefined;
if (!keyValidator) {
return "continue";
}
if (!Object.keys(data).includes(key)) {
try {
var output = keyValidator.parse(undefined, __assign(__assign({}, params), { path: __spread(params.path, [key]) }));
if (output === undefined) {
}
else {
objectPromises[key] = PseudoPromise_1.PseudoPromise.resolve(output);
}
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
var zerr = err;
ERROR.addIssues(zerr.issues);
objectPromises[key] = PseudoPromise_1.PseudoPromise.resolve(util_1.INVALID);
}
else {
throw err;
}
}
return "continue";
}
objectPromises[key] = new PseudoPromise_1.PseudoPromise().then(function () {
try {
var parsedValue = keyValidator.parse(data[key], __assign(__assign({}, params), { path: __spread(params.path, [key]) }));
return parsedValue;
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
var zerr = err;
ERROR.addIssues(zerr.issues);
return util_1.INVALID;
}
else {
throw err;
}
}
});
};
try {
for (var shapeKeys_1 = __values(shapeKeys_2), shapeKeys_1_1 = shapeKeys_1.next(); !shapeKeys_1_1.done; shapeKeys_1_1 = shapeKeys_1.next()) {
var key = shapeKeys_1_1.value;
_loop_1(key);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (shapeKeys_1_1 && !shapeKeys_1_1.done && (_a = shapeKeys_1.return)) _a.call(shapeKeys_1);
}
finally { if (e_1) throw e_1.error; }
}
if (def.catchall instanceof cjs.ZodNever) {
if (def.unknownKeys === 'passthrough') {
try {
for (var extraKeys_1 = __values(extraKeys), extraKeys_1_1 = extraKeys_1.next(); !extraKeys_1_1.done; extraKeys_1_1 = extraKeys_1.next()) {
var key = extraKeys_1_1.value;
objectPromises[key] = PseudoPromise_1.PseudoPromise.resolve(data[key]);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (extraKeys_1_1 && !extraKeys_1_1.done && (_b = extraKeys_1.return)) _b.call(extraKeys_1);
}
finally { if (e_2) throw e_2.error; }
}
}
else if (def.unknownKeys === 'strict') {
if (extraKeys.length > 0) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.unrecognized_keys,
keys: extraKeys,
}));
}
}
else if (def.unknownKeys === 'strip') ;
else {
util_1.util.assertNever(def.unknownKeys);
}
}
else {
var _loop_2 = function (key) {
objectPromises[key] = new PseudoPromise_1.PseudoPromise().then(function () {
try {
var parsedValue = def.catchall.parse(data[key], __assign(__assign({}, params), { path: __spread(params.path, [key]) }));
return parsedValue;
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
var zerr = err;
ERROR.addIssues(zerr.issues);
return util_1.INVALID;
}
else {
throw err;
}
}
});
};
try {
for (var extraKeys_2 = __values(extraKeys), extraKeys_2_1 = extraKeys_2.next(); !extraKeys_2_1.done; extraKeys_2_1 = extraKeys_2.next()) {
var key = extraKeys_2_1.value;
_loop_2(key);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (extraKeys_2_1 && !extraKeys_2_1.done && (_c = extraKeys_2.return)) _c.call(extraKeys_2);
}
finally { if (e_3) throw e_3.error; }
}
}
PROMISE = PseudoPromise_1.PseudoPromise.object(objectPromises)
.then(function (resolvedObject) {
Object.assign(RESULT.output, resolvedObject);
return RESULT.output;
})
.catch(function (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
return util_1.INVALID;
}
throw err;
});
break;
case z.ZodTypes.union:
var isValid_1 = false;
var unionErrors_1 = [];
PROMISE = PseudoPromise_1.PseudoPromise.all(def.options.map(function (opt) {
try {
var parseProm = opt.parse(data, params);
var unionValueProm = PseudoPromise_1.PseudoPromise.resolve(parseProm);
isValid_1 = true;
return unionValueProm;
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
unionErrors_1.push(err);
return PseudoPromise_1.PseudoPromise.resolve(util_1.INVALID);
}
throw err;
}
}))
.then(function (unionResults) {
return util_1.util.find(unionResults, function (val) { return val !== util_1.INVALID; });
})
.then(function (unionResult) {
if (!isValid_1) {
var nonTypeErrors = unionErrors_1.filter(function (err) {
return err.issues[0].code !== 'invalid_type';
});
if (nonTypeErrors.length === 1) {
ERROR.addIssues(nonTypeErrors[0].issues);
}
else {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_union,
unionErrors: unionErrors_1,
}));
}
return util_1.INVALID;
}
return unionResult;
});
break;
case z.ZodTypes.intersection:
PROMISE = PseudoPromise_1.PseudoPromise.all([
new PseudoPromise_1.PseudoPromise().then(function () {
try {
return def.left.parse(data, params);
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
return util_1.INVALID;
}
throw err;
}
}),
new PseudoPromise_1.PseudoPromise().then(function () {
try {
return def.right.parse(data, params);
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
return util_1.INVALID;
}
throw err;
}
}),
]).then(function (_a) {
var _b = __read(_a, 2), parsedLeft = _b[0], parsedRight = _b[1];
if (parsedLeft === util_1.INVALID || parsedRight === util_1.INVALID)
return util_1.INVALID;
var parsedLeftType = exports.getParsedType(parsedLeft);
var parsedRightType = exports.getParsedType(parsedRight);
if (parsedLeft === parsedRight) {
return parsedLeft;
}
else if (parsedLeftType === exports.ZodParsedType.object &&
parsedRightType === exports.ZodParsedType.object) {
return __assign(__assign({}, parsedLeft), parsedRight);
}
else {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_intersection_types,
}));
}
});
break;
case z.ZodTypes.optional:
if (parsedType === exports.ZodParsedType.undefined) {
PROMISE = PseudoPromise_1.PseudoPromise.resolve(undefined);
break;
}
PROMISE = new PseudoPromise_1.PseudoPromise().then(function () {
try {
return def.innerType.parse(data, params);
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
return util_1.INVALID;
}
throw err;
}
});
break;
case z.ZodTypes.nullable:
if (parsedType === exports.ZodParsedType.null) {
PROMISE = PseudoPromise_1.PseudoPromise.resolve(null);
break;
}
PROMISE = new PseudoPromise_1.PseudoPromise().then(function () {
try {
return def.innerType.parse(data, params);
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
return util_1.INVALID;
}
throw err;
}
});
break;
case z.ZodTypes.tuple:
if (parsedType !== exports.ZodParsedType.array) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.array,
received: parsedType,
}));
THROW();
}
if (data.length > def.items.length) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.too_big,
maximum: def.items.length,
inclusive: true,
type: 'array',
}));
}
else if (data.length < def.items.length) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.too_small,
minimum: def.items.length,
inclusive: true,
type: 'array',
}));
}
var tupleData = data;
PROMISE = PseudoPromise_1.PseudoPromise.all(tupleData.map(function (item, index) {
var itemParser = def.items[index];
return new PseudoPromise_1.PseudoPromise().then(function () {
try {
return itemParser.parse(item, __assign(__assign({}, params), { path: __spread(params.path, [index]) }));
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
return util_1.INVALID;
}
throw err;
}
});
}));
break;
case z.ZodTypes.lazy:
var lazySchema = def.getter();
PROMISE = PseudoPromise_1.PseudoPromise.resolve(lazySchema.parse(data, params));
break;
case z.ZodTypes.literal:
if (data !== def.value) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_literal_value,
expected: def.value,
}));
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.enum:
if (def.values.indexOf(data) === -1) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_enum_value,
options: def.values,
}));
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.nativeEnum:
if (util_1.util.getValidEnumValues(def.values).indexOf(data) === -1) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_enum_value,
options: util_1.util.objectValues(def.values),
}));
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.function:
if (parsedType !== exports.ZodParsedType.function) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.function,
received: parsedType,
}));
THROW();
}
var validatedFunc = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
try {
def.args.parse(args, params);
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
var argsError = new ZodError_1.ZodError([]);
argsError.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_arguments,
argumentsError: err,
}));
throw argsError;
}
throw err;
}
var result = data.apply(void 0, __spread(args));
try {
return def.returns.parse(result, params);
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
var returnsError = new ZodError_1.ZodError([]);
returnsError.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_return_type,
returnTypeError: err,
}));
throw returnsError;
}
throw err;
}
};
PROMISE = PseudoPromise_1.PseudoPromise.resolve(validatedFunc);
break;
case z.ZodTypes.record:
if (parsedType !== exports.ZodParsedType.object) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.object,
received: parsedType,
}));
THROW();
}
var parsedRecordPromises = {};
var _loop_3 = function (key) {
parsedRecordPromises[key] = new PseudoPromise_1.PseudoPromise().then(function () {
try {
return def.valueType.parse(data[key], __assign(__assign({}, params), { path: __spread(params.path, [key]) }));
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
return util_1.INVALID;
}
throw err;
}
});
};
for (var key in data) {
_loop_3(key);
}
PROMISE = PseudoPromise_1.PseudoPromise.object(parsedRecordPromises);
break;
case z.ZodTypes.date:
if (!(data instanceof Date)) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.date,
received: parsedType,
}));
THROW();
}
if (isNaN(data.getTime())) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_date,
}));
THROW();
}
PROMISE = PseudoPromise_1.PseudoPromise.resolve(data);
break;
case z.ZodTypes.promise:
if (parsedType !== exports.ZodParsedType.promise && params.async !== true) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.invalid_type,
expected: exports.ZodParsedType.promise,
received: parsedType,
}));
THROW();
}
var promisified = parsedType === exports.ZodParsedType.promise ? data : Promise.resolve(data);
PROMISE = PseudoPromise_1.PseudoPromise.resolve(promisified.then(function (resolvedData) {
try {
var parsed = def.type.parse(resolvedData, params);
return parsed;
}
catch (err) {
if (err instanceof ZodError_1.ZodError) {
ERROR.addIssues(err.issues);
}
throw err;
}
}));
break;
case z.ZodTypes.transformer:
PROMISE = new PseudoPromise_1.PseudoPromise()
.then(function () {
return def.input.parse(data, params);
})
.catch(HANDLE)
.then(function (inputParseResult) {
var transformed = def.transformer(inputParseResult);
if (transformed instanceof Promise && params.async === false) {
if (z.inputSchema(def.output)._def.t !== z.ZodTypes.promise) {
throw new Error("You can't call .parse on a schema containing async transformations.");
}
}
return transformed;
})
.then(function (transformedResult) {
return def.output.parse(transformedResult, params);
})
.catch(HANDLE);
break;
default:
PROMISE = PseudoPromise_1.PseudoPromise.resolve('adsf');
util_1.util.assertNever(def);
}
if (PROMISE._default === true) {
throw new Error('Result is not materialized.');
}
if (!ERROR.isEmpty) {
THROW();
}
var customChecks = def.checks || [];
var checkCtx = {
addIssue: function (arg) {
ERROR.addIssue(makeError(params, data, arg));
},
path: params.path,
};
if (params.async === false) {
var resolvedValue = PROMISE.getValueSync();
try {
for (var customChecks_1 = __values(customChecks), customChecks_1_1 = customChecks_1.next(); !customChecks_1_1.done; customChecks_1_1 = customChecks_1.next()) {
var check = customChecks_1_1.value;
var checkResult = check.check(resolvedValue, checkCtx);
if (checkResult instanceof Promise)
throw new Error("You can't use .parse on a schema containing async refinements. Use .parseAsync instead.");
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (customChecks_1_1 && !customChecks_1_1.done && (_d = customChecks_1.return)) _d.call(customChecks_1);
}
finally { if (e_4) throw e_4.error; }
}
if (!ERROR.isEmpty) {
THROW();
}
return resolvedValue;
}
else {
var checker = function () { return __awaiter(void 0, void 0, void 0, function () {
var resolvedValue, someError_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, PROMISE.getValueAsync()];
case 1:
resolvedValue = _a.sent();
if (!(resolvedValue !== util_1.INVALID)) return [3, 6];
if (!params.runAsyncValidationsInSeries) return [3, 3];
someError_1 = false;
return [4, customChecks.reduce(function (previousPromise, check) {
return previousPromise.then(function () { return __awaiter(void 0, void 0, void 0, function () {
var len;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!!someError_1) return [3, 2];
len = ERROR.issues.length;
return [4, check.check(resolvedValue, checkCtx)];
case 1:
_a.sent();
if (len < ERROR.issues.length)
someError_1 = true;
_a.label = 2;
case 2: return [2];
}
});
}); });
}, Promise.resolve())];
case 2:
_a.sent();
return [3, 5];
case 3: return [4, Promise.all(customChecks.map(function (check) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, check.check(resolvedValue, checkCtx)];
case 1:
_a.sent();
return [2];
}
});
}); }))];
case 4:
_a.sent();
_a.label = 5;
case 5: return [3, 7];
case 6:
if (ERROR.isEmpty) {
ERROR.addIssue(makeError(params, data, {
code: ZodError_1.ZodIssueCode.custom,
message: 'Invalid',
}));
}
_a.label = 7;
case 7:
if (!ERROR.isEmpty) {
THROW();
}
return [2, resolvedValue];
}
});
}); };
return checker();
}
}; };
});
var base = createCommonjsModule(function (module, exports) {
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (commonjsGlobal && commonjsGlobal.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodType = exports.outputSchema = exports.inputSchema = exports.ZodTypes = void 0;
var ZodTypes;
(function (ZodTypes) {
ZodTypes["string"] = "string";
ZodTypes["number"] = "number";
ZodTypes["bigint"] = "bigint";
ZodTypes["boolean"] = "boolean";
ZodTypes["date"] = "date";
ZodTypes["undefined"] = "undefined";
ZodTypes["null"] = "null";
ZodTypes["array"] = "array";
ZodTypes["object"] = "object";
ZodTypes["union"] = "union";
ZodTypes["intersection"] = "intersection";
ZodTypes["tuple"] = "tuple";
ZodTypes["record"] = "record";
ZodTypes["map"] = "map";
ZodTypes["function"] = "function";
ZodTypes["lazy"] = "lazy";
ZodTypes["literal"] = "literal";
ZodTypes["enum"] = "enum";
ZodTypes["nativeEnum"] = "nativeEnum";
ZodTypes["promise"] = "promise";
ZodTypes["any"] = "any";
ZodTypes["unknown"] = "unknown";
ZodTypes["never"] = "never";
ZodTypes["void"] = "void";
ZodTypes["transformer"] = "transformer";
ZodTypes["optional"] = "optional";
ZodTypes["nullable"] = "nullable";
})(ZodTypes = exports.ZodTypes || (exports.ZodTypes = {}));
exports.inputSchema = function (schema) {
if (schema instanceof cjs.ZodTransformer) {
return exports.inputSchema(schema._def.input);
}
else {
return schema;
}
};
exports.outputSchema = function (schema) {
if (schema instanceof cjs.ZodTransformer) {
return exports.inputSchema(schema._def.output);
}
else {
return schema;
}
};
var ZodType = (function () {
function ZodType(def) {
var _this = this;
this.safeParse = function (data, params) {
try {
var parsed = _this.parse(data, params);
return { success: true, data: parsed };
}
catch (err) {
if (err instanceof cjs.ZodError) {
return { success: false, error: err };
}
throw err;
}
};
this.parseAsync = function (value, params) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, this.parse(value, __assign(__assign({}, params), { async: true }))];
case 1: return [2, _a.sent()];
}
});
}); };
this.safeParseAsync = function (data, params) { return __awaiter(_this, void 0, void 0, function () {
var parsed, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4, this.parseAsync(data, params)];
case 1:
parsed = _a.sent();
return [2, { success: true, data: parsed }];
case 2:
err_1 = _a.sent();
if (err_1 instanceof cjs.ZodError) {
return [2, { success: false, error: err_1 }];
}
throw err_1;
case 3: return [2];
}
});
}); };
this.spa = this.safeParseAsync;
this.refine = function (check, message) {
if (message === void 0) { message = 'Invalid value.'; }
if (typeof message === 'string') {
return _this._refinement(function (val, ctx) {
var result = check(val);
var setError = function () {
return ctx.addIssue({
code: cjs.ZodIssueCode.custom,
message: message,
});
};
if (result instanceof Promise) {
return result.then(function (data) {
if (!data)
setError();
});
}
if (!result) {
setError();
return result;
}
});
}
if (typeof message === 'function') {
return _this._refinement(function (val, ctx) {
var result = check(val);
var setError = function () {
return ctx.addIssue(__assign({ code: cjs.ZodIssueCode.custom }, message(val)));
};
if (result instanceof Promise) {
return result.then(function (data) {
if (!data)
setError();
});
}
if (!result) {
setError();
return result;
}
});
}
return _this._refinement(function (val, ctx) {
var result = check(val);
var setError = function () {
return ctx.addIssue(__assign({ code: cjs.ZodIssueCode.custom }, message));
};
if (result instanceof Promise) {
return result.then(function (data) {
if (!data)
setError();
});
}
if (!result) {
setError();
return result;
}
});
};
this.refinement = function (check, refinementData) {
return _this._refinement(function (val, ctx) {
if (!check(val)) {
ctx.addIssue(typeof refinementData === 'function'
? refinementData(val, ctx)
: refinementData);
}
});
};
this._refinement = function (refinement) {
return new _this.constructor(__assign(__assign({}, _this._def), { checks: __spread((_this._def.checks || []), [{ check: refinement }]) }));
};
this.optional = function () { return cjs.ZodOptional.create(_this); };
this.or = this.optional;
this.nullable = function () {
return cjs.ZodNullable.create(_this);
};
this.array = function () { return cjs.ZodArray.create(_this); };
this.isOptional = function () { return _this.safeParse(undefined).success; };
this.isNullable = function () { return _this.safeParse(null).success; };
this._def = def;
this.parse = parser.ZodParser(this);
}
ZodType.prototype.is = function (u) {
try {
this.parse(u);
return true;
}
catch (err) {
return false;
}
};
ZodType.prototype.check = function (u) {
try {
this.parse(u);
return true;
}
catch (err) {
return false;
}
};
ZodType.prototype.transform = function (input, transformer) {
if (transformer) {
return cjs.ZodTransformer.create(this, input, transformer);
}
return cjs.ZodTransformer.create(this, exports.outputSchema(this), input);
};
ZodType.prototype.default = function (def) {
var _this = this;
return cjs.ZodTransformer.create(this.optional(), this, function (x) {
return x === undefined
? typeof def === 'function'
? def(_this)
: def
: x;
});
};
return ZodType;
}());
exports.ZodType = ZodType;
});
var errorUtil_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.errorUtil = void 0;
var errorUtil;
(function (errorUtil) {
errorUtil.errToObj = function (message) { return (typeof message === 'string' ? { message: message } : message || {}); };
})(errorUtil = exports.errorUtil || (exports.errorUtil = {}));
});
var string = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodString = void 0;
var z = __importStar(base);
var emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
var uuidRegex = /([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}){1}/i;
var ZodString = (function (_super) {
__extends(ZodString, _super);
function ZodString() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.inputSchema = _this;
_this.outputSchema = _this;
_this.toJSON = function () { return _this._def; };
_this.min = function (minLength, message) {
return _this.refinement(function (data) { return data.length >= minLength; }, __assign({ code: ZodError_1.ZodIssueCode.too_small, minimum: minLength, type: 'string', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.max = function (maxLength, message) {
return _this.refinement(function (data) { return data.length <= maxLength; }, __assign({ code: ZodError_1.ZodIssueCode.too_big, maximum: maxLength, type: 'string', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this._regex = function (regex, validation, message) {
return _this.refinement(function (data) { return regex.test(data); }, __assign({ validation: validation, code: ZodError_1.ZodIssueCode.invalid_string }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.email = function (message) {
return _this._regex(emailRegex, 'email', message);
};
_this.url = function (message) {
return _this.refinement(function (data) {
try {
new URL(data);
return true;
}
catch (_a) {
return false;
}
}, __assign({ code: ZodError_1.ZodIssueCode.invalid_string, validation: 'url' }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.uuid = function (message) {
return _this._regex(uuidRegex, 'uuid', message);
};
_this.regex = function (regexp, message) {
return _this._regex(regexp, 'regex', message);
};
_this.nonempty = function (message) {
return _this.min(1, errorUtil_1.errorUtil.errToObj(message));
};
return _this;
}
ZodString.prototype.length = function (len, message) {
return this.min(len, message).max(len, message);
};
ZodString.create = function () {
return new ZodString({
t: z.ZodTypes.string,
validation: {},
});
};
return ZodString;
}(z.ZodType));
exports.ZodString = ZodString;
});
var number = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodNumber = void 0;
var z = __importStar(base);
var ZodNumber = (function (_super) {
__extends(ZodNumber, _super);
function ZodNumber() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
_this.min = function (minimum, message) {
return _this.refinement(function (data) { return data >= minimum; }, __assign({ code: ZodError_1.ZodIssueCode.too_small, minimum: minimum, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.max = function (maximum, message) {
return _this.refinement(function (data) { return data <= maximum; }, __assign({ code: ZodError_1.ZodIssueCode.too_big, maximum: maximum, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.int = function (message) {
return _this.refinement(function (data) { return Number.isInteger(data); }, __assign({ code: ZodError_1.ZodIssueCode.invalid_type, expected: 'integer', received: 'number' }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.positive = function (message) {
return _this.refinement(function (data) { return data > 0; }, __assign({ code: ZodError_1.ZodIssueCode.too_small, minimum: 0, type: 'number', inclusive: false }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.negative = function (message) {
return _this.refinement(function (data) { return data < 0; }, __assign({ code: ZodError_1.ZodIssueCode.too_big, maximum: 0, type: 'number', inclusive: false }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.nonpositive = function (message) {
return _this.refinement(function (data) { return data <= 0; }, __assign({ code: ZodError_1.ZodIssueCode.too_big, maximum: 0, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.nonnegative = function (message) {
return _this.refinement(function (data) { return data >= 0; }, __assign({ code: ZodError_1.ZodIssueCode.too_small, minimum: 0, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
return _this;
}
ZodNumber.create = function () {
return new ZodNumber({
t: z.ZodTypes.number,
});
};
return ZodNumber;
}(z.ZodType));
exports.ZodNumber = ZodNumber;
});
var bigint = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodBigInt = void 0;
var z = __importStar(base);
var ZodBigInt = (function (_super) {
__extends(ZodBigInt, _super);
function ZodBigInt() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodBigInt.create = function () {
return new ZodBigInt({
t: z.ZodTypes.bigint,
});
};
return ZodBigInt;
}(z.ZodType));
exports.ZodBigInt = ZodBigInt;
});
var boolean_1 = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodBoolean = void 0;
var z = __importStar(base);
var ZodBoolean = (function (_super) {
__extends(ZodBoolean, _super);
function ZodBoolean() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodBoolean.create = function () {
return new ZodBoolean({
t: z.ZodTypes.boolean,
});
};
return ZodBoolean;
}(z.ZodType));
exports.ZodBoolean = ZodBoolean;
});
var date = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodDate = void 0;
var z = __importStar(base);
var ZodDate = (function (_super) {
__extends(ZodDate, _super);
function ZodDate() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodDate.create = function () {
return new ZodDate({
t: z.ZodTypes.date,
});
};
return ZodDate;
}(z.ZodType));
exports.ZodDate = ZodDate;
});
var _undefined = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodUndefined = void 0;
var z = __importStar(base);
var ZodUndefined = (function (_super) {
__extends(ZodUndefined, _super);
function ZodUndefined() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodUndefined.create = function () {
return new ZodUndefined({
t: z.ZodTypes.undefined,
});
};
return ZodUndefined;
}(z.ZodType));
exports.ZodUndefined = ZodUndefined;
});
var _null = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodNull = void 0;
var z = __importStar(base);
var ZodNull = (function (_super) {
__extends(ZodNull, _super);
function ZodNull() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodNull.create = function () {
return new ZodNull({
t: z.ZodTypes.null,
});
};
return ZodNull;
}(z.ZodType));
exports.ZodNull = ZodNull;
});
var any = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodAny = void 0;
var z = __importStar(base);
var ZodAny = (function (_super) {
__extends(ZodAny, _super);
function ZodAny() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodAny.create = function () {
return new ZodAny({
t: z.ZodTypes.any,
});
};
return ZodAny;
}(z.ZodType));
exports.ZodAny = ZodAny;
});
var unknown = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodUnknown = void 0;
var z = __importStar(base);
var ZodUnknown = (function (_super) {
__extends(ZodUnknown, _super);
function ZodUnknown() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodUnknown.create = function () {
return new ZodUnknown({
t: z.ZodTypes.unknown,
});
};
return ZodUnknown;
}(z.ZodType));
exports.ZodUnknown = ZodUnknown;
});
var never = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodNever = void 0;
var z = __importStar(base);
var ZodNever = (function (_super) {
__extends(ZodNever, _super);
function ZodNever() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodNever.create = function () {
return new ZodNever({
t: z.ZodTypes.never,
});
};
return ZodNever;
}(z.ZodType));
exports.ZodNever = ZodNever;
});
var _void = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodVoid = void 0;
var z = __importStar(base);
var ZodVoid = (function (_super) {
__extends(ZodVoid, _super);
function ZodVoid() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodVoid.create = function () {
return new ZodVoid({
t: z.ZodTypes.void,
});
};
return ZodVoid;
}(z.ZodType));
exports.ZodVoid = ZodVoid;
});
var array = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodNonEmptyArray = exports.ZodArray = void 0;
var z = __importStar(base);
var ZodArray = (function (_super) {
__extends(ZodArray, _super);
function ZodArray() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () {
return {
t: _this._def.t,
nonempty: _this._def.nonempty,
type: _this._def.type.toJSON(),
};
};
_this.min = function (minLength, message) {
return _this.refinement(function (data) { return data.length >= minLength; }, __assign({ code: ZodError_1.ZodIssueCode.too_small, type: 'array', inclusive: true, minimum: minLength }, (typeof message === 'string' ? { message: message } : message)));
};
_this.max = function (maxLength, message) {
return _this.refinement(function (data) { return data.length <= maxLength; }, __assign({ code: ZodError_1.ZodIssueCode.too_big, type: 'array', inclusive: true, maximum: maxLength }, (typeof message === 'string' ? { message: message } : message)));
};
_this.length = function (len, message) {
return _this.min(len, { message: message }).max(len, { message: message });
};
_this.nonempty = function () {
return new ZodNonEmptyArray(__assign(__assign({}, _this._def), { nonempty: true }));
};
return _this;
}
Object.defineProperty(ZodArray.prototype, "element", {
get: function () {
return this._def.type;
},
enumerable: false,
configurable: true
});
ZodArray.create = function (schema) {
return new ZodArray({
t: z.ZodTypes.array,
type: schema,
nonempty: false,
});
};
return ZodArray;
}(z.ZodType));
exports.ZodArray = ZodArray;
var ZodNonEmptyArray = (function (_super) {
__extends(ZodNonEmptyArray, _super);
function ZodNonEmptyArray() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () {
return {
t: _this._def.t,
type: _this._def.type.toJSON(),
};
};
_this.min = function (minLength, message) {
return _this.refinement(function (data) { return data.length >= minLength; }, __assign({ code: ZodError_1.ZodIssueCode.too_small, minimum: minLength, type: 'array', inclusive: true }, (typeof message === 'string' ? { message: message } : message)));
};
_this.max = function (maxLength, message) {
return _this.refinement(function (data) { return data.length <= maxLength; }, __assign({ code: ZodError_1.ZodIssueCode.too_big, maximum: maxLength, type: 'array', inclusive: true }, (typeof message === 'string' ? { message: message } : message)));
};
_this.length = function (len, message) {
return _this.min(len, { message: message }).max(len, { message: message });
};
return _this;
}
return ZodNonEmptyArray;
}(z.ZodType));
exports.ZodNonEmptyArray = ZodNonEmptyArray;
});
var intersection = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodIntersection = void 0;
var z = __importStar(base);
var ZodIntersection = (function (_super) {
__extends(ZodIntersection, _super);
function ZodIntersection() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
left: _this._def.left.toJSON(),
right: _this._def.right.toJSON(),
}); };
return _this;
}
ZodIntersection.create = function (left, right) {
return new ZodIntersection({
t: z.ZodTypes.intersection,
left: left,
right: right,
});
};
return ZodIntersection;
}(z.ZodType));
exports.ZodIntersection = ZodIntersection;
});
var objectUtil_1 = createCommonjsModule(function (module, exports) {
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (commonjsGlobal && commonjsGlobal.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectUtil = void 0;
var objectUtil;
(function (objectUtil) {
objectUtil.mergeShapes = function (first, second) {
var e_1, _a;
var firstKeys = Object.keys(first);
var secondKeys = Object.keys(second);
var sharedKeys = firstKeys.filter(function (k) { return secondKeys.indexOf(k) !== -1; });
var sharedShape = {};
try {
for (var sharedKeys_1 = __values(sharedKeys), sharedKeys_1_1 = sharedKeys_1.next(); !sharedKeys_1_1.done; sharedKeys_1_1 = sharedKeys_1.next()) {
var k = sharedKeys_1_1.value;
sharedShape[k] = intersection.ZodIntersection.create(first[k], second[k]);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (sharedKeys_1_1 && !sharedKeys_1_1.done && (_a = sharedKeys_1.return)) _a.call(sharedKeys_1);
}
finally { if (e_1) throw e_1.error; }
}
return __assign(__assign(__assign({}, first), second), sharedShape);
};
objectUtil.mergeObjects = function (first) { return function (second) {
var mergedShape = objectUtil.mergeShapes(first._def.shape(), second._def.shape());
var merged = new object.ZodObject({
t: base.ZodTypes.object,
checks: __spread((first._def.checks || []), (second._def.checks || [])),
unknownKeys: first._def.unknownKeys,
catchall: first._def.catchall,
shape: function () { return mergedShape; },
});
return merged;
}; };
})(objectUtil = exports.objectUtil || (exports.objectUtil = {}));
});
var isScalar = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.isScalar = void 0;
exports.isScalar = function (schema, params) {
if (params === void 0) { params = { root: true }; }
var def = schema._def;
var returnValue = false;
switch (def.t) {
case base.ZodTypes.string:
returnValue = true;
break;
case base.ZodTypes.number:
returnValue = true;
break;
case base.ZodTypes.bigint:
returnValue = true;
break;
case base.ZodTypes.boolean:
returnValue = true;
break;
case base.ZodTypes.undefined:
returnValue = true;
break;
case base.ZodTypes.null:
returnValue = true;
break;
case base.ZodTypes.any:
returnValue = false;
break;
case base.ZodTypes.unknown:
returnValue = false;
break;
case base.ZodTypes.never:
returnValue = false;
break;
case base.ZodTypes.void:
returnValue = false;
break;
case base.ZodTypes.array:
if (params.root === false)
return false;
returnValue = exports.isScalar(def.type, { root: false });
break;
case base.ZodTypes.object:
returnValue = false;
break;
case base.ZodTypes.union:
returnValue = def.options.every(function (x) { return exports.isScalar(x); });
break;
case base.ZodTypes.intersection:
returnValue = exports.isScalar(def.left) && exports.isScalar(def.right);
break;
case base.ZodTypes.tuple:
returnValue = def.items.every(function (x) { return exports.isScalar(x, { root: false }); });
break;
case base.ZodTypes.lazy:
returnValue = exports.isScalar(def.getter());
break;
case base.ZodTypes.literal:
returnValue = true;
break;
case base.ZodTypes.enum:
returnValue = true;
break;
case base.ZodTypes.nativeEnum:
returnValue = true;
break;
case base.ZodTypes.function:
returnValue = false;
break;
case base.ZodTypes.record:
returnValue = false;
break;
case base.ZodTypes.map:
returnValue = false;
break;
case base.ZodTypes.date:
returnValue = true;
break;
case base.ZodTypes.promise:
returnValue = false;
break;
case base.ZodTypes.transformer:
returnValue = exports.isScalar(def.output);
break;
case base.ZodTypes.optional:
returnValue = exports.isScalar(def.innerType);
break;
case base.ZodTypes.nullable:
returnValue = exports.isScalar(def.innerType);
break;
default:
util_1.util.assertNever(def);
}
return returnValue;
};
});
var object = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (commonjsGlobal && commonjsGlobal.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodObject = void 0;
var z = __importStar(base);
var AugmentFactory = function (def) { return function (augmentation) {
return new ZodObject(__assign(__assign({}, def), { shape: function () { return (__assign(__assign({}, def.shape()), augmentation)); } }));
}; };
var objectDefToJson = function (def) { return ({
t: def.t,
shape: Object.assign.apply(Object, __spread([{}], Object.keys(def.shape()).map(function (k) {
var _a;
return (_a = {},
_a[k] = def.shape()[k].toJSON(),
_a);
}))),
}); };
var ZodObject = (function (_super) {
__extends(ZodObject, _super);
function ZodObject() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return objectDefToJson(_this._def); };
_this.strict = function () {
return new ZodObject(__assign(__assign({}, _this._def), { unknownKeys: 'strict' }));
};
_this.strip = function () {
return new ZodObject(__assign(__assign({}, _this._def), { unknownKeys: 'strip' }));
};
_this.passthrough = function () {
return new ZodObject(__assign(__assign({}, _this._def), { unknownKeys: 'passthrough' }));
};
_this.nonstrict = _this.passthrough;
_this.augment = AugmentFactory(_this._def);
_this.extend = AugmentFactory(_this._def);
_this.setKey = function (key, schema) {
var _a;
return _this.augment((_a = {}, _a[key] = schema, _a));
};
_this.merge = objectUtil_1.objectUtil.mergeObjects(_this);
_this.catchall = function (index) {
return new ZodObject(__assign(__assign({}, _this._def), { catchall: index }));
};
_this.pick = function (mask) {
var shape = {};
Object.keys(mask).map(function (key) {
shape[key] = _this.shape[key];
});
return new ZodObject(__assign(__assign({}, _this._def), { shape: function () { return shape; } }));
};
_this.omit = function (mask) {
var shape = {};
Object.keys(_this.shape).map(function (key) {
if (Object.keys(mask).indexOf(key) === -1) {
shape[key] = _this.shape[key];
}
});
return new ZodObject(__assign(__assign({}, _this._def), { shape: function () { return shape; } }));
};
_this.partial = function () {
var newShape = {};
for (var key in _this.shape) {
var fieldSchema = _this.shape[key];
newShape[key] = fieldSchema.isOptional()
? fieldSchema
: fieldSchema.optional();
}
return new ZodObject(__assign(__assign({}, _this._def), { shape: function () { return newShape; } }));
};
_this.primitives = function () {
var newShape = {};
for (var key in _this.shape) {
if (isScalar.isScalar(_this.shape[key])) {
newShape[key] = _this.shape[key];
}
}
return new ZodObject(__assign(__assign({}, _this._def), { shape: function () { return newShape; } }));
};
_this.nonprimitives = function () {
var newShape = {};
for (var key in _this.shape) {
if (!isScalar.isScalar(_this.shape[key])) {
newShape[key] = _this.shape[key];
}
}
return new ZodObject(__assign(__assign({}, _this._def), { shape: function () { return newShape; } }));
};
_this.deepPartial = function () {
var newShape = {};
for (var key in _this.shape) {
var fieldSchema = _this.shape[key];
if (fieldSchema instanceof ZodObject) {
newShape[key] = fieldSchema.isOptional()
? fieldSchema
: fieldSchema.deepPartial().optional();
}
else {
newShape[key] = fieldSchema.isOptional()
? fieldSchema
: fieldSchema.optional();
}
}
return new ZodObject(__assign(__assign({}, _this._def), { shape: function () { return newShape; } }));
};
return _this;
}
Object.defineProperty(ZodObject.prototype, "shape", {
get: function () {
return this._def.shape();
},
enumerable: false,
configurable: true
});
ZodObject.create = function (shape) {
return new ZodObject({
t: z.ZodTypes.object,
shape: function () { return shape; },
unknownKeys: 'strip',
catchall: cjs.ZodNever.create(),
});
};
ZodObject.lazycreate = function (shape) {
return new ZodObject({
t: z.ZodTypes.object,
shape: shape,
unknownKeys: 'strip',
catchall: cjs.ZodNever.create(),
});
};
return ZodObject;
}(z.ZodType));
exports.ZodObject = ZodObject;
});
var union = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodUnion = void 0;
var z = __importStar(base);
var ZodUnion = (function (_super) {
__extends(ZodUnion, _super);
function ZodUnion() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
options: _this._def.options.map(function (x) { return x.toJSON(); }),
}); };
return _this;
}
Object.defineProperty(ZodUnion.prototype, "options", {
get: function () {
return this._def.options;
},
enumerable: false,
configurable: true
});
ZodUnion.create = function (types) {
return new ZodUnion({
t: z.ZodTypes.union,
options: types,
});
};
return ZodUnion;
}(z.ZodType));
exports.ZodUnion = ZodUnion;
});
var tuple = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodTuple = void 0;
var z = __importStar(base);
var ZodTuple = (function (_super) {
__extends(ZodTuple, _super);
function ZodTuple() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
items: _this._def.items.map(function (item) { return item.toJSON(); }),
}); };
return _this;
}
Object.defineProperty(ZodTuple.prototype, "items", {
get: function () {
return this._def.items;
},
enumerable: false,
configurable: true
});
ZodTuple.create = function (schemas) {
return new ZodTuple({
t: z.ZodTypes.tuple,
items: schemas,
});
};
return ZodTuple;
}(z.ZodType));
exports.ZodTuple = ZodTuple;
});
var record = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodRecord = void 0;
var z = __importStar(base);
var ZodRecord = (function (_super) {
__extends(ZodRecord, _super);
function ZodRecord() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
valueType: _this._def.valueType.toJSON(),
}); };
return _this;
}
ZodRecord.create = function (valueType) {
return new ZodRecord({
t: z.ZodTypes.record,
valueType: valueType,
});
};
return ZodRecord;
}(z.ZodType));
exports.ZodRecord = ZodRecord;
});
var map = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodMap = void 0;
var z = __importStar(base);
var ZodMap = (function (_super) {
__extends(ZodMap, _super);
function ZodMap() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
valueType: _this._def.valueType.toJSON(),
keyType: _this._def.keyType.toJSON(),
}); };
return _this;
}
ZodMap.create = function (keyType, valueType) {
return new ZodMap({
t: z.ZodTypes.map,
valueType: valueType,
keyType: keyType,
});
};
return ZodMap;
}(z.ZodType));
exports.ZodMap = ZodMap;
});
var _function = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodFunction = void 0;
var z = __importStar(base);
var ZodFunction = (function (_super) {
__extends(ZodFunction, _super);
function ZodFunction() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.args = function () {
var items = [];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i] = arguments[_i];
}
return new ZodFunction(__assign(__assign({}, _this._def), { args: tuple.ZodTuple.create(items) }));
};
_this.returns = function (returnType) {
return new ZodFunction(__assign(__assign({}, _this._def), { returns: returnType }));
};
_this.implement = function (func) {
var validatedFunc = _this.parse(func);
return validatedFunc;
};
_this.validate = _this.implement;
_this.toJSON = function () {
return {
t: _this._def.t,
args: _this._def.args.toJSON(),
returns: _this._def.returns.toJSON(),
};
};
return _this;
}
ZodFunction.create = function (args, returns) {
return new ZodFunction({
t: z.ZodTypes.function,
args: args || tuple.ZodTuple.create([]),
returns: returns || unknown.ZodUnknown.create(),
});
};
return ZodFunction;
}(z.ZodType));
exports.ZodFunction = ZodFunction;
});
var lazy = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodLazy = void 0;
var z = __importStar(base);
var ZodLazy = (function (_super) {
__extends(ZodLazy, _super);
function ZodLazy() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () {
throw new Error("Can't JSONify recursive structure");
};
return _this;
}
Object.defineProperty(ZodLazy.prototype, "schema", {
get: function () {
return this._def.getter();
},
enumerable: false,
configurable: true
});
ZodLazy.create = function (getter) {
return new ZodLazy({
t: z.ZodTypes.lazy,
getter: getter,
});
};
return ZodLazy;
}(z.ZodType));
exports.ZodLazy = ZodLazy;
});
var literal = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodLiteral = void 0;
var z = __importStar(base);
var ZodLiteral = (function (_super) {
__extends(ZodLiteral, _super);
function ZodLiteral() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodLiteral.create = function (value) {
return new ZodLiteral({
t: z.ZodTypes.literal,
value: value,
});
};
return ZodLiteral;
}(z.ZodType));
exports.ZodLiteral = ZodLiteral;
});
var _enum = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodEnum = void 0;
var z = __importStar(base);
var ZodEnum = (function (_super) {
__extends(ZodEnum, _super);
function ZodEnum() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
Object.defineProperty(ZodEnum.prototype, "options", {
get: function () {
return this._def.values;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ZodEnum.prototype, "enum", {
get: function () {
var e_1, _a;
var enumValues = {};
try {
for (var _b = __values(this._def.values), _c = _b.next(); !_c.done; _c = _b.next()) {
var val = _c.value;
enumValues[val] = val;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return enumValues;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ZodEnum.prototype, "Values", {
get: function () {
var e_2, _a;
var enumValues = {};
try {
for (var _b = __values(this._def.values), _c = _b.next(); !_c.done; _c = _b.next()) {
var val = _c.value;
enumValues[val] = val;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
return enumValues;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ZodEnum.prototype, "Enum", {
get: function () {
var e_3, _a;
var enumValues = {};
try {
for (var _b = __values(this._def.values), _c = _b.next(); !_c.done; _c = _b.next()) {
var val = _c.value;
enumValues[val] = val;
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
return enumValues;
},
enumerable: false,
configurable: true
});
ZodEnum.create = function (values) {
return new ZodEnum({
t: z.ZodTypes.enum,
values: values,
});
};
return ZodEnum;
}(z.ZodType));
exports.ZodEnum = ZodEnum;
});
var nativeEnum = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodNativeEnum = void 0;
var z = __importStar(base);
var ZodNativeEnum = (function (_super) {
__extends(ZodNativeEnum, _super);
function ZodNativeEnum() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return _this._def; };
return _this;
}
ZodNativeEnum.create = function (values) {
return new ZodNativeEnum({
t: z.ZodTypes.nativeEnum,
values: values,
});
};
return ZodNativeEnum;
}(z.ZodType));
exports.ZodNativeEnum = ZodNativeEnum;
});
var promise = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodPromise = void 0;
var z = __importStar(base);
var ZodPromise = (function (_super) {
__extends(ZodPromise, _super);
function ZodPromise() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () {
return {
t: _this._def.t,
type: _this._def.type.toJSON(),
};
};
return _this;
}
ZodPromise.create = function (schema) {
return new ZodPromise({
t: z.ZodTypes.promise,
type: schema,
});
};
return ZodPromise;
}(z.ZodType));
exports.ZodPromise = ZodPromise;
});
var transformer = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodTransformer = void 0;
var z = __importStar(base);
var ZodTransformer = (function (_super) {
__extends(ZodTransformer, _super);
function ZodTransformer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
left: _this._def.input.toJSON(),
right: _this._def.output.toJSON(),
}); };
return _this;
}
Object.defineProperty(ZodTransformer.prototype, "output", {
get: function () {
return this._def.output;
},
enumerable: false,
configurable: true
});
ZodTransformer.create = function (input, output, transformer) {
return new ZodTransformer({
t: z.ZodTypes.transformer,
input: input,
output: output,
transformer: transformer,
});
};
ZodTransformer.fromSchema = function (input) {
return new ZodTransformer({
t: z.ZodTypes.transformer,
input: input,
output: input,
transformer: function (x) { return x; },
});
};
return ZodTransformer;
}(z.ZodType));
exports.ZodTransformer = ZodTransformer;
});
var optional = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodOptional = void 0;
var ZodOptional = (function (_super) {
__extends(ZodOptional, _super);
function ZodOptional() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
innerType: _this._def.innerType.toJSON(),
}); };
return _this;
}
ZodOptional.create = function (type) {
if (type instanceof ZodOptional)
return type;
return new ZodOptional({
t: base.ZodTypes.optional,
innerType: type,
});
};
return ZodOptional;
}(base.ZodType));
exports.ZodOptional = ZodOptional;
});
var nullable = createCommonjsModule(function (module, exports) {
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodNullable = void 0;
var z = __importStar(base);
var ZodNullable = (function (_super) {
__extends(ZodNullable, _super);
function ZodNullable() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.toJSON = function () { return ({
t: _this._def.t,
innerType: _this._def.innerType.toJSON(),
}); };
return _this;
}
ZodNullable.create = function (type) {
if (type instanceof ZodNullable)
return type;
return new ZodNullable({
t: z.ZodTypes.nullable,
innerType: type,
});
};
return ZodNullable;
}(z.ZodType));
exports.ZodNullable = ZodNullable;
});
var codegen = createCommonjsModule(function (module, exports) {
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodCodeGenerator = void 0;
var isOptional = function (schema) {
return schema.isOptional();
};
var ZodCodeGenerator = (function () {
function ZodCodeGenerator() {
var _this = this;
this.seen = [];
this.serial = 0;
this.randomId = function () {
return "IZod" + _this.serial++;
};
this.findBySchema = function (schema) {
return _this.seen.find(function (s) { return s.schema === schema; });
};
this.findById = function (id) {
var found = _this.seen.find(function (s) { return s.id === id; });
if (!found)
throw new Error("Unfound ID: " + id);
return found;
};
this.dump = function () {
return "\ntype Identity<T> = T;\n\n" + _this.seen
.map(function (item) { return "type " + item.id + " = Identity<" + item.type + ">;"; })
.join('\n\n') + "\n";
};
this.setType = function (id, type) {
var found = _this.findById(id);
found.type = type;
return found;
};
this.generate = function (schema) {
var e_1, _a, e_2, _b;
var found = _this.findBySchema(schema);
if (found)
return found;
var def = schema._def;
var id = _this.randomId();
var ty = {
schema: schema,
id: id,
type: "__INCOMPLETE__",
};
_this.seen.push(ty);
switch (def.t) {
case base.ZodTypes.string:
return _this.setType(id, "string");
case base.ZodTypes.number:
return _this.setType(id, "number");
case base.ZodTypes.bigint:
return _this.setType(id, "bigint");
case base.ZodTypes.boolean:
return _this.setType(id, "boolean");
case base.ZodTypes.date:
return _this.setType(id, "Date");
case base.ZodTypes.undefined:
return _this.setType(id, "undefined");
case base.ZodTypes.null:
return _this.setType(id, "null");
case base.ZodTypes.any:
return _this.setType(id, "any");
case base.ZodTypes.unknown:
return _this.setType(id, "unknown");
case base.ZodTypes.never:
return _this.setType(id, "never");
case base.ZodTypes.void:
return _this.setType(id, "void");
case base.ZodTypes.literal:
var val = def.value;
var literalType = typeof val === 'string' ? "\"" + val + "\"" : "" + val;
return _this.setType(id, literalType);
case base.ZodTypes.enum:
return _this.setType(id, def.values.map(function (v) { return "\"" + v + "\""; }).join(' | '));
case base.ZodTypes.object:
var objectLines = [];
var shape = def.shape();
for (var key in shape) {
var childSchema = shape[key];
var childType = _this.generate(childSchema);
var OPTKEY = isOptional(childSchema) ? '?' : '';
objectLines.push("" + key + OPTKEY + ": " + childType.id);
}
var baseStruct = "{\n" + objectLines
.map(function (line) { return " " + line + ";"; })
.join('\n') + "\n}";
_this.setType(id, "" + baseStruct);
break;
case base.ZodTypes.tuple:
var tupleLines = [];
try {
for (var _c = __values(def.items), _d = _c.next(); !_d.done; _d = _c.next()) {
var elSchema = _d.value;
var elType = _this.generate(elSchema);
tupleLines.push(elType.id);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
var baseTuple = "[\n" + tupleLines
.map(function (line) { return " " + line + ","; })
.join('\n') + "\n]";
return _this.setType(id, "" + baseTuple);
case base.ZodTypes.array:
return _this.setType(id, _this.generate(def.type).id + "[]");
case base.ZodTypes.function:
var args = _this.generate(def.args);
var returns = _this.generate(def.returns);
return _this.setType(id, "(...args: " + args.id + ")=>" + returns.id);
case base.ZodTypes.promise:
var promValue = _this.generate(def.type);
return _this.setType(id, "Promise<" + promValue.id + ">");
case base.ZodTypes.union:
var unionLines = [];
try {
for (var _e = __values(def.options), _f = _e.next(); !_f.done; _f = _e.next()) {
var elSchema = _f.value;
var elType = _this.generate(elSchema);
unionLines.push(elType.id);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
return _this.setType(id, unionLines.join(" | "));
case base.ZodTypes.intersection:
return _this.setType(id, _this.generate(def.left).id + " & " + _this.generate(def.right).id);
case base.ZodTypes.record:
return _this.setType(id, "{[k:string]: " + _this.generate(def.valueType).id + "}");
case base.ZodTypes.transformer:
return _this.setType(id, _this.generate(def.output).id);
case base.ZodTypes.map:
return _this.setType(id, "Map<" + _this.generate(def.keyType).id + ", " + _this.generate(def.valueType).id + ">");
case base.ZodTypes.lazy:
var lazyType = def.getter();
return _this.setType(id, _this.generate(lazyType).id);
case base.ZodTypes.nativeEnum:
return _this.setType(id, 'asdf');
case base.ZodTypes.optional:
return _this.setType(id, _this.generate(def.innerType).id + " | undefined");
case base.ZodTypes.nullable:
return _this.setType(id, _this.generate(def.innerType).id + " | null");
default:
util_1.util.assertNever(def);
}
return _this.findById(id);
};
}
ZodCodeGenerator.create = function () { return new ZodCodeGenerator(); };
return ZodCodeGenerator;
}());
exports.ZodCodeGenerator = ZodCodeGenerator;
});
var cjs = createCommonjsModule(function (module, exports) {
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodCodeGenerator = exports.ZodParsedType = exports.ZodSchema = exports.Schema = exports.ZodType = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.late = exports.codegen = exports.oboolean = exports.onumber = exports.ostring = exports.nullable = exports.optional = exports.transformer = exports.instanceof = exports.promise = exports.nativeEnum = exports.enum = exports.literal = exports.lazy = exports.function = exports.map = exports.record = exports.tuple = exports.intersection = exports.union = exports.object = exports.array = exports.void = exports.never = exports.unknown = exports.any = exports.null = exports.undefined = exports.date = exports.boolean = exports.bigint = exports.number = exports.string = exports.custom = exports.ZodTypes = void 0;
Object.defineProperty(exports, "ZodString", { enumerable: true, get: function () { return string.ZodString; } });
Object.defineProperty(exports, "ZodNumber", { enumerable: true, get: function () { return number.ZodNumber; } });
Object.defineProperty(exports, "ZodBigInt", { enumerable: true, get: function () { return bigint.ZodBigInt; } });
Object.defineProperty(exports, "ZodBoolean", { enumerable: true, get: function () { return boolean_1.ZodBoolean; } });
Object.defineProperty(exports, "ZodDate", { enumerable: true, get: function () { return date.ZodDate; } });
Object.defineProperty(exports, "ZodUndefined", { enumerable: true, get: function () { return _undefined.ZodUndefined; } });
Object.defineProperty(exports, "ZodNull", { enumerable: true, get: function () { return _null.ZodNull; } });
Object.defineProperty(exports, "ZodAny", { enumerable: true, get: function () { return any.ZodAny; } });
Object.defineProperty(exports, "ZodUnknown", { enumerable: true, get: function () { return unknown.ZodUnknown; } });
Object.defineProperty(exports, "ZodNever", { enumerable: true, get: function () { return never.ZodNever; } });
Object.defineProperty(exports, "ZodVoid", { enumerable: true, get: function () { return _void.ZodVoid; } });
Object.defineProperty(exports, "ZodArray", { enumerable: true, get: function () { return array.ZodArray; } });
Object.defineProperty(exports, "ZodObject", { enumerable: true, get: function () { return object.ZodObject; } });
Object.defineProperty(exports, "ZodUnion", { enumerable: true, get: function () { return union.ZodUnion; } });
Object.defineProperty(exports, "ZodIntersection", { enumerable: true, get: function () { return intersection.ZodIntersection; } });
Object.defineProperty(exports, "ZodTuple", { enumerable: true, get: function () { return tuple.ZodTuple; } });
Object.defineProperty(exports, "ZodRecord", { enumerable: true, get: function () { return record.ZodRecord; } });
Object.defineProperty(exports, "ZodFunction", { enumerable: true, get: function () { return _function.ZodFunction; } });
Object.defineProperty(exports, "ZodLazy", { enumerable: true, get: function () { return lazy.ZodLazy; } });
Object.defineProperty(exports, "ZodLiteral", { enumerable: true, get: function () { return literal.ZodLiteral; } });
Object.defineProperty(exports, "ZodEnum", { enumerable: true, get: function () { return _enum.ZodEnum; } });
Object.defineProperty(exports, "ZodNativeEnum", { enumerable: true, get: function () { return nativeEnum.ZodNativeEnum; } });
Object.defineProperty(exports, "ZodPromise", { enumerable: true, get: function () { return promise.ZodPromise; } });
Object.defineProperty(exports, "ZodTransformer", { enumerable: true, get: function () { return transformer.ZodTransformer; } });
Object.defineProperty(exports, "ZodOptional", { enumerable: true, get: function () { return optional.ZodOptional; } });
Object.defineProperty(exports, "ZodNullable", { enumerable: true, get: function () { return nullable.ZodNullable; } });
Object.defineProperty(exports, "ZodType", { enumerable: true, get: function () { return base.ZodType; } });
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return base.ZodType; } });
Object.defineProperty(exports, "ZodSchema", { enumerable: true, get: function () { return base.ZodType; } });
Object.defineProperty(exports, "ZodTypes", { enumerable: true, get: function () { return base.ZodTypes; } });
Object.defineProperty(exports, "ZodParsedType", { enumerable: true, get: function () { return parser.ZodParsedType; } });
Object.defineProperty(exports, "ZodCodeGenerator", { enumerable: true, get: function () { return codegen.ZodCodeGenerator; } });
var stringType = string.ZodString.create;
exports.string = stringType;
var numberType = number.ZodNumber.create;
exports.number = numberType;
var bigIntType = bigint.ZodBigInt.create;
exports.bigint = bigIntType;
var booleanType = boolean_1.ZodBoolean.create;
exports.boolean = booleanType;
var dateType = date.ZodDate.create;
exports.date = dateType;
var undefinedType = _undefined.ZodUndefined.create;
exports.undefined = undefinedType;
var nullType = _null.ZodNull.create;
exports.null = nullType;
var anyType = any.ZodAny.create;
exports.any = anyType;
var unknownType = unknown.ZodUnknown.create;
exports.unknown = unknownType;
var neverType = never.ZodNever.create;
exports.never = neverType;
var voidType = _void.ZodVoid.create;
exports.void = voidType;
var arrayType = array.ZodArray.create;
exports.array = arrayType;
var objectType = object.ZodObject.create;
exports.object = objectType;
var unionType = union.ZodUnion.create;
exports.union = unionType;
var intersectionType = intersection.ZodIntersection.create;
exports.intersection = intersectionType;
var tupleType = tuple.ZodTuple.create;
exports.tuple = tupleType;
var recordType = record.ZodRecord.create;
exports.record = recordType;
var mapType = map.ZodMap.create;
exports.map = mapType;
var functionType = _function.ZodFunction.create;
exports.function = functionType;
var lazyType = lazy.ZodLazy.create;
exports.lazy = lazyType;
var literalType = literal.ZodLiteral.create;
exports.literal = literalType;
var enumType = _enum.ZodEnum.create;
exports.enum = enumType;
var nativeEnumType = nativeEnum.ZodNativeEnum.create;
exports.nativeEnum = nativeEnumType;
var promiseType = promise.ZodPromise.create;
exports.promise = promiseType;
var transformerType = transformer.ZodTransformer.create;
exports.transformer = transformerType;
var optionalType = optional.ZodOptional.create;
exports.optional = optionalType;
var nullableType = nullable.ZodNullable.create;
exports.nullable = nullableType;
var ostring = function () { return stringType().optional(); };
exports.ostring = ostring;
var onumber = function () { return numberType().optional(); };
exports.onumber = onumber;
var oboolean = function () { return booleanType().optional(); };
exports.oboolean = oboolean;
var codegen$1 = codegen.ZodCodeGenerator.create;
exports.codegen = codegen$1;
exports.custom = function (check, params) {
if (check)
return anyType().refine(check, params);
return anyType();
};
var instanceOfType = function (cls, params) {
if (params === void 0) { params = {
message: "Input not instance of " + cls.name,
}; }
return exports.custom(function (data) { return data instanceof cls; }, params);
};
exports.instanceof = instanceOfType;
exports.late = {
object: object.ZodObject.lazycreate,
};
__exportStar(ZodError_1, exports);
});
var __pika_web_default_export_for_treeshaking__ = /*@__PURE__*/getDefaultExportFromCjs(cjs);
var Schema = cjs.Schema;
var ZodAny = cjs.ZodAny;
var ZodArray = cjs.ZodArray;
var ZodBigInt = cjs.ZodBigInt;
var ZodBoolean = cjs.ZodBoolean;
var ZodCodeGenerator = cjs.ZodCodeGenerator;
var ZodDate = cjs.ZodDate;
var ZodEnum = cjs.ZodEnum;
var ZodError = cjs.ZodError;
var ZodFunction = cjs.ZodFunction;
var ZodIntersection = cjs.ZodIntersection;
var ZodIssueCode = cjs.ZodIssueCode;
var ZodLazy = cjs.ZodLazy;
var ZodLiteral = cjs.ZodLiteral;
var ZodNativeEnum = cjs.ZodNativeEnum;
var ZodNever = cjs.ZodNever;
var ZodNull = cjs.ZodNull;
var ZodNullable = cjs.ZodNullable;
var ZodNumber = cjs.ZodNumber;
var ZodObject = cjs.ZodObject;
var ZodOptional = cjs.ZodOptional;
var ZodParsedType = cjs.ZodParsedType;
var ZodPromise = cjs.ZodPromise;
var ZodRecord = cjs.ZodRecord;
var ZodSchema = cjs.ZodSchema;
var ZodString = cjs.ZodString;
var ZodTransformer = cjs.ZodTransformer;
var ZodTuple = cjs.ZodTuple;
var ZodType = cjs.ZodType;
var ZodTypes = cjs.ZodTypes;
var ZodUndefined = cjs.ZodUndefined;
var ZodUnion = cjs.ZodUnion;
var ZodUnknown = cjs.ZodUnknown;
var ZodVoid = cjs.ZodVoid;
var any$1 = cjs.any;
var array$1 = cjs.array;
var bigint$1 = cjs.bigint;
var boolean = cjs.boolean;
var codegen$1 = cjs.codegen;
var custom = cjs.custom;
var date$1 = cjs.date;
export default __pika_web_default_export_for_treeshaking__;
var function$1 = cjs["function"];
var instanceof$1 = cjs["instanceof"];
var intersection$1 = cjs.intersection;
var late = cjs.late;
var lazy$1 = cjs.lazy;
var literal$1 = cjs.literal;
var map$1 = cjs.map;
var nativeEnum$1 = cjs.nativeEnum;
var never$1 = cjs.never;
var null$1 = cjs["null"];
var nullable$1 = cjs.nullable;
var number$1 = cjs.number;
var object$1 = cjs.object;
var oboolean = cjs.oboolean;
var onumber = cjs.onumber;
var optional$1 = cjs.optional;
var ostring = cjs.ostring;
var promise$1 = cjs.promise;
var quotelessJson = cjs.quotelessJson;
var record$1 = cjs.record;
var string$1 = cjs.string;
var transformer$1 = cjs.transformer;
var tuple$1 = cjs.tuple;
var undefined$1 = cjs["undefined"];
var union$1 = cjs.union;
var unknown$1 = cjs.unknown;
var void$1 = cjs["void"];
export { Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodCodeGenerator, ZodDate, ZodEnum, ZodError, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPromise, ZodRecord, ZodSchema, ZodString, ZodTransformer, ZodTuple, ZodType, ZodTypes, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, cjs as __moduleExports, any$1 as any, array$1 as array, bigint$1 as bigint, boolean, codegen$1 as codegen, custom, date$1 as date, function$1 as function, instanceof$1 as instanceof, intersection$1 as intersection, late, lazy$1 as lazy, literal$1 as literal, map$1 as map, nativeEnum$1 as nativeEnum, never$1 as never, null$1 as null, nullable$1 as nullable, number$1 as number, object$1 as object, oboolean, onumber, optional$1 as optional, ostring, promise$1 as promise, quotelessJson, record$1 as record, string$1 as string, transformer$1 as transformer, tuple$1 as tuple, undefined$1 as undefined, union$1 as union, unknown$1 as unknown, void$1 as void };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment