@blackglory/structures 0.2.8 → 0.3.3

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.
@@ -6,8 +6,8 @@ export interface IFiniteStateMachineStateChange<State extends string, Event exte
6
6
  newState: State;
7
7
  }
8
8
  export declare class ObservableFiniteStateMachine<State extends string, Event extends string> extends FiniteStateMachine<State, Event> {
9
- private stateChanged;
10
- get stateChangedObservable(): Observable<IFiniteStateMachineStateChange<State, Event>>;
9
+ private stateChanges;
10
+ observeStateChanges(): Observable<IFiniteStateMachineStateChange<State, Event>>;
11
11
  send(event: Event): void;
12
12
  }
13
13
  export { BadEventError } from './finite-state-machine';
@@ -7,18 +7,18 @@ const types_1 = require("@blackglory/types");
7
7
  class ObservableFiniteStateMachine extends finite_state_machine_1.FiniteStateMachine {
8
8
  constructor() {
9
9
  super(...arguments);
10
- this.stateChanged = new rxjs_1.Subject();
10
+ this.stateChanges = new rxjs_1.Subject();
11
11
  }
12
- get stateChangedObservable() {
13
- return this.stateChanged;
12
+ observeStateChanges() {
13
+ return this.stateChanges;
14
14
  }
15
15
  send(event) {
16
16
  const oldState = this.state;
17
17
  super.send(event);
18
18
  const newState = this.state;
19
- this.stateChanged.next({ event, oldState, newState });
19
+ this.stateChanges.next({ event, oldState, newState });
20
20
  if ((0, types_1.isEmptyObject)(this.schema[newState])) {
21
- this.stateChanged.complete();
21
+ this.stateChanges.complete();
22
22
  }
23
23
  }
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"observable-finite-state-machine.js","sourceRoot":"","sources":["../../src/observable-finite-state-machine.ts"],"names":[],"mappings":";;;AAAA,iEAA2D;AAC3D,+BAA0C;AAC1C,6CAAiD;AAWjD,MAAa,4BAGX,SAAQ,yCAAgC;IAH1C;;QAIU,iBAAY,GAAG,IAAI,cAAO,EAAgD,CAAA;IAmBpF,CAAC;IAjBC,IAAI,sBAAsB;QACxB,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,C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DAAsD;AAA7C,qHAAA,aAAa,OAAA"}
@@ -6,8 +6,8 @@ export interface IFiniteStateMachineStateChange<State extends string, Event exte
6
6
  newState: State;
7
7
  }
8
8
  export declare class ObservableFiniteStateMachine<State extends string, Event extends string> extends FiniteStateMachine<State, Event> {
9
- private stateChanged;
10
- get stateChangedObservable(): Observable<IFiniteStateMachineStateChange<State, Event>>;
9
+ private stateChanges;
10
+ observeStateChanges(): Observable<IFiniteStateMachineStateChange<State, Event>>;
11
11
  send(event: Event): void;
12
12
  }
13
13
  export { BadEventError } from './finite-state-machine';
@@ -7,18 +7,18 @@ const types_1 = require("@blackglory/types");
7
7
  class ObservableFiniteStateMachine extends finite_state_machine_1.FiniteStateMachine {
8
8
  constructor() {
9
9
  super(...arguments);
10
- this.stateChanged = new rxjs_1.Subject();
10
+ this.stateChanges = new rxjs_1.Subject();
11
11
  }
12
- get stateChangedObservable() {
13
- return this.stateChanged;
12
+ observeStateChanges() {
13
+ return this.stateChanges;
14
14
  }
15
15
  send(event) {
16
16
  const oldState = this.state;
17
17
  super.send(event);
18
18
  const newState = this.state;
19
- this.stateChanged.next({ event, oldState, newState });
19
+ this.stateChanges.next({ event, oldState, newState });
20
20
  if ((0, types_1.isEmptyObject)(this.schema[newState])) {
21
- this.stateChanged.complete();
21
+ this.stateChanges.complete();
22
22
  }
23
23
  }
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"observable-finite-state-machine.js","sourceRoot":"","sources":["../../src/observable-finite-state-machine.ts"],"names":[],"mappings":";;;AAAA,iEAA2D;AAC3D,+BAA0C;AAC1C,6CAAiD;AAWjD,MAAa,4BAGX,SAAQ,yCAAgC;IAH1C;;QAIU,iBAAY,GAAG,IAAI,cAAO,EAAgD,CAAA;IAmBpF,CAAC;IAjBC,IAAI,sBAAsB;QACxB,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAKD,IAAI,CAAC,KAAY;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAA;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAA;QAE3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;QACrD,IAAI,IAAA,qBAAa,EAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE;YACxC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;SAC7B;IACH,CAAC;CACF;AAvBD,oEAuBC;AAED,+DAAsD;AAA7C,qHAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"observable-finite-state-machine.js","sourceRoot":"","sources":["../../src/observable-finite-state-machine.ts"],"names":[],"mappings":";;;AAAA,iEAA2D;AAC3D,+BAA0C;AAC1C,6CAAiD;AAWjD,MAAa,4BAGX,SAAQ,yCAAgC;IAH1C;;QAIU,iBAAY,GAAG,IAAI,cAAO,EAAgD,CAAA;IAmBpF,CAAC;IAjBC,mBAAmB;QACjB,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAKD,IAAI,CAAC,KAAY;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAA;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAA;QAE3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;QACrD,IAAI,IAAA,qBAAa,EAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE;YACxC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;SAC7B;IACH,CAAC;CACF;AAvBD,oEAuBC;AAED,+DAAsD;AAA7C,qHAAA,aAAa,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blackglory/structures",
3
- "version": "0.2.8",
3
+ "version": "0.3.3",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib",
@@ -8,6 +8,7 @@
8
8
  ],
9
9
  "main": "lib/es2018/index.js",
10
10
  "types": "lib/es2018/index.d.ts",
11
+ "sideEffects": false,
11
12
  "repository": "git@github.com:BlackGlory/structures.git",
12
13
  "author": "BlackGlory <woshenmedoubuzhidao@blackglory.me>",
13
14
  "license": "MIT",
@@ -40,39 +41,39 @@
40
41
  "node": ">=12"
41
42
  },
42
43
  "devDependencies": {
43
- "@blackglory/jest-matchers": "^0.1.21",
44
- "@commitlint/cli": "^15.0.0",
45
- "@commitlint/config-conventional": "^15.0.0",
44
+ "@blackglory/jest-matchers": "^0.2.1",
45
+ "@commitlint/cli": "^16.1.0",
46
+ "@commitlint/config-conventional": "^16.0.0",
46
47
  "@rollup/plugin-commonjs": "^21.0.1",
47
48
  "@rollup/plugin-json": "^4.1.0",
48
- "@rollup/plugin-node-resolve": "^13.0.6",
49
- "@rollup/plugin-replace": "^3.0.0",
49
+ "@rollup/plugin-node-resolve": "^13.1.3",
50
+ "@rollup/plugin-replace": "^3.0.1",
50
51
  "@rollup/plugin-typescript": "^8.3.0",
51
- "@types/jest": "^27.0.3",
52
- "@types/node": "^16.11.12",
53
- "@typescript-eslint/eslint-plugin": "^5.6.0",
54
- "@typescript-eslint/parser": "^5.6.0",
55
- "eslint": "^8.4.1",
56
- "extra-promise": "^0.19.4",
52
+ "@types/jest": "^27.4.0",
53
+ "@types/node": "14",
54
+ "@typescript-eslint/eslint-plugin": "^5.10.1",
55
+ "@typescript-eslint/parser": "^5.10.1",
56
+ "eslint": "^8.8.0",
57
+ "extra-promise": "^0.21.2",
57
58
  "husky": "^4.3.8",
58
- "iterable-operator": "^0.14.4",
59
- "jest": "^27.4.4",
59
+ "jest": "^27.4.7",
60
60
  "npm-run-all": "^4.1.5",
61
- "return-style": "^0.12.5",
61
+ "return-style": "^0.12.6",
62
62
  "rimraf": "^3.0.2",
63
- "rollup": "^2.61.1",
63
+ "rollup": "^2.66.1",
64
64
  "rollup-plugin-analyzer": "^4.0.0",
65
65
  "rollup-plugin-terser": "^7.0.2",
66
66
  "standard-version": "^9.3.2",
67
- "ts-jest": "^27.1.1",
67
+ "ts-jest": "^27.1.3",
68
68
  "tscpaths": "^0.0.9",
69
69
  "tslib": "^2.3.1",
70
- "typescript": "^4.5.3"
70
+ "typescript": "^4.5.5"
71
71
  },
72
72
  "dependencies": {
73
- "@blackglory/errors": "^1.1.2",
74
- "@blackglory/types": "^0.5.2",
75
- "extra-timers": "^0.2.4",
76
- "rxjs": "^7.4.0"
73
+ "@blackglory/errors": "^2.1.0",
74
+ "@blackglory/types": "^0.6.5",
75
+ "extra-timers": "^0.2.5",
76
+ "iterable-operator": "^0.14.5",
77
+ "rxjs": "^7.5.2"
77
78
  }
78
79
  }
package/CHANGELOG.md DELETED
@@ -1,156 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ### [0.2.8](https://github.com/BlackGlory/structures/compare/v0.2.7...v0.2.8) (2021-12-13)
6
-
7
-
8
- ### Features
9
-
10
- * add FiniteStateMachine ([219d440](https://github.com/BlackGlory/structures/commit/219d440b5bb0bc6684166dc2d13d786285368c27))
11
- * add ObservableFiniteStateMachine ([49e3b97](https://github.com/BlackGlory/structures/commit/49e3b97c2238b1567f7588b6c337063c40e0eec9))
12
-
13
- ### [0.2.7](https://github.com/BlackGlory/structures/compare/v0.2.6...v0.2.7) (2021-12-13)
14
-
15
-
16
- ### Features
17
-
18
- * add Box ([bce499f](https://github.com/BlackGlory/structures/commit/bce499f4debbed179c628fa1b3917f9ba2f9e513))
19
-
20
- ### [0.2.6](https://github.com/BlackGlory/structures/compare/v0.2.5...v0.2.6) (2021-10-14)
21
-
22
- ### [0.2.5](https://github.com/BlackGlory/structures/compare/v0.2.4...v0.2.5) (2021-09-16)
23
-
24
-
25
- ### Features
26
-
27
- * add ExpirableMap ([70d2bc3](https://github.com/BlackGlory/structures/commit/70d2bc359be26aa8719fd81286918989bd9cf265))
28
- * add TLRUMap ([21c5460](https://github.com/BlackGlory/structures/commit/21c5460b122c976a4e551d422ddfa3b3cdadd093))
29
-
30
- ### [0.2.4](https://github.com/BlackGlory/structures/compare/v0.2.3...v0.2.4) (2021-09-15)
31
-
32
-
33
- ### Bug Fixes
34
-
35
- * memory leak ([ea8c035](https://github.com/BlackGlory/structures/commit/ea8c035a28b80fad4df411cf4f07d07abe594ee8))
36
-
37
- ### [0.2.3](https://github.com/BlackGlory/structures/compare/v0.2.2...v0.2.3) (2021-07-28)
38
-
39
-
40
- ### Features
41
-
42
- * add HashMap ([f605460](https://github.com/BlackGlory/structures/commit/f605460e766c4117cb64bd2be552cfc300281aa8))
43
-
44
- ### [0.2.2](https://github.com/BlackGlory/structures/compare/v0.2.1...v0.2.2) (2021-07-04)
45
-
46
- ### [0.2.1](https://github.com/BlackGlory/structures/compare/v0.2.0...v0.2.1) (2021-05-16)
47
-
48
- ## [0.2.0](https://github.com/BlackGlory/structures/compare/v0.1.15...v0.2.0) (2021-05-16)
49
-
50
-
51
- ### ⚠ BREAKING CHANGES
52
-
53
- * rewrite
54
- * rename LRU to LRUMap
55
-
56
- ### Features
57
-
58
- * add LRU#clear, LRU#delete ([cdac3dc](https://github.com/BlackGlory/structures/commit/cdac3dcb1521abb0360d04f36097cc9b8027a09c))
59
- * improve Cons ([4564103](https://github.com/BlackGlory/structures/commit/456410346050b5c83c11c85808f447ffcb3484b2))
60
- * improve HashSet, Queue ([da0f515](https://github.com/BlackGlory/structures/commit/da0f5150c04af76d1dc93f2227e00099dacb0280))
61
- * rewrite ([902152b](https://github.com/BlackGlory/structures/commit/902152b0ed00fcb44b90df7e443b62a6147d796a))
62
-
63
-
64
- ### Bug Fixes
65
-
66
- * bundle ([0abacc1](https://github.com/BlackGlory/structures/commit/0abacc18c95884206ecb7d6323614bae826ff38c))
67
-
68
-
69
- * rename LRU to LRUMap ([7f0b8bb](https://github.com/BlackGlory/structures/commit/7f0b8bb3c35cd72bb8b9705ad0c40f09cc2353a2))
70
-
71
- ### [0.1.15](https://github.com/BlackGlory/structures/compare/v0.1.14...v0.1.15) (2021-05-15)
72
-
73
-
74
- ### Features
75
-
76
- * add LRU ([c1f8550](https://github.com/BlackGlory/structures/commit/c1f855022a4c4ac770fddc7d59aed1cfcf49d75f))
77
-
78
- ### [0.1.14](https://github.com/BlackGlory/structures/compare/v0.1.13...v0.1.14) (2021-03-16)
79
-
80
-
81
- ### Features
82
-
83
- * add Queue#remove ([b5f4ad6](https://github.com/BlackGlory/structures/commit/b5f4ad65c43f74edca9bafa43db9dad8b33ad098))
84
-
85
- ### [0.1.13](https://github.com/BlackGlory/structures/compare/v0.1.12...v0.1.13) (2021-02-28)
86
-
87
-
88
- ### Features
89
-
90
- * add Cons ([2a5effa](https://github.com/BlackGlory/structures/commit/2a5effa269cd5089763b458aa749d9b29ea76492))
91
-
92
- ### [0.1.12](https://github.com/BlackGlory/structures/compare/v0.1.11...v0.1.12) (2021-02-04)
93
-
94
- ### [0.1.11](https://github.com/BlackGlory/structures/compare/v0.1.10...v0.1.11) (2021-02-03)
95
-
96
-
97
- ### Bug Fixes
98
-
99
- * bundle ([5206cfa](https://github.com/BlackGlory/structures/commit/5206cfa0947330843ef052e69283844661fbc465))
100
-
101
- ### [0.1.10](https://github.com/BlackGlory/structures/compare/v0.1.9...v0.1.10) (2021-02-03)
102
-
103
- ### [0.1.9](https://github.com/BlackGlory/structures/compare/v0.1.8...v0.1.9) (2021-01-20)
104
-
105
- ### [0.1.8](https://github.com/BlackGlory/structures/compare/v0.1.7...v0.1.8) (2021-01-15)
106
-
107
-
108
- ### Bug Fixes
109
-
110
- * esm bundle ([7fa7e00](https://github.com/BlackGlory/structures/commit/7fa7e004ec290c1ecb4e7e7f4dcb5bc5c472cbd9))
111
-
112
- ### [0.1.7](https://github.com/BlackGlory/structures/compare/v0.1.6...v0.1.7) (2021-01-15)
113
-
114
- ### [0.1.6](https://github.com/BlackGlory/structures/compare/v0.1.5...v0.1.6) (2021-01-05)
115
-
116
-
117
- ### Features
118
-
119
- * add empty ([d66a13b](https://github.com/BlackGlory/structures/commit/d66a13b3b737fd825e265079897640ba07996dda))
120
-
121
- ### [0.1.5](https://github.com/BlackGlory/structures/compare/v0.1.4...v0.1.5) (2021-01-04)
122
-
123
-
124
- ### Bug Fixes
125
-
126
- * bundle ([4fa790b](https://github.com/BlackGlory/structures/commit/4fa790bc06f08dc7adb6bd27ac43345dce1e00f7))
127
-
128
- ### [0.1.4](https://github.com/BlackGlory/structures/compare/v0.1.3...v0.1.4) (2021-01-03)
129
-
130
- ### [0.1.3](https://github.com/BlackGlory/structures/compare/v0.1.2...v0.1.3) (2020-12-19)
131
-
132
-
133
- ### Features
134
-
135
- * add methods ([55266e9](https://github.com/BlackGlory/structures/commit/55266e94a0d6035121a360404617c538a97f4143))
136
-
137
- ### [0.1.2](https://github.com/BlackGlory/structures/compare/v0.1.1...v0.1.2) (2020-12-19)
138
-
139
-
140
- ### Features
141
-
142
- * add Emitter ([0cbcddc](https://github.com/BlackGlory/structures/commit/0cbcddca5520a0e5a496950936ef487634acd252))
143
-
144
- ### [0.1.1](https://github.com/BlackGlory/structures/compare/v0.1.0...v0.1.1) (2020-12-19)
145
-
146
-
147
- ### Features
148
-
149
- * add HashSet ([3cd0b59](https://github.com/BlackGlory/structures/commit/3cd0b59a5a06eeb9c99e23d634b2116eab3de090))
150
-
151
- ## 0.1.0 (2020-12-19)
152
-
153
-
154
- ### Features
155
-
156
- * add Queue ([dfd0c23](https://github.com/BlackGlory/structures/commit/dfd0c237753f4030bb5de11bf311b96170649216))