@nymphjs/tilmeld 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.
Files changed (57) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/README.md +14 -1
  3. package/dist/AbleObject.d.ts +15 -0
  4. package/dist/AbleObject.js +16 -1
  5. package/dist/AbleObject.js.map +1 -1
  6. package/dist/Group.d.ts +130 -10
  7. package/dist/Group.js +311 -129
  8. package/dist/Group.js.map +1 -1
  9. package/dist/Group.test.js +77 -2
  10. package/dist/Group.test.js.map +1 -1
  11. package/dist/Tilmeld.d.ts +237 -9
  12. package/dist/Tilmeld.js +569 -201
  13. package/dist/Tilmeld.js.map +1 -1
  14. package/dist/User.d.ts +344 -16
  15. package/dist/User.js +979 -313
  16. package/dist/User.js.map +1 -1
  17. package/dist/User.test.js +63 -2
  18. package/dist/User.test.js.map +1 -1
  19. package/dist/conf/d.d.ts +250 -3
  20. package/dist/conf/defaults.js +146 -98
  21. package/dist/conf/defaults.js.map +1 -1
  22. package/dist/enforceTilmeld.d.ts +3 -0
  23. package/dist/enforceTilmeld.js +22 -0
  24. package/dist/enforceTilmeld.js.map +1 -0
  25. package/dist/errors/AccessControlError.d.ts +2 -1
  26. package/dist/errors/AccessControlError.js +3 -2
  27. package/dist/errors/AccessControlError.js.map +1 -1
  28. package/dist/errors/BadDataError.d.ts +2 -1
  29. package/dist/errors/BadDataError.js +3 -2
  30. package/dist/errors/BadDataError.js.map +1 -1
  31. package/dist/errors/BadEmailError.d.ts +2 -1
  32. package/dist/errors/BadEmailError.js +3 -2
  33. package/dist/errors/BadEmailError.js.map +1 -1
  34. package/dist/errors/BadUsernameError.d.ts +2 -1
  35. package/dist/errors/BadUsernameError.js +3 -2
  36. package/dist/errors/BadUsernameError.js.map +1 -1
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.js +1 -0
  39. package/dist/index.js.map +1 -1
  40. package/package.json +30 -26
  41. package/src/AbleObject.ts +2 -2
  42. package/src/Group.test.ts +102 -4
  43. package/src/Group.ts +274 -158
  44. package/src/Tilmeld.ts +383 -249
  45. package/src/User.test.ts +80 -4
  46. package/src/User.ts +1061 -382
  47. package/src/conf/d.ts +26 -13
  48. package/src/conf/defaults.ts +151 -104
  49. package/src/enforceTilmeld.ts +20 -0
  50. package/src/errors/AccessControlError.ts +4 -2
  51. package/src/errors/BadDataError.ts +4 -2
  52. package/src/errors/BadEmailError.ts +4 -2
  53. package/src/errors/BadUsernameError.ts +4 -2
  54. package/src/index.ts +2 -0
  55. package/src/tilmeldJoiProps.ts +9 -9
  56. package/tsconfig.json +3 -3
  57. package/typedoc.json +4 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,332 @@
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/tilmeld
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/tilmeld
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/tilmeld
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/tilmeld
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/tilmeld
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/tilmeld
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/tilmeld
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
+ ### Bug Fixes
47
+
48
+ - assign generated and default groups to users created through admin app ([7ea0baa](https://github.com/sciactive/nymphjs/commit/7ea0baaf3a2c1285a63ee95ec153f38c169af6b6))
49
+
50
+ ### Features
51
+
52
+ - use unique constraint to guarantee username, groupname, and email uniqueness ([eff5cc4](https://github.com/sciactive/nymphjs/commit/eff5cc43fbbf31e66ede17f42d38de07a0344ede))
53
+
54
+ # [1.0.0-beta.61](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.60...v1.0.0-beta.61) (2024-06-14)
55
+
56
+ **Note:** Version bump only for package @nymphjs/tilmeld
57
+
58
+ # [1.0.0-beta.60](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.59...v1.0.0-beta.60) (2024-06-14)
59
+
60
+ **Note:** Version bump only for package @nymphjs/tilmeld
61
+
62
+ # [1.0.0-beta.59](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.58...v1.0.0-beta.59) (2024-06-14)
63
+
64
+ ### Features
65
+
66
+ - add uniqueness constraint feature, refactor some types ([8133d32](https://github.com/sciactive/nymphjs/commit/8133d32b2c04907182dca2e9171b8217ed1b57e4))
67
+
68
+ # [1.0.0-beta.58](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.57...v1.0.0-beta.58) (2024-06-12)
69
+
70
+ **Note:** Version bump only for package @nymphjs/tilmeld
71
+
72
+ # [1.0.0-beta.57](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.56...v1.0.0-beta.57) (2024-06-12)
73
+
74
+ ### Features
75
+
76
+ - add debug logs to tilmeld ([52dfc26](https://github.com/sciactive/nymphjs/commit/52dfc26f41401b5fe17807158d79e8ccba3ed280))
77
+
78
+ # [1.0.0-beta.56](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.55...v1.0.0-beta.56) (2024-06-11)
79
+
80
+ ### Bug Fixes
81
+
82
+ - use HttpError in tilmeld ([13893d5](https://github.com/sciactive/nymphjs/commit/13893d5b27f8540c1ed6a8d75a39ce6e0c638b93))
83
+
84
+ ### Features
85
+
86
+ - allow connections where tokens are not renewed ([39071a5](https://github.com/sciactive/nymphjs/commit/39071a545644075190bd8213be25e0a0c46d2b5d))
87
+
88
+ # [1.0.0-beta.55](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.54...v1.0.0-beta.55) (2024-05-26)
89
+
90
+ **Note:** Version bump only for package @nymphjs/tilmeld
91
+
92
+ # [1.0.0-beta.54](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.53...v1.0.0-beta.54) (2024-05-26)
93
+
94
+ **Note:** Version bump only for package @nymphjs/tilmeld
95
+
96
+ # [1.0.0-beta.53](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.52...v1.0.0-beta.53) (2024-05-26)
97
+
98
+ **Note:** Version bump only for package @nymphjs/tilmeld
99
+
100
+ # [1.0.0-beta.52](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.51...v1.0.0-beta.52) (2024-05-25)
101
+
102
+ ### Bug Fixes
103
+
104
+ - support setup app and users and groups when userFields is limited ([20e25a2](https://github.com/sciactive/nymphjs/commit/20e25a2bcc35f96b3146fd9d973e34083a85f854))
105
+
106
+ # [1.0.0-beta.51](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.50...v1.0.0-beta.51) (2024-04-12)
107
+
108
+ **Note:** Version bump only for package @nymphjs/tilmeld
109
+
110
+ # [1.0.0-beta.50](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.49...v1.0.0-beta.50) (2024-04-08)
111
+
112
+ ### Bug Fixes
113
+
114
+ - run beforeRegister callbacks within the registration transaction ([0c50329](https://github.com/sciactive/nymphjs/commit/0c503299d8bee5bba323e23e34583b9b59823af5))
115
+
116
+ # [1.0.0-beta.49](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.48...v1.0.0-beta.49) (2024-03-04)
117
+
118
+ ### Bug Fixes
119
+
120
+ - change some jwt defaults and fix nbf date ([cff5f38](https://github.com/sciactive/nymphjs/commit/cff5f38da6c1624b3fc27655e3601f409f8b86c2))
121
+
122
+ # [1.0.0-beta.48](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.47...v1.0.0-beta.48) (2023-11-10)
123
+
124
+ ### Bug Fixes
125
+
126
+ - avoid trying to roll back a transaction twice ([e26ef31](https://github.com/sciactive/nymphjs/commit/e26ef312b617edcc715c81e7f92875dfaa7a904a))
127
+
128
+ # [1.0.0-beta.47](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.46...v1.0.0-beta.47) (2023-11-10)
129
+
130
+ **Note:** Version bump only for package @nymphjs/tilmeld
131
+
132
+ # [1.0.0-beta.46](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.45...v1.0.0-beta.46) (2023-08-29)
133
+
134
+ ### Bug Fixes
135
+
136
+ - secure cookies ([85d3ca4](https://github.com/sciactive/nymphjs/commit/85d3ca49f9ecdcdbaf68fee6639c3e77a4aeb109))
137
+
138
+ ### Features
139
+
140
+ - add minimum username length ([fcb317a](https://github.com/sciactive/nymphjs/commit/fcb317ad8f758a89b1b24f377b506e8a38f9ad41))
141
+ - enable tilmeld admins to remove totp secret from users ([18455b3](https://github.com/sciactive/nymphjs/commit/18455b3edbbfa1188f8cf317438bbfa028ba8f47))
142
+
143
+ # [1.0.0-beta.45](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.44...v1.0.0-beta.45) (2023-07-17)
144
+
145
+ **Note:** Version bump only for package @nymphjs/tilmeld
146
+
147
+ # [1.0.0-beta.44](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.43...v1.0.0-beta.44) (2023-07-13)
148
+
149
+ ### Bug Fixes
150
+
151
+ - wake before gatekeeper check ([1b7e985](https://github.com/sciactive/nymphjs/commit/1b7e985c41bd758c478503b9e51efcc2df5e6a91))
152
+
153
+ # [1.0.0-beta.43](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.42...v1.0.0-beta.43) (2023-07-12)
154
+
155
+ ### Bug Fixes
156
+
157
+ - update calls to gatekeeper to not use await ([ad36172](https://github.com/sciactive/nymphjs/commit/ad361725b67054aeb9e8e1c1a221c8e150a2c737))
158
+
159
+ # [1.0.0-beta.42](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.41...v1.0.0-beta.42) (2023-07-12)
160
+
161
+ ### Features
162
+
163
+ - make fillSession async so that gatekeeper can be sync ([fb6def4](https://github.com/sciactive/nymphjs/commit/fb6def45cd031516c9bcd3438f905e2ff881707b))
164
+
165
+ # [1.0.0-beta.41](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2023-07-12)
166
+
167
+ ### Features
168
+
169
+ - remove synchronous database queries ([b579fb2](https://github.com/sciactive/nymphjs/commit/b579fb2eacd96cdd1b386a62c5c00cdbb2438f6e))
170
+ - rewrite server side async api to match client side api ([9c537a8](https://github.com/sciactive/nymphjs/commit/9c537a8be49e9b989af0822a4c2236e8c2d20f87))
171
+
172
+ # [1.0.0-beta.40](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2023-07-10)
173
+
174
+ **Note:** Version bump only for package @nymphjs/tilmeld
175
+
176
+ # [1.0.0-beta.39](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2023-07-09)
177
+
178
+ **Note:** Version bump only for package @nymphjs/tilmeld
179
+
180
+ # [1.0.0-beta.38](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2023-07-09)
181
+
182
+ **Note:** Version bump only for package @nymphjs/tilmeld
183
+
184
+ # [1.0.0-beta.37](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2023-07-09)
185
+
186
+ **Note:** Version bump only for package @nymphjs/tilmeld
187
+
188
+ # [1.0.0-beta.36](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2023-07-09)
189
+
190
+ **Note:** Version bump only for package @nymphjs/tilmeld
191
+
192
+ # [1.0.0-beta.35](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2023-06-14)
193
+
194
+ **Note:** Version bump only for package @nymphjs/tilmeld
195
+
196
+ # [1.0.0-beta.34](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2023-05-13)
197
+
198
+ **Note:** Version bump only for package @nymphjs/tilmeld
199
+
200
+ # [1.0.0-beta.33](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2023-05-13)
201
+
202
+ **Note:** Version bump only for package @nymphjs/tilmeld
203
+
204
+ # [1.0.0-beta.32](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2023-05-13)
205
+
206
+ **Note:** Version bump only for package @nymphjs/tilmeld
207
+
208
+ # [1.0.0-beta.31](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2023-05-12)
209
+
210
+ **Note:** Version bump only for package @nymphjs/tilmeld
211
+
212
+ # [1.0.0-beta.30](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2023-05-12)
213
+
214
+ ### Features
215
+
216
+ - allow providing getEntityClass with a class instead of string ([ecd64c1](https://github.com/sciactive/nymphjs/commit/ecd64c1bf92e3657889613b76bcc46652f371ead))
217
+
218
+ # [1.0.0-beta.29](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2023-05-08)
219
+
220
+ **Note:** Version bump only for package @nymphjs/tilmeld
221
+
222
+ # [1.0.0-beta.28](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2023-05-05)
223
+
224
+ **Note:** Version bump only for package @nymphjs/tilmeld
225
+
226
+ # [1.0.0-beta.27](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2023-05-04)
227
+
228
+ **Note:** Version bump only for package @nymphjs/tilmeld
229
+
230
+ # [1.0.0-beta.26](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2023-05-04)
231
+
232
+ ### Features
233
+
234
+ - update packages and migrate to mysql2 ([72ad611](https://github.com/sciactive/nymphjs/commit/72ad611bd2bf7bf85c3ba8a3486503d9b50c49d6))
235
+
236
+ # [1.0.0-beta.25](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2023-05-04)
237
+
238
+ ### Bug Fixes
239
+
240
+ - tilmeld uses wrong class when cloned with user ([059c2ce](https://github.com/sciactive/nymphjs/commit/059c2cedf1b07b9681e87c240eb36723a4581918))
241
+
242
+ # [1.0.0-beta.24](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2023-05-02)
243
+
244
+ ### Bug Fixes
245
+
246
+ - fill session after setting current user clone ([7bae7cf](https://github.com/sciactive/nymphjs/commit/7bae7cf1bf236b8efc00cb7b5ed53cd21f1370c7))
247
+
248
+ # [1.0.0-beta.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2023-05-02)
249
+
250
+ ### Bug Fixes
251
+
252
+ - rare case where currentUser isn't corrent ([97f233a](https://github.com/sciactive/nymphjs/commit/97f233a5fcfd4b97dd282562b0c99097ac3ef41d))
253
+
254
+ # [1.0.0-beta.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2023-05-01)
255
+
256
+ **Note:** Version bump only for package @nymphjs/tilmeld
257
+
258
+ # [1.0.0-beta.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2023-05-01)
259
+
260
+ ### Features
261
+
262
+ - add totp two factor authentication ([cc9f8ed](https://github.com/sciactive/nymphjs/commit/cc9f8edb183271fa7f51e4b182b876efb8fa0f8d))
263
+
264
+ # [1.0.0-beta.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2023-04-30)
265
+
266
+ ### Features
267
+
268
+ - let the user revoke all current auth tokens ([63af3b9](https://github.com/sciactive/nymphjs/commit/63af3b9a31c6c221ab40c2c8a69231675f4634a2))
269
+
270
+ # [1.0.0-beta.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2023-04-29)
271
+
272
+ ### Bug Fixes
273
+
274
+ - some type issues ([ee69d5d](https://github.com/sciactive/nymphjs/commit/ee69d5d73361dacda5745d697df18fafd47810bc))
275
+
276
+ # [1.0.0-beta.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2023-04-27)
277
+
278
+ ### Bug Fixes
279
+
280
+ - small type issues ([b91579c](https://github.com/sciactive/nymphjs/commit/b91579c9c1e96500d903332648f5a93c9a7e7d9b))
281
+
282
+ ### Features
283
+
284
+ - add enforceTilmeld function ([130faf1](https://github.com/sciactive/nymphjs/commit/130faf151dcdfbfacd6814833868907dca037d24))
285
+ - add the ability to switch to a user without their password ([ca4466a](https://github.com/sciactive/nymphjs/commit/ca4466af1704d68905ac087350a8cf151c1072d9))
286
+ - forbid modifying ac props from client ([f9e896f](https://github.com/sciactive/nymphjs/commit/f9e896f6c57b08ae100bc50d33a0234b6a431333))
287
+ - remove access control bypass for sysadmins and ownerless entities, no longer needed ([345bbf4](https://github.com/sciactive/nymphjs/commit/345bbf4fd78a8f9d6d01fd0be8337854a1277ce6))
288
+
289
+ # [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
290
+
291
+ **Note:** Version bump only for package @nymphjs/tilmeld
292
+
293
+ # [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
294
+
295
+ ### Features
296
+
297
+ - add ability to tell tilmeld to log in a specific user during authentication ([922e145](https://github.com/sciactive/nymphjs/commit/922e1452adae44bed2aa9655be16e19796acb39b))
298
+ - username check callback ([372e95c](https://github.com/sciactive/nymphjs/commit/372e95c39664c0d718e497ec1b09426e7cfa8862))
299
+
300
+ # [1.0.0-beta.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-23)
301
+
302
+ **Note:** Version bump only for package @nymphjs/tilmeld
303
+
304
+ # [1.0.0-beta.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-17)
305
+
306
+ **Note:** Version bump only for package @nymphjs/tilmeld
307
+
308
+ # [1.0.0-beta.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-16)
309
+
310
+ **Note:** Version bump only for package @nymphjs/tilmeld
311
+
312
+ # [1.0.0-beta.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-04)
313
+
314
+ **Note:** Version bump only for package @nymphjs/tilmeld
315
+
316
+ # [1.0.0-beta.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2023-02-27)
317
+
318
+ **Note:** Version bump only for package @nymphjs/tilmeld
319
+
320
+ # [1.0.0-beta.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2023-01-19)
321
+
322
+ **Note:** Version bump only for package @nymphjs/tilmeld
323
+
324
+ # [1.0.0-beta.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-01-09)
325
+
326
+ **Note:** Version bump only for package @nymphjs/tilmeld
327
+
328
+ # [1.0.0-beta.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-01-09)
329
+
330
+ **Note:** Version bump only for package @nymphjs/tilmeld
331
+
6
332
  # [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
333
 
8
334
  ### Bug Fixes
package/README.md CHANGED
@@ -38,7 +38,7 @@ const nymph = new Nymph(
38
38
  new SQLite3Driver({
39
39
  filename: ':memory:',
40
40
  }),
41
- tilmeld
41
+ tilmeld,
42
42
  );
43
43
 
44
44
  // These are the classes specific to this instance of Tilmeld.
@@ -49,6 +49,19 @@ const { User, Group } = tilmeld;
49
49
 
50
50
  See the [config declaration file](src/conf/d.ts).
51
51
 
52
+ ## Abilities
53
+
54
+ There are a few abilities that Tilmeld uses internally:
55
+
56
+ - `system/admin` - A user with this ability has **all** abilities.
57
+ - `tilmeld/admin` - Allow the user to manage and edit other user's account and group information and grant/revoke abilities.
58
+ - `tilmeld/switch` - Allow the user to switch to other users (log in as them without their password).
59
+ - `uid/get/[name]` - Allow the user to read the named UID.
60
+ - `uid/new/[name]` - Allow the user to read, create, and increment the named UID.
61
+ - `uid/set/[name]` - Allow the user to read, create, increment, set, and delete the named UID.
62
+
63
+ The admin and switch abilities cannot be inherited from groups.
64
+
52
65
  # License
53
66
 
54
67
  Copyright 2021 SciActive Inc
@@ -1,7 +1,22 @@
1
1
  import { Entity } from '@nymphjs/nymph';
2
+ /**
3
+ * AbleObject abstract class.
4
+ *
5
+ * Used in entities which support abilities, such as users and groups.
6
+ */
2
7
  export default abstract class AbleObject<T extends {
3
8
  abilities?: string[];
4
9
  }> extends Entity<T> {
10
+ /**
11
+ * Grant an ability.
12
+ *
13
+ * @param ability The ability.
14
+ */
5
15
  $grant(ability: string): void;
16
+ /**
17
+ * Revoke an ability.
18
+ *
19
+ * @param ability The ability.
20
+ */
6
21
  $revoke(ability: string): void;
7
22
  }
@@ -1,15 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const nymph_1 = require("@nymphjs/nymph");
4
+ /**
5
+ * AbleObject abstract class.
6
+ *
7
+ * Used in entities which support abilities, such as users and groups.
8
+ */
4
9
  class AbleObject extends nymph_1.Entity {
10
+ /**
11
+ * Grant an ability.
12
+ *
13
+ * @param ability The ability.
14
+ */
5
15
  $grant(ability) {
6
16
  if (!Array.isArray(this.$data.abilities)) {
7
17
  this.$data.abilities = [];
8
18
  }
9
- if (this.$data.abilities.indexOf(ability) === -1) {
19
+ if (!this.$data.abilities.includes(ability)) {
10
20
  this.$data.abilities.push(ability);
11
21
  }
12
22
  }
23
+ /**
24
+ * Revoke an ability.
25
+ *
26
+ * @param ability The ability.
27
+ */
13
28
  $revoke(ability) {
14
29
  if (!Array.isArray(this.$data.abilities)) {
15
30
  this.$data.abilities = [];
@@ -1 +1 @@
1
- {"version":3,"file":"AbleObject.js","sourceRoot":"","sources":["../src/AbleObject.ts"],"names":[],"mappings":";;AAAA,0CAAwC;AAOxC,MAA8B,UAE5B,SAAQ,cAAS;IAMV,MAAM,CAAC,OAAe;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACxC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;SAC3B;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;YAChD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACpC;IACH,CAAC;IAOM,OAAO,CAAC,OAAe;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACxC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;SAC3B;QACD,IAAI,GAAW,CAAC;QAChB,GAAG;YACD,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;aACrC;SACF,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAE;IACvB,CAAC;CACF;AAlCD,6BAkCC"}
1
+ {"version":3,"file":"AbleObject.js","sourceRoot":"","sources":["../src/AbleObject.ts"],"names":[],"mappings":";;AAAA,0CAAwC;AAExC;;;;GAIG;AACH,MAA8B,UAE5B,SAAQ,cAAS;IACjB;;;;OAIG;IACI,MAAM,CAAC,OAAe;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,OAAe;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;QAC5B,CAAC;QACD,IAAI,GAAW,CAAC;QAChB,GAAG,CAAC;YACF,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAE;IACvB,CAAC;CACF;AAlCD,6BAkCC"}
package/dist/Group.d.ts CHANGED
@@ -1,23 +1,70 @@
1
- import { EntityData, EntityJson, EntityPatch, Options, Selector, SerializedEntityData } from '@nymphjs/nymph';
2
- import type Tilmeld from './Tilmeld';
1
+ import type { Nymph, EntityData, EntityJson, EntityPatch, Options, Selector, SerializedEntityData } from '@nymphjs/nymph';
3
2
  import AbleObject from './AbleObject';
4
- import User, { UserData } from './User';
3
+ import type User from './User';
4
+ import type { UserData } from './User';
5
5
  export type GroupData = {
6
+ /**
7
+ * The abilities granted to the group.
8
+ */
6
9
  abilities?: string[];
10
+ /**
11
+ * The group's groupname.
12
+ */
7
13
  groupname?: string;
14
+ /**
15
+ * The group's name.
16
+ */
8
17
  name?: string;
18
+ /**
19
+ * The group's email address.
20
+ */
9
21
  email?: string;
22
+ /**
23
+ * The group's avatar URL. (Use getAvatar() to support Gravatar.)
24
+ */
10
25
  avatar?: string;
26
+ /**
27
+ * The group's telephone number.
28
+ */
11
29
  phone?: string;
30
+ /**
31
+ * The group's parent.
32
+ */
12
33
  parent?: Group & GroupData;
34
+ /**
35
+ * If generatePrimary is on, this will be the user who generated this group.
36
+ */
13
37
  user?: (User & UserData) | null;
38
+ /**
39
+ * Whether the group can be used.
40
+ */
14
41
  enabled?: boolean;
42
+ /**
43
+ * Whether this group is the default primary group for new users.
44
+ */
15
45
  defaultPrimary?: boolean;
46
+ /**
47
+ * Whether this group is a default secondary group for new users.
48
+ */
16
49
  defaultSecondary?: boolean;
50
+ /**
51
+ * Whether this group is a default secondary group for unverified users.
52
+ */
17
53
  unverifiedSecondary?: boolean;
18
54
  };
55
+ /**
56
+ * A user group data model.
57
+ *
58
+ * Written by Hunter Perrin for SciActive.
59
+ *
60
+ * @author Hunter Perrin <hperrin@gmail.com>
61
+ * @copyright SciActive Inc
62
+ * @see http://nymph.io/
63
+ */
19
64
  export default class Group extends AbleObject<GroupData> {
20
- static tilmeld: Tilmeld;
65
+ /**
66
+ * The instance of Tilmeld to use for queries.
67
+ */
21
68
  static ETYPE: string;
22
69
  static class: string;
23
70
  private static DEFAULT_PRIVATE_DATA;
@@ -29,29 +76,100 @@ export default class Group extends AbleObject<GroupData> {
29
76
  static searchRestrictedData: string[];
30
77
  protected $allowlistData?: string[] | undefined;
31
78
  protected $allowlistTags?: string[];
79
+ /**
80
+ * This should only be used by the backend.
81
+ */
32
82
  private $skipAcWhenSaving;
33
- static factory(guid?: string): Promise<Group & GroupData>;
83
+ /**
84
+ * This should only be used by the backend.
85
+ */
86
+ private $skipAcWhenDeleting;
34
87
  static factoryGroupname(groupname?: string): Promise<Group & GroupData>;
35
- static factorySync(guid?: string): Group & GroupData;
36
- constructor(guid?: string);
88
+ /**
89
+ * Get all the groups that can be assigned as primary groups.
90
+ *
91
+ * @param options The options for an optional search query.
92
+ * @param selectors The selectors for an optional search query.
93
+ * @returns An array of the assignable primary groups.
94
+ */
37
95
  static getPrimaryGroups(options?: Options, selectors?: Selector[]): Promise<(Group & GroupData)[]>;
96
+ /**
97
+ * Get all the groups that can be assigned as secondary groups.
98
+ *
99
+ * @param options The options for an optional search query.
100
+ * @param selectors The selectors for an optional search query.
101
+ * @returns An array of the assignable secondary groups.
102
+ */
38
103
  static getSecondaryGroups(options?: Options, selectors?: Selector[]): Promise<(Group & GroupData)[]>;
39
104
  private static getAssignableGroups;
105
+ constructor();
106
+ $setNymph(nymph: Nymph): void;
107
+ $getUniques(): Promise<string[]>;
40
108
  $getAvatar(): string;
41
109
  $jsonAcceptData(input: EntityJson, allowConflict?: boolean): void;
42
110
  $jsonAcceptPatch(patch: EntityPatch, allowConflict?: boolean): void;
43
111
  $putData(data: EntityData, sdata?: SerializedEntityData): void;
112
+ /**
113
+ * Update the data protection arrays for a user.
114
+ *
115
+ * @param givenUser User to update protection for. If undefined, will use the currently logged in user.
116
+ */
44
117
  $updateDataProtection(givenUser?: User & UserData): void;
45
- $isDescendant(givenGroup: (Group & GroupData) | string): boolean;
118
+ /**
119
+ * Check whether the group is a descendant of a group.
120
+ *
121
+ * @param group The group, or the group's GUID.
122
+ * @returns True or false.
123
+ */
124
+ $isDescendant(givenGroup: (Group & GroupData) | string): Promise<boolean>;
125
+ /**
126
+ * Gets an array of the group's child groups.
127
+ *
128
+ * @returns An array of groups.
129
+ */
46
130
  $getChildren(): Promise<(Group & GroupData)[]>;
131
+ /**
132
+ * Gets an array of the group's descendant groups.
133
+ *
134
+ * @param andSelf Include this group in the returned array.
135
+ * @returns An array of groups.
136
+ */
47
137
  $getDescendants(andSelf?: boolean): Promise<(Group & GroupData)[]>;
48
- $getDescendantsSync(andSelf?: boolean): (Group & GroupData)[];
49
- $getLevel(): number;
138
+ /**
139
+ * Get the number of parents the group has.
140
+ *
141
+ * If the group is a top level group, this will return 0. If it is a child of
142
+ * a top level group, this will return 1. If it is a grandchild of a top level
143
+ * group, this will return 2, and so on.
144
+ *
145
+ * Levels will max out at 1024 to avoid recursive loops.
146
+ *
147
+ * @returns The level of the group.
148
+ */
149
+ $getLevel(): Promise<number>;
150
+ /**
151
+ * Gets an array of users in the group.
152
+ *
153
+ * @param descendants Include users in all descendant groups too.
154
+ * @param limit The limit for the query.
155
+ * @param offset The offset for the query.
156
+ * @returns An array of users.
157
+ */
50
158
  $getUsers(descendants?: boolean, limit?: number, offset?: number): Promise<(User & UserData)[]>;
159
+ /**
160
+ * Check that a groupname is valid.
161
+ *
162
+ * @returns An object with a boolean 'result' entry and a 'message' entry.
163
+ */
51
164
  $checkGroupname(): Promise<{
52
165
  result: boolean;
53
166
  message: string;
54
167
  }>;
168
+ /**
169
+ * Check that an email is unique.
170
+ *
171
+ * @returns An object with a boolean 'result' entry and a 'message' entry.
172
+ */
55
173
  $checkEmail(): Promise<{
56
174
  result: boolean;
57
175
  message: string;
@@ -60,4 +178,6 @@ export default class Group extends AbleObject<GroupData> {
60
178
  $saveSkipAC(): Promise<boolean>;
61
179
  $tilmeldSaveSkipAC(): boolean;
62
180
  $delete(): Promise<boolean>;
181
+ $deleteSkipAC(): Promise<boolean>;
182
+ $tilmeldDeleteSkipAC(): boolean;
63
183
  }