@prisma/cli-init 0.5.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accelerate-YEFEYVGD.js → accelerate-MP5P6O6M.js} +2 -2
- package/dist/{chunk-YX4UTTNJ.js → chunk-NJX2BODH.js} +0 -5
- package/dist/{chunk-7C5I22R2.js → chunk-YTWW6A72.js} +191 -278
- package/dist/index.js +854 -462
- package/dist/{utility-W6LOZZIT.js → utility-QJR3G2JJ.js} +1 -1
- package/package.json +7 -3
- package/dist/_-2XY5LH7K.js +0 -36
- package/dist/chunk-C65YHZ4S.js +0 -1486
|
@@ -1,46 +1,43 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// ../../node_modules/.pnpm/valibot@1.
|
|
4
|
-
var store;
|
|
3
|
+
// ../../node_modules/.pnpm/valibot@1.2.0_typescript@5.8.3/node_modules/valibot/dist/index.mjs
|
|
4
|
+
var store$4;
|
|
5
5
|
// @__NO_SIDE_EFFECTS__
|
|
6
|
-
function getGlobalConfig(
|
|
6
|
+
function getGlobalConfig(config$1) {
|
|
7
7
|
return {
|
|
8
|
-
lang:
|
|
9
|
-
message:
|
|
10
|
-
abortEarly:
|
|
11
|
-
abortPipeEarly:
|
|
8
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
9
|
+
message: config$1?.message,
|
|
10
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
11
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
var
|
|
14
|
+
var store$3;
|
|
15
15
|
// @__NO_SIDE_EFFECTS__
|
|
16
16
|
function getGlobalMessage(lang) {
|
|
17
|
-
return
|
|
17
|
+
return store$3?.get(lang);
|
|
18
18
|
}
|
|
19
|
-
var
|
|
19
|
+
var store$2;
|
|
20
20
|
// @__NO_SIDE_EFFECTS__
|
|
21
21
|
function getSchemaMessage(lang) {
|
|
22
|
-
return
|
|
22
|
+
return store$2?.get(lang);
|
|
23
23
|
}
|
|
24
|
-
var
|
|
24
|
+
var store$1;
|
|
25
25
|
// @__NO_SIDE_EFFECTS__
|
|
26
26
|
function getSpecificMessage(reference, lang) {
|
|
27
|
-
return
|
|
27
|
+
return store$1?.get(reference)?.get(lang);
|
|
28
28
|
}
|
|
29
29
|
// @__NO_SIDE_EFFECTS__
|
|
30
30
|
function _stringify(input) {
|
|
31
31
|
const type = typeof input;
|
|
32
|
-
if (type === "string")
|
|
32
|
+
if (type === "string")
|
|
33
33
|
return `"${input}"`;
|
|
34
|
-
|
|
35
|
-
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
34
|
+
if (type === "number" || type === "bigint" || type === "boolean")
|
|
36
35
|
return `${input}`;
|
|
37
|
-
|
|
38
|
-
if (type === "object" || type === "function") {
|
|
36
|
+
if (type === "object" || type === "function")
|
|
39
37
|
return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
40
|
-
}
|
|
41
38
|
return type;
|
|
42
39
|
}
|
|
43
|
-
function _addIssue(context, label, dataset,
|
|
40
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
44
41
|
const input = other && "input" in other ? other.input : dataset.value;
|
|
45
42
|
const expected = other?.expected ?? context.expects ?? null;
|
|
46
43
|
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
@@ -54,51 +51,44 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
54
51
|
requirement: context.requirement,
|
|
55
52
|
path: other?.path,
|
|
56
53
|
issues: other?.issues,
|
|
57
|
-
lang:
|
|
58
|
-
abortEarly:
|
|
59
|
-
abortPipeEarly:
|
|
54
|
+
lang: config$1.lang,
|
|
55
|
+
abortEarly: config$1.abortEarly,
|
|
56
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
60
57
|
};
|
|
61
58
|
const isSchema = context.kind === "schema";
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
issue.message = typeof
|
|
65
|
-
|
|
66
|
-
message2(issue)
|
|
67
|
-
) : message2;
|
|
68
|
-
}
|
|
69
|
-
if (isSchema) {
|
|
59
|
+
const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
60
|
+
if (message$1 !== void 0)
|
|
61
|
+
issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
62
|
+
if (isSchema)
|
|
70
63
|
dataset.typed = false;
|
|
71
|
-
|
|
72
|
-
if (dataset.issues) {
|
|
64
|
+
if (dataset.issues)
|
|
73
65
|
dataset.issues.push(issue);
|
|
74
|
-
|
|
66
|
+
else
|
|
75
67
|
dataset.issues = [issue];
|
|
76
|
-
}
|
|
77
68
|
}
|
|
78
69
|
// @__NO_SIDE_EFFECTS__
|
|
79
70
|
function _getStandardProps(context) {
|
|
80
71
|
return {
|
|
81
72
|
version: 1,
|
|
82
73
|
vendor: "valibot",
|
|
83
|
-
validate(
|
|
84
|
-
return context["~run"]({ value:
|
|
74
|
+
validate(value$1) {
|
|
75
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
85
76
|
}
|
|
86
77
|
};
|
|
87
78
|
}
|
|
88
79
|
// @__NO_SIDE_EFFECTS__
|
|
89
|
-
function _isValidObjectKey(
|
|
90
|
-
return Object.hasOwn(
|
|
80
|
+
function _isValidObjectKey(object$1, key) {
|
|
81
|
+
return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
91
82
|
}
|
|
92
83
|
// @__NO_SIDE_EFFECTS__
|
|
93
|
-
function _joinExpects(
|
|
94
|
-
const list = [...new Set(
|
|
95
|
-
if (list.length > 1)
|
|
84
|
+
function _joinExpects(values$1, separator) {
|
|
85
|
+
const list = [...new Set(values$1)];
|
|
86
|
+
if (list.length > 1)
|
|
96
87
|
return `(${list.join(` ${separator} `)})`;
|
|
97
|
-
}
|
|
98
88
|
return list[0] ?? "never";
|
|
99
89
|
}
|
|
100
90
|
// @__NO_SIDE_EFFECTS__
|
|
101
|
-
function integer(
|
|
91
|
+
function integer(message$1) {
|
|
102
92
|
return {
|
|
103
93
|
kind: "validation",
|
|
104
94
|
type: "integer",
|
|
@@ -106,17 +96,16 @@ function integer(message2) {
|
|
|
106
96
|
async: false,
|
|
107
97
|
expects: null,
|
|
108
98
|
requirement: Number.isInteger,
|
|
109
|
-
message:
|
|
110
|
-
"~run"(dataset,
|
|
111
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
112
|
-
_addIssue(this, "integer", dataset,
|
|
113
|
-
}
|
|
99
|
+
message: message$1,
|
|
100
|
+
"~run"(dataset, config$1) {
|
|
101
|
+
if (dataset.typed && !this.requirement(dataset.value))
|
|
102
|
+
_addIssue(this, "integer", dataset, config$1);
|
|
114
103
|
return dataset;
|
|
115
104
|
}
|
|
116
105
|
};
|
|
117
106
|
}
|
|
118
107
|
// @__NO_SIDE_EFFECTS__
|
|
119
|
-
function minLength(requirement,
|
|
108
|
+
function minLength(requirement, message$1) {
|
|
120
109
|
return {
|
|
121
110
|
kind: "validation",
|
|
122
111
|
type: "min_length",
|
|
@@ -124,19 +113,16 @@ function minLength(requirement, message2) {
|
|
|
124
113
|
async: false,
|
|
125
114
|
expects: `>=${requirement}`,
|
|
126
115
|
requirement,
|
|
127
|
-
message:
|
|
128
|
-
"~run"(dataset,
|
|
129
|
-
if (dataset.typed && dataset.value.length < this.requirement)
|
|
130
|
-
_addIssue(this, "length", dataset,
|
|
131
|
-
received: `${dataset.value.length}`
|
|
132
|
-
});
|
|
133
|
-
}
|
|
116
|
+
message: message$1,
|
|
117
|
+
"~run"(dataset, config$1) {
|
|
118
|
+
if (dataset.typed && dataset.value.length < this.requirement)
|
|
119
|
+
_addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
|
|
134
120
|
return dataset;
|
|
135
121
|
}
|
|
136
122
|
};
|
|
137
123
|
}
|
|
138
124
|
// @__NO_SIDE_EFFECTS__
|
|
139
|
-
function minValue(requirement,
|
|
125
|
+
function minValue(requirement, message$1) {
|
|
140
126
|
return {
|
|
141
127
|
kind: "validation",
|
|
142
128
|
type: "min_value",
|
|
@@ -144,45 +130,39 @@ function minValue(requirement, message2) {
|
|
|
144
130
|
async: false,
|
|
145
131
|
expects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
146
132
|
requirement,
|
|
147
|
-
message:
|
|
148
|
-
"~run"(dataset,
|
|
149
|
-
if (dataset.typed && !(dataset.value >= this.requirement))
|
|
150
|
-
_addIssue(this, "value", dataset,
|
|
151
|
-
received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value)
|
|
152
|
-
});
|
|
153
|
-
}
|
|
133
|
+
message: message$1,
|
|
134
|
+
"~run"(dataset, config$1) {
|
|
135
|
+
if (dataset.typed && !(dataset.value >= this.requirement))
|
|
136
|
+
_addIssue(this, "value", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });
|
|
154
137
|
return dataset;
|
|
155
138
|
}
|
|
156
139
|
};
|
|
157
140
|
}
|
|
158
141
|
// @__NO_SIDE_EFFECTS__
|
|
159
|
-
function parseJson(
|
|
142
|
+
function parseJson(config$1, message$1) {
|
|
160
143
|
return {
|
|
161
144
|
kind: "transformation",
|
|
162
145
|
type: "parse_json",
|
|
163
146
|
reference: parseJson,
|
|
164
|
-
config:
|
|
165
|
-
message:
|
|
147
|
+
config: config$1,
|
|
148
|
+
message: message$1,
|
|
166
149
|
async: false,
|
|
167
|
-
"~run"(dataset,
|
|
150
|
+
"~run"(dataset, config$2) {
|
|
168
151
|
try {
|
|
169
152
|
dataset.value = JSON.parse(dataset.value, this.config?.reviver);
|
|
170
153
|
} catch (error) {
|
|
171
154
|
if (error instanceof Error) {
|
|
172
|
-
_addIssue(this, "JSON", dataset,
|
|
173
|
-
received: `"${error.message}"`
|
|
174
|
-
});
|
|
155
|
+
_addIssue(this, "JSON", dataset, config$2, { received: `"${error.message}"` });
|
|
175
156
|
dataset.typed = false;
|
|
176
|
-
} else
|
|
157
|
+
} else
|
|
177
158
|
throw error;
|
|
178
|
-
}
|
|
179
159
|
}
|
|
180
160
|
return dataset;
|
|
181
161
|
}
|
|
182
162
|
};
|
|
183
163
|
}
|
|
184
164
|
// @__NO_SIDE_EFFECTS__
|
|
185
|
-
function regex(requirement,
|
|
165
|
+
function regex(requirement, message$1) {
|
|
186
166
|
return {
|
|
187
167
|
kind: "validation",
|
|
188
168
|
type: "regex",
|
|
@@ -190,17 +170,16 @@ function regex(requirement, message2) {
|
|
|
190
170
|
async: false,
|
|
191
171
|
expects: `${requirement}`,
|
|
192
172
|
requirement,
|
|
193
|
-
message:
|
|
194
|
-
"~run"(dataset,
|
|
195
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
196
|
-
_addIssue(this, "format", dataset,
|
|
197
|
-
}
|
|
173
|
+
message: message$1,
|
|
174
|
+
"~run"(dataset, config$1) {
|
|
175
|
+
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
176
|
+
_addIssue(this, "format", dataset, config$1);
|
|
198
177
|
return dataset;
|
|
199
178
|
}
|
|
200
179
|
};
|
|
201
180
|
}
|
|
202
181
|
// @__NO_SIDE_EFFECTS__
|
|
203
|
-
function url(
|
|
182
|
+
function url(message$1) {
|
|
204
183
|
return {
|
|
205
184
|
kind: "validation",
|
|
206
185
|
type: "url",
|
|
@@ -215,37 +194,24 @@ function url(message2) {
|
|
|
215
194
|
return false;
|
|
216
195
|
}
|
|
217
196
|
},
|
|
218
|
-
message:
|
|
219
|
-
"~run"(dataset,
|
|
220
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
221
|
-
_addIssue(this, "URL", dataset,
|
|
222
|
-
}
|
|
197
|
+
message: message$1,
|
|
198
|
+
"~run"(dataset, config$1) {
|
|
199
|
+
if (dataset.typed && !this.requirement(dataset.value))
|
|
200
|
+
_addIssue(this, "URL", dataset, config$1);
|
|
223
201
|
return dataset;
|
|
224
202
|
}
|
|
225
203
|
};
|
|
226
204
|
}
|
|
227
205
|
// @__NO_SIDE_EFFECTS__
|
|
228
|
-
function getFallback(schema, dataset,
|
|
229
|
-
return typeof schema.fallback === "function" ? (
|
|
230
|
-
// @ts-expect-error
|
|
231
|
-
schema.fallback(dataset, config2)
|
|
232
|
-
) : (
|
|
233
|
-
// @ts-expect-error
|
|
234
|
-
schema.fallback
|
|
235
|
-
);
|
|
206
|
+
function getFallback(schema, dataset, config$1) {
|
|
207
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
236
208
|
}
|
|
237
209
|
// @__NO_SIDE_EFFECTS__
|
|
238
|
-
function getDefault(schema, dataset,
|
|
239
|
-
return typeof schema.default === "function" ? (
|
|
240
|
-
// @ts-expect-error
|
|
241
|
-
schema.default(dataset, config2)
|
|
242
|
-
) : (
|
|
243
|
-
// @ts-expect-error
|
|
244
|
-
schema.default
|
|
245
|
-
);
|
|
210
|
+
function getDefault(schema, dataset, config$1) {
|
|
211
|
+
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
246
212
|
}
|
|
247
213
|
// @__NO_SIDE_EFFECTS__
|
|
248
|
-
function array(item,
|
|
214
|
+
function array(item, message$1) {
|
|
249
215
|
return {
|
|
250
216
|
kind: "schema",
|
|
251
217
|
type: "array",
|
|
@@ -253,56 +219,52 @@ function array(item, message2) {
|
|
|
253
219
|
expects: "Array",
|
|
254
220
|
async: false,
|
|
255
221
|
item,
|
|
256
|
-
message:
|
|
222
|
+
message: message$1,
|
|
257
223
|
get "~standard"() {
|
|
258
224
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
259
225
|
},
|
|
260
|
-
"~run"(dataset,
|
|
226
|
+
"~run"(dataset, config$1) {
|
|
261
227
|
const input = dataset.value;
|
|
262
228
|
if (Array.isArray(input)) {
|
|
263
229
|
dataset.typed = true;
|
|
264
230
|
dataset.value = [];
|
|
265
231
|
for (let key = 0; key < input.length; key++) {
|
|
266
|
-
const
|
|
267
|
-
const itemDataset = this.item["~run"]({ value:
|
|
232
|
+
const value$1 = input[key];
|
|
233
|
+
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
268
234
|
if (itemDataset.issues) {
|
|
269
235
|
const pathItem = {
|
|
270
236
|
type: "array",
|
|
271
237
|
origin: "value",
|
|
272
238
|
input,
|
|
273
239
|
key,
|
|
274
|
-
value:
|
|
240
|
+
value: value$1
|
|
275
241
|
};
|
|
276
242
|
for (const issue of itemDataset.issues) {
|
|
277
|
-
if (issue.path)
|
|
243
|
+
if (issue.path)
|
|
278
244
|
issue.path.unshift(pathItem);
|
|
279
|
-
|
|
245
|
+
else
|
|
280
246
|
issue.path = [pathItem];
|
|
281
|
-
}
|
|
282
247
|
dataset.issues?.push(issue);
|
|
283
248
|
}
|
|
284
|
-
if (!dataset.issues)
|
|
249
|
+
if (!dataset.issues)
|
|
285
250
|
dataset.issues = itemDataset.issues;
|
|
286
|
-
|
|
287
|
-
if (config2.abortEarly) {
|
|
251
|
+
if (config$1.abortEarly) {
|
|
288
252
|
dataset.typed = false;
|
|
289
253
|
break;
|
|
290
254
|
}
|
|
291
255
|
}
|
|
292
|
-
if (!itemDataset.typed)
|
|
256
|
+
if (!itemDataset.typed)
|
|
293
257
|
dataset.typed = false;
|
|
294
|
-
}
|
|
295
258
|
dataset.value.push(itemDataset.value);
|
|
296
259
|
}
|
|
297
|
-
} else
|
|
298
|
-
_addIssue(this, "type", dataset,
|
|
299
|
-
}
|
|
260
|
+
} else
|
|
261
|
+
_addIssue(this, "type", dataset, config$1);
|
|
300
262
|
return dataset;
|
|
301
263
|
}
|
|
302
264
|
};
|
|
303
265
|
}
|
|
304
266
|
// @__NO_SIDE_EFFECTS__
|
|
305
|
-
function literal(literal_,
|
|
267
|
+
function literal(literal_, message$1) {
|
|
306
268
|
return {
|
|
307
269
|
kind: "schema",
|
|
308
270
|
type: "literal",
|
|
@@ -310,213 +272,185 @@ function literal(literal_, message2) {
|
|
|
310
272
|
expects: /* @__PURE__ */ _stringify(literal_),
|
|
311
273
|
async: false,
|
|
312
274
|
literal: literal_,
|
|
313
|
-
message:
|
|
275
|
+
message: message$1,
|
|
314
276
|
get "~standard"() {
|
|
315
277
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
316
278
|
},
|
|
317
|
-
"~run"(dataset,
|
|
318
|
-
if (dataset.value === this.literal)
|
|
279
|
+
"~run"(dataset, config$1) {
|
|
280
|
+
if (dataset.value === this.literal)
|
|
319
281
|
dataset.typed = true;
|
|
320
|
-
|
|
321
|
-
_addIssue(this, "type", dataset,
|
|
322
|
-
}
|
|
282
|
+
else
|
|
283
|
+
_addIssue(this, "type", dataset, config$1);
|
|
323
284
|
return dataset;
|
|
324
285
|
}
|
|
325
286
|
};
|
|
326
287
|
}
|
|
327
288
|
// @__NO_SIDE_EFFECTS__
|
|
328
|
-
function looseObject(
|
|
289
|
+
function looseObject(entries$1, message$1) {
|
|
329
290
|
return {
|
|
330
291
|
kind: "schema",
|
|
331
292
|
type: "loose_object",
|
|
332
293
|
reference: looseObject,
|
|
333
294
|
expects: "Object",
|
|
334
295
|
async: false,
|
|
335
|
-
entries:
|
|
336
|
-
message:
|
|
296
|
+
entries: entries$1,
|
|
297
|
+
message: message$1,
|
|
337
298
|
get "~standard"() {
|
|
338
299
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
339
300
|
},
|
|
340
|
-
"~run"(dataset,
|
|
301
|
+
"~run"(dataset, config$1) {
|
|
341
302
|
const input = dataset.value;
|
|
342
303
|
if (input && typeof input === "object") {
|
|
343
304
|
dataset.typed = true;
|
|
344
305
|
dataset.value = {};
|
|
345
306
|
for (const key in this.entries) {
|
|
346
307
|
const valueSchema = this.entries[key];
|
|
347
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") &&
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
// @ts-expect-error
|
|
351
|
-
input[key]
|
|
352
|
-
) : /* @__PURE__ */ getDefault(valueSchema);
|
|
353
|
-
const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
|
|
308
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
309
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
310
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
354
311
|
if (valueDataset.issues) {
|
|
355
312
|
const pathItem = {
|
|
356
313
|
type: "object",
|
|
357
314
|
origin: "value",
|
|
358
315
|
input,
|
|
359
316
|
key,
|
|
360
|
-
value:
|
|
317
|
+
value: value$1
|
|
361
318
|
};
|
|
362
319
|
for (const issue of valueDataset.issues) {
|
|
363
|
-
if (issue.path)
|
|
320
|
+
if (issue.path)
|
|
364
321
|
issue.path.unshift(pathItem);
|
|
365
|
-
|
|
322
|
+
else
|
|
366
323
|
issue.path = [pathItem];
|
|
367
|
-
}
|
|
368
324
|
dataset.issues?.push(issue);
|
|
369
325
|
}
|
|
370
|
-
if (!dataset.issues)
|
|
326
|
+
if (!dataset.issues)
|
|
371
327
|
dataset.issues = valueDataset.issues;
|
|
372
|
-
|
|
373
|
-
if (config2.abortEarly) {
|
|
328
|
+
if (config$1.abortEarly) {
|
|
374
329
|
dataset.typed = false;
|
|
375
330
|
break;
|
|
376
331
|
}
|
|
377
332
|
}
|
|
378
|
-
if (!valueDataset.typed)
|
|
333
|
+
if (!valueDataset.typed)
|
|
379
334
|
dataset.typed = false;
|
|
380
|
-
}
|
|
381
335
|
dataset.value[key] = valueDataset.value;
|
|
382
|
-
} else if (valueSchema.fallback !== void 0)
|
|
336
|
+
} else if (valueSchema.fallback !== void 0)
|
|
383
337
|
dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
384
|
-
|
|
385
|
-
_addIssue(this, "key", dataset,
|
|
338
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
339
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
386
340
|
input: void 0,
|
|
387
341
|
expected: `"${key}"`,
|
|
388
|
-
path: [
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
value: input[key]
|
|
396
|
-
}
|
|
397
|
-
]
|
|
342
|
+
path: [{
|
|
343
|
+
type: "object",
|
|
344
|
+
origin: "key",
|
|
345
|
+
input,
|
|
346
|
+
key,
|
|
347
|
+
value: input[key]
|
|
348
|
+
}]
|
|
398
349
|
});
|
|
399
|
-
if (
|
|
350
|
+
if (config$1.abortEarly)
|
|
400
351
|
break;
|
|
401
|
-
}
|
|
402
352
|
}
|
|
403
353
|
}
|
|
404
|
-
if (!dataset.issues || !
|
|
405
|
-
for (const key in input)
|
|
406
|
-
if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries))
|
|
354
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
355
|
+
for (const key in input)
|
|
356
|
+
if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries))
|
|
407
357
|
dataset.value[key] = input[key];
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
358
|
}
|
|
411
|
-
} else
|
|
412
|
-
_addIssue(this, "type", dataset,
|
|
413
|
-
}
|
|
359
|
+
} else
|
|
360
|
+
_addIssue(this, "type", dataset, config$1);
|
|
414
361
|
return dataset;
|
|
415
362
|
}
|
|
416
363
|
};
|
|
417
364
|
}
|
|
418
365
|
// @__NO_SIDE_EFFECTS__
|
|
419
|
-
function number(
|
|
366
|
+
function number(message$1) {
|
|
420
367
|
return {
|
|
421
368
|
kind: "schema",
|
|
422
369
|
type: "number",
|
|
423
370
|
reference: number,
|
|
424
371
|
expects: "number",
|
|
425
372
|
async: false,
|
|
426
|
-
message:
|
|
373
|
+
message: message$1,
|
|
427
374
|
get "~standard"() {
|
|
428
375
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
429
376
|
},
|
|
430
|
-
"~run"(dataset,
|
|
431
|
-
if (typeof dataset.value === "number" && !isNaN(dataset.value))
|
|
377
|
+
"~run"(dataset, config$1) {
|
|
378
|
+
if (typeof dataset.value === "number" && !isNaN(dataset.value))
|
|
432
379
|
dataset.typed = true;
|
|
433
|
-
|
|
434
|
-
_addIssue(this, "type", dataset,
|
|
435
|
-
}
|
|
380
|
+
else
|
|
381
|
+
_addIssue(this, "type", dataset, config$1);
|
|
436
382
|
return dataset;
|
|
437
383
|
}
|
|
438
384
|
};
|
|
439
385
|
}
|
|
440
386
|
// @__NO_SIDE_EFFECTS__
|
|
441
|
-
function object(
|
|
387
|
+
function object(entries$1, message$1) {
|
|
442
388
|
return {
|
|
443
389
|
kind: "schema",
|
|
444
390
|
type: "object",
|
|
445
391
|
reference: object,
|
|
446
392
|
expects: "Object",
|
|
447
393
|
async: false,
|
|
448
|
-
entries:
|
|
449
|
-
message:
|
|
394
|
+
entries: entries$1,
|
|
395
|
+
message: message$1,
|
|
450
396
|
get "~standard"() {
|
|
451
397
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
452
398
|
},
|
|
453
|
-
"~run"(dataset,
|
|
399
|
+
"~run"(dataset, config$1) {
|
|
454
400
|
const input = dataset.value;
|
|
455
401
|
if (input && typeof input === "object") {
|
|
456
402
|
dataset.typed = true;
|
|
457
403
|
dataset.value = {};
|
|
458
404
|
for (const key in this.entries) {
|
|
459
405
|
const valueSchema = this.entries[key];
|
|
460
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") &&
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
// @ts-expect-error
|
|
464
|
-
input[key]
|
|
465
|
-
) : /* @__PURE__ */ getDefault(valueSchema);
|
|
466
|
-
const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
|
|
406
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
407
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
408
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
467
409
|
if (valueDataset.issues) {
|
|
468
410
|
const pathItem = {
|
|
469
411
|
type: "object",
|
|
470
412
|
origin: "value",
|
|
471
413
|
input,
|
|
472
414
|
key,
|
|
473
|
-
value:
|
|
415
|
+
value: value$1
|
|
474
416
|
};
|
|
475
417
|
for (const issue of valueDataset.issues) {
|
|
476
|
-
if (issue.path)
|
|
418
|
+
if (issue.path)
|
|
477
419
|
issue.path.unshift(pathItem);
|
|
478
|
-
|
|
420
|
+
else
|
|
479
421
|
issue.path = [pathItem];
|
|
480
|
-
}
|
|
481
422
|
dataset.issues?.push(issue);
|
|
482
423
|
}
|
|
483
|
-
if (!dataset.issues)
|
|
424
|
+
if (!dataset.issues)
|
|
484
425
|
dataset.issues = valueDataset.issues;
|
|
485
|
-
|
|
486
|
-
if (config2.abortEarly) {
|
|
426
|
+
if (config$1.abortEarly) {
|
|
487
427
|
dataset.typed = false;
|
|
488
428
|
break;
|
|
489
429
|
}
|
|
490
430
|
}
|
|
491
|
-
if (!valueDataset.typed)
|
|
431
|
+
if (!valueDataset.typed)
|
|
492
432
|
dataset.typed = false;
|
|
493
|
-
}
|
|
494
433
|
dataset.value[key] = valueDataset.value;
|
|
495
|
-
} else if (valueSchema.fallback !== void 0)
|
|
434
|
+
} else if (valueSchema.fallback !== void 0)
|
|
496
435
|
dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
497
|
-
|
|
498
|
-
_addIssue(this, "key", dataset,
|
|
436
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
437
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
499
438
|
input: void 0,
|
|
500
439
|
expected: `"${key}"`,
|
|
501
|
-
path: [
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
value: input[key]
|
|
509
|
-
}
|
|
510
|
-
]
|
|
440
|
+
path: [{
|
|
441
|
+
type: "object",
|
|
442
|
+
origin: "key",
|
|
443
|
+
input,
|
|
444
|
+
key,
|
|
445
|
+
value: input[key]
|
|
446
|
+
}]
|
|
511
447
|
});
|
|
512
|
-
if (
|
|
448
|
+
if (config$1.abortEarly)
|
|
513
449
|
break;
|
|
514
|
-
}
|
|
515
450
|
}
|
|
516
451
|
}
|
|
517
|
-
} else
|
|
518
|
-
_addIssue(this, "type", dataset,
|
|
519
|
-
}
|
|
452
|
+
} else
|
|
453
|
+
_addIssue(this, "type", dataset, config$1);
|
|
520
454
|
return dataset;
|
|
521
455
|
}
|
|
522
456
|
};
|
|
@@ -534,38 +468,36 @@ function optional(wrapped, default_) {
|
|
|
534
468
|
get "~standard"() {
|
|
535
469
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
536
470
|
},
|
|
537
|
-
"~run"(dataset,
|
|
471
|
+
"~run"(dataset, config$1) {
|
|
538
472
|
if (dataset.value === void 0) {
|
|
539
|
-
if (this.default !== void 0)
|
|
540
|
-
dataset.value = /* @__PURE__ */ getDefault(this, dataset,
|
|
541
|
-
}
|
|
473
|
+
if (this.default !== void 0)
|
|
474
|
+
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
542
475
|
if (dataset.value === void 0) {
|
|
543
476
|
dataset.typed = true;
|
|
544
477
|
return dataset;
|
|
545
478
|
}
|
|
546
479
|
}
|
|
547
|
-
return this.wrapped["~run"](dataset,
|
|
480
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
548
481
|
}
|
|
549
482
|
};
|
|
550
483
|
}
|
|
551
484
|
// @__NO_SIDE_EFFECTS__
|
|
552
|
-
function string(
|
|
485
|
+
function string(message$1) {
|
|
553
486
|
return {
|
|
554
487
|
kind: "schema",
|
|
555
488
|
type: "string",
|
|
556
489
|
reference: string,
|
|
557
490
|
expects: "string",
|
|
558
491
|
async: false,
|
|
559
|
-
message:
|
|
492
|
+
message: message$1,
|
|
560
493
|
get "~standard"() {
|
|
561
494
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
562
495
|
},
|
|
563
|
-
"~run"(dataset,
|
|
564
|
-
if (typeof dataset.value === "string")
|
|
496
|
+
"~run"(dataset, config$1) {
|
|
497
|
+
if (typeof dataset.value === "string")
|
|
565
498
|
dataset.typed = true;
|
|
566
|
-
|
|
567
|
-
_addIssue(this, "type", dataset,
|
|
568
|
-
}
|
|
499
|
+
else
|
|
500
|
+
_addIssue(this, "type", dataset, config$1);
|
|
569
501
|
return dataset;
|
|
570
502
|
}
|
|
571
503
|
};
|
|
@@ -573,107 +505,88 @@ function string(message2) {
|
|
|
573
505
|
// @__NO_SIDE_EFFECTS__
|
|
574
506
|
function _subIssues(datasets) {
|
|
575
507
|
let issues;
|
|
576
|
-
if (datasets)
|
|
577
|
-
for (const dataset of datasets)
|
|
578
|
-
if (issues)
|
|
508
|
+
if (datasets)
|
|
509
|
+
for (const dataset of datasets)
|
|
510
|
+
if (issues)
|
|
579
511
|
issues.push(...dataset.issues);
|
|
580
|
-
|
|
512
|
+
else
|
|
581
513
|
issues = dataset.issues;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
514
|
return issues;
|
|
586
515
|
}
|
|
587
516
|
// @__NO_SIDE_EFFECTS__
|
|
588
|
-
function union(options,
|
|
517
|
+
function union(options, message$1) {
|
|
589
518
|
return {
|
|
590
519
|
kind: "schema",
|
|
591
520
|
type: "union",
|
|
592
521
|
reference: union,
|
|
593
|
-
expects: /* @__PURE__ */ _joinExpects(
|
|
594
|
-
options.map((option) => option.expects),
|
|
595
|
-
"|"
|
|
596
|
-
),
|
|
522
|
+
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
597
523
|
async: false,
|
|
598
524
|
options,
|
|
599
|
-
message:
|
|
525
|
+
message: message$1,
|
|
600
526
|
get "~standard"() {
|
|
601
527
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
602
528
|
},
|
|
603
|
-
"~run"(dataset,
|
|
529
|
+
"~run"(dataset, config$1) {
|
|
604
530
|
let validDataset;
|
|
605
531
|
let typedDatasets;
|
|
606
532
|
let untypedDatasets;
|
|
607
533
|
for (const schema of this.options) {
|
|
608
|
-
const optionDataset = schema["~run"]({ value: dataset.value },
|
|
609
|
-
if (optionDataset.typed)
|
|
610
|
-
if (optionDataset.issues)
|
|
611
|
-
if (typedDatasets)
|
|
534
|
+
const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
|
|
535
|
+
if (optionDataset.typed)
|
|
536
|
+
if (optionDataset.issues)
|
|
537
|
+
if (typedDatasets)
|
|
612
538
|
typedDatasets.push(optionDataset);
|
|
613
|
-
|
|
539
|
+
else
|
|
614
540
|
typedDatasets = [optionDataset];
|
|
615
|
-
|
|
616
|
-
} else {
|
|
541
|
+
else {
|
|
617
542
|
validDataset = optionDataset;
|
|
618
543
|
break;
|
|
619
544
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
untypedDatasets = [optionDataset];
|
|
625
|
-
}
|
|
626
|
-
}
|
|
545
|
+
else if (untypedDatasets)
|
|
546
|
+
untypedDatasets.push(optionDataset);
|
|
547
|
+
else
|
|
548
|
+
untypedDatasets = [optionDataset];
|
|
627
549
|
}
|
|
628
|
-
if (validDataset)
|
|
550
|
+
if (validDataset)
|
|
629
551
|
return validDataset;
|
|
630
|
-
}
|
|
631
552
|
if (typedDatasets) {
|
|
632
|
-
if (typedDatasets.length === 1)
|
|
553
|
+
if (typedDatasets.length === 1)
|
|
633
554
|
return typedDatasets[0];
|
|
634
|
-
}
|
|
635
|
-
_addIssue(this, "type", dataset, config2, {
|
|
636
|
-
issues: /* @__PURE__ */ _subIssues(typedDatasets)
|
|
637
|
-
});
|
|
555
|
+
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
638
556
|
dataset.typed = true;
|
|
639
|
-
} else if (untypedDatasets?.length === 1)
|
|
557
|
+
} else if (untypedDatasets?.length === 1)
|
|
640
558
|
return untypedDatasets[0];
|
|
641
|
-
|
|
642
|
-
_addIssue(this, "type", dataset,
|
|
643
|
-
issues: /* @__PURE__ */ _subIssues(untypedDatasets)
|
|
644
|
-
});
|
|
645
|
-
}
|
|
559
|
+
else
|
|
560
|
+
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
646
561
|
return dataset;
|
|
647
562
|
}
|
|
648
563
|
};
|
|
649
564
|
}
|
|
650
565
|
// @__NO_SIDE_EFFECTS__
|
|
651
|
-
function pipe(...
|
|
566
|
+
function pipe(...pipe$1) {
|
|
652
567
|
return {
|
|
653
|
-
...
|
|
654
|
-
pipe:
|
|
568
|
+
...pipe$1[0],
|
|
569
|
+
pipe: pipe$1,
|
|
655
570
|
get "~standard"() {
|
|
656
571
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
657
572
|
},
|
|
658
|
-
"~run"(dataset,
|
|
659
|
-
for (const item of
|
|
573
|
+
"~run"(dataset, config$1) {
|
|
574
|
+
for (const item of pipe$1)
|
|
660
575
|
if (item.kind !== "metadata") {
|
|
661
576
|
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
662
577
|
dataset.typed = false;
|
|
663
578
|
break;
|
|
664
579
|
}
|
|
665
|
-
if (!dataset.issues || !
|
|
666
|
-
dataset = item["~run"](dataset,
|
|
667
|
-
}
|
|
580
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly)
|
|
581
|
+
dataset = item["~run"](dataset, config$1);
|
|
668
582
|
}
|
|
669
|
-
}
|
|
670
583
|
return dataset;
|
|
671
584
|
}
|
|
672
585
|
};
|
|
673
586
|
}
|
|
674
587
|
// @__NO_SIDE_EFFECTS__
|
|
675
|
-
function safeParse(schema, input,
|
|
676
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(
|
|
588
|
+
function safeParse(schema, input, config$1) {
|
|
589
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
677
590
|
return {
|
|
678
591
|
typed: dataset.typed,
|
|
679
592
|
success: !dataset.issues,
|