@neuralinnovations/dataisland-sdk 0.0.1-dev12 → 0.0.1-dev14
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/README.md +122 -5
- package/dist/package.json +1 -1
- package/dist/src/storages/chats/answer.d.ts +7 -1
- package/dist/src/storages/chats/answer.d.ts.map +1 -1
- package/dist/src/storages/chats/answer.impl.d.ts.map +1 -1
- package/dist/src/storages/chats/answer.impl.js +12 -0
- package/dist/src/storages/chats/answer.impl.js.map +1 -1
- package/dist/src/storages/chats/answer.js +9 -2
- package/dist/src/storages/chats/answer.js.map +1 -1
- package/dist/src/storages/files/file.d.ts +9 -2
- package/dist/src/storages/files/file.d.ts.map +1 -1
- package/dist/src/storages/files/file.impl.d.ts +4 -1
- package/dist/src/storages/files/file.impl.d.ts.map +1 -1
- package/dist/src/storages/files/file.impl.js +15 -3
- package/dist/src/storages/files/file.impl.js.map +1 -1
- package/dist/src/storages/files/file.js +2 -1
- package/dist/src/storages/files/file.js.map +1 -1
- package/dist/src/storages/files/files.d.ts +5 -4
- package/dist/src/storages/files/files.d.ts.map +1 -1
- package/dist/src/storages/files/files.impl.d.ts +3 -3
- package/dist/src/storages/files/files.impl.d.ts.map +1 -1
- package/dist/src/storages/files/files.impl.js +12 -6
- package/dist/src/storages/files/files.impl.js.map +1 -1
- package/dist/src/storages/files/files.js +1 -0
- package/dist/src/storages/files/files.js.map +1 -1
- package/dist/src/storages/groups/groups.d.ts +3 -6
- package/dist/src/storages/groups/groups.d.ts.map +1 -1
- package/dist/src/storages/groups/groups.impl.d.ts +3 -3
- package/dist/src/storages/groups/groups.impl.d.ts.map +1 -1
- package/dist/src/storages/groups/groups.impl.js +9 -6
- package/dist/src/storages/groups/groups.impl.js.map +1 -1
- package/dist/src/storages/groups/groups.js.map +1 -1
- package/dist/src/storages/organizations/organization.d.ts +12 -1
- package/dist/src/storages/organizations/organization.d.ts.map +1 -1
- package/dist/src/storages/organizations/organization.impl.d.ts +1 -0
- package/dist/src/storages/organizations/organization.impl.d.ts.map +1 -1
- package/dist/src/storages/organizations/organization.impl.js +36 -0
- package/dist/src/storages/organizations/organization.impl.js.map +1 -1
- package/dist/src/storages/organizations/organization.js +10 -2
- package/dist/src/storages/organizations/organization.js.map +1 -1
- package/dist/src/storages/workspaces/workspace.d.ts +4 -0
- package/dist/src/storages/workspaces/workspace.d.ts.map +1 -1
- package/dist/src/storages/workspaces/workspace.impl.d.ts +1 -0
- package/dist/src/storages/workspaces/workspace.impl.d.ts.map +1 -1
- package/dist/src/storages/workspaces/workspace.impl.js +11 -0
- package/dist/src/storages/workspaces/workspace.impl.js.map +1 -1
- package/dist/src/storages/workspaces/workspace.js.map +1 -1
- package/package.json +1 -1
- package/src/storages/chats/answer.impl.ts +16 -1
- package/src/storages/chats/answer.ts +8 -1
- package/src/storages/files/file.impl.ts +21 -3
- package/src/storages/files/file.ts +14 -2
- package/src/storages/files/files.impl.ts +12 -7
- package/src/storages/files/files.ts +5 -4
- package/src/storages/groups/groups.impl.ts +10 -8
- package/src/storages/groups/groups.ts +3 -6
- package/src/storages/organizations/organization.impl.ts +48 -1
- package/src/storages/organizations/organization.ts +18 -1
- package/src/storages/workspaces/workspace.impl.ts +20 -0
- package/src/storages/workspaces/workspace.ts +5 -0
@@ -2,8 +2,6 @@ import { AccessGroupDto } from "../../dto/accessGroupResponse"
|
|
2
2
|
import { UserDto } from "../../dto/userInfoResponse"
|
3
3
|
import { WorkspaceDto } from "../../dto/workspacesResponse"
|
4
4
|
import { EventDispatcher } from "../../events"
|
5
|
-
import { OrganizationId } from "../organizations/organizations"
|
6
|
-
import { Organization } from "../organizations/organization"
|
7
5
|
|
8
6
|
/**
|
9
7
|
* Group id.
|
@@ -71,18 +69,17 @@ export abstract class Group extends EventDispatcher<GroupEvent, Group> {
|
|
71
69
|
export abstract class Groups extends EventDispatcher<GroupEvent, Group> {
|
72
70
|
|
73
71
|
/**
|
74
|
-
*
|
72
|
+
* Collection.
|
75
73
|
*/
|
76
|
-
abstract get
|
74
|
+
abstract get collection(): ReadonlyArray<Group>
|
77
75
|
|
78
76
|
/**
|
79
77
|
* Create new group.
|
80
78
|
* @param name
|
81
|
-
* @param organizationId
|
82
79
|
* @param permits
|
83
80
|
* @param memberIds
|
84
81
|
*/
|
85
|
-
abstract create(name: string,
|
82
|
+
abstract create(name: string, permits: {
|
86
83
|
isAdmin: boolean
|
87
84
|
}, memberIds: string[]): Promise<Group>
|
88
85
|
|
@@ -4,7 +4,7 @@ import { OrganizationDto } from "../../dto/userInfoResponse"
|
|
4
4
|
import { Workspaces } from "../workspaces/workspaces"
|
5
5
|
import { WorkspacesImpl } from "../workspaces/workspaces.impl"
|
6
6
|
import { Context } from "../../context"
|
7
|
-
import { Organization } from "./organization"
|
7
|
+
import { Organization, OrganizationEvent } from "./organization"
|
8
8
|
import { GroupsImpl } from "../groups/groups.impl"
|
9
9
|
import { Groups } from "../groups/groups"
|
10
10
|
import { ChatsImpl } from "../chats/chats.impl"
|
@@ -75,6 +75,53 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
75
75
|
get chats(): Chats {
|
76
76
|
return this._chats
|
77
77
|
}
|
78
|
+
|
79
|
+
async change(name: string, description: string): Promise<void> {
|
80
|
+
if (!this._content) {
|
81
|
+
throw new Error("Organization is not loaded.")
|
82
|
+
}
|
83
|
+
|
84
|
+
if (name === this.name && description === this.description) {
|
85
|
+
return Promise.resolve()
|
86
|
+
}
|
87
|
+
if (name === undefined || name === null || name.trim() === "") {
|
88
|
+
throw new Error("Name is required. Please provide a valid name.")
|
89
|
+
}
|
90
|
+
if (
|
91
|
+
description === undefined ||
|
92
|
+
description === null ||
|
93
|
+
description.trim() === ""
|
94
|
+
) {
|
95
|
+
throw new Error(
|
96
|
+
"Description is required. Please provide a valid description."
|
97
|
+
)
|
98
|
+
}
|
99
|
+
|
100
|
+
const response = await this.context
|
101
|
+
.resolve(RpcService)
|
102
|
+
?.requestBuilder("api/v1/Organizations")
|
103
|
+
.sendPutJson({
|
104
|
+
organizationId: this.id,
|
105
|
+
profile: {
|
106
|
+
name,
|
107
|
+
description
|
108
|
+
}
|
109
|
+
})
|
110
|
+
|
111
|
+
if (ResponseUtils.isFail(response)) {
|
112
|
+
await ResponseUtils.throwError("Failed to change organization", response)
|
113
|
+
}
|
114
|
+
|
115
|
+
if (this._content) {
|
116
|
+
this._content.profile.name = name
|
117
|
+
this._content.profile.description = description
|
118
|
+
}
|
119
|
+
|
120
|
+
this.dispatch({
|
121
|
+
type: OrganizationEvent.CHANGED,
|
122
|
+
data: this
|
123
|
+
})
|
124
|
+
}
|
78
125
|
|
79
126
|
async createInviteLink(emails: string[], accessGroups: string[]): Promise<void> {
|
80
127
|
const response = await this.context
|
@@ -2,11 +2,23 @@ import { Workspaces } from "../workspaces/workspaces"
|
|
2
2
|
import { OrganizationId } from "./organizations"
|
3
3
|
import { GroupId, Groups } from "../groups/groups"
|
4
4
|
import { Chats } from "../chats/chats"
|
5
|
+
import { EventDispatcher } from "../../events"
|
6
|
+
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Organization event.
|
10
|
+
*/
|
11
|
+
export enum OrganizationEvent {
|
12
|
+
CHANGED = "changed"
|
13
|
+
}
|
5
14
|
|
6
15
|
/**
|
7
16
|
* Organization.
|
8
17
|
*/
|
9
|
-
export abstract class Organization
|
18
|
+
export abstract class Organization extends EventDispatcher<
|
19
|
+
OrganizationEvent,
|
20
|
+
Organization
|
21
|
+
> {
|
10
22
|
/**
|
11
23
|
* Organization id.
|
12
24
|
*/
|
@@ -37,6 +49,11 @@ export abstract class Organization {
|
|
37
49
|
*/
|
38
50
|
abstract get accessGroups(): Groups
|
39
51
|
|
52
|
+
/**
|
53
|
+
* Change organization name and description.
|
54
|
+
*/
|
55
|
+
abstract change(name: string, description: string): Promise<void>
|
56
|
+
|
40
57
|
/**
|
41
58
|
* Create invite link
|
42
59
|
*/
|
@@ -46,6 +46,26 @@ export class WorkspaceImpl extends Workspace {
|
|
46
46
|
return this._files
|
47
47
|
}
|
48
48
|
|
49
|
+
async filesCount(): Promise<number> {
|
50
|
+
// send request to the server
|
51
|
+
const response = await this.context
|
52
|
+
.resolve(RpcService)
|
53
|
+
?.requestBuilder("api/v1/Workspaces/files/count")
|
54
|
+
.searchParam("workspaceId", this.id)
|
55
|
+
.searchParam("organizationId", this.organization.id)
|
56
|
+
.sendGet()
|
57
|
+
|
58
|
+
// check response status
|
59
|
+
if (ResponseUtils.isFail(response)) {
|
60
|
+
await ResponseUtils.throwError(
|
61
|
+
`Failed during get workspace total files count for ${this.id} of ${this.organization.id}`,
|
62
|
+
response
|
63
|
+
)
|
64
|
+
}
|
65
|
+
|
66
|
+
return (await response!.json()).count
|
67
|
+
}
|
68
|
+
|
49
69
|
async change(name: string, description: string): Promise<void> {
|
50
70
|
if (!this._workspace) {
|
51
71
|
throw new Error("Workspace is not loaded.")
|