tering-serieuze-types 2.7.1 → 2.8.0

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/dist/index.js CHANGED
@@ -160,11 +160,13 @@ var import_swagger5 = require("@nestjs/swagger");
160
160
 
161
161
  // src/user.ts
162
162
  var import_swagger4 = require("@nestjs/swagger");
163
- var import_class_transformer2 = require("class-transformer");
164
- var import_class_validator2 = require("class-validator");
163
+ var import_class_transformer3 = require("class-transformer");
164
+ var import_class_validator3 = require("class-validator");
165
165
 
166
166
  // src/session.ts
167
167
  var import_swagger3 = require("@nestjs/swagger");
168
+ var import_class_transformer2 = require("class-transformer");
169
+ var import_class_validator2 = require("class-validator");
168
170
  var TokenType = /* @__PURE__ */ ((TokenType2) => {
169
171
  TokenType2[TokenType2["Refresh"] = 0] = "Refresh";
170
172
  TokenType2[TokenType2["Access"] = 1] = "Access";
@@ -238,7 +240,9 @@ __decorateClass([
238
240
  type: Date,
239
241
  example: "2021-01-01T00:00:00.000Z",
240
242
  description: "Timestamp of the last time the session was used"
241
- })
243
+ }),
244
+ (0, import_class_validator2.IsDate)(),
245
+ (0, import_class_transformer2.Type)(() => Date)
242
246
  ], Session.prototype, "lastUsed", 2);
243
247
  __decorateClass([
244
248
  (0, import_swagger3.ApiProperty)({ type: String, example: "Chrome on Windows", description: "Name of the session" })
@@ -262,14 +266,14 @@ var User = class {
262
266
  apiTokens;
263
267
  };
264
268
  __decorateClass([
265
- (0, import_class_validator2.IsNumberString)(),
269
+ (0, import_class_validator3.IsNumberString)(),
266
270
  (0, import_swagger4.ApiProperty)({ type: Number })
267
271
  ], User.prototype, "id", 2);
268
272
  __decorateClass([
269
273
  (0, import_swagger4.ApiProperty)({ type: Number, nullable: true, default: null })
270
274
  ], User.prototype, "_id", 2);
271
275
  __decorateClass([
272
- (0, import_class_validator2.IsEmail)(),
276
+ (0, import_class_validator3.IsEmail)(),
273
277
  (0, import_swagger4.ApiProperty)({ type: String })
274
278
  ], User.prototype, "email", 2);
275
279
  __decorateClass([
@@ -290,8 +294,8 @@ __decorateClass([
290
294
  ], User.prototype, "isRegistering", 2);
291
295
  __decorateClass([
292
296
  (0, import_swagger4.ApiProperty)({ type: WindowState }),
293
- (0, import_class_validator2.ValidateNested)(),
294
- (0, import_class_transformer2.Type)(() => WindowState)
297
+ (0, import_class_validator3.ValidateNested)(),
298
+ (0, import_class_transformer3.Type)(() => WindowState)
295
299
  ], User.prototype, "windowState", 2);
296
300
  __decorateClass([
297
301
  (0, import_swagger4.ApiProperty)({ type: () => [Button] })
@@ -300,7 +304,9 @@ __decorateClass([
300
304
  (0, import_swagger4.ApiProperty)({ type: String, default: "" })
301
305
  ], User.prototype, "lastSeenChangelogId", 2);
302
306
  __decorateClass([
303
- (0, import_swagger4.ApiProperty)({ type: () => [Session] })
307
+ (0, import_swagger4.ApiProperty)({ type: () => [Session] }),
308
+ (0, import_class_validator3.ValidateNested)({ each: true }),
309
+ (0, import_class_transformer3.Type)(() => Session)
304
310
  ], User.prototype, "sessions", 2);
305
311
  __decorateClass([
306
312
  (0, import_swagger4.ApiProperty)({ type: () => [ApiToken] })
@@ -321,7 +327,7 @@ var AddUserDto = class {
321
327
  email;
322
328
  };
323
329
  __decorateClass([
324
- (0, import_class_validator2.IsEmail)(),
330
+ (0, import_class_validator3.IsEmail)(),
325
331
  (0, import_swagger4.ApiProperty)({ type: String, example: "info@example.com" })
326
332
  ], AddUserDto.prototype, "email", 2);
327
333
  var RemoveUserDto = class extends (0, import_swagger4.PickType)(User, ["id"]) {
@@ -399,7 +405,7 @@ __decorateClass([
399
405
  ], Button.prototype, "ButtonHold", 2);
400
406
 
401
407
  // src/emulator.ts
402
- var import_class_validator3 = require("class-validator");
408
+ var import_class_validator4 = require("class-validator");
403
409
  var import_swagger6 = require("@nestjs/swagger");
404
410
  var City = /* @__PURE__ */ ((City2) => {
405
411
  City2["Waalwijk"] = "Waalwijk";
@@ -411,13 +417,13 @@ var EmulateFireDepartmentDto = class {
411
417
  };
412
418
  __decorateClass([
413
419
  (0, import_swagger6.ApiProperty)({ enum: City }),
414
- (0, import_class_validator3.IsEnum)(City)
420
+ (0, import_class_validator4.IsEnum)(City)
415
421
  ], EmulateFireDepartmentDto.prototype, "city", 2);
416
422
 
417
423
  // src/jingle.ts
418
424
  var import_swagger7 = require("@nestjs/swagger");
419
- var import_class_validator4 = require("class-validator");
420
- var import_class_transformer3 = require("class-transformer");
425
+ var import_class_validator5 = require("class-validator");
426
+ var import_class_transformer4 = require("class-transformer");
421
427
  var Jingle = class {
422
428
  folder;
423
429
  file;
@@ -427,13 +433,13 @@ var Jingle = class {
427
433
  };
428
434
  __decorateClass([
429
435
  (0, import_swagger7.ApiProperty)({ type: String, example: "internet-gekkies" }),
430
- (0, import_class_validator4.IsString)(),
431
- (0, import_class_validator4.IsNotEmpty)()
436
+ (0, import_class_validator5.IsString)(),
437
+ (0, import_class_validator5.IsNotEmpty)()
432
438
  ], Jingle.prototype, "folder", 2);
433
439
  __decorateClass([
434
440
  (0, import_swagger7.ApiProperty)({ type: String, example: "mand.mp3" }),
435
- (0, import_class_validator4.IsString)(),
436
- (0, import_class_validator4.IsNotEmpty)()
441
+ (0, import_class_validator5.IsString)(),
442
+ (0, import_class_validator5.IsNotEmpty)()
437
443
  ], Jingle.prototype, "file", 2);
438
444
  __decorateClass([
439
445
  (0, import_swagger7.ApiProperty)({ type: [String], examples: ["internet", "gekkies", "mand"] })
@@ -450,13 +456,13 @@ var JingleFolder = class {
450
456
  };
451
457
  __decorateClass([
452
458
  (0, import_swagger7.ApiProperty)({ type: String, example: "internet-gekkies" }),
453
- (0, import_class_validator4.IsString)(),
454
- (0, import_class_validator4.IsNotEmpty)()
459
+ (0, import_class_validator5.IsString)(),
460
+ (0, import_class_validator5.IsNotEmpty)()
455
461
  ], JingleFolder.prototype, "folder", 2);
456
462
  __decorateClass([
457
463
  (0, import_swagger7.ApiProperty)({ type: [Jingle] }),
458
- (0, import_class_validator4.ValidateNested)({ each: true }),
459
- (0, import_class_transformer3.Type)(() => Jingle)
464
+ (0, import_class_validator5.ValidateNested)({ each: true }),
465
+ (0, import_class_transformer4.Type)(() => Jingle)
460
466
  ], JingleFolder.prototype, "jingles", 2);
461
467
  var PlayJingleDto = class extends (0, import_swagger7.PickType)(Jingle, ["folder", "file"]) {
462
468
  };
@@ -1,7 +1,8 @@
1
1
  import { TokenType } from '../src';
2
2
 
3
3
  export interface TokenContent {
4
- email: string;
4
+ email?: string;
5
+ userId?: number;
5
6
  type: TokenType;
6
7
  iat: number;
7
8
  exp: number;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "tering-serieuze-types",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "description": "Tering serieuze types",
5
5
  "author": "Frank",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://gitlab.com/tering-serieuze-shit/tering-serieuze-types.git"
8
+ "url": "git+https://gitlab.com/tering-serieuze-shit/tering-serieuze-types.git"
9
9
  },
10
10
  "scripts": {
11
11
  "prebuild": "npm run lint && npm run format",
package/src/session.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { ApiProperty } from '@nestjs/swagger';
2
+ import { Type } from 'class-transformer';
3
+ import { IsDate } from 'class-validator';
2
4
  import { User } from './user';
3
5
 
4
6
  export enum TokenType {
@@ -63,6 +65,8 @@ export class Session {
63
65
  example: '2021-01-01T00:00:00.000Z',
64
66
  description: 'Timestamp of the last time the session was used',
65
67
  })
68
+ @IsDate()
69
+ @Type(() => Date)
66
70
  lastUsed: Date;
67
71
 
68
72
  @ApiProperty({ type: String, example: 'Chrome on Windows', description: 'Name of the session' })
package/src/user.ts CHANGED
@@ -49,6 +49,8 @@ export class User {
49
49
  authenticators: DbAuthenticator[];
50
50
 
51
51
  @ApiProperty({ type: () => [Session] })
52
+ @ValidateNested({ each: true })
53
+ @Type(() => Session)
52
54
  sessions: Session[];
53
55
 
54
56
  @ApiProperty({ type: () => [ApiToken] })