Roadblock: an order webhook has an array of items but your invoicing app takes them one at a time. Transform the whole array in one step instead of five modules.
const order = JSON.parse(input.order);
const lines = order.items.map((item) => ({
sku: item.sku,
description: item.name,
qty: item.quantity,
total: (item.quantity * item.unit_price).toFixed(2),
}));
return { lines };