@excali-boards/boards-api-client 1.0.30 → 1.1.1-dev.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/{classes → cjs/classes}/admin.d.ts +4 -13
- package/dist/{classes → cjs/classes}/admin.js +5 -5
- package/dist/{classes → cjs/classes}/boards.d.ts +17 -23
- package/dist/{classes → cjs/classes}/boards.js +1 -1
- package/dist/{classes → cjs/classes}/categories.d.ts +6 -10
- package/dist/{classes → cjs/classes}/categories.js +1 -1
- package/dist/{classes → cjs/classes}/groups.d.ts +12 -19
- package/dist/cjs/classes/invites.d.ts +82 -0
- package/dist/cjs/classes/invites.js +36 -0
- package/dist/cjs/classes/metrics.d.ts +28 -0
- package/dist/{classes/stats.js → cjs/classes/metrics.js} +7 -9
- package/dist/cjs/classes/permissions.d.ts +50 -0
- package/dist/cjs/classes/permissions.js +30 -0
- package/dist/cjs/classes/users.d.ts +26 -0
- package/dist/{classes → cjs/classes}/users.js +2 -10
- package/dist/{core → cjs/core}/manager.d.ts +6 -4
- package/dist/{core → cjs/core}/manager.js +8 -6
- package/dist/cjs/external/types.d.ts +28 -0
- package/dist/cjs/external/types.js +7 -0
- package/dist/cjs/external/vars.d.ts +92 -0
- package/dist/cjs/external/vars.js +45 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +5 -2
- package/dist/{index.js → cjs/index.js} +5 -2
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/classes/admin.d.ts +26 -0
- package/dist/esm/classes/admin.js +20 -0
- package/dist/esm/classes/auth.d.ts +26 -0
- package/dist/esm/classes/auth.js +14 -0
- package/dist/esm/classes/boards.d.ts +77 -0
- package/dist/esm/classes/boards.js +50 -0
- package/dist/esm/classes/categories.d.ts +56 -0
- package/dist/esm/classes/categories.js +44 -0
- package/dist/esm/classes/groups.d.ts +74 -0
- package/dist/esm/classes/groups.js +62 -0
- package/dist/esm/classes/invites.d.ts +82 -0
- package/dist/esm/classes/invites.js +32 -0
- package/dist/esm/classes/metrics.d.ts +28 -0
- package/dist/esm/classes/metrics.js +20 -0
- package/dist/esm/classes/permissions.d.ts +50 -0
- package/dist/esm/classes/permissions.js +26 -0
- package/dist/esm/classes/users.d.ts +26 -0
- package/dist/esm/classes/users.js +28 -0
- package/dist/esm/core/manager.d.ts +34 -0
- package/dist/esm/core/manager.js +67 -0
- package/dist/esm/core/utils.d.ts +4 -0
- package/dist/esm/core/utils.js +21 -0
- package/dist/esm/external/types.d.ts +28 -0
- package/dist/esm/external/types.js +4 -0
- package/dist/esm/external/vars.d.ts +92 -0
- package/dist/esm/external/vars.js +42 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/esm/types.d.ts +54 -0
- package/dist/esm/types.js +1 -0
- package/package.json +29 -10
- package/prisma/schema/boards.prisma +14 -45
- package/prisma/schema/permissions.prisma +73 -0
- package/prisma/schema/schema.prisma +22 -11
- package/prisma/schema/user.prisma +10 -9
- package/prisma.config.ts +6 -0
- package/tsconfig.esm.json +9 -0
- package/dist/classes/stats.d.ts +0 -52
- package/dist/classes/users.d.ts +0 -49
- package/dist/classes/utils.d.ts +0 -42
- package/dist/classes/utils.js +0 -33
- package/dist/external/types.d.ts +0 -12
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types.js +0 -2
- /package/dist/{classes → cjs/classes}/auth.d.ts +0 -0
- /package/dist/{classes → cjs/classes}/auth.js +0 -0
- /package/dist/{classes → cjs/classes}/groups.js +0 -0
- /package/dist/{core → cjs/core}/utils.d.ts +0 -0
- /package/dist/{core → cjs/core}/utils.js +0 -0
- /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/dist/{external → cjs}/types.js +0 -0
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { BoardPermissionType } from '../../prisma/generated/default';
|
|
2
1
|
import { BoardsManager } from '../core/manager';
|
|
2
|
+
import { GetUsersOutput } from './users';
|
|
3
3
|
export declare class APIAdmin {
|
|
4
4
|
private web;
|
|
5
5
|
constructor(web: BoardsManager);
|
|
6
|
+
getUsers({ auth }: AdminFunctionsInput['getUsers']): Promise<import("..").WebResponse<GetUsersOutput[]>>;
|
|
6
7
|
getActiveRooms({ auth }: AdminFunctionsInput['getActiveRooms']): Promise<import("..").WebResponse<GetRoomsOutput<number>[]>>;
|
|
7
|
-
updateUserPermissions({ auth, body }: AdminFunctionsInput['updateUserPermissions']): Promise<import("..").WebResponse<string>>;
|
|
8
8
|
}
|
|
9
9
|
export type AdminFunctionsInput = {
|
|
10
|
-
'
|
|
10
|
+
'getUsers': {
|
|
11
11
|
auth: string;
|
|
12
12
|
};
|
|
13
|
-
'
|
|
13
|
+
'getActiveRooms': {
|
|
14
14
|
auth: string;
|
|
15
|
-
body: UpdateUserPermissionsInput;
|
|
16
15
|
};
|
|
17
16
|
};
|
|
18
17
|
export type GetRoomsOutput<T> = {
|
|
@@ -25,11 +24,3 @@ export type GetRoomsOutput<T> = {
|
|
|
25
24
|
avatarUrl: string | null;
|
|
26
25
|
}[];
|
|
27
26
|
};
|
|
28
|
-
export type UpdateUserPermissionsInput = {
|
|
29
|
-
userId: string;
|
|
30
|
-
isBoardsAdmin?: boolean;
|
|
31
|
-
permissions?: {
|
|
32
|
-
boardId: string;
|
|
33
|
-
permissionType: BoardPermissionType;
|
|
34
|
-
}[];
|
|
35
|
-
};
|
|
@@ -8,16 +8,16 @@ class APIAdmin {
|
|
|
8
8
|
this.web = web;
|
|
9
9
|
}
|
|
10
10
|
// Methods.
|
|
11
|
-
async
|
|
11
|
+
async getUsers({ auth }) {
|
|
12
12
|
return await this.web.request({
|
|
13
13
|
method: 'GET', auth,
|
|
14
|
-
endpoint: this.web.qp('/
|
|
14
|
+
endpoint: this.web.qp('/users'),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
async
|
|
17
|
+
async getActiveRooms({ auth }) {
|
|
18
18
|
return await this.web.request({
|
|
19
|
-
method: '
|
|
20
|
-
endpoint: this.web.qp('/admin/
|
|
19
|
+
method: 'GET', auth,
|
|
20
|
+
endpoint: this.web.qp('/admin/rooms'),
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NameInput, SingleOutput } from '../external/types';
|
|
1
|
+
import { AccessLevel, NameInput, SingleOutput } from '../external/types';
|
|
3
2
|
import { BoardsManager } from '../core/manager';
|
|
4
3
|
import { GetRoomsOutput } from './admin';
|
|
5
4
|
export declare class APIBoards {
|
|
6
5
|
private web;
|
|
7
6
|
constructor(web: BoardsManager);
|
|
8
|
-
getBoards({ auth, categoryId, groupId }: BoardsFunctionsInput['getBoards']): Promise<import("..").WebResponse<
|
|
7
|
+
getBoards({ auth, categoryId, groupId }: BoardsFunctionsInput['getBoards']): Promise<import("..").WebResponse<GetBoardOutput[]>>;
|
|
9
8
|
getBoard({ auth, categoryId, groupId, boardId }: BoardsFunctionsInput['getBoard']): Promise<import("..").WebResponse<GetBoardOutput>>;
|
|
10
9
|
updateBoard({ auth, categoryId, groupId, boardId, body }: BoardsFunctionsInput['updateBoard']): Promise<import("..").WebResponse<string>>;
|
|
11
10
|
scheduleBoardDeletion({ auth, categoryId, groupId, boardId }: BoardsFunctionsInput['scheduleBoardDeletion']): Promise<import("..").WebResponse<string>>;
|
|
@@ -58,26 +57,21 @@ export type BoardsFunctionsInput = {
|
|
|
58
57
|
userId: string;
|
|
59
58
|
};
|
|
60
59
|
};
|
|
61
|
-
export type
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
export type GetBoardOutput = {
|
|
61
|
+
group: SingleOutput;
|
|
62
|
+
category: SingleOutput;
|
|
63
|
+
board: SingleOutput & {
|
|
64
|
+
dataUrl: string;
|
|
65
|
+
totalSizeBytes: number;
|
|
66
|
+
accessLevel: AccessLevel;
|
|
67
|
+
scheduledForDeletion: Date | null;
|
|
68
|
+
files: {
|
|
69
|
+
fileId: string;
|
|
70
|
+
mimeType: string;
|
|
71
|
+
createdAt: Date;
|
|
68
72
|
sizeBytes: number;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
fileId: string;
|
|
73
|
-
mimeType: string;
|
|
74
|
-
createdAt: Date;
|
|
75
|
-
fileUrl: string;
|
|
76
|
-
}[];
|
|
77
|
-
};
|
|
78
|
-
}[];
|
|
79
|
-
};
|
|
80
|
-
export type GetBoardOutput = GetBoardsOutput['boards'][number] & {
|
|
81
|
-
isAdmin: boolean;
|
|
73
|
+
fileUrl: string;
|
|
74
|
+
}[];
|
|
75
|
+
};
|
|
82
76
|
};
|
|
83
77
|
export type GetFileOutput = ReadableStream | Blob;
|
|
@@ -9,7 +9,7 @@ class APIBoards {
|
|
|
9
9
|
async getBoards({ auth, categoryId, groupId }) {
|
|
10
10
|
return await this.web.request({
|
|
11
11
|
method: 'GET', auth,
|
|
12
|
-
endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}
|
|
12
|
+
endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}`),
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
async getBoard({ auth, categoryId, groupId, boardId }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NameInput, SingleOutput } from '../external/types';
|
|
2
2
|
import { BoardsManager } from '../core/manager';
|
|
3
|
-
import {
|
|
3
|
+
import { GetBoardOutput } from './boards';
|
|
4
4
|
export declare class APICategories {
|
|
5
5
|
private web;
|
|
6
6
|
constructor(web: BoardsManager);
|
|
@@ -45,16 +45,12 @@ export type CategoriesFunctionsInput = {
|
|
|
45
45
|
categoryId: string;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
export type GetCategoriesOutput = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
group: SingleOutput;
|
|
53
|
-
})[];
|
|
54
|
-
};
|
|
48
|
+
export type GetCategoriesOutput = (SingleOutput & {
|
|
49
|
+
boards: number;
|
|
50
|
+
group: SingleOutput;
|
|
51
|
+
})[];
|
|
55
52
|
export type GetCategoryOutput = {
|
|
56
|
-
isAdmin: boolean;
|
|
57
53
|
group: SingleOutput;
|
|
58
54
|
category: SingleOutput;
|
|
59
|
-
boards: Omit<
|
|
55
|
+
boards: Omit<GetBoardOutput['board'], 'files'>[];
|
|
60
56
|
};
|
|
@@ -11,7 +11,7 @@ class APICategories {
|
|
|
11
11
|
async getCategories({ auth, groupId }) {
|
|
12
12
|
return await this.web.request({
|
|
13
13
|
method: 'GET', auth,
|
|
14
|
-
endpoint: this.web.qp(`/data/groups/${groupId}
|
|
14
|
+
endpoint: this.web.qp(`/data/groups/${groupId}`),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
async getCategory({ auth, groupId, categoryId }) {
|
|
@@ -52,30 +52,23 @@ export type GroupsFunctionsInput = {
|
|
|
52
52
|
groupId: string;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
export type GetGroupsOutput = {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
sizeBytes: number;
|
|
61
|
-
})[];
|
|
62
|
-
};
|
|
55
|
+
export type GetGroupsOutput = (SingleOutput & {
|
|
56
|
+
categories: number;
|
|
57
|
+
isDefault: boolean;
|
|
58
|
+
sizeBytes: number;
|
|
59
|
+
})[];
|
|
63
60
|
export type GetGroupOutput = {
|
|
64
|
-
isAdmin: boolean;
|
|
65
61
|
group: SingleOutput;
|
|
66
62
|
categories: (SingleOutput & {
|
|
67
63
|
boards: number;
|
|
68
|
-
|
|
64
|
+
totalSizeBytes: number;
|
|
69
65
|
})[];
|
|
70
66
|
};
|
|
71
|
-
export type GetAllSortedOutput = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
sizeBytes: number;
|
|
77
|
-
scheduledForDeletion: Date | null;
|
|
78
|
-
})[];
|
|
67
|
+
export type GetAllSortedOutput = (SingleOutput & {
|
|
68
|
+
categories: (SingleOutput & {
|
|
69
|
+
boards: (SingleOutput & {
|
|
70
|
+
totalSizeBytes: number;
|
|
71
|
+
scheduledForDeletion: Date | null;
|
|
79
72
|
})[];
|
|
80
73
|
})[];
|
|
81
|
-
};
|
|
74
|
+
})[];
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { BoardRole, CategoryRole, GroupRole } from '../external/vars';
|
|
2
|
+
import { ResourceType } from '../external/types';
|
|
3
|
+
import { BoardsManager } from '../core/manager';
|
|
4
|
+
export declare class APIInvites {
|
|
5
|
+
private web;
|
|
6
|
+
constructor(web: BoardsManager);
|
|
7
|
+
getInvites({ auth }: InvitesFunctionsInput['getInvites']): Promise<import("..").WebResponse<GetInvitesOutput>>;
|
|
8
|
+
createInvite({ auth, body }: InvitesFunctionsInput['createInvite']): Promise<import("..").WebResponse<CreateInviteOutput>>;
|
|
9
|
+
useInvite({ auth, code }: InvitesFunctionsInput['useInvite']): Promise<import("..").WebResponse<UseInviteOutput>>;
|
|
10
|
+
revokeInvite({ auth, code }: InvitesFunctionsInput['revokeInvite']): Promise<import("..").WebResponse<string>>;
|
|
11
|
+
}
|
|
12
|
+
export type InvitesFunctionsInput = {
|
|
13
|
+
'getInvites': {
|
|
14
|
+
auth: string;
|
|
15
|
+
};
|
|
16
|
+
'createInvite': {
|
|
17
|
+
auth: string;
|
|
18
|
+
body: CreateInviteInput;
|
|
19
|
+
};
|
|
20
|
+
'useInvite': {
|
|
21
|
+
auth: string;
|
|
22
|
+
code: string;
|
|
23
|
+
};
|
|
24
|
+
'revokeInvite': {
|
|
25
|
+
auth: string;
|
|
26
|
+
code: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type CreateInviteInput = {
|
|
30
|
+
groupIds?: string[];
|
|
31
|
+
categoryIds?: string[];
|
|
32
|
+
boardIds?: string[];
|
|
33
|
+
groupRole?: GroupRole;
|
|
34
|
+
categoryRole?: CategoryRole;
|
|
35
|
+
boardRole?: BoardRole;
|
|
36
|
+
expiresIn?: number;
|
|
37
|
+
maxUses?: number;
|
|
38
|
+
};
|
|
39
|
+
export type CreateInviteOutput = {
|
|
40
|
+
code: string;
|
|
41
|
+
expiresAt: string;
|
|
42
|
+
maxUses: number;
|
|
43
|
+
};
|
|
44
|
+
export type GetInvitesOutput = {
|
|
45
|
+
dbId: string;
|
|
46
|
+
code: string;
|
|
47
|
+
createdBy: string;
|
|
48
|
+
expiresAt: string | null;
|
|
49
|
+
maxUses: number | null;
|
|
50
|
+
currentUses: number;
|
|
51
|
+
groupIds: string[];
|
|
52
|
+
categoryIds: string[];
|
|
53
|
+
boardIds: string[];
|
|
54
|
+
groupRole: GroupRole | null;
|
|
55
|
+
categoryRole: CategoryRole | null;
|
|
56
|
+
boardRole: BoardRole | null;
|
|
57
|
+
createdAt: string;
|
|
58
|
+
}[];
|
|
59
|
+
export type GrantedRole = {
|
|
60
|
+
type: ResourceType;
|
|
61
|
+
resourceId: string;
|
|
62
|
+
role: BoardRole | CategoryRole | GroupRole;
|
|
63
|
+
};
|
|
64
|
+
export type UseInviteOutput = {
|
|
65
|
+
granted: GrantedRole[];
|
|
66
|
+
details: {
|
|
67
|
+
groups: {
|
|
68
|
+
groupId: string;
|
|
69
|
+
name: string;
|
|
70
|
+
}[];
|
|
71
|
+
categories: {
|
|
72
|
+
categoryId: string;
|
|
73
|
+
name: string;
|
|
74
|
+
groupId: string;
|
|
75
|
+
}[];
|
|
76
|
+
boards: {
|
|
77
|
+
boardId: string;
|
|
78
|
+
name: string;
|
|
79
|
+
categoryId: string;
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APIInvites = void 0;
|
|
4
|
+
// Data.
|
|
5
|
+
class APIInvites {
|
|
6
|
+
web;
|
|
7
|
+
constructor(web) {
|
|
8
|
+
this.web = web;
|
|
9
|
+
}
|
|
10
|
+
// Methods.
|
|
11
|
+
async getInvites({ auth }) {
|
|
12
|
+
return await this.web.request({
|
|
13
|
+
method: 'GET', auth,
|
|
14
|
+
endpoint: this.web.qp('/invites'),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async createInvite({ auth, body }) {
|
|
18
|
+
return await this.web.request({
|
|
19
|
+
method: 'POST', auth, body,
|
|
20
|
+
endpoint: this.web.qp('/invites'),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async useInvite({ auth, code }) {
|
|
24
|
+
return await this.web.request({
|
|
25
|
+
method: 'POST', auth,
|
|
26
|
+
endpoint: this.web.qp(`/invites/${code}`),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async revokeInvite({ auth, code }) {
|
|
30
|
+
return await this.web.request({
|
|
31
|
+
method: 'DELETE', auth,
|
|
32
|
+
endpoint: this.web.qp(`/invites/${code}`),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.APIInvites = APIInvites;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BoardsManager } from '../core/manager';
|
|
2
|
+
export declare class APIMetrics {
|
|
3
|
+
private web;
|
|
4
|
+
constructor(web: BoardsManager);
|
|
5
|
+
getMetrics({ auth }: MetricsFunctionsInput['getMetrics']): Promise<import("..").WebResponse<string>>;
|
|
6
|
+
getStatus({ auth }: MetricsFunctionsInput['getStatus']): Promise<import("..").WebResponse<SystemStatus>>;
|
|
7
|
+
}
|
|
8
|
+
export type MetricsFunctionsInput = {
|
|
9
|
+
'getMetrics': {
|
|
10
|
+
auth: string;
|
|
11
|
+
};
|
|
12
|
+
'getStatus': {
|
|
13
|
+
auth: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type SystemStatus = {
|
|
17
|
+
cpuUsage: number;
|
|
18
|
+
memoryUsage: string;
|
|
19
|
+
activeRooms: number;
|
|
20
|
+
socketConnections: number;
|
|
21
|
+
queuedFiles: number;
|
|
22
|
+
cacheSize: number;
|
|
23
|
+
totalUsers: number;
|
|
24
|
+
totalInvites: number;
|
|
25
|
+
totalBoards: number;
|
|
26
|
+
totalCategories: number;
|
|
27
|
+
totalGroups: number;
|
|
28
|
+
};
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.APIMetrics = void 0;
|
|
4
4
|
// Data.
|
|
5
|
-
class
|
|
5
|
+
class APIMetrics {
|
|
6
6
|
web;
|
|
7
7
|
constructor(web) {
|
|
8
8
|
this.web = web;
|
|
9
9
|
}
|
|
10
10
|
// Methods.
|
|
11
|
-
async
|
|
11
|
+
async getMetrics({ auth }) {
|
|
12
12
|
return await this.web.request({
|
|
13
13
|
method: 'GET', auth,
|
|
14
|
-
endpoint: this.web.qp('/
|
|
14
|
+
endpoint: this.web.qp('/metrics'),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
async
|
|
17
|
+
async getStatus({ auth }) {
|
|
18
18
|
return await this.web.request({
|
|
19
19
|
method: 'GET', auth,
|
|
20
|
-
endpoint: this.web.qp('/
|
|
21
|
-
userId,
|
|
22
|
-
}),
|
|
20
|
+
endpoint: this.web.qp('/metrics/status'),
|
|
23
21
|
});
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
|
-
exports.
|
|
24
|
+
exports.APIMetrics = APIMetrics;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BoardRole, CategoryRole, GroupRole } from '../external/vars';
|
|
2
|
+
import { ResourceType } from '../external/types';
|
|
3
|
+
import { BoardsManager } from '../core/manager';
|
|
4
|
+
export declare class APIPermissions {
|
|
5
|
+
private web;
|
|
6
|
+
constructor(web: BoardsManager);
|
|
7
|
+
viewPermissions({ auth, query }: PermissionsFunctionsInput['viewPermissions']): Promise<import("..").WebResponse<ViewPermissionsOutput>>;
|
|
8
|
+
grantPermissions({ auth, body }: PermissionsFunctionsInput['grantPermissions']): Promise<import("..").WebResponse<string>>;
|
|
9
|
+
revokePermissions({ auth, body }: PermissionsFunctionsInput['revokePermissions']): Promise<import("..").WebResponse<string>>;
|
|
10
|
+
}
|
|
11
|
+
export type PermissionsFunctionsInput = {
|
|
12
|
+
'viewPermissions': {
|
|
13
|
+
auth: string;
|
|
14
|
+
query: ViewPermissionsQuery;
|
|
15
|
+
};
|
|
16
|
+
'grantPermissions': {
|
|
17
|
+
auth: string;
|
|
18
|
+
body: GrantPermissionsInput;
|
|
19
|
+
};
|
|
20
|
+
'revokePermissions': {
|
|
21
|
+
auth: string;
|
|
22
|
+
body: RevokePermissionsInput;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type ViewPermissionsQuery = {
|
|
26
|
+
type: ResourceType;
|
|
27
|
+
groupId?: string;
|
|
28
|
+
categoryId?: string;
|
|
29
|
+
boardId?: string;
|
|
30
|
+
};
|
|
31
|
+
export type ViewPermissionsOutput = {
|
|
32
|
+
userId: string;
|
|
33
|
+
email: string;
|
|
34
|
+
displayName: string;
|
|
35
|
+
avatarUrl: string | null;
|
|
36
|
+
}[];
|
|
37
|
+
export type GrantPermissionsInput = {
|
|
38
|
+
userId: string;
|
|
39
|
+
groupIds?: string[];
|
|
40
|
+
categoryIds?: string[];
|
|
41
|
+
boardIds?: string[];
|
|
42
|
+
groupRole?: GroupRole;
|
|
43
|
+
categoryRole?: CategoryRole;
|
|
44
|
+
boardRole?: BoardRole;
|
|
45
|
+
};
|
|
46
|
+
export type RevokePermissionsInput = {
|
|
47
|
+
userId: string;
|
|
48
|
+
resourceType: ResourceType;
|
|
49
|
+
resourceId: string;
|
|
50
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APIPermissions = void 0;
|
|
4
|
+
// Data.
|
|
5
|
+
class APIPermissions {
|
|
6
|
+
web;
|
|
7
|
+
constructor(web) {
|
|
8
|
+
this.web = web;
|
|
9
|
+
}
|
|
10
|
+
// Methods.
|
|
11
|
+
async viewPermissions({ auth, query }) {
|
|
12
|
+
return await this.web.request({
|
|
13
|
+
method: 'GET', auth,
|
|
14
|
+
endpoint: this.web.qp('/permissions/view', query),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async grantPermissions({ auth, body }) {
|
|
18
|
+
return await this.web.request({
|
|
19
|
+
method: 'POST', auth, body,
|
|
20
|
+
endpoint: this.web.qp('/permissions/grant'),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async revokePermissions({ auth, body }) {
|
|
24
|
+
return await this.web.request({
|
|
25
|
+
method: 'POST', auth, body,
|
|
26
|
+
endpoint: this.web.qp('/permissions/revoke'),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.APIPermissions = APIPermissions;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Platforms } from '../../prisma/generated/default';
|
|
2
|
+
import { DBUserPartialType } from '../external/vars';
|
|
3
|
+
import { BoardsManager } from '../core/manager';
|
|
4
|
+
export declare class APIUsers {
|
|
5
|
+
private web;
|
|
6
|
+
constructor(web: BoardsManager);
|
|
7
|
+
getCurrentUser({ auth }: UsersFunctionsInput['getCurrentUser']): Promise<import("..").WebResponse<GetUsersOutput>>;
|
|
8
|
+
changeMainPlatform({ auth, newMainPlatform }: UsersFunctionsInput['changeMainPlatform']): Promise<import("..").WebResponse<string>>;
|
|
9
|
+
changeMainGroup({ auth, newMainGroupId }: UsersFunctionsInput['changeMainGroup']): Promise<import("..").WebResponse<string>>;
|
|
10
|
+
}
|
|
11
|
+
export type UsersFunctionsInput = {
|
|
12
|
+
'getCurrentUser': {
|
|
13
|
+
auth: string;
|
|
14
|
+
};
|
|
15
|
+
'changeMainPlatform': {
|
|
16
|
+
auth: string;
|
|
17
|
+
newMainPlatform: Platforms;
|
|
18
|
+
};
|
|
19
|
+
'changeMainGroup': {
|
|
20
|
+
auth: string;
|
|
21
|
+
newMainGroupId: string | null;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type GetUsersOutput = DBUserPartialType & {
|
|
25
|
+
isDev: boolean;
|
|
26
|
+
};
|
|
@@ -8,18 +8,10 @@ class APIUsers {
|
|
|
8
8
|
this.web = web;
|
|
9
9
|
}
|
|
10
10
|
// Methods.
|
|
11
|
-
async
|
|
11
|
+
async getCurrentUser({ auth }) {
|
|
12
12
|
return await this.web.request({
|
|
13
13
|
method: 'GET', auth,
|
|
14
|
-
endpoint: this.web.qp('/users'),
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
async getCurrentUser({ auth, full }) {
|
|
18
|
-
return await this.web.request({
|
|
19
|
-
method: 'GET', auth,
|
|
20
|
-
endpoint: this.web.qp('/users/current', {
|
|
21
|
-
full,
|
|
22
|
-
}),
|
|
14
|
+
endpoint: this.web.qp('/users/current'),
|
|
23
15
|
});
|
|
24
16
|
}
|
|
25
17
|
async changeMainPlatform({ auth, newMainPlatform }) {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { PaginatedWebResponse, RequestMethod, WebResponse } from '../types';
|
|
2
2
|
import { AxiosResponse, ResponseType } from 'axios';
|
|
3
|
+
import { APIPermissions } from '../classes/permissions';
|
|
3
4
|
import { APICategories } from '../classes/categories';
|
|
5
|
+
import { APIMetrics } from '../classes/metrics';
|
|
6
|
+
import { APIInvites } from '../classes/invites';
|
|
4
7
|
import { APIGroups } from '../classes/groups';
|
|
5
8
|
import { APIBoards } from '../classes/boards';
|
|
6
|
-
import { APIUtils } from '../classes/utils';
|
|
7
9
|
import { APIUsers } from '../classes/users';
|
|
8
|
-
import { APIStats } from '../classes/stats';
|
|
9
10
|
import { APIAdmin } from '../classes/admin';
|
|
10
11
|
import { APIAuth } from '../classes/auth';
|
|
11
12
|
export declare class BoardsManager {
|
|
12
13
|
url: string;
|
|
14
|
+
readonly permissions: APIPermissions;
|
|
13
15
|
readonly categories: APICategories;
|
|
16
|
+
readonly invites: APIInvites;
|
|
17
|
+
readonly metrics: APIMetrics;
|
|
14
18
|
readonly groups: APIGroups;
|
|
15
19
|
readonly boards: APIBoards;
|
|
16
|
-
readonly stats: APIStats;
|
|
17
20
|
readonly admin: APIAdmin;
|
|
18
|
-
readonly utils: APIUtils;
|
|
19
21
|
readonly users: APIUsers;
|
|
20
22
|
readonly auth: APIAuth;
|
|
21
23
|
constructor(url: string);
|
|
@@ -5,23 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BoardsManager = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const permissions_1 = require("../classes/permissions");
|
|
8
9
|
const categories_1 = require("../classes/categories");
|
|
10
|
+
const metrics_1 = require("../classes/metrics");
|
|
11
|
+
const invites_1 = require("../classes/invites");
|
|
9
12
|
const groups_1 = require("../classes/groups");
|
|
10
13
|
const boards_1 = require("../classes/boards");
|
|
11
|
-
const utils_1 = require("../classes/utils");
|
|
12
14
|
const users_1 = require("../classes/users");
|
|
13
|
-
const stats_1 = require("../classes/stats");
|
|
14
15
|
const admin_1 = require("../classes/admin");
|
|
15
16
|
const auth_1 = require("../classes/auth");
|
|
16
|
-
const
|
|
17
|
+
const utils_1 = require("./utils");
|
|
17
18
|
class BoardsManager {
|
|
18
19
|
url;
|
|
20
|
+
permissions = new permissions_1.APIPermissions(this);
|
|
19
21
|
categories = new categories_1.APICategories(this);
|
|
22
|
+
invites = new invites_1.APIInvites(this);
|
|
23
|
+
metrics = new metrics_1.APIMetrics(this);
|
|
20
24
|
groups = new groups_1.APIGroups(this);
|
|
21
25
|
boards = new boards_1.APIBoards(this);
|
|
22
|
-
stats = new stats_1.APIStats(this);
|
|
23
26
|
admin = new admin_1.APIAdmin(this);
|
|
24
|
-
utils = new utils_1.APIUtils(this);
|
|
25
27
|
users = new users_1.APIUsers(this);
|
|
26
28
|
auth = new auth_1.APIAuth(this);
|
|
27
29
|
constructor(url) {
|
|
@@ -29,7 +31,7 @@ class BoardsManager {
|
|
|
29
31
|
}
|
|
30
32
|
async request(data) {
|
|
31
33
|
try {
|
|
32
|
-
axios_1.default.interceptors.response.use(
|
|
34
|
+
axios_1.default.interceptors.response.use(utils_1.transformDates);
|
|
33
35
|
const res = await (0, axios_1.default)(this.url + data.endpoint, {
|
|
34
36
|
method: data.method,
|
|
35
37
|
data: data.body ? JSON.stringify(data.body) : undefined,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BoardRole, CategoryRole, GroupRole } from './vars';
|
|
2
|
+
import { TSPrisma } from '../../prisma/generated/default';
|
|
3
|
+
export type User = TSPrisma.TSPrismaModelsFull['User'];
|
|
4
|
+
export type Group = TSPrisma.TSPrismaModelsFull['Group'];
|
|
5
|
+
export type Category = TSPrisma.TSPrismaModelsFull['Category'];
|
|
6
|
+
export type Board = TSPrisma.TSPrismaModelsFull['Board'];
|
|
7
|
+
export type File = TSPrisma.TSPrismaModelsFull['File'];
|
|
8
|
+
export type LoginMethod = TSPrisma.TSPrismaModelsFull['LoginMethod'];
|
|
9
|
+
export type GroupPermission = TSPrisma.TSPrismaModelsFull['GroupPermission'];
|
|
10
|
+
export type CategoryPermission = TSPrisma.TSPrismaModelsFull['CategoryPermission'];
|
|
11
|
+
export type BoardPermission = TSPrisma.TSPrismaModelsFull['BoardPermission'];
|
|
12
|
+
export type Invite = TSPrisma.TSPrismaModelsFull['Invite'];
|
|
13
|
+
export type UserRole = BoardRole | CategoryRole | GroupRole | GlobalRole;
|
|
14
|
+
export declare enum GlobalRole {
|
|
15
|
+
Developer = "Developer"
|
|
16
|
+
}
|
|
17
|
+
export type AccessLevel = 'read' | 'write' | 'manage' | 'admin';
|
|
18
|
+
export type ResourceType = 'group' | 'category' | 'board';
|
|
19
|
+
export type GlobalResourceType = ResourceType | 'global';
|
|
20
|
+
export type SingleOutput = {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
index: number;
|
|
24
|
+
accessLevel: AccessLevel;
|
|
25
|
+
};
|
|
26
|
+
export type NameInput = {
|
|
27
|
+
name: string;
|
|
28
|
+
};
|