@neuralinnovations/dataisland-sdk 0.0.1-dev2 → 0.0.1-dev20
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/LICENSE +201 -0
- package/README.md +306 -1
- 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 +100 -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/startCommandHandler.d.ts +7 -0
- package/dist/src/commands/startCommandHandler.d.ts.map +1 -0
- package/dist/src/commands/startCommandHandler.js +17 -0
- package/dist/src/commands/startCommandHandler.js.map +1 -0
- package/dist/src/context.d.ts +23 -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 +28 -0
- package/dist/src/credentials.d.ts.map +1 -0
- package/dist/src/credentials.js +70 -0
- package/dist/src/credentials.js.map +1 -0
- package/dist/src/dataIslandApp.d.ts +50 -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/chatResponse.d.ts +78 -0
- package/dist/src/dto/chatResponse.d.ts.map +1 -0
- package/dist/src/dto/chatResponse.js +45 -0
- package/dist/src/dto/chatResponse.js.map +1 -0
- package/dist/src/dto/userInfoResponse.d.ts +42 -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 +43 -0
- package/dist/src/dto/workspacesResponse.d.ts.map +1 -0
- package/dist/src/dto/workspacesResponse.js +3 -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 +58 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +91 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/app.impl.d.ts +28 -0
- package/dist/src/internal/app.impl.d.ts.map +1 -0
- package/dist/src/internal/app.impl.js +151 -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 +5 -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/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/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/middlewareService.d.ts +9 -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 +17 -0
- package/dist/src/services/requestBuilder.d.ts.map +1 -0
- package/dist/src/services/requestBuilder.js +104 -0
- package/dist/src/services/requestBuilder.js.map +1 -0
- package/dist/src/services/responseUtils.d.ts +6 -0
- package/dist/src/services/responseUtils.d.ts.map +1 -0
- package/dist/src/services/responseUtils.js +32 -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 +8 -0
- package/dist/src/services/userProfileService.d.ts.map +1 -0
- package/dist/src/services/userProfileService.js +32 -0
- package/dist/src/services/userProfileService.js.map +1 -0
- package/dist/src/storages/chats/answer.d.ts +40 -0
- package/dist/src/storages/chats/answer.d.ts.map +1 -0
- package/dist/src/storages/chats/answer.impl.d.ts +24 -0
- package/dist/src/storages/chats/answer.impl.d.ts.map +1 -0
- package/dist/src/storages/chats/answer.impl.js +130 -0
- package/dist/src/storages/chats/answer.impl.js.map +1 -0
- package/dist/src/storages/chats/answer.js +14 -0
- package/dist/src/storages/chats/answer.js.map +1 -0
- package/dist/src/storages/chats/chat.d.ts +39 -0
- package/dist/src/storages/chats/chat.d.ts.map +1 -0
- package/dist/src/storages/chats/chat.impl.d.ts +24 -0
- package/dist/src/storages/chats/chat.impl.d.ts.map +1 -0
- package/dist/src/storages/chats/chat.impl.js +98 -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 +40 -0
- package/dist/src/storages/chats/chats.d.ts.map +1 -0
- package/dist/src/storages/chats/chats.impl.d.ts +18 -0
- package/dist/src/storages/chats/chats.impl.d.ts.map +1 -0
- package/dist/src/storages/chats/chats.impl.js +102 -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 +31 -0
- package/dist/src/storages/files/file.d.ts.map +1 -0
- package/dist/src/storages/files/file.impl.d.ts +21 -0
- package/dist/src/storages/files/file.impl.d.ts.map +1 -0
- package/dist/src/storages/files/file.impl.js +64 -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 +34 -0
- package/dist/src/storages/files/files.d.ts.map +1 -0
- package/dist/src/storages/files/files.impl.d.ts +22 -0
- package/dist/src/storages/files/files.impl.d.ts.map +1 -0
- package/dist/src/storages/files/files.impl.js +140 -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/groups.d.ts +91 -0
- package/dist/src/storages/groups/groups.d.ts.map +1 -0
- package/dist/src/storages/groups/groups.impl.d.ts +58 -0
- package/dist/src/storages/groups/groups.impl.d.ts.map +1 -0
- package/dist/src/storages/groups/groups.impl.js +275 -0
- package/dist/src/storages/groups/groups.impl.js.map +1 -0
- package/dist/src/storages/groups/groups.js +26 -0
- package/dist/src/storages/groups/groups.js.map +1 -0
- package/dist/src/storages/organizations/organization.d.ts +54 -0
- package/dist/src/storages/organizations/organization.d.ts.map +1 -0
- package/dist/src/storages/organizations/organization.impl.d.ts +32 -0
- package/dist/src/storages/organizations/organization.impl.d.ts.map +1 -0
- package/dist/src/storages/organizations/organization.impl.js +120 -0
- package/dist/src/storages/organizations/organization.impl.js.map +1 -0
- package/dist/src/storages/organizations/organization.js +18 -0
- package/dist/src/storages/organizations/organization.js.map +1 -0
- package/dist/src/storages/organizations/organizations.d.ts +46 -0
- package/dist/src/storages/organizations/organizations.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizations.impl.d.ts +38 -0
- package/dist/src/storages/organizations/organizations.impl.d.ts.map +1 -0
- package/dist/src/storages/organizations/organizations.impl.js +151 -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/user/userProfile.d.ts +32 -0
- package/dist/src/storages/user/userProfile.d.ts.map +1 -0
- package/dist/src/storages/user/userProfile.impl.d.ts +13 -0
- package/dist/src/storages/user/userProfile.impl.d.ts.map +1 -0
- package/dist/src/storages/user/userProfile.impl.js +51 -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 +44 -0
- package/dist/src/storages/workspaces/workspace.d.ts.map +1 -0
- package/dist/src/storages/workspaces/workspace.impl.d.ts +23 -0
- package/dist/src/storages/workspaces/workspace.impl.d.ts.map +1 -0
- package/dist/src/storages/workspaces/workspace.impl.js +98 -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 +157 -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/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +43 -4
- package/src/appBuilder.ts +6 -6
- package/src/commands/startCommandHandler.ts +2 -2
- package/src/context.ts +5 -4
- package/src/credentials.ts +29 -7
- package/src/{appSdk.ts → dataIslandApp.ts} +7 -7
- package/src/disposable.ts +20 -8
- package/src/dto/accessGroupResponse.ts +35 -0
- package/src/dto/chatResponse.ts +103 -0
- package/src/dto/userInfoResponse.ts +15 -3
- package/src/dto/workspacesResponse.ts +49 -0
- package/src/events.ts +13 -13
- package/src/index.ts +41 -20
- package/src/internal/app.impl.ts +28 -31
- package/src/internal/appBuilder.impl.ts +16 -16
- package/src/internal/createApp.impl.ts +5 -5
- package/src/internal/registry.ts +54 -6
- package/src/services/commandService.ts +3 -3
- package/src/services/credentialService.ts +3 -3
- package/src/services/middlewareService.ts +4 -4
- package/src/services/organizationService.ts +18 -116
- package/src/services/requestBuilder.ts +40 -15
- package/src/services/responseUtils.ts +32 -0
- package/src/services/rpcService.ts +28 -11
- package/src/services/service.ts +10 -8
- package/src/services/userProfileService.ts +18 -66
- package/src/storages/chats/answer.impl.ts +186 -0
- package/src/storages/chats/answer.ts +55 -0
- package/src/storages/chats/chat.impl.ts +126 -0
- package/src/storages/chats/chat.ts +49 -0
- package/src/storages/chats/chats.impl.ts +142 -0
- package/src/storages/chats/chats.ts +47 -0
- package/src/storages/files/file.impl.ts +87 -0
- package/src/storages/files/file.ts +40 -0
- package/src/storages/files/files.impl.ts +191 -0
- package/src/storages/files/files.ts +39 -0
- package/src/storages/files/filesPage.impl.ts +37 -0
- package/src/storages/files/filesPage.ts +33 -0
- package/src/storages/groups/groups.impl.ts +363 -0
- package/src/storages/groups/groups.ts +106 -0
- package/src/storages/organizations/organization.impl.ts +163 -0
- package/src/storages/organizations/organization.ts +67 -0
- package/src/storages/organizations/organizations.impl.ts +197 -0
- package/src/storages/{organizations.ts → organizations/organizations.ts} +8 -28
- package/src/storages/user/userProfile.impl.ts +56 -0
- package/src/storages/{userProfile.ts → user/userProfile.ts} +2 -2
- package/src/storages/workspaces/workspace.impl.ts +129 -0
- package/src/storages/workspaces/workspace.ts +54 -0
- package/src/storages/workspaces/workspaces.impl.ts +212 -0
- package/src/storages/workspaces/workspaces.ts +53 -0
- package/src/unitTest.ts +12 -1
- package/.browserslistrc +0 -5
- package/.editorconfig +0 -22
- package/.eslintrc.json +0 -44
- package/.github/workflows/publish-npm.yml +0 -28
- package/.prettierignore +0 -1
- package/.prettierrc +0 -11
- package/.yarnrc +0 -2
- package/babel.config.js +0 -6
- package/jest.config.ts +0 -199
- package/jest.setup.ts +0 -2
- package/src/services/organizationImpl.ts +0 -51
- package/src/services/organizationsImpl.ts +0 -55
- package/src/types.ts +0 -86
- package/test/commands.test.ts +0 -24
- package/test/disposable.test.ts +0 -39
- package/test/events.test.ts +0 -151
- package/test/index.test.ts +0 -163
- package/test/registry.test.ts +0 -44
- package/test/services.test.ts +0 -56
- package/test/setup.ts +0 -2
- package/test/unitTest.test.ts +0 -21
- package/tsconfig.json +0 -31
package/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
@@ -1,7 +1,312 @@
|
|
1
|
+
@neuralinnovations/dataisland-sdk/[Exports](./docs/modules.md)
|
2
|
+
|
3
|
+

|
4
|
+

|
5
|
+
|
1
6
|
# DataIsland Client SDK
|
2
7
|
|
8
|
+
The DataIsland Client SDK is a TypeScript library designed to seamlessly integrate DataIsland web services into websites.
|
9
|
+
|
10
|
+
## Table of contents
|
11
|
+
|
12
|
+
1. [Install](#install)
|
13
|
+
2. [Create app](#create-app)
|
14
|
+
3. [Use organizations](#use-organizations)
|
15
|
+
4. [Use chat](#use-chat)
|
16
|
+
5. [Use workspaces](#use-workspaces)
|
17
|
+
6. [Use files](#use-files)
|
18
|
+
7. [Use access groups](#use-access-groups)
|
19
|
+
8. [Use invites](#use-invites)
|
20
|
+
9. [References](docs/modules.md)
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
### Install
|
25
|
+
|
26
|
+
For connecting this library to your website project simply install it using npm package manager.
|
27
|
+
|
28
|
+
```shell
|
29
|
+
npm i @neuralinnovations/dataisland-sdk
|
30
|
+
```
|
31
|
+
|
32
|
+
---
|
33
|
+
|
34
|
+
### Create app
|
35
|
+
|
36
|
+
You can initialize default app sdk instance using this code example.
|
37
|
+
|
38
|
+
```typescript
|
39
|
+
// default production app sdk instance
|
40
|
+
// it is an instance of DataIslandApp
|
41
|
+
const dataIslandSdk = await dataIslandApp()
|
42
|
+
|
43
|
+
// specific app sdk instance
|
44
|
+
// use this if you have more than one app
|
45
|
+
// or using custom api server
|
46
|
+
const yourAppNameSdk = await dataIslandApp('your-app-name', async (builder: AppBuilder) => {
|
47
|
+
builder.useHost(HOST)
|
48
|
+
builder.useCredential(new BearerCredential(TOKEN))
|
49
|
+
})
|
50
|
+
```
|
51
|
+
|
52
|
+
[DataIslandApp](docs/classes/DataIslandApp.md) is a application instance. It contains of user profile, organizations and context.
|
53
|
+
|
54
|
+
_It is immpossible to create more than one app sdk intance with same name._
|
55
|
+
|
56
|
+
**HOST** is a DataIsland API url which can be passed using environment file.
|
57
|
+
|
58
|
+
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.
|
59
|
+
|
60
|
+
You can also add requests middlewares with builder options.
|
61
|
+
|
62
|
+
```typescript
|
63
|
+
// The app is an instance of DataIslandApp
|
64
|
+
const app = await dataIslandApp('your-app-name', async (builder: AppBuilder) => {
|
65
|
+
builder.useHost(YOUR_HOST)
|
66
|
+
builder.useAutomaticDataCollectionEnabled(false)
|
67
|
+
builder.useCredential(new BasicCredential('email', 'password'))
|
68
|
+
builder.registerMiddleware(async (req, next) => {
|
69
|
+
req.headers.set('Your-header-name', 'value')
|
70
|
+
return await next(req)
|
71
|
+
})
|
72
|
+
})
|
73
|
+
```
|
74
|
+
|
75
|
+
[DataIslandApp](docs/classes/DataIslandApp.md) is a application instance. It contains of user profile, organizations and context.
|
76
|
+
|
77
|
+
---
|
78
|
+
|
79
|
+
### Use organizations
|
80
|
+
|
81
|
+
Organization is a top data structure object, which represents a company or some group of people using our services.
|
82
|
+
It contains of users ( admin or regular ), workspaces with files ( folders with access control features ) and chats.
|
83
|
+
|
84
|
+
By default all user organizations are fetched with user profile during app sdk start. But if there are no organizations linked to the user, you should run Create organization flow. This flow requires organization name and description data, and also first workspace name and description data provided by user.
|
85
|
+
|
86
|
+
**NOTE** There are two types of DataIsland web api servers, public and private. On public servers users can create their own organization after first registration, on private servers you must register using invite links.
|
87
|
+
|
88
|
+
Default organization creation code example:
|
89
|
+
|
90
|
+
```typescript
|
91
|
+
// create organization
|
92
|
+
// app is an instance of DataIslandApp
|
93
|
+
// app.organizations is an instance of Organizations (collection of organizations)
|
94
|
+
// return value is an instance of Organization
|
95
|
+
const org = await app.organizations.create(
|
96
|
+
'your-organization-name',
|
97
|
+
'your-organization-description'
|
98
|
+
)
|
99
|
+
```
|
100
|
+
|
101
|
+
1. [Organization](docs/classes/Organization.md) is a main object for user data management. It contains of users, workspaces and chats.
|
102
|
+
2. [Organizations](docs/classes/Organizations.md) is a collection of organizations.
|
103
|
+
|
104
|
+
---
|
105
|
+
|
106
|
+
### Use workspaces
|
107
|
+
|
108
|
+
Workspaces are folder-like objects used to store files and controll access to it using acces groups. During creation you must pass organization Id, name and description of new workspace and regulation options. You can pass existing group ID or ask to create new group for this workspace in regulation section.
|
109
|
+
|
110
|
+
Default workspace creation example:
|
111
|
+
|
3
112
|
```typescript
|
113
|
+
// create workspace
|
114
|
+
// org is an instance of Organization
|
115
|
+
// org.workspaces is an instance of Workspaces (collection of workspaces)
|
116
|
+
// return value is an instance of Workspace
|
117
|
+
//
|
118
|
+
// isCreateNewGroup: boolean - "Bool option for new group creation"
|
119
|
+
// newGroupName: string - "New group name"
|
120
|
+
// groupIds: string[] - "Array of selected accessed groups IDs"
|
121
|
+
const workspace = await org.workspaces.create(
|
122
|
+
// name of new workspace
|
123
|
+
'your-workspace-name',
|
124
|
+
// description of new workspace
|
125
|
+
'your-workspace-description',
|
126
|
+
// regulation options
|
127
|
+
{
|
128
|
+
// create new group for this workspace
|
129
|
+
isCreateNewGroup: true,
|
130
|
+
// new group name
|
131
|
+
newGroupName: 'your-new-group-name',
|
132
|
+
// array of selected groups IDs
|
133
|
+
groupIds: []
|
134
|
+
}
|
135
|
+
)
|
136
|
+
```
|
137
|
+
|
138
|
+
You can get workspace total file count with:
|
139
|
+
|
140
|
+
```
|
141
|
+
const count = workspace.totalCount()
|
142
|
+
```
|
143
|
+
|
144
|
+
1. [Workspace](docs/classes/Workspace.md) is a main object for files management. It contains of files, chats and access groups.
|
145
|
+
2. [Worskpaces](docs/classes/Workspaces.md) is a collection of workspaces.
|
146
|
+
|
147
|
+
---
|
148
|
+
|
149
|
+
### Use files
|
150
|
+
|
151
|
+
Files are part of workspaces and can be managed through workspace interface. You can upload, preview and delete files. Upload and delete operations are working with list parameters ( files list for upload, file ids list for delete )
|
152
|
+
|
153
|
+
Default file upload example:
|
154
|
+
|
155
|
+
```
|
156
|
+
const file = await workspace.files.upload([file])
|
157
|
+
```
|
158
|
+
|
159
|
+
The file uploading process always takes some time, so you can track its uploading status using the "status" property. The status object includes a success indicator, the total count of file parts, the count of uploaded file parts, and an error field. The success indicator represents whether the last file part was uploaded successfully or not. If one of the parts fails, the uploading process is stopped, and the "error" field contains the text of the failure reason. FIle status can be updated manually with update_status() method, or through events.
|
160
|
+
|
161
|
+
```
|
162
|
+
await file.update_status()
|
163
|
+
let status = file.status()
|
164
|
+
```
|
165
|
+
|
166
|
+
Delete file example:
|
167
|
+
|
168
|
+
```
|
169
|
+
await workspace.files.delete([file.id])
|
170
|
+
```
|
171
|
+
|
172
|
+
You can retrieve a list of files from a workspace using the "query" method. It involves several straightforward parameters: a search query for filtering files based on user input (if empty, no filter is applied), page number, and the number of files per page. The method returns an object containing the file list, selected page number, total page count, and other relevant information.
|
173
|
+
|
174
|
+
Here is an example:
|
175
|
+
|
176
|
+
```
|
177
|
+
const filesPage = await workspace.files.query(
|
178
|
+
"you-user-search-input",
|
179
|
+
0 - page number,
|
180
|
+
20 - files limit per page )
|
181
|
+
```
|
182
|
+
|
183
|
+
#### Events
|
184
|
+
|
185
|
+
You can subscribe to different file event in order to react for file status changes.
|
186
|
+
|
187
|
+
Available events:
|
188
|
+
|
189
|
+
* ADDED
|
190
|
+
* UPDATED
|
191
|
+
* REMOVED
|
192
|
+
|
193
|
+
Subscribe on event example:
|
194
|
+
|
195
|
+
```
|
196
|
+
workspace.files.subscribe((event) => { const file = event.data }, FilesEvent.ADDED)
|
197
|
+
```
|
198
|
+
|
199
|
+
---
|
200
|
+
|
201
|
+
### Use chat
|
202
|
+
|
203
|
+
Chat is object that stores one user-assistant chat with it's messages and other data. It can be easily created and deleted useing **chats** property of organization. Chat name is always generated by server.
|
204
|
+
|
205
|
+
```
|
206
|
+
const chat = await organization.chats.create()
|
207
|
+
|
208
|
+
await organization.chats.delete(your_chat_id)
|
209
|
+
```
|
210
|
+
|
211
|
+
You can access all chats list using **collection** property.
|
212
|
+
|
213
|
+
```
|
214
|
+
const chats = organization.chats.collection
|
215
|
+
```
|
216
|
+
|
217
|
+
Main chat functionality is answer handling. You can create, fetch and cancel answer in the chat. Answer is a data object which contains question, answer, answer steps and sources for them.
|
218
|
+
|
219
|
+
Here are some examples:
|
220
|
+
|
221
|
+
```
|
222
|
+
const answer = await chat.ask("Hello!", ChatAnswerType.SHORT)
|
223
|
+
|
224
|
+
await chat.getAnswer(answer.id).cancel()
|
225
|
+
|
226
|
+
```
|
227
|
+
|
228
|
+
Answer can be updated using fetch method.
|
229
|
+
|
230
|
+
```
|
231
|
+
await chat.getAnswer(answer.id).fetch()
|
232
|
+
```
|
233
|
+
|
234
|
+
Answer have two main states: running and done. This states is represented in answer status propery.
|
235
|
+
Main statuses are RUNNING, SUCCESS, CANCELED, FAIL. You can use them to correctly draw answer in chat.
|
236
|
+
|
237
|
+
```
|
238
|
+
status = chat.getAnswer(answer.id).status
|
239
|
+
```
|
240
|
+
|
241
|
+
Answer is consists of step. Main steps are Prepare, Generate answer, Sources and Done. Each step also includes tokens that model generate during execution. You can access them using fetch_tokens method.
|
242
|
+
|
243
|
+
```
|
244
|
+
const tokens = await chat.getAnswer(answer.id).fetchTokens(StepType.DONE, 0)
|
245
|
+
```
|
246
|
+
|
247
|
+
Every step also includes Sources that were used during execution. Step "Sources" contains all sources of all answer steps.
|
248
|
+
|
249
|
+
```
|
250
|
+
const sources = await chat.getAnswer(answer.id).sources(StepType.SOURCES)
|
251
|
+
```
|
252
|
+
|
253
|
+
If you want to get chat history, you can access chat.collection property
|
254
|
+
|
255
|
+
```
|
256
|
+
const answers = chat.collection
|
257
|
+
```
|
258
|
+
|
259
|
+
After some answer is done, it's content property is become available. There you can have answer data object to draw an answer in history.Every answer from history is accessed from collection after it status is changed from RUNNING.
|
260
|
+
|
261
|
+
```
|
262
|
+
const answer = chat.getAnswer(id).content
|
263
|
+
```
|
264
|
+
|
265
|
+
#### Events
|
266
|
+
|
267
|
+
Chat object have a variety of events. You can track chat and answer creation and deletion. Answer also contains "update" event.
|
268
|
+
|
269
|
+
Chat events:
|
270
|
+
|
271
|
+
* ADDED
|
272
|
+
* REMOVED
|
273
|
+
|
274
|
+
Answer events:
|
275
|
+
|
276
|
+
* ADDED
|
277
|
+
* CANCELLED
|
278
|
+
* UPDATED
|
279
|
+
|
280
|
+
Event subscribe example:
|
281
|
+
|
282
|
+
```
|
283
|
+
chat.answer.subscribe((event) => { const answer = event.data }, AnswerEvent.UPDATED)
|
284
|
+
```
|
285
|
+
|
286
|
+
---
|
287
|
+
|
288
|
+
### Use access groups
|
289
|
+
|
290
|
+
You can manage users access to workspaces and different features using access groups functionality. Group control methods are available in organization **groups** property. Also you can change workspaces available for group, change permits and control users.
|
291
|
+
|
292
|
+
```
|
293
|
+
const group = await organization.accessGroups.create(
|
294
|
+
"your_group_name",
|
295
|
+
permits: {
|
296
|
+
isAdmin: bool is user admin,
|
297
|
+
},
|
298
|
+
memberIds[] - array of group members ids,
|
299
|
+
)
|
300
|
+
|
301
|
+
await organization.accessGroups.delete(group.id)
|
302
|
+
```
|
303
|
+
|
304
|
+
---
|
4
305
|
|
306
|
+
### Use Invites
|
5
307
|
|
308
|
+
You can invite users to organization with provided emails and selected access groups. Use create invite link method of seleted organization.
|
6
309
|
|
7
|
-
```
|
310
|
+
```
|
311
|
+
await organiation.createInviteLink(emails[], accessGroups[])
|
312
|
+
```
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA"}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
{
|
2
|
+
"name": "@neuralinnovations/dataisland-sdk",
|
3
|
+
"version": "0.0.1-dev20",
|
4
|
+
"description": "SDK for DataIsland project",
|
5
|
+
"licenses": [
|
6
|
+
{
|
7
|
+
"type": "Apache-2.0",
|
8
|
+
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
|
9
|
+
}
|
10
|
+
],
|
11
|
+
"repository": {
|
12
|
+
"type": "git",
|
13
|
+
"url": "https://github.com/NeuralInnovations/dataisland-client-js-sdk.git"
|
14
|
+
},
|
15
|
+
"publishConfig": {
|
16
|
+
"access": "public"
|
17
|
+
},
|
18
|
+
"exports": {
|
19
|
+
".": "./dist/index.js"
|
20
|
+
},
|
21
|
+
"main": "dist/index.js",
|
22
|
+
"types": "dist/index.d.ts",
|
23
|
+
"browser": "dist/index.js",
|
24
|
+
"directories": {
|
25
|
+
"test": "test"
|
26
|
+
},
|
27
|
+
"files": [
|
28
|
+
"dist",
|
29
|
+
"src",
|
30
|
+
"index.js",
|
31
|
+
"index.d.ts"
|
32
|
+
],
|
33
|
+
"engines": {
|
34
|
+
"node": ">=16"
|
35
|
+
},
|
36
|
+
"scripts": {
|
37
|
+
"build": "tsc",
|
38
|
+
"test": "jest --runInBand",
|
39
|
+
"lint": "eslint --ext .ts,.tsx src test",
|
40
|
+
"lint:fix": "eslint --fix --ext .ts,.tsx src test",
|
41
|
+
"docs": "typedoc --disableSources --includeVersion --plugin typedoc-plugin-markdown --out docs src/index.ts && node scripts/docs/index.js",
|
42
|
+
"version-up-dev": "node scripts/version/up-dev.js && rm package-lock.json && npm install && npm run build && npm run lint:fix && npm run docs",
|
43
|
+
"release": "rm package-lock.json && npm install && npm run build && npm run lint:fix && npm run docs"
|
44
|
+
},
|
45
|
+
"keywords": [
|
46
|
+
"dataisland",
|
47
|
+
"sdk",
|
48
|
+
"neuralinnovations",
|
49
|
+
"neural innovations",
|
50
|
+
"neural-innovations",
|
51
|
+
"neural"
|
52
|
+
],
|
53
|
+
"author": "Neural Innovations LTD",
|
54
|
+
"license": "Apache-2.0",
|
55
|
+
"bugs": {
|
56
|
+
"url": "https://github.com/NeuralInnovations/dataisland-client-js-sdk/issues"
|
57
|
+
},
|
58
|
+
"homepage": "https://github.com/NeuralInnovations/dataisland-client-js-sdk#readme",
|
59
|
+
"devDependencies": {
|
60
|
+
"@babel/core": "^7.22.11",
|
61
|
+
"@babel/plugin-transform-modules-commonjs": "7.22.11",
|
62
|
+
"@babel/preset-env": "^7.22.10",
|
63
|
+
"@babel/preset-typescript": "^7.23.3",
|
64
|
+
"@babel/register": "7.22.5",
|
65
|
+
"@jest/globals": "^29.7.0",
|
66
|
+
"@types/jest": "^29.5.11",
|
67
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
68
|
+
"@typescript-eslint/parser": "^6.19.0",
|
69
|
+
"babel-jest": "^29.7.0",
|
70
|
+
"babel-loader": "8.3.0",
|
71
|
+
"eslint": "^8.56.0",
|
72
|
+
"eslint-config-semistandard": "^17.0.0",
|
73
|
+
"eslint-config-standard": "^17.1.0",
|
74
|
+
"eslint-config-standard-with-typescript": "^43.0.0",
|
75
|
+
"eslint-config-xo": "^0.43.1",
|
76
|
+
"eslint-config-xo-typescript": "^1.0.1",
|
77
|
+
"eslint-plugin-import": "^2.29.1",
|
78
|
+
"eslint-plugin-n": "^15.7.0",
|
79
|
+
"eslint-plugin-promise": "^6.1.1",
|
80
|
+
"eslint-plugin-react": "^7.33.2",
|
81
|
+
"glob": "7.2.3",
|
82
|
+
"jest": "^29.7.0",
|
83
|
+
"prettier": "2.8.7",
|
84
|
+
"ts-jest": "^29.1.1",
|
85
|
+
"ts-loader": "8.4.0",
|
86
|
+
"ts-node": "10.9.1",
|
87
|
+
"tslib": "^2.6.2",
|
88
|
+
"tslint": "6.1.3",
|
89
|
+
"typedoc": "^0.25.7",
|
90
|
+
"typedoc-plugin-markdown": "^3.17.1",
|
91
|
+
"typescript": "^5.3.3",
|
92
|
+
"watch": "^0.13.0",
|
93
|
+
"webpack": "5.76.0",
|
94
|
+
"yargs": "17.7.2"
|
95
|
+
},
|
96
|
+
"dependencies": {
|
97
|
+
"dotenv": "^16.3.2",
|
98
|
+
"jsdom": "^23.2.0"
|
99
|
+
}
|
100
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import type { Middleware } from "./middleware";
|
2
|
+
import type { CredentialBase } from "./credentials";
|
3
|
+
import type { Service, ServiceContext } from "./services/service";
|
4
|
+
import type { Constructor } from "./internal/registry";
|
5
|
+
import { CommandHandler, Command } from "./services/commandService";
|
6
|
+
import { Context } from "./context";
|
7
|
+
/**
|
8
|
+
* DataIsland App builder.
|
9
|
+
*/
|
10
|
+
export declare abstract class AppBuilder {
|
11
|
+
/**
|
12
|
+
* Set custom data.
|
13
|
+
*/
|
14
|
+
abstract get env(): Record<string, any>;
|
15
|
+
/**
|
16
|
+
* Add a middleware to the app.
|
17
|
+
*/
|
18
|
+
abstract registerMiddleware(middleware: Middleware): AppBuilder;
|
19
|
+
/**
|
20
|
+
* Host of the app.
|
21
|
+
*/
|
22
|
+
abstract useHost(host: string): AppBuilder;
|
23
|
+
/**
|
24
|
+
* GDPR compliant
|
25
|
+
*/
|
26
|
+
abstract useAutomaticDataCollectionEnabled(value: boolean): AppBuilder;
|
27
|
+
/**
|
28
|
+
* Credential of the app.
|
29
|
+
*/
|
30
|
+
abstract useCredential(credential: CredentialBase): AppBuilder;
|
31
|
+
/**
|
32
|
+
* Register a service to the app.
|
33
|
+
* @param type
|
34
|
+
* @param factory
|
35
|
+
*/
|
36
|
+
abstract registerService<T extends Service>(type: Constructor<T>, factory: (context: ServiceContext) => T): AppBuilder;
|
37
|
+
/**
|
38
|
+
* Register a command to the app.
|
39
|
+
* @param messageType
|
40
|
+
* @param commandFactory
|
41
|
+
*/
|
42
|
+
abstract registerCommand<T extends Command>(messageType: Constructor<T>, commandFactory: ((context: Context) => CommandHandler<T>) | ((context: Context) => (context: Context) => Promise<void>)): AppBuilder;
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=appBuilder.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"appBuilder.d.ts","sourceRoot":"","sources":["../../src/appBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;GAEG;AACH,8BAAsB,UAAU;IAC9B;;OAEG;IACH,QAAQ,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAEvC;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;IAE/D;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAE1C;;OAEG;IACH,QAAQ,CAAC,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU;IAEtE;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,GAAG,UAAU;IAE9D;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,OAAO,EACxC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,CAAC,GACtC,UAAU;IAEb;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,OAAO,EACxC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,EAC3B,cAAc,EACV,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,cAAc,CAAC,CAAC,CAAC,CAAC,GACzC,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAC9D,UAAU;CACd"}
|