@grafana/faro-core 2.2.1 → 2.2.3

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.
@@ -1 +1 @@
1
- var GrafanaFaroCore=function(e){"use strict";class t{constructor(e,t){var n,r;this.signalBuffer=[],this.itemLimit=null!==(n=null==t?void 0:t.itemLimit)&&void 0!==n?n:50,this.sendTimeout=null!==(r=null==t?void 0:t.sendTimeout)&&void 0!==r?r:250,this.paused=(null==t?void 0:t.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 t=new Map;return e.forEach(e=>{const n=JSON.stringify(e.meta);let r=t.get(n);r=void 0===r?[e]:[...r,e],t.set(n,r)}),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var n;e.TransportItemType=void 0,(n=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",n.LOG="log",n.MEASUREMENT="measurement",n.TRACE="trace",n.EVENT="event";const r={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function s(e,n,r,s){var a;n.debug("Initializing transports");const o=[];let u=r.paused,c=[];const l=e=>{let t=e;for(const e of c){const n=t.map(e).filter(Boolean);if(0===n.length)return[];t=i(n,r)}return t},d=e=>{const t=l(e);if(0!==t.length)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let g;(null===(a=r.batching)||void 0===a?void 0:a.enabled)&&(g=new t(d,{sendTimeout:r.batching.sendTimeout,itemLimit:r.batching.itemLimit,paused:u}));return{add:(...t)=>{n.debug("Adding transports"),t.forEach(t=>{n.debug(`Adding "${t.name}" transport`);o.some(e=>e===t)?n.warn(`Transport ${t.name} is already added`):(t.unpatchedConsole=e,t.internalLogger=n,t.config=r,t.metas=s,o.push(t))})},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",c),e.forEach(e=>{e&&c.push(e)})},getBeforeSendHooks:()=>[...c],execute:e=>{var t;u||((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&(null==g||g.addItem(e)),(e=>{var t,s;if((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&o.every(e=>e.isBatched()))return;const[i]=l([e]);if(void 0!==i)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,i),e.isBatched()?(null===(s=r.batching)||void 0===s?void 0:s.enabled)||e.send([i]):e.send(i)})(e))},isPaused:()=>u,pause:()=>{n.debug("Pausing transports"),null==g||g.pause(),u=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach(e=>{n.debug(`Removing "${e.name}" transport`);const t=o.indexOf(e);-1!==t?o.splice(t,1):n.warn(`Transport "${e.name}" is not added`)})},removeBeforeSendHooks:(...e)=>{c.filter(t=>!e.includes(t))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),null==g||g.start(),u=!1}}}function i(t,n){if(n.preserveOriginalError)for(const n of t)n.type===e.TransportItemType.EXCEPTION&&delete n.payload.originalError;return t}function a(e,t){return typeof e===t}function o(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function u(e,t){try{return e instanceof t}catch(e){return!1}}const c=e=>a(e,"null"),l=e=>a(e,"string"),d=e=>a(e,"number")&&!isNaN(e)||a(e,"bigint"),g=e=>!c(e)&&a(e,"object"),p=e=>a(e,"function"),f=e=>o(e,"Array"),m="undefined"!=typeof Event,b="undefined"!=typeof Error,h=e=>b&&u(e,Error),v="undefined"!=typeof Element,E="undefined"!=typeof Map;function y(e){return null==e||(f(e)||l(e)?0===e.length:!!g(e)&&0===Object.keys(e).length)}function I(e,t){if(e===t)return!0;if(a(e,"number")&&isNaN(e))return a(t,"number")&&isNaN(t);const n=f(e),r=f(t);if(n!==r)return!1;if(n&&r){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!==r--;)if(!I(e[r],t[r]))return!1;return!0}const s=g(e),i=g(t);if(s!==i)return!1;if(e&&t&&s&&i){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(!I(e[r],t[r]))return!1;return!0}return!1}function T(){return Date.now()}function O(){return(new Date).toISOString()}function S(e){return new Date(e).toISOString()}var A;e.LogLevel=void 0,(A=e.LogLevel||(e.LogLevel={})).TRACE="trace",A.DEBUG="debug",A.INFO="info",A.LOG="log",A.WARN="warn",A.ERROR="error";const L=e.LogLevel.LOG,j=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function _(){}const x="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map(()=>x[Math.floor(59*Math.random())]).join("")}const w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function R(){const e=new WeakSet;return function(t,n){if(g(n)&&null!==n){if(e.has(n))return null;e.add(n)}return n}}function U(e={}){return JSON.stringify(null!=e?e:{},R())}function k(e={}){const t={};for(const[n,r]of Object.entries(e))t[n]=g(r)&&null!==r?U(r):String(r);return t}class C{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter(t=>t!==e)}notify(e){this.subscribers.forEach(t=>t(e))}first(){const e=new C,t=t=>{e.notify(t),n.unsubscribe()},n=this.subscribe(t),r=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,r,t)}takeWhile(e){const t=new C,n=r=>{e(r)?t.notify(r):t.unsubscribe(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}filter(e){const t=new C,n=n=>{e(n)&&t.notify(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}merge(...e){const t=new C,n=[];e.forEach(e=>{const r=e.subscribe(e=>{t.notify(e)});n.push(r)});const r=t.unsubscribeAll.bind(t);return t.unsubscribe=()=>{n.forEach(e=>e.unsubscribe()),r()},t}withUnsubscribeOverride(e,t,n){return e.unsubscribe=e=>{t(e),this.unsubscribe(n)},e}unsubscribeAll(){this.subscribers=[]}}var B;e.InternalLoggerLevel=void 0,(B=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[B.OFF=0]="OFF",B[B.ERROR=1]="ERROR",B[B.WARN=2]="WARN",B[B.INFO=3]="INFO",B[B.VERBOSE=4]="VERBOSE";const P={debug:_,error:_,info:_,prefix:"Faro",warn:_},M=e.InternalLoggerLevel.ERROR,F=Object.assign({},console);let D=F;function V(e){var t;return D=null!==(t=e.unpatchedConsole)&&void 0!==t?t:D,D}function $(t=F,n=M){const r=P;return n>e.InternalLoggerLevel.OFF&&(r.error=n>=e.InternalLoggerLevel.ERROR?function(...e){t.error(`${r.prefix}\n`,...e)}:_,r.warn=n>=e.InternalLoggerLevel.WARN?function(...e){t.warn(`${r.prefix}\n`,...e)}:_,r.info=n>=e.InternalLoggerLevel.INFO?function(...e){t.info(`${r.prefix}\n`,...e)}:_,r.debug=n>=e.InternalLoggerLevel.VERBOSE?function(...e){t.debug(`${r.prefix}\n`,...e)}:_),r}let z=P;function G(e,t){return z=$(e,t.internalLoggerLevel),z}class H{constructor(){this.unpatchedConsole=F,this.internalLogger=P,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 K(e,t){var n,r;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const s=null===(n=e.resourceSpans)||void 0===n?void 0:n[0];if(void 0===s)return e;const i=(null==s?void 0:s.scopeSpans)||[],a=(null===(r=null==t?void 0:t[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},s),{scopeSpans:[...i,...a]})]})}const W={Normal:"normal",Critical:"critical"};var X;e.UserActionState=void 0,(X=e.UserActionState||(e.UserActionState={}))[X.Started=0]="Started",X[X.Halted=1]="Halted",X[X.Cancelled=2]="Cancelled",X[X.Ended=3]="Ended";class J{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(p(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}class q extends C{constructor({name:t,parentId:n,trigger:r,transports:s,attributes:i,trackUserActionsExcludeItem:a,importance:o=W.Normal,pushEvent:u}){super(),this.name=t,this.attributes=i,this.id=N(),this.trigger=r,this.parentId=null!=n?n:this.id,this.trackUserActionsExcludeItem=a,this.importance=o,this._pushEvent=u,this._itemBuffer=new J,this._transports=s,this._state=e.UserActionState.Started,this._start()}addItem(t){return this._state===e.UserActionState.Started&&(this._itemBuffer.addItem(t),!0)}_start(){this._state=e.UserActionState.Started,this._state===e.UserActionState.Started&&(this.startTime=T())}halt(){this._state===e.UserActionState.Started&&(this._state=e.UserActionState.Halted,this.notify(this._state))}cancel(){this._state===e.UserActionState.Started&&this._itemBuffer.flushBuffer(e=>{this._transports.execute(e)}),this._state=e.UserActionState.Cancelled,this.notify(this._state)}end(){if(this._state===e.UserActionState.Cancelled)return;const t=T(),n=t-this.startTime;this._state=e.UserActionState.Ended,this._itemBuffer.flushBuffer(t=>{if(function(t,n){return(null==n?void 0:n(t))||t.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===t.payload.type}(t,this.trackUserActionsExcludeItem))return void this._transports.execute(t);const n=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{action:{parentId:this.id,name:this.name}})});this._transports.execute(n)}),this._state=e.UserActionState.Ended,this.notify(this._state),this._pushEvent("faro.user.action",Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:t.toString(),userActionDuration:n.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},k(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:e=>(e.action={id:this.id,name:this.name},e)})}getState(){return this._state}}const Q=new C;function Y(t,n){if(!t)return!1;return(null==t?void 0:t.getState())===e.UserActionState.Started&&(t.addItem(n),!0)}const Z="Error";let ee;function te({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){var o;t.debug("Initializing exceptions API");let u=null;ee=null!==(o=n.parseStacktrace)&&void 0!==o?o:ee;const d=e=>{t.debug("Changing stacktrace parser"),ee=null!=e?e:ee},{ignoreErrors:p=[],preserveOriginalError:m}=n;return d(n.parseStacktrace),{changeStacktraceParser:d,getStacktraceParser:()=>ee,pushError:(o,{skipDedupe:d,stackFrames:b,type:v,context:E,spanContext:T,timestampOverwriteMs:A,originalError:L}={})=>{if(!function(e,t){const{message:n,name:r,stack:s}=t;return i=e,a=n+" "+r+" "+s,i.some(e=>l(e)?a.includes(e):!!a.match(e));var i,a}(p,null!=L?L:o))try{const l=k(Object.assign(Object.assign({},function(e){let t=e.cause;h(t)?t=e.cause.toString():null!==t&&(g(e.cause)||f(e.cause))?t=U(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(null!=L?L:o)),null!=E?E:{})),p={meta:r.value,payload:Object.assign(Object.assign({type:v||o.name||Z,value:o.message,timestamp:A?S(A):O(),trace:T?{trace_id:T.traceId,span_id:T.spanId}:i.getTraceContext()},y(l)?{}:{context:l}),m?{originalError:L}:{}),type:e.TransportItemType.EXCEPTION};(null==(b=null!=b?b:o.stack?null==ee?void 0:ee(o).frames:void 0)?void 0:b.length)&&(p.payload.stacktrace={frames:b});const j={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace,context:p.payload.context};if(!d&&n.dedupe&&!c(u)&&I(j,u))return void t.debug("Skipping error push because it is the same as the last one\n",p.payload);u=j,t.debug("Pushing exception\n",p),Y(a.getActiveUserAction(),p)||s.execute(p)}catch(e){t.error("Error pushing event",e)}}}}const ne=e=>e.map(e=>{try{return String(e)}catch(e){return""}}).join(" ");function re(t,n,r,s,i){n.debug("Initializing API");let a=null;const o=function({transports:t,internalLogger:n,config:r,pushEvent:s}){var i;const a=null===(i=r.userActionsInstrumentation)||void 0===i?void 0:i.excludeItem;let o;const u=()=>o;return{startUserAction:(r,i,c)=>{if(void 0===u()){const n=new q({name:r,transports:t,attributes:i,trigger:(null==c?void 0:c.triggerName)||"faroApiCall",importance:(null==c?void 0:c.importance)||W.Normal,trackUserActionsExcludeItem:a,pushEvent:s});return n.filter(t=>[e.UserActionState.Ended,e.UserActionState.Cancelled].includes(t)).first().subscribe(()=>{o=void 0}),Q.notify({type:"user_action_start",userAction:n}),o=n,o}n.error("Attempted to create a new user action while one is already running. This is not possible.")},getActiveUserAction:u}}({transports:i,config:r,internalLogger:n,pushEvent:(e,t,r,s)=>{a?a(e,t,r,s):n.warn("pushEventImpl is not initialized. Event dropped:",{name:e,attributes:t,domain:r,options:s})}}),u=function(t,n,r,s,i){let a;return n.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,t)=>{n.debug("Initializing OpenTelemetry"),a={trace:e,context:t}},isOTELInitialized:()=>!!a,pushTraces:t=>{try{const r={type:e.TransportItemType.TRACE,payload:t,meta:s.value};n.debug("Pushing trace\n",r),i.execute(r)}catch(e){n.error("Error pushing trace\n",e)}}}}(0,n,0,s,i),d={internalLogger:n,userActionsApi:o,config:r,metas:s,transports:i,tracesApi:u},g=function({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){let o=null;return{pushEvent:(u,l,d,{skipDedupe:g,spanContext:p,timestampOverwriteMs:f,customPayloadTransformer:m=e=>e}={})=>{try{const b=k(l),h={meta:r.value,payload:m({name:u,domain:null!=d?d:n.eventDomain,attributes:y(b)?void 0:b,timestamp:f?S(f):O(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:i.getTraceContext()}),type:e.TransportItemType.EVENT},v={name:h.payload.name,attributes:h.payload.attributes,domain:h.payload.domain};if(!g&&n.dedupe&&!c(o)&&I(v,o))return void t.debug("Skipping event push because it is the same as the last one\n",h.payload);o=v,t.debug("Pushing event\n",h),Y(a.getActiveUserAction(),h)||s.execute(h)}catch(e){t.error("Error pushing event",e)}}}}(d);return a=g.pushEvent,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},u),te(d)),function({internalLogger:e,metas:t}){let n,r,s,i;e.debug("Initializing meta API");const a=e=>{r&&t.remove(r),r={user:e},t.add(r)},o=(e,r)=>{var s;const i=null==r?void 0:r.overrides,a=i?{overrides:Object.assign(Object.assign({},null===(s=null==n?void 0:n.session)||void 0===s?void 0:s.overrides),i)}:{};n&&t.remove(n),n={session:Object.assign(Object.assign({},y(e)?void 0:e),a)},t.add(n)},u=()=>t.value.session,c=()=>t.value.page;return{setUser:a,resetUser:a,setSession:o,resetSession:o,getSession:u,setView:(e,n)=>{var r;if((null==n?void 0:n.overrides)&&o(u(),{overrides:n.overrides}),(null===(r=null==s?void 0:s.view)||void 0===r?void 0:r.name)===(null==e?void 0:e.name))return;const i=s;s={view:e},t.add(s),i&&t.remove(i)},getView:()=>t.value.view,setPage:e=>{var n;const r=l(e)?Object.assign(Object.assign({},null!==(n=null==i?void 0:i.page)&&void 0!==n?n:c()),{id:e}):e;i&&t.remove(i),i={page:r},t.add(i)},getPage:c}}(d)),function({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){var o;t.debug("Initializing logs API");let u=null;const l=null!==(o=n.logArgsSerializer)&&void 0!==o?o:ne;return{pushLog:(o,{context:d,level:g,skipDedupe:p,spanContext:f,timestampOverwriteMs:m}={})=>{try{const b=k(d),h={type:e.TransportItemType.LOG,payload:{message:l(o),level:null!=g?g:L,context:y(b)?void 0:b,timestamp:m?S(m):O(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:i.getTraceContext()},meta:r.value},v={message:h.payload.message,level:h.payload.level,context:h.payload.context};if(!p&&n.dedupe&&!c(u)&&I(v,u))return void t.debug("Skipping log push because it is the same as the last one\n",h.payload);u=v,t.debug("Pushing log\n",h),Y(a.getActiveUserAction(),h)||s.execute(h)}catch(e){t.error("Error pushing log\n",e)}}}}(d)),function({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){t.debug("Initializing measurements API");let o=null;return{pushMeasurement:(u,{skipDedupe:l,context:d,spanContext:g,timestampOverwriteMs:p}={})=>{try{const f=k(d),m={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},u),{trace:g?{trace_id:g.traceId,span_id:g.spanId}:i.getTraceContext(),timestamp:p?S(p):O(),context:y(f)?void 0:f}),meta:r.value},b={type:m.payload.type,values:m.payload.values,context:m.payload.context};if(!l&&n.dedupe&&!c(o)&&I(b,o))return void t.debug("Skipping measurement push because it is the same as the last one\n",m.payload);o=b,t.debug("Pushing measurement\n",m),Y(a.getActiveUserAction(),m)||s.execute(m)}catch(e){t.error("Error pushing measurement\n",e)}}}}(d)),g),o)}const se="2.2.1";const ie="_faroInternal";function ae(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(w,ie,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function oe(){return ie in w}function ue(t,n,r,s,i,a,o){return n.debug("Initializing Faro"),e.faro={api:a,config:r,instrumentations:o,internalLogger:n,metas:s,pause:i.pause,transports:i,unpatchedConsole:t,unpause:i.unpause},ae(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 w)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(w,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=H,e.BaseInstrumentation=class extends H{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends H{isBatched(){return!1}getIgnoreUrls(){return[]}},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.Observable=C,e.UserActionImportance=W,e.VERSION=se,e.allLogLevels=j,e.createInternalLogger=$,e.createPromiseBuffer=function(e){const{size:t,concurrency:n}=e,r=[];let s=0;const i=()=>{if(s<n&&r.length){const{producer:e,resolve:t,reject:n}=r.shift();s++,e().then(e=>{s--,i(),t(e)},e=>{s--,i(),n(e)})}};return{add:e=>{if(r.length+s>=t)throw new Error("Task buffer full");return new Promise((t,n)=>{r.push({producer:e,resolve:t,reject:n}),i()})}}},e.dateNow=T,e.deepEqual=I,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map(e=>g(e)?U(e):String(e)).join(" "),e.defaultExceptionType=Z,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=M,e.defaultLogArgsSerializer=ne,e.defaultLogLevel=L,e.defaultUnpatchedConsole=F,e.genShortID=N,e.getCircularDependencyReplacer=R,e.getCurrentTimestamp=O,e.getInternalFaroFromGlobalObject=function(){return w[ie]},e.getTransportBody=function(t){let n={meta:{}};return void 0!==t[0]&&(n.meta=t[0].meta),t.forEach(t=>{switch(t.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:{const e=r[t.type],s=n[e];n=Object.assign(Object.assign({},n),{[e]:void 0===s?[t.payload]:[...s,t.payload]});break}case e.TransportItemType.TRACE:n=Object.assign(Object.assign({},n),{traces:K(n.traces,t.payload.resourceSpans)})}}),n},e.globalObject=w,e.initializeFaro=function(e){const t=V(e),n=G(t,e);if(oe()&&!e.isolate)return void n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');n.debug("Initializing");const r=function(e,t){let n=[],r=[];const s=()=>n.reduce((e,t)=>Object.assign(e,p(t)?t():t),{}),i=()=>{if(r.length){const e=s();r.forEach(t=>t(e))}};return{add:(...e)=>{t.debug("Adding metas\n",e),n.push(...e),i()},remove:(...e)=>{t.debug("Removing metas\n",e),n=n.filter(t=>!e.includes(t)),i()},addListener:e=>{t.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),r=r.filter(t=>t!==e)},get value(){return s()}}}(0,n),i=s(t,n,e,r),a=re(0,n,e,r,i),o=function(e,t,n,r,s,i){t.debug("Initializing instrumentations");const a=[];return{add:(...o)=>{t.debug("Adding instrumentations"),o.forEach(o=>{t.debug(`Adding "${o.name}" instrumentation`),a.some(e=>e.name===o.name)?t.warn(`Instrumentation ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=t,o.config=n,o.metas=r,o.transports=s,o.api=i,a.push(o),o.initialize())})},get instrumentations(){return[...a]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach(e=>{var n,r;t.debug(`Removing "${e.name}" instrumentation`);const s=a.reduce((t,n,r)=>null===t&&n.name===e.name?r:null,null);null!==s?(null===(r=(n=a[s]).destroy)||void 0===r||r.call(n),a.splice(s,1)):t.warn(`Instrumentation "${e.name}" is not added`)})}}}(t,n,e,r,i,a),u=ue(t,n,e,r,i,a,o);return function(e){var t,n;const r={sdk:{version:se},app:{bundleId:e.config.app.name&&(s=e.config.app.name,null==w?void 0:w[`__faroBundleId_${s}`])}};var s;const i=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.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!==(n=e.config.metas)&&void 0!==n?n:[])}(u),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(u),function(e){e.instrumentations.add(...e.config.instrumentations)}(u),u},e.internalGlobalObjectKey=ie,e.isArray=f,e.isBoolean=e=>a(e,"boolean"),e.isDomError=e=>o(e,"DOMError"),e.isDomException=e=>o(e,"DOMException"),e.isElement=e=>v&&u(e,Element),e.isElementDefined=v,e.isEmpty=y,e.isError=h,e.isErrorDefined=b,e.isErrorEvent=e=>o(e,"ErrorEvent"),e.isEvent=e=>m&&u(e,Event),e.isEventDefined=m,e.isFunction=p,e.isInstanceOf=u,e.isInt=e=>d(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=oe,e.isMap=e=>E&&u(e,Map),e.isMapDefined=E,e.isNull=c,e.isNumber=d,e.isObject=g,e.isPrimitive=e=>!g(e)&&!p(e),e.isRegExp=e=>o(e,"RegExp"),e.isString=l,e.isSymbol=e=>a(e,"symbol"),e.isSyntheticEvent=e=>g(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>p(null==e?void 0:e.then),e.isToString=o,e.isTypeof=a,e.isUndefined=e=>a(e,"undefined"),e.noop=_,e.setInternalFaroOnGlobalObject=ae,e.stringifyExternalJson=U,e.stringifyObjectValues=k,e.transportItemTypeToBodyKey=r,e.unknownString="unknown",e.userActionsMessageBus=Q,e}({});
1
+ var GrafanaFaroCore=function(e){"use strict";class t{constructor(e,t){var n,r;this.signalBuffer=[],this.itemLimit=null!==(n=null==t?void 0:t.itemLimit)&&void 0!==n?n:50,this.sendTimeout=null!==(r=null==t?void 0:t.sendTimeout)&&void 0!==r?r:250,this.paused=(null==t?void 0:t.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 t=new Map;return e.forEach(e=>{const n=JSON.stringify(e.meta);let r=t.get(n);r=void 0===r?[e]:[...r,e],t.set(n,r)}),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var n;e.TransportItemType=void 0,(n=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",n.LOG="log",n.MEASUREMENT="measurement",n.TRACE="trace",n.EVENT="event";const r={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function s(e,n,r,s){var a;n.debug("Initializing transports");const o=[];let u=r.paused,c=[];const l=e=>{let t=e;for(const e of c){const n=t.map(e).filter(Boolean);if(0===n.length)return[];t=i(n,r)}return t},d=e=>{const t=l(e);if(0!==t.length)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let g;(null===(a=r.batching)||void 0===a?void 0:a.enabled)&&(g=new t(d,{sendTimeout:r.batching.sendTimeout,itemLimit:r.batching.itemLimit,paused:u}));return{add:(...t)=>{n.debug("Adding transports"),t.forEach(t=>{n.debug(`Adding "${t.name}" transport`);o.some(e=>e===t)?n.warn(`Transport ${t.name} is already added`):(t.unpatchedConsole=e,t.internalLogger=n,t.config=r,t.metas=s,o.push(t))})},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",c),e.forEach(e=>{e&&c.push(e)})},getBeforeSendHooks:()=>[...c],execute:e=>{var t;u||((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&(null==g||g.addItem(e)),(e=>{var t,s;if((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&o.every(e=>e.isBatched()))return;const[i]=l([e]);if(void 0!==i)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,i),e.isBatched()?(null===(s=r.batching)||void 0===s?void 0:s.enabled)||e.send([i]):e.send(i)})(e))},isPaused:()=>u,pause:()=>{n.debug("Pausing transports"),null==g||g.pause(),u=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach(e=>{n.debug(`Removing "${e.name}" transport`);const t=o.indexOf(e);-1!==t?o.splice(t,1):n.warn(`Transport "${e.name}" is not added`)})},removeBeforeSendHooks:(...e)=>{c.filter(t=>!e.includes(t))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),null==g||g.start(),u=!1}}}function i(t,n){if(n.preserveOriginalError)for(const n of t)n.type===e.TransportItemType.EXCEPTION&&delete n.payload.originalError;return t}function a(e,t){return typeof e===t}function o(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function u(e,t){try{return e instanceof t}catch(e){return!1}}const c=e=>a(e,"null"),l=e=>a(e,"string"),d=e=>a(e,"number")&&!isNaN(e)||a(e,"bigint"),g=e=>!c(e)&&a(e,"object"),p=e=>a(e,"function"),f=e=>o(e,"Array"),m="undefined"!=typeof Event,b="undefined"!=typeof Error,h=e=>b&&u(e,Error),v="undefined"!=typeof Element,E="undefined"!=typeof Map;function y(e){return null==e||(f(e)||l(e)?0===e.length:!!g(e)&&0===Object.keys(e).length)}function I(e,t){if(e===t)return!0;if(a(e,"number")&&isNaN(e))return a(t,"number")&&isNaN(t);const n=f(e),r=f(t);if(n!==r)return!1;if(n&&r){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!==r--;)if(!I(e[r],t[r]))return!1;return!0}const s=g(e),i=g(t);if(s!==i)return!1;if(e&&t&&s&&i){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(!I(e[r],t[r]))return!1;return!0}return!1}function T(){return Date.now()}function O(){return(new Date).toISOString()}function S(e){return new Date(e).toISOString()}var A;e.LogLevel=void 0,(A=e.LogLevel||(e.LogLevel={})).TRACE="trace",A.DEBUG="debug",A.INFO="info",A.LOG="log",A.WARN="warn",A.ERROR="error";const L=e.LogLevel.LOG,j=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function _(){}const x="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map(()=>x[Math.floor(59*Math.random())]).join("")}const w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function R(){const e=new WeakSet;return function(t,n){if(g(n)&&null!==n){if(e.has(n))return null;e.add(n)}return n}}function U(e={}){return JSON.stringify(null!=e?e:{},R())}function k(e={}){const t={};for(const[n,r]of Object.entries(e))t[n]=g(r)&&null!==r?U(r):String(r);return t}class C{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter(t=>t!==e)}notify(e){this.subscribers.forEach(t=>t(e))}first(){const e=new C,t=t=>{e.notify(t),n.unsubscribe()},n=this.subscribe(t),r=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,r,t)}takeWhile(e){const t=new C,n=r=>{e(r)?t.notify(r):t.unsubscribe(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}filter(e){const t=new C,n=n=>{e(n)&&t.notify(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}merge(...e){const t=new C,n=[];e.forEach(e=>{const r=e.subscribe(e=>{t.notify(e)});n.push(r)});const r=t.unsubscribeAll.bind(t);return t.unsubscribe=()=>{n.forEach(e=>e.unsubscribe()),r()},t}withUnsubscribeOverride(e,t,n){return e.unsubscribe=e=>{t(e),this.unsubscribe(n)},e}unsubscribeAll(){this.subscribers=[]}}var B;e.InternalLoggerLevel=void 0,(B=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[B.OFF=0]="OFF",B[B.ERROR=1]="ERROR",B[B.WARN=2]="WARN",B[B.INFO=3]="INFO",B[B.VERBOSE=4]="VERBOSE";const P={debug:_,error:_,info:_,prefix:"Faro",warn:_},M=e.InternalLoggerLevel.ERROR,F=Object.assign({},console);let D=F;function V(e){var t;return D=null!==(t=e.unpatchedConsole)&&void 0!==t?t:D,D}function $(t=F,n=M){const r=P;return n>e.InternalLoggerLevel.OFF&&(r.error=n>=e.InternalLoggerLevel.ERROR?function(...e){t.error(`${r.prefix}\n`,...e)}:_,r.warn=n>=e.InternalLoggerLevel.WARN?function(...e){t.warn(`${r.prefix}\n`,...e)}:_,r.info=n>=e.InternalLoggerLevel.INFO?function(...e){t.info(`${r.prefix}\n`,...e)}:_,r.debug=n>=e.InternalLoggerLevel.VERBOSE?function(...e){t.debug(`${r.prefix}\n`,...e)}:_),r}let z=P;function G(e,t){return z=$(e,t.internalLoggerLevel),z}class H{constructor(){this.unpatchedConsole=F,this.internalLogger=P,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 K(e,t){var n,r;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const s=null===(n=e.resourceSpans)||void 0===n?void 0:n[0];if(void 0===s)return e;const i=(null==s?void 0:s.scopeSpans)||[],a=(null===(r=null==t?void 0:t[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},s),{scopeSpans:[...i,...a]})]})}const W={Normal:"normal",Critical:"critical"};var X;e.UserActionState=void 0,(X=e.UserActionState||(e.UserActionState={}))[X.Started=0]="Started",X[X.Halted=1]="Halted",X[X.Cancelled=2]="Cancelled",X[X.Ended=3]="Ended";class J{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(p(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}class q extends C{constructor({name:t,parentId:n,trigger:r,transports:s,attributes:i,trackUserActionsExcludeItem:a,importance:o=W.Normal,pushEvent:u}){super(),this.name=t,this.attributes=i,this.id=N(),this.trigger=r,this.parentId=null!=n?n:this.id,this.trackUserActionsExcludeItem=a,this.importance=o,this._pushEvent=u,this._itemBuffer=new J,this._transports=s,this._state=e.UserActionState.Started,this._start()}addItem(t){return this._state===e.UserActionState.Started&&(this._itemBuffer.addItem(t),!0)}_start(){this._state=e.UserActionState.Started,this._state===e.UserActionState.Started&&(this.startTime=T())}halt(){this._state===e.UserActionState.Started&&(this._state=e.UserActionState.Halted,this.notify(this._state))}cancel(){this._state===e.UserActionState.Started&&this._itemBuffer.flushBuffer(e=>{this._transports.execute(e)}),this._state=e.UserActionState.Cancelled,this.notify(this._state)}end(){if(this._state===e.UserActionState.Cancelled)return;const t=T(),n=t-this.startTime;this._state=e.UserActionState.Ended,this._itemBuffer.flushBuffer(t=>{if(function(t,n){return(null==n?void 0:n(t))||t.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===t.payload.type}(t,this.trackUserActionsExcludeItem))return void this._transports.execute(t);const n=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{action:{parentId:this.id,name:this.name}})});this._transports.execute(n)}),this._state=e.UserActionState.Ended,this.notify(this._state),this._pushEvent("faro.user.action",Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:t.toString(),userActionDuration:n.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},k(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:e=>(e.action={id:this.id,name:this.name},e)})}getState(){return this._state}}const Q=new C;function Y(t,n){if(!t)return!1;return(null==t?void 0:t.getState())===e.UserActionState.Started&&(t.addItem(n),!0)}const Z="Error";let ee;function te({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){var o;t.debug("Initializing exceptions API");let u=null;ee=null!==(o=n.parseStacktrace)&&void 0!==o?o:ee;const d=e=>{t.debug("Changing stacktrace parser"),ee=null!=e?e:ee},{ignoreErrors:p=[],preserveOriginalError:m}=n;return d(n.parseStacktrace),{changeStacktraceParser:d,getStacktraceParser:()=>ee,pushError:(o,{skipDedupe:d,stackFrames:b,type:v,context:E,spanContext:T,timestampOverwriteMs:A,originalError:L}={})=>{if(!function(e,t){const{message:n,name:r,stack:s}=t;return i=e,a=n+" "+r+" "+s,i.some(e=>l(e)?a.includes(e):!!a.match(e));var i,a}(p,null!=L?L:o))try{const l=k(Object.assign(Object.assign({},function(e){let t=e.cause;h(t)?t=e.cause.toString():null!==t&&(g(e.cause)||f(e.cause))?t=U(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(null!=L?L:o)),null!=E?E:{})),p={meta:r.value,payload:Object.assign(Object.assign({type:v||o.name||Z,value:o.message,timestamp:A?S(A):O(),trace:T?{trace_id:T.traceId,span_id:T.spanId}:i.getTraceContext()},y(l)?{}:{context:l}),m?{originalError:L}:{}),type:e.TransportItemType.EXCEPTION};(null==(b=null!=b?b:o.stack?null==ee?void 0:ee(o).frames:void 0)?void 0:b.length)&&(p.payload.stacktrace={frames:b});const j={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace,context:p.payload.context};if(!d&&n.dedupe&&!c(u)&&I(j,u))return void t.debug("Skipping error push because it is the same as the last one\n",p.payload);u=j,t.debug("Pushing exception\n",p),Y(a.getActiveUserAction(),p)||s.execute(p)}catch(e){t.error("Error pushing event",e)}}}}const ne=e=>e.map(e=>{try{return String(e)}catch(e){return""}}).join(" ");function re(t,n,r,s,i){n.debug("Initializing API");let a=null;const o=function({transports:t,internalLogger:n,config:r,pushEvent:s}){var i;const a=null===(i=r.userActionsInstrumentation)||void 0===i?void 0:i.excludeItem;let o;const u=()=>o;return{startUserAction:(r,i,c)=>{if(void 0===u()){const n=new q({name:r,transports:t,attributes:i,trigger:(null==c?void 0:c.triggerName)||"faroApiCall",importance:(null==c?void 0:c.importance)||W.Normal,trackUserActionsExcludeItem:a,pushEvent:s});return n.filter(t=>[e.UserActionState.Ended,e.UserActionState.Cancelled].includes(t)).first().subscribe(()=>{o=void 0}),Q.notify({type:"user_action_start",userAction:n}),o=n,o}n.error("Attempted to create a new user action while one is already running. This is not possible.")},getActiveUserAction:u}}({transports:i,config:r,internalLogger:n,pushEvent:(e,t,r,s)=>{a?a(e,t,r,s):n.warn("pushEventImpl is not initialized. Event dropped:",{name:e,attributes:t,domain:r,options:s})}}),u=function(t,n,r,s,i){let a;return n.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,t)=>{n.debug("Initializing OpenTelemetry"),a={trace:e,context:t}},isOTELInitialized:()=>!!a,pushTraces:t=>{try{const r={type:e.TransportItemType.TRACE,payload:t,meta:s.value};n.debug("Pushing trace\n",r),i.execute(r)}catch(e){n.error("Error pushing trace\n",e)}}}}(0,n,0,s,i),d={internalLogger:n,userActionsApi:o,config:r,metas:s,transports:i,tracesApi:u},g=function({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){let o=null;return{pushEvent:(u,l,d,{skipDedupe:g,spanContext:p,timestampOverwriteMs:f,customPayloadTransformer:m=e=>e}={})=>{try{const b=k(l),h={meta:r.value,payload:m({name:u,domain:null!=d?d:n.eventDomain,attributes:y(b)?void 0:b,timestamp:f?S(f):O(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:i.getTraceContext()}),type:e.TransportItemType.EVENT},v={name:h.payload.name,attributes:h.payload.attributes,domain:h.payload.domain};if(!g&&n.dedupe&&!c(o)&&I(v,o))return void t.debug("Skipping event push because it is the same as the last one\n",h.payload);o=v,t.debug("Pushing event\n",h),Y(a.getActiveUserAction(),h)||s.execute(h)}catch(e){t.error("Error pushing event",e)}}}}(d);return a=g.pushEvent,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},u),te(d)),function({internalLogger:e,metas:t}){let n,r,s,i;e.debug("Initializing meta API");const a=e=>{r&&t.remove(r),r={user:e},t.add(r)},o=(e,r)=>{var s;const i=null==r?void 0:r.overrides,a=i?{overrides:Object.assign(Object.assign({},null===(s=null==n?void 0:n.session)||void 0===s?void 0:s.overrides),i)}:{};n&&t.remove(n),n={session:Object.assign(Object.assign({},y(e)?void 0:e),a)},t.add(n)},u=()=>t.value.session,c=()=>t.value.page;return{setUser:a,resetUser:a,setSession:o,resetSession:o,getSession:u,setView:(e,n)=>{var r;if((null==n?void 0:n.overrides)&&o(u(),{overrides:n.overrides}),(null===(r=null==s?void 0:s.view)||void 0===r?void 0:r.name)===(null==e?void 0:e.name))return;const i=s;s={view:e},t.add(s),i&&t.remove(i)},getView:()=>t.value.view,setPage:e=>{var n;const r=l(e)?Object.assign(Object.assign({},null!==(n=null==i?void 0:i.page)&&void 0!==n?n:c()),{id:e}):e;i&&t.remove(i),i={page:r},t.add(i)},getPage:c}}(d)),function({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){var o;t.debug("Initializing logs API");let u=null;const l=null!==(o=n.logArgsSerializer)&&void 0!==o?o:ne;return{pushLog:(o,{context:d,level:g,skipDedupe:p,spanContext:f,timestampOverwriteMs:m}={})=>{try{const b=k(d),h={type:e.TransportItemType.LOG,payload:{message:l(o),level:null!=g?g:L,context:y(b)?void 0:b,timestamp:m?S(m):O(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:i.getTraceContext()},meta:r.value},v={message:h.payload.message,level:h.payload.level,context:h.payload.context};if(!p&&n.dedupe&&!c(u)&&I(v,u))return void t.debug("Skipping log push because it is the same as the last one\n",h.payload);u=v,t.debug("Pushing log\n",h),Y(a.getActiveUserAction(),h)||s.execute(h)}catch(e){t.error("Error pushing log\n",e)}}}}(d)),function({internalLogger:t,config:n,metas:r,transports:s,tracesApi:i,userActionsApi:a}){t.debug("Initializing measurements API");let o=null;return{pushMeasurement:(u,{skipDedupe:l,context:d,spanContext:g,timestampOverwriteMs:p}={})=>{try{const f=k(d),m={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},u),{trace:g?{trace_id:g.traceId,span_id:g.spanId}:i.getTraceContext(),timestamp:p?S(p):O(),context:y(f)?void 0:f}),meta:r.value},b={type:m.payload.type,values:m.payload.values,context:m.payload.context};if(!l&&n.dedupe&&!c(o)&&I(b,o))return void t.debug("Skipping measurement push because it is the same as the last one\n",m.payload);o=b,t.debug("Pushing measurement\n",m),Y(a.getActiveUserAction(),m)||s.execute(m)}catch(e){t.error("Error pushing measurement\n",e)}}}}(d)),g),o)}const se="2.2.3";const ie="_faroInternal";function ae(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(w,ie,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function oe(){return ie in w}function ue(t,n,r,s,i,a,o){return n.debug("Initializing Faro"),e.faro={api:a,config:r,instrumentations:o,internalLogger:n,metas:s,pause:i.pause,transports:i,unpatchedConsole:t,unpause:i.unpause},ae(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 w)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(w,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=H,e.BaseInstrumentation=class extends H{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends H{isBatched(){return!1}getIgnoreUrls(){return[]}},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.Observable=C,e.UserActionImportance=W,e.VERSION=se,e.allLogLevels=j,e.createInternalLogger=$,e.createPromiseBuffer=function(e){const{size:t,concurrency:n}=e,r=[];let s=0;const i=()=>{if(s<n&&r.length){const{producer:e,resolve:t,reject:n}=r.shift();s++,e().then(e=>{s--,i(),t(e)},e=>{s--,i(),n(e)})}};return{add:e=>{if(r.length+s>=t)throw new Error("Task buffer full");return new Promise((t,n)=>{r.push({producer:e,resolve:t,reject:n}),i()})}}},e.dateNow=T,e.deepEqual=I,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map(e=>g(e)?U(e):String(e)).join(" "),e.defaultExceptionType=Z,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=M,e.defaultLogArgsSerializer=ne,e.defaultLogLevel=L,e.defaultUnpatchedConsole=F,e.genShortID=N,e.getCircularDependencyReplacer=R,e.getCurrentTimestamp=O,e.getInternalFaroFromGlobalObject=function(){return w[ie]},e.getTransportBody=function(t){let n={meta:{}};return void 0!==t[0]&&(n.meta=t[0].meta),t.forEach(t=>{switch(t.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:{const e=r[t.type],s=n[e];n=Object.assign(Object.assign({},n),{[e]:void 0===s?[t.payload]:[...s,t.payload]});break}case e.TransportItemType.TRACE:n=Object.assign(Object.assign({},n),{traces:K(n.traces,t.payload.resourceSpans)})}}),n},e.globalObject=w,e.initializeFaro=function(e){const t=V(e),n=G(t,e);if(oe()&&!e.isolate)return void n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');n.debug("Initializing");const r=function(e,t){let n=[],r=[];const s=()=>n.reduce((e,t)=>Object.assign(e,p(t)?t():t),{}),i=()=>{if(r.length){const e=s();r.forEach(t=>t(e))}};return{add:(...e)=>{t.debug("Adding metas\n",e),n.push(...e),i()},remove:(...e)=>{t.debug("Removing metas\n",e),n=n.filter(t=>!e.includes(t)),i()},addListener:e=>{t.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),r=r.filter(t=>t!==e)},get value(){return s()}}}(0,n),i=s(t,n,e,r),a=re(0,n,e,r,i),o=function(e,t,n,r,s,i){t.debug("Initializing instrumentations");const a=[];return{add:(...o)=>{t.debug("Adding instrumentations"),o.forEach(o=>{t.debug(`Adding "${o.name}" instrumentation`),a.some(e=>e.name===o.name)?t.warn(`Instrumentation ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=t,o.config=n,o.metas=r,o.transports=s,o.api=i,a.push(o),o.initialize())})},get instrumentations(){return[...a]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach(e=>{var n,r;t.debug(`Removing "${e.name}" instrumentation`);const s=a.reduce((t,n,r)=>null===t&&n.name===e.name?r:null,null);null!==s?(null===(r=(n=a[s]).destroy)||void 0===r||r.call(n),a.splice(s,1)):t.warn(`Instrumentation "${e.name}" is not added`)})}}}(t,n,e,r,i,a),u=ue(t,n,e,r,i,a,o);return function(e){var t,n;const r={sdk:{version:se,name:"faro"},app:{bundleId:e.config.app.name&&(s=e.config.app.name,null==w?void 0:w[`__faroBundleId_${s}`])}};var s;const i=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.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!==(n=e.config.metas)&&void 0!==n?n:[])}(u),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(u),function(e){e.instrumentations.add(...e.config.instrumentations)}(u),u},e.internalGlobalObjectKey=ie,e.isArray=f,e.isBoolean=e=>a(e,"boolean"),e.isDomError=e=>o(e,"DOMError"),e.isDomException=e=>o(e,"DOMException"),e.isElement=e=>v&&u(e,Element),e.isElementDefined=v,e.isEmpty=y,e.isError=h,e.isErrorDefined=b,e.isErrorEvent=e=>o(e,"ErrorEvent"),e.isEvent=e=>m&&u(e,Event),e.isEventDefined=m,e.isFunction=p,e.isInstanceOf=u,e.isInt=e=>d(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=oe,e.isMap=e=>E&&u(e,Map),e.isMapDefined=E,e.isNull=c,e.isNumber=d,e.isObject=g,e.isPrimitive=e=>!g(e)&&!p(e),e.isRegExp=e=>o(e,"RegExp"),e.isString=l,e.isSymbol=e=>a(e,"symbol"),e.isSyntheticEvent=e=>g(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>p(null==e?void 0:e.then),e.isToString=o,e.isTypeof=a,e.isUndefined=e=>a(e,"undefined"),e.noop=_,e.setInternalFaroOnGlobalObject=ae,e.stringifyExternalJson=U,e.stringifyObjectValues=k,e.transportItemTypeToBodyKey=r,e.unknownString="unknown",e.userActionsMessageBus=Q,e}({});
@@ -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 = "2.2.1";
7
+ readonly version = "2.2.3";
8
8
  items: TransportItem[];
9
9
  constructor(ignoreURLs?: Patterns);
10
10
  send(items: TransportItem[]): void | Promise<void>;
@@ -1 +1 @@
1
- export declare const VERSION = "2.2.1";
1
+ export declare const VERSION = "2.2.3";
@@ -29,6 +29,7 @@ function registerInitialMetas(faro) {
29
29
  var initial = {
30
30
  sdk: {
31
31
  version: version_1.VERSION,
32
+ name: 'faro',
32
33
  },
33
34
  app: {
34
35
  bundleId: faro.config.app.name && (0, sourceMaps_1.getBundleId)(faro.config.app.name),
@@ -1 +1 @@
1
- {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/metas/registerInitial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,oDA4BC;AAjCD,kDAAkD;AAClD,sCAAqC;AAIrC,SAAgB,oBAAoB,CAAC,IAAU;;;IAC7C,IAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,OAAO,EAAE,iBAAO;SACjB;QACD,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,IAAA,wBAAW,EAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACpE;KACF,CAAC;IAEF,IAAM,OAAO,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,eAAe,0CAAE,OAAO,CAAC;IACrD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,yBAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,GAAK,OAAO,CAAC,GAAG,CAAE,CAAC;IACvD,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,CAAA,KAAA,IAAI,CAAC,KAAK,CAAA,CAAC,GAAG,0BAAC,OAAO,GAAK,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,UAAE;AACxD,CAAC","sourcesContent":["import type { Faro } from '../sdk';\nimport { getBundleId } from '../utils/sourceMaps';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n version: VERSION,\n },\n app: {\n bundleId: faro.config.app.name && getBundleId(faro.config.app.name),\n },\n };\n\n const session = faro.config.sessionTracking?.session;\n if (session) {\n faro.api.setSession(session);\n }\n\n if (faro.config.app) {\n initial.app = { ...faro.config.app, ...initial.app };\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\n"]}
1
+ {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/metas/registerInitial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,oDA6BC;AAlCD,kDAAkD;AAClD,sCAAqC;AAIrC,SAAgB,oBAAoB,CAAC,IAAU;;;IAC7C,IAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,OAAO,EAAE,iBAAO;YAChB,IAAI,EAAE,MAAM;SACb;QACD,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,IAAA,wBAAW,EAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACpE;KACF,CAAC;IAEF,IAAM,OAAO,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,eAAe,0CAAE,OAAO,CAAC;IACrD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,yBAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,GAAK,OAAO,CAAC,GAAG,CAAE,CAAC;IACvD,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,CAAA,KAAA,IAAI,CAAC,KAAK,CAAA,CAAC,GAAG,0BAAC,OAAO,GAAK,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,UAAE;AACxD,CAAC","sourcesContent":["import type { Faro } from '../sdk';\nimport { getBundleId } from '../utils/sourceMaps';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n version: VERSION,\n name: 'faro',\n },\n app: {\n bundleId: faro.config.app.name && getBundleId(faro.config.app.name),\n },\n };\n\n const session = faro.config.sessionTracking?.session;\n if (session) {\n faro.api.setSession(session);\n }\n\n if (faro.config.app) {\n initial.app = { ...faro.config.app, ...initial.app };\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\n"]}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // auto-generated by bin/genVersion.ts
5
- exports.VERSION = '2.2.1';
5
+ exports.VERSION = '2.2.3';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.2.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.2.3';\n"]}
@@ -5,6 +5,7 @@ export function registerInitialMetas(faro) {
5
5
  const initial = {
6
6
  sdk: {
7
7
  version: VERSION,
8
+ name: 'faro',
8
9
  },
9
10
  app: {
10
11
  bundleId: faro.config.app.name && getBundleId(faro.config.app.name),
@@ -1 +1 @@
1
- {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/metas/registerInitial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,MAAM,UAAU,oBAAoB,CAAC,IAAU;;IAC7C,MAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,OAAO,EAAE,OAAO;SACjB;QACD,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACpE;KACF,CAAC;IAEF,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,eAAe,0CAAE,OAAO,CAAC;IACrD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,mCAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,GAAK,OAAO,CAAC,GAAG,CAAE,CAAC;IACvD,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import type { Faro } from '../sdk';\nimport { getBundleId } from '../utils/sourceMaps';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n version: VERSION,\n },\n app: {\n bundleId: faro.config.app.name && getBundleId(faro.config.app.name),\n },\n };\n\n const session = faro.config.sessionTracking?.session;\n if (session) {\n faro.api.setSession(session);\n }\n\n if (faro.config.app) {\n initial.app = { ...faro.config.app, ...initial.app };\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\n"]}
1
+ {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/metas/registerInitial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,MAAM,UAAU,oBAAoB,CAAC,IAAU;;IAC7C,MAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,MAAM;SACb;QACD,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACpE;KACF,CAAC;IAEF,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,eAAe,0CAAE,OAAO,CAAC;IACrD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,mCAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,GAAK,OAAO,CAAC,GAAG,CAAE,CAAC;IACvD,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import type { Faro } from '../sdk';\nimport { getBundleId } from '../utils/sourceMaps';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n version: VERSION,\n name: 'faro',\n },\n app: {\n bundleId: faro.config.app.name && getBundleId(faro.config.app.name),\n },\n };\n\n const session = faro.config.sessionTracking?.session;\n if (session) {\n faro.api.setSession(session);\n }\n\n if (faro.config.app) {\n initial.app = { ...faro.config.app, ...initial.app };\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  // auto-generated by bin/genVersion.ts
2
- export const VERSION = '2.2.1';
2
+ export const VERSION = '2.2.3';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.2.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.2.3';\n"]}
@@ -29,6 +29,7 @@ function registerInitialMetas(faro) {
29
29
  var initial = {
30
30
  sdk: {
31
31
  version: version_1.VERSION,
32
+ name: 'faro',
32
33
  },
33
34
  app: {
34
35
  bundleId: faro.config.app.name && (0, sourceMaps_1.getBundleId)(faro.config.app.name),
@@ -1 +1 @@
1
- {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../../../src/metas/registerInitial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,oDA4BC;AAjCD,kDAAkD;AAClD,sCAAqC;AAIrC,SAAgB,oBAAoB,CAAC,IAAU;;;IAC7C,IAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,OAAO,EAAE,iBAAO;SACjB;QACD,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,IAAA,wBAAW,EAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACpE;KACF,CAAC;IAEF,IAAM,OAAO,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,eAAe,0CAAE,OAAO,CAAC;IACrD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,yBAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,GAAK,OAAO,CAAC,GAAG,CAAE,CAAC;IACvD,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,CAAA,KAAA,IAAI,CAAC,KAAK,CAAA,CAAC,GAAG,0BAAC,OAAO,GAAK,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,UAAE;AACxD,CAAC","sourcesContent":["import type { Faro } from '../sdk';\nimport { getBundleId } from '../utils/sourceMaps';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n version: VERSION,\n },\n app: {\n bundleId: faro.config.app.name && getBundleId(faro.config.app.name),\n },\n };\n\n const session = faro.config.sessionTracking?.session;\n if (session) {\n faro.api.setSession(session);\n }\n\n if (faro.config.app) {\n initial.app = { ...faro.config.app, ...initial.app };\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\n"]}
1
+ {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../../../src/metas/registerInitial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,oDA6BC;AAlCD,kDAAkD;AAClD,sCAAqC;AAIrC,SAAgB,oBAAoB,CAAC,IAAU;;;IAC7C,IAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,OAAO,EAAE,iBAAO;YAChB,IAAI,EAAE,MAAM;SACb;QACD,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,IAAA,wBAAW,EAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACpE;KACF,CAAC;IAEF,IAAM,OAAO,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,eAAe,0CAAE,OAAO,CAAC;IACrD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,yBAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,GAAK,OAAO,CAAC,GAAG,CAAE,CAAC;IACvD,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,CAAA,KAAA,IAAI,CAAC,KAAK,CAAA,CAAC,GAAG,0BAAC,OAAO,GAAK,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,UAAE;AACxD,CAAC","sourcesContent":["import type { Faro } from '../sdk';\nimport { getBundleId } from '../utils/sourceMaps';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n version: VERSION,\n name: 'faro',\n },\n app: {\n bundleId: faro.config.app.name && getBundleId(faro.config.app.name),\n },\n };\n\n const session = faro.config.sessionTracking?.session;\n if (session) {\n faro.api.setSession(session);\n }\n\n if (faro.config.app) {\n initial.app = { ...faro.config.app, ...initial.app };\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\n"]}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // auto-generated by bin/genVersion.ts
5
- exports.VERSION = '2.2.1';
5
+ exports.VERSION = '2.2.3';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.2.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.2.3';\n"]}
@@ -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 = "2.2.1";
7
+ readonly version = "2.2.3";
8
8
  items: TransportItem[];
9
9
  constructor(ignoreURLs?: Patterns);
10
10
  send(items: TransportItem[]): void | Promise<void>;
@@ -1 +1 @@
1
- export declare const VERSION = "2.2.1";
1
+ export declare const VERSION = "2.2.3";
@@ -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 = "2.2.1";
7
+ readonly version = "2.2.3";
8
8
  items: TransportItem[];
9
9
  constructor(ignoreURLs?: Patterns);
10
10
  send(items: TransportItem[]): void | Promise<void>;
@@ -1 +1 @@
1
- export declare const VERSION = "2.2.1";
1
+ export declare const VERSION = "2.2.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/faro-core",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Core package of Faro.",
5
5
  "keywords": [
6
6
  "observability",
@@ -56,10 +56,10 @@
56
56
  "@opentelemetry/otlp-transformer": "^0.211.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@types/node": "24.10.9"
59
+ "@types/node": "24.10.11"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "aa59f4ec236bb7c8df4526d56d7c6bc013c5ad6e"
64
+ "gitHead": "27cb5bebe06077a050cfba9ea07c7c2f0bcdc455"
65
65
  }