@neuralinnovations/dataisland-sdk 0.0.1-dev7 → 0.0.1-dev9
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/.github/workflows/docs.yml +32 -0
- package/.github/workflows/format.yml +42 -0
- package/.github/workflows/publish-npm.yml +19 -16
- package/.github/workflows/tests.yml +38 -0
- package/.github/workflows/version.yml +44 -0
- package/LICENSE +201 -0
- package/README.md +37 -2
- package/docs/classes/BasicCredential.md +1 -1
- package/docs/classes/BearerCredential.md +1 -1
- package/docs/classes/Chat.md +34 -6
- package/docs/classes/Chats.md +87 -1
- package/docs/classes/CredentialBase.md +1 -1
- package/docs/classes/DataIslandApp.md +1 -1
- package/docs/classes/DebugCredential.md +1 -1
- package/docs/classes/DefaultCredential.md +1 -1
- package/docs/classes/DisposableContainer.md +1 -1
- package/docs/classes/EventDispatcher.md +1 -1
- package/docs/classes/File.md +1 -1
- package/docs/classes/Files.md +2 -2
- package/docs/classes/FilesPage.md +1 -1
- package/docs/classes/Group.md +19 -1
- package/docs/classes/Groups.md +27 -3
- package/docs/classes/Lifetime.md +1 -1
- package/docs/classes/Organization.md +37 -1
- package/docs/classes/Organizations.md +1 -1
- package/docs/classes/UserProfile.md +1 -1
- package/docs/classes/Workspace.md +1 -1
- package/docs/classes/Workspaces.md +6 -2
- package/docs/enums/ChatAnswerType.md +22 -0
- package/docs/enums/ChatsEvent.md +1 -1
- package/docs/enums/FilesEvent.md +1 -1
- package/docs/enums/GroupEvent.md +3 -1
- package/docs/enums/OrganizationsEvent.md +1 -1
- package/docs/enums/UserEvent.md +1 -1
- package/docs/enums/WorkspaceEvent.md +1 -1
- package/docs/enums/WorkspacesEvent.md +1 -1
- package/docs/interfaces/Disposable.md +1 -1
- package/docs/interfaces/Event.md +1 -1
- package/docs/interfaces/EventSubscriber.md +1 -1
- package/docs/interfaces/Input.md +1 -1
- package/docs/modules.md +5 -3
- package/package.json +6 -2
- package/src/dataIslandApp.ts +2 -2
- package/src/dto/chatResponse.ts +54 -55
- package/src/dto/workspacesResponse.ts +2 -2
- package/src/index.ts +13 -13
- package/src/internal/app.impl.ts +2 -2
- package/src/services/organizationService.ts +2 -2
- package/src/services/userProfileService.ts +2 -2
- package/src/storages/chats/answer.impl.ts +163 -0
- package/src/storages/chats/answer.ts +42 -0
- package/src/storages/chats/chat.impl.ts +87 -0
- package/src/storages/chats/chat.ts +38 -0
- package/src/storages/chats/chats.impl.ts +142 -0
- package/src/storages/chats/chats.ts +47 -0
- package/src/storages/{file.impl.ts → files/file.impl.ts} +5 -5
- package/src/storages/{file.ts → files/file.ts} +1 -1
- package/src/storages/{files.impl.ts → files/files.impl.ts} +6 -6
- package/src/storages/{files.ts → files/files.ts} +2 -2
- package/src/storages/{groups.impl.ts → groups/groups.impl.ts} +86 -97
- package/src/storages/groups/groups.ts +101 -0
- package/src/storages/{organization.impl.ts → organizations/organization.impl.ts} +34 -7
- package/src/storages/{organization.ts → organizations/organization.ts} +13 -2
- package/src/storages/{organizations.impl.ts → organizations/organizations.impl.ts} +10 -4
- package/src/storages/{organizations.ts → organizations/organizations.ts} +1 -1
- package/src/storages/{userProfile.impl.ts → user/userProfile.impl.ts} +1 -1
- package/src/storages/{userProfile.ts → user/userProfile.ts} +1 -1
- package/src/storages/{workspace.impl.ts → workspaces/workspace.impl.ts} +7 -7
- package/src/storages/{workspace.ts → workspaces/workspace.ts} +3 -3
- package/src/storages/{workspaces.impl.ts → workspaces/workspaces.impl.ts} +11 -11
- package/src/storages/{workspaces.ts → workspaces/workspaces.ts} +2 -2
- package/test/chats.test.ts +48 -0
- package/test/organization.test.ts +13 -1
- package/test/setup.ts +7 -0
- package/docs/enums/ChatAnswer.md +0 -22
- package/src/storages/chat.ts +0 -21
- package/src/storages/chats.ts +0 -17
- package/src/storages/groups.ts +0 -43
- /package/src/storages/{filesPage.ts → files/filesPage.ts} +0 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
import { AccessGroupDto } from "../../dto/accessGroupResponse"
|
2
|
+
import { UserDto } from "../../dto/userInfoResponse"
|
3
|
+
import { WorkspaceDto } from "../../dto/workspacesResponse"
|
4
|
+
import { EventDispatcher } from "../../events"
|
5
|
+
import { OrganizationId } from "../organizations/organizations"
|
6
|
+
import { Organization } from "../organizations/organization"
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Group id.
|
10
|
+
*/
|
11
|
+
export type GroupId = string
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Group event.
|
15
|
+
*/
|
16
|
+
export enum GroupEvent {
|
17
|
+
ADDED = "added",
|
18
|
+
REMOVED = "removed",
|
19
|
+
UPDATED = "updated"
|
20
|
+
}
|
21
|
+
|
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 getWorkspaces(): Promise<WorkspaceDto[]>
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Set workspaces.
|
49
|
+
*/
|
50
|
+
abstract setWorkspaces(workspaces: string[]): 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: string[]): Promise<void>
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Groups storage.
|
70
|
+
*/
|
71
|
+
export abstract class Groups extends EventDispatcher<GroupEvent, Group> {
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Organization.
|
75
|
+
*/
|
76
|
+
abstract get organization(): Organization
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Create new group.
|
80
|
+
* @param name
|
81
|
+
* @param organizationId
|
82
|
+
* @param permits
|
83
|
+
* @param memberIds
|
84
|
+
*/
|
85
|
+
abstract create(name: string, organizationId: OrganizationId, permits: {
|
86
|
+
isAdmin: boolean
|
87
|
+
}, memberIds: string[]): Promise<Group>
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Get group by id.
|
91
|
+
* @param id
|
92
|
+
*/
|
93
|
+
abstract get(id: GroupId): Group | undefined
|
94
|
+
|
95
|
+
/**
|
96
|
+
* delete group by id.
|
97
|
+
* @param id
|
98
|
+
*/
|
99
|
+
abstract delete(id: GroupId): Promise<void>
|
100
|
+
|
101
|
+
}
|
@@ -1,12 +1,16 @@
|
|
1
1
|
import { OrganizationId } from "./organizations"
|
2
|
-
import { Disposable } from "
|
3
|
-
import { OrganizationDto } from "
|
4
|
-
import { Workspaces } from "
|
5
|
-
import { WorkspacesImpl } from "
|
6
|
-
import { Context } from "
|
2
|
+
import { Disposable } from "../../disposable"
|
3
|
+
import { OrganizationDto } from "../../dto/userInfoResponse"
|
4
|
+
import { Workspaces } from "../workspaces/workspaces"
|
5
|
+
import { WorkspacesImpl } from "../workspaces/workspaces.impl"
|
6
|
+
import { Context } from "../../context"
|
7
7
|
import { Organization } from "./organization"
|
8
|
-
import { GroupsImpl } from "
|
9
|
-
import { Groups } from "
|
8
|
+
import { GroupsImpl } from "../groups/groups.impl"
|
9
|
+
import { Groups } from "../groups/groups"
|
10
|
+
import { ChatsImpl } from "../chats/chats.impl"
|
11
|
+
import { Chats } from "../chats/chats"
|
12
|
+
import { RpcService } from "../../services/rpcService"
|
13
|
+
import { ResponseUtils } from "../../services/responseUtils"
|
10
14
|
|
11
15
|
export class OrganizationImpl extends Organization implements Disposable {
|
12
16
|
private _isDisposed: boolean = false
|
@@ -14,11 +18,13 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
14
18
|
private _content?: OrganizationDto
|
15
19
|
private readonly _workspaces: WorkspacesImpl
|
16
20
|
private readonly _accessGroups: GroupsImpl
|
21
|
+
private readonly _chats: ChatsImpl
|
17
22
|
|
18
23
|
constructor(private readonly context: Context) {
|
19
24
|
super()
|
20
25
|
this._workspaces = new WorkspacesImpl(this, this.context)
|
21
26
|
this._accessGroups = new GroupsImpl(this, this.context)
|
27
|
+
this._chats = new ChatsImpl(this, this.context)
|
22
28
|
}
|
23
29
|
|
24
30
|
public async initFrom(
|
@@ -65,4 +71,25 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
65
71
|
get accessGroups(): Groups {
|
66
72
|
return this._accessGroups
|
67
73
|
}
|
74
|
+
|
75
|
+
get chats(): Chats {
|
76
|
+
return this._chats
|
77
|
+
}
|
78
|
+
|
79
|
+
async createInviteLink(emails: string[], accessGroups: string[]): Promise<void> {
|
80
|
+
const response = await this.context
|
81
|
+
.resolve(RpcService)
|
82
|
+
?.requestBuilder("api/v1/Invites")
|
83
|
+
.sendPostJson({
|
84
|
+
organizationId: this.id,
|
85
|
+
emails: emails,
|
86
|
+
accessGroupIds: accessGroups
|
87
|
+
})
|
88
|
+
if (ResponseUtils.isFail(response)) {
|
89
|
+
await ResponseUtils.throwError(
|
90
|
+
`Invite link creation failed for organization ${this.id}`,
|
91
|
+
response
|
92
|
+
)
|
93
|
+
}
|
94
|
+
}
|
68
95
|
}
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { Workspaces } from "
|
1
|
+
import { Workspaces } from "../workspaces/workspaces"
|
2
2
|
import { OrganizationId } from "./organizations"
|
3
|
-
import { Groups } from "
|
3
|
+
import { GroupId, Groups } from "../groups/groups"
|
4
|
+
import { Chats } from "../chats/chats"
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Organization.
|
@@ -26,8 +27,18 @@ export abstract class Organization {
|
|
26
27
|
*/
|
27
28
|
abstract get workspaces(): Workspaces
|
28
29
|
|
30
|
+
/**
|
31
|
+
* Chats.
|
32
|
+
*/
|
33
|
+
abstract get chats(): Chats
|
34
|
+
|
29
35
|
/**
|
30
36
|
* Groups.
|
31
37
|
*/
|
32
38
|
abstract get accessGroups(): Groups
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Create invite link
|
42
|
+
*/
|
43
|
+
abstract createInviteLink(emails: string[], accessGroups: GroupId[]): Promise<void>
|
33
44
|
}
|
@@ -4,11 +4,11 @@ import {
|
|
4
4
|
Organizations
|
5
5
|
} from "./organizations"
|
6
6
|
import { OrganizationImpl } from "./organization.impl"
|
7
|
-
import { RpcService } from "
|
8
|
-
import { OrganizationDto, UserSettings } from "
|
9
|
-
import { Context } from "
|
7
|
+
import { RpcService } from "../../services/rpcService"
|
8
|
+
import { OrganizationDto, UserSettings } from "../../dto/userInfoResponse"
|
9
|
+
import { Context } from "../../context"
|
10
10
|
import { Organization } from "./organization"
|
11
|
-
import { ResponseUtils } from "
|
11
|
+
import { ResponseUtils } from "../../services/responseUtils"
|
12
12
|
|
13
13
|
export class OrganizationsImpl extends Organizations {
|
14
14
|
constructor(public readonly context: Context) {
|
@@ -79,17 +79,22 @@ export class OrganizationsImpl extends Organizations {
|
|
79
79
|
if (!this.contains(id)) {
|
80
80
|
throw new Error(`Organization delete, id: ${id} is not found`)
|
81
81
|
}
|
82
|
+
// send request to the server
|
82
83
|
const response = await this.context
|
83
84
|
.resolve(RpcService)
|
84
85
|
?.requestBuilder("/api/v1/Organizations")
|
85
86
|
.searchParam("id", id)
|
86
87
|
.sendDelete()
|
88
|
+
|
89
|
+
// check response status
|
87
90
|
if (ResponseUtils.isFail(response)) {
|
88
91
|
await ResponseUtils.throwError(
|
89
92
|
`Organization ${id} delete, failed`,
|
90
93
|
response
|
91
94
|
)
|
92
95
|
}
|
96
|
+
|
97
|
+
// check organization in collection
|
93
98
|
const org = <OrganizationImpl>this.get(id)
|
94
99
|
const index = this.organizations.indexOf(org)
|
95
100
|
if (index < 0) {
|
@@ -188,4 +193,5 @@ export class OrganizationsImpl extends Organizations {
|
|
188
193
|
})
|
189
194
|
}
|
190
195
|
}
|
196
|
+
|
191
197
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { UserEvent, UserProfile } from "./userProfile"
|
2
|
-
import { UserInfoResponse } from "
|
2
|
+
import { UserInfoResponse } from "../../dto/userInfoResponse"
|
3
3
|
|
4
4
|
export class UserProfileImpl extends UserProfile {
|
5
5
|
private content?: UserInfoResponse
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { Context } from "
|
2
|
-
import { Files } from "
|
1
|
+
import { Context } from "../../context"
|
2
|
+
import { Files } from "../files/files"
|
3
3
|
import { Workspace, WorkspaceEvent } from "./workspace"
|
4
|
-
import { OrganizationImpl } from "
|
5
|
-
import { WorkspaceDto } from "
|
6
|
-
import { RpcService } from "
|
7
|
-
import { FilesImpl } from "
|
8
|
-
import { ResponseUtils } from "
|
4
|
+
import { OrganizationImpl } from "../organizations/organization.impl"
|
5
|
+
import { WorkspaceDto } from "../../dto/workspacesResponse"
|
6
|
+
import { RpcService } from "../../services/rpcService"
|
7
|
+
import { FilesImpl } from "../files/files.impl"
|
8
|
+
import { ResponseUtils } from "../../services/responseUtils"
|
9
9
|
|
10
10
|
export class WorkspaceImpl extends Workspace {
|
11
11
|
private _isMarkAsDeleted: boolean = false
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { EventDispatcher } from "
|
2
|
-
import { Files } from "
|
1
|
+
import { EventDispatcher } from "../../events"
|
2
|
+
import { Files } from "../files/files"
|
3
3
|
import { WorkspaceId } from "./workspaces"
|
4
|
-
import { Organization } from "
|
4
|
+
import { Organization } from "../organizations/organization"
|
5
5
|
|
6
6
|
/**
|
7
7
|
* Workspace event.
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { WorkspaceId, Workspaces, WorkspacesEvent } from "./workspaces"
|
2
|
-
import { OrganizationImpl } from "
|
3
|
-
import { Context } from "
|
2
|
+
import { OrganizationImpl } from "../organizations/organization.impl"
|
3
|
+
import { Context } from "../../context"
|
4
4
|
import { Workspace } from "./workspace"
|
5
5
|
import { WorkspaceImpl } from "./workspace.impl"
|
6
|
-
import { OrganizationId } from "
|
7
|
-
import { RpcService } from "
|
8
|
-
import { OrganizationWorkspaces } from "
|
9
|
-
import { WorkspaceDto } from "
|
10
|
-
import { ResponseUtils } from "
|
6
|
+
import { OrganizationId } from "../organizations/organizations"
|
7
|
+
import { RpcService } from "../../services/rpcService"
|
8
|
+
import { OrganizationWorkspaces } from "../../dto/userInfoResponse"
|
9
|
+
import { WorkspaceDto } from "../../dto/workspacesResponse"
|
10
|
+
import { ResponseUtils } from "../../services/responseUtils"
|
11
11
|
|
12
12
|
export class WorkspacesImpl extends Workspaces {
|
13
13
|
private readonly _workspaces: WorkspaceImpl[] = []
|
@@ -102,7 +102,7 @@ export class WorkspacesImpl extends Workspaces {
|
|
102
102
|
|
103
103
|
// check response status
|
104
104
|
if (ResponseUtils.isFail(response)) {
|
105
|
-
await ResponseUtils.throwError(
|
105
|
+
await ResponseUtils.throwError(`Failed to create workspace, in organization: ${this.organization.id}`, response)
|
106
106
|
}
|
107
107
|
|
108
108
|
// parse workspace from the server's response
|
@@ -139,7 +139,7 @@ export class WorkspacesImpl extends Workspaces {
|
|
139
139
|
|
140
140
|
// check if workspace is already marked as deleted
|
141
141
|
if (workspace.isMarkAsDeleted) {
|
142
|
-
throw new Error(`Workspace ${id} is already marked as deleted`)
|
142
|
+
throw new Error(`Workspace ${id} is already marked as deleted, in organization: ${this.organization.id}`)
|
143
143
|
}
|
144
144
|
|
145
145
|
// mark workspace as deleted
|
@@ -155,7 +155,7 @@ export class WorkspacesImpl extends Workspaces {
|
|
155
155
|
// check response status
|
156
156
|
if (ResponseUtils.isFail(response)) {
|
157
157
|
await ResponseUtils.throwError(
|
158
|
-
`Failed to delete workspace: ${workspace.organization.name}/${workspace.name}:${id}`,
|
158
|
+
`Failed to delete workspace: ${workspace.organization.name}/${workspace.name}:${id}, in organization: ${this.organization.id}`,
|
159
159
|
response
|
160
160
|
)
|
161
161
|
}
|
@@ -184,7 +184,7 @@ export class WorkspacesImpl extends Workspaces {
|
|
184
184
|
|
185
185
|
// check response status
|
186
186
|
if (ResponseUtils.isFail(response)) {
|
187
|
-
await ResponseUtils.throwError(
|
187
|
+
await ResponseUtils.throwError(`Failed to fetch workspaces in organization: ${organizationId}`, response)
|
188
188
|
}
|
189
189
|
|
190
190
|
// parse workspaces from the server's response
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { EventDispatcher } from "
|
1
|
+
import { EventDispatcher } from "../../events"
|
2
2
|
import { Workspace } from "./workspace"
|
3
3
|
|
4
4
|
export type WorkspaceId = string
|
@@ -44,7 +44,7 @@ export abstract class Workspaces extends EventDispatcher<
|
|
44
44
|
/**
|
45
45
|
* Create workspace.
|
46
46
|
*/
|
47
|
-
abstract create(name: string, description: string): Promise<Workspace>
|
47
|
+
abstract create(name: string, description: string, regulation?: { isCreateNewGroup: boolean, newGroupName: string, groupIds: string[]}): Promise<Workspace>
|
48
48
|
|
49
49
|
/**
|
50
50
|
* Delete workspace.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { ChatAnswerType } from "../src"
|
2
|
+
import { AnswerStatus, StepType } from "../src/dto/chatResponse"
|
3
|
+
import { testInOrganization } from "./setup"
|
4
|
+
|
5
|
+
test("Chat create, ask question, delete", async () => {
|
6
|
+
await testInOrganization(async (app, org) => {
|
7
|
+
|
8
|
+
const chatPromise = org.chats.create()
|
9
|
+
|
10
|
+
// check not throw
|
11
|
+
await expect(chatPromise).resolves.not.toThrow()
|
12
|
+
|
13
|
+
// get chat
|
14
|
+
const chat = await chatPromise
|
15
|
+
|
16
|
+
// check exists
|
17
|
+
expect(chat).not.toBeUndefined()
|
18
|
+
|
19
|
+
// check exists
|
20
|
+
expect(chat).not.toBeNull()
|
21
|
+
|
22
|
+
// check get
|
23
|
+
expect(org.chats.get(chat.id)).toBe(chat)
|
24
|
+
|
25
|
+
// Create answer
|
26
|
+
|
27
|
+
const askPromise = chat.ask("Hello!", ChatAnswerType.SHORT)
|
28
|
+
|
29
|
+
// check not throw
|
30
|
+
await expect(chatPromise).resolves.not.toThrow()
|
31
|
+
|
32
|
+
const answer = await askPromise
|
33
|
+
|
34
|
+
expect(answer.status).toBe(AnswerStatus.RUNNING)
|
35
|
+
|
36
|
+
while (answer.status !== AnswerStatus.SUCCESS) {
|
37
|
+
await new Promise(r => setTimeout(r, 300))
|
38
|
+
await answer.fetch()
|
39
|
+
}
|
40
|
+
|
41
|
+
const tokens = await answer.fetchTokens(StepType.DONE, 0)
|
42
|
+
|
43
|
+
expect(tokens.step_tokens.length).toBeGreaterThan(0)
|
44
|
+
|
45
|
+
// check delete
|
46
|
+
await expect(org.chats.delete(chat.id)).resolves.not.toThrow()
|
47
|
+
})
|
48
|
+
})
|
@@ -1,6 +1,18 @@
|
|
1
1
|
import { dataIslandApp, DebugCredential } from "../src"
|
2
2
|
import { HOST, randomHash, TOKEN } from "./setup"
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
OrganizationImpl
|
5
|
+
} from "../src/storages/organizations/organization.impl"
|
6
|
+
|
7
|
+
test.skip("Delete all organizations", async () => {
|
8
|
+
const app = await dataIslandApp("delete-all", async builder => {
|
9
|
+
builder.useHost(HOST)
|
10
|
+
builder.useCredential(new DebugCredential(TOKEN))
|
11
|
+
})
|
12
|
+
for (const organization of app.organizations.collection) {
|
13
|
+
await app.organizations.delete(organization.id)
|
14
|
+
}
|
15
|
+
})
|
4
16
|
|
5
17
|
test("Organization", async () => {
|
6
18
|
// make random name
|
package/test/setup.ts
CHANGED
@@ -19,6 +19,13 @@ export const testInOrganization = async (func: (app: DataIslandApp, org: Organiz
|
|
19
19
|
const app = await dataIslandApp(randomName, async builder => {
|
20
20
|
builder.useHost(config?.host ?? HOST)
|
21
21
|
builder.useCredential(new DebugCredential(config?.token ?? TOKEN))
|
22
|
+
builder.registerMiddleware(async (req, next) => {
|
23
|
+
const url = req.url
|
24
|
+
console.log("REQUEST", url, req.method)
|
25
|
+
const response = await next(req)
|
26
|
+
console.log("RESPONSE", url, response.status)
|
27
|
+
return response
|
28
|
+
})
|
22
29
|
})
|
23
30
|
const org = await app.organizations.create(
|
24
31
|
randomName,
|
package/docs/enums/ChatAnswer.md
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
[@neuralinnovations/dataisland-sdk - v0.0.1-dev7](../../README.md) / [Exports](../modules.md) / ChatAnswer
|
2
|
-
|
3
|
-
# Enumeration: ChatAnswer
|
4
|
-
|
5
|
-
## Table of contents
|
6
|
-
|
7
|
-
### Enumeration Members
|
8
|
-
|
9
|
-
- [LONG](ChatAnswer.md#long)
|
10
|
-
- [SHORT](ChatAnswer.md#short)
|
11
|
-
|
12
|
-
## Enumeration Members
|
13
|
-
|
14
|
-
### LONG
|
15
|
-
|
16
|
-
• **LONG** = ``"long"``
|
17
|
-
|
18
|
-
___
|
19
|
-
|
20
|
-
### SHORT
|
21
|
-
|
22
|
-
• **SHORT** = ``"short"``
|
package/src/storages/chat.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
export type ChatId = string
|
2
|
-
|
3
|
-
export enum ChatAnswer {
|
4
|
-
SHORT = "short",
|
5
|
-
LONG = "long"
|
6
|
-
}
|
7
|
-
|
8
|
-
export abstract class Chat {
|
9
|
-
/**
|
10
|
-
* Chat id.
|
11
|
-
*/
|
12
|
-
abstract get id(): ChatId
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Chat name.
|
16
|
-
*/
|
17
|
-
abstract get name(): string
|
18
|
-
|
19
|
-
abstract question(message: string, answer?: ChatAnswer): Promise<void>
|
20
|
-
}
|
21
|
-
|
package/src/storages/chats.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import { EventDispatcher } from "../events"
|
2
|
-
import { Chat } from "./chat"
|
3
|
-
|
4
|
-
export enum ChatsEvent {
|
5
|
-
ADDED = "added",
|
6
|
-
REMOVED = "removed"
|
7
|
-
}
|
8
|
-
|
9
|
-
/**
|
10
|
-
* Chats storage.
|
11
|
-
*/
|
12
|
-
export abstract class Chats extends EventDispatcher<ChatsEvent, Chat> {
|
13
|
-
/**
|
14
|
-
* Create new chat.
|
15
|
-
*/
|
16
|
-
abstract create(): Promise<Chat>
|
17
|
-
}
|
package/src/storages/groups.ts
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
import { AccessGroupDto } from "../dto/accessGroupResponse"
|
2
|
-
import { UserDto } from "../dto/userInfoResponse"
|
3
|
-
import { WorkspaceDto } from "../dto/workspacesResponse"
|
4
|
-
import { EventDispatcher } from "../events"
|
5
|
-
import { OrganizationId } from "./organizations"
|
6
|
-
|
7
|
-
export type GroupId = string
|
8
|
-
|
9
|
-
export enum GroupEvent {
|
10
|
-
ADDED = "added",
|
11
|
-
REMOVED = "removed",
|
12
|
-
UPDATED = "updated"
|
13
|
-
}
|
14
|
-
|
15
|
-
export abstract class Group extends EventDispatcher<GroupEvent, Group> {
|
16
|
-
|
17
|
-
abstract get id(): GroupId
|
18
|
-
|
19
|
-
abstract get group(): AccessGroupDto
|
20
|
-
|
21
|
-
abstract get members(): UserDto[]
|
22
|
-
|
23
|
-
abstract getWorkspaces() : Promise<WorkspaceDto[]>
|
24
|
-
|
25
|
-
abstract setWorkspaces(workspaces: string[]): Promise<void>
|
26
|
-
|
27
|
-
abstract setName(name: string): Promise<void>
|
28
|
-
|
29
|
-
abstract setPermits(permits: {isAdmin: boolean}): Promise<void>
|
30
|
-
|
31
|
-
abstract setMembersIds(members: string[]): Promise<void>
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
export abstract class Groups extends EventDispatcher<GroupEvent, Group>{
|
36
|
-
|
37
|
-
abstract create(name: string, organizationId: OrganizationId, permits: { isAdmin: boolean }, memberIds: string[]): Promise<Group>
|
38
|
-
|
39
|
-
abstract get(id: GroupId): Promise<Group | undefined>
|
40
|
-
|
41
|
-
abstract delete(id: GroupId): Promise<void>
|
42
|
-
|
43
|
-
}
|
File without changes
|