@modelcontextprotocol/server 2.0.0-beta.1 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/ajvProvider-D2kRT_qB.d.cts +1030 -0
  2. package/dist/ajvProvider-D2kRT_qB.d.cts.map +1 -0
  3. package/dist/ajvProvider-DhTNkgm1.cjs +7059 -0
  4. package/dist/ajvProvider-DhTNkgm1.cjs.map +1 -0
  5. package/dist/cfWorkerProvider-Djgwc46-.cjs +976 -0
  6. package/dist/cfWorkerProvider-Djgwc46-.cjs.map +1 -0
  7. package/dist/cfWorkerProvider-RncldJmy.d.cts +59 -0
  8. package/dist/cfWorkerProvider-RncldJmy.d.cts.map +1 -0
  9. package/dist/chunk-Bnu9O96Y.cjs +60 -0
  10. package/dist/createMcpHandler-Du3hjXvf.d.mts.map +1 -1
  11. package/dist/createMcpHandler-DyxapqGO.d.cts +11190 -0
  12. package/dist/createMcpHandler-DyxapqGO.d.cts.map +1 -0
  13. package/dist/index.cjs +1657 -0
  14. package/dist/index.cjs.map +1 -0
  15. package/dist/index.d.cts +1745 -0
  16. package/dist/index.d.cts.map +1 -0
  17. package/dist/index.mjs +3 -2
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/{mcp-JttQJlI9.mjs → mcp-C2tFGfLG.mjs} +18 -5
  20. package/dist/mcp-C2tFGfLG.mjs.map +1 -0
  21. package/dist/mcp-DVEehpM2.cjs +10545 -0
  22. package/dist/mcp-DVEehpM2.cjs.map +1 -0
  23. package/dist/shimsNode.cjs +12 -0
  24. package/dist/shimsNode.d.cts +3 -0
  25. package/dist/shimsWorkerd.cjs +23 -0
  26. package/dist/shimsWorkerd.cjs.map +1 -0
  27. package/dist/shimsWorkerd.d.cts +11 -0
  28. package/dist/shimsWorkerd.d.cts.map +1 -0
  29. package/dist/stdio.cjs +563 -0
  30. package/dist/stdio.cjs.map +1 -0
  31. package/dist/stdio.d.cts +107 -0
  32. package/dist/stdio.d.cts.map +1 -0
  33. package/dist/stdio.mjs +1 -1
  34. package/dist/types-Pc2fJzyM.d.cts +1099 -0
  35. package/dist/types-Pc2fJzyM.d.cts.map +1 -0
  36. package/dist/validators/ajv.cjs +10 -0
  37. package/dist/validators/ajv.d.cts +2 -0
  38. package/dist/validators/cfWorker.cjs +3 -0
  39. package/dist/validators/cfWorker.d.cts +2 -0
  40. package/package.json +68 -19
  41. package/dist/mcp-JttQJlI9.mjs.map +0 -1
@@ -0,0 +1,1030 @@
1
+ import { i as jsonSchemaValidator, n as JsonSchemaValidator, t as JsonSchemaType } from "./types-Pc2fJzyM.cjs";
2
+
3
+ //#region ../core-internal/src/validators/fastUriShim.d.ts
4
+
5
+ /**
6
+ * dts-bundling shim for `fast-uri`.
7
+ *
8
+ * ajv@8.18.0's published .d.ts does `import { URIComponent } from "fast-uri"`,
9
+ * but fast-uri ships its types as `export = namespace`, which rolldown's dts
10
+ * bundler can't destructure into a named import — it drops the import and
11
+ * leaves a dangling `URIComponent` reference in the bundled .d.mts (TS2304 for
12
+ * downstream consumers with `skipLibCheck: false`).
13
+ *
14
+ * The server/client tsdown configs map `fast-uri` to this file via
15
+ * `dts.compilerOptions.paths` so the type is inlined as a plain named export.
16
+ * Runtime code is unaffected (this is a `.d.ts`; the path mapping is dts-only).
17
+ */
18
+ // Field-for-field copy of fast-uri@3.1.0's URIComponent (types/index.d.ts).
19
+ // Keep in sync when bumping fast-uri/ajv.
20
+ interface URIComponent {
21
+ scheme?: string;
22
+ userinfo?: string;
23
+ host?: string;
24
+ port?: number | string;
25
+ path?: string;
26
+ query?: string;
27
+ fragment?: string;
28
+ reference?: string;
29
+ nid?: string;
30
+ nss?: string;
31
+ resourceName?: string;
32
+ secure?: boolean;
33
+ uuid?: string;
34
+ error?: string;
35
+ }
36
+ //#endregion
37
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.d.ts
38
+ declare abstract class _CodeOrName {
39
+ abstract readonly str: string;
40
+ abstract readonly names: UsedNames;
41
+ abstract toString(): string;
42
+ abstract emptyStr(): boolean;
43
+ }
44
+ declare class Name extends _CodeOrName {
45
+ readonly str: string;
46
+ constructor(s: string);
47
+ toString(): string;
48
+ emptyStr(): boolean;
49
+ get names(): UsedNames;
50
+ }
51
+ declare class _Code extends _CodeOrName {
52
+ readonly _items: readonly CodeItem[];
53
+ private _str?;
54
+ private _names?;
55
+ constructor(code: string | readonly CodeItem[]);
56
+ toString(): string;
57
+ emptyStr(): boolean;
58
+ get str(): string;
59
+ get names(): UsedNames;
60
+ }
61
+ type CodeItem = Name | string | number | boolean | null;
62
+ type UsedNames = Record<string, number | undefined>;
63
+ type Code = _Code | Name;
64
+ //#endregion
65
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.d.ts
66
+ interface NameGroup {
67
+ prefix: string;
68
+ index: number;
69
+ }
70
+ interface NameValue {
71
+ ref: ValueReference;
72
+ key?: unknown;
73
+ code?: Code;
74
+ }
75
+ type ValueReference = unknown;
76
+ interface ScopeOptions {
77
+ prefixes?: Set<string>;
78
+ parent?: Scope;
79
+ }
80
+ interface ValueScopeOptions extends ScopeOptions {
81
+ scope: ScopeStore;
82
+ es5?: boolean;
83
+ lines?: boolean;
84
+ }
85
+ type ScopeStore = Record<string, ValueReference[] | undefined>;
86
+ type ScopeValues = { [Prefix in string]?: Map<unknown, ValueScopeName> };
87
+ type ScopeValueSets = { [Prefix in string]?: Set<ValueScopeName> };
88
+ declare enum UsedValueState {
89
+ Started = 0,
90
+ Completed = 1,
91
+ }
92
+ type UsedScopeValues = { [Prefix in string]?: Map<ValueScopeName, UsedValueState | undefined> };
93
+ declare class Scope {
94
+ protected readonly _names: { [Prefix in string]?: NameGroup };
95
+ protected readonly _prefixes?: Set<string>;
96
+ protected readonly _parent?: Scope;
97
+ constructor({
98
+ prefixes,
99
+ parent
100
+ }?: ScopeOptions);
101
+ toName(nameOrPrefix: Name | string): Name;
102
+ name(prefix: string): Name;
103
+ protected _newName(prefix: string): string;
104
+ private _nameGroup;
105
+ }
106
+ interface ScopePath {
107
+ property: string;
108
+ itemIndex: number;
109
+ }
110
+ declare class ValueScopeName extends Name {
111
+ readonly prefix: string;
112
+ value?: NameValue;
113
+ scopePath?: Code;
114
+ constructor(prefix: string, nameStr: string);
115
+ setValue(value: NameValue, {
116
+ property,
117
+ itemIndex
118
+ }: ScopePath): void;
119
+ }
120
+ interface VSOptions extends ValueScopeOptions {
121
+ _n: Code;
122
+ }
123
+ declare class ValueScope extends Scope {
124
+ protected readonly _values: ScopeValues;
125
+ protected readonly _scope: ScopeStore;
126
+ readonly opts: VSOptions;
127
+ constructor(opts: ValueScopeOptions);
128
+ get(): ScopeStore;
129
+ name(prefix: string): ValueScopeName;
130
+ value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName;
131
+ getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
132
+ scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code;
133
+ scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code;
134
+ private _reduceValues;
135
+ }
136
+ //#endregion
137
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.d.ts
138
+ type SafeExpr = Code | number | boolean | null;
139
+ type Block = Code | (() => void);
140
+ interface CodeGenOptions {
141
+ es5?: boolean;
142
+ lines?: boolean;
143
+ ownProperties?: boolean;
144
+ }
145
+ declare class CodeGen {
146
+ readonly _scope: Scope;
147
+ readonly _extScope: ValueScope;
148
+ readonly _values: ScopeValueSets;
149
+ private readonly _nodes;
150
+ private readonly _blockStarts;
151
+ private readonly _constants;
152
+ private readonly opts;
153
+ constructor(extScope: ValueScope, opts?: CodeGenOptions);
154
+ toString(): string;
155
+ name(prefix: string): Name;
156
+ scopeName(prefix: string): ValueScopeName;
157
+ scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name;
158
+ getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
159
+ scopeRefs(scopeName: Name): Code;
160
+ scopeCode(): Code;
161
+ private _def;
162
+ const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name;
163
+ let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
164
+ var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
165
+ assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen;
166
+ add(lhs: Code, rhs: SafeExpr): CodeGen;
167
+ code(c: Block | SafeExpr): CodeGen;
168
+ object(...keyValues: [Name | string, SafeExpr | string][]): _Code;
169
+ if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen;
170
+ elseIf(condition: Code | boolean): CodeGen;
171
+ else(): CodeGen;
172
+ endIf(): CodeGen;
173
+ private _for;
174
+ for(iteration: Code, forBody?: Block): CodeGen;
175
+ forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen;
176
+ forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
177
+ forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
178
+ endFor(): CodeGen;
179
+ label(label: Name): CodeGen;
180
+ break(label?: Code): CodeGen;
181
+ return(value: Block | SafeExpr): CodeGen;
182
+ try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen;
183
+ throw(error: Code): CodeGen;
184
+ block(body?: Block, nodeCount?: number): CodeGen;
185
+ endBlock(nodeCount?: number): CodeGen;
186
+ func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen;
187
+ endFunc(): CodeGen;
188
+ optimize(n?: number): void;
189
+ private _leafNode;
190
+ private _blockNode;
191
+ private _endBlockNode;
192
+ private _elseNode;
193
+ private get _root();
194
+ private get _currNode();
195
+ private set _currNode(value);
196
+ }
197
+ //#endregion
198
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.d.ts
199
+ declare const _jsonTypes: readonly ["string", "number", "integer", "boolean", "null", "object", "array"];
200
+ type JSONType$1 = (typeof _jsonTypes)[number];
201
+ type ValidationTypes = { [K in JSONType$1]: boolean | RuleGroup | undefined };
202
+ interface ValidationRules {
203
+ rules: RuleGroup[];
204
+ post: RuleGroup;
205
+ all: { [Key in string]?: boolean | Rule };
206
+ keywords: { [Key in string]?: boolean };
207
+ types: ValidationTypes;
208
+ }
209
+ interface RuleGroup {
210
+ type?: JSONType$1;
211
+ rules: Rule[];
212
+ }
213
+ interface Rule {
214
+ keyword: string;
215
+ definition: AddedKeywordDefinition;
216
+ }
217
+ //#endregion
218
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.d.ts
219
+ declare enum Type {
220
+ Num = 0,
221
+ Str = 1,
222
+ }
223
+ //#endregion
224
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.d.ts
225
+ type SubschemaArgs = Partial<{
226
+ keyword: string;
227
+ schemaProp: string | number;
228
+ schema: AnySchema;
229
+ schemaPath: Code;
230
+ errSchemaPath: string;
231
+ topSchemaRef: Code;
232
+ data: Name | Code;
233
+ dataProp: Code | string | number;
234
+ dataTypes: JSONType$1[];
235
+ definedProperties: Set<string>;
236
+ propertyName: Name;
237
+ dataPropType: Type;
238
+ jtdDiscriminator: string;
239
+ jtdMetadata: boolean;
240
+ compositeRule: true;
241
+ createErrors: boolean;
242
+ allErrors: boolean;
243
+ }>;
244
+ //#endregion
245
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.d.ts
246
+ interface ErrorPaths {
247
+ instancePath?: Code;
248
+ schemaPath?: string;
249
+ parentSchema?: boolean;
250
+ }
251
+ //#endregion
252
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.d.ts
253
+ declare class KeywordCxt implements KeywordErrorCxt {
254
+ readonly gen: CodeGen;
255
+ readonly allErrors?: boolean;
256
+ readonly keyword: string;
257
+ readonly data: Name;
258
+ readonly $data?: string | false;
259
+ schema: any;
260
+ readonly schemaValue: Code | number | boolean;
261
+ readonly schemaCode: Code | number | boolean;
262
+ readonly schemaType: JSONType$1[];
263
+ readonly parentSchema: AnySchemaObject;
264
+ readonly errsCount?: Name;
265
+ params: KeywordCxtParams;
266
+ readonly it: SchemaObjCxt;
267
+ readonly def: AddedKeywordDefinition;
268
+ constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string);
269
+ result(condition: Code, successAction?: () => void, failAction?: () => void): void;
270
+ failResult(condition: Code, successAction?: () => void, failAction?: () => void): void;
271
+ pass(condition: Code, failAction?: () => void): void;
272
+ fail(condition?: Code): void;
273
+ fail$data(condition: Code): void;
274
+ error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void;
275
+ private _error;
276
+ $dataError(): void;
277
+ reset(): void;
278
+ ok(cond: Code | boolean): void;
279
+ setParams(obj: KeywordCxtParams, assign?: true): void;
280
+ block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void;
281
+ check$data(valid?: Name, $dataValid?: Code): void;
282
+ invalid$data(): Code;
283
+ subschema(appl: SubschemaArgs, valid: Name): SchemaCxt;
284
+ mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void;
285
+ mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void;
286
+ }
287
+ //#endregion
288
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/types/json-schema.d.ts
289
+ type StrictNullChecksWrapper<Name$1 extends string, Type$1> = undefined extends null ? `strictNullChecks must be true in tsconfig to use ${Name$1}` : Type$1;
290
+ type UnionToIntersection<U> = (U extends any ? (_: U) => void : never) extends ((_: infer I) => void) ? I : never;
291
+ type UncheckedPartialSchema<T> = Partial<UncheckedJSONSchemaType<T, true>>;
292
+ type JSONType<T extends string, IsPartial extends boolean> = IsPartial extends true ? T | undefined : T;
293
+ interface NumberKeywords {
294
+ minimum?: number;
295
+ maximum?: number;
296
+ exclusiveMinimum?: number;
297
+ exclusiveMaximum?: number;
298
+ multipleOf?: number;
299
+ format?: string;
300
+ }
301
+ interface StringKeywords {
302
+ minLength?: number;
303
+ maxLength?: number;
304
+ pattern?: string;
305
+ format?: string;
306
+ }
307
+ type UncheckedJSONSchemaType<T, IsPartial extends boolean> = (
308
+ // these two unions allow arbitrary unions of types
309
+ {
310
+ anyOf: readonly UncheckedJSONSchemaType<T, IsPartial>[];
311
+ } | {
312
+ oneOf: readonly UncheckedJSONSchemaType<T, IsPartial>[];
313
+ } | ({
314
+ type: readonly (T extends number ? JSONType<"number" | "integer", IsPartial> : T extends string ? JSONType<"string", IsPartial> : T extends boolean ? JSONType<"boolean", IsPartial> : never)[];
315
+ } & UnionToIntersection<T extends number ? NumberKeywords : T extends string ? StringKeywords : T extends boolean ? {} : never>) | ((T extends number ? {
316
+ type: JSONType<"number" | "integer", IsPartial>;
317
+ } & NumberKeywords : T extends string ? {
318
+ type: JSONType<"string", IsPartial>;
319
+ } & StringKeywords : T extends boolean ? {
320
+ type: JSONType<"boolean", IsPartial>;
321
+ } : T extends readonly [any, ...any[]] ? {
322
+ type: JSONType<"array", IsPartial>;
323
+ items: { readonly [K in keyof T]-?: UncheckedJSONSchemaType<T[K], false> & Nullable<T[K]> } & {
324
+ length: T["length"];
325
+ };
326
+ minItems: T["length"];
327
+ } & ({
328
+ maxItems: T["length"];
329
+ } | {
330
+ additionalItems: false;
331
+ }) : T extends readonly any[] ? {
332
+ type: JSONType<"array", IsPartial>;
333
+ items: UncheckedJSONSchemaType<T[0], false>;
334
+ contains?: UncheckedPartialSchema<T[0]>;
335
+ minItems?: number;
336
+ maxItems?: number;
337
+ minContains?: number;
338
+ maxContains?: number;
339
+ uniqueItems?: true;
340
+ additionalItems?: never;
341
+ } : T extends Record<string, any> ? {
342
+ type: JSONType<"object", IsPartial>;
343
+ additionalProperties?: boolean | UncheckedJSONSchemaType<T[string], false>;
344
+ unevaluatedProperties?: boolean | UncheckedJSONSchemaType<T[string], false>;
345
+ properties?: IsPartial extends true ? Partial<UncheckedPropertiesSchema<T>> : UncheckedPropertiesSchema<T>;
346
+ patternProperties?: Record<string, UncheckedJSONSchemaType<T[string], false>>;
347
+ propertyNames?: Omit<UncheckedJSONSchemaType<string, false>, "type"> & {
348
+ type?: "string";
349
+ };
350
+ dependencies?: { [K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema<T> };
351
+ dependentRequired?: { [K in keyof T]?: readonly (keyof T)[] };
352
+ dependentSchemas?: { [K in keyof T]?: UncheckedPartialSchema<T> };
353
+ minProperties?: number;
354
+ maxProperties?: number;
355
+ } & (IsPartial extends true ? {
356
+ required: readonly (keyof T)[];
357
+ } : [UncheckedRequiredMembers<T>] extends [never] ? {
358
+ required?: readonly UncheckedRequiredMembers<T>[];
359
+ } : {
360
+ required: readonly UncheckedRequiredMembers<T>[];
361
+ }) : T extends null ? {
362
+ type: JSONType<"null", IsPartial>;
363
+ nullable: true;
364
+ } : never) & {
365
+ allOf?: readonly UncheckedPartialSchema<T>[];
366
+ anyOf?: readonly UncheckedPartialSchema<T>[];
367
+ oneOf?: readonly UncheckedPartialSchema<T>[];
368
+ if?: UncheckedPartialSchema<T>;
369
+ then?: UncheckedPartialSchema<T>;
370
+ else?: UncheckedPartialSchema<T>;
371
+ not?: UncheckedPartialSchema<T>;
372
+ })) & {
373
+ [keyword: string]: any;
374
+ $id?: string;
375
+ $ref?: string;
376
+ $defs?: Record<string, UncheckedJSONSchemaType<Known, true>>;
377
+ definitions?: Record<string, UncheckedJSONSchemaType<Known, true>>;
378
+ };
379
+ type JSONSchemaType<T> = StrictNullChecksWrapper<"JSONSchemaType", UncheckedJSONSchemaType<T, false>>;
380
+ type Known = {
381
+ [key: string]: Known;
382
+ } | [Known, ...Known[]] | Known[] | number | string | boolean | null;
383
+ type UncheckedPropertiesSchema<T> = { [K in keyof T]-?: (UncheckedJSONSchemaType<T[K], false> & Nullable<T[K]>) | {
384
+ $ref: string;
385
+ } };
386
+ type UncheckedRequiredMembers<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];
387
+ type Nullable<T> = undefined extends T ? {
388
+ nullable: true;
389
+ const?: null;
390
+ enum?: readonly (T | null)[];
391
+ default?: T | null;
392
+ } : {
393
+ nullable?: false;
394
+ const?: T;
395
+ enum?: readonly T[];
396
+ default?: T;
397
+ };
398
+ //#endregion
399
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/types/jtd-schema.d.ts
400
+ /** numeric strings */
401
+ type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32";
402
+ /** string strings */
403
+ type StringType = "string" | "timestamp";
404
+ /** Generic JTD Schema without inference of the represented type */
405
+ type SomeJTDSchemaType = (
406
+ // ref
407
+ {
408
+ ref: string;
409
+ } | {
410
+ type: NumberType | StringType | "boolean";
411
+ } | {
412
+ enum: string[];
413
+ } | {
414
+ elements: SomeJTDSchemaType;
415
+ } | {
416
+ values: SomeJTDSchemaType;
417
+ } | {
418
+ properties: Record<string, SomeJTDSchemaType>;
419
+ optionalProperties?: Record<string, SomeJTDSchemaType>;
420
+ additionalProperties?: boolean;
421
+ } | {
422
+ properties?: Record<string, SomeJTDSchemaType>;
423
+ optionalProperties: Record<string, SomeJTDSchemaType>;
424
+ additionalProperties?: boolean;
425
+ } | {
426
+ discriminator: string;
427
+ mapping: Record<string, SomeJTDSchemaType>;
428
+ } | {}) & {
429
+ nullable?: boolean;
430
+ metadata?: Record<string, unknown>;
431
+ definitions?: Record<string, SomeJTDSchemaType>;
432
+ };
433
+ /** required keys of an object, not undefined */
434
+ type RequiredKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];
435
+ /** optional or undifined-able keys of an object */
436
+ type OptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T];
437
+ /** type is true if T is a union type */
438
+ type IsUnion_<T, U extends T = T> = false extends (T extends unknown ? ([U] extends [T] ? false : true) : never) ? false : true;
439
+ type IsUnion<T> = IsUnion_<T>;
440
+ /** type is true if T is identically E */
441
+ type TypeEquality<T, E$1> = [T] extends [E$1] ? ([E$1] extends [T] ? true : false) : false;
442
+ /** type is true if T or null is identically E or null*/
443
+ type NullTypeEquality<T, E$1> = TypeEquality<T | null, E$1 | null>;
444
+ /** gets only the string literals of a type or null if a type isn't a string literal */
445
+ type EnumString<T> = [T] extends [never] ? null : T extends string ? string extends T ? null : T : null;
446
+ /** true if type is a union of string literals */
447
+ type IsEnum<T> = null extends EnumString<T> ? false : true;
448
+ /** true only if all types are array types (not tuples) */
449
+ type IsElements<T> = false extends IsUnion<T> ? [T] extends [readonly unknown[]] ? undefined extends T[0.5] ? false : true : false : false;
450
+ /** true if the the type is a values type */
451
+ type IsValues<T> = false extends IsUnion<T> ? TypeEquality<keyof T, string> : false;
452
+ /** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */
453
+ type IsRecord<T, Union extends boolean> = Union extends IsUnion<T> ? null extends EnumString<keyof T> ? false : true : false;
454
+ /** true if type represents an empty record */
455
+ type IsEmptyRecord<T> = [T] extends [Record<string, never>] ? [T] extends [never] ? false : true : false;
456
+ /** actual schema */
457
+ type JTDSchemaType<T, D extends Record<string, unknown> = Record<string, never>> = (
458
+ // refs - where null wasn't specified, must match exactly
459
+ (null extends EnumString<keyof D> ? never : ({ [K in keyof D]: [T] extends [D[K]] ? {
460
+ ref: K;
461
+ } : never }[keyof D] & {
462
+ nullable?: false;
463
+ }) | (null extends T ? { [K in keyof D]: [Exclude<T, null>] extends [Exclude<D[K], null>] ? {
464
+ ref: K;
465
+ } : never }[keyof D] & {
466
+ nullable: true;
467
+ } : never)) | (unknown extends T ? {
468
+ nullable?: boolean;
469
+ } : never) | ((true extends NullTypeEquality<T, number> ? {
470
+ type: NumberType;
471
+ } : true extends NullTypeEquality<T, boolean> ? {
472
+ type: "boolean";
473
+ } : true extends NullTypeEquality<T, string> ? {
474
+ type: StringType;
475
+ } : true extends NullTypeEquality<T, Date> ? {
476
+ type: "timestamp";
477
+ } : true extends IsEnum<Exclude<T, null>> ? {
478
+ enum: EnumString<Exclude<T, null>>[];
479
+ } : true extends IsElements<Exclude<T, null>> ? T extends readonly (infer E)[] ? {
480
+ elements: JTDSchemaType<E, D>;
481
+ } : never : true extends IsEmptyRecord<Exclude<T, null>> ? {
482
+ properties: Record<string, never>;
483
+ optionalProperties?: Record<string, never>;
484
+ } | {
485
+ optionalProperties: Record<string, never>;
486
+ } : true extends IsValues<Exclude<T, null>> ? T extends Record<string, infer V> ? {
487
+ values: JTDSchemaType<V, D>;
488
+ } : never : true extends IsRecord<Exclude<T, null>, false> ? ([RequiredKeys<Exclude<T, null>>] extends [never] ? {
489
+ properties?: Record<string, never>;
490
+ } : {
491
+ properties: { [K in RequiredKeys<T>]: JTDSchemaType<T[K], D> };
492
+ }) & ([OptionalKeys<Exclude<T, null>>] extends [never] ? {
493
+ optionalProperties?: Record<string, never>;
494
+ } : {
495
+ optionalProperties: { [K in OptionalKeys<T>]: JTDSchemaType<Exclude<T[K], undefined>, D> };
496
+ }) & {
497
+ additionalProperties?: boolean;
498
+ } : true extends IsRecord<Exclude<T, null>, true> ? { [K in keyof Exclude<T, null>]-?: Exclude<T, null>[K] extends string ? {
499
+ discriminator: K;
500
+ mapping: { [M in Exclude<T, null>[K]]: JTDSchemaType<Omit<T extends Record<K, M> ? T : never, K>, D> };
501
+ } : never }[keyof Exclude<T, null>] : never) & (null extends T ? {
502
+ nullable: true;
503
+ } : {
504
+ nullable?: false;
505
+ }))) & {
506
+ metadata?: Record<string, unknown>;
507
+ definitions?: { [K in keyof D]: JTDSchemaType<D[K], D> };
508
+ };
509
+ type JTDDataDef<S, D extends Record<string, unknown>> =
510
+ // ref
511
+ (S extends {
512
+ ref: string;
513
+ } ? D extends { [K in S["ref"]]: infer V } ? JTDDataDef<V, D> : never : S extends {
514
+ type: NumberType;
515
+ } ? number : S extends {
516
+ type: "boolean";
517
+ } ? boolean : S extends {
518
+ type: "string";
519
+ } ? string : S extends {
520
+ type: "timestamp";
521
+ } ? string | Date : S extends {
522
+ enum: readonly (infer E)[];
523
+ } ? string extends E ? never : [E] extends [string] ? E : never : S extends {
524
+ elements: infer E;
525
+ } ? JTDDataDef<E, D>[] : S extends {
526
+ properties: Record<string, unknown>;
527
+ optionalProperties?: Record<string, unknown>;
528
+ additionalProperties?: boolean;
529
+ } ? { -readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D> } & { -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<S["optionalProperties"][K], D> } & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown) : S extends {
530
+ properties?: Record<string, unknown>;
531
+ optionalProperties: Record<string, unknown>;
532
+ additionalProperties?: boolean;
533
+ } ? { -readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D> } & { -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<S["optionalProperties"][K], D> } & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown) : S extends {
534
+ values: infer V;
535
+ } ? Record<string, JTDDataDef<V, D>> : S extends {
536
+ discriminator: infer M;
537
+ mapping: Record<string, unknown>;
538
+ } ? [M] extends [string] ? { [K in keyof S["mapping"]]: JTDDataDef<S["mapping"][K], D> & { [KM in M]: K } }[keyof S["mapping"]] : never : unknown) | (S extends {
539
+ nullable: true;
540
+ } ? null : never);
541
+ type JTDDataType<S> = S extends {
542
+ definitions: Record<string, unknown>;
543
+ } ? JTDDataDef<S, S["definitions"]> : JTDDataDef<S, Record<string, never>>;
544
+ //#endregion
545
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.d.ts
546
+ declare class ValidationError extends Error {
547
+ readonly errors: Partial<ErrorObject>[];
548
+ readonly ajv: true;
549
+ readonly validation: true;
550
+ constructor(errors: Partial<ErrorObject>[]);
551
+ }
552
+ //#endregion
553
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.d.ts
554
+ declare class MissingRefError extends Error {
555
+ readonly missingRef: string;
556
+ readonly missingSchema: string;
557
+ constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string);
558
+ }
559
+ //#endregion
560
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.d.ts
561
+ interface Plugin<Opts> {
562
+ (ajv: Ajv$1, options?: Opts): Ajv$1;
563
+ [prop: string]: any;
564
+ }
565
+ type Options = CurrentOptions & DeprecatedOptions;
566
+ interface CurrentOptions {
567
+ strict?: boolean | "log";
568
+ strictSchema?: boolean | "log";
569
+ strictNumbers?: boolean | "log";
570
+ strictTypes?: boolean | "log";
571
+ strictTuples?: boolean | "log";
572
+ strictRequired?: boolean | "log";
573
+ allowMatchingProperties?: boolean;
574
+ allowUnionTypes?: boolean;
575
+ validateFormats?: boolean;
576
+ $data?: boolean;
577
+ allErrors?: boolean;
578
+ verbose?: boolean;
579
+ discriminator?: boolean;
580
+ unicodeRegExp?: boolean;
581
+ timestamp?: "string" | "date";
582
+ parseDate?: boolean;
583
+ allowDate?: boolean;
584
+ specialNumbers?: "fast" | "null";
585
+ $comment?: true | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown);
586
+ formats?: { [Name in string]?: Format };
587
+ keywords?: Vocabulary;
588
+ schemas?: AnySchema[] | { [Key in string]?: AnySchema };
589
+ logger?: Logger | false;
590
+ loadSchema?: (uri: string) => Promise<AnySchemaObject>;
591
+ removeAdditional?: boolean | "all" | "failing";
592
+ useDefaults?: boolean | "empty";
593
+ coerceTypes?: boolean | "array";
594
+ next?: boolean;
595
+ unevaluated?: boolean;
596
+ dynamicRef?: boolean;
597
+ schemaId?: "id" | "$id";
598
+ jtd?: boolean;
599
+ meta?: SchemaObject | boolean;
600
+ defaultMeta?: string | AnySchemaObject;
601
+ validateSchema?: boolean | "log";
602
+ addUsedSchema?: boolean;
603
+ inlineRefs?: boolean | number;
604
+ passContext?: boolean;
605
+ loopRequired?: number;
606
+ loopEnum?: number;
607
+ ownProperties?: boolean;
608
+ multipleOfPrecision?: number;
609
+ int32range?: boolean;
610
+ messages?: boolean;
611
+ code?: CodeOptions;
612
+ uriResolver?: UriResolver;
613
+ }
614
+ interface CodeOptions {
615
+ es5?: boolean;
616
+ esm?: boolean;
617
+ lines?: boolean;
618
+ optimize?: boolean | number;
619
+ formats?: Code;
620
+ source?: boolean;
621
+ process?: (code: string, schema?: SchemaEnv) => string;
622
+ regExp?: RegExpEngine;
623
+ }
624
+ interface InstanceCodeOptions extends CodeOptions {
625
+ regExp: RegExpEngine;
626
+ optimize: number;
627
+ }
628
+ interface DeprecatedOptions {
629
+ /** @deprecated */
630
+ ignoreKeywordsWithRef?: boolean;
631
+ /** @deprecated */
632
+ jsPropertySyntax?: boolean;
633
+ /** @deprecated */
634
+ unicode?: boolean;
635
+ }
636
+ type RequiredInstanceOptions = { [K in "strictSchema" | "strictNumbers" | "strictTypes" | "strictTuples" | "strictRequired" | "inlineRefs" | "loopRequired" | "loopEnum" | "meta" | "messages" | "schemaId" | "addUsedSchema" | "validateSchema" | "validateFormats" | "int32range" | "unicodeRegExp" | "uriResolver"]: NonNullable<Options[K]> } & {
637
+ code: InstanceCodeOptions;
638
+ };
639
+ type InstanceOptions = Options & RequiredInstanceOptions;
640
+ interface Logger {
641
+ log(...args: unknown[]): unknown;
642
+ warn(...args: unknown[]): unknown;
643
+ error(...args: unknown[]): unknown;
644
+ }
645
+ declare class Ajv$1 {
646
+ opts: InstanceOptions;
647
+ errors?: ErrorObject[] | null;
648
+ logger: Logger;
649
+ readonly scope: ValueScope;
650
+ readonly schemas: { [Key in string]?: SchemaEnv };
651
+ readonly refs: { [Ref in string]?: SchemaEnv | string };
652
+ readonly formats: { [Name in string]?: AddedFormat };
653
+ readonly RULES: ValidationRules;
654
+ readonly _compilations: Set<SchemaEnv>;
655
+ private readonly _loading;
656
+ private readonly _cache;
657
+ private readonly _metaOpts;
658
+ static ValidationError: typeof ValidationError;
659
+ static MissingRefError: typeof MissingRefError;
660
+ constructor(opts?: Options);
661
+ _addVocabularies(): void;
662
+ _addDefaultMetaSchema(): void;
663
+ defaultMeta(): string | AnySchemaObject | undefined;
664
+ validate(schema: Schema | string, data: unknown): boolean;
665
+ validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise<unknown>;
666
+ validate<T>(schema: Schema | JSONSchemaType<T> | string, data: unknown): data is T;
667
+ validate<T>(schema: JTDSchemaType<T>, data: unknown): data is T;
668
+ validate<N extends never, T extends SomeJTDSchemaType>(schema: T, data: unknown): data is JTDDataType<T>;
669
+ validate<T>(schema: AsyncSchema, data: unknown | T): Promise<T>;
670
+ validate<T>(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise<T>;
671
+ compile<T = unknown>(schema: Schema | JSONSchemaType<T>, _meta?: boolean): ValidateFunction<T>;
672
+ compile<T = unknown>(schema: JTDSchemaType<T>, _meta?: boolean): ValidateFunction<T>;
673
+ compile<N extends never, T extends SomeJTDSchemaType>(schema: T, _meta?: boolean): ValidateFunction<JTDDataType<T>>;
674
+ compile<T = unknown>(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction<T>;
675
+ compile<T = unknown>(schema: AnySchema, _meta?: boolean): AnyValidateFunction<T>;
676
+ compileAsync<T = unknown>(schema: SchemaObject | JSONSchemaType<T>, _meta?: boolean): Promise<ValidateFunction<T>>;
677
+ compileAsync<T = unknown>(schema: JTDSchemaType<T>, _meta?: boolean): Promise<ValidateFunction<T>>;
678
+ compileAsync<T = unknown>(schema: AsyncSchema, meta?: boolean): Promise<AsyncValidateFunction<T>>;
679
+ compileAsync<T = unknown>(schema: AnySchemaObject, meta?: boolean): Promise<AnyValidateFunction<T>>;
680
+ addSchema(schema: AnySchema | AnySchema[],
681
+ // If array is passed, `key` will be ignored
682
+ key?: string,
683
+ // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
684
+ _meta?: boolean,
685
+ // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
686
+ _validateSchema?: boolean | "log"): Ajv$1;
687
+ addMetaSchema(schema: AnySchemaObject, key?: string,
688
+ // schema key
689
+ _validateSchema?: boolean | "log"): Ajv$1;
690
+ validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise<unknown>;
691
+ getSchema<T = unknown>(keyRef: string): AnyValidateFunction<T> | undefined;
692
+ removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv$1;
693
+ addVocabulary(definitions: Vocabulary): Ajv$1;
694
+ addKeyword(kwdOrDef: string | KeywordDefinition, def?: KeywordDefinition): Ajv$1;
695
+ getKeyword(keyword: string): AddedKeywordDefinition | boolean;
696
+ removeKeyword(keyword: string): Ajv$1;
697
+ addFormat(name: string, format: Format): Ajv$1;
698
+ errorsText(errors?: ErrorObject[] | null | undefined,
699
+ // optional array of validation errors
700
+ {
701
+ separator,
702
+ dataVar
703
+ }?: ErrorsTextOptions): string;
704
+ $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject;
705
+ private _removeAllSchemas;
706
+ _addSchema(schema: AnySchema, meta?: boolean, baseId?: string, validateSchema?: boolean | "log", addSchema?: boolean): SchemaEnv;
707
+ private _checkUnique;
708
+ private _compileSchemaEnv;
709
+ private _compileMetaSchema;
710
+ }
711
+ interface ErrorsTextOptions {
712
+ separator?: string;
713
+ dataVar?: string;
714
+ }
715
+ //#endregion
716
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.d.ts
717
+ type LocalRefs = { [Ref in string]?: AnySchemaObject };
718
+ //#endregion
719
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.d.ts
720
+ type SchemaRefs = { [Ref in string]?: SchemaEnv | AnySchema };
721
+ interface SchemaCxt {
722
+ readonly gen: CodeGen;
723
+ readonly allErrors?: boolean;
724
+ readonly data: Name;
725
+ readonly parentData: Name;
726
+ readonly parentDataProperty: Code | number;
727
+ readonly dataNames: Name[];
728
+ readonly dataPathArr: (Code | number)[];
729
+ readonly dataLevel: number;
730
+ dataTypes: JSONType$1[];
731
+ definedProperties: Set<string>;
732
+ readonly topSchemaRef: Code;
733
+ readonly validateName: Name;
734
+ evaluated?: Name;
735
+ readonly ValidationError?: Name;
736
+ readonly schema: AnySchema;
737
+ readonly schemaEnv: SchemaEnv;
738
+ readonly rootId: string;
739
+ baseId: string;
740
+ readonly schemaPath: Code;
741
+ readonly errSchemaPath: string;
742
+ readonly errorPath: Code;
743
+ readonly propertyName?: Name;
744
+ readonly compositeRule?: boolean;
745
+ props?: EvaluatedProperties | Name;
746
+ items?: EvaluatedItems | Name;
747
+ jtdDiscriminator?: string;
748
+ jtdMetadata?: boolean;
749
+ readonly createErrors?: boolean;
750
+ readonly opts: InstanceOptions;
751
+ readonly self: Ajv$1;
752
+ }
753
+ interface SchemaObjCxt extends SchemaCxt {
754
+ readonly schema: AnySchemaObject;
755
+ }
756
+ interface SchemaEnvArgs {
757
+ readonly schema: AnySchema;
758
+ readonly schemaId?: "$id" | "id";
759
+ readonly root?: SchemaEnv;
760
+ readonly baseId?: string;
761
+ readonly schemaPath?: string;
762
+ readonly localRefs?: LocalRefs;
763
+ readonly meta?: boolean;
764
+ }
765
+ declare class SchemaEnv implements SchemaEnvArgs {
766
+ readonly schema: AnySchema;
767
+ readonly schemaId?: "$id" | "id";
768
+ readonly root: SchemaEnv;
769
+ baseId: string;
770
+ schemaPath?: string;
771
+ localRefs?: LocalRefs;
772
+ readonly meta?: boolean;
773
+ readonly $async?: boolean;
774
+ readonly refs: SchemaRefs;
775
+ readonly dynamicAnchors: { [Ref in string]?: true };
776
+ validate?: AnyValidateFunction;
777
+ validateName?: ValueScopeName;
778
+ serialize?: (data: unknown) => string;
779
+ serializeName?: ValueScopeName;
780
+ parse?: (data: string) => unknown;
781
+ parseName?: ValueScopeName;
782
+ constructor(env: SchemaEnvArgs);
783
+ }
784
+ //#endregion
785
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/types/index.d.ts
786
+ interface _SchemaObject {
787
+ id?: string;
788
+ $id?: string;
789
+ $schema?: string;
790
+ [x: string]: any;
791
+ }
792
+ interface SchemaObject extends _SchemaObject {
793
+ id?: string;
794
+ $id?: string;
795
+ $schema?: string;
796
+ $async?: false;
797
+ [x: string]: any;
798
+ }
799
+ interface AsyncSchema extends _SchemaObject {
800
+ $async: true;
801
+ }
802
+ type AnySchemaObject = SchemaObject | AsyncSchema;
803
+ type Schema = SchemaObject | boolean;
804
+ type AnySchema = Schema | AsyncSchema;
805
+ interface SourceCode {
806
+ validateName: ValueScopeName;
807
+ validateCode: string;
808
+ scopeValues: ScopeValueSets;
809
+ evaluated?: Code;
810
+ }
811
+ interface DataValidationCxt<T extends string | number = string | number> {
812
+ instancePath: string;
813
+ parentData: { [K in T]: any };
814
+ parentDataProperty: T;
815
+ rootData: Record<string, any> | any[];
816
+ dynamicAnchors: { [Ref in string]?: ValidateFunction };
817
+ }
818
+ interface ValidateFunction<T = unknown> {
819
+ (this: Ajv$1 | any, data: any, dataCxt?: DataValidationCxt): data is T;
820
+ errors?: null | ErrorObject[];
821
+ evaluated?: Evaluated;
822
+ schema: AnySchema;
823
+ schemaEnv: SchemaEnv;
824
+ source?: SourceCode;
825
+ }
826
+ type EvaluatedProperties = { [K in string]?: true } | true;
827
+ type EvaluatedItems = number | true;
828
+ interface Evaluated {
829
+ props?: EvaluatedProperties;
830
+ items?: EvaluatedItems;
831
+ dynamicProps: boolean;
832
+ dynamicItems: boolean;
833
+ }
834
+ interface AsyncValidateFunction<T = unknown> extends ValidateFunction<T> {
835
+ (...args: Parameters<ValidateFunction<T>>): Promise<T>;
836
+ $async: true;
837
+ }
838
+ type AnyValidateFunction<T = any> = ValidateFunction<T> | AsyncValidateFunction<T>;
839
+ interface ErrorObject<K$1 extends string = string, P = Record<string, any>, S = unknown> {
840
+ keyword: K$1;
841
+ instancePath: string;
842
+ schemaPath: string;
843
+ params: P;
844
+ propertyName?: string;
845
+ message?: string;
846
+ schema?: S;
847
+ parentSchema?: AnySchemaObject;
848
+ data?: unknown;
849
+ }
850
+ interface _KeywordDef {
851
+ keyword: string | string[];
852
+ type?: JSONType$1 | JSONType$1[];
853
+ schemaType?: JSONType$1 | JSONType$1[];
854
+ allowUndefined?: boolean;
855
+ $data?: boolean;
856
+ implements?: string[];
857
+ before?: string;
858
+ post?: boolean;
859
+ metaSchema?: AnySchemaObject;
860
+ validateSchema?: AnyValidateFunction;
861
+ dependencies?: string[];
862
+ error?: KeywordErrorDefinition;
863
+ $dataError?: KeywordErrorDefinition;
864
+ }
865
+ interface CodeKeywordDefinition extends _KeywordDef {
866
+ code: (cxt: KeywordCxt, ruleType?: string) => void;
867
+ trackErrors?: boolean;
868
+ }
869
+ type MacroKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaCxt) => AnySchema;
870
+ type CompileKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaObjCxt) => DataValidateFunction;
871
+ interface DataValidateFunction {
872
+ (...args: Parameters<ValidateFunction>): boolean | Promise<any>;
873
+ errors?: Partial<ErrorObject>[];
874
+ }
875
+ interface SchemaValidateFunction {
876
+ (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise<any>;
877
+ errors?: Partial<ErrorObject>[];
878
+ }
879
+ interface FuncKeywordDefinition extends _KeywordDef {
880
+ validate?: SchemaValidateFunction | DataValidateFunction;
881
+ compile?: CompileKeywordFunc;
882
+ schema?: boolean;
883
+ modifying?: boolean;
884
+ async?: boolean;
885
+ valid?: boolean;
886
+ errors?: boolean | "full";
887
+ }
888
+ interface MacroKeywordDefinition extends FuncKeywordDefinition {
889
+ macro: MacroKeywordFunc;
890
+ }
891
+ type KeywordDefinition = CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition;
892
+ type AddedKeywordDefinition = KeywordDefinition & {
893
+ type: JSONType$1[];
894
+ schemaType: JSONType$1[];
895
+ };
896
+ interface KeywordErrorDefinition {
897
+ message: string | Code | ((cxt: KeywordErrorCxt) => string | Code);
898
+ params?: Code | ((cxt: KeywordErrorCxt) => Code);
899
+ }
900
+ type Vocabulary = (KeywordDefinition | string)[];
901
+ interface KeywordErrorCxt {
902
+ gen: CodeGen;
903
+ keyword: string;
904
+ data: Name;
905
+ $data?: string | false;
906
+ schema: any;
907
+ parentSchema?: AnySchemaObject;
908
+ schemaCode: Code | number | boolean;
909
+ schemaValue: Code | number | boolean;
910
+ schemaType?: JSONType$1[];
911
+ errsCount?: Name;
912
+ params: KeywordCxtParams;
913
+ it: SchemaCxt;
914
+ }
915
+ type KeywordCxtParams = { [P in string]?: Code | string | number };
916
+ type FormatValidator<T extends string | number> = (data: T) => boolean;
917
+ type FormatCompare<T extends string | number> = (data1: T, data2: T) => number | undefined;
918
+ type AsyncFormatValidator<T extends string | number> = (data: T) => Promise<boolean>;
919
+ interface FormatDefinition<T extends string | number> {
920
+ type?: T extends string ? "string" | undefined : "number";
921
+ validate: FormatValidator<T> | (T extends string ? string | RegExp : never);
922
+ async?: false | undefined;
923
+ compare?: FormatCompare<T>;
924
+ }
925
+ interface AsyncFormatDefinition<T extends string | number> {
926
+ type?: T extends string ? "string" | undefined : "number";
927
+ validate: AsyncFormatValidator<T>;
928
+ async: true;
929
+ compare?: FormatCompare<T>;
930
+ }
931
+ type AddedFormat = true | RegExp | FormatValidator<string> | FormatDefinition<string> | FormatDefinition<number> | AsyncFormatDefinition<string> | AsyncFormatDefinition<number>;
932
+ type Format = AddedFormat | string;
933
+ interface RegExpEngine {
934
+ (pattern: string, u: string): RegExpLike;
935
+ code: string;
936
+ }
937
+ interface RegExpLike {
938
+ test: (s: string) => boolean;
939
+ }
940
+ interface UriResolver {
941
+ parse(uri: string): URIComponent;
942
+ resolve(base: string, path: string): string;
943
+ serialize(component: URIComponent): string;
944
+ }
945
+ //#endregion
946
+ //#region ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.d.ts
947
+ declare class Ajv extends Ajv$1 {
948
+ _addVocabularies(): void;
949
+ _addDefaultMetaSchema(): void;
950
+ defaultMeta(): string | AnySchemaObject | undefined;
951
+ }
952
+ //#endregion
953
+ //#region ../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.d.ts
954
+ type FormatMode = "fast" | "full";
955
+ type FormatName = "date" | "time" | "date-time" | "iso-time" | "iso-date-time" | "duration" | "uri" | "uri-reference" | "uri-template" | "url" | "email" | "hostname" | "ipv4" | "ipv6" | "regex" | "uuid" | "json-pointer" | "json-pointer-uri-fragment" | "relative-json-pointer" | "byte" | "int32" | "int64" | "float" | "double" | "password" | "binary";
956
+ //#endregion
957
+ //#region ../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.d.ts
958
+ interface FormatOptions {
959
+ mode?: FormatMode;
960
+ formats?: FormatName[];
961
+ keywords?: boolean;
962
+ }
963
+ type FormatsPluginOptions = FormatName[] | FormatOptions;
964
+ interface FormatsPlugin extends Plugin<FormatsPluginOptions> {
965
+ get: (format: FormatName, mode?: FormatMode) => Format;
966
+ }
967
+ declare const formatsPlugin: FormatsPlugin;
968
+ //#endregion
969
+ //#region ../core-internal/src/validators/ajvProvider.d.ts
970
+ /** Structural subset of the AJV interface used by {@link AjvJsonSchemaValidator}. */
971
+ interface AjvLike {
972
+ compile: (schema: unknown) => AjvValidateFunction;
973
+ getSchema: (keyRef: string) => AjvValidateFunction | undefined;
974
+ errorsText: (errors?: any) => string;
975
+ }
976
+ interface AjvValidateFunction {
977
+ (input: unknown): boolean;
978
+ errors?: any;
979
+ }
980
+ declare const addFormats: typeof formatsPlugin.default;
981
+ /**
982
+ * AJV-backed JSON Schema validator. See `@modelcontextprotocol/{client,server}/validators/ajv`
983
+ * for the customisation entry point (re-exports `Ajv` and `addFormats` from the bundled copy).
984
+ *
985
+ * Default validates as **JSON Schema 2020-12** (SEP-1613). Schemas declaring a different
986
+ * `$schema` are rejected with a plain `Error`; pass a pre-configured Ajv instance to validate
987
+ * other dialects. The SDK bundles ajv internally but does not re-export `Ajv2020` (its type
988
+ * graph tips downstream declaration bundling — see #2339). To construct a custom 2020-12
989
+ * instance, add `ajv` to your own dependencies (matching the SDK's pinned version) and
990
+ * `import { Ajv2020 } from 'ajv/dist/2020.js'` — `new Ajv(...)` is the draft-07 class and would
991
+ * silently downgrade dialect.
992
+ *
993
+ * @example Use with default configuration
994
+ * ```ts source="./ajvProvider.examples.ts#AjvJsonSchemaValidator_default"
995
+ * const validator = new AjvJsonSchemaValidator();
996
+ * ```
997
+ *
998
+ * @example Use with a custom AJV instance
999
+ * ```ts source="./ajvProvider.examples.ts#AjvJsonSchemaValidator_customInstance"
1000
+ * // import { Ajv2020 } from 'ajv/dist/2020.js';
1001
+ * const ajv = new Ajv2020({ strict: false, validateSchema: false, allErrors: true });
1002
+ * const validator = new AjvJsonSchemaValidator(ajv);
1003
+ * ```
1004
+ *
1005
+ * @example Register ajv-formats
1006
+ * ```ts source="./ajvProvider.examples.ts#AjvJsonSchemaValidator_withFormats"
1007
+ * // import { Ajv2020 } from 'ajv/dist/2020.js';
1008
+ * const ajv = new Ajv2020({ strict: false, validateSchema: false, allErrors: true });
1009
+ * addFormats(ajv);
1010
+ * const validator = new AjvJsonSchemaValidator(ajv);
1011
+ * ```
1012
+ */
1013
+ declare class AjvJsonSchemaValidator implements jsonSchemaValidator {
1014
+ private readonly _ajv;
1015
+ /** True iff the constructor received a caller-supplied engine; the `$schema` check is skipped. */
1016
+ private readonly _userAjv;
1017
+ /**
1018
+ * @param ajv - Optional pre-configured AJV-compatible instance. When supplied, this instance is
1019
+ * used for **every** schema regardless of its declared `$schema` (the caller owns dialect
1020
+ * choice). When omitted, the provider constructs a single `Ajv2020` instance with
1021
+ * `strict: false`, `validateFormats: true`, `validateSchema: false`, `allErrors: true`, and
1022
+ * `ajv-formats` registered. The parameter is typed structurally so consumers who don't pass an
1023
+ * instance need not have `ajv` installed.
1024
+ */
1025
+ constructor(ajv?: AjvLike);
1026
+ getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T>;
1027
+ }
1028
+ //#endregion
1029
+ export { addFormats as n, Ajv as r, AjvJsonSchemaValidator as t };
1030
+ //# sourceMappingURL=ajvProvider-D2kRT_qB.d.cts.map