@nymphjs/tilmeld-setup 1.0.0-beta.4 → 1.0.0-beta.40

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,169 @@
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.40](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2023-07-10)
7
+
8
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
9
+
10
+ # [1.0.0-beta.39](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2023-07-09)
11
+
12
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
13
+
14
+ # [1.0.0-beta.38](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2023-07-09)
15
+
16
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
17
+
18
+ # [1.0.0-beta.37](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2023-07-09)
19
+
20
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
21
+
22
+ # [1.0.0-beta.36](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2023-07-09)
23
+
24
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
25
+
26
+ # [1.0.0-beta.35](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2023-06-14)
27
+
28
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
29
+
30
+ # [1.0.0-beta.34](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2023-05-13)
31
+
32
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
33
+
34
+ # [1.0.0-beta.33](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2023-05-13)
35
+
36
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
37
+
38
+ # [1.0.0-beta.32](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2023-05-13)
39
+
40
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
41
+
42
+ # [1.0.0-beta.31](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2023-05-12)
43
+
44
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
45
+
46
+ # [1.0.0-beta.30](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2023-05-12)
47
+
48
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
49
+
50
+ # [1.0.0-beta.29](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2023-05-08)
51
+
52
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
53
+
54
+ # [1.0.0-beta.28](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2023-05-05)
55
+
56
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
57
+
58
+ # [1.0.0-beta.27](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2023-05-04)
59
+
60
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
61
+
62
+ # [1.0.0-beta.26](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2023-05-04)
63
+
64
+ ### Features
65
+
66
+ - update packages and migrate to mysql2 ([72ad611](https://github.com/sciactive/nymphjs/commit/72ad611bd2bf7bf85c3ba8a3486503d9b50c49d6))
67
+
68
+ # [1.0.0-beta.25](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2023-05-04)
69
+
70
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
71
+
72
+ # [1.0.0-beta.24](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2023-05-02)
73
+
74
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
75
+
76
+ # [1.0.0-beta.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2023-05-02)
77
+
78
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
79
+
80
+ # [1.0.0-beta.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2023-05-01)
81
+
82
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
83
+
84
+ # [1.0.0-beta.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2023-05-01)
85
+
86
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
87
+
88
+ # [1.0.0-beta.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2023-04-30)
89
+
90
+ ### Features
91
+
92
+ - let the user revoke all current auth tokens ([63af3b9](https://github.com/sciactive/nymphjs/commit/63af3b9a31c6c221ab40c2c8a69231675f4634a2))
93
+
94
+ # [1.0.0-beta.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2023-04-29)
95
+
96
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
97
+
98
+ # [1.0.0-beta.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2023-04-27)
99
+
100
+ ### Bug Fixes
101
+
102
+ - small type issues ([b91579c](https://github.com/sciactive/nymphjs/commit/b91579c9c1e96500d903332648f5a93c9a7e7d9b))
103
+
104
+ ### Features
105
+
106
+ - add enforceTilmeld function ([130faf1](https://github.com/sciactive/nymphjs/commit/130faf151dcdfbfacd6814833868907dca037d24))
107
+ - add the ability to switch to a user without their password ([ca4466a](https://github.com/sciactive/nymphjs/commit/ca4466af1704d68905ac087350a8cf151c1072d9))
108
+
109
+ # [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
110
+
111
+ ### Features
112
+
113
+ - add spa router to user admin app ([25bb344](https://github.com/sciactive/nymphjs/commit/25bb344f4d358eeb2254df98782f1cba229b5f50))
114
+
115
+ # [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
116
+
117
+ ### Features
118
+
119
+ - add ability to tell tilmeld to log in a specific user during authentication ([922e145](https://github.com/sciactive/nymphjs/commit/922e1452adae44bed2aa9655be16e19796acb39b))
120
+
121
+ # [1.0.0-beta.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-23)
122
+
123
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
124
+
125
+ # [1.0.0-beta.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-17)
126
+
127
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
128
+
129
+ # [1.0.0-beta.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-16)
130
+
131
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
132
+
133
+ # [1.0.0-beta.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-04)
134
+
135
+ ### Bug Fixes
136
+
137
+ - make sure all default exports are also named exports ([06da9a6](https://github.com/sciactive/nymphjs/commit/06da9a61d444860f70b7f5b95b824547d9880500))
138
+
139
+ # [1.0.0-beta.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2023-02-27)
140
+
141
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
142
+
143
+ # [1.0.0-beta.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2023-01-19)
144
+
145
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
146
+
147
+ # [1.0.0-beta.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-01-09)
148
+
149
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
150
+
151
+ # [1.0.0-beta.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-01-09)
152
+
153
+ ### Features
154
+
155
+ - make entities in nymph client instance specific too ([1029f06](https://github.com/sciactive/nymphjs/commit/1029f061a1ad193e4a8a2dab0186b9a4b517f646))
156
+
157
+ # [1.0.0-beta.7](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2023-01-05)
158
+
159
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
160
+
161
+ # [1.0.0-beta.6](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2023-01-05)
162
+
163
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
164
+
165
+ # [1.0.0-beta.5](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2022-11-24)
166
+
167
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
168
+
6
169
  # [1.0.0-beta.4](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2022-11-23)
7
170
 
8
171
  **Note:** Version bump only for package @nymphjs/tilmeld-setup
package/README.md CHANGED
@@ -53,7 +53,8 @@ const app = express();
53
53
 
54
54
  // Use the REST server.
55
55
  app.use('/rest', createServer(nymph));
56
- // Use the Tilmeld Setup App, passing in the Nymph Client Config.
56
+
57
+ // Create Tilmeld setup app.
57
58
  app.use(
58
59
  '/user',
59
60
  setup(
@@ -33,16 +33,6 @@
33
33
  <path fill="currentColor" d={mdiMastodon} />
34
34
  </Icon>
35
35
  </IconButton>
36
- <IconButton
37
- href="https://twitter.com/SciActive"
38
- target="_blank"
39
- rel="noreferrer"
40
- title="SciActive on Twitter"
41
- >
42
- <Icon component={Svg} viewBox="0 0 24 24">
43
- <path fill="currentColor" d={mdiTwitter} />
44
- </Icon>
45
- </IconButton>
46
36
  <div>
47
37
  <IconButton
48
38
  title="Account"
@@ -74,7 +64,7 @@
74
64
  : 'hide-initial-small'}"
75
65
  >
76
66
  <Content>
77
- <List>
67
+ <List tag="div">
78
68
  {#if tilmeldAdmin}
79
69
  {#each sections as section (section.name)}
80
70
  {#if 'separator' in section}
@@ -82,13 +72,12 @@
82
72
  {:else}
83
73
  <Item
84
74
  bind:this={section.component}
85
- nonInteractive={!('route' in section)}
86
- on:click={() => {
87
- if ('route' in section) {
88
- active = section.route ?? Intro;
89
- }
90
- }}
91
- activated={active === section.route}
75
+ tag="a"
76
+ nonInteractive={!('href' in section)}
77
+ href={'href' in section ? `#${section.href}` : undefined}
78
+ activated={section.absolute
79
+ ? $location === section.href
80
+ : $location.startsWith(section.href ?? '!')}
92
81
  style={section.indent
93
82
  ? 'margin-left: ' + section.indent * 25 + 'px;'
94
83
  : ''}
@@ -98,11 +87,11 @@
98
87
  {/if}
99
88
  {/each}
100
89
  {:else if user == null}
101
- <Item on:click={() => (drawerOpen = false)} activated>
90
+ <Item tag="span" on:click={() => (drawerOpen = false)} activated>
102
91
  <Text class="mdc-theme--on-secondary">Login</Text>
103
92
  </Item>
104
93
  {:else}
105
- <Item on:click={() => (drawerOpen = false)} activated>
94
+ <Item tag="span" on:click={() => (drawerOpen = false)} activated>
106
95
  <Text class="mdc-theme--on-secondary">Forbidden</Text>
107
96
  </Item>
108
97
  {/if}
@@ -117,13 +106,17 @@
117
106
  <main class="tilmeld-main-content" bind:this={mainContent}>
118
107
  {#if tilmeldAdmin}
119
108
  {#if clientConfig}
120
- <svelte:component this={active} />
109
+ <Router {routes} />
121
110
  {:else}
122
111
  Loading...
123
112
  {/if}
124
113
  {:else if user == null}
125
114
  <section style="display: flex; justify-content: center;">
126
- <Login {User} {clientConfig} />
115
+ <Login
116
+ {User}
117
+ {clientConfig}
118
+ showExistingUserToggle={allowRegistration}
119
+ />
127
120
  </section>
128
121
  {:else}
129
122
  <section>You don't have permission to access this app.</section>
@@ -135,10 +128,14 @@
135
128
 
136
129
  <script lang="ts">
137
130
  import { onMount, SvelteComponent } from 'svelte';
138
- import type { ClientConfig, CurrentUserData } from '@nymphjs/tilmeld-client';
139
- import { User } from '@nymphjs/tilmeld-client';
131
+ import Router, { location } from 'svelte-spa-router';
132
+ import type {
133
+ User as UserClass,
134
+ ClientConfig,
135
+ CurrentUserData,
136
+ } from '@nymphjs/tilmeld-client';
140
137
  import { Login, Account } from '@nymphjs/tilmeld-components';
141
- import { mdiGithub, mdiMastodon, mdiTwitter } from '@mdi/js';
138
+ import { mdiGithub, mdiMastodon } from '@mdi/js';
142
139
  import TopAppBar, { Row, Section, Title } from '@smui/top-app-bar';
143
140
  import Drawer, { Content, Scrim, AppContent } from '@smui/drawer';
144
141
  import IconButton from '@smui/icon-button';
@@ -146,28 +143,33 @@
146
143
  import Menu from '@smui/menu';
147
144
  import { Icon, Svg } from '@smui/common';
148
145
 
149
- import Intro from './Intro.svelte';
150
- import Users from './Users.svelte';
151
- import Groups from './Groups.svelte';
152
- import type { SvelteComponentDev } from 'svelte/internal';
146
+ import { User } from './nymph';
147
+ import Intro from './routes/Intro.svelte';
148
+ import Users from './routes/Users.svelte';
149
+ import UserEdit from './routes/UserEdit.svelte';
150
+ import Groups from './routes/Groups.svelte';
151
+ import GroupEdit from './routes/GroupEdit.svelte';
152
+ import NotFound from './routes/NotFound.svelte';
153
153
 
154
154
  const DEFAULT_AVATAR = 'https://secure.gravatar.com/avatar/?d=mm&s=40';
155
+ const allowRegistration = (window as any).allowRegistration;
155
156
 
156
157
  let mainContent: HTMLElement;
157
158
  let miniWindow = false;
158
159
  let drawerOpen = false;
159
160
  let accountMenu: any;
160
- let active: typeof SvelteComponentDev = Intro;
161
161
  let clientConfig: ClientConfig;
162
- let user: (User & CurrentUserData) | undefined = undefined;
162
+ let user: (UserClass & CurrentUserData) | undefined = undefined;
163
163
  let userAvatar: string = DEFAULT_AVATAR;
164
164
  let tilmeldAdmin: boolean | undefined = undefined;
165
165
  let accountOpen = false;
166
166
 
167
- $: if (active && mainContent) {
168
- drawerOpen = false;
169
- mainContent.scrollTop = 0;
170
- }
167
+ location.subscribe(() => {
168
+ if (mainContent) {
169
+ drawerOpen = false;
170
+ mainContent.scrollTop = 0;
171
+ }
172
+ });
171
173
 
172
174
  $: if (user) {
173
175
  user.$gatekeeper('tilmeld/admin').then((value) => (tilmeldAdmin = value));
@@ -177,18 +179,29 @@
177
179
  userAvatar = DEFAULT_AVATAR;
178
180
  }
179
181
 
182
+ const routes = {
183
+ '/': Intro,
184
+ '/users/edit/:guid': UserEdit,
185
+ '/users/:query?': Users,
186
+ '/groups/edit/:guid': GroupEdit,
187
+ '/groups/:query?': Groups,
188
+ '*': NotFound,
189
+ };
190
+
180
191
  const sections: (
181
192
  | {
182
193
  name: string;
183
194
  indent: number;
184
- route?: typeof SvelteComponentDev;
195
+ href?: string;
196
+ absolute?: boolean;
185
197
  component?: SvelteComponent;
186
198
  }
187
199
  | { name: string; separator: true }
188
200
  )[] = [
189
201
  {
190
202
  name: 'Introduction',
191
- route: Intro,
203
+ href: '/',
204
+ absolute: true,
192
205
  indent: 0,
193
206
  },
194
207
  {
@@ -197,17 +210,17 @@
197
210
  },
198
211
  {
199
212
  name: 'Users',
200
- route: Users,
213
+ href: '/users/',
201
214
  indent: 0,
202
215
  },
203
216
  {
204
217
  name: 'Groups',
205
- route: Groups,
218
+ href: '/groups/',
206
219
  indent: 0,
207
220
  },
208
221
  ];
209
222
 
210
- const onLogin = (currentUser: User & CurrentUserData) => {
223
+ const onLogin = (currentUser: UserClass & CurrentUserData) => {
211
224
  user = currentUser;
212
225
  };
213
226
  const onLogout = () => {
@@ -1,17 +1,21 @@
1
1
  import type { NymphOptions } from '@nymphjs/client';
2
2
  import { Entity, Nymph } from '@nymphjs/client';
3
- import { User, Group } from '@nymphjs/tilmeld-client';
3
+ import {
4
+ User as UserClass,
5
+ Group as GroupClass,
6
+ } from '@nymphjs/tilmeld-client';
4
7
 
5
8
  const nymph = new Nymph(
6
9
  (window as unknown as { nymphOptions: NymphOptions }).nymphOptions
7
10
  );
8
- nymph.addEntityClass(User);
9
- nymph.addEntityClass(Group);
10
-
11
- export default nymph;
11
+ const User = nymph.addEntityClass(UserClass);
12
+ const Group = nymph.addEntityClass(GroupClass);
13
+ User.init(nymph);
12
14
 
13
15
  // Helps with admin and debugging.
14
16
  (window as any).Entity = Entity;
15
17
  (window as any).User = User;
16
18
  (window as any).Group = Group;
17
19
  (window as any).nymph = nymph;
20
+
21
+ export { nymph, User, Group };