@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.
- package/README.md +36 -22
- package/compiled/Dist/ConwayGeomWasmNode.js +0 -0
- package/compiled/Dist/ConwayGeomWasmNodeMT.js +0 -0
- package/compiled/Dist/ConwayGeomWasmWeb.js +0 -0
- package/compiled/Dist/ConwayGeomWasmWebMT.js +1 -1
- package/compiled/Dist/ConwayGeomWasmWebMT.wasm +0 -0
- package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNode.js +0 -0
- package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNodeMT.js +0 -0
- package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWeb.js +0 -0
- package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.js +1 -1
- package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.wasm +0 -0
- package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts +19 -0
- package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts.map +1 -1
- package/compiled/dependencies/conway-geom/interface/conway_geometry.js +17 -0
- package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts +6 -0
- package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts.map +1 -1
- package/compiled/examples/browser-bundled.cjs +1569 -51
- package/compiled/examples/cli-bundled.cjs +2790 -436
- package/compiled/examples/cli-step-bundled.cjs +1904 -229
- package/compiled/examples/validator-bundled.cjs +1569 -51
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts +2 -2
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.js +2 -2
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts +3 -3
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.js +3 -3
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.js +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.js +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.js +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.js +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.js +2 -2
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/schema_ap214.gen.js +11 -11
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.js +1 -1
- package/compiled/src/AP214E3_2010/ap214_command_line_main.js +7 -3
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +181 -7
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +906 -137
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.test.js +10 -2
- package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts +2 -0
- package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts.map +1 -0
- package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.js +114 -0
- package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts +6 -0
- package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/ap214_model_geometry.js +9 -0
- package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts +2 -0
- package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts.map +1 -0
- package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.js +233 -0
- package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts +2 -0
- package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts.map +1 -0
- package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.js +147 -0
- package/compiled/src/AP214E3_2010/ap214_step_model.d.ts +2 -1
- package/compiled/src/AP214E3_2010/ap214_step_model.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/ap214_step_model.js +1 -1
- package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts +2 -0
- package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts.map +1 -0
- package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.js +65 -0
- package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts +2 -0
- package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts.map +1 -0
- package/compiled/src/AP214E3_2010/ap214_unit_scale.test.js +111 -0
- package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/ap214_streamed_open.test.js +190 -0
- package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/coordination_export_order.test.js +110 -0
- package/compiled/src/compat/web-ifc/coordination_f64.d.ts +165 -0
- package/compiled/src/compat/web-ifc/coordination_f64.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/coordination_f64.js +286 -0
- package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/coordination_f64.test.js +225 -0
- package/compiled/src/compat/web-ifc/ifc_api.d.ts +154 -0
- package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api.js +211 -3
- package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.js +288 -0
- package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +39 -0
- package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts +30 -0
- package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.js +83 -0
- package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.js +383 -0
- package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.js +124 -0
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts +132 -0
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +488 -92
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +268 -0
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +996 -149
- package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.js +129 -0
- package/compiled/src/compat/web-ifc/spatial_imposter.d.ts +134 -0
- package/compiled/src/compat/web-ifc/spatial_imposter.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/spatial_imposter.js +933 -0
- package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/spatial_imposter.test.js +467 -0
- package/compiled/src/compat/web-ifc/store_preview_channel.d.ts +187 -0
- package/compiled/src/compat/web-ifc/store_preview_channel.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/store_preview_channel.js +524 -0
- package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/store_preview_channel.test.js +234 -0
- package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +306 -0
- package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/streamed_preview_channel.js +580 -0
- package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts +2 -0
- package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts.map +1 -0
- package/compiled/src/compat/web-ifc/web_wasm_directory.test.js +22 -0
- package/compiled/src/core/composed_model_skeleton.d.ts +63 -0
- package/compiled/src/core/composed_model_skeleton.d.ts.map +1 -0
- package/compiled/src/core/composed_model_skeleton.js +66 -0
- package/compiled/src/core/composed_model_skeleton.test.d.ts +2 -0
- package/compiled/src/core/composed_model_skeleton.test.d.ts.map +1 -0
- package/compiled/src/core/composed_model_skeleton.test.js +69 -0
- package/compiled/src/core/demand_geometry_queue.d.ts +147 -0
- package/compiled/src/core/demand_geometry_queue.d.ts.map +1 -0
- package/compiled/src/core/demand_geometry_queue.js +223 -0
- package/compiled/src/core/demand_geometry_queue.test.d.ts +2 -0
- package/compiled/src/core/demand_geometry_queue.test.d.ts.map +1 -0
- package/compiled/src/core/demand_geometry_queue.test.js +133 -0
- package/compiled/src/core/demand_residency_pump.d.ts +93 -0
- package/compiled/src/core/demand_residency_pump.d.ts.map +1 -0
- package/compiled/src/core/demand_residency_pump.js +120 -0
- package/compiled/src/core/demand_residency_pump.test.d.ts +2 -0
- package/compiled/src/core/demand_residency_pump.test.d.ts.map +1 -0
- package/compiled/src/core/demand_residency_pump.test.js +148 -0
- package/compiled/src/core/geometry_tile_bindings.d.ts +110 -0
- package/compiled/src/core/geometry_tile_bindings.d.ts.map +1 -0
- package/compiled/src/core/geometry_tile_bindings.js +76 -0
- package/compiled/src/core/geometry_tile_bindings.test.d.ts +2 -0
- package/compiled/src/core/geometry_tile_bindings.test.d.ts.map +1 -0
- package/compiled/src/core/geometry_tile_bindings.test.js +211 -0
- package/compiled/src/core/geometry_tile_pool.d.ts +99 -0
- package/compiled/src/core/geometry_tile_pool.d.ts.map +1 -0
- package/compiled/src/core/geometry_tile_pool.js +104 -0
- package/compiled/src/core/geometry_tile_pool.test.d.ts +2 -0
- package/compiled/src/core/geometry_tile_pool.test.d.ts.map +1 -0
- package/compiled/src/core/geometry_tile_pool.test.js +180 -0
- package/compiled/src/core/mem/chunked_pool.d.ts +116 -0
- package/compiled/src/core/mem/chunked_pool.d.ts.map +1 -0
- package/compiled/src/core/mem/chunked_pool.js +149 -0
- package/compiled/src/core/mem/chunked_pool.test.d.ts +2 -0
- package/compiled/src/core/mem/chunked_pool.test.d.ts.map +1 -0
- package/compiled/src/core/mem/chunked_pool.test.js +63 -0
- package/compiled/src/core/mem/shared_asset_pool.d.ts +82 -0
- package/compiled/src/core/mem/shared_asset_pool.d.ts.map +1 -0
- package/compiled/src/core/mem/shared_asset_pool.js +113 -0
- package/compiled/src/core/mem/shared_asset_pool.test.d.ts +2 -0
- package/compiled/src/core/mem/shared_asset_pool.test.d.ts.map +1 -0
- package/compiled/src/core/mem/shared_asset_pool.test.js +49 -0
- package/compiled/src/core/model_registry.d.ts +87 -0
- package/compiled/src/core/model_registry.d.ts.map +1 -0
- package/compiled/src/core/model_registry.js +101 -0
- package/compiled/src/core/model_registry.test.d.ts +2 -0
- package/compiled/src/core/model_registry.test.d.ts.map +1 -0
- package/compiled/src/core/model_registry.test.js +60 -0
- package/compiled/src/core/model_uri.d.ts +57 -0
- package/compiled/src/core/model_uri.d.ts.map +1 -0
- package/compiled/src/core/model_uri.js +101 -0
- package/compiled/src/core/model_uri.test.d.ts +2 -0
- package/compiled/src/core/model_uri.test.d.ts.map +1 -0
- package/compiled/src/core/model_uri.test.js +49 -0
- package/compiled/src/core/progress.d.ts +16 -2
- package/compiled/src/core/progress.d.ts.map +1 -1
- package/compiled/src/core/progress.js +31 -5
- package/compiled/src/core/progress.test.js +11 -2
- package/compiled/src/core/progress_log.d.ts +1 -0
- package/compiled/src/core/progress_log.d.ts.map +1 -1
- package/compiled/src/core/progress_log.js +7 -2
- package/compiled/src/core/progress_log.test.js +21 -0
- package/compiled/src/core/shared_byte_budget.d.ts +60 -0
- package/compiled/src/core/shared_byte_budget.d.ts.map +1 -0
- package/compiled/src/core/shared_byte_budget.js +85 -0
- package/compiled/src/core/shared_byte_budget.test.d.ts +2 -0
- package/compiled/src/core/shared_byte_budget.test.d.ts.map +1 -0
- package/compiled/src/core/shared_byte_budget.test.js +55 -0
- package/compiled/src/core/wasm_heap.d.ts +208 -0
- package/compiled/src/core/wasm_heap.d.ts.map +1 -0
- package/compiled/src/core/wasm_heap.js +417 -0
- package/compiled/src/core/wasm_heap.test.d.ts +2 -0
- package/compiled/src/core/wasm_heap.test.d.ts.map +1 -0
- package/compiled/src/core/wasm_heap.test.js +546 -0
- package/compiled/src/demand/index.d.ts +23 -0
- package/compiled/src/demand/index.d.ts.map +1 -0
- package/compiled/src/demand/index.js +22 -0
- package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts +1 -1
- package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts.map +1 -1
- package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.js +1 -1
- package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.d.ts.map +1 -1
- package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.js +2 -2
- package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts +1 -1
- package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts.map +1 -1
- package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.js +1 -1
- package/compiled/src/ifc/ifc4_gen/schema_ifc.gen.js +2 -2
- package/compiled/src/ifc/ifc_demand_extraction.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_demand_extraction.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_demand_extraction.test.js +251 -0
- package/compiled/src/ifc/ifc_geometry_extraction.d.ts +367 -6
- package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
- package/compiled/src/ifc/ifc_geometry_extraction.js +1322 -389
- package/compiled/src/ifc/ifc_grid_placement.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_grid_placement.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_grid_placement.test.js +261 -0
- package/compiled/src/ifc/ifc_model_geometry.d.ts +12 -0
- package/compiled/src/ifc/ifc_model_geometry.d.ts.map +1 -1
- package/compiled/src/ifc/ifc_model_geometry.js +15 -0
- package/compiled/src/ifc/ifc_regression_batch_main.js +210 -12
- package/compiled/src/ifc/ifc_spatial_skeleton.d.ts +145 -0
- package/compiled/src/ifc/ifc_spatial_skeleton.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_spatial_skeleton.js +266 -0
- package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_spatial_skeleton.test.js +199 -0
- package/compiled/src/ifc/ifc_step_model.d.ts +6 -2
- package/compiled/src/ifc/ifc_step_model.d.ts.map +1 -1
- package/compiled/src/ifc/ifc_step_model.js +6 -4
- package/compiled/src/ifc/ifc_step_parser.d.ts +58 -0
- package/compiled/src/ifc/ifc_step_parser.d.ts.map +1 -1
- package/compiled/src/ifc/ifc_step_parser.js +64 -0
- package/compiled/src/ifc/ifc_stream_model.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_stream_model.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_stream_model.test.js +70 -0
- package/compiled/src/ifc/ifc_stream_open.d.ts +131 -0
- package/compiled/src/ifc/ifc_stream_open.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_stream_open.js +116 -0
- package/compiled/src/ifc/ifc_stream_open.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_stream_open.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_stream_open.test.js +230 -0
- package/compiled/src/ifc/ifc_tile_extractor.d.ts +84 -0
- package/compiled/src/ifc/ifc_tile_extractor.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_tile_extractor.js +134 -0
- package/compiled/src/ifc/ifc_tile_extractor.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_tile_extractor.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_tile_extractor.test.js +118 -0
- package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_typed_select_enum.test.js +60 -0
- package/compiled/src/index.d.ts +21 -1
- package/compiled/src/index.d.ts.map +1 -1
- package/compiled/src/index.js +28 -1
- package/compiled/src/logging/logger.d.ts +16 -2
- package/compiled/src/logging/logger.d.ts.map +1 -1
- package/compiled/src/logging/logger.js +34 -7
- package/compiled/src/logging/logger.test.js +30 -0
- package/compiled/src/mem/index.d.ts +17 -0
- package/compiled/src/mem/index.d.ts.map +1 -0
- package/compiled/src/mem/index.js +16 -0
- package/compiled/src/namespace_surface.test.d.ts +2 -0
- package/compiled/src/namespace_surface.test.d.ts.map +1 -0
- package/compiled/src/namespace_surface.test.js +43 -0
- package/compiled/src/parsing/parsing_buffer.d.ts +23 -0
- package/compiled/src/parsing/parsing_buffer.d.ts.map +1 -1
- package/compiled/src/parsing/parsing_buffer.js +31 -0
- package/compiled/src/scripts/model_report_displacement.test.d.ts +2 -0
- package/compiled/src/scripts/model_report_displacement.test.d.ts.map +1 -0
- package/compiled/src/scripts/model_report_displacement.test.js +104 -0
- package/compiled/src/scripts/render_glb_paths.test.d.ts +2 -0
- package/compiled/src/scripts/render_glb_paths.test.d.ts.map +1 -0
- package/compiled/src/scripts/render_glb_paths.test.js +115 -0
- package/compiled/src/step/indexing/step_type_indexer.d.ts +20 -0
- package/compiled/src/step/indexing/step_type_indexer.d.ts.map +1 -1
- package/compiled/src/step/indexing/step_type_indexer.js +67 -0
- package/compiled/src/step/parsing/byte_source.d.ts +153 -0
- package/compiled/src/step/parsing/byte_source.d.ts.map +1 -0
- package/compiled/src/step/parsing/byte_source.js +106 -0
- package/compiled/src/step/parsing/byte_source.test.d.ts +2 -0
- package/compiled/src/step/parsing/byte_source.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/byte_source.test.js +47 -0
- package/compiled/src/step/parsing/byte_source_node.d.ts +41 -0
- package/compiled/src/step/parsing/byte_source_node.d.ts.map +1 -0
- package/compiled/src/step/parsing/byte_source_node.js +54 -0
- package/compiled/src/step/parsing/columnar_index.d.ts +103 -0
- package/compiled/src/step/parsing/columnar_index.d.ts.map +1 -0
- package/compiled/src/step/parsing/columnar_index.js +224 -0
- package/compiled/src/step/parsing/columnar_index.test.d.ts +2 -0
- package/compiled/src/step/parsing/columnar_index.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/columnar_index.test.js +155 -0
- package/compiled/src/step/parsing/cross_reference_registry.d.ts +95 -0
- package/compiled/src/step/parsing/cross_reference_registry.d.ts.map +1 -0
- package/compiled/src/step/parsing/cross_reference_registry.js +91 -0
- package/compiled/src/step/parsing/cross_reference_registry.test.d.ts +2 -0
- package/compiled/src/step/parsing/cross_reference_registry.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/cross_reference_registry.test.js +66 -0
- package/compiled/src/step/parsing/decode_utf8.d.ts +15 -0
- package/compiled/src/step/parsing/decode_utf8.d.ts.map +1 -1
- package/compiled/src/step/parsing/decode_utf8.js +28 -0
- package/compiled/src/step/parsing/express_ref_scan.d.ts +20 -0
- package/compiled/src/step/parsing/express_ref_scan.d.ts.map +1 -0
- package/compiled/src/step/parsing/express_ref_scan.js +91 -0
- package/compiled/src/step/parsing/express_ref_scan.test.d.ts +2 -0
- package/compiled/src/step/parsing/express_ref_scan.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/express_ref_scan.test.js +28 -0
- package/compiled/src/step/parsing/index_sidecar.d.ts +81 -0
- package/compiled/src/step/parsing/index_sidecar.d.ts.map +1 -0
- package/compiled/src/step/parsing/index_sidecar.js +283 -0
- package/compiled/src/step/parsing/index_sidecar.test.d.ts +2 -0
- package/compiled/src/step/parsing/index_sidecar.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/index_sidecar.test.js +122 -0
- package/compiled/src/step/parsing/inf_recovery_index.test.d.ts +2 -0
- package/compiled/src/step/parsing/inf_recovery_index.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/inf_recovery_index.test.js +108 -0
- package/compiled/src/step/parsing/prefix_type_index.d.ts +124 -0
- package/compiled/src/step/parsing/prefix_type_index.d.ts.map +1 -0
- package/compiled/src/step/parsing/prefix_type_index.js +207 -0
- package/compiled/src/step/parsing/prefix_type_index.test.d.ts +2 -0
- package/compiled/src/step/parsing/prefix_type_index.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/prefix_type_index.test.js +298 -0
- package/compiled/src/step/parsing/range_byte_source.d.ts +69 -0
- package/compiled/src/step/parsing/range_byte_source.d.ts.map +1 -0
- package/compiled/src/step/parsing/range_byte_source.js +78 -0
- package/compiled/src/step/parsing/range_byte_source.test.d.ts +2 -0
- package/compiled/src/step/parsing/range_byte_source.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/range_byte_source.test.js +70 -0
- package/compiled/src/step/parsing/record_event.d.ts +23 -0
- package/compiled/src/step/parsing/record_event.d.ts.map +1 -0
- package/compiled/src/step/parsing/record_event.js +1 -0
- package/compiled/src/step/parsing/record_field_cursor.d.ts +94 -0
- package/compiled/src/step/parsing/record_field_cursor.d.ts.map +1 -0
- package/compiled/src/step/parsing/record_field_cursor.js +189 -0
- package/compiled/src/step/parsing/step_deserialization_functions.d.ts +29 -0
- package/compiled/src/step/parsing/step_deserialization_functions.d.ts.map +1 -1
- package/compiled/src/step/parsing/step_deserialization_functions.js +45 -0
- package/compiled/src/step/parsing/step_deserialization_functions.test.js +59 -1
- package/compiled/src/step/parsing/step_parser.d.ts +66 -1
- package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
- package/compiled/src/step/parsing/step_parser.js +164 -10
- package/compiled/src/step/parsing/step_string_parser.js +8 -8
- package/compiled/src/step/parsing/streaming_index_builder.d.ts +141 -0
- package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -0
- package/compiled/src/step/parsing/streaming_index_builder.js +280 -0
- package/compiled/src/step/parsing/streaming_index_builder.test.d.ts +2 -0
- package/compiled/src/step/parsing/streaming_index_builder.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/streaming_index_builder.test.js +107 -0
- package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts +2 -0
- package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/streaming_index_builder_async.test.js +109 -0
- package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts +71 -0
- package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts.map +1 -0
- package/compiled/src/step/parsing/streaming_record_dispatcher.js +88 -0
- package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts +2 -0
- package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/streaming_record_dispatcher.test.js +66 -0
- package/compiled/src/step/parsing/uint32_sink.d.ts +72 -0
- package/compiled/src/step/parsing/uint32_sink.d.ts.map +1 -0
- package/compiled/src/step/parsing/uint32_sink.js +180 -0
- package/compiled/src/step/parsing/uint32_sink.test.d.ts +2 -0
- package/compiled/src/step/parsing/uint32_sink.test.d.ts.map +1 -0
- package/compiled/src/step/parsing/uint32_sink.test.js +199 -0
- package/compiled/src/step/step_buffer_provider.d.ts +48 -3
- package/compiled/src/step/step_buffer_provider.d.ts.map +1 -1
- package/compiled/src/step/step_buffer_provider.js +60 -11
- package/compiled/src/step/step_buffer_provider.test.js +14 -0
- package/compiled/src/step/step_entity_base.d.ts +65 -3
- package/compiled/src/step/step_entity_base.d.ts.map +1 -1
- package/compiled/src/step/step_entity_base.js +135 -3
- package/compiled/src/step/step_model_base.d.ts +221 -8
- package/compiled/src/step/step_model_base.d.ts.map +1 -1
- package/compiled/src/step/step_model_base.js +542 -7
- package/compiled/src/stream/index.d.ts +34 -0
- package/compiled/src/stream/index.d.ts.map +1 -0
- package/compiled/src/stream/index.js +32 -0
- package/compiled/src/version/version.js +1 -1
- package/compiled/tsconfig.tsbuildinfo +1 -1
- 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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"index_sidecar.test.d.ts","sourceRoot":"","sources":["../../../../src/step/parsing/index_sidecar.test.ts"],"names":[],"mappings":""}
|