diff --git a/.gitignore b/.gitignore index 45e3f7801..14359e600 100644 --- a/.gitignore +++ b/.gitignore @@ -42,9 +42,6 @@ out/ test-results.xml .nyc_output -# Release process -.release -.release-tmp-*/ # npm package-lock.json \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..d3a1239d0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +docs/* \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ea7da1e..b516a2486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,27 @@ # Change Log +## [v2.18.0](https://github.com/auth0/node-auth0/tree/v2.18.1) (2019-07-23) + +**Changed** + +- Encode id param on GET [\#374](https://github.com/auth0/node-auth0/pull/374) ([luisrudge](https://github.com/luisrudge)) + +[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.18.0...v2.18.1) + ## [v2.18.0](https://github.com/auth0/node-auth0/tree/v2.18.0) (2019-06-26) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.17.1...v2.18.0) **Added** + - Add Management API support for Branding and Prompts endpoints. [\#370](https://github.com/auth0/node-auth0/pull/370) ([chrisscott](https://github.com/chrisscott)) ## [v2.17.1](https://github.com/auth0/node-auth0/tree/v2.17.1) (2019-05-22) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.17.0...v2.17.1) **Fixed** + - Fix telemetry header [\#362](https://github.com/auth0/node-auth0/pull/362) ([lbalmaceda](https://github.com/lbalmaceda)) ## [v2.17.0](https://github.com/auth0/node-auth0/tree/v2.17.0) (2019-04-15) @@ -18,8 +30,8 @@ **Added** -* Add method to assign users to a role [\#348](https://github.com/auth0/node-auth0/pull/348) ([pushpabrol](https://github.com/pushpabrol)) -* Add support for roles and permissions [\#344](https://github.com/auth0/node-auth0/pull/344) ([pushpabrol](https://github.com/pushpabrol)) +- Add method to assign users to a role [\#348](https://github.com/auth0/node-auth0/pull/348) ([pushpabrol](https://github.com/pushpabrol)) +- Add support for roles and permissions [\#344](https://github.com/auth0/node-auth0/pull/344) ([pushpabrol](https://github.com/pushpabrol)) ## [v2.16.0](https://github.com/auth0/node-auth0/tree/v2.16.0) (2019-03-18) @@ -27,7 +39,7 @@ **Added** -* Add support for Auth0 Grants [\#343](https://github.com/auth0/node-auth0/pull/343) ([jsmpereira](https://github.com/jsmpereira)) +- Add support for Auth0 Grants [\#343](https://github.com/auth0/node-auth0/pull/343) ([jsmpereira](https://github.com/jsmpereira)) ## [v2.15.0](https://github.com/auth0/node-auth0/tree/v2.15.0) (2019-03-11) @@ -35,11 +47,11 @@ **Added** -* Add users-exports endpoint [\#340](https://github.com/auth0/node-auth0/pull/340) ([arjenvanderende](https://github.com/arjenvanderende)) +- Add users-exports endpoint [\#340](https://github.com/auth0/node-auth0/pull/340) ([arjenvanderende](https://github.com/arjenvanderende)) **Fixed** -* Don't validate id_token when alg is HS256 and there is no clientSecret [\#330](https://github.com/auth0/node-auth0/pull/330) ([luisrudge](https://github.com/luisrudge)) +- Don't validate id_token when alg is HS256 and there is no clientSecret [\#330](https://github.com/auth0/node-auth0/pull/330) ([luisrudge](https://github.com/luisrudge)) ## [v2.14.0](https://github.com/auth0/node-auth0/tree/v2.14.0) (2018-11-12) @@ -47,14 +59,14 @@ **Added** -* Add method to refresh a token using a refresh_token [\#313](https://github.com/auth0/node-auth0/pull/313) ([modeswitch](https://github.com/modeswitch)) -* Add all Guardian APIs [\#311](https://github.com/auth0/node-auth0/pull/311) ([stevezau](https://github.com/stevezau)) -* Add Custom Domains methods [\#310](https://github.com/auth0/node-auth0/pull/310) ([stevezau](https://github.com/stevezau)) -* Add send_completion_email and upsert params for importUsers [\#270](https://github.com/auth0/node-auth0/pull/270) ([Floppy](https://github.com/Floppy)) +- Add method to refresh a token using a refresh_token [\#313](https://github.com/auth0/node-auth0/pull/313) ([modeswitch](https://github.com/modeswitch)) +- Add all Guardian APIs [\#311](https://github.com/auth0/node-auth0/pull/311) ([stevezau](https://github.com/stevezau)) +- Add Custom Domains methods [\#310](https://github.com/auth0/node-auth0/pull/310) ([stevezau](https://github.com/stevezau)) +- Add send_completion_email and upsert params for importUsers [\#270](https://github.com/auth0/node-auth0/pull/270) ([Floppy](https://github.com/Floppy)) **Deprecated** -* Deprecate UsersManager.deleteAll and deleteAllUsers wrapper methods [\#309](https://github.com/auth0/node-auth0/pull/309) ([M-Zuber](https://github.com/M-Zuber)) +- Deprecate UsersManager.deleteAll and deleteAllUsers wrapper methods [\#309](https://github.com/auth0/node-auth0/pull/309) ([M-Zuber](https://github.com/M-Zuber)) ## [v2.13.0](https://github.com/auth0/node-auth0/tree/v2.13.0) (2018-09-28) @@ -62,7 +74,7 @@ **Added** -* Add id_token validation (HS256 and RS256) [\#295](https://github.com/auth0/node-auth0/pull/295) ([luisrudge](https://github.com/luisrudge)) +- Add id_token validation (HS256 and RS256) [\#295](https://github.com/auth0/node-auth0/pull/295) ([luisrudge](https://github.com/luisrudge)) ## [v2.12.0](https://github.com/auth0/node-auth0/tree/v2.12.0) (2018-08-09) @@ -70,8 +82,8 @@ **Added** -* Added authorizationCodeGrant method to OAuthAuthenticator [\#290](https://github.com/auth0/node-auth0/pull/290) ([cwurtz](https://github.com/cwurtz)) -* Add Guardian Enrollments endpoints [\#278](https://github.com/auth0/node-auth0/pull/278) ([fmedinac](https://github.com/fmedinac)) +- Added authorizationCodeGrant method to OAuthAuthenticator [\#290](https://github.com/auth0/node-auth0/pull/290) ([cwurtz](https://github.com/cwurtz)) +- Add Guardian Enrollments endpoints [\#278](https://github.com/auth0/node-auth0/pull/278) ([fmedinac](https://github.com/fmedinac)) ## [v2.11.0](https://github.com/auth0/node-auth0/tree/v2.11.0) (2018-07-25) @@ -79,12 +91,12 @@ **Added** -* Added Pagination Docs for a Client Grants, Resouce Servers and Rules [\#282](https://github.com/auth0/node-auth0/pull/282) ([cocojoe](https://github.com/cocojoe)) -* Added rules config methods [\#227](https://github.com/auth0/node-auth0/pull/227) ([dctoon](https://github.com/dctoon)) +- Added Pagination Docs for a Client Grants, Resouce Servers and Rules [\#282](https://github.com/auth0/node-auth0/pull/282) ([cocojoe](https://github.com/cocojoe)) +- Added rules config methods [\#227](https://github.com/auth0/node-auth0/pull/227) ([dctoon](https://github.com/dctoon)) **Fixed** -* Get access token before importing users [\#267](https://github.com/auth0/node-auth0/pull/267) ([Floppy](https://github.com/Floppy)) +- Get access token before importing users [\#267](https://github.com/auth0/node-auth0/pull/267) ([Floppy](https://github.com/Floppy)) ## [v2.10.0](https://github.com/auth0/node-auth0/tree/v2.10.0) (2018-05-29) @@ -92,11 +104,11 @@ **Added** -* Adding pagination docs for clients/connections [\#268](https://github.com/auth0/node-auth0/pull/268) ([luisrudge](https://github.com/luisrudge)) +- Adding pagination docs for clients/connections [\#268](https://github.com/auth0/node-auth0/pull/268) ([luisrudge](https://github.com/luisrudge)) **Fixed** -* Fix deleteUserMultifactor naming [\#259](https://github.com/auth0/node-auth0/pull/259) ([luisrudge](https://github.com/luisrudge)) +- Fix deleteUserMultifactor naming [\#259](https://github.com/auth0/node-auth0/pull/259) ([luisrudge](https://github.com/luisrudge)) ## [v2.9.3](https://github.com/auth0/node-auth0/tree/v2.9.3) (2018-03-01) @@ -104,7 +116,7 @@ **Fixed** -* Add client secret to passwordGrant [\#217](https://github.com/auth0/node-auth0/pull/217) ([luisrudge](https://github.com/luisrudge)) +- Add client secret to passwordGrant [\#217](https://github.com/auth0/node-auth0/pull/217) ([luisrudge](https://github.com/luisrudge)) ## [v2.9.2](https://github.com/auth0/node-auth0/tree/v2.9.2) (2018-01-16) @@ -112,7 +124,7 @@ **Security** -* Update rest facade [\#232](https://github.com/auth0/node-auth0/pull/232) ([luisrudge](https://github.com/luisrudge)) +- Update rest facade [\#232](https://github.com/auth0/node-auth0/pull/232) ([luisrudge](https://github.com/luisrudge)) ## [v2.9.1](https://github.com/auth0/node-auth0/tree/v2.9.1) (2017-12-08) @@ -120,7 +132,7 @@ **Fixed** -* fixed missing data object error [\#224](https://github.com/auth0/node-auth0/pull/224) ([dctoon](https://github.com/dctoon)) +- fixed missing data object error [\#224](https://github.com/auth0/node-auth0/pull/224) ([dctoon](https://github.com/dctoon)) ## [v2.9.0](https://github.com/auth0/node-auth0/tree/v2.9.0) (2017-12-07) @@ -128,8 +140,8 @@ **Added** -* Added support for /users-by-email method. [\#218](https://github.com/auth0/node-auth0/pull/218) ([kopertop](https://github.com/kopertop)) -* Add retry functionality for management api requests [\#215](https://github.com/auth0/node-auth0/pull/215) ([dctoon](https://github.com/dctoon)) +- Added support for /users-by-email method. [\#218](https://github.com/auth0/node-auth0/pull/218) ([kopertop](https://github.com/kopertop)) +- Add retry functionality for management api requests [\#215](https://github.com/auth0/node-auth0/pull/215) ([dctoon](https://github.com/dctoon)) ## [v2.8.0](https://github.com/auth0/node-auth0/tree/v2.8.0) (2017-09-30) @@ -137,11 +149,11 @@ **Added** -* Added tokenProvider functionality [\#196](https://github.com/auth0/node-auth0/pull/196) ([dctoon](https://github.com/dctoon)) +- Added tokenProvider functionality [\#196](https://github.com/auth0/node-auth0/pull/196) ([dctoon](https://github.com/dctoon)) **Fixed** -* Fix wrapPropertyMethod mistake for updateClientGrant [\#202](https://github.com/auth0/node-auth0/pull/202) ([danedmunds](https://github.com/danedmunds)) +- Fix wrapPropertyMethod mistake for updateClientGrant [\#202](https://github.com/auth0/node-auth0/pull/202) ([danedmunds](https://github.com/danedmunds)) ## [v2.7.1](https://github.com/auth0/node-auth0/tree/v2.7.1) (2017-09-30) @@ -149,11 +161,11 @@ **Fixed** -* Fix auth/users.getInfo to return JSON (fixes #158) [\#192](https://github.com/auth0/node-auth0/pull/192) ([pilwon](https://github.com/pilwon)) +- Fix auth/users.getInfo to return JSON (fixes #158) [\#192](https://github.com/auth0/node-auth0/pull/192) ([pilwon](https://github.com/pilwon)) **Security** -* Update request to address ReDoS vulnerability [\#206](https://github.com/auth0/node-auth0/pull/206) ([dancrumb](https://github.com/dancrumb)) +- Update request to address ReDoS vulnerability [\#206](https://github.com/auth0/node-auth0/pull/206) ([dancrumb](https://github.com/dancrumb)) ## [v2.7.0](https://github.com/auth0/node-auth0/tree/v2.7.0) (2017-06-28) @@ -161,16 +173,16 @@ **Added** -* Add password grant method [\#189](https://github.com/auth0/node-auth0/pull/189) ([hzalaz](https://github.com/hzalaz)) -* Retrieve a user's Guardian enrollments [\#181](https://github.com/auth0/node-auth0/pull/181) ([joshuaali](https://github.com/joshuaali)) -* Add get user logs [\#176](https://github.com/auth0/node-auth0/pull/176) ([amiram](https://github.com/amiram)) +- Add password grant method [\#189](https://github.com/auth0/node-auth0/pull/189) ([hzalaz](https://github.com/hzalaz)) +- Retrieve a user's Guardian enrollments [\#181](https://github.com/auth0/node-auth0/pull/181) ([joshuaali](https://github.com/joshuaali)) +- Add get user logs [\#176](https://github.com/auth0/node-auth0/pull/176) ([amiram](https://github.com/amiram)) **Changed** -* Update packages and utilize error classes from rest-facade correctly (Fixes #154) [\#183](https://github.com/auth0/node-auth0/pull/183) ([charsleysa](https://github.com/charsleysa)) +- Update packages and utilize error classes from rest-facade correctly (Fixes #154) [\#183](https://github.com/auth0/node-auth0/pull/183) ([charsleysa](https://github.com/charsleysa)) **Fixed** -* Fix impersonation to send AT in the params. [\#190](https://github.com/auth0/node-auth0/pull/190) ([hzalaz](https://github.com/hzalaz)) -* Fixed minor typo in DatabaseAuthenticator module [\#184](https://github.com/auth0/node-auth0/pull/184) ([scostello-paanalytics](https://github.com/scostello-paanalytics)) -* fix: avoid possible prototype override protection bypass [\#170](https://github.com/auth0/node-auth0/pull/170) ([AlmaasAre](https://github.com/AlmaasAre)) +- Fix impersonation to send AT in the params. [\#190](https://github.com/auth0/node-auth0/pull/190) ([hzalaz](https://github.com/hzalaz)) +- Fixed minor typo in DatabaseAuthenticator module [\#184](https://github.com/auth0/node-auth0/pull/184) ([scostello-paanalytics](https://github.com/scostello-paanalytics)) +- fix: avoid possible prototype override protection bypass [\#170](https://github.com/auth0/node-auth0/pull/170) ([AlmaasAre](https://github.com/AlmaasAre)) diff --git a/docs/RetryRestClient.js.html b/docs/RetryRestClient.js.html index c43d6fb9a..cd6b0f27c 100644 --- a/docs/RetryRestClient.js.html +++ b/docs/RetryRestClient.js.html @@ -24,7 +24,7 @@
@@ -207,7 +207,7 @@

RetryRestClient.js


diff --git a/docs/auth_DatabaseAuthenticator.js.html b/docs/auth_DatabaseAuthenticator.js.html index 22a2acf2c..f85767a4b 100644 --- a/docs/auth_DatabaseAuthenticator.js.html +++ b/docs/auth_DatabaseAuthenticator.js.html @@ -24,7 +24,7 @@
@@ -346,7 +346,7 @@

auth/DatabaseAuthenticator.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/auth_OAUthWithIDTokenValidation.js.html b/docs/auth_OAUthWithIDTokenValidation.js.html index 6d77aca07..5b3500446 100644 --- a/docs/auth_OAUthWithIDTokenValidation.js.html +++ b/docs/auth_OAUthWithIDTokenValidation.js.html @@ -24,7 +24,7 @@
@@ -54,12 +54,13 @@

auth/OAUthWithIDTokenValidation.js

* @constructor * @memberOf module:auth * - * @param {Object} oauth An instance of @type {OAuthAuthenticator} - * @param {Object} options Authenticator options. - * @param {String} options.domain AuthenticationClient server domain - * @param {String} [options.clientId] Default client ID. - * @param {String} [options.clientSecret] Default client Secret. - * @param {String} [options.supportedAlgorithms] Algorithms that your application expects to receive + * @param {Object} oauth An instance of @type {OAuthAuthenticator} + * @param {Object} options Authenticator options. + * @param {String} options.domain AuthenticationClient server domain + * @param {String} [options.clientId] Default client ID. + * @param {String} [options.clientSecret] Default client Secret. + * @param {String} [options.supportedAlgorithms] Algorithms that your application expects to receive + * @param {Boolean} [options.__bypassIdTokenValidation] Whether the id_token should be validated or not */ var OAUthWithIDTokenValidation = function(oauth, options) { if (!oauth) { @@ -75,6 +76,7 @@

auth/OAUthWithIDTokenValidation.js

} this.oauth = oauth; + this.__bypassIdTokenValidation = options.__bypassIdTokenValidation; this.clientId = options.clientId; this.clientSecret = options.clientSecret; this.domain = options.domain; @@ -97,8 +99,11 @@

auth/OAUthWithIDTokenValidation.js

* @return {Promise|undefined} */ OAUthWithIDTokenValidation.prototype.create = function(params, data, cb) { + const _this = this; const createAndValidate = this.oauth.create(params, data).then(r => { - var _this = this; + if (_this.__bypassIdTokenValidation) { + return r; + } if (r.id_token) { function getKey(header, callback) { if (header.alg === 'HS256') { @@ -158,7 +163,7 @@

auth/OAUthWithIDTokenValidation.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/auth_OAuthAuthenticator.js.html b/docs/auth_OAuthAuthenticator.js.html index 9abb044eb..20b0f329e 100644 --- a/docs/auth_OAuthAuthenticator.js.html +++ b/docs/auth_OAuthAuthenticator.js.html @@ -24,7 +24,7 @@
@@ -53,11 +53,12 @@

auth/OAuthAuthenticator.js

* @constructor * @memberOf module:auth * - * @param {Object} options Authenticator options. - * @param {String} options.baseUrl The Auth0 account URL. - * @param {String} options.domain AuthenticationClient server domain - * @param {String} [options.clientId] Default client ID. - * @param {String} [options.clientSecret] Default client Secret. + * @param {Object} options Authenticator options. + * @param {String} options.baseUrl The Auth0 account URL. + * @param {String} options.domain AuthenticationClient server domain + * @param {String} [options.clientId] Default client ID. + * @param {String} [options.clientSecret] Default client Secret. + * @param {Boolean} [options.__bypassIdTokenValidation] Whether the id_token should be validated or not */ var OAuthAuthenticator = function(options) { if (!options) { @@ -425,7 +426,7 @@

auth/OAuthAuthenticator.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/auth_PasswordlessAuthenticator.js.html b/docs/auth_PasswordlessAuthenticator.js.html index c778da948..c3f705836 100644 --- a/docs/auth_PasswordlessAuthenticator.js.html +++ b/docs/auth_PasswordlessAuthenticator.js.html @@ -24,7 +24,7 @@
@@ -287,7 +287,7 @@

auth/PasswordlessAuthenticator.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/auth_TokensManager.js.html b/docs/auth_TokensManager.js.html index 4e047cb47..d6a89de34 100644 --- a/docs/auth_TokensManager.js.html +++ b/docs/auth_TokensManager.js.html @@ -24,7 +24,7 @@
@@ -226,7 +226,7 @@

auth/TokensManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/auth_UsersManager.js.html b/docs/auth_UsersManager.js.html index 734fce040..a7b6f94c3 100644 --- a/docs/auth_UsersManager.js.html +++ b/docs/auth_UsersManager.js.html @@ -24,7 +24,7 @@
@@ -224,7 +224,7 @@

auth/UsersManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/auth_index.js.html b/docs/auth_index.js.html index b15bc3fa3..f17d32b31 100644 --- a/docs/auth_index.js.html +++ b/docs/auth_index.js.html @@ -24,7 +24,7 @@
@@ -78,11 +78,12 @@

auth/index.js

* clientId: '{OPTIONAL_CLIENT_ID}' * }); * - * @param {Object} options Options for the Authentication Client SDK. - * @param {String} options.domain AuthenticationClient server domain. - * @param {String} [options.clientId] Default client ID. - * @param {String} [options.clientSecret] Default client Secret. - * @param {String} [options.supportedAlgorithms] Algorithms that your application expects to receive + * @param {Object} options Options for the Authentication Client SDK. + * @param {String} options.domain AuthenticationClient server domain. + * @param {String} [options.clientId] Default client ID. + * @param {String} [options.clientSecret] Default client Secret. + * @param {String} [options.supportedAlgorithms] Algorithms that your application expects to receive + * @param {Boolean} [options.__bypassIdTokenValidation] Whether the id_token should be validated or not */ var AuthenticationClient = function(options) { if (!options || typeof options !== 'object') { @@ -102,7 +103,8 @@

auth/index.js

'Content-Type': 'application/json' }, baseUrl: util.format(BASE_URL_FORMAT, options.domain), - supportedAlgorithms: options.supportedAlgorithms + supportedAlgorithms: options.supportedAlgorithms, + __bypassIdTokenValidation: options.__bypassIdTokenValidation }; if (options.telemetry !== false) { @@ -601,7 +603,7 @@

auth/index.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/external-RestClient.html b/docs/external-RestClient.html index 39e3595d4..c0ac8e66f 100644 --- a/docs/external-RestClient.html +++ b/docs/external-RestClient.html @@ -24,7 +24,7 @@
@@ -87,7 +87,7 @@

Source:
@@ -187,7 +187,7 @@

Source:
@@ -287,7 +287,7 @@

Source:
@@ -387,7 +387,7 @@

Source:
@@ -487,7 +487,7 @@

Source:
@@ -587,7 +587,7 @@

Source:
@@ -687,7 +687,7 @@

Source:
@@ -787,7 +787,7 @@

Source:
@@ -887,7 +887,7 @@

Source:
@@ -987,7 +987,7 @@

Source:
@@ -1087,7 +1087,7 @@

Source:
@@ -1187,7 +1187,7 @@

Source:
@@ -1287,7 +1287,7 @@

Source:
@@ -1387,7 +1387,7 @@

Source:
@@ -1487,7 +1487,7 @@

Source:
@@ -1539,7 +1539,7 @@


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/fonts/OpenSans-Semibold-webfont.eot b/docs/fonts/OpenSans-Semibold-webfont.eot old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-Semibold-webfont.svg b/docs/fonts/OpenSans-Semibold-webfont.svg old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-Semibold-webfont.ttf b/docs/fonts/OpenSans-Semibold-webfont.ttf old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-Semibold-webfont.woff b/docs/fonts/OpenSans-Semibold-webfont.woff old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.eot b/docs/fonts/OpenSans-SemiboldItalic-webfont.eot old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.svg b/docs/fonts/OpenSans-SemiboldItalic-webfont.svg old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf b/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.woff b/docs/fonts/OpenSans-SemiboldItalic-webfont.woff old mode 100644 new mode 100755 diff --git a/docs/index.html b/docs/index.html index 16805a181..e3322adc6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,7 +24,7 @@
@@ -48,29 +48,40 @@
-

node-auth0

Build Status +

node-auth0

+

Build Status NPM version Coverage License Downloads

Node.js client library for the Auth0 platform.

-

Installation

  npm install auth0

Documentation

You can find this library documentation in this page.

+

Installation

+
  npm install auth0
+
+

Documentation

+

You can find this library documentation in this page.

For more information about auth0 check our documentation page.

-

Authentication API Client

This client must be used to access Auth0's Authentication API.

+

Authentication API Client

+

This client must be used to access Auth0's Authentication API.

The AuthenticationClient constructor takes an optional client ID, if specified it will be used as default value for all endpoints that accept a client ID.

var AuthenticationClient = require('auth0').AuthenticationClient;
 
 var auth0 = new AuthenticationClient({
   domain: '{YOUR_ACCOUNT}.auth0.com',
   clientId: '{OPTIONAL_CLIENT_ID}'
-});

Management API Client

The Auth0 Management API is meant to be used by back-end servers or trusted parties performing administrative tasks. Generally speaking, anything that can be done through the Auth0 dashboard (and more) can also be done through this API.

+}); + +

Management API Client

+

The Auth0 Management API is meant to be used by back-end servers or trusted parties performing administrative tasks. Generally speaking, anything that can be done through the Auth0 dashboard (and more) can also be done through this API.

Initialize your client class with an API v2 token and a domain.

var ManagementClient = require('auth0').ManagementClient;
 
 var management = new ManagementClient({
   token: '{YOUR_API_V2_TOKEN}',
   domain: '{YOUR_ACCOUNT}.auth0.com'
-});
+}); + +

Note: When using at browser you should use telemetry: false.

To obtain automatically a Management API token via the ManagementClient, you can specify the parameters clientId, clientSecret (use a Non Interactive Client) and optionally scope. @@ -81,7 +92,9 @@

Authentication API Client

This client must be used to access Auth0's clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}', clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}', scope: 'read:users update:users' -});

+}); + +

Make sure your ClientId is allowed to request tokens from Management API in Auth0 Dashboard

To obtain a Management API token from your node backend, you can use Client Credentials Grant using your registered Auth0 Non Interactive Clients

@@ -104,8 +117,11 @@

Authentication API Client

This client must be used to access Auth0's } console.log(response.access_token); } -);

Also you can request a token when the user authenticates using any of our client side SDKs, e.g. auth0.js.

-

Promises and callbacks

Be aware that all methods can be used with promises or callbacks. However, when a callback is provided no promise will be returned.

+); + +

Also you can request a token when the user authenticates using any of our client side SDKs, e.g. auth0.js.

+

Promises and callbacks

+

Be aware that all methods can be used with promises or callbacks. However, when a callback is provided no promise will be returned.

// Using callbacks.
 management.getUsers(function(err, users) {
   if (err) {
@@ -122,7 +138,10 @@ 

Promises and callbacks

Be aware that all methods can be used with pro }) .catch(function(err) { // Handle error. - });

What is Auth0?

Auth0 helps you to:

+ }); + +

What is Auth0?

+

Auth0 helps you to:

  • Add authentication with multiple authentication sources, either social like Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others, or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider.
  • Add authentication through more traditional username/password databases.
  • @@ -131,13 +150,17 @@

    Promises and callbacks

    Be aware that all methods can be used with pro

  • Analytics of how, when and where users are logging in.
  • Pull data from other sources and add it to the user profile, through JavaScript rules.
-

Create a free Auth0 Account

    +

    Create a free Auth0 Account

    +
    1. Go to Auth0 and click "Try Auth0 for Free".
    2. Use Google, GitHub or Microsoft Account to login.
    -

    Issue Reporting

    If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

    -

    Author

    Auth0

    -

    License

    This project is licensed under the MIT license. See the LICENSE file for more info.

    +

    Issue Reporting

    +

    If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

    +

    Author

    +

    Auth0

    +

    License

    +

    This project is licensed under the MIT license. See the LICENSE file for more info.

@@ -151,7 +174,7 @@

License

This project is licensed under the MIT license. See the

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/index.js.html b/docs/index.js.html index 4c2b75404..4a2b04ce2 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -24,7 +24,7 @@
@@ -61,7 +61,7 @@

index.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_BlacklistedTokensManager.js.html b/docs/management_BlacklistedTokensManager.js.html index 8fd791b78..54bd4efa2 100644 --- a/docs/management_BlacklistedTokensManager.js.html +++ b/docs/management_BlacklistedTokensManager.js.html @@ -24,7 +24,7 @@
@@ -153,7 +153,7 @@

management/BlacklistedTokensManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_BrandingManager.js.html b/docs/management_BrandingManager.js.html index a4c3c8b29..0cfec3248 100644 --- a/docs/management_BrandingManager.js.html +++ b/docs/management_BrandingManager.js.html @@ -24,7 +24,7 @@
@@ -62,36 +62,36 @@

management/BrandingManager.js

* @param {Object} [options.retry] Retry Policy Config */ var BrandingManager = function(options) { - if (options === null || typeof options !== 'object') { - throw new ArgumentError('Must provide manager options'); - } - - if (options.baseUrl === null || options.baseUrl === undefined) { - throw new ArgumentError('Must provide a base URL for the API'); - } - - if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) { - throw new ArgumentError('The provided base URL is invalid'); - } - - var clientOptions = { - errorFormatter: { message: 'message', name: 'error' }, - headers: options.headers, - query: { repeatParams: false } - }; - - /** - * Provides an abstraction layer for consuming the - * {@link https://auth0.com/docs/api/management/v2#!/Branding Branding endpoint}. - * - * @type {external:RestClient} - */ - var auth0RestClient = new Auth0RestClient( - options.baseUrl + '/branding', - clientOptions, - options.tokenProvider - ); - this.resource = new RetryRestClient(auth0RestClient, options.retry); + if (options === null || typeof options !== 'object') { + throw new ArgumentError('Must provide manager options'); + } + + if (options.baseUrl === null || options.baseUrl === undefined) { + throw new ArgumentError('Must provide a base URL for the API'); + } + + if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) { + throw new ArgumentError('The provided base URL is invalid'); + } + + var clientOptions = { + errorFormatter: { message: 'message', name: 'error' }, + headers: options.headers, + query: { repeatParams: false } + }; + + /** + * Provides an abstraction layer for consuming the + * {@link https://auth0.com/docs/api/management/v2#!/Branding Branding endpoint}. + * + * @type {external:RestClient} + */ + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/branding', + clientOptions, + options.tokenProvider + ); + this.resource = new RetryRestClient(auth0RestClient, options.retry); }; /** @@ -155,7 +155,7 @@

management/BrandingManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_ClientGrantsManager.js.html b/docs/management_ClientGrantsManager.js.html index 4e4b78a7e..8d7d0401f 100644 --- a/docs/management_ClientGrantsManager.js.html +++ b/docs/management_ClientGrantsManager.js.html @@ -24,7 +24,7 @@
@@ -216,7 +216,7 @@

management/ClientGrantsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_ClientsManager.js.html b/docs/management_ClientsManager.js.html index a19a1de60..5279aab88 100644 --- a/docs/management_ClientsManager.js.html +++ b/docs/management_ClientsManager.js.html @@ -24,7 +24,7 @@
@@ -238,7 +238,7 @@

management/ClientsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_ConnectionsManager.js.html b/docs/management_ConnectionsManager.js.html index dc4469281..f748d7979 100644 --- a/docs/management_ConnectionsManager.js.html +++ b/docs/management_ConnectionsManager.js.html @@ -24,7 +24,7 @@
@@ -232,7 +232,7 @@

management/ConnectionsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_CustomDomainsManager.js.html b/docs/management_CustomDomainsManager.js.html index fb6b5219a..28d0c4c7a 100644 --- a/docs/management_CustomDomainsManager.js.html +++ b/docs/management_CustomDomainsManager.js.html @@ -24,7 +24,7 @@
@@ -241,7 +241,7 @@

management/CustomDomainsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_DeviceCredentialsManager.js.html b/docs/management_DeviceCredentialsManager.js.html index e51fe5878..9ab8dcda8 100644 --- a/docs/management_DeviceCredentialsManager.js.html +++ b/docs/management_DeviceCredentialsManager.js.html @@ -24,7 +24,7 @@
@@ -177,7 +177,7 @@

management/DeviceCredentialsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_EmailProviderManager.js.html b/docs/management_EmailProviderManager.js.html index 1857b9913..4050202fc 100644 --- a/docs/management_EmailProviderManager.js.html +++ b/docs/management_EmailProviderManager.js.html @@ -24,7 +24,7 @@
@@ -198,7 +198,7 @@

management/EmailProviderManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_EmailTemplatesManager.js.html b/docs/management_EmailTemplatesManager.js.html index 0f465dc42..310eca6c8 100644 --- a/docs/management_EmailTemplatesManager.js.html +++ b/docs/management_EmailTemplatesManager.js.html @@ -24,7 +24,7 @@
@@ -180,7 +180,7 @@

management/EmailTemplatesManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_GrantsManager.js.html b/docs/management_GrantsManager.js.html index 13f5408b0..25873a07e 100644 --- a/docs/management_GrantsManager.js.html +++ b/docs/management_GrantsManager.js.html @@ -24,7 +24,7 @@
@@ -170,7 +170,7 @@

management/GrantsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_GuardianManager.js.html b/docs/management_GuardianManager.js.html index bae91ee6c..e75f1bf8f 100644 --- a/docs/management_GuardianManager.js.html +++ b/docs/management_GuardianManager.js.html @@ -24,7 +24,7 @@
@@ -328,7 +328,7 @@

management/GuardianManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_JobsManager.js.html b/docs/management_JobsManager.js.html index 427b20b8b..58d0cea01 100644 --- a/docs/management_JobsManager.js.html +++ b/docs/management_JobsManager.js.html @@ -24,7 +24,7 @@
@@ -354,7 +354,7 @@

management/JobsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_LogsManager.js.html b/docs/management_LogsManager.js.html index 24984c402..6bfcf887f 100644 --- a/docs/management_LogsManager.js.html +++ b/docs/management_LogsManager.js.html @@ -24,7 +24,7 @@
@@ -165,7 +165,7 @@

management/LogsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_ManagementTokenProvider.js.html b/docs/management_ManagementTokenProvider.js.html index 102700c26..5d1780a31 100644 --- a/docs/management_ManagementTokenProvider.js.html +++ b/docs/management_ManagementTokenProvider.js.html @@ -24,7 +24,7 @@
@@ -112,6 +112,40 @@

management/ManagementTokenProvider.js

clientInfo: this.options.clientInfo }; this.authenticationClient = new AuthenticationClient(authenticationClientOptions); + + var self = this; + this.getCachedAccessToken = Promise.promisify( + memoizer({ + load: function(options, callback) { + self + .clientCredentialsGrant(options.domain, options.scope, options.audience) + .then(function(data) { + callback(null, data); + }) + .catch(function(err) { + callback(err); + }); + }, + hash: function(options) { + return options.domain + '-' + options.clientId + '-' + options.scope; + }, + itemMaxAge: function(options, data) { + if (options.cacheTTLInSeconds) { + return options.cacheTTLInSeconds * 1000; + } + + // if the expires_in is lower than 10 seconds, do not subtract 10 additional seconds. + if (data.expires_in && data.expires_in < 10 /* seconds */) { + return data.expires_in * 1000; + } else if (data.expires_in) { + // Subtract 10 seconds from expires_in to fetch a new one, before it expires. + return data.expires_in * 1000 - 10000 /* milliseconds */; + } + return 60 * 60 * 1000; //1h + }, + max: 100 + }) + ); }; /** @@ -138,38 +172,6 @@

management/ManagementTokenProvider.js

} }; -ManagementTokenProvider.prototype.getCachedAccessToken = Promise.promisify( - memoizer({ - load: function(options, callback) { - this.clientCredentialsGrant(options.domain, options.scope, options.audience) - .then(function(data) { - callback(null, data); - }) - .catch(function(err) { - callback(err); - }); - }, - hash: function(options) { - return options.domain + '-' + options.clientId + '-' + options.scope; - }, - itemMaxAge: function(options, data) { - if (options.cacheTTLInSeconds) { - return options.cacheTTLInSeconds * 1000; - } - - // if the expires_in is lower than 10 seconds, do not subtract 10 additional seconds. - if (data.expires_in && data.expires_in < 10 /* seconds */) { - return data.expires_in * 1000; - } else if (data.expires_in) { - // Subtract 10 seconds from expires_in to fetch a new one, before it expires. - return data.expires_in * 1000 - 10000 /* milliseconds */; - } - return 60 * 60 * 1000; //1h - }, - max: 100 - }) -); - ManagementTokenProvider.prototype.clientCredentialsGrant = function(domain, scope, audience) { return this.authenticationClient.clientCredentialsGrant({ audience: audience, @@ -190,7 +192,7 @@

management/ManagementTokenProvider.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_PromptsManager.js.html b/docs/management_PromptsManager.js.html index 5f6609fa9..ac8a7d33e 100644 --- a/docs/management_PromptsManager.js.html +++ b/docs/management_PromptsManager.js.html @@ -24,7 +24,7 @@
@@ -62,36 +62,36 @@

management/PromptsManager.js

* @param {Object} [options.retry] Retry Policy Config */ var PromptsManager = function(options) { - if (options === null || typeof options !== 'object') { - throw new ArgumentError('Must provide manager options'); - } - - if (options.baseUrl === null || options.baseUrl === undefined) { - throw new ArgumentError('Must provide a base URL for the API'); - } - - if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) { - throw new ArgumentError('The provided base URL is invalid'); - } - - var clientOptions = { - errorFormatter: { message: 'message', name: 'error' }, - headers: options.headers, - query: { repeatParams: false } - }; - - /** - * Provides an abstraction layer for consuming the - * {@link https://auth0.com/docs/api/management/v2#!/Prompts Prompts endpoint}. - * - * @type {external:RestClient} - */ - var auth0RestClient = new Auth0RestClient( - options.baseUrl + '/prompts', - clientOptions, - options.tokenProvider - ); - this.resource = new RetryRestClient(auth0RestClient, options.retry); + if (options === null || typeof options !== 'object') { + throw new ArgumentError('Must provide manager options'); + } + + if (options.baseUrl === null || options.baseUrl === undefined) { + throw new ArgumentError('Must provide a base URL for the API'); + } + + if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) { + throw new ArgumentError('The provided base URL is invalid'); + } + + var clientOptions = { + errorFormatter: { message: 'message', name: 'error' }, + headers: options.headers, + query: { repeatParams: false } + }; + + /** + * Provides an abstraction layer for consuming the + * {@link https://auth0.com/docs/api/management/v2#!/Prompts Prompts endpoint}. + * + * @type {external:RestClient} + */ + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/prompts', + clientOptions, + options.tokenProvider + ); + this.resource = new RetryRestClient(auth0RestClient, options.retry); }; /** @@ -155,7 +155,7 @@

management/PromptsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_ResourceServersManager.js.html b/docs/management_ResourceServersManager.js.html index 049ca68c2..e26233ed7 100644 --- a/docs/management_ResourceServersManager.js.html +++ b/docs/management_ResourceServersManager.js.html @@ -24,7 +24,7 @@
@@ -238,7 +238,7 @@

management/ResourceServersManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_RolesManager.js.html b/docs/management_RolesManager.js.html index 52e3c2833..4fa432968 100644 --- a/docs/management_RolesManager.js.html +++ b/docs/management_RolesManager.js.html @@ -24,7 +24,7 @@
@@ -453,7 +453,7 @@

management/RolesManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_RulesConfigsManager.js.html b/docs/management_RulesConfigsManager.js.html index ce194615a..119d595c3 100644 --- a/docs/management_RulesConfigsManager.js.html +++ b/docs/management_RulesConfigsManager.js.html @@ -24,7 +24,7 @@
@@ -50,7 +50,6 @@

management/RulesConfigsManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class RulesConfigsManager * The rules configs manager class provides a simple abstraction for performing CRUD operations @@ -63,7 +62,7 @@

management/RulesConfigsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var RulesConfigsManager = function (options) { +var RulesConfigsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide manager options'); } @@ -92,11 +91,14 @@

management/RulesConfigsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/rules-configs/:key', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/rules-configs/:key', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Set a new rules config. * @@ -106,7 +108,7 @@

management/RulesConfigsManager.js

* @example * var params = { key: RULE_CONFIG_KEY }; * var data = { value: RULES_CONFIG_VALUE }; - * + * * management.rulesConfigs.set(params, data, function (err, rulesConfig) { * if (err) { * // Handle error. @@ -125,7 +127,6 @@

management/RulesConfigsManager.js

*/ utils.wrapPropertyMethod(RulesConfigsManager, 'set', 'resource.update'); - /** * Get all rules configs. * @@ -143,7 +144,6 @@

management/RulesConfigsManager.js

*/ utils.wrapPropertyMethod(RulesConfigsManager, 'getAll', 'resource.getAll'); - /** * Delete an existing rules config. * @@ -167,7 +167,8 @@

management/RulesConfigsManager.js

*/ utils.wrapPropertyMethod(RulesConfigsManager, 'delete', 'resource.delete'); -module.exports = RulesConfigsManager; +module.exports = RulesConfigsManager; + @@ -179,7 +180,7 @@

management/RulesConfigsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_RulesManager.js.html b/docs/management_RulesManager.js.html index 773d7fcbf..05dc7435b 100644 --- a/docs/management_RulesManager.js.html +++ b/docs/management_RulesManager.js.html @@ -24,7 +24,7 @@
@@ -248,7 +248,7 @@

management/RulesManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_StatsManager.js.html b/docs/management_StatsManager.js.html index c10229311..6682fefa5 100644 --- a/docs/management_StatsManager.js.html +++ b/docs/management_StatsManager.js.html @@ -24,7 +24,7 @@
@@ -174,7 +174,7 @@

management/StatsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_TenantManager.js.html b/docs/management_TenantManager.js.html index 4f8d47a59..16d8c709a 100644 --- a/docs/management_TenantManager.js.html +++ b/docs/management_TenantManager.js.html @@ -24,7 +24,7 @@
@@ -127,7 +127,7 @@

management/TenantManager.js

* @memberOf module:management.TenantManager.prototype * * @example - * management.tenant.getSettings(function (err, settings) { + * management.tenant.getSettings({ include_fields: true, fields: 'friendly_name' }, function (err, settings) { * if (err) { * // Handle error. * } @@ -135,17 +135,22 @@

management/TenantManager.js

* console.log(settings); * }); * - * @param {Function} [cb] Callback function. + * @param {Object} [data] Request parameters + * @param {Function} [cb] Callback function. * * @return {Promise|undefined} */ -TenantManager.prototype.getSettings = function(cb) { +TenantManager.prototype.getSettings = function(data, cb) { + if (data instanceof Function && !cb) { + cb = data; + data = {}; + } if (cb && cb instanceof Function) { - return this.resource.get({}, cb); + return this.resource.get(data, cb); } // Return a promise. - return this.resource.get({}); + return this.resource.get(data); }; module.exports = TenantManager; @@ -161,7 +166,7 @@

management/TenantManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_TicketsManager.js.html b/docs/management_TicketsManager.js.html index cdfe52b16..9c87827ae 100644 --- a/docs/management_TicketsManager.js.html +++ b/docs/management_TicketsManager.js.html @@ -24,7 +24,7 @@
@@ -166,7 +166,7 @@

management/TicketsManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_UserBlocksManager.js.html b/docs/management_UserBlocksManager.js.html index 74682277f..5fb8d3609 100644 --- a/docs/management_UserBlocksManager.js.html +++ b/docs/management_UserBlocksManager.js.html @@ -24,7 +24,7 @@
@@ -176,13 +176,13 @@

management/UserBlocksManager.js

* * @return {Promise|undefined} */ - UserBlocksManager.prototype.getByIdentifier = function(params) { - if (typeof params !== 'object' || typeof params.identifier !== 'string') { - throw new ArgumentError('You must provide an user identifier for the getByIdentifier method'); - } +UserBlocksManager.prototype.getByIdentifier = function(params) { + if (typeof params !== 'object' || typeof params.identifier !== 'string') { + throw new ArgumentError('You must provide an user identifier for the getByIdentifier method'); + } - return this.userBlocksByIdentifier.get.apply(this.userBlocksByIdentifier, arguments); - }; + return this.userBlocksByIdentifier.get.apply(this.userBlocksByIdentifier, arguments); +}; /** * Unblock an user by identifier. @@ -206,15 +206,17 @@

management/UserBlocksManager.js

* * @return {Promise|undefined} */ - UserBlocksManager.prototype.deleteByIdentifier = function(params) { - if (typeof params !== 'object' || typeof params.identifier !== 'string') { - throw new ArgumentError('You must provide an user identifier for the deleteByIdentifier method'); - } +UserBlocksManager.prototype.deleteByIdentifier = function(params) { + if (typeof params !== 'object' || typeof params.identifier !== 'string') { + throw new ArgumentError( + 'You must provide an user identifier for the deleteByIdentifier method' + ); + } - return this.userBlocksByIdentifier.delete.apply(this.userBlocksByIdentifier, arguments); - }; + return this.userBlocksByIdentifier.delete.apply(this.userBlocksByIdentifier, arguments); +}; - module.exports = UserBlocksManager; +module.exports = UserBlocksManager; @@ -227,7 +229,7 @@

management/UserBlocksManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_UsersManager.js.html b/docs/management_UsersManager.js.html index f25c384af..433479dcb 100644 --- a/docs/management_UsersManager.js.html +++ b/docs/management_UsersManager.js.html @@ -24,7 +24,7 @@
@@ -927,7 +927,7 @@

management/UsersManager.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/management_index.js.html b/docs/management_index.js.html index ce1ecd9dd..72a9b4ae2 100644 --- a/docs/management_index.js.html +++ b/docs/management_index.js.html @@ -24,7 +24,7 @@
@@ -166,6 +166,11 @@

management/index.js

} else if (typeof options.token !== 'string' || options.token.length === 0) { throw new ArgumentError('Must provide a token'); } else { + this.tokenProvider = { + getAccessToken: function() { + return Promise.resolve(options.token); + } + }; managerOptions.headers['Authorization'] = 'Bearer ' + options.token; } @@ -1619,7 +1624,11 @@

management/index.js

* * @return {Promise|undefined} */ -utils.wrapPropertyMethod(ManagementClient, 'getUserBlocksByIdentifier', 'userBlocks.getByIdentifier'); +utils.wrapPropertyMethod( + ManagementClient, + 'getUserBlocksByIdentifier', + 'userBlocks.getByIdentifier' +); /** * Unblock an user by its id. @@ -1642,7 +1651,11 @@

management/index.js

* * @return {Promise|undefined} */ -utils.wrapPropertyMethod(ManagementClient, 'unblockUserByIdentifier', 'userBlocks.deleteByIdentifier'); +utils.wrapPropertyMethod( + ManagementClient, + 'unblockUserByIdentifier', + 'userBlocks.deleteByIdentifier' +); /** * Get a single Guardian enrollment. @@ -2057,14 +2070,14 @@

management/index.js

* @memberOf module:management.ManagementClient.prototype * * @example - * + * * var params = { - * result_url: '{REDIRECT_URL}', // Redirect after using the ticket. - * user_id: '{USER_ID}' - * }; - * - * // or - * + * result_url: '{REDIRECT_URL}', // Redirect after using the ticket. + * user_id: '{USER_ID}' + * }; + * + * // or + * * var params = { * result_url: '{REDIRECT_URL}', // Redirect after using the ticket. * email: '{USER_EMAIL}', @@ -2844,6 +2857,16 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getUsersInRole', 'roles.getUsers'); +/** + * Returns the access_token. + * + * @method getAccessToken + * @memberOf module:management.ManagementClient.prototype + * + * @return {Promise} Promise returning an access_token. + */ +utils.wrapPropertyMethod(ManagementClient, 'getAccessToken', 'tokenProvider.getAccessToken'); + module.exports = ManagementClient; @@ -2857,7 +2880,7 @@

management/index.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.AuthenticationClient.html b/docs/module-auth.AuthenticationClient.html index e21aba0fd..596743ecf 100644 --- a/docs/module-auth.AuthenticationClient.html +++ b/docs/module-auth.AuthenticationClient.html @@ -24,7 +24,7 @@
@@ -103,7 +103,7 @@

n
Source:
@@ -331,6 +331,42 @@

Parameters:
+ + + + __bypassIdTokenValidation + + + + + +Boolean + + + + + + + + + <optional>
+ + + + + + + + + + + +

Whether the id_token should be validated or not

+ + + + + @@ -436,7 +472,7 @@

databaseSource:
@@ -510,7 +546,7 @@

oauthSource:
@@ -584,7 +620,7 @@

passwordl
Source:
@@ -658,7 +694,7 @@

tokensSource:
@@ -732,7 +768,7 @@

usersSource:
@@ -816,7 +852,7 @@

changeP
Source:
@@ -1106,7 +1142,7 @@

Source:
@@ -1386,7 +1422,7 @@

get
Source:
@@ -1702,7 +1738,7 @@

getProfile<
Source:
@@ -1880,7 +1916,7 @@

password
Source:
@@ -2201,7 +2237,7 @@

refreshTo
Source:
@@ -2438,7 +2474,7 @@

Source:
@@ -2700,7 +2736,7 @@

reque
Source:
@@ -2981,7 +3017,7 @@

request
Source:
@@ -3497,7 +3533,7 @@

verifySM
Source:
@@ -3786,7 +3822,7 @@

Examples

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.DatabaseAuthenticator.html b/docs/module-auth.DatabaseAuthenticator.html index f2ef70257..fdba0c1d3 100644 --- a/docs/module-auth.DatabaseAuthenticator.html +++ b/docs/module-auth.DatabaseAuthenticator.html @@ -24,7 +24,7 @@
@@ -1738,7 +1738,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.OAUthWithIDTokenValidation.html b/docs/module-auth.OAUthWithIDTokenValidation.html index 63a40eb65..a765bf62e 100644 --- a/docs/module-auth.OAUthWithIDTokenValidation.html +++ b/docs/module-auth.OAUthWithIDTokenValidation.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

Source:
@@ -355,6 +355,42 @@
Parameters:
+ + + + __bypassIdTokenValidation + + + + + +Boolean + + + + + + + + + <optional>
+ + + + + + + + + + + +

Whether the id_token should be validated or not

+ + + + + @@ -414,7 +450,7 @@
Parameters:

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.OAuthAuthenticator.html b/docs/module-auth.OAuthAuthenticator.html index fc014af15..9326694e4 100644 --- a/docs/module-auth.OAuthAuthenticator.html +++ b/docs/module-auth.OAuthAuthenticator.html @@ -24,7 +24,7 @@
@@ -102,7 +102,7 @@

new
Source:
@@ -328,6 +328,42 @@

Parameters:
+ + + + __bypassIdTokenValidation + + + + + +Boolean + + + + + + + + + <optional>
+ + + + + + + + + + + +

Whether the id_token should be validated or not

+ + + + + @@ -416,7 +452,7 @@

(inner) Source:
@@ -500,7 +536,7 @@

Source:
@@ -741,7 +777,7 @@

password
Source:
@@ -1062,7 +1098,7 @@

refreshTo
Source:
@@ -1299,7 +1335,7 @@

signInSource:
@@ -1591,7 +1627,7 @@

socialSig
Source:
@@ -1796,7 +1832,7 @@

Returns:

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.PasswordlessAuthenticator.html b/docs/module-auth.PasswordlessAuthenticator.html index 03ccd7936..57dfad95b 100644 --- a/docs/module-auth.PasswordlessAuthenticator.html +++ b/docs/module-auth.PasswordlessAuthenticator.html @@ -24,7 +24,7 @@
@@ -1492,7 +1492,7 @@
Examples

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.TokensManager.html b/docs/module-auth.TokensManager.html index 9ba0d243a..c5a8d7919 100644 --- a/docs/module-auth.TokensManager.html +++ b/docs/module-auth.TokensManager.html @@ -24,7 +24,7 @@
@@ -352,7 +352,7 @@
Parameters:

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.UsersManager.html b/docs/module-auth.UsersManager.html index a18b6c999..f9204634c 100644 --- a/docs/module-auth.UsersManager.html +++ b/docs/module-auth.UsersManager.html @@ -24,7 +24,7 @@
@@ -1009,7 +1009,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-auth.html b/docs/module-auth.html index 1bff27e32..0a6bb5dc5 100644 --- a/docs/module-auth.html +++ b/docs/module-auth.html @@ -24,7 +24,7 @@
@@ -108,7 +108,7 @@

Classes


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.BlacklistedTokensManager.html b/docs/module-management.BlacklistedTokensManager.html index 5ee572e86..c368d28f7 100644 --- a/docs/module-management.BlacklistedTokensManager.html +++ b/docs/module-management.BlacklistedTokensManager.html @@ -24,7 +24,7 @@
@@ -991,7 +991,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.BrandingManager.html b/docs/module-management.BrandingManager.html index 25b590cc9..262b34043 100644 --- a/docs/module-management.BrandingManager.html +++ b/docs/module-management.BrandingManager.html @@ -24,7 +24,7 @@
@@ -942,7 +942,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.ClientGrantsManager.html b/docs/module-management.ClientGrantsManager.html index 6d0cf8c46..846225a1d 100644 --- a/docs/module-management.ClientGrantsManager.html +++ b/docs/module-management.ClientGrantsManager.html @@ -24,7 +24,7 @@
@@ -1636,7 +1636,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.ClientsManager.html b/docs/module-management.ClientsManager.html index e95b18527..34a359c84 100644 --- a/docs/module-management.ClientsManager.html +++ b/docs/module-management.ClientsManager.html @@ -24,7 +24,7 @@
@@ -1904,7 +1904,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.ConnectionsManager.html b/docs/module-management.ConnectionsManager.html index fafa8c2ed..bb4f584ad 100644 --- a/docs/module-management.ConnectionsManager.html +++ b/docs/module-management.ConnectionsManager.html @@ -24,7 +24,7 @@
@@ -347,7 +347,7 @@

(inner)

Provides an abstraction layer for performing CRUD operations on -Auth0 Connections.

+Auth0 Connections.

@@ -1899,7 +1899,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.CustomDomainsManager.html b/docs/module-management.CustomDomainsManager.html index 331259335..a1ef086aa 100644 --- a/docs/module-management.CustomDomainsManager.html +++ b/docs/module-management.CustomDomainsManager.html @@ -24,7 +24,7 @@
@@ -1731,7 +1731,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.DeviceCredentialsManager.html b/docs/module-management.DeviceCredentialsManager.html index 8f72be7a3..c3285bccf 100644 --- a/docs/module-management.DeviceCredentialsManager.html +++ b/docs/module-management.DeviceCredentialsManager.html @@ -24,7 +24,7 @@
@@ -347,7 +347,7 @@

(inner)

Provides an abstraction layer for consuming the - Auth0 DeviceCredentialsManagers endpoint.

+Auth0 DeviceCredentialsManagers endpoint.

@@ -1179,7 +1179,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.EmailProviderManager.html b/docs/module-management.EmailProviderManager.html index 4016d15bc..4000f8a4a 100644 --- a/docs/module-management.EmailProviderManager.html +++ b/docs/module-management.EmailProviderManager.html @@ -24,7 +24,7 @@
@@ -1480,7 +1480,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.EmailTemplatesManager.html b/docs/module-management.EmailTemplatesManager.html index 7c2cb4cfe..af3174e54 100644 --- a/docs/module-management.EmailTemplatesManager.html +++ b/docs/module-management.EmailTemplatesManager.html @@ -24,7 +24,7 @@
@@ -1304,7 +1304,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.GrantsManager.html b/docs/module-management.GrantsManager.html index b0dd30aa6..3642f04d4 100644 --- a/docs/module-management.GrantsManager.html +++ b/docs/module-management.GrantsManager.html @@ -24,7 +24,7 @@
@@ -842,7 +842,7 @@

deleteGran
Source:
@@ -1515,7 +1515,7 @@

Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.GuardianManager.html b/docs/module-management.GuardianManager.html index a11d64658..ceb2d04d4 100644 --- a/docs/module-management.GuardianManager.html +++ b/docs/module-management.GuardianManager.html @@ -24,7 +24,7 @@
@@ -1440,7 +1440,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.JobsManager.html b/docs/module-management.JobsManager.html index c121884ec..de2d802ec 100644 --- a/docs/module-management.JobsManager.html +++ b/docs/module-management.JobsManager.html @@ -24,7 +24,7 @@
@@ -1849,7 +1849,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.LogsManager.html b/docs/module-management.LogsManager.html index 99603a30d..50c4d503b 100644 --- a/docs/module-management.LogsManager.html +++ b/docs/module-management.LogsManager.html @@ -24,7 +24,7 @@
@@ -347,7 +347,7 @@

(inner)

Provides an abstraction layer for performing CRUD operations on -Auth0 Logs.

+Auth0 Logs.

@@ -1286,7 +1286,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.ManagementClient.html b/docs/module-management.ManagementClient.html index cb7798b07..e49d66743 100644 --- a/docs/module-management.ManagementClient.html +++ b/docs/module-management.ManagementClient.html @@ -24,7 +24,7 @@
@@ -168,8 +168,8 @@
Parameters:

Options for the ManagementClient SDK. - If a token is provided only the domain is required, other parameters are ignored. - If no token is provided domain, clientId, clientSecret and scopes are required

+If a token is provided only the domain is required, other parameters are ignored. +If no token is provided domain, clientId, clientSecret and scopes are required

@@ -723,7 +723,7 @@

blac
Source:
@@ -798,7 +798,7 @@

clientGra
Source:
@@ -873,7 +873,7 @@

clientsSource:
@@ -948,7 +948,7 @@

connection
Source:
@@ -1023,7 +1023,7 @@

customDo
Source:
@@ -1098,7 +1098,7 @@

devi
Source:
@@ -1173,7 +1173,7 @@

emailPro
Source:
@@ -1248,7 +1248,7 @@

emailTe
Source:
@@ -1323,7 +1323,7 @@

grantsSource:
@@ -1398,7 +1398,7 @@

guardianSource:
@@ -1472,7 +1472,7 @@

jobsSource:
@@ -1546,7 +1546,7 @@

logsSource:
@@ -1621,7 +1621,7 @@

resour
Source:
@@ -1696,7 +1696,7 @@

rolesSource:
@@ -1771,7 +1771,7 @@

rulesSource:
@@ -1845,7 +1845,7 @@

rulesConf
Source:
@@ -1919,7 +1919,7 @@

statsSource:
@@ -1993,7 +1993,7 @@

tenantSource:
@@ -2067,7 +2067,7 @@

ticketsSource:
@@ -2142,7 +2142,7 @@

userBlocks<
Source:
@@ -2217,7 +2217,7 @@

usersSource:
@@ -2301,7 +2301,7 @@

a
Source:
@@ -2680,7 +2680,7 @@

Source:
@@ -3037,7 +3037,7 @@

assi
Source:
@@ -3394,7 +3394,7 @@

blackli
Source:
@@ -3694,7 +3694,7 @@

Source:
@@ -3912,7 +3912,7 @@

createCli
Source:
@@ -4130,7 +4130,7 @@

crea
Source:
@@ -4348,7 +4348,7 @@

creat
Source:
@@ -4566,7 +4566,7 @@

cre
Source:
@@ -4784,7 +4784,7 @@

Source:
@@ -5002,7 +5002,7 @@

Source:
@@ -5186,7 +5186,7 @@

Source:
@@ -5366,7 +5366,7 @@

Source:
@@ -5558,7 +5558,7 @@

c
Source:
@@ -5776,7 +5776,7 @@

createRole<
Source:
@@ -5995,7 +5995,7 @@

createRule<
Source:
@@ -6213,7 +6213,7 @@

createUser<
Source:
@@ -6433,7 +6433,7 @@

deleteA
Source:
@@ -6617,7 +6617,7 @@

deleteCli
Source:
@@ -6886,7 +6886,7 @@

dele
Source:
@@ -7155,7 +7155,7 @@

delet
Source:
@@ -7424,7 +7424,7 @@

del
Source:
@@ -7693,7 +7693,7 @@

Source:
@@ -7964,7 +7964,7 @@

de
Source:
@@ -8148,7 +8148,7 @@

Source:
@@ -8417,7 +8417,7 @@

d
Source:
@@ -8686,7 +8686,7 @@

deleteRole<
Source:
@@ -8955,7 +8955,7 @@

deleteRule<
Source:
@@ -9224,7 +9224,7 @@

dele
Source:
@@ -9493,7 +9493,7 @@

deleteUser<
Source:
@@ -9762,7 +9762,7 @@

Source:
@@ -10063,7 +10063,7 @@

Source:
@@ -10360,7 +10360,7 @@

exportUser
Source:
@@ -10727,6 +10727,114 @@

Example

+
+ + + +

getAccessToken() → {Promise}

+ + + + + +
+

Returns the access_token.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Promise + + +
+
+ + +
+

Promise returning an access_token.

+
+ + +
+ + + +
+ +
@@ -10774,7 +10882,7 @@

ge
Source:
@@ -10958,7 +11066,7 @@

g
Source:
@@ -11138,7 +11246,7 @@

getClientSource:
@@ -11407,7 +11515,7 @@

getCli
Source:
@@ -11734,7 +11842,7 @@

getClients<
Source:
@@ -12061,7 +12169,7 @@

getConne
Source:
@@ -12330,7 +12438,7 @@

getConn
Source:
@@ -12657,7 +12765,7 @@

getCus
Source:
@@ -12926,7 +13034,7 @@

getCu
Source:
@@ -13042,7 +13150,7 @@

getDaily
Source:
@@ -13342,7 +13450,7 @@

g
Source:
@@ -13522,7 +13630,7 @@

getEm
Source:
@@ -13837,7 +13945,7 @@

getGrantsSource:
@@ -14241,7 +14349,7 @@

Source:
@@ -14506,7 +14614,7 @@

Source:
@@ -14771,7 +14879,7 @@

getJobSource:
@@ -15045,7 +15153,7 @@

getLogSource:
@@ -15314,7 +15422,7 @@

getLogsSource:
@@ -15821,7 +15929,7 @@

g
Source:
@@ -16045,7 +16153,7 @@

getR
Source:
@@ -16314,7 +16422,7 @@

get
Source:
@@ -16641,7 +16749,7 @@

getRoleSource:
@@ -16910,7 +17018,7 @@

getRolesSource:
@@ -17237,7 +17345,7 @@

getRuleSource:
@@ -17506,7 +17614,7 @@

getRulesSource:
@@ -17833,7 +17941,7 @@

getRul
Source:
@@ -17953,7 +18061,7 @@

getT
Source:
@@ -18137,7 +18245,7 @@

getUserSource:
@@ -18402,7 +18510,7 @@

getUserB
Source:
@@ -18671,7 +18779,7 @@

Source:
@@ -18940,7 +19048,7 @@

getUserLog
Source:
@@ -19315,7 +19423,7 @@

get
Source:
@@ -19690,7 +19798,7 @@

getUserRo
Source:
@@ -20065,7 +20173,7 @@

getUsersSource:
@@ -20429,7 +20537,7 @@

getUse
Source:
@@ -20650,7 +20758,7 @@

getUser
Source:
@@ -20875,7 +20983,7 @@

importUser
Source:
@@ -21173,7 +21281,7 @@

linkUsersSource:
@@ -21508,7 +21616,7 @@

Source:
@@ -21773,7 +21881,7 @@

Source:
@@ -22152,7 +22260,7 @@

Source:
@@ -22509,7 +22617,7 @@

re
Source:
@@ -22866,7 +22974,7 @@

Source:
@@ -23137,7 +23245,7 @@

setRule
Source:
@@ -23494,7 +23602,7 @@

unblockUse
Source:
@@ -23591,7 +23699,7 @@

Parameters:
- identifier + id @@ -23608,7 +23716,7 @@
Parameters:
-

The user identifier, any of: username, phone_number, email.

+

The user id.

@@ -23703,7 +23811,7 @@
Returns:
Example
-
management.unblockUserByIdentifier({ identifier: USER_ID }, function (err) {
+    
management.unblockUser({ id: USER_ID }, function (err) {
   if (err) {
     // Handle error.
   }
@@ -23763,7 +23871,7 @@ 

unblockUse
Source:
@@ -23860,7 +23968,7 @@

Parameters:
- id + identifier @@ -23877,7 +23985,7 @@
Parameters:
-

The user id.

+

The user identifier, any of: username, phone_number, email.

@@ -23972,7 +24080,7 @@
Returns:
Example
-
management.unblockUser({ id: USER_ID }, function (err) {
+    
management.unblockUserByIdentifier({ identifier: USER_ID }, function (err) {
   if (err) {
     // Handle error.
   }
@@ -24032,7 +24140,7 @@ 

unlinkUser
Source:
@@ -24355,7 +24463,7 @@

upda
Source:
@@ -24664,7 +24772,7 @@

updateCli
Source:
@@ -24970,7 +25078,7 @@

upda
Source:
@@ -25280,7 +25388,7 @@

updat
Source:
@@ -25586,7 +25694,7 @@

up
Source:
@@ -25839,7 +25947,7 @@

u
Source:
@@ -26145,7 +26253,7 @@

updateRole<
Source:
@@ -26450,7 +26558,7 @@

updateRule<
Source:
@@ -26755,7 +26863,7 @@

u
Source:
@@ -26971,7 +27079,7 @@

updateUser<
Source:
@@ -27277,7 +27385,7 @@

upd
Source:
@@ -27586,7 +27694,7 @@

ver
Source:
@@ -27824,7 +27932,7 @@

Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.ManagementTokenProvider.html b/docs/module-management.ManagementTokenProvider.html index efb5c4e12..1b95886bc 100644 --- a/docs/module-management.ManagementTokenProvider.html +++ b/docs/module-management.ManagementTokenProvider.html @@ -24,7 +24,7 @@
@@ -556,7 +556,7 @@

getAcce
Source:
@@ -633,7 +633,7 @@

Returns:

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.PromptsManager.html b/docs/module-management.PromptsManager.html index b3283afe1..28f7e7b26 100644 --- a/docs/module-management.PromptsManager.html +++ b/docs/module-management.PromptsManager.html @@ -24,7 +24,7 @@
@@ -942,7 +942,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.ResourceServersManager.html b/docs/module-management.ResourceServersManager.html index 2b3d62933..a9b6ada8b 100644 --- a/docs/module-management.ResourceServersManager.html +++ b/docs/module-management.ResourceServersManager.html @@ -24,7 +24,7 @@
@@ -1904,7 +1904,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.RetryRestClient.html b/docs/module-management.RetryRestClient.html index f938d5202..b298ace00 100644 --- a/docs/module-management.RetryRestClient.html +++ b/docs/module-management.RetryRestClient.html @@ -24,7 +24,7 @@
@@ -377,7 +377,7 @@
Parameters:

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.RolesManager.html b/docs/module-management.RolesManager.html index 5520a2e29..3a62c27b9 100644 --- a/docs/module-management.RolesManager.html +++ b/docs/module-management.RolesManager.html @@ -24,7 +24,7 @@
@@ -4217,7 +4217,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.RulesConfigsManager.html b/docs/module-management.RulesConfigsManager.html index 9df6eca76..e3fca224b 100644 --- a/docs/module-management.RulesConfigsManager.html +++ b/docs/module-management.RulesConfigsManager.html @@ -24,7 +24,7 @@
@@ -103,7 +103,7 @@

ne
Source:
@@ -384,7 +384,7 @@

(inner) Source:
@@ -458,7 +458,7 @@

(inner) Source:
@@ -811,7 +811,7 @@

getAllSource:
@@ -991,7 +991,7 @@

setSource:
@@ -1287,7 +1287,7 @@
Example
var params = { key: RULE_CONFIG_KEY };
 var data =   { value: RULES_CONFIG_VALUE };
- 
+
 management.rulesConfigs.set(params, data, function (err, rulesConfig) {
   if (err) {
     // Handle error.
@@ -1317,7 +1317,7 @@ 
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.RulesManager.html b/docs/module-management.RulesManager.html index 6dbc46292..fac38ea6b 100644 --- a/docs/module-management.RulesManager.html +++ b/docs/module-management.RulesManager.html @@ -24,7 +24,7 @@
@@ -1910,7 +1910,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.StatsManager.html b/docs/module-management.StatsManager.html index 9387b509d..9bb64be36 100644 --- a/docs/module-management.StatsManager.html +++ b/docs/module-management.StatsManager.html @@ -24,7 +24,7 @@
@@ -919,7 +919,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.TenantManager.html b/docs/module-management.TenantManager.html index fc90e2189..ae72d7622 100644 --- a/docs/module-management.TenantManager.html +++ b/docs/module-management.TenantManager.html @@ -24,7 +24,7 @@
@@ -423,7 +423,7 @@

Methods

-

getSettings(cbopt) → {Promise|undefined}

+

getSettings(dataopt, cbopt) → {Promise|undefined}

@@ -510,6 +510,42 @@
Parameters:
+ + + data + + + + + +Object + + + + + + + + + <optional>
+ + + + + + + + + + + +

Request parameters

+ + + + + + cb @@ -590,7 +626,7 @@
Returns:
Example
-
management.tenant.getSettings(function (err, settings) {
+    
management.tenant.getSettings({ include_fields: true, fields: 'friendly_name' }, function (err, settings) {
   if (err) {
     // Handle error.
   }
@@ -835,7 +871,7 @@ 
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.TicketsManager.html b/docs/module-management.TicketsManager.html index a0bc4bc87..6d02acd9d 100644 --- a/docs/module-management.TicketsManager.html +++ b/docs/module-management.TicketsManager.html @@ -24,7 +24,7 @@
@@ -805,7 +805,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.UserBlocksManager.html b/docs/module-management.UserBlocksManager.html index 0d9cc4488..9d4eadd2b 100644 --- a/docs/module-management.UserBlocksManager.html +++ b/docs/module-management.UserBlocksManager.html @@ -24,7 +24,7 @@
@@ -1432,7 +1432,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.UsersManager.html b/docs/module-management.UsersManager.html index 76c82b39e..7e3bc8b09 100644 --- a/docs/module-management.UsersManager.html +++ b/docs/module-management.UsersManager.html @@ -24,7 +24,7 @@
@@ -5753,7 +5753,7 @@
Example

- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-management.html b/docs/module-management.html index be4771851..468b176e6 100644 --- a/docs/module-management.html +++ b/docs/module-management.html @@ -24,7 +24,7 @@
@@ -165,7 +165,7 @@

Classes


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/module-utils.html b/docs/module-utils.html index c3a9fec75..fc18e7056 100644 --- a/docs/module-utils.html +++ b/docs/module-utils.html @@ -24,7 +24,7 @@
@@ -447,7 +447,7 @@

(static)
- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:11 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/docs/utils.js.html b/docs/utils.js.html index 829a459f6..cd025a8a0 100644 --- a/docs/utils.js.html +++ b/docs/utils.js.html @@ -24,7 +24,7 @@
@@ -55,7 +55,7 @@

utils.js

* @memberOf module:utils */ utils.jsonToBase64 = function(json) { - var bytes = new Buffer(JSON.stringify(json)); + var bytes = Buffer.from(JSON.stringify(json)); return bytes .toString('base64') @@ -131,6 +131,18 @@

utils.js

); }); }; + +utils.containsUnsafeChars = s => { + const safeChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$-_.+!*'(),%"; + return !!s.split('').find(c => !safeChars.includes(c)); +}; + +utils.maybeDecode = url => { + if (utils.containsUnsafeChars(url)) { + return encodeURIComponent(url); + } + return url; +};

@@ -143,7 +155,7 @@

utils.js


- Generated by JSDoc 3.5.5 on Wed Jun 26 2019 11:41:16 GMT-0300 (Brasilia Standard Time) using the Minami theme. + Generated by JSDoc 3.6.3 on Tue Jul 23 2019 16:47:10 GMT-0300 (Brasilia Standard Time) using the Minami theme.
diff --git a/package.json b/package.json index 6eec67fe6..6650d7931 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "auth0", - "version": "2.18.0", + "version": "2.18.1", "description": "SDK for Auth0 API v2", "main": "src/index.js", "files": [ @@ -12,10 +12,7 @@ "test:coverage": "codecov", "test:watch": "cross-env NODE_ENV=test mocha --timeout 5000 ./test/**/*.tests.js ./test/*.tests.js --watch", "jsdoc:generate": "jsdoc --configure .jsdoc.json --verbose", - "release:clean": "node scripts/cleanup.js", - "preversion": "node scripts/prepare.js", - "version": "node scripts/changelog.js && node scripts/jsdocs.js", - "postversion": "npm run release:clean", + "version": "node ./scripts/release.js", "precommit": "pretty-quick --staged" }, "repository": { diff --git a/scripts/changelog.js b/scripts/changelog.js deleted file mode 100644 index 9b99fb50c..000000000 --- a/scripts/changelog.js +++ /dev/null @@ -1,43 +0,0 @@ -if (process.platform === 'win32') { - console.error('Must be run on a Unix OS'); - process.exit(1); -} - -var library = require('../package.json'); -var fs = require('fs'); -var path = require('path'); -var execSync = require('child_process').execSync; -var moment = require('moment'); - -var tmp = fs.readFileSync('.release', 'utf-8'); -var currentVersion = fs.readFileSync(path.resolve(tmp, 'current-version'), 'utf-8'); -var changelogPath = path.resolve(tmp, 'CHANGELOG.md'); -var stream = fs.createWriteStream(changelogPath); - -var webtask = `https://webtask.it.auth0.com/api/run/wt-hernan-auth0_com-0/oss-changelog.js?webtask_no_cache=1&repo=node-auth0&milestone=v${library.version}`; -var command = `curl -f -s -H "Accept: text/markdown" "${webtask}"`; -var changes = execSync(command, { encoding: 'utf-8' }); -var previous = execSync('sed "s/# Change Log//" CHANGELOG.md | sed \'1,2d\''); -stream.once('open', function(fd) { - stream.write('# Change Log'); - stream.write('\n'); - stream.write('\n'); - stream.write( - `## [v${library.version}](https://github.com/auth0/node-auth0/tree/v${ - library.version - }) (${moment().format('YYYY-MM-DD')})` - ); - stream.write('\n'); - stream.write( - `[Full Changelog](https://github.com/auth0/node-auth0/compare/v${currentVersion}...v${library.version})` - ); - stream.write('\n'); - stream.write(changes); - stream.write('\n'); - stream.write(previous); - stream.end(); -}); -stream.once('close', function(fd) { - execSync(`mv ${changelogPath} CHANGELOG.md`, { stdio: 'inherit' }); - execSync('git add CHANGELOG.md', { stdio: 'inherit' }); -}); diff --git a/scripts/cleanup.js b/scripts/cleanup.js deleted file mode 100644 index 5a08298dd..000000000 --- a/scripts/cleanup.js +++ /dev/null @@ -1,22 +0,0 @@ -if (process.platform === 'win32') { - console.error('Must be run on a Unix OS'); - process.exit(1); -} - -var execSync = require('child_process').execSync; -var fs = require('fs'); - -if (fs.existsSync('out')) { - execSync(`rm -r out`, { stdio: 'inherit' }); -} - -if (!fs.existsSync('.release')) { - console.log('No in progress release found'); - process.exit(0); -} -var tmp = fs.readFileSync('.release'); -if (fs.existsSync(tmp)) { - execSync(`rm -r ${tmp}`, { stdio: 'inherit' }); -} - -execSync(`rm -r .release`, { stdio: 'inherit' }); diff --git a/scripts/exec.js b/scripts/exec.js new file mode 100644 index 000000000..88221aeee --- /dev/null +++ b/scripts/exec.js @@ -0,0 +1,12 @@ +const exec = require('child_process').exec; + +module.exports = cmd => { + return new Promise((resolve, reject) => { + exec(cmd, (error, stdout, stderr) => { + if (error) { + reject(error); + } + resolve(stdout ? stdout : stderr); + }); + }); +}; diff --git a/scripts/jsdocs.js b/scripts/jsdocs.js deleted file mode 100644 index e6aceda1f..000000000 --- a/scripts/jsdocs.js +++ /dev/null @@ -1,15 +0,0 @@ -if (process.platform === 'win32') { - console.error('Must be run on a Unix OS'); - process.exit(1); -} - -var library = require('../package.json'); -var execSync = require('child_process').execSync; -var fs = require('fs'); - -execSync('npm run jsdoc:generate', { stdio: 'inherit' }); -if (fs.existsSync('docs')) { - execSync('rm -r docs', { stdio: 'inherit' }); -} -execSync(`mv out/${library.name}/${library.version}/ docs`, { stdio: 'inherit' }); -execSync('git add docs'); diff --git a/scripts/prepare.js b/scripts/prepare.js deleted file mode 100644 index 32867ccb5..000000000 --- a/scripts/prepare.js +++ /dev/null @@ -1,19 +0,0 @@ -if (process.platform === 'win32') { - console.error('Must be run on a Unix OS'); - process.exit(1); -} - -var library = require('../package.json'); -var fs = require('fs'); -var path = require('path'); - -if (!fs.existsSync('.release')) { - var tmp = fs.mkdtempSync(`.release-tmp-`); - fs.writeFileSync('.release', tmp); -} else { - console.error('Found a pending release. Please run npm run release:clean'); - process.exit(1); -} - -var lastVersionFile = path.resolve(tmp, 'current-version'); -fs.writeFileSync(lastVersionFile, library.version); diff --git a/scripts/release.js b/scripts/release.js new file mode 100644 index 000000000..6b02b4bf9 --- /dev/null +++ b/scripts/release.js @@ -0,0 +1,58 @@ +const fs = require('fs'); +const pkg = require('../package.json'); +const exec = require('./exec'); +const superagent = require('superagent'); + +const newVersion = process.argv[2]; +if (!newVersion) { + throw new Error('usage: `release new_version`'); +} + +const today = new Date().toISOString().split('T')[0]; + +const createChangelog = async () => { + const currentChangelog = fs.readFileSync('./CHANGELOG.md').toString('utf-8'); + const { text: changelog } = await superagent + .get( + `https://webtask.it.auth0.com/api/run/wt-hernan-auth0_com-0/oss-changelog.js?webtask_no_cache=1&repo=node-auth0&milestone=v${newVersion}` + ) + .set('Accept', 'text/markdown'); + + fs.writeFileSync( + './CHANGELOG.md', + currentChangelog.replace( + '# Change Log', + `# Change Log + +## [v${pkg.version}](https://github.com/auth0/node-auth0/tree/v${newVersion}) (${today}) +${changelog} +[Full Changelog](https://github.com/auth0/node-auth0/compare/v${pkg.version}...v${newVersion})` + ) + ); +}; + +const createDocs = async () => { + await exec('npm run jsdoc:generate'); + await exec('rm -rf ./docs'); + await exec(`mv out/${pkg.name}/${newVersion}/ ./docs`); +}; + +(async () => { + await exec('git checkout master'); + await exec('git pull'); + await exec(`git checkout -b prepare/${newVersion}`); + + const newReadme = fs + .readFileSync('./README.md') + .toString() + .replace(pkg.version, newVersion); + + fs.writeFileSync('./README.md', newReadme); + + fs.writeFileSync('./package.json', JSON.stringify({ ...pkg, version: newVersion }, null, 2)); + + await createDocs(); + await createChangelog(); + await exec('git add docs'); + await exec(`git commit -am "Release v${newVersion}"`); +})();