@neuralinnovations/dataisland-sdk 0.0.1-dev21 → 0.0.1-dev23

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.
Files changed (31) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/index.d.ts +3 -0
  3. package/dist/src/index.d.ts.map +1 -1
  4. package/dist/src/index.js +5 -1
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/storages/groups/group.d.ts +63 -0
  7. package/dist/src/storages/groups/group.d.ts.map +1 -0
  8. package/dist/src/storages/groups/group.impl.d.ts +37 -0
  9. package/dist/src/storages/groups/group.impl.d.ts.map +1 -0
  10. package/dist/src/storages/groups/group.impl.js +205 -0
  11. package/dist/src/storages/groups/group.impl.js.map +1 -0
  12. package/dist/src/storages/groups/group.js +15 -0
  13. package/dist/src/storages/groups/group.js.map +1 -0
  14. package/dist/src/storages/groups/groups.d.ts +3 -55
  15. package/dist/src/storages/groups/groups.d.ts.map +1 -1
  16. package/dist/src/storages/groups/groups.impl.d.ts +2 -33
  17. package/dist/src/storages/groups/groups.impl.d.ts.map +1 -1
  18. package/dist/src/storages/groups/groups.impl.js +14 -175
  19. package/dist/src/storages/groups/groups.impl.js.map +1 -1
  20. package/dist/src/storages/groups/groups.js +7 -13
  21. package/dist/src/storages/groups/groups.js.map +1 -1
  22. package/dist/src/storages/organizations/organization.d.ts +2 -1
  23. package/dist/src/storages/organizations/organization.d.ts.map +1 -1
  24. package/dist/src/storages/organizations/organization.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/index.ts +3 -0
  27. package/src/storages/groups/group.impl.ts +267 -0
  28. package/src/storages/groups/group.ts +73 -0
  29. package/src/storages/groups/groups.impl.ts +17 -228
  30. package/src/storages/groups/groups.ts +3 -64
  31. package/src/storages/organizations/organization.ts +2 -1
@@ -1,174 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GroupsImpl = exports.GroupImpl = void 0;
3
+ exports.GroupsImpl = void 0;
4
4
  const rpcService_1 = require("../../services/rpcService");
5
5
  const groups_1 = require("./groups");
6
6
  const responseUtils_1 = require("../../services/responseUtils");
7
- class GroupImpl extends groups_1.Group {
8
- constructor(context, organization) {
9
- super();
10
- this.context = context;
11
- this.organization = organization;
12
- this._isDisposed = false;
13
- this._workspaces = [];
14
- }
15
- async initFrom(id) {
16
- await this.reloadGroup(id);
17
- await this.reloadWorkspaces();
18
- return this;
19
- }
20
- async reloadGroup(id) {
21
- var _a;
22
- // fetch group
23
- const response = await ((_a = this.context.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/AccessGroups").searchParam("groupId", id).sendGet());
24
- // check response status
25
- if (responseUtils_1.ResponseUtils.isFail(response)) {
26
- await responseUtils_1.ResponseUtils.throwError(`Failed to get group: ${id}, organization: ${this.organization.id}`, response);
27
- }
28
- // parse group from the server's response
29
- const group = (await response.json());
30
- // init group
31
- this._content = group.group;
32
- this._members = group.members;
33
- }
34
- async reloadWorkspaces() {
35
- const groupWorkspaces = await this.loadWorkspaces(this.id);
36
- this._workspaces.length = 0;
37
- this._workspaces.push(...groupWorkspaces);
38
- }
39
- async loadWorkspaces(groupId) {
40
- var _a;
41
- // fetch workspaces
42
- const response = await ((_a = this.context.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/AccessGroups/workspaces").searchParam("groupId", groupId).sendGet());
43
- if (responseUtils_1.ResponseUtils.isFail(response)) {
44
- await responseUtils_1.ResponseUtils.throwError(`Failed to get workspaces for group: ${this.id}, organization: ${this.organization.id}`, response);
45
- }
46
- // parse workspaces from the server's response
47
- const workspaces = (await response.json());
48
- // get workspaces
49
- const result = [];
50
- for (const workspaceDto of workspaces.workspaces) {
51
- result.push(this.organization.workspaces.get(workspaceDto.id));
52
- }
53
- return result;
54
- }
55
- get id() {
56
- if (this._content) {
57
- return this._content.id;
58
- }
59
- throw new Error("Access group is not loaded.");
60
- }
61
- get group() {
62
- if (this._content) {
63
- return this._content;
64
- }
65
- throw new Error("Access group is not loaded.");
66
- }
67
- get workspaces() {
68
- return this._workspaces;
69
- }
70
- get members() {
71
- if (this._members) {
72
- return this._members;
73
- }
74
- throw new Error("Access group is not loaded.");
75
- }
76
- async setName(name) {
77
- var _a;
78
- if (name === undefined || name === null) {
79
- throw new Error("Groups change, name is undefined or null");
80
- }
81
- if (name.length === 0 || name.trim().length === 0) {
82
- throw new Error("Groups change, name is empty");
83
- }
84
- // send request to the server
85
- const response = await ((_a = this.context
86
- .resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/AccessGroups/name").sendPutJson({
87
- groupId: this.id,
88
- name: name
89
- }));
90
- // check response status
91
- if (responseUtils_1.ResponseUtils.isFail(response)) {
92
- await responseUtils_1.ResponseUtils.throwError(`Failed to change group name, group: ${this.id}, organization: ${this.organization.id}`, response);
93
- }
94
- // change name
95
- if (this._content) {
96
- this._content.name = name;
97
- }
98
- }
99
- async setPermits(permits) {
100
- var _a;
101
- // send request to the server
102
- const response = await ((_a = this.context
103
- .resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/AccessGroups/permits").sendPutJson({
104
- groupId: this.id,
105
- permits: permits
106
- }));
107
- if (responseUtils_1.ResponseUtils.isFail(response)) {
108
- await responseUtils_1.ResponseUtils.throwError(`Failed to change group permits, group: ${this.id}, organization: ${this.organization.id}`, response);
109
- }
110
- }
111
- async setWorkspaces(workspaces) {
112
- var _a;
113
- if (workspaces === null || workspaces === undefined) {
114
- throw new Error("Group add workspaces, workspaces is undefined or null");
115
- }
116
- // send request to the server
117
- const response = await ((_a = this.context
118
- .resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/AccessGroups/workspaces").sendPutJson({
119
- groupId: this.id,
120
- actualWorkspaceIds: workspaces
121
- }));
122
- if (responseUtils_1.ResponseUtils.isFail(response)) {
123
- await responseUtils_1.ResponseUtils.throwError(`Failed to set workspaces for group: ${this.id}, organization: ${this.organization.id}`, response);
124
- }
125
- // reload workspaces
126
- await this.reloadWorkspaces();
127
- }
128
- async setMembersIds(members) {
129
- var _a;
130
- if (members === null || members === undefined) {
131
- throw new Error("Group setMembersIds, members is undefined or null");
132
- }
133
- // send request to the server
134
- const response = await ((_a = this.context
135
- .resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/AccessGroups/members").sendPutJson({
136
- groupId: this.id,
137
- memberIds: members
138
- }));
139
- if (responseUtils_1.ResponseUtils.isFail(response)) {
140
- await responseUtils_1.ResponseUtils.throwError(`Failed to set members for group: ${this.id}, organization: ${this.organization.id}`, response);
141
- }
142
- // reload group
143
- await this.reloadGroup(this.id);
144
- }
145
- async removeMembers(members) {
146
- // check members
147
- if (members === null || members === undefined) {
148
- throw new Error("Group removeMembers, members is undefined or null");
149
- }
150
- // make set of members
151
- const groupMembers = new Set(this.members.map(m => m.id));
152
- // check argument
153
- if (!members.every(m => groupMembers.has(m))) {
154
- const notExistingMembers = members.filter(memberId => !groupMembers.has(memberId));
155
- throw new Error(`Group removeMembers, members contains not existing members: ${notExistingMembers}`);
156
- }
157
- // remove members
158
- for (const id of members) {
159
- groupMembers.delete(id);
160
- }
161
- // send request to the server
162
- await this.setMembersIds(Array.from(groupMembers));
163
- }
164
- get isDisposed() {
165
- return this._isDisposed;
166
- }
167
- dispose() {
168
- this._isDisposed = true;
169
- }
170
- }
171
- exports.GroupImpl = GroupImpl;
7
+ const group_impl_1 = require("./group.impl");
172
8
  class GroupsImpl extends groups_1.Groups {
173
9
  constructor(organization, context) {
174
10
  super();
@@ -207,17 +43,20 @@ class GroupsImpl extends groups_1.Groups {
207
43
  }
208
44
  // parse groups from the server's response
209
45
  const groups = (await response.json());
46
+ const wait = [];
210
47
  // init groups
211
48
  for (const gr of groups.groups) {
212
49
  // create group implementation
213
- const group = await new GroupImpl(this.context, this.organization).initFrom(gr.id);
50
+ const group = new group_impl_1.GroupImpl(this.context, this.organization).initFrom(gr.id);
51
+ // add to the wait list
52
+ wait.push(group);
53
+ }
54
+ // wait for all groups
55
+ const groupsResult = await Promise.all(wait);
56
+ // add groups to the collection
57
+ for (const group of groupsResult) {
214
58
  // add group to the collection
215
59
  this._groups.push(group);
216
- // dispatch event
217
- this.dispatch({
218
- type: groups_1.GroupEvent.ADDED,
219
- data: group
220
- });
221
60
  }
222
61
  }
223
62
  async internalCreate(name, permits, memberIds) {
@@ -243,12 +82,12 @@ class GroupsImpl extends groups_1.Groups {
243
82
  // parse group from the server's response
244
83
  const content = (await response.json());
245
84
  // create group implementation
246
- const group = await new GroupImpl(this.context, this.organization).initFrom(content.group.id);
85
+ const group = await new group_impl_1.GroupImpl(this.context, this.organization).initFrom(content.group.id);
247
86
  // add group to the collection
248
87
  this._groups.push(group);
249
88
  // dispatch event
250
89
  this.dispatch({
251
- type: groups_1.GroupEvent.ADDED,
90
+ type: groups_1.GroupsEvent.ADDED,
252
91
  data: group
253
92
  });
254
93
  return group;
@@ -282,7 +121,7 @@ class GroupsImpl extends groups_1.Groups {
282
121
  this._groups.splice(index, 1);
283
122
  // dispatch event, group removed
284
123
  this.dispatch({
285
- type: groups_1.GroupEvent.REMOVED,
124
+ type: groups_1.GroupsEvent.REMOVED,
286
125
  data: group
287
126
  });
288
127
  // dispose group
@@ -1 +1 @@
1
- {"version":3,"file":"groups.impl.js","sourceRoot":"","sources":["../../../../src/storages/groups/groups.impl.ts"],"names":[],"mappings":";;;AASA,0DAAsD;AACtD,qCAA6D;AAE7D,gEAA4D;AAK5D,MAAa,SAAU,SAAQ,cAAK;IAMlC,YACmB,OAAgB,EACjB,YAA0B;QAE1C,KAAK,EAAE,CAAA;QAHU,YAAO,GAAP,OAAO,CAAS;QACjB,iBAAY,GAAZ,YAAY,CAAc;QAPpC,gBAAW,GAAY,KAAK,CAAA;QAG5B,gBAAW,GAAgB,EAAE,CAAA;IAOrC,CAAC;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OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,sBAAsB,EACtC,WAAW,CAAC,SAAS,EAAE,EAAE,EACzB,UAAU,EAAE,CAAA,CAAA;QAEf,wBAAwB;QACxB,IAAI,6BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,MAAM,6BAAa,CAAC,UAAU,CAAC,2BAA2B,EAAE,mBAAmB,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAA;QAClH,CAAC;QAED,+BAA+B;QAC/B,MAAM,KAAK,GAAc,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACzC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;QACrD,CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QAE7B,gCAAgC;QAChC,IAAI,CAAC,QAAQ,CAAC;YACZ,IAAI,EAAE,oBAAW,CAAC,OAAO;YACzB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;QAEF,gBAAgB;QAChB,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC;CACF;AAlKD,gCAkKC"}
@@ -1,22 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Groups = exports.Group = exports.GroupEvent = void 0;
3
+ exports.Groups = exports.GroupsEvent = void 0;
4
4
  const events_1 = require("../../events");
5
5
  /**
6
6
  * Group event.
7
7
  */
8
- var GroupEvent;
9
- (function (GroupEvent) {
10
- GroupEvent["ADDED"] = "added";
11
- GroupEvent["REMOVED"] = "removed";
12
- GroupEvent["UPDATED"] = "updated";
13
- })(GroupEvent || (exports.GroupEvent = GroupEvent = {}));
14
- /**
15
- * Group.
16
- */
17
- class Group extends events_1.EventDispatcher {
18
- }
19
- exports.Group = Group;
8
+ var GroupsEvent;
9
+ (function (GroupsEvent) {
10
+ GroupsEvent["ADDED"] = "added";
11
+ GroupsEvent["REMOVED"] = "removed";
12
+ GroupsEvent["UPDATED"] = "updated";
13
+ })(GroupsEvent || (exports.GroupsEvent = GroupsEvent = {}));
20
14
  /**
21
15
  * Groups storage.
22
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../../../src/storages/groups/groups.ts"],"names":[],"mappings":";;;AAEA,yCAA8C;AAU9C;;GAEG;AACH,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED;;GAEG;AACH,MAAsB,KAAM,SAAQ,wBAAkC;CA+CrE;AA/CD,sBA+CC;AAED;;GAEG;AACH,MAAsB,MAAO,SAAQ,wBAAkC;CA6BtE;AA7BD,wBA6BC"}
1
+ {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../../../src/storages/groups/groups.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAG9C;;GAEG;AACH,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED;;GAEG;AACH,MAAsB,MAAO,SAAQ,wBAAmC;CA6BvE;AA7BD,wBA6BC"}
@@ -1,9 +1,10 @@
1
1
  import { Workspaces } from "../workspaces/workspaces";
2
2
  import { OrganizationId } from "./organizations";
3
- import { GroupId, Groups } from "../groups/groups";
3
+ import { Groups } from "../groups/groups";
4
4
  import { Chats } from "../chats/chats";
5
5
  import { EventDispatcher } from "../../events";
6
6
  import { UserDto } from "../../dto/userInfoResponse";
7
+ import { GroupId } from "../groups/group";
7
8
  /**
8
9
  * Organization event.
9
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../../src/storages/organizations/organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGpD;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,8BAAsB,YAAa,SAAQ,eAAe,CAC1D,iBAAiB,EACjB,YAAY,CACX;IACC;;OAEG;IACH,QAAQ,KAAK,EAAE,IAAI,cAAc,CAAA;IAEjC;;OAEG;IACH,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAA;IAE3B;;OAEG;IACH,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAA;IAElC;;OAEG;IACH,QAAQ,KAAK,UAAU,IAAI,UAAU,CAAA;IAErC;;OAEG;IACH,QAAQ,KAAK,KAAK,IAAI,KAAK,CAAA;IAE3B;;OAEG;IACH,QAAQ,KAAK,YAAY,IAAI,MAAM,CAAA;IAEnC;;OAEG;IACH,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjE;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAA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AAE,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CACpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organization.ts"],"names":[],"mappings":";;;AAIA,yCAA8C;AAI9C;;GAEG;AACH,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;AACrB,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B;AAED;;GAEG;AACH,MAAsB,YAAa,SAAQ,wBAG1C;CA6CA;AAhDD,oCAgDC"}
1
+ {"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organization.ts"],"names":[],"mappings":";;;AAIA,yCAA8C;AAK9C;;GAEG;AACH,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;AACrB,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B;AAED;;GAEG;AACH,MAAsB,YAAa,SAAQ,wBAG1C;CA6CA;AAhDD,oCAgDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralinnovations/dataisland-sdk",
3
- "version": "0.0.1-dev21",
3
+ "version": "0.0.1-dev23",
4
4
  "description": "SDK for DataIsland project",
5
5
  "licenses": [
6
6
  {
package/src/index.ts CHANGED
@@ -96,3 +96,6 @@ export async function dataIslandApp(
96
96
  }
97
97
  return await appPromise
98
98
  }
99
+ export { Group } from "./storages/groups/group"
100
+ export { GroupEvent } from "./storages/groups/group"
101
+ export { GroupId } from "./storages/groups/group"
@@ -0,0 +1,267 @@
1
+ import { Group, GroupEvent, GroupId } from "./group"
2
+ import { Disposable } from "../../disposable"
3
+ import {
4
+ AccessGroupDto,
5
+ AccessGroupResponse
6
+ } from "../../dto/accessGroupResponse"
7
+ import { UserDto } from "../../dto/userInfoResponse"
8
+ import { Workspace } from "../workspaces/workspace"
9
+ import { Context } from "../../context"
10
+ import { Organization } from "../organizations/organization"
11
+ import { RpcService } from "../../services/rpcService"
12
+ import { ResponseUtils } from "../../services/responseUtils"
13
+ import { WorkspacesResponse } from "../../dto/workspacesResponse"
14
+ import { WorkspaceId } from "../workspaces/workspaces"
15
+ import { UserId } from "../user/userProfile"
16
+
17
+ export class GroupImpl extends Group implements Disposable {
18
+ private _isDisposed: boolean = false
19
+ private _content?: AccessGroupDto
20
+ private _members?: UserDto[]
21
+ private _workspaces: Workspace[] = []
22
+
23
+ constructor(
24
+ private readonly context: Context,
25
+ public readonly organization: Organization
26
+ ) {
27
+ super()
28
+ }
29
+
30
+ async initFrom(id: GroupId): Promise<Group> {
31
+ await this.reloadGroup(id)
32
+ await this.reloadWorkspaces()
33
+ return this
34
+ }
35
+
36
+ async reloadGroup(id: GroupId): Promise<void> {
37
+ // fetch group
38
+ const response = await this.context.resolve(RpcService)
39
+ ?.requestBuilder("api/v1/AccessGroups")
40
+ .searchParam("groupId", id)
41
+ .sendGet()
42
+
43
+ // check response status
44
+ if (ResponseUtils.isFail(response)) {
45
+ await ResponseUtils.throwError(`Failed to get group: ${id}, organization: ${this.organization.id}`, response)
46
+ }
47
+
48
+ // parse group from the server's response
49
+ const group = (await response!.json()) as AccessGroupResponse
50
+ // init group
51
+ this._content = group.group
52
+ this._members = group.members
53
+ }
54
+
55
+ async reloadWorkspaces(): Promise<void> {
56
+ const groupWorkspaces = await this.loadWorkspaces(this.id)
57
+ this._workspaces.length = 0
58
+ this._workspaces.push(...groupWorkspaces)
59
+ }
60
+
61
+ async loadWorkspaces(groupId: GroupId): Promise<Workspace[]> {
62
+ // fetch workspaces
63
+ const response = await this.context.resolve(RpcService)
64
+ ?.requestBuilder("api/v1/AccessGroups/workspaces")
65
+ .searchParam("groupId", groupId)
66
+ .sendGet()
67
+
68
+ if (ResponseUtils.isFail(response)) {
69
+ await ResponseUtils.throwError(`Failed to get workspaces for group: ${this.id}, organization: ${this.organization.id}`, response)
70
+ }
71
+
72
+ // parse workspaces from the server's response
73
+ const workspaces = (await response!.json()) as WorkspacesResponse
74
+
75
+ // get workspaces
76
+ const result: Workspace[] = []
77
+ for (const workspaceDto of workspaces.workspaces) {
78
+ result.push(this.organization.workspaces.get(workspaceDto.id))
79
+ }
80
+
81
+ return result
82
+ }
83
+
84
+ get id(): GroupId {
85
+ if (this._content) {
86
+ return this._content.id
87
+ }
88
+ throw new Error("Access group is not loaded.")
89
+ }
90
+
91
+ get group(): AccessGroupDto {
92
+ if (this._content) {
93
+ return this._content
94
+ }
95
+ throw new Error("Access group is not loaded.")
96
+ }
97
+
98
+ get workspaces(): readonly Workspace[] {
99
+ return this._workspaces
100
+ }
101
+
102
+ get members(): UserDto[] {
103
+ if (this._members) {
104
+ return this._members
105
+ }
106
+ throw new Error("Access group is not loaded.")
107
+ }
108
+
109
+ async setName(name: string): Promise<void> {
110
+ if (name === undefined || name === null) {
111
+ throw new Error("Groups change, name is undefined or null")
112
+ }
113
+ if (name.length === 0 || name.trim().length === 0) {
114
+ throw new Error("Groups change, name is empty")
115
+ }
116
+ // send request to the server
117
+ const response = await this.context
118
+ .resolve(RpcService)
119
+ ?.requestBuilder("api/v1/AccessGroups/name")
120
+ .sendPutJson({
121
+ groupId: this.id,
122
+ name: name
123
+ })
124
+
125
+ // check response status
126
+ if (ResponseUtils.isFail(response)) {
127
+ await ResponseUtils.throwError(`Failed to change group name, group: ${this.id}, organization: ${this.organization.id}`, response)
128
+ }
129
+
130
+ // change name
131
+ if (this._content) {
132
+ this._content.name = name
133
+ }
134
+
135
+ // dispatch event
136
+ this.dispatch({
137
+ type: GroupEvent.UPDATED,
138
+ data: this
139
+ })
140
+ }
141
+
142
+ async setPermits(permits: { isAdmin: boolean }): Promise<void> {
143
+ // send request to the server
144
+ const response = await this.context
145
+ .resolve(RpcService)
146
+ ?.requestBuilder("api/v1/AccessGroups/permits")
147
+ .sendPutJson({
148
+ groupId: this.id,
149
+ permits: permits
150
+ })
151
+
152
+ if (ResponseUtils.isFail(response)) {
153
+ await ResponseUtils.throwError(`Failed to change group permits, group: ${this.id}, organization: ${this.organization.id}`, response)
154
+ }
155
+ }
156
+
157
+ async setWorkspaces(workspaces: string[]): Promise<void> {
158
+ if (workspaces === null || workspaces === undefined) {
159
+ throw new Error("Group add workspaces, workspaces is undefined or null")
160
+ }
161
+
162
+ // send request to the server
163
+ const response = await this.context
164
+ .resolve(RpcService)
165
+ ?.requestBuilder("api/v1/AccessGroups/workspaces")
166
+ .sendPutJson({
167
+ groupId: this.id,
168
+ actualWorkspaceIds: workspaces
169
+ })
170
+
171
+ if (ResponseUtils.isFail(response)) {
172
+ await ResponseUtils.throwError(`Failed to set workspaces for group: ${this.id}, organization: ${this.organization.id}`, response)
173
+ }
174
+
175
+ // reload workspaces
176
+ await this.reloadWorkspaces()
177
+
178
+ // dispatch event
179
+ this.dispatch({
180
+ type: GroupEvent.UPDATED,
181
+ data: this
182
+ })
183
+ }
184
+
185
+ async removeWorkspaces(workspaces: WorkspaceId[]): Promise<void> {
186
+ if (workspaces === null || workspaces === undefined) {
187
+ throw new Error("Group removeWorkspaces, workspaces is undefined or null")
188
+ }
189
+
190
+ // make set of workspaces
191
+ const groupWorkspaces = new Set(this.workspaces.map(w => w.id))
192
+
193
+ // check argument
194
+ if (!workspaces.every(w => groupWorkspaces.has(w))) {
195
+ const notExistingWorkspaces = workspaces.filter(workspaceId => !groupWorkspaces.has(workspaceId))
196
+ throw new Error(`Group removeWorkspaces, workspaces contains not existing workspaces: ${notExistingWorkspaces}`)
197
+ }
198
+
199
+ // remove workspaces
200
+ for (const id of workspaces) {
201
+ groupWorkspaces.delete(id)
202
+ }
203
+
204
+ // send request to the server
205
+ await this.setWorkspaces(Array.from(groupWorkspaces))
206
+ }
207
+
208
+ async setMembersIds(members: UserId[]) {
209
+ if (members === null || members === undefined) {
210
+ throw new Error("Group setMembersIds, members is undefined or null")
211
+ }
212
+
213
+ // send request to the server
214
+ const response = await this.context
215
+ .resolve(RpcService)
216
+ ?.requestBuilder("api/v1/AccessGroups/members")
217
+ .sendPutJson({
218
+ groupId: this.id,
219
+ memberIds: members
220
+ })
221
+
222
+ if (ResponseUtils.isFail(response)) {
223
+ await ResponseUtils.throwError(`Failed to set members for group: ${this.id}, organization: ${this.organization.id}`, response)
224
+ }
225
+
226
+ // reload group
227
+ await this.reloadGroup(this.id)
228
+
229
+ // dispatch event
230
+ this.dispatch({
231
+ type: GroupEvent.UPDATED,
232
+ data: this
233
+ })
234
+ }
235
+
236
+ async removeMembers(members: UserId[]): Promise<void> {
237
+ // check members
238
+ if (members === null || members === undefined) {
239
+ throw new Error("Group removeMembers, members is undefined or null")
240
+ }
241
+
242
+ // make set of members
243
+ const groupMembers = new Set(this.members.map(m => m.id))
244
+
245
+ // check argument
246
+ if (!members.every(m => groupMembers.has(m))) {
247
+ const notExistingMembers = members.filter(memberId => !groupMembers.has(memberId))
248
+ throw new Error(`Group removeMembers, members contains not existing members: ${notExistingMembers}`)
249
+ }
250
+
251
+ // remove members
252
+ for (const id of members) {
253
+ groupMembers.delete(id)
254
+ }
255
+
256
+ // send request to the server
257
+ await this.setMembersIds(Array.from(groupMembers))
258
+ }
259
+
260
+ get isDisposed(): boolean {
261
+ return this._isDisposed
262
+ }
263
+
264
+ dispose(): void {
265
+ this._isDisposed = true
266
+ }
267
+ }
@@ -0,0 +1,73 @@
1
+ import { EventDispatcher } from "../../events"
2
+ import { AccessGroupDto } from "../../dto/accessGroupResponse"
3
+ import { UserDto } from "../../dto/userInfoResponse"
4
+ import { Workspace } from "../workspaces/workspace"
5
+ import { WorkspaceId } from "../workspaces/workspaces"
6
+ import { UserId } from "../user/userProfile"
7
+
8
+ /**
9
+ * Group id.
10
+ */
11
+ export type GroupId = string
12
+
13
+ export enum GroupEvent {
14
+ UPDATED = "updated"
15
+ }
16
+
17
+ /**
18
+ * Group.
19
+ */
20
+ export abstract class Group extends EventDispatcher<GroupEvent, Group> {
21
+
22
+ /**
23
+ * Group id.
24
+ */
25
+ abstract get id(): GroupId
26
+
27
+ /**
28
+ * Group information.
29
+ */
30
+ abstract get group(): AccessGroupDto
31
+
32
+ /**
33
+ * Group members.
34
+ */
35
+ abstract get members(): UserDto[]
36
+
37
+ /**
38
+ * Group workspaces.
39
+ */
40
+ abstract get workspaces(): readonly Workspace[]
41
+
42
+ /**
43
+ * Set workspaces.
44
+ */
45
+ abstract setWorkspaces(workspaces: WorkspaceId[]): Promise<void>
46
+
47
+ /**
48
+ * Set name.
49
+ */
50
+ abstract setName(name: string): Promise<void>
51
+
52
+ /**
53
+ * Set permits.
54
+ */
55
+ abstract setPermits(permits: { isAdmin: boolean }): Promise<void>
56
+
57
+ /**
58
+ * Set members.
59
+ */
60
+ abstract setMembersIds(members: UserId[]): Promise<void>
61
+
62
+ /**
63
+ * Remove members.
64
+ * @param members
65
+ */
66
+ abstract removeMembers(members: UserId[]): Promise<void>
67
+
68
+ /**
69
+ * Remove workspaces.
70
+ * @param workspaces
71
+ */
72
+ abstract removeWorkspaces(workspaces: WorkspaceId[]): Promise<void>
73
+ }