@vsirotin/ts-stop 0.5.1 → 0.6.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 +2 -164
- package/lib/FiniteStateMachine.d.ts +6 -1
- package/lib/FiniteStateMachine.d.ts.map +1 -1
- package/lib/FiniteStateMachine.js +114 -6
- package/lib/FiniteStateMachine.js.map +1 -1
- package/lib/esm/FiniteStateMachine.js +114 -6
- package/lib/esm/fa/DefaultState.js +10 -0
- package/lib/esm/fa/FiniteStateMachine.js +405 -0
- package/lib/esm/fa/IStateWithActions.js +1 -0
- package/lib/esm/fa/IStateWithOutputSignal.js +1 -0
- package/lib/esm/fa/MatrixBasedStateMachine.js +127 -0
- package/lib/esm/fa/TransitionMatrix.js +98 -0
- package/lib/esm/index.js +6 -6
- package/lib/esm/sfsm/ExternalWorldHub.js +80 -0
- package/lib/esm/sfsm/FaLoader.js +30 -0
- package/lib/esm/sfsm/FaReducer.js +36 -0
- package/lib/esm/sfsm/FaResolver.js +115 -0
- package/lib/esm/sfsm/FaUpdater.js +101 -0
- package/lib/esm/sfsm/Sfsm.js +225 -0
- package/lib/esm/sfsm/index.js +6 -0
- package/lib/esm/sfsm/interfaces.js +1 -0
- package/lib/esm/sfsm/types.js +1 -0
- package/lib/fa/DefaultState.d.ts +9 -0
- package/lib/fa/DefaultState.d.ts.map +1 -0
- package/lib/fa/DefaultState.js +15 -0
- package/lib/fa/DefaultState.js.map +1 -0
- package/lib/fa/FiniteStateMachine.d.ts +227 -0
- package/lib/fa/FiniteStateMachine.d.ts.map +1 -0
- package/lib/fa/FiniteStateMachine.js +410 -0
- package/lib/fa/FiniteStateMachine.js.map +1 -0
- package/lib/fa/IStateWithActions.d.ts +18 -0
- package/lib/fa/IStateWithActions.d.ts.map +1 -0
- package/lib/fa/IStateWithActions.js +3 -0
- package/lib/fa/IStateWithActions.js.map +1 -0
- package/lib/fa/IStateWithOutputSignal.d.ts +4 -0
- package/lib/fa/IStateWithOutputSignal.d.ts.map +1 -0
- package/lib/fa/IStateWithOutputSignal.js +3 -0
- package/lib/fa/IStateWithOutputSignal.js.map +1 -0
- package/lib/fa/MatrixBasedStateMachine.d.ts +108 -0
- package/lib/fa/MatrixBasedStateMachine.d.ts.map +1 -0
- package/lib/fa/MatrixBasedStateMachine.js +132 -0
- package/lib/fa/MatrixBasedStateMachine.js.map +1 -0
- package/lib/fa/TransitionMatrix.d.ts +61 -0
- package/lib/fa/TransitionMatrix.d.ts.map +1 -0
- package/lib/fa/TransitionMatrix.js +104 -0
- package/lib/fa/TransitionMatrix.js.map +1 -0
- package/lib/index.d.ts +6 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/sfsm/ExternalWorldHub.d.ts +52 -0
- package/lib/sfsm/ExternalWorldHub.d.ts.map +1 -0
- package/lib/sfsm/ExternalWorldHub.js +85 -0
- package/lib/sfsm/ExternalWorldHub.js.map +1 -0
- package/lib/sfsm/FaLoader.d.ts +22 -0
- package/lib/sfsm/FaLoader.d.ts.map +1 -0
- package/lib/sfsm/FaLoader.js +68 -0
- package/lib/sfsm/FaLoader.js.map +1 -0
- package/lib/sfsm/FaReducer.d.ts +12 -0
- package/lib/sfsm/FaReducer.d.ts.map +1 -0
- package/lib/sfsm/FaReducer.js +40 -0
- package/lib/sfsm/FaReducer.js.map +1 -0
- package/lib/sfsm/FaResolver.d.ts +37 -0
- package/lib/sfsm/FaResolver.d.ts.map +1 -0
- package/lib/sfsm/FaResolver.js +120 -0
- package/lib/sfsm/FaResolver.js.map +1 -0
- package/lib/sfsm/FaUpdater.d.ts +25 -0
- package/lib/sfsm/FaUpdater.d.ts.map +1 -0
- package/lib/sfsm/FaUpdater.js +106 -0
- package/lib/sfsm/FaUpdater.js.map +1 -0
- package/lib/sfsm/Sfsm.d.ts +60 -0
- package/lib/sfsm/Sfsm.d.ts.map +1 -0
- package/lib/sfsm/Sfsm.js +230 -0
- package/lib/sfsm/Sfsm.js.map +1 -0
- package/lib/sfsm/index.d.ts +9 -0
- package/lib/sfsm/index.d.ts.map +1 -0
- package/lib/sfsm/index.js +18 -0
- package/lib/sfsm/index.js.map +1 -0
- package/lib/sfsm/interfaces.d.ts +22 -0
- package/lib/sfsm/interfaces.d.ts.map +1 -0
- package/lib/sfsm/interfaces.js +3 -0
- package/lib/sfsm/interfaces.js.map +1 -0
- package/lib/sfsm/types.d.ts +78 -0
- package/lib/sfsm/types.d.ts.map +1 -0
- package/lib/sfsm/types.js +3 -0
- package/lib/sfsm/types.js.map +1 -0
- package/package.json +12 -2
package/lib/sfsm/Sfsm.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sfsm = void 0;
|
|
4
|
+
const FaResolver_1 = require("./FaResolver");
|
|
5
|
+
/**
|
|
6
|
+
* Stacked Finite State Machine engine.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* const sfsm = new Sfsm(options);
|
|
10
|
+
* sfsm.setCommandReceiver(receiver);
|
|
11
|
+
* sfsm.loadFA(definition); // auto-activates state I of root FA
|
|
12
|
+
* sfsm.receiveSignal('TS.s');
|
|
13
|
+
*
|
|
14
|
+
* Signal re-entrancy: if receiveSignal is called while the engine is already
|
|
15
|
+
* processing a signal (e.g. from within a command receiver callback), the
|
|
16
|
+
* incoming signal is queued and processed after the current step completes.
|
|
17
|
+
* This prevents stack corruption and ensures deterministic ordering.
|
|
18
|
+
*/
|
|
19
|
+
class Sfsm {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
this.resolver = null;
|
|
23
|
+
this.stack = [];
|
|
24
|
+
this.commandReceiver = null;
|
|
25
|
+
this.log = [];
|
|
26
|
+
this.processing = false;
|
|
27
|
+
this.signalQueue = [];
|
|
28
|
+
this.options = {
|
|
29
|
+
byMissingData: (_a = options.byMissingData) !== null && _a !== void 0 ? _a : 'error',
|
|
30
|
+
byMissingTransition: (_b = options.byMissingTransition) !== null && _b !== void 0 ? _b : 'error'
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Register the single command receiver for this SFSM instance. */
|
|
34
|
+
setCommandReceiver(receiver) {
|
|
35
|
+
this.commandReceiver = receiver;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Load a FA definition and initialise the engine.
|
|
39
|
+
* The root FA is pushed onto the stack with active state "I".
|
|
40
|
+
* No signal is sent automatically — the caller is responsible for
|
|
41
|
+
* sending the first signal (e.g. "TS.s") to drive out of state I.
|
|
42
|
+
*/
|
|
43
|
+
loadFA(definition) {
|
|
44
|
+
this.resolver = new FaResolver_1.FaResolver(definition);
|
|
45
|
+
const rootName = this.resolver.getRootName();
|
|
46
|
+
this.stack = [{ faName: rootName, currentState: 'I' }];
|
|
47
|
+
this.log = [];
|
|
48
|
+
this.processing = false;
|
|
49
|
+
this.signalQueue = [];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Send a signal to the SFSM.
|
|
53
|
+
* If called re-entrantly (from within a command receiver), the signal
|
|
54
|
+
* is queued and will be processed after the current step finishes.
|
|
55
|
+
*/
|
|
56
|
+
receiveSignal(signal, data) {
|
|
57
|
+
if (this.processing) {
|
|
58
|
+
this.signalQueue.push({ signal, data });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this.processSignal(signal, data);
|
|
62
|
+
// Drain queue
|
|
63
|
+
while (this.signalQueue.length > 0) {
|
|
64
|
+
const next = this.signalQueue.shift();
|
|
65
|
+
this.processSignal(next.signal, next.data);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Returns the accumulated log entries. */
|
|
69
|
+
getLog() {
|
|
70
|
+
return [...this.log];
|
|
71
|
+
}
|
|
72
|
+
/** Returns the current FA name stack (bottom = index 0, head = last). */
|
|
73
|
+
getCurrentStack() {
|
|
74
|
+
return this.stack.map(f => f.faName);
|
|
75
|
+
}
|
|
76
|
+
/** Returns the active state of the head FA. */
|
|
77
|
+
getHeadState() {
|
|
78
|
+
if (this.stack.length === 0)
|
|
79
|
+
throw new Error('SFSM: not initialised');
|
|
80
|
+
return this.stack[this.stack.length - 1].currentState;
|
|
81
|
+
}
|
|
82
|
+
// ── Core engine ─────────────────────────────────────────────────────────
|
|
83
|
+
processSignal(signal, data) {
|
|
84
|
+
if (!this.resolver || this.stack.length === 0) {
|
|
85
|
+
throw new Error('SFSM: call loadFA() before sending signals');
|
|
86
|
+
}
|
|
87
|
+
this.processing = true;
|
|
88
|
+
try {
|
|
89
|
+
this.applySignal(signal, data);
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
this.processing = false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Rule 2: find a matching transition, searching from head down the stack.
|
|
97
|
+
* Returns { frameIndex, transition } or null if not found anywhere.
|
|
98
|
+
*/
|
|
99
|
+
findTransition(signal) {
|
|
100
|
+
for (let i = this.stack.length - 1; i >= 0; i--) {
|
|
101
|
+
const frame = this.stack[i];
|
|
102
|
+
const fa = this.resolver.get(frame.faName);
|
|
103
|
+
const match = fa.transitions.find(t => t[0] === frame.currentState && t[1] === signal);
|
|
104
|
+
if (match) {
|
|
105
|
+
return { frameIndex: i, toState: match[2], command: match[3] };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
applySignal(signal, data) {
|
|
111
|
+
var _a, _b, _c, _d;
|
|
112
|
+
const result = this.findTransition(signal);
|
|
113
|
+
if (!result) {
|
|
114
|
+
// Rule 2.2.1 — no transition found anywhere
|
|
115
|
+
this.handleMissingTransition(signal);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const { frameIndex, toState, command } = result;
|
|
119
|
+
// Capture stack state BEFORE any structural changes
|
|
120
|
+
const stackBefore = this.getCurrentStack();
|
|
121
|
+
const stateBefore = this.stack[frameIndex].currentState;
|
|
122
|
+
// Bubble-up: signal was handled by an ancestor FA, not the head
|
|
123
|
+
const bubbledUp = frameIndex < this.stack.length - 1;
|
|
124
|
+
// Rule 2.2.2.1 — pop frames above the matched FA
|
|
125
|
+
if (bubbledUp) {
|
|
126
|
+
this.stack.splice(frameIndex + 1);
|
|
127
|
+
}
|
|
128
|
+
// Update state
|
|
129
|
+
this.stack[frameIndex].currentState = toState;
|
|
130
|
+
// Rule label: 2.1 = head FA handled signal; 2.2.2.1 = ancestor handled after bubble-up
|
|
131
|
+
const rule = bubbledUp ? '2.2.2.1' : '2.1';
|
|
132
|
+
// Rule 2.1.1 — send command if present
|
|
133
|
+
let sentCommand;
|
|
134
|
+
let commandName;
|
|
135
|
+
let receiver;
|
|
136
|
+
if (command) {
|
|
137
|
+
sentCommand = command;
|
|
138
|
+
const meta = this.resolveCommandMeta(frameIndex, command);
|
|
139
|
+
commandName = meta === null || meta === void 0 ? void 0 : meta.name;
|
|
140
|
+
receiver = meta === null || meta === void 0 ? void 0 : meta.receiver;
|
|
141
|
+
const commandData = command.endsWith('$') ? data : undefined;
|
|
142
|
+
if (command.endsWith('$') && data === undefined) {
|
|
143
|
+
this.handleMissingData(signal, command);
|
|
144
|
+
}
|
|
145
|
+
(_a = this.commandReceiver) === null || _a === void 0 ? void 0 : _a.receiveCommand(command, commandData);
|
|
146
|
+
}
|
|
147
|
+
const logEntry = {
|
|
148
|
+
step: this.log.length + 1,
|
|
149
|
+
stack: stackBefore,
|
|
150
|
+
state: stateBefore,
|
|
151
|
+
stateName: (_b = this.resolveStateMeta(frameIndex, stateBefore)) === null || _b === void 0 ? void 0 : _b.name,
|
|
152
|
+
signal,
|
|
153
|
+
signalName: (_c = this.resolveSignalMeta(frameIndex, signal)) === null || _c === void 0 ? void 0 : _c.name,
|
|
154
|
+
rule,
|
|
155
|
+
newStack: this.getCurrentStack(),
|
|
156
|
+
newState: toState,
|
|
157
|
+
newStateName: (_d = this.resolveStateMeta(frameIndex, toState)) === null || _d === void 0 ? void 0 : _d.name,
|
|
158
|
+
command: sentCommand,
|
|
159
|
+
commandName,
|
|
160
|
+
receiver
|
|
161
|
+
};
|
|
162
|
+
this.log.push(logEntry);
|
|
163
|
+
// Rule 3: new state is itself a sub-FA — push it
|
|
164
|
+
const headFa = this.resolver.get(this.stack[frameIndex].faName);
|
|
165
|
+
if (headFa.subFaNames.has(toState)) {
|
|
166
|
+
this.stack.push({ faName: toState, currentState: 'I' });
|
|
167
|
+
this.applySignal(signal, data); // forward signal to sub-FA
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
// Rule 4: new state is an exit state
|
|
171
|
+
if (toState.startsWith('E_')) {
|
|
172
|
+
if (this.stack.length === 1) {
|
|
173
|
+
// Rule 4.1 — root FA resets to I
|
|
174
|
+
this.stack[0].currentState = 'I';
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// Rule 4.2 — pop current FA, forward signal to new head
|
|
178
|
+
this.stack.pop();
|
|
179
|
+
this.applySignal(signal, data);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// ── Meta resolution helpers ──────────────────────────────────────────────
|
|
184
|
+
resolveStateMeta(frameIndex, state) {
|
|
185
|
+
var _a;
|
|
186
|
+
const fa = this.resolver.get(this.stack[frameIndex].faName);
|
|
187
|
+
return (_a = fa.node.states) === null || _a === void 0 ? void 0 : _a[state];
|
|
188
|
+
}
|
|
189
|
+
resolveSignalMeta(frameIndex, signal) {
|
|
190
|
+
var _a;
|
|
191
|
+
// Search from head FA downward for signal metadata
|
|
192
|
+
for (let i = this.stack.length - 1; i >= 0; i--) {
|
|
193
|
+
const fa = this.resolver.get(this.stack[i].faName);
|
|
194
|
+
if ((_a = fa.node.signals) === null || _a === void 0 ? void 0 : _a[signal])
|
|
195
|
+
return fa.node.signals[signal];
|
|
196
|
+
}
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
resolveCommandMeta(frameIndex, command) {
|
|
200
|
+
var _a;
|
|
201
|
+
for (let i = this.stack.length - 1; i >= 0; i--) {
|
|
202
|
+
const fa = this.resolver.get(this.stack[i].faName);
|
|
203
|
+
if ((_a = fa.node.commands) === null || _a === void 0 ? void 0 : _a[command])
|
|
204
|
+
return fa.node.commands[command];
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
// ── Policy handlers ──────────────────────────────────────────────────────
|
|
209
|
+
handleMissingTransition(signal) {
|
|
210
|
+
var _a;
|
|
211
|
+
const policy = (_a = this.options.byMissingTransition) !== null && _a !== void 0 ? _a : 'error';
|
|
212
|
+
const msg = `SFSM: no transition for signal "${signal}" in state "${this.getHeadState()}" (FA: ${this.getCurrentStack().join('>')})`;
|
|
213
|
+
if (policy === 'error')
|
|
214
|
+
throw new Error(msg);
|
|
215
|
+
if (policy === 'log_warning')
|
|
216
|
+
console.warn(msg);
|
|
217
|
+
// 'ignore': do nothing
|
|
218
|
+
}
|
|
219
|
+
handleMissingData(signal, command) {
|
|
220
|
+
var _a;
|
|
221
|
+
const policy = (_a = this.options.byMissingData) !== null && _a !== void 0 ? _a : 'error';
|
|
222
|
+
const msg = `SFSM: command "${command}" expects data but signal "${signal}" carries none`;
|
|
223
|
+
if (policy === 'error')
|
|
224
|
+
throw new Error(msg);
|
|
225
|
+
if (policy === 'log_warning')
|
|
226
|
+
console.warn(msg);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
exports.Sfsm = Sfsm;
|
|
230
|
+
//# sourceMappingURL=Sfsm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sfsm.js","sourceRoot":"","sources":["../../src/sfsm/Sfsm.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAO1C;;;;;;;;;;;;;GAaG;AACH,MAAa,IAAI;IAUb,YAAY,UAAuB,EAAE;;QAR7B,aAAQ,GAAsB,IAAI,CAAC;QACnC,UAAK,GAAiB,EAAE,CA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,IAAI,CAAC,YAAY,EAAE,UAAU,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QACrI,IAAI,MAAM,KAAK,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,MAAM,KAAK,aAAa;YAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChD,uBAAuB;IAC3B,CAAC;IAEO,iBAAiB,CAAC,MAAc,EAAE,OAAe;;QACrD,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,aAAa,mCAAI,OAAO,CAAC;QACrD,MAAM,GAAG,GAAG,kBAAkB,OAAO,8BAA8B,MAAM,gBAAgB,CAAC;QAC1F,IAAI,MAAM,KAAK,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,MAAM,KAAK,aAAa;YAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;CACJ;AAnOD,oBAmOC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ICommandReceiver, ISignalReceiver, ISignalSender } from './interfaces';
|
|
2
|
+
export { ExternalWorldHub } from './ExternalWorldHub';
|
|
3
|
+
export { FaDefinition, FaNode, FaUpdate, Transition, SfsmOptions, LogEntry, MissingDataPolicy, MissingTransitionPolicy } from './types';
|
|
4
|
+
export { FaResolver, ResolvedFa } from './FaResolver';
|
|
5
|
+
export { Sfsm } from './Sfsm';
|
|
6
|
+
export { reduceFA } from './FaReducer';
|
|
7
|
+
export { updateCompactFA, updateFullFA } from './FaUpdater';
|
|
8
|
+
export { loadFAFromFile, loadFAFromURL } from './FaLoader';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sfsm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACxI,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadFAFromURL = exports.loadFAFromFile = exports.updateFullFA = exports.updateCompactFA = exports.reduceFA = exports.Sfsm = exports.FaResolver = exports.ExternalWorldHub = void 0;
|
|
4
|
+
var ExternalWorldHub_1 = require("./ExternalWorldHub");
|
|
5
|
+
Object.defineProperty(exports, "ExternalWorldHub", { enumerable: true, get: function () { return ExternalWorldHub_1.ExternalWorldHub; } });
|
|
6
|
+
var FaResolver_1 = require("./FaResolver");
|
|
7
|
+
Object.defineProperty(exports, "FaResolver", { enumerable: true, get: function () { return FaResolver_1.FaResolver; } });
|
|
8
|
+
var Sfsm_1 = require("./Sfsm");
|
|
9
|
+
Object.defineProperty(exports, "Sfsm", { enumerable: true, get: function () { return Sfsm_1.Sfsm; } });
|
|
10
|
+
var FaReducer_1 = require("./FaReducer");
|
|
11
|
+
Object.defineProperty(exports, "reduceFA", { enumerable: true, get: function () { return FaReducer_1.reduceFA; } });
|
|
12
|
+
var FaUpdater_1 = require("./FaUpdater");
|
|
13
|
+
Object.defineProperty(exports, "updateCompactFA", { enumerable: true, get: function () { return FaUpdater_1.updateCompactFA; } });
|
|
14
|
+
Object.defineProperty(exports, "updateFullFA", { enumerable: true, get: function () { return FaUpdater_1.updateFullFA; } });
|
|
15
|
+
var FaLoader_1 = require("./FaLoader");
|
|
16
|
+
Object.defineProperty(exports, "loadFAFromFile", { enumerable: true, get: function () { return FaLoader_1.loadFAFromFile; } });
|
|
17
|
+
Object.defineProperty(exports, "loadFAFromURL", { enumerable: true, get: function () { return FaLoader_1.loadFAFromURL; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sfsm/index.ts"],"names":[],"mappings":";;;AACA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAEzB,2CAAsD;AAA7C,wGAAA,UAAU,OAAA;AACnB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,yCAA4D;AAAnD,4GAAA,eAAe,OAAA;AAAE,yGAAA,YAAY,OAAA;AACtC,uCAA2D;AAAlD,0GAAA,cAAc,OAAA;AAAE,yGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for objects that can receive commands from the SFSM.
|
|
3
|
+
* Implement this interface for any device in the "external world" that the SFSM controls.
|
|
4
|
+
*/
|
|
5
|
+
export interface ICommandReceiver {
|
|
6
|
+
receiveCommand(command: string, data?: unknown): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Interface for objects that can receive signals.
|
|
10
|
+
* The SFSM implements this interface — external senders call receiveSignal() to drive it.
|
|
11
|
+
*/
|
|
12
|
+
export interface ISignalReceiver {
|
|
13
|
+
receiveSignal(signal: string, data?: unknown): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interface for external objects that send signals to the SFSM.
|
|
17
|
+
* ExternalWorldHub calls connectSignalTarget() on every registered sender during connectTo().
|
|
18
|
+
*/
|
|
19
|
+
export interface ISignalSender {
|
|
20
|
+
connectSignalTarget(target: ISignalReceiver): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/sfsm/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACzD;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACvD;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;CACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/sfsm/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A transition in compact (runtime) format: [from, signal, to] or [from, signal, to, command]
|
|
3
|
+
*/
|
|
4
|
+
export type Transition = [string, string, string] | [string, string, string, string];
|
|
5
|
+
/**
|
|
6
|
+
* Metadata for a named element (state, signal, or command) in extended format.
|
|
7
|
+
*/
|
|
8
|
+
export interface ElementMeta {
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
sender?: string;
|
|
12
|
+
receiver?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A node in the FA tree. Can represent either the root FA or a nested sub-FA.
|
|
16
|
+
*
|
|
17
|
+
* In compact format: the entire FaDefinition value is just a Transition[].
|
|
18
|
+
* In extended format: this object contains states, signals, commands, and ts.
|
|
19
|
+
*
|
|
20
|
+
* A state entry under "states" is either:
|
|
21
|
+
* - another FaNode (if it has a "ts" key) — a sub-FA
|
|
22
|
+
* - an ElementMeta (a leaf state with name/description only)
|
|
23
|
+
*/
|
|
24
|
+
export interface FaNode {
|
|
25
|
+
states?: Record<string, FaNode | ElementMeta>;
|
|
26
|
+
signals?: Record<string, ElementMeta>;
|
|
27
|
+
commands?: Record<string, ElementMeta>;
|
|
28
|
+
ts: Transition[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The top-level FA definition object.
|
|
32
|
+
* Key = root FA name, value = FaNode (extended) or Transition[] (compact).
|
|
33
|
+
*/
|
|
34
|
+
export type FaDefinition = Record<string, FaNode | Transition[]>;
|
|
35
|
+
/**
|
|
36
|
+
* An update descriptor applied by updateCompactFA or updateFullFA.
|
|
37
|
+
* - remove: list of FA names to remove (children only; parent ts is cleaned automatically)
|
|
38
|
+
* - add: map of FA name → new definition; existing entries are replaced, new ones inserted
|
|
39
|
+
*/
|
|
40
|
+
export interface FaUpdate {
|
|
41
|
+
remove?: string[];
|
|
42
|
+
add?: Record<string, FaNode | Transition[]>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* How the SFSM reacts when a data-carrying command has no data available in the signal.
|
|
46
|
+
*/
|
|
47
|
+
export type MissingDataPolicy = 'ignore' | 'log_warning' | 'error';
|
|
48
|
+
/**
|
|
49
|
+
* How the SFSM reacts when no matching transition is found for a (state, signal) pair.
|
|
50
|
+
*/
|
|
51
|
+
export type MissingTransitionPolicy = 'ignore' | 'log_warning' | 'error';
|
|
52
|
+
/**
|
|
53
|
+
* Configuration options for the SFSM engine.
|
|
54
|
+
*/
|
|
55
|
+
export interface SfsmOptions {
|
|
56
|
+
byMissingData?: MissingDataPolicy;
|
|
57
|
+
byMissingTransition?: MissingTransitionPolicy;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A single entry in the processing log.
|
|
61
|
+
* Fields marked (e) are only populated when the FA is in extended format.
|
|
62
|
+
*/
|
|
63
|
+
export interface LogEntry {
|
|
64
|
+
step: number;
|
|
65
|
+
stack: string[];
|
|
66
|
+
state: string;
|
|
67
|
+
stateName?: string;
|
|
68
|
+
signal: string;
|
|
69
|
+
signalName?: string;
|
|
70
|
+
rule: string;
|
|
71
|
+
newStack: string[];
|
|
72
|
+
newState: string;
|
|
73
|
+
newStateName?: string;
|
|
74
|
+
command?: string;
|
|
75
|
+
commandName?: string;
|
|
76
|
+
receiver?: string;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sfsm/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,MAAM;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvC,EAAE,EAAE,UAAU,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CACjD;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sfsm/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vsirotin/ts-stop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "State Oriented Programming library for TypeScript",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"types": "./lib/index.d.ts",
|
|
11
11
|
"import": "./lib/esm/index.js",
|
|
12
12
|
"require": "./lib/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./sfsm": {
|
|
15
|
+
"types": "./lib/sfsm/index.d.ts",
|
|
16
|
+
"import": "./lib/esm/sfsm/index.js",
|
|
17
|
+
"require": "./lib/sfsm/index.js"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -23,7 +28,10 @@
|
|
|
23
28
|
"test:coverage": "jest --coverage",
|
|
24
29
|
"clean": "rm -rf lib coverage",
|
|
25
30
|
"publish:local": "./scripts/publish-local.sh",
|
|
26
|
-
"pack": "npm run build && npm pack"
|
|
31
|
+
"pack": "npm run build && npm pack",
|
|
32
|
+
"reduce-fa": "node scripts/reduce-fa.js",
|
|
33
|
+
"update-full-fa": "node scripts/update-fa.js --format=full",
|
|
34
|
+
"update-compact-fa": "node scripts/update-fa.js --format=compact"
|
|
27
35
|
},
|
|
28
36
|
"keywords": [
|
|
29
37
|
"typescript",
|
|
@@ -34,8 +42,10 @@
|
|
|
34
42
|
"license": "MIT",
|
|
35
43
|
"devDependencies": {
|
|
36
44
|
"@types/jest": "^29.5.14",
|
|
45
|
+
"@types/js-yaml": "^4.0.9",
|
|
37
46
|
"@types/mocha": "^10.0.10",
|
|
38
47
|
"jest": "^29.5.0",
|
|
48
|
+
"js-yaml": "^4.1.1",
|
|
39
49
|
"ts-jest": "^29.1.0",
|
|
40
50
|
"typescript": "^5.0.0"
|
|
41
51
|
},
|