@wirecat/wirecat 0.0.0-stage → 1.0.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/LICENSE +204 -0
- package/README.md +400 -2
- package/THIRD_PARTY_NOTICES +2 -0
- package/contracts/wirecat.json +4612 -0
- package/dist/actions/actions.js +269 -0
- package/dist/actions/command.js +102 -0
- package/dist/agents/command.js +17 -0
- package/dist/agents/log.js +23 -0
- package/dist/answer.js +100 -0
- package/dist/answers/command.js +128 -0
- package/dist/app.js +15 -0
- package/dist/author.js +109 -0
- package/dist/bin/wcat-wirecat.js +40 -0
- package/dist/bots/command.js +175 -0
- package/dist/bundle/auto-YETGUQ2J.js +43 -0
- package/dist/bundle/chunk-3ME37WWB.js +31 -0
- package/dist/bundle/chunk-4WI3FO7T.js +395 -0
- package/dist/bundle/chunk-7O7XM37N.js +2 -0
- package/dist/bundle/chunk-DWQQRBQV.js +51 -0
- package/dist/bundle/chunk-FOWR5KJS.js +72 -0
- package/dist/bundle/chunk-GGRL6DTE.js +120 -0
- package/dist/bundle/chunk-KNFSW562.js +312 -0
- package/dist/bundle/chunk-KPJVVFQF.js +416 -0
- package/dist/bundle/chunk-WMPDRWVF.js +222 -0
- package/dist/bundle/chunk-X5OK73GU.js +807 -0
- package/dist/bundle/chunk-ZC4PRE6C.js +38 -0
- package/dist/bundle/entry-S4DSYEAY.js +64 -0
- package/dist/bundle/failure-FALOD7QW.js +19 -0
- package/dist/bundle/from-memo-XVOLSUOM.js +314 -0
- package/dist/bundle/program-XSZSINBU.js +14994 -0
- package/dist/bundle/server-GQ4NZUDL.js +303 -0
- package/dist/bundle/update-2EH5KHTV.js +22 -0
- package/dist/bundle/wcat-wirecat.js +83 -0
- package/dist/config-command.js +39 -0
- package/dist/config-issues.js +15 -0
- package/dist/config.js +187 -0
- package/dist/context/command.js +162 -0
- package/dist/context/context.js +197 -0
- package/dist/contract-overrides/commands.js +81 -0
- package/dist/contract-overrides/mcp.js +241 -0
- package/dist/contract-overrides/meetings.js +344 -0
- package/dist/contract-overrides/search.js +508 -0
- package/dist/contract-overrides/skill.js +85 -0
- package/dist/contract-overrides.js +7 -0
- package/dist/digest/backfill.js +175 -0
- package/dist/digest/brief.js +189 -0
- package/dist/digest/catch-up-record.js +30 -0
- package/dist/digest/catch-up.js +86 -0
- package/dist/digest/command.js +110 -0
- package/dist/digest/digest-commands.js +327 -0
- package/dist/digest/digest.js +560 -0
- package/dist/digest/digests.js +213 -0
- package/dist/digest/history.js +202 -0
- package/dist/digest/input.js +30 -0
- package/dist/digest/known.js +28 -0
- package/dist/digest/sources.js +155 -0
- package/dist/digest/sync-health.js +158 -0
- package/dist/digest/task-proposals.js +67 -0
- package/dist/digest/tasks.js +145 -0
- package/dist/digest/text.js +49 -0
- package/dist/discovery/command.js +107 -0
- package/dist/doctor/command.js +167 -0
- package/dist/documents/command.js +107 -0
- package/dist/domain-lists/command.js +13 -0
- package/dist/events/command.js +35 -0
- package/dist/events/events.js +196 -0
- package/dist/examples.js +609 -0
- package/dist/facts/command.js +100 -0
- package/dist/facts/fact.js +54 -0
- package/dist/facts/facts.js +15 -0
- package/dist/failure.js +58 -0
- package/dist/finance/command.js +121 -0
- package/dist/finance/contracts-command.js +109 -0
- package/dist/finance/deal-text.js +34 -0
- package/dist/finance/deals-command.js +346 -0
- package/dist/finance/finance.js +129 -0
- package/dist/finance/lines-command.js +70 -0
- package/dist/finance/orders-command.js +94 -0
- package/dist/finance/products-command.js +98 -0
- package/dist/finance/subscriptions-command.js +152 -0
- package/dist/finance/transactions-command.js +136 -0
- package/dist/finance/wallets-command.js +105 -0
- package/dist/finance/written.js +36 -0
- package/dist/findings/command.js +102 -0
- package/dist/findings-input.js +23 -0
- package/dist/identity.js +20 -0
- package/dist/install/postinstall.js +47 -0
- package/dist/json-fields.js +48 -0
- package/dist/knowledge/business-text.js +19 -0
- package/dist/knowledge/command.js +435 -0
- package/dist/knowledge/document-context.js +33 -0
- package/dist/knowledge/key-documents.js +120 -0
- package/dist/knowledge/list-queries.js +20 -0
- package/dist/knowledge/meeting-projects-command.js +61 -0
- package/dist/knowledge/messenger-sync.js +253 -0
- package/dist/knowledge/money-text.js +16 -0
- package/dist/knowledge/notes-about.js +81 -0
- package/dist/knowledge/organization-delete-command.js +44 -0
- package/dist/knowledge/organization-text.js +27 -0
- package/dist/knowledge/project-actions-command.js +130 -0
- package/dist/knowledge/project-actions.js +104 -0
- package/dist/knowledge/project-activity-command.js +70 -0
- package/dist/knowledge/project-context.js +101 -0
- package/dist/knowledge/project-findings.js +41 -0
- package/dist/knowledge/project-gather-command.js +100 -0
- package/dist/knowledge/project-status-command.js +129 -0
- package/dist/knowledge/project-transfer-command.js +58 -0
- package/dist/knowledge/project-transfer.js +107 -0
- package/dist/knowledge/relationships-scan.js +116 -0
- package/dist/knowledge/relationships.js +115 -0
- package/dist/knowledge/roles-command.js +67 -0
- package/dist/mail/command.js +20 -0
- package/dist/mail/findings-command.js +143 -0
- package/dist/mail/findings-duplicates.js +159 -0
- package/dist/mail/messages-command.js +77 -0
- package/dist/mail/review-command.js +59 -0
- package/dist/mail/subscriptions-command.js +84 -0
- package/dist/mcp/catalogue.js +159 -0
- package/dist/mcp/command.js +125 -0
- package/dist/mcp/granted.js +18 -0
- package/dist/mcp/permissions.js +61 -0
- package/dist/mcp/server.js +128 -0
- package/dist/meetings/command.js +31 -0
- package/dist/meetings/list-command.js +59 -0
- package/dist/meetings/preparation-command.js +42 -0
- package/dist/meetings/preparation-text.js +44 -0
- package/dist/meetings/preparation.js +50 -0
- package/dist/meetings/read.js +32 -0
- package/dist/memories/command.js +105 -0
- package/dist/memories/memories.js +17 -0
- package/dist/memories/memory.js +89 -0
- package/dist/memories/sources.js +111 -0
- package/dist/mentions/command.js +91 -0
- package/dist/migrate/check.js +48 -0
- package/dist/migrate/from-memo.js +345 -0
- package/dist/migrate/skill.js +35 -0
- package/dist/models/command.js +19 -0
- package/dist/options.js +35 -0
- package/dist/output.js +17 -0
- package/dist/page.js +14 -0
- package/dist/people/command.js +144 -0
- package/dist/people/delete-command.js +53 -0
- package/dist/people/doubts-command.js +81 -0
- package/dist/people/identities-command.js +188 -0
- package/dist/people/identity.js +42 -0
- package/dist/people/owner.js +14 -0
- package/dist/people/proposal-rows.js +70 -0
- package/dist/people/proposals-command.js +248 -0
- package/dist/people/review-context.js +108 -0
- package/dist/people/subject.js +19 -0
- package/dist/program.js +875 -0
- package/dist/read-only.js +51 -0
- package/dist/reasons.js +368 -0
- package/dist/records/import.js +135 -0
- package/dist/records/input.js +210 -0
- package/dist/records/mapping.js +80 -0
- package/dist/records/record-commands.js +125 -0
- package/dist/records/sources.js +73 -0
- package/dist/refs.js +28 -0
- package/dist/review/command.js +171 -0
- package/dist/review/kinds.js +44 -0
- package/dist/review/review.js +299 -0
- package/dist/review/status.js +93 -0
- package/dist/rows.js +219 -0
- package/dist/run/auto.js +237 -0
- package/dist/run/entry.js +62 -0
- package/dist/run/files.js +51 -0
- package/dist/run/import.js +253 -0
- package/dist/run/lock.js +20 -0
- package/dist/save-help.js +3 -0
- package/dist/schedule/command.js +58 -0
- package/dist/schedule/mail-triage-input.js +152 -0
- package/dist/schedule/task-triage-input.js +152 -0
- package/dist/search/answers.js +176 -0
- package/dist/search/command.js +257 -0
- package/dist/search/denied.js +9 -0
- package/dist/search/embed.js +126 -0
- package/dist/search/hits.js +4 -0
- package/dist/search/lane-gates.js +76 -0
- package/dist/search/notes-text.js +18 -0
- package/dist/search/people.js +88 -0
- package/dist/search/search.js +306 -0
- package/dist/show/command.js +179 -0
- package/dist/store/crm-viewer.js +102 -0
- package/dist/store/group.js +112 -0
- package/dist/store/groups-command.js +136 -0
- package/dist/store/guard.js +94 -0
- package/dist/store/held.js +21 -0
- package/dist/store/info-command.js +37 -0
- package/dist/store/scope.js +53 -0
- package/dist/store/source-list.js +222 -0
- package/dist/store/source-target.js +28 -0
- package/dist/tags/command.js +176 -0
- package/dist/tasks/command.js +174 -0
- package/dist/tasks/context.js +74 -0
- package/dist/tasks/list.js +199 -0
- package/dist/tasks/proposal-duplicates.js +70 -0
- package/dist/tasks/relations-command.js +28 -0
- package/dist/tasks/shared.js +105 -0
- package/dist/tasks/tasks.js +197 -0
- package/dist/templates/command.js +18 -0
- package/dist/terminal.js +23 -0
- package/dist/update.js +35 -0
- package/dist/version.js +2 -0
- package/dist/vocabulary/command.js +103 -0
- package/dist/vocabulary/inspect.js +23 -0
- package/dist/vocabulary/inspection.js +18 -0
- package/dist/vocabulary/list.js +18 -0
- package/dist/vocabulary/project.js +19 -0
- package/dist/wcat.js +3 -0
- package/install/postinstall.mjs +9 -0
- package/package.json +89 -4
- package/scenarios/decision-trail.md +21 -0
- package/scenarios/person-brief.md +35 -0
- package/scenarios/prepare-meeting.md +17 -0
- package/scenarios/project-state.md +26 -0
- package/scenarios/set-up.md +18 -0
- package/scenarios/start-the-day.md +19 -0
- package/skills/mail-triage/SKILL.md +208 -0
- package/skills/morning-digest/SKILL.md +147 -0
- package/skills/task-triage/SKILL.md +79 -0
- package/skills/wcat/SKILL.md +65 -0
- package/skills/wcat/topics/mail.md +32 -0
- package/skills/wcat/topics/mcp.md +22 -0
- package/skills/wcat/topics/meetings.md +37 -0
- package/skills/wcat/topics/money.md +52 -0
- package/skills/wcat/topics/projects.md +54 -0
- package/skills/wcat/topics/proposals.md +113 -0
- package/skills/wcat/topics/search.md +85 -0
- package/skills/wcat/topics/vocabulary.md +8 -0
|
@@ -0,0 +1,807 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-4WI3FO7T.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
|
+
var ValiError = class extends Error {
|
|
106
|
+
static {
|
|
107
|
+
__name(this, "ValiError");
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Creates a Valibot error with useful information.
|
|
111
|
+
*
|
|
112
|
+
* @param issues The error issues.
|
|
113
|
+
*/
|
|
114
|
+
constructor(issues) {
|
|
115
|
+
super(issues[0].message);
|
|
116
|
+
this.name = "ValiError";
|
|
117
|
+
this.issues = issues;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
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");
|
|
121
|
+
// @__NO_SIDE_EFFECTS__
|
|
122
|
+
function check(requirement, message$1) {
|
|
123
|
+
return {
|
|
124
|
+
kind: "validation",
|
|
125
|
+
type: "check",
|
|
126
|
+
reference: check,
|
|
127
|
+
async: false,
|
|
128
|
+
expects: null,
|
|
129
|
+
requirement,
|
|
130
|
+
message: message$1,
|
|
131
|
+
"~run"(dataset, config$1) {
|
|
132
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
|
|
133
|
+
return dataset;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
__name(check, "check");
|
|
138
|
+
// @__NO_SIDE_EFFECTS__
|
|
139
|
+
function integer(message$1) {
|
|
140
|
+
return {
|
|
141
|
+
kind: "validation",
|
|
142
|
+
type: "integer",
|
|
143
|
+
reference: integer,
|
|
144
|
+
async: false,
|
|
145
|
+
expects: null,
|
|
146
|
+
requirement: Number.isInteger,
|
|
147
|
+
message: message$1,
|
|
148
|
+
"~run"(dataset, config$1) {
|
|
149
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
|
|
150
|
+
return dataset;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
__name(integer, "integer");
|
|
155
|
+
// @__NO_SIDE_EFFECTS__
|
|
156
|
+
function maxLength(requirement, message$1) {
|
|
157
|
+
return {
|
|
158
|
+
kind: "validation",
|
|
159
|
+
type: "max_length",
|
|
160
|
+
reference: maxLength,
|
|
161
|
+
async: false,
|
|
162
|
+
expects: `<=${requirement}`,
|
|
163
|
+
requirement,
|
|
164
|
+
message: message$1,
|
|
165
|
+
"~run"(dataset, config$1) {
|
|
166
|
+
if (dataset.typed && dataset.value.length > this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
|
|
167
|
+
return dataset;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
__name(maxLength, "maxLength");
|
|
172
|
+
// @__NO_SIDE_EFFECTS__
|
|
173
|
+
function minLength(requirement, message$1) {
|
|
174
|
+
return {
|
|
175
|
+
kind: "validation",
|
|
176
|
+
type: "min_length",
|
|
177
|
+
reference: minLength,
|
|
178
|
+
async: false,
|
|
179
|
+
expects: `>=${requirement}`,
|
|
180
|
+
requirement,
|
|
181
|
+
message: message$1,
|
|
182
|
+
"~run"(dataset, config$1) {
|
|
183
|
+
if (dataset.typed && dataset.value.length < this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
|
|
184
|
+
return dataset;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
__name(minLength, "minLength");
|
|
189
|
+
// @__NO_SIDE_EFFECTS__
|
|
190
|
+
function minValue(requirement, message$1) {
|
|
191
|
+
return {
|
|
192
|
+
kind: "validation",
|
|
193
|
+
type: "min_value",
|
|
194
|
+
reference: minValue,
|
|
195
|
+
async: false,
|
|
196
|
+
expects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
197
|
+
requirement,
|
|
198
|
+
message: message$1,
|
|
199
|
+
"~run"(dataset, config$1) {
|
|
200
|
+
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) });
|
|
201
|
+
return dataset;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
__name(minValue, "minValue");
|
|
206
|
+
// @__NO_SIDE_EFFECTS__
|
|
207
|
+
function regex(requirement, message$1) {
|
|
208
|
+
return {
|
|
209
|
+
kind: "validation",
|
|
210
|
+
type: "regex",
|
|
211
|
+
reference: regex,
|
|
212
|
+
async: false,
|
|
213
|
+
expects: `${requirement}`,
|
|
214
|
+
requirement,
|
|
215
|
+
message: message$1,
|
|
216
|
+
"~run"(dataset, config$1) {
|
|
217
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config$1);
|
|
218
|
+
return dataset;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
__name(regex, "regex");
|
|
223
|
+
// @__NO_SIDE_EFFECTS__
|
|
224
|
+
function getFallback(schema, dataset, config$1) {
|
|
225
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
226
|
+
}
|
|
227
|
+
__name(getFallback, "getFallback");
|
|
228
|
+
// @__NO_SIDE_EFFECTS__
|
|
229
|
+
function getDefault(schema, dataset, config$1) {
|
|
230
|
+
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
231
|
+
}
|
|
232
|
+
__name(getDefault, "getDefault");
|
|
233
|
+
// @__NO_SIDE_EFFECTS__
|
|
234
|
+
function array(item, message$1) {
|
|
235
|
+
return _standardSchema({
|
|
236
|
+
kind: "schema",
|
|
237
|
+
type: "array",
|
|
238
|
+
reference: array,
|
|
239
|
+
expects: "Array",
|
|
240
|
+
async: false,
|
|
241
|
+
item,
|
|
242
|
+
message: message$1,
|
|
243
|
+
"~run"(dataset, config$1) {
|
|
244
|
+
const input = dataset.value;
|
|
245
|
+
if (Array.isArray(input)) {
|
|
246
|
+
dataset.typed = true;
|
|
247
|
+
dataset.value = [];
|
|
248
|
+
for (let key = 0; key < input.length; key++) {
|
|
249
|
+
const value$1 = input[key];
|
|
250
|
+
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
251
|
+
if (itemDataset.issues) {
|
|
252
|
+
const pathItem = {
|
|
253
|
+
type: "array",
|
|
254
|
+
origin: "value",
|
|
255
|
+
input,
|
|
256
|
+
key,
|
|
257
|
+
value: value$1
|
|
258
|
+
};
|
|
259
|
+
for (const issue of itemDataset.issues) {
|
|
260
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
261
|
+
else issue.path = [pathItem];
|
|
262
|
+
dataset.issues?.push(issue);
|
|
263
|
+
}
|
|
264
|
+
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
265
|
+
if (config$1.abortEarly) {
|
|
266
|
+
dataset.typed = false;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (!itemDataset.typed) dataset.typed = false;
|
|
271
|
+
dataset.value.push(itemDataset.value);
|
|
272
|
+
}
|
|
273
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
274
|
+
return dataset;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
__name(array, "array");
|
|
279
|
+
// @__NO_SIDE_EFFECTS__
|
|
280
|
+
function boolean(message$1) {
|
|
281
|
+
return _standardSchema({
|
|
282
|
+
kind: "schema",
|
|
283
|
+
type: "boolean",
|
|
284
|
+
reference: boolean,
|
|
285
|
+
expects: "boolean",
|
|
286
|
+
async: false,
|
|
287
|
+
message: message$1,
|
|
288
|
+
"~run"(dataset, config$1) {
|
|
289
|
+
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
290
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
291
|
+
return dataset;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
__name(boolean, "boolean");
|
|
296
|
+
// @__NO_SIDE_EFFECTS__
|
|
297
|
+
function literal(literal_, message$1) {
|
|
298
|
+
return _standardSchema({
|
|
299
|
+
kind: "schema",
|
|
300
|
+
type: "literal",
|
|
301
|
+
reference: literal,
|
|
302
|
+
expects: /* @__PURE__ */ _stringify(literal_),
|
|
303
|
+
async: false,
|
|
304
|
+
literal: literal_,
|
|
305
|
+
message: message$1,
|
|
306
|
+
"~run"(dataset, config$1) {
|
|
307
|
+
if (/* @__PURE__ */ _isSameValueZero(dataset.value, this.literal)) dataset.typed = true;
|
|
308
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
309
|
+
return dataset;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
__name(literal, "literal");
|
|
314
|
+
// @__NO_SIDE_EFFECTS__
|
|
315
|
+
function looseObject(entries$1, message$1) {
|
|
316
|
+
return _standardSchema({
|
|
317
|
+
kind: "schema",
|
|
318
|
+
type: "loose_object",
|
|
319
|
+
reference: looseObject,
|
|
320
|
+
expects: "Object",
|
|
321
|
+
async: false,
|
|
322
|
+
entries: entries$1,
|
|
323
|
+
message: message$1,
|
|
324
|
+
"~run"(dataset, config$1) {
|
|
325
|
+
const input = dataset.value;
|
|
326
|
+
if (input && typeof input === "object") {
|
|
327
|
+
dataset.typed = true;
|
|
328
|
+
dataset.value = {};
|
|
329
|
+
for (const key in this.entries) {
|
|
330
|
+
const valueSchema = this.entries[key];
|
|
331
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
332
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
333
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
334
|
+
if (valueDataset.issues) {
|
|
335
|
+
const pathItem = {
|
|
336
|
+
type: "object",
|
|
337
|
+
origin: "value",
|
|
338
|
+
input,
|
|
339
|
+
key,
|
|
340
|
+
value: value$1
|
|
341
|
+
};
|
|
342
|
+
for (const issue of valueDataset.issues) {
|
|
343
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
344
|
+
else issue.path = [pathItem];
|
|
345
|
+
dataset.issues?.push(issue);
|
|
346
|
+
}
|
|
347
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
348
|
+
if (config$1.abortEarly) {
|
|
349
|
+
dataset.typed = false;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
354
|
+
dataset.value[key] = valueDataset.value;
|
|
355
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
356
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
357
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
358
|
+
input: void 0,
|
|
359
|
+
expected: `"${key}"`,
|
|
360
|
+
path: [{
|
|
361
|
+
type: "object",
|
|
362
|
+
origin: "key",
|
|
363
|
+
input,
|
|
364
|
+
key,
|
|
365
|
+
value: input[key]
|
|
366
|
+
}]
|
|
367
|
+
});
|
|
368
|
+
if (config$1.abortEarly) break;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
372
|
+
for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !Object.prototype.hasOwnProperty.call(this.entries, key)) dataset.value[key] = input[key];
|
|
373
|
+
}
|
|
374
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
375
|
+
return dataset;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
__name(looseObject, "looseObject");
|
|
380
|
+
// @__NO_SIDE_EFFECTS__
|
|
381
|
+
function nullable(wrapped, default_) {
|
|
382
|
+
return _standardSchema({
|
|
383
|
+
kind: "schema",
|
|
384
|
+
type: "nullable",
|
|
385
|
+
reference: nullable,
|
|
386
|
+
expects: `(${wrapped.expects} | null)`,
|
|
387
|
+
async: false,
|
|
388
|
+
wrapped,
|
|
389
|
+
default: default_,
|
|
390
|
+
"~run"(dataset, config$1) {
|
|
391
|
+
if (dataset.value === null) {
|
|
392
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
393
|
+
if (dataset.value === null) {
|
|
394
|
+
dataset.typed = true;
|
|
395
|
+
return dataset;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
__name(nullable, "nullable");
|
|
403
|
+
// @__NO_SIDE_EFFECTS__
|
|
404
|
+
function number(message$1) {
|
|
405
|
+
return _standardSchema({
|
|
406
|
+
kind: "schema",
|
|
407
|
+
type: "number",
|
|
408
|
+
reference: number,
|
|
409
|
+
expects: "number",
|
|
410
|
+
async: false,
|
|
411
|
+
message: message$1,
|
|
412
|
+
"~run"(dataset, config$1) {
|
|
413
|
+
if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
|
|
414
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
415
|
+
return dataset;
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
__name(number, "number");
|
|
420
|
+
// @__NO_SIDE_EFFECTS__
|
|
421
|
+
function object(entries$1, message$1) {
|
|
422
|
+
return _standardSchema({
|
|
423
|
+
kind: "schema",
|
|
424
|
+
type: "object",
|
|
425
|
+
reference: object,
|
|
426
|
+
expects: "Object",
|
|
427
|
+
async: false,
|
|
428
|
+
entries: entries$1,
|
|
429
|
+
message: message$1,
|
|
430
|
+
"~run"(dataset, config$1) {
|
|
431
|
+
const input = dataset.value;
|
|
432
|
+
if (input && typeof input === "object") {
|
|
433
|
+
dataset.typed = true;
|
|
434
|
+
dataset.value = {};
|
|
435
|
+
for (const key in this.entries) {
|
|
436
|
+
const valueSchema = this.entries[key];
|
|
437
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
438
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
439
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
440
|
+
if (valueDataset.issues) {
|
|
441
|
+
const pathItem = {
|
|
442
|
+
type: "object",
|
|
443
|
+
origin: "value",
|
|
444
|
+
input,
|
|
445
|
+
key,
|
|
446
|
+
value: value$1
|
|
447
|
+
};
|
|
448
|
+
for (const issue of valueDataset.issues) {
|
|
449
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
450
|
+
else issue.path = [pathItem];
|
|
451
|
+
dataset.issues?.push(issue);
|
|
452
|
+
}
|
|
453
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
454
|
+
if (config$1.abortEarly) {
|
|
455
|
+
dataset.typed = false;
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
460
|
+
dataset.value[key] = valueDataset.value;
|
|
461
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
462
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
463
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
464
|
+
input: void 0,
|
|
465
|
+
expected: `"${key}"`,
|
|
466
|
+
path: [{
|
|
467
|
+
type: "object",
|
|
468
|
+
origin: "key",
|
|
469
|
+
input,
|
|
470
|
+
key,
|
|
471
|
+
value: input[key]
|
|
472
|
+
}]
|
|
473
|
+
});
|
|
474
|
+
if (config$1.abortEarly) break;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
478
|
+
return dataset;
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
__name(object, "object");
|
|
483
|
+
// @__NO_SIDE_EFFECTS__
|
|
484
|
+
function optional(wrapped, default_) {
|
|
485
|
+
return _standardSchema({
|
|
486
|
+
kind: "schema",
|
|
487
|
+
type: "optional",
|
|
488
|
+
reference: optional,
|
|
489
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
490
|
+
async: false,
|
|
491
|
+
wrapped,
|
|
492
|
+
default: default_,
|
|
493
|
+
"~run"(dataset, config$1) {
|
|
494
|
+
if (dataset.value === void 0) {
|
|
495
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
496
|
+
if (dataset.value === void 0) {
|
|
497
|
+
dataset.typed = true;
|
|
498
|
+
return dataset;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
__name(optional, "optional");
|
|
506
|
+
// @__NO_SIDE_EFFECTS__
|
|
507
|
+
function picklist(options, message$1) {
|
|
508
|
+
return _standardSchema({
|
|
509
|
+
kind: "schema",
|
|
510
|
+
type: "picklist",
|
|
511
|
+
reference: picklist,
|
|
512
|
+
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
513
|
+
async: false,
|
|
514
|
+
options,
|
|
515
|
+
message: message$1,
|
|
516
|
+
"~run"(dataset, config$1) {
|
|
517
|
+
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
518
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
519
|
+
return dataset;
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
__name(picklist, "picklist");
|
|
524
|
+
// @__NO_SIDE_EFFECTS__
|
|
525
|
+
function record(key, value$1, message$1) {
|
|
526
|
+
return _standardSchema({
|
|
527
|
+
kind: "schema",
|
|
528
|
+
type: "record",
|
|
529
|
+
reference: record,
|
|
530
|
+
expects: "Object",
|
|
531
|
+
async: false,
|
|
532
|
+
key,
|
|
533
|
+
value: value$1,
|
|
534
|
+
message: message$1,
|
|
535
|
+
"~run"(dataset, config$1) {
|
|
536
|
+
const input = dataset.value;
|
|
537
|
+
if (input && typeof input === "object") {
|
|
538
|
+
dataset.typed = true;
|
|
539
|
+
dataset.value = {};
|
|
540
|
+
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
541
|
+
const entryValue = input[entryKey];
|
|
542
|
+
const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
|
|
543
|
+
if (keyDataset.issues) {
|
|
544
|
+
const pathItem = {
|
|
545
|
+
type: "object",
|
|
546
|
+
origin: "key",
|
|
547
|
+
input,
|
|
548
|
+
key: entryKey,
|
|
549
|
+
value: entryValue
|
|
550
|
+
};
|
|
551
|
+
for (const issue of keyDataset.issues) {
|
|
552
|
+
issue.path = [pathItem];
|
|
553
|
+
dataset.issues?.push(issue);
|
|
554
|
+
}
|
|
555
|
+
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
556
|
+
if (config$1.abortEarly) {
|
|
557
|
+
dataset.typed = false;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
|
|
562
|
+
if (valueDataset.issues) {
|
|
563
|
+
const pathItem = {
|
|
564
|
+
type: "object",
|
|
565
|
+
origin: "value",
|
|
566
|
+
input,
|
|
567
|
+
key: entryKey,
|
|
568
|
+
value: entryValue
|
|
569
|
+
};
|
|
570
|
+
for (const issue of valueDataset.issues) {
|
|
571
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
572
|
+
else issue.path = [pathItem];
|
|
573
|
+
dataset.issues?.push(issue);
|
|
574
|
+
}
|
|
575
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
576
|
+
if (config$1.abortEarly) {
|
|
577
|
+
dataset.typed = false;
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
582
|
+
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
583
|
+
}
|
|
584
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
585
|
+
return dataset;
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
__name(record, "record");
|
|
590
|
+
// @__NO_SIDE_EFFECTS__
|
|
591
|
+
function strictObject(entries$1, message$1) {
|
|
592
|
+
return _standardSchema({
|
|
593
|
+
kind: "schema",
|
|
594
|
+
type: "strict_object",
|
|
595
|
+
reference: strictObject,
|
|
596
|
+
expects: "Object",
|
|
597
|
+
async: false,
|
|
598
|
+
entries: entries$1,
|
|
599
|
+
message: message$1,
|
|
600
|
+
"~run"(dataset, config$1) {
|
|
601
|
+
const input = dataset.value;
|
|
602
|
+
if (input && typeof input === "object") {
|
|
603
|
+
dataset.typed = true;
|
|
604
|
+
dataset.value = {};
|
|
605
|
+
for (const key in this.entries) {
|
|
606
|
+
const valueSchema = this.entries[key];
|
|
607
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
608
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
609
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
610
|
+
if (valueDataset.issues) {
|
|
611
|
+
const pathItem = {
|
|
612
|
+
type: "object",
|
|
613
|
+
origin: "value",
|
|
614
|
+
input,
|
|
615
|
+
key,
|
|
616
|
+
value: value$1
|
|
617
|
+
};
|
|
618
|
+
for (const issue of valueDataset.issues) {
|
|
619
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
620
|
+
else issue.path = [pathItem];
|
|
621
|
+
dataset.issues?.push(issue);
|
|
622
|
+
}
|
|
623
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
624
|
+
if (config$1.abortEarly) {
|
|
625
|
+
dataset.typed = false;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
630
|
+
dataset.value[key] = valueDataset.value;
|
|
631
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
632
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
633
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
634
|
+
input: void 0,
|
|
635
|
+
expected: `"${key}"`,
|
|
636
|
+
path: [{
|
|
637
|
+
type: "object",
|
|
638
|
+
origin: "key",
|
|
639
|
+
input,
|
|
640
|
+
key,
|
|
641
|
+
value: input[key]
|
|
642
|
+
}]
|
|
643
|
+
});
|
|
644
|
+
if (config$1.abortEarly) break;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
648
|
+
for (const key in input) if (!Object.prototype.hasOwnProperty.call(this.entries, key)) {
|
|
649
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
650
|
+
input: key,
|
|
651
|
+
expected: "never",
|
|
652
|
+
path: [{
|
|
653
|
+
type: "object",
|
|
654
|
+
origin: "key",
|
|
655
|
+
input,
|
|
656
|
+
key,
|
|
657
|
+
value: input[key]
|
|
658
|
+
}]
|
|
659
|
+
});
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
664
|
+
return dataset;
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
__name(strictObject, "strictObject");
|
|
669
|
+
// @__NO_SIDE_EFFECTS__
|
|
670
|
+
function string(message$1) {
|
|
671
|
+
return _standardSchema({
|
|
672
|
+
kind: "schema",
|
|
673
|
+
type: "string",
|
|
674
|
+
reference: string,
|
|
675
|
+
expects: "string",
|
|
676
|
+
async: false,
|
|
677
|
+
message: message$1,
|
|
678
|
+
"~run"(dataset, config$1) {
|
|
679
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
680
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
681
|
+
return dataset;
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
__name(string, "string");
|
|
686
|
+
// @__NO_SIDE_EFFECTS__
|
|
687
|
+
function _subIssues(datasets) {
|
|
688
|
+
let issues;
|
|
689
|
+
if (datasets) for (const dataset of datasets) if (issues) for (const issue of dataset.issues) issues.push(issue);
|
|
690
|
+
else issues = dataset.issues;
|
|
691
|
+
return issues;
|
|
692
|
+
}
|
|
693
|
+
__name(_subIssues, "_subIssues");
|
|
694
|
+
// @__NO_SIDE_EFFECTS__
|
|
695
|
+
function union(options, message$1) {
|
|
696
|
+
return _standardSchema({
|
|
697
|
+
kind: "schema",
|
|
698
|
+
type: "union",
|
|
699
|
+
reference: union,
|
|
700
|
+
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
701
|
+
async: false,
|
|
702
|
+
options,
|
|
703
|
+
message: message$1,
|
|
704
|
+
"~run"(dataset, config$1) {
|
|
705
|
+
let validDataset;
|
|
706
|
+
let typedDatasets;
|
|
707
|
+
let untypedDatasets;
|
|
708
|
+
for (const schema of this.options) {
|
|
709
|
+
const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
|
|
710
|
+
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
711
|
+
else typedDatasets = [optionDataset];
|
|
712
|
+
else {
|
|
713
|
+
validDataset = optionDataset;
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
else if (untypedDatasets) untypedDatasets.push(optionDataset);
|
|
717
|
+
else untypedDatasets = [optionDataset];
|
|
718
|
+
}
|
|
719
|
+
if (validDataset) return validDataset;
|
|
720
|
+
if (typedDatasets) {
|
|
721
|
+
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
722
|
+
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
723
|
+
dataset.typed = true;
|
|
724
|
+
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
725
|
+
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
726
|
+
return dataset;
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
__name(union, "union");
|
|
731
|
+
// @__NO_SIDE_EFFECTS__
|
|
732
|
+
function unknown() {
|
|
733
|
+
return _standardSchema({
|
|
734
|
+
kind: "schema",
|
|
735
|
+
type: "unknown",
|
|
736
|
+
reference: unknown,
|
|
737
|
+
expects: "unknown",
|
|
738
|
+
async: false,
|
|
739
|
+
"~run"(dataset) {
|
|
740
|
+
dataset.typed = true;
|
|
741
|
+
return dataset;
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
__name(unknown, "unknown");
|
|
746
|
+
function parse(schema, input, config$1) {
|
|
747
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
748
|
+
if (dataset.issues) throw new ValiError(dataset.issues);
|
|
749
|
+
return dataset.value;
|
|
750
|
+
}
|
|
751
|
+
__name(parse, "parse");
|
|
752
|
+
// @__NO_SIDE_EFFECTS__
|
|
753
|
+
function pipe(...pipe$1) {
|
|
754
|
+
return _standardSchema({
|
|
755
|
+
...pipe$1[0],
|
|
756
|
+
pipe: pipe$1,
|
|
757
|
+
"~run"(dataset, config$1) {
|
|
758
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
759
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
760
|
+
dataset.typed = false;
|
|
761
|
+
break;
|
|
762
|
+
}
|
|
763
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
764
|
+
}
|
|
765
|
+
return dataset;
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
__name(pipe, "pipe");
|
|
770
|
+
// @__NO_SIDE_EFFECTS__
|
|
771
|
+
function safeParse(schema, input, config$1) {
|
|
772
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
773
|
+
return {
|
|
774
|
+
typed: dataset.typed,
|
|
775
|
+
success: !dataset.issues,
|
|
776
|
+
output: dataset.value,
|
|
777
|
+
issues: dataset.issues
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
__name(safeParse, "safeParse");
|
|
781
|
+
|
|
782
|
+
export {
|
|
783
|
+
ValiError,
|
|
784
|
+
check,
|
|
785
|
+
integer,
|
|
786
|
+
maxLength,
|
|
787
|
+
minLength,
|
|
788
|
+
minValue,
|
|
789
|
+
regex,
|
|
790
|
+
array,
|
|
791
|
+
boolean,
|
|
792
|
+
literal,
|
|
793
|
+
looseObject,
|
|
794
|
+
nullable,
|
|
795
|
+
number,
|
|
796
|
+
object,
|
|
797
|
+
optional,
|
|
798
|
+
picklist,
|
|
799
|
+
record,
|
|
800
|
+
strictObject,
|
|
801
|
+
string,
|
|
802
|
+
union,
|
|
803
|
+
unknown,
|
|
804
|
+
parse,
|
|
805
|
+
pipe,
|
|
806
|
+
safeParse
|
|
807
|
+
};
|