@obinexusltd/obix-sdk-state 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/package.json +29 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBIX State - State machine minimization (automata-based state management)
|
|
3
|
+
* Efficient state management using automata-based algorithms
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Automaton type for state classification
|
|
7
|
+
*/
|
|
8
|
+
export type AutomatonType = "DFA" | "NFA" | "Moore" | "Mealy";
|
|
9
|
+
/**
|
|
10
|
+
* State definition in the state machine
|
|
11
|
+
*/
|
|
12
|
+
export interface State {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
onEnter?: () => void;
|
|
17
|
+
onExit?: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Transition between states
|
|
21
|
+
*/
|
|
22
|
+
export interface Transition {
|
|
23
|
+
from: string;
|
|
24
|
+
to: string;
|
|
25
|
+
event: string;
|
|
26
|
+
guard?: () => boolean;
|
|
27
|
+
action?: () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* State machine minimization result
|
|
31
|
+
*/
|
|
32
|
+
export interface MinimizationResult {
|
|
33
|
+
originalStateCount: number;
|
|
34
|
+
minimizedStateCount: number;
|
|
35
|
+
reduction: number;
|
|
36
|
+
equivalentStates: Map<string, string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* State machine configuration
|
|
40
|
+
*/
|
|
41
|
+
export interface StateMachineConfig {
|
|
42
|
+
initialState: string;
|
|
43
|
+
states: State[];
|
|
44
|
+
transitions: Transition[];
|
|
45
|
+
acceptingStates?: string[];
|
|
46
|
+
automatonType?: AutomatonType;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* State machine interface
|
|
50
|
+
*/
|
|
51
|
+
export interface StateMachine {
|
|
52
|
+
transition(event: string): boolean;
|
|
53
|
+
minimize(): MinimizationResult;
|
|
54
|
+
getStates(): State[];
|
|
55
|
+
isAccepting(): boolean;
|
|
56
|
+
serialize(): string;
|
|
57
|
+
merge(other: StateMachine): StateMachine;
|
|
58
|
+
getCurrentState(): State | undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a state machine instance
|
|
62
|
+
*/
|
|
63
|
+
export declare function createStateMachine(config: StateMachineConfig): StateMachine;
|
|
64
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,QAAQ,IAAI,kBAAkB,CAAC;IAC/B,SAAS,IAAI,KAAK,EAAE,CAAC;IACrB,WAAW,IAAI,OAAO,CAAC;IACvB,SAAS,IAAI,MAAM,CAAC;IACpB,KAAK,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAAC;IACzC,eAAe,IAAI,KAAK,GAAG,SAAS,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAwB3E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBIX State - State machine minimization (automata-based state management)
|
|
3
|
+
* Efficient state management using automata-based algorithms
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Create a state machine instance
|
|
7
|
+
*/
|
|
8
|
+
export function createStateMachine(config) {
|
|
9
|
+
return {
|
|
10
|
+
transition(event) {
|
|
11
|
+
throw new Error("Not yet implemented");
|
|
12
|
+
},
|
|
13
|
+
minimize() {
|
|
14
|
+
throw new Error("Not yet implemented");
|
|
15
|
+
},
|
|
16
|
+
getStates() {
|
|
17
|
+
throw new Error("Not yet implemented");
|
|
18
|
+
},
|
|
19
|
+
isAccepting() {
|
|
20
|
+
throw new Error("Not yet implemented");
|
|
21
|
+
},
|
|
22
|
+
serialize() {
|
|
23
|
+
throw new Error("Not yet implemented");
|
|
24
|
+
},
|
|
25
|
+
merge(other) {
|
|
26
|
+
throw new Error("Not yet implemented");
|
|
27
|
+
},
|
|
28
|
+
getCurrentState() {
|
|
29
|
+
throw new Error("Not yet implemented");
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+DH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA0B;IAC3D,OAAO;QACL,UAAU,CAAC,KAAa;YACtB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,QAAQ;YACN,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,SAAS;YACP,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,WAAW;YACT,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,SAAS;YACP,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,CAAC,KAAmB;YACvB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,eAAe;YACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@obinexusltd/obix-sdk-state",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OBIX State - State machine minimization (automata-based state management)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "echo 'no tests yet'"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "OBINexus <okpalan@protonmail.com>",
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@obinexusltd/obix-sdk-core": "^0.1.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
}
|
|
29
|
+
}
|