@docbrasil/api-systemmanager 1.0.107 → 1.0.109
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/.github/workflows/static.yml +43 -0
- package/api/external.js +41 -0
- package/dist/bundle.cjs +41 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +382 -0
- package/docs/Admin.html +336 -0
- package/docs/AdminDocuments.html +2235 -0
- package/docs/AdminForm.html +934 -0
- package/docs/AdminLists.html +895 -0
- package/docs/AdminMessage.html +1490 -0
- package/docs/AdminNotification.html +1636 -0
- package/docs/AdminPlugin.html +696 -0
- package/docs/AdminPolicy.html +451 -0
- package/docs/AdminProcesses.html +692 -0
- package/docs/AdminTask.html +740 -0
- package/docs/AdminUser.html +1203 -0
- package/docs/Datasource.html +660 -0
- package/docs/Dispatch.html +624 -0
- package/docs/Documents.html +4875 -0
- package/docs/External.html +1497 -0
- package/docs/GeoLocation.html +503 -0
- package/docs/Login.html +1839 -0
- package/docs/Notification.html +625 -0
- package/docs/Organization.html +2767 -0
- package/docs/Process.html +1598 -0
- package/docs/Register.html +1604 -0
- package/docs/Session.html +482 -0
- package/docs/Task.html +1394 -0
- package/docs/TaskAvailable.html +893 -0
- package/docs/User.html +2002 -0
- package/docs/Users.html +569 -0
- package/docs/admin_doctypes.js.html +193 -0
- package/docs/admin_document.js.html +449 -0
- package/docs/admin_form.js.html +268 -0
- package/docs/admin_index.js.html +163 -0
- package/docs/admin_list.js.html +250 -0
- package/docs/admin_message.js.html +311 -0
- package/docs/admin_notification.js.html +350 -0
- package/docs/admin_organization.js.html +241 -0
- package/docs/admin_plugin.js.html +233 -0
- package/docs/admin_policy.js.html +195 -0
- package/docs/admin_processes.js.html +487 -0
- package/docs/admin_task.js.html +242 -0
- package/docs/admin_user.js.html +302 -0
- package/docs/dispatch.js.html +218 -0
- package/docs/external.js.html +333 -0
- package/docs/general_geoLocation.js.html +205 -0
- package/docs/general_index.js.html +140 -0
- package/docs/index.html +129 -0
- package/docs/login.js.html +384 -0
- package/docs/scripts/app.min.js +1 -0
- package/docs/scripts/linenumber.js +26 -0
- package/docs/scripts/search.js +39 -0
- package/docs/session.js.html +202 -0
- package/docs/styles/app.min.css +1 -0
- package/docs/styles/iframe.css +13 -0
- package/docs/styles/prettify-jsdoc.css +111 -0
- package/docs/styles/prettify-tomorrow.css +132 -0
- package/docs/styles/reset.css +44 -0
- package/docs/user_datasource.js.html +261 -0
- package/docs/user_document.js.html +847 -0
- package/docs/user_index.js.html +156 -0
- package/docs/user_notification.js.html +218 -0
- package/docs/user_organization.js.html +347 -0
- package/docs/user_process.js.html +352 -0
- package/docs/user_register.js.html +322 -0
- package/docs/user_task.js.html +319 -0
- package/docs/user_task_available.js.html +252 -0
- package/docs/user_user.js.html +404 -0
- package/docs/utils_promises.js.html +235 -0
- package/package.json +7 -4
- package/readme.md +7 -8
- package/doc.md +0 -653
package/doc/api.md
CHANGED
|
@@ -73,6 +73,18 @@
|
|
|
73
73
|
<dt><a href="#User">User</a></dt>
|
|
74
74
|
<dd><p>Class for user, permission user</p>
|
|
75
75
|
</dd>
|
|
76
|
+
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
77
|
+
<dd><p>Api dispatch manager</p>
|
|
78
|
+
</dd>
|
|
79
|
+
<dt><a href="#External">External</a></dt>
|
|
80
|
+
<dd><p>Class for documents, permission user</p>
|
|
81
|
+
</dd>
|
|
82
|
+
<dt><a href="#Login">Login</a></dt>
|
|
83
|
+
<dd><p>Login manager</p>
|
|
84
|
+
</dd>
|
|
85
|
+
<dt><a href="#Session">Session</a></dt>
|
|
86
|
+
<dd><p>Session manager of the API</p>
|
|
87
|
+
</dd>
|
|
76
88
|
</dl>
|
|
77
89
|
|
|
78
90
|
<a name="AdminDocuments"></a>
|
|
@@ -2480,3 +2492,373 @@ const id = '616eccaaa9360a05293b10fe';
|
|
|
2480
2492
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2481
2493
|
await api.user.changeOrganization.updateAvatar(id, session);
|
|
2482
2494
|
```
|
|
2495
|
+
<a name="Dispatch"></a>
|
|
2496
|
+
|
|
2497
|
+
## Dispatch
|
|
2498
|
+
Api dispatch manager
|
|
2499
|
+
|
|
2500
|
+
**Kind**: global class
|
|
2501
|
+
|
|
2502
|
+
* [Dispatch](#Dispatch)
|
|
2503
|
+
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
2504
|
+
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
2505
|
+
|
|
2506
|
+
<a name="Dispatch+getContext"></a>
|
|
2507
|
+
|
|
2508
|
+
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
2509
|
+
Get the URL context
|
|
2510
|
+
|
|
2511
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
2512
|
+
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
2513
|
+
**Access**: public
|
|
2514
|
+
|
|
2515
|
+
| Param | Type | Default | Description |
|
|
2516
|
+
| --- | --- | --- | --- |
|
|
2517
|
+
| url | <code>string</code> | | Full url |
|
|
2518
|
+
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
2519
|
+
|
|
2520
|
+
**Example**
|
|
2521
|
+
```js
|
|
2522
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2523
|
+
const api = new API();
|
|
2524
|
+
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
2525
|
+
```
|
|
2526
|
+
<a name="Dispatch+getClient"></a>
|
|
2527
|
+
|
|
2528
|
+
### dispatch.getClient() ⇒ <code>promise</code>
|
|
2529
|
+
Get client Axios
|
|
2530
|
+
|
|
2531
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
2532
|
+
**Returns**: <code>promise</code> - return client axios
|
|
2533
|
+
**Access**: public
|
|
2534
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2535
|
+
**Example**
|
|
2536
|
+
```js
|
|
2537
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2538
|
+
const api = new API();
|
|
2539
|
+
await api.dispatch.getClient();
|
|
2540
|
+
```
|
|
2541
|
+
<a name="External"></a>
|
|
2542
|
+
|
|
2543
|
+
## External
|
|
2544
|
+
Class for documents, permission user
|
|
2545
|
+
|
|
2546
|
+
**Kind**: global class
|
|
2547
|
+
|
|
2548
|
+
* [External](#External)
|
|
2549
|
+
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
2550
|
+
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
2551
|
+
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
2552
|
+
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
2553
|
+
|
|
2554
|
+
<a name="External+context"></a>
|
|
2555
|
+
|
|
2556
|
+
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
2557
|
+
Create new document
|
|
2558
|
+
|
|
2559
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
2560
|
+
**Returns**: <code>Promise.<object></code> - data<code>string</code> - _id the id of the form<code>string</code> - orgId the organization id of the form<code>string</code> - authorization the unique token registered internally by the system for all the next calls to the external form APIs
|
|
2561
|
+
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
2562
|
+
**Access**: public
|
|
2563
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2564
|
+
|
|
2565
|
+
| Param | Type | Description |
|
|
2566
|
+
| --- | --- | --- |
|
|
2567
|
+
| params | <code>object</code> | Object for add new document |
|
|
2568
|
+
| params.id | <code>string</code> | Organization form id |
|
|
2569
|
+
|
|
2570
|
+
**Example**
|
|
2571
|
+
```js
|
|
2572
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2573
|
+
const api = new API();
|
|
2574
|
+
const params = {
|
|
2575
|
+
id: '611e679741cc63168c26d7ee'
|
|
2576
|
+
};
|
|
2577
|
+
const retForm = await api.external.context(params);
|
|
2578
|
+
```
|
|
2579
|
+
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
2580
|
+
|
|
2581
|
+
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
2582
|
+
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
2583
|
+
|
|
2584
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
2585
|
+
**Returns**: <code>Promise.<object></code> - doc<code>string</code> - doc.mime the original mime type of the document<code>string</code> - doc.signedUrl the signed url to upload the document<code>string</code> - doc.filename the filename of the uploaded file<code>string</code> - doc.extension the extension of the filename, obtained from the mime type
|
|
2586
|
+
**Access**: public
|
|
2587
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2588
|
+
|
|
2589
|
+
| Param | Type | Description |
|
|
2590
|
+
| --- | --- | --- |
|
|
2591
|
+
| mime | <code>string</code> | the mime type of the document |
|
|
2592
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
2593
|
+
|
|
2594
|
+
**Example**
|
|
2595
|
+
```js
|
|
2596
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2597
|
+
const api = new API();
|
|
2598
|
+
const authorization = '...';
|
|
2599
|
+
const doc = {
|
|
2600
|
+
mime: 'application/pdf'
|
|
2601
|
+
};
|
|
2602
|
+
const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
2603
|
+
```
|
|
2604
|
+
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
2605
|
+
|
|
2606
|
+
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
2607
|
+
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
2608
|
+
|
|
2609
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
2610
|
+
**Returns**: <code>Promise.<array></code> - docs<code>string</code> - docs.mime the original mime type of the document<code>string</code> - docs.signedUrl the signed url to upload the document<code>string</code> - docs.filename the filename of the uploaded file<code>string</code> - docs.extension the extension of the filename, obtained from the mime type
|
|
2611
|
+
**Access**: public
|
|
2612
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2613
|
+
|
|
2614
|
+
| Param | Type | Description |
|
|
2615
|
+
| --- | --- | --- |
|
|
2616
|
+
| docs | <code>array.<object></code> | the list of documents |
|
|
2617
|
+
| docs.mime | <code>string</code> | the mime type of the document |
|
|
2618
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
2619
|
+
|
|
2620
|
+
**Example**
|
|
2621
|
+
```js
|
|
2622
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2623
|
+
const api = new API();
|
|
2624
|
+
const authorization = '...';
|
|
2625
|
+
const docs = [
|
|
2626
|
+
{
|
|
2627
|
+
mime: 'application/pdf'
|
|
2628
|
+
}
|
|
2629
|
+
];
|
|
2630
|
+
const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
|
|
2631
|
+
```
|
|
2632
|
+
<a name="External+handle"></a>
|
|
2633
|
+
|
|
2634
|
+
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
2635
|
+
Handles the execution of an external form
|
|
2636
|
+
|
|
2637
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
2638
|
+
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
2639
|
+
**Access**: public
|
|
2640
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2641
|
+
|
|
2642
|
+
| Param | Type | Description |
|
|
2643
|
+
| --- | --- | --- |
|
|
2644
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
2645
|
+
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
2646
|
+
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
2647
|
+
| params.payload.name | <code>string</code> | the name of the group |
|
|
2648
|
+
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
2649
|
+
| params.payload.fields.value | <code>\*</code> \| <code>Object</code> | besides all the data inside a field, it should have the value of the the field |
|
|
2650
|
+
|
|
2651
|
+
**Example**
|
|
2652
|
+
```js
|
|
2653
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2654
|
+
const api = new API();
|
|
2655
|
+
const authorization = '...';
|
|
2656
|
+
const params = {
|
|
2657
|
+
payload: [
|
|
2658
|
+
{
|
|
2659
|
+
name: 'My Group One',
|
|
2660
|
+
fields: [
|
|
2661
|
+
{}
|
|
2662
|
+
]
|
|
2663
|
+
}
|
|
2664
|
+
]
|
|
2665
|
+
};
|
|
2666
|
+
const success = await api.external.handle(params, authorization);
|
|
2667
|
+
```
|
|
2668
|
+
<a name="Login"></a>
|
|
2669
|
+
|
|
2670
|
+
## Login
|
|
2671
|
+
Login manager
|
|
2672
|
+
|
|
2673
|
+
**Kind**: global class
|
|
2674
|
+
|
|
2675
|
+
* [Login](#Login)
|
|
2676
|
+
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2677
|
+
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2678
|
+
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2679
|
+
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2680
|
+
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
2681
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
2682
|
+
|
|
2683
|
+
<a name="Login+facebook"></a>
|
|
2684
|
+
|
|
2685
|
+
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2686
|
+
Login with social login Facebook
|
|
2687
|
+
|
|
2688
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
2689
|
+
**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
|
|
2690
|
+
**Access**: public
|
|
2691
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2692
|
+
|
|
2693
|
+
| Param | Type | Description |
|
|
2694
|
+
| --- | --- | --- |
|
|
2695
|
+
| params | <code>object</code> | Params to login Facebook |
|
|
2696
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
2697
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
2698
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
2699
|
+
|
|
2700
|
+
**Example**
|
|
2701
|
+
```js
|
|
2702
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2703
|
+
|
|
2704
|
+
// Params of the instance
|
|
2705
|
+
const params = {...}
|
|
2706
|
+
const api = new API(params);
|
|
2707
|
+
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
2708
|
+
const { auth, user } = await api.login.facebook(params);
|
|
2709
|
+
```
|
|
2710
|
+
<a name="Login+google"></a>
|
|
2711
|
+
|
|
2712
|
+
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2713
|
+
Login with social login Google
|
|
2714
|
+
|
|
2715
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
2716
|
+
**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
|
|
2717
|
+
**Access**: public
|
|
2718
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2719
|
+
|
|
2720
|
+
| Param | Type | Description |
|
|
2721
|
+
| --- | --- | --- |
|
|
2722
|
+
| params | <code>object</code> | Params to login Google |
|
|
2723
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
2724
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
2725
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
2726
|
+
|
|
2727
|
+
**Example**
|
|
2728
|
+
```js
|
|
2729
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2730
|
+
|
|
2731
|
+
// Params of the instance
|
|
2732
|
+
const params = {...}
|
|
2733
|
+
const api = new API(params);
|
|
2734
|
+
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
2735
|
+
const { auth, user } = await api.login.google(accessToken);
|
|
2736
|
+
```
|
|
2737
|
+
<a name="Login+apiKey"></a>
|
|
2738
|
+
|
|
2739
|
+
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2740
|
+
Login with apikey
|
|
2741
|
+
|
|
2742
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
2743
|
+
**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
|
|
2744
|
+
**Access**: public
|
|
2745
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2746
|
+
|
|
2747
|
+
| Param | Type | Description |
|
|
2748
|
+
| --- | --- | --- |
|
|
2749
|
+
| apikey | <code>string</code> | Access key |
|
|
2750
|
+
|
|
2751
|
+
**Example**
|
|
2752
|
+
```js
|
|
2753
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2754
|
+
|
|
2755
|
+
// Params of the instance
|
|
2756
|
+
const params = {...}
|
|
2757
|
+
const api = new API(params);
|
|
2758
|
+
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
2759
|
+
const { auth, user } = await api.login.apiKey(apiKey);
|
|
2760
|
+
```
|
|
2761
|
+
<a name="Login+userPass"></a>
|
|
2762
|
+
|
|
2763
|
+
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
2764
|
+
Login with user and password
|
|
2765
|
+
|
|
2766
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
2767
|
+
**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
|
|
2768
|
+
**Access**: public
|
|
2769
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2770
|
+
|
|
2771
|
+
| Param | Type | Description |
|
|
2772
|
+
| --- | --- | --- |
|
|
2773
|
+
| params | <code>object</code> | Object with user and password |
|
|
2774
|
+
| params.username | <code>string</code> | Username or email of the user |
|
|
2775
|
+
| params.password | <code>string</code> | Password of the user |
|
|
2776
|
+
| params.orgname | <code>string</code> | The organame of the user |
|
|
2777
|
+
|
|
2778
|
+
**Example**
|
|
2779
|
+
```js
|
|
2780
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2781
|
+
|
|
2782
|
+
// Params of the instance
|
|
2783
|
+
const params = {...}
|
|
2784
|
+
const api = new API(params);
|
|
2785
|
+
const params = {
|
|
2786
|
+
username: 'ana.silva@gmail.com',
|
|
2787
|
+
password: '123456'
|
|
2788
|
+
};
|
|
2789
|
+
const { auth, user } = await api.login.userPass(params);
|
|
2790
|
+
```
|
|
2791
|
+
<a name="Login+logout"></a>
|
|
2792
|
+
|
|
2793
|
+
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
2794
|
+
Logout user system manager
|
|
2795
|
+
|
|
2796
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
2797
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
2798
|
+
**Access**: public
|
|
2799
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2800
|
+
|
|
2801
|
+
| Param | Type | Description |
|
|
2802
|
+
| --- | --- | --- |
|
|
2803
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2804
|
+
|
|
2805
|
+
**Example**
|
|
2806
|
+
```js
|
|
2807
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2808
|
+
|
|
2809
|
+
// Params of the instance
|
|
2810
|
+
const params = {...}
|
|
2811
|
+
const api = new API(params);
|
|
2812
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2813
|
+
const { success } = await api.login.logout(session);
|
|
2814
|
+
```
|
|
2815
|
+
<a name="Login+recover"></a>
|
|
2816
|
+
|
|
2817
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
2818
|
+
Recover the password
|
|
2819
|
+
|
|
2820
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
2821
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
2822
|
+
**Access**: public
|
|
2823
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2824
|
+
|
|
2825
|
+
| Param | Type | Description |
|
|
2826
|
+
| --- | --- | --- |
|
|
2827
|
+
| username | <code>string</code> | The username or email |
|
|
2828
|
+
|
|
2829
|
+
**Example**
|
|
2830
|
+
```js
|
|
2831
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2832
|
+
|
|
2833
|
+
// Params of the instance
|
|
2834
|
+
const params = {...}
|
|
2835
|
+
const api = new API(params);
|
|
2836
|
+
const { success } = await api.login.recover('myusername');
|
|
2837
|
+
```
|
|
2838
|
+
<a name="Session"></a>
|
|
2839
|
+
|
|
2840
|
+
## Session
|
|
2841
|
+
Session manager of the API
|
|
2842
|
+
|
|
2843
|
+
**Kind**: global class
|
|
2844
|
+
<a name="Session+information"></a>
|
|
2845
|
+
|
|
2846
|
+
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
2847
|
+
Show information for session, thus validating the session (Valid token JWT)
|
|
2848
|
+
|
|
2849
|
+
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
2850
|
+
**Access**: public
|
|
2851
|
+
|
|
2852
|
+
| Param | Type | Default | Description |
|
|
2853
|
+
| --- | --- | --- | --- |
|
|
2854
|
+
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
2855
|
+
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
2856
|
+
|
|
2857
|
+
**Example**
|
|
2858
|
+
```js
|
|
2859
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2860
|
+
const api = new API();
|
|
2861
|
+
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2862
|
+
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2863
|
+
await api.session.information(sessionId, suSessionId);
|
|
2864
|
+
```
|