@speclynx/apidom-ns-json-schema-draft-4 1.12.1 → 2.0.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/NOTICE +16 -7
  3. package/README.md +24 -24
  4. package/dist/apidom-ns-json-schema-draft-4.browser.js +1 -1
  5. package/package.json +8 -8
  6. package/src/elements/JSONReference.cjs +2 -2
  7. package/src/elements/JSONReference.mjs +1 -2
  8. package/src/elements/JSONSchema.cjs +9 -9
  9. package/src/elements/JSONSchema.mjs +8 -8
  10. package/src/elements/LinkDescription.cjs +2 -2
  11. package/src/elements/LinkDescription.mjs +1 -1
  12. package/src/elements/Media.cjs +2 -2
  13. package/src/elements/Media.mjs +1 -2
  14. package/src/index.cjs +24 -21
  15. package/src/index.mjs +3 -4
  16. package/src/predicates.cjs +8 -29
  17. package/src/predicates.mjs +4 -29
  18. package/src/refractor/index.cjs +57 -16
  19. package/src/refractor/index.mjs +51 -15
  20. package/src/refractor/inspect.cjs +55 -0
  21. package/src/refractor/inspect.mjs +47 -0
  22. package/src/refractor/plugins/replace-empty-element.cjs +27 -21
  23. package/src/refractor/plugins/replace-empty-element.mjs +14 -8
  24. package/src/refractor/predicates.cjs +2 -2
  25. package/src/refractor/predicates.mjs +1 -1
  26. package/src/refractor/specification.cjs +14 -3
  27. package/src/refractor/specification.mjs +14 -3
  28. package/src/refractor/toolbox.cjs +10 -3
  29. package/src/refractor/toolbox.mjs +8 -2
  30. package/src/refractor/visitors/FallbackVisitor.cjs +4 -4
  31. package/src/refractor/visitors/FallbackVisitor.mjs +4 -4
  32. package/src/refractor/visitors/SpecificationVisitor.cjs +4 -3
  33. package/src/refractor/visitors/SpecificationVisitor.mjs +3 -2
  34. package/src/refractor/visitors/Visitor.cjs +10 -8
  35. package/src/refractor/visitors/Visitor.mjs +11 -9
  36. package/src/refractor/visitors/generics/AlternatingVisitor.cjs +3 -3
  37. package/src/refractor/visitors/generics/AlternatingVisitor.mjs +3 -3
  38. package/src/refractor/visitors/generics/FixedFieldsVisitor.cjs +10 -7
  39. package/src/refractor/visitors/generics/FixedFieldsVisitor.mjs +9 -6
  40. package/src/refractor/visitors/generics/PatternedFieldsVisitor.cjs +9 -6
  41. package/src/refractor/visitors/generics/PatternedFieldsVisitor.mjs +8 -5
  42. package/src/refractor/visitors/json-schema/AllOfVisitor.cjs +7 -10
  43. package/src/refractor/visitors/json-schema/AllOfVisitor.mjs +6 -8
  44. package/src/refractor/visitors/json-schema/AnyOfVisitor.cjs +7 -10
  45. package/src/refractor/visitors/json-schema/AnyOfVisitor.mjs +6 -8
  46. package/src/refractor/visitors/json-schema/DefinitionsVisitor.cjs +4 -8
  47. package/src/refractor/visitors/json-schema/DefinitionsVisitor.mjs +3 -6
  48. package/src/refractor/visitors/json-schema/DependenciesVisitor.cjs +4 -8
  49. package/src/refractor/visitors/json-schema/DependenciesVisitor.mjs +3 -6
  50. package/src/refractor/visitors/json-schema/EnumVisitor.cjs +2 -3
  51. package/src/refractor/visitors/json-schema/EnumVisitor.mjs +2 -3
  52. package/src/refractor/visitors/json-schema/ItemsVisitor.cjs +10 -12
  53. package/src/refractor/visitors/json-schema/ItemsVisitor.mjs +9 -10
  54. package/src/refractor/visitors/json-schema/LinksVisitor.cjs +7 -10
  55. package/src/refractor/visitors/json-schema/LinksVisitor.mjs +6 -8
  56. package/src/refractor/visitors/json-schema/OneOfVisitor.cjs +7 -10
  57. package/src/refractor/visitors/json-schema/OneOfVisitor.mjs +6 -8
  58. package/src/refractor/visitors/json-schema/PatternPropertiesVisitor.cjs +4 -8
  59. package/src/refractor/visitors/json-schema/PatternPropertiesVisitor.mjs +3 -6
  60. package/src/refractor/visitors/json-schema/PropertiesVisitor.cjs +4 -8
  61. package/src/refractor/visitors/json-schema/PropertiesVisitor.mjs +3 -6
  62. package/src/refractor/visitors/json-schema/RequiredVisitor.cjs +2 -3
  63. package/src/refractor/visitors/json-schema/RequiredVisitor.mjs +2 -3
  64. package/src/refractor/visitors/json-schema/TypeVisitor.cjs +4 -6
  65. package/src/refractor/visitors/json-schema/TypeVisitor.mjs +4 -6
  66. package/src/refractor/visitors/json-schema/bases.cjs +45 -0
  67. package/src/refractor/visitors/json-schema/bases.mjs +39 -0
  68. package/src/refractor/visitors/json-schema/index.cjs +12 -12
  69. package/src/refractor/visitors/json-schema/index.mjs +11 -11
  70. package/src/refractor/visitors/json-schema/json-reference/$RefVisitor.cjs +2 -3
  71. package/src/refractor/visitors/json-schema/json-reference/$RefVisitor.mjs +2 -3
  72. package/src/refractor/visitors/json-schema/json-reference/index.cjs +6 -8
  73. package/src/refractor/visitors/json-schema/json-reference/index.mjs +5 -7
  74. package/src/refractor/visitors/json-schema/link-description/index.cjs +2 -4
  75. package/src/refractor/visitors/json-schema/link-description/index.mjs +2 -4
  76. package/src/refractor/visitors/json-schema/media/index.cjs +2 -4
  77. package/src/refractor/visitors/json-schema/media/index.mjs +2 -4
  78. package/types/apidom-ns-json-schema-draft-4.d.ts +169 -151
  79. package/src/refractor/registration.cjs +0 -19
  80. package/src/refractor/registration.mjs +0 -10
  81. package/src/traversal/visitor.cjs +0 -26
  82. package/src/traversal/visitor.mjs +0 -22
@@ -1,37 +1,28 @@
1
- import { ArrayElement } from '@speclynx/apidom-core';
2
- import { Attributes } from '@speclynx/apidom-core';
3
- import { BooleanElement } from '@speclynx/apidom-core';
1
+ import { ArrayElement } from '@speclynx/apidom-datamodel';
2
+ import { Attributes } from '@speclynx/apidom-datamodel';
3
+ import { BooleanElement } from '@speclynx/apidom-datamodel';
4
4
  import { Class } from 'ts-mixer/dist/types/types.js';
5
- import { Element as Element_2 } from '@speclynx/apidom-core';
6
- import { ElementPredicate } from '@speclynx/apidom-core';
7
- import { isArrayElement } from '@speclynx/apidom-core';
8
- import { isBooleanElement } from '@speclynx/apidom-core';
9
- import { isElement } from '@speclynx/apidom-core';
10
- import { isLinkElement } from '@speclynx/apidom-core';
11
- import { isMemberElement } from '@speclynx/apidom-core';
12
- import { isNullElement } from '@speclynx/apidom-core';
13
- import { isNumberElement } from '@speclynx/apidom-core';
14
- import { isObjectElement } from '@speclynx/apidom-core';
15
- import { isRefElement } from '@speclynx/apidom-core';
16
- import { isStringElement } from '@speclynx/apidom-core';
5
+ import { Element as Element_2 } from '@speclynx/apidom-datamodel';
17
6
  import { MediaTypes } from '@speclynx/apidom-core';
18
- import { Meta } from '@speclynx/apidom-core';
19
- import { Namespace } from 'minim';
20
- import { NamespacePluginOptions } from '@speclynx/apidom-core';
21
- import { NumberElement } from '@speclynx/apidom-core';
22
- import { ObjectElement } from '@speclynx/apidom-core';
23
- import { StringElement } from '@speclynx/apidom-core';
7
+ import { Meta } from '@speclynx/apidom-datamodel';
8
+ import { Namespace } from '@speclynx/apidom-datamodel';
9
+ import { NamespacePlugin } from '@speclynx/apidom-datamodel';
10
+ import { NumberElement } from '@speclynx/apidom-datamodel';
11
+ import { ObjectElement } from '@speclynx/apidom-datamodel';
12
+ import { Path } from '@speclynx/apidom-traverse';
13
+ import { StringElement } from '@speclynx/apidom-datamodel';
24
14
 
25
15
  /**
26
16
  * @public
27
17
  */
28
- export declare class AllOfVisitor extends AllOfVisitor_base {
18
+ export declare class AllOfVisitor extends AllOfVisitorBase {
29
19
  readonly element: ArrayElement;
30
20
  constructor(options: AllOfVisitorOptions);
31
- ArrayElement(arrayElement: ArrayElement): {};
21
+ ArrayElement(path: Path<ArrayElement>): void;
32
22
  }
33
23
 
34
- declare const AllOfVisitor_base: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
24
+ /** @public */
25
+ export declare const AllOfVisitorBase: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
35
26
 
36
27
  /**
37
28
  * @public
@@ -45,7 +36,7 @@ export declare interface AllOfVisitorOptions extends SpecificationVisitorOptions
45
36
  export declare class AlternatingVisitor extends SpecificationVisitor {
46
37
  protected alternator: Alternator[];
47
38
  constructor({ alternator, ...rest }: AlternatingVisitorOptions);
48
- enter(element: Element_2): {};
39
+ enter(path: Path<Element_2>): void;
49
40
  }
50
41
 
51
42
  /**
@@ -68,13 +59,14 @@ export declare type Alternator = {
68
59
  /**
69
60
  * @public
70
61
  */
71
- export declare class AnyOfVisitor extends AnyOfVisitor_base {
62
+ export declare class AnyOfVisitor extends AnyOfVisitorBase {
72
63
  readonly element: ArrayElement;
73
64
  constructor(options: AnyOfVisitorOptions);
74
- ArrayElement(arrayElement: ArrayElement): {};
65
+ ArrayElement(path: Path<ArrayElement>): void;
75
66
  }
76
67
 
77
- declare const AnyOfVisitor_base: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
68
+ /** @public */
69
+ export declare const AnyOfVisitorBase: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
78
70
 
79
71
  /**
80
72
  * @public
@@ -85,12 +77,7 @@ export declare interface AnyOfVisitorOptions extends SpecificationVisitorOptions
85
77
  /**
86
78
  * @public
87
79
  */
88
- export declare const createRefractor: (specPath: string[]) => (value: unknown, options?: {}) => Element_2;
89
-
90
- /**
91
- * @public
92
- */
93
- export declare class DefinitionsVisitor extends DefinitionsVisitor_base {
80
+ export declare class DefinitionsVisitor extends DefinitionsVisitorBase {
94
81
  readonly element: ObjectElement;
95
82
  protected readonly specPath: SpecPath<[
96
83
  'document',
@@ -100,7 +87,8 @@ export declare class DefinitionsVisitor extends DefinitionsVisitor_base {
100
87
  constructor(options: DefinitionsVisitorOptions);
101
88
  }
102
89
 
103
- declare const DefinitionsVisitor_base: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
90
+ /** @public */
91
+ export declare const DefinitionsVisitorBase: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
104
92
 
105
93
  /**
106
94
  * @public
@@ -111,7 +99,7 @@ export declare interface DefinitionsVisitorOptions extends MapVisitorOptions, Pa
111
99
  /**
112
100
  * @public
113
101
  */
114
- export declare class DependenciesVisitor extends DependenciesVisitor_base {
102
+ export declare class DependenciesVisitor extends DependenciesVisitorBase {
115
103
  readonly element: ObjectElement;
116
104
  protected readonly specPath: SpecPath<[
117
105
  'document',
@@ -121,7 +109,8 @@ export declare class DependenciesVisitor extends DependenciesVisitor_base {
121
109
  constructor(options: DependenciesVisitorOptions);
122
110
  }
123
111
 
124
- declare const DependenciesVisitor_base: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
112
+ /** @public */
113
+ export declare const DependenciesVisitorBase: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
125
114
 
126
115
  /**
127
116
  * @public
@@ -134,14 +123,23 @@ export declare interface DependenciesVisitorOptions extends MapVisitorOptions, P
134
123
  */
135
124
  export declare class EnumVisitor extends FallbackVisitor {
136
125
  readonly element: ArrayElement;
137
- ArrayElement(arrayElement: ArrayElement): {};
126
+ ArrayElement(path: Path<ArrayElement>): void;
138
127
  }
139
128
 
140
129
  /**
141
130
  * @public
142
131
  */
143
132
  export declare class FallbackVisitor extends Visitor {
144
- enter(element: Element_2): {};
133
+ enter(path: Path<Element_2>): void;
134
+ }
135
+
136
+ /**
137
+ * @public
138
+ */
139
+ export declare interface FixedField {
140
+ name: string;
141
+ alias?: string;
142
+ $visitor: unknown;
145
143
  }
146
144
 
147
145
  /**
@@ -151,7 +149,7 @@ export declare class FixedFieldsVisitor extends SpecificationVisitor {
151
149
  protected specPath: SpecPath;
152
150
  protected ignoredFields: string[];
153
151
  constructor({ specPath, ignoredFields, ...rest }: FixedFieldsVisitorOptions);
154
- ObjectElement(objectElement: ObjectElement): {};
152
+ ObjectElement(path: Path<ObjectElement>): void;
155
153
  }
156
154
 
157
155
  /**
@@ -170,18 +168,7 @@ export declare type Format = 'generic' | 'json' | 'yaml';
170
168
  /**
171
169
  * @public
172
170
  */
173
- export declare const getNodeType: <T extends Element_2>(element: T) => string | undefined;
174
-
175
- export { isArrayElement }
176
-
177
- export { isBooleanElement }
178
-
179
- export { isElement }
180
-
181
- /**
182
- * @public
183
- */
184
- export declare const isJSONReferenceElement: ElementPredicate<JSONReferenceElement>;
171
+ export declare const isJSONReferenceElement: (element: unknown) => element is JSONReferenceElement;
185
172
 
186
173
  /**
187
174
  * @public
@@ -191,42 +178,29 @@ export declare const isJSONReferenceLikeElement: (element: unknown) => element i
191
178
  /**
192
179
  * @public
193
180
  */
194
- export declare const isJSONSchemaElement: ElementPredicate<JSONSchemaElement>;
181
+ export declare const isJSONSchemaElement: (element: unknown) => element is JSONSchemaElement;
195
182
 
196
183
  /**
197
184
  * @public
198
185
  */
199
- export declare const isLinkDescriptionElement: ElementPredicate<LinkDescriptionElement>;
200
-
201
- export { isLinkElement }
186
+ export declare const isLinkDescriptionElement: (element: unknown) => element is LinkDescriptionElement;
202
187
 
203
188
  /**
204
189
  * @public
205
190
  */
206
- export declare const isMediaElement: ElementPredicate<MediaElement>;
207
-
208
- export { isMemberElement }
209
-
210
- export { isNullElement }
211
-
212
- export { isNumberElement }
213
-
214
- export { isObjectElement }
215
-
216
- export { isRefElement }
217
-
218
- export { isStringElement }
191
+ export declare const isMediaElement: (element: unknown) => element is MediaElement;
219
192
 
220
193
  /**
221
194
  * @public
222
195
  */
223
- export declare class ItemsVisitor extends ItemsVisitor_base {
196
+ export declare class ItemsVisitor extends ItemsVisitorBase {
224
197
  element: ArrayElement | ObjectElement;
225
- ObjectElement(objectElement: ObjectElement): {};
226
- ArrayElement(arrayElement: ArrayElement): {};
198
+ ObjectElement(path: Path<ObjectElement>): void;
199
+ ArrayElement(path: Path<ArrayElement>): void;
227
200
  }
228
201
 
229
- declare const ItemsVisitor_base: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
202
+ /** @public */
203
+ export declare const ItemsVisitorBase: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
230
204
 
231
205
  /**
232
206
  * @public
@@ -239,7 +213,7 @@ export declare interface ItemsVisitorOptions extends SpecificationVisitorOptions
239
213
  */
240
214
  export declare class JSONReference$RefVisitor extends FallbackVisitor {
241
215
  readonly element: StringElement;
242
- StringElement(stringElement: StringElement): {};
216
+ StringElement(path: Path<StringElement>): void;
243
217
  }
244
218
 
245
219
  /**
@@ -252,6 +226,7 @@ export declare class JSONReference$RefVisitor extends FallbackVisitor {
252
226
  * @public
253
227
  */
254
228
  export declare class JSONReferenceElement extends ObjectElement {
229
+ static fixedFields: FixedField[];
255
230
  constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes);
256
231
  get $ref(): StringElement | undefined;
257
232
  set $ref($ref: StringElement | undefined);
@@ -267,14 +242,15 @@ export declare interface JSONReferenceLikeElement extends ObjectElement {
267
242
  /**
268
243
  * @public
269
244
  */
270
- export declare class JSONReferenceVisitor extends JSONReferenceVisitor_base {
245
+ export declare class JSONReferenceVisitor extends JSONReferenceVisitorBase {
271
246
  readonly element: JSONReferenceElement;
272
247
  protected readonly specPath: SpecPath<['document', 'objects', 'JSONReference']>;
273
248
  constructor(options: JSONReferenceVisitorOptions);
274
- ObjectElement(objectElement: ObjectElement): {};
249
+ ObjectElement(path: Path<ObjectElement>): void;
275
250
  }
276
251
 
277
- declare const JSONReferenceVisitor_base: Class<any[], FixedFieldsVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof FallbackVisitor>;
252
+ /** @public */
253
+ export declare const JSONReferenceVisitorBase: Class<any[], FixedFieldsVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof FallbackVisitor>;
278
254
 
279
255
  /**
280
256
  * @public
@@ -285,9 +261,7 @@ export declare interface JSONReferenceVisitorOptions extends FixedFieldsVisitorO
285
261
  /**
286
262
  * @public
287
263
  */
288
- declare const jsonSchemaDraft4: {
289
- namespace: (options: NamespacePluginOptions) => Namespace;
290
- };
264
+ declare const jsonSchemaDraft4: NamespacePlugin;
291
265
  export default jsonSchemaDraft4;
292
266
 
293
267
  /**
@@ -303,14 +277,15 @@ export declare class JSONSchemaDraft4MediaTypes extends MediaTypes<string> {
303
277
  * @public
304
278
  */
305
279
  export declare class JSONSchemaElement extends ObjectElement {
280
+ static fixedFields: FixedField[];
306
281
  constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes);
307
282
  /**
308
283
  * Core vocabulary
309
284
  *
310
285
  * URI: https://tools.ietf.org/html/draft-wright-json-schema-00
311
286
  */
312
- get idProp(): StringElement | undefined;
313
- set idProp(idProp: StringElement | undefined);
287
+ get idField(): StringElement | undefined;
288
+ set idField(idField: StringElement | undefined);
314
289
  get $schema(): StringElement | undefined;
315
290
  set $schema($schema: StringElement | undefined);
316
291
  /**
@@ -345,8 +320,8 @@ export declare class JSONSchemaElement extends ObjectElement {
345
320
  */
346
321
  get additionalItems(): this | JSONReferenceElement | BooleanElement | undefined;
347
322
  set additionalItems(additionalItems: this | JSONReferenceElement | BooleanElement | undefined);
348
- get items(): this | JSONReferenceElement | ArrayElement | undefined;
349
- set items(items: this | JSONReferenceElement | ArrayElement | undefined);
323
+ get itemsField(): this | JSONReferenceElement | ArrayElement<this | JSONReferenceElement> | undefined;
324
+ set itemsField(items: this | JSONReferenceElement | ArrayElement<this | JSONReferenceElement> | undefined);
350
325
  get maxItems(): NumberElement | undefined;
351
326
  set maxItems(maxItems: NumberElement | undefined);
352
327
  get minItems(): NumberElement | undefined;
@@ -360,8 +335,8 @@ export declare class JSONSchemaElement extends ObjectElement {
360
335
  set maxProperties(maxProperties: NumberElement | undefined);
361
336
  get minProperties(): NumberElement | undefined;
362
337
  set minProperties(minProperties: NumberElement | undefined);
363
- get required(): ArrayElement | undefined;
364
- set required(required: ArrayElement | undefined);
338
+ get required(): ArrayElement<StringElement> | undefined;
339
+ set required(required: ArrayElement<StringElement> | undefined);
365
340
  get properties(): ObjectElement | undefined;
366
341
  set properties(properties: ObjectElement | undefined);
367
342
  get additionalProperties(): this | JSONReferenceElement | BooleanElement | undefined;
@@ -373,16 +348,16 @@ export declare class JSONSchemaElement extends ObjectElement {
373
348
  /**
374
349
  * Validation keywords for any instance type
375
350
  */
376
- get enum(): ArrayElement | undefined;
377
- set enum(enumValue: ArrayElement | undefined);
378
- get type(): ArrayElement | StringElement | undefined;
379
- set type(type: ArrayElement | StringElement | undefined);
380
- get allOf(): ArrayElement | undefined;
381
- set allOf(allOf: ArrayElement | undefined);
382
- get anyOf(): ArrayElement | undefined;
383
- set anyOf(anyOf: ArrayElement | undefined);
384
- get oneOf(): ArrayElement | undefined;
385
- set oneOf(oneOf: ArrayElement | undefined);
351
+ get enum(): ArrayElement<Element_2> | undefined;
352
+ set enum(enumValue: ArrayElement<Element_2> | undefined);
353
+ get type(): ArrayElement<StringElement> | StringElement | undefined;
354
+ set type(type: ArrayElement<StringElement> | StringElement | undefined);
355
+ get allOf(): ArrayElement<this | JSONReferenceElement> | undefined;
356
+ set allOf(allOf: ArrayElement<this | JSONReferenceElement> | undefined);
357
+ get anyOf(): ArrayElement<this | JSONReferenceElement> | undefined;
358
+ set anyOf(anyOf: ArrayElement<this | JSONReferenceElement> | undefined);
359
+ get oneOf(): ArrayElement<this | JSONReferenceElement> | undefined;
360
+ set oneOf(oneOf: ArrayElement<this | JSONReferenceElement> | undefined);
386
361
  get not(): this | JSONReferenceElement | undefined;
387
362
  set not(not: this | JSONReferenceElement | undefined);
388
363
  get definitions(): ObjectElement | undefined;
@@ -412,8 +387,8 @@ export declare class JSONSchemaElement extends ObjectElement {
412
387
  */
413
388
  get base(): StringElement | undefined;
414
389
  set base(base: StringElement | undefined);
415
- get links(): ArrayElement | undefined;
416
- set links(links: ArrayElement | undefined);
390
+ get linksField(): ArrayElement<LinkDescriptionElement> | undefined;
391
+ set linksField(links: ArrayElement<LinkDescriptionElement> | undefined);
417
392
  get media(): MediaElement | undefined;
418
393
  set media(media: MediaElement | undefined);
419
394
  get readOnly(): BooleanElement | undefined;
@@ -423,17 +398,18 @@ export declare class JSONSchemaElement extends ObjectElement {
423
398
  /**
424
399
  * @public
425
400
  */
426
- export declare class JSONSchemaVisitor extends JSONSchemaVisitor_base {
401
+ export declare class JSONSchemaVisitor extends JSONSchemaVisitorBase {
427
402
  element: JSONSchemaElement;
428
403
  protected readonly specPath: SpecPath<['document', 'objects', 'JSONSchema']>;
429
404
  constructor(options: JSONSchemaVisitorOptions);
430
405
  get defaultDialectIdentifier(): string;
431
- ObjectElement(objectElement: ObjectElement): {};
406
+ ObjectElement(path: Path<ObjectElement>): void;
432
407
  handleDialectIdentifier(objectElement: ObjectElement): void;
433
408
  handleSchemaIdentifier(objectElement: ObjectElement, identifierKeyword?: string): void;
434
409
  }
435
410
 
436
- declare const JSONSchemaVisitor_base: Class<any[], FixedFieldsVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
411
+ /** @public */
412
+ export declare const JSONSchemaVisitorBase: Class<any[], FixedFieldsVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
437
413
 
438
414
  /**
439
415
  * @public
@@ -441,34 +417,12 @@ declare const JSONSchemaVisitor_base: Class<any[], FixedFieldsVisitor & ParentSc
441
417
  export declare interface JSONSchemaVisitorOptions extends FixedFieldsVisitorOptions, ParentSchemaAwareVisitorOptions, VisitorOptions {
442
418
  }
443
419
 
444
- /**
445
- * @public
446
- */
447
- export declare const keyMap: {
448
- ObjectElement: string[];
449
- ArrayElement: string[];
450
- MemberElement: string[];
451
- StringElement: never[];
452
- BooleanElement: never[];
453
- NumberElement: never[];
454
- NullElement: never[];
455
- RefElement: never[];
456
- LinkElement: never[];
457
- Annotation: never[];
458
- Comment: never[];
459
- ParseResultElement: string[];
460
- SourceMap: string[];
461
- JSONSchemaDraft4Element: string[];
462
- JSONReferenceElement: string[];
463
- MediaElement: string[];
464
- LinkDescriptionElement: string[];
465
- };
466
-
467
420
  /**
468
421
  * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-00#section-5
469
422
  * @public
470
423
  */
471
424
  export declare class LinkDescriptionElement extends ObjectElement {
425
+ static fixedFields: FixedField[];
472
426
  constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes);
473
427
  get href(): StringElement | undefined;
474
428
  set href(href: StringElement | undefined);
@@ -491,13 +445,14 @@ export declare class LinkDescriptionElement extends ObjectElement {
491
445
  /**
492
446
  * @public
493
447
  */
494
- export declare class LinkDescriptionVisitor extends LinkDescriptionVisitor_base {
448
+ export declare class LinkDescriptionVisitor extends LinkDescriptionVisitorBase {
495
449
  readonly element: LinkDescriptionElement;
496
450
  protected readonly specPath: SpecPath<['document', 'objects', 'LinkDescription']>;
497
451
  constructor(options: LinkDescriptionVisitorOptions);
498
452
  }
499
453
 
500
- declare const LinkDescriptionVisitor_base: Class<any[], FixedFieldsVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof FallbackVisitor>;
454
+ /** @public */
455
+ export declare const LinkDescriptionVisitorBase: Class<any[], FixedFieldsVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof FallbackVisitor>;
501
456
 
502
457
  /**
503
458
  * @public
@@ -508,13 +463,14 @@ export declare interface LinkDescriptionVisitorOptions extends FixedFieldsVisito
508
463
  /**
509
464
  * @public
510
465
  */
511
- export declare class LinksVisitor extends LinksVisitor_base {
466
+ export declare class LinksVisitor extends LinksVisitorBase {
512
467
  readonly element: ArrayElement;
513
468
  constructor(options: LinksVisitorOptions);
514
- ArrayElement(arrayElement: ArrayElement): {};
469
+ ArrayElement(path: Path<ArrayElement>): void;
515
470
  }
516
471
 
517
- declare const LinksVisitor_base: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
472
+ /** @public */
473
+ export declare const LinksVisitorBase: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
518
474
 
519
475
  /**
520
476
  * @public
@@ -540,6 +496,7 @@ export declare interface MapVisitorOptions extends PatternedFieldsVisitorOptions
540
496
  * @public
541
497
  */
542
498
  export declare class MediaElement extends ObjectElement {
499
+ static fixedFields: FixedField[];
543
500
  constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes);
544
501
  get binaryEncoding(): StringElement | undefined;
545
502
  set binaryEncoding(binaryEncoding: StringElement | undefined);
@@ -555,13 +512,14 @@ export declare const mediaTypes: JSONSchemaDraft4MediaTypes;
555
512
  /**
556
513
  * @public
557
514
  */
558
- export declare class MediaVisitor extends MediaVisitor_base {
515
+ export declare class MediaVisitor extends MediaVisitorBase {
559
516
  readonly element: MediaElement;
560
517
  protected readonly specPath: SpecPath<['document', 'objects', 'Media']>;
561
518
  constructor(options: MediaVisitorOptions);
562
519
  }
563
520
 
564
- declare const MediaVisitor_base: Class<any[], FixedFieldsVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof FallbackVisitor>;
521
+ /** @public */
522
+ export declare const MediaVisitorBase: Class<any[], FixedFieldsVisitor & FallbackVisitor, typeof FixedFieldsVisitor & typeof FallbackVisitor>;
565
523
 
566
524
  /**
567
525
  * @public
@@ -572,13 +530,14 @@ export declare interface MediaVisitorOptions extends FixedFieldsVisitorOptions,
572
530
  /**
573
531
  * @public
574
532
  */
575
- export declare class OneOfVisitor extends OneOfVisitor_base {
533
+ export declare class OneOfVisitor extends OneOfVisitorBase {
576
534
  readonly element: ArrayElement;
577
535
  constructor(options: OneOfVisitorOptions);
578
- ArrayElement(arrayElement: ArrayElement): {};
536
+ ArrayElement(path: Path<ArrayElement>): void;
579
537
  }
580
538
 
581
- declare const OneOfVisitor_base: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
539
+ /** @public */
540
+ export declare const OneOfVisitorBase: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
582
541
 
583
542
  /**
584
543
  * @public
@@ -609,7 +568,7 @@ export declare class PatternedFieldsVisitor extends SpecificationVisitor {
609
568
  protected ignoredFields: string[];
610
569
  protected fieldPatternPredicate: (value: unknown) => boolean;
611
570
  constructor({ specPath, ignoredFields, fieldPatternPredicate, ...rest }: PatternedFieldsVisitorOptions);
612
- ObjectElement(objectElement: ObjectElement): {};
571
+ ObjectElement(path: Path<ObjectElement>): void;
613
572
  }
614
573
 
615
574
  /**
@@ -624,7 +583,7 @@ export declare interface PatternedFieldsVisitorOptions extends SpecificationVisi
624
583
  /**
625
584
  * @public
626
585
  */
627
- export declare class PatternPropertiesVisitor extends PatternPropertiesVisitor_base {
586
+ export declare class PatternPropertiesVisitor extends PatternPropertiesVisitorBase {
628
587
  readonly element: ObjectElement;
629
588
  protected readonly specPath: SpecPath<[
630
589
  'document',
@@ -634,7 +593,8 @@ export declare class PatternPropertiesVisitor extends PatternPropertiesVisitor_b
634
593
  constructor(options: PatternPropertiesVisitorOptions);
635
594
  }
636
595
 
637
- declare const PatternPropertiesVisitor_base: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
596
+ /** @public */
597
+ export declare const PatternPropertiesVisitorBase: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
638
598
 
639
599
  /**
640
600
  * @public
@@ -645,7 +605,7 @@ export declare interface PatternPropertiesVisitorOptions extends MapVisitorOptio
645
605
  /**
646
606
  * @public
647
607
  */
648
- export declare class PropertiesVisitor extends PropertiesVisitor_base {
608
+ export declare class PropertiesVisitor extends PropertiesVisitorBase {
649
609
  readonly element: ObjectElement;
650
610
  protected readonly specPath: SpecPath<[
651
611
  'document',
@@ -655,7 +615,8 @@ export declare class PropertiesVisitor extends PropertiesVisitor_base {
655
615
  constructor(options: PropertiesVisitorOptions);
656
616
  }
657
617
 
658
- declare const PropertiesVisitor_base: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
618
+ /** @public */
619
+ export declare const PropertiesVisitorBase: Class<any[], MapVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof MapVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
659
620
 
660
621
  /**
661
622
  * @public
@@ -666,18 +627,56 @@ export declare interface PropertiesVisitorOptions extends MapVisitorOptions, Par
666
627
  /**
667
628
  * @public
668
629
  */
669
- export declare const refract: <T extends Element_2>(value: unknown, { specPath, plugins, specificationObj, }?: {
670
- specPath?: string[];
671
- plugins?: any[];
672
- specificationObj?: object;
673
- }) => T;
630
+ export declare const refract: <T extends Element_2>(value: unknown, { element, plugins, specificationObj, }?: RefractorOptions) => T;
631
+
632
+ /**
633
+ * Refracts a value into a JSONReferenceElement.
634
+ * @public
635
+ */
636
+ export declare const refractJSONReference: <T extends Element_2 = JSONReferenceElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
637
+
638
+ /**
639
+ * Refracts a value into a JSONSchemaElement.
640
+ * @public
641
+ */
642
+ export declare const refractJSONSchema: <T extends Element_2 = JSONSchemaElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
643
+
644
+ /**
645
+ * Refracts a value into a LinkDescriptionElement.
646
+ * @public
647
+ */
648
+ export declare const refractLinkDescription: <T extends Element_2 = LinkDescriptionElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
649
+
650
+ /**
651
+ * Refracts a value into a MediaElement.
652
+ * @public
653
+ */
654
+ export declare const refractMedia: <T extends Element_2 = MediaElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
655
+
656
+ /**
657
+ * @public
658
+ */
659
+ export declare interface RefractorOptions {
660
+ readonly element?: string;
661
+ readonly plugins?: RefractorPlugin[];
662
+ readonly specificationObj?: typeof specificationObj;
663
+ }
664
+
665
+ /**
666
+ * @public
667
+ */
668
+ export declare type RefractorPlugin = (toolbox: Toolbox) => {
669
+ visitor?: object;
670
+ pre?: () => void;
671
+ post?: () => void;
672
+ };
674
673
 
675
674
  /**
676
675
  * @public
677
676
  */
678
677
  export declare const refractorPluginReplaceEmptyElement: () => () => {
679
678
  visitor: {
680
- StringElement(element: StringElement, key: any, parent: any, path: any, ancestors: any[]): any;
679
+ StringElement(path: Path<StringElement>): void;
681
680
  };
682
681
  };
683
682
 
@@ -686,7 +685,7 @@ export declare const refractorPluginReplaceEmptyElement: () => () => {
686
685
  */
687
686
  export declare class RequiredVisitor extends FallbackVisitor {
688
687
  readonly element: ArrayElement;
689
- ArrayElement(arrayElement: ArrayElement): {};
688
+ ArrayElement(path: Path<ArrayElement>): void;
690
689
  }
691
690
 
692
691
  /**
@@ -712,10 +711,12 @@ export declare const specificationObj: {
712
711
  document: {
713
712
  objects: {
714
713
  JSONSchema: {
714
+ element: string;
715
715
  $visitor: typeof JSONSchemaVisitor;
716
716
  fixedFields: {
717
717
  id: {
718
- $ref: string;
718
+ $visitor: typeof FallbackVisitor;
719
+ alias: string;
719
720
  };
720
721
  $schema: {
721
722
  $ref: string;
@@ -745,7 +746,10 @@ export declare const specificationObj: {
745
746
  $ref: string;
746
747
  };
747
748
  additionalItems: typeof SchemaOrReferenceVisitor;
748
- items: typeof ItemsVisitor;
749
+ items: {
750
+ $visitor: typeof ItemsVisitor;
751
+ alias: string;
752
+ };
749
753
  maxItems: {
750
754
  $ref: string;
751
755
  };
@@ -788,7 +792,10 @@ export declare const specificationObj: {
788
792
  base: {
789
793
  $ref: string;
790
794
  };
791
- links: typeof LinksVisitor;
795
+ links: {
796
+ $visitor: typeof LinksVisitor;
797
+ alias: string;
798
+ };
792
799
  media: {
793
800
  $ref: string;
794
801
  };
@@ -798,12 +805,14 @@ export declare const specificationObj: {
798
805
  };
799
806
  };
800
807
  JSONReference: {
808
+ element: string;
801
809
  $visitor: typeof JSONReferenceVisitor;
802
810
  fixedFields: {
803
811
  $ref: typeof JSONReference$RefVisitor;
804
812
  };
805
813
  };
806
814
  Media: {
815
+ element: string;
807
816
  $visitor: typeof MediaVisitor;
808
817
  fixedFields: {
809
818
  binaryEncoding: {
@@ -815,6 +824,7 @@ export declare const specificationObj: {
815
824
  };
816
825
  };
817
826
  LinkDescription: {
827
+ element: string;
818
828
  $visitor: typeof LinkDescriptionVisitor;
819
829
  fixedFields: {
820
830
  href: {
@@ -872,13 +882,21 @@ export declare interface SpecificationVisitorOptions extends VisitorOptions {
872
882
  */
873
883
  export declare type SpecPath<T = string[]> = (element: unknown) => T;
874
884
 
885
+ /**
886
+ * @public
887
+ */
888
+ export declare interface Toolbox {
889
+ predicates: Record<string, (...args: any[]) => boolean>;
890
+ namespace: Namespace;
891
+ }
892
+
875
893
  /**
876
894
  * @public
877
895
  */
878
896
  export declare class TypeVisitor extends FallbackVisitor {
879
897
  readonly element: StringElement | ArrayElement;
880
- StringElement(stringElement: StringElement): {};
881
- ArrayElement(arrayElement: ArrayElement): {};
898
+ StringElement(path: Path<StringElement>): void;
899
+ ArrayElement(path: Path<ArrayElement>): void;
882
900
  }
883
901
 
884
902
  /**