@drfed/web 0.0.0-stage → 0.1.0-dev.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/.output/nitro.json +17 -0
- package/.output/public/.vite/manifest.json +493 -0
- package/.output/public/_build/assets/ActorDetailQuery.graphql-D96mwq1k.js +60 -0
- package/.output/public/_build/assets/ActorDetailQuery.graphql-DrxSNh1X.js +60 -0
- package/.output/public/_build/assets/CompleteLoginChallenge.graphql-C5Zq3wNh.js +10 -0
- package/.output/public/_build/assets/CopyButton-B2l484wE.js +1 -0
- package/.output/public/_build/assets/CopyButton-Bi-ZR8x9.css +1 -0
- package/.output/public/_build/assets/CreateInstanceMutation.graphql-B4CRy6cl.js +19 -0
- package/.output/public/_build/assets/CreateObjectMutation.graphql-B4A01dgV.js +23 -0
- package/.output/public/_build/assets/GenerateActorsMutation.graphql-mlHJNIbe.js +23 -0
- package/.output/public/_build/assets/GetHostQuery.graphql-CuzDdOdW.js +17 -0
- package/.output/public/_build/assets/GetHostQuery.graphql-o9K0Qkg0.js +17 -0
- package/.output/public/_build/assets/HomeViewerQuery.graphql-B903WWKs.js +8 -0
- package/.output/public/_build/assets/HttpStatusCode-bgaVzuLy.js +1 -0
- package/.output/public/_build/assets/InstanceActorListQuery.graphql-DmNwiEhM.js +24 -0
- package/.output/public/_build/assets/InstanceActorListQuery.graphql-paa7teUO.js +24 -0
- package/.output/public/_build/assets/InstanceDetailQuery.graphql-B52nR132.js +66 -0
- package/.output/public/_build/assets/InstanceDetailQuery.graphql-DSA2BcAV.js +66 -0
- package/.output/public/_build/assets/InstanceSummary_instance.graphql-BoQAa5Od.js +1 -0
- package/.output/public/_build/assets/JNCCF6MP-CNMywyiC.js +1 -0
- package/.output/public/_build/assets/LP6E37CW-Cwv6G3n1.js +1 -0
- package/.output/public/_build/assets/SignInMutation.graphql-BalZYNFu.js +9 -0
- package/.output/public/_build/assets/TSB6MOZK-CpiH97G1.js +1 -0
- package/.output/public/_build/assets/Toast-3-eXCAKc.css +1 -0
- package/.output/public/_build/assets/Toast-C1zr9crB.js +1 -0
- package/.output/public/_build/assets/WorkspaceQuery.graphql-UoI7QDs4.js +23 -0
- package/.output/public/_build/assets/_...404_-WZ8kAljY.js +1 -0
- package/.output/public/_build/assets/_challengeId_-BgL-Berz.js +1 -0
- package/.output/public/_build/assets/_id_-YcZZShAv.css +1 -0
- package/.output/public/_build/assets/_id_-bpxdclBj.js +1 -0
- package/.output/public/_build/assets/_slug_-CyTA2aW7.css +1 -0
- package/.output/public/_build/assets/_slug_-DXfRknzJ.js +200 -0
- package/.output/public/_build/assets/about-DIrbzRsi.js +1 -0
- package/.output/public/_build/assets/actors-HfZh_afh.js +24 -0
- package/.output/public/_build/assets/client-CGFoRcqH.js +3 -0
- package/.output/public/_build/assets/components-5MVu7IcD.js +1 -0
- package/.output/public/_build/assets/dist-BrJ_B8nU.js +1 -0
- package/.output/public/_build/assets/dist-DVo0HS5G.js +1 -0
- package/.output/public/_build/assets/dist-WrlGlK67.js +1 -0
- package/.output/public/_build/assets/entry-client-BurSTYr9.css +1 -0
- package/.output/public/_build/assets/entry-client-RIC5nXxX.js +8 -0
- package/.output/public/_build/assets/form-BxigYd7J.css +1 -0
- package/.output/public/_build/assets/form.module-BecmEfV_.js +1 -0
- package/.output/public/_build/assets/index-BHn6sAgH.js +23 -0
- package/.output/public/_build/assets/index-BSLqnqN7.js +8 -0
- package/.output/public/_build/assets/index-B_xLBDOo.css +1 -0
- package/.output/public/_build/assets/instance-tpMrvJNZ.js +35 -0
- package/.output/public/_build/assets/label-Mv8GZ4jc.js +1 -0
- package/.output/public/_build/assets/objects-DPb8DI8A.css +1 -0
- package/.output/public/_build/assets/objects-DR9TfL-V.js +25 -0
- package/.output/public/_build/assets/relay-runtime-BX3uubtA.js +7 -0
- package/.output/public/_build/assets/routing-DMN2NHu6.js +1 -0
- package/.output/public/_build/assets/sign-in-B67sv7z8.js +10 -0
- package/.output/public/_build/assets/web-DB_Nkq2D.js +1 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/icon-192.png +0 -0
- package/.output/public/icon-512.png +0 -0
- package/.output/public/icon-mask.png +0 -0
- package/.output/public/icon.svg +395 -0
- package/.output/public/manifest.webmanifest +13 -0
- package/.output/server/_...404_-DDEH5apf.mjs +16 -0
- package/.output/server/_challengeId_-C7BBdG0r.mjs +100 -0
- package/.output/server/_chunks/ssr-renderer.mjs +26 -0
- package/.output/server/_id_-DqytvZEf.mjs +505 -0
- package/.output/server/_libs/@shikijs/core+[...].mjs +7173 -0
- package/.output/server/_libs/@shikijs/engine-javascript+[...].mjs +3110 -0
- package/.output/server/_libs/babel__runtime.mjs +243 -0
- package/.output/server/_libs/dequal.mjs +25 -0
- package/.output/server/_libs/faker-js__faker.mjs +13150 -0
- package/.output/server/_libs/fbjs.mjs +115 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +650 -0
- package/.output/server/_libs/hookable.mjs +41 -0
- package/.output/server/_libs/invariant.mjs +36 -0
- package/.output/server/_libs/relay-runtime.mjs +9704 -0
- package/.output/server/_libs/seroval-plugins.mjs +563 -0
- package/.output/server/_libs/seroval.mjs +2956 -0
- package/.output/server/_libs/shikijs__langs.mjs +3 -0
- package/.output/server/_libs/shikijs__themes.mjs +7 -0
- package/.output/server/_libs/solid-js.mjs +1248 -0
- package/.output/server/_libs/solid-relay+tiny-invariant.mjs +1029 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_libs/valibot.mjs +711 -0
- package/.output/server/_runtime.mjs +33 -0
- package/.output/server/_slug_-CBOaSqoF.mjs +978 -0
- package/.output/server/_ssr/ActorDetailQuery.graphql-C1mWRP1B.mjs +283 -0
- package/.output/server/_ssr/CompleteLoginChallenge.graphql-CM7o_Md1.mjs +78 -0
- package/.output/server/_ssr/CopyButton-CQNR5D1y.mjs +43 -0
- package/.output/server/_ssr/CreateInstanceMutation.graphql-C-h2lGxz.mjs +116 -0
- package/.output/server/_ssr/CreateObjectMutation.graphql-C393Hp7q.mjs +166 -0
- package/.output/server/_ssr/GenerateActorsMutation.graphql-D2ADtn1j.mjs +163 -0
- package/.output/server/_ssr/GetHostQuery.graphql-C45XQo1i.mjs +127 -0
- package/.output/server/_ssr/HomeViewerQuery.graphql-Dote4Pkz.mjs +81 -0
- package/.output/server/_ssr/InstanceActorListQuery.graphql-DgItgN5t.mjs +167 -0
- package/.output/server/_ssr/InstanceDetailQuery.graphql-DP5wWWjX.mjs +367 -0
- package/.output/server/_ssr/InstanceSummary_instance.graphql-10tilF-Z.mjs +34 -0
- package/.output/server/_ssr/JNCCF6MP-BAZlBnvx.mjs +419 -0
- package/.output/server/_ssr/LP6E37CW-D2Ih_b_K.mjs +163 -0
- package/.output/server/_ssr/SignInMutation.graphql-BBXmiay6.mjs +72 -0
- package/.output/server/_ssr/TSB6MOZK-D06WZb6o.mjs +166 -0
- package/.output/server/_ssr/Toast-Bb1gcxED.mjs +947 -0
- package/.output/server/_ssr/WorkspaceQuery.graphql-DnCO8t-4.mjs +153 -0
- package/.output/server/_ssr/about-CD3QIgf_.mjs +14 -0
- package/.output/server/_ssr/actors-CMWf-xQU.mjs +1160 -0
- package/.output/server/_ssr/dist-D6rgyh-L.mjs +81 -0
- package/.output/server/_ssr/dist-I7KRMRbA.mjs +432 -0
- package/.output/server/_ssr/form.module-CTvIl1lm.mjs +192 -0
- package/.output/server/_ssr/index-C4crD6q-.mjs +347 -0
- package/.output/server/_ssr/index-yuhuc6-X.mjs +111 -0
- package/.output/server/_ssr/instance-ZYWGeWd3.mjs +280 -0
- package/.output/server/_ssr/label-DAXzanI9.mjs +9 -0
- package/.output/server/_ssr/objects-D5MVukzB.mjs +4316 -0
- package/.output/server/_ssr/routing-DKTLkkbY.mjs +620 -0
- package/.output/server/_ssr/sign-in-CNHZb_zL.mjs +264 -0
- package/.output/server/_ssr/ssr.mjs +6138 -0
- package/.output/server/index.mjs +691 -0
- package/LICENSE +661 -0
- package/README.md +143 -2
- package/dist/bridge.d.mts +39 -0
- package/dist/bridge.mjs +104 -0
- package/dist/bridge.mjs.map +1 -0
- package/dist/request-policy.d.mts +8 -0
- package/dist/request-policy.mjs +94 -0
- package/dist/request-policy.mjs.map +1 -0
- package/dist/runtime.d.mts +14 -0
- package/dist/runtime.mjs +44 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +111 -3
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/valibot@1.4.2_typescript@7.0.2/node_modules/valibot/dist/index.mjs
|
|
2
|
+
var store$4;
|
|
3
|
+
var DEFAULT_CONFIG = {
|
|
4
|
+
lang: void 0,
|
|
5
|
+
message: void 0,
|
|
6
|
+
abortEarly: void 0,
|
|
7
|
+
abortPipeEarly: void 0
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Returns the global configuration.
|
|
11
|
+
*
|
|
12
|
+
* @param config The config to merge.
|
|
13
|
+
*
|
|
14
|
+
* @returns The configuration.
|
|
15
|
+
*/
|
|
16
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
17
|
+
function getGlobalConfig(config$1) {
|
|
18
|
+
if (!config$1 && !store$4) return DEFAULT_CONFIG;
|
|
19
|
+
return {
|
|
20
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
21
|
+
message: config$1?.message,
|
|
22
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
23
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var store$3;
|
|
27
|
+
/**
|
|
28
|
+
* Returns a global error message.
|
|
29
|
+
*
|
|
30
|
+
* @param lang The language of the message.
|
|
31
|
+
*
|
|
32
|
+
* @returns The error message.
|
|
33
|
+
*/
|
|
34
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
35
|
+
function getGlobalMessage(lang) {
|
|
36
|
+
return store$3?.get(lang);
|
|
37
|
+
}
|
|
38
|
+
var store$2;
|
|
39
|
+
/**
|
|
40
|
+
* Returns a schema error message.
|
|
41
|
+
*
|
|
42
|
+
* @param lang The language of the message.
|
|
43
|
+
*
|
|
44
|
+
* @returns The error message.
|
|
45
|
+
*/
|
|
46
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
47
|
+
function getSchemaMessage(lang) {
|
|
48
|
+
return store$2?.get(lang);
|
|
49
|
+
}
|
|
50
|
+
var store$1;
|
|
51
|
+
/**
|
|
52
|
+
* Returns a specific error message.
|
|
53
|
+
*
|
|
54
|
+
* @param reference The identifier reference.
|
|
55
|
+
* @param lang The language of the message.
|
|
56
|
+
*
|
|
57
|
+
* @returns The error message.
|
|
58
|
+
*/
|
|
59
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
60
|
+
function getSpecificMessage(reference, lang) {
|
|
61
|
+
return store$1?.get(reference)?.get(lang);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Stringifies an unknown input to a literal or type string.
|
|
65
|
+
*
|
|
66
|
+
* @param input The unknown input.
|
|
67
|
+
*
|
|
68
|
+
* @returns A literal or type string.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
73
|
+
function _stringify(input) {
|
|
74
|
+
const type = typeof input;
|
|
75
|
+
if (type === "string") return `"${input}"`;
|
|
76
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
77
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
78
|
+
return type;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Adds an issue to the dataset.
|
|
82
|
+
*
|
|
83
|
+
* @param context The issue context.
|
|
84
|
+
* @param label The issue label.
|
|
85
|
+
* @param dataset The input dataset.
|
|
86
|
+
* @param config The configuration.
|
|
87
|
+
* @param other The optional props.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
92
|
+
const input = other && "input" in other ? other.input : dataset.value;
|
|
93
|
+
const expected = other?.expected ?? context.expects ?? null;
|
|
94
|
+
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
95
|
+
const issue = {
|
|
96
|
+
kind: context.kind,
|
|
97
|
+
type: context.type,
|
|
98
|
+
input,
|
|
99
|
+
expected,
|
|
100
|
+
received,
|
|
101
|
+
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
102
|
+
requirement: context.requirement,
|
|
103
|
+
path: other?.path,
|
|
104
|
+
issues: other?.issues,
|
|
105
|
+
lang: config$1.lang,
|
|
106
|
+
abortEarly: config$1.abortEarly,
|
|
107
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
108
|
+
};
|
|
109
|
+
const isSchema = context.kind === "schema";
|
|
110
|
+
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);
|
|
111
|
+
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
112
|
+
if (isSchema) dataset.typed = false;
|
|
113
|
+
if (dataset.issues) dataset.issues.push(issue);
|
|
114
|
+
else dataset.issues = [issue];
|
|
115
|
+
}
|
|
116
|
+
var _standardCache = /* @__PURE__ */ new WeakMap();
|
|
117
|
+
/**
|
|
118
|
+
* Returns the Standard Schema properties.
|
|
119
|
+
*
|
|
120
|
+
* @param context The schema context.
|
|
121
|
+
*
|
|
122
|
+
* @returns The Standard Schema properties.
|
|
123
|
+
*/
|
|
124
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
125
|
+
function _getStandardProps(context) {
|
|
126
|
+
let cached = _standardCache.get(context);
|
|
127
|
+
if (!cached) {
|
|
128
|
+
cached = {
|
|
129
|
+
version: 1,
|
|
130
|
+
vendor: "valibot",
|
|
131
|
+
validate(value$1) {
|
|
132
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
_standardCache.set(context, cached);
|
|
136
|
+
}
|
|
137
|
+
return cached;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Joins multiple `expects` values with the given separator.
|
|
141
|
+
*
|
|
142
|
+
* @param values The `expects` values.
|
|
143
|
+
* @param separator The separator.
|
|
144
|
+
*
|
|
145
|
+
* @returns The joined `expects` property.
|
|
146
|
+
*
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
150
|
+
function _joinExpects(values$1, separator) {
|
|
151
|
+
const list = [...new Set(values$1)];
|
|
152
|
+
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
153
|
+
return list[0] ?? "never";
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* [Email address](https://en.wikipedia.org/wiki/Email_address) regex.
|
|
157
|
+
*/
|
|
158
|
+
var EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
159
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
160
|
+
function check(requirement, message$1) {
|
|
161
|
+
return {
|
|
162
|
+
kind: "validation",
|
|
163
|
+
type: "check",
|
|
164
|
+
reference: check,
|
|
165
|
+
async: false,
|
|
166
|
+
expects: null,
|
|
167
|
+
requirement,
|
|
168
|
+
message: message$1,
|
|
169
|
+
"~run"(dataset, config$1) {
|
|
170
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
|
|
171
|
+
return dataset;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
176
|
+
function email(message$1) {
|
|
177
|
+
return {
|
|
178
|
+
kind: "validation",
|
|
179
|
+
type: "email",
|
|
180
|
+
reference: email,
|
|
181
|
+
expects: null,
|
|
182
|
+
async: false,
|
|
183
|
+
requirement: EMAIL_REGEX,
|
|
184
|
+
message: message$1,
|
|
185
|
+
"~run"(dataset, config$1) {
|
|
186
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);
|
|
187
|
+
return dataset;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
192
|
+
function integer(message$1) {
|
|
193
|
+
return {
|
|
194
|
+
kind: "validation",
|
|
195
|
+
type: "integer",
|
|
196
|
+
reference: integer,
|
|
197
|
+
async: false,
|
|
198
|
+
expects: null,
|
|
199
|
+
requirement: Number.isInteger,
|
|
200
|
+
message: message$1,
|
|
201
|
+
"~run"(dataset, config$1) {
|
|
202
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
|
|
203
|
+
return dataset;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
208
|
+
function maxLength(requirement, message$1) {
|
|
209
|
+
return {
|
|
210
|
+
kind: "validation",
|
|
211
|
+
type: "max_length",
|
|
212
|
+
reference: maxLength,
|
|
213
|
+
async: false,
|
|
214
|
+
expects: `<=${requirement}`,
|
|
215
|
+
requirement,
|
|
216
|
+
message: message$1,
|
|
217
|
+
"~run"(dataset, config$1) {
|
|
218
|
+
if (dataset.typed && dataset.value.length > this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
|
|
219
|
+
return dataset;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
224
|
+
function minLength(requirement, message$1) {
|
|
225
|
+
return {
|
|
226
|
+
kind: "validation",
|
|
227
|
+
type: "min_length",
|
|
228
|
+
reference: minLength,
|
|
229
|
+
async: false,
|
|
230
|
+
expects: `>=${requirement}`,
|
|
231
|
+
requirement,
|
|
232
|
+
message: message$1,
|
|
233
|
+
"~run"(dataset, config$1) {
|
|
234
|
+
if (dataset.typed && dataset.value.length < this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
|
|
235
|
+
return dataset;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
240
|
+
function minValue(requirement, message$1) {
|
|
241
|
+
return {
|
|
242
|
+
kind: "validation",
|
|
243
|
+
type: "min_value",
|
|
244
|
+
reference: minValue,
|
|
245
|
+
async: false,
|
|
246
|
+
expects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
247
|
+
requirement,
|
|
248
|
+
message: message$1,
|
|
249
|
+
"~run"(dataset, config$1) {
|
|
250
|
+
if (dataset.typed && !(dataset.value >= this.requirement)) _addIssue(this, "value", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });
|
|
251
|
+
return dataset;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
256
|
+
function nonEmpty(message$1) {
|
|
257
|
+
return {
|
|
258
|
+
kind: "validation",
|
|
259
|
+
type: "non_empty",
|
|
260
|
+
reference: nonEmpty,
|
|
261
|
+
async: false,
|
|
262
|
+
expects: "!0",
|
|
263
|
+
message: message$1,
|
|
264
|
+
"~run"(dataset, config$1) {
|
|
265
|
+
if (dataset.typed && dataset.value.length === 0) _addIssue(this, "length", dataset, config$1, { received: "0" });
|
|
266
|
+
return dataset;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
271
|
+
function parseJson(config$1, message$1) {
|
|
272
|
+
return {
|
|
273
|
+
kind: "transformation",
|
|
274
|
+
type: "parse_json",
|
|
275
|
+
reference: parseJson,
|
|
276
|
+
config: config$1,
|
|
277
|
+
message: message$1,
|
|
278
|
+
async: false,
|
|
279
|
+
"~run"(dataset, config$2) {
|
|
280
|
+
try {
|
|
281
|
+
dataset.value = JSON.parse(dataset.value, this.config?.reviver);
|
|
282
|
+
} catch (error) {
|
|
283
|
+
if (error instanceof Error) {
|
|
284
|
+
_addIssue(this, "JSON", dataset, config$2, { received: `"${error.message}"` });
|
|
285
|
+
dataset.typed = false;
|
|
286
|
+
} else throw error;
|
|
287
|
+
}
|
|
288
|
+
return dataset;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
293
|
+
function regex(requirement, message$1) {
|
|
294
|
+
return {
|
|
295
|
+
kind: "validation",
|
|
296
|
+
type: "regex",
|
|
297
|
+
reference: regex,
|
|
298
|
+
async: false,
|
|
299
|
+
expects: `${requirement}`,
|
|
300
|
+
requirement,
|
|
301
|
+
message: message$1,
|
|
302
|
+
"~run"(dataset, config$1) {
|
|
303
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config$1);
|
|
304
|
+
return dataset;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Creates a trim transformation action.
|
|
310
|
+
*
|
|
311
|
+
* @returns A trim action.
|
|
312
|
+
*/
|
|
313
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
314
|
+
function trim() {
|
|
315
|
+
return {
|
|
316
|
+
kind: "transformation",
|
|
317
|
+
type: "trim",
|
|
318
|
+
reference: trim,
|
|
319
|
+
async: false,
|
|
320
|
+
"~run"(dataset) {
|
|
321
|
+
dataset.value = dataset.value.trim();
|
|
322
|
+
return dataset;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
327
|
+
function url(message$1) {
|
|
328
|
+
return {
|
|
329
|
+
kind: "validation",
|
|
330
|
+
type: "url",
|
|
331
|
+
reference: url,
|
|
332
|
+
async: false,
|
|
333
|
+
expects: null,
|
|
334
|
+
requirement(input) {
|
|
335
|
+
try {
|
|
336
|
+
new URL(input);
|
|
337
|
+
return true;
|
|
338
|
+
} catch {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
message: message$1,
|
|
343
|
+
"~run"(dataset, config$1) {
|
|
344
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
|
|
345
|
+
return dataset;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Returns the fallback value of the schema.
|
|
351
|
+
*
|
|
352
|
+
* @param schema The schema to get it from.
|
|
353
|
+
* @param dataset The output dataset if available.
|
|
354
|
+
* @param config The config if available.
|
|
355
|
+
*
|
|
356
|
+
* @returns The fallback value.
|
|
357
|
+
*/
|
|
358
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
359
|
+
function getFallback(schema, dataset, config$1) {
|
|
360
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Returns the default value of the schema.
|
|
364
|
+
*
|
|
365
|
+
* @param schema The schema to get it from.
|
|
366
|
+
* @param dataset The input dataset if available.
|
|
367
|
+
* @param config The config if available.
|
|
368
|
+
*
|
|
369
|
+
* @returns The default value.
|
|
370
|
+
*/
|
|
371
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
372
|
+
function getDefault(schema, dataset, config$1) {
|
|
373
|
+
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
374
|
+
}
|
|
375
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
376
|
+
function array(item, message$1) {
|
|
377
|
+
return {
|
|
378
|
+
kind: "schema",
|
|
379
|
+
type: "array",
|
|
380
|
+
reference: array,
|
|
381
|
+
expects: "Array",
|
|
382
|
+
async: false,
|
|
383
|
+
item,
|
|
384
|
+
message: message$1,
|
|
385
|
+
get "~standard"() {
|
|
386
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
387
|
+
},
|
|
388
|
+
"~run"(dataset, config$1) {
|
|
389
|
+
const input = dataset.value;
|
|
390
|
+
if (Array.isArray(input)) {
|
|
391
|
+
dataset.typed = true;
|
|
392
|
+
dataset.value = [];
|
|
393
|
+
for (let key = 0; key < input.length; key++) {
|
|
394
|
+
const value$1 = input[key];
|
|
395
|
+
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
396
|
+
if (itemDataset.issues) {
|
|
397
|
+
const pathItem = {
|
|
398
|
+
type: "array",
|
|
399
|
+
origin: "value",
|
|
400
|
+
input,
|
|
401
|
+
key,
|
|
402
|
+
value: value$1
|
|
403
|
+
};
|
|
404
|
+
for (const issue of itemDataset.issues) {
|
|
405
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
406
|
+
else issue.path = [pathItem];
|
|
407
|
+
dataset.issues?.push(issue);
|
|
408
|
+
}
|
|
409
|
+
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
410
|
+
if (config$1.abortEarly) {
|
|
411
|
+
dataset.typed = false;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (!itemDataset.typed) dataset.typed = false;
|
|
416
|
+
dataset.value.push(itemDataset.value);
|
|
417
|
+
}
|
|
418
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
419
|
+
return dataset;
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
424
|
+
function number(message$1) {
|
|
425
|
+
return {
|
|
426
|
+
kind: "schema",
|
|
427
|
+
type: "number",
|
|
428
|
+
reference: number,
|
|
429
|
+
expects: "number",
|
|
430
|
+
async: false,
|
|
431
|
+
message: message$1,
|
|
432
|
+
get "~standard"() {
|
|
433
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
434
|
+
},
|
|
435
|
+
"~run"(dataset, config$1) {
|
|
436
|
+
if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
|
|
437
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
438
|
+
return dataset;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
443
|
+
function object(entries$1, message$1) {
|
|
444
|
+
return {
|
|
445
|
+
kind: "schema",
|
|
446
|
+
type: "object",
|
|
447
|
+
reference: object,
|
|
448
|
+
expects: "Object",
|
|
449
|
+
async: false,
|
|
450
|
+
entries: entries$1,
|
|
451
|
+
message: message$1,
|
|
452
|
+
get "~standard"() {
|
|
453
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
454
|
+
},
|
|
455
|
+
"~run"(dataset, config$1) {
|
|
456
|
+
const input = dataset.value;
|
|
457
|
+
if (input && typeof input === "object") {
|
|
458
|
+
dataset.typed = true;
|
|
459
|
+
dataset.value = {};
|
|
460
|
+
for (const key in this.entries) {
|
|
461
|
+
const valueSchema = this.entries[key];
|
|
462
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
463
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
464
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
465
|
+
if (valueDataset.issues) {
|
|
466
|
+
const pathItem = {
|
|
467
|
+
type: "object",
|
|
468
|
+
origin: "value",
|
|
469
|
+
input,
|
|
470
|
+
key,
|
|
471
|
+
value: value$1
|
|
472
|
+
};
|
|
473
|
+
for (const issue of valueDataset.issues) {
|
|
474
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
475
|
+
else issue.path = [pathItem];
|
|
476
|
+
dataset.issues?.push(issue);
|
|
477
|
+
}
|
|
478
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
479
|
+
if (config$1.abortEarly) {
|
|
480
|
+
dataset.typed = false;
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
485
|
+
dataset.value[key] = valueDataset.value;
|
|
486
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
487
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
488
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
489
|
+
input: void 0,
|
|
490
|
+
expected: `"${key}"`,
|
|
491
|
+
path: [{
|
|
492
|
+
type: "object",
|
|
493
|
+
origin: "key",
|
|
494
|
+
input,
|
|
495
|
+
key,
|
|
496
|
+
value: input[key]
|
|
497
|
+
}]
|
|
498
|
+
});
|
|
499
|
+
if (config$1.abortEarly) break;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
503
|
+
return dataset;
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
508
|
+
function optional(wrapped, default_) {
|
|
509
|
+
return {
|
|
510
|
+
kind: "schema",
|
|
511
|
+
type: "optional",
|
|
512
|
+
reference: optional,
|
|
513
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
514
|
+
async: false,
|
|
515
|
+
wrapped,
|
|
516
|
+
default: default_,
|
|
517
|
+
get "~standard"() {
|
|
518
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
519
|
+
},
|
|
520
|
+
"~run"(dataset, config$1) {
|
|
521
|
+
if (dataset.value === void 0) {
|
|
522
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
523
|
+
if (dataset.value === void 0) {
|
|
524
|
+
dataset.typed = true;
|
|
525
|
+
return dataset;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
533
|
+
function picklist(options, message$1) {
|
|
534
|
+
return {
|
|
535
|
+
kind: "schema",
|
|
536
|
+
type: "picklist",
|
|
537
|
+
reference: picklist,
|
|
538
|
+
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
539
|
+
async: false,
|
|
540
|
+
options,
|
|
541
|
+
message: message$1,
|
|
542
|
+
get "~standard"() {
|
|
543
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
544
|
+
},
|
|
545
|
+
"~run"(dataset, config$1) {
|
|
546
|
+
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
547
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
548
|
+
return dataset;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
553
|
+
function strictObject(entries$1, message$1) {
|
|
554
|
+
return {
|
|
555
|
+
kind: "schema",
|
|
556
|
+
type: "strict_object",
|
|
557
|
+
reference: strictObject,
|
|
558
|
+
expects: "Object",
|
|
559
|
+
async: false,
|
|
560
|
+
entries: entries$1,
|
|
561
|
+
message: message$1,
|
|
562
|
+
get "~standard"() {
|
|
563
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
564
|
+
},
|
|
565
|
+
"~run"(dataset, config$1) {
|
|
566
|
+
const input = dataset.value;
|
|
567
|
+
if (input && typeof input === "object") {
|
|
568
|
+
dataset.typed = true;
|
|
569
|
+
dataset.value = {};
|
|
570
|
+
for (const key in this.entries) {
|
|
571
|
+
const valueSchema = this.entries[key];
|
|
572
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
573
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
574
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
575
|
+
if (valueDataset.issues) {
|
|
576
|
+
const pathItem = {
|
|
577
|
+
type: "object",
|
|
578
|
+
origin: "value",
|
|
579
|
+
input,
|
|
580
|
+
key,
|
|
581
|
+
value: value$1
|
|
582
|
+
};
|
|
583
|
+
for (const issue of valueDataset.issues) {
|
|
584
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
585
|
+
else issue.path = [pathItem];
|
|
586
|
+
dataset.issues?.push(issue);
|
|
587
|
+
}
|
|
588
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
589
|
+
if (config$1.abortEarly) {
|
|
590
|
+
dataset.typed = false;
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
595
|
+
dataset.value[key] = valueDataset.value;
|
|
596
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
597
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
598
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
599
|
+
input: void 0,
|
|
600
|
+
expected: `"${key}"`,
|
|
601
|
+
path: [{
|
|
602
|
+
type: "object",
|
|
603
|
+
origin: "key",
|
|
604
|
+
input,
|
|
605
|
+
key,
|
|
606
|
+
value: input[key]
|
|
607
|
+
}]
|
|
608
|
+
});
|
|
609
|
+
if (config$1.abortEarly) break;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
613
|
+
for (const key in input) if (!(key in this.entries)) {
|
|
614
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
615
|
+
input: key,
|
|
616
|
+
expected: "never",
|
|
617
|
+
path: [{
|
|
618
|
+
type: "object",
|
|
619
|
+
origin: "key",
|
|
620
|
+
input,
|
|
621
|
+
key,
|
|
622
|
+
value: input[key]
|
|
623
|
+
}]
|
|
624
|
+
});
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
629
|
+
return dataset;
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
634
|
+
function string(message$1) {
|
|
635
|
+
return {
|
|
636
|
+
kind: "schema",
|
|
637
|
+
type: "string",
|
|
638
|
+
reference: string,
|
|
639
|
+
expects: "string",
|
|
640
|
+
async: false,
|
|
641
|
+
message: message$1,
|
|
642
|
+
get "~standard"() {
|
|
643
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
644
|
+
},
|
|
645
|
+
"~run"(dataset, config$1) {
|
|
646
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
647
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
648
|
+
return dataset;
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
653
|
+
function pipe(...pipe$1) {
|
|
654
|
+
return {
|
|
655
|
+
...pipe$1[0],
|
|
656
|
+
pipe: pipe$1,
|
|
657
|
+
get "~standard"() {
|
|
658
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
659
|
+
},
|
|
660
|
+
"~run"(dataset, config$1) {
|
|
661
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
662
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
663
|
+
dataset.typed = false;
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
667
|
+
}
|
|
668
|
+
return dataset;
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Parses an unknown input based on a schema.
|
|
674
|
+
*
|
|
675
|
+
* @param schema The schema to be used.
|
|
676
|
+
* @param input The input to be parsed.
|
|
677
|
+
* @param config The parse configuration.
|
|
678
|
+
*
|
|
679
|
+
* @returns The parse result.
|
|
680
|
+
*/
|
|
681
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
682
|
+
function safeParse(schema, input, config$1) {
|
|
683
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
684
|
+
return {
|
|
685
|
+
typed: dataset.typed,
|
|
686
|
+
success: !dataset.issues,
|
|
687
|
+
output: dataset.value,
|
|
688
|
+
issues: dataset.issues
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Parses an unknown input based on a schema.
|
|
693
|
+
*
|
|
694
|
+
* @param schema The schema to be used.
|
|
695
|
+
* @param input The input to be parsed.
|
|
696
|
+
* @param config The parse configuration.
|
|
697
|
+
*
|
|
698
|
+
* @returns The parse result.
|
|
699
|
+
*/
|
|
700
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
701
|
+
async function safeParseAsync(schema, input, config$1) {
|
|
702
|
+
const dataset = await schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
703
|
+
return {
|
|
704
|
+
typed: dataset.typed,
|
|
705
|
+
success: !dataset.issues,
|
|
706
|
+
output: dataset.value,
|
|
707
|
+
issues: dataset.issues
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
export { url as S, safeParse as _, integer as a, string as b, minValue as c, object as d, optional as f, regex as g, pipe as h, getDefault as i, nonEmpty as l, picklist as m, check as n, maxLength as o, parseJson as p, email as r, minLength as s, array as t, number as u, safeParseAsync as v, trim as x, strictObject as y };
|