@bldrs-ai/conway 1.389.1221 → 1.394.1504

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 (382) hide show
  1. package/README.md +36 -22
  2. package/compiled/Dist/ConwayGeomWasmNode.js +0 -0
  3. package/compiled/Dist/ConwayGeomWasmNodeMT.js +0 -0
  4. package/compiled/Dist/ConwayGeomWasmWeb.js +0 -0
  5. package/compiled/Dist/ConwayGeomWasmWebMT.js +1 -1
  6. package/compiled/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  7. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNode.js +0 -0
  8. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNodeMT.js +0 -0
  9. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWeb.js +0 -0
  10. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.js +1 -1
  11. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  12. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts +19 -0
  13. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts.map +1 -1
  14. package/compiled/dependencies/conway-geom/interface/conway_geometry.js +17 -0
  15. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts +6 -0
  16. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts.map +1 -1
  17. package/compiled/examples/browser-bundled.cjs +1569 -51
  18. package/compiled/examples/cli-bundled.cjs +2790 -436
  19. package/compiled/examples/cli-step-bundled.cjs +1904 -229
  20. package/compiled/examples/validator-bundled.cjs +1569 -51
  21. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts +2 -2
  22. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts.map +1 -1
  23. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.js +2 -2
  24. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts +3 -3
  25. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts.map +1 -1
  26. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.js +3 -3
  27. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts +1 -1
  28. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts.map +1 -1
  29. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.js +1 -1
  30. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts +1 -1
  31. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts.map +1 -1
  32. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.js +1 -1
  33. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts +1 -1
  34. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts.map +1 -1
  35. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.js +1 -1
  36. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts +1 -1
  37. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts.map +1 -1
  38. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.js +1 -1
  39. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.d.ts.map +1 -1
  40. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.js +2 -2
  41. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/schema_ap214.gen.js +11 -11
  42. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts +1 -1
  43. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts.map +1 -1
  44. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.js +1 -1
  45. package/compiled/src/AP214E3_2010/ap214_command_line_main.js +7 -3
  46. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +181 -7
  47. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
  48. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +906 -137
  49. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.test.js +10 -2
  50. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts +2 -0
  51. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts.map +1 -0
  52. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.js +114 -0
  53. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts +6 -0
  54. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts.map +1 -1
  55. package/compiled/src/AP214E3_2010/ap214_model_geometry.js +9 -0
  56. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts +2 -0
  57. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts.map +1 -0
  58. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.js +233 -0
  59. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts +2 -0
  60. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts.map +1 -0
  61. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.js +147 -0
  62. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts +2 -1
  63. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts.map +1 -1
  64. package/compiled/src/AP214E3_2010/ap214_step_model.js +1 -1
  65. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts +2 -0
  66. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts.map +1 -0
  67. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.js +65 -0
  68. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts +2 -0
  69. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts.map +1 -0
  70. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.js +111 -0
  71. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts +2 -0
  72. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts.map +1 -0
  73. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.js +190 -0
  74. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts +2 -0
  75. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts.map +1 -0
  76. package/compiled/src/compat/web-ifc/coordination_export_order.test.js +110 -0
  77. package/compiled/src/compat/web-ifc/coordination_f64.d.ts +165 -0
  78. package/compiled/src/compat/web-ifc/coordination_f64.d.ts.map +1 -0
  79. package/compiled/src/compat/web-ifc/coordination_f64.js +286 -0
  80. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts +2 -0
  81. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts.map +1 -0
  82. package/compiled/src/compat/web-ifc/coordination_f64.test.js +225 -0
  83. package/compiled/src/compat/web-ifc/ifc_api.d.ts +154 -0
  84. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  85. package/compiled/src/compat/web-ifc/ifc_api.js +211 -3
  86. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts +2 -0
  87. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts.map +1 -0
  88. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.js +288 -0
  89. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +39 -0
  90. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  91. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts +30 -0
  92. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts.map +1 -1
  93. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.js +83 -0
  94. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts +2 -0
  95. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts.map +1 -0
  96. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.js +383 -0
  97. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts +2 -0
  98. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts.map +1 -0
  99. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.js +124 -0
  100. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts +132 -0
  101. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
  102. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +488 -92
  103. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +268 -0
  104. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  105. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +996 -149
  106. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts +2 -0
  107. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts.map +1 -0
  108. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.js +129 -0
  109. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts +134 -0
  110. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts.map +1 -0
  111. package/compiled/src/compat/web-ifc/spatial_imposter.js +933 -0
  112. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts +2 -0
  113. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts.map +1 -0
  114. package/compiled/src/compat/web-ifc/spatial_imposter.test.js +467 -0
  115. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts +187 -0
  116. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts.map +1 -0
  117. package/compiled/src/compat/web-ifc/store_preview_channel.js +524 -0
  118. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts +2 -0
  119. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts.map +1 -0
  120. package/compiled/src/compat/web-ifc/store_preview_channel.test.js +234 -0
  121. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +306 -0
  122. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -0
  123. package/compiled/src/compat/web-ifc/streamed_preview_channel.js +580 -0
  124. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts +2 -0
  125. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts.map +1 -0
  126. package/compiled/src/compat/web-ifc/web_wasm_directory.test.js +22 -0
  127. package/compiled/src/core/composed_model_skeleton.d.ts +63 -0
  128. package/compiled/src/core/composed_model_skeleton.d.ts.map +1 -0
  129. package/compiled/src/core/composed_model_skeleton.js +66 -0
  130. package/compiled/src/core/composed_model_skeleton.test.d.ts +2 -0
  131. package/compiled/src/core/composed_model_skeleton.test.d.ts.map +1 -0
  132. package/compiled/src/core/composed_model_skeleton.test.js +69 -0
  133. package/compiled/src/core/demand_geometry_queue.d.ts +147 -0
  134. package/compiled/src/core/demand_geometry_queue.d.ts.map +1 -0
  135. package/compiled/src/core/demand_geometry_queue.js +223 -0
  136. package/compiled/src/core/demand_geometry_queue.test.d.ts +2 -0
  137. package/compiled/src/core/demand_geometry_queue.test.d.ts.map +1 -0
  138. package/compiled/src/core/demand_geometry_queue.test.js +133 -0
  139. package/compiled/src/core/demand_residency_pump.d.ts +93 -0
  140. package/compiled/src/core/demand_residency_pump.d.ts.map +1 -0
  141. package/compiled/src/core/demand_residency_pump.js +120 -0
  142. package/compiled/src/core/demand_residency_pump.test.d.ts +2 -0
  143. package/compiled/src/core/demand_residency_pump.test.d.ts.map +1 -0
  144. package/compiled/src/core/demand_residency_pump.test.js +148 -0
  145. package/compiled/src/core/geometry_tile_bindings.d.ts +110 -0
  146. package/compiled/src/core/geometry_tile_bindings.d.ts.map +1 -0
  147. package/compiled/src/core/geometry_tile_bindings.js +76 -0
  148. package/compiled/src/core/geometry_tile_bindings.test.d.ts +2 -0
  149. package/compiled/src/core/geometry_tile_bindings.test.d.ts.map +1 -0
  150. package/compiled/src/core/geometry_tile_bindings.test.js +211 -0
  151. package/compiled/src/core/geometry_tile_pool.d.ts +99 -0
  152. package/compiled/src/core/geometry_tile_pool.d.ts.map +1 -0
  153. package/compiled/src/core/geometry_tile_pool.js +104 -0
  154. package/compiled/src/core/geometry_tile_pool.test.d.ts +2 -0
  155. package/compiled/src/core/geometry_tile_pool.test.d.ts.map +1 -0
  156. package/compiled/src/core/geometry_tile_pool.test.js +180 -0
  157. package/compiled/src/core/mem/chunked_pool.d.ts +116 -0
  158. package/compiled/src/core/mem/chunked_pool.d.ts.map +1 -0
  159. package/compiled/src/core/mem/chunked_pool.js +149 -0
  160. package/compiled/src/core/mem/chunked_pool.test.d.ts +2 -0
  161. package/compiled/src/core/mem/chunked_pool.test.d.ts.map +1 -0
  162. package/compiled/src/core/mem/chunked_pool.test.js +63 -0
  163. package/compiled/src/core/mem/shared_asset_pool.d.ts +82 -0
  164. package/compiled/src/core/mem/shared_asset_pool.d.ts.map +1 -0
  165. package/compiled/src/core/mem/shared_asset_pool.js +113 -0
  166. package/compiled/src/core/mem/shared_asset_pool.test.d.ts +2 -0
  167. package/compiled/src/core/mem/shared_asset_pool.test.d.ts.map +1 -0
  168. package/compiled/src/core/mem/shared_asset_pool.test.js +49 -0
  169. package/compiled/src/core/model_registry.d.ts +87 -0
  170. package/compiled/src/core/model_registry.d.ts.map +1 -0
  171. package/compiled/src/core/model_registry.js +101 -0
  172. package/compiled/src/core/model_registry.test.d.ts +2 -0
  173. package/compiled/src/core/model_registry.test.d.ts.map +1 -0
  174. package/compiled/src/core/model_registry.test.js +60 -0
  175. package/compiled/src/core/model_uri.d.ts +57 -0
  176. package/compiled/src/core/model_uri.d.ts.map +1 -0
  177. package/compiled/src/core/model_uri.js +101 -0
  178. package/compiled/src/core/model_uri.test.d.ts +2 -0
  179. package/compiled/src/core/model_uri.test.d.ts.map +1 -0
  180. package/compiled/src/core/model_uri.test.js +49 -0
  181. package/compiled/src/core/progress.d.ts +16 -2
  182. package/compiled/src/core/progress.d.ts.map +1 -1
  183. package/compiled/src/core/progress.js +31 -5
  184. package/compiled/src/core/progress.test.js +11 -2
  185. package/compiled/src/core/progress_log.d.ts +1 -0
  186. package/compiled/src/core/progress_log.d.ts.map +1 -1
  187. package/compiled/src/core/progress_log.js +7 -2
  188. package/compiled/src/core/progress_log.test.js +21 -0
  189. package/compiled/src/core/shared_byte_budget.d.ts +60 -0
  190. package/compiled/src/core/shared_byte_budget.d.ts.map +1 -0
  191. package/compiled/src/core/shared_byte_budget.js +85 -0
  192. package/compiled/src/core/shared_byte_budget.test.d.ts +2 -0
  193. package/compiled/src/core/shared_byte_budget.test.d.ts.map +1 -0
  194. package/compiled/src/core/shared_byte_budget.test.js +55 -0
  195. package/compiled/src/core/wasm_heap.d.ts +208 -0
  196. package/compiled/src/core/wasm_heap.d.ts.map +1 -0
  197. package/compiled/src/core/wasm_heap.js +417 -0
  198. package/compiled/src/core/wasm_heap.test.d.ts +2 -0
  199. package/compiled/src/core/wasm_heap.test.d.ts.map +1 -0
  200. package/compiled/src/core/wasm_heap.test.js +546 -0
  201. package/compiled/src/demand/index.d.ts +23 -0
  202. package/compiled/src/demand/index.d.ts.map +1 -0
  203. package/compiled/src/demand/index.js +22 -0
  204. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts +1 -1
  205. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts.map +1 -1
  206. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.js +1 -1
  207. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.d.ts.map +1 -1
  208. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.js +2 -2
  209. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts +1 -1
  210. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts.map +1 -1
  211. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.js +1 -1
  212. package/compiled/src/ifc/ifc4_gen/schema_ifc.gen.js +2 -2
  213. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts +2 -0
  214. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts.map +1 -0
  215. package/compiled/src/ifc/ifc_demand_extraction.test.js +251 -0
  216. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +367 -6
  217. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  218. package/compiled/src/ifc/ifc_geometry_extraction.js +1322 -389
  219. package/compiled/src/ifc/ifc_grid_placement.test.d.ts +2 -0
  220. package/compiled/src/ifc/ifc_grid_placement.test.d.ts.map +1 -0
  221. package/compiled/src/ifc/ifc_grid_placement.test.js +261 -0
  222. package/compiled/src/ifc/ifc_model_geometry.d.ts +12 -0
  223. package/compiled/src/ifc/ifc_model_geometry.d.ts.map +1 -1
  224. package/compiled/src/ifc/ifc_model_geometry.js +15 -0
  225. package/compiled/src/ifc/ifc_regression_batch_main.js +210 -12
  226. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts +145 -0
  227. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts.map +1 -0
  228. package/compiled/src/ifc/ifc_spatial_skeleton.js +266 -0
  229. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts +2 -0
  230. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts.map +1 -0
  231. package/compiled/src/ifc/ifc_spatial_skeleton.test.js +199 -0
  232. package/compiled/src/ifc/ifc_step_model.d.ts +6 -2
  233. package/compiled/src/ifc/ifc_step_model.d.ts.map +1 -1
  234. package/compiled/src/ifc/ifc_step_model.js +6 -4
  235. package/compiled/src/ifc/ifc_step_parser.d.ts +58 -0
  236. package/compiled/src/ifc/ifc_step_parser.d.ts.map +1 -1
  237. package/compiled/src/ifc/ifc_step_parser.js +64 -0
  238. package/compiled/src/ifc/ifc_stream_model.test.d.ts +2 -0
  239. package/compiled/src/ifc/ifc_stream_model.test.d.ts.map +1 -0
  240. package/compiled/src/ifc/ifc_stream_model.test.js +70 -0
  241. package/compiled/src/ifc/ifc_stream_open.d.ts +131 -0
  242. package/compiled/src/ifc/ifc_stream_open.d.ts.map +1 -0
  243. package/compiled/src/ifc/ifc_stream_open.js +116 -0
  244. package/compiled/src/ifc/ifc_stream_open.test.d.ts +2 -0
  245. package/compiled/src/ifc/ifc_stream_open.test.d.ts.map +1 -0
  246. package/compiled/src/ifc/ifc_stream_open.test.js +230 -0
  247. package/compiled/src/ifc/ifc_tile_extractor.d.ts +84 -0
  248. package/compiled/src/ifc/ifc_tile_extractor.d.ts.map +1 -0
  249. package/compiled/src/ifc/ifc_tile_extractor.js +134 -0
  250. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts +2 -0
  251. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts.map +1 -0
  252. package/compiled/src/ifc/ifc_tile_extractor.test.js +118 -0
  253. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts +2 -0
  254. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts.map +1 -0
  255. package/compiled/src/ifc/ifc_typed_select_enum.test.js +60 -0
  256. package/compiled/src/index.d.ts +21 -1
  257. package/compiled/src/index.d.ts.map +1 -1
  258. package/compiled/src/index.js +28 -1
  259. package/compiled/src/logging/logger.d.ts +16 -2
  260. package/compiled/src/logging/logger.d.ts.map +1 -1
  261. package/compiled/src/logging/logger.js +34 -7
  262. package/compiled/src/logging/logger.test.js +30 -0
  263. package/compiled/src/mem/index.d.ts +17 -0
  264. package/compiled/src/mem/index.d.ts.map +1 -0
  265. package/compiled/src/mem/index.js +16 -0
  266. package/compiled/src/namespace_surface.test.d.ts +2 -0
  267. package/compiled/src/namespace_surface.test.d.ts.map +1 -0
  268. package/compiled/src/namespace_surface.test.js +43 -0
  269. package/compiled/src/parsing/parsing_buffer.d.ts +23 -0
  270. package/compiled/src/parsing/parsing_buffer.d.ts.map +1 -1
  271. package/compiled/src/parsing/parsing_buffer.js +31 -0
  272. package/compiled/src/scripts/model_report_displacement.test.d.ts +2 -0
  273. package/compiled/src/scripts/model_report_displacement.test.d.ts.map +1 -0
  274. package/compiled/src/scripts/model_report_displacement.test.js +104 -0
  275. package/compiled/src/scripts/render_glb_paths.test.d.ts +2 -0
  276. package/compiled/src/scripts/render_glb_paths.test.d.ts.map +1 -0
  277. package/compiled/src/scripts/render_glb_paths.test.js +115 -0
  278. package/compiled/src/step/indexing/step_type_indexer.d.ts +20 -0
  279. package/compiled/src/step/indexing/step_type_indexer.d.ts.map +1 -1
  280. package/compiled/src/step/indexing/step_type_indexer.js +67 -0
  281. package/compiled/src/step/parsing/byte_source.d.ts +153 -0
  282. package/compiled/src/step/parsing/byte_source.d.ts.map +1 -0
  283. package/compiled/src/step/parsing/byte_source.js +106 -0
  284. package/compiled/src/step/parsing/byte_source.test.d.ts +2 -0
  285. package/compiled/src/step/parsing/byte_source.test.d.ts.map +1 -0
  286. package/compiled/src/step/parsing/byte_source.test.js +47 -0
  287. package/compiled/src/step/parsing/byte_source_node.d.ts +41 -0
  288. package/compiled/src/step/parsing/byte_source_node.d.ts.map +1 -0
  289. package/compiled/src/step/parsing/byte_source_node.js +54 -0
  290. package/compiled/src/step/parsing/columnar_index.d.ts +103 -0
  291. package/compiled/src/step/parsing/columnar_index.d.ts.map +1 -0
  292. package/compiled/src/step/parsing/columnar_index.js +224 -0
  293. package/compiled/src/step/parsing/columnar_index.test.d.ts +2 -0
  294. package/compiled/src/step/parsing/columnar_index.test.d.ts.map +1 -0
  295. package/compiled/src/step/parsing/columnar_index.test.js +155 -0
  296. package/compiled/src/step/parsing/cross_reference_registry.d.ts +95 -0
  297. package/compiled/src/step/parsing/cross_reference_registry.d.ts.map +1 -0
  298. package/compiled/src/step/parsing/cross_reference_registry.js +91 -0
  299. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts +2 -0
  300. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts.map +1 -0
  301. package/compiled/src/step/parsing/cross_reference_registry.test.js +66 -0
  302. package/compiled/src/step/parsing/decode_utf8.d.ts +15 -0
  303. package/compiled/src/step/parsing/decode_utf8.d.ts.map +1 -1
  304. package/compiled/src/step/parsing/decode_utf8.js +28 -0
  305. package/compiled/src/step/parsing/express_ref_scan.d.ts +20 -0
  306. package/compiled/src/step/parsing/express_ref_scan.d.ts.map +1 -0
  307. package/compiled/src/step/parsing/express_ref_scan.js +91 -0
  308. package/compiled/src/step/parsing/express_ref_scan.test.d.ts +2 -0
  309. package/compiled/src/step/parsing/express_ref_scan.test.d.ts.map +1 -0
  310. package/compiled/src/step/parsing/express_ref_scan.test.js +28 -0
  311. package/compiled/src/step/parsing/index_sidecar.d.ts +81 -0
  312. package/compiled/src/step/parsing/index_sidecar.d.ts.map +1 -0
  313. package/compiled/src/step/parsing/index_sidecar.js +283 -0
  314. package/compiled/src/step/parsing/index_sidecar.test.d.ts +2 -0
  315. package/compiled/src/step/parsing/index_sidecar.test.d.ts.map +1 -0
  316. package/compiled/src/step/parsing/index_sidecar.test.js +122 -0
  317. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts +2 -0
  318. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts.map +1 -0
  319. package/compiled/src/step/parsing/inf_recovery_index.test.js +108 -0
  320. package/compiled/src/step/parsing/prefix_type_index.d.ts +124 -0
  321. package/compiled/src/step/parsing/prefix_type_index.d.ts.map +1 -0
  322. package/compiled/src/step/parsing/prefix_type_index.js +207 -0
  323. package/compiled/src/step/parsing/prefix_type_index.test.d.ts +2 -0
  324. package/compiled/src/step/parsing/prefix_type_index.test.d.ts.map +1 -0
  325. package/compiled/src/step/parsing/prefix_type_index.test.js +298 -0
  326. package/compiled/src/step/parsing/range_byte_source.d.ts +69 -0
  327. package/compiled/src/step/parsing/range_byte_source.d.ts.map +1 -0
  328. package/compiled/src/step/parsing/range_byte_source.js +78 -0
  329. package/compiled/src/step/parsing/range_byte_source.test.d.ts +2 -0
  330. package/compiled/src/step/parsing/range_byte_source.test.d.ts.map +1 -0
  331. package/compiled/src/step/parsing/range_byte_source.test.js +70 -0
  332. package/compiled/src/step/parsing/record_event.d.ts +23 -0
  333. package/compiled/src/step/parsing/record_event.d.ts.map +1 -0
  334. package/compiled/src/step/parsing/record_event.js +1 -0
  335. package/compiled/src/step/parsing/record_field_cursor.d.ts +94 -0
  336. package/compiled/src/step/parsing/record_field_cursor.d.ts.map +1 -0
  337. package/compiled/src/step/parsing/record_field_cursor.js +189 -0
  338. package/compiled/src/step/parsing/step_deserialization_functions.d.ts +29 -0
  339. package/compiled/src/step/parsing/step_deserialization_functions.d.ts.map +1 -1
  340. package/compiled/src/step/parsing/step_deserialization_functions.js +45 -0
  341. package/compiled/src/step/parsing/step_deserialization_functions.test.js +59 -1
  342. package/compiled/src/step/parsing/step_parser.d.ts +66 -1
  343. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  344. package/compiled/src/step/parsing/step_parser.js +164 -10
  345. package/compiled/src/step/parsing/step_string_parser.js +8 -8
  346. package/compiled/src/step/parsing/streaming_index_builder.d.ts +141 -0
  347. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -0
  348. package/compiled/src/step/parsing/streaming_index_builder.js +280 -0
  349. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts +2 -0
  350. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts.map +1 -0
  351. package/compiled/src/step/parsing/streaming_index_builder.test.js +107 -0
  352. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts +2 -0
  353. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts.map +1 -0
  354. package/compiled/src/step/parsing/streaming_index_builder_async.test.js +109 -0
  355. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts +71 -0
  356. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts.map +1 -0
  357. package/compiled/src/step/parsing/streaming_record_dispatcher.js +88 -0
  358. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts +2 -0
  359. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts.map +1 -0
  360. package/compiled/src/step/parsing/streaming_record_dispatcher.test.js +66 -0
  361. package/compiled/src/step/parsing/uint32_sink.d.ts +72 -0
  362. package/compiled/src/step/parsing/uint32_sink.d.ts.map +1 -0
  363. package/compiled/src/step/parsing/uint32_sink.js +180 -0
  364. package/compiled/src/step/parsing/uint32_sink.test.d.ts +2 -0
  365. package/compiled/src/step/parsing/uint32_sink.test.d.ts.map +1 -0
  366. package/compiled/src/step/parsing/uint32_sink.test.js +199 -0
  367. package/compiled/src/step/step_buffer_provider.d.ts +48 -3
  368. package/compiled/src/step/step_buffer_provider.d.ts.map +1 -1
  369. package/compiled/src/step/step_buffer_provider.js +60 -11
  370. package/compiled/src/step/step_buffer_provider.test.js +14 -0
  371. package/compiled/src/step/step_entity_base.d.ts +65 -3
  372. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  373. package/compiled/src/step/step_entity_base.js +135 -3
  374. package/compiled/src/step/step_model_base.d.ts +221 -8
  375. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  376. package/compiled/src/step/step_model_base.js +542 -7
  377. package/compiled/src/stream/index.d.ts +34 -0
  378. package/compiled/src/stream/index.d.ts.map +1 -0
  379. package/compiled/src/stream/index.js +32 -0
  380. package/compiled/src/version/version.js +1 -1
  381. package/compiled/tsconfig.tsbuildinfo +1 -1
  382. package/package.json +16 -1
@@ -1,22 +1,30 @@
1
1
  import { releaseScratchParsingBuffer } from "./parsing/step_deserialization_functions.js";
2
+ import { scanExpressRefs } from "./parsing/express_ref_scan.js";
2
3
  import { ResidentStepBufferProvider, WindowedStepBufferProvider, } from "./step_buffer_provider.js";
3
4
  import StepVtableBuilder from "./parsing/step_vtable_builder.js";
5
+ import { extractIntegerArrayAt } from "./parsing/uint32_sink.js";
4
6
  import { extractOneHotLow } from "../indexing/bit_operations.js";
5
7
  import { TriangleElementMap } from "../core/triangle_element_map.js";
6
8
  import InterpolationSearchTable32 from "../indexing/interpolation_search_table_32.js";
7
9
  /**
8
10
  * The base for models parsed from STEP.
9
11
  */
10
- export default class StepModelBase {
12
+ class StepModelBase {
11
13
  /**
12
14
  * Construct this step model with its matching schema, a buffer to read from and an element index.
13
15
  *
14
16
  * @param schema The Step schema this is based on.
15
- * @param buffer_ The buffer to read this from.
17
+ * @param buffer_ The buffer to read this from. Pass `undefined` together
18
+ * with `provider` to build a model whose source is windowed from
19
+ * construction (e.g. a streaming open — see buildModelStreaming); the
20
+ * synchronous read paths (geometry extraction) then require the relevant
21
+ * ranges to be resident, exactly as after `spillSourceToExternalStore`.
16
22
  * @param elementIndex The element index for this, parsed or deserialized - note this takes
17
23
  * ownership of this array in the sense it will modify values/unfold inline elements etc.
24
+ * @param provider Optional pre-built buffer provider. When omitted, a
25
+ * resident provider over `buffer_` is used (the classic path).
18
26
  */
19
- constructor(schema, buffer_, elementIndex) {
27
+ constructor(schema, buffer_, elementIndex, provider) {
20
28
  this.schema = schema;
21
29
  this.buffer_ = buffer_;
22
30
  this.vtableBuilder_ = new StepVtableBuilder();
@@ -39,7 +47,38 @@ export default class StepModelBase {
39
47
  * error, and the field is optional, return null instead of throwing an exception.
40
48
  */
41
49
  this.nullOnErrors = true;
42
- this.bufferProvider_ = new ResidentStepBufferProvider(buffer_);
50
+ this.bufferProvider_ = provider ?? new ResidentStepBufferProvider(buffer_);
51
+ if (!Array.isArray(elementIndex)) {
52
+ // Columns path (M7): the parse produced the SoA columns directly (see
53
+ // columnar_index.ts) — adopt them, build the lookup tables straight off
54
+ // the columns, and skip the object walk entirely. Inline entities are
55
+ // already unfolded into [firstInlineElement, count) in the same order
56
+ // the object path would have produced.
57
+ const columns = elementIndex;
58
+ const firstInline = columns.firstInlineElement;
59
+ const inlineCount = columns.count - firstInline;
60
+ const inlineElementTable = new Uint32Array(inlineCount << 1);
61
+ for (let where = 0; where < inlineCount; ++where) {
62
+ inlineElementTable[where << 1] = firstInline + where;
63
+ inlineElementTable[(where << 1) + 1] = columns.address[firstInline + where];
64
+ }
65
+ this.inlineAddressMap_ = new InterpolationSearchTable32(inlineElementTable, true);
66
+ const expressIdTable = new Uint32Array(firstInline << 1);
67
+ for (let where = 0; where < firstInline; ++where) {
68
+ expressIdTable[where << 1] = where;
69
+ expressIdTable[(where << 1) + 1] = columns.expressID[where];
70
+ }
71
+ this.expressIDMap_ =
72
+ new InterpolationSearchTable32(expressIdTable, columns.expressIdsSorted);
73
+ this.address_ = columns.address;
74
+ this.length_ = columns.length;
75
+ this.typeID_ = columns.typeID;
76
+ this.expressID_ = columns.expressID;
77
+ this.count_ = columns.count;
78
+ this.firstInlineElement_ = firstInline;
79
+ this.complexEntries_ = columns.complexEntries;
80
+ return;
81
+ }
43
82
  const localElementIndex = elementIndex;
44
83
  let where = 0;
45
84
  const firstInlineElement = localElementIndex.length;
@@ -204,11 +243,101 @@ export default class StepModelBase {
204
243
  }
205
244
  }
206
245
  /**
207
- * Populate a raw vtable entry for a particular element, extra
246
+ * Resolve an express ID to a local ID, using `hintLocalID + 1` when
247
+ * the next record is the one we want. Tessellated Faces lists are
248
+ * sequential (PSB: every faceset), so this turns 9.1M interpolation
249
+ * searches into one per faceset.
208
250
  *
209
- * @param element The raw elment to populate the vtable entry for.
210
- * @return {boolean} Did the vtable entry populate correctly?
251
+ * @param expressID The referenced record.
252
+ * @param hintLocalID Local ID of the previous resolve, if any.
253
+ * @return {number | undefined} The local ID, or undefined if unknown.
254
+ */
255
+ resolveExpressID(expressID, hintLocalID) {
256
+ if (hintLocalID !== void 0) {
257
+ const next = hintLocalID + 1;
258
+ if (next < this.firstInlineElement_ &&
259
+ this.expressID_[next] === expressID) {
260
+ return next;
261
+ }
262
+ }
263
+ return this.expressIDMap_.get(expressID);
264
+ }
265
+ /**
266
+ * Append a local record's unsigned-integer list field into `sink`
267
+ * without an express-ID lookup. The reference-level twin of
268
+ * `StepEntityBase.extractIntegerArrayInto`, for hot loops that walk
269
+ * millions of small records (tessellated facesets) where constructing
270
+ * an entity per record dominates. It deliberately handles only the
271
+ * simple case and reports failure otherwise, so callers keep a
272
+ * correct fallback rather than this growing subtle special cases:
273
+ * the record must be single-class (no multi-mapping) and exactly
274
+ * `expectedTypeID`.
275
+ *
276
+ * Field 0 is the data-block start the parser stored in `address_`
277
+ * (after `TYPE(`). Reading it from the columns skips the descriptor
278
+ * and vtable `entry()` would retain — on a 9 M-face model those are
279
+ * the objects the faceset path is trying not to build. Non-zero
280
+ * offsets still go through a vtable, because only field 0 has that
281
+ * address identity.
282
+ *
283
+ * @param localID The record's local ID.
284
+ * @param offset The field's vtable offset.
285
+ * @param expectedTypeID The type the record must be.
286
+ * @param sink Receives the appended values.
287
+ * @return {number | undefined} Count appended, or undefined when the
288
+ * fast path does not apply.
289
+ */
290
+ extractIntegerArrayByLocalIDInto(localID, offset, expectedTypeID, sink) {
291
+ if (localID >= this.count_) {
292
+ return void 0;
293
+ }
294
+ // Multi-mapped records need per-depth base offsets; leave them to
295
+ // the generated getters. typeID_ is -1 when unset.
296
+ if (this.complexEntries_?.has(localID) ||
297
+ this.typeID_[localID] !== expectedTypeID) {
298
+ return void 0;
299
+ }
300
+ if (offset === 0) {
301
+ const address = this.address_[localID];
302
+ const acquisition = this.bufferProvider_.acquire(address, this.length_[localID]);
303
+ const viewAddress = address - acquisition.offset;
304
+ return extractIntegerArrayAt(acquisition.buffer, viewAddress, acquisition.buffer.length, sink);
305
+ }
306
+ const element = this.entry(localID);
307
+ if (element.vtableIndex === void 0 && !this.populateVtableEntryRaw(element)) {
308
+ return void 0;
309
+ }
310
+ if (element.buffer === void 0) {
311
+ this.populateBufferEntry(localID);
312
+ }
313
+ const vtable = element.vtable;
314
+ const buffer = element.buffer;
315
+ if (vtable === void 0 || buffer === void 0 ||
316
+ offset >= (element.vtableCount ?? 0)) {
317
+ return void 0;
318
+ }
319
+ // Same window the vtable cursors were recorded against, and the
320
+ // same end bound the generated array getters use.
321
+ return extractIntegerArrayAt(buffer, vtable[element.vtableIndex + offset], buffer.length, sink);
322
+ }
323
+ /**
324
+ * Append a referenced record's unsigned-integer list field into `sink`
325
+ * without materialising the referenced entity.
326
+ *
327
+ * @param expressID The referenced record's express ID.
328
+ * @param offset The field's vtable offset within the record.
329
+ * @param expectedTypeID The type the record must be.
330
+ * @param sink Receives the appended values.
331
+ * @return {number | undefined} Count appended, or undefined when the
332
+ * fast path does not apply.
211
333
  */
334
+ extractIntegerArrayByExpressIDInto(expressID, offset, expectedTypeID, sink) {
335
+ const localID = this.expressIDMap_.get(expressID);
336
+ if (localID === void 0) {
337
+ return void 0;
338
+ }
339
+ return this.extractIntegerArrayByLocalIDInto(localID, offset, expectedTypeID, sink);
340
+ }
212
341
  populateVtableEntryRaw(element) {
213
342
  if (element.vtableIndex !== void 0 || element.typeID === 0) {
214
343
  return true;
@@ -257,6 +386,12 @@ export default class StepModelBase {
257
386
  const element = this.entry(localID);
258
387
  element.buffer =
259
388
  this.bufferProvider_.acquire(element.address, element.length).buffer;
389
+ if (element.multiMapping !== void 0) {
390
+ for (const mapped of element.multiMapping) {
391
+ mapped.buffer =
392
+ this.bufferProvider_.acquire(mapped.address, mapped.length).buffer;
393
+ }
394
+ }
260
395
  }
261
396
  /**
262
397
  * Get the size in bytes of the backing buffer for this.
@@ -284,6 +419,74 @@ export default class StepModelBase {
284
419
  get residentSourceBytes() {
285
420
  return this.bufferProvider_.residentBytes;
286
421
  }
422
+ /**
423
+ * Column type of a record, or `undefined` if the id is unknown / untyped.
424
+ *
425
+ * @param localID The record.
426
+ * @return {number | undefined} The schema type id.
427
+ */
428
+ typeIDOf(localID) {
429
+ if (localID >= this.count_) {
430
+ return;
431
+ }
432
+ const typeID = this.typeID_[localID];
433
+ return typeID < 0 ? void 0 : typeID;
434
+ }
435
+ /**
436
+ * Absolute source address of a record.
437
+ *
438
+ * @param localID The record.
439
+ * @return {number | undefined} The address.
440
+ */
441
+ recordAddress(localID) {
442
+ return localID < this.count_ ? this.address_[localID] : void 0;
443
+ }
444
+ /**
445
+ * Source length of a record.
446
+ *
447
+ * @param localID The record.
448
+ * @return {number | undefined} The length.
449
+ */
450
+ recordLength(localID) {
451
+ return localID < this.count_ ? this.length_[localID] : void 0;
452
+ }
453
+ /**
454
+ * Pin an arbitrary source span (e.g. a faceset's packed Faces[] run).
455
+ *
456
+ * @param address Absolute start.
457
+ * @param length Length in bytes.
458
+ */
459
+ pinAddressRange(address, length) {
460
+ if (!this.isSourceExternal) {
461
+ return;
462
+ }
463
+ this.bufferProvider_.pinRange?.(address, length);
464
+ }
465
+ /**
466
+ * Drop one {@link pinAddressRange} hold.
467
+ *
468
+ * @param address Absolute start.
469
+ * @param length Length in bytes.
470
+ */
471
+ unpinAddressRange(address, length) {
472
+ if (!this.isSourceExternal) {
473
+ return;
474
+ }
475
+ this.bufferProvider_.unpinRange?.(address, length);
476
+ }
477
+ /**
478
+ * Page an arbitrary source span.
479
+ *
480
+ * @param address Absolute start.
481
+ * @param length Length in bytes.
482
+ * @return {Promise<void>} Resolves when resident.
483
+ */
484
+ async ensureResidentRange(address, length) {
485
+ if (!this.isSourceExternal) {
486
+ return;
487
+ }
488
+ await this.bufferProvider_.ensureResident(address, length);
489
+ }
287
490
  /**
288
491
  * Release the resident source buffer and serve subsequent record
289
492
  * reads from fixed-size windows paged in from an external store.
@@ -359,6 +562,332 @@ export default class StepModelBase {
359
562
  }
360
563
  await this.ensureResidentByLocalID(localID);
361
564
  }
565
+ /**
566
+ * Page in the byte ranges a record *and every `#ref` reachable from
567
+ * its text* will need, so a following synchronous extract of that
568
+ * subgraph succeeds on a windowed source. Inverse relationships
569
+ * (not written in the record) are not discovered — callers that
570
+ * need them (rel-voids, styled items) pass their local IDs as
571
+ * `extraLocalIDs`.
572
+ *
573
+ * No-op while the source is fully resident.
574
+ *
575
+ * @param localID Seed record.
576
+ * @param extraLocalIDs Additional seeds (voids, styles, materials).
577
+ * @param seen Optional set to extend (also skips already-pinned IDs).
578
+ * @param descend If set, records for which this returns false are
579
+ * still visited (pinned, in `seen`) but their `#refs` are not
580
+ * followed — e.g. an `IfcPolygonalFaceSet` whose Faces[] payload
581
+ * is paged as one span afterwards.
582
+ * @param leafSpans Optional out-array of coalesced pin ranges for
583
+ * {@link spanLeaf} children — caller must {@link unpinAddressRange}
584
+ * each.
585
+ * @param spanLeaf If set, matching children are *not* visited
586
+ * (absent from `seen`); their bytes are one pin span. Packed
587
+ * extract reads `IfcIndexedPolygonalFace.CoordIndex` as integers —
588
+ * following those faces pinned ~78k records per PSB product. If
589
+ * omitted, `!descend` children use this span path (test helper).
590
+ * @param claimed Optional out-set of the IDs *this call* claimed and
591
+ * awaited residency for — a strict subset of `seen`. When `seen` is
592
+ * shared across concurrent walks (a batch of products sharing mapped
593
+ * geometry), an ID another walk claimed is skipped here and is NOT
594
+ * resident yet from this call's point of view: that walk's pin holds
595
+ * the chunk once it lands, but its read is still in flight. Anything
596
+ * that must synchronously read a record's bytes after this returns
597
+ * has to iterate `claimed`, never `seen` (conway#526).
598
+ * @return {Promise<Set<number>>} The local IDs that were visited.
599
+ */
600
+ async ensureResidentClosureByLocalID(localID, extraLocalIDs, seen = new Set(), descend, leafSpans, spanLeaf, claimed) {
601
+ if (!this.isSourceExternal) {
602
+ return seen;
603
+ }
604
+ // BFS by hop: page a whole frontier in parallel so a product whose
605
+ // #refs sit in different OPFS chunks is one round-trip, not one
606
+ // await per record. Claim `seen` before the await so overlapping
607
+ // walks (a batch of products sharing mapped geometry) pin once.
608
+ const frontier = [];
609
+ const enqueue = (id) => {
610
+ if (id < this.count_ && !seen.has(id)) {
611
+ frontier.push(id);
612
+ }
613
+ };
614
+ enqueue(localID);
615
+ if (extraLocalIDs !== void 0) {
616
+ for (const extra of extraLocalIDs) {
617
+ enqueue(extra);
618
+ }
619
+ }
620
+ while (frontier.length > 0) {
621
+ const wave = [];
622
+ for (const id of frontier) {
623
+ if (seen.has(id) || id >= this.count_) {
624
+ continue;
625
+ }
626
+ // Claim + pin before the await so a sibling ensure cannot
627
+ // evict this range once its own ensurePins_ drop.
628
+ seen.add(id);
629
+ this.pinByLocalID(id);
630
+ wave.push(id);
631
+ claimed?.add(id);
632
+ }
633
+ frontier.length = 0;
634
+ if (wave.length === 0) {
635
+ break;
636
+ }
637
+ await Promise.all(wave.map((id) => this.ensureResidentByLocalID(id)));
638
+ const waveSpans = [];
639
+ for (const id of wave) {
640
+ if (descend !== void 0 && !descend(id)) {
641
+ continue;
642
+ }
643
+ const skipped = [];
644
+ for (const expressID of this.scanRecordRefs_(id)) {
645
+ const referenced = this.expressIDMap_.get(expressID);
646
+ if (referenced === void 0 || seen.has(referenced)) {
647
+ continue;
648
+ }
649
+ // Packed leaves (Faces[]) are spanned, not visited. Stop
650
+ // nodes (facesets) fail `descend` so we do not scan their
651
+ // refs, but they still go on the frontier so they land in
652
+ // `seen` for the payload pass.
653
+ const leaf = spanLeaf !== void 0 ?
654
+ spanLeaf(referenced) :
655
+ (descend !== void 0 && !descend(referenced));
656
+ if (leaf) {
657
+ skipped.push(referenced);
658
+ continue;
659
+ }
660
+ frontier.push(referenced);
661
+ }
662
+ if (skipped.length > 0) {
663
+ for (const span of this.spansOf_(skipped)) {
664
+ this.pinAddressRange(span.address, span.length);
665
+ waveSpans.push(span);
666
+ leafSpans?.push(span);
667
+ }
668
+ }
669
+ }
670
+ if (waveSpans.length > 0) {
671
+ await Promise.all(waveSpans.map((span) => this.ensureResidentRange(span.address, span.length)));
672
+ }
673
+ }
674
+ return seen;
675
+ }
676
+ /**
677
+ * Hold a record's source range against windowed LRU eviction until
678
+ * {@link unpinByLocalID}. No-op while the source is fully resident.
679
+ *
680
+ * @param localID The record to pin.
681
+ */
682
+ pinByLocalID(localID) {
683
+ if (!this.isSourceExternal || localID >= this.count_) {
684
+ return;
685
+ }
686
+ this.bufferProvider_.pinRange?.(this.address_[localID], this.length_[localID]);
687
+ }
688
+ /**
689
+ * Drop one {@link pinByLocalID} hold.
690
+ *
691
+ * @param localID The record to unpin.
692
+ */
693
+ unpinByLocalID(localID) {
694
+ if (!this.isSourceExternal || localID >= this.count_) {
695
+ return;
696
+ }
697
+ this.bufferProvider_.unpinRange?.(this.address_[localID], this.length_[localID]);
698
+ }
699
+ /**
700
+ * Drop captured source-window views on `localIDs` so the LRU can
701
+ * evict those chunks. Vtables stay — `acquire` of the same
702
+ * `(address, length)` is at a stable base. The next
703
+ * `ensureResident` + field read rematerialises the view.
704
+ *
705
+ * @param localIDs Records whose `buffer` views to drop.
706
+ */
707
+ releaseSourceViews(localIDs) {
708
+ if (!this.isSourceExternal) {
709
+ return;
710
+ }
711
+ for (const localID of localIDs) {
712
+ if (localID >= this.count_) {
713
+ continue;
714
+ }
715
+ const item = this.complexEntries_?.get(localID) ?? this.descriptorCache_[localID];
716
+ if (item === void 0) {
717
+ continue;
718
+ }
719
+ item.buffer = void 0;
720
+ if (item.multiMapping !== void 0) {
721
+ for (const mapped of item.multiMapping) {
722
+ mapped.buffer = void 0;
723
+ }
724
+ }
725
+ }
726
+ releaseScratchParsingBuffer();
727
+ }
728
+ /**
729
+ * Unpin every local ID in `localIDs` (best-effort; missing IDs are
730
+ * ignored). Use after {@link ensureResidentClosureByLocalID}, which
731
+ * pins as it walks.
732
+ *
733
+ * @param localIDs The records to unpin.
734
+ */
735
+ unpinLocalIDs(localIDs) {
736
+ for (const localID of localIDs) {
737
+ this.unpinByLocalID(localID);
738
+ }
739
+ }
740
+ /**
741
+ * Express-ID twin of {@link ensureResidentClosureByLocalID}. Unknown
742
+ * IDs resolve to an empty visit set.
743
+ *
744
+ * @param expressID Seed record.
745
+ * @param extraLocalIDs Additional seeds (local IDs).
746
+ * @return {Promise<Set<number>>} The local IDs that were visited.
747
+ */
748
+ async ensureResidentClosureByExpressID(expressID, extraLocalIDs, seen) {
749
+ if (!this.isSourceExternal) {
750
+ return seen ?? new Set();
751
+ }
752
+ const localID = this.expressIDMap_.get(expressID);
753
+ if (localID === void 0) {
754
+ return seen ?? new Set();
755
+ }
756
+ return this.ensureResidentClosureByLocalID(localID, extraLocalIDs, seen);
757
+ }
758
+ /**
759
+ * Source spans covering the records referenced by `expressIDs` from
760
+ * `fromIndex` onward. A packed Faces[] run is consecutive in parse
761
+ * order — two express-ID lookups then cover the whole range. Sparse
762
+ * sets are coalesced into tight runs so intervening file is not
763
+ * pinned.
764
+ *
765
+ * @param expressIDs Referenced express IDs (e.g. a faceset's #refs).
766
+ * @param fromIndex First index to include (skip Coordinates at [0]).
767
+ * @return {{address: number, length: number}[]} The spans.
768
+ */
769
+ spansOfExpressIDs(expressIDs, fromIndex = 0) {
770
+ let minExpressID = Infinity;
771
+ let maxExpressID = 0;
772
+ let count = 0;
773
+ for (let i = fromIndex; i < expressIDs.length; ++i) {
774
+ const expressID = expressIDs[i];
775
+ if (expressID < minExpressID) {
776
+ minExpressID = expressID;
777
+ }
778
+ if (expressID > maxExpressID) {
779
+ maxExpressID = expressID;
780
+ }
781
+ ++count;
782
+ }
783
+ if (count === 0 || !Number.isFinite(minExpressID)) {
784
+ return [];
785
+ }
786
+ const minLocal = this.expressIDMap_.get(minExpressID);
787
+ const maxLocal = this.expressIDMap_.get(maxExpressID);
788
+ if (minLocal === void 0 || maxLocal === void 0) {
789
+ return [];
790
+ }
791
+ const lo = Math.min(minLocal, maxLocal);
792
+ const hi = Math.max(minLocal, maxLocal);
793
+ if (hi - lo + 1 === count) {
794
+ const address = this.address_[lo];
795
+ const end = this.address_[hi] + this.length_[hi];
796
+ if (end <= address) {
797
+ return [];
798
+ }
799
+ return [{ address, length: end - address }];
800
+ }
801
+ const locals = [];
802
+ for (let i = fromIndex; i < expressIDs.length; ++i) {
803
+ const localID = this.expressIDMap_.get(expressIDs[i]);
804
+ if (localID !== void 0) {
805
+ locals.push(localID);
806
+ }
807
+ }
808
+ return this.spansOf_(locals);
809
+ }
810
+ /**
811
+ * Coalesce `localIDs` into tight source runs. Records more than
812
+ * {@link LEAF_SPAN_COALESCE_GAP_} apart stay separate so a sparse
813
+ * Faces[] list does not pin the file between them.
814
+ *
815
+ * @param localIDs The records.
816
+ * @return {{address: number, length: number}[]} The spans.
817
+ */
818
+ spansOf_(localIDs) {
819
+ const items = [];
820
+ for (const id of localIDs) {
821
+ if (id >= this.count_) {
822
+ continue;
823
+ }
824
+ items.push({
825
+ address: this.address_[id],
826
+ length: this.length_[id],
827
+ });
828
+ }
829
+ items.sort((a, b) => a.address - b.address);
830
+ const spans = [];
831
+ let run;
832
+ for (const item of items) {
833
+ if (run === void 0) {
834
+ run = { address: item.address, length: item.length };
835
+ continue;
836
+ }
837
+ const runEnd = run.address + run.length;
838
+ if (item.address <= runEnd + StepModelBase.LEAF_SPAN_COALESCE_GAP_) {
839
+ const end = Math.max(runEnd, item.address + item.length);
840
+ run.length = end - run.address;
841
+ continue;
842
+ }
843
+ spans.push(run);
844
+ run = { address: item.address, length: item.length };
845
+ }
846
+ if (run !== void 0) {
847
+ spans.push(run);
848
+ }
849
+ return spans;
850
+ }
851
+ /**
852
+ * Express IDs referenced by a resident record (`#<id>` tokens in its
853
+ * text, including multi-mapped class records). The record itself
854
+ * must already be resident.
855
+ *
856
+ * @param localID The record to scan.
857
+ * @return {number[]} Distinct referenced express IDs.
858
+ */
859
+ referencedExpressIDs(localID) {
860
+ return this.scanRecordRefs_(localID);
861
+ }
862
+ /**
863
+ * Scan a resident record's bytes for `#<expressID>` references.
864
+ *
865
+ * @param localID The record to scan.
866
+ * @return {number[]} Distinct referenced express IDs.
867
+ */
868
+ scanRecordRefs_(localID) {
869
+ const address = this.address_[localID];
870
+ const length = this.length_[localID];
871
+ const acquisition = this.bufferProvider_.acquire(address, length);
872
+ const viewStart = address - acquisition.offset;
873
+ const refs = scanExpressRefs(acquisition.buffer, viewStart, length);
874
+ const complex = this.complexEntries_?.get(localID);
875
+ if (complex?.multiMapping === void 0) {
876
+ return refs;
877
+ }
878
+ const seen = new Set(refs);
879
+ for (const mapped of complex.multiMapping) {
880
+ const mappedAcquisition = this.bufferProvider_.acquire(mapped.address, mapped.length);
881
+ const mappedStart = mapped.address - mappedAcquisition.offset;
882
+ for (const expressID of scanExpressRefs(mappedAcquisition.buffer, mappedStart, mapped.length)) {
883
+ if (!seen.has(expressID)) {
884
+ seen.add(expressID);
885
+ refs.push(expressID);
886
+ }
887
+ }
888
+ }
889
+ return refs;
890
+ }
362
891
  /**
363
892
  * Get the number of elements/entities in this model.
364
893
  *
@@ -769,3 +1298,9 @@ export default class StepModelBase {
769
1298
  return this.geometry?.getByLocalID(node.localID);
770
1299
  }
771
1300
  }
1301
+ // Merge neighbouring leaf records only when the hole between them is
1302
+ // a few small STEP rows. A Faces[] dump is packed; a sparse list
1303
+ // must not pin the file in between.
1304
+ // eslint-disable-next-line no-magic-numbers
1305
+ StepModelBase.LEAF_SPAN_COALESCE_GAP_ = 1024;
1306
+ export default StepModelBase;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * `@bldrs-ai/conway/stream` — the streaming parse/index plane (epic #390;
3
+ * design/new/streaming-federated-loader.md).
4
+ *
5
+ * Fixed-memory opens: a model parses through a bounded moving window over
6
+ * a {@link ByteSource} into a columnar record index ({@link StepIndexColumns}
7
+ * — no per-record object phase), reads its source bytes on demand through a
8
+ * windowed provider over a {@link StepExternalByteStore} (e.g. OPFS), and
9
+ * serializes its index to a revisit sidecar whose payload IS the columns.
10
+ * Consumers work against the parse as it runs two ways: membership-shaped
11
+ * ones ({@link PrefixTypeIndex}) derive from a prefix snapshot of the columns
12
+ * at a cadence they choose, and byte-shaped ones subscribe to per-record
13
+ * events via {@link StreamingRecordDispatcher} (issue #393 for why the split
14
+ * is where it is).
15
+ *
16
+ * This is the conway-native namespace for new-era consumers. The web-ifc
17
+ * compat shim (`@bldrs-ai/conway/web-ifc`) adapts parts of this surface to
18
+ * web-ifc's API (e.g. `OpenModelStreamed`) and is headed for retirement;
19
+ * new integrations should build against this module directly.
20
+ */
21
+ export { openStreamedIfcModel, openStreamedIfcModelAsync, openStreamedIfcModelFromStore, ifcPrefixTypeIndex, StreamedIfcOpen, StreamedIfcOpenOptions, } from "../ifc/ifc_stream_open.js";
22
+ export { buildColumnarIndexStreaming, buildColumnarIndexStreamingAsync, StreamingColumnarIndexResult, StreamingIndexStats, } from "../step/parsing/streaming_index_builder.js";
23
+ export { ByteSource, BufferByteSource, AsyncByteSource, ReadableByteSource, StoreByteSource, SyncAccessHandleByteSource, SyncAccessHandleLike, } from "../step/parsing/byte_source.js";
24
+ export { scanExpressRefs } from "../step/parsing/express_ref_scan.js";
25
+ export { StepExternalByteStore, InMemoryStepByteStore, StepBufferProvider, WindowedStepBufferProvider, } from "../step/step_buffer_provider.js";
26
+ export { StepIndexColumns, ColumnarIndexSink } from "../step/parsing/columnar_index.js";
27
+ export { serializeIndexSidecarFromColumns, deserializeIndexSidecarToColumns, sidecarMatchesSource, hashSource, } from "../step/parsing/index_sidecar.js";
28
+ export { StreamingRecordDispatcher, RecordHandler, } from "../step/parsing/streaming_record_dispatcher.js";
29
+ export { PrefixTypeIndex } from "../step/parsing/prefix_type_index.js";
30
+ export { StepTypeIndexer } from "../step/indexing/step_type_indexer.js";
31
+ export { RecordEventHandler } from "../step/parsing/record_event.js";
32
+ export { RecordFieldCursor } from "../step/parsing/record_field_cursor.js";
33
+ export { IfcSpatialSkeleton, SkeletonNode } from "../ifc/ifc_spatial_skeleton.js";
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stream/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,yCAAyC,CAAA;AAChD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACpF,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,oBAAoB,EACpB,UAAU,GACX,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,yBAAyB,EACzB,aAAa,GACd,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * `@bldrs-ai/conway/stream` — the streaming parse/index plane (epic #390;
3
+ * design/new/streaming-federated-loader.md).
4
+ *
5
+ * Fixed-memory opens: a model parses through a bounded moving window over
6
+ * a {@link ByteSource} into a columnar record index ({@link StepIndexColumns}
7
+ * — no per-record object phase), reads its source bytes on demand through a
8
+ * windowed provider over a {@link StepExternalByteStore} (e.g. OPFS), and
9
+ * serializes its index to a revisit sidecar whose payload IS the columns.
10
+ * Consumers work against the parse as it runs two ways: membership-shaped
11
+ * ones ({@link PrefixTypeIndex}) derive from a prefix snapshot of the columns
12
+ * at a cadence they choose, and byte-shaped ones subscribe to per-record
13
+ * events via {@link StreamingRecordDispatcher} (issue #393 for why the split
14
+ * is where it is).
15
+ *
16
+ * This is the conway-native namespace for new-era consumers. The web-ifc
17
+ * compat shim (`@bldrs-ai/conway/web-ifc`) adapts parts of this surface to
18
+ * web-ifc's API (e.g. `OpenModelStreamed`) and is headed for retirement;
19
+ * new integrations should build against this module directly.
20
+ */
21
+ export { openStreamedIfcModel, openStreamedIfcModelAsync, openStreamedIfcModelFromStore, ifcPrefixTypeIndex, } from "../ifc/ifc_stream_open.js";
22
+ export { buildColumnarIndexStreaming, buildColumnarIndexStreamingAsync, } from "../step/parsing/streaming_index_builder.js";
23
+ export { BufferByteSource, StoreByteSource, SyncAccessHandleByteSource, } from "../step/parsing/byte_source.js";
24
+ export { scanExpressRefs } from "../step/parsing/express_ref_scan.js";
25
+ export { InMemoryStepByteStore, WindowedStepBufferProvider, } from "../step/step_buffer_provider.js";
26
+ export { ColumnarIndexSink } from "../step/parsing/columnar_index.js";
27
+ export { serializeIndexSidecarFromColumns, deserializeIndexSidecarToColumns, sidecarMatchesSource, hashSource, } from "../step/parsing/index_sidecar.js";
28
+ export { StreamingRecordDispatcher, } from "../step/parsing/streaming_record_dispatcher.js";
29
+ export { PrefixTypeIndex } from "../step/parsing/prefix_type_index.js";
30
+ export { StepTypeIndexer } from "../step/indexing/step_type_indexer.js";
31
+ export { RecordFieldCursor } from "../step/parsing/record_field_cursor.js";
32
+ export { IfcSpatialSkeleton } from "../ifc/ifc_spatial_skeleton.js";