@loopstack/loopstack-studio 0.23.1 → 0.24.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/dist/api/index.js +12 -10
- package/dist/api/secrets.js +16 -0
- package/dist/components/dynamic-form/ArrayController.js +68 -64
- package/dist/components/dynamic-form/Form.js +46 -40
- package/dist/components/dynamic-form/FormElement.js +1 -1
- package/dist/components/dynamic-form/FormElementHeader.js +2 -2
- package/dist/components/dynamic-form/ObjectController.js +24 -21
- package/dist/components/dynamic-form/fields/BaseFieldWrapper.js +1 -1
- package/dist/components/dynamic-form/fields/InputField.js +20 -19
- package/dist/components/dynamic-form/fields/RadioField.js +18 -18
- package/dist/components/dynamic-form/fields/SelectField.js +19 -19
- package/dist/components/dynamic-form/fields/TextareaField.js +17 -17
- package/dist/components/layout/MainLayout.js +18 -31
- package/dist/components/layout/StudioSidebar.js +168 -108
- package/dist/components/page/PageBreadcrumbs.js +79 -32
- package/dist/components/ui-widgets/UiWidget.js +36 -27
- package/dist/components/ui-widgets/widgets/SecretInput.js +42 -0
- package/dist/features/code-explorer/components/FileContentViewer.js +47 -30
- package/dist/features/documents/components/DocumentList.js +5 -1
- package/dist/features/documents/renderers/AiMessage.js +11 -11
- package/dist/features/documents/renderers/DocumentFormRenderer.js +17 -11
- package/dist/features/workbench/components/WorkbenchFilesPanel.js +32 -25
- package/dist/features/workbench/components/WorkbenchFloatingPanel.js +57 -49
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +46 -34
- package/dist/features/workbench/components/WorkbenchSecretsPanel.js +182 -0
- package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +132 -117
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/query-keys.js +41 -34
- package/dist/hooks/useSecrets.js +69 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +2 -2
- package/dist/pages/DashboardPage.js +87 -35
- package/dist/pages/EmbedWorkbenchPage.js +43 -39
- package/dist/types/ai.types.js +13 -0
- package/package.json +2 -3
- package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -65
- package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -1008
- package/dist/node_modules/ai/dist/index.js +0 -1083
- package/dist/node_modules/zod/v3/ZodError.js +0 -79
- package/dist/node_modules/zod/v3/errors.js +0 -6
- package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -5
- package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -90
- package/dist/node_modules/zod/v3/helpers/util.js +0 -72
- package/dist/node_modules/zod/v3/locales/en.js +0 -58
- package/dist/node_modules/zod/v3/types.js +0 -2425
- package/dist/node_modules/zod/v4/classic/errors.js +0 -21
- package/dist/node_modules/zod/v4/classic/iso.js +0 -29
- package/dist/node_modules/zod/v4/classic/parse.js +0 -4
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -392
- package/dist/node_modules/zod/v4/core/api.js +0 -532
- package/dist/node_modules/zod/v4/core/checks.js +0 -283
- package/dist/node_modules/zod/v4/core/core.js +0 -44
- package/dist/node_modules/zod/v4/core/doc.js +0 -21
- package/dist/node_modules/zod/v4/core/errors.js +0 -40
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -305
- package/dist/node_modules/zod/v4/core/parse.js +0 -66
- package/dist/node_modules/zod/v4/core/regexes.js +0 -28
- package/dist/node_modules/zod/v4/core/registries.js +0 -38
- package/dist/node_modules/zod/v4/core/schemas.js +0 -863
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -220
- package/dist/node_modules/zod/v4/core/util.js +0 -267
- package/dist/node_modules/zod/v4/core/versions.js +0 -6
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { globalRegistry } from "./registries.js";
|
|
2
|
-
function initializeContext(t) {
|
|
3
|
-
let n = t?.target ?? "draft-2020-12";
|
|
4
|
-
return n === "draft-4" && (n = "draft-04"), n === "draft-7" && (n = "draft-07"), {
|
|
5
|
-
processors: t.processors ?? {},
|
|
6
|
-
metadataRegistry: t?.metadata ?? globalRegistry,
|
|
7
|
-
target: n,
|
|
8
|
-
unrepresentable: t?.unrepresentable ?? "throw",
|
|
9
|
-
override: t?.override ?? (() => {}),
|
|
10
|
-
io: t?.io ?? "output",
|
|
11
|
-
counter: 0,
|
|
12
|
-
seen: /* @__PURE__ */ new Map(),
|
|
13
|
-
cycles: t?.cycles ?? "ref",
|
|
14
|
-
reused: t?.reused ?? "inline",
|
|
15
|
-
external: t?.external ?? void 0
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function process(e, t, r = {
|
|
19
|
-
path: [],
|
|
20
|
-
schemaPath: []
|
|
21
|
-
}) {
|
|
22
|
-
var i;
|
|
23
|
-
let o = e._zod.def, s = t.seen.get(e);
|
|
24
|
-
if (s) return s.count++, r.schemaPath.includes(e) && (s.cycle = r.path), s.schema;
|
|
25
|
-
let c = {
|
|
26
|
-
schema: {},
|
|
27
|
-
count: 1,
|
|
28
|
-
cycle: void 0,
|
|
29
|
-
path: r.path
|
|
30
|
-
};
|
|
31
|
-
t.seen.set(e, c);
|
|
32
|
-
let l = e._zod.toJSONSchema?.();
|
|
33
|
-
if (l) c.schema = l;
|
|
34
|
-
else {
|
|
35
|
-
let i = {
|
|
36
|
-
...r,
|
|
37
|
-
schemaPath: [...r.schemaPath, e],
|
|
38
|
-
path: r.path
|
|
39
|
-
};
|
|
40
|
-
if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, c.schema, i);
|
|
41
|
-
else {
|
|
42
|
-
let n = c.schema, r = t.processors[o.type];
|
|
43
|
-
if (!r) throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
|
|
44
|
-
r(e, t, n, i);
|
|
45
|
-
}
|
|
46
|
-
let a = e._zod.parent;
|
|
47
|
-
a && (c.ref ||= a, process(a, t, i), t.seen.get(a).isParent = !0);
|
|
48
|
-
}
|
|
49
|
-
let u = t.metadataRegistry.get(e);
|
|
50
|
-
return u && Object.assign(c.schema, u), t.io === "input" && isTransforming(e) && (delete c.schema.examples, delete c.schema.default), t.io === "input" && c.schema._prefault && ((i = c.schema).default ?? (i.default = c.schema._prefault)), delete c.schema._prefault, t.seen.get(e).schema;
|
|
51
|
-
}
|
|
52
|
-
function extractDefs(e, t) {
|
|
53
|
-
let n = e.seen.get(t);
|
|
54
|
-
if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
|
|
55
|
-
let r = /* @__PURE__ */ new Map();
|
|
56
|
-
for (let t of e.seen.entries()) {
|
|
57
|
-
let n = e.metadataRegistry.get(t[0])?.id;
|
|
58
|
-
if (n) {
|
|
59
|
-
let e = r.get(n);
|
|
60
|
-
if (e && e !== t[0]) throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
61
|
-
r.set(n, t[0]);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
let i = (t) => {
|
|
65
|
-
let r = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
66
|
-
if (e.external) {
|
|
67
|
-
let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e);
|
|
68
|
-
if (n) return { ref: i(n) };
|
|
69
|
-
let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`;
|
|
70
|
-
return t[1].defId = a, {
|
|
71
|
-
defId: a,
|
|
72
|
-
ref: `${i("__shared")}#/${r}/${a}`
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
if (t[1] === n) return { ref: "#" };
|
|
76
|
-
let i = `#/${r}/`, a = t[1].schema.id ?? `__schema${e.counter++}`;
|
|
77
|
-
return {
|
|
78
|
-
defId: a,
|
|
79
|
-
ref: i + a
|
|
80
|
-
};
|
|
81
|
-
}, a = (e) => {
|
|
82
|
-
if (e[1].schema.$ref) return;
|
|
83
|
-
let t = e[1], { ref: n, defId: r } = i(e);
|
|
84
|
-
t.def = { ...t.schema }, r && (t.defId = r);
|
|
85
|
-
let a = t.schema;
|
|
86
|
-
for (let e in a) delete a[e];
|
|
87
|
-
a.$ref = n;
|
|
88
|
-
};
|
|
89
|
-
if (e.cycles === "throw") for (let t of e.seen.entries()) {
|
|
90
|
-
let e = t[1];
|
|
91
|
-
if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
92
|
-
|
|
93
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
94
|
-
}
|
|
95
|
-
for (let n of e.seen.entries()) {
|
|
96
|
-
let r = n[1];
|
|
97
|
-
if (t === n[0]) {
|
|
98
|
-
a(n);
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
if (e.external) {
|
|
102
|
-
let r = e.external.registry.get(n[0])?.id;
|
|
103
|
-
if (t !== n[0] && r) {
|
|
104
|
-
a(n);
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (e.metadataRegistry.get(n[0])?.id) {
|
|
109
|
-
a(n);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
if (r.cycle) {
|
|
113
|
-
a(n);
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
if (r.count > 1 && e.reused === "ref") {
|
|
117
|
-
a(n);
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function finalize(e, t) {
|
|
123
|
-
let n = e.seen.get(t);
|
|
124
|
-
if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
|
|
125
|
-
let r = (t) => {
|
|
126
|
-
let n = e.seen.get(t);
|
|
127
|
-
if (n.ref === null) return;
|
|
128
|
-
let i = n.def ?? n.schema, a = { ...i }, o = n.ref;
|
|
129
|
-
if (n.ref = null, o) {
|
|
130
|
-
r(o);
|
|
131
|
-
let n = e.seen.get(o), s = n.schema;
|
|
132
|
-
if (s.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (i.allOf = i.allOf ?? [], i.allOf.push(s)) : Object.assign(i, s), Object.assign(i, a), t._zod.parent === o) for (let e in i) e === "$ref" || e === "allOf" || e in a || delete i[e];
|
|
133
|
-
if (s.$ref && n.def) for (let e in i) e === "$ref" || e === "allOf" || e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e];
|
|
134
|
-
}
|
|
135
|
-
let s = t._zod.parent;
|
|
136
|
-
if (s && s !== o) {
|
|
137
|
-
r(s);
|
|
138
|
-
let t = e.seen.get(s);
|
|
139
|
-
if (t?.schema.$ref && (i.$ref = t.schema.$ref, t.def)) for (let e in i) e === "$ref" || e === "allOf" || e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e];
|
|
140
|
-
}
|
|
141
|
-
e.override({
|
|
142
|
-
zodSchema: t,
|
|
143
|
-
jsonSchema: i,
|
|
144
|
-
path: n.path ?? []
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
for (let t of [...e.seen.entries()].reverse()) r(t[0]);
|
|
148
|
-
let i = {};
|
|
149
|
-
if (e.target === "draft-2020-12" ? i.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? i.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? i.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
|
|
150
|
-
let n = e.external.registry.get(t)?.id;
|
|
151
|
-
if (!n) throw Error("Schema is missing an `id` property");
|
|
152
|
-
i.$id = e.external.uri(n);
|
|
153
|
-
}
|
|
154
|
-
Object.assign(i, n.def ?? n.schema);
|
|
155
|
-
let a = e.external?.defs ?? {};
|
|
156
|
-
for (let t of e.seen.entries()) {
|
|
157
|
-
let e = t[1];
|
|
158
|
-
e.def && e.defId && (a[e.defId] = e.def);
|
|
159
|
-
}
|
|
160
|
-
e.external || Object.keys(a).length > 0 && (e.target === "draft-2020-12" ? i.$defs = a : i.definitions = a);
|
|
161
|
-
try {
|
|
162
|
-
let n = JSON.parse(JSON.stringify(i));
|
|
163
|
-
return Object.defineProperty(n, "~standard", {
|
|
164
|
-
value: {
|
|
165
|
-
...t["~standard"],
|
|
166
|
-
jsonSchema: {
|
|
167
|
-
input: createStandardJSONSchemaMethod(t, "input", e.processors),
|
|
168
|
-
output: createStandardJSONSchemaMethod(t, "output", e.processors)
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
enumerable: !1,
|
|
172
|
-
writable: !1
|
|
173
|
-
}), n;
|
|
174
|
-
} catch {
|
|
175
|
-
throw Error("Error converting schema to JSON.");
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function isTransforming(e, t) {
|
|
179
|
-
let n = t ?? { seen: /* @__PURE__ */ new Set() };
|
|
180
|
-
if (n.seen.has(e)) return !1;
|
|
181
|
-
n.seen.add(e);
|
|
182
|
-
let r = e._zod.def;
|
|
183
|
-
if (r.type === "transform") return !0;
|
|
184
|
-
if (r.type === "array") return isTransforming(r.element, n);
|
|
185
|
-
if (r.type === "set") return isTransforming(r.valueType, n);
|
|
186
|
-
if (r.type === "lazy") return isTransforming(r.getter(), n);
|
|
187
|
-
if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault") return isTransforming(r.innerType, n);
|
|
188
|
-
if (r.type === "intersection") return isTransforming(r.left, n) || isTransforming(r.right, n);
|
|
189
|
-
if (r.type === "record" || r.type === "map") return isTransforming(r.keyType, n) || isTransforming(r.valueType, n);
|
|
190
|
-
if (r.type === "pipe") return isTransforming(r.in, n) || isTransforming(r.out, n);
|
|
191
|
-
if (r.type === "object") {
|
|
192
|
-
for (let e in r.shape) if (isTransforming(r.shape[e], n)) return !0;
|
|
193
|
-
return !1;
|
|
194
|
-
}
|
|
195
|
-
if (r.type === "union") {
|
|
196
|
-
for (let e of r.options) if (isTransforming(e, n)) return !0;
|
|
197
|
-
return !1;
|
|
198
|
-
}
|
|
199
|
-
if (r.type === "tuple") {
|
|
200
|
-
for (let e of r.items) if (isTransforming(e, n)) return !0;
|
|
201
|
-
return !!(r.rest && isTransforming(r.rest, n));
|
|
202
|
-
}
|
|
203
|
-
return !1;
|
|
204
|
-
}
|
|
205
|
-
const createToJSONSchemaMethod = (e, a = {}) => (o) => {
|
|
206
|
-
let s = initializeContext({
|
|
207
|
-
...o,
|
|
208
|
-
processors: a
|
|
209
|
-
});
|
|
210
|
-
return process(e, s), extractDefs(s, e), finalize(s, e);
|
|
211
|
-
}, createStandardJSONSchemaMethod = (e, a, o = {}) => (s) => {
|
|
212
|
-
let { libraryOptions: c, target: l } = s ?? {}, u = initializeContext({
|
|
213
|
-
...c ?? {},
|
|
214
|
-
target: l,
|
|
215
|
-
io: a,
|
|
216
|
-
processors: o
|
|
217
|
-
});
|
|
218
|
-
return process(e, u), extractDefs(u, e), finalize(u, e);
|
|
219
|
-
};
|
|
220
|
-
export { createStandardJSONSchemaMethod, createToJSONSchemaMethod, extractDefs, finalize, initializeContext, process };
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
function getEnumValues(f) {
|
|
2
|
-
let j = Object.values(f).filter((f) => typeof f == "number");
|
|
3
|
-
return Object.entries(f).filter(([f, M]) => j.indexOf(+f) === -1).map(([f, j]) => j);
|
|
4
|
-
}
|
|
5
|
-
function jsonStringifyReplacer(f, j) {
|
|
6
|
-
return typeof j == "bigint" ? j.toString() : j;
|
|
7
|
-
}
|
|
8
|
-
function cached(f) {
|
|
9
|
-
return { get value() {
|
|
10
|
-
{
|
|
11
|
-
let j = f();
|
|
12
|
-
return Object.defineProperty(this, "value", { value: j }), j;
|
|
13
|
-
}
|
|
14
|
-
throw Error("cached value already set");
|
|
15
|
-
} };
|
|
16
|
-
}
|
|
17
|
-
function nullish(f) {
|
|
18
|
-
return f == null;
|
|
19
|
-
}
|
|
20
|
-
function cleanRegex(f) {
|
|
21
|
-
let j = f.startsWith("^") ? 1 : 0, M = f.endsWith("$") ? f.length - 1 : f.length;
|
|
22
|
-
return f.slice(j, M);
|
|
23
|
-
}
|
|
24
|
-
function floatSafeRemainder(f, j) {
|
|
25
|
-
let M = (f.toString().split(".")[1] || "").length, N = j.toString(), P = (N.split(".")[1] || "").length;
|
|
26
|
-
if (P === 0 && /\d?e-\d?/.test(N)) {
|
|
27
|
-
let f = N.match(/\d?e-(\d?)/);
|
|
28
|
-
f?.[1] && (P = Number.parseInt(f[1]));
|
|
29
|
-
}
|
|
30
|
-
let F = M > P ? M : P;
|
|
31
|
-
return Number.parseInt(f.toFixed(F).replace(".", "")) % Number.parseInt(j.toFixed(F).replace(".", "")) / 10 ** F;
|
|
32
|
-
}
|
|
33
|
-
var EVALUATING = Symbol("evaluating");
|
|
34
|
-
function defineLazy(f, j, M) {
|
|
35
|
-
let N;
|
|
36
|
-
Object.defineProperty(f, j, {
|
|
37
|
-
get() {
|
|
38
|
-
if (N !== EVALUATING) return N === void 0 && (N = EVALUATING, N = M()), N;
|
|
39
|
-
},
|
|
40
|
-
set(M) {
|
|
41
|
-
Object.defineProperty(f, j, { value: M });
|
|
42
|
-
},
|
|
43
|
-
configurable: !0
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
function assignProp(f, j, M) {
|
|
47
|
-
Object.defineProperty(f, j, {
|
|
48
|
-
value: M,
|
|
49
|
-
writable: !0,
|
|
50
|
-
enumerable: !0,
|
|
51
|
-
configurable: !0
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function mergeDefs(...f) {
|
|
55
|
-
let j = {};
|
|
56
|
-
for (let M of f) {
|
|
57
|
-
let f = Object.getOwnPropertyDescriptors(M);
|
|
58
|
-
Object.assign(j, f);
|
|
59
|
-
}
|
|
60
|
-
return Object.defineProperties({}, j);
|
|
61
|
-
}
|
|
62
|
-
function esc(f) {
|
|
63
|
-
return JSON.stringify(f);
|
|
64
|
-
}
|
|
65
|
-
function slugify(f) {
|
|
66
|
-
return f.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
67
|
-
}
|
|
68
|
-
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (...f) => {};
|
|
69
|
-
function isObject(f) {
|
|
70
|
-
return typeof f == "object" && !!f && !Array.isArray(f);
|
|
71
|
-
}
|
|
72
|
-
const allowsEval = cached(() => {
|
|
73
|
-
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1;
|
|
74
|
-
try {
|
|
75
|
-
return Function(""), !0;
|
|
76
|
-
} catch {
|
|
77
|
-
return !1;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
function isPlainObject(f) {
|
|
81
|
-
if (isObject(f) === !1) return !1;
|
|
82
|
-
let j = f.constructor;
|
|
83
|
-
if (j === void 0 || typeof j != "function") return !0;
|
|
84
|
-
let M = j.prototype;
|
|
85
|
-
return !(isObject(M) === !1 || Object.prototype.hasOwnProperty.call(M, "isPrototypeOf") === !1);
|
|
86
|
-
}
|
|
87
|
-
function shallowClone(f) {
|
|
88
|
-
return isPlainObject(f) ? { ...f } : Array.isArray(f) ? [...f] : f;
|
|
89
|
-
}
|
|
90
|
-
const propertyKeyTypes = new Set([
|
|
91
|
-
"string",
|
|
92
|
-
"number",
|
|
93
|
-
"symbol"
|
|
94
|
-
]);
|
|
95
|
-
function escapeRegex(f) {
|
|
96
|
-
return f.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
97
|
-
}
|
|
98
|
-
function clone(f, j, M) {
|
|
99
|
-
let N = new f._zod.constr(j ?? f._zod.def);
|
|
100
|
-
return (!j || M?.parent) && (N._zod.parent = f), N;
|
|
101
|
-
}
|
|
102
|
-
function normalizeParams(f) {
|
|
103
|
-
let j = f;
|
|
104
|
-
if (!j) return {};
|
|
105
|
-
if (typeof j == "string") return { error: () => j };
|
|
106
|
-
if (j?.message !== void 0) {
|
|
107
|
-
if (j?.error !== void 0) throw Error("Cannot specify both `message` and `error` params");
|
|
108
|
-
j.error = j.message;
|
|
109
|
-
}
|
|
110
|
-
return delete j.message, typeof j.error == "string" ? {
|
|
111
|
-
...j,
|
|
112
|
-
error: () => j.error
|
|
113
|
-
} : j;
|
|
114
|
-
}
|
|
115
|
-
function optionalKeys(f) {
|
|
116
|
-
return Object.keys(f).filter((j) => f[j]._zod.optin === "optional" && f[j]._zod.optout === "optional");
|
|
117
|
-
}
|
|
118
|
-
const NUMBER_FORMAT_RANGES = {
|
|
119
|
-
safeint: [-(2 ** 53 - 1), 2 ** 53 - 1],
|
|
120
|
-
int32: [-2147483648, 2147483647],
|
|
121
|
-
uint32: [0, 4294967295],
|
|
122
|
-
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
123
|
-
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
124
|
-
};
|
|
125
|
-
function pick(f, j) {
|
|
126
|
-
let M = f._zod.def, N = M.checks;
|
|
127
|
-
if (N && N.length > 0) throw Error(".pick() cannot be used on object schemas containing refinements");
|
|
128
|
-
return clone(f, mergeDefs(f._zod.def, {
|
|
129
|
-
get shape() {
|
|
130
|
-
let f = {};
|
|
131
|
-
for (let N in j) {
|
|
132
|
-
if (!(N in M.shape)) throw Error(`Unrecognized key: "${N}"`);
|
|
133
|
-
j[N] && (f[N] = M.shape[N]);
|
|
134
|
-
}
|
|
135
|
-
return assignProp(this, "shape", f), f;
|
|
136
|
-
},
|
|
137
|
-
checks: []
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
function omit(f, j) {
|
|
141
|
-
let M = f._zod.def, N = M.checks;
|
|
142
|
-
if (N && N.length > 0) throw Error(".omit() cannot be used on object schemas containing refinements");
|
|
143
|
-
return clone(f, mergeDefs(f._zod.def, {
|
|
144
|
-
get shape() {
|
|
145
|
-
let N = { ...f._zod.def.shape };
|
|
146
|
-
for (let f in j) {
|
|
147
|
-
if (!(f in M.shape)) throw Error(`Unrecognized key: "${f}"`);
|
|
148
|
-
j[f] && delete N[f];
|
|
149
|
-
}
|
|
150
|
-
return assignProp(this, "shape", N), N;
|
|
151
|
-
},
|
|
152
|
-
checks: []
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
function extend(f, j) {
|
|
156
|
-
if (!isPlainObject(j)) throw Error("Invalid input to extend: expected a plain object");
|
|
157
|
-
let M = f._zod.def.checks;
|
|
158
|
-
if (M && M.length > 0) {
|
|
159
|
-
let M = f._zod.def.shape;
|
|
160
|
-
for (let f in j) if (Object.getOwnPropertyDescriptor(M, f) !== void 0) throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
161
|
-
}
|
|
162
|
-
return clone(f, mergeDefs(f._zod.def, { get shape() {
|
|
163
|
-
let M = {
|
|
164
|
-
...f._zod.def.shape,
|
|
165
|
-
...j
|
|
166
|
-
};
|
|
167
|
-
return assignProp(this, "shape", M), M;
|
|
168
|
-
} }));
|
|
169
|
-
}
|
|
170
|
-
function safeExtend(f, j) {
|
|
171
|
-
if (!isPlainObject(j)) throw Error("Invalid input to safeExtend: expected a plain object");
|
|
172
|
-
return clone(f, mergeDefs(f._zod.def, { get shape() {
|
|
173
|
-
let M = {
|
|
174
|
-
...f._zod.def.shape,
|
|
175
|
-
...j
|
|
176
|
-
};
|
|
177
|
-
return assignProp(this, "shape", M), M;
|
|
178
|
-
} }));
|
|
179
|
-
}
|
|
180
|
-
function merge(f, j) {
|
|
181
|
-
return clone(f, mergeDefs(f._zod.def, {
|
|
182
|
-
get shape() {
|
|
183
|
-
let M = {
|
|
184
|
-
...f._zod.def.shape,
|
|
185
|
-
...j._zod.def.shape
|
|
186
|
-
};
|
|
187
|
-
return assignProp(this, "shape", M), M;
|
|
188
|
-
},
|
|
189
|
-
get catchall() {
|
|
190
|
-
return j._zod.def.catchall;
|
|
191
|
-
},
|
|
192
|
-
checks: []
|
|
193
|
-
}));
|
|
194
|
-
}
|
|
195
|
-
function partial(f, j, M) {
|
|
196
|
-
let N = j._zod.def.checks;
|
|
197
|
-
if (N && N.length > 0) throw Error(".partial() cannot be used on object schemas containing refinements");
|
|
198
|
-
return clone(j, mergeDefs(j._zod.def, {
|
|
199
|
-
get shape() {
|
|
200
|
-
let N = j._zod.def.shape, P = { ...N };
|
|
201
|
-
if (M) for (let j in M) {
|
|
202
|
-
if (!(j in N)) throw Error(`Unrecognized key: "${j}"`);
|
|
203
|
-
M[j] && (P[j] = f ? new f({
|
|
204
|
-
type: "optional",
|
|
205
|
-
innerType: N[j]
|
|
206
|
-
}) : N[j]);
|
|
207
|
-
}
|
|
208
|
-
else for (let j in N) P[j] = f ? new f({
|
|
209
|
-
type: "optional",
|
|
210
|
-
innerType: N[j]
|
|
211
|
-
}) : N[j];
|
|
212
|
-
return assignProp(this, "shape", P), P;
|
|
213
|
-
},
|
|
214
|
-
checks: []
|
|
215
|
-
}));
|
|
216
|
-
}
|
|
217
|
-
function required(f, j, M) {
|
|
218
|
-
return clone(j, mergeDefs(j._zod.def, { get shape() {
|
|
219
|
-
let N = j._zod.def.shape, P = { ...N };
|
|
220
|
-
if (M) for (let j in M) {
|
|
221
|
-
if (!(j in P)) throw Error(`Unrecognized key: "${j}"`);
|
|
222
|
-
M[j] && (P[j] = new f({
|
|
223
|
-
type: "nonoptional",
|
|
224
|
-
innerType: N[j]
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
else for (let j in N) P[j] = new f({
|
|
228
|
-
type: "nonoptional",
|
|
229
|
-
innerType: N[j]
|
|
230
|
-
});
|
|
231
|
-
return assignProp(this, "shape", P), P;
|
|
232
|
-
} }));
|
|
233
|
-
}
|
|
234
|
-
function aborted(f, j = 0) {
|
|
235
|
-
if (f.aborted === !0) return !0;
|
|
236
|
-
for (let M = j; M < f.issues.length; M++) if (f.issues[M]?.continue !== !0) return !0;
|
|
237
|
-
return !1;
|
|
238
|
-
}
|
|
239
|
-
function prefixIssues(f, j) {
|
|
240
|
-
return j.map((j) => {
|
|
241
|
-
var M;
|
|
242
|
-
return (M = j).path ?? (M.path = []), j.path.unshift(f), j;
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
function unwrapMessage(f) {
|
|
246
|
-
return typeof f == "string" ? f : f?.message;
|
|
247
|
-
}
|
|
248
|
-
function finalizeIssue(f, j, M) {
|
|
249
|
-
let N = {
|
|
250
|
-
...f,
|
|
251
|
-
path: f.path ?? []
|
|
252
|
-
};
|
|
253
|
-
return f.message || (N.message = unwrapMessage(f.inst?._zod.def?.error?.(f)) ?? unwrapMessage(j?.error?.(f)) ?? unwrapMessage(M.customError?.(f)) ?? unwrapMessage(M.localeError?.(f)) ?? "Invalid input"), delete N.inst, delete N.continue, j?.reportInput || delete N.input, N;
|
|
254
|
-
}
|
|
255
|
-
function getLengthableOrigin(f) {
|
|
256
|
-
return Array.isArray(f) ? "array" : typeof f == "string" ? "string" : "unknown";
|
|
257
|
-
}
|
|
258
|
-
function issue(...f) {
|
|
259
|
-
let [j, M, N] = f;
|
|
260
|
-
return typeof j == "string" ? {
|
|
261
|
-
message: j,
|
|
262
|
-
code: "custom",
|
|
263
|
-
input: M,
|
|
264
|
-
inst: N
|
|
265
|
-
} : { ...j };
|
|
266
|
-
}
|
|
267
|
-
export { NUMBER_FORMAT_RANGES, aborted, allowsEval, cached, captureStackTrace, cleanRegex, clone, defineLazy, esc, escapeRegex, extend, finalizeIssue, floatSafeRemainder, getEnumValues, getLengthableOrigin, isObject, isPlainObject, issue, jsonStringifyReplacer, merge, mergeDefs, normalizeParams, nullish, omit, optionalKeys, partial, pick, prefixIssues, propertyKeyTypes, required, safeExtend, shallowClone, slugify };
|