@nymphjs/tilmeld 1.0.0-beta.8 → 1.0.0-beta.80

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 +364 -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,370 @@
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.80](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.79...v1.0.0-beta.80) (2024-09-28)
7
+
8
+ **Note:** Version bump only for package @nymphjs/tilmeld
9
+
10
+ # [1.0.0-beta.79](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.78...v1.0.0-beta.79) (2024-09-28)
11
+
12
+ **Note:** Version bump only for package @nymphjs/tilmeld
13
+
14
+ # [1.0.0-beta.78](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.77...v1.0.0-beta.78) (2024-09-27)
15
+
16
+ **Note:** Version bump only for package @nymphjs/tilmeld
17
+
18
+ # [1.0.0-beta.77](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.76...v1.0.0-beta.77) (2024-09-26)
19
+
20
+ **Note:** Version bump only for package @nymphjs/tilmeld
21
+
22
+ # [1.0.0-beta.76](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.75...v1.0.0-beta.76) (2024-09-25)
23
+
24
+ ### Features
25
+
26
+ - add info level logging and log queries at this level ([afad941](https://github.com/sciactive/nymphjs/commit/afad941f46c4e594f0981de6443e4dd0b9ffdf4c))
27
+
28
+ # [1.0.0-beta.75](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.74...v1.0.0-beta.75) (2024-09-24)
29
+
30
+ **Note:** Version bump only for package @nymphjs/tilmeld
31
+
32
+ # [1.0.0-beta.74](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.73...v1.0.0-beta.74) (2024-09-21)
33
+
34
+ **Note:** Version bump only for package @nymphjs/tilmeld
35
+
36
+ # [1.0.0-beta.73](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.72...v1.0.0-beta.73) (2024-09-20)
37
+
38
+ **Note:** Version bump only for package @nymphjs/tilmeld
39
+
40
+ # [1.0.0-beta.72](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.71...v1.0.0-beta.72) (2024-09-20)
41
+
42
+ **Note:** Version bump only for package @nymphjs/tilmeld
43
+
44
+ # [1.0.0-beta.71](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.70...v1.0.0-beta.71) (2024-09-20)
45
+
46
+ **Note:** Version bump only for package @nymphjs/tilmeld
47
+
48
+ # [1.0.0-beta.70](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.69...v1.0.0-beta.70) (2024-09-20)
49
+
50
+ **Note:** Version bump only for package @nymphjs/tilmeld
51
+
52
+ # [1.0.0-beta.69](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.68...v1.0.0-beta.69) (2024-09-19)
53
+
54
+ **Note:** Version bump only for package @nymphjs/tilmeld
55
+
56
+ # [1.0.0-beta.68](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.67...v1.0.0-beta.68) (2024-09-19)
57
+
58
+ **Note:** Version bump only for package @nymphjs/tilmeld
59
+
60
+ # [1.0.0-beta.67](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.66...v1.0.0-beta.67) (2024-09-03)
61
+
62
+ **Note:** Version bump only for package @nymphjs/tilmeld
63
+
64
+ # [1.0.0-beta.66](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.65...v1.0.0-beta.66) (2024-08-06)
65
+
66
+ **Note:** Version bump only for package @nymphjs/tilmeld
67
+
68
+ # [1.0.0-beta.65](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.64...v1.0.0-beta.65) (2024-08-05)
69
+
70
+ **Note:** Version bump only for package @nymphjs/tilmeld
71
+
72
+ # [1.0.0-beta.64](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.63...v1.0.0-beta.64) (2024-08-04)
73
+
74
+ **Note:** Version bump only for package @nymphjs/tilmeld
75
+
76
+ # [1.0.0-beta.63](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.62...v1.0.0-beta.63) (2024-06-18)
77
+
78
+ ### Bug Fixes
79
+
80
+ - undo ts compilation to module change ([84be6d4](https://github.com/sciactive/nymphjs/commit/84be6d434be29f8afd53907d15be2eb77d1736ce))
81
+
82
+ ### Features
83
+
84
+ - export data iterator ([b86aa19](https://github.com/sciactive/nymphjs/commit/b86aa19fc77d744b5a683046dfb697fc4746df5c))
85
+
86
+ # [1.0.0-beta.62](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.61...v1.0.0-beta.62) (2024-06-15)
87
+
88
+ ### Bug Fixes
89
+
90
+ - assign generated and default groups to users created through admin app ([7ea0baa](https://github.com/sciactive/nymphjs/commit/7ea0baaf3a2c1285a63ee95ec153f38c169af6b6))
91
+
92
+ ### Features
93
+
94
+ - use unique constraint to guarantee username, groupname, and email uniqueness ([eff5cc4](https://github.com/sciactive/nymphjs/commit/eff5cc43fbbf31e66ede17f42d38de07a0344ede))
95
+
96
+ # [1.0.0-beta.61](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.60...v1.0.0-beta.61) (2024-06-14)
97
+
98
+ **Note:** Version bump only for package @nymphjs/tilmeld
99
+
100
+ # [1.0.0-beta.60](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.59...v1.0.0-beta.60) (2024-06-14)
101
+
102
+ **Note:** Version bump only for package @nymphjs/tilmeld
103
+
104
+ # [1.0.0-beta.59](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.58...v1.0.0-beta.59) (2024-06-14)
105
+
106
+ ### Features
107
+
108
+ - add uniqueness constraint feature, refactor some types ([8133d32](https://github.com/sciactive/nymphjs/commit/8133d32b2c04907182dca2e9171b8217ed1b57e4))
109
+
110
+ # [1.0.0-beta.58](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.57...v1.0.0-beta.58) (2024-06-12)
111
+
112
+ **Note:** Version bump only for package @nymphjs/tilmeld
113
+
114
+ # [1.0.0-beta.57](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.56...v1.0.0-beta.57) (2024-06-12)
115
+
116
+ ### Features
117
+
118
+ - add debug logs to tilmeld ([52dfc26](https://github.com/sciactive/nymphjs/commit/52dfc26f41401b5fe17807158d79e8ccba3ed280))
119
+
120
+ # [1.0.0-beta.56](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.55...v1.0.0-beta.56) (2024-06-11)
121
+
122
+ ### Bug Fixes
123
+
124
+ - use HttpError in tilmeld ([13893d5](https://github.com/sciactive/nymphjs/commit/13893d5b27f8540c1ed6a8d75a39ce6e0c638b93))
125
+
126
+ ### Features
127
+
128
+ - allow connections where tokens are not renewed ([39071a5](https://github.com/sciactive/nymphjs/commit/39071a545644075190bd8213be25e0a0c46d2b5d))
129
+
130
+ # [1.0.0-beta.55](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.54...v1.0.0-beta.55) (2024-05-26)
131
+
132
+ **Note:** Version bump only for package @nymphjs/tilmeld
133
+
134
+ # [1.0.0-beta.54](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.53...v1.0.0-beta.54) (2024-05-26)
135
+
136
+ **Note:** Version bump only for package @nymphjs/tilmeld
137
+
138
+ # [1.0.0-beta.53](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.52...v1.0.0-beta.53) (2024-05-26)
139
+
140
+ **Note:** Version bump only for package @nymphjs/tilmeld
141
+
142
+ # [1.0.0-beta.52](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.51...v1.0.0-beta.52) (2024-05-25)
143
+
144
+ ### Bug Fixes
145
+
146
+ - support setup app and users and groups when userFields is limited ([20e25a2](https://github.com/sciactive/nymphjs/commit/20e25a2bcc35f96b3146fd9d973e34083a85f854))
147
+
148
+ # [1.0.0-beta.51](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.50...v1.0.0-beta.51) (2024-04-12)
149
+
150
+ **Note:** Version bump only for package @nymphjs/tilmeld
151
+
152
+ # [1.0.0-beta.50](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.49...v1.0.0-beta.50) (2024-04-08)
153
+
154
+ ### Bug Fixes
155
+
156
+ - run beforeRegister callbacks within the registration transaction ([0c50329](https://github.com/sciactive/nymphjs/commit/0c503299d8bee5bba323e23e34583b9b59823af5))
157
+
158
+ # [1.0.0-beta.49](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.48...v1.0.0-beta.49) (2024-03-04)
159
+
160
+ ### Bug Fixes
161
+
162
+ - change some jwt defaults and fix nbf date ([cff5f38](https://github.com/sciactive/nymphjs/commit/cff5f38da6c1624b3fc27655e3601f409f8b86c2))
163
+
164
+ # [1.0.0-beta.48](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.47...v1.0.0-beta.48) (2023-11-10)
165
+
166
+ ### Bug Fixes
167
+
168
+ - avoid trying to roll back a transaction twice ([e26ef31](https://github.com/sciactive/nymphjs/commit/e26ef312b617edcc715c81e7f92875dfaa7a904a))
169
+
170
+ # [1.0.0-beta.47](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.46...v1.0.0-beta.47) (2023-11-10)
171
+
172
+ **Note:** Version bump only for package @nymphjs/tilmeld
173
+
174
+ # [1.0.0-beta.46](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.45...v1.0.0-beta.46) (2023-08-29)
175
+
176
+ ### Bug Fixes
177
+
178
+ - secure cookies ([85d3ca4](https://github.com/sciactive/nymphjs/commit/85d3ca49f9ecdcdbaf68fee6639c3e77a4aeb109))
179
+
180
+ ### Features
181
+
182
+ - add minimum username length ([fcb317a](https://github.com/sciactive/nymphjs/commit/fcb317ad8f758a89b1b24f377b506e8a38f9ad41))
183
+ - enable tilmeld admins to remove totp secret from users ([18455b3](https://github.com/sciactive/nymphjs/commit/18455b3edbbfa1188f8cf317438bbfa028ba8f47))
184
+
185
+ # [1.0.0-beta.45](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.44...v1.0.0-beta.45) (2023-07-17)
186
+
187
+ **Note:** Version bump only for package @nymphjs/tilmeld
188
+
189
+ # [1.0.0-beta.44](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.43...v1.0.0-beta.44) (2023-07-13)
190
+
191
+ ### Bug Fixes
192
+
193
+ - wake before gatekeeper check ([1b7e985](https://github.com/sciactive/nymphjs/commit/1b7e985c41bd758c478503b9e51efcc2df5e6a91))
194
+
195
+ # [1.0.0-beta.43](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.42...v1.0.0-beta.43) (2023-07-12)
196
+
197
+ ### Bug Fixes
198
+
199
+ - update calls to gatekeeper to not use await ([ad36172](https://github.com/sciactive/nymphjs/commit/ad361725b67054aeb9e8e1c1a221c8e150a2c737))
200
+
201
+ # [1.0.0-beta.42](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.41...v1.0.0-beta.42) (2023-07-12)
202
+
203
+ ### Features
204
+
205
+ - make fillSession async so that gatekeeper can be sync ([fb6def4](https://github.com/sciactive/nymphjs/commit/fb6def45cd031516c9bcd3438f905e2ff881707b))
206
+
207
+ # [1.0.0-beta.41](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2023-07-12)
208
+
209
+ ### Features
210
+
211
+ - remove synchronous database queries ([b579fb2](https://github.com/sciactive/nymphjs/commit/b579fb2eacd96cdd1b386a62c5c00cdbb2438f6e))
212
+ - rewrite server side async api to match client side api ([9c537a8](https://github.com/sciactive/nymphjs/commit/9c537a8be49e9b989af0822a4c2236e8c2d20f87))
213
+
214
+ # [1.0.0-beta.40](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2023-07-10)
215
+
216
+ **Note:** Version bump only for package @nymphjs/tilmeld
217
+
218
+ # [1.0.0-beta.39](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2023-07-09)
219
+
220
+ **Note:** Version bump only for package @nymphjs/tilmeld
221
+
222
+ # [1.0.0-beta.38](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2023-07-09)
223
+
224
+ **Note:** Version bump only for package @nymphjs/tilmeld
225
+
226
+ # [1.0.0-beta.37](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2023-07-09)
227
+
228
+ **Note:** Version bump only for package @nymphjs/tilmeld
229
+
230
+ # [1.0.0-beta.36](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2023-07-09)
231
+
232
+ **Note:** Version bump only for package @nymphjs/tilmeld
233
+
234
+ # [1.0.0-beta.35](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2023-06-14)
235
+
236
+ **Note:** Version bump only for package @nymphjs/tilmeld
237
+
238
+ # [1.0.0-beta.34](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2023-05-13)
239
+
240
+ **Note:** Version bump only for package @nymphjs/tilmeld
241
+
242
+ # [1.0.0-beta.33](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2023-05-13)
243
+
244
+ **Note:** Version bump only for package @nymphjs/tilmeld
245
+
246
+ # [1.0.0-beta.32](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2023-05-13)
247
+
248
+ **Note:** Version bump only for package @nymphjs/tilmeld
249
+
250
+ # [1.0.0-beta.31](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2023-05-12)
251
+
252
+ **Note:** Version bump only for package @nymphjs/tilmeld
253
+
254
+ # [1.0.0-beta.30](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2023-05-12)
255
+
256
+ ### Features
257
+
258
+ - allow providing getEntityClass with a class instead of string ([ecd64c1](https://github.com/sciactive/nymphjs/commit/ecd64c1bf92e3657889613b76bcc46652f371ead))
259
+
260
+ # [1.0.0-beta.29](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2023-05-08)
261
+
262
+ **Note:** Version bump only for package @nymphjs/tilmeld
263
+
264
+ # [1.0.0-beta.28](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2023-05-05)
265
+
266
+ **Note:** Version bump only for package @nymphjs/tilmeld
267
+
268
+ # [1.0.0-beta.27](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2023-05-04)
269
+
270
+ **Note:** Version bump only for package @nymphjs/tilmeld
271
+
272
+ # [1.0.0-beta.26](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2023-05-04)
273
+
274
+ ### Features
275
+
276
+ - update packages and migrate to mysql2 ([72ad611](https://github.com/sciactive/nymphjs/commit/72ad611bd2bf7bf85c3ba8a3486503d9b50c49d6))
277
+
278
+ # [1.0.0-beta.25](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2023-05-04)
279
+
280
+ ### Bug Fixes
281
+
282
+ - tilmeld uses wrong class when cloned with user ([059c2ce](https://github.com/sciactive/nymphjs/commit/059c2cedf1b07b9681e87c240eb36723a4581918))
283
+
284
+ # [1.0.0-beta.24](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2023-05-02)
285
+
286
+ ### Bug Fixes
287
+
288
+ - fill session after setting current user clone ([7bae7cf](https://github.com/sciactive/nymphjs/commit/7bae7cf1bf236b8efc00cb7b5ed53cd21f1370c7))
289
+
290
+ # [1.0.0-beta.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2023-05-02)
291
+
292
+ ### Bug Fixes
293
+
294
+ - rare case where currentUser isn't corrent ([97f233a](https://github.com/sciactive/nymphjs/commit/97f233a5fcfd4b97dd282562b0c99097ac3ef41d))
295
+
296
+ # [1.0.0-beta.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2023-05-01)
297
+
298
+ **Note:** Version bump only for package @nymphjs/tilmeld
299
+
300
+ # [1.0.0-beta.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2023-05-01)
301
+
302
+ ### Features
303
+
304
+ - add totp two factor authentication ([cc9f8ed](https://github.com/sciactive/nymphjs/commit/cc9f8edb183271fa7f51e4b182b876efb8fa0f8d))
305
+
306
+ # [1.0.0-beta.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2023-04-30)
307
+
308
+ ### Features
309
+
310
+ - let the user revoke all current auth tokens ([63af3b9](https://github.com/sciactive/nymphjs/commit/63af3b9a31c6c221ab40c2c8a69231675f4634a2))
311
+
312
+ # [1.0.0-beta.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2023-04-29)
313
+
314
+ ### Bug Fixes
315
+
316
+ - some type issues ([ee69d5d](https://github.com/sciactive/nymphjs/commit/ee69d5d73361dacda5745d697df18fafd47810bc))
317
+
318
+ # [1.0.0-beta.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2023-04-27)
319
+
320
+ ### Bug Fixes
321
+
322
+ - small type issues ([b91579c](https://github.com/sciactive/nymphjs/commit/b91579c9c1e96500d903332648f5a93c9a7e7d9b))
323
+
324
+ ### Features
325
+
326
+ - add enforceTilmeld function ([130faf1](https://github.com/sciactive/nymphjs/commit/130faf151dcdfbfacd6814833868907dca037d24))
327
+ - add the ability to switch to a user without their password ([ca4466a](https://github.com/sciactive/nymphjs/commit/ca4466af1704d68905ac087350a8cf151c1072d9))
328
+ - forbid modifying ac props from client ([f9e896f](https://github.com/sciactive/nymphjs/commit/f9e896f6c57b08ae100bc50d33a0234b6a431333))
329
+ - remove access control bypass for sysadmins and ownerless entities, no longer needed ([345bbf4](https://github.com/sciactive/nymphjs/commit/345bbf4fd78a8f9d6d01fd0be8337854a1277ce6))
330
+
331
+ # [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
332
+
333
+ **Note:** Version bump only for package @nymphjs/tilmeld
334
+
335
+ # [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
336
+
337
+ ### Features
338
+
339
+ - add ability to tell tilmeld to log in a specific user during authentication ([922e145](https://github.com/sciactive/nymphjs/commit/922e1452adae44bed2aa9655be16e19796acb39b))
340
+ - username check callback ([372e95c](https://github.com/sciactive/nymphjs/commit/372e95c39664c0d718e497ec1b09426e7cfa8862))
341
+
342
+ # [1.0.0-beta.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-23)
343
+
344
+ **Note:** Version bump only for package @nymphjs/tilmeld
345
+
346
+ # [1.0.0-beta.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-17)
347
+
348
+ **Note:** Version bump only for package @nymphjs/tilmeld
349
+
350
+ # [1.0.0-beta.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-16)
351
+
352
+ **Note:** Version bump only for package @nymphjs/tilmeld
353
+
354
+ # [1.0.0-beta.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-04)
355
+
356
+ **Note:** Version bump only for package @nymphjs/tilmeld
357
+
358
+ # [1.0.0-beta.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2023-02-27)
359
+
360
+ **Note:** Version bump only for package @nymphjs/tilmeld
361
+
362
+ # [1.0.0-beta.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2023-01-19)
363
+
364
+ **Note:** Version bump only for package @nymphjs/tilmeld
365
+
366
+ # [1.0.0-beta.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-01-09)
367
+
368
+ **Note:** Version bump only for package @nymphjs/tilmeld
369
+
6
370
  # [1.0.0-beta.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-01-09)
7
371
 
8
372
  **Note:** Version bump only for package @nymphjs/tilmeld
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
  }