@miragon/event-storming-dsl 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/index.cjs +682 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +664 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @miragon/event-storming-dsl
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@miragon/event-storming-dsl)
|
|
4
|
+
[](https://github.com/Miragon/event-storming-modeler/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
DOM-free bridge between the Event Storming `.storm` text DSL and the `EventStormingBoard`
|
|
7
|
+
model — a lossless round-trip.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @miragon/event-storming-dsl
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { parseDSL, serializeDSL } from '@miragon/event-storming-dsl';
|
|
19
|
+
|
|
20
|
+
const board = parseDSL(`title Order Checkout
|
|
21
|
+
actor Customer [80, 300]
|
|
22
|
+
command Place Order [240, 300]
|
|
23
|
+
event Order Placed [620, 300]
|
|
24
|
+
Customer -> Place Order`);
|
|
25
|
+
|
|
26
|
+
const text = serializeDSL(board); // back to .storm text, losslessly
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## The `.storm` format
|
|
30
|
+
|
|
31
|
+
One statement per line. Coordinates are `[x, y]` in board pixels (x first), optional
|
|
32
|
+
(default `[0, 0]`), unbounded — the canvas is free.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
title Order Checkout // config; also: style classic|dark
|
|
36
|
+
event Order Placed [620, 300]
|
|
37
|
+
command Place Order [240, 300] (color #ff0000) // optional color override
|
|
38
|
+
actor Customer [80, 300]
|
|
39
|
+
aggregate Order [420, 290]
|
|
40
|
+
policy When order placed, ship it [800, 300]
|
|
41
|
+
readmodel Order Status [620, 120]
|
|
42
|
+
external Payment Provider [420, 520]
|
|
43
|
+
hotspot Double payment on retry? [620, 520]
|
|
44
|
+
note Big-picture session [80, 80]
|
|
45
|
+
line [[100,100],[200,150],[180,240]] (dashed) // freeform drawing
|
|
46
|
+
|
|
47
|
+
// arrows: name-referenced, optional label after ;
|
|
48
|
+
Customer -> Place Order
|
|
49
|
+
Order Placed -> When order placed, ship it; async
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Unknown lines and comments are kept losslessly in `rawPassthrough`;
|
|
53
|
+
`parseDSLWithDiagnostics` reports uninterpretable lines with 1-based line numbers instead of
|
|
54
|
+
throwing.
|
|
55
|
+
|
|
56
|
+
Part of the [Event Storming Modeler](https://github.com/Miragon/event-storming-modeler) monorepo.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|