anx-esop-engine
v1.0.53
Published
ESOP Engine, providing BPMN components for React Flow conversion and rendering capabilities.
Maintainers
Readme
anx-esop-engine
ESOP Engine, providing BPMN components for React Flow conversion and rendering capabilities.
Installation
NPM (Recommended)
npm install anx-esop-engineCDN (Browser)
<script src="https://cdn.example.com/anx-esop-engine.js"></script>
<script>
const { BpmnImporter, BpmnExporter } = window.AnxEsopEngine;
</script>See CDN-SETUP.md for detailed CDN configuration and deployment.
Usage
import {
BpmnImporter,
BpmnExporter,
BpmnValidator,
type DomainWorkflow,
} from 'anx-esop-engine';
const workflow: DomainWorkflow = await BpmnImporter.importXml(xmlString);
const validation = BpmnValidator.validateWorkflow(workflow.nodes, workflow.edges);
const exportedXml = await BpmnExporter.exportToXml(workflow);Utils (Classes)
BpmnImporter- Import BPMN XML filesimportXml(xml: string): Promise<DomainWorkflow>
BpmnExporter- Export workflow to BPMN XMLexportToXml(workflow: DomainWorkflow): Promise<string>
BpmnLayout- Auto-layout utilitiesapplyAutoLayout(nodes, edges, direction?)
BpmnValidator- Validation & connection rulesvalidateWorkflow(nodes, edges)canConnect(source, target, connectionType)
REPLACE_OPTIONS- Node replacement options
Components
BpmnModeler- Main BPMN editor component (with palette, properties panel)BpmnNode- Custom React Flow node rendererBpmnEdge- Custom React Flow edge rendererBpmnPalette- Toolbar for adding elementsBpmnPropertiesPanel- Element properties editorBpmnContextPad- Context menu for quick actionsBpmnQuickAppend- Quick append helper componentBPMN_ICON_PATHS- SVG icon paths for BPMN shapes
Types
DomainWorkflow- Workflow modelDomainNode- Node in workflowDomainEdge- Connection between nodesDomainPool- Pool containerDomainLane- Lane in poolBpmnState- Global state from Zustand storeValidationError- Validation error detailsReplaceOption- Node replacement optionBpmnQuickAppendProps- Props for BpmnQuickAppend component
Store
useBpmnStore- Zustand store for BPMN state- Manages workflow, selection, clipboard, undo/redo
Publish Checklist
- Update package name/version in package.json.
- Ensure repository URL points to your GitHub repo.
- Login with
npm login. - Run
npm run publish:dryto verify. - Run
npm run publish:ps1to publish.
PowerShell Publish Script
The project includes scripts/publish.ps1 with these options:
-DryRun: publish dry-run-Tag <tag>: publish tag, defaultlatest-Access <public|restricted>: npm access, defaultpublic-Otp <code>: OTP for 2FA publish-SkipChecks: skipnpm whoami, build, and pack checks
Examples:
# Dry run with checks
powershell -ExecutionPolicy Bypass -File .\scripts\publish.ps1 -DryRun
# Real publish
powershell -ExecutionPolicy Bypass -File .\scripts\publish.ps1
# Publish with beta tag
powershell -ExecutionPolicy Bypass -File .\scripts\publish.ps1 -Tag betaPublishing to CDN
The library supports UMD builds for CDN distribution. All dependencies are bundled for browser use.
Build for CDN
# Creates dist/cdn/ with all CDN-ready files
npm run build:cdnOutput files:
anx-esop-engine.js(811.56 KB) - Latest versionanx-esop-engine-1.0.0.js- Versioned immutable buildanx-esop-engine.js.map- Source map for debuggingindex.html- Demo pagepackage-info.json- Metadata
CDN Deployment Options
Option 1: AWS S3 (Recommended)
# One-time setup
aws configure
# Set environment variable
$env:CDN_BUCKET = "my-bucket"
$env:AWS_REGION = "us-east-1"
# Upload to CDN
npm run cdn:uploadOption 2: jsDelivr (Automatic)
Automatically available after publishing to npm:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.js"></script>Option 3: Manual Upload
# Build CDN files
npm run build:cdn
# Upload dist/cdn/ contents to your CDN providerHTML Usage
<!DOCTYPE html>
<html>
<head>
<title>BPMN Viewer</title>
</head>
<body>
<div id="canvas" style="width: 100%; height: 100vh;"></div>
<!-- Include from CDN -->
<script src="https://cdn.example.com/anx-esop-engine.js"></script>
<script>
const { BpmnImporter, BpmnExporter } = window.AnxEsopEngine;
// Use library
const workflow = BpmnImporter.fromXML(xmlString);
console.log('Nodes:', workflow.nodes);
</script>
</body>
</html>Global API
Available as window.AnxEsopEngine:
{
// Utilities
BpmnImporter, BpmnExporter, BpmnLayout, BpmnValidator, REPLACE_OPTIONS,
// Components
BpmnModeler, BpmnNode, BpmnEdge, BpmnPalette, BpmnPropertiesPanel,
BpmnContextPad, BpmnQuickAppend, BPMN_ICON_PATHS,
// Store
useBpmnStore,
// Types & Constants
... (all TypeScript types and exports)
}For detailed CDN setup and troubleshooting, see CDN-SETUP.md and docs/CDN-DEPLOYMENT.md.
