@nymphjs/client 1.0.0-beta.4 → 1.0.0-beta.41
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/CHANGELOG.md +192 -0
- package/README.md +2 -2
- package/asyncitertest.js +53 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/lib/Entity.d.ts +10 -7
- package/lib/Entity.js +50 -73
- package/lib/Entity.js.map +1 -1
- package/lib/Entity.types.d.ts +4 -4
- package/lib/EntityWeakCache.js +3 -2
- package/lib/EntityWeakCache.js.map +1 -1
- package/lib/HttpRequester.d.ts +41 -6
- package/lib/HttpRequester.js +226 -12
- package/lib/HttpRequester.js.map +1 -1
- package/lib/Nymph.d.ts +7 -4
- package/lib/Nymph.js +53 -16
- package/lib/Nymph.js.map +1 -1
- package/lib/Nymph.types.d.ts +2 -1
- package/lib/PubSub.d.ts +12 -7
- package/lib/PubSub.js +129 -87
- package/lib/PubSub.js.map +1 -1
- package/lib/PubSub.types.d.ts +2 -1
- package/package.json +17 -14
- package/src/Entity.ts +76 -82
- package/src/Entity.types.ts +6 -8
- package/src/EntityWeakCache.ts +7 -5
- package/src/HttpRequester.ts +297 -11
- package/src/Nymph.ts +80 -25
- package/src/Nymph.types.ts +5 -1
- package/src/PubSub.ts +174 -105
- package/src/PubSub.types.ts +6 -1
- package/typedoc.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,198 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-beta.41](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2023-07-12)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- remove synchronous database queries ([b579fb2](https://github.com/sciactive/nymphjs/commit/b579fb2eacd96cdd1b386a62c5c00cdbb2438f6e))
|
|
11
|
+
- rewrite server side async api to match client side api ([9c537a8](https://github.com/sciactive/nymphjs/commit/9c537a8be49e9b989af0822a4c2236e8c2d20f87))
|
|
12
|
+
|
|
13
|
+
# [1.0.0-beta.40](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2023-07-10)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- rewrite updateArray function to fix it ([22185c7](https://github.com/sciactive/nymphjs/commit/22185c7627f6dc616f9d3187ee8c9a383ca71441))
|
|
18
|
+
|
|
19
|
+
# [1.0.0-beta.39](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2023-07-09)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- go back to older code for updateArray, but better number handling ([7a58c98](https://github.com/sciactive/nymphjs/commit/7a58c983eac73839544361b4d32fb2dbb0881da2))
|
|
24
|
+
|
|
25
|
+
# [1.0.0-beta.38](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2023-07-09)
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
- pull value from the array in updateArray function ([352d1ea](https://github.com/sciactive/nymphjs/commit/352d1eab0cf8868f672ce0350564eb75ac9d4a45))
|
|
30
|
+
- simplify updateArray code ([348154c](https://github.com/sciactive/nymphjs/commit/348154c4d42b1e2b54bc491c1588a59c7c48984c))
|
|
31
|
+
|
|
32
|
+
# [1.0.0-beta.37](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2023-07-09)
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
- correctly iterate through new arrays on updateArray pubsub method ([27d7cc8](https://github.com/sciactive/nymphjs/commit/27d7cc847d93300e3d76cf6fa528176c3d06ae67))
|
|
37
|
+
|
|
38
|
+
# [1.0.0-beta.36](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2023-07-09)
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
- use code 1000 for closing pubsub connection ([cbd56af](https://github.com/sciactive/nymphjs/commit/cbd56af98d0775dee36025d909a82a0af0633d72))
|
|
43
|
+
|
|
44
|
+
# [1.0.0-beta.35](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2023-06-14)
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- add iteratable server call support using event streams ([fa7c1ec](https://github.com/sciactive/nymphjs/commit/fa7c1ec869e1fb52db20c8245e98a681f73dbf83))
|
|
49
|
+
|
|
50
|
+
# [1.0.0-beta.34](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2023-05-13)
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
- subscribeWith making guid null ([dbb38d4](https://github.com/sciactive/nymphjs/commit/dbb38d424f2395bbfa01ab4a0663dcaebf0c7aa7))
|
|
55
|
+
|
|
56
|
+
# [1.0.0-beta.33](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2023-05-13)
|
|
57
|
+
|
|
58
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
59
|
+
|
|
60
|
+
# [1.0.0-beta.32](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2023-05-13)
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
- issue initial request with pubsub instead of rest on subscribe ([8a232d2](https://github.com/sciactive/nymphjs/commit/8a232d2faeb8622924f9c35a01a8f71a70659bb3))
|
|
65
|
+
|
|
66
|
+
# [1.0.0-beta.31](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2023-05-12)
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
- pubsub client reconnect multiple times issue ([bba0897](https://github.com/sciactive/nymphjs/commit/bba08974fadf318d040f8844a2d583f6bc15b486))
|
|
71
|
+
|
|
72
|
+
# [1.0.0-beta.30](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2023-05-12)
|
|
73
|
+
|
|
74
|
+
### Features
|
|
75
|
+
|
|
76
|
+
- allow providing getEntityClass with a class instead of string ([ecd64c1](https://github.com/sciactive/nymphjs/commit/ecd64c1bf92e3657889613b76bcc46652f371ead))
|
|
77
|
+
|
|
78
|
+
# [1.0.0-beta.29](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2023-05-08)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
81
|
+
|
|
82
|
+
# [1.0.0-beta.28](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2023-05-05)
|
|
83
|
+
|
|
84
|
+
### Bug Fixes
|
|
85
|
+
|
|
86
|
+
- pubsub client auth ([979d913](https://github.com/sciactive/nymphjs/commit/979d9138abc86c7cef8b80b4f63c519b7b7ded78))
|
|
87
|
+
|
|
88
|
+
# [1.0.0-beta.27](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2023-05-04)
|
|
89
|
+
|
|
90
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
91
|
+
|
|
92
|
+
# [1.0.0-beta.26](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2023-05-04)
|
|
93
|
+
|
|
94
|
+
### Features
|
|
95
|
+
|
|
96
|
+
- update packages and migrate to mysql2 ([72ad611](https://github.com/sciactive/nymphjs/commit/72ad611bd2bf7bf85c3ba8a3486503d9b50c49d6))
|
|
97
|
+
|
|
98
|
+
# [1.0.0-beta.25](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2023-05-04)
|
|
99
|
+
|
|
100
|
+
### Features
|
|
101
|
+
|
|
102
|
+
- add flags to disable rest and pubsub support on an entity class ([52106a3](https://github.com/sciactive/nymphjs/commit/52106a3d44065bcfec40d361344bf1eba59a5136)), closes [#1](https://github.com/sciactive/nymphjs/issues/1)
|
|
103
|
+
|
|
104
|
+
# [1.0.0-beta.24](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2023-05-02)
|
|
105
|
+
|
|
106
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
107
|
+
|
|
108
|
+
# [1.0.0-beta.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2023-05-02)
|
|
109
|
+
|
|
110
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
111
|
+
|
|
112
|
+
# [1.0.0-beta.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2023-05-01)
|
|
113
|
+
|
|
114
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
115
|
+
|
|
116
|
+
# [1.0.0-beta.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2023-05-01)
|
|
117
|
+
|
|
118
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
119
|
+
|
|
120
|
+
# [1.0.0-beta.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2023-04-30)
|
|
121
|
+
|
|
122
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
123
|
+
|
|
124
|
+
# [1.0.0-beta.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2023-04-29)
|
|
125
|
+
|
|
126
|
+
### Bug Fixes
|
|
127
|
+
|
|
128
|
+
- some type issues ([ee69d5d](https://github.com/sciactive/nymphjs/commit/ee69d5d73361dacda5745d697df18fafd47810bc))
|
|
129
|
+
|
|
130
|
+
# [1.0.0-beta.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2023-04-27)
|
|
131
|
+
|
|
132
|
+
### Features
|
|
133
|
+
|
|
134
|
+
- add the ability to switch to a user without their password ([ca4466a](https://github.com/sciactive/nymphjs/commit/ca4466af1704d68905ac087350a8cf151c1072d9))
|
|
135
|
+
|
|
136
|
+
# [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
|
|
137
|
+
|
|
138
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
139
|
+
|
|
140
|
+
# [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
|
|
141
|
+
|
|
142
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
143
|
+
|
|
144
|
+
# [1.0.0-beta.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-23)
|
|
145
|
+
|
|
146
|
+
### Features
|
|
147
|
+
|
|
148
|
+
- add option to sort results by a property ([16384e7](https://github.com/sciactive/nymphjs/commit/16384e7bdab88abb55ccccabb06ac09f92fa8a03))
|
|
149
|
+
|
|
150
|
+
# [1.0.0-beta.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-17)
|
|
151
|
+
|
|
152
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
153
|
+
|
|
154
|
+
# [1.0.0-beta.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-16)
|
|
155
|
+
|
|
156
|
+
### Features
|
|
157
|
+
|
|
158
|
+
- add noAutoconnect option to pubsub client ([266e715](https://github.com/sciactive/nymphjs/commit/266e715988b34f3e0d58ac68178677d2086b5160))
|
|
159
|
+
|
|
160
|
+
# [1.0.0-beta.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-04)
|
|
161
|
+
|
|
162
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
163
|
+
|
|
164
|
+
# [1.0.0-beta.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2023-02-27)
|
|
165
|
+
|
|
166
|
+
### Features
|
|
167
|
+
|
|
168
|
+
- allow customizing HTTP status codes in response from server called methods ([8c5c3d4](https://github.com/sciactive/nymphjs/commit/8c5c3d4af741edabc1a8947aaebf026ba546c46a))
|
|
169
|
+
|
|
170
|
+
# [1.0.0-beta.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2023-01-19)
|
|
171
|
+
|
|
172
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
173
|
+
|
|
174
|
+
# [1.0.0-beta.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-01-09)
|
|
175
|
+
|
|
176
|
+
### Bug Fixes
|
|
177
|
+
|
|
178
|
+
- reworked $is and $equals to better work with new instance based classes ([b1f3f0c](https://github.com/sciactive/nymphjs/commit/b1f3f0cca3e2b0dd392cd9da31167a6bd9487b40))
|
|
179
|
+
|
|
180
|
+
# [1.0.0-beta.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-01-09)
|
|
181
|
+
|
|
182
|
+
### Features
|
|
183
|
+
|
|
184
|
+
- make entities in nymph client instance specific too ([1029f06](https://github.com/sciactive/nymphjs/commit/1029f061a1ad193e4a8a2dab0186b9a4b517f646))
|
|
185
|
+
|
|
186
|
+
# [1.0.0-beta.7](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2023-01-05)
|
|
187
|
+
|
|
188
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
189
|
+
|
|
190
|
+
# [1.0.0-beta.6](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2023-01-05)
|
|
191
|
+
|
|
192
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
193
|
+
|
|
194
|
+
# [1.0.0-beta.5](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2022-11-24)
|
|
195
|
+
|
|
196
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
197
|
+
|
|
6
198
|
# [1.0.0-beta.4](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2022-11-23)
|
|
7
199
|
|
|
8
200
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Here's an overview:
|
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
import { Nymph, PubSub } from '@nymphjs/client';
|
|
21
|
-
import
|
|
21
|
+
import TodoClass from 'Todo';
|
|
22
22
|
|
|
23
23
|
const nymphOptions = {
|
|
24
24
|
restUrl: 'https://yournymphrestserver/path/to/your/endpoint',
|
|
@@ -26,7 +26,7 @@ const nymphOptions = {
|
|
|
26
26
|
};
|
|
27
27
|
const nymph = new Nymph(nymphOptions);
|
|
28
28
|
const pubsub = new PubSub(nymphOptions, nymph);
|
|
29
|
-
nymph.addEntityClass(
|
|
29
|
+
const Todo = nymph.addEntityClass(TodoClass);
|
|
30
30
|
|
|
31
31
|
// Now you can use Nymph and PubSub.
|
|
32
32
|
const myTodo = new Todo();
|
package/asyncitertest.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
async function* iterate() {
|
|
2
|
+
let values = [1, 2, 3];
|
|
3
|
+
let finished = false;
|
|
4
|
+
|
|
5
|
+
let promise = new Promise((resolve) => {
|
|
6
|
+
setTimeout(() => {
|
|
7
|
+
promise = new Promise((resolve) => {
|
|
8
|
+
setTimeout(() => {
|
|
9
|
+
values.push(4);
|
|
10
|
+
promise = new Promise((resolve) => {
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
values.push(5, 6);
|
|
13
|
+
finished = true;
|
|
14
|
+
resolve();
|
|
15
|
+
}, 3000);
|
|
16
|
+
});
|
|
17
|
+
resolve();
|
|
18
|
+
}, 3000);
|
|
19
|
+
});
|
|
20
|
+
resolve();
|
|
21
|
+
}, 0);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const iterable = {
|
|
25
|
+
async *[Symbol.asyncIterator]() {
|
|
26
|
+
do {
|
|
27
|
+
await promise;
|
|
28
|
+
|
|
29
|
+
while (values.length) {
|
|
30
|
+
yield values.shift();
|
|
31
|
+
}
|
|
32
|
+
} while (!finished);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
yield* iterable;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
(async () => {
|
|
40
|
+
const iter = iterate();
|
|
41
|
+
|
|
42
|
+
for await (let value of iter) {
|
|
43
|
+
console.log(value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log('done');
|
|
47
|
+
|
|
48
|
+
for await (let value of ['a', 'b', 'c']) {
|
|
49
|
+
console.log(value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log('done');
|
|
53
|
+
})();
|