@lexstandard/lex
v1.0.0
Published
LEX (Lead Exchange Standard) — multi-industry lead exchange protocol
Maintainers
Readme
LEX JavaScript / TypeScript Library
LEX (Lead Exchange Standard) — JavaScript/Node.js library generated from the canonical Haxe implementation.
Installation
npm install @lexstandard/lexOr include the compiled file directly:
<script src="lex.js"></script>Quick Start — LexClient
import { LexClient } from './LexClient.js';
const client = new LexClient();
const result = client.parseJson(JSON.stringify({
lex: {
header: {
messageId: crypto.randomUUID(),
messageType: 'LEAD',
version: '1.0',
timestamp: new Date().toISOString(),
senderId: 'DEALER-001'
},
payload: {
lead: {
customer: { emailAddress: '[email protected]' },
desiredAsset: { assetClass: 'VEHICLE', productType: 'VEHICLE' }
}
}
}
}));
console.log(result.valid, result.errors);Quick Start — Fluent DSL Builder
import { lex } from './lex-builder.js';
const message = lex.lead()
.sender('DEALER-001')
.customer({ emailAddress: '[email protected]' })
.desiredAsset({ assetClass: 'VEHICLE', productType: 'VEHICLE', year: 2024 })
.build();
// message is a validated LEX envelope ready for transmissionFiles
| File | Description |
|------|-------------|
| lex.js | Compiled Haxe core (validation engine, parser) |
| lex.js.map | Source map for debugging |
| LexClient.js | High-level client wrapper |
| lex-builder.js | Fluent DSL builder API |
| lex.d.ts | TypeScript declarations |
| examples.js | Usage examples |
TypeScript
Full type declarations are bundled in lex.d.ts:
import type { LexLead, LexAsset, AssetClass, LeadSource } from './lex.d.ts';