rudder-sdk-js 2.33.1 → 2.34.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +17 -0
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/service-worker/index.es.js +33 -47
- package/service-worker/index.js +33 -47
package/package.json
CHANGED
@@ -2808,7 +2808,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
2808
2808
|
// Also filter out any prototype objects using the circular check.
|
2809
2809
|
!(value.constructor && value.constructor.prototype === value)) {
|
2810
2810
|
var ret = value.inspect(recurseTimes, ctx);
|
2811
|
-
if (!isString$
|
2811
|
+
if (!isString$3(ret)) {
|
2812
2812
|
ret = formatValue(ctx, ret, recurseTimes);
|
2813
2813
|
}
|
2814
2814
|
return ret;
|
@@ -2913,7 +2913,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
2913
2913
|
function formatPrimitive(ctx, value) {
|
2914
2914
|
if (isUndefined$1(value))
|
2915
2915
|
return ctx.stylize('undefined', 'undefined');
|
2916
|
-
if (isString$
|
2916
|
+
if (isString$3(value)) {
|
2917
2917
|
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
2918
2918
|
.replace(/'/g, "\\'")
|
2919
2919
|
.replace(/\\"/g, '"') + '\'';
|
@@ -3050,7 +3050,7 @@ function isNumber$1(arg) {
|
|
3050
3050
|
return typeof arg === 'number';
|
3051
3051
|
}
|
3052
3052
|
|
3053
|
-
function isString$
|
3053
|
+
function isString$3(arg) {
|
3054
3054
|
return typeof arg === 'string';
|
3055
3055
|
}
|
3056
3056
|
|
@@ -3608,19 +3608,9 @@ var MAX_SIZE=32<<10;var looselyValidateEvent_1=looselyValidateEvent;/**
|
|
3608
3608
|
*/var genericValidationRules={anonymousId:['string','number'],category:'string',context:'object',event:'string',groupId:['string','number'],integrations:'object',name:'string',previousId:['string','number'],timestamp:'date',userId:['string','number'],type:'string'};/**
|
3609
3609
|
* Validate an event object.
|
3610
3610
|
*/function validateGenericEvent(event){assert(type(event)==='object','You must pass a message object.');var json=JSON.stringify(event);// Strings are variable byte encoded, so json.length is not sufficient.
|
3611
|
-
assert(Buffer.byteLength(json,'utf8')<MAX_SIZE,'Your message must be < 32kb.');for(var key in genericValidationRules){var val=event[key];if(!val)continue;var rule=genericValidationRules[key];if(type(rule)!=='array'){rule=[rule];}var a=rule[0]==='object'?'an':'a';assert(rule.some(function(e){return type(val)===e;}),'"'+key+'" must be '+a+' '+join(rule,'or')+'.');}}
|
3611
|
+
assert(Buffer.byteLength(json,'utf8')<MAX_SIZE,'Your message must be < 32kb.');for(var key in genericValidationRules){var val=event[key];if(!val)continue;var rule=genericValidationRules[key];if(type(rule)!=='array'){rule=[rule];}var a=rule[0]==='object'?'an':'a';assert(rule.some(function(e){return type(val)===e;}),'"'+key+'" must be '+a+' '+join(rule,'or')+'.');}}var looselyValidate = /*@__PURE__*/getDefaultExportFromCjs(looselyValidateEvent_1);
|
3612
3612
|
|
3613
|
-
var
|
3614
|
-
var axios$3 = {
|
3615
|
-
get exports(){ return axiosExports$1; },
|
3616
|
-
set exports(v){ axiosExports$1 = v; },
|
3617
|
-
};
|
3618
|
-
|
3619
|
-
var axiosExports = {};
|
3620
|
-
var axios$2 = {
|
3621
|
-
get exports(){ return axiosExports; },
|
3622
|
-
set exports(v){ axiosExports = v; },
|
3623
|
-
};
|
3613
|
+
var axios$3 = {exports: {}};
|
3624
3614
|
|
3625
3615
|
var bind$2=function bind(fn,thisArg){return function wrap(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}return fn.apply(thisArg,args);};};
|
3626
3616
|
|
@@ -3658,7 +3648,7 @@ return function(thing){var str=toString.call(thing);return cache[str]||(cache[st
|
|
3658
3648
|
*
|
3659
3649
|
* @param {Object} val The value to test
|
3660
3650
|
* @returns {boolean} True if value is a String, otherwise false
|
3661
|
-
*/function isString$
|
3651
|
+
*/function isString$2(val){return typeof val==='string';}/**
|
3662
3652
|
* Determine if a value is a Number
|
3663
3653
|
*
|
3664
3654
|
* @param {Object} val The value to test
|
@@ -3803,7 +3793,7 @@ for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)){fn.call(nu
|
|
3803
3793
|
* @returns {Array}
|
3804
3794
|
*/function toArray(thing){if(!thing)return null;var i=thing.length;if(isUndefined(i))return null;var arr=new Array(i);while(i-->0){arr[i]=thing[i];}return arr;}// eslint-disable-next-line func-names
|
3805
3795
|
var isTypedArray=function(TypedArray){// eslint-disable-next-line func-names
|
3806
|
-
return function(thing){return TypedArray&&thing instanceof TypedArray;};}(typeof Uint8Array!=='undefined'&&Object.getPrototypeOf(Uint8Array));var utils$9={isArray:isArray$1,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString$
|
3796
|
+
return function(thing){return TypedArray&&thing instanceof TypedArray;};}(typeof Uint8Array!=='undefined'&&Object.getPrototypeOf(Uint8Array));var utils$9={isArray:isArray$1,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString$2,isNumber:isNumber,isObject:isObject,isPlainObject:isPlainObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction$1,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:kindOf,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,isTypedArray:isTypedArray,isFileList:isFileList};
|
3807
3797
|
|
3808
3798
|
var utils$8=utils$9;function encode(val){return encodeURIComponent(val).replace(/%3A/gi,':').replace(/%24/g,'$').replace(/%2C/gi,',').replace(/%20/g,'+').replace(/%5B/gi,'[').replace(/%5D/gi,']');}/**
|
3809
3799
|
* Build a URL by appending params to the end
|
@@ -3811,7 +3801,7 @@ var utils$8=utils$9;function encode(val){return encodeURIComponent(val).replace(
|
|
3811
3801
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
3812
3802
|
* @param {object} [params] The params to be appended
|
3813
3803
|
* @returns {string} The formatted url
|
3814
|
-
*/var buildURL$1=function buildURL(url,params,paramsSerializer){/*eslint no-param-reassign:0*/if(!params){return url;}var serializedParams;if(paramsSerializer){serializedParams=paramsSerializer(params);}else if(utils$8.isURLSearchParams(params)){serializedParams=params.toString();}else {var parts=[];utils$8.forEach(params,function serialize(val,key){if(val===null||typeof val==='undefined'){return;}if(utils$8.isArray(val)){key=key+'[]';}else {val=[val];}utils$8.forEach(val,function parseValue(v){if(utils$8.isDate(v)){v=v.toISOString();}else if(utils$8.isObject(v)){v=JSON.stringify(v);}parts.push(encode(key)+'='+encode(v));});});serializedParams=parts.join('&');}if(serializedParams){var hashmarkIndex=url.indexOf('#');if(hashmarkIndex!==-1){url=url.slice(0,hashmarkIndex);}url+=(url.indexOf('?')===-1?'?':'&')+serializedParams;}return url;};
|
3804
|
+
*/var buildURL$1=function buildURL(url,params,paramsSerializer){/*eslint no-param-reassign:0*/if(!params){return url;}var serializedParams;if(paramsSerializer){serializedParams=paramsSerializer(params);}else if(utils$8.isURLSearchParams(params)){serializedParams=params.toString();}else {var parts=[];utils$8.forEach(params,function serialize(val,key){if(val===null||typeof val==='undefined'){return;}if(utils$8.isArray(val)){key=key+'[]';}else {val=[val];}utils$8.forEach(val,function parseValue(v){if(utils$8.isDate(v)){v=v.toISOString();}else if(utils$8.isObject(v)){v=JSON.stringify(v);}parts.push(encode(key)+'='+encode(v));});});serializedParams=parts.join('&');}if(serializedParams){var hashmarkIndex=url.indexOf('#');if(hashmarkIndex!==-1){url=url.slice(0,hashmarkIndex);}url+=(url.indexOf('?')===-1?'?':'&')+serializedParams;}return url;};var buildURL$2 = /*@__PURE__*/getDefaultExportFromCjs(buildURL$1);
|
3815
3805
|
|
3816
3806
|
var utils$7=utils$9;function InterceptorManager$1(){this.handlers=[];}/**
|
3817
3807
|
* Add a new interceptor to the stack
|
@@ -3870,7 +3860,7 @@ var AxiosError$2=requireAxiosError();/**
|
|
3870
3860
|
* @param {Function} resolve A function that resolves the promise.
|
3871
3861
|
* @param {Function} reject A function that rejects the promise.
|
3872
3862
|
* @param {object} response The response.
|
3873
|
-
*/var settle=function settle(resolve,reject,response){var validateStatus=response.config.validateStatus;if(!response.status||!validateStatus||validateStatus(response.status)){resolve(response);}else {reject(new AxiosError$2('Request failed with status code '+response.status,[AxiosError$2.ERR_BAD_REQUEST,AxiosError$2.ERR_BAD_RESPONSE][Math.floor(response.status/100)-4],response.config,response.request,response));}};
|
3863
|
+
*/var settle=function settle(resolve,reject,response){var validateStatus=response.config.validateStatus;if(!response.status||!validateStatus||validateStatus(response.status)){resolve(response);}else {reject(new AxiosError$2('Request failed with status code '+response.status,[AxiosError$2.ERR_BAD_REQUEST,AxiosError$2.ERR_BAD_RESPONSE][Math.floor(response.status/100)-4],response.config,response.request,response));}};var settle$1 = /*@__PURE__*/getDefaultExportFromCjs(settle);
|
3874
3864
|
|
3875
3865
|
var cookies;var hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var utils=utils$9;cookies=utils.isStandardBrowserEnv()?// Standard browser envs support document.cookie
|
3876
3866
|
function standardBrowserEnv(){return {write:function write(name,value,expires,path,domain,secure){var cookie=[];cookie.push(name+'='+encodeURIComponent(value));if(utils.isNumber(expires)){cookie.push('expires='+new Date(expires).toGMTString());}if(utils.isString(path)){cookie.push('path='+path);}if(utils.isString(domain)){cookie.push('domain='+domain);}if(secure===true){cookie.push('secure');}document.cookie=cookie.join('; ');},read:function read(name){var match=document.cookie.match(new RegExp('(^|;\\s*)('+name+')=([^;]*)'));return match?decodeURIComponent(match[3]):null;},remove:function remove(name){this.write(name,'',Date.now()-86400000);}};}():// Non standard browser env (web workers, react-native) lack needed support.
|
@@ -3902,7 +3892,7 @@ var isAbsoluteURL=isAbsoluteURL$1;var combineURLs=combineURLs$1;/**
|
|
3902
3892
|
* @param {string} baseURL The base URL
|
3903
3893
|
* @param {string} requestedURL Absolute or relative URL to combine
|
3904
3894
|
* @returns {string} The combined full path
|
3905
|
-
*/var buildFullPath$1=function buildFullPath(baseURL,requestedURL){if(baseURL&&!isAbsoluteURL(requestedURL)){return combineURLs(baseURL,requestedURL);}return requestedURL;};
|
3895
|
+
*/var buildFullPath$1=function buildFullPath(baseURL,requestedURL){if(baseURL&&!isAbsoluteURL(requestedURL)){return combineURLs(baseURL,requestedURL);}return requestedURL;};var buildFullPath$2 = /*@__PURE__*/getDefaultExportFromCjs(buildFullPath$1);
|
3906
3896
|
|
3907
3897
|
var parseHeaders;var hasRequiredParseHeaders;function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var utils=utils$9;// Headers whose duplicates are ignored by node
|
3908
3898
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
@@ -4122,27 +4112,27 @@ var utils=utils$9;var bind=bind$2;var Axios=Axios_1;var mergeConfig=mergeConfig$
|
|
4122
4112
|
utils.extend(instance,Axios.prototype,context);// Copy context to instance
|
4123
4113
|
utils.extend(instance,context);// Factory for creating new instances
|
4124
4114
|
instance.create=function create(instanceConfig){return createInstance(mergeConfig(defaultConfig,instanceConfig));};return instance;}// Create the default instance to be exported
|
4125
|
-
var axios$
|
4126
|
-
axios$
|
4127
|
-
axios$
|
4128
|
-
axios$
|
4129
|
-
axios$
|
4130
|
-
axios$
|
4131
|
-
axios$
|
4132
|
-
|
4115
|
+
var axios$2=createInstance(defaults);// Expose Axios class to allow class inheritance
|
4116
|
+
axios$2.Axios=Axios;// Expose Cancel & CancelToken
|
4117
|
+
axios$2.CanceledError=requireCanceledError();axios$2.CancelToken=requireCancelToken();axios$2.isCancel=requireIsCancel();axios$2.VERSION=requireData().version;axios$2.toFormData=requireToFormData();// Expose AxiosError class
|
4118
|
+
axios$2.AxiosError=requireAxiosError();// alias for CanceledError for backward compatibility
|
4119
|
+
axios$2.Cancel=axios$2.CanceledError;// Expose all/spread
|
4120
|
+
axios$2.all=function all(promises){return Promise.all(promises);};axios$2.spread=requireSpread();// Expose isAxiosError
|
4121
|
+
axios$2.isAxiosError=requireIsAxiosError();axios$3.exports=axios$2;// Allow use of default import syntax in TypeScript
|
4122
|
+
axios$3.exports.default=axios$2;var axiosExports=axios$3.exports;
|
4133
4123
|
|
4134
|
-
|
4124
|
+
var axios=axiosExports;var axios$1 = /*@__PURE__*/getDefaultExportFromCjs(axios);
|
4135
4125
|
|
4136
4126
|
var denyList=new Set(['ENOTFOUND','ENETUNREACH',// SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
|
4137
4127
|
'UNABLE_TO_GET_ISSUER_CERT','UNABLE_TO_GET_CRL','UNABLE_TO_DECRYPT_CERT_SIGNATURE','UNABLE_TO_DECRYPT_CRL_SIGNATURE','UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY','CERT_SIGNATURE_FAILURE','CRL_SIGNATURE_FAILURE','CERT_NOT_YET_VALID','CERT_HAS_EXPIRED','CRL_NOT_YET_VALID','CRL_HAS_EXPIRED','ERROR_IN_CERT_NOT_BEFORE_FIELD','ERROR_IN_CERT_NOT_AFTER_FIELD','ERROR_IN_CRL_LAST_UPDATE_FIELD','ERROR_IN_CRL_NEXT_UPDATE_FIELD','OUT_OF_MEM','DEPTH_ZERO_SELF_SIGNED_CERT','SELF_SIGNED_CERT_IN_CHAIN','UNABLE_TO_GET_ISSUER_CERT_LOCALLY','UNABLE_TO_VERIFY_LEAF_SIGNATURE','CERT_CHAIN_TOO_LONG','CERT_REVOKED','INVALID_CA','PATH_LENGTH_EXCEEDED','INVALID_PURPOSE','CERT_UNTRUSTED','CERT_REJECTED','HOSTNAME_MISMATCH']);// TODO: Use `error?.code` when targeting Node.js 14
|
4138
|
-
var isRetryAllowed=function isRetryAllowed(error){return !denyList.has(error&&error.code);};
|
4128
|
+
var isRetryAllowed=function isRetryAllowed(error){return !denyList.has(error&&error.code);};var isRetryAllowed$1 = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowed);
|
4139
4129
|
|
4140
4130
|
function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj;}var namespace='axios-retry';/**
|
4141
4131
|
* @param {Error} error
|
4142
4132
|
* @return {boolean}
|
4143
4133
|
*/function isNetworkError(error){return !error.response&&Boolean(error.code)&&// Prevents retrying cancelled requests
|
4144
4134
|
error.code!=='ECONNABORTED'&&// Prevents retrying timed out requests
|
4145
|
-
isRetryAllowed(error);// Prevents retrying unsafe errors
|
4135
|
+
isRetryAllowed$1(error);// Prevents retrying unsafe errors
|
4146
4136
|
}var SAFE_HTTP_METHODS=['get','head','options'];var IDEMPOTENT_HTTP_METHODS=SAFE_HTTP_METHODS.concat(['put','delete']);/**
|
4147
4137
|
* @param {Error} error
|
4148
4138
|
* @return {boolean}
|
@@ -4274,7 +4264,7 @@ var s=1000;var m=s*60;var h=m*60;var d=h*24;var w=d*7;var y=d*365.25;/**
|
|
4274
4264
|
* @api private
|
4275
4265
|
*/function fmtLong(ms){var msAbs=Math.abs(ms);if(msAbs>=d){return plural(ms,msAbs,d,'day');}if(msAbs>=h){return plural(ms,msAbs,h,'hour');}if(msAbs>=m){return plural(ms,msAbs,m,'minute');}if(msAbs>=s){return plural(ms,msAbs,s,'second');}return ms+' ms';}/**
|
4276
4266
|
* Pluralization helper.
|
4277
|
-
*/function plural(ms,msAbs,n,name){var isPlural=msAbs>=n*1.5;return Math.round(ms/n)+' '+name+(isPlural?'s':'');}
|
4267
|
+
*/function plural(ms,msAbs,n,name){var isPlural=msAbs>=n*1.5;return Math.round(ms/n)+' '+name+(isPlural?'s':'');}var ms$1 = /*@__PURE__*/getDefaultExportFromCjs(ms);
|
4278
4268
|
|
4279
4269
|
var IDX=256,HEX=[],BUFFER;while(IDX--)HEX[IDX]=(IDX+256).toString(16).substring(1);function v4(){var i=0,num,out='';if(!BUFFER||IDX+16>256){BUFFER=Array(i=256);while(i--)BUFFER[i]=256*Math.random()|0;i=IDX=0;}for(;i<16;i++){num=BUFFER[IDX+i];if(i==6)out+=HEX[num&15|64];else if(i==8)out+=HEX[num&63|128];else out+=HEX[num];if(i&1&&i>1&&i<11)out+='-';}IDX++;return out;}
|
4280
4270
|
|
@@ -4340,15 +4330,11 @@ var IDX=256,HEX=[],BUFFER;while(IDX--)HEX[IDX]=(IDX+256).toString(16).substring(
|
|
4340
4330
|
*
|
4341
4331
|
* _.isString(1);
|
4342
4332
|
* // => false
|
4343
|
-
*/function isString(value){return typeof value=='string'||!isArray(value)&&isObjectLike(value)&&objectToString.call(value)==stringTag;}var lodash_isstring=isString;
|
4333
|
+
*/function isString(value){return typeof value=='string'||!isArray(value)&&isObjectLike(value)&&objectToString.call(value)==stringTag;}var lodash_isstring=isString;var isString$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_isstring);
|
4344
4334
|
|
4345
|
-
var
|
4346
|
-
var lodash_clonedeep = {
|
4347
|
-
get exports(){ return lodash_clonedeepExports; },
|
4348
|
-
set exports(v){ lodash_clonedeepExports = v; },
|
4349
|
-
};
|
4335
|
+
var lodash_clonedeep = {exports: {}};
|
4350
4336
|
|
4351
|
-
(function(module,exports){/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;/** Used to stand-in for `undefined` hash values. */var HASH_UNDEFINED='__lodash_hash_undefined__';/** Used as references for various `Number` constants. */var MAX_SAFE_INTEGER=9007199254740991;/** `Object#toString` result references. */var argsTag='[object Arguments]',arrayTag='[object Array]',boolTag='[object Boolean]',dateTag='[object Date]',errorTag='[object Error]',funcTag='[object Function]',genTag='[object GeneratorFunction]',mapTag='[object Map]',numberTag='[object Number]',objectTag='[object Object]',promiseTag='[object Promise]',regexpTag='[object RegExp]',setTag='[object Set]',stringTag='[object String]',symbolTag='[object Symbol]',weakMapTag='[object WeakMap]';var arrayBufferTag='[object ArrayBuffer]',dataViewTag='[object DataView]',float32Tag='[object Float32Array]',float64Tag='[object Float64Array]',int8Tag='[object Int8Array]',int16Tag='[object Int16Array]',int32Tag='[object Int32Array]',uint8Tag='[object Uint8Array]',uint8ClampedTag='[object Uint8ClampedArray]',uint16Tag='[object Uint16Array]',uint32Tag='[object Uint32Array]';/**
|
4337
|
+
lodash_clonedeep.exports;(function(module,exports){/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;/** Used to stand-in for `undefined` hash values. */var HASH_UNDEFINED='__lodash_hash_undefined__';/** Used as references for various `Number` constants. */var MAX_SAFE_INTEGER=9007199254740991;/** `Object#toString` result references. */var argsTag='[object Arguments]',arrayTag='[object Array]',boolTag='[object Boolean]',dateTag='[object Date]',errorTag='[object Error]',funcTag='[object Function]',genTag='[object GeneratorFunction]',mapTag='[object Map]',numberTag='[object Number]',objectTag='[object Object]',promiseTag='[object Promise]',regexpTag='[object RegExp]',setTag='[object Set]',stringTag='[object String]',symbolTag='[object Symbol]',weakMapTag='[object WeakMap]';var arrayBufferTag='[object ArrayBuffer]',dataViewTag='[object DataView]',float32Tag='[object Float32Array]',float64Tag='[object Float64Array]',int8Tag='[object Int8Array]',int16Tag='[object Int16Array]',int32Tag='[object Int32Array]',uint8Tag='[object Uint8Array]',uint8ClampedTag='[object Uint8ClampedArray]',uint16Tag='[object Uint16Array]',uint32Tag='[object Uint32Array]';/**
|
4352
4338
|
* Used to match `RegExp`
|
4353
4339
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
4354
4340
|
*/var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;/** Used to match `RegExp` flags from their coerced string values. */var reFlags=/\w*$/;/** Used to detect host constructors (Safari). */var reIsHostCtor=/^\[object .+?Constructor\]$/;/** Used to detect unsigned integer values. */var reIsUint=/^(?:0|[1-9]\d*)$/;/** Used to identify `toStringTag` values supported by `_.clone`. */var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;/** Detect free variable `global` from Node.js. */var freeGlobal=_typeof(commonjsGlobal)=='object'&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;/** Detect free variable `self`. */var freeSelf=(typeof self==="undefined"?"undefined":_typeof(self))=='object'&&self&&self.Object===Object&&self;/** Used as a reference to the global object. */var root=freeGlobal||freeSelf||Function('return this')();/** Detect free variable `exports`. */var freeExports=exports&&!exports.nodeType&&exports;/** Detect free variable `module`. */var freeModule=freeExports&&'object'=='object'&&module&&!module.nodeType&&module;/** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports;/**
|
@@ -5174,7 +5160,7 @@ var tag=isObject(value)?objectToString.call(value):'';return tag==funcTag||tag==
|
|
5174
5160
|
*
|
5175
5161
|
* _.times(2, _.stubFalse);
|
5176
5162
|
* // => [false, false]
|
5177
|
-
*/function stubFalse(){return false;}module.exports=cloneDeep;})(lodash_clonedeep,
|
5163
|
+
*/function stubFalse(){return false;}module.exports=cloneDeep;})(lodash_clonedeep,lodash_clonedeep.exports);var lodash_clonedeepExports=lodash_clonedeep.exports;var cloneDeep = /*@__PURE__*/getDefaultExportFromCjs(lodash_clonedeepExports);
|
5178
5164
|
|
5179
5165
|
/**
|
5180
5166
|
* - Create a request object
|
@@ -5183,7 +5169,7 @@ var tag=isObject(value)?objectToString.call(value):'';return tag==funcTag||tag==
|
|
5183
5169
|
*/function fetchAdapter(_x){return _fetchAdapter.apply(this,arguments);}/**
|
5184
5170
|
* Fetch API stage two is to get response body. This funtion tries to retrieve
|
5185
5171
|
* response body based on response's type
|
5186
|
-
*/function _fetchAdapter(){_fetchAdapter=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config){var request,promiseChain,data;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:request=createRequest(config);promiseChain=[getResponse(request,config)];if(config.timeout&&config.timeout>0){promiseChain.push(new Promise(function(res){setTimeout(function(){var message=config.timeoutErrorMessage?config.timeoutErrorMessage:'timeout of '+config.timeout+'ms exceeded';res(createError(message,config,'ECONNABORTED',request));},config.timeout);}));}_context.next=5;return Promise.race(promiseChain);case 5:data=_context.sent;return _context.abrupt("return",new Promise(function(resolve,reject){if(data instanceof Error){reject(data);}else {Object.prototype.toString.call(config.settle)==='[object Function]'?config.settle(resolve,reject,data):settle(resolve,reject,data);}}));case 7:case"end":return _context.stop();}},_callee);}));return _fetchAdapter.apply(this,arguments);}function getResponse(_x2,_x3){return _getResponse.apply(this,arguments);}/**
|
5172
|
+
*/function _fetchAdapter(){_fetchAdapter=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config){var request,promiseChain,data;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:request=createRequest(config);promiseChain=[getResponse(request,config)];if(config.timeout&&config.timeout>0){promiseChain.push(new Promise(function(res){setTimeout(function(){var message=config.timeoutErrorMessage?config.timeoutErrorMessage:'timeout of '+config.timeout+'ms exceeded';res(createError(message,config,'ECONNABORTED',request));},config.timeout);}));}_context.next=5;return Promise.race(promiseChain);case 5:data=_context.sent;return _context.abrupt("return",new Promise(function(resolve,reject){if(data instanceof Error){reject(data);}else {Object.prototype.toString.call(config.settle)==='[object Function]'?config.settle(resolve,reject,data):settle$1(resolve,reject,data);}}));case 7:case"end":return _context.stop();}},_callee);}));return _fetchAdapter.apply(this,arguments);}function getResponse(_x2,_x3){return _getResponse.apply(this,arguments);}/**
|
5187
5173
|
* This function will create a Request object based on configuration's axios
|
5188
5174
|
*/function _getResponse(){_getResponse=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request,config){var stageOne,response;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return fetch(request);case 3:stageOne=_context2.sent;_context2.next=9;break;case 6:_context2.prev=6;_context2.t0=_context2["catch"](0);return _context2.abrupt("return",createError('Network Error',config,'ERR_NETWORK',request));case 9:response={ok:stageOne.ok,status:stageOne.status,statusText:stageOne.statusText,headers:new Headers(stageOne.headers),// Make a copy of headers
|
5189
5175
|
config:config,request:request};if(!(stageOne.status>=200&&stageOne.status!==204)){_context2.next=34;break;}_context2.t1=config.responseType;_context2.next=_context2.t1==='arraybuffer'?14:_context2.t1==='blob'?18:_context2.t1==='json'?22:_context2.t1==='formData'?26:30;break;case 14:_context2.next=16;return stageOne.arrayBuffer();case 16:response.data=_context2.sent;return _context2.abrupt("break",34);case 18:_context2.next=20;return stageOne.blob();case 20:response.data=_context2.sent;return _context2.abrupt("break",34);case 22:_context2.next=24;return stageOne.json();case 24:response.data=_context2.sent;return _context2.abrupt("break",34);case 26:_context2.next=28;return stageOne.formData();case 28:response.data=_context2.sent;return _context2.abrupt("break",34);case 30:_context2.next=32;return stageOne.text();case 32:response.data=_context2.sent;return _context2.abrupt("break",34);case 34:return _context2.abrupt("return",response);case 35:case"end":return _context2.stop();}},_callee2,null,[[0,6]]);}));return _getResponse.apply(this,arguments);}function createRequest(config){var headers=new Headers(config.headers);// HTTP basic authentication
|
@@ -5191,7 +5177,7 @@ if(config.auth){var username=config.auth.username||'';var password=config.auth.p
|
|
5191
5177
|
// but only if that header hasn't been set yet. So that's why we're deleting it.
|
5192
5178
|
if(utils$9.isFormData(options.body)&&utils$9.isStandardBrowserEnv()){headers.delete('Content-Type');}}if(config.mode){options.mode=config.mode;}if(config.cache){options.cache=config.cache;}if(config.integrity){options.integrity=config.integrity;}if(config.redirect){options.redirect=config.redirect;}if(config.referrer){options.referrer=config.referrer;}// This config is similar to XHR’s withCredentials flag, but with three available values instead of two.
|
5193
5179
|
// So if withCredentials is not set, default value 'same-origin' will be used
|
5194
|
-
if(!utils$9.isUndefined(config.withCredentials)){options.credentials=config.withCredentials?'include':'omit';}var fullPath=buildFullPath$
|
5180
|
+
if(!utils$9.isUndefined(config.withCredentials)){options.credentials=config.withCredentials?'include':'omit';}var fullPath=buildFullPath$2(config.baseURL,config.url);var url=buildURL$2(fullPath,config.params,config.paramsSerializer);// Expected browser to throw error if there is any wrong configuration value
|
5195
5181
|
return new Request(url,options);}/**
|
5196
5182
|
* Note:
|
5197
5183
|
*
|
@@ -5208,7 +5194,7 @@ return new Request(url,options);}/**
|
|
5208
5194
|
* @param {Object} [request] The request.
|
5209
5195
|
* @param {Object} [response] The response.
|
5210
5196
|
* @returns {Error} The created error.
|
5211
|
-
*/function createError(message,config,code,request,response){if(axios.AxiosError&&typeof axios.AxiosError==='function'){return new axios.AxiosError(message,axios.AxiosError[code],config,request,response);}var error=new Error(message);return enhanceError(error,config,code,request,response);}/**
|
5197
|
+
*/function createError(message,config,code,request,response){if(axios$1.AxiosError&&typeof axios$1.AxiosError==='function'){return new axios$1.AxiosError(message,axios$1.AxiosError[code],config,request,response);}var error=new Error(message);return enhanceError(error,config,code,request,response);}/**
|
5212
5198
|
*
|
5213
5199
|
* Note:
|
5214
5200
|
*
|
@@ -5229,7 +5215,7 @@ description:this.description,number:this.number,// Mozilla
|
|
5229
5215
|
fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,// Axios
|
5230
5216
|
config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null};};return error;}
|
5231
5217
|
|
5232
|
-
var version='2.
|
5218
|
+
var version='2.34.0';var removeTrailingSlashes=function removeTrailingSlashes(inURL){return inURL&&inURL.endsWith('/')?inURL.replace(/\/+$/,''):inURL;};var isFunction=function isFunction(value){return typeof value==='function'&&Boolean(value.constructor&&value.call&&value.apply);};var setImmediate=browser$1.nextTick.bind(browser$1);var noop=function noop(){};var Analytics=/*#__PURE__*/function(){/**
|
5233
5219
|
* Initialize a new `Analytics` with your RudderStack source's `writeKey` and an
|
5234
5220
|
* optional dictionary of `options`.
|
5235
5221
|
*
|
@@ -5243,7 +5229,7 @@ var version='2.33.1';var removeTrailingSlashes=function removeTrailingSlashes(in
|
|
5243
5229
|
* @param {Number} options.timeout (default: false)
|
5244
5230
|
* @param {String=info} options.logLevel (default: info)
|
5245
5231
|
* @param {Function} options.flushOverride (optional)
|
5246
|
-
*/function Analytics(writeKey,dataPlaneURL,options){_classCallCheck(this,Analytics);options=options||{};if(!writeKey){throw new Error('You must pass your project\'s write key.');}if(!dataPlaneURL){throw new Error('You must pass our data plane url.');}this.queue=[];this.writeKey=writeKey;this.host=removeTrailingSlashes(dataPlaneURL);this.timeout=options.timeout||false;this.flushAt=Math.max(options.flushAt,1)||20;this.flushInterval=options.flushInterval||20000;this.maxInternalQueueSize=options.maxInternalQueueSize||20000;this.logLevel=options.logLevel||'info';this.flushOverride=options.flushOverride&&isFunction(options.flushOverride)?options.flushOverride:undefined;this.flushed=false;this.axiosInstance=axios.create({adapter:fetchAdapter});Object.defineProperty(this,'enable',{configurable:false,writable:false,enumerable:true,value:typeof options.enable==='boolean'?options.enable:true});this.logger={error:function error(message){if(this.logLevel!=='off'){var _console;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}(_console=console).error.apply(_console,["".concat(new Date().toISOString()," [\"Rudder\"] error: ").concat(message)].concat(args));}},info:function info(message){if(['silly','debug','info'].includes(this.logLevel)){var _console2;for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}(_console2=console).log.apply(_console2,["".concat(new Date().toISOString()," [\"Rudder\"] info: ").concat(message)].concat(args));}},debug:function debug(message){if(['silly','debug'].includes(this.logLevel)){var _console3;for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}(_console3=console).debug.apply(_console3,["".concat(new Date().toISOString()," [\"Rudder\"] debug: ").concat(message)].concat(args));}},silly:function silly(message){if(['silly'].includes(this.logLevel)){var _console4;for(var _len4=arguments.length,args=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){args[_key4-1]=arguments[_key4];}(_console4=console).info.apply(_console4,["".concat(new Date().toISOString()," [\"Rudder\"] silly: ").concat(message)].concat(args));}}};axiosRetry(this.axiosInstance,{retries:0});}_createClass(Analytics,[{key:"_validate",value:function _validate(message,type){try{
|
5232
|
+
*/function Analytics(writeKey,dataPlaneURL,options){_classCallCheck(this,Analytics);options=options||{};if(!writeKey){throw new Error('You must pass your project\'s write key.');}if(!dataPlaneURL){throw new Error('You must pass our data plane url.');}this.queue=[];this.writeKey=writeKey;this.host=removeTrailingSlashes(dataPlaneURL);this.timeout=options.timeout||false;this.flushAt=Math.max(options.flushAt,1)||20;this.flushInterval=options.flushInterval||20000;this.maxInternalQueueSize=options.maxInternalQueueSize||20000;this.logLevel=options.logLevel||'info';this.flushOverride=options.flushOverride&&isFunction(options.flushOverride)?options.flushOverride:undefined;this.flushed=false;this.axiosInstance=axios$1.create({adapter:fetchAdapter});Object.defineProperty(this,'enable',{configurable:false,writable:false,enumerable:true,value:typeof options.enable==='boolean'?options.enable:true});this.logger={error:function error(message){if(this.logLevel!=='off'){var _console;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}(_console=console).error.apply(_console,["".concat(new Date().toISOString()," [\"Rudder\"] error: ").concat(message)].concat(args));}},info:function info(message){if(['silly','debug','info'].includes(this.logLevel)){var _console2;for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}(_console2=console).log.apply(_console2,["".concat(new Date().toISOString()," [\"Rudder\"] info: ").concat(message)].concat(args));}},debug:function debug(message){if(['silly','debug'].includes(this.logLevel)){var _console3;for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}(_console3=console).debug.apply(_console3,["".concat(new Date().toISOString()," [\"Rudder\"] debug: ").concat(message)].concat(args));}},silly:function silly(message){if(['silly'].includes(this.logLevel)){var _console4;for(var _len4=arguments.length,args=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){args[_key4-1]=arguments[_key4];}(_console4=console).info.apply(_console4,["".concat(new Date().toISOString()," [\"Rudder\"] silly: ").concat(message)].concat(args));}}};axiosRetry(this.axiosInstance,{retries:0});}_createClass(Analytics,[{key:"_validate",value:function _validate(message,type){try{looselyValidate(message,type);}catch(e){if(e.message==='Your message must be < 32kb.'){this.logger.info('Your message must be < 32kb. This is currently surfaced as a warning. Please update your code',message);return;}throw e;}}/**
|
5247
5233
|
* Send an identify `message`.
|
5248
5234
|
*
|
5249
5235
|
* @param {Object} message
|
@@ -5326,7 +5312,7 @@ var version='2.33.1';var removeTrailingSlashes=function removeTrailingSlashes(in
|
|
5326
5312
|
var lMessage=cloneDeep(message);callback=callback||noop;if(!this.enable){return setImmediate(callback);}if(type=='identify'){if(lMessage.traits){if(!lMessage.context){lMessage.context={};}lMessage.context.traits=lMessage.traits;}}lMessage=_objectSpread2({},lMessage);lMessage.type=type;lMessage.context=_objectSpread2({library:{name:'analytics-service-worker',version:version}},lMessage.context);lMessage.channel='service-worker';lMessage._metadata=_objectSpread2({serviceWorkerVersion:version},lMessage._metadata);if(!lMessage.originalTimestamp){lMessage.originalTimestamp=new Date();}if(!lMessage.messageId){lMessage.messageId=v4();}// Historically this library has accepted strings and numbers as IDs.
|
5327
5313
|
// However, our spec only allows strings. To avoid breaking compatibility,
|
5328
5314
|
// we'll coerce these to strings if they aren't already.
|
5329
|
-
if(lMessage.anonymousId&&!
|
5315
|
+
if(lMessage.anonymousId&&!isString$1(lMessage.anonymousId)){lMessage.anonymousId=JSON.stringify(lMessage.anonymousId);}if(lMessage.userId&&!isString$1(lMessage.userId)){lMessage.userId=JSON.stringify(lMessage.userId);}this.queue.push({message:lMessage,callback:callback});if(!this.flushed){this.flushed=true;this.flush();return;}if(this.queue.length>=this.flushAt){this.logger.debug('flushAt reached, trying flush...');this.flush();}if(this.flushInterval&&!this.flushTimer){this.logger.debug('no existing flush timer, creating new one');this.flushTimer=setTimeout(this.flush.bind(this),this.flushInterval);}}/**
|
5330
5316
|
* Flush the current queue
|
5331
5317
|
*
|
5332
5318
|
* @param {Function} [callback] (optional)
|
@@ -5337,7 +5323,7 @@ if(_typeof(item.message)==='object'){item.message.sentAt=new Date();}return item
|
|
5337
5323
|
// the User-Agent header (see https://fetch.spec.whatwg.org/#terminology-headers
|
5338
5324
|
// and https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader),
|
5339
5325
|
// but browsers such as Chrome and Safari have not caught up.
|
5340
|
-
var headers={};if(typeof window==='undefined'){headers['user-agent']="analytics-service-worker/".concat(version);headers['Content-Type']="application/json";}var reqTimeout=typeof this.timeout==='string'?ms(this.timeout):this.timeout;if(this.flushOverride){this.flushOverride({host:"".concat(this.host),writeKey:this.writeKey,data:data,headers:headers,reqTimeout:reqTimeout,flush:this.flush.bind(this),done:done,isErrorRetryable:this._isErrorRetryable.bind(this)});}else {var req={method:'POST',url:"".concat(this.host),auth:{username:this.writeKey},data:data,headers:headers};if(reqTimeout){req.timeout=reqTimeout;}this.axiosInstance(_objectSpread2(_objectSpread2({},req),{},{'axios-retry':{retries:3,retryCondition:this._isErrorRetryable.bind(this),retryDelay:axiosRetry.exponentialDelay}})).then(function(response){_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);done();}).catch(function(err){console.log(err);_this.logger.error("got error while attempting send for 3 times, dropping ".concat(items.length," events"));_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);if(err.response){var error=new Error(err.response.statusText);return done(error);}done(err);});}}},{key:"_isErrorRetryable",value:function _isErrorRetryable(error){// Retry Network Errors.
|
5326
|
+
var headers={};if(typeof window==='undefined'){headers['user-agent']="analytics-service-worker/".concat(version);headers['Content-Type']="application/json";}var reqTimeout=typeof this.timeout==='string'?ms$1(this.timeout):this.timeout;if(this.flushOverride){this.flushOverride({host:"".concat(this.host),writeKey:this.writeKey,data:data,headers:headers,reqTimeout:reqTimeout,flush:this.flush.bind(this),done:done,isErrorRetryable:this._isErrorRetryable.bind(this)});}else {var req={method:'POST',url:"".concat(this.host),auth:{username:this.writeKey},data:data,headers:headers};if(reqTimeout){req.timeout=reqTimeout;}this.axiosInstance(_objectSpread2(_objectSpread2({},req),{},{'axios-retry':{retries:3,retryCondition:this._isErrorRetryable.bind(this),retryDelay:axiosRetry.exponentialDelay}})).then(function(response){_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);done();}).catch(function(err){console.log(err);_this.logger.error("got error while attempting send for 3 times, dropping ".concat(items.length," events"));_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);if(err.response){var error=new Error(err.response.statusText);return done(error);}done(err);});}}},{key:"_isErrorRetryable",value:function _isErrorRetryable(error){// Retry Network Errors.
|
5341
5327
|
if(axiosRetry.isNetworkError(error)){return true;}if(!error.response){// Cannot determine if the request can be retried
|
5342
5328
|
return false;}this.logger.error("error status: ".concat(error.response.status));// Retry Server Errors (5xx).
|
5343
5329
|
if(error.response.status>=500&&error.response.status<=599){return true;}// Retry if rate limited.
|
package/service-worker/index.js
CHANGED
@@ -2814,7 +2814,7 @@
|
|
2814
2814
|
// Also filter out any prototype objects using the circular check.
|
2815
2815
|
!(value.constructor && value.constructor.prototype === value)) {
|
2816
2816
|
var ret = value.inspect(recurseTimes, ctx);
|
2817
|
-
if (!isString$
|
2817
|
+
if (!isString$3(ret)) {
|
2818
2818
|
ret = formatValue(ctx, ret, recurseTimes);
|
2819
2819
|
}
|
2820
2820
|
return ret;
|
@@ -2919,7 +2919,7 @@
|
|
2919
2919
|
function formatPrimitive(ctx, value) {
|
2920
2920
|
if (isUndefined$1(value))
|
2921
2921
|
return ctx.stylize('undefined', 'undefined');
|
2922
|
-
if (isString$
|
2922
|
+
if (isString$3(value)) {
|
2923
2923
|
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
2924
2924
|
.replace(/'/g, "\\'")
|
2925
2925
|
.replace(/\\"/g, '"') + '\'';
|
@@ -3056,7 +3056,7 @@
|
|
3056
3056
|
return typeof arg === 'number';
|
3057
3057
|
}
|
3058
3058
|
|
3059
|
-
function isString$
|
3059
|
+
function isString$3(arg) {
|
3060
3060
|
return typeof arg === 'string';
|
3061
3061
|
}
|
3062
3062
|
|
@@ -3614,19 +3614,9 @@
|
|
3614
3614
|
*/var genericValidationRules={anonymousId:['string','number'],category:'string',context:'object',event:'string',groupId:['string','number'],integrations:'object',name:'string',previousId:['string','number'],timestamp:'date',userId:['string','number'],type:'string'};/**
|
3615
3615
|
* Validate an event object.
|
3616
3616
|
*/function validateGenericEvent(event){assert(type(event)==='object','You must pass a message object.');var json=JSON.stringify(event);// Strings are variable byte encoded, so json.length is not sufficient.
|
3617
|
-
assert(Buffer.byteLength(json,'utf8')<MAX_SIZE,'Your message must be < 32kb.');for(var key in genericValidationRules){var val=event[key];if(!val)continue;var rule=genericValidationRules[key];if(type(rule)!=='array'){rule=[rule];}var a=rule[0]==='object'?'an':'a';assert(rule.some(function(e){return type(val)===e;}),'"'+key+'" must be '+a+' '+join(rule,'or')+'.');}}
|
3617
|
+
assert(Buffer.byteLength(json,'utf8')<MAX_SIZE,'Your message must be < 32kb.');for(var key in genericValidationRules){var val=event[key];if(!val)continue;var rule=genericValidationRules[key];if(type(rule)!=='array'){rule=[rule];}var a=rule[0]==='object'?'an':'a';assert(rule.some(function(e){return type(val)===e;}),'"'+key+'" must be '+a+' '+join(rule,'or')+'.');}}var looselyValidate = /*@__PURE__*/getDefaultExportFromCjs(looselyValidateEvent_1);
|
3618
3618
|
|
3619
|
-
var
|
3620
|
-
var axios$3 = {
|
3621
|
-
get exports(){ return axiosExports$1; },
|
3622
|
-
set exports(v){ axiosExports$1 = v; },
|
3623
|
-
};
|
3624
|
-
|
3625
|
-
var axiosExports = {};
|
3626
|
-
var axios$2 = {
|
3627
|
-
get exports(){ return axiosExports; },
|
3628
|
-
set exports(v){ axiosExports = v; },
|
3629
|
-
};
|
3619
|
+
var axios$3 = {exports: {}};
|
3630
3620
|
|
3631
3621
|
var bind$2=function bind(fn,thisArg){return function wrap(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}return fn.apply(thisArg,args);};};
|
3632
3622
|
|
@@ -3664,7 +3654,7 @@
|
|
3664
3654
|
*
|
3665
3655
|
* @param {Object} val The value to test
|
3666
3656
|
* @returns {boolean} True if value is a String, otherwise false
|
3667
|
-
*/function isString$
|
3657
|
+
*/function isString$2(val){return typeof val==='string';}/**
|
3668
3658
|
* Determine if a value is a Number
|
3669
3659
|
*
|
3670
3660
|
* @param {Object} val The value to test
|
@@ -3809,7 +3799,7 @@
|
|
3809
3799
|
* @returns {Array}
|
3810
3800
|
*/function toArray(thing){if(!thing)return null;var i=thing.length;if(isUndefined(i))return null;var arr=new Array(i);while(i-->0){arr[i]=thing[i];}return arr;}// eslint-disable-next-line func-names
|
3811
3801
|
var isTypedArray=function(TypedArray){// eslint-disable-next-line func-names
|
3812
|
-
return function(thing){return TypedArray&&thing instanceof TypedArray;};}(typeof Uint8Array!=='undefined'&&Object.getPrototypeOf(Uint8Array));var utils$9={isArray:isArray$1,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString$
|
3802
|
+
return function(thing){return TypedArray&&thing instanceof TypedArray;};}(typeof Uint8Array!=='undefined'&&Object.getPrototypeOf(Uint8Array));var utils$9={isArray:isArray$1,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString$2,isNumber:isNumber,isObject:isObject,isPlainObject:isPlainObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction$1,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:kindOf,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,isTypedArray:isTypedArray,isFileList:isFileList};
|
3813
3803
|
|
3814
3804
|
var utils$8=utils$9;function encode(val){return encodeURIComponent(val).replace(/%3A/gi,':').replace(/%24/g,'$').replace(/%2C/gi,',').replace(/%20/g,'+').replace(/%5B/gi,'[').replace(/%5D/gi,']');}/**
|
3815
3805
|
* Build a URL by appending params to the end
|
@@ -3817,7 +3807,7 @@
|
|
3817
3807
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
3818
3808
|
* @param {object} [params] The params to be appended
|
3819
3809
|
* @returns {string} The formatted url
|
3820
|
-
*/var buildURL$1=function buildURL(url,params,paramsSerializer){/*eslint no-param-reassign:0*/if(!params){return url;}var serializedParams;if(paramsSerializer){serializedParams=paramsSerializer(params);}else if(utils$8.isURLSearchParams(params)){serializedParams=params.toString();}else {var parts=[];utils$8.forEach(params,function serialize(val,key){if(val===null||typeof val==='undefined'){return;}if(utils$8.isArray(val)){key=key+'[]';}else {val=[val];}utils$8.forEach(val,function parseValue(v){if(utils$8.isDate(v)){v=v.toISOString();}else if(utils$8.isObject(v)){v=JSON.stringify(v);}parts.push(encode(key)+'='+encode(v));});});serializedParams=parts.join('&');}if(serializedParams){var hashmarkIndex=url.indexOf('#');if(hashmarkIndex!==-1){url=url.slice(0,hashmarkIndex);}url+=(url.indexOf('?')===-1?'?':'&')+serializedParams;}return url;};
|
3810
|
+
*/var buildURL$1=function buildURL(url,params,paramsSerializer){/*eslint no-param-reassign:0*/if(!params){return url;}var serializedParams;if(paramsSerializer){serializedParams=paramsSerializer(params);}else if(utils$8.isURLSearchParams(params)){serializedParams=params.toString();}else {var parts=[];utils$8.forEach(params,function serialize(val,key){if(val===null||typeof val==='undefined'){return;}if(utils$8.isArray(val)){key=key+'[]';}else {val=[val];}utils$8.forEach(val,function parseValue(v){if(utils$8.isDate(v)){v=v.toISOString();}else if(utils$8.isObject(v)){v=JSON.stringify(v);}parts.push(encode(key)+'='+encode(v));});});serializedParams=parts.join('&');}if(serializedParams){var hashmarkIndex=url.indexOf('#');if(hashmarkIndex!==-1){url=url.slice(0,hashmarkIndex);}url+=(url.indexOf('?')===-1?'?':'&')+serializedParams;}return url;};var buildURL$2 = /*@__PURE__*/getDefaultExportFromCjs(buildURL$1);
|
3821
3811
|
|
3822
3812
|
var utils$7=utils$9;function InterceptorManager$1(){this.handlers=[];}/**
|
3823
3813
|
* Add a new interceptor to the stack
|
@@ -3876,7 +3866,7 @@
|
|
3876
3866
|
* @param {Function} resolve A function that resolves the promise.
|
3877
3867
|
* @param {Function} reject A function that rejects the promise.
|
3878
3868
|
* @param {object} response The response.
|
3879
|
-
*/var settle=function settle(resolve,reject,response){var validateStatus=response.config.validateStatus;if(!response.status||!validateStatus||validateStatus(response.status)){resolve(response);}else {reject(new AxiosError$2('Request failed with status code '+response.status,[AxiosError$2.ERR_BAD_REQUEST,AxiosError$2.ERR_BAD_RESPONSE][Math.floor(response.status/100)-4],response.config,response.request,response));}};
|
3869
|
+
*/var settle=function settle(resolve,reject,response){var validateStatus=response.config.validateStatus;if(!response.status||!validateStatus||validateStatus(response.status)){resolve(response);}else {reject(new AxiosError$2('Request failed with status code '+response.status,[AxiosError$2.ERR_BAD_REQUEST,AxiosError$2.ERR_BAD_RESPONSE][Math.floor(response.status/100)-4],response.config,response.request,response));}};var settle$1 = /*@__PURE__*/getDefaultExportFromCjs(settle);
|
3880
3870
|
|
3881
3871
|
var cookies;var hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var utils=utils$9;cookies=utils.isStandardBrowserEnv()?// Standard browser envs support document.cookie
|
3882
3872
|
function standardBrowserEnv(){return {write:function write(name,value,expires,path,domain,secure){var cookie=[];cookie.push(name+'='+encodeURIComponent(value));if(utils.isNumber(expires)){cookie.push('expires='+new Date(expires).toGMTString());}if(utils.isString(path)){cookie.push('path='+path);}if(utils.isString(domain)){cookie.push('domain='+domain);}if(secure===true){cookie.push('secure');}document.cookie=cookie.join('; ');},read:function read(name){var match=document.cookie.match(new RegExp('(^|;\\s*)('+name+')=([^;]*)'));return match?decodeURIComponent(match[3]):null;},remove:function remove(name){this.write(name,'',Date.now()-86400000);}};}():// Non standard browser env (web workers, react-native) lack needed support.
|
@@ -3908,7 +3898,7 @@
|
|
3908
3898
|
* @param {string} baseURL The base URL
|
3909
3899
|
* @param {string} requestedURL Absolute or relative URL to combine
|
3910
3900
|
* @returns {string} The combined full path
|
3911
|
-
*/var buildFullPath$1=function buildFullPath(baseURL,requestedURL){if(baseURL&&!isAbsoluteURL(requestedURL)){return combineURLs(baseURL,requestedURL);}return requestedURL;};
|
3901
|
+
*/var buildFullPath$1=function buildFullPath(baseURL,requestedURL){if(baseURL&&!isAbsoluteURL(requestedURL)){return combineURLs(baseURL,requestedURL);}return requestedURL;};var buildFullPath$2 = /*@__PURE__*/getDefaultExportFromCjs(buildFullPath$1);
|
3912
3902
|
|
3913
3903
|
var parseHeaders;var hasRequiredParseHeaders;function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var utils=utils$9;// Headers whose duplicates are ignored by node
|
3914
3904
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
@@ -4128,27 +4118,27 @@
|
|
4128
4118
|
utils.extend(instance,Axios.prototype,context);// Copy context to instance
|
4129
4119
|
utils.extend(instance,context);// Factory for creating new instances
|
4130
4120
|
instance.create=function create(instanceConfig){return createInstance(mergeConfig(defaultConfig,instanceConfig));};return instance;}// Create the default instance to be exported
|
4131
|
-
var axios$
|
4132
|
-
axios$
|
4133
|
-
axios$
|
4134
|
-
axios$
|
4135
|
-
axios$
|
4136
|
-
axios$
|
4137
|
-
axios$
|
4138
|
-
|
4121
|
+
var axios$2=createInstance(defaults);// Expose Axios class to allow class inheritance
|
4122
|
+
axios$2.Axios=Axios;// Expose Cancel & CancelToken
|
4123
|
+
axios$2.CanceledError=requireCanceledError();axios$2.CancelToken=requireCancelToken();axios$2.isCancel=requireIsCancel();axios$2.VERSION=requireData().version;axios$2.toFormData=requireToFormData();// Expose AxiosError class
|
4124
|
+
axios$2.AxiosError=requireAxiosError();// alias for CanceledError for backward compatibility
|
4125
|
+
axios$2.Cancel=axios$2.CanceledError;// Expose all/spread
|
4126
|
+
axios$2.all=function all(promises){return Promise.all(promises);};axios$2.spread=requireSpread();// Expose isAxiosError
|
4127
|
+
axios$2.isAxiosError=requireIsAxiosError();axios$3.exports=axios$2;// Allow use of default import syntax in TypeScript
|
4128
|
+
axios$3.exports.default=axios$2;var axiosExports=axios$3.exports;
|
4139
4129
|
|
4140
|
-
|
4130
|
+
var axios=axiosExports;var axios$1 = /*@__PURE__*/getDefaultExportFromCjs(axios);
|
4141
4131
|
|
4142
4132
|
var denyList=new Set(['ENOTFOUND','ENETUNREACH',// SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
|
4143
4133
|
'UNABLE_TO_GET_ISSUER_CERT','UNABLE_TO_GET_CRL','UNABLE_TO_DECRYPT_CERT_SIGNATURE','UNABLE_TO_DECRYPT_CRL_SIGNATURE','UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY','CERT_SIGNATURE_FAILURE','CRL_SIGNATURE_FAILURE','CERT_NOT_YET_VALID','CERT_HAS_EXPIRED','CRL_NOT_YET_VALID','CRL_HAS_EXPIRED','ERROR_IN_CERT_NOT_BEFORE_FIELD','ERROR_IN_CERT_NOT_AFTER_FIELD','ERROR_IN_CRL_LAST_UPDATE_FIELD','ERROR_IN_CRL_NEXT_UPDATE_FIELD','OUT_OF_MEM','DEPTH_ZERO_SELF_SIGNED_CERT','SELF_SIGNED_CERT_IN_CHAIN','UNABLE_TO_GET_ISSUER_CERT_LOCALLY','UNABLE_TO_VERIFY_LEAF_SIGNATURE','CERT_CHAIN_TOO_LONG','CERT_REVOKED','INVALID_CA','PATH_LENGTH_EXCEEDED','INVALID_PURPOSE','CERT_UNTRUSTED','CERT_REJECTED','HOSTNAME_MISMATCH']);// TODO: Use `error?.code` when targeting Node.js 14
|
4144
|
-
var isRetryAllowed=function isRetryAllowed(error){return !denyList.has(error&&error.code);};
|
4134
|
+
var isRetryAllowed=function isRetryAllowed(error){return !denyList.has(error&&error.code);};var isRetryAllowed$1 = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowed);
|
4145
4135
|
|
4146
4136
|
function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj;}var namespace='axios-retry';/**
|
4147
4137
|
* @param {Error} error
|
4148
4138
|
* @return {boolean}
|
4149
4139
|
*/function isNetworkError(error){return !error.response&&Boolean(error.code)&&// Prevents retrying cancelled requests
|
4150
4140
|
error.code!=='ECONNABORTED'&&// Prevents retrying timed out requests
|
4151
|
-
isRetryAllowed(error);// Prevents retrying unsafe errors
|
4141
|
+
isRetryAllowed$1(error);// Prevents retrying unsafe errors
|
4152
4142
|
}var SAFE_HTTP_METHODS=['get','head','options'];var IDEMPOTENT_HTTP_METHODS=SAFE_HTTP_METHODS.concat(['put','delete']);/**
|
4153
4143
|
* @param {Error} error
|
4154
4144
|
* @return {boolean}
|
@@ -4280,7 +4270,7 @@
|
|
4280
4270
|
* @api private
|
4281
4271
|
*/function fmtLong(ms){var msAbs=Math.abs(ms);if(msAbs>=d){return plural(ms,msAbs,d,'day');}if(msAbs>=h){return plural(ms,msAbs,h,'hour');}if(msAbs>=m){return plural(ms,msAbs,m,'minute');}if(msAbs>=s){return plural(ms,msAbs,s,'second');}return ms+' ms';}/**
|
4282
4272
|
* Pluralization helper.
|
4283
|
-
*/function plural(ms,msAbs,n,name){var isPlural=msAbs>=n*1.5;return Math.round(ms/n)+' '+name+(isPlural?'s':'');}
|
4273
|
+
*/function plural(ms,msAbs,n,name){var isPlural=msAbs>=n*1.5;return Math.round(ms/n)+' '+name+(isPlural?'s':'');}var ms$1 = /*@__PURE__*/getDefaultExportFromCjs(ms);
|
4284
4274
|
|
4285
4275
|
var IDX=256,HEX=[],BUFFER;while(IDX--)HEX[IDX]=(IDX+256).toString(16).substring(1);function v4(){var i=0,num,out='';if(!BUFFER||IDX+16>256){BUFFER=Array(i=256);while(i--)BUFFER[i]=256*Math.random()|0;i=IDX=0;}for(;i<16;i++){num=BUFFER[IDX+i];if(i==6)out+=HEX[num&15|64];else if(i==8)out+=HEX[num&63|128];else out+=HEX[num];if(i&1&&i>1&&i<11)out+='-';}IDX++;return out;}
|
4286
4276
|
|
@@ -4346,15 +4336,11 @@
|
|
4346
4336
|
*
|
4347
4337
|
* _.isString(1);
|
4348
4338
|
* // => false
|
4349
|
-
*/function isString(value){return typeof value=='string'||!isArray(value)&&isObjectLike(value)&&objectToString.call(value)==stringTag;}var lodash_isstring=isString;
|
4339
|
+
*/function isString(value){return typeof value=='string'||!isArray(value)&&isObjectLike(value)&&objectToString.call(value)==stringTag;}var lodash_isstring=isString;var isString$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_isstring);
|
4350
4340
|
|
4351
|
-
var
|
4352
|
-
var lodash_clonedeep = {
|
4353
|
-
get exports(){ return lodash_clonedeepExports; },
|
4354
|
-
set exports(v){ lodash_clonedeepExports = v; },
|
4355
|
-
};
|
4341
|
+
var lodash_clonedeep = {exports: {}};
|
4356
4342
|
|
4357
|
-
(function(module,exports){/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;/** Used to stand-in for `undefined` hash values. */var HASH_UNDEFINED='__lodash_hash_undefined__';/** Used as references for various `Number` constants. */var MAX_SAFE_INTEGER=9007199254740991;/** `Object#toString` result references. */var argsTag='[object Arguments]',arrayTag='[object Array]',boolTag='[object Boolean]',dateTag='[object Date]',errorTag='[object Error]',funcTag='[object Function]',genTag='[object GeneratorFunction]',mapTag='[object Map]',numberTag='[object Number]',objectTag='[object Object]',promiseTag='[object Promise]',regexpTag='[object RegExp]',setTag='[object Set]',stringTag='[object String]',symbolTag='[object Symbol]',weakMapTag='[object WeakMap]';var arrayBufferTag='[object ArrayBuffer]',dataViewTag='[object DataView]',float32Tag='[object Float32Array]',float64Tag='[object Float64Array]',int8Tag='[object Int8Array]',int16Tag='[object Int16Array]',int32Tag='[object Int32Array]',uint8Tag='[object Uint8Array]',uint8ClampedTag='[object Uint8ClampedArray]',uint16Tag='[object Uint16Array]',uint32Tag='[object Uint32Array]';/**
|
4343
|
+
lodash_clonedeep.exports;(function(module,exports){/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;/** Used to stand-in for `undefined` hash values. */var HASH_UNDEFINED='__lodash_hash_undefined__';/** Used as references for various `Number` constants. */var MAX_SAFE_INTEGER=9007199254740991;/** `Object#toString` result references. */var argsTag='[object Arguments]',arrayTag='[object Array]',boolTag='[object Boolean]',dateTag='[object Date]',errorTag='[object Error]',funcTag='[object Function]',genTag='[object GeneratorFunction]',mapTag='[object Map]',numberTag='[object Number]',objectTag='[object Object]',promiseTag='[object Promise]',regexpTag='[object RegExp]',setTag='[object Set]',stringTag='[object String]',symbolTag='[object Symbol]',weakMapTag='[object WeakMap]';var arrayBufferTag='[object ArrayBuffer]',dataViewTag='[object DataView]',float32Tag='[object Float32Array]',float64Tag='[object Float64Array]',int8Tag='[object Int8Array]',int16Tag='[object Int16Array]',int32Tag='[object Int32Array]',uint8Tag='[object Uint8Array]',uint8ClampedTag='[object Uint8ClampedArray]',uint16Tag='[object Uint16Array]',uint32Tag='[object Uint32Array]';/**
|
4358
4344
|
* Used to match `RegExp`
|
4359
4345
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
4360
4346
|
*/var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;/** Used to match `RegExp` flags from their coerced string values. */var reFlags=/\w*$/;/** Used to detect host constructors (Safari). */var reIsHostCtor=/^\[object .+?Constructor\]$/;/** Used to detect unsigned integer values. */var reIsUint=/^(?:0|[1-9]\d*)$/;/** Used to identify `toStringTag` values supported by `_.clone`. */var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;/** Detect free variable `global` from Node.js. */var freeGlobal=_typeof(commonjsGlobal)=='object'&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;/** Detect free variable `self`. */var freeSelf=(typeof self==="undefined"?"undefined":_typeof(self))=='object'&&self&&self.Object===Object&&self;/** Used as a reference to the global object. */var root=freeGlobal||freeSelf||Function('return this')();/** Detect free variable `exports`. */var freeExports=exports&&!exports.nodeType&&exports;/** Detect free variable `module`. */var freeModule=freeExports&&'object'=='object'&&module&&!module.nodeType&&module;/** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports;/**
|
@@ -5180,7 +5166,7 @@
|
|
5180
5166
|
*
|
5181
5167
|
* _.times(2, _.stubFalse);
|
5182
5168
|
* // => [false, false]
|
5183
|
-
*/function stubFalse(){return false;}module.exports=cloneDeep;})(lodash_clonedeep,
|
5169
|
+
*/function stubFalse(){return false;}module.exports=cloneDeep;})(lodash_clonedeep,lodash_clonedeep.exports);var lodash_clonedeepExports=lodash_clonedeep.exports;var cloneDeep = /*@__PURE__*/getDefaultExportFromCjs(lodash_clonedeepExports);
|
5184
5170
|
|
5185
5171
|
/**
|
5186
5172
|
* - Create a request object
|
@@ -5189,7 +5175,7 @@
|
|
5189
5175
|
*/function fetchAdapter(_x){return _fetchAdapter.apply(this,arguments);}/**
|
5190
5176
|
* Fetch API stage two is to get response body. This funtion tries to retrieve
|
5191
5177
|
* response body based on response's type
|
5192
|
-
*/function _fetchAdapter(){_fetchAdapter=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config){var request,promiseChain,data;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:request=createRequest(config);promiseChain=[getResponse(request,config)];if(config.timeout&&config.timeout>0){promiseChain.push(new Promise(function(res){setTimeout(function(){var message=config.timeoutErrorMessage?config.timeoutErrorMessage:'timeout of '+config.timeout+'ms exceeded';res(createError(message,config,'ECONNABORTED',request));},config.timeout);}));}_context.next=5;return Promise.race(promiseChain);case 5:data=_context.sent;return _context.abrupt("return",new Promise(function(resolve,reject){if(data instanceof Error){reject(data);}else {Object.prototype.toString.call(config.settle)==='[object Function]'?config.settle(resolve,reject,data):settle(resolve,reject,data);}}));case 7:case"end":return _context.stop();}},_callee);}));return _fetchAdapter.apply(this,arguments);}function getResponse(_x2,_x3){return _getResponse.apply(this,arguments);}/**
|
5178
|
+
*/function _fetchAdapter(){_fetchAdapter=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config){var request,promiseChain,data;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:request=createRequest(config);promiseChain=[getResponse(request,config)];if(config.timeout&&config.timeout>0){promiseChain.push(new Promise(function(res){setTimeout(function(){var message=config.timeoutErrorMessage?config.timeoutErrorMessage:'timeout of '+config.timeout+'ms exceeded';res(createError(message,config,'ECONNABORTED',request));},config.timeout);}));}_context.next=5;return Promise.race(promiseChain);case 5:data=_context.sent;return _context.abrupt("return",new Promise(function(resolve,reject){if(data instanceof Error){reject(data);}else {Object.prototype.toString.call(config.settle)==='[object Function]'?config.settle(resolve,reject,data):settle$1(resolve,reject,data);}}));case 7:case"end":return _context.stop();}},_callee);}));return _fetchAdapter.apply(this,arguments);}function getResponse(_x2,_x3){return _getResponse.apply(this,arguments);}/**
|
5193
5179
|
* This function will create a Request object based on configuration's axios
|
5194
5180
|
*/function _getResponse(){_getResponse=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request,config){var stageOne,response;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return fetch(request);case 3:stageOne=_context2.sent;_context2.next=9;break;case 6:_context2.prev=6;_context2.t0=_context2["catch"](0);return _context2.abrupt("return",createError('Network Error',config,'ERR_NETWORK',request));case 9:response={ok:stageOne.ok,status:stageOne.status,statusText:stageOne.statusText,headers:new Headers(stageOne.headers),// Make a copy of headers
|
5195
5181
|
config:config,request:request};if(!(stageOne.status>=200&&stageOne.status!==204)){_context2.next=34;break;}_context2.t1=config.responseType;_context2.next=_context2.t1==='arraybuffer'?14:_context2.t1==='blob'?18:_context2.t1==='json'?22:_context2.t1==='formData'?26:30;break;case 14:_context2.next=16;return stageOne.arrayBuffer();case 16:response.data=_context2.sent;return _context2.abrupt("break",34);case 18:_context2.next=20;return stageOne.blob();case 20:response.data=_context2.sent;return _context2.abrupt("break",34);case 22:_context2.next=24;return stageOne.json();case 24:response.data=_context2.sent;return _context2.abrupt("break",34);case 26:_context2.next=28;return stageOne.formData();case 28:response.data=_context2.sent;return _context2.abrupt("break",34);case 30:_context2.next=32;return stageOne.text();case 32:response.data=_context2.sent;return _context2.abrupt("break",34);case 34:return _context2.abrupt("return",response);case 35:case"end":return _context2.stop();}},_callee2,null,[[0,6]]);}));return _getResponse.apply(this,arguments);}function createRequest(config){var headers=new Headers(config.headers);// HTTP basic authentication
|
@@ -5197,7 +5183,7 @@
|
|
5197
5183
|
// but only if that header hasn't been set yet. So that's why we're deleting it.
|
5198
5184
|
if(utils$9.isFormData(options.body)&&utils$9.isStandardBrowserEnv()){headers.delete('Content-Type');}}if(config.mode){options.mode=config.mode;}if(config.cache){options.cache=config.cache;}if(config.integrity){options.integrity=config.integrity;}if(config.redirect){options.redirect=config.redirect;}if(config.referrer){options.referrer=config.referrer;}// This config is similar to XHR’s withCredentials flag, but with three available values instead of two.
|
5199
5185
|
// So if withCredentials is not set, default value 'same-origin' will be used
|
5200
|
-
if(!utils$9.isUndefined(config.withCredentials)){options.credentials=config.withCredentials?'include':'omit';}var fullPath=buildFullPath$
|
5186
|
+
if(!utils$9.isUndefined(config.withCredentials)){options.credentials=config.withCredentials?'include':'omit';}var fullPath=buildFullPath$2(config.baseURL,config.url);var url=buildURL$2(fullPath,config.params,config.paramsSerializer);// Expected browser to throw error if there is any wrong configuration value
|
5201
5187
|
return new Request(url,options);}/**
|
5202
5188
|
* Note:
|
5203
5189
|
*
|
@@ -5214,7 +5200,7 @@
|
|
5214
5200
|
* @param {Object} [request] The request.
|
5215
5201
|
* @param {Object} [response] The response.
|
5216
5202
|
* @returns {Error} The created error.
|
5217
|
-
*/function createError(message,config,code,request,response){if(axios.AxiosError&&typeof axios.AxiosError==='function'){return new axios.AxiosError(message,axios.AxiosError[code],config,request,response);}var error=new Error(message);return enhanceError(error,config,code,request,response);}/**
|
5203
|
+
*/function createError(message,config,code,request,response){if(axios$1.AxiosError&&typeof axios$1.AxiosError==='function'){return new axios$1.AxiosError(message,axios$1.AxiosError[code],config,request,response);}var error=new Error(message);return enhanceError(error,config,code,request,response);}/**
|
5218
5204
|
*
|
5219
5205
|
* Note:
|
5220
5206
|
*
|
@@ -5235,7 +5221,7 @@
|
|
5235
5221
|
fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,// Axios
|
5236
5222
|
config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null};};return error;}
|
5237
5223
|
|
5238
|
-
var version='2.
|
5224
|
+
var version='2.34.0';var removeTrailingSlashes=function removeTrailingSlashes(inURL){return inURL&&inURL.endsWith('/')?inURL.replace(/\/+$/,''):inURL;};var isFunction=function isFunction(value){return typeof value==='function'&&Boolean(value.constructor&&value.call&&value.apply);};var setImmediate=browser$1.nextTick.bind(browser$1);var noop=function noop(){};var Analytics=/*#__PURE__*/function(){/**
|
5239
5225
|
* Initialize a new `Analytics` with your RudderStack source's `writeKey` and an
|
5240
5226
|
* optional dictionary of `options`.
|
5241
5227
|
*
|
@@ -5249,7 +5235,7 @@
|
|
5249
5235
|
* @param {Number} options.timeout (default: false)
|
5250
5236
|
* @param {String=info} options.logLevel (default: info)
|
5251
5237
|
* @param {Function} options.flushOverride (optional)
|
5252
|
-
*/function Analytics(writeKey,dataPlaneURL,options){_classCallCheck(this,Analytics);options=options||{};if(!writeKey){throw new Error('You must pass your project\'s write key.');}if(!dataPlaneURL){throw new Error('You must pass our data plane url.');}this.queue=[];this.writeKey=writeKey;this.host=removeTrailingSlashes(dataPlaneURL);this.timeout=options.timeout||false;this.flushAt=Math.max(options.flushAt,1)||20;this.flushInterval=options.flushInterval||20000;this.maxInternalQueueSize=options.maxInternalQueueSize||20000;this.logLevel=options.logLevel||'info';this.flushOverride=options.flushOverride&&isFunction(options.flushOverride)?options.flushOverride:undefined;this.flushed=false;this.axiosInstance=axios.create({adapter:fetchAdapter});Object.defineProperty(this,'enable',{configurable:false,writable:false,enumerable:true,value:typeof options.enable==='boolean'?options.enable:true});this.logger={error:function error(message){if(this.logLevel!=='off'){var _console;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}(_console=console).error.apply(_console,["".concat(new Date().toISOString()," [\"Rudder\"] error: ").concat(message)].concat(args));}},info:function info(message){if(['silly','debug','info'].includes(this.logLevel)){var _console2;for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}(_console2=console).log.apply(_console2,["".concat(new Date().toISOString()," [\"Rudder\"] info: ").concat(message)].concat(args));}},debug:function debug(message){if(['silly','debug'].includes(this.logLevel)){var _console3;for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}(_console3=console).debug.apply(_console3,["".concat(new Date().toISOString()," [\"Rudder\"] debug: ").concat(message)].concat(args));}},silly:function silly(message){if(['silly'].includes(this.logLevel)){var _console4;for(var _len4=arguments.length,args=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){args[_key4-1]=arguments[_key4];}(_console4=console).info.apply(_console4,["".concat(new Date().toISOString()," [\"Rudder\"] silly: ").concat(message)].concat(args));}}};axiosRetry(this.axiosInstance,{retries:0});}_createClass(Analytics,[{key:"_validate",value:function _validate(message,type){try{
|
5238
|
+
*/function Analytics(writeKey,dataPlaneURL,options){_classCallCheck(this,Analytics);options=options||{};if(!writeKey){throw new Error('You must pass your project\'s write key.');}if(!dataPlaneURL){throw new Error('You must pass our data plane url.');}this.queue=[];this.writeKey=writeKey;this.host=removeTrailingSlashes(dataPlaneURL);this.timeout=options.timeout||false;this.flushAt=Math.max(options.flushAt,1)||20;this.flushInterval=options.flushInterval||20000;this.maxInternalQueueSize=options.maxInternalQueueSize||20000;this.logLevel=options.logLevel||'info';this.flushOverride=options.flushOverride&&isFunction(options.flushOverride)?options.flushOverride:undefined;this.flushed=false;this.axiosInstance=axios$1.create({adapter:fetchAdapter});Object.defineProperty(this,'enable',{configurable:false,writable:false,enumerable:true,value:typeof options.enable==='boolean'?options.enable:true});this.logger={error:function error(message){if(this.logLevel!=='off'){var _console;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}(_console=console).error.apply(_console,["".concat(new Date().toISOString()," [\"Rudder\"] error: ").concat(message)].concat(args));}},info:function info(message){if(['silly','debug','info'].includes(this.logLevel)){var _console2;for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}(_console2=console).log.apply(_console2,["".concat(new Date().toISOString()," [\"Rudder\"] info: ").concat(message)].concat(args));}},debug:function debug(message){if(['silly','debug'].includes(this.logLevel)){var _console3;for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}(_console3=console).debug.apply(_console3,["".concat(new Date().toISOString()," [\"Rudder\"] debug: ").concat(message)].concat(args));}},silly:function silly(message){if(['silly'].includes(this.logLevel)){var _console4;for(var _len4=arguments.length,args=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){args[_key4-1]=arguments[_key4];}(_console4=console).info.apply(_console4,["".concat(new Date().toISOString()," [\"Rudder\"] silly: ").concat(message)].concat(args));}}};axiosRetry(this.axiosInstance,{retries:0});}_createClass(Analytics,[{key:"_validate",value:function _validate(message,type){try{looselyValidate(message,type);}catch(e){if(e.message==='Your message must be < 32kb.'){this.logger.info('Your message must be < 32kb. This is currently surfaced as a warning. Please update your code',message);return;}throw e;}}/**
|
5253
5239
|
* Send an identify `message`.
|
5254
5240
|
*
|
5255
5241
|
* @param {Object} message
|
@@ -5332,7 +5318,7 @@
|
|
5332
5318
|
var lMessage=cloneDeep(message);callback=callback||noop;if(!this.enable){return setImmediate(callback);}if(type=='identify'){if(lMessage.traits){if(!lMessage.context){lMessage.context={};}lMessage.context.traits=lMessage.traits;}}lMessage=_objectSpread2({},lMessage);lMessage.type=type;lMessage.context=_objectSpread2({library:{name:'analytics-service-worker',version:version}},lMessage.context);lMessage.channel='service-worker';lMessage._metadata=_objectSpread2({serviceWorkerVersion:version},lMessage._metadata);if(!lMessage.originalTimestamp){lMessage.originalTimestamp=new Date();}if(!lMessage.messageId){lMessage.messageId=v4();}// Historically this library has accepted strings and numbers as IDs.
|
5333
5319
|
// However, our spec only allows strings. To avoid breaking compatibility,
|
5334
5320
|
// we'll coerce these to strings if they aren't already.
|
5335
|
-
if(lMessage.anonymousId&&!
|
5321
|
+
if(lMessage.anonymousId&&!isString$1(lMessage.anonymousId)){lMessage.anonymousId=JSON.stringify(lMessage.anonymousId);}if(lMessage.userId&&!isString$1(lMessage.userId)){lMessage.userId=JSON.stringify(lMessage.userId);}this.queue.push({message:lMessage,callback:callback});if(!this.flushed){this.flushed=true;this.flush();return;}if(this.queue.length>=this.flushAt){this.logger.debug('flushAt reached, trying flush...');this.flush();}if(this.flushInterval&&!this.flushTimer){this.logger.debug('no existing flush timer, creating new one');this.flushTimer=setTimeout(this.flush.bind(this),this.flushInterval);}}/**
|
5336
5322
|
* Flush the current queue
|
5337
5323
|
*
|
5338
5324
|
* @param {Function} [callback] (optional)
|
@@ -5343,7 +5329,7 @@
|
|
5343
5329
|
// the User-Agent header (see https://fetch.spec.whatwg.org/#terminology-headers
|
5344
5330
|
// and https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader),
|
5345
5331
|
// but browsers such as Chrome and Safari have not caught up.
|
5346
|
-
var headers={};if(typeof window==='undefined'){headers['user-agent']="analytics-service-worker/".concat(version);headers['Content-Type']="application/json";}var reqTimeout=typeof this.timeout==='string'?ms(this.timeout):this.timeout;if(this.flushOverride){this.flushOverride({host:"".concat(this.host),writeKey:this.writeKey,data:data,headers:headers,reqTimeout:reqTimeout,flush:this.flush.bind(this),done:done,isErrorRetryable:this._isErrorRetryable.bind(this)});}else {var req={method:'POST',url:"".concat(this.host),auth:{username:this.writeKey},data:data,headers:headers};if(reqTimeout){req.timeout=reqTimeout;}this.axiosInstance(_objectSpread2(_objectSpread2({},req),{},{'axios-retry':{retries:3,retryCondition:this._isErrorRetryable.bind(this),retryDelay:axiosRetry.exponentialDelay}})).then(function(response){_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);done();}).catch(function(err){console.log(err);_this.logger.error("got error while attempting send for 3 times, dropping ".concat(items.length," events"));_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);if(err.response){var error=new Error(err.response.statusText);return done(error);}done(err);});}}},{key:"_isErrorRetryable",value:function _isErrorRetryable(error){// Retry Network Errors.
|
5332
|
+
var headers={};if(typeof window==='undefined'){headers['user-agent']="analytics-service-worker/".concat(version);headers['Content-Type']="application/json";}var reqTimeout=typeof this.timeout==='string'?ms$1(this.timeout):this.timeout;if(this.flushOverride){this.flushOverride({host:"".concat(this.host),writeKey:this.writeKey,data:data,headers:headers,reqTimeout:reqTimeout,flush:this.flush.bind(this),done:done,isErrorRetryable:this._isErrorRetryable.bind(this)});}else {var req={method:'POST',url:"".concat(this.host),auth:{username:this.writeKey},data:data,headers:headers};if(reqTimeout){req.timeout=reqTimeout;}this.axiosInstance(_objectSpread2(_objectSpread2({},req),{},{'axios-retry':{retries:3,retryCondition:this._isErrorRetryable.bind(this),retryDelay:axiosRetry.exponentialDelay}})).then(function(response){_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);done();}).catch(function(err){console.log(err);_this.logger.error("got error while attempting send for 3 times, dropping ".concat(items.length," events"));_this.timer=setTimeout(_this.flush.bind(_this),_this.flushInterval);if(err.response){var error=new Error(err.response.statusText);return done(error);}done(err);});}}},{key:"_isErrorRetryable",value:function _isErrorRetryable(error){// Retry Network Errors.
|
5347
5333
|
if(axiosRetry.isNetworkError(error)){return true;}if(!error.response){// Cannot determine if the request can be retried
|
5348
5334
|
return false;}this.logger.error("error status: ".concat(error.response.status));// Retry Server Errors (5xx).
|
5349
5335
|
if(error.response.status>=500&&error.response.status<=599){return true;}// Retry if rate limited.
|