@neuralinnovations/dataisland-sdk 0.0.1-dev5 → 0.0.1-dev7

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 (39) hide show
  1. package/.github/workflows/publish-npm.yml +15 -2
  2. package/README.md +83 -34
  3. package/docs/.nojekyll +1 -0
  4. package/docs/classes/BasicCredential.md +80 -0
  5. package/docs/classes/BearerCredential.md +72 -0
  6. package/docs/classes/Chat.md +69 -0
  7. package/docs/classes/Chats.md +90 -0
  8. package/docs/classes/CredentialBase.md +54 -0
  9. package/docs/classes/DataIslandApp.md +168 -0
  10. package/docs/classes/DebugCredential.md +72 -0
  11. package/docs/classes/DefaultCredential.md +56 -0
  12. package/docs/classes/DisposableContainer.md +177 -0
  13. package/docs/classes/EventDispatcher.md +109 -0
  14. package/docs/classes/File.md +79 -0
  15. package/docs/classes/Files.md +136 -0
  16. package/docs/classes/FilesPage.md +76 -0
  17. package/docs/classes/Group.md +191 -0
  18. package/docs/classes/Groups.md +130 -0
  19. package/docs/classes/Lifetime.md +108 -0
  20. package/docs/classes/Organization.md +89 -0
  21. package/docs/classes/Organizations.md +195 -0
  22. package/docs/classes/UserProfile.md +156 -0
  23. package/docs/classes/Workspace.md +165 -0
  24. package/docs/classes/Workspaces.md +189 -0
  25. package/docs/enums/ChatAnswer.md +22 -0
  26. package/docs/enums/ChatsEvent.md +22 -0
  27. package/docs/enums/FilesEvent.md +24 -0
  28. package/docs/enums/GroupEvent.md +29 -0
  29. package/docs/enums/OrganizationsEvent.md +31 -0
  30. package/docs/enums/UserEvent.md +15 -0
  31. package/docs/enums/WorkspaceEvent.md +17 -0
  32. package/docs/enums/WorkspacesEvent.md +24 -0
  33. package/docs/interfaces/Disposable.md +25 -0
  34. package/docs/interfaces/Event.md +58 -0
  35. package/docs/interfaces/EventSubscriber.md +41 -0
  36. package/docs/interfaces/Input.md +35 -0
  37. package/docs/modules.md +205 -0
  38. package/package.json +4 -2
  39. package/scripts/docs/index.js +15 -0
@@ -16,12 +16,25 @@ jobs:
16
16
  - name: ⏩ CI Install ⏩
17
17
  run: npm ci
18
18
 
19
- - name: 🧪 Test 🧪
20
- run: npm test >> $GITHUB_STEP_SUMMARY | cat
19
+ - name: 🌈 Lint 🌈
20
+ run: npm run lint:fix
21
21
 
22
22
  - name: 🧱 Build 🧱
23
23
  run: npm run build
24
24
 
25
+ - name: 🧪 Test 🧪
26
+ run: npm test >> $GITHUB_STEP_SUMMARY | cat
27
+
28
+ - name: 📝 Docs 📝
29
+ run: npm run docs
30
+
31
+ - name: 📋 Check changes 📋
32
+ run: |
33
+ git diff --exit-code --quiet || {
34
+ echo "There are changes to commit"
35
+ exit 1
36
+ }
37
+
25
38
  - name: 📢 Publish to npm 📢
26
39
  run: npm publish --access public
27
40
  env:
package/README.md CHANGED
@@ -1,10 +1,12 @@
1
+ @neuralinnovations/dataisland-sdk/[Exports](./docs/modules.md)
2
+
1
3
  # DataIsland Client SDK
2
4
 
3
5
  The DataIsland Client SDK is a TypeScript library designed to seamlessly integrate DataIsland web services into websites.
4
6
 
5
7
  ## Table of contents
6
8
 
7
- 1. [Connect](#connect)
9
+ 1. [Install](#install)
8
10
  2. [Create app](#create-app)
9
11
  3. [Use organizations](#use-organizations)
10
12
  4. [Use chat](#use-chat)
@@ -12,43 +14,64 @@ The DataIsland Client SDK is a TypeScript library designed to seamlessly integra
12
14
  6. [Use files](#use-files)
13
15
  7. [Use access groups](#use-access-groups)
14
16
  8. [Use invites](#use-invites)
17
+ 9. [References](docs/modules.md)
18
+
19
+ ---
15
20
 
16
- ### Connect
21
+ ### Install
17
22
 
18
23
  For connecting this library to your website project simply install it using npm package manager.
19
24
 
20
- `npm i @neuralinnovations/dataisland-sdk`
25
+ ```shell
26
+ npm i @neuralinnovations/dataisland-sdk
27
+ ```
28
+
29
+ ---
21
30
 
22
31
  ### Create app
23
32
 
24
33
  You can initialize default app sdk instance using this code example.
25
34
 
26
- ```
27
- const app = await dataIslandApp("your-app-name", async (builder: AppBuilder) => {
28
- builder.useHost(HOST)
29
- builder.useCredential(new BearerCredential(TOKEN))
30
- })
35
+ ```typescript
36
+ // default production app sdk instance
37
+ // it is an instance of DataIslandApp
38
+ const dataIslandSdk = await dataIslandApp()
39
+
40
+ // specific app sdk instance
41
+ // use this if you have more than one app
42
+ // or using custom api server
43
+ const yourAppNameSdk = await dataIslandApp('your-app-name', async (builder: AppBuilder) => {
44
+ builder.useHost(HOST)
45
+ builder.useCredential(new BearerCredential(TOKEN))
46
+ })
31
47
  ```
32
48
 
33
- It is immpossible to create more than one app sdk intance with same name.
49
+ [DataIslandApp](docs/classes/DataIslandApp.md) is a application instance. It contains of user profile, organizations and context.
50
+
51
+ _It is immpossible to create more than one app sdk intance with same name._
34
52
 
35
53
  **HOST** is a DataIsland API url which can be passed using environment file.
36
54
 
37
- Second required parameter for builder is Credentials. It is recomended to use Bearer credentials instance and pass your user Auth0 **TOKEN** in order to get access to API.
55
+ Second required parameter for builder is Credentials. It is recomended to use Bearer credentials instance and pass your user **TOKEN** in order to get access to API.
38
56
 
39
57
  You can also add requests middlewares with builder options.
40
58
 
59
+ ```typescript
60
+ // The app is an instance of DataIslandApp
61
+ const app = await dataIslandApp('your-app-name', async (builder: AppBuilder) => {
62
+ builder.useHost(YOUR_HOST)
63
+ builder.useAutomaticDataCollectionEnabled(false)
64
+ builder.useCredential(new BasicCredential('email', 'password'))
65
+ builder.registerMiddleware(async (req, next) => {
66
+ req.headers.set('Your-header-name', 'value')
67
+ return await next(req)
68
+ })
69
+ })
41
70
  ```
42
- const app = await dataIslandApp("your-app-name", async (builder: AppBuilder) => {
43
- builder.useHost(YOUR_HOST)
44
- builder.useAutomaticDataCollectionEnabled(false)
45
- builder.useCredential(new BasicCredential("email", "password"))
46
- builder.registerMiddleware(async (req, next) => {
47
- req.headers.set("Your-header-name", "value")
48
- return await next(req)
49
- })
50
- })
51
- ```
71
+
72
+ [DataIslandApp](docs/classes/DataIslandApp.md) is a application instance. It contains of user profile, organizations and context.
73
+
74
+ ---
52
75
 
53
76
  ### Use organizations
54
77
 
@@ -61,13 +84,20 @@ By default all user organizations are fetched with user profile during app sdk s
61
84
 
62
85
  Default organization creation code example:
63
86
 
64
- ```
87
+ ```typescript
65
88
  // create organization
66
- const org = await app.organizations.create(
67
- "your-organization-name",
68
- "your-organization-description"
69
- )
89
+ // app is an instance of DataIslandApp
90
+ // app.organizations is an instance of Organizations (collection of organizations)
91
+ // return value is an instance of Organization
92
+ const org = await app.organizations.create(
93
+ 'your-organization-name',
94
+ 'your-organization-description'
95
+ )
70
96
  ```
97
+ 1. [Organization](docs/classes/Organization.md) is a main object for user data management. It contains of users, workspaces and chats.
98
+ 2. [Organizations](docs/classes/Organizations.md) is a collection of organizations.
99
+
100
+ ---
71
101
 
72
102
  ### Use workspaces
73
103
 
@@ -75,17 +105,36 @@ Workspaces are folder-like objects used to store files and controll access to it
75
105
 
76
106
  Default workspace creation example:
77
107
 
78
- ```
108
+ ```typescript
109
+ // create workspace
110
+ // org is an instance of Organization
111
+ // org.workspaces is an instance of Workspaces (collection of workspaces)
112
+ // return value is an instance of Workspace
113
+ //
114
+ // isCreateNewGroup: boolean - "Bool option for new group creation"
115
+ // newGroupName: string - "New group name"
116
+ // groupIds: string[] - "Array of selected accessed groups IDs"
79
117
  const workspace = await org.workspaces.create(
80
- "your-workspace-name",
81
- "your-workspace-description",
82
- regulation: {
83
- isCreateNewGroup: boolean - "Bool option for new group creation"
84
- newGroupName: string - "New group name"
85
- groupIds: string[] - "Array of selected accessed groups IDs"
86
- }
87
- )
118
+ // name of new workspace
119
+ 'your-workspace-name',
120
+ // description of new workspace
121
+ 'your-workspace-description',
122
+ // regulation options
123
+ {
124
+ // create new group for this workspace
125
+ isCreateNewGroup: true,
126
+ // new group name
127
+ newGroupName: 'your-new-group-name',
128
+ // array of selected groups IDs
129
+ groupIds: []
130
+ }
131
+ )
88
132
  ```
133
+ 1. [Workspace](docs/classes/Workspace.md) is a main object for files management. It contains of files, chats and access groups.
134
+
135
+ 2. [Worskpaces](docs/classes/Workspaces.md) is a collection of workspaces.
136
+
137
+ ---
89
138
 
90
139
  ### Use files
91
140
 
package/docs/.nojekyll ADDED
@@ -0,0 +1 @@
1
+ TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
@@ -0,0 +1,80 @@
1
+ [@neuralinnovations/dataisland-sdk - v0.0.1-dev7](../../README.md) / [Exports](../modules.md) / BasicCredential
2
+
3
+ # Class: BasicCredential
4
+
5
+ DataIsland App credential.
6
+
7
+ ## Hierarchy
8
+
9
+ - [`CredentialBase`](CredentialBase.md)
10
+
11
+ ↳ **`BasicCredential`**
12
+
13
+ ## Table of contents
14
+
15
+ ### Constructors
16
+
17
+ - [constructor](BasicCredential.md#constructor)
18
+
19
+ ### Properties
20
+
21
+ - [email](BasicCredential.md#email)
22
+ - [password](BasicCredential.md#password)
23
+
24
+ ### Methods
25
+
26
+ - [onRegister](BasicCredential.md#onregister)
27
+
28
+ ## Constructors
29
+
30
+ ### constructor
31
+
32
+ • **new BasicCredential**(`email`, `password`): [`BasicCredential`](BasicCredential.md)
33
+
34
+ #### Parameters
35
+
36
+ | Name | Type |
37
+ | :------ | :------ |
38
+ | `email` | `string` |
39
+ | `password` | `string` |
40
+
41
+ #### Returns
42
+
43
+ [`BasicCredential`](BasicCredential.md)
44
+
45
+ #### Overrides
46
+
47
+ [CredentialBase](CredentialBase.md).[constructor](CredentialBase.md#constructor)
48
+
49
+ ## Properties
50
+
51
+ ### email
52
+
53
+ • `Readonly` **email**: `string`
54
+
55
+ ___
56
+
57
+ ### password
58
+
59
+ • `Readonly` **password**: `string`
60
+
61
+ ## Methods
62
+
63
+ ### onRegister
64
+
65
+ ▸ **onRegister**(`lifetime`, `context`): `void`
66
+
67
+ #### Parameters
68
+
69
+ | Name | Type |
70
+ | :------ | :------ |
71
+ | `lifetime` | [`Lifetime`](Lifetime.md) |
72
+ | `context` | `Context` |
73
+
74
+ #### Returns
75
+
76
+ `void`
77
+
78
+ #### Overrides
79
+
80
+ [CredentialBase](CredentialBase.md).[onRegister](CredentialBase.md#onregister)
@@ -0,0 +1,72 @@
1
+ [@neuralinnovations/dataisland-sdk - v0.0.1-dev7](../../README.md) / [Exports](../modules.md) / BearerCredential
2
+
3
+ # Class: BearerCredential
4
+
5
+ DataIsland App credential.
6
+
7
+ ## Hierarchy
8
+
9
+ - [`CredentialBase`](CredentialBase.md)
10
+
11
+ ↳ **`BearerCredential`**
12
+
13
+ ## Table of contents
14
+
15
+ ### Constructors
16
+
17
+ - [constructor](BearerCredential.md#constructor)
18
+
19
+ ### Properties
20
+
21
+ - [token](BearerCredential.md#token)
22
+
23
+ ### Methods
24
+
25
+ - [onRegister](BearerCredential.md#onregister)
26
+
27
+ ## Constructors
28
+
29
+ ### constructor
30
+
31
+ • **new BearerCredential**(`token`): [`BearerCredential`](BearerCredential.md)
32
+
33
+ #### Parameters
34
+
35
+ | Name | Type |
36
+ | :------ | :------ |
37
+ | `token` | `string` |
38
+
39
+ #### Returns
40
+
41
+ [`BearerCredential`](BearerCredential.md)
42
+
43
+ #### Overrides
44
+
45
+ [CredentialBase](CredentialBase.md).[constructor](CredentialBase.md#constructor)
46
+
47
+ ## Properties
48
+
49
+ ### token
50
+
51
+ • `Readonly` **token**: `string`
52
+
53
+ ## Methods
54
+
55
+ ### onRegister
56
+
57
+ ▸ **onRegister**(`lifetime`, `context`): `void`
58
+
59
+ #### Parameters
60
+
61
+ | Name | Type |
62
+ | :------ | :------ |
63
+ | `lifetime` | [`Lifetime`](Lifetime.md) |
64
+ | `context` | `Context` |
65
+
66
+ #### Returns
67
+
68
+ `void`
69
+
70
+ #### Overrides
71
+
72
+ [CredentialBase](CredentialBase.md).[onRegister](CredentialBase.md#onregister)
@@ -0,0 +1,69 @@
1
+ [@neuralinnovations/dataisland-sdk - v0.0.1-dev7](../../README.md) / [Exports](../modules.md) / Chat
2
+
3
+ # Class: Chat
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](Chat.md#constructor)
10
+
11
+ ### Accessors
12
+
13
+ - [id](Chat.md#id)
14
+ - [name](Chat.md#name)
15
+
16
+ ### Methods
17
+
18
+ - [question](Chat.md#question)
19
+
20
+ ## Constructors
21
+
22
+ ### constructor
23
+
24
+ • **new Chat**(): [`Chat`](Chat.md)
25
+
26
+ #### Returns
27
+
28
+ [`Chat`](Chat.md)
29
+
30
+ ## Accessors
31
+
32
+ ### id
33
+
34
+ • `get` **id**(): `string`
35
+
36
+ Chat id.
37
+
38
+ #### Returns
39
+
40
+ `string`
41
+
42
+ ___
43
+
44
+ ### name
45
+
46
+ • `get` **name**(): `string`
47
+
48
+ Chat name.
49
+
50
+ #### Returns
51
+
52
+ `string`
53
+
54
+ ## Methods
55
+
56
+ ### question
57
+
58
+ ▸ **question**(`message`, `answer?`): `Promise`\<`void`\>
59
+
60
+ #### Parameters
61
+
62
+ | Name | Type |
63
+ | :------ | :------ |
64
+ | `message` | `string` |
65
+ | `answer?` | [`ChatAnswer`](../enums/ChatAnswer.md) |
66
+
67
+ #### Returns
68
+
69
+ `Promise`\<`void`\>
@@ -0,0 +1,90 @@
1
+ [@neuralinnovations/dataisland-sdk - v0.0.1-dev7](../../README.md) / [Exports](../modules.md) / Chats
2
+
3
+ # Class: Chats
4
+
5
+ Chats storage.
6
+
7
+ ## Hierarchy
8
+
9
+ - [`EventDispatcher`](EventDispatcher.md)\<[`ChatsEvent`](../enums/ChatsEvent.md), [`Chat`](Chat.md)\>
10
+
11
+ ↳ **`Chats`**
12
+
13
+ ## Table of contents
14
+
15
+ ### Constructors
16
+
17
+ - [constructor](Chats.md#constructor)
18
+
19
+ ### Methods
20
+
21
+ - [create](Chats.md#create)
22
+ - [dispatch](Chats.md#dispatch)
23
+ - [subscribe](Chats.md#subscribe)
24
+
25
+ ## Constructors
26
+
27
+ ### constructor
28
+
29
+ • **new Chats**(): [`Chats`](Chats.md)
30
+
31
+ #### Returns
32
+
33
+ [`Chats`](Chats.md)
34
+
35
+ #### Inherited from
36
+
37
+ [EventDispatcher](EventDispatcher.md).[constructor](EventDispatcher.md#constructor)
38
+
39
+ ## Methods
40
+
41
+ ### create
42
+
43
+ ▸ **create**(): `Promise`\<[`Chat`](Chat.md)\>
44
+
45
+ Create new chat.
46
+
47
+ #### Returns
48
+
49
+ `Promise`\<[`Chat`](Chat.md)\>
50
+
51
+ ___
52
+
53
+ ### dispatch
54
+
55
+ ▸ **dispatch**(`input`): `void`
56
+
57
+ #### Parameters
58
+
59
+ | Name | Type |
60
+ | :------ | :------ |
61
+ | `input` | [`Input`](../interfaces/Input.md)\<[`ChatsEvent`](../enums/ChatsEvent.md), [`Chat`](Chat.md)\> |
62
+
63
+ #### Returns
64
+
65
+ `void`
66
+
67
+ #### Inherited from
68
+
69
+ [EventDispatcher](EventDispatcher.md).[dispatch](EventDispatcher.md#dispatch)
70
+
71
+ ___
72
+
73
+ ### subscribe
74
+
75
+ ▸ **subscribe**(`callback`, `type?`): [`Disposable`](../interfaces/Disposable.md)
76
+
77
+ #### Parameters
78
+
79
+ | Name | Type |
80
+ | :------ | :------ |
81
+ | `callback` | (`event`: [`Event`](../interfaces/Event.md)\<[`ChatsEvent`](../enums/ChatsEvent.md), [`Chat`](Chat.md)\>) => `void` |
82
+ | `type?` | [`ChatsEvent`](../enums/ChatsEvent.md) |
83
+
84
+ #### Returns
85
+
86
+ [`Disposable`](../interfaces/Disposable.md)
87
+
88
+ #### Inherited from
89
+
90
+ [EventDispatcher](EventDispatcher.md).[subscribe](EventDispatcher.md#subscribe)
@@ -0,0 +1,54 @@
1
+ [@neuralinnovations/dataisland-sdk - v0.0.1-dev7](../../README.md) / [Exports](../modules.md) / CredentialBase
2
+
3
+ # Class: CredentialBase
4
+
5
+ DataIsland App credential.
6
+
7
+ ## Hierarchy
8
+
9
+ - **`CredentialBase`**
10
+
11
+ ↳ [`DefaultCredential`](DefaultCredential.md)
12
+
13
+ ↳ [`BasicCredential`](BasicCredential.md)
14
+
15
+ ↳ [`DebugCredential`](DebugCredential.md)
16
+
17
+ ↳ [`BearerCredential`](BearerCredential.md)
18
+
19
+ ## Table of contents
20
+
21
+ ### Constructors
22
+
23
+ - [constructor](CredentialBase.md#constructor)
24
+
25
+ ### Methods
26
+
27
+ - [onRegister](CredentialBase.md#onregister)
28
+
29
+ ## Constructors
30
+
31
+ ### constructor
32
+
33
+ • **new CredentialBase**(): [`CredentialBase`](CredentialBase.md)
34
+
35
+ #### Returns
36
+
37
+ [`CredentialBase`](CredentialBase.md)
38
+
39
+ ## Methods
40
+
41
+ ### onRegister
42
+
43
+ ▸ **onRegister**(`lifetime`, `context`): `void`
44
+
45
+ #### Parameters
46
+
47
+ | Name | Type |
48
+ | :------ | :------ |
49
+ | `lifetime` | [`Lifetime`](Lifetime.md) |
50
+ | `context` | `Context` |
51
+
52
+ #### Returns
53
+
54
+ `void`