@grafana/faro-core 1.0.0-beta4 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +5 -4
  2. package/dist/bundle/faro-core.iife.js +1 -1
  3. package/dist/cjs/api/events/initialize.js +1 -1
  4. package/dist/cjs/api/events/initialize.js.map +1 -1
  5. package/dist/cjs/api/exceptions/initialize.js +1 -1
  6. package/dist/cjs/api/exceptions/initialize.js.map +1 -1
  7. package/dist/cjs/api/initialize.js +3 -3
  8. package/dist/cjs/api/initialize.js.map +1 -1
  9. package/dist/cjs/api/logs/initialize.js +1 -1
  10. package/dist/cjs/api/logs/initialize.js.map +1 -1
  11. package/dist/cjs/api/measurements/initialize.js +4 -3
  12. package/dist/cjs/api/measurements/initialize.js.map +1 -1
  13. package/dist/cjs/api/measurements/types.js.map +1 -1
  14. package/dist/cjs/api/meta/initialize.js +14 -1
  15. package/dist/cjs/api/meta/initialize.js.map +1 -1
  16. package/dist/cjs/api/meta/types.js.map +1 -1
  17. package/dist/cjs/api/traces/initialize.js +1 -1
  18. package/dist/cjs/api/traces/initialize.js.map +1 -1
  19. package/dist/cjs/config/types.js.map +1 -1
  20. package/dist/cjs/{utils/extensions.js → extensions/baseExtension.js} +15 -17
  21. package/dist/cjs/extensions/baseExtension.js.map +1 -0
  22. package/dist/cjs/extensions/index.js +6 -0
  23. package/dist/cjs/extensions/index.js.map +1 -0
  24. package/dist/cjs/extensions/types.js +3 -0
  25. package/dist/cjs/extensions/types.js.map +1 -0
  26. package/dist/cjs/index.js +12 -11
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/initialize.js +11 -21
  29. package/dist/cjs/initialize.js.map +1 -1
  30. package/dist/cjs/instrumentations/base.js +6 -3
  31. package/dist/cjs/instrumentations/base.js.map +1 -1
  32. package/dist/cjs/instrumentations/index.js +3 -1
  33. package/dist/cjs/instrumentations/index.js.map +1 -1
  34. package/dist/cjs/instrumentations/initialize.js +8 -2
  35. package/dist/cjs/instrumentations/initialize.js.map +1 -1
  36. package/dist/cjs/instrumentations/registerInitial.js +9 -0
  37. package/dist/cjs/instrumentations/registerInitial.js.map +1 -0
  38. package/dist/cjs/instrumentations/types.js.map +1 -1
  39. package/dist/cjs/internalLogger/const.js.map +1 -1
  40. package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
  41. package/dist/cjs/internalLogger/index.js +2 -1
  42. package/dist/cjs/internalLogger/index.js.map +1 -1
  43. package/dist/cjs/internalLogger/initialize.js.map +1 -1
  44. package/dist/cjs/metas/index.js +3 -1
  45. package/dist/cjs/metas/index.js.map +1 -1
  46. package/dist/cjs/metas/initialize.js +4 -30
  47. package/dist/cjs/metas/initialize.js.map +1 -1
  48. package/dist/cjs/metas/registerInitial.js +42 -0
  49. package/dist/cjs/metas/registerInitial.js.map +1 -0
  50. package/dist/cjs/metas/types.js.map +1 -1
  51. package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
  52. package/dist/cjs/sdk/index.js +3 -3
  53. package/dist/cjs/sdk/index.js.map +1 -1
  54. package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
  55. package/dist/cjs/sdk/{register.js → registerFaro.js} +13 -3
  56. package/dist/cjs/sdk/registerFaro.js.map +1 -0
  57. package/dist/cjs/semantic.js +1 -0
  58. package/dist/cjs/semantic.js.map +1 -1
  59. package/dist/cjs/testUtils/mockConfig.js.map +1 -1
  60. package/dist/cjs/transports/base.js +2 -2
  61. package/dist/cjs/transports/base.js.map +1 -1
  62. package/dist/cjs/transports/index.js +3 -1
  63. package/dist/cjs/transports/index.js.map +1 -1
  64. package/dist/cjs/transports/initialize.js +5 -4
  65. package/dist/cjs/transports/initialize.js.map +1 -1
  66. package/dist/cjs/transports/registerInitial.js +11 -0
  67. package/dist/cjs/transports/registerInitial.js.map +1 -0
  68. package/dist/cjs/transports/types.js.map +1 -1
  69. package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
  70. package/dist/cjs/utils/index.js +1 -3
  71. package/dist/cjs/utils/index.js.map +1 -1
  72. package/dist/cjs/utils/shortId.js.map +1 -1
  73. package/dist/cjs/version.js +1 -1
  74. package/dist/cjs/version.js.map +1 -1
  75. package/dist/esm/api/events/initialize.js +1 -1
  76. package/dist/esm/api/events/initialize.js.map +1 -1
  77. package/dist/esm/api/exceptions/initialize.js +1 -1
  78. package/dist/esm/api/exceptions/initialize.js.map +1 -1
  79. package/dist/esm/api/initialize.js +3 -3
  80. package/dist/esm/api/initialize.js.map +1 -1
  81. package/dist/esm/api/logs/initialize.js +1 -1
  82. package/dist/esm/api/logs/initialize.js.map +1 -1
  83. package/dist/esm/api/measurements/initialize.js +4 -3
  84. package/dist/esm/api/measurements/initialize.js.map +1 -1
  85. package/dist/esm/api/measurements/types.js.map +1 -1
  86. package/dist/esm/api/meta/initialize.js +14 -1
  87. package/dist/esm/api/meta/initialize.js.map +1 -1
  88. package/dist/esm/api/meta/types.js.map +1 -1
  89. package/dist/esm/api/traces/initialize.js +1 -1
  90. package/dist/esm/api/traces/initialize.js.map +1 -1
  91. package/dist/esm/config/types.js.map +1 -1
  92. package/dist/esm/extensions/baseExtension.js +23 -0
  93. package/dist/esm/extensions/baseExtension.js.map +1 -0
  94. package/dist/esm/extensions/index.js +2 -0
  95. package/dist/esm/extensions/index.js.map +1 -0
  96. package/dist/esm/extensions/types.js +2 -0
  97. package/dist/esm/extensions/types.js.map +1 -0
  98. package/dist/esm/index.js +4 -3
  99. package/dist/esm/index.js.map +1 -1
  100. package/dist/esm/initialize.js +14 -23
  101. package/dist/esm/initialize.js.map +1 -1
  102. package/dist/esm/instrumentations/base.js +6 -1
  103. package/dist/esm/instrumentations/base.js.map +1 -1
  104. package/dist/esm/instrumentations/index.js +1 -0
  105. package/dist/esm/instrumentations/index.js.map +1 -1
  106. package/dist/esm/instrumentations/initialize.js +8 -2
  107. package/dist/esm/instrumentations/initialize.js.map +1 -1
  108. package/dist/esm/instrumentations/registerInitial.js +4 -0
  109. package/dist/esm/instrumentations/registerInitial.js.map +1 -0
  110. package/dist/esm/instrumentations/types.js.map +1 -1
  111. package/dist/esm/internalLogger/const.js.map +1 -1
  112. package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
  113. package/dist/esm/internalLogger/index.js +1 -1
  114. package/dist/esm/internalLogger/index.js.map +1 -1
  115. package/dist/esm/internalLogger/initialize.js.map +1 -1
  116. package/dist/esm/metas/index.js +1 -0
  117. package/dist/esm/metas/index.js.map +1 -1
  118. package/dist/esm/metas/initialize.js +4 -18
  119. package/dist/esm/metas/initialize.js.map +1 -1
  120. package/dist/esm/metas/registerInitial.js +25 -0
  121. package/dist/esm/metas/registerInitial.js.map +1 -0
  122. package/dist/esm/metas/types.js.map +1 -1
  123. package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
  124. package/dist/esm/sdk/index.js +1 -1
  125. package/dist/esm/sdk/index.js.map +1 -1
  126. package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
  127. package/dist/esm/sdk/registerFaro.js +21 -0
  128. package/dist/esm/sdk/registerFaro.js.map +1 -0
  129. package/dist/esm/semantic.js +1 -0
  130. package/dist/esm/semantic.js.map +1 -1
  131. package/dist/esm/testUtils/mockConfig.js.map +1 -1
  132. package/dist/esm/transports/base.js +1 -1
  133. package/dist/esm/transports/base.js.map +1 -1
  134. package/dist/esm/transports/index.js +1 -0
  135. package/dist/esm/transports/index.js.map +1 -1
  136. package/dist/esm/transports/initialize.js +5 -4
  137. package/dist/esm/transports/initialize.js.map +1 -1
  138. package/dist/esm/transports/registerInitial.js +6 -0
  139. package/dist/esm/transports/registerInitial.js.map +1 -0
  140. package/dist/esm/transports/types.js.map +1 -1
  141. package/dist/esm/unpatchedConsole/initialize.js.map +1 -1
  142. package/dist/esm/utils/index.js +0 -1
  143. package/dist/esm/utils/index.js.map +1 -1
  144. package/dist/esm/utils/shortId.js.map +1 -1
  145. package/dist/esm/version.js +1 -1
  146. package/dist/esm/version.js.map +1 -1
  147. package/dist/types/api/events/initialize.d.ts +2 -1
  148. package/dist/types/api/exceptions/initialize.d.ts +2 -1
  149. package/dist/types/api/initialize.d.ts +2 -1
  150. package/dist/types/api/logs/initialize.d.ts +2 -1
  151. package/dist/types/api/measurements/initialize.d.ts +2 -1
  152. package/dist/types/api/measurements/types.d.ts +2 -1
  153. package/dist/types/api/meta/initialize.d.ts +2 -1
  154. package/dist/types/api/meta/types.d.ts +5 -3
  155. package/dist/types/api/traces/initialize.d.ts +2 -1
  156. package/dist/types/config/types.d.ts +2 -1
  157. package/dist/types/extensions/baseExtension.d.ts +15 -0
  158. package/dist/types/extensions/index.d.ts +2 -0
  159. package/dist/types/extensions/types.d.ts +16 -0
  160. package/dist/types/index.d.ts +7 -5
  161. package/dist/types/instrumentations/base.d.ts +5 -1
  162. package/dist/types/instrumentations/index.d.ts +1 -0
  163. package/dist/types/instrumentations/initialize.d.ts +5 -1
  164. package/dist/types/instrumentations/registerInitial.d.ts +2 -0
  165. package/dist/types/instrumentations/types.d.ts +5 -1
  166. package/dist/types/internalLogger/index.d.ts +1 -1
  167. package/dist/types/metas/index.d.ts +2 -1
  168. package/dist/types/metas/initialize.d.ts +2 -1
  169. package/dist/types/metas/registerInitial.d.ts +2 -0
  170. package/dist/types/metas/types.d.ts +6 -1
  171. package/dist/types/sdk/index.d.ts +1 -1
  172. package/dist/types/sdk/registerFaro.d.ts +10 -0
  173. package/dist/types/semantic.d.ts +1 -0
  174. package/dist/types/testUtils/mockTransport.d.ts +1 -1
  175. package/dist/types/transports/base.d.ts +1 -1
  176. package/dist/types/transports/index.d.ts +1 -0
  177. package/dist/types/transports/initialize.d.ts +3 -1
  178. package/dist/types/transports/registerInitial.d.ts +2 -0
  179. package/dist/types/transports/types.d.ts +1 -1
  180. package/dist/types/utils/index.d.ts +0 -2
  181. package/dist/types/version.d.ts +1 -1
  182. package/package.json +4 -4
  183. package/dist/cjs/sdk/register.js.map +0 -1
  184. package/dist/cjs/utils/extensions.js.map +0 -1
  185. package/dist/esm/sdk/register.js +0 -11
  186. package/dist/esm/sdk/register.js.map +0 -1
  187. package/dist/esm/utils/extensions.js +0 -23
  188. package/dist/esm/utils/extensions.js.map +0 -1
  189. package/dist/types/sdk/register.d.ts +0 -4
  190. package/dist/types/utils/extensions.d.ts +0 -19
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @grafana/faro-core
2
2
 
3
- Core package of Faro.
4
-
5
3
  _Warning_: currently pre-release and subject to frequent breaking changes. Use at your own risk.
6
4
 
7
- The entire architecture of the library is contained within this package. Out of the box, it doesn't collect any metrics,
8
- logs etc. but it offers an API to capture them.
5
+ Core package of Faro.
6
+
7
+ The entire architecture of the library is contained within this package. Out of the box, it doesn't collect any signals,
8
+ but it provides the API to do it as well as multiple helper methods.
9
9
 
10
10
  ## Installation
11
11
 
@@ -44,6 +44,7 @@ Besides the mandatory properties, Faro configuration also supports the following
44
44
  | `ignoreErrors` | Error message patterns for errors that should be ignored | `Patterns` | `[]` |
45
45
  | `session` | Session metadata | `Session` | `undefined` |
46
46
  | `user` | User metadata | `User` | `undefined` |
47
+ | `view` | View metadata | `View` | `undefined` |
47
48
 
48
49
  ## Faro instance
49
50
 
@@ -1 +1 @@
1
- var GrafanaFaroCore=function(e){"use strict";const n="_faroInternal",t="undefined"==typeof window?global:window;function r(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,n,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function o(){return n in t}function a(n,o){return n.debug("Initializing Faro"),e.faro=o,r(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={};class i{get faro(){return e.faro}logDebug(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.debug(`${this.name}\n`,...e)}logInfo(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.info(`${this.name}\n`,...e)}logWarn(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.warn(`${this.name}\n`,...e)}logError(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.error(`${this.name}\n`,...e)}}function s(e,n){return typeof e===n}function l(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function u(e,n){try{return e instanceof n}catch(e){return!1}}const g=e=>s(e,"undefined"),c=e=>s(e,"null"),d=e=>s(e,"string"),p=e=>s(e,"number")&&!isNaN(e)||s(e,"bigint"),f=e=>!c(e)&&s(e,"object"),m=e=>s(e,"function"),b=e=>l(e,"Array"),v=!g(Event),y="undefined"!=typeof Error,E="undefined"!=typeof Element,h="undefined"!=typeof Map;function I(e,n){if(e===n)return!0;if(s(e,"number")&&isNaN(e))return s(n,"number")&&isNaN(n);const t=b(e),r=b(n);if(t!==r)return!1;if(t&&r){const t=e.length;if(t!==n.length)return!1;for(let r=t;0!=r--;)if(!I(e[r],n[r]))return!1;return!0}const o=f(e),a=f(n);if(o!==a)return!1;if(e&&n&&o&&a){const t=Object.keys(e),r=Object.keys(n);if(t.length!==r.length)return!1;for(let e of t)if(!r.includes(e))return!1;for(let r of t)if(!I(e[r],n[r]))return!1;return!0}return!1}function T(){return(new Date).toISOString()}var L;e.LogLevel=void 0,(L=e.LogLevel||(e.LogLevel={})).TRACE="trace",L.DEBUG="debug",L.INFO="info",L.LOG="log",L.WARN="warn",L.ERROR="error";const O=e.LogLevel.LOG,R=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function S(){}const x="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";var j;e.TransportItemType=void 0,(j=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",j.LOG="log",j.MEASUREMENT="measurement",j.TRACE="trace",j.EVENT="event";const A={[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=>d(e)?n.includes(e):!!n.match(e)))}(n,r))return null}return t}}const k="Error";let P;function C(n,t,r,o){n.debug("Initializing API");const a=function(n,t,r,o){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 a={type:e.TransportItemType.TRACE,payload:t,meta:o.value};n.debug("Pushing trace\n",a),r.execute(a)}catch(e){n.error("Error pushing trace\n",e)}}}}(n,0,r,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,r,o,a){var i;n.debug("Initializing exceptions API");let s=null;P=null!==(i=t.parseStacktrace)&&void 0!==i?i:P;const l=e=>{n.debug("Changing stacktrace parser"),P=null!=e?e:P};return l(t.parseStacktrace),{changeStacktraceParser:l,getStacktraceParser:()=>P,pushError:(i,{skipDedupe:l,stackFrames:u,type:g}={})=>{g=g||i.name||k;const d={meta:o.value,payload:{type:g,value:i.message,timestamp:T(),trace:a.getTraceContext()},type:e.TransportItemType.EXCEPTION};(null==(u=null!=u?u:i.stack?null==P?void 0:P(i).frames:void 0)?void 0:u.length)&&(d.payload.stacktrace={frames:u});const p={type:d.payload.type,value:d.payload.value,stackTrace:d.payload.stacktrace};l||!t.dedupe||c(s)||!I(p,s)?(s=p,n.debug("Pushing exception\n",d),r.execute(d)):n.debug("Skipping error push because it is the same as the last one\n",d.payload)}}}(n,t,r,o,a)),function(e,n,t,r){let o,a;e.debug("Initializing meta API");const i=e=>{a&&r.remove(a),a={user:e},r.add(a)},s=e=>{o&&r.remove(o),o={session:e},r.add(o)};return{setUser:i,resetUser:i,setSession:s,resetSession:s,getSession:()=>r.value.session}}(n,0,0,o)),function(n,t,r,o,a){n.debug("Initializing logs API");let i=null;return{pushLog:(s,{context:l,level:u,skipDedupe:g}={})=>{try{const d={type:e.TransportItemType.LOG,payload:{message:s.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=u?u:O,context:null!=l?l:{},timestamp:T(),trace:a.getTraceContext()},meta:o.value},p={message:d.payload.message,level:d.payload.level,context:d.payload.context};if(!g&&t.dedupe&&!c(i)&&I(p,i))return void n.debug("Skipping log push because it is the same as the last one\n",d.payload);i=p,n.debug("Pushing log\n",d),r.execute(d)}catch(e){n.error("Error pushing log\n",e)}}}}(n,t,r,o,a)),function(n,t,r,o,a){n.debug("Initializing measurements API");let i=null;return{pushMeasurement:(s,{skipDedupe:l}={})=>{try{const u={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},s),{trace:a.getTraceContext()}),meta:o.value},g={type:u.payload.type,values:u.payload.values};if(!l&&t.dedupe&&!c(i)&&I(g,i))return void n.debug("Skipping measurement push because it is the same as the last one\n",u.payload);i=g,n.debug("Pushing measurement\n",u),r.execute(u)}catch(e){n.error("Error pushing measurement\n",e)}}}}(n,t,r,o,a)),function(n,t,r,o,a){let i=null;return{pushEvent:(s,l,u,{skipDedupe:g}={})=>{try{const d={meta:o.value,payload:{name:s,domain:null!=u?u:t.eventDomain,attributes:l,timestamp:T(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},p={name:d.payload.name,attributes:d.payload.attributes,domain:d.payload.domain};if(!g&&t.dedupe&&!c(i)&&I(p,i))return void n.debug("Skipping event push because it is the same as the last one\n",d.payload);i=p,n.debug("Pushing event\n",d),r.execute(d)}catch(e){n.error("Error pushing event",e)}}}}(n,t,r,o,a))}function F(e,n){e.debug("Initializing instrumentations");const t=[];return{add:(...n)=>{e.debug("Adding instrumentations"),n.forEach((n=>{e.debug(`Adding "${n.name}" instrumentation`);t.some((e=>e.name===n.name))?e.warn(`Transport ${n.name} is already added`):(t.push(n),n.initialize())}))},get instrumentations(){return[...t]},remove:(...n)=>{e.debug("Removing instrumentations"),n.forEach((n=>{var r,o;e.debug(`Removing "${n.name}" instrumentation`);const a=t.reduce(((e,t,r)=>null===e&&t.name===n.name?r:null),null);a?(null===(o=(r=t[a]).destroy)||void 0===o||o.call(r),t.splice(a,1)):e.warn(`Instrumentation "${n.name}" is not added`)}))}}}var $;e.InternalLoggerLevel=void 0,($=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[$.OFF=0]="OFF",$[$.ERROR=1]="ERROR",$[$.WARN=2]="WARN",$[$.INFO=3]="INFO",$[$.VERBOSE=4]="VERBOSE";const w={debug:S,error:S,info:S,prefix:"Faro",warn:S},D=e.InternalLoggerLevel.ERROR,G=Object.assign({},console);let z=G;function B(e){var n;return z=null!==(n=e.unpatchedConsole)&&void 0!==n?n:z,z}function M(n=G,t=D){const r=w;return t>e.InternalLoggerLevel.OFF&&(r.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${r.prefix}\n`,...e)}:S,r.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${r.prefix}\n`,...e)}:S,r.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${r.prefix}\n`,...e)}:S,r.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${r.prefix}\n`,...e)}:S),r}let U=w;function K(e,n){return U=M(e,n.internalLoggerLevel),U}const V="1.0.0-beta4";return e.BaseExtension=i,e.BaseInstrumentation=class extends i{},e.BaseTransport=class extends i{getIgnoreUrls(){return[]}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start"}},e.VERSION=V,e.allLogLevels=R,e.createInternalLogger=M,e.createPromiseBuffer=function(e){const{size:n,concurrency:t}=e,r=[];let o=0;const a=()=>{if(o<t&&r.length){const{producer:e,resolve:n,reject:t}=r.shift();o++,e().then((e=>{o--,a(),n(e)}),(e=>{o--,a(),t(e)}))}};return{add:e=>{if(r.length+o>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{r.push({producer:e,resolve:n,reject:t}),a()}))}}},e.deepEqual=I,e.defaultExceptionType=k,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=D,e.defaultLogLevel=O,e.defaultUnpatchedConsole=G,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>x[Math.floor(Math.random()*x.length)])).join("")},e.getCurrentTimestamp=T,e.getInternalFaroFromGlobalObject=function(){return t[n]},e.getTransportBody=function(n){return{[A[n.type]]:n.type===e.TransportItemType.TRACE?n.payload:[n.payload],meta:n.meta}},e.globalObject=t,e.initializeFaro=function(e){const n=B(e),t=K(n,e);if(t.debug("Initializing"),o()&&!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');const r=function(e,n){var t;let r=[],o=[];const a=()=>r.reduce(((e,n)=>Object.assign(e,m(n)?n():n)),{}),i=()=>{if(o.length){const e=a();o.forEach((n=>n(e)))}},s=(...n)=>{e.debug("Adding metas\n",n),r.push(...n),i()},l={sdk:{name:"@grafana/faro-core",version:V,integrations:n.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}};return n.app&&(l.app=n.app),n.user&&(l.user=n.user),s(l,...null!==(t=n.metas)&&void 0!==t?t:[]),{add:s,remove:(...n)=>{e.debug("Removing metas\n",n),r=r.filter((e=>!n.includes(e))),i()},addListener:e=>{o.push(e)},removeListener:e=>{o=o.filter((n=>n!==e))},get value(){return a()}}}(t,e),i=function(e,n){e.debug("Initializing transports");const t=[];let r=n.paused,o=[];const a=(...n)=>{e.debug("Adding transports"),n.forEach((n=>{e.debug(`Adding "${n.name}" transport`),t.some((e=>e===n))?e.warn(`Transport ${n.name} is already added`):t.push(n)}))},i=(...n)=>{e.debug("Adding beforeSendHooks\n",o),n.forEach((e=>{e&&o.push(e)}))},s=(...n)=>{e.debug("Adding ignoreErrorsPatterns\n",n),n.forEach((e=>{e&&o.push(N(e))}))};return a(...n.transports),i(n.beforeSend),s(n.ignoreErrors),{add:a,addBeforeSendHooks:i,addIgnoreErrorsPatterns:s,getBeforeSendHooks:()=>[...o],execute:n=>{if(!r){let r=n;for(const e of o){const n=e(r);if(null===n)return;r=n}for(const n of t)e.debug(`Transporting item using ${n.name}\n`,r),n.send(r)}},isPaused:()=>r,pause:()=>{e.debug("Pausing transports"),r=!0},remove:(...n)=>{e.debug("Removing transports"),n.forEach((n=>{e.debug(`Removing "${n.name}" transport`);const r=t.indexOf(n);-1!==r?t.splice(r,1):e.warn(`Transport "${n.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{o.filter((n=>!e.includes(n)))},get transports(){return[...t]},unpause:()=>{e.debug("Unpausing transports"),r=!1}}}(t,e),s=C(t,e,i,r);e.session&&s.setSession(e.session);const l=a(t,{api:s,config:e,internalLogger:t,metas:r,pause:i.pause,transports:i,unpatchedConsole:n,unpause:i.unpause,instrumentations:F(t)});return l.instrumentations.add(...e.instrumentations),l},e.internalGlobalObjectKey=n,e.isArray=b,e.isBoolean=e=>s(e,"boolean"),e.isDomError=e=>l(e,"DOMError"),e.isDomException=e=>l(e,"DOMException"),e.isElement=e=>E&&u(e,Element),e.isElementDefined=E,e.isError=e=>y&&u(e,Error),e.isErrorDefined=y,e.isErrorEvent=e=>l(e,"ErrorEvent"),e.isEvent=e=>v&&u(e,Event),e.isEventDefined=v,e.isFunction=m,e.isInstanceOf=u,e.isInt=e=>p(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=o,e.isMap=e=>h&&u(e,Map),e.isMapDefined=h,e.isNull=c,e.isNumber=p,e.isObject=f,e.isPrimitive=e=>!f(e)&&!m(e),e.isRegExp=e=>l(e,"RegExp"),e.isString=d,e.isSymbol=e=>s(e,"symbol"),e.isSyntheticEvent=e=>f(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>m(null==e?void 0:e.then),e.isToString=l,e.isTypeof=s,e.isUndefined=g,e.noop=S,e.setInternalFaroOnGlobalObject=r,e.transportItemTypeToBodyKey=A,e}({});
1
+ var GrafanaFaroCore=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function r(e,n){try{return e instanceof n}catch(e){return!1}}const o=e=>n(e,"undefined"),a=e=>n(e,"null"),i=e=>n(e,"string"),s=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),u=e=>!a(e)&&n(e,"object"),l=e=>n(e,"function"),g=e=>t(e,"Array"),c=!o(Event),d="undefined"!=typeof Error,p="undefined"!=typeof Element,f="undefined"!=typeof Map;function m(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const r=g(e),o=g(t);if(r!==o)return!1;if(r&&o){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!=r--;)if(!m(e[r],t[r]))return!1;return!0}const a=u(e),i=u(t);if(a!==i)return!1;if(e&&t&&a&&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(!m(e[r],t[r]))return!1;return!0}return!1}function b(){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 y=e.LogLevel.LOG,E=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function h(){}const I="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";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 T={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function O(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}}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 S={debug:h,error:h,info:h,prefix:"Faro",warn:h},x=e.InternalLoggerLevel.ERROR,A=Object.assign({},console);let j=A;function N(e){var n;return j=null!==(n=e.unpatchedConsole)&&void 0!==n?n:j,j}function k(n=A,t=x){const r=S;return t>e.InternalLoggerLevel.OFF&&(r.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${r.prefix}\n`,...e)}:h,r.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${r.prefix}\n`,...e)}:h,r.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${r.prefix}\n`,...e)}:h,r.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${r.prefix}\n`,...e)}:h),r}let C=S;function P(e,n){return C=k(e,n.internalLoggerLevel),C}class w{constructor(){this.unpatchedConsole=A,this.internalLogger=S,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)}}const F="Error";let $;function D(n,t,r,o,i){t.debug("Initializing API");const s=function(n,t,r,o,a){let i;return t.debug("Initializing traces API"),{getOTEL:()=>i,getTraceContext:()=>{const e=null==i?void 0:i.trace.getSpanContext(i.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),i={trace:e,context:n}},isOTELInitialized:()=>!!i,pushTraces:n=>{try{const r={type:e.TransportItemType.TRACE,payload:n,meta:o.value};t.debug("Pushing trace\n",r),a.execute(r)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,o,i);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s),function(n,t,r,o,i,s){var u;t.debug("Initializing exceptions API");let l=null;$=null!==(u=r.parseStacktrace)&&void 0!==u?u:$;const g=e=>{t.debug("Changing stacktrace parser"),$=null!=e?e:$};return g(r.parseStacktrace),{changeStacktraceParser:g,getStacktraceParser:()=>$,pushError:(n,{skipDedupe:u,stackFrames:g,type:c}={})=>{c=c||n.name||F;const d={meta:o.value,payload:{type:c,value:n.message,timestamp:b(),trace:s.getTraceContext()},type:e.TransportItemType.EXCEPTION};(null==(g=null!=g?g:n.stack?null==$?void 0:$(n).frames:void 0)?void 0:g.length)&&(d.payload.stacktrace={frames:g});const p={type:d.payload.type,value:d.payload.value,stackTrace:d.payload.stacktrace};u||!r.dedupe||a(l)||!m(p,l)?(l=p,t.debug("Pushing exception\n",d),i.execute(d)):t.debug("Skipping error push because it is the same as the last one\n",d.payload)}}}(0,t,r,o,i,s)),function(e,n,t,r,o){let a,i,s;n.debug("Initializing meta API");const u=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:u,resetUser:u,setSession:l,resetSession:l,getSession:()=>r.value.session,setView:e=>{s&&r.remove(s),s={view:e},r.add(s)},getView:()=>r.value.view}}(0,t,0,o)),function(n,t,r,o,i,s){t.debug("Initializing logs API");let u=null;return{pushLog:(n,{context:l,level:g,skipDedupe:c}={})=>{try{const d={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=g?g:y,context:null!=l?l:{},timestamp:b(),trace:s.getTraceContext()},meta:o.value},p={message:d.payload.message,level:d.payload.level,context:d.payload.context};if(!c&&r.dedupe&&!a(u)&&m(p,u))return void t.debug("Skipping log push because it is the same as the last one\n",d.payload);u=p,t.debug("Pushing log\n",d),i.execute(d)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,r,o,i,s)),function(n,t,r,o,i,s){t.debug("Initializing measurements API");let u=null;return{pushMeasurement:(n,{skipDedupe:l}={})=>{var g;try{const c={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:s.getTraceContext(),timestamp:null!==(g=n.timestamp)&&void 0!==g?g:b()}),meta:o.value},d={type:c.payload.type,values:c.payload.values};if(!l&&r.dedupe&&!a(u)&&m(d,u))return void t.debug("Skipping measurement push because it is the same as the last one\n",c.payload);u=d,t.debug("Pushing measurement\n",c),i.execute(c)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,r,o,i,s)),function(n,t,r,o,i,s){let u=null;return{pushEvent:(n,l,g,{skipDedupe:c}={})=>{try{const d={meta:o.value,payload:{name:n,domain:null!=g?g:r.eventDomain,attributes:l,timestamp:b(),trace:s.getTraceContext()},type:e.TransportItemType.EVENT},p={name:d.payload.name,attributes:d.payload.attributes,domain:d.payload.domain};if(!c&&r.dedupe&&!a(u)&&m(p,u))return void t.debug("Skipping event push because it is the same as the last one\n",d.payload);u=p,t.debug("Pushing event\n",d),i.execute(d)}catch(e){t.error("Error pushing event",e)}}}}(0,t,r,o,i,s))}const G="undefined"==typeof window?global:window;const B="1.0.1";const z="_faroInternal";function M(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(G,z,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function U(){return z in G}function V(n,t,r,o,a,i,s){return t.debug("Initializing Faro"),e.faro={api:i,config:r,instrumentations:s,internalLogger:t,metas:o,pause:a.pause,transports:a,unpatchedConsole:n,unpause:a.unpause},M(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 G)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(G,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=w,e.BaseInstrumentation=class extends w{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends w{getIgnoreUrls(){return[]}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.VERSION=B,e.allLogLevels=E,e.createInternalLogger=k,e.createPromiseBuffer=function(e){const{size:n,concurrency:t}=e,r=[];let o=0;const a=()=>{if(o<t&&r.length){const{producer:e,resolve:n,reject:t}=r.shift();o++,e().then((e=>{o--,a(),n(e)}),(e=>{o--,a(),t(e)}))}};return{add:e=>{if(r.length+o>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{r.push({producer:e,resolve:n,reject:t}),a()}))}}},e.deepEqual=m,e.defaultExceptionType=F,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=x,e.defaultLogLevel=y,e.defaultUnpatchedConsole=A,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>I[Math.floor(Math.random()*I.length)])).join("")},e.getCurrentTimestamp=b,e.getInternalFaroFromGlobalObject=function(){return G[z]},e.getTransportBody=function(n){return{[T[n.type]]:n.type===e.TransportItemType.TRACE?n.payload:[n.payload],meta:n.meta}},e.globalObject=G,e.initializeFaro=function(e){const n=N(e),t=P(n,e);if(U()&&!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=[],o=[];const a=()=>r.reduce(((e,n)=>Object.assign(e,l(n)?n():n)),{}),i=()=>{if(o.length){const e=a();o.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),r.push(...e),i()},remove:(...e)=>{n.debug("Removing metas\n",e),r=r.filter((n=>!e.includes(n))),i()},addListener:e=>{n.debug("Adding metas listener\n",e),o.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),o=o.filter((n=>n!==e))},get value(){return a()}}}(0,t),o=function(e,n,t,r){n.debug("Initializing transports");const o=[];let a=t.paused,i=[];return{add:(...a)=>{n.debug("Adding transports"),a.forEach((a=>{n.debug(`Adding "${a.name}" transport`),o.some((e=>e===a))?n.warn(`Transport ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=r,o.push(a))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",i),e.forEach((e=>{e&&i.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&i.push(O(e))}))},getBeforeSendHooks:()=>[...i],execute:e=>{if(!a){let t=e;for(const e of i){const n=e(t);if(null===n)return;t=n}for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.send(t)}},isPaused:()=>a,pause:()=>{n.debug("Pausing transports"),a=!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)=>{i.filter((n=>!e.includes(n)))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),a=!1}}}(n,t,e,r),a=D(0,t,e,r,o),i=function(e,n,t,r,o,a){n.debug("Initializing instrumentations");const i=[];return{add:(...s)=>{n.debug("Adding instrumentations"),s.forEach((s=>{n.debug(`Adding "${s.name}" instrumentation`),i.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=o,s.api=a,i.push(s),s.initialize())}))},get instrumentations(){return[...i]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,r;n.debug(`Removing "${e.name}" instrumentation`);const o=i.reduce(((n,t,r)=>null===n&&t.name===e.name?r:null),null);o?(null===(r=(t=i[o]).destroy)||void 0===r||r.call(t),i.splice(o,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,r,o,a),s=V(n,t,e,r,o,a,i);return function(e){var n;const t={sdk:{name:"@grafana/faro-core",version:B,integrations:e.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}};e.config.session&&e.api.setSession(e.config.session),e.config.app&&(t.app=e.config.app),e.config.user&&(t.user=e.config.user),e.config.view&&(t.view=e.config.view),e.metas.add(t,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(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=g,e.isBoolean=e=>n(e,"boolean"),e.isDomError=e=>t(e,"DOMError"),e.isDomException=e=>t(e,"DOMException"),e.isElement=e=>p&&r(e,Element),e.isElementDefined=p,e.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=>s(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=U,e.isMap=e=>f&&r(e,Map),e.isMapDefined=f,e.isNull=a,e.isNumber=s,e.isObject=u,e.isPrimitive=e=>!u(e)&&!l(e),e.isRegExp=e=>t(e,"RegExp"),e.isString=i,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>u(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=o,e.noop=h,e.setInternalFaroOnGlobalObject=M,e.transportItemTypeToBodyKey=T,e}({});
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initializeEventsAPI = void 0;
4
4
  var transports_1 = require("../../transports");
5
5
  var utils_1 = require("../../utils");
6
- function initializeEventsAPI(internalLogger, config, transports, metas, tracesApi) {
6
+ function initializeEventsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
7
7
  var lastPayload = null;
8
8
  var pushEvent = function (name, attributes, domain, _a) {
9
9
  var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe;
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAgF;AAChF,qCAAqE;AAIrE,SAAgB,mBAAmB,CACjC,cAA8B,EAC9B,MAAc,EACd,UAAsB,EACtB,KAAY,EACZ,SAAoB;IAEpB,IAAI,WAAW,GAA8D,IAAI,CAAC;IAElF,IAAM,SAAS,GAA2B,UAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAmB;YAAnB,qBAAiB,EAAE,KAAA,EAAjB,UAAU,gBAAA;QAC/E,IAAI;YACF,IAAM,IAAI,GAA8B;gBACtC,IAAI,EAAE,KAAK,CAAC,KAAK;gBACjB,OAAO,EAAE;oBACP,IAAI,MAAA;oBACJ,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,MAAM,CAAC,WAAW;oBACpC,UAAU,YAAA;oBACV,SAAS,EAAE,IAAA,2BAAmB,GAAE;oBAChC,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE;iBACnC;gBACD,IAAI,EAAE,8BAAiB,CAAC,KAAK;aAC9B,CAAC;YAEF,IAAM,cAAc,GAAG;gBACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;gBACvB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;gBACnC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAClG,cAAc,CAAC,KAAK,CAAC,8DAA8D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEnG,OAAO;aACR;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAE9C,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;SAClD;IACH,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AAhDD,kDAgDC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType, Transports } from '../../transports';\nimport { deepEqual, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\nimport type { EventEvent, EventsAPI } from './types';\n\nexport function initializeEventsAPI(\n internalLogger: InternalLogger,\n config: Config,\n transports: Transports,\n metas: Metas,\n tracesApi: TracesAPI\n): EventsAPI {\n let lastPayload: Pick<EventEvent, 'name' | 'domain' | 'attributes'> | null = null;\n\n const pushEvent: EventsAPI['pushEvent'] = (name, attributes, domain, { skipDedupe } = {}) => {\n try {\n const item: TransportItem<EventEvent> = {\n meta: metas.value,\n payload: {\n name,\n domain: domain ?? config.eventDomain,\n attributes,\n timestamp: getCurrentTimestamp(),\n trace: tracesApi.getTraceContext(),\n },\n type: TransportItemType.EVENT,\n };\n\n const testingPayload = {\n name: item.payload.name,\n attributes: item.payload.attributes,\n domain: item.payload.domain,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping event push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing event\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n return {\n pushEvent,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAgF;AAEhF,qCAAqE;AAKrE,SAAgB,mBAAmB,CACjC,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,SAAoB;IAEpB,IAAI,WAAW,GAA8D,IAAI,CAAC;IAElF,IAAM,SAAS,GAA2B,UAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAmB;YAAnB,qBAAiB,EAAE,KAAA,EAAjB,UAAU,gBAAA;QAC/E,IAAI;YACF,IAAM,IAAI,GAA8B;gBACtC,IAAI,EAAE,KAAK,CAAC,KAAK;gBACjB,OAAO,EAAE;oBACP,IAAI,MAAA;oBACJ,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,MAAM,CAAC,WAAW;oBACpC,UAAU,YAAA;oBACV,SAAS,EAAE,IAAA,2BAAmB,GAAE;oBAChC,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE;iBACnC;gBACD,IAAI,EAAE,8BAAiB,CAAC,KAAK;aAC9B,CAAC;YAEF,IAAM,cAAc,GAAG;gBACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;gBACvB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;gBACnC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAClG,cAAc,CAAC,KAAK,CAAC,8DAA8D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEnG,OAAO;aACR;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAE9C,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;SAClD;IACH,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AAjDD,kDAiDC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport type { EventEvent, EventsAPI } from './types';\n\nexport function initializeEventsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): EventsAPI {\n let lastPayload: Pick<EventEvent, 'name' | 'domain' | 'attributes'> | null = null;\n\n const pushEvent: EventsAPI['pushEvent'] = (name, attributes, domain, { skipDedupe } = {}) => {\n try {\n const item: TransportItem<EventEvent> = {\n meta: metas.value,\n payload: {\n name,\n domain: domain ?? config.eventDomain,\n attributes,\n timestamp: getCurrentTimestamp(),\n trace: tracesApi.getTraceContext(),\n },\n type: TransportItemType.EVENT,\n };\n\n const testingPayload = {\n name: item.payload.name,\n attributes: item.payload.attributes,\n domain: item.payload.domain,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping event push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing event\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n return {\n pushEvent,\n };\n}\n"]}
@@ -5,7 +5,7 @@ var transports_1 = require("../../transports");
5
5
  var utils_1 = require("../../utils");
6
6
  var const_1 = require("./const");
7
7
  var stacktraceParser;
8
- function initializeExceptionsAPI(internalLogger, config, transports, metas, tracesApi) {
8
+ function initializeExceptionsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
9
9
  var _a;
10
10
  internalLogger.debug('Initializing exceptions API');
11
11
  var lastPayload = null;
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAqD;AAErD,qCAAqE;AAErE,iCAA+C;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,SAAgB,uBAAuB,CACrC,cAA8B,EAC9B,MAAc,EACd,UAAsB,EACtB,KAAY,EACZ,SAAoB;;IAEpB,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAiE,IAAI,CAAC;IAErF,gBAAgB,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,gBAAgB,CAAC;IAE9D,IAAM,sBAAsB,GAA4C,UAAC,mBAAmB;QAC1F,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,gBAAgB,GAAG,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,gBAAgB,CAAC;IAC7D,CAAC,CAAC;IAEF,IAAM,mBAAmB,GAAyC,cAAM,OAAA,gBAAgB,EAAhB,CAAgB,CAAC;IAEzF,IAAM,SAAS,GAA+B,UAAC,KAAK,EAAE,EAAsC;YAAtC,qBAAoC,EAAE,KAAA,EAApC,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,IAAI,UAAA;QACnF,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,4BAAoB,CAAC;QAElD,IAAM,IAAI,GAAkC;YAC1C,IAAI,EAAE,KAAK,CAAC,KAAK;YACjB,OAAO,EAAE;gBACP,IAAI,MAAA;gBACJ,KAAK,EAAE,KAAK,CAAC,OAAO;gBACpB,SAAS,EAAE,IAAA,2BAAmB,GAAE;gBAChC,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE;aACnC;YACD,IAAI,EAAE,8BAAiB,CAAC,SAAS;SAClC,CAAC;QAEF,WAAW,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAE1F,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,EAAE;YACvB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG;gBACxB,MAAM,EAAE,WAAW;aACpB,CAAC;SACH;QAED,IAAM,cAAc,GAAG;YACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;YACzB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;SACpC,CAAC;QAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;YAClG,cAAc,CAAC,KAAK,CAAC,8DAA8D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnG,OAAO;SACR;QAED,WAAW,GAAG,cAAc,CAAC;QAE7B,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;QAElD,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAE/C,OAAO;QACL,sBAAsB,wBAAA;QACtB,mBAAmB,qBAAA;QACnB,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AArED,0DAqEC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport { deepEqual, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\nimport { defaultExceptionType } from './const';\nimport type { ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI(\n internalLogger: InternalLogger,\n config: Config,\n transports: Transports,\n metas: Metas,\n tracesApi: TracesAPI\n): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const pushError: ExceptionsAPI['pushError'] = (error, { skipDedupe, stackFrames, type } = {}) => {\n type = type || error.name || defaultExceptionType;\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type,\n value: error.message,\n timestamp: getCurrentTimestamp(),\n trace: tracesApi.getTraceContext(),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n transports.execute(item);\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAqD;AAGrD,qCAAqE;AAGrE,iCAA+C;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,SAAgB,uBAAuB,CACrC,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,SAAoB;;IAEpB,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAiE,IAAI,CAAC;IAErF,gBAAgB,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,gBAAgB,CAAC;IAE9D,IAAM,sBAAsB,GAA4C,UAAC,mBAAmB;QAC1F,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,gBAAgB,GAAG,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,gBAAgB,CAAC;IAC7D,CAAC,CAAC;IAEF,IAAM,mBAAmB,GAAyC,cAAM,OAAA,gBAAgB,EAAhB,CAAgB,CAAC;IAEzF,IAAM,SAAS,GAA+B,UAAC,KAAK,EAAE,EAAsC;YAAtC,qBAAoC,EAAE,KAAA,EAApC,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,IAAI,UAAA;QACnF,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,4BAAoB,CAAC;QAElD,IAAM,IAAI,GAAkC;YAC1C,IAAI,EAAE,KAAK,CAAC,KAAK;YACjB,OAAO,EAAE;gBACP,IAAI,MAAA;gBACJ,KAAK,EAAE,KAAK,CAAC,OAAO;gBACpB,SAAS,EAAE,IAAA,2BAAmB,GAAE;gBAChC,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE;aACnC;YACD,IAAI,EAAE,8BAAiB,CAAC,SAAS;SAClC,CAAC;QAEF,WAAW,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAE1F,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,EAAE;YACvB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG;gBACxB,MAAM,EAAE,WAAW;aACpB,CAAC;SACH;QAED,IAAM,cAAc,GAAG;YACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;YACzB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;SACpC,CAAC;QAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;YAClG,cAAc,CAAC,KAAK,CAAC,8DAA8D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnG,OAAO;SACR;QAED,WAAW,GAAG,cAAc,CAAC;QAE7B,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;QAElD,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAE/C,OAAO;QACL,sBAAsB,wBAAA;QACtB,mBAAmB,qBAAA;QACnB,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AAtED,0DAsEC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport { defaultExceptionType } from './const';\nimport type { ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const pushError: ExceptionsAPI['pushError'] = (error, { skipDedupe, stackFrames, type } = {}) => {\n type = type || error.name || defaultExceptionType;\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type,\n value: error.message,\n timestamp: getCurrentTimestamp(),\n trace: tracesApi.getTraceContext(),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n transports.execute(item);\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n"]}
@@ -18,10 +18,10 @@ var logs_1 = require("./logs");
18
18
  var measurements_1 = require("./measurements");
19
19
  var meta_1 = require("./meta");
20
20
  var traces_1 = require("./traces");
21
- function initializeAPI(internalLogger, config, transports, metas) {
21
+ function initializeAPI(unpatchedConsole, internalLogger, config, metas, transports) {
22
22
  internalLogger.debug('Initializing API');
23
- var tracesApi = (0, traces_1.initializeTracesAPI)(internalLogger, config, transports, metas);
24
- return __assign(__assign(__assign(__assign(__assign(__assign({}, tracesApi), (0, exceptions_1.initializeExceptionsAPI)(internalLogger, config, transports, metas, tracesApi)), (0, meta_1.initializeMetaAPI)(internalLogger, config, transports, metas)), (0, logs_1.initializeLogsAPI)(internalLogger, config, transports, metas, tracesApi)), (0, measurements_1.initializeMeasurementsAPI)(internalLogger, config, transports, metas, tracesApi)), (0, events_1.initializeEventsAPI)(internalLogger, config, transports, metas, tracesApi));
23
+ var tracesApi = (0, traces_1.initializeTracesAPI)(unpatchedConsole, internalLogger, config, metas, transports);
24
+ return __assign(__assign(__assign(__assign(__assign(__assign({}, tracesApi), (0, exceptions_1.initializeExceptionsAPI)(unpatchedConsole, internalLogger, config, metas, transports, tracesApi)), (0, meta_1.initializeMetaAPI)(unpatchedConsole, internalLogger, config, metas, transports)), (0, logs_1.initializeLogsAPI)(unpatchedConsole, internalLogger, config, metas, transports, tracesApi)), (0, measurements_1.initializeMeasurementsAPI)(unpatchedConsole, internalLogger, config, metas, transports, tracesApi)), (0, events_1.initializeEventsAPI)(unpatchedConsole, internalLogger, config, metas, transports, tracesApi));
25
25
  }
26
26
  exports.initializeAPI = initializeAPI;
27
27
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,mCAA+C;AAC/C,2CAAuD;AACvD,+BAA2C;AAC3C,+CAA2D;AAC3D,+BAA2C;AAC3C,mCAA+C;AAG/C,SAAgB,aAAa,CAC3B,cAA8B,EAC9B,MAAc,EACd,UAAsB,EACtB,KAAY;IAEZ,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEzC,IAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAEjF,iEACK,SAAS,GACT,IAAA,oCAAuB,EAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,GAC7E,IAAA,wBAAiB,EAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,GAC5D,IAAA,wBAAiB,EAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,GACvE,IAAA,wCAAyB,EAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,GAC/E,IAAA,4BAAmB,EAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,EAC5E;AACJ,CAAC;AAlBD,sCAkBC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport { initializeEventsAPI } from './events';\nimport { initializeExceptionsAPI } from './exceptions';\nimport { initializeLogsAPI } from './logs';\nimport { initializeMeasurementsAPI } from './measurements';\nimport { initializeMetaAPI } from './meta';\nimport { initializeTracesAPI } from './traces';\nimport type { API } from './types';\n\nexport function initializeAPI(\n internalLogger: InternalLogger,\n config: Config,\n transports: Transports,\n metas: Metas\n): API {\n internalLogger.debug('Initializing API');\n\n const tracesApi = initializeTracesAPI(internalLogger, config, transports, metas);\n\n return {\n ...tracesApi,\n ...initializeExceptionsAPI(internalLogger, config, transports, metas, tracesApi),\n ...initializeMetaAPI(internalLogger, config, transports, metas),\n ...initializeLogsAPI(internalLogger, config, transports, metas, tracesApi),\n ...initializeMeasurementsAPI(internalLogger, config, transports, metas, tracesApi),\n ...initializeEventsAPI(internalLogger, config, transports, metas, tracesApi),\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAMA,mCAA+C;AAC/C,2CAAuD;AACvD,+BAA2C;AAC3C,+CAA2D;AAC3D,+BAA2C;AAC3C,mCAA+C;AAG/C,SAAgB,aAAa,CAC3B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB;IAEtB,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEzC,IAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAEnG,iEACK,SAAS,GACT,IAAA,oCAAuB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,GAC/F,IAAA,wBAAiB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,GAC9E,IAAA,wBAAiB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,GACzF,IAAA,wCAAyB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,GACjG,IAAA,4BAAmB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,EAC9F;AACJ,CAAC;AAnBD,sCAmBC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { initializeEventsAPI } from './events';\nimport { initializeExceptionsAPI } from './exceptions';\nimport { initializeLogsAPI } from './logs';\nimport { initializeMeasurementsAPI } from './measurements';\nimport { initializeMetaAPI } from './meta';\nimport { initializeTracesAPI } from './traces';\nimport type { API } from './types';\n\nexport function initializeAPI(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports\n): API {\n internalLogger.debug('Initializing API');\n\n const tracesApi = initializeTracesAPI(unpatchedConsole, internalLogger, config, metas, transports);\n\n return {\n ...tracesApi,\n ...initializeExceptionsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n ...initializeMetaAPI(unpatchedConsole, internalLogger, config, metas, transports),\n ...initializeLogsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n ...initializeMeasurementsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n ...initializeEventsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n };\n}\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initializeLogsAPI = void 0;
4
4
  var transports_1 = require("../../transports");
5
5
  var utils_1 = require("../../utils");
6
- function initializeLogsAPI(internalLogger, config, transports, metas, tracesApi) {
6
+ function initializeLogsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
7
7
  internalLogger.debug('Initializing logs API');
8
8
  var lastPayload = null;
9
9
  var pushLog = function (args, _a) {
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/logs/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAoE;AAEpE,qCAAsF;AAItF,SAAgB,iBAAiB,CAC/B,cAA8B,EAC9B,MAAc,EACd,UAAsB,EACtB,KAAY,EACZ,SAAoB;IAEpB,cAAc,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE9C,IAAI,WAAW,GAA2D,IAAI,CAAC;IAE/E,IAAM,OAAO,GAAuB,UAAC,IAAI,EAAE,EAAmC;YAAnC,qBAAiC,EAAE,KAAA,EAAjC,OAAO,aAAA,EAAE,KAAK,WAAA,EAAE,UAAU,gBAAA;QACrE,IAAI;YACF,IAAM,IAAI,GAA4B;gBACpC,IAAI,EAAE,8BAAiB,CAAC,GAAG;gBAC3B,OAAO,EAAE;oBACP,OAAO,EAAE,IAAI;yBACV,GAAG,CAAC,UAAC,GAAG;wBACP,IAAI;4BACF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;yBACpB;wBAAC,OAAO,GAAG,EAAE;4BACZ,OAAO,EAAE,CAAC;yBACX;oBACH,CAAC,CAAC;yBACD,IAAI,CAAC,GAAG,CAAC;oBACZ,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,uBAAe;oBAC/B,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;oBACtB,SAAS,EAAE,IAAA,2BAAmB,GAAE;oBAChC,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE;iBACnC;gBACD,IAAI,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC;YAEF,IAAM,cAAc,GAAG;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;gBAC7B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;aAC9B,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAClG,cAAc,CAAC,KAAK,CAAC,4DAA4D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEjG,OAAO;aACR;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAE5C,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;SAClD;IACH,CAAC,CAAC;IAEF,OAAO;QACL,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AA1DD,8CA0DC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType } from '../../transports';\nimport type { Transports } from '../../transports';\nimport { deepEqual, defaultLogLevel, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\nimport type { LogEvent, LogsAPI } from './types';\n\nexport function initializeLogsAPI(\n internalLogger: InternalLogger,\n config: Config,\n transports: Transports,\n metas: Metas,\n tracesApi: TracesAPI\n): LogsAPI {\n internalLogger.debug('Initializing logs API');\n\n let lastPayload: Pick<LogEvent, 'message' | 'level' | 'context'> | null = null;\n\n const pushLog: LogsAPI['pushLog'] = (args, { context, level, skipDedupe } = {}) => {\n try {\n const item: TransportItem<LogEvent> = {\n type: TransportItemType.LOG,\n payload: {\n message: args\n .map((arg) => {\n try {\n return String(arg);\n } catch (err) {\n return '';\n }\n })\n .join(' '),\n level: level ?? defaultLogLevel,\n context: context ?? {},\n timestamp: getCurrentTimestamp(),\n trace: tracesApi.getTraceContext(),\n },\n meta: metas.value,\n };\n\n const testingPayload = {\n message: item.payload.message,\n level: item.payload.level,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping log push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing log\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing log\\n', err);\n }\n };\n\n return {\n pushLog,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/logs/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAoE;AAGpE,qCAAsF;AAKtF,SAAgB,iBAAiB,CAC/B,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,SAAoB;IAEpB,cAAc,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE9C,IAAI,WAAW,GAA2D,IAAI,CAAC;IAE/E,IAAM,OAAO,GAAuB,UAAC,IAAI,EAAE,EAAmC;YAAnC,qBAAiC,EAAE,KAAA,EAAjC,OAAO,aAAA,EAAE,KAAK,WAAA,EAAE,UAAU,gBAAA;QACrE,IAAI;YACF,IAAM,IAAI,GAA4B;gBACpC,IAAI,EAAE,8BAAiB,CAAC,GAAG;gBAC3B,OAAO,EAAE;oBACP,OAAO,EAAE,IAAI;yBACV,GAAG,CAAC,UAAC,GAAG;wBACP,IAAI;4BACF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;yBACpB;wBAAC,OAAO,GAAG,EAAE;4BACZ,OAAO,EAAE,CAAC;yBACX;oBACH,CAAC,CAAC;yBACD,IAAI,CAAC,GAAG,CAAC;oBACZ,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,uBAAe;oBAC/B,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;oBACtB,SAAS,EAAE,IAAA,2BAAmB,GAAE;oBAChC,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE;iBACnC;gBACD,IAAI,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC;YAEF,IAAM,cAAc,GAAG;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;gBAC7B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;aAC9B,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAClG,cAAc,CAAC,KAAK,CAAC,4DAA4D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEjG,OAAO;aACR;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAE5C,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;SAClD;IACH,CAAC,CAAC;IAEF,OAAO;QACL,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AA3DD,8CA2DC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType } from '../../transports';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, defaultLogLevel, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport type { LogEvent, LogsAPI } from './types';\n\nexport function initializeLogsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): LogsAPI {\n internalLogger.debug('Initializing logs API');\n\n let lastPayload: Pick<LogEvent, 'message' | 'level' | 'context'> | null = null;\n\n const pushLog: LogsAPI['pushLog'] = (args, { context, level, skipDedupe } = {}) => {\n try {\n const item: TransportItem<LogEvent> = {\n type: TransportItemType.LOG,\n payload: {\n message: args\n .map((arg) => {\n try {\n return String(arg);\n } catch (err) {\n return '';\n }\n })\n .join(' '),\n level: level ?? defaultLogLevel,\n context: context ?? {},\n timestamp: getCurrentTimestamp(),\n trace: tracesApi.getTraceContext(),\n },\n meta: metas.value,\n };\n\n const testingPayload = {\n message: item.payload.message,\n level: item.payload.level,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping log push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing log\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing log\\n', err);\n }\n };\n\n return {\n pushLog,\n };\n}\n"]}
@@ -14,15 +14,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.initializeMeasurementsAPI = void 0;
15
15
  var transports_1 = require("../../transports");
16
16
  var utils_1 = require("../../utils");
17
- function initializeMeasurementsAPI(internalLogger, config, transports, metas, tracesApi) {
17
+ function initializeMeasurementsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
18
18
  internalLogger.debug('Initializing measurements API');
19
19
  var lastPayload = null;
20
20
  var pushMeasurement = function (payload, _a) {
21
- var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe;
21
+ var _b;
22
+ var _c = _a === void 0 ? {} : _a, skipDedupe = _c.skipDedupe;
22
23
  try {
23
24
  var item = {
24
25
  type: transports_1.TransportItemType.MEASUREMENT,
25
- payload: __assign(__assign({}, payload), { trace: tracesApi.getTraceContext() }),
26
+ payload: __assign(__assign({}, payload), { trace: tracesApi.getTraceContext(), timestamp: (_b = payload.timestamp) !== null && _b !== void 0 ? _b : (0, utils_1.getCurrentTimestamp)() }),
26
27
  meta: metas.value,
27
28
  };
28
29
  var testingPayload = {
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/measurements/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,+CAAoE;AAEpE,qCAAgD;AAIhD,SAAgB,yBAAyB,CACvC,cAA8B,EAC9B,MAAc,EACd,UAAsB,EACtB,KAAY,EACZ,SAAoB;IAEpB,cAAc,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAEtD,IAAI,WAAW,GAAqD,IAAI,CAAC;IAEzE,IAAM,eAAe,GAAuC,UAAC,OAAO,EAAE,EAAmB;YAAnB,qBAAiB,EAAE,KAAA,EAAjB,UAAU,gBAAA;QAChF,IAAI;YACF,IAAM,IAAI,GAAoC;gBAC5C,IAAI,EAAE,8BAAiB,CAAC,WAAW;gBACnC,OAAO,wBACF,OAAO,KACV,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE,GACnC;gBACD,IAAI,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC;YAEF,IAAM,cAAc,GAAG;gBACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;gBACvB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAClG,cAAc,CAAC,KAAK,CAAC,oEAAoE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEzG,OAAO;aACR;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;YAEpD,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;SAC1D;IACH,CAAC,CAAC;IAEF,OAAO;QACL,eAAe,iBAAA;KAChB,CAAC;AACJ,CAAC;AA9CD,8DA8CC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType } from '../../transports';\nimport type { Transports } from '../../transports';\nimport { deepEqual, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\nimport type { MeasurementEvent, MeasurementsAPI } from './types';\n\nexport function initializeMeasurementsAPI(\n internalLogger: InternalLogger,\n config: Config,\n transports: Transports,\n metas: Metas,\n tracesApi: TracesAPI\n): MeasurementsAPI {\n internalLogger.debug('Initializing measurements API');\n\n let lastPayload: Pick<MeasurementEvent, 'type' | 'values'> | null = null;\n\n const pushMeasurement: MeasurementsAPI['pushMeasurement'] = (payload, { skipDedupe } = {}) => {\n try {\n const item: TransportItem<MeasurementEvent> = {\n type: TransportItemType.MEASUREMENT,\n payload: {\n ...payload,\n trace: tracesApi.getTraceContext(),\n },\n meta: metas.value,\n };\n\n const testingPayload = {\n type: item.payload.type,\n values: item.payload.values,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping measurement push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing measurement\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing measurement\\n', err);\n }\n };\n\n return {\n pushMeasurement,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/measurements/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,+CAAoE;AAGpE,qCAAqE;AAKrE,SAAgB,yBAAyB,CACvC,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,SAAoB;IAEpB,cAAc,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAEtD,IAAI,WAAW,GAAqD,IAAI,CAAC;IAEzE,IAAM,eAAe,GAAuC,UAAC,OAAO,EAAE,EAAmB;;YAAnB,qBAAiB,EAAE,KAAA,EAAjB,UAAU,gBAAA;QAChF,IAAI;YACF,IAAM,IAAI,GAAoC;gBAC5C,IAAI,EAAE,8BAAiB,CAAC,WAAW;gBACnC,OAAO,wBACF,OAAO,KACV,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE,EAClC,SAAS,EAAE,MAAA,OAAO,CAAC,SAAS,mCAAI,IAAA,2BAAmB,GAAE,GACtD;gBACD,IAAI,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC;YAEF,IAAM,cAAc,GAAG;gBACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;gBACvB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAClG,cAAc,CAAC,KAAK,CAAC,oEAAoE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEzG,OAAO;aACR;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;YAEpD,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;SAC1D;IACH,CAAC,CAAC;IAEF,OAAO;QACL,eAAe,iBAAA;KAChB,CAAC;AACJ,CAAC;AAhDD,8DAgDC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType } from '../../transports';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport type { MeasurementEvent, MeasurementsAPI } from './types';\n\nexport function initializeMeasurementsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): MeasurementsAPI {\n internalLogger.debug('Initializing measurements API');\n\n let lastPayload: Pick<MeasurementEvent, 'type' | 'values'> | null = null;\n\n const pushMeasurement: MeasurementsAPI['pushMeasurement'] = (payload, { skipDedupe } = {}) => {\n try {\n const item: TransportItem<MeasurementEvent> = {\n type: TransportItemType.MEASUREMENT,\n payload: {\n ...payload,\n trace: tracesApi.getTraceContext(),\n timestamp: payload.timestamp ?? getCurrentTimestamp(),\n },\n meta: metas.value,\n };\n\n const testingPayload = {\n type: item.payload.type,\n values: item.payload.values,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping measurement push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing measurement\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing measurement\\n', err);\n }\n };\n\n return {\n pushMeasurement,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/measurements/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceContext } from '../traces';\n\nexport interface MeasurementEvent<V extends { [label: string]: number } = { [label: string]: number }> {\n type: string;\n values: V;\n\n trace?: TraceContext;\n}\n\nexport interface PushMeasurementOptions {\n skipDedupe?: boolean;\n}\n\nexport interface MeasurementsAPI {\n pushMeasurement: (payload: MeasurementEvent, options?: PushMeasurementOptions) => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/measurements/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceContext } from '../traces';\n\nexport interface MeasurementEvent<V extends { [label: string]: number } = { [label: string]: number }> {\n type: string;\n values: V;\n\n timestamp: string;\n trace?: TraceContext;\n}\n\nexport interface PushMeasurementOptions {\n skipDedupe?: boolean;\n}\n\nexport interface MeasurementsAPI {\n pushMeasurement: (\n // TODO: change this back once we have aligned the measurement event types: See: https://github.com/grafana/faro-web-sdk/issues/110\n payload: Omit<MeasurementEvent, 'timestamp'> & Partial<Pick<MeasurementEvent, 'timestamp'>>,\n options?: PushMeasurementOptions\n ) => void;\n}\n"]}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initializeMetaAPI = void 0;
4
- function initializeMetaAPI(internalLogger, _config, _transports, metas) {
4
+ function initializeMetaAPI(_unpatchedConsole, internalLogger, _config, metas, _transports) {
5
5
  internalLogger.debug('Initializing meta API');
6
6
  var metaSession = undefined;
7
7
  var metaUser = undefined;
8
+ var metaView = undefined;
8
9
  var setUser = function (user) {
9
10
  if (metaUser) {
10
11
  metas.remove(metaUser);
@@ -24,12 +25,24 @@ function initializeMetaAPI(internalLogger, _config, _transports, metas) {
24
25
  metas.add(metaSession);
25
26
  };
26
27
  var getSession = function () { return metas.value.session; };
28
+ var setView = function (view) {
29
+ if (metaView) {
30
+ metas.remove(metaView);
31
+ }
32
+ metaView = {
33
+ view: view,
34
+ };
35
+ metas.add(metaView);
36
+ };
37
+ var getView = function () { return metas.value.view; };
27
38
  return {
28
39
  setUser: setUser,
29
40
  resetUser: setUser,
30
41
  setSession: setSession,
31
42
  resetSession: setSession,
32
43
  getSession: getSession,
44
+ setView: setView,
45
+ getView: getView,
33
46
  };
34
47
  }
35
48
  exports.initializeMetaAPI = initializeMetaAPI;
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/meta/initialize.ts"],"names":[],"mappings":";;;AAMA,SAAgB,iBAAiB,CAC/B,cAA8B,EAC9B,OAAe,EACf,WAAuB,EACvB,KAAY;IAEZ,cAAc,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE9C,IAAI,WAAW,GAA8B,SAAS,CAAC;IACvD,IAAI,QAAQ,GAA8B,SAAS,CAAC;IAEpD,IAAM,OAAO,GAAG,UAAC,IAAe;QAC9B,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SACxB;QAED,QAAQ,GAAG;YACT,IAAI,MAAA;SACL,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,IAAM,UAAU,GAAG,UAAC,OAAqB;QACvC,IAAI,WAAW,EAAE;YACf,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;SAC3B;QAED,WAAW,GAAG;YACZ,OAAO,SAAA;SACR,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,IAAM,UAAU,GAA0B,cAAM,OAAA,KAAK,CAAC,KAAK,CAAC,OAAO,EAAnB,CAAmB,CAAC;IAEpE,OAAO;QACL,OAAO,SAAA;QACP,SAAS,EAAE,OAAO;QAClB,UAAU,YAAA;QACV,YAAY,EAAE,UAAU;QACxB,UAAU,YAAA;KACX,CAAC;AACJ,CAAC;AA5CD,8CA4CC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Meta, Metas, MetaSession, MetaUser } from '../../metas';\nimport type { Transports } from '../../transports';\nimport type { MetaAPI } from './types';\n\nexport function initializeMetaAPI(\n internalLogger: InternalLogger,\n _config: Config,\n _transports: Transports,\n metas: Metas\n): MetaAPI {\n internalLogger.debug('Initializing meta API');\n\n let metaSession: Partial<Meta> | undefined = undefined;\n let metaUser: Partial<Meta> | undefined = undefined;\n\n const setUser = (user?: MetaUser) => {\n if (metaUser) {\n metas.remove(metaUser);\n }\n\n metaUser = {\n user,\n };\n\n metas.add(metaUser);\n };\n\n const setSession = (session?: MetaSession) => {\n if (metaSession) {\n metas.remove(metaSession);\n }\n\n metaSession = {\n session,\n };\n\n metas.add(metaSession);\n };\n\n const getSession: MetaAPI['getSession'] = () => metas.value.session;\n\n return {\n setUser,\n resetUser: setUser,\n setSession,\n resetSession: setSession,\n getSession,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/meta/initialize.ts"],"names":[],"mappings":";;;AAQA,SAAgB,iBAAiB,CAC/B,iBAAmC,EACnC,cAA8B,EAC9B,OAAe,EACf,KAAY,EACZ,WAAuB;IAEvB,cAAc,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE9C,IAAI,WAAW,GAA8B,SAAS,CAAC;IACvD,IAAI,QAAQ,GAA8B,SAAS,CAAC;IACpD,IAAI,QAAQ,GAA8B,SAAS,CAAC;IAEpD,IAAM,OAAO,GAAuB,UAAC,IAAI;QACvC,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SACxB;QAED,QAAQ,GAAG;YACT,IAAI,MAAA;SACL,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,IAAM,UAAU,GAA0B,UAAC,OAAO;QAChD,IAAI,WAAW,EAAE;YACf,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;SAC3B;QAED,WAAW,GAAG;YACZ,OAAO,SAAA;SACR,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,IAAM,UAAU,GAA0B,cAAM,OAAA,KAAK,CAAC,KAAK,CAAC,OAAO,EAAnB,CAAmB,CAAC;IAEpE,IAAM,OAAO,GAAuB,UAAC,IAAI;QACvC,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SACxB;QAED,QAAQ,GAAG;YACT,IAAI,MAAA;SACL,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,IAAM,OAAO,GAAuB,cAAM,OAAA,KAAK,CAAC,KAAK,CAAC,IAAI,EAAhB,CAAgB,CAAC;IAE3D,OAAO;QACL,OAAO,SAAA;QACP,SAAS,EAAE,OAA+B;QAC1C,UAAU,YAAA;QACV,YAAY,EAAE,UAAqC;QACnD,UAAU,YAAA;QACV,OAAO,SAAA;QACP,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AA9DD,8CA8DC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Meta, Metas } from '../../metas';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\n\nimport type { MetaAPI } from './types';\n\nexport function initializeMetaAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config,\n metas: Metas,\n _transports: Transports\n): MetaAPI {\n internalLogger.debug('Initializing meta API');\n\n let metaSession: Partial<Meta> | undefined = undefined;\n let metaUser: Partial<Meta> | undefined = undefined;\n let metaView: Partial<Meta> | undefined = undefined;\n\n const setUser: MetaAPI['setUser'] = (user) => {\n if (metaUser) {\n metas.remove(metaUser);\n }\n\n metaUser = {\n user,\n };\n\n metas.add(metaUser);\n };\n\n const setSession: MetaAPI['setSession'] = (session) => {\n if (metaSession) {\n metas.remove(metaSession);\n }\n\n metaSession = {\n session,\n };\n\n metas.add(metaSession);\n };\n\n const getSession: MetaAPI['getSession'] = () => metas.value.session;\n\n const setView: MetaAPI['setView'] = (view) => {\n if (metaView) {\n metas.remove(metaView);\n }\n\n metaView = {\n view,\n };\n\n metas.add(metaView);\n };\n\n const getView: MetaAPI['getView'] = () => metas.value.view;\n\n return {\n setUser,\n resetUser: setUser as MetaAPI['resetUser'],\n setSession,\n resetSession: setSession as MetaAPI['resetSession'],\n getSession,\n setView,\n getView,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/meta/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MetaSession, MetaUser } from '../../metas';\n\nexport interface MetaAPI {\n setUser: (user: MetaUser) => void;\n resetUser: () => void;\n setSession: (session: MetaSession) => void;\n resetSession: () => void;\n getSession: () => MetaSession | undefined;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/meta/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MetaSession, MetaUser, MetaView } from '../../metas';\n\nexport interface MetaAPI {\n setUser: (user?: MetaUser | undefined) => void;\n resetUser: () => void;\n setSession: (session?: MetaSession | undefined) => void;\n resetSession: () => void;\n getSession: () => MetaSession | undefined;\n setView: (view?: MetaView | undefined) => void;\n getView: () => MetaView | undefined;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initializeTracesAPI = void 0;
4
4
  var transports_1 = require("../../transports");
5
- function initializeTracesAPI(internalLogger, _config, transports, metas) {
5
+ function initializeTracesAPI(_unpatchedConsole, internalLogger, _config, metas, transports) {
6
6
  internalLogger.debug('Initializing traces API');
7
7
  var otel = undefined;
8
8
  var initOTEL = function (trace, context) {
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/traces/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAgF;AAGhF,SAAgB,mBAAmB,CACjC,cAA8B,EAC9B,OAAe,EACf,UAAsB,EACtB,KAAY;IAEZ,cAAc,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAEhD,IAAI,IAAI,GAAwB,SAAS,CAAC;IAE1C,IAAM,QAAQ,GAA0B,UAAC,KAAK,EAAE,OAAO;QACrD,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,IAAI,GAAG;YACL,KAAK,OAAA;YACL,OAAO,SAAA;SACR,CAAC;IACJ,CAAC,CAAC;IAEF,IAAM,eAAe,GAAiC;QACpD,IAAM,GAAG,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAE9D,OAAO,CAAC,GAAG;YACT,CAAC,CAAC,SAAS;YACX,CAAC,CAAC;gBACE,QAAQ,EAAE,GAAG,CAAC,OAAO;gBACrB,OAAO,EAAE,GAAG,CAAC,MAAM;aACpB,CAAC;IACR,CAAC,CAAC;IAEF,IAAM,UAAU,GAA4B,UAAC,OAAO;QAClD,IAAI;YACF,IAAM,IAAI,GAA8B;gBACtC,IAAI,EAAE,8BAAiB,CAAC,KAAK;gBAC7B,OAAO,SAAA;gBACP,IAAI,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC;YAEF,cAAc,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAE9C,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;SACpD;IACH,CAAC,CAAC;IAEF,IAAM,OAAO,GAAyB,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;IAEjD,IAAM,iBAAiB,GAAmC,cAAM,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC;IAEvE,OAAO;QACL,OAAO,SAAA;QACP,eAAe,iBAAA;QACf,QAAQ,UAAA;QACR,iBAAiB,mBAAA;QACjB,UAAU,YAAA;KACX,CAAC;AACJ,CAAC;AAzDD,kDAyDC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType, Transports } from '../../transports';\nimport type { OTELApi, TraceEvent, TracesAPI } from './types';\n\nexport function initializeTracesAPI(\n internalLogger: InternalLogger,\n _config: Config,\n transports: Transports,\n metas: Metas\n): TracesAPI {\n internalLogger.debug('Initializing traces API');\n\n let otel: OTELApi | undefined = undefined;\n\n const initOTEL: TracesAPI['initOTEL'] = (trace, context) => {\n internalLogger.debug('Initializing OpenTelemetry');\n\n otel = {\n trace,\n context,\n };\n };\n\n const getTraceContext: TracesAPI['getTraceContext'] = () => {\n const ctx = otel?.trace.getSpanContext(otel.context.active());\n\n return !ctx\n ? undefined\n : {\n trace_id: ctx.traceId,\n span_id: ctx.spanId,\n };\n };\n\n const pushTraces: TracesAPI['pushTraces'] = (payload) => {\n try {\n const item: TransportItem<TraceEvent> = {\n type: TransportItemType.TRACE,\n payload,\n meta: metas.value,\n };\n\n internalLogger.debug('Pushing trace\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing trace\\n', err);\n }\n };\n\n const getOTEL: TracesAPI['getOTEL'] = () => otel;\n\n const isOTELInitialized: TracesAPI['isOTELInitialized'] = () => !!otel;\n\n return {\n getOTEL,\n getTraceContext,\n initOTEL,\n isOTELInitialized,\n pushTraces,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/traces/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAgF;AAKhF,SAAgB,mBAAmB,CACjC,iBAAmC,EACnC,cAA8B,EAC9B,OAAe,EACf,KAAY,EACZ,UAAsB;IAEtB,cAAc,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAEhD,IAAI,IAAI,GAAwB,SAAS,CAAC;IAE1C,IAAM,QAAQ,GAA0B,UAAC,KAAK,EAAE,OAAO;QACrD,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,IAAI,GAAG;YACL,KAAK,OAAA;YACL,OAAO,SAAA;SACR,CAAC;IACJ,CAAC,CAAC;IAEF,IAAM,eAAe,GAAiC;QACpD,IAAM,GAAG,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAE9D,OAAO,CAAC,GAAG;YACT,CAAC,CAAC,SAAS;YACX,CAAC,CAAC;gBACE,QAAQ,EAAE,GAAG,CAAC,OAAO;gBACrB,OAAO,EAAE,GAAG,CAAC,MAAM;aACpB,CAAC;IACR,CAAC,CAAC;IAEF,IAAM,UAAU,GAA4B,UAAC,OAAO;QAClD,IAAI;YACF,IAAM,IAAI,GAA8B;gBACtC,IAAI,EAAE,8BAAiB,CAAC,KAAK;gBAC7B,OAAO,SAAA;gBACP,IAAI,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC;YAEF,cAAc,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAE9C,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;SACpD;IACH,CAAC,CAAC;IAEF,IAAM,OAAO,GAAyB,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;IAEjD,IAAM,iBAAiB,GAAmC,cAAM,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC;IAEvE,OAAO;QACL,OAAO,SAAA;QACP,eAAe,iBAAA;QACf,QAAQ,UAAA;QACR,iBAAiB,mBAAA;QACjB,UAAU,YAAA;KACX,CAAC;AACJ,CAAC;AA1DD,kDA0DC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\n\nimport type { OTELApi, TraceEvent, TracesAPI } from './types';\n\nexport function initializeTracesAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config,\n metas: Metas,\n transports: Transports\n): TracesAPI {\n internalLogger.debug('Initializing traces API');\n\n let otel: OTELApi | undefined = undefined;\n\n const initOTEL: TracesAPI['initOTEL'] = (trace, context) => {\n internalLogger.debug('Initializing OpenTelemetry');\n\n otel = {\n trace,\n context,\n };\n };\n\n const getTraceContext: TracesAPI['getTraceContext'] = () => {\n const ctx = otel?.trace.getSpanContext(otel.context.active());\n\n return !ctx\n ? undefined\n : {\n trace_id: ctx.traceId,\n span_id: ctx.spanId,\n };\n };\n\n const pushTraces: TracesAPI['pushTraces'] = (payload) => {\n try {\n const item: TransportItem<TraceEvent> = {\n type: TransportItemType.TRACE,\n payload,\n meta: metas.value,\n };\n\n internalLogger.debug('Pushing trace\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing trace\\n', err);\n }\n };\n\n const getOTEL: TracesAPI['getOTEL'] = () => otel;\n\n const isOTELInitialized: TracesAPI['isOTELInitialized'] = () => !!otel;\n\n return {\n getOTEL,\n getTraceContext,\n initOTEL,\n isOTELInitialized,\n pushTraces,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, StacktraceParser } from '../api';\nimport type { Instrumentation } from '../instrumentations';\nimport type { InternalLoggerLevel } from '../internalLogger';\nimport type { MetaApp, MetaItem, MetaSession, MetaUser } from '../metas';\nimport type { BeforeSendHook, Transport } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nexport interface Config<P = APIEvent> {\n app: MetaApp;\n dedupe: boolean;\n globalObjectKey: string;\n isolate: boolean;\n instrumentations: Instrumentation[];\n internalLoggerLevel: InternalLoggerLevel;\n metas: MetaItem[];\n parseStacktrace: StacktraceParser;\n paused: boolean;\n preventGlobalExposure: boolean;\n transports: Transport[];\n unpatchedConsole: UnpatchedConsole;\n\n beforeSend?: BeforeSendHook<P>;\n ignoreErrors?: Patterns;\n session?: MetaSession;\n user?: MetaUser;\n eventDomain?: string;\n}\n\nexport type Patterns = Array<string | RegExp>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, StacktraceParser } from '../api';\nimport type { Instrumentation } from '../instrumentations';\nimport type { InternalLoggerLevel } from '../internalLogger';\nimport type { MetaApp, MetaItem, MetaSession, MetaUser, MetaView } from '../metas';\nimport type { BeforeSendHook, Transport } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nexport interface Config<P = APIEvent> {\n app: MetaApp;\n dedupe: boolean;\n globalObjectKey: string;\n isolate: boolean;\n instrumentations: Instrumentation[];\n internalLoggerLevel: InternalLoggerLevel;\n metas: MetaItem[];\n parseStacktrace: StacktraceParser;\n paused: boolean;\n preventGlobalExposure: boolean;\n transports: Transport[];\n unpatchedConsole: UnpatchedConsole;\n\n beforeSend?: BeforeSendHook<P>;\n ignoreErrors?: Patterns;\n session?: MetaSession;\n user?: MetaUser;\n view?: MetaView;\n eventDomain?: string;\n}\n\nexport type Patterns = Array<string | RegExp>;\n"]}
@@ -10,50 +10,48 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseExtension = void 0;
13
- var sdk_1 = require("../sdk");
13
+ var internalLogger_1 = require("../internalLogger");
14
+ var unpatchedConsole_1 = require("../unpatchedConsole");
14
15
  var BaseExtension = /** @class */ (function () {
15
16
  function BaseExtension() {
17
+ this.unpatchedConsole = unpatchedConsole_1.defaultUnpatchedConsole;
18
+ this.internalLogger = internalLogger_1.defaultInternalLogger;
19
+ this.config = {};
20
+ this.metas = {};
16
21
  }
17
- Object.defineProperty(BaseExtension.prototype, "faro", {
18
- get: function () {
19
- return sdk_1.faro;
20
- },
21
- enumerable: false,
22
- configurable: true
23
- });
24
22
  BaseExtension.prototype.logDebug = function () {
25
- var _a, _b;
23
+ var _a;
26
24
  var args = [];
27
25
  for (var _i = 0; _i < arguments.length; _i++) {
28
26
  args[_i] = arguments[_i];
29
27
  }
30
- (_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.debug.apply(_b, __spreadArray(["".concat(this.name, "\n")], args, false));
28
+ (_a = this.internalLogger).debug.apply(_a, __spreadArray(["".concat(this.name, "\n")], args, false));
31
29
  };
32
30
  BaseExtension.prototype.logInfo = function () {
33
- var _a, _b;
31
+ var _a;
34
32
  var args = [];
35
33
  for (var _i = 0; _i < arguments.length; _i++) {
36
34
  args[_i] = arguments[_i];
37
35
  }
38
- (_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.info.apply(_b, __spreadArray(["".concat(this.name, "\n")], args, false));
36
+ (_a = this.internalLogger).info.apply(_a, __spreadArray(["".concat(this.name, "\n")], args, false));
39
37
  };
40
38
  BaseExtension.prototype.logWarn = function () {
41
- var _a, _b;
39
+ var _a;
42
40
  var args = [];
43
41
  for (var _i = 0; _i < arguments.length; _i++) {
44
42
  args[_i] = arguments[_i];
45
43
  }
46
- (_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.warn.apply(_b, __spreadArray(["".concat(this.name, "\n")], args, false));
44
+ (_a = this.internalLogger).warn.apply(_a, __spreadArray(["".concat(this.name, "\n")], args, false));
47
45
  };
48
46
  BaseExtension.prototype.logError = function () {
49
- var _a, _b;
47
+ var _a;
50
48
  var args = [];
51
49
  for (var _i = 0; _i < arguments.length; _i++) {
52
50
  args[_i] = arguments[_i];
53
51
  }
54
- (_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.error.apply(_b, __spreadArray(["".concat(this.name, "\n")], args, false));
52
+ (_a = this.internalLogger).error.apply(_a, __spreadArray(["".concat(this.name, "\n")], args, false));
55
53
  };
56
54
  return BaseExtension;
57
55
  }());
58
56
  exports.BaseExtension = BaseExtension;
59
- //# sourceMappingURL=extensions.js.map
57
+ //# sourceMappingURL=baseExtension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseExtension.js","sourceRoot":"","sources":["../../../src/extensions/baseExtension.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oDAA0D;AAE1D,wDAA8D;AAI9D;IAAA;QAIE,qBAAgB,GAAG,0CAAuB,CAAC;QAC3C,mBAAc,GAAG,sCAAqB,CAAC;QACvC,WAAM,GAAG,EAAY,CAAC;QACtB,UAAK,GAAG,EAAW,CAAC;IAiBtB,CAAC;IAfC,gCAAQ,GAAR;;QAAS,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACzB,CAAA,KAAA,IAAI,CAAC,cAAc,CAAA,CAAC,KAAK,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,UAAE;IACvD,CAAC;IAED,+BAAO,GAAP;;QAAQ,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACxB,CAAA,KAAA,IAAI,CAAC,cAAc,CAAA,CAAC,IAAI,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,UAAE;IACtD,CAAC;IAED,+BAAO,GAAP;;QAAQ,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACxB,CAAA,KAAA,IAAI,CAAC,cAAc,CAAA,CAAC,IAAI,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,UAAE;IACtD,CAAC;IAED,gCAAQ,GAAR;;QAAS,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACzB,CAAA,KAAA,IAAI,CAAC,cAAc,CAAA,CAAC,KAAK,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,UAAE;IACvD,CAAC;IACH,oBAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBqB,sCAAa","sourcesContent":["import type { Config } from '../config';\nimport { defaultInternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport { defaultUnpatchedConsole } from '../unpatchedConsole';\n\nimport type { Extension } from './types';\n\nexport abstract class BaseExtension implements Extension {\n abstract readonly name: string;\n abstract readonly version: string;\n\n unpatchedConsole = defaultUnpatchedConsole;\n internalLogger = defaultInternalLogger;\n config = {} as Config;\n metas = {} as Metas;\n\n logDebug(...args: unknown[]): void {\n this.internalLogger.debug(`${this.name}\\n`, ...args);\n }\n\n logInfo(...args: unknown[]): void {\n this.internalLogger.info(`${this.name}\\n`, ...args);\n }\n\n logWarn(...args: unknown[]): void {\n this.internalLogger.warn(`${this.name}\\n`, ...args);\n }\n\n logError(...args: unknown[]): void {\n this.internalLogger.error(`${this.name}\\n`, ...args);\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseExtension = void 0;
4
+ var baseExtension_1 = require("./baseExtension");
5
+ Object.defineProperty(exports, "BaseExtension", { enumerable: true, get: function () { return baseExtension_1.BaseExtension; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/index.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA","sourcesContent":["export { BaseExtension } from './baseExtension';\n\nexport type { Extension } from './types';\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/extensions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nexport interface Extension {\n readonly name: string;\n readonly version: string;\n\n internalLogger: InternalLogger;\n unpatchedConsole: UnpatchedConsole;\n config: Config;\n metas: Metas;\n\n logDebug(...args: unknown[]): void;\n logInfo(...args: unknown[]): void;\n logWarn(...args: unknown[]): void;\n logError(...args: unknown[]): void;\n}\n"]}
package/dist/cjs/index.js CHANGED
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.deepEqual = exports.createPromiseBuffer = exports.BaseExtension = exports.allLogLevels = exports.defaultUnpatchedConsole = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.getTransportBody = exports.BaseTransport = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = exports.createInternalLogger = exports.BaseInstrumentation = exports.defaultGlobalObjectKey = exports.initializeFaro = exports.globalObject = exports.defaultExceptionType = exports.setInternalFaroOnGlobalObject = exports.isInternalFaroOnGlobalObject = exports.internalGlobalObjectKey = exports.getInternalFaroFromGlobalObject = exports.faro = void 0;
4
- exports.Conventions = exports.VERSION = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = void 0;
5
- var sdk_1 = require("./sdk");
6
- Object.defineProperty(exports, "faro", { enumerable: true, get: function () { return sdk_1.faro; } });
7
- Object.defineProperty(exports, "getInternalFaroFromGlobalObject", { enumerable: true, get: function () { return sdk_1.getInternalFaroFromGlobalObject; } });
8
- Object.defineProperty(exports, "internalGlobalObjectKey", { enumerable: true, get: function () { return sdk_1.internalGlobalObjectKey; } });
9
- Object.defineProperty(exports, "isInternalFaroOnGlobalObject", { enumerable: true, get: function () { return sdk_1.isInternalFaroOnGlobalObject; } });
10
- Object.defineProperty(exports, "setInternalFaroOnGlobalObject", { enumerable: true, get: function () { return sdk_1.setInternalFaroOnGlobalObject; } });
3
+ exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.deepEqual = exports.createPromiseBuffer = exports.allLogLevels = exports.defaultUnpatchedConsole = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.getTransportBody = exports.BaseTransport = exports.Conventions = exports.setInternalFaroOnGlobalObject = exports.isInternalFaroOnGlobalObject = exports.internalGlobalObjectKey = exports.getInternalFaroFromGlobalObject = exports.faro = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = exports.createInternalLogger = exports.BaseInstrumentation = exports.defaultGlobalObjectKey = exports.initializeFaro = exports.globalObject = exports.BaseExtension = exports.defaultExceptionType = void 0;
4
+ exports.VERSION = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = void 0;
11
5
  var api_1 = require("./api");
12
6
  Object.defineProperty(exports, "defaultExceptionType", { enumerable: true, get: function () { return api_1.defaultExceptionType; } });
7
+ var extensions_1 = require("./extensions");
8
+ Object.defineProperty(exports, "BaseExtension", { enumerable: true, get: function () { return extensions_1.BaseExtension; } });
13
9
  var globalObject_1 = require("./globalObject");
14
10
  Object.defineProperty(exports, "globalObject", { enumerable: true, get: function () { return globalObject_1.globalObject; } });
15
11
  var initialize_1 = require("./initialize");
@@ -22,6 +18,14 @@ var internalLogger_1 = require("./internalLogger");
22
18
  Object.defineProperty(exports, "createInternalLogger", { enumerable: true, get: function () { return internalLogger_1.createInternalLogger; } });
23
19
  Object.defineProperty(exports, "defaultInternalLoggerLevel", { enumerable: true, get: function () { return internalLogger_1.defaultInternalLoggerLevel; } });
24
20
  Object.defineProperty(exports, "InternalLoggerLevel", { enumerable: true, get: function () { return internalLogger_1.InternalLoggerLevel; } });
21
+ var sdk_1 = require("./sdk");
22
+ Object.defineProperty(exports, "faro", { enumerable: true, get: function () { return sdk_1.faro; } });
23
+ Object.defineProperty(exports, "getInternalFaroFromGlobalObject", { enumerable: true, get: function () { return sdk_1.getInternalFaroFromGlobalObject; } });
24
+ Object.defineProperty(exports, "internalGlobalObjectKey", { enumerable: true, get: function () { return sdk_1.internalGlobalObjectKey; } });
25
+ Object.defineProperty(exports, "isInternalFaroOnGlobalObject", { enumerable: true, get: function () { return sdk_1.isInternalFaroOnGlobalObject; } });
26
+ Object.defineProperty(exports, "setInternalFaroOnGlobalObject", { enumerable: true, get: function () { return sdk_1.setInternalFaroOnGlobalObject; } });
27
+ var semantic_1 = require("./semantic");
28
+ Object.defineProperty(exports, "Conventions", { enumerable: true, get: function () { return semantic_1.Conventions; } });
25
29
  var transports_1 = require("./transports");
26
30
  Object.defineProperty(exports, "BaseTransport", { enumerable: true, get: function () { return transports_1.BaseTransport; } });
27
31
  Object.defineProperty(exports, "getTransportBody", { enumerable: true, get: function () { return transports_1.getTransportBody; } });
@@ -31,7 +35,6 @@ var unpatchedConsole_1 = require("./unpatchedConsole");
31
35
  Object.defineProperty(exports, "defaultUnpatchedConsole", { enumerable: true, get: function () { return unpatchedConsole_1.defaultUnpatchedConsole; } });
32
36
  var utils_1 = require("./utils");
33
37
  Object.defineProperty(exports, "allLogLevels", { enumerable: true, get: function () { return utils_1.allLogLevels; } });
34
- Object.defineProperty(exports, "BaseExtension", { enumerable: true, get: function () { return utils_1.BaseExtension; } });
35
38
  Object.defineProperty(exports, "createPromiseBuffer", { enumerable: true, get: function () { return utils_1.createPromiseBuffer; } });
36
39
  Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return utils_1.deepEqual; } });
37
40
  Object.defineProperty(exports, "defaultLogLevel", { enumerable: true, get: function () { return utils_1.defaultLogLevel; } });
@@ -69,6 +72,4 @@ Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function ()
69
72
  Object.defineProperty(exports, "noop", { enumerable: true, get: function () { return utils_1.noop; } });
70
73
  var version_1 = require("./version");
71
74
  Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
72
- var semantic_1 = require("./semantic");
73
- Object.defineProperty(exports, "Conventions", { enumerable: true, get: function () { return semantic_1.Conventions; } });
74
75
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,6BAMe;AALb,2FAAA,IAAI,OAAA;AACJ,sHAAA,+BAA+B,OAAA;AAC/B,8GAAA,uBAAuB,OAAA;AACvB,mHAAA,4BAA4B,OAAA;AAC5B,oHAAA,6BAA6B,OAAA;AAI/B,6BAA6C;AAApC,2GAAA,oBAAoB,OAAA;AA4B7B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,mCAAkD;AAAzC,gHAAA,sBAAsB,OAAA;AAG/B,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAG5B,mDAAyG;AAAhG,sHAAA,oBAAoB,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAkB9E,2CAA8G;AAArG,2GAAA,aAAa,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAUvF,uDAA6D;AAApD,2HAAA,uBAAuB,OAAA;AAGhC,iCAsCiB;AArCf,qGAAA,YAAY,OAAA;AACZ,sGAAA,aAAa,OAAA;AACb,4GAAA,mBAAmB,OAAA;AACnB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,4GAAA,mBAAmB,OAAA;AACnB,gGAAA,OAAO,OAAA;AACP,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAChB,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AAaN,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,uCAAyC;AAAhC,uGAAA,WAAW,OAAA","sourcesContent":["export {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport { defaultExceptionType } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n} from './metas';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n BaseExtension,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { Conventions } from './semantic';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,6BAA6C;AAApC,2GAAA,oBAAoB,OAAA;AA4B7B,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAGtB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,mCAAkD;AAAzC,gHAAA,sBAAsB,OAAA;AAG/B,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAG5B,mDAAyG;AAAhG,sHAAA,oBAAoB,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAmB9E,6BAMe;AALb,2FAAA,IAAI,OAAA;AACJ,sHAAA,+BAA+B,OAAA;AAC/B,8GAAA,uBAAuB,OAAA;AACvB,mHAAA,4BAA4B,OAAA;AAC5B,oHAAA,6BAA6B,OAAA;AAI/B,uCAAyC;AAAhC,uGAAA,WAAW,OAAA;AAEpB,2CAA8G;AAArG,2GAAA,aAAa,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAUvF,uDAA6D;AAApD,2HAAA,uBAAuB,OAAA;AAGhC,iCAqCiB;AApCf,qGAAA,YAAY,OAAA;AACZ,4GAAA,mBAAmB,OAAA;AACnB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,4GAAA,mBAAmB,OAAA;AACnB,gGAAA,OAAO,OAAA;AACP,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAChB,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AAaN,qCAAoC;AAA3B,kGAAA,OAAO,OAAA","sourcesContent":["export { defaultExceptionType } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport { Conventions } from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n"]}