@nymphjs/client 1.0.0-alpha.2 → 1.0.0-alpha.23
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 +102 -0
- package/README.md +13 -32
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/lib/Entity.d.ts +6 -3
- package/lib/Entity.js +71 -18
- package/lib/Entity.js.map +1 -1
- package/lib/Entity.types.d.ts +3 -0
- package/lib/EntityWeakCache.d.ts +6 -0
- package/lib/EntityWeakCache.js +31 -0
- package/lib/EntityWeakCache.js.map +1 -0
- package/lib/Nymph.d.ts +44 -35
- package/lib/Nymph.js +69 -46
- package/lib/Nymph.js.map +1 -1
- package/lib/Nymph.types.d.ts +1 -0
- package/lib/PubSub.d.ts +40 -39
- package/lib/PubSub.js +54 -87
- package/lib/PubSub.js.map +1 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +10 -13
- package/lib/utils.js.map +1 -1
- package/package.json +10 -10
- package/src/Entity.ts +120 -22
- package/src/Entity.types.ts +10 -0
- package/src/EntityWeakCache.ts +32 -0
- package/src/Nymph.ts +118 -98
- package/src/Nymph.types.ts +19 -0
- package/src/PubSub.ts +59 -102
- package/src/index.ts +0 -4
- package/src/utils.ts +7 -12
- package/lib/EntitySorter.d.ts +0 -16
- package/lib/EntitySorter.js +0 -134
- package/lib/EntitySorter.js.map +0 -1
- package/src/EntitySorter.ts +0 -186
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,108 @@
|
|
|
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.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2021-12-30)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- add optional weakly referenced cache to client lib ([fbb184c](https://github.com/sciactive/nymphjs/commit/fbb184c6a721968bb92cc9b05c328594618554ed))
|
|
11
|
+
|
|
12
|
+
# [1.0.0-alpha.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2021-12-14)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- update smui to latest versions ([912873b](https://github.com/sciactive/nymphjs/commit/912873b863d1ae5d51c359a3c0558bff38ce85cd))
|
|
17
|
+
|
|
18
|
+
# [1.0.0-alpha.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2021-11-29)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- open sleeping reference props to protected, allow custom property definitions in data proxies ([79779c3](https://github.com/sciactive/nymphjs/commit/79779c35123f8b829f3eb847088e68a58865c76d))
|
|
23
|
+
|
|
24
|
+
# [1.0.0-alpha.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2021-11-24)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
27
|
+
|
|
28
|
+
# [1.0.0-alpha.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2021-11-18)
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
- update smui and other packages to latest versions ([2465340](https://github.com/sciactive/nymphjs/commit/24653400d887bc04c41c3c4ee0c73ce2f2289e0d))
|
|
33
|
+
|
|
34
|
+
# [1.0.0-alpha.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2021-11-09)
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
- move entity sorter to its own package and add more features ([ef57460](https://github.com/sciactive/nymphjs/commit/ef57460d88c927a0e3a44b0071f553f1c92708bc))
|
|
39
|
+
|
|
40
|
+
# [1.0.0-alpha.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2021-10-14)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
43
|
+
|
|
44
|
+
# [1.0.0-alpha.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2021-10-14)
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
- don't ignore built files in npm packages ([7d688db](https://github.com/sciactive/nymphjs/commit/7d688dbec362f1f71fb451a1d0dbcaecc15d99fc))
|
|
49
|
+
|
|
50
|
+
# [1.0.0-alpha.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2021-10-14)
|
|
51
|
+
|
|
52
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
53
|
+
|
|
54
|
+
# [1.0.0-alpha.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2021-10-14)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
57
|
+
|
|
58
|
+
# [1.0.0-alpha.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2021-10-14)
|
|
59
|
+
|
|
60
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
61
|
+
|
|
62
|
+
# [1.0.0-alpha.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2021-10-13)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
65
|
+
|
|
66
|
+
# [1.0.0-alpha.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2021-10-13)
|
|
67
|
+
|
|
68
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
69
|
+
|
|
70
|
+
# [1.0.0-alpha.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2021-10-12)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
73
|
+
|
|
74
|
+
# [1.0.0-alpha.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2021-10-12)
|
|
75
|
+
|
|
76
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
77
|
+
|
|
78
|
+
# [1.0.0-alpha.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2021-10-12)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
81
|
+
|
|
82
|
+
# [1.0.0-alpha.7](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2021-10-05)
|
|
83
|
+
|
|
84
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
85
|
+
|
|
86
|
+
# [1.0.0-alpha.6](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2021-10-05)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
89
|
+
|
|
90
|
+
# [1.0.0-alpha.5](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2021-09-30)
|
|
91
|
+
|
|
92
|
+
**Note:** Version bump only for package @nymphjs/client
|
|
93
|
+
|
|
94
|
+
# [1.0.0-alpha.4](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2021-09-27)
|
|
95
|
+
|
|
96
|
+
### Features
|
|
97
|
+
|
|
98
|
+
- use new instances of nymph for server and pubsub requests ([0c18fab](https://github.com/sciactive/nymphjs/commit/0c18faba2b55fe82c16806d221fc54d2cd42c992))
|
|
99
|
+
|
|
100
|
+
# [1.0.0-alpha.3](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2021-09-22)
|
|
101
|
+
|
|
102
|
+
### Features
|
|
103
|
+
|
|
104
|
+
- allow multiple instances of Nymph Client ([81eacd7](https://github.com/sciactive/nymphjs/commit/81eacd7caff6f3c209d7d6dbfdac0414a1857c6d))
|
|
105
|
+
- migrate Tilmeld Client to new instance based Nymph Client ([dffe83b](https://github.com/sciactive/nymphjs/commit/dffe83b3900171a56d703cd491536b5d21360198))
|
|
106
|
+
- move to fully instance based design, no more globals ([c036220](https://github.com/sciactive/nymphjs/commit/c0362209b90a475b8b85269a829b0ec6bed4465f))
|
|
107
|
+
|
|
6
108
|
# [1.0.0-alpha.2](https://github.com/sciactive/nymphjs/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2021-09-21)
|
|
7
109
|
|
|
8
110
|
### Features
|
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
|
-
```
|
|
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
|
|
37
|
+
let allMyTodos = await nymph.getEntities({ class: Todo });
|
|
57
38
|
|
|
58
|
-
let subscription =
|
|
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 =
|
|
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
|
-
|
|
71
|
+
pubsub.updateArray(todos, update);
|
|
91
72
|
|
|
92
73
|
// `todos` is now up to date with the latest publishes from the server.
|
|
93
74
|
},
|