@ifc-lite/parser 4.3.2 → 5.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.
Files changed (155) hide show
  1. package/dist/attribute-helpers.d.ts +38 -4
  2. package/dist/attribute-helpers.d.ts.map +1 -1
  3. package/dist/attribute-helpers.js +71 -4
  4. package/dist/attribute-helpers.js.map +1 -1
  5. package/dist/columnar-parser-attributes.d.ts.map +1 -1
  6. package/dist/columnar-parser-attributes.js +35 -5
  7. package/dist/columnar-parser-attributes.js.map +1 -1
  8. package/dist/columnar-parser-indexes.d.ts.map +1 -1
  9. package/dist/columnar-parser-indexes.js +14 -2
  10. package/dist/columnar-parser-indexes.js.map +1 -1
  11. package/dist/columnar-parser-relationships.d.ts.map +1 -1
  12. package/dist/columnar-parser-relationships.js +6 -1
  13. package/dist/columnar-parser-relationships.js.map +1 -1
  14. package/dist/columnar-parser.d.ts +3 -1
  15. package/dist/columnar-parser.d.ts.map +1 -1
  16. package/dist/columnar-parser.js +16 -25
  17. package/dist/columnar-parser.js.map +1 -1
  18. package/dist/compact-entity-index-transport.d.ts +23 -0
  19. package/dist/compact-entity-index-transport.d.ts.map +1 -0
  20. package/dist/compact-entity-index-transport.js +28 -0
  21. package/dist/compact-entity-index-transport.js.map +1 -0
  22. package/dist/compact-entity-index.d.ts +0 -10
  23. package/dist/compact-entity-index.d.ts.map +1 -1
  24. package/dist/compact-entity-index.js +31 -24
  25. package/dist/compact-entity-index.js.map +1 -1
  26. package/dist/data-store-transport.d.ts +2 -12
  27. package/dist/data-store-transport.d.ts.map +1 -1
  28. package/dist/data-store-transport.js +7 -20
  29. package/dist/data-store-transport.js.map +1 -1
  30. package/dist/entity-extractor.d.ts.map +1 -1
  31. package/dist/entity-extractor.js +101 -6
  32. package/dist/entity-extractor.js.map +1 -1
  33. package/dist/entity-refs-from-index.d.ts.map +1 -1
  34. package/dist/entity-refs-from-index.js +12 -2
  35. package/dist/entity-refs-from-index.js.map +1 -1
  36. package/dist/entity-scanner.d.ts +63 -0
  37. package/dist/entity-scanner.d.ts.map +1 -1
  38. package/dist/entity-scanner.js +79 -2
  39. package/dist/entity-scanner.js.map +1 -1
  40. package/dist/express-id.d.ts +47 -0
  41. package/dist/express-id.d.ts.map +1 -0
  42. package/dist/express-id.js +57 -0
  43. package/dist/express-id.js.map +1 -0
  44. package/dist/generated/entities.d.ts +1 -1
  45. package/dist/generated/entities.d.ts.map +1 -1
  46. package/dist/generated/schema-registry.js +146 -146
  47. package/dist/generated/schema-registry.js.map +1 -1
  48. package/dist/georef-epset.d.ts +25 -0
  49. package/dist/georef-epset.d.ts.map +1 -0
  50. package/dist/georef-epset.js +214 -0
  51. package/dist/georef-epset.js.map +1 -0
  52. package/dist/georef-extractor.d.ts.map +1 -1
  53. package/dist/georef-extractor.js +38 -175
  54. package/dist/georef-extractor.js.map +1 -1
  55. package/dist/georef-map-conversion.d.ts +29 -0
  56. package/dist/georef-map-conversion.d.ts.map +1 -0
  57. package/dist/georef-map-conversion.js +75 -0
  58. package/dist/georef-map-conversion.js.map +1 -0
  59. package/dist/ifc-schema.d.ts +4 -2
  60. package/dist/ifc-schema.d.ts.map +1 -1
  61. package/dist/ifc-schema.js +15 -5
  62. package/dist/ifc-schema.js.map +1 -1
  63. package/dist/index.d.ts +5 -2
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +5 -2
  66. package/dist/index.js.map +1 -1
  67. package/dist/material-extractor.d.ts +2 -17
  68. package/dist/material-extractor.d.ts.map +1 -1
  69. package/dist/material-extractor.js +12 -37
  70. package/dist/material-extractor.js.map +1 -1
  71. package/dist/material-layer-reader.d.ts +45 -0
  72. package/dist/material-layer-reader.d.ts.map +1 -0
  73. package/dist/material-layer-reader.js +63 -0
  74. package/dist/material-layer-reader.js.map +1 -0
  75. package/dist/material-resolver.d.ts.map +1 -1
  76. package/dist/material-resolver.js +14 -14
  77. package/dist/material-resolver.js.map +1 -1
  78. package/dist/measure-unit-scale.d.ts +41 -0
  79. package/dist/measure-unit-scale.d.ts.map +1 -0
  80. package/dist/measure-unit-scale.js +53 -0
  81. package/dist/measure-unit-scale.js.map +1 -0
  82. package/dist/on-demand-extractors.d.ts +3 -19
  83. package/dist/on-demand-extractors.d.ts.map +1 -1
  84. package/dist/on-demand-extractors.js +54 -264
  85. package/dist/on-demand-extractors.js.map +1 -1
  86. package/dist/owning-project.d.ts +54 -0
  87. package/dist/owning-project.d.ts.map +1 -0
  88. package/dist/owning-project.js +76 -0
  89. package/dist/owning-project.js.map +1 -0
  90. package/dist/parser.worker.d.ts +14 -0
  91. package/dist/parser.worker.d.ts.map +1 -1
  92. package/dist/parser.worker.js +2 -0
  93. package/dist/parser.worker.js.map +1 -1
  94. package/dist/project-units-symbols.d.ts +33 -0
  95. package/dist/project-units-symbols.d.ts.map +1 -0
  96. package/dist/project-units-symbols.js +265 -0
  97. package/dist/project-units-symbols.js.map +1 -0
  98. package/dist/project-units.d.ts +11 -19
  99. package/dist/project-units.d.ts.map +1 -1
  100. package/dist/project-units.js +9 -267
  101. package/dist/project-units.js.map +1 -1
  102. package/dist/property-set-merge.d.ts +65 -8
  103. package/dist/property-set-merge.d.ts.map +1 -1
  104. package/dist/property-set-merge.js +130 -29
  105. package/dist/property-set-merge.js.map +1 -1
  106. package/dist/property-value-parser.d.ts +55 -0
  107. package/dist/property-value-parser.d.ts.map +1 -0
  108. package/dist/property-value-parser.js +277 -0
  109. package/dist/property-value-parser.js.map +1 -0
  110. package/dist/quantity-collect.d.ts +42 -3
  111. package/dist/quantity-collect.d.ts.map +1 -1
  112. package/dist/quantity-collect.js +114 -7
  113. package/dist/quantity-collect.js.map +1 -1
  114. package/dist/query-backend-maps.d.ts +5 -8
  115. package/dist/query-backend-maps.d.ts.map +1 -1
  116. package/dist/query-backend-maps.js +155 -15
  117. package/dist/query-backend-maps.js.map +1 -1
  118. package/dist/relationship-extractor.d.ts.map +1 -1
  119. package/dist/relationship-extractor.js +18 -0
  120. package/dist/relationship-extractor.js.map +1 -1
  121. package/dist/scan-entities-balanced.d.ts +38 -0
  122. package/dist/scan-entities-balanced.d.ts.map +1 -0
  123. package/dist/scan-entities-balanced.js +258 -0
  124. package/dist/scan-entities-balanced.js.map +1 -0
  125. package/dist/scan-worker-inline.d.ts +17 -11
  126. package/dist/scan-worker-inline.d.ts.map +1 -1
  127. package/dist/scan-worker-inline.js +9 -235
  128. package/dist/scan-worker-inline.js.map +1 -1
  129. package/dist/scan-worker-source.d.ts +9 -0
  130. package/dist/scan-worker-source.d.ts.map +1 -0
  131. package/dist/scan-worker-source.js +383 -0
  132. package/dist/scan-worker-source.js.map +1 -0
  133. package/dist/spatial-hierarchy-builder.js +3 -3
  134. package/dist/spatial-hierarchy-builder.js.map +1 -1
  135. package/dist/step-lexing.d.ts +2 -0
  136. package/dist/step-lexing.d.ts.map +1 -1
  137. package/dist/step-lexing.js +116 -18
  138. package/dist/step-lexing.js.map +1 -1
  139. package/dist/step-trivia.d.ts +60 -0
  140. package/dist/step-trivia.d.ts.map +1 -0
  141. package/dist/step-trivia.js +63 -0
  142. package/dist/step-trivia.js.map +1 -0
  143. package/dist/tokenizer.d.ts +20 -21
  144. package/dist/tokenizer.d.ts.map +1 -1
  145. package/dist/tokenizer.js +164 -203
  146. package/dist/tokenizer.js.map +1 -1
  147. package/dist/unit-extractor.d.ts +43 -1
  148. package/dist/unit-extractor.d.ts.map +1 -1
  149. package/dist/unit-extractor.js +63 -4
  150. package/dist/unit-extractor.js.map +1 -1
  151. package/dist/worker-parser.d.ts +11 -1
  152. package/dist/worker-parser.d.ts.map +1 -1
  153. package/dist/worker-parser.js +16 -2
  154. package/dist/worker-parser.js.map +1 -1
  155. package/package.json +6 -6
@@ -11,6 +11,8 @@
11
11
  */
12
12
  import { QuantityType } from '@ifc-lite/data';
13
13
  import { QUANTITY_TYPE_MAP } from './columnar-parser-indexes.js';
14
+ import { isUnrepresentableNumericValue } from './attribute-helpers.js';
15
+ import { resolveUnitByRef } from './project-units.js';
14
16
  /**
15
17
  * `IfcPhysicalComplexQuantity` groups other quantities instead of carrying a
16
18
  * value of its own (`packages/codegen/schemas/IFC4_ADD2_TC1.exp`, identically
@@ -95,16 +97,60 @@ export function collectQuantitiesFromRefs(store, extractor, refs) {
95
97
  if (!qtyName)
96
98
  continue;
97
99
  const qtyType = QUANTITY_TYPE_MAP[qtyTypeUpper] ?? QuantityType.Count;
100
+ // `IfcPhysicalSimpleQuantity.Unit` is optional, but it overrides the
101
+ // project assignment when present. Preserve its scale on the record so
102
+ // every downstream reader of this shared collection uses the same
103
+ // physical value rather than silently treating (say) 2000 mm as 2000 m.
104
+ const unitRef = qtyAttrs[2];
105
+ const unit = typeof unitRef === 'number'
106
+ ? resolveUnitByRef(extractor, store.entityIndex, unitRef)
107
+ : null;
98
108
  const rawValue = qtyAttrs[SIMPLE_QUANTITY_VALUE_SLOT];
109
+ // A measure the double range cannot hold is dropped with a diagnostic,
110
+ // not reported as `0`. `CollectedQuantity.value` is `number` and is
111
+ // consumed by callers that do arithmetic on it, so there is no
112
+ // in-band way to say "unrepresentable" — and `0` is the worst of the
113
+ // available lies, because a 0 m^3 volume reads as a measurement
114
+ // somebody took. An absent quantity is detectable; a zero one is not.
115
+ //
116
+ // This matches what the sibling path already does:
117
+ // `QuantityExtractor.extractQuantity` returns `null` and warns when
118
+ // slot 3 is not a number. That path and this one walk the same
119
+ // `Quantities` list, so they must agree.
120
+ //
121
+ // The diagnostic is per occurrence, deliberately. Each line names a
122
+ // different entity id and quantity name, so it is the list of what was
123
+ // dropped rather than one message repeated — collapsing it to
124
+ // once-per-file would leave a reader knowing that something was
125
+ // discarded and not which. There is also no per-file context threaded
126
+ // through this function to hang a once-per-file flag on: the only
127
+ // place to keep one is module scope, which outlives a file in the
128
+ // viewer's long-lived worker and would then silence the *next* file's
129
+ // first warning. No `console.warn` in this package is throttled
130
+ // today, so a local cap here would be the one-off. The cost is bounded by how
131
+ // corrupt the file is, and a file with thousands of unrepresentable
132
+ // measures has a louder problem than its console output.
133
+ if (isUnrepresentableNumericValue(rawValue)) {
134
+ console.warn(`[quantity-collect] ${qtyEntity.type} #${qtyEntity.expressId} "${qtyName}" ` +
135
+ `has a value outside the IEEE-754 double range (${String(rawValue)}); ` +
136
+ `dropping the quantity rather than reporting it as 0.`);
137
+ continue;
138
+ }
99
139
  const value = typeof rawValue === 'number' ? rawValue : 0;
100
- quantities.push({ name: qtyName, type: qtyType, value });
140
+ quantities.push({
141
+ name: qtyName,
142
+ type: qtyType,
143
+ value,
144
+ ...(unit ? { explicitUnitSiScale: unit.resolved.siScale } : {}),
145
+ });
101
146
  }
102
147
  return quantities;
103
148
  }
104
149
  /**
105
150
  * `Quantities` slot on `IfcElementQuantity`: GlobalId[0], OwnerHistory[1],
106
151
  * Name[2], Description[3] inherited from `IfcRoot`, then MethodOfMeasurement[4]
107
- * and Quantities[5].
152
+ * and Quantities[5]. GlobalId[0] is the identity of the `IfcElementQuantity`
153
+ * instance itself, not any of its quantities.
108
154
  */
109
155
  const QUANTITIES_SLOT = 5;
110
156
  /**
@@ -120,27 +166,88 @@ const QUANTITIES_SLOT = 5;
120
166
  *
121
167
  * `SET [1:?]` admits no empty set, so a set that walks to zero quantities —
122
168
  * written empty, or filled only with members this reader cannot report, such as
123
- * an unresolvable reference or an `IfcPhysicalComplexQuantity` (#3254) is
124
- * non-conformant data. Reporting it anyway would assert "this element has
169
+ * an unresolvable reference, an `IfcPhysicalComplexQuantity` (#3254), or a
170
+ * measure outside the IEEE-754 double range — is non-conformant data. Reporting it anyway would assert "this element has
125
171
  * quantities" on the strength of a name alone, and the consumers act on exactly
126
172
  * that: `validate` counts the element as quantified in its quantity-completeness
127
173
  * figure, an IDS quantity-set existence check passes, and the viewer's fallback
128
174
  * to the element's TYPE quantities is suppressed by the phantom occurrence set,
129
175
  * hiding the real numbers the type carries. So it is dropped (#3259).
130
176
  *
177
+ * That applies unchanged when every member was dropped for being
178
+ * unrepresentable: the set then vanishes rather than surviving empty. Keeping
179
+ * an empty shell would make exactly the claim #3259 removed — "this element is
180
+ * quantified" — while carrying no number to back it, and it would still
181
+ * suppress the type-quantity fallback. The reason each quantity went is on the
182
+ * console; the reason the set went is that nothing in it survived.
183
+ *
131
184
  * The instance path and the type path both go through here, so the drop cannot
132
185
  * come apart between them again: it used to be inlined at each site, and the
133
186
  * type site dropped while the instance site kept.
134
187
  */
135
- export function readQuantitySet(store, extractor, qsetRef, qsetId) {
188
+ export function readQuantitySet(store, extractor, qsetRef) {
136
189
  const qsetEntity = extractor.extractEntity(qsetRef);
137
190
  if (!qsetEntity)
138
191
  return null;
139
192
  const qsetAttrs = qsetEntity.attributes || [];
140
- const qsetName = typeof qsetAttrs[2] === 'string' ? qsetAttrs[2] : `QuantitySet #${qsetId}`;
193
+ // Left empty rather than a fabricated `QuantitySet #<id>` when the source
194
+ // declared no Name: this is `store.getQuantities()`'s answer, consumed
195
+ // verbatim downstream (MCP tool responses, `bim.quantities()`) as though
196
+ // the model had genuinely declared that name (#3530 census).
197
+ const qsetName = typeof qsetAttrs[2] === 'string' ? qsetAttrs[2] : '';
198
+ const qsetGlobalId = typeof qsetAttrs[0] === 'string' ? qsetAttrs[0] : undefined;
141
199
  const quantities = collectQuantitiesFromRefs(store, extractor, qsetAttrs[QUANTITIES_SLOT]);
142
200
  if (quantities.length === 0)
143
201
  return null;
144
- return { name: qsetName, quantities };
202
+ return { name: qsetName, globalId: qsetGlobalId, quantities };
203
+ }
204
+ /**
205
+ * SI scale factor for a `Qto_` value, preferring its explicit `Unit` and then
206
+ * resolving against the project's declared units.
207
+ *
208
+ * An `IfcQuantityLength`/`Area`/`Volume` is stored in the project's raw
209
+ * author unit exactly like an `IfcPropertySingleValue` of the matching
210
+ * measure type — the value is not pre-converted to SI by the exporter. A
211
+ * consumer that hashes or otherwise compares `CollectedQuantity.value`
212
+ * across two files (or against a base-SI literal) as-is therefore reads a
213
+ * project's choice of length unit as a change in the design itself: the
214
+ * same 2 m wall authored in millimetres carries the raw value `2000`
215
+ * instead of `2`.
216
+ *
217
+ * `1` for `Count`/`Weight`/`Time`/`Number` — this only scales the three
218
+ * quantity types that are themselves `IfcLengthMeasure`-family measures.
219
+ *
220
+ * Area and Volume scale by the SQUARE and CUBE of the length factor (a
221
+ * millimetre-authored 1 m² is stored as `1e6`, not `1e3`) — but only as a
222
+ * FALLBACK: `IFC` lets a project declare an explicit `AREAUNIT`/`VOLUMEUNIT`
223
+ * with no arithmetic relationship to `LENGTHUNIT`, so the file's own
224
+ * declaration is preferred and the length-derived power is used only when
225
+ * the project declares none. An explicit member `Unit` always wins; IFC uses
226
+ * it specifically to let a quantity depart from its containing project's
227
+ * assignment.
228
+ */
229
+ export function quantitySiScale(quantity, units) {
230
+ if (quantity.explicitUnitSiScale !== undefined)
231
+ return quantity.explicitUnitSiScale;
232
+ switch (quantity.type) {
233
+ case QuantityType.Length:
234
+ return units.unitForMeasure('IfcLengthMeasure')?.siScale ?? 1;
235
+ case QuantityType.Area: {
236
+ const explicit = units.resolvedForUnitType('AREAUNIT')?.siScale;
237
+ if (explicit !== undefined)
238
+ return explicit;
239
+ const length = units.unitForMeasure('IfcLengthMeasure')?.siScale ?? 1;
240
+ return length ** 2;
241
+ }
242
+ case QuantityType.Volume: {
243
+ const explicit = units.resolvedForUnitType('VOLUMEUNIT')?.siScale;
244
+ if (explicit !== undefined)
245
+ return explicit;
246
+ const length = units.unitForMeasure('IfcLengthMeasure')?.siScale ?? 1;
247
+ return length ** 3;
248
+ }
249
+ default:
250
+ return 1;
251
+ }
145
252
  }
146
253
  //# sourceMappingURL=quantity-collect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"quantity-collect.js","sourceRoot":"","sources":["../src/quantity-collect.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAmBjE;;;;;;;;;;;;;;;;GAgBG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AAmB,CAAC;IAEpF,QAAQ,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,YAAY,CAAC,MAAM;YACpB,OAAO,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC;QAClE,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;YACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;YAChE,IAAI,QAAQ,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAC;YAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC;YACtE,OAAO,MAAM,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,KAAK,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,KAAK,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;YAClE,IAAI,QAAQ,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAC;YAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC;YACtE,OAAO,MAAM,IAAI,CAAC,CAAC;QACvB,CAAC;QACD;YACI,OAAO,CAAC,CAAC;IACjB,CAAC;AACL,CAAC"}
@@ -14,19 +14,16 @@
14
14
  import { RelationshipType } from '@ifc-lite/data';
15
15
  /**
16
16
  * IFC4 subtype map — parent types to their StandardCase/ElementedCase
17
- * subtypes. In IFC4 many element types have `*StandardCase` subtypes that the
18
- * parser stores under the full type name, so `byType('IfcWall')` has to look
19
- * for `IfcWallStandardCase` as well to answer what the caller meant.
17
+ * subtypes, kept for backward compatibility (`@ifc-lite/cli`'s
18
+ * `validate-subtypes.test.ts` reads this table directly as ground truth) and
19
+ * as a fixed, hand-legible cross-check of the schema-driven expansion below.
20
+ * `expandTypes` no longer walks this table itself — see its doc comment.
20
21
  *
21
22
  * Keys and values are UPPERCASE because `entityIndex.byType` is keyed by the
22
23
  * raw STEP type name (e.g. `IFCWALLSTANDARDCASE`).
23
24
  */
24
25
  export declare const IFC_SUBTYPES: Record<string, string[]>;
25
- /**
26
- * Expand a caller's type list to include the known IFC subtypes, uppercasing
27
- * PascalCase input (`'IfcWall'`) for the `entityIndex` lookup.
28
- */
29
- export declare function expandTypes(types: string[]): string[];
26
+ export declare function expandTypes(types: string[], schemaVersion?: string): string[];
30
27
  /**
31
28
  * Relationship names the SDK's `related(ref, relType, direction)` accepts,
32
29
  * keyed in the PascalCase spelling a caller writes.
@@ -1 +1 @@
1
- {"version":3,"file":"query-backend-maps.d.ts","sourceRoot":"","sources":["../src/query-backend-maps.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAcjD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWrD;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAM/D,CAAC"}
1
+ {"version":3,"file":"query-backend-maps.d.ts","sourceRoot":"","sources":["../src/query-backend-maps.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAgC,MAAM,gBAAgB,CAAC;AAGhF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAcjD,CAAC;AAkHF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ7E;AAiDD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAM/D,CAAC"}
@@ -14,12 +14,14 @@
14
14
  * many, so the tables live here, next to the `entityIndex` whose key shape
15
15
  * they are written against.
16
16
  */
17
- import { RelationshipType } from '@ifc-lite/data';
17
+ import { RelationshipType, expandTypeNamesToDescendants } from '@ifc-lite/data';
18
+ import { getInheritanceChain, isQueryableObjectType } from './ifc-schema.js';
18
19
  /**
19
20
  * IFC4 subtype map — parent types to their StandardCase/ElementedCase
20
- * subtypes. In IFC4 many element types have `*StandardCase` subtypes that the
21
- * parser stores under the full type name, so `byType('IfcWall')` has to look
22
- * for `IfcWallStandardCase` as well to answer what the caller meant.
21
+ * subtypes, kept for backward compatibility (`@ifc-lite/cli`'s
22
+ * `validate-subtypes.test.ts` reads this table directly as ground truth) and
23
+ * as a fixed, hand-legible cross-check of the schema-driven expansion below.
24
+ * `expandTypes` no longer walks this table itself — see its doc comment.
23
25
  *
24
26
  * Keys and values are UPPERCASE because `entityIndex.byType` is keyed by the
25
27
  * raw STEP type name (e.g. `IFCWALLSTANDARDCASE`).
@@ -39,22 +41,160 @@ export const IFC_SUBTYPES = {
39
41
  // with nothing on a model that plainly contained furniture.
40
42
  IFCFURNISHINGELEMENT: ['IFCFURNITURE', 'IFCSYSTEMFURNITUREELEMENT'],
41
43
  };
44
+ // Cached per name: `rootBranchOf` and `isQueryableObjectType` both walk the
45
+ // inheritance chain, and the gate calls one of them once per descendant. On
46
+ // `byType('IfcRoot')` that is 294 uncached walks for one query.
47
+ const rootBranchCache = new Map();
42
48
  /**
43
- * Expand a caller's type list to include the known IFC subtypes, uppercasing
44
- * PascalCase input (`'IfcWall'`) for the `entityIndex` lookup.
49
+ * Bound on both memos below. Their keys are caller-supplied type names and
50
+ * type lists, and `byType()` is reached from the MCP server and the viewer,
51
+ * long-lived processes where those come from an agent or an SDK script — so
52
+ * an unbounded map grows on typos and vendor namespaces for the life of the
53
+ * process. Clearing wholesale costs one recompute and needs no bookkeeping;
54
+ * the bundled schemas declare ~1160 names, so a real workload never reaches
55
+ * it.
45
56
  */
46
- export function expandTypes(types) {
47
- const result = [];
57
+ const CACHE_LIMIT = 4096;
58
+ function rootBranchOf(type) {
59
+ const cached = rootBranchCache.get(type);
60
+ if (cached !== undefined)
61
+ return cached;
62
+ const branch = computeRootBranch(type);
63
+ if (rootBranchCache.size >= CACHE_LIMIT)
64
+ rootBranchCache.clear();
65
+ rootBranchCache.set(type, branch);
66
+ return branch;
67
+ }
68
+ function computeRootBranch(type) {
69
+ const chain = getInheritanceChain(type);
70
+ if (chain.includes('IfcRelationship'))
71
+ return 'relationship';
72
+ if (chain.includes('IfcPropertyDefinition'))
73
+ return 'propertyDefinition';
74
+ if (chain.includes('IfcTypeObject'))
75
+ return 'typeObject';
76
+ if (chain.includes('IfcObjectDefinition'))
77
+ return 'object';
78
+ return 'other';
79
+ }
80
+ /**
81
+ * Expand a caller's type list to every schema-declared descendant (itself
82
+ * plus every type that has it as an ancestor, direct or indirect), so
83
+ * `byType('IfcBuildingElement')` finds the concrete leaves a model actually
84
+ * contains instead of matching nothing — `IfcBuildingElement`/`IfcElement`
85
+ * are abstract EXPRESS supertypes, never a literal STEP entity type, so a
86
+ * caller asking for one always meant its subtypes.
87
+ *
88
+ * Delegates to `@ifc-lite/data`'s `expandTypeNamesToDescendants`, the single
89
+ * schema-authority resolver every `byType()` backend now shares — this used
90
+ * to be a fixed nine-entry `IFC_SUBTYPES` table (still above, unused here)
91
+ * that only aliased `*StandardCase`/`*ElementedCase` pairs and silently
92
+ * dropped every abstract-supertype query.
93
+ *
94
+ * PASS `schemaVersion`. It is the queried model's own `store.schemaVersion`,
95
+ * and it is what makes the answer exact. Descendant sets are not the same
96
+ * across versions -- buildingSMART re-parented entities, so
97
+ * `IfcReinforcingBar` is an `IfcBuildingElement` in IFC2X3 and an
98
+ * `IfcElementComponent` in IFC4 -- while the names a FILE contains need not
99
+ * belong to the version its header claims. The resolver reconciles the two;
100
+ * see its module doc for the exact rule.
101
+ *
102
+ * It is optional only because this function is a published export of
103
+ * `@ifc-lite/parser` and of `@ifc-lite/mcp/browser`, and requiring it would
104
+ * stop an existing `expandTypes(['IfcWall'])` compiling -- a major, which a
105
+ * bug-fix release is not. Omitted, the expansion falls back to the UNION
106
+ * across the three bundled schemas: a superset that finds every spelling but
107
+ * cannot tell a re-parented entity from a real subtype, so
108
+ * `expandTypes(['IfcBuildingElement'])` answers with reinforcing bars that
109
+ * `expandTypes(['IfcBuildingElement'], 'IFC4')` correctly leaves out. Every
110
+ * caller in this repository passes the version; a viewer test goes red if one
111
+ * stops.
112
+ *
113
+ * The expansion does not cross an `IfcRoot` branch. Descending the whole
114
+ * hierarchy from an abstract root turned `byType('IfcRoot')` into "every
115
+ * rooted record in the file" — 223 rows on `infra-bridge.ifc`, 36 of them
116
+ * `IfcRelDefinesByProperties` — which a caller then hands to `storey()` or
117
+ * `group_by`, written against products. `IfcObjectDefinition` swept in every
118
+ * `*Type` the same way, contradicting the untyped branch of the very same
119
+ * backends, which has always answered with {@link isQueryableObjectType}
120
+ * only.
121
+ *
122
+ * The gate reads the requested type's branch rather than "is a product",
123
+ * because `byType('IfcBuildingElementType')` means its subtypes exactly as
124
+ * much as `byType('IfcBuildingElement')` does. The requested names themselves
125
+ * are never gated: a caller who spells out `IfcPropertySet` said what they
126
+ * wanted.
127
+ *
128
+ * Memoized on (schemaVersion, type list). Every `byType()` call goes through
129
+ * here, and `validate` now calls it twice per store; the closure plus the gate
130
+ * cost 0.78 ms for `IfcRoot` on IFC4, which the caches take to a Map lookup.
131
+ * The key keeps the caller's order rather than sorting it: the output order is
132
+ * contractual — each requested type ahead of its own descendants — so two
133
+ * different orders are two different answers and must not share an entry.
134
+ */
135
+ const expandCache = new Map();
136
+ /**
137
+ * Cache-key stand-in for an omitted version. Not a value `resolveSchemaVersion`
138
+ * can ever see, so the union answer cannot share an entry with `''` or any
139
+ * other unrecognized string, which resolve to IFC4 instead.
140
+ */
141
+ const NO_VERSION_KEY = '\u0001union';
142
+ export function expandTypes(types, schemaVersion) {
143
+ const key = `${schemaVersion ?? NO_VERSION_KEY}\u0000${types.join('\u0000')}`;
144
+ const cached = expandCache.get(key);
145
+ if (cached)
146
+ return [...cached];
147
+ const result = computeExpandTypes(types, schemaVersion);
148
+ if (expandCache.size >= CACHE_LIMIT)
149
+ expandCache.clear();
150
+ expandCache.set(key, result);
151
+ return [...result];
152
+ }
153
+ /** The three versions with a bundled table, for the no-version union. */
154
+ const UNION_VERSIONS = ['IFC2X3', 'IFC4', 'IFC4X3'];
155
+ /**
156
+ * One type's expansion when the caller named no schema: the requested type,
157
+ * then every descendant ANY bundled schema gives it, sorted.
158
+ *
159
+ * Deliberately a superset rather than a guess at a version. A caller who has
160
+ * not said which schema the file is written in is better served finding a
161
+ * record that is arguably of the wrong class than silently finding none at
162
+ * all, which is what picking one table for them would do to the other two.
163
+ * The sort keeps the order stable across schema-table regeneration, as the
164
+ * per-version path does.
165
+ */
166
+ function unionExpansion(type) {
167
+ const self = expandTypeNamesToDescendants([type], UNION_VERSIONS[0])[0];
168
+ const rest = new Set();
169
+ for (const version of UNION_VERSIONS) {
170
+ const expanded = expandTypeNamesToDescendants([type], version);
171
+ for (let i = 1; i < expanded.length; i++)
172
+ rest.add(expanded[i]);
173
+ }
174
+ rest.delete(self);
175
+ return [self, ...[...rest].sort()];
176
+ }
177
+ function computeExpandTypes(types, schemaVersion) {
178
+ const out = [];
179
+ const seen = new Set();
48
180
  for (const type of types) {
49
- const upper = type.toUpperCase();
50
- result.push(upper);
51
- const subtypes = IFC_SUBTYPES[upper];
52
- if (subtypes) {
53
- for (const sub of subtypes)
54
- result.push(sub);
181
+ const branch = rootBranchOf(type);
182
+ const expanded = schemaVersion === undefined
183
+ ? unionExpansion(type)
184
+ : expandTypeNamesToDescendants([type], schemaVersion);
185
+ for (let i = 0; i < expanded.length; i++) {
186
+ const name = expanded[i];
187
+ // Index 0 is the requested type itself, which is never gated: a caller
188
+ // who spells out `IfcPropertySet` said what they wanted.
189
+ if (i > 0 && !isQueryableObjectType(name) && rootBranchOf(name) !== branch)
190
+ continue;
191
+ if (seen.has(name))
192
+ continue;
193
+ seen.add(name);
194
+ out.push(name);
55
195
  }
56
196
  }
57
- return result;
197
+ return out;
58
198
  }
59
199
  /**
60
200
  * Relationship names the SDK's `related(ref, relType, direction)` accepts,
@@ -1 +1 @@
1
- {"version":3,"file":"query-backend-maps.js","sourceRoot":"","sources":["../src/query-backend-maps.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAA6B;IACpD,OAAO,EAAE,CAAC,qBAAqB,EAAE,sBAAsB,CAAC;IACxD,OAAO,EAAE,CAAC,qBAAqB,CAAC;IAChC,SAAS,EAAE,CAAC,uBAAuB,CAAC;IACpC,OAAO,EAAE,CAAC,qBAAqB,CAAC;IAChC,SAAS,EAAE,CAAC,uBAAuB,CAAC;IACpC,OAAO,EAAE,CAAC,qBAAqB,EAAE,sBAAsB,CAAC;IACxD,SAAS,EAAE,CAAC,uBAAuB,CAAC;IACpC,QAAQ,EAAE,CAAC,sBAAsB,CAAC;IAClC,iBAAiB,EAAE,CAAC,wBAAwB,CAAC;IAC7C,6EAA6E;IAC7E,0EAA0E;IAC1E,4DAA4D;IAC5D,oBAAoB,EAAE,CAAC,cAAc,EAAE,2BAA2B,CAAC;CACpE,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAe;IACzC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,C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AkB,EAAE,gBAAgB,CAAC,YAAY;CAClD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"relationship-extractor.d.ts","sourceRoot":"","sources":["../src/relationship-extractor.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1D,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAyB;gBAE7B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;IAI5C;;OAEG;IACG,yBAAyB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IA6B1D;;OAEG;IACH,oBAAoB,IAAI,YAAY,EAAE;IAsBtC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAwD3B,OAAO,CAAC,iBAAiB;CAM1B"}
1
+ {"version":3,"file":"relationship-extractor.d.ts","sourceRoot":"","sources":["../src/relationship-extractor.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1D,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAyB;gBAE7B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;IAI5C;;OAEG;IACG,yBAAyB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IA6B1D;;OAEG;IACH,oBAAoB,IAAI,YAAY,EAAE;IAsBtC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyE3B,OAAO,CAAC,iBAAiB;CAM1B"}
@@ -75,6 +75,19 @@ export class RelationshipExtractor {
75
75
  // IfcRelDefinesByProperties: RelatedObjects (4), RelatingPropertyDefinition (5)
76
76
  // IfcRelAggregates: RelatingObject (4), RelatedObjects (5)
77
77
  // IfcRelContainedInSpatialStructure: RelatedElements (4), RelatingStructure (5)
78
+ // IfcRelAssociatesMaterial: RelatedObjects (4, inherited from IfcRelAssociates),
79
+ // RelatingMaterial (5, own attribute) — the list/single-ref slots are
80
+ // swapped relative to IfcRelAggregates. Schema (IFC4_ADD2_TC1.exp):
81
+ // ENTITY IfcRelAssociates SUBTYPE OF (IfcRelationship);
82
+ // RelatedObjects : SET [1:?] OF IfcDefinitionSelect;
83
+ // ENTITY IfcRelAssociatesMaterial SUBTYPE OF (IfcRelAssociates);
84
+ // RelatingMaterial : IfcMaterialSelect;
85
+ // The "standard" RelatingObject-then-RelatedObjects branch below only
86
+ // holds for the IfcRelAggregates shape; applying it here read the
87
+ // RelatedObjects list as the (single) relatingObject and the single
88
+ // RelatingMaterial reference as the relatedObjects list, so every
89
+ // `typeof relatingObject !== 'number'` / `!Array.isArray(relatedObjects)`
90
+ // guard below failed and the association was silently dropped (#3253).
78
91
  let relatingObject;
79
92
  let relatedObjects;
80
93
  if (entityTypeUpper === 'IFCRELDEFINESBYPROPERTIES') {
@@ -87,6 +100,11 @@ export class RelationshipExtractor {
87
100
  relatedObjects = this.getAttributeValue(entity, 4);
88
101
  relatingObject = this.getAttributeValue(entity, 5);
89
102
  }
103
+ else if (entityTypeUpper === 'IFCRELASSOCIATESMATERIAL') {
104
+ // RelatedObjects at 4, RelatingMaterial at 5
105
+ relatedObjects = this.getAttributeValue(entity, 4);
106
+ relatingObject = this.getAttributeValue(entity, 5);
107
+ }
90
108
  else {
91
109
  // Standard: RelatingObject at 4, RelatedObjects at 5
92
110
  relatingObject = this.getAttributeValue(entity, 4);
@@ -1 +1 @@
1
- {"version":3,"file":"relationship-extractor.js","sourceRoot":"","sources":["../src/relationship-extractor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAW/D,MAAM,OAAO,qBAAqB;IACxB,QAAQ,CAAyB;IAEzC,YAAY,QAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,yBAAyB;QAC7B,MAAM,aAAa,GAAmB,EAAE,CAAC;QACzC,MAAM,UAAU,G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,CAAC,CAAC;YACrD,CAAC;YAED,IAAI,cAAc,KAAK,IAAI,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;gBACpG,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,cAAc,EAAE,cAAc;gBAC9B,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;aACpF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,mCAAmC,MAAM,CAAC,SAAS,GAAG,EAAE,KAAK,CAAC,CAAC;YAC5E,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAEO,iBAAiB,CAAC,MAAiB,EAAE,KAAa;QACxD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACnD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF"}
@@ -0,0 +1,38 @@
1
+ export interface ScannedEntityRef {
2
+ expressId: number;
3
+ type: string;
4
+ offset: number;
5
+ length: number;
6
+ line: number;
7
+ }
8
+ /**
9
+ * One balanced-parenthesis scan over one buffer.
10
+ *
11
+ * The cursor and the refusal count are bound to the scan rather than kept on
12
+ * `StepTokenizer`, so a second scan cannot read the first one's leftovers.
13
+ */
14
+ export declare class BalancedEntityScan {
15
+ private readonly buffer;
16
+ private position;
17
+ private lineNumber;
18
+ private oversizedIds;
19
+ private malformed;
20
+ constructor(buffer: Uint8Array);
21
+ /** Records this scan refused for an out-of-contract express id (#3395). */
22
+ get oversizedIdCount(): number;
23
+ /** Mirrors `StepTokenizer.malformedRecordCount`'s contract: 0 or 1, set by
24
+ * the single post-loop check at the end of `run()`. */
25
+ get malformedRecordCount(): number;
26
+ /** Every entity declaration (`#EXPRESS_ID = TYPE(...)`) in the buffer. */
27
+ run(): Generator<ScannedEntityRef>;
28
+ private readExpressId;
29
+ private readTypeName;
30
+ /**
31
+ * Advance past whitespace and comments (see `skipTrivia` in step-lexing).
32
+ * Returns true when the comment it was in never closed, so the caller's
33
+ * single post-loop check can count it instead of reading a false '0' from
34
+ * a scan that actually ran out of buffer mid-header.
35
+ */
36
+ private skipTrivia;
37
+ }
38
+ //# sourceMappingURL=scan-entities-balanced.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-entities-balanced.d.ts","sourceRoot":"","sources":["../src/scan-entities-balanced.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,qBAAa,kBAAkB;IAMjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,SAAS,CAAK;gBAEO,MAAM,EAAE,UAAU;IAE/C,2EAA2E;IAC3E,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;4DACwD;IACxD,IAAI,oBAAoB,IAAI,MAAM,CAEjC;IAED,0EAA0E;IACzE,GAAG,IAAI,SAAS,CAAC,gBAAgB,CAAC;IA0InC,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,YAAY;IA+BpB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;CAMnB"}