New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@grafana/faro-core

Package Overview
Dependencies
Maintainers
22
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grafana/faro-core - npm Package Compare versions

Comparing version 1.8.2 to 1.9.0

2

dist/bundle/faro-core.iife.js

@@ -1,1 +0,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 a=e=>n(e,"null"),i=e=>n(e,"string"),o=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),s=e=>!a(e)&&n(e,"object"),l=e=>n(e,"function"),u=e=>t(e,"Array"),c="undefined"!=typeof Event,d="undefined"!=typeof Error,g="undefined"!=typeof Element,p="undefined"!=typeof Map;function f(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const r=u(e),a=u(t);if(r!==a)return!1;if(r&&a){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!=r--;)if(!f(e[r],t[r]))return!1;return!0}const i=s(e),o=s(t);if(i!==o)return!1;if(e&&t&&i&&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(!f(e[r],t[r]))return!1;return!0}return!1}function m(){return(new Date).toISOString()}var v;e.LogLevel=void 0,(v=e.LogLevel||(e.LogLevel={})).TRACE="trace",v.DEBUG="debug",v.INFO="info",v.LOG="log",v.WARN="warn",v.ERROR="error";const b=e.LogLevel.LOG,h=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function E(){}const y="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class T{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 O;e.TransportItemType=void 0,(O=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",O.LOG="log",O.MEASUREMENT="measurement",O.TRACE="trace",O.EVENT="event";const L={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function S(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=>i(e)?n.includes(e):!!n.match(e)))}(n,r))return null}return t}}function N(e,n,t,r){var a;n.debug("Initializing transports");const i=[];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 i)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let c;(null===(a=t.batching)||void 0===a?void 0:a.enabled)&&(c=new T(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:o}));return{add:(...a)=>{n.debug("Adding transports"),a.forEach((a=>{n.debug(`Adding "${a.name}" transport`);i.some((e=>e===a))?n.warn(`Transport ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=r,i.push(a))}))},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(S(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,a;if((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&i.every((e=>e.isBatched())))return;const[o]=l([e]);if(void 0!==o)for(const e of i)n.debug(`Transporting item using ${e.name}\n`,o),e.isBatched()?(null===(a=t.batching)||void 0===a?void 0:a.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=i.indexOf(e);-1!==t?i.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{s.filter((n=>!e.includes(n)))},get transports(){return[...i]},unpause:()=>{n.debug("Unpausing transports"),null==c||c.start(),o=!1}}}var x;e.InternalLoggerLevel=void 0,(x=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[x.OFF=0]="OFF",x[x.ERROR=1]="ERROR",x[x.WARN=2]="WARN",x[x.INFO=3]="INFO",x[x.VERBOSE=4]="VERBOSE";const R={debug:E,error:E,info:E,prefix:"Faro",warn:E},j=e.InternalLoggerLevel.ERROR,A=Object.assign({},console);let C=A;function k(e){var n;return C=null!==(n=e.unpatchedConsole)&&void 0!==n?n:C,C}function _(n=A,t=j){const r=R;return t>e.InternalLoggerLevel.OFF&&(r.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${r.prefix}\n`,...e)}:E,r.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${r.prefix}\n`,...e)}:E,r.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${r.prefix}\n`,...e)}:E,r.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${r.prefix}\n`,...e)}:E),r}let w=R;function P(e,n){return w=_(e,n.internalLoggerLevel),w}class B{constructor(){this.unpatchedConsole=A,this.internalLogger=R,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 F(e,n){var t,r;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const a=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===a)return e;const i=(null==a?void 0:a.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({},a),{scopeSpans:[...i,...o]})]})}const D="Error";let $;const G=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");function V(n,t,r,i,o){t.debug("Initializing API");const s=function(n,t,r,a,i){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:a.value};t.debug("Pushing trace\n",r),i.execute(r)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,i,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s),function(n,t,r,i,o,s){var l;t.debug("Initializing exceptions API");let u=null;$=null!==(l=r.parseStacktrace)&&void 0!==l?l:$;const c=e=>{t.debug("Changing stacktrace parser"),$=null!=e?e:$};return c(r.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>$,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:g,spanContext:p}={})=>{d=d||n.name||D;const v={meta:i.value,payload:{type:d,value:n.message,timestamp:m(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext(),context:null!=g?g:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==$?void 0:$(n).frames:void 0)?void 0:c.length)&&(v.payload.stacktrace={frames:c});const b={type:v.payload.type,value:v.payload.value,stackTrace:v.payload.stacktrace,context:v.payload.context};l||!r.dedupe||a(u)||!f(b,u)?(u=b,t.debug("Pushing exception\n",v),o.execute(v)):t.debug("Skipping error push because it is the same as the last one\n",v.payload)}}}(0,t,r,i,o,s)),function(e,n,t,r,a){let i,o,s;n.debug("Initializing meta API");const l=e=>{o&&r.remove(o),o={user:e},r.add(o)},u=e=>{i&&r.remove(i),i={session:e},r.add(i)};return{setUser:l,resetUser:l,setSession:u,resetSession:u,getSession:()=>r.value.session,setView:e=>{var n;if((null===(n=null==s?void 0:s.view)||void 0===n?void 0:n.name)===(null==e?void 0:e.name))return;const t=s;s={view:e},r.add(s),t&&r.remove(t)},getView:()=>r.value.view}}(0,t,0,i)),function(n,t,r,i,o,s){var l;t.debug("Initializing logs API");let u=null;const c=null!==(l=r.logArgsSerializer)&&void 0!==l?l:G;return{pushLog:(n,{context:l,level:d,skipDedupe:g,spanContext:p}={})=>{try{const v={type:e.TransportItemType.LOG,payload:{message:c(n),level:null!=d?d:b,context:null!=l?l:{},timestamp:m(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext()},meta:i.value},h={message:v.payload.message,level:v.payload.level,context:v.payload.context};if(!g&&r.dedupe&&!a(u)&&f(h,u))return void t.debug("Skipping log push because it is the same as the last one\n",v.payload);u=h,t.debug("Pushing log\n",v),o.execute(v)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,r,i,o,s)),function(n,t,r,i,o,s){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c,spanContext:d}={})=>{var 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:null!==(g=n.timestamp)&&void 0!==g?g:m(),context:null!=c?c:{}}),meta:i.value},v={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&r.dedupe&&!a(l)&&f(v,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=v,t.debug("Pushing measurement\n",p),o.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,r,i,o,s)),function(n,t,r,i,o,s){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d,spanContext:g}={})=>{try{const p={meta:i.value,payload:{name:n,domain:null!=c?c:r.eventDomain,attributes:u,timestamp:m(),trace:g?{trace_id:g.traceId,span_id:g.spanId}:s.getTraceContext()},type:e.TransportItemType.EVENT},v={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&r.dedupe&&!a(l)&&f(v,l))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);l=v,t.debug("Pushing event\n",p),o.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,r,i,o,s))}const M="1.8.2";const z="_faroInternal";function U(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(I,z,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function K(){return z in I}function H(n,t,r,a,i,o,s){return t.debug("Initializing Faro"),e.faro={api:o,config:r,instrumentations:s,internalLogger:t,metas:a,pause:i.pause,transports:i,unpatchedConsole:n,unpause:i.unpause},U(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 I)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(I,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=B,e.BaseInstrumentation=class extends B{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends B{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_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=M,e.allLogLevels=h,e.createInternalLogger=_,e.createPromiseBuffer=function(e){const{size:n,concurrency:t}=e,r=[];let a=0;const i=()=>{if(a<t&&r.length){const{producer:e,resolve:n,reject:t}=r.shift();a++,e().then((e=>{a--,i(),n(e)}),(e=>{a--,i(),t(e)}))}};return{add:e=>{if(r.length+a>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{r.push({producer:e,resolve:n,reject:t}),i()}))}}},e.dateNow=function(){return Date.now()},e.deepEqual=f,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultExceptionType=D,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=j,e.defaultLogArgsSerializer=G,e.defaultLogLevel=b,e.defaultUnpatchedConsole=A,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>y[Math.floor(Math.random()*y.length)])).join("")},e.getCurrentTimestamp=m,e.getInternalFaroFromGlobalObject=function(){return I[z]},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=L[n.type],a=t[r];t=Object.assign(Object.assign({},t),{[r]:void 0===a?[n.payload]:[...a,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:F(t.traces,n.payload.resourceSpans)})}})),t},e.globalObject=I,e.initializeFaro=function(e){const n=k(e),t=P(n,e);if(K()&&!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,t){let r=[],a=[];const i=()=>r.reduce(((e,n)=>Object.assign(e,l(n)?n():n)),{}),o=()=>{if(a.length){const e=i();a.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),r.push(...e),o()},remove:(...e)=>{n.debug("Removing metas\n",e),r=r.filter((n=>!e.includes(n))),o()},addListener:e=>{n.debug("Adding metas listener\n",e),a.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),a=a.filter((n=>n!==e))},get value(){return i()}}}(0,t),a=N(n,t,e,r),i=V(0,t,e,r,a),o=function(e,n,t,r,a,i){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=a,s.api=i,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 a=o.reduce(((n,t,r)=>null===n&&t.name===e.name?r:null),null);a?(null===(r=(t=o[a]).destroy)||void 0===r||r.call(t),o.splice(a,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,r,a,i),s=H(n,t,e,r,a,i,o);return function(e){var n,t;const r={sdk:{version:M},app:{bundleId:e.config.app.name&&(a=e.config.app.name,null==I?void 0:I[`__faroBundleId_${a}`])}};var a;const i=null===(n=e.config.sessionTracking)||void 0===n?void 0:n.session;i&&e.api.setSession(i),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=z,e.isArray=u,e.isBoolean=e=>n(e,"boolean"),e.isDomError=e=>t(e,"DOMError"),e.isDomException=e=>t(e,"DOMException"),e.isElement=e=>g&&r(e,Element),e.isElementDefined=g,e.isError=e=>d&&r(e,Error),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=K,e.isMap=e=>p&&r(e,Map),e.isMapDefined=p,e.isNull=a,e.isNumber=o,e.isObject=s,e.isPrimitive=e=>!s(e)&&!l(e),e.isRegExp=e=>t(e,"RegExp"),e.isString=i,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=E,e.setInternalFaroOnGlobalObject=U,e.transportItemTypeToBodyKey=L,e}({});
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 a=e=>n(e,"null"),i=e=>n(e,"string"),o=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),s=e=>!a(e)&&n(e,"object"),l=e=>n(e,"function"),u=e=>t(e,"Array"),c="undefined"!=typeof Event,d="undefined"!=typeof Error,g="undefined"!=typeof Element,p="undefined"!=typeof Map;function f(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const r=u(e),a=u(t);if(r!==a)return!1;if(r&&a){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!=r--;)if(!f(e[r],t[r]))return!1;return!0}const i=s(e),o=s(t);if(i!==o)return!1;if(e&&t&&i&&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(!f(e[r],t[r]))return!1;return!0}return!1}function m(){return(new Date).toISOString()}function v(e){return new Date(e).toISOString()}var b;e.LogLevel=void 0,(b=e.LogLevel||(e.LogLevel={})).TRACE="trace",b.DEBUG="debug",b.INFO="info",b.LOG="log",b.WARN="warn",b.ERROR="error";const h=e.LogLevel.LOG,E=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function y(){}const I="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";const T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class O{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 L;e.TransportItemType=void 0,(L=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",L.LOG="log",L.MEASUREMENT="measurement",L.TRACE="trace",L.EVENT="event";const S={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function N(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=>i(e)?n.includes(e):!!n.match(e)))}(n,r))return null}return t}}function x(e,n,t,r){var a;n.debug("Initializing transports");const i=[];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 i)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let c;(null===(a=t.batching)||void 0===a?void 0:a.enabled)&&(c=new O(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:o}));return{add:(...a)=>{n.debug("Adding transports"),a.forEach((a=>{n.debug(`Adding "${a.name}" transport`);i.some((e=>e===a))?n.warn(`Transport ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=r,i.push(a))}))},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(N(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,a;if((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&i.every((e=>e.isBatched())))return;const[o]=l([e]);if(void 0!==o)for(const e of i)n.debug(`Transporting item using ${e.name}\n`,o),e.isBatched()?(null===(a=t.batching)||void 0===a?void 0:a.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=i.indexOf(e);-1!==t?i.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{s.filter((n=>!e.includes(n)))},get transports(){return[...i]},unpause:()=>{n.debug("Unpausing transports"),null==c||c.start(),o=!1}}}var R;e.InternalLoggerLevel=void 0,(R=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[R.OFF=0]="OFF",R[R.ERROR=1]="ERROR",R[R.WARN=2]="WARN",R[R.INFO=3]="INFO",R[R.VERBOSE=4]="VERBOSE";const j={debug:y,error:y,info:y,prefix:"Faro",warn:y},A=e.InternalLoggerLevel.ERROR,C=Object.assign({},console);let w=C;function k(e){var n;return w=null!==(n=e.unpatchedConsole)&&void 0!==n?n:w,w}function _(n=C,t=A){const r=j;return t>e.InternalLoggerLevel.OFF&&(r.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${r.prefix}\n`,...e)}:y,r.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${r.prefix}\n`,...e)}:y,r.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${r.prefix}\n`,...e)}:y,r.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${r.prefix}\n`,...e)}:y),r}let P=j;function B(e,n){return P=_(e,n.internalLoggerLevel),P}class F{constructor(){this.unpatchedConsole=C,this.internalLogger=j,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 D(e,n){var t,r;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const a=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===a)return e;const i=(null==a?void 0:a.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({},a),{scopeSpans:[...i,...o]})]})}const M="Error";let $;const G=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");function V(n,t,r,i,o){t.debug("Initializing API");const s=function(n,t,r,a,i){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:a.value};t.debug("Pushing trace\n",r),i.execute(r)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,i,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s),function(n,t,r,i,o,s){var l;t.debug("Initializing exceptions API");let u=null;$=null!==(l=r.parseStacktrace)&&void 0!==l?l:$;const c=e=>{t.debug("Changing stacktrace parser"),$=null!=e?e:$};return c(r.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>$,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:g,spanContext:p,timestampOverwriteMs:b}={})=>{d=d||n.name||M;const h={meta:i.value,payload:{type:d,value:n.message,timestamp:b?v(b):m(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext(),context:null!=g?g:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==$?void 0:$(n).frames:void 0)?void 0:c.length)&&(h.payload.stacktrace={frames:c});const E={type:h.payload.type,value:h.payload.value,stackTrace:h.payload.stacktrace,context:h.payload.context};l||!r.dedupe||a(u)||!f(E,u)?(u=E,t.debug("Pushing exception\n",h),o.execute(h)):t.debug("Skipping error push because it is the same as the last one\n",h.payload)}}}(0,t,r,i,o,s)),function(e,n,t,r){let a,i,o;n.debug("Initializing meta API");const s=e=>{i&&r.remove(i),i={user:e},r.add(i)},l=e=>{a&&r.remove(a),a={session:e},r.add(a)};return{setUser:s,resetUser:s,setSession:l,resetSession:l,getSession:()=>r.value.session,setView:e=>{var n;if((null===(n=null==o?void 0:o.view)||void 0===n?void 0:n.name)===(null==e?void 0:e.name))return;const t=o;o={view:e},r.add(o),t&&r.remove(t)},getView:()=>r.value.view}}(0,t,0,i)),function(n,t,r,i,o,s){var l;t.debug("Initializing logs API");let u=null;const c=null!==(l=r.logArgsSerializer)&&void 0!==l?l:G;return{pushLog:(n,{context:l,level:d,skipDedupe:g,spanContext:p,timestampOverwriteMs:b}={})=>{try{const E={type:e.TransportItemType.LOG,payload:{message:c(n),level:null!=d?d:h,context:null!=l?l:{},timestamp:b?v(b):m(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext()},meta:i.value},y={message:E.payload.message,level:E.payload.level,context:E.payload.context};if(!g&&r.dedupe&&!a(u)&&f(y,u))return void t.debug("Skipping log push because it is the same as the last one\n",E.payload);u=y,t.debug("Pushing log\n",E),o.execute(E)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,r,i,o,s)),function(n,t,r,i,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?v(g):m(),context:null!=c?c:{}}),meta:i.value},b={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&r.dedupe&&!a(l)&&f(b,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=b,t.debug("Pushing measurement\n",p),o.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,r,i,o,s)),function(n,t,r,i,o,s){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d,spanContext:g,timestampOverwriteMs:p}={})=>{try{const b={meta:i.value,payload:{name:n,domain:null!=c?c:r.eventDomain,attributes:u,timestamp:p?v(p):m(),trace:g?{trace_id:g.traceId,span_id:g.spanId}:s.getTraceContext()},type:e.TransportItemType.EVENT},h={name:b.payload.name,attributes:b.payload.attributes,domain:b.payload.domain};if(!d&&r.dedupe&&!a(l)&&f(h,l))return void t.debug("Skipping event push because it is the same as the last one\n",b.payload);l=h,t.debug("Pushing event\n",b),o.execute(b)}catch(e){t.error("Error pushing event",e)}}}}(0,t,r,i,o,s))}const z="1.9.0";const U="_faroInternal";function K(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(T,U,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function H(){return U in T}function W(n,t,r,a,i,o,s){return t.debug("Initializing Faro"),e.faro={api:o,config:r,instrumentations:s,internalLogger:t,metas:a,pause:i.pause,transports:i,unpatchedConsole:n,unpause:i.unpause},K(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 T)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(T,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=F,e.BaseInstrumentation=class extends F{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends F{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_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=z,e.allLogLevels=E,e.createInternalLogger=_,e.createPromiseBuffer=function(e){const{size:n,concurrency:t}=e,r=[];let a=0;const i=()=>{if(a<t&&r.length){const{producer:e,resolve:n,reject:t}=r.shift();a++,e().then((e=>{a--,i(),n(e)}),(e=>{a--,i(),t(e)}))}};return{add:e=>{if(r.length+a>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{r.push({producer:e,resolve:n,reject:t}),i()}))}}},e.dateNow=function(){return Date.now()},e.deepEqual=f,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultExceptionType=M,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=A,e.defaultLogArgsSerializer=G,e.defaultLogLevel=h,e.defaultUnpatchedConsole=C,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>I[Math.floor(59*Math.random())])).join("")},e.getCurrentTimestamp=m,e.getInternalFaroFromGlobalObject=function(){return T[U]},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=S[n.type],a=t[r];t=Object.assign(Object.assign({},t),{[r]:void 0===a?[n.payload]:[...a,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:D(t.traces,n.payload.resourceSpans)})}})),t},e.globalObject=T,e.initializeFaro=function(e){const n=k(e),t=B(n,e);if(H()&&!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 a=()=>t.reduce(((e,n)=>Object.assign(e,l(n)?n():n)),{}),i=()=>{if(r.length){const e=a();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),t.push(...e),i()},remove:(...e)=>{n.debug("Removing metas\n",e),t=t.filter((n=>!e.includes(n))),i()},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 a()}}}(0,t),a=x(n,t,e,r),i=V(0,t,e,r,a),o=function(e,n,t,r,a,i){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=a,s.api=i,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 a=o.reduce(((n,t,r)=>null===n&&t.name===e.name?r:null),null);a?(null===(r=(t=o[a]).destroy)||void 0===r||r.call(t),o.splice(a,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,r,a,i),s=W(n,t,e,r,a,i,o);return function(e){var n,t;const r={sdk:{version:z},app:{bundleId:e.config.app.name&&(a=e.config.app.name,null==T?void 0:T[`__faroBundleId_${a}`])}};var a;const i=null===(n=e.config.sessionTracking)||void 0===n?void 0:n.session;i&&e.api.setSession(i),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=U,e.isArray=u,e.isBoolean=e=>n(e,"boolean"),e.isDomError=e=>t(e,"DOMError"),e.isDomException=e=>t(e,"DOMException"),e.isElement=e=>g&&r(e,Element),e.isElementDefined=g,e.isError=e=>d&&r(e,Error),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=H,e.isMap=e=>p&&r(e,Map),e.isMapDefined=p,e.isNull=a,e.isNumber=o,e.isObject=s,e.isPrimitive=e=>!s(e)&&!l(e),e.isRegExp=e=>t(e,"RegExp"),e.isString=i,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=y,e.setInternalFaroOnGlobalObject=K,e.transportItemTypeToBodyKey=S,e}({});

@@ -14,2 +14,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -16,0 +17,0 @@ export interface EventsAPI {

@@ -33,2 +33,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -35,0 +36,0 @@ export interface ExceptionsAPI {

@@ -17,2 +17,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -19,0 +20,0 @@ export interface LogsAPI {

@@ -19,2 +19,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -21,0 +22,0 @@ export interface MeasurementsAPI {

@@ -7,3 +7,3 @@ import type { Patterns } from '../config';

readonly name = "@grafana/transport-mock";
readonly version = "1.8.2";
readonly version = "1.9.0";
items: TransportItem[];

@@ -10,0 +10,0 @@ constructor(ignoreURLs?: Patterns);

export declare function dateNow(): number;
export declare function getCurrentTimestamp(): string;
export declare function timestampToIsoString(value: number): string;
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';
export { deepEqual } from './deepEqual';
export { getCurrentTimestamp } from './getCurrentTimestamp';
export { getCurrentTimestamp } from './date';
export { 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, } from './is';

@@ -5,0 +5,0 @@ export type { IsFnHelper } from './is';

@@ -1,1 +0,1 @@

export declare const VERSION = "1.8.2";
export declare const VERSION = "1.9.0";

@@ -6,6 +6,7 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
function initializeEventsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
var lastPayload = null;
var pushEvent = function (name, attributes, domain, _a) {
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext;
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
try {

@@ -18,3 +19,3 @@ var item = {

attributes: attributes,
timestamp: (0, utils_1.getCurrentTimestamp)(),
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
trace: spanContext

@@ -21,0 +22,0 @@ ? {

@@ -6,2 +6,3 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
var const_1 = require("./const");

@@ -20,3 +21,3 @@ var stacktraceParser;

var pushError = function (error, _a) {
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, stackFrames = _b.stackFrames, type = _b.type, context = _b.context, spanContext = _b.spanContext;
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, stackFrames = _b.stackFrames, type = _b.type, context = _b.context, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
type = type || error.name || const_1.defaultExceptionType;

@@ -28,3 +29,3 @@ var item = {

value: error.message,
timestamp: (0, utils_1.getCurrentTimestamp)(),
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
trace: spanContext

@@ -31,0 +32,0 @@ ? {

@@ -6,2 +6,3 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
var const_1 = require("./const");

@@ -14,3 +15,3 @@ function initializeLogsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {

var pushLog = function (args, _a) {
var _b = _a === void 0 ? {} : _a, context = _b.context, level = _b.level, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext;
var _b = _a === void 0 ? {} : _a, context = _b.context, level = _b.level, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
try {

@@ -23,3 +24,3 @@ var item = {

context: context !== null && context !== void 0 ? context : {},
timestamp: (0, utils_1.getCurrentTimestamp)(),
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
trace: spanContext

@@ -26,0 +27,0 @@ ? {

@@ -17,2 +17,3 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
function initializeMeasurementsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {

@@ -22,4 +23,3 @@ internalLogger.debug('Initializing measurements API');

var pushMeasurement = function (payload, _a) {
var _b;
var _c = _a === void 0 ? {} : _a, skipDedupe = _c.skipDedupe, context = _c.context, spanContext = _c.spanContext;
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, context = _b.context, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
try {

@@ -33,3 +33,3 @@ var item = {

}
: tracesApi.getTraceContext(), timestamp: (_b = payload.timestamp) !== null && _b !== void 0 ? _b : (0, utils_1.getCurrentTimestamp)(), context: context !== null && context !== void 0 ? context : {} }),
: tracesApi.getTraceContext(), timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(), context: context !== null && context !== void 0 ? context : {} }),
meta: metas.value,

@@ -36,0 +36,0 @@ };

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dateNow = void 0;
exports.timestampToIsoString = exports.getCurrentTimestamp = exports.dateNow = void 0;
function dateNow() {

@@ -8,2 +8,10 @@ return Date.now();

exports.dateNow = dateNow;
function getCurrentTimestamp() {
return new Date().toISOString();
}
exports.getCurrentTimestamp = getCurrentTimestamp;
function timestampToIsoString(value) {
return new Date(value).toISOString();
}
exports.timestampToIsoString = timestampToIsoString;
//# sourceMappingURL=date.js.map

@@ -6,4 +6,4 @@ "use strict";

Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deepEqual_1.deepEqual; } });
var getCurrentTimestamp_1 = require("./getCurrentTimestamp");
Object.defineProperty(exports, "getCurrentTimestamp", { enumerable: true, get: function () { return getCurrentTimestamp_1.getCurrentTimestamp; } });
var date_1 = require("./date");
Object.defineProperty(exports, "getCurrentTimestamp", { enumerable: true, get: function () { return date_1.getCurrentTimestamp; } });
var is_1 = require("./is");

@@ -50,4 +50,4 @@ Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return is_1.isArray; } });

Object.defineProperty(exports, "getBundleId", { enumerable: true, get: function () { return sourceMaps_1.getBundleId; } });
var date_1 = require("./date");
Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () { return date_1.dateNow; } });
var date_2 = require("./date");
Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () { return date_2.dateNow; } });
//# sourceMappingURL=index.js.map

@@ -5,3 +5,3 @@ "use strict";

// auto-generated by bin/genVersion.ts
exports.VERSION = '1.8.2';
exports.VERSION = '1.9.0';
//# sourceMappingURL=version.js.map
import { TransportItemType } from '../../transports';
import { deepEqual, getCurrentTimestamp, isNull } from '../../utils';
import { timestampToIsoString } from '../../utils/date';
export function initializeEventsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
let lastPayload = null;
const pushEvent = (name, attributes, domain, { skipDedupe, spanContext } = {}) => {
const pushEvent = (name, attributes, domain, { skipDedupe, spanContext, timestampOverwriteMs } = {}) => {
try {

@@ -13,3 +14,3 @@ const item = {

attributes,
timestamp: getCurrentTimestamp(),
timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),
trace: spanContext

@@ -16,0 +17,0 @@ ? {

import { TransportItemType } from '../../transports';
import { deepEqual, getCurrentTimestamp, isNull } from '../../utils';
import { timestampToIsoString } from '../../utils/date';
import { defaultExceptionType } from './const';

@@ -15,3 +16,3 @@ let stacktraceParser;

const getStacktraceParser = () => stacktraceParser;
const pushError = (error, { skipDedupe, stackFrames, type, context, spanContext } = {}) => {
const pushError = (error, { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs } = {}) => {
type = type || error.name || defaultExceptionType;

@@ -23,3 +24,3 @@ const item = {

value: error.message,
timestamp: getCurrentTimestamp(),
timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),
trace: spanContext

@@ -26,0 +27,0 @@ ? {

import { TransportItemType } from '../../transports';
import { deepEqual, defaultLogLevel, getCurrentTimestamp, isNull } from '../../utils';
import { timestampToIsoString } from '../../utils/date';
import { defaultLogArgsSerializer } from './const';

@@ -9,3 +10,3 @@ export function initializeLogsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {

const logArgsSerializer = (_a = config.logArgsSerializer) !== null && _a !== void 0 ? _a : defaultLogArgsSerializer;
const pushLog = (args, { context, level, skipDedupe, spanContext } = {}) => {
const pushLog = (args, { context, level, skipDedupe, spanContext, timestampOverwriteMs } = {}) => {
try {

@@ -18,3 +19,3 @@ const item = {

context: context !== null && context !== void 0 ? context : {},
timestamp: getCurrentTimestamp(),
timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),
trace: spanContext

@@ -21,0 +22,0 @@ ? {

import { TransportItemType } from '../../transports';
import { deepEqual, getCurrentTimestamp, isNull } from '../../utils';
import { timestampToIsoString } from '../../utils/date';
export function initializeMeasurementsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
internalLogger.debug('Initializing measurements API');
let lastPayload = null;
const pushMeasurement = (payload, { skipDedupe, context, spanContext } = {}) => {
var _a;
const pushMeasurement = (payload, { skipDedupe, context, spanContext, timestampOverwriteMs } = {}) => {
try {

@@ -16,3 +16,3 @@ const item = {

}
: tracesApi.getTraceContext(), timestamp: (_a = payload.timestamp) !== null && _a !== void 0 ? _a : getCurrentTimestamp(), context: context !== null && context !== void 0 ? context : {} }),
: tracesApi.getTraceContext(), timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(), context: context !== null && context !== void 0 ? context : {} }),
meta: metas.value,

@@ -19,0 +19,0 @@ };

export function dateNow() {
return Date.now();
}
export function getCurrentTimestamp() {
return new Date().toISOString();
}
export function timestampToIsoString(value) {
return new Date(value).toISOString();
}
//# sourceMappingURL=date.js.map
export { deepEqual } from './deepEqual';
export { getCurrentTimestamp } from './getCurrentTimestamp';
export { getCurrentTimestamp } from './date';
export { 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, } from './is';

@@ -4,0 +4,0 @@ export { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';

// auto-generated by bin/genVersion.ts
export const VERSION = '1.8.2';
export const VERSION = '1.9.0';
//# sourceMappingURL=version.js.map

@@ -6,6 +6,7 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
function initializeEventsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
var lastPayload = null;
var pushEvent = function (name, attributes, domain, _a) {
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext;
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
try {

@@ -18,3 +19,3 @@ var item = {

attributes: attributes,
timestamp: (0, utils_1.getCurrentTimestamp)(),
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
trace: spanContext

@@ -21,0 +22,0 @@ ? {

@@ -98,2 +98,8 @@ "use strict";

});
it('Sets the timestamp to the provided custom timestamp', function () {
var _a;
api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });
expect(transport.items).toHaveLength(1);
expect(((_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload).timestamp).toBe('1970-01-01T00:00:00.123Z');
});
});

@@ -100,0 +106,0 @@ });

@@ -6,2 +6,3 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
var const_1 = require("./const");

@@ -20,3 +21,3 @@ var stacktraceParser;

var pushError = function (error, _a) {
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, stackFrames = _b.stackFrames, type = _b.type, context = _b.context, spanContext = _b.spanContext;
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, stackFrames = _b.stackFrames, type = _b.type, context = _b.context, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
type = type || error.name || const_1.defaultExceptionType;

@@ -28,3 +29,3 @@ var item = {

value: error.message,
timestamp: (0, utils_1.getCurrentTimestamp)(),
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
trace: spanContext

@@ -31,0 +32,0 @@ ? {

@@ -157,2 +157,8 @@ "use strict";

});
it('Sets the timestamp to the provided custom timestamp', function () {
var _a;
api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });
expect(transport.items).toHaveLength(1);
expect(((_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload).timestamp).toBe('1970-01-01T00:00:00.123Z');
});
});

@@ -159,0 +165,0 @@ });

@@ -6,2 +6,3 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
var const_1 = require("./const");

@@ -14,3 +15,3 @@ function initializeLogsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {

var pushLog = function (args, _a) {
var _b = _a === void 0 ? {} : _a, context = _b.context, level = _b.level, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext;
var _b = _a === void 0 ? {} : _a, context = _b.context, level = _b.level, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
try {

@@ -23,3 +24,3 @@ var item = {

context: context !== null && context !== void 0 ? context : {},
timestamp: (0, utils_1.getCurrentTimestamp)(),
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
trace: spanContext

@@ -26,0 +27,0 @@ ? {

@@ -109,4 +109,10 @@ "use strict";

});
it('Sets the timestamp to the provided custom timestamp', function () {
var _a;
api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });
expect(transport.items).toHaveLength(1);
expect(((_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload).timestamp).toBe('1970-01-01T00:00:00.123Z');
});
});
});
//# sourceMappingURL=initialize.test.js.map

@@ -17,2 +17,3 @@ "use strict";

var utils_1 = require("../../utils");
var date_1 = require("../../utils/date");
function initializeMeasurementsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {

@@ -22,4 +23,3 @@ internalLogger.debug('Initializing measurements API');

var pushMeasurement = function (payload, _a) {
var _b;
var _c = _a === void 0 ? {} : _a, skipDedupe = _c.skipDedupe, context = _c.context, spanContext = _c.spanContext;
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, context = _b.context, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs;
try {

@@ -33,3 +33,3 @@ var item = {

}
: tracesApi.getTraceContext(), timestamp: (_b = payload.timestamp) !== null && _b !== void 0 ? _b : (0, utils_1.getCurrentTimestamp)(), context: context !== null && context !== void 0 ? context : {} }),
: tracesApi.getTraceContext(), timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(), context: context !== null && context !== void 0 ? context : {} }),
meta: metas.value,

@@ -36,0 +36,0 @@ };

@@ -159,4 +159,10 @@ "use strict";

});
it('Sets the timestamp to the provided custom timestamp', function () {
var _a;
api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });
expect(transport.items).toHaveLength(1);
expect(((_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload).timestamp).toBe('1970-01-01T00:00:00.123Z');
});
});
});
//# sourceMappingURL=initialize.test.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dateNow = void 0;
exports.timestampToIsoString = exports.getCurrentTimestamp = exports.dateNow = void 0;
function dateNow() {

@@ -8,2 +8,10 @@ return Date.now();

exports.dateNow = dateNow;
function getCurrentTimestamp() {
return new Date().toISOString();
}
exports.getCurrentTimestamp = getCurrentTimestamp;
function timestampToIsoString(value) {
return new Date(value).toISOString();
}
exports.timestampToIsoString = timestampToIsoString;
//# sourceMappingURL=date.js.map

@@ -6,4 +6,4 @@ "use strict";

Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deepEqual_1.deepEqual; } });
var getCurrentTimestamp_1 = require("./getCurrentTimestamp");
Object.defineProperty(exports, "getCurrentTimestamp", { enumerable: true, get: function () { return getCurrentTimestamp_1.getCurrentTimestamp; } });
var date_1 = require("./date");
Object.defineProperty(exports, "getCurrentTimestamp", { enumerable: true, get: function () { return date_1.getCurrentTimestamp; } });
var is_1 = require("./is");

@@ -50,4 +50,4 @@ Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return is_1.isArray; } });

Object.defineProperty(exports, "getBundleId", { enumerable: true, get: function () { return sourceMaps_1.getBundleId; } });
var date_1 = require("./date");
Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () { return date_1.dateNow; } });
var date_2 = require("./date");
Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () { return date_2.dateNow; } });
//# sourceMappingURL=index.js.map

@@ -5,3 +5,3 @@ "use strict";

// auto-generated by bin/genVersion.ts
exports.VERSION = '1.8.2';
exports.VERSION = '1.9.0';
//# sourceMappingURL=version.js.map

@@ -14,2 +14,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -16,0 +17,0 @@ export interface EventsAPI {

@@ -33,2 +33,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -35,0 +36,0 @@ export interface ExceptionsAPI {

@@ -17,2 +17,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -19,0 +20,0 @@ export interface LogsAPI {

@@ -19,2 +19,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -21,0 +22,0 @@ export interface MeasurementsAPI {

@@ -14,2 +14,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -16,0 +17,0 @@ export interface EventsAPI {

@@ -33,2 +33,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -35,0 +36,0 @@ export interface ExceptionsAPI {

@@ -17,2 +17,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -19,0 +20,0 @@ export interface LogsAPI {

@@ -19,2 +19,3 @@ import type { SpanContext } from '@opentelemetry/api';

spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
timestampOverwriteMs?: number;
}

@@ -21,0 +22,0 @@ export interface MeasurementsAPI {

@@ -7,3 +7,3 @@ import type { Patterns } from '../config';

readonly name = "@grafana/transport-mock";
readonly version = "1.8.2";
readonly version = "1.9.0";
items: TransportItem[];

@@ -10,0 +10,0 @@ constructor(ignoreURLs?: Patterns);

export declare function dateNow(): number;
export declare function getCurrentTimestamp(): string;
export declare function timestampToIsoString(value: number): string;
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';
export { deepEqual } from './deepEqual';
export { getCurrentTimestamp } from './getCurrentTimestamp';
export { getCurrentTimestamp } from './date';
export { 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, } from './is';

@@ -5,0 +5,0 @@ export type { IsFnHelper } from './is';

@@ -1,1 +0,1 @@

export declare const VERSION = "1.8.2";
export declare const VERSION = "1.9.0";

@@ -7,3 +7,3 @@ import type { Patterns } from '../config';

readonly name = "@grafana/transport-mock";
readonly version = "1.8.2";
readonly version = "1.9.0";
items: TransportItem[];

@@ -10,0 +10,0 @@ constructor(ignoreURLs?: Patterns);

export declare function dateNow(): number;
export declare function getCurrentTimestamp(): string;
export declare function timestampToIsoString(value: number): string;
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';
export { deepEqual } from './deepEqual';
export { getCurrentTimestamp } from './getCurrentTimestamp';
export { getCurrentTimestamp } from './date';
export { 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, } from './is';

@@ -5,0 +5,0 @@ export type { IsFnHelper } from './is';

@@ -1,1 +0,1 @@

export declare const VERSION = "1.8.2";
export declare const VERSION = "1.9.0";
{
"name": "@grafana/faro-core",
"version": "1.8.2",
"version": "1.9.0",
"description": "Core package of Faro.",

@@ -60,3 +60,3 @@ "keywords": [

},
"gitHead": "ce860054636cc98bc3ad86420c3da19cccfc971a"
"gitHead": "adbb672f86fe8158022cb93a2802edf6219e6655"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc