@hyperjump/json-schema 0.20.0 → 0.23.0

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.
@@ -1909,7 +1909,7 @@ const compile$P = (pointer) => {
1909
1909
  return pointer.split("/").slice(1).map(unescape);
1910
1910
  };
1911
1911
 
1912
- const get$1 = (pointer, value = undefined) => {
1912
+ const get$2 = (pointer, value = undefined) => {
1913
1913
  const ptr = compile$P(pointer);
1914
1914
 
1915
1915
  const fn = (value) => ptr.reduce(([value, pointer], segment) => {
@@ -2028,7 +2028,7 @@ const applySegment = (value, segment, cursor = "") => {
2028
2028
 
2029
2029
  const isScalar = (value) => value === null || typeof value !== "object";
2030
2030
 
2031
- var lib$3 = { nil: nil$2, append, get: get$1, set, assign, unset, remove };
2031
+ var lib$3 = { nil: nil$2, append, get: get$2, set, assign, unset, remove };
2032
2032
 
2033
2033
  const $__value = Symbol("$__value");
2034
2034
  const $__href = Symbol("$__href");
@@ -2052,6 +2052,15 @@ const Reference$2 = reference;
2052
2052
 
2053
2053
  const nil$1 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
2054
2054
  const cons = (instance, id = "") => Object.freeze({ ...nil$1, id: resolveUrl$2(id, ""), instance, value: instance });
2055
+
2056
+ const get$1 = (url, instance = nil$1) => {
2057
+ if (!url.startsWith("#")) {
2058
+ throw Error(`No JSON document found at '${url.split("#")[0]}'`);
2059
+ }
2060
+
2061
+ return Object.freeze({ ...instance, pointer: url.substr(1) });
2062
+ };
2063
+
2055
2064
  const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
2056
2065
  const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
2057
2066
  const has$1 = (key, doc) => key in value$1(doc);
@@ -2071,6 +2080,9 @@ const keys$1 = (doc) => Object.keys(value$1(doc));
2071
2080
  const map$4 = curry$8((fn, doc) => value$1(doc)
2072
2081
  .map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2073
2082
 
2083
+ const forEach = curry$8((fn, doc) => value$1(doc)
2084
+ .forEach((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2085
+
2074
2086
  const filter$1 = curry$8((fn, doc) => value$1(doc)
2075
2087
  .map((item, ndx, array, thisArg) => step$1(ndx, doc))
2076
2088
  .filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
@@ -2086,7 +2098,92 @@ const some$1 = curry$8((fn, doc) => value$1(doc)
2086
2098
 
2087
2099
  const length$1 = (doc) => value$1(doc).length;
2088
2100
 
2089
- var instance = { nil: nil$1, cons, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, step: step$1, entries: entries$3, keys: keys$1, map: map$4, filter: filter$1, reduce: reduce$3, every: every$1, some: some$1, length: length$1 };
2101
+ var instance = {
2102
+ nil: nil$1, cons, get: get$1, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, length: length$1,
2103
+ step: step$1, entries: entries$3, keys: keys$1, map: map$4, forEach, filter: filter$1, reduce: reduce$3, every: every$1, some: some$1
2104
+ };
2105
+
2106
+ var entries$2 = async (doc) => Object.entries(await doc);
2107
+
2108
+ const curry$7 = justCurryIt;
2109
+
2110
+
2111
+ var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
2112
+
2113
+ const curry$6 = justCurryIt;
2114
+
2115
+
2116
+ var reduce$2 = curry$6(async (fn, acc, doc) => {
2117
+ return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
2118
+ });
2119
+
2120
+ const curry$5 = justCurryIt;
2121
+ const reduce$1 = reduce$2;
2122
+
2123
+
2124
+ var filter = curry$5(async (fn, doc, options = {}) => {
2125
+ return reduce$1(async (acc, item) => {
2126
+ return (await fn(item)) ? acc.concat([item]) : acc;
2127
+ }, [], doc, options);
2128
+ });
2129
+
2130
+ const curry$4 = justCurryIt;
2131
+ const map$2 = map$3;
2132
+
2133
+
2134
+ var some = curry$4(async (fn, doc) => {
2135
+ const results = await map$2(fn, doc);
2136
+ return (await Promise.all(results))
2137
+ .some((a) => a);
2138
+ });
2139
+
2140
+ const curry$3 = justCurryIt;
2141
+ const map$1 = map$3;
2142
+
2143
+
2144
+ var every = curry$3(async (fn, doc) => {
2145
+ const results = await map$1(fn, doc);
2146
+ return (await Promise.all(results))
2147
+ .every((a) => a);
2148
+ });
2149
+
2150
+ const curry$2 = justCurryIt;
2151
+
2152
+
2153
+ var pipeline$1 = curry$2((fns, doc) => {
2154
+ return fns.reduce(async (acc, fn) => fn(await acc), doc);
2155
+ });
2156
+
2157
+ var all = (doc) => Promise.all(doc);
2158
+
2159
+ const pipeline = pipeline$1;
2160
+ const entries$1 = entries$2;
2161
+ const reduce = reduce$2;
2162
+
2163
+
2164
+ var allValues = (doc) => {
2165
+ return pipeline([
2166
+ entries$1,
2167
+ reduce(async (acc, [propertyName, propertyValue]) => {
2168
+ acc[propertyName] = await propertyValue;
2169
+ return acc;
2170
+ }, {})
2171
+ ], doc);
2172
+ };
2173
+
2174
+ var lib$2 = {
2175
+ entries: entries$2,
2176
+ map: map$3,
2177
+ filter: filter,
2178
+ reduce: reduce$2,
2179
+ some: some,
2180
+ every: every,
2181
+ pipeline: pipeline$1,
2182
+ all: all,
2183
+ allValues: allValues
2184
+ };
2185
+
2186
+ var fetch_browser = fetch;
2090
2187
 
2091
2188
  var contentType = {};
2092
2189
 
@@ -2142,7 +2239,7 @@ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
2142
2239
  */
2143
2240
 
2144
2241
  contentType.format = format$1;
2145
- contentType.parse = parse;
2242
+ contentType.parse = parse$1;
2146
2243
 
2147
2244
  /**
2148
2245
  * Format object to media type.
@@ -2193,7 +2290,7 @@ function format$1 (obj) {
2193
2290
  * @public
2194
2291
  */
2195
2292
 
2196
- function parse (string) {
2293
+ function parse$1 (string) {
2197
2294
  if (!string) {
2198
2295
  throw new TypeError('argument string is required')
2199
2296
  }
@@ -2311,102 +2408,54 @@ function ContentType (type) {
2311
2408
  this.type = type;
2312
2409
  }
2313
2410
 
2314
- var entries$2 = async (doc) => Object.entries(await doc);
2315
-
2316
- const curry$7 = justCurryIt;
2317
-
2318
-
2319
- var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
2320
-
2321
- const curry$6 = justCurryIt;
2322
-
2323
-
2324
- var reduce$2 = curry$6(async (fn, acc, doc) => {
2325
- return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
2326
- });
2327
-
2328
- const curry$5 = justCurryIt;
2329
- const reduce$1 = reduce$2;
2330
-
2331
-
2332
- var filter = curry$5(async (fn, doc, options = {}) => {
2333
- return reduce$1(async (acc, item) => {
2334
- return (await fn(item)) ? acc.concat([item]) : acc;
2335
- }, [], doc, options);
2336
- });
2337
-
2338
- const curry$4 = justCurryIt;
2339
- const map$2 = map$3;
2340
-
2341
-
2342
- var some = curry$4(async (fn, doc) => {
2343
- const results = await map$2(fn, doc);
2344
- return (await Promise.all(results))
2345
- .some((a) => a);
2346
- });
2347
-
2348
- const curry$3 = justCurryIt;
2349
- const map$1 = map$3;
2350
-
2351
-
2352
- var every = curry$3(async (fn, doc) => {
2353
- const results = await map$1(fn, doc);
2354
- return (await Promise.all(results))
2355
- .every((a) => a);
2356
- });
2357
-
2358
- const curry$2 = justCurryIt;
2359
-
2411
+ const contentTypeParser = contentType;
2360
2412
 
2361
- var pipeline$1 = curry$2((fns, doc) => {
2362
- return fns.reduce(async (acc, fn) => fn(await acc), doc);
2363
- });
2364
2413
 
2365
- var all = (doc) => Promise.all(doc);
2366
-
2367
- const pipeline = pipeline$1;
2368
- const entries$1 = entries$2;
2369
- const reduce = reduce$2;
2414
+ const mediaTypePlugins = {};
2370
2415
 
2416
+ const addPlugin = (contentType, plugin) => {
2417
+ mediaTypePlugins[contentType] = plugin;
2418
+ };
2371
2419
 
2372
- var allValues = (doc) => {
2373
- return pipeline([
2374
- entries$1,
2375
- reduce(async (acc, [propertyName, propertyValue]) => {
2376
- acc[propertyName] = await propertyValue;
2377
- return acc;
2378
- }, {})
2379
- ], doc);
2420
+ const parse = (response) => {
2421
+ const contentType = contentTypeParser.parse(response.headers.get("content-type"));
2422
+ if (!(contentType.type in mediaTypePlugins)) {
2423
+ throw Error(`${response.url} is not a schema. Found a document with media type: ${contentType.type}`);
2424
+ }
2425
+ return mediaTypePlugins[contentType.type].parse(response, contentType.parameters);
2380
2426
  };
2381
2427
 
2382
- var lib$2 = {
2383
- entries: entries$2,
2384
- map: map$3,
2385
- filter: filter,
2386
- reduce: reduce$2,
2387
- some: some,
2388
- every: every,
2389
- pipeline: pipeline$1,
2390
- all: all,
2391
- allValues: allValues
2428
+ const getContentType = (path) => {
2429
+ for (const contentType in mediaTypePlugins) {
2430
+ if (mediaTypePlugins[contentType].matcher(path)) {
2431
+ return contentType;
2432
+ }
2433
+ }
2434
+
2435
+ return "application/octet-stream";
2392
2436
  };
2393
2437
 
2394
- var fetch_browser = fetch;
2438
+ var mediaTypes = { addPlugin, parse, getContentType };
2395
2439
 
2396
- const contentTypeParser = contentType;
2397
2440
  const curry$1 = justCurryIt;
2398
2441
  const Pact$a = lib$2;
2399
2442
  const JsonPointer = lib$3;
2400
2443
  const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
2401
2444
  const fetch$1 = fetch_browser;
2402
2445
  const Reference$1 = reference;
2446
+ const MediaTypes$1 = mediaTypes;
2447
+
2403
2448
 
2449
+ const core201909Id = "https://json-schema.org/draft/2019-09/vocab/core";
2450
+ const core202012Id = "https://json-schema.org/draft/2020-12/vocab/core";
2404
2451
 
2405
2452
  // Config
2406
2453
  const config = {};
2407
2454
  const dialectJsonSchemaVersion = {};
2408
2455
 
2409
2456
  const setConfig = (jsonSchemaVersion, key, value) => {
2457
+ dialectJsonSchemaVersion[jsonSchemaVersion] = jsonSchemaVersion;
2458
+
2410
2459
  if (!config[jsonSchemaVersion]) {
2411
2460
  config[jsonSchemaVersion] = {};
2412
2461
  }
@@ -2414,10 +2463,8 @@ const setConfig = (jsonSchemaVersion, key, value) => {
2414
2463
  };
2415
2464
 
2416
2465
  const getConfig = (dialectId, key) => {
2417
- const jsonSchemaVersion = dialectJsonSchemaVersion[dialectId] || dialectId;
2418
- if (jsonSchemaVersion in config) {
2419
- return config[jsonSchemaVersion][key];
2420
- }
2466
+ const jsonSchemaVersion = dialectJsonSchemaVersion[dialectId];
2467
+ return config[jsonSchemaVersion]?.[key];
2421
2468
  };
2422
2469
 
2423
2470
  // Schema Management
@@ -2426,6 +2473,7 @@ const schemaStoreAlias = {};
2426
2473
 
2427
2474
  const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
2428
2475
  schema = JSON.parse(JSON.stringify(schema));
2476
+ const externalId = resolveUrl$1(url, "");
2429
2477
 
2430
2478
  // Dialect / JSON Schema Version
2431
2479
  const dialectId = resolveUrl$1(schema["$schema"] || defaultSchemaVersion, "");
@@ -2434,35 +2482,45 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
2434
2482
  }
2435
2483
  delete schema["$schema"];
2436
2484
 
2437
- let jsonSchemaVersion;
2438
- if (schema.$vocabulary?.["https://json-schema.org/draft/2019-09/vocab/core"] === true) {
2439
- jsonSchemaVersion = "https://json-schema.org/draft/2019-09/vocab/core";
2440
- } else if (schema.$vocabulary?.["https://json-schema.org/draft/2020-12/vocab/core"] === true) {
2441
- jsonSchemaVersion = "https://json-schema.org/draft/2020-12/vocab/core";
2442
- } else {
2443
- jsonSchemaVersion = dialectJsonSchemaVersion[dialectId] || dialectId;
2485
+ // Determine JSON Schema version
2486
+ if (!(dialectId in dialectJsonSchemaVersion)) {
2487
+ if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core201909Id)[0]) {
2488
+ // Self describing 2019-09 meta-schema
2489
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
2490
+ } else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core202012Id)[0]) {
2491
+ // Self describing 2020-12 meta-schema
2492
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
2493
+ } else {
2494
+ // Need to look at meta-schema to determine version
2495
+ const metaSchema = schemaStore[dialectId];
2496
+ if (!metaSchema) {
2497
+ throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
2498
+ } else if (metaSchema.vocabulary[core201909Id] === true) {
2499
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
2500
+ } else if (metaSchema.vocabulary[core202012Id] === true) {
2501
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
2502
+ } else {
2503
+ // Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
2504
+ dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
2505
+ }
2506
+ }
2444
2507
  }
2445
2508
 
2446
- // Identifier
2447
- const baseToken = getConfig(jsonSchemaVersion, "baseToken");
2448
- const anchorToken = getConfig(jsonSchemaVersion, "anchorToken");
2449
- const externalId = resolveUrl$1(url, "");
2450
- if (!externalId && !resolveUrl$1(schema[baseToken] || "", "")) {
2509
+ // Internal Identifier
2510
+ const [id, fragment] = getSchemaIdentifier(schema, externalId, dialectJsonSchemaVersion[dialectId]);
2511
+ if (!id) {
2451
2512
  throw Error("Couldn't determine an identifier for the schema");
2452
2513
  }
2453
- const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
2454
- const id = resolveUrl$1(internalUrl, "");
2455
- const fragment = urlFragment(internalUrl);
2514
+ const baseToken = getConfig(dialectId, "baseToken");
2456
2515
  delete schema[baseToken];
2457
- if (fragment && baseToken === anchorToken) {
2458
- schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
2459
- }
2460
2516
  if (externalId) {
2461
2517
  schemaStoreAlias[externalId] = id;
2462
2518
  }
2463
2519
 
2464
- // JSON Schema version
2465
- dialectJsonSchemaVersion[id] = jsonSchemaVersion;
2520
+ const anchorToken = getConfig(dialectId, "anchorToken");
2521
+ if (fragment && baseToken === anchorToken) {
2522
+ schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
2523
+ }
2466
2524
 
2467
2525
  // recursiveAnchor
2468
2526
  const dynamicAnchors = {};
@@ -2498,6 +2556,12 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
2498
2556
  return id;
2499
2557
  };
2500
2558
 
2559
+ const getSchemaIdentifier = (schema, externalId, jsonSchemaVersion) => {
2560
+ const baseToken = config[jsonSchemaVersion]?.["baseToken"];
2561
+ const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
2562
+ return [resolveUrl$1(internalUrl, ""), urlFragment(internalUrl)];
2563
+ };
2564
+
2501
2565
  const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
2502
2566
  if (jsonTypeOf(subject, "object")) {
2503
2567
  const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
@@ -2575,14 +2639,15 @@ const get = async (url, contextDoc = nil) => {
2575
2639
  throw Error(`Failed to retrieve schema with id: ${id}`);
2576
2640
  }
2577
2641
 
2578
- if (response.headers.has("content-type")) {
2579
- const contentType = contentTypeParser.parse(response.headers.get("content-type")).type;
2580
- if (contentType !== "application/schema+json") {
2581
- throw Error(`${id} is not a schema. Found a document with media type: ${contentType}`);
2582
- }
2642
+ const [schema, defaultDialectId] = await MediaTypes$1.parse(response);
2643
+
2644
+ // Make sure the meta-schema is loaded if this isn't a known dialect
2645
+ const dialectId = resolveUrl$1(schema.$schema, "") || defaultDialectId;
2646
+ if (id !== dialectId && !(dialectId in dialectJsonSchemaVersion)) {
2647
+ await get(dialectId);
2583
2648
  }
2584
2649
 
2585
- add$1(await response.json(), id);
2650
+ add$1(schema, id);
2586
2651
  }
2587
2652
 
2588
2653
  const storedSchema = getStoredSchema(id);
@@ -2719,12 +2784,22 @@ class InvalidSchemaError$3 extends Error {
2719
2784
 
2720
2785
  var invalidSchemaError = InvalidSchemaError$3;
2721
2786
 
2787
+ const Schema$R = schema$5;
2788
+
2789
+
2790
+ const compile$O = (schema) => Schema$R.value(schema);
2791
+ const interpret$O = () => true;
2792
+
2793
+ var metaData$4 = { compile: compile$O, interpret: interpret$O };
2794
+
2722
2795
  const curry = justCurryIt;
2723
2796
  const PubSub$1 = pubsub.exports;
2724
2797
  const { resolveUrl } = common$1;
2725
2798
  const Instance$E = instance;
2726
- const Schema$R = schema$5;
2799
+ const Schema$Q = schema$5;
2727
2800
  const InvalidSchemaError$2 = invalidSchemaError;
2801
+ const MediaTypes = mediaTypes;
2802
+ const metaData$3 = metaData$4;
2728
2803
 
2729
2804
 
2730
2805
  const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
@@ -2732,20 +2807,28 @@ const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE"
2732
2807
  let metaOutputFormat = DETAILED;
2733
2808
  let shouldMetaValidate = true;
2734
2809
 
2810
+ MediaTypes.addPlugin("application/schema+json", {
2811
+ parse: async (response, contentTypeParameters) => [
2812
+ await response.json(),
2813
+ contentTypeParameters.schema || contentTypeParameters.profile
2814
+ ],
2815
+ matcher: (path) => path.endsWith(".schema.json")
2816
+ });
2817
+
2735
2818
  const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
2736
- const compiled = await compile$O(schema);
2737
- const interpretAst = (value, outputFormat) => interpret$O(compiled, Instance$E.cons(value), outputFormat);
2819
+ const compiled = await compile$N(schema);
2820
+ const interpretAst = (value, outputFormat) => interpret$N(compiled, Instance$E.cons(value), outputFormat);
2738
2821
 
2739
2822
  return value === undefined ? interpretAst : interpretAst(value, outputFormat);
2740
2823
  };
2741
2824
 
2742
- const compile$O = async (schema) => {
2825
+ const compile$N = async (schema) => {
2743
2826
  const ast = { metaData: {} };
2744
2827
  const schemaUri = await compileSchema(schema, ast);
2745
2828
  return { ast, schemaUri };
2746
2829
  };
2747
2830
 
2748
- const interpret$O = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
2831
+ const interpret$N = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
2749
2832
  if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
2750
2833
  throw Error(`The '${outputFormat}' error format is not supported`);
2751
2834
  }
@@ -2799,7 +2882,7 @@ const setShouldMetaValidate = (isEnabled) => {
2799
2882
  };
2800
2883
 
2801
2884
  const _keywords = {};
2802
- const getKeyword = (id) => _keywords[id];
2885
+ const getKeyword = (id) => _keywords[id] || metaData$3;
2803
2886
  const hasKeyword = (id) => id in _keywords;
2804
2887
  const addKeyword = (id, keywordHandler) => {
2805
2888
  _keywords[id] = {
@@ -2820,10 +2903,10 @@ const compileSchema = async (schema, ast) => {
2820
2903
 
2821
2904
  // Vocabularies
2822
2905
  if (!hasKeyword(`${schema.dialectId}#validate`)) {
2823
- const metaSchema = await Schema$R.get(schema.dialectId);
2906
+ const metaSchema = await Schema$Q.get(schema.dialectId);
2824
2907
 
2825
2908
  // Check for mandatory vocabularies
2826
- const mandatoryVocabularies = Schema$R.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
2909
+ const mandatoryVocabularies = Schema$Q.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
2827
2910
  mandatoryVocabularies.forEach((vocabularyId) => {
2828
2911
  if (!metaSchema.vocabulary[vocabularyId]) {
2829
2912
  throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
@@ -2846,13 +2929,13 @@ const compileSchema = async (schema, ast) => {
2846
2929
 
2847
2930
  // Meta validation
2848
2931
  if (shouldMetaValidate && !schema.validated) {
2849
- Schema$R.markValidated(schema.id);
2932
+ Schema$Q.markValidated(schema.id);
2850
2933
 
2851
2934
  // Compile
2852
2935
  if (!(schema.dialectId in metaValidators)) {
2853
- const metaSchema = await Schema$R.get(schema.dialectId);
2854
- const compiledSchema = await compile$O(metaSchema);
2855
- metaValidators[metaSchema.id] = interpret$O(compiledSchema);
2936
+ const metaSchema = await Schema$Q.get(schema.dialectId);
2937
+ const compiledSchema = await compile$N(metaSchema);
2938
+ metaValidators[metaSchema.id] = interpret$N(compiledSchema);
2856
2939
  }
2857
2940
 
2858
2941
  // Interpret
@@ -2875,7 +2958,7 @@ const compileSchema = async (schema, ast) => {
2875
2958
  };
2876
2959
 
2877
2960
  const followReferences = async (doc) => {
2878
- return Schema$R.typeOf(doc, "string") ? followReferences(await Schema$R.get(Schema$R.value(doc), doc)) : doc;
2961
+ return Schema$Q.typeOf(doc, "string") ? followReferences(await Schema$Q.get(Schema$Q.value(doc), doc)) : doc;
2879
2962
  };
2880
2963
 
2881
2964
  const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
@@ -2903,25 +2986,18 @@ const getKeywordId = (schemaUri, ast) => {
2903
2986
  };
2904
2987
 
2905
2988
  const add = (schema, url = "", defaultSchemaVersion = "") => {
2906
- const id = Schema$R.add(schema, url, defaultSchemaVersion);
2989
+ const id = Schema$Q.add(schema, url, defaultSchemaVersion);
2907
2990
  delete metaValidators[id];
2908
2991
  };
2909
2992
 
2910
2993
  var core$2 = {
2911
- validate: validate$2, compile: compile$O, interpret: interpret$O,
2994
+ validate: validate$2, compile: compile$N, interpret: interpret$N,
2912
2995
  setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
2913
2996
  add, getKeyword, hasKeyword, defineVocabulary,
2914
- compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f
2997
+ compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
2998
+ addMediaTypePlugin: MediaTypes.addPlugin
2915
2999
  };
2916
3000
 
2917
- const Schema$Q = schema$5;
2918
-
2919
-
2920
- const compile$N = (schema) => Schema$Q.value(schema);
2921
- const interpret$N = () => true;
2922
-
2923
- var metaData$3 = { compile: compile$N, interpret: interpret$N };
2924
-
2925
3001
  const Pact$9 = lib$2;
2926
3002
  const PubSub = pubsub.exports;
2927
3003
  const Core$x = core$2;
@@ -2945,7 +3021,7 @@ const compile$M = async (schema, ast) => {
2945
3021
  typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
2946
3022
  Schema$P.entries,
2947
3023
  Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
2948
- Pact$9.filter(([keywordId]) => Core$x.hasKeyword(keywordId) && keywordId !== `${schema.dialectId}#validate`),
3024
+ Pact$9.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`),
2949
3025
  Pact$9.map(async ([keywordId, keywordSchema]) => {
2950
3026
  const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
2951
3027
  return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
@@ -3021,7 +3097,7 @@ const collectEvaluatedItems$e = (uri, instance, ast, dynamicAnchors, isTop = fal
3021
3097
 
3022
3098
  var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
3023
3099
 
3024
- const metaData$2 = metaData$3;
3100
+ const metaData$2 = metaData$4;
3025
3101
  const validate = validate$1;
3026
3102
 
3027
3103
 
@@ -5625,6 +5701,7 @@ var lib = {
5625
5701
  interpret: Core.interpret,
5626
5702
  setMetaOutputFormat: Core.setMetaOutputFormat,
5627
5703
  setShouldMetaValidate: Core.setShouldMetaValidate,
5704
+ addMediaTypePlugin: Core.addMediaTypePlugin,
5628
5705
  FLAG: Core.FLAG,
5629
5706
  BASIC: Core.BASIC,
5630
5707
  DETAILED: Core.DETAILED,