@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
@@ -0,0 +1,524 @@
1
+ import { CanonicalMeshType } from "../../index.js";
2
+ import IfcStepModel from "../../ifc/ifc_step_model.js";
3
+ import { IfcGeometryExtraction } from "../../ifc/ifc_geometry_extraction.js";
4
+ import { IfcBuildingStorey, IfcProduct, IfcProject, IfcRelAggregates, IfcUnitAssignment, } from "../../ifc/ifc4_gen/index.js";
5
+ import { cursorIterator } from "../../indexing/cursor_utilities.js";
6
+ import { WindowedStepBufferProvider } from "../../step/step_buffer_provider.js";
7
+ import * as glmatrix from "gl-matrix";
8
+ import { composeTransformF64, deriveCoordinationF64, IDENTITY_MAT4, NORMALIZE_MAT_F64, } from "./coordination_f64.js";
9
+ import { emitSpatialStructureImposters } from "./spatial_imposter.js";
10
+ import { releaseModelGeometry, } from "./streamed_preview_channel.js";
11
+ /* eslint-disable no-magic-numbers */
12
+ const TICK_INTERVAL_MS = 150;
13
+ const TICK_INTERVAL_MAX_MS = 600;
14
+ const TICK_INTERVAL_GROWTH = 1.1;
15
+ /**
16
+ * Extraction + capture budget per tick, mirroring
17
+ * {@link StreamedPreviewChannel}'s. The store path used to extract
18
+ * exactly ONE product per tick on the interval below, i.e. 2-7
19
+ * products/second — which is why PSB's preview arrived girder by girder
20
+ * where the resident path delivered batches (conway#518).
21
+ */
22
+ const TICK_BUDGET_MS = 20;
23
+ /**
24
+ * Products a single tick may attempt, whatever the clock says.
25
+ *
26
+ * `deferDanglingPlacements` (Share#1744) defers any product whose
27
+ * placement records the prefix does not hold yet, and Revit writes
28
+ * per-product placements toward the file tail — so early ticks meet long
29
+ * runs of products that cannot extract. Each such attempt still pages
30
+ * source through the windowed provider, so a run of them is not free;
31
+ * this caps the run rather than letting the deadline be the only bound.
32
+ */
33
+ const TICK_MAX_ATTEMPTS = 32;
34
+ const FIRST_GENERATION_MIN_RECORDS = 1024;
35
+ const GENERATION_GROWTH_FACTOR = 2;
36
+ const DEFAULT_MAX_PREVIEW_UNITS = 512;
37
+ const DEFAULT_MAX_PREVIEW_BYTES = 48 * 1024 * 1024;
38
+ const FLOATS_PER_VERTEX = 6;
39
+ const BYTES_PER_FLOAT = 4;
40
+ const DEFAULT_COLOR = [0.8, 0.8, 0.8, 1];
41
+ const FLUSH_BUDGET_MS = 100;
42
+ /**
43
+ * Parse-time placed-mesh preview for a windowed (store-backed) open.
44
+ *
45
+ * Twin of {@link StreamedPreviewChannel}: same capture math and
46
+ * COORDINATE_TO_ORIGIN frame, same time-budgeted tick, but the prefix
47
+ * model pages product closures from `store` instead of a resident
48
+ * buffer. After each product the pins drop, so peak source residency
49
+ * stays the windowed LRU — not the file.
50
+ *
51
+ * It also runs the spatial-structure walk off its own prefix
52
+ * generations, so the building's skeleton goes up in the first seconds
53
+ * of a long parse rather than after it — see
54
+ * {@link maybeEmitEarlySpatialPlates_}.
55
+ */
56
+ export class StorePreviewChannel {
57
+ /**
58
+ * @param store_ External source (OPFS / file).
59
+ * @param sink_ Live columnar sink the parse is filling.
60
+ * @param conwaywasm_ Shared wasm wrapper.
61
+ * @param coordinateToOrigin_ Open COORDINATE_TO_ORIGIN.
62
+ * @param onMesh_ Preview consumer.
63
+ * @param maxUnits Cap on products preview-extracted.
64
+ * @param maxBytes Cap on copied payload bytes.
65
+ * @param firstGenerationMinRecords Records before the first snapshot.
66
+ */
67
+ constructor(store_, sink_, conwaywasm_, coordinateToOrigin_, onMesh_, maxUnits = DEFAULT_MAX_PREVIEW_UNITS, maxBytes = DEFAULT_MAX_PREVIEW_BYTES, firstGenerationMinRecords = FIRST_GENERATION_MIN_RECORDS) {
68
+ this.store_ = store_;
69
+ this.sink_ = sink_;
70
+ this.conwaywasm_ = conwaywasm_;
71
+ this.coordinateToOrigin_ = coordinateToOrigin_;
72
+ this.onMesh_ = onMesh_;
73
+ this.maxUnits = maxUnits;
74
+ this.maxBytes = maxBytes;
75
+ this.firstGenerationMinRecords = firstGenerationMinRecords;
76
+ this.stopped_ = false;
77
+ this.emittedUnits_ = 0;
78
+ this.emittedBytes_ = 0;
79
+ this.unitOrdinal_ = 0;
80
+ this.lastInlineTick_ = 0;
81
+ this.tickIntervalMs_ = TICK_INTERVAL_MS;
82
+ this.lastSnapshotRecords_ = 0;
83
+ this.lastFailedSnapshotRecords_ = 0;
84
+ // Fields rather than the constants directly, so a test can lift the
85
+ // wall-clock bounds the way ifc_api_preview_channel.test.ts already
86
+ // lifts the streamed channel's: asserting "this tick ran N products"
87
+ // against a real 20ms budget is a coin flip on a loaded runner.
88
+ this.tickBudgetMs_ = TICK_BUDGET_MS;
89
+ this.tickMaxAttempts_ = TICK_MAX_ATTEMPTS;
90
+ /** Set once a prefix-generation spatial walk has emitted a plate. */
91
+ this.earlyPlatesEmitted_ = 0;
92
+ /**
93
+ * Whether those plates were composed under the walk's own fallback
94
+ * frame because no preview instance had latched one yet. They get one
95
+ * re-emission on a later generation once a real frame exists — see
96
+ * {@link maybeEmitEarlySpatialPlates_}.
97
+ */
98
+ this.earlyPlatesUsedFallbackFrame_ = false;
99
+ this.emittedGeometry_ = new Set();
100
+ }
101
+ get capped() {
102
+ return this.emittedUnits_ >= this.maxUnits ||
103
+ this.emittedBytes_ >= this.maxBytes;
104
+ }
105
+ get emittedUnits() {
106
+ return this.emittedUnits_;
107
+ }
108
+ /** Products the current generation would run (test seam). */
109
+ get productCount() {
110
+ return this.generation_?.products.length ?? 0;
111
+ }
112
+ /**
113
+ * Plates the prefix-generation spatial walk emitted, 0 while it has
114
+ * not succeeded (see {@link maybeEmitEarlySpatialPlates_}).
115
+ */
116
+ get earlyPlateCount() {
117
+ return this.earlyPlatesEmitted_;
118
+ }
119
+ /**
120
+ * One cadence-gated, time-budgeted tick. No-op until the interval
121
+ * elapses or the index can support a generation. Safe to call from
122
+ * parse progress.
123
+ *
124
+ * **Cadence and budget interact once, not twice.** The interval is
125
+ * measured tick-start to tick-start (`lastInlineTick_` is stamped
126
+ * before the work, as on the streamed channel), so a tick that spends
127
+ * its whole budget shortens the gap to the next one by that budget
128
+ * rather than adding to it. And the decay is charged only to ticks
129
+ * that actually attempted a product: a tick that found no generation —
130
+ * which is every tick through the opening seconds of a big parse, when
131
+ * the index has not yet reached FIRST_GENERATION_MIN_RECORDS — used to
132
+ * decay the interval anyway, so by the time there was anything to
133
+ * extract the cadence had already cooled toward
134
+ * TICK_INTERVAL_MAX_MS. Deliberately divergent from
135
+ * {@link StreamedPreviewChannel}, which decays unconditionally; the
136
+ * cost is that a channel which never finds a generation keeps probing
137
+ * at TICK_INTERVAL_MS, and a probe that finds nothing is a record
138
+ * count compared against two thresholds.
139
+ *
140
+ * @return {Promise<void>} Settles when this tick's products (if any)
141
+ * are captured.
142
+ */
143
+ async maybeTickAsync() {
144
+ if (this.stopped_ || this.capped) {
145
+ return;
146
+ }
147
+ const now = Date.now();
148
+ if (now - this.lastInlineTick_ < this.tickIntervalMs_) {
149
+ return;
150
+ }
151
+ this.lastInlineTick_ = now;
152
+ try {
153
+ if ((await this.tickBudgeted_()) > 0) {
154
+ this.tickIntervalMs_ = Math.min(this.tickIntervalMs_ * TICK_INTERVAL_GROWTH, TICK_INTERVAL_MAX_MS);
155
+ }
156
+ }
157
+ catch {
158
+ this.stopped_ = true;
159
+ }
160
+ }
161
+ /**
162
+ * Attempt products until the time budget or the attempt cap runs out,
163
+ * whichever comes first.
164
+ *
165
+ * @return {Promise<number>} Products attempted this tick.
166
+ */
167
+ async tickBudgeted_() {
168
+ const deadline = Date.now() + this.tickBudgetMs_;
169
+ let attempts = 0;
170
+ while (!this.capped &&
171
+ attempts < this.tickMaxAttempts_ &&
172
+ Date.now() < deadline) {
173
+ if (!(await this.tickOnce_())) {
174
+ break;
175
+ }
176
+ ++attempts;
177
+ }
178
+ return attempts;
179
+ }
180
+ /**
181
+ * After parse: extract a short burst so small files (and prefixes
182
+ * that never crossed a progress tick) still emit placed meshes
183
+ * before open returns.
184
+ *
185
+ * @return {Promise<void>} Settles when the burst ends.
186
+ */
187
+ async flushAsync() {
188
+ if (this.stopped_ || this.capped) {
189
+ return;
190
+ }
191
+ const deadline = Date.now() + FLUSH_BUDGET_MS;
192
+ try {
193
+ while (!this.capped && Date.now() < deadline) {
194
+ const did = await this.tickOnce_();
195
+ if (!did) {
196
+ break;
197
+ }
198
+ }
199
+ }
200
+ catch {
201
+ this.stopped_ = true;
202
+ }
203
+ }
204
+ /** Drop the throwaway prefix generation. Idempotent. */
205
+ stop() {
206
+ this.stopped_ = true;
207
+ this.disposeGeneration_();
208
+ }
209
+ /**
210
+ * Test seam: drain until the current sink is exhausted or a cap hits.
211
+ *
212
+ * @return {Promise<void>} Settles when idle.
213
+ */
214
+ async drainForTest() {
215
+ this.lastInlineTick_ = 0;
216
+ this.tickIntervalMs_ = 0;
217
+ for (;;) {
218
+ if (this.capped) {
219
+ return;
220
+ }
221
+ const did = await this.tickOnce_();
222
+ if (!did) {
223
+ return;
224
+ }
225
+ }
226
+ }
227
+ /**
228
+ * @return {Promise<boolean>} True when a product was attempted.
229
+ */
230
+ async tickOnce_() {
231
+ if (!(await this.ensureGeneration_())) {
232
+ return false;
233
+ }
234
+ const active = this.generation_;
235
+ if (this.unitOrdinal_ >= active.products.length) {
236
+ return false;
237
+ }
238
+ const localID = active.products[this.unitOrdinal_++];
239
+ const model = active.model;
240
+ const pins = new Set();
241
+ const leafSpans = [];
242
+ try {
243
+ await active.extraction.ensureResidentForProductExtract(localID, pins, leafSpans);
244
+ if (active.extraction.extractProductGeometryByLocalID(localID)) {
245
+ this.captureNewInstances_();
246
+ ++this.emittedUnits_;
247
+ }
248
+ }
249
+ catch {
250
+ // Forward-ref / unplaced — durable pump extracts later.
251
+ }
252
+ finally {
253
+ model.releaseSourceViews(pins);
254
+ model.unpinLocalIDs(pins);
255
+ for (const span of leafSpans) {
256
+ model.unpinAddressRange(span.address, span.length);
257
+ }
258
+ }
259
+ return true;
260
+ }
261
+ /**
262
+ * @return {Promise<boolean>} True when a generation with pending units exists.
263
+ */
264
+ async ensureGeneration_() {
265
+ const active = this.generation_;
266
+ if (active !== void 0 && this.unitOrdinal_ < active.products.length) {
267
+ return true;
268
+ }
269
+ const records = this.sink_.topLevelCount;
270
+ if (records < this.firstGenerationMinRecords) {
271
+ return false;
272
+ }
273
+ if (active !== void 0 &&
274
+ records < this.lastSnapshotRecords_ * GENERATION_GROWTH_FACTOR) {
275
+ return false;
276
+ }
277
+ if (records < this.lastFailedSnapshotRecords_ * GENERATION_GROWTH_FACTOR) {
278
+ return false;
279
+ }
280
+ try {
281
+ const columns = this.sink_.snapshot();
282
+ const provider = new WindowedStepBufferProvider(this.store_);
283
+ const model = new IfcStepModel(void 0, columns, provider);
284
+ const products = [];
285
+ for (const localID of cursorIterator(model.typeIndex.cursor(...IfcProduct.query))) {
286
+ products.push(localID);
287
+ }
288
+ if (products.length === 0) {
289
+ this.lastFailReason = `no products in ${records} records`;
290
+ return false;
291
+ }
292
+ if (products.length <= this.unitOrdinal_) {
293
+ this.lastFailReason = `ordinal ${this.unitOrdinal_} >= ${products.length}`;
294
+ return false;
295
+ }
296
+ const extraction = new IfcGeometryExtraction(this.conwaywasm_, model);
297
+ extraction.quietRecoverableLogging = true;
298
+ extraction.deferDanglingPlacements = true;
299
+ const prepPins = await extraction.ensureResidentForDemandPrep();
300
+ try {
301
+ extraction.prepareDemandExtraction(true);
302
+ }
303
+ finally {
304
+ model.releaseSourceViews(prepPins);
305
+ model.unpinLocalIDs(prepPins);
306
+ }
307
+ this.disposeGeneration_();
308
+ this.generation_ = {
309
+ model,
310
+ extraction,
311
+ products,
312
+ capturedCounts: new Map(),
313
+ };
314
+ this.lastSnapshotRecords_ = records;
315
+ this.lastFailedSnapshotRecords_ = 0;
316
+ this.lastFailReason = void 0;
317
+ await this.maybeEmitEarlySpatialPlates_(model, extraction);
318
+ return true;
319
+ }
320
+ catch (error) {
321
+ this.lastFailedSnapshotRecords_ = records;
322
+ this.lastFailReason = error instanceof Error ? error.message : String(error);
323
+ return false;
324
+ }
325
+ }
326
+ /**
327
+ * Put the spatial skeleton up from a PREFIX generation, seconds into
328
+ * the parse instead of after it (conway#518).
329
+ *
330
+ * The spatial records sit at the file head on Revit exports — on PSB
331
+ * `IFCSITE` is record #211 — and a prefix generation is already
332
+ * everything the walk needs: a columns snapshot over a windowed
333
+ * provider, with `prepareDemandExtraction(true)` done, which is what
334
+ * makes `getLinearScalingFactor()` report real units rather than 1.
335
+ * So the plates can lead the first extracted product rather than
336
+ * trailing the whole parse, which is what the store path's three
337
+ * stacked latency gates (one product per tick, early products
338
+ * deferring on late placements, the walk waiting for the full index)
339
+ * added up to: a blank screen through the first ~60% of a 16.7 s
340
+ * parse.
341
+ *
342
+ * **Runs at most once successfully, on the parse's cooperative path.**
343
+ * The walk is reused as-is, with no internal budget: it awaits a
344
+ * residency ensure per spatial node and per sampled product placement
345
+ * (PRODUCT_SAMPLE per node), so its cost tracks the prefix's spatial
346
+ * tree, not the file. On the first qualifying generation that tree is
347
+ * small by construction — the storeys exist but few
348
+ * `IfcRelContainedInSpatialStructure` do — which is the same property
349
+ * that makes these early plates coarse. Retries are bounded without a
350
+ * counter: generations only rebuild on a GENERATION_GROWTH_FACTOR
351
+ * doubling of the index, so there are O(log records) of them.
352
+ *
353
+ * **The end-of-parse walk in the proxy is the refresh, not a
354
+ * duplicate.** It re-emits the same expressIDs with contained-product
355
+ * samples the prefix did not hold and under the frame the channel
356
+ * latched, and the consumer contract is that an `aabb` payload
357
+ * REPLACES the prior plate for its expressID. Double emission is the
358
+ * design; see PreviewMeshPayload.
359
+ *
360
+ * **Known gap in that contract, and it is a gap, not a subtlety.**
361
+ * Replacement only reaches nodes the final walk still emits, and the
362
+ * emit set is not stable between the two: `aabbMostlyEqual` collapses
363
+ * a single-child wrapper (Project over Site over Building) once its
364
+ * box matches its child's, which a prefix generation's degenerate
365
+ * boxes may not yet do. A wrapper emitted here and collapsed there is
366
+ * never replaced and never removed — the payload contract has no
367
+ * delete — so its early box lingers as one small plate until Share
368
+ * tears the preview scenery down at load end. Bounded (the wrapper
369
+ * chain is a handful of nodes, and the collapse needs exactly one
370
+ * child), but real. Closing it properly needs either a delete/
371
+ * generation channel in the payload contract or an emit set the two
372
+ * walks agree on, and both are consumer-side changes.
373
+ *
374
+ * @param model The prefix model.
375
+ * @param extraction Its prepared extraction.
376
+ * @return {Promise<void>} Settles when the walk has run or been skipped.
377
+ */
378
+ async maybeEmitEarlySpatialPlates_(model, extraction) {
379
+ // Same choice the proxy's imposterCoordination() makes: the latched
380
+ // preview frame when the open asked to coordinate, else identity.
381
+ const coordination = this.coordinateToOrigin_ ?
382
+ this.coordinationMatrix : IDENTITY_MAT4;
383
+ // This runs as a generation is BUILT, before that tick captures its
384
+ // first product — and capture is the only thing that latches a
385
+ // frame. So the first walk on a coordinating open always finds
386
+ // `undefined` here and takes the walk's fallback derivation, which
387
+ // its own docs describe as capable of a full site-offset on a file
388
+ // that bakes absolute coordinates into vertices behind identity
389
+ // placements. Waiting for a latched frame instead would put the
390
+ // skeleton back behind the deferred-placement gate this whole change
391
+ // exists to get in front of, so: emit now, and re-emit ONCE on a
392
+ // later generation as soon as a real frame exists. That second
393
+ // emission is exactly what the replace-by-expressID contract is for.
394
+ const usingFallbackFrame = coordination === void 0;
395
+ const canImproveFrame = this.earlyPlatesUsedFallbackFrame_ && !usingFallbackFrame;
396
+ if (this.earlyPlatesEmitted_ > 0 && !canImproveFrame) {
397
+ return;
398
+ }
399
+ try {
400
+ // Cheap prefix-sum reads, so this is affordable per generation.
401
+ // No storeys or no aggregate chain means the walk would emit
402
+ // nothing but still pay for the type scans. IfcProject and
403
+ // IfcUnitAssignment are in the guard for a different reason:
404
+ // `extractLinearScalingFactor` returns with the factor still at 1
405
+ // when it cannot resolve the project's UnitsInContext (it only
406
+ // logs), and a silent 1 on a millimetre model scales the whole
407
+ // skeleton 1000x — the conway#515 symptom. The project alone is
408
+ // not enough: a valid file may forward-reference its
409
+ // IfcUnitAssignment, so a prefix can hold the project while the
410
+ // units record is still ahead of the parse cursor, and because a
411
+ // successful walk latches `earlyPlatesEmitted_`, mis-scaled early
412
+ // plates would stand until the frame-improvement re-emit or the
413
+ // post-parse refresh (Codex review on #519). The guard therefore
414
+ // defers plates until the units record is indexed; a file with
415
+ // genuinely no unit assignment never emits EARLY plates and is
416
+ // covered by the end-of-parse walk instead.
417
+ if (model.typeCount(IfcProject) < 1 ||
418
+ model.typeCount(IfcUnitAssignment) < 1 ||
419
+ model.typeCount(IfcBuildingStorey) < 1 ||
420
+ model.typeCount(IfcRelAggregates) < 1) {
421
+ return;
422
+ }
423
+ const emitted = await emitSpatialStructureImposters(model, this.onMesh_, coordination, extraction.getLinearScalingFactor());
424
+ if (emitted > 0) {
425
+ this.earlyPlatesEmitted_ = emitted;
426
+ this.earlyPlatesUsedFallbackFrame_ = usingFallbackFrame;
427
+ }
428
+ }
429
+ catch {
430
+ // A failed early walk retries on the next generation; the
431
+ // end-of-parse walk covers it regardless.
432
+ }
433
+ }
434
+ disposeGeneration_() {
435
+ const active = this.generation_;
436
+ if (active === void 0) {
437
+ return;
438
+ }
439
+ try {
440
+ releaseModelGeometry(active.model.geometry);
441
+ }
442
+ catch {
443
+ // Never let a free break the open.
444
+ }
445
+ this.generation_ = void 0;
446
+ }
447
+ /**
448
+ * Copy newly extracted instances out of wasm — same placement math
449
+ * as {@link StreamedPreviewChannel}.
450
+ */
451
+ captureNewInstances_() {
452
+ const active = this.generation_;
453
+ if (active === void 0) {
454
+ return;
455
+ }
456
+ const { extraction, capturedCounts } = active;
457
+ const scene = extraction.scene;
458
+ const seenThisPass = new Map();
459
+ for (const walked of scene.walk()) {
460
+ const [, nativeTransform, geometry, material, entity] = walked;
461
+ if (entity?.localID === void 0 || entity.expressID === void 0) {
462
+ continue;
463
+ }
464
+ const walkIndex = seenThisPass.get(entity.localID) ?? 0;
465
+ seenThisPass.set(entity.localID, walkIndex + 1);
466
+ if (walkIndex < (capturedCounts.get(entity.localID) ?? 0)) {
467
+ continue;
468
+ }
469
+ capturedCounts.set(entity.localID, walkIndex + 1);
470
+ if (geometry.type !== CanonicalMeshType.BUFFER_GEOMETRY ||
471
+ geometry.temporary) {
472
+ continue;
473
+ }
474
+ const material_ = material ?? {
475
+ name: "",
476
+ baseColor: DEFAULT_COLOR,
477
+ legacyColor: DEFAULT_COLOR,
478
+ doubleSided: true,
479
+ blend: 0,
480
+ };
481
+ let nativePt;
482
+ if (this.coordinationMatrix === void 0 && this.coordinateToOrigin_) {
483
+ nativePt = geometry.geometry.getPoint(0);
484
+ }
485
+ const center = geometry.geometry.normalize();
486
+ const geometryExpressID = active.model.getElementByLocalID(geometry.localID)?.expressID ??
487
+ geometry.localID;
488
+ const geometryTransform = nativeTransform?.getValues();
489
+ if (this.coordinationMatrix === void 0 && this.coordinateToOrigin_) {
490
+ this.coordinationMatrix = deriveCoordinationF64(geometryTransform, nativePt, NORMALIZE_MAT_F64, extraction.getLinearScalingFactor());
491
+ }
492
+ const coordination = this.coordinationMatrix ?? glmatrix.mat4.create();
493
+ const newTransform = composeTransformF64(coordination, geometryTransform, center);
494
+ const payload = {
495
+ expressID: entity.expressID,
496
+ geometryExpressID,
497
+ color: {
498
+ x: material_.legacyColor[0],
499
+ y: material_.legacyColor[1],
500
+ z: material_.legacyColor[2],
501
+ w: material_.legacyColor[3],
502
+ },
503
+ flatTransformation: Array.from(newTransform),
504
+ };
505
+ if (!this.emittedGeometry_.has(geometryExpressID)) {
506
+ const nativeGeometry = geometry.geometry;
507
+ const vertexData = this.conwaywasm_.floatHeapSlice(nativeGeometry.GetVertexData(), nativeGeometry.GetVertexDataSize()).slice();
508
+ const indexData = this.conwaywasm_.uint32HeapSlice(nativeGeometry.GetIndexData(), nativeGeometry.GetIndexDataSize()).slice();
509
+ if (vertexData.length < FLOATS_PER_VERTEX || indexData.length === 0) {
510
+ continue;
511
+ }
512
+ payload.vertexData = vertexData;
513
+ payload.indexData = indexData;
514
+ this.emittedGeometry_.add(geometryExpressID);
515
+ this.emittedBytes_ +=
516
+ (vertexData.length + indexData.length) * BYTES_PER_FLOAT;
517
+ }
518
+ this.onMesh_(payload);
519
+ if (this.emittedBytes_ >= this.maxBytes) {
520
+ return;
521
+ }
522
+ }
523
+ }
524
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=store_preview_channel.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store_preview_channel.test.d.ts","sourceRoot":"","sources":["../../../../src/compat/web-ifc/store_preview_channel.test.ts"],"names":[],"mappings":""}