@nymphjs/pubsub 1.0.0-beta.7 → 1.0.0-beta.70

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 CHANGED
@@ -3,6 +3,298 @@
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.70](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.69...v1.0.0-beta.70) (2024-09-20)
7
+
8
+ **Note:** Version bump only for package @nymphjs/pubsub
9
+
10
+ # [1.0.0-beta.69](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.68...v1.0.0-beta.69) (2024-09-19)
11
+
12
+ **Note:** Version bump only for package @nymphjs/pubsub
13
+
14
+ # [1.0.0-beta.68](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.67...v1.0.0-beta.68) (2024-09-19)
15
+
16
+ **Note:** Version bump only for package @nymphjs/pubsub
17
+
18
+ # [1.0.0-beta.67](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.66...v1.0.0-beta.67) (2024-09-03)
19
+
20
+ **Note:** Version bump only for package @nymphjs/pubsub
21
+
22
+ # [1.0.0-beta.66](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.65...v1.0.0-beta.66) (2024-08-06)
23
+
24
+ **Note:** Version bump only for package @nymphjs/pubsub
25
+
26
+ # [1.0.0-beta.65](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.64...v1.0.0-beta.65) (2024-08-05)
27
+
28
+ **Note:** Version bump only for package @nymphjs/pubsub
29
+
30
+ # [1.0.0-beta.64](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.63...v1.0.0-beta.64) (2024-08-04)
31
+
32
+ **Note:** Version bump only for package @nymphjs/pubsub
33
+
34
+ # [1.0.0-beta.63](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.62...v1.0.0-beta.63) (2024-06-18)
35
+
36
+ ### Bug Fixes
37
+
38
+ - undo ts compilation to module change ([84be6d4](https://github.com/sciactive/nymphjs/commit/84be6d434be29f8afd53907d15be2eb77d1736ce))
39
+
40
+ ### Features
41
+
42
+ - export data iterator ([b86aa19](https://github.com/sciactive/nymphjs/commit/b86aa19fc77d744b5a683046dfb697fc4746df5c))
43
+
44
+ # [1.0.0-beta.62](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.61...v1.0.0-beta.62) (2024-06-15)
45
+
46
+ **Note:** Version bump only for package @nymphjs/pubsub
47
+
48
+ # [1.0.0-beta.61](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.60...v1.0.0-beta.61) (2024-06-14)
49
+
50
+ **Note:** Version bump only for package @nymphjs/pubsub
51
+
52
+ # [1.0.0-beta.60](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.59...v1.0.0-beta.60) (2024-06-14)
53
+
54
+ **Note:** Version bump only for package @nymphjs/pubsub
55
+
56
+ # [1.0.0-beta.59](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.58...v1.0.0-beta.59) (2024-06-14)
57
+
58
+ **Note:** Version bump only for package @nymphjs/pubsub
59
+
60
+ # [1.0.0-beta.58](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.57...v1.0.0-beta.58) (2024-06-12)
61
+
62
+ **Note:** Version bump only for package @nymphjs/pubsub
63
+
64
+ # [1.0.0-beta.57](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.56...v1.0.0-beta.57) (2024-06-12)
65
+
66
+ **Note:** Version bump only for package @nymphjs/pubsub
67
+
68
+ # [1.0.0-beta.56](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.55...v1.0.0-beta.56) (2024-06-11)
69
+
70
+ **Note:** Version bump only for package @nymphjs/pubsub
71
+
72
+ # [1.0.0-beta.55](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.54...v1.0.0-beta.55) (2024-05-26)
73
+
74
+ **Note:** Version bump only for package @nymphjs/pubsub
75
+
76
+ # [1.0.0-beta.54](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.53...v1.0.0-beta.54) (2024-05-26)
77
+
78
+ **Note:** Version bump only for package @nymphjs/pubsub
79
+
80
+ # [1.0.0-beta.53](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.52...v1.0.0-beta.53) (2024-05-26)
81
+
82
+ **Note:** Version bump only for package @nymphjs/pubsub
83
+
84
+ # [1.0.0-beta.52](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.51...v1.0.0-beta.52) (2024-05-25)
85
+
86
+ **Note:** Version bump only for package @nymphjs/pubsub
87
+
88
+ # [1.0.0-beta.51](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.50...v1.0.0-beta.51) (2024-04-12)
89
+
90
+ **Note:** Version bump only for package @nymphjs/pubsub
91
+
92
+ # [1.0.0-beta.50](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.49...v1.0.0-beta.50) (2024-04-08)
93
+
94
+ **Note:** Version bump only for package @nymphjs/pubsub
95
+
96
+ # [1.0.0-beta.49](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.48...v1.0.0-beta.49) (2024-03-04)
97
+
98
+ **Note:** Version bump only for package @nymphjs/pubsub
99
+
100
+ # [1.0.0-beta.48](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.47...v1.0.0-beta.48) (2023-11-10)
101
+
102
+ **Note:** Version bump only for package @nymphjs/pubsub
103
+
104
+ # [1.0.0-beta.47](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.46...v1.0.0-beta.47) (2023-11-10)
105
+
106
+ **Note:** Version bump only for package @nymphjs/pubsub
107
+
108
+ # [1.0.0-beta.46](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.45...v1.0.0-beta.46) (2023-08-29)
109
+
110
+ ### Bug Fixes
111
+
112
+ - make the name even much more correct this time ([8d0b381](https://github.com/sciactive/nymphjs/commit/8d0b3817925ce9b1de21d2f9248f6cdec0f7d3f0))
113
+
114
+ # [1.0.0-beta.45](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.44...v1.0.0-beta.45) (2023-07-17)
115
+
116
+ ### Bug Fixes
117
+
118
+ - missing pubsub updates when new top level match uses qref with multiple results ([6dc26e2](https://github.com/sciactive/nymphjs/commit/6dc26e280453794ea9ce6c2b77482f85eb62bd23))
119
+
120
+ # [1.0.0-beta.44](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.43...v1.0.0-beta.44) (2023-07-13)
121
+
122
+ **Note:** Version bump only for package @nymphjs/pubsub
123
+
124
+ # [1.0.0-beta.43](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.42...v1.0.0-beta.43) (2023-07-12)
125
+
126
+ **Note:** Version bump only for package @nymphjs/pubsub
127
+
128
+ # [1.0.0-beta.42](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.41...v1.0.0-beta.42) (2023-07-12)
129
+
130
+ ### Features
131
+
132
+ - make fillSession async so that gatekeeper can be sync ([fb6def4](https://github.com/sciactive/nymphjs/commit/fb6def45cd031516c9bcd3438f905e2ff881707b))
133
+
134
+ # [1.0.0-beta.41](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2023-07-12)
135
+
136
+ ### Features
137
+
138
+ - remove synchronous database queries ([b579fb2](https://github.com/sciactive/nymphjs/commit/b579fb2eacd96cdd1b386a62c5c00cdbb2438f6e))
139
+
140
+ # [1.0.0-beta.40](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2023-07-10)
141
+
142
+ **Note:** Version bump only for package @nymphjs/pubsub
143
+
144
+ # [1.0.0-beta.39](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2023-07-09)
145
+
146
+ **Note:** Version bump only for package @nymphjs/pubsub
147
+
148
+ # [1.0.0-beta.38](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2023-07-09)
149
+
150
+ **Note:** Version bump only for package @nymphjs/pubsub
151
+
152
+ # [1.0.0-beta.37](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2023-07-09)
153
+
154
+ **Note:** Version bump only for package @nymphjs/pubsub
155
+
156
+ # [1.0.0-beta.36](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2023-07-09)
157
+
158
+ **Note:** Version bump only for package @nymphjs/pubsub
159
+
160
+ # [1.0.0-beta.35](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2023-06-14)
161
+
162
+ **Note:** Version bump only for package @nymphjs/pubsub
163
+
164
+ # [1.0.0-beta.34](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2023-05-13)
165
+
166
+ ### Bug Fixes
167
+
168
+ - subscribeWith making guid null ([dbb38d4](https://github.com/sciactive/nymphjs/commit/dbb38d424f2395bbfa01ab4a0663dcaebf0c7aa7))
169
+
170
+ # [1.0.0-beta.33](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2023-05-13)
171
+
172
+ ### Bug Fixes
173
+
174
+ - don't send initial entities for qref subscriptions ([b07ed5c](https://github.com/sciactive/nymphjs/commit/b07ed5cb0404aa85dd58dc951261a2b4e3d2bcbf))
175
+
176
+ # [1.0.0-beta.32](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2023-05-13)
177
+
178
+ ### Features
179
+
180
+ - issue initial request with pubsub instead of rest on subscribe ([8a232d2](https://github.com/sciactive/nymphjs/commit/8a232d2faeb8622924f9c35a01a8f71a70659bb3))
181
+
182
+ # [1.0.0-beta.31](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2023-05-12)
183
+
184
+ **Note:** Version bump only for package @nymphjs/pubsub
185
+
186
+ # [1.0.0-beta.30](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2023-05-12)
187
+
188
+ ### Features
189
+
190
+ - allow providing getEntityClass with a class instead of string ([ecd64c1](https://github.com/sciactive/nymphjs/commit/ecd64c1bf92e3657889613b76bcc46652f371ead))
191
+
192
+ # [1.0.0-beta.29](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2023-05-08)
193
+
194
+ **Note:** Version bump only for package @nymphjs/pubsub
195
+
196
+ # [1.0.0-beta.28](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2023-05-05)
197
+
198
+ **Note:** Version bump only for package @nymphjs/pubsub
199
+
200
+ # [1.0.0-beta.27](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2023-05-04)
201
+
202
+ **Note:** Version bump only for package @nymphjs/pubsub
203
+
204
+ # [1.0.0-beta.26](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2023-05-04)
205
+
206
+ ### Bug Fixes
207
+
208
+ - broken pubsub test ([99de0e4](https://github.com/sciactive/nymphjs/commit/99de0e4e7a79420bae1c5df5fb8fcbfafe894ace))
209
+
210
+ # [1.0.0-beta.25](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2023-05-04)
211
+
212
+ ### Features
213
+
214
+ - 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)
215
+
216
+ # [1.0.0-beta.24](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2023-05-02)
217
+
218
+ **Note:** Version bump only for package @nymphjs/pubsub
219
+
220
+ # [1.0.0-beta.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2023-05-02)
221
+
222
+ **Note:** Version bump only for package @nymphjs/pubsub
223
+
224
+ # [1.0.0-beta.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2023-05-01)
225
+
226
+ **Note:** Version bump only for package @nymphjs/pubsub
227
+
228
+ # [1.0.0-beta.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2023-05-01)
229
+
230
+ **Note:** Version bump only for package @nymphjs/pubsub
231
+
232
+ # [1.0.0-beta.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2023-04-30)
233
+
234
+ **Note:** Version bump only for package @nymphjs/pubsub
235
+
236
+ # [1.0.0-beta.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2023-04-29)
237
+
238
+ **Note:** Version bump only for package @nymphjs/pubsub
239
+
240
+ # [1.0.0-beta.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2023-04-27)
241
+
242
+ ### Bug Fixes
243
+
244
+ - small type issues ([b91579c](https://github.com/sciactive/nymphjs/commit/b91579c9c1e96500d903332648f5a93c9a7e7d9b))
245
+
246
+ ### Features
247
+
248
+ - add the ability to switch to a user without their password ([ca4466a](https://github.com/sciactive/nymphjs/commit/ca4466af1704d68905ac087350a8cf151c1072d9))
249
+
250
+ # [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
251
+
252
+ **Note:** Version bump only for package @nymphjs/pubsub
253
+
254
+ # [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
255
+
256
+ **Note:** Version bump only for package @nymphjs/pubsub
257
+
258
+ # [1.0.0-beta.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-23)
259
+
260
+ **Note:** Version bump only for package @nymphjs/pubsub
261
+
262
+ # [1.0.0-beta.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-17)
263
+
264
+ **Note:** Version bump only for package @nymphjs/pubsub
265
+
266
+ # [1.0.0-beta.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-16)
267
+
268
+ ### Bug Fixes
269
+
270
+ - pubsub publishing changes before transaction is finished ([a918cc1](https://github.com/sciactive/nymphjs/commit/a918cc1451e03015ecce20f1c9bf6ceb62b7dff1))
271
+
272
+ # [1.0.0-beta.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-04)
273
+
274
+ **Note:** Version bump only for package @nymphjs/pubsub
275
+
276
+ # [1.0.0-beta.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2023-02-27)
277
+
278
+ **Note:** Version bump only for package @nymphjs/pubsub
279
+
280
+ # [1.0.0-beta.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2023-01-19)
281
+
282
+ ### Bug Fixes
283
+
284
+ - explicitly set skipAc to false in PubSub server ([33f96f7](https://github.com/sciactive/nymphjs/commit/33f96f7ccabaedb9e226fe302a996259e0158315))
285
+
286
+ # [1.0.0-beta.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-01-09)
287
+
288
+ ### Bug Fixes
289
+
290
+ - reworked $is and $equals to better work with new instance based classes ([b1f3f0c](https://github.com/sciactive/nymphjs/commit/b1f3f0cca3e2b0dd392cd9da31167a6bd9487b40))
291
+
292
+ # [1.0.0-beta.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-01-09)
293
+
294
+ ### Features
295
+
296
+ - make entities in nymph client instance specific too ([1029f06](https://github.com/sciactive/nymphjs/commit/1029f061a1ad193e4a8a2dab0186b9a4b517f646))
297
+
6
298
  # [1.0.0-beta.7](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2023-01-05)
7
299
 
8
300
  **Note:** Version bump only for package @nymphjs/pubsub
package/README.md CHANGED
@@ -27,7 +27,7 @@ const nymph = new Nymph(
27
27
  {},
28
28
  new SQLite3Driver({
29
29
  filename: ':memory:', // Put the correct driver/config here.
30
- })
30
+ }),
31
31
  );
32
32
  PubSub.initPublisher(pubSubConfig, nymph);
33
33
  ```
@@ -51,7 +51,7 @@ const nymph = new Nymph(
51
51
  {},
52
52
  new SQLite3Driver({
53
53
  filename: ':memory:', // Put the correct driver/config here.
54
- })
54
+ }),
55
55
  );
56
56
  // Don't forget to do this; even here!
57
57
  PubSub.initPublisher(pubSubConfig, nymph);
@@ -81,7 +81,7 @@ const nymph = new Nymph(
81
81
  {},
82
82
  new SQLite3Driver({
83
83
  filename: ':memory:', // Put the correct driver/config here.
84
- })
84
+ }),
85
85
  );
86
86
  // Don't forget to do this; even here!
87
87
  PubSub.initPublisher(pubSubConfig, nymph);
@@ -95,7 +95,7 @@ const server = http.createServer((_request, response) => {
95
95
  const listener = server.listen(port, () => {
96
96
  console.log(
97
97
  new Date().toISOString(),
98
- `Nymph-PubSub server started listening on port ${port}.`
98
+ `Nymph-PubSub server started listening on port ${port}.`,
99
99
  );
100
100
  });
101
101
  const wsServer = new WebSocketServer({
package/dist/PubSub.d.ts CHANGED
@@ -2,9 +2,27 @@ import { Nymph } from '@nymphjs/nymph';
2
2
  import { request, server as WebSocketServer, connection, Message } from 'websocket';
3
3
  import { Config } from './conf';
4
4
  import type { QuerySubscriptionData } from './PubSub.types';
5
+ /**
6
+ * A publish/subscribe server for Nymph.
7
+ *
8
+ * Written by Hunter Perrin for SciActive.
9
+ *
10
+ * @author Hunter Perrin <hperrin@gmail.com>
11
+ * @copyright SciActive Inc
12
+ * @see http://nymph.io/
13
+ */
5
14
  export default class PubSub {
15
+ /**
16
+ * The Nymph instance.
17
+ */
6
18
  nymph: Nymph;
19
+ /**
20
+ * The PubSub config.
21
+ */
7
22
  config: Config;
23
+ /**
24
+ * The WebSocket server.
25
+ */
8
26
  server: WebSocketServer;
9
27
  private sessions;
10
28
  protected querySubs: {
@@ -17,23 +35,70 @@ export default class PubSub {
17
35
  count: boolean;
18
36
  }>;
19
37
  };
38
+ protected static transactionPublishes: {
39
+ nymph: Nymph;
40
+ payload: string;
41
+ config: Config;
42
+ }[];
20
43
  static initPublisher(config: Partial<Config>, nymph: Nymph): void;
21
44
  private static publish;
45
+ private static isOrIsDescendant;
46
+ private static publishTransactionPublishes;
47
+ private static removeTransactionPublishes;
48
+ /**
49
+ * Initialize Nymph PubSub.
50
+ *
51
+ * @param config The PubSub configuration.
52
+ */
22
53
  constructor(config: Partial<Config>, nymph: Nymph, server: WebSocketServer);
23
54
  close(): void;
24
55
  handleRequest(request: request): void;
56
+ /**
57
+ * Handle a message from a client.
58
+ */
25
59
  onMessage(from: connection, msg: Message): Promise<void>;
60
+ /**
61
+ * Clean up after users who leave.
62
+ */
26
63
  onClose(conn: connection, description: string): void;
27
64
  onError(conn: connection, e: Error): void;
65
+ /**
66
+ * Handle an authentication from a client.
67
+ */
28
68
  private handleAuthentication;
69
+ /**
70
+ * Handle a subscribe or unsubscribe from a client.
71
+ */
29
72
  private handleSubscription;
73
+ /**
74
+ * Handle a subscribe or unsubscribe for a query from a client.
75
+ */
30
76
  private handleSubscriptionQuery;
77
+ /**
78
+ * Handle a subscribe or unsubscribe for a UID from a client.
79
+ */
31
80
  private handleSubscriptionUid;
81
+ /**
82
+ * Handle a publish from a client.
83
+ */
32
84
  private handlePublish;
85
+ /**
86
+ * Handle an entity publish from a client.
87
+ */
33
88
  private handlePublishEntity;
34
89
  private updateClient;
90
+ /**
91
+ * Handle a UID publish from a client.
92
+ */
35
93
  private handlePublishUid;
94
+ /**
95
+ * Relay publish data to other servers.
96
+ */
36
97
  private relay;
37
98
  private findQRefQueries;
99
+ /**
100
+ * This translates qref selectors into ref selectors using the "current" GUID
101
+ * list in the existing subscriptions.
102
+ */
38
103
  private translateQRefSelectors;
39
104
  }