@shopify/cli-kit 0.12.0 → 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index-17ec6a4a.js +60148 -0
- package/dist/index-17ec6a4a.js.map +1 -0
- package/dist/index.d.ts +3864 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -153
- package/dist/index.js.map +1 -0
- package/dist/multipart-parser-a3698ba7.js +468 -0
- package/dist/multipart-parser-a3698ba7.js.map +1 -0
- package/package.json +25 -16
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3864 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Writable } from 'node:stream';
|
|
3
|
+
import path$1 from 'path';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
import { RequestOptions } from 'http';
|
|
7
|
+
|
|
8
|
+
interface Question {
|
|
9
|
+
type: 'input' | 'select';
|
|
10
|
+
name: string;
|
|
11
|
+
message: string;
|
|
12
|
+
default?: string;
|
|
13
|
+
choices?: string[];
|
|
14
|
+
}
|
|
15
|
+
declare const prompt: <T>(questions: Question[]) => Promise<T>;
|
|
16
|
+
interface Task$1 {
|
|
17
|
+
title: string;
|
|
18
|
+
output: string;
|
|
19
|
+
}
|
|
20
|
+
interface Context {
|
|
21
|
+
}
|
|
22
|
+
interface ListTask {
|
|
23
|
+
title: string;
|
|
24
|
+
task: (ctx: Context, task: Task$1) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
interface ListOptions {
|
|
27
|
+
concurrent?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const list: (tasks: ListTask[], options?: ListOptions | undefined) => Promise<void>;
|
|
30
|
+
|
|
31
|
+
type ui_Question = Question;
|
|
32
|
+
declare const ui_prompt: typeof prompt;
|
|
33
|
+
type ui_Context = Context;
|
|
34
|
+
declare const ui_list: typeof list;
|
|
35
|
+
declare namespace ui {
|
|
36
|
+
export {
|
|
37
|
+
ui_Question as Question,
|
|
38
|
+
ui_prompt as prompt,
|
|
39
|
+
Task$1 as Task,
|
|
40
|
+
ui_Context as Context,
|
|
41
|
+
ui_list as list,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A fatal error represents an error shouldn't be rescued and that causes the execution to terminate.
|
|
47
|
+
* There shouldn't be code that catches fatal errors.
|
|
48
|
+
*/
|
|
49
|
+
declare class Fatal extends Error {
|
|
50
|
+
tryMessage: string | null;
|
|
51
|
+
constructor(message: string, tryMessage?: string | null);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* An abort error is a fatal error that shouldn't be reported as a bug.
|
|
55
|
+
* Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer
|
|
56
|
+
*/
|
|
57
|
+
declare class Abort extends Fatal {
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A bug error is an error that represents a bug and therefore should be reported.
|
|
61
|
+
*/
|
|
62
|
+
declare class Bug extends Fatal {
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A function that handles errors that blow up in the CLI.
|
|
66
|
+
* @param error Error to be handled.
|
|
67
|
+
* @returns A promise that resolves with the error passed.
|
|
68
|
+
*/
|
|
69
|
+
declare function handler(error: Error): Promise<Error>;
|
|
70
|
+
|
|
71
|
+
type error$1_Fatal = Fatal;
|
|
72
|
+
declare const error$1_Fatal: typeof Fatal;
|
|
73
|
+
type error$1_Abort = Abort;
|
|
74
|
+
declare const error$1_Abort: typeof Abort;
|
|
75
|
+
type error$1_Bug = Bug;
|
|
76
|
+
declare const error$1_Bug: typeof Bug;
|
|
77
|
+
declare const error$1_handler: typeof handler;
|
|
78
|
+
declare namespace error$1 {
|
|
79
|
+
export {
|
|
80
|
+
error$1_Fatal as Fatal,
|
|
81
|
+
error$1_Abort as Abort,
|
|
82
|
+
error$1_Bug as Bug,
|
|
83
|
+
error$1_handler as handler,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface ExecOptions {
|
|
88
|
+
cwd?: string;
|
|
89
|
+
stdout?: Writable;
|
|
90
|
+
stderr?: Writable;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Runs a command asynchronously, aggregates the stdout data, and returns it.
|
|
94
|
+
* @param command {string} Command to be executed.
|
|
95
|
+
* @param args {string[]} Arguments to pass to the command.
|
|
96
|
+
* @returns A promise that resolves with the aggregatted stdout of the command.
|
|
97
|
+
*/
|
|
98
|
+
declare const captureOutput: (command: string, args: string[]) => Promise<string>;
|
|
99
|
+
declare const exec: (command: string, args: string[], options?: ExecOptions | undefined) => Promise<void>;
|
|
100
|
+
|
|
101
|
+
type system_ExecOptions = ExecOptions;
|
|
102
|
+
declare const system_captureOutput: typeof captureOutput;
|
|
103
|
+
declare const system_exec: typeof exec;
|
|
104
|
+
declare namespace system {
|
|
105
|
+
export {
|
|
106
|
+
system_ExecOptions as ExecOptions,
|
|
107
|
+
system_captureOutput as captureOutput,
|
|
108
|
+
system_exec as exec,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare function template(templateContent: string): (data: object) => Promise<string>;
|
|
113
|
+
|
|
114
|
+
interface Options$4 {
|
|
115
|
+
splitRegexp?: RegExp | RegExp[];
|
|
116
|
+
stripRegexp?: RegExp | RegExp[];
|
|
117
|
+
delimiter?: string;
|
|
118
|
+
transform?: (part: string, index: number, parts: string[]) => string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare function camelCase(input: string, options?: Options$4): string;
|
|
122
|
+
|
|
123
|
+
declare function paramCase(input: string, options?: Options$4): string;
|
|
124
|
+
|
|
125
|
+
declare namespace string {
|
|
126
|
+
export {
|
|
127
|
+
camelCase as camelize,
|
|
128
|
+
paramCase as hyphenize,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare const sep = "/";
|
|
133
|
+
declare const delimiter = ":";
|
|
134
|
+
declare const normalize: typeof path$1.normalize;
|
|
135
|
+
declare const join: typeof path$1.join;
|
|
136
|
+
declare const resolve: typeof path$1.resolve;
|
|
137
|
+
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
|
|
138
|
+
declare const isAbsolute: typeof path$1.isAbsolute;
|
|
139
|
+
declare const toNamespacedPath: typeof path$1.toNamespacedPath;
|
|
140
|
+
declare const extname: typeof path$1.extname;
|
|
141
|
+
declare const relative: typeof path$1.relative;
|
|
142
|
+
declare const dirname: typeof path$1.dirname;
|
|
143
|
+
declare const format: typeof path$1.format;
|
|
144
|
+
declare const basename: typeof path$1.basename;
|
|
145
|
+
declare const parse$1: typeof path$1.parse;
|
|
146
|
+
|
|
147
|
+
interface Options$3 {
|
|
148
|
+
/**
|
|
149
|
+
The current working directory.
|
|
150
|
+
|
|
151
|
+
@default process.cwd()
|
|
152
|
+
*/
|
|
153
|
+
readonly cwd?: URL | string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
The type of path to match.
|
|
157
|
+
|
|
158
|
+
@default 'file'
|
|
159
|
+
*/
|
|
160
|
+
readonly type?: 'file' | 'directory';
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
Allow symbolic links to match if they point to the requested path type.
|
|
164
|
+
|
|
165
|
+
@default true
|
|
166
|
+
*/
|
|
167
|
+
readonly allowSymlinks?: boolean;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
|
|
175
|
+
*/
|
|
176
|
+
declare const findUpStop: unique symbol;
|
|
177
|
+
|
|
178
|
+
type Match = string | typeof findUpStop | undefined;
|
|
179
|
+
|
|
180
|
+
interface Options$2 extends Options$3 {
|
|
181
|
+
/**
|
|
182
|
+
The path to the directory to stop the search before reaching root if there were no matches before the `stopAt` directory.
|
|
183
|
+
|
|
184
|
+
@default path.parse(cwd).root
|
|
185
|
+
*/
|
|
186
|
+
readonly stopAt?: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
Find a file or directory by walking up parent directories.
|
|
191
|
+
|
|
192
|
+
@param name - The name of the file or directory to find. Can be multiple.
|
|
193
|
+
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
|
|
194
|
+
|
|
195
|
+
@example
|
|
196
|
+
```
|
|
197
|
+
// /
|
|
198
|
+
// └── Users
|
|
199
|
+
// └── sindresorhus
|
|
200
|
+
// ├── unicorn.png
|
|
201
|
+
// └── foo
|
|
202
|
+
// └── bar
|
|
203
|
+
// ├── baz
|
|
204
|
+
// └── example.js
|
|
205
|
+
|
|
206
|
+
// example.js
|
|
207
|
+
import {findUp} from 'find-up';
|
|
208
|
+
|
|
209
|
+
console.log(await findUp('unicorn.png'));
|
|
210
|
+
//=> '/Users/sindresorhus/unicorn.png'
|
|
211
|
+
|
|
212
|
+
console.log(await findUp(['rainbow.png', 'unicorn.png']));
|
|
213
|
+
//=> '/Users/sindresorhus/unicorn.png'
|
|
214
|
+
```
|
|
215
|
+
*/
|
|
216
|
+
declare function findUp(name: string | readonly string[], options?: Options$2): Promise<string | undefined>;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
Find a file or directory by walking up parent directories.
|
|
220
|
+
|
|
221
|
+
@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search.
|
|
222
|
+
@returns The first path found or `undefined` if none could be found.
|
|
223
|
+
|
|
224
|
+
@example
|
|
225
|
+
```
|
|
226
|
+
import path from 'node:path';
|
|
227
|
+
import {findUp, pathExists} from 'find-up';
|
|
228
|
+
|
|
229
|
+
console.log(await findUp(async directory => {
|
|
230
|
+
const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png'));
|
|
231
|
+
return hasUnicorns && directory;
|
|
232
|
+
}, {type: 'directory'}));
|
|
233
|
+
//=> '/Users/sindresorhus'
|
|
234
|
+
```
|
|
235
|
+
*/
|
|
236
|
+
declare function findUp(matcher: (directory: string) => (Match | Promise<Match>), options?: Options$2): Promise<string | undefined>;
|
|
237
|
+
|
|
238
|
+
declare type ErrnoException$1 = NodeJS.ErrnoException;
|
|
239
|
+
|
|
240
|
+
declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException$1 | null, stats: fs.Stats) => void) => void;
|
|
241
|
+
declare type StatSynchronousMethod = (path: string) => fs.Stats;
|
|
242
|
+
interface FileSystemAdapter$2 {
|
|
243
|
+
lstat: StatAsynchronousMethod;
|
|
244
|
+
stat: StatAsynchronousMethod;
|
|
245
|
+
lstatSync: StatSynchronousMethod;
|
|
246
|
+
statSync: StatSynchronousMethod;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface Entry$2 {
|
|
250
|
+
dirent: Dirent;
|
|
251
|
+
name: string;
|
|
252
|
+
path: string;
|
|
253
|
+
stats?: Stats;
|
|
254
|
+
}
|
|
255
|
+
declare type Stats = fs.Stats;
|
|
256
|
+
declare type ErrnoException = NodeJS.ErrnoException;
|
|
257
|
+
interface Dirent {
|
|
258
|
+
isBlockDevice: () => boolean;
|
|
259
|
+
isCharacterDevice: () => boolean;
|
|
260
|
+
isDirectory: () => boolean;
|
|
261
|
+
isFIFO: () => boolean;
|
|
262
|
+
isFile: () => boolean;
|
|
263
|
+
isSocket: () => boolean;
|
|
264
|
+
isSymbolicLink: () => boolean;
|
|
265
|
+
name: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface ReaddirAsynchronousMethod {
|
|
269
|
+
(filepath: string, options: {
|
|
270
|
+
withFileTypes: true;
|
|
271
|
+
}, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
|
|
272
|
+
(filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
|
|
273
|
+
}
|
|
274
|
+
interface ReaddirSynchronousMethod {
|
|
275
|
+
(filepath: string, options: {
|
|
276
|
+
withFileTypes: true;
|
|
277
|
+
}): Dirent[];
|
|
278
|
+
(filepath: string): string[];
|
|
279
|
+
}
|
|
280
|
+
declare type FileSystemAdapter$1 = FileSystemAdapter$2 & {
|
|
281
|
+
readdir: ReaddirAsynchronousMethod;
|
|
282
|
+
readdirSync: ReaddirSynchronousMethod;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
declare type Entry$1 = Entry$2;
|
|
286
|
+
|
|
287
|
+
declare type Entry = Entry$1;
|
|
288
|
+
declare type Pattern = string;
|
|
289
|
+
declare type FileSystemAdapter = FileSystemAdapter$1;
|
|
290
|
+
|
|
291
|
+
declare type Options$1 = {
|
|
292
|
+
/**
|
|
293
|
+
* Return the absolute path for entries.
|
|
294
|
+
*
|
|
295
|
+
* @default false
|
|
296
|
+
*/
|
|
297
|
+
absolute?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* If set to `true`, then patterns without slashes will be matched against
|
|
300
|
+
* the basename of the path if it contains slashes.
|
|
301
|
+
*
|
|
302
|
+
* @default false
|
|
303
|
+
*/
|
|
304
|
+
baseNameMatch?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Enables Bash-like brace expansion.
|
|
307
|
+
*
|
|
308
|
+
* @default true
|
|
309
|
+
*/
|
|
310
|
+
braceExpansion?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Enables a case-sensitive mode for matching files.
|
|
313
|
+
*
|
|
314
|
+
* @default true
|
|
315
|
+
*/
|
|
316
|
+
caseSensitiveMatch?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Specifies the maximum number of concurrent requests from a reader to read
|
|
319
|
+
* directories.
|
|
320
|
+
*
|
|
321
|
+
* @default os.cpus().length
|
|
322
|
+
*/
|
|
323
|
+
concurrency?: number;
|
|
324
|
+
/**
|
|
325
|
+
* The current working directory in which to search.
|
|
326
|
+
*
|
|
327
|
+
* @default process.cwd()
|
|
328
|
+
*/
|
|
329
|
+
cwd?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Specifies the maximum depth of a read directory relative to the start
|
|
332
|
+
* directory.
|
|
333
|
+
*
|
|
334
|
+
* @default Infinity
|
|
335
|
+
*/
|
|
336
|
+
deep?: number;
|
|
337
|
+
/**
|
|
338
|
+
* Allow patterns to match entries that begin with a period (`.`).
|
|
339
|
+
*
|
|
340
|
+
* @default false
|
|
341
|
+
*/
|
|
342
|
+
dot?: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Enables Bash-like `extglob` functionality.
|
|
345
|
+
*
|
|
346
|
+
* @default true
|
|
347
|
+
*/
|
|
348
|
+
extglob?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Indicates whether to traverse descendants of symbolic link directories.
|
|
351
|
+
*
|
|
352
|
+
* @default true
|
|
353
|
+
*/
|
|
354
|
+
followSymbolicLinks?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Custom implementation of methods for working with the file system.
|
|
357
|
+
*
|
|
358
|
+
* @default fs.*
|
|
359
|
+
*/
|
|
360
|
+
fs?: Partial<FileSystemAdapter>;
|
|
361
|
+
/**
|
|
362
|
+
* Enables recursively repeats a pattern containing `**`.
|
|
363
|
+
* If `false`, `**` behaves exactly like `*`.
|
|
364
|
+
*
|
|
365
|
+
* @default true
|
|
366
|
+
*/
|
|
367
|
+
globstar?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* An array of glob patterns to exclude matches.
|
|
370
|
+
* This is an alternative way to use negative patterns.
|
|
371
|
+
*
|
|
372
|
+
* @default []
|
|
373
|
+
*/
|
|
374
|
+
ignore?: Pattern[];
|
|
375
|
+
/**
|
|
376
|
+
* Mark the directory path with the final slash.
|
|
377
|
+
*
|
|
378
|
+
* @default false
|
|
379
|
+
*/
|
|
380
|
+
markDirectories?: boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Returns objects (instead of strings) describing entries.
|
|
383
|
+
*
|
|
384
|
+
* @default false
|
|
385
|
+
*/
|
|
386
|
+
objectMode?: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Return only directories.
|
|
389
|
+
*
|
|
390
|
+
* @default false
|
|
391
|
+
*/
|
|
392
|
+
onlyDirectories?: boolean;
|
|
393
|
+
/**
|
|
394
|
+
* Return only files.
|
|
395
|
+
*
|
|
396
|
+
* @default true
|
|
397
|
+
*/
|
|
398
|
+
onlyFiles?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Enables an object mode (`objectMode`) with an additional `stats` field.
|
|
401
|
+
*
|
|
402
|
+
* @default false
|
|
403
|
+
*/
|
|
404
|
+
stats?: boolean;
|
|
405
|
+
/**
|
|
406
|
+
* By default this package suppress only `ENOENT` errors.
|
|
407
|
+
* Set to `true` to suppress any error.
|
|
408
|
+
*
|
|
409
|
+
* @default false
|
|
410
|
+
*/
|
|
411
|
+
suppressErrors?: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Throw an error when symbolic link is broken if `true` or safely
|
|
414
|
+
* return `lstat` call if `false`.
|
|
415
|
+
*
|
|
416
|
+
* @default false
|
|
417
|
+
*/
|
|
418
|
+
throwErrorOnBrokenSymbolicLink?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Ensures that the returned entries are unique.
|
|
421
|
+
*
|
|
422
|
+
* @default true
|
|
423
|
+
*/
|
|
424
|
+
unique?: boolean;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
declare type Task = {
|
|
428
|
+
base: string;
|
|
429
|
+
dynamic: boolean;
|
|
430
|
+
patterns: Pattern[];
|
|
431
|
+
positive: Pattern[];
|
|
432
|
+
negative: Pattern[];
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
declare type EntryObjectModePredicate = {
|
|
436
|
+
[TKey in keyof Pick<Options$1, 'objectMode'>]-?: true;
|
|
437
|
+
};
|
|
438
|
+
declare type EntryStatsPredicate = {
|
|
439
|
+
[TKey in keyof Pick<Options$1, 'stats'>]-?: true;
|
|
440
|
+
};
|
|
441
|
+
declare type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
|
|
442
|
+
declare function FastGlob(source: Pattern | Pattern[], options: Options$1 & EntryObjectPredicate): Promise<Entry[]>;
|
|
443
|
+
declare function FastGlob(source: Pattern | Pattern[], options?: Options$1): Promise<string[]>;
|
|
444
|
+
declare namespace FastGlob {
|
|
445
|
+
type Options = Options$1;
|
|
446
|
+
type Entry = Entry;
|
|
447
|
+
type Task = Task;
|
|
448
|
+
type Pattern = Pattern;
|
|
449
|
+
type FileSystemAdapter = FileSystemAdapter;
|
|
450
|
+
function sync(source: Pattern | Pattern[], options: Options$1 & EntryObjectPredicate): Entry[];
|
|
451
|
+
function sync(source: Pattern | Pattern[], options?: Options$1): string[];
|
|
452
|
+
function stream(source: Pattern | Pattern[], options?: Options$1): NodeJS.ReadableStream;
|
|
453
|
+
function generateTasks(source: Pattern | Pattern[], options?: Options$1): Task[];
|
|
454
|
+
function isDynamicPattern(source: Pattern, options?: Options$1): boolean;
|
|
455
|
+
function escapePath(source: Pattern): Pattern;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare const path_findUp: typeof findUp;
|
|
459
|
+
declare const path_basename: typeof basename;
|
|
460
|
+
declare const path_delimiter: typeof delimiter;
|
|
461
|
+
declare const path_dirname: typeof dirname;
|
|
462
|
+
declare const path_extname: typeof extname;
|
|
463
|
+
declare const path_format: typeof format;
|
|
464
|
+
declare const path_isAbsolute: typeof isAbsolute;
|
|
465
|
+
declare const path_join: typeof join;
|
|
466
|
+
declare const path_normalize: typeof normalize;
|
|
467
|
+
declare const path_normalizeString: typeof normalizeString;
|
|
468
|
+
declare const path_relative: typeof relative;
|
|
469
|
+
declare const path_resolve: typeof resolve;
|
|
470
|
+
declare const path_sep: typeof sep;
|
|
471
|
+
declare const path_toNamespacedPath: typeof toNamespacedPath;
|
|
472
|
+
declare namespace path {
|
|
473
|
+
export {
|
|
474
|
+
path_findUp as findUp,
|
|
475
|
+
FastGlob as glob,
|
|
476
|
+
path_basename as basename,
|
|
477
|
+
path_delimiter as delimiter,
|
|
478
|
+
path_dirname as dirname,
|
|
479
|
+
path_extname as extname,
|
|
480
|
+
path_format as format,
|
|
481
|
+
path_isAbsolute as isAbsolute,
|
|
482
|
+
path_join as join,
|
|
483
|
+
path_normalize as normalize,
|
|
484
|
+
path_normalizeString as normalizeString,
|
|
485
|
+
parse$1 as parse,
|
|
486
|
+
path_relative as relative,
|
|
487
|
+
path_resolve as resolve,
|
|
488
|
+
path_sep as sep,
|
|
489
|
+
path_toNamespacedPath as toNamespacedPath,
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
declare function read(path: string): Promise<string>;
|
|
494
|
+
declare function write(path: string, data: string): Promise<void>;
|
|
495
|
+
declare function mkdir(path: string): Promise<void>;
|
|
496
|
+
declare function rmdir(path: string): Promise<void>;
|
|
497
|
+
declare function mkTmpDir(): Promise<string>;
|
|
498
|
+
declare function isDirectory(path: string): Promise<boolean>;
|
|
499
|
+
declare function exists(path: string): Promise<boolean>;
|
|
500
|
+
|
|
501
|
+
declare const file_read: typeof read;
|
|
502
|
+
declare const file_write: typeof write;
|
|
503
|
+
declare const file_mkdir: typeof mkdir;
|
|
504
|
+
declare const file_rmdir: typeof rmdir;
|
|
505
|
+
declare const file_mkTmpDir: typeof mkTmpDir;
|
|
506
|
+
declare const file_isDirectory: typeof isDirectory;
|
|
507
|
+
declare const file_exists: typeof exists;
|
|
508
|
+
declare namespace file {
|
|
509
|
+
export {
|
|
510
|
+
file_read as read,
|
|
511
|
+
file_write as write,
|
|
512
|
+
file_mkdir as mkdir,
|
|
513
|
+
file_rmdir as rmdir,
|
|
514
|
+
file_mkTmpDir as mkTmpDir,
|
|
515
|
+
file_isDirectory as isDirectory,
|
|
516
|
+
file_exists as exists,
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
declare enum ContentTokenType {
|
|
521
|
+
Command = 0,
|
|
522
|
+
Path = 1,
|
|
523
|
+
Link = 2
|
|
524
|
+
}
|
|
525
|
+
interface ContentMetadata {
|
|
526
|
+
link?: string;
|
|
527
|
+
}
|
|
528
|
+
declare class ContentToken {
|
|
529
|
+
type: ContentTokenType;
|
|
530
|
+
value: string;
|
|
531
|
+
metadata: ContentMetadata;
|
|
532
|
+
constructor(value: string, metadata: ContentMetadata | undefined, type: ContentTokenType);
|
|
533
|
+
}
|
|
534
|
+
declare const token: {
|
|
535
|
+
command: (value: string) => ContentToken;
|
|
536
|
+
path: (value: string) => ContentToken;
|
|
537
|
+
link: (value: string, link: string) => ContentToken;
|
|
538
|
+
};
|
|
539
|
+
declare class TokenizedString {
|
|
540
|
+
value: string;
|
|
541
|
+
constructor(value: string);
|
|
542
|
+
}
|
|
543
|
+
declare type Message = string | TokenizedString;
|
|
544
|
+
declare function content(strings: TemplateStringsArray, ...keys: (ContentToken | string)[]): TokenizedString;
|
|
545
|
+
declare const success: (content: Message) => void;
|
|
546
|
+
declare const message: (content: Message) => void;
|
|
547
|
+
declare const error: (content: Message) => void;
|
|
548
|
+
declare const warning: (content: Message) => void;
|
|
549
|
+
|
|
550
|
+
declare const output$1_token: typeof token;
|
|
551
|
+
declare const output$1_content: typeof content;
|
|
552
|
+
declare const output$1_success: typeof success;
|
|
553
|
+
declare const output$1_message: typeof message;
|
|
554
|
+
declare const output$1_error: typeof error;
|
|
555
|
+
declare const output$1_warning: typeof warning;
|
|
556
|
+
declare namespace output$1 {
|
|
557
|
+
export {
|
|
558
|
+
output$1_token as token,
|
|
559
|
+
output$1_content as content,
|
|
560
|
+
output$1_success as success,
|
|
561
|
+
output$1_message as message,
|
|
562
|
+
output$1_error as error,
|
|
563
|
+
output$1_warning as warning,
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
declare enum DependencyManager {
|
|
568
|
+
Npm = "npm",
|
|
569
|
+
Yarn = "yarn",
|
|
570
|
+
Pnpm = "pnpm"
|
|
571
|
+
}
|
|
572
|
+
declare const dependencyManager: string[];
|
|
573
|
+
/**
|
|
574
|
+
* Returns the dependency manager used to run the create workflow.
|
|
575
|
+
* @param env {Object} The environment variables of the process in which the CLI runs.
|
|
576
|
+
* @returns The dependency manager
|
|
577
|
+
*/
|
|
578
|
+
declare function dependencyManagerUsedForCreating(env?: NodeJS.ProcessEnv): DependencyManager;
|
|
579
|
+
/**
|
|
580
|
+
* Installs the dependencies in the given directory.
|
|
581
|
+
* @param directory {string} The directory that contains the package.json
|
|
582
|
+
* @param dependencyManager {DependencyManager} The dependency manager to use to install the dependencies.
|
|
583
|
+
* @returns
|
|
584
|
+
*/
|
|
585
|
+
declare function install(directory: string, dependencyManager: DependencyManager, stdout?: Writable): Promise<void>;
|
|
586
|
+
|
|
587
|
+
type dependency_DependencyManager = DependencyManager;
|
|
588
|
+
declare const dependency_DependencyManager: typeof DependencyManager;
|
|
589
|
+
declare const dependency_dependencyManager: typeof dependencyManager;
|
|
590
|
+
declare const dependency_dependencyManagerUsedForCreating: typeof dependencyManagerUsedForCreating;
|
|
591
|
+
declare const dependency_install: typeof install;
|
|
592
|
+
declare namespace dependency {
|
|
593
|
+
export {
|
|
594
|
+
dependency_DependencyManager as DependencyManager,
|
|
595
|
+
dependency_dependencyManager as dependencyManager,
|
|
596
|
+
dependency_dependencyManagerUsedForCreating as dependencyManagerUsedForCreating,
|
|
597
|
+
dependency_install as install,
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Returns the latest available version of an NPM package.
|
|
603
|
+
* @param name {string} The name of the NPM package.
|
|
604
|
+
* @returns A promise to get the latest available version of a package.
|
|
605
|
+
*/
|
|
606
|
+
declare function latestNpmPackageVersion(name: string): Promise<string>;
|
|
607
|
+
|
|
608
|
+
declare const version_latestNpmPackageVersion: typeof latestNpmPackageVersion;
|
|
609
|
+
declare namespace version {
|
|
610
|
+
export {
|
|
611
|
+
version_latestNpmPackageVersion as latestNpmPackageVersion,
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
declare const username: () => Promise<string | null>;
|
|
616
|
+
|
|
617
|
+
declare const os_username: typeof username;
|
|
618
|
+
declare namespace os {
|
|
619
|
+
export {
|
|
620
|
+
os_username as username,
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Returns true if the CLI is running in debug mode.
|
|
626
|
+
* @param env The environment variables from the environment of the current process.
|
|
627
|
+
* @returns true if SHOPIFY_CONFIG is debug
|
|
628
|
+
*/
|
|
629
|
+
declare function isDebug(env?: NodeJS.ProcessEnv): boolean;
|
|
630
|
+
/**
|
|
631
|
+
* Returns true if the environment in which the CLI is running is either
|
|
632
|
+
* a local environment (where dev is present) or a cloud environment (spin).
|
|
633
|
+
* @returns {boolean} True if the CLI is used in a Shopify environment.
|
|
634
|
+
*/
|
|
635
|
+
declare function isShopify(env?: NodeJS.ProcessEnv): Promise<boolean>;
|
|
636
|
+
|
|
637
|
+
declare const local_isDebug: typeof isDebug;
|
|
638
|
+
declare const local_isShopify: typeof isShopify;
|
|
639
|
+
declare namespace local {
|
|
640
|
+
export {
|
|
641
|
+
local_isDebug as isDebug,
|
|
642
|
+
local_isShopify as isShopify,
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Enum that represents the environment to use for a given service.
|
|
648
|
+
* @readonly
|
|
649
|
+
* @enum {number}
|
|
650
|
+
*/
|
|
651
|
+
declare enum Environment {
|
|
652
|
+
Local = "local",
|
|
653
|
+
Production = "production",
|
|
654
|
+
Spin = "spin"
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Returns the environment to be used for the interactions with the partners' CLI API.
|
|
659
|
+
* @param env The environment variables from the environment of the current process.
|
|
660
|
+
*/
|
|
661
|
+
declare function partners$1(env?: NodeJS.ProcessEnv): Environment;
|
|
662
|
+
/**
|
|
663
|
+
* Returns the environment to be used for the interactions with the admin API.
|
|
664
|
+
* @param env The environment variables from the environment of the current process.
|
|
665
|
+
*/
|
|
666
|
+
declare function shopify$1(env?: NodeJS.ProcessEnv): Environment;
|
|
667
|
+
/**
|
|
668
|
+
* Returns the environment to be used for the interactions with identity.
|
|
669
|
+
* @param env The environment variables from the environment of the current process.
|
|
670
|
+
*/
|
|
671
|
+
declare function identity$1(env?: NodeJS.ProcessEnv): Environment;
|
|
672
|
+
|
|
673
|
+
declare namespace service {
|
|
674
|
+
export {
|
|
675
|
+
partners$1 as partners,
|
|
676
|
+
shopify$1 as shopify,
|
|
677
|
+
identity$1 as identity,
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
declare const CouldntObtainPartnersSpinFQDNError: Abort;
|
|
682
|
+
declare const CouldntObtainIdentitySpinFQDNError: Abort;
|
|
683
|
+
declare const CouldntObtainShopifySpinFQDNError: Abort;
|
|
684
|
+
declare const NotProvidedStoreFQDNError: Abort;
|
|
685
|
+
/**
|
|
686
|
+
* It returns the Partners' API service we should interact with.
|
|
687
|
+
* @returns {string} Fully-qualified domain of the partners service we should interact with.
|
|
688
|
+
*/
|
|
689
|
+
declare function partners(): Promise<string>;
|
|
690
|
+
/**
|
|
691
|
+
* It returns the Identity service we should interact with.
|
|
692
|
+
* @returns {string} Fully-qualified domain of the Identity service we should interact with.
|
|
693
|
+
*/
|
|
694
|
+
declare function identity(): Promise<string>;
|
|
695
|
+
/**
|
|
696
|
+
* It returns the Shopify service we should interact with.
|
|
697
|
+
* Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.
|
|
698
|
+
* @returns {string} Fully-qualified domain of the Shopify service we should interact with.
|
|
699
|
+
*/
|
|
700
|
+
declare function shopify(options?: {
|
|
701
|
+
storeFqdn?: string;
|
|
702
|
+
}): Promise<string>;
|
|
703
|
+
|
|
704
|
+
declare const fqdn_CouldntObtainPartnersSpinFQDNError: typeof CouldntObtainPartnersSpinFQDNError;
|
|
705
|
+
declare const fqdn_CouldntObtainIdentitySpinFQDNError: typeof CouldntObtainIdentitySpinFQDNError;
|
|
706
|
+
declare const fqdn_CouldntObtainShopifySpinFQDNError: typeof CouldntObtainShopifySpinFQDNError;
|
|
707
|
+
declare const fqdn_NotProvidedStoreFQDNError: typeof NotProvidedStoreFQDNError;
|
|
708
|
+
declare const fqdn_partners: typeof partners;
|
|
709
|
+
declare const fqdn_identity: typeof identity;
|
|
710
|
+
declare const fqdn_shopify: typeof shopify;
|
|
711
|
+
declare namespace fqdn {
|
|
712
|
+
export {
|
|
713
|
+
fqdn_CouldntObtainPartnersSpinFQDNError as CouldntObtainPartnersSpinFQDNError,
|
|
714
|
+
fqdn_CouldntObtainIdentitySpinFQDNError as CouldntObtainIdentitySpinFQDNError,
|
|
715
|
+
fqdn_CouldntObtainShopifySpinFQDNError as CouldntObtainShopifySpinFQDNError,
|
|
716
|
+
fqdn_NotProvidedStoreFQDNError as NotProvidedStoreFQDNError,
|
|
717
|
+
fqdn_partners as partners,
|
|
718
|
+
fqdn_identity as identity,
|
|
719
|
+
fqdn_shopify as shopify,
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
declare const environment_local: typeof local;
|
|
724
|
+
declare const environment_service: typeof service;
|
|
725
|
+
declare const environment_fqdn: typeof fqdn;
|
|
726
|
+
declare namespace environment {
|
|
727
|
+
export {
|
|
728
|
+
environment_local as local,
|
|
729
|
+
environment_service as service,
|
|
730
|
+
environment_fqdn as fqdn,
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
declare namespace util {
|
|
735
|
+
type AssertEqual<T, Expected> = [T] extends [Expected] ? [Expected] extends [T] ? true : false : false;
|
|
736
|
+
function assertNever(_x: never): never;
|
|
737
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
738
|
+
type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
739
|
+
type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
740
|
+
const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; };
|
|
741
|
+
const getValidEnumValues: (obj: any) => any[];
|
|
742
|
+
const objectValues: (obj: any) => any[];
|
|
743
|
+
const objectKeys: ObjectConstructor["keys"];
|
|
744
|
+
const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
745
|
+
type identity<T> = T;
|
|
746
|
+
type flatten<T extends object> = identity<{
|
|
747
|
+
[k in keyof T]: T[k];
|
|
748
|
+
}>;
|
|
749
|
+
type noUndefined<T> = T extends undefined ? never : T;
|
|
750
|
+
const isInteger: NumberConstructor["isInteger"];
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
declare const ZodIssueCode: {
|
|
754
|
+
invalid_type: "invalid_type";
|
|
755
|
+
custom: "custom";
|
|
756
|
+
invalid_union: "invalid_union";
|
|
757
|
+
invalid_enum_value: "invalid_enum_value";
|
|
758
|
+
unrecognized_keys: "unrecognized_keys";
|
|
759
|
+
invalid_arguments: "invalid_arguments";
|
|
760
|
+
invalid_return_type: "invalid_return_type";
|
|
761
|
+
invalid_date: "invalid_date";
|
|
762
|
+
invalid_string: "invalid_string";
|
|
763
|
+
too_small: "too_small";
|
|
764
|
+
too_big: "too_big";
|
|
765
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
766
|
+
not_multiple_of: "not_multiple_of";
|
|
767
|
+
};
|
|
768
|
+
declare type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
769
|
+
declare type ZodIssueBase = {
|
|
770
|
+
path: (string | number)[];
|
|
771
|
+
message?: string;
|
|
772
|
+
};
|
|
773
|
+
interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
774
|
+
code: typeof ZodIssueCode.invalid_type;
|
|
775
|
+
expected: ZodParsedType;
|
|
776
|
+
received: ZodParsedType;
|
|
777
|
+
}
|
|
778
|
+
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
|
779
|
+
code: typeof ZodIssueCode.unrecognized_keys;
|
|
780
|
+
keys: string[];
|
|
781
|
+
}
|
|
782
|
+
interface ZodInvalidUnionIssue extends ZodIssueBase {
|
|
783
|
+
code: typeof ZodIssueCode.invalid_union;
|
|
784
|
+
unionErrors: ZodError[];
|
|
785
|
+
}
|
|
786
|
+
interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
|
787
|
+
code: typeof ZodIssueCode.invalid_enum_value;
|
|
788
|
+
options: (string | number)[];
|
|
789
|
+
}
|
|
790
|
+
interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
|
791
|
+
code: typeof ZodIssueCode.invalid_arguments;
|
|
792
|
+
argumentsError: ZodError;
|
|
793
|
+
}
|
|
794
|
+
interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
|
795
|
+
code: typeof ZodIssueCode.invalid_return_type;
|
|
796
|
+
returnTypeError: ZodError;
|
|
797
|
+
}
|
|
798
|
+
interface ZodInvalidDateIssue extends ZodIssueBase {
|
|
799
|
+
code: typeof ZodIssueCode.invalid_date;
|
|
800
|
+
}
|
|
801
|
+
declare type StringValidation = "email" | "url" | "uuid" | "regex" | "cuid";
|
|
802
|
+
interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
803
|
+
code: typeof ZodIssueCode.invalid_string;
|
|
804
|
+
validation: StringValidation;
|
|
805
|
+
}
|
|
806
|
+
interface ZodTooSmallIssue extends ZodIssueBase {
|
|
807
|
+
code: typeof ZodIssueCode.too_small;
|
|
808
|
+
minimum: number;
|
|
809
|
+
inclusive: boolean;
|
|
810
|
+
type: "array" | "string" | "number";
|
|
811
|
+
}
|
|
812
|
+
interface ZodTooBigIssue extends ZodIssueBase {
|
|
813
|
+
code: typeof ZodIssueCode.too_big;
|
|
814
|
+
maximum: number;
|
|
815
|
+
inclusive: boolean;
|
|
816
|
+
type: "array" | "string" | "number";
|
|
817
|
+
}
|
|
818
|
+
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
|
819
|
+
code: typeof ZodIssueCode.invalid_intersection_types;
|
|
820
|
+
}
|
|
821
|
+
interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
|
822
|
+
code: typeof ZodIssueCode.not_multiple_of;
|
|
823
|
+
multipleOf: number;
|
|
824
|
+
}
|
|
825
|
+
interface ZodCustomIssue extends ZodIssueBase {
|
|
826
|
+
code: typeof ZodIssueCode.custom;
|
|
827
|
+
params?: {
|
|
828
|
+
[k: string]: any;
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
declare type DenormalizedError = {
|
|
832
|
+
[k: string]: DenormalizedError | string[];
|
|
833
|
+
};
|
|
834
|
+
declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodCustomIssue;
|
|
835
|
+
declare type ZodIssue = ZodIssueOptionalMessage & {
|
|
836
|
+
message: string;
|
|
837
|
+
};
|
|
838
|
+
declare const quotelessJson: (obj: any) => string;
|
|
839
|
+
declare type ZodFormattedError<T> = {
|
|
840
|
+
_errors: string[];
|
|
841
|
+
} & (T extends [any, ...any[]] ? {
|
|
842
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
843
|
+
} : T extends any[] ? ZodFormattedError<T[number]>[] : T extends object ? {
|
|
844
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
845
|
+
} : unknown);
|
|
846
|
+
declare class ZodError<T = any> extends Error {
|
|
847
|
+
issues: ZodIssue[];
|
|
848
|
+
get errors(): ZodIssue[];
|
|
849
|
+
constructor(issues: ZodIssue[]);
|
|
850
|
+
format: () => ZodFormattedError<T>;
|
|
851
|
+
static create: (issues: ZodIssue[]) => ZodError<any>;
|
|
852
|
+
toString(): string;
|
|
853
|
+
get message(): string;
|
|
854
|
+
get isEmpty(): boolean;
|
|
855
|
+
addIssue: (sub: ZodIssue) => void;
|
|
856
|
+
addIssues: (subs?: ZodIssue[]) => void;
|
|
857
|
+
flatten: <U = string>(mapper?: (issue: ZodIssue) => U) => {
|
|
858
|
+
formErrors: U[];
|
|
859
|
+
fieldErrors: {
|
|
860
|
+
[k: string]: U[];
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
get formErrors(): {
|
|
864
|
+
formErrors: string[];
|
|
865
|
+
fieldErrors: {
|
|
866
|
+
[k: string]: string[];
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
declare type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
|
871
|
+
declare type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
|
872
|
+
path?: (string | number)[];
|
|
873
|
+
fatal?: boolean;
|
|
874
|
+
};
|
|
875
|
+
declare type MakeErrorData = IssueData;
|
|
876
|
+
declare type ErrorMapCtx = {
|
|
877
|
+
defaultError: string;
|
|
878
|
+
data: any;
|
|
879
|
+
};
|
|
880
|
+
declare type ZodErrorMap = typeof defaultErrorMap;
|
|
881
|
+
declare const defaultErrorMap: (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
|
882
|
+
message: string;
|
|
883
|
+
};
|
|
884
|
+
declare let overrideErrorMap: (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
|
885
|
+
message: string;
|
|
886
|
+
};
|
|
887
|
+
declare const setErrorMap: (map: ZodErrorMap) => void;
|
|
888
|
+
|
|
889
|
+
declare const ZodParsedType: {
|
|
890
|
+
function: "function";
|
|
891
|
+
number: "number";
|
|
892
|
+
string: "string";
|
|
893
|
+
nan: "nan";
|
|
894
|
+
integer: "integer";
|
|
895
|
+
float: "float";
|
|
896
|
+
boolean: "boolean";
|
|
897
|
+
date: "date";
|
|
898
|
+
bigint: "bigint";
|
|
899
|
+
symbol: "symbol";
|
|
900
|
+
undefined: "undefined";
|
|
901
|
+
null: "null";
|
|
902
|
+
array: "array";
|
|
903
|
+
object: "object";
|
|
904
|
+
unknown: "unknown";
|
|
905
|
+
promise: "promise";
|
|
906
|
+
void: "void";
|
|
907
|
+
never: "never";
|
|
908
|
+
map: "map";
|
|
909
|
+
set: "set";
|
|
910
|
+
};
|
|
911
|
+
declare type ZodParsedType = keyof typeof ZodParsedType;
|
|
912
|
+
declare const getParsedType: (data: any, cache?: Map<any, "function" | "number" | "string" | "nan" | "integer" | "float" | "boolean" | "date" | "bigint" | "symbol" | "undefined" | "null" | "array" | "object" | "unknown" | "promise" | "void" | "never" | "map" | "set"> | undefined) => ZodParsedType;
|
|
913
|
+
declare const makeIssue: (params: {
|
|
914
|
+
data: any;
|
|
915
|
+
path: (string | number)[];
|
|
916
|
+
errorMaps: ZodErrorMap[];
|
|
917
|
+
issueData: IssueData;
|
|
918
|
+
}) => ZodIssue;
|
|
919
|
+
declare type ParseParams = {
|
|
920
|
+
path: (string | number)[];
|
|
921
|
+
errorMap: ZodErrorMap;
|
|
922
|
+
async: boolean;
|
|
923
|
+
};
|
|
924
|
+
declare type ParsePathComponent = string | number;
|
|
925
|
+
declare type ParsePath = ParsePathComponent[];
|
|
926
|
+
declare const EMPTY_PATH: ParsePath;
|
|
927
|
+
interface ParseContext {
|
|
928
|
+
readonly path: ParsePath;
|
|
929
|
+
readonly issues: ZodIssue[];
|
|
930
|
+
readonly schemaErrorMap?: ZodErrorMap;
|
|
931
|
+
readonly contextualErrorMap?: ZodErrorMap;
|
|
932
|
+
readonly async: boolean;
|
|
933
|
+
readonly parent: ParseContext | null;
|
|
934
|
+
readonly typeCache: Map<any, ZodParsedType>;
|
|
935
|
+
readonly data: any;
|
|
936
|
+
readonly parsedType: ZodParsedType;
|
|
937
|
+
}
|
|
938
|
+
declare type ParseInput = {
|
|
939
|
+
data: any;
|
|
940
|
+
path: (string | number)[];
|
|
941
|
+
parent: ParseContext;
|
|
942
|
+
};
|
|
943
|
+
declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
|
|
944
|
+
declare type ObjectPair = {
|
|
945
|
+
key: SyncParseReturnType<any>;
|
|
946
|
+
value: SyncParseReturnType<any>;
|
|
947
|
+
};
|
|
948
|
+
declare class ParseStatus {
|
|
949
|
+
value: "aborted" | "dirty" | "valid";
|
|
950
|
+
dirty(): void;
|
|
951
|
+
abort(): void;
|
|
952
|
+
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
953
|
+
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
954
|
+
key: ParseReturnType<any>;
|
|
955
|
+
value: ParseReturnType<any>;
|
|
956
|
+
}[]): Promise<SyncParseReturnType<any>>;
|
|
957
|
+
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
958
|
+
key: SyncParseReturnType<any>;
|
|
959
|
+
value: SyncParseReturnType<any>;
|
|
960
|
+
alwaysSet?: boolean;
|
|
961
|
+
}[]): SyncParseReturnType;
|
|
962
|
+
}
|
|
963
|
+
interface ParseResult {
|
|
964
|
+
status: "aborted" | "dirty" | "valid";
|
|
965
|
+
data: any;
|
|
966
|
+
}
|
|
967
|
+
declare type INVALID = {
|
|
968
|
+
status: "aborted";
|
|
969
|
+
};
|
|
970
|
+
declare const INVALID: INVALID;
|
|
971
|
+
declare type DIRTY<T> = {
|
|
972
|
+
status: "dirty";
|
|
973
|
+
value: T;
|
|
974
|
+
};
|
|
975
|
+
declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
976
|
+
declare type OK<T> = {
|
|
977
|
+
status: "valid";
|
|
978
|
+
value: T;
|
|
979
|
+
};
|
|
980
|
+
declare const OK: <T>(value: T) => OK<T>;
|
|
981
|
+
declare type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
982
|
+
declare type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
983
|
+
declare type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
984
|
+
declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
|
|
985
|
+
declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
|
986
|
+
declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
|
987
|
+
declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
|
|
988
|
+
|
|
989
|
+
declare namespace errorUtil {
|
|
990
|
+
type ErrMessage = string | {
|
|
991
|
+
message?: string;
|
|
992
|
+
};
|
|
993
|
+
const errToObj: (message?: ErrMessage | undefined) => {
|
|
994
|
+
message?: string | undefined;
|
|
995
|
+
};
|
|
996
|
+
const toString: (message?: ErrMessage | undefined) => string | undefined;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
declare namespace partialUtil {
|
|
1000
|
+
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<infer Shape, infer Params, infer Catchall> ? ZodObject<{
|
|
1001
|
+
[k in keyof Shape]: ZodOptional<DeepPartial<Shape[k]>>;
|
|
1002
|
+
}, Params, Catchall> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
|
|
1003
|
+
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
1004
|
+
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
declare type RefinementCtx = {
|
|
1008
|
+
addIssue: (arg: IssueData) => void;
|
|
1009
|
+
path: (string | number)[];
|
|
1010
|
+
};
|
|
1011
|
+
declare type ZodRawShape = {
|
|
1012
|
+
[k: string]: ZodTypeAny;
|
|
1013
|
+
};
|
|
1014
|
+
declare type ZodTypeAny = ZodType<any, any, any>;
|
|
1015
|
+
declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
1016
|
+
declare type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
1017
|
+
declare type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
1018
|
+
|
|
1019
|
+
declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
1020
|
+
interface ZodTypeDef {
|
|
1021
|
+
errorMap?: ZodErrorMap;
|
|
1022
|
+
description?: string;
|
|
1023
|
+
}
|
|
1024
|
+
declare type RawCreateParams = {
|
|
1025
|
+
errorMap?: ZodErrorMap;
|
|
1026
|
+
invalid_type_error?: string;
|
|
1027
|
+
required_error?: string;
|
|
1028
|
+
description?: string;
|
|
1029
|
+
} | undefined;
|
|
1030
|
+
declare type SafeParseSuccess<Output> = {
|
|
1031
|
+
success: true;
|
|
1032
|
+
data: Output;
|
|
1033
|
+
};
|
|
1034
|
+
declare type SafeParseError<Input> = {
|
|
1035
|
+
success: false;
|
|
1036
|
+
error: ZodError<Input>;
|
|
1037
|
+
};
|
|
1038
|
+
declare type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
1039
|
+
declare abstract class ZodType<Output, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
1040
|
+
readonly _type: Output;
|
|
1041
|
+
readonly _output: Output;
|
|
1042
|
+
readonly _input: Input;
|
|
1043
|
+
readonly _def: Def;
|
|
1044
|
+
get description(): string | undefined;
|
|
1045
|
+
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
1046
|
+
_processInputParams(input: ParseInput): {
|
|
1047
|
+
status: ParseStatus;
|
|
1048
|
+
ctx: ParseContext;
|
|
1049
|
+
};
|
|
1050
|
+
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
1051
|
+
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
1052
|
+
parse(data: unknown, params?: Partial<ParseParams>): Output;
|
|
1053
|
+
safeParse(data: unknown, params?: Partial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
1054
|
+
parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
|
|
1055
|
+
safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
1056
|
+
/** Alias of safeParseAsync */
|
|
1057
|
+
spa: (data: unknown, params?: Partial<ParseParams> | undefined) => Promise<SafeParseReturnType<Input, Output>>;
|
|
1058
|
+
/** The .is method has been removed in Zod 3. For details see https://github.com/colinhacks/zod/tree/v3. */
|
|
1059
|
+
is: never;
|
|
1060
|
+
/** The .check method has been removed in Zod 3. For details see https://github.com/colinhacks/zod/tree/v3. */
|
|
1061
|
+
check: never;
|
|
1062
|
+
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, RefinedOutput>;
|
|
1063
|
+
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
1064
|
+
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, RefinedOutput>;
|
|
1065
|
+
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
1066
|
+
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
1067
|
+
superRefine: (refinement: RefinementEffect<Output>["refinement"]) => ZodEffects<this, Output, Input>;
|
|
1068
|
+
constructor(def: Def);
|
|
1069
|
+
optional(): ZodOptional<this>;
|
|
1070
|
+
nullable(): ZodNullable<this>;
|
|
1071
|
+
nullish(): ZodNullable<ZodOptional<this>>;
|
|
1072
|
+
array(): ZodArray<this>;
|
|
1073
|
+
promise(): ZodPromise<this>;
|
|
1074
|
+
or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
|
|
1075
|
+
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
|
|
1076
|
+
transform<NewOut>(transform: (arg: Output) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
1077
|
+
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
1078
|
+
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
1079
|
+
describe(description: string): this;
|
|
1080
|
+
isOptional(): boolean;
|
|
1081
|
+
isNullable(): boolean;
|
|
1082
|
+
}
|
|
1083
|
+
declare type ZodStringCheck = {
|
|
1084
|
+
kind: "min";
|
|
1085
|
+
value: number;
|
|
1086
|
+
message?: string;
|
|
1087
|
+
} | {
|
|
1088
|
+
kind: "max";
|
|
1089
|
+
value: number;
|
|
1090
|
+
message?: string;
|
|
1091
|
+
} | {
|
|
1092
|
+
kind: "email";
|
|
1093
|
+
message?: string;
|
|
1094
|
+
} | {
|
|
1095
|
+
kind: "url";
|
|
1096
|
+
message?: string;
|
|
1097
|
+
} | {
|
|
1098
|
+
kind: "uuid";
|
|
1099
|
+
message?: string;
|
|
1100
|
+
} | {
|
|
1101
|
+
kind: "cuid";
|
|
1102
|
+
message?: string;
|
|
1103
|
+
} | {
|
|
1104
|
+
kind: "regex";
|
|
1105
|
+
regex: RegExp;
|
|
1106
|
+
message?: string;
|
|
1107
|
+
};
|
|
1108
|
+
interface ZodStringDef extends ZodTypeDef {
|
|
1109
|
+
checks: ZodStringCheck[];
|
|
1110
|
+
typeName: ZodFirstPartyTypeKind.ZodString;
|
|
1111
|
+
}
|
|
1112
|
+
declare class ZodString extends ZodType<string, ZodStringDef> {
|
|
1113
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
1114
|
+
protected _regex: (regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage | undefined) => ZodEffects<this, string, string>;
|
|
1115
|
+
_addCheck(check: ZodStringCheck): ZodString;
|
|
1116
|
+
email(message?: errorUtil.ErrMessage): ZodString;
|
|
1117
|
+
url(message?: errorUtil.ErrMessage): ZodString;
|
|
1118
|
+
uuid(message?: errorUtil.ErrMessage): ZodString;
|
|
1119
|
+
cuid(message?: errorUtil.ErrMessage): ZodString;
|
|
1120
|
+
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
|
|
1121
|
+
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1122
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1123
|
+
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1124
|
+
/**
|
|
1125
|
+
* Deprecated.
|
|
1126
|
+
* Use z.string().min(1) instead.
|
|
1127
|
+
*/
|
|
1128
|
+
nonempty: (message?: errorUtil.ErrMessage | undefined) => ZodString;
|
|
1129
|
+
get isEmail(): boolean;
|
|
1130
|
+
get isURL(): boolean;
|
|
1131
|
+
get isUUID(): boolean;
|
|
1132
|
+
get isCUID(): boolean;
|
|
1133
|
+
get minLength(): number;
|
|
1134
|
+
get maxLength(): null;
|
|
1135
|
+
static create: (params?: RawCreateParams) => ZodString;
|
|
1136
|
+
}
|
|
1137
|
+
declare type ZodNumberCheck = {
|
|
1138
|
+
kind: "min";
|
|
1139
|
+
value: number;
|
|
1140
|
+
inclusive: boolean;
|
|
1141
|
+
message?: string;
|
|
1142
|
+
} | {
|
|
1143
|
+
kind: "max";
|
|
1144
|
+
value: number;
|
|
1145
|
+
inclusive: boolean;
|
|
1146
|
+
message?: string;
|
|
1147
|
+
} | {
|
|
1148
|
+
kind: "int";
|
|
1149
|
+
message?: string;
|
|
1150
|
+
} | {
|
|
1151
|
+
kind: "multipleOf";
|
|
1152
|
+
value: number;
|
|
1153
|
+
message?: string;
|
|
1154
|
+
};
|
|
1155
|
+
interface ZodNumberDef extends ZodTypeDef {
|
|
1156
|
+
checks: ZodNumberCheck[];
|
|
1157
|
+
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
1158
|
+
}
|
|
1159
|
+
declare class ZodNumber extends ZodType<number, ZodNumberDef> {
|
|
1160
|
+
_parse(input: ParseInput): ParseReturnType<number>;
|
|
1161
|
+
static create: (params?: RawCreateParams) => ZodNumber;
|
|
1162
|
+
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1163
|
+
min: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1164
|
+
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1165
|
+
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1166
|
+
max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1167
|
+
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1168
|
+
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
1169
|
+
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
1170
|
+
int(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1171
|
+
positive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1172
|
+
negative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1173
|
+
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1174
|
+
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1175
|
+
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1176
|
+
step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1177
|
+
get minValue(): number | null;
|
|
1178
|
+
get maxValue(): number | null;
|
|
1179
|
+
get isInt(): boolean;
|
|
1180
|
+
}
|
|
1181
|
+
interface ZodBigIntDef extends ZodTypeDef {
|
|
1182
|
+
typeName: ZodFirstPartyTypeKind.ZodBigInt;
|
|
1183
|
+
}
|
|
1184
|
+
declare class ZodBigInt extends ZodType<bigint, ZodBigIntDef> {
|
|
1185
|
+
_parse(input: ParseInput): ParseReturnType<bigint>;
|
|
1186
|
+
static create: (params?: RawCreateParams) => ZodBigInt;
|
|
1187
|
+
}
|
|
1188
|
+
interface ZodBooleanDef extends ZodTypeDef {
|
|
1189
|
+
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
1190
|
+
}
|
|
1191
|
+
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef> {
|
|
1192
|
+
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
1193
|
+
static create: (params?: RawCreateParams) => ZodBoolean;
|
|
1194
|
+
}
|
|
1195
|
+
interface ZodDateDef extends ZodTypeDef {
|
|
1196
|
+
typeName: ZodFirstPartyTypeKind.ZodDate;
|
|
1197
|
+
}
|
|
1198
|
+
declare class ZodDate extends ZodType<Date, ZodDateDef> {
|
|
1199
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1200
|
+
static create: (params?: RawCreateParams) => ZodDate;
|
|
1201
|
+
}
|
|
1202
|
+
interface ZodUndefinedDef extends ZodTypeDef {
|
|
1203
|
+
typeName: ZodFirstPartyTypeKind.ZodUndefined;
|
|
1204
|
+
}
|
|
1205
|
+
declare class ZodUndefined extends ZodType<undefined, ZodUndefinedDef> {
|
|
1206
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1207
|
+
params?: RawCreateParams;
|
|
1208
|
+
static create: (params?: RawCreateParams) => ZodUndefined;
|
|
1209
|
+
}
|
|
1210
|
+
interface ZodNullDef extends ZodTypeDef {
|
|
1211
|
+
typeName: ZodFirstPartyTypeKind.ZodNull;
|
|
1212
|
+
}
|
|
1213
|
+
declare class ZodNull extends ZodType<null, ZodNullDef> {
|
|
1214
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1215
|
+
static create: (params?: RawCreateParams) => ZodNull;
|
|
1216
|
+
}
|
|
1217
|
+
interface ZodAnyDef extends ZodTypeDef {
|
|
1218
|
+
typeName: ZodFirstPartyTypeKind.ZodAny;
|
|
1219
|
+
}
|
|
1220
|
+
declare class ZodAny extends ZodType<any, ZodAnyDef> {
|
|
1221
|
+
_any: true;
|
|
1222
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1223
|
+
static create: (params?: RawCreateParams) => ZodAny;
|
|
1224
|
+
}
|
|
1225
|
+
interface ZodUnknownDef extends ZodTypeDef {
|
|
1226
|
+
typeName: ZodFirstPartyTypeKind.ZodUnknown;
|
|
1227
|
+
}
|
|
1228
|
+
declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef> {
|
|
1229
|
+
_unknown: true;
|
|
1230
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1231
|
+
static create: (params?: RawCreateParams) => ZodUnknown;
|
|
1232
|
+
}
|
|
1233
|
+
interface ZodNeverDef extends ZodTypeDef {
|
|
1234
|
+
typeName: ZodFirstPartyTypeKind.ZodNever;
|
|
1235
|
+
}
|
|
1236
|
+
declare class ZodNever extends ZodType<never, ZodNeverDef> {
|
|
1237
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1238
|
+
static create: (params?: RawCreateParams) => ZodNever;
|
|
1239
|
+
}
|
|
1240
|
+
interface ZodVoidDef extends ZodTypeDef {
|
|
1241
|
+
typeName: ZodFirstPartyTypeKind.ZodVoid;
|
|
1242
|
+
}
|
|
1243
|
+
declare class ZodVoid extends ZodType<void, ZodVoidDef> {
|
|
1244
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1245
|
+
static create: (params?: RawCreateParams) => ZodVoid;
|
|
1246
|
+
}
|
|
1247
|
+
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1248
|
+
type: T;
|
|
1249
|
+
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
1250
|
+
minLength: {
|
|
1251
|
+
value: number;
|
|
1252
|
+
message?: string;
|
|
1253
|
+
} | null;
|
|
1254
|
+
maxLength: {
|
|
1255
|
+
value: number;
|
|
1256
|
+
message?: string;
|
|
1257
|
+
} | null;
|
|
1258
|
+
}
|
|
1259
|
+
declare type ArrayCardinality = "many" | "atleastone";
|
|
1260
|
+
declare type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
|
|
1261
|
+
declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
|
|
1262
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1263
|
+
get element(): T;
|
|
1264
|
+
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
1265
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
1266
|
+
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
1267
|
+
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
1268
|
+
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
|
|
1269
|
+
}
|
|
1270
|
+
declare type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
|
|
1271
|
+
declare namespace objectUtil {
|
|
1272
|
+
export type MergeShapes<U extends ZodRawShape, V extends ZodRawShape> = {
|
|
1273
|
+
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
1274
|
+
} & V;
|
|
1275
|
+
type optionalKeys<T extends object> = {
|
|
1276
|
+
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
1277
|
+
}[keyof T];
|
|
1278
|
+
type requiredKeys<T extends object> = Exclude<keyof T, optionalKeys<T>>;
|
|
1279
|
+
export type addQuestionMarks<T extends object> = {
|
|
1280
|
+
[k in optionalKeys<T>]?: T[k];
|
|
1281
|
+
} & {
|
|
1282
|
+
[k in requiredKeys<T>]: T[k];
|
|
1283
|
+
};
|
|
1284
|
+
export type identity<T> = T;
|
|
1285
|
+
export type flatten<T extends object> = identity<{
|
|
1286
|
+
[k in keyof T]: T[k];
|
|
1287
|
+
}>;
|
|
1288
|
+
export type noNeverKeys<T extends ZodRawShape> = {
|
|
1289
|
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
1290
|
+
}[keyof T];
|
|
1291
|
+
export type noNever<T extends ZodRawShape> = identity<{
|
|
1292
|
+
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
1293
|
+
}>;
|
|
1294
|
+
export const mergeShapes: <U extends ZodRawShape, T extends ZodRawShape>(first: U, second: T) => T & U;
|
|
1295
|
+
export {};
|
|
1296
|
+
}
|
|
1297
|
+
declare type extendShape<A, B> = {
|
|
1298
|
+
[k in Exclude<keyof A, keyof B>]: A[k];
|
|
1299
|
+
} & {
|
|
1300
|
+
[k in keyof B]: B[k];
|
|
1301
|
+
};
|
|
1302
|
+
declare type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
1303
|
+
declare type Primitive = string | number | bigint | boolean | null | undefined;
|
|
1304
|
+
declare type Scalars = Primitive | Primitive[];
|
|
1305
|
+
interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1306
|
+
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
1307
|
+
shape: () => T;
|
|
1308
|
+
catchall: Catchall;
|
|
1309
|
+
unknownKeys: UnknownKeys;
|
|
1310
|
+
}
|
|
1311
|
+
declare type baseObjectOutputType<Shape extends ZodRawShape> = objectUtil.flatten<objectUtil.addQuestionMarks<{
|
|
1312
|
+
[k in keyof Shape]: Shape[k]["_output"];
|
|
1313
|
+
}>>;
|
|
1314
|
+
declare type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? baseObjectOutputType<Shape> : objectUtil.flatten<baseObjectOutputType<Shape> & {
|
|
1315
|
+
[k: string]: Catchall["_output"];
|
|
1316
|
+
}>;
|
|
1317
|
+
declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.flatten<objectUtil.addQuestionMarks<{
|
|
1318
|
+
[k in keyof Shape]: Shape[k]["_input"];
|
|
1319
|
+
}>>;
|
|
1320
|
+
declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? baseObjectInputType<Shape> : objectUtil.flatten<baseObjectInputType<Shape> & {
|
|
1321
|
+
[k: string]: Catchall["_input"];
|
|
1322
|
+
}>;
|
|
1323
|
+
declare type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T;
|
|
1324
|
+
declare type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny, any, any>;
|
|
1325
|
+
declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = "strip", Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall>, Input = objectInputType<T, Catchall>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
|
|
1326
|
+
readonly _shape: T;
|
|
1327
|
+
readonly _unknownKeys: UnknownKeys;
|
|
1328
|
+
readonly _catchall: Catchall;
|
|
1329
|
+
private _cached;
|
|
1330
|
+
_getCached(): {
|
|
1331
|
+
shape: T;
|
|
1332
|
+
keys: string[];
|
|
1333
|
+
};
|
|
1334
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1335
|
+
get shape(): T;
|
|
1336
|
+
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
1337
|
+
strip(): ZodObject<T, "strip", Catchall>;
|
|
1338
|
+
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
1339
|
+
/**
|
|
1340
|
+
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
1341
|
+
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
1342
|
+
*/
|
|
1343
|
+
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
1344
|
+
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<extendShape<T, Augmentation>, UnknownKeys, Catchall, objectOutputType<extendShape<T, Augmentation>, Catchall>, objectInputType<extendShape<T, Augmentation>, Catchall>>;
|
|
1345
|
+
extend: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<extendShape<T, Augmentation>, UnknownKeys, Catchall, objectOutputType<extendShape<T, Augmentation>, Catchall>, objectInputType<extendShape<T, Augmentation>, Catchall>>;
|
|
1346
|
+
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
1347
|
+
[k in Key]: Schema;
|
|
1348
|
+
}, UnknownKeys, Catchall>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
1351
|
+
* inferred type of merged objects. Please
|
|
1352
|
+
* upgrade if you are experiencing issues.
|
|
1353
|
+
*/
|
|
1354
|
+
merge<Incoming extends AnyZodObject>(merging: Incoming): ZodObject<extendShape<T, Incoming["_shape"]>, UnknownKeys, Catchall>;
|
|
1355
|
+
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
1356
|
+
pick<Mask extends {
|
|
1357
|
+
[k in keyof T]?: true;
|
|
1358
|
+
}>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1359
|
+
[k in keyof Mask]: k extends keyof T ? T[k] : never;
|
|
1360
|
+
}>, UnknownKeys, Catchall>;
|
|
1361
|
+
omit<Mask extends {
|
|
1362
|
+
[k in keyof T]?: true;
|
|
1363
|
+
}>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1364
|
+
[k in keyof T]: k extends keyof Mask ? never : T[k];
|
|
1365
|
+
}>, UnknownKeys, Catchall>;
|
|
1366
|
+
deepPartial(): partialUtil.DeepPartial<this>;
|
|
1367
|
+
partial(): ZodObject<{
|
|
1368
|
+
[k in keyof T]: ZodOptional<T[k]>;
|
|
1369
|
+
}, UnknownKeys, Catchall>;
|
|
1370
|
+
partial<Mask extends {
|
|
1371
|
+
[k in keyof T]?: true;
|
|
1372
|
+
}>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1373
|
+
[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
|
|
1374
|
+
}>, UnknownKeys, Catchall>;
|
|
1375
|
+
required(): ZodObject<{
|
|
1376
|
+
[k in keyof T]: deoptional<T[k]>;
|
|
1377
|
+
}, UnknownKeys, Catchall>;
|
|
1378
|
+
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]["_output"]; }>]: objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]["_output"]; }>[k_1]; }, { [k_3 in keyof objectUtil.addQuestionMarks<{ [k_2 in keyof T_1]: T_1[k_2]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_2 in keyof T_1]: T_1[k_2]["_input"]; }>[k_3]; }>;
|
|
1379
|
+
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]["_output"]; }>]: objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]["_output"]; }>[k_1]; }, { [k_3 in keyof objectUtil.addQuestionMarks<{ [k_2 in keyof T_1]: T_1[k_2]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_2 in keyof T_1]: T_1[k_2]["_input"]; }>[k_3]; }>;
|
|
1380
|
+
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]["_output"]; }>]: objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]["_output"]; }>[k_1]; }, { [k_3 in keyof objectUtil.addQuestionMarks<{ [k_2 in keyof T_1]: T_1[k_2]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_2 in keyof T_1]: T_1[k_2]["_input"]; }>[k_3]; }>;
|
|
1381
|
+
}
|
|
1382
|
+
declare type AnyZodObject = ZodObject<any, any, any>;
|
|
1383
|
+
declare type ZodUnionOptions = [ZodTypeAny, ...ZodTypeAny[]];
|
|
1384
|
+
interface ZodUnionDef<T extends ZodUnionOptions = [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]> extends ZodTypeDef {
|
|
1385
|
+
options: T;
|
|
1386
|
+
typeName: ZodFirstPartyTypeKind.ZodUnion;
|
|
1387
|
+
}
|
|
1388
|
+
declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
1389
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1390
|
+
get options(): T;
|
|
1391
|
+
static create: <T_1 extends [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
|
|
1392
|
+
}
|
|
1393
|
+
interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1394
|
+
left: T;
|
|
1395
|
+
right: U;
|
|
1396
|
+
typeName: ZodFirstPartyTypeKind.ZodIntersection;
|
|
1397
|
+
}
|
|
1398
|
+
declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
1399
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1400
|
+
static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
|
|
1401
|
+
}
|
|
1402
|
+
declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
1403
|
+
declare type AssertArray<T extends any> = T extends any[] ? T : never;
|
|
1404
|
+
declare type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
1405
|
+
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_output"] : never;
|
|
1406
|
+
}>;
|
|
1407
|
+
declare type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
|
|
1408
|
+
declare type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
1409
|
+
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_input"] : never;
|
|
1410
|
+
}>;
|
|
1411
|
+
declare type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
|
|
1412
|
+
interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
1413
|
+
items: T;
|
|
1414
|
+
rest: Rest;
|
|
1415
|
+
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
1416
|
+
}
|
|
1417
|
+
declare class ZodTuple<T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
1418
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1419
|
+
get items(): T;
|
|
1420
|
+
rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
|
|
1421
|
+
static create: <T_1 extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
|
|
1422
|
+
}
|
|
1423
|
+
interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1424
|
+
valueType: Value;
|
|
1425
|
+
keyType: Key;
|
|
1426
|
+
typeName: ZodFirstPartyTypeKind.ZodRecord;
|
|
1427
|
+
}
|
|
1428
|
+
declare type KeySchema = ZodType<string | number | symbol, any, any>;
|
|
1429
|
+
declare class ZodRecord<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Record<Key["_output"], Value["_output"]>, ZodRecordDef<Key, Value>, Record<Key["_input"], Value["_input"]>> {
|
|
1430
|
+
get keySchema(): Key;
|
|
1431
|
+
get valueSchema(): Value;
|
|
1432
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1433
|
+
get element(): Value;
|
|
1434
|
+
static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
|
|
1435
|
+
static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
|
|
1436
|
+
}
|
|
1437
|
+
interface ZodMapDef<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1438
|
+
valueType: Value;
|
|
1439
|
+
keyType: Key;
|
|
1440
|
+
typeName: ZodFirstPartyTypeKind.ZodMap;
|
|
1441
|
+
}
|
|
1442
|
+
declare class ZodMap<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Map<Key["_output"], Value["_output"]>, ZodMapDef<Key, Value>, Map<Key["_input"], Value["_input"]>> {
|
|
1443
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1444
|
+
static create: <Key_1 extends ZodTypeAny = ZodTypeAny, Value_1 extends ZodTypeAny = ZodTypeAny>(keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap<Key_1, Value_1>;
|
|
1445
|
+
}
|
|
1446
|
+
interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1447
|
+
valueType: Value;
|
|
1448
|
+
typeName: ZodFirstPartyTypeKind.ZodSet;
|
|
1449
|
+
}
|
|
1450
|
+
declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Set<Value["_output"]>, ZodSetDef<Value>, Set<Value["_input"]>> {
|
|
1451
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1452
|
+
static create: <Value_1 extends ZodTypeAny = ZodTypeAny>(valueType: Value_1, params?: RawCreateParams) => ZodSet<Value_1>;
|
|
1453
|
+
}
|
|
1454
|
+
interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1455
|
+
args: Args;
|
|
1456
|
+
returns: Returns;
|
|
1457
|
+
typeName: ZodFirstPartyTypeKind.ZodFunction;
|
|
1458
|
+
}
|
|
1459
|
+
declare type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
1460
|
+
declare type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
1461
|
+
declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
1462
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1463
|
+
parameters(): Args;
|
|
1464
|
+
returnType(): Returns;
|
|
1465
|
+
args<Items extends Parameters<typeof ZodTuple["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
1466
|
+
returns<NewReturnType extends ZodType<any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
|
|
1467
|
+
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): F;
|
|
1468
|
+
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
1469
|
+
validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => F;
|
|
1470
|
+
static create: <T extends ZodTuple<any, any> = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args?: T | undefined, returns?: U | undefined, params?: RawCreateParams) => ZodFunction<T, U>;
|
|
1471
|
+
}
|
|
1472
|
+
interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1473
|
+
getter: () => T;
|
|
1474
|
+
typeName: ZodFirstPartyTypeKind.ZodLazy;
|
|
1475
|
+
}
|
|
1476
|
+
declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
|
|
1477
|
+
get schema(): T;
|
|
1478
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1479
|
+
static create: <T_1 extends ZodTypeAny>(getter: () => T_1, params?: RawCreateParams) => ZodLazy<T_1>;
|
|
1480
|
+
}
|
|
1481
|
+
interface ZodLiteralDef<T extends any = any> extends ZodTypeDef {
|
|
1482
|
+
value: T;
|
|
1483
|
+
typeName: ZodFirstPartyTypeKind.ZodLiteral;
|
|
1484
|
+
}
|
|
1485
|
+
declare class ZodLiteral<T extends any> extends ZodType<T, ZodLiteralDef<T>> {
|
|
1486
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1487
|
+
get value(): T;
|
|
1488
|
+
static create: <T_1 extends Primitive>(value: T_1, params?: RawCreateParams) => ZodLiteral<T_1>;
|
|
1489
|
+
}
|
|
1490
|
+
declare type ArrayKeys = keyof any[];
|
|
1491
|
+
declare type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
1492
|
+
declare type EnumValues = [string, ...string[]];
|
|
1493
|
+
declare type Values<T extends EnumValues> = {
|
|
1494
|
+
[k in T[number]]: k;
|
|
1495
|
+
};
|
|
1496
|
+
interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
1497
|
+
values: T;
|
|
1498
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
1499
|
+
}
|
|
1500
|
+
declare type Writeable<T> = {
|
|
1501
|
+
-readonly [P in keyof T]: T[P];
|
|
1502
|
+
};
|
|
1503
|
+
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T): ZodEnum<Writeable<T>>;
|
|
1504
|
+
declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T): ZodEnum<T>;
|
|
1505
|
+
declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>> {
|
|
1506
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1507
|
+
get options(): T;
|
|
1508
|
+
get enum(): Values<T>;
|
|
1509
|
+
get Values(): Values<T>;
|
|
1510
|
+
get Enum(): Values<T>;
|
|
1511
|
+
static create: typeof createZodEnum;
|
|
1512
|
+
}
|
|
1513
|
+
interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {
|
|
1514
|
+
values: T;
|
|
1515
|
+
typeName: ZodFirstPartyTypeKind.ZodNativeEnum;
|
|
1516
|
+
}
|
|
1517
|
+
declare type EnumLike = {
|
|
1518
|
+
[k: string]: string | number;
|
|
1519
|
+
[nu: number]: string;
|
|
1520
|
+
};
|
|
1521
|
+
declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T], ZodNativeEnumDef<T>> {
|
|
1522
|
+
_parse(input: ParseInput): ParseReturnType<T[keyof T]>;
|
|
1523
|
+
static create: <T_1 extends EnumLike>(values: T_1, params?: RawCreateParams) => ZodNativeEnum<T_1>;
|
|
1524
|
+
}
|
|
1525
|
+
interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1526
|
+
type: T;
|
|
1527
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
1528
|
+
}
|
|
1529
|
+
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
1530
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1531
|
+
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
|
|
1532
|
+
}
|
|
1533
|
+
declare type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
1534
|
+
declare type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void;
|
|
1535
|
+
declare type RefinementEffect<T> = {
|
|
1536
|
+
type: "refinement";
|
|
1537
|
+
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
1538
|
+
};
|
|
1539
|
+
declare type TransformEffect<T> = {
|
|
1540
|
+
type: "transform";
|
|
1541
|
+
transform: (arg: T) => any;
|
|
1542
|
+
};
|
|
1543
|
+
declare type PreprocessEffect<T> = {
|
|
1544
|
+
type: "preprocess";
|
|
1545
|
+
transform: (arg: T) => any;
|
|
1546
|
+
};
|
|
1547
|
+
declare type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
1548
|
+
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1549
|
+
schema: T;
|
|
1550
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
1551
|
+
effect: Effect<any>;
|
|
1552
|
+
}
|
|
1553
|
+
declare class ZodEffects<T extends ZodTypeAny, Output = T["_output"], Input = T["_input"]> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
1554
|
+
innerType(): T;
|
|
1555
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1556
|
+
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], I["_input"]>;
|
|
1557
|
+
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], I["_input"]>;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1561
|
+
innerType: T;
|
|
1562
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
1563
|
+
}
|
|
1564
|
+
declare type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
|
|
1565
|
+
declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
1566
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1567
|
+
unwrap(): T;
|
|
1568
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
|
|
1569
|
+
}
|
|
1570
|
+
interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1571
|
+
innerType: T;
|
|
1572
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
1573
|
+
}
|
|
1574
|
+
declare type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
|
|
1575
|
+
declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
1576
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1577
|
+
unwrap(): T;
|
|
1578
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
|
|
1579
|
+
}
|
|
1580
|
+
interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1581
|
+
innerType: T;
|
|
1582
|
+
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
1583
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault;
|
|
1584
|
+
}
|
|
1585
|
+
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
1586
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1587
|
+
removeDefault(): T;
|
|
1588
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
|
|
1589
|
+
}
|
|
1590
|
+
declare const custom: <T>(check?: ((data: unknown) => any) | undefined, params?: Parameters<ZodTypeAny["refine"]>[1]) => ZodType<T, ZodTypeDef, T>;
|
|
1591
|
+
|
|
1592
|
+
declare const late: {
|
|
1593
|
+
object: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T]: T[k]["_output"]; }>]: objectUtil.addQuestionMarks<{ [k in keyof T]: T[k]["_output"]; }>[k_1]; }, { [k_3 in keyof objectUtil.addQuestionMarks<{ [k_2 in keyof T]: T[k_2]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_2 in keyof T]: T[k_2]["_input"]; }>[k_3]; }>;
|
|
1594
|
+
};
|
|
1595
|
+
declare enum ZodFirstPartyTypeKind {
|
|
1596
|
+
ZodString = "ZodString",
|
|
1597
|
+
ZodNumber = "ZodNumber",
|
|
1598
|
+
ZodBigInt = "ZodBigInt",
|
|
1599
|
+
ZodBoolean = "ZodBoolean",
|
|
1600
|
+
ZodDate = "ZodDate",
|
|
1601
|
+
ZodUndefined = "ZodUndefined",
|
|
1602
|
+
ZodNull = "ZodNull",
|
|
1603
|
+
ZodAny = "ZodAny",
|
|
1604
|
+
ZodUnknown = "ZodUnknown",
|
|
1605
|
+
ZodNever = "ZodNever",
|
|
1606
|
+
ZodVoid = "ZodVoid",
|
|
1607
|
+
ZodArray = "ZodArray",
|
|
1608
|
+
ZodObject = "ZodObject",
|
|
1609
|
+
ZodUnion = "ZodUnion",
|
|
1610
|
+
ZodIntersection = "ZodIntersection",
|
|
1611
|
+
ZodTuple = "ZodTuple",
|
|
1612
|
+
ZodRecord = "ZodRecord",
|
|
1613
|
+
ZodMap = "ZodMap",
|
|
1614
|
+
ZodSet = "ZodSet",
|
|
1615
|
+
ZodFunction = "ZodFunction",
|
|
1616
|
+
ZodLazy = "ZodLazy",
|
|
1617
|
+
ZodLiteral = "ZodLiteral",
|
|
1618
|
+
ZodEnum = "ZodEnum",
|
|
1619
|
+
ZodEffects = "ZodEffects",
|
|
1620
|
+
ZodNativeEnum = "ZodNativeEnum",
|
|
1621
|
+
ZodOptional = "ZodOptional",
|
|
1622
|
+
ZodNullable = "ZodNullable",
|
|
1623
|
+
ZodDefault = "ZodDefault",
|
|
1624
|
+
ZodPromise = "ZodPromise"
|
|
1625
|
+
}
|
|
1626
|
+
declare type ZodFirstPartySchemaTypes = ZodString | ZodNumber | ZodBigInt | ZodBoolean | ZodDate | ZodUndefined | ZodNull | ZodAny | ZodUnknown | ZodNever | ZodVoid | ZodArray<any, any> | ZodObject<any, any, any, any, any> | ZodUnion<any> | ZodIntersection<any, any> | ZodTuple<any, any> | ZodRecord<any, any> | ZodMap<any> | ZodSet<any> | ZodFunction<any, any> | ZodLazy<any> | ZodLiteral<any> | ZodEnum<any> | ZodEffects<any, any, any> | ZodNativeEnum<any> | ZodOptional<any> | ZodNullable<any> | ZodDefault<any> | ZodPromise<any>;
|
|
1627
|
+
declare const instanceOfType: <T extends new (...args: any[]) => any>(cls: T, params?: Parameters<ZodTypeAny["refine"]>[1]) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>;
|
|
1628
|
+
declare const stringType: (params?: RawCreateParams) => ZodString;
|
|
1629
|
+
declare const numberType: (params?: RawCreateParams) => ZodNumber;
|
|
1630
|
+
declare const bigIntType: (params?: RawCreateParams) => ZodBigInt;
|
|
1631
|
+
declare const booleanType: (params?: RawCreateParams) => ZodBoolean;
|
|
1632
|
+
declare const dateType: (params?: RawCreateParams) => ZodDate;
|
|
1633
|
+
declare const undefinedType: (params?: RawCreateParams) => ZodUndefined;
|
|
1634
|
+
declare const nullType: (params?: RawCreateParams) => ZodNull;
|
|
1635
|
+
declare const anyType: (params?: RawCreateParams) => ZodAny;
|
|
1636
|
+
declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
|
|
1637
|
+
declare const neverType: (params?: RawCreateParams) => ZodNever;
|
|
1638
|
+
declare const voidType: (params?: RawCreateParams) => ZodVoid;
|
|
1639
|
+
declare const arrayType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T, "many">;
|
|
1640
|
+
declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T]: T[k]["_output"]; }>]: objectUtil.addQuestionMarks<{ [k in keyof T]: T[k]["_output"]; }>[k_1]; }, { [k_3 in keyof objectUtil.addQuestionMarks<{ [k_2 in keyof T]: T[k_2]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_2 in keyof T]: T[k_2]["_input"]; }>[k_3]; }>;
|
|
1641
|
+
declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T]: T[k]["_output"]; }>]: objectUtil.addQuestionMarks<{ [k in keyof T]: T[k]["_output"]; }>[k_1]; }, { [k_3 in keyof objectUtil.addQuestionMarks<{ [k_2 in keyof T]: T[k_2]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_2 in keyof T]: T[k_2]["_input"]; }>[k_3]; }>;
|
|
1642
|
+
declare const unionType: <T extends [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T, params?: RawCreateParams) => ZodUnion<T>;
|
|
1643
|
+
declare const intersectionType: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
|
|
1644
|
+
declare const tupleType: <T extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: T, params?: RawCreateParams) => ZodTuple<T, null>;
|
|
1645
|
+
declare const recordType: typeof ZodRecord.create;
|
|
1646
|
+
declare const mapType: <Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>(keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap<Key, Value>;
|
|
1647
|
+
declare const setType: <Value extends ZodTypeAny = ZodTypeAny>(valueType: Value, params?: RawCreateParams) => ZodSet<Value>;
|
|
1648
|
+
declare const functionType: <T extends ZodTuple<any, any> = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args?: T | undefined, returns?: U | undefined, params?: RawCreateParams) => ZodFunction<T, U>;
|
|
1649
|
+
declare const lazyType: <T extends ZodTypeAny>(getter: () => T, params?: RawCreateParams) => ZodLazy<T>;
|
|
1650
|
+
declare const literalType: <T extends Primitive>(value: T, params?: RawCreateParams) => ZodLiteral<T>;
|
|
1651
|
+
declare const enumType: typeof createZodEnum;
|
|
1652
|
+
declare const nativeEnumType: <T extends EnumLike>(values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
|
|
1653
|
+
declare const promiseType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodPromise<T>;
|
|
1654
|
+
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], I["_input"]>;
|
|
1655
|
+
declare const optionalType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodOptional<T>;
|
|
1656
|
+
declare const nullableType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodNullable<T>;
|
|
1657
|
+
declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], I["_input"]>;
|
|
1658
|
+
declare const ostring: () => ZodOptional<ZodString>;
|
|
1659
|
+
declare const onumber: () => ZodOptional<ZodNumber>;
|
|
1660
|
+
declare const oboolean: () => ZodOptional<ZodBoolean>;
|
|
1661
|
+
|
|
1662
|
+
//# sourceMappingURL=external.d.ts.map
|
|
1663
|
+
|
|
1664
|
+
type external_d_ZodParsedType = ZodParsedType;
|
|
1665
|
+
declare const external_d_getParsedType: typeof getParsedType;
|
|
1666
|
+
declare const external_d_makeIssue: typeof makeIssue;
|
|
1667
|
+
type external_d_ParseParams = ParseParams;
|
|
1668
|
+
type external_d_ParsePathComponent = ParsePathComponent;
|
|
1669
|
+
type external_d_ParsePath = ParsePath;
|
|
1670
|
+
declare const external_d_EMPTY_PATH: typeof EMPTY_PATH;
|
|
1671
|
+
type external_d_ParseContext = ParseContext;
|
|
1672
|
+
type external_d_ParseInput = ParseInput;
|
|
1673
|
+
declare const external_d_addIssueToContext: typeof addIssueToContext;
|
|
1674
|
+
type external_d_ObjectPair = ObjectPair;
|
|
1675
|
+
type external_d_ParseStatus = ParseStatus;
|
|
1676
|
+
declare const external_d_ParseStatus: typeof ParseStatus;
|
|
1677
|
+
type external_d_ParseResult = ParseResult;
|
|
1678
|
+
declare const external_d_INVALID: typeof INVALID;
|
|
1679
|
+
declare const external_d_DIRTY: typeof DIRTY;
|
|
1680
|
+
declare const external_d_OK: typeof OK;
|
|
1681
|
+
type external_d_SyncParseReturnType<T = any> = SyncParseReturnType<T>;
|
|
1682
|
+
type external_d_AsyncParseReturnType<T> = AsyncParseReturnType<T>;
|
|
1683
|
+
type external_d_ParseReturnType<T> = ParseReturnType<T>;
|
|
1684
|
+
declare const external_d_isAborted: typeof isAborted;
|
|
1685
|
+
declare const external_d_isDirty: typeof isDirty;
|
|
1686
|
+
declare const external_d_isValid: typeof isValid;
|
|
1687
|
+
declare const external_d_isAsync: typeof isAsync;
|
|
1688
|
+
declare const external_d_oboolean: typeof oboolean;
|
|
1689
|
+
declare const external_d_onumber: typeof onumber;
|
|
1690
|
+
declare const external_d_ostring: typeof ostring;
|
|
1691
|
+
type external_d_RefinementCtx = RefinementCtx;
|
|
1692
|
+
type external_d_ZodRawShape = ZodRawShape;
|
|
1693
|
+
type external_d_ZodTypeAny = ZodTypeAny;
|
|
1694
|
+
type external_d_TypeOf<T extends ZodType<any, any, any>> = TypeOf<T>;
|
|
1695
|
+
type external_d_input<T extends ZodType<any, any, any>> = input<T>;
|
|
1696
|
+
type external_d_output<T extends ZodType<any, any, any>> = output<T>;
|
|
1697
|
+
type external_d_CustomErrorParams = CustomErrorParams;
|
|
1698
|
+
type external_d_ZodTypeDef = ZodTypeDef;
|
|
1699
|
+
type external_d_SafeParseSuccess<Output> = SafeParseSuccess<Output>;
|
|
1700
|
+
type external_d_SafeParseError<Input> = SafeParseError<Input>;
|
|
1701
|
+
type external_d_SafeParseReturnType<Input, Output> = SafeParseReturnType<Input, Output>;
|
|
1702
|
+
type external_d_ZodType<Output, Def extends ZodTypeDef = ZodTypeDef, Input = Output> = ZodType<Output, Def, Input>;
|
|
1703
|
+
declare const external_d_ZodType: typeof ZodType;
|
|
1704
|
+
type external_d_ZodStringDef = ZodStringDef;
|
|
1705
|
+
type external_d_ZodString = ZodString;
|
|
1706
|
+
declare const external_d_ZodString: typeof ZodString;
|
|
1707
|
+
type external_d_ZodNumberDef = ZodNumberDef;
|
|
1708
|
+
type external_d_ZodNumber = ZodNumber;
|
|
1709
|
+
declare const external_d_ZodNumber: typeof ZodNumber;
|
|
1710
|
+
type external_d_ZodBigIntDef = ZodBigIntDef;
|
|
1711
|
+
type external_d_ZodBigInt = ZodBigInt;
|
|
1712
|
+
declare const external_d_ZodBigInt: typeof ZodBigInt;
|
|
1713
|
+
type external_d_ZodBooleanDef = ZodBooleanDef;
|
|
1714
|
+
type external_d_ZodBoolean = ZodBoolean;
|
|
1715
|
+
declare const external_d_ZodBoolean: typeof ZodBoolean;
|
|
1716
|
+
type external_d_ZodDateDef = ZodDateDef;
|
|
1717
|
+
type external_d_ZodDate = ZodDate;
|
|
1718
|
+
declare const external_d_ZodDate: typeof ZodDate;
|
|
1719
|
+
type external_d_ZodUndefinedDef = ZodUndefinedDef;
|
|
1720
|
+
type external_d_ZodUndefined = ZodUndefined;
|
|
1721
|
+
declare const external_d_ZodUndefined: typeof ZodUndefined;
|
|
1722
|
+
type external_d_ZodNullDef = ZodNullDef;
|
|
1723
|
+
type external_d_ZodNull = ZodNull;
|
|
1724
|
+
declare const external_d_ZodNull: typeof ZodNull;
|
|
1725
|
+
type external_d_ZodAnyDef = ZodAnyDef;
|
|
1726
|
+
type external_d_ZodAny = ZodAny;
|
|
1727
|
+
declare const external_d_ZodAny: typeof ZodAny;
|
|
1728
|
+
type external_d_ZodUnknownDef = ZodUnknownDef;
|
|
1729
|
+
type external_d_ZodUnknown = ZodUnknown;
|
|
1730
|
+
declare const external_d_ZodUnknown: typeof ZodUnknown;
|
|
1731
|
+
type external_d_ZodNeverDef = ZodNeverDef;
|
|
1732
|
+
type external_d_ZodNever = ZodNever;
|
|
1733
|
+
declare const external_d_ZodNever: typeof ZodNever;
|
|
1734
|
+
type external_d_ZodVoidDef = ZodVoidDef;
|
|
1735
|
+
type external_d_ZodVoid = ZodVoid;
|
|
1736
|
+
declare const external_d_ZodVoid: typeof ZodVoid;
|
|
1737
|
+
type external_d_ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> = ZodArrayDef<T>;
|
|
1738
|
+
type external_d_ArrayCardinality = ArrayCardinality;
|
|
1739
|
+
type external_d_ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = ZodArray<T, Cardinality>;
|
|
1740
|
+
declare const external_d_ZodArray: typeof ZodArray;
|
|
1741
|
+
type external_d_ZodNonEmptyArray<T extends ZodTypeAny> = ZodNonEmptyArray<T>;
|
|
1742
|
+
declare const external_d_objectUtil: typeof objectUtil;
|
|
1743
|
+
type external_d_extendShape<A, B> = extendShape<A, B>;
|
|
1744
|
+
type external_d_Primitive = Primitive;
|
|
1745
|
+
type external_d_Scalars = Scalars;
|
|
1746
|
+
type external_d_ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> = ZodObjectDef<T, UnknownKeys, Catchall>;
|
|
1747
|
+
type external_d_baseObjectOutputType<Shape extends ZodRawShape> = baseObjectOutputType<Shape>;
|
|
1748
|
+
type external_d_objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = objectOutputType<Shape, Catchall>;
|
|
1749
|
+
type external_d_baseObjectInputType<Shape extends ZodRawShape> = baseObjectInputType<Shape>;
|
|
1750
|
+
type external_d_objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = objectInputType<Shape, Catchall>;
|
|
1751
|
+
type external_d_SomeZodObject = SomeZodObject;
|
|
1752
|
+
type external_d_ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = "strip", Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall>, Input = objectInputType<T, Catchall>> = ZodObject<T, UnknownKeys, Catchall, Output, Input>;
|
|
1753
|
+
declare const external_d_ZodObject: typeof ZodObject;
|
|
1754
|
+
type external_d_AnyZodObject = AnyZodObject;
|
|
1755
|
+
type external_d_ZodUnionDef<T extends ZodUnionOptions = [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]> = ZodUnionDef<T>;
|
|
1756
|
+
type external_d_ZodUnion<T extends ZodUnionOptions> = ZodUnion<T>;
|
|
1757
|
+
declare const external_d_ZodUnion: typeof ZodUnion;
|
|
1758
|
+
type external_d_ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> = ZodIntersectionDef<T, U>;
|
|
1759
|
+
type external_d_ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> = ZodIntersection<T, U>;
|
|
1760
|
+
declare const external_d_ZodIntersection: typeof ZodIntersection;
|
|
1761
|
+
type external_d_ZodTupleItems = ZodTupleItems;
|
|
1762
|
+
type external_d_AssertArray<T extends any> = AssertArray<T>;
|
|
1763
|
+
type external_d_OutputTypeOfTuple<T extends ZodTupleItems | []> = OutputTypeOfTuple<T>;
|
|
1764
|
+
type external_d_OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = OutputTypeOfTupleWithRest<T, Rest>;
|
|
1765
|
+
type external_d_InputTypeOfTuple<T extends ZodTupleItems | []> = InputTypeOfTuple<T>;
|
|
1766
|
+
type external_d_InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = InputTypeOfTupleWithRest<T, Rest>;
|
|
1767
|
+
type external_d_ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> = ZodTupleDef<T, Rest>;
|
|
1768
|
+
type external_d_ZodTuple<T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> = ZodTuple<T, Rest>;
|
|
1769
|
+
declare const external_d_ZodTuple: typeof ZodTuple;
|
|
1770
|
+
type external_d_ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> = ZodRecordDef<Key, Value>;
|
|
1771
|
+
type external_d_ZodRecord<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> = ZodRecord<Key, Value>;
|
|
1772
|
+
declare const external_d_ZodRecord: typeof ZodRecord;
|
|
1773
|
+
type external_d_ZodMapDef<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> = ZodMapDef<Key, Value>;
|
|
1774
|
+
type external_d_ZodMap<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> = ZodMap<Key, Value>;
|
|
1775
|
+
declare const external_d_ZodMap: typeof ZodMap;
|
|
1776
|
+
type external_d_ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> = ZodSetDef<Value>;
|
|
1777
|
+
type external_d_ZodSet<Value extends ZodTypeAny = ZodTypeAny> = ZodSet<Value>;
|
|
1778
|
+
declare const external_d_ZodSet: typeof ZodSet;
|
|
1779
|
+
type external_d_ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> = ZodFunctionDef<Args, Returns>;
|
|
1780
|
+
type external_d_OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = OuterTypeOfFunction<Args, Returns>;
|
|
1781
|
+
type external_d_InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = InnerTypeOfFunction<Args, Returns>;
|
|
1782
|
+
type external_d_ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = ZodFunction<Args, Returns>;
|
|
1783
|
+
declare const external_d_ZodFunction: typeof ZodFunction;
|
|
1784
|
+
type external_d_ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> = ZodLazyDef<T>;
|
|
1785
|
+
type external_d_ZodLazy<T extends ZodTypeAny> = ZodLazy<T>;
|
|
1786
|
+
declare const external_d_ZodLazy: typeof ZodLazy;
|
|
1787
|
+
type external_d_ZodLiteralDef<T extends any = any> = ZodLiteralDef<T>;
|
|
1788
|
+
type external_d_ZodLiteral<T extends any> = ZodLiteral<T>;
|
|
1789
|
+
declare const external_d_ZodLiteral: typeof ZodLiteral;
|
|
1790
|
+
type external_d_ArrayKeys = ArrayKeys;
|
|
1791
|
+
type external_d_Indices<T> = Indices<T>;
|
|
1792
|
+
type external_d_ZodEnumDef<T extends EnumValues = EnumValues> = ZodEnumDef<T>;
|
|
1793
|
+
type external_d_ZodEnum<T extends [string, ...string[]]> = ZodEnum<T>;
|
|
1794
|
+
declare const external_d_ZodEnum: typeof ZodEnum;
|
|
1795
|
+
type external_d_ZodNativeEnumDef<T extends EnumLike = EnumLike> = ZodNativeEnumDef<T>;
|
|
1796
|
+
type external_d_ZodNativeEnum<T extends EnumLike> = ZodNativeEnum<T>;
|
|
1797
|
+
declare const external_d_ZodNativeEnum: typeof ZodNativeEnum;
|
|
1798
|
+
type external_d_ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> = ZodPromiseDef<T>;
|
|
1799
|
+
type external_d_ZodPromise<T extends ZodTypeAny> = ZodPromise<T>;
|
|
1800
|
+
declare const external_d_ZodPromise: typeof ZodPromise;
|
|
1801
|
+
type external_d_Refinement<T> = Refinement<T>;
|
|
1802
|
+
type external_d_SuperRefinement<T> = SuperRefinement<T>;
|
|
1803
|
+
type external_d_RefinementEffect<T> = RefinementEffect<T>;
|
|
1804
|
+
type external_d_TransformEffect<T> = TransformEffect<T>;
|
|
1805
|
+
type external_d_PreprocessEffect<T> = PreprocessEffect<T>;
|
|
1806
|
+
type external_d_Effect<T> = Effect<T>;
|
|
1807
|
+
type external_d_ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> = ZodEffectsDef<T>;
|
|
1808
|
+
type external_d_ZodEffects<T extends ZodTypeAny, Output = T["_output"], Input = T["_input"]> = ZodEffects<T, Output, Input>;
|
|
1809
|
+
declare const external_d_ZodEffects: typeof ZodEffects;
|
|
1810
|
+
type external_d_ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> = ZodOptionalDef<T>;
|
|
1811
|
+
type external_d_ZodOptionalType<T extends ZodTypeAny> = ZodOptionalType<T>;
|
|
1812
|
+
type external_d_ZodOptional<T extends ZodTypeAny> = ZodOptional<T>;
|
|
1813
|
+
declare const external_d_ZodOptional: typeof ZodOptional;
|
|
1814
|
+
type external_d_ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> = ZodNullableDef<T>;
|
|
1815
|
+
type external_d_ZodNullableType<T extends ZodTypeAny> = ZodNullableType<T>;
|
|
1816
|
+
type external_d_ZodNullable<T extends ZodTypeAny> = ZodNullable<T>;
|
|
1817
|
+
declare const external_d_ZodNullable: typeof ZodNullable;
|
|
1818
|
+
type external_d_ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> = ZodDefaultDef<T>;
|
|
1819
|
+
type external_d_ZodDefault<T extends ZodTypeAny> = ZodDefault<T>;
|
|
1820
|
+
declare const external_d_ZodDefault: typeof ZodDefault;
|
|
1821
|
+
declare const external_d_custom: typeof custom;
|
|
1822
|
+
declare const external_d_late: typeof late;
|
|
1823
|
+
type external_d_ZodFirstPartyTypeKind = ZodFirstPartyTypeKind;
|
|
1824
|
+
declare const external_d_ZodFirstPartyTypeKind: typeof ZodFirstPartyTypeKind;
|
|
1825
|
+
type external_d_ZodFirstPartySchemaTypes = ZodFirstPartySchemaTypes;
|
|
1826
|
+
type external_d_ZodIssueCode = ZodIssueCode;
|
|
1827
|
+
type external_d_ZodIssueBase = ZodIssueBase;
|
|
1828
|
+
type external_d_ZodInvalidTypeIssue = ZodInvalidTypeIssue;
|
|
1829
|
+
type external_d_ZodUnrecognizedKeysIssue = ZodUnrecognizedKeysIssue;
|
|
1830
|
+
type external_d_ZodInvalidUnionIssue = ZodInvalidUnionIssue;
|
|
1831
|
+
type external_d_ZodInvalidEnumValueIssue = ZodInvalidEnumValueIssue;
|
|
1832
|
+
type external_d_ZodInvalidArgumentsIssue = ZodInvalidArgumentsIssue;
|
|
1833
|
+
type external_d_ZodInvalidReturnTypeIssue = ZodInvalidReturnTypeIssue;
|
|
1834
|
+
type external_d_ZodInvalidDateIssue = ZodInvalidDateIssue;
|
|
1835
|
+
type external_d_StringValidation = StringValidation;
|
|
1836
|
+
type external_d_ZodInvalidStringIssue = ZodInvalidStringIssue;
|
|
1837
|
+
type external_d_ZodTooSmallIssue = ZodTooSmallIssue;
|
|
1838
|
+
type external_d_ZodTooBigIssue = ZodTooBigIssue;
|
|
1839
|
+
type external_d_ZodInvalidIntersectionTypesIssue = ZodInvalidIntersectionTypesIssue;
|
|
1840
|
+
type external_d_ZodNotMultipleOfIssue = ZodNotMultipleOfIssue;
|
|
1841
|
+
type external_d_ZodCustomIssue = ZodCustomIssue;
|
|
1842
|
+
type external_d_DenormalizedError = DenormalizedError;
|
|
1843
|
+
type external_d_ZodIssueOptionalMessage = ZodIssueOptionalMessage;
|
|
1844
|
+
type external_d_ZodIssue = ZodIssue;
|
|
1845
|
+
declare const external_d_quotelessJson: typeof quotelessJson;
|
|
1846
|
+
type external_d_ZodFormattedError<T> = ZodFormattedError<T>;
|
|
1847
|
+
type external_d_ZodError<T = any> = ZodError<T>;
|
|
1848
|
+
declare const external_d_ZodError: typeof ZodError;
|
|
1849
|
+
type external_d_IssueData = IssueData;
|
|
1850
|
+
type external_d_MakeErrorData = MakeErrorData;
|
|
1851
|
+
type external_d_ZodErrorMap = ZodErrorMap;
|
|
1852
|
+
declare const external_d_defaultErrorMap: typeof defaultErrorMap;
|
|
1853
|
+
declare const external_d_overrideErrorMap: typeof overrideErrorMap;
|
|
1854
|
+
declare const external_d_setErrorMap: typeof setErrorMap;
|
|
1855
|
+
declare namespace external_d {
|
|
1856
|
+
export {
|
|
1857
|
+
external_d_ZodParsedType as ZodParsedType,
|
|
1858
|
+
external_d_getParsedType as getParsedType,
|
|
1859
|
+
external_d_makeIssue as makeIssue,
|
|
1860
|
+
external_d_ParseParams as ParseParams,
|
|
1861
|
+
external_d_ParsePathComponent as ParsePathComponent,
|
|
1862
|
+
external_d_ParsePath as ParsePath,
|
|
1863
|
+
external_d_EMPTY_PATH as EMPTY_PATH,
|
|
1864
|
+
external_d_ParseContext as ParseContext,
|
|
1865
|
+
external_d_ParseInput as ParseInput,
|
|
1866
|
+
external_d_addIssueToContext as addIssueToContext,
|
|
1867
|
+
external_d_ObjectPair as ObjectPair,
|
|
1868
|
+
external_d_ParseStatus as ParseStatus,
|
|
1869
|
+
external_d_ParseResult as ParseResult,
|
|
1870
|
+
external_d_INVALID as INVALID,
|
|
1871
|
+
external_d_DIRTY as DIRTY,
|
|
1872
|
+
external_d_OK as OK,
|
|
1873
|
+
external_d_SyncParseReturnType as SyncParseReturnType,
|
|
1874
|
+
external_d_AsyncParseReturnType as AsyncParseReturnType,
|
|
1875
|
+
external_d_ParseReturnType as ParseReturnType,
|
|
1876
|
+
external_d_isAborted as isAborted,
|
|
1877
|
+
external_d_isDirty as isDirty,
|
|
1878
|
+
external_d_isValid as isValid,
|
|
1879
|
+
external_d_isAsync as isAsync,
|
|
1880
|
+
TypeOf as infer,
|
|
1881
|
+
ZodEffects as ZodTransformer,
|
|
1882
|
+
ZodType as Schema,
|
|
1883
|
+
ZodType as ZodSchema,
|
|
1884
|
+
anyType as any,
|
|
1885
|
+
arrayType as array,
|
|
1886
|
+
bigIntType as bigint,
|
|
1887
|
+
booleanType as boolean,
|
|
1888
|
+
dateType as date,
|
|
1889
|
+
effectsType as effect,
|
|
1890
|
+
enumType as enum,
|
|
1891
|
+
functionType as function,
|
|
1892
|
+
instanceOfType as instanceof,
|
|
1893
|
+
intersectionType as intersection,
|
|
1894
|
+
lazyType as lazy,
|
|
1895
|
+
literalType as literal,
|
|
1896
|
+
mapType as map,
|
|
1897
|
+
nativeEnumType as nativeEnum,
|
|
1898
|
+
neverType as never,
|
|
1899
|
+
nullType as null,
|
|
1900
|
+
nullableType as nullable,
|
|
1901
|
+
numberType as number,
|
|
1902
|
+
objectType as object,
|
|
1903
|
+
external_d_oboolean as oboolean,
|
|
1904
|
+
external_d_onumber as onumber,
|
|
1905
|
+
optionalType as optional,
|
|
1906
|
+
external_d_ostring as ostring,
|
|
1907
|
+
preprocessType as preprocess,
|
|
1908
|
+
promiseType as promise,
|
|
1909
|
+
recordType as record,
|
|
1910
|
+
setType as set,
|
|
1911
|
+
strictObjectType as strictObject,
|
|
1912
|
+
stringType as string,
|
|
1913
|
+
effectsType as transformer,
|
|
1914
|
+
tupleType as tuple,
|
|
1915
|
+
undefinedType as undefined,
|
|
1916
|
+
unionType as union,
|
|
1917
|
+
unknownType as unknown,
|
|
1918
|
+
voidType as void,
|
|
1919
|
+
external_d_RefinementCtx as RefinementCtx,
|
|
1920
|
+
external_d_ZodRawShape as ZodRawShape,
|
|
1921
|
+
external_d_ZodTypeAny as ZodTypeAny,
|
|
1922
|
+
external_d_TypeOf as TypeOf,
|
|
1923
|
+
external_d_input as input,
|
|
1924
|
+
external_d_output as output,
|
|
1925
|
+
external_d_CustomErrorParams as CustomErrorParams,
|
|
1926
|
+
external_d_ZodTypeDef as ZodTypeDef,
|
|
1927
|
+
external_d_SafeParseSuccess as SafeParseSuccess,
|
|
1928
|
+
external_d_SafeParseError as SafeParseError,
|
|
1929
|
+
external_d_SafeParseReturnType as SafeParseReturnType,
|
|
1930
|
+
external_d_ZodType as ZodType,
|
|
1931
|
+
external_d_ZodStringDef as ZodStringDef,
|
|
1932
|
+
external_d_ZodString as ZodString,
|
|
1933
|
+
external_d_ZodNumberDef as ZodNumberDef,
|
|
1934
|
+
external_d_ZodNumber as ZodNumber,
|
|
1935
|
+
external_d_ZodBigIntDef as ZodBigIntDef,
|
|
1936
|
+
external_d_ZodBigInt as ZodBigInt,
|
|
1937
|
+
external_d_ZodBooleanDef as ZodBooleanDef,
|
|
1938
|
+
external_d_ZodBoolean as ZodBoolean,
|
|
1939
|
+
external_d_ZodDateDef as ZodDateDef,
|
|
1940
|
+
external_d_ZodDate as ZodDate,
|
|
1941
|
+
external_d_ZodUndefinedDef as ZodUndefinedDef,
|
|
1942
|
+
external_d_ZodUndefined as ZodUndefined,
|
|
1943
|
+
external_d_ZodNullDef as ZodNullDef,
|
|
1944
|
+
external_d_ZodNull as ZodNull,
|
|
1945
|
+
external_d_ZodAnyDef as ZodAnyDef,
|
|
1946
|
+
external_d_ZodAny as ZodAny,
|
|
1947
|
+
external_d_ZodUnknownDef as ZodUnknownDef,
|
|
1948
|
+
external_d_ZodUnknown as ZodUnknown,
|
|
1949
|
+
external_d_ZodNeverDef as ZodNeverDef,
|
|
1950
|
+
external_d_ZodNever as ZodNever,
|
|
1951
|
+
external_d_ZodVoidDef as ZodVoidDef,
|
|
1952
|
+
external_d_ZodVoid as ZodVoid,
|
|
1953
|
+
external_d_ZodArrayDef as ZodArrayDef,
|
|
1954
|
+
external_d_ArrayCardinality as ArrayCardinality,
|
|
1955
|
+
external_d_ZodArray as ZodArray,
|
|
1956
|
+
external_d_ZodNonEmptyArray as ZodNonEmptyArray,
|
|
1957
|
+
external_d_objectUtil as objectUtil,
|
|
1958
|
+
external_d_extendShape as extendShape,
|
|
1959
|
+
external_d_Primitive as Primitive,
|
|
1960
|
+
external_d_Scalars as Scalars,
|
|
1961
|
+
external_d_ZodObjectDef as ZodObjectDef,
|
|
1962
|
+
external_d_baseObjectOutputType as baseObjectOutputType,
|
|
1963
|
+
external_d_objectOutputType as objectOutputType,
|
|
1964
|
+
external_d_baseObjectInputType as baseObjectInputType,
|
|
1965
|
+
external_d_objectInputType as objectInputType,
|
|
1966
|
+
external_d_SomeZodObject as SomeZodObject,
|
|
1967
|
+
external_d_ZodObject as ZodObject,
|
|
1968
|
+
external_d_AnyZodObject as AnyZodObject,
|
|
1969
|
+
external_d_ZodUnionDef as ZodUnionDef,
|
|
1970
|
+
external_d_ZodUnion as ZodUnion,
|
|
1971
|
+
external_d_ZodIntersectionDef as ZodIntersectionDef,
|
|
1972
|
+
external_d_ZodIntersection as ZodIntersection,
|
|
1973
|
+
external_d_ZodTupleItems as ZodTupleItems,
|
|
1974
|
+
external_d_AssertArray as AssertArray,
|
|
1975
|
+
external_d_OutputTypeOfTuple as OutputTypeOfTuple,
|
|
1976
|
+
external_d_OutputTypeOfTupleWithRest as OutputTypeOfTupleWithRest,
|
|
1977
|
+
external_d_InputTypeOfTuple as InputTypeOfTuple,
|
|
1978
|
+
external_d_InputTypeOfTupleWithRest as InputTypeOfTupleWithRest,
|
|
1979
|
+
external_d_ZodTupleDef as ZodTupleDef,
|
|
1980
|
+
external_d_ZodTuple as ZodTuple,
|
|
1981
|
+
external_d_ZodRecordDef as ZodRecordDef,
|
|
1982
|
+
external_d_ZodRecord as ZodRecord,
|
|
1983
|
+
external_d_ZodMapDef as ZodMapDef,
|
|
1984
|
+
external_d_ZodMap as ZodMap,
|
|
1985
|
+
external_d_ZodSetDef as ZodSetDef,
|
|
1986
|
+
external_d_ZodSet as ZodSet,
|
|
1987
|
+
external_d_ZodFunctionDef as ZodFunctionDef,
|
|
1988
|
+
external_d_OuterTypeOfFunction as OuterTypeOfFunction,
|
|
1989
|
+
external_d_InnerTypeOfFunction as InnerTypeOfFunction,
|
|
1990
|
+
external_d_ZodFunction as ZodFunction,
|
|
1991
|
+
external_d_ZodLazyDef as ZodLazyDef,
|
|
1992
|
+
external_d_ZodLazy as ZodLazy,
|
|
1993
|
+
external_d_ZodLiteralDef as ZodLiteralDef,
|
|
1994
|
+
external_d_ZodLiteral as ZodLiteral,
|
|
1995
|
+
external_d_ArrayKeys as ArrayKeys,
|
|
1996
|
+
external_d_Indices as Indices,
|
|
1997
|
+
external_d_ZodEnumDef as ZodEnumDef,
|
|
1998
|
+
external_d_ZodEnum as ZodEnum,
|
|
1999
|
+
external_d_ZodNativeEnumDef as ZodNativeEnumDef,
|
|
2000
|
+
external_d_ZodNativeEnum as ZodNativeEnum,
|
|
2001
|
+
external_d_ZodPromiseDef as ZodPromiseDef,
|
|
2002
|
+
external_d_ZodPromise as ZodPromise,
|
|
2003
|
+
external_d_Refinement as Refinement,
|
|
2004
|
+
external_d_SuperRefinement as SuperRefinement,
|
|
2005
|
+
external_d_RefinementEffect as RefinementEffect,
|
|
2006
|
+
external_d_TransformEffect as TransformEffect,
|
|
2007
|
+
external_d_PreprocessEffect as PreprocessEffect,
|
|
2008
|
+
external_d_Effect as Effect,
|
|
2009
|
+
external_d_ZodEffectsDef as ZodEffectsDef,
|
|
2010
|
+
external_d_ZodEffects as ZodEffects,
|
|
2011
|
+
external_d_ZodOptionalDef as ZodOptionalDef,
|
|
2012
|
+
external_d_ZodOptionalType as ZodOptionalType,
|
|
2013
|
+
external_d_ZodOptional as ZodOptional,
|
|
2014
|
+
external_d_ZodNullableDef as ZodNullableDef,
|
|
2015
|
+
external_d_ZodNullableType as ZodNullableType,
|
|
2016
|
+
external_d_ZodNullable as ZodNullable,
|
|
2017
|
+
external_d_ZodDefaultDef as ZodDefaultDef,
|
|
2018
|
+
external_d_ZodDefault as ZodDefault,
|
|
2019
|
+
external_d_custom as custom,
|
|
2020
|
+
external_d_late as late,
|
|
2021
|
+
external_d_ZodFirstPartyTypeKind as ZodFirstPartyTypeKind,
|
|
2022
|
+
external_d_ZodFirstPartySchemaTypes as ZodFirstPartySchemaTypes,
|
|
2023
|
+
external_d_ZodIssueCode as ZodIssueCode,
|
|
2024
|
+
external_d_ZodIssueBase as ZodIssueBase,
|
|
2025
|
+
external_d_ZodInvalidTypeIssue as ZodInvalidTypeIssue,
|
|
2026
|
+
external_d_ZodUnrecognizedKeysIssue as ZodUnrecognizedKeysIssue,
|
|
2027
|
+
external_d_ZodInvalidUnionIssue as ZodInvalidUnionIssue,
|
|
2028
|
+
external_d_ZodInvalidEnumValueIssue as ZodInvalidEnumValueIssue,
|
|
2029
|
+
external_d_ZodInvalidArgumentsIssue as ZodInvalidArgumentsIssue,
|
|
2030
|
+
external_d_ZodInvalidReturnTypeIssue as ZodInvalidReturnTypeIssue,
|
|
2031
|
+
external_d_ZodInvalidDateIssue as ZodInvalidDateIssue,
|
|
2032
|
+
external_d_StringValidation as StringValidation,
|
|
2033
|
+
external_d_ZodInvalidStringIssue as ZodInvalidStringIssue,
|
|
2034
|
+
external_d_ZodTooSmallIssue as ZodTooSmallIssue,
|
|
2035
|
+
external_d_ZodTooBigIssue as ZodTooBigIssue,
|
|
2036
|
+
external_d_ZodInvalidIntersectionTypesIssue as ZodInvalidIntersectionTypesIssue,
|
|
2037
|
+
external_d_ZodNotMultipleOfIssue as ZodNotMultipleOfIssue,
|
|
2038
|
+
external_d_ZodCustomIssue as ZodCustomIssue,
|
|
2039
|
+
external_d_DenormalizedError as DenormalizedError,
|
|
2040
|
+
external_d_ZodIssueOptionalMessage as ZodIssueOptionalMessage,
|
|
2041
|
+
external_d_ZodIssue as ZodIssue,
|
|
2042
|
+
external_d_quotelessJson as quotelessJson,
|
|
2043
|
+
external_d_ZodFormattedError as ZodFormattedError,
|
|
2044
|
+
external_d_ZodError as ZodError,
|
|
2045
|
+
external_d_IssueData as IssueData,
|
|
2046
|
+
external_d_MakeErrorData as MakeErrorData,
|
|
2047
|
+
external_d_ZodErrorMap as ZodErrorMap,
|
|
2048
|
+
external_d_defaultErrorMap as defaultErrorMap,
|
|
2049
|
+
external_d_overrideErrorMap as overrideErrorMap,
|
|
2050
|
+
external_d_setErrorMap as setErrorMap,
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
declare namespace schema {
|
|
2055
|
+
export {
|
|
2056
|
+
external_d as define,
|
|
2057
|
+
};
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
/**
|
|
2061
|
+
* This schema represents the format of the session
|
|
2062
|
+
* that we cache in the system to avoid unnecessary
|
|
2063
|
+
* token exchanges.
|
|
2064
|
+
*
|
|
2065
|
+
* @example
|
|
2066
|
+
* {
|
|
2067
|
+
* "accounts.shopify.com": {...}
|
|
2068
|
+
* "identity.spin.com": {...}
|
|
2069
|
+
* }
|
|
2070
|
+
*
|
|
2071
|
+
*/
|
|
2072
|
+
declare const SessionSchema: ZodObject<{}, "strip", ZodObject<{
|
|
2073
|
+
/**
|
|
2074
|
+
* It contains the identity token. Before usint it, we exchange it
|
|
2075
|
+
* to get a token that we can use with different applications. The exchanged
|
|
2076
|
+
* tokens for the applications are stored under applications.
|
|
2077
|
+
*/
|
|
2078
|
+
identity: ZodObject<{
|
|
2079
|
+
accessToken: ZodString;
|
|
2080
|
+
refreshToken: ZodString;
|
|
2081
|
+
expiresAt: ZodEffects<ZodDate, Date, Date>;
|
|
2082
|
+
scopes: ZodArray<ZodString, "many">;
|
|
2083
|
+
}, "strip", ZodTypeAny, {
|
|
2084
|
+
accessToken: string;
|
|
2085
|
+
refreshToken: string;
|
|
2086
|
+
expiresAt: Date;
|
|
2087
|
+
scopes: string[];
|
|
2088
|
+
}, {
|
|
2089
|
+
accessToken: string;
|
|
2090
|
+
refreshToken: string;
|
|
2091
|
+
expiresAt: Date;
|
|
2092
|
+
scopes: string[];
|
|
2093
|
+
}>;
|
|
2094
|
+
/**
|
|
2095
|
+
* It contains exchanged tokens for the applications the CLI
|
|
2096
|
+
* authenticates with. Tokens are scoped under the fqdn of the applications.
|
|
2097
|
+
*/
|
|
2098
|
+
applications: ZodObject<{
|
|
2099
|
+
/**
|
|
2100
|
+
* Exchanged tokens for Admin applications.
|
|
2101
|
+
*/
|
|
2102
|
+
adminApi: ZodObject<{}, "strip", ZodObject<{
|
|
2103
|
+
accessToken: ZodString;
|
|
2104
|
+
expiresAt: ZodEffects<ZodDate, Date, Date>;
|
|
2105
|
+
scopes: ZodArray<ZodString, "many">;
|
|
2106
|
+
}, "strip", ZodTypeAny, {
|
|
2107
|
+
accessToken: string;
|
|
2108
|
+
expiresAt: Date;
|
|
2109
|
+
scopes: string[];
|
|
2110
|
+
}, {
|
|
2111
|
+
accessToken: string;
|
|
2112
|
+
expiresAt: Date;
|
|
2113
|
+
scopes: string[];
|
|
2114
|
+
}>, {
|
|
2115
|
+
[x: string]: {
|
|
2116
|
+
accessToken: string;
|
|
2117
|
+
expiresAt: Date;
|
|
2118
|
+
scopes: string[];
|
|
2119
|
+
};
|
|
2120
|
+
}, {
|
|
2121
|
+
[x: string]: {
|
|
2122
|
+
accessToken: string;
|
|
2123
|
+
expiresAt: Date;
|
|
2124
|
+
scopes: string[];
|
|
2125
|
+
};
|
|
2126
|
+
}>;
|
|
2127
|
+
/**
|
|
2128
|
+
* Exchanged tokens for Partner applications.
|
|
2129
|
+
*/
|
|
2130
|
+
partnersApi: ZodObject<{}, "strip", ZodObject<{
|
|
2131
|
+
accessToken: ZodString;
|
|
2132
|
+
expiresAt: ZodEffects<ZodDate, Date, Date>;
|
|
2133
|
+
scopes: ZodArray<ZodString, "many">;
|
|
2134
|
+
}, "strip", ZodTypeAny, {
|
|
2135
|
+
accessToken: string;
|
|
2136
|
+
expiresAt: Date;
|
|
2137
|
+
scopes: string[];
|
|
2138
|
+
}, {
|
|
2139
|
+
accessToken: string;
|
|
2140
|
+
expiresAt: Date;
|
|
2141
|
+
scopes: string[];
|
|
2142
|
+
}>, {
|
|
2143
|
+
[x: string]: {
|
|
2144
|
+
accessToken: string;
|
|
2145
|
+
expiresAt: Date;
|
|
2146
|
+
scopes: string[];
|
|
2147
|
+
};
|
|
2148
|
+
}, {
|
|
2149
|
+
[x: string]: {
|
|
2150
|
+
accessToken: string;
|
|
2151
|
+
expiresAt: Date;
|
|
2152
|
+
scopes: string[];
|
|
2153
|
+
};
|
|
2154
|
+
}>;
|
|
2155
|
+
/**
|
|
2156
|
+
* Exchanged tokens for Storefront Renderer applications.
|
|
2157
|
+
*/
|
|
2158
|
+
storefrontRendererApi: ZodObject<{}, "strip", ZodObject<{
|
|
2159
|
+
accessToken: ZodString;
|
|
2160
|
+
expiresAt: ZodEffects<ZodDate, Date, Date>;
|
|
2161
|
+
scopes: ZodArray<ZodString, "many">;
|
|
2162
|
+
}, "strip", ZodTypeAny, {
|
|
2163
|
+
accessToken: string;
|
|
2164
|
+
expiresAt: Date;
|
|
2165
|
+
scopes: string[];
|
|
2166
|
+
}, {
|
|
2167
|
+
accessToken: string;
|
|
2168
|
+
expiresAt: Date;
|
|
2169
|
+
scopes: string[];
|
|
2170
|
+
}>, {
|
|
2171
|
+
[x: string]: {
|
|
2172
|
+
accessToken: string;
|
|
2173
|
+
expiresAt: Date;
|
|
2174
|
+
scopes: string[];
|
|
2175
|
+
};
|
|
2176
|
+
}, {
|
|
2177
|
+
[x: string]: {
|
|
2178
|
+
accessToken: string;
|
|
2179
|
+
expiresAt: Date;
|
|
2180
|
+
scopes: string[];
|
|
2181
|
+
};
|
|
2182
|
+
}>;
|
|
2183
|
+
}, "strip", ZodTypeAny, {
|
|
2184
|
+
adminApi: {
|
|
2185
|
+
[x: string]: {
|
|
2186
|
+
accessToken: string;
|
|
2187
|
+
expiresAt: Date;
|
|
2188
|
+
scopes: string[];
|
|
2189
|
+
};
|
|
2190
|
+
};
|
|
2191
|
+
partnersApi: {
|
|
2192
|
+
[x: string]: {
|
|
2193
|
+
accessToken: string;
|
|
2194
|
+
expiresAt: Date;
|
|
2195
|
+
scopes: string[];
|
|
2196
|
+
};
|
|
2197
|
+
};
|
|
2198
|
+
storefrontRendererApi: {
|
|
2199
|
+
[x: string]: {
|
|
2200
|
+
accessToken: string;
|
|
2201
|
+
expiresAt: Date;
|
|
2202
|
+
scopes: string[];
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
}, {
|
|
2206
|
+
adminApi: {
|
|
2207
|
+
[x: string]: {
|
|
2208
|
+
accessToken: string;
|
|
2209
|
+
expiresAt: Date;
|
|
2210
|
+
scopes: string[];
|
|
2211
|
+
};
|
|
2212
|
+
};
|
|
2213
|
+
partnersApi: {
|
|
2214
|
+
[x: string]: {
|
|
2215
|
+
accessToken: string;
|
|
2216
|
+
expiresAt: Date;
|
|
2217
|
+
scopes: string[];
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
storefrontRendererApi: {
|
|
2221
|
+
[x: string]: {
|
|
2222
|
+
accessToken: string;
|
|
2223
|
+
expiresAt: Date;
|
|
2224
|
+
scopes: string[];
|
|
2225
|
+
};
|
|
2226
|
+
};
|
|
2227
|
+
}>;
|
|
2228
|
+
}, "strip", ZodTypeAny, {
|
|
2229
|
+
identity: {
|
|
2230
|
+
accessToken: string;
|
|
2231
|
+
refreshToken: string;
|
|
2232
|
+
expiresAt: Date;
|
|
2233
|
+
scopes: string[];
|
|
2234
|
+
};
|
|
2235
|
+
applications: {
|
|
2236
|
+
adminApi: {
|
|
2237
|
+
[x: string]: {
|
|
2238
|
+
accessToken: string;
|
|
2239
|
+
expiresAt: Date;
|
|
2240
|
+
scopes: string[];
|
|
2241
|
+
};
|
|
2242
|
+
};
|
|
2243
|
+
partnersApi: {
|
|
2244
|
+
[x: string]: {
|
|
2245
|
+
accessToken: string;
|
|
2246
|
+
expiresAt: Date;
|
|
2247
|
+
scopes: string[];
|
|
2248
|
+
};
|
|
2249
|
+
};
|
|
2250
|
+
storefrontRendererApi: {
|
|
2251
|
+
[x: string]: {
|
|
2252
|
+
accessToken: string;
|
|
2253
|
+
expiresAt: Date;
|
|
2254
|
+
scopes: string[];
|
|
2255
|
+
};
|
|
2256
|
+
};
|
|
2257
|
+
};
|
|
2258
|
+
}, {
|
|
2259
|
+
identity: {
|
|
2260
|
+
accessToken: string;
|
|
2261
|
+
refreshToken: string;
|
|
2262
|
+
expiresAt: Date;
|
|
2263
|
+
scopes: string[];
|
|
2264
|
+
};
|
|
2265
|
+
applications: {
|
|
2266
|
+
adminApi: {
|
|
2267
|
+
[x: string]: {
|
|
2268
|
+
accessToken: string;
|
|
2269
|
+
expiresAt: Date;
|
|
2270
|
+
scopes: string[];
|
|
2271
|
+
};
|
|
2272
|
+
};
|
|
2273
|
+
partnersApi: {
|
|
2274
|
+
[x: string]: {
|
|
2275
|
+
accessToken: string;
|
|
2276
|
+
expiresAt: Date;
|
|
2277
|
+
scopes: string[];
|
|
2278
|
+
};
|
|
2279
|
+
};
|
|
2280
|
+
storefrontRendererApi: {
|
|
2281
|
+
[x: string]: {
|
|
2282
|
+
accessToken: string;
|
|
2283
|
+
expiresAt: Date;
|
|
2284
|
+
scopes: string[];
|
|
2285
|
+
};
|
|
2286
|
+
};
|
|
2287
|
+
};
|
|
2288
|
+
}>, {
|
|
2289
|
+
[x: string]: {
|
|
2290
|
+
identity: {
|
|
2291
|
+
accessToken: string;
|
|
2292
|
+
refreshToken: string;
|
|
2293
|
+
expiresAt: Date;
|
|
2294
|
+
scopes: string[];
|
|
2295
|
+
};
|
|
2296
|
+
applications: {
|
|
2297
|
+
adminApi: {
|
|
2298
|
+
[x: string]: {
|
|
2299
|
+
accessToken: string;
|
|
2300
|
+
expiresAt: Date;
|
|
2301
|
+
scopes: string[];
|
|
2302
|
+
};
|
|
2303
|
+
};
|
|
2304
|
+
partnersApi: {
|
|
2305
|
+
[x: string]: {
|
|
2306
|
+
accessToken: string;
|
|
2307
|
+
expiresAt: Date;
|
|
2308
|
+
scopes: string[];
|
|
2309
|
+
};
|
|
2310
|
+
};
|
|
2311
|
+
storefrontRendererApi: {
|
|
2312
|
+
[x: string]: {
|
|
2313
|
+
accessToken: string;
|
|
2314
|
+
expiresAt: Date;
|
|
2315
|
+
scopes: string[];
|
|
2316
|
+
};
|
|
2317
|
+
};
|
|
2318
|
+
};
|
|
2319
|
+
};
|
|
2320
|
+
}, {
|
|
2321
|
+
[x: string]: {
|
|
2322
|
+
identity: {
|
|
2323
|
+
accessToken: string;
|
|
2324
|
+
refreshToken: string;
|
|
2325
|
+
expiresAt: Date;
|
|
2326
|
+
scopes: string[];
|
|
2327
|
+
};
|
|
2328
|
+
applications: {
|
|
2329
|
+
adminApi: {
|
|
2330
|
+
[x: string]: {
|
|
2331
|
+
accessToken: string;
|
|
2332
|
+
expiresAt: Date;
|
|
2333
|
+
scopes: string[];
|
|
2334
|
+
};
|
|
2335
|
+
};
|
|
2336
|
+
partnersApi: {
|
|
2337
|
+
[x: string]: {
|
|
2338
|
+
accessToken: string;
|
|
2339
|
+
expiresAt: Date;
|
|
2340
|
+
scopes: string[];
|
|
2341
|
+
};
|
|
2342
|
+
};
|
|
2343
|
+
storefrontRendererApi: {
|
|
2344
|
+
[x: string]: {
|
|
2345
|
+
accessToken: string;
|
|
2346
|
+
expiresAt: Date;
|
|
2347
|
+
scopes: string[];
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2350
|
+
};
|
|
2351
|
+
};
|
|
2352
|
+
}>;
|
|
2353
|
+
declare type Session = TypeOf<typeof SessionSchema>;
|
|
2354
|
+
|
|
2355
|
+
/**
|
|
2356
|
+
* A scope supported by the Shopify Admin API.
|
|
2357
|
+
*/
|
|
2358
|
+
declare type AdminAPIScope = 'graphql' | 'themes' | 'collaborator' | string;
|
|
2359
|
+
/**
|
|
2360
|
+
* It represents the options to authenticate against the Shopify Admin API.
|
|
2361
|
+
*/
|
|
2362
|
+
interface AdminAPIOAuthOptions {
|
|
2363
|
+
/** List of scopes to request permissions for */
|
|
2364
|
+
scopes: AdminAPIScope[];
|
|
2365
|
+
}
|
|
2366
|
+
/**
|
|
2367
|
+
* A scope supported by the Partners API.
|
|
2368
|
+
*/
|
|
2369
|
+
declare type PartnersAPIScope = 'cli' | string;
|
|
2370
|
+
interface PartnersAPIOAuthOptions {
|
|
2371
|
+
/** List of scopes to request permissions for */
|
|
2372
|
+
scopes: PartnersAPIScope[];
|
|
2373
|
+
}
|
|
2374
|
+
/**
|
|
2375
|
+
* A scope supported by the Storefront Renderer API.
|
|
2376
|
+
*/
|
|
2377
|
+
declare type StorefrontRendererScope = 'devtools' | string;
|
|
2378
|
+
interface StorefrontRendererAPIOAuthOptions {
|
|
2379
|
+
/** List of scopes to request permissions for */
|
|
2380
|
+
scopes: StorefrontRendererScope[];
|
|
2381
|
+
}
|
|
2382
|
+
interface ShopifyOAuthOptions {
|
|
2383
|
+
storeFqdn?: string;
|
|
2384
|
+
storefrontRendererApi?: StorefrontRendererAPIOAuthOptions;
|
|
2385
|
+
adminApi?: AdminAPIOAuthOptions;
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* It represents the authentication requirements and
|
|
2389
|
+
* is the input necessary to trigger the authentication
|
|
2390
|
+
* flow.
|
|
2391
|
+
*/
|
|
2392
|
+
interface OAuthApplications {
|
|
2393
|
+
shopify?: ShopifyOAuthOptions;
|
|
2394
|
+
partnersApi?: PartnersAPIOAuthOptions;
|
|
2395
|
+
}
|
|
2396
|
+
/**
|
|
2397
|
+
* This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.
|
|
2398
|
+
* @param options {OAuthApplications} An object containing the applications we need to be authenticated with.
|
|
2399
|
+
* @returns {OAuthSession} An instance with the access tokens organized by application.
|
|
2400
|
+
*/
|
|
2401
|
+
declare function ensureAuthenticated(applications: OAuthApplications): Promise<Session>;
|
|
2402
|
+
|
|
2403
|
+
declare const session_ensureAuthenticated: typeof ensureAuthenticated;
|
|
2404
|
+
declare namespace session {
|
|
2405
|
+
export {
|
|
2406
|
+
session_ensureAuthenticated as ensureAuthenticated,
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
declare function parse(input: string): object;
|
|
2411
|
+
|
|
2412
|
+
declare const toml_parse: typeof parse;
|
|
2413
|
+
declare namespace toml {
|
|
2414
|
+
export {
|
|
2415
|
+
toml_parse as parse,
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
/**
|
|
2420
|
+
* JSON Schema
|
|
2421
|
+
*
|
|
2422
|
+
* Documentation corresponds to the work-in-progress draft-07 of JSON Schema.
|
|
2423
|
+
*
|
|
2424
|
+
* The latest published drafts are:
|
|
2425
|
+
* - draft-handrews-json-schema-01
|
|
2426
|
+
* - draft-handrews-json-schema-validation-01
|
|
2427
|
+
*
|
|
2428
|
+
* For more information, visit: http://json-schema.org/.
|
|
2429
|
+
*
|
|
2430
|
+
* Draft date: March 19, 2018.
|
|
2431
|
+
*
|
|
2432
|
+
* @public
|
|
2433
|
+
*/
|
|
2434
|
+
interface JSONSchema {
|
|
2435
|
+
/**
|
|
2436
|
+
* This keyword is reserved for comments from schema authors to readers or
|
|
2437
|
+
* maintainers of the schema. The value of this keyword MUST be a string.
|
|
2438
|
+
* Implementations MUST NOT present this string to end users. Tools for
|
|
2439
|
+
* editing schemas SHOULD support displaying and editing this keyword.
|
|
2440
|
+
*
|
|
2441
|
+
* The value of this keyword MAY be used in debug or error output which is
|
|
2442
|
+
* intended for developers making use of schemas. Schema vocabularies SHOULD
|
|
2443
|
+
* allow "$comment" within any object containing vocabulary keywords.
|
|
2444
|
+
*
|
|
2445
|
+
* Implementations MAY assume "$comment" is allowed unless the vocabulary
|
|
2446
|
+
* specifically forbids it. Vocabularies MUST NOT specify any effect of
|
|
2447
|
+
* "$comment" beyond what is described in this specification. Tools that
|
|
2448
|
+
* translate other media types or programming languages to and from
|
|
2449
|
+
* application/schema+json MAY choose to convert that media type or
|
|
2450
|
+
* programming language's native comments to or from "$comment" values.
|
|
2451
|
+
*
|
|
2452
|
+
* The behavior of such translation when both native comments and "$comment"
|
|
2453
|
+
* properties are present is implementation-dependent. Implementations SHOULD
|
|
2454
|
+
* treat "$comment" identically to an unknown extension keyword.
|
|
2455
|
+
*
|
|
2456
|
+
* They MAY strip "$comment" values at any point during processing. In
|
|
2457
|
+
* particular, this allows for shortening schemas when the size of deployed
|
|
2458
|
+
* schemas is a concern. Implementations MUST NOT take any other action based
|
|
2459
|
+
* on the presence, absence, or contents of "$comment" properties.
|
|
2460
|
+
*/
|
|
2461
|
+
$comment?: string
|
|
2462
|
+
/**
|
|
2463
|
+
* The "$id" keyword defines a URI for the schema, and the base URI that other
|
|
2464
|
+
* URI references within the schema are resolved against. A subschema's "$id"
|
|
2465
|
+
* is resolved against the base URI of its parent schema. If no parent sets an
|
|
2466
|
+
* explicit base with "$id", the base URI is that of the entire document, as
|
|
2467
|
+
* determined per [RFC 3986 section 5][RFC3986].
|
|
2468
|
+
*
|
|
2469
|
+
* If present, the value for this keyword MUST be a string, and MUST represent
|
|
2470
|
+
* a valid [URI-reference][RFC3986]. This value SHOULD be normalized, and
|
|
2471
|
+
* SHOULD NOT be an empty fragment <#> or an empty string <>.
|
|
2472
|
+
*
|
|
2473
|
+
* [RFC3986]: http://json-schema.org/latest/json-schema-core.html#RFC3986
|
|
2474
|
+
*/
|
|
2475
|
+
$id?: string
|
|
2476
|
+
/**
|
|
2477
|
+
* The "$ref" keyword is used to reference a schema, and provides the ability
|
|
2478
|
+
* to validate recursive structures through self-reference.
|
|
2479
|
+
*
|
|
2480
|
+
* An object schema with a "$ref" property MUST be interpreted as a "$ref"
|
|
2481
|
+
* reference. The value of the "$ref" property MUST be a URI Reference.
|
|
2482
|
+
* Resolved against the current URI base, it identifies the URI of a schema to
|
|
2483
|
+
* use. All other properties in a "$ref" object MUST be ignored.
|
|
2484
|
+
*
|
|
2485
|
+
* The URI is not a network locator, only an identifier. A schema need not be
|
|
2486
|
+
* downloadable from the address if it is a network-addressable URL, and
|
|
2487
|
+
* implementations SHOULD NOT assume they should perform a network operation
|
|
2488
|
+
* when they encounter a network-addressable URI.
|
|
2489
|
+
*
|
|
2490
|
+
* A schema MUST NOT be run into an infinite loop against a schema. For
|
|
2491
|
+
* example, if two schemas "#alice" and "#bob" both have an "allOf" property
|
|
2492
|
+
* that refers to the other, a naive validator might get stuck in an infinite
|
|
2493
|
+
* recursive loop trying to validate the instance. Schemas SHOULD NOT make use
|
|
2494
|
+
* of infinite recursive nesting like this; the behavior is undefined.
|
|
2495
|
+
*/
|
|
2496
|
+
$ref?: string
|
|
2497
|
+
/**
|
|
2498
|
+
* The "$schema" keyword is both used as a JSON Schema version identifier and
|
|
2499
|
+
* the location of a resource which is itself a JSON Schema, which describes
|
|
2500
|
+
* any schema written for this particular version.
|
|
2501
|
+
*
|
|
2502
|
+
* The value of this keyword MUST be a [URI][RFC3986] (containing a scheme)
|
|
2503
|
+
* and this URI MUST be normalized. The current schema MUST be valid against
|
|
2504
|
+
* the meta-schema identified by this URI.
|
|
2505
|
+
*
|
|
2506
|
+
* If this URI identifies a retrievable resource, that resource SHOULD be of
|
|
2507
|
+
* media type "application/schema+json".
|
|
2508
|
+
*
|
|
2509
|
+
* The "$schema" keyword SHOULD be used in a root schema. It MUST NOT appear
|
|
2510
|
+
* in subschemas.
|
|
2511
|
+
*
|
|
2512
|
+
* Values for this property are defined in other documents and by other
|
|
2513
|
+
* parties. JSON Schema implementations SHOULD implement support for current
|
|
2514
|
+
* and previous published drafts of JSON Schema vocabularies as deemed
|
|
2515
|
+
* reasonable.
|
|
2516
|
+
*
|
|
2517
|
+
* [RFC3986]: http://json-schema.org/latest/json-schema-core.html#RFC3986
|
|
2518
|
+
*/
|
|
2519
|
+
$schema?: string
|
|
2520
|
+
/**
|
|
2521
|
+
* The value of "additionalItems" MUST be a valid JSON Schema.
|
|
2522
|
+
*
|
|
2523
|
+
* This keyword determines how child instances validate for arrays, and does
|
|
2524
|
+
* not directly validate the immediate instance itself.
|
|
2525
|
+
*
|
|
2526
|
+
* If "items" is an array of schemas, validation succeeds if every instance
|
|
2527
|
+
* element at a position greater than the size of "items" validates against
|
|
2528
|
+
* "additionalItems".
|
|
2529
|
+
*
|
|
2530
|
+
* Otherwise, "additionalItems" MUST be ignored, as the "items" schema
|
|
2531
|
+
* (possibly the default value of an empty schema) is applied to all elements.
|
|
2532
|
+
*
|
|
2533
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
2534
|
+
*/
|
|
2535
|
+
additionalItems?: JSONSchema | boolean
|
|
2536
|
+
/**
|
|
2537
|
+
* The value of "additionalProperties" MUST be a valid JSON Schema.
|
|
2538
|
+
*
|
|
2539
|
+
* This keyword determines how child instances validate for objects, and does
|
|
2540
|
+
* not directly validate the immediate instance itself.
|
|
2541
|
+
*
|
|
2542
|
+
* Validation with "additionalProperties" applies only to the child values of
|
|
2543
|
+
* instance names that do not match any names in "properties", and do not
|
|
2544
|
+
* match any regular expression in "patternProperties".
|
|
2545
|
+
*
|
|
2546
|
+
* For all such properties, validation succeeds if the child instance
|
|
2547
|
+
* validates against the "additionalProperties" schema.
|
|
2548
|
+
*
|
|
2549
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
2550
|
+
*/
|
|
2551
|
+
additionalProperties?: JSONSchema | boolean
|
|
2552
|
+
/**
|
|
2553
|
+
* This keyword's value MUST be a non-empty array. Each item of the array MUST
|
|
2554
|
+
* be a valid JSON Schema.
|
|
2555
|
+
*
|
|
2556
|
+
* An instance validates successfully against this keyword if it validates
|
|
2557
|
+
* successfully against all schemas defined by this keyword's value.
|
|
2558
|
+
*/
|
|
2559
|
+
allOf?: (JSONSchema | boolean)[]
|
|
2560
|
+
/**
|
|
2561
|
+
* This keyword's value MUST be a non-empty array. Each item of the array MUST
|
|
2562
|
+
* be a valid JSON Schema.
|
|
2563
|
+
*
|
|
2564
|
+
* An instance validates successfully against this keyword if it validates
|
|
2565
|
+
* successfully against at least one schema defined by this keyword's value.
|
|
2566
|
+
*/
|
|
2567
|
+
anyOf?: (JSONSchema | boolean)[]
|
|
2568
|
+
/**
|
|
2569
|
+
* The value of this keyword MAY be of any type, including null.
|
|
2570
|
+
*
|
|
2571
|
+
* An instance validates successfully against this keyword if its value is
|
|
2572
|
+
* equal to the value of the keyword.
|
|
2573
|
+
*/
|
|
2574
|
+
const?: any
|
|
2575
|
+
/**
|
|
2576
|
+
* The value of this keyword MUST be a valid JSON Schema.
|
|
2577
|
+
*
|
|
2578
|
+
* An array instance is valid against "contains" if at least one of its
|
|
2579
|
+
* elements is valid against the given schema.
|
|
2580
|
+
*/
|
|
2581
|
+
contains?: JSONSchema | boolean
|
|
2582
|
+
/**
|
|
2583
|
+
* If the instance value is a string, this property defines that the string
|
|
2584
|
+
* SHOULD be interpreted as binary data and decoded using the encoding named
|
|
2585
|
+
* by this property. [RFC 2045, Sec 6.1][RFC2045] lists the possible values for
|
|
2586
|
+
* this property.
|
|
2587
|
+
*
|
|
2588
|
+
* The value of this property SHOULD be ignored if the instance described is
|
|
2589
|
+
* not a string.
|
|
2590
|
+
*
|
|
2591
|
+
* [RFC2045]: https://tools.ietf.org/html/rfc2045#section-6.1
|
|
2592
|
+
*/
|
|
2593
|
+
contentEncoding?: JSONSchemaContentEncodingName | JSONSchemaContentEncoding
|
|
2594
|
+
/**
|
|
2595
|
+
* The value of this property must be a media type, as defined by
|
|
2596
|
+
* [RFC 2046][RFC2046]. This property defines the media type of instances
|
|
2597
|
+
* which this schema defines.
|
|
2598
|
+
*
|
|
2599
|
+
* The value of this property SHOULD be ignored if the instance described is
|
|
2600
|
+
* not a string.
|
|
2601
|
+
*
|
|
2602
|
+
* If the "contentEncoding" property is not present, but the instance value is
|
|
2603
|
+
* a string, then the value of this property SHOULD specify a text document
|
|
2604
|
+
* type, and the character set SHOULD be the character set into which the
|
|
2605
|
+
* JSON string value was decoded (for which the default is Unicode).
|
|
2606
|
+
*
|
|
2607
|
+
* [RFC2046]: https://tools.ietf.org/html/rfc2046
|
|
2608
|
+
*/
|
|
2609
|
+
contentMediaType?: string
|
|
2610
|
+
/**
|
|
2611
|
+
* There are no restrictions placed on the value of this keyword. When
|
|
2612
|
+
* multiple occurrences of this keyword are applicable to a single
|
|
2613
|
+
* sub-instance, implementations SHOULD remove duplicates.
|
|
2614
|
+
*
|
|
2615
|
+
* This keyword can be used to supply a default JSON value associated with a
|
|
2616
|
+
* particular schema. It is RECOMMENDED that a default value be valid against
|
|
2617
|
+
* the associated schema.
|
|
2618
|
+
*/
|
|
2619
|
+
default?: any
|
|
2620
|
+
/**
|
|
2621
|
+
* The "definitions" keywords provides a standardized location for schema
|
|
2622
|
+
* authors to inline re-usable JSON Schemas into a more general schema. The
|
|
2623
|
+
* keyword does not directly affect the validation result.
|
|
2624
|
+
*
|
|
2625
|
+
* This keyword's value MUST be an object. Each member value of this object
|
|
2626
|
+
* MUST be a valid JSON Schema.
|
|
2627
|
+
*/
|
|
2628
|
+
definitions?: {
|
|
2629
|
+
[key: string]: JSONSchema | boolean
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* This keyword specifies rules that are evaluated if the instance is an
|
|
2633
|
+
* object and contains a certain property.
|
|
2634
|
+
*
|
|
2635
|
+
* This keyword's value MUST be an object. Each property specifies a
|
|
2636
|
+
* dependency. Each dependency value MUST be an array or a valid JSON Schema.
|
|
2637
|
+
*
|
|
2638
|
+
* If the dependency value is a subschema, and the dependency key is a
|
|
2639
|
+
* property in the instance, the entire instance must validate against the
|
|
2640
|
+
* dependency value.
|
|
2641
|
+
*
|
|
2642
|
+
* If the dependency value is an array, each element in the array, if any,
|
|
2643
|
+
* MUST be a string, and MUST be unique. If the dependency key is a property
|
|
2644
|
+
* in the instance, each of the items in the dependency value must be a
|
|
2645
|
+
* property that exists in the instance.
|
|
2646
|
+
*
|
|
2647
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
2648
|
+
*/
|
|
2649
|
+
dependencies?:
|
|
2650
|
+
| {
|
|
2651
|
+
[key: string]: JSONSchema | boolean | string[]
|
|
2652
|
+
}
|
|
2653
|
+
| string[]
|
|
2654
|
+
/**
|
|
2655
|
+
* Can be used to decorate a user interface with explanation or information
|
|
2656
|
+
* about the data produced.
|
|
2657
|
+
*/
|
|
2658
|
+
description?: string
|
|
2659
|
+
/**
|
|
2660
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
2661
|
+
*
|
|
2662
|
+
* When "if" is present, and the instance fails to validate against its
|
|
2663
|
+
* subschema, then validation succeeds against this keyword if the instance
|
|
2664
|
+
* successfully validates against this keyword's subschema.
|
|
2665
|
+
*
|
|
2666
|
+
* This keyword has no effect when "if" is absent, or when the instance
|
|
2667
|
+
* successfully validates against its subschema. Implementations MUST NOT
|
|
2668
|
+
* evaluate the instance against this keyword, for either validation or
|
|
2669
|
+
* annotation collection purposes, in such cases.
|
|
2670
|
+
*/
|
|
2671
|
+
else?: JSONSchema | boolean
|
|
2672
|
+
/**
|
|
2673
|
+
* The value of this keyword MUST be an array. This array SHOULD have at least
|
|
2674
|
+
* one element. Elements in the array SHOULD be unique.
|
|
2675
|
+
*
|
|
2676
|
+
* An instance validates successfully against this keyword if its value is
|
|
2677
|
+
* equal to one of the elements in this keyword's array value.
|
|
2678
|
+
*
|
|
2679
|
+
* Elements in the array might be of any value, including null.
|
|
2680
|
+
*/
|
|
2681
|
+
enum?: any[]
|
|
2682
|
+
/**
|
|
2683
|
+
* The value of this keyword MUST be an array. There are no restrictions
|
|
2684
|
+
* placed on the values within the array. When multiple occurrences of this
|
|
2685
|
+
* keyword are applicable to a single sub-instance, implementations MUST
|
|
2686
|
+
* provide a flat array of all values rather than an array of arrays.
|
|
2687
|
+
*
|
|
2688
|
+
* This keyword can be used to provide sample JSON values associated with a
|
|
2689
|
+
* particular schema, for the purpose of illustrating usage. It is RECOMMENDED
|
|
2690
|
+
* that these values be valid against the associated schema.
|
|
2691
|
+
*
|
|
2692
|
+
* Implementations MAY use the value(s) of "default", if present, as an
|
|
2693
|
+
* additional example. If "examples" is absent, "default" MAY still be used in
|
|
2694
|
+
* this manner.
|
|
2695
|
+
*/
|
|
2696
|
+
examples?: any[]
|
|
2697
|
+
/**
|
|
2698
|
+
* The value of "exclusiveMaximum" MUST be number, representing an exclusive
|
|
2699
|
+
* upper limit for a numeric instance.
|
|
2700
|
+
*
|
|
2701
|
+
* If the instance is a number, then the instance is valid only if it has a
|
|
2702
|
+
* value strictly less than (not equal to) "exclusiveMaximum".
|
|
2703
|
+
*/
|
|
2704
|
+
exclusiveMaximum?: number
|
|
2705
|
+
/**
|
|
2706
|
+
* The value of "exclusiveMinimum" MUST be number, representing an exclusive
|
|
2707
|
+
* lower limit for a numeric instance.
|
|
2708
|
+
*
|
|
2709
|
+
* If the instance is a number, then the instance is valid only if it has a
|
|
2710
|
+
* value strictly greater than (not equal to) "exclusiveMinimum".
|
|
2711
|
+
*/
|
|
2712
|
+
exclusiveMinimum?: number
|
|
2713
|
+
/**
|
|
2714
|
+
* The "format" keyword functions as both an [annotation][annotation] and as
|
|
2715
|
+
* an [assertion][assertion]. While no special effort is required to implement
|
|
2716
|
+
* it as an annotation conveying semantic meaning, implementing validation is
|
|
2717
|
+
* non-trivial.
|
|
2718
|
+
*
|
|
2719
|
+
* Implementations MAY support the "format" keyword as a validation assertion.
|
|
2720
|
+
* Should they choose to do so:
|
|
2721
|
+
*
|
|
2722
|
+
* - they SHOULD implement validation for attributes defined below;
|
|
2723
|
+
* - they SHOULD offer an option to disable validation for this keyword.
|
|
2724
|
+
*
|
|
2725
|
+
* Implementations MAY add custom format attributes. Save for agreement
|
|
2726
|
+
* between parties, schema authors SHALL NOT expect a peer implementation to
|
|
2727
|
+
* support this keyword and/or custom format attributes.
|
|
2728
|
+
*
|
|
2729
|
+
* [annotation]: http://json-schema.org/latest/json-schema-validation.html#annotations
|
|
2730
|
+
* [assertion]: http://json-schema.org/latest/json-schema-validation.html#assertions
|
|
2731
|
+
*/
|
|
2732
|
+
format?:
|
|
2733
|
+
| JSONSchemaFormat
|
|
2734
|
+
| 'date'
|
|
2735
|
+
| 'date-time'
|
|
2736
|
+
| 'email'
|
|
2737
|
+
| 'full-date'
|
|
2738
|
+
| 'full-time'
|
|
2739
|
+
| 'hostname'
|
|
2740
|
+
| 'idn-email'
|
|
2741
|
+
| 'idn-hostname'
|
|
2742
|
+
| 'ipv4'
|
|
2743
|
+
| 'ipv6'
|
|
2744
|
+
| 'iri'
|
|
2745
|
+
| 'iri-reference'
|
|
2746
|
+
| 'json-pointer'
|
|
2747
|
+
| 'json-pointer-uri-fragment'
|
|
2748
|
+
| 'regex'
|
|
2749
|
+
| 'relative-json-pointer'
|
|
2750
|
+
| 'time'
|
|
2751
|
+
| 'uri'
|
|
2752
|
+
| 'uri-reference'
|
|
2753
|
+
| 'uri-template'
|
|
2754
|
+
| 'uuid'
|
|
2755
|
+
/**
|
|
2756
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
2757
|
+
*
|
|
2758
|
+
* This validation outcome of this keyword's subschema has no direct effect on
|
|
2759
|
+
* the overall validation result. Rather, it controls which of the "then" or
|
|
2760
|
+
* "else" keywords are evaluated.
|
|
2761
|
+
*
|
|
2762
|
+
* Instances that successfully validate against this keyword's subschema MUST
|
|
2763
|
+
* also be valid against the subschema value of the "then" keyword, if
|
|
2764
|
+
* present.
|
|
2765
|
+
*
|
|
2766
|
+
* Instances that fail to validate against this keyword's subschema MUST also
|
|
2767
|
+
* be valid against the subschema value of the "else" keyword, if present.
|
|
2768
|
+
*
|
|
2769
|
+
* If [annotations][annotations] are being collected, they are collected from
|
|
2770
|
+
* this keyword's subschema in the usual way, including when the keyword is
|
|
2771
|
+
* present without either "then" or "else".
|
|
2772
|
+
*
|
|
2773
|
+
* [annotations]: http://json-schema.org/latest/json-schema-validation.html#annotations
|
|
2774
|
+
*/
|
|
2775
|
+
if?: JSONSchema | boolean
|
|
2776
|
+
/**
|
|
2777
|
+
* The value of "items" MUST be either a valid JSON Schema or an array of
|
|
2778
|
+
* valid JSON Schemas.
|
|
2779
|
+
*
|
|
2780
|
+
* This keyword determines how child instances validate for arrays, and does
|
|
2781
|
+
* not directly validate the immediate instance itself.
|
|
2782
|
+
*
|
|
2783
|
+
* If "items" is a schema, validation succeeds if all elements in the array
|
|
2784
|
+
* successfully validate against that schema.
|
|
2785
|
+
*
|
|
2786
|
+
* If "items" is an array of schemas, validation succeeds if each element of
|
|
2787
|
+
* the instance validates against the schema at the same position, if any.
|
|
2788
|
+
*
|
|
2789
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
2790
|
+
*/
|
|
2791
|
+
items?: JSONSchema | boolean | (JSONSchema | boolean)[]
|
|
2792
|
+
/**
|
|
2793
|
+
* The value of "maximum" MUST be a number, representing an inclusive upper
|
|
2794
|
+
* limit for a numeric instance.
|
|
2795
|
+
*
|
|
2796
|
+
* If the instance is a number, then this keyword validates only if the
|
|
2797
|
+
* instance is less than or exactly equal to "maximum".
|
|
2798
|
+
*/
|
|
2799
|
+
maximum?: number
|
|
2800
|
+
/**
|
|
2801
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
2802
|
+
*
|
|
2803
|
+
* An array instance is valid against "maxItems" if its size is less than, or
|
|
2804
|
+
* equal to, the value of this keyword.
|
|
2805
|
+
*/
|
|
2806
|
+
maxItems?: number
|
|
2807
|
+
/**
|
|
2808
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
2809
|
+
*
|
|
2810
|
+
* A string instance is valid against this keyword if its length is less than,
|
|
2811
|
+
* or equal to, the value of this keyword.
|
|
2812
|
+
*
|
|
2813
|
+
* The length of a string instance is defined as the number of its characters
|
|
2814
|
+
* as defined by [RFC 7159][RFC7159].
|
|
2815
|
+
*
|
|
2816
|
+
* [RFC7159]: http://json-schema.org/latest/json-schema-validation.html#RFC7159
|
|
2817
|
+
*/
|
|
2818
|
+
maxLength?: number
|
|
2819
|
+
/**
|
|
2820
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
2821
|
+
*
|
|
2822
|
+
* An object instance is valid against "maxProperties" if its number of
|
|
2823
|
+
* properties is less than, or equal to, the value of this keyword.
|
|
2824
|
+
*/
|
|
2825
|
+
maxProperties?: number
|
|
2826
|
+
/**
|
|
2827
|
+
* The value of "minimum" MUST be a number, representing an inclusive lower
|
|
2828
|
+
* limit for a numeric instance.
|
|
2829
|
+
*
|
|
2830
|
+
* If the instance is a number, then this keyword validates only if the
|
|
2831
|
+
* instance is greater than or exactly equal to "minimum".
|
|
2832
|
+
*/
|
|
2833
|
+
minimum?: number
|
|
2834
|
+
/**
|
|
2835
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
2836
|
+
*
|
|
2837
|
+
* A string instance is valid against this keyword if its length is greater
|
|
2838
|
+
* than, or equal to, the value of this keyword.
|
|
2839
|
+
*
|
|
2840
|
+
* The length of a string instance is defined as the number of its characters
|
|
2841
|
+
* as defined by [RFC 7159][RFC7159].
|
|
2842
|
+
*
|
|
2843
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
2844
|
+
*
|
|
2845
|
+
* [RFC7159]: http://json-schema.org/latest/json-schema-validation.html#RFC7159
|
|
2846
|
+
*/
|
|
2847
|
+
minLength?: number
|
|
2848
|
+
/**
|
|
2849
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
2850
|
+
*
|
|
2851
|
+
* An array instance is valid against "minItems" if its size is greater than,
|
|
2852
|
+
* or equal to, the value of this keyword.
|
|
2853
|
+
*
|
|
2854
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
2855
|
+
*/
|
|
2856
|
+
minItems?: number
|
|
2857
|
+
/**
|
|
2858
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
2859
|
+
*
|
|
2860
|
+
* An object instance is valid against "minProperties" if its number of
|
|
2861
|
+
* properties is greater than, or equal to, the value of this keyword.
|
|
2862
|
+
*
|
|
2863
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
2864
|
+
*/
|
|
2865
|
+
minProperties?: number
|
|
2866
|
+
/**
|
|
2867
|
+
* The value of "multipleOf" MUST be a number, strictly greater than 0.
|
|
2868
|
+
*
|
|
2869
|
+
* A numeric instance is valid only if division by this keyword's value
|
|
2870
|
+
* results in an integer.
|
|
2871
|
+
*/
|
|
2872
|
+
multipleOf?: number
|
|
2873
|
+
/**
|
|
2874
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
2875
|
+
*
|
|
2876
|
+
* An instance is valid against this keyword if it fails to validate
|
|
2877
|
+
* successfully against the schema defined by this keyword.
|
|
2878
|
+
*/
|
|
2879
|
+
not?: JSONSchema | boolean
|
|
2880
|
+
/**
|
|
2881
|
+
* This keyword's value MUST be a non-empty array. Each item of the array MUST
|
|
2882
|
+
* be a valid JSON Schema.
|
|
2883
|
+
*
|
|
2884
|
+
* An instance validates successfully against this keyword if it validates
|
|
2885
|
+
* successfully against exactly one schema defined by this keyword's value.
|
|
2886
|
+
*/
|
|
2887
|
+
oneOf?: (JSONSchema | boolean)[]
|
|
2888
|
+
/**
|
|
2889
|
+
* The value of this keyword MUST be a string. This string SHOULD be a valid
|
|
2890
|
+
* regular expression, according to the ECMA 262 regular expression dialect.
|
|
2891
|
+
*
|
|
2892
|
+
* A string instance is considered valid if the regular expression matches the
|
|
2893
|
+
* instance successfully. Recall: regular expressions are not implicitly
|
|
2894
|
+
* anchored.
|
|
2895
|
+
*/
|
|
2896
|
+
pattern?: string
|
|
2897
|
+
/**
|
|
2898
|
+
* The value of "patternProperties" MUST be an object. Each property name of
|
|
2899
|
+
* this object SHOULD be a valid regular expression, according to the ECMA 262
|
|
2900
|
+
* regular expression dialect. Each property value of this object MUST be a
|
|
2901
|
+
* valid JSON Schema.
|
|
2902
|
+
*
|
|
2903
|
+
* This keyword determines how child instances validate for objects, and does
|
|
2904
|
+
* not directly validate the immediate instance itself. Validation of the
|
|
2905
|
+
* primitive instance type against this keyword always succeeds.
|
|
2906
|
+
*
|
|
2907
|
+
* Validation succeeds if, for each instance name that matches any regular
|
|
2908
|
+
* expressions that appear as a property name in this keyword's value, the
|
|
2909
|
+
* child instance for that name successfully validates against each schema
|
|
2910
|
+
* that corresponds to a matching regular expression.
|
|
2911
|
+
*
|
|
2912
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
2913
|
+
*/
|
|
2914
|
+
patternProperties?: {
|
|
2915
|
+
[key: string]: JSONSchema | boolean
|
|
2916
|
+
}
|
|
2917
|
+
/**
|
|
2918
|
+
* The value of "properties" MUST be an object. Each value of this object MUST
|
|
2919
|
+
* be a valid JSON Schema.
|
|
2920
|
+
*
|
|
2921
|
+
* This keyword determines how child instances validate for objects, and does
|
|
2922
|
+
* not directly validate the immediate instance itself.
|
|
2923
|
+
*
|
|
2924
|
+
* Validation succeeds if, for each name that appears in both the instance and
|
|
2925
|
+
* as a name within this keyword's value, the child instance for that name
|
|
2926
|
+
* successfully validates against the corresponding schema.
|
|
2927
|
+
*
|
|
2928
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
2929
|
+
*/
|
|
2930
|
+
properties?: {
|
|
2931
|
+
[key: string]: JSONSchema | boolean
|
|
2932
|
+
}
|
|
2933
|
+
/**
|
|
2934
|
+
* The value of "propertyNames" MUST be a valid JSON Schema.
|
|
2935
|
+
*
|
|
2936
|
+
* If the instance is an object, this keyword validates if every property name
|
|
2937
|
+
* in the instance validates against the provided schema. Note the property
|
|
2938
|
+
* name that the schema is testing will always be a string.
|
|
2939
|
+
*
|
|
2940
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
2941
|
+
*/
|
|
2942
|
+
propertyNames?: JSONSchema | boolean
|
|
2943
|
+
/**
|
|
2944
|
+
* The value of this keywords MUST be a boolean. When multiple occurrences of
|
|
2945
|
+
* this keyword are applicable to a single sub-instance, the resulting value
|
|
2946
|
+
* MUST be true if any occurrence specifies a true value, and MUST be false
|
|
2947
|
+
* otherwise.
|
|
2948
|
+
*
|
|
2949
|
+
* If "readOnly" has a value of boolean true, it indicates that the value of
|
|
2950
|
+
* the instance is managed exclusively by the owning authority, and attempts
|
|
2951
|
+
* by an application to modify the value of this property are expected to be
|
|
2952
|
+
* ignored or rejected by that owning authority.
|
|
2953
|
+
*
|
|
2954
|
+
* An instance document that is marked as "readOnly for the entire document
|
|
2955
|
+
* MAY be ignored if sent to the owning authority, or MAY result in an error,
|
|
2956
|
+
* at the authority's discretion.
|
|
2957
|
+
*
|
|
2958
|
+
* For example, "readOnly" would be used to mark a database-generated serial
|
|
2959
|
+
* number as read-only.
|
|
2960
|
+
*
|
|
2961
|
+
* This keywords can be used to assist in user interface instance generation.
|
|
2962
|
+
*
|
|
2963
|
+
* @default false
|
|
2964
|
+
*/
|
|
2965
|
+
readOnly?: boolean
|
|
2966
|
+
/**
|
|
2967
|
+
* The value of this keyword MUST be an array. Elements of this array, if any,
|
|
2968
|
+
* MUST be strings, and MUST be unique.
|
|
2969
|
+
*
|
|
2970
|
+
* An object instance is valid against this keyword if every item in the array
|
|
2971
|
+
* is the name of a property in the instance.
|
|
2972
|
+
*
|
|
2973
|
+
* Omitting this keyword has the same behavior as an empty array.
|
|
2974
|
+
*
|
|
2975
|
+
* @default []
|
|
2976
|
+
*/
|
|
2977
|
+
required?: string[]
|
|
2978
|
+
/**
|
|
2979
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
2980
|
+
*
|
|
2981
|
+
* When "if" is present, and the instance successfully validates against its
|
|
2982
|
+
* subschema, then validation succeeds against this keyword if the instance
|
|
2983
|
+
* also successfully validates against this keyword's subschema.
|
|
2984
|
+
*
|
|
2985
|
+
* This keyword has no effect when "if" is absent, or when the instance fails
|
|
2986
|
+
* to validate against its subschema. Implementations MUST NOT evaluate the
|
|
2987
|
+
* instance against this keyword, for either validation or annotation
|
|
2988
|
+
* collection purposes, in such cases.
|
|
2989
|
+
*/
|
|
2990
|
+
then?: JSONSchema | boolean
|
|
2991
|
+
/**
|
|
2992
|
+
* Can be used to decorate a user interface with a short label about the data
|
|
2993
|
+
* produced.
|
|
2994
|
+
*/
|
|
2995
|
+
title?: string
|
|
2996
|
+
/**
|
|
2997
|
+
* The value of this keyword MUST be either a string or an array. If it is an
|
|
2998
|
+
* array, elements of the array MUST be strings and MUST be unique.
|
|
2999
|
+
*
|
|
3000
|
+
* String values MUST be one of the six primitive types ("null", "boolean",
|
|
3001
|
+
* "object", "array", "number", or "string"), or "integer" which matches any
|
|
3002
|
+
* number with a zero fractional part.
|
|
3003
|
+
*
|
|
3004
|
+
* An instance validates if and only if the instance is in any of the sets
|
|
3005
|
+
* listed for this keyword.
|
|
3006
|
+
*/
|
|
3007
|
+
type?:
|
|
3008
|
+
| JSONSchemaType
|
|
3009
|
+
| JSONSchemaTypeName
|
|
3010
|
+
| (JSONSchemaType | JSONSchemaTypeName)[]
|
|
3011
|
+
/**
|
|
3012
|
+
* The value of this keyword MUST be a boolean.
|
|
3013
|
+
*
|
|
3014
|
+
* If this keyword has boolean value false, the instance validates
|
|
3015
|
+
* successfully. If it has boolean value true, the instance validates
|
|
3016
|
+
* successfully if all of its elements are unique.
|
|
3017
|
+
*
|
|
3018
|
+
* Omitting this keyword has the same behavior as a value of false.
|
|
3019
|
+
*
|
|
3020
|
+
* @default false
|
|
3021
|
+
*/
|
|
3022
|
+
uniqueItems?: boolean
|
|
3023
|
+
/**
|
|
3024
|
+
* The value of this keyword MUST be a boolean. When multiple occurrences of
|
|
3025
|
+
* this keyword is applicable to a single sub-instance, the resulting value
|
|
3026
|
+
* MUST be true if any occurrence specifies a true value, and MUST be false
|
|
3027
|
+
* otherwise.
|
|
3028
|
+
*
|
|
3029
|
+
* If "writeOnly" has a value of boolean true, it indicates that the value is
|
|
3030
|
+
* never present when the instance is retrieved from the owning authority. It
|
|
3031
|
+
* can be present when sent to the owning authority to update or create the
|
|
3032
|
+
* document (or the resource it represents), but it will not be included in
|
|
3033
|
+
* any updated or newly created version of the instance.
|
|
3034
|
+
*
|
|
3035
|
+
* An instance document that is marked as "writeOnly" for the entire document
|
|
3036
|
+
* MAY be returned as a blank document of some sort, or MAY produce an error
|
|
3037
|
+
* upon retrieval, or have the retrieval request ignored, at the authority's
|
|
3038
|
+
* discretion.
|
|
3039
|
+
*
|
|
3040
|
+
* For example, "writeOnly" would be used to mark a password input field.
|
|
3041
|
+
*
|
|
3042
|
+
* These keywords can be used to assist in user interface instance generation.
|
|
3043
|
+
* In particular, an application MAY choose to use a widget that hides input
|
|
3044
|
+
* values as they are typed for write-only fields.
|
|
3045
|
+
*
|
|
3046
|
+
* @default false
|
|
3047
|
+
*/
|
|
3048
|
+
writeOnly?: boolean
|
|
3049
|
+
}
|
|
3050
|
+
/**
|
|
3051
|
+
* String formats.
|
|
3052
|
+
*
|
|
3053
|
+
* @public
|
|
3054
|
+
*/
|
|
3055
|
+
declare enum JSONSchemaFormat {
|
|
3056
|
+
/**
|
|
3057
|
+
* A string instance is valid against this attribute if it is a valid
|
|
3058
|
+
* representation according to the "full-date" production in
|
|
3059
|
+
* [RFC 3339][RFC3339].
|
|
3060
|
+
*
|
|
3061
|
+
* [RFC3339]: http://json-schema.org/latest/json-schema-validation.html#RFC3339
|
|
3062
|
+
*/
|
|
3063
|
+
Date = 'date',
|
|
3064
|
+
/**
|
|
3065
|
+
* A string instance is valid against this attribute if it is a valid
|
|
3066
|
+
* representation according to the "date-time" production in
|
|
3067
|
+
* [RFC 3339][RFC3339].
|
|
3068
|
+
*
|
|
3069
|
+
* [RFC3339]: http://json-schema.org/latest/json-schema-validation.html#RFC3339
|
|
3070
|
+
*/
|
|
3071
|
+
DateTime = 'date-time',
|
|
3072
|
+
/**
|
|
3073
|
+
* A string instance is valid against these attributes if it is a valid
|
|
3074
|
+
* Internet email address as defined by [RFC 5322, section 3.4.1][RFC5322].
|
|
3075
|
+
*
|
|
3076
|
+
* [RFC5322]: http://json-schema.org/latest/json-schema-validation.html#RFC5322
|
|
3077
|
+
*/
|
|
3078
|
+
Email = 'email',
|
|
3079
|
+
/**
|
|
3080
|
+
* As defined by [RFC 1034, section 3.1][RFC1034], including host names
|
|
3081
|
+
* produced using the Punycode algorithm specified in
|
|
3082
|
+
* [RFC 5891, section 4.4][RFC5891].
|
|
3083
|
+
*
|
|
3084
|
+
* [RFC1034]: http://json-schema.org/latest/json-schema-validation.html#RFC1034
|
|
3085
|
+
* [RFC5891]: http://json-schema.org/latest/json-schema-validation.html#RFC5891
|
|
3086
|
+
*/
|
|
3087
|
+
Hostname = 'hostname',
|
|
3088
|
+
/**
|
|
3089
|
+
* A string instance is valid against these attributes if it is a valid
|
|
3090
|
+
* Internet email address as defined by [RFC 6531][RFC6531].
|
|
3091
|
+
*
|
|
3092
|
+
* [RFC6531]: http://json-schema.org/latest/json-schema-validation.html#RFC6531
|
|
3093
|
+
*/
|
|
3094
|
+
IDNEmail = 'idn-email',
|
|
3095
|
+
/**
|
|
3096
|
+
* As defined by either [RFC 1034, section 3.1][RFC1034] as for hostname, or
|
|
3097
|
+
* an internationalized hostname as defined by
|
|
3098
|
+
* [RFC 5890, section 2.3.2.3][RFC5890].
|
|
3099
|
+
*
|
|
3100
|
+
* [RFC1034]: http://json-schema.org/latest/json-schema-validation.html#RFC1034
|
|
3101
|
+
* [RFC5890]: http://json-schema.org/latest/json-schema-validation.html#RFC5890
|
|
3102
|
+
*/
|
|
3103
|
+
IDNHostname = 'idn-hostname',
|
|
3104
|
+
/**
|
|
3105
|
+
* An IPv4 address according to the "dotted-quad" ABNF syntax as defined in
|
|
3106
|
+
* [RFC 2673, section 3.2][RFC2673].
|
|
3107
|
+
*
|
|
3108
|
+
* [RFC2673]: http://json-schema.org/latest/json-schema-validation.html#RFC2673
|
|
3109
|
+
*/
|
|
3110
|
+
IPv4 = 'ipv4',
|
|
3111
|
+
/**
|
|
3112
|
+
* An IPv6 address as defined in [RFC 4291, section 2.2][RFC4291].
|
|
3113
|
+
*
|
|
3114
|
+
* [RFC4291]: http://json-schema.org/latest/json-schema-validation.html#RFC4291
|
|
3115
|
+
*/
|
|
3116
|
+
IPv6 = 'ipv6',
|
|
3117
|
+
/**
|
|
3118
|
+
* A string instance is valid against this attribute if it is a valid IRI,
|
|
3119
|
+
* according to [RFC3987][RFC3987].
|
|
3120
|
+
*
|
|
3121
|
+
* [RFC3987]: http://json-schema.org/latest/json-schema-validation.html#RFC3987
|
|
3122
|
+
*/
|
|
3123
|
+
IRI = 'iri',
|
|
3124
|
+
/**
|
|
3125
|
+
* A string instance is valid against this attribute if it is a valid IRI
|
|
3126
|
+
* Reference (either an IRI or a relative-reference), according to
|
|
3127
|
+
* [RFC3987][RFC3987].
|
|
3128
|
+
*
|
|
3129
|
+
* [RFC3987]: http://json-schema.org/latest/json-schema-validation.html#RFC3987
|
|
3130
|
+
*/
|
|
3131
|
+
IRIReference = 'iri-reference',
|
|
3132
|
+
/**
|
|
3133
|
+
* A string instance is valid against this attribute if it is a valid JSON
|
|
3134
|
+
* string representation of a JSON Pointer, according to
|
|
3135
|
+
* [RFC 6901, section 5][RFC6901].
|
|
3136
|
+
*
|
|
3137
|
+
* [RFC6901]: http://json-schema.org/latest/json-schema-validation.html#RFC6901
|
|
3138
|
+
*/
|
|
3139
|
+
JSONPointer = 'json-pointer',
|
|
3140
|
+
/**
|
|
3141
|
+
* A string instance is valid against this attribute if it is a valid JSON
|
|
3142
|
+
* string representation of a JSON Pointer fragment, according to
|
|
3143
|
+
* [RFC 6901, section 5][RFC6901].
|
|
3144
|
+
*
|
|
3145
|
+
* [RFC6901]: http://json-schema.org/latest/json-schema-validation.html#RFC6901
|
|
3146
|
+
*/
|
|
3147
|
+
JSONPointerURIFragment = 'json-pointer-uri-fragment',
|
|
3148
|
+
/**
|
|
3149
|
+
* This attribute applies to string instances.
|
|
3150
|
+
*
|
|
3151
|
+
* A regular expression, which SHOULD be valid according to the
|
|
3152
|
+
* [ECMA 262][ecma262] regular expression dialect.
|
|
3153
|
+
*
|
|
3154
|
+
* Implementations that validate formats MUST accept at least the subset of
|
|
3155
|
+
* [ECMA 262][ecma262] defined in the [Regular Expressions][regexInterop]
|
|
3156
|
+
* section of this specification, and SHOULD accept all valid
|
|
3157
|
+
* [ECMA 262][ecma262] expressions.
|
|
3158
|
+
*
|
|
3159
|
+
* [ecma262]: http://json-schema.org/latest/json-schema-validation.html#ecma262
|
|
3160
|
+
* [regexInterop]: http://json-schema.org/latest/json-schema-validation.html#regexInterop
|
|
3161
|
+
*/
|
|
3162
|
+
RegEx = 'regex',
|
|
3163
|
+
/**
|
|
3164
|
+
* A string instance is valid against this attribute if it is a valid
|
|
3165
|
+
* [Relative JSON Pointer][relative-json-pointer].
|
|
3166
|
+
*
|
|
3167
|
+
* [relative-json-pointer]: http://json-schema.org/latest/json-schema-validation.html#relative-json-pointer
|
|
3168
|
+
*/
|
|
3169
|
+
RelativeJSONPointer = 'relative-json-pointer',
|
|
3170
|
+
/**
|
|
3171
|
+
* A string instance is valid against this attribute if it is a valid
|
|
3172
|
+
* representation according to the "time" production in [RFC 3339][RFC3339].
|
|
3173
|
+
*
|
|
3174
|
+
* [RFC3339]: http://json-schema.org/latest/json-schema-validation.html#RFC3339
|
|
3175
|
+
*/
|
|
3176
|
+
Time = 'time',
|
|
3177
|
+
/**
|
|
3178
|
+
* A string instance is valid against this attribute if it is a valid URI,
|
|
3179
|
+
* according to [RFC3986][RFC3986].
|
|
3180
|
+
*
|
|
3181
|
+
* [RFC3986]: http://json-schema.org/latest/json-schema-validation.html#RFC3986
|
|
3182
|
+
*/
|
|
3183
|
+
URI = 'uri',
|
|
3184
|
+
/**
|
|
3185
|
+
* A string instance is valid against this attribute if it is a valid URI
|
|
3186
|
+
* Reference (either a URI or a relative-reference), according to
|
|
3187
|
+
* [RFC3986][RFC3986].
|
|
3188
|
+
*
|
|
3189
|
+
* [RFC3986]: http://json-schema.org/latest/json-schema-validation.html#RFC3986
|
|
3190
|
+
*/
|
|
3191
|
+
URIReference = 'uri-reference',
|
|
3192
|
+
/**
|
|
3193
|
+
* A string instance is valid against this attribute if it is a valid URI
|
|
3194
|
+
* Template (of any level), according to [RFC6570][RFC6570].
|
|
3195
|
+
*
|
|
3196
|
+
* Note that URI Templates may be used for IRIs; there is no separate IRI
|
|
3197
|
+
* Template specification.
|
|
3198
|
+
*
|
|
3199
|
+
* [RFC6570]: http://json-schema.org/latest/json-schema-validation.html#RFC6570
|
|
3200
|
+
*/
|
|
3201
|
+
URITemplate = 'uri-template',
|
|
3202
|
+
/**
|
|
3203
|
+
* UUID
|
|
3204
|
+
*/
|
|
3205
|
+
UUID = 'uuid'
|
|
3206
|
+
}
|
|
3207
|
+
/**
|
|
3208
|
+
* JSON Schema type.
|
|
3209
|
+
*
|
|
3210
|
+
* @public
|
|
3211
|
+
*/
|
|
3212
|
+
declare type JSONSchemaTypeName =
|
|
3213
|
+
| 'array'
|
|
3214
|
+
| 'boolean'
|
|
3215
|
+
| 'integer'
|
|
3216
|
+
| 'null'
|
|
3217
|
+
| 'number'
|
|
3218
|
+
| 'object'
|
|
3219
|
+
| 'string'
|
|
3220
|
+
/**
|
|
3221
|
+
* JSON Schema type.
|
|
3222
|
+
*
|
|
3223
|
+
* @public
|
|
3224
|
+
*/
|
|
3225
|
+
declare enum JSONSchemaType {
|
|
3226
|
+
/**
|
|
3227
|
+
* Array
|
|
3228
|
+
*/
|
|
3229
|
+
Array = 'array',
|
|
3230
|
+
/**
|
|
3231
|
+
* Boolean
|
|
3232
|
+
*/
|
|
3233
|
+
Boolean = 'boolean',
|
|
3234
|
+
/**
|
|
3235
|
+
* Integer
|
|
3236
|
+
*/
|
|
3237
|
+
Integer = 'integer',
|
|
3238
|
+
/**
|
|
3239
|
+
* Null
|
|
3240
|
+
*/
|
|
3241
|
+
Null = 'null',
|
|
3242
|
+
/**
|
|
3243
|
+
* Number
|
|
3244
|
+
*/
|
|
3245
|
+
Number = 'number',
|
|
3246
|
+
/**
|
|
3247
|
+
* Object
|
|
3248
|
+
*/
|
|
3249
|
+
Object = 'object',
|
|
3250
|
+
/**
|
|
3251
|
+
* String
|
|
3252
|
+
*/
|
|
3253
|
+
String = 'string'
|
|
3254
|
+
}
|
|
3255
|
+
/**
|
|
3256
|
+
* Content encoding name.
|
|
3257
|
+
*
|
|
3258
|
+
* @public
|
|
3259
|
+
*/
|
|
3260
|
+
declare type JSONSchemaContentEncodingName =
|
|
3261
|
+
| '7bit'
|
|
3262
|
+
| '8bit'
|
|
3263
|
+
| 'binary'
|
|
3264
|
+
| 'quoted-printable'
|
|
3265
|
+
| 'base64'
|
|
3266
|
+
| 'ietf-token'
|
|
3267
|
+
| 'x-token'
|
|
3268
|
+
/**
|
|
3269
|
+
* Content encoding strategy.
|
|
3270
|
+
*
|
|
3271
|
+
* @public
|
|
3272
|
+
* {@link https://tools.ietf.org/html/rfc2045#section-6.1}
|
|
3273
|
+
* {@link https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705}
|
|
3274
|
+
*/
|
|
3275
|
+
declare enum JSONSchemaContentEncoding {
|
|
3276
|
+
/**
|
|
3277
|
+
* Only US-ASCII characters, which use the lower 7 bits for each character.
|
|
3278
|
+
*
|
|
3279
|
+
* Each line must be less than 1,000 characters.
|
|
3280
|
+
*/
|
|
3281
|
+
'7bit' = '7bit',
|
|
3282
|
+
/**
|
|
3283
|
+
* Allow extended ASCII characters which can use the 8th (highest) bit to
|
|
3284
|
+
* indicate special characters not available in 7bit.
|
|
3285
|
+
*
|
|
3286
|
+
* Each line must be less than 1,000 characters.
|
|
3287
|
+
*/
|
|
3288
|
+
'8bit' = '8bit',
|
|
3289
|
+
/**
|
|
3290
|
+
* Same character set as 8bit, with no line length restriction.
|
|
3291
|
+
*/
|
|
3292
|
+
Binary = 'binary',
|
|
3293
|
+
/**
|
|
3294
|
+
* Lines are limited to 76 characters, and line breaks are represented using
|
|
3295
|
+
* special characters that are escaped.
|
|
3296
|
+
*/
|
|
3297
|
+
QuotedPrintable = 'quoted-printable',
|
|
3298
|
+
/**
|
|
3299
|
+
* Useful for data that is mostly non-text.
|
|
3300
|
+
*/
|
|
3301
|
+
Base64 = 'base64',
|
|
3302
|
+
/**
|
|
3303
|
+
* An extension token defined by a standards-track RFC and registered with
|
|
3304
|
+
* IANA.
|
|
3305
|
+
*/
|
|
3306
|
+
IETFToken = 'ietf-token',
|
|
3307
|
+
/**
|
|
3308
|
+
* The two characters "X-" or "x-" followed, with no intervening white space,
|
|
3309
|
+
* by any token.
|
|
3310
|
+
*/
|
|
3311
|
+
XToken = 'x-token'
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3314
|
+
interface Options<T> {
|
|
3315
|
+
/**
|
|
3316
|
+
Config used if there are no existing config.
|
|
3317
|
+
|
|
3318
|
+
**Note:** The values in `defaults` will overwrite the `default` key in the `schema` option.
|
|
3319
|
+
*/
|
|
3320
|
+
defaults?: Readonly<T>;
|
|
3321
|
+
/**
|
|
3322
|
+
[JSON Schema](https://json-schema.org) to validate your config data.
|
|
3323
|
+
|
|
3324
|
+
Under the hood, the JSON Schema validator [ajv](https://github.com/epoberezkin/ajv) is used to validate your config. We use [JSON Schema draft-07](https://json-schema.org/latest/json-schema-validation.html) and support all [validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md) and [formats](https://github.com/epoberezkin/ajv#formats).
|
|
3325
|
+
|
|
3326
|
+
You should define your schema as an object where each key is the name of your data's property and each value is a JSON schema used to validate that property. See more [here](https://json-schema.org/understanding-json-schema/reference/object.html#properties).
|
|
3327
|
+
|
|
3328
|
+
@example
|
|
3329
|
+
```
|
|
3330
|
+
import Conf = require('conf');
|
|
3331
|
+
|
|
3332
|
+
const schema = {
|
|
3333
|
+
foo: {
|
|
3334
|
+
type: 'number',
|
|
3335
|
+
maximum: 100,
|
|
3336
|
+
minimum: 1,
|
|
3337
|
+
default: 50
|
|
3338
|
+
},
|
|
3339
|
+
bar: {
|
|
3340
|
+
type: 'string',
|
|
3341
|
+
format: 'url'
|
|
3342
|
+
}
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3345
|
+
const config = new Conf({schema});
|
|
3346
|
+
|
|
3347
|
+
console.log(config.get('foo'));
|
|
3348
|
+
//=> 50
|
|
3349
|
+
|
|
3350
|
+
config.set('foo', '1');
|
|
3351
|
+
// [Error: Config schema violation: `foo` should be number]
|
|
3352
|
+
```
|
|
3353
|
+
|
|
3354
|
+
**Note:** The `default` value will be overwritten by the `defaults` option if set.
|
|
3355
|
+
*/
|
|
3356
|
+
schema?: Schema<T>;
|
|
3357
|
+
/**
|
|
3358
|
+
Name of the config file (without extension).
|
|
3359
|
+
|
|
3360
|
+
Useful if you need multiple config files for your app or module. For example, different config files between two major versions.
|
|
3361
|
+
|
|
3362
|
+
@default 'config'
|
|
3363
|
+
*/
|
|
3364
|
+
configName?: string;
|
|
3365
|
+
/**
|
|
3366
|
+
You only need to specify this if you don't have a package.json file in your project or if it doesn't have a name defined within it.
|
|
3367
|
+
|
|
3368
|
+
Default: The name field in the `package.json` closest to where `conf` is imported.
|
|
3369
|
+
*/
|
|
3370
|
+
projectName?: string;
|
|
3371
|
+
/**
|
|
3372
|
+
You only need to specify this if you don't have a package.json file in your project or if it doesn't have a version defined within it.
|
|
3373
|
+
|
|
3374
|
+
Default: The name field in the `package.json` closest to where `conf` is imported.
|
|
3375
|
+
*/
|
|
3376
|
+
projectVersion?: string;
|
|
3377
|
+
/**
|
|
3378
|
+
You can use migrations to perform operations to the store whenever a version is changed.
|
|
3379
|
+
|
|
3380
|
+
The `migrations` object should consist of a key-value pair of `'version': handler`. The `version` can also be a [semver range](https://github.com/npm/node-semver#ranges).
|
|
3381
|
+
|
|
3382
|
+
Note: The version the migrations use refers to the __project version__ by default. If you want to change this behavior, specify the `projectVersion` option.
|
|
3383
|
+
|
|
3384
|
+
@example
|
|
3385
|
+
```
|
|
3386
|
+
import Conf = require('conf');
|
|
3387
|
+
|
|
3388
|
+
const store = new Conf({
|
|
3389
|
+
migrations: {
|
|
3390
|
+
'0.0.1': store => {
|
|
3391
|
+
store.set('debugPhase', true);
|
|
3392
|
+
},
|
|
3393
|
+
'1.0.0': store => {
|
|
3394
|
+
store.delete('debugPhase');
|
|
3395
|
+
store.set('phase', '1.0.0');
|
|
3396
|
+
},
|
|
3397
|
+
'1.0.2': store => {
|
|
3398
|
+
store.set('phase', '1.0.2');
|
|
3399
|
+
},
|
|
3400
|
+
'>=2.0.0': store => {
|
|
3401
|
+
store.set('phase', '>=2.0.0');
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
});
|
|
3405
|
+
```
|
|
3406
|
+
*/
|
|
3407
|
+
migrations?: Migrations<T>;
|
|
3408
|
+
/**
|
|
3409
|
+
__You most likely don't need this. Please don't use it unless you really have to.__
|
|
3410
|
+
|
|
3411
|
+
The only use-case I can think of is having the config located in the app directory or on some external storage. Default: System default user [config directory](https://github.com/sindresorhus/env-paths#pathsconfig).
|
|
3412
|
+
*/
|
|
3413
|
+
cwd?: string;
|
|
3414
|
+
/**
|
|
3415
|
+
Note that this is __not intended for security purposes__, since the encryption key would be easily found inside a plain-text Node.js app.
|
|
3416
|
+
|
|
3417
|
+
Its main use is for obscurity. If a user looks through the config directory and finds the config file, since it's just a JSON file, they may be tempted to modify it. By providing an encryption key, the file will be obfuscated, which should hopefully deter any users from doing so.
|
|
3418
|
+
|
|
3419
|
+
It also has the added bonus of ensuring the config file's integrity. If the file is changed in any way, the decryption will not work, in which case the store will just reset back to its default state.
|
|
3420
|
+
|
|
3421
|
+
When specified, the store will be encrypted using the [`aes-256-cbc`](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation) encryption algorithm.
|
|
3422
|
+
*/
|
|
3423
|
+
encryptionKey?: string | Buffer | NodeJS.TypedArray | DataView;
|
|
3424
|
+
/**
|
|
3425
|
+
Extension of the config file.
|
|
3426
|
+
|
|
3427
|
+
You would usually not need this, but could be useful if you want to interact with a file with a custom file extension that can be associated with your app. These might be simple save/export/preference files that are intended to be shareable or saved outside of the app.
|
|
3428
|
+
|
|
3429
|
+
@default 'json'
|
|
3430
|
+
*/
|
|
3431
|
+
fileExtension?: string;
|
|
3432
|
+
/**
|
|
3433
|
+
The config is cleared if reading the config file causes a `SyntaxError`. This is a good behavior for unimportant data, as the config file is not intended to be hand-edited, so it usually means the config is corrupt and there's nothing the user can do about it anyway. However, if you let the user edit the config file directly, mistakes might happen and it could be more useful to throw an error when the config is invalid instead of clearing.
|
|
3434
|
+
|
|
3435
|
+
@default false
|
|
3436
|
+
*/
|
|
3437
|
+
clearInvalidConfig?: boolean;
|
|
3438
|
+
/**
|
|
3439
|
+
Function to serialize the config object to a UTF-8 string when writing the config file.
|
|
3440
|
+
|
|
3441
|
+
You would usually not need this, but it could be useful if you want to use a format other than JSON.
|
|
3442
|
+
|
|
3443
|
+
@default value => JSON.stringify(value, null, '\t')
|
|
3444
|
+
*/
|
|
3445
|
+
readonly serialize?: Serialize<T>;
|
|
3446
|
+
/**
|
|
3447
|
+
Function to deserialize the config object from a UTF-8 string when reading the config file.
|
|
3448
|
+
|
|
3449
|
+
You would usually not need this, but it could be useful if you want to use a format other than JSON.
|
|
3450
|
+
|
|
3451
|
+
@default JSON.parse
|
|
3452
|
+
*/
|
|
3453
|
+
readonly deserialize?: Deserialize<T>;
|
|
3454
|
+
/**
|
|
3455
|
+
__You most likely don't need this. Please don't use it unless you really have to.__
|
|
3456
|
+
|
|
3457
|
+
Suffix appended to `projectName` during config file creation to avoid name conflicts with native apps.
|
|
3458
|
+
|
|
3459
|
+
You can pass an empty string to remove the suffix.
|
|
3460
|
+
|
|
3461
|
+
For example, on macOS, the config file will be stored in the `~/Library/Preferences/foo-nodejs` directory, where `foo` is the `projectName`.
|
|
3462
|
+
|
|
3463
|
+
@default 'nodejs'
|
|
3464
|
+
*/
|
|
3465
|
+
readonly projectSuffix?: string;
|
|
3466
|
+
/**
|
|
3467
|
+
Access nested properties by dot notation.
|
|
3468
|
+
|
|
3469
|
+
@default true
|
|
3470
|
+
|
|
3471
|
+
@example
|
|
3472
|
+
```
|
|
3473
|
+
const config = new Conf();
|
|
3474
|
+
|
|
3475
|
+
config.set({
|
|
3476
|
+
foo: {
|
|
3477
|
+
bar: {
|
|
3478
|
+
foobar: '🦄'
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
});
|
|
3482
|
+
|
|
3483
|
+
console.log(config.get('foo.bar.foobar'));
|
|
3484
|
+
//=> '🦄'
|
|
3485
|
+
```
|
|
3486
|
+
|
|
3487
|
+
Alternatively, you can set this option to `false` so the whole string would be treated as one key.
|
|
3488
|
+
|
|
3489
|
+
@example
|
|
3490
|
+
```
|
|
3491
|
+
const config = new Conf({accessPropertiesByDotNotation: false});
|
|
3492
|
+
|
|
3493
|
+
config.set({
|
|
3494
|
+
`foo.bar.foobar`: '🦄'
|
|
3495
|
+
});
|
|
3496
|
+
|
|
3497
|
+
console.log(config.get('foo.bar.foobar'));
|
|
3498
|
+
//=> '🦄'
|
|
3499
|
+
```
|
|
3500
|
+
|
|
3501
|
+
*/
|
|
3502
|
+
readonly accessPropertiesByDotNotation?: boolean;
|
|
3503
|
+
/**
|
|
3504
|
+
Watch for any changes in the config file and call the callback for `onDidChange` or `onDidAnyChange` if set. This is useful if there are multiple processes changing the same config file.
|
|
3505
|
+
|
|
3506
|
+
@default false
|
|
3507
|
+
*/
|
|
3508
|
+
readonly watch?: boolean;
|
|
3509
|
+
/**
|
|
3510
|
+
The [mode](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) that will be used for the config file.
|
|
3511
|
+
|
|
3512
|
+
You would usually not need this, but it could be useful if you want to restrict the permissions of the config file. Setting a permission such as `0o600` would result in a config file that can only be accessed by the user running the program.
|
|
3513
|
+
|
|
3514
|
+
Note that setting restrictive permissions can cause problems if different users need to read the file. A common problem is a user running your tool with and without `sudo` and then not being able to access the config the second time.
|
|
3515
|
+
|
|
3516
|
+
@default 0o666
|
|
3517
|
+
*/
|
|
3518
|
+
readonly configFileMode?: number;
|
|
3519
|
+
}
|
|
3520
|
+
declare type Migrations<T> = Record<string, (store: Conf<T>) => void>;
|
|
3521
|
+
declare type Schema<T> = {
|
|
3522
|
+
[Property in keyof T]: ValueSchema;
|
|
3523
|
+
};
|
|
3524
|
+
declare type ValueSchema = JSONSchema;
|
|
3525
|
+
declare type Serialize<T> = (value: T) => string;
|
|
3526
|
+
declare type Deserialize<T> = (text: string) => T;
|
|
3527
|
+
declare type OnDidChangeCallback<T> = (newValue?: T, oldValue?: T) => void;
|
|
3528
|
+
declare type OnDidAnyChangeCallback<T> = (newValue?: Readonly<T>, oldValue?: Readonly<T>) => void;
|
|
3529
|
+
declare type Unsubscribe = () => EventEmitter;
|
|
3530
|
+
|
|
3531
|
+
declare class Conf<T extends Record<string, any> = Record<string, unknown>> implements Iterable<[keyof T, T[keyof T]]> {
|
|
3532
|
+
#private;
|
|
3533
|
+
readonly path: string;
|
|
3534
|
+
readonly events: EventEmitter;
|
|
3535
|
+
constructor(partialOptions?: Readonly<Partial<Options<T>>>);
|
|
3536
|
+
/**
|
|
3537
|
+
Get an item.
|
|
3538
|
+
|
|
3539
|
+
@param key - The key of the item to get.
|
|
3540
|
+
@param defaultValue - The default value if the item does not exist.
|
|
3541
|
+
*/
|
|
3542
|
+
get<Key extends keyof T>(key: Key): T[Key];
|
|
3543
|
+
get<Key extends keyof T>(key: Key, defaultValue: Required<T>[Key]): Required<T>[Key];
|
|
3544
|
+
get<Key extends string, Value = unknown>(key: Exclude<Key, keyof T>, defaultValue?: Value): Value;
|
|
3545
|
+
/**
|
|
3546
|
+
Set an item or multiple items at once.
|
|
3547
|
+
|
|
3548
|
+
@param {key|object} - You can use [dot-notation](https://github.com/sindresorhus/dot-prop) in a key to access nested properties. Or a hashmap of items to set at once.
|
|
3549
|
+
@param value - Must be JSON serializable. Trying to set the type `undefined`, `function`, or `symbol` will result in a `TypeError`.
|
|
3550
|
+
*/
|
|
3551
|
+
set<Key extends keyof T>(key: Key, value?: T[Key]): void;
|
|
3552
|
+
set(key: string, value: unknown): void;
|
|
3553
|
+
set(object: Partial<T>): void;
|
|
3554
|
+
/**
|
|
3555
|
+
Check if an item exists.
|
|
3556
|
+
|
|
3557
|
+
@param key - The key of the item to check.
|
|
3558
|
+
*/
|
|
3559
|
+
has<Key extends keyof T>(key: Key | string): boolean;
|
|
3560
|
+
/**
|
|
3561
|
+
Reset items to their default values, as defined by the `defaults` or `schema` option.
|
|
3562
|
+
|
|
3563
|
+
@see `clear()` to reset all items.
|
|
3564
|
+
|
|
3565
|
+
@param keys - The keys of the items to reset.
|
|
3566
|
+
*/
|
|
3567
|
+
reset<Key extends keyof T>(...keys: Key[]): void;
|
|
3568
|
+
/**
|
|
3569
|
+
Delete an item.
|
|
3570
|
+
|
|
3571
|
+
@param key - The key of the item to delete.
|
|
3572
|
+
*/
|
|
3573
|
+
delete<Key extends keyof T>(key: Key): void;
|
|
3574
|
+
/**
|
|
3575
|
+
Delete all items.
|
|
3576
|
+
|
|
3577
|
+
This resets known items to their default values, if defined by the `defaults` or `schema` option.
|
|
3578
|
+
*/
|
|
3579
|
+
clear(): void;
|
|
3580
|
+
/**
|
|
3581
|
+
Watches the given `key`, calling `callback` on any changes.
|
|
3582
|
+
|
|
3583
|
+
@param key - The key wo watch.
|
|
3584
|
+
@param callback - A callback function that is called on any changes. When a `key` is first set `oldValue` will be `undefined`, and when a key is deleted `newValue` will be `undefined`.
|
|
3585
|
+
@returns A function, that when called, will unsubscribe.
|
|
3586
|
+
*/
|
|
3587
|
+
onDidChange<Key extends keyof T>(key: Key, callback: OnDidChangeCallback<T[Key]>): Unsubscribe;
|
|
3588
|
+
/**
|
|
3589
|
+
Watches the whole config object, calling `callback` on any changes.
|
|
3590
|
+
|
|
3591
|
+
@param callback - A callback function that is called on any changes. When a `key` is first set `oldValue` will be `undefined`, and when a key is deleted `newValue` will be `undefined`.
|
|
3592
|
+
@returns A function, that when called, will unsubscribe.
|
|
3593
|
+
*/
|
|
3594
|
+
onDidAnyChange(callback: OnDidAnyChangeCallback<T>): Unsubscribe;
|
|
3595
|
+
get size(): number;
|
|
3596
|
+
get store(): T;
|
|
3597
|
+
set store(value: T);
|
|
3598
|
+
[Symbol.iterator](): IterableIterator<[keyof T, T[keyof T]]>;
|
|
3599
|
+
private _encryptData;
|
|
3600
|
+
private _handleChange;
|
|
3601
|
+
private readonly _deserialize;
|
|
3602
|
+
private readonly _serialize;
|
|
3603
|
+
private _validate;
|
|
3604
|
+
private _ensureDirectory;
|
|
3605
|
+
private _write;
|
|
3606
|
+
private _watch;
|
|
3607
|
+
private _migrate;
|
|
3608
|
+
private _containsReservedKey;
|
|
3609
|
+
private _isVersionInRangeFormat;
|
|
3610
|
+
private _shouldPerformMigration;
|
|
3611
|
+
private _get;
|
|
3612
|
+
private _set;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
declare const cliKit: Conf<any>;
|
|
3616
|
+
|
|
3617
|
+
declare const store_cliKit: typeof cliKit;
|
|
3618
|
+
declare namespace store {
|
|
3619
|
+
export {
|
|
3620
|
+
store_cliKit as cliKit,
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
/** @type {typeof globalThis.Blob} */
|
|
3625
|
+
declare const Blob: typeof globalThis.Blob;
|
|
3626
|
+
|
|
3627
|
+
/// <reference lib="dom" />
|
|
3628
|
+
|
|
3629
|
+
|
|
3630
|
+
type AbortSignal = {
|
|
3631
|
+
readonly aborted: boolean;
|
|
3632
|
+
|
|
3633
|
+
addEventListener: (type: 'abort', listener: (this: AbortSignal) => void) => void;
|
|
3634
|
+
removeEventListener: (type: 'abort', listener: (this: AbortSignal) => void) => void;
|
|
3635
|
+
};
|
|
3636
|
+
|
|
3637
|
+
type HeadersInit = Headers | Record<string, string> | Iterable<readonly [string, string]> | Iterable<Iterable<string>>;
|
|
3638
|
+
|
|
3639
|
+
|
|
3640
|
+
/**
|
|
3641
|
+
* This Fetch API interface allows you to perform various actions on HTTP request and response headers.
|
|
3642
|
+
* These actions include retrieving, setting, adding to, and removing.
|
|
3643
|
+
* A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.
|
|
3644
|
+
* You can add to this using methods like append() (see Examples.)
|
|
3645
|
+
* In all methods of this interface, header names are matched by case-insensitive byte sequence.
|
|
3646
|
+
* */
|
|
3647
|
+
declare class Headers {
|
|
3648
|
+
constructor(init?: HeadersInit);
|
|
3649
|
+
|
|
3650
|
+
append(name: string, value: string): void;
|
|
3651
|
+
delete(name: string): void;
|
|
3652
|
+
get(name: string): string | null;
|
|
3653
|
+
has(name: string): boolean;
|
|
3654
|
+
set(name: string, value: string): void;
|
|
3655
|
+
forEach(
|
|
3656
|
+
callbackfn: (value: string, key: string, parent: Headers) => void,
|
|
3657
|
+
thisArg?: any
|
|
3658
|
+
): void;
|
|
3659
|
+
|
|
3660
|
+
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
3661
|
+
/**
|
|
3662
|
+
* Returns an iterator allowing to go through all key/value pairs contained in this object.
|
|
3663
|
+
*/
|
|
3664
|
+
entries(): IterableIterator<[string, string]>;
|
|
3665
|
+
/**
|
|
3666
|
+
* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
|
|
3667
|
+
*/
|
|
3668
|
+
keys(): IterableIterator<string>;
|
|
3669
|
+
/**
|
|
3670
|
+
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
|
|
3671
|
+
*/
|
|
3672
|
+
values(): IterableIterator<string>;
|
|
3673
|
+
|
|
3674
|
+
/** Node-fetch extension */
|
|
3675
|
+
raw(): Record<string, string[]>;
|
|
3676
|
+
}
|
|
3677
|
+
|
|
3678
|
+
interface RequestInit {
|
|
3679
|
+
/**
|
|
3680
|
+
* A BodyInit object or null to set request's body.
|
|
3681
|
+
*/
|
|
3682
|
+
body?: BodyInit | null;
|
|
3683
|
+
/**
|
|
3684
|
+
* A Headers object, an object literal, or an array of two-item arrays to set request's headers.
|
|
3685
|
+
*/
|
|
3686
|
+
headers?: HeadersInit;
|
|
3687
|
+
/**
|
|
3688
|
+
* A string to set request's method.
|
|
3689
|
+
*/
|
|
3690
|
+
method?: string;
|
|
3691
|
+
/**
|
|
3692
|
+
* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.
|
|
3693
|
+
*/
|
|
3694
|
+
redirect?: RequestRedirect;
|
|
3695
|
+
/**
|
|
3696
|
+
* An AbortSignal to set request's signal.
|
|
3697
|
+
*/
|
|
3698
|
+
signal?: AbortSignal | null;
|
|
3699
|
+
/**
|
|
3700
|
+
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request’s referrer.
|
|
3701
|
+
*/
|
|
3702
|
+
referrer?: string;
|
|
3703
|
+
/**
|
|
3704
|
+
* A referrer policy to set request’s referrerPolicy.
|
|
3705
|
+
*/
|
|
3706
|
+
referrerPolicy?: ReferrerPolicy;
|
|
3707
|
+
|
|
3708
|
+
// Node-fetch extensions to the whatwg/fetch spec
|
|
3709
|
+
agent?: RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']);
|
|
3710
|
+
compress?: boolean;
|
|
3711
|
+
counter?: number;
|
|
3712
|
+
follow?: number;
|
|
3713
|
+
hostname?: string;
|
|
3714
|
+
port?: number;
|
|
3715
|
+
protocol?: string;
|
|
3716
|
+
size?: number;
|
|
3717
|
+
highWaterMark?: number;
|
|
3718
|
+
insecureHTTPParser?: boolean;
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
interface ResponseInit {
|
|
3722
|
+
headers?: HeadersInit;
|
|
3723
|
+
status?: number;
|
|
3724
|
+
statusText?: string;
|
|
3725
|
+
}
|
|
3726
|
+
|
|
3727
|
+
type BodyInit =
|
|
3728
|
+
| Blob
|
|
3729
|
+
| Buffer
|
|
3730
|
+
| URLSearchParams
|
|
3731
|
+
| FormData
|
|
3732
|
+
| NodeJS.ReadableStream
|
|
3733
|
+
| string;
|
|
3734
|
+
declare class BodyMixin {
|
|
3735
|
+
constructor(body?: BodyInit, options?: {size?: number});
|
|
3736
|
+
|
|
3737
|
+
readonly body: NodeJS.ReadableStream | null;
|
|
3738
|
+
readonly bodyUsed: boolean;
|
|
3739
|
+
readonly size: number;
|
|
3740
|
+
|
|
3741
|
+
/** @deprecated Use `body.arrayBuffer()` instead. */
|
|
3742
|
+
buffer(): Promise<Buffer>;
|
|
3743
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
3744
|
+
formData(): Promise<FormData>;
|
|
3745
|
+
blob(): Promise<Blob>;
|
|
3746
|
+
json(): Promise<unknown>;
|
|
3747
|
+
text(): Promise<string>;
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
type RequestRedirect = 'error' | 'follow' | 'manual';
|
|
3751
|
+
type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
|
3752
|
+
type RequestInfo = string | Request;
|
|
3753
|
+
declare class Request extends BodyMixin {
|
|
3754
|
+
constructor(input: RequestInfo, init?: RequestInit);
|
|
3755
|
+
|
|
3756
|
+
/**
|
|
3757
|
+
* Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.
|
|
3758
|
+
*/
|
|
3759
|
+
readonly headers: Headers;
|
|
3760
|
+
/**
|
|
3761
|
+
* Returns request's HTTP method, which is "GET" by default.
|
|
3762
|
+
*/
|
|
3763
|
+
readonly method: string;
|
|
3764
|
+
/**
|
|
3765
|
+
* Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.
|
|
3766
|
+
*/
|
|
3767
|
+
readonly redirect: RequestRedirect;
|
|
3768
|
+
/**
|
|
3769
|
+
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
|
3770
|
+
*/
|
|
3771
|
+
readonly signal: AbortSignal;
|
|
3772
|
+
/**
|
|
3773
|
+
* Returns the URL of request as a string.
|
|
3774
|
+
*/
|
|
3775
|
+
readonly url: string;
|
|
3776
|
+
/**
|
|
3777
|
+
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request’s referrer.
|
|
3778
|
+
*/
|
|
3779
|
+
readonly referrer: string;
|
|
3780
|
+
/**
|
|
3781
|
+
* A referrer policy to set request’s referrerPolicy.
|
|
3782
|
+
*/
|
|
3783
|
+
readonly referrerPolicy: ReferrerPolicy;
|
|
3784
|
+
clone(): Request;
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
|
|
3788
|
+
|
|
3789
|
+
declare class Response$1 extends BodyMixin {
|
|
3790
|
+
constructor(body?: BodyInit | null, init?: ResponseInit);
|
|
3791
|
+
|
|
3792
|
+
readonly headers: Headers;
|
|
3793
|
+
readonly ok: boolean;
|
|
3794
|
+
readonly redirected: boolean;
|
|
3795
|
+
readonly status: number;
|
|
3796
|
+
readonly statusText: string;
|
|
3797
|
+
readonly type: ResponseType;
|
|
3798
|
+
readonly url: string;
|
|
3799
|
+
clone(): Response$1;
|
|
3800
|
+
|
|
3801
|
+
static error(): Response$1;
|
|
3802
|
+
static redirect(url: string, status?: number): Response$1;
|
|
3803
|
+
}
|
|
3804
|
+
declare function fetch$1(url: RequestInfo, init?: RequestInit): Promise<Response$1>;
|
|
3805
|
+
|
|
3806
|
+
declare type Response = ReturnType<typeof fetch$1>;
|
|
3807
|
+
/**
|
|
3808
|
+
* An interface that abstracts way node-fetch. When Node has built-in
|
|
3809
|
+
* support for "fetch" in the standard library, we can drop the node-fetch
|
|
3810
|
+
* dependency from here.
|
|
3811
|
+
* Note that we are exposing types from "node-fetch". The reason being is that
|
|
3812
|
+
* they are consistent with the Web API so if we drop node-fetch in the future
|
|
3813
|
+
* it won't require changes from the callers.
|
|
3814
|
+
* @param url {RequestInfo} This defines the resource that you wish to fetch.
|
|
3815
|
+
* @param init {RequestInit} An object containing any custom settings that you want to apply to the request
|
|
3816
|
+
* @returns A promise that resolves with the response.
|
|
3817
|
+
*/
|
|
3818
|
+
declare function fetch(url: RequestInfo, init?: RequestInit): Response;
|
|
3819
|
+
|
|
3820
|
+
declare const http_fetch: typeof fetch;
|
|
3821
|
+
declare namespace http {
|
|
3822
|
+
export {
|
|
3823
|
+
http_fetch as fetch,
|
|
3824
|
+
};
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
declare const constants: {
|
|
3828
|
+
environmentVariables: {
|
|
3829
|
+
debug: string;
|
|
3830
|
+
runAsUser: string;
|
|
3831
|
+
partnersEnv: string;
|
|
3832
|
+
shopifyEnv: string;
|
|
3833
|
+
identityEnv: string;
|
|
3834
|
+
spin: string;
|
|
3835
|
+
spinInstance: string;
|
|
3836
|
+
spinWorkspace: string;
|
|
3837
|
+
spinNamespace: string;
|
|
3838
|
+
spinHost: string;
|
|
3839
|
+
};
|
|
3840
|
+
paths: {
|
|
3841
|
+
executables: {
|
|
3842
|
+
dev: string;
|
|
3843
|
+
};
|
|
3844
|
+
};
|
|
3845
|
+
/**
|
|
3846
|
+
* Versions are resolved at build time by Rollup's JSON plugin.
|
|
3847
|
+
*/
|
|
3848
|
+
versions: {
|
|
3849
|
+
cliKit: string;
|
|
3850
|
+
/**
|
|
3851
|
+
* cli-kit can resolve the version of cli at build time because
|
|
3852
|
+
* the version of both packages is tied. If it wasn't, wen'd need
|
|
3853
|
+
* to resolve the version at build time.
|
|
3854
|
+
* Check out the linked configuration in .changeset/config.json
|
|
3855
|
+
*/
|
|
3856
|
+
cli: string;
|
|
3857
|
+
};
|
|
3858
|
+
keychain: {
|
|
3859
|
+
service: string;
|
|
3860
|
+
};
|
|
3861
|
+
};
|
|
3862
|
+
|
|
3863
|
+
export { constants, dependency, environment, error$1 as error, file, http, os, output$1 as output, path, schema, session, store, string, system, template, toml, ui, version };
|
|
3864
|
+
//# sourceMappingURL=index.d.ts.map
|