@excali-boards/boards-api-client 1.1.1-dev.13 → 1.1.1-dev.14

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.
@@ -19,7 +19,6 @@ export type SystemStatus = {
19
19
  activeRooms: number;
20
20
  socketConnections: number;
21
21
  queuedFiles: number;
22
- cacheSize: number;
23
22
  totalUsers: number;
24
23
  totalInvites: number;
25
24
  totalBoards: number;
@@ -0,0 +1,45 @@
1
+ import { Platforms } from '../../prisma/generated/default';
2
+ import { BoardsManager } from '../core/manager';
3
+ export declare class APISessions {
4
+ private web;
5
+ constructor(web: BoardsManager);
6
+ createSession({ auth, body }: SessionsFunctionsInput['createSession']): Promise<import("..").WebResponse<CreateSessionOutput>>;
7
+ getAllSessions({ auth }: SessionsFunctionsInput['getAllSessions']): Promise<import("..").WebResponse<SessionsOutput>>;
8
+ deleteSession({ auth, token }: SessionsFunctionsInput['deleteSession']): Promise<import("..").WebResponse<void>>;
9
+ deleteAllSessions({ auth }: SessionsFunctionsInput['deleteAllSessions']): Promise<import("..").WebResponse<void>>;
10
+ }
11
+ export type SessionsFunctionsInput = {
12
+ 'createSession': {
13
+ auth: string;
14
+ body: CreateSessionInput;
15
+ };
16
+ 'getAllSessions': {
17
+ auth: string;
18
+ };
19
+ 'deleteSession': {
20
+ auth: string;
21
+ token: string;
22
+ };
23
+ 'deleteAllSessions': {
24
+ auth: string;
25
+ };
26
+ };
27
+ export type CreateSessionInput = {
28
+ ip?: string;
29
+ email: string;
30
+ platform: Platforms;
31
+ displayName: string;
32
+ avatarUrl?: string | null;
33
+ currentUserId?: string;
34
+ };
35
+ export type CreateSessionOutput = {
36
+ token: string;
37
+ expiresAt: Date;
38
+ };
39
+ export type SessionsOutput = {
40
+ tokenPreview: string;
41
+ expiresAt: Date;
42
+ location: string;
43
+ createdAt: Date;
44
+ lastUsed: Date;
45
+ }[];
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APISessions = void 0;
4
+ // Data.
5
+ class APISessions {
6
+ web;
7
+ constructor(web) {
8
+ this.web = web;
9
+ }
10
+ // Methods.
11
+ async createSession({ auth, body }) {
12
+ return await this.web.request({
13
+ method: 'POST', auth, body,
14
+ endpoint: this.web.qp('/sessions'),
15
+ });
16
+ }
17
+ async getAllSessions({ auth }) {
18
+ return await this.web.request({
19
+ method: 'GET', auth,
20
+ endpoint: this.web.qp('/sessions'),
21
+ });
22
+ }
23
+ async deleteSession({ auth, token }) {
24
+ return await this.web.request({
25
+ method: 'DELETE', auth, body: { token },
26
+ endpoint: this.web.qp('/sessions'),
27
+ });
28
+ }
29
+ async deleteAllSessions({ auth }) {
30
+ return await this.web.request({
31
+ method: 'DELETE', auth,
32
+ endpoint: this.web.qp('/sessions/all'),
33
+ });
34
+ }
35
+ }
36
+ exports.APISessions = APISessions;
@@ -5,7 +5,6 @@ export declare class APIUsers {
5
5
  private web;
6
6
  constructor(web: BoardsManager);
7
7
  getCurrentUser({ auth }: UsersFunctionsInput['getCurrentUser']): Promise<import("..").WebResponse<GetUsersOutput>>;
8
- isCurrentUserDev({ auth }: UsersFunctionsInput['isCurrentUserDev']): Promise<import("..").WebResponse<boolean>>;
9
8
  changeMainPlatform({ auth, newMainPlatform }: UsersFunctionsInput['changeMainPlatform']): Promise<import("..").WebResponse<string>>;
10
9
  changeMainGroup({ auth, newMainGroupId }: UsersFunctionsInput['changeMainGroup']): Promise<import("..").WebResponse<string>>;
11
10
  deleteAccount({ auth }: UsersFunctionsInput['deleteAccount']): Promise<import("..").WebResponse<void>>;
@@ -11,26 +11,20 @@ class APIUsers {
11
11
  async getCurrentUser({ auth }) {
12
12
  return await this.web.request({
13
13
  method: 'GET', auth,
14
- endpoint: this.web.qp('/users/current'),
15
- });
16
- }
17
- async isCurrentUserDev({ auth }) {
18
- return await this.web.request({
19
- method: 'GET', auth,
20
- endpoint: this.web.qp('/users/dev'),
14
+ endpoint: this.web.qp('/users'),
21
15
  });
22
16
  }
23
17
  async changeMainPlatform({ auth, newMainPlatform }) {
24
18
  return await this.web.request({
25
- method: 'POST', auth,
26
- endpoint: this.web.qp('/users/change-main-platform'),
19
+ method: 'PATCH', auth,
20
+ endpoint: this.web.qp('/users/platform'),
27
21
  body: { name: newMainPlatform },
28
22
  });
29
23
  }
30
24
  async changeMainGroup({ auth, newMainGroupId }) {
31
25
  return await this.web.request({
32
- method: 'POST', auth,
33
- endpoint: this.web.qp('/users/change-main-group'),
26
+ method: 'PATCH', auth,
27
+ endpoint: this.web.qp('/users/group'),
34
28
  body: { groupId: newMainGroupId },
35
29
  });
36
30
  }
@@ -2,24 +2,24 @@ import { PaginatedWebResponse, RequestMethod, WebResponse } from '../types';
2
2
  import { AxiosResponse, ResponseType } from 'axios';
3
3
  import { APIPermissions } from '../classes/permissions';
4
4
  import { APICategories } from '../classes/categories';
5
+ import { APISessions } from '../classes/sessions';
5
6
  import { APIMetrics } from '../classes/metrics';
6
7
  import { APIInvites } from '../classes/invites';
7
8
  import { APIGroups } from '../classes/groups';
8
9
  import { APIBoards } from '../classes/boards';
9
10
  import { APIUsers } from '../classes/users';
10
11
  import { APIAdmin } from '../classes/admin';
11
- import { APIAuth } from '../classes/auth';
12
12
  export declare class BoardsManager {
13
13
  url: string;
14
14
  readonly permissions: APIPermissions;
15
15
  readonly categories: APICategories;
16
+ readonly sessions: APISessions;
16
17
  readonly invites: APIInvites;
17
18
  readonly metrics: APIMetrics;
18
19
  readonly groups: APIGroups;
19
20
  readonly boards: APIBoards;
20
21
  readonly admin: APIAdmin;
21
22
  readonly users: APIUsers;
22
- readonly auth: APIAuth;
23
23
  constructor(url: string);
24
24
  request<O, T = unknown, R extends boolean = false, P extends boolean = false>(data: {
25
25
  endpoint: string;
@@ -7,25 +7,25 @@ exports.BoardsManager = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const permissions_1 = require("../classes/permissions");
9
9
  const categories_1 = require("../classes/categories");
10
+ const sessions_1 = require("../classes/sessions");
10
11
  const metrics_1 = require("../classes/metrics");
11
12
  const invites_1 = require("../classes/invites");
12
13
  const groups_1 = require("../classes/groups");
13
14
  const boards_1 = require("../classes/boards");
14
15
  const users_1 = require("../classes/users");
15
16
  const admin_1 = require("../classes/admin");
16
- const auth_1 = require("../classes/auth");
17
17
  const utils_1 = require("./utils");
18
18
  class BoardsManager {
19
19
  url;
20
20
  permissions = new permissions_1.APIPermissions(this);
21
21
  categories = new categories_1.APICategories(this);
22
+ sessions = new sessions_1.APISessions(this);
22
23
  invites = new invites_1.APIInvites(this);
23
24
  metrics = new metrics_1.APIMetrics(this);
24
25
  groups = new groups_1.APIGroups(this);
25
26
  boards = new boards_1.APIBoards(this);
26
27
  admin = new admin_1.APIAdmin(this);
27
28
  users = new users_1.APIUsers(this);
28
- auth = new auth_1.APIAuth(this);
29
29
  constructor(url) {
30
30
  this.url = url;
31
31
  }
package/dist/index.d.ts CHANGED
@@ -4,10 +4,10 @@ export * from './external/types';
4
4
  export * from './external/vars';
5
5
  export * from './classes/permissions';
6
6
  export * from './classes/categories';
7
+ export * from './classes/sessions';
7
8
  export * from './classes/invites';
8
9
  export * from './classes/metrics';
9
10
  export * from './classes/groups';
10
11
  export * from './classes/boards';
11
12
  export * from './classes/admin';
12
13
  export * from './classes/users';
13
- export * from './classes/auth';
package/dist/index.js CHANGED
@@ -20,10 +20,10 @@ __exportStar(require("./external/types"), exports);
20
20
  __exportStar(require("./external/vars"), exports);
21
21
  __exportStar(require("./classes/permissions"), exports);
22
22
  __exportStar(require("./classes/categories"), exports);
23
+ __exportStar(require("./classes/sessions"), exports);
23
24
  __exportStar(require("./classes/invites"), exports);
24
25
  __exportStar(require("./classes/metrics"), exports);
25
26
  __exportStar(require("./classes/groups"), exports);
26
27
  __exportStar(require("./classes/boards"), exports);
27
28
  __exportStar(require("./classes/admin"), exports);
28
29
  __exportStar(require("./classes/users"), exports);
29
- __exportStar(require("./classes/auth"), exports);
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/types.ts","../src/classes/admin.ts","../src/classes/auth.ts","../src/classes/boards.ts","../src/classes/categories.ts","../src/classes/groups.ts","../src/classes/invites.ts","../src/classes/metrics.ts","../src/classes/permissions.ts","../src/classes/users.ts","../src/core/manager.ts","../src/core/utils.ts","../src/external/types.ts","../src/external/vars.ts"],"version":"5.9.2"}
1
+ {"root":["../src/index.ts","../src/types.ts","../src/classes/admin.ts","../src/classes/boards.ts","../src/classes/categories.ts","../src/classes/groups.ts","../src/classes/invites.ts","../src/classes/metrics.ts","../src/classes/permissions.ts","../src/classes/sessions.ts","../src/classes/users.ts","../src/core/manager.ts","../src/core/utils.ts","../src/external/types.ts","../src/external/vars.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.1-dev.13",
2
+ "version": "1.1.1-dev.14",
3
3
  "name": "@excali-boards/boards-api-client",
4
4
  "description": "A simple API client for the Boards API.",
5
5
  "repository": "https://github.com/Excali-Boards/boards-api-client",
@@ -1,26 +0,0 @@
1
- import { Platforms } from '../../prisma/generated/default';
2
- import { BoardsManager } from '../core/manager';
3
- export declare class APIAuth {
4
- private web;
5
- constructor(web: BoardsManager);
6
- authenticate({ auth, body }: AuthFunctionsInput['authenticate']): Promise<import("..").WebResponse<AuthenticateOutput>>;
7
- }
8
- export type AuthFunctionsInput = {
9
- 'authenticate': {
10
- auth: string;
11
- body: AuthenticateInput;
12
- };
13
- };
14
- export type AuthenticateInput = {
15
- platform: Platforms;
16
- email: string;
17
- displayName: string;
18
- avatarUrl?: string | null;
19
- currentUserId?: string;
20
- };
21
- export type AuthenticateOutput = {
22
- email: string;
23
- displayName: string | null;
24
- avatarUrl: string | null;
25
- platform: Platforms;
26
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APIAuth = void 0;
4
- // Data.
5
- class APIAuth {
6
- web;
7
- constructor(web) {
8
- this.web = web;
9
- }
10
- // Methods.
11
- async authenticate({ auth, body }) {
12
- return await this.web.request({
13
- method: 'POST', auth, body,
14
- endpoint: this.web.qp('/auth'),
15
- });
16
- }
17
- }
18
- exports.APIAuth = APIAuth;