@jetta/axle-load-calculator 0.1.3
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/.cursor/ai_changelog/INDEX.md +13 -0
- package/.cursor/ai_changelog/_TEMPLATE.md +55 -0
- package/.cursor/rules/code-standards.mdc +103 -0
- package/.cursor/rules/knowledge-base.mdc +14 -0
- package/.cursor/rules/planning-standards.mdc +55 -0
- package/.cursor/skills/document-feature-knowledge/SKILL.md +51 -0
- package/README.md +49 -0
- package/bitbucket-pipelines.yml +81 -0
- package/build/core/contracts/chassi_reference.d.ts +7 -0
- package/build/core/contracts/chassi_reference.d.ts.map +1 -0
- package/build/core/contracts/chassi_reference.js +5 -0
- package/build/core/contracts/ms_faixas_contract.d.ts +13 -0
- package/build/core/contracts/ms_faixas_contract.d.ts.map +1 -0
- package/build/core/contracts/ms_faixas_contract.js +89 -0
- package/build/core/contracts/rotation_enum.d.ts +11 -0
- package/build/core/contracts/rotation_enum.d.ts.map +1 -0
- package/build/core/contracts/rotation_enum.js +9 -0
- package/build/core/contracts/suspension_type.d.ts +5 -0
- package/build/core/contracts/suspension_type.d.ts.map +1 -0
- package/build/core/contracts/suspension_type.js +4 -0
- package/build/core/contracts/transport_record.d.ts +5 -0
- package/build/core/contracts/transport_record.d.ts.map +1 -0
- package/build/core/contracts/transport_record.js +1 -0
- package/build/core/contracts/vehicle_type.d.ts +12 -0
- package/build/core/contracts/vehicle_type.d.ts.map +1 -0
- package/build/core/contracts/vehicle_type.js +10 -0
- package/build/core/contracts/vehicle_version.d.ts +8 -0
- package/build/core/contracts/vehicle_version.d.ts.map +1 -0
- package/build/core/contracts/vehicle_version.js +7 -0
- package/build/core/contracts/wire_flags.d.ts +27 -0
- package/build/core/contracts/wire_flags.d.ts.map +1 -0
- package/build/core/contracts/wire_flags.js +26 -0
- package/build/core/math/float_tools.d.ts +7 -0
- package/build/core/math/float_tools.d.ts.map +1 -0
- package/build/core/math/float_tools.js +14 -0
- package/build/core/math/gaussian_elimination.d.ts +8 -0
- package/build/core/math/gaussian_elimination.d.ts.map +1 -0
- package/build/core/math/gaussian_elimination.js +85 -0
- package/build/core/orchestration/axle_weight_physics.d.ts +7 -0
- package/build/core/orchestration/axle_weight_physics.d.ts.map +1 -0
- package/build/core/orchestration/axle_weight_physics.js +27 -0
- package/build/core/orchestration/collision_checker.d.ts +6 -0
- package/build/core/orchestration/collision_checker.d.ts.map +1 -0
- package/build/core/orchestration/collision_checker.js +67 -0
- package/build/core/orchestration/connector_payload_builder.d.ts +11 -0
- package/build/core/orchestration/connector_payload_builder.d.ts.map +1 -0
- package/build/core/orchestration/connector_payload_builder.js +67 -0
- package/build/core/orchestration/java_mass_center.d.ts +9 -0
- package/build/core/orchestration/java_mass_center.d.ts.map +1 -0
- package/build/core/orchestration/java_mass_center.js +79 -0
- package/build/core/orchestration/output_builder.d.ts +11 -0
- package/build/core/orchestration/output_builder.d.ts.map +1 -0
- package/build/core/orchestration/output_builder.js +15 -0
- package/build/core/orchestration/request_schema.d.ts +65 -0
- package/build/core/orchestration/request_schema.d.ts.map +1 -0
- package/build/core/orchestration/request_schema.js +20 -0
- package/build/core/orchestration/weight_by_axis_task.d.ts +7 -0
- package/build/core/orchestration/weight_by_axis_task.d.ts.map +1 -0
- package/build/core/orchestration/weight_by_axis_task.js +105 -0
- package/build/core/physics/items/allocated_item.d.ts +22 -0
- package/build/core/physics/items/allocated_item.d.ts.map +1 -0
- package/build/core/physics/items/allocated_item.js +29 -0
- package/build/core/physics/items/allocated_item_manager.d.ts +31 -0
- package/build/core/physics/items/allocated_item_manager.d.ts.map +1 -0
- package/build/core/physics/items/allocated_item_manager.js +38 -0
- package/build/core/physics/items/center_of_mass.d.ts +14 -0
- package/build/core/physics/items/center_of_mass.d.ts.map +1 -0
- package/build/core/physics/items/center_of_mass.js +24 -0
- package/build/core/physics/items/compute_grouper_center_of_mass.d.ts +19 -0
- package/build/core/physics/items/compute_grouper_center_of_mass.d.ts.map +1 -0
- package/build/core/physics/items/compute_grouper_center_of_mass.js +28 -0
- package/build/core/physics/items/item_templates.d.ts +32 -0
- package/build/core/physics/items/item_templates.d.ts.map +1 -0
- package/build/core/physics/items/item_templates.js +53 -0
- package/build/core/physics/items/multi_container_allocated_items.d.ts +37 -0
- package/build/core/physics/items/multi_container_allocated_items.d.ts.map +1 -0
- package/build/core/physics/items/multi_container_allocated_items.js +91 -0
- package/build/core/physics/items/rotation_transforms.d.ts +8 -0
- package/build/core/physics/items/rotation_transforms.d.ts.map +1 -0
- package/build/core/physics/items/rotation_transforms.js +21 -0
- package/build/core/physics/models/axle_weight_model.d.ts +32 -0
- package/build/core/physics/models/axle_weight_model.d.ts.map +1 -0
- package/build/core/physics/models/axle_weight_model.js +72 -0
- package/build/core/physics/models/bi_truck_model.d.ts +21 -0
- package/build/core/physics/models/bi_truck_model.d.ts.map +1 -0
- package/build/core/physics/models/bi_truck_model.js +60 -0
- package/build/core/physics/models/bi_truck_tractor_semi_trailer_model.d.ts +21 -0
- package/build/core/physics/models/bi_truck_tractor_semi_trailer_model.d.ts.map +1 -0
- package/build/core/physics/models/bi_truck_tractor_semi_trailer_model.js +69 -0
- package/build/core/physics/models/bitrem_model.d.ts +33 -0
- package/build/core/physics/models/bitrem_model.d.ts.map +1 -0
- package/build/core/physics/models/bitrem_model.js +123 -0
- package/build/core/physics/models/chassi_forces.d.ts +30 -0
- package/build/core/physics/models/chassi_forces.d.ts.map +1 -0
- package/build/core/physics/models/chassi_forces.js +39 -0
- package/build/core/physics/models/deflection/beam_deflection.d.ts +28 -0
- package/build/core/physics/models/deflection/beam_deflection.d.ts.map +1 -0
- package/build/core/physics/models/deflection/beam_deflection.js +78 -0
- package/build/core/physics/models/deflection/bitrem_deflection.d.ts +22 -0
- package/build/core/physics/models/deflection/bitrem_deflection.d.ts.map +1 -0
- package/build/core/physics/models/deflection/bitrem_deflection.js +54 -0
- package/build/core/physics/models/deflection/create_deflection_delegate.d.ts +12 -0
- package/build/core/physics/models/deflection/create_deflection_delegate.d.ts.map +1 -0
- package/build/core/physics/models/deflection/create_deflection_delegate.js +32 -0
- package/build/core/physics/models/deflection/deflection_model.d.ts +19 -0
- package/build/core/physics/models/deflection/deflection_model.d.ts.map +1 -0
- package/build/core/physics/models/deflection/deflection_model.js +23 -0
- package/build/core/physics/models/deflection/deflection_support_manager.d.ts +21 -0
- package/build/core/physics/models/deflection/deflection_support_manager.d.ts.map +1 -0
- package/build/core/physics/models/deflection/deflection_support_manager.js +40 -0
- package/build/core/physics/models/deflection/deflection_tools.d.ts +6 -0
- package/build/core/physics/models/deflection/deflection_tools.d.ts.map +1 -0
- package/build/core/physics/models/deflection/deflection_tools.js +10 -0
- package/build/core/physics/models/deflection/integration_constant_calculator.d.ts +22 -0
- package/build/core/physics/models/deflection/integration_constant_calculator.d.ts.map +1 -0
- package/build/core/physics/models/deflection/integration_constant_calculator.js +48 -0
- package/build/core/physics/models/deflection/rodotrem_deflection.d.ts +22 -0
- package/build/core/physics/models/deflection/rodotrem_deflection.d.ts.map +1 -0
- package/build/core/physics/models/deflection/rodotrem_deflection.js +47 -0
- package/build/core/physics/models/deflection/semi_reboque_deflection.d.ts +21 -0
- package/build/core/physics/models/deflection/semi_reboque_deflection.d.ts.map +1 -0
- package/build/core/physics/models/deflection/semi_reboque_deflection.js +31 -0
- package/build/core/physics/models/deflection/simple_truck_deflection.d.ts +20 -0
- package/build/core/physics/models/deflection/simple_truck_deflection.d.ts.map +1 -0
- package/build/core/physics/models/deflection/simple_truck_deflection.js +28 -0
- package/build/core/physics/models/deflection/vanderleia_deflection.d.ts +21 -0
- package/build/core/physics/models/deflection/vanderleia_deflection.d.ts.map +1 -0
- package/build/core/physics/models/deflection/vanderleia_deflection.js +41 -0
- package/build/core/physics/models/old_tare_model.d.ts +17 -0
- package/build/core/physics/models/old_tare_model.d.ts.map +1 -0
- package/build/core/physics/models/old_tare_model.js +40 -0
- package/build/core/physics/models/old_tare_scale.d.ts +7 -0
- package/build/core/physics/models/old_tare_scale.d.ts.map +1 -0
- package/build/core/physics/models/old_tare_scale.js +8 -0
- package/build/core/physics/models/old_tare_semireboque.d.ts +7 -0
- package/build/core/physics/models/old_tare_semireboque.d.ts.map +1 -0
- package/build/core/physics/models/old_tare_semireboque.js +37 -0
- package/build/core/physics/models/old_tare_truck.d.ts +7 -0
- package/build/core/physics/models/old_tare_truck.d.ts.map +1 -0
- package/build/core/physics/models/old_tare_truck.js +12 -0
- package/build/core/physics/models/old_tare_vanderleia.d.ts +7 -0
- package/build/core/physics/models/old_tare_vanderleia.d.ts.map +1 -0
- package/build/core/physics/models/old_tare_vanderleia.js +31 -0
- package/build/core/physics/models/percentage_on_axles_calculator.d.ts +19 -0
- package/build/core/physics/models/percentage_on_axles_calculator.d.ts.map +1 -0
- package/build/core/physics/models/percentage_on_axles_calculator.js +39 -0
- package/build/core/physics/models/quad_semi_trailer_model.d.ts +21 -0
- package/build/core/physics/models/quad_semi_trailer_model.d.ts.map +1 -0
- package/build/core/physics/models/quad_semi_trailer_model.js +70 -0
- package/build/core/physics/models/rodotrem_model.d.ts +33 -0
- package/build/core/physics/models/rodotrem_model.d.ts.map +1 -0
- package/build/core/physics/models/rodotrem_model.js +101 -0
- package/build/core/physics/models/semi_reboque_base.d.ts +34 -0
- package/build/core/physics/models/semi_reboque_base.d.ts.map +1 -0
- package/build/core/physics/models/semi_reboque_base.js +85 -0
- package/build/core/physics/models/semi_reboque_model.d.ts +41 -0
- package/build/core/physics/models/semi_reboque_model.d.ts.map +1 -0
- package/build/core/physics/models/semi_reboque_model.js +84 -0
- package/build/core/physics/models/simple_truck_base.d.ts +29 -0
- package/build/core/physics/models/simple_truck_base.d.ts.map +1 -0
- package/build/core/physics/models/simple_truck_base.js +57 -0
- package/build/core/physics/models/simple_truck_model.d.ts +41 -0
- package/build/core/physics/models/simple_truck_model.d.ts.map +1 -0
- package/build/core/physics/models/simple_truck_model.js +76 -0
- package/build/core/physics/models/single_container_tare.d.ts +18 -0
- package/build/core/physics/models/single_container_tare.d.ts.map +1 -0
- package/build/core/physics/models/single_container_tare.js +45 -0
- package/build/core/physics/models/tare_model.d.ts +12 -0
- package/build/core/physics/models/tare_model.d.ts.map +1 -0
- package/build/core/physics/models/tare_model.js +36 -0
- package/build/core/physics/models/vanderleia_model.d.ts +33 -0
- package/build/core/physics/models/vanderleia_model.d.ts.map +1 -0
- package/build/core/physics/models/vanderleia_model.js +100 -0
- package/build/core/physics/services/axle_weight_output_builder.d.ts +27 -0
- package/build/core/physics/services/axle_weight_output_builder.d.ts.map +1 -0
- package/build/core/physics/services/axle_weight_output_builder.js +42 -0
- package/build/core/physics/services/axle_weight_service.d.ts +20 -0
- package/build/core/physics/services/axle_weight_service.d.ts.map +1 -0
- package/build/core/physics/services/axle_weight_service.js +91 -0
- package/build/core/physics/services/cm_axle_weight_service.d.ts +12 -0
- package/build/core/physics/services/cm_axle_weight_service.d.ts.map +1 -0
- package/build/core/physics/services/cm_axle_weight_service.js +33 -0
- package/build/core/physics/services/container_corner_forces.d.ts +33 -0
- package/build/core/physics/services/container_corner_forces.d.ts.map +1 -0
- package/build/core/physics/services/container_corner_forces.js +84 -0
- package/build/core/physics/transports/axle_manager.d.ts +22 -0
- package/build/core/physics/transports/axle_manager.d.ts.map +1 -0
- package/build/core/physics/transports/axle_manager.js +34 -0
- package/build/core/physics/transports/axle_record.d.ts +21 -0
- package/build/core/physics/transports/axle_record.d.ts.map +1 -0
- package/build/core/physics/transports/axle_record.js +57 -0
- package/build/core/physics/transports/chassi.d.ts +52 -0
- package/build/core/physics/transports/chassi.d.ts.map +1 -0
- package/build/core/physics/transports/chassi.js +105 -0
- package/build/core/physics/transports/container_record.d.ts +25 -0
- package/build/core/physics/transports/container_record.d.ts.map +1 -0
- package/build/core/physics/transports/container_record.js +49 -0
- package/build/core/physics/transports/containerweight/container_max_weight_calculator.d.ts +27 -0
- package/build/core/physics/transports/containerweight/container_max_weight_calculator.d.ts.map +1 -0
- package/build/core/physics/transports/containerweight/container_max_weight_calculator.js +40 -0
- package/build/core/physics/transports/containerweight/container_tare_calculator.d.ts +28 -0
- package/build/core/physics/transports/containerweight/container_tare_calculator.d.ts.map +1 -0
- package/build/core/physics/transports/containerweight/container_tare_calculator.js +55 -0
- package/build/core/physics/transports/containerweight/container_weight_model.d.ts +15 -0
- package/build/core/physics/transports/containerweight/container_weight_model.d.ts.map +1 -0
- package/build/core/physics/transports/containerweight/container_weight_model.js +31 -0
- package/build/core/physics/transports/containerweight/merged_containers_weight_calculator.d.ts +17 -0
- package/build/core/physics/transports/containerweight/merged_containers_weight_calculator.d.ts.map +1 -0
- package/build/core/physics/transports/containerweight/merged_containers_weight_calculator.js +31 -0
- package/build/core/physics/transports/containerweight/single_container_weight_calculator.d.ts +20 -0
- package/build/core/physics/transports/containerweight/single_container_weight_calculator.d.ts.map +1 -0
- package/build/core/physics/transports/containerweight/single_container_weight_calculator.js +48 -0
- package/build/core/physics/transports/grouped_containers.d.ts +34 -0
- package/build/core/physics/transports/grouped_containers.d.ts.map +1 -0
- package/build/core/physics/transports/grouped_containers.js +68 -0
- package/build/core/physics/transports/merged_containers.d.ts +26 -0
- package/build/core/physics/transports/merged_containers.d.ts.map +1 -0
- package/build/core/physics/transports/merged_containers.js +45 -0
- package/build/core/physics/transports/tare/bitrem_axle_splitter.d.ts +26 -0
- package/build/core/physics/transports/tare/bitrem_axle_splitter.d.ts.map +1 -0
- package/build/core/physics/transports/tare/bitrem_axle_splitter.js +84 -0
- package/build/core/physics/transports/tare/bitrem_axle_weight_split.d.ts +22 -0
- package/build/core/physics/transports/tare/bitrem_axle_weight_split.d.ts.map +1 -0
- package/build/core/physics/transports/tare/bitrem_axle_weight_split.js +32 -0
- package/build/core/physics/transports/transport.d.ts +33 -0
- package/build/core/physics/transports/transport.d.ts.map +1 -0
- package/build/core/physics/transports/transport.js +110 -0
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +10 -0
- package/eslint.config.js +51 -0
- package/package.json +38 -0
- package/src/core/contracts/chassi_reference.ts +7 -0
- package/src/core/contracts/ms_faixas_contract.ts +114 -0
- package/src/core/contracts/rotation_enum.ts +11 -0
- package/src/core/contracts/suspension_type.ts +4 -0
- package/src/core/contracts/transport_record.ts +4 -0
- package/src/core/contracts/vehicle_type.ts +12 -0
- package/src/core/contracts/vehicle_version.ts +7 -0
- package/src/core/contracts/wire_flags.ts +26 -0
- package/src/core/math/float_tools.ts +17 -0
- package/src/core/math/gaussian_elimination.ts +104 -0
- package/src/core/orchestration/axle_weight_physics.ts +37 -0
- package/src/core/orchestration/collision_checker.ts +86 -0
- package/src/core/orchestration/connector_payload_builder.ts +81 -0
- package/src/core/orchestration/java_mass_center.ts +98 -0
- package/src/core/orchestration/output_builder.ts +18 -0
- package/src/core/orchestration/request_schema.ts +26 -0
- package/src/core/orchestration/weight_by_axis_task.ts +140 -0
- package/src/core/physics/items/allocated_item.ts +41 -0
- package/src/core/physics/items/allocated_item_manager.ts +50 -0
- package/src/core/physics/items/center_of_mass.ts +31 -0
- package/src/core/physics/items/compute_grouper_center_of_mass.ts +44 -0
- package/src/core/physics/items/item_templates.ts +65 -0
- package/src/core/physics/items/multi_container_allocated_items.ts +120 -0
- package/src/core/physics/items/rotation_transforms.ts +29 -0
- package/src/core/physics/models/axle_weight_model.ts +109 -0
- package/src/core/physics/models/bi_truck_model.ts +74 -0
- package/src/core/physics/models/bi_truck_tractor_semi_trailer_model.ts +86 -0
- package/src/core/physics/models/bitrem_model.ts +148 -0
- package/src/core/physics/models/chassi_forces.ts +50 -0
- package/src/core/physics/models/deflection/beam_deflection.ts +105 -0
- package/src/core/physics/models/deflection/bitrem_deflection.ts +68 -0
- package/src/core/physics/models/deflection/create_deflection_delegate.ts +46 -0
- package/src/core/physics/models/deflection/deflection_model.ts +33 -0
- package/src/core/physics/models/deflection/deflection_support_manager.ts +56 -0
- package/src/core/physics/models/deflection/deflection_tools.ts +11 -0
- package/src/core/physics/models/deflection/integration_constant_calculator.ts +62 -0
- package/src/core/physics/models/deflection/rodotrem_deflection.ts +57 -0
- package/src/core/physics/models/deflection/semi_reboque_deflection.ts +40 -0
- package/src/core/physics/models/deflection/simple_truck_deflection.ts +35 -0
- package/src/core/physics/models/deflection/vanderleia_deflection.ts +48 -0
- package/src/core/physics/models/old_tare_model.ts +51 -0
- package/src/core/physics/models/old_tare_scale.ts +9 -0
- package/src/core/physics/models/old_tare_semireboque.ts +51 -0
- package/src/core/physics/models/old_tare_truck.ts +15 -0
- package/src/core/physics/models/old_tare_vanderleia.ts +44 -0
- package/src/core/physics/models/percentage_on_axles_calculator.ts +49 -0
- package/src/core/physics/models/quad_semi_trailer_model.ts +87 -0
- package/src/core/physics/models/rodotrem_model.ts +131 -0
- package/src/core/physics/models/semi_reboque_base.ts +103 -0
- package/src/core/physics/models/semi_reboque_model.ts +127 -0
- package/src/core/physics/models/simple_truck_base.ts +70 -0
- package/src/core/physics/models/simple_truck_model.ts +115 -0
- package/src/core/physics/models/single_container_tare.ts +56 -0
- package/src/core/physics/models/tare_model.ts +46 -0
- package/src/core/physics/models/vanderleia_model.ts +125 -0
- package/src/core/physics/services/axle_weight_output_builder.ts +63 -0
- package/src/core/physics/services/axle_weight_service.ts +116 -0
- package/src/core/physics/services/cm_axle_weight_service.ts +45 -0
- package/src/core/physics/services/container_corner_forces.ts +95 -0
- package/src/core/physics/transports/axle_manager.ts +45 -0
- package/src/core/physics/transports/axle_record.ts +68 -0
- package/src/core/physics/transports/chassi.ts +130 -0
- package/src/core/physics/transports/container_record.ts +58 -0
- package/src/core/physics/transports/containerweight/container_max_weight_calculator.ts +59 -0
- package/src/core/physics/transports/containerweight/container_tare_calculator.ts +76 -0
- package/src/core/physics/transports/containerweight/container_weight_model.ts +38 -0
- package/src/core/physics/transports/containerweight/merged_containers_weight_calculator.ts +39 -0
- package/src/core/physics/transports/containerweight/single_container_weight_calculator.ts +65 -0
- package/src/core/physics/transports/grouped_containers.ts +91 -0
- package/src/core/physics/transports/merged_containers.ts +62 -0
- package/src/core/physics/transports/tare/bitrem_axle_splitter.ts +107 -0
- package/src/core/physics/transports/tare/bitrem_axle_weight_split.ts +55 -0
- package/src/core/physics/transports/transport.ts +137 -0
- package/src/index.ts +12 -0
- package/src/service/.gitkeep +0 -0
- package/test/data/src/core/orchestration/weight_by_axis/case_1_basic_truck_input.json +1759 -0
- package/test/data/src/core/orchestration/weight_by_axis/case_2_vanderleia_input.json +1286 -0
- package/test/data/src/core/orchestration/weight_by_axis/case_3_interlink_input.json +2226 -0
- package/test/data/src/core/orchestration/weight_by_axis/case_4_quad_semi_trailer.json +639 -0
- package/test/data/src/core/orchestration/weight_by_axis/case_5_custom_center_of_gravity.json +557 -0
- package/test/data/src/core/physics/axle_weight_calculations/case_2_bitruck.json +664 -0
- package/test/data/src/core/physics/axle_weight_calculations/case_4_quad_semi_trailer.json +674 -0
- package/test/data/src/core/physics/axle_weight_calculations/case_5_bi_truck_semi_trailer.json +674 -0
- package/test/data/src/core/physics/axle_weight_service/case_1_input_truck.json +1025 -0
- package/test/data/src/core/physics/axle_weight_service/case_1_output_truck.json +38 -0
- package/test/data/src/core/physics/axle_weight_service/case_2_vanderleia_input.json +1286 -0
- package/test/data/src/core/physics/axle_weight_service/case_2_vanderleia_output.json +65 -0
- package/test/data/src/core/physics/axle_weight_service/case_3_input_semireboque.json +24625 -0
- package/test/data/src/core/physics/axle_weight_service/case_3_output_semireboque.json +57 -0
- package/test/data/src/core/physics/axle_weight_service/case_4_input_bitrem.json +2226 -0
- package/test/data/src/core/physics/axle_weight_service/case_4_output_bitrem.json +96 -0
- package/test/data/src/core/physics/beam_deflection/case_10_rodotrem_offset.json +474 -0
- package/test/data/src/core/physics/beam_deflection/case_11_bitruck.json +664 -0
- package/test/data/src/core/physics/beam_deflection/case_12_quad_semi_trailer.json +792 -0
- package/test/data/src/core/physics/beam_deflection/case_13_bi_truck_semi_trailer.json +792 -0
- package/test/data/src/core/physics/beam_deflection/case_1_documentation.ipynb +316 -0
- package/test/data/src/core/physics/beam_deflection/case_1_semireboque.json +402 -0
- package/test/data/src/core/physics/beam_deflection/case_2_bitrem.json +434 -0
- package/test/data/src/core/physics/beam_deflection/case_3_rodotrem.json +474 -0
- package/test/data/src/core/physics/beam_deflection/case_4_vanderleia_pneumatica.json +425 -0
- package/test/data/src/core/physics/beam_deflection/case_5_vanderleia_mecanica.json +366 -0
- package/test/data/src/core/physics/beam_deflection/case_6_truck.json +279 -0
- package/test/data/src/core/physics/beam_deflection/case_7_semireboque_structural_offset.json +318 -0
- package/test/data/src/core/physics/beam_deflection/case_8_vanderleia_offset.json +425 -0
- package/test/data/src/core/physics/beam_deflection/case_9_bitrem_offset.json +434 -0
- package/test/data/src/core/physics/bitrem_axle_splitter/case_1_simple_bitrem.json +145 -0
- package/test/data/src/core/physics/bitrem_axle_splitter/case_2_lowered_bitrem.json +238 -0
- package/test/data/src/core/physics/bitrem_axle_splitter/case_3_lowered_positive_proportion.json +238 -0
- package/test/data/src/core/physics/c_m_axle_weight_service/case_1_interlink_trailer.json +94 -0
- package/test/data/src/core/physics/calculations/case_1_simple_truck.json +83 -0
- package/test/data/src/core/physics/calculations/case_2_lowered_bitrem.json +1051 -0
- package/test/data/src/core/physics/calculations/case_3_container_mercedes.json +50 -0
- package/test/data/src/core/physics/container_corner_forces/case_1.json +674 -0
- package/test/data/src/core/physics/container_weight/case_1_basictruck.json +223 -0
- package/test/data/src/core/physics/container_weight/case_2_roadtrain.json +277 -0
- package/test/data/src/core/physics/container_weight/case_3_semireboque_rebaixado.json +197 -0
- package/test/data/src/core/physics/container_weight/case_4_semireboque_neck_limit.json +197 -0
- package/test/data/src/core/physics/container_weight/case_5_vanderleia_rebaixada.json +211 -0
- package/test/data/src/core/physics/container_weight/case_6_lowered_interlink.json +230 -0
- package/test/data/src/core/physics/python_goldens.json +9 -0
- package/test/data/src/core/physics/tare/case_1_simple_vanderleia.json +185 -0
- package/test/data/src/core/physics/tare/case_2_lowered_vanderleia.json +646 -0
- package/test/data/src/core/physics/tare/case_3_lowered_interlink.json +230 -0
- package/test/data/src/core/physics/tare/case_4_negative_tare_VUC.json +483 -0
- package/test/data/src/core/physics/tare/case_5_truck_bitruck.json +664 -0
- package/test/data/src/core/physics/tare/case_6_quad_semi_trailer.json +203 -0
- package/test/data/src/core/physics/tare/case_7_bi_truck_semi_trailer.json +203 -0
- package/test/data/src/core/physics/tare/case_8_triaxle_semi_trailer.json +203 -0
- package/test/data/src/core/physics/time_performance/case_1_center_of_mass.json +2916 -0
- package/test/data/src/core/physics/trucks/bitrem.json +150 -0
- package/test/data/src/core/physics/trucks/lowered_bitrem.json +1216 -0
- package/test/data/src/core/physics/trucks/lowered_bitrem_empty_first_container.json +1182 -0
- package/test/data/src/core/physics/trucks/rodotrem.json +148 -0
- package/test/data/src/core/physics/trucks/semi_reboque.json +91 -0
- package/test/data/src/core/physics/trucks/semi_reboque_rebaixado.json +1629 -0
- package/test/data/src/core/physics/trucks/simple_truck.json +85 -0
- package/test/data/src/core/physics/trucks/vanderleia_mechanical.json +105 -0
- package/test/data/src/core/physics/trucks/vanderleia_pneumatic.json +105 -0
- package/test/src/core/orchestration/request_schema.test.ts +20 -0
- package/test/src/core/orchestration/weight_by_axis_task.test.ts +87 -0
- package/test/src/core/physics/items/center_of_mass.test.ts +38 -0
- package/test/src/core/physics/items/multi_container_allocated_items.test.ts +22 -0
- package/test/src/core/physics/math_input_helpers.ts +64 -0
- package/test/src/core/physics/models/bitrem_model.test.ts +54 -0
- package/test/src/core/physics/models/deflection/deflection_model.test.ts +78 -0
- package/test/src/core/physics/models/rodotrem_model.test.ts +29 -0
- package/test/src/core/physics/models/semi_reboque_model.test.ts +72 -0
- package/test/src/core/physics/models/simple_truck_model.test.ts +23 -0
- package/test/src/core/physics/models/tare_model.test.ts +34 -0
- package/test/src/core/physics/models/vanderleia_model.test.ts +36 -0
- package/test/src/core/physics/services/axle_weight_service.test.ts +56 -0
- package/test/src/core/physics/services/cm_axle_weight_service.test.ts +23 -0
- package/test/src/core/physics/services/container_corner_forces.test.ts +23 -0
- package/test/src/core/physics/test_helpers.ts +13 -0
- package/test/src/core/physics/transports/chassi.test.ts +35 -0
- package/test/src/core/physics/transports/containerweight/container_weight_model.test.ts +57 -0
- package/test/src/core/physics/transports/tare/bitrem_axle_splitter.test.ts +30 -0
- package/test/src/index.test.ts +35 -0
- package/tsconfig.eslint.json +15 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Feature knowledge index
|
|
2
|
+
|
|
3
|
+
Agent-oriented notes for implemented features in this repository.
|
|
4
|
+
|
|
5
|
+
| Ticket | Topic | Primary module | Doc |
|
|
6
|
+
|--------|-------|----------------|-----|
|
|
7
|
+
|
|
8
|
+
## How to add a doc
|
|
9
|
+
|
|
10
|
+
1. Copy structure from [_TEMPLATE.md](./_TEMPLATE.md).
|
|
11
|
+
2. Save as `JET-XXXX-short-slug.md` (lowercase slug, hyphens).
|
|
12
|
+
3. Add a row to this table.
|
|
13
|
+
4. In Cursor, invoke: `KB: JET-XXXX` or use the `document-feature-knowledge` skill.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# JET-XXXX — Short title
|
|
2
|
+
|
|
3
|
+
## Problem / outcome
|
|
4
|
+
|
|
5
|
+
One paragraph: what problem this solves and what changes for callers.
|
|
6
|
+
|
|
7
|
+
## Scope
|
|
8
|
+
|
|
9
|
+
- **In scope:**
|
|
10
|
+
- **Out of scope / unchanged:**
|
|
11
|
+
|
|
12
|
+
## Entry points
|
|
13
|
+
|
|
14
|
+
| Role | Path |
|
|
15
|
+
|------|------|
|
|
16
|
+
| Main logic | `src/...` |
|
|
17
|
+
| Integration | `src/...` |
|
|
18
|
+
| Config accessors | `src/models/Cargo_Profile.js` |
|
|
19
|
+
| Validation | `src/validation/schemas/...` |
|
|
20
|
+
|
|
21
|
+
## Configuration
|
|
22
|
+
|
|
23
|
+
Do not duplicate full key docs here. Link to [config.md](../../config.md) and list only behavior-specific notes.
|
|
24
|
+
|
|
25
|
+
- Keys: `...`
|
|
26
|
+
- Defaults:
|
|
27
|
+
- Enabled when:
|
|
28
|
+
|
|
29
|
+
## Behavior and invariants
|
|
30
|
+
|
|
31
|
+
-
|
|
32
|
+
- Fixed vocabulary: `src/.../Some_Strategy.js`
|
|
33
|
+
|
|
34
|
+
## Flow (optional)
|
|
35
|
+
|
|
36
|
+
```mermaid
|
|
37
|
+
flowchart LR
|
|
38
|
+
A[Input] --> B[Step]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Tests as specification
|
|
42
|
+
|
|
43
|
+
| Type | Path | What it proves |
|
|
44
|
+
|------|------|----------------|
|
|
45
|
+
| Unit | `test/src/...` | |
|
|
46
|
+
| Integration | `test/src/...` | |
|
|
47
|
+
|
|
48
|
+
## Dependencies and related work
|
|
49
|
+
|
|
50
|
+
- Tickets:
|
|
51
|
+
- Packages:
|
|
52
|
+
|
|
53
|
+
## Open questions
|
|
54
|
+
|
|
55
|
+
- (only if still true)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Project standards from GEMINI.md (language, naming, code rules, style, refactoring, testing, commit)
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# General Standards
|
|
7
|
+
|
|
8
|
+
## Languages
|
|
9
|
+
|
|
10
|
+
1. English. Always.
|
|
11
|
+
|
|
12
|
+
## Naming Conventions
|
|
13
|
+
|
|
14
|
+
1. Use `snake_case` for all functions, variables, and parameters;
|
|
15
|
+
2. Use `lowercase` for folder names;
|
|
16
|
+
3. Prefer full words over abbreviations in variable and parameter names so intent stays obvious (e.g. `minimum_weight` rather than `min_w`). Narrow exceptions: ubiquitous forms such as `id`, conventional loop indices (`i`, `j`), or standard acronyms where spelling them out adds noise without clarity;
|
|
17
|
+
|
|
18
|
+
## Code Rules
|
|
19
|
+
|
|
20
|
+
1. Meaningful names only;
|
|
21
|
+
2. Adhere to the SOLID principles;
|
|
22
|
+
3. Maximum 2 statements per line (e.g. two assignments or two declarations). Chained method calls (e.g. `a().b().c()`) count each as one statement;
|
|
23
|
+
4. Prefer the algorithm with the best time/space complexity that is still readable and maintainable;
|
|
24
|
+
5. Maximum 25 lines per function. It does not apply to comments or blank lines;
|
|
25
|
+
6. Maximum 125 lines per file. It does not apply to comments or blank lines;
|
|
26
|
+
7. When a file or module gains multiple distinct responsibilities, split it into separate files so that each file has a single, clear responsibility (and the split keeps the design coherent) - that's an enforcement on SOLID principles;
|
|
27
|
+
8. Adhere to modern and best practices standards;
|
|
28
|
+
9. Prefer one of: return an empty collection (e.g. []), use an optional/Maybe type, return a Result/Either type, or throw a documented exception. Choose based on the API contract and language idioms.;
|
|
29
|
+
10. Avoid anonymous functions being declared inside of another function, except trivial one-liners when readability is not harmed (e.g. `.map(x => x.id)`). Except anonymous callbacks that are a single expression with no side effects and that are passed directly to a well-known higher-order function (e.g. .map(x => x.id), .filter(Boolean)). If in doubt, extract to a named function;
|
|
30
|
+
11. Avoid nested functions;
|
|
31
|
+
12. Avoid multiple classes, interfaces or types in the same file: split them into a single one per file;
|
|
32
|
+
13. Avoid generic exceptions. Create specialized exceptions instead.
|
|
33
|
+
|
|
34
|
+
## Code Style
|
|
35
|
+
|
|
36
|
+
1. Follow the rules defined in `eslint.config.js`.
|
|
37
|
+
2. Document all public functions using JSDoc, explaining their purpose, parameters (`@param`), and return values (`@returns`);
|
|
38
|
+
3. Follow the semicolon style defined in eslint.config.js;
|
|
39
|
+
4. Run `npm run lint` before committing. Fix any reported issues before committing.
|
|
40
|
+
|
|
41
|
+
## Error Handling
|
|
42
|
+
|
|
43
|
+
1. Never suppress errors silently with empty `catch` blocks; either handle them meaningfully or rethrow;
|
|
44
|
+
2. Log errors with enough context (operation, relevant identifiers, inputs) to make the failure diagnosable.
|
|
45
|
+
|
|
46
|
+
## Performance
|
|
47
|
+
|
|
48
|
+
1. Avoid expensive operations inside loops; hoist invariant computations out of the loop body, or use optimized array methods to prevent redundant processing.
|
|
49
|
+
|
|
50
|
+
## API Design
|
|
51
|
+
|
|
52
|
+
1. Use a standardized response format across all API endpoints to ensure consistency and predictability;
|
|
53
|
+
2. Validate every incoming payload from user input or API clients using a robust validation schema (e.g., `zod`, already a project dependency);
|
|
54
|
+
3. After validating a fixed-vocabulary field, normalize it to the shared constants object defined in **Fixed Vocabularies**; reject or default unknown values at the boundary, not in downstream consumers.
|
|
55
|
+
|
|
56
|
+
## Fixed Vocabularies
|
|
57
|
+
|
|
58
|
+
1. When a value belongs to a fixed, finite set (e.g. strategies, modes, statuses), define it once as a frozen constants object and reuse it across validation, readers, and consumers. Do not scatter the same string literals in multiple files;
|
|
59
|
+
2. In plain JavaScript, use a frozen object as the enum (not TypeScript `enum`). Export both the named constants and, when useful, `Object.values(...)` for schema allow-lists;
|
|
60
|
+
3. Keep external wire formats as strings (config JSON, API payloads). Map validated input to the shared constants at the boundary; internal code compares against the constants, not raw strings;
|
|
61
|
+
4. Place the constants module next to the domain they describe (e.g. `src/Allocation_Optimization/density_groups/Density_Groups_Strategy.js`), not inside validation-only modules, unless the vocabulary is truly validation-specific;
|
|
62
|
+
5. Document public accessors that return a vocabulary member with JSDoc union types referencing the constants (e.g. `@returns {typeof DENSITY_GROUPS_STRATEGY.ROUND_ROBIN | typeof DENSITY_GROUPS_STRATEGY.ADAPTIVE}`);
|
|
63
|
+
6. Prefer the constants in tests as well (`expect(...).to.equal(DENSITY_GROUPS_STRATEGY.ADAPTIVE)`), so tests stay aligned with production code.
|
|
64
|
+
|
|
65
|
+
## Security
|
|
66
|
+
|
|
67
|
+
1. Never trust external input; validate and sanitize all data from users or API clients before using it, to prevent injection, XSS, and similar vulnerabilities.
|
|
68
|
+
|
|
69
|
+
## Refactoring
|
|
70
|
+
|
|
71
|
+
1. When refactoring, preserve behavior: do not change the observable semantics of the code. Refactoring is structure-only unless the user explicitly requests a behavior change;
|
|
72
|
+
2. Prioritize readability and explicit logic over extreme conciseness;
|
|
73
|
+
3. Simplify unnecessary abstractions, but do not sacrifice clarity for fewer lines of code.
|
|
74
|
+
|
|
75
|
+
## Testing
|
|
76
|
+
|
|
77
|
+
1. Write tests using Mocha and Chai;
|
|
78
|
+
2. Structure tests with `describe` for test suites and `it` for individual test cases;
|
|
79
|
+
3. Test descriptions should be clear, descriptive, and explain the expected behavior;
|
|
80
|
+
4. Under `test/src`, mirror the directory structure of `src/` (e.g. `src/Allocation_Optimization/block_builder/` → `test/src/Allocation_Optimization/block_builder/`);
|
|
81
|
+
5. Test data are to be created on root/test/data/src, then follow root/src's pattern of folder;
|
|
82
|
+
6. Ensure tests cover the 'happy path', known edge cases, invalid inputs, and all expected Exception scenarios;
|
|
83
|
+
7. Avoid redundant tests that assert the same logical branch;
|
|
84
|
+
8. Avoid changing the main code behavior in tests, except when the user has explicitly asked for a behavior change;
|
|
85
|
+
9. Always add intergration tests.
|
|
86
|
+
|
|
87
|
+
## Commit
|
|
88
|
+
|
|
89
|
+
This project adheres to:
|
|
90
|
+
|
|
91
|
+
1. [SemVer](https://semver.org/)
|
|
92
|
+
2. [Conventional Commits](https://www.conventionalcommits.org/en/)
|
|
93
|
+
3. **Make atomic commits:** Each commit must represent a single, logical change (e.g., refactoring one component, deleting an unused file, or fixing a specific bug);
|
|
94
|
+
4. **Never use `git add .` or `git commit -a`:** Always stage files individually (`git add <file>`) to ensure multiple distinct changes are not grouped in a single commit;
|
|
95
|
+
5. **Irreversible commands:** Never use irreversible git commands (e.g., `git reset --hard`, `git clean -fd`) without explicit permission granted by the user;
|
|
96
|
+
6. Avoid adding `Made-with: Cursor` to commit messages;
|
|
97
|
+
7. Commit messages should be one concise phrase;
|
|
98
|
+
8. Try to keep tests green after each commit, if possible;
|
|
99
|
+
9. Never commit input from debug. i.e., `./debug/data/input.json`.
|
|
100
|
+
|
|
101
|
+
## README
|
|
102
|
+
|
|
103
|
+
1. must contain at least sections `how to install`, `usage`, `dependencies`, `requirements` (not necessarily in that order)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Feature knowledge base location and doc shape for ai_changelog
|
|
3
|
+
globs: .cursor/ai_changelog/**
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Knowledge base
|
|
8
|
+
|
|
9
|
+
Feature knowledge lives in `.cursor/ai_changelog/`.
|
|
10
|
+
|
|
11
|
+
- New docs: follow `_TEMPLATE.md`; filename `JET-XXXX-short-slug.md`.
|
|
12
|
+
- Update `INDEX.md` when adding a doc.
|
|
13
|
+
- Config keys: link to `config.md`, do not duplicate tables.
|
|
14
|
+
- Prefer tests + code over stale PR text when they disagree.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Planning norms—investigation, scope, plan shape, clarifications, Plan Mode alignment (enable for design-heavy work)
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Planning Standards
|
|
7
|
+
|
|
8
|
+
## Languages
|
|
9
|
+
|
|
10
|
+
1. English. Always.
|
|
11
|
+
|
|
12
|
+
## When to plan
|
|
13
|
+
|
|
14
|
+
1. Produce a written plan before multi-file work, behavior changes, or ambiguous requirements;
|
|
15
|
+
2. Prefer a short plan even for medium tasks when trade-offs or risks matter;
|
|
16
|
+
3. Skip heavy planning for obvious one-line fixes when scope and approach are already clear.
|
|
17
|
+
|
|
18
|
+
## Research first
|
|
19
|
+
|
|
20
|
+
1. Investigate with read-only steps (read files, search the codebase) before proposing changes;
|
|
21
|
+
2. Cite existing code using full repository paths and, when helpful, markdown links to files;
|
|
22
|
+
3. When the session is in Plan Mode (or the user asked for a plan only), do not edit files, run mutating commands, or commit until the user approves the plan;
|
|
23
|
+
4. Base the plan on evidence from the repo, not assumptions; state explicit assumptions when evidence is missing.
|
|
24
|
+
|
|
25
|
+
## Scope and constraints
|
|
26
|
+
|
|
27
|
+
1. State what is in scope and what is explicitly out of scope;
|
|
28
|
+
2. Avoid drive-by refactors and unrelated file churn; every planned change should trace to the user request;
|
|
29
|
+
3. Respect project rules in `code-standards.mdc` once implementation begins.
|
|
30
|
+
|
|
31
|
+
## Clarification
|
|
32
|
+
|
|
33
|
+
1. If requirements are ambiguous or multiple approaches differ materially, ask one or two critical questions before finalizing the plan;
|
|
34
|
+
2. Surface trade-offs in the plan instead of hiding them in later implementation;
|
|
35
|
+
3. Prefer structured multiple-choice when the product offers it for decisions that block planning;
|
|
36
|
+
4. Avoid any assumption.
|
|
37
|
+
|
|
38
|
+
## Plan document shape
|
|
39
|
+
|
|
40
|
+
1. Start with a clear title and a short overview of the goal and outcome;
|
|
41
|
+
2. List key files to touch with paths (markdown links where useful);
|
|
42
|
+
3. Use ordered, actionable steps the implementer can follow;
|
|
43
|
+
4. Call out risks, unknowns, and dependencies;
|
|
44
|
+
5. Use mermaid or similar diagrams only when the flow or architecture is non-trivial;
|
|
45
|
+
6. Keep the plan proportional to task complexity—do not over-engineer small changes.
|
|
46
|
+
|
|
47
|
+
## Handoff to implementation
|
|
48
|
+
|
|
49
|
+
1. After the user accepts the plan, implement following `.cursor/rules/code-standards.mdc` (code style, tests, commits);
|
|
50
|
+
2. If the user revises the plan mid-task, treat updates as steering unless they clearly start a new task.
|
|
51
|
+
|
|
52
|
+
## Tooling alignment
|
|
53
|
+
|
|
54
|
+
1. When using the product’s plan workflow, the user-visible plan should satisfy the sections above without duplicating Cursor product documentation;
|
|
55
|
+
2. Do not edit the plan artifact file itself unless the user explicitly asks to update that file.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: document-feature-knowledge
|
|
3
|
+
description: >-
|
|
4
|
+
Create or update a feature knowledge doc under .cursor/ai_changelog from
|
|
5
|
+
code, tests, and config. Use when the user says "knowledge base", "KB:",
|
|
6
|
+
"document this feature", or names a JET ticket for condensation.
|
|
7
|
+
disable-model-invocation: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Document feature knowledge
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
The user explicitly asks to document a feature or branch in the knowledge base (e.g. "KB: JET-1977", "document density groups in the knowledge base").
|
|
15
|
+
|
|
16
|
+
## Output location
|
|
17
|
+
|
|
18
|
+
- Directory: `.cursor/ai_changelog/`
|
|
19
|
+
- Filename: `JET-XXXX-short-slug.md` (lowercase slug, hyphens)
|
|
20
|
+
- Template: copy structure from `_TEMPLATE.md`
|
|
21
|
+
- Update `INDEX.md` with a new row when creating a file
|
|
22
|
+
|
|
23
|
+
## Source-of-truth priority
|
|
24
|
+
|
|
25
|
+
1. Integration and unit tests under `test/src/` (mirror of `src/`)
|
|
26
|
+
2. `config.md` for keys, defaults, ranges
|
|
27
|
+
3. Implementation under `src/`
|
|
28
|
+
4. User-provided PR notes or chat decisions (label as "product decision" if not in code)
|
|
29
|
+
|
|
30
|
+
Do not duplicate `config.md` key tables; link to sections instead.
|
|
31
|
+
|
|
32
|
+
## Research steps
|
|
33
|
+
|
|
34
|
+
1. Parse ticket id (JET-XXXX) and scope from the user message; ask if scope is ambiguous.
|
|
35
|
+
2. If branch or commit range given, use read-only `git diff` / `git log` to bound changes.
|
|
36
|
+
3. Find entry points: grep ticket slug, feature folder name, config keys.
|
|
37
|
+
4. Read `Cargo_Profile` or schema validators for boundary normalization and fixed vocabularies.
|
|
38
|
+
5. List tests that encode behavior; read integration tests first for business claims.
|
|
39
|
+
6. Write the doc using `_TEMPLATE.md` sections; omit empty optional sections.
|
|
40
|
+
7. Add or update `INDEX.md` row.
|
|
41
|
+
|
|
42
|
+
## Quality bar
|
|
43
|
+
|
|
44
|
+
Each doc must include: problem/outcome, scope, entry points table, behavior/invariants, tests table, backward-compat note if feature is flag-gated.
|
|
45
|
+
|
|
46
|
+
## Non-goals
|
|
47
|
+
|
|
48
|
+
- No install/usage README content
|
|
49
|
+
- No full API reference (point to `config.md` and `doc/`)
|
|
50
|
+
- No commit unless user asks
|
|
51
|
+
- Never use `debug/data/input.json` as a source
|
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# axle-load-calculator
|
|
2
|
+
|
|
3
|
+
TypeScript library that merges **ms-faixas-porcentuais** `weight_on_axles_physics` orchestration with the **axleweight** physics engine. v1 is in-process only (no HTTP).
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 20+
|
|
8
|
+
- npm
|
|
9
|
+
|
|
10
|
+
## How to install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install
|
|
14
|
+
npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { calculate_weight_on_axles_physics } from '@jetta/axle-load-calculator'
|
|
21
|
+
|
|
22
|
+
const response_json = calculate_weight_on_axles_physics(input_json_string)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Contract:** same as `WeightByAxisTask.run()` in ms-faixas-porcentuais:
|
|
26
|
+
|
|
27
|
+
- Input: JSON string `{ envs, config? }`
|
|
28
|
+
- Success: `envs[].conteiners[].pesoEixos` filled; `items` and `faixas` cleared on containers
|
|
29
|
+
- Error: `{ msg, apiError }`
|
|
30
|
+
|
|
31
|
+
## Dependencies
|
|
32
|
+
|
|
33
|
+
- [zod](https://github.com/colinhacks/zod) — request validation at the public boundary
|
|
34
|
+
|
|
35
|
+
## Scripts
|
|
36
|
+
|
|
37
|
+
| Command | Description |
|
|
38
|
+
|---------|-------------|
|
|
39
|
+
| `npm test` | Mocha tests (physics + Java integration fixtures) |
|
|
40
|
+
| `npm run lint` | ESLint (`src`, `test/src`) |
|
|
41
|
+
| `npm run build` | `tsc` → `build/` |
|
|
42
|
+
|
|
43
|
+
## Layout
|
|
44
|
+
|
|
45
|
+
- `src/index.ts` — public API
|
|
46
|
+
- `src/core/physics/` — axleweight port (models, deflection, tare, services)
|
|
47
|
+
- `src/core/orchestration/` — Java weight-by-axis glue (mass center, collision, output)
|
|
48
|
+
- `src/service/` — reserved for future HTTP layer
|
|
49
|
+
- `test/src/` — mirrors `src/`; fixtures under `test/data/src/`
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#version v0.0.4
|
|
2
|
+
|
|
3
|
+
image: node:24
|
|
4
|
+
|
|
5
|
+
definitions:
|
|
6
|
+
steps:
|
|
7
|
+
- step: &lint-step
|
|
8
|
+
name: 'Running lint'
|
|
9
|
+
script:
|
|
10
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" > .npmrc
|
|
11
|
+
- npm ci
|
|
12
|
+
- npm run lint
|
|
13
|
+
- step: &build-verify-step
|
|
14
|
+
name: 'Building ts'
|
|
15
|
+
caches:
|
|
16
|
+
- node
|
|
17
|
+
script:
|
|
18
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" > .npmrc
|
|
19
|
+
- npm ci
|
|
20
|
+
- npm run build
|
|
21
|
+
- step: &security-step
|
|
22
|
+
name: 'Running security scan'
|
|
23
|
+
script:
|
|
24
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" > .npmrc
|
|
25
|
+
- npm ci
|
|
26
|
+
- npm audit --omit=dev
|
|
27
|
+
- step: &test-step
|
|
28
|
+
name: 'Running tests'
|
|
29
|
+
caches:
|
|
30
|
+
- node
|
|
31
|
+
script:
|
|
32
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" > .npmrc
|
|
33
|
+
- npm ci
|
|
34
|
+
- npm run test
|
|
35
|
+
|
|
36
|
+
pipelines:
|
|
37
|
+
pull-requests:
|
|
38
|
+
'{dev,stage,prod}': # Default pull request pipeline for all branches
|
|
39
|
+
- parallel:
|
|
40
|
+
- step: *lint-step
|
|
41
|
+
- step: *build-verify-step
|
|
42
|
+
- step: *security-step
|
|
43
|
+
- step: *test-step
|
|
44
|
+
|
|
45
|
+
tags:
|
|
46
|
+
# 1. Matches tags starting with 'alpha-' (e.g., alpha-v1.0.1-0)
|
|
47
|
+
'alpha-*':
|
|
48
|
+
- parallel:
|
|
49
|
+
- step: *lint-step
|
|
50
|
+
- step: *build-verify-step
|
|
51
|
+
- step: *security-step
|
|
52
|
+
- step: *test-step
|
|
53
|
+
- step:
|
|
54
|
+
name: Deploy Alpha
|
|
55
|
+
deployment: Test
|
|
56
|
+
script:
|
|
57
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" > .npmrc
|
|
58
|
+
- npm ci
|
|
59
|
+
- npm run build
|
|
60
|
+
- pipe: atlassian/npm-publish:0.3.2
|
|
61
|
+
variables:
|
|
62
|
+
NPM_TOKEN: $NPM_PUBLISH_TOKEN
|
|
63
|
+
EXTRA_ARGS: '--tag alpha'
|
|
64
|
+
|
|
65
|
+
# 2. Matches tags starting with 'v' (e.g., v1.0.1)
|
|
66
|
+
'v*':
|
|
67
|
+
- parallel:
|
|
68
|
+
- step: *lint-step
|
|
69
|
+
- step: *build-verify-step
|
|
70
|
+
- step: *security-step
|
|
71
|
+
- step: *test-step
|
|
72
|
+
- step:
|
|
73
|
+
name: Deploy to Production
|
|
74
|
+
deployment: Production
|
|
75
|
+
script:
|
|
76
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" > .npmrc
|
|
77
|
+
- npm ci
|
|
78
|
+
- npm run build
|
|
79
|
+
- pipe: atlassian/npm-publish:0.3.2
|
|
80
|
+
variables:
|
|
81
|
+
NPM_TOKEN: $NPM_PUBLISH_TOKEN
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chassi_reference.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/chassi_reference.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;EAI3B,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AllocatedItemManager } from '../physics/items/allocated_item_manager.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parses ms-faixas `{ envs: [...] }` payloads for axleweight services.
|
|
4
|
+
*/
|
|
5
|
+
export declare class MsFaixasContract {
|
|
6
|
+
transport_data: Record<string, unknown>;
|
|
7
|
+
allocated_items_by_sequence_id: Record<number, AllocatedItemManager>;
|
|
8
|
+
/**
|
|
9
|
+
* @param ms_faixas_input - Request with envs array.
|
|
10
|
+
*/
|
|
11
|
+
constructor(ms_faixas_input: Record<string, unknown>);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ms_faixas_contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ms_faixas_contract.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/ms_faixas_contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AAOjF;;GAEG;AACH,qBAAa,gBAAgB;IAEzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACvC,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IAEpE;;OAEG;gBACS,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOvD"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { AllocatedItem } from '../physics/items/allocated_item.js';
|
|
2
|
+
import { AllocatedItemManager } from '../physics/items/allocated_item_manager.js';
|
|
3
|
+
import { ItemTemplates } from '../physics/items/item_templates.js';
|
|
4
|
+
const TRANSPORT_LIST_FLAG = 'envs';
|
|
5
|
+
const CONTAINERS_FLAG = 'containers';
|
|
6
|
+
const ITEM_LIST_FLAG = 'items';
|
|
7
|
+
/**
|
|
8
|
+
* Parses ms-faixas `{ envs: [...] }` payloads for axleweight services.
|
|
9
|
+
*/
|
|
10
|
+
export class MsFaixasContract {
|
|
11
|
+
transport_data;
|
|
12
|
+
allocated_items_by_sequence_id;
|
|
13
|
+
/**
|
|
14
|
+
* @param ms_faixas_input - Request with envs array.
|
|
15
|
+
*/
|
|
16
|
+
constructor(ms_faixas_input) {
|
|
17
|
+
const envs = ms_faixas_input[TRANSPORT_LIST_FLAG];
|
|
18
|
+
this.transport_data = { ...envs[0] };
|
|
19
|
+
this.allocated_items_by_sequence_id = build_allocated_items(this.transport_data);
|
|
20
|
+
strip_items_from_transport(this.transport_data);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @param transport_data - Env vehicle data.
|
|
25
|
+
* @returns Allocated items keyed by sequence index.
|
|
26
|
+
*/
|
|
27
|
+
function build_allocated_items(transport_data) {
|
|
28
|
+
const templates = build_item_templates(transport_data);
|
|
29
|
+
const result = {};
|
|
30
|
+
const containers = transport_data[CONTAINERS_FLAG];
|
|
31
|
+
for (let index = 0; index < containers.length; index++) {
|
|
32
|
+
const container = containers[index];
|
|
33
|
+
const sequence = Number(container.sequencia ?? index + 1);
|
|
34
|
+
result[sequence] = build_container_items(templates, container);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @param transport_data - Env vehicle.
|
|
40
|
+
* @returns Item templates from all container items.
|
|
41
|
+
*/
|
|
42
|
+
function build_item_templates(transport_data) {
|
|
43
|
+
const templates = new ItemTemplates();
|
|
44
|
+
const containers = transport_data[CONTAINERS_FLAG];
|
|
45
|
+
for (const container of containers) {
|
|
46
|
+
const items = container[ITEM_LIST_FLAG];
|
|
47
|
+
if (!items) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
for (const item of items) {
|
|
51
|
+
templates.add_template_from_item_data(item);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return templates;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @param templates - Shared templates.
|
|
58
|
+
* @param container - Container JSON.
|
|
59
|
+
* @returns Allocated item manager for container.
|
|
60
|
+
*/
|
|
61
|
+
function build_container_items(templates, container) {
|
|
62
|
+
const manager = new AllocatedItemManager(templates);
|
|
63
|
+
const items = container[ITEM_LIST_FLAG];
|
|
64
|
+
if (!items) {
|
|
65
|
+
return manager;
|
|
66
|
+
}
|
|
67
|
+
const allocated = [];
|
|
68
|
+
for (const item_data of items) {
|
|
69
|
+
const item_id = String(item_data.id ?? item_data._id);
|
|
70
|
+
const template_index = templates.index_of(item_id);
|
|
71
|
+
const item = new AllocatedItem(templates, template_index);
|
|
72
|
+
item.xi = Number(item_data.x ?? 0);
|
|
73
|
+
item.yi = Number(item_data.y ?? 0);
|
|
74
|
+
// Ms-faixas stores longitudinal position in `y` (jettainterface maps y→chassis z).
|
|
75
|
+
item.zi = Number(item_data.y ?? item_data.z ?? 0);
|
|
76
|
+
allocated.push(item);
|
|
77
|
+
}
|
|
78
|
+
manager.add_allocated_items(allocated);
|
|
79
|
+
return manager;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @param transport_data - Env vehicle to strip item lists from.
|
|
83
|
+
*/
|
|
84
|
+
function strip_items_from_transport(transport_data) {
|
|
85
|
+
const containers = transport_data[CONTAINERS_FLAG];
|
|
86
|
+
for (const container of containers) {
|
|
87
|
+
delete container[ITEM_LIST_FLAG];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Cargo rotation positions (carrierinterface RotationEnum). */
|
|
2
|
+
export declare const ROTATION: Readonly<{
|
|
3
|
+
POS1: 1;
|
|
4
|
+
POS2: 2;
|
|
5
|
+
POS3: 3;
|
|
6
|
+
POS4: 4;
|
|
7
|
+
POS5: 5;
|
|
8
|
+
POS6: 6;
|
|
9
|
+
}>;
|
|
10
|
+
export type RotationCode = typeof ROTATION[keyof typeof ROTATION];
|
|
11
|
+
//# sourceMappingURL=rotation_enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotation_enum.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/rotation_enum.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,eAAO,MAAM,QAAQ;;;;;;;EAOnB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suspension_type.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/suspension_type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;EAG1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport_record.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/transport_record.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const VEHICLE_TYPE: Readonly<{
|
|
2
|
+
CONTAINER: 0;
|
|
3
|
+
SEMIREBOQUE: 1;
|
|
4
|
+
BITREM: 2;
|
|
5
|
+
RODOTREM: 3;
|
|
6
|
+
VANDERLEIA: 5;
|
|
7
|
+
REBAIXADO: 6;
|
|
8
|
+
CAMINHAO: 7;
|
|
9
|
+
VUC: 8;
|
|
10
|
+
}>;
|
|
11
|
+
export type VehicleTypeCode = typeof VEHICLE_TYPE[keyof typeof VEHICLE_TYPE];
|
|
12
|
+
//# sourceMappingURL=vehicle_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vehicle_type.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/vehicle_type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;EASvB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vehicle_version.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/vehicle_version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAA"}
|