@neuralinnovations/dataisland-sdk 0.0.1-dev9 → 0.1.1
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 +99 -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 +129 -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 +81 -0
- package/dist/src/storages/organizations/organizations.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizations.impl.d.ts +46 -0
- package/dist/src/storages/organizations/organizations.impl.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizations.impl.js +256 -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 +72 -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 +78 -66
- 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 +170 -9
- package/src/storages/organizations/organizations.ts +42 -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
@@ -0,0 +1,23 @@
|
|
1
|
+
import { LibraryPage } from "./libraryPage"
|
2
|
+
import { FolderId } from "./folderId"
|
3
|
+
import { LibraryId } from "./libraryId"
|
4
|
+
|
5
|
+
export abstract class LibraryFolder {
|
6
|
+
|
7
|
+
abstract get libraryId(): LibraryId
|
8
|
+
|
9
|
+
abstract get folderId(): FolderId
|
10
|
+
|
11
|
+
abstract get name(): string
|
12
|
+
|
13
|
+
abstract get description(): string
|
14
|
+
|
15
|
+
abstract get iconId(): string
|
16
|
+
|
17
|
+
abstract itemsCount(): Promise<number>
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Query files.
|
21
|
+
*/
|
22
|
+
abstract query(query: string, page: number, limit: number): Promise<LibraryPage>
|
23
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type LibraryId = string
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { LibraryPage, LibraryParent } from "./libraryPage"
|
2
|
+
import { LibraryFolder } from "./libraryFolder"
|
3
|
+
import { File } from "../files/file"
|
4
|
+
import { FolderId } from "./folderId"
|
5
|
+
|
6
|
+
export class LibraryParentImpl extends LibraryParent {
|
7
|
+
/**
|
8
|
+
* Get parent id.
|
9
|
+
*/
|
10
|
+
public id: FolderId
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Get parent name.
|
14
|
+
*/
|
15
|
+
public name: string
|
16
|
+
|
17
|
+
constructor(id: FolderId, name: string) {
|
18
|
+
super()
|
19
|
+
this.id = id
|
20
|
+
this.name = name
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
export class LibraryPageImpl extends LibraryPage {
|
25
|
+
|
26
|
+
public libraryId: string = ""
|
27
|
+
public parents: LibraryParent[] = []
|
28
|
+
public files: File[] = []
|
29
|
+
public folders: LibraryFolder[] = []
|
30
|
+
|
31
|
+
public total: number = 0
|
32
|
+
public filesPerPage: number = 0
|
33
|
+
public page: number = 0
|
34
|
+
|
35
|
+
get pages(): number {
|
36
|
+
return Math.ceil(Math.max(this.total / this.filesPerPage, 1.0))
|
37
|
+
}
|
38
|
+
|
39
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { LibraryFolder } from "./libraryFolder"
|
2
|
+
import { File } from "../files/file"
|
3
|
+
import { FolderId } from "./folderId"
|
4
|
+
|
5
|
+
import { LibraryId } from "./libraryId"
|
6
|
+
|
7
|
+
export abstract class LibraryParent {
|
8
|
+
/**
|
9
|
+
* Get parent id.
|
10
|
+
*/
|
11
|
+
abstract get id(): FolderId
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Get parent name.
|
15
|
+
*/
|
16
|
+
abstract get name(): string
|
17
|
+
}
|
18
|
+
|
19
|
+
export abstract class LibraryPage {
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Get library id.
|
23
|
+
*/
|
24
|
+
abstract get libraryId(): LibraryId
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Get current page.
|
28
|
+
*/
|
29
|
+
abstract get parents(): LibraryParent[]
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Get page files.
|
33
|
+
*/
|
34
|
+
abstract get files(): File[]
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Get page folders
|
38
|
+
*/
|
39
|
+
abstract get folders(): LibraryFolder[]
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Get pages count.
|
43
|
+
*/
|
44
|
+
abstract get pages(): number
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Get total count.
|
48
|
+
*/
|
49
|
+
abstract get total(): number
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Get current page.
|
53
|
+
*/
|
54
|
+
abstract get page(): number
|
55
|
+
|
56
|
+
}
|
@@ -1,7 +1,16 @@
|
|
1
1
|
import { OrganizationId } from "./organizations"
|
2
2
|
import { Disposable } from "../../disposable"
|
3
|
-
import {
|
4
|
-
|
3
|
+
import {
|
4
|
+
CurrentLimitItem,
|
5
|
+
CurrentLimitRecordData,
|
6
|
+
CurrentLimitsData,
|
7
|
+
OrganizationDto,
|
8
|
+
OrganizationSegmentData,
|
9
|
+
UserDto,
|
10
|
+
UserLimitsData,
|
11
|
+
UsersStatisticsResponse
|
12
|
+
} from "../../dto/userInfoResponse"
|
13
|
+
import { WorkspaceId, Workspaces } from "../workspaces/workspaces"
|
5
14
|
import { WorkspacesImpl } from "../workspaces/workspaces.impl"
|
6
15
|
import { Context } from "../../context"
|
7
16
|
import { Organization } from "./organization"
|
@@ -11,6 +20,26 @@ import { ChatsImpl } from "../chats/chats.impl"
|
|
11
20
|
import { Chats } from "../chats/chats"
|
12
21
|
import { RpcService } from "../../services/rpcService"
|
13
22
|
import { ResponseUtils } from "../../services/responseUtils"
|
23
|
+
import { StatisticsResponse } from "../../dto/statisticsResponse"
|
24
|
+
import {
|
25
|
+
LimitActionType,
|
26
|
+
SegmentData,
|
27
|
+
SegmentsData
|
28
|
+
} from "../../dto/limitsResponse"
|
29
|
+
import { FileId } from "../files/file"
|
30
|
+
import { QuizData } from "../../dto/quizResponse"
|
31
|
+
import { InviteCodeResponse, InviteResponse } from "../../dto/invitesResponse"
|
32
|
+
import {
|
33
|
+
ApiKeyResponse,
|
34
|
+
OrganizationApiKey,
|
35
|
+
OrganizationKeysResponse, TokenResponse
|
36
|
+
} from "../../dto/apiKeyResponse"
|
37
|
+
import { IconResponse } from "../../dto/workspacesResponse"
|
38
|
+
import { UploadFile } from "../files/files"
|
39
|
+
import { QueryFlowsImpl } from "../queryFlows/queryFlows.impl"
|
40
|
+
import { QueryFlows } from "../queryFlows/queryFlows"
|
41
|
+
import { OrganizationPromptsImpl } from "./organizationPrompts.impl"
|
42
|
+
import { OrganizationPrompts } from "./organizationPrompts"
|
14
43
|
|
15
44
|
export class OrganizationImpl extends Organization implements Disposable {
|
16
45
|
private _isDisposed: boolean = false
|
@@ -18,13 +47,17 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
18
47
|
private _content?: OrganizationDto
|
19
48
|
private readonly _workspaces: WorkspacesImpl
|
20
49
|
private readonly _accessGroups: GroupsImpl
|
50
|
+
private readonly _queryFlows: QueryFlowsImpl
|
21
51
|
private readonly _chats: ChatsImpl
|
52
|
+
private readonly _prompts: OrganizationPromptsImpl
|
22
53
|
|
23
54
|
constructor(private readonly context: Context) {
|
24
55
|
super()
|
25
56
|
this._workspaces = new WorkspacesImpl(this, this.context)
|
26
57
|
this._accessGroups = new GroupsImpl(this, this.context)
|
27
58
|
this._chats = new ChatsImpl(this, this.context)
|
59
|
+
this._queryFlows = new QueryFlowsImpl(this, this.context)
|
60
|
+
this._prompts = new OrganizationPromptsImpl(this, this.context)
|
28
61
|
}
|
29
62
|
|
30
63
|
public async initFrom(
|
@@ -35,11 +68,21 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
35
68
|
this._isAdmin = isAdmin
|
36
69
|
|
37
70
|
// init workspaces by organization id
|
38
|
-
|
71
|
+
const promises = [
|
72
|
+
this._workspaces.initFrom(content.id),
|
73
|
+
this._chats.initFrom(content.id),
|
74
|
+
this._accessGroups.initialize()
|
75
|
+
]
|
76
|
+
|
77
|
+
await Promise.all(promises)
|
39
78
|
|
40
79
|
return this
|
41
80
|
}
|
42
81
|
|
82
|
+
get prompts(): OrganizationPrompts {
|
83
|
+
return this._prompts
|
84
|
+
}
|
85
|
+
|
43
86
|
get isAdmin(): boolean {
|
44
87
|
return this._isAdmin
|
45
88
|
}
|
@@ -57,11 +100,19 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
57
100
|
}
|
58
101
|
|
59
102
|
get name(): string {
|
60
|
-
return <
|
103
|
+
return <string>this._content?.profile.name
|
61
104
|
}
|
62
105
|
|
63
106
|
get description(): string {
|
64
|
-
return <
|
107
|
+
return <string>this._content?.profile.description
|
108
|
+
}
|
109
|
+
|
110
|
+
get icon(): string {
|
111
|
+
return <string>this._content?.profile.iconId
|
112
|
+
}
|
113
|
+
|
114
|
+
get isAllowedInLibraries(): boolean {
|
115
|
+
return <boolean>this._content?.profile.isAllowedInLibraries
|
65
116
|
}
|
66
117
|
|
67
118
|
get workspaces(): Workspaces {
|
@@ -72,11 +123,264 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
72
123
|
return this._accessGroups
|
73
124
|
}
|
74
125
|
|
126
|
+
get queryFlows(): QueryFlows {
|
127
|
+
return this._queryFlows
|
128
|
+
}
|
129
|
+
|
75
130
|
get chats(): Chats {
|
76
131
|
return this._chats
|
77
132
|
}
|
78
|
-
|
79
|
-
async
|
133
|
+
|
134
|
+
async members(): Promise<UserDto[]> {
|
135
|
+
// send request to the server
|
136
|
+
const response = await this.context
|
137
|
+
.resolve(RpcService)
|
138
|
+
?.requestBuilder("api/v1/Organizations/members")
|
139
|
+
.searchParam("id", this.id)
|
140
|
+
.sendGet()
|
141
|
+
|
142
|
+
// check response status
|
143
|
+
if (ResponseUtils.isFail(response)) {
|
144
|
+
await ResponseUtils.throwError(
|
145
|
+
`Failed during fetch of organization members ${this.id}`,
|
146
|
+
response
|
147
|
+
)
|
148
|
+
}
|
149
|
+
|
150
|
+
return (await response!.json() as {
|
151
|
+
members: UserDto[]
|
152
|
+
}).members as UserDto[]
|
153
|
+
}
|
154
|
+
|
155
|
+
async change(name: string, description: string): Promise<void> {
|
156
|
+
if (!this._content) {
|
157
|
+
throw new Error("Organization is not loaded.")
|
158
|
+
}
|
159
|
+
|
160
|
+
if (name === this.name && description === this.description) {
|
161
|
+
return Promise.resolve()
|
162
|
+
}
|
163
|
+
if (name === undefined || name === null || name.trim() === "") {
|
164
|
+
throw new Error("Name is required. Please provide a valid name.")
|
165
|
+
}
|
166
|
+
if (
|
167
|
+
description === undefined ||
|
168
|
+
description === null ||
|
169
|
+
description.trim() === ""
|
170
|
+
) {
|
171
|
+
throw new Error(
|
172
|
+
"Description is required. Please provide a valid description."
|
173
|
+
)
|
174
|
+
}
|
175
|
+
|
176
|
+
const response = await this.context
|
177
|
+
.resolve(RpcService)
|
178
|
+
?.requestBuilder("api/v1/Organizations")
|
179
|
+
.sendPutJson({
|
180
|
+
organizationId: this.id,
|
181
|
+
profile: {
|
182
|
+
name,
|
183
|
+
description
|
184
|
+
}
|
185
|
+
})
|
186
|
+
|
187
|
+
if (ResponseUtils.isFail(response)) {
|
188
|
+
await ResponseUtils.throwError("Failed to change organization", response)
|
189
|
+
}
|
190
|
+
|
191
|
+
if (this._content) {
|
192
|
+
this._content.profile.name = name
|
193
|
+
this._content.profile.description = description
|
194
|
+
}
|
195
|
+
|
196
|
+
this.fireChanged()
|
197
|
+
}
|
198
|
+
|
199
|
+
async uploadIcon(icon: UploadFile): Promise<string> {
|
200
|
+
// check icon file
|
201
|
+
if (icon === undefined || icon === null) {
|
202
|
+
throw new Error("Organization icon upload, file is undefined or null")
|
203
|
+
}
|
204
|
+
|
205
|
+
// form data to send
|
206
|
+
const form = new FormData()
|
207
|
+
form.append("OrganizationId", this.id)
|
208
|
+
form.append("FileName", icon.name)
|
209
|
+
form.append("File", icon, icon.name)
|
210
|
+
|
211
|
+
// send request to the server
|
212
|
+
const response = await this.context
|
213
|
+
.resolve(RpcService)
|
214
|
+
?.requestBuilder("api/v1/Organizations/icon")
|
215
|
+
.sendPutFormData(form)
|
216
|
+
|
217
|
+
// check response status
|
218
|
+
if (ResponseUtils.isFail(response)) {
|
219
|
+
await ResponseUtils.throwError(`Organization icon upload ${icon.name}`, response)
|
220
|
+
}
|
221
|
+
|
222
|
+
const iconResponse = await response!.json() as IconResponse
|
223
|
+
|
224
|
+
return iconResponse.iconId
|
225
|
+
}
|
226
|
+
|
227
|
+
async statistics(dateFrom: number, dateTo: number): Promise<StatisticsResponse> {
|
228
|
+
// send request to the server
|
229
|
+
const response = await this.context
|
230
|
+
.resolve(RpcService)
|
231
|
+
?.requestBuilder("api/v1/Stats/organization")
|
232
|
+
.searchParam("organizationId", this.id)
|
233
|
+
.searchParam("dateFrom", dateFrom.toString())
|
234
|
+
.searchParam("dateTo", dateTo.toString())
|
235
|
+
.sendGet()
|
236
|
+
|
237
|
+
// check response status
|
238
|
+
if (ResponseUtils.isFail(response)) {
|
239
|
+
await ResponseUtils.throwError(
|
240
|
+
`Failed during fetch of organization statistics ${this.id}`,
|
241
|
+
response
|
242
|
+
)
|
243
|
+
}
|
244
|
+
|
245
|
+
return await response!.json() as StatisticsResponse
|
246
|
+
}
|
247
|
+
|
248
|
+
async membersStatistics(dateFrom: number, dateTo: number): Promise<UsersStatisticsResponse> {
|
249
|
+
// send request to the server
|
250
|
+
const response = await this.context
|
251
|
+
.resolve(RpcService)
|
252
|
+
?.requestBuilder("api/v1/Stats/organization/members")
|
253
|
+
.searchParam("organizationId", this.id)
|
254
|
+
.searchParam("dateFrom", dateFrom.toString())
|
255
|
+
.searchParam("dateTo", dateTo.toString())
|
256
|
+
.sendGet()
|
257
|
+
|
258
|
+
// check response status
|
259
|
+
if (ResponseUtils.isFail(response)) {
|
260
|
+
await ResponseUtils.throwError(
|
261
|
+
`Failed during fetch of organization members statistics ${this.id}`,
|
262
|
+
response
|
263
|
+
)
|
264
|
+
}
|
265
|
+
|
266
|
+
return await response!.json() as UsersStatisticsResponse
|
267
|
+
}
|
268
|
+
|
269
|
+
async userStatistic(userId: string, dateFrom: number, dateTo: number): Promise<StatisticsResponse> {
|
270
|
+
// send request to the server
|
271
|
+
const response = await this.context
|
272
|
+
.resolve(RpcService)
|
273
|
+
?.requestBuilder("api/v1/Stats/user")
|
274
|
+
.searchParam("userId", userId)
|
275
|
+
.searchParam("organizationId", this.id)
|
276
|
+
.searchParam("dateFrom", dateFrom.toString())
|
277
|
+
.searchParam("dateTo", dateTo.toString())
|
278
|
+
.sendGet()
|
279
|
+
|
280
|
+
// check response status
|
281
|
+
if (ResponseUtils.isFail(response)) {
|
282
|
+
await ResponseUtils.throwError(
|
283
|
+
`Failed during fetch of user statistics ${this.id}`,
|
284
|
+
response
|
285
|
+
)
|
286
|
+
}
|
287
|
+
|
288
|
+
return await response!.json() as StatisticsResponse
|
289
|
+
}
|
290
|
+
|
291
|
+
async userLimits(): Promise<CurrentLimitsData> {
|
292
|
+
// fetch limits
|
293
|
+
const response = await this.context.resolve(RpcService)
|
294
|
+
?.requestBuilder("api/v1/Users/limits")
|
295
|
+
.sendGet()
|
296
|
+
|
297
|
+
// check response status
|
298
|
+
if (ResponseUtils.isFail(response)) {
|
299
|
+
await ResponseUtils.throwError(`Failed to get limits in organization: ${this.id}`, response)
|
300
|
+
}
|
301
|
+
|
302
|
+
// parse limits from the server's response
|
303
|
+
const limits = (await response!.json()) as UserLimitsData
|
304
|
+
|
305
|
+
const currentLimits = {
|
306
|
+
segment: limits.userSegment.key,
|
307
|
+
limits: []
|
308
|
+
} as CurrentLimitsData
|
309
|
+
for (const limit of limits.userLimits) {
|
310
|
+
const type = limit.action as LimitActionType
|
311
|
+
const currentItem = {
|
312
|
+
action: type,
|
313
|
+
records: []
|
314
|
+
} as CurrentLimitItem
|
315
|
+
|
316
|
+
if (limit.records.length == 0) continue
|
317
|
+
|
318
|
+
for (const record of limit.records) {
|
319
|
+
const segmentRecord = limits.userSegment.dayItems.find(item => item.daysCount == record.daysCount)
|
320
|
+
if (segmentRecord == null) {
|
321
|
+
throw new Error(`Invalid response during get limits in organization: ${this.id}. Days count with ${type} not found in segment ${limits.userSegment.key}`)
|
322
|
+
}
|
323
|
+
const actionRecord = segmentRecord?.actionItems.find(item => item.type == type)
|
324
|
+
if (actionRecord == null) {
|
325
|
+
throw new Error(`Invalid response during get limits in organization: ${this.id}. Type ${type} not found in segment ${limits.userSegment.key}`)
|
326
|
+
}
|
327
|
+
|
328
|
+
const currentRecord = {} as CurrentLimitRecordData
|
329
|
+
currentRecord.daysCount = record.daysCount
|
330
|
+
currentRecord.activeTill = record.activeTill
|
331
|
+
currentRecord.all = actionRecord?.tokenLimit ?? actionRecord?.countLimit
|
332
|
+
|
333
|
+
const available = record.tokenLimit ?? record.countLimit
|
334
|
+
currentRecord.used = currentRecord.all - available
|
335
|
+
|
336
|
+
currentItem.records.push(currentRecord)
|
337
|
+
}
|
338
|
+
|
339
|
+
currentLimits.limits.push(currentItem)
|
340
|
+
}
|
341
|
+
|
342
|
+
return currentLimits
|
343
|
+
}
|
344
|
+
|
345
|
+
async organizationLimits(): Promise<SegmentData> {
|
346
|
+
// fetch limits
|
347
|
+
const response = await this.context.resolve(RpcService)
|
348
|
+
?.requestBuilder("api/v1/Descriptions/limits/organization")
|
349
|
+
.searchParam("organizationId", this.id)
|
350
|
+
.sendGet()
|
351
|
+
|
352
|
+
// check response status
|
353
|
+
if (ResponseUtils.isFail(response)) {
|
354
|
+
await ResponseUtils.throwError(`Failed to get limits in organization: ${this.id}`, response)
|
355
|
+
}
|
356
|
+
|
357
|
+
const json = await response!.json()
|
358
|
+
|
359
|
+
// parse limits from the server's response
|
360
|
+
const limits = (json as OrganizationSegmentData).segment
|
361
|
+
|
362
|
+
return limits
|
363
|
+
}
|
364
|
+
|
365
|
+
async limitSegments(): Promise<SegmentData[]> {
|
366
|
+
// fetch limits
|
367
|
+
const response = await this.context.resolve(RpcService)
|
368
|
+
?.requestBuilder("api/v1/Descriptions/limits/segments")
|
369
|
+
.sendGet()
|
370
|
+
|
371
|
+
// check response status
|
372
|
+
if (ResponseUtils.isFail(response)) {
|
373
|
+
await ResponseUtils.throwError(`Failed to get limits in organization: ${this.id}`, response)
|
374
|
+
}
|
375
|
+
const json = await response!.json()
|
376
|
+
|
377
|
+
// parse limits from the server's response
|
378
|
+
const limits = (json as SegmentsData).segments
|
379
|
+
|
380
|
+
return limits
|
381
|
+
}
|
382
|
+
|
383
|
+
async inviteUsers(emails: string[], accessGroups: string[]): Promise<void> {
|
80
384
|
const response = await this.context
|
81
385
|
.resolve(RpcService)
|
82
386
|
?.requestBuilder("api/v1/Invites")
|
@@ -87,9 +391,203 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
87
391
|
})
|
88
392
|
if (ResponseUtils.isFail(response)) {
|
89
393
|
await ResponseUtils.throwError(
|
90
|
-
`Invite
|
394
|
+
`Invite users failed for organization ${this.id}`,
|
395
|
+
response
|
396
|
+
)
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
async createInviteCode(accessGroups: string[], validateDomain?: string): Promise<string> {
|
401
|
+
let validateObj = null
|
402
|
+
if (validateDomain !== null && validateDomain !== undefined) {
|
403
|
+
validateObj = {
|
404
|
+
domain: validateDomain
|
405
|
+
}
|
406
|
+
}
|
407
|
+
|
408
|
+
const response = await this.context
|
409
|
+
.resolve(RpcService)
|
410
|
+
?.requestBuilder("api/v1/Invites/link")
|
411
|
+
.sendPostJson({
|
412
|
+
organizationId: this.id,
|
413
|
+
accessGroupIds: accessGroups,
|
414
|
+
validation: validateObj
|
415
|
+
})
|
416
|
+
if (ResponseUtils.isFail(response)) {
|
417
|
+
await ResponseUtils.throwError(
|
418
|
+
`Invite code creation failed for organization ${this.id}`,
|
419
|
+
response
|
420
|
+
)
|
421
|
+
}
|
422
|
+
|
423
|
+
const json = await response!.json()
|
424
|
+
|
425
|
+
const code = (json as InviteCodeResponse).code
|
426
|
+
|
427
|
+
return code
|
428
|
+
}
|
429
|
+
|
430
|
+
async deleteInviteCode(code: string): Promise<void> {
|
431
|
+
if (code === undefined || code === null || code.trim() === "") {
|
432
|
+
throw new Error("Invite code is required. Please provide a valid code.")
|
433
|
+
}
|
434
|
+
|
435
|
+
const response = await this.context
|
436
|
+
.resolve(RpcService)
|
437
|
+
?.requestBuilder("api/v1/Invites/link")
|
438
|
+
.searchParam("code", code)
|
439
|
+
.sendDelete()
|
440
|
+
|
441
|
+
// check response status
|
442
|
+
if (ResponseUtils.isFail(response)) {
|
443
|
+
await ResponseUtils.throwError(
|
444
|
+
`Failed to delete invite for code: ${code}`,
|
445
|
+
response
|
446
|
+
)
|
447
|
+
}
|
448
|
+
}
|
449
|
+
|
450
|
+
async getOrganizationInvites(): Promise<InviteResponse> {
|
451
|
+
// get invites
|
452
|
+
const response = await this.context.resolve(RpcService)
|
453
|
+
?.requestBuilder("api/v1/Invites/link/organization")
|
454
|
+
.searchParam("organizationId", this.id)
|
455
|
+
.sendGet()
|
456
|
+
|
457
|
+
// check response status
|
458
|
+
if (ResponseUtils.isFail(response)) {
|
459
|
+
await ResponseUtils.throwError(`Failed to get invites in organization: ${this.id}`, response)
|
460
|
+
}
|
461
|
+
|
462
|
+
const json = await response!.json()
|
463
|
+
|
464
|
+
return json as InviteResponse
|
465
|
+
}
|
466
|
+
|
467
|
+
async createApiKey(name: string, accessGroups: string[]): Promise<OrganizationApiKey> {
|
468
|
+
if (name === null || name === undefined || name.trim() === "") {
|
469
|
+
throw new Error("Name is required. Please provide a valid name.")
|
470
|
+
}
|
471
|
+
|
472
|
+
const response = await this.context
|
473
|
+
.resolve(RpcService)
|
474
|
+
?.requestBuilder("api/v1/Keys/organization/exist")
|
475
|
+
.sendPostJson({
|
476
|
+
organizationId: this.id,
|
477
|
+
accessGroupIds: accessGroups,
|
478
|
+
keyName: name
|
479
|
+
})
|
480
|
+
|
481
|
+
if (ResponseUtils.isFail(response)) {
|
482
|
+
await ResponseUtils.throwError(
|
483
|
+
`API key creation failed for organization ${this.id}`,
|
484
|
+
response
|
485
|
+
)
|
486
|
+
}
|
487
|
+
|
488
|
+
const json = await response!.json()
|
489
|
+
|
490
|
+
const key = (json as ApiKeyResponse).apiKey
|
491
|
+
|
492
|
+
return key
|
493
|
+
}
|
494
|
+
|
495
|
+
async getApiKeys(): Promise<OrganizationApiKey[]> {
|
496
|
+
// get invites
|
497
|
+
const response = await this.context.resolve(RpcService)
|
498
|
+
?.requestBuilder("api/v1/Keys/organization")
|
499
|
+
.searchParam("organizationId", this.id)
|
500
|
+
.sendGet()
|
501
|
+
|
502
|
+
// check response status
|
503
|
+
if (ResponseUtils.isFail(response)) {
|
504
|
+
await ResponseUtils.throwError(`Failed to get api keys fot organization: ${this.id}`, response)
|
505
|
+
}
|
506
|
+
|
507
|
+
const json = await response!.json()
|
508
|
+
|
509
|
+
const keys = (json as OrganizationKeysResponse).keys
|
510
|
+
|
511
|
+
return keys
|
512
|
+
}
|
513
|
+
|
514
|
+
async getTokenFromKey(key: string, userId: string, userName: string, userMetadata: string): Promise<TokenResponse> {
|
515
|
+
// get invites
|
516
|
+
const response = await this.context.resolve(RpcService)
|
517
|
+
?.requestBuilder("api/v1/Keys/user/token/jwt")
|
518
|
+
.searchParam("apiKey", key)
|
519
|
+
.searchParam("userId", userId)
|
520
|
+
.searchParam("userName", userName)
|
521
|
+
.searchParam("userMetadata", userMetadata)
|
522
|
+
.sendGet()
|
523
|
+
|
524
|
+
// check response status
|
525
|
+
if (ResponseUtils.isFail(response)) {
|
526
|
+
await ResponseUtils.throwError(`Failed to get token from key for org: ${this.id}`, response)
|
527
|
+
}
|
528
|
+
|
529
|
+
const json = await response!.json()
|
530
|
+
|
531
|
+
return json as TokenResponse
|
532
|
+
}
|
533
|
+
|
534
|
+
async deleteApiKey(key: string): Promise<void> {
|
535
|
+
if (key === null || key === undefined || key.trim() === "") {
|
536
|
+
throw new Error("Key is required. Please provide a valid key.")
|
537
|
+
}
|
538
|
+
|
539
|
+
const response = await this.context
|
540
|
+
.resolve(RpcService)
|
541
|
+
?.requestBuilder("api/v1/Keys/organization")
|
542
|
+
.searchParam("apiKey", key)
|
543
|
+
.sendDelete()
|
544
|
+
|
545
|
+
if (ResponseUtils.isFail(response)) {
|
546
|
+
await ResponseUtils.throwError("Api key delete error", response)
|
547
|
+
}
|
548
|
+
}
|
549
|
+
|
550
|
+
async createQuiz(workspaces: WorkspaceId[], query: string, questionsCount: number, optionsCount: number, fileId: FileId): Promise<QuizData> {
|
551
|
+
const response = await this.context
|
552
|
+
.resolve(RpcService)
|
553
|
+
?.requestBuilder("api/v1/Quiz")
|
554
|
+
.sendPostJson({
|
555
|
+
query: query,
|
556
|
+
questionsCount: questionsCount,
|
557
|
+
optionsCount: optionsCount,
|
558
|
+
organizationId: this.id,
|
559
|
+
workspaceIds: workspaces,
|
560
|
+
fileId: fileId
|
561
|
+
})
|
562
|
+
if (ResponseUtils.isFail(response)) {
|
563
|
+
await ResponseUtils.throwError(
|
564
|
+
`Quiz creation failed for organization ${this.id} with query ${query}`,
|
91
565
|
response
|
92
566
|
)
|
93
567
|
}
|
568
|
+
|
569
|
+
return (await response!.json()) as QuizData
|
570
|
+
}
|
571
|
+
|
572
|
+
async deleteOrganizationMember(userIds: string[]): Promise<void> {
|
573
|
+
if (userIds === undefined || userIds === null) {
|
574
|
+
throw new Error(`Users delete from org ${this.id}, ids array is undefined or null`)
|
575
|
+
}
|
576
|
+
if (userIds.length === 0) {
|
577
|
+
throw new Error(`Users delete from org ${this.id}, array of ids is empty`)
|
578
|
+
}
|
579
|
+
|
580
|
+
const response = await this.context
|
581
|
+
.resolve(RpcService)
|
582
|
+
?.requestBuilder("api/v1/Organizations/member")
|
583
|
+
.searchParam("organizationId", this.id)
|
584
|
+
.searchParam("userIds", userIds.toString())
|
585
|
+
.sendDelete()
|
586
|
+
|
587
|
+
if (ResponseUtils.isFail(response)) {
|
588
|
+
await ResponseUtils.throwError(`Users delete from org ${this.id} failed`, response)
|
589
|
+
}
|
590
|
+
|
591
|
+
this.fireChanged()
|
94
592
|
}
|
95
593
|
}
|