@formicoidea/labre-framework-bpmn 0.32.0 → 0.34.1

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.
Files changed (49) hide show
  1. package/dist/actions.d.ts +202 -6
  2. package/dist/actions.js +427 -43
  3. package/dist/background.d.ts +2 -0
  4. package/dist/background.js +158 -0
  5. package/dist/commands-manifest.d.ts +18 -0
  6. package/dist/commands-manifest.js +226 -0
  7. package/dist/commands.js +496 -5
  8. package/dist/consts.d.ts +195 -4
  9. package/dist/consts.js +230 -4
  10. package/dist/element-renderer.d.ts +10 -4
  11. package/dist/element-renderer.js +14 -55
  12. package/dist/element-view.d.ts +119 -8
  13. package/dist/element-view.js +274 -30
  14. package/dist/export.d.ts +277 -0
  15. package/dist/export.js +1802 -0
  16. package/dist/facts.d.ts +48 -0
  17. package/dist/facts.js +127 -0
  18. package/dist/import.d.ts +69 -0
  19. package/dist/import.js +1476 -0
  20. package/dist/index.d.ts +12 -0
  21. package/dist/index.js +47 -0
  22. package/dist/interchange.d.ts +109 -0
  23. package/dist/interchange.js +191 -0
  24. package/dist/morph.d.ts +61 -0
  25. package/dist/morph.js +118 -0
  26. package/dist/node/node-renderer.d.ts +0 -9
  27. package/dist/node/node-renderer.js +294 -17
  28. package/dist/pool-hit.d.ts +98 -0
  29. package/dist/pool-hit.js +130 -0
  30. package/dist/presets.d.ts +168 -0
  31. package/dist/presets.js +327 -0
  32. package/dist/profiles.d.ts +2 -0
  33. package/dist/profiles.js +189 -0
  34. package/dist/roles.d.ts +96 -0
  35. package/dist/roles.js +410 -0
  36. package/dist/rules.d.ts +199 -0
  37. package/dist/rules.js +1539 -0
  38. package/dist/templates/index.js +116 -9
  39. package/dist/toolbar/bpmn-senior-button.js +8 -2
  40. package/dist/toolbar/config.d.ts +28 -2
  41. package/dist/toolbar/config.js +93 -4
  42. package/dist/toolbar/icons.d.ts +67 -0
  43. package/dist/toolbar/icons.js +141 -0
  44. package/dist/toolbar/senior-tool.js +1 -0
  45. package/dist/translations.d.ts +3 -1
  46. package/dist/translations.js +38 -3
  47. package/dist/view.d.ts +6 -2
  48. package/dist/view.js +68 -5
  49. package/package.json +6 -2
@@ -0,0 +1,189 @@
1
+ /**
2
+ * BPMN validation profiles (backlog item B6 — not the rule of that number; see
3
+ * the numbering note in `rules.ts`).
4
+ *
5
+ * DATA owned by the framework, like its rules and its roles. A profile is chosen
6
+ * per POOL — the framework's root instance — and the choice rides on the pool
7
+ * element itself, so two participants at two levels of requirement coexist on one
8
+ * canvas: the pool somebody is still sketching stays a sketch while the one
9
+ * that is being handed over is held to the norm.
10
+ *
11
+ * Registered from the flag-gated `BpmnViewExtension`, beside the rules:
12
+ * switching the `bpmn` flag off takes the choice away with the rest of the
13
+ * tooling, and a pool already set to `descriptive` simply stops being checked
14
+ * until it comes back — the id stays written, untouched.
15
+ *
16
+ * ## Two today, and the two that are future DATA
17
+ *
18
+ * BPMN 2.0 defines three conformance sub-classes, each a superset of the last:
19
+ * DESCRIPTIVE (the visual subset a business reader can follow — the one this
20
+ * pack draws), ANALYTIC (every event type, every gateway, the full flow
21
+ * semantics) and COMMON EXECUTABLE (what an engine can run: data mappings,
22
+ * expressions, message correlation). Only the first is meaningful against the
23
+ * twenty-two rules that exist, because the other two are levels of requirement
24
+ * about artefacts this pack does not yet draw.
25
+ *
26
+ * They arrive as PROFILES and not as engine work when they arrive: a level of
27
+ * requirement is a table of severities per rule id, so `bpmn.analytic` is an
28
+ * entry in the array at the bottom of this file plus whatever new rules the new
29
+ * artefacts bring. Nothing in the pipework has to learn a third word.
30
+ *
31
+ * ## Both tables spell out all TWENTY-TWO ids
32
+ *
33
+ * Every severity a user can get is either the one its rule declares or one of
34
+ * these lines — nothing is raised implicitly (PF9.4). Spelling them all out is
35
+ * also what let eight of these rules wait a review cycle for the engine fields
36
+ * they needed and then arrive already governed, rather than arriving and
37
+ * quietly keeping their own severity at a level nobody had chosen.
38
+ */
39
+ /**
40
+ * Sketch: every rule demoted to `audit`. Findings still reach `violations$` —
41
+ * a host panel and a conformance report see them — and the canvas says nothing.
42
+ *
43
+ * The DEFAULT, and deliberately so (PRD principle 3). A process is drawn in a
44
+ * workshop, at speed, with the steps going down before anybody decides where the
45
+ * pools are: for the first minutes of that, EVERY task is a dead end, no pool has
46
+ * a start event, and half the links are still plain connectors somebody
47
+ * quick-dragged. A tool arguing with that hand is a tool switched off within the
48
+ * hour, and it would be arguing about a diagram the author already knows is
49
+ * unfinished.
50
+ *
51
+ * The sketch PRIMES: the findings are computed, collected and available the
52
+ * moment the author asks — through the panel, through a check-up, through the
53
+ * profile switch — so nothing has to be re-derived when they decide the drawing
54
+ * is a deliverable. Being the default also means it WRITES NOTHING: a pool on
55
+ * `sketch` carries no profile key, so every process ever drawn is on it, with no
56
+ * migration and no backfill.
57
+ */
58
+ const sketch = {
59
+ id: 'bpmn.sketch',
60
+ framework: 'bpmn',
61
+ labelKey: 'com.labre.bpmn.profile.sketch',
62
+ fallback: 'Sketch',
63
+ isDefault: true,
64
+ rules: {
65
+ 'bpmn.sequence-flow-endpoints': 'audit',
66
+ 'bpmn.sequence-flow-self-loop': 'audit',
67
+ 'bpmn.message-flow-endpoints': 'audit',
68
+ 'bpmn.association-endpoints': 'audit',
69
+ 'bpmn.untyped-flow': 'audit',
70
+ 'bpmn.duplicate-sequence-flow': 'audit',
71
+ 'bpmn.start-event-no-inflow': 'audit',
72
+ 'bpmn.start-event-must-exit': 'audit',
73
+ 'bpmn.end-event-no-outflow': 'audit',
74
+ 'bpmn.end-event-must-be-reached': 'audit',
75
+ 'bpmn.activity-dead-end': 'audit',
76
+ 'bpmn.sequence-flow-stays-home': 'audit',
77
+ 'bpmn.message-flow-crosses-pools': 'audit',
78
+ 'bpmn.unreachable-step': 'audit',
79
+ 'bpmn.pool-end-without-start': 'audit',
80
+ 'bpmn.pool-start-without-end': 'audit',
81
+ 'bpmn.single-blank-start': 'audit',
82
+ 'bpmn.gateway-must-branch': 'audit',
83
+ 'bpmn.gateway-join-and-fork': 'audit',
84
+ 'bpmn.fake-join': 'audit',
85
+ 'bpmn.implicit-split': 'audit',
86
+ 'bpmn.unlabeled-step': 'audit',
87
+ },
88
+ };
89
+ /**
90
+ * Descriptive: the BPMN 2.0 DESCRIPTIVE conformance posture — a diagram a
91
+ * business reader can be handed and will read correctly.
92
+ *
93
+ * Every rule at the severity its own declaration carries, spelled out rather
94
+ * than left absent, so the answer is readable in one place. That is the point of
95
+ * a profile table: a reviewer asking "what does this level actually require"
96
+ * reads twenty-two lines instead of twenty-two files, and a rule added later
97
+ * cannot join
98
+ * a level silently — it arrives with its own severity until somebody writes it
99
+ * down here.
100
+ *
101
+ * ## Nothing is `blocking-overridable`, and one line each is what changes that
102
+ *
103
+ * Nothing in this library implements refusal — no gesture is declined anywhere —
104
+ * so declaring the level would be data claiming an effect that does not exist
105
+ * (the `wardley/rules.ts:30` promise, kept). FOUR rules would sit there the day
106
+ * a gesture refusal lands, and each moves in one line, here:
107
+ *
108
+ * - `bpmn.start-event-no-inflow` and `bpmn.end-event-no-outflow` (p.244 / p.248)
109
+ * — both say the process runs backwards, and neither has a reading in which
110
+ * the author is right;
111
+ * - `bpmn.pool-end-without-start` and `bpmn.pool-start-without-end` — verbatim
112
+ * normative MUSTs, guard included: "If there is an End Event, then there MUST
113
+ * be at least one Start Event" (p.238) and its mirror (p.246). The pack argued
114
+ * the pairing into existence before somebody read the pages; the specification
115
+ * simply states it.
116
+ *
117
+ * ## The five that do not move
118
+ *
119
+ * `bpmn.activity-dead-end`, `bpmn.fake-join`, `bpmn.implicit-split`,
120
+ * `bpmn.single-blank-start` and `bpmn.unlabeled-step` stay `audit` HERE TOO, and
121
+ * they are the reason a profile spells everything out.
122
+ *
123
+ * The first three report shapes the specification explicitly SANCTIONS: an
124
+ * activity with no outgoing sequence flow is a way to end a path (BPMN 2.0.2,
125
+ * p.151), and an activity with several incoming or several outgoing flows has
126
+ * defined token semantics on the same page. A warning would be the tool arguing
127
+ * with a house style the standard allows. They stay in the pack because on a
128
+ * diagram meant to be READ each of them is a question the drawing no longer asks
129
+ * out loud — which is a remark for the conformance panel, at every level of
130
+ * requirement. Every one of them is quieter than bpmnlint's own level for the
131
+ * same shape, deliberately.
132
+ *
133
+ * The last two report a diagram that is UNFINISHED rather than wrong — two
134
+ * indistinguishable blank starts, a step nobody has named — and "not done" is
135
+ * what a panel is for.
136
+ *
137
+ * The exact `context-map.acl-on-customer-supplier` shape, one layer over: a
138
+ * judgement the diagram cannot make on the author's behalf, so it is collected
139
+ * and never interrupts.
140
+ *
141
+ * ## Which line is which, now that a rule says so itself
142
+ *
143
+ * Every rule declares {@link ValidationRule.provenance}, so the question this
144
+ * table used to answer only in prose — is this a conformance defect or a
145
+ * suggestion — is readable off the rule. Twelve of them read a normative
146
+ * sentence of the standard, and those are not judgement calls: a message flow
147
+ * inside one pool is a sentence BPMN does not have. The other ten are a linter's
148
+ * rule, a reading nudge, or our own house style, and the bubble now says which
149
+ * before the user decides how much to care.
150
+ */
151
+ const descriptive = {
152
+ id: 'bpmn.descriptive',
153
+ framework: 'bpmn',
154
+ labelKey: 'com.labre.bpmn.profile.descriptive',
155
+ fallback: 'Descriptive',
156
+ rules: {
157
+ 'bpmn.sequence-flow-endpoints': 'warning',
158
+ // A LABRE convention (see B1a), and the one line of this table where that
159
+ // is worth knowing: an organisation that does not share the house style
160
+ // switches it off here without touching p.95, which is the whole point of
161
+ // having split it out of the endpoints rule.
162
+ 'bpmn.sequence-flow-self-loop': 'warning',
163
+ 'bpmn.message-flow-endpoints': 'warning',
164
+ 'bpmn.association-endpoints': 'warning',
165
+ 'bpmn.untyped-flow': 'warning',
166
+ 'bpmn.duplicate-sequence-flow': 'warning',
167
+ 'bpmn.start-event-no-inflow': 'warning',
168
+ 'bpmn.start-event-must-exit': 'warning',
169
+ 'bpmn.end-event-no-outflow': 'warning',
170
+ 'bpmn.end-event-must-be-reached': 'warning',
171
+ // The five that do not move — see the header.
172
+ 'bpmn.activity-dead-end': 'audit',
173
+ 'bpmn.sequence-flow-stays-home': 'warning',
174
+ 'bpmn.message-flow-crosses-pools': 'warning',
175
+ 'bpmn.unreachable-step': 'warning',
176
+ 'bpmn.pool-end-without-start': 'warning',
177
+ 'bpmn.pool-start-without-end': 'warning',
178
+ 'bpmn.single-blank-start': 'audit',
179
+ 'bpmn.gateway-must-branch': 'warning',
180
+ 'bpmn.gateway-join-and-fork': 'warning',
181
+ 'bpmn.fake-join': 'audit',
182
+ 'bpmn.implicit-split': 'audit',
183
+ 'bpmn.unlabeled-step': 'audit',
184
+ },
185
+ };
186
+ export const BPMN_PROFILES = [
187
+ sketch,
188
+ descriptive,
189
+ ];
@@ -0,0 +1,96 @@
1
+ import type { BpmnNodeKind } from '@formicoidea/labre-core/model';
2
+ import type { RoleDefs, RoleId } from '@formicoidea/labre-core/std/gfx';
3
+ /**
4
+ * BPMN role vocabulary (B1).
5
+ *
6
+ * A role is the semantic identity of a BPMN artefact — no rule will ever look at
7
+ * a shape type, and none ever could here: the whole notation is drawn with three
8
+ * native shapes, and an ellipse is a start event, an end event or somebody's
9
+ * doodle depending entirely on what the author meant. The `kind` discriminant
10
+ * the pack already carries answers a different question (which glyph to paint);
11
+ * the role answers what the glyph MEANS.
12
+ *
13
+ * Hierarchy is DATA (`parent`), never TS inheritance: `bpmn:start-event` and
14
+ * `bpmn:end-event` specialise `bpmn:event`, so a rule written on the parent
15
+ * applies to both for free (see `roleIsA`). The three families were declared
16
+ * while the lean pack still shipped one or two children each, precisely so that
17
+ * the descriptive profile could land underneath them without a reshuffle — and
18
+ * that is what happened: the message and timer starts, the message and terminate
19
+ * ends, the user and service tasks, the sub-process, the call activity and the
20
+ * parallel gateway all arrived as LEAVES, and everything already written about
21
+ * "an event" or "an activity" stayed written.
22
+ *
23
+ * The tree is FOUR levels deep on two branches — `bpmn:message-start-event` is a
24
+ * `bpmn:start-event` is a `bpmn:event` is a `bpmn:flow-object`, and
25
+ * `bpmn:user-task` is a `bpmn:task` is a `bpmn:activity` is a
26
+ * `bpmn:flow-object` — which `roleIsA` walks for free.
27
+ *
28
+ * `bpmn:flow-object` arrived with the rules, for the reason its own block gives:
29
+ * a sequence flow chains flow objects and a step must be reachable from the
30
+ * start, and both sentences are about events, activities and gateways at once.
31
+ * It is the one word BPMN itself uses, so the rules say it once instead of
32
+ * enumerating three families and forgetting the fourth.
33
+ *
34
+ * The **pool** is parent-less on purpose, the same call `wardley:map` makes: it
35
+ * is the FRAME the flow objects are drawn in, and a rule written on the artefacts
36
+ * must never fall on the lane they sit in — nor, therefore, under
37
+ * `bpmn:flow-object`. `bpmn:data` is a family of its own for
38
+ * the same reason inverted: a data object is not a flow object, it is never
39
+ * executed, and a rule about the WORK must not fall on the paperwork. And the
40
+ * two artifacts — `bpmn:text-annotation` and `bpmn:group` — are parent-less AND
41
+ * childless, because they are what the author drew ON the picture rather than
42
+ * IN it: a note and a lasso, neither of which says anything the process does.
43
+ * The group's isolation is the spec's own (BPMN 2.0.2 §10.4 exempts it from
44
+ * every connection and containment constraint there is), and the tree is where
45
+ * that exemption is written down.
46
+ *
47
+ * ## Compatibility
48
+ *
49
+ * Nothing is backfilled. A process drawn before today carries nodes, pools and
50
+ * connectors with no role, so it is never evaluated and never says a word — the
51
+ * same promise every role in this library has made (PRD principle 8).
52
+ */
53
+ /** Every role this framework declares. */
54
+ export type BpmnRole = 'flow-object' | 'event' | 'start-event' | 'message-start-event' | 'timer-start-event' | 'end-event' | 'message-end-event' | 'terminate-end-event' | 'activity' | 'task' | 'user-task' | 'service-task' | 'sub-process' | 'call-activity' | 'gateway' | 'gateway-exclusive' | 'parallel-gateway' | 'data' | 'data-object' | 'data-store' | 'text-annotation' | 'group' | 'pool' | 'sequence-flow' | 'message-flow' | 'association';
55
+ export type BpmnRoleId = `bpmn:${BpmnRole}`;
56
+ /** Role ids, keyed by the `kind` used at the creation sites. */
57
+ export declare const BPMN_ROLE: {
58
+ readonly flowObject: "bpmn:flow-object";
59
+ readonly event: "bpmn:event";
60
+ readonly startEvent: "bpmn:start-event";
61
+ readonly startEventMessage: "bpmn:message-start-event";
62
+ readonly startEventTimer: "bpmn:timer-start-event";
63
+ readonly endEvent: "bpmn:end-event";
64
+ readonly endEventMessage: "bpmn:message-end-event";
65
+ readonly endEventTerminate: "bpmn:terminate-end-event";
66
+ readonly activity: "bpmn:activity";
67
+ readonly task: "bpmn:task";
68
+ readonly taskUser: "bpmn:user-task";
69
+ readonly taskService: "bpmn:service-task";
70
+ readonly subProcess: "bpmn:sub-process";
71
+ readonly callActivity: "bpmn:call-activity";
72
+ readonly gateway: "bpmn:gateway";
73
+ readonly gatewayExclusive: "bpmn:gateway-exclusive";
74
+ readonly gatewayParallel: "bpmn:parallel-gateway";
75
+ readonly data: "bpmn:data";
76
+ readonly dataObject: "bpmn:data-object";
77
+ readonly dataStore: "bpmn:data-store";
78
+ readonly textAnnotation: "bpmn:text-annotation";
79
+ readonly group: "bpmn:group";
80
+ readonly pool: "bpmn:pool";
81
+ readonly sequenceFlow: "bpmn:sequence-flow";
82
+ readonly messageFlow: "bpmn:message-flow";
83
+ readonly association: "bpmn:association";
84
+ };
85
+ export declare const BPMN_ROLES: RoleDefs;
86
+ /**
87
+ * The legacy `kind` discriminant → the role it means.
88
+ *
89
+ * `kind` STAYS: it is persisted, it drives the renderer and it is what the
90
+ * palette writes. What it is not, from today, is the semantic authority — the
91
+ * ROLE is. The two are posted side by side at every creation site, the way
92
+ * Wardley already does it, and this table is the single place that says which
93
+ * kind means which role. Total over {@link BpmnNodeKind} by its type, so a new
94
+ * kind cannot land without being given a meaning.
95
+ */
96
+ export declare const BPMN_ROLE_OF_KIND: Record<BpmnNodeKind, RoleId>;