@ifc-lite/cache 3.1.0 → 3.3.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 +63 -23
- package/dist/adapt.d.ts +72 -0
- package/dist/adapt.d.ts.map +1 -0
- package/dist/adapt.js +68 -0
- package/dist/adapt.js.map +1 -0
- package/dist/glb-color.d.ts +15 -0
- package/dist/glb-color.d.ts.map +1 -0
- package/dist/glb-color.js +18 -0
- package/dist/glb-color.js.map +1 -0
- package/dist/glb.d.ts.map +1 -1
- package/dist/glb.js +3 -3
- package/dist/glb.js.map +1 -1
- package/dist/index.d.ts +18 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/reader.js +1 -1
- package/dist/reader.js.map +1 -1
- package/dist/sections/entity-index-columns.d.ts +4 -0
- package/dist/sections/entity-index-columns.d.ts.map +1 -0
- package/dist/sections/entity-index-columns.js +41 -0
- package/dist/sections/entity-index-columns.js.map +1 -0
- package/dist/sections/entity-index.d.ts.map +1 -1
- package/dist/sections/entity-index.js +17 -9
- package/dist/sections/entity-index.js.map +1 -1
- package/dist/sections/geometry-chunks.d.ts +2 -2
- package/dist/sections/geometry-chunks.d.ts.map +1 -1
- package/dist/sections/geometry-chunks.js +21 -22
- package/dist/sections/geometry-chunks.js.map +1 -1
- package/dist/sections/geometry-codec.d.ts +8 -0
- package/dist/sections/geometry-codec.d.ts.map +1 -0
- package/dist/sections/geometry-codec.js +19 -0
- package/dist/sections/geometry-codec.js.map +1 -0
- package/dist/sections/geometry.d.ts.map +1 -1
- package/dist/sections/geometry.js +49 -0
- package/dist/sections/geometry.js.map +1 -1
- package/dist/sections/properties.d.ts.map +1 -1
- package/dist/sections/properties.js +23 -26
- package/dist/sections/properties.js.map +1 -1
- package/dist/sections/quantities.d.ts.map +1 -1
- package/dist/sections/quantities.js +26 -25
- package/dist/sections/quantities.js.map +1 -1
- package/dist/sections/relationships.d.ts +25 -2
- package/dist/sections/relationships.d.ts.map +1 -1
- package/dist/sections/relationships.js +150 -16
- package/dist/sections/relationships.js.map +1 -1
- package/dist/types.d.ts +51 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +37 -1
- package/dist/types.js.map +1 -1
- package/dist/workers/geometry-compression-client.d.ts +27 -0
- package/dist/workers/geometry-compression-client.d.ts.map +1 -0
- package/dist/workers/geometry-compression-client.js +84 -0
- package/dist/workers/geometry-compression-client.js.map +1 -0
- package/dist/workers/geometry-compression-handler.d.ts +4 -0
- package/dist/workers/geometry-compression-handler.d.ts.map +1 -0
- package/dist/workers/geometry-compression-handler.js +18 -0
- package/dist/workers/geometry-compression-handler.js.map +1 -0
- package/dist/workers/geometry-compression-protocol.d.ts +14 -0
- package/dist/workers/geometry-compression-protocol.d.ts.map +1 -0
- package/dist/workers/geometry-compression-protocol.js +10 -0
- package/dist/workers/geometry-compression-protocol.js.map +1 -0
- package/dist/workers/geometry-compression.worker.d.ts +2 -0
- package/dist/workers/geometry-compression.worker.d.ts.map +1 -0
- package/dist/workers/geometry-compression.worker.js +13 -0
- package/dist/workers/geometry-compression.worker.js.map +1 -0
- package/dist/writer.js +1 -1
- package/dist/writer.js.map +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quantities.js","sourceRoot":"","sources":["../../src/sections/quantities.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"quantities.js","sourceRoot":"","sources":["../../src/sections/quantities.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAGpF;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB,EAAE,UAAyB;IAC7E,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAE/B,MAAM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U,EAAE,CAAC;QAChC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACvC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YACrC,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,eAAe,QAAQ,YAAY,GAAG,GAAG;oBAC1E,qBAAqB,QAAQ,EAAE,CAClC,CAAC;YACJ,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxB,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -12,10 +12,33 @@ import { BufferWriter, BufferReader } from '../utils/buffer-utils.js';
|
|
|
12
12
|
* - edgeTargets: Uint32Array[edgeCount]
|
|
13
13
|
* - edgeTypes: Uint16Array[edgeCount]
|
|
14
14
|
* - edgeRelIds: Uint32Array[edgeCount]
|
|
15
|
+
* - shadowedGroupCount: uint32 (v18+, #3782: edges collapsed from more
|
|
16
|
+
* than one IfcRel* instance — see RelationshipGraphBuilder.addEdge)
|
|
17
|
+
* - shadowedEdgeIndex: Uint32Array[shadowedGroupCount]
|
|
18
|
+
* - shadowedGroupOffsets: Uint32Array[shadowedGroupCount + 1]
|
|
19
|
+
* - shadowedIdCount: uint32
|
|
20
|
+
* - shadowedRelIds: Uint32Array[shadowedIdCount]
|
|
21
|
+
*
|
|
22
|
+
* A v17 reader stops after edgeRelIds — the trailing shadow section is new
|
|
23
|
+
* bytes it never asks for, and the section table's own size field bounds
|
|
24
|
+
* how far a stray future read could reach. A v18+ reader given a v17
|
|
25
|
+
* section (should one ever reach it — the cache LOOKUP key embeds
|
|
26
|
+
* FORMAT_VERSION, so normal load paths never do) must not attempt the
|
|
27
|
+
* shadow read at all; see the `version` parameter on `readRelationships`.
|
|
15
28
|
*/
|
|
16
29
|
export declare function writeRelationships(writer: BufferWriter, graph: RelationshipGraph): void;
|
|
17
30
|
/**
|
|
18
|
-
* Read RelationshipGraph from buffer
|
|
31
|
+
* Read RelationshipGraph from buffer. `version` is the cache header's
|
|
32
|
+
* FORMAT_VERSION — v17 sections have no shadow-id trailer (see
|
|
33
|
+
* `writeEdges`'s doc comment); pass the header's actual version so a v17
|
|
34
|
+
* section isn't misread as a v18+ one.
|
|
35
|
+
*
|
|
36
|
+
* Required, not defaulted to `FORMAT_VERSION`: a forgotten argument would
|
|
37
|
+
* silently read every buffer as the CURRENT version, the unsafe direction —
|
|
38
|
+
* a real v17 blob would be misread as v18 and hit `validateShadowedColumns`
|
|
39
|
+
* on bytes that were never written as a trailer at all (#3782 round 3
|
|
40
|
+
* review). `reader.ts`'s only call site already threads `header.version`
|
|
41
|
+
* through.
|
|
19
42
|
*/
|
|
20
|
-
export declare function readRelationships(reader: BufferReader): RelationshipGraph;
|
|
43
|
+
export declare function readRelationships(reader: BufferReader, version: number): RelationshipGraph;
|
|
21
44
|
//# sourceMappingURL=relationships.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/sections/relationships.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAA0B,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/sections/relationships.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAA0B,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAMvF;AA+CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAqC1F"}
|
|
@@ -1,7 +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 { RelationshipType } from '@ifc-lite/data';
|
|
4
|
+
import { RelationshipType, binarySearchU32 } from '@ifc-lite/data';
|
|
5
5
|
/**
|
|
6
6
|
* Write RelationshipGraph to buffer
|
|
7
7
|
* Format (for each direction - forward and inverse):
|
|
@@ -11,6 +11,19 @@ import { RelationshipType } from '@ifc-lite/data';
|
|
|
11
11
|
* - edgeTargets: Uint32Array[edgeCount]
|
|
12
12
|
* - edgeTypes: Uint16Array[edgeCount]
|
|
13
13
|
* - edgeRelIds: Uint32Array[edgeCount]
|
|
14
|
+
* - shadowedGroupCount: uint32 (v18+, #3782: edges collapsed from more
|
|
15
|
+
* than one IfcRel* instance — see RelationshipGraphBuilder.addEdge)
|
|
16
|
+
* - shadowedEdgeIndex: Uint32Array[shadowedGroupCount]
|
|
17
|
+
* - shadowedGroupOffsets: Uint32Array[shadowedGroupCount + 1]
|
|
18
|
+
* - shadowedIdCount: uint32
|
|
19
|
+
* - shadowedRelIds: Uint32Array[shadowedIdCount]
|
|
20
|
+
*
|
|
21
|
+
* A v17 reader stops after edgeRelIds — the trailing shadow section is new
|
|
22
|
+
* bytes it never asks for, and the section table's own size field bounds
|
|
23
|
+
* how far a stray future read could reach. A v18+ reader given a v17
|
|
24
|
+
* section (should one ever reach it — the cache LOOKUP key embeds
|
|
25
|
+
* FORMAT_VERSION, so normal load paths never do) must not attempt the
|
|
26
|
+
* shadow read at all; see the `version` parameter on `readRelationships`.
|
|
14
27
|
*/
|
|
15
28
|
export function writeRelationships(writer, graph) {
|
|
16
29
|
// Write forward edges
|
|
@@ -34,13 +47,34 @@ function writeEdges(writer, edges) {
|
|
|
34
47
|
writer.writeTypedArray(edges.edgeTargets);
|
|
35
48
|
writer.writeTypedArray(edges.edgeTypes);
|
|
36
49
|
writer.writeTypedArray(edges.edgeRelIds);
|
|
50
|
+
// Shadowed rel ids: sparse (absent whenever no edge in this half collapsed
|
|
51
|
+
// more than one IfcRel* instance), so this costs 4 bytes on the
|
|
52
|
+
// overwhelming majority of graphs.
|
|
53
|
+
const shadowedEdgeIndex = edges.shadowedEdgeIndex ?? new Uint32Array(0);
|
|
54
|
+
const shadowedGroupOffsets = edges.shadowedGroupOffsets ?? new Uint32Array([0]);
|
|
55
|
+
const shadowedRelIds = edges.shadowedRelIds ?? new Uint32Array(0);
|
|
56
|
+
writer.writeUint32(shadowedEdgeIndex.length);
|
|
57
|
+
writer.writeTypedArray(shadowedEdgeIndex);
|
|
58
|
+
writer.writeTypedArray(shadowedGroupOffsets);
|
|
59
|
+
writer.writeUint32(shadowedRelIds.length);
|
|
60
|
+
writer.writeTypedArray(shadowedRelIds);
|
|
37
61
|
}
|
|
38
62
|
/**
|
|
39
|
-
* Read RelationshipGraph from buffer
|
|
63
|
+
* Read RelationshipGraph from buffer. `version` is the cache header's
|
|
64
|
+
* FORMAT_VERSION — v17 sections have no shadow-id trailer (see
|
|
65
|
+
* `writeEdges`'s doc comment); pass the header's actual version so a v17
|
|
66
|
+
* section isn't misread as a v18+ one.
|
|
67
|
+
*
|
|
68
|
+
* Required, not defaulted to `FORMAT_VERSION`: a forgotten argument would
|
|
69
|
+
* silently read every buffer as the CURRENT version, the unsafe direction —
|
|
70
|
+
* a real v17 blob would be misread as v18 and hit `validateShadowedColumns`
|
|
71
|
+
* on bytes that were never written as a trailer at all (#3782 round 3
|
|
72
|
+
* review). `reader.ts`'s only call site already threads `header.version`
|
|
73
|
+
* through.
|
|
40
74
|
*/
|
|
41
|
-
export function readRelationships(reader) {
|
|
42
|
-
const forward = readEdges(reader);
|
|
43
|
-
const inverse = readEdges(reader);
|
|
75
|
+
export function readRelationships(reader, version) {
|
|
76
|
+
const forward = readEdges(reader, version);
|
|
77
|
+
const inverse = readEdges(reader, version);
|
|
44
78
|
return {
|
|
45
79
|
forward,
|
|
46
80
|
inverse,
|
|
@@ -58,15 +92,71 @@ export function readRelationships(reader) {
|
|
|
58
92
|
const edges = forward.getEdges(sourceId);
|
|
59
93
|
return edges
|
|
60
94
|
.filter((e) => e.target === targetId)
|
|
61
|
-
.map((e) =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
95
|
+
.map((e) => {
|
|
96
|
+
const info = {
|
|
97
|
+
relationshipId: e.relationshipId,
|
|
98
|
+
type: e.type,
|
|
99
|
+
typeName: relationshipTypeToString(e.type),
|
|
100
|
+
};
|
|
101
|
+
if (e.shadowedRelationshipIds !== undefined) {
|
|
102
|
+
info.shadowedRelationshipIds = e.shadowedRelationshipIds;
|
|
103
|
+
}
|
|
104
|
+
return info;
|
|
105
|
+
});
|
|
66
106
|
},
|
|
67
107
|
};
|
|
68
108
|
}
|
|
69
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Fail fast on a corrupt shadowed-rel-ids trailer (v18+, #3782), the same
|
|
111
|
+
* way the (offset, count) guard above does for the base edge arrays:
|
|
112
|
+
* `readUint32Array` only bounds-checks against the buffer's remaining
|
|
113
|
+
* bytes, it says nothing about whether the VALUES it read are internally
|
|
114
|
+
* consistent. Without this, `getEdges`'s `binarySearchU32` +
|
|
115
|
+
* `shadowedRelIds.subarray(...)` silently attaches the wrong ids to the
|
|
116
|
+
* wrong edge, clamps or overruns the slice, or (an out-of-range
|
|
117
|
+
* `shadowedEdgeIndex` entry) drops a group's shadowed ids entirely — every
|
|
118
|
+
* one of those is wrong data returned without an error, not a crash.
|
|
119
|
+
*
|
|
120
|
+
* Checks, in the order a corrupt encoder is most likely to break them:
|
|
121
|
+
* - `shadowedGroupOffsets.length === shadowedEdgeIndex.length + 1`
|
|
122
|
+
* - `shadowedGroupOffsets[0] === 0`
|
|
123
|
+
* - `shadowedGroupOffsets` strictly increasing (equal neighbours would be
|
|
124
|
+
* an empty group, which `buildShadowedColumns` never emits — see its
|
|
125
|
+
* "present implies non-empty" invariant)
|
|
126
|
+
* - `shadowedGroupOffsets[last] === shadowedRelIds.length`
|
|
127
|
+
* - `shadowedEdgeIndex` strictly ascending and every entry `< edgeCount`
|
|
128
|
+
*/
|
|
129
|
+
function validateShadowedColumns(shadowedEdgeIndex, shadowedGroupOffsets, shadowedRelIds, edgeCount) {
|
|
130
|
+
const groupCount = shadowedEdgeIndex.length;
|
|
131
|
+
if (shadowedGroupOffsets.length !== groupCount + 1) {
|
|
132
|
+
throw new Error(`Corrupt cache RelationshipGraph: shadowedGroupOffsets has ${shadowedGroupOffsets.length} ` +
|
|
133
|
+
`entries, expected ${groupCount + 1} for ${groupCount} shadowed group(s)`);
|
|
134
|
+
}
|
|
135
|
+
if (shadowedGroupOffsets[0] !== 0) {
|
|
136
|
+
throw new Error(`Corrupt cache RelationshipGraph: shadowedGroupOffsets[0] must be 0, got ${shadowedGroupOffsets[0]}`);
|
|
137
|
+
}
|
|
138
|
+
if (shadowedGroupOffsets[groupCount] !== shadowedRelIds.length) {
|
|
139
|
+
throw new Error(`Corrupt cache RelationshipGraph: shadowedGroupOffsets[${groupCount}] ` +
|
|
140
|
+
`(${shadowedGroupOffsets[groupCount]}) does not match shadowedRelIds length ${shadowedRelIds.length}`);
|
|
141
|
+
}
|
|
142
|
+
let prevEdgeIndex = -1;
|
|
143
|
+
for (let g = 0; g < groupCount; g++) {
|
|
144
|
+
const edgeIndex = shadowedEdgeIndex[g];
|
|
145
|
+
if (edgeIndex <= prevEdgeIndex) {
|
|
146
|
+
throw new Error(`Corrupt cache RelationshipGraph: shadowedEdgeIndex is not strictly ascending ` +
|
|
147
|
+
`at group ${g} (${edgeIndex} <= ${prevEdgeIndex})`);
|
|
148
|
+
}
|
|
149
|
+
if (edgeIndex >= edgeCount) {
|
|
150
|
+
throw new Error(`Corrupt cache RelationshipGraph: shadowedEdgeIndex[${g}] = ${edgeIndex} is out of range for edgeCount ${edgeCount}`);
|
|
151
|
+
}
|
|
152
|
+
prevEdgeIndex = edgeIndex;
|
|
153
|
+
if (shadowedGroupOffsets[g + 1] <= shadowedGroupOffsets[g]) {
|
|
154
|
+
throw new Error(`Corrupt cache RelationshipGraph: shadowed group ${g} is empty ` +
|
|
155
|
+
`[${shadowedGroupOffsets[g]}, ${shadowedGroupOffsets[g + 1]})`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function readEdges(reader, version) {
|
|
70
160
|
const nodeCount = reader.readUint32();
|
|
71
161
|
const offsets = new Map();
|
|
72
162
|
const counts = new Map();
|
|
@@ -81,28 +171,67 @@ function readEdges(reader) {
|
|
|
81
171
|
const edgeTargets = reader.readUint32Array(edgeCount);
|
|
82
172
|
const edgeTypes = reader.readUint16Array(edgeCount);
|
|
83
173
|
const edgeRelIds = reader.readUint32Array(edgeCount);
|
|
84
|
-
|
|
174
|
+
// Fail fast on a corrupt cache: each node's (offset, count) pair is an
|
|
175
|
+
// independent field from `edgeCount` — `BufferReader`'s own bounds checks
|
|
176
|
+
// (see its `ensureAvailable` doc comment) only guarantee the edge arrays
|
|
177
|
+
// themselves are `edgeCount` long, they say nothing about whether a given
|
|
178
|
+
// node's range stays inside that. Without this check, `getEdges` below
|
|
179
|
+
// reads `edgeTargets[i]` for `i` past the array's end — a plain JS typed-
|
|
180
|
+
// array index-out-of-bounds, which silently yields `undefined` rather than
|
|
181
|
+
// throwing — and returns edges with an `undefined` target/type/
|
|
182
|
+
// relationshipId mixed in with the real ones instead of failing loudly.
|
|
183
|
+
// Mirrors the same-shaped guards already in `strings.ts` (offset
|
|
184
|
+
// monotonicity) and `entity-index.ts` (typeIndex range).
|
|
185
|
+
for (const [entityId, offset] of offsets) {
|
|
186
|
+
const count = counts.get(entityId) ?? 0;
|
|
187
|
+
if (offset + count > edgeCount) {
|
|
188
|
+
throw new Error(`Corrupt cache RelationshipGraph: entity ${entityId}'s edge range ` +
|
|
189
|
+
`[${offset}, ${offset + count}) exceeds edge array length ${edgeCount}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
let shadowedEdgeIndex;
|
|
193
|
+
let shadowedGroupOffsets;
|
|
194
|
+
let shadowedRelIds;
|
|
195
|
+
if (version >= 18) {
|
|
196
|
+
const shadowedGroupCount = reader.readUint32();
|
|
197
|
+
shadowedEdgeIndex = reader.readUint32Array(shadowedGroupCount);
|
|
198
|
+
shadowedGroupOffsets = reader.readUint32Array(shadowedGroupCount + 1);
|
|
199
|
+
const shadowedIdCount = reader.readUint32();
|
|
200
|
+
shadowedRelIds = reader.readUint32Array(shadowedIdCount);
|
|
201
|
+
validateShadowedColumns(shadowedEdgeIndex, shadowedGroupOffsets, shadowedRelIds, edgeCount);
|
|
202
|
+
}
|
|
203
|
+
const edges = {
|
|
85
204
|
offsets,
|
|
86
205
|
counts,
|
|
87
206
|
edgeTargets,
|
|
88
207
|
edgeTypes,
|
|
89
208
|
edgeRelIds,
|
|
209
|
+
shadowedEdgeIndex,
|
|
210
|
+
shadowedGroupOffsets,
|
|
211
|
+
shadowedRelIds,
|
|
90
212
|
getEdges(entityId, type) {
|
|
91
213
|
const offset = offsets.get(entityId);
|
|
92
214
|
if (offset === undefined)
|
|
93
215
|
return [];
|
|
94
216
|
const count = counts.get(entityId);
|
|
95
|
-
const
|
|
217
|
+
const result = [];
|
|
96
218
|
for (let i = offset; i < offset + count; i++) {
|
|
97
219
|
if (type === undefined || edgeTypes[i] === type) {
|
|
98
|
-
|
|
220
|
+
const edge = {
|
|
99
221
|
target: edgeTargets[i],
|
|
100
222
|
type: edgeTypes[i],
|
|
101
223
|
relationshipId: edgeRelIds[i],
|
|
102
|
-
}
|
|
224
|
+
};
|
|
225
|
+
if (shadowedEdgeIndex && shadowedGroupOffsets && shadowedRelIds) {
|
|
226
|
+
const g = binarySearchU32(shadowedEdgeIndex, i);
|
|
227
|
+
if (g !== -1) {
|
|
228
|
+
edge.shadowedRelationshipIds = Array.from(shadowedRelIds.subarray(shadowedGroupOffsets[g], shadowedGroupOffsets[g + 1]));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
result.push(edge);
|
|
103
232
|
}
|
|
104
233
|
}
|
|
105
|
-
return
|
|
234
|
+
return result;
|
|
106
235
|
},
|
|
107
236
|
getTargets(entityId, type) {
|
|
108
237
|
return this.getEdges(entityId, type).map((e) => e.target);
|
|
@@ -111,6 +240,11 @@ function readEdges(reader) {
|
|
|
111
240
|
return offsets.has(entityId);
|
|
112
241
|
},
|
|
113
242
|
};
|
|
243
|
+
// `shadowedEdgeIndex`/etc. are `undefined` (not present) on a pre-#3782
|
|
244
|
+
// cache read (version < 18) — matches `RelationshipEdges`'s optional
|
|
245
|
+
// fields exactly, so `edges` above satisfies the interface either way
|
|
246
|
+
// without a cast.
|
|
247
|
+
return edges;
|
|
114
248
|
}
|
|
115
249
|
function relationshipTypeToString(type) {
|
|
116
250
|
const names = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationships.js","sourceRoot":"","sources":["../../src/sections/relationships.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"relationships.js","sourceRoot":"","sources":["../../src/sections/relationships.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,kBAAkB,CA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,kBAAkB,CAAC,EAAE,0BAA0B;QACjE,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,oBAAoB;QACrD,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,oBAAoB;QACrD,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,EAAE,4BAA4B;QACrE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,wBAAwB;QAC7D,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,EAAE,6BAA6B;QACvE,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,qBAAqB;QACvD,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,qBAAqB;QACvD,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,sBAAsB;QACzD,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,wBAAwB;QAC7D,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,EAAE,8BAA8B;KAChF,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;AAClC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -107,8 +107,44 @@ export declare const MAGIC = 1279477321;
|
|
|
107
107
|
* follows. A v15 reader still reads v14 sections — the column is
|
|
108
108
|
* version-gated and degrades to the enum-only name, exactly the pre-v15
|
|
109
109
|
* behaviour.
|
|
110
|
+
*
|
|
111
|
+
* v15->v16: instanced shards go to IFNS v2 (#2985). Their instance records gain
|
|
112
|
+
* a trailing `itemId` and declare a 92-byte stride, and the InstancedShards
|
|
113
|
+
* section stores shard bytes VERBATIM -- it never re-encodes. So a v2 shard
|
|
114
|
+
* this build writes would sit under a cache key an OLDER bundle still
|
|
115
|
+
* matches, and that bundle's decoder is a strict `version !== 1` throw which
|
|
116
|
+
* `useGeometryStreaming` swallows with a console.warn. Every instanced
|
|
117
|
+
* occurrence would vanish while the flat geometry kept drawing: it reads as
|
|
118
|
+
* missing geometry, not as a version error. Deploy skew reaches that without
|
|
119
|
+
* a rollback (a tab opened before the deploy, an edge still serving the
|
|
120
|
+
* previous bundle), and this repo has been bitten by deploy skew before.
|
|
121
|
+
* The bump splits the keyspace rather than sharing it: an old bundle looks
|
|
122
|
+
* for v15, misses, re-parses, and writes v1 shards it can read; this build
|
|
123
|
+
* looks for v16. This is the ONE bump here that is deliberately destructive
|
|
124
|
+
* -- every existing entry re-meshes once -- because the alternative is a
|
|
125
|
+
* silent partial render on a bundle nobody can update.
|
|
126
|
+
*
|
|
127
|
+
* v16->v17: the QuantityTable gains a `qsetGlobalId` column (#3606),
|
|
128
|
+
* mirroring PropertyTable's `psetGlobalId` — `QuantityTable.getForEntity`
|
|
129
|
+
* now groups on (qsetName, qsetGlobalId) instead of qsetName alone, so
|
|
130
|
+
* two distinct `IfcElementQuantity` instances sharing a literal name
|
|
131
|
+
* (federated merge, or an exporter emitting the same Qto_ set twice)
|
|
132
|
+
* stay separate instead of the second instance's quantities landing
|
|
133
|
+
* under the first instance's GlobalId.
|
|
134
|
+
*
|
|
135
|
+
* v17->v18: the Relationships section gains a trailing shadowed-rel-ids
|
|
136
|
+
* trailer per direction (#3782): `RelationshipGraphBuilder.addEdge` now
|
|
137
|
+
* folds a repeat (source, target, type) triple into the surviving edge
|
|
138
|
+
* instead of dropping it, keeping the extra `IfcRel*` express ids so a
|
|
139
|
+
* delete of the surviving one doesn't erase a connection a sibling
|
|
140
|
+
* instance still names. Appended AFTER `edgeRelIds` so the v17 prefix
|
|
141
|
+
* stays byte-identical; a v18 reader handed a v17 section simply stops
|
|
142
|
+
* there and never emits `shadowedRelationshipIds` — matches the pre-v18
|
|
143
|
+
* in-memory behaviour exactly, since those graphs never tracked them
|
|
144
|
+
* either. Not the destructive kind of bump: no existing cache entry is
|
|
145
|
+
* wrong to read, only silent about a rare case until it is re-parsed.
|
|
110
146
|
*/
|
|
111
|
-
export declare const FORMAT_VERSION =
|
|
147
|
+
export declare const FORMAT_VERSION = 18;
|
|
112
148
|
/** Geometry chunking parameters (v13+). Grouping is a WRITE-side layout
|
|
113
149
|
* policy: readers only trust the directory, so these can change without a
|
|
114
150
|
* format bump. Cell size mirrors the renderer's spatial bucketing default
|
|
@@ -227,6 +263,10 @@ export interface CacheWriteOptions {
|
|
|
227
263
|
* latency matters more than entry size.
|
|
228
264
|
*/
|
|
229
265
|
compressGeometryChunks?: boolean;
|
|
266
|
+
/** Use one lazy browser module worker for geometry compression (default false).
|
|
267
|
+
* Requires Worker support and a bundled worker asset; failure rejects the write.
|
|
268
|
+
* Has no effect when compression is disabled or all chunks are below its floor. */
|
|
269
|
+
compressGeometryChunksInWorker?: boolean;
|
|
230
270
|
}
|
|
231
271
|
/**
|
|
232
272
|
* Options for reading cache
|
|
@@ -282,7 +322,16 @@ export interface CacheEntityRef {
|
|
|
282
322
|
lineNumber?: number;
|
|
283
323
|
}
|
|
284
324
|
export interface CacheEntityIndex {
|
|
285
|
-
byId: Iterable<[number, CacheEntityRef]
|
|
325
|
+
byId: Iterable<[number, CacheEntityRef]> & {
|
|
326
|
+
/** Optional borrowed columns equivalent to iteration; never mutated/transferred. */
|
|
327
|
+
getColumns?(): {
|
|
328
|
+
expressIds: Uint32Array;
|
|
329
|
+
byteOffsets: Uint32Array;
|
|
330
|
+
byteLengths: Uint32Array;
|
|
331
|
+
typeIndices: Uint16Array;
|
|
332
|
+
typeStrings: string[];
|
|
333
|
+
};
|
|
334
|
+
};
|
|
286
335
|
}
|
|
287
336
|
export interface CachedEntityIndexColumns {
|
|
288
337
|
ids: Uint32Array;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClI,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oB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Ac;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,GAAG;QACzC,oFAAoF;QACpF,UAAU,CAAC,IAAI;YACb,UAAU,EAAE,WAAW,CAAC;YACxB,WAAW,EAAE,WAAW,CAAC;YACzB,WAAW,EAAE,WAAW,CAAC;YACzB,WAAW,EAAE,WAAW,CAAC;YACzB,WAAW,EAAE,MAAM,EAAE,CAAC;SACvB,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,WAAW,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,QAAQ,EAAE,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,cAAc,CAAC;QAC/B;;6EAEqE;QACrE,eAAe,CAAC,EAAE,WAAW,EAAE,CAAC;KACjC,CAAC;CACH;AAED,2BAA2B;AAC3B,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,kCAAkC;AAClC,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -105,8 +105,44 @@ export const MAGIC = 0x4C434649; // "IFCL" in little-endian
|
|
|
105
105
|
* follows. A v15 reader still reads v14 sections — the column is
|
|
106
106
|
* version-gated and degrades to the enum-only name, exactly the pre-v15
|
|
107
107
|
* behaviour.
|
|
108
|
+
*
|
|
109
|
+
* v15->v16: instanced shards go to IFNS v2 (#2985). Their instance records gain
|
|
110
|
+
* a trailing `itemId` and declare a 92-byte stride, and the InstancedShards
|
|
111
|
+
* section stores shard bytes VERBATIM -- it never re-encodes. So a v2 shard
|
|
112
|
+
* this build writes would sit under a cache key an OLDER bundle still
|
|
113
|
+
* matches, and that bundle's decoder is a strict `version !== 1` throw which
|
|
114
|
+
* `useGeometryStreaming` swallows with a console.warn. Every instanced
|
|
115
|
+
* occurrence would vanish while the flat geometry kept drawing: it reads as
|
|
116
|
+
* missing geometry, not as a version error. Deploy skew reaches that without
|
|
117
|
+
* a rollback (a tab opened before the deploy, an edge still serving the
|
|
118
|
+
* previous bundle), and this repo has been bitten by deploy skew before.
|
|
119
|
+
* The bump splits the keyspace rather than sharing it: an old bundle looks
|
|
120
|
+
* for v15, misses, re-parses, and writes v1 shards it can read; this build
|
|
121
|
+
* looks for v16. This is the ONE bump here that is deliberately destructive
|
|
122
|
+
* -- every existing entry re-meshes once -- because the alternative is a
|
|
123
|
+
* silent partial render on a bundle nobody can update.
|
|
124
|
+
*
|
|
125
|
+
* v16->v17: the QuantityTable gains a `qsetGlobalId` column (#3606),
|
|
126
|
+
* mirroring PropertyTable's `psetGlobalId` — `QuantityTable.getForEntity`
|
|
127
|
+
* now groups on (qsetName, qsetGlobalId) instead of qsetName alone, so
|
|
128
|
+
* two distinct `IfcElementQuantity` instances sharing a literal name
|
|
129
|
+
* (federated merge, or an exporter emitting the same Qto_ set twice)
|
|
130
|
+
* stay separate instead of the second instance's quantities landing
|
|
131
|
+
* under the first instance's GlobalId.
|
|
132
|
+
*
|
|
133
|
+
* v17->v18: the Relationships section gains a trailing shadowed-rel-ids
|
|
134
|
+
* trailer per direction (#3782): `RelationshipGraphBuilder.addEdge` now
|
|
135
|
+
* folds a repeat (source, target, type) triple into the surviving edge
|
|
136
|
+
* instead of dropping it, keeping the extra `IfcRel*` express ids so a
|
|
137
|
+
* delete of the surviving one doesn't erase a connection a sibling
|
|
138
|
+
* instance still names. Appended AFTER `edgeRelIds` so the v17 prefix
|
|
139
|
+
* stays byte-identical; a v18 reader handed a v17 section simply stops
|
|
140
|
+
* there and never emits `shadowedRelationshipIds` — matches the pre-v18
|
|
141
|
+
* in-memory behaviour exactly, since those graphs never tracked them
|
|
142
|
+
* either. Not the destructive kind of bump: no existing cache entry is
|
|
143
|
+
* wrong to read, only silent about a rare case until it is re-parsed.
|
|
108
144
|
*/
|
|
109
|
-
export const FORMAT_VERSION =
|
|
145
|
+
export const FORMAT_VERSION = 18;
|
|
110
146
|
/** Geometry chunking parameters (v13+). Grouping is a WRITE-side layout
|
|
111
147
|
* policy: readers only trust the directory, so these can change without a
|
|
112
148
|
* format bump. Cell size mirrors the renderer's spatial bucketing default
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAS/D,0BAA0B;AAC1B,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,0BAA0B;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;;;;;;GAMG;AACH;;;;;;;;;;GAUG;AACH;;;;;;;;;;GAUG;AACH
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAS/D,0BAA0B;AAC1B,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,0BAA0B;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;;;;;;GAMG;AACH;;;;;;;;;;GAUG;AACH;;;;;;;;;;GAUG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAA;IACR,2DAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AA4JD,2BAA2B;AAC3B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,kCAAkC;AAClC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CompressionRequest } from './geometry-compression-protocol.js';
|
|
2
|
+
type StoredChunk = {
|
|
3
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
4
|
+
compressed: boolean;
|
|
5
|
+
};
|
|
6
|
+
export interface CompressionWorkerPort {
|
|
7
|
+
onmessage: ((event: MessageEvent<unknown>) => void) | null;
|
|
8
|
+
onerror: ((event: ErrorEvent) => void) | null;
|
|
9
|
+
onmessageerror: ((event: MessageEvent<unknown>) => void) | null;
|
|
10
|
+
postMessage(message: CompressionRequest, transfers: ArrayBuffer[]): void;
|
|
11
|
+
terminate(): void;
|
|
12
|
+
}
|
|
13
|
+
/** Private per-write owner. The existing builder bounds requests to four chunks. */
|
|
14
|
+
export declare class GeometryCompressionSession {
|
|
15
|
+
private readonly createWorker;
|
|
16
|
+
private worker?;
|
|
17
|
+
private nextId;
|
|
18
|
+
private failure?;
|
|
19
|
+
private readonly pending;
|
|
20
|
+
constructor(createWorker?: () => CompressionWorkerPort);
|
|
21
|
+
compress(raw: Uint8Array<ArrayBuffer>): Promise<StoredChunk>;
|
|
22
|
+
close(): void;
|
|
23
|
+
private receive;
|
|
24
|
+
private fail;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=geometry-compression-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry-compression-client.d.ts","sourceRoot":"","sources":["../../src/workers/geometry-compression-client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,oCAAoC,CAAC;AAElG,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAC3E,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9C,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAChE,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IACzE,SAAS,IAAI,IAAI,CAAC;CACnB;AAED,oFAAoF;AACpF,qBAAa,0BAA0B;IAQzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAPzC,OAAO,CAAC,MAAM,CAAC,CAAwB;IACvC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAEnB;gBAEwB,YAAY,GAAE,MAAM,qBAC6C;IAE9F,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAyB5D,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,OAAO;IA2Bf,OAAO,CAAC,IAAI;CAYb"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
/** Private per-write owner. The existing builder bounds requests to four chunks. */
|
|
5
|
+
export class GeometryCompressionSession {
|
|
6
|
+
createWorker;
|
|
7
|
+
worker;
|
|
8
|
+
nextId = 0;
|
|
9
|
+
failure;
|
|
10
|
+
pending = new Map();
|
|
11
|
+
constructor(createWorker = () => new Worker(new URL('./geometry-compression.worker.js', import.meta.url), { type: 'module' })) {
|
|
12
|
+
this.createWorker = createWorker;
|
|
13
|
+
}
|
|
14
|
+
compress(raw) {
|
|
15
|
+
if (this.failure)
|
|
16
|
+
return Promise.reject(this.failure);
|
|
17
|
+
if (raw.byteOffset !== 0 || raw.byteLength !== raw.buffer.byteLength) {
|
|
18
|
+
return Promise.reject(new Error('Geometry compression requires an owned whole buffer'));
|
|
19
|
+
}
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const id = ++this.nextId;
|
|
22
|
+
this.pending.set(id, { length: raw.byteLength, resolve, reject });
|
|
23
|
+
try {
|
|
24
|
+
if (!this.worker) {
|
|
25
|
+
this.worker = this.createWorker();
|
|
26
|
+
this.worker.onmessage = event => this.receive(event.data);
|
|
27
|
+
this.worker.onerror = event => {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
this.fail(new Error(`Geometry compression worker failed: ${event.message}`));
|
|
30
|
+
};
|
|
31
|
+
this.worker.onmessageerror = () => this.fail(new Error('Geometry compression response could not be decoded'));
|
|
32
|
+
}
|
|
33
|
+
this.worker.postMessage({ id, buffer: raw.buffer }, [raw.buffer]);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
this.fail(error instanceof Error ? error : new Error(String(error)));
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
close() {
|
|
41
|
+
this.fail(new Error('Geometry compression session closed'));
|
|
42
|
+
}
|
|
43
|
+
receive(value) {
|
|
44
|
+
if (!value || typeof value !== 'object') {
|
|
45
|
+
this.fail(new Error('Invalid geometry compression response'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const response = value;
|
|
49
|
+
const pending = typeof response.id === 'number' ? this.pending.get(response.id) : undefined;
|
|
50
|
+
if (!pending) {
|
|
51
|
+
this.fail(new Error('Unknown geometry compression response id'));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if ('error' in response) {
|
|
55
|
+
this.fail(new Error(`Geometry compression failed: ${String(response.error)}`));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!('buffer' in response) || !(response.buffer instanceof ArrayBuffer)
|
|
59
|
+
|| typeof response.compressed !== 'boolean'
|
|
60
|
+
|| (response.compressed && response.buffer.byteLength === 0)
|
|
61
|
+
|| (response.compressed ? response.buffer.byteLength >= pending.length
|
|
62
|
+
: response.buffer.byteLength !== pending.length)) {
|
|
63
|
+
this.fail(new Error('Invalid geometry compression result length or flags'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.pending.delete(response.id);
|
|
67
|
+
pending.resolve({ bytes: new Uint8Array(response.buffer), compressed: response.compressed });
|
|
68
|
+
}
|
|
69
|
+
fail(error) {
|
|
70
|
+
if (this.failure)
|
|
71
|
+
return;
|
|
72
|
+
this.failure = error;
|
|
73
|
+
const worker = this.worker;
|
|
74
|
+
this.worker = undefined;
|
|
75
|
+
if (worker) {
|
|
76
|
+
worker.onmessage = worker.onerror = worker.onmessageerror = null;
|
|
77
|
+
worker.terminate();
|
|
78
|
+
}
|
|
79
|
+
for (const pending of this.pending.values())
|
|
80
|
+
pending.reject(error);
|
|
81
|
+
this.pending.clear();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=geometry-compression-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry-compression-client.js","sourceRoot":"","sources":["../../src/workers/geometry-compression-client.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAa/D,oFAAoF;AACpF,MAAM,OAAO,0BAA0B;IAQR;IAPrB,MAAM,CAAyB;IAC/B,MAAM,GAAG,CAAC,CAAC;IACX,OAAO,CAAS;IACP,OAAO,GAAG,IAAI,GAAG,EAE9B,CAAC;IAEL,YAA6B,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AS,EAAE,CAAC;QACrB,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CompressionResponse } from './geometry-compression-protocol.js';
|
|
2
|
+
/** Canonical codec handler shared by the real worker and transport contract tests. */
|
|
3
|
+
export declare function handleCompressionRequest(value: unknown, send: (response: CompressionResponse, transfers: ArrayBuffer[]) => void): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=geometry-compression-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry-compression-handler.d.ts","sourceRoot":"","sources":["../../src/workers/geometry-compression-handler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEpG,sFAAsF;AACtF,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,IAAI,GACtE,OAAO,CAAC,IAAI,CAAC,CAQf"}
|