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