@ediflow/infrastructure-shared
v0.2.1
Published
Shared infrastructure utilities for EDIFlow packages (EDIFACT, X12)
Downloads
221
Maintainers
Readme
@ediflow/infrastructure-shared
Shared infrastructure utilities for EDIFlow packages (EDIFACT, X12)
🆕 NEW in v0.2.0!
This package is brand new in v0.2.0! It contains reusable infrastructure components shared across all EDI format packages.
Why this matters:
- ✅ DRY Principle - No code duplication between EDIFACT/X12
- ✅ Single source of truth - Bug fix once, benefits all formats
- ✅ Consistency - Same repository/cache logic everywhere
📦 What's This Package?
This package provides shared infrastructure components used by multiple EDIFlow format packages (EDIFACT, X12).
import {
LRUCacheManager,
FileBasedMessageStructureRepository,
CachedDefinitionLoader
} from '@ediflow/infrastructure-shared';
// EDIFACT Package uses these
// X12 Package uses these
// No code duplication!🎯 Why a Separate Package?
DRY Principle: Don't Repeat Yourself
- EDIFACT and X12 both need cache, repositories, loaders
- Instead of duplicating code, share it!
- Bug fix in one place → benefits all packages
📋 What's Included?
Cache Implementations
LRUCacheManager- LRU cache for fast lookups
Repositories
FileBasedMessageStructureRepository- Loads definitions from JSON filesInMemoryMessageStructureRepository- For testing
Loaders
CachedDefinitionLoader- Loads definitions with caching
🚀 Usage
// EDIFACT Package
import { LRUCacheManager, FileBasedMessageStructureRepository, CachedDefinitionLoader } from '@ediflow/infrastructure-shared';
const repo = new FileBasedMessageStructureRepository('./data/edifact');
const loader = new CachedDefinitionLoader(repoManager, 100); // LRU cache size 100📝 License
MIT
