@jetta/cargo-stabilizer 0.1.0-12 → 0.1.0-15
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/CHANGELOG.md +11 -2
- package/README.md +15 -10
- package/build/core/adapters/axle_adapter.d.ts +1 -0
- package/build/core/adapters/axle_adapter.d.ts.map +1 -1
- package/build/core/adapters/axle_adapter.js +3 -22
- package/build/core/adapters/axle_load_evaluation.d.ts +8 -0
- package/build/core/adapters/axle_load_evaluation.d.ts.map +1 -0
- package/build/core/adapters/axle_load_evaluation.js +1 -0
- package/build/core/adapters/build_axle_request.d.ts +2 -9
- package/build/core/adapters/build_axle_request.d.ts.map +1 -1
- package/build/core/adapters/build_axle_request.js +52 -24
- package/build/core/adapters/compute_axle_excess_kg.d.ts +8 -0
- package/build/core/adapters/compute_axle_excess_kg.d.ts.map +1 -0
- package/build/core/adapters/compute_axle_excess_kg.js +19 -0
- package/build/core/adapters/coordinate_mapper.d.ts +1 -1
- package/build/core/adapters/coordinate_mapper.js +3 -3
- package/build/core/adapters/evaluate_axle_load.d.ts +10 -0
- package/build/core/adapters/evaluate_axle_load.d.ts.map +1 -0
- package/build/core/adapters/evaluate_axle_load.js +32 -0
- package/build/core/adapters/map_item_to_stacking_item.d.ts +14 -0
- package/build/core/adapters/map_item_to_stacking_item.d.ts.map +1 -0
- package/build/core/adapters/map_item_to_stacking_item.js +40 -0
- package/build/core/adapters/run_axle_calculator.d.ts.map +1 -1
- package/build/core/adapters/run_axle_calculator.js +21 -16
- package/build/core/candidates/candidate_validation.d.ts.map +1 -1
- package/build/core/candidates/candidate_validation.js +4 -0
- package/build/core/candidates/is_candidate_stacking_valid.d.ts +14 -0
- package/build/core/candidates/is_candidate_stacking_valid.d.ts.map +1 -0
- package/build/core/candidates/is_candidate_stacking_valid.js +43 -0
- package/build/core/evaluation/compare_search_states.d.ts +12 -0
- package/build/core/evaluation/compare_search_states.d.ts.map +1 -0
- package/build/core/evaluation/compare_search_states.js +12 -0
- package/build/core/evaluation/evaluate_search_gates.d.ts +18 -0
- package/build/core/evaluation/evaluate_search_gates.d.ts.map +1 -0
- package/build/core/evaluation/evaluate_search_gates.js +30 -0
- package/build/core/evaluation/evaluation_result.d.ts +15 -0
- package/build/core/evaluation/evaluation_result.d.ts.map +1 -0
- package/build/core/evaluation/evaluation_result.js +1 -0
- package/build/core/evaluation/genetic_fitness.d.ts +9 -0
- package/build/core/evaluation/genetic_fitness.d.ts.map +1 -0
- package/build/core/evaluation/genetic_fitness.js +16 -0
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts +8 -0
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts.map +1 -0
- package/build/core/evaluation/is_non_axle_gates_pass.js +8 -0
- package/build/core/evaluation/is_search_trial_admissible.d.ts +10 -0
- package/build/core/evaluation/is_search_trial_admissible.d.ts.map +1 -0
- package/build/core/evaluation/is_search_trial_admissible.js +17 -0
- package/build/core/evaluation/is_waypoint_order_valid.d.ts +10 -0
- package/build/core/evaluation/is_waypoint_order_valid.d.ts.map +1 -0
- package/build/core/evaluation/is_waypoint_order_valid.js +14 -0
- package/build/core/evaluation/state_evaluator.d.ts +2 -10
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.js +6 -26
- package/build/core/factory/read_stabilizer_config.d.ts +3 -2
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +5 -2
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +1 -1
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.js +1 -1
- package/build/core/filters/is_item_on_cm_floor.d.ts +2 -2
- package/build/core/filters/is_item_on_cm_floor.js +3 -3
- package/build/core/geometry/has_penetrating_overlap.d.ts +2 -2
- package/build/core/geometry/has_penetrating_overlap.d.ts.map +1 -1
- package/build/core/geometry/has_penetrating_overlap.js +6 -6
- package/build/core/orchestration/StabilizerFlow.d.ts.map +1 -1
- package/build/core/orchestration/StabilizerFlow.js +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.js +8 -10
- package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/GeneticReorder.js +2 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.js +14 -5
- package/build/core/strategies/reorder/append_admitted_trial.d.ts +11 -0
- package/build/core/strategies/reorder/append_admitted_trial.d.ts.map +1 -0
- package/build/core/strategies/reorder/append_admitted_trial.js +22 -0
- package/build/core/strategies/reorder/beam_context.d.ts +1 -0
- package/build/core/strategies/reorder/beam_context.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.js +3 -2
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts +10 -0
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts.map +1 -0
- package/build/core/strategies/reorder/is_improving_greedy_trial.js +17 -0
- package/build/core/strategies/reorder/select_surviving_beam.d.ts +3 -2
- package/build/core/strategies/reorder/select_surviving_beam.d.ts.map +1 -1
- package/build/core/strategies/reorder/select_surviving_beam.js +5 -4
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +37 -3
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +1 -1
- package/build/core/validation/contract/cargo_movement_wire_field_map.js +40 -6
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +1 -1
- package/build/core/validation/contract/cargo_movement_wire_mapper.js +10 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +1 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.js +12 -21
- package/build/core/validation/contract/map_input_config.d.ts +9 -0
- package/build/core/validation/contract/map_input_config.d.ts.map +1 -0
- package/build/core/validation/contract/map_input_config.js +40 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +1 -1
- package/build/core/validation/contract/map_wire_input_to_contract_shape.js +28 -22
- package/build/core/validation/contract/map_wire_item_stacking.d.ts +7 -0
- package/build/core/validation/contract/map_wire_item_stacking.d.ts.map +1 -0
- package/build/core/validation/contract/map_wire_item_stacking.js +40 -0
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts +1 -5
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts.map +1 -1
- package/build/core/validation/contract/map_wire_item_to_contract.js +16 -14
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +49 -7
- package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +1 -1
- package/build/core/validation/contract/parse_stabilizer_input.js +2 -0
- package/build/core/validation/contract/parse_stabilizer_output.d.ts +34 -5
- package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +1 -1
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts +6 -0
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts.map +1 -0
- package/build/core/validation/contract/reject_forbidden_input_fields.js +53 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts +36 -65
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +1 -1
- package/build/core/validation/contract/stabilizer_domain_schema.js +16 -38
- package/build/core/validation/contract/stabilizer_env_schema.d.ts +112 -0
- package/build/core/validation/contract/stabilizer_env_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_env_schema.js +38 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +51 -7
- package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +1 -1
- package/build/core/validation/contract/stabilizer_input_schema.js +2 -2
- package/build/core/validation/contract/stabilizer_item_schema.d.ts +25 -0
- package/build/core/validation/contract/stabilizer_item_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_item_schema.js +23 -0
- package/build/core/validation/contract/stabilizer_output_schema.d.ts +68 -10
- package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +1 -1
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts +14 -0
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts.map +1 -0
- package/build/core/validation/contract/uniquify_contract_item_ids.js +54 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.js +1 -1
- package/build/index.d.ts +11 -12
- package/build/index.d.ts.map +1 -1
- package/build/index.js +29 -21
- package/package.json +12 -10
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { stabilizer_config_schema } from '../schemas/stabilizer_config_schema.js';
|
|
2
3
|
import { add_waypoint_validation_issues, stabilizer_cargo_state_schema } from './stabilizer_domain_schema.js';
|
|
3
4
|
export const stabilizer_input_schema = z.object({
|
|
4
5
|
id: z.union([z.string(), z.number()]).optional(),
|
|
5
6
|
company: z.union([z.string(), z.number()]).optional(),
|
|
6
7
|
cargo_state: stabilizer_cargo_state_schema,
|
|
7
|
-
|
|
8
|
-
config: z.record(z.string(), z.unknown()).optional()
|
|
8
|
+
config: stabilizer_config_schema.optional()
|
|
9
9
|
}).strict().superRefine((input_data, context) => {
|
|
10
10
|
add_waypoint_validation_issues(input_data.cargo_state, context);
|
|
11
11
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const stabilizer_item_schema: z.ZodObject<{
|
|
3
|
+
item_id: z.ZodString;
|
|
4
|
+
group_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
5
|
+
waypoint_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
x: z.ZodNumber;
|
|
7
|
+
y: z.ZodNumber;
|
|
8
|
+
z: z.ZodNumber;
|
|
9
|
+
width: z.ZodNumber;
|
|
10
|
+
height: z.ZodNumber;
|
|
11
|
+
depth: z.ZodNumber;
|
|
12
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
tie_ratio_orientation: z.ZodOptional<z.ZodString>;
|
|
14
|
+
family: z.ZodOptional<z.ZodString>;
|
|
15
|
+
supported_families: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
16
|
+
constraint: z.ZodOptional<z.ZodString>;
|
|
17
|
+
stack_families: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
stack_same_item: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
stack_same_area: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
stacking_unit: z.ZodOptional<z.ZodString>;
|
|
21
|
+
supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type StabilizerItem = z.infer<typeof stabilizer_item_schema>;
|
|
25
|
+
//# sourceMappingURL=stabilizer_item_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stabilizer_item_schema.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/stabilizer_item_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;kBAqBxB,CAAA;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const stabilizer_item_schema = z.object({
|
|
3
|
+
item_id: z.string().min(1),
|
|
4
|
+
group_id: z.union([z.string(), z.null()]).optional(),
|
|
5
|
+
waypoint_id: z.string().optional(),
|
|
6
|
+
x: z.number(),
|
|
7
|
+
y: z.number(),
|
|
8
|
+
z: z.number(),
|
|
9
|
+
width: z.number().positive(),
|
|
10
|
+
height: z.number().positive(),
|
|
11
|
+
depth: z.number().positive(),
|
|
12
|
+
weight: z.number().optional(),
|
|
13
|
+
tie_ratio_orientation: z.string().optional(),
|
|
14
|
+
family: z.string().optional(),
|
|
15
|
+
supported_families: z.array(z.string()).optional(),
|
|
16
|
+
constraint: z.string().optional(),
|
|
17
|
+
stack_families: z.boolean().optional(),
|
|
18
|
+
stack_same_item: z.boolean().optional(),
|
|
19
|
+
stack_same_area: z.boolean().optional(),
|
|
20
|
+
stacking_unit: z.string().optional(),
|
|
21
|
+
supported_weight: z.number().optional(),
|
|
22
|
+
priority: z.number().optional()
|
|
23
|
+
}).strict();
|
|
@@ -19,14 +19,43 @@ export declare const stabilizer_success_response_schema: z.ZodObject<{
|
|
|
19
19
|
height: z.ZodNumber;
|
|
20
20
|
depth: z.ZodNumber;
|
|
21
21
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
|
|
22
|
+
tie_ratio_orientation: z.ZodOptional<z.ZodString>;
|
|
23
|
+
family: z.ZodOptional<z.ZodString>;
|
|
24
|
+
supported_families: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
constraint: z.ZodOptional<z.ZodString>;
|
|
26
|
+
stack_families: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
stack_same_item: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
stack_same_area: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
stacking_unit: z.ZodOptional<z.ZodString>;
|
|
30
|
+
supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
23
32
|
}, z.core.$strict>>;
|
|
24
|
-
|
|
33
|
+
kingpin_distance: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
container_distance_ahead: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
max_supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
tare: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
cargo_weight: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
grouper: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
axles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
41
|
+
distance_from_origin: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
max_supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
dnit_weight: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
tare: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
container_sequence: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strict>>>;
|
|
48
|
+
vehicle: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
vehicle_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
50
|
+
vehicle_type: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
version_type: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
suspension_type: z.ZodOptional<z.ZodString>;
|
|
53
|
+
first_axle: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
tare: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
max_supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
25
57
|
}, z.core.$strict>>;
|
|
26
|
-
axles: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
27
|
-
vehicle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
58
|
}, z.core.$strict>>;
|
|
29
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
30
59
|
}, z.core.$strict>;
|
|
31
60
|
messages: z.ZodArray<z.ZodString>;
|
|
32
61
|
}, z.core.$strict>;
|
|
@@ -55,14 +84,43 @@ export declare const stabilizer_response_schema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
55
84
|
height: z.ZodNumber;
|
|
56
85
|
depth: z.ZodNumber;
|
|
57
86
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
58
|
-
|
|
87
|
+
tie_ratio_orientation: z.ZodOptional<z.ZodString>;
|
|
88
|
+
family: z.ZodOptional<z.ZodString>;
|
|
89
|
+
supported_families: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
constraint: z.ZodOptional<z.ZodString>;
|
|
91
|
+
stack_families: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
stack_same_item: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
stack_same_area: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
stacking_unit: z.ZodOptional<z.ZodString>;
|
|
95
|
+
supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
59
97
|
}, z.core.$strict>>;
|
|
60
|
-
|
|
98
|
+
kingpin_distance: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
container_distance_ahead: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
max_supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
tare: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
cargo_weight: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
grouper: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
}, z.core.$strict>>;
|
|
105
|
+
axles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
106
|
+
distance_from_origin: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
max_supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
dnit_weight: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
tare: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
container_sequence: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
}, z.core.$strict>>>;
|
|
113
|
+
vehicle: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
vehicle_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
115
|
+
vehicle_type: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
version_type: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
suspension_type: z.ZodOptional<z.ZodString>;
|
|
118
|
+
first_axle: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
tare: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
max_supported_weight: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
61
122
|
}, z.core.$strict>>;
|
|
62
|
-
axles: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
|
-
vehicle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
64
123
|
}, z.core.$strict>>;
|
|
65
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
66
124
|
}, z.core.$strict>;
|
|
67
125
|
messages: z.ZodArray<z.ZodString>;
|
|
68
126
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stabilizer_output_schema.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/stabilizer_output_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,kCAAkC
|
|
1
|
+
{"version":3,"file":"stabilizer_output_schema.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/stabilizer_output_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAIpC,CAAA;AAEX,eAAO,MAAM,gCAAgC;;;;kBAIlC,CAAA;AAEX,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAGrC,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC1F,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACtF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes contract item_id unique when the same SKU id repeats.
|
|
3
|
+
* Duplicate catalog ids receive a `#occurrence` suffix on `item_id`.
|
|
4
|
+
* @param items - Mapped contract items.
|
|
5
|
+
* @returns Items with unique `item_id` values.
|
|
6
|
+
*/
|
|
7
|
+
export declare function uniquify_contract_item_ids(items: unknown[]): unknown[];
|
|
8
|
+
/**
|
|
9
|
+
* Removes a numeric `#occurrence` suffix added by uniquify.
|
|
10
|
+
* @param item_id - Possibly uniquified item id.
|
|
11
|
+
* @returns Original item id.
|
|
12
|
+
*/
|
|
13
|
+
export declare function strip_uniquify_suffix(item_id: string): string;
|
|
14
|
+
//# sourceMappingURL=uniquify_contract_item_ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniquify_contract_item_ids.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/uniquify_contract_item_ids.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAKtE;AA0CD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAa7D"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { is_record } from './wire_mapper_record_utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Makes contract item_id unique when the same SKU id repeats.
|
|
4
|
+
* Duplicate catalog ids receive a `#occurrence` suffix on `item_id`.
|
|
5
|
+
* @param items - Mapped contract items.
|
|
6
|
+
* @returns Items with unique `item_id` values.
|
|
7
|
+
*/
|
|
8
|
+
export function uniquify_contract_item_ids(items) {
|
|
9
|
+
const counts = count_item_ids(items);
|
|
10
|
+
const seen = new Map();
|
|
11
|
+
return items.map(item => uniquify_one_item(item, counts, seen));
|
|
12
|
+
}
|
|
13
|
+
function count_item_ids(items) {
|
|
14
|
+
const counts = new Map();
|
|
15
|
+
for (const item of items) {
|
|
16
|
+
const item_id = read_item_id(item);
|
|
17
|
+
if (item_id === undefined) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
counts.set(item_id, (counts.get(item_id) ?? 0) + 1);
|
|
21
|
+
}
|
|
22
|
+
return counts;
|
|
23
|
+
}
|
|
24
|
+
function uniquify_one_item(item, counts, seen) {
|
|
25
|
+
const item_id = read_item_id(item);
|
|
26
|
+
if (item_id === undefined || (counts.get(item_id) ?? 0) <= 1 || !is_record(item)) {
|
|
27
|
+
return item;
|
|
28
|
+
}
|
|
29
|
+
const occurrence = seen.get(item_id) ?? 0;
|
|
30
|
+
seen.set(item_id, occurrence + 1);
|
|
31
|
+
return { ...item, item_id: `${item_id}#${occurrence}` };
|
|
32
|
+
}
|
|
33
|
+
function read_item_id(item) {
|
|
34
|
+
if (!is_record(item) || typeof item.item_id !== 'string') {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return item.item_id;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Removes a numeric `#occurrence` suffix added by uniquify.
|
|
41
|
+
* @param item_id - Possibly uniquified item id.
|
|
42
|
+
* @returns Original item id.
|
|
43
|
+
*/
|
|
44
|
+
export function strip_uniquify_suffix(item_id) {
|
|
45
|
+
const index = item_id.lastIndexOf('#');
|
|
46
|
+
if (index < 0) {
|
|
47
|
+
return item_id;
|
|
48
|
+
}
|
|
49
|
+
const suffix = item_id.slice(index + 1);
|
|
50
|
+
if (!/^\d+$/.test(suffix)) {
|
|
51
|
+
return item_id;
|
|
52
|
+
}
|
|
53
|
+
return item_id.slice(0, index);
|
|
54
|
+
}
|
|
@@ -15,6 +15,6 @@ export declare const stabilizer_config_schema: z.ZodObject<{
|
|
|
15
15
|
pin_tie_ratio_blocks: z.ZodDefault<z.ZodBoolean>;
|
|
16
16
|
enforce_milkrun_wall_reservation: z.ZodDefault<z.ZodBoolean>;
|
|
17
17
|
number_of_wall_to_allocate_from_last_waypoints: z.ZodDefault<z.ZodNumber>;
|
|
18
|
-
}, z.core.$
|
|
18
|
+
}, z.core.$strict>;
|
|
19
19
|
export type StabilizerConfig = z.infer<typeof stabilizer_config_schema>;
|
|
20
20
|
//# sourceMappingURL=stabilizer_config_schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stabilizer_config_schema.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/schemas/stabilizer_config_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"stabilizer_config_schema.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/schemas/stabilizer_config_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;kBAc1B,CAAA;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
|
@@ -14,4 +14,4 @@ export const stabilizer_config_schema = z.object({
|
|
|
14
14
|
pin_tie_ratio_blocks: z.boolean().default(false),
|
|
15
15
|
enforce_milkrun_wall_reservation: z.boolean().default(false),
|
|
16
16
|
number_of_wall_to_allocate_from_last_waypoints: z.number().int().min(0).default(0)
|
|
17
|
-
});
|
|
17
|
+
}).strict();
|
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type StabilizerInput, type StabilizerResponse } from './core/validation/contract/index.js';
|
|
1
2
|
export { REORDER_STRATEGY, REORDER_STRATEGY_VALUES } from './core/constants/ReorderStrategy.js';
|
|
2
3
|
export type { ReorderStrategyValue } from './core/constants/ReorderStrategy.js';
|
|
3
4
|
export { MixedWaypointIdError } from './core/exceptions/MixedWaypointIdError.js';
|
|
@@ -6,21 +7,19 @@ export { InvalidStabilizerInputError } from './core/exceptions/InvalidStabilizer
|
|
|
6
7
|
export { InvalidStabilizerOutputError } from './core/exceptions/InvalidStabilizerOutputError.js';
|
|
7
8
|
export type { StabilizerInput, StabilizerResponse, StabilizerSuccessResponse, StabilizerErrorResponse, StabilizerItem, StabilizerContainer, StabilizerEnv, StabilizerCargoState } from './core/validation/contract/index.js';
|
|
8
9
|
export { parse_stabilizer_input, safe_parse_stabilizer_input, parse_stabilizer_output, safe_parse_stabilizer_output, map_wire_input_to_contract, map_contract_to_wire_output } from './core/validation/contract/index.js';
|
|
9
|
-
export type StabilizerWireResponse =
|
|
10
|
-
status: 'success';
|
|
11
|
-
data: unknown;
|
|
12
|
-
messages: string[];
|
|
13
|
-
} | {
|
|
14
|
-
status: 'error';
|
|
15
|
-
data: string;
|
|
16
|
-
messages: string[];
|
|
17
|
-
};
|
|
10
|
+
export type StabilizerWireResponse = StabilizerResponse;
|
|
18
11
|
/**
|
|
19
|
-
*
|
|
12
|
+
* Parses unknown wire or English input, then runs the typed stabilizer.
|
|
20
13
|
* @param input - Cargo-movement wire payload or English contract input.
|
|
21
|
-
* @returns Success or error response with
|
|
14
|
+
* @returns Success or error response with typed cargo_state on success.
|
|
22
15
|
*/
|
|
23
|
-
export declare function stabilize(input: unknown): Promise<
|
|
16
|
+
export declare function stabilize(input: unknown): Promise<StabilizerResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Runs stabilizer on a parsed contract input. `unknown` is not accepted.
|
|
19
|
+
* @param input - Validated stabilizer input.
|
|
20
|
+
* @returns Success or error response.
|
|
21
|
+
*/
|
|
22
|
+
export declare function run_stabilize(input: StabilizerInput): StabilizerResponse;
|
|
24
23
|
export { run_stabilizer_flow_from_unknown } from './core/orchestration/StabilizerFlow.js';
|
|
25
24
|
export { create_reorder_strategy } from './core/factory/strategy_factory.js';
|
|
26
25
|
export { validate_waypoint_ids } from './core/waypoint/validate_waypoint_ids.js';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAC1B,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC/F,YAAY,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAA;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAA;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAA;AAChG,YAAY,EACR,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACvB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACH,sBAAsB,EACtB,2BAA2B,EAC3B,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC9B,MAAM,qCAAqC,CAAA;AAK5C,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAA;AAEvD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAc3E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,CAaxE;AAkDD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAA;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Logger } from '@jetta/logger';
|
|
2
|
-
import {
|
|
2
|
+
import { run_stabilizer_flow } from './core/orchestration/StabilizerFlow.js';
|
|
3
3
|
import { stabilizer_logger } from './core/logging/stabilizer_logger.js';
|
|
4
|
-
import {
|
|
4
|
+
import { parse_stabilizer_input, parse_stabilizer_output } from './core/validation/contract/index.js';
|
|
5
5
|
export { REORDER_STRATEGY, REORDER_STRATEGY_VALUES } from './core/constants/ReorderStrategy.js';
|
|
6
6
|
export { MixedWaypointIdError } from './core/exceptions/MixedWaypointIdError.js';
|
|
7
7
|
export { UnknownReorderStrategyError } from './core/exceptions/UnknownReorderStrategyError.js';
|
|
@@ -11,13 +11,36 @@ export { parse_stabilizer_input, safe_parse_stabilizer_input, parse_stabilizer_o
|
|
|
11
11
|
const messages = [];
|
|
12
12
|
const UNKNOWN_IDENTITY = 'UNKNOWN';
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Parses unknown wire or English input, then runs the typed stabilizer.
|
|
15
15
|
* @param input - Cargo-movement wire payload or English contract input.
|
|
16
|
-
* @returns Success or error response with
|
|
16
|
+
* @returns Success or error response with typed cargo_state on success.
|
|
17
17
|
*/
|
|
18
18
|
export async function stabilize(input) {
|
|
19
19
|
const identity = read_stabilizer_identity(input);
|
|
20
|
-
return Logger.run_with_cargo_info(identity.company, identity.cargo_id, () =>
|
|
20
|
+
return Logger.run_with_cargo_info(identity.company, identity.cargo_id, () => {
|
|
21
|
+
try {
|
|
22
|
+
return run_stabilize(parse_stabilizer_input(input));
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return build_error_response(error);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Runs stabilizer on a parsed contract input. `unknown` is not accepted.
|
|
31
|
+
* @param input - Validated stabilizer input.
|
|
32
|
+
* @returns Success or error response.
|
|
33
|
+
*/
|
|
34
|
+
export function run_stabilize(input) {
|
|
35
|
+
stabilizer_logger.log('cargo-stabilizer started');
|
|
36
|
+
try {
|
|
37
|
+
const cargo_state = run_stabilizer_flow(input);
|
|
38
|
+
stabilizer_logger.log('cargo-stabilizer finished successfully');
|
|
39
|
+
return build_success_response(cargo_state);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return build_error_response(error);
|
|
43
|
+
}
|
|
21
44
|
}
|
|
22
45
|
function read_stabilizer_identity(input) {
|
|
23
46
|
if (typeof input !== 'object' || input === null) {
|
|
@@ -29,17 +52,6 @@ function read_stabilizer_identity(input) {
|
|
|
29
52
|
cargo_id: record.id !== undefined ? String(record.id) : UNKNOWN_IDENTITY
|
|
30
53
|
};
|
|
31
54
|
}
|
|
32
|
-
function run_stabilize(input) {
|
|
33
|
-
stabilizer_logger.log('cargo-stabilizer started');
|
|
34
|
-
try {
|
|
35
|
-
const cargo_state = run_stabilizer_flow_from_unknown(input);
|
|
36
|
-
stabilizer_logger.log('cargo-stabilizer finished successfully');
|
|
37
|
-
return build_success_response(cargo_state);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
return build_error_response(error);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
55
|
function build_success_response(cargo_state) {
|
|
44
56
|
const english_response = {
|
|
45
57
|
status: 'success',
|
|
@@ -50,11 +62,7 @@ function build_success_response(cargo_state) {
|
|
|
50
62
|
if (validated.status !== 'success') {
|
|
51
63
|
throw new Error('Expected success response after stabilizer flow');
|
|
52
64
|
}
|
|
53
|
-
return
|
|
54
|
-
status: 'success',
|
|
55
|
-
data: map_contract_to_wire_output(validated.data),
|
|
56
|
-
messages: validated.messages
|
|
57
|
-
};
|
|
65
|
+
return validated;
|
|
58
66
|
}
|
|
59
67
|
function build_error_response(err) {
|
|
60
68
|
stabilizer_logger.warn('cargo-stabilizer finished with error');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetta/cargo-stabilizer",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-15",
|
|
4
4
|
"description": "Stable loose-item reorder library for cargo-movement (JET-2262)",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,23 +29,25 @@
|
|
|
29
29
|
"coverage:ci": "c8 --reporter=text --reporter=text-summary --check-coverage --lines 75 --functions 75 --branches 75 --statements 75 npm run test"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@jetta/axle-load-calculator": "^0.
|
|
32
|
+
"@jetta/axle-load-calculator": "^0.3.3",
|
|
33
33
|
"@jetta/cargo-stability": "^2.0.1-3",
|
|
34
34
|
"@jetta/empty-spaces-manager": "^0.1.1-0",
|
|
35
|
+
"@jetta/number-compare": "^3.0.3",
|
|
36
|
+
"@jetta/stacking-constraints": "^1.1.0",
|
|
35
37
|
"zod": "^4.4.3"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"@types/chai": "^5.2.3",
|
|
39
41
|
"@types/mocha": "^10.0.10",
|
|
40
|
-
"@types/node": "^
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
42
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
-
"c8": "^
|
|
42
|
+
"@types/node": "^26.3.0",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.68.0",
|
|
44
|
+
"@typescript-eslint/parser": "^8.68.0",
|
|
45
|
+
"c8": "^12.0.0",
|
|
44
46
|
"chai": "^6.2.2",
|
|
45
|
-
"eslint": "^9.
|
|
46
|
-
"mocha": "^11.
|
|
47
|
-
"publint": "^0.3.
|
|
48
|
-
"tsx": "^4.
|
|
47
|
+
"eslint": "^10.9.1",
|
|
48
|
+
"mocha": "^11.8.0",
|
|
49
|
+
"publint": "^0.3.24",
|
|
50
|
+
"tsx": "^4.23.12",
|
|
49
51
|
"typescript": "^6.0.3"
|
|
50
52
|
}
|
|
51
53
|
}
|