@ue-too/being 0.5.2 → 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/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "@ue-too/being",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.6.0",
5
5
  "exports": {
6
6
  ".": {
7
- "types": "./src/index.ts",
8
- "import": "./src/index.ts",
9
- "default": "./src/index.ts"
7
+ "types": "./index.d.ts",
8
+ "import": "./index.js",
9
+ "default": "./index.js"
10
10
  },
11
11
  "./package.json": "./package.json"
12
12
  },
13
- "main": "./src/index.ts",
14
- "types": "./src/index.ts",
15
- "module": "./src/index.ts",
13
+ "main": "./index.js",
14
+ "types": "./index.d.ts",
15
+ "module": "./index.js",
16
16
  "scripts": {
17
- "test": "jest",
18
- "build": "rm -rf dist && rollup -c rollup.config.js"
17
+ "test": "echo \"Error: no test specified\" && exit 1"
19
18
  }
20
19
  }
@@ -1,2 +0,0 @@
1
- export * from "./interface";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,116 +0,0 @@
1
- export const NO_OP = () => { };
2
- /**
3
- * @description This is the template for the state machine.
4
- *
5
- * You can use this class to create a state machine. Usually this is all you need for the state machine. Unless you need extra functionality.
6
- * To create a state machine, just instantiate this class and pass in the states, initial state and context.
7
- *
8
- * @see {@link createKmtInputStateMachine} for an example of how to create a state machine.
9
- *
10
- * @category being
11
- */
12
- export class TemplateStateMachine {
13
- constructor(states, initialState, context) {
14
- this._timeouts = undefined;
15
- this._states = states;
16
- this._currentState = initialState;
17
- this._context = context;
18
- this._statesArray = Object.keys(states);
19
- this._stateChangeCallbacks = [];
20
- this._happensCallbacks = [];
21
- }
22
- switchTo(state) {
23
- this._currentState = state;
24
- }
25
- // Implementation that handles both cases
26
- happens(event, payload) {
27
- if (this._timeouts) {
28
- clearTimeout(this._timeouts);
29
- }
30
- this._happensCallbacks.forEach(callback => callback(event, payload, this._context));
31
- const nextState = this._states[this._currentState].handles(event, payload, this._context, this);
32
- if (nextState !== undefined && nextState !== this._currentState) {
33
- const originalState = this._currentState;
34
- this._states[this._currentState].beforeExit(this._context, this, nextState);
35
- this.switchTo(nextState);
36
- this._states[this._currentState].uponEnter(this._context, this, originalState);
37
- this._stateChangeCallbacks.forEach(callback => callback(originalState, this._currentState));
38
- }
39
- return nextState;
40
- }
41
- onStateChange(callback) {
42
- this._stateChangeCallbacks.push(callback);
43
- }
44
- onHappens(callback) {
45
- this._happensCallbacks.push(callback);
46
- }
47
- get currentState() {
48
- return this._currentState;
49
- }
50
- setContext(context) {
51
- this._context = context;
52
- }
53
- get possibleStates() {
54
- return this._statesArray;
55
- }
56
- get states() {
57
- return this._states;
58
- }
59
- }
60
- /**
61
- * @description This is the template for the state.
62
- *
63
- * This is a base template that you can extend to create a state.
64
- * Unlike the TemplateStateMachine, this class is abstract. You need to implement the specific methods that you need.
65
- * The core part off the state is the event reactions in which you would define how to handle each event in a state.
66
- * You can define an eventReactions object that maps only the events that you need. If this state does not need to handle a specific event, you can just not define it in the eventReactions object.
67
- *
68
- * @category being
69
- */
70
- export class TemplateState {
71
- constructor() {
72
- this._guards = {};
73
- this._eventGuards = {};
74
- this._delay = undefined;
75
- }
76
- get guards() {
77
- return this._guards;
78
- }
79
- get eventGuards() {
80
- return this._eventGuards;
81
- }
82
- get delay() {
83
- return this._delay;
84
- }
85
- uponEnter(context, stateMachine, from) {
86
- // console.log("enter");
87
- }
88
- beforeExit(context, stateMachine, to) {
89
- // console.log('leave');
90
- }
91
- // Implementation that handles both cases
92
- handles(event, payload, context, stateMachine) {
93
- const eventKey = event;
94
- if (this.eventReactions[eventKey]) {
95
- this.eventReactions[eventKey].action(context, payload, stateMachine);
96
- const targetState = this.eventReactions[eventKey].defaultTargetState;
97
- const guardToEvaluate = this._eventGuards[eventKey];
98
- if (guardToEvaluate) {
99
- const target = guardToEvaluate.find((guard) => {
100
- if (this.guards[guard.guard]) {
101
- return this.guards[guard.guard](context);
102
- }
103
- return false;
104
- });
105
- return target ? target.target : targetState;
106
- }
107
- return targetState;
108
- }
109
- return undefined;
110
- }
111
- }
112
- export function placeHolder() {
113
- return "placeholder";
114
- }
115
- ;
116
- //# sourceMappingURL=interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interface.js","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,KAAK,GAAS,GAAE,EAAE,GAAC,CAAC,CAAC;AA+JlC;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAoB;IAU7B,YAAY,MAAmE,EAAE,YAAoB,EAAE,OAAgB;QAF7G,cAAS,GAA8C,SAAS,CAAC;QAGvE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAa,CAAC;QACpD,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;IAMD,yCAAyC;IACzC,OAAO,CAAC,KAAyC,EAAE,OAAY;QAC3D,IAAG,IAAI,CAAC,SAAS,EAAC,CAAC;YACf,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAkC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,KAAkC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC7H,IAAG,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,aAAa,EAAC,CAAC;YAC5D,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;YACzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;YAC5E,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;YAC/E,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,aAAa,CAAC,QAAqC;QAC/C,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS,CAAC,QAA+H;QACrI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,UAAU,CAAC,OAAgB;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ;AACD;;;;;;;;;GASG;AACH,MAAM,OAAgB,aAAa;IAAnC;QAGc,YAAO,GAAmB,EAAoB,CAAC;QAC/C,iBAAY,GAA+E,EAAgF,CAAC;QAC5K,WAAM,GAA4D,SAAS,CAAC;IA8C1F,CAAC;IA5CG,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,SAAS,CAAC,OAAgB,EAAE,YAAgE,EAAE,IAAY;QACtG,wBAAwB;IAC5B,CAAC;IAED,UAAU,CAAC,OAAgB,EAAE,YAAgE,EAAE,EAAU;QACrG,wBAAwB;IAC5B,CAAC;IAMD,yCAAyC;IACzC,OAAO,CAAC,KAAyC,EAAE,OAAY,EAAE,OAAgB,EAAE,YAAgE;QAC/I,MAAM,QAAQ,GAAG,KAAkC,CAAC;QACpD,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;YACrE,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,kBAAkB,CAAC;YACrE,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YACpD,IAAG,eAAe,EAAC,CAAC;gBAChB,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,EAAC,EAAE;oBACzC,IAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC,CAAC;wBACzB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;oBAC7C,CAAC;oBACD,OAAO,KAAK,CAAC;gBACjB,CAAC,CAAC,CAAC;gBACH,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC;YAChD,CAAC;YACD,OAAO,WAAW,CAAC;QACvB,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAED,MAAM,UAAU,WAAW;IACvB,OAAO,aAAa,CAAC;AACzB,CAAC;AAAA,CAAC"}
@@ -1 +0,0 @@
1
- {"fileNames":["../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.full.d.ts","../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.d.ts","../src/interface.ts","../src/index.ts","../../../node_modules/.pnpm/@jest+expect-utils@29.7.0/node_modules/@jest/expect-utils/build/index.d.ts","../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/index.d.ts","../../../node_modules/.pnpm/@sinclair+typebox@0.27.8/node_modules/@sinclair/typebox/typebox.d.ts","../../../node_modules/.pnpm/@jest+schemas@29.6.3/node_modules/@jest/schemas/build/index.d.ts","../../../node_modules/.pnpm/pretty-format@29.7.0/node_modules/pretty-format/build/index.d.ts","../../../node_modules/.pnpm/jest-diff@29.7.0/node_modules/jest-diff/build/index.d.ts","../../../node_modules/.pnpm/jest-matcher-utils@29.7.0/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.d.ts","../../../node_modules/.pnpm/@types+jest@29.5.14/node_modules/@types/jest/index.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/compatibility/disposable.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/compatibility/indexable.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/compatibility/index.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/file.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/filereader.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@6.20.0/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/dom-events.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/inspector.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/sqlite.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@22.13.4/node_modules/@types/node/index.d.ts"],"fileIdsList":[[69,112],[57,69,112],[59,62,69,112],[69,109,112],[69,111,112],[112],[69,112,117,147],[69,112,113,118,124,125,132,144,155],[69,112,113,114,124,132],[64,65,66,69,112],[69,112,115,156],[69,112,116,117,125,133],[69,112,117,144,152],[69,112,118,120,124,132],[69,111,112,119],[69,112,120,121],[69,112,124],[69,112,122,124],[69,111,112,124],[69,112,124,125,126,144,155],[69,112,124,125,126,139,144,147],[69,107,112,160],[69,107,112,120,124,127,132,144,155],[69,112,124,125,127,128,132,144,152,155],[69,112,127,129,144,152,155],[67,68,69,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161],[69,112,124,130],[69,112,131,155],[69,112,120,124,132,144],[69,112,133],[69,112,134],[69,111,112,135],[69,109,110,111,112,113,114,115,116,117,118,119,120,121,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161],[69,112,137],[69,112,138],[69,112,124,139,140],[69,112,139,141,156,158],[69,112,124,144,145,146,147],[69,112,144,146],[69,112,144,145],[69,112,147],[69,112,148],[69,109,112,144],[69,112,124,150,151],[69,112,150,151],[69,112,117,132,144,152],[69,112,153],[69,112,132,154],[69,112,127,138,155],[69,112,117,156],[69,112,144,157],[69,112,131,158],[69,112,159],[69,112,117,124,126,135,144,155,158,160],[69,112,144,161],[55,61,69,112],[59,69,112],[56,60,69,112],[58,69,112],[69,79,83,112,155],[69,79,112,144,155],[69,74,112],[69,76,79,112,152,155],[69,112,132,152],[69,112,162],[69,74,112,162],[69,76,79,112,132,155],[69,71,72,75,78,112,124,144,155],[69,79,86,112],[69,71,77,112],[69,79,100,101,112],[69,75,79,112,147,155,162],[69,100,112,162],[69,73,74,112,162],[69,79,112],[69,73,74,75,76,77,78,79,80,81,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101,102,103,104,105,106,112],[69,79,94,112],[69,79,86,87,112],[69,77,79,87,88,112],[69,78,112],[69,71,74,79,112],[69,79,83,87,88,112],[69,83,112],[69,77,79,82,112,155],[69,71,76,79,86,112],[69,112,144],[69,74,79,100,112,160,162],[52,53,69,112],[52,69,112]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"69e65d976bf166ce4a9e6f6c18f94d2424bf116e90837ace179610dbccad9b42","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1305d1e76ca44e30fb8b2b8075fa522b83f60c0bcf5d4326a9d2cf79b53724f8","impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},"2460e50cbf2b391fc5bc775c428cc0c4ab26a8eac3357dfd02a254329db7c414","8798c5909b3c4bbf6dd77e770b1f571cde525edf28e64accda6ded5be9c2baac",{"version":"cdcc132f207d097d7d3aa75615ab9a2e71d6a478162dde8b67f88ea19f3e54de","impliedFormat":1},{"version":"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","impliedFormat":1},{"version":"c085e9aa62d1ae1375794c1fb927a445fa105fed891a7e24edbb1c3300f7384a","impliedFormat":1},{"version":"f315e1e65a1f80992f0509e84e4ae2df15ecd9ef73df975f7c98813b71e4c8da","impliedFormat":1},{"version":"5b9586e9b0b6322e5bfbd2c29bd3b8e21ab9d871f82346cb71020e3d84bae73e","impliedFormat":1},{"version":"3e70a7e67c2cb16f8cd49097360c0309fe9d1e3210ff9222e9dac1f8df9d4fb6","impliedFormat":1},{"version":"ab68d2a3e3e8767c3fba8f80de099a1cfc18c0de79e42cb02ae66e22dfe14a66","impliedFormat":1},{"version":"d96cc6598148bf1a98fb2e8dcf01c63a4b3558bdaec6ef35e087fd0562eb40ec","impliedFormat":1},{"version":"f8db4fea512ab759b2223b90ecbbe7dae919c02f8ce95ec03f7fb1cf757cfbeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"030e350db2525514580ed054f712ffb22d273e6bc7eddc1bb7eda1e0ba5d395e","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"a79e62f1e20467e11a904399b8b18b18c0c6eea6b50c1168bf215356d5bebfaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"13af9e8fb6757946c48117315866177b95e554d1e773577bb6ca6e40083b6d73","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"24bd580b5743dc56402c440dc7f9a4f5d592ad7a419f25414d37a7bfe11e342b","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"6bdc71028db658243775263e93a7db2fd2abfce3ca569c3cca5aee6ed5eb186d","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"d2bc987ae352271d0d615a420dcf98cc886aa16b87fb2b569358c1fe0ca0773d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4f0539c58717cbc8b73acb29f9e992ab5ff20adba5f9b57130691c7f9b186a4d","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"76103716ba397bbb61f9fa9c9090dca59f39f9047cb1352b2179c5d8e7f4e8d0","impliedFormat":1},{"version":"53eac70430b30089a3a1959d8306b0f9cfaf0de75224b68ef25243e0b5ad1ca3","affectsGlobalScope":true,"impliedFormat":1},{"version":"4314c7a11517e221f7296b46547dbc4df047115b182f544d072bdccffa57fc72","impliedFormat":1},{"version":"115971d64632ea4742b5b115fb64ed04bcaae2c3c342f13d9ba7e3f9ee39c4e7","impliedFormat":1},{"version":"c2510f124c0293ab80b1777c44d80f812b75612f297b9857406468c0f4dafe29","affectsGlobalScope":true,"impliedFormat":1},{"version":"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb","impliedFormat":1},{"version":"86956cc2eb9dd371d6fab493d326a574afedebf76eef3fa7833b8e0d9b52d6f1","affectsGlobalScope":true,"impliedFormat":1},{"version":"19d5f8d3930e9f99aa2c36258bf95abbe5adf7e889e6181872d1cdba7c9a7dd5","impliedFormat":1},{"version":"e6f5a38687bebe43a4cef426b69d34373ef68be9a6b1538ec0a371e69f309354","impliedFormat":1},{"version":"a6bf63d17324010ca1fbf0389cab83f93389bb0b9a01dc8a346d092f65b3605f","impliedFormat":1},{"version":"e009777bef4b023a999b2e5b9a136ff2cde37dc3f77c744a02840f05b18be8ff","impliedFormat":1},{"version":"1e0d1f8b0adfa0b0330e028c7941b5a98c08b600efe7f14d2d2a00854fb2f393","impliedFormat":1},{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true,"impliedFormat":1},{"version":"88bc59b32d0d5b4e5d9632ac38edea23454057e643684c3c0b94511296f2998c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ff5a53a58e756d2661b73ba60ffe274231a4432d21f7a2d0d9e4f6aa99f4283","impliedFormat":1},{"version":"1e289f30a48126935a5d408a91129a13a59c9b0f8c007a816f9f16ef821e144e","impliedFormat":1},{"version":"2ea254f944dfe131df1264d1fb96e4b1f7d110195b21f1f5dbb68fdd394e5518","impliedFormat":1},{"version":"5135bdd72cc05a8192bd2e92f0914d7fc43ee077d1293dc622a049b7035a0afb","impliedFormat":1},{"version":"4f80de3a11c0d2f1329a72e92c7416b2f7eab14f67e92cac63bb4e8d01c6edc8","impliedFormat":1},{"version":"6d386bc0d7f3afa1d401afc3e00ed6b09205a354a9795196caed937494a713e6","impliedFormat":1},{"version":"b11cb909327c874a4e81bfb390bf0d231e5bf9439052689ab80ba8afa50da17b","affectsGlobalScope":true,"impliedFormat":1},{"version":"23459c1915878a7c1e86e8bdb9c187cddd3aea105b8b1dfce512f093c969bc7e","impliedFormat":1},{"version":"b1b6ee0d012aeebe11d776a155d8979730440082797695fc8e2a5c326285678f","impliedFormat":1},{"version":"45875bcae57270aeb3ebc73a5e3fb4c7b9d91d6b045f107c1d8513c28ece71c0","impliedFormat":1},{"version":"1dc73f8854e5c4506131c4d95b3a6c24d0c80336d3758e95110f4c7b5cb16397","affectsGlobalScope":true,"impliedFormat":1},{"version":"5f6f1d54779d0b9ed152b0516b0958cd34889764c1190434bbf18e7a8bb884cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f16a7e4deafa527ed9995a772bb380eb7d3c2c0fd4ae178c5263ed18394db2c","impliedFormat":1},{"version":"c6b4e0a02545304935ecbf7de7a8e056a31bb50939b5b321c9d50a405b5a0bba","impliedFormat":1},{"version":"fab29e6d649aa074a6b91e3bdf2bff484934a46067f6ee97a30fcd9762ae2213","impliedFormat":1},{"version":"8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","impliedFormat":1},{"version":"e1120271ebbc9952fdc7b2dd3e145560e52e06956345e6fdf91d70ca4886464f","impliedFormat":1},{"version":"814118df420c4e38fe5ae1b9a3bafb6e9c2aa40838e528cde908381867be6466","impliedFormat":1},{"version":"1cbae62b67f180291d211f0e1045fb923a8ec800cfbf9caa13223d769013dae2","impliedFormat":1},{"version":"b52d379b4939681f3781d1cfd5b2c3cbb35e7e76f2425172e165782f8a08228c","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","impliedFormat":1},{"version":"745c4240220559bd340c8aeb6e3c5270a709d3565e934dc22a69c304703956bc","affectsGlobalScope":true,"impliedFormat":1},{"version":"2754d8221d77c7b382096651925eb476f1066b3348da4b73fe71ced7801edada","impliedFormat":1},{"version":"993985beef40c7d113f6dd8f0ba26eed63028b691fbfeb6a5b63f26408dd2c6d","affectsGlobalScope":true,"impliedFormat":1},{"version":"bef91efa0baea5d0e0f0f27b574a8bc100ce62a6d7e70220a0d58af6acab5e89","affectsGlobalScope":true,"impliedFormat":1},{"version":"282fd2a1268a25345b830497b4b7bf5037a5e04f6a9c44c840cb605e19fea841","impliedFormat":1},{"version":"5360a27d3ebca11b224d7d3e38e3e2c63f8290cb1fcf6c3610401898f8e68bc3","impliedFormat":1},{"version":"66ba1b2c3e3a3644a1011cd530fb444a96b1b2dfe2f5e837a002d41a1a799e60","impliedFormat":1},{"version":"7e514f5b852fdbc166b539fdd1f4e9114f29911592a5eb10a94bb3a13ccac3c4","impliedFormat":1},{"version":"7d6ff413e198d25639f9f01f16673e7df4e4bd2875a42455afd4ecc02ef156da","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb094bb347d7df3380299eb69836c2c8758626ecf45917577707c03cf816b6f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"f689c4237b70ae6be5f0e4180e8833f34ace40529d1acc0676ab8fb8f70457d7","impliedFormat":1},{"version":"b02784111b3fc9c38590cd4339ff8718f9329a6f4d3fd66e9744a1dcd1d7e191","impliedFormat":1},{"version":"ac5ed35e649cdd8143131964336ab9076937fa91802ec760b3ea63b59175c10a","impliedFormat":1},{"version":"52a8e7e8a1454b6d1b5ad428efae3870ffc56f2c02d923467f2940c454aa9aec","affectsGlobalScope":true,"impliedFormat":1},{"version":"78dc0513cc4f1642906b74dda42146bcbd9df7401717d6e89ea6d72d12ecb539","impliedFormat":1},{"version":"ad90122e1cb599b3bc06a11710eb5489101be678f2920f2322b0ac3e195af78d","impliedFormat":1}],"root":[53,54],"options":{"composite":true,"declaration":true,"declarationMap":false,"emitDeclarationOnly":false,"esModuleInterop":true,"importHelpers":true,"module":99,"noEmitHelpers":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":false,"target":7,"tsBuildInfoFile":"./being.tsbuildinfo"},"referencedMap":[[55,1],[58,2],[57,1],[63,3],[109,4],[110,4],[111,5],[69,6],[112,7],[113,8],[114,9],[64,1],[67,10],[65,1],[66,1],[115,11],[116,12],[117,13],[118,14],[119,15],[120,16],[121,16],[123,17],[122,18],[124,19],[125,20],[126,21],[108,22],[68,1],[127,23],[128,24],[129,25],[162,26],[130,27],[131,28],[132,29],[133,30],[134,31],[135,32],[136,33],[137,34],[138,35],[139,36],[140,36],[141,37],[142,1],[143,1],[144,38],[146,39],[145,40],[147,41],[148,42],[149,43],[150,44],[151,45],[152,46],[153,47],[154,48],[155,49],[156,50],[157,51],[158,52],[159,53],[160,54],[161,55],[70,1],[56,1],[62,56],[60,57],[61,58],[59,59],[52,1],[49,1],[50,1],[10,1],[8,1],[9,1],[14,1],[13,1],[2,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[22,1],[3,1],[23,1],[24,1],[4,1],[25,1],[29,1],[26,1],[27,1],[28,1],[30,1],[31,1],[32,1],[5,1],[33,1],[34,1],[35,1],[36,1],[6,1],[40,1],[37,1],[38,1],[39,1],[41,1],[7,1],[42,1],[51,1],[47,1],[48,1],[43,1],[44,1],[45,1],[46,1],[1,1],[12,1],[11,1],[86,60],[96,61],[85,60],[106,62],[77,63],[76,64],[105,65],[99,66],[104,67],[79,68],[93,69],[78,70],[102,71],[74,72],[73,65],[103,73],[75,74],[80,75],[81,1],[84,75],[71,1],[107,76],[97,77],[88,78],[89,79],[91,80],[87,81],[90,82],[100,65],[82,83],[83,84],[92,85],[72,86],[95,77],[94,75],[98,1],[101,87],[54,88],[53,89]],"emitSignatures":[[53,"059dbac92226173c88dfa23aae28bc77af048f4d202df410adb552944807edd3"]],"latestChangedDtsFile":"./index.d.ts","version":"5.7.3"}
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./interface";
@@ -1,203 +0,0 @@
1
- export interface BaseContext {
2
- setup(): void;
3
- cleanup(): void;
4
- }
5
- type NOOP = () => void;
6
- export declare const NO_OP: NOOP;
7
- /**
8
- * @description This is the interface for the state machine. The interface takes in a few generic parameters.
9
- *
10
- * Generic parameters:
11
- * - EventPayloadMapping: A mapping of events to their payloads.
12
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
13
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
14
- *
15
- * You can probably get by using the TemplateStateMachine class.
16
- * The naming is that an event would "happen" and the state of the state machine would "handle" it.
17
- *
18
- * @see {@link TemplateStateMachine}
19
- * @see {@link KmtInputStateMachine}
20
- *
21
- * @category being
22
- */
23
- export interface StateMachine<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> {
24
- switchTo(state: States): void;
25
- happens<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K]): States | undefined;
26
- happens(event: string, payload: any): States | undefined;
27
- setContext(context: Context): void;
28
- states: Record<States, State<EventPayloadMapping, Context, string extends States ? string : States>>;
29
- onStateChange(callback: StateChangeCallback<States>): void;
30
- possibleStates: States[];
31
- onHappens(callback: (event: keyof EventPayloadMapping, payload: EventPayloadMapping[keyof EventPayloadMapping], context: Context) => void): void;
32
- }
33
- /**
34
- * @description This is the type for the callback that is called when the state changes.
35
- *
36
- * @category being
37
- */
38
- export type StateChangeCallback<States extends string = 'IDLE'> = (currentState: States, nextState: States) => void;
39
- /**
40
- * @description This is the interface for the state. The interface takes in a few generic parameters:
41
- * You can probably get by extending the TemplateState class.
42
- *
43
- * Generic parameters:
44
- * - EventPayloadMapping: A mapping of events to their payloads.
45
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
46
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
47
- *
48
- * A state's all possible states can be only a subset of the possible states of the state machine. (a state only needs to know what states it can transition to)
49
- * This allows for a state to be reusable across different state machines.
50
- *
51
- * @see {@link TemplateState}
52
- *
53
- * @category being
54
- */
55
- export interface State<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> {
56
- uponEnter(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, from: States): void;
57
- beforeExit(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, to: States): void;
58
- handles<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K], context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
59
- handles(event: string, payload: any, context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
60
- eventReactions: EventReactions<EventPayloadMapping, Context, States>;
61
- guards: Guard<Context>;
62
- eventGuards: Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>>;
63
- delay: Delay<Context, EventPayloadMapping, States> | undefined;
64
- }
65
- /**
66
- * @description This is the type for the event reactions of a state.
67
- *
68
- * Generic parameters:
69
- * - EventPayloadMapping: A mapping of events to their payloads.
70
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
71
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
72
- *
73
- * @category being
74
- */
75
- export type EventReactions<EventPayloadMapping, Context extends BaseContext, States extends string> = {
76
- [K in keyof Partial<EventPayloadMapping>]: {
77
- action: (context: Context, event: EventPayloadMapping[K], stateMachine: StateMachine<EventPayloadMapping, Context, States>) => void;
78
- defaultTargetState: States;
79
- };
80
- };
81
- /**
82
- * @description This is the type for the guard evaluation when a state transition is happening.
83
- *
84
- * Guard evaluations are evaluated after the state has handled the event with the action.
85
- * Guard evaluations can be defined in an array and the first guard that evaluates to true will be used to determine the next state.
86
- *
87
- * Generic parameters:
88
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
89
- *
90
- * @category being
91
- */
92
- export type GuardEvaluation<Context extends BaseContext> = (context: Context) => boolean;
93
- /**
94
- * @description This is the type for the guard of a state.
95
- *
96
- * guard is an object that maps a key to a guard evaluation.
97
- * K is all the possible keys that can be used to evaluate the guard.
98
- * K is optional but if it is not provided, typescript won't be able to type guard in the EventGuards type.
99
- *
100
- * @category being
101
- */
102
- export type Guard<Context extends BaseContext, K extends string = string> = {
103
- [P in K]: GuardEvaluation<Context>;
104
- };
105
- export type Action<Context extends BaseContext, EventPayloadMapping, States extends string> = {
106
- action: (context: Context, event: EventPayloadMapping[keyof EventPayloadMapping], stateMachine: StateMachine<EventPayloadMapping, Context, States>) => void;
107
- defaultTargetState: States;
108
- };
109
- export type Delay<Context extends BaseContext, EventPayloadMapping, States extends string> = {
110
- time: number;
111
- action: Action<Context, EventPayloadMapping, States>;
112
- };
113
- /**
114
- * @description This is a mapping of a guard to a target state.
115
- *
116
- * Generic parameters:
117
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
118
- * - G: The guard type.
119
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
120
- *
121
- * You probably don't need to use this type directly.
122
- *
123
- * @see {@link TemplateState['eventGuards']}
124
- *
125
- * @category being
126
- */
127
- export type GuardMapping<Context extends BaseContext, G, States extends string> = {
128
- guard: G extends Guard<Context, infer K> ? K : never;
129
- target: States;
130
- };
131
- /**
132
- * @description This is a mapping of an event to a guard evaluation.
133
- *
134
- * Generic parameters:
135
- * - EventPayloadMapping: A mapping of events to their payloads.
136
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
137
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
138
- * - T: The guard type.
139
- *
140
- * You probably don't need to use this type directly.
141
- * This is a mapping of an event to a guard evaluation.
142
- *
143
- * @see {@link TemplateState['eventGuards']}
144
- *
145
- * @category being
146
- */
147
- export type EventGuards<EventPayloadMapping, States extends string, Context extends BaseContext, T extends Guard<Context>> = {
148
- [K in keyof EventPayloadMapping]: GuardMapping<Context, T, States>[];
149
- };
150
- /**
151
- * @description This is the template for the state machine.
152
- *
153
- * You can use this class to create a state machine. Usually this is all you need for the state machine. Unless you need extra functionality.
154
- * To create a state machine, just instantiate this class and pass in the states, initial state and context.
155
- *
156
- * @see {@link createKmtInputStateMachine} for an example of how to create a state machine.
157
- *
158
- * @category being
159
- */
160
- export declare class TemplateStateMachine<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> implements StateMachine<EventPayloadMapping, Context, States> {
161
- protected _currentState: States;
162
- protected _states: Record<States, State<EventPayloadMapping, Context, States>>;
163
- protected _context: Context;
164
- protected _statesArray: States[];
165
- protected _stateChangeCallbacks: StateChangeCallback<States>[];
166
- protected _happensCallbacks: ((event: keyof EventPayloadMapping, payload: EventPayloadMapping[keyof EventPayloadMapping], context: Context) => void)[];
167
- protected _timeouts: ReturnType<typeof setTimeout> | undefined;
168
- constructor(states: Record<States, State<EventPayloadMapping, Context, States>>, initialState: States, context: Context);
169
- switchTo(state: States): void;
170
- happens<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K]): States | undefined;
171
- happens(event: string, payload: any): States | undefined;
172
- onStateChange(callback: StateChangeCallback<States>): void;
173
- onHappens(callback: (event: keyof EventPayloadMapping, payload: EventPayloadMapping[keyof EventPayloadMapping], context: Context) => void): void;
174
- get currentState(): States;
175
- setContext(context: Context): void;
176
- get possibleStates(): States[];
177
- get states(): Record<States, State<EventPayloadMapping, Context, States>>;
178
- }
179
- /**
180
- * @description This is the template for the state.
181
- *
182
- * This is a base template that you can extend to create a state.
183
- * Unlike the TemplateStateMachine, this class is abstract. You need to implement the specific methods that you need.
184
- * The core part off the state is the event reactions in which you would define how to handle each event in a state.
185
- * You can define an eventReactions object that maps only the events that you need. If this state does not need to handle a specific event, you can just not define it in the eventReactions object.
186
- *
187
- * @category being
188
- */
189
- export declare abstract class TemplateState<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> implements State<EventPayloadMapping, Context, States> {
190
- abstract eventReactions: EventReactions<EventPayloadMapping, Context, States>;
191
- protected _guards: Guard<Context>;
192
- protected _eventGuards: Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>>;
193
- protected _delay: Delay<Context, EventPayloadMapping, States> | undefined;
194
- get guards(): Guard<Context>;
195
- get eventGuards(): Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>>;
196
- get delay(): Delay<Context, EventPayloadMapping, States> | undefined;
197
- uponEnter(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, from: States): void;
198
- beforeExit(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, to: States): void;
199
- handles<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K], context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
200
- handles(event: string, payload: any, context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
201
- }
202
- export declare function placeHolder(): string;
203
- export {};
package/dist/package.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "name": "@ue-too/being",
3
- "type": "module",
4
- "version": "0.5.2",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
7
- },
8
- "exports": {
9
- ".": {
10
- "types": "./index.d.ts",
11
- "import": "./index.js",
12
- "default": "./index.js"
13
- },
14
- "./package.json": "./package.json"
15
- },
16
- "main": "./index.js",
17
- "types": "./index.d.ts",
18
- "module": "./index.js"
19
- }
package/jest.config.js DELETED
@@ -1,18 +0,0 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} */
2
- export default {
3
- preset: 'ts-jest',
4
- testEnvironment: 'node',
5
- rootDir: '.',
6
- testMatch: ['<rootDir>/test/**/*.test.ts'],
7
- moduleFileExtensions: ['ts', 'js'],
8
- extensionsToTreatAsEsm: ['.ts'],
9
- transform: {
10
- '^.+\\.ts$': ['ts-jest', {
11
- useESM: true,
12
- tsconfig: 'tsconfig.spec.json'
13
- }]
14
- },
15
- moduleNameMapper: {
16
- '^@ue-too/(.*)$': '<rootDir>/../$1/src'
17
- }
18
- };
package/project.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "name": "being",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/being/src",
5
- "projectType": "library",
6
- "targets": {
7
- "build": {
8
- "executor": "nx:run-commands",
9
- "options": {
10
- "command": "pnpm build",
11
- "cwd": "packages/being"
12
- }
13
- },
14
- "move-package": {
15
- "executor": "nx:run-commands",
16
- "options": {
17
- "command": "node ../../scripts/move-package.mjs",
18
- "cwd": "packages/being"
19
- }
20
- },
21
- "test": {
22
- "executor": "nx:run-commands",
23
- "options": {
24
- "command": "pnpm test",
25
- "cwd": "packages/being"
26
- }
27
- }
28
- },
29
- "tags": []
30
- }
package/rollup.config.js DELETED
@@ -1,20 +0,0 @@
1
- /**
2
- * @type {import('rollup').RollupOptions}
3
- */
4
- import typescript from '@rollup/plugin-typescript';
5
-
6
- export default {
7
- input: 'src/index.ts',
8
- output: {
9
- file: 'dist/index.js',
10
- format: 'esm',
11
- sourcemap: true
12
- },
13
- plugins: [
14
- typescript({
15
- tsconfig: 'tsconfig.json',
16
- outputToFilesystem: true,
17
- })
18
- ],
19
- external: ['@ue-too/math']
20
- };
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./interface";
package/src/interface.ts DELETED
@@ -1,310 +0,0 @@
1
- export interface BaseContext {
2
- setup(): void;
3
- cleanup(): void;
4
- }
5
-
6
- type NOOP = () => void;
7
-
8
- export const NO_OP: NOOP = ()=>{};
9
-
10
- /**
11
- * @description This is the interface for the state machine. The interface takes in a few generic parameters.
12
- *
13
- * Generic parameters:
14
- * - EventPayloadMapping: A mapping of events to their payloads.
15
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
16
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
17
- *
18
- * You can probably get by using the TemplateStateMachine class.
19
- * The naming is that an event would "happen" and the state of the state machine would "handle" it.
20
- *
21
- * @see {@link TemplateStateMachine}
22
- * @see {@link KmtInputStateMachine}
23
- *
24
- * @category being
25
- */
26
- export interface StateMachine<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> {
27
- switchTo(state: States): void;
28
- // Overload for known events - maintains type inference
29
- happens<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K]): States | undefined;
30
- // Overload for unknown events - accepts any event and payload
31
- happens(event: string, payload: any): States | undefined;
32
- setContext(context: Context): void;
33
- states: Record<States, State<EventPayloadMapping, Context, string extends States ? string : States>>;
34
- onStateChange(callback: StateChangeCallback<States>): void;
35
- possibleStates: States[];
36
- onHappens(callback: (event: keyof EventPayloadMapping, payload: EventPayloadMapping[keyof EventPayloadMapping], context: Context) => void): void;
37
- }
38
-
39
- /**
40
- * @description This is the type for the callback that is called when the state changes.
41
- *
42
- * @category being
43
- */
44
- export type StateChangeCallback<States extends string = 'IDLE'> = (currentState: States, nextState: States) => void;
45
-
46
- /**
47
- * @description This is the interface for the state. The interface takes in a few generic parameters:
48
- * You can probably get by extending the TemplateState class.
49
- *
50
- * Generic parameters:
51
- * - EventPayloadMapping: A mapping of events to their payloads.
52
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
53
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
54
- *
55
- * A state's all possible states can be only a subset of the possible states of the state machine. (a state only needs to know what states it can transition to)
56
- * This allows for a state to be reusable across different state machines.
57
- *
58
- * @see {@link TemplateState}
59
- *
60
- * @category being
61
- */
62
- export interface State<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> {
63
- uponEnter(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, from: States): void;
64
- beforeExit(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, to: States): void;
65
- // Overload for known events - maintains type inference
66
- handles<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K], context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
67
- // Overload for unknown events - accepts any event and payload
68
- handles(event: string, payload: any, context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
69
- eventReactions: EventReactions<EventPayloadMapping, Context, States>;
70
- guards: Guard<Context>;
71
- eventGuards: Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>>;
72
- delay: Delay<Context, EventPayloadMapping, States> | undefined;
73
- }
74
-
75
- /**
76
- * @description This is the type for the event reactions of a state.
77
- *
78
- * Generic parameters:
79
- * - EventPayloadMapping: A mapping of events to their payloads.
80
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
81
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
82
- *
83
- * @category being
84
- */
85
- export type EventReactions<EventPayloadMapping, Context extends BaseContext, States extends string> = {
86
- [K in keyof Partial<EventPayloadMapping>]: {
87
- action: (context: Context, event: EventPayloadMapping[K], stateMachine: StateMachine<EventPayloadMapping, Context, States>) => void;
88
- defaultTargetState: States;
89
- };
90
- };
91
-
92
- /**
93
- * @description This is the type for the guard evaluation when a state transition is happening.
94
- *
95
- * Guard evaluations are evaluated after the state has handled the event with the action.
96
- * Guard evaluations can be defined in an array and the first guard that evaluates to true will be used to determine the next state.
97
- *
98
- * Generic parameters:
99
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
100
- *
101
- * @category being
102
- */
103
- export type GuardEvaluation<Context extends BaseContext> = (context: Context) => boolean;
104
-
105
- /**
106
- * @description This is the type for the guard of a state.
107
- *
108
- * guard is an object that maps a key to a guard evaluation.
109
- * K is all the possible keys that can be used to evaluate the guard.
110
- * K is optional but if it is not provided, typescript won't be able to type guard in the EventGuards type.
111
- *
112
- * @category being
113
- */
114
- export type Guard<Context extends BaseContext, K extends string = string> = {
115
- [P in K]: GuardEvaluation<Context>;
116
- }
117
-
118
- export type Action<Context extends BaseContext, EventPayloadMapping, States extends string> = {
119
- action: (context: Context, event: EventPayloadMapping[keyof EventPayloadMapping], stateMachine: StateMachine<EventPayloadMapping, Context, States>) => void;
120
- defaultTargetState: States;
121
- }
122
-
123
- export type Delay<Context extends BaseContext, EventPayloadMapping, States extends string> = {
124
- time: number;
125
- action: Action<Context, EventPayloadMapping, States>;
126
- }
127
-
128
- /**
129
- * @description This is a mapping of a guard to a target state.
130
- *
131
- * Generic parameters:
132
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
133
- * - G: The guard type.
134
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
135
- *
136
- * You probably don't need to use this type directly.
137
- *
138
- * @see {@link TemplateState['eventGuards']}
139
- *
140
- * @category being
141
- */
142
- export type GuardMapping<Context extends BaseContext, G, States extends string> = {
143
- guard: G extends Guard<Context, infer K> ? K : never;
144
- target: States;
145
- }
146
-
147
- /**
148
- * @description This is a mapping of an event to a guard evaluation.
149
- *
150
- * Generic parameters:
151
- * - EventPayloadMapping: A mapping of events to their payloads.
152
- * - States: All of the possible states that the state machine can be in. e.g. a string literal union like "IDLE" | "SELECTING" | "PAN" | "ZOOM"
153
- * - Context: The context of the state machine. (which can be used by each state to do calculations that would persist across states)
154
- * - T: The guard type.
155
- *
156
- * You probably don't need to use this type directly.
157
- * This is a mapping of an event to a guard evaluation.
158
- *
159
- * @see {@link TemplateState['eventGuards']}
160
- *
161
- * @category being
162
- */
163
- export type EventGuards<EventPayloadMapping, States extends string, Context extends BaseContext, T extends Guard<Context>> = {
164
- [K in keyof EventPayloadMapping]: GuardMapping<Context, T, States>[];
165
- }
166
-
167
- /**
168
- * @description This is the template for the state machine.
169
- *
170
- * You can use this class to create a state machine. Usually this is all you need for the state machine. Unless you need extra functionality.
171
- * To create a state machine, just instantiate this class and pass in the states, initial state and context.
172
- *
173
- * @see {@link createKmtInputStateMachine} for an example of how to create a state machine.
174
- *
175
- * @category being
176
- */
177
- export class TemplateStateMachine<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> implements StateMachine<EventPayloadMapping, Context, States> {
178
-
179
- protected _currentState: States;
180
- protected _states: Record<States, State<EventPayloadMapping, Context, States>>;
181
- protected _context: Context;
182
- protected _statesArray: States[];
183
- protected _stateChangeCallbacks: StateChangeCallback<States>[];
184
- protected _happensCallbacks: ((event: keyof EventPayloadMapping, payload: EventPayloadMapping[keyof EventPayloadMapping], context: Context) => void)[];
185
- protected _timeouts: ReturnType<typeof setTimeout> | undefined = undefined;
186
-
187
- constructor(states: Record<States, State<EventPayloadMapping, Context, States>>, initialState: States, context: Context){
188
- this._states = states;
189
- this._currentState = initialState;
190
- this._context = context;
191
- this._statesArray = Object.keys(states) as States[];
192
- this._stateChangeCallbacks = [];
193
- this._happensCallbacks = [];
194
- }
195
-
196
- switchTo(state: States): void {
197
- this._currentState = state;
198
- }
199
-
200
- // Overload for known events - maintains type inference
201
- happens<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K]): States | undefined;
202
- // Overload for unknown events - accepts any event and payload
203
- happens(event: string, payload: any): States | undefined;
204
- // Implementation that handles both cases
205
- happens(event: keyof EventPayloadMapping | string, payload: any): States | undefined {
206
- if(this._timeouts){
207
- clearTimeout(this._timeouts);
208
- }
209
- this._happensCallbacks.forEach(callback => callback(event as keyof EventPayloadMapping, payload, this._context));
210
- const nextState = this._states[this._currentState].handles(event as keyof EventPayloadMapping, payload, this._context, this);
211
- if(nextState !== undefined && nextState !== this._currentState){
212
- const originalState = this._currentState;
213
- this._states[this._currentState].beforeExit(this._context, this, nextState);
214
- this.switchTo(nextState);
215
- this._states[this._currentState].uponEnter(this._context, this, originalState);
216
- this._stateChangeCallbacks.forEach(callback => callback(originalState, this._currentState));
217
- }
218
- return nextState;
219
- }
220
-
221
- onStateChange(callback: StateChangeCallback<States>): void {
222
- this._stateChangeCallbacks.push(callback);
223
- }
224
-
225
- onHappens(callback: (event: keyof EventPayloadMapping, payload: EventPayloadMapping[keyof EventPayloadMapping], context: Context) => void): void {
226
- this._happensCallbacks.push(callback);
227
- }
228
-
229
- get currentState(): States {
230
- return this._currentState;
231
- }
232
-
233
- setContext(context: Context): void {
234
- this._context = context;
235
- }
236
-
237
- get possibleStates(): States[] {
238
- return this._statesArray;
239
- }
240
-
241
- get states(): Record<States, State<EventPayloadMapping, Context, States>> {
242
- return this._states;
243
- }
244
- }
245
- /**
246
- * @description This is the template for the state.
247
- *
248
- * This is a base template that you can extend to create a state.
249
- * Unlike the TemplateStateMachine, this class is abstract. You need to implement the specific methods that you need.
250
- * The core part off the state is the event reactions in which you would define how to handle each event in a state.
251
- * You can define an eventReactions object that maps only the events that you need. If this state does not need to handle a specific event, you can just not define it in the eventReactions object.
252
- *
253
- * @category being
254
- */
255
- export abstract class TemplateState<EventPayloadMapping, Context extends BaseContext, States extends string = 'IDLE'> implements State<EventPayloadMapping, Context, States> {
256
-
257
- public abstract eventReactions: EventReactions<EventPayloadMapping, Context, States>;
258
- protected _guards: Guard<Context> = {} as Guard<Context>;
259
- protected _eventGuards: Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>> = {} as Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>>;
260
- protected _delay: Delay<Context, EventPayloadMapping, States> | undefined = undefined;
261
-
262
- get guards(): Guard<Context> {
263
- return this._guards;
264
- }
265
-
266
- get eventGuards(): Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>> {
267
- return this._eventGuards;
268
- }
269
-
270
- get delay(): Delay<Context, EventPayloadMapping, States> | undefined {
271
- return this._delay;
272
- }
273
-
274
- uponEnter(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, from: States): void {
275
- // console.log("enter");
276
- }
277
-
278
- beforeExit(context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>, to: States): void {
279
- // console.log('leave');
280
- }
281
-
282
- // Overload for known events - maintains type inference
283
- handles<K extends keyof EventPayloadMapping>(event: K, payload: EventPayloadMapping[K], context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
284
- // Overload for unknown events - accepts any event and payload
285
- handles(event: string, payload: any, context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined;
286
- // Implementation that handles both cases
287
- handles(event: keyof EventPayloadMapping | string, payload: any, context: Context, stateMachine: StateMachine<EventPayloadMapping, Context, States>): States | undefined {
288
- const eventKey = event as keyof EventPayloadMapping;
289
- if (this.eventReactions[eventKey]) {
290
- this.eventReactions[eventKey].action(context, payload, stateMachine);
291
- const targetState = this.eventReactions[eventKey].defaultTargetState;
292
- const guardToEvaluate = this._eventGuards[eventKey];
293
- if(guardToEvaluate){
294
- const target = guardToEvaluate.find((guard)=>{
295
- if(this.guards[guard.guard]){
296
- return this.guards[guard.guard](context);
297
- }
298
- return false;
299
- });
300
- return target ? target.target : targetState;
301
- }
302
- return targetState;
303
- }
304
- return undefined;
305
- }
306
- }
307
-
308
- export function placeHolder(){
309
- return "placeholder";
310
- };
@@ -1,111 +0,0 @@
1
- import { TemplateStateMachine, TemplateState, BaseContext, EventReactions } from "../src/interface";
2
-
3
- type TestStates = "IDLE" | "FIRST" | "SECOND";
4
-
5
- type TestEventPayloadMapping = {
6
- "EVENT_1": {
7
- };
8
- "EVENT_2": {
9
- };
10
- }
11
-
12
- const testContext: BaseContext = {
13
- setup: ()=>{},
14
- cleanup: ()=>{}
15
- }
16
-
17
- class IdleState extends TemplateState<TestEventPayloadMapping, BaseContext, TestStates> {
18
- eventReactions: EventReactions<TestEventPayloadMapping, BaseContext, TestStates> = {
19
- "EVENT_1": {
20
- action: ()=>{},
21
- defaultTargetState: "FIRST"
22
- }
23
- }
24
- }
25
-
26
- class FirstState extends TemplateState<TestEventPayloadMapping, BaseContext, TestStates> {
27
- eventReactions: EventReactions<TestEventPayloadMapping, BaseContext, TestStates> = {
28
- "EVENT_2": {
29
- action: ()=>{},
30
- defaultTargetState: "SECOND"
31
- }
32
- }
33
- }
34
-
35
- class SecondState extends TemplateState<TestEventPayloadMapping, BaseContext, TestStates> {
36
- eventReactions: EventReactions<TestEventPayloadMapping, BaseContext, TestStates> = {
37
- "EVENT_1": {
38
- action: ()=>{},
39
- defaultTargetState: "IDLE"
40
- }
41
- }
42
- }
43
-
44
- describe("being", ()=>{
45
- it("should be able to switch to a new state", ()=>{
46
- const stateMachine = new TemplateStateMachine({
47
- "IDLE": new IdleState(),
48
- "FIRST": new FirstState(),
49
- "SECOND": new SecondState()
50
- }, "IDLE", testContext);
51
-
52
- stateMachine.happens("EVENT_1", testContext);
53
- expect(stateMachine.currentState).toBe("FIRST");
54
- });
55
-
56
- it("should call the action when event occurs", () => {
57
- const mockAction = jest.fn();
58
- const idleState = new IdleState();
59
- (idleState.eventReactions["EVENT_1"] as any).action = mockAction;
60
- idleState.beforeExit = jest.fn();
61
- idleState.uponEnter = jest.fn();
62
-
63
- const firstState = new FirstState();
64
- firstState.beforeExit = jest.fn();
65
- firstState.uponEnter = jest.fn();
66
-
67
- const stateMachine = new TemplateStateMachine({
68
- "IDLE": idleState,
69
- "FIRST": firstState,
70
- "SECOND": new SecondState()
71
- }, "IDLE", testContext);
72
-
73
- stateMachine.happens("EVENT_1", testContext);
74
- expect(mockAction).toHaveBeenCalled();
75
- expect(idleState.beforeExit).toHaveBeenCalledWith(testContext, stateMachine, "FIRST");
76
- expect(firstState.uponEnter).toHaveBeenCalledWith(testContext, stateMachine, "IDLE");
77
- });
78
-
79
- it("should call the beforeExit and uponEnter functions when the state changes with the correct context and source and target states", ()=>{
80
- const mockAction = jest.fn();
81
- const idleState = new IdleState();
82
- (idleState.eventReactions["EVENT_1"] as any).action = mockAction;
83
- idleState.beforeExit = jest.fn();
84
- idleState.uponEnter = jest.fn();
85
-
86
- const firstState = new FirstState();
87
- firstState.beforeExit = jest.fn();
88
- firstState.uponEnter = jest.fn();
89
-
90
- const stateMachine = new TemplateStateMachine({
91
- "IDLE": idleState,
92
- "FIRST": firstState,
93
- "SECOND": new SecondState()
94
- }, "IDLE", testContext);
95
-
96
- stateMachine.happens("EVENT_1", testContext);
97
- expect(idleState.beforeExit).toHaveBeenCalledWith(testContext, stateMachine, "FIRST");
98
- expect(firstState.uponEnter).toHaveBeenCalledWith(testContext, stateMachine, "IDLE");
99
- });
100
-
101
- it("should be able to handle unknown events", ()=>{
102
- const stateMachine = new TemplateStateMachine({
103
- "IDLE": new IdleState(),
104
- "FIRST": new FirstState(),
105
- "SECOND": new SecondState()
106
- }, "IDLE", testContext);
107
-
108
- stateMachine.happens("EVENT_3", testContext);
109
- expect(stateMachine.currentState).toBe("IDLE");
110
- });
111
- });
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "baseUrl": ".",
6
- "outDir": "dist",
7
- "tsBuildInfoFile": "dist/being.tsbuildinfo",
8
- "declaration": true,
9
- "module": "ESNext",
10
- "moduleResolution": "node"
11
- },
12
- "include": ["src/**/*"]
13
- }
14
-
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "baseUrl": ".",
6
- "outDir": "dist",
7
- "tsBuildInfoFile": "dist/being.tsbuildinfo",
8
- "declaration": true
9
- },
10
- "include": ["test/**/*"]
11
- }
12
-
File without changes
File without changes