@neuralinnovations/dataisland-sdk 0.0.1-dev9 → 0.1.0
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 +178 -9
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +103 -0
- package/dist/src/appBuilder.d.ts +44 -0
- package/dist/src/appBuilder.d.ts.map +1 -0
- package/dist/src/appBuilder.js +10 -0
- package/dist/src/appBuilder.js.map +1 -0
- package/dist/src/commands/deleteUserFullCommandHandler.d.ts +7 -0
- package/dist/src/commands/deleteUserFullCommandHandler.d.ts.map +1 -0
- package/dist/src/commands/deleteUserFullCommandHandler.js +21 -0
- package/dist/src/commands/deleteUserFullCommandHandler.js.map +1 -0
- package/dist/src/commands/startCommandHandler.d.ts +7 -0
- package/dist/src/commands/startCommandHandler.d.ts.map +1 -0
- package/dist/src/commands/startCommandHandler.js +33 -0
- package/dist/src/commands/startCommandHandler.js.map +1 -0
- package/dist/src/context.d.ts +24 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +31 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/credentials.d.ts +39 -0
- package/dist/src/credentials.d.ts.map +1 -0
- package/dist/src/credentials.js +105 -0
- package/dist/src/credentials.js.map +1 -0
- package/dist/src/dataIslandApp.d.ts +60 -0
- package/dist/src/dataIslandApp.d.ts.map +1 -0
- package/dist/src/dataIslandApp.js +10 -0
- package/dist/src/dataIslandApp.js.map +1 -0
- package/dist/src/disposable.d.ts +84 -0
- package/dist/src/disposable.d.ts.map +1 -0
- package/dist/src/disposable.js +147 -0
- package/dist/src/disposable.js.map +1 -0
- package/dist/src/dto/accessGroupResponse.d.ts +27 -0
- package/dist/src/dto/accessGroupResponse.d.ts.map +1 -0
- package/dist/src/dto/accessGroupResponse.js +3 -0
- package/dist/src/dto/accessGroupResponse.js.map +1 -0
- package/dist/src/dto/acquiringResponse.d.ts +46 -0
- package/dist/src/dto/acquiringResponse.d.ts.map +1 -0
- package/dist/src/dto/acquiringResponse.js +11 -0
- package/dist/src/dto/acquiringResponse.js.map +1 -0
- package/dist/src/dto/apiKeyResponse.d.ts +24 -0
- package/dist/src/dto/apiKeyResponse.d.ts.map +1 -0
- package/dist/src/dto/apiKeyResponse.js +3 -0
- package/dist/src/dto/apiKeyResponse.js.map +1 -0
- package/dist/src/dto/badRequestResponse.d.ts +6 -0
- package/dist/src/dto/badRequestResponse.d.ts.map +1 -0
- package/dist/src/dto/badRequestResponse.js +3 -0
- package/dist/src/dto/badRequestResponse.js.map +1 -0
- package/dist/src/dto/chatResponse.d.ts +99 -0
- package/dist/src/dto/chatResponse.d.ts.map +1 -0
- package/dist/src/dto/chatResponse.js +56 -0
- package/dist/src/dto/chatResponse.js.map +1 -0
- package/dist/src/dto/invitesResponse.d.ts +21 -0
- package/dist/src/dto/invitesResponse.d.ts.map +1 -0
- package/dist/src/dto/invitesResponse.js +3 -0
- package/dist/src/dto/invitesResponse.js.map +1 -0
- package/dist/src/dto/libraryResponse.d.ts +42 -0
- package/dist/src/dto/libraryResponse.d.ts.map +1 -0
- package/dist/src/dto/libraryResponse.js +3 -0
- package/dist/src/dto/libraryResponse.js.map +1 -0
- package/dist/src/dto/limitsResponse.d.ts +29 -0
- package/dist/src/dto/limitsResponse.d.ts.map +1 -0
- package/dist/src/dto/limitsResponse.js +13 -0
- package/dist/src/dto/limitsResponse.js.map +1 -0
- package/dist/src/dto/queryFlowResponse.d.ts +34 -0
- package/dist/src/dto/queryFlowResponse.d.ts.map +1 -0
- package/dist/src/dto/queryFlowResponse.js +19 -0
- package/dist/src/dto/queryFlowResponse.js.map +1 -0
- package/dist/src/dto/quizResponse.d.ts +11 -0
- package/dist/src/dto/quizResponse.d.ts.map +1 -0
- package/dist/src/dto/quizResponse.js +3 -0
- package/dist/src/dto/quizResponse.js.map +1 -0
- package/dist/src/dto/statisticsResponse.d.ts +11 -0
- package/dist/src/dto/statisticsResponse.d.ts.map +1 -0
- package/dist/src/dto/statisticsResponse.js +3 -0
- package/dist/src/dto/statisticsResponse.js.map +1 -0
- package/dist/src/dto/userInfoResponse.d.ts +97 -0
- package/dist/src/dto/userInfoResponse.d.ts.map +1 -0
- package/dist/src/dto/userInfoResponse.js +3 -0
- package/dist/src/dto/userInfoResponse.js.map +1 -0
- package/dist/src/dto/workspacesResponse.d.ts +79 -0
- package/dist/src/dto/workspacesResponse.d.ts.map +1 -0
- package/dist/src/dto/workspacesResponse.js +31 -0
- package/dist/src/dto/workspacesResponse.js.map +1 -0
- package/dist/src/events.d.ts +17 -0
- package/dist/src/events.d.ts.map +1 -0
- package/dist/src/events.js +52 -0
- package/dist/src/events.js.map +1 -0
- package/dist/src/index.d.ts +88 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +140 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/app.impl.d.ts +32 -0
- package/dist/src/internal/app.impl.d.ts.map +1 -0
- package/dist/src/internal/app.impl.js +187 -0
- package/dist/src/internal/app.impl.js.map +1 -0
- package/dist/src/internal/appBuilder.impl.d.ts +27 -0
- package/dist/src/internal/appBuilder.impl.d.ts.map +1 -0
- package/dist/src/internal/appBuilder.impl.js +71 -0
- package/dist/src/internal/appBuilder.impl.js.map +1 -0
- package/dist/src/internal/createApp.impl.d.ts +4 -0
- package/dist/src/internal/createApp.impl.d.ts.map +1 -0
- package/dist/src/internal/createApp.impl.js +11 -0
- package/dist/src/internal/createApp.impl.js.map +1 -0
- package/dist/src/internal/registry.d.ts +66 -0
- package/dist/src/internal/registry.d.ts.map +1 -0
- package/dist/src/internal/registry.js +114 -0
- package/dist/src/internal/registry.js.map +1 -0
- package/dist/src/middleware.d.ts +6 -0
- package/dist/src/middleware.d.ts.map +1 -0
- package/dist/src/middleware.js +3 -0
- package/dist/src/middleware.js.map +1 -0
- package/dist/src/services/acquiringService.d.ts +9 -0
- package/dist/src/services/acquiringService.d.ts.map +1 -0
- package/dist/src/services/acquiringService.js +19 -0
- package/dist/src/services/acquiringService.js.map +1 -0
- package/dist/src/services/anonymousService.d.ts +8 -0
- package/dist/src/services/anonymousService.d.ts.map +1 -0
- package/dist/src/services/anonymousService.js +41 -0
- package/dist/src/services/anonymousService.js.map +1 -0
- package/dist/src/services/commandService.d.ts +18 -0
- package/dist/src/services/commandService.d.ts.map +1 -0
- package/dist/src/services/commandService.js +40 -0
- package/dist/src/services/commandService.js.map +1 -0
- package/dist/src/services/cookieService.d.ts +7 -0
- package/dist/src/services/cookieService.d.ts.map +1 -0
- package/dist/src/services/cookieService.js +18 -0
- package/dist/src/services/cookieService.js.map +1 -0
- package/dist/src/services/credentialService.d.ts +9 -0
- package/dist/src/services/credentialService.d.ts.map +1 -0
- package/dist/src/services/credentialService.js +26 -0
- package/dist/src/services/credentialService.js.map +1 -0
- package/dist/src/services/httpMethod.d.ts +2 -0
- package/dist/src/services/httpMethod.d.ts.map +1 -0
- package/dist/src/services/httpMethod.js +3 -0
- package/dist/src/services/httpMethod.js.map +1 -0
- package/dist/src/services/librariesService.d.ts +9 -0
- package/dist/src/services/librariesService.d.ts.map +1 -0
- package/dist/src/services/librariesService.js +19 -0
- package/dist/src/services/librariesService.js.map +1 -0
- package/dist/src/services/middlewareService.d.ts +10 -0
- package/dist/src/services/middlewareService.d.ts.map +1 -0
- package/dist/src/services/middlewareService.js +34 -0
- package/dist/src/services/middlewareService.js.map +1 -0
- package/dist/src/services/organizationService.d.ts +10 -0
- package/dist/src/services/organizationService.d.ts.map +1 -0
- package/dist/src/services/organizationService.js +19 -0
- package/dist/src/services/organizationService.js.map +1 -0
- package/dist/src/services/requestBuilder.d.ts +19 -0
- package/dist/src/services/requestBuilder.d.ts.map +1 -0
- package/dist/src/services/requestBuilder.js +133 -0
- package/dist/src/services/requestBuilder.js.map +1 -0
- package/dist/src/services/responseUtils.d.ts +8 -0
- package/dist/src/services/responseUtils.d.ts.map +1 -0
- package/dist/src/services/responseUtils.js +40 -0
- package/dist/src/services/responseUtils.js.map +1 -0
- package/dist/src/services/rpcService.d.ts +77 -0
- package/dist/src/services/rpcService.d.ts.map +1 -0
- package/dist/src/services/rpcService.js +125 -0
- package/dist/src/services/rpcService.js.map +1 -0
- package/dist/src/services/service.d.ts +21 -0
- package/dist/src/services/service.d.ts.map +1 -0
- package/dist/src/services/service.js +41 -0
- package/dist/src/services/service.js.map +1 -0
- package/dist/src/services/userProfileService.d.ts +10 -0
- package/dist/src/services/userProfileService.d.ts.map +1 -0
- package/dist/src/services/userProfileService.js +59 -0
- package/dist/src/services/userProfileService.js.map +1 -0
- package/dist/src/storages/acquirings/acquiring.d.ts +41 -0
- package/dist/src/storages/acquirings/acquiring.d.ts.map +1 -0
- package/dist/src/storages/acquirings/acquiring.impl.d.ts +20 -0
- package/dist/src/storages/acquirings/acquiring.impl.d.ts.map +1 -0
- package/dist/src/storages/acquirings/acquiring.impl.js +92 -0
- package/dist/src/storages/acquirings/acquiring.impl.js.map +1 -0
- package/dist/src/storages/acquirings/acquiring.js +10 -0
- package/dist/src/storages/acquirings/acquiring.js.map +1 -0
- package/dist/src/storages/chats/answer.d.ts +41 -0
- package/dist/src/storages/chats/answer.d.ts.map +1 -0
- package/dist/src/storages/chats/answer.impl.d.ts +29 -0
- package/dist/src/storages/chats/answer.impl.d.ts.map +1 -0
- package/dist/src/storages/chats/answer.impl.js +134 -0
- package/dist/src/storages/chats/answer.impl.js.map +1 -0
- package/dist/src/storages/chats/answer.js +15 -0
- package/dist/src/storages/chats/answer.js.map +1 -0
- package/dist/src/storages/chats/chat.d.ts +60 -0
- package/dist/src/storages/chats/chat.d.ts.map +1 -0
- package/dist/src/storages/chats/chat.impl.d.ts +29 -0
- package/dist/src/storages/chats/chat.impl.d.ts.map +1 -0
- package/dist/src/storages/chats/chat.impl.js +110 -0
- package/dist/src/storages/chats/chat.impl.js.map +1 -0
- package/dist/src/storages/chats/chat.js +12 -0
- package/dist/src/storages/chats/chat.js.map +1 -0
- package/dist/src/storages/chats/chats.d.ts +63 -0
- package/dist/src/storages/chats/chats.d.ts.map +1 -0
- package/dist/src/storages/chats/chats.impl.d.ts +25 -0
- package/dist/src/storages/chats/chats.impl.d.ts.map +1 -0
- package/dist/src/storages/chats/chats.impl.js +287 -0
- package/dist/src/storages/chats/chats.impl.js.map +1 -0
- package/dist/src/storages/chats/chats.js +16 -0
- package/dist/src/storages/chats/chats.js.map +1 -0
- package/dist/src/storages/files/file.d.ts +59 -0
- package/dist/src/storages/files/file.d.ts.map +1 -0
- package/dist/src/storages/files/file.impl.d.ts +27 -0
- package/dist/src/storages/files/file.impl.d.ts.map +1 -0
- package/dist/src/storages/files/file.impl.js +104 -0
- package/dist/src/storages/files/file.impl.js.map +1 -0
- package/dist/src/storages/files/file.js +11 -0
- package/dist/src/storages/files/file.js.map +1 -0
- package/dist/src/storages/files/files.d.ts +39 -0
- package/dist/src/storages/files/files.d.ts.map +1 -0
- package/dist/src/storages/files/files.impl.d.ts +26 -0
- package/dist/src/storages/files/files.impl.d.ts.map +1 -0
- package/dist/src/storages/files/files.impl.js +199 -0
- package/dist/src/storages/files/files.impl.js.map +1 -0
- package/dist/src/storages/files/files.js +20 -0
- package/dist/src/storages/files/files.js.map +1 -0
- package/dist/src/storages/files/filesPage.d.ts +28 -0
- package/dist/src/storages/files/filesPage.d.ts.map +1 -0
- package/dist/src/storages/files/filesPage.impl.d.ts +15 -0
- package/dist/src/storages/files/filesPage.impl.d.ts.map +1 -0
- package/dist/src/storages/files/filesPage.impl.js +38 -0
- package/dist/src/storages/files/filesPage.impl.js.map +1 -0
- package/dist/src/storages/files/filesPage.js +10 -0
- package/dist/src/storages/files/filesPage.js.map +1 -0
- package/dist/src/storages/groups/group.d.ts +63 -0
- package/dist/src/storages/groups/group.d.ts.map +1 -0
- package/dist/src/storages/groups/group.impl.d.ts +38 -0
- package/dist/src/storages/groups/group.impl.d.ts.map +1 -0
- package/dist/src/storages/groups/group.impl.js +210 -0
- package/dist/src/storages/groups/group.impl.js.map +1 -0
- package/dist/src/storages/groups/group.js +15 -0
- package/dist/src/storages/groups/group.js.map +1 -0
- package/dist/src/storages/groups/groups.d.ts +43 -0
- package/dist/src/storages/groups/groups.d.ts.map +1 -0
- package/dist/src/storages/groups/groups.impl.d.ts +31 -0
- package/dist/src/storages/groups/groups.impl.d.ts.map +1 -0
- package/dist/src/storages/groups/groups.impl.js +136 -0
- package/dist/src/storages/groups/groups.impl.js.map +1 -0
- package/dist/src/storages/groups/groups.js +20 -0
- package/dist/src/storages/groups/groups.js.map +1 -0
- package/dist/src/storages/library/folderId.d.ts +2 -0
- package/dist/src/storages/library/folderId.d.ts.map +1 -0
- package/dist/src/storages/library/folderId.js +3 -0
- package/dist/src/storages/library/folderId.js.map +1 -0
- package/dist/src/storages/library/libraries.d.ts +48 -0
- package/dist/src/storages/library/libraries.d.ts.map +1 -0
- package/dist/src/storages/library/libraries.impl.d.ts +26 -0
- package/dist/src/storages/library/libraries.impl.d.ts.map +1 -0
- package/dist/src/storages/library/libraries.impl.js +148 -0
- package/dist/src/storages/library/libraries.impl.js.map +1 -0
- package/dist/src/storages/library/libraries.js +16 -0
- package/dist/src/storages/library/libraries.js.map +1 -0
- package/dist/src/storages/library/library.d.ts +30 -0
- package/dist/src/storages/library/library.d.ts.map +1 -0
- package/dist/src/storages/library/library.impl.d.ts +19 -0
- package/dist/src/storages/library/library.impl.d.ts.map +1 -0
- package/dist/src/storages/library/library.impl.js +98 -0
- package/dist/src/storages/library/library.impl.js.map +1 -0
- package/dist/src/storages/library/library.js +10 -0
- package/dist/src/storages/library/library.js.map +1 -0
- package/dist/src/storages/library/libraryFolder.d.ts +16 -0
- package/dist/src/storages/library/libraryFolder.d.ts.map +1 -0
- package/dist/src/storages/library/libraryFolder.impl.d.ts +22 -0
- package/dist/src/storages/library/libraryFolder.impl.d.ts.map +1 -0
- package/dist/src/storages/library/libraryFolder.impl.js +104 -0
- package/dist/src/storages/library/libraryFolder.impl.js.map +1 -0
- package/dist/src/storages/library/libraryFolder.js +7 -0
- package/dist/src/storages/library/libraryFolder.js.map +1 -0
- package/dist/src/storages/library/libraryId.d.ts +2 -0
- package/dist/src/storages/library/libraryId.d.ts.map +1 -0
- package/dist/src/storages/library/libraryId.js +3 -0
- package/dist/src/storages/library/libraryId.js.map +1 -0
- package/dist/src/storages/library/libraryPage.d.ts +45 -0
- package/dist/src/storages/library/libraryPage.d.ts.map +1 -0
- package/dist/src/storages/library/libraryPage.impl.d.ts +26 -0
- package/dist/src/storages/library/libraryPage.impl.d.ts.map +1 -0
- package/dist/src/storages/library/libraryPage.impl.js +29 -0
- package/dist/src/storages/library/libraryPage.impl.js.map +1 -0
- package/dist/src/storages/library/libraryPage.js +10 -0
- package/dist/src/storages/library/libraryPage.js.map +1 -0
- package/dist/src/storages/organizations/organization.d.ts +164 -0
- package/dist/src/storages/organizations/organization.d.ts.map +1 -0
- package/dist/src/storages/organizations/organization.impl.d.ts +63 -0
- package/dist/src/storages/organizations/organization.impl.d.ts.map +1 -0
- package/dist/src/storages/organizations/organization.impl.js +388 -0
- package/dist/src/storages/organizations/organization.impl.js.map +1 -0
- package/dist/src/storages/organizations/organization.js +27 -0
- package/dist/src/storages/organizations/organization.js.map +1 -0
- package/dist/src/storages/organizations/organizationPrompts.d.ts +33 -0
- package/dist/src/storages/organizations/organizationPrompts.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizationPrompts.impl.d.ts +17 -0
- package/dist/src/storages/organizations/organizationPrompts.impl.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizationPrompts.impl.js +71 -0
- package/dist/src/storages/organizations/organizationPrompts.impl.js.map +1 -0
- package/dist/src/storages/organizations/organizationPrompts.js +7 -0
- package/dist/src/storages/organizations/organizationPrompts.js.map +1 -0
- package/dist/src/storages/organizations/organizations.d.ts +77 -0
- package/dist/src/storages/organizations/organizations.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizations.impl.d.ts +45 -0
- package/dist/src/storages/organizations/organizations.impl.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizations.impl.js +242 -0
- package/dist/src/storages/organizations/organizations.impl.js.map +1 -0
- package/dist/src/storages/organizations/organizations.js +20 -0
- package/dist/src/storages/organizations/organizations.js.map +1 -0
- package/dist/src/storages/queryFlows/queryFlow.d.ts +14 -0
- package/dist/src/storages/queryFlows/queryFlow.d.ts.map +1 -0
- package/dist/src/storages/queryFlows/queryFlow.impl.d.ts +18 -0
- package/dist/src/storages/queryFlows/queryFlow.impl.d.ts.map +1 -0
- package/dist/src/storages/queryFlows/queryFlow.impl.js +81 -0
- package/dist/src/storages/queryFlows/queryFlow.impl.js.map +1 -0
- package/dist/src/storages/queryFlows/queryFlow.js +12 -0
- package/dist/src/storages/queryFlows/queryFlow.js.map +1 -0
- package/dist/src/storages/queryFlows/queryFlows.d.ts +21 -0
- package/dist/src/storages/queryFlows/queryFlows.d.ts.map +1 -0
- package/dist/src/storages/queryFlows/queryFlows.impl.d.ts +16 -0
- package/dist/src/storages/queryFlows/queryFlows.impl.d.ts.map +1 -0
- package/dist/src/storages/queryFlows/queryFlows.impl.js +110 -0
- package/dist/src/storages/queryFlows/queryFlows.impl.js.map +1 -0
- package/dist/src/storages/queryFlows/queryFlows.js +16 -0
- package/dist/src/storages/queryFlows/queryFlows.js.map +1 -0
- package/dist/src/storages/user/userProfile.d.ts +68 -0
- package/dist/src/storages/user/userProfile.d.ts.map +1 -0
- package/dist/src/storages/user/userProfile.impl.d.ts +25 -0
- package/dist/src/storages/user/userProfile.impl.d.ts.map +1 -0
- package/dist/src/storages/user/userProfile.impl.js +145 -0
- package/dist/src/storages/user/userProfile.impl.js.map +1 -0
- package/dist/src/storages/user/userProfile.js +12 -0
- package/dist/src/storages/user/userProfile.js.map +1 -0
- package/dist/src/storages/workspaces/workspace.d.ts +50 -0
- package/dist/src/storages/workspaces/workspace.d.ts.map +1 -0
- package/dist/src/storages/workspaces/workspace.impl.d.ts +25 -0
- package/dist/src/storages/workspaces/workspace.impl.d.ts.map +1 -0
- package/dist/src/storages/workspaces/workspace.impl.js +133 -0
- package/dist/src/storages/workspaces/workspace.impl.js.map +1 -0
- package/dist/src/storages/workspaces/workspace.js +18 -0
- package/dist/src/storages/workspaces/workspace.js.map +1 -0
- package/dist/src/storages/workspaces/workspaces.d.ts +47 -0
- package/dist/src/storages/workspaces/workspaces.d.ts.map +1 -0
- package/dist/src/storages/workspaces/workspaces.impl.d.ts +33 -0
- package/dist/src/storages/workspaces/workspaces.impl.d.ts.map +1 -0
- package/dist/src/storages/workspaces/workspaces.impl.js +153 -0
- package/dist/src/storages/workspaces/workspaces.impl.js.map +1 -0
- package/dist/src/storages/workspaces/workspaces.js +19 -0
- package/dist/src/storages/workspaces/workspaces.js.map +1 -0
- package/dist/src/unitTest.d.ts +12 -0
- package/dist/src/unitTest.d.ts.map +1 -0
- package/dist/src/unitTest.js +44 -0
- package/dist/src/unitTest.js.map +1 -0
- package/dist/src/utils/browserUtils.d.ts +4 -0
- package/dist/src/utils/browserUtils.d.ts.map +1 -0
- package/dist/src/utils/browserUtils.js +64 -0
- package/dist/src/utils/browserUtils.js.map +1 -0
- package/dist/src/utils/request.d.ts +6 -0
- package/dist/src/utils/request.d.ts.map +1 -0
- package/dist/src/utils/request.js +3 -0
- package/dist/src/utils/request.js.map +1 -0
- package/dist/src/utils/utils.d.ts +3 -0
- package/dist/src/utils/utils.d.ts.map +1 -0
- package/dist/src/utils/utils.js +13 -0
- package/dist/src/utils/utils.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +42 -7
- package/src/commands/deleteUserFullCommandHandler.ts +19 -0
- package/src/commands/startCommandHandler.ts +22 -5
- package/src/context.ts +4 -2
- package/src/credentials.ts +46 -0
- package/src/dataIslandApp.ts +12 -0
- package/src/disposable.ts +18 -5
- package/src/dto/accessGroupResponse.ts +17 -16
- package/src/dto/acquiringResponse.ts +54 -0
- package/src/dto/apiKeyResponse.ts +29 -0
- package/src/dto/badRequestResponse.ts +6 -0
- package/src/dto/chatResponse.ts +33 -8
- package/src/dto/invitesResponse.ts +25 -0
- package/src/dto/libraryResponse.ts +51 -0
- package/src/dto/limitsResponse.ts +32 -0
- package/src/dto/queryFlowResponse.ts +42 -0
- package/src/dto/quizResponse.ts +12 -0
- package/src/dto/statisticsResponse.ts +12 -0
- package/src/dto/userInfoResponse.ts +70 -2
- package/src/dto/workspacesResponse.ts +53 -5
- package/src/index.ts +71 -14
- package/src/internal/app.impl.ts +61 -10
- package/src/internal/registry.ts +54 -6
- package/src/middleware.ts +2 -0
- package/src/services/acquiringService.ts +21 -0
- package/src/services/anonymousService.ts +43 -0
- package/src/services/commandService.ts +4 -2
- package/src/services/cookieService.ts +16 -0
- package/src/services/httpMethod.ts +1 -0
- package/src/services/librariesService.ts +22 -0
- package/src/services/middlewareService.ts +1 -0
- package/src/services/requestBuilder.ts +49 -9
- package/src/services/responseUtils.ts +12 -0
- package/src/services/rpcService.ts +1 -0
- package/src/services/userProfileService.ts +34 -2
- package/src/storages/acquirings/acquiring.impl.ts +132 -0
- package/src/storages/acquirings/acquiring.ts +54 -0
- package/src/storages/chats/answer.impl.ts +82 -67
- package/src/storages/chats/answer.ts +23 -12
- package/src/storages/chats/chat.impl.ts +63 -8
- package/src/storages/chats/chat.ts +39 -1
- package/src/storages/chats/chats.impl.ts +260 -5
- package/src/storages/chats/chats.ts +28 -1
- package/src/storages/files/file.impl.ts +83 -26
- package/src/storages/files/file.ts +55 -5
- package/src/storages/files/files.impl.ts +130 -63
- package/src/storages/files/files.ts +12 -5
- package/src/storages/files/filesPage.impl.ts +37 -0
- package/src/storages/files/filesPage.ts +6 -0
- package/src/storages/groups/group.impl.ts +276 -0
- package/src/storages/groups/group.ts +73 -0
- package/src/storages/groups/groups.impl.ts +31 -177
- package/src/storages/groups/groups.ts +9 -60
- package/src/storages/library/folderId.ts +1 -0
- package/src/storages/library/libraries.impl.ts +209 -0
- package/src/storages/library/libraries.ts +56 -0
- package/src/storages/library/library.impl.ts +151 -0
- package/src/storages/library/library.ts +35 -0
- package/src/storages/library/libraryFolder.impl.ts +144 -0
- package/src/storages/library/libraryFolder.ts +23 -0
- package/src/storages/library/libraryId.ts +1 -0
- package/src/storages/library/libraryPage.impl.ts +39 -0
- package/src/storages/library/libraryPage.ts +56 -0
- package/src/storages/organizations/organization.impl.ts +506 -8
- package/src/storages/organizations/organization.ts +167 -5
- package/src/storages/organizations/organizationPrompts.impl.ts +109 -0
- package/src/storages/organizations/organizationPrompts.ts +41 -0
- package/src/storages/organizations/organizations.impl.ts +152 -9
- package/src/storages/organizations/organizations.ts +37 -0
- package/src/storages/queryFlows/queryFlow.impl.ts +96 -0
- package/src/storages/queryFlows/queryFlow.ts +28 -0
- package/src/storages/queryFlows/queryFlows.impl.ts +149 -0
- package/src/storages/queryFlows/queryFlows.ts +31 -0
- package/src/storages/user/userProfile.impl.ts +122 -0
- package/src/storages/user/userProfile.ts +44 -0
- package/src/storages/workspaces/workspace.impl.ts +65 -5
- package/src/storages/workspaces/workspace.ts +13 -0
- package/src/storages/workspaces/workspaces.impl.ts +19 -22
- package/src/storages/workspaces/workspaces.ts +5 -1
- package/src/unitTest.ts +3 -3
- package/src/utils/browserUtils.ts +68 -0
- package/src/utils/request.ts +6 -0
- package/src/utils/utils.ts +8 -0
- package/.browserslistrc +0 -5
- package/.editorconfig +0 -25
- package/.eslintrc.json +0 -44
- package/.github/workflows/docs.yml +0 -32
- package/.github/workflows/format.yml +0 -42
- package/.github/workflows/publish-npm.yml +0 -44
- package/.github/workflows/tests.yml +0 -38
- package/.github/workflows/version.yml +0 -44
- package/.prettierignore +0 -1
- package/.prettierrc +0 -11
- package/.yarnrc +0 -2
- package/babel.config.js +0 -6
- package/docs/.nojekyll +0 -1
- package/docs/classes/BasicCredential.md +0 -80
- package/docs/classes/BearerCredential.md +0 -72
- package/docs/classes/Chat.md +0 -97
- package/docs/classes/Chats.md +0 -176
- package/docs/classes/CredentialBase.md +0 -54
- package/docs/classes/DataIslandApp.md +0 -168
- package/docs/classes/DebugCredential.md +0 -72
- package/docs/classes/DefaultCredential.md +0 -56
- package/docs/classes/DisposableContainer.md +0 -177
- package/docs/classes/EventDispatcher.md +0 -109
- package/docs/classes/File.md +0 -79
- package/docs/classes/Files.md +0 -136
- package/docs/classes/FilesPage.md +0 -76
- package/docs/classes/Group.md +0 -209
- package/docs/classes/Groups.md +0 -154
- package/docs/classes/Lifetime.md +0 -108
- package/docs/classes/Organization.md +0 -125
- package/docs/classes/Organizations.md +0 -195
- package/docs/classes/UserProfile.md +0 -156
- package/docs/classes/Workspace.md +0 -165
- package/docs/classes/Workspaces.md +0 -193
- package/docs/enums/ChatAnswerType.md +0 -22
- package/docs/enums/ChatsEvent.md +0 -22
- package/docs/enums/FilesEvent.md +0 -24
- package/docs/enums/GroupEvent.md +0 -31
- package/docs/enums/OrganizationsEvent.md +0 -31
- package/docs/enums/UserEvent.md +0 -15
- package/docs/enums/WorkspaceEvent.md +0 -17
- package/docs/enums/WorkspacesEvent.md +0 -24
- package/docs/interfaces/Disposable.md +0 -25
- package/docs/interfaces/Event.md +0 -58
- package/docs/interfaces/EventSubscriber.md +0 -41
- package/docs/interfaces/Input.md +0 -35
- package/docs/modules.md +0 -207
- package/jest.config.ts +0 -199
- package/jest.setup.ts +0 -2
- package/scripts/docs/index.js +0 -15
- package/test/chats.test.ts +0 -48
- package/test/commands.test.ts +0 -24
- package/test/data/test_file.pdf +0 -0
- package/test/disposable.test.ts +0 -39
- package/test/events.test.ts +0 -151
- package/test/files.test.ts +0 -52
- package/test/index.test.ts +0 -122
- package/test/organization.test.ts +0 -69
- package/test/registry.test.ts +0 -44
- package/test/services.test.ts +0 -56
- package/test/setup.ts +0 -61
- package/test/unitTest.test.ts +0 -21
- package/test/workspace.test.ts +0 -71
- package/tsconfig.json +0 -31
@@ -1,14 +1,20 @@
|
|
1
1
|
import {
|
2
2
|
AnswerStatus,
|
3
|
-
|
4
|
-
SourceDto,
|
5
|
-
StepType
|
3
|
+
SourceDto
|
6
4
|
} from "../../dto/chatResponse"
|
5
|
+
import { EventDispatcher } from "../../events"
|
7
6
|
|
8
7
|
export type AnswerId = string
|
9
8
|
export type StepId = string
|
10
9
|
|
11
|
-
export
|
10
|
+
export enum AnswerEvent {
|
11
|
+
ADDED = "added",
|
12
|
+
CANCALLED = "cancelled",
|
13
|
+
FAILED = "failed",
|
14
|
+
UPDATED = "updated"
|
15
|
+
}
|
16
|
+
|
17
|
+
export abstract class Answer extends EventDispatcher<AnswerEvent, Answer> {
|
12
18
|
|
13
19
|
/**
|
14
20
|
* Answer id.
|
@@ -16,24 +22,29 @@ export abstract class Answer {
|
|
16
22
|
abstract get id(): AnswerId
|
17
23
|
|
18
24
|
/**
|
19
|
-
* Answer
|
25
|
+
* Answer data object
|
20
26
|
*/
|
21
|
-
abstract get
|
27
|
+
abstract get question(): string
|
22
28
|
|
23
29
|
/**
|
24
|
-
* Answer
|
30
|
+
* Answer tokens
|
25
31
|
*/
|
26
|
-
abstract
|
32
|
+
abstract get tokens(): string
|
27
33
|
|
28
34
|
/**
|
29
|
-
*
|
35
|
+
* Answer status.
|
36
|
+
*/
|
37
|
+
abstract get status(): AnswerStatus
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Answer sources.
|
30
41
|
*/
|
31
|
-
abstract
|
42
|
+
abstract get sources(): SourceDto[]
|
32
43
|
|
33
44
|
/**
|
34
|
-
*
|
45
|
+
* Answer time.
|
35
46
|
*/
|
36
|
-
abstract
|
47
|
+
abstract get timestamp(): number
|
37
48
|
|
38
49
|
/**
|
39
50
|
* Cancel answer
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Chat, ChatAnswerType } from "./chat"
|
2
2
|
import { Disposable } from "../../disposable"
|
3
|
-
import { Answer } from "./answer"
|
4
|
-
import {
|
3
|
+
import { Answer, AnswerId } from "./answer"
|
4
|
+
import {ChatDto, ChatResourceDto} from "../../dto/chatResponse"
|
5
5
|
import { Context } from "../../context"
|
6
6
|
import { AnswerImpl } from "./answer.impl"
|
7
7
|
import { RpcService } from "../../services/rpcService"
|
@@ -10,7 +10,7 @@ import { Organization } from "../organizations/organization"
|
|
10
10
|
|
11
11
|
export class ChatImpl extends Chat implements Disposable {
|
12
12
|
private _isDisposed: boolean = false
|
13
|
-
private
|
13
|
+
private _answers: AnswerImpl[] = []
|
14
14
|
|
15
15
|
private _content?: ChatDto
|
16
16
|
|
@@ -24,10 +24,11 @@ export class ChatImpl extends Chat implements Disposable {
|
|
24
24
|
async initFrom(chat: ChatDto): Promise<ChatImpl> {
|
25
25
|
this._content = chat
|
26
26
|
|
27
|
+
this._answers = []
|
27
28
|
// init answers
|
28
29
|
for (const ans of chat.answers) {
|
29
30
|
// create answer implementation
|
30
|
-
const answer =
|
31
|
+
const answer = new AnswerImpl(this, this.context).initFromHistory(ans)
|
31
32
|
|
32
33
|
// add answer to the collection
|
33
34
|
this._answers.push(answer)
|
@@ -36,6 +37,27 @@ export class ChatImpl extends Chat implements Disposable {
|
|
36
37
|
return this
|
37
38
|
}
|
38
39
|
|
40
|
+
async update(): Promise<void> {
|
41
|
+
const response = await this.context
|
42
|
+
.resolve(RpcService)
|
43
|
+
?.requestBuilder("api/v1/Chats")
|
44
|
+
.searchParam("id", this.id)
|
45
|
+
.sendGet()
|
46
|
+
|
47
|
+
// check response status
|
48
|
+
if (ResponseUtils.isFail(response)) {
|
49
|
+
await ResponseUtils.throwError(
|
50
|
+
`Get chat for id ${this.id} is failed`,
|
51
|
+
response
|
52
|
+
)
|
53
|
+
}
|
54
|
+
|
55
|
+
// parse chat from the server's response
|
56
|
+
const chat = (await response!.json() as { chat: ChatDto }).chat as ChatDto
|
57
|
+
|
58
|
+
await this.initFrom(chat)
|
59
|
+
}
|
60
|
+
|
39
61
|
get id(): string {
|
40
62
|
return <string>this._content?.id
|
41
63
|
}
|
@@ -44,15 +66,43 @@ export class ChatImpl extends Chat implements Disposable {
|
|
44
66
|
return <string>this._content?.name
|
45
67
|
}
|
46
68
|
|
69
|
+
get resource(): ChatResourceDto {
|
70
|
+
return <ChatResourceDto>this._content?.resources
|
71
|
+
}
|
72
|
+
|
73
|
+
get model(): string {
|
74
|
+
return <string>this._content?.model
|
75
|
+
}
|
76
|
+
|
77
|
+
get createAt(): number{
|
78
|
+
return <number>this._content?.createdAt
|
79
|
+
}
|
80
|
+
|
81
|
+
get modifiedAt(): number{
|
82
|
+
return <number>this._content?.modifiedAt
|
83
|
+
}
|
84
|
+
get clientContext(): string {
|
85
|
+
return <string>this._content?.clientContext
|
86
|
+
}
|
87
|
+
|
47
88
|
get collection(): readonly Answer[] {
|
48
|
-
return this._answers
|
89
|
+
return <Answer[]>this._answers
|
49
90
|
}
|
50
91
|
|
51
92
|
get isDisposed(): boolean {
|
52
93
|
return this._isDisposed
|
53
94
|
}
|
54
95
|
|
55
|
-
|
96
|
+
public getAnswer(id: AnswerId): Answer {
|
97
|
+
const answer = this._answers.find(answer => answer.id === id)
|
98
|
+
if (answer) {
|
99
|
+
return answer
|
100
|
+
}
|
101
|
+
throw new Error(`Answer with id ${id} is not found`)
|
102
|
+
}
|
103
|
+
|
104
|
+
async ask(message: string, answerType: ChatAnswerType): Promise<Answer | undefined> {
|
105
|
+
|
56
106
|
// send request to the server
|
57
107
|
const response = await this.context
|
58
108
|
.resolve(RpcService)
|
@@ -65,14 +115,17 @@ export class ChatImpl extends Chat implements Disposable {
|
|
65
115
|
|
66
116
|
// check response status
|
67
117
|
if (ResponseUtils.isFail(response)) {
|
118
|
+
if (await ResponseUtils.isLimitReached()){
|
119
|
+
return undefined
|
120
|
+
}
|
68
121
|
await ResponseUtils.throwError(`Failed to ask a question, organization: ${this.organization.id}`, response)
|
69
122
|
}
|
70
123
|
|
71
124
|
// parse answer id from the server's response
|
72
|
-
const id = (await response!.json()).id
|
125
|
+
const id = (await response!.json() as { id: string }).id
|
73
126
|
|
74
127
|
// create answer implementation
|
75
|
-
const answer = await new AnswerImpl(this, this.context).
|
128
|
+
const answer = await new AnswerImpl(this, this.context).initNew(id, message)
|
76
129
|
|
77
130
|
// add answer to the collection
|
78
131
|
this._answers.push(answer)
|
@@ -80,6 +133,8 @@ export class ChatImpl extends Chat implements Disposable {
|
|
80
133
|
return answer
|
81
134
|
}
|
82
135
|
|
136
|
+
|
137
|
+
|
83
138
|
dispose(): void {
|
84
139
|
this._isDisposed = true
|
85
140
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Answer } from "./answer"
|
2
2
|
import { Organization } from "../organizations/organization"
|
3
|
+
import {ChatResourceDto} from "../../dto/chatResponse"
|
3
4
|
|
4
5
|
export type ChatId = string
|
5
6
|
|
@@ -25,14 +26,51 @@ export abstract class Chat {
|
|
25
26
|
*/
|
26
27
|
abstract get name(): string
|
27
28
|
|
29
|
+
/**
|
30
|
+
* Chat resource info : type ChatType, related entities Ids.
|
31
|
+
*/
|
32
|
+
abstract get resource(): ChatResourceDto
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Model.
|
36
|
+
*/
|
37
|
+
abstract get model(): string
|
38
|
+
|
39
|
+
/**
|
40
|
+
* CreateAt.
|
41
|
+
*/
|
42
|
+
abstract get createAt(): number
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Modified at.
|
46
|
+
*/
|
47
|
+
abstract get modifiedAt(): number
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Added client context.
|
51
|
+
*/
|
52
|
+
abstract get clientContext(): string
|
53
|
+
|
28
54
|
/**
|
29
55
|
* Answers list.
|
30
56
|
*/
|
31
57
|
abstract get collection(): ReadonlyArray<Answer>
|
32
58
|
|
59
|
+
/**
|
60
|
+
* Get answer by id
|
61
|
+
* @param id answer id
|
62
|
+
*/
|
63
|
+
abstract getAnswer(id: string): Answer
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Update chat
|
67
|
+
*/
|
68
|
+
abstract update(): Promise<void>
|
69
|
+
|
33
70
|
/**
|
34
71
|
* Ask new question in chat.
|
35
72
|
*/
|
36
|
-
abstract ask(message: string, answerType: ChatAnswerType): Promise<Answer>
|
73
|
+
abstract ask(message: string, answerType: ChatAnswerType): Promise<Answer | undefined>
|
74
|
+
|
37
75
|
}
|
38
76
|
|
@@ -7,6 +7,8 @@ import { OrganizationId } from "../organizations/organizations"
|
|
7
7
|
import { Chat } from "./chat"
|
8
8
|
import { ChatImpl } from "./chat.impl"
|
9
9
|
import { Chats, ChatsEvent } from "./chats"
|
10
|
+
import {LibraryId} from "../library/libraryId"
|
11
|
+
import {LibrariesService} from "../../services/librariesService"
|
10
12
|
|
11
13
|
export class ChatsImpl extends Chats {
|
12
14
|
private readonly _chats: Chat[] = []
|
@@ -19,6 +21,16 @@ export class ChatsImpl extends Chats {
|
|
19
21
|
}
|
20
22
|
|
21
23
|
async initFrom(organizationId: OrganizationId): Promise<void> {
|
24
|
+
await this.loadOrganizationChats(organizationId)
|
25
|
+
const libraries = (this.context.resolve(LibrariesService) as LibrariesService).libraries.collection
|
26
|
+
for (const library of libraries){
|
27
|
+
await this.loadLibraryChats(library.id)
|
28
|
+
}
|
29
|
+
|
30
|
+
this._chats.sort((a, b) => b.modifiedAt - a.modifiedAt)
|
31
|
+
}
|
32
|
+
|
33
|
+
async loadOrganizationChats(organizationId: OrganizationId): Promise<void> {
|
22
34
|
// init chats from the server's response
|
23
35
|
const limit = 100
|
24
36
|
const page = 0
|
@@ -55,7 +67,45 @@ export class ChatsImpl extends Chats {
|
|
55
67
|
data: chat
|
56
68
|
})
|
57
69
|
}
|
70
|
+
}
|
71
|
+
|
72
|
+
async loadLibraryChats(libraryId: LibraryId): Promise<void>{
|
73
|
+
// init chats from the server's response
|
74
|
+
const limit = 100
|
75
|
+
const page = 0
|
76
|
+
const response = await this.context
|
77
|
+
.resolve(RpcService)
|
78
|
+
?.requestBuilder("api/v1/Chats/list/library")
|
79
|
+
.searchParam("libraryId", libraryId)
|
80
|
+
.searchParam("limit", limit.toString())
|
81
|
+
.searchParam("page", page.toString())
|
82
|
+
.sendGet()
|
83
|
+
|
84
|
+
// check response status
|
85
|
+
if (ResponseUtils.isFail(response)) {
|
86
|
+
await ResponseUtils.throwError(
|
87
|
+
`Chats list library id:${libraryId}, page:${page}, limit:${limit}, failed`,
|
88
|
+
response
|
89
|
+
)
|
90
|
+
}
|
58
91
|
|
92
|
+
// parse chats from the server's response
|
93
|
+
const chats = (await response!.json()) as ChatListResponse
|
94
|
+
|
95
|
+
// init chats
|
96
|
+
for (const cht of chats.chats) {
|
97
|
+
// create chat implementation
|
98
|
+
const chat = await new ChatImpl(this.context, this.organization).initFrom(cht)
|
99
|
+
|
100
|
+
// add chat to the collection
|
101
|
+
this._chats.push(chat)
|
102
|
+
|
103
|
+
// dispatch event
|
104
|
+
this.dispatch({
|
105
|
+
type: ChatsEvent.ADDED,
|
106
|
+
data: chat
|
107
|
+
})
|
108
|
+
}
|
59
109
|
}
|
60
110
|
|
61
111
|
get collection(): readonly Chat[] {
|
@@ -70,28 +120,41 @@ export class ChatsImpl extends Chats {
|
|
70
120
|
return this._chats.find(chat => chat.id === id)
|
71
121
|
}
|
72
122
|
|
73
|
-
async create(): Promise<Chat> {
|
123
|
+
async create(model: string, clientContext: string = ""): Promise<Chat | undefined> {
|
124
|
+
if (model === undefined || model === null) {
|
125
|
+
throw new Error("Create chat, model is undefined or null")
|
126
|
+
}
|
127
|
+
|
128
|
+
if (model.length === 0) {
|
129
|
+
throw new Error("Create chat, model is empty")
|
130
|
+
}
|
74
131
|
|
75
132
|
// send create request to the server
|
76
133
|
const response = await this.context
|
77
134
|
.resolve(RpcService)
|
78
|
-
?.requestBuilder("api/v1/Chats")
|
79
|
-
.sendPostJson({ organizationId: this.organization.id })
|
135
|
+
?.requestBuilder("api/v1/Chats/workspaces")
|
136
|
+
.sendPostJson({ organizationId: this.organization.id, model: model, clientContext: clientContext })
|
80
137
|
|
81
138
|
// check response status
|
82
139
|
if (ResponseUtils.isFail(response)) {
|
140
|
+
if (await ResponseUtils.isLimitReached()){
|
141
|
+
return undefined
|
142
|
+
}
|
143
|
+
|
83
144
|
await ResponseUtils.throwError(`Failed to create chat, organization: ${this.organization.id}`, response)
|
84
145
|
}
|
85
146
|
|
86
147
|
// parse workspace from the server's response
|
87
|
-
const content = (await response!.json()
|
148
|
+
const content = (await response!.json() as {
|
149
|
+
chat: ChatDto
|
150
|
+
}).chat as ChatDto
|
88
151
|
|
89
152
|
// create workspace implementation
|
90
153
|
const chat = new ChatImpl(this.context, this.organization)
|
91
154
|
await chat.initFrom(content)
|
92
155
|
|
93
156
|
// add chat to the collection
|
94
|
-
this._chats.
|
157
|
+
this._chats.splice(0, 0, chat)
|
95
158
|
|
96
159
|
// dispatch event
|
97
160
|
this.dispatch({
|
@@ -102,6 +165,198 @@ export class ChatsImpl extends Chats {
|
|
102
165
|
return chat
|
103
166
|
}
|
104
167
|
|
168
|
+
async createWithFile(fileId: string): Promise<Chat | undefined> {
|
169
|
+
if (fileId === undefined || fileId === null) {
|
170
|
+
throw new Error("Create chat with file, id is undefined or null")
|
171
|
+
}
|
172
|
+
if (fileId.length === 0 || fileId.trim().length === 0) {
|
173
|
+
throw new Error("Create chat with file, id is empty")
|
174
|
+
}
|
175
|
+
|
176
|
+
// send create request to the server
|
177
|
+
const response = await this.context
|
178
|
+
.resolve(RpcService)
|
179
|
+
?.requestBuilder("api/v1/Chats/file")
|
180
|
+
.sendPostJson({
|
181
|
+
organizationId: this.organization.id,
|
182
|
+
fileId: fileId,
|
183
|
+
model: "search"
|
184
|
+
})
|
185
|
+
|
186
|
+
// check response status
|
187
|
+
if (ResponseUtils.isFail(response)) {
|
188
|
+
if (await ResponseUtils.isLimitReached()){
|
189
|
+
return undefined
|
190
|
+
}
|
191
|
+
|
192
|
+
await ResponseUtils.throwError(`Failed to create chat, organization: ${this.organization.id}`, response)
|
193
|
+
}
|
194
|
+
|
195
|
+
// parse workspace from the server's response
|
196
|
+
const content = (await response!.json() as {
|
197
|
+
chat: ChatDto
|
198
|
+
}).chat as ChatDto
|
199
|
+
|
200
|
+
// create workspace implementation
|
201
|
+
const chat = new ChatImpl(this.context, this.organization)
|
202
|
+
await chat.initFrom(content)
|
203
|
+
|
204
|
+
// add chat to the collection
|
205
|
+
this._chats.splice(0, 0, chat)
|
206
|
+
|
207
|
+
// dispatch event
|
208
|
+
this.dispatch({
|
209
|
+
type: ChatsEvent.ADDED,
|
210
|
+
data: chat
|
211
|
+
})
|
212
|
+
|
213
|
+
return chat
|
214
|
+
}
|
215
|
+
|
216
|
+
async createWithWorkspace(workspaceIds: string[], clientContext: string = ""): Promise<Chat | undefined> {
|
217
|
+
if (workspaceIds === undefined || workspaceIds === null) {
|
218
|
+
throw new Error("Create chat with workspace, ids are undefined or null")
|
219
|
+
}
|
220
|
+
if (workspaceIds.length === 0) {
|
221
|
+
throw new Error("Create chat with workspace, ids are empty")
|
222
|
+
}
|
223
|
+
|
224
|
+
// send create request to the server
|
225
|
+
const response = await this.context
|
226
|
+
.resolve(RpcService)
|
227
|
+
?.requestBuilder("api/v1/Chats/workspaces")
|
228
|
+
.sendPostJson({
|
229
|
+
organizationId: this.organization.id,
|
230
|
+
model: "search",
|
231
|
+
clientContext: clientContext,
|
232
|
+
workspaceIds: workspaceIds
|
233
|
+
})
|
234
|
+
|
235
|
+
// check response status
|
236
|
+
if (ResponseUtils.isFail(response)) {
|
237
|
+
if (await ResponseUtils.isLimitReached()){
|
238
|
+
return undefined
|
239
|
+
}
|
240
|
+
|
241
|
+
await ResponseUtils.throwError(`Failed to create chat in workspace, organization: ${this.organization.id}`, response)
|
242
|
+
}
|
243
|
+
|
244
|
+
// parse workspace from the server's response
|
245
|
+
const content = (await response!.json() as {
|
246
|
+
chat: ChatDto
|
247
|
+
}).chat as ChatDto
|
248
|
+
|
249
|
+
// create workspace implementation
|
250
|
+
const chat = new ChatImpl(this.context, this.organization)
|
251
|
+
await chat.initFrom(content)
|
252
|
+
|
253
|
+
// add chat to the collection
|
254
|
+
this._chats.splice(0, 0, chat)
|
255
|
+
|
256
|
+
// dispatch event
|
257
|
+
this.dispatch({
|
258
|
+
type: ChatsEvent.ADDED,
|
259
|
+
data: chat
|
260
|
+
})
|
261
|
+
|
262
|
+
return chat
|
263
|
+
}
|
264
|
+
|
265
|
+
async createWithLibraryFolder(libraryId: string, folderIds: string[] | null = null): Promise<Chat | undefined>{
|
266
|
+
if (libraryId === undefined || libraryId === null || libraryId.trim() === "") {
|
267
|
+
throw new Error("Create chat with library folder, library id is undefined, null or empty")
|
268
|
+
}
|
269
|
+
|
270
|
+
// send create request to the server
|
271
|
+
const response = await this.context
|
272
|
+
.resolve(RpcService)
|
273
|
+
?.requestBuilder("api/v1/chats/library/folders")
|
274
|
+
.sendPostJson({
|
275
|
+
libraryId: libraryId,
|
276
|
+
folderIds: folderIds,
|
277
|
+
model: "search",
|
278
|
+
clientContext: "",
|
279
|
+
})
|
280
|
+
|
281
|
+
// check response status
|
282
|
+
if (ResponseUtils.isFail(response)) {
|
283
|
+
if (await ResponseUtils.isLimitReached()){
|
284
|
+
return undefined
|
285
|
+
}
|
286
|
+
|
287
|
+
await ResponseUtils.throwError(`Failed to create chat in library with folder, library: ${libraryId}`, response)
|
288
|
+
}
|
289
|
+
|
290
|
+
// parse workspace from the server's response
|
291
|
+
const content = (await response!.json() as {
|
292
|
+
chat: ChatDto
|
293
|
+
}).chat as ChatDto
|
294
|
+
|
295
|
+
// create workspace implementation
|
296
|
+
const chat = new ChatImpl(this.context, this.organization)
|
297
|
+
await chat.initFrom(content)
|
298
|
+
|
299
|
+
// add chat to the collection
|
300
|
+
this._chats.splice(0, 0, chat)
|
301
|
+
|
302
|
+
// dispatch event
|
303
|
+
this.dispatch({
|
304
|
+
type: ChatsEvent.ADDED,
|
305
|
+
data: chat
|
306
|
+
})
|
307
|
+
|
308
|
+
return chat
|
309
|
+
}
|
310
|
+
|
311
|
+
async createWithLibraryFile(libraryId: string, fileId: string): Promise<Chat | undefined>{
|
312
|
+
if (libraryId === undefined || libraryId === null || libraryId.trim() === "") {
|
313
|
+
throw new Error("Create chat with library file, library id is undefined, null or empty")
|
314
|
+
}
|
315
|
+
|
316
|
+
// send create request to the server
|
317
|
+
const response = await this.context
|
318
|
+
.resolve(RpcService)
|
319
|
+
?.requestBuilder("api/v1/chats/library/file")
|
320
|
+
.sendPostJson({
|
321
|
+
libraryId: libraryId,
|
322
|
+
fileId: fileId,
|
323
|
+
model: "search",
|
324
|
+
clientContext: "",
|
325
|
+
})
|
326
|
+
|
327
|
+
// check response status
|
328
|
+
if (ResponseUtils.isFail(response)) {
|
329
|
+
if (await ResponseUtils.isLimitReached()){
|
330
|
+
return undefined
|
331
|
+
}
|
332
|
+
|
333
|
+
await ResponseUtils.throwError(`Failed to create chat in library with file, library: ${libraryId}`, response)
|
334
|
+
}
|
335
|
+
|
336
|
+
// parse workspace from the server's response
|
337
|
+
const content = (await response!.json() as {
|
338
|
+
chat: ChatDto
|
339
|
+
}).chat as ChatDto
|
340
|
+
|
341
|
+
// create workspace implementation
|
342
|
+
const chat = new ChatImpl(this.context, this.organization)
|
343
|
+
await chat.initFrom(content)
|
344
|
+
|
345
|
+
// add chat to the collection
|
346
|
+
this._chats.splice(0, 0, chat)
|
347
|
+
|
348
|
+
// dispatch event
|
349
|
+
this.dispatch({
|
350
|
+
type: ChatsEvent.ADDED,
|
351
|
+
data: chat
|
352
|
+
})
|
353
|
+
|
354
|
+
return chat
|
355
|
+
}
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
105
360
|
async delete(id: string): Promise<void> {
|
106
361
|
// get chat by id
|
107
362
|
const chat = <ChatImpl>this.tryGet(id)
|
@@ -25,7 +25,34 @@ export abstract class Chats extends EventDispatcher<ChatsEvent, Chat> {
|
|
25
25
|
/**
|
26
26
|
* Create new chat.
|
27
27
|
*/
|
28
|
-
abstract create(): Promise<Chat>
|
28
|
+
abstract create(model: string, clientContext: string): Promise<Chat | undefined>
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Create chat with specific file
|
32
|
+
* @param fileId
|
33
|
+
*/
|
34
|
+
abstract createWithFile(fileId: string): Promise<Chat | undefined>
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Create chat with specific workspace
|
38
|
+
* @param workspaceIds
|
39
|
+
* @param clientContext
|
40
|
+
*/
|
41
|
+
abstract createWithWorkspace(workspaceIds: string[], clientContext: string): Promise<Chat | undefined>
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Create chat with library folders
|
45
|
+
* @param libraryId
|
46
|
+
* @param folderIds
|
47
|
+
*/
|
48
|
+
abstract createWithLibraryFolder(libraryId: string, folderIds: string[]): Promise<Chat | undefined>
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Create chat with library file
|
52
|
+
* @param libraryId
|
53
|
+
* @param fileId
|
54
|
+
*/
|
55
|
+
abstract createWithLibraryFile(libraryId: string, fileId: string): Promise<Chat | undefined>
|
29
56
|
|
30
57
|
/**
|
31
58
|
* Get chat by id.
|