@vsirotin/ts-stop 1.13.1 → 2.4.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 (122) hide show
  1. package/ai/skills/sfsm-compare-json-uml-diagram/SKILL.md +62 -0
  2. package/ai/skills/sfsm-json-to-uml-diagram/SKILL.md +50 -0
  3. package/ai/skills/sfsm-uml-diagram-to-json/SKILL.md +49 -0
  4. package/lib/esm/sfsm/CommandReceiver.js +17 -0
  5. package/lib/esm/sfsm/ControllerHub.js +82 -0
  6. package/lib/esm/sfsm/FaResolver.js +24 -3
  7. package/lib/esm/sfsm/Sfsm.js +48 -7
  8. package/lib/esm/sfsm/SignalSender.js +27 -0
  9. package/lib/esm/sfsm/index.js +3 -1
  10. package/lib/sfsm/CommandReceiver.d.ts +23 -0
  11. package/lib/sfsm/CommandReceiver.d.ts.map +1 -0
  12. package/lib/sfsm/CommandReceiver.js +22 -0
  13. package/lib/sfsm/CommandReceiver.js.map +1 -0
  14. package/lib/sfsm/ControllerHub.d.ts +56 -0
  15. package/lib/sfsm/ControllerHub.d.ts.map +1 -0
  16. package/lib/sfsm/ControllerHub.js +87 -0
  17. package/lib/sfsm/ControllerHub.js.map +1 -0
  18. package/lib/sfsm/FaResolver.d.ts +14 -0
  19. package/lib/sfsm/FaResolver.d.ts.map +1 -1
  20. package/lib/sfsm/FaResolver.js +24 -3
  21. package/lib/sfsm/FaResolver.js.map +1 -1
  22. package/lib/sfsm/Sfsm.d.ts +26 -0
  23. package/lib/sfsm/Sfsm.d.ts.map +1 -1
  24. package/lib/sfsm/Sfsm.js +48 -7
  25. package/lib/sfsm/Sfsm.js.map +1 -1
  26. package/lib/sfsm/SignalSender.d.ts +24 -0
  27. package/lib/sfsm/SignalSender.d.ts.map +1 -0
  28. package/lib/sfsm/SignalSender.js +32 -0
  29. package/lib/sfsm/SignalSender.js.map +1 -0
  30. package/lib/sfsm/index.d.ts +3 -1
  31. package/lib/sfsm/index.d.ts.map +1 -1
  32. package/lib/sfsm/index.js +7 -3
  33. package/lib/sfsm/index.js.map +1 -1
  34. package/lib/sfsm/interfaces.d.ts +1 -1
  35. package/lib/sfsm/types.d.ts +21 -0
  36. package/lib/sfsm/types.d.ts.map +1 -1
  37. package/package.json +9 -8
  38. package/scripts/compare-compact-jsons.js +146 -0
  39. package/scripts/drawio-to-json.js +149 -0
  40. package/scripts/json-to-drawio-old.js +311 -0
  41. package/scripts/json-to-drawio.js +309 -0
  42. package/tutorial/01-finite-state-machine.md +223 -0
  43. package/tutorial/02-stacked-finite-state-machine.md +32 -0
  44. package/tutorial/03-advanced-themes.md +110 -0
  45. package/tutorial/04-tools.md +164 -0
  46. package/tutorial/images/Turnstile-img.png +0 -0
  47. package/tutorial/images/TurnstileBaseFA.png +0 -0
  48. package/LICENSE +0 -201
  49. package/LICENSE-COMMERCIAL.md +0 -41
  50. package/README.md +0 -19
  51. package/lib/DefaultState.d.ts +0 -9
  52. package/lib/DefaultState.d.ts.map +0 -1
  53. package/lib/DefaultState.js +0 -15
  54. package/lib/DefaultState.js.map +0 -1
  55. package/lib/FiniteStateMachine.d.ts +0 -227
  56. package/lib/FiniteStateMachine.d.ts.map +0 -1
  57. package/lib/FiniteStateMachine.js +0 -410
  58. package/lib/FiniteStateMachine.js.map +0 -1
  59. package/lib/IStateWithActions.d.ts +0 -18
  60. package/lib/IStateWithActions.d.ts.map +0 -1
  61. package/lib/IStateWithActions.js +0 -3
  62. package/lib/IStateWithActions.js.map +0 -1
  63. package/lib/IStateWithOutputSignal.d.ts +0 -4
  64. package/lib/IStateWithOutputSignal.d.ts.map +0 -1
  65. package/lib/IStateWithOutputSignal.js +0 -3
  66. package/lib/IStateWithOutputSignal.js.map +0 -1
  67. package/lib/MatrixBasedStateMachine.d.ts +0 -108
  68. package/lib/MatrixBasedStateMachine.d.ts.map +0 -1
  69. package/lib/MatrixBasedStateMachine.js +0 -132
  70. package/lib/MatrixBasedStateMachine.js.map +0 -1
  71. package/lib/TransitionMatrix.d.ts +0 -61
  72. package/lib/TransitionMatrix.d.ts.map +0 -1
  73. package/lib/TransitionMatrix.js +0 -104
  74. package/lib/TransitionMatrix.js.map +0 -1
  75. package/lib/esm/DefaultState.js +0 -10
  76. package/lib/esm/FiniteStateMachine.js +0 -405
  77. package/lib/esm/IStateWithActions.js +0 -1
  78. package/lib/esm/IStateWithOutputSignal.js +0 -1
  79. package/lib/esm/MatrixBasedStateMachine.js +0 -127
  80. package/lib/esm/TransitionMatrix.js +0 -98
  81. package/lib/esm/fa/DefaultState.js +0 -10
  82. package/lib/esm/fa/FiniteStateMachine.js +0 -405
  83. package/lib/esm/fa/IStateWithActions.js +0 -1
  84. package/lib/esm/fa/IStateWithOutputSignal.js +0 -1
  85. package/lib/esm/fa/MatrixBasedStateMachine.js +0 -127
  86. package/lib/esm/fa/TransitionMatrix.js +0 -98
  87. package/lib/esm/index.js +0 -9
  88. package/lib/esm/sfsm/ExternalWorldHub.js +0 -80
  89. package/lib/esm/sfsm/index.browser.js +0 -5
  90. package/lib/fa/DefaultState.d.ts +0 -9
  91. package/lib/fa/DefaultState.d.ts.map +0 -1
  92. package/lib/fa/DefaultState.js +0 -15
  93. package/lib/fa/DefaultState.js.map +0 -1
  94. package/lib/fa/FiniteStateMachine.d.ts +0 -227
  95. package/lib/fa/FiniteStateMachine.d.ts.map +0 -1
  96. package/lib/fa/FiniteStateMachine.js +0 -410
  97. package/lib/fa/FiniteStateMachine.js.map +0 -1
  98. package/lib/fa/IStateWithActions.d.ts +0 -18
  99. package/lib/fa/IStateWithActions.d.ts.map +0 -1
  100. package/lib/fa/IStateWithActions.js +0 -3
  101. package/lib/fa/IStateWithActions.js.map +0 -1
  102. package/lib/fa/IStateWithOutputSignal.d.ts +0 -4
  103. package/lib/fa/IStateWithOutputSignal.d.ts.map +0 -1
  104. package/lib/fa/IStateWithOutputSignal.js +0 -3
  105. package/lib/fa/IStateWithOutputSignal.js.map +0 -1
  106. package/lib/fa/MatrixBasedStateMachine.d.ts +0 -108
  107. package/lib/fa/MatrixBasedStateMachine.d.ts.map +0 -1
  108. package/lib/fa/MatrixBasedStateMachine.js +0 -132
  109. package/lib/fa/MatrixBasedStateMachine.js.map +0 -1
  110. package/lib/fa/TransitionMatrix.d.ts +0 -61
  111. package/lib/fa/TransitionMatrix.d.ts.map +0 -1
  112. package/lib/fa/TransitionMatrix.js +0 -104
  113. package/lib/fa/TransitionMatrix.js.map +0 -1
  114. package/lib/index.d.ts +0 -10
  115. package/lib/index.d.ts.map +0 -1
  116. package/lib/index.js +0 -26
  117. package/lib/index.js.map +0 -1
  118. package/lib/sfsm/ExternalWorldHub.d.ts +0 -52
  119. package/lib/sfsm/ExternalWorldHub.d.ts.map +0 -1
  120. package/lib/sfsm/ExternalWorldHub.js +0 -85
  121. package/lib/sfsm/ExternalWorldHub.js.map +0 -1
  122. package/lib/sfsm/index.browser.d.ts +0 -7
@@ -0,0 +1,164 @@
1
+ # StOP Tutorial. Part 4: Tools
2
+
3
+ ## 7. Tools
4
+
5
+ Beyond the core `Sfsm` engine, the StOP SDK ships a handful of functions with corresponding CLI-scripts for working with FA definitions themselves.
6
+
7
+ StOP SDK ships with a few AI-skills, that can be useful by working with SFSMs. These skills are described in the paragraph 7.6 of this document.
8
+
9
+ ### 7.1 Extended vs. compact format, and `reduceFA`
10
+
11
+ Every example so far has used the **compact** (runtime) format: a plain list of `[from, signal, to]` tuples or `[from, signal, to, command]` tuples. For larger FAs, an **extended** (declaration) format is available where every state, signal, and command can carry a human-readable `name`/`description`, and a `sender`/`receiver` — much more pleasant to read and maintain by hand, and to auto-generate documentation from.
12
+
13
+ The `reduceFA()` function converts an extended definition into the flat compact form that `Sfsm.loadFA()` actually consumes internally:
14
+
15
+ ```typescript
16
+ import { reduceFA, FaDefinition } from '@vsirotin/ts-stop/sfsm';
17
+
18
+ const compact = reduceFA(extendedTurnstileFa as FaDefinition);
19
+ ```
20
+
21
+ Passing an already-compact definition through `reduceFA()` returns it unchanged, so it is always safe to call.
22
+
23
+ ### 7.2 The multi-FA compact format
24
+
25
+ Once an FA has children, the compact format lists **every** FA (root and all descendants) as separate top-level keys of the same object — the parent's `ts` list simply refers to a child by name as a transition target, exactly like `CoinCheck` in the example below. The root FA is auto-detected as whichever key is never referenced as a target (3rd element) in any FA's transitions. Both this format and a single flat FA are accepted by `loadFA()` without any change to the calling code.
26
+
27
+ ### 7.3 `updateCompactFA` / `updateFullFA` — evolving an FA definition without rewriting it
28
+
29
+ `updateCompactFA()` (and its extended-format counterpart `updateFullFA()`) apply a small, structured `FaUpdate` descriptor — `{ remove?: string[], add?: Record<string, ...> }` — to an existing FA definition and return a new one, without mutating the source. This is the mechanism the CLI tools `update-compact-fa` / `update-full-fa` use under the hood.
30
+
31
+ A particularly useful pattern: **turning a plain leaf state into a sub-FA**, so a device's behaviour becomes more detailed over time without touching the rest of the definition. Suppose our turnstile starts out trusting any coin unconditionally:
32
+
33
+ ```json
34
+ {
35
+ "Turnstile": [
36
+ ["I", "start", "locked"],
37
+ ["locked", "coin", "unlocked"],
38
+ ["unlocked", "push", "locked"]
39
+ ]
40
+ }
41
+ ```
42
+
43
+ Later, we decide coins should actually be validated before unlocking. Instead of hand-editing this list, we describe the change as an update that (a) adds a new `CoinCheck` sub-FA, and (b) replaces the root so that `"coin"` now leads into it instead of straight to `"unlocked"`:
44
+
45
+ ```typescript
46
+ import { updateCompactFA, FaDefinition, FaUpdate } from '@vsirotin/ts-stop/sfsm';
47
+
48
+ const update: FaUpdate = {
49
+ add: {
50
+ Turnstile: [
51
+ ["I", "start", "locked"],
52
+ ["locked", "coin", "CoinCheck"],
53
+ ["CoinCheck", "CC.ok", "unlocked"],
54
+ ["CoinCheck", "CC.bad", "locked"],
55
+ ["unlocked", "push", "locked"]
56
+ ],
57
+ CoinCheck: [
58
+ ["I", "coin", "checking"],
59
+ ["checking", "CC.ok", "E_ok"],
60
+ ["checking", "CC.bad", "E_bad"]
61
+ ]
62
+ }
63
+ };
64
+
65
+ const detailedTurnstileFa = updateCompactFA(simpleTurnstileFa as FaDefinition, update);
66
+ ```
67
+
68
+ `simpleTurnstileFa` is untouched; `detailedTurnstileFa` now behaves exactly like the original for `start`/`push`, but pushes `CoinCheck` onto the stack on `"coin"` (rule 4 from the previous chapter) and only reaches `"unlocked"` once a `CC.ok` signal arrives — otherwise it falls back to `"locked"` on `CC.bad`. No existing consumer of the FA (nor the SFSM engine itself) needs to change for this to work.
69
+
70
+ A runnable version of this example is available as a unit test: [07-update-fa-add-detail.test.ts](../../ts/ts-stop/test/sfsm/tutorial/07-update-fa-add-detail.test.ts). The full behaviour of `updateCompactFA` / `updateFullFA` (removing FAs, replacing existing ones, pruning dangling transitions, non-mutation of the source) is covered by [FaUpdater.test.ts](../../ts/ts-stop/test/sfsm/FaUpdater.test.ts).
71
+
72
+ ### 7.4 Loading FA definitions from files and URLs
73
+
74
+ Two small helpers load a `FaDefinition` from outside the source code, so FA JSON files can live alongside the code that uses them (or be served remotely) instead of being inlined:
75
+
76
+ ```typescript
77
+ import { Sfsm, loadFAFromFile, FaDefinition } from '@vsirotin/ts-stop/sfsm';
78
+
79
+ const sfsm = new Sfsm({ byMissingTransition: 'error' });
80
+ sfsm.loadFA(loadFAFromFile('./turnstile-fa.json')); // Node.js only (uses fs)
81
+ ```
82
+
83
+ ```typescript
84
+ import { Sfsm, loadFAFromURL, FaDefinition } from '@vsirotin/ts-stop/sfsm';
85
+
86
+ const sfsm = new Sfsm({ byMissingTransition: 'error' });
87
+ sfsm.loadFA(await loadFAFromURL('https://example.com/turnstile-fa.json')); // browser & Node.js ≥ 18
88
+ ```
89
+
90
+ Both accept extended or compact JSON and throw on a failed read/fetch or invalid JSON. Their full behaviour is covered by [FaLoader.test.ts](../../ts/ts-stop/test/sfsm/FaLoader.test.ts).
91
+
92
+ ### 7.5 CLI tools and scripts
93
+
94
+ For one-off conversions and FA manipulations without writing code, the package ships several npm scripts (run from `ts/ts-stop`, after `npm run build`).
95
+
96
+ #### 7.5.1 `reduce-fa` — Convert extended FA to compact format
97
+
98
+ ```bash
99
+ npm run reduce-fa -- <path-to-fa-file>
100
+ # writes <path-to-fa-file>-compact.json (or to stdout if no file extension)
101
+ ```
102
+
103
+ Converts an **extended** (hand-authored) FA definition into the flat **compact** format used at runtime by `Sfsm.loadFA()`. Input can be either extended or compact; compact input passes through unchanged. Thin wrapper around `reduceFA()`, whose behaviour is covered by [FaReducer.test.ts](../../ts/ts-stop/test/sfsm/FaReducer.test.ts).
104
+
105
+ #### 7.5.2 `update-compact-fa` / `update-full-fa` — Apply structured changes to FA definitions
106
+
107
+ ```bash
108
+ npm run update-compact-fa -- --source=<path> --update=<path> [--result=<path>]
109
+ npm run update-full-fa -- --source=<path> --update=<path> [--result=<path>]
110
+ ```
111
+
112
+ Applies a small structured `FaUpdate` descriptor (JSON file with `remove` and/or `add` keys) to an existing FA definition, returning a modified copy without mutating the source. By default, `--result` outputs to `<source-basename>-updated.json` if omitted. Thin wrappers around `updateCompactFA()` / `updateFullFA()`, whose behaviour is covered by [FaUpdater.test.ts](../../ts-stop/test/sfsm/FaUpdater.test.ts).
113
+
114
+ #### 7.5.3 `json-to-drawio` — Convert compact FA JSON to UML state diagram
115
+
116
+ ```bash
117
+ node scripts/json-to-drawio.js <input.json> <output.drawio>
118
+ ```
119
+
120
+ Converts a compact SFSM JSON file into a professional draw.io (.drawio) UML state diagram. Features:
121
+ - **Hierarchical container layout**: Each FA rendered as a swimlane; sub-FAs as nested light-grey containers (100×60 px).
122
+ - **ELK.js hierarchical layout**: Professional automatic positioning of states within each FA using Eclipse Layout Kernel.
123
+ - **Vertical stacking**: Multiple FAs stacked without overlap with 30px spacing.
124
+ - **SFSM metadata preservation**: All state roles, FA names, signals, and commands embedded in cell styles for round-trip conversion.
125
+ - **Initial, plain, sub-FA, and exit states**: All SFSM state types rendered correctly with appropriate UML shapes.
126
+
127
+ Output diagram can be opened in draw.io, inspected visually, and subjected to small manual adjustments (state/container repositioning, style tweaks) to achieve visual perfection without affecting the underlying SFSM data.
128
+
129
+ #### 7.5.4 `drawio-to-json` — Extract compact FA JSON from UML diagram
130
+
131
+ ```bash
132
+ node scripts/drawio-to-json.js <input.drawio> <output.json>
133
+ ```
134
+
135
+ Reverse conversion: reads a draw.io diagram (preferably generated by `json-to-drawio.js`, but can parse hand-drawn diagrams with heuristic fallbacks) and extracts a compact SFSM JSON file. Parses the custom SFSM metadata (sfsmRole, sfsmFa, sfsmKey, sfsmSignal, sfsmCommand) from cell styles; if metadata is absent, applies shape-based heuristics (ellipses for states, swimlanes for sub-FAs, etc.).
136
+
137
+ Output is a valid compact-format FA ready for `Sfsm.loadFA()`.
138
+
139
+ #### 7.5.5 `compare-compact-jsons` — Validate diagram vs. JSON correspondence
140
+
141
+ ```bash
142
+ node scripts/compare-compact-jsons.js <file-a.json> <file-b.json>
143
+ ```
144
+
145
+ Intelligent comparison of two compact SFSM JSON files. Reports per-FA alignment: matching transitions, missing/extra transitions, mismatched targets or commands. Exits with code 0 if files are identical, non-zero if differences found. Designed for round-trip validation: after converting JSON → Diagram → JSON, this script confirms the resulting file matches the original exactly.
146
+
147
+ #### 7.5.6 `merge-fas` / `merge-fas-from-dir` — Combine FA definitions
148
+
149
+ ```bash
150
+ node scripts/merge-fas.js <input1.json> <input2.json> ... --result=<output.json>
151
+ node scripts/merge-fas-from-dir.js <input-dir> --result=<output.json>
152
+ ```
153
+
154
+ Combine multiple compact or extended FA definitions into a single multi-FA output file. Later input files override earlier ones with the same FA key. Useful for modular FA composition and testing multi-FA hierarchies.
155
+
156
+ ### 7.6 AI skills for diagram generation and validation
157
+
158
+ Three AI skills in the [ai-skills directory](../../ts/ts-stop/ai/skills) automate common diagram workflows:
159
+
160
+ - **`sfsm-json-to-uml-diagram`**: Wraps `json-to-drawio.js`. Use when you need to visualize an SFSM JSON definition as a professional draw.io UML state diagram. Generates hierarchical layout with nested sub-FAs and full metadata preservation. Note: the generated diagram is production-ready but may benefit from small manual repositioning of states or containers for optimal visual polish.
161
+
162
+ - **`sfsm-uml-diagram-to-json`**: Wraps `drawio-to-json.js`. Use when you need to extract or reverse-convert a draw.io state diagram back to compact SFSM JSON (e.g., after hand-editing the diagram, or starting from a collaborator's visual design).
163
+
164
+ - **`sfsm-compare-json-uml-diagram`**: Combines `drawio-to-json.js` and `compare-compact-jsons.js`. Use when you need to validate a draw.io diagram against its source JSON (or vice versa). Identifies every discrepancy—missing transitions, state mismatches, command errors—and reports them in a clear diff format. Accepts user-specified input/output paths, requesting them if not provided.
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,41 +0,0 @@
1
- # StOP Commercial License
2
-
3
- **Version 1.0**
4
-
5
- ## 1. Grant of Commercial License
6
-
7
- This Commercial License grants you permission to use the StOP library in commercial projects under the conditions specified in Section 2.
8
-
9
- ## 2. Commercial Use Restrictions
10
-
11
- You may use StOP under the **free Apache 2.0 license** if:
12
-
13
- - Your organization has fewer than 10 employees, **AND**
14
- - Your project generates less than $10,000 USD in annual revenue
15
-
16
- If your organization or project exceeds either threshold, you must:
17
-
18
- - Obtain a separate Commercial License from the copyright holder, or
19
- - Use the library under the Apache 2.0 license with explicit written permission from the copyright holder
20
-
21
- ## 3. Obtaining a Commercial License
22
-
23
- To request a Commercial License for organizations with 10+ employees or projects generating $10,000+ USD annually:
24
-
25
- **Contact the author through the GitHub repository for licensing terms and pricing.**
26
-
27
- Commercial licenses are available at reasonable rates. Please reach out to discuss your specific use case.
28
-
29
- ## 4. Terms
30
-
31
- - Commercial licenses are granted on a per-project or per-organization basis
32
- - Licensing terms will be negotiated based on project scope and revenue
33
- - All commercial licensees must comply with the underlying Apache 2.0 obligations regarding patents and attribution
34
-
35
- ## 5. Disclaimer
36
-
37
- This Commercial License is provided in addition to, not in place of, the Apache 2.0 License. In the event of conflict, the more restrictive terms apply. For clarity on your licensing obligations, please contact the copyright holder.
38
-
39
- ## 6. Termination
40
-
41
- If you exceed the commercial use thresholds (10+ employees or $10,000+ annual revenue) without obtaining a Commercial License, your right to use the library terminates immediately upon notice.
package/README.md DELETED
@@ -1,19 +0,0 @@
1
- # @vsirotin/ts-stop
2
-
3
- State-Oriented Programming library for TypeScript.
4
-
5
- For an introduction to the concept, read the [StOP Tutorial](https://github.com/vsirotin/StOP/blob/main/docs/Tutorial/01-StOP-Tutorial.md).
6
-
7
- For usage and API documentation, see the Angular 17 demo in [ts/ts-example](https://github.com/vsirotin/StOP/blob/main/ts/ts-example).
8
-
9
- ## License
10
-
11
- This project is dual-licensed:
12
-
13
- - **[Apache 2.0](./LICENSE)** - Free for open-source, academic, and small commercial use
14
- - **[Commercial License](./LICENSE-COMMERCIAL.md)** - For organizations with 10+ employees or projects with $10,000+ annual revenue
15
-
16
- **Quick Summary:**
17
- - ✅ Free for individuals and small teams (< 10 employees)
18
- - ✅ Free for non-commercial and low-revenue projects (< $10K/year)
19
- - 📧 Commercial licensing available - contact the author
@@ -1,9 +0,0 @@
1
- /**
2
- * Marker base class for states that should be used processed by invalid signals and
3
- * in situation, then no transitions set for pair (current signal, current state).
4
- * Only one state in a state machine can have this role.
5
- */
6
- export declare abstract class DefaultState {
7
- isDefaultState(): boolean;
8
- }
9
- //# sourceMappingURL=DefaultState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultState.d.ts","sourceRoot":"","sources":["../src/DefaultState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,8BAAsB,YAAY;IAC9B,cAAc,IAAI,OAAO;CAG5B"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultState = void 0;
4
- /**
5
- * Marker base class for states that should be used processed by invalid signals and
6
- * in situation, then no transitions set for pair (current signal, current state).
7
- * Only one state in a state machine can have this role.
8
- */
9
- class DefaultState {
10
- isDefaultState() {
11
- return true;
12
- }
13
- }
14
- exports.DefaultState = DefaultState;
15
- //# sourceMappingURL=DefaultState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultState.js","sourceRoot":"","sources":["../src/DefaultState.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,MAAsB,YAAY;IAC9B,cAAc;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAJD,oCAIC"}