@neuralinnovations/dataisland-sdk 0.0.1-dev2 → 0.0.1-dev4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.editorconfig +4 -1
  2. package/.eslintrc.json +1 -1
  3. package/README.md +91 -2
  4. package/jest.config.ts +3 -3
  5. package/jest.setup.ts +2 -2
  6. package/package.json +3 -2
  7. package/src/appBuilder.ts +6 -6
  8. package/src/appSdk.ts +6 -6
  9. package/src/commands/startCommandHandler.ts +2 -2
  10. package/src/context.ts +3 -3
  11. package/src/credentials.ts +29 -7
  12. package/src/disposable.ts +3 -4
  13. package/src/dto/accessGroupResponse.ts +35 -0
  14. package/src/dto/chatResponse.ts +104 -0
  15. package/src/dto/userInfoResponse.ts +11 -1
  16. package/src/dto/workspacesResponse.ts +49 -0
  17. package/src/events.ts +13 -13
  18. package/src/index.ts +24 -12
  19. package/src/internal/app.impl.ts +25 -28
  20. package/src/internal/appBuilder.impl.ts +16 -16
  21. package/src/internal/createApp.impl.ts +3 -3
  22. package/src/services/commandService.ts +3 -3
  23. package/src/services/credentialService.ts +3 -3
  24. package/src/services/middlewareService.ts +4 -4
  25. package/src/services/organizationService.ts +18 -116
  26. package/src/services/requestBuilder.ts +40 -15
  27. package/src/services/responseUtils.ts +32 -0
  28. package/src/services/rpcService.ts +28 -11
  29. package/src/services/service.ts +10 -8
  30. package/src/services/userProfileService.ts +18 -66
  31. package/src/storages/chat.ts +21 -0
  32. package/src/storages/chats.ts +17 -0
  33. package/src/storages/file.impl.ts +69 -0
  34. package/src/storages/file.ts +28 -0
  35. package/src/storages/files.impl.ts +213 -0
  36. package/src/storages/files.ts +38 -0
  37. package/src/storages/filesPage.ts +27 -0
  38. package/src/storages/groups.impl.ts +337 -0
  39. package/src/storages/groups.ts +43 -0
  40. package/src/storages/organization.impl.ts +68 -0
  41. package/src/storages/organization.ts +33 -0
  42. package/src/storages/organizations.impl.ts +191 -0
  43. package/src/storages/organizations.ts +8 -28
  44. package/src/storages/userProfile.impl.ts +56 -0
  45. package/src/storages/userProfile.ts +2 -2
  46. package/src/storages/workspace.impl.ts +109 -0
  47. package/src/storages/workspace.ts +49 -0
  48. package/src/storages/workspaces.impl.ts +212 -0
  49. package/src/storages/workspaces.ts +53 -0
  50. package/test/commands.test.ts +8 -8
  51. package/test/data/test_file.pdf +0 -0
  52. package/test/disposable.test.ts +3 -3
  53. package/test/events.test.ts +4 -4
  54. package/test/files.test.ts +52 -0
  55. package/test/index.test.ts +42 -83
  56. package/test/organization.test.ts +57 -0
  57. package/test/registry.test.ts +8 -8
  58. package/test/services.test.ts +15 -15
  59. package/test/setup.ts +52 -0
  60. package/test/unitTest.test.ts +2 -2
  61. package/test/workspace.test.ts +71 -0
  62. package/src/services/organizationImpl.ts +0 -51
  63. package/src/services/organizationsImpl.ts +0 -55
  64. package/src/types.ts +0 -86
package/src/types.ts DELETED
@@ -1,86 +0,0 @@
1
- import { type Event } from './events'
2
- import { type Disposable } from './disposable'
3
- import {
4
- Organization,
5
- OrganizationEvent,
6
- OrganizationId
7
- } from './storages/organizations'
8
-
9
- export type WorkspaceId = string
10
- export type ChatId = string
11
- export type FileId = string
12
-
13
- export enum FileEvent {
14
- ADDED,
15
- REMOVED,
16
- UPDATED
17
- }
18
-
19
- export enum ChatEvent {
20
- ADDED,
21
- REMOVED,
22
- UPDATED
23
- }
24
-
25
- export enum ChatMessageEvent {
26
- ADDED,
27
- REMOVED,
28
- UPDATED
29
- }
30
-
31
- export interface File {
32
- id: FileId
33
- name: string
34
-
35
- download: () => Promise<void>
36
- }
37
-
38
- export interface Files {
39
- files: File[]
40
- on: (callback: (event: Event<FileEvent, File>) => void) => Disposable
41
- fetch: () => Promise<void>
42
- upload: (path: string, name: string) => Promise<File>
43
- }
44
-
45
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
46
- export interface ChatMessage {}
47
-
48
- export interface Chat {
49
- id: ChatId
50
- name: string
51
- on: (
52
- callback: (event: Event<ChatMessageEvent, ChatMessage>) => void
53
- ) => Disposable
54
- messages: ChatMessage[]
55
- fetch: () => Promise<void>
56
- subscribe: () => void
57
- unsubscribe: () => void
58
- }
59
-
60
- export interface Chats {
61
- chats: Chat[]
62
- newChat: (name: string) => Promise<Chat>
63
- on: (callback: (event: Event<ChatEvent, Chat>) => void) => Disposable
64
- fetch: () => Promise<void>
65
- }
66
-
67
- export interface Invites {
68
- invite: (email: string) => Promise<void>
69
- accept: (id: OrganizationId) => Promise<void>
70
- decline: (id: OrganizationId) => Promise<void>
71
- on: (
72
- callback: (organization: Event<OrganizationEvent, Organization>) => void
73
- ) => Disposable
74
- }
75
-
76
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
77
- export interface Statistics {}
78
-
79
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
80
- export interface Workspace {}
81
-
82
- export interface Workspaces {
83
- newWorkspace: (name: string) => Promise<Workspace>
84
-
85
- delete: (id: WorkspaceId) => Promise<void>
86
- }