tering-serieuze-types 1.6.1 → 1.7.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
@@ -29,47 +29,220 @@ var __decorateClass = (decorators, target, key, kind) => {
29
29
  var src_exports = {};
30
30
  __export(src_exports, {
31
31
  AddUserDto: () => AddUserDto,
32
+ Application: () => Application,
33
+ Button: () => Button,
32
34
  Jingle: () => Jingle,
33
35
  JingleFolder: () => JingleFolder,
34
- PlayJingleDto: () => PlayJingleDto
36
+ PlayJingleDto: () => PlayJingleDto,
37
+ RemoveUserDto: () => RemoveUserDto,
38
+ SetWindowStateDto: () => SetWindowStateDto,
39
+ ToggleAbleUserPropertyEnum: () => ToggleAbleUserPropertyEnum,
40
+ ToggleBoolDto: () => ToggleBoolDto,
41
+ ToggleableUserProperties: () => ToggleableUserProperties,
42
+ User: () => User,
43
+ WebsocketAction: () => WebsocketAction,
44
+ WindowState: () => WindowState
35
45
  });
36
46
  module.exports = __toCommonJS(src_exports);
47
+
48
+ // src/application.ts
37
49
  var import_swagger = require("@nestjs/swagger");
50
+ var Application = class {
51
+ };
52
+ __decorateClass([
53
+ (0, import_swagger.ApiProperty)({ type: String })
54
+ ], Application.prototype, "name", 2);
55
+ __decorateClass([
56
+ (0, import_swagger.ApiProperty)({ type: String })
57
+ ], Application.prototype, "icon", 2);
58
+ __decorateClass([
59
+ (0, import_swagger.ApiProperty)({ type: Boolean })
60
+ ], Application.prototype, "isOpened", 2);
61
+ __decorateClass([
62
+ (0, import_swagger.ApiProperty)({ type: Boolean })
63
+ ], Application.prototype, "isMinimized", 2);
64
+ __decorateClass([
65
+ (0, import_swagger.ApiProperty)({ type: Boolean })
66
+ ], Application.prototype, "isMaximized", 2);
67
+ __decorateClass([
68
+ (0, import_swagger.ApiProperty)({ type: Boolean })
69
+ ], Application.prototype, "isAdminOnly", 2);
70
+ __decorateClass([
71
+ (0, import_swagger.ApiProperty)({ type: Boolean })
72
+ ], Application.prototype, "isDevOnly", 2);
73
+ __decorateClass([
74
+ (0, import_swagger.ApiProperty)({ type: Number })
75
+ ], Application.prototype, "width", 2);
76
+ __decorateClass([
77
+ (0, import_swagger.ApiProperty)({ type: Number })
78
+ ], Application.prototype, "height", 2);
79
+ __decorateClass([
80
+ (0, import_swagger.ApiProperty)({ type: Number })
81
+ ], Application.prototype, "x", 2);
82
+ __decorateClass([
83
+ (0, import_swagger.ApiProperty)({ type: Number })
84
+ ], Application.prototype, "y", 2);
85
+ __decorateClass([
86
+ (0, import_swagger.ApiProperty)({ type: Object })
87
+ ], Application.prototype, "custom", 2);
88
+ var WindowState = class {
89
+ };
90
+ __decorateClass([
91
+ (0, import_swagger.ApiProperty)({ type: [Application] })
92
+ ], WindowState.prototype, "applications", 2);
93
+ __decorateClass([
94
+ (0, import_swagger.ApiProperty)({ type: String })
95
+ ], WindowState.prototype, "activeApplication", 2);
96
+
97
+ // src/user.ts
98
+ var import_swagger2 = require("@nestjs/swagger");
38
99
  var import_class_validator = require("class-validator");
100
+ var User = class {
101
+ };
102
+ __decorateClass([
103
+ (0, import_swagger2.ApiProperty)({ type: String })
104
+ ], User.prototype, "id", 2);
105
+ __decorateClass([
106
+ (0, import_class_validator.IsEmail)(),
107
+ (0, import_swagger2.ApiProperty)({ type: String })
108
+ ], User.prototype, "email", 2);
109
+ __decorateClass([
110
+ (0, import_swagger2.ApiProperty)({ type: Boolean, default: false })
111
+ ], User.prototype, "isAdmin", 2);
112
+ __decorateClass([
113
+ (0, import_swagger2.ApiProperty)({ type: Boolean, default: false })
114
+ ], User.prototype, "isBanned", 2);
115
+ __decorateClass([
116
+ (0, import_swagger2.ApiProperty)({ type: Boolean, default: false })
117
+ ], User.prototype, "playJinglesLocal", 2);
118
+ __decorateClass([
119
+ (0, import_swagger2.ApiProperty)({ type: [String], default: [] })
120
+ ], User.prototype, "favoriteJingles", 2);
121
+ __decorateClass([
122
+ (0, import_swagger2.ApiProperty)({ type: Number, nullable: true }),
123
+ (0, import_swagger2.ApiProperty)()
124
+ ], User.prototype, "isRegistering", 2);
125
+ __decorateClass([
126
+ (0, import_swagger2.ApiProperty)({ type: WindowState })
127
+ ], User.prototype, "windowState", 2);
128
+ __decorateClass([
129
+ (0, import_swagger2.ApiProperty)({ type: () => [Button] })
130
+ ], User.prototype, "buttons", 2);
131
+ var ToggleAbleUserPropertyEnum = /* @__PURE__ */ ((ToggleAbleUserPropertyEnum2) => {
132
+ ToggleAbleUserPropertyEnum2["isAdmin"] = "isAdmin";
133
+ ToggleAbleUserPropertyEnum2["isBanned"] = "isBanned";
134
+ ToggleAbleUserPropertyEnum2["playJinglesLocal"] = "playJinglesLocal";
135
+ return ToggleAbleUserPropertyEnum2;
136
+ })(ToggleAbleUserPropertyEnum || {});
137
+ var ToggleableUserProperties = class extends (0, import_swagger2.PickType)(User, [
138
+ "isAdmin" /* isAdmin */,
139
+ "isBanned" /* isBanned */,
140
+ "playJinglesLocal" /* playJinglesLocal */
141
+ ]) {
142
+ };
39
143
  var AddUserDto = class {
40
144
  };
41
145
  __decorateClass([
42
146
  (0, import_class_validator.IsEmail)(),
43
- (0, import_swagger.ApiProperty)({ type: String, example: "info@example.com" })
147
+ (0, import_swagger2.ApiProperty)({ type: String, example: "info@example.com" })
44
148
  ], AddUserDto.prototype, "email", 2);
149
+ var RemoveUserDto = class extends (0, import_swagger2.PickType)(User, ["id"]) {
150
+ };
151
+ var SetWindowStateDto = class extends (0, import_swagger2.PickType)(User, ["windowState"]) {
152
+ };
153
+ var ToggleBoolDto = class {
154
+ };
155
+ __decorateClass([
156
+ (0, import_swagger2.ApiProperty)({
157
+ type: String,
158
+ nullable: true,
159
+ description: "User ID. When empty, the current user is used. Admin only param"
160
+ })
161
+ ], ToggleBoolDto.prototype, "id", 2);
162
+ __decorateClass([
163
+ (0, import_swagger2.ApiProperty)({ enum: ToggleAbleUserPropertyEnum, description: "The property to toggle" })
164
+ ], ToggleBoolDto.prototype, "field", 2);
165
+
166
+ // src/button.ts
167
+ var import_swagger3 = require("@nestjs/swagger");
168
+ var WebsocketAction = class {
169
+ };
170
+ __decorateClass([
171
+ (0, import_swagger3.ApiProperty)({ type: String })
172
+ ], WebsocketAction.prototype, "serviceName", 2);
173
+ __decorateClass([
174
+ (0, import_swagger3.ApiProperty)({ type: String })
175
+ ], WebsocketAction.prototype, "methodName", 2);
176
+ __decorateClass([
177
+ (0, import_swagger3.ApiProperty)({ type: Object })
178
+ ], WebsocketAction.prototype, "data", 2);
179
+ var Button = class {
180
+ };
181
+ __decorateClass([
182
+ (0, import_swagger3.ApiProperty)({ type: String })
183
+ ], Button.prototype, "bdAddr", 2);
184
+ __decorateClass([
185
+ (0, import_swagger3.ApiProperty)({ type: User, nullable: true })
186
+ ], Button.prototype, "owner", 2);
187
+ __decorateClass([
188
+ (0, import_swagger3.ApiProperty)({ type: Number, nullable: true })
189
+ ], Button.prototype, "batteryLevel", 2);
190
+ __decorateClass([
191
+ (0, import_swagger3.ApiProperty)({ type: Date, nullable: true })
192
+ ], Button.prototype, "lastBatteryUpdate", 2);
193
+ __decorateClass([
194
+ (0, import_swagger3.ApiProperty)({ type: WebsocketAction, nullable: true })
195
+ ], Button.prototype, "ButtonSingleClick", 2);
196
+ __decorateClass([
197
+ (0, import_swagger3.ApiProperty)({ type: WebsocketAction, nullable: true })
198
+ ], Button.prototype, "ButtonDoubleClick", 2);
199
+ __decorateClass([
200
+ (0, import_swagger3.ApiProperty)({ type: WebsocketAction, nullable: true })
201
+ ], Button.prototype, "ButtonHold", 2);
202
+ __decorateClass([
203
+ (0, import_swagger3.ApiProperty)({ type: Number, nullable: true })
204
+ ], Button.prototype, "batteryState", 2);
205
+
206
+ // src/jingle.ts
207
+ var import_swagger4 = require("@nestjs/swagger");
45
208
  var Jingle = class {
46
209
  };
47
210
  __decorateClass([
48
- (0, import_swagger.ApiProperty)({ type: String, example: "internet-gekkies" })
211
+ (0, import_swagger4.ApiProperty)({ type: String, example: "internet-gekkies" })
49
212
  ], Jingle.prototype, "folder", 2);
50
213
  __decorateClass([
51
- (0, import_swagger.ApiProperty)({ type: String, example: "mand.mp3" })
214
+ (0, import_swagger4.ApiProperty)({ type: String, example: "mand.mp3" })
52
215
  ], Jingle.prototype, "file", 2);
53
216
  __decorateClass([
54
- (0, import_swagger.ApiProperty)({ type: [String], examples: ["internet", "gekkies", "mand"] })
217
+ (0, import_swagger4.ApiProperty)({ type: [String], examples: ["internet", "gekkies", "mand"] })
55
218
  ], Jingle.prototype, "keywords", 2);
56
219
  __decorateClass([
57
- (0, import_swagger.ApiProperty)({ type: String, example: "1475909a5bbe100" })
220
+ (0, import_swagger4.ApiProperty)({ type: String, example: "1475909a5bbe100" })
58
221
  ], Jingle.prototype, "hash", 2);
59
222
  var JingleFolder = class {
60
223
  };
61
224
  __decorateClass([
62
- (0, import_swagger.ApiProperty)({ type: String, example: "internet-gekkies" })
225
+ (0, import_swagger4.ApiProperty)({ type: String, example: "internet-gekkies" })
63
226
  ], JingleFolder.prototype, "folder", 2);
64
227
  __decorateClass([
65
- (0, import_swagger.ApiProperty)({ type: [Jingle] })
228
+ (0, import_swagger4.ApiProperty)({ type: [Jingle] })
66
229
  ], JingleFolder.prototype, "jingles", 2);
67
- var PlayJingleDto = class extends (0, import_swagger.PickType)(Jingle, ["folder", "file"]) {
230
+ var PlayJingleDto = class extends (0, import_swagger4.PickType)(Jingle, ["folder", "file"]) {
68
231
  };
69
232
  // Annotate the CommonJS export names for ESM import in node:
70
233
  0 && (module.exports = {
71
234
  AddUserDto,
235
+ Application,
236
+ Button,
72
237
  Jingle,
73
238
  JingleFolder,
74
- PlayJingleDto
239
+ PlayJingleDto,
240
+ RemoveUserDto,
241
+ SetWindowStateDto,
242
+ ToggleAbleUserPropertyEnum,
243
+ ToggleBoolDto,
244
+ ToggleableUserProperties,
245
+ User,
246
+ WebsocketAction,
247
+ WindowState
75
248
  });
@@ -1,53 +1,10 @@
1
- export interface UserInterface extends ToggleableUserInterfaceProperties {
2
- id: string;
3
- email: string;
4
- favoriteJingles: string[];
5
- isRegistering?: number;
6
- windowState: any;
7
- buttons: ButtonInterface[];
8
- }
9
-
10
- export interface ToggleableUserInterfaceProperties {
11
- isAdmin: boolean;
12
- isBanned: boolean;
13
- playJinglesLocal: boolean;
14
- }
15
-
16
- export interface ButtonInterface {
17
- bdAddr: string;
18
- owner?: UserInterface;
19
- batteryLevel?: number;
20
- lastBatteryUpdate?: Date;
21
- ButtonSingleClick?: WebsocketAction;
22
- ButtonDoubleClick?: WebsocketAction;
23
- ButtonHold?: WebsocketAction;
24
- batteryState?: number;
25
-
26
- [key: string]: any;
27
- }
28
-
29
- export interface WebsocketAction {
30
- serviceName: string;
31
- methodName: string;
32
- data: any;
33
- }
34
-
35
- export interface RemoveUserDto {
36
- id: number;
37
- }
38
-
39
- export interface ToggleBoolDto {
40
- id: number;
41
- field: keyof ToggleableUserInterfaceProperties;
42
- }
43
-
44
1
  export interface EmulateFireDepartmentDto {
45
2
  city: string;
46
3
  }
47
4
 
48
5
  export interface RemoveButtonDto {
49
6
  buttonId: string;
50
- owner: number;
7
+ owner: string;
51
8
  }
52
9
 
53
10
  export interface SaveButtonEventDto {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tering-serieuze-types",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Tering serieuze types",
5
5
  "author": "Frank",
6
6
  "repository": {
@@ -0,0 +1,47 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+
3
+ export class Application {
4
+ @ApiProperty({ type: String })
5
+ name: string;
6
+
7
+ @ApiProperty({ type: String })
8
+ icon: string;
9
+
10
+ @ApiProperty({ type: Boolean })
11
+ isOpened: boolean;
12
+
13
+ @ApiProperty({ type: Boolean })
14
+ isMinimized: boolean;
15
+
16
+ @ApiProperty({ type: Boolean })
17
+ isMaximized: boolean;
18
+
19
+ @ApiProperty({ type: Boolean })
20
+ isAdminOnly: boolean;
21
+
22
+ @ApiProperty({ type: Boolean })
23
+ isDevOnly: boolean;
24
+
25
+ @ApiProperty({ type: Number })
26
+ width: number;
27
+
28
+ @ApiProperty({ type: Number })
29
+ height: number;
30
+
31
+ @ApiProperty({ type: Number })
32
+ x: number;
33
+
34
+ @ApiProperty({ type: Number })
35
+ y: number;
36
+
37
+ @ApiProperty({ type: Object })
38
+ custom: any;
39
+ }
40
+
41
+ export class WindowState {
42
+ @ApiProperty({ type: [Application] })
43
+ applications: Application[];
44
+
45
+ @ApiProperty({ type: String })
46
+ activeApplication: string;
47
+ }
package/src/button.ts ADDED
@@ -0,0 +1,41 @@
1
+ import { User } from './user';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+
4
+ export class WebsocketAction {
5
+ @ApiProperty({ type: String })
6
+ serviceName: string;
7
+
8
+ @ApiProperty({ type: String })
9
+ methodName: string;
10
+
11
+ @ApiProperty({ type: Object })
12
+ data: any;
13
+ }
14
+
15
+ export class Button {
16
+ @ApiProperty({ type: String })
17
+ bdAddr: string;
18
+
19
+ @ApiProperty({ type: User, nullable: true })
20
+ owner?: User;
21
+
22
+ @ApiProperty({ type: Number, nullable: true })
23
+ batteryLevel?: number;
24
+
25
+ @ApiProperty({ type: Date, nullable: true })
26
+ lastBatteryUpdate?: Date;
27
+
28
+ @ApiProperty({ type: WebsocketAction, nullable: true })
29
+ ButtonSingleClick?: WebsocketAction;
30
+
31
+ @ApiProperty({ type: WebsocketAction, nullable: true })
32
+ ButtonDoubleClick?: WebsocketAction;
33
+
34
+ @ApiProperty({ type: WebsocketAction, nullable: true })
35
+ ButtonHold?: WebsocketAction;
36
+
37
+ @ApiProperty({ type: Number, nullable: true })
38
+ batteryState?: number;
39
+
40
+ [key: string]: any;
41
+ }
package/src/index.ts CHANGED
@@ -1,32 +1,4 @@
1
- import { ApiProperty, PickType } from '@nestjs/swagger';
2
- import { IsEmail } from 'class-validator';
3
-
4
- export class AddUserDto {
5
- @IsEmail()
6
- @ApiProperty({ type: String, example: 'info@example.com' })
7
- email: string;
8
- }
9
-
10
- export class Jingle {
11
- @ApiProperty({ type: String, example: 'internet-gekkies' })
12
- folder: string;
13
-
14
- @ApiProperty({ type: String, example: 'mand.mp3' })
15
- file: string;
16
-
17
- @ApiProperty({ type: [String], examples: ['internet', 'gekkies', 'mand'] })
18
- keywords: string[];
19
-
20
- @ApiProperty({ type: String, example: '1475909a5bbe100' })
21
- hash: string;
22
- }
23
-
24
- export class JingleFolder {
25
- @ApiProperty({ type: String, example: 'internet-gekkies' })
26
- folder: string;
27
-
28
- @ApiProperty({ type: [Jingle] })
29
- jingles: Jingle[];
30
- }
31
-
32
- export class PlayJingleDto extends PickType(Jingle, ['folder', 'file'] as const) {}
1
+ export * from './application';
2
+ export * from './button';
3
+ export * from './jingle';
4
+ export * from './user';
package/src/jingle.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { ApiProperty, PickType } from '@nestjs/swagger';
2
+
3
+ export class Jingle {
4
+ @ApiProperty({ type: String, example: 'internet-gekkies' })
5
+ folder: string;
6
+
7
+ @ApiProperty({ type: String, example: 'mand.mp3' })
8
+ file: string;
9
+
10
+ @ApiProperty({ type: [String], examples: ['internet', 'gekkies', 'mand'] })
11
+ keywords: string[];
12
+
13
+ @ApiProperty({ type: String, example: '1475909a5bbe100' })
14
+ hash: string;
15
+ }
16
+
17
+ export class JingleFolder {
18
+ @ApiProperty({ type: String, example: 'internet-gekkies' })
19
+ folder: string;
20
+
21
+ @ApiProperty({ type: [Jingle] })
22
+ jingles: Jingle[];
23
+ }
24
+
25
+ export class PlayJingleDto extends PickType(Jingle, ['folder', 'file'] as const) {}
package/src/user.ts ADDED
@@ -0,0 +1,69 @@
1
+ import { ApiProperty, PickType } from '@nestjs/swagger';
2
+ import { IsEmail } from 'class-validator';
3
+ import { Button } from './button';
4
+ import { WindowState } from './application';
5
+
6
+ export class User {
7
+ @ApiProperty({ type: String })
8
+ id: string;
9
+
10
+ @IsEmail()
11
+ @ApiProperty({ type: String })
12
+ email: string;
13
+
14
+ @ApiProperty({ type: Boolean, default: false })
15
+ isAdmin: boolean;
16
+
17
+ @ApiProperty({ type: Boolean, default: false })
18
+ isBanned: boolean;
19
+
20
+ @ApiProperty({ type: Boolean, default: false })
21
+ playJinglesLocal: boolean;
22
+
23
+ @ApiProperty({ type: [String], default: [] })
24
+ favoriteJingles: string[];
25
+
26
+ @ApiProperty({ type: Number, nullable: true })
27
+ @ApiProperty()
28
+ isRegistering?: number;
29
+
30
+ @ApiProperty({ type: WindowState })
31
+ windowState: WindowState;
32
+
33
+ @ApiProperty({ type: () => [Button] })
34
+ buttons: Button[];
35
+ }
36
+
37
+ export enum ToggleAbleUserPropertyEnum {
38
+ isAdmin = 'isAdmin',
39
+ isBanned = 'isBanned',
40
+ playJinglesLocal = 'playJinglesLocal',
41
+ }
42
+
43
+ export class ToggleableUserProperties extends PickType(User, [
44
+ ToggleAbleUserPropertyEnum.isAdmin,
45
+ ToggleAbleUserPropertyEnum.isBanned,
46
+ ToggleAbleUserPropertyEnum.playJinglesLocal,
47
+ ] as const) {}
48
+
49
+ export class AddUserDto {
50
+ @IsEmail()
51
+ @ApiProperty({ type: String, example: 'info@example.com' })
52
+ email: string;
53
+ }
54
+
55
+ export class RemoveUserDto extends PickType(User, ['id'] as const) {}
56
+
57
+ export class SetWindowStateDto extends PickType(User, ['windowState'] as const) {}
58
+
59
+ export class ToggleBoolDto {
60
+ @ApiProperty({
61
+ type: String,
62
+ nullable: true,
63
+ description: 'User ID. When empty, the current user is used. Admin only param',
64
+ })
65
+ id: string;
66
+
67
+ @ApiProperty({ enum: ToggleAbleUserPropertyEnum, description: 'The property to toggle' })
68
+ field: keyof ToggleableUserProperties;
69
+ }