@bldrs-ai/conway 1.513.1447 → 1.516.1463

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 (48) hide show
  1. package/compiled/examples/browser-bundled.cjs +206 -7
  2. package/compiled/examples/cli-bundled.cjs +325 -38
  3. package/compiled/examples/cli-step-bundled.cjs +206 -7
  4. package/compiled/examples/validator-bundled.cjs +206 -7
  5. package/compiled/src/compat/web-ifc/coordination_f64.d.ts +20 -0
  6. package/compiled/src/compat/web-ifc/coordination_f64.d.ts.map +1 -1
  7. package/compiled/src/compat/web-ifc/coordination_f64.js +25 -0
  8. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +9 -0
  9. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  10. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +21 -5
  11. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  12. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +138 -25
  13. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts +134 -0
  14. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts.map +1 -0
  15. package/compiled/src/compat/web-ifc/spatial_imposter.js +724 -0
  16. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts +2 -0
  17. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts.map +1 -0
  18. package/compiled/src/compat/web-ifc/spatial_imposter.test.js +292 -0
  19. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts +89 -0
  20. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts.map +1 -0
  21. package/compiled/src/compat/web-ifc/store_preview_channel.js +332 -0
  22. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts +2 -0
  23. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts.map +1 -0
  24. package/compiled/src/compat/web-ifc/store_preview_channel.test.js +81 -0
  25. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +26 -1
  26. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -1
  27. package/compiled/src/compat/web-ifc/streamed_preview_channel.js +3 -5
  28. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +20 -2
  29. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  30. package/compiled/src/ifc/ifc_geometry_extraction.js +137 -33
  31. package/compiled/src/ifc/ifc_stream_open.test.js +63 -0
  32. package/compiled/src/step/parsing/step_parser.d.ts +1 -1
  33. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  34. package/compiled/src/step/parsing/step_parser.js +5 -1
  35. package/compiled/src/step/parsing/streaming_index_builder.d.ts +2 -2
  36. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -1
  37. package/compiled/src/step/step_model_base.d.ts +84 -1
  38. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  39. package/compiled/src/step/step_model_base.js +210 -4
  40. package/compiled/src/version/version.js +1 -1
  41. package/compiled/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +1 -1
  43. package/compiled/src/compat/web-ifc/parse_aabb_imposter.d.ts +0 -41
  44. package/compiled/src/compat/web-ifc/parse_aabb_imposter.d.ts.map +0 -1
  45. package/compiled/src/compat/web-ifc/parse_aabb_imposter.js +0 -161
  46. package/compiled/src/compat/web-ifc/parse_aabb_imposter.test.d.ts +0 -2
  47. package/compiled/src/compat/web-ifc/parse_aabb_imposter.test.d.ts.map +0 -1
  48. package/compiled/src/compat/web-ifc/parse_aabb_imposter.test.js +0 -39
@@ -30,7 +30,7 @@ var import_node_process = require("node:process");
30
30
  var readline = __toESM(require("node:readline"), 1);
31
31
 
32
32
  // compiled/src/version/version.js
33
- var versionString = "Conway v1.513.1447";
33
+ var versionString = "Conway v1.516.1463";
34
34
 
35
35
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
36
36
  var wasmType = "";
@@ -2678,7 +2678,10 @@ var StepParser = class extends StepHeaderParser {
2678
2678
  await next.value;
2679
2679
  continue;
2680
2680
  }
2681
- onProgress?.(next.value);
2681
+ const progressed = onProgress?.(next.value);
2682
+ if (progressed !== void 0 && typeof progressed.then === "function") {
2683
+ await progressed;
2684
+ }
2682
2685
  if (Date.now() - lastYield >= yieldIntervalMs) {
2683
2686
  await yieldToEventLoop();
2684
2687
  lastYield = Date.now();
@@ -5288,7 +5291,7 @@ var InterpolationSearchTable32 = class {
5288
5291
  };
5289
5292
 
5290
5293
  // compiled/src/step/step_model_base.js
5291
- var StepModelBase = class {
5294
+ var StepModelBase = class _StepModelBase {
5292
5295
  /**
5293
5296
  * Construct this step model with its matching schema, a buffer to read from and an element index.
5294
5297
  *
@@ -5642,6 +5645,74 @@ var StepModelBase = class {
5642
5645
  get residentSourceBytes() {
5643
5646
  return this.bufferProvider_.residentBytes;
5644
5647
  }
5648
+ /**
5649
+ * Column type of a record, or `undefined` if the id is unknown / untyped.
5650
+ *
5651
+ * @param localID The record.
5652
+ * @return {number | undefined} The schema type id.
5653
+ */
5654
+ typeIDOf(localID) {
5655
+ if (localID >= this.count_) {
5656
+ return;
5657
+ }
5658
+ const typeID = this.typeID_[localID];
5659
+ return typeID < 0 ? void 0 : typeID;
5660
+ }
5661
+ /**
5662
+ * Absolute source address of a record.
5663
+ *
5664
+ * @param localID The record.
5665
+ * @return {number | undefined} The address.
5666
+ */
5667
+ recordAddress(localID) {
5668
+ return localID < this.count_ ? this.address_[localID] : void 0;
5669
+ }
5670
+ /**
5671
+ * Source length of a record.
5672
+ *
5673
+ * @param localID The record.
5674
+ * @return {number | undefined} The length.
5675
+ */
5676
+ recordLength(localID) {
5677
+ return localID < this.count_ ? this.length_[localID] : void 0;
5678
+ }
5679
+ /**
5680
+ * Pin an arbitrary source span (e.g. a faceset's packed Faces[] run).
5681
+ *
5682
+ * @param address Absolute start.
5683
+ * @param length Length in bytes.
5684
+ */
5685
+ pinAddressRange(address, length) {
5686
+ if (!this.isSourceExternal) {
5687
+ return;
5688
+ }
5689
+ this.bufferProvider_.pinRange?.(address, length);
5690
+ }
5691
+ /**
5692
+ * Drop one {@link pinAddressRange} hold.
5693
+ *
5694
+ * @param address Absolute start.
5695
+ * @param length Length in bytes.
5696
+ */
5697
+ unpinAddressRange(address, length) {
5698
+ if (!this.isSourceExternal) {
5699
+ return;
5700
+ }
5701
+ this.bufferProvider_.unpinRange?.(address, length);
5702
+ }
5703
+ /**
5704
+ * Page an arbitrary source span.
5705
+ *
5706
+ * @param address Absolute start.
5707
+ * @param length Length in bytes.
5708
+ * @return {Promise<void>} Resolves when resident.
5709
+ */
5710
+ async ensureResidentRange(address, length) {
5711
+ if (!this.isSourceExternal) {
5712
+ return;
5713
+ }
5714
+ await this.bufferProvider_.ensureResident(address, length);
5715
+ }
5645
5716
  /**
5646
5717
  * Release the resident source buffer and serve subsequent record
5647
5718
  * reads from fixed-size windows paged in from an external store.
@@ -5729,9 +5800,21 @@ var StepModelBase = class {
5729
5800
  * @param localID Seed record.
5730
5801
  * @param extraLocalIDs Additional seeds (voids, styles, materials).
5731
5802
  * @param seen Optional set to extend (also skips already-pinned IDs).
5803
+ * @param descend If set, records for which this returns false are
5804
+ * still visited (pinned, in `seen`) but their `#refs` are not
5805
+ * followed — e.g. an `IfcPolygonalFaceSet` whose Faces[] payload
5806
+ * is paged as one span afterwards.
5807
+ * @param leafSpans Optional out-array of coalesced pin ranges for
5808
+ * {@link spanLeaf} children — caller must {@link unpinAddressRange}
5809
+ * each.
5810
+ * @param spanLeaf If set, matching children are *not* visited
5811
+ * (absent from `seen`); their bytes are one pin span. Packed
5812
+ * extract reads `IfcIndexedPolygonalFace.CoordIndex` as integers —
5813
+ * following those faces pinned ~78k records per PSB product. If
5814
+ * omitted, `!descend` children use this span path (test helper).
5732
5815
  * @return {Promise<Set<number>>} The local IDs that were visited.
5733
5816
  */
5734
- async ensureResidentClosureByLocalID(localID, extraLocalIDs, seen = /* @__PURE__ */ new Set()) {
5817
+ async ensureResidentClosureByLocalID(localID, extraLocalIDs, seen = /* @__PURE__ */ new Set(), descend, leafSpans, spanLeaf) {
5735
5818
  if (!this.isSourceExternal) {
5736
5819
  return seen;
5737
5820
  }
@@ -5762,13 +5845,34 @@ var StepModelBase = class {
5762
5845
  break;
5763
5846
  }
5764
5847
  await Promise.all(wave.map((id) => this.ensureResidentByLocalID(id)));
5848
+ const waveSpans = [];
5765
5849
  for (const id of wave) {
5850
+ if (descend !== void 0 && !descend(id)) {
5851
+ continue;
5852
+ }
5853
+ const skipped = [];
5766
5854
  for (const expressID of this.scanRecordRefs_(id)) {
5767
5855
  const referenced = this.expressIDMap_.get(expressID);
5768
- if (referenced !== void 0 && !seen.has(referenced)) {
5769
- frontier.push(referenced);
5856
+ if (referenced === void 0 || seen.has(referenced)) {
5857
+ continue;
5770
5858
  }
5859
+ const leaf = spanLeaf !== void 0 ? spanLeaf(referenced) : descend !== void 0 && !descend(referenced);
5860
+ if (leaf) {
5861
+ skipped.push(referenced);
5862
+ continue;
5863
+ }
5864
+ frontier.push(referenced);
5771
5865
  }
5866
+ if (skipped.length > 0) {
5867
+ for (const span of this.spansOf_(skipped)) {
5868
+ this.pinAddressRange(span.address, span.length);
5869
+ waveSpans.push(span);
5870
+ leafSpans?.push(span);
5871
+ }
5872
+ }
5873
+ }
5874
+ if (waveSpans.length > 0) {
5875
+ await Promise.all(waveSpans.map((span) => this.ensureResidentRange(span.address, span.length)));
5772
5876
  }
5773
5877
  }
5774
5878
  return seen;
@@ -5855,6 +5959,99 @@ var StepModelBase = class {
5855
5959
  }
5856
5960
  return this.ensureResidentClosureByLocalID(localID, extraLocalIDs, seen);
5857
5961
  }
5962
+ /**
5963
+ * Source spans covering the records referenced by `expressIDs` from
5964
+ * `fromIndex` onward. A packed Faces[] run is consecutive in parse
5965
+ * order — two express-ID lookups then cover the whole range. Sparse
5966
+ * sets are coalesced into tight runs so intervening file is not
5967
+ * pinned.
5968
+ *
5969
+ * @param expressIDs Referenced express IDs (e.g. a faceset's #refs).
5970
+ * @param fromIndex First index to include (skip Coordinates at [0]).
5971
+ * @return {{address: number, length: number}[]} The spans.
5972
+ */
5973
+ spansOfExpressIDs(expressIDs, fromIndex = 0) {
5974
+ let minExpressID = Infinity;
5975
+ let maxExpressID = 0;
5976
+ let count = 0;
5977
+ for (let i = fromIndex; i < expressIDs.length; ++i) {
5978
+ const expressID = expressIDs[i];
5979
+ if (expressID < minExpressID) {
5980
+ minExpressID = expressID;
5981
+ }
5982
+ if (expressID > maxExpressID) {
5983
+ maxExpressID = expressID;
5984
+ }
5985
+ ++count;
5986
+ }
5987
+ if (count === 0 || !Number.isFinite(minExpressID)) {
5988
+ return [];
5989
+ }
5990
+ const minLocal = this.expressIDMap_.get(minExpressID);
5991
+ const maxLocal = this.expressIDMap_.get(maxExpressID);
5992
+ if (minLocal === void 0 || maxLocal === void 0) {
5993
+ return [];
5994
+ }
5995
+ const lo = Math.min(minLocal, maxLocal);
5996
+ const hi = Math.max(minLocal, maxLocal);
5997
+ if (hi - lo + 1 === count) {
5998
+ const address = this.address_[lo];
5999
+ const end = this.address_[hi] + this.length_[hi];
6000
+ if (end <= address) {
6001
+ return [];
6002
+ }
6003
+ return [{ address, length: end - address }];
6004
+ }
6005
+ const locals = [];
6006
+ for (let i = fromIndex; i < expressIDs.length; ++i) {
6007
+ const localID = this.expressIDMap_.get(expressIDs[i]);
6008
+ if (localID !== void 0) {
6009
+ locals.push(localID);
6010
+ }
6011
+ }
6012
+ return this.spansOf_(locals);
6013
+ }
6014
+ /**
6015
+ * Coalesce `localIDs` into tight source runs. Records more than
6016
+ * {@link LEAF_SPAN_COALESCE_GAP_} apart stay separate so a sparse
6017
+ * Faces[] list does not pin the file between them.
6018
+ *
6019
+ * @param localIDs The records.
6020
+ * @return {{address: number, length: number}[]} The spans.
6021
+ */
6022
+ spansOf_(localIDs) {
6023
+ const items = [];
6024
+ for (const id of localIDs) {
6025
+ if (id >= this.count_) {
6026
+ continue;
6027
+ }
6028
+ items.push({
6029
+ address: this.address_[id],
6030
+ length: this.length_[id]
6031
+ });
6032
+ }
6033
+ items.sort((a2, b) => a2.address - b.address);
6034
+ const spans = [];
6035
+ let run;
6036
+ for (const item of items) {
6037
+ if (run === void 0) {
6038
+ run = { address: item.address, length: item.length };
6039
+ continue;
6040
+ }
6041
+ const runEnd = run.address + run.length;
6042
+ if (item.address <= runEnd + _StepModelBase.LEAF_SPAN_COALESCE_GAP_) {
6043
+ const end = Math.max(runEnd, item.address + item.length);
6044
+ run.length = end - run.address;
6045
+ continue;
6046
+ }
6047
+ spans.push(run);
6048
+ run = { address: item.address, length: item.length };
6049
+ }
6050
+ if (run !== void 0) {
6051
+ spans.push(run);
6052
+ }
6053
+ return spans;
6054
+ }
5858
6055
  /**
5859
6056
  * Express IDs referenced by a resident record (`#<id>` tokens in its
5860
6057
  * text, including multi-mapped class records). The record itself
@@ -6279,6 +6476,8 @@ var StepModelBase = class {
6279
6476
  return this.geometry?.getByLocalID(node.localID);
6280
6477
  }
6281
6478
  };
6479
+ StepModelBase.LEAF_SPAN_COALESCE_GAP_ = 1024;
6480
+ var step_model_base_default = StepModelBase;
6282
6481
 
6283
6482
  // compiled/src/core/entity_field_description.js
6284
6483
  var FieldDescriptionKind;
@@ -71538,7 +71737,7 @@ var IfcMaterialCache = class {
71538
71737
 
71539
71738
  // compiled/src/ifc/ifc_step_model.js
71540
71739
  var indexerInstance = new StepTypeIndexer(EntityTypesIfcCount);
71541
- var IfcStepModel = class extends StepModelBase {
71740
+ var IfcStepModel = class extends step_model_base_default {
71542
71741
  /**
71543
71742
  * Construct this model given a buffer containing the data and the parsed data index on that,
71544
71743
  * adding the typeIndex on top of that.