@agentcomms/whatsapp 0.13.0 → 0.13.1
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/README.md +1 -1
- package/dist/cli.mjs +97 -82
- package/dist/index.d.mts +2893 -1654
- package/dist/index.mjs +2 -3
- package/dist/{server-DIlBV3Wu.mjs → server-DNyMO_pq.mjs} +5 -5
- package/dist/{stdio-entry-BCIfuv69.mjs → stdio-entry-vXXVDpnA.mjs} +1 -1
- package/dist/{sync-fzUQKMxy.mjs → sync-DrWJVoXp.mjs} +2189 -757
- package/package.json +6 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,1298 +1,203 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
import { styleText } from "node:util";
|
|
2
3
|
//#endregion
|
|
3
4
|
//#region src/version.d.ts
|
|
4
5
|
/** The package version, read from package.json at build time. */
|
|
5
6
|
export declare const VERSION: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Using JSON Pointer fragments requires knowledge of the structure of the
|
|
17
|
-
* schema. When writing schema documents with the intention to provide
|
|
18
|
-
* re-usable schemas, it may be preferable to use a plain name fragment
|
|
19
|
-
* that is not tied to any particular structural location. This allows a
|
|
20
|
-
* subschema to be relocated without requiring JSON Pointer references to
|
|
21
|
-
* be updated.
|
|
22
|
-
*
|
|
23
|
-
* The `$anchor` keyword is used to specify such a fragment. It is an
|
|
24
|
-
* identifier keyword that can only be used to create plain name fragments.
|
|
25
|
-
*
|
|
26
|
-
* If present, the value of this keyword MUST be a string, which MUST start
|
|
27
|
-
* with a letter `[A-Za-z]`, followed by any number of letters, digits
|
|
28
|
-
* `[0-9]`, hyphens `-`, underscores `_`, colons `:`,
|
|
29
|
-
* or periods `.`.
|
|
30
|
-
*
|
|
31
|
-
* Note that the anchor string does not include the `#` character,
|
|
32
|
-
* as it is not a URI-reference. An `{"$anchor": "foo"}` becomes the
|
|
33
|
-
* fragment `#foo` when used in a URI.
|
|
34
|
-
*
|
|
35
|
-
* The base URI to which the resulting fragment is appended is determined
|
|
36
|
-
* by the `$id` keyword as explained in the previous section.
|
|
37
|
-
* Two `$anchor` keywords in the same schema document MAY have the same
|
|
38
|
-
* value if they apply to different base URIs, as the resulting full URIs
|
|
39
|
-
* will be distinct. However, the effect of two `$anchor` keywords
|
|
40
|
-
* with the same value and the same base URI is undefined. Implementations
|
|
41
|
-
* MAY raise an error if such usage is detected.
|
|
42
|
-
*/
|
|
7
|
+
declare namespace json_schema_d_exports {
|
|
8
|
+
export { ArraySchema, BaseSchema, BooleanSchema, IntegerSchema, JSONSchema$1 as JSONSchema, NullSchema, NumberSchema, ObjectSchema, Schema$1 as Schema, SchemaType, StringSchema, _JSONSchema };
|
|
9
|
+
}
|
|
10
|
+
type Schema$1 = ObjectSchema | ArraySchema | StringSchema | NumberSchema | IntegerSchema | BooleanSchema | NullSchema;
|
|
11
|
+
type _JSONSchema = boolean | JSONSchema$1;
|
|
12
|
+
type SchemaType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
13
|
+
type JSONSchema$1 = {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
16
|
+
$id?: string;
|
|
43
17
|
$anchor?: string;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* The value of this keyword MUST be a string. Implementations MUST NOT
|
|
49
|
-
* present this string to end users. Tools for editing schemas SHOULD
|
|
50
|
-
* support displaying and editing this keyword. The value of this keyword
|
|
51
|
-
* MAY be used in debug or error output which is intended for developers
|
|
52
|
-
* making use of schemas.
|
|
53
|
-
*
|
|
54
|
-
* Schema vocabularies SHOULD allow `$comment` within any object
|
|
55
|
-
* containing vocabulary keywords. Implementations MAY assume `$comment`
|
|
56
|
-
* is allowed unless the vocabulary specifically forbids it. Vocabularies
|
|
57
|
-
* MUST NOT specify any effect of `$comment` beyond what is described in
|
|
58
|
-
* this specification.
|
|
59
|
-
*
|
|
60
|
-
* Tools that translate other media types or programming languages
|
|
61
|
-
* to and from `application/schema+json` MAY choose to convert that media
|
|
62
|
-
* type or programming language's native comments to or from `$comment`
|
|
63
|
-
* values. The behavior of such translation when both native comments and
|
|
64
|
-
* `$comment` properties are present is implementation-dependent.
|
|
65
|
-
*
|
|
66
|
-
* Implementations MAY strip `$comment` values at any point during
|
|
67
|
-
* processing. In particular, this allows for shortening schemas when the
|
|
68
|
-
* size of deployed schemas is a concern.
|
|
69
|
-
*
|
|
70
|
-
* Implementations MUST NOT take any other action based on the presence,
|
|
71
|
-
* absence, or contents of `$comment` properties. In particular, the
|
|
72
|
-
* value of `$comment` MUST NOT be collected as an annotation result.
|
|
73
|
-
*/
|
|
18
|
+
$ref?: string;
|
|
19
|
+
$dynamicRef?: string;
|
|
20
|
+
$dynamicAnchor?: string;
|
|
21
|
+
$vocabulary?: Record<string, boolean>;
|
|
74
22
|
$comment?: string;
|
|
75
|
-
/**
|
|
76
|
-
* The `$defs` keyword reserves a location for schema authors to inline
|
|
77
|
-
* re-usable JSON Schemas into a more general schema. The keyword does not
|
|
78
|
-
* directly affect the validation result.
|
|
79
|
-
*
|
|
80
|
-
* This keyword's value MUST be an object. Each member value of this object
|
|
81
|
-
* MUST be a valid JSON Schema.
|
|
82
|
-
*/
|
|
83
23
|
$defs?: Record<string, JSONSchema$1>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* The
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
* the child values of instance names that do not appear in the annotation
|
|
262
|
-
* results of either `properties` or `patternProperties`.
|
|
263
|
-
*
|
|
264
|
-
* For all such properties, validation succeeds if the child instance
|
|
265
|
-
* validates against the `additionalProperties` schema.
|
|
266
|
-
*
|
|
267
|
-
* The annotation result of this keyword is the set of instance property
|
|
268
|
-
* names validated by this keyword's subschema. Annotation results for
|
|
269
|
-
* `additionalProperties` keywords from multiple schemas applied to the
|
|
270
|
-
* same instance location are combined by taking the union of the sets.
|
|
271
|
-
*
|
|
272
|
-
* Omitting this keyword has the same assertion behavior as an empty
|
|
273
|
-
* schema.
|
|
274
|
-
*
|
|
275
|
-
* Implementations MAY choose to implement or optimize this keyword in
|
|
276
|
-
* another way that produces the same effect, such as by directly checking
|
|
277
|
-
* the names in `properties` and the patterns in `patternProperties`
|
|
278
|
-
* against the instance property set.
|
|
279
|
-
*/
|
|
280
|
-
additionalProperties?: JSONSchema$1;
|
|
281
|
-
/**
|
|
282
|
-
* This keyword's value MUST be a non-empty array. Each item of the array
|
|
283
|
-
* MUST be a valid JSON Schema.
|
|
284
|
-
*
|
|
285
|
-
* An instance validates successfully against this keyword if it validates
|
|
286
|
-
* successfully against all schemas defined by this keyword's value.
|
|
287
|
-
*/
|
|
288
|
-
allOf?: MaybeReadonlyArray<JSONSchema$1<Value, SchemaType>>;
|
|
289
|
-
/**
|
|
290
|
-
* This keyword's value MUST be a non-empty array. Each item of the array
|
|
291
|
-
* MUST be a valid JSON Schema.
|
|
292
|
-
*
|
|
293
|
-
* An instance validates successfully against this keyword if it validates
|
|
294
|
-
* successfully against at least one schema defined by this keyword's
|
|
295
|
-
* value.
|
|
296
|
-
*/
|
|
297
|
-
anyOf?: MaybeReadonlyArray<JSONSchema$1<Value, SchemaType>>;
|
|
298
|
-
/**
|
|
299
|
-
* An instance validates successfully against this keyword if its value is
|
|
300
|
-
* equal to the value of the keyword.
|
|
301
|
-
*
|
|
302
|
-
* Use of this keyword is functionally equivalent to the `enum` keyword
|
|
303
|
-
* with a single value.
|
|
304
|
-
*/
|
|
305
|
-
const?: Value;
|
|
306
|
-
/**
|
|
307
|
-
* The value of this keyword MUST be a valid JSON Schema.
|
|
308
|
-
*
|
|
309
|
-
* An array instance is valid against `contains` if at least one of its
|
|
310
|
-
* elements is valid against the given schema. The subschema MUST be
|
|
311
|
-
* applied to every array element even after the first match has been
|
|
312
|
-
* found, in order to collect annotations for use by other keywords.
|
|
313
|
-
* This is to ensure that all possible annotations are collected.
|
|
314
|
-
*
|
|
315
|
-
* Logically, the validation result of applying the value subschema to each
|
|
316
|
-
* item in the array MUST be OR'ed with `false`, resulting in an overall
|
|
317
|
-
* validation result.
|
|
318
|
-
*
|
|
319
|
-
* This keyword produces an annotation value which is an array of the
|
|
320
|
-
* indexes to which this keyword validates successfully when applying its
|
|
321
|
-
* subschema, in ascending order. The value MAY be a boolean `true` if
|
|
322
|
-
* the subschema validates successfully when applied to every index of the
|
|
323
|
-
* instance. The annotation MUST be present if the instance array to which
|
|
324
|
-
* this keyword's schema applies is empty.
|
|
325
|
-
*/
|
|
326
|
-
contains?: JSONSchema$1<Value, SchemaType>;
|
|
327
|
-
/**
|
|
328
|
-
* If the instance value is a string, this property defines that the
|
|
329
|
-
* string SHOULD be interpreted as binary data and decoded using the
|
|
330
|
-
* encoding named by this property. [RFC 2045, Sec 6.1][RFC2045] lists the
|
|
331
|
-
* possible values for this property.
|
|
332
|
-
*
|
|
333
|
-
* The value of this property SHOULD be ignored if the instance described
|
|
334
|
-
* is not a string.
|
|
335
|
-
*
|
|
336
|
-
* If this keyword is absent, but `contentMediaType` is present, this
|
|
337
|
-
* indicates that the media type could be encoded into `UTF-8` like any
|
|
338
|
-
* other JSON string value, and does not require additional decoding.
|
|
339
|
-
*
|
|
340
|
-
* The value of this property MUST be a string.
|
|
341
|
-
*
|
|
342
|
-
* [RFC2045]: https://datatracker.ietf.org/doc/html/rfc2045#section-6.1
|
|
343
|
-
*/
|
|
344
|
-
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
345
|
-
/**
|
|
346
|
-
* If the instance is a string, this property indicates the media type
|
|
347
|
-
* of the contents of the string. If `contentEncoding` is present,
|
|
348
|
-
* this property describes the decoded string.
|
|
349
|
-
*
|
|
350
|
-
* The value of this property must be a media type, as defined by
|
|
351
|
-
* [RFC 2046][RFC2046]. This property defines the media type of instances
|
|
352
|
-
* which this schema defines.
|
|
353
|
-
*
|
|
354
|
-
* The value of this property SHOULD be ignored if the instance described
|
|
355
|
-
* is not a string.
|
|
356
|
-
*
|
|
357
|
-
* If the `contentEncoding` property is not present, but the instance
|
|
358
|
-
* value is a string, then the value of this property SHOULD specify a text
|
|
359
|
-
* document type, and the character set SHOULD be the character set into
|
|
360
|
-
* which the JSON string value was decoded (for which the default is
|
|
361
|
-
* Unicode).
|
|
362
|
-
*
|
|
363
|
-
* [RFC2046]: https://datatracker.ietf.org/doc/html/rfc2046
|
|
364
|
-
*/
|
|
365
|
-
contentMediaType?: string;
|
|
366
|
-
/**
|
|
367
|
-
* If the instance is a string, and if `contentMediaType` is present,
|
|
368
|
-
* this property contains a schema which describes the structure of the
|
|
369
|
-
* string.
|
|
370
|
-
*
|
|
371
|
-
* This keyword MAY be used with any media type that can be mapped into
|
|
372
|
-
* JSON Schema's data model.
|
|
373
|
-
*
|
|
374
|
-
* The value of this property MUST be a valid JSON schema. It SHOULD be
|
|
375
|
-
* ignored if `contentMediaType` is not present.
|
|
376
|
-
*/
|
|
377
|
-
contentSchema?: JSONSchema$1<Value, SchemaType>;
|
|
378
|
-
/**
|
|
379
|
-
* This keyword can be used to supply a default JSON value associated with
|
|
380
|
-
* a particular schema. It is RECOMMENDED that a `default` value be valid
|
|
381
|
-
* against the associated schema.
|
|
382
|
-
*/
|
|
383
|
-
default?: Value;
|
|
384
|
-
/**
|
|
385
|
-
* @deprecated `definitions` has been renamed to `$defs`.
|
|
386
|
-
*/
|
|
387
|
-
definitions?: Record<string, JSONSchema$1>;
|
|
388
|
-
/**
|
|
389
|
-
* @deprecated `dependencies` has been split into two keywords:
|
|
390
|
-
* `dependentSchemas` and `dependentRequired`.
|
|
391
|
-
*/
|
|
392
|
-
dependencies?: Record<string, MaybeReadonlyArray<string> | JSONSchema$1>;
|
|
393
|
-
/**
|
|
394
|
-
* The value of this keyword MUST be an object. Properties in
|
|
395
|
-
* this object, if any, MUST be arrays. Elements in each array,
|
|
396
|
-
* if any, MUST be strings, and MUST be unique.
|
|
397
|
-
*
|
|
398
|
-
* This keyword specifies properties that are required if a specific
|
|
399
|
-
* other property is present. Their requirement is dependent on the
|
|
400
|
-
* presence of the other property.
|
|
401
|
-
*
|
|
402
|
-
* Validation succeeds if, for each name that appears in both
|
|
403
|
-
* the instance and as a name within this keyword's value, every
|
|
404
|
-
* item in the corresponding array is also the name of a property
|
|
405
|
-
* in the instance.
|
|
406
|
-
*
|
|
407
|
-
* Omitting this keyword has the same behavior as an empty object.
|
|
408
|
-
*/
|
|
409
|
-
dependentRequired?: Record<string, MaybeReadonlyArray<string>>;
|
|
410
|
-
/**
|
|
411
|
-
* This keyword specifies subschemas that are evaluated if the instance is
|
|
412
|
-
* an object and contains a certain property.
|
|
413
|
-
*
|
|
414
|
-
* This keyword's value MUST be an object. Each value in the object MUST be
|
|
415
|
-
* a valid JSON Schema.
|
|
416
|
-
*
|
|
417
|
-
* If the object key is a property in the instance, the entire instance
|
|
418
|
-
* must validate against the subschema. Its use is dependent on the
|
|
419
|
-
* presence of the property.
|
|
420
|
-
*
|
|
421
|
-
* Omitting this keyword has the same behavior as an empty object.
|
|
422
|
-
*/
|
|
423
|
-
dependentSchemas?: Record<string, JSONSchema$1>;
|
|
424
|
-
/**
|
|
425
|
-
* The value of this keyword MUST be a boolean. When multiple occurrences
|
|
426
|
-
* of this keyword are applicable to a single sub-instance, applications
|
|
427
|
-
* SHOULD consider the instance location to be deprecated if any occurrence
|
|
428
|
-
* specifies a `true` value.
|
|
429
|
-
*
|
|
430
|
-
* If `deprecated` has a value of boolean `true`, it indicates that
|
|
431
|
-
* applications SHOULD refrain from usage of the declared property. It MAY
|
|
432
|
-
* mean the property is going to be removed in the future.
|
|
433
|
-
*
|
|
434
|
-
* A root schema containing `deprecated` with a value of `true`
|
|
435
|
-
* indicates that the entire resource being described MAY be removed in the
|
|
436
|
-
* future.
|
|
437
|
-
*
|
|
438
|
-
* The `deprecated` keyword applies to each instance location to which
|
|
439
|
-
* the schema object containing the keyword successfully applies. This can
|
|
440
|
-
* result in scenarios where every array item or object property is
|
|
441
|
-
* deprecated even though the containing array or object is not.
|
|
442
|
-
*
|
|
443
|
-
* Omitting this keyword has the same behavior as a value of `false`.
|
|
444
|
-
*/
|
|
445
|
-
deprecated?: boolean;
|
|
446
|
-
/**
|
|
447
|
-
* Can be used to decorate a user interface with explanation or information
|
|
448
|
-
* about the data produced.
|
|
449
|
-
*/
|
|
450
|
-
description?: string;
|
|
451
|
-
/**
|
|
452
|
-
* This keyword's value MUST be a valid JSON Schema.
|
|
453
|
-
*
|
|
454
|
-
* When `if` is present, and the instance fails to validate against its
|
|
455
|
-
* subschema, then validation succeeds against this keyword if the instance
|
|
456
|
-
* successfully validates against this keyword's subschema.
|
|
457
|
-
*
|
|
458
|
-
* This keyword has no effect when `if` is absent, or when the instance
|
|
459
|
-
* successfully validates against its subschema. Implementations MUST NOT
|
|
460
|
-
* evaluate the instance against this keyword, for either validation or
|
|
461
|
-
* annotation collection purposes, in such cases.
|
|
462
|
-
*/
|
|
463
|
-
else?: JSONSchema$1<Value, SchemaType>;
|
|
464
|
-
/**
|
|
465
|
-
* The value of this keyword MUST be an array. This array SHOULD have at
|
|
466
|
-
* least one element. Elements in the array SHOULD be unique.
|
|
467
|
-
*
|
|
468
|
-
* An instance validates successfully against this keyword if its value is
|
|
469
|
-
* equal to one of the elements in this keyword's array value.
|
|
470
|
-
*
|
|
471
|
-
* Elements in the array might be of any type, including `null`.
|
|
472
|
-
*/
|
|
473
|
-
enum?: MaybeReadonlyArray<Value>;
|
|
474
|
-
/**
|
|
475
|
-
* The value of this keyword MUST be an array. When multiple occurrences of
|
|
476
|
-
* this keyword are applicable to a single sub-instance, implementations
|
|
477
|
-
* MUST provide a flat array of all values rather than an array of arrays.
|
|
478
|
-
*
|
|
479
|
-
* This keyword can be used to provide sample JSON values associated with a
|
|
480
|
-
* particular schema, for the purpose of illustrating usage. It is
|
|
481
|
-
* RECOMMENDED that these values be valid against the associated schema.
|
|
482
|
-
*
|
|
483
|
-
* Implementations MAY use the value(s) of `default`, if present, as an
|
|
484
|
-
* additional example. If `examples` is absent, `default` MAY still be
|
|
485
|
-
* used in this manner.
|
|
486
|
-
*/
|
|
487
|
-
examples?: MaybeReadonlyArray<Value>;
|
|
488
|
-
/**
|
|
489
|
-
* The value of `exclusiveMaximum` MUST be a number, representing an
|
|
490
|
-
* exclusive upper limit for a numeric instance.
|
|
491
|
-
*
|
|
492
|
-
* If the instance is a number, then the instance is valid only if it has a
|
|
493
|
-
* value strictly less than (not equal to) `exclusiveMaximum`.
|
|
494
|
-
*/
|
|
495
|
-
exclusiveMaximum?: number;
|
|
496
|
-
/**
|
|
497
|
-
* The value of `exclusiveMinimum` MUST be a number, representing an
|
|
498
|
-
* exclusive lower limit for a numeric instance.
|
|
499
|
-
*
|
|
500
|
-
* If the instance is a number, then the instance is valid only if it has a
|
|
501
|
-
* value strictly greater than (not equal to) `exclusiveMinimum`.
|
|
502
|
-
*/
|
|
503
|
-
exclusiveMinimum?: number;
|
|
504
|
-
/**
|
|
505
|
-
* Implementations MAY treat `format` as an assertion in addition to an
|
|
506
|
-
* annotation, and attempt to validate the value's conformance to the
|
|
507
|
-
* specified semantics.
|
|
508
|
-
*
|
|
509
|
-
* The value of this keyword is called a format attribute. It MUST be a
|
|
510
|
-
* string. A format attribute can generally only validate a given set
|
|
511
|
-
* of instance types. If the type of the instance to validate is not in
|
|
512
|
-
* this set, validation for this format attribute and instance SHOULD
|
|
513
|
-
* succeed. Format attributes are most often applied to strings, but can
|
|
514
|
-
* be specified to apply to any type.
|
|
515
|
-
*
|
|
516
|
-
* Implementations MAY support custom format attributes. Save for agreement
|
|
517
|
-
* between parties, schema authors SHALL NOT expect a peer implementation
|
|
518
|
-
* to support such custom format attributes. An implementation MUST NOT
|
|
519
|
-
* fail validation or cease processing due to an unknown format attribute.
|
|
520
|
-
* When treating `format` as an annotation, implementations SHOULD
|
|
521
|
-
* collect both known and unknown format attribute values.
|
|
522
|
-
*/
|
|
523
|
-
format?: string;
|
|
524
|
-
/**
|
|
525
|
-
* This keyword's value MUST be a valid JSON Schema.
|
|
526
|
-
*
|
|
527
|
-
* This validation outcome of this keyword's subschema has no direct effect
|
|
528
|
-
* on the overall validation result. Rather, it controls which of the
|
|
529
|
-
* `then` or `else` keywords are evaluated.
|
|
530
|
-
*
|
|
531
|
-
* Instances that successfully validate against this keyword's subschema
|
|
532
|
-
* MUST also be valid against the subschema value of the `then` keyword,
|
|
533
|
-
* if present.
|
|
534
|
-
*
|
|
535
|
-
* Instances that fail to validate against this keyword's subschema MUST
|
|
536
|
-
* also be valid against the subschema value of the `else` keyword, if
|
|
537
|
-
* present.
|
|
538
|
-
*
|
|
539
|
-
* If annotations are being collected, they are collected
|
|
540
|
-
* from this keyword's subschema in the usual way, including when the
|
|
541
|
-
* keyword is present without either `then` or `else`.
|
|
542
|
-
*/
|
|
543
|
-
if?: JSONSchema$1<Value, SchemaType>;
|
|
544
|
-
/**
|
|
545
|
-
* The value of `items` MUST be a valid JSON Schema.
|
|
546
|
-
*
|
|
547
|
-
* This keyword applies its subschema to all instance elements at indexes
|
|
548
|
-
* greater than the length of the `prefixItems` array in the same schema
|
|
549
|
-
* object, as reported by the annotation result of that `prefixItems`
|
|
550
|
-
* keyword. If no such annotation result exists, `items` applies its
|
|
551
|
-
* subschema to all instance array elements.
|
|
552
|
-
*
|
|
553
|
-
* Note that the behavior of `items` without `prefixItems` is identical
|
|
554
|
-
* to that of the schema form of `items` in prior drafts.
|
|
555
|
-
*
|
|
556
|
-
* When `prefixItems` is present, the behavior of `items` is identical
|
|
557
|
-
* to the former `additionalItems` keyword.
|
|
558
|
-
*
|
|
559
|
-
* If the `items` subschema is applied to any positions within the
|
|
560
|
-
* instance array, it produces an annotation result of boolean `true`,
|
|
561
|
-
* indicating that all remaining array elements have been evaluated against
|
|
562
|
-
* this keyword's subschema.
|
|
563
|
-
*
|
|
564
|
-
* Omitting this keyword has the same assertion behavior as an empty
|
|
565
|
-
* schema.
|
|
566
|
-
*
|
|
567
|
-
* Implementations MAY choose to implement or optimize this keyword
|
|
568
|
-
* in another way that produces the same effect, such as by directly
|
|
569
|
-
* checking for the presence and size of a `prefixItems` array.
|
|
570
|
-
*/
|
|
571
|
-
items?: JSONSchema$1;
|
|
572
|
-
/**
|
|
573
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
574
|
-
*
|
|
575
|
-
* If `contains` is not present within the same schema object, then this
|
|
576
|
-
* keyword has no effect.
|
|
577
|
-
*
|
|
578
|
-
* An instance array is valid against `maxContains` in two ways,
|
|
579
|
-
* depending on the form of the annotation result of an adjacent
|
|
580
|
-
* `contains` keyword. The first way is if the annotation result is an
|
|
581
|
-
* array and the length of that array is less than or equal to the
|
|
582
|
-
* `maxContains` value. The second way is if the annotation result is a
|
|
583
|
-
* boolean `true` and the instance array length is less than or equal to
|
|
584
|
-
* the `maxContains` value.
|
|
585
|
-
*/
|
|
586
|
-
maxContains?: number;
|
|
587
|
-
/**
|
|
588
|
-
* The value of `maximum` MUST be a number, representing an inclusive
|
|
589
|
-
* upper limit for a numeric instance.
|
|
590
|
-
*
|
|
591
|
-
* If the instance is a number, then this keyword validates only if the
|
|
592
|
-
* instance is less than or exactly equal to `maximum`.
|
|
593
|
-
*/
|
|
594
|
-
maximum?: number;
|
|
595
|
-
/**
|
|
596
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
597
|
-
*
|
|
598
|
-
* An array instance is valid against `maxItems` if its size is less
|
|
599
|
-
* than, or equal to, the value of this keyword.
|
|
600
|
-
*
|
|
601
|
-
* @minimum 0
|
|
602
|
-
*/
|
|
603
|
-
maxItems?: number;
|
|
604
|
-
/**
|
|
605
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
606
|
-
*
|
|
607
|
-
* A string instance is valid against this keyword if its length is less
|
|
608
|
-
* than, or equal to, the value of this keyword.
|
|
609
|
-
*
|
|
610
|
-
* The length of a string instance is defined as the number of its
|
|
611
|
-
* characters as defined by [RFC 8259][RFC8259].
|
|
612
|
-
*
|
|
613
|
-
* [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259
|
|
614
|
-
*
|
|
615
|
-
* @minimum 0
|
|
616
|
-
*/
|
|
617
|
-
maxLength?: number;
|
|
618
|
-
/**
|
|
619
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
620
|
-
*
|
|
621
|
-
* An object instance is valid against `maxProperties` if its number of
|
|
622
|
-
* `properties` is less than, or equal to, the value of this keyword.
|
|
623
|
-
*
|
|
624
|
-
* @minimum 0
|
|
625
|
-
*/
|
|
626
|
-
maxProperties?: number;
|
|
627
|
-
/**
|
|
628
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
629
|
-
*
|
|
630
|
-
* If `contains` is not present within the same schema object, then this
|
|
631
|
-
* keyword has no effect.
|
|
632
|
-
*
|
|
633
|
-
* An instance array is valid against `minContains` in two ways,
|
|
634
|
-
* depending on the form of the annotation result of an adjacent
|
|
635
|
-
* `contains` keyword. The first way is if the annotation result is an
|
|
636
|
-
* array and the length of that array is greater than or equal to the
|
|
637
|
-
* `minContains` value. The second way is if the annotation result is a
|
|
638
|
-
* boolean `true` and the instance array length is greater than or equal
|
|
639
|
-
* to the `minContains` value.
|
|
640
|
-
*
|
|
641
|
-
* A value of `0` is allowed, but is only useful for setting a range
|
|
642
|
-
* of occurrences from `0` to the value of `maxContains`. A value of
|
|
643
|
-
* `0` with no `maxContains` causes `contains` to always pass
|
|
644
|
-
* validation.
|
|
645
|
-
*
|
|
646
|
-
* Omitting this keyword has the same behavior as a value of `1`.
|
|
647
|
-
*
|
|
648
|
-
* @default 1
|
|
649
|
-
*/
|
|
650
|
-
minContains?: number;
|
|
651
|
-
/**
|
|
652
|
-
* The value of `minimum` MUST be a number, representing an inclusive
|
|
653
|
-
* lower limit for a numeric instance.
|
|
654
|
-
*
|
|
655
|
-
* If the instance is a number, then this keyword validates only if the
|
|
656
|
-
* instance is greater than or exactly equal to `minimum`.
|
|
657
|
-
*/
|
|
658
|
-
minimum?: number;
|
|
659
|
-
/**
|
|
660
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
661
|
-
*
|
|
662
|
-
* An array instance is valid against `minItems` if its size is greater
|
|
663
|
-
* than, or equal to, the value of this keyword.
|
|
664
|
-
*
|
|
665
|
-
* Omitting this keyword has the same behavior as a value of `0`.
|
|
666
|
-
*
|
|
667
|
-
* @default 0
|
|
668
|
-
* @minimum 0
|
|
669
|
-
*/
|
|
670
|
-
minItems?: number;
|
|
671
|
-
/**
|
|
672
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
673
|
-
*
|
|
674
|
-
* A string instance is valid against this keyword if its length is greater
|
|
675
|
-
* than, or equal to, the value of this keyword.
|
|
676
|
-
*
|
|
677
|
-
* The length of a string instance is defined as the number of its
|
|
678
|
-
* characters as defined by [RFC 8259][RFC8259].
|
|
679
|
-
*
|
|
680
|
-
* Omitting this keyword has the same behavior as a value of `0`.
|
|
681
|
-
*
|
|
682
|
-
* [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259
|
|
683
|
-
*
|
|
684
|
-
* @default 0
|
|
685
|
-
* @minimum 0
|
|
686
|
-
*/
|
|
687
|
-
minLength?: number;
|
|
688
|
-
/**
|
|
689
|
-
* The value of this keyword MUST be a non-negative integer.
|
|
690
|
-
*
|
|
691
|
-
* An object instance is valid against `minProperties` if its number of
|
|
692
|
-
* `properties` is greater than, or equal to, the value of this keyword.
|
|
693
|
-
*
|
|
694
|
-
* Omitting this keyword has the same behavior as a value of `0`.
|
|
695
|
-
*
|
|
696
|
-
* @default 0
|
|
697
|
-
* @minimum 0
|
|
698
|
-
*/
|
|
699
|
-
minProperties?: number;
|
|
700
|
-
/**
|
|
701
|
-
* The value of `multipleOf` MUST be a number, strictly greater than
|
|
702
|
-
* `0`.
|
|
703
|
-
*
|
|
704
|
-
* A numeric instance is valid only if division by this keyword's value
|
|
705
|
-
* results in an integer.
|
|
706
|
-
*
|
|
707
|
-
* @exclusiveMinimum 0
|
|
708
|
-
*/
|
|
709
|
-
multipleOf?: number;
|
|
710
|
-
/**
|
|
711
|
-
* This keyword's value MUST be a valid JSON Schema.
|
|
712
|
-
*
|
|
713
|
-
* An instance is valid against this keyword if it fails to validate
|
|
714
|
-
* successfully against the schema defined by this keyword.
|
|
715
|
-
*/
|
|
716
|
-
not?: JSONSchema$1<Value, SchemaType>;
|
|
717
|
-
/**
|
|
718
|
-
* This keyword's value MUST be a non-empty array. Each item of the array
|
|
719
|
-
* MUST be a valid JSON Schema.
|
|
720
|
-
*
|
|
721
|
-
* An instance validates successfully against this keyword if it validates
|
|
722
|
-
* successfully against exactly one schema defined by this keyword's value.
|
|
723
|
-
*/
|
|
724
|
-
oneOf?: MaybeReadonlyArray<JSONSchema$1<Value, SchemaType>>;
|
|
725
|
-
/**
|
|
726
|
-
* The value of this keyword MUST be a string. This string SHOULD be a
|
|
727
|
-
* valid regular expression, according to the [ECMA-262][ecma262] regular
|
|
728
|
-
* expression dialect.
|
|
729
|
-
*
|
|
730
|
-
* A string instance is considered valid if the regular expression matches
|
|
731
|
-
* the instance successfully. Recall: regular expressions are not
|
|
732
|
-
* implicitly anchored.
|
|
733
|
-
*
|
|
734
|
-
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
|
|
735
|
-
*
|
|
736
|
-
* @format "regex"
|
|
737
|
-
*/
|
|
738
|
-
pattern?: string;
|
|
739
|
-
/**
|
|
740
|
-
* The value of `patternProperties` MUST be an object. Each property name
|
|
741
|
-
* of this object SHOULD be a valid regular expression, according to the
|
|
742
|
-
* [ECMA-262][ecma262] regular expression dialect. Each property value of
|
|
743
|
-
* this object MUST be a valid JSON Schema.
|
|
744
|
-
*
|
|
745
|
-
* Validation succeeds if, for each instance name that matches any regular
|
|
746
|
-
* expressions that appear as a property name in this keyword's value,
|
|
747
|
-
* the child instance for that name successfully validates against each
|
|
748
|
-
* schema that corresponds to a matching regular expression.
|
|
749
|
-
*
|
|
750
|
-
* The annotation result of this keyword is the set of instance property
|
|
751
|
-
* names matched by this keyword. Omitting this keyword has the same
|
|
752
|
-
* assertion behavior as an empty object.
|
|
753
|
-
*
|
|
754
|
-
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
|
|
755
|
-
*/
|
|
756
|
-
patternProperties?: Record<string, JSONSchema$1>;
|
|
757
|
-
/**
|
|
758
|
-
* The value of `prefixItems` MUST be a non-empty array of valid JSON
|
|
759
|
-
* Schemas.
|
|
760
|
-
*
|
|
761
|
-
* Validation succeeds if each element of the instance validates against
|
|
762
|
-
* the schema at the same position, if any. This keyword does not
|
|
763
|
-
* constrain the length of the array. If the array is longer than this
|
|
764
|
-
* keyword's value, this keyword validates only the prefix of matching
|
|
765
|
-
* length.
|
|
766
|
-
*
|
|
767
|
-
* This keyword produces an annotation value which is the largest index to
|
|
768
|
-
* which this keyword applied a subschema. The value MAY be a boolean
|
|
769
|
-
* `true` if a subschema was applied to every index of the instance, such
|
|
770
|
-
* as is produced by the `items` keyword.
|
|
771
|
-
* This annotation affects the behavior of `items` and
|
|
772
|
-
* `unevaluatedItems`.
|
|
773
|
-
*
|
|
774
|
-
* Omitting this keyword has the same assertion behavior as an empty array.
|
|
775
|
-
*/
|
|
776
|
-
prefixItems?: MaybeReadonlyArray<JSONSchema$1> | JSONSchema$1;
|
|
777
|
-
/**
|
|
778
|
-
* The value of `properties` MUST be an object. Each value of this object
|
|
779
|
-
* MUST be a valid JSON Schema.
|
|
780
|
-
*
|
|
781
|
-
* Validation succeeds if, for each name that appears in both the instance
|
|
782
|
-
* and as a name within this keyword's value, the child instance for that
|
|
783
|
-
* name successfully validates against the corresponding schema.
|
|
784
|
-
*
|
|
785
|
-
* The annotation result of this keyword is the set of instance property
|
|
786
|
-
* names matched by this keyword.
|
|
787
|
-
*
|
|
788
|
-
* Omitting this keyword has the same assertion behavior as an empty
|
|
789
|
-
* object.
|
|
790
|
-
*/
|
|
791
|
-
properties?: Record<string, JSONSchema$1>;
|
|
792
|
-
/**
|
|
793
|
-
* The value of `propertyNames` MUST be a valid JSON Schema.
|
|
794
|
-
*
|
|
795
|
-
* If the instance is an object, this keyword validates if every property
|
|
796
|
-
* name in the instance validates against the provided schema.
|
|
797
|
-
* Note the property name that the schema is testing will always be a
|
|
798
|
-
* string.
|
|
799
|
-
*
|
|
800
|
-
* Omitting this keyword has the same behavior as an empty schema.
|
|
801
|
-
*/
|
|
802
|
-
propertyNames?: JSONSchema$1;
|
|
803
|
-
/**
|
|
804
|
-
* The value of this keyword MUST be a boolean. When multiple occurrences
|
|
805
|
-
* of this keyword are applicable to a single sub-instance, the resulting
|
|
806
|
-
* value MUST be `true` if any occurrence specifies a `true` value, and
|
|
807
|
-
* MUST be `false` otherwise.
|
|
808
|
-
*
|
|
809
|
-
* If `readOnly` has a value of boolean `true`, it indicates that the
|
|
810
|
-
* value of the instance is managed exclusively by the owning authority,
|
|
811
|
-
* and attempts by an application to modify the value of this property are
|
|
812
|
-
* expected to be ignored or rejected by that owning authority.
|
|
813
|
-
*
|
|
814
|
-
* An instance document that is marked as `readOnly` for the entire
|
|
815
|
-
* document MAY be ignored if sent to the owning authority, or MAY result
|
|
816
|
-
* in an error, at the authority's discretion.
|
|
817
|
-
*
|
|
818
|
-
* For example, `readOnly` would be used to mark a database-generated
|
|
819
|
-
* serial number as read-only.
|
|
820
|
-
*
|
|
821
|
-
* This keyword can be used to assist in user interface instance
|
|
822
|
-
* generation.
|
|
823
|
-
*
|
|
824
|
-
* @default false
|
|
825
|
-
*/
|
|
826
|
-
readOnly?: boolean;
|
|
827
|
-
/**
|
|
828
|
-
* The value of this keyword MUST be an array. Elements of this array, if
|
|
829
|
-
* any, MUST be strings, and MUST be unique.
|
|
830
|
-
*
|
|
831
|
-
* An object instance is valid against this keyword if every item in the
|
|
832
|
-
* array is the name of a property in the instance.
|
|
833
|
-
*
|
|
834
|
-
* Omitting this keyword has the same behavior as an empty array.
|
|
835
|
-
*/
|
|
836
|
-
required?: MaybeReadonlyArray<string>;
|
|
837
|
-
/**
|
|
838
|
-
* This keyword's value MUST be a valid JSON Schema.
|
|
839
|
-
*
|
|
840
|
-
* When `if` is present, and the instance successfully validates against
|
|
841
|
-
* its subschema, then validation succeeds against this keyword if the
|
|
842
|
-
* instance also successfully validates against this keyword's subschema.
|
|
843
|
-
*
|
|
844
|
-
* This keyword has no effect when `if` is absent, or when the instance
|
|
845
|
-
* fails to validate against its subschema. Implementations MUST NOT
|
|
846
|
-
* evaluate the instance against this keyword, for either validation or
|
|
847
|
-
* annotation collection purposes, in such cases.
|
|
848
|
-
*/
|
|
849
|
-
then?: JSONSchema$1<Value, SchemaType>;
|
|
850
|
-
/**
|
|
851
|
-
* Can be used to decorate a user interface with a short label about the
|
|
852
|
-
* data produced.
|
|
853
|
-
*/
|
|
854
|
-
title?: string;
|
|
855
|
-
/**
|
|
856
|
-
* The value of this keyword MUST be either a string or an array. If it is
|
|
857
|
-
* an array, elements of the array MUST be strings and MUST be unique.
|
|
858
|
-
*
|
|
859
|
-
* String values MUST be one of the six primitive types (`"null"`,
|
|
860
|
-
* `"boolean"`, `"object"`, `"array"`, `"number"`, or
|
|
861
|
-
* `"string"`), or `"integer"` which matches any number with a zero
|
|
862
|
-
* fractional part.
|
|
863
|
-
*
|
|
864
|
-
* An instance validates if and only if the instance is in any of the sets
|
|
865
|
-
* listed for this keyword.
|
|
866
|
-
*/
|
|
867
|
-
type?: SchemaType;
|
|
868
|
-
/**
|
|
869
|
-
* The value of `unevaluatedItems` MUST be a valid JSON Schema.
|
|
870
|
-
*
|
|
871
|
-
* The behavior of this keyword depends on the annotation results of
|
|
872
|
-
* adjacent keywords that apply to the instance location being validated.
|
|
873
|
-
* Specifically, the annotations from `prefixItems`, `items`, and
|
|
874
|
-
* `contains`, which can come from those keywords when they are adjacent
|
|
875
|
-
* to the `unevaluatedItems` keyword. Those three annotations, as well as
|
|
876
|
-
* `unevaluatedItems`, can also result from any and all adjacent
|
|
877
|
-
* [in-place applicator][in-place-applicator] keywords.
|
|
878
|
-
*
|
|
879
|
-
* If no relevant annotations are present, the `unevaluatedItems`
|
|
880
|
-
* subschema MUST be applied to all locations in the array.
|
|
881
|
-
* If a boolean `true` value is present from any of the relevant
|
|
882
|
-
* annotations, `unevaluatedItems` MUST be ignored. Otherwise, the
|
|
883
|
-
* subschema MUST be applied to any index greater than the largest
|
|
884
|
-
* annotation value for `prefixItems`, which does not appear in any
|
|
885
|
-
* annotation value for `contains`.
|
|
886
|
-
*
|
|
887
|
-
* This means that `prefixItems`, `items`, `contains`, and all
|
|
888
|
-
* in-place applicators MUST be evaluated before this keyword can be
|
|
889
|
-
* evaluated. Authors of extension keywords MUST NOT define an in-place
|
|
890
|
-
* applicator that would need to be evaluated after this keyword.
|
|
891
|
-
*
|
|
892
|
-
* If the `unevaluatedItems` subschema is applied to any positions within
|
|
893
|
-
* the instance array, it produces an annotation result of boolean
|
|
894
|
-
* `true`, analogous to the behavior of `items`.
|
|
895
|
-
*
|
|
896
|
-
* Omitting this keyword has the same assertion behavior as an empty
|
|
897
|
-
* schema.
|
|
898
|
-
*
|
|
899
|
-
* [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place
|
|
900
|
-
*/
|
|
901
|
-
unevaluatedItems?: JSONSchema$1;
|
|
902
|
-
/**
|
|
903
|
-
* The value of `unevaluatedProperties` MUST be a valid JSON Schema.
|
|
904
|
-
*
|
|
905
|
-
* The behavior of this keyword depends on the annotation results of
|
|
906
|
-
* adjacent keywords that apply to the instance location being validated.
|
|
907
|
-
* Specifically, the annotations from `properties`,
|
|
908
|
-
* `patternProperties`, and `additionalProperties`, which can come from
|
|
909
|
-
* those keywords when they are adjacent to the `unevaluatedProperties`
|
|
910
|
-
* keyword. Those three annotations, as well as `unevaluatedProperties`,
|
|
911
|
-
* can also result from any and all adjacent
|
|
912
|
-
* [in-place applicator][in-place-applicator] keywords.
|
|
913
|
-
*
|
|
914
|
-
* Validation with `unevaluatedProperties` applies only to the child
|
|
915
|
-
* values of instance names that do not appear in the `properties`,
|
|
916
|
-
* `patternProperties`, `additionalProperties`, or
|
|
917
|
-
* `unevaluatedProperties` annotation results that apply to the
|
|
918
|
-
* instance location being validated.
|
|
919
|
-
*
|
|
920
|
-
* For all such properties, validation succeeds if the child instance
|
|
921
|
-
* validates against the "unevaluatedProperties" schema.
|
|
922
|
-
*
|
|
923
|
-
* This means that `properties`, `patternProperties`,
|
|
924
|
-
* `additionalProperties`, and all in-place applicators MUST be evaluated
|
|
925
|
-
* before this keyword can be evaluated. Authors of extension keywords
|
|
926
|
-
* MUST NOT define an in-place applicator that would need to be evaluated
|
|
927
|
-
* after this keyword.
|
|
928
|
-
*
|
|
929
|
-
* The annotation result of this keyword is the set of instance property
|
|
930
|
-
* names validated by this keyword's subschema.
|
|
931
|
-
*
|
|
932
|
-
* Omitting this keyword has the same assertion behavior as an empty
|
|
933
|
-
* schema.
|
|
934
|
-
*
|
|
935
|
-
* [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place
|
|
936
|
-
*/
|
|
937
|
-
unevaluatedProperties?: JSONSchema$1;
|
|
938
|
-
/**
|
|
939
|
-
* The value of this keyword MUST be a boolean.
|
|
940
|
-
*
|
|
941
|
-
* If this keyword has boolean value `false`, the instance validates
|
|
942
|
-
* successfully. If it has boolean value `true`, the instance validates
|
|
943
|
-
* successfully if all of its elements are unique.
|
|
944
|
-
*
|
|
945
|
-
* Omitting this keyword has the same behavior as a value of `false`.
|
|
946
|
-
*
|
|
947
|
-
* @default false
|
|
948
|
-
*/
|
|
949
|
-
uniqueItems?: boolean;
|
|
950
|
-
/**
|
|
951
|
-
* The value of this keyword MUST be a boolean. When multiple occurrences
|
|
952
|
-
* of this keyword is applicable to a single sub-instance, the resulting
|
|
953
|
-
* value MUST be `true` if any occurrence specifies a `true` value, and
|
|
954
|
-
* MUST be `false` otherwise.
|
|
955
|
-
*
|
|
956
|
-
* If `writeOnly` has a value of boolean `true`, it indicates that the
|
|
957
|
-
* value is never present when the instance is retrieved from the owning
|
|
958
|
-
* authority. It can be present when sent to the owning authority to update
|
|
959
|
-
* or create the document (or the resource it represents), but it will not
|
|
960
|
-
* be included in any updated or newly created version of the instance.
|
|
961
|
-
*
|
|
962
|
-
* An instance document that is marked as `writeOnly` for the entire
|
|
963
|
-
* document MAY be returned as a blank document of some sort, or MAY
|
|
964
|
-
* produce an error upon retrieval, or have the retrieval request ignored,
|
|
965
|
-
* at the authority's discretion.
|
|
966
|
-
*
|
|
967
|
-
* For example, `writeOnly` would be used to mark a password input field.
|
|
968
|
-
*
|
|
969
|
-
* These keywords can be used to assist in user interface instance
|
|
970
|
-
* generation. In particular, an application MAY choose to use a widget
|
|
971
|
-
* that hides input values as they are typed for write-only fields.
|
|
972
|
-
*
|
|
973
|
-
* @default false
|
|
974
|
-
*/
|
|
975
|
-
writeOnly?: boolean;
|
|
976
|
-
};
|
|
977
|
-
declare namespace JSONSchema$1 {
|
|
978
|
-
type TypeValue = ValueOf<TypeName> | TypeName | Array<ValueOf<TypeName> | TypeName> | ReadonlyArray<ValueOf<TypeName> | TypeName>;
|
|
979
|
-
/**
|
|
980
|
-
* JSON Schema interface
|
|
981
|
-
*/
|
|
982
|
-
type Interface<Value = any, SchemaType extends TypeValue = TypeValue> = Exclude<JSONSchema$1<Value, SchemaType>, boolean>;
|
|
983
|
-
type Array<T = any> = Pick<Interface<T, "array">, KeywordByType.Any | KeywordByType.Array>;
|
|
984
|
-
type Boolean = Pick<Interface<boolean, "boolean">, KeywordByType.Any>;
|
|
985
|
-
type Integer = Pick<Interface<number, "integer">, KeywordByType.Any | KeywordByType.Number>;
|
|
986
|
-
type Number = Pick<Interface<number, "number">, KeywordByType.Any | KeywordByType.Number>;
|
|
987
|
-
type Null = Pick<Interface<null, "null">, KeywordByType.Any>;
|
|
988
|
-
type Object<T = any> = Pick<Interface<T, "object">, KeywordByType.Any | KeywordByType.Object>;
|
|
989
|
-
type String = Pick<Interface<string, "string">, KeywordByType.Any | KeywordByType.String>;
|
|
990
|
-
}
|
|
991
|
-
declare namespace KeywordByType {
|
|
992
|
-
type Any = "$anchor" | "$comment" | "$defs" | "$dynamicAnchor" | "$dynamicRef" | "$id" | "$ref" | "$schema" | "$vocabulary" | "allOf" | "anyOf" | "const" | "default" | "definitions" | "deprecated" | "description" | "else" | "enum" | "examples" | "format" | "if" | "not" | "oneOf" | "readOnly" | "then" | "title" | "type" | "writeOnly";
|
|
993
|
-
type Array = "additionalItems" | "contains" | "items" | "maxContains" | "maxItems" | "minContains" | "minItems" | "prefixItems" | "unevaluatedItems" | "uniqueItems";
|
|
994
|
-
type Number = "exclusiveMaximum" | "exclusiveMinimum" | "maximum" | "minimum" | "multipleOf";
|
|
995
|
-
type Object = "additionalProperties" | "dependencies" | "dependentRequired" | "dependentSchemas" | "maxProperties" | "minProperties" | "patternProperties" | "properties" | "propertyNames" | "required" | "unevaluatedProperties";
|
|
996
|
-
type String = "contentEncoding" | "contentMediaType" | "contentSchema" | "maxLength" | "minLength" | "pattern";
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Content encoding strategy enum.
|
|
1000
|
-
*
|
|
1001
|
-
* - [Content-Transfer-Encoding Syntax](https://datatracker.ietf.org/doc/html/rfc2045#section-6.1)
|
|
1002
|
-
* - [7bit vs 8bit encoding](https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705)
|
|
1003
|
-
*/
|
|
1004
|
-
/**
|
|
1005
|
-
* Enum consisting of simple type names for the `type` keyword
|
|
1006
|
-
*/
|
|
1007
|
-
declare enum TypeName {
|
|
1008
|
-
/**
|
|
1009
|
-
* Value MUST be an array.
|
|
1010
|
-
*/
|
|
1011
|
-
Array = "array",
|
|
1012
|
-
/**
|
|
1013
|
-
* Value MUST be a boolean.
|
|
1014
|
-
*/
|
|
1015
|
-
Boolean = "boolean",
|
|
1016
|
-
/**
|
|
1017
|
-
* Value MUST be an integer, no floating point numbers are allowed. This is a
|
|
1018
|
-
* subset of the number type.
|
|
1019
|
-
*/
|
|
1020
|
-
Integer = "integer",
|
|
1021
|
-
/**
|
|
1022
|
-
* Value MUST be null. Note this is mainly for purpose of being able use union
|
|
1023
|
-
* types to define nullability. If this type is not included in a union, null
|
|
1024
|
-
* values are not allowed (the primitives listed above do not allow nulls on
|
|
1025
|
-
* their own).
|
|
1026
|
-
*/
|
|
1027
|
-
Null = "null",
|
|
1028
|
-
/**
|
|
1029
|
-
* Value MUST be a number, floating point numbers are allowed.
|
|
1030
|
-
*/
|
|
1031
|
-
Number = "number",
|
|
1032
|
-
/**
|
|
1033
|
-
* Value MUST be an object.
|
|
1034
|
-
*/
|
|
1035
|
-
Object = "object",
|
|
1036
|
-
/**
|
|
1037
|
-
* Value MUST be a string.
|
|
1038
|
-
*/
|
|
1039
|
-
String = "string"
|
|
1040
|
-
}
|
|
1041
|
-
//#endregion
|
|
1042
|
-
//#region ../core-internal/src/validators/types.d.ts
|
|
1043
|
-
/**
|
|
1044
|
-
* JSON Schema type definition (JSON Schema Draft 2020-12)
|
|
1045
|
-
*
|
|
1046
|
-
* This uses the object form of JSON Schema (excluding boolean schemas).
|
|
1047
|
-
* While `true` and `false` are valid JSON Schemas, this SDK uses the
|
|
1048
|
-
* object form for practical type safety.
|
|
1049
|
-
*
|
|
1050
|
-
* Re-exported from json-schema-typed for convenience.
|
|
1051
|
-
* @see https://json-schema.org/draft/2020-12/json-schema-core.html
|
|
1052
|
-
*/
|
|
1053
|
-
type JsonSchemaType = JSONSchema$1.Interface;
|
|
1054
|
-
/**
|
|
1055
|
-
* Result of a JSON Schema validation operation
|
|
1056
|
-
*/
|
|
1057
|
-
type JsonSchemaValidatorResult<T> = {
|
|
1058
|
-
valid: true;
|
|
1059
|
-
data: T;
|
|
1060
|
-
errorMessage: undefined;
|
|
1061
|
-
} | {
|
|
1062
|
-
valid: false;
|
|
1063
|
-
data: undefined;
|
|
1064
|
-
errorMessage: string;
|
|
1065
|
-
};
|
|
1066
|
-
/**
|
|
1067
|
-
* A validator function that validates data against a JSON Schema
|
|
1068
|
-
*/
|
|
1069
|
-
type JsonSchemaValidator<T> = (input: unknown) => JsonSchemaValidatorResult<T>;
|
|
1070
|
-
/**
|
|
1071
|
-
* Provider interface for creating validators from JSON Schemas
|
|
1072
|
-
*
|
|
1073
|
-
* This is the main extension point for custom validator implementations.
|
|
1074
|
-
* Implementations should:
|
|
1075
|
-
* - Support JSON Schema Draft 2020-12 (or be compatible with it)
|
|
1076
|
-
* - Return validator functions that can be called multiple times
|
|
1077
|
-
* - Handle schema compilation/caching internally
|
|
1078
|
-
* - Provide clear error messages on validation failure
|
|
1079
|
-
*
|
|
1080
|
-
* @example
|
|
1081
|
-
* ```ts source="./types.examples.ts#jsonSchemaValidator_implementation"
|
|
1082
|
-
* class MyValidatorProvider implements jsonSchemaValidator {
|
|
1083
|
-
* getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T> {
|
|
1084
|
-
* // Compile/cache validator from schema
|
|
1085
|
-
* return (input: unknown) =>
|
|
1086
|
-
* isValid(schema, input)
|
|
1087
|
-
* ? { valid: true, data: input as T, errorMessage: undefined }
|
|
1088
|
-
* : { valid: false, data: undefined, errorMessage: 'Error details' };
|
|
1089
|
-
* }
|
|
1090
|
-
* }
|
|
1091
|
-
* ```
|
|
1092
|
-
*/
|
|
1093
|
-
interface jsonSchemaValidator {
|
|
1094
|
-
/**
|
|
1095
|
-
* Create a validator for the given JSON Schema
|
|
1096
|
-
*
|
|
1097
|
-
* @param schema - Standard JSON Schema object
|
|
1098
|
-
* @returns A validator function that can be called multiple times
|
|
1099
|
-
*/
|
|
1100
|
-
getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T>;
|
|
1101
|
-
}
|
|
1102
|
-
declare namespace json_schema_d_exports {
|
|
1103
|
-
export { ArraySchema, BaseSchema, BooleanSchema, IntegerSchema, JSONSchema, NullSchema, NumberSchema, ObjectSchema, Schema$1 as Schema, SchemaType, StringSchema, _JSONSchema };
|
|
1104
|
-
}
|
|
1105
|
-
type Schema$1 = ObjectSchema | ArraySchema | StringSchema | NumberSchema | IntegerSchema | BooleanSchema | NullSchema;
|
|
1106
|
-
type _JSONSchema = boolean | JSONSchema;
|
|
1107
|
-
type SchemaType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
1108
|
-
type JSONSchema = {
|
|
1109
|
-
[k: string]: unknown;
|
|
1110
|
-
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
1111
|
-
$id?: string;
|
|
1112
|
-
$anchor?: string;
|
|
1113
|
-
$ref?: string;
|
|
1114
|
-
$dynamicRef?: string;
|
|
1115
|
-
$dynamicAnchor?: string;
|
|
1116
|
-
$vocabulary?: Record<string, boolean>;
|
|
1117
|
-
$comment?: string;
|
|
1118
|
-
$defs?: Record<string, JSONSchema>;
|
|
1119
|
-
type?: SchemaType | SchemaType[];
|
|
1120
|
-
additionalItems?: _JSONSchema;
|
|
1121
|
-
unevaluatedItems?: _JSONSchema;
|
|
1122
|
-
prefixItems?: _JSONSchema[];
|
|
1123
|
-
items?: _JSONSchema | _JSONSchema[];
|
|
1124
|
-
contains?: _JSONSchema;
|
|
1125
|
-
additionalProperties?: _JSONSchema;
|
|
1126
|
-
unevaluatedProperties?: _JSONSchema;
|
|
1127
|
-
properties?: Record<string, _JSONSchema>;
|
|
1128
|
-
patternProperties?: Record<string, _JSONSchema>;
|
|
1129
|
-
dependentSchemas?: Record<string, _JSONSchema>;
|
|
1130
|
-
propertyNames?: _JSONSchema;
|
|
1131
|
-
if?: _JSONSchema;
|
|
1132
|
-
then?: _JSONSchema;
|
|
1133
|
-
else?: _JSONSchema;
|
|
1134
|
-
allOf?: JSONSchema[];
|
|
1135
|
-
anyOf?: JSONSchema[];
|
|
1136
|
-
oneOf?: JSONSchema[];
|
|
1137
|
-
not?: _JSONSchema;
|
|
1138
|
-
multipleOf?: number;
|
|
1139
|
-
maximum?: number;
|
|
1140
|
-
exclusiveMaximum?: number | boolean;
|
|
1141
|
-
minimum?: number;
|
|
1142
|
-
exclusiveMinimum?: number | boolean;
|
|
1143
|
-
maxLength?: number;
|
|
1144
|
-
minLength?: number;
|
|
1145
|
-
pattern?: string;
|
|
1146
|
-
maxItems?: number;
|
|
1147
|
-
minItems?: number;
|
|
1148
|
-
uniqueItems?: boolean;
|
|
1149
|
-
maxContains?: number;
|
|
1150
|
-
minContains?: number;
|
|
1151
|
-
maxProperties?: number;
|
|
1152
|
-
minProperties?: number;
|
|
1153
|
-
required?: string[];
|
|
1154
|
-
dependentRequired?: Record<string, string[]>;
|
|
1155
|
-
enum?: Array<string | number | boolean | null>;
|
|
1156
|
-
const?: string | number | boolean | null;
|
|
1157
|
-
id?: string;
|
|
1158
|
-
title?: string;
|
|
1159
|
-
description?: string;
|
|
1160
|
-
default?: unknown;
|
|
1161
|
-
deprecated?: boolean;
|
|
1162
|
-
readOnly?: boolean;
|
|
1163
|
-
writeOnly?: boolean;
|
|
1164
|
-
nullable?: boolean;
|
|
1165
|
-
examples?: unknown[];
|
|
1166
|
-
format?: string;
|
|
1167
|
-
contentMediaType?: string;
|
|
1168
|
-
contentEncoding?: string;
|
|
1169
|
-
contentSchema?: JSONSchema;
|
|
1170
|
-
_prefault?: unknown;
|
|
1171
|
-
};
|
|
1172
|
-
type BaseSchema = JSONSchema;
|
|
1173
|
-
interface ObjectSchema extends JSONSchema {
|
|
1174
|
-
type: "object";
|
|
1175
|
-
}
|
|
1176
|
-
interface ArraySchema extends JSONSchema {
|
|
1177
|
-
type: "array";
|
|
1178
|
-
}
|
|
1179
|
-
interface StringSchema extends JSONSchema {
|
|
1180
|
-
type: "string";
|
|
1181
|
-
}
|
|
1182
|
-
interface NumberSchema extends JSONSchema {
|
|
1183
|
-
type: "number";
|
|
1184
|
-
}
|
|
1185
|
-
interface IntegerSchema extends JSONSchema {
|
|
1186
|
-
type: "integer";
|
|
1187
|
-
}
|
|
1188
|
-
interface BooleanSchema extends JSONSchema {
|
|
1189
|
-
type: "boolean";
|
|
1190
|
-
}
|
|
1191
|
-
interface NullSchema extends JSONSchema {
|
|
1192
|
-
type: "null";
|
|
1193
|
-
}
|
|
1194
|
-
//#endregion
|
|
1195
|
-
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/standard-schema.d.cts
|
|
1196
|
-
/** The Standard interface. */
|
|
1197
|
-
interface StandardTypedV1$1<Input = unknown, Output = Input> {
|
|
1198
|
-
/** The Standard properties. */
|
|
1199
|
-
readonly "~standard": StandardTypedV1$1.Props<Input, Output>;
|
|
1200
|
-
}
|
|
1201
|
-
declare namespace StandardTypedV1$1 {
|
|
1202
|
-
/** The Standard properties interface. */
|
|
1203
|
-
interface Props<Input = unknown, Output = Input> {
|
|
1204
|
-
/** The version number of the standard. */
|
|
1205
|
-
readonly version: 1;
|
|
1206
|
-
/** The vendor name of the schema library. */
|
|
1207
|
-
readonly vendor: string;
|
|
1208
|
-
/** Inferred types associated with the schema. */
|
|
1209
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
1210
|
-
}
|
|
1211
|
-
/** The Standard types interface. */
|
|
1212
|
-
interface Types<Input = unknown, Output = Input> {
|
|
1213
|
-
/** The input type of the schema. */
|
|
1214
|
-
readonly input: Input;
|
|
1215
|
-
/** The output type of the schema. */
|
|
1216
|
-
readonly output: Output;
|
|
1217
|
-
}
|
|
1218
|
-
/** Infers the input type of a Standard. */
|
|
1219
|
-
type InferInput<Schema extends StandardTypedV1$1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
1220
|
-
/** Infers the output type of a Standard. */
|
|
1221
|
-
type InferOutput<Schema extends StandardTypedV1$1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
1222
|
-
}
|
|
1223
|
-
/** The Standard Schema interface. */
|
|
1224
|
-
interface StandardSchemaV1$1<Input = unknown, Output = Input> {
|
|
1225
|
-
/** The Standard Schema properties. */
|
|
1226
|
-
readonly "~standard": StandardSchemaV1$1.Props<Input, Output>;
|
|
1227
|
-
}
|
|
1228
|
-
declare namespace StandardSchemaV1$1 {
|
|
1229
|
-
/** The Standard Schema properties interface. */
|
|
1230
|
-
interface Props<Input = unknown, Output = Input> extends StandardTypedV1$1.Props<Input, Output> {
|
|
1231
|
-
/** Validates unknown input values. */
|
|
1232
|
-
readonly validate: (value: unknown, options?: StandardSchemaV1$1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
1233
|
-
}
|
|
1234
|
-
/** The result interface of the validate function. */
|
|
1235
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1236
|
-
/** The result interface if validation succeeds. */
|
|
1237
|
-
interface SuccessResult<Output> {
|
|
1238
|
-
/** The typed output value. */
|
|
1239
|
-
readonly value: Output;
|
|
1240
|
-
/** The absence of issues indicates success. */
|
|
1241
|
-
readonly issues?: undefined;
|
|
1242
|
-
}
|
|
1243
|
-
interface Options {
|
|
1244
|
-
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
1245
|
-
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
1246
|
-
}
|
|
1247
|
-
/** The result interface if validation fails. */
|
|
1248
|
-
interface FailureResult {
|
|
1249
|
-
/** The issues of failed validation. */
|
|
1250
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
1251
|
-
}
|
|
1252
|
-
/** The issue interface of the failure output. */
|
|
1253
|
-
interface Issue {
|
|
1254
|
-
/** The error message of the issue. */
|
|
1255
|
-
readonly message: string;
|
|
1256
|
-
/** The path of the issue, if any. */
|
|
1257
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1258
|
-
}
|
|
1259
|
-
/** The path segment interface of the issue. */
|
|
1260
|
-
interface PathSegment {
|
|
1261
|
-
/** The key representing a path segment. */
|
|
1262
|
-
readonly key: PropertyKey;
|
|
1263
|
-
}
|
|
1264
|
-
/** The Standard types interface. */
|
|
1265
|
-
interface Types<Input = unknown, Output = Input> extends StandardTypedV1$1.Types<Input, Output> {}
|
|
1266
|
-
/** Infers the input type of a Standard. */
|
|
1267
|
-
type InferInput<Schema extends StandardTypedV1$1> = StandardTypedV1$1.InferInput<Schema>;
|
|
1268
|
-
/** Infers the output type of a Standard. */
|
|
1269
|
-
type InferOutput<Schema extends StandardTypedV1$1> = StandardTypedV1$1.InferOutput<Schema>;
|
|
1270
|
-
}
|
|
1271
|
-
/** The Standard JSON Schema interface. */
|
|
1272
|
-
interface StandardJSONSchemaV1$1<Input = unknown, Output = Input> {
|
|
1273
|
-
/** The Standard JSON Schema properties. */
|
|
1274
|
-
readonly "~standard": StandardJSONSchemaV1$1.Props<Input, Output>;
|
|
1275
|
-
}
|
|
1276
|
-
declare namespace StandardJSONSchemaV1$1 {
|
|
1277
|
-
/** The Standard JSON Schema properties interface. */
|
|
1278
|
-
interface Props<Input = unknown, Output = Input> extends StandardTypedV1$1.Props<Input, Output> {
|
|
1279
|
-
/** Methods for generating the input/output JSON Schema. */
|
|
1280
|
-
readonly jsonSchema: Converter;
|
|
1281
|
-
}
|
|
1282
|
-
/** The Standard JSON Schema converter interface. */
|
|
1283
|
-
interface Converter {
|
|
1284
|
-
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
1285
|
-
readonly input: (options: StandardJSONSchemaV1$1.Options) => Record<string, unknown>;
|
|
1286
|
-
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
1287
|
-
readonly output: (options: StandardJSONSchemaV1$1.Options) => Record<string, unknown>;
|
|
1288
|
-
}
|
|
1289
|
-
/** The target version of the generated JSON Schema.
|
|
1290
|
-
*
|
|
1291
|
-
* It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use.
|
|
1292
|
-
*
|
|
1293
|
-
* The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
|
|
1294
|
-
*
|
|
1295
|
-
* All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
|
|
24
|
+
type?: SchemaType | SchemaType[];
|
|
25
|
+
additionalItems?: _JSONSchema;
|
|
26
|
+
unevaluatedItems?: _JSONSchema;
|
|
27
|
+
prefixItems?: _JSONSchema[];
|
|
28
|
+
items?: _JSONSchema | _JSONSchema[];
|
|
29
|
+
contains?: _JSONSchema;
|
|
30
|
+
additionalProperties?: _JSONSchema;
|
|
31
|
+
unevaluatedProperties?: _JSONSchema;
|
|
32
|
+
properties?: Record<string, _JSONSchema>;
|
|
33
|
+
patternProperties?: Record<string, _JSONSchema>;
|
|
34
|
+
dependentSchemas?: Record<string, _JSONSchema>;
|
|
35
|
+
propertyNames?: _JSONSchema;
|
|
36
|
+
if?: _JSONSchema;
|
|
37
|
+
then?: _JSONSchema;
|
|
38
|
+
else?: _JSONSchema;
|
|
39
|
+
allOf?: JSONSchema$1[];
|
|
40
|
+
anyOf?: JSONSchema$1[];
|
|
41
|
+
oneOf?: JSONSchema$1[];
|
|
42
|
+
not?: _JSONSchema;
|
|
43
|
+
multipleOf?: number;
|
|
44
|
+
maximum?: number;
|
|
45
|
+
exclusiveMaximum?: number | boolean;
|
|
46
|
+
minimum?: number;
|
|
47
|
+
exclusiveMinimum?: number | boolean;
|
|
48
|
+
maxLength?: number;
|
|
49
|
+
minLength?: number;
|
|
50
|
+
pattern?: string;
|
|
51
|
+
maxItems?: number;
|
|
52
|
+
minItems?: number;
|
|
53
|
+
uniqueItems?: boolean;
|
|
54
|
+
maxContains?: number;
|
|
55
|
+
minContains?: number;
|
|
56
|
+
maxProperties?: number;
|
|
57
|
+
minProperties?: number;
|
|
58
|
+
required?: string[];
|
|
59
|
+
dependentRequired?: Record<string, string[]>;
|
|
60
|
+
enum?: Array<string | number | boolean | null>;
|
|
61
|
+
const?: string | number | boolean | null;
|
|
62
|
+
id?: string;
|
|
63
|
+
title?: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
default?: unknown;
|
|
66
|
+
deprecated?: boolean;
|
|
67
|
+
readOnly?: boolean;
|
|
68
|
+
writeOnly?: boolean;
|
|
69
|
+
nullable?: boolean;
|
|
70
|
+
examples?: unknown[];
|
|
71
|
+
format?: string;
|
|
72
|
+
contentMediaType?: string;
|
|
73
|
+
contentEncoding?: string;
|
|
74
|
+
contentSchema?: JSONSchema$1;
|
|
75
|
+
_prefault?: unknown;
|
|
76
|
+
};
|
|
77
|
+
type BaseSchema = JSONSchema$1;
|
|
78
|
+
interface ObjectSchema extends JSONSchema$1 {
|
|
79
|
+
type: "object";
|
|
80
|
+
}
|
|
81
|
+
interface ArraySchema extends JSONSchema$1 {
|
|
82
|
+
type: "array";
|
|
83
|
+
}
|
|
84
|
+
interface StringSchema extends JSONSchema$1 {
|
|
85
|
+
type: "string";
|
|
86
|
+
}
|
|
87
|
+
interface NumberSchema extends JSONSchema$1 {
|
|
88
|
+
type: "number";
|
|
89
|
+
}
|
|
90
|
+
interface IntegerSchema extends JSONSchema$1 {
|
|
91
|
+
type: "integer";
|
|
92
|
+
}
|
|
93
|
+
interface BooleanSchema extends JSONSchema$1 {
|
|
94
|
+
type: "boolean";
|
|
95
|
+
}
|
|
96
|
+
interface NullSchema extends JSONSchema$1 {
|
|
97
|
+
type: "null";
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/standard-schema.d.cts
|
|
101
|
+
/** The Standard interface. */
|
|
102
|
+
interface StandardTypedV1$1<Input = unknown, Output = Input> {
|
|
103
|
+
/** The Standard properties. */
|
|
104
|
+
readonly "~standard": StandardTypedV1$1.Props<Input, Output>;
|
|
105
|
+
}
|
|
106
|
+
declare namespace StandardTypedV1$1 {
|
|
107
|
+
/** The Standard properties interface. */
|
|
108
|
+
interface Props<Input = unknown, Output = Input> {
|
|
109
|
+
/** The version number of the standard. */
|
|
110
|
+
readonly version: 1;
|
|
111
|
+
/** The vendor name of the schema library. */
|
|
112
|
+
readonly vendor: string;
|
|
113
|
+
/** Inferred types associated with the schema. */
|
|
114
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
115
|
+
}
|
|
116
|
+
/** The Standard types interface. */
|
|
117
|
+
interface Types<Input = unknown, Output = Input> {
|
|
118
|
+
/** The input type of the schema. */
|
|
119
|
+
readonly input: Input;
|
|
120
|
+
/** The output type of the schema. */
|
|
121
|
+
readonly output: Output;
|
|
122
|
+
}
|
|
123
|
+
/** Infers the input type of a Standard. */
|
|
124
|
+
type InferInput<Schema extends StandardTypedV1$1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
125
|
+
/** Infers the output type of a Standard. */
|
|
126
|
+
type InferOutput<Schema extends StandardTypedV1$1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
127
|
+
}
|
|
128
|
+
/** The Standard Schema interface. */
|
|
129
|
+
interface StandardSchemaV1$1<Input = unknown, Output = Input> {
|
|
130
|
+
/** The Standard Schema properties. */
|
|
131
|
+
readonly "~standard": StandardSchemaV1$1.Props<Input, Output>;
|
|
132
|
+
}
|
|
133
|
+
declare namespace StandardSchemaV1$1 {
|
|
134
|
+
/** The Standard Schema properties interface. */
|
|
135
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1$1.Props<Input, Output> {
|
|
136
|
+
/** Validates unknown input values. */
|
|
137
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1$1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
138
|
+
}
|
|
139
|
+
/** The result interface of the validate function. */
|
|
140
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
141
|
+
/** The result interface if validation succeeds. */
|
|
142
|
+
interface SuccessResult<Output> {
|
|
143
|
+
/** The typed output value. */
|
|
144
|
+
readonly value: Output;
|
|
145
|
+
/** The absence of issues indicates success. */
|
|
146
|
+
readonly issues?: undefined;
|
|
147
|
+
}
|
|
148
|
+
interface Options {
|
|
149
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
150
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
151
|
+
}
|
|
152
|
+
/** The result interface if validation fails. */
|
|
153
|
+
interface FailureResult {
|
|
154
|
+
/** The issues of failed validation. */
|
|
155
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
156
|
+
}
|
|
157
|
+
/** The issue interface of the failure output. */
|
|
158
|
+
interface Issue {
|
|
159
|
+
/** The error message of the issue. */
|
|
160
|
+
readonly message: string;
|
|
161
|
+
/** The path of the issue, if any. */
|
|
162
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
163
|
+
}
|
|
164
|
+
/** The path segment interface of the issue. */
|
|
165
|
+
interface PathSegment {
|
|
166
|
+
/** The key representing a path segment. */
|
|
167
|
+
readonly key: PropertyKey;
|
|
168
|
+
}
|
|
169
|
+
/** The Standard types interface. */
|
|
170
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1$1.Types<Input, Output> {}
|
|
171
|
+
/** Infers the input type of a Standard. */
|
|
172
|
+
type InferInput<Schema extends StandardTypedV1$1> = StandardTypedV1$1.InferInput<Schema>;
|
|
173
|
+
/** Infers the output type of a Standard. */
|
|
174
|
+
type InferOutput<Schema extends StandardTypedV1$1> = StandardTypedV1$1.InferOutput<Schema>;
|
|
175
|
+
}
|
|
176
|
+
/** The Standard JSON Schema interface. */
|
|
177
|
+
interface StandardJSONSchemaV1$1<Input = unknown, Output = Input> {
|
|
178
|
+
/** The Standard JSON Schema properties. */
|
|
179
|
+
readonly "~standard": StandardJSONSchemaV1$1.Props<Input, Output>;
|
|
180
|
+
}
|
|
181
|
+
declare namespace StandardJSONSchemaV1$1 {
|
|
182
|
+
/** The Standard JSON Schema properties interface. */
|
|
183
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1$1.Props<Input, Output> {
|
|
184
|
+
/** Methods for generating the input/output JSON Schema. */
|
|
185
|
+
readonly jsonSchema: Converter;
|
|
186
|
+
}
|
|
187
|
+
/** The Standard JSON Schema converter interface. */
|
|
188
|
+
interface Converter {
|
|
189
|
+
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
190
|
+
readonly input: (options: StandardJSONSchemaV1$1.Options) => Record<string, unknown>;
|
|
191
|
+
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
192
|
+
readonly output: (options: StandardJSONSchemaV1$1.Options) => Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
/** The target version of the generated JSON Schema.
|
|
195
|
+
*
|
|
196
|
+
* It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use.
|
|
197
|
+
*
|
|
198
|
+
* The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
|
|
199
|
+
*
|
|
200
|
+
* All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
|
|
1296
201
|
*/
|
|
1297
202
|
type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
|
|
1298
203
|
/** The options for the input/output methods. */
|
|
@@ -4960,416 +3865,2743 @@ interface _ZodDate<T extends $ZodDateInternals = $ZodDateInternals> extends _Zod
|
|
|
4960
3865
|
/** @deprecated Not recommended. */
|
|
4961
3866
|
maxDate: Date | null;
|
|
4962
3867
|
}
|
|
4963
|
-
interface ZodDate extends _ZodDate<$ZodDateInternals<Date>> {}
|
|
4964
|
-
declare const ZodDate: $constructor<ZodDate>;
|
|
4965
|
-
declare function date$2(params?: string | $ZodDateParams): ZodDate;
|
|
4966
|
-
interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInternals<T>>, $ZodArray<T> {
|
|
4967
|
-
element: T;
|
|
4968
|
-
min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
|
|
4969
|
-
nonempty(params?: string | $ZodCheckMinLengthParams): this;
|
|
4970
|
-
max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
|
|
4971
|
-
length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
|
|
4972
|
-
unwrap(): T;
|
|
3868
|
+
interface ZodDate extends _ZodDate<$ZodDateInternals<Date>> {}
|
|
3869
|
+
declare const ZodDate: $constructor<ZodDate>;
|
|
3870
|
+
declare function date$2(params?: string | $ZodDateParams): ZodDate;
|
|
3871
|
+
interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInternals<T>>, $ZodArray<T> {
|
|
3872
|
+
element: T;
|
|
3873
|
+
min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
|
|
3874
|
+
nonempty(params?: string | $ZodCheckMinLengthParams): this;
|
|
3875
|
+
max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
|
|
3876
|
+
length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
|
|
3877
|
+
unwrap(): T;
|
|
3878
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3879
|
+
}
|
|
3880
|
+
declare const ZodArray: $constructor<ZodArray>;
|
|
3881
|
+
declare function array<T extends SomeType>(element: T, params?: string | $ZodArrayParams): ZodArray<T>;
|
|
3882
|
+
declare function keyof<T extends ZodObject>(schema: T): ZodEnum<KeysEnum<T["_zod"]["output"]>>;
|
|
3883
|
+
type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = { [K in keyof Ext]: K extends keyof Base ? output$1<Ext[K]> extends output$1<Base[K]> ? input$1<Ext[K]> extends input$1<Base[K]> ? Ext[K] : never : never : Ext[K]; };
|
|
3884
|
+
interface ZodObject<
|
|
3885
|
+
/** @ts-ignore Cast variance */
|
|
3886
|
+
out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
|
|
3887
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3888
|
+
shape: Shape;
|
|
3889
|
+
keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
|
|
3890
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
3891
|
+
catchall<T extends SomeType>(schema: T): ZodObject<Shape, $catchall<T>>;
|
|
3892
|
+
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
3893
|
+
passthrough(): ZodObject<Shape, $loose>;
|
|
3894
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
3895
|
+
loose(): ZodObject<Shape, $loose>;
|
|
3896
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
3897
|
+
strict(): ZodObject<Shape, $strict>;
|
|
3898
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
3899
|
+
strip(): ZodObject<Shape, $strip>;
|
|
3900
|
+
extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
3901
|
+
safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
3902
|
+
/**
|
|
3903
|
+
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
3904
|
+
*/
|
|
3905
|
+
merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
3906
|
+
pick<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten$1<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
3907
|
+
omit<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten$1<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
3908
|
+
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]>; }, Config>;
|
|
3909
|
+
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
3910
|
+
exactPartial(): ZodObject<{ -readonly [k in keyof Shape]: ZodExactOptional<Shape[k]>; }, Config>;
|
|
3911
|
+
exactPartial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodExactOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
3912
|
+
required(): ZodObject<{ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>; }, Config>;
|
|
3913
|
+
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
3914
|
+
}
|
|
3915
|
+
declare const ZodObject: $constructor<ZodObject>;
|
|
3916
|
+
declare function object<T extends $ZodLooseShape = Partial<Record<never, SomeType>>>(shape?: T, params?: string | $ZodObjectParams): ZodObject<Writeable<T>, $strip>;
|
|
3917
|
+
declare function strictObject<T extends $ZodLooseShape>(shape: T, params?: string | $ZodObjectParams): ZodObject<Writeable<T>, $strict>;
|
|
3918
|
+
declare function looseObject<T extends $ZodLooseShape>(shape: T, params?: string | $ZodObjectParams): ZodObject<Writeable<T>, $loose>;
|
|
3919
|
+
interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
|
|
3920
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3921
|
+
options: T;
|
|
3922
|
+
}
|
|
3923
|
+
declare const ZodUnion: $constructor<ZodUnion>;
|
|
3924
|
+
declare function union<const T extends readonly SomeType[]>(options: T, params?: string | $ZodUnionParams): ZodUnion<T>;
|
|
3925
|
+
interface ZodXor<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodXorInternals<T>>, $ZodXor<T> {
|
|
3926
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3927
|
+
options: T;
|
|
3928
|
+
}
|
|
3929
|
+
declare const ZodXor: $constructor<ZodXor>;
|
|
3930
|
+
/** Creates an exclusive union (XOR) where exactly one option must match.
|
|
3931
|
+
* Unlike regular unions that succeed when any option matches, xor fails if
|
|
3932
|
+
* zero or more than one option matches the input. */
|
|
3933
|
+
declare function xor<const T extends readonly SomeType[]>(options: T, params?: string | $ZodXorParams): ZodXor<T>;
|
|
3934
|
+
interface ZodDiscriminatedUnion<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends ZodUnion<Options>, $ZodDiscriminatedUnion<Options, Disc> {
|
|
3935
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3936
|
+
_zod: $ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
3937
|
+
def: $ZodDiscriminatedUnionDef<Options, Disc>;
|
|
3938
|
+
}
|
|
3939
|
+
declare const ZodDiscriminatedUnion: $constructor<ZodDiscriminatedUnion>;
|
|
3940
|
+
declare function discriminatedUnion<Types extends readonly [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | $ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types, Disc>;
|
|
3941
|
+
interface ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodIntersectionInternals<A, B>>, $ZodIntersection<A, B> {
|
|
3942
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3943
|
+
}
|
|
3944
|
+
declare const ZodIntersection: $constructor<ZodIntersection>;
|
|
3945
|
+
declare function intersection<T extends SomeType, U extends SomeType>(left: T, right: U): ZodIntersection<T, U>;
|
|
3946
|
+
interface ZodTuple<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends _ZodType<$ZodTupleInternals<T, Rest>>, $ZodTuple<T, Rest> {
|
|
3947
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3948
|
+
rest<Rest extends SomeType = $ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
|
3949
|
+
partial(): ZodTuple<{ -readonly [k in keyof T]: ZodOptional<T[k]>; }, Rest>;
|
|
3950
|
+
}
|
|
3951
|
+
declare const ZodTuple: $constructor<ZodTuple>;
|
|
3952
|
+
declare function tuple<T extends readonly [SomeType, ...SomeType[]]>(items: T, params?: string | $ZodTupleParams): ZodTuple<T, null>;
|
|
3953
|
+
declare function tuple<T extends readonly [SomeType, ...SomeType[]], Rest extends SomeType>(items: T, rest: Rest, params?: string | $ZodTupleParams): ZodTuple<T, Rest>;
|
|
3954
|
+
declare function tuple(items: [], params?: string | $ZodTupleParams): ZodTuple<[], null>;
|
|
3955
|
+
interface ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends _ZodType<$ZodRecordInternals<Key, Value>>, $ZodRecord<Key, Value> {
|
|
3956
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3957
|
+
keyType: Key;
|
|
3958
|
+
valueType: Value;
|
|
3959
|
+
}
|
|
3960
|
+
declare const ZodRecord: $constructor<ZodRecord>;
|
|
3961
|
+
declare function record<Key extends $ZodRecordKey, Value extends SomeType>(keyType: Key, valueType: Value, params?: string | $ZodRecordParams): ZodRecord<Key, Value>;
|
|
3962
|
+
declare function partialRecord<Key extends $ZodRecordKey, Value extends SomeType>(keyType: Key, valueType: Value, params?: string | $ZodRecordParams): ZodRecord<Key & $partial, Value>;
|
|
3963
|
+
declare function looseRecord<Key extends $ZodRecordKey, Value extends SomeType>(keyType: Key, valueType: Value, params?: string | $ZodRecordParams): ZodRecord<Key, Value>;
|
|
3964
|
+
interface ZodMap<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends _ZodType<$ZodMapInternals<Key, Value>>, $ZodMap<Key, Value> {
|
|
3965
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3966
|
+
keyType: Key;
|
|
3967
|
+
valueType: Value;
|
|
3968
|
+
min(minSize: number, params?: string | $ZodCheckMinSizeParams): this;
|
|
3969
|
+
nonempty(params?: string | $ZodCheckMinSizeParams): this;
|
|
3970
|
+
max(maxSize: number, params?: string | $ZodCheckMaxSizeParams): this;
|
|
3971
|
+
size(size: number, params?: string | $ZodCheckSizeEqualsParams): this;
|
|
3972
|
+
}
|
|
3973
|
+
declare const ZodMap: $constructor<ZodMap>;
|
|
3974
|
+
declare function map<Key extends SomeType, Value extends SomeType>(keyType: Key, valueType: Value, params?: string | $ZodMapParams): ZodMap<Key, Value>;
|
|
3975
|
+
interface ZodSet<T extends SomeType = $ZodType> extends _ZodType<$ZodSetInternals<T>>, $ZodSet<T> {
|
|
3976
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3977
|
+
min(minSize: number, params?: string | $ZodCheckMinSizeParams): this;
|
|
3978
|
+
nonempty(params?: string | $ZodCheckMinSizeParams): this;
|
|
3979
|
+
max(maxSize: number, params?: string | $ZodCheckMaxSizeParams): this;
|
|
3980
|
+
size(size: number, params?: string | $ZodCheckSizeEqualsParams): this;
|
|
3981
|
+
}
|
|
3982
|
+
declare const ZodSet: $constructor<ZodSet>;
|
|
3983
|
+
declare function set<Value extends SomeType>(valueType: Value, params?: string | $ZodSetParams): ZodSet<Value>;
|
|
3984
|
+
interface ZodEnum<
|
|
3985
|
+
/** @ts-ignore Cast variance */
|
|
3986
|
+
out T extends EnumLike = EnumLike> extends _ZodType<$ZodEnumInternals<T>>, $ZodEnum<T> {
|
|
3987
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
3988
|
+
enum: T;
|
|
3989
|
+
options: Array<T[keyof T]>;
|
|
3990
|
+
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten$1<Pick<T, U[number]>>>;
|
|
3991
|
+
exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten$1<Omit<T, U[number]>>>;
|
|
3992
|
+
}
|
|
3993
|
+
declare const ZodEnum: $constructor<ZodEnum>;
|
|
3994
|
+
declare function _enum<const T extends readonly string[]>(values: T, params?: string | $ZodEnumParams): ZodEnum<ToEnum<T[number]>>;
|
|
3995
|
+
declare function _enum<const T extends EnumLike>(entries: T, params?: string | $ZodEnumParams): ZodEnum<T>;
|
|
3996
|
+
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
3997
|
+
*
|
|
3998
|
+
* ```ts
|
|
3999
|
+
* enum Colors { red, green, blue }
|
|
4000
|
+
* z.enum(Colors);
|
|
4001
|
+
* ```
|
|
4002
|
+
*/
|
|
4003
|
+
declare function nativeEnum<T extends EnumLike>(entries: T, params?: string | $ZodEnumParams): ZodEnum<T>;
|
|
4004
|
+
interface ZodLiteral<T extends Literal = Literal> extends _ZodType<$ZodLiteralInternals<T>>, $ZodLiteral<T> {
|
|
4005
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4006
|
+
values: Set<T>;
|
|
4007
|
+
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
4008
|
+
value: T;
|
|
4009
|
+
}
|
|
4010
|
+
declare const ZodLiteral: $constructor<ZodLiteral>;
|
|
4011
|
+
declare function literal<const T extends ReadonlyArray<Literal>>(value: T, params?: string | $ZodLiteralParams): ZodLiteral<T[number]>;
|
|
4012
|
+
declare function literal<const T extends Literal>(value: T, params?: string | $ZodLiteralParams): ZodLiteral<T>;
|
|
4013
|
+
interface ZodFile extends _ZodType<$ZodFileInternals>, $ZodFile {
|
|
4014
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4015
|
+
min(size: number, params?: string | $ZodCheckMinSizeParams): this;
|
|
4016
|
+
max(size: number, params?: string | $ZodCheckMaxSizeParams): this;
|
|
4017
|
+
mime(types: MimeTypes | Array<MimeTypes>, params?: string | $ZodCheckMimeTypeParams): this;
|
|
4018
|
+
}
|
|
4019
|
+
declare const ZodFile: $constructor<ZodFile>;
|
|
4020
|
+
declare function file(params?: string | $ZodFileParams): ZodFile;
|
|
4021
|
+
interface ZodTransform<O = unknown, I = unknown> extends _ZodType<$ZodTransformInternals<O, I>>, $ZodTransform<O, I> {
|
|
4022
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4023
|
+
}
|
|
4024
|
+
declare const ZodTransform: $constructor<ZodTransform>;
|
|
4025
|
+
declare function transform<I = unknown, O = I>(fn: (input: I, ctx: $RefinementCtx) => O): ZodTransform<Awaited<O>, I>;
|
|
4026
|
+
interface ZodOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodOptionalInternals<T>>, $ZodOptional<T> {
|
|
4027
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4028
|
+
unwrap(): T;
|
|
4029
|
+
}
|
|
4030
|
+
declare const ZodOptional: $constructor<ZodOptional>;
|
|
4031
|
+
declare function optional<T extends SomeType>(innerType: T): ZodOptional<T>;
|
|
4032
|
+
interface ZodExactOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodExactOptionalInternals<T>>, $ZodExactOptional<T> {
|
|
4033
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4034
|
+
unwrap(): T;
|
|
4035
|
+
}
|
|
4036
|
+
declare const ZodExactOptional: $constructor<ZodExactOptional>;
|
|
4037
|
+
declare function exactOptional<T extends SomeType>(innerType: T): ZodExactOptional<T>;
|
|
4038
|
+
interface ZodNullable<T extends SomeType = $ZodType> extends _ZodType<$ZodNullableInternals<T>>, $ZodNullable<T> {
|
|
4039
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4040
|
+
unwrap(): T;
|
|
4041
|
+
}
|
|
4042
|
+
declare const ZodNullable: $constructor<ZodNullable>;
|
|
4043
|
+
declare function nullable<T extends SomeType>(innerType: T): ZodNullable<T>;
|
|
4044
|
+
declare function nullish<T extends SomeType>(innerType: T): ZodOptional<ZodNullable<T>>;
|
|
4045
|
+
interface ZodDefault<T extends SomeType = $ZodType> extends _ZodType<$ZodDefaultInternals<T>>, $ZodDefault<T> {
|
|
4046
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4047
|
+
unwrap(): T;
|
|
4048
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
4049
|
+
removeDefault(): T;
|
|
4050
|
+
}
|
|
4051
|
+
declare const ZodDefault: $constructor<ZodDefault>;
|
|
4052
|
+
declare function _default<T extends SomeType>(innerType: T, defaultValue: NoUndefined<output$1<T>> | (() => NoUndefined<output$1<T>>)): ZodDefault<T>;
|
|
4053
|
+
interface ZodPrefault<T extends SomeType = $ZodType> extends _ZodType<$ZodPrefaultInternals<T>>, $ZodPrefault<T> {
|
|
4054
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4055
|
+
unwrap(): T;
|
|
4056
|
+
}
|
|
4057
|
+
declare const ZodPrefault: $constructor<ZodPrefault>;
|
|
4058
|
+
declare function prefault<T extends SomeType>(innerType: T, defaultValue: input$1<T> | (() => input$1<T>)): ZodPrefault<T>;
|
|
4059
|
+
interface ZodNonOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodNonOptionalInternals<T>>, $ZodNonOptional<T> {
|
|
4060
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4061
|
+
unwrap(): T;
|
|
4062
|
+
}
|
|
4063
|
+
declare const ZodNonOptional: $constructor<ZodNonOptional>;
|
|
4064
|
+
declare function nonoptional<T extends SomeType>(innerType: T, params?: string | $ZodNonOptionalParams): ZodNonOptional<T>;
|
|
4065
|
+
interface ZodSuccess<T extends SomeType = $ZodType> extends _ZodType<$ZodSuccessInternals<T>>, $ZodSuccess<T> {
|
|
4066
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4067
|
+
unwrap(): T;
|
|
4068
|
+
}
|
|
4069
|
+
declare const ZodSuccess: $constructor<ZodSuccess>;
|
|
4070
|
+
declare function success<T extends SomeType>(innerType: T): ZodSuccess<T>;
|
|
4071
|
+
interface ZodCatch<T extends SomeType = $ZodType> extends _ZodType<$ZodCatchInternals<T>>, $ZodCatch<T> {
|
|
4072
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4073
|
+
unwrap(): T;
|
|
4074
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
4075
|
+
removeCatch(): T;
|
|
4076
|
+
}
|
|
4077
|
+
declare const ZodCatch: $constructor<ZodCatch>;
|
|
4078
|
+
declare function _catch<T extends SomeType>(innerType: T, catchValue: output$1<T> | ((ctx: $ZodCatchCtx) => output$1<T>)): ZodCatch<T>;
|
|
4079
|
+
interface ZodNaN extends _ZodType<$ZodNaNInternals>, $ZodNaN {
|
|
4080
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4081
|
+
}
|
|
4082
|
+
declare const ZodNaN: $constructor<ZodNaN>;
|
|
4083
|
+
declare function nan(params?: string | $ZodNaNParams): ZodNaN;
|
|
4084
|
+
interface ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodPipeInternals<A, B>>, $ZodPipe<A, B> {
|
|
4085
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4086
|
+
in: A;
|
|
4087
|
+
out: B;
|
|
4088
|
+
}
|
|
4089
|
+
declare const ZodPipe: $constructor<ZodPipe>;
|
|
4090
|
+
declare function pipe<const A extends SomeType, B extends $ZodType<unknown, output$1<A>> = $ZodType<unknown, output$1<A>>>(in_: A, out: B | $ZodType<unknown, output$1<A>>): ZodPipe<A, B>;
|
|
4091
|
+
interface ZodCodec<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends ZodPipe<A, B>, $ZodCodec<A, B> {
|
|
4092
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4093
|
+
_zod: $ZodCodecInternals<A, B>;
|
|
4094
|
+
def: $ZodCodecDef<A, B>;
|
|
4095
|
+
}
|
|
4096
|
+
declare const ZodCodec: $constructor<ZodCodec>;
|
|
4097
|
+
declare function codec<const A extends SomeType, B extends SomeType = $ZodType>(in_: A, out: B, params: {
|
|
4098
|
+
decode: (value: output$1<A>, payload: ParsePayload<output$1<A>>) => MaybeAsync<input$1<B>>;
|
|
4099
|
+
encode: (value: input$1<B>, payload: ParsePayload<input$1<B>>) => MaybeAsync<output$1<A>>;
|
|
4100
|
+
}): ZodCodec<A, B>;
|
|
4101
|
+
declare function invertCodec<A extends SomeType, B extends SomeType>(codec: ZodCodec<A, B>): ZodCodec<B, A>;
|
|
4102
|
+
interface ZodPreprocess<B extends SomeType = $ZodType, I = unknown> extends ZodPipe<$ZodTransform<unknown, I>, B>, $ZodPreprocess<B, I> {
|
|
4973
4103
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4104
|
+
_zod: $ZodPreprocessInternals<B, I>;
|
|
4105
|
+
def: $ZodPreprocessDef<B, I>;
|
|
4974
4106
|
}
|
|
4975
|
-
declare const
|
|
4976
|
-
|
|
4977
|
-
declare function keyof<T extends ZodObject>(schema: T): ZodEnum<KeysEnum<T["_zod"]["output"]>>;
|
|
4978
|
-
type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = { [K in keyof Ext]: K extends keyof Base ? output$1<Ext[K]> extends output$1<Base[K]> ? input$1<Ext[K]> extends input$1<Base[K]> ? Ext[K] : never : never : Ext[K]; };
|
|
4979
|
-
interface ZodObject<
|
|
4980
|
-
/** @ts-ignore Cast variance */
|
|
4981
|
-
out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
|
|
4107
|
+
declare const ZodPreprocess: $constructor<ZodPreprocess>;
|
|
4108
|
+
interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadonlyInternals<T>>, $ZodReadonly<T> {
|
|
4982
4109
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4983
|
-
|
|
4984
|
-
keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
|
|
4985
|
-
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
4986
|
-
catchall<T extends SomeType>(schema: T): ZodObject<Shape, $catchall<T>>;
|
|
4987
|
-
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
4988
|
-
passthrough(): ZodObject<Shape, $loose>;
|
|
4989
|
-
/** Consider `z.looseObject(A.shape)` instead */
|
|
4990
|
-
loose(): ZodObject<Shape, $loose>;
|
|
4991
|
-
/** Consider `z.strictObject(A.shape)` instead */
|
|
4992
|
-
strict(): ZodObject<Shape, $strict>;
|
|
4993
|
-
/** This is the default behavior. This method call is likely unnecessary. */
|
|
4994
|
-
strip(): ZodObject<Shape, $strip>;
|
|
4995
|
-
extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
4996
|
-
safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
4997
|
-
/**
|
|
4998
|
-
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
4999
|
-
*/
|
|
5000
|
-
merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
5001
|
-
pick<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten$1<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
5002
|
-
omit<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten$1<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
5003
|
-
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]>; }, Config>;
|
|
5004
|
-
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
5005
|
-
exactPartial(): ZodObject<{ -readonly [k in keyof Shape]: ZodExactOptional<Shape[k]>; }, Config>;
|
|
5006
|
-
exactPartial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodExactOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
5007
|
-
required(): ZodObject<{ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>; }, Config>;
|
|
5008
|
-
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
4110
|
+
unwrap(): T;
|
|
5009
4111
|
}
|
|
5010
|
-
declare const
|
|
5011
|
-
declare function
|
|
5012
|
-
|
|
5013
|
-
declare function looseObject<T extends $ZodLooseShape>(shape: T, params?: string | $ZodObjectParams): ZodObject<Writeable<T>, $loose>;
|
|
5014
|
-
interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
|
|
4112
|
+
declare const ZodReadonly: $constructor<ZodReadonly>;
|
|
4113
|
+
declare function readonly<T extends SomeType>(innerType: T): ZodReadonly<T>;
|
|
4114
|
+
interface ZodTemplateLiteral<Template extends string = string> extends _ZodType<$ZodTemplateLiteralInternals<Template>>, $ZodTemplateLiteral<Template> {
|
|
5015
4115
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
5016
|
-
options: T;
|
|
5017
4116
|
}
|
|
5018
|
-
declare const
|
|
5019
|
-
declare function
|
|
5020
|
-
interface
|
|
4117
|
+
declare const ZodTemplateLiteral: $constructor<ZodTemplateLiteral>;
|
|
4118
|
+
declare function templateLiteral<const Parts extends $ZodTemplateLiteralPart[]>(parts: Parts, params?: string | $ZodTemplateLiteralParams): ZodTemplateLiteral<$PartsToTemplateLiteral<Parts>>;
|
|
4119
|
+
interface ZodLazy<T extends SomeType = $ZodType> extends _ZodType<$ZodLazyInternals<T>>, $ZodLazy<T> {
|
|
5021
4120
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
5022
|
-
|
|
4121
|
+
unwrap(): T;
|
|
5023
4122
|
}
|
|
5024
|
-
declare const
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
* zero or more than one option matches the input. */
|
|
5028
|
-
declare function xor<const T extends readonly SomeType[]>(options: T, params?: string | $ZodXorParams): ZodXor<T>;
|
|
5029
|
-
interface ZodDiscriminatedUnion<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends ZodUnion<Options>, $ZodDiscriminatedUnion<Options, Disc> {
|
|
4123
|
+
declare const ZodLazy: $constructor<ZodLazy>;
|
|
4124
|
+
declare function lazy<T extends SomeType>(getter: () => T): ZodLazy<T>;
|
|
4125
|
+
interface ZodPromise<T extends SomeType = $ZodType> extends _ZodType<$ZodPromiseInternals<T>>, $ZodPromise<T> {
|
|
5030
4126
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
5031
|
-
|
|
5032
|
-
def: $ZodDiscriminatedUnionDef<Options, Disc>;
|
|
4127
|
+
unwrap(): T;
|
|
5033
4128
|
}
|
|
5034
|
-
declare const
|
|
5035
|
-
declare function
|
|
5036
|
-
interface
|
|
4129
|
+
declare const ZodPromise: $constructor<ZodPromise>;
|
|
4130
|
+
declare function promise<T extends SomeType>(innerType: T): ZodPromise<T>;
|
|
4131
|
+
interface ZodFunction<Args extends $ZodFunctionIn = $ZodFunctionIn, Returns extends $ZodFunctionOut = $ZodFunctionOut> extends _ZodType<$ZodFunctionInternals<Args, Returns>>, $ZodFunction<Args, Returns> {
|
|
4132
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4133
|
+
_def: $ZodFunctionDef<Args, Returns>;
|
|
4134
|
+
_input: $InferInnerFunctionType<Args, Returns>;
|
|
4135
|
+
_output: $InferOuterFunctionType<Args, Returns>;
|
|
4136
|
+
input<const Items extends TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(args: Items, rest?: Rest): ZodFunction<$ZodTuple<Items, Rest>, Returns>;
|
|
4137
|
+
input<NewArgs extends $ZodFunctionIn>(args: NewArgs): ZodFunction<NewArgs, Returns>;
|
|
4138
|
+
input(...args: any[]): ZodFunction<any, Returns>;
|
|
4139
|
+
output<NewReturns extends $ZodType>(output: NewReturns): ZodFunction<Args, NewReturns>;
|
|
4140
|
+
}
|
|
4141
|
+
declare const ZodFunction: $constructor<ZodFunction>;
|
|
4142
|
+
declare function _function(): ZodFunction;
|
|
4143
|
+
declare function _function<const In extends ReadonlyArray<$ZodType>>(params: {
|
|
4144
|
+
input: In;
|
|
4145
|
+
}): ZodFunction<ZodTuple<In, null>, $ZodFunctionOut>;
|
|
4146
|
+
declare function _function<const In extends ReadonlyArray<$ZodType>, const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
|
|
4147
|
+
input: In;
|
|
4148
|
+
output: Out;
|
|
4149
|
+
}): ZodFunction<ZodTuple<In, null>, Out>;
|
|
4150
|
+
declare function _function<const In extends $ZodFunctionIn = $ZodFunctionIn>(params: {
|
|
4151
|
+
input: In;
|
|
4152
|
+
}): ZodFunction<In, $ZodFunctionOut>;
|
|
4153
|
+
declare function _function<const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
|
|
4154
|
+
output: Out;
|
|
4155
|
+
}): ZodFunction<$ZodFunctionIn, Out>;
|
|
4156
|
+
declare function _function<In extends $ZodFunctionIn = $ZodFunctionIn, Out extends $ZodType = $ZodType>(params?: {
|
|
4157
|
+
input: In;
|
|
4158
|
+
output: Out;
|
|
4159
|
+
}): ZodFunction<In, Out>;
|
|
4160
|
+
interface ZodCustom<O = unknown, I = unknown> extends _ZodType<$ZodCustomInternals<O, I>>, $ZodCustom<O, I> {
|
|
5037
4161
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
5038
4162
|
}
|
|
5039
|
-
declare const
|
|
5040
|
-
declare function
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
4163
|
+
declare const ZodCustom: $constructor<ZodCustom>;
|
|
4164
|
+
declare function check<O = unknown>(fn: CheckFn<O>): $ZodCheck<O>;
|
|
4165
|
+
declare function custom<O>(fn?: (data: unknown) => unknown, _params?: string | $ZodCustomParams | undefined): ZodCustom<O, O>;
|
|
4166
|
+
declare function refine<T>(fn: (arg: NoInfer<T>) => MaybeAsync<unknown>, _params?: string | $ZodCustomParams): $ZodCheck<T>;
|
|
4167
|
+
declare function superRefine<T>(fn: (arg: T, payload: $RefinementCtx<T>) => void | Promise<void>, params?: $ZodSuperRefineParams): $ZodCheck<T>;
|
|
4168
|
+
declare const describe: typeof describe$1;
|
|
4169
|
+
declare const meta: typeof meta$1;
|
|
4170
|
+
type ZodInstanceOfParams = Params<ZodCustom, $ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
|
|
4171
|
+
interface ZodInstanceOf<T = unknown> extends ZodCustom<T, T> {
|
|
4172
|
+
properties<Shape extends { [k in keyof T as T[k] extends Function ? never : k]?: $ZodType<unknown, T[k]>; }>(shape: Shape, params?: string | $ZodCheckPropertiesParams): ZodInstanceOf<T & $InferObjectInput<Shape, {}>>;
|
|
4173
|
+
}
|
|
4174
|
+
declare const ZodInstanceOf: $constructor<ZodInstanceOf>;
|
|
4175
|
+
declare function _instanceof<T extends typeof Class>(cls: T, params?: ZodInstanceOfParams): ZodInstanceOf<InstanceType<T>>;
|
|
4176
|
+
declare const stringbool: (_params?: string | $ZodStringBoolParams) => ZodCodec<ZodString, ZodBoolean>;
|
|
4177
|
+
type _ZodJSONSchema = ZodUnion<[ZodString, ZodNumber, ZodBoolean, ZodNull, ZodArray<ZodJSONSchema>, ZodRecord<ZodString, ZodJSONSchema>]>;
|
|
4178
|
+
type _ZodJSONSchemaInternals = _ZodJSONSchema["_zod"];
|
|
4179
|
+
interface ZodJSONSchemaInternals extends _ZodJSONSchemaInternals {
|
|
4180
|
+
output: JSONType;
|
|
4181
|
+
input: JSONType;
|
|
4182
|
+
}
|
|
4183
|
+
interface ZodJSONSchema extends _ZodJSONSchema {
|
|
4184
|
+
_zod: ZodJSONSchemaInternals;
|
|
4185
|
+
}
|
|
4186
|
+
declare function json(params?: string | $ZodCustomParams): ZodJSONSchema;
|
|
4187
|
+
declare function preprocess<A, U extends SomeType, B = unknown>(fn: (arg: B, ctx: $RefinementCtx) => A, schema: U): ZodPreprocess<U, B>;
|
|
4188
|
+
//#endregion
|
|
4189
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/compat.d.cts
|
|
4190
|
+
/** @deprecated Use `z.output<T>` instead. */
|
|
4191
|
+
type TypeOf<T> = output$1<T>;
|
|
4192
|
+
/** @deprecated Use `z.output<T>` instead. */
|
|
4193
|
+
type Infer$1<T> = output$1<T>;
|
|
4194
|
+
/** @deprecated Use `z.core.$ZodTypes` instead */
|
|
4195
|
+
type ZodFirstPartySchemaTypes = $ZodTypes;
|
|
4196
|
+
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
4197
|
+
declare const ZodIssueCode: {
|
|
4198
|
+
readonly invalid_type: "invalid_type";
|
|
4199
|
+
readonly too_big: "too_big";
|
|
4200
|
+
readonly too_small: "too_small";
|
|
4201
|
+
readonly invalid_format: "invalid_format";
|
|
4202
|
+
readonly not_multiple_of: "not_multiple_of";
|
|
4203
|
+
readonly unrecognized_keys: "unrecognized_keys";
|
|
4204
|
+
readonly invalid_union: "invalid_union";
|
|
4205
|
+
readonly invalid_key: "invalid_key";
|
|
4206
|
+
readonly invalid_element: "invalid_element";
|
|
4207
|
+
readonly invalid_value: "invalid_value";
|
|
4208
|
+
readonly custom: "custom";
|
|
4209
|
+
};
|
|
4210
|
+
/** @deprecated Use `z.core.$ZodFlattenedError<z.output<T>>` instead; it takes an inferred type, not a schema. */
|
|
4211
|
+
type inferFlattenedErrors<T extends $ZodType, U = string> = $ZodFlattenedError<output$1<T>, U>;
|
|
4212
|
+
/** @deprecated Use `z.core.$ZodFormattedError<z.output<T>>` instead; it takes an inferred type, not a schema. */
|
|
4213
|
+
type inferFormattedError<T extends $ZodType<any, any>, U = string> = $ZodFormattedError<output$1<T>, U>;
|
|
4214
|
+
/** Use `z.$brand` instead */
|
|
4215
|
+
type BRAND<T extends string | number | symbol = string | number | symbol> = {
|
|
4216
|
+
[$brand]: { [k in T]: true; };
|
|
4217
|
+
};
|
|
4218
|
+
/** @deprecated Use `z.config(params)` instead. */
|
|
4219
|
+
declare function setErrorMap(map: $ZodErrorMap): void;
|
|
4220
|
+
/** @deprecated Use `z.config()` instead. */
|
|
4221
|
+
declare function getErrorMap(): $ZodErrorMap<$ZodIssue> | undefined;
|
|
4222
|
+
/** @deprecated Use z.ZodType (without generics) instead. */
|
|
4223
|
+
type ZodTypeAny<Output = unknown, Input = unknown, Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> = ZodType<Output, Input, Internals>;
|
|
4224
|
+
/** @deprecated Use `z.ZodType` */
|
|
4225
|
+
type ZodSchema<Output = unknown, Input = unknown, Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> = ZodType<Output, Input, Internals>;
|
|
4226
|
+
/** @deprecated Use `z.ZodType` */
|
|
4227
|
+
type Schema<Output = unknown, Input = unknown, Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> = ZodType<Output, Input, Internals>;
|
|
4228
|
+
/** Included for Zod 3 compatibility */
|
|
4229
|
+
type ZodRawShape$1 = $ZodShape;
|
|
4230
|
+
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
4231
|
+
declare enum ZodFirstPartyTypeKind {}
|
|
4232
|
+
//#endregion
|
|
4233
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/from-json-schema.d.cts
|
|
4234
|
+
type JSONSchemaVersion = "draft-2020-12" | "draft-7" | "draft-4" | "openapi-3.0";
|
|
4235
|
+
interface FromJSONSchemaParams {
|
|
4236
|
+
defaultTarget?: JSONSchemaVersion;
|
|
4237
|
+
registry?: $ZodRegistry<any>;
|
|
4238
|
+
}
|
|
4239
|
+
/**
|
|
4240
|
+
* Converts a JSON Schema to a Zod schema. This function should be considered semi-experimental. It's behavior is liable to change. */
|
|
4241
|
+
declare function fromJSONSchema(schema: JSONSchema$1 | boolean, params?: FromJSONSchemaParams): ZodType;
|
|
4242
|
+
//#endregion
|
|
4243
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/deep-partial.d.cts
|
|
4244
|
+
/** Distributes `.partial()` through every object in a schema type, preserving the wrappers around them. */
|
|
4245
|
+
type DeepPartial<T extends SomeType> = T extends ZodObject<infer Shape, infer Config> ? ZodObject<{ -readonly [K in keyof Shape]: ZodOptional<DeepPartial<Shape[K]>>; }, Config> : T extends ZodDiscriminatedUnion<infer Options, any> ? ZodUnion<{ -readonly [I in keyof Options]: Options[I] extends SomeType ? DeepPartial<Options[I]> : Options[I]; }> : T extends ZodUnion<infer Options> ? ZodUnion<{ -readonly [I in keyof Options]: Options[I] extends SomeType ? DeepPartial<Options[I]> : Options[I]; }> : T extends ZodArray<infer El> ? ZodArray<DeepPartial<El>> : T extends ZodTuple<infer Items, infer Rest> ? ZodTuple<{ -readonly [K in keyof Items]: Items[K] extends SomeType ? DeepPartial<Items[K]> : Items[K]; }, Rest extends SomeType ? DeepPartial<Rest> : Rest> : T extends ZodIntersection<infer A, infer B> ? ZodIntersection<DeepPartial<A>, DeepPartial<B>> : T extends ZodRecord<infer K, infer V> ? ZodRecord<K, DeepPartial<V>> : T extends ZodMap<infer K, infer V> ? ZodMap<K, DeepPartial<V>> : T extends ZodSet<infer El> ? ZodSet<DeepPartial<El>> : T extends ZodOptional<infer Inner> ? ZodOptional<DeepPartial<Inner>> : T extends ZodNullable<infer Inner> ? ZodNullable<DeepPartial<Inner>> : T extends ZodDefault<infer Inner> ? ZodDefault<DeepPartial<Inner>> : T extends ZodPrefault<infer Inner> ? ZodPrefault<DeepPartial<Inner>> : T extends ZodNonOptional<infer Inner> ? ZodNonOptional<DeepPartial<Inner>> : T extends ZodCatch<infer Inner> ? ZodCatch<DeepPartial<Inner>> : T extends ZodReadonly<infer Inner> ? ZodReadonly<DeepPartial<Inner>> : T extends ZodSuccess<infer Inner> ? ZodSuccess<DeepPartial<Inner>> : T extends ZodPromise<infer Inner> ? ZodPromise<DeepPartial<Inner>> : T extends ZodCodec<infer A, infer B> ? ZodCodec<DeepPartial<A>, DeepPartial<B>> : T extends ZodPreprocess<infer B> ? ZodPreprocess<DeepPartial<B>> : T extends ZodPipe<infer A, infer B> ? ZodPipe<DeepPartial<A>, DeepPartial<B>> : T extends ZodLazy<infer Inner> ? ZodLazy<DeepPartial<Inner>> : T;
|
|
4246
|
+
/** Returns a copy of the schema with every nested object's properties made optional. */
|
|
4247
|
+
declare function deepPartial<T extends SomeType>(schema: T): DeepPartial<T>;
|
|
4248
|
+
//#endregion
|
|
4249
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/in-out.d.cts
|
|
4250
|
+
type input<T> = input$1<T>;
|
|
4251
|
+
type output<T> = output$1<T>;
|
|
4252
|
+
/** Returns a copy of the schema with every pipe replaced by its input side. A codec's checks are dropped: they constrain the decoded value the input side never produces. */
|
|
4253
|
+
declare function input<T extends $ZodType>(schema: T): ZodType<input$1<T>, input$1<T>>;
|
|
4254
|
+
/** Returns a copy of the schema with every pipe replaced by its output side, carrying over the pipe's own checks. */
|
|
4255
|
+
declare function output<T extends $ZodType>(schema: T): ZodType<output$1<T>, output$1<T>>;
|
|
4256
|
+
declare namespace iso_d_exports {
|
|
4257
|
+
export { ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, date$1 as date, datetime, duration, time };
|
|
4258
|
+
}
|
|
4259
|
+
declare function datetime(params?: string | $ZodISODateTimeParams): ZodISODateTime;
|
|
4260
|
+
declare function date$1(params?: string | $ZodISODateParams): ZodISODate;
|
|
4261
|
+
declare function time(params?: string | $ZodISOTimeParams): ZodISOTime;
|
|
4262
|
+
declare function duration(params?: string | $ZodISODurationParams): ZodISODuration;
|
|
4263
|
+
declare namespace coerce_d_exports {
|
|
4264
|
+
export { ZodCoercedBigInt, ZodCoercedBoolean, ZodCoercedDate, ZodCoercedNumber, ZodCoercedString, bigint, boolean, date, number, string };
|
|
4265
|
+
}
|
|
4266
|
+
interface ZodCoercedString<T = unknown> extends _ZodString<$ZodStringInternals<T>> {}
|
|
4267
|
+
declare function string<T = unknown>(params?: string | $ZodStringParams): ZodCoercedString<T>;
|
|
4268
|
+
interface ZodCoercedNumber<T = unknown> extends _ZodNumber<$ZodNumberInternals<T>> {}
|
|
4269
|
+
declare function number<T = unknown>(params?: string | $ZodNumberParams): ZodCoercedNumber<T>;
|
|
4270
|
+
interface ZodCoercedBoolean<T = unknown> extends _ZodBoolean<$ZodBooleanInternals<T>> {}
|
|
4271
|
+
declare function boolean<T = unknown>(params?: string | $ZodBooleanParams): ZodCoercedBoolean<T>;
|
|
4272
|
+
interface ZodCoercedBigInt<T = unknown> extends _ZodBigInt<$ZodBigIntInternals<T>> {}
|
|
4273
|
+
declare function bigint<T = unknown>(params?: string | $ZodBigIntParams): ZodCoercedBigInt<T>;
|
|
4274
|
+
interface ZodCoercedDate<T = unknown> extends _ZodDate<$ZodDateInternals<T>> {}
|
|
4275
|
+
declare function date<T = unknown>(params?: string | $ZodDateParams): ZodCoercedDate<T>;
|
|
4276
|
+
declare namespace external_d_exports {
|
|
4277
|
+
export { $brand, $input, $output, BRAND, CompileOptions, GlobalMeta, INVALID, Infer$1 as Infer, IssueData, JSONType, NEVER, $RefinementCtx as RefinementCtx, SafeExtendShape, Schema, TimePrecision, TypeOf, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCoercedBigInt, ZodCoercedBoolean, ZodCoercedDate, ZodCoercedNumber, ZodCoercedString, ZodCompileAsyncError, ZodCompileUnsupportedError, ZodCreditCard, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodErrorMap, ZodExactOptional, ZodFile, ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind, ZodFlattenedError, ZodFloat32, ZodFloat64, ZodFormattedError, ZodFunction, ZodGUID, ZodIBAN, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodInstanceOf, ZodInt, ZodInt32, ZodInt64, ZodIntersection, ZodIssue, ZodIssueCode, ZodJSONSchema, ZodJSONSchemaInternals, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPreprocess, ZodPromise, ZodRawShape$1 as ZodRawShape, ZodReadonly, ZodRealError, ZodRecord, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodSchema, ZodSet, ZodStandardSchemaWithJSON, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodTypeAny, ZodUInt32, ZodUInt64, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber, _ZodString, _ZodType, _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch as catch, check, cidrv4, cidrv6, clone, codec, coerce_d_exports as coerce, compile, config, index_d_exports$1 as core, creditCard, cuid, cuid2, currencyCode, custom, date$2 as date, decode, decodeAsync, deepPartial, describe, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _endsWith as endsWith, _enum as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getDiscriminatedOption, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, iban, _includes as includes, output$1 as infer, inferFlattenedErrors, inferFormattedError, input, _instanceof as instanceof, int, int32, int64, intersection, invertCodec, ipv4, ipv6, iso_d_exports as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index_d_exports$2 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, memoizer, meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null as null, nullable, nullish, number$1 as number, object, optional, output, _overwrite as overwrite, parse, parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _properties as properties, _property as property, readonly, record, refine, _regex as regex, regexes_d_exports as regexes, registry, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, toZod, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, _uppercase as uppercase, url, util_d_exports as util, uuid, uuidv4, uuidv6, uuidv7, validate, validateAsync, _void as void, withParser, xid, xor };
|
|
4278
|
+
}
|
|
4279
|
+
//#endregion
|
|
4280
|
+
//#region ../core/dist/change-flow-i6vGyxUm.d.mts
|
|
4281
|
+
interface RegisteredServer {
|
|
4282
|
+
client: string;
|
|
4283
|
+
path: string;
|
|
4284
|
+
name: string;
|
|
4285
|
+
command: string;
|
|
4286
|
+
args: string[];
|
|
4287
|
+
/**
|
|
4288
|
+
* The address of a remote server, for an entry that has one instead of a command.
|
|
4289
|
+
*
|
|
4290
|
+
* Read because the official Slack server is exactly such an entry — `https://mcp.slack.com/mcp` — and a scan
|
|
4291
|
+
* that looked only at `command` and `args` could not see the one other Slack server most people will have.
|
|
4292
|
+
*/
|
|
4293
|
+
url?: string | undefined;
|
|
4294
|
+
/** The entry's own `type` (`stdio`, `http`, `sse`), when it declares one. */
|
|
4295
|
+
type?: string | undefined;
|
|
4296
|
+
/** The npm package the entry launches, when one can be read from the command line. */
|
|
4297
|
+
packageName?: string | undefined;
|
|
4298
|
+
/**
|
|
4299
|
+
* The entry's own environment, when it declares one.
|
|
4300
|
+
*
|
|
4301
|
+
* Carried because an entry cannot be put back without it: ours sets `AGENT_COMMS_CONFIG_DIR`, and a server
|
|
4302
|
+
* restored without that looks in the wrong directory and reports no mailboxes — a silent wrong answer where the
|
|
4303
|
+
* missing entry it replaced was at least an obvious one.
|
|
4304
|
+
*/
|
|
4305
|
+
env?: Record<string, string> | undefined;
|
|
4306
|
+
/**
|
|
4307
|
+
* `project` for an entry Claude Code keeps under `projects`, `user` otherwise.
|
|
4308
|
+
*
|
|
4309
|
+
* Every command this package issues targets user scope. Without knowing the difference, a repair aimed at a
|
|
4310
|
+
* project-scoped entry removes nothing, adds a second entry at user scope, and reports success — leaving the
|
|
4311
|
+
* stale one still in force for that project.
|
|
4312
|
+
*/
|
|
4313
|
+
scope?: "user" | "project" | undefined;
|
|
4314
|
+
}
|
|
4315
|
+
/** The five suite directories a CLI can pin independently. */
|
|
4316
|
+
declare const PATH_OPTIONS: readonly [{
|
|
4317
|
+
readonly key: "configDir";
|
|
4318
|
+
readonly option: "config-dir";
|
|
4319
|
+
readonly flag: "--config-dir";
|
|
4320
|
+
}, {
|
|
4321
|
+
readonly key: "stateDir";
|
|
4322
|
+
readonly option: "state-dir";
|
|
4323
|
+
readonly flag: "--state-dir";
|
|
4324
|
+
}, {
|
|
4325
|
+
readonly key: "dataDir";
|
|
4326
|
+
readonly option: "data-dir";
|
|
4327
|
+
readonly flag: "--data-dir";
|
|
4328
|
+
}, {
|
|
4329
|
+
readonly key: "secretsDir";
|
|
4330
|
+
readonly option: "secrets-dir";
|
|
4331
|
+
readonly flag: "--secrets-dir";
|
|
4332
|
+
}, {
|
|
4333
|
+
readonly key: "downloadsDir";
|
|
4334
|
+
readonly option: "downloads-dir";
|
|
4335
|
+
readonly flag: "--downloads-dir";
|
|
4336
|
+
}];
|
|
4337
|
+
type PathName = (typeof PATH_OPTIONS)[number]["key"];
|
|
4338
|
+
type PathOverrides = Partial<Record<PathName, string>>;
|
|
4339
|
+
interface ResolvedPaths {
|
|
4340
|
+
/** config.json and everything a user edits. */
|
|
4341
|
+
configDir: string;
|
|
4342
|
+
/** Approvals, pending OAuth flows, audit log, rate-cap counters, taint set. */
|
|
4343
|
+
stateDir: string;
|
|
4344
|
+
/** The file secret store: refresh tokens, client secrets, the approval key. */
|
|
4345
|
+
secretsDir: string;
|
|
4346
|
+
/** Managed runtime installs for MCP clients. */
|
|
4347
|
+
dataDir: string;
|
|
4348
|
+
/**
|
|
4349
|
+
* Default root for exports and for the files Resend's received mail carries. A Gmail attachment or a Slack file is
|
|
4350
|
+
* not saved here: those downloads ask the person where to save (`save-destination.ts`).
|
|
4351
|
+
*/
|
|
4352
|
+
downloadsDir: string;
|
|
4353
|
+
}
|
|
4354
|
+
//#endregion
|
|
4355
|
+
//#region src/cli-command.d.ts
|
|
4356
|
+
/**
|
|
4357
|
+
* The command a person is told to run for one of this suite's own CLIs (design 2026-10-04, D1 and D5; CUE-403).
|
|
4358
|
+
*
|
|
4359
|
+
* A bare `agent-gmail approve …` is not runnable for most of the people it is printed for: a package run by npx, by a
|
|
4360
|
+
* managed runtime or from a checkout puts nothing on their PATH. So every such command names this process's Node and
|
|
4361
|
+
* a checked file of the product it runs, with the suite directories it uses pinned as options — and when no file can
|
|
4362
|
+
* be checked, there is no command at all, only a sentence saying what is missing. The caller says which package it is
|
|
4363
|
+
* and what to run; it never supplies the program or quotes the line.
|
|
4364
|
+
*
|
|
4365
|
+
* Three directions. A product's own CLI is found from the product itself, walking from one of its own modules to its
|
|
4366
|
+
* manifest: no registration is ever asked. A channel's handoff to core is found the way the channel itself finds core,
|
|
4367
|
+
* through its installed dependency, and only the same release. Another product's command is found among the servers
|
|
4368
|
+
* registered with the person's MCP clients, which the caller scanned and passes in: only a file-backed registration of
|
|
4369
|
+
* exactly the printing package's version, checked on disk. Nothing a registration names is run, or asked anything —
|
|
4370
|
+
* not even its interpreter for a version: no installer wrote down where a scanned entry came from, so none is trusted
|
|
4371
|
+
* to run (D1). This module never scans, spawns or probes.
|
|
4372
|
+
*
|
|
4373
|
+
* What is checked is checked when the command is printed, not for ever (D6): the file it names is real, readable and
|
|
4374
|
+
* inside its package then, and a later change to that installation is a later fact.
|
|
4375
|
+
*/
|
|
4376
|
+
/** The gate a constructor call has to pass: only this module holds it. */
|
|
4377
|
+
declare const GATE$1: unique symbol;
|
|
4378
|
+
/**
|
|
4379
|
+
* A command that runs one of this suite's own CLIs, made only by `locateCliCommand`. Rendered as every printed command
|
|
4380
|
+
* is — a line to paste, or on Windows its words as JSON when no line is safe in every shell (`inlineCommand`,
|
|
4381
|
+
* `commandText`).
|
|
4382
|
+
*
|
|
4383
|
+
* A class with a private field, so the type is nominal: an object literal with the same fields is not one, and nor is
|
|
4384
|
+
* a spread copy of one with other words in it, as it would be with a symbol-keyed brand. Only the type is exported;
|
|
4385
|
+
* the class and its gate are not.
|
|
4386
|
+
*/
|
|
4387
|
+
declare class PrintedCommand {
|
|
4388
|
+
#private;
|
|
4389
|
+
/** The words, as the program is to receive them: this Node, its flags, the entry, then the CLI's own words. */
|
|
4390
|
+
readonly words: readonly string[];
|
|
4391
|
+
/** The line to paste; null when one of the words has no printing that every Windows shell passes on alike. */
|
|
4392
|
+
readonly line: string | null;
|
|
4393
|
+
readonly platform: NodeJS.Platform;
|
|
4394
|
+
constructor(gate: typeof GATE$1, words: readonly string[], platform: NodeJS.Platform, entry: string);
|
|
4395
|
+
/**
|
|
4396
|
+
* The real path of the file it runs, as it was checked when the command was located: a fact about then (D6). The
|
|
4397
|
+
* command names this path and nothing else, so what runs is whatever is there when the person runs it.
|
|
4398
|
+
*/
|
|
4399
|
+
get entry(): string;
|
|
4400
|
+
/**
|
|
4401
|
+
* As JSON — a result's field written out by `--json`, or returned to an MCP client — it is the text it always was:
|
|
4402
|
+
* its line, or its words as JSON with what to do when no Windows line is safe (`commandText`). Rendered where it
|
|
4403
|
+
* leaves the process, so a field can hold the command itself and the wire stays the same.
|
|
4404
|
+
*/
|
|
4405
|
+
toJSON(): string;
|
|
4406
|
+
/** Never interpolated: a sentence gives a command through `handoffSentence`, a value through `handoffText`. */
|
|
4407
|
+
[Symbol.toPrimitive](): never;
|
|
4408
|
+
}
|
|
4409
|
+
/** The package asking: a module of its own (`import.meta.url`), and the package that module is expected to be in. */
|
|
4410
|
+
interface CliCommandCaller {
|
|
4411
|
+
readonly url: string;
|
|
4412
|
+
readonly packageName: string;
|
|
4413
|
+
}
|
|
4414
|
+
/** Why there is no command: the step that found nothing it could check. */
|
|
4415
|
+
type CliNotLocatedReason = "caller" | "manifest" | "core" | "version" | "engine" | "bin" | "entry" | "interpreter" | "arguments" | "direction" | "no-registrations" | "not-registered";
|
|
4416
|
+
/** Why one registration of the product was not used. */
|
|
4417
|
+
type RegistrationRejection = "npx" | "arguments" | "no-file" | "no-package" | "version" | "engine" | "bin" | "entry";
|
|
4418
|
+
interface RegistrationNotUsed {
|
|
4419
|
+
readonly client: string;
|
|
4420
|
+
readonly path: string;
|
|
4421
|
+
readonly name: string;
|
|
4422
|
+
readonly why: RegistrationRejection;
|
|
4423
|
+
}
|
|
4424
|
+
/**
|
|
4425
|
+
* No command: nothing to run, and a sentence naming the product, its package and the exact version it needs. An
|
|
4426
|
+
* installation that has gone or changed since is said so, never replaced by a suite command found by name on PATH.
|
|
4427
|
+
*/
|
|
4428
|
+
interface CliCommandNotLocated {
|
|
4429
|
+
readonly ok: false;
|
|
4430
|
+
readonly reason: CliNotLocatedReason;
|
|
4431
|
+
/** How the product is named to a person: `Gmail`. */
|
|
4432
|
+
readonly product: string;
|
|
4433
|
+
readonly package: string;
|
|
4434
|
+
/** The exact version needed: the printing package's own, since the suite is released together. */
|
|
4435
|
+
readonly version: string;
|
|
4436
|
+
/** For `engine`: the Node range the target declares. */
|
|
4437
|
+
readonly nodeRange?: string | undefined;
|
|
4438
|
+
/** For another product: each registration of it that was looked at, and why it was not used. */
|
|
4439
|
+
readonly registrations?: readonly RegistrationNotUsed[] | undefined;
|
|
4440
|
+
/** What was found, in a clause. */
|
|
4441
|
+
readonly detail: string;
|
|
4442
|
+
/** The whole sentence to show. */
|
|
4443
|
+
readonly message: string;
|
|
4444
|
+
}
|
|
4445
|
+
//#endregion
|
|
4446
|
+
//#region src/handoff-text.d.ts
|
|
4447
|
+
/**
|
|
4448
|
+
* A handoff as words a person reads, and what a core function that prints one is given (CUE-403; CONTRIBUTING.md,
|
|
4449
|
+
* "Telling a person what to run"). `handoffs.ts` makes located handoffs and re-exports all of this.
|
|
4450
|
+
*
|
|
4451
|
+
* Kept apart from the locator on purpose: the configuration store, the secret stores and the attachment jail print
|
|
4452
|
+
* handoffs too, and the locator's own imports reach the configuration store, so importing it from them would be a
|
|
4453
|
+
* cycle. Nothing here locates anything or imports a module that does: a located command is made by `handoffs.ts` and
|
|
4454
|
+
* handed in, and what is here only renders one. With none handed in, there is nothing to render: a package that did not
|
|
4455
|
+
* give core its caller and is asked for a command has a programming error, not a bare name to fall back on.
|
|
4456
|
+
*/
|
|
4457
|
+
/** A command for a person to run, located, or the sentence saying why there is none here. */
|
|
4458
|
+
type Handoff = PrintedCommand | CliCommandNotLocated;
|
|
4459
|
+
interface HandoffUse {
|
|
4460
|
+
/** The suite folders the command reads or writes; the four every command opens when left out. */
|
|
4461
|
+
readonly uses?: readonly PathName[] | undefined;
|
|
4462
|
+
/** It also reads or writes downloads, so the downloads folder is pinned too. */
|
|
4463
|
+
readonly downloads?: boolean | undefined;
|
|
4464
|
+
}
|
|
4465
|
+
/**
|
|
4466
|
+
* The commands a package tells a person to run, made once per printing process from its caller (`handoffs.ts`,
|
|
4467
|
+
* `cliHandoffs`): `openCore({ caller })` puts them on `core.handoffs`. Each method takes the CLI's own words, never the
|
|
4468
|
+
* program, and returns a `Handoff`.
|
|
4469
|
+
*/
|
|
4470
|
+
interface CliHandoffs {
|
|
4471
|
+
/** The printing package: one of its own modules and its name. */
|
|
4472
|
+
readonly caller: CliCommandCaller;
|
|
4473
|
+
/** The shell the commands are quoted for. */
|
|
4474
|
+
readonly platform: NodeJS.Platform;
|
|
4475
|
+
/** The printing package's own CLI, with these words after the program. */
|
|
4476
|
+
own(words: readonly string[], use?: HandoffUse): Handoff;
|
|
4477
|
+
/** The core CLI: the printing package's own when that is core, the core it has installed otherwise. */
|
|
4478
|
+
core(words: readonly string[], use?: HandoffUse): Handoff;
|
|
4479
|
+
/** The CLI of `channel` — `core`, `gmail`, `slack` …: own, core, or another product found among its registrations. */
|
|
4480
|
+
of(channel: string, words: readonly string[], use?: HandoffUse): Handoff;
|
|
4481
|
+
/** The same commands, quoted for another shell. */
|
|
4482
|
+
on(platform: NodeJS.Platform): CliHandoffs;
|
|
4483
|
+
/**
|
|
4484
|
+
* The same, able to find another product: with the servers registered with this machine's MCP clients read now, from
|
|
4485
|
+
* the environment these were made with. Read once per call; nothing a registration names is run.
|
|
4486
|
+
*/
|
|
4487
|
+
registered(): Promise<CliHandoffs>;
|
|
4488
|
+
/** The same, finding another product among these registrations: a scan the caller has already read. */
|
|
4489
|
+
withRegistrations(registrations: readonly RegisteredServer[]): CliHandoffs;
|
|
4490
|
+
}
|
|
4491
|
+
type SendPolicy = "chat" | "confirm" | "never";
|
|
4492
|
+
/**
|
|
4493
|
+
* How a loosening of the configuration is approved: `chat` — the person says yes in the conversation and the agent
|
|
4494
|
+
* claims the approval — or `confirm` — the person types a code at a terminal, as for a send under `confirm`.
|
|
4495
|
+
*
|
|
4496
|
+
* There is no `never`. A setting the software refused ever to loosen would leave editing the file by hand as the only
|
|
4497
|
+
* way to change it, and that passes no gate at all.
|
|
4498
|
+
*/
|
|
4499
|
+
type ChangePolicy = "chat" | "confirm";
|
|
4500
|
+
/** Whether this machine checks for a newer release once a day, and stops until it is updated or put off. */
|
|
4501
|
+
type UpdateCheckSetting = "on" | "off";
|
|
4502
|
+
type StoreKind = "keychain" | "file";
|
|
4503
|
+
interface ClientConfig {
|
|
4504
|
+
provider: string;
|
|
4505
|
+
clientId: string;
|
|
4506
|
+
projectId?: string | undefined;
|
|
4507
|
+
secretRef: string;
|
|
4508
|
+
addedAt: string;
|
|
4509
|
+
/**
|
|
4510
|
+
* The organisation profile that made this row and owns it (design 2026-10-02 §D4) — absent on a row a person
|
|
4511
|
+
* registered, or one a profile adopted. A row carrying it is the profile's to change: `org update` and `org remove`
|
|
4512
|
+
* change it, and `client add --replace` and `client remove` refuse it while its organisation has a record.
|
|
4513
|
+
*
|
|
4514
|
+
* Additive: client rows are loose, so a release that does not know the key keeps it through its writes.
|
|
4515
|
+
*/
|
|
4516
|
+
organisation?: string | undefined;
|
|
4517
|
+
}
|
|
4518
|
+
interface InboxConfig {
|
|
4519
|
+
/** Immutable id (`ibx_` + 16 base32 characters). Secrets and all state are keyed by it; the alias is a label. */
|
|
4520
|
+
id: string;
|
|
4521
|
+
provider: string;
|
|
4522
|
+
email: string;
|
|
4523
|
+
/** Stable account id (OIDC `sub`). Absent for inboxes imported from tools that never asked for it. */
|
|
4524
|
+
sub?: string | undefined;
|
|
4525
|
+
identity: "oidc" | "legacy";
|
|
4526
|
+
client: string;
|
|
4527
|
+
tier: string;
|
|
4528
|
+
contacts: boolean;
|
|
4529
|
+
grantedScopes: string[];
|
|
4530
|
+
secretRef: string;
|
|
4531
|
+
sendPolicy?: SendPolicy | undefined;
|
|
4532
|
+
/** Overrides `defaults.changePolicy` for changes to this inbox. */
|
|
4533
|
+
changePolicy?: ChangePolicy | undefined;
|
|
4534
|
+
internalDomains: string[];
|
|
4535
|
+
createdAt: string;
|
|
4536
|
+
}
|
|
4537
|
+
interface Defaults {
|
|
4538
|
+
sendPolicy: SendPolicy;
|
|
4539
|
+
/**
|
|
4540
|
+
* How a loosening is approved wherever an inbox or account does not say otherwise. Absent reads as `chat`.
|
|
4541
|
+
*
|
|
4542
|
+
* Absent rather than filled in by the schema, unlike `sendPolicy`. A config written before this setting existed
|
|
4543
|
+
* reads as `chat` from then on, and the release note says so; a default the schema supplied would be written into
|
|
4544
|
+
* the file by the next unrelated change, where it would look like a choice somebody made.
|
|
4545
|
+
*/
|
|
4546
|
+
changePolicy?: ChangePolicy | undefined;
|
|
4547
|
+
riskEscalation: boolean;
|
|
4548
|
+
sendCaps: {
|
|
4549
|
+
perHour: number;
|
|
4550
|
+
perDay: number;
|
|
4551
|
+
};
|
|
4552
|
+
attachRoots: string[];
|
|
4553
|
+
/** Extra deny entries on top of the built-in list. */
|
|
4554
|
+
attachDeny: string[];
|
|
4555
|
+
downloadsDir?: string | undefined;
|
|
4556
|
+
timezone: string;
|
|
4557
|
+
confirm: {
|
|
4558
|
+
/**
|
|
4559
|
+
* Fail-closed allowlist of MCP `clientInfo.name` values whose form elicitation is trusted to reach a human.
|
|
4560
|
+
* Empty by default; only the CLI adds entries, after a probe.
|
|
4561
|
+
*/
|
|
4562
|
+
elicitationClients: string[];
|
|
4563
|
+
};
|
|
4564
|
+
/**
|
|
4565
|
+
* The daily update check (design 2026-09-28): once a day this machine asks npm whether a newer release is out, and
|
|
4566
|
+
* every server and command stops until it is updated or put off until tomorrow. Absent reads as `on`.
|
|
4567
|
+
*
|
|
4568
|
+
* Absent rather than filled in, as `changePolicy` is: a default the schema supplied would be written into the file
|
|
4569
|
+
* by the next unrelated change, where it would look like a choice somebody made. Turning it off is a loosening —
|
|
4570
|
+
* it is what keeps a machine from quietly falling behind a release — so it is approved like one; on applies at once.
|
|
4571
|
+
*/
|
|
4572
|
+
updateCheck?: UpdateCheckSetting | undefined;
|
|
5045
4573
|
}
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
4574
|
+
/**
|
|
4575
|
+
* A connected account on a platform that is not mail: a Slack workspace, and every channel after it (design
|
|
4576
|
+
* 2026-09-26) — one generic record, whatever the platform.
|
|
4577
|
+
*
|
|
4578
|
+
* `id`, `platform`, `workspace` (the container: a Slack team, a Resend team, a WhatsApp store), `userId` (who it acts
|
|
4579
|
+
* as), `tier`, `mode`, `grantedScopes`, `secretRef`, the two policies and `createdAt` are every channel's. A channel
|
|
4580
|
+
* may keep keys of its own beside them — Slack's `appId`, `redirectPort` — and they are kept through every write. It
|
|
4581
|
+
* may not add a safety setting: only `sendPolicy`, `changePolicy` and `mode` are judged by `classifyChange`, so a key
|
|
4582
|
+
* of a channel's own that loosened something would loosen it unasked.
|
|
4583
|
+
*
|
|
4584
|
+
* `secretRef` stays required, although the 2026-09-26 contract made it optional for a channel with no credential:
|
|
4585
|
+
* every earlier release requires it, and they share this file — an account without one would make the whole
|
|
4586
|
+
* configuration unreadable to a server started last week. Such a channel records a reference that names no secret,
|
|
4587
|
+
* `<platform>:none:<id>`, until a config version can say otherwise.
|
|
4588
|
+
*
|
|
4589
|
+
* It sits beside `inboxes` rather than replacing it. The spec asked for one `accounts` map holding everything, and
|
|
4590
|
+
* that rename is the one change this file cannot take: `version: 1` is additive precisely because an MCP server
|
|
4591
|
+
* started last week and a CLI run today share the file, and a release that moved every mailbox out of `inboxes`
|
|
4592
|
+
* would read, to the older of the two, as a config with no mailboxes in it. What the rename was for — one list of
|
|
4593
|
+
* everything connected, whatever the platform — is a question about the shape of the answer, not the shape of the
|
|
4594
|
+
* file, so `connectedAccounts()` provides it and the file grows one key.
|
|
4595
|
+
*/
|
|
4596
|
+
interface AccountConfig {
|
|
4597
|
+
id: string;
|
|
4598
|
+
/** `slack`. */
|
|
4599
|
+
platform: string;
|
|
4600
|
+
/** The workspace or team id. Every other id this account sees is only meaningful inside it. */
|
|
4601
|
+
workspace: string;
|
|
4602
|
+
/** "Acme Corp" — shown to people, never matched on: a workspace can be renamed and stays the same workspace. */
|
|
4603
|
+
workspaceName?: string | undefined;
|
|
4604
|
+
/** This account's own user id in that workspace, so its own messages can be told from everyone else's. */
|
|
4605
|
+
userId: string;
|
|
4606
|
+
tier: string;
|
|
4607
|
+
grantedScopes: string[];
|
|
4608
|
+
/** Where its credential is in the secret store, `<platform>:…` — for a channel that stores none, `<platform>:none:<id>`. */
|
|
4609
|
+
secretRef: string;
|
|
4610
|
+
sendPolicy?: SendPolicy | undefined;
|
|
4611
|
+
/** Overrides `defaults.changePolicy` for changes to this account. */
|
|
4612
|
+
changePolicy?: ChangePolicy | undefined;
|
|
4613
|
+
createdAt: string;
|
|
4614
|
+
/**
|
|
4615
|
+
* The OAuth client this account's token was issued by, and the app it belongs to.
|
|
4616
|
+
*
|
|
4617
|
+
* Recorded because the Gmail release found the opposite: a reauth used the first OAuth client in the config
|
|
4618
|
+
* rather than the inbox's own, and then did not record which one it had used. Slack makes that worse — D8
|
|
4619
|
+
* means **one app per workspace**, so "the first app" is wrong more often than it is right — and a reauth
|
|
4620
|
+
* that silently moves an account onto a different app changes what it can do without saying so.
|
|
4621
|
+
*
|
|
4622
|
+
* Optional because the key is additive: a config written before these existed parses unchanged.
|
|
4623
|
+
*/
|
|
4624
|
+
oauthClientId?: string | undefined;
|
|
4625
|
+
appId?: string | undefined;
|
|
4626
|
+
/**
|
|
4627
|
+
* `read` or `send`, as installed.
|
|
4628
|
+
*
|
|
4629
|
+
* Kept beside `grantedScopes` rather than derived from them, because the two answer different questions: the
|
|
4630
|
+
* scopes are what Slack granted, and this is what the person asked for. A disagreement between them is drift
|
|
4631
|
+
* worth reporting, and a value derived from the scopes could never disagree.
|
|
4632
|
+
*/
|
|
4633
|
+
mode?: string | undefined;
|
|
4634
|
+
/**
|
|
4635
|
+
* The loopback port the last sign-in used, which is the one in the app's redirect URL.
|
|
4636
|
+
*
|
|
4637
|
+
* Slack matches redirect URLs exactly, so every later sign-in and every set of steps that edits the app has to
|
|
4638
|
+
* name this number. Without it the steps said `<port>`, or — from the MCP server — guessed 51234, and a person who
|
|
4639
|
+
* had chosen another port followed them to a sign-in that failed on the way back.
|
|
4640
|
+
*/
|
|
4641
|
+
redirectPort?: number | undefined;
|
|
4642
|
+
/** The organisation profile whose Slack app created this account. Absent for a person's own app. */
|
|
4643
|
+
organisation?: string | undefined;
|
|
4644
|
+
/** Which app in that profile issued the account's current credential. */
|
|
4645
|
+
profileApp?: "read" | "send" | undefined;
|
|
5054
4646
|
}
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
keyType: Key;
|
|
5062
|
-
valueType: Value;
|
|
5063
|
-
min(minSize: number, params?: string | $ZodCheckMinSizeParams): this;
|
|
5064
|
-
nonempty(params?: string | $ZodCheckMinSizeParams): this;
|
|
5065
|
-
max(maxSize: number, params?: string | $ZodCheckMaxSizeParams): this;
|
|
5066
|
-
size(size: number, params?: string | $ZodCheckSizeEqualsParams): this;
|
|
4647
|
+
type PendingRevocationStatus = "pending" | "revoked" | "expired";
|
|
4648
|
+
/** One bearer token in a superseded rotating bundle, tracked independently from its pair. */
|
|
4649
|
+
interface PendingRevocationTokenState {
|
|
4650
|
+
status: PendingRevocationStatus;
|
|
4651
|
+
/** The fixed absolute time after which the old token is known to be unusable. */
|
|
4652
|
+
deadline: string;
|
|
5067
4653
|
}
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
4654
|
+
/**
|
|
4655
|
+
* A superseded credential kept until each token in it is conclusively revoked or expired.
|
|
4656
|
+
*
|
|
4657
|
+
* `store` belongs to the entry rather than being inferred from `secrets.store`: an older release can move the root
|
|
4658
|
+
* store without knowing to move this bundle, and cleanup must still find the only copy that exists.
|
|
4659
|
+
*/
|
|
4660
|
+
interface PendingRevocation {
|
|
4661
|
+
ref: string;
|
|
4662
|
+
store: StoreKind;
|
|
4663
|
+
platform: string;
|
|
4664
|
+
workspace: string;
|
|
4665
|
+
createdAt: string;
|
|
4666
|
+
tokens: {
|
|
4667
|
+
access: PendingRevocationTokenState;
|
|
4668
|
+
refresh?: PendingRevocationTokenState | undefined;
|
|
4669
|
+
};
|
|
5076
4670
|
}
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
4671
|
+
interface ConfigBody {
|
|
4672
|
+
/**
|
|
4673
|
+
* The one secret backend for this config directory: client secrets, refresh tokens and the approval key. Absent
|
|
4674
|
+
* until the first command that stores a secret chooses it.
|
|
4675
|
+
*/
|
|
4676
|
+
secrets?: {
|
|
4677
|
+
store: StoreKind;
|
|
4678
|
+
} | undefined;
|
|
4679
|
+
clients: Record<string, ClientConfig>;
|
|
4680
|
+
inboxes: Record<string, InboxConfig>;
|
|
4681
|
+
/** Non-mail accounts. Absent in every config written before this key existed, hence the default. */
|
|
4682
|
+
accounts: Record<string, AccountConfig>;
|
|
4683
|
+
/** Superseded rotating credentials which still need conclusive per-token cleanup. */
|
|
4684
|
+
pendingRevocations?: PendingRevocation[] | undefined;
|
|
4685
|
+
defaults: Defaults;
|
|
4686
|
+
}
|
|
4687
|
+
interface ConfigV1 extends ConfigBody {
|
|
4688
|
+
version: 1;
|
|
4689
|
+
}
|
|
4690
|
+
/** A name an account used to have, and the account that had it. */
|
|
4691
|
+
interface FormerName {
|
|
4692
|
+
/** What it was renamed to — at the time. The account's current name is found by `id`, so a later rename is followed. */
|
|
4693
|
+
name: string;
|
|
4694
|
+
id: string;
|
|
5087
4695
|
}
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
declare function _enum<const T extends EnumLike>(entries: T, params?: string | $ZodEnumParams): ZodEnum<T>;
|
|
5091
|
-
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
4696
|
+
/**
|
|
4697
|
+
* Names that were replaced, per kind, and never reusable.
|
|
5092
4698
|
*
|
|
5093
|
-
*
|
|
5094
|
-
*
|
|
5095
|
-
* z.enum(Colors);
|
|
5096
|
-
* ```
|
|
4699
|
+
* Per kind because version 1 lets a mailbox and a workspace share a word: `work` the mailbox and `work` the workspace
|
|
4700
|
+
* become `work/gmail` and `work/slack`, and one flat record could not say which old `work` is which.
|
|
5097
4701
|
*/
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
values: Set<T>;
|
|
5102
|
-
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
5103
|
-
value: T;
|
|
4702
|
+
interface FormerNames {
|
|
4703
|
+
inboxes: Record<string, FormerName>;
|
|
4704
|
+
accounts: Record<string, FormerName>;
|
|
5104
4705
|
}
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
4706
|
+
/** Who an organisation's Google client is for, as its administrator states it (design 2026-10-02 §D2). */
|
|
4707
|
+
type OrganisationServes = "any" | {
|
|
4708
|
+
domains: string[];
|
|
4709
|
+
};
|
|
4710
|
+
/**
|
|
4711
|
+
* One Google client an organisation profile brought here: a *generation* (design 2026-10-02 §D4).
|
|
4712
|
+
*
|
|
4713
|
+
* `owned` — the profile made the client row `name` (`rgc-1`), which carries `organisation`, and its secret is the
|
|
4714
|
+
* profile's to rewrite. `adopted` — the row was already here under a name a person chose (they ran `client add` with
|
|
4715
|
+
* the organisation's file), and stays theirs: no `org` command changes or removes it. `serves` is per generation,
|
|
4716
|
+
* because it is a fact about one client, not about the organisation.
|
|
4717
|
+
*/
|
|
4718
|
+
interface OrganisationGeneration {
|
|
4719
|
+
name: string;
|
|
4720
|
+
clientId: string;
|
|
4721
|
+
projectId?: string | undefined;
|
|
4722
|
+
ownership: "owned" | "adopted";
|
|
4723
|
+
serves: OrganisationServes;
|
|
4724
|
+
addedAt: string;
|
|
5113
4725
|
}
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
4726
|
+
interface OrganisationSlackApp {
|
|
4727
|
+
clientId: string;
|
|
4728
|
+
appId?: string | undefined;
|
|
5118
4729
|
}
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
4730
|
+
/**
|
|
4731
|
+
* What this machine records of one organisation profile: never its bytes and never its secret — where it was read
|
|
4732
|
+
* from, the SHA-256 of what was read and when, the generations of its Google client, and its Slack apps.
|
|
4733
|
+
*/
|
|
4734
|
+
interface OrganisationRecord {
|
|
4735
|
+
label: string;
|
|
4736
|
+
/** Read again, from this absolute path, by every `org update`. `file` is the one kind version 1 knows (§D3). */
|
|
4737
|
+
source: {
|
|
4738
|
+
kind: string;
|
|
4739
|
+
path: string;
|
|
4740
|
+
};
|
|
4741
|
+
sha256: string;
|
|
4742
|
+
readAt: string;
|
|
4743
|
+
addedAt: string;
|
|
4744
|
+
/** Whether the member asked for this organisation's client to serve addresses outside it too (§D6). */
|
|
4745
|
+
forOtherAddresses: boolean;
|
|
4746
|
+
/** `active` names the generation new mailboxes get — none once a profile stops naming a Google client. */
|
|
4747
|
+
gmail?: {
|
|
4748
|
+
active: string | null;
|
|
4749
|
+
generations: OrganisationGeneration[];
|
|
4750
|
+
} | undefined;
|
|
4751
|
+
slack?: {
|
|
4752
|
+
workspace: string;
|
|
4753
|
+
workspaceName: string;
|
|
4754
|
+
redirectPort: number;
|
|
4755
|
+
apps: {
|
|
4756
|
+
read?: OrganisationSlackApp | undefined;
|
|
4757
|
+
send?: OrganisationSlackApp | undefined;
|
|
4758
|
+
};
|
|
4759
|
+
} | undefined;
|
|
5124
4760
|
}
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
4761
|
+
interface ConfigV2 extends ConfigBody {
|
|
4762
|
+
version: 2;
|
|
4763
|
+
formerNames: FormerNames;
|
|
4764
|
+
/**
|
|
4765
|
+
* The organisation profiles added here, by organisation word (design 2026-10-02 §D4). Absent reads as none, and
|
|
4766
|
+
* stays absent until the first `org add`: a key the schema filled in would be written into every file by the next
|
|
4767
|
+
* unrelated change.
|
|
4768
|
+
*/
|
|
4769
|
+
organisations?: Record<string, OrganisationRecord> | undefined;
|
|
5130
4770
|
}
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
4771
|
+
type Config$1 = ConfigV1 | ConfigV2;
|
|
4772
|
+
/** The committed config returned by an update; process-only commit metadata is deliberately stored out of band. */
|
|
4773
|
+
type ConfigUpdateResult = Config$1;
|
|
4774
|
+
declare class ConfigStore {
|
|
4775
|
+
#private;
|
|
4776
|
+
readonly path: string;
|
|
4777
|
+
/**
|
|
4778
|
+
* @param options.handoffs the printing package's handoffs (`core.handoffs`, CUE-403), for the command a refusal
|
|
4779
|
+
* names; left out, a refusal that has to name one is a programming error (`requiredHandoffs`).
|
|
4780
|
+
*/
|
|
4781
|
+
constructor(configDir: string, options?: {
|
|
4782
|
+
readonly handoffs?: CliHandoffs | undefined;
|
|
4783
|
+
});
|
|
4784
|
+
/** The current config; an empty one when the file does not exist yet. */
|
|
4785
|
+
load(): Promise<Config$1>;
|
|
4786
|
+
/**
|
|
4787
|
+
* Read-modify-write under a lock, so a CLI command and a running MCP server never lose each other's changes. The
|
|
4788
|
+
* mutator receives a fresh copy read inside the lock and returns the new config, which is validated before writing.
|
|
4789
|
+
*/
|
|
4790
|
+
update(mutator: (config: Config$1) => Config$1 | Promise<Config$1>, options?: {
|
|
4791
|
+
consent?: LooseningConsent;
|
|
4792
|
+
signal?: AbortSignal | undefined;
|
|
4793
|
+
}): Promise<ConfigUpdateResult>;
|
|
4794
|
+
/**
|
|
4795
|
+
* The one way a version-1 config becomes version 2.
|
|
4796
|
+
*
|
|
4797
|
+
* Under the credentials lock and then the config lock — the order everything takes them in — so it cannot land
|
|
4798
|
+
* between a removal's read and its write, or in the middle of moving secrets between backends.
|
|
4799
|
+
*
|
|
4800
|
+
* `expected` is the fingerprint of the config the caller previewed. The file is read again inside the locks, and
|
|
4801
|
+
* if it is not that config any more the whole thing is refused: somebody confirmed a mapping computed from
|
|
4802
|
+
* something else. Nothing waits for a person while holding a lock; the preview happens before this is called.
|
|
4803
|
+
*
|
|
4804
|
+
* `build` produces version 2 from the locked snapshot. What it may change is checked rather than trusted: the same
|
|
4805
|
+
* accounts, byte for byte, under new keys — a rename grants nothing, so a build that changed anything else is a
|
|
4806
|
+
* bug and is refused before it is written.
|
|
4807
|
+
*
|
|
4808
|
+
* Idempotent, but only for this plan. A retry after a write that committed — even one whose lock release then
|
|
4809
|
+
* failed — finds version 2, recognises its own mapping in it, and says so. Version 2 that does *not* carry this
|
|
4810
|
+
* mapping is somebody else's migration; saying "already migrated" there would report a mapping nobody applied,
|
|
4811
|
+
* and a caller updating registrations from it would point them at names that do not exist.
|
|
4812
|
+
*
|
|
4813
|
+
* `rows` is the plan, and the question is asked of the mapping rather than of the whole file: between a
|
|
4814
|
+
* committed write and its retry, something else may have changed a policy or a timezone, and a retry refused
|
|
4815
|
+
* over that would be idempotency in name only. The rows are checked here rather than by whoever built them,
|
|
4816
|
+
* for the same reason `build` is: a caller that could answer its own question could answer it wrongly.
|
|
4817
|
+
*
|
|
4818
|
+
* The file it replaces is copied beside it first — see `backUpBeforeMigration` — and the copy's path returned.
|
|
4819
|
+
*/
|
|
4820
|
+
migrateNames(expected: string, rows: readonly RenamedAccount[], build: (current: ConfigV1) => ConfigV2): Promise<{
|
|
4821
|
+
status: "migrated" | "already-migrated";
|
|
4822
|
+
config: ConfigV2;
|
|
4823
|
+
backup?: string;
|
|
4824
|
+
}>;
|
|
5136
4825
|
}
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
/** @deprecated Use `.unwrap()` instead. */
|
|
5144
|
-
removeDefault(): T;
|
|
4826
|
+
/** One account's rename, as the migration planned it. */
|
|
4827
|
+
interface RenamedAccount {
|
|
4828
|
+
readonly kind: "inbox" | "account";
|
|
4829
|
+
readonly from: string;
|
|
4830
|
+
readonly to: string;
|
|
4831
|
+
readonly id: string;
|
|
5145
4832
|
}
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
4833
|
+
/** A value a loosened setting had or will have: a policy, a mode, a list, a pair of caps, a path, or nothing. */
|
|
4834
|
+
type SettingValue = string | number | boolean | readonly string[] | {
|
|
4835
|
+
readonly [key: string]: unknown;
|
|
4836
|
+
} | null;
|
|
4837
|
+
/**
|
|
4838
|
+
* One loosened setting, with the values the classifier compared.
|
|
4839
|
+
*
|
|
4840
|
+
* The values are the ones it judged, not the raw fields: an inbox that inherits a looser default reports the policy
|
|
4841
|
+
* it inherits, and a new inbox reports the default it was measured against. A preview built from anything else could
|
|
4842
|
+
* show a person one change while the classifier judged another.
|
|
4843
|
+
*/
|
|
4844
|
+
interface Loosening {
|
|
4845
|
+
/** As `ConfigStore.update` names it in a refusal: `accounts.rgc/slack.mode`, `defaults.sendPolicy`. */
|
|
4846
|
+
readonly path: string;
|
|
4847
|
+
readonly before: SettingValue;
|
|
4848
|
+
readonly after: SettingValue;
|
|
4849
|
+
/**
|
|
4850
|
+
* The inbox or account measured on the before side, by id. Absent for one new in this change and for a setting
|
|
4851
|
+
* that belongs to the whole configuration. Carried so that an approval of this loosening cannot be spent on a
|
|
4852
|
+
* different account that took the same name in the meantime.
|
|
4853
|
+
*/
|
|
4854
|
+
readonly id?: string | undefined;
|
|
5151
4855
|
}
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
4856
|
+
/**
|
|
4857
|
+
* One setting a change writes, from the value in the file before to the value after — whichever way it moves.
|
|
4858
|
+
*
|
|
4859
|
+
* Unlike a `Loosening`, these are the raw values, not the effective ones: `null` for a setting the file does not
|
|
4860
|
+
* hold, so a mailbox set to `chat` itself is told apart from one inheriting `chat`, which only the first survives a
|
|
4861
|
+
* later change to the default. `id` is the inbox or account measured on the before side, as for a loosening.
|
|
4862
|
+
*/
|
|
4863
|
+
interface SettingChange {
|
|
4864
|
+
readonly path: string;
|
|
4865
|
+
readonly before: SettingValue;
|
|
4866
|
+
readonly after: SettingValue;
|
|
4867
|
+
readonly id?: string | undefined;
|
|
5157
4868
|
}
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
4869
|
+
/**
|
|
4870
|
+
* Proof that exactly these paths may loosen: produced by a CLI after a person at a terminal typed a challenge, or by
|
|
4871
|
+
* `claimChange` from a change approval a person gave.
|
|
4872
|
+
*/
|
|
4873
|
+
interface LooseningConsent {
|
|
4874
|
+
kind: "loosening-consent";
|
|
4875
|
+
paths: readonly string[];
|
|
4876
|
+
/**
|
|
4877
|
+
* What each path was approved to move between, when the consent came from a change approval.
|
|
4878
|
+
*
|
|
4879
|
+
* A terminal challenge is answered moments before the write it permits, so the paths are enough. An approval is
|
|
4880
|
+
* prepared first and applied later — after a sign-in, possibly minutes later — and in between the configuration
|
|
4881
|
+
* can move underneath it: the same path, loosened from a different value, or on a different account that took
|
|
4882
|
+
* the name. With these, `ConfigStore.update` refuses any loosening that is not exactly one of them.
|
|
4883
|
+
*/
|
|
4884
|
+
changes?: readonly Loosening[] | undefined;
|
|
5163
4885
|
}
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
4886
|
+
/**
|
|
4887
|
+
* Why a saved name has {@link DOWNLOAD_SUFFIX} after it: a name tools read or run on their own (`auto-read`), an
|
|
4888
|
+
* extension that is not one of the inert ones (`type`), or no extension at all (`no-extension`).
|
|
4889
|
+
*/
|
|
4890
|
+
type RenameReason = "auto-read" | "type" | "no-extension";
|
|
4891
|
+
//#endregion
|
|
4892
|
+
//#region src/approvals.d.ts
|
|
4893
|
+
/**
|
|
4894
|
+
* Approval records bind a send to exactly one draft version. States:
|
|
4895
|
+
*
|
|
4896
|
+
* pending ──approve──▶ approved ──claim──▶ sending ──▶ used | failed
|
|
4897
|
+
* └──claim (effective policy chat)──────┘ └──▶ unknown (the process died mid-send)
|
|
4898
|
+
* pending | approved ──▶ revoked ("voided": content changed, wrong inbox, too many wrong challenges, user revoked)
|
|
4899
|
+
* expired is derived: a pending or approved record past its deadline reads as expired.
|
|
4900
|
+
*
|
|
4901
|
+
* Every transition is a compare-and-swap under a per-record lock. Single use does not rest on the lock alone: a claim
|
|
4902
|
+
* also creates `<id>.claim` with O_EXCL, which the file system guarantees only one process can do.
|
|
4903
|
+
*
|
|
4904
|
+
* A change approval (`kind: 'change'`) lives in the same store and goes through the same states, except that its
|
|
4905
|
+
* claim goes straight to `used`: what it permits is a write to the configuration, which the claimant makes itself.
|
|
4906
|
+
*
|
|
4907
|
+
* So does a download's question (`kind: 'download'`): where to save the files a Gmail or Slack download names. It is
|
|
4908
|
+
* held to the change policy of the mailbox or workspace it is about, as every other change there is. Under `chat` the
|
|
4909
|
+
* person's answer, relayed from the chat, claims it straight from `pending`. Under `confirm` it has to be answered
|
|
4910
|
+
* where an agent cannot answer for them — at their own terminal, or in a form a trusted client shows them — which
|
|
4911
|
+
* records the answer and moves it to `approved`; only then is it claimed, straight to `used`, and the recorded answer
|
|
4912
|
+
* is the one that saves. It gets the store's expiry, its single use and its binding for the reason a change does: an
|
|
4913
|
+
* answer given for three invoices must not save the next conversation's files, nor be spent twice.
|
|
4914
|
+
*/
|
|
4915
|
+
type ApprovalState = "pending" | "approved" | "sending" | "used" | "failed" | "unknown" | "expired" | "revoked";
|
|
4916
|
+
type ApprovalChannel = "elicitation" | "terminal";
|
|
4917
|
+
/**
|
|
4918
|
+
* What an approval permits: a send (a mail, a post, a reaction), a change to the configuration, or a download saved
|
|
4919
|
+
* where the person said.
|
|
4920
|
+
*
|
|
4921
|
+
* One store for all three, so a change gets the machinery a send already has — expiry, single use, the typed code —
|
|
4922
|
+
* and a kind on every record, so that none can be spent as another. Without it, a person who approved a post at a
|
|
4923
|
+
* terminal would also have approved whatever change an agent claimed under the same id.
|
|
4924
|
+
*/
|
|
4925
|
+
type ApprovalKind = "send" | "change" | "download";
|
|
4926
|
+
/** The inbox or account a change is about. `id` is absent when the change connects it, and it does not exist yet. */
|
|
4927
|
+
interface ChangeTarget {
|
|
4928
|
+
kind: "inbox" | "account";
|
|
4929
|
+
name: string;
|
|
4930
|
+
id?: string | undefined;
|
|
5171
4931
|
}
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
4932
|
+
/**
|
|
4933
|
+
* Exactly what a change approval permits, stored on the record so a terminal can show it again and prove it is what
|
|
4934
|
+
* was prepared.
|
|
4935
|
+
*/
|
|
4936
|
+
interface ChangeBinding {
|
|
4937
|
+
/** The caller's one line about the change, shown to the person. Not part of the digest: the lines below are. */
|
|
4938
|
+
summary: string;
|
|
4939
|
+
/** What it is about, or `null` for a change to the whole configuration. */
|
|
4940
|
+
target: ChangeTarget | null;
|
|
4941
|
+
/** Every safety setting it loosens, with the values `classifyChange` compared. Empty for a destructive change. */
|
|
4942
|
+
loosened: Loosening[];
|
|
4943
|
+
/**
|
|
4944
|
+
* Every setting it writes, loosened or tightened, with the values in the file before and after (`changedSettings`).
|
|
4945
|
+
*
|
|
4946
|
+
* Bound as well as the loosenings, because a preview shows the whole change: a claim that loosened the same thing
|
|
4947
|
+
* while dropping a tightening the person read would otherwise digest the same. Absent reads as none.
|
|
4948
|
+
*/
|
|
4949
|
+
settings?: SettingChange[] | undefined;
|
|
4950
|
+
/** What it does outside the configuration, in words: a sign-in, a registration, files removed. */
|
|
4951
|
+
effects: string[];
|
|
4952
|
+
/**
|
|
4953
|
+
* What the call that prepared it already did at once, because it never waits for an approval — a narrowing beside
|
|
4954
|
+
* the change (design 2026-10-02 §D8). Not what approving does: the preview lists these apart, and its header says
|
|
4955
|
+
* the rest is what waits. A field of its own rather than words in `effects`, so no text a change carries — a label
|
|
4956
|
+
* a profile chose, say — can make a preview claim something was done.
|
|
4957
|
+
*
|
|
4958
|
+
* Bound when present, so a record cannot gain one it was not prepared with; absent reads as none, and leaves the
|
|
4959
|
+
* digest of every other change exactly what it was.
|
|
4960
|
+
*/
|
|
4961
|
+
doneAtOnce?: string[] | undefined;
|
|
5176
4962
|
}
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
4963
|
+
/**
|
|
4964
|
+
* Exactly which download a question was asked for, stored on the record so the answer can be held to it.
|
|
4965
|
+
*
|
|
4966
|
+
* The files are the ones the question listed, by the platform's own ids — `<message id>/<part id>` for Gmail, the file
|
|
4967
|
+
* id for Slack — in the order they were listed: a claim for any other set is a claim for a download the person was
|
|
4968
|
+
* not asked about. So are the names they would be saved under, in the same order: a Slack file renamed between the
|
|
4969
|
+
* question and the answer would otherwise be saved under a name the person was never shown. The folders are the two
|
|
4970
|
+
* the question showed, as absolute paths. They are not part of the digest, because they are what the answer *means*
|
|
4971
|
+
* rather than what it is for: `downloads` in the answer is the path the person read, even when an agent runs the
|
|
4972
|
+
* download again from another folder.
|
|
4973
|
+
*/
|
|
4974
|
+
interface DownloadBinding {
|
|
4975
|
+
/** One line about the download, for a listing: "where to save 2 files from acme/gmail". Not part of the digest. */
|
|
4976
|
+
summary: string;
|
|
4977
|
+
/** The mailbox or workspace the files come from, by the id it has now. */
|
|
4978
|
+
target: {
|
|
4979
|
+
kind: "inbox" | "account";
|
|
4980
|
+
name: string;
|
|
4981
|
+
id: string;
|
|
4982
|
+
};
|
|
4983
|
+
/** Which download asked: `attachments.download`, `files.download`. */
|
|
4984
|
+
operation: string;
|
|
4985
|
+
/** The request as the caller made it, in the words of its own arguments: the selection, and how many at most. */
|
|
4986
|
+
request: Record<string, unknown>;
|
|
4987
|
+
/** The files the question listed, by the platform's ids, in order. */
|
|
4988
|
+
files: string[];
|
|
4989
|
+
/** The names those files would be saved under, as the question listed them, in the same order. */
|
|
4990
|
+
names: string[];
|
|
4991
|
+
/** The two folders the question offered, as absolute paths. */
|
|
4992
|
+
folders: {
|
|
4993
|
+
downloads: string;
|
|
4994
|
+
current: string;
|
|
4995
|
+
};
|
|
4996
|
+
/**
|
|
4997
|
+
* The files as the question listed them to the person — the names they would be saved under, their sizes, why a
|
|
4998
|
+
* name has `.download` after it, and their risk flags — so a terminal or a form can show the question, and its
|
|
4999
|
+
* warnings, again. Not part of the digest: the ids and names above are.
|
|
5000
|
+
*/
|
|
5001
|
+
listing?: ListedFile[] | undefined;
|
|
5002
|
+
/** The person's answer, when they gave it where an agent cannot: at a terminal, or in a trusted client's form. */
|
|
5003
|
+
answer?: RecordedSaveAnswer | undefined;
|
|
5004
|
+
}
|
|
5005
|
+
/** One file as a question lists it. */
|
|
5006
|
+
interface ListedFile {
|
|
5007
|
+
/** The name it would be saved under: the sender's made safe, with `.download` after it unless it is inert. */
|
|
5008
|
+
name: string;
|
|
5009
|
+
size: number | null;
|
|
5010
|
+
/** Why `.download` is after its name; absent when the name is the sender's, made safe. */
|
|
5011
|
+
renamed?: RenameReason | undefined;
|
|
5012
|
+
/** Its risk flags, as the file's own listing gives them. */
|
|
5013
|
+
flags?: string[] | undefined;
|
|
5014
|
+
}
|
|
5015
|
+
/**
|
|
5016
|
+
* An answer recorded on a question: one of the two folders it offered, or the folder the person named, as an absolute
|
|
5017
|
+
* path — resolved where they typed it, so it means the folder they read.
|
|
5018
|
+
*/
|
|
5019
|
+
type RecordedSaveAnswer = {
|
|
5020
|
+
readonly choice: "downloads" | "current";
|
|
5021
|
+
} | {
|
|
5022
|
+
readonly choice: "other";
|
|
5023
|
+
readonly folder: string;
|
|
5024
|
+
};
|
|
5025
|
+
/** What a claim of a download's question is held to: all of the binding but its summary and the folders it offered. */
|
|
5026
|
+
type DownloadRequest = Pick<DownloadBinding, "target" | "operation" | "request" | "files" | "names">;
|
|
5027
|
+
interface Expectation {
|
|
5028
|
+
to: string[];
|
|
5029
|
+
cc: string[];
|
|
5030
|
+
bcc: string[];
|
|
5031
|
+
subject: string;
|
|
5032
|
+
}
|
|
5033
|
+
interface ApprovalRecord {
|
|
5034
|
+
approvalId: string;
|
|
5035
|
+
/** Absent on a send, so a send's record is byte for byte what it was before change approvals existed. */
|
|
5036
|
+
kind?: ApprovalKind | undefined;
|
|
5037
|
+
digestVersion: number;
|
|
5038
|
+
/** For a change: the id of the inbox or account it is about, or empty for one to the whole configuration. */
|
|
5039
|
+
inboxId: string;
|
|
5040
|
+
inboxSub?: string | undefined;
|
|
5041
|
+
draftId: string;
|
|
5042
|
+
/** Changes on every save of the draft; binding to it detects any edit, even one that restores identical content. */
|
|
5043
|
+
draftMessageId: string;
|
|
5044
|
+
digest: string;
|
|
5045
|
+
/** The digest the human was actually shown when approving through a confirm channel. */
|
|
5046
|
+
approvedDigest?: string | undefined;
|
|
5047
|
+
approvedVia?: ApprovalChannel | undefined;
|
|
5048
|
+
/** Live policy at prepare time, for display and audit. */
|
|
5049
|
+
policy: SendPolicy;
|
|
5050
|
+
/** `confirm` when risk escalation raised this send. The effective policy is the stricter of this and the live one. */
|
|
5051
|
+
requiredPolicy: SendPolicy;
|
|
5052
|
+
riskFlags: string[];
|
|
5053
|
+
expect: Expectation;
|
|
5054
|
+
/** Hash of the challenge currently issued to a human; the challenge itself is never stored or returned. */
|
|
5055
|
+
challengeHash?: string | undefined;
|
|
5056
|
+
challengeAttempts: number;
|
|
5057
|
+
state: ApprovalState;
|
|
5058
|
+
createdAt: string;
|
|
5059
|
+
expiresAt: string;
|
|
5060
|
+
updatedAt: string;
|
|
5061
|
+
sentMessageId?: string | undefined;
|
|
5062
|
+
reason?: string | undefined;
|
|
5063
|
+
/** For a change: exactly what it permits. `digest` is `changeDigest` of this. */
|
|
5064
|
+
change?: ChangeBinding | undefined;
|
|
5065
|
+
/** For a download's question: what it asked about, and the folders it offered. `digest` is `downloadDigest`. */
|
|
5066
|
+
download?: DownloadBinding | undefined;
|
|
5067
|
+
}
|
|
5068
|
+
interface CreateApprovalInput {
|
|
5069
|
+
inboxId: string;
|
|
5070
|
+
inboxSub?: string | undefined;
|
|
5071
|
+
draftId: string;
|
|
5072
|
+
draftMessageId: string;
|
|
5073
|
+
digest: string;
|
|
5074
|
+
policy: SendPolicy;
|
|
5075
|
+
requiredPolicy: SendPolicy;
|
|
5076
|
+
riskFlags: string[];
|
|
5077
|
+
expect: Expectation;
|
|
5078
|
+
}
|
|
5079
|
+
interface CreateChangeApprovalInput {
|
|
5080
|
+
change: ChangeBinding;
|
|
5081
|
+
/** The change policy in force before the change: it decides how the change is approved. */
|
|
5082
|
+
policy: ChangePolicy;
|
|
5083
|
+
}
|
|
5084
|
+
/** What a claimant of a change is about to write, and the change policy in force as it does. */
|
|
5085
|
+
interface LiveChange {
|
|
5086
|
+
change: ChangeBinding;
|
|
5087
|
+
policy: ChangePolicy;
|
|
5088
|
+
}
|
|
5089
|
+
/** What the caller observed in the live draft at the moment of a transition. */
|
|
5090
|
+
interface LiveDraft {
|
|
5091
|
+
draftMessageId: string;
|
|
5092
|
+
digest: string;
|
|
5093
|
+
}
|
|
5094
|
+
/** What the product making a claim tells the store about itself. */
|
|
5095
|
+
interface ClaimOptions {
|
|
5096
|
+
/** The shell syntax used by any approval command this refusal prints. */
|
|
5097
|
+
platform?: NodeJS.Platform | undefined;
|
|
5098
|
+
/**
|
|
5099
|
+
* The commands the printing package gives a person (`core.handoffs`), for a refusal that names one: the store's own
|
|
5100
|
+
* when left out. With neither, a refusal that has to name one is a programming error (`requiredHandoffs`).
|
|
5101
|
+
*/
|
|
5102
|
+
handoffs?: CliHandoffs | undefined;
|
|
5103
|
+
/**
|
|
5104
|
+
* What the caller is told when the send is waiting for a person: which command approves it, and what to run after.
|
|
5105
|
+
*
|
|
5106
|
+
* The product's to say, because the store is shared and the command that approves is not. The store used to say
|
|
5107
|
+
* it itself, in Gmail's words, so a Slack post held for approval told the agent to hand the person
|
|
5108
|
+
* `agent-gmail approve` — which cannot approve a Slack record — or to "send it from Gmail". Left out, the hint
|
|
5109
|
+
* names no product at all rather than the wrong one.
|
|
5110
|
+
*/
|
|
5111
|
+
pendingHint?: string | undefined;
|
|
5112
|
+
/**
|
|
5113
|
+
* The caller's cancellation — an MCP request's signal — asked under the record's lock, immediately before the claim
|
|
5114
|
+
* would change the record.
|
|
5115
|
+
*
|
|
5116
|
+
* A claim can wait: for the lock, while another process holds it. A caller that looked at its signal before calling
|
|
5117
|
+
* and found it clear could be cancelled during that wait, and the claim then went through all the same, spending an
|
|
5118
|
+
* approval on a call nobody was waiting for any more — whose outcome its caller then had to record as a failure,
|
|
5119
|
+
* since a claim cannot be put back. Asked here, a cancellation that lands before the record changes leaves it exactly
|
|
5120
|
+
* as it was, for the same call made again; one that lands after is the caller's to handle, as it always was.
|
|
5121
|
+
*/
|
|
5122
|
+
signal?: AbortSignal | undefined;
|
|
5123
|
+
}
|
|
5124
|
+
declare class ApprovalStore {
|
|
5125
|
+
#private;
|
|
5126
|
+
readonly directory: string;
|
|
5127
|
+
constructor(stateDir: string, options?: {
|
|
5128
|
+
now?: () => Date;
|
|
5129
|
+
ttlMs?: number;
|
|
5130
|
+
downloadTtlMs?: number;
|
|
5131
|
+
handoffs?: CliHandoffs | undefined;
|
|
5132
|
+
});
|
|
5133
|
+
create(input: CreateApprovalInput): Promise<ApprovalRecord>;
|
|
5134
|
+
get(approvalId: string): Promise<ApprovalRecord | null>;
|
|
5135
|
+
/** Issues a new challenge to show a human; only its hash is kept. */
|
|
5136
|
+
issueChallenge(approvalId: string, kind?: ApprovalKind, platform?: NodeJS.Platform): Promise<string>;
|
|
5137
|
+
/**
|
|
5138
|
+
* A human approved through a confirm channel by typing the issued challenge. The draft must still be exactly what the
|
|
5139
|
+
* record was prepared for; otherwise the record is voided, because the human would be approving content the record
|
|
5140
|
+
* does not describe. Three wrong answers void it too.
|
|
5141
|
+
*
|
|
5142
|
+
* A change is approved the same way, with `kind: 'change'` and its digest standing in for the draft (see
|
|
5143
|
+
* `createChange`), so a person's typed code means one thing whichever kind of approval it is typed for.
|
|
5144
|
+
*/
|
|
5145
|
+
approve(approvalId: string, via: ApprovalChannel, live: LiveDraft, answer: string, kind?: ApprovalKind, platform?: NodeJS.Platform): Promise<ApprovalRecord>;
|
|
5146
|
+
/**
|
|
5147
|
+
* Claims the record for sending, once. Non-consuming refusals (not yet approved) leave the record untouched so the
|
|
5148
|
+
* human can still approve it; integrity failures (other inbox or account, edited or changed draft, different
|
|
5149
|
+
* recipients or subject) void it. Success creates the O_EXCL claim marker.
|
|
5150
|
+
*/
|
|
5151
|
+
claimForSend(approvalId: string, live: LiveDraft & {
|
|
5152
|
+
inboxId: string;
|
|
5153
|
+
inboxSub?: string | undefined;
|
|
5154
|
+
policy: SendPolicy;
|
|
5155
|
+
expect: Expectation;
|
|
5156
|
+
}, options?: ClaimOptions): Promise<ApprovalRecord>;
|
|
5157
|
+
/**
|
|
5158
|
+
* A change approval, pending, bound to `changeDigest(input.change)`.
|
|
5159
|
+
*
|
|
5160
|
+
* The digest is computed here, never taken from the caller, so a record cannot claim to be bound to one change while
|
|
5161
|
+
* describing another. It stands in for the draft revision too, as a reaction's does: a change has no draft, and the
|
|
5162
|
+
* same value means the same change.
|
|
5163
|
+
*/
|
|
5164
|
+
createChange(input: CreateChangeApprovalInput): Promise<ApprovalRecord>;
|
|
5165
|
+
/**
|
|
5166
|
+
* Claims a change approval, once, for the change the caller is about to write.
|
|
5167
|
+
*
|
|
5168
|
+
* `live.change` is the change as the caller computes it now, and it has to digest to what was prepared: a different
|
|
5169
|
+
* path, a different value, a different account or a different effect voids the approval, because the person agreed
|
|
5170
|
+
* to something else. `live.policy` is the change policy in force now, and the stricter of it and the one at prepare
|
|
5171
|
+
* decides — so tightening the policy after an agent prepared a change takes effect on that change, and loosening it
|
|
5172
|
+
* does not release one prepared under `confirm`.
|
|
5173
|
+
*
|
|
5174
|
+
* Under `chat` a pending approval is claimable: the yes was given in the conversation. Anything stricter needs a
|
|
5175
|
+
* person to have typed the code at a terminal first; until then the refusal leaves the record as it is.
|
|
5176
|
+
*/
|
|
5177
|
+
claimForChange(approvalId: string, live: LiveChange, options?: ClaimOptions): Promise<ApprovalRecord>;
|
|
5178
|
+
/**
|
|
5179
|
+
* A download's question, pending, bound to `downloadDigest(input.download)` — computed here, never taken from the
|
|
5180
|
+
* caller, as a change's digest is. It stands in for the draft revision too.
|
|
5181
|
+
*
|
|
5182
|
+
* `policy` is the change policy of the mailbox or workspace the files come from, as it stands when the question is
|
|
5183
|
+
* asked: where a stranger's files land on this machine is a change to it, and is answered the way that account's
|
|
5184
|
+
* other changes are approved. A claim holds the question to the stricter of this and the policy then.
|
|
5185
|
+
*/
|
|
5186
|
+
createDownload(input: {
|
|
5187
|
+
download: DownloadBinding;
|
|
5188
|
+
policy: ChangePolicy;
|
|
5189
|
+
}): Promise<ApprovalRecord & {
|
|
5190
|
+
download: DownloadBinding;
|
|
5191
|
+
}>;
|
|
5192
|
+
/**
|
|
5193
|
+
* Records the person's answer to a download's question, given where an agent cannot give it: at their own terminal,
|
|
5194
|
+
* or in a form a trusted client showed them. The question moves to `approved`, carrying the answer, and waits for
|
|
5195
|
+
* the download to claim it — which it may then do under `confirm`, and which saves where this answer says.
|
|
5196
|
+
*
|
|
5197
|
+
* Only a pending question can be answered, and only once: a second answer is refused, not taken over the first.
|
|
5198
|
+
*/
|
|
5199
|
+
answerDownload(approvalId: string, via: ApprovalChannel, answer: RecordedSaveAnswer, platform?: NodeJS.Platform): Promise<ApprovalRecord & {
|
|
5200
|
+
download: DownloadBinding;
|
|
5201
|
+
}>;
|
|
5202
|
+
/**
|
|
5203
|
+
* Claims a download's question, once, for the download the caller is about to make — and returns it, with the
|
|
5204
|
+
* folders it offered, so that `downloads` and `current` in the answer mean the paths the person read, and with the
|
|
5205
|
+
* answer the person recorded, when they recorded one.
|
|
5206
|
+
*
|
|
5207
|
+
* `live` is the download as the caller computes it now: the same account, the same request, the same files under
|
|
5208
|
+
* the same names — the person answered for those files and no others. Any other is refused, and the question left
|
|
5209
|
+
* open, as it was: a second call that got an argument wrong is the agent's slip, not the person's, and voiding the
|
|
5210
|
+
* question for it would make the person answer again for nothing. It still expires, and is claimed once.
|
|
5211
|
+
*
|
|
5212
|
+
* `options.policy` is the change policy of that account now, and the stricter of it and the one the question was
|
|
5213
|
+
* asked under decides. Under `chat`, a pending question is claimed with the answer the caller carries: the person
|
|
5214
|
+
* gave it in the conversation. Under `confirm`, only a question the person answered at a terminal or in a trusted
|
|
5215
|
+
* form can be claimed; a pending one is refused, and left as it is, so they can still answer it. One used, voided or
|
|
5216
|
+
* expired is refused as an approval in that state is.
|
|
5217
|
+
*
|
|
5218
|
+
* `options.signal` is the download's cancellation, asked under the lock as a send's is (`ClaimOptions.signal`): a
|
|
5219
|
+
* download cancelled while this waited saves nothing and leaves the question open, the answer still unused.
|
|
5220
|
+
*/
|
|
5221
|
+
claimForDownload(approvalId: string, live: DownloadRequest, options?: {
|
|
5222
|
+
policy?: ChangePolicy | undefined;
|
|
5223
|
+
pendingHint?: string | undefined;
|
|
5224
|
+
signal?: AbortSignal | undefined;
|
|
5225
|
+
platform?: NodeJS.Platform | undefined;
|
|
5226
|
+
handoffs?: CliHandoffs | undefined;
|
|
5227
|
+
}): Promise<ApprovalRecord & {
|
|
5228
|
+
download: DownloadBinding;
|
|
5229
|
+
}>;
|
|
5230
|
+
/** Records the outcome of the one send attempt. */
|
|
5231
|
+
complete(approvalId: string, outcome: {
|
|
5232
|
+
sentMessageId: string;
|
|
5233
|
+
} | {
|
|
5234
|
+
error: string;
|
|
5235
|
+
}): Promise<ApprovalRecord>;
|
|
5236
|
+
/** Voids a pending or approved record (user revoked it, or policy tightened). Other records are left as they are. */
|
|
5237
|
+
revoke(approvalId: string, reason: string): Promise<ApprovalRecord>;
|
|
5238
|
+
list(filter?: {
|
|
5239
|
+
inboxId?: string;
|
|
5240
|
+
states?: ApprovalState[];
|
|
5241
|
+
}): Promise<ApprovalRecord[]>;
|
|
5183
5242
|
}
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5243
|
+
//#endregion
|
|
5244
|
+
//#region src/audit.d.ts
|
|
5245
|
+
/**
|
|
5246
|
+
* Every mailbox write leaves one line here: what was done, to which inbox, with which ids and outcome. Never message
|
|
5247
|
+
* bodies, never secrets — recipient *domains* only, so the log can be shared when asking for help.
|
|
5248
|
+
*/
|
|
5249
|
+
interface AuditRecord {
|
|
5250
|
+
at: string;
|
|
5251
|
+
/** Immutable inbox id; `alias` is the label at the time. */
|
|
5252
|
+
inboxId: string;
|
|
5253
|
+
alias?: string;
|
|
5254
|
+
operation: string;
|
|
5255
|
+
/** `started` marks the first half of a change recorded before it is made; a later record for the same ids ends it. */
|
|
5256
|
+
outcome: "ok" | "refused" | "failed" | "started";
|
|
5257
|
+
ids?: Record<string, string | string[] | CondensedIds>;
|
|
5258
|
+
recipientDomains?: string[];
|
|
5259
|
+
/**
|
|
5260
|
+
* Full canonical recipient addresses. Only a send writes these: for every other operation the domains are enough,
|
|
5261
|
+
* and storing less is better — but when mail has actually left, "who did it go to" is the first question anyone
|
|
5262
|
+
* asks afterwards, and a domain does not answer it.
|
|
5263
|
+
*/
|
|
5264
|
+
recipients?: string[];
|
|
5265
|
+
approvalId?: string;
|
|
5266
|
+
reason?: string;
|
|
5267
|
+
surface?: "cli" | "mcp";
|
|
5268
|
+
/**
|
|
5269
|
+
* The policy that decided how this was approved. Written by change approvals, where it is the whole question
|
|
5270
|
+
* afterwards: a loosening a person typed a code for and one an agent claimed after a yes in chat look the same in
|
|
5271
|
+
* the configuration, and only this line tells them apart.
|
|
5272
|
+
*/
|
|
5273
|
+
policy?: SendPolicy;
|
|
5274
|
+
}
|
|
5275
|
+
/** Large id lists are condensed so every audit line stays small enough to be appended atomically. */
|
|
5276
|
+
interface CondensedIds {
|
|
5277
|
+
count: number;
|
|
5278
|
+
sha256: string;
|
|
5279
|
+
first: string[];
|
|
5280
|
+
}
|
|
5281
|
+
declare class AuditLog {
|
|
5282
|
+
#private;
|
|
5283
|
+
readonly directory: string;
|
|
5284
|
+
constructor(stateDir: string, now?: () => Date);
|
|
5285
|
+
append(record: Omit<AuditRecord, "at"> & {
|
|
5286
|
+
at?: string;
|
|
5287
|
+
}, options?: {
|
|
5288
|
+
durable?: boolean;
|
|
5289
|
+
}): Promise<AuditRecord>;
|
|
5290
|
+
/** The most recent records, newest last, optionally filtered by inbox and a lower time bound. */
|
|
5291
|
+
tail(options?: {
|
|
5292
|
+
limit?: number;
|
|
5293
|
+
inbox?: string;
|
|
5294
|
+
since?: string;
|
|
5295
|
+
}): Promise<AuditRecord[]>;
|
|
5190
5296
|
}
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
interface
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5297
|
+
//#endregion
|
|
5298
|
+
//#region src/ledger.d.ts
|
|
5299
|
+
interface Caps {
|
|
5300
|
+
perHour: number;
|
|
5301
|
+
perDay: number;
|
|
5302
|
+
}
|
|
5303
|
+
interface CapStatus {
|
|
5304
|
+
hour: number;
|
|
5305
|
+
day: number;
|
|
5306
|
+
/** When the next slot frees up, if a cap is reached. */
|
|
5307
|
+
resetAt?: string;
|
|
5308
|
+
}
|
|
5309
|
+
declare class SendLedger {
|
|
5310
|
+
#private;
|
|
5311
|
+
readonly directory: string;
|
|
5312
|
+
constructor(stateDir: string, now?: () => Date);
|
|
5313
|
+
/** Counts sends (including in-flight reservations) in the last hour and day. */
|
|
5314
|
+
status(inboxId: string, caps: Caps): Promise<CapStatus>;
|
|
5315
|
+
/** Reserves a slot or refuses with APPROVAL_REQUIRED and the time the cap resets. Atomic across processes. */
|
|
5316
|
+
reserve(inboxId: string, approvalId: string, caps: Caps): Promise<CapStatus>;
|
|
5317
|
+
/** Releases a reservation whose send did not happen. */
|
|
5318
|
+
release(inboxId: string, approvalId: string): Promise<void>;
|
|
5201
5319
|
}
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5320
|
+
//#endregion
|
|
5321
|
+
//#region src/plans.d.ts
|
|
5322
|
+
/**
|
|
5323
|
+
* Bulk mailbox changes (more than 20 messages, anything driven by a query, and every trash) are two-step: a dry run
|
|
5324
|
+
* returns a plan token bound to the exact set of ids and the exact change; executing requires that token, once, within
|
|
5325
|
+
* ten minutes. The ids are resolved at dry-run time, so a query cannot silently grow between preview and execution.
|
|
5326
|
+
*/
|
|
5327
|
+
interface PlanRecord {
|
|
5328
|
+
token: string;
|
|
5329
|
+
inboxId: string;
|
|
5330
|
+
operation: string;
|
|
5331
|
+
/** Digest of the operation parameters (labels added/removed, archive, trash…). */
|
|
5332
|
+
paramsDigest: string;
|
|
5333
|
+
/** Digest of the sorted id list. */
|
|
5334
|
+
idsDigest: string;
|
|
5335
|
+
count: number;
|
|
5336
|
+
createdAt: string;
|
|
5337
|
+
expiresAt: string;
|
|
5338
|
+
}
|
|
5339
|
+
declare class PlanStore {
|
|
5340
|
+
#private;
|
|
5341
|
+
readonly directory: string;
|
|
5342
|
+
constructor(stateDir: string, now?: () => Date);
|
|
5343
|
+
create(input: {
|
|
5344
|
+
inboxId: string;
|
|
5345
|
+
operation: string;
|
|
5346
|
+
params: unknown;
|
|
5347
|
+
ids: readonly string[];
|
|
5348
|
+
}): Promise<PlanRecord>;
|
|
5349
|
+
/**
|
|
5350
|
+
* Consumes a plan exactly once. It must be for the same inbox, operation, parameters and ids; the file is deleted
|
|
5351
|
+
* inside the lock, so a second consume fails.
|
|
5352
|
+
*/
|
|
5353
|
+
consume(token: string, expected: {
|
|
5354
|
+
inboxId: string;
|
|
5355
|
+
operation: string;
|
|
5356
|
+
params: unknown;
|
|
5357
|
+
ids: readonly string[];
|
|
5358
|
+
}): Promise<PlanRecord>;
|
|
5206
5359
|
}
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5360
|
+
//#endregion
|
|
5361
|
+
//#region src/secrets.d.ts
|
|
5362
|
+
/**
|
|
5363
|
+
* Where refresh tokens, client secrets and approval keys live. Two backends, chosen per inbox or client and recorded
|
|
5364
|
+
* in config; the choice is never switched at runtime and there is no silent fallback from one to the other.
|
|
5365
|
+
*
|
|
5366
|
+
* - `keychain`: the OS store (macOS Keychain, Windows Credential Manager, Linux Secret Service — pinned, never the
|
|
5367
|
+
* kernel keyring, which forgets everything on reboot) through the optional `@napi-rs/keyring` package.
|
|
5368
|
+
* - `file`: one owner-only JSON file per secret in an owner-only directory. Chosen explicitly, never by default.
|
|
5369
|
+
*/
|
|
5370
|
+
type SecretStoreKind = "keychain" | "file";
|
|
5371
|
+
interface SecretStore {
|
|
5372
|
+
readonly kind: SecretStoreKind;
|
|
5373
|
+
get(ref: string): Promise<string | null>;
|
|
5374
|
+
set(ref: string, value: string): Promise<void>;
|
|
5375
|
+
delete(ref: string): Promise<boolean>;
|
|
5376
|
+
/** Forgets any cached value, so the next read goes to the backend (e.g. after another process re-authorised). */
|
|
5377
|
+
invalidate(ref: string): void;
|
|
5378
|
+
/**
|
|
5379
|
+
* Resolves once no earlier call is still occupying the backend. Absent on a store with nothing to wait for.
|
|
5380
|
+
*
|
|
5381
|
+
* For a caller that must not give up on a write: the keychain fails every call fast while a timed-out native call
|
|
5382
|
+
* is still held by an OS dialog, so retrying on a timer spends every attempt against the same stuck call. A
|
|
5383
|
+
* refresh that has already spent Slack's single-use token is that caller — it has one value it cannot get again,
|
|
5384
|
+
* and waiting for the dialog to be answered is the only retry that can succeed.
|
|
5385
|
+
*/
|
|
5386
|
+
settled?(): Promise<void>;
|
|
5211
5387
|
}
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5388
|
+
//#endregion
|
|
5389
|
+
//#region src/state.d.ts
|
|
5390
|
+
/**
|
|
5391
|
+
* Per-inbox runtime facts that any process may update (last successful refresh, last use, health). Kept out of
|
|
5392
|
+
* config.json so a running server never rewrites user intent — a stale in-memory copy of config written back by a
|
|
5393
|
+
* server could otherwise silently undo a policy the user just tightened.
|
|
5394
|
+
*/
|
|
5395
|
+
interface InboxRuntimeState {
|
|
5396
|
+
lastRefreshOkAt?: string | undefined;
|
|
5397
|
+
lastUsedAt?: string | undefined;
|
|
5398
|
+
/** Set to `undefined` to clear it: the merged value is dropped when the file is written. */
|
|
5399
|
+
lastError?: {
|
|
5400
|
+
code: string;
|
|
5401
|
+
message: string;
|
|
5402
|
+
at: string;
|
|
5403
|
+
} | undefined;
|
|
5404
|
+
grantedScopes?: string[] | undefined;
|
|
5405
|
+
refreshTokenExpiresAt?: string | undefined;
|
|
5217
5406
|
}
|
|
5218
|
-
declare
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5407
|
+
declare class InboxStateStore {
|
|
5408
|
+
#private;
|
|
5409
|
+
readonly directory: string;
|
|
5410
|
+
constructor(stateDir: string);
|
|
5411
|
+
get(inboxId: string): Promise<InboxRuntimeState>;
|
|
5412
|
+
/** Merges `patch` into the stored state under a per-inbox lock. */
|
|
5413
|
+
update(inboxId: string, patch: Partial<InboxRuntimeState>): Promise<InboxRuntimeState>;
|
|
5223
5414
|
}
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5415
|
+
/**
|
|
5416
|
+
* A platform identifier that is not an email address: a Slack user or conversation id.
|
|
5417
|
+
*
|
|
5418
|
+
* It carries its scope because, unlike an address, it is not globally unique — `U024BE7LH` names a different person
|
|
5419
|
+
* in every workspace that happens to mint that id. The address store is deliberately cross-inbox, on the reasoning
|
|
5420
|
+
* that a message read in one mailbox can ask for a send from another; that reasoning does not transfer here, and a
|
|
5421
|
+
* store that matched ids across workspaces would flag an unrelated person every time two workspaces collided.
|
|
5422
|
+
*
|
|
5423
|
+
* The id, never the display name. `@sam` is set by the account that bears it and can be changed to `@finance-bot`
|
|
5424
|
+
* between the message being read and the send being checked; the id cannot.
|
|
5425
|
+
*/
|
|
5426
|
+
interface TaintHandle {
|
|
5427
|
+
/** `slack`. Lower-cased on the way in. */
|
|
5428
|
+
platform: string;
|
|
5429
|
+
/** The workspace or team the id belongs to — a Slack team id. */
|
|
5430
|
+
scope: string;
|
|
5431
|
+
/** `U024BE7LH`, `C0123`, `D0456`. Passed in the platform's own canonical form; core does not know its shape. */
|
|
5432
|
+
id: string;
|
|
5433
|
+
}
|
|
5434
|
+
type TaintSource = "header" | "body";
|
|
5435
|
+
interface TaintObservation {
|
|
5436
|
+
address: string;
|
|
5437
|
+
source: TaintSource;
|
|
5438
|
+
inboxId: string;
|
|
5439
|
+
messageId?: string | undefined;
|
|
5440
|
+
}
|
|
5441
|
+
/** The same observation for a handle. `inboxId` is the account that did the reading, as it is for an address. */
|
|
5442
|
+
interface TaintHandleObservation {
|
|
5443
|
+
handle: TaintHandle;
|
|
5444
|
+
source: TaintSource;
|
|
5445
|
+
inboxId: string;
|
|
5446
|
+
messageId?: string | undefined;
|
|
5447
|
+
}
|
|
5448
|
+
/** What is never recorded: the user's own addresses and the domains they call internal. */
|
|
5449
|
+
interface TaintExclusions {
|
|
5450
|
+
ownAddresses: readonly string[];
|
|
5451
|
+
internalDomains: readonly string[];
|
|
5452
|
+
/**
|
|
5453
|
+
* Handles that are never recorded: the account's own user id, and whoever the caller treats as internal — the
|
|
5454
|
+
* counterpart of `internalDomains`, decided per platform because "internal" means a domain for mail and
|
|
5455
|
+
* workspace membership for Slack, and core should not be the thing that knows the difference.
|
|
5456
|
+
*/
|
|
5457
|
+
ownHandles?: readonly TaintHandle[] | undefined;
|
|
5458
|
+
}
|
|
5459
|
+
interface TaintCheck {
|
|
5460
|
+
address: boolean;
|
|
5461
|
+
domain: boolean;
|
|
5462
|
+
}
|
|
5463
|
+
declare class TaintStore {
|
|
5464
|
+
#private;
|
|
5465
|
+
readonly directory: string;
|
|
5466
|
+
constructor(stateDir: string, now?: () => Date);
|
|
5467
|
+
/**
|
|
5468
|
+
* Records observations. Throws if it cannot — callers must fail the read rather than return content whose taint
|
|
5469
|
+
* was not recorded.
|
|
5470
|
+
*/
|
|
5471
|
+
record(observations: readonly TaintObservation[], exclusions: TaintExclusions, handleObservations?: readonly TaintHandleObservation[]): Promise<void>;
|
|
5472
|
+
/** Whether an address, or its (non-public) domain, was seen in email content in the window — from any inbox. */
|
|
5473
|
+
check(address: string): Promise<TaintCheck>;
|
|
5474
|
+
/**
|
|
5475
|
+
* Whether a handle was seen in message content in the window.
|
|
5476
|
+
*
|
|
5477
|
+
* Only within its own workspace — see `TaintHandle`. There is no second answer to give, the way an address also
|
|
5478
|
+
* carries a domain: two ids sharing a workspace says nothing about either of them.
|
|
5479
|
+
*/
|
|
5480
|
+
checkHandle(handle: TaintHandle): Promise<boolean>;
|
|
5235
5481
|
}
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5482
|
+
//#endregion
|
|
5483
|
+
//#region src/core.d.ts
|
|
5484
|
+
/** Everything a provider package needs from the core, wired to one config directory. */
|
|
5485
|
+
interface Core {
|
|
5486
|
+
paths: ResolvedPaths;
|
|
5487
|
+
/** The subset of `paths` explicitly pinned by global CLI options. */
|
|
5488
|
+
pathOverrides: Readonly<PathOverrides>;
|
|
5489
|
+
config: ConfigStore;
|
|
5490
|
+
states: InboxStateStore;
|
|
5491
|
+
approvals: ApprovalStore;
|
|
5492
|
+
ledger: SendLedger;
|
|
5493
|
+
plans: PlanStore;
|
|
5494
|
+
taint: TaintStore;
|
|
5495
|
+
audit: AuditLog;
|
|
5496
|
+
/** Opens the config directory's one secret backend (as recorded in config, or `kind` before the first write). */
|
|
5497
|
+
secrets(kind?: SecretStoreKind): Promise<SecretStore>;
|
|
5498
|
+
/**
|
|
5499
|
+
* The commands this process tells a person to run — its own CLI's, core's, another product's — located from the
|
|
5500
|
+
* caller it was opened with (`OpenCoreOptions.caller`), for these folders. Undefined when none was given: then there
|
|
5501
|
+
* is no command to print at all, and anything that asks for one meets the programming error `requireHandoffs` throws —
|
|
5502
|
+
* never a bare name. Every package opens core with its caller.
|
|
5503
|
+
*/
|
|
5504
|
+
handoffs?: CliHandoffs | undefined;
|
|
5257
5505
|
}
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
declare
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
type
|
|
5266
|
-
|
|
5267
|
-
|
|
5506
|
+
//#endregion
|
|
5507
|
+
//#region src/caller.d.ts
|
|
5508
|
+
/** This package's name, as its manifest has it. */
|
|
5509
|
+
export declare const PACKAGE_NAME = "@agentcomms/whatsapp";
|
|
5510
|
+
//#endregion
|
|
5511
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts
|
|
5512
|
+
//#region ../../node_modules/.pnpm/json-schema-typed@8.0.2/node_modules/json-schema-typed/draft_2020_12.d.ts
|
|
5513
|
+
type MaybeReadonlyArray<T> = Array<T> | ReadonlyArray<T>;
|
|
5514
|
+
type ValueOf<T> = T[keyof T];
|
|
5515
|
+
/**
|
|
5516
|
+
* JSON Schema [Draft 2020-12](https://json-schema.org/draft/2020-12/json-schema-validation.html)
|
|
5517
|
+
*/
|
|
5518
|
+
type JSONSchema<Value = any, SchemaType = (Value extends boolean ? "boolean" : Value extends null ? "null" : Value extends number ? "number" | "integer" : Value extends string ? "string" : Value extends unknown[] ? "array" : Value extends Record<string | number, unknown> ? "object" : JSONSchema.TypeValue)> = boolean | {
|
|
5519
|
+
/**
|
|
5520
|
+
* Using JSON Pointer fragments requires knowledge of the structure of the
|
|
5521
|
+
* schema. When writing schema documents with the intention to provide
|
|
5522
|
+
* re-usable schemas, it may be preferable to use a plain name fragment
|
|
5523
|
+
* that is not tied to any particular structural location. This allows a
|
|
5524
|
+
* subschema to be relocated without requiring JSON Pointer references to
|
|
5525
|
+
* be updated.
|
|
5526
|
+
*
|
|
5527
|
+
* The `$anchor` keyword is used to specify such a fragment. It is an
|
|
5528
|
+
* identifier keyword that can only be used to create plain name fragments.
|
|
5529
|
+
*
|
|
5530
|
+
* If present, the value of this keyword MUST be a string, which MUST start
|
|
5531
|
+
* with a letter `[A-Za-z]`, followed by any number of letters, digits
|
|
5532
|
+
* `[0-9]`, hyphens `-`, underscores `_`, colons `:`,
|
|
5533
|
+
* or periods `.`.
|
|
5534
|
+
*
|
|
5535
|
+
* Note that the anchor string does not include the `#` character,
|
|
5536
|
+
* as it is not a URI-reference. An `{"$anchor": "foo"}` becomes the
|
|
5537
|
+
* fragment `#foo` when used in a URI.
|
|
5538
|
+
*
|
|
5539
|
+
* The base URI to which the resulting fragment is appended is determined
|
|
5540
|
+
* by the `$id` keyword as explained in the previous section.
|
|
5541
|
+
* Two `$anchor` keywords in the same schema document MAY have the same
|
|
5542
|
+
* value if they apply to different base URIs, as the resulting full URIs
|
|
5543
|
+
* will be distinct. However, the effect of two `$anchor` keywords
|
|
5544
|
+
* with the same value and the same base URI is undefined. Implementations
|
|
5545
|
+
* MAY raise an error if such usage is detected.
|
|
5546
|
+
*/
|
|
5547
|
+
$anchor?: string;
|
|
5548
|
+
/**
|
|
5549
|
+
* This keyword reserves a location for comments from schema authors to
|
|
5550
|
+
* readers or maintainers of the schema.
|
|
5551
|
+
*
|
|
5552
|
+
* The value of this keyword MUST be a string. Implementations MUST NOT
|
|
5553
|
+
* present this string to end users. Tools for editing schemas SHOULD
|
|
5554
|
+
* support displaying and editing this keyword. The value of this keyword
|
|
5555
|
+
* MAY be used in debug or error output which is intended for developers
|
|
5556
|
+
* making use of schemas.
|
|
5557
|
+
*
|
|
5558
|
+
* Schema vocabularies SHOULD allow `$comment` within any object
|
|
5559
|
+
* containing vocabulary keywords. Implementations MAY assume `$comment`
|
|
5560
|
+
* is allowed unless the vocabulary specifically forbids it. Vocabularies
|
|
5561
|
+
* MUST NOT specify any effect of `$comment` beyond what is described in
|
|
5562
|
+
* this specification.
|
|
5563
|
+
*
|
|
5564
|
+
* Tools that translate other media types or programming languages
|
|
5565
|
+
* to and from `application/schema+json` MAY choose to convert that media
|
|
5566
|
+
* type or programming language's native comments to or from `$comment`
|
|
5567
|
+
* values. The behavior of such translation when both native comments and
|
|
5568
|
+
* `$comment` properties are present is implementation-dependent.
|
|
5569
|
+
*
|
|
5570
|
+
* Implementations MAY strip `$comment` values at any point during
|
|
5571
|
+
* processing. In particular, this allows for shortening schemas when the
|
|
5572
|
+
* size of deployed schemas is a concern.
|
|
5573
|
+
*
|
|
5574
|
+
* Implementations MUST NOT take any other action based on the presence,
|
|
5575
|
+
* absence, or contents of `$comment` properties. In particular, the
|
|
5576
|
+
* value of `$comment` MUST NOT be collected as an annotation result.
|
|
5577
|
+
*/
|
|
5578
|
+
$comment?: string;
|
|
5579
|
+
/**
|
|
5580
|
+
* The `$defs` keyword reserves a location for schema authors to inline
|
|
5581
|
+
* re-usable JSON Schemas into a more general schema. The keyword does not
|
|
5582
|
+
* directly affect the validation result.
|
|
5583
|
+
*
|
|
5584
|
+
* This keyword's value MUST be an object. Each member value of this object
|
|
5585
|
+
* MUST be a valid JSON Schema.
|
|
5586
|
+
*/
|
|
5587
|
+
$defs?: Record<string, JSONSchema>;
|
|
5588
|
+
/**
|
|
5589
|
+
* "The `$dynamicAnchor` indicates that the fragment is an extension
|
|
5590
|
+
* point when used with the `$dynamicRef` keyword. This low-level,
|
|
5591
|
+
* advanced feature makes it easier to extend recursive schemas such as the
|
|
5592
|
+
* meta-schemas, without imposing any particular semantics on that
|
|
5593
|
+
* extension. See `$dynamicRef` for more details.
|
|
5594
|
+
*/
|
|
5595
|
+
$dynamicAnchor?: string;
|
|
5596
|
+
/**
|
|
5597
|
+
* The `$dynamicRef` keyword is an applicator that allows for deferring
|
|
5598
|
+
* the full resolution until runtime, at which point it is resolved each
|
|
5599
|
+
* time it is encountered while evaluating an instance.
|
|
5600
|
+
*
|
|
5601
|
+
* Together with `$dynamicAnchor`, `$dynamicRef` implements a
|
|
5602
|
+
* cooperative extension mechanism that is primarily useful with recursive
|
|
5603
|
+
* schemas (schemas that reference themselves). Both the extension point
|
|
5604
|
+
* and the runtime-determined extension target are defined with
|
|
5605
|
+
* `$dynamicAnchor`, and only exhibit runtime dynamic behavior when
|
|
5606
|
+
* referenced with `$dynamicRef`.
|
|
5607
|
+
*
|
|
5608
|
+
* The value of the `$dynamicRef` property MUST be a string which is
|
|
5609
|
+
* a URI-Reference. Resolved against the current URI base, it produces
|
|
5610
|
+
* the URI used as the starting point for runtime resolution. This initial
|
|
5611
|
+
* resolution is safe to perform on schema load.
|
|
5612
|
+
*
|
|
5613
|
+
* If the initially resolved starting point URI includes a fragment that
|
|
5614
|
+
* was created by the `$dynamicAnchor` keyword, the initial URI MUST be
|
|
5615
|
+
* replaced by the URI (including the fragment) for the outermost schema
|
|
5616
|
+
* resource in the [dynamic scope][scopes] that defines
|
|
5617
|
+
* an identically named fragment with `$dynamicAnchor`.
|
|
5618
|
+
*
|
|
5619
|
+
* Otherwise, its behavior is identical to `$ref`, and no runtime
|
|
5620
|
+
* resolution is needed.
|
|
5621
|
+
*
|
|
5622
|
+
* [scopes]: https://json-schema.org/draft/2020-12/json-schema-core.html#scopes
|
|
5623
|
+
*
|
|
5624
|
+
* @format "uri-reference"
|
|
5625
|
+
*/
|
|
5626
|
+
$dynamicRef?: string;
|
|
5627
|
+
/**
|
|
5628
|
+
* The `$id` keyword identifies a schema resource with its
|
|
5629
|
+
* [canonical][[RFC6596]] URI.
|
|
5630
|
+
*
|
|
5631
|
+
* Note that this URI is an identifier and not necessarily a network
|
|
5632
|
+
* locator. In the case of a network-addressable URL, a schema need not be
|
|
5633
|
+
* downloadable from its canonical URI.
|
|
5634
|
+
*
|
|
5635
|
+
* If present, the value for this keyword MUST be a string, and MUST
|
|
5636
|
+
* represent a valid [URI-reference][RFC3986]. This URI-reference SHOULD
|
|
5637
|
+
* be normalized, and MUST resolve to an [absolute-URI][RFC3986] (without a
|
|
5638
|
+
* fragment). Therefore, `$id` MUST NOT contain a non-empty fragment,
|
|
5639
|
+
* and SHOULD NOT contain an empty fragment.
|
|
5640
|
+
*
|
|
5641
|
+
* Since an empty fragment in the context of the
|
|
5642
|
+
* `application/schema+json` media type refers to the same resource as
|
|
5643
|
+
* the base URI without a fragment, an implementation MAY normalize a URI
|
|
5644
|
+
* ending with an empty fragment by removing the fragment. However, schema
|
|
5645
|
+
* authors SHOULD NOT rely on this behavior across implementations.
|
|
5646
|
+
*
|
|
5647
|
+
* This URI also serves as the base URI for relative URI-references in
|
|
5648
|
+
* keywords within the schema resource, in accordance with
|
|
5649
|
+
* [RFC 3986][RFC3986] section 5.1.1 regarding base URIs embedded in
|
|
5650
|
+
* content.
|
|
5651
|
+
*
|
|
5652
|
+
* The presence of `$id` in a subschema indicates that the subschema
|
|
5653
|
+
* constitutes a distinct schema resource within a single schema document.
|
|
5654
|
+
* Furthermore, in accordance with [RFC 3986][RFC3986] section 5.1.2
|
|
5655
|
+
* regarding encapsulating entities, if an `$id` in a subschema is a
|
|
5656
|
+
* relative URI-reference, the base URI for resolving that reference is the
|
|
5657
|
+
* URI of the parent schema resource.
|
|
5658
|
+
*
|
|
5659
|
+
* If no parent schema object explicitly identifies itself as a resource
|
|
5660
|
+
* with `$id`, the base URI is that of the entire document.
|
|
5661
|
+
*
|
|
5662
|
+
* The root schema of a JSON Schema document SHOULD contain an `$id`
|
|
5663
|
+
* keyword with an [absolute-URI][RFC3986] (containing a scheme, but no
|
|
5664
|
+
* fragment).
|
|
5665
|
+
*
|
|
5666
|
+
* [RFC6596]: https://datatracker.ietf.org/doc/html/rfc6596
|
|
5667
|
+
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
|
|
5668
|
+
*
|
|
5669
|
+
* @format "uri-reference"
|
|
5670
|
+
*/
|
|
5671
|
+
$id?: string;
|
|
5672
|
+
/**
|
|
5673
|
+
* The `$ref` keyword is an applicator that is used to reference a
|
|
5674
|
+
* statically identified schema. Its results are the results of the
|
|
5675
|
+
* referenced schema. Other keywords can appear alongside of `$ref` in
|
|
5676
|
+
* the same schema object.
|
|
5677
|
+
*
|
|
5678
|
+
* The value of the `$ref` property MUST be a string which is a
|
|
5679
|
+
* URI-Reference. Resolved against the current URI base, it produces the
|
|
5680
|
+
* URI of the schema to apply.
|
|
5681
|
+
*
|
|
5682
|
+
* @format "uri-reference"
|
|
5683
|
+
*/
|
|
5684
|
+
$ref?: string;
|
|
5685
|
+
/**
|
|
5686
|
+
* The `$schema` keyword is both used as a JSON Schema dialect identifier
|
|
5687
|
+
* and as the identifier of a resource which is itself a JSON Schema, which
|
|
5688
|
+
* describes the set of valid schemas written for this particular dialect.
|
|
5689
|
+
*
|
|
5690
|
+
* The value of this keyword MUST be a [URI][RFC3986] (containing a scheme)
|
|
5691
|
+
* and this URI MUST be normalized. The current schema MUST be valid
|
|
5692
|
+
* against the meta-schema identified by this URI.
|
|
5693
|
+
*
|
|
5694
|
+
* If this URI identifies a retrievable resource, that resource SHOULD be
|
|
5695
|
+
* of media type `application/schema+json`.
|
|
5696
|
+
*
|
|
5697
|
+
* The `$schema` keyword SHOULD be used in the document root schema
|
|
5698
|
+
* object, and MAY be used in the root schema objects of embedded schema
|
|
5699
|
+
* resources. It MUST NOT appear in non-resource root schema objects. If
|
|
5700
|
+
* absent from the document root schema, the resulting behavior is
|
|
5701
|
+
* implementation-defined.
|
|
5702
|
+
*
|
|
5703
|
+
* Values for this property are defined elsewhere in this and other
|
|
5704
|
+
* documents, and by other parties.
|
|
5705
|
+
*
|
|
5706
|
+
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
|
|
5707
|
+
*
|
|
5708
|
+
* @format "uri"
|
|
5709
|
+
*/
|
|
5710
|
+
$schema?: string;
|
|
5711
|
+
/**
|
|
5712
|
+
* The `$vocabulary` keyword is used in meta-schemas to identify the
|
|
5713
|
+
* vocabularies available for use in schemas described by that meta-schema.
|
|
5714
|
+
* It is also used to indicate whether each vocabulary is required or
|
|
5715
|
+
* optional, in the sense that an implementation MUST understand the
|
|
5716
|
+
* required vocabularies in order to successfully process the schema.
|
|
5717
|
+
* Together, this information forms a dialect. Any vocabulary that is
|
|
5718
|
+
* understood by the implementation MUST be processed in a manner
|
|
5719
|
+
* consistent with the semantic definitions contained within the
|
|
5720
|
+
* vocabulary.
|
|
5721
|
+
*
|
|
5722
|
+
* The value of this keyword MUST be an object. The property names in the
|
|
5723
|
+
* object MUST be URIs (containing a scheme) and this URI MUST be
|
|
5724
|
+
* normalized. Each URI that appears as a property name identifies a
|
|
5725
|
+
* specific set of keywords and their semantics.
|
|
5726
|
+
*
|
|
5727
|
+
* The URI MAY be a URL, but the nature of the retrievable resource is
|
|
5728
|
+
* currently undefined, and reserved for future use. Vocabulary authors
|
|
5729
|
+
* MAY use the URL of the vocabulary specification, in a human-readable
|
|
5730
|
+
* media type such as `text/html` or `text/plain`, as the vocabulary
|
|
5731
|
+
* URI.
|
|
5732
|
+
*
|
|
5733
|
+
* The values of the object properties MUST be booleans. If the value is
|
|
5734
|
+
* `true`, then implementations that do not recognize the vocabulary MUST
|
|
5735
|
+
* refuse to process any schemas that declare this meta-schema with
|
|
5736
|
+
* `$schema`. If the value is `false`, implementations that do not
|
|
5737
|
+
* recognize the vocabulary SHOULD proceed with processing such schemas.
|
|
5738
|
+
* The value has no impact if the implementation understands the
|
|
5739
|
+
* vocabulary.
|
|
5740
|
+
*
|
|
5741
|
+
* Unrecognized keywords SHOULD be ignored. This remains the case for
|
|
5742
|
+
* keywords defined by unrecognized vocabularies. It is not currently
|
|
5743
|
+
* possible to distinguish between unrecognized keywords that are defined
|
|
5744
|
+
* in vocabularies from those that are not part of any vocabulary.
|
|
5745
|
+
*
|
|
5746
|
+
* The `$vocabulary` keyword SHOULD be used in the root schema of any
|
|
5747
|
+
* schema document intended for use as a meta-schema. It MUST NOT appear
|
|
5748
|
+
* in subschemas.
|
|
5749
|
+
*
|
|
5750
|
+
* The `$vocabulary` keyword MUST be ignored in schema documents that are
|
|
5751
|
+
* not being processed as a meta-schema.
|
|
5752
|
+
*/
|
|
5753
|
+
$vocabulary?: Record<string, string>;
|
|
5754
|
+
/**
|
|
5755
|
+
* @deprecated `additionalItems` has been deprecated in favor of `prefixItems`
|
|
5756
|
+
* paired with `items`.
|
|
5757
|
+
*/
|
|
5758
|
+
additionalItems?: JSONSchema;
|
|
5759
|
+
/**
|
|
5760
|
+
* The value of `additionalProperties` MUST be a valid JSON Schema.
|
|
5761
|
+
*
|
|
5762
|
+
* The behavior of this keyword depends on the presence and annotation
|
|
5763
|
+
* results of `properties` and `patternProperties` within the same
|
|
5764
|
+
* schema object. Validation with `additionalProperties` applies only to
|
|
5765
|
+
* the child values of instance names that do not appear in the annotation
|
|
5766
|
+
* results of either `properties` or `patternProperties`.
|
|
5767
|
+
*
|
|
5768
|
+
* For all such properties, validation succeeds if the child instance
|
|
5769
|
+
* validates against the `additionalProperties` schema.
|
|
5770
|
+
*
|
|
5771
|
+
* The annotation result of this keyword is the set of instance property
|
|
5772
|
+
* names validated by this keyword's subschema. Annotation results for
|
|
5773
|
+
* `additionalProperties` keywords from multiple schemas applied to the
|
|
5774
|
+
* same instance location are combined by taking the union of the sets.
|
|
5775
|
+
*
|
|
5776
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
|
5777
|
+
* schema.
|
|
5778
|
+
*
|
|
5779
|
+
* Implementations MAY choose to implement or optimize this keyword in
|
|
5780
|
+
* another way that produces the same effect, such as by directly checking
|
|
5781
|
+
* the names in `properties` and the patterns in `patternProperties`
|
|
5782
|
+
* against the instance property set.
|
|
5783
|
+
*/
|
|
5784
|
+
additionalProperties?: JSONSchema;
|
|
5785
|
+
/**
|
|
5786
|
+
* This keyword's value MUST be a non-empty array. Each item of the array
|
|
5787
|
+
* MUST be a valid JSON Schema.
|
|
5788
|
+
*
|
|
5789
|
+
* An instance validates successfully against this keyword if it validates
|
|
5790
|
+
* successfully against all schemas defined by this keyword's value.
|
|
5791
|
+
*/
|
|
5792
|
+
allOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;
|
|
5793
|
+
/**
|
|
5794
|
+
* This keyword's value MUST be a non-empty array. Each item of the array
|
|
5795
|
+
* MUST be a valid JSON Schema.
|
|
5796
|
+
*
|
|
5797
|
+
* An instance validates successfully against this keyword if it validates
|
|
5798
|
+
* successfully against at least one schema defined by this keyword's
|
|
5799
|
+
* value.
|
|
5800
|
+
*/
|
|
5801
|
+
anyOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;
|
|
5802
|
+
/**
|
|
5803
|
+
* An instance validates successfully against this keyword if its value is
|
|
5804
|
+
* equal to the value of the keyword.
|
|
5805
|
+
*
|
|
5806
|
+
* Use of this keyword is functionally equivalent to the `enum` keyword
|
|
5807
|
+
* with a single value.
|
|
5808
|
+
*/
|
|
5809
|
+
const?: Value;
|
|
5810
|
+
/**
|
|
5811
|
+
* The value of this keyword MUST be a valid JSON Schema.
|
|
5812
|
+
*
|
|
5813
|
+
* An array instance is valid against `contains` if at least one of its
|
|
5814
|
+
* elements is valid against the given schema. The subschema MUST be
|
|
5815
|
+
* applied to every array element even after the first match has been
|
|
5816
|
+
* found, in order to collect annotations for use by other keywords.
|
|
5817
|
+
* This is to ensure that all possible annotations are collected.
|
|
5818
|
+
*
|
|
5819
|
+
* Logically, the validation result of applying the value subschema to each
|
|
5820
|
+
* item in the array MUST be OR'ed with `false`, resulting in an overall
|
|
5821
|
+
* validation result.
|
|
5822
|
+
*
|
|
5823
|
+
* This keyword produces an annotation value which is an array of the
|
|
5824
|
+
* indexes to which this keyword validates successfully when applying its
|
|
5825
|
+
* subschema, in ascending order. The value MAY be a boolean `true` if
|
|
5826
|
+
* the subschema validates successfully when applied to every index of the
|
|
5827
|
+
* instance. The annotation MUST be present if the instance array to which
|
|
5828
|
+
* this keyword's schema applies is empty.
|
|
5829
|
+
*/
|
|
5830
|
+
contains?: JSONSchema<Value, SchemaType>;
|
|
5831
|
+
/**
|
|
5832
|
+
* If the instance value is a string, this property defines that the
|
|
5833
|
+
* string SHOULD be interpreted as binary data and decoded using the
|
|
5834
|
+
* encoding named by this property. [RFC 2045, Sec 6.1][RFC2045] lists the
|
|
5835
|
+
* possible values for this property.
|
|
5836
|
+
*
|
|
5837
|
+
* The value of this property SHOULD be ignored if the instance described
|
|
5838
|
+
* is not a string.
|
|
5839
|
+
*
|
|
5840
|
+
* If this keyword is absent, but `contentMediaType` is present, this
|
|
5841
|
+
* indicates that the media type could be encoded into `UTF-8` like any
|
|
5842
|
+
* other JSON string value, and does not require additional decoding.
|
|
5843
|
+
*
|
|
5844
|
+
* The value of this property MUST be a string.
|
|
5845
|
+
*
|
|
5846
|
+
* [RFC2045]: https://datatracker.ietf.org/doc/html/rfc2045#section-6.1
|
|
5847
|
+
*/
|
|
5848
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
5849
|
+
/**
|
|
5850
|
+
* If the instance is a string, this property indicates the media type
|
|
5851
|
+
* of the contents of the string. If `contentEncoding` is present,
|
|
5852
|
+
* this property describes the decoded string.
|
|
5853
|
+
*
|
|
5854
|
+
* The value of this property must be a media type, as defined by
|
|
5855
|
+
* [RFC 2046][RFC2046]. This property defines the media type of instances
|
|
5856
|
+
* which this schema defines.
|
|
5857
|
+
*
|
|
5858
|
+
* The value of this property SHOULD be ignored if the instance described
|
|
5859
|
+
* is not a string.
|
|
5860
|
+
*
|
|
5861
|
+
* If the `contentEncoding` property is not present, but the instance
|
|
5862
|
+
* value is a string, then the value of this property SHOULD specify a text
|
|
5863
|
+
* document type, and the character set SHOULD be the character set into
|
|
5864
|
+
* which the JSON string value was decoded (for which the default is
|
|
5865
|
+
* Unicode).
|
|
5866
|
+
*
|
|
5867
|
+
* [RFC2046]: https://datatracker.ietf.org/doc/html/rfc2046
|
|
5868
|
+
*/
|
|
5869
|
+
contentMediaType?: string;
|
|
5870
|
+
/**
|
|
5871
|
+
* If the instance is a string, and if `contentMediaType` is present,
|
|
5872
|
+
* this property contains a schema which describes the structure of the
|
|
5873
|
+
* string.
|
|
5874
|
+
*
|
|
5875
|
+
* This keyword MAY be used with any media type that can be mapped into
|
|
5876
|
+
* JSON Schema's data model.
|
|
5877
|
+
*
|
|
5878
|
+
* The value of this property MUST be a valid JSON schema. It SHOULD be
|
|
5879
|
+
* ignored if `contentMediaType` is not present.
|
|
5880
|
+
*/
|
|
5881
|
+
contentSchema?: JSONSchema<Value, SchemaType>;
|
|
5882
|
+
/**
|
|
5883
|
+
* This keyword can be used to supply a default JSON value associated with
|
|
5884
|
+
* a particular schema. It is RECOMMENDED that a `default` value be valid
|
|
5885
|
+
* against the associated schema.
|
|
5886
|
+
*/
|
|
5887
|
+
default?: Value;
|
|
5888
|
+
/**
|
|
5889
|
+
* @deprecated `definitions` has been renamed to `$defs`.
|
|
5890
|
+
*/
|
|
5891
|
+
definitions?: Record<string, JSONSchema>;
|
|
5892
|
+
/**
|
|
5893
|
+
* @deprecated `dependencies` has been split into two keywords:
|
|
5894
|
+
* `dependentSchemas` and `dependentRequired`.
|
|
5895
|
+
*/
|
|
5896
|
+
dependencies?: Record<string, MaybeReadonlyArray<string> | JSONSchema>;
|
|
5897
|
+
/**
|
|
5898
|
+
* The value of this keyword MUST be an object. Properties in
|
|
5899
|
+
* this object, if any, MUST be arrays. Elements in each array,
|
|
5900
|
+
* if any, MUST be strings, and MUST be unique.
|
|
5901
|
+
*
|
|
5902
|
+
* This keyword specifies properties that are required if a specific
|
|
5903
|
+
* other property is present. Their requirement is dependent on the
|
|
5904
|
+
* presence of the other property.
|
|
5905
|
+
*
|
|
5906
|
+
* Validation succeeds if, for each name that appears in both
|
|
5907
|
+
* the instance and as a name within this keyword's value, every
|
|
5908
|
+
* item in the corresponding array is also the name of a property
|
|
5909
|
+
* in the instance.
|
|
5910
|
+
*
|
|
5911
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
5912
|
+
*/
|
|
5913
|
+
dependentRequired?: Record<string, MaybeReadonlyArray<string>>;
|
|
5914
|
+
/**
|
|
5915
|
+
* This keyword specifies subschemas that are evaluated if the instance is
|
|
5916
|
+
* an object and contains a certain property.
|
|
5917
|
+
*
|
|
5918
|
+
* This keyword's value MUST be an object. Each value in the object MUST be
|
|
5919
|
+
* a valid JSON Schema.
|
|
5920
|
+
*
|
|
5921
|
+
* If the object key is a property in the instance, the entire instance
|
|
5922
|
+
* must validate against the subschema. Its use is dependent on the
|
|
5923
|
+
* presence of the property.
|
|
5924
|
+
*
|
|
5925
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
5926
|
+
*/
|
|
5927
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
|
5928
|
+
/**
|
|
5929
|
+
* The value of this keyword MUST be a boolean. When multiple occurrences
|
|
5930
|
+
* of this keyword are applicable to a single sub-instance, applications
|
|
5931
|
+
* SHOULD consider the instance location to be deprecated if any occurrence
|
|
5932
|
+
* specifies a `true` value.
|
|
5933
|
+
*
|
|
5934
|
+
* If `deprecated` has a value of boolean `true`, it indicates that
|
|
5935
|
+
* applications SHOULD refrain from usage of the declared property. It MAY
|
|
5936
|
+
* mean the property is going to be removed in the future.
|
|
5937
|
+
*
|
|
5938
|
+
* A root schema containing `deprecated` with a value of `true`
|
|
5939
|
+
* indicates that the entire resource being described MAY be removed in the
|
|
5940
|
+
* future.
|
|
5941
|
+
*
|
|
5942
|
+
* The `deprecated` keyword applies to each instance location to which
|
|
5943
|
+
* the schema object containing the keyword successfully applies. This can
|
|
5944
|
+
* result in scenarios where every array item or object property is
|
|
5945
|
+
* deprecated even though the containing array or object is not.
|
|
5946
|
+
*
|
|
5947
|
+
* Omitting this keyword has the same behavior as a value of `false`.
|
|
5948
|
+
*/
|
|
5949
|
+
deprecated?: boolean;
|
|
5950
|
+
/**
|
|
5951
|
+
* Can be used to decorate a user interface with explanation or information
|
|
5952
|
+
* about the data produced.
|
|
5953
|
+
*/
|
|
5954
|
+
description?: string;
|
|
5955
|
+
/**
|
|
5956
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
5957
|
+
*
|
|
5958
|
+
* When `if` is present, and the instance fails to validate against its
|
|
5959
|
+
* subschema, then validation succeeds against this keyword if the instance
|
|
5960
|
+
* successfully validates against this keyword's subschema.
|
|
5961
|
+
*
|
|
5962
|
+
* This keyword has no effect when `if` is absent, or when the instance
|
|
5963
|
+
* successfully validates against its subschema. Implementations MUST NOT
|
|
5964
|
+
* evaluate the instance against this keyword, for either validation or
|
|
5965
|
+
* annotation collection purposes, in such cases.
|
|
5966
|
+
*/
|
|
5967
|
+
else?: JSONSchema<Value, SchemaType>;
|
|
5968
|
+
/**
|
|
5969
|
+
* The value of this keyword MUST be an array. This array SHOULD have at
|
|
5970
|
+
* least one element. Elements in the array SHOULD be unique.
|
|
5971
|
+
*
|
|
5972
|
+
* An instance validates successfully against this keyword if its value is
|
|
5973
|
+
* equal to one of the elements in this keyword's array value.
|
|
5974
|
+
*
|
|
5975
|
+
* Elements in the array might be of any type, including `null`.
|
|
5976
|
+
*/
|
|
5977
|
+
enum?: MaybeReadonlyArray<Value>;
|
|
5978
|
+
/**
|
|
5979
|
+
* The value of this keyword MUST be an array. When multiple occurrences of
|
|
5980
|
+
* this keyword are applicable to a single sub-instance, implementations
|
|
5981
|
+
* MUST provide a flat array of all values rather than an array of arrays.
|
|
5982
|
+
*
|
|
5983
|
+
* This keyword can be used to provide sample JSON values associated with a
|
|
5984
|
+
* particular schema, for the purpose of illustrating usage. It is
|
|
5985
|
+
* RECOMMENDED that these values be valid against the associated schema.
|
|
5986
|
+
*
|
|
5987
|
+
* Implementations MAY use the value(s) of `default`, if present, as an
|
|
5988
|
+
* additional example. If `examples` is absent, `default` MAY still be
|
|
5989
|
+
* used in this manner.
|
|
5990
|
+
*/
|
|
5991
|
+
examples?: MaybeReadonlyArray<Value>;
|
|
5992
|
+
/**
|
|
5993
|
+
* The value of `exclusiveMaximum` MUST be a number, representing an
|
|
5994
|
+
* exclusive upper limit for a numeric instance.
|
|
5995
|
+
*
|
|
5996
|
+
* If the instance is a number, then the instance is valid only if it has a
|
|
5997
|
+
* value strictly less than (not equal to) `exclusiveMaximum`.
|
|
5998
|
+
*/
|
|
5999
|
+
exclusiveMaximum?: number;
|
|
6000
|
+
/**
|
|
6001
|
+
* The value of `exclusiveMinimum` MUST be a number, representing an
|
|
6002
|
+
* exclusive lower limit for a numeric instance.
|
|
6003
|
+
*
|
|
6004
|
+
* If the instance is a number, then the instance is valid only if it has a
|
|
6005
|
+
* value strictly greater than (not equal to) `exclusiveMinimum`.
|
|
6006
|
+
*/
|
|
6007
|
+
exclusiveMinimum?: number;
|
|
6008
|
+
/**
|
|
6009
|
+
* Implementations MAY treat `format` as an assertion in addition to an
|
|
6010
|
+
* annotation, and attempt to validate the value's conformance to the
|
|
6011
|
+
* specified semantics.
|
|
6012
|
+
*
|
|
6013
|
+
* The value of this keyword is called a format attribute. It MUST be a
|
|
6014
|
+
* string. A format attribute can generally only validate a given set
|
|
6015
|
+
* of instance types. If the type of the instance to validate is not in
|
|
6016
|
+
* this set, validation for this format attribute and instance SHOULD
|
|
6017
|
+
* succeed. Format attributes are most often applied to strings, but can
|
|
6018
|
+
* be specified to apply to any type.
|
|
6019
|
+
*
|
|
6020
|
+
* Implementations MAY support custom format attributes. Save for agreement
|
|
6021
|
+
* between parties, schema authors SHALL NOT expect a peer implementation
|
|
6022
|
+
* to support such custom format attributes. An implementation MUST NOT
|
|
6023
|
+
* fail validation or cease processing due to an unknown format attribute.
|
|
6024
|
+
* When treating `format` as an annotation, implementations SHOULD
|
|
6025
|
+
* collect both known and unknown format attribute values.
|
|
6026
|
+
*/
|
|
6027
|
+
format?: string;
|
|
6028
|
+
/**
|
|
6029
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
6030
|
+
*
|
|
6031
|
+
* This validation outcome of this keyword's subschema has no direct effect
|
|
6032
|
+
* on the overall validation result. Rather, it controls which of the
|
|
6033
|
+
* `then` or `else` keywords are evaluated.
|
|
6034
|
+
*
|
|
6035
|
+
* Instances that successfully validate against this keyword's subschema
|
|
6036
|
+
* MUST also be valid against the subschema value of the `then` keyword,
|
|
6037
|
+
* if present.
|
|
6038
|
+
*
|
|
6039
|
+
* Instances that fail to validate against this keyword's subschema MUST
|
|
6040
|
+
* also be valid against the subschema value of the `else` keyword, if
|
|
6041
|
+
* present.
|
|
6042
|
+
*
|
|
6043
|
+
* If annotations are being collected, they are collected
|
|
6044
|
+
* from this keyword's subschema in the usual way, including when the
|
|
6045
|
+
* keyword is present without either `then` or `else`.
|
|
6046
|
+
*/
|
|
6047
|
+
if?: JSONSchema<Value, SchemaType>;
|
|
6048
|
+
/**
|
|
6049
|
+
* The value of `items` MUST be a valid JSON Schema.
|
|
6050
|
+
*
|
|
6051
|
+
* This keyword applies its subschema to all instance elements at indexes
|
|
6052
|
+
* greater than the length of the `prefixItems` array in the same schema
|
|
6053
|
+
* object, as reported by the annotation result of that `prefixItems`
|
|
6054
|
+
* keyword. If no such annotation result exists, `items` applies its
|
|
6055
|
+
* subschema to all instance array elements.
|
|
6056
|
+
*
|
|
6057
|
+
* Note that the behavior of `items` without `prefixItems` is identical
|
|
6058
|
+
* to that of the schema form of `items` in prior drafts.
|
|
6059
|
+
*
|
|
6060
|
+
* When `prefixItems` is present, the behavior of `items` is identical
|
|
6061
|
+
* to the former `additionalItems` keyword.
|
|
6062
|
+
*
|
|
6063
|
+
* If the `items` subschema is applied to any positions within the
|
|
6064
|
+
* instance array, it produces an annotation result of boolean `true`,
|
|
6065
|
+
* indicating that all remaining array elements have been evaluated against
|
|
6066
|
+
* this keyword's subschema.
|
|
6067
|
+
*
|
|
6068
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
|
6069
|
+
* schema.
|
|
6070
|
+
*
|
|
6071
|
+
* Implementations MAY choose to implement or optimize this keyword
|
|
6072
|
+
* in another way that produces the same effect, such as by directly
|
|
6073
|
+
* checking for the presence and size of a `prefixItems` array.
|
|
6074
|
+
*/
|
|
6075
|
+
items?: JSONSchema;
|
|
6076
|
+
/**
|
|
6077
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6078
|
+
*
|
|
6079
|
+
* If `contains` is not present within the same schema object, then this
|
|
6080
|
+
* keyword has no effect.
|
|
6081
|
+
*
|
|
6082
|
+
* An instance array is valid against `maxContains` in two ways,
|
|
6083
|
+
* depending on the form of the annotation result of an adjacent
|
|
6084
|
+
* `contains` keyword. The first way is if the annotation result is an
|
|
6085
|
+
* array and the length of that array is less than or equal to the
|
|
6086
|
+
* `maxContains` value. The second way is if the annotation result is a
|
|
6087
|
+
* boolean `true` and the instance array length is less than or equal to
|
|
6088
|
+
* the `maxContains` value.
|
|
6089
|
+
*/
|
|
6090
|
+
maxContains?: number;
|
|
6091
|
+
/**
|
|
6092
|
+
* The value of `maximum` MUST be a number, representing an inclusive
|
|
6093
|
+
* upper limit for a numeric instance.
|
|
6094
|
+
*
|
|
6095
|
+
* If the instance is a number, then this keyword validates only if the
|
|
6096
|
+
* instance is less than or exactly equal to `maximum`.
|
|
6097
|
+
*/
|
|
6098
|
+
maximum?: number;
|
|
6099
|
+
/**
|
|
6100
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6101
|
+
*
|
|
6102
|
+
* An array instance is valid against `maxItems` if its size is less
|
|
6103
|
+
* than, or equal to, the value of this keyword.
|
|
6104
|
+
*
|
|
6105
|
+
* @minimum 0
|
|
6106
|
+
*/
|
|
6107
|
+
maxItems?: number;
|
|
6108
|
+
/**
|
|
6109
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6110
|
+
*
|
|
6111
|
+
* A string instance is valid against this keyword if its length is less
|
|
6112
|
+
* than, or equal to, the value of this keyword.
|
|
6113
|
+
*
|
|
6114
|
+
* The length of a string instance is defined as the number of its
|
|
6115
|
+
* characters as defined by [RFC 8259][RFC8259].
|
|
6116
|
+
*
|
|
6117
|
+
* [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259
|
|
6118
|
+
*
|
|
6119
|
+
* @minimum 0
|
|
6120
|
+
*/
|
|
6121
|
+
maxLength?: number;
|
|
6122
|
+
/**
|
|
6123
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6124
|
+
*
|
|
6125
|
+
* An object instance is valid against `maxProperties` if its number of
|
|
6126
|
+
* `properties` is less than, or equal to, the value of this keyword.
|
|
6127
|
+
*
|
|
6128
|
+
* @minimum 0
|
|
6129
|
+
*/
|
|
6130
|
+
maxProperties?: number;
|
|
6131
|
+
/**
|
|
6132
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6133
|
+
*
|
|
6134
|
+
* If `contains` is not present within the same schema object, then this
|
|
6135
|
+
* keyword has no effect.
|
|
6136
|
+
*
|
|
6137
|
+
* An instance array is valid against `minContains` in two ways,
|
|
6138
|
+
* depending on the form of the annotation result of an adjacent
|
|
6139
|
+
* `contains` keyword. The first way is if the annotation result is an
|
|
6140
|
+
* array and the length of that array is greater than or equal to the
|
|
6141
|
+
* `minContains` value. The second way is if the annotation result is a
|
|
6142
|
+
* boolean `true` and the instance array length is greater than or equal
|
|
6143
|
+
* to the `minContains` value.
|
|
6144
|
+
*
|
|
6145
|
+
* A value of `0` is allowed, but is only useful for setting a range
|
|
6146
|
+
* of occurrences from `0` to the value of `maxContains`. A value of
|
|
6147
|
+
* `0` with no `maxContains` causes `contains` to always pass
|
|
6148
|
+
* validation.
|
|
6149
|
+
*
|
|
6150
|
+
* Omitting this keyword has the same behavior as a value of `1`.
|
|
6151
|
+
*
|
|
6152
|
+
* @default 1
|
|
6153
|
+
*/
|
|
6154
|
+
minContains?: number;
|
|
6155
|
+
/**
|
|
6156
|
+
* The value of `minimum` MUST be a number, representing an inclusive
|
|
6157
|
+
* lower limit for a numeric instance.
|
|
6158
|
+
*
|
|
6159
|
+
* If the instance is a number, then this keyword validates only if the
|
|
6160
|
+
* instance is greater than or exactly equal to `minimum`.
|
|
6161
|
+
*/
|
|
6162
|
+
minimum?: number;
|
|
6163
|
+
/**
|
|
6164
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6165
|
+
*
|
|
6166
|
+
* An array instance is valid against `minItems` if its size is greater
|
|
6167
|
+
* than, or equal to, the value of this keyword.
|
|
6168
|
+
*
|
|
6169
|
+
* Omitting this keyword has the same behavior as a value of `0`.
|
|
6170
|
+
*
|
|
6171
|
+
* @default 0
|
|
6172
|
+
* @minimum 0
|
|
6173
|
+
*/
|
|
6174
|
+
minItems?: number;
|
|
6175
|
+
/**
|
|
6176
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6177
|
+
*
|
|
6178
|
+
* A string instance is valid against this keyword if its length is greater
|
|
6179
|
+
* than, or equal to, the value of this keyword.
|
|
6180
|
+
*
|
|
6181
|
+
* The length of a string instance is defined as the number of its
|
|
6182
|
+
* characters as defined by [RFC 8259][RFC8259].
|
|
6183
|
+
*
|
|
6184
|
+
* Omitting this keyword has the same behavior as a value of `0`.
|
|
6185
|
+
*
|
|
6186
|
+
* [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259
|
|
6187
|
+
*
|
|
6188
|
+
* @default 0
|
|
6189
|
+
* @minimum 0
|
|
6190
|
+
*/
|
|
6191
|
+
minLength?: number;
|
|
6192
|
+
/**
|
|
6193
|
+
* The value of this keyword MUST be a non-negative integer.
|
|
6194
|
+
*
|
|
6195
|
+
* An object instance is valid against `minProperties` if its number of
|
|
6196
|
+
* `properties` is greater than, or equal to, the value of this keyword.
|
|
6197
|
+
*
|
|
6198
|
+
* Omitting this keyword has the same behavior as a value of `0`.
|
|
6199
|
+
*
|
|
6200
|
+
* @default 0
|
|
6201
|
+
* @minimum 0
|
|
6202
|
+
*/
|
|
6203
|
+
minProperties?: number;
|
|
6204
|
+
/**
|
|
6205
|
+
* The value of `multipleOf` MUST be a number, strictly greater than
|
|
6206
|
+
* `0`.
|
|
6207
|
+
*
|
|
6208
|
+
* A numeric instance is valid only if division by this keyword's value
|
|
6209
|
+
* results in an integer.
|
|
6210
|
+
*
|
|
6211
|
+
* @exclusiveMinimum 0
|
|
6212
|
+
*/
|
|
6213
|
+
multipleOf?: number;
|
|
6214
|
+
/**
|
|
6215
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
6216
|
+
*
|
|
6217
|
+
* An instance is valid against this keyword if it fails to validate
|
|
6218
|
+
* successfully against the schema defined by this keyword.
|
|
6219
|
+
*/
|
|
6220
|
+
not?: JSONSchema<Value, SchemaType>;
|
|
6221
|
+
/**
|
|
6222
|
+
* This keyword's value MUST be a non-empty array. Each item of the array
|
|
6223
|
+
* MUST be a valid JSON Schema.
|
|
6224
|
+
*
|
|
6225
|
+
* An instance validates successfully against this keyword if it validates
|
|
6226
|
+
* successfully against exactly one schema defined by this keyword's value.
|
|
6227
|
+
*/
|
|
6228
|
+
oneOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;
|
|
6229
|
+
/**
|
|
6230
|
+
* The value of this keyword MUST be a string. This string SHOULD be a
|
|
6231
|
+
* valid regular expression, according to the [ECMA-262][ecma262] regular
|
|
6232
|
+
* expression dialect.
|
|
6233
|
+
*
|
|
6234
|
+
* A string instance is considered valid if the regular expression matches
|
|
6235
|
+
* the instance successfully. Recall: regular expressions are not
|
|
6236
|
+
* implicitly anchored.
|
|
6237
|
+
*
|
|
6238
|
+
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
|
|
6239
|
+
*
|
|
6240
|
+
* @format "regex"
|
|
6241
|
+
*/
|
|
6242
|
+
pattern?: string;
|
|
6243
|
+
/**
|
|
6244
|
+
* The value of `patternProperties` MUST be an object. Each property name
|
|
6245
|
+
* of this object SHOULD be a valid regular expression, according to the
|
|
6246
|
+
* [ECMA-262][ecma262] regular expression dialect. Each property value of
|
|
6247
|
+
* this object MUST be a valid JSON Schema.
|
|
6248
|
+
*
|
|
6249
|
+
* Validation succeeds if, for each instance name that matches any regular
|
|
6250
|
+
* expressions that appear as a property name in this keyword's value,
|
|
6251
|
+
* the child instance for that name successfully validates against each
|
|
6252
|
+
* schema that corresponds to a matching regular expression.
|
|
6253
|
+
*
|
|
6254
|
+
* The annotation result of this keyword is the set of instance property
|
|
6255
|
+
* names matched by this keyword. Omitting this keyword has the same
|
|
6256
|
+
* assertion behavior as an empty object.
|
|
6257
|
+
*
|
|
6258
|
+
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
|
|
6259
|
+
*/
|
|
6260
|
+
patternProperties?: Record<string, JSONSchema>;
|
|
6261
|
+
/**
|
|
6262
|
+
* The value of `prefixItems` MUST be a non-empty array of valid JSON
|
|
6263
|
+
* Schemas.
|
|
6264
|
+
*
|
|
6265
|
+
* Validation succeeds if each element of the instance validates against
|
|
6266
|
+
* the schema at the same position, if any. This keyword does not
|
|
6267
|
+
* constrain the length of the array. If the array is longer than this
|
|
6268
|
+
* keyword's value, this keyword validates only the prefix of matching
|
|
6269
|
+
* length.
|
|
6270
|
+
*
|
|
6271
|
+
* This keyword produces an annotation value which is the largest index to
|
|
6272
|
+
* which this keyword applied a subschema. The value MAY be a boolean
|
|
6273
|
+
* `true` if a subschema was applied to every index of the instance, such
|
|
6274
|
+
* as is produced by the `items` keyword.
|
|
6275
|
+
* This annotation affects the behavior of `items` and
|
|
6276
|
+
* `unevaluatedItems`.
|
|
6277
|
+
*
|
|
6278
|
+
* Omitting this keyword has the same assertion behavior as an empty array.
|
|
6279
|
+
*/
|
|
6280
|
+
prefixItems?: MaybeReadonlyArray<JSONSchema> | JSONSchema;
|
|
6281
|
+
/**
|
|
6282
|
+
* The value of `properties` MUST be an object. Each value of this object
|
|
6283
|
+
* MUST be a valid JSON Schema.
|
|
6284
|
+
*
|
|
6285
|
+
* Validation succeeds if, for each name that appears in both the instance
|
|
6286
|
+
* and as a name within this keyword's value, the child instance for that
|
|
6287
|
+
* name successfully validates against the corresponding schema.
|
|
6288
|
+
*
|
|
6289
|
+
* The annotation result of this keyword is the set of instance property
|
|
6290
|
+
* names matched by this keyword.
|
|
6291
|
+
*
|
|
6292
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
|
6293
|
+
* object.
|
|
6294
|
+
*/
|
|
6295
|
+
properties?: Record<string, JSONSchema>;
|
|
6296
|
+
/**
|
|
6297
|
+
* The value of `propertyNames` MUST be a valid JSON Schema.
|
|
6298
|
+
*
|
|
6299
|
+
* If the instance is an object, this keyword validates if every property
|
|
6300
|
+
* name in the instance validates against the provided schema.
|
|
6301
|
+
* Note the property name that the schema is testing will always be a
|
|
6302
|
+
* string.
|
|
6303
|
+
*
|
|
6304
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
6305
|
+
*/
|
|
6306
|
+
propertyNames?: JSONSchema;
|
|
6307
|
+
/**
|
|
6308
|
+
* The value of this keyword MUST be a boolean. When multiple occurrences
|
|
6309
|
+
* of this keyword are applicable to a single sub-instance, the resulting
|
|
6310
|
+
* value MUST be `true` if any occurrence specifies a `true` value, and
|
|
6311
|
+
* MUST be `false` otherwise.
|
|
6312
|
+
*
|
|
6313
|
+
* If `readOnly` has a value of boolean `true`, it indicates that the
|
|
6314
|
+
* value of the instance is managed exclusively by the owning authority,
|
|
6315
|
+
* and attempts by an application to modify the value of this property are
|
|
6316
|
+
* expected to be ignored or rejected by that owning authority.
|
|
6317
|
+
*
|
|
6318
|
+
* An instance document that is marked as `readOnly` for the entire
|
|
6319
|
+
* document MAY be ignored if sent to the owning authority, or MAY result
|
|
6320
|
+
* in an error, at the authority's discretion.
|
|
6321
|
+
*
|
|
6322
|
+
* For example, `readOnly` would be used to mark a database-generated
|
|
6323
|
+
* serial number as read-only.
|
|
6324
|
+
*
|
|
6325
|
+
* This keyword can be used to assist in user interface instance
|
|
6326
|
+
* generation.
|
|
6327
|
+
*
|
|
6328
|
+
* @default false
|
|
6329
|
+
*/
|
|
6330
|
+
readOnly?: boolean;
|
|
6331
|
+
/**
|
|
6332
|
+
* The value of this keyword MUST be an array. Elements of this array, if
|
|
6333
|
+
* any, MUST be strings, and MUST be unique.
|
|
6334
|
+
*
|
|
6335
|
+
* An object instance is valid against this keyword if every item in the
|
|
6336
|
+
* array is the name of a property in the instance.
|
|
6337
|
+
*
|
|
6338
|
+
* Omitting this keyword has the same behavior as an empty array.
|
|
6339
|
+
*/
|
|
6340
|
+
required?: MaybeReadonlyArray<string>;
|
|
6341
|
+
/**
|
|
6342
|
+
* This keyword's value MUST be a valid JSON Schema.
|
|
6343
|
+
*
|
|
6344
|
+
* When `if` is present, and the instance successfully validates against
|
|
6345
|
+
* its subschema, then validation succeeds against this keyword if the
|
|
6346
|
+
* instance also successfully validates against this keyword's subschema.
|
|
6347
|
+
*
|
|
6348
|
+
* This keyword has no effect when `if` is absent, or when the instance
|
|
6349
|
+
* fails to validate against its subschema. Implementations MUST NOT
|
|
6350
|
+
* evaluate the instance against this keyword, for either validation or
|
|
6351
|
+
* annotation collection purposes, in such cases.
|
|
6352
|
+
*/
|
|
6353
|
+
then?: JSONSchema<Value, SchemaType>;
|
|
6354
|
+
/**
|
|
6355
|
+
* Can be used to decorate a user interface with a short label about the
|
|
6356
|
+
* data produced.
|
|
6357
|
+
*/
|
|
6358
|
+
title?: string;
|
|
6359
|
+
/**
|
|
6360
|
+
* The value of this keyword MUST be either a string or an array. If it is
|
|
6361
|
+
* an array, elements of the array MUST be strings and MUST be unique.
|
|
6362
|
+
*
|
|
6363
|
+
* String values MUST be one of the six primitive types (`"null"`,
|
|
6364
|
+
* `"boolean"`, `"object"`, `"array"`, `"number"`, or
|
|
6365
|
+
* `"string"`), or `"integer"` which matches any number with a zero
|
|
6366
|
+
* fractional part.
|
|
6367
|
+
*
|
|
6368
|
+
* An instance validates if and only if the instance is in any of the sets
|
|
6369
|
+
* listed for this keyword.
|
|
6370
|
+
*/
|
|
6371
|
+
type?: SchemaType;
|
|
6372
|
+
/**
|
|
6373
|
+
* The value of `unevaluatedItems` MUST be a valid JSON Schema.
|
|
6374
|
+
*
|
|
6375
|
+
* The behavior of this keyword depends on the annotation results of
|
|
6376
|
+
* adjacent keywords that apply to the instance location being validated.
|
|
6377
|
+
* Specifically, the annotations from `prefixItems`, `items`, and
|
|
6378
|
+
* `contains`, which can come from those keywords when they are adjacent
|
|
6379
|
+
* to the `unevaluatedItems` keyword. Those three annotations, as well as
|
|
6380
|
+
* `unevaluatedItems`, can also result from any and all adjacent
|
|
6381
|
+
* [in-place applicator][in-place-applicator] keywords.
|
|
6382
|
+
*
|
|
6383
|
+
* If no relevant annotations are present, the `unevaluatedItems`
|
|
6384
|
+
* subschema MUST be applied to all locations in the array.
|
|
6385
|
+
* If a boolean `true` value is present from any of the relevant
|
|
6386
|
+
* annotations, `unevaluatedItems` MUST be ignored. Otherwise, the
|
|
6387
|
+
* subschema MUST be applied to any index greater than the largest
|
|
6388
|
+
* annotation value for `prefixItems`, which does not appear in any
|
|
6389
|
+
* annotation value for `contains`.
|
|
6390
|
+
*
|
|
6391
|
+
* This means that `prefixItems`, `items`, `contains`, and all
|
|
6392
|
+
* in-place applicators MUST be evaluated before this keyword can be
|
|
6393
|
+
* evaluated. Authors of extension keywords MUST NOT define an in-place
|
|
6394
|
+
* applicator that would need to be evaluated after this keyword.
|
|
6395
|
+
*
|
|
6396
|
+
* If the `unevaluatedItems` subschema is applied to any positions within
|
|
6397
|
+
* the instance array, it produces an annotation result of boolean
|
|
6398
|
+
* `true`, analogous to the behavior of `items`.
|
|
6399
|
+
*
|
|
6400
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
|
6401
|
+
* schema.
|
|
6402
|
+
*
|
|
6403
|
+
* [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place
|
|
6404
|
+
*/
|
|
6405
|
+
unevaluatedItems?: JSONSchema;
|
|
6406
|
+
/**
|
|
6407
|
+
* The value of `unevaluatedProperties` MUST be a valid JSON Schema.
|
|
6408
|
+
*
|
|
6409
|
+
* The behavior of this keyword depends on the annotation results of
|
|
6410
|
+
* adjacent keywords that apply to the instance location being validated.
|
|
6411
|
+
* Specifically, the annotations from `properties`,
|
|
6412
|
+
* `patternProperties`, and `additionalProperties`, which can come from
|
|
6413
|
+
* those keywords when they are adjacent to the `unevaluatedProperties`
|
|
6414
|
+
* keyword. Those three annotations, as well as `unevaluatedProperties`,
|
|
6415
|
+
* can also result from any and all adjacent
|
|
6416
|
+
* [in-place applicator][in-place-applicator] keywords.
|
|
6417
|
+
*
|
|
6418
|
+
* Validation with `unevaluatedProperties` applies only to the child
|
|
6419
|
+
* values of instance names that do not appear in the `properties`,
|
|
6420
|
+
* `patternProperties`, `additionalProperties`, or
|
|
6421
|
+
* `unevaluatedProperties` annotation results that apply to the
|
|
6422
|
+
* instance location being validated.
|
|
6423
|
+
*
|
|
6424
|
+
* For all such properties, validation succeeds if the child instance
|
|
6425
|
+
* validates against the "unevaluatedProperties" schema.
|
|
6426
|
+
*
|
|
6427
|
+
* This means that `properties`, `patternProperties`,
|
|
6428
|
+
* `additionalProperties`, and all in-place applicators MUST be evaluated
|
|
6429
|
+
* before this keyword can be evaluated. Authors of extension keywords
|
|
6430
|
+
* MUST NOT define an in-place applicator that would need to be evaluated
|
|
6431
|
+
* after this keyword.
|
|
6432
|
+
*
|
|
6433
|
+
* The annotation result of this keyword is the set of instance property
|
|
6434
|
+
* names validated by this keyword's subschema.
|
|
6435
|
+
*
|
|
6436
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
|
6437
|
+
* schema.
|
|
6438
|
+
*
|
|
6439
|
+
* [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place
|
|
6440
|
+
*/
|
|
6441
|
+
unevaluatedProperties?: JSONSchema;
|
|
6442
|
+
/**
|
|
6443
|
+
* The value of this keyword MUST be a boolean.
|
|
6444
|
+
*
|
|
6445
|
+
* If this keyword has boolean value `false`, the instance validates
|
|
6446
|
+
* successfully. If it has boolean value `true`, the instance validates
|
|
6447
|
+
* successfully if all of its elements are unique.
|
|
6448
|
+
*
|
|
6449
|
+
* Omitting this keyword has the same behavior as a value of `false`.
|
|
6450
|
+
*
|
|
6451
|
+
* @default false
|
|
6452
|
+
*/
|
|
6453
|
+
uniqueItems?: boolean;
|
|
6454
|
+
/**
|
|
6455
|
+
* The value of this keyword MUST be a boolean. When multiple occurrences
|
|
6456
|
+
* of this keyword is applicable to a single sub-instance, the resulting
|
|
6457
|
+
* value MUST be `true` if any occurrence specifies a `true` value, and
|
|
6458
|
+
* MUST be `false` otherwise.
|
|
6459
|
+
*
|
|
6460
|
+
* If `writeOnly` has a value of boolean `true`, it indicates that the
|
|
6461
|
+
* value is never present when the instance is retrieved from the owning
|
|
6462
|
+
* authority. It can be present when sent to the owning authority to update
|
|
6463
|
+
* or create the document (or the resource it represents), but it will not
|
|
6464
|
+
* be included in any updated or newly created version of the instance.
|
|
6465
|
+
*
|
|
6466
|
+
* An instance document that is marked as `writeOnly` for the entire
|
|
6467
|
+
* document MAY be returned as a blank document of some sort, or MAY
|
|
6468
|
+
* produce an error upon retrieval, or have the retrieval request ignored,
|
|
6469
|
+
* at the authority's discretion.
|
|
6470
|
+
*
|
|
6471
|
+
* For example, `writeOnly` would be used to mark a password input field.
|
|
6472
|
+
*
|
|
6473
|
+
* These keywords can be used to assist in user interface instance
|
|
6474
|
+
* generation. In particular, an application MAY choose to use a widget
|
|
6475
|
+
* that hides input values as they are typed for write-only fields.
|
|
6476
|
+
*
|
|
6477
|
+
* @default false
|
|
6478
|
+
*/
|
|
6479
|
+
writeOnly?: boolean;
|
|
6480
|
+
};
|
|
6481
|
+
declare namespace JSONSchema {
|
|
6482
|
+
type TypeValue = ValueOf<TypeName> | TypeName | Array<ValueOf<TypeName> | TypeName> | ReadonlyArray<ValueOf<TypeName> | TypeName>;
|
|
6483
|
+
/**
|
|
6484
|
+
* JSON Schema interface
|
|
6485
|
+
*/
|
|
6486
|
+
type Interface<Value = any, SchemaType extends TypeValue = TypeValue> = Exclude<JSONSchema<Value, SchemaType>, boolean>;
|
|
6487
|
+
type Array<T = any> = Pick<Interface<T, "array">, KeywordByType.Any | KeywordByType.Array>;
|
|
6488
|
+
type Boolean = Pick<Interface<boolean, "boolean">, KeywordByType.Any>;
|
|
6489
|
+
type Integer = Pick<Interface<number, "integer">, KeywordByType.Any | KeywordByType.Number>;
|
|
6490
|
+
type Number = Pick<Interface<number, "number">, KeywordByType.Any | KeywordByType.Number>;
|
|
6491
|
+
type Null = Pick<Interface<null, "null">, KeywordByType.Any>;
|
|
6492
|
+
type Object<T = any> = Pick<Interface<T, "object">, KeywordByType.Any | KeywordByType.Object>;
|
|
6493
|
+
type String = Pick<Interface<string, "string">, KeywordByType.Any | KeywordByType.String>;
|
|
5268
6494
|
}
|
|
5269
|
-
declare
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
type
|
|
5273
|
-
type
|
|
5274
|
-
|
|
5275
|
-
output: JSONType;
|
|
5276
|
-
input: JSONType;
|
|
6495
|
+
declare namespace KeywordByType {
|
|
6496
|
+
type Any = "$anchor" | "$comment" | "$defs" | "$dynamicAnchor" | "$dynamicRef" | "$id" | "$ref" | "$schema" | "$vocabulary" | "allOf" | "anyOf" | "const" | "default" | "definitions" | "deprecated" | "description" | "else" | "enum" | "examples" | "format" | "if" | "not" | "oneOf" | "readOnly" | "then" | "title" | "type" | "writeOnly";
|
|
6497
|
+
type Array = "additionalItems" | "contains" | "items" | "maxContains" | "maxItems" | "minContains" | "minItems" | "prefixItems" | "unevaluatedItems" | "uniqueItems";
|
|
6498
|
+
type Number = "exclusiveMaximum" | "exclusiveMinimum" | "maximum" | "minimum" | "multipleOf";
|
|
6499
|
+
type Object = "additionalProperties" | "dependencies" | "dependentRequired" | "dependentSchemas" | "maxProperties" | "minProperties" | "patternProperties" | "properties" | "propertyNames" | "required" | "unevaluatedProperties";
|
|
6500
|
+
type String = "contentEncoding" | "contentMediaType" | "contentSchema" | "maxLength" | "minLength" | "pattern";
|
|
5277
6501
|
}
|
|
5278
|
-
|
|
5279
|
-
|
|
6502
|
+
/**
|
|
6503
|
+
* Content encoding strategy enum.
|
|
6504
|
+
*
|
|
6505
|
+
* - [Content-Transfer-Encoding Syntax](https://datatracker.ietf.org/doc/html/rfc2045#section-6.1)
|
|
6506
|
+
* - [7bit vs 8bit encoding](https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705)
|
|
6507
|
+
*/
|
|
6508
|
+
/**
|
|
6509
|
+
* Enum consisting of simple type names for the `type` keyword
|
|
6510
|
+
*/
|
|
6511
|
+
declare enum TypeName {
|
|
6512
|
+
/**
|
|
6513
|
+
* Value MUST be an array.
|
|
6514
|
+
*/
|
|
6515
|
+
Array = "array",
|
|
6516
|
+
/**
|
|
6517
|
+
* Value MUST be a boolean.
|
|
6518
|
+
*/
|
|
6519
|
+
Boolean = "boolean",
|
|
6520
|
+
/**
|
|
6521
|
+
* Value MUST be an integer, no floating point numbers are allowed. This is a
|
|
6522
|
+
* subset of the number type.
|
|
6523
|
+
*/
|
|
6524
|
+
Integer = "integer",
|
|
6525
|
+
/**
|
|
6526
|
+
* Value MUST be null. Note this is mainly for purpose of being able use union
|
|
6527
|
+
* types to define nullability. If this type is not included in a union, null
|
|
6528
|
+
* values are not allowed (the primitives listed above do not allow nulls on
|
|
6529
|
+
* their own).
|
|
6530
|
+
*/
|
|
6531
|
+
Null = "null",
|
|
6532
|
+
/**
|
|
6533
|
+
* Value MUST be a number, floating point numbers are allowed.
|
|
6534
|
+
*/
|
|
6535
|
+
Number = "number",
|
|
6536
|
+
/**
|
|
6537
|
+
* Value MUST be an object.
|
|
6538
|
+
*/
|
|
6539
|
+
Object = "object",
|
|
6540
|
+
/**
|
|
6541
|
+
* Value MUST be a string.
|
|
6542
|
+
*/
|
|
6543
|
+
String = "string"
|
|
5280
6544
|
}
|
|
5281
|
-
declare function json(params?: string | $ZodCustomParams): ZodJSONSchema;
|
|
5282
|
-
declare function preprocess<A, U extends SomeType, B = unknown>(fn: (arg: B, ctx: $RefinementCtx) => A, schema: U): ZodPreprocess<U, B>;
|
|
5283
6545
|
//#endregion
|
|
5284
|
-
//#region
|
|
5285
|
-
/**
|
|
5286
|
-
type
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
/** @deprecated Use `z.core.$ZodFormattedError<z.output<T>>` instead; it takes an inferred type, not a schema. */
|
|
5308
|
-
type inferFormattedError<T extends $ZodType<any, any>, U = string> = $ZodFormattedError<output$1<T>, U>;
|
|
5309
|
-
/** Use `z.$brand` instead */
|
|
5310
|
-
type BRAND<T extends string | number | symbol = string | number | symbol> = {
|
|
5311
|
-
[$brand]: { [k in T]: true; };
|
|
6546
|
+
//#region ../core-internal/src/validators/types.d.ts
|
|
6547
|
+
/**
|
|
6548
|
+
* JSON Schema type definition (JSON Schema Draft 2020-12)
|
|
6549
|
+
*
|
|
6550
|
+
* This uses the object form of JSON Schema (excluding boolean schemas).
|
|
6551
|
+
* While `true` and `false` are valid JSON Schemas, this SDK uses the
|
|
6552
|
+
* object form for practical type safety.
|
|
6553
|
+
*
|
|
6554
|
+
* Re-exported from json-schema-typed for convenience.
|
|
6555
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core.html
|
|
6556
|
+
*/
|
|
6557
|
+
type JsonSchemaType = JSONSchema.Interface;
|
|
6558
|
+
/**
|
|
6559
|
+
* Result of a JSON Schema validation operation
|
|
6560
|
+
*/
|
|
6561
|
+
type JsonSchemaValidatorResult<T> = {
|
|
6562
|
+
valid: true;
|
|
6563
|
+
data: T;
|
|
6564
|
+
errorMessage: undefined;
|
|
6565
|
+
} | {
|
|
6566
|
+
valid: false;
|
|
6567
|
+
data: undefined;
|
|
6568
|
+
errorMessage: string;
|
|
5312
6569
|
};
|
|
5313
|
-
/** @deprecated Use `z.config(params)` instead. */
|
|
5314
|
-
declare function setErrorMap(map: $ZodErrorMap): void;
|
|
5315
|
-
/** @deprecated Use `z.config()` instead. */
|
|
5316
|
-
declare function getErrorMap(): $ZodErrorMap<$ZodIssue> | undefined;
|
|
5317
|
-
/** @deprecated Use z.ZodType (without generics) instead. */
|
|
5318
|
-
type ZodTypeAny<Output = unknown, Input = unknown, Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> = ZodType<Output, Input, Internals>;
|
|
5319
|
-
/** @deprecated Use `z.ZodType` */
|
|
5320
|
-
type ZodSchema<Output = unknown, Input = unknown, Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> = ZodType<Output, Input, Internals>;
|
|
5321
|
-
/** @deprecated Use `z.ZodType` */
|
|
5322
|
-
type Schema<Output = unknown, Input = unknown, Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> = ZodType<Output, Input, Internals>;
|
|
5323
|
-
/** Included for Zod 3 compatibility */
|
|
5324
|
-
type ZodRawShape$1 = $ZodShape;
|
|
5325
|
-
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
5326
|
-
declare enum ZodFirstPartyTypeKind {}
|
|
5327
|
-
//#endregion
|
|
5328
|
-
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/from-json-schema.d.cts
|
|
5329
|
-
type JSONSchemaVersion = "draft-2020-12" | "draft-7" | "draft-4" | "openapi-3.0";
|
|
5330
|
-
interface FromJSONSchemaParams {
|
|
5331
|
-
defaultTarget?: JSONSchemaVersion;
|
|
5332
|
-
registry?: $ZodRegistry<any>;
|
|
5333
|
-
}
|
|
5334
6570
|
/**
|
|
5335
|
-
*
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
interface
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
interface ZodCoercedDate<T = unknown> extends _ZodDate<$ZodDateInternals<T>> {}
|
|
5370
|
-
declare function date<T = unknown>(params?: string | $ZodDateParams): ZodCoercedDate<T>;
|
|
5371
|
-
declare namespace external_d_exports {
|
|
5372
|
-
export { $brand, $input, $output, BRAND, CompileOptions, GlobalMeta, INVALID, Infer$1 as Infer, IssueData, JSONType, NEVER, $RefinementCtx as RefinementCtx, SafeExtendShape, Schema, TimePrecision, TypeOf, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCoercedBigInt, ZodCoercedBoolean, ZodCoercedDate, ZodCoercedNumber, ZodCoercedString, ZodCompileAsyncError, ZodCompileUnsupportedError, ZodCreditCard, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodErrorMap, ZodExactOptional, ZodFile, ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind, ZodFlattenedError, ZodFloat32, ZodFloat64, ZodFormattedError, ZodFunction, ZodGUID, ZodIBAN, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodInstanceOf, ZodInt, ZodInt32, ZodInt64, ZodIntersection, ZodIssue, ZodIssueCode, ZodJSONSchema, ZodJSONSchemaInternals, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPreprocess, ZodPromise, ZodRawShape$1 as ZodRawShape, ZodReadonly, ZodRealError, ZodRecord, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodSchema, ZodSet, ZodStandardSchemaWithJSON, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodTypeAny, ZodUInt32, ZodUInt64, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber, _ZodString, _ZodType, _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch as catch, check, cidrv4, cidrv6, clone, codec, coerce_d_exports as coerce, compile, config, index_d_exports$1 as core, creditCard, cuid, cuid2, currencyCode, custom, date$2 as date, decode, decodeAsync, deepPartial, describe, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _endsWith as endsWith, _enum as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getDiscriminatedOption, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, iban, _includes as includes, output$1 as infer, inferFlattenedErrors, inferFormattedError, input, _instanceof as instanceof, int, int32, int64, intersection, invertCodec, ipv4, ipv6, iso_d_exports as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index_d_exports$2 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, memoizer, meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null as null, nullable, nullish, number$1 as number, object, optional, output, _overwrite as overwrite, parse, parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _properties as properties, _property as property, readonly, record, refine, _regex as regex, regexes_d_exports as regexes, registry, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, toZod, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, _uppercase as uppercase, url, util_d_exports as util, uuid, uuidv4, uuidv6, uuidv7, validate, validateAsync, _void as void, withParser, xid, xor };
|
|
6571
|
+
* A validator function that validates data against a JSON Schema
|
|
6572
|
+
*/
|
|
6573
|
+
type JsonSchemaValidator<T> = (input: unknown) => JsonSchemaValidatorResult<T>;
|
|
6574
|
+
/**
|
|
6575
|
+
* Provider interface for creating validators from JSON Schemas
|
|
6576
|
+
*
|
|
6577
|
+
* This is the main extension point for custom validator implementations.
|
|
6578
|
+
* Implementations should:
|
|
6579
|
+
* - Support JSON Schema Draft 2020-12 (or be compatible with it)
|
|
6580
|
+
* - Return validator functions that can be called multiple times
|
|
6581
|
+
* - Handle schema compilation/caching internally
|
|
6582
|
+
* - Provide clear error messages on validation failure
|
|
6583
|
+
*
|
|
6584
|
+
* @example
|
|
6585
|
+
* ```ts source="./types.examples.ts#jsonSchemaValidator_implementation"
|
|
6586
|
+
* class MyValidatorProvider implements jsonSchemaValidator {
|
|
6587
|
+
* getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T> {
|
|
6588
|
+
* // Compile/cache validator from schema
|
|
6589
|
+
* return (input: unknown) =>
|
|
6590
|
+
* isValid(schema, input)
|
|
6591
|
+
* ? { valid: true, data: input as T, errorMessage: undefined }
|
|
6592
|
+
* : { valid: false, data: undefined, errorMessage: 'Error details' };
|
|
6593
|
+
* }
|
|
6594
|
+
* }
|
|
6595
|
+
* ```
|
|
6596
|
+
*/
|
|
6597
|
+
interface jsonSchemaValidator {
|
|
6598
|
+
/**
|
|
6599
|
+
* Create a validator for the given JSON Schema
|
|
6600
|
+
*
|
|
6601
|
+
* @param schema - Standard JSON Schema object
|
|
6602
|
+
* @returns A validator function that can be called multiple times
|
|
6603
|
+
*/
|
|
6604
|
+
getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T>;
|
|
5373
6605
|
}
|
|
5374
6606
|
declare namespace index_d_exports {
|
|
5375
6607
|
export { $brand, $input, $output, BRAND, CompileOptions, GlobalMeta, INVALID, Infer$1 as Infer, IssueData, JSONType, NEVER, $RefinementCtx as RefinementCtx, SafeExtendShape, Schema, TimePrecision, TypeOf, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCoercedBigInt, ZodCoercedBoolean, ZodCoercedDate, ZodCoercedNumber, ZodCoercedString, ZodCompileAsyncError, ZodCompileUnsupportedError, ZodCreditCard, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodErrorMap, ZodExactOptional, ZodFile, ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind, ZodFlattenedError, ZodFloat32, ZodFloat64, ZodFormattedError, ZodFunction, ZodGUID, ZodIBAN, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodInstanceOf, ZodInt, ZodInt32, ZodInt64, ZodIntersection, ZodIssue, ZodIssueCode, ZodJSONSchema, ZodJSONSchemaInternals, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPreprocess, ZodPromise, ZodRawShape$1 as ZodRawShape, ZodReadonly, ZodRealError, ZodRecord, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodSchema, ZodSet, ZodStandardSchemaWithJSON, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodTypeAny, ZodUInt32, ZodUInt64, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber, _ZodString, _ZodType, _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch as catch, check, cidrv4, cidrv6, clone, codec, coerce_d_exports as coerce, compile, config, index_d_exports$1 as core, creditCard, cuid, cuid2, currencyCode, custom, date$2 as date, decode, decodeAsync, deepPartial, external_d_exports as default, describe, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _endsWith as endsWith, _enum as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getDiscriminatedOption, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, iban, _includes as includes, output$1 as infer, inferFlattenedErrors, inferFormattedError, input, _instanceof as instanceof, int, int32, int64, intersection, invertCodec, ipv4, ipv6, iso_d_exports as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index_d_exports$2 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, memoizer, meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null as null, nullable, nullish, number$1 as number, object, optional, output, _overwrite as overwrite, parse, parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _properties as properties, _property as property, readonly, record, refine, _regex as regex, regexes_d_exports as regexes, registry, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, toZod, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, _uppercase as uppercase, url, util_d_exports as util, uuid, uuidv4, uuidv6, uuidv7, validate, validateAsync, _void as void, withParser, xid, xor, external_d_exports as z };
|
|
@@ -11533,9 +12765,16 @@ interface SourceIo {
|
|
|
11533
12765
|
* Accounts are core's (`config.json`'s `accounts`), read through core's `ConfigStore`; the person's chat lists are this
|
|
11534
12766
|
* package's own file (`lists.ts`). The first read of the configuration in a process moves the spike's accounts in, when
|
|
11535
12767
|
* there are any (`spike-migration.ts`).
|
|
12768
|
+
*
|
|
12769
|
+
* Core is opened with this package as its caller, so every command this tells a person to run — its own, core's — is
|
|
12770
|
+
* located from here: this Node and this installation's CLI, with the folders of this run pinned, or the sentence saying
|
|
12771
|
+
* there is none (CUE-403; CONTRIBUTING.md, "Telling a person what to run"). `handoffs` makes them.
|
|
11536
12772
|
*/
|
|
11537
12773
|
interface WhatsAppContextOptions {
|
|
12774
|
+
core?: Core | undefined;
|
|
11538
12775
|
env?: NodeJS.ProcessEnv | undefined;
|
|
12776
|
+
/** Explicit suite directories, resolved before any store is constructed. */
|
|
12777
|
+
pathOverrides?: PathOverrides | undefined;
|
|
11539
12778
|
now?: (() => Date) | undefined;
|
|
11540
12779
|
surface?: "cli" | "mcp" | undefined;
|
|
11541
12780
|
/**
|
|
@@ -11567,6 +12806,9 @@ interface WhatsAppContextOptions {
|
|
|
11567
12806
|
* **Pinned** (`agent-whatsapp mcp --account acme/whatsapp`, which `mcp install --account` writes): every call acts on
|
|
11568
12807
|
* that account, `account` may be left out, any other is refused, and nothing about another account is said — not in
|
|
11569
12808
|
* the greeting, not in `whatsapp_status`. The pin is held by the account's id, so a rename follows it.
|
|
12809
|
+
*
|
|
12810
|
+
* The greeting names no command (CUE-403): what a person runs is in the result that needs it — `whatsapp_status`'s
|
|
12811
|
+
* `setup`, a refusal's `hint` — located from this installation when it is asked for.
|
|
11570
12812
|
*/
|
|
11571
12813
|
interface WhatsAppMcpOptions extends WhatsAppContextOptions {}
|
|
11572
12814
|
interface WhatsAppMcpServer {
|
|
@@ -11599,7 +12841,4 @@ export declare function composeDraft(request: {
|
|
|
11599
12841
|
text: string;
|
|
11600
12842
|
}): DraftResult;
|
|
11601
12843
|
//#endregion
|
|
11602
|
-
//#region src/index.d.ts
|
|
11603
|
-
export declare const PACKAGE_NAME = "@agentcomms/whatsapp";
|
|
11604
|
-
//#endregion
|
|
11605
12844
|
export type { DraftResult, WhatsAppMcpOptions, WhatsAppMcpServer };
|