@intlayer/design-system 6.0.2 → 6.1.0
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/README.md +249 -56
- package/dist/.vite/manifest.json +42 -62
- package/dist/{better-auth.CMQ3rA-I-7umXOENE.js → better-auth.CiuwFiHM-7umXOENE.js} +1 -1
- package/dist/better-auth.CiuwFiHM-7umXOENE.js.map +1 -0
- package/dist/{better-auth.CMQ3rA-I-C2nBKRMa.cjs → better-auth.CiuwFiHM-C2nBKRMa.cjs} +1 -1
- package/dist/better-auth.CiuwFiHM-C2nBKRMa.cjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +12 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +13 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs +1 -1
- package/dist/components/Form/FormBase.cjs +1 -1
- package/dist/components/Form/FormBase.mjs +1 -1
- package/dist/components/Form/elements/FormElementWrapper.cjs +2 -2
- package/dist/components/Form/elements/FormElementWrapper.mjs +2 -2
- package/dist/components/IDE/CodeContext.cjs +1 -1
- package/dist/components/IDE/CodeContext.mjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +1 -1
- package/dist/components/MarkDownRender/index.cjs +1 -1
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.mjs +1 -1
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.mjs +1 -1
- package/dist/components/Navbar/DesktopNavbar.cjs +14 -16
- package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.mjs +14 -16
- package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +1 -1
- package/dist/components/Navbar/index.cjs +1 -1
- package/dist/components/Navbar/index.mjs +1 -1
- package/dist/components/SwitchSelector/index.cjs +1 -1
- package/dist/components/SwitchSelector/index.mjs +1 -1
- package/dist/components/TabSelector/TabSelector.cjs +1 -1
- package/dist/components/TabSelector/TabSelector.mjs +1 -1
- package/dist/hooks/auth.cjs +13 -7
- package/dist/hooks/auth.cjs.map +1 -1
- package/dist/hooks/auth.mjs +12 -6
- package/dist/hooks/auth.mjs.map +1 -1
- package/dist/hooks/reactQuery.cjs +1 -1
- package/dist/hooks/reactQuery.d.ts +111 -43
- package/dist/hooks/reactQuery.d.ts.map +1 -1
- package/dist/hooks/reactQuery.mjs +1 -1
- package/dist/hooks/useAuth/useAuth.cjs.map +1 -1
- package/dist/hooks/useAuth/useAuth.d.ts +1 -0
- package/dist/hooks/useAuth/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth/useAuth.mjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.d.ts +1 -1
- package/dist/hooks/useAuth/useSession.d.ts +88 -1
- package/dist/hooks/useAuth/useSession.d.ts.map +1 -1
- package/dist/hooks/useUser/index.cjs +1 -1
- package/dist/hooks/useUser/index.d.ts +18 -2
- package/dist/hooks/useUser/index.d.ts.map +1 -1
- package/dist/hooks/useUser/index.mjs +1 -1
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/{schemas-lh5OFOvX.cjs → schemas-0lUZlFWF.cjs} +703 -240
- package/dist/schemas-0lUZlFWF.cjs.map +1 -0
- package/dist/{schemas-DEXdAbCK.js → schemas-BG_GIt-j.js} +465 -2
- package/dist/schemas-BG_GIt-j.js.map +1 -0
- package/dist/zod-CCm3hUBS.js +210 -0
- package/dist/zod-CCm3hUBS.js.map +1 -0
- package/dist/zod-CvjrdkEg.cjs +209 -0
- package/dist/zod-CvjrdkEg.cjs.map +1 -0
- package/package.json +45 -43
- package/dist/better-auth.CMQ3rA-I-7umXOENE.js.map +0 -1
- package/dist/better-auth.CMQ3rA-I-C2nBKRMa.cjs.map +0 -1
- package/dist/parse-Ltyyb1op.cjs +0 -509
- package/dist/parse-Ltyyb1op.cjs.map +0 -1
- package/dist/parse-Vrm0h1r9.js +0 -510
- package/dist/parse-Vrm0h1r9.js.map +0 -1
- package/dist/schemas-DEXdAbCK.js.map +0 -1
- package/dist/schemas-lh5OFOvX.cjs.map +0 -1
- package/dist/zod-BvUVjPTw.cjs +0 -91
- package/dist/zod-BvUVjPTw.cjs.map +0 -1
- package/dist/zod-CJrbzxwg.js +0 -92
- package/dist/zod-CJrbzxwg.js.map +0 -1
|
@@ -1,4 +1,467 @@
|
|
|
1
|
-
|
|
1
|
+
function $constructor(name, initializer2, params) {
|
|
2
|
+
function init(inst, def) {
|
|
3
|
+
var _a;
|
|
4
|
+
Object.defineProperty(inst, "_zod", {
|
|
5
|
+
value: inst._zod ?? {},
|
|
6
|
+
enumerable: false
|
|
7
|
+
});
|
|
8
|
+
(_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
|
|
9
|
+
inst._zod.traits.add(name);
|
|
10
|
+
initializer2(inst, def);
|
|
11
|
+
for (const k in _.prototype) {
|
|
12
|
+
if (!(k in inst))
|
|
13
|
+
Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
|
|
14
|
+
}
|
|
15
|
+
inst._zod.constr = _;
|
|
16
|
+
inst._zod.def = def;
|
|
17
|
+
}
|
|
18
|
+
const Parent = params?.Parent ?? Object;
|
|
19
|
+
class Definition extends Parent {
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
22
|
+
function _(def) {
|
|
23
|
+
var _a;
|
|
24
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
25
|
+
init(inst, def);
|
|
26
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
27
|
+
for (const fn of inst._zod.deferred) {
|
|
28
|
+
fn();
|
|
29
|
+
}
|
|
30
|
+
return inst;
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(_, "init", { value: init });
|
|
33
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
34
|
+
value: (inst) => {
|
|
35
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
36
|
+
return true;
|
|
37
|
+
return inst?._zod?.traits?.has(name);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(_, "name", { value: name });
|
|
41
|
+
return _;
|
|
42
|
+
}
|
|
43
|
+
class $ZodAsyncError extends Error {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const globalConfig = {};
|
|
49
|
+
function config(newConfig) {
|
|
50
|
+
return globalConfig;
|
|
51
|
+
}
|
|
52
|
+
function getEnumValues(entries) {
|
|
53
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
54
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
55
|
+
return values;
|
|
56
|
+
}
|
|
57
|
+
function jsonStringifyReplacer(_, value) {
|
|
58
|
+
if (typeof value === "bigint")
|
|
59
|
+
return value.toString();
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
function cached(getter) {
|
|
63
|
+
return {
|
|
64
|
+
get value() {
|
|
65
|
+
{
|
|
66
|
+
const value = getter();
|
|
67
|
+
Object.defineProperty(this, "value", { value });
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function nullish(input) {
|
|
74
|
+
return input === null || input === void 0;
|
|
75
|
+
}
|
|
76
|
+
function cleanRegex(source) {
|
|
77
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
78
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
79
|
+
return source.slice(start, end);
|
|
80
|
+
}
|
|
81
|
+
function defineLazy(object2, key, getter) {
|
|
82
|
+
Object.defineProperty(object2, key, {
|
|
83
|
+
get() {
|
|
84
|
+
{
|
|
85
|
+
const value = getter();
|
|
86
|
+
object2[key] = value;
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
set(v) {
|
|
91
|
+
Object.defineProperty(object2, key, {
|
|
92
|
+
value: v
|
|
93
|
+
// configurable: true,
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
configurable: true
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function assignProp(target, prop, value) {
|
|
100
|
+
Object.defineProperty(target, prop, {
|
|
101
|
+
value,
|
|
102
|
+
writable: true,
|
|
103
|
+
enumerable: true,
|
|
104
|
+
configurable: true
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function esc(str) {
|
|
108
|
+
return JSON.stringify(str);
|
|
109
|
+
}
|
|
110
|
+
const captureStackTrace = Error.captureStackTrace ? Error.captureStackTrace : (..._args) => {
|
|
111
|
+
};
|
|
112
|
+
function isObject(data) {
|
|
113
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
114
|
+
}
|
|
115
|
+
const allowsEval = cached(() => {
|
|
116
|
+
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const F = Function;
|
|
121
|
+
new F("");
|
|
122
|
+
return true;
|
|
123
|
+
} catch (_) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
function isPlainObject(o) {
|
|
128
|
+
if (isObject(o) === false)
|
|
129
|
+
return false;
|
|
130
|
+
const ctor = o.constructor;
|
|
131
|
+
if (ctor === void 0)
|
|
132
|
+
return true;
|
|
133
|
+
const prot = ctor.prototype;
|
|
134
|
+
if (isObject(prot) === false)
|
|
135
|
+
return false;
|
|
136
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
const propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
142
|
+
function escapeRegex(str) {
|
|
143
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
144
|
+
}
|
|
145
|
+
function clone(inst, def, params) {
|
|
146
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
147
|
+
if (!def || params?.parent)
|
|
148
|
+
cl._zod.parent = inst;
|
|
149
|
+
return cl;
|
|
150
|
+
}
|
|
151
|
+
function normalizeParams(_params) {
|
|
152
|
+
const params = _params;
|
|
153
|
+
if (!params)
|
|
154
|
+
return {};
|
|
155
|
+
if (typeof params === "string")
|
|
156
|
+
return { error: () => params };
|
|
157
|
+
if (params?.message !== void 0) {
|
|
158
|
+
if (params?.error !== void 0)
|
|
159
|
+
throw new Error("Cannot specify both `message` and `error` params");
|
|
160
|
+
params.error = params.message;
|
|
161
|
+
}
|
|
162
|
+
delete params.message;
|
|
163
|
+
if (typeof params.error === "string")
|
|
164
|
+
return { ...params, error: () => params.error };
|
|
165
|
+
return params;
|
|
166
|
+
}
|
|
167
|
+
function optionalKeys(shape) {
|
|
168
|
+
return Object.keys(shape).filter((k) => {
|
|
169
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function pick(schema, mask) {
|
|
173
|
+
const newShape = {};
|
|
174
|
+
const currDef = schema._zod.def;
|
|
175
|
+
for (const key in mask) {
|
|
176
|
+
if (!(key in currDef.shape)) {
|
|
177
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
178
|
+
}
|
|
179
|
+
if (!mask[key])
|
|
180
|
+
continue;
|
|
181
|
+
newShape[key] = currDef.shape[key];
|
|
182
|
+
}
|
|
183
|
+
return clone(schema, {
|
|
184
|
+
...schema._zod.def,
|
|
185
|
+
shape: newShape,
|
|
186
|
+
checks: []
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function omit(schema, mask) {
|
|
190
|
+
const newShape = { ...schema._zod.def.shape };
|
|
191
|
+
const currDef = schema._zod.def;
|
|
192
|
+
for (const key in mask) {
|
|
193
|
+
if (!(key in currDef.shape)) {
|
|
194
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
195
|
+
}
|
|
196
|
+
if (!mask[key])
|
|
197
|
+
continue;
|
|
198
|
+
delete newShape[key];
|
|
199
|
+
}
|
|
200
|
+
return clone(schema, {
|
|
201
|
+
...schema._zod.def,
|
|
202
|
+
shape: newShape,
|
|
203
|
+
checks: []
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function extend(schema, shape) {
|
|
207
|
+
if (!isPlainObject(shape)) {
|
|
208
|
+
throw new Error("Invalid input to extend: expected a plain object");
|
|
209
|
+
}
|
|
210
|
+
const def = {
|
|
211
|
+
...schema._zod.def,
|
|
212
|
+
get shape() {
|
|
213
|
+
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
214
|
+
assignProp(this, "shape", _shape);
|
|
215
|
+
return _shape;
|
|
216
|
+
},
|
|
217
|
+
checks: []
|
|
218
|
+
// delete existing checks
|
|
219
|
+
};
|
|
220
|
+
return clone(schema, def);
|
|
221
|
+
}
|
|
222
|
+
function merge(a, b) {
|
|
223
|
+
return clone(a, {
|
|
224
|
+
...a._zod.def,
|
|
225
|
+
get shape() {
|
|
226
|
+
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
227
|
+
assignProp(this, "shape", _shape);
|
|
228
|
+
return _shape;
|
|
229
|
+
},
|
|
230
|
+
catchall: b._zod.def.catchall,
|
|
231
|
+
checks: []
|
|
232
|
+
// delete existing checks
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function partial(Class, schema, mask) {
|
|
236
|
+
const oldShape = schema._zod.def.shape;
|
|
237
|
+
const shape = { ...oldShape };
|
|
238
|
+
if (mask) {
|
|
239
|
+
for (const key in mask) {
|
|
240
|
+
if (!(key in oldShape)) {
|
|
241
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
242
|
+
}
|
|
243
|
+
if (!mask[key])
|
|
244
|
+
continue;
|
|
245
|
+
shape[key] = Class ? new Class({
|
|
246
|
+
type: "optional",
|
|
247
|
+
innerType: oldShape[key]
|
|
248
|
+
}) : oldShape[key];
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
for (const key in oldShape) {
|
|
252
|
+
shape[key] = Class ? new Class({
|
|
253
|
+
type: "optional",
|
|
254
|
+
innerType: oldShape[key]
|
|
255
|
+
}) : oldShape[key];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return clone(schema, {
|
|
259
|
+
...schema._zod.def,
|
|
260
|
+
shape,
|
|
261
|
+
checks: []
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function required(Class, schema, mask) {
|
|
265
|
+
const oldShape = schema._zod.def.shape;
|
|
266
|
+
const shape = { ...oldShape };
|
|
267
|
+
if (mask) {
|
|
268
|
+
for (const key in mask) {
|
|
269
|
+
if (!(key in shape)) {
|
|
270
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
271
|
+
}
|
|
272
|
+
if (!mask[key])
|
|
273
|
+
continue;
|
|
274
|
+
shape[key] = new Class({
|
|
275
|
+
type: "nonoptional",
|
|
276
|
+
innerType: oldShape[key]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
for (const key in oldShape) {
|
|
281
|
+
shape[key] = new Class({
|
|
282
|
+
type: "nonoptional",
|
|
283
|
+
innerType: oldShape[key]
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return clone(schema, {
|
|
288
|
+
...schema._zod.def,
|
|
289
|
+
shape,
|
|
290
|
+
// optional: [],
|
|
291
|
+
checks: []
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function aborted(x, startIndex = 0) {
|
|
295
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
296
|
+
if (x.issues[i]?.continue !== true)
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
function prefixIssues(path, issues) {
|
|
302
|
+
return issues.map((iss) => {
|
|
303
|
+
var _a;
|
|
304
|
+
(_a = iss).path ?? (_a.path = []);
|
|
305
|
+
iss.path.unshift(path);
|
|
306
|
+
return iss;
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function unwrapMessage(message) {
|
|
310
|
+
return typeof message === "string" ? message : message?.message;
|
|
311
|
+
}
|
|
312
|
+
function finalizeIssue(iss, ctx, config2) {
|
|
313
|
+
const full = { ...iss, path: iss.path ?? [] };
|
|
314
|
+
if (!iss.message) {
|
|
315
|
+
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
316
|
+
full.message = message;
|
|
317
|
+
}
|
|
318
|
+
delete full.inst;
|
|
319
|
+
delete full.continue;
|
|
320
|
+
if (!ctx?.reportInput) {
|
|
321
|
+
delete full.input;
|
|
322
|
+
}
|
|
323
|
+
return full;
|
|
324
|
+
}
|
|
325
|
+
function getLengthableOrigin(input) {
|
|
326
|
+
if (Array.isArray(input))
|
|
327
|
+
return "array";
|
|
328
|
+
if (typeof input === "string")
|
|
329
|
+
return "string";
|
|
330
|
+
return "unknown";
|
|
331
|
+
}
|
|
332
|
+
function issue(...args) {
|
|
333
|
+
const [iss, input, inst] = args;
|
|
334
|
+
if (typeof iss === "string") {
|
|
335
|
+
return {
|
|
336
|
+
message: iss,
|
|
337
|
+
code: "custom",
|
|
338
|
+
input,
|
|
339
|
+
inst
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
return { ...iss };
|
|
343
|
+
}
|
|
344
|
+
const initializer$1 = (inst, def) => {
|
|
345
|
+
inst.name = "$ZodError";
|
|
346
|
+
Object.defineProperty(inst, "_zod", {
|
|
347
|
+
value: inst._zod,
|
|
348
|
+
enumerable: false
|
|
349
|
+
});
|
|
350
|
+
Object.defineProperty(inst, "issues", {
|
|
351
|
+
value: def,
|
|
352
|
+
enumerable: false
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(inst, "message", {
|
|
355
|
+
get() {
|
|
356
|
+
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
357
|
+
},
|
|
358
|
+
enumerable: true
|
|
359
|
+
// configurable: false,
|
|
360
|
+
});
|
|
361
|
+
Object.defineProperty(inst, "toString", {
|
|
362
|
+
value: () => inst.message,
|
|
363
|
+
enumerable: false
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
367
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
368
|
+
function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
369
|
+
const fieldErrors = {};
|
|
370
|
+
const formErrors = [];
|
|
371
|
+
for (const sub of error.issues) {
|
|
372
|
+
if (sub.path.length > 0) {
|
|
373
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
374
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
375
|
+
} else {
|
|
376
|
+
formErrors.push(mapper(sub));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return { formErrors, fieldErrors };
|
|
380
|
+
}
|
|
381
|
+
function formatError(error, _mapper) {
|
|
382
|
+
const mapper = _mapper || function(issue2) {
|
|
383
|
+
return issue2.message;
|
|
384
|
+
};
|
|
385
|
+
const fieldErrors = { _errors: [] };
|
|
386
|
+
const processError = (error2) => {
|
|
387
|
+
for (const issue2 of error2.issues) {
|
|
388
|
+
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
389
|
+
issue2.errors.map((issues) => processError({ issues }));
|
|
390
|
+
} else if (issue2.code === "invalid_key") {
|
|
391
|
+
processError({ issues: issue2.issues });
|
|
392
|
+
} else if (issue2.code === "invalid_element") {
|
|
393
|
+
processError({ issues: issue2.issues });
|
|
394
|
+
} else if (issue2.path.length === 0) {
|
|
395
|
+
fieldErrors._errors.push(mapper(issue2));
|
|
396
|
+
} else {
|
|
397
|
+
let curr = fieldErrors;
|
|
398
|
+
let i = 0;
|
|
399
|
+
while (i < issue2.path.length) {
|
|
400
|
+
const el = issue2.path[i];
|
|
401
|
+
const terminal = i === issue2.path.length - 1;
|
|
402
|
+
if (!terminal) {
|
|
403
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
404
|
+
} else {
|
|
405
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
406
|
+
curr[el]._errors.push(mapper(issue2));
|
|
407
|
+
}
|
|
408
|
+
curr = curr[el];
|
|
409
|
+
i++;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
processError(error);
|
|
415
|
+
return fieldErrors;
|
|
416
|
+
}
|
|
417
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
418
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
419
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
420
|
+
if (result instanceof Promise) {
|
|
421
|
+
throw new $ZodAsyncError();
|
|
422
|
+
}
|
|
423
|
+
if (result.issues.length) {
|
|
424
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
425
|
+
captureStackTrace(e, _params?.callee);
|
|
426
|
+
throw e;
|
|
427
|
+
}
|
|
428
|
+
return result.value;
|
|
429
|
+
};
|
|
430
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
431
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
432
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
433
|
+
if (result instanceof Promise)
|
|
434
|
+
result = await result;
|
|
435
|
+
if (result.issues.length) {
|
|
436
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
437
|
+
captureStackTrace(e, params?.callee);
|
|
438
|
+
throw e;
|
|
439
|
+
}
|
|
440
|
+
return result.value;
|
|
441
|
+
};
|
|
442
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
443
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
444
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
445
|
+
if (result instanceof Promise) {
|
|
446
|
+
throw new $ZodAsyncError();
|
|
447
|
+
}
|
|
448
|
+
return result.issues.length ? {
|
|
449
|
+
success: false,
|
|
450
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
451
|
+
} : { success: true, data: result.value };
|
|
452
|
+
};
|
|
453
|
+
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
454
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
455
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
456
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
457
|
+
if (result instanceof Promise)
|
|
458
|
+
result = await result;
|
|
459
|
+
return result.issues.length ? {
|
|
460
|
+
success: false,
|
|
461
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
462
|
+
} : { success: true, data: result.value };
|
|
463
|
+
};
|
|
464
|
+
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
2
465
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
3
466
|
const cuid2 = /^[0-9a-z]+$/;
|
|
4
467
|
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -2281,4 +2744,4 @@ export {
|
|
|
2281
2744
|
object as o,
|
|
2282
2745
|
string as s
|
|
2283
2746
|
};
|
|
2284
|
-
//# sourceMappingURL=schemas-
|
|
2747
|
+
//# sourceMappingURL=schemas-BG_GIt-j.js.map
|