terminusdb 12.0.2
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/Contributing.md +36 -0
- package/LICENSE +201 -0
- package/README.md +175 -0
- package/RELEASE_NOTES.md +462 -0
- package/dist/index.html +22 -0
- package/dist/terminusdb-client.min.js +3 -0
- package/dist/terminusdb-client.min.js.LICENSE.txt +188 -0
- package/dist/terminusdb-client.min.js.map +1 -0
- package/dist/typescript/index.d.ts +14 -0
- package/dist/typescript/lib/accessControl.d.ts +554 -0
- package/dist/typescript/lib/axiosInstance.d.ts +2 -0
- package/dist/typescript/lib/connectionConfig.d.ts +381 -0
- package/dist/typescript/lib/const.d.ts +54 -0
- package/dist/typescript/lib/dispatchRequest.d.ts +17 -0
- package/dist/typescript/lib/errorMessage.d.ts +25 -0
- package/dist/typescript/lib/query/woqlBuilder.d.ts +75 -0
- package/dist/typescript/lib/query/woqlCore.d.ts +341 -0
- package/dist/typescript/lib/query/woqlDoc.d.ts +63 -0
- package/dist/typescript/lib/query/woqlLibrary.d.ts +718 -0
- package/dist/typescript/lib/query/woqlPrinter.d.ts +71 -0
- package/dist/typescript/lib/query/woqlQuery.d.ts +833 -0
- package/dist/typescript/lib/typedef.d.ts +624 -0
- package/dist/typescript/lib/utils.d.ts +199 -0
- package/dist/typescript/lib/valueHash.d.ts +146 -0
- package/dist/typescript/lib/viewer/chartConfig.d.ts +62 -0
- package/dist/typescript/lib/viewer/chooserConfig.d.ts +38 -0
- package/dist/typescript/lib/viewer/documentFrame.d.ts +44 -0
- package/dist/typescript/lib/viewer/frameConfig.d.ts +74 -0
- package/dist/typescript/lib/viewer/frameRule.d.ts +145 -0
- package/dist/typescript/lib/viewer/graphConfig.d.ts +73 -0
- package/dist/typescript/lib/viewer/objectFrame.d.ts +212 -0
- package/dist/typescript/lib/viewer/streamConfig.d.ts +23 -0
- package/dist/typescript/lib/viewer/tableConfig.d.ts +66 -0
- package/dist/typescript/lib/viewer/terminusRule.d.ts +75 -0
- package/dist/typescript/lib/viewer/viewConfig.d.ts +47 -0
- package/dist/typescript/lib/viewer/woqlChart.d.ts +1 -0
- package/dist/typescript/lib/viewer/woqlChooser.d.ts +56 -0
- package/dist/typescript/lib/viewer/woqlGraph.d.ts +26 -0
- package/dist/typescript/lib/viewer/woqlPaging.d.ts +1 -0
- package/dist/typescript/lib/viewer/woqlResult.d.ts +128 -0
- package/dist/typescript/lib/viewer/woqlRule.d.ts +96 -0
- package/dist/typescript/lib/viewer/woqlStream.d.ts +31 -0
- package/dist/typescript/lib/viewer/woqlTable.d.ts +102 -0
- package/dist/typescript/lib/viewer/woqlView.d.ts +49 -0
- package/dist/typescript/lib/woql.d.ts +1267 -0
- package/dist/typescript/lib/woqlClient.d.ts +1216 -0
- package/index.js +28 -0
- package/lib/.eslintrc +1 -0
- package/lib/accessControl.js +988 -0
- package/lib/axiosInstance.js +5 -0
- package/lib/connectionConfig.js +765 -0
- package/lib/const.js +59 -0
- package/lib/dispatchRequest.js +236 -0
- package/lib/errorMessage.js +110 -0
- package/lib/query/woqlBuilder.js +234 -0
- package/lib/query/woqlCore.js +934 -0
- package/lib/query/woqlDoc.js +177 -0
- package/lib/query/woqlLibrary.js +1015 -0
- package/lib/query/woqlPrinter.js +476 -0
- package/lib/query/woqlQuery.js +1865 -0
- package/lib/typedef.js +248 -0
- package/lib/utils.js +817 -0
- package/lib/valueHash.js_old +581 -0
- package/lib/viewer/chartConfig.js +411 -0
- package/lib/viewer/chooserConfig.js +234 -0
- package/lib/viewer/documentFrame.js +206 -0
- package/lib/viewer/frameConfig.js +469 -0
- package/lib/viewer/frameRule.js +519 -0
- package/lib/viewer/graphConfig.js +345 -0
- package/lib/viewer/objectFrame.js +1550 -0
- package/lib/viewer/streamConfig.js +82 -0
- package/lib/viewer/tableConfig.js +310 -0
- package/lib/viewer/terminusRule.js +196 -0
- package/lib/viewer/viewConfig.js +219 -0
- package/lib/viewer/woqlChart.js +17 -0
- package/lib/viewer/woqlChooser.js +171 -0
- package/lib/viewer/woqlGraph.js +295 -0
- package/lib/viewer/woqlPaging.js +148 -0
- package/lib/viewer/woqlResult.js +258 -0
- package/lib/viewer/woqlRule.js +312 -0
- package/lib/viewer/woqlStream.js +27 -0
- package/lib/viewer/woqlTable.js +332 -0
- package/lib/viewer/woqlView.js +107 -0
- package/lib/woql.js +1693 -0
- package/lib/woqlClient.js +2091 -0
- package/package.json +110 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Var } from "./lib/query/woqlDoc";
|
|
2
|
+
import { Doc } from "./lib/query/woqlDoc";
|
|
3
|
+
import { Vars } from "./lib/query/woqlDoc";
|
|
4
|
+
import WOQLClient = require("./lib/woqlClient");
|
|
5
|
+
import UTILS = require("./lib/utils");
|
|
6
|
+
import View = require("./lib/viewer/woqlView");
|
|
7
|
+
import WOQL = require("./lib/woql");
|
|
8
|
+
import WOQLResult = require("./lib/viewer/woqlResult");
|
|
9
|
+
import WOQLTable = require("./lib/viewer/woqlTable");
|
|
10
|
+
import WOQLGraph = require("./lib/viewer/woqlGraph");
|
|
11
|
+
import axiosInstance = require("./lib/axiosInstance");
|
|
12
|
+
import AccessControl = require("./lib/accessControl");
|
|
13
|
+
import WOQLQuery = require("./lib/query/woqlBuilder");
|
|
14
|
+
export { Var, Doc, Vars, WOQLClient, UTILS, View, WOQL, WOQLResult, WOQLTable, WOQLGraph, axiosInstance, AccessControl, WOQLQuery };
|
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
export = AccessControl;
|
|
2
|
+
/**
|
|
3
|
+
* @license Apache Version 2
|
|
4
|
+
* @module AccessControl
|
|
5
|
+
* @constructor AccessControl
|
|
6
|
+
* @description The AccessControl is a driver to work with
|
|
7
|
+
* TerminusDB and TerminusX access control api
|
|
8
|
+
* for the credential you can use the JWT token, the API token or
|
|
9
|
+
* the basic authentication with username and password
|
|
10
|
+
* @example
|
|
11
|
+
* //connect with the API token
|
|
12
|
+
* //(to request a token create an account in https://terminusdb.com/)
|
|
13
|
+
* const accessContol = new AccessControl("https://servername.com",
|
|
14
|
+
* {organization:"my_team_name",
|
|
15
|
+
* token:"dGVybWludXNkYjovLy9kYXRhL2tleXNfYXB........"})
|
|
16
|
+
* accessControl.getOrgUsers().then(result=>{
|
|
17
|
+
* console.log(result)
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* //connect with the jwt token this type of connection is only for the dashboard
|
|
21
|
+
* //or for application integrate with our login workflow
|
|
22
|
+
* const accessContol = new AccessControl("https://servername.com",
|
|
23
|
+
* {organization:"my_team_name",
|
|
24
|
+
* jwt:"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYyeTFORUd........"})
|
|
25
|
+
* accessControl.getOrgUsers().then(result=>{
|
|
26
|
+
* console.log(result)
|
|
27
|
+
* })
|
|
28
|
+
*
|
|
29
|
+
* //if the jwt is expired you can change it with
|
|
30
|
+
* accessControl.setJwtToken("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYy
|
|
31
|
+
* eTFORUd.......")
|
|
32
|
+
*
|
|
33
|
+
* //connect with the base authentication this type of connection is only for the local installation
|
|
34
|
+
* const accessContol = new AccessControl("http://127.0.0.1:6363",
|
|
35
|
+
* {organization:"my_team_name", user:"admin"
|
|
36
|
+
* key:"mykey"})
|
|
37
|
+
* accessControl.getOrgUsers().then(result=>{
|
|
38
|
+
* console.log(result)
|
|
39
|
+
* })
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
declare function AccessControl(cloudAPIUrl: any, params: any): void;
|
|
43
|
+
declare class AccessControl {
|
|
44
|
+
/**
|
|
45
|
+
* @license Apache Version 2
|
|
46
|
+
* @module AccessControl
|
|
47
|
+
* @constructor AccessControl
|
|
48
|
+
* @description The AccessControl is a driver to work with
|
|
49
|
+
* TerminusDB and TerminusX access control api
|
|
50
|
+
* for the credential you can use the JWT token, the API token or
|
|
51
|
+
* the basic authentication with username and password
|
|
52
|
+
* @example
|
|
53
|
+
* //connect with the API token
|
|
54
|
+
* //(to request a token create an account in https://terminusdb.com/)
|
|
55
|
+
* const accessContol = new AccessControl("https://servername.com",
|
|
56
|
+
* {organization:"my_team_name",
|
|
57
|
+
* token:"dGVybWludXNkYjovLy9kYXRhL2tleXNfYXB........"})
|
|
58
|
+
* accessControl.getOrgUsers().then(result=>{
|
|
59
|
+
* console.log(result)
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* //connect with the jwt token this type of connection is only for the dashboard
|
|
63
|
+
* //or for application integrate with our login workflow
|
|
64
|
+
* const accessContol = new AccessControl("https://servername.com",
|
|
65
|
+
* {organization:"my_team_name",
|
|
66
|
+
* jwt:"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYyeTFORUd........"})
|
|
67
|
+
* accessControl.getOrgUsers().then(result=>{
|
|
68
|
+
* console.log(result)
|
|
69
|
+
* })
|
|
70
|
+
*
|
|
71
|
+
* //if the jwt is expired you can change it with
|
|
72
|
+
* accessControl.setJwtToken("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYy
|
|
73
|
+
* eTFORUd.......")
|
|
74
|
+
*
|
|
75
|
+
* //connect with the base authentication this type of connection is only for the local installation
|
|
76
|
+
* const accessContol = new AccessControl("http://127.0.0.1:6363",
|
|
77
|
+
* {organization:"my_team_name", user:"admin"
|
|
78
|
+
* key:"mykey"})
|
|
79
|
+
* accessControl.getOrgUsers().then(result=>{
|
|
80
|
+
* console.log(result)
|
|
81
|
+
* })
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
constructor(cloudAPIUrl: any, params: any);
|
|
85
|
+
baseURL: string;
|
|
86
|
+
user: any;
|
|
87
|
+
defaultOrganization: string;
|
|
88
|
+
/**
|
|
89
|
+
* Get a organization from parameters.
|
|
90
|
+
* @param {object} params - The parameters
|
|
91
|
+
* @return {string|undefined} - organization
|
|
92
|
+
*/
|
|
93
|
+
getDefaultOrganization(params: object): string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Sets the Jwt token for the object
|
|
96
|
+
* @param {string} jwt - The jwt api token to use
|
|
97
|
+
*/
|
|
98
|
+
setJwtToken(jwt: string): void;
|
|
99
|
+
apiKey: any;
|
|
100
|
+
apiType: string;
|
|
101
|
+
/**
|
|
102
|
+
* Sets the API token for the object, to request a token create an account in https://terminusdb.com/
|
|
103
|
+
* @param {string} atokenpi - The API token to use to connect with TerminusX
|
|
104
|
+
*/
|
|
105
|
+
setApiToken(token: any): void;
|
|
106
|
+
/**
|
|
107
|
+
* Sets the API token for the object, to request a token create an account in https://terminusdb.com/
|
|
108
|
+
* @param {string} atokenpi - The API token to use to connect with TerminusX
|
|
109
|
+
*/
|
|
110
|
+
setApiKey(key: any): void;
|
|
111
|
+
/**
|
|
112
|
+
* Get a API url from cloudAPIUrl
|
|
113
|
+
* @param {string} cloudAPIUrl - The base url for cloud
|
|
114
|
+
* @return {string} apiUrl
|
|
115
|
+
*/
|
|
116
|
+
getAPIUrl(cloudAPIUrl: string): string;
|
|
117
|
+
dispatch(requestUrl: any, action: any, payload: any): Promise<any>;
|
|
118
|
+
/**
|
|
119
|
+
* add extra headers to your request
|
|
120
|
+
* @param {object} customHeaders
|
|
121
|
+
* @returns {object}
|
|
122
|
+
*/
|
|
123
|
+
customHeaders(customHeaders: object): object;
|
|
124
|
+
_customHeaders: any;
|
|
125
|
+
/**
|
|
126
|
+
* -- TerminusDB API ---
|
|
127
|
+
* Get an organization from the TerminusDB API.
|
|
128
|
+
* @param {string} organization - The organization
|
|
129
|
+
* @return {object} - organization
|
|
130
|
+
*/
|
|
131
|
+
getOrganization(org: any): object;
|
|
132
|
+
/**
|
|
133
|
+
* -- TerminusDB API ---
|
|
134
|
+
* This end point works in basic authentication, admin user
|
|
135
|
+
* Get list of organizations
|
|
136
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
137
|
+
*/
|
|
138
|
+
getAllOrganizations(): Promise<any>;
|
|
139
|
+
/**
|
|
140
|
+
* -- TerminusDB API ---
|
|
141
|
+
* This end point works in basic authentication, admin user
|
|
142
|
+
* Create an organization
|
|
143
|
+
* @param {string} orgName - The organization name to create
|
|
144
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
145
|
+
* @example
|
|
146
|
+
* accessControl.createOrganization("my_org_name").then(result=>{
|
|
147
|
+
* console.log(result)
|
|
148
|
+
* })
|
|
149
|
+
*/
|
|
150
|
+
createOrganization(orgName: string): Promise<any>;
|
|
151
|
+
/**
|
|
152
|
+
* -- TerminusDB API ---
|
|
153
|
+
* Delete an Organization
|
|
154
|
+
* @param {string} orgName - The organization name to delete
|
|
155
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
156
|
+
* @example
|
|
157
|
+
* accessControl.deleteOrganization("my_org_name").then(result=>{
|
|
158
|
+
* console.log(result)
|
|
159
|
+
* })
|
|
160
|
+
*/
|
|
161
|
+
deleteOrganization(orgName: string): Promise<any>;
|
|
162
|
+
/**
|
|
163
|
+
* --TerminusDB API ---
|
|
164
|
+
* basic authentication, admin user.
|
|
165
|
+
* Create a new role in the system database.
|
|
166
|
+
* @param {string} [name] - The role name.
|
|
167
|
+
* @param {typedef.RolesActions} [actions] - A list of actions
|
|
168
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
169
|
+
* @example
|
|
170
|
+
* accessControl.createRole("Reader",[ACTIONS.INSTANCE_READ_ACCESS]).then(result=>{
|
|
171
|
+
* console.log(result)
|
|
172
|
+
* })
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
createRole(name?: string, actions?: typedef.RolesActions): Promise<any>;
|
|
176
|
+
/**
|
|
177
|
+
* -- TerminusdDB API ---
|
|
178
|
+
* basic Authentication, admin user.
|
|
179
|
+
* Delete role in the system database, (this api is enabled only in the local installation)
|
|
180
|
+
* @param {string} [name] - The role name.
|
|
181
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
182
|
+
* @example
|
|
183
|
+
* accessControl.deleteRole("Reader").then(result=>{
|
|
184
|
+
* console.log(result)
|
|
185
|
+
* })
|
|
186
|
+
*
|
|
187
|
+
*/
|
|
188
|
+
deleteRole(name?: string): Promise<any>;
|
|
189
|
+
/**
|
|
190
|
+
* -- TerminusdDB API ---
|
|
191
|
+
* basic Authentication, admin user.
|
|
192
|
+
* Return the list of all the users (this api is enabled only in the local installation)
|
|
193
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
194
|
+
* @example
|
|
195
|
+
* accessControl.getAllUsers().then(result=>{
|
|
196
|
+
* console.log(result)
|
|
197
|
+
* })
|
|
198
|
+
*
|
|
199
|
+
*/
|
|
200
|
+
getAllUsers(): Promise<any>;
|
|
201
|
+
/**
|
|
202
|
+
* -- TerminusdDB API ---
|
|
203
|
+
* basic Authentication, admin user.
|
|
204
|
+
* Add the user into the system database
|
|
205
|
+
* @param {string} name - the user name
|
|
206
|
+
* @param {string} [password] - you need the password for basic authentication
|
|
207
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
208
|
+
* @example
|
|
209
|
+
* accessControl.deleteUser(userId).then(result=>{
|
|
210
|
+
* console.log(result)
|
|
211
|
+
* })
|
|
212
|
+
*
|
|
213
|
+
*/
|
|
214
|
+
createUser(name: string, password?: string): Promise<any>;
|
|
215
|
+
/**
|
|
216
|
+
* -- TerminusdDB API ---
|
|
217
|
+
* basic Authentication, admin user.
|
|
218
|
+
* Remove the user from the system database.
|
|
219
|
+
* @param {string} userId - the document user id
|
|
220
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
221
|
+
* @example
|
|
222
|
+
* accessControl.deleteUser(userId).then(result=>{
|
|
223
|
+
* console.log(result)
|
|
224
|
+
* })
|
|
225
|
+
*
|
|
226
|
+
*/
|
|
227
|
+
deleteUser(userId: string): Promise<any>;
|
|
228
|
+
/**
|
|
229
|
+
* -- TerminusdDB API ---
|
|
230
|
+
* Grant/Revoke Capability
|
|
231
|
+
* @param {string} userName - the document user id
|
|
232
|
+
* @param {string} resourceName - the name of a (database or team)
|
|
233
|
+
* @param {array} rolesArr - the roles name list
|
|
234
|
+
* @param {typedef.CapabilityCommand} operation - grant/revoke operation
|
|
235
|
+
* @param {typedef.ScopeType} [scopeType] - the resource type (database or organization)
|
|
236
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
237
|
+
* @example
|
|
238
|
+
* //we add an user to an organization and manage users' access
|
|
239
|
+
* //the user myUser can access the Organization and all the database under the organization with "reader" Role
|
|
240
|
+
* client.manageCapability(myUser,myteam,[reader],"grant","organization").then(result=>{
|
|
241
|
+
* consol.log(result)
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
244
|
+
* //the user myUser can access the database db__001 under the organization myteam
|
|
245
|
+
* //with "writer" Role
|
|
246
|
+
* client.manageCapability(myUser,myteam/db__001,[writer],"grant","database").then(result=>{
|
|
247
|
+
* consol.log(result)
|
|
248
|
+
* })
|
|
249
|
+
*/
|
|
250
|
+
manageCapability(userName: string, resourceName: string, rolesArr: any[], operation: typedef.CapabilityCommand, scopeType?: typedef.ScopeType): Promise<any>;
|
|
251
|
+
/**
|
|
252
|
+
* --TerminusX and TerminusDB API ---
|
|
253
|
+
* Get all the system database roles types.
|
|
254
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
255
|
+
*/
|
|
256
|
+
getAccessRoles(): Promise<any>;
|
|
257
|
+
/**
|
|
258
|
+
* -- TerminusX and TerminusDB API --
|
|
259
|
+
* Get all the organization's users and roles,
|
|
260
|
+
* @param {string} [orgName] - The organization name.
|
|
261
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
262
|
+
* @example
|
|
263
|
+
* accessControl.getOrgUsers().then(result=>{
|
|
264
|
+
* console.log(result)
|
|
265
|
+
* })
|
|
266
|
+
*
|
|
267
|
+
* //this function will return an array of capabilities with users and roles
|
|
268
|
+
* //-- TerminusX -- response array example
|
|
269
|
+
* //[{capability: "Capability/3ea26e1d698821c570afe9cb4fe81a3......"
|
|
270
|
+
* // email: {@type: "xsd:string", @value: "user@terminusdb.com"}
|
|
271
|
+
* // picture: {@type: "xsd:string",…}
|
|
272
|
+
* // role: "Role/dataReader"
|
|
273
|
+
* // scope: "Organization/my_org_name"
|
|
274
|
+
* // user: "User/auth0%7C613f5dnndjdjkTTT"}]
|
|
275
|
+
* //
|
|
276
|
+
* //
|
|
277
|
+
* // -- Local Installation -- response array example
|
|
278
|
+
* //[{ "@id":"User/auth0%7C615462f8ab33f4006a6bee0c",
|
|
279
|
+
* // "capability": [{
|
|
280
|
+
* // "@id":"Capability/c52af34b71f6f8916ac0115ecb5fe0e31248ead8b1e3d100852015...",
|
|
281
|
+
* // "@type":"Capability",
|
|
282
|
+
* // "role": [{
|
|
283
|
+
* // "@id":"Role/admin",
|
|
284
|
+
* // "@type":"Role",
|
|
285
|
+
* // "action": ["instance_read_access"],
|
|
286
|
+
* // "name":"Admin Role"
|
|
287
|
+
* // }],
|
|
288
|
+
* // "scope":"Organization/@team"}]]
|
|
289
|
+
*/
|
|
290
|
+
getOrgUsers(orgName?: string): Promise<any>;
|
|
291
|
+
/**
|
|
292
|
+
* -- TerminusX and TerminusDB API --
|
|
293
|
+
* Get the user roles for a given organization or the default organization,
|
|
294
|
+
* @param {string} [userName] - The organization name.
|
|
295
|
+
* @param {string} [orgName] - The organization name.
|
|
296
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
297
|
+
* @example
|
|
298
|
+
* accessControl.getTeamUserRole("myUser").then(result=>{
|
|
299
|
+
* console.log(result)
|
|
300
|
+
* })
|
|
301
|
+
*
|
|
302
|
+
* //response object example
|
|
303
|
+
* {
|
|
304
|
+
* "@id": "User/myUser",
|
|
305
|
+
* "capability": [
|
|
306
|
+
* {
|
|
307
|
+
* "@id":"Capability/server_access",
|
|
308
|
+
* "@type":"Capability",
|
|
309
|
+
* "role": [{
|
|
310
|
+
* "@id":"Role/reader",
|
|
311
|
+
* "@type":"Role",
|
|
312
|
+
* "action": [
|
|
313
|
+
* "instance_read_access",
|
|
314
|
+
* ],
|
|
315
|
+
* "name":"reader"
|
|
316
|
+
* }],
|
|
317
|
+
* "scope":"Organization/myteam"
|
|
318
|
+
* }
|
|
319
|
+
* ],
|
|
320
|
+
* "name": "myUser"
|
|
321
|
+
*}
|
|
322
|
+
*/
|
|
323
|
+
getTeamUserRoles(userName?: string, orgName?: string): Promise<any>;
|
|
324
|
+
/**
|
|
325
|
+
* -- TerminusX API ---
|
|
326
|
+
* Check if the organization exists. it is a Head call .
|
|
327
|
+
* IMPORTANT This does not work with the API-TOKEN.
|
|
328
|
+
* @param {string} orgName - The organization name to check if exists.
|
|
329
|
+
* @return {Promise} A promise that returns the call status object, 200: if the organization
|
|
330
|
+
* exists and 404: if the organization does not exist
|
|
331
|
+
*/
|
|
332
|
+
ifOrganizationExists(orgName: string): Promise<any>;
|
|
333
|
+
/**
|
|
334
|
+
* -- TerminusX API ---
|
|
335
|
+
* IMPORTANT This does not work with the API-TOKEN.
|
|
336
|
+
* Create an organization
|
|
337
|
+
* @param {string} orgName - The organization name to create
|
|
338
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
339
|
+
* @example
|
|
340
|
+
* accessControl.createOrganization("my_org_name").then(result=>{
|
|
341
|
+
* console.log(result)
|
|
342
|
+
* })
|
|
343
|
+
*/
|
|
344
|
+
createOrganizationRemote(orgName: string): Promise<any>;
|
|
345
|
+
/**
|
|
346
|
+
* -- TerminusX API ---
|
|
347
|
+
* Send a new invitation
|
|
348
|
+
* @param {string} userEmail - The email of user.
|
|
349
|
+
* @param {string} role - The role for user. (the document @id role like Role/collaborator)
|
|
350
|
+
* @param {string} [note] - The note to send with the invitation.
|
|
351
|
+
* @param {string} [orgName] - The organization name.
|
|
352
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
353
|
+
* @example
|
|
354
|
+
* accessControl.sendOrgInvite("new_user@terminusdb.com","Role/admin",
|
|
355
|
+
* "please join myteam").then(result=>{
|
|
356
|
+
* console.log(result)
|
|
357
|
+
* })
|
|
358
|
+
*/
|
|
359
|
+
sendOrgInvite(userEmail: string, role: string, note?: string, orgName?: string): Promise<any>;
|
|
360
|
+
/**
|
|
361
|
+
* -- TerminusX API ---
|
|
362
|
+
* Get the invitation info
|
|
363
|
+
* @param {string} inviteId - The invite id to retrieve.
|
|
364
|
+
* @param {string} [orgName] - The organization name.
|
|
365
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
366
|
+
* @example
|
|
367
|
+
* const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc
|
|
368
|
+
* 2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
|
|
369
|
+
* accessControl.getOrgInvite(fullInviteId).then(result=>{
|
|
370
|
+
* console.log(result)
|
|
371
|
+
* })
|
|
372
|
+
*/
|
|
373
|
+
getOrgInvite(inviteId: string, orgName?: string): Promise<any>;
|
|
374
|
+
/**
|
|
375
|
+
* -- TerminusX API ---
|
|
376
|
+
* Delete an invitation
|
|
377
|
+
* @param {string} inviteId - The invite id to delete.
|
|
378
|
+
* @param {string} [orgName] - The organization name.
|
|
379
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
380
|
+
* @example
|
|
381
|
+
* const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9
|
|
382
|
+
* c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
|
|
383
|
+
* accessControl.deleteOrgInvite(fullInviteId).then(result=>{
|
|
384
|
+
* console.log(result)
|
|
385
|
+
* })
|
|
386
|
+
*/
|
|
387
|
+
deleteOrgInvite(inviteId: string, orgName?: string): Promise<any>;
|
|
388
|
+
/**
|
|
389
|
+
* -- TerminusX API ---
|
|
390
|
+
* Accept /Reject invitation. if the invitation has been accepted we add the current user
|
|
391
|
+
* to the organization.
|
|
392
|
+
*
|
|
393
|
+
* the only user that can accept this invitation is the user registered with the invitation email,
|
|
394
|
+
* we indentify the user with the jwt token
|
|
395
|
+
* @param {string} inviteId - The invite id to updated.
|
|
396
|
+
* @param {boolean} accepted - The status of the invitation.
|
|
397
|
+
* @param {string} [orgName] - The organization name.
|
|
398
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
399
|
+
* @example
|
|
400
|
+
* const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9
|
|
401
|
+
* c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
|
|
402
|
+
* accessControl.updateOrgInviteStatus(fullInviteId,true).then(result=>{
|
|
403
|
+
* console.log(result)
|
|
404
|
+
* })
|
|
405
|
+
*/
|
|
406
|
+
updateOrgInviteStatus(inviteId: string, accepted: boolean, orgName?: string): Promise<any>;
|
|
407
|
+
/**
|
|
408
|
+
* -- TerminusX API ---
|
|
409
|
+
* Get the user role for a given organization or the default organization
|
|
410
|
+
* The user is identified by the jwt or the access token
|
|
411
|
+
* @param {string} [orgName] - The organization name.
|
|
412
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
413
|
+
* @example
|
|
414
|
+
* accessControl.getTeamUserRole().then(result=>{
|
|
415
|
+
* console.log(result)
|
|
416
|
+
* })
|
|
417
|
+
*
|
|
418
|
+
* //response object example
|
|
419
|
+
* {"userRole":"Role/admin"}
|
|
420
|
+
*/
|
|
421
|
+
getTeamUserRole(orgName?: string): Promise<any>;
|
|
422
|
+
/**
|
|
423
|
+
* -- TerminusX API --
|
|
424
|
+
* Remove an user from an organization, only an admin user can remove an user from an organization
|
|
425
|
+
* @param {string} userId - The id of the user to be removed. (this is the document user's @id)
|
|
426
|
+
* @param {string} [orgName] - The organization name in which the user is to be removed.
|
|
427
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
428
|
+
* @example
|
|
429
|
+
* accessControl.removeUserFromOrg("User/auth0%7C613f5dnndjdjkTTT","my_org_name").then(result=>{
|
|
430
|
+
* console.log(result)
|
|
431
|
+
* })
|
|
432
|
+
*
|
|
433
|
+
*/
|
|
434
|
+
removeUserFromOrg(userId: string, orgName?: string): Promise<any>;
|
|
435
|
+
/**
|
|
436
|
+
* -- TerminusX API --
|
|
437
|
+
* Get the user's role for every databases under the organization
|
|
438
|
+
* @param {string} userId - The user's id.
|
|
439
|
+
* @param {string} [orgName] - The organization name.
|
|
440
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
441
|
+
* @example
|
|
442
|
+
* accessControl.getDatabaseRolesOfUser('User/auth0%7C61790e366377Yu6596a').then(result=>{
|
|
443
|
+
* console.log(result)
|
|
444
|
+
* })
|
|
445
|
+
*
|
|
446
|
+
* //this is a capabilities list of databases and roles
|
|
447
|
+
* //[ {capability: "Capability/b395e8523d509dec6b33aefc9baed3b2e2bfadbd4c79d4ff9b20dce2b14e2edc"
|
|
448
|
+
* //if there is an id we have a user specific capabality for this database
|
|
449
|
+
* // name: {@type: "xsd:string", @value: "profiles_test"}
|
|
450
|
+
* // role: "Role/dataUpdater"
|
|
451
|
+
* // scope: "UserDatabase/7ebdfae5a02bc7e8f6d79sjjjsa4e179b1df9d4576a3b1d2e5ff3b4859"
|
|
452
|
+
* // user: "User/auth0%7C61790e11a3966d006906596a"},
|
|
453
|
+
*
|
|
454
|
+
* //{ capability: null
|
|
455
|
+
* // if the capability id is null the user level of access for this database is the
|
|
456
|
+
* same of the team
|
|
457
|
+
* //name: {@type: "xsd:string", @value: "Collab002"}
|
|
458
|
+
* //role: "Role/dataReader"
|
|
459
|
+
* // scope: "UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f"
|
|
460
|
+
* //user: "User/auth0%7C61790e11a3966d006906596a"}]
|
|
461
|
+
*/
|
|
462
|
+
getDatabaseRolesOfUser(userId: string, orgName?: string): Promise<any>;
|
|
463
|
+
/**
|
|
464
|
+
* -- TerminusX API --
|
|
465
|
+
* Create a user's a role for a resource (organization/database)
|
|
466
|
+
* @param {string} userId - The user's id.
|
|
467
|
+
* @param {string} scope - The resource name/id.
|
|
468
|
+
* @param {string} role - The user role to be assigned.
|
|
469
|
+
* @param {string} [orgName] - The organization name.
|
|
470
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
471
|
+
* @example
|
|
472
|
+
* const dbId = "UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f"
|
|
473
|
+
* accessControl.assignUserRole('User/auth0%7C61790e11a3966d006906596a',dbId,
|
|
474
|
+
* "Role/collaborator").then(result=>{
|
|
475
|
+
* console.log(result)
|
|
476
|
+
*
|
|
477
|
+
* })
|
|
478
|
+
*/
|
|
479
|
+
createUserRole(userId: string, scope: string, role: string, orgName?: string): Promise<any>;
|
|
480
|
+
/**
|
|
481
|
+
* -- TerminusX API --
|
|
482
|
+
* Update user's a role for a resource (organization/database), (this api works only in terminusX)
|
|
483
|
+
* @param {string} userId - The user's id.
|
|
484
|
+
* @param {string} capabilityId - The capability id.
|
|
485
|
+
* @param {string} scope - The resource name/id.
|
|
486
|
+
* @param {string} role - The user role to be updated.
|
|
487
|
+
* @param {string} [orgName] - The organization name.
|
|
488
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
489
|
+
* @example
|
|
490
|
+
* const dbId = "UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f"
|
|
491
|
+
* const capId= "Capability/b395e8523d509dec6b33aefc9baed3b2e2bfadbd4c79d4ff9b20dce2b14e2edc"
|
|
492
|
+
* accessControl.updateUserRole('User/auth0%7C61790e11a3966d006906596a',capId,dbId,
|
|
493
|
+
* "Role/dataUpdater").then(result=>{
|
|
494
|
+
* console.log(result)
|
|
495
|
+
*
|
|
496
|
+
* })
|
|
497
|
+
*/
|
|
498
|
+
updateUserRole(userId: string, capabilityId: string, scope: string, role: string, orgName?: string): Promise<any>;
|
|
499
|
+
/**
|
|
500
|
+
* -- TerminusX API --
|
|
501
|
+
* Get all the access request list for a specify organization
|
|
502
|
+
* @param {string} [orgName] - The organization name.
|
|
503
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
504
|
+
* @example
|
|
505
|
+
* accessControl.accessRequestsList().then(result=>{
|
|
506
|
+
* console.log(result)
|
|
507
|
+
* })
|
|
508
|
+
*
|
|
509
|
+
*/
|
|
510
|
+
accessRequestsList(orgName?: string): Promise<any>;
|
|
511
|
+
/**
|
|
512
|
+
* -- TerminusX API --
|
|
513
|
+
* Get all the access request list for a specify organization
|
|
514
|
+
* @param {string} [email] - the user email.
|
|
515
|
+
* @param {string} [affiliation] - the user affiliation, company, university etc..
|
|
516
|
+
* @param {string} [note] - the message for the team admin
|
|
517
|
+
* @param {string} [orgName] - The organization name.
|
|
518
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
519
|
+
* @example
|
|
520
|
+
* accessControl.sendAccessRequest("myemail@terminusdb.com",
|
|
521
|
+
* "my_company",
|
|
522
|
+
* "please add me to your team"
|
|
523
|
+
* ).then(result=>{
|
|
524
|
+
* console.log(result)
|
|
525
|
+
* })
|
|
526
|
+
*
|
|
527
|
+
*/
|
|
528
|
+
sendAccessRequest(email?: string, affiliation?: string, note?: string, orgName?: string): Promise<any>;
|
|
529
|
+
/**
|
|
530
|
+
* -- TerminusX API --
|
|
531
|
+
* Delete an access request to join your team, only an admin user can delete it
|
|
532
|
+
* @param {string} [orgName] - The organization name.
|
|
533
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
534
|
+
* @example
|
|
535
|
+
* accessControl.deleteAccessRequest("djjdshhsuuwewueueuiHYHYYW.......").then(result=>{
|
|
536
|
+
* console.log(result)
|
|
537
|
+
* })
|
|
538
|
+
*
|
|
539
|
+
*/
|
|
540
|
+
deleteAccessRequest(acceId: any, orgName?: string): Promise<any>;
|
|
541
|
+
/**
|
|
542
|
+
* -- TerminusX API --
|
|
543
|
+
* Get the userinfo teams ownership and subscription
|
|
544
|
+
* @param {string} [orgName] - The organization name.
|
|
545
|
+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
|
|
546
|
+
* @example
|
|
547
|
+
* accessControl.getUserInfo().then(result=>{
|
|
548
|
+
* console.log(result)
|
|
549
|
+
* })
|
|
550
|
+
*
|
|
551
|
+
*/
|
|
552
|
+
getUserInfo(userName: any): Promise<any>;
|
|
553
|
+
}
|
|
554
|
+
import typedef = require("./typedef");
|