@docbrasil/api-systemmanager 1.0.65 → 1.0.66

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/doc/api.md CHANGED
@@ -49,6 +49,9 @@
49
49
  <dt><a href="#Users">Users</a></dt>
50
50
  <dd><p>API request, user permission level</p>
51
51
  </dd>
52
+ <dt><a href="#Register">Register</a></dt>
53
+ <dd><p>Class for user registration in a user</p>
54
+ </dd>
52
55
  <dt><a href="#Organization">Organization</a></dt>
53
56
  <dd><p>Class for organizations, permission user</p>
54
57
  </dd>
@@ -1457,6 +1460,207 @@ API request, user permission level
1457
1460
  | options | <code>object</code> | Params of the constructor |
1458
1461
  | options.parent | <code>object</code> | This of the pararent |
1459
1462
 
1463
+ <a name="Register"></a>
1464
+
1465
+ ## Register
1466
+ Class for user registration in a user
1467
+
1468
+ **Kind**: global class
1469
+
1470
+ * [Register](#Register)
1471
+ * [.addToken(params)](#Register+addToken) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1472
+ * [.execute(params)](#Register+execute) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
1473
+ * [.getOrgname()](#Register+getOrgname) ⇒ <code>string</code>
1474
+ * [.validateEmail(params)](#Register+validateEmail) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code>
1475
+ * [.execute(params)](#Register+execute) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
1476
+
1477
+ <a name="Register+addToken"></a>
1478
+
1479
+ ### register.addToken(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1480
+ Method to add a notification token
1481
+
1482
+ **Kind**: instance method of [<code>Register</code>](#Register)
1483
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>boolean</code> - data._id the id of the added token
1484
+ **Access**: public
1485
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1486
+
1487
+ | Param | Type | Description |
1488
+ | --- | --- | --- |
1489
+ | params | <code>object</code> | Params to add notification token |
1490
+ | params.token | <code>string</code> | The token |
1491
+ | params.type | <code>object</code> | The token type |
1492
+
1493
+ **Example**
1494
+ ```js
1495
+ const API = require('@docbrasil/api-systemmanager');
1496
+ const api = new API();
1497
+ const params = {
1498
+ token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
1499
+ type: 'FCM_WEB'
1500
+ };
1501
+ const retData = await api.user.notification.addToken(params);
1502
+ ```
1503
+ <a name="Register+execute"></a>
1504
+
1505
+ ### register.execute(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
1506
+ Method to register a user
1507
+
1508
+ **Kind**: instance method of [<code>Register</code>](#Register)
1509
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>object</code> - auth The full authentication data with session, if login is true.<code>string</code> - auth.redirectUrl The url to redirect.
1510
+ **Access**: public
1511
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1512
+
1513
+ | Param | Type | Default | Description |
1514
+ | --- | --- | --- | --- |
1515
+ | params | <code>object</code> | | Params to get task |
1516
+ | params.registerId | <code>string</code> | | The registerId that comes with the registration page context |
1517
+ | params.type | <code>string</code> | <code>&quot;sign&quot;</code> | The type of the registration. By defailt, |
1518
+ | params.login | <code>boolean</code> | <code>false</code> | If we want to login the user directly after registering the user successfully. If you have a redirect, the best option is to login automatically. |
1519
+ | params.emailInfo | <code>object</code> | | The information for the email validation |
1520
+ | params.emailInfo.email | <code>string</code> | | The email validation information |
1521
+ | params.emailInfo.code | <code>string</code> | | The 4 digit code to validate the email |
1522
+ | params.registerData | <code>object</code> | | The registration data |
1523
+ | params.registerData.name | <code>string</code> | | The name if the user |
1524
+ | params.registerData.registerEmail | <code>string</code> | | The email of the user |
1525
+ | params.registerData.phone | <code>string</code> | | The phone of the user |
1526
+ | params.registerData.idcard | <code>string</code> | | The ID card of the user |
1527
+ | params.registerData.registerPassword | <code>string</code> | | The user password in open text |
1528
+ | params.registerData.emailValidationCode | <code>string</code> | | The code used to validate the email |
1529
+ | params.registerData.phoneValidationCode | <code>string</code> | | The code used to validate the phone |
1530
+ | params.registerData.language | <code>string</code> | | The defaulf navigator language (i.e.: navigator.language) |
1531
+ | params.registerData.timezone | <code>string</code> | | The defaulf navigator timezone (i.e.: Intl.DateTimeFormat().resolvedOptions().timeZone) |
1532
+
1533
+ **Example**
1534
+ ```js
1535
+ const API = require('@docbrasil/api-systemmanager');
1536
+ const api = new API();
1537
+ const params ={
1538
+ "registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
1539
+ "type": 'sign',
1540
+ "login": false,
1541
+ "emailInfo": {
1542
+ "code": "5974",
1543
+ "email": "cbtoto_1@mailinator.com"
1544
+ },
1545
+ "registerData": {
1546
+ "name": "Augusto Totlo",
1547
+ "registerEmail": "cbtoto_1@mailinator.com",
1548
+ "phone": "",
1549
+ "idcard": "",
1550
+ "dob": "1978-01-12T03:00:00.000Z",
1551
+ "registerPassword": "123456",
1552
+ "emailValidationCode": "5974",
1553
+ "phoneValidationCode": "",
1554
+ "language": "en-US",
1555
+ "timezone": "Europe/Dublin"
1556
+ }
1557
+ };
1558
+ const retData = await api.user.register.execute(params);
1559
+ ```
1560
+ <a name="Register+getOrgname"></a>
1561
+
1562
+ ### register.getOrgname() ⇒ <code>string</code>
1563
+ **Kind**: instance method of [<code>Register</code>](#Register)
1564
+ **Returns**: <code>string</code> - orgname The orgname of the organization in the registerId
1565
+ **Access**: public
1566
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1567
+
1568
+ | Param | Type | Description |
1569
+ | --- | --- | --- |
1570
+ | params.registerId | <code>object</code> | The registerId that comes with the registration page context |
1571
+
1572
+ **Example**
1573
+ ```js
1574
+ const API = require('@docbrasil/api-systemmanager');
1575
+ const api = new API();
1576
+ const params = {
1577
+ registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
1578
+ };
1579
+ const orgname = await api.user.register.getOrgname(params);
1580
+ ```
1581
+ <a name="Register+validateEmail"></a>
1582
+
1583
+ ### register.validateEmail(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code>
1584
+ Method to find task by id
1585
+
1586
+ **Kind**: instance method of [<code>Register</code>](#Register)
1587
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>string</code> - data.registrationEmailInfoRaw The fully cryptographed registration information<code>object</code> - data.registrationEmailInfo The registration information<code>string</code> - data.registrationEmailInfo.orgname The orgname<code>string</code> - data.registrationEmailInfo.orgId The orgId of the organization<code>string</code> - data.registrationEmailInfo.guid The unique id for the registration<code>object</code> - data.registrationEmailInfo.emailValidation The email validation information<code>string</code> - data.registrationEmailInfo.emailValidation.email The email that the code was sent to<code>string</code> - data.registrationEmailInfo.emailValidation.code The 4 digit code to validate the email
1588
+ **Access**: public
1589
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1590
+
1591
+ | Param | Type | Description |
1592
+ | --- | --- | --- |
1593
+ | params | <code>object</code> | Params to get task |
1594
+ | params.registerId | <code>string</code> | The registerId that comes with the registration page context |
1595
+ | params.email | <code>object</code> | The email to validate |
1596
+
1597
+ **Example**
1598
+ ```js
1599
+ const API = require('@docbrasil/api-systemmanager');
1600
+ const api = new API();
1601
+ const params = {
1602
+ registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
1603
+ email: 'myemail@company.com'
1604
+ };
1605
+ const retData = await api.user.register.validateEmail(params);
1606
+ ```
1607
+ <a name="Register+execute"></a>
1608
+
1609
+ ### register.execute(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
1610
+ Method to register a user
1611
+
1612
+ **Kind**: instance method of [<code>Register</code>](#Register)
1613
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>object</code> - auth The full authentication data with session, if login is true.<code>string</code> - auth.redirectUrl The url to redirect.
1614
+ **Access**: public
1615
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1616
+
1617
+ | Param | Type | Default | Description |
1618
+ | --- | --- | --- | --- |
1619
+ | params | <code>object</code> | | Params to get task |
1620
+ | params.registerId | <code>string</code> | | The registerId that comes with the registration page context |
1621
+ | params.type | <code>string</code> | <code>&quot;sign&quot;</code> | The type of the registration. By defailt, |
1622
+ | params.login | <code>boolean</code> | <code>false</code> | If we want to login the user directly after registering the user successfully. If you have a redirect, the best option is to login automatically. |
1623
+ | params.emailInfo | <code>object</code> | | The information for the email validation |
1624
+ | params.emailInfo.email | <code>string</code> | | The email validation information |
1625
+ | params.emailInfo.code | <code>string</code> | | The 4 digit code to validate the email |
1626
+ | params.registerData | <code>object</code> | | The registration data |
1627
+ | params.registerData.name | <code>string</code> | | The name if the user |
1628
+ | params.registerData.registerEmail | <code>string</code> | | The email of the user |
1629
+ | params.registerData.phone | <code>string</code> | | The phone of the user |
1630
+ | params.registerData.idcard | <code>string</code> | | The ID card of the user |
1631
+ | params.registerData.registerPassword | <code>string</code> | | The user password in open text |
1632
+ | params.registerData.emailValidationCode | <code>string</code> | | The code used to validate the email |
1633
+ | params.registerData.phoneValidationCode | <code>string</code> | | The code used to validate the phone |
1634
+ | params.registerData.language | <code>string</code> | | The defaulf navigator language (i.e.: navigator.language) |
1635
+ | params.registerData.timezone | <code>string</code> | | The defaulf navigator timezone (i.e.: Intl.DateTimeFormat().resolvedOptions().timeZone) |
1636
+
1637
+ **Example**
1638
+ ```js
1639
+ const API = require('@docbrasil/api-systemmanager');
1640
+ const api = new API();
1641
+ const params ={
1642
+ "registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
1643
+ "type": 'sign',
1644
+ "login": false,
1645
+ "emailInfo": {
1646
+ "code": "5974",
1647
+ "email": "cbtoto_1@mailinator.com"
1648
+ },
1649
+ "registerData": {
1650
+ "name": "Augusto Totlo",
1651
+ "registerEmail": "cbtoto_1@mailinator.com",
1652
+ "phone": "",
1653
+ "idcard": "",
1654
+ "dob": "1978-01-12T03:00:00.000Z",
1655
+ "registerPassword": "123456",
1656
+ "emailValidationCode": "5974",
1657
+ "phoneValidationCode": "",
1658
+ "language": "en-US",
1659
+ "timezone": "Europe/Dublin"
1660
+ }
1661
+ };
1662
+ const retData = await api.user.register.execute(params);
1663
+ ```
1460
1664
  <a name="Organization"></a>
1461
1665
 
1462
1666
  ## Organization
@@ -1717,10 +1921,95 @@ Class for user registration in a user
1717
1921
  **Kind**: global class
1718
1922
 
1719
1923
  * [Register](#Register)
1924
+ * [.addToken(params)](#Register+addToken) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1925
+ * [.execute(params)](#Register+execute) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
1720
1926
  * [.getOrgname()](#Register+getOrgname) ⇒ <code>string</code>
1721
1927
  * [.validateEmail(params)](#Register+validateEmail) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code>
1722
1928
  * [.execute(params)](#Register+execute) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
1723
1929
 
1930
+ <a name="Register+addToken"></a>
1931
+
1932
+ ### register.addToken(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1933
+ Method to add a notification token
1934
+
1935
+ **Kind**: instance method of [<code>Register</code>](#Register)
1936
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>boolean</code> - data._id the id of the added token
1937
+ **Access**: public
1938
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1939
+
1940
+ | Param | Type | Description |
1941
+ | --- | --- | --- |
1942
+ | params | <code>object</code> | Params to add notification token |
1943
+ | params.token | <code>string</code> | The token |
1944
+ | params.type | <code>object</code> | The token type |
1945
+
1946
+ **Example**
1947
+ ```js
1948
+ const API = require('@docbrasil/api-systemmanager');
1949
+ const api = new API();
1950
+ const params = {
1951
+ token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
1952
+ type: 'FCM_WEB'
1953
+ };
1954
+ const retData = await api.user.notification.addToken(params);
1955
+ ```
1956
+ <a name="Register+execute"></a>
1957
+
1958
+ ### register.execute(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
1959
+ Method to register a user
1960
+
1961
+ **Kind**: instance method of [<code>Register</code>](#Register)
1962
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>object</code> - auth The full authentication data with session, if login is true.<code>string</code> - auth.redirectUrl The url to redirect.
1963
+ **Access**: public
1964
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1965
+
1966
+ | Param | Type | Default | Description |
1967
+ | --- | --- | --- | --- |
1968
+ | params | <code>object</code> | | Params to get task |
1969
+ | params.registerId | <code>string</code> | | The registerId that comes with the registration page context |
1970
+ | params.type | <code>string</code> | <code>&quot;sign&quot;</code> | The type of the registration. By defailt, |
1971
+ | params.login | <code>boolean</code> | <code>false</code> | If we want to login the user directly after registering the user successfully. If you have a redirect, the best option is to login automatically. |
1972
+ | params.emailInfo | <code>object</code> | | The information for the email validation |
1973
+ | params.emailInfo.email | <code>string</code> | | The email validation information |
1974
+ | params.emailInfo.code | <code>string</code> | | The 4 digit code to validate the email |
1975
+ | params.registerData | <code>object</code> | | The registration data |
1976
+ | params.registerData.name | <code>string</code> | | The name if the user |
1977
+ | params.registerData.registerEmail | <code>string</code> | | The email of the user |
1978
+ | params.registerData.phone | <code>string</code> | | The phone of the user |
1979
+ | params.registerData.idcard | <code>string</code> | | The ID card of the user |
1980
+ | params.registerData.registerPassword | <code>string</code> | | The user password in open text |
1981
+ | params.registerData.emailValidationCode | <code>string</code> | | The code used to validate the email |
1982
+ | params.registerData.phoneValidationCode | <code>string</code> | | The code used to validate the phone |
1983
+ | params.registerData.language | <code>string</code> | | The defaulf navigator language (i.e.: navigator.language) |
1984
+ | params.registerData.timezone | <code>string</code> | | The defaulf navigator timezone (i.e.: Intl.DateTimeFormat().resolvedOptions().timeZone) |
1985
+
1986
+ **Example**
1987
+ ```js
1988
+ const API = require('@docbrasil/api-systemmanager');
1989
+ const api = new API();
1990
+ const params ={
1991
+ "registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
1992
+ "type": 'sign',
1993
+ "login": false,
1994
+ "emailInfo": {
1995
+ "code": "5974",
1996
+ "email": "cbtoto_1@mailinator.com"
1997
+ },
1998
+ "registerData": {
1999
+ "name": "Augusto Totlo",
2000
+ "registerEmail": "cbtoto_1@mailinator.com",
2001
+ "phone": "",
2002
+ "idcard": "",
2003
+ "dob": "1978-01-12T03:00:00.000Z",
2004
+ "registerPassword": "123456",
2005
+ "emailValidationCode": "5974",
2006
+ "phoneValidationCode": "",
2007
+ "language": "en-US",
2008
+ "timezone": "Europe/Dublin"
2009
+ }
2010
+ };
2011
+ const retData = await api.user.register.execute(params);
2012
+ ```
1724
2013
  <a name="Register+getOrgname"></a>
1725
2014
 
1726
2015
  ### register.getOrgname() ⇒ <code>string</code>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docbrasil/api-systemmanager",
3
3
  "description": "Module API System Manager",
4
- "version": "1.0.65",
4
+ "version": "1.0.66",
5
5
  "scripts": {
6
6
  "doc": "rm -f doc/api.md && jsdoc2md api/**/** > doc/api.md",
7
7
  "build": "node bundleRollup.js"