@grafana/faro-core 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/faro-core.iife.js +1 -1
- package/dist/bundle/types/index.d.ts +1 -1
- package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/bundle/types/utils/index.d.ts +1 -1
- package/dist/bundle/types/utils/json.d.ts +1 -0
- package/dist/bundle/types/version.d.ts +1 -1
- package/dist/cjs/api/exceptions/initialize.js +2 -2
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/index.js +2 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/json.js +13 -2
- package/dist/cjs/utils/json.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/api/exceptions/initialize.js +3 -3
- package/dist/esm/api/exceptions/initialize.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/json.js +9 -1
- package/dist/esm/utils/json.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/initialize.js +2 -2
- package/dist/spec/core/src/api/exceptions/initialize.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/initialize.test.js +33 -0
- package/dist/spec/core/src/api/exceptions/initialize.test.js.map +1 -1
- package/dist/spec/core/src/index.js +2 -1
- package/dist/spec/core/src/index.js.map +1 -1
- package/dist/spec/core/src/utils/index.js +2 -1
- package/dist/spec/core/src/utils/index.js.map +1 -1
- package/dist/spec/core/src/utils/json.js +13 -2
- package/dist/spec/core/src/utils/json.js.map +1 -1
- package/dist/spec/core/src/utils/json.test.js +15 -0
- package/dist/spec/core/src/utils/json.test.js.map +1 -1
- package/dist/spec/core/src/version.js +1 -1
- package/dist/spec/core/src/version.js.map +1 -1
- package/dist/types/core/src/index.d.ts +1 -1
- package/dist/types/core/src/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/core/src/utils/index.d.ts +1 -1
- package/dist/types/core/src/utils/json.d.ts +1 -0
- package/dist/types/core/src/version.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/json.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
var GrafanaFaroCore=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function r(e,n){try{return e instanceof n}catch(e){return!1}}const i=e=>n(e,"null"),a=e=>n(e,"string"),o=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),s=e=>!i(e)&&n(e,"object"),l=e=>n(e,"function"),u=e=>t(e,"Array"),c="undefined"!=typeof Event,d="undefined"!=typeof Error,g=e=>d&&r(e,Error),p="undefined"!=typeof Element,f="undefined"!=typeof Map;function m(e){return null==e||(u(e)||a(e)?0===e.length:!!s(e)&&0===Object.keys(e).length)}function v(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const r=u(e),i=u(t);if(r!==i)return!1;if(r&&i){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!=r--;)if(!v(e[r],t[r]))return!1;return!0}const a=s(e),o=s(t);if(a!==o)return!1;if(e&&t&&a&&o){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;for(let r of n)if(!v(e[r],t[r]))return!1;return!0}return!1}function b(){return(new Date).toISOString()}function h(e){return new Date(e).toISOString()}var E;e.LogLevel=void 0,(E=e.LogLevel||(e.LogLevel={})).TRACE="trace",E.DEBUG="debug",E.INFO="info",E.LOG="log",E.WARN="warn",E.ERROR="error";const y=e.LogLevel.LOG,I=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function T(){}const O="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";const L="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function S(){const e=new WeakSet;return function(n,t){if("object"==typeof t&&null!==t){if(e.has(t))return null;e.add(t)}return t}}function N(e={}){return JSON.stringify(null!=e?e:{},S())}class R{constructor(e,n){var t,r;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(r=null==n?void 0:n.sendTimeout)&&void 0!==r?r:250,this.paused=(null==n?void 0:n.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const n=new Map;return e.forEach((e=>{const t=JSON.stringify(e.meta);let r=n.get(t);r=void 0===r?[e]:[...r,e],n.set(t,r)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var j;e.TransportItemType=void 0,(j=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",j.LOG="log",j.MEASUREMENT="measurement",j.TRACE="trace",j.EVENT="event";const x={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function A(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,r=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>a(e)?n.includes(e):!!n.match(e)))}(n,r))return null}return t}}function w(e,n,t,r){var i;n.debug("Initializing transports");const a=[];let o=t.paused,s=[];const l=e=>{let n=e;for(const e of s){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of a)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let c;(null===(i=t.batching)||void 0===i?void 0:i.enabled)&&(c=new R(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:o}));return{add:(...i)=>{n.debug("Adding transports"),i.forEach((i=>{n.debug(`Adding "${i.name}" transport`);a.some((e=>e===i))?n.warn(`Transport ${i.name} is already added`):(i.unpatchedConsole=e,i.internalLogger=n,i.config=t,i.metas=r,a.push(i))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",s),e.forEach((e=>{e&&s.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&s.push(A(e))}))},getBeforeSendHooks:()=>[...s],execute:e=>{var r;o||((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&(null==c||c.addItem(e)),(e=>{var r,i;if((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&a.every((e=>e.isBatched())))return;const[o]=l([e]);if(void 0!==o)for(const e of a)n.debug(`Transporting item using ${e.name}\n`,o),e.isBatched()?(null===(i=t.batching)||void 0===i?void 0:i.enabled)||e.send([o]):e.send(o)})(e))},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),null==c||c.pause(),o=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=a.indexOf(e);-1!==t?a.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{s.filter((n=>!e.includes(n)))},get transports(){return[...a]},unpause:()=>{n.debug("Unpausing transports"),null==c||c.start(),o=!1}}}var C;e.InternalLoggerLevel=void 0,(C=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[C.OFF=0]="OFF",C[C.ERROR=1]="ERROR",C[C.WARN=2]="WARN",C[C.INFO=3]="INFO",C[C.VERBOSE=4]="VERBOSE";const k={debug:T,error:T,info:T,prefix:"Faro",warn:T},_=e.InternalLoggerLevel.ERROR,P=Object.assign({},console);let B=P;function F(e){var n;return B=null!==(n=e.unpatchedConsole)&&void 0!==n?n:B,B}function D(n=P,t=_){const r=k;return t>e.InternalLoggerLevel.OFF&&(r.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${r.prefix}\n`,...e)}:T,r.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${r.prefix}\n`,...e)}:T,r.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${r.prefix}\n`,...e)}:T,r.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${r.prefix}\n`,...e)}:T),r}let M=k;function V(e,n){return M=D(e,n.internalLoggerLevel),M}class ${constructor(){this.unpatchedConsole=P,this.internalLogger=k,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}function G(e,n){var t,r;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const i=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===i)return e;const a=(null==i?void 0:i.scopeSpans)||[],o=(null===(r=null==n?void 0:n[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},i),{scopeSpans:[...a,...o]})]})}const z="Error";let U;function K(e){let n=e.cause;return g(n)?n=e.cause.toString():null!==n&&(s(e.cause)||u(e.cause))?n=JSON.stringify(e.cause):null!=n&&(n=e.cause.toString()),null==n?{}:{cause:n}}const W=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");function H(n,t,r,o,s){t.debug("Initializing API");const l=function(n,t,r,i,a){let o;return t.debug("Initializing traces API"),{getOTEL:()=>o,getTraceContext:()=>{const e=null==o?void 0:o.trace.getSpanContext(o.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),o={trace:e,context:n}},isOTELInitialized:()=>!!o,pushTraces:n=>{try{const r={type:e.TransportItemType.TRACE,payload:n,meta:i.value};t.debug("Pushing trace\n",r),a.execute(r)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,o,s);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),function(n,t,r,a,o,s){var l;t.debug("Initializing exceptions API");let u=null;U=null!==(l=r.parseStacktrace)&&void 0!==l?l:U;const c=e=>{t.debug("Changing stacktrace parser"),U=null!=e?e:U};return c(r.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>U,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:g,spanContext:p,timestampOverwriteMs:f}={})=>{d=d||n.name||z;const m={meta:a.value,payload:{type:d,value:n.message,timestamp:f?h(f):b(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext(),context:Object.assign(Object.assign({},K(n)),null!=g?g:{})},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==U?void 0:U(n).frames:void 0)?void 0:c.length)&&(m.payload.stacktrace={frames:c});const E={type:m.payload.type,value:m.payload.value,stackTrace:m.payload.stacktrace,context:m.payload.context};l||!r.dedupe||i(u)||!v(E,u)?(u=E,t.debug("Pushing exception\n",m),o.execute(m)):t.debug("Skipping error push because it is the same as the last one\n",m.payload)}}}(0,t,r,o,s,l)),function(e,n,t,r){let i,o,s,l;n.debug("Initializing meta API");const u=e=>{o&&r.remove(o),o={user:e},r.add(o)},c=(e,n)=>{const t=null==n?void 0:n.overrides;i&&r.remove(i),i={session:Object.assign(Object.assign({},m(e)?void 0:e),t?{overrides:t}:{})},r.add(i)},d=()=>r.value.session,g=()=>r.value.page;return{setUser:u,resetUser:u,setSession:c,resetSession:c,getSession:d,setView:(e,n)=>{var t;if((null==n?void 0:n.overrides)&&c(d(),{overrides:n.overrides}),(null===(t=null==s?void 0:s.view)||void 0===t?void 0:t.name)===(null==e?void 0:e.name))return;const i=s;s={view:e},r.add(s),i&&r.remove(i)},getView:()=>r.value.view,setPage:e=>{var n;const t=a(e)?Object.assign(Object.assign({},null!==(n=null==l?void 0:l.page)&&void 0!==n?n:g()),{id:e}):e;l&&r.remove(l),l={page:t},r.add(l)},getPage:g}}(0,t,0,o)),function(n,t,r,a,o,s){var l;t.debug("Initializing logs API");let u=null;const c=null!==(l=r.logArgsSerializer)&&void 0!==l?l:W;return{pushLog:(n,{context:l,level:d,skipDedupe:g,spanContext:p,timestampOverwriteMs:f}={})=>{try{const m={type:e.TransportItemType.LOG,payload:{message:c(n),level:null!=d?d:y,context:null!=l?l:{},timestamp:f?h(f):b(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext()},meta:a.value},E={message:m.payload.message,level:m.payload.level,context:m.payload.context};if(!g&&r.dedupe&&!i(u)&&v(E,u))return void t.debug("Skipping log push because it is the same as the last one\n",m.payload);u=E,t.debug("Pushing log\n",m),o.execute(m)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,r,o,s,l)),function(n,t,r,a,o,s){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c,spanContext:d,timestampOverwriteMs:g}={})=>{try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:d?{trace_id:d.traceId,span_id:d.spanId}:s.getTraceContext(),timestamp:g?h(g):b(),context:null!=c?c:{}}),meta:a.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&r.dedupe&&!i(l)&&v(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),o.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,r,o,s,l)),function(n,t,r,a,o,s){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d,spanContext:g,timestampOverwriteMs:p}={})=>{try{const f={meta:a.value,payload:{name:n,domain:null!=c?c:r.eventDomain,attributes:u,timestamp:p?h(p):b(),trace:g?{trace_id:g.traceId,span_id:g.spanId}:s.getTraceContext()},type:e.TransportItemType.EVENT},m={name:f.payload.name,attributes:f.payload.attributes,domain:f.payload.domain};if(!d&&r.dedupe&&!i(l)&&v(m,l))return void t.debug("Skipping event push because it is the same as the last one\n",f.payload);l=m,t.debug("Pushing event\n",f),o.execute(f)}catch(e){t.error("Error pushing event",e)}}}}(0,t,r,o,s,l))}const X="1.13.1";const J="_faroInternal";function q(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(L,J,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function Q(){return J in L}function Y(n,t,r,i,a,o,s){return t.debug("Initializing Faro"),e.faro={api:o,config:r,instrumentations:s,internalLogger:t,metas:i,pause:a.pause,transports:a,unpatchedConsole:n,unpause:a.unpause},q(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in L)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(L,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=$,e.BaseInstrumentation=class extends ${constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends ${isBatched(){return!1}getIgnoreUrls(){return[]}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.EVENT_CLICK="click",e.EVENT_NAVIGATION="navigation",e.EVENT_OVERRIDES_SERVICE_NAME="service_name_override",e.EVENT_ROUTE_CHANGE="route_change",e.EVENT_SESSION_EXTEND="session_extend",e.EVENT_SESSION_RESUME="session_resume",e.EVENT_SESSION_START="session_start",e.EVENT_VIEW_CHANGED="view_changed",e.VERSION=X,e.allLogLevels=I,e.createInternalLogger=D,e.createPromiseBuffer=function(e){const{size:n,concurrency:t}=e,r=[];let i=0;const a=()=>{if(i<t&&r.length){const{producer:e,resolve:n,reject:t}=r.shift();i++,e().then((e=>{i--,a(),n(e)}),(e=>{i--,a(),t(e)}))}};return{add:e=>{if(r.length+i>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{r.push({producer:e,resolve:n,reject:t}),a()}))}}},e.dateNow=function(){return Date.now()},e.deepEqual=v,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map((e=>s(e)?N(e):String(e))).join(" "),e.defaultExceptionType=z,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=_,e.defaultLogArgsSerializer=W,e.defaultLogLevel=y,e.defaultUnpatchedConsole=P,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>O[Math.floor(59*Math.random())])).join("")},e.getCircularDependencyReplacer=S,e.getCurrentTimestamp=b,e.getInternalFaroFromGlobalObject=function(){return L[J]},e.getTransportBody=function(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const r=x[n.type],i=t[r];t=Object.assign(Object.assign({},t),{[r]:void 0===i?[n.payload]:[...i,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:G(t.traces,n.payload.resourceSpans)})}})),t},e.globalObject=L,e.initializeFaro=function(e){const n=F(e),t=V(n,e);if(Q()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const r=function(e,n){let t=[],r=[];const i=()=>t.reduce(((e,n)=>Object.assign(e,l(n)?n():n)),{}),a=()=>{if(r.length){const e=i();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),t.push(...e),a()},remove:(...e)=>{n.debug("Removing metas\n",e),t=t.filter((n=>!e.includes(n))),a()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return i()}}}(0,t),i=w(n,t,e,r),a=H(0,t,e,r,i),o=function(e,n,t,r,i,a){n.debug("Initializing instrumentations");const o=[];return{add:(...s)=>{n.debug("Adding instrumentations"),s.forEach((s=>{n.debug(`Adding "${s.name}" instrumentation`),o.some((e=>e.name===s.name))?n.warn(`Instrumentation ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=r,s.transports=i,s.api=a,o.push(s),s.initialize())}))},get instrumentations(){return[...o]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,r;n.debug(`Removing "${e.name}" instrumentation`);const i=o.reduce(((n,t,r)=>null===n&&t.name===e.name?r:null),null);i?(null===(r=(t=o[i]).destroy)||void 0===r||r.call(t),o.splice(i,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,r,i,a),s=Y(n,t,e,r,i,a,o);return function(e){var n,t;const r={sdk:{version:X},app:{bundleId:e.config.app.name&&(i=e.config.app.name,null==L?void 0:L[`__faroBundleId_${i}`])}};var i;const a=null===(n=e.config.sessionTracking)||void 0===n?void 0:n.session;a&&e.api.setSession(a),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(t=e.config.metas)&&void 0!==t?t:[])}(s),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(s),function(e){e.instrumentations.add(...e.config.instrumentations)}(s),s},e.internalGlobalObjectKey=J,e.isArray=u,e.isBoolean=e=>n(e,"boolean"),e.isDomError=e=>t(e,"DOMError"),e.isDomException=e=>t(e,"DOMException"),e.isElement=e=>p&&r(e,Element),e.isElementDefined=p,e.isEmpty=m,e.isError=g,e.isErrorDefined=d,e.isErrorEvent=e=>t(e,"ErrorEvent"),e.isEvent=e=>c&&r(e,Event),e.isEventDefined=c,e.isFunction=l,e.isInstanceOf=r,e.isInt=e=>o(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=Q,e.isMap=e=>f&&r(e,Map),e.isMapDefined=f,e.isNull=i,e.isNumber=o,e.isObject=s,e.isPrimitive=e=>!s(e)&&!l(e),e.isRegExp=e=>t(e,"RegExp"),e.isString=a,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>s(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>l(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=e=>n(e,"undefined"),e.noop=T,e.setInternalFaroOnGlobalObject=q,e.stringifyExternalJson=N,e.transportItemTypeToBodyKey=x,e.unknownString="unknown",e}({});
|
|
1
|
+
var GrafanaFaroCore=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function r(e,n){try{return e instanceof n}catch(e){return!1}}const i=e=>n(e,"null"),a=e=>n(e,"string"),s=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),o=e=>!i(e)&&n(e,"object"),l=e=>n(e,"function"),u=e=>t(e,"Array"),c="undefined"!=typeof Event,d="undefined"!=typeof Error,g=e=>d&&r(e,Error),p="undefined"!=typeof Element,f="undefined"!=typeof Map;function m(e){return null==e||(u(e)||a(e)?0===e.length:!!o(e)&&0===Object.keys(e).length)}function v(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const r=u(e),i=u(t);if(r!==i)return!1;if(r&&i){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!=r--;)if(!v(e[r],t[r]))return!1;return!0}const a=o(e),s=o(t);if(a!==s)return!1;if(e&&t&&a&&s){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;for(let r of n)if(!v(e[r],t[r]))return!1;return!0}return!1}function b(){return(new Date).toISOString()}function h(e){return new Date(e).toISOString()}var E;e.LogLevel=void 0,(E=e.LogLevel||(e.LogLevel={})).TRACE="trace",E.DEBUG="debug",E.INFO="info",E.LOG="log",E.WARN="warn",E.ERROR="error";const y=e.LogLevel.LOG,I=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function T(){}const O="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";const L="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function S(){const e=new WeakSet;return function(n,t){if(o(t)&&null!==t){if(e.has(t))return null;e.add(t)}return t}}function N(e={}){return JSON.stringify(null!=e?e:{},S())}function j(e={}){const n={};for(const[t,r]of Object.entries(e))n[t]=o(r)&&null!==r?N(r):String(r);return n}class R{constructor(e,n){var t,r;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(r=null==n?void 0:n.sendTimeout)&&void 0!==r?r:250,this.paused=(null==n?void 0:n.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const n=new Map;return e.forEach((e=>{const t=JSON.stringify(e.meta);let r=n.get(t);r=void 0===r?[e]:[...r,e],n.set(t,r)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var x;e.TransportItemType=void 0,(x=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",x.LOG="log",x.MEASUREMENT="measurement",x.TRACE="trace",x.EVENT="event";const A={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function w(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,r=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>a(e)?n.includes(e):!!n.match(e)))}(n,r))return null}return t}}function C(e,n,t,r){var i;n.debug("Initializing transports");const a=[];let s=t.paused,o=[];const l=e=>{let n=e;for(const e of o){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of a)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let c;(null===(i=t.batching)||void 0===i?void 0:i.enabled)&&(c=new R(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:s}));return{add:(...i)=>{n.debug("Adding transports"),i.forEach((i=>{n.debug(`Adding "${i.name}" transport`);a.some((e=>e===i))?n.warn(`Transport ${i.name} is already added`):(i.unpatchedConsole=e,i.internalLogger=n,i.config=t,i.metas=r,a.push(i))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",o),e.forEach((e=>{e&&o.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&o.push(w(e))}))},getBeforeSendHooks:()=>[...o],execute:e=>{var r;s||((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&(null==c||c.addItem(e)),(e=>{var r,i;if((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&a.every((e=>e.isBatched())))return;const[s]=l([e]);if(void 0!==s)for(const e of a)n.debug(`Transporting item using ${e.name}\n`,s),e.isBatched()?(null===(i=t.batching)||void 0===i?void 0:i.enabled)||e.send([s]):e.send(s)})(e))},isPaused:()=>s,pause:()=>{n.debug("Pausing transports"),null==c||c.pause(),s=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=a.indexOf(e);-1!==t?a.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{o.filter((n=>!e.includes(n)))},get transports(){return[...a]},unpause:()=>{n.debug("Unpausing transports"),null==c||c.start(),s=!1}}}var k;e.InternalLoggerLevel=void 0,(k=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[k.OFF=0]="OFF",k[k.ERROR=1]="ERROR",k[k.WARN=2]="WARN",k[k.INFO=3]="INFO",k[k.VERBOSE=4]="VERBOSE";const _={debug:T,error:T,info:T,prefix:"Faro",warn:T},P=e.InternalLoggerLevel.ERROR,B=Object.assign({},console);let F=B;function D(e){var n;return F=null!==(n=e.unpatchedConsole)&&void 0!==n?n:F,F}function V(n=B,t=P){const r=_;return t>e.InternalLoggerLevel.OFF&&(r.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${r.prefix}\n`,...e)}:T,r.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${r.prefix}\n`,...e)}:T,r.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${r.prefix}\n`,...e)}:T,r.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${r.prefix}\n`,...e)}:T),r}let M=_;function $(e,n){return M=V(e,n.internalLoggerLevel),M}class G{constructor(){this.unpatchedConsole=B,this.internalLogger=_,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}function z(e,n){var t,r;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const i=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===i)return e;const a=(null==i?void 0:i.scopeSpans)||[],s=(null===(r=null==n?void 0:n[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},i),{scopeSpans:[...a,...s]})]})}const U="Error";let K;function W(e){let n=e.cause;return g(n)?n=e.cause.toString():null!==n&&(o(e.cause)||u(e.cause))?n=N(e.cause):null!=n&&(n=e.cause.toString()),null==n?{}:{cause:n}}const H=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");function X(n,t,r,s,o){t.debug("Initializing API");const l=function(n,t,r,i,a){let s;return t.debug("Initializing traces API"),{getOTEL:()=>s,getTraceContext:()=>{const e=null==s?void 0:s.trace.getSpanContext(s.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),s={trace:e,context:n}},isOTELInitialized:()=>!!s,pushTraces:n=>{try{const r={type:e.TransportItemType.TRACE,payload:n,meta:i.value};t.debug("Pushing trace\n",r),a.execute(r)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,s,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),function(n,t,r,a,s,o){var l;t.debug("Initializing exceptions API");let u=null;K=null!==(l=r.parseStacktrace)&&void 0!==l?l:K;const c=e=>{t.debug("Changing stacktrace parser"),K=null!=e?e:K};return c(r.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>K,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:g,spanContext:p,timestampOverwriteMs:f}={})=>{d=d||n.name||U;const m={meta:a.value,payload:{type:d,value:n.message,timestamp:f?h(f):b(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:o.getTraceContext(),context:j(Object.assign(Object.assign({},W(n)),null!=g?g:{}))},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==K?void 0:K(n).frames:void 0)?void 0:c.length)&&(m.payload.stacktrace={frames:c});const E={type:m.payload.type,value:m.payload.value,stackTrace:m.payload.stacktrace,context:m.payload.context};l||!r.dedupe||i(u)||!v(E,u)?(u=E,t.debug("Pushing exception\n",m),s.execute(m)):t.debug("Skipping error push because it is the same as the last one\n",m.payload)}}}(0,t,r,s,o,l)),function(e,n,t,r){let i,s,o,l;n.debug("Initializing meta API");const u=e=>{s&&r.remove(s),s={user:e},r.add(s)},c=(e,n)=>{const t=null==n?void 0:n.overrides;i&&r.remove(i),i={session:Object.assign(Object.assign({},m(e)?void 0:e),t?{overrides:t}:{})},r.add(i)},d=()=>r.value.session,g=()=>r.value.page;return{setUser:u,resetUser:u,setSession:c,resetSession:c,getSession:d,setView:(e,n)=>{var t;if((null==n?void 0:n.overrides)&&c(d(),{overrides:n.overrides}),(null===(t=null==o?void 0:o.view)||void 0===t?void 0:t.name)===(null==e?void 0:e.name))return;const i=o;o={view:e},r.add(o),i&&r.remove(i)},getView:()=>r.value.view,setPage:e=>{var n;const t=a(e)?Object.assign(Object.assign({},null!==(n=null==l?void 0:l.page)&&void 0!==n?n:g()),{id:e}):e;l&&r.remove(l),l={page:t},r.add(l)},getPage:g}}(0,t,0,s)),function(n,t,r,a,s,o){var l;t.debug("Initializing logs API");let u=null;const c=null!==(l=r.logArgsSerializer)&&void 0!==l?l:H;return{pushLog:(n,{context:l,level:d,skipDedupe:g,spanContext:p,timestampOverwriteMs:f}={})=>{try{const m={type:e.TransportItemType.LOG,payload:{message:c(n),level:null!=d?d:y,context:null!=l?l:{},timestamp:f?h(f):b(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:o.getTraceContext()},meta:a.value},E={message:m.payload.message,level:m.payload.level,context:m.payload.context};if(!g&&r.dedupe&&!i(u)&&v(E,u))return void t.debug("Skipping log push because it is the same as the last one\n",m.payload);u=E,t.debug("Pushing log\n",m),s.execute(m)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,r,s,o,l)),function(n,t,r,a,s,o){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c,spanContext:d,timestampOverwriteMs:g}={})=>{try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:d?{trace_id:d.traceId,span_id:d.spanId}:o.getTraceContext(),timestamp:g?h(g):b(),context:null!=c?c:{}}),meta:a.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&r.dedupe&&!i(l)&&v(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),s.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,r,s,o,l)),function(n,t,r,a,s,o){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d,spanContext:g,timestampOverwriteMs:p}={})=>{try{const f={meta:a.value,payload:{name:n,domain:null!=c?c:r.eventDomain,attributes:u,timestamp:p?h(p):b(),trace:g?{trace_id:g.traceId,span_id:g.spanId}:o.getTraceContext()},type:e.TransportItemType.EVENT},m={name:f.payload.name,attributes:f.payload.attributes,domain:f.payload.domain};if(!d&&r.dedupe&&!i(l)&&v(m,l))return void t.debug("Skipping event push because it is the same as the last one\n",f.payload);l=m,t.debug("Pushing event\n",f),s.execute(f)}catch(e){t.error("Error pushing event",e)}}}}(0,t,r,s,o,l))}const J="1.13.2";const q="_faroInternal";function Q(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(L,q,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function Y(){return q in L}function Z(n,t,r,i,a,s,o){return t.debug("Initializing Faro"),e.faro={api:s,config:r,instrumentations:o,internalLogger:t,metas:i,pause:a.pause,transports:a,unpatchedConsole:n,unpause:a.unpause},Q(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in L)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(L,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=G,e.BaseInstrumentation=class extends G{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends G{isBatched(){return!1}getIgnoreUrls(){return[]}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.EVENT_CLICK="click",e.EVENT_NAVIGATION="navigation",e.EVENT_OVERRIDES_SERVICE_NAME="service_name_override",e.EVENT_ROUTE_CHANGE="route_change",e.EVENT_SESSION_EXTEND="session_extend",e.EVENT_SESSION_RESUME="session_resume",e.EVENT_SESSION_START="session_start",e.EVENT_VIEW_CHANGED="view_changed",e.VERSION=J,e.allLogLevels=I,e.createInternalLogger=V,e.createPromiseBuffer=function(e){const{size:n,concurrency:t}=e,r=[];let i=0;const a=()=>{if(i<t&&r.length){const{producer:e,resolve:n,reject:t}=r.shift();i++,e().then((e=>{i--,a(),n(e)}),(e=>{i--,a(),t(e)}))}};return{add:e=>{if(r.length+i>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{r.push({producer:e,resolve:n,reject:t}),a()}))}}},e.dateNow=function(){return Date.now()},e.deepEqual=v,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map((e=>o(e)?N(e):String(e))).join(" "),e.defaultExceptionType=U,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=P,e.defaultLogArgsSerializer=H,e.defaultLogLevel=y,e.defaultUnpatchedConsole=B,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>O[Math.floor(59*Math.random())])).join("")},e.getCircularDependencyReplacer=S,e.getCurrentTimestamp=b,e.getInternalFaroFromGlobalObject=function(){return L[q]},e.getTransportBody=function(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const r=A[n.type],i=t[r];t=Object.assign(Object.assign({},t),{[r]:void 0===i?[n.payload]:[...i,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:z(t.traces,n.payload.resourceSpans)})}})),t},e.globalObject=L,e.initializeFaro=function(e){const n=D(e),t=$(n,e);if(Y()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const r=function(e,n){let t=[],r=[];const i=()=>t.reduce(((e,n)=>Object.assign(e,l(n)?n():n)),{}),a=()=>{if(r.length){const e=i();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),t.push(...e),a()},remove:(...e)=>{n.debug("Removing metas\n",e),t=t.filter((n=>!e.includes(n))),a()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return i()}}}(0,t),i=C(n,t,e,r),a=X(0,t,e,r,i),s=function(e,n,t,r,i,a){n.debug("Initializing instrumentations");const s=[];return{add:(...o)=>{n.debug("Adding instrumentations"),o.forEach((o=>{n.debug(`Adding "${o.name}" instrumentation`),s.some((e=>e.name===o.name))?n.warn(`Instrumentation ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=n,o.config=t,o.metas=r,o.transports=i,o.api=a,s.push(o),o.initialize())}))},get instrumentations(){return[...s]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,r;n.debug(`Removing "${e.name}" instrumentation`);const i=s.reduce(((n,t,r)=>null===n&&t.name===e.name?r:null),null);i?(null===(r=(t=s[i]).destroy)||void 0===r||r.call(t),s.splice(i,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,r,i,a),o=Z(n,t,e,r,i,a,s);return function(e){var n,t;const r={sdk:{version:J},app:{bundleId:e.config.app.name&&(i=e.config.app.name,null==L?void 0:L[`__faroBundleId_${i}`])}};var i;const a=null===(n=e.config.sessionTracking)||void 0===n?void 0:n.session;a&&e.api.setSession(a),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(t=e.config.metas)&&void 0!==t?t:[])}(o),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(o),function(e){e.instrumentations.add(...e.config.instrumentations)}(o),o},e.internalGlobalObjectKey=q,e.isArray=u,e.isBoolean=e=>n(e,"boolean"),e.isDomError=e=>t(e,"DOMError"),e.isDomException=e=>t(e,"DOMException"),e.isElement=e=>p&&r(e,Element),e.isElementDefined=p,e.isEmpty=m,e.isError=g,e.isErrorDefined=d,e.isErrorEvent=e=>t(e,"ErrorEvent"),e.isEvent=e=>c&&r(e,Event),e.isEventDefined=c,e.isFunction=l,e.isInstanceOf=r,e.isInt=e=>s(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=Y,e.isMap=e=>f&&r(e,Map),e.isMapDefined=f,e.isNull=i,e.isNumber=s,e.isObject=o,e.isPrimitive=e=>!o(e)&&!l(e),e.isRegExp=e=>t(e,"RegExp"),e.isString=a,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>o(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>l(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=e=>n(e,"undefined"),e.noop=T,e.setInternalFaroOnGlobalObject=Q,e.stringifyExternalJson=N,e.stringifyObjectValues=j,e.transportItemTypeToBodyKey=A,e.unknownString="unknown",e}({});
|
|
@@ -19,7 +19,7 @@ export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeTo
|
|
|
19
19
|
export type { BeforeSendHook, SendFn, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
|
|
20
20
|
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
21
21
|
export type { UnpatchedConsole } from './unpatchedConsole';
|
|
22
|
-
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, } from './utils';
|
|
22
|
+
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, } from './utils';
|
|
23
23
|
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, } from './utils';
|
|
24
24
|
export { VERSION } from './version';
|
|
25
25
|
export { unknownString } from './consts';
|
|
@@ -4,7 +4,7 @@ import type { Transport, TransportItem } from '../transports';
|
|
|
4
4
|
export declare class MockTransport extends BaseTransport implements Transport {
|
|
5
5
|
private ignoreURLs;
|
|
6
6
|
readonly name = "@grafana/transport-mock";
|
|
7
|
-
readonly version = "1.13.
|
|
7
|
+
readonly version = "1.13.2";
|
|
8
8
|
items: TransportItem[];
|
|
9
9
|
constructor(ignoreURLs?: Patterns);
|
|
10
10
|
send(items: TransportItem[]): void | Promise<void>;
|
|
@@ -10,4 +10,4 @@ export type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer }
|
|
|
10
10
|
export { genShortID } from './shortId';
|
|
11
11
|
export { getBundleId } from './sourceMaps';
|
|
12
12
|
export { dateNow } from './date';
|
|
13
|
-
export { getCircularDependencyReplacer, stringifyExternalJson } from './json';
|
|
13
|
+
export { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function getCircularDependencyReplacer(): (_key: string | Symbol, value: unknown) => unknown;
|
|
2
2
|
export declare function stringifyExternalJson(json?: any): string;
|
|
3
|
+
export declare function stringifyObjectValues(obj?: Record<string, unknown>): Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.13.
|
|
1
|
+
export declare const VERSION = "1.13.2";
|
|
@@ -42,7 +42,7 @@ function initializeExceptionsAPI(_unpatchedConsole, internalLogger, config, meta
|
|
|
42
42
|
span_id: spanContext.spanId,
|
|
43
43
|
}
|
|
44
44
|
: tracesApi.getTraceContext(),
|
|
45
|
-
context: __assign(__assign({}, parseCause(error)), (context !== null && context !== void 0 ? context : {})),
|
|
45
|
+
context: (0, utils_1.stringifyObjectValues)(__assign(__assign({}, parseCause(error)), (context !== null && context !== void 0 ? context : {}))),
|
|
46
46
|
},
|
|
47
47
|
type: transports_1.TransportItemType.EXCEPTION,
|
|
48
48
|
};
|
|
@@ -82,7 +82,7 @@ function parseCause(error) {
|
|
|
82
82
|
// MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null
|
|
83
83
|
}
|
|
84
84
|
else if (cause !== null && ((0, utils_1.isObject)(error.cause) || (0, utils_1.isArray)(error.cause))) {
|
|
85
|
-
cause =
|
|
85
|
+
cause = (0, utils_1.stringifyExternalJson)(error.cause);
|
|
86
86
|
}
|
|
87
87
|
else if (cause != null) {
|
|
88
88
|
cause = error.cause.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,+CAAqD;AAGrD,
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,+CAAqD;AAGrD,qCASqB;AACrB,yCAAwD;AAGxD,iCAA+C;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,SAAgB,uBAAuB,CACrC,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,SAAoB;;IAEpB,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAA6E,IAAI,CAAC;IAEjG,gBAAgB,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,gBAAgB,CAAC;IAE9D,IAAM,sBAAsB,GAA4C,UAAC,mBAAmB;QAC1F,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,gBAAgB,GAAG,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,gBAAgB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,CAAC,EAAE;QAC5E,KAAK,GAAG,IAAA,6BAAqB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC5C;SAAM,IAAI,KAAK,IAAI,IAAI,EAAE;QACxB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;KAChC;IAED,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs } = {}\n ) => {\n type = type || error.name || defaultExceptionType;\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n context: stringifyObjectValues({\n ...parseCause(error),\n ...(context ?? {}),\n }),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n transports.execute(item);\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n"]}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.deepEqual = exports.createPromiseBuffer = exports.allLogLevels = exports.defaultUnpatchedConsole = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.getTransportBody = exports.BaseTransport = exports.setInternalFaroOnGlobalObject = exports.isInternalFaroOnGlobalObject = exports.internalGlobalObjectKey = exports.getInternalFaroFromGlobalObject = exports.faro = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = exports.createInternalLogger = exports.BaseInstrumentation = exports.defaultGlobalObjectKey = exports.defaultBatchingConfig = exports.initializeFaro = exports.globalObject = exports.BaseExtension = exports.defaultErrorArgsSerializer = exports.defaultLogArgsSerializer = exports.defaultExceptionType = void 0;
|
|
18
|
-
exports.unknownString = exports.VERSION = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.isEmpty = exports.dateNow = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = void 0;
|
|
18
|
+
exports.unknownString = exports.VERSION = exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.isEmpty = exports.dateNow = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = void 0;
|
|
19
19
|
var api_1 = require("./api");
|
|
20
20
|
Object.defineProperty(exports, "defaultExceptionType", { enumerable: true, get: function () { return api_1.defaultExceptionType; } });
|
|
21
21
|
Object.defineProperty(exports, "defaultLogArgsSerializer", { enumerable: true, get: function () { return api_1.defaultLogArgsSerializer; } });
|
|
@@ -90,6 +90,7 @@ Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () {
|
|
|
90
90
|
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return utils_1.isEmpty; } });
|
|
91
91
|
Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return utils_1.getCircularDependencyReplacer; } });
|
|
92
92
|
Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return utils_1.stringifyExternalJson; } });
|
|
93
|
+
Object.defineProperty(exports, "stringifyObjectValues", { enumerable: true, get: function () { return utils_1.stringifyObjectValues; } });
|
|
93
94
|
var version_1 = require("./version");
|
|
94
95
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
95
96
|
var consts_1 = require("./consts");
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6BAAmG;AAA1F,2GAAA,oBAAoB,OAAA;AAAE,+GAAA,wBAAwB,OAAA;AAAE,iHAAA,0BAA0B,OAAA;AA8BnF,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAGtB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,mCAAyE;AAAhE,+GAAA,qBAAqB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAGtD,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAG5B,mDAAyG;AAAhG,sHAAA,oBAAoB,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAoB9E,6BAMe;AALb,2FAAA,IAAI,OAAA;AACJ,sHAAA,+BAA+B,OAAA;AAC/B,8GAAA,uBAAuB,OAAA;AACvB,mHAAA,4BAA4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OAAA;AACV,4GAAA,mBAAmB,OAAA;AACnB,gGAAA,OAAO,OAAA;AACP,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAChB,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,sHAAA,6BAA6B,OAAA;AAC7B,8GAAA,qBAAqB,OAAA;AACrB,8GAAA,qBAAqB,OAAA;AAavB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n stringifyObjectValues,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = void 0;
|
|
3
|
+
exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = void 0;
|
|
4
4
|
var deepEqual_1 = require("./deepEqual");
|
|
5
5
|
Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deepEqual_1.deepEqual; } });
|
|
6
6
|
var date_1 = require("./date");
|
|
@@ -52,4 +52,5 @@ Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () {
|
|
|
52
52
|
var json_1 = require("./json");
|
|
53
53
|
Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return json_1.getCircularDependencyReplacer; } });
|
|
54
54
|
Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return json_1.stringifyExternalJson; } });
|
|
55
|
+
Object.defineProperty(exports, "stringifyObjectValues", { enumerable: true, get: function () { return json_1.stringifyObjectValues; } });
|
|
55
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,2BA8Bc;AA7BZ,6FAAA,OAAO,OAAA;AACP,+FAAA,SAAS,OAAA;AACT,gGAAA,UAAU,OAAA;AACV,oGAAA,cAAc,OAAA;AACd,+FAAA,SAAS,OAAA;AACT,sGAAA,gBAAgB,OAAA;AAChB,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,kGAAA,YAAY,OAAA;AACZ,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,gGAAA,UAAU,OAAA;AACV,kGAAA,YAAY,OAAA;AACZ,2FAAA,KAAK,OAAA;AACL,2FAAA,K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YAAY,OAAA;AACZ,4FAAA,MAAM,OAAA;AACN,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,sGAAA,gBAAgB,OAAA;AAChB,gGAAA,UAAU,OAAA;AACV,gGAAA,UAAU,OAAA;AACV,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,6FAAA,OAAO,OAAA;AAIT,yCAAsE;AAA7D,yGAAA,YAAY,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAEhD,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAG5B,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAEnB,2CAA2C;AAAlC,yGAAA,WAAW,OAAA;AAEpB,+BAAiC;AAAxB,+FAAA,OAAO,OAAA;AAEhB,+BAAqG;AAA5F,qHAAA,6BAA6B,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAAE,6GAAA,qBAAqB,OAAA","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n"]}
|
package/dist/cjs/utils/json.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringifyExternalJson = exports.getCircularDependencyReplacer = void 0;
|
|
3
|
+
exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = void 0;
|
|
4
|
+
var is_1 = require("./is");
|
|
4
5
|
function getCircularDependencyReplacer() {
|
|
5
6
|
var valueSeen = new WeakSet();
|
|
6
7
|
return function (_key, value) {
|
|
7
|
-
if (
|
|
8
|
+
if ((0, is_1.isObject)(value) && value !== null) {
|
|
8
9
|
if (valueSeen.has(value)) {
|
|
9
10
|
return null;
|
|
10
11
|
}
|
|
@@ -19,4 +20,14 @@ function stringifyExternalJson(json) {
|
|
|
19
20
|
return JSON.stringify(json !== null && json !== void 0 ? json : {}, getCircularDependencyReplacer());
|
|
20
21
|
}
|
|
21
22
|
exports.stringifyExternalJson = stringifyExternalJson;
|
|
23
|
+
function stringifyObjectValues(obj) {
|
|
24
|
+
if (obj === void 0) { obj = {}; }
|
|
25
|
+
var o = {};
|
|
26
|
+
for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) {
|
|
27
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
28
|
+
o[key] = (0, is_1.isObject)(value) && value !== null ? stringifyExternalJson(value) : String(value);
|
|
29
|
+
}
|
|
30
|
+
return o;
|
|
31
|
+
}
|
|
32
|
+
exports.stringifyObjectValues = stringifyObjectValues;
|
|
22
33
|
//# sourceMappingURL=json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":";;;AAAA,SAAgB,6BAA6B;IAC3C,IAAM,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,OAAO,UAAU,IAAqB,EAAE,KAAc;QACpD,IAAI,
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":";;;AAAA,2BAAgC;AAEhC,SAAgB,6BAA6B;IAC3C,IAAM,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,OAAO,UAAU,IAAqB,EAAE,KAAc;QACpD,IAAI,IAAA,aAAQ,EAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YACrC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC;aACb;YACD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACtB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAXD,sEAWC;AAQD,SAAgB,qBAAqB,CAAC,IAAc;IAAd,qBAAA,EAAA,SAAc;IAClD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,EAAE,6BAA6B,EAAE,CAAC,CAAC;AACrE,CAAC;AAFD,sDAEC;AAED,SAAgB,qBAAqB,CAAC,GAAiC;IAAjC,oBAAA,EAAA,QAAiC;IACrE,IAAM,CAAC,GAA2B,EAAE,CAAC;IAErC,KAA2B,UAAmB,EAAnB,KAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAnB,cAAmB,EAAnB,IAAmB,EAAE;QAArC,IAAA,WAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QACpB,CAAC,CAAC,GAAG,CAAC,GAAG,IAAA,aAAQ,EAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC3F;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AARD,sDAQC","sourcesContent":["import { isObject } from './is';\n\nexport function getCircularDependencyReplacer() {\n const valueSeen = new WeakSet();\n return function (_key: string | Symbol, value: unknown) {\n if (isObject(value) && value !== null) {\n if (valueSeen.has(value)) {\n return null;\n }\n valueSeen.add(value);\n }\n return value;\n };\n}\n\ntype JSONObject = {\n [key: string]: JSONValue;\n};\ntype JSONArray = JSONValue[] & {};\ntype JSONValue = string | number | boolean | null | JSONObject | JSONArray;\n\nexport function stringifyExternalJson(json: any = {}) {\n return JSON.stringify(json ?? {}, getCircularDependencyReplacer());\n}\n\nexport function stringifyObjectValues(obj: Record<string, unknown> = {}) {\n const o: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n o[key] = isObject(value) && value !== null ? stringifyExternalJson(value) : String(value);\n }\n\n return o;\n}\n"]}
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.13.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.13.2';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
|
-
import { deepEqual, getCurrentTimestamp, isArray, isError, isNull, isObject } from '../../utils';
|
|
2
|
+
import { deepEqual, getCurrentTimestamp, isArray, isError, isNull, isObject, stringifyExternalJson, stringifyObjectValues, } from '../../utils';
|
|
3
3
|
import { timestampToIsoString } from '../../utils/date';
|
|
4
4
|
import { defaultExceptionType } from './const';
|
|
5
5
|
let stacktraceParser;
|
|
@@ -27,7 +27,7 @@ export function initializeExceptionsAPI(_unpatchedConsole, internalLogger, confi
|
|
|
27
27
|
span_id: spanContext.spanId,
|
|
28
28
|
}
|
|
29
29
|
: tracesApi.getTraceContext(),
|
|
30
|
-
context: Object.assign(Object.assign({}, parseCause(error)), (context !== null && context !== void 0 ? context : {})),
|
|
30
|
+
context: stringifyObjectValues(Object.assign(Object.assign({}, parseCause(error)), (context !== null && context !== void 0 ? context : {}))),
|
|
31
31
|
},
|
|
32
32
|
type: TransportItemType.EXCEPTION,
|
|
33
33
|
};
|
|
@@ -66,7 +66,7 @@ function parseCause(error) {
|
|
|
66
66
|
// MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null
|
|
67
67
|
}
|
|
68
68
|
else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {
|
|
69
|
-
cause =
|
|
69
|
+
cause = stringifyExternalJson(error.cause);
|
|
70
70
|
}
|
|
71
71
|
else if (cause != null) {
|
|
72
72
|
cause = error.cause.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oB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,OAAO;QACL,sBAAsB;QACtB,mBAAmB;QACnB,SAAS;KACV,CAAC;AACJ,CAAC;AACD,SAAS,UAAU,CAAC,KAA+B;IACjD,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAExB,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;QAClB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,wKAAwK;QACxK,sGAAsG;KACvG;SAAM,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;QAC5E,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC5C;SAAM,IAAI,KAAK,IAAI,IAAI,EAAE;QACxB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;KAChC;IAED,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs } = {}\n ) => {\n type = type || error.name || defaultExceptionType;\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n context: stringifyObjectValues({\n ...parseCause(error),\n ...(context ?? {}),\n }),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n transports.execute(item);\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInter
|
|
|
9
9
|
export * from './semantic';
|
|
10
10
|
export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';
|
|
11
11
|
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
12
|
-
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, } from './utils';
|
|
12
|
+
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, } from './utils';
|
|
13
13
|
export { VERSION } from './version';
|
|
14
14
|
export { unknownString } from './consts';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AA8BnG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAoBzG,OAAO,EACL,IAAI,EACJ,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,OAAO,CAAC;AAGf,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAW9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,OAAO,EACP,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAYjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AA8BnG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAoBzG,OAAO,EACL,IAAI,EACJ,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,OAAO,CAAC;AAGf,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAW9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,OAAO,EACP,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAYjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n stringifyObjectValues,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -7,5 +7,5 @@ export { createPromiseBuffer } from './promiseBuffer';
|
|
|
7
7
|
export { genShortID } from './shortId';
|
|
8
8
|
export { getBundleId } from './sourceMaps';
|
|
9
9
|
export { dateNow } from './date';
|
|
10
|
-
export { getCircularDependencyReplacer, stringifyExternalJson } from './json';
|
|
10
|
+
export { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,OAAO,GACR,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson } from './json';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,OAAO,GACR,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n"]}
|
package/dist/esm/utils/json.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { isObject } from './is';
|
|
1
2
|
export function getCircularDependencyReplacer() {
|
|
2
3
|
const valueSeen = new WeakSet();
|
|
3
4
|
return function (_key, value) {
|
|
4
|
-
if (
|
|
5
|
+
if (isObject(value) && value !== null) {
|
|
5
6
|
if (valueSeen.has(value)) {
|
|
6
7
|
return null;
|
|
7
8
|
}
|
|
@@ -13,4 +14,11 @@ export function getCircularDependencyReplacer() {
|
|
|
13
14
|
export function stringifyExternalJson(json = {}) {
|
|
14
15
|
return JSON.stringify(json !== null && json !== void 0 ? json : {}, getCircularDependencyReplacer());
|
|
15
16
|
}
|
|
17
|
+
export function stringifyObjectValues(obj = {}) {
|
|
18
|
+
const o = {};
|
|
19
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
20
|
+
o[key] = isObject(value) && value !== null ? stringifyExternalJson(value) : String(value);
|
|
21
|
+
}
|
|
22
|
+
return o;
|
|
23
|
+
}
|
|
16
24
|
//# sourceMappingURL=json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,6BAA6B;IAC3C,MAAM,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,OAAO,UAAU,IAAqB,EAAE,KAAc;QACpD,IAAI,
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,MAAM,UAAU,6BAA6B;IAC3C,MAAM,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,OAAO,UAAU,IAAqB,EAAE,KAAc;QACpD,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YACrC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC;aACb;YACD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACtB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,qBAAqB,CAAC,OAAY,EAAE;IAClD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,EAAE,6BAA6B,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAA+B,EAAE;IACrE,MAAM,CAAC,GAA2B,EAAE,CAAC;IAErC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC9C,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC3F;IAED,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["import { isObject } from './is';\n\nexport function getCircularDependencyReplacer() {\n const valueSeen = new WeakSet();\n return function (_key: string | Symbol, value: unknown) {\n if (isObject(value) && value !== null) {\n if (valueSeen.has(value)) {\n return null;\n }\n valueSeen.add(value);\n }\n return value;\n };\n}\n\ntype JSONObject = {\n [key: string]: JSONValue;\n};\ntype JSONArray = JSONValue[] & {};\ntype JSONValue = string | number | boolean | null | JSONObject | JSONArray;\n\nexport function stringifyExternalJson(json: any = {}) {\n return JSON.stringify(json ?? {}, getCircularDependencyReplacer());\n}\n\nexport function stringifyObjectValues(obj: Record<string, unknown> = {}) {\n const o: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n o[key] = isObject(value) && value !== null ? stringifyExternalJson(value) : String(value);\n }\n\n return o;\n}\n"]}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.13.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.13.2';\n"]}
|
|
@@ -42,7 +42,7 @@ function initializeExceptionsAPI(_unpatchedConsole, internalLogger, config, meta
|
|
|
42
42
|
span_id: spanContext.spanId,
|
|
43
43
|
}
|
|
44
44
|
: tracesApi.getTraceContext(),
|
|
45
|
-
context: __assign(__assign({}, parseCause(error)), (context !== null && context !== void 0 ? context : {})),
|
|
45
|
+
context: (0, utils_1.stringifyObjectValues)(__assign(__assign({}, parseCause(error)), (context !== null && context !== void 0 ? context : {}))),
|
|
46
46
|
},
|
|
47
47
|
type: transports_1.TransportItemType.EXCEPTION,
|
|
48
48
|
};
|
|
@@ -82,7 +82,7 @@ function parseCause(error) {
|
|
|
82
82
|
// MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null
|
|
83
83
|
}
|
|
84
84
|
else if (cause !== null && ((0, utils_1.isObject)(error.cause) || (0, utils_1.isArray)(error.cause))) {
|
|
85
|
-
cause =
|
|
85
|
+
cause = (0, utils_1.stringifyExternalJson)(error.cause);
|
|
86
86
|
}
|
|
87
87
|
else if (cause != null) {
|
|
88
88
|
cause = error.cause.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,+CAAqD;AAGrD,
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,+CAAqD;AAGrD,qCASqB;AACrB,yCAAwD;AAGxD,iCAA+C;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,SAAgB,uBAAuB,CACrC,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,SAAoB;;IAEpB,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAA6E,IAAI,CAAC;IAEjG,gBAAgB,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,gBAAgB,CAAC;IAE9D,IAAM,sBAAsB,GAA4C,UAAC,mBAAmB;QAC1F,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,gBAAgB,GAAG,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,gBAAgB,CAAC;IAC7D,CAAC,CAAC;IAEF,IAAM,mBAAmB,GAAyC,cAAM,OAAA,gBAAgB,EAAhB,CAAgB,CAAC;IAEzF,IAAM,SAAS,GAA+B,UAC5C,KAAK,EACL,EAAkF;YAAlF,qBAAgF,EAAE,KAAA,EAAhF,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,IAAI,UAAA,EAAE,OAAO,aAAA,EAAE,WAAW,iBAAA,EAAE,oBAAoB,0BAAA;QAE3E,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,4BA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../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs } = {}\n ) => {\n type = type || error.name || defaultExceptionType;\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n context: stringifyObjectValues({\n ...parseCause(error),\n ...(context ?? {}),\n }),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n transports.execute(item);\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n"]}
|
|
@@ -191,6 +191,39 @@ describe('api.exceptions', function () {
|
|
|
191
191
|
expect((_m = (_l = transport.items[5]) === null || _l === void 0 ? void 0 : _l.payload) === null || _m === void 0 ? void 0 : _m.context).toEqual({});
|
|
192
192
|
expect((_p = (_o = transport.items[5]) === null || _o === void 0 ? void 0 : _o.payload) === null || _p === void 0 ? void 0 : _p.context).toEqual({});
|
|
193
193
|
});
|
|
194
|
+
it('stringifies all values added to the context', function () {
|
|
195
|
+
var _a, _b;
|
|
196
|
+
api.pushError(new Error('Error with context'), {
|
|
197
|
+
context: {
|
|
198
|
+
// @ts-expect-error
|
|
199
|
+
a: 1,
|
|
200
|
+
b: 'foo',
|
|
201
|
+
// @ts-expect-error
|
|
202
|
+
c: true,
|
|
203
|
+
// @ts-expect-error
|
|
204
|
+
d: { e: 'bar' },
|
|
205
|
+
// @ts-expect-error
|
|
206
|
+
g: null,
|
|
207
|
+
// @ts-expect-error
|
|
208
|
+
h: undefined,
|
|
209
|
+
// @ts-expect-error
|
|
210
|
+
i: [1, 2, 3],
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
var context = (_b = (_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.context;
|
|
214
|
+
expect(context).toStrictEqual({
|
|
215
|
+
a: '1',
|
|
216
|
+
b: 'foo',
|
|
217
|
+
c: 'true',
|
|
218
|
+
d: '{"e":"bar"}',
|
|
219
|
+
g: 'null',
|
|
220
|
+
h: 'undefined',
|
|
221
|
+
i: '[1,2,3]',
|
|
222
|
+
});
|
|
223
|
+
Object.values(context !== null && context !== void 0 ? context : {}).forEach(function (value) {
|
|
224
|
+
expect(typeof value).toBe('string');
|
|
225
|
+
});
|
|
226
|
+
});
|
|
194
227
|
});
|
|
195
228
|
});
|
|
196
229
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.test.js","sourceRoot":"","sources":["../../../../../../src/api/exceptions/initialize.test.ts"],"names":[],"mappings":";;AAAA,+CAAkD;AAClD,6CAA4D;AAC5D,+CAAqD;AAKrD,QAAQ,CAAC,gBAAgB,EAAE;IACzB,SAAS,SAAS,CAAC,EAAkD;YAAlD,qBAAkC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAA,EAAhD,MAAM,YAAA;QACzB,IAAM,SAAS,GAAG,IAAI,yBAAa,EAAE,CAAC;QACtC,IAAM,MAAM,GAAG,IAAA,sBAAU,EAAC;YACxB,MAAM,QAAA;YACN,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC,CAAC;QAEK,IAAA,GAAG,GAAK,IAAA,2BAAc,EAAC,MAAM,CAAC,IAA3B,CAA4B;QAEvC,OAAO,CAAC,G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AC/E,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { initializeFaro } from '../../initialize';\nimport { mockConfig, MockTransport } from '../../testUtils';\nimport { TransportItemType } from '../../transports';\nimport type { API } from '../types';\n\nimport type { ExceptionEvent, ExceptionStackFrame, PushErrorOptions } from './types';\n\ndescribe('api.exceptions', () => {\n function createAPI({ dedupe }: { dedupe: boolean } = { dedupe: true }): [API, MockTransport] {\n const transport = new MockTransport();\n const config = mockConfig({\n dedupe,\n transports: [transport],\n });\n\n const { api } = initializeFaro(config);\n\n return [api, transport];\n }\n\n describe('pushError', () => {\n let api: API;\n let transport: MockTransport;\n\n beforeEach(() => {\n [api, transport] = createAPI();\n });\n\n it('error with overrides', () => {\n const frames: ExceptionStackFrame[] = [\n {\n filename: 'foo.js',\n function: 'FooFn',\n colno: 4,\n lineno: 23,\n },\n {\n filename: 'bar.js',\n function: 'BarFn',\n colno: 6,\n lineno: 52,\n },\n ];\n\n const additionalContext = {\n message: 'React error boundary',\n componentStackTrace: 'componentStackTrace',\n };\n\n api.pushError(new Error('test exception'), {\n stackFrames: frames,\n type: 'TestError',\n context: additionalContext,\n });\n\n expect(transport.items).toHaveLength(1);\n\n const payload = transport.items[0];\n expect(payload?.payload).toBeTruthy();\n expect(payload?.type).toEqual(TransportItemType.EXCEPTION);\n\n const evt = payload?.payload as ExceptionEvent;\n expect(evt.type).toEqual('TestError');\n expect(evt.value).toEqual('test exception');\n expect(evt.stacktrace).toEqual({ frames });\n expect(evt.context).toEqual(additionalContext);\n });\n\n it('error without overrides', () => {\n const err = new Error('test');\n api.pushError(err);\n expect(transport.items).toHaveLength(1);\n\n const payload = transport.items[0];\n expect(payload?.meta.app?.name).toEqual('test');\n expect(payload?.payload).toBeTruthy();\n expect(payload?.type).toEqual(TransportItemType.EXCEPTION);\n\n const evt = payload?.payload as ExceptionEvent;\n expect(evt.type).toEqual('Error');\n expect(evt.value).toEqual('test');\n expect(evt.timestamp).toBeTruthy();\n\n const stacktrace = evt.stacktrace;\n expect(stacktrace).toBeTruthy();\n expect(stacktrace?.frames.length).toBeGreaterThan(3);\n expect(stacktrace?.frames[0]?.filename).toEqual('Error: test');\n });\n\n describe('Filtering', () => {\n it('filters the same event', () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n });\n\n it(\"doesn't filter events with same message and different stacktrace\", () => {\n const error1 = new Error('test');\n const error2 = new Error('test');\n\n api.pushError(error1);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error2);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with other message and same stacktrace\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.message = 'test2';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with same message and same stacktrace but different type\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.name = 'Another Type';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"filters an event and doesn't filter the next different one\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.name = 'Another Type';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when dedupe is false\", () => {\n [api, transport] = createAPI({ dedupe: false });\n\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when skipDedupe is true\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error, {\n skipDedupe: true,\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with same message, same stacktrace, same type but different context\", () => {\n const error = new Error('test');\n\n api.pushError(error, { context: { foo: 'bar' } });\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error, { context: { bar: 'baz' } });\n expect(transport.items).toHaveLength(2);\n });\n\n it('uses traceId and spanId from custom context', () => {\n const spanContext: PushErrorOptions['spanContext'] = {\n traceId: 'my-trace-id',\n spanId: 'my-span-id',\n };\n\n const error = new Error('test');\n\n api.pushError(error, { spanContext });\n expect(transport.items).toHaveLength(1);\n expect((transport.items[0]?.payload as ExceptionEvent).trace).toStrictEqual({\n trace_id: 'my-trace-id',\n span_id: 'my-span-id',\n });\n });\n\n it('Sets the timestamp to the provided custom timestamp', () => {\n api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });\n expect(transport.items).toHaveLength(1);\n expect((transport.items[0]?.payload as ExceptionEvent).timestamp).toBe('1970-01-01T00:00:00.123Z');\n });\n\n it('Adds error cause to error context', () => {\n // @ts-expect-error cause is missing in TS type Error\n const error = new Error('test', { cause: 'foo' });\n // @ts-expect-error cause is missing in TS type Error\n const error2 = new Error('test2', { cause: [1, 3] });\n // @ts-expect-error cause is missing in TS type Error\n const error3 = new Error('test3', { cause: { a: 'b' } });\n // @ts-expect-error cause is missing in TS type Error\n const error4 = new Error('test4', { cause: new Error('original error') });\n // @ts-expect-error cause is missing in TS type Error\n const error5 = new Error('test5', { cause: null });\n // @ts-expect-error cause is missing in TS type Error\n const error6 = new Error('test6', { cause: undefined });\n const error7 = new Error('test6');\n\n api.pushError(error);\n api.pushError(error2);\n api.pushError(error3);\n api.pushError(error4);\n api.pushError(error5);\n api.pushError(error6);\n api.pushError(error7);\n\n expect(transport.items).toHaveLength(7);\n\n expect((transport.items[0]?.payload as ExceptionEvent)?.context).toEqual({ cause: 'foo' });\n expect((transport.items[1]?.payload as ExceptionEvent)?.context).toEqual({ cause: '[1,3]' });\n expect((transport.items[2]?.payload as ExceptionEvent)?.context).toEqual({ cause: '{\"a\":\"b\"}' });\n expect((transport.items[3]?.payload as ExceptionEvent)?.context).toEqual({ cause: 'Error: original error' });\n expect((transport.items[4]?.payload as ExceptionEvent)?.context).toEqual({});\n expect((transport.items[5]?.payload as ExceptionEvent)?.context).toEqual({});\n expect((transport.items[5]?.payload as ExceptionEvent)?.context).toEqual({});\n });\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"initialize.test.js","sourceRoot":"","sources":["../../../../../../src/api/exceptions/initialize.test.ts"],"names":[],"mappings":";;AAAA,+CAAkD;AAClD,6CAA4D;AAC5D,+CAAqD;AAKrD,QAAQ,CAAC,gBAAgB,EAAE;IACzB,SAAS,SAAS,CAAC,EAAkD;YAAlD,qBAAkC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAA,EAAhD,MAAM,YAAA;QACzB,IAAM,SAAS,GAAG,IAAI,yBAAa,EAAE,CAAC;QACtC,IAAM,MAAM,GAAG,IAAA,sBAAU,EAAC;YACxB,MAAM,QAAA;YACN,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC,CAAC;QAEK,IAAA,GAAG,GAAK,IAAA,2BAAc,EAAC,MAAM,CAAC,IAA3B,CAA4B;QAEvC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,WAAW,EAAE;QACpB,IAAI,GAAQ,CAAC;QACb,IAAI,SAAwB,CAAC;QAE7B,UAAU,CAAC;;YACT,KAAmB,SAAS,EAAE,EAA7B,GAAG,QAAA,EAAE,SAAS,QAAA,CAAgB;QACjC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sBAAsB,EAAE;YACzB,IAAM,MAAM,GAA0B;gBACpC;oBACE,QAAQ,EAAE,QAAQ;oBAClB,QAAQ,EAAE,OAAO;oBACjB,KAAK,EAAE,CAAC;oBACR,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,QAAQ,EAAE,QAAQ;oBAClB,QAAQ,EAAE,OAAO;oBACjB,KAAK,EAAE,CAAC;oBACR,MAAM,EAAE,EAAE;i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AAG,MAAC,MAAA,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,0CAAE,OAA0B,0CAAE,OAAO,CAAC;gBACzE,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC;oBAC5B,CAAC,EAAE,GAAG;oBACN,CAAC,EAAE,KAAK;oBACR,CAAC,EAAE,MAAM;oBACT,CAAC,EAAE,aAAa;oBAChB,CAAC,EAAE,MAAM;oBACT,CAAC,EAAE,WAAW;oBACd,CAAC,EAAE,SAAS;iBACb,CAAC,CAAC;gBAEH,MAAM,CAAC,MAAM,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAC,KAAK;oBACzC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtC,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { initializeFaro } from '../../initialize';\nimport { mockConfig, MockTransport } from '../../testUtils';\nimport { TransportItemType } from '../../transports';\nimport type { API } from '../types';\n\nimport type { ExceptionEvent, ExceptionStackFrame, PushErrorOptions } from './types';\n\ndescribe('api.exceptions', () => {\n function createAPI({ dedupe }: { dedupe: boolean } = { dedupe: true }): [API, MockTransport] {\n const transport = new MockTransport();\n const config = mockConfig({\n dedupe,\n transports: [transport],\n });\n\n const { api } = initializeFaro(config);\n\n return [api, transport];\n }\n\n describe('pushError', () => {\n let api: API;\n let transport: MockTransport;\n\n beforeEach(() => {\n [api, transport] = createAPI();\n });\n\n it('error with overrides', () => {\n const frames: ExceptionStackFrame[] = [\n {\n filename: 'foo.js',\n function: 'FooFn',\n colno: 4,\n lineno: 23,\n },\n {\n filename: 'bar.js',\n function: 'BarFn',\n colno: 6,\n lineno: 52,\n },\n ];\n\n const additionalContext = {\n message: 'React error boundary',\n componentStackTrace: 'componentStackTrace',\n };\n\n api.pushError(new Error('test exception'), {\n stackFrames: frames,\n type: 'TestError',\n context: additionalContext,\n });\n\n expect(transport.items).toHaveLength(1);\n\n const payload = transport.items[0];\n expect(payload?.payload).toBeTruthy();\n expect(payload?.type).toEqual(TransportItemType.EXCEPTION);\n\n const evt = payload?.payload as ExceptionEvent;\n expect(evt.type).toEqual('TestError');\n expect(evt.value).toEqual('test exception');\n expect(evt.stacktrace).toEqual({ frames });\n expect(evt.context).toEqual(additionalContext);\n });\n\n it('error without overrides', () => {\n const err = new Error('test');\n api.pushError(err);\n expect(transport.items).toHaveLength(1);\n\n const payload = transport.items[0];\n expect(payload?.meta.app?.name).toEqual('test');\n expect(payload?.payload).toBeTruthy();\n expect(payload?.type).toEqual(TransportItemType.EXCEPTION);\n\n const evt = payload?.payload as ExceptionEvent;\n expect(evt.type).toEqual('Error');\n expect(evt.value).toEqual('test');\n expect(evt.timestamp).toBeTruthy();\n\n const stacktrace = evt.stacktrace;\n expect(stacktrace).toBeTruthy();\n expect(stacktrace?.frames.length).toBeGreaterThan(3);\n expect(stacktrace?.frames[0]?.filename).toEqual('Error: test');\n });\n\n describe('Filtering', () => {\n it('filters the same event', () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n });\n\n it(\"doesn't filter events with same message and different stacktrace\", () => {\n const error1 = new Error('test');\n const error2 = new Error('test');\n\n api.pushError(error1);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error2);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with other message and same stacktrace\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.message = 'test2';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with same message and same stacktrace but different type\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.name = 'Another Type';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"filters an event and doesn't filter the next different one\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.name = 'Another Type';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when dedupe is false\", () => {\n [api, transport] = createAPI({ dedupe: false });\n\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when skipDedupe is true\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error, {\n skipDedupe: true,\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with same message, same stacktrace, same type but different context\", () => {\n const error = new Error('test');\n\n api.pushError(error, { context: { foo: 'bar' } });\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error, { context: { bar: 'baz' } });\n expect(transport.items).toHaveLength(2);\n });\n\n it('uses traceId and spanId from custom context', () => {\n const spanContext: PushErrorOptions['spanContext'] = {\n traceId: 'my-trace-id',\n spanId: 'my-span-id',\n };\n\n const error = new Error('test');\n\n api.pushError(error, { spanContext });\n expect(transport.items).toHaveLength(1);\n expect((transport.items[0]?.payload as ExceptionEvent).trace).toStrictEqual({\n trace_id: 'my-trace-id',\n span_id: 'my-span-id',\n });\n });\n\n it('Sets the timestamp to the provided custom timestamp', () => {\n api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });\n expect(transport.items).toHaveLength(1);\n expect((transport.items[0]?.payload as ExceptionEvent).timestamp).toBe('1970-01-01T00:00:00.123Z');\n });\n\n it('Adds error cause to error context', () => {\n // @ts-expect-error cause is missing in TS type Error\n const error = new Error('test', { cause: 'foo' });\n // @ts-expect-error cause is missing in TS type Error\n const error2 = new Error('test2', { cause: [1, 3] });\n // @ts-expect-error cause is missing in TS type Error\n const error3 = new Error('test3', { cause: { a: 'b' } });\n // @ts-expect-error cause is missing in TS type Error\n const error4 = new Error('test4', { cause: new Error('original error') });\n // @ts-expect-error cause is missing in TS type Error\n const error5 = new Error('test5', { cause: null });\n // @ts-expect-error cause is missing in TS type Error\n const error6 = new Error('test6', { cause: undefined });\n const error7 = new Error('test6');\n\n api.pushError(error);\n api.pushError(error2);\n api.pushError(error3);\n api.pushError(error4);\n api.pushError(error5);\n api.pushError(error6);\n api.pushError(error7);\n\n expect(transport.items).toHaveLength(7);\n\n expect((transport.items[0]?.payload as ExceptionEvent)?.context).toEqual({ cause: 'foo' });\n expect((transport.items[1]?.payload as ExceptionEvent)?.context).toEqual({ cause: '[1,3]' });\n expect((transport.items[2]?.payload as ExceptionEvent)?.context).toEqual({ cause: '{\"a\":\"b\"}' });\n expect((transport.items[3]?.payload as ExceptionEvent)?.context).toEqual({ cause: 'Error: original error' });\n expect((transport.items[4]?.payload as ExceptionEvent)?.context).toEqual({});\n expect((transport.items[5]?.payload as ExceptionEvent)?.context).toEqual({});\n expect((transport.items[5]?.payload as ExceptionEvent)?.context).toEqual({});\n });\n\n it('stringifies all values added to the context', () => {\n api.pushError(new Error('Error with context'), {\n context: {\n // @ts-expect-error\n a: 1,\n b: 'foo',\n // @ts-expect-error\n c: true,\n // @ts-expect-error\n d: { e: 'bar' },\n // @ts-expect-error\n g: null,\n // @ts-expect-error\n h: undefined,\n // @ts-expect-error\n i: [1, 2, 3],\n },\n });\n\n const context = (transport.items[0]?.payload as ExceptionEvent)?.context;\n expect(context).toStrictEqual({\n a: '1',\n b: 'foo',\n c: 'true',\n d: '{\"e\":\"bar\"}',\n g: 'null',\n h: 'undefined',\n i: '[1,2,3]',\n });\n\n Object.values(context ?? {}).forEach((value) => {\n expect(typeof value).toBe('string');\n });\n });\n });\n });\n});\n"]}
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.deepEqual = exports.createPromiseBuffer = exports.allLogLevels = exports.defaultUnpatchedConsole = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.getTransportBody = exports.BaseTransport = exports.setInternalFaroOnGlobalObject = exports.isInternalFaroOnGlobalObject = exports.internalGlobalObjectKey = exports.getInternalFaroFromGlobalObject = exports.faro = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = exports.createInternalLogger = exports.BaseInstrumentation = exports.defaultGlobalObjectKey = exports.defaultBatchingConfig = exports.initializeFaro = exports.globalObject = exports.BaseExtension = exports.defaultErrorArgsSerializer = exports.defaultLogArgsSerializer = exports.defaultExceptionType = void 0;
|
|
18
|
-
exports.unknownString = exports.VERSION = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.isEmpty = exports.dateNow = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = void 0;
|
|
18
|
+
exports.unknownString = exports.VERSION = exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.isEmpty = exports.dateNow = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = void 0;
|
|
19
19
|
var api_1 = require("./api");
|
|
20
20
|
Object.defineProperty(exports, "defaultExceptionType", { enumerable: true, get: function () { return api_1.defaultExceptionType; } });
|
|
21
21
|
Object.defineProperty(exports, "defaultLogArgsSerializer", { enumerable: true, get: function () { return api_1.defaultLogArgsSerializer; } });
|
|
@@ -90,6 +90,7 @@ Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () {
|
|
|
90
90
|
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return utils_1.isEmpty; } });
|
|
91
91
|
Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return utils_1.getCircularDependencyReplacer; } });
|
|
92
92
|
Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return utils_1.stringifyExternalJson; } });
|
|
93
|
+
Object.defineProperty(exports, "stringifyObjectValues", { enumerable: true, get: function () { return utils_1.stringifyObjectValues; } });
|
|
93
94
|
var version_1 = require("./version");
|
|
94
95
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
95
96
|
var consts_1 = require("./consts");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6BAAmG;AAA1F,2GAAA,oBAAoB,OAAA;AAAE,+GAAA,wBAAwB,OAAA;AAAE,iHAAA,0BAA0B,OAAA;AA8BnF,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAGtB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,mCAAyE;AAAhE,+GAAA,qBAAqB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAGtD,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAG5B,mDAAyG;AAAhG,sHAAA,oBAAoB,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAoB9E,6BAMe;AALb,2FAAA,IAAI,OAAA;AACJ,sHAAA,+BAA+B,OAAA;AAC/B,8GAAA,uBAAuB,OAAA;AACvB,mHAAA,4BAA4B,OAAA;AAC5B,oHAAA,6BAA6B,OAAA;AAI/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GAAA,OAAO,OAAA;AACP,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAChB,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,sHAAA,6BAA6B,OAAA;AAC7B,8GAAA,qBAAqB,OAAA;AACrB,8GAAA,qBAAqB,OAAA;AAavB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n stringifyObjectValues,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = void 0;
|
|
3
|
+
exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = void 0;
|
|
4
4
|
var deepEqual_1 = require("./deepEqual");
|
|
5
5
|
Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deepEqual_1.deepEqual; } });
|
|
6
6
|
var date_1 = require("./date");
|
|
@@ -52,4 +52,5 @@ Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () {
|
|
|
52
52
|
var json_1 = require("./json");
|
|
53
53
|
Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return json_1.getCircularDependencyReplacer; } });
|
|
54
54
|
Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return json_1.stringifyExternalJson; } });
|
|
55
|
+
Object.defineProperty(exports, "stringifyObjectValues", { enumerable: true, get: function () { return json_1.stringifyObjectValues; } });
|
|
55
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,2BA8Bc;AA7BZ,6FAAA,OAAO,OAAA;AACP,+FAAA,SAAS,OAAA;AACT,gGAAA,UAAU,OAAA;AACV,oGAAA,cAAc,OAAA;AACd,+FAAA,SAAS,OAAA;AACT,sGAAA,gBAAgB,OAAA;AAChB,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,kGAAA,YAAY,OAAA;AACZ,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,gGAAA,UAAU,OAAA;AACV,kGAAA,YAAY,OAAA;AACZ,2FAAA,KAAK,OAAA;AACL,2FAAA,KAAK,OAAA;AACL,kGAAA,YAAY,OAAA;AACZ,4FAAA,MAAM,OAAA;AACN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;AACR,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,sGAAA,gBAAgB,OAAA;AAChB,gGAAA,UAAU,OAAA;AACV,gGAAA,UAAU,OAAA;AACV,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,6FAAA,OAAO,OAAA;AAIT,yCAAsE;AAA7D,yGAAA,YAAY,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAEhD,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAG5B,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAEnB,2CAA2C;AAAlC,yGAAA,WAAW,OAAA;AAEpB,+BAAiC;AAAxB,+FAAA,OAAO,OAAA;AAEhB,+BAAqG;AAA5F,qHAAA,6BAA6B,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAAE,6GAAA,qBAAqB,OAAA","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringifyExternalJson = exports.getCircularDependencyReplacer = void 0;
|
|
3
|
+
exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = void 0;
|
|
4
|
+
var is_1 = require("./is");
|
|
4
5
|
function getCircularDependencyReplacer() {
|
|
5
6
|
var valueSeen = new WeakSet();
|
|
6
7
|
return function (_key, value) {
|
|
7
|
-
if (
|
|
8
|
+
if ((0, is_1.isObject)(value) && value !== null) {
|
|
8
9
|
if (valueSeen.has(value)) {
|
|
9
10
|
return null;
|
|
10
11
|
}
|
|
@@ -19,4 +20,14 @@ function stringifyExternalJson(json) {
|
|
|
19
20
|
return JSON.stringify(json !== null && json !== void 0 ? json : {}, getCircularDependencyReplacer());
|
|
20
21
|
}
|
|
21
22
|
exports.stringifyExternalJson = stringifyExternalJson;
|
|
23
|
+
function stringifyObjectValues(obj) {
|
|
24
|
+
if (obj === void 0) { obj = {}; }
|
|
25
|
+
var o = {};
|
|
26
|
+
for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) {
|
|
27
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
28
|
+
o[key] = (0, is_1.isObject)(value) && value !== null ? stringifyExternalJson(value) : String(value);
|
|
29
|
+
}
|
|
30
|
+
return o;
|
|
31
|
+
}
|
|
32
|
+
exports.stringifyObjectValues = stringifyObjectValues;
|
|
22
33
|
//# sourceMappingURL=json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../../src/utils/json.ts"],"names":[],"mappings":";;;AAAA,SAAgB,6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IAED,OAAO,CAAC,CAAC;AACX,CAAC;AARD,sDAQC","sourcesContent":["import { isObject } from './is';\n\nexport function getCircularDependencyReplacer() {\n const valueSeen = new WeakSet();\n return function (_key: string | Symbol, value: unknown) {\n if (isObject(value) && value !== null) {\n if (valueSeen.has(value)) {\n return null;\n }\n valueSeen.add(value);\n }\n return value;\n };\n}\n\ntype JSONObject = {\n [key: string]: JSONValue;\n};\ntype JSONArray = JSONValue[] & {};\ntype JSONValue = string | number | boolean | null | JSONObject | JSONArray;\n\nexport function stringifyExternalJson(json: any = {}) {\n return JSON.stringify(json ?? {}, getCircularDependencyReplacer());\n}\n\nexport function stringifyObjectValues(obj: Record<string, unknown> = {}) {\n const o: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n o[key] = isObject(value) && value !== null ? stringifyExternalJson(value) : String(value);\n }\n\n return o;\n}\n"]}
|
|
@@ -13,5 +13,20 @@ describe('json', function () {
|
|
|
13
13
|
obj.circular = obj;
|
|
14
14
|
expect((0, json_1.stringifyExternalJson)(obj)).toBe('{"a":1,"circular":null}');
|
|
15
15
|
});
|
|
16
|
+
it('stringifyObjectValues function stringifies object values', function () {
|
|
17
|
+
var obj = { a: 1, b: { c: 2 }, d: 'foo', e: true, f: [true, 'a', 1], g: null };
|
|
18
|
+
var objectWithStringifiedValues = (0, json_1.stringifyObjectValues)(obj);
|
|
19
|
+
expect(objectWithStringifiedValues).toStrictEqual({
|
|
20
|
+
a: '1',
|
|
21
|
+
b: '{"c":2}',
|
|
22
|
+
d: 'foo',
|
|
23
|
+
e: 'true',
|
|
24
|
+
f: '[true,\"a\",1]',
|
|
25
|
+
g: 'null',
|
|
26
|
+
});
|
|
27
|
+
Object.values(objectWithStringifiedValues).forEach(function (key) {
|
|
28
|
+
expect(typeof key).toBe('string');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
16
31
|
});
|
|
17
32
|
//# sourceMappingURL=json.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.test.js","sourceRoot":"","sources":["../../../../../src/utils/json.test.ts"],"names":[],"mappings":";;AAAA,+
|
|
1
|
+
{"version":3,"file":"json.test.js","sourceRoot":"","sources":["../../../../../src/utils/json.test.ts"],"names":[],"mappings":";;AAAA,+BAAqG;AAErG,QAAQ,CAAC,MAAM,EAAE;IACf,EAAE,CAAC,6CAA6C,EAAE;QAChD,IAAM,QAAQ,GAAG,IAAA,oCAA6B,GAAE,CAAC;QAEjD,IAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACpB,GAAW,CAAC,QAAQ,GAAG,GAAG,CAAC;QAE5B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6EAA6E,EAAE;QAChF,IAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACpB,GAAW,CAAC,QAAQ,GAAG,GAAG,CAAC;QAE5B,MAAM,CAAC,IAAA,4BAAqB,EAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE;QAC7D,IAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;QAEjF,IAAM,2BAA2B,GAAG,IAAA,4BAAqB,EAAC,GAAG,CAAC,CAAC;QAC/D,MAAM,CAAC,2BAA2B,CAAC,CAAC,aAAa,CAAC;YAChD,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,SAAS;YACZ,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,MAAM;YACT,CAAC,EAAE,gBAAgB;YACnB,CAAC,EAAE,MAAM;SACV,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YACrD,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n\ndescribe('json', () => {\n it('replace circular references with null value', () => {\n const replacer = getCircularDependencyReplacer();\n\n const obj = { a: 1 };\n (obj as any).circular = obj;\n\n expect(JSON.stringify(obj, replacer)).toBe('{\"a\":1,\"circular\":null}');\n });\n\n it('stringifyExternalJson function replaces circular references with null value', () => {\n const obj = { a: 1 };\n (obj as any).circular = obj;\n\n expect(stringifyExternalJson(obj)).toBe('{\"a\":1,\"circular\":null}');\n });\n\n it('stringifyObjectValues function stringifies object values', () => {\n const obj = { a: 1, b: { c: 2 }, d: 'foo', e: true, f: [true, 'a', 1], g: null };\n\n const objectWithStringifiedValues = stringifyObjectValues(obj);\n expect(objectWithStringifiedValues).toStrictEqual({\n a: '1',\n b: '{\"c\":2}',\n d: 'foo',\n e: 'true',\n f: '[true,\\\"a\\\",1]',\n g: 'null',\n });\n\n Object.values(objectWithStringifiedValues).forEach((key) => {\n expect(typeof key).toBe('string');\n });\n });\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.13.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.13.2';\n"]}
|
|
@@ -19,7 +19,7 @@ export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeTo
|
|
|
19
19
|
export type { BeforeSendHook, SendFn, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
|
|
20
20
|
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
21
21
|
export type { UnpatchedConsole } from './unpatchedConsole';
|
|
22
|
-
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, } from './utils';
|
|
22
|
+
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, } from './utils';
|
|
23
23
|
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, } from './utils';
|
|
24
24
|
export { VERSION } from './version';
|
|
25
25
|
export { unknownString } from './consts';
|
|
@@ -4,7 +4,7 @@ import type { Transport, TransportItem } from '../transports';
|
|
|
4
4
|
export declare class MockTransport extends BaseTransport implements Transport {
|
|
5
5
|
private ignoreURLs;
|
|
6
6
|
readonly name = "@grafana/transport-mock";
|
|
7
|
-
readonly version = "1.13.
|
|
7
|
+
readonly version = "1.13.2";
|
|
8
8
|
items: TransportItem[];
|
|
9
9
|
constructor(ignoreURLs?: Patterns);
|
|
10
10
|
send(items: TransportItem[]): void | Promise<void>;
|
|
@@ -10,4 +10,4 @@ export type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer }
|
|
|
10
10
|
export { genShortID } from './shortId';
|
|
11
11
|
export { getBundleId } from './sourceMaps';
|
|
12
12
|
export { dateNow } from './date';
|
|
13
|
-
export { getCircularDependencyReplacer, stringifyExternalJson } from './json';
|
|
13
|
+
export { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function getCircularDependencyReplacer(): (_key: string | Symbol, value: unknown) => unknown;
|
|
2
2
|
export declare function stringifyExternalJson(json?: any): string;
|
|
3
|
+
export declare function stringifyObjectValues(obj?: Record<string, unknown>): Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.13.
|
|
1
|
+
export declare const VERSION = "1.13.2";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeTo
|
|
|
19
19
|
export type { BeforeSendHook, SendFn, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
|
|
20
20
|
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
21
21
|
export type { UnpatchedConsole } from './unpatchedConsole';
|
|
22
|
-
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, } from './utils';
|
|
22
|
+
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, } from './utils';
|
|
23
23
|
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, } from './utils';
|
|
24
24
|
export { VERSION } from './version';
|
|
25
25
|
export { unknownString } from './consts';
|
|
@@ -4,7 +4,7 @@ import type { Transport, TransportItem } from '../transports';
|
|
|
4
4
|
export declare class MockTransport extends BaseTransport implements Transport {
|
|
5
5
|
private ignoreURLs;
|
|
6
6
|
readonly name = "@grafana/transport-mock";
|
|
7
|
-
readonly version = "1.13.
|
|
7
|
+
readonly version = "1.13.2";
|
|
8
8
|
items: TransportItem[];
|
|
9
9
|
constructor(ignoreURLs?: Patterns);
|
|
10
10
|
send(items: TransportItem[]): void | Promise<void>;
|
|
@@ -10,4 +10,4 @@ export type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer }
|
|
|
10
10
|
export { genShortID } from './shortId';
|
|
11
11
|
export { getBundleId } from './sourceMaps';
|
|
12
12
|
export { dateNow } from './date';
|
|
13
|
-
export { getCircularDependencyReplacer, stringifyExternalJson } from './json';
|
|
13
|
+
export { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function getCircularDependencyReplacer(): (_key: string | Symbol, value: unknown) => unknown;
|
|
2
2
|
export declare function stringifyExternalJson(json?: any): string;
|
|
3
|
+
export declare function stringifyObjectValues(obj?: Record<string, unknown>): Record<string, string>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.13.
|
|
1
|
+
export declare const VERSION = "1.13.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/faro-core",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"description": "Core package of Faro.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "e6d416fad242ea0ce0aba99ece0c2045bef16791"
|
|
67
67
|
}
|