@aws-amplify/auth 4.3.7 → 4.3.8-unstable.1

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.
@@ -79,7 +79,7 @@ function R(e){return c.Buffer.from((new v).random(e).toString(),"hex")}D.prototy
79
79
  * CONDITIONS OF ANY KIND, express or implied. See the License
80
80
  * for the specific language governing permissions and
81
81
  * limitations under the License.
82
- */if("undefined"!=typeof navigator&&navigator.product)switch($.product=navigator.product||"",$.navigator=navigator||null,navigator.product){case"ReactNative":$.userAgent="aws-amplify/5.0.4 react-native",$.isReactNative=!0;break;default:$.userAgent="aws-amplify/5.0.4 js",$.isReactNative=!1}function Q(){}Q.prototype.userAgent=$.userAgent;var ee=function(e){e&&(Q.prototype.userAgent&&!Q.prototype.userAgent.includes(e)&&(Q.prototype.userAgent=Q.prototype.userAgent.concat(" ",e)),Q.prototype.userAgent&&""!==Q.prototype.userAgent||(Q.prototype.userAgent=e))},te=Q;function ne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,se(e,t)}function re(e){var t="function"==typeof Map?new Map:void 0;return(re=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ie(e,arguments,ae(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),se(r,e)})(e)}function ie(e,t,n){return(ie=oe()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&se(i,n.prototype),i}).apply(null,arguments)}function oe(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function se(e,t){return(se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ue=function(e){function t(t,n,r,i){var o;return(o=e.call(this,t)||this).code=n,o.name=r,o.statusCode=i,o}return ne(t,e),t}(re(Error)),ce=function(){function e(e,t,n){this.endpoint=t||"https://cognito-idp."+e+".amazonaws.com/";var r=(n||{}).credentials;this.fetchOptions=r?{credentials:r}:{}}var t=e.prototype;return t.promisifyRequest=function(e,t){var n=this;return new Promise((function(r,i){n.request(e,t,(function(e,t){e?i(new ue(e.message,e.code,e.name,e.statusCode)):r(t)}))}))},t.requestWithRetry=function(e,t,n){var r=this;(function(e,t,n){void 0===n&&(n=3e5);return function e(t,n,r,i){void 0===i&&(i=1);if("function"!=typeof t)throw Error("functionToRetry must be a function");return he(t.name+" attempt #"+i+" with args: "+JSON.stringify(n)),t.apply(void 0,n).catch((function(o){if(he("error on "+t.name,o),(s=o)&&s.nonRetryable)throw he(t.name+" non retryable error",o),o;var s,a=r(i,n,o);if(he(t.name+" retrying in "+a+" ms"),!1!==a)return new Promise((function(e){return setTimeout(e,a)})).then((function(){return e(t,n,r,i+1)}));throw o}))}(e,t,function(e){return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}(n))})((function(t){return new Promise((function(n,i){r.request(e,t,(function(e,t){e?i(e):n(t)}))}))}),[t],5e3).then((function(e){return n(null,e)})).catch((function(e){return n(e)}))},t.request=function(e,t,n){var r,i={"Content-Type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityProviderService."+e,"X-Amz-User-Agent":te.prototype.userAgent},o=Object.assign({},this.fetchOptions,{headers:i,method:"POST",mode:"cors",cache:"no-cache",body:JSON.stringify(t)});fetch(this.endpoint,o).then((function(e){return r=e,e}),(function(e){if(e instanceof TypeError)throw new Error("Network error");throw e})).then((function(e){return e.json().catch((function(){return{}}))})).then((function(e){if(r.ok)return n(null,e);e;var t=(e.__type||e.code).split("#").pop(),i={code:t,name:t,message:e.message||e.Message||null};return n(i)})).catch((function(e){if(!(r&&r.headers&&r.headers.get("x-amzn-errortype"))){if(e instanceof Error&&"Network error"===e.message){var t={code:"NetworkError",name:e.name,message:e.message};return n(t)}return n(e)}try{var i=r.headers.get("x-amzn-errortype").split(":")[0],o={code:i,name:i,statusCode:r.status,message:r.status?r.status.toString():null};return n(o)}catch(t){return n(e)}}))},e}(),he=function(){};Error;
82
+ */if("undefined"!=typeof navigator&&navigator.product)switch($.product=navigator.product||"",$.navigator=navigator||null,navigator.product){case"ReactNative":$.userAgent="aws-amplify/5.0.4 react-native",$.isReactNative=!0;break;default:$.userAgent="aws-amplify/5.0.4 js",$.isReactNative=!1}function Q(){}Q.prototype.userAgent=$.userAgent;var ee=function(e){e&&(Q.prototype.userAgent&&!Q.prototype.userAgent.includes(e)&&(Q.prototype.userAgent=Q.prototype.userAgent.concat(" ",e)),Q.prototype.userAgent&&""!==Q.prototype.userAgent||(Q.prototype.userAgent=e))},te=Q;function ne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,se(e,t)}function re(e){var t="function"==typeof Map?new Map:void 0;return(re=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ie(e,arguments,ae(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),se(r,e)})(e)}function ie(e,t,n){return(ie=oe()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&se(i,n.prototype),i}).apply(null,arguments)}function oe(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function se(e,t){return(se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ue=function(e){function t(t,n,r,i){var o;return(o=e.call(this,t)||this).code=n,o.name=r,o.statusCode=i,o}return ne(t,e),t}(re(Error)),ce=function(){function e(e,t,n){this.endpoint=t||"https://cognito-idp."+e+".amazonaws.com/";var r=(n||{}).credentials;this.fetchOptions=r?{credentials:r}:{}}var t=e.prototype;return t.promisifyRequest=function(e,t){var n=this;return new Promise((function(r,i){n.request(e,t,(function(e,t){e?i(new ue(e.message,e.code,e.name,e.statusCode)):r(t)}))}))},t.requestWithRetry=function(e,t,n){var r=this;(function(e,t,n){void 0===n&&(n=3e5);return function e(t,n,r,i){void 0===i&&(i=1);if("function"!=typeof t)throw Error("functionToRetry must be a function");return he(t.name+" attempt #"+i+" with args: "+JSON.stringify(n)),t.apply(void 0,n).catch((function(o){if(he("error on "+t.name,o),(s=o)&&s.nonRetryable)throw he(t.name+" non retryable error",o),o;var s,a=r(i,n,o);if(he(t.name+" retrying in "+a+" ms"),!1!==a)return new Promise((function(e){return setTimeout(e,a)})).then((function(){return e(t,n,r,i+1)}));throw o}))}(e,t,function(e){return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}(n))})((function(t){return new Promise((function(n,i){r.request(e,t,(function(e,t){e?i(e):n(t)}))}))}),[t],5e3).then((function(e){return n(null,e)})).catch((function(e){return n(e)}))},t.request=function(e,t,n){var r,i={"Content-Type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityProviderService."+e,"X-Amz-User-Agent":te.prototype.userAgent},o=Object.assign({},this.fetchOptions,{headers:i,method:"POST",mode:"cors",cache:"no-cache",body:JSON.stringify(t)});fetch(this.endpoint,o).then((function(e){return r=e,e}),(function(e){if(e instanceof TypeError)throw new Error("Network error");throw e})).then((function(e){return e.json().catch((function(){return{}}))})).then((function(e){if(r.ok)return n(null,e);e;var t=(e.__type||e.code).split("#").pop(),i=new Error(e.message||e.Message||null);return i.name=t,i.code=t,n(i)})).catch((function(e){if(r&&r.headers&&r.headers.get("x-amzn-errortype"))try{var t=r.headers.get("x-amzn-errortype").split(":")[0],i=new Error(r.status?r.status.toString():null);return i.code=t,i.name=t,i.statusCode=r.status,n(i)}catch(t){return n(e)}else e instanceof Error&&"Network error"===e.message&&(e.code="NetworkError");return n(e)}))},e}(),he=function(){};Error;
83
83
  /*!
84
84
  * Copyright 2016 Amazon.com,
85
85
  * Inc. or its affiliates. All Rights Reserved.