SHOWN IN Node / JavaScript
import { pack } from '@packvium/engine';
const request = {
items: [
{ id: 'heavy', quantity: 1, weight: '650 kg',
dimensions: { length: '200', width: '200', height: '200' } },
{ id: 'light', quantity: 1, weight: '5 kg',
dimensions: { length: '200', width: '200', height: '200' } },
],
containers: [
{
id: 'trailer', cost_minor: 100, max_payload: '2000 kg',
inner_dimensions: { length: '2000', width: '200', height: '200' },
axles: [
{ position: '400', max_load: '300 kg' },
{ position: '1600', max_load: '300 kg' },
],
},
],
};
const result = pack(request);
console.log(result.status);
for (const unpacked of result.unpacked_items) console.log(unpacked.item_id, unpacked.reason);
console.log(result.containers[0]?.axle_reactions);
WHAT COMES BACK
The light item places; the 650 kg item cannot, at any position. Wherever it stands, the two axles share its whole weight, and two 300 kg limits add up to 600 kg - so one axle is always over, inside a trailer with 2000 kg of payload and most of its floor still empty. The refusal is about axle loads, not about running out of room.