@docbrasil/api-systemmanager 1.0.54 → 1.0.55
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/api/admin/document.js +0 -42
- package/api/admin/index.js +6 -5
- package/api/admin/organization.js +124 -0
- package/dist/bundle.cjs +0 -43
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +0 -257
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -34,21 +34,12 @@
|
|
|
34
34
|
<dt><a href="#AdminUser">AdminUser</a></dt>
|
|
35
35
|
<dd><p>Admin Class for user, permission admin</p>
|
|
36
36
|
</dd>
|
|
37
|
-
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
38
|
-
<dd><p>Api dispatch manager</p>
|
|
39
|
-
</dd>
|
|
40
37
|
<dt><a href="#GeoLocation">GeoLocation</a></dt>
|
|
41
38
|
<dd><p>General Class for user, permission organization</p>
|
|
42
39
|
</dd>
|
|
43
40
|
<dt><a href="#Users">Users</a></dt>
|
|
44
41
|
<dd><p>API request, user permission level</p>
|
|
45
42
|
</dd>
|
|
46
|
-
<dt><a href="#Login">Login</a></dt>
|
|
47
|
-
<dd><p>Login manager</p>
|
|
48
|
-
</dd>
|
|
49
|
-
<dt><a href="#Session">Session</a></dt>
|
|
50
|
-
<dd><p>Session manager of the API</p>
|
|
51
|
-
</dd>
|
|
52
43
|
<dt><a href="#Documents">Documents</a></dt>
|
|
53
44
|
<dd><p>Class for documents, permission user</p>
|
|
54
45
|
</dd>
|
|
@@ -85,7 +76,6 @@ Admin Class for documents, permission admin
|
|
|
85
76
|
* [.signedUrl(params, apiKey)](#AdminDocuments+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
86
77
|
* [.updateContent(params, apiKey)](#AdminDocuments+updateContent) ⇒ <code>Promise.<object></code>
|
|
87
78
|
* [.updateAI(params, apiKey)](#AdminDocuments+updateAI) ⇒ <code>Promise.<object></code>
|
|
88
|
-
* [.getContent(params, apiKey)](#AdminDocuments+getContent) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>number</code>
|
|
89
79
|
|
|
90
80
|
<a name="AdminDocuments+advancedSearch"></a>
|
|
91
81
|
|
|
@@ -261,34 +251,6 @@ const params - {
|
|
|
261
251
|
const apiKey: '...';
|
|
262
252
|
await api.admin.document.updateContent(params, apiKey);
|
|
263
253
|
```
|
|
264
|
-
<a name="AdminDocuments+getContent"></a>
|
|
265
|
-
|
|
266
|
-
### adminDocuments.getContent(params, apiKey) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>number</code>
|
|
267
|
-
Get the content of a document
|
|
268
|
-
|
|
269
|
-
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
270
|
-
**Returns**: <code>Promise.<object></code> - data the document content<code>string</code> - data._id the _id of the document<code>string</code> - data.content all the pages or if asked by page, just one page, the one requested<code>string</code> - data.content.TextOverlay the overlay text if requested<code>string</code> - data.content.ParsedText the page text content<code>number</code> - data.total the total number of pages
|
|
271
|
-
**Access**: public
|
|
272
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
273
|
-
|
|
274
|
-
| Param | Type | Description |
|
|
275
|
-
| --- | --- | --- |
|
|
276
|
-
| params | <code>object</code> | Params to request signed url |
|
|
277
|
-
| params.docId | <code>string</code> | The unique id of the document |
|
|
278
|
-
| params.page | <code>string</code> | The page, from 0, or 'all' if all pages (the full content) |
|
|
279
|
-
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
280
|
-
|
|
281
|
-
**Example**
|
|
282
|
-
```js
|
|
283
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
284
|
-
const api = new API();
|
|
285
|
-
const params - {
|
|
286
|
-
page: '0',
|
|
287
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
288
|
-
};
|
|
289
|
-
const apiKey: '...';
|
|
290
|
-
await api.admin.document.getContent(params, apiKey);
|
|
291
|
-
```
|
|
292
254
|
<a name="AdminForm"></a>
|
|
293
255
|
|
|
294
256
|
## AdminForm
|
|
@@ -942,52 +904,6 @@ const payload = {
|
|
|
942
904
|
};
|
|
943
905
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
944
906
|
```
|
|
945
|
-
<a name="Dispatch"></a>
|
|
946
|
-
|
|
947
|
-
## Dispatch
|
|
948
|
-
Api dispatch manager
|
|
949
|
-
|
|
950
|
-
**Kind**: global class
|
|
951
|
-
|
|
952
|
-
* [Dispatch](#Dispatch)
|
|
953
|
-
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
954
|
-
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
955
|
-
|
|
956
|
-
<a name="Dispatch+getContext"></a>
|
|
957
|
-
|
|
958
|
-
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
959
|
-
Get the URL context
|
|
960
|
-
|
|
961
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
962
|
-
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
963
|
-
**Access**: public
|
|
964
|
-
|
|
965
|
-
| Param | Type | Default | Description |
|
|
966
|
-
| --- | --- | --- | --- |
|
|
967
|
-
| url | <code>string</code> | | Full url |
|
|
968
|
-
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
969
|
-
|
|
970
|
-
**Example**
|
|
971
|
-
```js
|
|
972
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
973
|
-
const api = new API();
|
|
974
|
-
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
975
|
-
```
|
|
976
|
-
<a name="Dispatch+getClient"></a>
|
|
977
|
-
|
|
978
|
-
### dispatch.getClient() ⇒ <code>promise</code>
|
|
979
|
-
Get client Axios
|
|
980
|
-
|
|
981
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
982
|
-
**Returns**: <code>promise</code> - return client axios
|
|
983
|
-
**Access**: public
|
|
984
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
985
|
-
**Example**
|
|
986
|
-
```js
|
|
987
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
988
|
-
const api = new API();
|
|
989
|
-
await api.dispatch.getClient();
|
|
990
|
-
```
|
|
991
907
|
<a name="GeoLocation"></a>
|
|
992
908
|
|
|
993
909
|
## GeoLocation
|
|
@@ -1049,179 +965,6 @@ API request, user permission level
|
|
|
1049
965
|
| options | <code>object</code> | Params of the constructor |
|
|
1050
966
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1051
967
|
|
|
1052
|
-
<a name="Login"></a>
|
|
1053
|
-
|
|
1054
|
-
## Login
|
|
1055
|
-
Login manager
|
|
1056
|
-
|
|
1057
|
-
**Kind**: global class
|
|
1058
|
-
|
|
1059
|
-
* [Login](#Login)
|
|
1060
|
-
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1061
|
-
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1062
|
-
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1063
|
-
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1064
|
-
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1065
|
-
|
|
1066
|
-
<a name="Login+facebook"></a>
|
|
1067
|
-
|
|
1068
|
-
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1069
|
-
Login with social login Facebook
|
|
1070
|
-
|
|
1071
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1072
|
-
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
1073
|
-
**Access**: public
|
|
1074
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1075
|
-
|
|
1076
|
-
| Param | Type | Description |
|
|
1077
|
-
| --- | --- | --- |
|
|
1078
|
-
| params | <code>object</code> | Params to login Facebook |
|
|
1079
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1080
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1081
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1082
|
-
|
|
1083
|
-
**Example**
|
|
1084
|
-
```js
|
|
1085
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1086
|
-
|
|
1087
|
-
// Params of the instance
|
|
1088
|
-
const params = {...}
|
|
1089
|
-
const api = new API(params);
|
|
1090
|
-
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
1091
|
-
const { auth, user } = await api.login.facebook(params);
|
|
1092
|
-
```
|
|
1093
|
-
<a name="Login+google"></a>
|
|
1094
|
-
|
|
1095
|
-
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1096
|
-
Login with social login Google
|
|
1097
|
-
|
|
1098
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1099
|
-
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
1100
|
-
**Access**: public
|
|
1101
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1102
|
-
|
|
1103
|
-
| Param | Type | Description |
|
|
1104
|
-
| --- | --- | --- |
|
|
1105
|
-
| params | <code>object</code> | Params to login Google |
|
|
1106
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1107
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1108
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1109
|
-
|
|
1110
|
-
**Example**
|
|
1111
|
-
```js
|
|
1112
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1113
|
-
|
|
1114
|
-
// Params of the instance
|
|
1115
|
-
const params = {...}
|
|
1116
|
-
const api = new API(params);
|
|
1117
|
-
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
1118
|
-
const { auth, user } = await api.login.google(accessToken);
|
|
1119
|
-
```
|
|
1120
|
-
<a name="Login+apiKey"></a>
|
|
1121
|
-
|
|
1122
|
-
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1123
|
-
Login with apikey
|
|
1124
|
-
|
|
1125
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1126
|
-
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
1127
|
-
**Access**: public
|
|
1128
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1129
|
-
|
|
1130
|
-
| Param | Type | Description |
|
|
1131
|
-
| --- | --- | --- |
|
|
1132
|
-
| apikey | <code>string</code> | Access key |
|
|
1133
|
-
|
|
1134
|
-
**Example**
|
|
1135
|
-
```js
|
|
1136
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1137
|
-
|
|
1138
|
-
// Params of the instance
|
|
1139
|
-
const params = {...}
|
|
1140
|
-
const api = new API(params);
|
|
1141
|
-
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
1142
|
-
const { auth, user } = await api.login.apiKey(apiKey);
|
|
1143
|
-
```
|
|
1144
|
-
<a name="Login+userPass"></a>
|
|
1145
|
-
|
|
1146
|
-
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1147
|
-
Login with user and password
|
|
1148
|
-
|
|
1149
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1150
|
-
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
1151
|
-
**Access**: public
|
|
1152
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1153
|
-
|
|
1154
|
-
| Param | Type | Description |
|
|
1155
|
-
| --- | --- | --- |
|
|
1156
|
-
| params | <code>object</code> | Object with user and password |
|
|
1157
|
-
| params.username | <code>string</code> | Username or email of the user |
|
|
1158
|
-
| params.password | <code>string</code> | Password of the user |
|
|
1159
|
-
| params.orgname | <code>string</code> | The organame of the user |
|
|
1160
|
-
|
|
1161
|
-
**Example**
|
|
1162
|
-
```js
|
|
1163
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1164
|
-
|
|
1165
|
-
// Params of the instance
|
|
1166
|
-
const params = {...}
|
|
1167
|
-
const api = new API(params);
|
|
1168
|
-
const params = {
|
|
1169
|
-
username: 'ana.silva@gmail.com',
|
|
1170
|
-
password: '123456'
|
|
1171
|
-
};
|
|
1172
|
-
const { auth, user } = await api.login.userPass(params);
|
|
1173
|
-
```
|
|
1174
|
-
<a name="Login+logout"></a>
|
|
1175
|
-
|
|
1176
|
-
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1177
|
-
Logout user system manager
|
|
1178
|
-
|
|
1179
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1180
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1181
|
-
**Access**: public
|
|
1182
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1183
|
-
|
|
1184
|
-
| Param | Type | Description |
|
|
1185
|
-
| --- | --- | --- |
|
|
1186
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1187
|
-
|
|
1188
|
-
**Example**
|
|
1189
|
-
```js
|
|
1190
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1191
|
-
|
|
1192
|
-
// Params of the instance
|
|
1193
|
-
const params = {...}
|
|
1194
|
-
const api = new API(params);
|
|
1195
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1196
|
-
const { success } = await api.login.logout(session);
|
|
1197
|
-
```
|
|
1198
|
-
<a name="Session"></a>
|
|
1199
|
-
|
|
1200
|
-
## Session
|
|
1201
|
-
Session manager of the API
|
|
1202
|
-
|
|
1203
|
-
**Kind**: global class
|
|
1204
|
-
<a name="Session+information"></a>
|
|
1205
|
-
|
|
1206
|
-
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
1207
|
-
Show information for session, thus validating the session (Valid token JWT)
|
|
1208
|
-
|
|
1209
|
-
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
1210
|
-
**Access**: public
|
|
1211
|
-
|
|
1212
|
-
| Param | Type | Default | Description |
|
|
1213
|
-
| --- | --- | --- | --- |
|
|
1214
|
-
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
1215
|
-
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
1216
|
-
|
|
1217
|
-
**Example**
|
|
1218
|
-
```js
|
|
1219
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1220
|
-
const api = new API();
|
|
1221
|
-
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1222
|
-
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1223
|
-
await api.session.information(sessionId, suSessionId);
|
|
1224
|
-
```
|
|
1225
968
|
<a name="Documents"></a>
|
|
1226
969
|
|
|
1227
970
|
## Documents
|
package/package.json
CHANGED