npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ediflow/core

v0.2.1

Published

Modern EDIFACT Parser, Validator & Builder - Core Library

Downloads

637

Readme

@ediflow/core

Modern EDIFACT Parser, Validator & Builder - Core Library

NPM Version License: MIT TypeScript Downloads

Clean ArchitectureType-SafeZero ConfigBattle-Tested


🆕 What's New in v0.2.0

🔥 Major Architecture Refactoring - Complete Clean Architecture enforcement!

Key Changes:

  • New modular structure - Better tree-shaking, smaller bundles
  • New packages - @ediflow/edifact, @ediflow/infrastructure-shared, @ediflow/cli
  • Pure domain layer - No infrastructure code in core anymore
  • 🇺🇸 X12 foundation - USA market support coming in v0.3.0

⚠️ Migrating from v0.1.x? Zero code changes needed! Just upgrade:

npm install @ediflow/[email protected] @ediflow/[email protected]

📝 See full changelog →


📦 What is @ediflow/core?

@ediflow/core is the core engine for EDIFlow - a modern EDIFACT library built with Clean Architecture principles.

This package provides:

  • Parser - EDIFACT string → EDIMessage
  • Validator - 3-phase validation (Syntax → Structure → Business)
  • Builder - EDIMessage → EDIFACT string
  • Mapper - Auto-convert to/from business objects
  • Envelope Generator - UNH/UNT/UNB/UNZ support
  • CLI - Command-line tools
  • TypeScript - Full type safety

What this package does NOT include:

  • ❌ EDIFACT standard definitions (install separately)

🚀 Installation

# Install core library
npm install @ediflow/core

# Install EDIFACT standard(s) - REQUIRED for validation
npm install @ediflow/edifact-d20b   # Latest (recommended)
# OR
npm install @ediflow/edifact-d12a   # Full coverage (196 messages)
# OR
npm install @ediflow/edifact-d01b   # Legacy systems
npm install @ediflow/edifact-d96a   # Classic

📖 Quick Start

Parse EDIFACT Message

import { DIContainer } from '@ediflow/core';

const container = DIContainer.getInstance();
const parseUseCase = container.resolve('ParseEDIUseCase');

const result = parseUseCase.execute({
  message: edifactString,
  standard: 'EDIFACT'
});

if (result.success) {
  console.log('✅ Parsed!', result.message);
}

Validate Message

const validateUseCase = container.resolve('ValidateMessageUseCase');

const validation = validateUseCase.execute({
  message: result.message,
  messageType: 'ORDERS',
  version: 'D20B',
  repositoryPath: './node_modules/@ediflow/edifact-d20b/data'
});

if (validation.success) {
  console.log('✅ Valid!');
}

Build EDIFACT Message

import { EDIMessage, EDISegment, EDIElement } from '@ediflow/core';

const message = new EDIMessage({
  standard: 'EDIFACT',
  version: 'D20B',
  messageType: 'ORDERS',
  segments: [
    new EDISegment({
      tag: 'BGM',
      elements: [
        new EDIElement({ value: '220' }),
        new EDIElement({ value: 'PO12345' })
      ]
    })
  ]
});

const buildUseCase = container.resolve('BuildEDIUseCase');
const ediString = buildUseCase.execute({
  message,
  standard: 'EDIFACT'
});

console.log(ediString); // BGM+220+PO12345'

🎯 Features

Core Features

  • Parse - EDIFACT → EDIMessage (with envelope support)
  • Validate - 3-phase validation (Syntax, Structure, Business)
  • Build - EDIMessage → EDIFACT (with envelope generation)
  • Map - Business Objects ↔ EDIMessage
  • CLI - Command-line interface

Clean Architecture

  • Domain Layer - Pure business logic (zero dependencies)
  • Application Layer - Use Cases (ParseEDI, ValidateMessage, BuildEDI)
  • Infrastructure Layer - Parsers, Repositories
  • Presentation Layer - CLI, Future: REST API

TypeScript Support

  • Full TypeScript definitions
  • Advanced type inference
  • IntelliSense support
  • Strict type checking

Zero Config

  • Works out of the box
  • Sensible defaults
  • Easy to customize

📦 Related Packages

EDIFACT Standards (choose what you need):


🏗️ Architecture

┌─────────────────────────────────────┐
│      Presentation Layer             │  CLI
└──────────────┬──────────────────────┘
               │
┌──────────────▼──────────────────────┐
│      Application Layer              │  Use Cases
│  • ParseEDIUseCase                  │
│  • ValidateMessageUseCase           │
│  • BuildEDIUseCase                  │
└──────────────┬──────────────────────┘
               │
┌──────────────▼──────────────────────┐
│      Domain Layer                   │  Entities
│  • EDIMessage                       │
│  • EDISegment                       │
│  • EDIElement                       │
└──────────────┬──────────────────────┘
               │
┌──────────────▼──────────────────────┐
│      Infrastructure Layer           │  Parsers
│  • EdifactMessageParser             │
│  • FileBasedRepository              │
└─────────────────────────────────────┘

Read more: Architecture Documentation


📚 Documentation


🧪 Testing

Extensively tested with TDD:

  • 590 tests passing
  • Unit tests - Domain & Application layers
  • Integration tests - Cross-layer interactions
  • E2E tests - Complete roundtrip validation
npm test
npm run test:watch
npm run test:coverage

🤝 Contributing

We welcome contributions! See:


📄 License

MIT License - see LICENSE


🔗 Links


Made with ❤️ for the EDI community