@nymphjs/tilmeld 1.0.0-beta.131 → 1.0.0-beta.133

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.
@@ -7,8 +7,8 @@ import { nanoid } from '@nymphjs/guid';
7
7
  import { nymphJoiProps } from '@nymphjs/nymph';
8
8
 
9
9
  import type { Config } from './index.js';
10
- import User from '../User.js';
11
- import Group from '../Group.js';
10
+ import { User } from '../User.js';
11
+ import { Group } from '../Group.js';
12
12
 
13
13
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
14
 
package/src/conf/index.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  import type { EmailOptions, EmailConfig } from 'email-templates';
2
2
 
3
3
  import type Tilmeld from '../Tilmeld.js';
4
- import type Group from '../Group.js';
5
- import type { GroupData } from '../Group.js';
6
- import type User from '../User.js';
7
- import type { UserData } from '../User.js';
4
+ import type { Group } from '../Group.js';
5
+ import type { User } from '../User.js';
8
6
 
9
7
  /**
10
8
  * Tilmeld Config
@@ -267,11 +265,7 @@ export interface Config {
267
265
  /**
268
266
  * Function to build the JWT for user sessions.
269
267
  */
270
- jwtBuilder: (
271
- config: Config,
272
- user: User & UserData,
273
- switchToken?: boolean,
274
- ) => string;
268
+ jwtBuilder: (config: Config, user: User, switchToken?: boolean) => string;
275
269
  /**
276
270
  * Function to verify that a JWT was signed with the secret key, validate its
277
271
  * data, validate the XSRF token, and extract the GUID and dates.
@@ -301,7 +295,7 @@ export interface Config {
301
295
  configEmail: (
302
296
  tilmeld: Tilmeld,
303
297
  options: EmailOptions,
304
- user: User & UserData,
298
+ user: User,
305
299
  ) => Promise<EmailConfig>;
306
300
  /**
307
301
  * Send an email to a user. Uses `email-templates` by default.
@@ -331,7 +325,7 @@ export interface Config {
331
325
  sendEmail: (
332
326
  tilmeld: Tilmeld,
333
327
  options: EmailOptions,
334
- user: User & UserData,
328
+ user: User,
335
329
  ) => Promise<boolean>;
336
330
  /**
337
331
  * The address you'd like to receive a notification of registered users, if
@@ -350,7 +344,7 @@ export interface Config {
350
344
  * verified. For example, username might be an array or a number.
351
345
  */
352
346
  failedLoginAttempt: (
353
- user: (User & UserData) | null,
347
+ user: User | null,
354
348
  data: {
355
349
  username: string;
356
350
  password: string;
@@ -361,11 +355,11 @@ export interface Config {
361
355
  /**
362
356
  * The validator used to check groups before saving.
363
357
  */
364
- validatorGroup: (tilmeld: Tilmeld, group: Group & GroupData) => void;
358
+ validatorGroup: (tilmeld: Tilmeld, group: Group) => void;
365
359
  /**
366
360
  * The validator used to check users before saving.
367
361
  */
368
- validatorUser: (tilmeld: Tilmeld, user: User & UserData) => void;
362
+ validatorUser: (tilmeld: Tilmeld, user: User) => void;
369
363
  }
370
364
 
371
365
  import defaults from './defaults.js';
package/src/index.ts CHANGED
@@ -5,21 +5,15 @@ export * from './enforceTilmeld.js';
5
5
  export * from './decorators/index.js';
6
6
  export * from './errors/index.js';
7
7
 
8
- import AbleObject from './AbleObject.js';
9
- export { AbleObject };
8
+ export * from './AbleObject.js';
10
9
 
11
10
  export * from './Group.js';
12
- import Group from './Group.js';
13
- export { Group };
14
11
 
15
12
  import Tilmeld from './Tilmeld.js';
16
13
  export { Tilmeld };
17
14
 
18
15
  export * from './Tilmeld.types.js';
19
16
 
20
- import tilmeldJoiProps from './tilmeldJoiProps.js';
21
- export { tilmeldJoiProps };
17
+ export * from './tilmeldJoiProps.js';
22
18
 
23
19
  export * from './User.js';
24
- import User from './User.js';
25
- export { User };
@@ -10,14 +10,16 @@ import Tilmeld from './Tilmeld.js';
10
10
  import { requireAbility, requireAuthentication } from './decorators/index.js';
11
11
  import { AccessControlError } from './errors/index.js';
12
12
  import type { AccessControlData } from './Tilmeld.types.js';
13
- import type UserClass from './User.js';
13
+ import type { User as UserClass } from './User.js';
14
14
  import { UserTest } from './User.testArtifacts.js';
15
- import type GroupClass from './Group.js';
15
+ import type { Group as GroupClass } from './Group.js';
16
16
  import { GroupTest } from './Group.testArtifacts.js';
17
17
 
18
- export type TestModelData = {
18
+ export interface TestModelData extends AccessControlData {
19
19
  name?: string;
20
- } & AccessControlData;
20
+ }
21
+
22
+ export interface TestModel extends TestModelData {}
21
23
 
22
24
  /**
23
25
  * This class is a test class that extends the Entity class.
@@ -1,10 +1,10 @@
1
1
  import { TilmeldAccessLevels } from '@nymphjs/nymph';
2
2
  import Joi from 'joi';
3
3
 
4
- import User from './User.js';
5
- import Group from './Group.js';
4
+ import { User } from './User.js';
5
+ import { Group } from './Group.js';
6
6
 
7
- export default {
7
+ export const tilmeldJoiProps = {
8
8
  user: Joi.object().instance(User),
9
9
  group: Joi.object().instance(Group),
10
10
  acUser: Joi.number().valid(