@nymphjs/client 1.0.0-alpha.1 → 1.0.0-alpha.10

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,51 @@
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-alpha.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2021-10-12)
7
+
8
+ **Note:** Version bump only for package @nymphjs/client
9
+
10
+ # [1.0.0-alpha.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2021-10-12)
11
+
12
+ **Note:** Version bump only for package @nymphjs/client
13
+
14
+ # [1.0.0-alpha.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2021-10-12)
15
+
16
+ **Note:** Version bump only for package @nymphjs/client
17
+
18
+ # [1.0.0-alpha.7](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2021-10-05)
19
+
20
+ **Note:** Version bump only for package @nymphjs/client
21
+
22
+ # [1.0.0-alpha.6](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2021-10-05)
23
+
24
+ **Note:** Version bump only for package @nymphjs/client
25
+
26
+ # [1.0.0-alpha.5](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2021-09-30)
27
+
28
+ **Note:** Version bump only for package @nymphjs/client
29
+
30
+ # [1.0.0-alpha.4](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2021-09-27)
31
+
32
+ ### Features
33
+
34
+ - use new instances of nymph for server and pubsub requests ([0c18fab](https://github.com/sciactive/nymphjs/commit/0c18faba2b55fe82c16806d221fc54d2cd42c992))
35
+
36
+ # [1.0.0-alpha.3](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2021-09-22)
37
+
38
+ ### Features
39
+
40
+ - allow multiple instances of Nymph Client ([81eacd7](https://github.com/sciactive/nymphjs/commit/81eacd7caff6f3c209d7d6dbfdac0414a1857c6d))
41
+ - migrate Tilmeld Client to new instance based Nymph Client ([dffe83b](https://github.com/sciactive/nymphjs/commit/dffe83b3900171a56d703cd491536b5d21360198))
42
+ - move to fully instance based design, no more globals ([c036220](https://github.com/sciactive/nymphjs/commit/c0362209b90a475b8b85269a829b0ec6bed4465f))
43
+
44
+ # [1.0.0-alpha.2](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2021-09-21)
45
+
46
+ ### Features
47
+
48
+ - support qref queries from the client ([3c8bef0](https://github.com/sciactive/nymphjs/commit/3c8bef0251111983b06eb13ad42a2afef80a1446))
49
+ - support qref queries in the query parser ([71169a2](https://github.com/sciactive/nymphjs/commit/71169a2aa33f11d791e93bb23d377a6c270b42f2))
50
+
6
51
  # 1.0.0-alpha.1 (2021-09-06)
7
52
 
8
53
  ### Bug Fixes
package/README.md CHANGED
@@ -12,50 +12,31 @@ npm install --save @nymphjs/client
12
12
 
13
13
  This package is the Nymph client for browsers. You can find UMD in `dist`, or TS source in `src`. There is also a **[Node.js client](https://github.com/sciactive/nymphjs/packages/client-node)**.
14
14
 
15
- ## Setup
16
-
17
- ```html
18
- <head>
19
- <!-- Nymph setup -->
20
- <script>
21
- NymphOptions = {
22
- restUrl: 'https://yournymphrestserver/path/to/your/endpoint',
23
- pubsubUrl: 'wss://yournymphpubsubserver',
24
- };
25
- </script>
26
- <!-- End Nymph setup -->
27
-
28
- <!-- Old school JS -->
29
- <script src="node_modules/nymph-client/dist/NymphClient.js"></script>
30
- <script src="path/to/your/entity/js/Todo.js"></script>
31
- <!-- End Old school JS -->
32
- </head>
33
- ```
34
-
35
15
  ## Usage
36
16
 
37
- For detailed docs, check out the User Guide on the website:
38
-
39
- - [Entity Class](https://nymph.io/user-guide/entity-class)
40
- - [Entity Querying](https://nymph.io/user-guide/entity-querying)
41
- - [Extending the Entity Class](https://nymph.io/user-guide/extending-the-entity-class)
42
- - [Subscribing to Queries](https://nymph.io/user-guide/subscribing-to-queries)
43
-
44
17
  Here's an overview:
45
18
 
46
- ```js
19
+ ```ts
47
20
  import { Nymph, PubSub } from '@nymphjs/client';
48
21
  import Todo from 'Todo';
49
22
 
23
+ const nymphOptions = {
24
+ restUrl: 'https://yournymphrestserver/path/to/your/endpoint',
25
+ pubsubUrl: 'wss://yournymphpubsubserver',
26
+ };
27
+ const nymph = new Nymph(nymphOptions);
28
+ const pubsub = new PubSub(nymphOptions, nymph);
29
+ nymph.addEntityClass(Todo);
30
+
50
31
  // Now you can use Nymph and PubSub.
51
32
  const myTodo = new Todo();
52
33
  myTodo.name = 'This is a new todo!';
53
34
  myTodo.done = false;
54
35
  await myTodo.$save();
55
36
 
56
- let allMyTodos = await Nymph.getEntities({ class: Todo });
37
+ let allMyTodos = await nymph.getEntities({ class: Todo });
57
38
 
58
- let subscription = PubSub.subscribeWith(myTodo, () => {
39
+ let subscription = pubsub.subscribeWith(myTodo, () => {
59
40
  // When this is called, the entity will already contain new data from the
60
41
  // publish event. If the entity is deleted, the GUID will be set to null.
61
42
  if (myTodo.guid != null) {
@@ -71,7 +52,7 @@ let subscription = PubSub.subscribeWith(myTodo, () => {
71
52
  // Subscribing to a query.
72
53
  let todos = [];
73
54
  let userCount = 0;
74
- let subscription = PubSub.subscribeEntities(
55
+ let subscription = pubsub.subscribeEntities(
75
56
  {
76
57
  class: Todo.class,
77
58
  },
@@ -87,7 +68,7 @@ let subscription = PubSub.subscribeEntities(
87
68
  // This takes an existing array of entities and either updates it to match
88
69
  // another array, or performs actions from a publish event object to update
89
70
  // it.
90
- PubSub.updateArray(todos, update);
71
+ pubsub.updateArray(todos, update);
91
72
 
92
73
  // `todos` is now up to date with the latest publishes from the server.
93
74
  },