@ifc-lite/ids 1.15.51 → 1.15.52
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.
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The specials upstream's xs:double pattern accepts, spelled exactly as it
|
|
3
|
+
* spells them:
|
|
4
|
+
*
|
|
5
|
+
* ^([-+]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?|NaN|\+INF|-INF)$
|
|
6
|
+
*
|
|
7
|
+
* Bare `INF` is absent because that pattern has `\+INF`, not `\+?INF`; and
|
|
8
|
+
* `Infinity` because it appears in neither upstream nor XSD.
|
|
9
|
+
*/
|
|
10
|
+
export declare const XSD_NUMERIC_SPECIALS: Set<string>;
|
|
1
11
|
/**
|
|
2
12
|
* Returns true iff the IDS literal `value` casts successfully under at
|
|
3
13
|
* least one of `xsdTypes`. Empty / undefined `xsdTypes` returns `true`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsd-cast.d.ts","sourceRoot":"","sources":["../../src/constraints/xsd-cast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xsd-cast.d.ts","sourceRoot":"","sources":["../../src/constraints/xsd-cast.ts"],"names":[],"mappings":"AAsBA;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,aAAmC,CAAC;AASrE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACtC,OAAO,CAGT;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAkCzE;AA4CD,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AA6BD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,GACjC,SAAS,MAAM,EAAE,CAkDnB"}
|
|
@@ -4,13 +4,29 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* XSD strict-cast helpers shared by the attribute and property facets.
|
|
6
6
|
*
|
|
7
|
-
* Mirrors
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Mirrors what upstream `IDS-Audit-tool` accepts before doing the value
|
|
8
|
+
* comparison.
|
|
9
|
+
*
|
|
10
|
+
* NOT `TryParse`, which this said until #3336: upstream decides these with
|
|
11
|
+
* GENERATED REGEXES (`ids-lib.codegen/XmlSchema_XsTypesGenerator.cs`), and its
|
|
12
|
+
* xs:double pattern is neither .NET nor XSD. It takes `+INF` (an XSD 1.1
|
|
13
|
+
* spelling) while rejecting bare `INF` (the 1.0 one), and rejects `Infinity`
|
|
14
|
+
* (the .NET one). Parity with upstream is the contract, so that is what these
|
|
15
|
+
* arms implement. An IDS literal must cast successfully under at least one
|
|
10
16
|
* of the slot's declared XSD types — `xs:integer` rejects `42.0`,
|
|
11
17
|
* `xs:double` accepts either, etc.
|
|
12
18
|
*/
|
|
13
19
|
import { isWhollyNumeric } from '@ifc-lite/encoding';
|
|
20
|
+
/**
|
|
21
|
+
* The specials upstream's xs:double pattern accepts, spelled exactly as it
|
|
22
|
+
* spells them:
|
|
23
|
+
*
|
|
24
|
+
* ^([-+]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?|NaN|\+INF|-INF)$
|
|
25
|
+
*
|
|
26
|
+
* Bare `INF` is absent because that pattern has `\+INF`, not `\+?INF`; and
|
|
27
|
+
* `Infinity` because it appears in neither upstream nor XSD.
|
|
28
|
+
*/
|
|
29
|
+
export const XSD_NUMERIC_SPECIALS = new Set(['NaN', '+INF', '-INF']);
|
|
14
30
|
const INTEGER_RE = /^[+-]?\d+$/;
|
|
15
31
|
const DATE_RE = /^\d{4}-\d{2}-\d{2}(Z|[+-]\d{2}:\d{2})?$/;
|
|
16
32
|
const DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/;
|
|
@@ -31,12 +47,21 @@ export function literalCastsUnder(value, xsdType) {
|
|
|
31
47
|
case 'xs:integer':
|
|
32
48
|
return INTEGER_RE.test(value);
|
|
33
49
|
case 'xs:double':
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
// quadratic on a failing match — and an IDS literal is as
|
|
50
|
+
// The finite part goes through the shared linear scan, not a regex: the
|
|
51
|
+
// natural pattern `/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/` is the
|
|
52
|
+
// #3113 shape, quadratic on a failing match, and an IDS literal is as
|
|
38
53
|
// untrusted as the file it came out of.
|
|
39
|
-
|
|
54
|
+
//
|
|
55
|
+
// Deliberate deviation from upstream (#3336). Every part of upstream's
|
|
56
|
+
// pattern is optional, so it accepts a family of digitless and
|
|
57
|
+
// mantissa-less forms that are not numbers: "", "+", ".", "-", "+.",
|
|
58
|
+
// "-.", and the exponent-only class "e5" / "+e5" / ".e5". Those fall out
|
|
59
|
+
// of how the regex is written rather than being a contract, and an empty
|
|
60
|
+
// string is not a double, so the finite scan keeps rejecting them.
|
|
61
|
+
//
|
|
62
|
+
// NOT an exhaustive list -- the family is larger than the rows pinned in
|
|
63
|
+
// xsd-cast-specials.test.ts, which are representatives.
|
|
64
|
+
return isWhollyNumeric(value) || XSD_NUMERIC_SPECIALS.has(value);
|
|
40
65
|
case 'xs:boolean':
|
|
41
66
|
return value === 'true' || value === 'false';
|
|
42
67
|
case 'xs:date':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsd-cast.js","sourceRoot":"","sources":["../../src/constraints/xsd-cast.ts"],"names":[],"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IACtE,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,wDAAwD;IACxD,EAAE;IACF,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,0EAA0E;IAC1E,2EAA2E;IAC3E,8DAA8D;IAC9D,EAAE;IACF,wEAAwE;IACxE,0EAA0E;IAC1E,8DAA8D;IAC9D,IAAI,CAAC,KAAK,cAAc,EAAE,CAAC;QACzB,IAAI,aAAa,KAAK,SAAS;YAAE,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;QACtE,OAAO,aAAa,CAAC,WAAW,EAAE,KAAK,QAAQ;YAC7C,CAAC,CAAC,CAAC,YAAY,CAAC;YAChB,CAAC,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IACpC,CAAC;IACD,gEAAgE;IAChE,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACpE,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC;IACD,yDAAyD;IACzD,IACE,CAAC,KAAK,UAAU;QAChB,CAAC,KAAK,SAAS;QACf,CAAC,KAAK,eAAe;QACrB,CAAC,KAAK,WAAW,EACjB,CAAC;QACD,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/ids",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.52",
|
|
4
4
|
"description": "IDS (Information Delivery Specification) support for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@xmldom/xmldom": "^0.9.
|
|
21
|
-
"@ifc-lite/data": "3.5.
|
|
20
|
+
"@xmldom/xmldom": "^0.9.12",
|
|
21
|
+
"@ifc-lite/data": "3.5.1",
|
|
22
22
|
"@ifc-lite/encoding": "2.1.0",
|
|
23
23
|
"@ifc-lite/parser": "4.3.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"happy-dom": "^20.11.
|
|
26
|
+
"happy-dom": "^20.11.6",
|
|
27
27
|
"typescript": "^6.0.3",
|
|
28
|
-
"vitest": "^4.1.
|
|
28
|
+
"vitest": "^4.1.11",
|
|
29
29
|
"xmllint-wasm": "5.3.0",
|
|
30
30
|
"@ifc-lite/timing-ladder": "^0.1.0"
|
|
31
31
|
},
|