@docbrasil/api-systemmanager 1.0.76 → 1.0.78
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/user/document.js +29 -29
- package/api/user/process.js +4 -4
- package/dist/bundle.cjs +33 -33
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +5 -253
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -37,21 +37,12 @@
|
|
|
37
37
|
<dt><a href="#AdminUser">AdminUser</a></dt>
|
|
38
38
|
<dd><p>Admin Class for user, permission admin</p>
|
|
39
39
|
</dd>
|
|
40
|
-
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
41
|
-
<dd><p>Api dispatch manager</p>
|
|
42
|
-
</dd>
|
|
43
40
|
<dt><a href="#GeoLocation">GeoLocation</a></dt>
|
|
44
41
|
<dd><p>General Class for user, permission organization</p>
|
|
45
42
|
</dd>
|
|
46
43
|
<dt><a href="#Users">Users</a></dt>
|
|
47
44
|
<dd><p>API request, user permission level</p>
|
|
48
45
|
</dd>
|
|
49
|
-
<dt><a href="#Login">Login</a></dt>
|
|
50
|
-
<dd><p>Login manager</p>
|
|
51
|
-
</dd>
|
|
52
|
-
<dt><a href="#Session">Session</a></dt>
|
|
53
|
-
<dd><p>Session manager of the API</p>
|
|
54
|
-
</dd>
|
|
55
46
|
<dt><a href="#Documents">Documents</a></dt>
|
|
56
47
|
<dd><p>Class for documents, permission user</p>
|
|
57
48
|
</dd>
|
|
@@ -1011,6 +1002,10 @@ Get task by user Id
|
|
|
1011
1002
|
| params | <code>object</code> | | Params to get task |
|
|
1012
1003
|
| params.userId | <code>string</code> | | User id (_id database) |
|
|
1013
1004
|
| [params.filter] | <code>string</code> | <code>"NOT_DONE"</code> | Filter type CLEAN | EXECUTED | PENDING | LATE | NOT_DONE | DONE |
|
|
1005
|
+
| params.project | <code>object</code> | | Project to return |
|
|
1006
|
+
| params.project.returnProcessProperties | <code>boolean</code> | | Return process properties |
|
|
1007
|
+
| params.project.returnInitParams | <code>boolean</code> | | Return init params |
|
|
1008
|
+
| params.userId | <code>string</code> | | User id (_id database) |
|
|
1014
1009
|
| [params.includeOwner] | <code>boolean</code> | <code>false</code> | Include owner true | false |
|
|
1015
1010
|
| session | <code>string</code> | | Session, token JWT |
|
|
1016
1011
|
|
|
@@ -1133,52 +1128,6 @@ const payload = {
|
|
|
1133
1128
|
};
|
|
1134
1129
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1135
1130
|
```
|
|
1136
|
-
<a name="Dispatch"></a>
|
|
1137
|
-
|
|
1138
|
-
## Dispatch
|
|
1139
|
-
Api dispatch manager
|
|
1140
|
-
|
|
1141
|
-
**Kind**: global class
|
|
1142
|
-
|
|
1143
|
-
* [Dispatch](#Dispatch)
|
|
1144
|
-
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
1145
|
-
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
1146
|
-
|
|
1147
|
-
<a name="Dispatch+getContext"></a>
|
|
1148
|
-
|
|
1149
|
-
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
1150
|
-
Get the URL context
|
|
1151
|
-
|
|
1152
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1153
|
-
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
1154
|
-
**Access**: public
|
|
1155
|
-
|
|
1156
|
-
| Param | Type | Default | Description |
|
|
1157
|
-
| --- | --- | --- | --- |
|
|
1158
|
-
| url | <code>string</code> | | Full url |
|
|
1159
|
-
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
1160
|
-
|
|
1161
|
-
**Example**
|
|
1162
|
-
```js
|
|
1163
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1164
|
-
const api = new API();
|
|
1165
|
-
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
1166
|
-
```
|
|
1167
|
-
<a name="Dispatch+getClient"></a>
|
|
1168
|
-
|
|
1169
|
-
### dispatch.getClient() ⇒ <code>promise</code>
|
|
1170
|
-
Get client Axios
|
|
1171
|
-
|
|
1172
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1173
|
-
**Returns**: <code>promise</code> - return client axios
|
|
1174
|
-
**Access**: public
|
|
1175
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1176
|
-
**Example**
|
|
1177
|
-
```js
|
|
1178
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1179
|
-
const api = new API();
|
|
1180
|
-
await api.dispatch.getClient();
|
|
1181
|
-
```
|
|
1182
1131
|
<a name="GeoLocation"></a>
|
|
1183
1132
|
|
|
1184
1133
|
## GeoLocation
|
|
@@ -1240,203 +1189,6 @@ API request, user permission level
|
|
|
1240
1189
|
| options | <code>object</code> | Params of the constructor |
|
|
1241
1190
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1242
1191
|
|
|
1243
|
-
<a name="Login"></a>
|
|
1244
|
-
|
|
1245
|
-
## Login
|
|
1246
|
-
Login manager
|
|
1247
|
-
|
|
1248
|
-
**Kind**: global class
|
|
1249
|
-
|
|
1250
|
-
* [Login](#Login)
|
|
1251
|
-
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1252
|
-
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1253
|
-
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1254
|
-
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1255
|
-
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1256
|
-
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1257
|
-
|
|
1258
|
-
<a name="Login+facebook"></a>
|
|
1259
|
-
|
|
1260
|
-
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1261
|
-
Login with social login Facebook
|
|
1262
|
-
|
|
1263
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1264
|
-
**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
|
|
1265
|
-
**Access**: public
|
|
1266
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1267
|
-
|
|
1268
|
-
| Param | Type | Description |
|
|
1269
|
-
| --- | --- | --- |
|
|
1270
|
-
| params | <code>object</code> | Params to login Facebook |
|
|
1271
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1272
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1273
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1274
|
-
|
|
1275
|
-
**Example**
|
|
1276
|
-
```js
|
|
1277
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1278
|
-
|
|
1279
|
-
// Params of the instance
|
|
1280
|
-
const params = {...}
|
|
1281
|
-
const api = new API(params);
|
|
1282
|
-
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
1283
|
-
const { auth, user } = await api.login.facebook(params);
|
|
1284
|
-
```
|
|
1285
|
-
<a name="Login+google"></a>
|
|
1286
|
-
|
|
1287
|
-
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1288
|
-
Login with social login Google
|
|
1289
|
-
|
|
1290
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1291
|
-
**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
|
|
1292
|
-
**Access**: public
|
|
1293
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1294
|
-
|
|
1295
|
-
| Param | Type | Description |
|
|
1296
|
-
| --- | --- | --- |
|
|
1297
|
-
| params | <code>object</code> | Params to login Google |
|
|
1298
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1299
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1300
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1301
|
-
|
|
1302
|
-
**Example**
|
|
1303
|
-
```js
|
|
1304
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1305
|
-
|
|
1306
|
-
// Params of the instance
|
|
1307
|
-
const params = {...}
|
|
1308
|
-
const api = new API(params);
|
|
1309
|
-
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
1310
|
-
const { auth, user } = await api.login.google(accessToken);
|
|
1311
|
-
```
|
|
1312
|
-
<a name="Login+apiKey"></a>
|
|
1313
|
-
|
|
1314
|
-
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1315
|
-
Login with apikey
|
|
1316
|
-
|
|
1317
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1318
|
-
**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
|
|
1319
|
-
**Access**: public
|
|
1320
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1321
|
-
|
|
1322
|
-
| Param | Type | Description |
|
|
1323
|
-
| --- | --- | --- |
|
|
1324
|
-
| apikey | <code>string</code> | Access key |
|
|
1325
|
-
|
|
1326
|
-
**Example**
|
|
1327
|
-
```js
|
|
1328
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1329
|
-
|
|
1330
|
-
// Params of the instance
|
|
1331
|
-
const params = {...}
|
|
1332
|
-
const api = new API(params);
|
|
1333
|
-
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
1334
|
-
const { auth, user } = await api.login.apiKey(apiKey);
|
|
1335
|
-
```
|
|
1336
|
-
<a name="Login+userPass"></a>
|
|
1337
|
-
|
|
1338
|
-
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1339
|
-
Login with user and password
|
|
1340
|
-
|
|
1341
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1342
|
-
**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
|
|
1343
|
-
**Access**: public
|
|
1344
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1345
|
-
|
|
1346
|
-
| Param | Type | Description |
|
|
1347
|
-
| --- | --- | --- |
|
|
1348
|
-
| params | <code>object</code> | Object with user and password |
|
|
1349
|
-
| params.username | <code>string</code> | Username or email of the user |
|
|
1350
|
-
| params.password | <code>string</code> | Password of the user |
|
|
1351
|
-
| params.orgname | <code>string</code> | The organame of the user |
|
|
1352
|
-
|
|
1353
|
-
**Example**
|
|
1354
|
-
```js
|
|
1355
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1356
|
-
|
|
1357
|
-
// Params of the instance
|
|
1358
|
-
const params = {...}
|
|
1359
|
-
const api = new API(params);
|
|
1360
|
-
const params = {
|
|
1361
|
-
username: 'ana.silva@gmail.com',
|
|
1362
|
-
password: '123456'
|
|
1363
|
-
};
|
|
1364
|
-
const { auth, user } = await api.login.userPass(params);
|
|
1365
|
-
```
|
|
1366
|
-
<a name="Login+logout"></a>
|
|
1367
|
-
|
|
1368
|
-
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1369
|
-
Logout user system manager
|
|
1370
|
-
|
|
1371
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1372
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1373
|
-
**Access**: public
|
|
1374
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1375
|
-
|
|
1376
|
-
| Param | Type | Description |
|
|
1377
|
-
| --- | --- | --- |
|
|
1378
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1379
|
-
|
|
1380
|
-
**Example**
|
|
1381
|
-
```js
|
|
1382
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1383
|
-
|
|
1384
|
-
// Params of the instance
|
|
1385
|
-
const params = {...}
|
|
1386
|
-
const api = new API(params);
|
|
1387
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1388
|
-
const { success } = await api.login.logout(session);
|
|
1389
|
-
```
|
|
1390
|
-
<a name="Login+recover"></a>
|
|
1391
|
-
|
|
1392
|
-
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1393
|
-
Recover the password
|
|
1394
|
-
|
|
1395
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1396
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1397
|
-
**Access**: public
|
|
1398
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1399
|
-
|
|
1400
|
-
| Param | Type | Description |
|
|
1401
|
-
| --- | --- | --- |
|
|
1402
|
-
| username | <code>string</code> | The username or email |
|
|
1403
|
-
|
|
1404
|
-
**Example**
|
|
1405
|
-
```js
|
|
1406
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1407
|
-
|
|
1408
|
-
// Params of the instance
|
|
1409
|
-
const params = {...}
|
|
1410
|
-
const api = new API(params);
|
|
1411
|
-
const { success } = await api.login.recover('myusername');
|
|
1412
|
-
```
|
|
1413
|
-
<a name="Session"></a>
|
|
1414
|
-
|
|
1415
|
-
## Session
|
|
1416
|
-
Session manager of the API
|
|
1417
|
-
|
|
1418
|
-
**Kind**: global class
|
|
1419
|
-
<a name="Session+information"></a>
|
|
1420
|
-
|
|
1421
|
-
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
1422
|
-
Show information for session, thus validating the session (Valid token JWT)
|
|
1423
|
-
|
|
1424
|
-
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
1425
|
-
**Access**: public
|
|
1426
|
-
|
|
1427
|
-
| Param | Type | Default | Description |
|
|
1428
|
-
| --- | --- | --- | --- |
|
|
1429
|
-
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
1430
|
-
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
1431
|
-
|
|
1432
|
-
**Example**
|
|
1433
|
-
```js
|
|
1434
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1435
|
-
const api = new API();
|
|
1436
|
-
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1437
|
-
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1438
|
-
await api.session.information(sessionId, suSessionId);
|
|
1439
|
-
```
|
|
1440
1192
|
<a name="Documents"></a>
|
|
1441
1193
|
|
|
1442
1194
|
## Documents
|
|
@@ -1468,7 +1220,7 @@ Create new document
|
|
|
1468
1220
|
| params.orgname | <code>string</code> | | Organization name |
|
|
1469
1221
|
| params.areaId | <code>string</code> | | Doc area id (_id database) |
|
|
1470
1222
|
| params.docId | <code>string</code> | | Document id (_id database) |
|
|
1471
|
-
| [params.documentDate] | <code>string</code> | <code>"new
|
|
1223
|
+
| [params.documentDate] | <code>string</code> | <code>"new Date()"</code> | Date of document |
|
|
1472
1224
|
| params.document | <code>string</code> | | The path to the file. If S3, the key to S3, gotten after getting a signed URL |
|
|
1473
1225
|
| params.filename | <code>string</code> | | File name |
|
|
1474
1226
|
| params.type | <code>string</code> | | Mimetype of the document (image/png) |
|
package/package.json
CHANGED