@bldrs-ai/conway 1.536.1507 → 1.543.1513

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 (49) hide show
  1. package/compiled/examples/browser-bundled.cjs +39 -5
  2. package/compiled/examples/cli-bundled.cjs +197 -22
  3. package/compiled/examples/cli-step-bundled.cjs +39 -5
  4. package/compiled/examples/validator-bundled.cjs +39 -5
  5. package/compiled/src/compat/web-ifc/geometry_shard_coordination.test.d.ts +2 -0
  6. package/compiled/src/compat/web-ifc/geometry_shard_coordination.test.d.ts.map +1 -0
  7. package/compiled/src/compat/web-ifc/geometry_shard_coordination.test.js +236 -0
  8. package/compiled/src/compat/web-ifc/ifc_api.d.ts +26 -0
  9. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  10. package/compiled/src/compat/web-ifc/ifc_api.js +33 -0
  11. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +6 -0
  12. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  13. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.js +264 -1
  14. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +116 -5
  15. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  16. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +256 -85
  17. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts +79 -0
  18. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts.map +1 -1
  19. package/compiled/src/compat/web-ifc/store_preview_channel.js +237 -14
  20. package/compiled/src/compat/web-ifc/store_preview_channel.test.js +270 -1
  21. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +106 -1
  22. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -1
  23. package/compiled/src/compat/web-ifc/streamed_preview_channel.js +269 -17
  24. package/compiled/src/core/progress_log.d.ts +75 -2
  25. package/compiled/src/core/progress_log.d.ts.map +1 -1
  26. package/compiled/src/core/progress_log.js +59 -2
  27. package/compiled/src/core/progress_log.test.js +75 -1
  28. package/compiled/src/ifc/dangling_placement_error.d.ts +35 -0
  29. package/compiled/src/ifc/dangling_placement_error.d.ts.map +1 -0
  30. package/compiled/src/ifc/dangling_placement_error.js +38 -0
  31. package/compiled/src/ifc/geometry_dispatch.d.ts +74 -3
  32. package/compiled/src/ifc/geometry_dispatch.d.ts.map +1 -1
  33. package/compiled/src/ifc/geometry_dispatch.js +261 -5
  34. package/compiled/src/ifc/geometry_dispatch.test.js +147 -1
  35. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +54 -0
  36. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  37. package/compiled/src/ifc/ifc_geometry_extraction.js +153 -20
  38. package/compiled/src/index.d.ts +1 -1
  39. package/compiled/src/index.d.ts.map +1 -1
  40. package/compiled/src/index.js +1 -1
  41. package/compiled/src/step/dangling_reference_error.d.ts +34 -0
  42. package/compiled/src/step/dangling_reference_error.d.ts.map +1 -0
  43. package/compiled/src/step/dangling_reference_error.js +36 -0
  44. package/compiled/src/step/step_entity_base.d.ts +17 -0
  45. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  46. package/compiled/src/step/step_entity_base.js +28 -4
  47. package/compiled/src/version/version.js +1 -1
  48. package/compiled/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +1 -1
@@ -1,6 +1,8 @@
1
1
  import { BlendMode, } from "../../dependencies/conway-geom/index.js";
2
2
  import { Uint32Sink } from "../step/parsing/uint32_sink.js";
3
3
  import { StepBufferNotResidentError } from "../step/step_buffer_provider.js";
4
+ import { DanglingReferenceError } from "../step/dangling_reference_error.js";
5
+ import { DanglingPlacementError } from "./dangling_placement_error.js";
4
6
  import { exponentToRoughness } from "../core/canonical_material.js";
5
7
  import { CanonicalMeshType } from "../core/canonical_mesh.js";
6
8
  import { yieldToEventLoop } from "../core/progress.js";
@@ -192,6 +194,14 @@ export class IfcGeometryExtraction {
192
194
  // Guards prepareExtractionMaps_ so the demand path and the whole-model
193
195
  // walk can both trigger it without duplicating work.
194
196
  this.extractionMapsPrepared_ = false;
197
+ /* Whether the cached set came from the PAGED walk. A windowed source can
198
+ * cache an incomplete set from the sync walk (that is the defect
199
+ * ensureAggregateTargetLocalIDs fixes), and the cache is for the model's
200
+ * life — so the paged walk recomputes over a sync-built set rather than
201
+ * trusting whichever caller happened to arrive first. Ordering that
202
+ * decides correctness and is invisible when it breaks is not worth
203
+ * relying on. */
204
+ this.aggregateTargetsPaged_ = false;
195
205
  this.csgMemoization = !this.lowMemoryMode;
196
206
  this.quietRecoverableLogging = false;
197
207
  this.materials = model.materials;
@@ -4073,6 +4083,12 @@ export class IfcGeometryExtraction {
4073
4083
  * IFCLOCALPLACEMENT ancestors and their axis/point records included,
4074
4084
  * since `extractPlacement` resolves them through the same layer.
4075
4085
  *
4086
+ * Only an unresolved reference (`DanglingReferenceError`) is tagged as
4087
+ * a deferral. A placement that is malformed rather than unscanned still
4088
+ * throws, and still stops the product being extracted, but propagates
4089
+ * untagged so the preview does not queue it for a retry that can never
4090
+ * come good — see the catch below.
4091
+ *
4076
4092
  * The throw intentionally propagates: the demand seam
4077
4093
  * (`extractProductGeometryByLocalID` callers, the preview adapter's
4078
4094
  * per-unit catch) already treats a throwing product as
@@ -4095,6 +4111,27 @@ export class IfcGeometryExtraction {
4095
4111
  this.extractPlacement(objectPlacement);
4096
4112
  }
4097
4113
  }
4114
+ catch (error) {
4115
+ // Tagged, not swallowed. The throw still propagates and callers still
4116
+ // treat it as not-yet-extractable — but a preview tick that catches it
4117
+ // can now say WHY a product deferred. Without that, a model whose
4118
+ // preview stays blank is indistinguishable from one deferring for some
4119
+ // other reason, and the fix for those is not the same (conway#542).
4120
+ //
4121
+ // Only an UNRESOLVED reference earns the tag. Everything else this
4122
+ // chain can throw — a placement record of the wrong entity type, a
4123
+ // select that does not hold an IfcAxis2Placement, a malformed axis
4124
+ // literal — is a property of the file, not of how much of it has been
4125
+ // scanned, so a longer prefix cannot change the answer. Tagging those
4126
+ // put them in the preview's retry queue permanently, and a non-empty
4127
+ // retry queue is also what triggers early generation PREEMPTION, so a
4128
+ // single broken placement could keep buying rebuilds that could never
4129
+ // satisfy it (codex round 1 on #543).
4130
+ if (error instanceof DanglingReferenceError) {
4131
+ throw new DanglingPlacementError(product.localID, error);
4132
+ }
4133
+ throw error;
4134
+ }
4098
4135
  finally {
4099
4136
  model.nullOnErrors = priorNullOnErrors;
4100
4137
  }
@@ -4939,33 +4976,123 @@ export class IfcGeometryExtraction {
4939
4976
  const targets = new Set();
4940
4977
  const productTypes = new Set(IfcProduct.query);
4941
4978
  for (const relAggregate of this.model.types(IfcRelAggregates)) {
4979
+ this.addAggregateTargets_(relAggregate, targets, productTypes);
4980
+ }
4981
+ this.aggregateTargetLocalIDs_ = targets;
4982
+ return targets;
4983
+ }
4984
+ /**
4985
+ * Windowed twin of {@link aggregateTargetLocalIDs}: page each
4986
+ * relationship record before scanning it, so the set is COMPLETE rather
4987
+ * than whatever this instance's LRU happened to still hold.
4988
+ *
4989
+ * **This is a correctness fix, not a prefetch.** The sync walk reads each
4990
+ * `IfcRelAggregates` record's bytes, and on a windowed source those pages
4991
+ * are routinely gone by the first pump — the parse walked past them
4992
+ * hundreds of megabytes ago. The per-record catch then swallows the
4993
+ * non-resident read, the incomplete set is **cached for the model's
4994
+ * life**, and every child it failed to record stays in the per-product
4995
+ * worklist *as well as* in the aggregates pass. That product is then
4996
+ * emitted twice: once with the uncut/placeholder content the deferral
4997
+ * exists to suppress, and again from the aggregates pass. Measured on
4998
+ * `aggregate_master_voids.ifc` behind 512-byte windows: 0 targets against
4999
+ * a resident open's 1, and 3 demand products against 2.
5000
+ *
5001
+ * Paged in bounded waves, and the scan happens INSIDE each wave rather
5002
+ * than after all of them: a model with many assemblies would otherwise
5003
+ * need every relationship record resident at once, which is the residency
5004
+ * ceiling this is supposed to respect.
5005
+ *
5006
+ * A non-resident read still throws from here — after this has paged the
5007
+ * record, that is a defect in the paging, not a property of the file.
5008
+ *
5009
+ * @param waveSize Relationship records paged and scanned at once.
5010
+ * @return {Promise<Set<number>>} The same set the sync twin caches.
5011
+ */
5012
+ async ensureAggregateTargetLocalIDs(waveSize = IfcGeometryExtraction.AGGREGATE_TARGET_WAVE_SIZE_) {
5013
+ if (!this.model.isSourceExternal) {
5014
+ return this.aggregateTargetLocalIDs();
5015
+ }
5016
+ if (this.aggregateTargetsPaged_) {
5017
+ return this.aggregateTargetLocalIDs_;
5018
+ }
5019
+ const targets = new Set();
5020
+ const productTypes = new Set(IfcProduct.query);
5021
+ const wave = Math.max(1, Math.floor(waveSize));
5022
+ let pending = [];
5023
+ const drain = async () => {
5024
+ const pinned = new Set();
4942
5025
  try {
4943
- // RelatedObjects as express IDs — do not hydrate every child
4944
- // product (that paged most of the file during demand prep).
4945
- relAggregate.forEachReferenceInField(REL_AGGREGATES_RELATED_OFFSET, REL_AGGREGATES_RELATED_BASE, REL_AGGREGATES_RELATED_DEPTH, (expressID) => {
4946
- if (expressID === void 0) {
4947
- return true;
4948
- }
4949
- const relatedLocalID = this.model.resolveExpressID(expressID);
4950
- if (relatedLocalID === void 0) {
4951
- return true;
4952
- }
4953
- const typeID = this.model.typeIDOf(relatedLocalID);
4954
- if (typeID !== void 0 && productTypes.has(typeID)) {
4955
- targets.add(relatedLocalID);
4956
- }
4957
- return true;
4958
- });
5026
+ for (const relAggregate of pending) {
5027
+ pinned.add(relAggregate.localID);
5028
+ this.model.pinByLocalID(relAggregate.localID);
5029
+ }
5030
+ await Promise.all([...pinned].map((localID) => this.model.ensureResidentByLocalID(localID)));
5031
+ for (const relAggregate of pending) {
5032
+ this.addAggregateTargets_(relAggregate, targets, productTypes, true);
5033
+ }
4959
5034
  }
4960
- catch {
4961
- // Malformed relationship rows are tolerated exactly like the
4962
- // aggregates pass itself tolerates them (permissive catch) —
4963
- // their targets simply stay in the first-pass walk.
5035
+ finally {
5036
+ this.model.releaseSourceViews(pinned);
5037
+ this.model.unpinLocalIDs(pinned);
5038
+ pending = [];
4964
5039
  }
5040
+ };
5041
+ for (const relAggregate of this.model.types(IfcRelAggregates)) {
5042
+ pending.push(relAggregate);
5043
+ if (pending.length >= wave) {
5044
+ await drain();
5045
+ }
5046
+ }
5047
+ if (pending.length > 0) {
5048
+ await drain();
4965
5049
  }
4966
5050
  this.aggregateTargetLocalIDs_ = targets;
5051
+ this.aggregateTargetsPaged_ = true;
4967
5052
  return targets;
4968
5053
  }
5054
+ /**
5055
+ * Record one relationship's product children.
5056
+ *
5057
+ * Shared by the sync and paged walks so there is a single definition of
5058
+ * what an aggregate target is. Reads only this relationship's own record:
5059
+ * children resolve through the express map and the typeID column, so the
5060
+ * scan never hydrates a child product (doing so paged most of the file
5061
+ * during demand prep).
5062
+ *
5063
+ * @param relAggregate The relationship to scan.
5064
+ * @param targets Accumulator.
5065
+ * @param productTypes The IfcProduct type set.
5066
+ * @param strictResidency When set, a non-resident read propagates instead
5067
+ * of being tolerated — for the paged walk, which has already made the
5068
+ * record resident and so can only reach that error through a defect.
5069
+ */
5070
+ addAggregateTargets_(relAggregate, targets, productTypes, strictResidency = false) {
5071
+ try {
5072
+ relAggregate.forEachReferenceInField(REL_AGGREGATES_RELATED_OFFSET, REL_AGGREGATES_RELATED_BASE, REL_AGGREGATES_RELATED_DEPTH, (expressID) => {
5073
+ if (expressID === void 0) {
5074
+ return true;
5075
+ }
5076
+ const relatedLocalID = this.model.resolveExpressID(expressID);
5077
+ if (relatedLocalID === void 0) {
5078
+ return true;
5079
+ }
5080
+ const typeID = this.model.typeIDOf(relatedLocalID);
5081
+ if (typeID !== void 0 && productTypes.has(typeID)) {
5082
+ targets.add(relatedLocalID);
5083
+ }
5084
+ return true;
5085
+ });
5086
+ }
5087
+ catch (error) {
5088
+ if (strictResidency && error instanceof StepBufferNotResidentError) {
5089
+ throw error;
5090
+ }
5091
+ // Malformed relationship rows are tolerated exactly like the
5092
+ // aggregates pass itself tolerates them (permissive catch) —
5093
+ // their targets simply stay in the first-pass walk.
5094
+ }
5095
+ }
4969
5096
  /**
4970
5097
  * One-time extraction setup shared by the whole-model walk and the
4971
5098
  * per-product demand path (Phase B2): linear scaling factor and the
@@ -5717,3 +5844,9 @@ export class IfcGeometryExtraction {
5717
5844
  }
5718
5845
  }
5719
5846
  }
5847
+ /* Relationship records paged and scanned at once by
5848
+ * ensureAggregateTargetLocalIDs. Each is a single small row, and the scan
5849
+ * runs inside the wave, so this bounds what has to be resident
5850
+ * simultaneously rather than what is read in total. */
5851
+ // eslint-disable-next-line no-magic-numbers
5852
+ IfcGeometryExtraction.AGGREGATE_TARGET_WAVE_SIZE_ = 512;
@@ -30,6 +30,6 @@ export { GeometryTilePoolBindings, TileAssetExtractor, WasmTileBackend, createWa
30
30
  export { IfcTileAssetExtractor, TileCommitBindings } from "./ifc/ifc_tile_extractor.js";
31
31
  export { ChunkedPool, ChunkSpan } from "./core/mem/chunked_pool.js";
32
32
  export { SharedAssetPool } from "./core/mem/shared_asset_pool.js";
33
- export { geometryDispatchKey, shardOfDispatchKey } from "./ifc/geometry_dispatch.js";
33
+ export { computeDispatchKeys, computeRelatingLocalIDs, geometryDispatchKey, relatingLocalIDOf, shardOfDispatchKey, } from "./ifc/geometry_dispatch.js";
34
34
  export { GeometryTilePool, InstanceAssetSource, GeometryAsset } from "./core/geometry_tile_pool.js";
35
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,eAAe,GAChB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,aAAa,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core/geometry
36
36
  export { IfcTileAssetExtractor } from "./ifc/ifc_tile_extractor.js";
37
37
  export { ChunkedPool } from "./core/mem/chunked_pool.js";
38
38
  export { SharedAssetPool } from "./core/mem/shared_asset_pool.js";
39
- export { geometryDispatchKey, shardOfDispatchKey } from "./ifc/geometry_dispatch.js";
39
+ export { computeDispatchKeys, computeRelatingLocalIDs, geometryDispatchKey, relatingLocalIDOf, shardOfDispatchKey, } from "./ifc/geometry_dispatch.js";
40
40
  export { GeometryTilePool } from "./core/geometry_tile_pool.js";
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A reference field whose target express ID is not in the model's index.
3
+ *
4
+ * The step layer answers "this reference did not resolve" for two causes
5
+ * that look identical at the throw site but are opposites for a caller
6
+ * working a mid-parse PREFIX:
7
+ *
8
+ * - the referenced record is **absent from the index** — on a prefix that
9
+ * usually means "not scanned yet", so a longer prefix may resolve it;
10
+ * - the referenced record **is** indexed but is the wrong entity type, or
11
+ * the field holds something that is not a reference at all — no amount
12
+ * of extra index changes that answer.
13
+ *
14
+ * Only the first is worth deferring and retrying. Both used to throw the
15
+ * same bare `Error( 'Value in STEP was incorrectly typed' )`, so
16
+ * `IfcGeometryExtraction.extractPlacementStrict_` tagged both as
17
+ * {@link DanglingPlacementError} and the preview channels re-queued a
18
+ * permanently broken placement on every generation — and, worse, its
19
+ * presence in `deferredForRetry_` is what triggers early generation
20
+ * PREEMPTION, so one malformed placement could keep paying for rebuilds
21
+ * that could never satisfy it (conway#542, codex round 1 on #543).
22
+ *
23
+ * Deliberately thrown only from the reference-resolution failure paths in
24
+ * `StepEntityBase`; it carries no fallback meaning, so a caller that does
25
+ * not care can keep treating it as the `Error` it extends.
26
+ */
27
+ export declare class DanglingReferenceError extends Error {
28
+ readonly expressID: number;
29
+ /**
30
+ * @param expressID The referenced record that is not in the index.
31
+ */
32
+ constructor(expressID: number);
33
+ }
34
+ //# sourceMappingURL=dangling_reference_error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dangling_reference_error.d.ts","sourceRoot":"","sources":["../../../src/step/dangling_reference_error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aAIlB,SAAS,EAAE,MAAM;IAH9C;;OAEG;gBAC0B,SAAS,EAAE,MAAM;CAM/C"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A reference field whose target express ID is not in the model's index.
3
+ *
4
+ * The step layer answers "this reference did not resolve" for two causes
5
+ * that look identical at the throw site but are opposites for a caller
6
+ * working a mid-parse PREFIX:
7
+ *
8
+ * - the referenced record is **absent from the index** — on a prefix that
9
+ * usually means "not scanned yet", so a longer prefix may resolve it;
10
+ * - the referenced record **is** indexed but is the wrong entity type, or
11
+ * the field holds something that is not a reference at all — no amount
12
+ * of extra index changes that answer.
13
+ *
14
+ * Only the first is worth deferring and retrying. Both used to throw the
15
+ * same bare `Error( 'Value in STEP was incorrectly typed' )`, so
16
+ * `IfcGeometryExtraction.extractPlacementStrict_` tagged both as
17
+ * {@link DanglingPlacementError} and the preview channels re-queued a
18
+ * permanently broken placement on every generation — and, worse, its
19
+ * presence in `deferredForRetry_` is what triggers early generation
20
+ * PREEMPTION, so one malformed placement could keep paying for rebuilds
21
+ * that could never satisfy it (conway#542, codex round 1 on #543).
22
+ *
23
+ * Deliberately thrown only from the reference-resolution failure paths in
24
+ * `StepEntityBase`; it carries no fallback meaning, so a caller that does
25
+ * not care can keep treating it as the `Error` it extends.
26
+ */
27
+ export class DanglingReferenceError extends Error {
28
+ /**
29
+ * @param expressID The referenced record that is not in the index.
30
+ */
31
+ constructor(expressID) {
32
+ super(`Reference to #${expressID} is not in the index`);
33
+ this.expressID = expressID;
34
+ this.name = 'DanglingReferenceError';
35
+ }
36
+ }
@@ -141,6 +141,23 @@ export default abstract class StepEntityBase<EntityTypeIDs extends number> imple
141
141
  * an absent optional.
142
142
  */
143
143
  extractLogical(offset: number, baseOffset: number, depth: number, optional: boolean): boolean | null;
144
+ /**
145
+ * Classify a reference field that failed to resolve.
146
+ *
147
+ * `getElementByExpressID` / `getTypedElementByExpressID` answer
148
+ * `undefined` for two opposite causes: the record is not in the index at
149
+ * all, or it is indexed but is the wrong entity type. A mid-parse prefix
150
+ * reader must tell them apart — the first may resolve once more of the
151
+ * file is scanned, the second never will — so the absent case gets its
152
+ * own error type (see {@link DanglingReferenceError}). Called only on a
153
+ * throwing path, so the extra index lookup costs nothing in the common
154
+ * case.
155
+ *
156
+ * @param expressID The reference's target, or undefined when the field
157
+ * did not hold a reference at all (an unresolved inline element).
158
+ * @return {Error} The error to throw.
159
+ */
160
+ private unresolvedReferenceError_;
144
161
  /**
145
162
  * Extract a reference from an offset, without type check.
146
163
  *
@@ -1 +1 @@
1
- {"version":3,"file":"step_entity_base.d.ts","sourceRoot":"","sources":["../../../src/step/step_entity_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uDAAuD,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAgBjD,OAAO,EAAE,UAAU,EAAyB,MAAM,uBAAuB,CAAA;AAEzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,2BAC+B,MAAM,kCAAkC,CAAA;AAC9E,OAAO,aAAa,MAAM,mBAAmB,CAAA;AAG7C,aAAK,YAAY;IACf,OAAO,IAAI;IACX,MAAM,IAAA;IACN,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,GAAG,IAAA;IACH,KAAK,IAAA;IACL,SAAS,IAAA;IACT,OAAO,IAAA;IACP,QAAQ,IAAA;CACT;AAmDD;;GAEG;AAC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,EAAE,KAAK,GAAG,OAAO;IAwC3B;;;;;OAKG;IACH,SAAS,KAAK,MAAM,IAAI,UAAU,CAKjC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,qBAAqB,CAC7B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;IAqB9C;;;;;;;OAOG;IACH,SAAS,CAAC,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAI,MAAM;IActF;;;;;;OAMG;IACH,SAAS,CAAC,YAAY,CACpB,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,QAAQ,CAAE,2BAA2B,CAAE,aAAa,CAAE,CAAE,GAAI,MAAM;IAkBvF;;;;;;;OAOG;gBAKe,OAAO,EAAE,MAAM,EACd,kBAAkB,EAAE,2BAA2B,CAAC,aAAa,CAAC,EAC/D,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,EAEnD,eAAe,CAAC,EAAE,2BAA2B,CAAC,aAAa,CAAC,EAAE;IAEhE,SAAS,CAAC,eAAe,CAAC,EAAE,2BAA2B,CAAC,aAAa,CAAC,EAAE,CAAA;IAExE;;;;;OAKG;IACH,SAAS,CAAC,eAAe,CAAE,KAAK,EAAE,MAAM,GACtC,QAAQ,CAAE,2BAA2B,CAAC,aAAa,CAAC,CAAE;IAgDxD;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,IAAI;CAKlC"}
@@ -2,6 +2,7 @@ import { wasmHeapView } from "../core/wasm_heap.js";
2
2
  import { skipValue, stepExtractArray, stepExtractArrayBegin, stepExtractArrayToken, stepExtractBinary, stepExtractBoolean, stepExtractInlineElemement, stepExtractLogical, stepExtractNumber, stepExtractOptional, stepExtractReference, stepExtractString, } from "./parsing/step_deserialization_functions.js";
3
3
  import { extractIntegerArrayAt } from "./parsing/uint32_sink.js";
4
4
  import { stepBufferBase } from "./step_buffer_provider.js";
5
+ import { DanglingReferenceError } from "./dangling_reference_error.js";
5
6
  var IfcTokenType;
6
7
  (function (IfcTokenType) {
7
8
  IfcTokenType[IfcTokenType["UNKNOWN"] = 0] = "UNKNOWN";
@@ -221,6 +222,29 @@ export default class StepEntityBase {
221
222
  }
222
223
  return value;
223
224
  }
225
+ /**
226
+ * Classify a reference field that failed to resolve.
227
+ *
228
+ * `getElementByExpressID` / `getTypedElementByExpressID` answer
229
+ * `undefined` for two opposite causes: the record is not in the index at
230
+ * all, or it is indexed but is the wrong entity type. A mid-parse prefix
231
+ * reader must tell them apart — the first may resolve once more of the
232
+ * file is scanned, the second never will — so the absent case gets its
233
+ * own error type (see {@link DanglingReferenceError}). Called only on a
234
+ * throwing path, so the extra index lookup costs nothing in the common
235
+ * case.
236
+ *
237
+ * @param expressID The reference's target, or undefined when the field
238
+ * did not hold a reference at all (an unresolved inline element).
239
+ * @return {Error} The error to throw.
240
+ */
241
+ unresolvedReferenceError_(expressID) {
242
+ if (expressID !== void 0 &&
243
+ this.model.resolveExpressID(expressID) === void 0) {
244
+ return new DanglingReferenceError(expressID);
245
+ }
246
+ return new Error("Value in STEP was incorrectly typed");
247
+ }
224
248
  extractReference(offset, baseOffset, depth, optional) {
225
249
  // Use the tuple form so the buffer is the SAME view the cursor was
226
250
  // recorded against — with a windowed provider, `this.buffer` and a
@@ -231,10 +255,10 @@ export default class StepEntityBase {
231
255
  (this.model.getInlineElementByAddress(extractInlineElementAddress(buffer, cursor, endCursor)));
232
256
  if (value === void 0) {
233
257
  if (!optional) {
234
- throw new Error("Value in STEP was incorrectly typed");
258
+ throw this.unresolvedReferenceError_(expressID);
235
259
  }
236
260
  if (!this.model.nullOnErrors && stepExtractOptional(buffer, cursor, endCursor) !== null) {
237
- throw new Error("Value in STEP was incorrectly typed");
261
+ throw this.unresolvedReferenceError_(expressID);
238
262
  }
239
263
  return null;
240
264
  }
@@ -417,10 +441,10 @@ export default class StepEntityBase {
417
441
  model.getTypedInlineElementByAddress(extractInlineElementAddress(buffer, cursor, endCursor), entityConstructor);
418
442
  if (value === void 0) {
419
443
  if (!optional) {
420
- throw new Error("Value in STEP was incorrectly typed");
444
+ throw this.unresolvedReferenceError_(expressID);
421
445
  }
422
446
  if (!model.nullOnErrors && stepExtractOptional(buffer, cursor, endCursor) !== null) {
423
- throw new Error("Value in STEP was incorrectly typed");
447
+ throw this.unresolvedReferenceError_(expressID);
424
448
  }
425
449
  return null;
426
450
  }
@@ -5,5 +5,5 @@
5
5
  // only the first segment (major) is meaningful and is the one CI carries forward.
6
6
  // Must stay in `vN.N.N` shape: the CI stamp regex, scripts/updateVersion.mjs, and
7
7
  // statistics.ts all match `v\d+\.\d+\.\d+`.
8
- const versionString = 'Conway v1.536.1507';
8
+ const versionString = 'Conway v1.543.1513';
9
9
  export { versionString };