@totoday/quinn-sdk 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -5
- package/dist/services/competencies.d.ts +6 -2
- package/dist/services/competencies.js +23 -1
- package/dist/services/courses.d.ts +7 -2
- package/dist/services/courses.js +26 -1
- package/dist/services/groups.d.ts +8 -2
- package/dist/services/groups.js +28 -1
- package/dist/services/knowledge.d.ts +24 -0
- package/dist/services/knowledge.js +52 -0
- package/dist/services/programs.d.ts +2 -1
- package/dist/services/programs.js +4 -0
- package/dist/services/roles.d.ts +7 -2
- package/dist/services/roles.js +22 -1
- package/dist/types.d.ts +138 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { CompetenciesService } from './services/competencies';
|
|
|
3
3
|
import { CoursesService } from './services/courses';
|
|
4
4
|
import { EndorsementsService } from './services/endorsements';
|
|
5
5
|
import { GroupsService } from './services/groups';
|
|
6
|
+
import { KnowledgeService } from './services/knowledge';
|
|
6
7
|
import { LevelsService } from './services/levels';
|
|
7
8
|
import { MembersService } from './services/members';
|
|
8
9
|
import { OrganizationsService } from './services/organizations';
|
|
@@ -15,10 +16,12 @@ export { DEFAULT_QUINN_API_URL, resolveApiUrl, resolveConfigPath, } from './conf
|
|
|
15
16
|
export type { QuinnClientConfig } from './config';
|
|
16
17
|
export type { QuinnMutationAccess } from './mutation-access';
|
|
17
18
|
export { QuinnMutationAccessError } from './mutation-access';
|
|
19
|
+
export { KnowledgeDocumentsService, KnowledgeFoldersService, KnowledgeService, } from './services/knowledge';
|
|
18
20
|
export declare class Quinn {
|
|
19
21
|
private readonly config;
|
|
20
22
|
private readonly http;
|
|
21
23
|
readonly organizations: OrganizationsService;
|
|
24
|
+
readonly knowledge: KnowledgeService;
|
|
22
25
|
readonly members: MembersService;
|
|
23
26
|
readonly roles: RolesService;
|
|
24
27
|
readonly levels: LevelsService;
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Quinn = exports.QuinnMutationAccessError = exports.resolveConfigPath = exports.resolveApiUrl = exports.DEFAULT_QUINN_API_URL = exports.QuinnAuth = void 0;
|
|
17
|
+
exports.Quinn = exports.KnowledgeService = exports.KnowledgeFoldersService = exports.KnowledgeDocumentsService = exports.QuinnMutationAccessError = exports.resolveConfigPath = exports.resolveApiUrl = exports.DEFAULT_QUINN_API_URL = exports.QuinnAuth = void 0;
|
|
18
18
|
const config_1 = require("./config");
|
|
19
19
|
const http_1 = require("./http");
|
|
20
20
|
const mutation_access_1 = require("./mutation-access");
|
|
@@ -22,6 +22,7 @@ const competencies_1 = require("./services/competencies");
|
|
|
22
22
|
const courses_1 = require("./services/courses");
|
|
23
23
|
const endorsements_1 = require("./services/endorsements");
|
|
24
24
|
const groups_1 = require("./services/groups");
|
|
25
|
+
const knowledge_1 = require("./services/knowledge");
|
|
25
26
|
const levels_1 = require("./services/levels");
|
|
26
27
|
const members_1 = require("./services/members");
|
|
27
28
|
const organizations_1 = require("./services/organizations");
|
|
@@ -37,10 +38,15 @@ Object.defineProperty(exports, "resolveApiUrl", { enumerable: true, get: functio
|
|
|
37
38
|
Object.defineProperty(exports, "resolveConfigPath", { enumerable: true, get: function () { return config_2.resolveConfigPath; } });
|
|
38
39
|
var mutation_access_2 = require("./mutation-access");
|
|
39
40
|
Object.defineProperty(exports, "QuinnMutationAccessError", { enumerable: true, get: function () { return mutation_access_2.QuinnMutationAccessError; } });
|
|
41
|
+
var knowledge_2 = require("./services/knowledge");
|
|
42
|
+
Object.defineProperty(exports, "KnowledgeDocumentsService", { enumerable: true, get: function () { return knowledge_2.KnowledgeDocumentsService; } });
|
|
43
|
+
Object.defineProperty(exports, "KnowledgeFoldersService", { enumerable: true, get: function () { return knowledge_2.KnowledgeFoldersService; } });
|
|
44
|
+
Object.defineProperty(exports, "KnowledgeService", { enumerable: true, get: function () { return knowledge_2.KnowledgeService; } });
|
|
40
45
|
class Quinn {
|
|
41
46
|
config;
|
|
42
47
|
http;
|
|
43
48
|
organizations;
|
|
49
|
+
knowledge;
|
|
44
50
|
members;
|
|
45
51
|
roles;
|
|
46
52
|
levels;
|
|
@@ -60,12 +66,13 @@ class Quinn {
|
|
|
60
66
|
orgId: this.config.orgId,
|
|
61
67
|
});
|
|
62
68
|
this.organizations = new organizations_1.OrganizationsService(this.http, this.assertMutationAllowed);
|
|
69
|
+
this.knowledge = new knowledge_1.KnowledgeService(this.http);
|
|
63
70
|
this.members = new members_1.MembersService(this.http, this.assertMutationAllowed);
|
|
64
|
-
this.roles = new roles_1.RolesService(this.http);
|
|
71
|
+
this.roles = new roles_1.RolesService(this.http, this.assertMutationAllowed);
|
|
65
72
|
this.levels = new levels_1.LevelsService(this.http);
|
|
66
|
-
this.competencies = new competencies_1.CompetenciesService(this.http);
|
|
67
|
-
this.courses = new courses_1.CoursesService(this.http);
|
|
68
|
-
this.groups = new groups_1.GroupsService(this.http);
|
|
73
|
+
this.competencies = new competencies_1.CompetenciesService(this.http, this.assertMutationAllowed);
|
|
74
|
+
this.courses = new courses_1.CoursesService(this.http, this.assertMutationAllowed);
|
|
75
|
+
this.groups = new groups_1.GroupsService(this.http, this.assertMutationAllowed);
|
|
69
76
|
this.programs = new programs_1.ProgramsService(this.http);
|
|
70
77
|
this.progress = new progress_1.ProgressService(this.http);
|
|
71
78
|
this.endorsements = new endorsements_1.EndorsementsService(this.http, this.assertMutationAllowed);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { CompetenciesListQuery, Competency, Course, PagedResult } from '../types';
|
|
2
|
+
import { CompetenciesCreateInput, CompetenciesListQuery, CompetenciesUpdateInput, Competency, Course, PagedResult } from '../types';
|
|
3
3
|
export declare class CompetenciesService {
|
|
4
4
|
private readonly http;
|
|
5
|
-
|
|
5
|
+
private readonly assertMutationAllowed;
|
|
6
|
+
constructor(http: AxiosInstance, assertMutationAllowed: (operation: string) => void);
|
|
6
7
|
list(query: CompetenciesListQuery): Promise<PagedResult<Competency>>;
|
|
7
8
|
get(id: string): Promise<Competency | null>;
|
|
8
9
|
batchGet(ids: string[]): Promise<Competency[]>;
|
|
9
10
|
listCourses(id: string): Promise<Course[]>;
|
|
11
|
+
create(input: CompetenciesCreateInput): Promise<Competency | null>;
|
|
12
|
+
update(input: CompetenciesUpdateInput): Promise<Competency | null>;
|
|
13
|
+
delete(competencyId: string): Promise<void>;
|
|
10
14
|
}
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CompetenciesService = void 0;
|
|
4
4
|
class CompetenciesService {
|
|
5
5
|
http;
|
|
6
|
-
|
|
6
|
+
assertMutationAllowed;
|
|
7
|
+
constructor(http, assertMutationAllowed) {
|
|
7
8
|
this.http = http;
|
|
9
|
+
this.assertMutationAllowed = assertMutationAllowed;
|
|
8
10
|
}
|
|
9
11
|
async list(query) {
|
|
10
12
|
const resp = await this.http.get('/competencies', { params: query });
|
|
@@ -22,5 +24,25 @@ class CompetenciesService {
|
|
|
22
24
|
const resp = await this.http.get(`/competencies/${id}/courses`);
|
|
23
25
|
return resp.data.items;
|
|
24
26
|
}
|
|
27
|
+
async create(input) {
|
|
28
|
+
this.assertMutationAllowed('competencies.create');
|
|
29
|
+
const resp = await this.http.post('/competencies', input);
|
|
30
|
+
return resp.data.item;
|
|
31
|
+
}
|
|
32
|
+
async update(input) {
|
|
33
|
+
this.assertMutationAllowed('competencies.update');
|
|
34
|
+
const resp = await this.http.patch(`/competencies/${input.competencyId}`, {
|
|
35
|
+
name: input.name,
|
|
36
|
+
description: input.description,
|
|
37
|
+
roleId: input.roleId,
|
|
38
|
+
levelIds: input.levelIds,
|
|
39
|
+
settings: input.settings,
|
|
40
|
+
});
|
|
41
|
+
return resp.data.item;
|
|
42
|
+
}
|
|
43
|
+
async delete(competencyId) {
|
|
44
|
+
this.assertMutationAllowed('competencies.delete');
|
|
45
|
+
await this.http.delete(`/competencies/${competencyId}`);
|
|
46
|
+
}
|
|
25
47
|
}
|
|
26
48
|
exports.CompetenciesService = CompetenciesService;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { Course, PagedResult } from '../types';
|
|
2
|
+
import { AssignedUser, Course, CoursesAssignToGroupsInput, CoursesAssignToUsersInput, CoursesUnassignFromGroupInput, CoursesUnassignFromUserInput, PagedResult } from '../types';
|
|
3
3
|
export declare class CoursesService {
|
|
4
4
|
private readonly http;
|
|
5
|
-
|
|
5
|
+
private readonly assertMutationAllowed;
|
|
6
|
+
constructor(http: AxiosInstance, assertMutationAllowed: (operation: string) => void);
|
|
6
7
|
list(query?: {
|
|
7
8
|
limit?: number;
|
|
8
9
|
token?: string;
|
|
9
10
|
}): Promise<PagedResult<Course>>;
|
|
10
11
|
get(id: string): Promise<Course | null>;
|
|
11
12
|
batchGet(ids: string[]): Promise<Course[]>;
|
|
13
|
+
assignToUsers(input: CoursesAssignToUsersInput): Promise<AssignedUser[]>;
|
|
14
|
+
assignToGroups(input: CoursesAssignToGroupsInput): Promise<void>;
|
|
15
|
+
unassignFromUser(input: CoursesUnassignFromUserInput): Promise<void>;
|
|
16
|
+
unassignFromGroup(input: CoursesUnassignFromGroupInput): Promise<void>;
|
|
12
17
|
}
|
package/dist/services/courses.js
CHANGED
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CoursesService = void 0;
|
|
4
4
|
class CoursesService {
|
|
5
5
|
http;
|
|
6
|
-
|
|
6
|
+
assertMutationAllowed;
|
|
7
|
+
constructor(http, assertMutationAllowed) {
|
|
7
8
|
this.http = http;
|
|
9
|
+
this.assertMutationAllowed = assertMutationAllowed;
|
|
8
10
|
}
|
|
9
11
|
async list(query = {}) {
|
|
10
12
|
const resp = await this.http.get('/courses', { params: query });
|
|
@@ -18,5 +20,28 @@ class CoursesService {
|
|
|
18
20
|
const resp = await this.http.post('/courses/batch', { ids });
|
|
19
21
|
return resp.data.items;
|
|
20
22
|
}
|
|
23
|
+
async assignToUsers(input) {
|
|
24
|
+
this.assertMutationAllowed('courses.assignToUsers');
|
|
25
|
+
const resp = await this.http.post(`/courses/${input.courseId}/assign/users`, {
|
|
26
|
+
userIds: input.userIds,
|
|
27
|
+
dueDateConfig: input.dueDateConfig,
|
|
28
|
+
});
|
|
29
|
+
return resp.data.assignedUsers;
|
|
30
|
+
}
|
|
31
|
+
async assignToGroups(input) {
|
|
32
|
+
this.assertMutationAllowed('courses.assignToGroups');
|
|
33
|
+
await this.http.post(`/courses/${input.courseId}/assign/groups`, {
|
|
34
|
+
groupIds: input.groupIds,
|
|
35
|
+
dueDateConfig: input.dueDateConfig,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async unassignFromUser(input) {
|
|
39
|
+
this.assertMutationAllowed('courses.unassignFromUser');
|
|
40
|
+
await this.http.delete(`/courses/${input.courseId}/users/${input.userId}`);
|
|
41
|
+
}
|
|
42
|
+
async unassignFromGroup(input) {
|
|
43
|
+
this.assertMutationAllowed('courses.unassignFromGroup');
|
|
44
|
+
await this.http.delete(`/courses/${input.courseId}/groups/${input.groupId}`);
|
|
45
|
+
}
|
|
21
46
|
}
|
|
22
47
|
exports.CoursesService = CoursesService;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { Group, GroupMember } from '../types';
|
|
2
|
+
import { AssignedUser, Group, GroupMember, GroupsAddMembersInput, GroupsCreateInput, GroupsCreateResult, GroupsRemoveMemberInput, GroupsUpdateNameInput } from '../types';
|
|
3
3
|
export declare class GroupsService {
|
|
4
4
|
private readonly http;
|
|
5
|
-
|
|
5
|
+
private readonly assertMutationAllowed;
|
|
6
|
+
constructor(http: AxiosInstance, assertMutationAllowed: (operation: string) => void);
|
|
6
7
|
list(): Promise<Group[]>;
|
|
7
8
|
get(id: string): Promise<Group | null>;
|
|
8
9
|
batchGet(ids: string[]): Promise<Group[]>;
|
|
9
10
|
listMembers(groupId: string): Promise<GroupMember[]>;
|
|
11
|
+
create(input: GroupsCreateInput): Promise<GroupsCreateResult>;
|
|
12
|
+
updateName(input: GroupsUpdateNameInput): Promise<Group | null>;
|
|
13
|
+
delete(groupId: string): Promise<void>;
|
|
14
|
+
addMembers(input: GroupsAddMembersInput): Promise<AssignedUser[]>;
|
|
15
|
+
removeMember(input: GroupsRemoveMemberInput): Promise<void>;
|
|
10
16
|
}
|
package/dist/services/groups.js
CHANGED
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GroupsService = void 0;
|
|
4
4
|
class GroupsService {
|
|
5
5
|
http;
|
|
6
|
-
|
|
6
|
+
assertMutationAllowed;
|
|
7
|
+
constructor(http, assertMutationAllowed) {
|
|
7
8
|
this.http = http;
|
|
9
|
+
this.assertMutationAllowed = assertMutationAllowed;
|
|
8
10
|
}
|
|
9
11
|
async list() {
|
|
10
12
|
const resp = await this.http.get('/groups');
|
|
@@ -22,5 +24,30 @@ class GroupsService {
|
|
|
22
24
|
const resp = await this.http.get(`/groups/${groupId}/members`);
|
|
23
25
|
return resp.data.items;
|
|
24
26
|
}
|
|
27
|
+
async create(input) {
|
|
28
|
+
this.assertMutationAllowed('groups.create');
|
|
29
|
+
const resp = await this.http.post('/groups', input);
|
|
30
|
+
return resp.data;
|
|
31
|
+
}
|
|
32
|
+
async updateName(input) {
|
|
33
|
+
this.assertMutationAllowed('groups.updateName');
|
|
34
|
+
const resp = await this.http.put(`/groups/${input.groupId}/name`, { name: input.name });
|
|
35
|
+
return resp.data.item;
|
|
36
|
+
}
|
|
37
|
+
async delete(groupId) {
|
|
38
|
+
this.assertMutationAllowed('groups.delete');
|
|
39
|
+
await this.http.delete(`/groups/${groupId}`);
|
|
40
|
+
}
|
|
41
|
+
async addMembers(input) {
|
|
42
|
+
this.assertMutationAllowed('groups.addMembers');
|
|
43
|
+
const resp = await this.http.post(`/groups/${input.groupId}/members`, {
|
|
44
|
+
userIds: input.userIds,
|
|
45
|
+
});
|
|
46
|
+
return resp.data.assignedUsers;
|
|
47
|
+
}
|
|
48
|
+
async removeMember(input) {
|
|
49
|
+
this.assertMutationAllowed('groups.removeMember');
|
|
50
|
+
await this.http.delete(`/groups/${input.groupId}/members/${input.userId}`);
|
|
51
|
+
}
|
|
25
52
|
}
|
|
26
53
|
exports.GroupsService = GroupsService;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { GetDocumentTranscriptResponse, KnowledgeDocument, KnowledgeDocumentsListQuery, KnowledgeFolder, KnowledgeFoldersListQuery, KnowledgeSearchHit, KnowledgeSearchInput, PagedResult } from '../types';
|
|
3
|
+
export declare class KnowledgeDocumentsService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: AxiosInstance);
|
|
6
|
+
list(query?: KnowledgeDocumentsListQuery): Promise<PagedResult<KnowledgeDocument>>;
|
|
7
|
+
get(id: string): Promise<KnowledgeDocument | null>;
|
|
8
|
+
getTranscript(id: string): Promise<GetDocumentTranscriptResponse>;
|
|
9
|
+
}
|
|
10
|
+
export declare class KnowledgeFoldersService {
|
|
11
|
+
private readonly http;
|
|
12
|
+
constructor(http: AxiosInstance);
|
|
13
|
+
list(query?: KnowledgeFoldersListQuery): Promise<{
|
|
14
|
+
items: KnowledgeFolder[];
|
|
15
|
+
}>;
|
|
16
|
+
get(id: string): Promise<KnowledgeFolder | null>;
|
|
17
|
+
}
|
|
18
|
+
export declare class KnowledgeService {
|
|
19
|
+
private readonly http;
|
|
20
|
+
readonly documents: KnowledgeDocumentsService;
|
|
21
|
+
readonly folders: KnowledgeFoldersService;
|
|
22
|
+
constructor(http: AxiosInstance);
|
|
23
|
+
search(input: KnowledgeSearchInput): Promise<KnowledgeSearchHit[]>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KnowledgeService = exports.KnowledgeFoldersService = exports.KnowledgeDocumentsService = void 0;
|
|
4
|
+
class KnowledgeDocumentsService {
|
|
5
|
+
http;
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async list(query = {}) {
|
|
10
|
+
const resp = await this.http.get('/knowledge/documents', { params: query });
|
|
11
|
+
return resp.data;
|
|
12
|
+
}
|
|
13
|
+
async get(id) {
|
|
14
|
+
const resp = await this.http.get(`/knowledge/documents/${id}`);
|
|
15
|
+
return resp.data.item;
|
|
16
|
+
}
|
|
17
|
+
async getTranscript(id) {
|
|
18
|
+
const resp = await this.http.get(`/knowledge/documents/${id}/transcript`);
|
|
19
|
+
return resp.data;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.KnowledgeDocumentsService = KnowledgeDocumentsService;
|
|
23
|
+
class KnowledgeFoldersService {
|
|
24
|
+
http;
|
|
25
|
+
constructor(http) {
|
|
26
|
+
this.http = http;
|
|
27
|
+
}
|
|
28
|
+
async list(query = {}) {
|
|
29
|
+
const resp = await this.http.get('/knowledge/folders', { params: query });
|
|
30
|
+
return resp.data;
|
|
31
|
+
}
|
|
32
|
+
async get(id) {
|
|
33
|
+
const resp = await this.http.get(`/knowledge/folders/${id}`);
|
|
34
|
+
return resp.data.item;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.KnowledgeFoldersService = KnowledgeFoldersService;
|
|
38
|
+
class KnowledgeService {
|
|
39
|
+
http;
|
|
40
|
+
documents;
|
|
41
|
+
folders;
|
|
42
|
+
constructor(http) {
|
|
43
|
+
this.http = http;
|
|
44
|
+
this.documents = new KnowledgeDocumentsService(http);
|
|
45
|
+
this.folders = new KnowledgeFoldersService(http);
|
|
46
|
+
}
|
|
47
|
+
async search(input) {
|
|
48
|
+
const resp = await this.http.post('/knowledge/search', input);
|
|
49
|
+
return resp.data.items;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.KnowledgeService = KnowledgeService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { PagedResult, Program } from '../types';
|
|
2
|
+
import { Course, PagedResult, Program } from '../types';
|
|
3
3
|
export declare class ProgramsService {
|
|
4
4
|
private readonly http;
|
|
5
5
|
constructor(http: AxiosInstance);
|
|
@@ -9,4 +9,5 @@ export declare class ProgramsService {
|
|
|
9
9
|
}): Promise<PagedResult<Program>>;
|
|
10
10
|
get(id: string): Promise<Program | null>;
|
|
11
11
|
batchGet(ids: string[]): Promise<Program[]>;
|
|
12
|
+
listCourses(id: string): Promise<Course[]>;
|
|
12
13
|
}
|
|
@@ -18,5 +18,9 @@ class ProgramsService {
|
|
|
18
18
|
const resp = await this.http.post('/programs/batch', { ids });
|
|
19
19
|
return resp.data.items;
|
|
20
20
|
}
|
|
21
|
+
async listCourses(id) {
|
|
22
|
+
const resp = await this.http.get(`/programs/${id}/courses`);
|
|
23
|
+
return resp.data.items;
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
26
|
exports.ProgramsService = ProgramsService;
|
package/dist/services/roles.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { Role } from '../types';
|
|
2
|
+
import { Role, RolesCreateInput, RolesUpdateInput, RolesUpdateLevelsInput, Level } from '../types';
|
|
3
3
|
export declare class RolesService {
|
|
4
4
|
private readonly http;
|
|
5
|
-
|
|
5
|
+
private readonly assertMutationAllowed;
|
|
6
|
+
constructor(http: AxiosInstance, assertMutationAllowed: (operation: string) => void);
|
|
6
7
|
list(): Promise<Role[]>;
|
|
7
8
|
get(id: string): Promise<Role | null>;
|
|
8
9
|
batchGet(ids: string[]): Promise<Role[]>;
|
|
10
|
+
create(input: RolesCreateInput): Promise<Role | null>;
|
|
11
|
+
update(input: RolesUpdateInput): Promise<Role | null>;
|
|
12
|
+
delete(roleId: string): Promise<void>;
|
|
13
|
+
updateLevels(input: RolesUpdateLevelsInput): Promise<Level[]>;
|
|
9
14
|
}
|
package/dist/services/roles.js
CHANGED
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RolesService = void 0;
|
|
4
4
|
class RolesService {
|
|
5
5
|
http;
|
|
6
|
-
|
|
6
|
+
assertMutationAllowed;
|
|
7
|
+
constructor(http, assertMutationAllowed) {
|
|
7
8
|
this.http = http;
|
|
9
|
+
this.assertMutationAllowed = assertMutationAllowed;
|
|
8
10
|
}
|
|
9
11
|
async list() {
|
|
10
12
|
const resp = await this.http.get('/roles');
|
|
@@ -18,5 +20,24 @@ class RolesService {
|
|
|
18
20
|
const resp = await this.http.post('/roles/batch', { ids });
|
|
19
21
|
return resp.data.items;
|
|
20
22
|
}
|
|
23
|
+
async create(input) {
|
|
24
|
+
this.assertMutationAllowed('roles.create');
|
|
25
|
+
const resp = await this.http.post('/roles', input);
|
|
26
|
+
return resp.data.item;
|
|
27
|
+
}
|
|
28
|
+
async update(input) {
|
|
29
|
+
this.assertMutationAllowed('roles.update');
|
|
30
|
+
const resp = await this.http.patch(`/roles/${input.roleId}`, { label: input.label });
|
|
31
|
+
return resp.data.item;
|
|
32
|
+
}
|
|
33
|
+
async delete(roleId) {
|
|
34
|
+
this.assertMutationAllowed('roles.delete');
|
|
35
|
+
await this.http.delete(`/roles/${roleId}`);
|
|
36
|
+
}
|
|
37
|
+
async updateLevels(input) {
|
|
38
|
+
this.assertMutationAllowed('roles.updateLevels');
|
|
39
|
+
const resp = await this.http.put(`/roles/${input.roleId}/levels`, { levels: input.levels });
|
|
40
|
+
return resp.data.items;
|
|
41
|
+
}
|
|
21
42
|
}
|
|
22
43
|
exports.RolesService = RolesService;
|
package/dist/types.d.ts
CHANGED
|
@@ -18,13 +18,6 @@ export interface Organization {
|
|
|
18
18
|
}
|
|
19
19
|
export interface OrganizationDetails {
|
|
20
20
|
organization: Organization | null;
|
|
21
|
-
stats: {
|
|
22
|
-
members: number;
|
|
23
|
-
managers: number;
|
|
24
|
-
roles: number;
|
|
25
|
-
levels: number;
|
|
26
|
-
competencies: number;
|
|
27
|
-
};
|
|
28
21
|
}
|
|
29
22
|
export interface OrganizationUpdateInput {
|
|
30
23
|
name?: string;
|
|
@@ -40,7 +33,6 @@ export interface Member {
|
|
|
40
33
|
managerUid: string | null;
|
|
41
34
|
roleIds: string[];
|
|
42
35
|
createdAt: string;
|
|
43
|
-
activatedAt: string | null;
|
|
44
36
|
phoneNumber: string | null;
|
|
45
37
|
}
|
|
46
38
|
export interface MembersListQuery extends PaginationQuery {
|
|
@@ -86,6 +78,21 @@ export interface Role {
|
|
|
86
78
|
createdAt: string;
|
|
87
79
|
updatedAt: string;
|
|
88
80
|
}
|
|
81
|
+
export interface RolesCreateInput {
|
|
82
|
+
label: string;
|
|
83
|
+
}
|
|
84
|
+
export interface RolesUpdateInput {
|
|
85
|
+
roleId: string;
|
|
86
|
+
label?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface RoleLevelInput {
|
|
89
|
+
id?: string;
|
|
90
|
+
name: string;
|
|
91
|
+
}
|
|
92
|
+
export interface RolesUpdateLevelsInput {
|
|
93
|
+
roleId: string;
|
|
94
|
+
levels: RoleLevelInput[];
|
|
95
|
+
}
|
|
89
96
|
export interface Level {
|
|
90
97
|
id: string;
|
|
91
98
|
roleId: string;
|
|
@@ -105,12 +112,32 @@ export interface LevelsListQuery extends PaginationQuery {
|
|
|
105
112
|
export interface Competency {
|
|
106
113
|
id: string;
|
|
107
114
|
name: string;
|
|
115
|
+
description: string;
|
|
108
116
|
creatorUid: string;
|
|
109
117
|
createdAt: string;
|
|
110
118
|
settings?: {
|
|
111
119
|
managerOnlyEndorsement: boolean;
|
|
112
120
|
};
|
|
113
121
|
}
|
|
122
|
+
export interface CompetenciesCreateInput {
|
|
123
|
+
name: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
roleId: string;
|
|
126
|
+
levelIds: string[];
|
|
127
|
+
settings?: {
|
|
128
|
+
managerOnlyEndorsement?: boolean;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export interface CompetenciesUpdateInput {
|
|
132
|
+
competencyId: string;
|
|
133
|
+
name?: string;
|
|
134
|
+
description?: string;
|
|
135
|
+
roleId?: string;
|
|
136
|
+
levelIds?: string[];
|
|
137
|
+
settings?: {
|
|
138
|
+
managerOnlyEndorsement?: boolean;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
114
141
|
export interface CompetenciesListQuery extends PaginationQuery {
|
|
115
142
|
roleId: string;
|
|
116
143
|
levelId: string;
|
|
@@ -122,6 +149,88 @@ export interface Course {
|
|
|
122
149
|
creatorUid: string;
|
|
123
150
|
createdAt: string;
|
|
124
151
|
}
|
|
152
|
+
export type DueDateType = 'fixed' | 'relative';
|
|
153
|
+
export interface AssignmentDueConfig {
|
|
154
|
+
type: DueDateType;
|
|
155
|
+
fixedDate?: string;
|
|
156
|
+
timezone?: string;
|
|
157
|
+
relativeDays?: number;
|
|
158
|
+
}
|
|
159
|
+
export interface AssignedUser {
|
|
160
|
+
email: string;
|
|
161
|
+
userId: string;
|
|
162
|
+
assigned: boolean;
|
|
163
|
+
}
|
|
164
|
+
export interface CoursesAssignToUsersInput {
|
|
165
|
+
courseId: string;
|
|
166
|
+
userIds: string[];
|
|
167
|
+
dueDateConfig?: AssignmentDueConfig;
|
|
168
|
+
}
|
|
169
|
+
export interface CoursesAssignToGroupsInput {
|
|
170
|
+
courseId: string;
|
|
171
|
+
groupIds: string[];
|
|
172
|
+
dueDateConfig?: AssignmentDueConfig;
|
|
173
|
+
}
|
|
174
|
+
export interface CoursesUnassignFromUserInput {
|
|
175
|
+
courseId: string;
|
|
176
|
+
userId: string;
|
|
177
|
+
}
|
|
178
|
+
export interface CoursesUnassignFromGroupInput {
|
|
179
|
+
courseId: string;
|
|
180
|
+
groupId: string;
|
|
181
|
+
}
|
|
182
|
+
export interface KnowledgeSearchInput {
|
|
183
|
+
query: string;
|
|
184
|
+
folderId?: string;
|
|
185
|
+
size?: number;
|
|
186
|
+
}
|
|
187
|
+
export interface KnowledgeSearchHit {
|
|
188
|
+
id: string;
|
|
189
|
+
type: string;
|
|
190
|
+
text: string;
|
|
191
|
+
documentId?: string | null;
|
|
192
|
+
courseId?: string | null;
|
|
193
|
+
blockId?: string | null;
|
|
194
|
+
metadata?: Record<string, unknown>;
|
|
195
|
+
}
|
|
196
|
+
export interface KnowledgeDocument {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
uid: string;
|
|
200
|
+
orgId: string;
|
|
201
|
+
parentId: string;
|
|
202
|
+
parentType: string;
|
|
203
|
+
status: string;
|
|
204
|
+
extFileId: string | null;
|
|
205
|
+
contentType: string | null;
|
|
206
|
+
originalContentLength: number;
|
|
207
|
+
contentLength: number;
|
|
208
|
+
downloadable: boolean;
|
|
209
|
+
folderId: string | null;
|
|
210
|
+
createdAt: string;
|
|
211
|
+
updatedAt: string;
|
|
212
|
+
}
|
|
213
|
+
export interface KnowledgeDocumentsListQuery extends PaginationQuery {
|
|
214
|
+
folderId?: string;
|
|
215
|
+
name?: string;
|
|
216
|
+
includePackFiles?: boolean;
|
|
217
|
+
}
|
|
218
|
+
export interface GetDocumentTranscriptResponse {
|
|
219
|
+
content: string;
|
|
220
|
+
}
|
|
221
|
+
export interface KnowledgeFolder {
|
|
222
|
+
id: string;
|
|
223
|
+
orgId: string;
|
|
224
|
+
name: string;
|
|
225
|
+
parentId: string | null;
|
|
226
|
+
createdBy: string;
|
|
227
|
+
children?: KnowledgeFolder[];
|
|
228
|
+
createdAt: string;
|
|
229
|
+
updatedAt: string;
|
|
230
|
+
}
|
|
231
|
+
export interface KnowledgeFoldersListQuery {
|
|
232
|
+
parentId?: string;
|
|
233
|
+
}
|
|
125
234
|
export interface Group {
|
|
126
235
|
id: string;
|
|
127
236
|
name: string;
|
|
@@ -134,14 +243,32 @@ export interface GroupMember {
|
|
|
134
243
|
addedByUid: string;
|
|
135
244
|
addedAt: string;
|
|
136
245
|
}
|
|
246
|
+
export interface GroupsCreateInput {
|
|
247
|
+
name: string;
|
|
248
|
+
userIds?: string[];
|
|
249
|
+
}
|
|
250
|
+
export interface GroupsCreateResult {
|
|
251
|
+
group: Group;
|
|
252
|
+
assignedUsers: AssignedUser[];
|
|
253
|
+
}
|
|
254
|
+
export interface GroupsUpdateNameInput {
|
|
255
|
+
groupId: string;
|
|
256
|
+
name: string;
|
|
257
|
+
}
|
|
258
|
+
export interface GroupsAddMembersInput {
|
|
259
|
+
groupId: string;
|
|
260
|
+
userIds: string[];
|
|
261
|
+
}
|
|
262
|
+
export interface GroupsRemoveMemberInput {
|
|
263
|
+
groupId: string;
|
|
264
|
+
userId: string;
|
|
265
|
+
}
|
|
137
266
|
export interface Program {
|
|
138
267
|
id: string;
|
|
139
268
|
name: string;
|
|
269
|
+
description: string;
|
|
140
270
|
creatorUid: string;
|
|
141
271
|
createdAt: string;
|
|
142
|
-
settings?: {
|
|
143
|
-
managerOnlyEndorsement: boolean;
|
|
144
|
-
};
|
|
145
272
|
}
|
|
146
273
|
export interface Progress {
|
|
147
274
|
id: string;
|