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.
100 lines (96 loc) • 3.34 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/codelists/allowance.gen.ts
var allowance_gen_exports = {};
__export(allowance_gen_exports, {
ALLOWANCE: () => ALLOWANCE,
Allowance: () => Allowance,
PUBLISHED: () => PUBLISHED,
allowanceCode: () => allowanceCode
});
module.exports = __toCommonJS(allowance_gen_exports);
// 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/allowance.gen.ts
var PUBLISHED = /* @__PURE__ */ new Date("2019-03-11T23:00:00.000Z");
var ALLOWANCE = [
{
key: "BONUS_FOR_WORKS_AHEAD_OF_SCHEDULE",
name: "Bonus for works ahead of schedule",
value: "41"
},
{ key: "OTHER_BONUS", name: "Other bonus", value: "42" },
{
key: "MANUFACTURERS_CONSUMER_DISCOUNT",
name: "Manufacturer\u2019s consumer discount",
value: "60"
},
{
key: "DUE_TO_MILITARY_STATUS",
name: "Due to military status",
value: "62"
},
{ key: "DUE_TO_WORK_ACCIDENT", name: "Due to work accident", value: "63" },
{ key: "SPECIAL_AGREEMENT", name: "Special agreement", value: "64" },
{
key: "PRODUCTION_ERROR_DISCOUNT",
name: "Production error discount",
value: "65"
},
{ key: "NEW_OUTLET_DISCOUNT", name: "New outlet discount", value: "66" },
{ key: "SAMPLE_DISCOUNT", name: "Sample discount", value: "67" },
{ key: "END_OF_RANGE_DISCOUNT", name: "End-of-range discount", value: "68" },
{ key: "INCOTERM_DISCOUNT", name: "Incoterm discount", value: "70" },
{
key: "POINT_OF_SALES_THRESHOLD_ALLOWANCE",
name: "Point of sales threshold allowance",
value: "71"
},
{
key: "MATERIAL_SURCHARGEDEDUCTION",
name: "Material surcharge/deduction",
value: "88"
},
{ key: "DISCOUNT", name: "Discount", value: "95" },
{ key: "SPECIAL_REBATE", name: "Special rebate", value: "100" },
{ key: "FIXED_LONG_TERM", name: "Fixed long term", value: "102" },
{ key: "TEMPORARY", name: "Temporary", value: "103" },
{ key: "STANDARD", name: "Standard", value: "104" },
{ key: "YEARLY_TURNOVER", name: "Yearly turnover", value: "105" }
];
var allowanceCode = ALLOWANCE.map(({ value }) => value);
var Allowance = createEnum(ALLOWANCE, {
keyProp: "key",
valueProp: "value"
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ALLOWANCE,
Allowance,
PUBLISHED,
allowanceCode
});