@ifc-lite/data 1.15.2 → 2.0.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/README.md +58 -28
- package/dist/entity-table.d.ts +51 -0
- package/dist/entity-table.d.ts.map +1 -1
- package/dist/entity-table.js +146 -96
- package/dist/entity-table.js.map +1 -1
- package/dist/ifc-schema/generated/attributes.d.ts +10 -0
- package/dist/ifc-schema/generated/attributes.d.ts.map +1 -0
- package/dist/ifc-schema/generated/attributes.js +2775 -0
- package/dist/ifc-schema/generated/attributes.js.map +1 -0
- package/dist/ifc-schema/generated/data-types.d.ts +8 -0
- package/dist/ifc-schema/generated/data-types.d.ts.map +1 -0
- package/dist/ifc-schema/generated/data-types.js +396 -0
- package/dist/ifc-schema/generated/data-types.js.map +1 -0
- package/dist/ifc-schema/generated/entities-ifc2x3.d.ts +8 -0
- package/dist/ifc-schema/generated/entities-ifc2x3.d.ts.map +1 -0
- package/dist/ifc-schema/generated/entities-ifc2x3.js +777 -0
- package/dist/ifc-schema/generated/entities-ifc2x3.js.map +1 -0
- package/dist/ifc-schema/generated/entities-ifc4.d.ts +8 -0
- package/dist/ifc-schema/generated/entities-ifc4.d.ts.map +1 -0
- package/dist/ifc-schema/generated/entities-ifc4.js +938 -0
- package/dist/ifc-schema/generated/entities-ifc4.js.map +1 -0
- package/dist/ifc-schema/generated/entities-ifc4x3.d.ts +8 -0
- package/dist/ifc-schema/generated/entities-ifc4x3.d.ts.map +1 -0
- package/dist/ifc-schema/generated/entities-ifc4x3.js +1014 -0
- package/dist/ifc-schema/generated/entities-ifc4x3.js.map +1 -0
- package/dist/ifc-schema/generated/partof-relations.d.ts +10 -0
- package/dist/ifc-schema/generated/partof-relations.d.ts.map +1 -0
- package/dist/ifc-schema/generated/partof-relations.js +28 -0
- package/dist/ifc-schema/generated/partof-relations.js.map +1 -0
- package/dist/ifc-schema/generated/psets-ifc2x3.d.ts +8 -0
- package/dist/ifc-schema/generated/psets-ifc2x3.d.ts.map +1 -0
- package/dist/ifc-schema/generated/psets-ifc2x3.js +3416 -0
- package/dist/ifc-schema/generated/psets-ifc2x3.js.map +1 -0
- package/dist/ifc-schema/generated/psets-ifc4.d.ts +8 -0
- package/dist/ifc-schema/generated/psets-ifc4.d.ts.map +1 -0
- package/dist/ifc-schema/generated/psets-ifc4.js +4510 -0
- package/dist/ifc-schema/generated/psets-ifc4.js.map +1 -0
- package/dist/ifc-schema/generated/psets-ifc4x3.d.ts +8 -0
- package/dist/ifc-schema/generated/psets-ifc4x3.d.ts.map +1 -0
- package/dist/ifc-schema/generated/psets-ifc4x3.js +8554 -0
- package/dist/ifc-schema/generated/psets-ifc4x3.js.map +1 -0
- package/dist/ifc-schema/index.d.ts +61 -0
- package/dist/ifc-schema/index.d.ts.map +1 -0
- package/dist/ifc-schema/index.js +212 -0
- package/dist/ifc-schema/index.js.map +1 -0
- package/dist/ifc-schema/types.d.ts +108 -0
- package/dist/ifc-schema/types.d.ts.map +1 -0
- package/dist/ifc-schema/types.js +5 -0
- package/dist/ifc-schema/types.js.map +1 -0
- package/dist/index.d.ts +14 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/property-table.d.ts +22 -0
- package/dist/property-table.d.ts.map +1 -1
- package/dist/property-table.js +89 -62
- package/dist/property-table.js.map +1 -1
- package/dist/quantity-table.d.ts +18 -0
- package/dist/quantity-table.d.ts.map +1 -1
- package/dist/quantity-table.js +80 -66
- package/dist/quantity-table.js.map +1 -1
- package/dist/relationship-graph.d.ts +53 -6
- package/dist/relationship-graph.d.ts.map +1 -1
- package/dist/relationship-graph.js +149 -113
- package/dist/relationship-graph.js.map +1 -1
- package/dist/spatial-types.d.ts +0 -1
- package/dist/spatial-types.d.ts.map +1 -1
- package/dist/spatial-types.js +0 -6
- package/dist/spatial-types.js.map +1 -1
- package/dist/string-table.d.ts +8 -0
- package/dist/string-table.d.ts.map +1 -1
- package/dist/string-table.js +20 -0
- package/dist/string-table.js.map +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +66 -0
- package/dist/types.js.map +1 -1
- package/dist/utf8-decode.d.ts +24 -0
- package/dist/utf8-decode.d.ts.map +1 -0
- package/dist/utf8-decode.js +103 -0
- package/dist/utf8-decode.js.map +1 -0
- package/package.json +11 -6
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true when `TextDecoder.decode()` accepts a SAB-backed view in
|
|
3
|
+
* this realm. Cached after first call.
|
|
4
|
+
*
|
|
5
|
+
* Exported so call sites can short-circuit explicit copies (e.g. when
|
|
6
|
+
* they already know the view is SAB-backed and want to allocate a single
|
|
7
|
+
* scratch buffer for a whole batch).
|
|
8
|
+
*/
|
|
9
|
+
export declare function textDecoderAcceptsSab(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Reset the detection cache. Tests only — production callers should never
|
|
12
|
+
* need to invalidate the result because the answer is fixed for the
|
|
13
|
+
* lifetime of the realm.
|
|
14
|
+
*/
|
|
15
|
+
export declare function __resetSabDecodeCache(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Decode a UTF-8 byte range from `view` into a string. Safe to call on
|
|
18
|
+
* `SharedArrayBuffer`-backed views in any realm.
|
|
19
|
+
*
|
|
20
|
+
* The optional `start`/`end` parameters mirror `Uint8Array.subarray`.
|
|
21
|
+
* Calling without them decodes the entire view.
|
|
22
|
+
*/
|
|
23
|
+
export declare function safeUtf8Decode(view: Uint8Array, start?: number, end?: number): string;
|
|
24
|
+
//# sourceMappingURL=utf8-decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utf8-decode.d.ts","sourceRoot":"","sources":["../src/utf8-decode.ts"],"names":[],"mappings":"AAmCA;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAa/C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAiBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBrF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* SAB-safe wrapper around `TextDecoder.decode()`.
|
|
6
|
+
*
|
|
7
|
+
* Both Firefox and Chromium reject `TextDecoder.decode(view)` when `view`
|
|
8
|
+
* is backed by a `SharedArrayBuffer` (Spectre timing-attack mitigation).
|
|
9
|
+
* The parser intentionally hands the source bytes around as a SAB so the
|
|
10
|
+
* parser worker, geometry workers, and main-thread on-demand extractors
|
|
11
|
+
* all read the same memory zero-copy — which means every decode of a
|
|
12
|
+
* subarray of the source needs to be SAB-aware.
|
|
13
|
+
*
|
|
14
|
+
* Strategy:
|
|
15
|
+
* 1. Detect the runtime's SAB-decode policy lazily, once. The result is
|
|
16
|
+
* stable for the lifetime of the realm.
|
|
17
|
+
* 2. When the runtime accepts SAB views, decode straight off the source
|
|
18
|
+
* (zero-copy, ~10 ns per call).
|
|
19
|
+
* 3. When it rejects, copy the requested subarray into a thread-local
|
|
20
|
+
* scratch `Uint8Array` first, then decode. The scratch buffer grows
|
|
21
|
+
* to the largest seen subarray and is reused, so the GC pressure is
|
|
22
|
+
* bounded even for million-entity files.
|
|
23
|
+
*
|
|
24
|
+
* Performance: the typical IFC entity decode is 50–500 bytes, so the copy
|
|
25
|
+
* path is microseconds per call. The hot batch decode path
|
|
26
|
+
* (`columnar-parser-attributes.ts`) already routes through scratch
|
|
27
|
+
* buffers, so only the per-entity attribute reads + schema detection +
|
|
28
|
+
* tokenizer fallback go through this helper.
|
|
29
|
+
*/
|
|
30
|
+
const sharedDecoder = new TextDecoder();
|
|
31
|
+
let acceptsSabCache = null;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true when `TextDecoder.decode()` accepts a SAB-backed view in
|
|
34
|
+
* this realm. Cached after first call.
|
|
35
|
+
*
|
|
36
|
+
* Exported so call sites can short-circuit explicit copies (e.g. when
|
|
37
|
+
* they already know the view is SAB-backed and want to allocate a single
|
|
38
|
+
* scratch buffer for a whole batch).
|
|
39
|
+
*/
|
|
40
|
+
export function textDecoderAcceptsSab() {
|
|
41
|
+
if (acceptsSabCache !== null)
|
|
42
|
+
return acceptsSabCache;
|
|
43
|
+
if (typeof SharedArrayBuffer === 'undefined') {
|
|
44
|
+
acceptsSabCache = true; // No SAB exists, so the question is moot.
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
sharedDecoder.decode(new Uint8Array(new SharedArrayBuffer(8)));
|
|
49
|
+
acceptsSabCache = true;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
acceptsSabCache = false;
|
|
53
|
+
}
|
|
54
|
+
return acceptsSabCache;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Reset the detection cache. Tests only — production callers should never
|
|
58
|
+
* need to invalidate the result because the answer is fixed for the
|
|
59
|
+
* lifetime of the realm.
|
|
60
|
+
*/
|
|
61
|
+
export function __resetSabDecodeCache() {
|
|
62
|
+
acceptsSabCache = null;
|
|
63
|
+
}
|
|
64
|
+
let scratchBuffer = null;
|
|
65
|
+
/**
|
|
66
|
+
* Ensure the realm-local scratch buffer can hold `byteLength` bytes,
|
|
67
|
+
* doubling on growth to amortise reallocation cost.
|
|
68
|
+
*/
|
|
69
|
+
function ensureScratch(byteLength) {
|
|
70
|
+
if (scratchBuffer === null || scratchBuffer.length < byteLength) {
|
|
71
|
+
let cap = scratchBuffer?.length ?? 4096;
|
|
72
|
+
while (cap < byteLength)
|
|
73
|
+
cap *= 2;
|
|
74
|
+
scratchBuffer = new Uint8Array(cap);
|
|
75
|
+
}
|
|
76
|
+
return scratchBuffer;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Decode a UTF-8 byte range from `view` into a string. Safe to call on
|
|
80
|
+
* `SharedArrayBuffer`-backed views in any realm.
|
|
81
|
+
*
|
|
82
|
+
* The optional `start`/`end` parameters mirror `Uint8Array.subarray`.
|
|
83
|
+
* Calling without them decodes the entire view.
|
|
84
|
+
*/
|
|
85
|
+
export function safeUtf8Decode(view, start, end) {
|
|
86
|
+
const sub = (start === undefined && end === undefined)
|
|
87
|
+
? view
|
|
88
|
+
: view.subarray(start ?? 0, end ?? view.length);
|
|
89
|
+
if (textDecoderAcceptsSab()) {
|
|
90
|
+
return sharedDecoder.decode(sub);
|
|
91
|
+
}
|
|
92
|
+
// SAB rejected — copy into scratch. `Uint8Array.set` accepts SAB-backed
|
|
93
|
+
// sources without restriction (the Spectre mitigation only fires inside
|
|
94
|
+
// string-producing APIs like TextDecoder), so this gives us an
|
|
95
|
+
// ArrayBuffer-backed view with the same bytes.
|
|
96
|
+
const len = sub.length;
|
|
97
|
+
if (len === 0)
|
|
98
|
+
return '';
|
|
99
|
+
const scratch = ensureScratch(len);
|
|
100
|
+
scratch.set(sub);
|
|
101
|
+
return sharedDecoder.decode(scratch.subarray(0, len));
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=utf8-decode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utf8-decode.js","sourceRoot":"","sources":["../src/utf8-decode.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,aAAa,GAAG,IAAI,WAAW,EAAE,CAAC;AAExC,IAAI,eAAe,GAAmB,IAAI,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB;IACnC,IAAI,eAAe,KAAK,IAAI;QAAE,OAAO,eAAe,CAAC;IACrD,IAAI,OAAO,iBAAiB,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E,wEAAwE;IACxE,+DAA+D;IAC/D,+CAA+C;IAC/C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IACvB,IAAI,GAAG,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,OAAO,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/data",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Columnar data structures for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,18 +12,21 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"
|
|
15
|
+
"@types/node": "^25.9.1",
|
|
16
|
+
"@types/proj4": "^2.19.0",
|
|
17
|
+
"proj4": "^2.20.4",
|
|
18
|
+
"typescript": "^6.0.3",
|
|
16
19
|
"vitest": "^1.6.0"
|
|
17
20
|
},
|
|
18
21
|
"license": "MPL-2.0",
|
|
19
22
|
"author": "Louis True",
|
|
20
23
|
"repository": {
|
|
21
24
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/
|
|
25
|
+
"url": "https://github.com/LTplus-AG/ifc-lite.git",
|
|
23
26
|
"directory": "packages/data"
|
|
24
27
|
},
|
|
25
|
-
"homepage": "https://
|
|
26
|
-
"bugs": "https://github.com/
|
|
28
|
+
"homepage": "https://ltplus-ag.github.io/ifc-lite/",
|
|
29
|
+
"bugs": "https://github.com/LTplus-AG/ifc-lite/issues",
|
|
27
30
|
"keywords": [
|
|
28
31
|
"ifc",
|
|
29
32
|
"bim",
|
|
@@ -43,6 +46,8 @@
|
|
|
43
46
|
"dev": "pnpm exec tsc --watch",
|
|
44
47
|
"test": "vitest run",
|
|
45
48
|
"generate:epsg-index": "tsx ../../scripts/generate-epsg-index.ts",
|
|
46
|
-
"augment:epsg-proj4": "tsx ../../scripts/augment-epsg-proj4.ts"
|
|
49
|
+
"augment:epsg-proj4": "tsx ../../scripts/augment-epsg-proj4.ts",
|
|
50
|
+
"verify:epsg": "tsx scripts/verify-epsg-roundtrip.ts",
|
|
51
|
+
"generate:ifc-schema": "tsx scripts/generate-ifc-schema.ts"
|
|
47
52
|
}
|
|
48
53
|
}
|