@sourcemeta/blaze 15.0.0 → 15.2.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.
package/index.d.mts CHANGED
@@ -9,6 +9,32 @@ export type EvaluationCallback = (
9
9
  annotation: unknown
10
10
  ) => void;
11
11
 
12
+ export type StandardOutputFormat = 'flag' | 'basic';
13
+
14
+ export interface StandardOutputErrorEntry {
15
+ keywordLocation: string;
16
+ absoluteKeywordLocation: string;
17
+ instanceLocation: string;
18
+ error: string;
19
+ }
20
+
21
+ export interface StandardOutputAnnotationEntry {
22
+ keywordLocation: string;
23
+ absoluteKeywordLocation: string;
24
+ instanceLocation: string;
25
+ annotation: unknown[];
26
+ }
27
+
28
+ export type StandardOutputFlagResult = { valid: boolean };
29
+
30
+ export type StandardOutputBasicResult =
31
+ | { valid: true; annotations?: StandardOutputAnnotationEntry[] }
32
+ | { valid: false; errors: StandardOutputErrorEntry[] };
33
+
34
+ export type StandardOutputResult =
35
+ | StandardOutputFlagResult
36
+ | StandardOutputBasicResult;
37
+
12
38
  export declare class Blaze {
13
39
  static reviver(
14
40
  key: string,
@@ -16,5 +42,16 @@ export declare class Blaze {
16
42
  context: { source: string }
17
43
  ): unknown;
18
44
  constructor(template: Template);
45
+ validate(instance: unknown, format: 'flag'): StandardOutputFlagResult;
46
+ validate(instance: unknown, format: 'basic'): StandardOutputBasicResult;
19
47
  validate(instance: unknown, callback?: EvaluationCallback): boolean;
20
48
  }
49
+
50
+ export declare function describe(
51
+ valid: boolean,
52
+ instruction: unknown[],
53
+ evaluatePath: string,
54
+ instanceLocation: string,
55
+ instance: unknown,
56
+ annotation: unknown
57
+ ): string;
package/index.mjs CHANGED
@@ -1,10 +1,11 @@
1
+ import {
2
+ ANNOTATION_EMIT, ANNOTATION_TO_PARENT, ANNOTATION_BASENAME_TO_PARENT,
3
+ CONTROL_GROUP as CONTROL_GROUP_START,
4
+ CONTROL_EVALUATE as CONTROL_EVALUATE_END
5
+ } from './opcodes.mjs';
6
+
1
7
  const JSON_VERSION = 4;
2
8
  const DEPTH_LIMIT = 300;
3
- const ANNOTATION_EMIT = 49;
4
- const ANNOTATION_TO_PARENT = 50;
5
- const ANNOTATION_BASENAME_TO_PARENT = 51;
6
- const CONTROL_GROUP_START = 92;
7
- const CONTROL_EVALUATE_END = 96;
8
9
  const URI_REGEX = /^[a-zA-Z][a-zA-Z0-9+\-.]*:[^\s]*$/;
9
10
 
10
11
  function buildJsonPointer(tokens, length) {
@@ -423,7 +424,13 @@ class Blaze {
423
424
  this._nativeValidate = generateNativeValidator(template);
424
425
  }
425
426
 
426
- validate(instance, callback) {
427
+ validate(instance, callbackOrFormat) {
428
+ if (typeof callbackOrFormat === 'string') {
429
+ return runStandard(this, instance, callbackOrFormat);
430
+ }
431
+
432
+ const callback = callbackOrFormat;
433
+
427
434
  if (callback === undefined && this._nativeValidate) {
428
435
  return this._nativeValidate(instance, this);
429
436
  }
@@ -3967,4 +3974,178 @@ fastHandlers[89] = LoopItemsIntegerBounded_fast;
3967
3974
  fastHandlers[90] = LoopItemsIntegerBoundedSized_fast;
3968
3975
  fastHandlers[97] = ControlDynamicAnchorJump_fast;
3969
3976
 
3977
+ import { describe } from './describe.mjs';
3978
+
3979
+ const STANDARD_MASK_KEYWORDS =
3980
+ new Set([ 'anyOf', 'oneOf', 'not', 'if', 'contains' ]);
3981
+
3982
+ function isAnnotationOpcode(opcode) {
3983
+ return opcode >= ANNOTATION_EMIT && opcode <= ANNOTATION_BASENAME_TO_PARENT;
3984
+ }
3985
+
3986
+ function lastEvaluatePathToken(evaluatePath) {
3987
+ const lastSlash = evaluatePath.lastIndexOf('/');
3988
+ if (lastSlash < 0) return '';
3989
+ return evaluatePath.slice(lastSlash + 1);
3990
+ }
3991
+
3992
+ function isPathPrefix(path, prefix) {
3993
+ if (path === prefix) return true;
3994
+ return path.startsWith(prefix) && path[prefix.length] === '/';
3995
+ }
3996
+
3997
+ function maskKey(evaluatePath, instanceLocation) {
3998
+ return evaluatePath + '\u0000' + instanceLocation;
3999
+ }
4000
+
4001
+ class SimpleOutput {
4002
+ constructor(instance) {
4003
+ this.instance = instance;
4004
+ this.errors = [];
4005
+ this.mask = [];
4006
+ this.maskedTraces = new Map();
4007
+ this.annotations = new Map();
4008
+ }
4009
+
4010
+ callback(type, valid, instruction, evaluatePath, instanceLocation, annotation) {
4011
+ if (evaluatePath === '') return;
4012
+
4013
+ const opcode = instruction[0];
4014
+ const isAnnotation = isAnnotationOpcode(opcode);
4015
+ const keyword = lastEvaluatePathToken(evaluatePath);
4016
+
4017
+ if (valid && !isAnnotation) {
4018
+ if (type === 'pre' && STANDARD_MASK_KEYWORDS.has(keyword)) {
4019
+ this.mask.push({
4020
+ evaluatePath, instanceLocation,
4021
+ key: maskKey(evaluatePath, instanceLocation)
4022
+ });
4023
+ } else if (type === 'post' && this.mask.length > 0) {
4024
+ const top = this.mask[this.mask.length - 1];
4025
+ if (top.evaluatePath === evaluatePath &&
4026
+ top.instanceLocation === instanceLocation) {
4027
+ this.maskedTraces.delete(top.key);
4028
+ this.mask.pop();
4029
+ }
4030
+ }
4031
+ return;
4032
+ }
4033
+
4034
+ if (isAnnotation) {
4035
+ if (type !== 'post') return;
4036
+ const annotationKey =
4037
+ evaluatePath + '\u0000' + instanceLocation + '\u0000' + instruction[3];
4038
+ let bucket = this.annotations.get(annotationKey);
4039
+ if (bucket === undefined) {
4040
+ bucket = {
4041
+ keywordLocation: evaluatePath,
4042
+ absoluteKeywordLocation: instruction[3],
4043
+ instanceLocation,
4044
+ annotation: [ annotation ]
4045
+ };
4046
+ this.annotations.set(annotationKey, bucket);
4047
+ } else {
4048
+ const last = bucket.annotation[bucket.annotation.length - 1];
4049
+ let isSame = last === annotation;
4050
+ if (!isSame && Array.isArray(last) && Array.isArray(annotation) &&
4051
+ last.length === annotation.length) {
4052
+ isSame = last.every((value, index) => value === annotation[index]);
4053
+ }
4054
+ if (!isSame) bucket.annotation.push(annotation);
4055
+ }
4056
+ return;
4057
+ }
4058
+
4059
+ if (type === 'pre') {
4060
+ if (STANDARD_MASK_KEYWORDS.has(keyword)) {
4061
+ this.mask.push({
4062
+ evaluatePath, instanceLocation,
4063
+ key: maskKey(evaluatePath, instanceLocation)
4064
+ });
4065
+ }
4066
+ return;
4067
+ }
4068
+
4069
+ const currentKey = maskKey(evaluatePath, instanceLocation);
4070
+ const matchIndex = this.mask.findIndex(entry => entry.key === currentKey);
4071
+ if (matchIndex >= 0) {
4072
+ if (!valid && keyword !== 'not' && keyword !== 'if') {
4073
+ const buffered = this.maskedTraces.get(currentKey);
4074
+ if (buffered !== undefined) {
4075
+ for (const entry of buffered) this.errors.push(entry);
4076
+ this.maskedTraces.delete(currentKey);
4077
+ }
4078
+ } else {
4079
+ this.maskedTraces.delete(currentKey);
4080
+ }
4081
+ this.mask.splice(matchIndex, 1);
4082
+ }
4083
+
4084
+ if (valid) return;
4085
+
4086
+ if (this.annotations.size > 0) {
4087
+ const lastSlash = evaluatePath.lastIndexOf('/');
4088
+ const parentPath = lastSlash <= 0 ? '' : evaluatePath.slice(0, lastSlash);
4089
+ for (const [ key, value ] of this.annotations) {
4090
+ if (value.instanceLocation === instanceLocation &&
4091
+ (parentPath === '' ||
4092
+ isPathPrefix(value.keywordLocation, parentPath))) {
4093
+ this.annotations.delete(key);
4094
+ }
4095
+ }
4096
+ }
4097
+
4098
+ if (keyword === 'if') return;
4099
+
4100
+ const entry = {
4101
+ keywordLocation: evaluatePath,
4102
+ absoluteKeywordLocation: instruction[3],
4103
+ instanceLocation,
4104
+ error: describe(valid, instruction, evaluatePath, instanceLocation,
4105
+ this.instance, annotation)
4106
+ };
4107
+
4108
+ for (const maskEntry of this.mask) {
4109
+ if (isPathPrefix(evaluatePath, maskEntry.evaluatePath)) {
4110
+ let buffer = this.maskedTraces.get(maskEntry.key);
4111
+ if (buffer === undefined) {
4112
+ buffer = [];
4113
+ this.maskedTraces.set(maskEntry.key, buffer);
4114
+ }
4115
+ buffer.push(entry);
4116
+ return;
4117
+ }
4118
+ }
4119
+
4120
+ this.errors.push(entry);
4121
+ }
4122
+
4123
+ toBasic(valid) {
4124
+ if (valid) {
4125
+ const result = { valid: true };
4126
+ if (this.annotations.size > 0) {
4127
+ result.annotations = [ ...this.annotations.values() ];
4128
+ }
4129
+ return result;
4130
+ }
4131
+ return { valid: false, errors: this.errors };
4132
+ }
4133
+ }
4134
+
4135
+ function runStandard(evaluator, instance, format) {
4136
+ if (format === 'flag') {
4137
+ return { valid: evaluator.validate(instance) };
4138
+ }
4139
+ if (format !== 'basic') {
4140
+ throw new Error(`Unknown standard output format: ${format}`);
4141
+ }
4142
+ const collector = new SimpleOutput(instance);
4143
+ const valid = evaluator.validate(instance,
4144
+ (type, ok, instruction, evaluatePath, instanceLocation, annotation) =>
4145
+ collector.callback(type, ok, instruction, evaluatePath, instanceLocation,
4146
+ annotation));
4147
+ return collector.toBasic(valid);
4148
+ }
4149
+
3970
4150
  export { Blaze };
4151
+ export { describe } from './describe.mjs';
package/opcodes.mjs ADDED
@@ -0,0 +1,206 @@
1
+ export const ASSERTION_FAIL = 0;
2
+ export const ASSERTION_DEFINES = 1;
3
+ export const ASSERTION_DEFINES_STRICT = 2;
4
+ export const ASSERTION_DEFINES_ALL = 3;
5
+ export const ASSERTION_DEFINES_ALL_STRICT = 4;
6
+ export const ASSERTION_DEFINES_EXACTLY = 5;
7
+ export const ASSERTION_DEFINES_EXACTLY_STRICT = 6;
8
+ export const ASSERTION_DEFINES_EXACTLY_STRICT_HASH3 = 7;
9
+ export const ASSERTION_PROPERTY_DEPENDENCIES = 8;
10
+ export const ASSERTION_TYPE = 9;
11
+ export const ASSERTION_TYPE_ANY = 10;
12
+ export const ASSERTION_TYPE_STRICT = 11;
13
+ export const ASSERTION_TYPE_STRICT_ANY = 12;
14
+ export const ASSERTION_TYPE_STRING_BOUNDED = 13;
15
+ export const ASSERTION_TYPE_STRING_UPPER = 14;
16
+ export const ASSERTION_TYPE_ARRAY_BOUNDED = 15;
17
+ export const ASSERTION_TYPE_ARRAY_UPPER = 16;
18
+ export const ASSERTION_TYPE_OBJECT_BOUNDED = 17;
19
+ export const ASSERTION_TYPE_OBJECT_UPPER = 18;
20
+ export const ASSERTION_REGEX = 19;
21
+ export const ASSERTION_STRING_SIZE_LESS = 20;
22
+ export const ASSERTION_STRING_SIZE_GREATER = 21;
23
+ export const ASSERTION_ARRAY_SIZE_LESS = 22;
24
+ export const ASSERTION_ARRAY_SIZE_GREATER = 23;
25
+ export const ASSERTION_OBJECT_SIZE_LESS = 24;
26
+ export const ASSERTION_OBJECT_SIZE_GREATER = 25;
27
+ export const ASSERTION_EQUAL = 26;
28
+ export const ASSERTION_EQUALS_ANY = 27;
29
+ export const ASSERTION_EQUALS_ANY_STRING_HASH = 28;
30
+ export const ASSERTION_GREATER_EQUAL = 29;
31
+ export const ASSERTION_LESS_EQUAL = 30;
32
+ export const ASSERTION_GREATER = 31;
33
+ export const ASSERTION_LESS = 32;
34
+ export const ASSERTION_UNIQUE = 33;
35
+ export const ASSERTION_DIVISIBLE = 34;
36
+ export const ASSERTION_TYPE_INTEGER_BOUNDED = 35;
37
+ export const ASSERTION_TYPE_INTEGER_BOUNDED_STRICT = 36;
38
+ export const ASSERTION_TYPE_INTEGER_LOWER_BOUND = 37;
39
+ export const ASSERTION_TYPE_INTEGER_LOWER_BOUND_STRICT = 38;
40
+ export const ASSERTION_STRING_TYPE = 39;
41
+ export const ASSERTION_PROPERTY_TYPE = 40;
42
+ export const ASSERTION_PROPERTY_TYPE_EVALUATE = 41;
43
+ export const ASSERTION_PROPERTY_TYPE_STRICT = 42;
44
+ export const ASSERTION_PROPERTY_TYPE_STRICT_EVALUATE = 43;
45
+ export const ASSERTION_PROPERTY_TYPE_STRICT_ANY = 44;
46
+ export const ASSERTION_PROPERTY_TYPE_STRICT_ANY_EVALUATE = 45;
47
+ export const ASSERTION_ARRAY_PREFIX = 46;
48
+ export const ASSERTION_ARRAY_PREFIX_EVALUATE = 47;
49
+ export const ASSERTION_OBJECT_PROPERTIES_SIMPLE = 48;
50
+ export const ANNOTATION_EMIT = 49;
51
+ export const ANNOTATION_TO_PARENT = 50;
52
+ export const ANNOTATION_BASENAME_TO_PARENT = 51;
53
+ export const EVALUATE = 52;
54
+ export const LOGICAL_NOT = 53;
55
+ export const LOGICAL_NOT_EVALUATE = 54;
56
+ export const LOGICAL_OR = 55;
57
+ export const LOGICAL_AND = 56;
58
+ export const LOGICAL_XOR = 57;
59
+ export const LOGICAL_CONDITION = 58;
60
+ export const LOGICAL_WHEN_TYPE = 59;
61
+ export const LOGICAL_WHEN_DEFINES = 60;
62
+ export const LOGICAL_WHEN_ARRAY_SIZE_GREATER = 61;
63
+ export const LOOP_PROPERTIES_UNEVALUATED = 62;
64
+ export const LOOP_PROPERTIES_UNEVALUATED_EXCEPT = 63;
65
+ export const LOOP_PROPERTIES_MATCH = 64;
66
+ export const LOOP_PROPERTIES_MATCH_CLOSED = 65;
67
+ export const LOOP_PROPERTIES = 66;
68
+ export const LOOP_PROPERTIES_EVALUATE = 67;
69
+ export const LOOP_PROPERTIES_REGEX = 68;
70
+ export const LOOP_PROPERTIES_REGEX_CLOSED = 69;
71
+ export const LOOP_PROPERTIES_STARTS_WITH = 70;
72
+ export const LOOP_PROPERTIES_EXCEPT = 71;
73
+ export const LOOP_PROPERTIES_TYPE = 72;
74
+ export const LOOP_PROPERTIES_TYPE_EVALUATE = 73;
75
+ export const LOOP_PROPERTIES_EXACTLY_TYPE_STRICT = 74;
76
+ export const LOOP_PROPERTIES_EXACTLY_TYPE_STRICT_HASH = 75;
77
+ export const LOOP_PROPERTIES_TYPE_STRICT = 76;
78
+ export const LOOP_PROPERTIES_TYPE_STRICT_EVALUATE = 77;
79
+ export const LOOP_PROPERTIES_TYPE_STRICT_ANY = 78;
80
+ export const LOOP_PROPERTIES_TYPE_STRICT_ANY_EVALUATE = 79;
81
+ export const LOOP_KEYS = 80;
82
+ export const LOOP_ITEMS = 81;
83
+ export const LOOP_ITEMS_FROM = 82;
84
+ export const LOOP_ITEMS_UNEVALUATED = 83;
85
+ export const LOOP_ITEMS_TYPE = 84;
86
+ export const LOOP_ITEMS_TYPE_STRICT = 85;
87
+ export const LOOP_ITEMS_TYPE_STRICT_ANY = 86;
88
+ export const LOOP_ITEMS_PROPERTIES_EXACTLY_TYPE_STRICT_HASH = 87;
89
+ export const LOOP_ITEMS_PROPERTIES_EXACTLY_TYPE_STRICT_HASH3 = 88;
90
+ export const LOOP_ITEMS_INTEGER_BOUNDED = 89;
91
+ export const LOOP_ITEMS_INTEGER_BOUNDED_SIZED = 90;
92
+ export const LOOP_CONTAINS = 91;
93
+ export const CONTROL_GROUP = 92;
94
+ export const CONTROL_GROUP_WHEN_DEFINES = 93;
95
+ export const CONTROL_GROUP_WHEN_DEFINES_DIRECT = 94;
96
+ export const CONTROL_GROUP_WHEN_TYPE = 95;
97
+ export const CONTROL_EVALUATE = 96;
98
+ export const CONTROL_DYNAMIC_ANCHOR_JUMP = 97;
99
+ export const CONTROL_JUMP = 98;
100
+
101
+ export const INSTRUCTION_NAMES = {
102
+ "AssertionFail": ASSERTION_FAIL,
103
+ "AssertionDefines": ASSERTION_DEFINES,
104
+ "AssertionDefinesStrict": ASSERTION_DEFINES_STRICT,
105
+ "AssertionDefinesAll": ASSERTION_DEFINES_ALL,
106
+ "AssertionDefinesAllStrict": ASSERTION_DEFINES_ALL_STRICT,
107
+ "AssertionDefinesExactly": ASSERTION_DEFINES_EXACTLY,
108
+ "AssertionDefinesExactlyStrict": ASSERTION_DEFINES_EXACTLY_STRICT,
109
+ "AssertionDefinesExactlyStrictHash3": ASSERTION_DEFINES_EXACTLY_STRICT_HASH3,
110
+ "AssertionPropertyDependencies": ASSERTION_PROPERTY_DEPENDENCIES,
111
+ "AssertionType": ASSERTION_TYPE,
112
+ "AssertionTypeAny": ASSERTION_TYPE_ANY,
113
+ "AssertionTypeStrict": ASSERTION_TYPE_STRICT,
114
+ "AssertionTypeStrictAny": ASSERTION_TYPE_STRICT_ANY,
115
+ "AssertionTypeStringBounded": ASSERTION_TYPE_STRING_BOUNDED,
116
+ "AssertionTypeStringUpper": ASSERTION_TYPE_STRING_UPPER,
117
+ "AssertionTypeArrayBounded": ASSERTION_TYPE_ARRAY_BOUNDED,
118
+ "AssertionTypeArrayUpper": ASSERTION_TYPE_ARRAY_UPPER,
119
+ "AssertionTypeObjectBounded": ASSERTION_TYPE_OBJECT_BOUNDED,
120
+ "AssertionTypeObjectUpper": ASSERTION_TYPE_OBJECT_UPPER,
121
+ "AssertionRegex": ASSERTION_REGEX,
122
+ "AssertionStringSizeLess": ASSERTION_STRING_SIZE_LESS,
123
+ "AssertionStringSizeGreater": ASSERTION_STRING_SIZE_GREATER,
124
+ "AssertionArraySizeLess": ASSERTION_ARRAY_SIZE_LESS,
125
+ "AssertionArraySizeGreater": ASSERTION_ARRAY_SIZE_GREATER,
126
+ "AssertionObjectSizeLess": ASSERTION_OBJECT_SIZE_LESS,
127
+ "AssertionObjectSizeGreater": ASSERTION_OBJECT_SIZE_GREATER,
128
+ "AssertionEqual": ASSERTION_EQUAL,
129
+ "AssertionEqualsAny": ASSERTION_EQUALS_ANY,
130
+ "AssertionEqualsAnyStringHash": ASSERTION_EQUALS_ANY_STRING_HASH,
131
+ "AssertionGreaterEqual": ASSERTION_GREATER_EQUAL,
132
+ "AssertionLessEqual": ASSERTION_LESS_EQUAL,
133
+ "AssertionGreater": ASSERTION_GREATER,
134
+ "AssertionLess": ASSERTION_LESS,
135
+ "AssertionUnique": ASSERTION_UNIQUE,
136
+ "AssertionDivisible": ASSERTION_DIVISIBLE,
137
+ "AssertionTypeIntegerBounded": ASSERTION_TYPE_INTEGER_BOUNDED,
138
+ "AssertionTypeIntegerBoundedStrict": ASSERTION_TYPE_INTEGER_BOUNDED_STRICT,
139
+ "AssertionTypeIntegerLowerBound": ASSERTION_TYPE_INTEGER_LOWER_BOUND,
140
+ "AssertionTypeIntegerLowerBoundStrict": ASSERTION_TYPE_INTEGER_LOWER_BOUND_STRICT,
141
+ "AssertionStringType": ASSERTION_STRING_TYPE,
142
+ "AssertionPropertyType": ASSERTION_PROPERTY_TYPE,
143
+ "AssertionPropertyTypeEvaluate": ASSERTION_PROPERTY_TYPE_EVALUATE,
144
+ "AssertionPropertyTypeStrict": ASSERTION_PROPERTY_TYPE_STRICT,
145
+ "AssertionPropertyTypeStrictEvaluate": ASSERTION_PROPERTY_TYPE_STRICT_EVALUATE,
146
+ "AssertionPropertyTypeStrictAny": ASSERTION_PROPERTY_TYPE_STRICT_ANY,
147
+ "AssertionPropertyTypeStrictAnyEvaluate": ASSERTION_PROPERTY_TYPE_STRICT_ANY_EVALUATE,
148
+ "AssertionArrayPrefix": ASSERTION_ARRAY_PREFIX,
149
+ "AssertionArrayPrefixEvaluate": ASSERTION_ARRAY_PREFIX_EVALUATE,
150
+ "AssertionObjectPropertiesSimple": ASSERTION_OBJECT_PROPERTIES_SIMPLE,
151
+ "AnnotationEmit": ANNOTATION_EMIT,
152
+ "AnnotationToParent": ANNOTATION_TO_PARENT,
153
+ "AnnotationBasenameToParent": ANNOTATION_BASENAME_TO_PARENT,
154
+ "Evaluate": EVALUATE,
155
+ "LogicalNot": LOGICAL_NOT,
156
+ "LogicalNotEvaluate": LOGICAL_NOT_EVALUATE,
157
+ "LogicalOr": LOGICAL_OR,
158
+ "LogicalAnd": LOGICAL_AND,
159
+ "LogicalXor": LOGICAL_XOR,
160
+ "LogicalCondition": LOGICAL_CONDITION,
161
+ "LogicalWhenType": LOGICAL_WHEN_TYPE,
162
+ "LogicalWhenDefines": LOGICAL_WHEN_DEFINES,
163
+ "LogicalWhenArraySizeGreater": LOGICAL_WHEN_ARRAY_SIZE_GREATER,
164
+ "LoopPropertiesUnevaluated": LOOP_PROPERTIES_UNEVALUATED,
165
+ "LoopPropertiesUnevaluatedExcept": LOOP_PROPERTIES_UNEVALUATED_EXCEPT,
166
+ "LoopPropertiesMatch": LOOP_PROPERTIES_MATCH,
167
+ "LoopPropertiesMatchClosed": LOOP_PROPERTIES_MATCH_CLOSED,
168
+ "LoopProperties": LOOP_PROPERTIES,
169
+ "LoopPropertiesEvaluate": LOOP_PROPERTIES_EVALUATE,
170
+ "LoopPropertiesRegex": LOOP_PROPERTIES_REGEX,
171
+ "LoopPropertiesRegexClosed": LOOP_PROPERTIES_REGEX_CLOSED,
172
+ "LoopPropertiesStartsWith": LOOP_PROPERTIES_STARTS_WITH,
173
+ "LoopPropertiesExcept": LOOP_PROPERTIES_EXCEPT,
174
+ "LoopPropertiesType": LOOP_PROPERTIES_TYPE,
175
+ "LoopPropertiesTypeEvaluate": LOOP_PROPERTIES_TYPE_EVALUATE,
176
+ "LoopPropertiesExactlyTypeStrict": LOOP_PROPERTIES_EXACTLY_TYPE_STRICT,
177
+ "LoopPropertiesExactlyTypeStrictHash": LOOP_PROPERTIES_EXACTLY_TYPE_STRICT_HASH,
178
+ "LoopPropertiesTypeStrict": LOOP_PROPERTIES_TYPE_STRICT,
179
+ "LoopPropertiesTypeStrictEvaluate": LOOP_PROPERTIES_TYPE_STRICT_EVALUATE,
180
+ "LoopPropertiesTypeStrictAny": LOOP_PROPERTIES_TYPE_STRICT_ANY,
181
+ "LoopPropertiesTypeStrictAnyEvaluate": LOOP_PROPERTIES_TYPE_STRICT_ANY_EVALUATE,
182
+ "LoopKeys": LOOP_KEYS,
183
+ "LoopItems": LOOP_ITEMS,
184
+ "LoopItemsFrom": LOOP_ITEMS_FROM,
185
+ "LoopItemsUnevaluated": LOOP_ITEMS_UNEVALUATED,
186
+ "LoopItemsType": LOOP_ITEMS_TYPE,
187
+ "LoopItemsTypeStrict": LOOP_ITEMS_TYPE_STRICT,
188
+ "LoopItemsTypeStrictAny": LOOP_ITEMS_TYPE_STRICT_ANY,
189
+ "LoopItemsPropertiesExactlyTypeStrictHash": LOOP_ITEMS_PROPERTIES_EXACTLY_TYPE_STRICT_HASH,
190
+ "LoopItemsPropertiesExactlyTypeStrictHash3": LOOP_ITEMS_PROPERTIES_EXACTLY_TYPE_STRICT_HASH3,
191
+ "LoopItemsIntegerBounded": LOOP_ITEMS_INTEGER_BOUNDED,
192
+ "LoopItemsIntegerBoundedSized": LOOP_ITEMS_INTEGER_BOUNDED_SIZED,
193
+ "LoopContains": LOOP_CONTAINS,
194
+ "ControlGroup": CONTROL_GROUP,
195
+ "ControlGroupWhenDefines": CONTROL_GROUP_WHEN_DEFINES,
196
+ "ControlGroupWhenDefinesDirect": CONTROL_GROUP_WHEN_DEFINES_DIRECT,
197
+ "ControlGroupWhenType": CONTROL_GROUP_WHEN_TYPE,
198
+ "ControlEvaluate": CONTROL_EVALUATE,
199
+ "ControlDynamicAnchorJump": CONTROL_DYNAMIC_ANCHOR_JUMP,
200
+ "ControlJump": CONTROL_JUMP,
201
+ "Annotation": -1
202
+ };
203
+
204
+ export const ANNOTATION_OPCODES = new Set([
205
+ ANNOTATION_EMIT, ANNOTATION_TO_PARENT, ANNOTATION_BASENAME_TO_PARENT
206
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourcemeta/blaze",
3
- "version": "15.0.0",
3
+ "version": "15.2.0",
4
4
  "description": "A pure JavaScript port of the evaluator from Blaze, a high-performance C++ JSON Schema validator. Zero dependencies. Supports Draft 4, Draft 6, Draft 7, 2019-09, and 2020-12 with schema-specific code generation for near-native speed",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
@@ -20,7 +20,7 @@
20
20
  "url": "https://www.sourcemeta.com"
21
21
  },
22
22
  "engines": {
23
- "node": ">=18"
23
+ "node": ">=21.7"
24
24
  },
25
25
  "funding": "https://github.com/sponsors/sourcemeta",
26
26
  "keywords": [
@@ -66,6 +66,8 @@
66
66
  "files": [
67
67
  "index.mjs",
68
68
  "index.d.mts",
69
+ "opcodes.mjs",
70
+ "describe.mjs",
69
71
  "README.md",
70
72
  "LICENSE"
71
73
  ]