tering-serieuze-types 2.5.0 → 2.6.1

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
@@ -20,8 +20,7 @@ var __decorateClass = (decorators, target, key, kind) => {
20
20
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
21
21
  if (decorator = decorators[i])
22
22
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
23
- if (kind && result)
24
- __defProp(target, key, result);
23
+ if (kind && result) __defProp(target, key, result);
25
24
  return result;
26
25
  };
27
26
 
@@ -62,6 +61,8 @@ module.exports = __toCommonJS(src_exports);
62
61
 
63
62
  // src/application.ts
64
63
  var import_swagger = require("@nestjs/swagger");
64
+ var import_class_validator = require("class-validator");
65
+ var import_class_transformer = require("class-transformer");
65
66
  var Application = class {
66
67
  name;
67
68
  icon;
@@ -77,40 +78,52 @@ var Application = class {
77
78
  custom;
78
79
  };
79
80
  __decorateClass([
80
- (0, import_swagger.ApiProperty)({ type: String })
81
+ (0, import_swagger.ApiProperty)({ type: String }),
82
+ (0, import_class_validator.IsNotEmpty)()
81
83
  ], Application.prototype, "name", 2);
82
84
  __decorateClass([
83
- (0, import_swagger.ApiProperty)({ type: String })
85
+ (0, import_swagger.ApiProperty)({ type: String }),
86
+ (0, import_class_validator.IsNotEmpty)()
84
87
  ], Application.prototype, "icon", 2);
85
88
  __decorateClass([
86
- (0, import_swagger.ApiProperty)({ type: Boolean })
89
+ (0, import_swagger.ApiProperty)({ type: Boolean }),
90
+ (0, import_class_validator.IsBoolean)()
87
91
  ], Application.prototype, "isOpened", 2);
88
92
  __decorateClass([
89
- (0, import_swagger.ApiProperty)({ type: Boolean })
93
+ (0, import_swagger.ApiProperty)({ type: Boolean }),
94
+ (0, import_class_validator.IsBoolean)()
90
95
  ], Application.prototype, "isMinimized", 2);
91
96
  __decorateClass([
92
- (0, import_swagger.ApiProperty)({ type: Boolean })
97
+ (0, import_swagger.ApiProperty)({ type: Boolean }),
98
+ (0, import_class_validator.IsBoolean)()
93
99
  ], Application.prototype, "isMaximized", 2);
94
100
  __decorateClass([
95
- (0, import_swagger.ApiProperty)({ type: Boolean })
101
+ (0, import_swagger.ApiProperty)({ type: Boolean }),
102
+ (0, import_class_validator.IsBoolean)()
96
103
  ], Application.prototype, "isAdminOnly", 2);
97
104
  __decorateClass([
98
- (0, import_swagger.ApiProperty)({ type: Boolean })
105
+ (0, import_swagger.ApiProperty)({ type: Boolean }),
106
+ (0, import_class_validator.IsBoolean)()
99
107
  ], Application.prototype, "isDevOnly", 2);
100
108
  __decorateClass([
101
- (0, import_swagger.ApiProperty)({ type: Number })
109
+ (0, import_swagger.ApiProperty)({ type: Number }),
110
+ (0, import_class_validator.IsNumber)()
102
111
  ], Application.prototype, "width", 2);
103
112
  __decorateClass([
104
- (0, import_swagger.ApiProperty)({ type: Number })
113
+ (0, import_swagger.ApiProperty)({ type: Number }),
114
+ (0, import_class_validator.IsNumber)()
105
115
  ], Application.prototype, "height", 2);
106
116
  __decorateClass([
107
- (0, import_swagger.ApiProperty)({ type: Number })
117
+ (0, import_swagger.ApiProperty)({ type: Number }),
118
+ (0, import_class_validator.IsNumber)()
108
119
  ], Application.prototype, "x", 2);
109
120
  __decorateClass([
110
- (0, import_swagger.ApiProperty)({ type: Number })
121
+ (0, import_swagger.ApiProperty)({ type: Number }),
122
+ (0, import_class_validator.IsNumber)()
111
123
  ], Application.prototype, "y", 2);
112
124
  __decorateClass([
113
- (0, import_swagger.ApiProperty)({ type: Object })
125
+ (0, import_swagger.ApiProperty)({ type: Object }),
126
+ (0, import_class_validator.IsOptional)()
114
127
  ], Application.prototype, "custom", 2);
115
128
  var WindowStateApplication = class extends (0, import_swagger.OmitType)(Application, ["icon", "isAdminOnly"]) {
116
129
  };
@@ -119,10 +132,13 @@ var WindowState = class {
119
132
  activeApplication;
120
133
  };
121
134
  __decorateClass([
122
- (0, import_swagger.ApiProperty)({ type: [WindowStateApplication] })
135
+ (0, import_swagger.ApiProperty)({ type: [WindowStateApplication] }),
136
+ (0, import_class_validator.ValidateNested)({ each: true }),
137
+ (0, import_class_transformer.Type)(() => WindowStateApplication)
123
138
  ], WindowState.prototype, "applications", 2);
124
139
  __decorateClass([
125
- (0, import_swagger.ApiProperty)({ type: String })
140
+ (0, import_swagger.ApiProperty)({ type: String }),
141
+ (0, import_class_validator.IsString)()
126
142
  ], WindowState.prototype, "activeApplication", 2);
127
143
 
128
144
  // src/authenticator.ts
@@ -144,7 +160,8 @@ var import_swagger5 = require("@nestjs/swagger");
144
160
 
145
161
  // src/user.ts
146
162
  var import_swagger4 = require("@nestjs/swagger");
147
- var import_class_validator = require("class-validator");
163
+ var import_class_transformer2 = require("class-transformer");
164
+ var import_class_validator2 = require("class-validator");
148
165
 
149
166
  // src/session.ts
150
167
  var import_swagger3 = require("@nestjs/swagger");
@@ -245,13 +262,14 @@ var User = class {
245
262
  apiTokens;
246
263
  };
247
264
  __decorateClass([
265
+ (0, import_class_validator2.IsNumberString)(),
248
266
  (0, import_swagger4.ApiProperty)({ type: Number })
249
267
  ], User.prototype, "id", 2);
250
268
  __decorateClass([
251
269
  (0, import_swagger4.ApiProperty)({ type: Number, nullable: true, default: null })
252
270
  ], User.prototype, "_id", 2);
253
271
  __decorateClass([
254
- (0, import_class_validator.IsEmail)(),
272
+ (0, import_class_validator2.IsEmail)(),
255
273
  (0, import_swagger4.ApiProperty)({ type: String })
256
274
  ], User.prototype, "email", 2);
257
275
  __decorateClass([
@@ -271,7 +289,9 @@ __decorateClass([
271
289
  (0, import_swagger4.ApiProperty)()
272
290
  ], User.prototype, "isRegistering", 2);
273
291
  __decorateClass([
274
- (0, import_swagger4.ApiProperty)({ type: WindowState })
292
+ (0, import_swagger4.ApiProperty)({ type: WindowState }),
293
+ (0, import_class_validator2.ValidateNested)(),
294
+ (0, import_class_transformer2.Type)(() => WindowState)
275
295
  ], User.prototype, "windowState", 2);
276
296
  __decorateClass([
277
297
  (0, import_swagger4.ApiProperty)({ type: () => [Button] })
@@ -301,7 +321,7 @@ var AddUserDto = class {
301
321
  email;
302
322
  };
303
323
  __decorateClass([
304
- (0, import_class_validator.IsEmail)(),
324
+ (0, import_class_validator2.IsEmail)(),
305
325
  (0, import_swagger4.ApiProperty)({ type: String, example: "info@example.com" })
306
326
  ], AddUserDto.prototype, "email", 2);
307
327
  var RemoveUserDto = class extends (0, import_swagger4.PickType)(User, ["id"]) {
@@ -379,7 +399,7 @@ __decorateClass([
379
399
  ], Button.prototype, "ButtonHold", 2);
380
400
 
381
401
  // src/emulator.ts
382
- var import_class_validator2 = require("class-validator");
402
+ var import_class_validator3 = require("class-validator");
383
403
  var import_swagger6 = require("@nestjs/swagger");
384
404
  var City = /* @__PURE__ */ ((City2) => {
385
405
  City2["Waalwijk"] = "Waalwijk";
@@ -391,11 +411,13 @@ var EmulateFireDepartmentDto = class {
391
411
  };
392
412
  __decorateClass([
393
413
  (0, import_swagger6.ApiProperty)({ enum: City }),
394
- (0, import_class_validator2.IsEnum)(City)
414
+ (0, import_class_validator3.IsEnum)(City)
395
415
  ], EmulateFireDepartmentDto.prototype, "city", 2);
396
416
 
397
417
  // src/jingle.ts
398
418
  var import_swagger7 = require("@nestjs/swagger");
419
+ var import_class_validator4 = require("class-validator");
420
+ var import_class_transformer3 = require("class-transformer");
399
421
  var Jingle = class {
400
422
  folder;
401
423
  file;
@@ -404,10 +426,14 @@ var Jingle = class {
404
426
  mtime;
405
427
  };
406
428
  __decorateClass([
407
- (0, import_swagger7.ApiProperty)({ type: String, example: "internet-gekkies" })
429
+ (0, import_swagger7.ApiProperty)({ type: String, example: "internet-gekkies" }),
430
+ (0, import_class_validator4.IsString)(),
431
+ (0, import_class_validator4.IsNotEmpty)()
408
432
  ], Jingle.prototype, "folder", 2);
409
433
  __decorateClass([
410
- (0, import_swagger7.ApiProperty)({ type: String, example: "mand.mp3" })
434
+ (0, import_swagger7.ApiProperty)({ type: String, example: "mand.mp3" }),
435
+ (0, import_class_validator4.IsString)(),
436
+ (0, import_class_validator4.IsNotEmpty)()
411
437
  ], Jingle.prototype, "file", 2);
412
438
  __decorateClass([
413
439
  (0, import_swagger7.ApiProperty)({ type: [String], examples: ["internet", "gekkies", "mand"] })
@@ -423,10 +449,14 @@ var JingleFolder = class {
423
449
  jingles;
424
450
  };
425
451
  __decorateClass([
426
- (0, import_swagger7.ApiProperty)({ type: String, example: "internet-gekkies" })
452
+ (0, import_swagger7.ApiProperty)({ type: String, example: "internet-gekkies" }),
453
+ (0, import_class_validator4.IsString)(),
454
+ (0, import_class_validator4.IsNotEmpty)()
427
455
  ], JingleFolder.prototype, "folder", 2);
428
456
  __decorateClass([
429
- (0, import_swagger7.ApiProperty)({ type: [Jingle] })
457
+ (0, import_swagger7.ApiProperty)({ type: [Jingle] }),
458
+ (0, import_class_validator4.ValidateNested)({ each: true }),
459
+ (0, import_class_transformer3.Type)(() => Jingle)
430
460
  ], JingleFolder.prototype, "jingles", 2);
431
461
  var PlayJingleDto = class extends (0, import_swagger7.PickType)(Jingle, ["folder", "file"]) {
432
462
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tering-serieuze-types",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "description": "Tering serieuze types",
5
5
  "author": "Frank",
6
6
  "repository": {
@@ -19,7 +19,7 @@
19
19
  "devDependencies": {
20
20
  "@typescript-eslint/eslint-plugin": "^7.7.0",
21
21
  "@typescript-eslint/parser": "^7.7.0",
22
- "esbuild": "^0.16.10",
22
+ "esbuild": "^0.23.1",
23
23
  "eslint": "^8.57.0",
24
24
  "eslint-config-airbnb-base": "^15.0.0",
25
25
  "eslint-config-prettier": "^9.1.0",
@@ -29,6 +29,7 @@
29
29
  "dependencies": {
30
30
  "@nestjs/swagger": "^7.1.16",
31
31
  "@simplewebauthn/typescript-types": "^7.4.0",
32
- "class-validator": "^0.13.2"
32
+ "class-transformer": "^0.5.1",
33
+ "class-validator": "^0.14.1"
33
34
  }
34
35
  }
@@ -1,40 +1,54 @@
1
1
  import { ApiProperty, OmitType } from '@nestjs/swagger';
2
+ import { IsBoolean, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateNested } from 'class-validator';
3
+ import { Type } from 'class-transformer';
2
4
 
3
5
  export class Application {
4
6
  @ApiProperty({ type: String })
7
+ @IsNotEmpty()
5
8
  name: string;
6
9
 
7
10
  @ApiProperty({ type: String })
11
+ @IsNotEmpty()
8
12
  icon: string;
9
13
 
10
14
  @ApiProperty({ type: Boolean })
15
+ @IsBoolean()
11
16
  isOpened: boolean;
12
17
 
13
18
  @ApiProperty({ type: Boolean })
19
+ @IsBoolean()
14
20
  isMinimized: boolean;
15
21
 
16
22
  @ApiProperty({ type: Boolean })
23
+ @IsBoolean()
17
24
  isMaximized: boolean;
18
25
 
19
26
  @ApiProperty({ type: Boolean })
27
+ @IsBoolean()
20
28
  isAdminOnly: boolean;
21
29
 
22
30
  @ApiProperty({ type: Boolean })
31
+ @IsBoolean()
23
32
  isDevOnly: boolean;
24
33
 
25
34
  @ApiProperty({ type: Number })
35
+ @IsNumber()
26
36
  width: number;
27
37
 
28
38
  @ApiProperty({ type: Number })
39
+ @IsNumber()
29
40
  height: number;
30
41
 
31
42
  @ApiProperty({ type: Number })
43
+ @IsNumber()
32
44
  x: number;
33
45
 
34
46
  @ApiProperty({ type: Number })
47
+ @IsNumber()
35
48
  y: number;
36
49
 
37
50
  @ApiProperty({ type: Object })
51
+ @IsOptional()
38
52
  custom: any;
39
53
  }
40
54
 
@@ -42,8 +56,11 @@ export class WindowStateApplication extends OmitType(Application, ['icon', 'isAd
42
56
 
43
57
  export class WindowState {
44
58
  @ApiProperty({ type: [WindowStateApplication] })
59
+ @ValidateNested({ each: true })
60
+ @Type(() => WindowStateApplication)
45
61
  applications: WindowStateApplication[];
46
62
 
47
63
  @ApiProperty({ type: String })
64
+ @IsString()
48
65
  activeApplication: string;
49
66
  }
package/src/jingle.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  import { ApiProperty, PickType } from '@nestjs/swagger';
2
+ import { IsNotEmpty, IsString, ValidateNested } from 'class-validator';
3
+ import { Type } from 'class-transformer';
2
4
 
3
5
  export class Jingle {
4
6
  @ApiProperty({ type: String, example: 'internet-gekkies' })
7
+ @IsString()
8
+ @IsNotEmpty()
5
9
  folder: string;
6
10
 
7
11
  @ApiProperty({ type: String, example: 'mand.mp3' })
12
+ @IsString()
13
+ @IsNotEmpty()
8
14
  file: string;
9
15
 
10
16
  @ApiProperty({ type: [String], examples: ['internet', 'gekkies', 'mand'] })
@@ -19,9 +25,13 @@ export class Jingle {
19
25
 
20
26
  export class JingleFolder {
21
27
  @ApiProperty({ type: String, example: 'internet-gekkies' })
28
+ @IsString()
29
+ @IsNotEmpty()
22
30
  folder: string;
23
31
 
24
32
  @ApiProperty({ type: [Jingle] })
33
+ @ValidateNested({ each: true })
34
+ @Type(() => Jingle)
25
35
  jingles: Jingle[];
26
36
  }
27
37
 
package/src/user.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { ApiProperty, PickType } from '@nestjs/swagger';
2
- import { IsEmail } from 'class-validator';
2
+ import { Type } from 'class-transformer';
3
+ import { IsEmail, IsNumberString, ValidateNested } from 'class-validator';
3
4
  import { Button } from './button';
4
5
  import { WindowState } from './application';
5
6
  import { type DbAuthenticator } from './authenticator';
6
7
  import { ApiToken, Session } from './session';
7
8
 
8
9
  export class User {
10
+ @IsNumberString()
9
11
  @ApiProperty({ type: Number })
10
12
  id: number;
11
13
 
@@ -34,6 +36,8 @@ export class User {
34
36
  isRegistering: Date | null;
35
37
 
36
38
  @ApiProperty({ type: WindowState })
39
+ @ValidateNested()
40
+ @Type(() => WindowState)
37
41
  windowState: WindowState;
38
42
 
39
43
  @ApiProperty({ type: () => [Button] })
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "emitDecoratorMetadata": true,
3
4
  "experimentalDecorators": true,
4
5
  "target": "esnext",
5
6
  "moduleResolution": "NodeNext"