tering-serieuze-types 1.20.0 → 1.21.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 +33 -0
- package/package.json +1 -1
- package/src/session.ts +28 -0
- package/src/user.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
29
29
|
var src_exports = {};
|
|
30
30
|
__export(src_exports, {
|
|
31
31
|
AddUserDto: () => AddUserDto,
|
|
32
|
+
ApiToken: () => ApiToken,
|
|
32
33
|
Application: () => Application,
|
|
33
34
|
AuthenticationOptionsDto: () => AuthenticationOptionsDto,
|
|
34
35
|
BigBrotherItem: () => BigBrotherItem,
|
|
@@ -124,8 +125,36 @@ var import_swagger3 = require("@nestjs/swagger");
|
|
|
124
125
|
var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
125
126
|
TokenType2[TokenType2["Refresh"] = 0] = "Refresh";
|
|
126
127
|
TokenType2[TokenType2["Access"] = 1] = "Access";
|
|
128
|
+
TokenType2[TokenType2["Api"] = 2] = "Api";
|
|
127
129
|
return TokenType2;
|
|
128
130
|
})(TokenType || {});
|
|
131
|
+
var ApiToken = class {
|
|
132
|
+
};
|
|
133
|
+
__decorateClass([
|
|
134
|
+
(0, import_swagger3.ApiProperty)({
|
|
135
|
+
type: String,
|
|
136
|
+
example: "fc532e57-66d6-4e92-9eb1-b08578d24b0b",
|
|
137
|
+
description: "Token ID, a random UUID"
|
|
138
|
+
})
|
|
139
|
+
], ApiToken.prototype, "id", 2);
|
|
140
|
+
__decorateClass([
|
|
141
|
+
(0, import_swagger3.ApiProperty)({ type: String, example: "Token name" })
|
|
142
|
+
], ApiToken.prototype, "name", 2);
|
|
143
|
+
__decorateClass([
|
|
144
|
+
(0, import_swagger3.ApiProperty)({
|
|
145
|
+
type: Date,
|
|
146
|
+
example: "2021-01-01T00:00:00.000Z",
|
|
147
|
+
description: "Timestamp of the creation of the api token"
|
|
148
|
+
})
|
|
149
|
+
], ApiToken.prototype, "created", 2);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
(0, import_swagger3.ApiProperty)({
|
|
152
|
+
type: Date,
|
|
153
|
+
example: "2021-01-01T00:00:00.000Z",
|
|
154
|
+
description: "Timestamp of the last time the api token was used",
|
|
155
|
+
nullable: true
|
|
156
|
+
})
|
|
157
|
+
], ApiToken.prototype, "lastUsed", 2);
|
|
129
158
|
var Session = class {
|
|
130
159
|
};
|
|
131
160
|
__decorateClass([
|
|
@@ -191,6 +220,9 @@ __decorateClass([
|
|
|
191
220
|
__decorateClass([
|
|
192
221
|
(0, import_swagger4.ApiProperty)({ type: () => [Session] })
|
|
193
222
|
], User.prototype, "sessions", 2);
|
|
223
|
+
__decorateClass([
|
|
224
|
+
(0, import_swagger4.ApiProperty)({ type: () => [ApiToken] })
|
|
225
|
+
], User.prototype, "apiTokens", 2);
|
|
194
226
|
var ToggleAbleUserPropertyEnum = /* @__PURE__ */ ((ToggleAbleUserPropertyEnum2) => {
|
|
195
227
|
ToggleAbleUserPropertyEnum2["isAdmin"] = "isAdmin";
|
|
196
228
|
ToggleAbleUserPropertyEnum2["isBanned"] = "isBanned";
|
|
@@ -350,6 +382,7 @@ var P2000Payload = class {
|
|
|
350
382
|
// Annotate the CommonJS export names for ESM import in node:
|
|
351
383
|
0 && (module.exports = {
|
|
352
384
|
AddUserDto,
|
|
385
|
+
ApiToken,
|
|
353
386
|
Application,
|
|
354
387
|
AuthenticationOptionsDto,
|
|
355
388
|
BigBrotherItem,
|
package/package.json
CHANGED
package/src/session.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ApiProperty } from '@nestjs/swagger';
|
|
|
3
3
|
export enum TokenType {
|
|
4
4
|
Refresh,
|
|
5
5
|
Access,
|
|
6
|
+
Api,
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export type TokenContent = {
|
|
@@ -14,6 +15,33 @@ export type TokenContent = {
|
|
|
14
15
|
exp: number;
|
|
15
16
|
};
|
|
16
17
|
|
|
18
|
+
export class ApiToken {
|
|
19
|
+
@ApiProperty({
|
|
20
|
+
type: String,
|
|
21
|
+
example: 'fc532e57-66d6-4e92-9eb1-b08578d24b0b',
|
|
22
|
+
description: 'Token ID, a random UUID',
|
|
23
|
+
})
|
|
24
|
+
id: string;
|
|
25
|
+
|
|
26
|
+
@ApiProperty({ type: String, example: 'Token name' })
|
|
27
|
+
name: string;
|
|
28
|
+
|
|
29
|
+
@ApiProperty({
|
|
30
|
+
type: Date,
|
|
31
|
+
example: '2021-01-01T00:00:00.000Z',
|
|
32
|
+
description: 'Timestamp of the creation of the api token',
|
|
33
|
+
})
|
|
34
|
+
created: Date;
|
|
35
|
+
|
|
36
|
+
@ApiProperty({
|
|
37
|
+
type: Date,
|
|
38
|
+
example: '2021-01-01T00:00:00.000Z',
|
|
39
|
+
description: 'Timestamp of the last time the api token was used',
|
|
40
|
+
nullable: true,
|
|
41
|
+
})
|
|
42
|
+
lastUsed?: Date;
|
|
43
|
+
}
|
|
44
|
+
|
|
17
45
|
export class Session {
|
|
18
46
|
@ApiProperty({ type: String, example: '1234567890abcdef', description: 'Session ID' })
|
|
19
47
|
id: string;
|
package/src/user.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IsEmail } from 'class-validator';
|
|
|
3
3
|
import { Button } from './button';
|
|
4
4
|
import { WindowState } from './application';
|
|
5
5
|
import { DbAuthenticator } from './authenticator';
|
|
6
|
-
import { Session } from './session';
|
|
6
|
+
import { ApiToken, Session } from './session';
|
|
7
7
|
|
|
8
8
|
export class User {
|
|
9
9
|
@ApiProperty({ type: String })
|
|
@@ -42,6 +42,9 @@ export class User {
|
|
|
42
42
|
|
|
43
43
|
@ApiProperty({ type: () => [Session] })
|
|
44
44
|
sessions: Session[];
|
|
45
|
+
|
|
46
|
+
@ApiProperty({ type: () => [ApiToken] })
|
|
47
|
+
apiTokens: ApiToken[];
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
export enum ToggleAbleUserPropertyEnum {
|