tering-serieuze-types 3.8.1 → 3.9.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/.oxfmtrc.json +6 -0
- package/.oxlintrc.json +147 -0
- package/interfaces/index.ts +4 -4
- package/interfaces/mopidy.ts +20 -21
- package/interfaces/token.ts +3 -3
- package/package.json +9 -11
- package/src/application.ts +4 -5
- package/src/arduino.ts +6 -6
- package/src/authenticator.ts +4 -4
- package/src/button.ts +2 -2
- package/src/emulator.ts +4 -4
- package/src/index.ts +11 -11
- package/src/jingle.ts +13 -13
- package/src/k8s.ts +2 -2
- package/src/mopidy.ts +4 -4
- package/src/session.ts +18 -18
- package/src/user.ts +17 -17
- package/tsconfig.json +1 -0
- package/.eslintrc.js +0 -40
- package/.prettierrc +0 -6
package/.oxfmtrc.json
ADDED
package/.oxlintrc.json
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
|
|
4
|
+
"plugins": ["typescript", "unicorn", "oxc", "import", "node", "promise"],
|
|
5
|
+
|
|
6
|
+
"categories": {
|
|
7
|
+
"correctness": "error",
|
|
8
|
+
"suspicious": "warn",
|
|
9
|
+
"perf": "warn"
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
"options": {
|
|
13
|
+
"typeAware": true
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
"env": {
|
|
17
|
+
"node": true,
|
|
18
|
+
"es2024": true
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
"rules": {
|
|
22
|
+
"oxc/approx-constant": "error",
|
|
23
|
+
"oxc/bad-array-method-on-arguments": "error",
|
|
24
|
+
"oxc/bad-bitwise-operator": "error",
|
|
25
|
+
"oxc/bad-char-at-comparison": "error",
|
|
26
|
+
"oxc/bad-comparison-sequence": "error",
|
|
27
|
+
"oxc/bad-min-max-func": "error",
|
|
28
|
+
"oxc/bad-object-literal-comparison": "error",
|
|
29
|
+
"oxc/bad-replace-all-arg": "error",
|
|
30
|
+
"oxc/branches-sharing-code": "warn",
|
|
31
|
+
"oxc/const-comparisons": "error",
|
|
32
|
+
"oxc/double-comparisons": "error",
|
|
33
|
+
"oxc/erasing-op": "error",
|
|
34
|
+
"oxc/misrefactored-assign-op": "error",
|
|
35
|
+
"oxc/missing-throw": "error",
|
|
36
|
+
"oxc/no-accumulating-spread": "error",
|
|
37
|
+
"oxc/no-barrel-file": "off",
|
|
38
|
+
"oxc/no-const-enum": "error",
|
|
39
|
+
"oxc/no-map-spread": "error",
|
|
40
|
+
"oxc/number-arg-out-of-range": "error",
|
|
41
|
+
"oxc/only-used-in-recursion": "warn",
|
|
42
|
+
"oxc/uninvoked-array-callback": "error",
|
|
43
|
+
|
|
44
|
+
"typescript/consistent-type-imports": "off",
|
|
45
|
+
"typescript/no-extraneous-class": "off",
|
|
46
|
+
"typescript/no-floating-promises": ["error", { "ignoreVoid": true }],
|
|
47
|
+
"typescript/no-misused-promises": "warn",
|
|
48
|
+
"typescript/no-unnecessary-condition": "warn",
|
|
49
|
+
"typescript/switch-exhaustiveness-check": "error",
|
|
50
|
+
"typescript/prefer-optional-chain": "error",
|
|
51
|
+
"typescript/prefer-nullish-coalescing": "warn",
|
|
52
|
+
"typescript/no-deprecated": "warn",
|
|
53
|
+
"typescript/no-unsafe-enum-comparison": "error",
|
|
54
|
+
"typescript/prefer-includes": "error",
|
|
55
|
+
"typescript/prefer-string-starts-ends-with": "error",
|
|
56
|
+
"typescript/prefer-find": "error",
|
|
57
|
+
"typescript/no-base-to-string": "warn",
|
|
58
|
+
"typescript/return-await": "error",
|
|
59
|
+
"typescript/no-confusing-void-expression": "warn",
|
|
60
|
+
"typescript/no-misused-spread": "error",
|
|
61
|
+
"typescript/restrict-plus-operands": "warn",
|
|
62
|
+
"typescript/restrict-template-expressions": "warn",
|
|
63
|
+
"typescript/no-unnecessary-type-assertion": "error",
|
|
64
|
+
"typescript/no-unnecessary-type-arguments": "off",
|
|
65
|
+
"typescript/no-unnecessary-template-expression": "error",
|
|
66
|
+
"typescript/no-non-null-assertion": "error",
|
|
67
|
+
"typescript/no-inferrable-types": "error",
|
|
68
|
+
"typescript/no-namespace": "error",
|
|
69
|
+
"typescript/no-dynamic-delete": "error",
|
|
70
|
+
"typescript/array-type": ["error", { "default": "array" }],
|
|
71
|
+
"typescript/prefer-for-of": "error",
|
|
72
|
+
"typescript/prefer-literal-enum-member": "off",
|
|
73
|
+
"typescript/prefer-readonly": "error",
|
|
74
|
+
"typescript/prefer-function-type": "error",
|
|
75
|
+
"typescript/prefer-promise-reject-errors": "warn",
|
|
76
|
+
"typescript/only-throw-error": "error",
|
|
77
|
+
"typescript/require-await": "error",
|
|
78
|
+
"typescript/strict-boolean-expressions": "off",
|
|
79
|
+
"typescript/consistent-return": "warn",
|
|
80
|
+
|
|
81
|
+
"eslint/complexity": ["error", { "max": 15 }],
|
|
82
|
+
"eslint/no-await-in-loop": "error",
|
|
83
|
+
"eslint/no-param-reassign": "error",
|
|
84
|
+
"eslint/no-nested-ternary": "error",
|
|
85
|
+
"eslint/no-else-return": "error",
|
|
86
|
+
"eslint/yoda": "error",
|
|
87
|
+
"eslint/curly": "error",
|
|
88
|
+
"eslint/prefer-const": "error",
|
|
89
|
+
"eslint/default-param-last": "error",
|
|
90
|
+
"eslint/default-case": "error",
|
|
91
|
+
"eslint/prefer-object-spread": "error",
|
|
92
|
+
"eslint/prefer-destructuring": "warn",
|
|
93
|
+
"eslint/operator-assignment": "error",
|
|
94
|
+
"eslint/object-shorthand": "warn",
|
|
95
|
+
"eslint/no-var": "error",
|
|
96
|
+
"eslint/no-empty": "error",
|
|
97
|
+
"eslint/no-empty-function": "error",
|
|
98
|
+
"eslint/no-warning-comments": "warn",
|
|
99
|
+
"eslint/radix": "error",
|
|
100
|
+
"eslint/no-array-constructor": "error",
|
|
101
|
+
"eslint/no-self-compare": "error",
|
|
102
|
+
"eslint/no-new-func": "error",
|
|
103
|
+
"eslint/no-script-url": "error",
|
|
104
|
+
"eslint/no-useless-concat": "error",
|
|
105
|
+
|
|
106
|
+
"import/no-cycle": "off",
|
|
107
|
+
"import/no-self-import": "error",
|
|
108
|
+
"import/no-duplicates": "error",
|
|
109
|
+
"import/first": "error",
|
|
110
|
+
"import/no-namespace": "error",
|
|
111
|
+
"import/no-commonjs": "error",
|
|
112
|
+
"import/no-mutable-exports": "error",
|
|
113
|
+
|
|
114
|
+
"unicorn/prefer-node-protocol": "error",
|
|
115
|
+
"unicorn/prefer-number-properties": "error",
|
|
116
|
+
"unicorn/numeric-separators-style": "error",
|
|
117
|
+
"unicorn/prefer-string-slice": "error",
|
|
118
|
+
"unicorn/throw-new-error": "error",
|
|
119
|
+
"unicorn/error-message": "error",
|
|
120
|
+
"unicorn/new-for-builtins": "error",
|
|
121
|
+
"unicorn/no-lonely-if": "error",
|
|
122
|
+
"unicorn/explicit-length-check": "error",
|
|
123
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
124
|
+
"unicorn/require-number-to-fixed-digits-argument": "error",
|
|
125
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
126
|
+
"unicorn/no-single-promise-in-promise-methods": "error",
|
|
127
|
+
"unicorn/no-useless-spread": "error",
|
|
128
|
+
"unicorn/prefer-structured-clone": "warn",
|
|
129
|
+
"unicorn/consistent-function-scoping": "warn",
|
|
130
|
+
"unicorn/no-thenable": "error",
|
|
131
|
+
"unicorn/prefer-at": "warn",
|
|
132
|
+
"unicorn/no-negation-in-equality-check": "error",
|
|
133
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
134
|
+
|
|
135
|
+
"promise/catch-or-return": "warn",
|
|
136
|
+
"promise/no-return-in-finally": "error",
|
|
137
|
+
"promise/no-multiple-resolved": "warn",
|
|
138
|
+
"promise/valid-params": "error",
|
|
139
|
+
"promise/no-nesting": "warn",
|
|
140
|
+
"promise/prefer-await-to-callbacks": "warn",
|
|
141
|
+
|
|
142
|
+
"node/no-path-concat": "error",
|
|
143
|
+
"node/no-new-require": "error"
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
"ignorePatterns": ["dist", "node_modules"]
|
|
147
|
+
}
|
package/interfaces/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type ClickType } from
|
|
1
|
+
import { type ClickType } from "../index";
|
|
2
2
|
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
3
|
+
export * from "./mopidy";
|
|
4
|
+
export * from "./token";
|
|
5
|
+
export * from "./webamp";
|
|
6
6
|
|
|
7
7
|
export interface RemoveButtonDto {
|
|
8
8
|
bdAddr: string;
|
package/interfaces/mopidy.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type Mopidy = require(
|
|
1
|
+
import type Mopidy = require("mopidy");
|
|
2
2
|
|
|
3
|
-
type Artist = Omit<Mopidy.models.Artist,
|
|
4
|
-
type Album = Omit<Mopidy.models.Album,
|
|
3
|
+
type Artist = Omit<Mopidy.models.Artist, "musicbrainz_id">;
|
|
4
|
+
type Album = Omit<Mopidy.models.Album, "artists" | "num_discs" | "musicbrainz_id"> & {
|
|
5
5
|
artists: Artist[];
|
|
6
6
|
};
|
|
7
7
|
type Track = Omit<
|
|
8
8
|
Mopidy.models.Track,
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
9
|
+
| "album"
|
|
10
|
+
| "composers"
|
|
11
|
+
| "performers"
|
|
12
|
+
| "genre"
|
|
13
|
+
| "track_no"
|
|
14
|
+
| "disc_no"
|
|
15
|
+
| "date"
|
|
16
|
+
| "bitrate"
|
|
17
|
+
| "comment"
|
|
18
|
+
| "musicbrainz_id"
|
|
19
|
+
| "artists"
|
|
20
|
+
| "last_modified"
|
|
21
21
|
> & { album: Album; artists: Artist[]; isPlayable?: boolean };
|
|
22
|
-
type TlTrack = Omit<Mopidy.models.TlTrack,
|
|
22
|
+
type TlTrack = Omit<Mopidy.models.TlTrack, "track"> & { track: Track };
|
|
23
23
|
type Image = Mopidy.models.Image;
|
|
24
|
-
type Playlist = Omit<Mopidy.models.Playlist,
|
|
24
|
+
type Playlist = Omit<Mopidy.models.Playlist, "tracks" | "last_modified" | "length">;
|
|
25
25
|
|
|
26
26
|
export type HasImage = { image: Image | undefined };
|
|
27
27
|
export type TlTrackWithImage = TlTrack & HasImage;
|
|
@@ -30,7 +30,7 @@ export type ArtistWithImage = Artist & HasImage;
|
|
|
30
30
|
export type TrackWithImage = Track & HasImage;
|
|
31
31
|
export type PlaylistWithImage = Playlist & HasImage;
|
|
32
32
|
|
|
33
|
-
type SearchResult = Omit<Mopidy.models.SearchResult,
|
|
33
|
+
type SearchResult = Omit<Mopidy.models.SearchResult, "uri" | "tracks" | "albums" | "artists"> & {
|
|
34
34
|
tracks: TrackWithImage[];
|
|
35
35
|
albums: AlbumWithImage[];
|
|
36
36
|
artists: ArtistWithImage[];
|
|
@@ -39,8 +39,8 @@ type SearchResult = Omit<Mopidy.models.SearchResult, 'uri' | 'tracks' | 'albums'
|
|
|
39
39
|
|
|
40
40
|
export type { Track, TlTrack, Artist, Image, SearchResult, Album };
|
|
41
41
|
|
|
42
|
-
export type PlaybackState =
|
|
43
|
-
export type MopidyConnectionState =
|
|
42
|
+
export type PlaybackState = "playing" | "paused" | "stopped";
|
|
43
|
+
export type MopidyConnectionState = "connected" | "reconnecting" | "offline";
|
|
44
44
|
|
|
45
45
|
export interface MopidyData {
|
|
46
46
|
tracklist: TlTrack[];
|
|
@@ -55,7 +55,6 @@ export interface MopidyData {
|
|
|
55
55
|
connectionState: MopidyConnectionState;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
59
58
|
export type AlarmschijfResult = {
|
|
60
59
|
playlist: Track[];
|
|
61
60
|
alarmschijf?: TrackWithImage;
|
package/interfaces/token.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TokenType } from
|
|
1
|
+
import { TokenType } from "../src";
|
|
2
2
|
|
|
3
3
|
export interface TokenContent {
|
|
4
4
|
email?: string;
|
|
@@ -17,6 +17,6 @@ export interface ApiTokenContent extends TokenContent {
|
|
|
17
17
|
id: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export interface NewFrontendTokenContent extends Omit<FrontendTokenContent,
|
|
20
|
+
export interface NewFrontendTokenContent extends Omit<FrontendTokenContent, "iat" | "exp"> {}
|
|
21
21
|
|
|
22
|
-
export interface NewApiTokenContent extends Omit<ApiTokenContent,
|
|
22
|
+
export interface NewApiTokenContent extends Omit<ApiTokenContent, "iat" | "exp"> {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tering-serieuze-types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Tering serieuze types",
|
|
5
5
|
"author": "Frank",
|
|
6
6
|
"repository": {
|
|
@@ -8,24 +8,22 @@
|
|
|
8
8
|
"url": "git+https://gitlab.com/tering-serieuze-shit/tering-serieuze-types.git"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"prebuild": "npm run lint && npm run format",
|
|
11
|
+
"prebuild": "npm run lint && npm run format:check",
|
|
12
12
|
"build": "esbuild src/index.ts --bundle --platform=node --outfile=dist/index.js --packages=external",
|
|
13
13
|
"version": "npm run build && git add -A dist",
|
|
14
14
|
"pub": "npm publish && git push",
|
|
15
|
-
"lint": "
|
|
16
|
-
"
|
|
15
|
+
"lint": "oxlint",
|
|
16
|
+
"lint:fix": "oxlint --fix",
|
|
17
|
+
"format": "oxfmt src interfaces",
|
|
18
|
+
"format:check": "oxfmt --check src interfaces"
|
|
17
19
|
},
|
|
18
20
|
"main": "dist/index.js",
|
|
19
21
|
"types": "index.d.ts",
|
|
20
22
|
"devDependencies": {
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
22
|
-
"@typescript-eslint/parser": "^7.7.0",
|
|
23
23
|
"esbuild": "^0.23.1",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
28
|
-
"prettier": "^3.4.2"
|
|
24
|
+
"oxfmt": "^0.44.0",
|
|
25
|
+
"oxlint": "^1.60.0",
|
|
26
|
+
"oxlint-tsgolint": "^0.20.0"
|
|
29
27
|
},
|
|
30
28
|
"dependencies": {
|
|
31
29
|
"@nestjs/swagger": "^11.0.2",
|
package/src/application.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ApiProperty, OmitType } from
|
|
2
|
-
import { IsBoolean, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateNested } from
|
|
3
|
-
import { Type } from
|
|
1
|
+
import { ApiProperty, OmitType } from "@nestjs/swagger";
|
|
2
|
+
import { IsBoolean, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateNested } from "class-validator";
|
|
3
|
+
import { Type } from "class-transformer";
|
|
4
4
|
|
|
5
5
|
export class CustomApplicationProperties {
|
|
6
|
-
// eslint-disable-next-line no-undef
|
|
7
6
|
[key: string]: string | number | boolean | string[] | number[] | boolean[] | (number | string)[];
|
|
8
7
|
}
|
|
9
8
|
|
|
@@ -62,7 +61,7 @@ export class Application {
|
|
|
62
61
|
custom: CustomApplicationProperties;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
export class WindowStateApplication extends OmitType(Application, [
|
|
64
|
+
export class WindowStateApplication extends OmitType(Application, ["icon", "isAdminOnly"]) {}
|
|
66
65
|
|
|
67
66
|
export class WindowState {
|
|
68
67
|
@ApiProperty({ type: [WindowStateApplication] })
|
package/src/arduino.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ApiProperty } from
|
|
2
|
-
import { IsEnum } from
|
|
1
|
+
import { ApiProperty } from "@nestjs/swagger";
|
|
2
|
+
import { IsEnum } from "class-validator";
|
|
3
3
|
|
|
4
4
|
export enum ToggleableHardwareDeviceStateEnum {
|
|
5
|
-
ON =
|
|
6
|
-
OFF =
|
|
5
|
+
ON = "Aan.",
|
|
6
|
+
OFF = "Uit.",
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export class ToggleableHardwareDeviceStateDto {
|
|
@@ -17,8 +17,8 @@ export class ToggleableHardwareDeviceStateDto {
|
|
|
17
17
|
* TODO remove in next version
|
|
18
18
|
*/
|
|
19
19
|
export enum ZwaailampStateEnum {
|
|
20
|
-
ON =
|
|
21
|
-
OFF =
|
|
20
|
+
ON = "Aan.",
|
|
21
|
+
OFF = "Uit.",
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
package/src/authenticator.ts
CHANGED
|
@@ -2,16 +2,16 @@ import type {
|
|
|
2
2
|
AuthenticatorDevice,
|
|
3
3
|
CredentialDeviceType,
|
|
4
4
|
PublicKeyCredentialRequestOptionsJSON,
|
|
5
|
-
} from
|
|
6
|
-
import { ApiProperty } from
|
|
7
|
-
import { User } from
|
|
5
|
+
} from "@simplewebauthn/types";
|
|
6
|
+
import { ApiProperty } from "@nestjs/swagger";
|
|
7
|
+
import { User } from "./user";
|
|
8
8
|
|
|
9
9
|
export type Authenticator = AuthenticatorDevice & {
|
|
10
10
|
credentialDeviceType: CredentialDeviceType;
|
|
11
11
|
credentialBackedUp: boolean;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type DbAuthenticator = Omit<Authenticator,
|
|
14
|
+
export type DbAuthenticator = Omit<Authenticator, "credentialID" | "credentialPublicKey"> & {
|
|
15
15
|
user: Promise<User> | User;
|
|
16
16
|
credentialID: string;
|
|
17
17
|
credentialPublicKey: string;
|
package/src/button.ts
CHANGED
package/src/emulator.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IsEnum } from
|
|
2
|
-
import { ApiProperty } from
|
|
1
|
+
import { IsEnum } from "class-validator";
|
|
2
|
+
import { ApiProperty } from "@nestjs/swagger";
|
|
3
3
|
|
|
4
4
|
export enum City {
|
|
5
|
-
Waalwijk =
|
|
6
|
-
Sprang =
|
|
5
|
+
Waalwijk = "Waalwijk",
|
|
6
|
+
Sprang = "Sprang-Capelle",
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export class EmulateFireDepartmentDto {
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
1
|
+
export * from "./application";
|
|
2
|
+
export * from "./arduino";
|
|
3
|
+
export * from "./authenticator";
|
|
4
|
+
export * from "./button";
|
|
5
|
+
export * from "./emulator";
|
|
6
|
+
export * from "./jingle";
|
|
7
|
+
export * from "./k8s";
|
|
8
|
+
export * from "./mopidy";
|
|
9
|
+
export * from "./session";
|
|
10
|
+
export * from "./user";
|
|
11
11
|
|
|
12
12
|
// Prevent 'Inferred type cannot be named' error
|
|
13
|
-
export type { Type } from
|
|
13
|
+
export type { Type } from "@nestjs/common";
|
|
14
14
|
|
|
15
15
|
export interface Dto {}
|
|
16
16
|
|
package/src/jingle.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { ApiProperty, PickType } from
|
|
2
|
-
import { IsNotEmpty, IsString, ValidateNested } from
|
|
3
|
-
import { Type } from
|
|
1
|
+
import { ApiProperty, PickType } from "@nestjs/swagger";
|
|
2
|
+
import { IsNotEmpty, IsString, ValidateNested } from "class-validator";
|
|
3
|
+
import { Type } from "class-transformer";
|
|
4
4
|
|
|
5
5
|
export class Jingle {
|
|
6
|
-
@ApiProperty({ type: String, example:
|
|
6
|
+
@ApiProperty({ type: String, example: "internet-gekkies" })
|
|
7
7
|
@IsString()
|
|
8
8
|
@IsNotEmpty()
|
|
9
9
|
folder: string;
|
|
10
10
|
|
|
11
|
-
@ApiProperty({ type: String, example:
|
|
11
|
+
@ApiProperty({ type: String, example: "mand.mp3" })
|
|
12
12
|
@IsString()
|
|
13
13
|
@IsNotEmpty()
|
|
14
14
|
file: string;
|
|
15
15
|
|
|
16
|
-
@ApiProperty({ type: [String], examples: [
|
|
16
|
+
@ApiProperty({ type: [String], examples: ["internet", "gekkies", "mand"] })
|
|
17
17
|
keywords: string[];
|
|
18
18
|
|
|
19
|
-
@ApiProperty({ type: String, example:
|
|
19
|
+
@ApiProperty({ type: String, example: "1475909a5bbe100" })
|
|
20
20
|
hash: string;
|
|
21
21
|
|
|
22
|
-
@ApiProperty({ type: Number, example:
|
|
22
|
+
@ApiProperty({ type: Number, example: 1_599_223_250, description: "Timestamp in seconds" })
|
|
23
23
|
mtime: number;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export class JingleFolder {
|
|
27
|
-
@ApiProperty({ type: String, example:
|
|
27
|
+
@ApiProperty({ type: String, example: "internet-gekkies" })
|
|
28
28
|
@IsString()
|
|
29
29
|
@IsNotEmpty()
|
|
30
30
|
folder: string;
|
|
@@ -35,15 +35,15 @@ export class JingleFolder {
|
|
|
35
35
|
jingles: Jingle[];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export class PlayJingleDto extends PickType(Jingle, [
|
|
38
|
+
export class PlayJingleDto extends PickType(Jingle, ["folder", "file"] as const) {}
|
|
39
39
|
|
|
40
40
|
export class BigBrotherItem {
|
|
41
|
-
@ApiProperty({ type: String, example:
|
|
41
|
+
@ApiProperty({ type: String, example: "internet-gekkies/mand.mp3", description: "Path of the played jingle" })
|
|
42
42
|
data: string;
|
|
43
43
|
|
|
44
|
-
@ApiProperty({ type: String, example:
|
|
44
|
+
@ApiProperty({ type: String, example: "frank@maxserv.com", description: "User's email" })
|
|
45
45
|
user: string;
|
|
46
46
|
|
|
47
|
-
@ApiProperty({ type: Number, example:
|
|
47
|
+
@ApiProperty({ type: Number, example: 1_679_694_523_189, description: "Timestamp in milliseconds" })
|
|
48
48
|
time: number;
|
|
49
49
|
}
|
package/src/k8s.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiProperty, PickType } from
|
|
1
|
+
import { ApiProperty, PickType } from "@nestjs/swagger";
|
|
2
2
|
|
|
3
3
|
export class Pod {
|
|
4
4
|
@ApiProperty({ type: String })
|
|
@@ -26,4 +26,4 @@ export class Pod {
|
|
|
26
26
|
node: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export class DeletePodDto extends PickType(Pod, [
|
|
29
|
+
export class DeletePodDto extends PickType(Pod, ["name"] as const) {}
|
package/src/mopidy.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ApiProperty } from
|
|
2
|
-
import { IsNotEmpty, IsString, Matches } from
|
|
1
|
+
import { ApiProperty } from "@nestjs/swagger";
|
|
2
|
+
import { IsNotEmpty, IsString, Matches } from "class-validator";
|
|
3
3
|
|
|
4
4
|
export class SetAlarmschijfDto {
|
|
5
|
-
@ApiProperty({ description:
|
|
5
|
+
@ApiProperty({ description: "URI of the track to set as alarmschijf", type: String })
|
|
6
6
|
@IsString()
|
|
7
7
|
@IsNotEmpty()
|
|
8
|
-
@Matches(/^spotify:track:[a-zA-Z0-9]{22}$/, { message:
|
|
8
|
+
@Matches(/^spotify:track:[a-zA-Z0-9]{22}$/, { message: "URI must be a valid Spotify track URI" })
|
|
9
9
|
uri: string;
|
|
10
10
|
}
|
package/src/session.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ApiProperty } from
|
|
2
|
-
import { Type } from
|
|
3
|
-
import { IsDate } from
|
|
4
|
-
import { User } from
|
|
1
|
+
import { ApiProperty } from "@nestjs/swagger";
|
|
2
|
+
import { Type } from "class-transformer";
|
|
3
|
+
import { IsDate } from "class-validator";
|
|
4
|
+
import { User } from "./user";
|
|
5
5
|
|
|
6
6
|
export enum TokenType {
|
|
7
7
|
Refresh,
|
|
@@ -12,63 +12,63 @@ export enum TokenType {
|
|
|
12
12
|
export class ApiToken {
|
|
13
13
|
@ApiProperty({
|
|
14
14
|
type: String,
|
|
15
|
-
example:
|
|
16
|
-
description:
|
|
15
|
+
example: "fc532e57-66d6-4e92-9eb1-b08578d24b0b",
|
|
16
|
+
description: "Token ID, a random UUID",
|
|
17
17
|
})
|
|
18
18
|
id: string;
|
|
19
19
|
|
|
20
20
|
@ApiProperty({
|
|
21
21
|
type: () => [User],
|
|
22
|
-
description:
|
|
22
|
+
description: "User object",
|
|
23
23
|
})
|
|
24
24
|
user: Promise<User> | User;
|
|
25
25
|
|
|
26
|
-
@ApiProperty({ type: String, example:
|
|
26
|
+
@ApiProperty({ type: String, example: "Token name" })
|
|
27
27
|
name: string;
|
|
28
28
|
|
|
29
29
|
@ApiProperty({
|
|
30
30
|
type: Date,
|
|
31
|
-
example:
|
|
32
|
-
description:
|
|
31
|
+
example: "2021-01-01T00:00:00.000Z",
|
|
32
|
+
description: "Timestamp of the creation of the api token",
|
|
33
33
|
})
|
|
34
34
|
created: Date;
|
|
35
35
|
|
|
36
36
|
@ApiProperty({
|
|
37
37
|
type: Date,
|
|
38
|
-
example:
|
|
39
|
-
description:
|
|
38
|
+
example: "2021-01-01T00:00:00.000Z",
|
|
39
|
+
description: "Timestamp of the last time the api token was used",
|
|
40
40
|
nullable: true,
|
|
41
41
|
})
|
|
42
42
|
lastUsed?: Date;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export class Session {
|
|
46
|
-
@ApiProperty({ type: Number, example: 123, description:
|
|
46
|
+
@ApiProperty({ type: Number, example: 123, description: "Session ID" })
|
|
47
47
|
id: number;
|
|
48
48
|
|
|
49
49
|
@ApiProperty({
|
|
50
50
|
type: () => [User],
|
|
51
|
-
description:
|
|
51
|
+
description: "User object",
|
|
52
52
|
})
|
|
53
53
|
user: Promise<User> | User;
|
|
54
54
|
|
|
55
55
|
@ApiProperty({
|
|
56
56
|
type: Number,
|
|
57
57
|
example: 5,
|
|
58
|
-
description:
|
|
58
|
+
description: "Current number of the token. Updates when the refresh token is renewed.",
|
|
59
59
|
default: 0,
|
|
60
60
|
})
|
|
61
61
|
lastTokenNumber: number;
|
|
62
62
|
|
|
63
63
|
@ApiProperty({
|
|
64
64
|
type: Date,
|
|
65
|
-
example:
|
|
66
|
-
description:
|
|
65
|
+
example: "2021-01-01T00:00:00.000Z",
|
|
66
|
+
description: "Timestamp of the last time the session was used",
|
|
67
67
|
})
|
|
68
68
|
@IsDate()
|
|
69
69
|
@Type(() => Date)
|
|
70
70
|
lastUsed: Date;
|
|
71
71
|
|
|
72
|
-
@ApiProperty({ type: String, example:
|
|
72
|
+
@ApiProperty({ type: String, example: "Chrome on Windows", description: "Name of the session" })
|
|
73
73
|
name: string;
|
|
74
74
|
}
|
package/src/user.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ApiProperty, PickType } from
|
|
2
|
-
import { Type } from
|
|
3
|
-
import { IsEmail, IsNumberString, ValidateNested } from
|
|
4
|
-
import { Button } from
|
|
5
|
-
import { WindowState } from
|
|
6
|
-
import { type DbAuthenticator } from
|
|
7
|
-
import { ApiToken, Session } from
|
|
1
|
+
import { ApiProperty, PickType } from "@nestjs/swagger";
|
|
2
|
+
import { Type } from "class-transformer";
|
|
3
|
+
import { IsEmail, IsNumberString, ValidateNested } from "class-validator";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
import { WindowState } from "./application";
|
|
6
|
+
import { type DbAuthenticator } from "./authenticator";
|
|
7
|
+
import { ApiToken, Session } from "./session";
|
|
8
8
|
|
|
9
9
|
export class User {
|
|
10
10
|
@IsNumberString()
|
|
@@ -43,7 +43,7 @@ export class User {
|
|
|
43
43
|
@ApiProperty({ type: () => [Button] })
|
|
44
44
|
buttons: Button[];
|
|
45
45
|
|
|
46
|
-
@ApiProperty({ type: String, default:
|
|
46
|
+
@ApiProperty({ type: String, default: "" })
|
|
47
47
|
lastSeenChangelogId: string;
|
|
48
48
|
|
|
49
49
|
authenticators: DbAuthenticator[];
|
|
@@ -58,9 +58,9 @@ export class User {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export enum ToggleAbleUserPropertyEnum {
|
|
61
|
-
isAdmin =
|
|
62
|
-
isBanned =
|
|
63
|
-
playJinglesLocal =
|
|
61
|
+
isAdmin = "isAdmin",
|
|
62
|
+
isBanned = "isBanned",
|
|
63
|
+
playJinglesLocal = "playJinglesLocal",
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export class ToggleableUserProperties extends PickType(User, [
|
|
@@ -71,25 +71,25 @@ export class ToggleableUserProperties extends PickType(User, [
|
|
|
71
71
|
|
|
72
72
|
export class AddUserDto {
|
|
73
73
|
@IsEmail()
|
|
74
|
-
@ApiProperty({ type: String, example:
|
|
74
|
+
@ApiProperty({ type: String, example: "info@example.com" })
|
|
75
75
|
email: string;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export class RemoveUserDto extends PickType(User, [
|
|
78
|
+
export class RemoveUserDto extends PickType(User, ["id"] as const) {}
|
|
79
79
|
|
|
80
|
-
export class SetWindowStateDto extends PickType(User, [
|
|
80
|
+
export class SetWindowStateDto extends PickType(User, ["windowState"] as const) {}
|
|
81
81
|
|
|
82
|
-
export class SetChangelogIdDto extends PickType(User, [
|
|
82
|
+
export class SetChangelogIdDto extends PickType(User, ["lastSeenChangelogId"] as const) {}
|
|
83
83
|
|
|
84
84
|
export class ToggleBoolDto {
|
|
85
85
|
@ApiProperty({
|
|
86
86
|
type: String,
|
|
87
87
|
nullable: true,
|
|
88
|
-
description:
|
|
88
|
+
description: "User ID. When empty, the current user is used. Admin only param",
|
|
89
89
|
})
|
|
90
90
|
id?: string | null;
|
|
91
91
|
|
|
92
|
-
@ApiProperty({ enum: ToggleAbleUserPropertyEnum, description:
|
|
92
|
+
@ApiProperty({ enum: ToggleAbleUserPropertyEnum, description: "The property to toggle" })
|
|
93
93
|
field: keyof ToggleableUserProperties;
|
|
94
94
|
}
|
|
95
95
|
|
package/tsconfig.json
CHANGED
package/.eslintrc.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
project: 'tsconfig.json',
|
|
5
|
-
tsconfigRootDir: __dirname,
|
|
6
|
-
sourceType: 'module',
|
|
7
|
-
},
|
|
8
|
-
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
9
|
-
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended', 'airbnb-base'],
|
|
10
|
-
root: true,
|
|
11
|
-
env: {
|
|
12
|
-
node: true,
|
|
13
|
-
},
|
|
14
|
-
ignorePatterns: ['.eslintrc.js'],
|
|
15
|
-
rules: {
|
|
16
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
17
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
18
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
19
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
20
|
-
indent: ['error', 4, { SwitchCase: 1, ignoredNodes: ['PropertyDefinition'] }],
|
|
21
|
-
'import/prefer-default-export': 'off',
|
|
22
|
-
'no-useless-constructor': 'off',
|
|
23
|
-
'no-empty-function': 'off',
|
|
24
|
-
'no-unused-vars': 'off',
|
|
25
|
-
'import/no-unresolved': 'off',
|
|
26
|
-
'import/extensions': 'off',
|
|
27
|
-
'class-methods-use-this': 'off',
|
|
28
|
-
'no-param-reassign': 'off',
|
|
29
|
-
'no-console': 'off',
|
|
30
|
-
'max-len': ['error', { code: 120 }],
|
|
31
|
-
'no-underscore-dangle': 'off',
|
|
32
|
-
'no-shadow': 'off',
|
|
33
|
-
'object-curly-newline': 'off',
|
|
34
|
-
'import/no-extraneous-dependencies': 'off',
|
|
35
|
-
'arrow-body-style': 'off',
|
|
36
|
-
|
|
37
|
-
// tering-serieuze-types specific
|
|
38
|
-
'max-classes-per-file': 'off',
|
|
39
|
-
},
|
|
40
|
-
};
|