@neuralinnovations/dataisland-sdk 0.0.1-dev6 → 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 +31 -0
  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,3 +1,5 @@
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.
@@ -12,6 +14,9 @@ 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
21
  ### Install
17
22
 
@@ -21,12 +26,15 @@ For connecting this library to your website project simply install it using npm
21
26
  npm i @neuralinnovations/dataisland-sdk
22
27
  ```
23
28
 
29
+ ---
30
+
24
31
  ### Create app
25
32
 
26
33
  You can initialize default app sdk instance using this code example.
27
34
 
28
35
  ```typescript
29
36
  // default production app sdk instance
37
+ // it is an instance of DataIslandApp
30
38
  const dataIslandSdk = await dataIslandApp()
31
39
 
32
40
  // specific app sdk instance
@@ -38,6 +46,8 @@ const yourAppNameSdk = await dataIslandApp('your-app-name', async (builder: AppB
38
46
  })
39
47
  ```
40
48
 
49
+ [DataIslandApp](docs/classes/DataIslandApp.md) is a application instance. It contains of user profile, organizations and context.
50
+
41
51
  _It is immpossible to create more than one app sdk intance with same name._
42
52
 
43
53
  **HOST** is a DataIsland API url which can be passed using environment file.
@@ -47,6 +57,7 @@ Second required parameter for builder is Credentials. It is recomended to use Be
47
57
  You can also add requests middlewares with builder options.
48
58
 
49
59
  ```typescript
60
+ // The app is an instance of DataIslandApp
50
61
  const app = await dataIslandApp('your-app-name', async (builder: AppBuilder) => {
51
62
  builder.useHost(YOUR_HOST)
52
63
  builder.useAutomaticDataCollectionEnabled(false)
@@ -58,6 +69,10 @@ const app = await dataIslandApp('your-app-name', async (builder: AppBuilder) =>
58
69
  })
59
70
  ```
60
71
 
72
+ [DataIslandApp](docs/classes/DataIslandApp.md) is a application instance. It contains of user profile, organizations and context.
73
+
74
+ ---
75
+
61
76
  ### Use organizations
62
77
 
63
78
  Organization is a top data structure object, which represents a company or some group of people using our services.
@@ -71,11 +86,18 @@ Default organization creation code example:
71
86
 
72
87
  ```typescript
73
88
  // create organization
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
74
92
  const org = await app.organizations.create(
75
93
  'your-organization-name',
76
94
  'your-organization-description'
77
95
  )
78
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
+ ---
79
101
 
80
102
  ### Use workspaces
81
103
 
@@ -85,6 +107,10 @@ Default workspace creation example:
85
107
 
86
108
  ```typescript
87
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
+ //
88
114
  // isCreateNewGroup: boolean - "Bool option for new group creation"
89
115
  // newGroupName: string - "New group name"
90
116
  // groupIds: string[] - "Array of selected accessed groups IDs"
@@ -104,6 +130,11 @@ const workspace = await org.workspaces.create(
104
130
  }
105
131
  )
106
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
+ ---
107
138
 
108
139
  ### Use files
109
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`
@@ -0,0 +1,168 @@
1
+ [@neuralinnovations/dataisland-sdk - v0.0.1-dev7](../../README.md) / [Exports](../modules.md) / DataIslandApp
2
+
3
+ # Class: DataIslandApp
4
+
5
+ DataIsland App instance.
6
+
7
+ ## Table of contents
8
+
9
+ ### Constructors
10
+
11
+ - [constructor](DataIslandApp.md#constructor)
12
+
13
+ ### Accessors
14
+
15
+ - [automaticDataCollectionEnabled](DataIslandApp.md#automaticdatacollectionenabled)
16
+ - [context](DataIslandApp.md#context)
17
+ - [credential](DataIslandApp.md#credential)
18
+ - [host](DataIslandApp.md#host)
19
+ - [lifetime](DataIslandApp.md#lifetime)
20
+ - [name](DataIslandApp.md#name)
21
+ - [organizations](DataIslandApp.md#organizations)
22
+ - [userProfile](DataIslandApp.md#userprofile)
23
+
24
+ ### Methods
25
+
26
+ - [resolve](DataIslandApp.md#resolve)
27
+
28
+ ## Constructors
29
+
30
+ ### constructor
31
+
32
+ • **new DataIslandApp**(): [`DataIslandApp`](DataIslandApp.md)
33
+
34
+ #### Returns
35
+
36
+ [`DataIslandApp`](DataIslandApp.md)
37
+
38
+ ## Accessors
39
+
40
+ ### automaticDataCollectionEnabled
41
+
42
+ • `get` **automaticDataCollectionEnabled**(): `boolean`
43
+
44
+ The automaticDataCollectionEnabled of this app.
45
+
46
+ #### Returns
47
+
48
+ `boolean`
49
+
50
+ ___
51
+
52
+ ### context
53
+
54
+ • `get` **context**(): `Context`
55
+
56
+ The context of this app.
57
+
58
+ #### Returns
59
+
60
+ `Context`
61
+
62
+ ___
63
+
64
+ ### credential
65
+
66
+ • `get` **credential**(): `undefined` \| [`CredentialBase`](CredentialBase.md)
67
+
68
+ The credential of this app.
69
+
70
+ #### Returns
71
+
72
+ `undefined` \| [`CredentialBase`](CredentialBase.md)
73
+
74
+ • `set` **credential**(`value`): `void`
75
+
76
+ #### Parameters
77
+
78
+ | Name | Type |
79
+ | :------ | :------ |
80
+ | `value` | [`CredentialBase`](CredentialBase.md) |
81
+
82
+ #### Returns
83
+
84
+ `void`
85
+
86
+ ___
87
+
88
+ ### host
89
+
90
+ • `get` **host**(): `string`
91
+
92
+ The host of this app.
93
+
94
+ #### Returns
95
+
96
+ `string`
97
+
98
+ ___
99
+
100
+ ### lifetime
101
+
102
+ • `get` **lifetime**(): [`Lifetime`](Lifetime.md)
103
+
104
+ The lifetime of this app.
105
+
106
+ #### Returns
107
+
108
+ [`Lifetime`](Lifetime.md)
109
+
110
+ ___
111
+
112
+ ### name
113
+
114
+ • `get` **name**(): `string`
115
+
116
+ The name of this app.
117
+
118
+ #### Returns
119
+
120
+ `string`
121
+
122
+ ___
123
+
124
+ ### organizations
125
+
126
+ • `get` **organizations**(): [`Organizations`](Organizations.md)
127
+
128
+ User's organizations.
129
+
130
+ #### Returns
131
+
132
+ [`Organizations`](Organizations.md)
133
+
134
+ ___
135
+
136
+ ### userProfile
137
+
138
+ • `get` **userProfile**(): [`UserProfile`](UserProfile.md)
139
+
140
+ User's profile.
141
+
142
+ #### Returns
143
+
144
+ [`UserProfile`](UserProfile.md)
145
+
146
+ ## Methods
147
+
148
+ ### resolve
149
+
150
+ ▸ **resolve**\<`T`\>(`type`): `undefined` \| `T`
151
+
152
+ Resolve a service from the app.
153
+
154
+ #### Type parameters
155
+
156
+ | Name |
157
+ | :------ |
158
+ | `T` |
159
+
160
+ #### Parameters
161
+
162
+ | Name | Type |
163
+ | :------ | :------ |
164
+ | `type` | `Constructor`\<`T`\> |
165
+
166
+ #### Returns
167
+
168
+ `undefined` \| `T`