@bldrs-ai/conway 1.389.1221 → 1.394.1504

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/README.md +36 -22
  2. package/compiled/Dist/ConwayGeomWasmNode.js +0 -0
  3. package/compiled/Dist/ConwayGeomWasmNodeMT.js +0 -0
  4. package/compiled/Dist/ConwayGeomWasmWeb.js +0 -0
  5. package/compiled/Dist/ConwayGeomWasmWebMT.js +1 -1
  6. package/compiled/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  7. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNode.js +0 -0
  8. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNodeMT.js +0 -0
  9. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWeb.js +0 -0
  10. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.js +1 -1
  11. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  12. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts +19 -0
  13. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts.map +1 -1
  14. package/compiled/dependencies/conway-geom/interface/conway_geometry.js +17 -0
  15. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts +6 -0
  16. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts.map +1 -1
  17. package/compiled/examples/browser-bundled.cjs +1569 -51
  18. package/compiled/examples/cli-bundled.cjs +2790 -436
  19. package/compiled/examples/cli-step-bundled.cjs +1904 -229
  20. package/compiled/examples/validator-bundled.cjs +1569 -51
  21. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts +2 -2
  22. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts.map +1 -1
  23. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.js +2 -2
  24. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts +3 -3
  25. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts.map +1 -1
  26. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.js +3 -3
  27. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts +1 -1
  28. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts.map +1 -1
  29. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.js +1 -1
  30. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts +1 -1
  31. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts.map +1 -1
  32. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.js +1 -1
  33. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts +1 -1
  34. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts.map +1 -1
  35. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.js +1 -1
  36. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts +1 -1
  37. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts.map +1 -1
  38. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.js +1 -1
  39. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.d.ts.map +1 -1
  40. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.js +2 -2
  41. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/schema_ap214.gen.js +11 -11
  42. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts +1 -1
  43. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts.map +1 -1
  44. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.js +1 -1
  45. package/compiled/src/AP214E3_2010/ap214_command_line_main.js +7 -3
  46. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +181 -7
  47. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
  48. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +906 -137
  49. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.test.js +10 -2
  50. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts +2 -0
  51. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts.map +1 -0
  52. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.js +114 -0
  53. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts +6 -0
  54. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts.map +1 -1
  55. package/compiled/src/AP214E3_2010/ap214_model_geometry.js +9 -0
  56. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts +2 -0
  57. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts.map +1 -0
  58. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.js +233 -0
  59. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts +2 -0
  60. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts.map +1 -0
  61. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.js +147 -0
  62. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts +2 -1
  63. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts.map +1 -1
  64. package/compiled/src/AP214E3_2010/ap214_step_model.js +1 -1
  65. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts +2 -0
  66. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts.map +1 -0
  67. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.js +65 -0
  68. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts +2 -0
  69. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts.map +1 -0
  70. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.js +111 -0
  71. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts +2 -0
  72. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts.map +1 -0
  73. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.js +190 -0
  74. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts +2 -0
  75. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts.map +1 -0
  76. package/compiled/src/compat/web-ifc/coordination_export_order.test.js +110 -0
  77. package/compiled/src/compat/web-ifc/coordination_f64.d.ts +165 -0
  78. package/compiled/src/compat/web-ifc/coordination_f64.d.ts.map +1 -0
  79. package/compiled/src/compat/web-ifc/coordination_f64.js +286 -0
  80. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts +2 -0
  81. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts.map +1 -0
  82. package/compiled/src/compat/web-ifc/coordination_f64.test.js +225 -0
  83. package/compiled/src/compat/web-ifc/ifc_api.d.ts +154 -0
  84. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  85. package/compiled/src/compat/web-ifc/ifc_api.js +211 -3
  86. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts +2 -0
  87. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts.map +1 -0
  88. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.js +288 -0
  89. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +39 -0
  90. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  91. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts +30 -0
  92. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts.map +1 -1
  93. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.js +83 -0
  94. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts +2 -0
  95. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts.map +1 -0
  96. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.js +383 -0
  97. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts +2 -0
  98. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts.map +1 -0
  99. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.js +124 -0
  100. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts +132 -0
  101. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
  102. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +488 -92
  103. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +268 -0
  104. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  105. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +996 -149
  106. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts +2 -0
  107. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts.map +1 -0
  108. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.js +129 -0
  109. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts +134 -0
  110. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts.map +1 -0
  111. package/compiled/src/compat/web-ifc/spatial_imposter.js +933 -0
  112. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts +2 -0
  113. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts.map +1 -0
  114. package/compiled/src/compat/web-ifc/spatial_imposter.test.js +467 -0
  115. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts +187 -0
  116. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts.map +1 -0
  117. package/compiled/src/compat/web-ifc/store_preview_channel.js +524 -0
  118. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts +2 -0
  119. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts.map +1 -0
  120. package/compiled/src/compat/web-ifc/store_preview_channel.test.js +234 -0
  121. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +306 -0
  122. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -0
  123. package/compiled/src/compat/web-ifc/streamed_preview_channel.js +580 -0
  124. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts +2 -0
  125. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts.map +1 -0
  126. package/compiled/src/compat/web-ifc/web_wasm_directory.test.js +22 -0
  127. package/compiled/src/core/composed_model_skeleton.d.ts +63 -0
  128. package/compiled/src/core/composed_model_skeleton.d.ts.map +1 -0
  129. package/compiled/src/core/composed_model_skeleton.js +66 -0
  130. package/compiled/src/core/composed_model_skeleton.test.d.ts +2 -0
  131. package/compiled/src/core/composed_model_skeleton.test.d.ts.map +1 -0
  132. package/compiled/src/core/composed_model_skeleton.test.js +69 -0
  133. package/compiled/src/core/demand_geometry_queue.d.ts +147 -0
  134. package/compiled/src/core/demand_geometry_queue.d.ts.map +1 -0
  135. package/compiled/src/core/demand_geometry_queue.js +223 -0
  136. package/compiled/src/core/demand_geometry_queue.test.d.ts +2 -0
  137. package/compiled/src/core/demand_geometry_queue.test.d.ts.map +1 -0
  138. package/compiled/src/core/demand_geometry_queue.test.js +133 -0
  139. package/compiled/src/core/demand_residency_pump.d.ts +93 -0
  140. package/compiled/src/core/demand_residency_pump.d.ts.map +1 -0
  141. package/compiled/src/core/demand_residency_pump.js +120 -0
  142. package/compiled/src/core/demand_residency_pump.test.d.ts +2 -0
  143. package/compiled/src/core/demand_residency_pump.test.d.ts.map +1 -0
  144. package/compiled/src/core/demand_residency_pump.test.js +148 -0
  145. package/compiled/src/core/geometry_tile_bindings.d.ts +110 -0
  146. package/compiled/src/core/geometry_tile_bindings.d.ts.map +1 -0
  147. package/compiled/src/core/geometry_tile_bindings.js +76 -0
  148. package/compiled/src/core/geometry_tile_bindings.test.d.ts +2 -0
  149. package/compiled/src/core/geometry_tile_bindings.test.d.ts.map +1 -0
  150. package/compiled/src/core/geometry_tile_bindings.test.js +211 -0
  151. package/compiled/src/core/geometry_tile_pool.d.ts +99 -0
  152. package/compiled/src/core/geometry_tile_pool.d.ts.map +1 -0
  153. package/compiled/src/core/geometry_tile_pool.js +104 -0
  154. package/compiled/src/core/geometry_tile_pool.test.d.ts +2 -0
  155. package/compiled/src/core/geometry_tile_pool.test.d.ts.map +1 -0
  156. package/compiled/src/core/geometry_tile_pool.test.js +180 -0
  157. package/compiled/src/core/mem/chunked_pool.d.ts +116 -0
  158. package/compiled/src/core/mem/chunked_pool.d.ts.map +1 -0
  159. package/compiled/src/core/mem/chunked_pool.js +149 -0
  160. package/compiled/src/core/mem/chunked_pool.test.d.ts +2 -0
  161. package/compiled/src/core/mem/chunked_pool.test.d.ts.map +1 -0
  162. package/compiled/src/core/mem/chunked_pool.test.js +63 -0
  163. package/compiled/src/core/mem/shared_asset_pool.d.ts +82 -0
  164. package/compiled/src/core/mem/shared_asset_pool.d.ts.map +1 -0
  165. package/compiled/src/core/mem/shared_asset_pool.js +113 -0
  166. package/compiled/src/core/mem/shared_asset_pool.test.d.ts +2 -0
  167. package/compiled/src/core/mem/shared_asset_pool.test.d.ts.map +1 -0
  168. package/compiled/src/core/mem/shared_asset_pool.test.js +49 -0
  169. package/compiled/src/core/model_registry.d.ts +87 -0
  170. package/compiled/src/core/model_registry.d.ts.map +1 -0
  171. package/compiled/src/core/model_registry.js +101 -0
  172. package/compiled/src/core/model_registry.test.d.ts +2 -0
  173. package/compiled/src/core/model_registry.test.d.ts.map +1 -0
  174. package/compiled/src/core/model_registry.test.js +60 -0
  175. package/compiled/src/core/model_uri.d.ts +57 -0
  176. package/compiled/src/core/model_uri.d.ts.map +1 -0
  177. package/compiled/src/core/model_uri.js +101 -0
  178. package/compiled/src/core/model_uri.test.d.ts +2 -0
  179. package/compiled/src/core/model_uri.test.d.ts.map +1 -0
  180. package/compiled/src/core/model_uri.test.js +49 -0
  181. package/compiled/src/core/progress.d.ts +16 -2
  182. package/compiled/src/core/progress.d.ts.map +1 -1
  183. package/compiled/src/core/progress.js +31 -5
  184. package/compiled/src/core/progress.test.js +11 -2
  185. package/compiled/src/core/progress_log.d.ts +1 -0
  186. package/compiled/src/core/progress_log.d.ts.map +1 -1
  187. package/compiled/src/core/progress_log.js +7 -2
  188. package/compiled/src/core/progress_log.test.js +21 -0
  189. package/compiled/src/core/shared_byte_budget.d.ts +60 -0
  190. package/compiled/src/core/shared_byte_budget.d.ts.map +1 -0
  191. package/compiled/src/core/shared_byte_budget.js +85 -0
  192. package/compiled/src/core/shared_byte_budget.test.d.ts +2 -0
  193. package/compiled/src/core/shared_byte_budget.test.d.ts.map +1 -0
  194. package/compiled/src/core/shared_byte_budget.test.js +55 -0
  195. package/compiled/src/core/wasm_heap.d.ts +208 -0
  196. package/compiled/src/core/wasm_heap.d.ts.map +1 -0
  197. package/compiled/src/core/wasm_heap.js +417 -0
  198. package/compiled/src/core/wasm_heap.test.d.ts +2 -0
  199. package/compiled/src/core/wasm_heap.test.d.ts.map +1 -0
  200. package/compiled/src/core/wasm_heap.test.js +546 -0
  201. package/compiled/src/demand/index.d.ts +23 -0
  202. package/compiled/src/demand/index.d.ts.map +1 -0
  203. package/compiled/src/demand/index.js +22 -0
  204. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts +1 -1
  205. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts.map +1 -1
  206. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.js +1 -1
  207. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.d.ts.map +1 -1
  208. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.js +2 -2
  209. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts +1 -1
  210. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts.map +1 -1
  211. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.js +1 -1
  212. package/compiled/src/ifc/ifc4_gen/schema_ifc.gen.js +2 -2
  213. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts +2 -0
  214. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts.map +1 -0
  215. package/compiled/src/ifc/ifc_demand_extraction.test.js +251 -0
  216. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +367 -6
  217. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  218. package/compiled/src/ifc/ifc_geometry_extraction.js +1322 -389
  219. package/compiled/src/ifc/ifc_grid_placement.test.d.ts +2 -0
  220. package/compiled/src/ifc/ifc_grid_placement.test.d.ts.map +1 -0
  221. package/compiled/src/ifc/ifc_grid_placement.test.js +261 -0
  222. package/compiled/src/ifc/ifc_model_geometry.d.ts +12 -0
  223. package/compiled/src/ifc/ifc_model_geometry.d.ts.map +1 -1
  224. package/compiled/src/ifc/ifc_model_geometry.js +15 -0
  225. package/compiled/src/ifc/ifc_regression_batch_main.js +210 -12
  226. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts +145 -0
  227. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts.map +1 -0
  228. package/compiled/src/ifc/ifc_spatial_skeleton.js +266 -0
  229. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts +2 -0
  230. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts.map +1 -0
  231. package/compiled/src/ifc/ifc_spatial_skeleton.test.js +199 -0
  232. package/compiled/src/ifc/ifc_step_model.d.ts +6 -2
  233. package/compiled/src/ifc/ifc_step_model.d.ts.map +1 -1
  234. package/compiled/src/ifc/ifc_step_model.js +6 -4
  235. package/compiled/src/ifc/ifc_step_parser.d.ts +58 -0
  236. package/compiled/src/ifc/ifc_step_parser.d.ts.map +1 -1
  237. package/compiled/src/ifc/ifc_step_parser.js +64 -0
  238. package/compiled/src/ifc/ifc_stream_model.test.d.ts +2 -0
  239. package/compiled/src/ifc/ifc_stream_model.test.d.ts.map +1 -0
  240. package/compiled/src/ifc/ifc_stream_model.test.js +70 -0
  241. package/compiled/src/ifc/ifc_stream_open.d.ts +131 -0
  242. package/compiled/src/ifc/ifc_stream_open.d.ts.map +1 -0
  243. package/compiled/src/ifc/ifc_stream_open.js +116 -0
  244. package/compiled/src/ifc/ifc_stream_open.test.d.ts +2 -0
  245. package/compiled/src/ifc/ifc_stream_open.test.d.ts.map +1 -0
  246. package/compiled/src/ifc/ifc_stream_open.test.js +230 -0
  247. package/compiled/src/ifc/ifc_tile_extractor.d.ts +84 -0
  248. package/compiled/src/ifc/ifc_tile_extractor.d.ts.map +1 -0
  249. package/compiled/src/ifc/ifc_tile_extractor.js +134 -0
  250. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts +2 -0
  251. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts.map +1 -0
  252. package/compiled/src/ifc/ifc_tile_extractor.test.js +118 -0
  253. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts +2 -0
  254. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts.map +1 -0
  255. package/compiled/src/ifc/ifc_typed_select_enum.test.js +60 -0
  256. package/compiled/src/index.d.ts +21 -1
  257. package/compiled/src/index.d.ts.map +1 -1
  258. package/compiled/src/index.js +28 -1
  259. package/compiled/src/logging/logger.d.ts +16 -2
  260. package/compiled/src/logging/logger.d.ts.map +1 -1
  261. package/compiled/src/logging/logger.js +34 -7
  262. package/compiled/src/logging/logger.test.js +30 -0
  263. package/compiled/src/mem/index.d.ts +17 -0
  264. package/compiled/src/mem/index.d.ts.map +1 -0
  265. package/compiled/src/mem/index.js +16 -0
  266. package/compiled/src/namespace_surface.test.d.ts +2 -0
  267. package/compiled/src/namespace_surface.test.d.ts.map +1 -0
  268. package/compiled/src/namespace_surface.test.js +43 -0
  269. package/compiled/src/parsing/parsing_buffer.d.ts +23 -0
  270. package/compiled/src/parsing/parsing_buffer.d.ts.map +1 -1
  271. package/compiled/src/parsing/parsing_buffer.js +31 -0
  272. package/compiled/src/scripts/model_report_displacement.test.d.ts +2 -0
  273. package/compiled/src/scripts/model_report_displacement.test.d.ts.map +1 -0
  274. package/compiled/src/scripts/model_report_displacement.test.js +104 -0
  275. package/compiled/src/scripts/render_glb_paths.test.d.ts +2 -0
  276. package/compiled/src/scripts/render_glb_paths.test.d.ts.map +1 -0
  277. package/compiled/src/scripts/render_glb_paths.test.js +115 -0
  278. package/compiled/src/step/indexing/step_type_indexer.d.ts +20 -0
  279. package/compiled/src/step/indexing/step_type_indexer.d.ts.map +1 -1
  280. package/compiled/src/step/indexing/step_type_indexer.js +67 -0
  281. package/compiled/src/step/parsing/byte_source.d.ts +153 -0
  282. package/compiled/src/step/parsing/byte_source.d.ts.map +1 -0
  283. package/compiled/src/step/parsing/byte_source.js +106 -0
  284. package/compiled/src/step/parsing/byte_source.test.d.ts +2 -0
  285. package/compiled/src/step/parsing/byte_source.test.d.ts.map +1 -0
  286. package/compiled/src/step/parsing/byte_source.test.js +47 -0
  287. package/compiled/src/step/parsing/byte_source_node.d.ts +41 -0
  288. package/compiled/src/step/parsing/byte_source_node.d.ts.map +1 -0
  289. package/compiled/src/step/parsing/byte_source_node.js +54 -0
  290. package/compiled/src/step/parsing/columnar_index.d.ts +103 -0
  291. package/compiled/src/step/parsing/columnar_index.d.ts.map +1 -0
  292. package/compiled/src/step/parsing/columnar_index.js +224 -0
  293. package/compiled/src/step/parsing/columnar_index.test.d.ts +2 -0
  294. package/compiled/src/step/parsing/columnar_index.test.d.ts.map +1 -0
  295. package/compiled/src/step/parsing/columnar_index.test.js +155 -0
  296. package/compiled/src/step/parsing/cross_reference_registry.d.ts +95 -0
  297. package/compiled/src/step/parsing/cross_reference_registry.d.ts.map +1 -0
  298. package/compiled/src/step/parsing/cross_reference_registry.js +91 -0
  299. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts +2 -0
  300. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts.map +1 -0
  301. package/compiled/src/step/parsing/cross_reference_registry.test.js +66 -0
  302. package/compiled/src/step/parsing/decode_utf8.d.ts +15 -0
  303. package/compiled/src/step/parsing/decode_utf8.d.ts.map +1 -1
  304. package/compiled/src/step/parsing/decode_utf8.js +28 -0
  305. package/compiled/src/step/parsing/express_ref_scan.d.ts +20 -0
  306. package/compiled/src/step/parsing/express_ref_scan.d.ts.map +1 -0
  307. package/compiled/src/step/parsing/express_ref_scan.js +91 -0
  308. package/compiled/src/step/parsing/express_ref_scan.test.d.ts +2 -0
  309. package/compiled/src/step/parsing/express_ref_scan.test.d.ts.map +1 -0
  310. package/compiled/src/step/parsing/express_ref_scan.test.js +28 -0
  311. package/compiled/src/step/parsing/index_sidecar.d.ts +81 -0
  312. package/compiled/src/step/parsing/index_sidecar.d.ts.map +1 -0
  313. package/compiled/src/step/parsing/index_sidecar.js +283 -0
  314. package/compiled/src/step/parsing/index_sidecar.test.d.ts +2 -0
  315. package/compiled/src/step/parsing/index_sidecar.test.d.ts.map +1 -0
  316. package/compiled/src/step/parsing/index_sidecar.test.js +122 -0
  317. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts +2 -0
  318. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts.map +1 -0
  319. package/compiled/src/step/parsing/inf_recovery_index.test.js +108 -0
  320. package/compiled/src/step/parsing/prefix_type_index.d.ts +124 -0
  321. package/compiled/src/step/parsing/prefix_type_index.d.ts.map +1 -0
  322. package/compiled/src/step/parsing/prefix_type_index.js +207 -0
  323. package/compiled/src/step/parsing/prefix_type_index.test.d.ts +2 -0
  324. package/compiled/src/step/parsing/prefix_type_index.test.d.ts.map +1 -0
  325. package/compiled/src/step/parsing/prefix_type_index.test.js +298 -0
  326. package/compiled/src/step/parsing/range_byte_source.d.ts +69 -0
  327. package/compiled/src/step/parsing/range_byte_source.d.ts.map +1 -0
  328. package/compiled/src/step/parsing/range_byte_source.js +78 -0
  329. package/compiled/src/step/parsing/range_byte_source.test.d.ts +2 -0
  330. package/compiled/src/step/parsing/range_byte_source.test.d.ts.map +1 -0
  331. package/compiled/src/step/parsing/range_byte_source.test.js +70 -0
  332. package/compiled/src/step/parsing/record_event.d.ts +23 -0
  333. package/compiled/src/step/parsing/record_event.d.ts.map +1 -0
  334. package/compiled/src/step/parsing/record_event.js +1 -0
  335. package/compiled/src/step/parsing/record_field_cursor.d.ts +94 -0
  336. package/compiled/src/step/parsing/record_field_cursor.d.ts.map +1 -0
  337. package/compiled/src/step/parsing/record_field_cursor.js +189 -0
  338. package/compiled/src/step/parsing/step_deserialization_functions.d.ts +29 -0
  339. package/compiled/src/step/parsing/step_deserialization_functions.d.ts.map +1 -1
  340. package/compiled/src/step/parsing/step_deserialization_functions.js +45 -0
  341. package/compiled/src/step/parsing/step_deserialization_functions.test.js +59 -1
  342. package/compiled/src/step/parsing/step_parser.d.ts +66 -1
  343. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  344. package/compiled/src/step/parsing/step_parser.js +164 -10
  345. package/compiled/src/step/parsing/step_string_parser.js +8 -8
  346. package/compiled/src/step/parsing/streaming_index_builder.d.ts +141 -0
  347. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -0
  348. package/compiled/src/step/parsing/streaming_index_builder.js +280 -0
  349. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts +2 -0
  350. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts.map +1 -0
  351. package/compiled/src/step/parsing/streaming_index_builder.test.js +107 -0
  352. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts +2 -0
  353. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts.map +1 -0
  354. package/compiled/src/step/parsing/streaming_index_builder_async.test.js +109 -0
  355. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts +71 -0
  356. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts.map +1 -0
  357. package/compiled/src/step/parsing/streaming_record_dispatcher.js +88 -0
  358. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts +2 -0
  359. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts.map +1 -0
  360. package/compiled/src/step/parsing/streaming_record_dispatcher.test.js +66 -0
  361. package/compiled/src/step/parsing/uint32_sink.d.ts +72 -0
  362. package/compiled/src/step/parsing/uint32_sink.d.ts.map +1 -0
  363. package/compiled/src/step/parsing/uint32_sink.js +180 -0
  364. package/compiled/src/step/parsing/uint32_sink.test.d.ts +2 -0
  365. package/compiled/src/step/parsing/uint32_sink.test.d.ts.map +1 -0
  366. package/compiled/src/step/parsing/uint32_sink.test.js +199 -0
  367. package/compiled/src/step/step_buffer_provider.d.ts +48 -3
  368. package/compiled/src/step/step_buffer_provider.d.ts.map +1 -1
  369. package/compiled/src/step/step_buffer_provider.js +60 -11
  370. package/compiled/src/step/step_buffer_provider.test.js +14 -0
  371. package/compiled/src/step/step_entity_base.d.ts +65 -3
  372. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  373. package/compiled/src/step/step_entity_base.js +135 -3
  374. package/compiled/src/step/step_model_base.d.ts +221 -8
  375. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  376. package/compiled/src/step/step_model_base.js +542 -7
  377. package/compiled/src/stream/index.d.ts +34 -0
  378. package/compiled/src/stream/index.d.ts.map +1 -0
  379. package/compiled/src/stream/index.js +32 -0
  380. package/compiled/src/version/version.js +1 -1
  381. package/compiled/tsconfig.tsbuildinfo +1 -1
  382. package/package.json +16 -1
@@ -1 +1 @@
1
- {"version":3,"file":"decode_utf8.d.ts","sourceRoot":"","sources":["../../../../src/step/parsing/decode_utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA+BH;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnD;AAID;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAqBtD"}
1
+ {"version":3,"file":"decode_utf8.d.ts","sourceRoot":"","sources":["../../../../src/step/parsing/decode_utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA+BH;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnD;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAczD;AAID;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAqBtD"}
@@ -54,6 +54,34 @@ function copyOutOfResizable(view) {
54
54
  export function decodeUtf8(view) {
55
55
  return decoder.decode(decodeNeedsCopy(view.buffer) ? view.slice() : view);
56
56
  }
57
+ const strictUtf8Decoder = new TextDecoder('utf-8', { fatal: true });
58
+ /**
59
+ * Decode the raw byte run of a STEP string literal.
60
+ *
61
+ * ISO 10303-21 says raw (non-\X\-escaped) bytes are ISO 8859-1, but modern
62
+ * exporters routinely write UTF-8 (and some, like Onshape's ST-Developer,
63
+ * write outright invalid sequences). The lenient default decoder mapped every
64
+ * non-UTF-8 byte to U+FFFD, so a spec-conformant latin-1 'Küche' surfaced as
65
+ * 'K�che' in product names and titles. Decode as strict UTF-8 first (the
66
+ * common modern case, and unambiguous when it validates), and fall back to
67
+ * exact ISO 8859-1 (byte = code point, which cannot fail) when it doesn't.
68
+ *
69
+ * @param view The bytes of the string literal's raw run.
70
+ * @return The decoded string.
71
+ */
72
+ export function decodeStepString(view) {
73
+ const bytes = decodeNeedsCopy(view.buffer) ? view.slice() : view;
74
+ try {
75
+ return strictUtf8Decoder.decode(bytes);
76
+ }
77
+ catch {
78
+ let result = '';
79
+ for (let where = 0; where < bytes.length; ++where) {
80
+ result += String.fromCharCode(bytes[where]);
81
+ }
82
+ return result;
83
+ }
84
+ }
57
85
  let shimInstalled = false;
58
86
  /**
59
87
  * Install a global, idempotent `TextDecoder.prototype.decode` shim that copies a
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Lexical scan of a STEP record for `#<expressID>` references.
3
+ *
4
+ * Used to prefetch the source-byte closure a windowed extract will
5
+ * acquire: walking typed attributes requires those records to already
6
+ * be resident, so the walk has to happen on the raw text. Strings
7
+ * (`'...'` with `''` escapes), binary blobs (`"..."`) and C-style
8
+ * comments are skipped so a hash inside a string is not a ref.
9
+ */
10
+ /**
11
+ * Collect the distinct express IDs referenced from a STEP record's
12
+ * bytes. Order is first-seen; `#0` is ignored (not a real entity).
13
+ *
14
+ * @param bytes The record text (or a view containing it).
15
+ * @param from Start offset within `bytes`.
16
+ * @param length Number of bytes to scan.
17
+ * @return {number[]} Distinct referenced express IDs.
18
+ */
19
+ export declare function scanExpressRefs(bytes: Uint8Array, from?: number, length?: number): number[];
20
+ //# sourceMappingURL=express_ref_scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express_ref_scan.d.ts","sourceRoot":"","sources":["../../../../src/step/parsing/express_ref_scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC3B,KAAK,EAAE,UAAU,EAAE,IAAI,GAAE,MAAU,EAAE,MAAM,GAAE,MAA4B,GAAI,MAAM,EAAE,CA8DxF"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Lexical scan of a STEP record for `#<expressID>` references.
3
+ *
4
+ * Used to prefetch the source-byte closure a windowed extract will
5
+ * acquire: walking typed attributes requires those records to already
6
+ * be resident, so the walk has to happen on the raw text. Strings
7
+ * (`'...'` with `''` escapes), binary blobs (`"..."`) and C-style
8
+ * comments are skipped so a hash inside a string is not a ref.
9
+ */
10
+ const HASH = 0x23;
11
+ const QUOTE = 0x27;
12
+ const DQUOTE = 0x22;
13
+ const ZERO = 0x30;
14
+ const NINE = 0x39;
15
+ const SLASH = 0x2F;
16
+ const STAR = 0x2A;
17
+ /**
18
+ * Collect the distinct express IDs referenced from a STEP record's
19
+ * bytes. Order is first-seen; `#0` is ignored (not a real entity).
20
+ *
21
+ * @param bytes The record text (or a view containing it).
22
+ * @param from Start offset within `bytes`.
23
+ * @param length Number of bytes to scan.
24
+ * @return {number[]} Distinct referenced express IDs.
25
+ */
26
+ export function scanExpressRefs(bytes, from = 0, length = bytes.length - from) {
27
+ const refs = [];
28
+ const seen = new Set();
29
+ const end = Math.min(from + length, bytes.length);
30
+ let cursor = from;
31
+ while (cursor < end) {
32
+ const byte = bytes[cursor];
33
+ if (byte === QUOTE) {
34
+ cursor = skipQuoted_(bytes, cursor + 1, end, QUOTE, true);
35
+ continue;
36
+ }
37
+ if (byte === DQUOTE) {
38
+ cursor = skipQuoted_(bytes, cursor + 1, end, DQUOTE, false);
39
+ continue;
40
+ }
41
+ if (byte === SLASH && cursor + 1 < end && bytes[cursor + 1] === STAR) {
42
+ cursor += 2;
43
+ while (cursor + 1 < end &&
44
+ !(bytes[cursor] === STAR && bytes[cursor + 1] === SLASH)) {
45
+ ++cursor;
46
+ }
47
+ cursor += 2;
48
+ continue;
49
+ }
50
+ if (byte === HASH) {
51
+ let value = 0;
52
+ let digit = cursor + 1;
53
+ while (digit < end && bytes[digit] >= ZERO && bytes[digit] <= NINE) {
54
+ value = (value * 10) + (bytes[digit] - ZERO);
55
+ ++digit;
56
+ }
57
+ if (digit > cursor + 1 && value !== 0 && !seen.has(value)) {
58
+ seen.add(value);
59
+ refs.push(value);
60
+ }
61
+ cursor = digit;
62
+ continue;
63
+ }
64
+ ++cursor;
65
+ }
66
+ return refs;
67
+ }
68
+ /**
69
+ * Advance past a quoted span that started just before `from`.
70
+ *
71
+ * @param bytes Source bytes.
72
+ * @param from First byte after the opening quote.
73
+ * @param end Exclusive scan limit.
74
+ * @param quote The quote byte to match.
75
+ * @param doubledEscape True for STEP strings (`''` is one quote).
76
+ * @return {number} Index just after the closing quote (or `end`).
77
+ */
78
+ function skipQuoted_(bytes, from, end, quote, doubledEscape) {
79
+ let cursor = from;
80
+ while (cursor < end) {
81
+ if (bytes[cursor] === quote) {
82
+ if (doubledEscape && cursor + 1 < end && bytes[cursor + 1] === quote) {
83
+ cursor += 2;
84
+ continue;
85
+ }
86
+ return cursor + 1;
87
+ }
88
+ ++cursor;
89
+ }
90
+ return end;
91
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=express_ref_scan.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express_ref_scan.test.d.ts","sourceRoot":"","sources":["../../../../src/step/parsing/express_ref_scan.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ /* eslint-disable no-magic-numbers */
2
+ import { describe, expect, test } from "@jest/globals";
3
+ import { scanExpressRefs } from "./express_ref_scan.js";
4
+ /**
5
+ * @param text STEP text to scan.
6
+ * @return {number[]} Referenced express IDs.
7
+ */
8
+ function scan(text) {
9
+ return scanExpressRefs(new TextEncoder().encode(text));
10
+ }
11
+ describe("scanExpressRefs", () => {
12
+ test("collects distinct #ids in first-seen order", () => {
13
+ expect(scan("#10=IFCWALL(#20,#20,#30);")).toEqual([10, 20, 30]);
14
+ });
15
+ test("ignores hashes inside STEP strings and doubled quotes", () => {
16
+ expect(scan("#1=IFCLABEL('door #99 is fine');#2=IFCNAME('it''s #8');"))
17
+ .toEqual([1, 2]);
18
+ });
19
+ test("ignores hashes inside binary blobs", () => {
20
+ expect(scan("#1=IFCBLOB(\"#99DEAD\");")).toEqual([1]);
21
+ });
22
+ test("ignores hashes inside comments", () => {
23
+ expect(scan("#1=IFCWALL(/* see #99 */#2);")).toEqual([1, 2]);
24
+ });
25
+ test("skips #0", () => {
26
+ expect(scan("#1=IFCWALL(#0,#2);")).toEqual([1, 2]);
27
+ });
28
+ });
@@ -0,0 +1,81 @@
1
+ import { StepIndexColumns } from "./columnar_index.js";
2
+ import { StepIndexEntry } from "./step_parser.js";
3
+ /**
4
+ * The decoded sidecar: the source identity it was built against, plus the
5
+ * reconstructed top-level element index.
6
+ */
7
+ export interface DecodedSidecar<TypeIDType extends number> {
8
+ version: number;
9
+ sourceByteLength: number;
10
+ sourceHash: number;
11
+ elements: StepIndexEntry<TypeIDType>[];
12
+ /**
13
+ * True for records the sidecar under-describes (they had inline / multi
14
+ * children the v1 format doesn't serialise). Same order as `elements`.
15
+ */
16
+ hasChildren: boolean[];
17
+ }
18
+ /**
19
+ * A placeholder strong-ish hash of the source bytes (FNV-1a, 32-bit). Stands
20
+ * in for a production digest (SHA-256); only the fixed slot matters to the
21
+ * format. Sufficient to demonstrate the mismatch → cold-scan handshake.
22
+ *
23
+ * @param source The source bytes.
24
+ * @return {number} A 32-bit unsigned hash.
25
+ */
26
+ export declare function hashSource(source: Uint8Array): number;
27
+ /**
28
+ * Serialise a model's top-level element index to a sidecar blob.
29
+ *
30
+ * @param elements The top-level element index.
31
+ * @param sourceByteLength The length of the source it was built from.
32
+ * @param sourceHash The source hash (see {@link hashSource}).
33
+ * @return {Uint8Array} The sidecar bytes.
34
+ */
35
+ export declare function serializeIndexSidecar<TypeIDType extends number>(elements: StepIndexEntry<TypeIDType>[], sourceByteLength: number, sourceHash: number): Uint8Array;
36
+ /**
37
+ * Deserialise a sidecar blob back to the top-level element index.
38
+ *
39
+ * @param bytes The sidecar bytes.
40
+ * @return {DecodedSidecar} The decoded source identity + element index.
41
+ */
42
+ export declare function deserializeIndexSidecar<TypeIDType extends number>(bytes: Uint8Array): DecodedSidecar<TypeIDType>;
43
+ /**
44
+ * Serialise a columnar index (M7) to a sidecar blob — same format as
45
+ * {@link serializeIndexSidecar}, byte for byte, but read straight off the SoA
46
+ * columns so no object index is needed. Only the top-level range is carried
47
+ * (the v1 format; inline rows re-materialise from record bytes on demand).
48
+ *
49
+ * @param columns The columnar index.
50
+ * @param sourceByteLength The length of the source it was built from.
51
+ * @param sourceHash The source hash (see {@link hashSource}).
52
+ * @return {Uint8Array} The sidecar bytes.
53
+ */
54
+ export declare function serializeIndexSidecarFromColumns<TypeIDType extends number>(columns: StepIndexColumns<TypeIDType>, sourceByteLength: number, sourceHash: number): Uint8Array;
55
+ /**
56
+ * Deserialise a sidecar blob straight to a columnar index (M7) — the
57
+ * index-first open path: no per-record objects at any point between the
58
+ * sidecar bytes and a constructed model. Top-level rows only (v1 sidecars
59
+ * carry no inline rows), so `count === firstInlineElement`.
60
+ *
61
+ * @param bytes The sidecar bytes.
62
+ * @return {{ sourceByteLength: number, sourceHash: number,
63
+ * columns: StepIndexColumns }} Source identity + the columnar index.
64
+ */
65
+ export declare function deserializeIndexSidecarToColumns<TypeIDType extends number>(bytes: Uint8Array): {
66
+ sourceByteLength: number;
67
+ sourceHash: number;
68
+ columns: StepIndexColumns<TypeIDType>;
69
+ };
70
+ /**
71
+ * Validate a decoded sidecar against the actual source identity. The
72
+ * index-first open path calls this before trusting the sidecar; on false it
73
+ * must fall back to a cold scan.
74
+ *
75
+ * @param sidecar The decoded sidecar.
76
+ * @param sourceByteLength The actual source length.
77
+ * @param sourceHash The actual source hash.
78
+ * @return {boolean} True if the sidecar matches the source.
79
+ */
80
+ export declare function sidecarMatchesSource<TypeIDType extends number>(sidecar: DecodedSidecar<TypeIDType>, sourceByteLength: number, sourceHash: number): boolean;
81
+ //# sourceMappingURL=index_sidecar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index_sidecar.d.ts","sourceRoot":"","sources":["../../../../src/step/parsing/index_sidecar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AA0D9C;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,UAAU,SAAS,MAAM;IACvD,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,CAAA;IAEtC;;;OAGG;IACH,WAAW,EAAE,OAAO,EAAE,CAAA;CACvB;AAGD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAE,MAAM,EAAE,UAAU,GAAI,MAAM,CASvD;AAGD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,MAAM,EAC3D,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,EACtC,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,MAAM,GAAI,UAAU,CAsCnC;AAGD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,SAAS,MAAM,EAC7D,KAAK,EAAE,UAAU,GAAI,cAAc,CAAC,UAAU,CAAC,CA0ClD;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,SAAS,MAAM,EACtE,OAAO,EAAE,gBAAgB,CAAC,UAAU,CAAC,EACrC,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,MAAM,GAAI,UAAU,CAkCnC;AAGD;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,SAAS,MAAM,EACtE,KAAK,EAAE,UAAU,GAAI;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;CACvC,CA+DA;AAGD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,SAAS,MAAM,EAC1D,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,EACnC,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,MAAM,GAAI,OAAO,CAIhC"}
@@ -0,0 +1,283 @@
1
+ /**
2
+ * Index sidecar (M4): a compact, version-stamped binary serialisation of a
3
+ * model's parse index, so a revisit (or a first visit with a server-provided
4
+ * sidecar) can open **index-first** — reconstruct the entity index without
5
+ * re-scanning the source, then fetch only the byte ranges demand asks for
6
+ * (see RangeByteSource).
7
+ *
8
+ * Layout (all little-endian):
9
+ *
10
+ * 'CIDX' 4 magic
11
+ * version u32
12
+ * sourceByteLength f64 (length of the source the index was built from)
13
+ * sourceHash u32 (hash of the source bytes — the handshake)
14
+ * recordCount u32
15
+ * address[] f64 × recordCount (file-absolute; f64 tolerates >4 GB)
16
+ * length[] u32 × recordCount
17
+ * typeID[] i32 × recordCount (−1 = undefined type)
18
+ * expressID[] u32 × recordCount
19
+ *
20
+ * This carries the top-level record columns — enough to answer type/express
21
+ * queries and locate every record's bytes. Inline / multi-mapping child
22
+ * serialisation is a v2 extension (records with children re-materialise their
23
+ * children from the record bytes on demand); `hasChildren` flags which
24
+ * records the sidecar under-describes so a consumer can fall back for them.
25
+ *
26
+ * The sidecar is a **cache, not an interchange format**: it is only trusted
27
+ * after `sourceHash` + `sourceByteLength` match the actual source. A mismatch
28
+ * means fall back to a cold scan — never serve wrong bytes. Production should
29
+ * swap the placeholder 32-bit hash for a strong digest (e.g. SHA-256); the
30
+ * format reserves a fixed slot so that is a version bump, not a reshape.
31
+ */
32
+ const MAGIC = 0x58444943; // 'CIDX' little-endian
33
+ const VERSION = 1;
34
+ const UNDEFINED_TYPE = -1;
35
+ // FNV-1a 32-bit parameters (see hashSource).
36
+ const FNV_OFFSET_BASIS = 2166136261;
37
+ const FNV_PRIME = 16777619;
38
+ const HEX = 16;
39
+ // Byte sizes of the fixed header fields, in order.
40
+ const HEADER_BYTES = 4 + // magic
41
+ 4 + // version
42
+ 8 + // sourceByteLength (f64)
43
+ 4 + // sourceHash (u32)
44
+ 4; // recordCount (u32)
45
+ const ADDRESS_BYTES = 8;
46
+ const LENGTH_BYTES = 4;
47
+ const TYPEID_BYTES = 4;
48
+ const EXPRESSID_BYTES = 4;
49
+ /**
50
+ * A placeholder strong-ish hash of the source bytes (FNV-1a, 32-bit). Stands
51
+ * in for a production digest (SHA-256); only the fixed slot matters to the
52
+ * format. Sufficient to demonstrate the mismatch → cold-scan handshake.
53
+ *
54
+ * @param source The source bytes.
55
+ * @return {number} A 32-bit unsigned hash.
56
+ */
57
+ export function hashSource(source) {
58
+ let hash = FNV_OFFSET_BASIS >>> 0;
59
+ for (let where = 0; where < source.length; ++where) {
60
+ hash ^= source[where];
61
+ hash = Math.imul(hash, FNV_PRIME) >>> 0;
62
+ }
63
+ return hash >>> 0;
64
+ }
65
+ /**
66
+ * Serialise a model's top-level element index to a sidecar blob.
67
+ *
68
+ * @param elements The top-level element index.
69
+ * @param sourceByteLength The length of the source it was built from.
70
+ * @param sourceHash The source hash (see {@link hashSource}).
71
+ * @return {Uint8Array} The sidecar bytes.
72
+ */
73
+ export function serializeIndexSidecar(elements, sourceByteLength, sourceHash) {
74
+ const recordCount = elements.length;
75
+ const total = HEADER_BYTES +
76
+ recordCount * (ADDRESS_BYTES + LENGTH_BYTES + TYPEID_BYTES + EXPRESSID_BYTES);
77
+ const bytes = new Uint8Array(total);
78
+ const view = new DataView(bytes.buffer);
79
+ let offset = 0;
80
+ view.setUint32(offset, MAGIC, true);
81
+ offset += 4;
82
+ view.setUint32(offset, VERSION, true);
83
+ offset += 4;
84
+ view.setFloat64(offset, sourceByteLength, true);
85
+ offset += 8;
86
+ view.setUint32(offset, sourceHash >>> 0, true);
87
+ offset += 4;
88
+ view.setUint32(offset, recordCount, true);
89
+ offset += 4;
90
+ // Column-major: better compression locality than row-major, and it mirrors
91
+ // the SoA columns the model rebuilds.
92
+ for (const element of elements) {
93
+ view.setFloat64(offset, element.address, true);
94
+ offset += ADDRESS_BYTES;
95
+ }
96
+ for (const element of elements) {
97
+ view.setUint32(offset, element.length, true);
98
+ offset += LENGTH_BYTES;
99
+ }
100
+ for (const element of elements) {
101
+ const typeID = element.typeID;
102
+ view.setInt32(offset, typeID === void 0 ? UNDEFINED_TYPE : typeID, true);
103
+ offset += TYPEID_BYTES;
104
+ }
105
+ for (const element of elements) {
106
+ view.setUint32(offset, element.expressID, true);
107
+ offset += EXPRESSID_BYTES;
108
+ }
109
+ return bytes;
110
+ }
111
+ /**
112
+ * Deserialise a sidecar blob back to the top-level element index.
113
+ *
114
+ * @param bytes The sidecar bytes.
115
+ * @return {DecodedSidecar} The decoded source identity + element index.
116
+ */
117
+ export function deserializeIndexSidecar(bytes) {
118
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
119
+ let offset = 0;
120
+ const magic = view.getUint32(offset, true);
121
+ offset += 4;
122
+ if (magic !== MAGIC) {
123
+ throw new Error(`Not a sidecar: bad magic 0x${magic.toString(HEX)}`);
124
+ }
125
+ const version = view.getUint32(offset, true);
126
+ offset += 4;
127
+ if (version !== VERSION) {
128
+ throw new Error(`Unsupported sidecar version ${version}`);
129
+ }
130
+ const sourceByteLength = view.getFloat64(offset, true);
131
+ offset += 8;
132
+ const sourceHash = view.getUint32(offset, true);
133
+ offset += 4;
134
+ const recordCount = view.getUint32(offset, true);
135
+ offset += 4;
136
+ const addressBase = offset;
137
+ const lengthBase = addressBase + recordCount * ADDRESS_BYTES;
138
+ const typeIDBase = lengthBase + recordCount * LENGTH_BYTES;
139
+ const expressIDBase = typeIDBase + recordCount * TYPEID_BYTES;
140
+ const elements = new Array(recordCount);
141
+ const hasChildren = new Array(recordCount).fill(false);
142
+ for (let where = 0; where < recordCount; ++where) {
143
+ const typeID = view.getInt32(typeIDBase + where * TYPEID_BYTES, true);
144
+ elements[where] = {
145
+ address: view.getFloat64(addressBase + where * ADDRESS_BYTES, true),
146
+ length: view.getUint32(lengthBase + where * LENGTH_BYTES, true),
147
+ typeID: (typeID === UNDEFINED_TYPE ? void 0 : typeID),
148
+ expressID: view.getUint32(expressIDBase + where * EXPRESSID_BYTES, true),
149
+ };
150
+ }
151
+ return { version, sourceByteLength, sourceHash, elements, hasChildren };
152
+ }
153
+ /**
154
+ * Serialise a columnar index (M7) to a sidecar blob — same format as
155
+ * {@link serializeIndexSidecar}, byte for byte, but read straight off the SoA
156
+ * columns so no object index is needed. Only the top-level range is carried
157
+ * (the v1 format; inline rows re-materialise from record bytes on demand).
158
+ *
159
+ * @param columns The columnar index.
160
+ * @param sourceByteLength The length of the source it was built from.
161
+ * @param sourceHash The source hash (see {@link hashSource}).
162
+ * @return {Uint8Array} The sidecar bytes.
163
+ */
164
+ export function serializeIndexSidecarFromColumns(columns, sourceByteLength, sourceHash) {
165
+ const recordCount = columns.firstInlineElement;
166
+ const total = HEADER_BYTES +
167
+ recordCount * (ADDRESS_BYTES + LENGTH_BYTES + TYPEID_BYTES + EXPRESSID_BYTES);
168
+ const bytes = new Uint8Array(total);
169
+ const view = new DataView(bytes.buffer);
170
+ let offset = 0;
171
+ view.setUint32(offset, MAGIC, true);
172
+ offset += 4;
173
+ view.setUint32(offset, VERSION, true);
174
+ offset += 4;
175
+ view.setFloat64(offset, sourceByteLength, true);
176
+ offset += 8;
177
+ view.setUint32(offset, sourceHash >>> 0, true);
178
+ offset += 4;
179
+ view.setUint32(offset, recordCount, true);
180
+ offset += 4;
181
+ for (let where = 0; where < recordCount; ++where) {
182
+ view.setFloat64(offset, columns.address[where], true);
183
+ offset += ADDRESS_BYTES;
184
+ }
185
+ for (let where = 0; where < recordCount; ++where) {
186
+ view.setUint32(offset, columns.length[where], true);
187
+ offset += LENGTH_BYTES;
188
+ }
189
+ for (let where = 0; where < recordCount; ++where) {
190
+ // The column already uses the sidecar's −1 sentinel for undefined.
191
+ view.setInt32(offset, columns.typeID[where], true);
192
+ offset += TYPEID_BYTES;
193
+ }
194
+ for (let where = 0; where < recordCount; ++where) {
195
+ view.setUint32(offset, columns.expressID[where], true);
196
+ offset += EXPRESSID_BYTES;
197
+ }
198
+ return bytes;
199
+ }
200
+ /**
201
+ * Deserialise a sidecar blob straight to a columnar index (M7) — the
202
+ * index-first open path: no per-record objects at any point between the
203
+ * sidecar bytes and a constructed model. Top-level rows only (v1 sidecars
204
+ * carry no inline rows), so `count === firstInlineElement`.
205
+ *
206
+ * @param bytes The sidecar bytes.
207
+ * @return {{ sourceByteLength: number, sourceHash: number,
208
+ * columns: StepIndexColumns }} Source identity + the columnar index.
209
+ */
210
+ export function deserializeIndexSidecarToColumns(bytes) {
211
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
212
+ let offset = 0;
213
+ const magic = view.getUint32(offset, true);
214
+ offset += 4;
215
+ if (magic !== MAGIC) {
216
+ throw new Error(`Not a sidecar: bad magic 0x${magic.toString(HEX)}`);
217
+ }
218
+ const version = view.getUint32(offset, true);
219
+ offset += 4;
220
+ if (version !== VERSION) {
221
+ throw new Error(`Unsupported sidecar version ${version}`);
222
+ }
223
+ const sourceByteLength = view.getFloat64(offset, true);
224
+ offset += 8;
225
+ const sourceHash = view.getUint32(offset, true);
226
+ offset += 4;
227
+ const recordCount = view.getUint32(offset, true);
228
+ offset += 4;
229
+ const address = new Uint32Array(recordCount);
230
+ const length = new Uint32Array(recordCount);
231
+ const typeID = new Int32Array(recordCount);
232
+ const expressID = new Uint32Array(recordCount);
233
+ let sorted = true;
234
+ let previous = 0;
235
+ for (let where = 0; where < recordCount; ++where) {
236
+ address[where] = view.getFloat64(offset, true);
237
+ offset += ADDRESS_BYTES;
238
+ }
239
+ for (let where = 0; where < recordCount; ++where) {
240
+ length[where] = view.getUint32(offset, true);
241
+ offset += LENGTH_BYTES;
242
+ }
243
+ for (let where = 0; where < recordCount; ++where) {
244
+ typeID[where] = view.getInt32(offset, true);
245
+ offset += TYPEID_BYTES;
246
+ }
247
+ for (let where = 0; where < recordCount; ++where) {
248
+ const id = view.getUint32(offset, true);
249
+ offset += EXPRESSID_BYTES;
250
+ expressID[where] = id;
251
+ if (id < previous) {
252
+ sorted = false;
253
+ }
254
+ previous = id;
255
+ }
256
+ return {
257
+ sourceByteLength,
258
+ sourceHash,
259
+ columns: {
260
+ address,
261
+ length,
262
+ typeID,
263
+ expressID,
264
+ count: recordCount,
265
+ firstInlineElement: recordCount,
266
+ expressIdsSorted: sorted,
267
+ },
268
+ };
269
+ }
270
+ /**
271
+ * Validate a decoded sidecar against the actual source identity. The
272
+ * index-first open path calls this before trusting the sidecar; on false it
273
+ * must fall back to a cold scan.
274
+ *
275
+ * @param sidecar The decoded sidecar.
276
+ * @param sourceByteLength The actual source length.
277
+ * @param sourceHash The actual source hash.
278
+ * @return {boolean} True if the sidecar matches the source.
279
+ */
280
+ export function sidecarMatchesSource(sidecar, sourceByteLength, sourceHash) {
281
+ return sidecar.sourceByteLength === sourceByteLength &&
282
+ sidecar.sourceHash === (sourceHash >>> 0);
283
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index_sidecar.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index_sidecar.test.d.ts","sourceRoot":"","sources":["../../../../src/step/parsing/index_sidecar.test.ts"],"names":[],"mappings":""}