@wirecat/attio-cli 0.9.0 → 0.10.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/CHANGELOG.md +12 -0
- package/contracts/wirecat.json +1 -0
- package/dist/bin/attio.js +11 -11
- package/dist/bundle/attio.js +5 -166
- package/dist/bundle/{chunk-6E5QWCBK.js → chunk-OGWKDPR5.js} +2 -1
- package/dist/bundle/chunk-TQAECZFO.js +13 -0
- package/dist/bundle/{definitions-FODOIPM2.js → definitions-J73IBAHT.js} +1 -1
- package/dist/bundle/program-NSBWZ25F.js +6201 -0
- package/dist/bundle/{schemas-YGSTNU6F.js → schemas-G3HFAS45.js} +576 -29
- package/dist/commands/api.js +1 -2
- package/dist/commands/crm.js +1 -4
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/session.js +1 -2
- package/dist/config.js +1 -2
- package/dist/context.js +1 -1
- package/dist/identity.js +1 -0
- package/dist/program.js +1 -2
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/activities.d.ts +0 -4
- package/dist/activities.d.ts.map +0 -1
- package/dist/activities.js.map +0 -1
- package/dist/bin/attio.d.ts +0 -3
- package/dist/bin/attio.d.ts.map +0 -1
- package/dist/bin/attio.js.map +0 -1
- package/dist/bundle/agent-C3SZOGZS.js +0 -38
- package/dist/bundle/all-profiles-673VSTRG.js +0 -320
- package/dist/bundle/anthropic-V4RZS5XM.js +0 -91
- package/dist/bundle/app-server-CTEDPA5H.js +0 -249
- package/dist/bundle/bun-F4M4KCNA.js +0 -169
- package/dist/bundle/bun-sqlite-33JTNHCK.js +0 -76
- package/dist/bundle/chunk-2R2EX5I6.js +0 -54
- package/dist/bundle/chunk-5EH7S4RM.js +0 -362
- package/dist/bundle/chunk-5N2V6XO7.js +0 -119
- package/dist/bundle/chunk-5WY6RURV.js +0 -161
- package/dist/bundle/chunk-6V7ZUJI6.js +0 -4072
- package/dist/bundle/chunk-AOKAYQSJ.js +0 -2338
- package/dist/bundle/chunk-AQ5RIOUE.js +0 -633
- package/dist/bundle/chunk-B4DVW2BA.js +0 -185
- package/dist/bundle/chunk-C7JPYWYQ.js +0 -77
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DBHZ7TQ7.js +0 -69828
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-E2L4R6EI.js +0 -388
- package/dist/bundle/chunk-EDWRHVHD.js +0 -218
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EV6B3GHM.js +0 -323
- package/dist/bundle/chunk-FBWECICU.js +0 -259
- package/dist/bundle/chunk-FFER7KJI.js +0 -407
- package/dist/bundle/chunk-FTH6WGYO.js +0 -24
- package/dist/bundle/chunk-G3PK5BZB.js +0 -1222
- package/dist/bundle/chunk-G46PNDWL.js +0 -58
- package/dist/bundle/chunk-G6NY7LFB.js +0 -230
- package/dist/bundle/chunk-GLU36VKA.js +0 -52
- package/dist/bundle/chunk-GZ7WBU5Y.js +0 -18
- package/dist/bundle/chunk-HMYBAVIE.js +0 -86
- package/dist/bundle/chunk-HOJJPSLU.js +0 -288
- package/dist/bundle/chunk-HUAHLO6N.js +0 -29
- package/dist/bundle/chunk-ISQ23VKV.js +0 -123
- package/dist/bundle/chunk-J2LSOG3A.js +0 -12766
- package/dist/bundle/chunk-K5L77R7P.js +0 -66
- package/dist/bundle/chunk-KKRFVN4X.js +0 -1835
- package/dist/bundle/chunk-KLRCTMES.js +0 -100
- package/dist/bundle/chunk-KYRYD4CR.js +0 -38
- package/dist/bundle/chunk-L5QLKUQR.js +0 -794
- package/dist/bundle/chunk-MFSWMNSZ.js +0 -334
- package/dist/bundle/chunk-MYK2F5LD.js +0 -1251
- package/dist/bundle/chunk-NBNQLNVV.js +0 -388
- package/dist/bundle/chunk-O3DZDITT.js +0 -274
- package/dist/bundle/chunk-OEEWVKJX.js +0 -53
- package/dist/bundle/chunk-P5XYQZVW.js +0 -80
- package/dist/bundle/chunk-P6OJKJJS.js +0 -1197
- package/dist/bundle/chunk-P6S3ZRVW.js +0 -106
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-QBJRK733.js +0 -1068
- package/dist/bundle/chunk-QBYE26ZC.js +0 -131
- package/dist/bundle/chunk-QPPOIWPY.js +0 -1246
- package/dist/bundle/chunk-R2CEA7MK.js +0 -743
- package/dist/bundle/chunk-S4UUN6LD.js +0 -1410
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-SKUY7JDA.js +0 -164
- package/dist/bundle/chunk-T35IOBPJ.js +0 -1341
- package/dist/bundle/chunk-T3W4V4A6.js +0 -63
- package/dist/bundle/chunk-TB3LN5G2.js +0 -50
- package/dist/bundle/chunk-TCT5D2X2.js +0 -6848
- package/dist/bundle/chunk-TES7MB6I.js +0 -82
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-U7UTYALA.js +0 -353
- package/dist/bundle/chunk-UOWHMOU3.js +0 -188
- package/dist/bundle/chunk-UXDUWGX6.js +0 -2791
- package/dist/bundle/chunk-V5I3QHDU.js +0 -558
- package/dist/bundle/chunk-VCDIKCFE.js +0 -1007
- package/dist/bundle/chunk-VJHUMB7U.js +0 -338
- package/dist/bundle/chunk-W4KLHM2K.js +0 -95
- package/dist/bundle/chunk-W5LKEOGN.js +0 -142
- package/dist/bundle/chunk-WLDZWHSF.js +0 -170
- package/dist/bundle/chunk-WQEEYEWO.js +0 -3752
- package/dist/bundle/chunk-WRF6TY63.js +0 -1521
- package/dist/bundle/chunk-WXYOELRI.js +0 -108
- package/dist/bundle/chunk-WZBPUOWM.js +0 -76
- package/dist/bundle/chunk-XGNZD52X.js +0 -592
- package/dist/bundle/chunk-XQUUANA2.js +0 -24600
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YQH4J6YZ.js +0 -358
- package/dist/bundle/chunk-Z7Y2I5YR.js +0 -44045
- package/dist/bundle/chunk-ZBCC7MBN.js +0 -9671
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/command-contract-ZL67KMYL.js +0 -37
- package/dist/bundle/command-server-entry-COR2VDRU.js +0 -166
- package/dist/bundle/decode-33SGRQM6.js +0 -297
- package/dist/bundle/dispatch-2FTOHA5D.js +0 -411
- package/dist/bundle/dist-EM7KLEG4.js +0 -7577
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/echarts-QMAA7HH5.js +0 -42501
- package/dist/bundle/embed-W4ZBXPWD.js +0 -38
- package/dist/bundle/embedder-73CCZC52.js +0 -111
- package/dist/bundle/failure-OHIXWTR6.js +0 -25
- package/dist/bundle/first-run-MOSUMMVX.js +0 -28
- package/dist/bundle/first-screen-GUXBF3SL.js +0 -38
- package/dist/bundle/instructions-4H7UREH2.js +0 -11
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-QMIZOBBJ.js +0 -24
- package/dist/bundle/meeting-model-2UYVGXD5.js +0 -25
- package/dist/bundle/meeting-semantic-LEJPUIN3.js +0 -22
- package/dist/bundle/node-KM3CUABH.js +0 -2340
- package/dist/bundle/node-P3PUHKYH.js +0 -176
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-UHPODTKB.js +0 -74
- package/dist/bundle/oauth-T3DWL7OV.js +0 -20
- package/dist/bundle/open-ODWX32PF.js +0 -23
- package/dist/bundle/openai-GSXXHKPX.js +0 -238
- package/dist/bundle/process-AFIXYXWL.js +0 -91
- package/dist/bundle/program-SXSUG335.js +0 -35250
- package/dist/bundle/prompt-GVTYTFK7.js +0 -17
- package/dist/bundle/recognize-XDSZEZP5.js +0 -26
- package/dist/bundle/remote-ZWZKMEY6.js +0 -31
- package/dist/bundle/rerank-OBZQ54NL.js +0 -52
- package/dist/bundle/serve-NY5MUTNW.js +0 -199
- package/dist/bundle/server-JK334V5Y.js +0 -212
- package/dist/bundle/server-VOPYQCUD.js +0 -79
- package/dist/bundle/sqlite-runtime-2NHF4S6G.js +0 -20
- package/dist/bundle/state-YGWZZWPM.js +0 -36
- package/dist/bundle/store-LRQUTFJR.js +0 -306
- package/dist/bundle/store-ND6KU4RI.js +0 -181
- package/dist/bundle/store-maintenance-command-GLYGQM2V.js +0 -66
- package/dist/bundle/surface-P53WLLXP.js +0 -65
- package/dist/commands/api.d.ts +0 -12
- package/dist/commands/api.d.ts.map +0 -1
- package/dist/commands/api.js.map +0 -1
- package/dist/commands/crm.d.ts +0 -7
- package/dist/commands/crm.d.ts.map +0 -1
- package/dist/commands/crm.js.map +0 -1
- package/dist/commands/schedule.d.ts +0 -3
- package/dist/commands/schedule.d.ts.map +0 -1
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/session.d.ts +0 -8
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/config.d.ts +0 -13
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -37
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/generated/definitions.d.ts +0 -3
- package/dist/generated/definitions.d.ts.map +0 -1
- package/dist/generated/definitions.js.map +0 -1
- package/dist/generated/manifest.d.ts +0 -6
- package/dist/generated/manifest.d.ts.map +0 -1
- package/dist/generated/manifest.js.map +0 -1
- package/dist/generated/schemas.d.ts +0 -383
- package/dist/generated/schemas.d.ts.map +0 -1
- package/dist/generated/schemas.js.map +0 -1
- package/dist/generated/types.d.ts +0 -10166
- package/dist/generated/types.d.ts.map +0 -1
- package/dist/generated/types.js.map +0 -1
- package/dist/generated/wirecat-config.d.ts +0 -15
- package/dist/generated/wirecat-config.d.ts.map +0 -1
- package/dist/generated/wirecat-config.js.map +0 -1
- package/dist/hooks.d.ts +0 -33
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/identity.d.ts +0 -33
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/links.d.ts +0 -10
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js.map +0 -1
- package/dist/meetings.d.ts +0 -57
- package/dist/meetings.d.ts.map +0 -1
- package/dist/meetings.js.map +0 -1
- package/dist/program.d.ts +0 -6
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/wcat.d.ts +0 -3
- package/dist/wcat.d.ts.map +0 -1
- package/dist/wcat.js.map +0 -1
|
@@ -1,1410 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
__name
|
|
5
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
-
|
|
7
|
-
// node_modules/.pnpm/valibot@1.5.0_typescript@7.0.2/node_modules/valibot/dist/index.mjs
|
|
8
|
-
var store$4;
|
|
9
|
-
var DEFAULT_CONFIG = {
|
|
10
|
-
lang: void 0,
|
|
11
|
-
message: void 0,
|
|
12
|
-
abortEarly: void 0,
|
|
13
|
-
abortPipeEarly: void 0
|
|
14
|
-
};
|
|
15
|
-
// @__NO_SIDE_EFFECTS__
|
|
16
|
-
function getGlobalConfig(config$1) {
|
|
17
|
-
if (!config$1 && !store$4) return DEFAULT_CONFIG;
|
|
18
|
-
return {
|
|
19
|
-
lang: config$1?.lang ?? store$4?.lang,
|
|
20
|
-
message: config$1?.message,
|
|
21
|
-
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
22
|
-
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
__name(getGlobalConfig, "getGlobalConfig");
|
|
26
|
-
var store$3;
|
|
27
|
-
// @__NO_SIDE_EFFECTS__
|
|
28
|
-
function getGlobalMessage(lang) {
|
|
29
|
-
return store$3?.get(lang);
|
|
30
|
-
}
|
|
31
|
-
__name(getGlobalMessage, "getGlobalMessage");
|
|
32
|
-
var store$2;
|
|
33
|
-
// @__NO_SIDE_EFFECTS__
|
|
34
|
-
function getSchemaMessage(lang) {
|
|
35
|
-
return store$2?.get(lang);
|
|
36
|
-
}
|
|
37
|
-
__name(getSchemaMessage, "getSchemaMessage");
|
|
38
|
-
var store$1;
|
|
39
|
-
// @__NO_SIDE_EFFECTS__
|
|
40
|
-
function getSpecificMessage(reference, lang) {
|
|
41
|
-
return store$1?.get(reference)?.get(lang);
|
|
42
|
-
}
|
|
43
|
-
__name(getSpecificMessage, "getSpecificMessage");
|
|
44
|
-
// @__NO_SIDE_EFFECTS__
|
|
45
|
-
function _stringify(input) {
|
|
46
|
-
const type = typeof input;
|
|
47
|
-
if (type === "string") return `"${input}"`;
|
|
48
|
-
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
49
|
-
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
50
|
-
return type;
|
|
51
|
-
}
|
|
52
|
-
__name(_stringify, "_stringify");
|
|
53
|
-
function _addIssue(context, label, dataset, config$1, other) {
|
|
54
|
-
const input = other && "input" in other ? other.input : dataset.value;
|
|
55
|
-
const expected = other?.expected ?? context.expects ?? null;
|
|
56
|
-
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
57
|
-
const issue = {
|
|
58
|
-
kind: context.kind,
|
|
59
|
-
type: context.type,
|
|
60
|
-
input,
|
|
61
|
-
expected,
|
|
62
|
-
received,
|
|
63
|
-
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
64
|
-
requirement: context.requirement,
|
|
65
|
-
path: other?.path,
|
|
66
|
-
issues: other?.issues,
|
|
67
|
-
lang: config$1.lang,
|
|
68
|
-
abortEarly: config$1.abortEarly,
|
|
69
|
-
abortPipeEarly: config$1.abortPipeEarly
|
|
70
|
-
};
|
|
71
|
-
const isSchema = context.kind === "schema";
|
|
72
|
-
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);
|
|
73
|
-
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
74
|
-
if (isSchema) dataset.typed = false;
|
|
75
|
-
if (dataset.issues) dataset.issues.push(issue);
|
|
76
|
-
else dataset.issues = [issue];
|
|
77
|
-
}
|
|
78
|
-
__name(_addIssue, "_addIssue");
|
|
79
|
-
// @__NO_SIDE_EFFECTS__
|
|
80
|
-
function _isSameValueZero(value1, value2) {
|
|
81
|
-
return value1 === value2 || Number.isNaN(value1) && Number.isNaN(value2);
|
|
82
|
-
}
|
|
83
|
-
__name(_isSameValueZero, "_isSameValueZero");
|
|
84
|
-
// @__NO_SIDE_EFFECTS__
|
|
85
|
-
function _isValidObjectKey(object$1, key) {
|
|
86
|
-
return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
87
|
-
}
|
|
88
|
-
__name(_isValidObjectKey, "_isValidObjectKey");
|
|
89
|
-
// @__NO_SIDE_EFFECTS__
|
|
90
|
-
function _joinExpects(values$1, separator) {
|
|
91
|
-
const list = [...new Set(values$1)];
|
|
92
|
-
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
93
|
-
return list[0] ?? "never";
|
|
94
|
-
}
|
|
95
|
-
__name(_joinExpects, "_joinExpects");
|
|
96
|
-
function _standardSchema(schema) {
|
|
97
|
-
schema["~standard"] = {
|
|
98
|
-
version: 1,
|
|
99
|
-
vendor: "valibot",
|
|
100
|
-
validate: /* @__PURE__ */ __name((value$1) => schema["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig()), "validate")
|
|
101
|
-
};
|
|
102
|
-
return schema;
|
|
103
|
-
}
|
|
104
|
-
__name(_standardSchema, "_standardSchema");
|
|
105
|
-
// @__NO_SIDE_EFFECTS__
|
|
106
|
-
function getDotPath(issue) {
|
|
107
|
-
if (issue.path) {
|
|
108
|
-
let key = "";
|
|
109
|
-
for (const item of issue.path) if (typeof item.key === "string" || typeof item.key === "number") if (key) key += `.${item.key}`;
|
|
110
|
-
else key += item.key;
|
|
111
|
-
else return null;
|
|
112
|
-
return key;
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
__name(getDotPath, "getDotPath");
|
|
117
|
-
var ValiError = class extends Error {
|
|
118
|
-
static {
|
|
119
|
-
__name(this, "ValiError");
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Creates a Valibot error with useful information.
|
|
123
|
-
*
|
|
124
|
-
* @param issues The error issues.
|
|
125
|
-
*/
|
|
126
|
-
constructor(issues) {
|
|
127
|
-
super(issues[0].message);
|
|
128
|
-
this.name = "ValiError";
|
|
129
|
-
this.issues = issues;
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
var EMOJI_REGEX = new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$", "u");
|
|
133
|
-
var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;
|
|
134
|
-
var ISO_TIMESTAMP_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;
|
|
135
|
-
// @__NO_SIDE_EFFECTS__
|
|
136
|
-
function check(requirement, message$1) {
|
|
137
|
-
return {
|
|
138
|
-
kind: "validation",
|
|
139
|
-
type: "check",
|
|
140
|
-
reference: check,
|
|
141
|
-
async: false,
|
|
142
|
-
expects: null,
|
|
143
|
-
requirement,
|
|
144
|
-
message: message$1,
|
|
145
|
-
"~run"(dataset, config$1) {
|
|
146
|
-
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
|
|
147
|
-
return dataset;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
__name(check, "check");
|
|
152
|
-
// @__NO_SIDE_EFFECTS__
|
|
153
|
-
function description(description_) {
|
|
154
|
-
return {
|
|
155
|
-
kind: "metadata",
|
|
156
|
-
type: "description",
|
|
157
|
-
reference: description,
|
|
158
|
-
description: description_
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
__name(description, "description");
|
|
162
|
-
// @__NO_SIDE_EFFECTS__
|
|
163
|
-
function endsWith(requirement, message$1) {
|
|
164
|
-
return {
|
|
165
|
-
kind: "validation",
|
|
166
|
-
type: "ends_with",
|
|
167
|
-
reference: endsWith,
|
|
168
|
-
async: false,
|
|
169
|
-
expects: `"${requirement}"`,
|
|
170
|
-
requirement,
|
|
171
|
-
message: message$1,
|
|
172
|
-
"~run"(dataset, config$1) {
|
|
173
|
-
if (dataset.typed && !dataset.value.endsWith(this.requirement)) _addIssue(this, "end", dataset, config$1, { received: `"${dataset.value.slice(-this.requirement.length)}"` });
|
|
174
|
-
return dataset;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
__name(endsWith, "endsWith");
|
|
179
|
-
// @__NO_SIDE_EFFECTS__
|
|
180
|
-
function finite(message$1) {
|
|
181
|
-
return {
|
|
182
|
-
kind: "validation",
|
|
183
|
-
type: "finite",
|
|
184
|
-
reference: finite,
|
|
185
|
-
async: false,
|
|
186
|
-
expects: null,
|
|
187
|
-
requirement: Number.isFinite,
|
|
188
|
-
message: message$1,
|
|
189
|
-
"~run"(dataset, config$1) {
|
|
190
|
-
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "finite", dataset, config$1);
|
|
191
|
-
return dataset;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
__name(finite, "finite");
|
|
196
|
-
// @__NO_SIDE_EFFECTS__
|
|
197
|
-
function integer(message$1) {
|
|
198
|
-
return {
|
|
199
|
-
kind: "validation",
|
|
200
|
-
type: "integer",
|
|
201
|
-
reference: integer,
|
|
202
|
-
async: false,
|
|
203
|
-
expects: null,
|
|
204
|
-
requirement: Number.isInteger,
|
|
205
|
-
message: message$1,
|
|
206
|
-
"~run"(dataset, config$1) {
|
|
207
|
-
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
|
|
208
|
-
return dataset;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
__name(integer, "integer");
|
|
213
|
-
// @__NO_SIDE_EFFECTS__
|
|
214
|
-
function isoDate(message$1) {
|
|
215
|
-
return {
|
|
216
|
-
kind: "validation",
|
|
217
|
-
type: "iso_date",
|
|
218
|
-
reference: isoDate,
|
|
219
|
-
async: false,
|
|
220
|
-
expects: null,
|
|
221
|
-
requirement: ISO_DATE_REGEX,
|
|
222
|
-
message: message$1,
|
|
223
|
-
"~run"(dataset, config$1) {
|
|
224
|
-
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date", dataset, config$1);
|
|
225
|
-
return dataset;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
__name(isoDate, "isoDate");
|
|
230
|
-
// @__NO_SIDE_EFFECTS__
|
|
231
|
-
function isoTimestamp(message$1) {
|
|
232
|
-
return {
|
|
233
|
-
kind: "validation",
|
|
234
|
-
type: "iso_timestamp",
|
|
235
|
-
reference: isoTimestamp,
|
|
236
|
-
async: false,
|
|
237
|
-
expects: null,
|
|
238
|
-
requirement: ISO_TIMESTAMP_REGEX,
|
|
239
|
-
message: message$1,
|
|
240
|
-
"~run"(dataset, config$1) {
|
|
241
|
-
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
|
|
242
|
-
return dataset;
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
__name(isoTimestamp, "isoTimestamp");
|
|
247
|
-
// @__NO_SIDE_EFFECTS__
|
|
248
|
-
function maxEntries(requirement, message$1) {
|
|
249
|
-
return {
|
|
250
|
-
kind: "validation",
|
|
251
|
-
type: "max_entries",
|
|
252
|
-
reference: maxEntries,
|
|
253
|
-
async: false,
|
|
254
|
-
expects: `<=${requirement}`,
|
|
255
|
-
requirement,
|
|
256
|
-
message: message$1,
|
|
257
|
-
"~run"(dataset, config$1) {
|
|
258
|
-
if (!dataset.typed) return dataset;
|
|
259
|
-
const count = Object.keys(dataset.value).length;
|
|
260
|
-
if (dataset.typed && count > this.requirement) _addIssue(this, "entries", dataset, config$1, { received: `${count}` });
|
|
261
|
-
return dataset;
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
__name(maxEntries, "maxEntries");
|
|
266
|
-
// @__NO_SIDE_EFFECTS__
|
|
267
|
-
function maxLength(requirement, message$1) {
|
|
268
|
-
return {
|
|
269
|
-
kind: "validation",
|
|
270
|
-
type: "max_length",
|
|
271
|
-
reference: maxLength,
|
|
272
|
-
async: false,
|
|
273
|
-
expects: `<=${requirement}`,
|
|
274
|
-
requirement,
|
|
275
|
-
message: message$1,
|
|
276
|
-
"~run"(dataset, config$1) {
|
|
277
|
-
if (dataset.typed && dataset.value.length > this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
|
|
278
|
-
return dataset;
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
__name(maxLength, "maxLength");
|
|
283
|
-
// @__NO_SIDE_EFFECTS__
|
|
284
|
-
function maxValue(requirement, message$1) {
|
|
285
|
-
return {
|
|
286
|
-
kind: "validation",
|
|
287
|
-
type: "max_value",
|
|
288
|
-
reference: maxValue,
|
|
289
|
-
async: false,
|
|
290
|
-
expects: `<=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
291
|
-
requirement,
|
|
292
|
-
message: message$1,
|
|
293
|
-
"~run"(dataset, config$1) {
|
|
294
|
-
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) });
|
|
295
|
-
return dataset;
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
__name(maxValue, "maxValue");
|
|
300
|
-
// @__NO_SIDE_EFFECTS__
|
|
301
|
-
function minLength(requirement, message$1) {
|
|
302
|
-
return {
|
|
303
|
-
kind: "validation",
|
|
304
|
-
type: "min_length",
|
|
305
|
-
reference: minLength,
|
|
306
|
-
async: false,
|
|
307
|
-
expects: `>=${requirement}`,
|
|
308
|
-
requirement,
|
|
309
|
-
message: message$1,
|
|
310
|
-
"~run"(dataset, config$1) {
|
|
311
|
-
if (dataset.typed && dataset.value.length < this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
|
|
312
|
-
return dataset;
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
__name(minLength, "minLength");
|
|
317
|
-
// @__NO_SIDE_EFFECTS__
|
|
318
|
-
function minValue(requirement, message$1) {
|
|
319
|
-
return {
|
|
320
|
-
kind: "validation",
|
|
321
|
-
type: "min_value",
|
|
322
|
-
reference: minValue,
|
|
323
|
-
async: false,
|
|
324
|
-
expects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
325
|
-
requirement,
|
|
326
|
-
message: message$1,
|
|
327
|
-
"~run"(dataset, config$1) {
|
|
328
|
-
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) });
|
|
329
|
-
return dataset;
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
__name(minValue, "minValue");
|
|
334
|
-
// @__NO_SIDE_EFFECTS__
|
|
335
|
-
function nonEmpty(message$1) {
|
|
336
|
-
return {
|
|
337
|
-
kind: "validation",
|
|
338
|
-
type: "non_empty",
|
|
339
|
-
reference: nonEmpty,
|
|
340
|
-
async: false,
|
|
341
|
-
expects: "!0",
|
|
342
|
-
message: message$1,
|
|
343
|
-
"~run"(dataset, config$1) {
|
|
344
|
-
if (dataset.typed && dataset.value.length === 0) _addIssue(this, "length", dataset, config$1, { received: "0" });
|
|
345
|
-
return dataset;
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
__name(nonEmpty, "nonEmpty");
|
|
350
|
-
// @__NO_SIDE_EFFECTS__
|
|
351
|
-
function regex(requirement, message$1) {
|
|
352
|
-
return {
|
|
353
|
-
kind: "validation",
|
|
354
|
-
type: "regex",
|
|
355
|
-
reference: regex,
|
|
356
|
-
async: false,
|
|
357
|
-
expects: `${requirement}`,
|
|
358
|
-
requirement,
|
|
359
|
-
message: message$1,
|
|
360
|
-
"~run"(dataset, config$1) {
|
|
361
|
-
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config$1);
|
|
362
|
-
return dataset;
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
__name(regex, "regex");
|
|
367
|
-
// @__NO_SIDE_EFFECTS__
|
|
368
|
-
function safeInteger(message$1) {
|
|
369
|
-
return {
|
|
370
|
-
kind: "validation",
|
|
371
|
-
type: "safe_integer",
|
|
372
|
-
reference: safeInteger,
|
|
373
|
-
async: false,
|
|
374
|
-
expects: null,
|
|
375
|
-
requirement: Number.isSafeInteger,
|
|
376
|
-
message: message$1,
|
|
377
|
-
"~run"(dataset, config$1) {
|
|
378
|
-
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "safe integer", dataset, config$1);
|
|
379
|
-
return dataset;
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
__name(safeInteger, "safeInteger");
|
|
384
|
-
// @__NO_SIDE_EFFECTS__
|
|
385
|
-
function startsWith(requirement, message$1) {
|
|
386
|
-
return {
|
|
387
|
-
kind: "validation",
|
|
388
|
-
type: "starts_with",
|
|
389
|
-
reference: startsWith,
|
|
390
|
-
async: false,
|
|
391
|
-
expects: `"${requirement}"`,
|
|
392
|
-
requirement,
|
|
393
|
-
message: message$1,
|
|
394
|
-
"~run"(dataset, config$1) {
|
|
395
|
-
if (dataset.typed && !dataset.value.startsWith(this.requirement)) _addIssue(this, "start", dataset, config$1, { received: `"${dataset.value.slice(0, this.requirement.length)}"` });
|
|
396
|
-
return dataset;
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
__name(startsWith, "startsWith");
|
|
401
|
-
// @__NO_SIDE_EFFECTS__
|
|
402
|
-
function transform(operation) {
|
|
403
|
-
return {
|
|
404
|
-
kind: "transformation",
|
|
405
|
-
type: "transform",
|
|
406
|
-
reference: transform,
|
|
407
|
-
async: false,
|
|
408
|
-
operation,
|
|
409
|
-
"~run"(dataset) {
|
|
410
|
-
dataset.value = this.operation(dataset.value);
|
|
411
|
-
return dataset;
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
__name(transform, "transform");
|
|
416
|
-
// @__NO_SIDE_EFFECTS__
|
|
417
|
-
function trim() {
|
|
418
|
-
return {
|
|
419
|
-
kind: "transformation",
|
|
420
|
-
type: "trim",
|
|
421
|
-
reference: trim,
|
|
422
|
-
async: false,
|
|
423
|
-
"~run"(dataset) {
|
|
424
|
-
dataset.value = dataset.value.trim();
|
|
425
|
-
return dataset;
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
__name(trim, "trim");
|
|
430
|
-
// @__NO_SIDE_EFFECTS__
|
|
431
|
-
function url(message$1) {
|
|
432
|
-
return {
|
|
433
|
-
kind: "validation",
|
|
434
|
-
type: "url",
|
|
435
|
-
reference: url,
|
|
436
|
-
async: false,
|
|
437
|
-
expects: null,
|
|
438
|
-
requirement(input) {
|
|
439
|
-
try {
|
|
440
|
-
if (URL.canParse) return URL.canParse(input);
|
|
441
|
-
new URL(input);
|
|
442
|
-
return true;
|
|
443
|
-
} catch {
|
|
444
|
-
return false;
|
|
445
|
-
}
|
|
446
|
-
},
|
|
447
|
-
message: message$1,
|
|
448
|
-
"~run"(dataset, config$1) {
|
|
449
|
-
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
|
|
450
|
-
return dataset;
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
__name(url, "url");
|
|
455
|
-
var ABORT_EARLY_CONFIG = { abortEarly: true };
|
|
456
|
-
// @__NO_SIDE_EFFECTS__
|
|
457
|
-
function getFallback(schema, dataset, config$1) {
|
|
458
|
-
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
459
|
-
}
|
|
460
|
-
__name(getFallback, "getFallback");
|
|
461
|
-
// @__NO_SIDE_EFFECTS__
|
|
462
|
-
function forward(action, path) {
|
|
463
|
-
return {
|
|
464
|
-
...action,
|
|
465
|
-
"~run"(dataset, config$1) {
|
|
466
|
-
const prevIssues = dataset.issues && [...dataset.issues];
|
|
467
|
-
dataset = action["~run"](dataset, config$1);
|
|
468
|
-
if (dataset.issues) {
|
|
469
|
-
for (const issue of dataset.issues) if (!prevIssues?.includes(issue)) {
|
|
470
|
-
let pathInput = dataset.value;
|
|
471
|
-
for (const key of path) {
|
|
472
|
-
const pathValue = pathInput[key];
|
|
473
|
-
const pathItem = {
|
|
474
|
-
type: "unknown",
|
|
475
|
-
origin: "value",
|
|
476
|
-
input: pathInput,
|
|
477
|
-
key,
|
|
478
|
-
value: pathValue
|
|
479
|
-
};
|
|
480
|
-
if (issue.path) issue.path.push(pathItem);
|
|
481
|
-
else issue.path = [pathItem];
|
|
482
|
-
if (!pathValue) break;
|
|
483
|
-
pathInput = pathValue;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return dataset;
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
__name(forward, "forward");
|
|
492
|
-
// @__NO_SIDE_EFFECTS__
|
|
493
|
-
function getDefault(schema, dataset, config$1) {
|
|
494
|
-
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
495
|
-
}
|
|
496
|
-
__name(getDefault, "getDefault");
|
|
497
|
-
// @__NO_SIDE_EFFECTS__
|
|
498
|
-
function array(item, message$1) {
|
|
499
|
-
return _standardSchema({
|
|
500
|
-
kind: "schema",
|
|
501
|
-
type: "array",
|
|
502
|
-
reference: array,
|
|
503
|
-
expects: "Array",
|
|
504
|
-
async: false,
|
|
505
|
-
item,
|
|
506
|
-
message: message$1,
|
|
507
|
-
"~run"(dataset, config$1) {
|
|
508
|
-
const input = dataset.value;
|
|
509
|
-
if (Array.isArray(input)) {
|
|
510
|
-
dataset.typed = true;
|
|
511
|
-
dataset.value = [];
|
|
512
|
-
for (let key = 0; key < input.length; key++) {
|
|
513
|
-
const value$1 = input[key];
|
|
514
|
-
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
515
|
-
if (itemDataset.issues) {
|
|
516
|
-
const pathItem = {
|
|
517
|
-
type: "array",
|
|
518
|
-
origin: "value",
|
|
519
|
-
input,
|
|
520
|
-
key,
|
|
521
|
-
value: value$1
|
|
522
|
-
};
|
|
523
|
-
for (const issue of itemDataset.issues) {
|
|
524
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
525
|
-
else issue.path = [pathItem];
|
|
526
|
-
dataset.issues?.push(issue);
|
|
527
|
-
}
|
|
528
|
-
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
529
|
-
if (config$1.abortEarly) {
|
|
530
|
-
dataset.typed = false;
|
|
531
|
-
break;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
if (!itemDataset.typed) dataset.typed = false;
|
|
535
|
-
dataset.value.push(itemDataset.value);
|
|
536
|
-
}
|
|
537
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
538
|
-
return dataset;
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
__name(array, "array");
|
|
543
|
-
// @__NO_SIDE_EFFECTS__
|
|
544
|
-
function boolean(message$1) {
|
|
545
|
-
return _standardSchema({
|
|
546
|
-
kind: "schema",
|
|
547
|
-
type: "boolean",
|
|
548
|
-
reference: boolean,
|
|
549
|
-
expects: "boolean",
|
|
550
|
-
async: false,
|
|
551
|
-
message: message$1,
|
|
552
|
-
"~run"(dataset, config$1) {
|
|
553
|
-
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
554
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
555
|
-
return dataset;
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
__name(boolean, "boolean");
|
|
560
|
-
// @__NO_SIDE_EFFECTS__
|
|
561
|
-
function custom(check$1, message$1) {
|
|
562
|
-
return _standardSchema({
|
|
563
|
-
kind: "schema",
|
|
564
|
-
type: "custom",
|
|
565
|
-
reference: custom,
|
|
566
|
-
expects: "unknown",
|
|
567
|
-
async: false,
|
|
568
|
-
check: check$1,
|
|
569
|
-
message: message$1,
|
|
570
|
-
"~run"(dataset, config$1) {
|
|
571
|
-
if (this.check(dataset.value)) dataset.typed = true;
|
|
572
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
573
|
-
return dataset;
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
__name(custom, "custom");
|
|
578
|
-
// @__NO_SIDE_EFFECTS__
|
|
579
|
-
function exactOptional(wrapped, default_) {
|
|
580
|
-
return _standardSchema({
|
|
581
|
-
kind: "schema",
|
|
582
|
-
type: "exact_optional",
|
|
583
|
-
reference: exactOptional,
|
|
584
|
-
expects: wrapped.expects,
|
|
585
|
-
async: false,
|
|
586
|
-
wrapped,
|
|
587
|
-
default: default_,
|
|
588
|
-
"~run"(dataset, config$1) {
|
|
589
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
__name(exactOptional, "exactOptional");
|
|
594
|
-
// @__NO_SIDE_EFFECTS__
|
|
595
|
-
function function_(message$1) {
|
|
596
|
-
return _standardSchema({
|
|
597
|
-
kind: "schema",
|
|
598
|
-
type: "function",
|
|
599
|
-
reference: function_,
|
|
600
|
-
expects: "Function",
|
|
601
|
-
async: false,
|
|
602
|
-
message: message$1,
|
|
603
|
-
"~run"(dataset, config$1) {
|
|
604
|
-
if (typeof dataset.value === "function") dataset.typed = true;
|
|
605
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
606
|
-
return dataset;
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
__name(function_, "function_");
|
|
611
|
-
// @__NO_SIDE_EFFECTS__
|
|
612
|
-
function lazy(getter) {
|
|
613
|
-
return _standardSchema({
|
|
614
|
-
kind: "schema",
|
|
615
|
-
type: "lazy",
|
|
616
|
-
reference: lazy,
|
|
617
|
-
expects: "unknown",
|
|
618
|
-
async: false,
|
|
619
|
-
getter,
|
|
620
|
-
"~run"(dataset, config$1) {
|
|
621
|
-
return this.getter(dataset.value)["~run"](dataset, config$1);
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
__name(lazy, "lazy");
|
|
626
|
-
// @__NO_SIDE_EFFECTS__
|
|
627
|
-
function literal(literal_, message$1) {
|
|
628
|
-
return _standardSchema({
|
|
629
|
-
kind: "schema",
|
|
630
|
-
type: "literal",
|
|
631
|
-
reference: literal,
|
|
632
|
-
expects: /* @__PURE__ */ _stringify(literal_),
|
|
633
|
-
async: false,
|
|
634
|
-
literal: literal_,
|
|
635
|
-
message: message$1,
|
|
636
|
-
"~run"(dataset, config$1) {
|
|
637
|
-
if (/* @__PURE__ */ _isSameValueZero(dataset.value, this.literal)) dataset.typed = true;
|
|
638
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
639
|
-
return dataset;
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
__name(literal, "literal");
|
|
644
|
-
// @__NO_SIDE_EFFECTS__
|
|
645
|
-
function looseObject(entries$1, message$1) {
|
|
646
|
-
return _standardSchema({
|
|
647
|
-
kind: "schema",
|
|
648
|
-
type: "loose_object",
|
|
649
|
-
reference: looseObject,
|
|
650
|
-
expects: "Object",
|
|
651
|
-
async: false,
|
|
652
|
-
entries: entries$1,
|
|
653
|
-
message: message$1,
|
|
654
|
-
"~run"(dataset, config$1) {
|
|
655
|
-
const input = dataset.value;
|
|
656
|
-
if (input && typeof input === "object") {
|
|
657
|
-
dataset.typed = true;
|
|
658
|
-
dataset.value = {};
|
|
659
|
-
for (const key in this.entries) {
|
|
660
|
-
const valueSchema = this.entries[key];
|
|
661
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
662
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
663
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
664
|
-
if (valueDataset.issues) {
|
|
665
|
-
const pathItem = {
|
|
666
|
-
type: "object",
|
|
667
|
-
origin: "value",
|
|
668
|
-
input,
|
|
669
|
-
key,
|
|
670
|
-
value: value$1
|
|
671
|
-
};
|
|
672
|
-
for (const issue of valueDataset.issues) {
|
|
673
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
674
|
-
else issue.path = [pathItem];
|
|
675
|
-
dataset.issues?.push(issue);
|
|
676
|
-
}
|
|
677
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
678
|
-
if (config$1.abortEarly) {
|
|
679
|
-
dataset.typed = false;
|
|
680
|
-
break;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
684
|
-
dataset.value[key] = valueDataset.value;
|
|
685
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
686
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
687
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
688
|
-
input: void 0,
|
|
689
|
-
expected: `"${key}"`,
|
|
690
|
-
path: [{
|
|
691
|
-
type: "object",
|
|
692
|
-
origin: "key",
|
|
693
|
-
input,
|
|
694
|
-
key,
|
|
695
|
-
value: input[key]
|
|
696
|
-
}]
|
|
697
|
-
});
|
|
698
|
-
if (config$1.abortEarly) break;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
if (!dataset.issues || !config$1.abortEarly) {
|
|
702
|
-
for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !Object.prototype.hasOwnProperty.call(this.entries, key)) dataset.value[key] = input[key];
|
|
703
|
-
}
|
|
704
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
705
|
-
return dataset;
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
__name(looseObject, "looseObject");
|
|
710
|
-
// @__NO_SIDE_EFFECTS__
|
|
711
|
-
function null_(message$1) {
|
|
712
|
-
return _standardSchema({
|
|
713
|
-
kind: "schema",
|
|
714
|
-
type: "null",
|
|
715
|
-
reference: null_,
|
|
716
|
-
expects: "null",
|
|
717
|
-
async: false,
|
|
718
|
-
message: message$1,
|
|
719
|
-
"~run"(dataset, config$1) {
|
|
720
|
-
if (dataset.value === null) dataset.typed = true;
|
|
721
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
722
|
-
return dataset;
|
|
723
|
-
}
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
__name(null_, "null_");
|
|
727
|
-
// @__NO_SIDE_EFFECTS__
|
|
728
|
-
function nullable(wrapped, default_) {
|
|
729
|
-
return _standardSchema({
|
|
730
|
-
kind: "schema",
|
|
731
|
-
type: "nullable",
|
|
732
|
-
reference: nullable,
|
|
733
|
-
expects: `(${wrapped.expects} | null)`,
|
|
734
|
-
async: false,
|
|
735
|
-
wrapped,
|
|
736
|
-
default: default_,
|
|
737
|
-
"~run"(dataset, config$1) {
|
|
738
|
-
if (dataset.value === null) {
|
|
739
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
740
|
-
if (dataset.value === null) {
|
|
741
|
-
dataset.typed = true;
|
|
742
|
-
return dataset;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
__name(nullable, "nullable");
|
|
750
|
-
// @__NO_SIDE_EFFECTS__
|
|
751
|
-
function nullish(wrapped, default_) {
|
|
752
|
-
return _standardSchema({
|
|
753
|
-
kind: "schema",
|
|
754
|
-
type: "nullish",
|
|
755
|
-
reference: nullish,
|
|
756
|
-
expects: `(${wrapped.expects} | null | undefined)`,
|
|
757
|
-
async: false,
|
|
758
|
-
wrapped,
|
|
759
|
-
default: default_,
|
|
760
|
-
"~run"(dataset, config$1) {
|
|
761
|
-
if (dataset.value === null || dataset.value === void 0) {
|
|
762
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
763
|
-
if (dataset.value === null || dataset.value === void 0) {
|
|
764
|
-
dataset.typed = true;
|
|
765
|
-
return dataset;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
__name(nullish, "nullish");
|
|
773
|
-
// @__NO_SIDE_EFFECTS__
|
|
774
|
-
function number(message$1) {
|
|
775
|
-
return _standardSchema({
|
|
776
|
-
kind: "schema",
|
|
777
|
-
type: "number",
|
|
778
|
-
reference: number,
|
|
779
|
-
expects: "number",
|
|
780
|
-
async: false,
|
|
781
|
-
message: message$1,
|
|
782
|
-
"~run"(dataset, config$1) {
|
|
783
|
-
if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
|
|
784
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
785
|
-
return dataset;
|
|
786
|
-
}
|
|
787
|
-
});
|
|
788
|
-
}
|
|
789
|
-
__name(number, "number");
|
|
790
|
-
// @__NO_SIDE_EFFECTS__
|
|
791
|
-
function object(entries$1, message$1) {
|
|
792
|
-
return _standardSchema({
|
|
793
|
-
kind: "schema",
|
|
794
|
-
type: "object",
|
|
795
|
-
reference: object,
|
|
796
|
-
expects: "Object",
|
|
797
|
-
async: false,
|
|
798
|
-
entries: entries$1,
|
|
799
|
-
message: message$1,
|
|
800
|
-
"~run"(dataset, config$1) {
|
|
801
|
-
const input = dataset.value;
|
|
802
|
-
if (input && typeof input === "object") {
|
|
803
|
-
dataset.typed = true;
|
|
804
|
-
dataset.value = {};
|
|
805
|
-
for (const key in this.entries) {
|
|
806
|
-
const valueSchema = this.entries[key];
|
|
807
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
808
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
809
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
810
|
-
if (valueDataset.issues) {
|
|
811
|
-
const pathItem = {
|
|
812
|
-
type: "object",
|
|
813
|
-
origin: "value",
|
|
814
|
-
input,
|
|
815
|
-
key,
|
|
816
|
-
value: value$1
|
|
817
|
-
};
|
|
818
|
-
for (const issue of valueDataset.issues) {
|
|
819
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
820
|
-
else issue.path = [pathItem];
|
|
821
|
-
dataset.issues?.push(issue);
|
|
822
|
-
}
|
|
823
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
824
|
-
if (config$1.abortEarly) {
|
|
825
|
-
dataset.typed = false;
|
|
826
|
-
break;
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
830
|
-
dataset.value[key] = valueDataset.value;
|
|
831
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
832
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
833
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
834
|
-
input: void 0,
|
|
835
|
-
expected: `"${key}"`,
|
|
836
|
-
path: [{
|
|
837
|
-
type: "object",
|
|
838
|
-
origin: "key",
|
|
839
|
-
input,
|
|
840
|
-
key,
|
|
841
|
-
value: input[key]
|
|
842
|
-
}]
|
|
843
|
-
});
|
|
844
|
-
if (config$1.abortEarly) break;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
848
|
-
return dataset;
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
__name(object, "object");
|
|
853
|
-
// @__NO_SIDE_EFFECTS__
|
|
854
|
-
function objectWithRest(entries$1, rest, message$1) {
|
|
855
|
-
return _standardSchema({
|
|
856
|
-
kind: "schema",
|
|
857
|
-
type: "object_with_rest",
|
|
858
|
-
reference: objectWithRest,
|
|
859
|
-
expects: "Object",
|
|
860
|
-
async: false,
|
|
861
|
-
entries: entries$1,
|
|
862
|
-
rest,
|
|
863
|
-
message: message$1,
|
|
864
|
-
"~run"(dataset, config$1) {
|
|
865
|
-
const input = dataset.value;
|
|
866
|
-
if (input && typeof input === "object") {
|
|
867
|
-
dataset.typed = true;
|
|
868
|
-
dataset.value = {};
|
|
869
|
-
for (const key in this.entries) {
|
|
870
|
-
const valueSchema = this.entries[key];
|
|
871
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
872
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
873
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
874
|
-
if (valueDataset.issues) {
|
|
875
|
-
const pathItem = {
|
|
876
|
-
type: "object",
|
|
877
|
-
origin: "value",
|
|
878
|
-
input,
|
|
879
|
-
key,
|
|
880
|
-
value: value$1
|
|
881
|
-
};
|
|
882
|
-
for (const issue of valueDataset.issues) {
|
|
883
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
884
|
-
else issue.path = [pathItem];
|
|
885
|
-
dataset.issues?.push(issue);
|
|
886
|
-
}
|
|
887
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
888
|
-
if (config$1.abortEarly) {
|
|
889
|
-
dataset.typed = false;
|
|
890
|
-
break;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
894
|
-
dataset.value[key] = valueDataset.value;
|
|
895
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
896
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
897
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
898
|
-
input: void 0,
|
|
899
|
-
expected: `"${key}"`,
|
|
900
|
-
path: [{
|
|
901
|
-
type: "object",
|
|
902
|
-
origin: "key",
|
|
903
|
-
input,
|
|
904
|
-
key,
|
|
905
|
-
value: input[key]
|
|
906
|
-
}]
|
|
907
|
-
});
|
|
908
|
-
if (config$1.abortEarly) break;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
if (!dataset.issues || !config$1.abortEarly) {
|
|
912
|
-
for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !Object.prototype.hasOwnProperty.call(this.entries, key)) {
|
|
913
|
-
const valueDataset = this.rest["~run"]({ value: input[key] }, config$1);
|
|
914
|
-
if (valueDataset.issues) {
|
|
915
|
-
const pathItem = {
|
|
916
|
-
type: "object",
|
|
917
|
-
origin: "value",
|
|
918
|
-
input,
|
|
919
|
-
key,
|
|
920
|
-
value: input[key]
|
|
921
|
-
};
|
|
922
|
-
for (const issue of valueDataset.issues) {
|
|
923
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
924
|
-
else issue.path = [pathItem];
|
|
925
|
-
dataset.issues?.push(issue);
|
|
926
|
-
}
|
|
927
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
928
|
-
if (config$1.abortEarly) {
|
|
929
|
-
dataset.typed = false;
|
|
930
|
-
break;
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
934
|
-
dataset.value[key] = valueDataset.value;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
938
|
-
return dataset;
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
__name(objectWithRest, "objectWithRest");
|
|
943
|
-
// @__NO_SIDE_EFFECTS__
|
|
944
|
-
function optional(wrapped, default_) {
|
|
945
|
-
return _standardSchema({
|
|
946
|
-
kind: "schema",
|
|
947
|
-
type: "optional",
|
|
948
|
-
reference: optional,
|
|
949
|
-
expects: `(${wrapped.expects} | undefined)`,
|
|
950
|
-
async: false,
|
|
951
|
-
wrapped,
|
|
952
|
-
default: default_,
|
|
953
|
-
"~run"(dataset, config$1) {
|
|
954
|
-
if (dataset.value === void 0) {
|
|
955
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
956
|
-
if (dataset.value === void 0) {
|
|
957
|
-
dataset.typed = true;
|
|
958
|
-
return dataset;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
962
|
-
}
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
__name(optional, "optional");
|
|
966
|
-
// @__NO_SIDE_EFFECTS__
|
|
967
|
-
function picklist(options, message$1) {
|
|
968
|
-
return _standardSchema({
|
|
969
|
-
kind: "schema",
|
|
970
|
-
type: "picklist",
|
|
971
|
-
reference: picklist,
|
|
972
|
-
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
973
|
-
async: false,
|
|
974
|
-
options,
|
|
975
|
-
message: message$1,
|
|
976
|
-
"~run"(dataset, config$1) {
|
|
977
|
-
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
978
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
979
|
-
return dataset;
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
__name(picklist, "picklist");
|
|
984
|
-
// @__NO_SIDE_EFFECTS__
|
|
985
|
-
function record(key, value$1, message$1) {
|
|
986
|
-
return _standardSchema({
|
|
987
|
-
kind: "schema",
|
|
988
|
-
type: "record",
|
|
989
|
-
reference: record,
|
|
990
|
-
expects: "Object",
|
|
991
|
-
async: false,
|
|
992
|
-
key,
|
|
993
|
-
value: value$1,
|
|
994
|
-
message: message$1,
|
|
995
|
-
"~run"(dataset, config$1) {
|
|
996
|
-
const input = dataset.value;
|
|
997
|
-
if (input && typeof input === "object") {
|
|
998
|
-
dataset.typed = true;
|
|
999
|
-
dataset.value = {};
|
|
1000
|
-
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
1001
|
-
const entryValue = input[entryKey];
|
|
1002
|
-
const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
|
|
1003
|
-
if (keyDataset.issues) {
|
|
1004
|
-
const pathItem = {
|
|
1005
|
-
type: "object",
|
|
1006
|
-
origin: "key",
|
|
1007
|
-
input,
|
|
1008
|
-
key: entryKey,
|
|
1009
|
-
value: entryValue
|
|
1010
|
-
};
|
|
1011
|
-
for (const issue of keyDataset.issues) {
|
|
1012
|
-
issue.path = [pathItem];
|
|
1013
|
-
dataset.issues?.push(issue);
|
|
1014
|
-
}
|
|
1015
|
-
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
1016
|
-
if (config$1.abortEarly) {
|
|
1017
|
-
dataset.typed = false;
|
|
1018
|
-
break;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
|
|
1022
|
-
if (valueDataset.issues) {
|
|
1023
|
-
const pathItem = {
|
|
1024
|
-
type: "object",
|
|
1025
|
-
origin: "value",
|
|
1026
|
-
input,
|
|
1027
|
-
key: entryKey,
|
|
1028
|
-
value: entryValue
|
|
1029
|
-
};
|
|
1030
|
-
for (const issue of valueDataset.issues) {
|
|
1031
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1032
|
-
else issue.path = [pathItem];
|
|
1033
|
-
dataset.issues?.push(issue);
|
|
1034
|
-
}
|
|
1035
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1036
|
-
if (config$1.abortEarly) {
|
|
1037
|
-
dataset.typed = false;
|
|
1038
|
-
break;
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
1042
|
-
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
1043
|
-
}
|
|
1044
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1045
|
-
return dataset;
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
__name(record, "record");
|
|
1050
|
-
// @__NO_SIDE_EFFECTS__
|
|
1051
|
-
function strictObject(entries$1, message$1) {
|
|
1052
|
-
return _standardSchema({
|
|
1053
|
-
kind: "schema",
|
|
1054
|
-
type: "strict_object",
|
|
1055
|
-
reference: strictObject,
|
|
1056
|
-
expects: "Object",
|
|
1057
|
-
async: false,
|
|
1058
|
-
entries: entries$1,
|
|
1059
|
-
message: message$1,
|
|
1060
|
-
"~run"(dataset, config$1) {
|
|
1061
|
-
const input = dataset.value;
|
|
1062
|
-
if (input && typeof input === "object") {
|
|
1063
|
-
dataset.typed = true;
|
|
1064
|
-
dataset.value = {};
|
|
1065
|
-
for (const key in this.entries) {
|
|
1066
|
-
const valueSchema = this.entries[key];
|
|
1067
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
1068
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
1069
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
1070
|
-
if (valueDataset.issues) {
|
|
1071
|
-
const pathItem = {
|
|
1072
|
-
type: "object",
|
|
1073
|
-
origin: "value",
|
|
1074
|
-
input,
|
|
1075
|
-
key,
|
|
1076
|
-
value: value$1
|
|
1077
|
-
};
|
|
1078
|
-
for (const issue of valueDataset.issues) {
|
|
1079
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1080
|
-
else issue.path = [pathItem];
|
|
1081
|
-
dataset.issues?.push(issue);
|
|
1082
|
-
}
|
|
1083
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1084
|
-
if (config$1.abortEarly) {
|
|
1085
|
-
dataset.typed = false;
|
|
1086
|
-
break;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
1090
|
-
dataset.value[key] = valueDataset.value;
|
|
1091
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
1092
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
1093
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
1094
|
-
input: void 0,
|
|
1095
|
-
expected: `"${key}"`,
|
|
1096
|
-
path: [{
|
|
1097
|
-
type: "object",
|
|
1098
|
-
origin: "key",
|
|
1099
|
-
input,
|
|
1100
|
-
key,
|
|
1101
|
-
value: input[key]
|
|
1102
|
-
}]
|
|
1103
|
-
});
|
|
1104
|
-
if (config$1.abortEarly) break;
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
if (!dataset.issues || !config$1.abortEarly) {
|
|
1108
|
-
for (const key in input) if (!Object.prototype.hasOwnProperty.call(this.entries, key)) {
|
|
1109
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
1110
|
-
input: key,
|
|
1111
|
-
expected: "never",
|
|
1112
|
-
path: [{
|
|
1113
|
-
type: "object",
|
|
1114
|
-
origin: "key",
|
|
1115
|
-
input,
|
|
1116
|
-
key,
|
|
1117
|
-
value: input[key]
|
|
1118
|
-
}]
|
|
1119
|
-
});
|
|
1120
|
-
break;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1124
|
-
return dataset;
|
|
1125
|
-
}
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
__name(strictObject, "strictObject");
|
|
1129
|
-
// @__NO_SIDE_EFFECTS__
|
|
1130
|
-
function string(message$1) {
|
|
1131
|
-
return _standardSchema({
|
|
1132
|
-
kind: "schema",
|
|
1133
|
-
type: "string",
|
|
1134
|
-
reference: string,
|
|
1135
|
-
expects: "string",
|
|
1136
|
-
async: false,
|
|
1137
|
-
message: message$1,
|
|
1138
|
-
"~run"(dataset, config$1) {
|
|
1139
|
-
if (typeof dataset.value === "string") dataset.typed = true;
|
|
1140
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1141
|
-
return dataset;
|
|
1142
|
-
}
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
__name(string, "string");
|
|
1146
|
-
// @__NO_SIDE_EFFECTS__
|
|
1147
|
-
function _subIssues(datasets) {
|
|
1148
|
-
let issues;
|
|
1149
|
-
if (datasets) for (const dataset of datasets) if (issues) for (const issue of dataset.issues) issues.push(issue);
|
|
1150
|
-
else issues = dataset.issues;
|
|
1151
|
-
return issues;
|
|
1152
|
-
}
|
|
1153
|
-
__name(_subIssues, "_subIssues");
|
|
1154
|
-
// @__NO_SIDE_EFFECTS__
|
|
1155
|
-
function union(options, message$1) {
|
|
1156
|
-
return _standardSchema({
|
|
1157
|
-
kind: "schema",
|
|
1158
|
-
type: "union",
|
|
1159
|
-
reference: union,
|
|
1160
|
-
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1161
|
-
async: false,
|
|
1162
|
-
options,
|
|
1163
|
-
message: message$1,
|
|
1164
|
-
"~run"(dataset, config$1) {
|
|
1165
|
-
let validDataset;
|
|
1166
|
-
let typedDatasets;
|
|
1167
|
-
let untypedDatasets;
|
|
1168
|
-
for (const schema of this.options) {
|
|
1169
|
-
const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
|
|
1170
|
-
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
1171
|
-
else typedDatasets = [optionDataset];
|
|
1172
|
-
else {
|
|
1173
|
-
validDataset = optionDataset;
|
|
1174
|
-
break;
|
|
1175
|
-
}
|
|
1176
|
-
else if (untypedDatasets) untypedDatasets.push(optionDataset);
|
|
1177
|
-
else untypedDatasets = [optionDataset];
|
|
1178
|
-
}
|
|
1179
|
-
if (validDataset) return validDataset;
|
|
1180
|
-
if (typedDatasets) {
|
|
1181
|
-
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
1182
|
-
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
1183
|
-
dataset.typed = true;
|
|
1184
|
-
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
1185
|
-
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
1186
|
-
return dataset;
|
|
1187
|
-
}
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
__name(union, "union");
|
|
1191
|
-
// @__NO_SIDE_EFFECTS__
|
|
1192
|
-
function unknown() {
|
|
1193
|
-
return _standardSchema({
|
|
1194
|
-
kind: "schema",
|
|
1195
|
-
type: "unknown",
|
|
1196
|
-
reference: unknown,
|
|
1197
|
-
expects: "unknown",
|
|
1198
|
-
async: false,
|
|
1199
|
-
"~run"(dataset) {
|
|
1200
|
-
dataset.typed = true;
|
|
1201
|
-
return dataset;
|
|
1202
|
-
}
|
|
1203
|
-
});
|
|
1204
|
-
}
|
|
1205
|
-
__name(unknown, "unknown");
|
|
1206
|
-
// @__NO_SIDE_EFFECTS__
|
|
1207
|
-
function variant(key, options, message$1) {
|
|
1208
|
-
return _standardSchema({
|
|
1209
|
-
kind: "schema",
|
|
1210
|
-
type: "variant",
|
|
1211
|
-
reference: variant,
|
|
1212
|
-
expects: "Object",
|
|
1213
|
-
async: false,
|
|
1214
|
-
key,
|
|
1215
|
-
options,
|
|
1216
|
-
message: message$1,
|
|
1217
|
-
"~run"(dataset, config$1) {
|
|
1218
|
-
const input = dataset.value;
|
|
1219
|
-
if (input && typeof input === "object") {
|
|
1220
|
-
let outputDataset;
|
|
1221
|
-
let maxDiscriminatorPriority = 0;
|
|
1222
|
-
let invalidDiscriminatorKey = this.key;
|
|
1223
|
-
let expectedDiscriminators = [];
|
|
1224
|
-
const parseOptions = /* @__PURE__ */ __name((variant$1, allKeys) => {
|
|
1225
|
-
for (const schema of variant$1.options) {
|
|
1226
|
-
if (schema.type === "variant") parseOptions(schema, new Set(allKeys).add(schema.key));
|
|
1227
|
-
else {
|
|
1228
|
-
let keysAreValid = true;
|
|
1229
|
-
let currentPriority = 0;
|
|
1230
|
-
for (const currentKey of allKeys) {
|
|
1231
|
-
const discriminatorSchema = schema.entries[currentKey];
|
|
1232
|
-
if (currentKey in input ? discriminatorSchema["~run"]({
|
|
1233
|
-
typed: false,
|
|
1234
|
-
value: input[currentKey]
|
|
1235
|
-
}, ABORT_EARLY_CONFIG).issues : discriminatorSchema.type !== "exact_optional" && discriminatorSchema.type !== "optional" && discriminatorSchema.type !== "nullish") {
|
|
1236
|
-
keysAreValid = false;
|
|
1237
|
-
if (invalidDiscriminatorKey !== currentKey && (maxDiscriminatorPriority < currentPriority || maxDiscriminatorPriority === currentPriority && currentKey in input && !(invalidDiscriminatorKey in input))) {
|
|
1238
|
-
maxDiscriminatorPriority = currentPriority;
|
|
1239
|
-
invalidDiscriminatorKey = currentKey;
|
|
1240
|
-
expectedDiscriminators = [];
|
|
1241
|
-
}
|
|
1242
|
-
if (invalidDiscriminatorKey === currentKey) expectedDiscriminators.push(schema.entries[currentKey].expects);
|
|
1243
|
-
break;
|
|
1244
|
-
}
|
|
1245
|
-
currentPriority++;
|
|
1246
|
-
}
|
|
1247
|
-
if (keysAreValid) {
|
|
1248
|
-
const optionDataset = schema["~run"]({ value: input }, config$1);
|
|
1249
|
-
if (!outputDataset || !outputDataset.typed && optionDataset.typed) outputDataset = optionDataset;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
if (outputDataset && !outputDataset.issues) break;
|
|
1253
|
-
}
|
|
1254
|
-
}, "parseOptions");
|
|
1255
|
-
parseOptions(this, /* @__PURE__ */ new Set([this.key]));
|
|
1256
|
-
if (outputDataset) return outputDataset;
|
|
1257
|
-
_addIssue(this, "type", dataset, config$1, {
|
|
1258
|
-
input: input[invalidDiscriminatorKey],
|
|
1259
|
-
expected: /* @__PURE__ */ _joinExpects(expectedDiscriminators, "|"),
|
|
1260
|
-
path: [{
|
|
1261
|
-
type: "object",
|
|
1262
|
-
origin: "value",
|
|
1263
|
-
input,
|
|
1264
|
-
key: invalidDiscriminatorKey,
|
|
1265
|
-
value: input[invalidDiscriminatorKey]
|
|
1266
|
-
}]
|
|
1267
|
-
});
|
|
1268
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1269
|
-
return dataset;
|
|
1270
|
-
}
|
|
1271
|
-
});
|
|
1272
|
-
}
|
|
1273
|
-
__name(variant, "variant");
|
|
1274
|
-
// @__NO_SIDE_EFFECTS__
|
|
1275
|
-
function omit(schema, keys) {
|
|
1276
|
-
const entries$1 = { ...schema.entries };
|
|
1277
|
-
for (const key of keys) delete entries$1[key];
|
|
1278
|
-
return _standardSchema({
|
|
1279
|
-
...schema,
|
|
1280
|
-
entries: entries$1
|
|
1281
|
-
});
|
|
1282
|
-
}
|
|
1283
|
-
__name(omit, "omit");
|
|
1284
|
-
function parse(schema, input, config$1) {
|
|
1285
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
1286
|
-
if (dataset.issues) throw new ValiError(dataset.issues);
|
|
1287
|
-
return dataset.value;
|
|
1288
|
-
}
|
|
1289
|
-
__name(parse, "parse");
|
|
1290
|
-
// @__NO_SIDE_EFFECTS__
|
|
1291
|
-
function partial(schema, keys) {
|
|
1292
|
-
const entries$1 = {};
|
|
1293
|
-
for (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
|
|
1294
|
-
return _standardSchema({
|
|
1295
|
-
...schema,
|
|
1296
|
-
entries: entries$1
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
__name(partial, "partial");
|
|
1300
|
-
// @__NO_SIDE_EFFECTS__
|
|
1301
|
-
function pick(schema, keys) {
|
|
1302
|
-
const entries$1 = {};
|
|
1303
|
-
for (const key of keys) entries$1[key] = schema.entries[key];
|
|
1304
|
-
return _standardSchema({
|
|
1305
|
-
...schema,
|
|
1306
|
-
entries: entries$1
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
__name(pick, "pick");
|
|
1310
|
-
// @__NO_SIDE_EFFECTS__
|
|
1311
|
-
function pipe(...pipe$1) {
|
|
1312
|
-
return _standardSchema({
|
|
1313
|
-
...pipe$1[0],
|
|
1314
|
-
pipe: pipe$1,
|
|
1315
|
-
"~run"(dataset, config$1) {
|
|
1316
|
-
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
1317
|
-
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1318
|
-
dataset.typed = false;
|
|
1319
|
-
break;
|
|
1320
|
-
}
|
|
1321
|
-
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
1322
|
-
}
|
|
1323
|
-
return dataset;
|
|
1324
|
-
}
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1327
|
-
__name(pipe, "pipe");
|
|
1328
|
-
// @__NO_SIDE_EFFECTS__
|
|
1329
|
-
function safeParse(schema, input, config$1) {
|
|
1330
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
1331
|
-
return {
|
|
1332
|
-
typed: dataset.typed,
|
|
1333
|
-
success: !dataset.issues,
|
|
1334
|
-
output: dataset.value,
|
|
1335
|
-
issues: dataset.issues
|
|
1336
|
-
};
|
|
1337
|
-
}
|
|
1338
|
-
__name(safeParse, "safeParse");
|
|
1339
|
-
// @__NO_SIDE_EFFECTS__
|
|
1340
|
-
function summarize(issues) {
|
|
1341
|
-
let summary = "";
|
|
1342
|
-
for (const issue of issues) {
|
|
1343
|
-
if (summary) summary += "\n";
|
|
1344
|
-
summary += `\xD7 ${issue.message}`;
|
|
1345
|
-
const dotPath = /* @__PURE__ */ getDotPath(issue);
|
|
1346
|
-
if (dotPath) summary += `
|
|
1347
|
-
\u2192 at ${dotPath}`;
|
|
1348
|
-
}
|
|
1349
|
-
return summary;
|
|
1350
|
-
}
|
|
1351
|
-
__name(summarize, "summarize");
|
|
1352
|
-
// @__NO_SIDE_EFFECTS__
|
|
1353
|
-
function unwrap(schema) {
|
|
1354
|
-
return schema.wrapped;
|
|
1355
|
-
}
|
|
1356
|
-
__name(unwrap, "unwrap");
|
|
1357
|
-
|
|
1358
|
-
export {
|
|
1359
|
-
getDotPath,
|
|
1360
|
-
check,
|
|
1361
|
-
description,
|
|
1362
|
-
endsWith,
|
|
1363
|
-
finite,
|
|
1364
|
-
integer,
|
|
1365
|
-
isoDate,
|
|
1366
|
-
isoTimestamp,
|
|
1367
|
-
maxEntries,
|
|
1368
|
-
maxLength,
|
|
1369
|
-
maxValue,
|
|
1370
|
-
minLength,
|
|
1371
|
-
minValue,
|
|
1372
|
-
nonEmpty,
|
|
1373
|
-
regex,
|
|
1374
|
-
safeInteger,
|
|
1375
|
-
startsWith,
|
|
1376
|
-
transform,
|
|
1377
|
-
trim,
|
|
1378
|
-
url,
|
|
1379
|
-
forward,
|
|
1380
|
-
array,
|
|
1381
|
-
boolean,
|
|
1382
|
-
custom,
|
|
1383
|
-
exactOptional,
|
|
1384
|
-
function_,
|
|
1385
|
-
lazy,
|
|
1386
|
-
literal,
|
|
1387
|
-
looseObject,
|
|
1388
|
-
null_,
|
|
1389
|
-
nullable,
|
|
1390
|
-
nullish,
|
|
1391
|
-
number,
|
|
1392
|
-
object,
|
|
1393
|
-
objectWithRest,
|
|
1394
|
-
optional,
|
|
1395
|
-
picklist,
|
|
1396
|
-
record,
|
|
1397
|
-
strictObject,
|
|
1398
|
-
string,
|
|
1399
|
-
union,
|
|
1400
|
-
unknown,
|
|
1401
|
-
variant,
|
|
1402
|
-
omit,
|
|
1403
|
-
parse,
|
|
1404
|
-
partial,
|
|
1405
|
-
pick,
|
|
1406
|
-
pipe,
|
|
1407
|
-
safeParse,
|
|
1408
|
-
summarize,
|
|
1409
|
-
unwrap
|
|
1410
|
-
};
|