@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,580 @@
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 { IfcProduct } from "../../ifc/ifc4_gen/index.js";
5
+ import AP214StepModel from "../../AP214E3_2010/ap214_step_model.js";
6
+ import { AP214GeometryExtraction, } from "../../AP214E3_2010/ap214_geometry_extraction.js";
7
+ import { cursorIterator } from "../../indexing/cursor_utilities.js";
8
+ import * as glmatrix from "gl-matrix";
9
+ import { composeTransformF64, deriveCoordinationF64, NORMALIZE_MAT_F64, } from "./coordination_f64.js";
10
+ /* eslint-disable no-magic-numbers */
11
+ /** Initial ms between preview pump ticks (interleaves with the parse's
12
+ * yields). The interval decays (TICK_INTERVAL_GROWTH per tick, capped at
13
+ * TICK_INTERVAL_MAX_MS): dense ticking in the first seconds delivers the
14
+ * immediate-feedback wow, then the channel backs off so a long parse
15
+ * isn't taxed all the way through. */
16
+ const TICK_INTERVAL_MS = 150;
17
+ const TICK_INTERVAL_MAX_MS = 600;
18
+ const TICK_INTERVAL_GROWTH = 1.1;
19
+ /** Extraction + capture time budget per tick, so the parse keeps most of
20
+ * the main thread (~25/150 ≈ 17% worst-case preview share). */
21
+ const TICK_BUDGET_MS = 25;
22
+ /** Don't build the first generation before this many top-level records —
23
+ * below it the prefix rarely contains a placeable product. */
24
+ const FIRST_GENERATION_MIN_RECORDS = 1024;
25
+ /** A new generation only when the index grew this much past the previous
26
+ * snapshot (bounds snapshot copies to O(GROWTH/(GROWTH-1)) of the file). */
27
+ const GENERATION_GROWTH_FACTOR = 2;
28
+ /** Default cap on units the preview channel ever extracts. Preview
29
+ * generations are throwaway extractions whose native geometry is not
30
+ * reclaimed until page teardown (the shim never frees classic scenes
31
+ * either — see closeModel), so the cap bounds that one-time cost. */
32
+ const DEFAULT_MAX_PREVIEW_UNITS = 4096;
33
+ /** Default cap on total payload bytes copied out to the consumer. */
34
+ const DEFAULT_MAX_PREVIEW_BYTES = 48 * 1024 * 1024;
35
+ const FLOATS_PER_VERTEX = 6;
36
+ const BYTES_PER_FLOAT = 4;
37
+ const DEFAULT_COLOR = [0.8, 0.8, 0.8, 1];
38
+ /**
39
+ * IFC adapter: units are IfcProducts in localID order (stable across
40
+ * prefix growth), extracted through the per-product demand seam.
41
+ *
42
+ * @return {PreviewSchemaAdapter} The adapter.
43
+ */
44
+ export function ifcPreviewAdapter() {
45
+ return {
46
+ buildGeneration(data, conwaywasm, columns) {
47
+ const model = new IfcStepModel(data, columns);
48
+ // Enumerate product localIDs straight off the type index — NO
49
+ // entity materialization (a per-generation sweep of 50k+ product
50
+ // entities was a dominant channel cost on PSB-class models).
51
+ const products = [];
52
+ for (const localID of cursorIterator(model.typeIndex.cursor(...IfcProduct.query))) {
53
+ products.push(localID);
54
+ }
55
+ if (products.length === 0) {
56
+ return void 0;
57
+ }
58
+ const extraction = new IfcGeometryExtraction(conwaywasm, model);
59
+ // Prefix extractions hit representation items whose style/select
60
+ // references aren't parsed yet — expected on a truncated tail;
61
+ // don't flood the report (DOWA: 1164 styled-item errors).
62
+ extraction.quietRecoverableLogging = true;
63
+ // A product whose placement records sit beyond this prefix must
64
+ // defer, not extract unplaced: Revit writes placements near the
65
+ // end of the file, so an early product can reference a placement
66
+ // the index does not hold yet. Lenient reads null the dangling
67
+ // reference and the product extracts at the origin — on a
68
+ // georeferenced model the emitted payloads then sit a site-offset
69
+ // away from the model (Share#1744: Snowdon's door #5014 put 88
70
+ // payloads ~425km out, and the camera follow framed them). The
71
+ // per-unit catch below already treats a throwing product as
72
+ // not-yet-extractable; this makes a dangling placement throw like
73
+ // any other unparsed forward reference. The classic-mode cursor
74
+ // does not re-run passed units, so a deferred product sits out
75
+ // the preview and the durable pump renders it — an empty slot,
76
+ // never geometry at the wrong placement.
77
+ extraction.deferDanglingPlacements = true;
78
+ // Preview-only preparation: skip the relationship sweeps whose
79
+ // entity materialization dominates per-generation cost.
80
+ extraction.prepareDemandExtraction(true);
81
+ return {
82
+ scene: extraction.scene,
83
+ unitCount: products.length,
84
+ get linearScalingFactor() {
85
+ return extraction.getLinearScalingFactor();
86
+ },
87
+ runUnits: (from, count) => {
88
+ const end = Math.min(from + count, products.length);
89
+ let executed = 0;
90
+ for (let where = from; where < end; ++where) {
91
+ try {
92
+ if (extraction.extractProductGeometryByLocalID(products[where])) {
93
+ ++executed;
94
+ }
95
+ }
96
+ catch {
97
+ // Unparsed forward reference — the durable pump extracts
98
+ // this product from the full model later.
99
+ }
100
+ }
101
+ return executed;
102
+ },
103
+ geometryExpressID: (geometryLocalID) => model.getElementByLocalID(geometryLocalID)?.expressID,
104
+ recenter: true,
105
+ dispose: () => {
106
+ releaseModelGeometry(model.geometry);
107
+ },
108
+ };
109
+ },
110
+ };
111
+ }
112
+ /**
113
+ * Free every buffer-geometry canonical mesh a model geometry cache
114
+ * holds (native embind objects), leaving the cache empty. Safe on an
115
+ * already-released cache.
116
+ *
117
+ * @param geometry The model geometry cache (iterable of canonical
118
+ * meshes with a delete(localID)).
119
+ */
120
+ export function releaseModelGeometry(geometry) {
121
+ const localIDs = [];
122
+ for (const mesh of geometry) {
123
+ localIDs.push(mesh.localID);
124
+ }
125
+ for (const localID of localIDs) {
126
+ try {
127
+ geometry.delete(localID);
128
+ }
129
+ catch {
130
+ // Never let a free break a load — leaked is better than crashed.
131
+ }
132
+ }
133
+ }
134
+ /**
135
+ * AP214 adapter: units are assembly-tree units (see
136
+ * AP214GeometryExtraction.prepareDemandExtraction). Unit ordinals are
137
+ * only approximately stable across prefix growth (a root's child list
138
+ * can grow, shifting later ordinals) — for a preview that is
139
+ * acceptable: a shifted ordinal re-emits an instance at an identical
140
+ * placement (invisible overlap) or skips one (the durable pump renders
141
+ * it later).
142
+ *
143
+ * @return {PreviewSchemaAdapter} The adapter.
144
+ */
145
+ export function ap214PreviewAdapter() {
146
+ return {
147
+ retryEmptyUnits: true,
148
+ buildGeneration(data, conwaywasm, columns) {
149
+ const model = new AP214StepModel(data, columns);
150
+ const extraction = new AP214GeometryExtraction(conwaywasm, model);
151
+ // Prefix extractions hit dangling records by construction —
152
+ // don't let their expected per-record errors flood the report
153
+ // (Arty: 5k+ styled-item warnings across generations).
154
+ extraction.quietRecoverableLogging = true;
155
+ extraction.prepareDemandExtraction();
156
+ if (extraction.demandUnitCount === 0) {
157
+ return void 0;
158
+ }
159
+ return {
160
+ scene: extraction.scene,
161
+ unitCount: extraction.demandUnitCount,
162
+ get linearScalingFactor() {
163
+ return extraction.getLinearScalingFactor();
164
+ },
165
+ runUnits: (from, count) => {
166
+ if (extraction.demandUnitCursor < from) {
167
+ extraction.skipDemandUnits(from - extraction.demandUnitCursor);
168
+ }
169
+ return extraction.extractDemandUnitBatch(count);
170
+ },
171
+ geometryExpressID: (geometryLocalID) => model.getElementByLocalID(geometryLocalID)?.expressID,
172
+ recenter: false,
173
+ dispose: () => {
174
+ releaseModelGeometry(model.geometry);
175
+ },
176
+ };
177
+ },
178
+ };
179
+ }
180
+ /**
181
+ * Parse-time preview channel (demand/tiled rendering slice A2): while a
182
+ * deferred streamed open is still parsing, periodically snapshot the
183
+ * growing columnar index into a PREFIX model, extract a bounded number of
184
+ * units through a throwaway extraction, and emit self-contained mesh
185
+ * payloads — first pixels within the first seconds of a large parse
186
+ * instead of after it. Schema knowledge lives in the
187
+ * {@link PreviewSchemaAdapter}; the channel owns scheduling, generations,
188
+ * watermarks, payload copies, caps and the coordination pin.
189
+ *
190
+ * Preview quality, by construction: relationship records (IFC voids,
191
+ * materials, styled items) spread to the very end of real files
192
+ * (measured ~92–97% depth), so a prefix extraction can miss
193
+ * openings and materials. That is why these extractions are throwaway:
194
+ * the durable batch pump after the parse re-extracts every unit with the
195
+ * full model and REPLACES the preview — final geometry parity is
196
+ * untouched by this channel.
197
+ *
198
+ * Scheduling: the cooperative parse yields to the event loop via
199
+ * macrotasks every ~50ms; each pump tick runs in one of those gaps under
200
+ * a hard time budget, so the parse keeps the bulk of the main thread.
201
+ */
202
+ export class StreamedPreviewChannel {
203
+ /**
204
+ * @param data The (fully resident) source buffer the parse is indexing.
205
+ * @param conwaywasm The shared geometry wasm wrapper (sequential use only
206
+ * — ticks run between parse yields, never concurrently with the durable
207
+ * extraction, which is created after the parse completes).
208
+ * @param sink The live columnar sink the streamed parse is filling.
209
+ * @param adapter The schema adapter building prefix generations.
210
+ * @param coordinateToOrigin The open's COORDINATE_TO_ORIGIN setting.
211
+ * @param onMesh Consumer callback for each preview payload.
212
+ * @param maxUnits Cap on units ever preview-extracted.
213
+ * @param maxBytes Cap on total payload bytes copied out.
214
+ * @param firstGenerationMinRecords Records required before the first
215
+ * snapshot (tests lower it for tiny fixtures).
216
+ */
217
+ constructor(data, conwaywasm, sink, adapter, coordinateToOrigin, onMesh, maxUnits = DEFAULT_MAX_PREVIEW_UNITS, maxBytes = DEFAULT_MAX_PREVIEW_BYTES, firstGenerationMinRecords = FIRST_GENERATION_MIN_RECORDS) {
218
+ this.data = data;
219
+ this.conwaywasm = conwaywasm;
220
+ this.sink = sink;
221
+ this.adapter = adapter;
222
+ this.coordinateToOrigin = coordinateToOrigin;
223
+ this.onMesh = onMesh;
224
+ this.maxUnits = maxUnits;
225
+ this.maxBytes = maxBytes;
226
+ this.firstGenerationMinRecords = firstGenerationMinRecords;
227
+ this.stopped_ = false;
228
+ this.emittedUnits_ = 0;
229
+ this.emittedBytes_ = 0;
230
+ /** Ordinal cursor into the unit list (see the adapter's stability
231
+ * notes). */
232
+ this.unitOrdinal_ = 0;
233
+ /** Retry mode (adapter.retryEmptyUnits): ordinals that captured ≥ 1
234
+ * instance — done for good, skipped on later generations. */
235
+ this.completedUnits_ = new Set();
236
+ /** Retry mode: scan position within the CURRENT generation (resets to
237
+ * 0 on every new generation so empty units get re-run). */
238
+ this.retryScan_ = 0;
239
+ /** Geometry expressIDs whose payload has been emitted (cross-generation
240
+ * dedup for mapped/shared geometry). */
241
+ this.emittedGeometry_ = new Set();
242
+ this.lastSnapshotRecords_ = 0;
243
+ /** Records at the last snapshot whose generation build THREW (a
244
+ * structurally incomplete prefix) — gates retries to index growth so a
245
+ * throwing prefix build can't hot-loop every tick. */
246
+ this.lastFailedSnapshotRecords_ = 0;
247
+ this.lastInlineTick_ = 0;
248
+ this.tickIntervalMs_ = TICK_INTERVAL_MS;
249
+ // A field rather than reading TICK_BUDGET_MS directly, so a test can lift
250
+ // the wall-clock bound the way it already lifts tickIntervalMs_. Asserting
251
+ // "this tick ran all N units" against a real 25ms budget is a coin flip on
252
+ // a loaded runner: the retryEmptyUnits test expected [0,1,2] and got [0,1]
253
+ // in CI while passing locally. Production behaviour is unchanged.
254
+ this.tickBudgetMs_ = TICK_BUDGET_MS;
255
+ }
256
+ /** Begin ticking (call just before awaiting the parse). */
257
+ start() {
258
+ this.schedule_();
259
+ }
260
+ /**
261
+ * Tick inline if one is due — called from the parse's own progress
262
+ * callback, so the channel keeps its cadence even when the event
263
+ * loop's timer queue is starved (browser: the cooperative parse
264
+ * yields via scheduler.yield / MessageChannel, whose continuations
265
+ * outrank setTimeout; the 150ms timer ticks barely ran on PSB-class
266
+ * parses, starving the preview until parse end). The timer remains
267
+ * as a fallback for gaps between progress calls.
268
+ */
269
+ maybeTickInline() {
270
+ if (this.stopped_ || this.capped) {
271
+ return;
272
+ }
273
+ const now = Date.now();
274
+ if (now - this.lastInlineTick_ < this.tickIntervalMs_) {
275
+ return;
276
+ }
277
+ this.lastInlineTick_ = now;
278
+ this.tickIntervalMs_ =
279
+ Math.min(this.tickIntervalMs_ * TICK_INTERVAL_GROWTH, TICK_INTERVAL_MAX_MS);
280
+ try {
281
+ this.tick_();
282
+ }
283
+ catch {
284
+ // A preview failure must never break the open.
285
+ this.stopped_ = true;
286
+ }
287
+ }
288
+ /**
289
+ * Stop ticking (call once the parse settles, before finalize/fallback).
290
+ * Idempotent; no tick runs after this returns (ticks are synchronous and
291
+ * scheduled on the same event loop).
292
+ */
293
+ stop() {
294
+ this.stopped_ = true;
295
+ if (this.timer_ !== void 0) {
296
+ clearTimeout(this.timer_);
297
+ this.timer_ = void 0;
298
+ }
299
+ // Payloads are copies — a stopped channel's throwaway scenes hold
300
+ // nothing anyone can reference. Free them so repeated loads in one
301
+ // tab reuse the wasm pages instead of stacking preview scenes.
302
+ try {
303
+ this.generation_?.generation.dispose();
304
+ }
305
+ catch {
306
+ // Never let a free break the open.
307
+ }
308
+ this.generation_ = void 0;
309
+ }
310
+ /** True when a cap was hit and the channel retired itself early. */
311
+ get capped() {
312
+ return this.emittedUnits_ >= this.maxUnits ||
313
+ this.emittedBytes_ >= this.maxBytes;
314
+ }
315
+ // eslint-disable-next-line require-jsdoc
316
+ schedule_() {
317
+ if (this.stopped_ || this.capped) {
318
+ return;
319
+ }
320
+ this.timer_ = setTimeout(() => {
321
+ this.timer_ = void 0;
322
+ try {
323
+ this.tick_();
324
+ }
325
+ catch {
326
+ // A preview failure must never break the open — retire quietly;
327
+ // the durable pump renders everything after the parse.
328
+ this.stopped_ = true;
329
+ }
330
+ this.schedule_();
331
+ }, this.tickIntervalMs_);
332
+ }
333
+ /**
334
+ * One pump tick: ensure a generation with pending units exists, then
335
+ * extract + capture under the time budget.
336
+ */
337
+ tick_() {
338
+ const deadline = Date.now() + this.tickBudgetMs_;
339
+ if (!this.ensureGeneration_()) {
340
+ return;
341
+ }
342
+ const active = this.generation_;
343
+ const { generation } = active;
344
+ if (this.adapter.retryEmptyUnits === true) {
345
+ // Retry mode: scan the fixed unit list, skipping units that
346
+ // already captured instances on an earlier (or this) generation.
347
+ // Capture runs per unit so completion can be attributed — unit
348
+ // counts here are small by construction (assembly roots).
349
+ while (this.retryScan_ < generation.unitCount &&
350
+ this.emittedUnits_ < this.maxUnits &&
351
+ Date.now() < deadline) {
352
+ const ordinal = this.retryScan_++;
353
+ if (this.completedUnits_.has(ordinal)) {
354
+ continue;
355
+ }
356
+ const executed = generation.runUnits(ordinal, 1);
357
+ if (executed > 0 && this.captureNewInstances_() > 0) {
358
+ this.completedUnits_.add(ordinal);
359
+ ++this.emittedUnits_;
360
+ }
361
+ }
362
+ return;
363
+ }
364
+ let extractedThisTick = 0;
365
+ while (this.unitOrdinal_ < generation.unitCount &&
366
+ this.emittedUnits_ + extractedThisTick < this.maxUnits &&
367
+ Date.now() < deadline) {
368
+ const executed = generation.runUnits(this.unitOrdinal_, 1);
369
+ ++this.unitOrdinal_;
370
+ extractedThisTick += executed;
371
+ }
372
+ if (extractedThisTick > 0) {
373
+ this.captureNewInstances_();
374
+ this.emittedUnits_ += extractedThisTick;
375
+ }
376
+ }
377
+ /**
378
+ * Ensure a generation with pending units: keep the current one while
379
+ * it has work; otherwise snapshot a fresh prefix model once the index
380
+ * has grown enough to be worth the copy.
381
+ *
382
+ * @return {boolean} True when a generation with pending units exists.
383
+ */
384
+ ensureGeneration_() {
385
+ const active = this.generation_;
386
+ if (active !== void 0 && this.hasPendingUnits_(active.generation)) {
387
+ return true;
388
+ }
389
+ const records = this.sink.topLevelCount;
390
+ if (records < this.firstGenerationMinRecords) {
391
+ return false;
392
+ }
393
+ if (active !== void 0 &&
394
+ records < this.lastSnapshotRecords_ * GENERATION_GROWTH_FACTOR) {
395
+ return false;
396
+ }
397
+ if (records < this.lastFailedSnapshotRecords_ * GENERATION_GROWTH_FACTOR) {
398
+ return false;
399
+ }
400
+ const columns = this.sink.snapshot();
401
+ let generation;
402
+ try {
403
+ generation =
404
+ this.adapter.buildGeneration(this.data, this.conwaywasm, columns);
405
+ }
406
+ catch {
407
+ // A mid-parse prefix can be structurally incomplete — dangling
408
+ // references throw schema-typed errors (AP214's assembly-tree
409
+ // prep especially; a bad prefix killed the whole STEP preview
410
+ // before this catch). That retires THIS attempt, not the
411
+ // channel: the growth gate above retries once the index has
412
+ // grown enough for a materially different prefix.
413
+ this.lastFailedSnapshotRecords_ = records;
414
+ return false;
415
+ }
416
+ this.lastFailedSnapshotRecords_ = 0;
417
+ this.lastSnapshotRecords_ = records;
418
+ if (generation === void 0) {
419
+ // Prefix grew but cannot build yet — wait for more records.
420
+ return false;
421
+ }
422
+ const newGenerationPending = this.adapter.retryEmptyUnits === true ?
423
+ generation.unitCount > 0 &&
424
+ this.completedUnits_.size < generation.unitCount :
425
+ generation.unitCount > this.unitOrdinal_;
426
+ if (!newGenerationPending) {
427
+ // Nothing this prefix can add — free it and wait for more records.
428
+ // (The active generation, if any, keeps its scan state untouched.)
429
+ try {
430
+ generation.dispose();
431
+ }
432
+ catch {
433
+ // Never let a free break the open.
434
+ }
435
+ return false;
436
+ }
437
+ // Retry mode: a fresh generation re-runs every not-yet-captured unit.
438
+ this.retryScan_ = 0;
439
+ // The outgoing generation's instances are all captured (a
440
+ // generation is only replaced once exhausted + captured) — free its
441
+ // native scenes before adopting the new one.
442
+ try {
443
+ active?.generation.dispose();
444
+ }
445
+ catch {
446
+ // Never let a free break the open.
447
+ }
448
+ this.generation_ = {
449
+ generation,
450
+ capturedCounts: new Map(),
451
+ };
452
+ return true;
453
+ }
454
+ /**
455
+ * Does the given generation still have units this channel would run —
456
+ * retry mode: not-yet-captured ordinals ahead of the scan; classic
457
+ * mode: ordinals beyond the global forward-only cursor.
458
+ *
459
+ * @param generation The generation to check.
460
+ * @return {boolean} True when a tick can make progress on it.
461
+ */
462
+ hasPendingUnits_(generation) {
463
+ if (this.adapter.retryEmptyUnits === true) {
464
+ return this.retryScan_ < generation.unitCount &&
465
+ this.completedUnits_.size < generation.unitCount;
466
+ }
467
+ return this.unitOrdinal_ < generation.unitCount;
468
+ }
469
+ /**
470
+ * Walk the current generation's scene and emit every not-yet-captured
471
+ * placed instance as a payload — the preview twin of the durable delta
472
+ * captures, with the same placed-geometry math per schema (recentering
473
+ * for IFC, bare composition for AP214) so preview and durable
474
+ * placements coincide, but copying geometry OUT of the wasm heap
475
+ * instead of retaining native references.
476
+ *
477
+ * @return {number} Instances emitted by this pass (retry mode uses
478
+ * this to attribute unit completion).
479
+ */
480
+ captureNewInstances_() {
481
+ const active = this.generation_;
482
+ const { generation, capturedCounts } = active;
483
+ const { scene, recenter } = generation;
484
+ const linearScalingFactor = generation.linearScalingFactor;
485
+ const seenThisPass = new Map();
486
+ let emitted = 0;
487
+ for (const walked of scene.walk()) {
488
+ const [, nativeTransform, geometry, material, entity] = walked;
489
+ if (entity?.localID === void 0 || entity.expressID === void 0) {
490
+ continue;
491
+ }
492
+ const walkIndex = seenThisPass.get(entity.localID) ?? 0;
493
+ seenThisPass.set(entity.localID, walkIndex + 1);
494
+ if (walkIndex < (capturedCounts.get(entity.localID) ?? 0)) {
495
+ continue;
496
+ }
497
+ capturedCounts.set(entity.localID, walkIndex + 1);
498
+ if (geometry.type !== CanonicalMeshType.BUFFER_GEOMETRY || geometry.temporary) {
499
+ continue;
500
+ }
501
+ const material_ = material ?? {
502
+ name: "",
503
+ baseColor: DEFAULT_COLOR,
504
+ legacyColor: DEFAULT_COLOR,
505
+ doubleSided: true,
506
+ blend: 0,
507
+ };
508
+ let nativePt;
509
+ if (this.coordinationMatrix === void 0 && this.coordinateToOrigin) {
510
+ nativePt = geometry.geometry.getPoint(0);
511
+ }
512
+ // normalize() recenters the geometry buffer (side effect) and returns
513
+ // the local centre; only the per-leaf recenter path (IFC) applies it —
514
+ // AP214 shares one buffer and composes bare (issue #308).
515
+ const center = recenter ? geometry.geometry.normalize() : undefined;
516
+ const geometryExpressID = generation.geometryExpressID(geometry.localID);
517
+ // Full-precision float64 placement straight from the wasm boundary
518
+ // (glm::dmat4) — never truncated through a gl-matrix Float32Array;
519
+ // the recentre math runs in double precision (see coordination_f64).
520
+ const geometryTransform = nativeTransform?.getValues();
521
+ if (this.coordinationMatrix === void 0 && this.coordinateToOrigin) {
522
+ this.coordinationMatrix = deriveCoordinationF64(geometryTransform, nativePt, NORMALIZE_MAT_F64, linearScalingFactor);
523
+ }
524
+ const coordination = this.coordinationMatrix ?? glmatrix.mat4.create();
525
+ const newTransform = composeTransformF64(coordination, geometryTransform, center);
526
+ const payload = {
527
+ expressID: entity.expressID,
528
+ geometryExpressID,
529
+ color: {
530
+ x: material_.legacyColor[0],
531
+ y: material_.legacyColor[1],
532
+ z: material_.legacyColor[2],
533
+ w: material_.legacyColor[3],
534
+ },
535
+ flatTransformation: Array.from(newTransform),
536
+ };
537
+ if (!this.emittedGeometry_.has(geometryExpressID)) {
538
+ const nativeGeometry = geometry.geometry;
539
+ const vertexData = this.conwaywasm.floatHeapSlice(nativeGeometry.GetVertexData(), nativeGeometry.GetVertexDataSize()).slice();
540
+ const indexData = this.conwaywasm.uint32HeapSlice(nativeGeometry.GetIndexData(), nativeGeometry.GetIndexDataSize()).slice();
541
+ if (vertexData.length < FLOATS_PER_VERTEX || indexData.length === 0) {
542
+ continue;
543
+ }
544
+ payload.vertexData = vertexData;
545
+ payload.indexData = indexData;
546
+ this.emittedGeometry_.add(geometryExpressID);
547
+ this.emittedBytes_ +=
548
+ (vertexData.length + indexData.length) * BYTES_PER_FLOAT;
549
+ }
550
+ this.onMesh(payload);
551
+ ++emitted;
552
+ if (this.emittedBytes_ >= this.maxBytes) {
553
+ return emitted;
554
+ }
555
+ }
556
+ return emitted;
557
+ }
558
+ /**
559
+ * Test seam: run generation building + extraction + capture synchronously
560
+ * until either every unit currently in the sink is attempted or a cap
561
+ * is hit — what the timer-driven ticks do, without the timers.
562
+ */
563
+ drainForTest() {
564
+ for (;;) {
565
+ if (this.capped || !this.ensureGeneration_()) {
566
+ return;
567
+ }
568
+ const active = this.generation_;
569
+ if (this.unitOrdinal_ >= active.generation.unitCount) {
570
+ return;
571
+ }
572
+ const executed = active.generation.runUnits(this.unitOrdinal_, 1);
573
+ ++this.unitOrdinal_;
574
+ if (executed > 0) {
575
+ this.captureNewInstances_();
576
+ ++this.emittedUnits_;
577
+ }
578
+ }
579
+ }
580
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=web_wasm_directory.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web_wasm_directory.test.d.ts","sourceRoot":"","sources":["../../../../src/compat/web-ifc/web_wasm_directory.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ // The wasm-directory normalization behind the isolated-context module
2
+ // prefix (Share #1610): embedder SetWasmPath values are site-root-
3
+ // relative by convention and must come out as absolute directories,
4
+ // since they become runtime dynamic-import prefixes whose resolution
5
+ // must not depend on the page or bundle URL (the pthread worker script
6
+ // URL derives from the imported module's import.meta.url).
7
+ import { describe, expect, test } from "@jest/globals";
8
+ import { webWasmDirectory } from "./ifc_api.js";
9
+ describe("webWasmDirectory", () => {
10
+ test("site-root-relative convention absolutizes", () => {
11
+ expect(webWasmDirectory("./static/js/")).toBe("/static/js/");
12
+ expect(webWasmDirectory("static/js/")).toBe("/static/js/");
13
+ });
14
+ test("absolute paths pass through with a trailing slash ensured", () => {
15
+ expect(webWasmDirectory("/static/js/")).toBe("/static/js/");
16
+ expect(webWasmDirectory("/wasm")).toBe("/wasm/");
17
+ });
18
+ test("missing input falls back to the conventional serve directory", () => {
19
+ expect(webWasmDirectory(undefined)).toBe("/static/js/");
20
+ expect(webWasmDirectory("")).toBe("/static/js/");
21
+ });
22
+ });
@@ -0,0 +1,63 @@
1
+ import { StepEntityConstructorAbstract } from "../step/step_entity_constructor.js";
2
+ import { EntityAddress } from "./model_uri.js";
3
+ import { ModelRegistry } from "./model_registry.js";
4
+ /**
5
+ * A model that can answer a type query — the minimum a federated model must
6
+ * expose to take part in cross-file composition. Both the resident model's
7
+ * type index and the streaming {@link IncrementalTypeIndex} satisfy this, so a
8
+ * composed view works whether its members are fully parsed or still streaming.
9
+ */
10
+ export interface TypeQueryableModel<TypeIDType extends number> {
11
+ /**
12
+ * Express IDs of all records of the given types (including subtypes).
13
+ *
14
+ * @param types The entity constructors to query.
15
+ * @return {IterableIterator<number>} The matching express IDs.
16
+ */
17
+ expressIDsOfTypes(...types: StepEntityConstructorAbstract<TypeIDType>[]): IterableIterator<number>;
18
+ }
19
+ /**
20
+ * A composed view over every model in a {@link ModelRegistry} (M5 / design S3).
21
+ *
22
+ * Federation's read side: a site plan that references per-building files, or a
23
+ * project split across disciplines, is browsed as **one** model whose entities
24
+ * carry universal {@link EntityAddress}es (`modelURI#expressID`). A type query
25
+ * here fans out across all registered members and yields addresses, not bare
26
+ * express IDs — so "every `IfcWall` in the project" spans files, and each
27
+ * result round-trips back through {@link ModelRegistry.resolve} to the right
28
+ * model.
29
+ *
30
+ * This is the composition scaffold: it unions the members' type skeletons
31
+ * under the shared address space. The spatial-containment merge (a site's
32
+ * `IfcRelAggregates` linking to building files) layers on top by resolving the
33
+ * cross-file references the {@link CrossReferenceRegistry} discovers — the next
34
+ * increment, gated on the loader registering streamed models here.
35
+ */
36
+ export declare class ComposedModelSkeleton<TypeIDType extends number, H extends TypeQueryableModel<TypeIDType>> {
37
+ private readonly registry_;
38
+ /**
39
+ * @param registry_ The registry whose models this composes over.
40
+ */
41
+ constructor(registry_: ModelRegistry<H>);
42
+ /**
43
+ * @return {ModelRegistry<H>} The registry backing this composed view.
44
+ */
45
+ get registry(): ModelRegistry<H>;
46
+ /**
47
+ * Yield the universal address of every entity of the given types across all
48
+ * registered models.
49
+ *
50
+ * @param types The entity constructors to query (subtype closures unioned).
51
+ * @return {IterableIterator<EntityAddress>} Addresses of matching entities.
52
+ * @yields {EntityAddress} Each matching entity's universal address.
53
+ */
54
+ entitiesOfType(...types: StepEntityConstructorAbstract<TypeIDType>[]): IterableIterator<EntityAddress>;
55
+ /**
56
+ * Count entities of the given types across all registered models.
57
+ *
58
+ * @param types The entity constructors to count.
59
+ * @return {number} The total across the federation.
60
+ */
61
+ countOfType(...types: StepEntityConstructorAbstract<TypeIDType>[]): number;
62
+ }
63
+ //# sourceMappingURL=composed_model_skeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composed_model_skeleton.d.ts","sourceRoot":"","sources":["../../../src/core/composed_model_skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGhD;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,UAAU,SAAS,MAAM;IAE3D;;;;;OAKG;IACH,iBAAiB,CACf,GAAG,KAAK,EAAE,6BAA6B,CAAC,UAAU,CAAC,EAAE,GAAI,gBAAgB,CAAC,MAAM,CAAC,CAAA;CACpF;AAGD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,qBAAqB,CAChC,UAAU,SAAS,MAAM,EACzB,CAAC,SAAS,kBAAkB,CAAC,UAAU,CAAC;IAK3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAHvC;;OAEG;gBAC2B,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAEzD;;OAEG;IACH,IAAW,QAAQ,IAAI,aAAa,CAAC,CAAC,CAAC,CAEtC;IAED;;;;;;;OAOG;IACK,cAAc,CAClB,GAAG,KAAK,EAAE,6BAA6B,CAAC,UAAU,CAAC,EAAE,GACrD,gBAAgB,CAAC,aAAa,CAAC;IAgBnC;;;;;OAKG;IACI,WAAW,CACd,GAAG,KAAK,EAAE,6BAA6B,CAAC,UAAU,CAAC,EAAE,GAAI,MAAM;CAapE"}