@ifc-lite/ids 1.15.49 → 1.15.51

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.
Files changed (56) hide show
  1. package/dist/bridge/data-types.d.ts.map +1 -1
  2. package/dist/bridge/data-types.js +1 -0
  3. package/dist/bridge/data-types.js.map +1 -1
  4. package/dist/constraint-types.d.ts +110 -0
  5. package/dist/constraint-types.d.ts.map +1 -0
  6. package/dist/constraint-types.js +5 -0
  7. package/dist/constraint-types.js.map +1 -0
  8. package/dist/constraints/describe.d.ts +17 -0
  9. package/dist/constraints/describe.d.ts.map +1 -0
  10. package/dist/constraints/describe.js +140 -0
  11. package/dist/constraints/describe.js.map +1 -0
  12. package/dist/constraints/index.d.ts +1 -8
  13. package/dist/constraints/index.d.ts.map +1 -1
  14. package/dist/constraints/index.js +13 -361
  15. package/dist/constraints/index.js.map +1 -1
  16. package/dist/constraints/match-family.d.ts +20 -0
  17. package/dist/constraints/match-family.d.ts.map +1 -0
  18. package/dist/constraints/match-family.js +265 -0
  19. package/dist/constraints/match-family.js.map +1 -0
  20. package/dist/constraints/xsd-cast.d.ts +10 -1
  21. package/dist/constraints/xsd-cast.d.ts.map +1 -1
  22. package/dist/constraints/xsd-cast.js +66 -2
  23. package/dist/constraints/xsd-cast.js.map +1 -1
  24. package/dist/facets/property-facet.d.ts.map +1 -1
  25. package/dist/facets/property-facet.js +30 -33
  26. package/dist/facets/property-facet.js.map +1 -1
  27. package/dist/parser/dom.d.ts +11 -0
  28. package/dist/parser/dom.d.ts.map +1 -0
  29. package/dist/parser/dom.js +49 -0
  30. package/dist/parser/dom.js.map +1 -0
  31. package/dist/parser/xml-parser.d.ts.map +1 -1
  32. package/dist/parser/xml-parser.js +46 -58
  33. package/dist/parser/xml-parser.js.map +1 -1
  34. package/dist/translation/describe-constraint.d.ts +18 -0
  35. package/dist/translation/describe-constraint.d.ts.map +1 -0
  36. package/dist/translation/describe-constraint.js +77 -0
  37. package/dist/translation/describe-constraint.js.map +1 -0
  38. package/dist/translation/locales/de.d.ts +1 -0
  39. package/dist/translation/locales/de.d.ts.map +1 -1
  40. package/dist/translation/locales/de.js +1 -0
  41. package/dist/translation/locales/de.js.map +1 -1
  42. package/dist/translation/locales/en.d.ts +2 -0
  43. package/dist/translation/locales/en.d.ts.map +1 -1
  44. package/dist/translation/locales/en.js +2 -0
  45. package/dist/translation/locales/en.js.map +1 -1
  46. package/dist/translation/locales/fr.d.ts +1 -0
  47. package/dist/translation/locales/fr.d.ts.map +1 -1
  48. package/dist/translation/locales/fr.js +1 -0
  49. package/dist/translation/locales/fr.js.map +1 -1
  50. package/dist/translation/service.d.ts +4 -5
  51. package/dist/translation/service.d.ts.map +1 -1
  52. package/dist/translation/service.js +8 -58
  53. package/dist/translation/service.js.map +1 -1
  54. package/dist/types.d.ts +2 -59
  55. package/dist/types.d.ts.map +1 -1
  56. package/package.json +5 -4
@@ -1,11 +1,7 @@
1
1
  /* This Source Code Form is subject to the terms of the Mozilla Public
2
2
  * License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
- import { compareBoolean, compareNumeric, compareString, isStrictNumericLiteral, isBooleanLiteral, } from './comparators.js';
5
- import { isNumericXsdBase, isBooleanXsdBase } from './xsd-cast.js';
6
- import { translateXsdRegex } from './xsd-regex.js';
7
- /** Tolerance for the bounds matcher's exclusive comparators. */
8
- const NUMERIC_TOLERANCE = 1e-6;
4
+ import { conjunctiveFacetsOf, matchOneFamily } from './match-family.js';
9
5
  /**
10
6
  * Check if a value matches a constraint
11
7
  */
@@ -14,365 +10,21 @@ export function matchConstraint(constraint, actualValue, options) {
14
10
  return false;
15
11
  }
16
12
  const ci = options?.caseInsensitive ?? false;
17
- switch (constraint.type) {
18
- case 'simpleValue':
19
- return matchSimpleValue(constraint, actualValue, ci);
20
- case 'pattern':
21
- return matchPattern(constraint, actualValue, ci);
22
- case 'enumeration':
23
- return matchEnumeration(constraint, actualValue, ci);
24
- case 'bounds':
25
- return matchBounds(constraint, actualValue);
26
- default:
27
- return false;
28
- }
29
- }
30
- /**
31
- * Per-constraint comparator applicability. `compareNumeric` runs two
32
- * regex tests and `compareBoolean` two equality checks per call — and
33
- * simple-value matching sits inside per-entity × per-specification hot
34
- * loops (name matching against every pset/property). Whether the IDS
35
- * literal could EVER match numerically or boolean-ly depends only on
36
- * the constraint, so decide it once.
37
- */
38
- const SIMPLE_VALUE_COERCIBLE = new WeakMap();
39
- function isCoercibleSimpleValue(constraint) {
40
- let coercible = SIMPLE_VALUE_COERCIBLE.get(constraint);
41
- if (coercible === undefined) {
42
- coercible =
43
- isStrictNumericLiteral(constraint.value) ||
44
- isBooleanLiteral(constraint.value);
45
- SIMPLE_VALUE_COERCIBLE.set(constraint, coercible);
46
- }
47
- return coercible;
48
- }
49
- /**
50
- * Match against a simple value. Tries each comparator in order:
51
- * string → numeric → boolean. The first decisive result wins;
52
- * `undefined` lets the next strategy run.
53
- */
54
- function matchSimpleValue(constraint, actualValue, caseInsensitive) {
55
- const expected = constraint.value;
56
- const stringResult = compareString(expected, actualValue, caseInsensitive);
57
- if (stringResult !== undefined)
58
- return stringResult;
59
- // A non-numeric, non-boolean literal can only match through string
60
- // equality — skip the comparators that would return undefined anyway.
61
- if (!isCoercibleSimpleValue(constraint))
62
- return false;
63
- const numericResult = compareNumeric(expected, actualValue);
64
- if (numericResult !== undefined)
65
- return numericResult;
66
- const booleanResult = compareBoolean(expected, actualValue);
67
- if (booleanResult !== undefined)
68
- return booleanResult;
69
- return false;
70
- }
71
- /**
72
- * Match against a regex pattern
73
- * IDS uses XSD regex syntax which is slightly different from JavaScript
74
- */
75
- function matchPattern(constraint, actualValue, caseInsensitive = false) {
76
- // An XSD `xs:pattern` facet constrains the *lexical* space of its base
77
- // datatype, so it matches the textual representation of the value — the
78
- // official IDS reference (ifctester) does `re.fullmatch(pattern,
79
- // str(value))`. A numeric value therefore satisfies e.g.
80
- // `<restriction base="xs:decimal"><pattern value="^.*$"/>` ("any
81
- // decimal value present"), which the previous blanket number/boolean
82
- // bail-out wrongly failed on every numeric property.
83
- //
84
- // But the runtime value must first be type-compatible with the declared
85
- // base: a number only matches a numeric base and a boolean only a
86
- // boolean base. A number tested against `base="xs:string"` is a type
87
- // mismatch — buildingSMART's corpus encodes exactly this as
88
- // `patterns_always_fail_on_any_number`. (A string actual is already the
89
- // lexical form, so it is matched directly regardless of base.)
90
- if (typeof actualValue === 'number') {
91
- if (!isNumericXsdBase(constraint.base))
92
- return false;
93
- }
94
- else if (typeof actualValue === 'boolean') {
95
- if (!isBooleanXsdBase(constraint.base))
96
- return false;
97
- }
98
- const actualStr = String(actualValue);
99
- const regex = compilePatternRegex(constraint, caseInsensitive);
100
- // An un-compilable pattern can't match anything (e.g. an unbalanced
101
- // `[`); treat it as a non-match rather than throwing.
102
- return regex ? regex.test(actualStr) : false;
103
- }
104
- /**
105
- * Compiled-pattern cache. Translating XSD → JS regex and building the
106
- * `RegExp` on every value check dominated pattern-heavy validation; the
107
- * compiled form depends only on (constraint, caseInsensitive), and the
108
- * constraint object is stable per parsed document.
109
- */
110
- const PATTERN_REGEX_CACHE = new WeakMap();
111
- function compilePatternRegex(constraint, caseInsensitive) {
112
- let entry = PATTERN_REGEX_CACHE.get(constraint);
113
- if (!entry) {
114
- entry = {};
115
- PATTERN_REGEX_CACHE.set(constraint, entry);
116
- }
117
- const slot = caseInsensitive ? 'ci' : 'cs';
118
- let regex = entry[slot];
119
- if (regex === undefined) {
120
- regex = buildPatternRegex(constraint.pattern, caseInsensitive);
121
- entry[slot] = regex;
122
- }
123
- return regex;
124
- }
125
- function buildPatternRegex(xsdPattern, caseInsensitive) {
126
- // XSD char-class subtraction `[a-z-[aeiou]]` has no JS equivalent;
127
- // approximate as the positive class (drop the exclusion) so the rest
128
- // of the pattern still evaluates, matching long-standing behaviour.
129
- const desubtracted = xsdPattern.replace(/\[([^\]]+)-\[[^\]]+\]\]/g, '[$1]');
130
- // Shared XSD → JS translation: `\i`/`\c`/`\d`/`\w` (and their
131
- // negations) map to Unicode property escapes, and verbatim `\p{…}`
132
- // classes pass through — both require the `u` flag for full fidelity.
133
- const { pattern } = translateXsdRegex(desubtracted);
134
- // IDS patterns must match the entire lexical value. Wrapping in a
135
- // non-capturing group anchors top-level alternation correctly
136
- // (`a|b` → `^(?:a|b)$`, not `^a|b$`). Case-insensitive matching is
137
- // opt-in per the call site (entity / predefined-type names use it;
138
- // property and attribute values do not).
139
- const anchored = `^(?:${pattern})$`;
140
- try {
141
- return new RegExp(anchored, caseInsensitive ? 'iu' : 'u');
142
- }
143
- catch {
144
- // Some patterns are valid under JS's lenient (Annex-B) dialect but
145
- // rejected under `u`. Retry without it so plain patterns keep
146
- // matching; this loses `\p{…}` fidelity for that one pattern only.
147
- try {
148
- return new RegExp(anchored, caseInsensitive ? 'i' : '');
149
- }
150
- catch {
151
- return null;
152
- }
153
- }
154
- }
155
- /**
156
- * Compiled exact-match sets per enumeration constraint. Real-world IDS
157
- * code lists carry hundreds of values and are matched against every
158
- * candidate entity, so the linear comparator walk dominated validation
159
- * time. Constraint objects are stable per parsed document, making a
160
- * WeakMap cache safe.
161
- */
162
- const ENUM_VALUE_SETS = new WeakMap();
163
- function getEnumValueSets(constraint) {
164
- let sets = ENUM_VALUE_SETS.get(constraint);
165
- if (!sets) {
166
- const exact = new Set(constraint.values);
167
- const upper = new Set();
168
- let anyCoercible = false;
169
- for (const v of constraint.values) {
170
- upper.add(v.toUpperCase());
171
- if (isStrictNumericLiteral(v) || isBooleanLiteral(v))
172
- anyCoercible = true;
173
- }
174
- sets = { exact, upper, anyCoercible };
175
- ENUM_VALUE_SETS.set(constraint, sets);
176
- }
177
- return sets;
178
- }
179
- /**
180
- * Match against an enumeration. The actual value matches if ANY of the
181
- * declared options matches under string / numeric / boolean comparison
182
- * — same strategy table as `matchSimpleValue`, just iterated.
183
- */
184
- function matchEnumeration(constraint, actualValue, caseInsensitive) {
185
- // O(1) fast path: a set hit is exactly the condition under which
186
- // `compareString` would have returned true for some value, so this
187
- // never changes the outcome — misses fall through to the full
188
- // comparator walk for numeric / boolean semantics.
189
- const sets = getEnumValueSets(constraint);
190
- const actualStr = String(actualValue);
191
- if (sets.exact.has(actualStr))
192
- return true;
193
- if (caseInsensitive && sets.upper.has(actualStr.toUpperCase()))
13
+ if (!matchOneFamily(constraint, actualValue, ci))
14
+ return false;
15
+ // XSD facets declared in the same `<xs:restriction>` are conjunctive.
16
+ // `parseRestriction` keeps the first family as the constraint itself
17
+ // and hangs the others here; a value has to satisfy all of them. The
18
+ // overwhelmingly common restriction declares one family and leaves
19
+ // `and` undefined, so this costs one property read.
20
+ const siblings = conjunctiveFacetsOf(constraint);
21
+ if (siblings === undefined)
194
22
  return true;
195
- // Pure-string enumerations are fully decided by the set lookups —
196
- // only numeric/boolean literals can still match in the slow walk.
197
- if (!sets.anyCoercible)
198
- return false;
199
- return constraint.values.some((v) => {
200
- const stringResult = compareString(v, actualValue, caseInsensitive);
201
- if (stringResult !== undefined)
202
- return stringResult;
203
- const numericResult = compareNumeric(v, actualValue);
204
- if (numericResult !== undefined)
205
- return numericResult;
206
- const booleanResult = compareBoolean(v, actualValue);
207
- if (booleanResult !== undefined)
208
- return booleanResult;
209
- return false;
210
- });
211
- }
212
- /**
213
- * Match against numeric bounds
214
- */
215
- function matchBounds(constraint, actualValue) {
216
- // String-length facets (xs:length / xs:minLength / xs:maxLength)
217
- // operate on the textual length, not on numeric magnitude. When any
218
- // of them are present, evaluate the length constraints first.
219
- if (constraint.length !== undefined ||
220
- constraint.minLength !== undefined ||
221
- constraint.maxLength !== undefined) {
222
- const str = String(actualValue);
223
- if (constraint.length !== undefined && str.length !== constraint.length) {
224
- return false;
225
- }
226
- if (constraint.minLength !== undefined && str.length < constraint.minLength) {
23
+ for (const sibling of siblings) {
24
+ if (!matchOneFamily(sibling, actualValue, ci))
227
25
  return false;
228
- }
229
- if (constraint.maxLength !== undefined && str.length > constraint.maxLength) {
230
- return false;
231
- }
232
- // Length-only restrictions don't impose numeric bounds; if the
233
- // constraint also carries min/max we fall through to the numeric
234
- // check below (rare in practice).
235
- if (constraint.minInclusive === undefined &&
236
- constraint.maxInclusive === undefined &&
237
- constraint.minExclusive === undefined &&
238
- constraint.maxExclusive === undefined) {
239
- return true;
240
- }
241
- }
242
- const num = typeof actualValue === 'number'
243
- ? actualValue
244
- : parseFloat(String(actualValue));
245
- if (isNaN(num))
246
- return false;
247
- if (constraint.minInclusive !== undefined &&
248
- num < constraint.minInclusive) {
249
- return false;
250
- }
251
- if (constraint.maxInclusive !== undefined &&
252
- num > constraint.maxInclusive) {
253
- return false;
254
- }
255
- if (constraint.minExclusive !== undefined && num <= constraint.minExclusive) {
256
- return false;
257
- }
258
- if (constraint.maxExclusive !== undefined && num >= constraint.maxExclusive) {
259
- return false;
260
26
  }
261
27
  return true;
262
28
  }
263
- /**
264
- * Cap enumeration rendering. These strings are embedded in per-entity
265
- * validation results — an uncapped 800-value code list produced ~20KB
266
- * per result and ballooned reports into the gigabytes (OOM crash on
267
- * large models). The full value list stays available on the constraint
268
- * object itself.
269
- */
270
- const MAX_ENUM_DISPLAY_VALUES = 10;
271
- function formatEnumValues(values) {
272
- const shown = values
273
- .slice(0, MAX_ENUM_DISPLAY_VALUES)
274
- .map((v) => `"${v}"`)
275
- .join(', ');
276
- const more = values.length - MAX_ENUM_DISPLAY_VALUES;
277
- return more > 0 ? `[${shown}, … +${more} more]` : `[${shown}]`;
278
- }
279
- /**
280
- * Get a human-readable description of why a constraint match failed
281
- */
282
- export function getConstraintMismatchReason(constraint, actualValue) {
283
- if (actualValue === null || actualValue === undefined) {
284
- return 'value is missing';
285
- }
286
- switch (constraint.type) {
287
- case 'simpleValue':
288
- return `expected "${constraint.value}", got "${actualValue}"`;
289
- case 'pattern':
290
- return `"${actualValue}" does not match pattern "${constraint.pattern}"`;
291
- case 'enumeration':
292
- return `"${actualValue}" is not one of ${formatEnumValues(constraint.values)}`;
293
- case 'bounds':
294
- return getBoundsMismatchReason(constraint, actualValue);
295
- default:
296
- return 'unknown constraint type';
297
- }
298
- }
299
- function getBoundsMismatchReason(constraint, actualValue) {
300
- const num = typeof actualValue === 'number'
301
- ? actualValue
302
- : parseFloat(String(actualValue));
303
- if (isNaN(num)) {
304
- return `"${actualValue}" is not a valid number`;
305
- }
306
- const violations = [];
307
- if (constraint.minInclusive !== undefined &&
308
- num < constraint.minInclusive - NUMERIC_TOLERANCE) {
309
- violations.push(`must be >= ${constraint.minInclusive}`);
310
- }
311
- if (constraint.maxInclusive !== undefined &&
312
- num > constraint.maxInclusive + NUMERIC_TOLERANCE) {
313
- violations.push(`must be <= ${constraint.maxInclusive}`);
314
- }
315
- if (constraint.minExclusive !== undefined && num <= constraint.minExclusive) {
316
- violations.push(`must be > ${constraint.minExclusive}`);
317
- }
318
- if (constraint.maxExclusive !== undefined && num >= constraint.maxExclusive) {
319
- violations.push(`must be < ${constraint.maxExclusive}`);
320
- }
321
- return `${num} ${violations.join(' and ')}`;
322
- }
323
- /**
324
- * Per-constraint display-string cache. Failure paths format the same
325
- * constraint for every non-matching entity — millions of times during
326
- * applicability filtering — and the output depends only on the
327
- * constraint object.
328
- */
329
- const FORMAT_CACHE = new WeakMap();
330
- /**
331
- * Format a constraint for display
332
- */
333
- export function formatConstraint(constraint) {
334
- let formatted = FORMAT_CACHE.get(constraint);
335
- if (formatted === undefined) {
336
- formatted = formatConstraintUncached(constraint);
337
- FORMAT_CACHE.set(constraint, formatted);
338
- }
339
- return formatted;
340
- }
341
- function formatConstraintUncached(constraint) {
342
- switch (constraint.type) {
343
- case 'simpleValue':
344
- return `"${constraint.value}"`;
345
- case 'pattern':
346
- return `pattern "${constraint.pattern}"`;
347
- case 'enumeration':
348
- if (constraint.values.length === 1) {
349
- return `"${constraint.values[0]}"`;
350
- }
351
- return `one of ${formatEnumValues(constraint.values)}`;
352
- case 'bounds':
353
- return formatBounds(constraint);
354
- default:
355
- return 'unknown';
356
- }
357
- }
358
- function formatBounds(constraint) {
359
- const parts = [];
360
- if (constraint.minInclusive !== undefined &&
361
- constraint.maxInclusive !== undefined) {
362
- return `between ${constraint.minInclusive} and ${constraint.maxInclusive}`;
363
- }
364
- if (constraint.minInclusive !== undefined) {
365
- parts.push(`>= ${constraint.minInclusive}`);
366
- }
367
- if (constraint.maxInclusive !== undefined) {
368
- parts.push(`<= ${constraint.maxInclusive}`);
369
- }
370
- if (constraint.minExclusive !== undefined) {
371
- parts.push(`> ${constraint.minExclusive}`);
372
- }
373
- if (constraint.maxExclusive !== undefined) {
374
- parts.push(`< ${constraint.maxExclusive}`);
375
- }
376
- return parts.join(' and ') || 'any value';
377
- }
29
+ export { getConstraintMismatchReason, formatConstraint, } from './describe.js';
378
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constraints/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EACL,cAAc,EACd,cAAc,EACd,aAAa,EAEb,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,gEAAgE;AAChE,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAa/B;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAyB,EACzB,WAAyD,EACzD,OAAsB;IAEtB,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,GAAG,OAAO,EAAE,eAAe,IAAI,KAAK,CAAC;IAE7C,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;QACxB,KAAK,aAAa;YAChB,OAAO,gBAAgB,CAAC,UAAU,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;QACvD,KAAK,SAAS;YAC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;IAC7C,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constraints/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAQ/D,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAaxE;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAyB,EACzB,WAAyD,EACzD,OAAsB;IAEtB,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,GAAG,OAAO,EAAE,eAAe,IAAI,KAAK,CAAC;IAE7C,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,WAAW,EAAE,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC;IAE/D,sEAAsE;IACtE,qEAAqE;IACrE,qEAAqE;IACrE,mEAAmE;IACnE,oDAAoD;IACpD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACjD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC;YAAE,OAAO,KAAK,CAAC;IAC9D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAGD,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The per-facet-family matchers — simple value, pattern, enumeration
3
+ * and bounds — plus their compiled-form caches.
4
+ *
5
+ * Split out of `constraints/index.ts` so that module is the matching
6
+ * entry point and this one holds the primitives, letting the reporting
7
+ * module (`describe.ts`) reach them without an import cycle.
8
+ */
9
+ import type { IDSConstraint } from '../types.js';
10
+ /** Tolerance for the bounds matcher's exclusive comparators. */
11
+ export declare const NUMERIC_TOLERANCE = 0.000001;
12
+ /**
13
+ * The conjunctive facets `parseRestriction` attached to this constraint
14
+ * from the same `<xs:restriction>`, or `undefined` when it declared one
15
+ * facet family (the common case). `simpleValue` never carries any: it
16
+ * does not come from a restriction.
17
+ */
18
+ export declare function conjunctiveFacetsOf(constraint: IDSConstraint): readonly IDSConstraint[] | undefined;
19
+ export declare function matchOneFamily(constraint: IDSConstraint, actualValue: string | number | boolean, ci: boolean): boolean;
20
+ //# sourceMappingURL=match-family.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-family.d.ts","sourceRoot":"","sources":["../../src/constraints/match-family.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EAKd,MAAM,aAAa,CAAC;AAarB,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,WAAO,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,aAAa,GACxB,SAAS,aAAa,EAAE,GAAG,SAAS,CAEtC;AAED,wBAAgB,cAAc,CAC5B,UAAU,EAAE,aAAa,EACzB,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EACtC,EAAE,EAAE,OAAO,GACV,OAAO,CAaT"}