@excali-boards/boards-api-client 1.1.51 → 1.1.52
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/admin.d.ts +6 -3
- package/dist/classes/admin.js +1 -5
- package/dist/classes/analytics.d.ts +5 -5
- package/dist/classes/analytics.js +1 -5
- package/dist/classes/auth.d.ts +48 -0
- package/dist/classes/auth.js +12 -0
- package/dist/classes/boards.d.ts +9 -9
- package/dist/classes/boards.js +1 -5
- package/dist/classes/calendar.d.ts +6 -6
- package/dist/classes/calendar.js +1 -5
- package/dist/classes/categories.d.ts +10 -8
- package/dist/classes/categories.js +1 -5
- package/dist/classes/files.d.ts +3 -3
- package/dist/classes/files.js +1 -5
- package/dist/classes/flashcards.d.ts +10 -10
- package/dist/classes/flashcards.js +1 -5
- package/dist/classes/groups.d.ts +15 -11
- package/dist/classes/groups.js +1 -5
- package/dist/classes/invites.d.ts +7 -7
- package/dist/classes/invites.js +1 -5
- package/dist/classes/metrics.d.ts +2 -2
- package/dist/classes/metrics.js +1 -5
- package/dist/classes/permissions.d.ts +4 -4
- package/dist/classes/permissions.js +1 -5
- package/dist/classes/sessions.d.ts +6 -5
- package/dist/classes/sessions.js +1 -5
- package/dist/classes/users.d.ts +3 -3
- package/dist/classes/users.js +1 -5
- package/dist/classes/utils.d.ts +1 -1
- package/dist/classes/utils.js +1 -5
- package/dist/core/manager.d.ts +3 -1
- package/dist/core/manager.js +35 -40
- package/dist/core/utils.js +4 -10
- package/dist/external/types.d.ts +11 -0
- package/dist/external/types.js +2 -5
- package/dist/external/vars.js +15 -18
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -35
- package/dist/src/classes/admin.d.ts +23 -0
- package/dist/src/classes/admin.js +20 -0
- package/dist/src/classes/analytics.d.ts +62 -0
- package/dist/src/classes/analytics.js +38 -0
- package/dist/src/classes/auth.d.ts +48 -0
- package/dist/src/classes/auth.js +12 -0
- package/dist/src/classes/boards.d.ts +99 -0
- package/dist/src/classes/boards.js +62 -0
- package/dist/src/classes/calendar.d.ts +84 -0
- package/dist/src/classes/calendar.js +45 -0
- package/dist/src/classes/categories.d.ts +75 -0
- package/dist/src/classes/categories.js +50 -0
- package/dist/src/classes/files.d.ts +45 -0
- package/dist/src/classes/files.js +31 -0
- package/dist/src/classes/flashcards.d.ts +120 -0
- package/dist/src/classes/flashcards.js +68 -0
- package/dist/src/classes/groups.d.ts +80 -0
- package/dist/src/classes/groups.js +62 -0
- package/dist/src/classes/invites.d.ts +116 -0
- package/dist/src/classes/invites.js +50 -0
- package/dist/src/classes/metrics.d.ts +31 -0
- package/dist/src/classes/metrics.js +20 -0
- package/dist/src/classes/permissions.d.ts +48 -0
- package/dist/src/classes/permissions.js +32 -0
- package/dist/src/classes/sessions.d.ts +61 -0
- package/dist/src/classes/sessions.js +38 -0
- package/dist/src/classes/users.d.ts +37 -0
- package/dist/src/classes/users.js +26 -0
- package/dist/src/classes/utils.d.ts +19 -0
- package/dist/src/classes/utils.js +16 -0
- package/dist/src/core/manager.d.ts +44 -0
- package/dist/src/core/manager.js +92 -0
- package/dist/src/core/utils.d.ts +9 -0
- package/dist/src/core/utils.js +52 -0
- package/dist/src/external/types.d.ts +87 -0
- package/dist/src/external/types.js +4 -0
- package/dist/src/external/vars.d.ts +99 -0
- package/dist/src/external/vars.js +65 -0
- package/dist/src/index.d.ts +20 -0
- package/dist/src/index.js +20 -0
- package/dist/src/types.d.ts +61 -0
- package/dist/src/types.js +1 -0
- package/dist/types.js +1 -2
- package/package.json +2 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/core/manager.js
CHANGED
|
@@ -1,47 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const files_1 = require("../classes/files");
|
|
20
|
-
const admin_1 = require("../classes/admin");
|
|
21
|
-
const axios_1 = __importDefault(require("axios"));
|
|
22
|
-
const utils_2 = require("./utils");
|
|
23
|
-
class BoardsManager {
|
|
1
|
+
import { APIPermissions } from '../classes/permissions';
|
|
2
|
+
import { APIFlashcards } from '../classes/flashcards';
|
|
3
|
+
import { APICategories } from '../classes/categories';
|
|
4
|
+
import { APIAnalytics } from '../classes/analytics';
|
|
5
|
+
import { APISessions } from '../classes/sessions';
|
|
6
|
+
import { APICalendar } from '../classes/calendar';
|
|
7
|
+
import { APIMetrics } from '../classes/metrics';
|
|
8
|
+
import { APIInvites } from '../classes/invites';
|
|
9
|
+
import { APIGroups } from '../classes/groups';
|
|
10
|
+
import { APIBoards } from '../classes/boards';
|
|
11
|
+
import { APIUtils } from '../classes/utils';
|
|
12
|
+
import { APIUsers } from '../classes/users';
|
|
13
|
+
import { APIFiles } from '../classes/files';
|
|
14
|
+
import { APIAdmin } from '../classes/admin';
|
|
15
|
+
import { APIAuth } from '../classes/auth';
|
|
16
|
+
import axios from 'axios';
|
|
17
|
+
import { transformDates } from './utils';
|
|
18
|
+
export class BoardsManager {
|
|
24
19
|
url;
|
|
25
|
-
permissions = new
|
|
26
|
-
categories = new
|
|
27
|
-
flashcards = new
|
|
28
|
-
analytics = new
|
|
29
|
-
calendar = new
|
|
30
|
-
sessions = new
|
|
31
|
-
invites = new
|
|
32
|
-
metrics = new
|
|
33
|
-
groups = new
|
|
34
|
-
boards = new
|
|
35
|
-
admin = new
|
|
36
|
-
users = new
|
|
37
|
-
utils = new
|
|
38
|
-
files = new
|
|
20
|
+
permissions = new APIPermissions(this);
|
|
21
|
+
categories = new APICategories(this);
|
|
22
|
+
flashcards = new APIFlashcards(this);
|
|
23
|
+
analytics = new APIAnalytics(this);
|
|
24
|
+
calendar = new APICalendar(this);
|
|
25
|
+
sessions = new APISessions(this);
|
|
26
|
+
invites = new APIInvites(this);
|
|
27
|
+
metrics = new APIMetrics(this);
|
|
28
|
+
groups = new APIGroups(this);
|
|
29
|
+
boards = new APIBoards(this);
|
|
30
|
+
admin = new APIAdmin(this);
|
|
31
|
+
users = new APIUsers(this);
|
|
32
|
+
utils = new APIUtils(this);
|
|
33
|
+
files = new APIFiles(this);
|
|
34
|
+
auth = new APIAuth(this);
|
|
39
35
|
constructor(url) {
|
|
40
36
|
this.url = url;
|
|
41
37
|
}
|
|
42
38
|
async request(data) {
|
|
43
39
|
try {
|
|
44
|
-
|
|
40
|
+
axios.interceptors.response.use(transformDates);
|
|
45
41
|
let requestData;
|
|
46
42
|
let contentType;
|
|
47
43
|
if (data.body instanceof FormData) {
|
|
@@ -56,7 +52,7 @@ class BoardsManager {
|
|
|
56
52
|
requestData = undefined;
|
|
57
53
|
contentType = undefined;
|
|
58
54
|
}
|
|
59
|
-
const res = await (
|
|
55
|
+
const res = await axios(this.url + data.endpoint, {
|
|
60
56
|
method: data.method,
|
|
61
57
|
data: requestData,
|
|
62
58
|
headers: {
|
|
@@ -94,4 +90,3 @@ class BoardsManager {
|
|
|
94
90
|
return (obj && typeof obj === 'object' && 'status' in obj);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
|
-
exports.BoardsManager = BoardsManager;
|
package/dist/core/utils.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDateStringRegex = isDateStringRegex;
|
|
4
|
-
exports.recursiveDateConversion = recursiveDateConversion;
|
|
5
|
-
exports.transformDates = transformDates;
|
|
6
|
-
exports.getAll = getAll;
|
|
7
|
-
function isDateStringRegex(value) {
|
|
1
|
+
export function isDateStringRegex(value) {
|
|
8
2
|
const isoPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/;
|
|
9
3
|
return typeof value === 'string' && isoPattern.test(value);
|
|
10
4
|
}
|
|
11
|
-
function recursiveDateConversion(data) {
|
|
5
|
+
export function recursiveDateConversion(data) {
|
|
12
6
|
if (data instanceof Date)
|
|
13
7
|
return new Date(data);
|
|
14
8
|
if (Array.isArray(data))
|
|
@@ -20,12 +14,12 @@ function recursiveDateConversion(data) {
|
|
|
20
14
|
}
|
|
21
15
|
return isDateStringRegex(data) ? new Date(data) : data;
|
|
22
16
|
}
|
|
23
|
-
function transformDates(response) {
|
|
17
|
+
export function transformDates(response) {
|
|
24
18
|
if (response.data)
|
|
25
19
|
response.data = recursiveDateConversion(response.data);
|
|
26
20
|
return response;
|
|
27
21
|
}
|
|
28
|
-
async function getAll(fetcher, options) {
|
|
22
|
+
export async function getAll(fetcher, options) {
|
|
29
23
|
const limit = options?.limit ?? 50;
|
|
30
24
|
const maxItems = options?.maxItems ?? Infinity;
|
|
31
25
|
const allItems = [];
|
package/dist/external/types.d.ts
CHANGED
|
@@ -68,6 +68,17 @@ export type AllRooms = {
|
|
|
68
68
|
type: BoardType;
|
|
69
69
|
collaborators: CollabUser[];
|
|
70
70
|
}[];
|
|
71
|
+
export type RecentlyActiveRoom = {
|
|
72
|
+
boardId: string;
|
|
73
|
+
elements: number;
|
|
74
|
+
type: BoardType;
|
|
75
|
+
lastCollaborators: CollabUser[];
|
|
76
|
+
lastActiveAt: number;
|
|
77
|
+
};
|
|
78
|
+
export type GetActiveRoomsResponse = {
|
|
79
|
+
rooms: AllRooms;
|
|
80
|
+
recentlyActiveRooms: RecentlyActiveRoom[];
|
|
81
|
+
};
|
|
71
82
|
export type CollabUser = {
|
|
72
83
|
id: string;
|
|
73
84
|
socketId: string;
|
package/dist/external/types.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GlobalRole = void 0;
|
|
4
|
-
var GlobalRole;
|
|
1
|
+
export var GlobalRole;
|
|
5
2
|
(function (GlobalRole) {
|
|
6
3
|
GlobalRole["Developer"] = "Developer";
|
|
7
|
-
})(GlobalRole || (
|
|
4
|
+
})(GlobalRole || (GlobalRole = {}));
|
package/dist/external/vars.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const default_1 = require("../../prisma/generated/default");
|
|
5
|
-
const types_1 = require("./types");
|
|
6
|
-
exports.DBUserSelectArgs = {
|
|
1
|
+
import { Prisma } from '../../prisma/generated/default';
|
|
2
|
+
import { GlobalRole } from './types';
|
|
3
|
+
export const DBUserSelectArgs = {
|
|
7
4
|
select: {
|
|
8
5
|
email: true,
|
|
9
6
|
userId: true,
|
|
@@ -19,41 +16,41 @@ exports.DBUserSelectArgs = {
|
|
|
19
16
|
loginMethods: { select: { platform: true, platformEmail: true } },
|
|
20
17
|
},
|
|
21
18
|
};
|
|
22
|
-
|
|
23
|
-
var Platforms;
|
|
19
|
+
export const DBUserPartial = Prisma.validator()(DBUserSelectArgs);
|
|
20
|
+
export var Platforms;
|
|
24
21
|
(function (Platforms) {
|
|
25
22
|
Platforms["Google"] = "Google";
|
|
26
23
|
Platforms["GitHub"] = "GitHub";
|
|
27
24
|
Platforms["Discord"] = "Discord";
|
|
28
25
|
Platforms["Microsoft"] = "Microsoft";
|
|
29
|
-
})(Platforms || (
|
|
30
|
-
var BoardRole;
|
|
26
|
+
})(Platforms || (Platforms = {}));
|
|
27
|
+
export var BoardRole;
|
|
31
28
|
(function (BoardRole) {
|
|
32
29
|
BoardRole["BoardViewer"] = "BoardViewer";
|
|
33
30
|
BoardRole["BoardCollaborator"] = "BoardCollaborator";
|
|
34
|
-
})(BoardRole || (
|
|
35
|
-
var CategoryRole;
|
|
31
|
+
})(BoardRole || (BoardRole = {}));
|
|
32
|
+
export var CategoryRole;
|
|
36
33
|
(function (CategoryRole) {
|
|
37
34
|
CategoryRole["CategoryViewer"] = "CategoryViewer";
|
|
38
35
|
CategoryRole["CategoryCollaborator"] = "CategoryCollaborator";
|
|
39
36
|
CategoryRole["CategoryManager"] = "CategoryManager";
|
|
40
37
|
CategoryRole["CategoryAdmin"] = "CategoryAdmin";
|
|
41
|
-
})(CategoryRole || (
|
|
42
|
-
var GroupRole;
|
|
38
|
+
})(CategoryRole || (CategoryRole = {}));
|
|
39
|
+
export var GroupRole;
|
|
43
40
|
(function (GroupRole) {
|
|
44
41
|
GroupRole["GroupViewer"] = "GroupViewer";
|
|
45
42
|
GroupRole["GroupCollaborator"] = "GroupCollaborator";
|
|
46
43
|
GroupRole["GroupManager"] = "GroupManager";
|
|
47
44
|
GroupRole["GroupAdmin"] = "GroupAdmin";
|
|
48
|
-
})(GroupRole || (
|
|
45
|
+
})(GroupRole || (GroupRole = {}));
|
|
49
46
|
// Variables.
|
|
50
|
-
|
|
47
|
+
export const SimplePermissionHierarchy = {
|
|
51
48
|
Viewer: 1,
|
|
52
49
|
Collaborator: 2,
|
|
53
50
|
Manager: 3,
|
|
54
51
|
Admin: 4,
|
|
55
52
|
};
|
|
56
|
-
|
|
53
|
+
export const PermissionHierarchy = {
|
|
57
54
|
[BoardRole.BoardViewer]: 1,
|
|
58
55
|
[BoardRole.BoardCollaborator]: 2,
|
|
59
56
|
[CategoryRole.CategoryViewer]: 3,
|
|
@@ -64,5 +61,5 @@ exports.PermissionHierarchy = {
|
|
|
64
61
|
[GroupRole.GroupCollaborator]: 8,
|
|
65
62
|
[GroupRole.GroupManager]: 9,
|
|
66
63
|
[GroupRole.GroupAdmin]: 10,
|
|
67
|
-
[
|
|
64
|
+
[GlobalRole.Developer]: 11,
|
|
68
65
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,35 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__exportStar(require("./external/vars"), exports);
|
|
22
|
-
__exportStar(require("./classes/permissions"), exports);
|
|
23
|
-
__exportStar(require("./classes/categories"), exports);
|
|
24
|
-
__exportStar(require("./classes/flashcards"), exports);
|
|
25
|
-
__exportStar(require("./classes/analytics"), exports);
|
|
26
|
-
__exportStar(require("./classes/calendar"), exports);
|
|
27
|
-
__exportStar(require("./classes/sessions"), exports);
|
|
28
|
-
__exportStar(require("./classes/invites"), exports);
|
|
29
|
-
__exportStar(require("./classes/metrics"), exports);
|
|
30
|
-
__exportStar(require("./classes/groups"), exports);
|
|
31
|
-
__exportStar(require("./classes/boards"), exports);
|
|
32
|
-
__exportStar(require("./classes/utils"), exports);
|
|
33
|
-
__exportStar(require("./classes/admin"), exports);
|
|
34
|
-
__exportStar(require("./classes/users"), exports);
|
|
35
|
-
__exportStar(require("./classes/files"), exports);
|
|
1
|
+
export * from './core/manager';
|
|
2
|
+
export * from './core/utils';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './external/types';
|
|
5
|
+
export * from './external/vars';
|
|
6
|
+
export * from './classes/permissions';
|
|
7
|
+
export * from './classes/categories';
|
|
8
|
+
export * from './classes/flashcards';
|
|
9
|
+
export * from './classes/analytics';
|
|
10
|
+
export * from './classes/calendar';
|
|
11
|
+
export * from './classes/sessions';
|
|
12
|
+
export * from './classes/invites';
|
|
13
|
+
export * from './classes/metrics';
|
|
14
|
+
export * from './classes/groups';
|
|
15
|
+
export * from './classes/boards';
|
|
16
|
+
export * from './classes/utils';
|
|
17
|
+
export * from './classes/admin';
|
|
18
|
+
export * from './classes/users';
|
|
19
|
+
export * from './classes/files';
|
|
20
|
+
export * from './classes/auth';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Paginated, WithHeaders } from '../types';
|
|
2
|
+
import { BoardsManager } from '../core/manager';
|
|
3
|
+
import { AllRooms, RecentlyActiveRoom } from '../external/types';
|
|
4
|
+
import { GetUsersOutput } from './users';
|
|
5
|
+
export declare class APIAdmin {
|
|
6
|
+
private web;
|
|
7
|
+
constructor(web: BoardsManager);
|
|
8
|
+
getUsers({ auth, page, limit, ...rest }: AdminFunctionsInput['getUsers']): Promise<import("..").WebResponse<Paginated<GetUsersOutput>>>;
|
|
9
|
+
getActiveRooms({ auth, ...rest }: AdminFunctionsInput['getActiveRooms']): Promise<import("..").WebResponse<{
|
|
10
|
+
rooms: AllRooms;
|
|
11
|
+
recentlyActiveRooms: RecentlyActiveRoom[];
|
|
12
|
+
}>>;
|
|
13
|
+
}
|
|
14
|
+
export type AdminFunctionsInput = WithHeaders<{
|
|
15
|
+
'getUsers': {
|
|
16
|
+
auth: string;
|
|
17
|
+
page?: number;
|
|
18
|
+
limit?: number;
|
|
19
|
+
};
|
|
20
|
+
'getActiveRooms': {
|
|
21
|
+
auth: string;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Data.
|
|
2
|
+
export class APIAdmin {
|
|
3
|
+
web;
|
|
4
|
+
constructor(web) {
|
|
5
|
+
this.web = web;
|
|
6
|
+
}
|
|
7
|
+
// Methods.
|
|
8
|
+
async getUsers({ auth, page, limit, ...rest }) {
|
|
9
|
+
return await this.web.request({
|
|
10
|
+
method: 'GET', auth, ...rest,
|
|
11
|
+
endpoint: this.web.qp('/admin/users', { page, limit }),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async getActiveRooms({ auth, ...rest }) {
|
|
15
|
+
return await this.web.request({
|
|
16
|
+
method: 'GET', auth, ...rest,
|
|
17
|
+
endpoint: this.web.qp('/admin/rooms'),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BoardsManager } from '../core/manager';
|
|
2
|
+
import { WithHeaders } from '../types';
|
|
3
|
+
export declare class APIAnalytics {
|
|
4
|
+
private web;
|
|
5
|
+
constructor(web: BoardsManager);
|
|
6
|
+
getGlobalAnalytics({ auth, ...rest }: AnalyticsFunctionsInput['getGlobalAnalytics']): Promise<import("..").WebResponse<UserBoardActivityWithUser[]>>;
|
|
7
|
+
getUserAnalytics({ auth, ...rest }: AnalyticsFunctionsInput['getUserAnalytics']): Promise<import("..").WebResponse<UserBoardActivityWithBoard[]>>;
|
|
8
|
+
getBoardAnalytics({ auth, boardId, categoryId, groupId, ...rest }: AnalyticsFunctionsInput['getBoardAnalytics']): Promise<import("..").WebResponse<UserBoardActivityWithUser[]>>;
|
|
9
|
+
getCategoryAnalytics({ auth, categoryId, groupId, ...rest }: AnalyticsFunctionsInput['getCategoryAnalytics']): Promise<import("..").WebResponse<UserBoardActivityWithUser[]>>;
|
|
10
|
+
getGroupAnalytics({ auth, groupId, ...rest }: AnalyticsFunctionsInput['getGroupAnalytics']): Promise<import("..").WebResponse<UserBoardActivityWithUser[]>>;
|
|
11
|
+
}
|
|
12
|
+
export type AnalyticsFunctionsInput = WithHeaders<{
|
|
13
|
+
'getGlobalAnalytics': {
|
|
14
|
+
auth: string;
|
|
15
|
+
};
|
|
16
|
+
'getUserAnalytics': {
|
|
17
|
+
auth: string;
|
|
18
|
+
};
|
|
19
|
+
'getBoardAnalytics': {
|
|
20
|
+
auth: string;
|
|
21
|
+
boardId: string;
|
|
22
|
+
categoryId: string;
|
|
23
|
+
groupId: string;
|
|
24
|
+
};
|
|
25
|
+
'getCategoryAnalytics': {
|
|
26
|
+
auth: string;
|
|
27
|
+
categoryId: string;
|
|
28
|
+
groupId: string;
|
|
29
|
+
};
|
|
30
|
+
'getGroupAnalytics': {
|
|
31
|
+
auth: string;
|
|
32
|
+
groupId: string;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
export type ActivityAnalytics = {
|
|
36
|
+
totalSessions: number;
|
|
37
|
+
totalActiveSeconds: number;
|
|
38
|
+
lastActivityAt: Date;
|
|
39
|
+
};
|
|
40
|
+
export type BoardData = {
|
|
41
|
+
name: string;
|
|
42
|
+
boardId: string;
|
|
43
|
+
category: {
|
|
44
|
+
categoryId: string;
|
|
45
|
+
name: string;
|
|
46
|
+
group: {
|
|
47
|
+
groupId: string;
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type UserBoardActivityWithBoard = ActivityAnalytics & {
|
|
53
|
+
board: BoardData;
|
|
54
|
+
};
|
|
55
|
+
export type UserBoardActivityWithUser = ActivityAnalytics & {
|
|
56
|
+
board: BoardData;
|
|
57
|
+
user: {
|
|
58
|
+
userId: string;
|
|
59
|
+
displayName: string;
|
|
60
|
+
avatarUrl: string | null;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Data.
|
|
2
|
+
export class APIAnalytics {
|
|
3
|
+
web;
|
|
4
|
+
constructor(web) {
|
|
5
|
+
this.web = web;
|
|
6
|
+
}
|
|
7
|
+
// Methods.
|
|
8
|
+
async getGlobalAnalytics({ auth, ...rest }) {
|
|
9
|
+
return await this.web.request({
|
|
10
|
+
method: 'GET', auth, ...rest,
|
|
11
|
+
endpoint: this.web.qp('/analytics'),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async getUserAnalytics({ auth, ...rest }) {
|
|
15
|
+
return await this.web.request({
|
|
16
|
+
method: 'GET', auth, ...rest,
|
|
17
|
+
endpoint: this.web.qp('/analytics/user'),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async getBoardAnalytics({ auth, boardId, categoryId, groupId, ...rest }) {
|
|
21
|
+
return await this.web.request({
|
|
22
|
+
method: 'GET', auth, ...rest,
|
|
23
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/analytics`),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async getCategoryAnalytics({ auth, categoryId, groupId, ...rest }) {
|
|
27
|
+
return await this.web.request({
|
|
28
|
+
method: 'GET', auth, ...rest,
|
|
29
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/analytics`),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async getGroupAnalytics({ auth, groupId, ...rest }) {
|
|
33
|
+
return await this.web.request({
|
|
34
|
+
method: 'GET', auth, ...rest,
|
|
35
|
+
endpoint: this.web.qp(`/groups/${groupId}/analytics`),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BoardsManager } from '../core/manager';
|
|
2
|
+
import { CreateSessionInput } from './sessions';
|
|
3
|
+
import { DBUserPartialType } from '../external/vars';
|
|
4
|
+
import { WithHeaders } from '../types';
|
|
5
|
+
export declare class APIAuth {
|
|
6
|
+
private web;
|
|
7
|
+
constructor(web: BoardsManager);
|
|
8
|
+
authenticate({ auth, body, ...rest }: AuthFunctionsInput['authenticate']): Promise<import("..").WebResponse<{
|
|
9
|
+
avatarUrl: string | null;
|
|
10
|
+
boardPermissions: {
|
|
11
|
+
boardId: string;
|
|
12
|
+
role: import("../../prisma/generated").$Enums.BoardRole;
|
|
13
|
+
}[];
|
|
14
|
+
categoryPermissions: {
|
|
15
|
+
categoryId: string;
|
|
16
|
+
role: import("../../prisma/generated").$Enums.CategoryRole;
|
|
17
|
+
}[];
|
|
18
|
+
displayName: string;
|
|
19
|
+
email: string;
|
|
20
|
+
groupPermissions: {
|
|
21
|
+
groupId: string;
|
|
22
|
+
role: import("../../prisma/generated").$Enums.GroupRole;
|
|
23
|
+
}[];
|
|
24
|
+
invitedBy: string | null;
|
|
25
|
+
loginMethods: {
|
|
26
|
+
platform: import("../../prisma/generated").$Enums.Platforms;
|
|
27
|
+
platformEmail: string;
|
|
28
|
+
}[];
|
|
29
|
+
mainGroupId: string | null;
|
|
30
|
+
mainLoginType: import("../../prisma/generated").$Enums.Platforms;
|
|
31
|
+
registrationMethod: import("../../prisma/generated").$Enums.RegistrationMethod;
|
|
32
|
+
userId: string;
|
|
33
|
+
}>>;
|
|
34
|
+
}
|
|
35
|
+
export type AuthFunctionsInput = WithHeaders<{
|
|
36
|
+
'authenticate': {
|
|
37
|
+
auth: string;
|
|
38
|
+
body: CreateSessionInput & {
|
|
39
|
+
refreshProfile?: boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
export type AuthOutput = DBUserPartialType & {
|
|
44
|
+
sessions: {
|
|
45
|
+
dbId: string;
|
|
46
|
+
lastUsed: Date;
|
|
47
|
+
}[];
|
|
48
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class APIAuth {
|
|
2
|
+
web;
|
|
3
|
+
constructor(web) {
|
|
4
|
+
this.web = web;
|
|
5
|
+
}
|
|
6
|
+
async authenticate({ auth, body, ...rest }) {
|
|
7
|
+
return await this.web.request({
|
|
8
|
+
method: 'POST', auth, body, ...rest,
|
|
9
|
+
endpoint: this.web.qp('/auth/authenticate'),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AccessLevel, AllRooms, NameInput, SingleOutput } from '../external/types';
|
|
2
|
+
import { BoardType } from '../../prisma/generated/default';
|
|
3
|
+
import { BoardsManager } from '../core/manager';
|
|
4
|
+
import { WithHeaders } from '../types';
|
|
5
|
+
export declare class APIBoards {
|
|
6
|
+
private web;
|
|
7
|
+
constructor(web: BoardsManager);
|
|
8
|
+
getBoards({ auth, categoryId, groupId, ...rest }: BoardsFunctionsInput['getBoards']): Promise<import("..").WebResponse<GetBoardOutput[]>>;
|
|
9
|
+
getBoard({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['getBoard']): Promise<import("..").WebResponse<GetBoardOutput>>;
|
|
10
|
+
updateBoard({ auth, categoryId, groupId, boardId, body, ...rest }: BoardsFunctionsInput['updateBoard']): Promise<import("..").WebResponse<string>>;
|
|
11
|
+
moveBoard({ auth, categoryId, groupId, boardId, body, ...rest }: BoardsFunctionsInput['moveBoard']): Promise<import("..").WebResponse<MoveBoardOutput>>;
|
|
12
|
+
scheduleBoardDeletion({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['scheduleBoardDeletion']): Promise<import("..").WebResponse<string>>;
|
|
13
|
+
forceDeleteBoard({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['scheduleBoardDeletion']): Promise<import("..").WebResponse<string>>;
|
|
14
|
+
cancelBoardDeletion({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['cancelBoardDeletion']): Promise<import("..").WebResponse<string>>;
|
|
15
|
+
getBoardRoomData({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['getRoomData']): Promise<import("..").WebResponse<AllRooms>>;
|
|
16
|
+
kickUserFromRoom({ auth, categoryId, groupId, boardId, userId, ...rest }: BoardsFunctionsInput['kickUserFromRoom']): Promise<import("..").WebResponse<string>>;
|
|
17
|
+
}
|
|
18
|
+
export type BoardsFunctionsInput = WithHeaders<{
|
|
19
|
+
'getBoards': {
|
|
20
|
+
auth: string;
|
|
21
|
+
categoryId: string;
|
|
22
|
+
groupId: string;
|
|
23
|
+
};
|
|
24
|
+
'getBoard': {
|
|
25
|
+
auth: string;
|
|
26
|
+
categoryId: string;
|
|
27
|
+
groupId: string;
|
|
28
|
+
boardId: string;
|
|
29
|
+
};
|
|
30
|
+
'updateBoard': {
|
|
31
|
+
auth: string;
|
|
32
|
+
categoryId: string;
|
|
33
|
+
groupId: string;
|
|
34
|
+
boardId: string;
|
|
35
|
+
body: NameInput;
|
|
36
|
+
};
|
|
37
|
+
'moveBoard': {
|
|
38
|
+
auth: string;
|
|
39
|
+
categoryId: string;
|
|
40
|
+
groupId: string;
|
|
41
|
+
boardId: string;
|
|
42
|
+
body: MoveBoardInput;
|
|
43
|
+
};
|
|
44
|
+
'scheduleBoardDeletion': {
|
|
45
|
+
auth: string;
|
|
46
|
+
categoryId: string;
|
|
47
|
+
groupId: string;
|
|
48
|
+
boardId: string;
|
|
49
|
+
};
|
|
50
|
+
'cancelBoardDeletion': {
|
|
51
|
+
auth: string;
|
|
52
|
+
categoryId: string;
|
|
53
|
+
groupId: string;
|
|
54
|
+
boardId: string;
|
|
55
|
+
};
|
|
56
|
+
'getRoomData': {
|
|
57
|
+
auth: string;
|
|
58
|
+
categoryId: string;
|
|
59
|
+
groupId: string;
|
|
60
|
+
boardId: string;
|
|
61
|
+
};
|
|
62
|
+
'kickUserFromRoom': {
|
|
63
|
+
auth: string;
|
|
64
|
+
categoryId: string;
|
|
65
|
+
groupId: string;
|
|
66
|
+
boardId: string;
|
|
67
|
+
userId: string;
|
|
68
|
+
};
|
|
69
|
+
}>;
|
|
70
|
+
export type GetBoardOutput = {
|
|
71
|
+
group: SingleOutput;
|
|
72
|
+
category: SingleOutput;
|
|
73
|
+
board: SingleOutput & {
|
|
74
|
+
type: BoardType;
|
|
75
|
+
dataUrl: string;
|
|
76
|
+
hasFlashcards: boolean;
|
|
77
|
+
totalSizeBytes: number;
|
|
78
|
+
accessLevel: AccessLevel;
|
|
79
|
+
scheduledForDeletion: Date | null;
|
|
80
|
+
files: {
|
|
81
|
+
fileId: string;
|
|
82
|
+
mimeType: string;
|
|
83
|
+
createdAt: Date;
|
|
84
|
+
sizeBytes: number;
|
|
85
|
+
fileUrl: string;
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type GetFileOutput = ReadableStream | Blob;
|
|
90
|
+
export type MoveBoardInput = {
|
|
91
|
+
targetCategoryId: string;
|
|
92
|
+
targetIndex?: number;
|
|
93
|
+
};
|
|
94
|
+
export type MoveBoardOutput = {
|
|
95
|
+
boardId: string;
|
|
96
|
+
categoryId: string;
|
|
97
|
+
groupId: string;
|
|
98
|
+
index: number;
|
|
99
|
+
};
|