@neuralinnovations/dataisland-sdk 0.0.1-dev22 → 0.0.1-dev24

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 (35) 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 -60
  15. package/dist/src/storages/groups/groups.d.ts.map +1 -1
  16. package/dist/src/storages/groups/groups.impl.d.ts +2 -35
  17. package/dist/src/storages/groups/groups.impl.d.ts.map +1 -1
  18. package/dist/src/storages/groups/groups.impl.js +14 -193
  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/dist/src/storages/organizations/organizations.impl.d.ts.map +1 -1
  26. package/dist/src/storages/organizations/organizations.impl.js +12 -6
  27. package/dist/src/storages/organizations/organizations.impl.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/index.ts +3 -0
  30. package/src/storages/groups/group.impl.ts +267 -0
  31. package/src/storages/groups/group.ts +73 -0
  32. package/src/storages/groups/groups.impl.ts +17 -252
  33. package/src/storages/groups/groups.ts +3 -70
  34. package/src/storages/organizations/organization.ts +2 -1
  35. package/src/storages/organizations/organizations.impl.ts +17 -8
@@ -1,86 +1,19 @@
1
- import { AccessGroupDto } from "../../dto/accessGroupResponse"
2
- import { UserDto } from "../../dto/userInfoResponse"
3
1
  import { EventDispatcher } from "../../events"
4
- import { UserId } from "../user/userProfile"
5
- import { WorkspaceId } from "../workspaces/workspaces"
6
- import { Workspace } from "../workspaces/workspace"
7
-
8
- /**
9
- * Group id.
10
- */
11
- export type GroupId = string
2
+ import { Group, GroupId } from "./group"
12
3
 
13
4
  /**
14
5
  * Group event.
15
6
  */
16
- export enum GroupEvent {
7
+ export enum GroupsEvent {
17
8
  ADDED = "added",
18
9
  REMOVED = "removed",
19
10
  UPDATED = "updated"
20
11
  }
21
12
 
22
- /**
23
- * Group.
24
- */
25
- export abstract class Group extends EventDispatcher<GroupEvent, Group> {
26
-
27
- /**
28
- * Group id.
29
- */
30
- abstract get id(): GroupId
31
-
32
- /**
33
- * Group information.
34
- */
35
- abstract get group(): AccessGroupDto
36
-
37
- /**
38
- * Group members.
39
- */
40
- abstract get members(): UserDto[]
41
-
42
- /**
43
- * Group workspaces.
44
- */
45
- abstract get workspaces(): readonly Workspace[]
46
-
47
- /**
48
- * Set workspaces.
49
- */
50
- abstract setWorkspaces(workspaces: WorkspaceId[]): Promise<void>
51
-
52
- /**
53
- * Set name.
54
- */
55
- abstract setName(name: string): Promise<void>
56
-
57
- /**
58
- * Set permits.
59
- */
60
- abstract setPermits(permits: { isAdmin: boolean }): Promise<void>
61
-
62
- /**
63
- * Set members.
64
- */
65
- abstract setMembersIds(members: UserId[]): Promise<void>
66
-
67
- /**
68
- * Remove members.
69
- * @param members
70
- */
71
- abstract removeMembers(members: UserId[]): Promise<void>
72
-
73
- /**
74
- * Remove workspaces.
75
- * @param workspaces
76
- */
77
- abstract removeWorkspaces(workspaces: WorkspaceId[]): Promise<void>
78
- }
79
-
80
13
  /**
81
14
  * Groups storage.
82
15
  */
83
- export abstract class Groups extends EventDispatcher<GroupEvent, Group> {
16
+ export abstract class Groups extends EventDispatcher<GroupsEvent, Group> {
84
17
 
85
18
  /**
86
19
  * Collection.
@@ -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
 
9
10
  /**
@@ -175,23 +175,32 @@ export class OrganizationsImpl extends Organizations {
175
175
  organizations: OrganizationDto[],
176
176
  settings: UserSettings | null | undefined
177
177
  ): Promise<void> {
178
+
179
+ // set current organization
178
180
  this.currentOrganizationId = settings?.activeOrganizationId
181
+
182
+ // wait list
183
+ const waitList: Promise<OrganizationImpl>[] = []
184
+
185
+ // init organizations
179
186
  for (const organization of organizations) {
180
187
  // create organization and init from content
181
- const org = await new OrganizationImpl(this.context).initFrom(
188
+ const orgPromise = new OrganizationImpl(this.context).initFrom(
182
189
  organization,
183
190
  adminInOrganization.includes(organization.id)
184
191
  )
185
192
 
193
+ // add organization to wait list
194
+ waitList.push(orgPromise)
195
+ }
196
+
197
+ // wait for all organizations
198
+ const orgImpls = await Promise.all(waitList)
199
+
200
+ // add organizations to collection
201
+ for (const org of orgImpls) {
186
202
  // add organization to collection
187
203
  this.organizations.push(org)
188
-
189
- // dispatch event, organization added
190
- this.dispatch({
191
- type: OrganizationsEvent.ADDED,
192
- data: org
193
- })
194
204
  }
195
205
  }
196
-
197
206
  }