@jetta/blocks-allocator 0.0.0-stage → 0.1.0-0
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 +103 -2
- package/package.json +67 -5
- package/src/Allocation_Attempt.js +135 -0
- package/src/Allocation_Error_Handler.js +69 -0
- package/src/Allocation_Flow.js +162 -0
- package/src/Allocation_Optimization/Allocation_LP.js +150 -0
- package/src/Allocation_Optimization/Block_Allocator.js +129 -0
- package/src/Allocation_Optimization/Block_Layer_Order.js +50 -0
- package/src/Allocation_Optimization/Block_Potential_Weight.js +54 -0
- package/src/Allocation_Optimization/Chosen_Blocks_Stock_Cap.js +82 -0
- package/src/Allocation_Optimization/block_builder/Allocation_Item_Creator.js +37 -0
- package/src/Allocation_Optimization/block_builder/Block_Item_List_Validator.js +18 -0
- package/src/Allocation_Optimization/block_builder/Block_Wall_Builder.js +303 -0
- package/src/Allocation_Optimization/block_builder/Blocks_Builder.js +40 -0
- package/src/Allocation_Optimization/block_builder/Next_Block_Position.js +33 -0
- package/src/Allocation_Optimization/block_builder/Slot_Item_Assigner.js +45 -0
- package/src/Allocation_Optimization/block_builder/Stacking_Validation.js +30 -0
- package/src/Allocation_Optimization/block_builder/assert_tie_ratio_block_matches_orientation_below.js +44 -0
- package/src/Allocation_Optimization/block_builder/block_shape_stock.js +129 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Empty_Block_Item_List_Exception.js +21 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Invalid_Stacking_Exception.js +14 -0
- package/src/Allocation_Optimization/block_builder/exceptions/No_Suitable_Item_Exception.js +16 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Restricted_Block_Exception.js +21 -0
- package/src/Allocation_Optimization/block_builder/should_omit_block_group_id.js +29 -0
- package/src/Allocation_Optimization/block_builder/snap_elevated_block_wall_items.js +34 -0
- package/src/Allocation_Optimization/block_builder/stacking_rules_input.js +52 -0
- package/src/Allocation_Optimization/cap_chosen_blocks_by_shape_stock.js +110 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Preparer.js +21 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Selector.js +55 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Threshold_Resolver.js +28 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Thresholds.js +23 -0
- package/src/Allocation_Optimization/density_groups/Container_Utilization.js +67 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Partitioner.js +74 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Scheduler.js +168 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Stock.js +49 -0
- package/src/Allocation_Optimization/density_groups/Density_Groups_Strategy.js +26 -0
- package/src/Allocation_Optimization/density_groups/Item_Density_Calculator.js +20 -0
- package/src/Allocation_Optimization/density_groups/Lock_Weight_Ahead_Release.js +75 -0
- package/src/Allocation_Optimization/exceptions/Invalid_Item_Amount_Exception.js +17 -0
- package/src/Allocation_Optimization/exceptions/No_Valid_Allocation_Exception.js +14 -0
- package/src/Allocation_Optimization/exceptions/Optimization_Infeasible_Exception.js +14 -0
- package/src/Allocation_Optimization/functions/Measure_Reader.js +20 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Cobination_Mode.js +25 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Cobination_Strategies.js +8 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Combination_Mode_Checkers.js +70 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Translation.js +22 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Variable_Weight_Getter.js +85 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/constants.js +16 -0
- package/src/Allocation_Optimization/functions/measure_to_optimize.js +6 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Capacity_Bias_Item_Order.js +76 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Choose_Item_Heuristic_Context.js +63 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Item_Chooser.js +159 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Item_For_Slot_Chooser.js +49 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Slot_Compatible_Items_Finder.js +88 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Slots_Items_Assigner.js +182 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Stack_Slot_Calculator.js +87 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Weight_Slot_Distribution.js +72 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/Empty_Slot_Exception.js +17 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/Item_Taller_Than_Limit_Exception.js +21 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/No_Available_Items_Exception.js +14 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/No_Slots_For_Items_Exception.js +14 -0
- package/src/Allocation_Optimization/lp_model/Block_Weight_Calculator.js +31 -0
- package/src/Allocation_Optimization/lp_model/LP_Data_Processor.js +42 -0
- package/src/Allocation_Optimization/lp_model/LP_Item_Slot_Assignment.js +93 -0
- package/src/Allocation_Optimization/lp_model/LP_Result_Mapper.js +47 -0
- package/src/Allocation_Optimization/lp_model/model_builder/Dimension_Range_Helper.js +49 -0
- package/src/Allocation_Optimization/lp_model/model_builder/Item_Assignment_Variables.js +133 -0
- package/src/Allocation_Optimization/lp_model/model_builder/LP_Model_Builder.js +132 -0
- package/src/Allocation_Optimization/lp_model/model_builder/exceptions/Missing_Item_Stock_Exception.js +18 -0
- package/src/Allocation_Optimization/lp_model/model_builder/goal_function/Goal_Function_Creator.js +83 -0
- package/src/Allocation_Optimization/lp_model/model_builder/item_dimension_hashes.js +31 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Block_Item_Amount_Restriction.js +53 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Coherence_Restriction.js +65 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Container_Supported_Weight_Restriction.js +42 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Relational_Exact_Pass_Amount_Restriction.js +62 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Relational_Group_Restriction.js +97 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Single_Item_Type_Restriction.js +79 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Space_Restriction.js +47 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Unavailable_Block_Restriction.js +27 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Uniform_Block_Measure_Restriction.js +92 -0
- package/src/Allocation_Optimization/next_group_id_after_preloaded.js +30 -0
- package/src/Allocation_Optimization/preferential_blocks/Preferential_Block_Identifier.js +74 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/Key_Item_Mapper.js +49 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Almost_Unique_Item.js +31 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Cant_Stack_It_Self.js +68 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Rule_Interface.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Intercalation_State.js +49 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Orientation_Filter.js +33 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Vertical_Stack_Filter.js +20 -0
- package/src/Allocation_Optimization/tie_ratio/collect_tie_ratio_orientations_below_footprint.js +64 -0
- package/src/Allocation_Optimization/tie_ratio/filter_blocks_by_orientation.js +17 -0
- package/src/Allocation_Optimization/tie_ratio/find_orientation_below_space.js +77 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/allocated_item_penetrates_any.js +31 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/apply_loose_placement_to_allocated_item.js +94 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/axis_overlap_length.js +16 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/block_local_origin.js +18 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/box_fits_inside_container.js +39 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_allocated_item_at_placement.js +18 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_placement_on_generic_supporter.js +64 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_slot_grid_from_cluster.js +66 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/compare_group_ids.js +20 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/container_with_pending_wall_items.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/empty_space_is_on_floor.js +16 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/finalize_loose_item_placement.js +58 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_best_generic_supporter_placement.js +58 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_next_free_slot_index.js +119 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_supporter_directly_below.js +51 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_tie_ratio_supporter_cluster.js +57 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/footprint_xz_overlap_area.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/item_fits_supporter_slot.js +22 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_footprint_region_from_options.js +24 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_fits_inside_container.js +21 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_has_geometric_support.js +21 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_on_block_slot_state.js +88 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/placement_coords_fit_inside_container.js +34 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/read_empilhar_area_igual_from_allocation_item.js +12 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/realigned_loose_geometry_gates.js +25 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_on_generic_supporter.js +65 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_placement_position.js +68 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_placement_y_at_slot.js +45 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_without_tie_ratio_cluster.js +79 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/select_tie_ratio_slot_placement.js +84 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/slot_footprint_collision.js +105 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_cluster_selection.js +119 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_footprint_overlap.js +56 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_placement_plane.js +109 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_supporter_predicate.js +23 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/try_tie_ratio_slot_placement.js +62 -0
- package/src/Allocation_Optimization/tie_ratio/snap_stacked_items_to_floor_footprints.js +138 -0
- package/src/Allocation_Optimization/tie_ratio/supporters_by_top_y_index.js +78 -0
- package/src/Allocation_Optimization/tie_ratio/tie_ratio_orientation_below_empty_space.js +89 -0
- package/src/Allocation_Optimization/tie_ratio/tie_ratio_orientation_from_group.js +48 -0
- package/src/Block_Management.js +34 -0
- package/src/Blocks_Preparation/Cube_Map_Function.js +27 -0
- package/src/Blocks_Wall_Allocation.js +3 -0
- package/src/IO/Answer_Status.js +4 -0
- package/src/IO/Output_Builder.js +35 -0
- package/src/IO/count_allocated_items.js +31 -0
- package/src/IO/create_error_response.js +62 -0
- package/src/IO/format_allocation_error_message.js +25 -0
- package/src/Item_Continuation_Lock.js +129 -0
- package/src/Item_Picking_Continuity.js +41 -0
- package/src/allocation_flow/chooser_session_state.js +21 -0
- package/src/allocation_flow/compound_probe_fallback.js +17 -0
- package/src/allocation_flow/container_remaining_capacity.js +23 -0
- package/src/allocation_flow/density_group_item_filter.js +31 -0
- package/src/allocation_flow/effective_item_fingerprint.js +14 -0
- package/src/allocation_flow/item_continuation_lock_gate.js +38 -0
- package/src/allocation_flow/no_space_left_recovery.js +48 -0
- package/src/allocation_flow/run_allocation_iteration.js +155 -0
- package/src/allocation_flow/space_skip_state.js +91 -0
- package/src/allocation_flow/try_no_space_left_recovery.js +50 -0
- package/src/exceptions/Invalid_Parameter_Exception.js +17 -0
- package/src/exceptions/Relational_Allocation_Incomplete_Exception.js +24 -0
- package/src/exceptions/Relational_Colocation_Violation_Exception.js +23 -0
- package/src/exceptions/Relational_Config_Mismatch_Exception.js +17 -0
- package/src/exceptions/There_Is_No_Block_Options_To_Allocate_Exception.js +14 -0
- package/src/index.js +6 -0
- package/src/input_preparation/Block_Formatter.js +179 -0
- package/src/input_preparation/Input_Creator.js +76 -0
- package/src/input_preparation/Input_State_Preparation.js +47 -0
- package/src/input_preparation/State_Builder.js +27 -0
- package/src/input_preparation/block_formatter/align_flush_axis_config.js +36 -0
- package/src/input_preparation/block_formatter/align_flush_axis_single_round.js +112 -0
- package/src/input_preparation/block_formatter/align_flush_stacked_slots.js +67 -0
- package/src/input_preparation/block_formatter/overlapped_slots.js +24 -0
- package/src/input_preparation/block_formatter/parallelepiped_shell.js +38 -0
- package/src/input_preparation/block_formatter/rectangle_coverage.js +112 -0
- package/src/input_preparation/block_formatter/shell_face_coverage.js +64 -0
- package/src/input_preparation/block_formatter/shell_snap_convergence.js +104 -0
- package/src/input_preparation/block_preparation/Block_Data_To_Object_Transformer.js +57 -0
- package/src/input_preparation/block_preparation/Block_Module_Name.js +17 -0
- package/src/input_preparation/block_preparation/Blocks_Creator.js +101 -0
- package/src/input_preparation/block_preparation/Blocksmith.js +19 -0
- package/src/input_preparation/block_preparation/block_modules/create_block_candidates.js +41 -0
- package/src/input_preparation/block_preparation/block_modules/manual_blocks.js +10 -0
- package/src/input_preparation/block_preparation/block_modules/module_registry.js +20 -0
- package/src/input_preparation/block_preparation/block_modules/run_creator.js +34 -0
- package/src/input_preparation/block_preparation/block_modules/single_item_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/spiral_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/tie_ratio_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/tower_blocks.js +12 -0
- package/src/input_preparation/block_preparation/exceptions/Failed_To_Create_Block_Exception.js +14 -0
- package/src/input_preparation/block_preparation/exceptions/Failed_To_Retrieve_Block_Exception.js +17 -0
- package/src/input_preparation/block_preparation/exceptions/Missing_Object_Store_Exception.js +10 -0
- package/src/input_preparation/block_preparation/exceptions/No_Blocks_Were_Created_Exception.js +14 -0
- package/src/input_preparation/block_preparation/input/Input_Creator.js +96 -0
- package/src/input_preparation/block_preparation/manual_blocks/Manual_Blocks.js +95 -0
- package/src/input_preparation/build_empty_space_finder_options.js +43 -0
- package/src/input_preparation/item_preparation/Items_Reader.js +27 -0
- package/src/input_preparation/min_extents_from_items.js +29 -0
- package/src/input_preparation/stackability_index/Blocks_Stackability_Index_Calculator.js +58 -0
- package/src/input_preparation/stackability_index/Slots_Stackability_index_Calculator.js +28 -0
- package/src/input_preparation/stackability_index/Stackability_Input_Creator.js +27 -0
- package/src/input_preparation/stackability_index/stackability_index_pop_stack.js +81 -0
- package/src/input_preparation/stacking_constraints/Weight_Stacking_Validation.js +15 -0
- package/src/lp_optimizer_result_status.js +20 -0
- package/src/messages/Allocator_Message.js +42 -0
- package/src/messages/resolve_error_message_entry.js +57 -0
- package/src/models/Allocated_Item.js +136 -0
- package/src/models/Allocation_Item.js +219 -0
- package/src/models/Block.js +198 -0
- package/src/models/Cargo_Profile.js +418 -0
- package/src/models/Preloaded_Allocated_Item.js +132 -0
- package/src/models/Slot.js +67 -0
- package/src/models/Stacking_Rules.js +58 -0
- package/src/models/auxiliaryFunctions/Available_Block_Module_List_Creator.js +9 -0
- package/src/models/auxiliaryFunctions/Measure_Translator.js +24 -0
- package/src/models/auxiliaryFunctions/item_json_reader.js +44 -0
- package/src/models/item_json_reader.js +71 -0
- package/src/models/placed_item_record.js +70 -0
- package/src/models/preloaded_rotation_helpers.js +38 -0
- package/src/models/slots_have_same_measure.js +45 -0
- package/src/models/transport/Container.js +162 -0
- package/src/models/transport/Transport.js +62 -0
- package/src/models/transport/build_stacking_feasibility_checker.js +64 -0
- package/src/models/transport/container_stacking_checkpoint.js +42 -0
- package/src/models/transport/factory/Container_Factory.js +46 -0
- package/src/models/transport/factory/Corner_Casting_Factory.js +62 -0
- package/src/models/transport/factory/Previously_Allocated_Item_Factory.js +28 -0
- package/src/models/transport/factory/Transport_Factory.js +13 -0
- package/src/models/transport/items_for_empty_space_finder.js +91 -0
- package/src/models/transport/resolve_container_stacking_inputs.js +23 -0
- package/src/models/transport/stacking_input_from_wire.js +58 -0
- package/src/optimizer_connection_errors.js +50 -0
- package/src/relational/Relational_Error_Codes.js +7 -0
- package/src/relational/finalize_relational_allocation.js +20 -0
- package/src/relational/has_relational_items.js +11 -0
- package/src/relational/is_relational_error_code.js +15 -0
- package/src/relational/resolve_relational_container_sequences.js +29 -0
- package/src/run_core_allocation.js +118 -0
- package/src/space_and_block_chooser/Space_And_Blocks_Chooser.js +115 -0
- package/src/space_and_block_chooser/blocks_filters/Block_Filter_Interface.js +19 -0
- package/src/space_and_block_chooser/blocks_filters/Filter_Runner.js +46 -0
- package/src/space_and_block_chooser/blocks_filters/initial_blocks_filter/Block_With_Overlapped_Slots_Filter.js +14 -0
- package/src/space_and_block_chooser/blocks_filters/initial_blocks_filter/Initial_Blocks_Filter_List.js +19 -0
- package/src/space_and_block_chooser/blocks_filters/pos_selection_filters/Blocks_Bigger_Than_Space_Filter.js +17 -0
- package/src/space_and_block_chooser/blocks_filters/pos_selection_filters/Post_Selection_Filter_List.js +9 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/Insuficient_Items_Filter.js +81 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/Pre_Selection_Filter_List.js +8 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/max_tower_height/Blocks_Lower_Than_Max_Tower_Height.js +23 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/max_tower_height/Max_Tower_Height.js +82 -0
- package/src/space_and_block_chooser/build_allocated_item_snapshots.js +19 -0
- package/src/space_and_block_chooser/compound_first_empty_space_branch.js +61 -0
- package/src/space_and_block_chooser/compound_first_with_leftover_fill.js +142 -0
- package/src/space_and_block_chooser/compound_first_without_leftover_fill.js +56 -0
- package/src/space_and_block_chooser/empty_spaces_where_post_selection_keeps_blocks.js +83 -0
- package/src/space_and_block_chooser/exceptions/Invalid_Space_To_Allocate_Exception.js +14 -0
- package/src/space_and_block_chooser/leftover_space_memory.js +113 -0
- package/src/space_and_block_chooser/leftover_unitary_blocks.js +153 -0
- package/src/space_and_block_chooser/leftover_unitary_empty_spaces.js +135 -0
- package/src/space_and_block_chooser/probe_set_pool.js +35 -0
- package/src/space_and_block_chooser/run_space_and_block_selection_attempt.js +88 -0
- package/src/tools/Array_Validator.js +6 -0
- package/src/tools/Clone.js +27 -0
- package/src/tools/Hash.js +8 -0
- package/src/tools/Rounder.js +5 -0
- package/src/tools/String_To_Boolean.js +12 -0
- package/src/tools/cargo_profile/Cargo_Profile_Field_Value_Resolver.js +44 -0
- package/src/tools/compact_items_with_stock.js +9 -0
- package/src/tools/mm_to_allocation_domain.js +14 -0
- package/src/tracing/Allocation_Tracer.js +52 -0
- package/src/tracing/Trace_Context.js +18 -0
- package/src/tracing/trace_outcome.js +18 -0
- package/src/tracing/traced_step.js +57 -0
- package/src/validation/Item_Continuation_Lock_Flag.js +52 -0
- package/src/validation/Item_Validation.js +29 -0
- package/src/validation/Relational_Colocation_Validator.js +60 -0
- package/src/validation/Relational_Completeness_Validator.js +146 -0
- package/src/validation/Relational_Continuation_Lock_Validation.js +37 -0
- package/src/validation/Relational_Proportional_Normalizer.js +194 -0
- package/src/validation/Validation.js +9 -0
- package/src/validation/Validation_Runner.js +20 -0
- package/src/validation/exceptions/Invalid_Block_Module_Config_Exception.js +14 -0
- package/src/validation/exceptions/Invalid_Input_Exception.js +14 -0
- package/src/validation/exceptions/Invalid_Input_Type_Exception.js +14 -0
- package/src/validation/schemas/allocated_item_schema.js +18 -0
- package/src/validation/schemas/allocation_request_schema.js +178 -0
- package/src/validation/schemas/container_row_schema.js +16 -0
- package/src/validation/schemas/item_schema.js +60 -0
- package/src/validation/schemas/transport_env_schema.js +19 -0
- package/src/validation/validate_block_module_config.js +147 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const ITEM_CONTINUATION_LOCK_KEY = 'allocation.blocks.enable_item_continuation_lock'
|
|
2
|
+
const CONFLICT_MESSAGE =
|
|
3
|
+
'allocation.blocks.enable_item_continuation_lock must be false when relational_allocation_enabled is true'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns true when relational allocation is enabled.
|
|
7
|
+
* @param {object} algoritmo
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
function is_relational_allocation_enabled(algoritmo)
|
|
11
|
+
{
|
|
12
|
+
const raw = algoritmo?.relational_allocation_enabled
|
|
13
|
+
return raw === true || raw === 'true'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolves whether item continuation lock is enabled.
|
|
18
|
+
* Omitted values default to true (legacy behavior).
|
|
19
|
+
* @param {object} algoritmo
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
function is_item_continuation_lock_enabled(algoritmo)
|
|
23
|
+
{
|
|
24
|
+
const raw = algoritmo?.[ITEM_CONTINUATION_LOCK_KEY]
|
|
25
|
+
if (raw === undefined)
|
|
26
|
+
{
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
return raw === true || raw === 'true'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns true when relational allocation conflicts with continuation lock.
|
|
34
|
+
* @param {object} algoritmo
|
|
35
|
+
* @returns {boolean}
|
|
36
|
+
*/
|
|
37
|
+
function has_relational_continuation_lock_conflict(algoritmo)
|
|
38
|
+
{
|
|
39
|
+
if (!is_relational_allocation_enabled(algoritmo))
|
|
40
|
+
{
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
return is_item_continuation_lock_enabled(algoritmo)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
ITEM_CONTINUATION_LOCK_KEY,
|
|
48
|
+
CONFLICT_MESSAGE,
|
|
49
|
+
is_relational_allocation_enabled,
|
|
50
|
+
is_item_continuation_lock_enabled,
|
|
51
|
+
has_relational_continuation_lock_conflict
|
|
52
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const Validation = require('./Validation')
|
|
2
|
+
const Invalid_Input_Type_Exception = require('./exceptions/Invalid_Input_Type_Exception')
|
|
3
|
+
|
|
4
|
+
class Item_Validation extends Validation
|
|
5
|
+
{
|
|
6
|
+
#item_list
|
|
7
|
+
constructor(item_list)
|
|
8
|
+
{
|
|
9
|
+
super()
|
|
10
|
+
this.#item_list = item_list
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
validate()
|
|
14
|
+
{
|
|
15
|
+
this.#has_any_longeron()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#has_any_longeron()
|
|
19
|
+
{
|
|
20
|
+
const has_longeron = this.#item_list.some(item => item.tipo.toLowerCase() === 'longarina')
|
|
21
|
+
|
|
22
|
+
if (has_longeron)
|
|
23
|
+
{
|
|
24
|
+
throw new Invalid_Input_Type_Exception()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = Item_Validation
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const Relational_Colocation_Violation_Exception = require('../exceptions/Relational_Colocation_Violation_Exception')
|
|
2
|
+
const Cargo_Profile = require('../models/Cargo_Profile')
|
|
3
|
+
|
|
4
|
+
function validate_transport_colocation(transport)
|
|
5
|
+
{
|
|
6
|
+
if (!Cargo_Profile.enforce_relational_group_co_location())
|
|
7
|
+
{
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const groups = collect_allocated_groups(transport)
|
|
12
|
+
|
|
13
|
+
for (const [group_id, sequences] of groups.entries())
|
|
14
|
+
{
|
|
15
|
+
const unique_sequences = [...new Set(sequences)]
|
|
16
|
+
if (unique_sequences.length > 1)
|
|
17
|
+
{
|
|
18
|
+
throw new Relational_Colocation_Violation_Exception(
|
|
19
|
+
{
|
|
20
|
+
relational_group_id: group_id,
|
|
21
|
+
container_sequences: unique_sequences
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function collect_allocated_groups(transport)
|
|
29
|
+
{
|
|
30
|
+
const groups = new Map()
|
|
31
|
+
|
|
32
|
+
for (const sequence of transport.get_container_sequence_list())
|
|
33
|
+
{
|
|
34
|
+
const container = transport.get_container_by_sequence(sequence)
|
|
35
|
+
const allocated_items = container.get_allocated_items()
|
|
36
|
+
|
|
37
|
+
for (const allocated_item of allocated_items)
|
|
38
|
+
{
|
|
39
|
+
const source_item = allocated_item.get_allocation_item()
|
|
40
|
+
const group_id = source_item.get_relational_group_id()
|
|
41
|
+
if (!group_id)
|
|
42
|
+
{
|
|
43
|
+
continue
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!groups.has(group_id))
|
|
47
|
+
{
|
|
48
|
+
groups.set(group_id, [])
|
|
49
|
+
}
|
|
50
|
+
groups.get(group_id).push(sequence)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return groups
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
validate_transport_colocation,
|
|
59
|
+
collect_allocated_groups
|
|
60
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const Cargo_Profile = require('../models/Cargo_Profile')
|
|
2
|
+
const Relational_Allocation_Incomplete_Exception = require('../exceptions/Relational_Allocation_Incomplete_Exception')
|
|
3
|
+
|
|
4
|
+
function validate_relational_completeness(transport, item_list)
|
|
5
|
+
{
|
|
6
|
+
if (!Cargo_Profile.enforce_relational_group_co_location())
|
|
7
|
+
{
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const allocated_counts = count_allocated_by_user_id(transport)
|
|
12
|
+
const groups = build_group_expectations(item_list, allocated_counts)
|
|
13
|
+
if (groups.size === 0)
|
|
14
|
+
{
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
for (const [group_id, group] of groups.entries())
|
|
19
|
+
{
|
|
20
|
+
validate_group_completeness(group_id, group, allocated_counts)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function build_group_expectations(item_list, allocated_counts)
|
|
25
|
+
{
|
|
26
|
+
const groups = new Map()
|
|
27
|
+
|
|
28
|
+
for (const item of item_list)
|
|
29
|
+
{
|
|
30
|
+
const group_id = item.get_relational_group_id && item.get_relational_group_id()
|
|
31
|
+
if (!group_id)
|
|
32
|
+
{
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!groups.has(group_id))
|
|
37
|
+
{
|
|
38
|
+
groups.set(group_id, {
|
|
39
|
+
links: item.get_relational_links(),
|
|
40
|
+
expected_counts: {}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const user_id = item.get_user_id()
|
|
45
|
+
const group = groups.get(group_id)
|
|
46
|
+
const already_allocated = allocated_counts[user_id] || 0
|
|
47
|
+
const remaining = item.get_amount()
|
|
48
|
+
group.expected_counts[user_id] = already_allocated + remaining
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return groups
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function count_allocated_by_user_id(transport)
|
|
55
|
+
{
|
|
56
|
+
const counts = {}
|
|
57
|
+
|
|
58
|
+
for (const sequence of transport.get_container_sequence_list())
|
|
59
|
+
{
|
|
60
|
+
const container = transport.get_container_by_sequence(sequence)
|
|
61
|
+
for (const allocated_item of container.get_allocated_items())
|
|
62
|
+
{
|
|
63
|
+
const source_item = allocated_item.get_allocation_item()
|
|
64
|
+
const user_id = source_item.get_user_id()
|
|
65
|
+
counts[user_id] = (counts[user_id] || 0) + 1
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return counts
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function validate_group_completeness(group_id, group, allocated_counts)
|
|
73
|
+
{
|
|
74
|
+
const user_ids = Object.keys(group.links || {})
|
|
75
|
+
const allocated_in_group = user_ids.map(user_id => allocated_counts[user_id] || 0)
|
|
76
|
+
const total_allocated = allocated_in_group.reduce((sum, count) => sum + count, 0)
|
|
77
|
+
|
|
78
|
+
if (total_allocated === 0)
|
|
79
|
+
{
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!is_valid_integer_multiple(allocated_in_group, user_ids, group.links))
|
|
84
|
+
{
|
|
85
|
+
throw new Relational_Allocation_Incomplete_Exception(
|
|
86
|
+
{
|
|
87
|
+
relational_group_id: group_id,
|
|
88
|
+
allocated_counts: pick_counts(user_ids, allocated_counts),
|
|
89
|
+
expected_counts: group.expected_counts
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function is_valid_integer_multiple(allocated_counts, user_ids, links)
|
|
96
|
+
{
|
|
97
|
+
let reference_k = null
|
|
98
|
+
|
|
99
|
+
for (let index = 0; index < user_ids.length; index++)
|
|
100
|
+
{
|
|
101
|
+
const user_id = user_ids[index]
|
|
102
|
+
const allocated = allocated_counts[index]
|
|
103
|
+
const link_qty = links[user_id]
|
|
104
|
+
|
|
105
|
+
if (link_qty == null || link_qty <= 0)
|
|
106
|
+
{
|
|
107
|
+
return false
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (allocated % link_qty !== 0)
|
|
111
|
+
{
|
|
112
|
+
return false
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const k = allocated / link_qty
|
|
116
|
+
if (k < 1 || !Number.isInteger(k))
|
|
117
|
+
{
|
|
118
|
+
return false
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (reference_k == null)
|
|
122
|
+
{
|
|
123
|
+
reference_k = k
|
|
124
|
+
}
|
|
125
|
+
else if (reference_k !== k)
|
|
126
|
+
{
|
|
127
|
+
return false
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return reference_k != null
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function pick_counts(user_ids, allocated_counts)
|
|
135
|
+
{
|
|
136
|
+
const picked = {}
|
|
137
|
+
for (const user_id of user_ids)
|
|
138
|
+
{
|
|
139
|
+
picked[user_id] = allocated_counts[user_id] || 0
|
|
140
|
+
}
|
|
141
|
+
return picked
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
module.exports = {
|
|
145
|
+
validate_relational_completeness
|
|
146
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const Validation = require('./Validation')
|
|
2
|
+
const Relational_Config_Mismatch_Exception = require('../exceptions/Relational_Config_Mismatch_Exception')
|
|
3
|
+
const { has_relational_continuation_lock_conflict } = require('./Item_Continuation_Lock_Flag')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Rejects relational allocation when item continuation lock remains enabled.
|
|
7
|
+
*/
|
|
8
|
+
class Relational_Continuation_Lock_Validation extends Validation
|
|
9
|
+
{
|
|
10
|
+
#algoritmo
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {object} input_data - Parsed allocation request.
|
|
14
|
+
*/
|
|
15
|
+
constructor(input_data)
|
|
16
|
+
{
|
|
17
|
+
super()
|
|
18
|
+
this.#algoritmo = input_data?.config?.algoritmo || {}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Validates the relational / continuation-lock config combination.
|
|
23
|
+
* @returns {void}
|
|
24
|
+
* @throws {Relational_Config_Mismatch_Exception}
|
|
25
|
+
*/
|
|
26
|
+
validate()
|
|
27
|
+
{
|
|
28
|
+
if (!has_relational_continuation_lock_conflict(this.#algoritmo))
|
|
29
|
+
{
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
throw new Relational_Config_Mismatch_Exception()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = Relational_Continuation_Lock_Validation
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
const Cargo_Profile = require('../models/Cargo_Profile')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Trims excess allocated items so each relational group matches a valid integer k.
|
|
5
|
+
* @param {object} transport
|
|
6
|
+
* @param {object[]} item_list
|
|
7
|
+
*/
|
|
8
|
+
function normalize_relational_proportional_allocation(transport, item_list)
|
|
9
|
+
{
|
|
10
|
+
if (!Cargo_Profile.enforce_relational_group_co_location())
|
|
11
|
+
{
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const groups = build_relational_groups(item_list)
|
|
16
|
+
|
|
17
|
+
for (const sequence of transport.get_container_sequence_list())
|
|
18
|
+
{
|
|
19
|
+
const container = transport.get_container_by_sequence(sequence)
|
|
20
|
+
trim_container_relational_excess(container, groups, item_list)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function build_relational_groups(item_list)
|
|
25
|
+
{
|
|
26
|
+
const groups = new Map()
|
|
27
|
+
|
|
28
|
+
for (const item of item_list)
|
|
29
|
+
{
|
|
30
|
+
const group_id = item.get_relational_group_id && item.get_relational_group_id()
|
|
31
|
+
if (!group_id)
|
|
32
|
+
{
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!groups.has(group_id))
|
|
37
|
+
{
|
|
38
|
+
groups.set(group_id, {
|
|
39
|
+
links: item.get_relational_links(),
|
|
40
|
+
items_by_user_id: new Map()
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
groups.get(group_id).items_by_user_id.set(item.get_user_id(), item)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return groups
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function trim_container_relational_excess(container, groups, item_list)
|
|
51
|
+
{
|
|
52
|
+
const allocated_items = container.get_allocated_items()
|
|
53
|
+
|
|
54
|
+
for (const [group_id, group] of groups.entries())
|
|
55
|
+
{
|
|
56
|
+
const user_ids = Object.keys(group.links || {})
|
|
57
|
+
const indices_by_user_id = collect_indices_by_user_id(allocated_items, user_ids, group_id)
|
|
58
|
+
const counts = user_ids.map(user_id => indices_by_user_id.get(user_id)?.length || 0)
|
|
59
|
+
const k = compute_valid_k_from_counts(counts, user_ids, group.links)
|
|
60
|
+
|
|
61
|
+
if (k < 1)
|
|
62
|
+
{
|
|
63
|
+
continue
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (is_valid_integer_multiple(counts, user_ids, group.links))
|
|
67
|
+
{
|
|
68
|
+
continue
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const remove_indices = []
|
|
72
|
+
|
|
73
|
+
for (const user_id of user_ids)
|
|
74
|
+
{
|
|
75
|
+
const target = group.links[user_id] * k
|
|
76
|
+
const indices = indices_by_user_id.get(user_id) || []
|
|
77
|
+
const excess = indices.length - target
|
|
78
|
+
|
|
79
|
+
if (excess > 0)
|
|
80
|
+
{
|
|
81
|
+
remove_indices.push(...indices.slice(-excess))
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
remove_indices.sort((left, right) => right - left)
|
|
86
|
+
|
|
87
|
+
const restored_counts = new Map()
|
|
88
|
+
|
|
89
|
+
for (const index of remove_indices)
|
|
90
|
+
{
|
|
91
|
+
const user_id = allocated_items[index]?.get_allocation_item()?.get_user_id()
|
|
92
|
+
if (user_id)
|
|
93
|
+
{
|
|
94
|
+
restored_counts.set(user_id, (restored_counts.get(user_id) || 0) + 1)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
allocated_items.splice(index, 1)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
for (const [user_id, count] of restored_counts.entries())
|
|
101
|
+
{
|
|
102
|
+
const stock_item = group.items_by_user_id.get(user_id)
|
|
103
|
+
if (stock_item)
|
|
104
|
+
{
|
|
105
|
+
stock_item.update_amount(stock_item.get_amount() + count)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function collect_indices_by_user_id(allocated_items, user_ids, group_id)
|
|
112
|
+
{
|
|
113
|
+
const indices_by_user_id = new Map()
|
|
114
|
+
const user_id_set = new Set(user_ids)
|
|
115
|
+
|
|
116
|
+
for (let index = 0; index < allocated_items.length; index++)
|
|
117
|
+
{
|
|
118
|
+
const source_item = allocated_items[index].get_allocation_item()
|
|
119
|
+
const user_id = source_item.get_user_id()
|
|
120
|
+
const item_group_id = source_item.get_relational_group_id && source_item.get_relational_group_id()
|
|
121
|
+
|
|
122
|
+
if (!user_id_set.has(user_id) || item_group_id !== group_id)
|
|
123
|
+
{
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!indices_by_user_id.has(user_id))
|
|
128
|
+
{
|
|
129
|
+
indices_by_user_id.set(user_id, [])
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
indices_by_user_id.get(user_id).push(index)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return indices_by_user_id
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function compute_valid_k_from_counts(counts, user_ids, links)
|
|
139
|
+
{
|
|
140
|
+
let k = Infinity
|
|
141
|
+
|
|
142
|
+
for (let index = 0; index < user_ids.length; index++)
|
|
143
|
+
{
|
|
144
|
+
const user_id = user_ids[index]
|
|
145
|
+
const allocated = counts[index]
|
|
146
|
+
const link_qty = links[user_id]
|
|
147
|
+
|
|
148
|
+
if (allocated > 0 && link_qty > 0)
|
|
149
|
+
{
|
|
150
|
+
k = Math.min(k, Math.floor(allocated / link_qty))
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return k === Infinity ? 0 : k
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function is_valid_integer_multiple(allocated_counts, user_ids, links)
|
|
158
|
+
{
|
|
159
|
+
let reference_k = null
|
|
160
|
+
|
|
161
|
+
for (let index = 0; index < user_ids.length; index++)
|
|
162
|
+
{
|
|
163
|
+
const user_id = user_ids[index]
|
|
164
|
+
const allocated = allocated_counts[index]
|
|
165
|
+
const link_qty = links[user_id]
|
|
166
|
+
|
|
167
|
+
if (link_qty == null || link_qty <= 0 || allocated === 0)
|
|
168
|
+
{
|
|
169
|
+
continue
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (allocated % link_qty !== 0)
|
|
173
|
+
{
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const k = allocated / link_qty
|
|
178
|
+
|
|
179
|
+
if (reference_k == null)
|
|
180
|
+
{
|
|
181
|
+
reference_k = k
|
|
182
|
+
}
|
|
183
|
+
else if (reference_k !== k)
|
|
184
|
+
{
|
|
185
|
+
return false
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return reference_k != null
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
module.exports = {
|
|
193
|
+
normalize_relational_proportional_allocation
|
|
194
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const Item_Validation = require('./Item_Validation')
|
|
2
|
+
const Relational_Continuation_Lock_Validation = require('./Relational_Continuation_Lock_Validation')
|
|
3
|
+
|
|
4
|
+
function _assemble_validation_list(input_data)
|
|
5
|
+
{
|
|
6
|
+
return [
|
|
7
|
+
new Item_Validation(input_data.items),
|
|
8
|
+
new Relational_Continuation_Lock_Validation(input_data)
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
module.exports = function(input_data)
|
|
14
|
+
{
|
|
15
|
+
const validation_list = _assemble_validation_list(input_data)
|
|
16
|
+
for (const validation of validation_list)
|
|
17
|
+
{
|
|
18
|
+
validation.validate()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { build_message_entry } = require('../../messages/resolve_error_message_entry')
|
|
2
|
+
const { ALLOCATOR_MESSAGE } = require('../../messages/Allocator_Message')
|
|
3
|
+
|
|
4
|
+
class Invalid_Block_Module_Config_Exception extends Error
|
|
5
|
+
{
|
|
6
|
+
constructor()
|
|
7
|
+
{
|
|
8
|
+
const message_key = ALLOCATOR_MESSAGE.INVALID_BLOCK_MODULE_CONFIG
|
|
9
|
+
super(message_key)
|
|
10
|
+
this.message_entry = build_message_entry(message_key)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = Invalid_Block_Module_Config_Exception
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { build_message_entry } = require('../../messages/resolve_error_message_entry')
|
|
2
|
+
const { ALLOCATOR_MESSAGE } = require('../../messages/Allocator_Message')
|
|
3
|
+
|
|
4
|
+
class Invalid_Input_Exception extends Error
|
|
5
|
+
{
|
|
6
|
+
constructor()
|
|
7
|
+
{
|
|
8
|
+
const message_key = ALLOCATOR_MESSAGE.INVALID_INPUT
|
|
9
|
+
super(message_key)
|
|
10
|
+
this.message_entry = build_message_entry(message_key)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = Invalid_Input_Exception
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { build_message_entry } = require('../../messages/resolve_error_message_entry')
|
|
2
|
+
const { ALLOCATOR_MESSAGE } = require('../../messages/Allocator_Message')
|
|
3
|
+
|
|
4
|
+
class Invalid_Input_Type_Exception extends Error
|
|
5
|
+
{
|
|
6
|
+
constructor()
|
|
7
|
+
{
|
|
8
|
+
const message_key = ALLOCATOR_MESSAGE.INVALID_INPUT_TYPE
|
|
9
|
+
super(message_key)
|
|
10
|
+
this.message_entry = build_message_entry(message_key)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = Invalid_Input_Type_Exception
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One pre-placed item on a container row (`containers[*].items[*]`), English geometry field names.
|
|
5
|
+
*/
|
|
6
|
+
const allocated_item_schema = z.looseObject({
|
|
7
|
+
_id: z.string().min(1),
|
|
8
|
+
x: z.number().nonnegative(),
|
|
9
|
+
y: z.number().nonnegative(),
|
|
10
|
+
z: z.number().nonnegative(),
|
|
11
|
+
w: z.number().positive(),
|
|
12
|
+
h: z.number().positive(),
|
|
13
|
+
d: z.number().positive(),
|
|
14
|
+
wg: z.number().positive(),
|
|
15
|
+
supported_weight: z.number().nonnegative()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
module.exports = allocated_item_schema
|