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