@hyperjump/json-schema 0.21.0 → 0.22.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.
@@ -2762,13 +2762,22 @@ System.register('JsonSchema', [], (function (exports) {
2762
2762
 
2763
2763
  var invalidSchemaError = InvalidSchemaError$3;
2764
2764
 
2765
+ const Schema$R = schema$5;
2766
+
2767
+
2768
+ const compile$O = (schema) => Schema$R.value(schema);
2769
+ const interpret$O = () => true;
2770
+
2771
+ var metaData$4 = { compile: compile$O, interpret: interpret$O };
2772
+
2765
2773
  const curry = justCurryIt;
2766
2774
  const PubSub$1 = pubsub.exports;
2767
2775
  const { resolveUrl } = common$1;
2768
2776
  const Instance$E = instance;
2769
- const Schema$R = schema$5;
2777
+ const Schema$Q = schema$5;
2770
2778
  const InvalidSchemaError$2 = invalidSchemaError;
2771
2779
  const MediaTypes = mediaTypes;
2780
+ const metaData$3 = metaData$4;
2772
2781
 
2773
2782
 
2774
2783
  const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
@@ -2782,19 +2791,19 @@ System.register('JsonSchema', [], (function (exports) {
2782
2791
  });
2783
2792
 
2784
2793
  const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
2785
- const compiled = await compile$O(schema);
2786
- const interpretAst = (value, outputFormat) => interpret$O(compiled, Instance$E.cons(value), outputFormat);
2794
+ const compiled = await compile$N(schema);
2795
+ const interpretAst = (value, outputFormat) => interpret$N(compiled, Instance$E.cons(value), outputFormat);
2787
2796
 
2788
2797
  return value === undefined ? interpretAst : interpretAst(value, outputFormat);
2789
2798
  };
2790
2799
 
2791
- const compile$O = async (schema) => {
2800
+ const compile$N = async (schema) => {
2792
2801
  const ast = { metaData: {} };
2793
2802
  const schemaUri = await compileSchema(schema, ast);
2794
2803
  return { ast, schemaUri };
2795
2804
  };
2796
2805
 
2797
- const interpret$O = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
2806
+ const interpret$N = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
2798
2807
  if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
2799
2808
  throw Error(`The '${outputFormat}' error format is not supported`);
2800
2809
  }
@@ -2848,7 +2857,7 @@ System.register('JsonSchema', [], (function (exports) {
2848
2857
  };
2849
2858
 
2850
2859
  const _keywords = {};
2851
- const getKeyword = (id) => _keywords[id];
2860
+ const getKeyword = (id) => _keywords[id] || metaData$3;
2852
2861
  const hasKeyword = (id) => id in _keywords;
2853
2862
  const addKeyword = (id, keywordHandler) => {
2854
2863
  _keywords[id] = {
@@ -2869,10 +2878,10 @@ System.register('JsonSchema', [], (function (exports) {
2869
2878
 
2870
2879
  // Vocabularies
2871
2880
  if (!hasKeyword(`${schema.dialectId}#validate`)) {
2872
- const metaSchema = await Schema$R.get(schema.dialectId);
2881
+ const metaSchema = await Schema$Q.get(schema.dialectId);
2873
2882
 
2874
2883
  // Check for mandatory vocabularies
2875
- const mandatoryVocabularies = Schema$R.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
2884
+ const mandatoryVocabularies = Schema$Q.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
2876
2885
  mandatoryVocabularies.forEach((vocabularyId) => {
2877
2886
  if (!metaSchema.vocabulary[vocabularyId]) {
2878
2887
  throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
@@ -2895,13 +2904,13 @@ System.register('JsonSchema', [], (function (exports) {
2895
2904
 
2896
2905
  // Meta validation
2897
2906
  if (shouldMetaValidate && !schema.validated) {
2898
- Schema$R.markValidated(schema.id);
2907
+ Schema$Q.markValidated(schema.id);
2899
2908
 
2900
2909
  // Compile
2901
2910
  if (!(schema.dialectId in metaValidators)) {
2902
- const metaSchema = await Schema$R.get(schema.dialectId);
2903
- const compiledSchema = await compile$O(metaSchema);
2904
- metaValidators[metaSchema.id] = interpret$O(compiledSchema);
2911
+ const metaSchema = await Schema$Q.get(schema.dialectId);
2912
+ const compiledSchema = await compile$N(metaSchema);
2913
+ metaValidators[metaSchema.id] = interpret$N(compiledSchema);
2905
2914
  }
2906
2915
 
2907
2916
  // Interpret
@@ -2924,7 +2933,7 @@ System.register('JsonSchema', [], (function (exports) {
2924
2933
  };
2925
2934
 
2926
2935
  const followReferences = async (doc) => {
2927
- return Schema$R.typeOf(doc, "string") ? followReferences(await Schema$R.get(Schema$R.value(doc), doc)) : doc;
2936
+ return Schema$Q.typeOf(doc, "string") ? followReferences(await Schema$Q.get(Schema$Q.value(doc), doc)) : doc;
2928
2937
  };
2929
2938
 
2930
2939
  const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
@@ -2952,26 +2961,18 @@ System.register('JsonSchema', [], (function (exports) {
2952
2961
  };
2953
2962
 
2954
2963
  const add = (schema, url = "", defaultSchemaVersion = "") => {
2955
- const id = Schema$R.add(schema, url, defaultSchemaVersion);
2964
+ const id = Schema$Q.add(schema, url, defaultSchemaVersion);
2956
2965
  delete metaValidators[id];
2957
2966
  };
2958
2967
 
2959
2968
  var core$2 = {
2960
- validate: validate$2, compile: compile$O, interpret: interpret$O,
2969
+ validate: validate$2, compile: compile$N, interpret: interpret$N,
2961
2970
  setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
2962
2971
  add, getKeyword, hasKeyword, defineVocabulary,
2963
2972
  compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
2964
2973
  addMediaTypePlugin: MediaTypes.addPlugin
2965
2974
  };
2966
2975
 
2967
- const Schema$Q = schema$5;
2968
-
2969
-
2970
- const compile$N = (schema) => Schema$Q.value(schema);
2971
- const interpret$N = () => true;
2972
-
2973
- var metaData$3 = { compile: compile$N, interpret: interpret$N };
2974
-
2975
2976
  const Pact$9 = lib$2;
2976
2977
  const PubSub = pubsub.exports;
2977
2978
  const Core$x = core$2;
@@ -2995,7 +2996,7 @@ System.register('JsonSchema', [], (function (exports) {
2995
2996
  typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
2996
2997
  Schema$P.entries,
2997
2998
  Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
2998
- Pact$9.filter(([keywordId]) => Core$x.hasKeyword(keywordId) && keywordId !== `${schema.dialectId}#validate`),
2999
+ Pact$9.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`),
2999
3000
  Pact$9.map(async ([keywordId, keywordSchema]) => {
3000
3001
  const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
3001
3002
  return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
@@ -3071,7 +3072,7 @@ System.register('JsonSchema', [], (function (exports) {
3071
3072
 
3072
3073
  var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
3073
3074
 
3074
- const metaData$2 = metaData$3;
3075
+ const metaData$2 = metaData$4;
3075
3076
  const validate = validate$1;
3076
3077
 
3077
3078