node-zugferd
Version:
A Node.js library for creating ZUGFeRD/Factur-X compliant documents. Generating XML and embedding it into PDF/A files, enabling seamless e-invoicing and digital document compliance.
88 lines (86 loc) • 2.42 kB
JavaScript
// src/codelists/index.ts
var getByPath = (obj, path) => path.split(".").reduce((acc, key) => acc?.[key], obj);
var createEnum = (data, options) => {
return Object.fromEntries(
data.map((item) => [
getByPath(item, options.keyProp),
getByPath(item, options.valueProp)
])
);
};
// src/codelists/incoterms.gen.ts
var PUBLISHED = "Factur-X";
var INCOTERMS = [
{
key: "DELIVERY_ARRANGED_BY_SUPPLIER",
name: "Delivery arranged by supplier",
value: "1"
},
{
key: "DELIVERY_ARRANGED_BY_LOGISTIC_SERVICE_PROVIDER",
name: "Delivery arranged by logistic service provider",
value: "2"
},
{ key: "COST_AND_FREIGHT", name: "Cost and Freight", value: "CFR" },
{
key: "COST_INSURANCE_AND_FREIGHT",
name: "Cost, Insurance and Freight",
value: "CIF"
},
{
key: "CARRIAGE_AND_INSURANCE_PAID_TO_INSERT_NAMED_PLACE_OF_DESTINATION",
name: "Carriage and Insurance Paid to (insert named place of destination)",
value: "CIP"
},
{
key: "CARRIAGE_PAID_TO_INSERT_NAMED_PLACE_OF_DESTINATION",
name: "Carriage Paid To (insert named place of destination)",
value: "CPT"
},
{
key: "DELIVERED_AT_PLACE_INSERT_NAMED_PLACE_OF_DESTINATION",
name: "Delivered At Place (insert named place of destination)",
value: "DAP"
},
{
key: "DELIVERED_DUTY_PAID_INSERT_NAMED_PLACE_OF_DESTINATION",
name: "Delivered Duty Paid (insert named place of destination)",
value: "DDP"
},
{
key: "DELIVERED_AT_PLACE_UNLOADED_INSERT_NAMED_PLACE_OF_UNLOADING",
name: "Delivered At Place Unloaded (insert named place of unloading)",
value: "DPU"
},
{
key: "EX_WORKS_INSERT_NAMED_PLACE_OF_DELIVERY",
name: "Ex Works (insert named place of delivery)",
value: "EXW"
},
{
key: "FREE_ALONGSIDE_SHIP_INSERT_NAMED_PORT_OF_SHIPMENT",
name: "Free Alongside Ship (insert named port of shipment)",
value: "FAS"
},
{
key: "FREE_CARRIER_INSERT_NAMED_PLACE_OF_DELIVERY",
name: "Free Carrier (insert named place of delivery)",
value: "FCA"
},
{
key: "FREE_ON_BOARD_INSERT_NAMED_PORT_OF_SHIPMENT",
name: "Free On Board (insert named port of shipment)",
value: "FOB"
}
];
var incotermsCode = INCOTERMS.map(({ value }) => value);
var Incoterms = createEnum(INCOTERMS, {
keyProp: "key",
valueProp: "value"
});
export {
INCOTERMS,
Incoterms,
PUBLISHED,
incotermsCode
};