@alint-js/plugin-simplicity 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/S-CK_sYI4B.mjs +3796 -0
- package/dist/core-BMoyZMrf.mjs +788 -0
- package/dist/effect-Df2gY8Wx-md27HJj5.mjs +8 -0
- package/dist/esm-DJF2n0HM.mjs +111800 -0
- package/dist/esm-Dk08cWwM.mjs +4632 -0
- package/dist/index-DoHiaFQM-9scNuUlY.mjs +16 -0
- package/dist/index.d.mts +1911 -17
- package/dist/index.mjs +9577 -977
- package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
- package/dist/sury-BoOvxlMw-BFMqRCCo.mjs +8 -0
- package/dist/valibot-_ibN3zSD-p0SIbJDK.mjs +8 -0
- package/dist/zod-DjyNjMBF-G0rhiyEk.mjs +28 -0
- package/package.json +9 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,294 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region ../plugin/dist/index.d.mts
|
|
2
|
+
//#region ../core/dist/types-DSvXUVZ7.d.mts
|
|
3
|
+
//#region src/core/source/types.d.ts
|
|
4
|
+
type ClassTarget = SourceTargetOfKind<'class'>;
|
|
5
|
+
type FileTarget = SourceTargetOfKind<'file'>;
|
|
6
|
+
type FunctionTarget = SourceTargetOfKind<'function'>;
|
|
7
|
+
interface LanguageContext {
|
|
8
|
+
cwd: string;
|
|
9
|
+
languageOptions: Record<string, unknown>;
|
|
10
|
+
src: SourceRuntime;
|
|
11
|
+
}
|
|
12
|
+
interface LineRange {
|
|
13
|
+
endLine: number;
|
|
14
|
+
startLine: number;
|
|
15
|
+
}
|
|
16
|
+
interface ProcessedSource {
|
|
17
|
+
identity: string;
|
|
18
|
+
language?: string;
|
|
19
|
+
origin?: ProcessedSourceOrigin;
|
|
20
|
+
path: string;
|
|
21
|
+
text: string;
|
|
22
|
+
}
|
|
23
|
+
interface ProcessedSourceOrigin {
|
|
24
|
+
physicalPath: string;
|
|
25
|
+
range?: SourceRange;
|
|
26
|
+
virtualPath?: string;
|
|
27
|
+
}
|
|
28
|
+
interface ProcessorContext {
|
|
29
|
+
cwd: string;
|
|
30
|
+
options: Record<string, unknown>;
|
|
31
|
+
src: SourceRuntime;
|
|
32
|
+
}
|
|
33
|
+
interface ProcessorPostprocessContext extends ProcessorContext {
|
|
34
|
+
file: SourceFile;
|
|
35
|
+
processedSources: ProcessedSource[];
|
|
36
|
+
}
|
|
37
|
+
interface SourceFile {
|
|
38
|
+
language: string;
|
|
39
|
+
lines: string[];
|
|
40
|
+
path: string;
|
|
41
|
+
text: string;
|
|
42
|
+
}
|
|
43
|
+
interface SourceLocation {
|
|
44
|
+
end: SourcePosition;
|
|
45
|
+
start: SourcePosition;
|
|
46
|
+
}
|
|
47
|
+
interface SourcePosition {
|
|
48
|
+
column: number;
|
|
49
|
+
line: number;
|
|
50
|
+
}
|
|
51
|
+
interface SourceRange {
|
|
52
|
+
end: number;
|
|
53
|
+
start: number;
|
|
54
|
+
}
|
|
55
|
+
interface SourceRuntime {
|
|
56
|
+
getText: (target: SourceFile | SourceTarget) => string;
|
|
57
|
+
readFile: (filePath: string) => Promise<SourceFile>;
|
|
58
|
+
sliceLines: (file: SourceFile, range: LineRange) => SourceText;
|
|
59
|
+
sliceRange: (file: SourceFile, range: SourceRange) => SourceText;
|
|
60
|
+
}
|
|
61
|
+
interface SourceTarget {
|
|
62
|
+
file: SourceFile;
|
|
63
|
+
identity: string;
|
|
64
|
+
kind: SourceTargetKind;
|
|
65
|
+
language: string;
|
|
66
|
+
loc?: SourceLocation;
|
|
67
|
+
metadata?: Record<string, unknown>;
|
|
68
|
+
name?: string;
|
|
69
|
+
origin?: SourceTargetOrigin;
|
|
70
|
+
range?: SourceRange;
|
|
71
|
+
text: string;
|
|
72
|
+
}
|
|
73
|
+
type SourceTargetKind = 'class' | 'file' | 'fragment' | 'function' | 'symbol' | (string & {});
|
|
74
|
+
type SourceTargetOfKind<Kind extends SourceTargetKind> = Omit<SourceTarget, 'kind'> & {
|
|
75
|
+
kind: Kind;
|
|
76
|
+
};
|
|
77
|
+
interface SourceTargetOrigin {
|
|
78
|
+
physicalPath: string;
|
|
79
|
+
range?: SourceRange;
|
|
80
|
+
virtualPath?: string;
|
|
81
|
+
}
|
|
82
|
+
interface SourceText {
|
|
83
|
+
filePath: string;
|
|
84
|
+
loc: SourceLocation;
|
|
85
|
+
text: string;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../core/dist/types-CR_Grd6q.d.mts
|
|
89
|
+
//#region src/config/types.d.ts
|
|
90
|
+
type ModelSize = 'large' | 'medium' | 'small';
|
|
91
|
+
interface RunnerCacheConfig {
|
|
92
|
+
enabled?: boolean;
|
|
93
|
+
location?: string;
|
|
94
|
+
}
|
|
95
|
+
interface RunnerConfig {
|
|
96
|
+
/** Retries after the initial attempt for replay-safe agent failures. @default 2 */
|
|
97
|
+
agentRetries?: number;
|
|
98
|
+
cache?: boolean | RunnerCacheConfig;
|
|
99
|
+
ruleConcurrency?: number;
|
|
100
|
+
stats?: boolean | RunnerStatsConfig;
|
|
101
|
+
timeoutMs?: number;
|
|
102
|
+
}
|
|
103
|
+
interface RunnerStatsConfig {
|
|
104
|
+
enabled?: boolean;
|
|
105
|
+
location?: string;
|
|
106
|
+
retentionMonths?: number;
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/models/types.d.ts
|
|
110
|
+
interface ModelRequirement {
|
|
111
|
+
capabilities?: string[];
|
|
112
|
+
minContextWindow?: number;
|
|
113
|
+
params?: Record<string, unknown>;
|
|
114
|
+
size?: ModelSize;
|
|
115
|
+
}
|
|
116
|
+
interface ResolvedModel {
|
|
117
|
+
aliases: string[];
|
|
118
|
+
capabilities: string[];
|
|
119
|
+
contextWindow?: number;
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
params: Record<string, unknown>;
|
|
123
|
+
provider: ResolvedProvider;
|
|
124
|
+
size?: ModelSize;
|
|
125
|
+
}
|
|
126
|
+
interface ResolvedProvider {
|
|
127
|
+
endpoint: string;
|
|
128
|
+
headers: Record<string, string>;
|
|
129
|
+
id: string;
|
|
130
|
+
type: 'openai-compatible';
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/agent/types.d.ts
|
|
134
|
+
type AgentAdapter = (request: AgentRequest) => Promise<AgentResult>;
|
|
135
|
+
interface AgentRequest {
|
|
136
|
+
instructions: string;
|
|
137
|
+
model: ResolvedModel;
|
|
138
|
+
prompt: string;
|
|
139
|
+
signal?: AbortSignal;
|
|
140
|
+
tools: AgentTool$1[];
|
|
141
|
+
}
|
|
142
|
+
interface AgentResult {
|
|
143
|
+
answer: string;
|
|
144
|
+
usage?: AgentUsage;
|
|
145
|
+
}
|
|
146
|
+
/** Agent-agnostic tool definition. Each adapter translates it to its framework's tool format. */
|
|
147
|
+
interface AgentTool$1 {
|
|
148
|
+
description: string;
|
|
149
|
+
execute: (input: unknown) => Promise<unknown> | unknown;
|
|
150
|
+
name: string;
|
|
151
|
+
parameters: Record<string, unknown>;
|
|
152
|
+
}
|
|
153
|
+
interface AgentUsage {
|
|
154
|
+
inputTokens?: number;
|
|
155
|
+
outputTokens?: number;
|
|
156
|
+
totalTokens?: number;
|
|
157
|
+
}
|
|
158
|
+
type AlintConfigExtends = AlintConfigInput | string;
|
|
159
|
+
type AlintConfigInput = AlintConfigItem | readonly AlintConfigInput[];
|
|
160
|
+
interface AlintConfigItem {
|
|
161
|
+
agent?: AgentAdapter;
|
|
162
|
+
basePath?: string;
|
|
163
|
+
directories?: readonly (readonly string[] | string)[];
|
|
164
|
+
extends?: readonly AlintConfigExtends[];
|
|
165
|
+
files?: readonly (readonly string[] | string)[];
|
|
166
|
+
ignore?: IgnoreConfig;
|
|
167
|
+
ignores?: readonly string[];
|
|
168
|
+
language?: string;
|
|
169
|
+
languageOptions?: Record<string, unknown>;
|
|
170
|
+
linterOptions?: AlintLinterOptions;
|
|
171
|
+
name?: string;
|
|
172
|
+
plugins?: Record<string, PluginDefinition>;
|
|
173
|
+
processor?: ProcessorDefinition | string;
|
|
174
|
+
rules?: Record<string, RuleConfigEntry>;
|
|
175
|
+
runner?: RunnerConfig;
|
|
176
|
+
settings?: Record<string, unknown>;
|
|
177
|
+
}
|
|
178
|
+
interface AlintLinterOptions {
|
|
179
|
+
noInlineConfig?: boolean;
|
|
180
|
+
reportUnusedDisableDirectives?: RuleSeverity;
|
|
181
|
+
}
|
|
182
|
+
type Awaitable<T> = Promise<T> | T;
|
|
183
|
+
interface DiagnosticDescriptor {
|
|
184
|
+
evidence?: unknown;
|
|
185
|
+
filePath?: string;
|
|
186
|
+
loc?: DiagnosticLocation;
|
|
187
|
+
message: string;
|
|
188
|
+
}
|
|
189
|
+
interface DiagnosticLocation {
|
|
190
|
+
end?: {
|
|
191
|
+
column: number;
|
|
192
|
+
line: number;
|
|
193
|
+
};
|
|
194
|
+
start: {
|
|
195
|
+
column: number;
|
|
196
|
+
line: number;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
interface DirectoryTarget {
|
|
200
|
+
kind: 'directory';
|
|
201
|
+
path: string;
|
|
202
|
+
}
|
|
203
|
+
interface IgnoreConfig {
|
|
204
|
+
gitignore?: boolean;
|
|
205
|
+
}
|
|
206
|
+
interface LanguageDefinition {
|
|
207
|
+
extensions?: readonly string[];
|
|
208
|
+
extract: (file: SourceFile, context: LanguageContext) => Awaitable<SourceTarget[]>;
|
|
209
|
+
name: string;
|
|
210
|
+
}
|
|
211
|
+
interface PluginDefinition {
|
|
212
|
+
configs?: Record<string, AlintConfigInput>;
|
|
213
|
+
languages?: Record<string, LanguageDefinition>;
|
|
214
|
+
processors?: Record<string, ProcessorDefinition>;
|
|
215
|
+
rules?: Record<string, RuleDefinition>;
|
|
216
|
+
}
|
|
217
|
+
interface ProcessorDefinition {
|
|
218
|
+
postprocess?: (diagnostics: DiagnosticDescriptor[], context: ProcessorPostprocessContext) => Awaitable<DiagnosticDescriptor[]>;
|
|
219
|
+
preprocess: (file: SourceFile, context: ProcessorContext) => Awaitable<ProcessedSource[]>;
|
|
220
|
+
}
|
|
221
|
+
interface ProjectTarget {
|
|
222
|
+
files: SourceFile[];
|
|
223
|
+
kind: 'project';
|
|
224
|
+
root: string;
|
|
225
|
+
targets: SourceTarget[];
|
|
226
|
+
}
|
|
227
|
+
type RuleCacheConfig = boolean | {
|
|
228
|
+
level?: 'target';
|
|
229
|
+
};
|
|
230
|
+
type RuleConfigEntry = [RuleSeverity] | RuleSeverity;
|
|
231
|
+
interface RuleContext {
|
|
232
|
+
agent?: AgentAdapter;
|
|
233
|
+
cwd: string;
|
|
234
|
+
id: string;
|
|
235
|
+
localId: string;
|
|
236
|
+
logger: {
|
|
237
|
+
debug: (...args: unknown[]) => void;
|
|
238
|
+
};
|
|
239
|
+
metering: {
|
|
240
|
+
recordUsage: (usage: RuleInferenceUsageRecord) => void;
|
|
241
|
+
};
|
|
242
|
+
model: (selector?: ModelRequirement | string) => Promise<ResolvedModel>;
|
|
243
|
+
outputLanguage?: string;
|
|
244
|
+
report: (diagnostic: DiagnosticDescriptor) => void;
|
|
245
|
+
settings: Record<string, unknown>;
|
|
246
|
+
/**
|
|
247
|
+
* Cancels the run. Forward it to anything long-running a rule starts, so cancelling stops
|
|
248
|
+
* the work instead of letting it finish and bill.
|
|
249
|
+
*
|
|
250
|
+
* `ctx.agent` already injects it, and `generateStructured` accepts it as `signal`.
|
|
251
|
+
*/
|
|
252
|
+
signal?: AbortSignal;
|
|
253
|
+
src: SourceRuntime;
|
|
254
|
+
}
|
|
255
|
+
interface RuleDefinition {
|
|
256
|
+
cache?: RuleCacheConfig;
|
|
257
|
+
/** Additional stable rule inputs, such as imported prompts, that invalidate cached results when changed. */
|
|
258
|
+
cacheKey?: unknown;
|
|
259
|
+
create: (context: RuleContext) => RuleHandlers;
|
|
260
|
+
model?: ModelRequirement;
|
|
261
|
+
}
|
|
262
|
+
type RuleHandlers = RuleSpecializedHandlers | RuleWithHandler;
|
|
263
|
+
interface RuleInferenceUsageRecord {
|
|
264
|
+
filePath?: string;
|
|
265
|
+
inputTokens?: number;
|
|
266
|
+
metadata?: unknown;
|
|
267
|
+
modelId: string;
|
|
268
|
+
outputTokens?: number;
|
|
269
|
+
providerId: string;
|
|
270
|
+
ruleId?: string;
|
|
271
|
+
totalTokens?: number;
|
|
272
|
+
}
|
|
273
|
+
type RuleSeverity = 'error' | 'off' | 'warn';
|
|
274
|
+
interface RuleSpecializedHandlers {
|
|
275
|
+
onTargetClass?: (target: ClassTarget) => Awaitable<void>;
|
|
276
|
+
onTargetDirectory?: (target: DirectoryTarget) => Awaitable<void>;
|
|
277
|
+
onTargetFile?: (target: FileTarget) => Awaitable<void>;
|
|
278
|
+
onTargetFunction?: (target: FunctionTarget) => Awaitable<void>;
|
|
279
|
+
onTargetProject?: (target: ProjectTarget) => Awaitable<void>;
|
|
280
|
+
onTargetWith?: never;
|
|
281
|
+
}
|
|
282
|
+
interface RuleWithHandler {
|
|
283
|
+
onTargetClass?: never;
|
|
284
|
+
onTargetDirectory?: never;
|
|
285
|
+
onTargetFile?: never;
|
|
286
|
+
onTargetFunction?: never;
|
|
287
|
+
onTargetProject?: never;
|
|
288
|
+
onTargetWith: (target: Target) => Awaitable<void>;
|
|
289
|
+
}
|
|
290
|
+
type Target = DirectoryTarget | ProjectTarget | SourceTarget;
|
|
291
|
+
//#endregion
|
|
4
292
|
//#region src/extract/types.d.ts
|
|
5
293
|
interface CallSite {
|
|
6
294
|
/** The last segment only: `a.b.helper()` and `helper()` both yield `helper`. */
|
|
@@ -56,6 +344,15 @@ declare function tokenize(text: string, commentRanges: readonly SourceRange[], i
|
|
|
56
344
|
/** Shared token fraction of the larger bag. Ranks candidates, decides nothing. */
|
|
57
345
|
declare function tokenOverlap(left: readonly string[], right: readonly string[]): number;
|
|
58
346
|
//#endregion
|
|
347
|
+
//#region ../core/dist/types-CR_Grd6q.d.mts
|
|
348
|
+
/** Agent-agnostic tool definition. Each adapter translates it to its framework's tool format. */
|
|
349
|
+
interface AgentTool {
|
|
350
|
+
description: string;
|
|
351
|
+
execute: (input: unknown) => Promise<unknown> | unknown;
|
|
352
|
+
name: string;
|
|
353
|
+
parameters: Record<string, unknown>;
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
59
356
|
//#region src/rules/no-duplicated-helper/tools.d.ts
|
|
60
357
|
interface AgentFinding {
|
|
61
358
|
helperId: string;
|
|
@@ -149,18 +446,1615 @@ declare function buildDuplicatedHelperPrompt(options: {
|
|
|
149
446
|
* Identical bodies and renamed-only copies are settled by AST fingerprints, with no model. What
|
|
150
447
|
* a fingerprint cannot settle goes to an agent holding the whole index as tools.
|
|
151
448
|
*/
|
|
152
|
-
declare const duplicatedHelperRule:
|
|
449
|
+
declare const duplicatedHelperRule: RuleDefinition;
|
|
153
450
|
//#endregion
|
|
154
451
|
//#region src/rules/no-needless-helper/prompt.d.ts
|
|
155
452
|
declare const needlessHelperPrompt: string;
|
|
156
453
|
declare function buildNeedlessHelperPrompt(helpers: readonly IndexedHelper[]): string;
|
|
157
454
|
//#endregion
|
|
455
|
+
//#region ../../node_modules/.pnpm/valibot@1.4.2_typescript@6.0.3/node_modules/valibot/dist/index.d.mts
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/methods/fallback/fallback.d.ts
|
|
458
|
+
/**
|
|
459
|
+
* Fallback type.
|
|
460
|
+
*/
|
|
461
|
+
type Fallback<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>> = MaybeDeepReadonly<InferOutput<TSchema>> | ((dataset?: OutputDataset<InferOutput<TSchema>, InferIssue<TSchema>>, config?: Config<InferIssue<TSchema>>) => MaybeDeepReadonly<InferOutput<TSchema>>);
|
|
462
|
+
/**
|
|
463
|
+
* Schema with fallback type.
|
|
464
|
+
*/
|
|
465
|
+
type SchemaWithFallback<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TFallback$1 extends Fallback<TSchema>> = TSchema & {
|
|
466
|
+
/**
|
|
467
|
+
* The fallback value.
|
|
468
|
+
*/
|
|
469
|
+
readonly fallback: TFallback$1;
|
|
470
|
+
};
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region src/methods/fallback/fallbackAsync.d.ts
|
|
473
|
+
/**
|
|
474
|
+
* Fallback async type.
|
|
475
|
+
*/
|
|
476
|
+
type FallbackAsync<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = MaybeDeepReadonly<InferOutput<TSchema>> | ((dataset?: OutputDataset<InferOutput<TSchema>, InferIssue<TSchema>>, config?: Config<InferIssue<TSchema>>) => MaybePromise<MaybeDeepReadonly<InferOutput<TSchema>>>);
|
|
477
|
+
/**
|
|
478
|
+
* Schema with fallback async type.
|
|
479
|
+
*/
|
|
480
|
+
type SchemaWithFallbackAsync<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TFallback$1 extends FallbackAsync<TSchema>> = Omit<TSchema, "async" | "~standard" | "~run"> & {
|
|
481
|
+
/**
|
|
482
|
+
* The fallback value.
|
|
483
|
+
*/
|
|
484
|
+
readonly fallback: TFallback$1;
|
|
485
|
+
/**
|
|
486
|
+
* Whether it's async.
|
|
487
|
+
*/
|
|
488
|
+
readonly async: true;
|
|
489
|
+
/**
|
|
490
|
+
* The Standard Schema properties.
|
|
491
|
+
*
|
|
492
|
+
* @internal
|
|
493
|
+
*/
|
|
494
|
+
readonly "~standard": StandardProps<InferInput<TSchema>, InferOutput<TSchema>>;
|
|
495
|
+
/**
|
|
496
|
+
* Parses unknown input values.
|
|
497
|
+
*
|
|
498
|
+
* @param dataset The input dataset.
|
|
499
|
+
* @param config The configuration.
|
|
500
|
+
*
|
|
501
|
+
* @returns The output dataset.
|
|
502
|
+
*
|
|
503
|
+
* @internal
|
|
504
|
+
*/
|
|
505
|
+
readonly "~run": (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<InferOutput<TSchema>, InferIssue<TSchema>>>;
|
|
506
|
+
};
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region src/methods/pipe/pipe.d.ts
|
|
509
|
+
/**
|
|
510
|
+
* Schema with pipe type.
|
|
511
|
+
*/
|
|
512
|
+
type SchemaWithPipe<TPipe$1 extends readonly [BaseSchema<unknown, unknown, BaseIssue<unknown>>, ...PipeItem<any, unknown, BaseIssue<unknown>>[]]> = Omit<FirstTupleItem<TPipe$1>, "pipe" | "~standard" | "~run" | "~types"> & {
|
|
513
|
+
/**
|
|
514
|
+
* The pipe items.
|
|
515
|
+
*/
|
|
516
|
+
readonly pipe: TPipe$1;
|
|
517
|
+
/**
|
|
518
|
+
* The Standard Schema properties.
|
|
519
|
+
*
|
|
520
|
+
* @internal
|
|
521
|
+
*/
|
|
522
|
+
readonly "~standard": StandardProps<InferInput<FirstTupleItem<TPipe$1>>, InferOutput<LastTupleItem<TPipe$1>>>;
|
|
523
|
+
/**
|
|
524
|
+
* Parses unknown input values.
|
|
525
|
+
*
|
|
526
|
+
* @param dataset The input dataset.
|
|
527
|
+
* @param config The configuration.
|
|
528
|
+
*
|
|
529
|
+
* @returns The output dataset.
|
|
530
|
+
*
|
|
531
|
+
* @internal
|
|
532
|
+
*/
|
|
533
|
+
readonly "~run": (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => OutputDataset<InferOutput<LastTupleItem<TPipe$1>>, InferIssue<TPipe$1[number]>>;
|
|
534
|
+
/**
|
|
535
|
+
* The input, output and issue type.
|
|
536
|
+
*
|
|
537
|
+
* @internal
|
|
538
|
+
*/
|
|
539
|
+
readonly "~types"?: {
|
|
540
|
+
readonly input: InferInput<FirstTupleItem<TPipe$1>>;
|
|
541
|
+
readonly output: InferOutput<LastTupleItem<TPipe$1>>;
|
|
542
|
+
readonly issue: InferIssue<TPipe$1[number]>;
|
|
543
|
+
} | undefined;
|
|
544
|
+
};
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/types/metadata.d.ts
|
|
547
|
+
/**
|
|
548
|
+
* Base metadata interface.
|
|
549
|
+
*/
|
|
550
|
+
interface BaseMetadata<TInput$1> {
|
|
551
|
+
/**
|
|
552
|
+
* The object kind.
|
|
553
|
+
*/
|
|
554
|
+
readonly kind: "metadata";
|
|
555
|
+
/**
|
|
556
|
+
* The metadata type.
|
|
557
|
+
*/
|
|
558
|
+
readonly type: string;
|
|
559
|
+
/**
|
|
560
|
+
* The metadata reference.
|
|
561
|
+
*/
|
|
562
|
+
readonly reference: (...args: any[]) => BaseMetadata<any>;
|
|
563
|
+
/**
|
|
564
|
+
* The input, output and issue type.
|
|
565
|
+
*
|
|
566
|
+
* @internal
|
|
567
|
+
*/
|
|
568
|
+
readonly "~types"?: {
|
|
569
|
+
readonly input: TInput$1;
|
|
570
|
+
readonly output: TInput$1;
|
|
571
|
+
readonly issue: never;
|
|
572
|
+
} | undefined;
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/types/dataset.d.ts
|
|
576
|
+
/**
|
|
577
|
+
* Unknown dataset interface.
|
|
578
|
+
*/
|
|
579
|
+
interface UnknownDataset {
|
|
580
|
+
/**
|
|
581
|
+
* Whether is's typed.
|
|
582
|
+
*/
|
|
583
|
+
typed?: false;
|
|
584
|
+
/**
|
|
585
|
+
* The dataset value.
|
|
586
|
+
*/
|
|
587
|
+
value: unknown;
|
|
588
|
+
/**
|
|
589
|
+
* The dataset issues.
|
|
590
|
+
*/
|
|
591
|
+
issues?: undefined;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Success dataset interface.
|
|
595
|
+
*/
|
|
596
|
+
interface SuccessDataset<TValue$1> {
|
|
597
|
+
/**
|
|
598
|
+
* Whether is's typed.
|
|
599
|
+
*/
|
|
600
|
+
typed: true;
|
|
601
|
+
/**
|
|
602
|
+
* The dataset value.
|
|
603
|
+
*/
|
|
604
|
+
value: TValue$1;
|
|
605
|
+
/**
|
|
606
|
+
* The dataset issues.
|
|
607
|
+
*/
|
|
608
|
+
issues?: undefined;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Partial dataset interface.
|
|
612
|
+
*/
|
|
613
|
+
interface PartialDataset<TValue$1, TIssue extends BaseIssue<unknown>> {
|
|
614
|
+
/**
|
|
615
|
+
* Whether is's typed.
|
|
616
|
+
*/
|
|
617
|
+
typed: true;
|
|
618
|
+
/**
|
|
619
|
+
* The dataset value.
|
|
620
|
+
*/
|
|
621
|
+
value: TValue$1;
|
|
622
|
+
/**
|
|
623
|
+
* The dataset issues.
|
|
624
|
+
*/
|
|
625
|
+
issues: [TIssue, ...TIssue[]];
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Failure dataset interface.
|
|
629
|
+
*/
|
|
630
|
+
interface FailureDataset<TIssue extends BaseIssue<unknown>> {
|
|
631
|
+
/**
|
|
632
|
+
* Whether is's typed.
|
|
633
|
+
*/
|
|
634
|
+
typed: false;
|
|
635
|
+
/**
|
|
636
|
+
* The dataset value.
|
|
637
|
+
*/
|
|
638
|
+
value: unknown;
|
|
639
|
+
/**
|
|
640
|
+
* The dataset issues.
|
|
641
|
+
*/
|
|
642
|
+
issues: [TIssue, ...TIssue[]];
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Output dataset type.
|
|
646
|
+
*/
|
|
647
|
+
type OutputDataset<TValue$1, TIssue extends BaseIssue<unknown>> = SuccessDataset<TValue$1> | PartialDataset<TValue$1, TIssue> | FailureDataset<TIssue>;
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/types/standard.d.ts
|
|
650
|
+
/**
|
|
651
|
+
* The Standard Schema properties interface.
|
|
652
|
+
*/
|
|
653
|
+
interface StandardProps<TInput$1, TOutput$1> {
|
|
654
|
+
/**
|
|
655
|
+
* The version number of the standard.
|
|
656
|
+
*/
|
|
657
|
+
readonly version: 1;
|
|
658
|
+
/**
|
|
659
|
+
* The vendor name of the schema library.
|
|
660
|
+
*/
|
|
661
|
+
readonly vendor: "valibot";
|
|
662
|
+
/**
|
|
663
|
+
* Validates unknown input values.
|
|
664
|
+
*/
|
|
665
|
+
readonly validate: (value: unknown) => StandardResult<TOutput$1> | Promise<StandardResult<TOutput$1>>;
|
|
666
|
+
/**
|
|
667
|
+
* Inferred types associated with the schema.
|
|
668
|
+
*/
|
|
669
|
+
readonly types?: StandardTypes<TInput$1, TOutput$1> | undefined;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* The result interface of the validate function.
|
|
673
|
+
*/
|
|
674
|
+
type StandardResult<TOutput$1> = StandardSuccessResult<TOutput$1> | StandardFailureResult;
|
|
675
|
+
/**
|
|
676
|
+
* The result interface if validation succeeds.
|
|
677
|
+
*/
|
|
678
|
+
interface StandardSuccessResult<TOutput$1> {
|
|
679
|
+
/**
|
|
680
|
+
* The typed output value.
|
|
681
|
+
*/
|
|
682
|
+
readonly value: TOutput$1;
|
|
683
|
+
/**
|
|
684
|
+
* The non-existent issues.
|
|
685
|
+
*/
|
|
686
|
+
readonly issues?: undefined;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* The result interface if validation fails.
|
|
690
|
+
*/
|
|
691
|
+
interface StandardFailureResult {
|
|
692
|
+
/**
|
|
693
|
+
* The issues of failed validation.
|
|
694
|
+
*/
|
|
695
|
+
readonly issues: readonly StandardIssue[];
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* The issue interface of the failure output.
|
|
699
|
+
*/
|
|
700
|
+
interface StandardIssue {
|
|
701
|
+
/**
|
|
702
|
+
* The error message of the issue.
|
|
703
|
+
*/
|
|
704
|
+
readonly message: string;
|
|
705
|
+
/**
|
|
706
|
+
* The path of the issue, if any.
|
|
707
|
+
*/
|
|
708
|
+
readonly path?: readonly (PropertyKey | StandardPathItem)[] | undefined;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* The path item interface of the issue.
|
|
712
|
+
*/
|
|
713
|
+
interface StandardPathItem {
|
|
714
|
+
/**
|
|
715
|
+
* The key of the path item.
|
|
716
|
+
*/
|
|
717
|
+
readonly key: PropertyKey;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* The Standard Schema types interface.
|
|
721
|
+
*/
|
|
722
|
+
interface StandardTypes<TInput$1, TOutput$1> {
|
|
723
|
+
/**
|
|
724
|
+
* The input type of the schema.
|
|
725
|
+
*/
|
|
726
|
+
readonly input: TInput$1;
|
|
727
|
+
/**
|
|
728
|
+
* The output type of the schema.
|
|
729
|
+
*/
|
|
730
|
+
readonly output: TOutput$1;
|
|
731
|
+
}
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region src/types/schema.d.ts
|
|
734
|
+
/**
|
|
735
|
+
* Base schema interface.
|
|
736
|
+
*/
|
|
737
|
+
interface BaseSchema<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
|
|
738
|
+
/**
|
|
739
|
+
* The object kind.
|
|
740
|
+
*/
|
|
741
|
+
readonly kind: "schema";
|
|
742
|
+
/**
|
|
743
|
+
* The schema type.
|
|
744
|
+
*/
|
|
745
|
+
readonly type: string;
|
|
746
|
+
/**
|
|
747
|
+
* The schema reference.
|
|
748
|
+
*/
|
|
749
|
+
readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>>;
|
|
750
|
+
/**
|
|
751
|
+
* The expected property.
|
|
752
|
+
*/
|
|
753
|
+
readonly expects: string;
|
|
754
|
+
/**
|
|
755
|
+
* Whether it's async.
|
|
756
|
+
*/
|
|
757
|
+
readonly async: false;
|
|
758
|
+
/**
|
|
759
|
+
* The Standard Schema properties.
|
|
760
|
+
*
|
|
761
|
+
* @internal
|
|
762
|
+
*/
|
|
763
|
+
readonly "~standard": StandardProps<TInput$1, TOutput$1>;
|
|
764
|
+
/**
|
|
765
|
+
* Parses unknown input values.
|
|
766
|
+
*
|
|
767
|
+
* @param dataset The input dataset.
|
|
768
|
+
* @param config The configuration.
|
|
769
|
+
*
|
|
770
|
+
* @returns The output dataset.
|
|
771
|
+
*
|
|
772
|
+
* @internal
|
|
773
|
+
*/
|
|
774
|
+
readonly "~run": (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, TIssue>;
|
|
775
|
+
/**
|
|
776
|
+
* The input, output and issue type.
|
|
777
|
+
*
|
|
778
|
+
* @internal
|
|
779
|
+
*/
|
|
780
|
+
readonly "~types"?: {
|
|
781
|
+
readonly input: TInput$1;
|
|
782
|
+
readonly output: TOutput$1;
|
|
783
|
+
readonly issue: TIssue;
|
|
784
|
+
} | undefined;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Base schema async interface.
|
|
788
|
+
*/
|
|
789
|
+
interface BaseSchemaAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseSchema<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
790
|
+
/**
|
|
791
|
+
* The schema reference.
|
|
792
|
+
*/
|
|
793
|
+
readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
|
|
794
|
+
/**
|
|
795
|
+
* Whether it's async.
|
|
796
|
+
*/
|
|
797
|
+
readonly async: true;
|
|
798
|
+
/**
|
|
799
|
+
* Parses unknown input values.
|
|
800
|
+
*
|
|
801
|
+
* @param dataset The input dataset.
|
|
802
|
+
* @param config The configuration.
|
|
803
|
+
*
|
|
804
|
+
* @returns The output dataset.
|
|
805
|
+
*
|
|
806
|
+
* @internal
|
|
807
|
+
*/
|
|
808
|
+
readonly "~run": (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, TIssue>>;
|
|
809
|
+
}
|
|
810
|
+
//#endregion
|
|
811
|
+
//#region src/types/transformation.d.ts
|
|
812
|
+
/**
|
|
813
|
+
* Base transformation interface.
|
|
814
|
+
*/
|
|
815
|
+
interface BaseTransformation<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
|
|
816
|
+
/**
|
|
817
|
+
* The object kind.
|
|
818
|
+
*/
|
|
819
|
+
readonly kind: "transformation";
|
|
820
|
+
/**
|
|
821
|
+
* The transformation type.
|
|
822
|
+
*/
|
|
823
|
+
readonly type: string;
|
|
824
|
+
/**
|
|
825
|
+
* The transformation reference.
|
|
826
|
+
*/
|
|
827
|
+
readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>>;
|
|
828
|
+
/**
|
|
829
|
+
* Whether it's async.
|
|
830
|
+
*/
|
|
831
|
+
readonly async: false;
|
|
832
|
+
/**
|
|
833
|
+
* Transforms known input values.
|
|
834
|
+
*
|
|
835
|
+
* @param dataset The input dataset.
|
|
836
|
+
* @param config The configuration.
|
|
837
|
+
*
|
|
838
|
+
* @returns The output dataset.
|
|
839
|
+
*
|
|
840
|
+
* @internal
|
|
841
|
+
*/
|
|
842
|
+
readonly "~run": (dataset: SuccessDataset<TInput$1>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>;
|
|
843
|
+
/**
|
|
844
|
+
* The input, output and issue type.
|
|
845
|
+
*
|
|
846
|
+
* @internal
|
|
847
|
+
*/
|
|
848
|
+
readonly "~types"?: {
|
|
849
|
+
readonly input: TInput$1;
|
|
850
|
+
readonly output: TOutput$1;
|
|
851
|
+
readonly issue: TIssue;
|
|
852
|
+
} | undefined;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Base transformation async interface.
|
|
856
|
+
*/
|
|
857
|
+
interface BaseTransformationAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseTransformation<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
858
|
+
/**
|
|
859
|
+
* The transformation reference.
|
|
860
|
+
*/
|
|
861
|
+
readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>> | BaseTransformationAsync<any, any, BaseIssue<unknown>>;
|
|
862
|
+
/**
|
|
863
|
+
* Whether it's async.
|
|
864
|
+
*/
|
|
865
|
+
readonly async: true;
|
|
866
|
+
/**
|
|
867
|
+
* Transforms known input values.
|
|
868
|
+
*
|
|
869
|
+
* @param dataset The input dataset.
|
|
870
|
+
* @param config The configuration.
|
|
871
|
+
*
|
|
872
|
+
* @returns The output dataset.
|
|
873
|
+
*
|
|
874
|
+
* @internal
|
|
875
|
+
*/
|
|
876
|
+
readonly "~run": (dataset: SuccessDataset<TInput$1>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>>;
|
|
877
|
+
}
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/types/validation.d.ts
|
|
880
|
+
/**
|
|
881
|
+
* Base validation interface.
|
|
882
|
+
*/
|
|
883
|
+
interface BaseValidation<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
|
|
884
|
+
/**
|
|
885
|
+
* The object kind.
|
|
886
|
+
*/
|
|
887
|
+
readonly kind: "validation";
|
|
888
|
+
/**
|
|
889
|
+
* The validation type.
|
|
890
|
+
*/
|
|
891
|
+
readonly type: string;
|
|
892
|
+
/**
|
|
893
|
+
* The validation reference.
|
|
894
|
+
*/
|
|
895
|
+
readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>>;
|
|
896
|
+
/**
|
|
897
|
+
* The expected property.
|
|
898
|
+
*/
|
|
899
|
+
readonly expects: string | null;
|
|
900
|
+
/**
|
|
901
|
+
* Whether it's async.
|
|
902
|
+
*/
|
|
903
|
+
readonly async: false;
|
|
904
|
+
/**
|
|
905
|
+
* Validates known input values.
|
|
906
|
+
*
|
|
907
|
+
* @param dataset The input dataset.
|
|
908
|
+
* @param config The configuration.
|
|
909
|
+
*
|
|
910
|
+
* @returns The output dataset.
|
|
911
|
+
*
|
|
912
|
+
* @internal
|
|
913
|
+
*/
|
|
914
|
+
readonly "~run": (dataset: OutputDataset<TInput$1, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>;
|
|
915
|
+
/**
|
|
916
|
+
* The input, output and issue type.
|
|
917
|
+
*
|
|
918
|
+
* @internal
|
|
919
|
+
*/
|
|
920
|
+
readonly "~types"?: {
|
|
921
|
+
readonly input: TInput$1;
|
|
922
|
+
readonly output: TOutput$1;
|
|
923
|
+
readonly issue: TIssue;
|
|
924
|
+
} | undefined;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Base validation async interface.
|
|
928
|
+
*/
|
|
929
|
+
interface BaseValidationAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseValidation<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
930
|
+
/**
|
|
931
|
+
* The validation reference.
|
|
932
|
+
*/
|
|
933
|
+
readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>> | BaseValidationAsync<any, any, BaseIssue<unknown>>;
|
|
934
|
+
/**
|
|
935
|
+
* Whether it's async.
|
|
936
|
+
*/
|
|
937
|
+
readonly async: true;
|
|
938
|
+
/**
|
|
939
|
+
* Validates known input values.
|
|
940
|
+
*
|
|
941
|
+
* @param dataset The input dataset.
|
|
942
|
+
* @param config The configuration.
|
|
943
|
+
*
|
|
944
|
+
* @returns The output dataset.
|
|
945
|
+
*
|
|
946
|
+
* @internal
|
|
947
|
+
*/
|
|
948
|
+
readonly "~run": (dataset: OutputDataset<TInput$1, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>>;
|
|
949
|
+
}
|
|
950
|
+
//#endregion
|
|
951
|
+
//#region src/types/infer.d.ts
|
|
952
|
+
/**
|
|
953
|
+
* Infer input type.
|
|
954
|
+
*/
|
|
955
|
+
type InferInput<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem$1["~types"]>["input"];
|
|
956
|
+
/**
|
|
957
|
+
* Infer output type.
|
|
958
|
+
*/
|
|
959
|
+
type InferOutput<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem$1["~types"]>["output"];
|
|
960
|
+
/**
|
|
961
|
+
* Infer issue type.
|
|
962
|
+
*/
|
|
963
|
+
type InferIssue<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem$1["~types"]>["issue"];
|
|
964
|
+
/**
|
|
965
|
+
* Constructs a type that is maybe readonly.
|
|
966
|
+
*/
|
|
967
|
+
type MaybeReadonly<TValue$1> = TValue$1 | Readonly<TValue$1>;
|
|
968
|
+
/**
|
|
969
|
+
* Constructs a type that is deeply readonly.
|
|
970
|
+
*/
|
|
971
|
+
type DeepReadonly<TValue$1> = TValue$1 extends Record<string, unknown> | readonly unknown[] ? { readonly [TKey in keyof TValue$1]: DeepReadonly<TValue$1[TKey]>; } : TValue$1;
|
|
972
|
+
/**
|
|
973
|
+
* Constructs a type that is maybe deeply readonly.
|
|
974
|
+
*/
|
|
975
|
+
type MaybeDeepReadonly<TValue$1> = TValue$1 | DeepReadonly<TValue$1>;
|
|
976
|
+
/**
|
|
977
|
+
* Constructs a type that is maybe a promise.
|
|
978
|
+
*/
|
|
979
|
+
type MaybePromise<TValue$1> = TValue$1 | Promise<TValue$1>;
|
|
980
|
+
/**
|
|
981
|
+
* Prettifies a type for better readability.
|
|
982
|
+
*
|
|
983
|
+
* Hint: This type has no effect and is only used so that TypeScript displays
|
|
984
|
+
* the final type in the preview instead of the utility types used.
|
|
985
|
+
*/
|
|
986
|
+
type Prettify<TObject> = { [TKey in keyof TObject]: TObject[TKey]; } & {};
|
|
987
|
+
/**
|
|
988
|
+
* Marks specific keys as optional.
|
|
989
|
+
*/
|
|
990
|
+
type MarkOptional<TObject, TKeys extends keyof TObject> = { [TKey in keyof TObject]?: unknown; } & Omit<TObject, TKeys> & Partial<Pick<TObject, TKeys>>;
|
|
991
|
+
/**
|
|
992
|
+
* Extracts first tuple item.
|
|
993
|
+
*/
|
|
994
|
+
type FirstTupleItem<TTuple extends readonly [unknown, ...unknown[]]> = TTuple[0];
|
|
995
|
+
/**
|
|
996
|
+
* Extracts last tuple item.
|
|
997
|
+
*/
|
|
998
|
+
type LastTupleItem<TTuple extends readonly [unknown, ...unknown[]]> = TTuple[TTuple extends readonly [unknown, ...infer TRest] ? TRest["length"] : never];
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/types/other.d.ts
|
|
1001
|
+
/**
|
|
1002
|
+
* Error message type.
|
|
1003
|
+
*/
|
|
1004
|
+
type ErrorMessage<TIssue extends BaseIssue<unknown>> = ((issue: TIssue) => string) | string;
|
|
1005
|
+
/**
|
|
1006
|
+
* Default type.
|
|
1007
|
+
*/
|
|
1008
|
+
type Default<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TInput$1 extends null | undefined> = MaybeDeepReadonly<InferInput<TWrapped$1> | TInput$1> | ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped$1>>) => MaybeDeepReadonly<InferInput<TWrapped$1> | TInput$1>) | undefined;
|
|
1009
|
+
/**
|
|
1010
|
+
* Default async type.
|
|
1011
|
+
*/
|
|
1012
|
+
type DefaultAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TInput$1 extends null | undefined> = MaybeDeepReadonly<InferInput<TWrapped$1> | TInput$1> | ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped$1>>) => MaybePromise<MaybeDeepReadonly<InferInput<TWrapped$1> | TInput$1>>) | undefined;
|
|
1013
|
+
/**
|
|
1014
|
+
* Default value type.
|
|
1015
|
+
*/
|
|
1016
|
+
type DefaultValue<TDefault extends Default<BaseSchema<unknown, unknown, BaseIssue<unknown>>, null | undefined> | DefaultAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, null | undefined>> = TDefault extends DefaultAsync<infer TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, infer TInput> ? TDefault extends ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped>>) => MaybePromise<MaybeDeepReadonly<InferInput<TWrapped> | TInput>>) ? Awaited<ReturnType<TDefault>> : TDefault : never;
|
|
1017
|
+
//#endregion
|
|
1018
|
+
//#region src/types/object.d.ts
|
|
1019
|
+
/**
|
|
1020
|
+
* Optional entry schema type.
|
|
1021
|
+
*/
|
|
1022
|
+
type OptionalEntrySchema = ExactOptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | NullishSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Optional entry schema async type.
|
|
1025
|
+
*/
|
|
1026
|
+
type OptionalEntrySchemaAsync = ExactOptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | NullishSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Object entries interface.
|
|
1029
|
+
*/
|
|
1030
|
+
interface ObjectEntries {
|
|
1031
|
+
[key: string]: BaseSchema<unknown, unknown, BaseIssue<unknown>> | SchemaWithFallback<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalEntrySchema;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Object entries async interface.
|
|
1035
|
+
*/
|
|
1036
|
+
interface ObjectEntriesAsync {
|
|
1037
|
+
[key: string]: BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | SchemaWithFallback<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | SchemaWithFallbackAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalEntrySchema | OptionalEntrySchemaAsync;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Infer entries input type.
|
|
1041
|
+
*/
|
|
1042
|
+
type InferEntriesInput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { -readonly [TKey in keyof TEntries$1]: InferInput<TEntries$1[TKey]>; };
|
|
1043
|
+
/**
|
|
1044
|
+
* Infer entries output type.
|
|
1045
|
+
*/
|
|
1046
|
+
type InferEntriesOutput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { -readonly [TKey in keyof TEntries$1]: InferOutput<TEntries$1[TKey]>; };
|
|
1047
|
+
/**
|
|
1048
|
+
* Optional input keys type.
|
|
1049
|
+
*/
|
|
1050
|
+
type OptionalInputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? TKey : never; }[keyof TEntries$1];
|
|
1051
|
+
/**
|
|
1052
|
+
* Optional output keys type.
|
|
1053
|
+
*/
|
|
1054
|
+
type OptionalOutputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? undefined extends TEntries$1[TKey]["default"] ? TKey : never : never; }[keyof TEntries$1];
|
|
1055
|
+
/**
|
|
1056
|
+
* Input with question marks type.
|
|
1057
|
+
*/
|
|
1058
|
+
type InputWithQuestionMarks<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesInput<TEntries$1>> = MarkOptional<TObject, OptionalInputKeys<TEntries$1>>;
|
|
1059
|
+
/**
|
|
1060
|
+
* Output with question marks type.
|
|
1061
|
+
*/
|
|
1062
|
+
type OutputWithQuestionMarks<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesOutput<TEntries$1>> = MarkOptional<TObject, OptionalOutputKeys<TEntries$1>>;
|
|
1063
|
+
/**
|
|
1064
|
+
* Readonly output keys type.
|
|
1065
|
+
*/
|
|
1066
|
+
type ReadonlyOutputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends {
|
|
1067
|
+
readonly pipe: readonly unknown[];
|
|
1068
|
+
} ? ReadonlyAction<any> extends TEntries$1[TKey]["pipe"][number] ? TKey : never : never; }[keyof TEntries$1];
|
|
1069
|
+
/**
|
|
1070
|
+
* Output with readonly type.
|
|
1071
|
+
*/
|
|
1072
|
+
type OutputWithReadonly<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>> = ReadonlyOutputKeys<TEntries$1> extends never ? TObject : Readonly<TObject> & Pick<TObject, Exclude<keyof TObject, ReadonlyOutputKeys<TEntries$1>>>;
|
|
1073
|
+
/**
|
|
1074
|
+
* Infer object input type.
|
|
1075
|
+
*/
|
|
1076
|
+
type InferObjectInput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify<InputWithQuestionMarks<TEntries$1, InferEntriesInput<TEntries$1>>>;
|
|
1077
|
+
/**
|
|
1078
|
+
* Infer object output type.
|
|
1079
|
+
*/
|
|
1080
|
+
type InferObjectOutput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify<OutputWithReadonly<TEntries$1, OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>>>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Infer object issue type.
|
|
1083
|
+
*/
|
|
1084
|
+
type InferObjectIssue<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = InferIssue<TEntries$1[keyof TEntries$1]>;
|
|
1085
|
+
//#endregion
|
|
1086
|
+
//#region src/types/issue.d.ts
|
|
1087
|
+
/**
|
|
1088
|
+
* Array path item interface.
|
|
1089
|
+
*/
|
|
1090
|
+
interface ArrayPathItem {
|
|
1091
|
+
/**
|
|
1092
|
+
* The path item type.
|
|
1093
|
+
*/
|
|
1094
|
+
readonly type: "array";
|
|
1095
|
+
/**
|
|
1096
|
+
* The path item origin.
|
|
1097
|
+
*/
|
|
1098
|
+
readonly origin: "value";
|
|
1099
|
+
/**
|
|
1100
|
+
* The path item input.
|
|
1101
|
+
*/
|
|
1102
|
+
readonly input: MaybeReadonly<unknown[]>;
|
|
1103
|
+
/**
|
|
1104
|
+
* The path item key.
|
|
1105
|
+
*/
|
|
1106
|
+
readonly key: number;
|
|
1107
|
+
/**
|
|
1108
|
+
* The path item value.
|
|
1109
|
+
*/
|
|
1110
|
+
readonly value: unknown;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Map path item interface.
|
|
1114
|
+
*/
|
|
1115
|
+
interface MapPathItem {
|
|
1116
|
+
/**
|
|
1117
|
+
* The path item type.
|
|
1118
|
+
*/
|
|
1119
|
+
readonly type: "map";
|
|
1120
|
+
/**
|
|
1121
|
+
* The path item origin.
|
|
1122
|
+
*/
|
|
1123
|
+
readonly origin: "key" | "value";
|
|
1124
|
+
/**
|
|
1125
|
+
* The path item input.
|
|
1126
|
+
*/
|
|
1127
|
+
readonly input: Map<unknown, unknown>;
|
|
1128
|
+
/**
|
|
1129
|
+
* The path item key.
|
|
1130
|
+
*/
|
|
1131
|
+
readonly key: unknown;
|
|
1132
|
+
/**
|
|
1133
|
+
* The path item value.
|
|
1134
|
+
*/
|
|
1135
|
+
readonly value: unknown;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Object path item interface.
|
|
1139
|
+
*/
|
|
1140
|
+
interface ObjectPathItem {
|
|
1141
|
+
/**
|
|
1142
|
+
* The path item type.
|
|
1143
|
+
*/
|
|
1144
|
+
readonly type: "object";
|
|
1145
|
+
/**
|
|
1146
|
+
* The path item origin.
|
|
1147
|
+
*/
|
|
1148
|
+
readonly origin: "key" | "value";
|
|
1149
|
+
/**
|
|
1150
|
+
* The path item input.
|
|
1151
|
+
*/
|
|
1152
|
+
readonly input: Record<string, unknown>;
|
|
1153
|
+
/**
|
|
1154
|
+
* The path item key.
|
|
1155
|
+
*/
|
|
1156
|
+
readonly key: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* The path item value.
|
|
1159
|
+
*/
|
|
1160
|
+
readonly value: unknown;
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Set path item interface.
|
|
1164
|
+
*/
|
|
1165
|
+
interface SetPathItem {
|
|
1166
|
+
/**
|
|
1167
|
+
* The path item type.
|
|
1168
|
+
*/
|
|
1169
|
+
readonly type: "set";
|
|
1170
|
+
/**
|
|
1171
|
+
* The path item origin.
|
|
1172
|
+
*/
|
|
1173
|
+
readonly origin: "value";
|
|
1174
|
+
/**
|
|
1175
|
+
* The path item input.
|
|
1176
|
+
*/
|
|
1177
|
+
readonly input: Set<unknown>;
|
|
1178
|
+
/**
|
|
1179
|
+
* The path item key.
|
|
1180
|
+
*/
|
|
1181
|
+
readonly key: null;
|
|
1182
|
+
/**
|
|
1183
|
+
* The path item key.
|
|
1184
|
+
*/
|
|
1185
|
+
readonly value: unknown;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Unknown path item interface.
|
|
1189
|
+
*/
|
|
1190
|
+
interface UnknownPathItem {
|
|
1191
|
+
/**
|
|
1192
|
+
* The path item type.
|
|
1193
|
+
*/
|
|
1194
|
+
readonly type: "unknown";
|
|
1195
|
+
/**
|
|
1196
|
+
* The path item origin.
|
|
1197
|
+
*/
|
|
1198
|
+
readonly origin: "key" | "value";
|
|
1199
|
+
/**
|
|
1200
|
+
* The path item input.
|
|
1201
|
+
*/
|
|
1202
|
+
readonly input: unknown;
|
|
1203
|
+
/**
|
|
1204
|
+
* The path item key.
|
|
1205
|
+
*/
|
|
1206
|
+
readonly key: unknown;
|
|
1207
|
+
/**
|
|
1208
|
+
* The path item value.
|
|
1209
|
+
*/
|
|
1210
|
+
readonly value: unknown;
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Issue path item type.
|
|
1214
|
+
*/
|
|
1215
|
+
type IssuePathItem = ArrayPathItem | MapPathItem | ObjectPathItem | SetPathItem | UnknownPathItem;
|
|
1216
|
+
/**
|
|
1217
|
+
* Base issue interface.
|
|
1218
|
+
*/
|
|
1219
|
+
interface BaseIssue<TInput$1> extends Config<BaseIssue<TInput$1>> {
|
|
1220
|
+
/**
|
|
1221
|
+
* The issue kind.
|
|
1222
|
+
*/
|
|
1223
|
+
readonly kind: "schema" | "validation" | "transformation";
|
|
1224
|
+
/**
|
|
1225
|
+
* The issue type.
|
|
1226
|
+
*/
|
|
1227
|
+
readonly type: string;
|
|
1228
|
+
/**
|
|
1229
|
+
* The raw input data.
|
|
1230
|
+
*/
|
|
1231
|
+
readonly input: TInput$1;
|
|
1232
|
+
/**
|
|
1233
|
+
* The expected property.
|
|
1234
|
+
*/
|
|
1235
|
+
readonly expected: string | null;
|
|
1236
|
+
/**
|
|
1237
|
+
* The received property.
|
|
1238
|
+
*/
|
|
1239
|
+
readonly received: string;
|
|
1240
|
+
/**
|
|
1241
|
+
* The error message.
|
|
1242
|
+
*/
|
|
1243
|
+
readonly message: string;
|
|
1244
|
+
/**
|
|
1245
|
+
* The input requirement.
|
|
1246
|
+
*/
|
|
1247
|
+
readonly requirement?: unknown | undefined;
|
|
1248
|
+
/**
|
|
1249
|
+
* The issue path.
|
|
1250
|
+
*/
|
|
1251
|
+
readonly path?: [IssuePathItem, ...IssuePathItem[]] | undefined;
|
|
1252
|
+
/**
|
|
1253
|
+
* The sub issues.
|
|
1254
|
+
*/
|
|
1255
|
+
readonly issues?: [BaseIssue<TInput$1>, ...BaseIssue<TInput$1>[]] | undefined;
|
|
1256
|
+
}
|
|
1257
|
+
//#endregion
|
|
1258
|
+
//#region src/types/config.d.ts
|
|
1259
|
+
/**
|
|
1260
|
+
* Config interface.
|
|
1261
|
+
*/
|
|
1262
|
+
interface Config<TIssue extends BaseIssue<unknown>> {
|
|
1263
|
+
/**
|
|
1264
|
+
* The selected language.
|
|
1265
|
+
*/
|
|
1266
|
+
readonly lang?: string | undefined;
|
|
1267
|
+
/**
|
|
1268
|
+
* The error message.
|
|
1269
|
+
*/
|
|
1270
|
+
readonly message?: ErrorMessage<TIssue> | undefined;
|
|
1271
|
+
/**
|
|
1272
|
+
* Whether it should be aborted early.
|
|
1273
|
+
*/
|
|
1274
|
+
readonly abortEarly?: boolean | undefined;
|
|
1275
|
+
/**
|
|
1276
|
+
* Whether a pipe should be aborted early.
|
|
1277
|
+
*/
|
|
1278
|
+
readonly abortPipeEarly?: boolean | undefined;
|
|
1279
|
+
}
|
|
1280
|
+
//#endregion
|
|
1281
|
+
//#region src/types/pipe.d.ts
|
|
1282
|
+
/**
|
|
1283
|
+
* Pipe action type.
|
|
1284
|
+
*/
|
|
1285
|
+
type PipeAction<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseValidation<TInput$1, TOutput$1, TIssue> | BaseTransformation<TInput$1, TOutput$1, TIssue> | BaseMetadata<TInput$1>;
|
|
1286
|
+
/**
|
|
1287
|
+
* Pipe item type.
|
|
1288
|
+
*/
|
|
1289
|
+
type PipeItem<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseSchema<TInput$1, TOutput$1, TIssue> | PipeAction<TInput$1, TOutput$1, TIssue>;
|
|
1290
|
+
//#endregion
|
|
1291
|
+
//#region src/schemas/array/types.d.ts
|
|
1292
|
+
/**
|
|
1293
|
+
* Array issue interface.
|
|
1294
|
+
*/
|
|
1295
|
+
interface ArrayIssue extends BaseIssue<unknown> {
|
|
1296
|
+
/**
|
|
1297
|
+
* The issue kind.
|
|
1298
|
+
*/
|
|
1299
|
+
readonly kind: "schema";
|
|
1300
|
+
/**
|
|
1301
|
+
* The issue type.
|
|
1302
|
+
*/
|
|
1303
|
+
readonly type: "array";
|
|
1304
|
+
/**
|
|
1305
|
+
* The expected property.
|
|
1306
|
+
*/
|
|
1307
|
+
readonly expected: "Array";
|
|
1308
|
+
}
|
|
1309
|
+
//#endregion
|
|
1310
|
+
//#region src/schemas/array/array.d.ts
|
|
1311
|
+
/**
|
|
1312
|
+
* Array schema interface.
|
|
1313
|
+
*/
|
|
1314
|
+
interface ArraySchema<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<ArrayIssue> | undefined> extends BaseSchema<InferInput<TItem$1>[], InferOutput<TItem$1>[], ArrayIssue | InferIssue<TItem$1>> {
|
|
1315
|
+
/**
|
|
1316
|
+
* The schema type.
|
|
1317
|
+
*/
|
|
1318
|
+
readonly type: "array";
|
|
1319
|
+
/**
|
|
1320
|
+
* The schema reference.
|
|
1321
|
+
*/
|
|
1322
|
+
readonly reference: typeof array;
|
|
1323
|
+
/**
|
|
1324
|
+
* The expected property.
|
|
1325
|
+
*/
|
|
1326
|
+
readonly expects: "Array";
|
|
1327
|
+
/**
|
|
1328
|
+
* The array item schema.
|
|
1329
|
+
*/
|
|
1330
|
+
readonly item: TItem$1;
|
|
1331
|
+
/**
|
|
1332
|
+
* The error message.
|
|
1333
|
+
*/
|
|
1334
|
+
readonly message: TMessage;
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Creates an array schema.
|
|
1338
|
+
*
|
|
1339
|
+
* @param item The item schema.
|
|
1340
|
+
*
|
|
1341
|
+
* @returns An array schema.
|
|
1342
|
+
*/
|
|
1343
|
+
declare function array<const TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(item: TItem$1): ArraySchema<TItem$1, undefined>;
|
|
1344
|
+
/**
|
|
1345
|
+
* Creates an array schema.
|
|
1346
|
+
*
|
|
1347
|
+
* @param item The item schema.
|
|
1348
|
+
* @param message The error message.
|
|
1349
|
+
*
|
|
1350
|
+
* @returns An array schema.
|
|
1351
|
+
*/
|
|
1352
|
+
declare function array<const TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<ArrayIssue> | undefined>(item: TItem$1, message: TMessage): ArraySchema<TItem$1, TMessage>;
|
|
1353
|
+
//#endregion
|
|
1354
|
+
//#region src/schemas/boolean/boolean.d.ts
|
|
1355
|
+
/**
|
|
1356
|
+
* Boolean issue interface.
|
|
1357
|
+
*/
|
|
1358
|
+
interface BooleanIssue extends BaseIssue<unknown> {
|
|
1359
|
+
/**
|
|
1360
|
+
* The issue kind.
|
|
1361
|
+
*/
|
|
1362
|
+
readonly kind: "schema";
|
|
1363
|
+
/**
|
|
1364
|
+
* The issue type.
|
|
1365
|
+
*/
|
|
1366
|
+
readonly type: "boolean";
|
|
1367
|
+
/**
|
|
1368
|
+
* The expected property.
|
|
1369
|
+
*/
|
|
1370
|
+
readonly expected: "boolean";
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Boolean schema interface.
|
|
1374
|
+
*/
|
|
1375
|
+
interface BooleanSchema<TMessage extends ErrorMessage<BooleanIssue> | undefined> extends BaseSchema<boolean, boolean, BooleanIssue> {
|
|
1376
|
+
/**
|
|
1377
|
+
* The schema type.
|
|
1378
|
+
*/
|
|
1379
|
+
readonly type: "boolean";
|
|
1380
|
+
/**
|
|
1381
|
+
* The schema reference.
|
|
1382
|
+
*/
|
|
1383
|
+
readonly reference: typeof boolean;
|
|
1384
|
+
/**
|
|
1385
|
+
* The expected property.
|
|
1386
|
+
*/
|
|
1387
|
+
readonly expects: "boolean";
|
|
1388
|
+
/**
|
|
1389
|
+
* The error message.
|
|
1390
|
+
*/
|
|
1391
|
+
readonly message: TMessage;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Creates a boolean schema.
|
|
1395
|
+
*
|
|
1396
|
+
* @returns A boolean schema.
|
|
1397
|
+
*/
|
|
1398
|
+
declare function boolean(): BooleanSchema<undefined>;
|
|
1399
|
+
/**
|
|
1400
|
+
* Creates a boolean schema.
|
|
1401
|
+
*
|
|
1402
|
+
* @param message The error message.
|
|
1403
|
+
*
|
|
1404
|
+
* @returns A boolean schema.
|
|
1405
|
+
*/
|
|
1406
|
+
declare function boolean<const TMessage extends ErrorMessage<BooleanIssue> | undefined>(message: TMessage): BooleanSchema<TMessage>;
|
|
1407
|
+
//#endregion
|
|
1408
|
+
//#region src/schemas/exactOptional/exactOptional.d.ts
|
|
1409
|
+
/**
|
|
1410
|
+
* Exact optional schema interface.
|
|
1411
|
+
*/
|
|
1412
|
+
interface ExactOptionalSchema<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped$1, never>> extends BaseSchema<InferInput<TWrapped$1>, InferOutput<TWrapped$1>, InferIssue<TWrapped$1>> {
|
|
1413
|
+
/**
|
|
1414
|
+
* The schema type.
|
|
1415
|
+
*/
|
|
1416
|
+
readonly type: "exact_optional";
|
|
1417
|
+
/**
|
|
1418
|
+
* The schema reference.
|
|
1419
|
+
*/
|
|
1420
|
+
readonly reference: typeof exactOptional;
|
|
1421
|
+
/**
|
|
1422
|
+
* The expected property.
|
|
1423
|
+
*/
|
|
1424
|
+
readonly expects: TWrapped$1["expects"];
|
|
1425
|
+
/**
|
|
1426
|
+
* The wrapped schema.
|
|
1427
|
+
*/
|
|
1428
|
+
readonly wrapped: TWrapped$1;
|
|
1429
|
+
/**
|
|
1430
|
+
* The default value.
|
|
1431
|
+
*/
|
|
1432
|
+
readonly default: TDefault;
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Creates an exact optional schema.
|
|
1436
|
+
*
|
|
1437
|
+
* @param wrapped The wrapped schema.
|
|
1438
|
+
*
|
|
1439
|
+
* @returns An exact optional schema.
|
|
1440
|
+
*/
|
|
1441
|
+
declare function exactOptional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): ExactOptionalSchema<TWrapped$1, undefined>;
|
|
1442
|
+
/**
|
|
1443
|
+
* Creates an exact optional schema.
|
|
1444
|
+
*
|
|
1445
|
+
* @param wrapped The wrapped schema.
|
|
1446
|
+
* @param default_ The default value.
|
|
1447
|
+
*
|
|
1448
|
+
* @returns An exact optional schema.
|
|
1449
|
+
*/
|
|
1450
|
+
declare function exactOptional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped$1, never>>(wrapped: TWrapped$1, default_: TDefault): ExactOptionalSchema<TWrapped$1, TDefault>;
|
|
1451
|
+
//#endregion
|
|
1452
|
+
//#region src/schemas/exactOptional/exactOptionalAsync.d.ts
|
|
1453
|
+
/**
|
|
1454
|
+
* Exact optional schema async interface.
|
|
1455
|
+
*/
|
|
1456
|
+
interface ExactOptionalSchemaAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, never>> extends BaseSchemaAsync<InferInput<TWrapped$1>, InferOutput<TWrapped$1>, InferIssue<TWrapped$1>> {
|
|
1457
|
+
/**
|
|
1458
|
+
* The schema type.
|
|
1459
|
+
*/
|
|
1460
|
+
readonly type: "exact_optional";
|
|
1461
|
+
/**
|
|
1462
|
+
* The schema reference.
|
|
1463
|
+
*/
|
|
1464
|
+
readonly reference: typeof exactOptional | typeof exactOptionalAsync;
|
|
1465
|
+
/**
|
|
1466
|
+
* The expected property.
|
|
1467
|
+
*/
|
|
1468
|
+
readonly expects: TWrapped$1["expects"];
|
|
1469
|
+
/**
|
|
1470
|
+
* The wrapped schema.
|
|
1471
|
+
*/
|
|
1472
|
+
readonly wrapped: TWrapped$1;
|
|
1473
|
+
/**
|
|
1474
|
+
* The default value.
|
|
1475
|
+
*/
|
|
1476
|
+
readonly default: TDefault;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Creates an exact optional schema.
|
|
1480
|
+
*
|
|
1481
|
+
* @param wrapped The wrapped schema.
|
|
1482
|
+
*
|
|
1483
|
+
* @returns An exact optional schema.
|
|
1484
|
+
*/
|
|
1485
|
+
declare function exactOptionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): ExactOptionalSchemaAsync<TWrapped$1, undefined>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Creates an exact optional schema.
|
|
1488
|
+
*
|
|
1489
|
+
* @param wrapped The wrapped schema.
|
|
1490
|
+
* @param default_ The default value.
|
|
1491
|
+
*
|
|
1492
|
+
* @returns An exact optional schema.
|
|
1493
|
+
*/
|
|
1494
|
+
declare function exactOptionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped$1, never>>(wrapped: TWrapped$1, default_: TDefault): ExactOptionalSchemaAsync<TWrapped$1, TDefault>;
|
|
1495
|
+
//#endregion
|
|
1496
|
+
//#region src/schemas/nullish/types.d.ts
|
|
1497
|
+
/**
|
|
1498
|
+
* Infer nullish output type.
|
|
1499
|
+
*/
|
|
1500
|
+
type InferNullishOutput<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, null | undefined>> = undefined extends TDefault ? InferOutput<TWrapped$1> | null | undefined : InferOutput<TWrapped$1> | Extract<DefaultValue<TDefault>, null | undefined>;
|
|
1501
|
+
//#endregion
|
|
1502
|
+
//#region src/schemas/nullish/nullish.d.ts
|
|
1503
|
+
/**
|
|
1504
|
+
* Nullish schema interface.
|
|
1505
|
+
*/
|
|
1506
|
+
interface NullishSchema<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped$1, null | undefined>> extends BaseSchema<InferInput<TWrapped$1> | null | undefined, InferNullishOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
|
|
1507
|
+
/**
|
|
1508
|
+
* The schema type.
|
|
1509
|
+
*/
|
|
1510
|
+
readonly type: "nullish";
|
|
1511
|
+
/**
|
|
1512
|
+
* The schema reference.
|
|
1513
|
+
*/
|
|
1514
|
+
readonly reference: typeof nullish;
|
|
1515
|
+
/**
|
|
1516
|
+
* The expected property.
|
|
1517
|
+
*/
|
|
1518
|
+
readonly expects: `(${TWrapped$1["expects"]} | null | undefined)`;
|
|
1519
|
+
/**
|
|
1520
|
+
* The wrapped schema.
|
|
1521
|
+
*/
|
|
1522
|
+
readonly wrapped: TWrapped$1;
|
|
1523
|
+
/**
|
|
1524
|
+
* The default value.
|
|
1525
|
+
*/
|
|
1526
|
+
readonly default: TDefault;
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Creates a nullish schema.
|
|
1530
|
+
*
|
|
1531
|
+
* @param wrapped The wrapped schema.
|
|
1532
|
+
*
|
|
1533
|
+
* @returns A nullish schema.
|
|
1534
|
+
*/
|
|
1535
|
+
declare function nullish<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): NullishSchema<TWrapped$1, undefined>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Creates a nullish schema.
|
|
1538
|
+
*
|
|
1539
|
+
* @param wrapped The wrapped schema.
|
|
1540
|
+
* @param default_ The default value.
|
|
1541
|
+
*
|
|
1542
|
+
* @returns A nullish schema.
|
|
1543
|
+
*/
|
|
1544
|
+
declare function nullish<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped$1, null | undefined>>(wrapped: TWrapped$1, default_: TDefault): NullishSchema<TWrapped$1, TDefault>;
|
|
1545
|
+
//#endregion
|
|
1546
|
+
//#region src/schemas/nullish/nullishAsync.d.ts
|
|
1547
|
+
/**
|
|
1548
|
+
* Nullish schema async interface.
|
|
1549
|
+
*/
|
|
1550
|
+
interface NullishSchemaAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, null | undefined>> extends BaseSchemaAsync<InferInput<TWrapped$1> | null | undefined, InferNullishOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
|
|
1551
|
+
/**
|
|
1552
|
+
* The schema type.
|
|
1553
|
+
*/
|
|
1554
|
+
readonly type: "nullish";
|
|
1555
|
+
/**
|
|
1556
|
+
* The schema reference.
|
|
1557
|
+
*/
|
|
1558
|
+
readonly reference: typeof nullish | typeof nullishAsync;
|
|
1559
|
+
/**
|
|
1560
|
+
* The expected property.
|
|
1561
|
+
*/
|
|
1562
|
+
readonly expects: `(${TWrapped$1["expects"]} | null | undefined)`;
|
|
1563
|
+
/**
|
|
1564
|
+
* The wrapped schema.
|
|
1565
|
+
*/
|
|
1566
|
+
readonly wrapped: TWrapped$1;
|
|
1567
|
+
/**
|
|
1568
|
+
* The default value.
|
|
1569
|
+
*/
|
|
1570
|
+
readonly default: TDefault;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Creates a nullish schema.
|
|
1574
|
+
*
|
|
1575
|
+
* @param wrapped The wrapped schema.
|
|
1576
|
+
*
|
|
1577
|
+
* @returns A nullish schema.
|
|
1578
|
+
*/
|
|
1579
|
+
declare function nullishAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): NullishSchemaAsync<TWrapped$1, undefined>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Creates a nullish schema.
|
|
1582
|
+
*
|
|
1583
|
+
* @param wrapped The wrapped schema.
|
|
1584
|
+
* @param default_ The default value.
|
|
1585
|
+
*
|
|
1586
|
+
* @returns A nullish schema.
|
|
1587
|
+
*/
|
|
1588
|
+
declare function nullishAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped$1, null | undefined>>(wrapped: TWrapped$1, default_: TDefault): NullishSchemaAsync<TWrapped$1, TDefault>;
|
|
1589
|
+
//#endregion
|
|
1590
|
+
//#region src/schemas/number/number.d.ts
|
|
1591
|
+
/**
|
|
1592
|
+
* Number issue interface.
|
|
1593
|
+
*/
|
|
1594
|
+
interface NumberIssue extends BaseIssue<unknown> {
|
|
1595
|
+
/**
|
|
1596
|
+
* The issue kind.
|
|
1597
|
+
*/
|
|
1598
|
+
readonly kind: "schema";
|
|
1599
|
+
/**
|
|
1600
|
+
* The issue type.
|
|
1601
|
+
*/
|
|
1602
|
+
readonly type: "number";
|
|
1603
|
+
/**
|
|
1604
|
+
* The expected property.
|
|
1605
|
+
*/
|
|
1606
|
+
readonly expected: "number";
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Number schema interface.
|
|
1610
|
+
*/
|
|
1611
|
+
interface NumberSchema<TMessage extends ErrorMessage<NumberIssue> | undefined> extends BaseSchema<number, number, NumberIssue> {
|
|
1612
|
+
/**
|
|
1613
|
+
* The schema type.
|
|
1614
|
+
*/
|
|
1615
|
+
readonly type: "number";
|
|
1616
|
+
/**
|
|
1617
|
+
* The schema reference.
|
|
1618
|
+
*/
|
|
1619
|
+
readonly reference: typeof number;
|
|
1620
|
+
/**
|
|
1621
|
+
* The expected property.
|
|
1622
|
+
*/
|
|
1623
|
+
readonly expects: "number";
|
|
1624
|
+
/**
|
|
1625
|
+
* The error message.
|
|
1626
|
+
*/
|
|
1627
|
+
readonly message: TMessage;
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Creates a number schema.
|
|
1631
|
+
*
|
|
1632
|
+
* @returns A number schema.
|
|
1633
|
+
*/
|
|
1634
|
+
declare function number(): NumberSchema<undefined>;
|
|
1635
|
+
/**
|
|
1636
|
+
* Creates a number schema.
|
|
1637
|
+
*
|
|
1638
|
+
* @param message The error message.
|
|
1639
|
+
*
|
|
1640
|
+
* @returns A number schema.
|
|
1641
|
+
*/
|
|
1642
|
+
declare function number<const TMessage extends ErrorMessage<NumberIssue> | undefined>(message: TMessage): NumberSchema<TMessage>;
|
|
1643
|
+
//#endregion
|
|
1644
|
+
//#region src/schemas/object/types.d.ts
|
|
1645
|
+
/**
|
|
1646
|
+
* Object issue interface.
|
|
1647
|
+
*/
|
|
1648
|
+
interface ObjectIssue extends BaseIssue<unknown> {
|
|
1649
|
+
/**
|
|
1650
|
+
* The issue kind.
|
|
1651
|
+
*/
|
|
1652
|
+
readonly kind: "schema";
|
|
1653
|
+
/**
|
|
1654
|
+
* The issue type.
|
|
1655
|
+
*/
|
|
1656
|
+
readonly type: "object";
|
|
1657
|
+
/**
|
|
1658
|
+
* The expected property.
|
|
1659
|
+
*/
|
|
1660
|
+
readonly expected: "Object" | `"${string}"`;
|
|
1661
|
+
}
|
|
1662
|
+
//#endregion
|
|
1663
|
+
//#region src/schemas/object/object.d.ts
|
|
1664
|
+
/**
|
|
1665
|
+
* Object schema interface.
|
|
1666
|
+
*/
|
|
1667
|
+
interface ObjectSchema<TEntries$1 extends ObjectEntries, TMessage extends ErrorMessage<ObjectIssue> | undefined> extends BaseSchema<InferObjectInput<TEntries$1>, InferObjectOutput<TEntries$1>, ObjectIssue | InferObjectIssue<TEntries$1>> {
|
|
1668
|
+
/**
|
|
1669
|
+
* The schema type.
|
|
1670
|
+
*/
|
|
1671
|
+
readonly type: "object";
|
|
1672
|
+
/**
|
|
1673
|
+
* The schema reference.
|
|
1674
|
+
*/
|
|
1675
|
+
readonly reference: typeof object;
|
|
1676
|
+
/**
|
|
1677
|
+
* The expected property.
|
|
1678
|
+
*/
|
|
1679
|
+
readonly expects: "Object";
|
|
1680
|
+
/**
|
|
1681
|
+
* The entries schema.
|
|
1682
|
+
*/
|
|
1683
|
+
readonly entries: TEntries$1;
|
|
1684
|
+
/**
|
|
1685
|
+
* The error message.
|
|
1686
|
+
*/
|
|
1687
|
+
readonly message: TMessage;
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Creates an object schema.
|
|
1691
|
+
*
|
|
1692
|
+
* Hint: This schema removes unknown entries. The output will only include the
|
|
1693
|
+
* entries you specify. To include unknown entries, use `looseObject`. To
|
|
1694
|
+
* return an issue for unknown entries, use `strictObject`. To include and
|
|
1695
|
+
* validate unknown entries, use `objectWithRest`.
|
|
1696
|
+
*
|
|
1697
|
+
* @param entries The entries schema.
|
|
1698
|
+
*
|
|
1699
|
+
* @returns An object schema.
|
|
1700
|
+
*/
|
|
1701
|
+
declare function object<const TEntries$1 extends ObjectEntries>(entries: TEntries$1): ObjectSchema<TEntries$1, undefined>;
|
|
1702
|
+
/**
|
|
1703
|
+
* Creates an object schema.
|
|
1704
|
+
*
|
|
1705
|
+
* Hint: This schema removes unknown entries. The output will only include the
|
|
1706
|
+
* entries you specify. To include unknown entries, use `looseObject`. To
|
|
1707
|
+
* return an issue for unknown entries, use `strictObject`. To include and
|
|
1708
|
+
* validate unknown entries, use `objectWithRest`.
|
|
1709
|
+
*
|
|
1710
|
+
* @param entries The entries schema.
|
|
1711
|
+
* @param message The error message.
|
|
1712
|
+
*
|
|
1713
|
+
* @returns An object schema.
|
|
1714
|
+
*/
|
|
1715
|
+
declare function object<const TEntries$1 extends ObjectEntries, const TMessage extends ErrorMessage<ObjectIssue> | undefined>(entries: TEntries$1, message: TMessage): ObjectSchema<TEntries$1, TMessage>;
|
|
1716
|
+
//#endregion
|
|
1717
|
+
//#region src/schemas/optional/types.d.ts
|
|
1718
|
+
/**
|
|
1719
|
+
* Infer optional output type.
|
|
1720
|
+
*/
|
|
1721
|
+
type InferOptionalOutput<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, undefined>> = undefined extends TDefault ? InferOutput<TWrapped$1> | undefined : InferOutput<TWrapped$1> | Extract<DefaultValue<TDefault>, undefined>;
|
|
1722
|
+
//#endregion
|
|
1723
|
+
//#region src/schemas/optional/optional.d.ts
|
|
1724
|
+
/**
|
|
1725
|
+
* Optional schema interface.
|
|
1726
|
+
*/
|
|
1727
|
+
interface OptionalSchema<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped$1, undefined>> extends BaseSchema<InferInput<TWrapped$1> | undefined, InferOptionalOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
|
|
1728
|
+
/**
|
|
1729
|
+
* The schema type.
|
|
1730
|
+
*/
|
|
1731
|
+
readonly type: "optional";
|
|
1732
|
+
/**
|
|
1733
|
+
* The schema reference.
|
|
1734
|
+
*/
|
|
1735
|
+
readonly reference: typeof optional;
|
|
1736
|
+
/**
|
|
1737
|
+
* The expected property.
|
|
1738
|
+
*/
|
|
1739
|
+
readonly expects: `(${TWrapped$1["expects"]} | undefined)`;
|
|
1740
|
+
/**
|
|
1741
|
+
* The wrapped schema.
|
|
1742
|
+
*/
|
|
1743
|
+
readonly wrapped: TWrapped$1;
|
|
1744
|
+
/**
|
|
1745
|
+
* The default value.
|
|
1746
|
+
*/
|
|
1747
|
+
readonly default: TDefault;
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Creates an optional schema.
|
|
1751
|
+
*
|
|
1752
|
+
* @param wrapped The wrapped schema.
|
|
1753
|
+
*
|
|
1754
|
+
* @returns An optional schema.
|
|
1755
|
+
*/
|
|
1756
|
+
declare function optional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): OptionalSchema<TWrapped$1, undefined>;
|
|
1757
|
+
/**
|
|
1758
|
+
* Creates an optional schema.
|
|
1759
|
+
*
|
|
1760
|
+
* @param wrapped The wrapped schema.
|
|
1761
|
+
* @param default_ The default value.
|
|
1762
|
+
*
|
|
1763
|
+
* @returns An optional schema.
|
|
1764
|
+
*/
|
|
1765
|
+
declare function optional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped$1, undefined>>(wrapped: TWrapped$1, default_: TDefault): OptionalSchema<TWrapped$1, TDefault>;
|
|
1766
|
+
//#endregion
|
|
1767
|
+
//#region src/schemas/optional/optionalAsync.d.ts
|
|
1768
|
+
/**
|
|
1769
|
+
* Optional schema async interface.
|
|
1770
|
+
*/
|
|
1771
|
+
interface OptionalSchemaAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, undefined>> extends BaseSchemaAsync<InferInput<TWrapped$1> | undefined, InferOptionalOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
|
|
1772
|
+
/**
|
|
1773
|
+
* The schema type.
|
|
1774
|
+
*/
|
|
1775
|
+
readonly type: "optional";
|
|
1776
|
+
/**
|
|
1777
|
+
* The schema reference.
|
|
1778
|
+
*/
|
|
1779
|
+
readonly reference: typeof optional | typeof optionalAsync;
|
|
1780
|
+
/**
|
|
1781
|
+
* The expected property.
|
|
1782
|
+
*/
|
|
1783
|
+
readonly expects: `(${TWrapped$1["expects"]} | undefined)`;
|
|
1784
|
+
/**
|
|
1785
|
+
* The wrapped schema.
|
|
1786
|
+
*/
|
|
1787
|
+
readonly wrapped: TWrapped$1;
|
|
1788
|
+
/**
|
|
1789
|
+
* The default value.
|
|
1790
|
+
*/
|
|
1791
|
+
readonly default: TDefault;
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Creates an optional schema.
|
|
1795
|
+
*
|
|
1796
|
+
* @param wrapped The wrapped schema.
|
|
1797
|
+
*
|
|
1798
|
+
* @returns An optional schema.
|
|
1799
|
+
*/
|
|
1800
|
+
declare function optionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): OptionalSchemaAsync<TWrapped$1, undefined>;
|
|
1801
|
+
/**
|
|
1802
|
+
* Creates an optional schema.
|
|
1803
|
+
*
|
|
1804
|
+
* @param wrapped The wrapped schema.
|
|
1805
|
+
* @param default_ The default value.
|
|
1806
|
+
*
|
|
1807
|
+
* @returns An optional schema.
|
|
1808
|
+
*/
|
|
1809
|
+
declare function optionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped$1, undefined>>(wrapped: TWrapped$1, default_: TDefault): OptionalSchemaAsync<TWrapped$1, TDefault>;
|
|
1810
|
+
//#endregion
|
|
1811
|
+
//#region src/schemas/string/string.d.ts
|
|
1812
|
+
/**
|
|
1813
|
+
* String issue interface.
|
|
1814
|
+
*/
|
|
1815
|
+
interface StringIssue extends BaseIssue<unknown> {
|
|
1816
|
+
/**
|
|
1817
|
+
* The issue kind.
|
|
1818
|
+
*/
|
|
1819
|
+
readonly kind: "schema";
|
|
1820
|
+
/**
|
|
1821
|
+
* The issue type.
|
|
1822
|
+
*/
|
|
1823
|
+
readonly type: "string";
|
|
1824
|
+
/**
|
|
1825
|
+
* The expected property.
|
|
1826
|
+
*/
|
|
1827
|
+
readonly expected: "string";
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* String schema interface.
|
|
1831
|
+
*/
|
|
1832
|
+
interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined> extends BaseSchema<string, string, StringIssue> {
|
|
1833
|
+
/**
|
|
1834
|
+
* The schema type.
|
|
1835
|
+
*/
|
|
1836
|
+
readonly type: "string";
|
|
1837
|
+
/**
|
|
1838
|
+
* The schema reference.
|
|
1839
|
+
*/
|
|
1840
|
+
readonly reference: typeof string;
|
|
1841
|
+
/**
|
|
1842
|
+
* The expected property.
|
|
1843
|
+
*/
|
|
1844
|
+
readonly expects: "string";
|
|
1845
|
+
/**
|
|
1846
|
+
* The error message.
|
|
1847
|
+
*/
|
|
1848
|
+
readonly message: TMessage;
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Creates a string schema.
|
|
1852
|
+
*
|
|
1853
|
+
* @returns A string schema.
|
|
1854
|
+
*/
|
|
1855
|
+
declare function string(): StringSchema<undefined>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Creates a string schema.
|
|
1858
|
+
*
|
|
1859
|
+
* @param message The error message.
|
|
1860
|
+
*
|
|
1861
|
+
* @returns A string schema.
|
|
1862
|
+
*/
|
|
1863
|
+
declare function string<const TMessage extends ErrorMessage<StringIssue> | undefined>(message: TMessage): StringSchema<TMessage>;
|
|
1864
|
+
/**
|
|
1865
|
+
* Value input type.
|
|
1866
|
+
*/
|
|
1867
|
+
type ValueInput = string | number | bigint | boolean | Date;
|
|
1868
|
+
//#endregion
|
|
1869
|
+
//#region src/actions/description/description.d.ts
|
|
1870
|
+
/**
|
|
1871
|
+
* Description action interface.
|
|
1872
|
+
*/
|
|
1873
|
+
interface DescriptionAction<TInput$1, TDescription extends string> extends BaseMetadata<TInput$1> {
|
|
1874
|
+
/**
|
|
1875
|
+
* The action type.
|
|
1876
|
+
*/
|
|
1877
|
+
readonly type: "description";
|
|
1878
|
+
/**
|
|
1879
|
+
* The action reference.
|
|
1880
|
+
*/
|
|
1881
|
+
readonly reference: typeof description;
|
|
1882
|
+
/**
|
|
1883
|
+
* The description text.
|
|
1884
|
+
*/
|
|
1885
|
+
readonly description: TDescription;
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* Creates a description metadata action.
|
|
1889
|
+
*
|
|
1890
|
+
* @param description_ The description text.
|
|
1891
|
+
*
|
|
1892
|
+
* @returns A description action.
|
|
1893
|
+
*/
|
|
1894
|
+
declare function description<TInput$1, TDescription extends string>(description_: TDescription): DescriptionAction<TInput$1, TDescription>;
|
|
1895
|
+
//#endregion
|
|
1896
|
+
//#region src/actions/integer/integer.d.ts
|
|
1897
|
+
/**
|
|
1898
|
+
* Integer issue interface.
|
|
1899
|
+
*/
|
|
1900
|
+
interface IntegerIssue<TInput$1 extends number> extends BaseIssue<TInput$1> {
|
|
1901
|
+
/**
|
|
1902
|
+
* The issue kind.
|
|
1903
|
+
*/
|
|
1904
|
+
readonly kind: "validation";
|
|
1905
|
+
/**
|
|
1906
|
+
* The issue type.
|
|
1907
|
+
*/
|
|
1908
|
+
readonly type: "integer";
|
|
1909
|
+
/**
|
|
1910
|
+
* The expected property.
|
|
1911
|
+
*/
|
|
1912
|
+
readonly expected: null;
|
|
1913
|
+
/**
|
|
1914
|
+
* The received property.
|
|
1915
|
+
*/
|
|
1916
|
+
readonly received: `${number}`;
|
|
1917
|
+
/**
|
|
1918
|
+
* The validation function.
|
|
1919
|
+
*/
|
|
1920
|
+
readonly requirement: (input: number) => boolean;
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Integer action interface.
|
|
1924
|
+
*/
|
|
1925
|
+
interface IntegerAction<TInput$1 extends number, TMessage extends ErrorMessage<IntegerIssue<TInput$1>> | undefined> extends BaseValidation<TInput$1, TInput$1, IntegerIssue<TInput$1>> {
|
|
1926
|
+
/**
|
|
1927
|
+
* The action type.
|
|
1928
|
+
*/
|
|
1929
|
+
readonly type: "integer";
|
|
1930
|
+
/**
|
|
1931
|
+
* The action reference.
|
|
1932
|
+
*/
|
|
1933
|
+
readonly reference: typeof integer;
|
|
1934
|
+
/**
|
|
1935
|
+
* The expected property.
|
|
1936
|
+
*/
|
|
1937
|
+
readonly expects: null;
|
|
1938
|
+
/**
|
|
1939
|
+
* The validation function.
|
|
1940
|
+
*/
|
|
1941
|
+
readonly requirement: (input: number) => boolean;
|
|
1942
|
+
/**
|
|
1943
|
+
* The error message.
|
|
1944
|
+
*/
|
|
1945
|
+
readonly message: TMessage;
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Creates an [integer](https://en.wikipedia.org/wiki/Integer) validation action.
|
|
1949
|
+
*
|
|
1950
|
+
* @returns An integer action.
|
|
1951
|
+
*/
|
|
1952
|
+
declare function integer<TInput$1 extends number>(): IntegerAction<TInput$1, undefined>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Creates an [integer](https://en.wikipedia.org/wiki/Integer) validation action.
|
|
1955
|
+
*
|
|
1956
|
+
* @param message The error message.
|
|
1957
|
+
*
|
|
1958
|
+
* @returns An integer action.
|
|
1959
|
+
*/
|
|
1960
|
+
declare function integer<TInput$1 extends number, const TMessage extends ErrorMessage<IntegerIssue<TInput$1>> | undefined>(message: TMessage): IntegerAction<TInput$1, TMessage>;
|
|
1961
|
+
//#endregion
|
|
1962
|
+
//#region src/actions/minValue/minValue.d.ts
|
|
1963
|
+
/**
|
|
1964
|
+
* Min value issue interface.
|
|
1965
|
+
*/
|
|
1966
|
+
interface MinValueIssue<TInput$1 extends ValueInput, TRequirement extends ValueInput> extends BaseIssue<TInput$1> {
|
|
1967
|
+
/**
|
|
1968
|
+
* The issue kind.
|
|
1969
|
+
*/
|
|
1970
|
+
readonly kind: "validation";
|
|
1971
|
+
/**
|
|
1972
|
+
* The issue type.
|
|
1973
|
+
*/
|
|
1974
|
+
readonly type: "min_value";
|
|
1975
|
+
/**
|
|
1976
|
+
* The expected property.
|
|
1977
|
+
*/
|
|
1978
|
+
readonly expected: `>=${string}`;
|
|
1979
|
+
/**
|
|
1980
|
+
* The minimum value.
|
|
1981
|
+
*/
|
|
1982
|
+
readonly requirement: TRequirement;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Min value action interface.
|
|
1986
|
+
*/
|
|
1987
|
+
interface MinValueAction<TInput$1 extends ValueInput, TRequirement extends TInput$1, TMessage extends ErrorMessage<MinValueIssue<TInput$1, TRequirement>> | undefined> extends BaseValidation<TInput$1, TInput$1, MinValueIssue<TInput$1, TRequirement>> {
|
|
1988
|
+
/**
|
|
1989
|
+
* The action type.
|
|
1990
|
+
*/
|
|
1991
|
+
readonly type: "min_value";
|
|
1992
|
+
/**
|
|
1993
|
+
* The action reference.
|
|
1994
|
+
*/
|
|
1995
|
+
readonly reference: typeof minValue;
|
|
1996
|
+
/**
|
|
1997
|
+
* The expected property.
|
|
1998
|
+
*/
|
|
1999
|
+
readonly expects: `>=${string}`;
|
|
2000
|
+
/**
|
|
2001
|
+
* The minimum value.
|
|
2002
|
+
*/
|
|
2003
|
+
readonly requirement: TRequirement;
|
|
2004
|
+
/**
|
|
2005
|
+
* The error message.
|
|
2006
|
+
*/
|
|
2007
|
+
readonly message: TMessage;
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Creates a min value validation action.
|
|
2011
|
+
*
|
|
2012
|
+
* @param requirement The minimum value.
|
|
2013
|
+
*
|
|
2014
|
+
* @returns A min value action.
|
|
2015
|
+
*/
|
|
2016
|
+
declare function minValue<TInput$1 extends ValueInput, const TRequirement extends TInput$1>(requirement: TRequirement): MinValueAction<TInput$1, TRequirement, undefined>;
|
|
2017
|
+
/**
|
|
2018
|
+
* Creates a min value validation action.
|
|
2019
|
+
*
|
|
2020
|
+
* @param requirement The minimum value.
|
|
2021
|
+
* @param message The error message.
|
|
2022
|
+
*
|
|
2023
|
+
* @returns A min value action.
|
|
2024
|
+
*/
|
|
2025
|
+
declare function minValue<TInput$1 extends ValueInput, const TRequirement extends TInput$1, const TMessage extends ErrorMessage<MinValueIssue<TInput$1, TRequirement>> | undefined>(requirement: TRequirement, message: TMessage): MinValueAction<TInput$1, TRequirement, TMessage>;
|
|
2026
|
+
//#endregion
|
|
2027
|
+
//#region src/actions/readonly/readonly.d.ts
|
|
2028
|
+
/**
|
|
2029
|
+
* Readonly output type.
|
|
2030
|
+
*/
|
|
2031
|
+
type ReadonlyOutput<TInput$1> = TInput$1 extends Map<infer TKey, infer TValue> ? ReadonlyMap<TKey, TValue> : TInput$1 extends Set<infer TValue> ? ReadonlySet<TValue> : Readonly<TInput$1>;
|
|
2032
|
+
/**
|
|
2033
|
+
* Readonly action interface.
|
|
2034
|
+
*/
|
|
2035
|
+
interface ReadonlyAction<TInput$1> extends BaseTransformation<TInput$1, ReadonlyOutput<TInput$1>, never> {
|
|
2036
|
+
/**
|
|
2037
|
+
* The action type.
|
|
2038
|
+
*/
|
|
2039
|
+
readonly type: "readonly";
|
|
2040
|
+
/**
|
|
2041
|
+
* The action reference.
|
|
2042
|
+
*/
|
|
2043
|
+
readonly reference: typeof readonly;
|
|
2044
|
+
}
|
|
2045
|
+
/**
|
|
2046
|
+
* Creates a readonly transformation action.
|
|
2047
|
+
*
|
|
2048
|
+
* @returns A readonly action.
|
|
2049
|
+
*/
|
|
2050
|
+
declare function readonly<TInput$1>(): ReadonlyAction<TInput$1>;
|
|
2051
|
+
//#endregion
|
|
158
2052
|
//#region src/rules/no-needless-helper/rule.d.ts
|
|
159
|
-
declare const needlessHelperResponseSchema:
|
|
160
|
-
readonly findings:
|
|
161
|
-
readonly helper:
|
|
162
|
-
readonly name:
|
|
163
|
-
readonly reason:
|
|
2053
|
+
declare const needlessHelperResponseSchema: ObjectSchema<{
|
|
2054
|
+
readonly findings: ArraySchema<ObjectSchema<{
|
|
2055
|
+
readonly helper: SchemaWithPipe<readonly [NumberSchema<undefined>, DescriptionAction<number, "The number shown beside the helper, exactly as given.">]>;
|
|
2056
|
+
readonly name: SchemaWithPipe<readonly [StringSchema<undefined>, DescriptionAction<string, "The helper's name, exactly as shown.">]>;
|
|
2057
|
+
readonly reason: SchemaWithPipe<readonly [StringSchema<undefined>, DescriptionAction<string, "At most twelve words, naming what the body already says.">]>;
|
|
164
2058
|
}, undefined>, undefined>;
|
|
165
2059
|
}, undefined>;
|
|
166
2060
|
/**
|
|
@@ -170,24 +2064,24 @@ declare const needlessHelperResponseSchema: import("valibot").ObjectSchema<{
|
|
|
170
2064
|
* should not exist. The deterministic half only finds candidates and gathers facts (usage
|
|
171
2065
|
* count, exported), which are given to the model rather than applied as filters.
|
|
172
2066
|
*/
|
|
173
|
-
declare const needlessHelperRule:
|
|
2067
|
+
declare const needlessHelperRule: RuleDefinition;
|
|
174
2068
|
//#endregion
|
|
175
2069
|
//#region src/rules/shared/settings.d.ts
|
|
176
|
-
declare const settingsSchema:
|
|
177
|
-
readonly cache:
|
|
2070
|
+
declare const settingsSchema: ObjectSchema<{
|
|
2071
|
+
readonly cache: OptionalSchema<BooleanSchema<undefined>, true>;
|
|
178
2072
|
/** Globs matched against the repository-relative file path. */
|
|
179
|
-
readonly ignores:
|
|
2073
|
+
readonly ignores: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, readonly []>;
|
|
180
2074
|
/**
|
|
181
2075
|
* When false, no model is called: `no-duplicated-helper` still reports what a fingerprint settles,
|
|
182
2076
|
* `no-needless-helper` reports nothing.
|
|
183
2077
|
*/
|
|
184
|
-
readonly judge:
|
|
185
|
-
readonly maxLines:
|
|
186
|
-
readonly minTokens:
|
|
2078
|
+
readonly judge: OptionalSchema<BooleanSchema<undefined>, true>;
|
|
2079
|
+
readonly maxLines: OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>, IntegerAction<number, undefined>, MinValueAction<number, 1, undefined>]>, 10>;
|
|
2080
|
+
readonly minTokens: OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>, IntegerAction<number, undefined>, MinValueAction<number, 1, undefined>]>, 5>;
|
|
187
2081
|
}, undefined>;
|
|
188
2082
|
type SimplicitySettings = InferOutput<typeof settingsSchema>;
|
|
189
2083
|
//#endregion
|
|
190
2084
|
//#region src/index.d.ts
|
|
191
|
-
declare const simplicityPlugin:
|
|
2085
|
+
declare const simplicityPlugin: PluginDefinition;
|
|
192
2086
|
//#endregion
|
|
193
2087
|
export { type AgentFinding, type CallSite, type DuplicateToolsOptions, type ExtractLanguage, type ExtractedFunction, type IndexedHelper, type RepoIndex, type RepoIndexOptions, type ReviewCache, type SimplicitySettings, type SourceExtract, alphaFingerprint, buildDuplicatedHelperPrompt, buildNeedlessHelperPrompt, createDuplicateTools, simplicityPlugin as default, simplicityPlugin, duplicatedHelperInstructions, duplicatedHelperRule, exactFingerprint, extractSource, helpersIn, needlessHelperPrompt, needlessHelperResponseSchema, needlessHelperRule, normalizedBody, repoIndexFor, resolveExtractLanguage, reviewCacheFor, tokenOverlap, tokenize, twinsOf };
|