auth0 3.2.0 → 3.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## [v3.3.0](https://github.com/auth0/node-auth0/tree/v3.3.0) (2023-03-14)
4
+
5
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.2.0...v3.3.0)
6
+
7
+ **Added**
8
+
9
+ - [SDK-4013] Add API2 Factor Management Endpoints [\#791](https://github.com/auth0/node-auth0/pull/791) ([adamjmcgrath](https://github.com/adamjmcgrath))
10
+ - ESM support [\#784](https://github.com/auth0/node-auth0/pull/784) ([btakita](https://github.com/btakita))
11
+
3
12
  ## [v3.2.0](https://github.com/auth0/node-auth0/tree/v3.2.0) (2023-02-09)
4
13
 
5
14
  [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.1.2...v3.2.0)
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "auth0",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "SDK for Auth0 API v2",
5
5
  "main": "src/index.js",
6
+ "module": "src/index.mjs",
6
7
  "sideEffects": false,
7
8
  "files": [
8
9
  "src"
package/src/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ /**
4
+ * Simple facade for consuming a REST API endpoint.
5
+ *
6
+ * @external RestClient
7
+ * {@link https://github.com/ngonzalvez/rest-facade}
8
+ */
9
+ export const ManagementClient = require('./management');
10
+ export const AuthenticationClient = require('./auth');
11
+ export default { ManagementClient, AuthenticationClient }
@@ -72,10 +72,15 @@ class ConnectionsManager extends BaseManager {
72
72
  * management.connections.getAll(params, function (err, connections) {
73
73
  * console.log(connections.length);
74
74
  * });
75
- * @param {object} [params] Connections params.
76
- * @param {number} [params.per_page] Number of results per page.
77
- * @param {number} [params.page] Page number, zero indexed.
78
- * @param {Function} [cb] Callback function.
75
+ * @param {object} [params] Connections params.
76
+ * @param {number} [params.per_page] Number of results per page.
77
+ * @param {number} [params.page] Page number, zero indexed.
78
+ * @param {string[]} [params.fields] List of fields to include or exclude
79
+ * @param {boolean} [params.include_fields] true if the fields specified are to be included in the result, false otherwise. Default true
80
+ * @param {boolean} [params.include_totals] true if a query summary must be included in the result, false otherwise. Default false
81
+ * @param {string} [params.strategy] Provide strategies to only retrieve connections with such strategies
82
+ * @param {string} [params.name] Provide the name of the connection to retrieve
83
+ * @param {Function} [cb] Callback function.
79
84
  * @returns {Promise|undefined}
80
85
  */
81
86
  getAll(...args) {
@@ -93,6 +93,10 @@ class UsersManager extends BaseManager {
93
93
  this.authenticators = this._getRestClient('/users/:id/authenticators');
94
94
 
95
95
  this.organizations = this._getRestClient('/users/:id/organizations');
96
+
97
+ this.authenticationMethods = this._getRestClient(
98
+ '/users/:id/authentication-methods/:authentication_method_id'
99
+ );
96
100
  }
97
101
 
98
102
  /**
@@ -782,6 +786,97 @@ class UsersManager extends BaseManager {
782
786
  getUserOrganizations(...args) {
783
787
  return this.organizations.getAll(...args);
784
788
  }
789
+
790
+ /**
791
+ * Gets a list of authentication methods.
792
+ *
793
+ * @param {object} params The user data object.
794
+ * @param {string} params.id The user id.
795
+ * @param {Function} [cb] Callback function.
796
+ * @returns {Promise|undefined}
797
+ */
798
+ getAuthenticationMethods(...args) {
799
+ return this.authenticationMethods.getAll(...args);
800
+ }
801
+
802
+ /**
803
+ * Gets an authentication method by ID.
804
+ *
805
+ * @param {object} params The user data object.
806
+ * @param {string} params.id The user id.
807
+ * @param {string} params.authentication_method_id The authentication method id.
808
+ * @param {Function} [cb] Callback function.
809
+ * @returns {Promise|undefined}
810
+ */
811
+ getAuthenticationMethodById(...args) {
812
+ return this.authenticationMethods.get(...args);
813
+ }
814
+
815
+ /**
816
+ * Creates an authentication method for a given user.
817
+ *
818
+ * @param {object} params The user data object.
819
+ * @param {string} params.id The user id.
820
+ * @param {object} data Authentication method data.
821
+ * @param {Function} [cb] Callback function.
822
+ * @returns {Promise|undefined}
823
+ */
824
+ createAuthenticationMethod(...args) {
825
+ return this.authenticationMethods.create(...args);
826
+ }
827
+
828
+ /**
829
+ * Updates all authentication methods for a user by replacing them with the given ones.
830
+ *
831
+ * @param {object} params The user data object.
832
+ * @param {string} params.id The user id.
833
+ * @param {object} data Updated authentication method data.
834
+ * @param {Function} [cb] Callback function.
835
+ * @returns {Promise|undefined}
836
+ */
837
+ updateAuthenticationMethods(...args) {
838
+ return this.authenticationMethods.update(...args);
839
+ }
840
+
841
+ /**
842
+ * Updates an authentication method.
843
+ *
844
+ * @param {object} params The user data object.
845
+ * @param {string} params.id The user id.
846
+ * @param {string} params.authentication_method_id The authentication method id.
847
+ * @param {object} data Updated authentication method data.
848
+ * @param {Function} [cb] Callback function.
849
+ * @returns {Promise|undefined}
850
+ */
851
+ updateAuthenticationMethodById(...args) {
852
+ return this.authenticationMethods.patch(...args);
853
+ }
854
+
855
+ /**
856
+ * Deletes all authentication methods for the given user.
857
+ *
858
+ * @param {object} params The user data object.
859
+ * @param {string} params.id The user id.
860
+ * @param {Function} [cb] Callback function.
861
+ * @returns {Promise|undefined}
862
+ */
863
+ deleteAuthenticationMethods(...args) {
864
+ return this.authenticationMethods.delete(...args);
865
+ }
866
+
867
+ /**
868
+ * Deletes an authentication method by ID.
869
+ *
870
+ * @param {object} params The user data object.
871
+ * @param {string} params.id The user id.
872
+ * @param {string} params.authentication_method_id The authentication method id.
873
+ * @param {object} data Updated authentication method data.
874
+ * @param {Function} [cb] Callback function.
875
+ * @returns {Promise|undefined}
876
+ */
877
+ deleteAuthenticationMethodById(...args) {
878
+ return this.authenticationMethods.delete(...args);
879
+ }
785
880
  }
786
881
 
787
882
  module.exports = UsersManager;
@@ -92,8 +92,8 @@ class ManagementClient {
92
92
  /**
93
93
  * @param {object} options Options for the ManagementClient SDK.
94
94
  * If a token is provided only the domain is required, other parameters are ignored.
95
- * If no token is provided domain, clientId, clientSecret (or clientAssertionSigningKey)
96
- * and scopes are required
95
+ * If no token is provided domain, clientId and clientSecret (or clientAssertionSigningKey)
96
+ * are required.
97
97
  * @param {string} options.domain ManagementClient server domain.
98
98
  * @param {string} [options.token] API access token.
99
99
  * @param {string} [options.clientId] Management API Non Interactive Client Id.