@ray-js/robot-data-stream 0.0.14 → 0.0.15-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mqtt/createCommonOptions.d.ts +4 -2
- package/lib/mqtt/createCommonOptions.js +10 -5
- package/lib/mqtt/hooks/useStructuredMessage.d.ts +14 -0
- package/lib/mqtt/hooks/useStructuredMessage.js +131 -0
- package/lib/mqtt/mqttProvider.d.ts +19 -1
- package/lib/mqtt/mqttProvider.js +69 -8
- package/lib/mqtt/promise.d.ts +57 -4
- package/lib/mqtt/promise.js +115 -36
- package/lib/mqtt/type/fun.d.ts +49 -0
- package/lib/mqtt/type/fun.js +145 -0
- package/lib/mqtt/type/index.d.ts +0 -7
- package/lib/mqtt/type/index.js +0 -1
- package/lib/mqtt/type/protocols/base.d.ts +5 -0
- package/lib/mqtt/type/protocols/base.js +32 -0
- package/lib/mqtt/type/protocols/carpetCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/carpetCleanProtocol.js +16 -0
- package/lib/mqtt/type/protocols/carpetProtocol.d.ts +41 -0
- package/lib/mqtt/type/protocols/carpetProtocol.js +202 -0
- package/lib/mqtt/type/protocols/devInfoProtocol.d.ts +5 -0
- package/lib/mqtt/type/protocols/devInfoProtocol.js +12 -0
- package/lib/mqtt/type/protocols/deviceModelProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/deviceModelProtocol.js +34 -0
- package/lib/mqtt/type/protocols/furnitureModelProtocol.d.ts +10 -0
- package/lib/mqtt/type/protocols/furnitureModelProtocol.js +35 -0
- package/lib/mqtt/type/protocols/historyMapProtocol.d.ts +17 -0
- package/lib/mqtt/type/protocols/historyMapProtocol.js +37 -0
- package/lib/mqtt/type/protocols/index.d.ts +20 -0
- package/lib/mqtt/type/protocols/index.js +20 -0
- package/lib/mqtt/type/protocols/partDivisionProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/partDivisionProtocol.js +12 -0
- package/lib/mqtt/type/protocols/partMergeProtocol.d.ts +7 -0
- package/lib/mqtt/type/protocols/partMergeProtocol.js +12 -0
- package/lib/mqtt/type/protocols/passwordProtocol.d.ts +11 -0
- package/lib/mqtt/type/protocols/passwordProtocol.js +25 -0
- package/lib/mqtt/type/protocols/quietHoursProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/quietHoursProtocol.js +35 -0
- package/lib/mqtt/type/protocols/resetMapProtocol.d.ts +4 -0
- package/lib/mqtt/type/protocols/resetMapProtocol.js +1 -0
- package/lib/mqtt/type/protocols/roomPropertyProtocol.d.ts +14 -0
- package/lib/mqtt/type/protocols/roomPropertyProtocol.js +113 -0
- package/lib/mqtt/type/protocols/scheduleProtocol.d.ts +18 -0
- package/lib/mqtt/type/protocols/scheduleProtocol.js +100 -0
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.js +40 -0
- package/lib/mqtt/type/protocols/spotCleanProtocol.d.ts +9 -0
- package/lib/mqtt/type/protocols/spotCleanProtocol.js +72 -0
- package/lib/mqtt/type/protocols/virtualAreaProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/virtualAreaProtocol.js +36 -0
- package/lib/mqtt/type/protocols/virtualWallProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/virtualWallProtocol.js +25 -0
- package/lib/mqtt/type/protocols/voiceProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/voiceProtocol.js +23 -0
- package/lib/mqtt/type/protocols/wifiMapProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/wifiMapProtocol.js +14 -0
- package/lib/mqtt/type/protocols/zoneCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/zoneCleanProtocol.js +49 -0
- package/lib/mqtt/useCarpet.d.ts +7 -67
- package/lib/mqtt/useCarpet.js +101 -181
- package/lib/mqtt/useCarpetClean.d.ts +2 -11
- package/lib/mqtt/useCarpetClean.js +24 -51
- package/lib/mqtt/useDevInfo.d.ts +8 -6
- package/lib/mqtt/useDevInfo.js +44 -36
- package/lib/mqtt/useDeviceModel.d.ts +6 -19
- package/lib/mqtt/useDeviceModel.js +29 -42
- package/lib/mqtt/useFurnitureModel.d.ts +6 -18
- package/lib/mqtt/useFurnitureModel.js +29 -43
- package/lib/mqtt/useHistoryMap.d.ts +2 -18
- package/lib/mqtt/useHistoryMap.js +102 -119
- package/lib/mqtt/usePartDivision.d.ts +2 -9
- package/lib/mqtt/usePartDivision.js +48 -57
- package/lib/mqtt/usePartMerge.d.ts +2 -8
- package/lib/mqtt/usePartMerge.js +34 -49
- package/lib/mqtt/usePassword.d.ts +6 -13
- package/lib/mqtt/usePassword.js +84 -74
- package/lib/mqtt/useQuiteHours.d.ts +4 -37
- package/lib/mqtt/useQuiteHours.js +66 -100
- package/lib/mqtt/useResetMap.d.ts +2 -8
- package/lib/mqtt/useResetMap.js +27 -34
- package/lib/mqtt/useRoomProperty.d.ts +8 -9
- package/lib/mqtt/useRoomProperty.js +67 -65
- package/lib/mqtt/useSchedule.d.ts +3 -23
- package/lib/mqtt/useSchedule.js +72 -101
- package/lib/mqtt/useSelectRoomClean.d.ts +3 -24
- package/lib/mqtt/useSelectRoomClean.js +107 -133
- package/lib/mqtt/useSpotClean.d.ts +5 -15
- package/lib/mqtt/useSpotClean.js +68 -121
- package/lib/mqtt/useVirtualArea.d.ts +6 -17
- package/lib/mqtt/useVirtualArea.js +109 -119
- package/lib/mqtt/useVirtualWall.d.ts +2 -18
- package/lib/mqtt/useVirtualWall.js +69 -90
- package/lib/mqtt/useVoice.d.ts +2 -16
- package/lib/mqtt/useVoice.js +48 -68
- package/lib/mqtt/useWifiMap.d.ts +6 -5
- package/lib/mqtt/useWifiMap.js +43 -42
- package/lib/mqtt/useZoneClean.d.ts +2 -21
- package/lib/mqtt/useZoneClean.js +125 -137
- package/lib/myLib/zod/mini/index.d.cts +1 -0
- package/lib/myLib/zod/mini/index.d.ts +1 -0
- package/lib/myLib/zod/mini/index.js +1 -0
- package/lib/myLib/zod/mini/package.json +6 -0
- package/lib/myLib/zod/src/mini/index.d.ts +1 -0
- package/lib/myLib/zod/src/mini/index.js +1 -0
- package/lib/myLib/zod/src/v4/core/api.d.ts +306 -0
- package/lib/myLib/zod/src/v4/core/api.js +1256 -0
- package/lib/myLib/zod/src/v4/core/checks.d.ts +278 -0
- package/lib/myLib/zod/src/v4/core/checks.js +816 -0
- package/lib/myLib/zod/src/v4/core/config.d.ts +9 -0
- package/lib/myLib/zod/src/v4/core/config.js +5 -0
- package/lib/myLib/zod/src/v4/core/core.d.ts +70 -0
- package/lib/myLib/zod/src/v4/core/core.js +95 -0
- package/lib/myLib/zod/src/v4/core/doc.d.ts +14 -0
- package/lib/myLib/zod/src/v4/core/doc.js +42 -0
- package/lib/myLib/zod/src/v4/core/errors.d.ts +220 -0
- package/lib/myLib/zod/src/v4/core/errors.js +232 -0
- package/lib/myLib/zod/src/v4/core/index.d.ts +15 -0
- package/lib/myLib/zod/src/v4/core/index.js +15 -0
- package/lib/myLib/zod/src/v4/core/json-schema-generator.d.ts +65 -0
- package/lib/myLib/zod/src/v4/core/json-schema-generator.js +120 -0
- package/lib/myLib/zod/src/v4/core/json-schema-processors.d.ts +49 -0
- package/lib/myLib/zod/src/v4/core/json-schema-processors.js +593 -0
- package/lib/myLib/zod/src/v4/core/json-schema.d.ts +88 -0
- package/lib/myLib/zod/src/v4/core/json-schema.js +1 -0
- package/lib/myLib/zod/src/v4/core/parse.d.ts +49 -0
- package/lib/myLib/zod/src/v4/core/parse.js +147 -0
- package/lib/myLib/zod/src/v4/core/regexes.d.ts +78 -0
- package/lib/myLib/zod/src/v4/core/regexes.js +146 -0
- package/lib/myLib/zod/src/v4/core/registries.d.ts +35 -0
- package/lib/myLib/zod/src/v4/core/registries.js +51 -0
- package/lib/myLib/zod/src/v4/core/schemas.d.ts +1136 -0
- package/lib/myLib/zod/src/v4/core/schemas.js +2745 -0
- package/lib/myLib/zod/src/v4/core/standard-schema.d.ts +126 -0
- package/lib/myLib/zod/src/v4/core/standard-schema.js +1 -0
- package/lib/myLib/zod/src/v4/core/to-json-schema.d.ts +114 -0
- package/lib/myLib/zod/src/v4/core/to-json-schema.js +488 -0
- package/lib/myLib/zod/src/v4/core/util.d.ts +199 -0
- package/lib/myLib/zod/src/v4/core/util.js +656 -0
- package/lib/myLib/zod/src/v4/core/versions.d.ts +5 -0
- package/lib/myLib/zod/src/v4/core/versions.js +5 -0
- package/lib/myLib/zod/src/v4/core/zsf.d.ts +91 -0
- package/lib/myLib/zod/src/v4/core/zsf.js +1 -0
- package/lib/myLib/zod/src/v4/mini/checks.d.ts +1 -0
- package/lib/myLib/zod/src/v4/mini/checks.js +1 -0
- package/lib/myLib/zod/src/v4/mini/coerce.d.ts +7 -0
- package/lib/myLib/zod/src/v4/mini/coerce.js +27 -0
- package/lib/myLib/zod/src/v4/mini/external.d.ts +11 -0
- package/lib/myLib/zod/src/v4/mini/external.js +16 -0
- package/lib/myLib/zod/src/v4/mini/index.d.ts +3 -0
- package/lib/myLib/zod/src/v4/mini/index.js +3 -0
- package/lib/myLib/zod/src/v4/mini/iso.d.ts +22 -0
- package/lib/myLib/zod/src/v4/mini/iso.js +46 -0
- package/lib/myLib/zod/src/v4/mini/parse.d.ts +1 -0
- package/lib/myLib/zod/src/v4/mini/parse.js +1 -0
- package/lib/myLib/zod/src/v4/mini/schemas.js +1244 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -1
- package/package.json +5 -3
|
@@ -0,0 +1,1244 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
3
|
+
import * as core from "../core/index.js";
|
|
4
|
+
import * as util from "../core/util.js";
|
|
5
|
+
import * as parse from "./parse.js";
|
|
6
|
+
export const ZodMiniType = /*@__PURE__*/core.$constructor("ZodMiniType", (inst, def) => {
|
|
7
|
+
if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
|
|
8
|
+
core.$ZodType.init(inst, def);
|
|
9
|
+
inst.def = def;
|
|
10
|
+
inst.type = def.type;
|
|
11
|
+
inst.parse = (data, params) => parse.parse(inst, data, params, {
|
|
12
|
+
callee: inst.parse
|
|
13
|
+
});
|
|
14
|
+
inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
|
|
15
|
+
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, {
|
|
16
|
+
callee: inst.parseAsync
|
|
17
|
+
});
|
|
18
|
+
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
|
|
19
|
+
inst.check = function () {
|
|
20
|
+
var _def$checks;
|
|
21
|
+
for (var _len = arguments.length, checks = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
22
|
+
checks[_key] = arguments[_key];
|
|
23
|
+
}
|
|
24
|
+
return inst.clone(_objectSpread(_objectSpread({}, def), {}, {
|
|
25
|
+
checks: [...((_def$checks = def.checks) !== null && _def$checks !== void 0 ? _def$checks : []), ...checks.map(ch => typeof ch === "function" ? {
|
|
26
|
+
_zod: {
|
|
27
|
+
check: ch,
|
|
28
|
+
def: {
|
|
29
|
+
check: "custom"
|
|
30
|
+
},
|
|
31
|
+
onattach: []
|
|
32
|
+
}
|
|
33
|
+
} : ch)]
|
|
34
|
+
}), {
|
|
35
|
+
parent: true
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
inst.with = inst.check;
|
|
39
|
+
inst.clone = (_def, params) => core.clone(inst, _def, params);
|
|
40
|
+
inst.brand = () => inst;
|
|
41
|
+
inst.register = (reg, meta) => {
|
|
42
|
+
reg.add(inst, meta);
|
|
43
|
+
return inst;
|
|
44
|
+
};
|
|
45
|
+
inst.apply = fn => fn(inst);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// ZodMiniString
|
|
49
|
+
|
|
50
|
+
export const ZodMiniString = /*@__PURE__*/core.$constructor("ZodMiniString", (inst, def) => {
|
|
51
|
+
core.$ZodString.init(inst, def);
|
|
52
|
+
ZodMiniType.init(inst, def);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// @__NO_SIDE_EFFECTS__
|
|
56
|
+
export function string(params) {
|
|
57
|
+
return core._string(ZodMiniString, params);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ZodMiniStringFormat
|
|
61
|
+
|
|
62
|
+
export const ZodMiniStringFormat = /*@__PURE__*/core.$constructor("ZodMiniStringFormat", (inst, def) => {
|
|
63
|
+
core.$ZodStringFormat.init(inst, def);
|
|
64
|
+
ZodMiniString.init(inst, def);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// ZodMiniEmail
|
|
68
|
+
|
|
69
|
+
export const ZodMiniEmail = /*@__PURE__*/core.$constructor("ZodMiniEmail", (inst, def) => {
|
|
70
|
+
core.$ZodEmail.init(inst, def);
|
|
71
|
+
ZodMiniStringFormat.init(inst, def);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// @__NO_SIDE_EFFECTS__
|
|
75
|
+
export function email(params) {
|
|
76
|
+
return core._email(ZodMiniEmail, params);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ZodMiniGUID
|
|
80
|
+
|
|
81
|
+
export const ZodMiniGUID = /*@__PURE__*/core.$constructor("ZodMiniGUID", (inst, def) => {
|
|
82
|
+
core.$ZodGUID.init(inst, def);
|
|
83
|
+
ZodMiniStringFormat.init(inst, def);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// @__NO_SIDE_EFFECTS__
|
|
87
|
+
export function guid(params) {
|
|
88
|
+
return core._guid(ZodMiniGUID, params);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ZodMiniUUID
|
|
92
|
+
|
|
93
|
+
export const ZodMiniUUID = /*@__PURE__*/core.$constructor("ZodMiniUUID", (inst, def) => {
|
|
94
|
+
core.$ZodUUID.init(inst, def);
|
|
95
|
+
ZodMiniStringFormat.init(inst, def);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// @__NO_SIDE_EFFECTS__
|
|
99
|
+
export function uuid(params) {
|
|
100
|
+
return core._uuid(ZodMiniUUID, params);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// @__NO_SIDE_EFFECTS__
|
|
104
|
+
export function uuidv4(params) {
|
|
105
|
+
return core._uuidv4(ZodMiniUUID, params);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ZodMiniUUIDv6
|
|
109
|
+
|
|
110
|
+
// @__NO_SIDE_EFFECTS__
|
|
111
|
+
export function uuidv6(params) {
|
|
112
|
+
return core._uuidv6(ZodMiniUUID, params);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ZodMiniUUIDv7
|
|
116
|
+
|
|
117
|
+
// @__NO_SIDE_EFFECTS__
|
|
118
|
+
export function uuidv7(params) {
|
|
119
|
+
return core._uuidv7(ZodMiniUUID, params);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ZodMiniURL
|
|
123
|
+
|
|
124
|
+
export const ZodMiniURL = /*@__PURE__*/core.$constructor("ZodMiniURL", (inst, def) => {
|
|
125
|
+
core.$ZodURL.init(inst, def);
|
|
126
|
+
ZodMiniStringFormat.init(inst, def);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// @__NO_SIDE_EFFECTS__
|
|
130
|
+
export function url(params) {
|
|
131
|
+
return core._url(ZodMiniURL, params);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// @__NO_SIDE_EFFECTS__
|
|
135
|
+
export function httpUrl(params) {
|
|
136
|
+
return core._url(ZodMiniURL, _objectSpread({
|
|
137
|
+
protocol: /^https?$/,
|
|
138
|
+
hostname: core.regexes.domain
|
|
139
|
+
}, util.normalizeParams(params)));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ZodMiniNanoID
|
|
143
|
+
|
|
144
|
+
export const ZodMiniNanoID = /*@__PURE__*/core.$constructor("ZodMiniNanoID", (inst, def) => {
|
|
145
|
+
core.$ZodNanoID.init(inst, def);
|
|
146
|
+
ZodMiniStringFormat.init(inst, def);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// @__NO_SIDE_EFFECTS__
|
|
150
|
+
export function nanoid(params) {
|
|
151
|
+
return core._nanoid(ZodMiniNanoID, params);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ZodMiniCUID
|
|
155
|
+
|
|
156
|
+
export const ZodMiniCUID = /*@__PURE__*/core.$constructor("ZodMiniCUID", (inst, def) => {
|
|
157
|
+
core.$ZodCUID.init(inst, def);
|
|
158
|
+
ZodMiniStringFormat.init(inst, def);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// @__NO_SIDE_EFFECTS__
|
|
162
|
+
export function cuid(params) {
|
|
163
|
+
return core._cuid(ZodMiniCUID, params);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ZodMiniCUID2
|
|
167
|
+
|
|
168
|
+
export const ZodMiniCUID2 = /*@__PURE__*/core.$constructor("ZodMiniCUID2", (inst, def) => {
|
|
169
|
+
core.$ZodCUID2.init(inst, def);
|
|
170
|
+
ZodMiniStringFormat.init(inst, def);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// @__NO_SIDE_EFFECTS__
|
|
174
|
+
export function cuid2(params) {
|
|
175
|
+
return core._cuid2(ZodMiniCUID2, params);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// ZodMiniULID
|
|
179
|
+
|
|
180
|
+
export const ZodMiniULID = /*@__PURE__*/core.$constructor("ZodMiniULID", (inst, def) => {
|
|
181
|
+
core.$ZodULID.init(inst, def);
|
|
182
|
+
ZodMiniStringFormat.init(inst, def);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// @__NO_SIDE_EFFECTS__
|
|
186
|
+
export function ulid(params) {
|
|
187
|
+
return core._ulid(ZodMiniULID, params);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// ZodMiniXID
|
|
191
|
+
|
|
192
|
+
export const ZodMiniXID = /*@__PURE__*/core.$constructor("ZodMiniXID", (inst, def) => {
|
|
193
|
+
core.$ZodXID.init(inst, def);
|
|
194
|
+
ZodMiniStringFormat.init(inst, def);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// @__NO_SIDE_EFFECTS__
|
|
198
|
+
export function xid(params) {
|
|
199
|
+
return core._xid(ZodMiniXID, params);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ZodMiniKSUID
|
|
203
|
+
|
|
204
|
+
export const ZodMiniKSUID = /*@__PURE__*/core.$constructor("ZodMiniKSUID", (inst, def) => {
|
|
205
|
+
core.$ZodKSUID.init(inst, def);
|
|
206
|
+
ZodMiniStringFormat.init(inst, def);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// @__NO_SIDE_EFFECTS__
|
|
210
|
+
export function ksuid(params) {
|
|
211
|
+
return core._ksuid(ZodMiniKSUID, params);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// ZodMiniIPv4
|
|
215
|
+
|
|
216
|
+
export const ZodMiniIPv4 = /*@__PURE__*/core.$constructor("ZodMiniIPv4", (inst, def) => {
|
|
217
|
+
core.$ZodIPv4.init(inst, def);
|
|
218
|
+
ZodMiniStringFormat.init(inst, def);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// @__NO_SIDE_EFFECTS__
|
|
222
|
+
export function ipv4(params) {
|
|
223
|
+
return core._ipv4(ZodMiniIPv4, params);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ZodMiniIPv6
|
|
227
|
+
|
|
228
|
+
export const ZodMiniIPv6 = /*@__PURE__*/core.$constructor("ZodMiniIPv6", (inst, def) => {
|
|
229
|
+
core.$ZodIPv6.init(inst, def);
|
|
230
|
+
ZodMiniStringFormat.init(inst, def);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// @__NO_SIDE_EFFECTS__
|
|
234
|
+
export function ipv6(params) {
|
|
235
|
+
return core._ipv6(ZodMiniIPv6, params);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// ZodMiniCIDRv4
|
|
239
|
+
|
|
240
|
+
export const ZodMiniCIDRv4 = /*@__PURE__*/core.$constructor("ZodMiniCIDRv4", (inst, def) => {
|
|
241
|
+
core.$ZodCIDRv4.init(inst, def);
|
|
242
|
+
ZodMiniStringFormat.init(inst, def);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// @__NO_SIDE_EFFECTS__
|
|
246
|
+
export function cidrv4(params) {
|
|
247
|
+
return core._cidrv4(ZodMiniCIDRv4, params);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ZodMiniCIDRv6
|
|
251
|
+
|
|
252
|
+
export const ZodMiniCIDRv6 = /*@__PURE__*/core.$constructor("ZodMiniCIDRv6", (inst, def) => {
|
|
253
|
+
core.$ZodCIDRv6.init(inst, def);
|
|
254
|
+
ZodMiniStringFormat.init(inst, def);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
// @__NO_SIDE_EFFECTS__
|
|
258
|
+
export function cidrv6(params) {
|
|
259
|
+
return core._cidrv6(ZodMiniCIDRv6, params);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// ZodMiniMAC
|
|
263
|
+
|
|
264
|
+
export const ZodMiniMAC = /*@__PURE__*/core.$constructor("ZodMiniMAC", (inst, def) => {
|
|
265
|
+
core.$ZodMAC.init(inst, def);
|
|
266
|
+
ZodMiniStringFormat.init(inst, def);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
// @__NO_SIDE_EFFECTS__
|
|
270
|
+
export function mac(params) {
|
|
271
|
+
return core._mac(ZodMiniMAC, params);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ZodMiniBase64
|
|
275
|
+
|
|
276
|
+
export const ZodMiniBase64 = /*@__PURE__*/core.$constructor("ZodMiniBase64", (inst, def) => {
|
|
277
|
+
core.$ZodBase64.init(inst, def);
|
|
278
|
+
ZodMiniStringFormat.init(inst, def);
|
|
279
|
+
});
|
|
280
|
+
// @__NO_SIDE_EFFECTS__
|
|
281
|
+
export function base64(params) {
|
|
282
|
+
return core._base64(ZodMiniBase64, params);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// ZodMiniBase64URL
|
|
286
|
+
|
|
287
|
+
export const ZodMiniBase64URL = /*@__PURE__*/core.$constructor("ZodMiniBase64URL", (inst, def) => {
|
|
288
|
+
core.$ZodBase64URL.init(inst, def);
|
|
289
|
+
ZodMiniStringFormat.init(inst, def);
|
|
290
|
+
});
|
|
291
|
+
// @__NO_SIDE_EFFECTS__
|
|
292
|
+
export function base64url(params) {
|
|
293
|
+
return core._base64url(ZodMiniBase64URL, params);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ZodMiniE164
|
|
297
|
+
|
|
298
|
+
export const ZodMiniE164 = /*@__PURE__*/core.$constructor("ZodMiniE164", (inst, def) => {
|
|
299
|
+
core.$ZodE164.init(inst, def);
|
|
300
|
+
ZodMiniStringFormat.init(inst, def);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// @__NO_SIDE_EFFECTS__
|
|
304
|
+
export function e164(params) {
|
|
305
|
+
return core._e164(ZodMiniE164, params);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// ZodMiniJWT
|
|
309
|
+
|
|
310
|
+
export const ZodMiniJWT = /*@__PURE__*/core.$constructor("ZodMiniJWT", (inst, def) => {
|
|
311
|
+
core.$ZodJWT.init(inst, def);
|
|
312
|
+
ZodMiniStringFormat.init(inst, def);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// @__NO_SIDE_EFFECTS__
|
|
316
|
+
export function jwt(params) {
|
|
317
|
+
return core._jwt(ZodMiniJWT, params);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// ZodMiniCustomStringFormat
|
|
321
|
+
|
|
322
|
+
export const ZodMiniCustomStringFormat = /*@__PURE__*/core.$constructor("ZodMiniCustomStringFormat", (inst, def) => {
|
|
323
|
+
core.$ZodCustomStringFormat.init(inst, def);
|
|
324
|
+
ZodMiniStringFormat.init(inst, def);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// @__NO_SIDE_EFFECTS__
|
|
328
|
+
export function stringFormat(format, fnOrRegex) {
|
|
329
|
+
let _params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
330
|
+
return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// @__NO_SIDE_EFFECTS__
|
|
334
|
+
export function hostname(_params) {
|
|
335
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// @__NO_SIDE_EFFECTS__
|
|
339
|
+
export function hex(_params) {
|
|
340
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "hex", core.regexes.hex, _params);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// @__NO_SIDE_EFFECTS__
|
|
344
|
+
export function hash(alg, params) {
|
|
345
|
+
var _params$enc;
|
|
346
|
+
const enc = (_params$enc = params === null || params === void 0 ? void 0 : params.enc) !== null && _params$enc !== void 0 ? _params$enc : "hex";
|
|
347
|
+
const format = `${alg}_${enc}`;
|
|
348
|
+
const regex = core.regexes[format];
|
|
349
|
+
// check for unrecognized format
|
|
350
|
+
if (!regex) throw new Error(`Unrecognized hash format: ${format}`);
|
|
351
|
+
return core._stringFormat(ZodMiniCustomStringFormat, format, regex, params);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// ZodMiniNumber
|
|
355
|
+
|
|
356
|
+
export const ZodMiniNumber = /*@__PURE__*/core.$constructor("ZodMiniNumber", (inst, def) => {
|
|
357
|
+
core.$ZodNumber.init(inst, def);
|
|
358
|
+
ZodMiniType.init(inst, def);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
// @__NO_SIDE_EFFECTS__
|
|
362
|
+
export function number(params) {
|
|
363
|
+
return core._number(ZodMiniNumber, params);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// ZodMiniNumberFormat
|
|
367
|
+
|
|
368
|
+
export const ZodMiniNumberFormat = /*@__PURE__*/core.$constructor("ZodMiniNumberFormat", (inst, def) => {
|
|
369
|
+
core.$ZodNumberFormat.init(inst, def);
|
|
370
|
+
ZodMiniNumber.init(inst, def);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// int
|
|
374
|
+
|
|
375
|
+
// @__NO_SIDE_EFFECTS__
|
|
376
|
+
export function int(params) {
|
|
377
|
+
return core._int(ZodMiniNumberFormat, params);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// float32
|
|
381
|
+
|
|
382
|
+
// @__NO_SIDE_EFFECTS__
|
|
383
|
+
export function float32(params) {
|
|
384
|
+
return core._float32(ZodMiniNumberFormat, params);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// float64
|
|
388
|
+
|
|
389
|
+
// @__NO_SIDE_EFFECTS__
|
|
390
|
+
export function float64(params) {
|
|
391
|
+
return core._float64(ZodMiniNumberFormat, params);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// int32
|
|
395
|
+
|
|
396
|
+
// @__NO_SIDE_EFFECTS__
|
|
397
|
+
export function int32(params) {
|
|
398
|
+
return core._int32(ZodMiniNumberFormat, params);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// uint32
|
|
402
|
+
|
|
403
|
+
// @__NO_SIDE_EFFECTS__
|
|
404
|
+
export function uint32(params) {
|
|
405
|
+
return core._uint32(ZodMiniNumberFormat, params);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// ZodMiniBoolean
|
|
409
|
+
|
|
410
|
+
export const ZodMiniBoolean = /*@__PURE__*/core.$constructor("ZodMiniBoolean", (inst, def) => {
|
|
411
|
+
core.$ZodBoolean.init(inst, def);
|
|
412
|
+
ZodMiniType.init(inst, def);
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
// @__NO_SIDE_EFFECTS__
|
|
416
|
+
export function boolean(params) {
|
|
417
|
+
return core._boolean(ZodMiniBoolean, params);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// ZodMiniBigInt
|
|
421
|
+
|
|
422
|
+
export const ZodMiniBigInt = /*@__PURE__*/core.$constructor("ZodMiniBigInt", (inst, def) => {
|
|
423
|
+
core.$ZodBigInt.init(inst, def);
|
|
424
|
+
ZodMiniType.init(inst, def);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// @__NO_SIDE_EFFECTS__
|
|
428
|
+
export function bigint(params) {
|
|
429
|
+
return core._bigint(ZodMiniBigInt, params);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// bigint formats
|
|
433
|
+
|
|
434
|
+
// ZodMiniBigIntFormat
|
|
435
|
+
|
|
436
|
+
export const ZodMiniBigIntFormat = /*@__PURE__*/core.$constructor("ZodMiniBigIntFormat", (inst, def) => {
|
|
437
|
+
core.$ZodBigIntFormat.init(inst, def);
|
|
438
|
+
ZodMiniBigInt.init(inst, def);
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
// int64
|
|
442
|
+
|
|
443
|
+
// @__NO_SIDE_EFFECTS__
|
|
444
|
+
export function int64(params) {
|
|
445
|
+
return core._int64(ZodMiniBigIntFormat, params);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// uint64
|
|
449
|
+
|
|
450
|
+
// @__NO_SIDE_EFFECTS__
|
|
451
|
+
export function uint64(params) {
|
|
452
|
+
return core._uint64(ZodMiniBigIntFormat, params);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// ZodMiniSymbol
|
|
456
|
+
|
|
457
|
+
export const ZodMiniSymbol = /*@__PURE__*/core.$constructor("ZodMiniSymbol", (inst, def) => {
|
|
458
|
+
core.$ZodSymbol.init(inst, def);
|
|
459
|
+
ZodMiniType.init(inst, def);
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
// @__NO_SIDE_EFFECTS__
|
|
463
|
+
export function symbol(params) {
|
|
464
|
+
return core._symbol(ZodMiniSymbol, params);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// ZodMiniUndefined
|
|
468
|
+
|
|
469
|
+
export const ZodMiniUndefined = /*@__PURE__*/core.$constructor("ZodMiniUndefined", (inst, def) => {
|
|
470
|
+
core.$ZodUndefined.init(inst, def);
|
|
471
|
+
ZodMiniType.init(inst, def);
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
// @__NO_SIDE_EFFECTS__
|
|
475
|
+
function _undefined(params) {
|
|
476
|
+
return core._undefined(ZodMiniUndefined, params);
|
|
477
|
+
}
|
|
478
|
+
export { _undefined as undefined };
|
|
479
|
+
|
|
480
|
+
// ZodMiniNull
|
|
481
|
+
|
|
482
|
+
export const ZodMiniNull = /*@__PURE__*/core.$constructor("ZodMiniNull", (inst, def) => {
|
|
483
|
+
core.$ZodNull.init(inst, def);
|
|
484
|
+
ZodMiniType.init(inst, def);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// @__NO_SIDE_EFFECTS__
|
|
488
|
+
function _null(params) {
|
|
489
|
+
return core._null(ZodMiniNull, params);
|
|
490
|
+
}
|
|
491
|
+
export { _null as null };
|
|
492
|
+
|
|
493
|
+
// ZodMiniAny
|
|
494
|
+
|
|
495
|
+
export const ZodMiniAny = /*@__PURE__*/core.$constructor("ZodMiniAny", (inst, def) => {
|
|
496
|
+
core.$ZodAny.init(inst, def);
|
|
497
|
+
ZodMiniType.init(inst, def);
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
// @__NO_SIDE_EFFECTS__
|
|
501
|
+
export function any() {
|
|
502
|
+
return core._any(ZodMiniAny);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// ZodMiniUnknown
|
|
506
|
+
|
|
507
|
+
export const ZodMiniUnknown = /*@__PURE__*/core.$constructor("ZodMiniUnknown", (inst, def) => {
|
|
508
|
+
core.$ZodUnknown.init(inst, def);
|
|
509
|
+
ZodMiniType.init(inst, def);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
// @__NO_SIDE_EFFECTS__
|
|
513
|
+
export function unknown() {
|
|
514
|
+
return core._unknown(ZodMiniUnknown);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// ZodMiniNever
|
|
518
|
+
|
|
519
|
+
export const ZodMiniNever = /*@__PURE__*/core.$constructor("ZodMiniNever", (inst, def) => {
|
|
520
|
+
core.$ZodNever.init(inst, def);
|
|
521
|
+
ZodMiniType.init(inst, def);
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
// @__NO_SIDE_EFFECTS__
|
|
525
|
+
export function never(params) {
|
|
526
|
+
return core._never(ZodMiniNever, params);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// ZodMiniVoid
|
|
530
|
+
|
|
531
|
+
export const ZodMiniVoid = /*@__PURE__*/core.$constructor("ZodMiniVoid", (inst, def) => {
|
|
532
|
+
core.$ZodVoid.init(inst, def);
|
|
533
|
+
ZodMiniType.init(inst, def);
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// @__NO_SIDE_EFFECTS__
|
|
537
|
+
function _void(params) {
|
|
538
|
+
return core._void(ZodMiniVoid, params);
|
|
539
|
+
}
|
|
540
|
+
export { _void as void };
|
|
541
|
+
|
|
542
|
+
// ZodMiniDate
|
|
543
|
+
|
|
544
|
+
export const ZodMiniDate = /*@__PURE__*/core.$constructor("ZodMiniDate", (inst, def) => {
|
|
545
|
+
core.$ZodDate.init(inst, def);
|
|
546
|
+
ZodMiniType.init(inst, def);
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
// @__NO_SIDE_EFFECTS__
|
|
550
|
+
export function date(params) {
|
|
551
|
+
return core._date(ZodMiniDate, params);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// ZodMiniArray
|
|
555
|
+
|
|
556
|
+
export const ZodMiniArray = /*@__PURE__*/core.$constructor("ZodMiniArray", (inst, def) => {
|
|
557
|
+
core.$ZodArray.init(inst, def);
|
|
558
|
+
ZodMiniType.init(inst, def);
|
|
559
|
+
});
|
|
560
|
+
// @__NO_SIDE_EFFECTS__
|
|
561
|
+
export function array(element, params) {
|
|
562
|
+
return new ZodMiniArray(_objectSpread({
|
|
563
|
+
type: "array",
|
|
564
|
+
element: element
|
|
565
|
+
}, util.normalizeParams(params)));
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// .keyof
|
|
569
|
+
// @__NO_SIDE_EFFECTS__
|
|
570
|
+
export function keyof(schema) {
|
|
571
|
+
const shape = schema._zod.def.shape;
|
|
572
|
+
return _enum(Object.keys(shape));
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// ZodMiniObject
|
|
576
|
+
|
|
577
|
+
export const ZodMiniObject = /*@__PURE__*/core.$constructor("ZodMiniObject", (inst, def) => {
|
|
578
|
+
core.$ZodObject.init(inst, def);
|
|
579
|
+
ZodMiniType.init(inst, def);
|
|
580
|
+
util.defineLazy(inst, "shape", () => def.shape);
|
|
581
|
+
});
|
|
582
|
+
// @__NO_SIDE_EFFECTS__
|
|
583
|
+
export function object(shape, params) {
|
|
584
|
+
const def = _objectSpread({
|
|
585
|
+
type: "object",
|
|
586
|
+
shape: shape !== null && shape !== void 0 ? shape : {}
|
|
587
|
+
}, util.normalizeParams(params));
|
|
588
|
+
return new ZodMiniObject(def);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// strictObject
|
|
592
|
+
// @__NO_SIDE_EFFECTS__
|
|
593
|
+
export function strictObject(shape, params) {
|
|
594
|
+
return new ZodMiniObject(_objectSpread({
|
|
595
|
+
type: "object",
|
|
596
|
+
shape,
|
|
597
|
+
catchall: never()
|
|
598
|
+
}, util.normalizeParams(params)));
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// looseObject
|
|
602
|
+
// @__NO_SIDE_EFFECTS__
|
|
603
|
+
export function looseObject(shape, params) {
|
|
604
|
+
return new ZodMiniObject(_objectSpread({
|
|
605
|
+
type: "object",
|
|
606
|
+
shape,
|
|
607
|
+
catchall: unknown()
|
|
608
|
+
}, util.normalizeParams(params)));
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// object methods
|
|
612
|
+
// @__NO_SIDE_EFFECTS__
|
|
613
|
+
export function extend(schema, shape) {
|
|
614
|
+
return util.extend(schema, shape);
|
|
615
|
+
}
|
|
616
|
+
// @__NO_SIDE_EFFECTS__
|
|
617
|
+
export function safeExtend(schema, shape) {
|
|
618
|
+
return util.safeExtend(schema, shape);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** @deprecated Identical to `z.extend(A, B)` */
|
|
622
|
+
|
|
623
|
+
// @__NO_SIDE_EFFECTS__
|
|
624
|
+
export function merge(schema, shape) {
|
|
625
|
+
return util.extend(schema, shape);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// @__NO_SIDE_EFFECTS__
|
|
629
|
+
export function pick(schema, mask) {
|
|
630
|
+
return util.pick(schema, mask);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// .omit
|
|
634
|
+
|
|
635
|
+
// @__NO_SIDE_EFFECTS__
|
|
636
|
+
export function omit(schema, mask) {
|
|
637
|
+
return util.omit(schema, mask);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// @__NO_SIDE_EFFECTS__
|
|
641
|
+
|
|
642
|
+
// @__NO_SIDE_EFFECTS__
|
|
643
|
+
|
|
644
|
+
// @__NO_SIDE_EFFECTS__
|
|
645
|
+
export function partial(schema, mask) {
|
|
646
|
+
return util.partial(ZodMiniOptional, schema, mask);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// @__NO_SIDE_EFFECTS__
|
|
650
|
+
|
|
651
|
+
// @__NO_SIDE_EFFECTS__
|
|
652
|
+
|
|
653
|
+
// @__NO_SIDE_EFFECTS__
|
|
654
|
+
export function required(schema, mask) {
|
|
655
|
+
return util.required(ZodMiniNonOptional, schema, mask);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// @__NO_SIDE_EFFECTS__
|
|
659
|
+
export function catchall(inst, catchall) {
|
|
660
|
+
return inst.clone(_objectSpread(_objectSpread({}, inst._zod.def), {}, {
|
|
661
|
+
catchall: catchall
|
|
662
|
+
}));
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// ZodMiniUnion
|
|
666
|
+
|
|
667
|
+
export const ZodMiniUnion = /*@__PURE__*/core.$constructor("ZodMiniUnion", (inst, def) => {
|
|
668
|
+
core.$ZodUnion.init(inst, def);
|
|
669
|
+
ZodMiniType.init(inst, def);
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
// @__NO_SIDE_EFFECTS__
|
|
673
|
+
export function union(options, params) {
|
|
674
|
+
return new ZodMiniUnion(_objectSpread({
|
|
675
|
+
type: "union",
|
|
676
|
+
options: options
|
|
677
|
+
}, util.normalizeParams(params)));
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// ZodMiniXor
|
|
681
|
+
|
|
682
|
+
export const ZodMiniXor = /*@__PURE__*/core.$constructor("ZodMiniXor", (inst, def) => {
|
|
683
|
+
ZodMiniUnion.init(inst, def);
|
|
684
|
+
core.$ZodXor.init(inst, def);
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
/** Creates an exclusive union (XOR) where exactly one option must match.
|
|
688
|
+
* Unlike regular unions that succeed when any option matches, xor fails if
|
|
689
|
+
* zero or more than one option matches the input. */
|
|
690
|
+
export function xor(options, params) {
|
|
691
|
+
return new ZodMiniXor(_objectSpread({
|
|
692
|
+
type: "union",
|
|
693
|
+
options: options,
|
|
694
|
+
inclusive: false
|
|
695
|
+
}, util.normalizeParams(params)));
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// ZodMiniDiscriminatedUnion
|
|
699
|
+
|
|
700
|
+
export const ZodMiniDiscriminatedUnion = /*@__PURE__*/core.$constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
|
|
701
|
+
core.$ZodDiscriminatedUnion.init(inst, def);
|
|
702
|
+
ZodMiniType.init(inst, def);
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
// @__NO_SIDE_EFFECTS__
|
|
706
|
+
export function discriminatedUnion(discriminator, options, params) {
|
|
707
|
+
return new ZodMiniDiscriminatedUnion(_objectSpread({
|
|
708
|
+
type: "union",
|
|
709
|
+
options,
|
|
710
|
+
discriminator
|
|
711
|
+
}, util.normalizeParams(params)));
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// ZodMiniIntersection
|
|
715
|
+
|
|
716
|
+
export const ZodMiniIntersection = /*@__PURE__*/core.$constructor("ZodMiniIntersection", (inst, def) => {
|
|
717
|
+
core.$ZodIntersection.init(inst, def);
|
|
718
|
+
ZodMiniType.init(inst, def);
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
// @__NO_SIDE_EFFECTS__
|
|
722
|
+
export function intersection(left, right) {
|
|
723
|
+
return new ZodMiniIntersection({
|
|
724
|
+
type: "intersection",
|
|
725
|
+
left: left,
|
|
726
|
+
right: right
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// ZodMiniTuple
|
|
731
|
+
|
|
732
|
+
export const ZodMiniTuple = /*@__PURE__*/core.$constructor("ZodMiniTuple", (inst, def) => {
|
|
733
|
+
core.$ZodTuple.init(inst, def);
|
|
734
|
+
ZodMiniType.init(inst, def);
|
|
735
|
+
});
|
|
736
|
+
// @__NO_SIDE_EFFECTS__
|
|
737
|
+
export function tuple(items, _paramsOrRest, _params) {
|
|
738
|
+
const hasRest = _paramsOrRest instanceof core.$ZodType;
|
|
739
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
740
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
741
|
+
return new ZodMiniTuple(_objectSpread({
|
|
742
|
+
type: "tuple",
|
|
743
|
+
items: items,
|
|
744
|
+
rest
|
|
745
|
+
}, util.normalizeParams(params)));
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// ZodMiniRecord
|
|
749
|
+
|
|
750
|
+
export const ZodMiniRecord = /*@__PURE__*/core.$constructor("ZodMiniRecord", (inst, def) => {
|
|
751
|
+
core.$ZodRecord.init(inst, def);
|
|
752
|
+
ZodMiniType.init(inst, def);
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
// @__NO_SIDE_EFFECTS__
|
|
756
|
+
export function record(keyType, valueType, params) {
|
|
757
|
+
return new ZodMiniRecord(_objectSpread({
|
|
758
|
+
type: "record",
|
|
759
|
+
keyType,
|
|
760
|
+
valueType: valueType
|
|
761
|
+
}, util.normalizeParams(params)));
|
|
762
|
+
}
|
|
763
|
+
// @__NO_SIDE_EFFECTS__
|
|
764
|
+
export function partialRecord(keyType, valueType, params) {
|
|
765
|
+
const k = core.clone(keyType);
|
|
766
|
+
k._zod.values = undefined;
|
|
767
|
+
return new ZodMiniRecord(_objectSpread({
|
|
768
|
+
type: "record",
|
|
769
|
+
keyType: k,
|
|
770
|
+
valueType: valueType
|
|
771
|
+
}, util.normalizeParams(params)));
|
|
772
|
+
}
|
|
773
|
+
export function looseRecord(keyType, valueType, params) {
|
|
774
|
+
return new ZodMiniRecord(_objectSpread({
|
|
775
|
+
type: "record",
|
|
776
|
+
keyType,
|
|
777
|
+
valueType: valueType,
|
|
778
|
+
mode: "loose"
|
|
779
|
+
}, util.normalizeParams(params)));
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// ZodMiniMap
|
|
783
|
+
|
|
784
|
+
export const ZodMiniMap = /*@__PURE__*/core.$constructor("ZodMiniMap", (inst, def) => {
|
|
785
|
+
core.$ZodMap.init(inst, def);
|
|
786
|
+
ZodMiniType.init(inst, def);
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
// @__NO_SIDE_EFFECTS__
|
|
790
|
+
export function map(keyType, valueType, params) {
|
|
791
|
+
return new ZodMiniMap(_objectSpread({
|
|
792
|
+
type: "map",
|
|
793
|
+
keyType: keyType,
|
|
794
|
+
valueType: valueType
|
|
795
|
+
}, util.normalizeParams(params)));
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// ZodMiniSet
|
|
799
|
+
|
|
800
|
+
export const ZodMiniSet = /*@__PURE__*/core.$constructor("ZodMiniSet", (inst, def) => {
|
|
801
|
+
core.$ZodSet.init(inst, def);
|
|
802
|
+
ZodMiniType.init(inst, def);
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
// @__NO_SIDE_EFFECTS__
|
|
806
|
+
export function set(valueType, params) {
|
|
807
|
+
return new ZodMiniSet(_objectSpread({
|
|
808
|
+
type: "set",
|
|
809
|
+
valueType: valueType
|
|
810
|
+
}, util.normalizeParams(params)));
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// ZodMiniEnum
|
|
814
|
+
|
|
815
|
+
export const ZodMiniEnum = /*@__PURE__*/core.$constructor("ZodMiniEnum", (inst, def) => {
|
|
816
|
+
core.$ZodEnum.init(inst, def);
|
|
817
|
+
ZodMiniType.init(inst, def);
|
|
818
|
+
inst.options = Object.values(def.entries);
|
|
819
|
+
});
|
|
820
|
+
// @__NO_SIDE_EFFECTS__
|
|
821
|
+
function _enum(values, params) {
|
|
822
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map(v => [v, v])) : values;
|
|
823
|
+
return new ZodMiniEnum(_objectSpread({
|
|
824
|
+
type: "enum",
|
|
825
|
+
entries
|
|
826
|
+
}, util.normalizeParams(params)));
|
|
827
|
+
}
|
|
828
|
+
export { _enum as enum };
|
|
829
|
+
|
|
830
|
+
// @__NO_SIDE_EFFECTS__
|
|
831
|
+
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
832
|
+
*
|
|
833
|
+
* ```ts
|
|
834
|
+
* enum Colors { red, green, blue }
|
|
835
|
+
* z.enum(Colors);
|
|
836
|
+
* ```
|
|
837
|
+
*/
|
|
838
|
+
export function nativeEnum(entries, params) {
|
|
839
|
+
return new ZodMiniEnum(_objectSpread({
|
|
840
|
+
type: "enum",
|
|
841
|
+
entries
|
|
842
|
+
}, util.normalizeParams(params)));
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// ZodMiniLiteral
|
|
846
|
+
|
|
847
|
+
export const ZodMiniLiteral = /*@__PURE__*/core.$constructor("ZodMiniLiteral", (inst, def) => {
|
|
848
|
+
core.$ZodLiteral.init(inst, def);
|
|
849
|
+
ZodMiniType.init(inst, def);
|
|
850
|
+
});
|
|
851
|
+
// @__NO_SIDE_EFFECTS__
|
|
852
|
+
export function literal(value, params) {
|
|
853
|
+
return new ZodMiniLiteral(_objectSpread({
|
|
854
|
+
type: "literal",
|
|
855
|
+
values: Array.isArray(value) ? value : [value]
|
|
856
|
+
}, util.normalizeParams(params)));
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// ZodMiniFile
|
|
860
|
+
|
|
861
|
+
export const ZodMiniFile = /*@__PURE__*/core.$constructor("ZodMiniFile", (inst, def) => {
|
|
862
|
+
core.$ZodFile.init(inst, def);
|
|
863
|
+
ZodMiniType.init(inst, def);
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
// @__NO_SIDE_EFFECTS__
|
|
867
|
+
export function file(params) {
|
|
868
|
+
return core._file(ZodMiniFile, params);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// ZodMiniTransform
|
|
872
|
+
|
|
873
|
+
export const ZodMiniTransform = /*@__PURE__*/core.$constructor("ZodMiniTransform", (inst, def) => {
|
|
874
|
+
core.$ZodTransform.init(inst, def);
|
|
875
|
+
ZodMiniType.init(inst, def);
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
// @__NO_SIDE_EFFECTS__
|
|
879
|
+
export function transform(fn) {
|
|
880
|
+
return new ZodMiniTransform({
|
|
881
|
+
type: "transform",
|
|
882
|
+
transform: fn
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// ZodMiniOptional
|
|
887
|
+
|
|
888
|
+
export const ZodMiniOptional = /*@__PURE__*/core.$constructor("ZodMiniOptional", (inst, def) => {
|
|
889
|
+
core.$ZodOptional.init(inst, def);
|
|
890
|
+
ZodMiniType.init(inst, def);
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
// @__NO_SIDE_EFFECTS__
|
|
894
|
+
export function optional(innerType) {
|
|
895
|
+
return new ZodMiniOptional({
|
|
896
|
+
type: "optional",
|
|
897
|
+
innerType: innerType
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// ZodMiniExactOptional
|
|
902
|
+
|
|
903
|
+
export const ZodMiniExactOptional = /*@__PURE__*/core.$constructor("ZodMiniExactOptional", (inst, def) => {
|
|
904
|
+
core.$ZodExactOptional.init(inst, def);
|
|
905
|
+
ZodMiniType.init(inst, def);
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
// @__NO_SIDE_EFFECTS__
|
|
909
|
+
export function exactOptional(innerType) {
|
|
910
|
+
return new ZodMiniExactOptional({
|
|
911
|
+
type: "optional",
|
|
912
|
+
innerType: innerType
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// ZodMiniNullable
|
|
917
|
+
|
|
918
|
+
export const ZodMiniNullable = /*@__PURE__*/core.$constructor("ZodMiniNullable", (inst, def) => {
|
|
919
|
+
core.$ZodNullable.init(inst, def);
|
|
920
|
+
ZodMiniType.init(inst, def);
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
// @__NO_SIDE_EFFECTS__
|
|
924
|
+
export function nullable(innerType) {
|
|
925
|
+
return new ZodMiniNullable({
|
|
926
|
+
type: "nullable",
|
|
927
|
+
innerType: innerType
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// nullish
|
|
932
|
+
// @__NO_SIDE_EFFECTS__
|
|
933
|
+
export function nullish(innerType) {
|
|
934
|
+
return optional(nullable(innerType));
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// ZodMiniDefault
|
|
938
|
+
|
|
939
|
+
export const ZodMiniDefault = /*@__PURE__*/core.$constructor("ZodMiniDefault", (inst, def) => {
|
|
940
|
+
core.$ZodDefault.init(inst, def);
|
|
941
|
+
ZodMiniType.init(inst, def);
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
// @__NO_SIDE_EFFECTS__
|
|
945
|
+
export function _default(innerType, defaultValue) {
|
|
946
|
+
return new ZodMiniDefault({
|
|
947
|
+
type: "default",
|
|
948
|
+
innerType: innerType,
|
|
949
|
+
get defaultValue() {
|
|
950
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// ZodMiniPrefault
|
|
956
|
+
|
|
957
|
+
export const ZodMiniPrefault = /*@__PURE__*/core.$constructor("ZodMiniPrefault", (inst, def) => {
|
|
958
|
+
core.$ZodPrefault.init(inst, def);
|
|
959
|
+
ZodMiniType.init(inst, def);
|
|
960
|
+
});
|
|
961
|
+
// @__NO_SIDE_EFFECTS__
|
|
962
|
+
export function prefault(innerType, defaultValue) {
|
|
963
|
+
return new ZodMiniPrefault({
|
|
964
|
+
type: "prefault",
|
|
965
|
+
innerType: innerType,
|
|
966
|
+
get defaultValue() {
|
|
967
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// ZodMiniNonOptional
|
|
973
|
+
|
|
974
|
+
export const ZodMiniNonOptional = /*@__PURE__*/core.$constructor("ZodMiniNonOptional", (inst, def) => {
|
|
975
|
+
core.$ZodNonOptional.init(inst, def);
|
|
976
|
+
ZodMiniType.init(inst, def);
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
// @__NO_SIDE_EFFECTS__
|
|
980
|
+
export function nonoptional(innerType, params) {
|
|
981
|
+
return new ZodMiniNonOptional(_objectSpread({
|
|
982
|
+
type: "nonoptional",
|
|
983
|
+
innerType: innerType
|
|
984
|
+
}, util.normalizeParams(params)));
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// ZodMiniSuccess
|
|
988
|
+
|
|
989
|
+
export const ZodMiniSuccess = /*@__PURE__*/core.$constructor("ZodMiniSuccess", (inst, def) => {
|
|
990
|
+
core.$ZodSuccess.init(inst, def);
|
|
991
|
+
ZodMiniType.init(inst, def);
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
// @__NO_SIDE_EFFECTS__
|
|
995
|
+
export function success(innerType) {
|
|
996
|
+
return new ZodMiniSuccess({
|
|
997
|
+
type: "success",
|
|
998
|
+
innerType: innerType
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// ZodMiniCatch
|
|
1003
|
+
|
|
1004
|
+
export const ZodMiniCatch = /*@__PURE__*/core.$constructor("ZodMiniCatch", (inst, def) => {
|
|
1005
|
+
core.$ZodCatch.init(inst, def);
|
|
1006
|
+
ZodMiniType.init(inst, def);
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
// @__NO_SIDE_EFFECTS__
|
|
1010
|
+
function _catch(innerType, catchValue) {
|
|
1011
|
+
return new ZodMiniCatch({
|
|
1012
|
+
type: "catch",
|
|
1013
|
+
innerType: innerType,
|
|
1014
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
export { _catch as catch };
|
|
1018
|
+
|
|
1019
|
+
// ZodMiniNaN
|
|
1020
|
+
|
|
1021
|
+
export const ZodMiniNaN = /*@__PURE__*/core.$constructor("ZodMiniNaN", (inst, def) => {
|
|
1022
|
+
core.$ZodNaN.init(inst, def);
|
|
1023
|
+
ZodMiniType.init(inst, def);
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
// @__NO_SIDE_EFFECTS__
|
|
1027
|
+
export function nan(params) {
|
|
1028
|
+
return core._nan(ZodMiniNaN, params);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// ZodMiniPipe
|
|
1032
|
+
|
|
1033
|
+
export const ZodMiniPipe = /*@__PURE__*/core.$constructor("ZodMiniPipe", (inst, def) => {
|
|
1034
|
+
core.$ZodPipe.init(inst, def);
|
|
1035
|
+
ZodMiniType.init(inst, def);
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
// @__NO_SIDE_EFFECTS__
|
|
1039
|
+
export function pipe(in_, out) {
|
|
1040
|
+
return new ZodMiniPipe({
|
|
1041
|
+
type: "pipe",
|
|
1042
|
+
in: in_,
|
|
1043
|
+
out: out
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
// ZodMiniCodec
|
|
1048
|
+
|
|
1049
|
+
export const ZodMiniCodec = /*@__PURE__*/core.$constructor("ZodMiniCodec", (inst, def) => {
|
|
1050
|
+
ZodMiniPipe.init(inst, def);
|
|
1051
|
+
core.$ZodCodec.init(inst, def);
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
// @__NO_SIDE_EFFECTS__
|
|
1055
|
+
export function codec(in_, out, params) {
|
|
1056
|
+
return new ZodMiniCodec({
|
|
1057
|
+
type: "pipe",
|
|
1058
|
+
in: in_,
|
|
1059
|
+
out: out,
|
|
1060
|
+
transform: params.decode,
|
|
1061
|
+
reverseTransform: params.encode
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
|
|
1066
|
+
// export function preprocess<A, U extends core.$ZodType>(
|
|
1067
|
+
// fn: (arg: unknown, ctx: core.ParsePayload) => A,
|
|
1068
|
+
// schema: U,
|
|
1069
|
+
// params?: ZodPreprocessParams
|
|
1070
|
+
// ): ZodPipe<ZodTransform<A, unknown>, U> {
|
|
1071
|
+
// return pipe(transform(fn as any, params), schema as any, params);
|
|
1072
|
+
// }
|
|
1073
|
+
|
|
1074
|
+
// ZodMiniReadonly
|
|
1075
|
+
|
|
1076
|
+
export const ZodMiniReadonly = /*@__PURE__*/core.$constructor("ZodMiniReadonly", (inst, def) => {
|
|
1077
|
+
core.$ZodReadonly.init(inst, def);
|
|
1078
|
+
ZodMiniType.init(inst, def);
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
// @__NO_SIDE_EFFECTS__
|
|
1082
|
+
export function readonly(innerType) {
|
|
1083
|
+
return new ZodMiniReadonly({
|
|
1084
|
+
type: "readonly",
|
|
1085
|
+
innerType: innerType
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// ZodMiniTemplateLiteral
|
|
1090
|
+
|
|
1091
|
+
export const ZodMiniTemplateLiteral = /*@__PURE__*/core.$constructor("ZodMiniTemplateLiteral", (inst, def) => {
|
|
1092
|
+
core.$ZodTemplateLiteral.init(inst, def);
|
|
1093
|
+
ZodMiniType.init(inst, def);
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
// @__NO_SIDE_EFFECTS__
|
|
1097
|
+
export function templateLiteral(parts, params) {
|
|
1098
|
+
return new ZodMiniTemplateLiteral(_objectSpread({
|
|
1099
|
+
type: "template_literal",
|
|
1100
|
+
parts
|
|
1101
|
+
}, util.normalizeParams(params)));
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// ZodMiniLazy
|
|
1105
|
+
|
|
1106
|
+
export const ZodMiniLazy = /*@__PURE__*/core.$constructor("ZodMiniLazy", (inst, def) => {
|
|
1107
|
+
core.$ZodLazy.init(inst, def);
|
|
1108
|
+
ZodMiniType.init(inst, def);
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
// export function lazy<T extends object>(getter: () => T): T {
|
|
1112
|
+
// return util.createTransparentProxy<T>(getter);
|
|
1113
|
+
// }
|
|
1114
|
+
// @__NO_SIDE_EFFECTS__
|
|
1115
|
+
function _lazy(getter) {
|
|
1116
|
+
return new ZodMiniLazy({
|
|
1117
|
+
type: "lazy",
|
|
1118
|
+
getter: getter
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
export { _lazy as lazy };
|
|
1122
|
+
|
|
1123
|
+
// ZodMiniPromise
|
|
1124
|
+
|
|
1125
|
+
export const ZodMiniPromise = /*@__PURE__*/core.$constructor("ZodMiniPromise", (inst, def) => {
|
|
1126
|
+
core.$ZodPromise.init(inst, def);
|
|
1127
|
+
ZodMiniType.init(inst, def);
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
// @__NO_SIDE_EFFECTS__
|
|
1131
|
+
export function promise(innerType) {
|
|
1132
|
+
return new ZodMiniPromise({
|
|
1133
|
+
type: "promise",
|
|
1134
|
+
innerType: innerType
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// ZodMiniCustom
|
|
1139
|
+
|
|
1140
|
+
export const ZodMiniCustom = /*@__PURE__*/core.$constructor("ZodMiniCustom", (inst, def) => {
|
|
1141
|
+
core.$ZodCustom.init(inst, def);
|
|
1142
|
+
ZodMiniType.init(inst, def);
|
|
1143
|
+
});
|
|
1144
|
+
|
|
1145
|
+
// custom checks
|
|
1146
|
+
// @__NO_SIDE_EFFECTS__
|
|
1147
|
+
export function check(fn, params) {
|
|
1148
|
+
const ch = new core.$ZodCheck(_objectSpread({
|
|
1149
|
+
check: "custom"
|
|
1150
|
+
}, util.normalizeParams(params)));
|
|
1151
|
+
ch._zod.check = fn;
|
|
1152
|
+
return ch;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
// ZodCustom
|
|
1156
|
+
// custom schema
|
|
1157
|
+
// @__NO_SIDE_EFFECTS__
|
|
1158
|
+
export function custom(fn, _params) {
|
|
1159
|
+
return core._custom(ZodMiniCustom, fn !== null && fn !== void 0 ? fn : () => true, _params);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// refine
|
|
1163
|
+
// @__NO_SIDE_EFFECTS__
|
|
1164
|
+
export function refine(fn) {
|
|
1165
|
+
let _params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1166
|
+
return core._refine(ZodMiniCustom, fn, _params);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
// superRefine
|
|
1170
|
+
// @__NO_SIDE_EFFECTS__
|
|
1171
|
+
export function superRefine(fn) {
|
|
1172
|
+
return core._superRefine(fn);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
// Re-export describe and meta from core
|
|
1176
|
+
export const describe = core.describe;
|
|
1177
|
+
export const meta = core.meta;
|
|
1178
|
+
|
|
1179
|
+
// instanceof
|
|
1180
|
+
class Class {
|
|
1181
|
+
constructor() {}
|
|
1182
|
+
}
|
|
1183
|
+
// @__NO_SIDE_EFFECTS__
|
|
1184
|
+
function _instanceof(cls) {
|
|
1185
|
+
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1186
|
+
const inst = custom(data => data instanceof cls, params);
|
|
1187
|
+
inst._zod.bag.Class = cls;
|
|
1188
|
+
// Override check to emit invalid_type instead of custom
|
|
1189
|
+
inst._zod.check = payload => {
|
|
1190
|
+
if (!(payload.value instanceof cls)) {
|
|
1191
|
+
var _inst$_zod$def$path;
|
|
1192
|
+
payload.issues.push({
|
|
1193
|
+
code: "invalid_type",
|
|
1194
|
+
expected: cls.name,
|
|
1195
|
+
input: payload.value,
|
|
1196
|
+
inst,
|
|
1197
|
+
path: [...((_inst$_zod$def$path = inst._zod.def.path) !== null && _inst$_zod$def$path !== void 0 ? _inst$_zod$def$path : [])]
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
return inst;
|
|
1202
|
+
}
|
|
1203
|
+
export { _instanceof as instanceof };
|
|
1204
|
+
|
|
1205
|
+
// stringbool
|
|
1206
|
+
export const stringbool = function () {
|
|
1207
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1208
|
+
args[_key2] = arguments[_key2];
|
|
1209
|
+
}
|
|
1210
|
+
return core._stringbool({
|
|
1211
|
+
Codec: ZodMiniCodec,
|
|
1212
|
+
Boolean: ZodMiniBoolean,
|
|
1213
|
+
String: ZodMiniString
|
|
1214
|
+
}, ...args);
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
// json
|
|
1218
|
+
|
|
1219
|
+
// json
|
|
1220
|
+
|
|
1221
|
+
// @__NO_SIDE_EFFECTS__
|
|
1222
|
+
export function json() {
|
|
1223
|
+
const jsonSchema = _lazy(() => {
|
|
1224
|
+
return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
|
|
1225
|
+
});
|
|
1226
|
+
return jsonSchema;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
// ZodMiniFunction
|
|
1230
|
+
|
|
1231
|
+
export const ZodMiniFunction = /*@__PURE__*/core.$constructor("ZodMiniFunction", (inst, def) => {
|
|
1232
|
+
core.$ZodFunction.init(inst, def);
|
|
1233
|
+
ZodMiniType.init(inst, def);
|
|
1234
|
+
});
|
|
1235
|
+
// @__NO_SIDE_EFFECTS__
|
|
1236
|
+
export function _function(params) {
|
|
1237
|
+
var _params$input, _params$output;
|
|
1238
|
+
return new ZodMiniFunction({
|
|
1239
|
+
type: "function",
|
|
1240
|
+
input: Array.isArray(params === null || params === void 0 ? void 0 : params.input) ? tuple(params === null || params === void 0 ? void 0 : params.input) : (_params$input = params === null || params === void 0 ? void 0 : params.input) !== null && _params$input !== void 0 ? _params$input : array(unknown()),
|
|
1241
|
+
output: (_params$output = params === null || params === void 0 ? void 0 : params.output) !== null && _params$output !== void 0 ? _params$output : unknown()
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
export { _function as function };
|