@excali-boards/boards-api-client 1.1.73 → 1.1.74
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 +1 -1
- package/dist/classes/auth.d.ts +20 -18
- package/dist/classes/boards.d.ts +2 -3
- package/dist/classes/personal.d.ts +1 -1
- package/dist/classes/sessions.d.ts +2 -0
- package/dist/external/vars.d.ts +6 -1
- package/dist/external/vars.js +2 -1
- package/package.json +18 -7
- package/prisma/generated/edge.js +10 -6
- package/prisma/generated/index-browser.js +4 -1
- package/prisma/generated/index.d.ts +83 -3
- package/prisma/generated/index.js +10 -6
- package/prisma/generated/package.json +1 -1
- package/prisma/generated/schema.prisma +5 -0
- package/prisma/generated/wasm.js +10 -6
- package/prisma/schema/schema.prisma +1 -0
- package/prisma/schema/user.prisma +4 -0
- package/dist/src/classes/admin.d.ts +0 -23
- package/dist/src/classes/admin.js +0 -20
- package/dist/src/classes/analytics.d.ts +0 -62
- package/dist/src/classes/analytics.js +0 -38
- package/dist/src/classes/auth.d.ts +0 -48
- package/dist/src/classes/auth.js +0 -12
- package/dist/src/classes/boards.d.ts +0 -99
- package/dist/src/classes/boards.js +0 -62
- package/dist/src/classes/calendar.d.ts +0 -84
- package/dist/src/classes/calendar.js +0 -45
- package/dist/src/classes/categories.d.ts +0 -75
- package/dist/src/classes/categories.js +0 -50
- package/dist/src/classes/files.d.ts +0 -45
- package/dist/src/classes/files.js +0 -31
- package/dist/src/classes/flashcards.d.ts +0 -120
- package/dist/src/classes/flashcards.js +0 -68
- package/dist/src/classes/groups.d.ts +0 -80
- package/dist/src/classes/groups.js +0 -62
- package/dist/src/classes/invites.d.ts +0 -116
- package/dist/src/classes/invites.js +0 -50
- package/dist/src/classes/metrics.d.ts +0 -31
- package/dist/src/classes/metrics.js +0 -20
- package/dist/src/classes/permissions.d.ts +0 -48
- package/dist/src/classes/permissions.js +0 -32
- package/dist/src/classes/sessions.d.ts +0 -61
- package/dist/src/classes/sessions.js +0 -38
- package/dist/src/classes/users.d.ts +0 -37
- package/dist/src/classes/users.js +0 -26
- package/dist/src/classes/utils.d.ts +0 -19
- package/dist/src/classes/utils.js +0 -16
- package/dist/src/core/manager.d.ts +0 -44
- package/dist/src/core/manager.js +0 -92
- package/dist/src/core/utils.d.ts +0 -9
- package/dist/src/core/utils.js +0 -52
- package/dist/src/external/types.d.ts +0 -87
- package/dist/src/external/types.js +0 -4
- package/dist/src/external/vars.d.ts +0 -99
- package/dist/src/external/vars.js +0 -65
- package/dist/src/index.d.ts +0 -20
- package/dist/src/index.js +0 -20
- package/dist/src/types.d.ts +0 -61
- package/dist/src/types.js +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { BoardRole, CategoryRole, GroupRole } from '../external/vars';
|
|
2
|
-
import { GrantedRoles, ResourceType } from '../external/types';
|
|
3
|
-
import { Invite } from '../../prisma/generated';
|
|
4
|
-
import { BoardsManager } from '../core/manager';
|
|
5
|
-
import { WithHeaders } from '../types';
|
|
6
|
-
export declare class APIInvites {
|
|
7
|
-
private web;
|
|
8
|
-
constructor(web: BoardsManager);
|
|
9
|
-
getUserInvites({ auth, ...rest }: InvitesFunctionsInput['getUserInvites']): Promise<import("..").WebResponse<GetUserInvitesOutput>>;
|
|
10
|
-
getResourceInvites({ auth, query, ...rest }: InvitesFunctionsInput['getResourceInvites']): Promise<import("..").WebResponse<GetResourceInvitesOutput>>;
|
|
11
|
-
getInviteDetails({ auth, code, ...rest }: InvitesFunctionsInput['getInviteDetails']): Promise<import("..").WebResponse<InviteDetails>>;
|
|
12
|
-
createInvite({ auth, body, ...rest }: InvitesFunctionsInput['createInvite']): Promise<import("..").WebResponse<CreateInviteOutput>>;
|
|
13
|
-
useInvite({ auth, code, ...rest }: InvitesFunctionsInput['useInvite']): Promise<import("..").WebResponse<UseInviteOutput>>;
|
|
14
|
-
renewInvite({ auth, code, ...rest }: InvitesFunctionsInput['renewInvite']): Promise<import("..").WebResponse<RenewInviteOutput>>;
|
|
15
|
-
revokeInvite({ auth, code, ...rest }: InvitesFunctionsInput['revokeInvite']): Promise<import("..").WebResponse<string>>;
|
|
16
|
-
}
|
|
17
|
-
export type InvitesFunctionsInput = WithHeaders<{
|
|
18
|
-
'getUserInvites': {
|
|
19
|
-
auth: string;
|
|
20
|
-
};
|
|
21
|
-
'getResourceInvites': {
|
|
22
|
-
auth: string;
|
|
23
|
-
query: ViewInvitesQuery;
|
|
24
|
-
};
|
|
25
|
-
'getInviteDetails': {
|
|
26
|
-
auth: string;
|
|
27
|
-
code: string;
|
|
28
|
-
};
|
|
29
|
-
'createInvite': {
|
|
30
|
-
auth: string;
|
|
31
|
-
body: CreateInviteInput;
|
|
32
|
-
};
|
|
33
|
-
'useInvite': {
|
|
34
|
-
auth: string;
|
|
35
|
-
code: string;
|
|
36
|
-
};
|
|
37
|
-
'revokeInvite': {
|
|
38
|
-
auth: string;
|
|
39
|
-
code: string;
|
|
40
|
-
};
|
|
41
|
-
'renewInvite': {
|
|
42
|
-
auth: string;
|
|
43
|
-
code: string;
|
|
44
|
-
};
|
|
45
|
-
}>;
|
|
46
|
-
export type ViewInvitesQuery = {
|
|
47
|
-
type: ResourceType;
|
|
48
|
-
groupId?: string;
|
|
49
|
-
categoryId?: string;
|
|
50
|
-
boardId?: string;
|
|
51
|
-
};
|
|
52
|
-
export type CreateInviteInput = {
|
|
53
|
-
groupIds?: string[];
|
|
54
|
-
categoryIds?: string[];
|
|
55
|
-
boardIds?: string[];
|
|
56
|
-
groupRole?: GroupRole;
|
|
57
|
-
categoryRole?: CategoryRole;
|
|
58
|
-
boardRole?: BoardRole;
|
|
59
|
-
expiresIn?: number;
|
|
60
|
-
maxUses?: number;
|
|
61
|
-
};
|
|
62
|
-
export type CreateInviteOutput = {
|
|
63
|
-
code: string;
|
|
64
|
-
expiresAt: string;
|
|
65
|
-
maxUses: number;
|
|
66
|
-
};
|
|
67
|
-
export type RenewInviteOutput = CreateInviteOutput & {
|
|
68
|
-
currentUses: number;
|
|
69
|
-
};
|
|
70
|
-
export type GetUserInvitesOutput = {
|
|
71
|
-
invites: InviteData[];
|
|
72
|
-
canInvite: boolean;
|
|
73
|
-
};
|
|
74
|
-
export type GetResourceInvitesOutput = InviteData[];
|
|
75
|
-
export type UseInviteOutput = {
|
|
76
|
-
granted: GrantedRoles;
|
|
77
|
-
details: {
|
|
78
|
-
groups: {
|
|
79
|
-
groupId: string;
|
|
80
|
-
name: string;
|
|
81
|
-
}[];
|
|
82
|
-
categories: {
|
|
83
|
-
categoryId: string;
|
|
84
|
-
name: string;
|
|
85
|
-
groupId: string;
|
|
86
|
-
}[];
|
|
87
|
-
boards: {
|
|
88
|
-
boardId: string;
|
|
89
|
-
name: string;
|
|
90
|
-
categoryId: string;
|
|
91
|
-
}[];
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
export type InviteDetails = RenewInviteOutput & {
|
|
95
|
-
invitedBy: {
|
|
96
|
-
userId: string;
|
|
97
|
-
displayName: string;
|
|
98
|
-
avatarUrl: string | null;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
export type InviteData = Pick<Invite, 'code' | 'expiresAt' | 'maxUses' | 'currentUses' | 'boardRole' | 'categoryRole' | 'groupRole'> & {
|
|
102
|
-
groups: {
|
|
103
|
-
groupId: string;
|
|
104
|
-
name: string;
|
|
105
|
-
}[];
|
|
106
|
-
categories: {
|
|
107
|
-
categoryId: string;
|
|
108
|
-
name: string;
|
|
109
|
-
groupId: string;
|
|
110
|
-
}[];
|
|
111
|
-
boards: {
|
|
112
|
-
boardId: string;
|
|
113
|
-
name: string;
|
|
114
|
-
categoryId: string;
|
|
115
|
-
}[];
|
|
116
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Data.
|
|
2
|
-
export class APIInvites {
|
|
3
|
-
web;
|
|
4
|
-
constructor(web) {
|
|
5
|
-
this.web = web;
|
|
6
|
-
}
|
|
7
|
-
// Methods.
|
|
8
|
-
async getUserInvites({ auth, ...rest }) {
|
|
9
|
-
return await this.web.request({
|
|
10
|
-
method: 'GET', auth, ...rest,
|
|
11
|
-
endpoint: this.web.qp('/invites'),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async getResourceInvites({ auth, query, ...rest }) {
|
|
15
|
-
return await this.web.request({
|
|
16
|
-
method: 'GET', auth, ...rest,
|
|
17
|
-
endpoint: this.web.qp('/resources/invites', query),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async getInviteDetails({ auth, code, ...rest }) {
|
|
21
|
-
return await this.web.request({
|
|
22
|
-
method: 'GET', auth, ...rest,
|
|
23
|
-
endpoint: this.web.qp(`/invites/${code}`),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async createInvite({ auth, body, ...rest }) {
|
|
27
|
-
return await this.web.request({
|
|
28
|
-
method: 'POST', auth, body, ...rest,
|
|
29
|
-
endpoint: this.web.qp('/invites'),
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async useInvite({ auth, code, ...rest }) {
|
|
33
|
-
return await this.web.request({
|
|
34
|
-
method: 'POST', auth, ...rest,
|
|
35
|
-
endpoint: this.web.qp(`/invites/${code}`),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
async renewInvite({ auth, code, ...rest }) {
|
|
39
|
-
return await this.web.request({
|
|
40
|
-
method: 'PATCH', auth, ...rest,
|
|
41
|
-
endpoint: this.web.qp(`/invites/${code}`),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async revokeInvite({ auth, code, ...rest }) {
|
|
45
|
-
return await this.web.request({
|
|
46
|
-
method: 'DELETE', auth, ...rest,
|
|
47
|
-
endpoint: this.web.qp(`/invites/${code}`),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BoardsManager } from '../core/manager';
|
|
2
|
-
import { WithHeaders } from '../types';
|
|
3
|
-
export declare class APIMetrics {
|
|
4
|
-
private web;
|
|
5
|
-
constructor(web: BoardsManager);
|
|
6
|
-
getMetrics({ auth, ...rest }: MetricsFunctionsInput['getMetrics']): Promise<import("..").WebResponse<string>>;
|
|
7
|
-
getStatus({ auth, ...rest }: MetricsFunctionsInput['getStatus']): Promise<import("..").WebResponse<SystemStatus>>;
|
|
8
|
-
}
|
|
9
|
-
export type MetricsFunctionsInput = WithHeaders<{
|
|
10
|
-
'getMetrics': {
|
|
11
|
-
auth: string;
|
|
12
|
-
};
|
|
13
|
-
'getStatus': {
|
|
14
|
-
auth: string;
|
|
15
|
-
};
|
|
16
|
-
}>;
|
|
17
|
-
export type SystemStatus = {
|
|
18
|
-
cpuUsage: number;
|
|
19
|
-
memoryUsageMb: number;
|
|
20
|
-
uptimeSeconds: number;
|
|
21
|
-
activeRooms: number;
|
|
22
|
-
socketConnections: number;
|
|
23
|
-
queuedFiles: number;
|
|
24
|
-
totalUsers: number;
|
|
25
|
-
totalInvites: number;
|
|
26
|
-
totalBoards: number;
|
|
27
|
-
totalCategories: number;
|
|
28
|
-
totalGroups: number;
|
|
29
|
-
totalFiles: number;
|
|
30
|
-
storageSizeMb: number;
|
|
31
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Data.
|
|
2
|
-
export class APIMetrics {
|
|
3
|
-
web;
|
|
4
|
-
constructor(web) {
|
|
5
|
-
this.web = web;
|
|
6
|
-
}
|
|
7
|
-
// Methods.
|
|
8
|
-
async getMetrics({ auth, ...rest }) {
|
|
9
|
-
return await this.web.request({
|
|
10
|
-
method: 'GET', auth, ...rest,
|
|
11
|
-
endpoint: this.web.qp('/metrics'),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async getStatus({ auth, ...rest }) {
|
|
15
|
-
return await this.web.request({
|
|
16
|
-
method: 'GET', auth, ...rest,
|
|
17
|
-
endpoint: this.web.qp('/status'),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { BoardRole, CategoryRole, GroupRole } from '../external/vars';
|
|
2
|
-
import { PermUser, ResourceType } from '../external/types';
|
|
3
|
-
import { BoardsManager } from '../core/manager';
|
|
4
|
-
import { WithHeaders } from '../types';
|
|
5
|
-
export declare class APIPermissions {
|
|
6
|
-
private web;
|
|
7
|
-
constructor(web: BoardsManager);
|
|
8
|
-
viewPermissions({ auth, query, ...rest }: PermissionsFunctionsInput['viewPermissions']): Promise<import("..").WebResponse<PermUser[]>>;
|
|
9
|
-
viewAllPermissions({ auth, userIds, ...rest }: PermissionsFunctionsInput['viewAllPermissions']): Promise<import("..").WebResponse<Record<string, PermUser>>>;
|
|
10
|
-
grantPermissions({ auth, body, ...rest }: PermissionsFunctionsInput['grantPermissions']): Promise<import("..").WebResponse<string>>;
|
|
11
|
-
revokePermissions({ auth, body, ...rest }: PermissionsFunctionsInput['revokePermissions']): Promise<import("..").WebResponse<string>>;
|
|
12
|
-
}
|
|
13
|
-
export type PermissionsFunctionsInput = WithHeaders<{
|
|
14
|
-
'viewPermissions': {
|
|
15
|
-
auth: string;
|
|
16
|
-
query: ViewPermissionsQuery;
|
|
17
|
-
};
|
|
18
|
-
'viewAllPermissions': {
|
|
19
|
-
auth: string;
|
|
20
|
-
userIds: string[];
|
|
21
|
-
};
|
|
22
|
-
'grantPermissions': {
|
|
23
|
-
auth: string;
|
|
24
|
-
body: GrantPermissionsInput;
|
|
25
|
-
};
|
|
26
|
-
'revokePermissions': {
|
|
27
|
-
auth: string;
|
|
28
|
-
body: RevokePermissionsInput;
|
|
29
|
-
};
|
|
30
|
-
}>;
|
|
31
|
-
export type ViewPermissionsQuery = {
|
|
32
|
-
type: ResourceType;
|
|
33
|
-
id: string;
|
|
34
|
-
};
|
|
35
|
-
export type GrantPermissionsInput = {
|
|
36
|
-
userId: string;
|
|
37
|
-
groupIds?: string[];
|
|
38
|
-
groupRole?: GroupRole;
|
|
39
|
-
categoryIds?: string[];
|
|
40
|
-
categoryRole?: CategoryRole;
|
|
41
|
-
boardIds?: string[];
|
|
42
|
-
boardRole?: BoardRole;
|
|
43
|
-
};
|
|
44
|
-
export type RevokePermissionsInput = {
|
|
45
|
-
userId: string;
|
|
46
|
-
resourceType: ResourceType;
|
|
47
|
-
resourceId: string;
|
|
48
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Data.
|
|
2
|
-
export class APIPermissions {
|
|
3
|
-
web;
|
|
4
|
-
constructor(web) {
|
|
5
|
-
this.web = web;
|
|
6
|
-
}
|
|
7
|
-
// Methods.
|
|
8
|
-
async viewPermissions({ auth, query, ...rest }) {
|
|
9
|
-
return await this.web.request({
|
|
10
|
-
method: 'GET', auth, ...rest,
|
|
11
|
-
endpoint: this.web.qp('/permissions/view', query),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async viewAllPermissions({ auth, userIds, ...rest }) {
|
|
15
|
-
return await this.web.request({
|
|
16
|
-
method: 'POST', auth, body: { userIds }, ...rest,
|
|
17
|
-
endpoint: this.web.qp('/permissions/view-all'),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async grantPermissions({ auth, body, ...rest }) {
|
|
21
|
-
return await this.web.request({
|
|
22
|
-
method: 'POST', auth, body, ...rest,
|
|
23
|
-
endpoint: this.web.qp('/permissions/grant'),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async revokePermissions({ auth, body, ...rest }) {
|
|
27
|
-
return await this.web.request({
|
|
28
|
-
method: 'POST', auth, body, ...rest,
|
|
29
|
-
endpoint: this.web.qp('/permissions/revoke'),
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Device, Platforms } from '../../prisma/generated/default';
|
|
2
|
-
import { BoardsManager } from '../core/manager';
|
|
3
|
-
import { WithHeaders } from '../types';
|
|
4
|
-
export declare class APISessions {
|
|
5
|
-
private web;
|
|
6
|
-
constructor(web: BoardsManager);
|
|
7
|
-
createSession({ auth, body, ...rest }: SessionsFunctionsInput['createSession']): Promise<import("..").WebResponse<CreateSessionOutput>>;
|
|
8
|
-
getAllSessions({ auth, ...rest }: SessionsFunctionsInput['getAllSessions']): Promise<import("..").WebResponse<SessionsOutput>>;
|
|
9
|
-
deleteSession({ auth, dbId, ...rest }: SessionsFunctionsInput['deleteSession']): Promise<import("..").WebResponse<string>>;
|
|
10
|
-
deleteAllSessions({ auth, ...rest }: SessionsFunctionsInput['deleteAllSessions']): Promise<import("..").WebResponse<string>>;
|
|
11
|
-
rotateLinkedSession({ auth, body, ...rest }: SessionsFunctionsInput['rotateLinkedSession']): Promise<import("..").WebResponse<string>>;
|
|
12
|
-
}
|
|
13
|
-
export type SessionsFunctionsInput = WithHeaders<{
|
|
14
|
-
'createSession': {
|
|
15
|
-
auth: string;
|
|
16
|
-
body: CreateSessionInput;
|
|
17
|
-
};
|
|
18
|
-
'getAllSessions': {
|
|
19
|
-
auth: string;
|
|
20
|
-
};
|
|
21
|
-
'deleteSession': {
|
|
22
|
-
auth: string;
|
|
23
|
-
dbId: string;
|
|
24
|
-
};
|
|
25
|
-
'deleteAllSessions': {
|
|
26
|
-
auth: string;
|
|
27
|
-
};
|
|
28
|
-
'rotateLinkedSession': {
|
|
29
|
-
auth: string;
|
|
30
|
-
body: UnlinkLoginMethodInput;
|
|
31
|
-
};
|
|
32
|
-
}>;
|
|
33
|
-
export type CreateSessionInput = {
|
|
34
|
-
ip?: string;
|
|
35
|
-
email: string;
|
|
36
|
-
device?: Device;
|
|
37
|
-
platform: Platforms;
|
|
38
|
-
displayName: string;
|
|
39
|
-
avatarUrl?: string | null;
|
|
40
|
-
currentUserId?: string;
|
|
41
|
-
refreshProfile?: boolean;
|
|
42
|
-
};
|
|
43
|
-
export type CreateSessionOutput = {
|
|
44
|
-
token: string;
|
|
45
|
-
expiresAt: Date;
|
|
46
|
-
};
|
|
47
|
-
export type SessionsOutput = {
|
|
48
|
-
activeDbId: string;
|
|
49
|
-
sessions: {
|
|
50
|
-
location: string | null;
|
|
51
|
-
device: Device | null;
|
|
52
|
-
tokenPreview: string;
|
|
53
|
-
dbId: string;
|
|
54
|
-
expiresAt: Date;
|
|
55
|
-
createdAt: Date;
|
|
56
|
-
lastUsed: Date;
|
|
57
|
-
}[];
|
|
58
|
-
};
|
|
59
|
-
export type UnlinkLoginMethodInput = {
|
|
60
|
-
platform: Platforms;
|
|
61
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Data.
|
|
2
|
-
export class APISessions {
|
|
3
|
-
web;
|
|
4
|
-
constructor(web) {
|
|
5
|
-
this.web = web;
|
|
6
|
-
}
|
|
7
|
-
// Methods.
|
|
8
|
-
async createSession({ auth, body, ...rest }) {
|
|
9
|
-
return await this.web.request({
|
|
10
|
-
method: 'POST', auth, body, ...rest,
|
|
11
|
-
endpoint: this.web.qp('/sessions'),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async getAllSessions({ auth, ...rest }) {
|
|
15
|
-
return await this.web.request({
|
|
16
|
-
method: 'GET', auth, ...rest,
|
|
17
|
-
endpoint: this.web.qp('/sessions'),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async deleteSession({ auth, dbId, ...rest }) {
|
|
21
|
-
return await this.web.request({
|
|
22
|
-
method: 'DELETE', auth, body: { dbId }, ...rest,
|
|
23
|
-
endpoint: this.web.qp('/sessions'),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async deleteAllSessions({ auth, ...rest }) {
|
|
27
|
-
return await this.web.request({
|
|
28
|
-
method: 'DELETE', auth, ...rest,
|
|
29
|
-
endpoint: this.web.qp('/sessions/all'),
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async rotateLinkedSession({ auth, body, ...rest }) {
|
|
33
|
-
return await this.web.request({
|
|
34
|
-
method: 'POST', auth, body, ...rest,
|
|
35
|
-
endpoint: this.web.qp('/sessions/rotate'),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Platforms } from '../../prisma/generated/default';
|
|
2
|
-
import { DBUserPartialType } from '../external/vars';
|
|
3
|
-
import { BoardsManager } from '../core/manager';
|
|
4
|
-
import { WithHeaders } from '../types';
|
|
5
|
-
export declare class APIUsers {
|
|
6
|
-
private web;
|
|
7
|
-
constructor(web: BoardsManager);
|
|
8
|
-
getUser({ auth, userId, ...rest }: UsersFunctionsInput['getCurrentUser']): Promise<import("..").WebResponse<GetUsersOutput>>;
|
|
9
|
-
updateUser({ auth, userId, body, ...rest }: UsersFunctionsInput['updateUser']): Promise<import("..").WebResponse<string>>;
|
|
10
|
-
deleteAccount({ auth, userId, ...rest }: UsersFunctionsInput['deleteAccount']): Promise<import("..").WebResponse<void>>;
|
|
11
|
-
}
|
|
12
|
-
export type UsersFunctionsInput = WithHeaders<{
|
|
13
|
-
'getCurrentUser': {
|
|
14
|
-
auth: string;
|
|
15
|
-
userId?: string;
|
|
16
|
-
};
|
|
17
|
-
'updateUser': {
|
|
18
|
-
auth: string;
|
|
19
|
-
userId?: string;
|
|
20
|
-
body: UserInput;
|
|
21
|
-
};
|
|
22
|
-
'deleteAccount': {
|
|
23
|
-
auth: string;
|
|
24
|
-
userId?: string;
|
|
25
|
-
};
|
|
26
|
-
'isCurrentUserDev': {
|
|
27
|
-
auth: string;
|
|
28
|
-
};
|
|
29
|
-
}>;
|
|
30
|
-
export type GetUsersOutput = DBUserPartialType & {
|
|
31
|
-
isDev: boolean;
|
|
32
|
-
};
|
|
33
|
-
export type UserInput = {
|
|
34
|
-
mainGroupId?: string | null;
|
|
35
|
-
displayName?: string;
|
|
36
|
-
platform?: Platforms;
|
|
37
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Data.
|
|
2
|
-
export class APIUsers {
|
|
3
|
-
web;
|
|
4
|
-
constructor(web) {
|
|
5
|
-
this.web = web;
|
|
6
|
-
}
|
|
7
|
-
// Methods.
|
|
8
|
-
async getUser({ auth, userId, ...rest }) {
|
|
9
|
-
return await this.web.request({
|
|
10
|
-
method: 'GET', auth, ...rest,
|
|
11
|
-
endpoint: this.web.qp('/users' + (userId ? `/${userId}` : '')),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async updateUser({ auth, userId, body, ...rest }) {
|
|
15
|
-
return await this.web.request({
|
|
16
|
-
method: 'PATCH', auth, body, ...rest,
|
|
17
|
-
endpoint: this.web.qp('/users' + (userId ? `/${userId}` : '')),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async deleteAccount({ auth, userId, ...rest }) {
|
|
21
|
-
return await this.web.request({
|
|
22
|
-
method: 'DELETE', auth, ...rest,
|
|
23
|
-
endpoint: this.web.qp('/users' + (userId ? `/${userId}` : '')),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BoardsManager } from '../core/manager';
|
|
2
|
-
import { WithHeaders } from '../types';
|
|
3
|
-
export declare class APIUtils {
|
|
4
|
-
private web;
|
|
5
|
-
constructor(web: BoardsManager);
|
|
6
|
-
unfurlUrl({ auth, url, ...rest }: UtilsFunctionsInput['unfurlUrl']): Promise<import("..").WebResponse<Partial<UnfurlOutput>>>;
|
|
7
|
-
}
|
|
8
|
-
export type UtilsFunctionsInput = WithHeaders<{
|
|
9
|
-
'unfurlUrl': {
|
|
10
|
-
auth: string;
|
|
11
|
-
url: string;
|
|
12
|
-
};
|
|
13
|
-
}>;
|
|
14
|
-
export type UnfurlOutput = {
|
|
15
|
-
title: string;
|
|
16
|
-
description: string;
|
|
17
|
-
image: string;
|
|
18
|
-
favicon: string;
|
|
19
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Data.
|
|
2
|
-
export class APIUtils {
|
|
3
|
-
web;
|
|
4
|
-
constructor(web) {
|
|
5
|
-
this.web = web;
|
|
6
|
-
}
|
|
7
|
-
// Methods.
|
|
8
|
-
async unfurlUrl({ auth, url, ...rest }) {
|
|
9
|
-
return await this.web.request({
|
|
10
|
-
method: 'GET', auth, ...rest,
|
|
11
|
-
endpoint: this.web.qp('/utils/unfurl', {
|
|
12
|
-
url,
|
|
13
|
-
}),
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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 { RequestMethod, WebResponse } from '../types';
|
|
17
|
-
export declare class BoardsManager {
|
|
18
|
-
url: string;
|
|
19
|
-
readonly permissions: APIPermissions;
|
|
20
|
-
readonly categories: APICategories;
|
|
21
|
-
readonly flashcards: APIFlashcards;
|
|
22
|
-
readonly analytics: APIAnalytics;
|
|
23
|
-
readonly calendar: APICalendar;
|
|
24
|
-
readonly sessions: APISessions;
|
|
25
|
-
readonly invites: APIInvites;
|
|
26
|
-
readonly metrics: APIMetrics;
|
|
27
|
-
readonly groups: APIGroups;
|
|
28
|
-
readonly boards: APIBoards;
|
|
29
|
-
readonly admin: APIAdmin;
|
|
30
|
-
readonly users: APIUsers;
|
|
31
|
-
readonly utils: APIUtils;
|
|
32
|
-
readonly files: APIFiles;
|
|
33
|
-
readonly auth: APIAuth;
|
|
34
|
-
constructor(url: string);
|
|
35
|
-
request<O, T = unknown>(data: {
|
|
36
|
-
endpoint: string;
|
|
37
|
-
method: RequestMethod;
|
|
38
|
-
body?: T;
|
|
39
|
-
auth?: string;
|
|
40
|
-
headers?: Record<string, string> | null;
|
|
41
|
-
}): Promise<WebResponse<O>>;
|
|
42
|
-
qp<T extends Record<string, unknown>>(url: string, params?: T): string;
|
|
43
|
-
private isResponse;
|
|
44
|
-
}
|
package/dist/src/core/manager.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
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 {
|
|
19
|
-
url;
|
|
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);
|
|
35
|
-
constructor(url) {
|
|
36
|
-
this.url = url;
|
|
37
|
-
}
|
|
38
|
-
async request(data) {
|
|
39
|
-
try {
|
|
40
|
-
axios.interceptors.response.use(transformDates);
|
|
41
|
-
let requestData;
|
|
42
|
-
let contentType;
|
|
43
|
-
if (data.body instanceof FormData) {
|
|
44
|
-
requestData = data.body;
|
|
45
|
-
contentType = 'multipart/form-data';
|
|
46
|
-
}
|
|
47
|
-
else if (data.body !== undefined) {
|
|
48
|
-
requestData = JSON.stringify(data.body);
|
|
49
|
-
contentType = 'application/json';
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
requestData = undefined;
|
|
53
|
-
contentType = undefined;
|
|
54
|
-
}
|
|
55
|
-
const res = await axios(this.url + data.endpoint, {
|
|
56
|
-
method: data.method,
|
|
57
|
-
data: requestData,
|
|
58
|
-
headers: {
|
|
59
|
-
...(data.headers === null ? {} : contentType ? { 'Content-Type': contentType } : {}),
|
|
60
|
-
...(data.auth ? { 'Authorization': data.auth } : {}),
|
|
61
|
-
...(data.headers || {}),
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
.then((res) => res.data)
|
|
65
|
-
.catch((err) => err.response?.data);
|
|
66
|
-
if (!this.isResponse(res)) {
|
|
67
|
-
throw new Error('Invalid response received.');
|
|
68
|
-
}
|
|
69
|
-
return res;
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
return {
|
|
73
|
-
status: 500,
|
|
74
|
-
error: 'An error occurred while processing the request.',
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
qp(url, params) {
|
|
79
|
-
if (!params)
|
|
80
|
-
return url;
|
|
81
|
-
const query = new URLSearchParams();
|
|
82
|
-
for (const [key, value] of Object.entries(params)) {
|
|
83
|
-
if (value === undefined)
|
|
84
|
-
continue;
|
|
85
|
-
query.append(key, String(value));
|
|
86
|
-
}
|
|
87
|
-
return url + '?' + query.toString();
|
|
88
|
-
}
|
|
89
|
-
isResponse(obj) {
|
|
90
|
-
return (obj && typeof obj === 'object' && 'status' in obj);
|
|
91
|
-
}
|
|
92
|
-
}
|
package/dist/src/core/utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Paginated, PaginatedWebResponse, WebResponse } from '../types';
|
|
2
|
-
import { AxiosResponse } from 'axios';
|
|
3
|
-
export declare function isDateStringRegex(value: unknown): value is string;
|
|
4
|
-
export declare function recursiveDateConversion<T>(data: T): T;
|
|
5
|
-
export declare function transformDates<T>(response: AxiosResponse<T>): AxiosResponse<T>;
|
|
6
|
-
export declare function getAll<T>(fetcher: (page: number, limit: number) => Promise<WebResponse<Paginated<T>>>, options?: {
|
|
7
|
-
limit?: number;
|
|
8
|
-
maxItems?: number;
|
|
9
|
-
}): Promise<PaginatedWebResponse<T>>;
|