@hochfrequenz/efoli
v0.0.8
Published
enums for edifact formats and format versions used by German utilities
Readme
E-Foli.ts
@hochfrequenz/efoli is a TypeScript package that contains
- an enum
EdifactFormatthat models EDIFACT formats used by German utilities, e.g.UTILMDMSCONSINVOIC- …
- an enum
EdifactFormatVersionthat models validity periods of different message versions, e.g.FV2310is valid from 2023-10-01 onwardsFV2404is valid from 2024-04-03 onwards- …
- helper functions that allow
- deriving the
EdifactFormatfrom a given Prüfidentifikator (e.g.55001➡UTILMDS) - deriving the
EdifactFormatVersionfrom a given date (e.g.2024-01-01➡FV2310)
- deriving the
It's not much, but we need it at many places. This is why we use this package as a central place to define these formats and versions.
This is the TypeScript port of the Python package efoli.
Installation
npm install @hochfrequenz/efoliUsage
import {
EdifactFormat,
EdifactFormatVersion,
getFormatOfPruefidentifikator,
getEdifactFormatVersion,
getCurrentEdifactFormatVersion,
} from "@hochfrequenz/efoli";
// Derive the EDIFACT format from a Prüfidentifikator
const format: EdifactFormat = getFormatOfPruefidentifikator("55001"); // EdifactFormat.UTILMDS
// Derive the format version for a specific date (UTC timestamp)
const version: EdifactFormatVersion = getEdifactFormatVersion(new Date("2024-01-01T00:00:00Z")); // EdifactFormatVersion.FV2310
// Or pass a plain calendar date (interpreted as midnight Europe/Berlin — preferred for date-only inputs)
const version2: EdifactFormatVersion = getEdifactFormatVersion({ year: 2025, month: 6, day: 6 }); // EdifactFormatVersion.FV2504
// Get the currently active format version
const current: EdifactFormatVersion = getCurrentEdifactFormatVersion();Setup for Local Development
npm install
npm test # run unit tests
npm run typecheck # type check
npm run lint # lint
npm run build # build CJS + ESM output to dist/Contribute
You are very welcome to contribute to this repository by opening a pull request against the main branch.
