@jetta/cargo-stabilizer 0.1.0-3 → 0.1.0-5
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 +21 -1
- package/README.md +51 -11
- package/build/core/adapters/axle_adapter.d.ts +4 -4
- package/build/core/adapters/axle_adapter.d.ts.map +1 -1
- package/build/core/adapters/axle_adapter.js +7 -5
- package/build/core/adapters/coordinate_mapper.d.ts +5 -5
- package/build/core/adapters/coordinate_mapper.d.ts.map +1 -1
- package/build/core/adapters/coordinate_mapper.js +11 -11
- package/build/core/adapters/empty_space_adapter.d.ts +10 -0
- package/build/core/adapters/empty_space_adapter.d.ts.map +1 -0
- package/build/core/adapters/empty_space_adapter.js +24 -0
- package/build/core/adapters/map_item_to_positioned_cube.d.ts +9 -0
- package/build/core/adapters/map_item_to_positioned_cube.d.ts.map +1 -0
- package/build/core/adapters/map_item_to_positioned_cube.js +16 -0
- package/build/core/adapters/stability_adapter.d.ts +1 -1
- package/build/core/adapters/stability_adapter.d.ts.map +1 -1
- package/build/core/adapters/stability_adapter.js +1 -1
- package/build/core/candidates/build_candidate_context.d.ts +1 -1
- package/build/core/candidates/build_candidate_context.d.ts.map +1 -1
- package/build/core/candidates/build_candidate_context.js +3 -1
- package/build/core/candidates/candidate_context.d.ts +4 -1
- package/build/core/candidates/candidate_context.d.ts.map +1 -1
- package/build/core/candidates/candidate_generator.d.ts +1 -1
- package/build/core/candidates/candidate_generator.d.ts.map +1 -1
- package/build/core/candidates/candidate_generator.js +19 -16
- package/build/core/candidates/candidate_validation.d.ts +0 -12
- package/build/core/candidates/candidate_validation.d.ts.map +1 -1
- package/build/core/candidates/candidate_validation.js +32 -26
- package/build/core/candidates/enumerate_empty_space_slots.d.ts +15 -0
- package/build/core/candidates/enumerate_empty_space_slots.d.ts.map +1 -0
- package/build/core/candidates/enumerate_empty_space_slots.js +44 -0
- package/build/core/candidates/rank_candidates.d.ts.map +1 -1
- package/build/core/candidates/rank_candidates.js +3 -0
- package/build/core/evaluation/evaluation_context.d.ts +3 -1
- package/build/core/evaluation/evaluation_context.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.d.ts +12 -1
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.js +28 -5
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts +4 -0
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts.map +1 -0
- package/build/core/exceptions/InvalidStabilizerOutputError.js +6 -0
- package/build/core/factory/read_stabilizer_config.d.ts +4 -2
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config.js +6 -25
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +28 -0
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +1 -0
- package/build/core/factory/read_stabilizer_config_helpers.js +62 -0
- package/build/core/filters/loose_item_filter.d.ts +2 -2
- package/build/core/filters/loose_item_filter.d.ts.map +1 -1
- package/build/core/filters/loose_item_filter.js +3 -3
- package/build/core/geometry/box_geometry.d.ts +17 -1
- package/build/core/geometry/box_geometry.d.ts.map +1 -1
- package/build/core/geometry/box_geometry.js +67 -2
- package/build/core/move/apply_move.d.ts +1 -1
- package/build/core/move/apply_move.d.ts.map +1 -1
- package/build/core/move/apply_move.js +1 -1
- package/build/core/orchestration/StabilizerFlow.d.ts +2 -1
- package/build/core/orchestration/StabilizerFlow.d.ts.map +1 -1
- package/build/core/orchestration/StabilizerFlow.js +2 -2
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts +13 -0
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts.map +1 -0
- package/build/core/orchestration/build_milkrun_bands_from_config.js +14 -0
- package/build/core/orchestration/build_reorder_context.d.ts +1 -1
- package/build/core/orchestration/build_reorder_context.d.ts.map +1 -1
- package/build/core/orchestration/build_reorder_context.js +7 -7
- package/build/core/orchestration/read_primary_env.d.ts +9 -0
- package/build/core/orchestration/read_primary_env.d.ts.map +1 -0
- package/build/core/orchestration/read_primary_env.js +13 -0
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.js +3 -3
- package/build/core/strategies/reorder/GeneticReorder.d.ts +1 -1
- package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/GravityCompaction.d.ts +1 -1
- package/build/core/strategies/reorder/GravityCompaction.d.ts.map +1 -1
- package/build/core/strategies/reorder/GravityCompaction.js +2 -2
- package/build/core/strategies/reorder/GreedyReorder.d.ts +1 -1
- package/build/core/strategies/reorder/GreedyReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/ReorderStrategy.d.ts +3 -1
- package/build/core/strategies/reorder/ReorderStrategy.d.ts.map +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/anneal_helpers.d.ts +1 -1
- package/build/core/strategies/reorder/anneal_helpers.d.ts.map +1 -1
- package/build/core/strategies/reorder/anneal_helpers.js +1 -1
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts +1 -1
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts.map +1 -1
- package/build/core/strategies/reorder/beam_context.d.ts +1 -1
- package/build/core/strategies/reorder/beam_context.d.ts.map +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts.map +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.js +2 -2
- package/build/core/strategies/reorder/greedy_improvement.d.ts +1 -1
- package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.js +2 -2
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +21 -0
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +1 -0
- package/build/core/validation/contract/cargo_movement_wire_field_map.js +27 -0
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts +14 -0
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +1 -0
- package/build/core/validation/contract/cargo_movement_wire_mapper.js +34 -0
- package/build/core/validation/contract/format_zod_error.d.ts +8 -0
- package/build/core/validation/contract/format_zod_error.d.ts.map +1 -0
- package/build/core/validation/contract/format_zod_error.js +11 -0
- package/build/core/validation/contract/index.d.ts +9 -0
- package/build/core/validation/contract/index.d.ts.map +1 -0
- package/build/core/validation/contract/index.js +8 -0
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts +3 -0
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +1 -0
- package/build/core/validation/contract/map_contract_to_wire_shape.js +28 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts +2 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +1 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.js +62 -0
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +45 -0
- package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +1 -0
- package/build/core/validation/contract/parse_stabilizer_input.js +26 -0
- package/build/core/validation/contract/parse_stabilizer_output.d.ts +47 -0
- package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +1 -0
- package/build/core/validation/contract/parse_stabilizer_output.js +24 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts +92 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_domain_schema.js +61 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +33 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_input_schema.js +11 -0
- package/build/core/validation/contract/stabilizer_output_schema.d.ts +70 -0
- package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_output_schema.js +16 -0
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts +20 -0
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts.map +1 -0
- package/build/core/validation/contract/wire_mapper_record_utils.js +36 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +4 -1
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.js +4 -1
- package/build/core/waypoint/build_waypoint_zones.d.ts +1 -1
- package/build/core/waypoint/build_waypoint_zones.d.ts.map +1 -1
- package/build/core/waypoint/build_waypoint_zones.js +2 -2
- package/build/core/waypoint/milkrun_wall_reservation.d.ts +24 -0
- package/build/core/waypoint/milkrun_wall_reservation.d.ts.map +1 -0
- package/build/core/waypoint/milkrun_wall_reservation.js +57 -0
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts +15 -0
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts.map +1 -0
- package/build/core/waypoint/milkrun_wall_reservation_helpers.js +48 -0
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts +16 -0
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts.map +1 -0
- package/build/core/waypoint/milkrun_wall_reservation_types.js +1 -0
- package/build/core/waypoint/preserves_waypoint_order.d.ts +1 -1
- package/build/core/waypoint/preserves_waypoint_order.d.ts.map +1 -1
- package/build/core/waypoint/validate_waypoint_ids.d.ts +1 -1
- package/build/core/waypoint/validate_waypoint_ids.d.ts.map +1 -1
- package/build/index.d.ts +15 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +30 -7
- package/package.json +1 -1
- package/build/core/validation/parse_stabilizer_input.d.ts +0 -8
- package/build/core/validation/parse_stabilizer_input.d.ts.map +0 -1
- package/build/core/validation/parse_stabilizer_input.js +0 -20
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts +0 -110
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts.map +0 -1
- package/build/core/validation/schemas/stabilizer_input_schema.js +0 -34
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts +0 -13
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts.map +0 -1
- package/build/core/validation/schemas/stabilizer_output_schema.js +0 -6
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { format_zod_error } from './format_zod_error.js';
|
|
2
|
+
import { type StabilizerInput } from './stabilizer_input_schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* Safely parses stabilizer input after wire mapping.
|
|
5
|
+
* @param input_data - Unknown wire payload.
|
|
6
|
+
* @returns Zod safe parse result.
|
|
7
|
+
*/
|
|
8
|
+
export declare function safe_parse_stabilizer_input(input_data: unknown): import("zod").ZodSafeParseResult<{
|
|
9
|
+
cargo_state: {
|
|
10
|
+
envs: {
|
|
11
|
+
containers: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
length: number;
|
|
15
|
+
items: {
|
|
16
|
+
item_id: string;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
z: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
depth: number;
|
|
23
|
+
group_id?: string | null | undefined;
|
|
24
|
+
waypoint_id?: string | undefined;
|
|
25
|
+
weight?: number | undefined;
|
|
26
|
+
}[];
|
|
27
|
+
sequence?: number | undefined;
|
|
28
|
+
}[];
|
|
29
|
+
axles?: Record<string, unknown>[] | undefined;
|
|
30
|
+
}[];
|
|
31
|
+
config?: Record<string, unknown> | undefined;
|
|
32
|
+
};
|
|
33
|
+
id?: string | number | undefined;
|
|
34
|
+
company?: string | number | undefined;
|
|
35
|
+
original_input?: unknown;
|
|
36
|
+
config?: Record<string, unknown> | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Parses stabilizer input at the public boundary.
|
|
40
|
+
* @param input_data - Unknown wire payload.
|
|
41
|
+
* @returns Validated stabilizer input in English contract shape.
|
|
42
|
+
*/
|
|
43
|
+
export declare function parse_stabilizer_input(input_data: unknown): StabilizerInput;
|
|
44
|
+
export { format_zod_error };
|
|
45
|
+
//# sourceMappingURL=parse_stabilizer_input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse_stabilizer_input.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/parse_stabilizer_input.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAE5F;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAI9D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,OAAO,GAAG,eAAe,CAS3E;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InvalidStabilizerInputError } from '../../exceptions/InvalidStabilizerInputError.js';
|
|
2
|
+
import { map_wire_input_to_contract } from './cargo_movement_wire_mapper.js';
|
|
3
|
+
import { format_zod_error } from './format_zod_error.js';
|
|
4
|
+
import { stabilizer_input_schema } from './stabilizer_input_schema.js';
|
|
5
|
+
/**
|
|
6
|
+
* Safely parses stabilizer input after wire mapping.
|
|
7
|
+
* @param input_data - Unknown wire payload.
|
|
8
|
+
* @returns Zod safe parse result.
|
|
9
|
+
*/
|
|
10
|
+
export function safe_parse_stabilizer_input(input_data) {
|
|
11
|
+
const contract_payload = map_wire_input_to_contract(input_data);
|
|
12
|
+
return stabilizer_input_schema.safeParse(contract_payload);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parses stabilizer input at the public boundary.
|
|
16
|
+
* @param input_data - Unknown wire payload.
|
|
17
|
+
* @returns Validated stabilizer input in English contract shape.
|
|
18
|
+
*/
|
|
19
|
+
export function parse_stabilizer_input(input_data) {
|
|
20
|
+
const result = safe_parse_stabilizer_input(input_data);
|
|
21
|
+
if (!result.success) {
|
|
22
|
+
throw new InvalidStabilizerInputError(format_zod_error(result.error));
|
|
23
|
+
}
|
|
24
|
+
return result.data;
|
|
25
|
+
}
|
|
26
|
+
export { format_zod_error };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { format_zod_error } from './format_zod_error.js';
|
|
2
|
+
import { type StabilizerResponse } from './stabilizer_output_schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* Safely parses stabilizer output envelope.
|
|
5
|
+
* @param output_data - Unknown response payload.
|
|
6
|
+
* @returns Zod safe parse result.
|
|
7
|
+
*/
|
|
8
|
+
export declare function safe_parse_stabilizer_output(output_data: unknown): import("zod").ZodSafeParseResult<{
|
|
9
|
+
status: "success";
|
|
10
|
+
data: {
|
|
11
|
+
envs: {
|
|
12
|
+
containers: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
length: number;
|
|
16
|
+
items: {
|
|
17
|
+
item_id: string;
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
z: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
depth: number;
|
|
24
|
+
group_id?: string | null | undefined;
|
|
25
|
+
waypoint_id?: string | undefined;
|
|
26
|
+
weight?: number | undefined;
|
|
27
|
+
}[];
|
|
28
|
+
sequence?: number | undefined;
|
|
29
|
+
}[];
|
|
30
|
+
axles?: Record<string, unknown>[] | undefined;
|
|
31
|
+
}[];
|
|
32
|
+
config?: Record<string, unknown> | undefined;
|
|
33
|
+
};
|
|
34
|
+
messages: string[];
|
|
35
|
+
} | {
|
|
36
|
+
status: "error";
|
|
37
|
+
data: string;
|
|
38
|
+
messages: string[];
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Parses stabilizer output at the public boundary.
|
|
42
|
+
* @param output_data - Unknown response payload.
|
|
43
|
+
* @returns Validated stabilizer response in English contract shape.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parse_stabilizer_output(output_data: unknown): StabilizerResponse;
|
|
46
|
+
export { format_zod_error };
|
|
47
|
+
//# sourceMappingURL=parse_stabilizer_output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse_stabilizer_output.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/parse_stabilizer_output.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAEH,KAAK,kBAAkB,EAC1B,MAAM,+BAA+B,CAAA;AAEtC;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGhE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,OAAO,GAAG,kBAAkB,CAShF;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { InvalidStabilizerOutputError } from '../../exceptions/InvalidStabilizerOutputError.js';
|
|
2
|
+
import { format_zod_error } from './format_zod_error.js';
|
|
3
|
+
import { stabilizer_response_schema } from './stabilizer_output_schema.js';
|
|
4
|
+
/**
|
|
5
|
+
* Safely parses stabilizer output envelope.
|
|
6
|
+
* @param output_data - Unknown response payload.
|
|
7
|
+
* @returns Zod safe parse result.
|
|
8
|
+
*/
|
|
9
|
+
export function safe_parse_stabilizer_output(output_data) {
|
|
10
|
+
return stabilizer_response_schema.safeParse(output_data);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parses stabilizer output at the public boundary.
|
|
14
|
+
* @param output_data - Unknown response payload.
|
|
15
|
+
* @returns Validated stabilizer response in English contract shape.
|
|
16
|
+
*/
|
|
17
|
+
export function parse_stabilizer_output(output_data) {
|
|
18
|
+
const result = safe_parse_stabilizer_output(output_data);
|
|
19
|
+
if (!result.success) {
|
|
20
|
+
throw new InvalidStabilizerOutputError(format_zod_error(result.error));
|
|
21
|
+
}
|
|
22
|
+
return result.data;
|
|
23
|
+
}
|
|
24
|
+
export { format_zod_error };
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
}, z.core.$strict>;
|
|
14
|
+
export declare const stabilizer_container_schema: z.ZodObject<{
|
|
15
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
width: z.ZodNumber;
|
|
17
|
+
height: z.ZodNumber;
|
|
18
|
+
length: z.ZodNumber;
|
|
19
|
+
items: z.ZodArray<z.ZodObject<{
|
|
20
|
+
item_id: z.ZodString;
|
|
21
|
+
group_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
22
|
+
waypoint_id: z.ZodOptional<z.ZodString>;
|
|
23
|
+
x: z.ZodNumber;
|
|
24
|
+
y: z.ZodNumber;
|
|
25
|
+
z: z.ZodNumber;
|
|
26
|
+
width: z.ZodNumber;
|
|
27
|
+
height: z.ZodNumber;
|
|
28
|
+
depth: z.ZodNumber;
|
|
29
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export declare const stabilizer_env_schema: z.ZodObject<{
|
|
33
|
+
containers: z.ZodArray<z.ZodObject<{
|
|
34
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
width: z.ZodNumber;
|
|
36
|
+
height: z.ZodNumber;
|
|
37
|
+
length: z.ZodNumber;
|
|
38
|
+
items: z.ZodArray<z.ZodObject<{
|
|
39
|
+
item_id: z.ZodString;
|
|
40
|
+
group_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
41
|
+
waypoint_id: z.ZodOptional<z.ZodString>;
|
|
42
|
+
x: z.ZodNumber;
|
|
43
|
+
y: z.ZodNumber;
|
|
44
|
+
z: z.ZodNumber;
|
|
45
|
+
width: z.ZodNumber;
|
|
46
|
+
height: z.ZodNumber;
|
|
47
|
+
depth: z.ZodNumber;
|
|
48
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
}, z.core.$strict>>;
|
|
51
|
+
axles: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export declare const stabilizer_cargo_state_schema: z.ZodObject<{
|
|
54
|
+
envs: z.ZodArray<z.ZodObject<{
|
|
55
|
+
containers: z.ZodArray<z.ZodObject<{
|
|
56
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
width: z.ZodNumber;
|
|
58
|
+
height: z.ZodNumber;
|
|
59
|
+
length: z.ZodNumber;
|
|
60
|
+
items: z.ZodArray<z.ZodObject<{
|
|
61
|
+
item_id: z.ZodString;
|
|
62
|
+
group_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
63
|
+
waypoint_id: z.ZodOptional<z.ZodString>;
|
|
64
|
+
x: z.ZodNumber;
|
|
65
|
+
y: z.ZodNumber;
|
|
66
|
+
z: z.ZodNumber;
|
|
67
|
+
width: z.ZodNumber;
|
|
68
|
+
height: z.ZodNumber;
|
|
69
|
+
depth: z.ZodNumber;
|
|
70
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
}, z.core.$strict>>;
|
|
72
|
+
}, z.core.$strict>>;
|
|
73
|
+
axles: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
74
|
+
}, z.core.$strict>>;
|
|
75
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export type StabilizerItem = z.infer<typeof stabilizer_item_schema>;
|
|
78
|
+
export type StabilizerContainer = z.infer<typeof stabilizer_container_schema>;
|
|
79
|
+
export type StabilizerEnv = z.infer<typeof stabilizer_env_schema>;
|
|
80
|
+
export type StabilizerCargoState = z.infer<typeof stabilizer_cargo_state_schema>;
|
|
81
|
+
/**
|
|
82
|
+
* Validates waypoint consistency across all items in the primary env.
|
|
83
|
+
* @param cargo_state - Parsed cargo state.
|
|
84
|
+
*/
|
|
85
|
+
export declare function validate_primary_env_waypoints(cargo_state: StabilizerCargoState): void;
|
|
86
|
+
/**
|
|
87
|
+
* Adds waypoint validation issues to a Zod context.
|
|
88
|
+
* @param cargo_state - Cargo state being validated.
|
|
89
|
+
* @param context - Zod refinement context.
|
|
90
|
+
*/
|
|
91
|
+
export declare function add_waypoint_validation_issues(cargo_state: StabilizerCargoState, context: z.RefinementCtx): void;
|
|
92
|
+
//# sourceMappingURL=stabilizer_domain_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stabilizer_domain_schema.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/stabilizer_domain_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,sBAAsB;;;;;;;;;;;kBAWxB,CAAA;AAEX,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;kBAM7B,CAAA;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;kBAGvB,CAAA;AAEX,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;kBAG/B,CAAA;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACnE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAC7E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACjE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAEhF;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAKtF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC1C,WAAW,EAAE,oBAAoB,EACjC,OAAO,EAAE,CAAC,CAAC,aAAa,GACzB,IAAI,CAqBN"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MixedWaypointIdError } from '../../exceptions/MixedWaypointIdError.js';
|
|
3
|
+
import { validate_waypoint_ids } from '../../waypoint/validate_waypoint_ids.js';
|
|
4
|
+
export const stabilizer_item_schema = z.object({
|
|
5
|
+
item_id: z.string().min(1),
|
|
6
|
+
group_id: z.union([z.string(), z.null()]).optional(),
|
|
7
|
+
waypoint_id: z.string().optional(),
|
|
8
|
+
x: z.number(),
|
|
9
|
+
y: z.number(),
|
|
10
|
+
z: z.number(),
|
|
11
|
+
width: z.number().positive(),
|
|
12
|
+
height: z.number().positive(),
|
|
13
|
+
depth: z.number().positive(),
|
|
14
|
+
weight: z.number().optional()
|
|
15
|
+
}).strict();
|
|
16
|
+
export const stabilizer_container_schema = z.object({
|
|
17
|
+
sequence: z.number().optional(),
|
|
18
|
+
width: z.number().positive(),
|
|
19
|
+
height: z.number().positive(),
|
|
20
|
+
length: z.number().positive(),
|
|
21
|
+
items: z.array(stabilizer_item_schema)
|
|
22
|
+
}).strict();
|
|
23
|
+
export const stabilizer_env_schema = z.object({
|
|
24
|
+
containers: z.array(stabilizer_container_schema).min(1),
|
|
25
|
+
axles: z.array(z.record(z.string(), z.unknown())).optional()
|
|
26
|
+
}).strict();
|
|
27
|
+
export const stabilizer_cargo_state_schema = z.object({
|
|
28
|
+
envs: z.array(stabilizer_env_schema).min(1),
|
|
29
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
30
|
+
}).strict();
|
|
31
|
+
/**
|
|
32
|
+
* Validates waypoint consistency across all items in the primary env.
|
|
33
|
+
* @param cargo_state - Parsed cargo state.
|
|
34
|
+
*/
|
|
35
|
+
export function validate_primary_env_waypoints(cargo_state) {
|
|
36
|
+
const primary_env = cargo_state.envs[0];
|
|
37
|
+
const all_items = primary_env.containers.flatMap(container => container.items);
|
|
38
|
+
validate_waypoint_ids(all_items);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Adds waypoint validation issues to a Zod context.
|
|
42
|
+
* @param cargo_state - Cargo state being validated.
|
|
43
|
+
* @param context - Zod refinement context.
|
|
44
|
+
*/
|
|
45
|
+
export function add_waypoint_validation_issues(cargo_state, context) {
|
|
46
|
+
try {
|
|
47
|
+
validate_primary_env_waypoints(cargo_state);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error instanceof MixedWaypointIdError) {
|
|
51
|
+
context.addIssue({
|
|
52
|
+
code: 'custom',
|
|
53
|
+
message: error.message,
|
|
54
|
+
path: ['cargo_state', 'envs', 0]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const stabilizer_input_schema: z.ZodObject<{
|
|
3
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4
|
+
company: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
5
|
+
cargo_state: z.ZodObject<{
|
|
6
|
+
envs: z.ZodArray<z.ZodObject<{
|
|
7
|
+
containers: z.ZodArray<z.ZodObject<{
|
|
8
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
width: z.ZodNumber;
|
|
10
|
+
height: z.ZodNumber;
|
|
11
|
+
length: z.ZodNumber;
|
|
12
|
+
items: z.ZodArray<z.ZodObject<{
|
|
13
|
+
item_id: z.ZodString;
|
|
14
|
+
group_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
15
|
+
waypoint_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
x: z.ZodNumber;
|
|
17
|
+
y: z.ZodNumber;
|
|
18
|
+
z: z.ZodNumber;
|
|
19
|
+
width: z.ZodNumber;
|
|
20
|
+
height: z.ZodNumber;
|
|
21
|
+
depth: z.ZodNumber;
|
|
22
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, z.core.$strict>>;
|
|
24
|
+
}, z.core.$strict>>;
|
|
25
|
+
axles: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
26
|
+
}, z.core.$strict>>;
|
|
27
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
original_input: z.ZodOptional<z.ZodUnknown>;
|
|
30
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export type StabilizerInput = z.infer<typeof stabilizer_input_schema>;
|
|
33
|
+
//# sourceMappingURL=stabilizer_input_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stabilizer_input_schema.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/stabilizer_input_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBASlC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { add_waypoint_validation_issues, stabilizer_cargo_state_schema } from './stabilizer_domain_schema.js';
|
|
3
|
+
export const stabilizer_input_schema = z.object({
|
|
4
|
+
id: z.union([z.string(), z.number()]).optional(),
|
|
5
|
+
company: z.union([z.string(), z.number()]).optional(),
|
|
6
|
+
cargo_state: stabilizer_cargo_state_schema,
|
|
7
|
+
original_input: z.unknown().optional(),
|
|
8
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
9
|
+
}).strict().superRefine((input_data, context) => {
|
|
10
|
+
add_waypoint_validation_issues(input_data.cargo_state, context);
|
|
11
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const stabilizer_success_response_schema: z.ZodObject<{
|
|
3
|
+
status: z.ZodLiteral<"success">;
|
|
4
|
+
data: z.ZodObject<{
|
|
5
|
+
envs: z.ZodArray<z.ZodObject<{
|
|
6
|
+
containers: z.ZodArray<z.ZodObject<{
|
|
7
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
width: z.ZodNumber;
|
|
9
|
+
height: z.ZodNumber;
|
|
10
|
+
length: z.ZodNumber;
|
|
11
|
+
items: z.ZodArray<z.ZodObject<{
|
|
12
|
+
item_id: z.ZodString;
|
|
13
|
+
group_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
14
|
+
waypoint_id: z.ZodOptional<z.ZodString>;
|
|
15
|
+
x: z.ZodNumber;
|
|
16
|
+
y: z.ZodNumber;
|
|
17
|
+
z: z.ZodNumber;
|
|
18
|
+
width: z.ZodNumber;
|
|
19
|
+
height: z.ZodNumber;
|
|
20
|
+
depth: z.ZodNumber;
|
|
21
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
}, z.core.$strict>>;
|
|
24
|
+
axles: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
25
|
+
}, z.core.$strict>>;
|
|
26
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
messages: z.ZodArray<z.ZodString>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export declare const stabilizer_error_response_schema: z.ZodObject<{
|
|
31
|
+
status: z.ZodLiteral<"error">;
|
|
32
|
+
data: z.ZodString;
|
|
33
|
+
messages: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export declare const stabilizer_response_schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36
|
+
status: z.ZodLiteral<"success">;
|
|
37
|
+
data: z.ZodObject<{
|
|
38
|
+
envs: z.ZodArray<z.ZodObject<{
|
|
39
|
+
containers: z.ZodArray<z.ZodObject<{
|
|
40
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
width: z.ZodNumber;
|
|
42
|
+
height: z.ZodNumber;
|
|
43
|
+
length: z.ZodNumber;
|
|
44
|
+
items: z.ZodArray<z.ZodObject<{
|
|
45
|
+
item_id: z.ZodString;
|
|
46
|
+
group_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
47
|
+
waypoint_id: z.ZodOptional<z.ZodString>;
|
|
48
|
+
x: z.ZodNumber;
|
|
49
|
+
y: z.ZodNumber;
|
|
50
|
+
z: z.ZodNumber;
|
|
51
|
+
width: z.ZodNumber;
|
|
52
|
+
height: z.ZodNumber;
|
|
53
|
+
depth: z.ZodNumber;
|
|
54
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
axles: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
58
|
+
}, z.core.$strict>>;
|
|
59
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
messages: z.ZodArray<z.ZodString>;
|
|
62
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
63
|
+
status: z.ZodLiteral<"error">;
|
|
64
|
+
data: z.ZodString;
|
|
65
|
+
messages: z.ZodArray<z.ZodString>;
|
|
66
|
+
}, z.core.$strict>], "status">;
|
|
67
|
+
export type StabilizerSuccessResponse = z.infer<typeof stabilizer_success_response_schema>;
|
|
68
|
+
export type StabilizerErrorResponse = z.infer<typeof stabilizer_error_response_schema>;
|
|
69
|
+
export type StabilizerResponse = z.infer<typeof stabilizer_response_schema>;
|
|
70
|
+
//# sourceMappingURL=stabilizer_output_schema.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;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,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { stabilizer_cargo_state_schema } from './stabilizer_domain_schema.js';
|
|
3
|
+
export const stabilizer_success_response_schema = z.object({
|
|
4
|
+
status: z.literal('success'),
|
|
5
|
+
data: stabilizer_cargo_state_schema,
|
|
6
|
+
messages: z.array(z.string())
|
|
7
|
+
}).strict();
|
|
8
|
+
export const stabilizer_error_response_schema = z.object({
|
|
9
|
+
status: z.literal('error'),
|
|
10
|
+
data: z.string(),
|
|
11
|
+
messages: z.array(z.string())
|
|
12
|
+
}).strict();
|
|
13
|
+
export const stabilizer_response_schema = z.discriminatedUnion('status', [
|
|
14
|
+
stabilizer_success_response_schema,
|
|
15
|
+
stabilizer_error_response_schema
|
|
16
|
+
]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param value - Unknown value.
|
|
3
|
+
* @returns True when value is a plain object record.
|
|
4
|
+
*/
|
|
5
|
+
export declare function is_record(value: unknown): value is Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Renames object keys using a wire-to-contract map, preserving unmapped keys.
|
|
8
|
+
* @param source - Source record.
|
|
9
|
+
* @param key_map - Key rename map.
|
|
10
|
+
* @returns Record with renamed keys.
|
|
11
|
+
*/
|
|
12
|
+
export declare function rename_keys(source: Record<string, unknown>, key_map: Record<string, string>): Record<string, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Picks only allowed keys from a record.
|
|
15
|
+
* @param source - Source record.
|
|
16
|
+
* @param allowed_keys - Keys to retain.
|
|
17
|
+
* @returns Filtered record.
|
|
18
|
+
*/
|
|
19
|
+
export declare function pick_keys(source: Record<string, unknown>, allowed_keys: string[]): Record<string, unknown>;
|
|
20
|
+
//# sourceMappingURL=wire_mapper_record_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire_mapper_record_utils.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/contract/wire_mapper_record_utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAG1E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,YAAY,EAAE,MAAM,EAAE,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param value - Unknown value.
|
|
3
|
+
* @returns True when value is a plain object record.
|
|
4
|
+
*/
|
|
5
|
+
export function is_record(value) {
|
|
6
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renames object keys using a wire-to-contract map, preserving unmapped keys.
|
|
10
|
+
* @param source - Source record.
|
|
11
|
+
* @param key_map - Key rename map.
|
|
12
|
+
* @returns Record with renamed keys.
|
|
13
|
+
*/
|
|
14
|
+
export function rename_keys(source, key_map) {
|
|
15
|
+
const target = {};
|
|
16
|
+
for (const [key, value] of Object.entries(source)) {
|
|
17
|
+
const contract_key = key_map[key] ?? key;
|
|
18
|
+
target[contract_key] = value;
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Picks only allowed keys from a record.
|
|
24
|
+
* @param source - Source record.
|
|
25
|
+
* @param allowed_keys - Keys to retain.
|
|
26
|
+
* @returns Filtered record.
|
|
27
|
+
*/
|
|
28
|
+
export function pick_keys(source, allowed_keys) {
|
|
29
|
+
const picked = {};
|
|
30
|
+
for (const key of allowed_keys) {
|
|
31
|
+
if (source[key] !== undefined) {
|
|
32
|
+
picked[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return picked;
|
|
36
|
+
}
|
|
@@ -10,7 +10,10 @@ export declare const stabilizer_config_schema: z.ZodObject<{
|
|
|
10
10
|
genetic_mutation_rate: z.ZodDefault<z.ZodNumber>;
|
|
11
11
|
beam_width: z.ZodDefault<z.ZodNumber>;
|
|
12
12
|
beam_top_k: z.ZodDefault<z.ZodNumber>;
|
|
13
|
-
|
|
13
|
+
axle_load_margin_percent: z.ZodDefault<z.ZodNumber>;
|
|
14
|
+
preserve_tie_block_organization: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
+
enforce_milkrun_wall_reservation: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
+
number_of_wall_to_allocate_from_last_waypoints: z.ZodDefault<z.ZodNumber>;
|
|
14
17
|
}, z.core.$strip>;
|
|
15
18
|
export type StabilizerConfig = z.infer<typeof stabilizer_config_schema>;
|
|
16
19
|
//# 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;;;;;;;;;;;;;;;iBAanC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
|
@@ -9,5 +9,8 @@ export const stabilizer_config_schema = z.object({
|
|
|
9
9
|
genetic_mutation_rate: z.number().min(0).max(1).default(0.15),
|
|
10
10
|
beam_width: z.number().int().positive().default(5),
|
|
11
11
|
beam_top_k: z.number().int().positive().default(3),
|
|
12
|
-
|
|
12
|
+
axle_load_margin_percent: z.number().min(0).default(0),
|
|
13
|
+
preserve_tie_block_organization: z.boolean().default(true),
|
|
14
|
+
enforce_milkrun_wall_reservation: z.boolean().default(false),
|
|
15
|
+
number_of_wall_to_allocate_from_last_waypoints: z.number().int().min(0).default(0)
|
|
13
16
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerContainer, StabilizerItem } from '../validation/
|
|
1
|
+
import type { StabilizerContainer, StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
2
|
import type { WaypointMode, WaypointZone } from './WaypointMode.js';
|
|
3
3
|
/**
|
|
4
4
|
* Builds Z zones per waypoint per container from item extents.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_waypoint_zones.d.ts","sourceRoot":"","sources":["../../../src/core/waypoint/build_waypoint_zones.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"build_waypoint_zones.d.ts","sourceRoot":"","sources":["../../../src/core/waypoint/build_waypoint_zones.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGnE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,mBAAmB,EAAE,EACjC,IAAI,EAAE,YAAY,GACnB,YAAY,EAAE,CAmBhB;AAmCD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,CAGT"}
|
|
@@ -29,7 +29,7 @@ function group_items_by_waypoint(items, mode) {
|
|
|
29
29
|
return groups;
|
|
30
30
|
}
|
|
31
31
|
function build_zone(waypoint_id, container_index, items) {
|
|
32
|
-
const z_values = items.flatMap(item => [item.z, item.z + item.
|
|
32
|
+
const z_values = items.flatMap(item => [item.z, item.z + item.depth]);
|
|
33
33
|
return {
|
|
34
34
|
waypoint_id,
|
|
35
35
|
container_index,
|
|
@@ -44,5 +44,5 @@ function build_zone(waypoint_id, container_index, items) {
|
|
|
44
44
|
* @returns True when item fits inside zone on Z axis.
|
|
45
45
|
*/
|
|
46
46
|
export function is_position_in_zone(zone, item, position) {
|
|
47
|
-
return position.z >= zone.z_min && position.z + item.
|
|
47
|
+
return position.z >= zone.z_min && position.z + item.depth <= zone.z_max;
|
|
48
48
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { WaypointMode } from './WaypointMode.js';
|
|
3
|
+
import type { MilkrunPositionCheck, MilkrunReservedBand } from './milkrun_wall_reservation_types.js';
|
|
4
|
+
export type { MilkrunPositionCheck, MilkrunReservedBand } from './milkrun_wall_reservation_types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Builds reserved Z bands for the last N waypoints' compound walls per container.
|
|
7
|
+
* @param containers - Baseline container layout.
|
|
8
|
+
* @param mode - Waypoint mode.
|
|
9
|
+
* @param wall_count - Number of trailing waypoints to reserve.
|
|
10
|
+
* @returns Reserved Z bands (empty when wall_count is zero or single-waypoint mode).
|
|
11
|
+
*/
|
|
12
|
+
export declare function build_milkrun_reserved_z_bands(containers: StabilizerContainer[], mode: WaypointMode, wall_count: number): MilkrunReservedBand[];
|
|
13
|
+
/**
|
|
14
|
+
* @param request - Reserved bands and candidate placement.
|
|
15
|
+
* @returns True when candidate overlaps a reserved band.
|
|
16
|
+
*/
|
|
17
|
+
export declare function is_position_in_milkrun_reserved_band(request: MilkrunPositionCheck): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @param containers - Layout to validate.
|
|
20
|
+
* @param bands - Reserved milkrun Z bands.
|
|
21
|
+
* @returns True when no loose item overlaps a reserved band.
|
|
22
|
+
*/
|
|
23
|
+
export declare function is_layout_milkrun_valid(containers: StabilizerContainer[], bands: MilkrunReservedBand[]): boolean;
|
|
24
|
+
//# sourceMappingURL=milkrun_wall_reservation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"milkrun_wall_reservation.d.ts","sourceRoot":"","sources":["../../../src/core/waypoint/milkrun_wall_reservation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,oDAAoD,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAEpG,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAEpG;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC1C,UAAU,EAAE,mBAAmB,EAAE,EACjC,IAAI,EAAE,YAAY,EAClB,UAAU,EAAE,MAAM,GACnB,mBAAmB,EAAE,CAiBvB;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAS3F;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,mBAAmB,EAAE,EACjC,KAAK,EAAE,mBAAmB,EAAE,GAC7B,OAAO,CAUT"}
|