@grafana/faro-core 1.14.0 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/bundle/faro-core.iife.js +1 -1
  2. package/dist/bundle/types/api/ItemBuffer.d.ts +7 -0
  3. package/dist/bundle/types/api/apiTestHelpers.d.ts +11 -0
  4. package/dist/bundle/types/api/const.d.ts +3 -0
  5. package/dist/bundle/types/api/events/initialize.d.ts +13 -2
  6. package/dist/bundle/types/api/events/types.d.ts +11 -0
  7. package/dist/bundle/types/api/exceptions/initialize.d.ts +13 -2
  8. package/dist/bundle/types/api/exceptions/types.d.ts +2 -0
  9. package/dist/bundle/types/api/index.d.ts +3 -1
  10. package/dist/bundle/types/api/initialize.d.ts +3 -1
  11. package/dist/bundle/types/api/logs/initialize.d.ts +13 -2
  12. package/dist/bundle/types/api/logs/types.d.ts +3 -1
  13. package/dist/bundle/types/api/measurements/initialize.d.ts +13 -1
  14. package/dist/bundle/types/api/measurements/types.d.ts +2 -0
  15. package/dist/bundle/types/api/meta/initialize.d.ts +14 -2
  16. package/dist/bundle/types/api/types.d.ts +37 -0
  17. package/dist/bundle/types/api/userActionLifecycleHandler.d.ts +13 -0
  18. package/dist/bundle/types/api/utils.d.ts +2 -0
  19. package/dist/bundle/types/config/types.d.ts +21 -12
  20. package/dist/bundle/types/index.d.ts +4 -4
  21. package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
  22. package/dist/bundle/types/transports/initialize.d.ts +2 -4
  23. package/dist/bundle/types/transports/types.d.ts +0 -1
  24. package/dist/bundle/types/utils/index.d.ts +2 -0
  25. package/dist/bundle/types/utils/reactive.d.ts +46 -0
  26. package/dist/bundle/types/version.d.ts +1 -1
  27. package/dist/cjs/api/ItemBuffer.js +27 -0
  28. package/dist/cjs/api/ItemBuffer.js.map +1 -0
  29. package/dist/cjs/api/apiTestHelpers.js +36 -0
  30. package/dist/cjs/api/apiTestHelpers.js.map +1 -0
  31. package/dist/cjs/api/const.js +7 -0
  32. package/dist/cjs/api/const.js.map +1 -0
  33. package/dist/cjs/api/events/initialize.js +15 -6
  34. package/dist/cjs/api/events/initialize.js.map +1 -1
  35. package/dist/cjs/api/events/types.js.map +1 -1
  36. package/dist/cjs/api/exceptions/initialize.js +59 -37
  37. package/dist/cjs/api/exceptions/initialize.js.map +1 -1
  38. package/dist/cjs/api/exceptions/types.js.map +1 -1
  39. package/dist/cjs/api/index.js +7 -1
  40. package/dist/cjs/api/index.js.map +1 -1
  41. package/dist/cjs/api/initialize.js +16 -2
  42. package/dist/cjs/api/initialize.js.map +1 -1
  43. package/dist/cjs/api/logs/initialize.js +15 -6
  44. package/dist/cjs/api/logs/initialize.js.map +1 -1
  45. package/dist/cjs/api/logs/types.js.map +1 -1
  46. package/dist/cjs/api/measurements/initialize.js +12 -3
  47. package/dist/cjs/api/measurements/initialize.js.map +1 -1
  48. package/dist/cjs/api/measurements/types.js.map +1 -1
  49. package/dist/cjs/api/meta/initialize.js +2 -1
  50. package/dist/cjs/api/meta/initialize.js.map +1 -1
  51. package/dist/cjs/api/types.js.map +1 -1
  52. package/dist/cjs/api/userActionLifecycleHandler.js +59 -0
  53. package/dist/cjs/api/userActionLifecycleHandler.js.map +1 -0
  54. package/dist/cjs/api/utils.js +11 -0
  55. package/dist/cjs/api/utils.js.map +1 -0
  56. package/dist/cjs/config/types.js.map +1 -1
  57. package/dist/cjs/index.js +8 -2
  58. package/dist/cjs/index.js.map +1 -1
  59. package/dist/cjs/transports/initialize.js +1 -35
  60. package/dist/cjs/transports/initialize.js.map +1 -1
  61. package/dist/cjs/transports/registerInitial.js +0 -1
  62. package/dist/cjs/transports/registerInitial.js.map +1 -1
  63. package/dist/cjs/transports/types.js.map +1 -1
  64. package/dist/cjs/utils/index.js +4 -1
  65. package/dist/cjs/utils/index.js.map +1 -1
  66. package/dist/cjs/utils/reactive.js +104 -0
  67. package/dist/cjs/utils/reactive.js.map +1 -0
  68. package/dist/cjs/version.js +1 -1
  69. package/dist/cjs/version.js.map +1 -1
  70. package/dist/esm/api/ItemBuffer.js +21 -0
  71. package/dist/esm/api/ItemBuffer.js.map +1 -0
  72. package/dist/esm/api/apiTestHelpers.js +33 -0
  73. package/dist/esm/api/apiTestHelpers.js.map +1 -0
  74. package/dist/esm/api/const.js +4 -0
  75. package/dist/esm/api/const.js.map +1 -0
  76. package/dist/esm/api/events/initialize.js +15 -7
  77. package/dist/esm/api/events/initialize.js.map +1 -1
  78. package/dist/esm/api/events/types.js.map +1 -1
  79. package/dist/esm/api/exceptions/initialize.js +56 -35
  80. package/dist/esm/api/exceptions/initialize.js.map +1 -1
  81. package/dist/esm/api/exceptions/types.js.map +1 -1
  82. package/dist/esm/api/index.js +2 -0
  83. package/dist/esm/api/index.js.map +1 -1
  84. package/dist/esm/api/initialize.js +15 -1
  85. package/dist/esm/api/initialize.js.map +1 -1
  86. package/dist/esm/api/logs/initialize.js +12 -4
  87. package/dist/esm/api/logs/initialize.js.map +1 -1
  88. package/dist/esm/api/logs/types.js.map +1 -1
  89. package/dist/esm/api/measurements/initialize.js +12 -4
  90. package/dist/esm/api/measurements/initialize.js.map +1 -1
  91. package/dist/esm/api/measurements/types.js.map +1 -1
  92. package/dist/esm/api/meta/initialize.js +1 -1
  93. package/dist/esm/api/meta/initialize.js.map +1 -1
  94. package/dist/esm/api/types.js.map +1 -1
  95. package/dist/esm/api/userActionLifecycleHandler.js +43 -0
  96. package/dist/esm/api/userActionLifecycleHandler.js.map +1 -0
  97. package/dist/esm/api/utils.js +7 -0
  98. package/dist/esm/api/utils.js.map +1 -0
  99. package/dist/esm/config/types.js.map +1 -1
  100. package/dist/esm/index.js +2 -2
  101. package/dist/esm/index.js.map +1 -1
  102. package/dist/esm/transports/initialize.js +0 -28
  103. package/dist/esm/transports/initialize.js.map +1 -1
  104. package/dist/esm/transports/registerInitial.js +0 -1
  105. package/dist/esm/transports/registerInitial.js.map +1 -1
  106. package/dist/esm/transports/types.js.map +1 -1
  107. package/dist/esm/utils/index.js +1 -0
  108. package/dist/esm/utils/index.js.map +1 -1
  109. package/dist/esm/utils/reactive.js +93 -0
  110. package/dist/esm/utils/reactive.js.map +1 -0
  111. package/dist/esm/version.js +1 -1
  112. package/dist/esm/version.js.map +1 -1
  113. package/dist/spec/core/src/api/ItemBuffer.js +27 -0
  114. package/dist/spec/core/src/api/ItemBuffer.js.map +1 -0
  115. package/dist/spec/core/src/api/apiTestHelpers.js +36 -0
  116. package/dist/spec/core/src/api/apiTestHelpers.js.map +1 -0
  117. package/dist/spec/core/src/api/const.js +7 -0
  118. package/dist/spec/core/src/api/const.js.map +1 -0
  119. package/dist/spec/core/src/api/events/initialize.js +15 -6
  120. package/dist/spec/core/src/api/events/initialize.js.map +1 -1
  121. package/dist/spec/core/src/api/events/initialize.test.js +57 -0
  122. package/dist/spec/core/src/api/events/initialize.test.js.map +1 -1
  123. package/dist/spec/core/src/api/events/types.js.map +1 -1
  124. package/dist/spec/core/src/api/exceptions/initialize.js +59 -37
  125. package/dist/spec/core/src/api/exceptions/initialize.js.map +1 -1
  126. package/dist/spec/core/src/api/exceptions/initialize.test.js +83 -3
  127. package/dist/spec/core/src/api/exceptions/initialize.test.js.map +1 -1
  128. package/dist/spec/core/src/api/exceptions/types.js.map +1 -1
  129. package/dist/spec/core/src/api/index.js +7 -1
  130. package/dist/spec/core/src/api/index.js.map +1 -1
  131. package/dist/spec/core/src/api/initialize.js +16 -2
  132. package/dist/spec/core/src/api/initialize.js.map +1 -1
  133. package/dist/spec/core/src/api/initialize.test.js +73 -0
  134. package/dist/spec/core/src/api/initialize.test.js.map +1 -0
  135. package/dist/spec/core/src/api/itemBuffer.test.js +36 -0
  136. package/dist/spec/core/src/api/itemBuffer.test.js.map +1 -0
  137. package/dist/spec/core/src/api/logs/initialize.js +15 -6
  138. package/dist/spec/core/src/api/logs/initialize.js.map +1 -1
  139. package/dist/spec/core/src/api/logs/initialize.test.js +98 -0
  140. package/dist/spec/core/src/api/logs/initialize.test.js.map +1 -1
  141. package/dist/spec/core/src/api/logs/types.js.map +1 -1
  142. package/dist/spec/core/src/api/measurements/initialize.js +12 -3
  143. package/dist/spec/core/src/api/measurements/initialize.js.map +1 -1
  144. package/dist/spec/core/src/api/measurements/initialize.test.js +105 -0
  145. package/dist/spec/core/src/api/measurements/initialize.test.js.map +1 -1
  146. package/dist/spec/core/src/api/measurements/types.js.map +1 -1
  147. package/dist/spec/core/src/api/meta/initialize.js +2 -1
  148. package/dist/spec/core/src/api/meta/initialize.js.map +1 -1
  149. package/dist/spec/core/src/api/meta/initilialize.test.js +1 -3
  150. package/dist/spec/core/src/api/meta/initilialize.test.js.map +1 -1
  151. package/dist/spec/core/src/api/types.js.map +1 -1
  152. package/dist/spec/core/src/api/userActionLifecycleHandler.js +59 -0
  153. package/dist/spec/core/src/api/userActionLifecycleHandler.js.map +1 -0
  154. package/dist/spec/core/src/api/userActionLifecycleHandler.test.js +152 -0
  155. package/dist/spec/core/src/api/userActionLifecycleHandler.test.js.map +1 -0
  156. package/dist/spec/core/src/api/utils.js +11 -0
  157. package/dist/spec/core/src/api/utils.js.map +1 -0
  158. package/dist/spec/core/src/api/utils.test.js +20 -0
  159. package/dist/spec/core/src/api/utils.test.js.map +1 -0
  160. package/dist/spec/core/src/config/types.js.map +1 -1
  161. package/dist/spec/core/src/index.js +8 -2
  162. package/dist/spec/core/src/index.js.map +1 -1
  163. package/dist/spec/core/src/transports/initialize.js +1 -35
  164. package/dist/spec/core/src/transports/initialize.js.map +1 -1
  165. package/dist/spec/core/src/transports/registerInitial.js +0 -1
  166. package/dist/spec/core/src/transports/registerInitial.js.map +1 -1
  167. package/dist/spec/core/src/transports/transports.test.js +0 -16
  168. package/dist/spec/core/src/transports/transports.test.js.map +1 -1
  169. package/dist/spec/core/src/transports/types.js.map +1 -1
  170. package/dist/spec/core/src/utils/index.js +4 -1
  171. package/dist/spec/core/src/utils/index.js.map +1 -1
  172. package/dist/spec/core/src/utils/reactive.js +104 -0
  173. package/dist/spec/core/src/utils/reactive.js.map +1 -0
  174. package/dist/spec/core/src/utils/reactive.test.js +104 -0
  175. package/dist/spec/core/src/utils/reactive.test.js.map +1 -0
  176. package/dist/spec/core/src/version.js +1 -1
  177. package/dist/spec/core/src/version.js.map +1 -1
  178. package/dist/types/api/ItemBuffer.d.ts +7 -0
  179. package/dist/types/api/apiTestHelpers.d.ts +11 -0
  180. package/dist/types/api/const.d.ts +3 -0
  181. package/dist/types/api/events/initialize.d.ts +13 -2
  182. package/dist/types/api/events/types.d.ts +11 -0
  183. package/dist/types/api/exceptions/initialize.d.ts +13 -2
  184. package/dist/types/api/exceptions/types.d.ts +2 -0
  185. package/dist/types/api/index.d.ts +3 -1
  186. package/dist/types/api/initialize.d.ts +3 -1
  187. package/dist/types/api/logs/initialize.d.ts +13 -2
  188. package/dist/types/api/logs/types.d.ts +3 -1
  189. package/dist/types/api/measurements/initialize.d.ts +13 -1
  190. package/dist/types/api/measurements/types.d.ts +2 -0
  191. package/dist/types/api/meta/initialize.d.ts +14 -2
  192. package/dist/types/api/types.d.ts +37 -0
  193. package/dist/types/api/userActionLifecycleHandler.d.ts +13 -0
  194. package/dist/types/api/utils.d.ts +2 -0
  195. package/dist/types/config/types.d.ts +21 -12
  196. package/dist/types/core/src/api/ItemBuffer.d.ts +7 -0
  197. package/dist/types/core/src/api/apiTestHelpers.d.ts +11 -0
  198. package/dist/types/core/src/api/const.d.ts +3 -0
  199. package/dist/types/core/src/api/events/initialize.d.ts +13 -2
  200. package/dist/types/core/src/api/events/types.d.ts +11 -0
  201. package/dist/types/core/src/api/exceptions/initialize.d.ts +13 -2
  202. package/dist/types/core/src/api/exceptions/types.d.ts +2 -0
  203. package/dist/types/core/src/api/index.d.ts +3 -1
  204. package/dist/types/core/src/api/initialize.d.ts +3 -1
  205. package/dist/types/core/src/api/initialize.test.d.ts +1 -0
  206. package/dist/types/core/src/api/itemBuffer.test.d.ts +1 -0
  207. package/dist/types/core/src/api/logs/initialize.d.ts +13 -2
  208. package/dist/types/core/src/api/logs/types.d.ts +3 -1
  209. package/dist/types/core/src/api/measurements/initialize.d.ts +13 -1
  210. package/dist/types/core/src/api/measurements/types.d.ts +2 -0
  211. package/dist/types/core/src/api/meta/initialize.d.ts +14 -2
  212. package/dist/types/core/src/api/types.d.ts +37 -0
  213. package/dist/types/core/src/api/userActionLifecycleHandler.d.ts +13 -0
  214. package/dist/types/core/src/api/userActionLifecycleHandler.test.d.ts +1 -0
  215. package/dist/types/core/src/api/utils.d.ts +2 -0
  216. package/dist/types/core/src/api/utils.test.d.ts +1 -0
  217. package/dist/types/core/src/config/types.d.ts +21 -12
  218. package/dist/types/core/src/index.d.ts +4 -4
  219. package/dist/types/core/src/testUtils/mockTransport.d.ts +1 -1
  220. package/dist/types/core/src/transports/initialize.d.ts +2 -4
  221. package/dist/types/core/src/transports/types.d.ts +0 -1
  222. package/dist/types/core/src/utils/index.d.ts +2 -0
  223. package/dist/types/core/src/utils/reactive.d.ts +46 -0
  224. package/dist/types/core/src/utils/reactive.test.d.ts +1 -0
  225. package/dist/types/core/src/version.d.ts +1 -1
  226. package/dist/types/index.d.ts +4 -4
  227. package/dist/types/testUtils/mockTransport.d.ts +1 -1
  228. package/dist/types/transports/initialize.d.ts +2 -4
  229. package/dist/types/transports/types.d.ts +0 -1
  230. package/dist/types/utils/index.d.ts +2 -0
  231. package/dist/types/utils/reactive.d.ts +46 -0
  232. package/dist/types/version.d.ts +1 -1
  233. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6BAAmG;AAA1F,2GAAA,oBAAoB,OAAA;AAAE,+GAAA,wBAAwB,OAAA;AAAE,iHAAA,0BAA0B,OAAA;AA8BnF,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAGtB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,2CAA8C;AAArC,4GAAA,cAAc,OA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AAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,sHAAA,6BAA6B,OAAA;AAC7B,8GAAA,qBAAqB,OAAA;AACrB,8GAAA,qBAAqB,OAAA;AAavB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n stringifyObjectValues,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6BAQe;AAPb,2GAAA,oBAAoB,OAAA;AACpB,+GAAA,wBAAwB,OAAA;AACxB,iHAAA,0BAA0B,OAAA;AAC1B,oGAAA,aA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AA;AACV,qGAAA,YAAY,OAAA;AACZ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,sHAAA,6BAA6B,OAAA;AAC7B,8GAAA,qBAAqB,OAAA;AACrB,8GAAA,qBAAqB,OAAA;AACrB,mGAAA,UAAU,OAAA;AACV,8FAAA,KAAK,OAAA;AAcP,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export {\n defaultExceptionType,\n defaultLogArgsSerializer,\n defaultErrorArgsSerializer,\n apiMessageBus,\n USER_ACTION_CANCEL_MESSAGE_TYPE,\n USER_ACTION_END_MESSAGE_TYPE,\n USER_ACTION_START_MESSAGE_TYPE,\n} from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n ApiMessageBusMessages,\n UserActionStartMessage,\n UserActionEndMessage,\n UserActionCancelMessage,\n UserAction,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n stringifyObjectValues,\n Observable,\n merge,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n Subscription,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
@@ -9,29 +9,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
9
  return to.concat(ar || Array.prototype.slice.call(from));
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.initializeTransports = exports.createBeforeSendHookFromIgnorePatterns = exports.shouldIgnoreEvent = void 0;
13
- var utils_1 = require("../utils");
12
+ exports.initializeTransports = void 0;
14
13
  var batchExecutor_1 = require("./batchExecutor");
15
- var const_1 = require("./const");
16
- function shouldIgnoreEvent(patterns, msg) {
17
- return patterns.some(function (pattern) {
18
- return (0, utils_1.isString)(pattern) ? msg.includes(pattern) : !!msg.match(pattern);
19
- });
20
- }
21
- exports.shouldIgnoreEvent = shouldIgnoreEvent;
22
- function createBeforeSendHookFromIgnorePatterns(patterns) {
23
- return function (item) {
24
- if (item.type === const_1.TransportItemType.EXCEPTION && item.payload) {
25
- var evt = item.payload;
26
- var msg = "".concat(evt.type, ": ").concat(evt.value);
27
- if (shouldIgnoreEvent(patterns, msg)) {
28
- return null;
29
- }
30
- }
31
- return item;
32
- };
33
- }
34
- exports.createBeforeSendHookFromIgnorePatterns = createBeforeSendHookFromIgnorePatterns;
35
14
  function initializeTransports(unpatchedConsole, internalLogger, config, metas) {
36
15
  var _a;
37
16
  internalLogger.debug('Initializing transports');
@@ -70,18 +49,6 @@ function initializeTransports(unpatchedConsole, internalLogger, config, metas) {
70
49
  }
71
50
  });
72
51
  };
73
- var addIgnoreErrorsPatterns = function () {
74
- var ignoreErrorsPatterns = [];
75
- for (var _i = 0; _i < arguments.length; _i++) {
76
- ignoreErrorsPatterns[_i] = arguments[_i];
77
- }
78
- internalLogger.debug('Adding ignoreErrorsPatterns\n', ignoreErrorsPatterns);
79
- ignoreErrorsPatterns.forEach(function (ignoreErrorsPattern) {
80
- if (ignoreErrorsPattern) {
81
- beforeSendHooks.push(createBeforeSendHookFromIgnorePatterns(ignoreErrorsPattern));
82
- }
83
- });
84
- };
85
52
  var applyBeforeSendHooks = function (items) {
86
53
  var filteredItems = items;
87
54
  for (var _i = 0, beforeSendHooks_1 = beforeSendHooks; _i < beforeSendHooks_1.length; _i++) {
@@ -191,7 +158,6 @@ function initializeTransports(unpatchedConsole, internalLogger, config, metas) {
191
158
  return {
192
159
  add: add,
193
160
  addBeforeSendHooks: addBeforeSendHooks,
194
- addIgnoreErrorsPatterns: addIgnoreErrorsPatterns,
195
161
  getBeforeSendHooks: getBeforeSendHooks,
196
162
  execute: execute,
197
163
  isPaused: isPaused,
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../../src/transports/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,kCAAoC;AAEpC,iDAAgD;AAChD,iCAA4C;AAG5C,SAAgB,iBAAiB,CAAC,QAAkB,EAAE,GAAW;IAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC,UAAC,OAAO;QAC3B,OAAO,IAAA,gBAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,8CAIC;AAED,SAAgB,sCAAsC,CAAC,QAAkB;IACvE,OAAO,UAAC,IAAmB;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,yBAAiB,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE;YAC7D,IAAM,GAAG,GAAG,IAAI,CAAC,OAAyB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AAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAErE,IAAI,sBAAsB,KAAK,CAAC,CAAC,EAAE;gBACjC,cAAc,CAAC,IAAI,CAAC,sBAAc,iBAAiB,CAAC,IAAI,oBAAgB,CAAC,CAAC;gBAE1E,OAAO;aACR;YAED,UAAU,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,IAAM,qBAAqB,GAAwC;QAAC,iCAA0B;aAA1B,UAA0B,EAA1B,qBAA0B,EAA1B,IAA0B;YAA1B,4CAA0B;;QAC5F,eAAe,CAAC,MAAM,CAAC,UAAC,cAAc,IAAK,OAAA,CAAC,uBAAuB,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAjD,CAAiD,CAAC,CAAC;IAChG,CAAC,CAAC;IAEF,IAAM,OAAO,GAA0B;QACrC,cAAc,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC7C,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,EAAE,CAAC;QAEvB,MAAM,GAAG,KAAK,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,KAAA;QACH,kBAAkB,oBAAA;QAClB,uBAAuB,yBAAA;QACvB,kBAAkB,oBAAA;QAClB,OAAO,SAAA;QACP,QAAQ,UAAA;QACR,KAAK,OAAA;QACL,MAAM,QAAA;QACN,qBAAqB,uBAAA;QACrB,IAAI,UAAU;YACZ,yBAAW,UAAU,QAAE;QACzB,CAAC;QACD,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AAhMD,oDAgMC","sourcesContent":["import type { TransportItem } from '..';\nimport type { ExceptionEvent } from '../api';\nimport type { Config, Patterns } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { isString } from '../utils';\n\nimport { BatchExecutor } from './batchExecutor';\nimport { TransportItemType } from './const';\nimport type { BeforeSendHook, Transport, Transports } from './types';\n\nexport function shouldIgnoreEvent(patterns: Patterns, msg: string): boolean {\n return patterns.some((pattern) => {\n return isString(pattern) ? msg.includes(pattern) : !!msg.match(pattern);\n });\n}\n\nexport function createBeforeSendHookFromIgnorePatterns(patterns: Patterns): BeforeSendHook {\n return (item: TransportItem) => {\n if (item.type === TransportItemType.EXCEPTION && item.payload) {\n const evt = item.payload as ExceptionEvent;\n const msg = `${evt.type}: ${evt.value}`;\n\n if (shouldIgnoreEvent(patterns, msg)) {\n return null;\n }\n }\n\n return item;\n };\n}\n\nexport function initializeTransports(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas\n): Transports {\n internalLogger.debug('Initializing transports');\n\n const transports: Transport[] = [];\n\n let paused = config.paused;\n\n let beforeSendHooks: BeforeSendHook[] = [];\n\n const add: Transports['add'] = (...newTransports) => {\n internalLogger.debug('Adding transports');\n\n newTransports.forEach((newTransport) => {\n internalLogger.debug(`Adding \"${newTransport.name}\" transport`);\n\n const exists = transports.some((existingTransport) => existingTransport === newTransport);\n\n if (exists) {\n internalLogger.warn(`Transport ${newTransport.name} is already added`);\n\n return;\n }\n\n newTransport.unpatchedConsole = unpatchedConsole;\n newTransport.internalLogger = internalLogger;\n newTransport.config = config;\n newTransport.metas = metas;\n\n transports.push(newTransport);\n });\n };\n\n const addBeforeSendHooks: Transports['addBeforeSendHooks'] = (...newBeforeSendHooks) => {\n internalLogger.debug('Adding beforeSendHooks\\n', beforeSendHooks);\n\n newBeforeSendHooks.forEach((beforeSendHook) => {\n if (beforeSendHook) {\n beforeSendHooks.push(beforeSendHook);\n }\n });\n };\n\n const addIgnoreErrorsPatterns: Transports['addIgnoreErrorsPatterns'] = (...ignoreErrorsPatterns) => {\n internalLogger.debug('Adding ignoreErrorsPatterns\\n', ignoreErrorsPatterns);\n\n ignoreErrorsPatterns.forEach((ignoreErrorsPattern) => {\n if (ignoreErrorsPattern) {\n beforeSendHooks.push(createBeforeSendHookFromIgnorePatterns(ignoreErrorsPattern));\n }\n });\n };\n\n const applyBeforeSendHooks = (items: TransportItem[]): TransportItem[] => {\n let filteredItems = items;\n for (const hook of beforeSendHooks) {\n const modified = filteredItems.map(hook).filter(Boolean) as TransportItem[];\n\n if (modified.length === 0) {\n return [];\n }\n\n filteredItems = modified;\n }\n return filteredItems;\n };\n\n const batchedSend = (items: TransportItem[]) => {\n const filteredItems = applyBeforeSendHooks(items);\n\n if (filteredItems.length === 0) {\n return;\n }\n\n for (const transport of transports) {\n internalLogger.debug(`Transporting item using ${transport.name}\\n`, filteredItems);\n if (transport.isBatched()) {\n transport.send(filteredItems);\n }\n }\n };\n\n const instantSend = (item: TransportItem) => {\n // prevent all beforeSend hooks being executed twice if batching is enabled.\n if (config.batching?.enabled && transports.every((transport) => transport.isBatched())) {\n return;\n }\n\n const [filteredItem] = applyBeforeSendHooks([item]);\n\n if (filteredItem === undefined) {\n return;\n }\n\n for (const transport of transports) {\n internalLogger.debug(`Transporting item using ${transport.name}\\n`, filteredItem);\n if (!transport.isBatched()) {\n transport.send(filteredItem);\n } else if (!config.batching?.enabled) {\n transport.send([filteredItem]);\n }\n }\n };\n\n let batchExecutor: BatchExecutor | undefined;\n\n if (config.batching?.enabled) {\n batchExecutor = new BatchExecutor(batchedSend, {\n sendTimeout: config.batching.sendTimeout,\n itemLimit: config.batching.itemLimit,\n paused,\n });\n }\n\n // Send a signal to the appropriate transports\n //\n // 1. If SDK is paused, early return\n // 2. If batching is not enabled send the signal to all transports\n // instantly.\n // 3i. If batching is enabled, enqueue the signal\n // 3ii. Send the signal instantly to all un-batched transports\n const execute: Transports['execute'] = (item) => {\n if (paused) {\n return;\n }\n\n if (config.batching?.enabled) {\n batchExecutor?.addItem(item);\n }\n\n instantSend(item);\n };\n\n const getBeforeSendHooks: Transports['getBeforeSendHooks'] = () => [...beforeSendHooks];\n\n const isPaused: Transports['isPaused'] = () => paused;\n\n const pause: Transports['pause'] = () => {\n internalLogger.debug('Pausing transports');\n batchExecutor?.pause();\n\n paused = true;\n };\n\n const remove: Transports['remove'] = (...transportsToRemove) => {\n internalLogger.debug('Removing transports');\n\n transportsToRemove.forEach((transportToRemove) => {\n internalLogger.debug(`Removing \"${transportToRemove.name}\" transport`);\n\n const existingTransportIndex = transports.indexOf(transportToRemove);\n\n if (existingTransportIndex === -1) {\n internalLogger.warn(`Transport \"${transportToRemove.name}\" is not added`);\n\n return;\n }\n\n transports.splice(existingTransportIndex, 1);\n });\n };\n\n const removeBeforeSendHooks: Transports['removeBeforeSendHooks'] = (...beforeSendHooksToRemove) => {\n beforeSendHooks.filter((beforeSendHook) => !beforeSendHooksToRemove.includes(beforeSendHook));\n };\n\n const unpause: Transports['unpause'] = () => {\n internalLogger.debug('Unpausing transports');\n batchExecutor?.start();\n\n paused = false;\n };\n\n return {\n add,\n addBeforeSendHooks,\n addIgnoreErrorsPatterns,\n getBeforeSendHooks,\n execute,\n isPaused,\n pause,\n remove,\n removeBeforeSendHooks,\n get transports() {\n return [...transports];\n },\n unpause,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../../src/transports/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,iDAAgD;AAGhD,SAAgB,oBAAoB,CAClC,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY;;IAEZ,cAAc,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAEhD,IAAM,UAAU,GAAgB,EAAE,CAAC;IAEnC,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAE3B,IAAI,eAAe,GAAqB,EAAE,CAAC;IAE3C,IAAM,GAAG,GAAsB;QAAC,uBAAgB;aAAhB,UAAgB,EAAhB,qBAAgB,EAAhB,IAAgB;YAAhB,kCAAgB;;QAC9C,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAE1C,aAAa,CAAC,OAAO,CAAC,UAAC,YAAY;YACjC,cAAc,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5C,kBAAkB,CAAC,OAAO,CAAC,UAAC,iBAAiB;YAC3C,cAAc,CAAC,KAAK,CAAC,qBAAa,iBAAiB,CAAC,IAAI,iBAAa,CAAC,CAAC;YAEvE,IAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAErE,IAAI,sBAAsB,KAAK,CAAC,CAAC,EAAE;gBACjC,cAAc,CAAC,IAAI,CAAC,sBAAc,iBAAiB,CAAC,IAAI,oBAAgB,CAAC,CAAC;gBAE1E,OAAO;aACR;YAED,UAAU,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,IAAM,qBAAqB,GAAwC;QAAC,iCAA0B;aAA1B,UAA0B,EAA1B,qBAA0B,EAA1B,IAA0B;YAA1B,4CAA0B;;QAC5F,eAAe,CAAC,MAAM,CAAC,UAAC,cAAc,IAAK,OAAA,CAAC,uBAAuB,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAjD,CAAiD,CAAC,CAAC;IAChG,CAAC,CAAC;IAEF,IAAM,OAAO,GAA0B;QACrC,cAAc,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC7C,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,EAAE,CAAC;QAEvB,MAAM,GAAG,KAAK,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,KAAA;QACH,kBAAkB,oBAAA;QAClB,kBAAkB,oBAAA;QAClB,OAAO,SAAA;QACP,QAAQ,UAAA;QACR,KAAK,OAAA;QACL,MAAM,QAAA;QACN,qBAAqB,uBAAA;QACrB,IAAI,UAAU;YACZ,yBAAW,UAAU,QAAE;QACzB,CAAC;QACD,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AArLD,oDAqLC","sourcesContent":["import type { TransportItem } from '..';\nimport type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { BatchExecutor } from './batchExecutor';\nimport type { BeforeSendHook, Transport, Transports } from './types';\n\nexport function initializeTransports(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas\n): Transports {\n internalLogger.debug('Initializing transports');\n\n const transports: Transport[] = [];\n\n let paused = config.paused;\n\n let beforeSendHooks: BeforeSendHook[] = [];\n\n const add: Transports['add'] = (...newTransports) => {\n internalLogger.debug('Adding transports');\n\n newTransports.forEach((newTransport) => {\n internalLogger.debug(`Adding \"${newTransport.name}\" transport`);\n\n const exists = transports.some((existingTransport) => existingTransport === newTransport);\n\n if (exists) {\n internalLogger.warn(`Transport ${newTransport.name} is already added`);\n\n return;\n }\n\n newTransport.unpatchedConsole = unpatchedConsole;\n newTransport.internalLogger = internalLogger;\n newTransport.config = config;\n newTransport.metas = metas;\n\n transports.push(newTransport);\n });\n };\n\n const addBeforeSendHooks: Transports['addBeforeSendHooks'] = (...newBeforeSendHooks) => {\n internalLogger.debug('Adding beforeSendHooks\\n', beforeSendHooks);\n\n newBeforeSendHooks.forEach((beforeSendHook) => {\n if (beforeSendHook) {\n beforeSendHooks.push(beforeSendHook);\n }\n });\n };\n\n const applyBeforeSendHooks = (items: TransportItem[]): TransportItem[] => {\n let filteredItems = items;\n for (const hook of beforeSendHooks) {\n const modified = filteredItems.map(hook).filter(Boolean) as TransportItem[];\n\n if (modified.length === 0) {\n return [];\n }\n\n filteredItems = modified;\n }\n return filteredItems;\n };\n\n const batchedSend = (items: TransportItem[]) => {\n const filteredItems = applyBeforeSendHooks(items);\n\n if (filteredItems.length === 0) {\n return;\n }\n\n for (const transport of transports) {\n internalLogger.debug(`Transporting item using ${transport.name}\\n`, filteredItems);\n if (transport.isBatched()) {\n transport.send(filteredItems);\n }\n }\n };\n\n const instantSend = (item: TransportItem) => {\n // prevent all beforeSend hooks being executed twice if batching is enabled.\n if (config.batching?.enabled && transports.every((transport) => transport.isBatched())) {\n return;\n }\n\n const [filteredItem] = applyBeforeSendHooks([item]);\n\n if (filteredItem === undefined) {\n return;\n }\n\n for (const transport of transports) {\n internalLogger.debug(`Transporting item using ${transport.name}\\n`, filteredItem);\n if (!transport.isBatched()) {\n transport.send(filteredItem);\n } else if (!config.batching?.enabled) {\n transport.send([filteredItem]);\n }\n }\n };\n\n let batchExecutor: BatchExecutor | undefined;\n\n if (config.batching?.enabled) {\n batchExecutor = new BatchExecutor(batchedSend, {\n sendTimeout: config.batching.sendTimeout,\n itemLimit: config.batching.itemLimit,\n paused,\n });\n }\n\n // Send a signal to the appropriate transports\n //\n // 1. If SDK is paused, early return\n // 2. If batching is not enabled send the signal to all transports\n // instantly.\n // 3i. If batching is enabled, enqueue the signal\n // 3ii. Send the signal instantly to all un-batched transports\n const execute: Transports['execute'] = (item) => {\n if (paused) {\n return;\n }\n\n if (config.batching?.enabled) {\n batchExecutor?.addItem(item);\n }\n\n instantSend(item);\n };\n\n const getBeforeSendHooks: Transports['getBeforeSendHooks'] = () => [...beforeSendHooks];\n\n const isPaused: Transports['isPaused'] = () => paused;\n\n const pause: Transports['pause'] = () => {\n internalLogger.debug('Pausing transports');\n batchExecutor?.pause();\n\n paused = true;\n };\n\n const remove: Transports['remove'] = (...transportsToRemove) => {\n internalLogger.debug('Removing transports');\n\n transportsToRemove.forEach((transportToRemove) => {\n internalLogger.debug(`Removing \"${transportToRemove.name}\" transport`);\n\n const existingTransportIndex = transports.indexOf(transportToRemove);\n\n if (existingTransportIndex === -1) {\n internalLogger.warn(`Transport \"${transportToRemove.name}\" is not added`);\n\n return;\n }\n\n transports.splice(existingTransportIndex, 1);\n });\n };\n\n const removeBeforeSendHooks: Transports['removeBeforeSendHooks'] = (...beforeSendHooksToRemove) => {\n beforeSendHooks.filter((beforeSendHook) => !beforeSendHooksToRemove.includes(beforeSendHook));\n };\n\n const unpause: Transports['unpause'] = () => {\n internalLogger.debug('Unpausing transports');\n batchExecutor?.start();\n\n paused = false;\n };\n\n return {\n add,\n addBeforeSendHooks,\n getBeforeSendHooks,\n execute,\n isPaused,\n pause,\n remove,\n removeBeforeSendHooks,\n get transports() {\n return [...transports];\n },\n unpause,\n };\n}\n"]}
@@ -5,7 +5,6 @@ function registerInitialTransports(faro) {
5
5
  var _a;
6
6
  (_a = faro.transports).add.apply(_a, faro.config.transports);
7
7
  faro.transports.addBeforeSendHooks(faro.config.beforeSend);
8
- faro.transports.addIgnoreErrorsPatterns(faro.config.ignoreErrors);
9
8
  }
10
9
  exports.registerInitialTransports = registerInitialTransports;
11
10
  //# sourceMappingURL=registerInitial.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../../../src/transports/registerInitial.ts"],"names":[],"mappings":";;;AAEA,SAAgB,yBAAyB,CAAC,IAAU;;IAClD,CAAA,KAAA,IAAI,CAAC,UAAU,CAAA,CAAC,GAAG,WAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;IAC/C,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC;AAJD,8DAIC","sourcesContent":["import type { Faro } from '../sdk';\n\nexport function registerInitialTransports(faro: Faro): void {\n faro.transports.add(...faro.config.transports);\n faro.transports.addBeforeSendHooks(faro.config.beforeSend);\n faro.transports.addIgnoreErrorsPatterns(faro.config.ignoreErrors);\n}\n"]}
1
+ {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../../../src/transports/registerInitial.ts"],"names":[],"mappings":";;;AAEA,SAAgB,yBAAyB,CAAC,IAAU;;IAClD,CAAA,KAAA,IAAI,CAAC,UAAU,CAAA,CAAC,GAAG,WAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;IAC/C,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC7D,CAAC;AAHD,8DAGC","sourcesContent":["import type { Faro } from '../sdk';\n\nexport function registerInitialTransports(faro: Faro): void {\n faro.transports.add(...faro.config.transports);\n faro.transports.addBeforeSendHooks(faro.config.beforeSend);\n}\n"]}
@@ -67,22 +67,6 @@ var MockTransport = /** @class */ (function (_super) {
67
67
  }(base_1.BaseTransport));
68
68
  var sendMock = jest.spyOn(MockTransport.prototype, 'send');
69
69
  describe('transports', function () {
70
- describe('config.ignoreErrors', function () {
71
- it('will filter out errors by string or regex', function () {
72
- var _a;
73
- var transport = new MockTransport();
74
- var transports = (0, initialize_1.initializeFaro)((0, testUtils_1.mockConfig)({
75
- transports: [transport],
76
- ignoreErrors: ['Error: ResizeObserver', /FetchError[:\s\w\/]*pwc/],
77
- })).transports;
78
- transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));
79
- transports.execute(makeExceptionTransportItem('TypeError', '_.viz is undefined'));
80
- transports.execute(makeExceptionTransportItem('FetchError', '404 \n Instantiating https://pwc.grafana.net/public/react-router-dom'));
81
- transports.execute(makeExceptionTransportItem('FetchError', '404 \n Instantiating https://pwc.grafana.net/public/@emotion/css'));
82
- expect(transport.sentItems).toHaveLength(1);
83
- expect(((_a = transport.sentItems[0]) === null || _a === void 0 ? void 0 : _a.payload).type).toEqual('TypeError');
84
- });
85
- });
86
70
  describe('config.beforeSend', function () {
87
71
  it('will not send events that are rejected by beforeSend hook', function () {
88
72
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"transports.test.js","sourceRoot":"","sources":["../../../../../src/transports/transports.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,4CAA+C;AAC/C,0CAA0C;AAC1C,kCAA+C;AAC/C,sCAAqC;AAErC,+BAAuC;AACvC,iCAA4C;AAG5C;IAAkC,uCAAa;IAA/C;QAAA,qEASC;QARU,UAAI,GAAG,yBAAyB,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AAE,QAAQ,CAAC,CAAC;YAC5D,IAAM,KAAK,GAAG,0BAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAE5D,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC1B,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAE5B,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAS,0BAA0B,CAAC,IAAY,EAAE,KAAa;IAC7D,OAAO;QACL,IAAI,EAAE,yBAAiB,CAAC,SAAS;QACjC,OAAO,EAAE;YACP,IAAI,MAAA;YACJ,KAAK,OAAA;YACL,SAAS,EAAE,IAAA,2BAAmB,GAAE;YAChC,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE;aACX;SACF;QACD,IAAI,EAAE,EAAE;KACT,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @jest-environment jsdom\n */\nimport type { ExceptionEvent } from '../api';\nimport { initializeFaro } from '../initialize';\nimport { mockConfig } from '../testUtils';\nimport { getCurrentTimestamp } from '../utils';\nimport { VERSION } from '../version';\n\nimport { BaseTransport } from './base';\nimport { TransportItemType } from './const';\nimport type { Transport, TransportItem } from './types';\n\nclass MockSingleTransport extends BaseTransport implements Transport {\n readonly name = '@grafana/transport-mock';\n readonly version = VERSION;\n\n sentItems: TransportItem[] = [];\n\n send(item: TransportItem): void | Promise<void> {\n this.sentItems.push(item);\n }\n}\n\nconst sendSingleMock = jest.spyOn(MockSingleTransport.prototype, 'send');\n\nclass MockTransport extends BaseTransport implements Transport {\n readonly name = '@grafana/transport-single-mock';\n readonly version = VERSION;\n\n sentItems: TransportItem[] = [];\n\n send(items: TransportItem[]): void | Promise<void> {\n this.sentItems.push(...items);\n }\n\n override isBatched(): boolean {\n return true;\n }\n}\n\nconst sendMock = jest.spyOn(MockTransport.prototype, 'send');\n\ndescribe('transports', () => {\n describe('config.ignoreErrors', () => {\n it('will filter out errors by string or regex', () => {\n const transport = new MockTransport();\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport],\n ignoreErrors: ['Error: ResizeObserver', /FetchError[:\\s\\w\\/]*pwc/],\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n transports.execute(makeExceptionTransportItem('TypeError', '_.viz is undefined'));\n transports.execute(\n makeExceptionTransportItem(\n 'FetchError',\n '404 \\n Instantiating https://pwc.grafana.net/public/react-router-dom'\n )\n );\n transports.execute(\n makeExceptionTransportItem('FetchError', '404 \\n Instantiating https://pwc.grafana.net/public/@emotion/css')\n );\n expect(transport.sentItems).toHaveLength(1);\n expect((transport.sentItems[0]?.payload as ErrorEvent).type).toEqual('TypeError');\n });\n });\n\n describe('config.beforeSend', () => {\n it('will not send events that are rejected by beforeSend hook', () => {\n const transport = new MockTransport();\n const hookedItems: TransportItem[] = [];\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport],\n beforeSend: (item: TransportItem) => {\n hookedItems.push(item);\n\n if (item.type === TransportItemType.EXCEPTION && (item.payload as ErrorEvent).type === 'TypeError') {\n return null;\n }\n\n return item;\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n transports.execute(makeExceptionTransportItem('TypeError', '_.viz is undefined'));\n\n expect(transport.sentItems).toHaveLength(1);\n expect(hookedItems).toHaveLength(2);\n expect((transport.sentItems[0]?.payload as ErrorEvent).type).toEqual('Error');\n });\n\n it('events can be modified by beforeSend hook', () => {\n const transport = new MockTransport();\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport],\n beforeSend: (item: TransportItem) => {\n if (item.type === TransportItemType.EXCEPTION) {\n return {\n ...item,\n payload: {\n ...item.payload,\n type: 'NewType',\n },\n };\n }\n return item;\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(transport.sentItems).toHaveLength(1);\n expect((transport.sentItems[0]?.payload as ErrorEvent).type).toEqual('NewType');\n });\n\n it('Only call beforeSentHooks once in batched mode.', () => {\n const transport = new MockTransport();\n\n const mockBeforeSend = jest.fn((item) => item);\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport],\n beforeSend: mockBeforeSend,\n batching: {\n enabled: true,\n sendTimeout: 1,\n itemLimit: 1,\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(mockBeforeSend).toHaveBeenCalledTimes(1);\n });\n\n it('Call beforeSentHooks two times if in batched mode but with an existing transport which is not batched', () => {\n const transport = new MockTransport();\n\n const nonBachedTransport = new MockTransport();\n nonBachedTransport.isBatched = () => false;\n (nonBachedTransport.name as any) = 'non-batched-transport';\n\n const mockBeforeSend = jest.fn((item) => item);\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport, nonBachedTransport],\n beforeSend: mockBeforeSend,\n batching: {\n enabled: true,\n sendTimeout: 1,\n itemLimit: 1,\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(mockBeforeSend).toHaveBeenCalledTimes(2);\n });\n });\n\n describe('multiple transports of the same type', () => {\n const transport1 = new MockTransport();\n const transport2 = new MockTransport();\n\n const { transports } = initializeFaro(\n mockConfig({\n isolate: true,\n instrumentations: [],\n transports: [transport1, transport2],\n })\n );\n\n it('will all be added and receive events', () => {\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(transport1.sentItems).toHaveLength(1);\n expect(transport2.sentItems).toHaveLength(1);\n });\n\n it('one of them can be removed by instance', () => {\n transports.remove(transport1);\n transports.execute(makeExceptionTransportItem('Error', 'Kaboom'));\n expect(transport1.sentItems).toHaveLength(1);\n expect(transport2.sentItems).toHaveLength(2);\n });\n });\n\n describe('test batched transports and single item ones', () => {\n beforeAll(() => {\n jest.useFakeTimers();\n });\n\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n it('single item transports with batching enabled', () => {\n const transport = new MockSingleTransport();\n const { transports } = initializeFaro(\n mockConfig({\n isolate: true,\n instrumentations: [],\n transports: [transport],\n batching: {\n enabled: true,\n sendTimeout: 1,\n },\n })\n );\n\n const item1 = makeExceptionTransportItem('Error', 'Kaboom');\n const item2 = makeExceptionTransportItem('Error', 'Kaboom');\n\n transports.execute(item1);\n transports.execute(item2);\n jest.advanceTimersByTime(1);\n\n expect(sendSingleMock).toHaveBeenCalledTimes(2);\n expect(sendSingleMock.mock.calls).toEqual([[item1], [item2]]);\n });\n\n it('multiple item transports', () => {\n const transport = new MockTransport();\n const { transports } = initializeFaro(\n mockConfig({\n isolate: true,\n instrumentations: [],\n transports: [transport],\n batching: {\n enabled: true,\n sendTimeout: 1,\n },\n })\n );\n\n const item1 = makeExceptionTransportItem('Error', 'Kaboom');\n const item2 = makeExceptionTransportItem('Error', 'Kaboom');\n\n transports.execute(item1);\n transports.execute(item2);\n jest.advanceTimersByTime(1);\n\n expect(sendMock).toHaveBeenCalledWith([item1, item2]);\n });\n });\n});\n\nfunction makeExceptionTransportItem(type: string, value: string): TransportItem<ExceptionEvent> {\n return {\n type: TransportItemType.EXCEPTION,\n payload: {\n type,\n value,\n timestamp: getCurrentTimestamp(),\n stacktrace: {\n frames: [],\n },\n },\n meta: {},\n };\n}\n"]}
1
+ {"version":3,"file":"transports.test.js","sourceRoot":"","sources":["../../../../../src/transports/transports.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,4CAA+C;AAC/C,0CAA0C;AAC1C,kCAA+C;AAC/C,sCAAqC;AAErC,+BAAuC;AACvC,iCAA4C;AAG5C;IAAkC,uCAAa;IAA/C;QAAA,qEASC;QARU,UAAI,GAAG,yBAAyB,CAAC;QACjC,aAAO,GAAG,i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CAAC;YAC9B,IAAA,UAAU,GAAK,IAAA,2BAAc,EACnC,IAAA,sBAAU,EAAC;gBACT,OAAO,EAAE,IAAI;gBACb,gBAAgB,EAAE,EAAE;gBACpB,UAAU,EAAE,CAAC,SAAS,CAAC;gBACvB,QAAQ,EAAE;oBACR,OAAO,EAAE,IAAI;oBACb,WAAW,EAAE,CAAC;iBACf;aACF,CAAC,CACH,WAViB,CAUhB;YAEF,IAAM,KAAK,GAAG,0BAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC5D,IAAM,KAAK,GAAG,0BAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAE5D,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC1B,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAE5B,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAS,0BAA0B,CAAC,IAAY,EAAE,KAAa;IAC7D,OAAO;QACL,IAAI,EAAE,yBAAiB,CAAC,SAAS;QACjC,OAAO,EAAE;YACP,IAAI,MAAA;YACJ,KAAK,OAAA;YACL,SAAS,EAAE,IAAA,2BAAmB,GAAE;YAChC,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE;aACX;SACF;QACD,IAAI,EAAE,EAAE;KACT,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @jest-environment jsdom\n */\nimport type { ExceptionEvent } from '../api';\nimport { initializeFaro } from '../initialize';\nimport { mockConfig } from '../testUtils';\nimport { getCurrentTimestamp } from '../utils';\nimport { VERSION } from '../version';\n\nimport { BaseTransport } from './base';\nimport { TransportItemType } from './const';\nimport type { Transport, TransportItem } from './types';\n\nclass MockSingleTransport extends BaseTransport implements Transport {\n readonly name = '@grafana/transport-mock';\n readonly version = VERSION;\n\n sentItems: TransportItem[] = [];\n\n send(item: TransportItem): void | Promise<void> {\n this.sentItems.push(item);\n }\n}\n\nconst sendSingleMock = jest.spyOn(MockSingleTransport.prototype, 'send');\n\nclass MockTransport extends BaseTransport implements Transport {\n readonly name = '@grafana/transport-single-mock';\n readonly version = VERSION;\n\n sentItems: TransportItem[] = [];\n\n send(items: TransportItem[]): void | Promise<void> {\n this.sentItems.push(...items);\n }\n\n override isBatched(): boolean {\n return true;\n }\n}\n\nconst sendMock = jest.spyOn(MockTransport.prototype, 'send');\n\ndescribe('transports', () => {\n describe('config.beforeSend', () => {\n it('will not send events that are rejected by beforeSend hook', () => {\n const transport = new MockTransport();\n const hookedItems: TransportItem[] = [];\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport],\n beforeSend: (item: TransportItem) => {\n hookedItems.push(item);\n\n if (item.type === TransportItemType.EXCEPTION && (item.payload as ErrorEvent).type === 'TypeError') {\n return null;\n }\n\n return item;\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n transports.execute(makeExceptionTransportItem('TypeError', '_.viz is undefined'));\n\n expect(transport.sentItems).toHaveLength(1);\n expect(hookedItems).toHaveLength(2);\n expect((transport.sentItems[0]?.payload as ErrorEvent).type).toEqual('Error');\n });\n\n it('events can be modified by beforeSend hook', () => {\n const transport = new MockTransport();\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport],\n beforeSend: (item: TransportItem) => {\n if (item.type === TransportItemType.EXCEPTION) {\n return {\n ...item,\n payload: {\n ...item.payload,\n type: 'NewType',\n },\n };\n }\n return item;\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(transport.sentItems).toHaveLength(1);\n expect((transport.sentItems[0]?.payload as ErrorEvent).type).toEqual('NewType');\n });\n\n it('Only call beforeSentHooks once in batched mode.', () => {\n const transport = new MockTransport();\n\n const mockBeforeSend = jest.fn((item) => item);\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport],\n beforeSend: mockBeforeSend,\n batching: {\n enabled: true,\n sendTimeout: 1,\n itemLimit: 1,\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(mockBeforeSend).toHaveBeenCalledTimes(1);\n });\n\n it('Call beforeSentHooks two times if in batched mode but with an existing transport which is not batched', () => {\n const transport = new MockTransport();\n\n const nonBachedTransport = new MockTransport();\n nonBachedTransport.isBatched = () => false;\n (nonBachedTransport.name as any) = 'non-batched-transport';\n\n const mockBeforeSend = jest.fn((item) => item);\n\n const { transports } = initializeFaro(\n mockConfig({\n transports: [transport, nonBachedTransport],\n beforeSend: mockBeforeSend,\n batching: {\n enabled: true,\n sendTimeout: 1,\n itemLimit: 1,\n },\n })\n );\n\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(mockBeforeSend).toHaveBeenCalledTimes(2);\n });\n });\n\n describe('multiple transports of the same type', () => {\n const transport1 = new MockTransport();\n const transport2 = new MockTransport();\n\n const { transports } = initializeFaro(\n mockConfig({\n isolate: true,\n instrumentations: [],\n transports: [transport1, transport2],\n })\n );\n\n it('will all be added and receive events', () => {\n transports.execute(makeExceptionTransportItem('Error', 'ResizeObserver loop limit exceeded'));\n expect(transport1.sentItems).toHaveLength(1);\n expect(transport2.sentItems).toHaveLength(1);\n });\n\n it('one of them can be removed by instance', () => {\n transports.remove(transport1);\n transports.execute(makeExceptionTransportItem('Error', 'Kaboom'));\n expect(transport1.sentItems).toHaveLength(1);\n expect(transport2.sentItems).toHaveLength(2);\n });\n });\n\n describe('test batched transports and single item ones', () => {\n beforeAll(() => {\n jest.useFakeTimers();\n });\n\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n it('single item transports with batching enabled', () => {\n const transport = new MockSingleTransport();\n const { transports } = initializeFaro(\n mockConfig({\n isolate: true,\n instrumentations: [],\n transports: [transport],\n batching: {\n enabled: true,\n sendTimeout: 1,\n },\n })\n );\n\n const item1 = makeExceptionTransportItem('Error', 'Kaboom');\n const item2 = makeExceptionTransportItem('Error', 'Kaboom');\n\n transports.execute(item1);\n transports.execute(item2);\n jest.advanceTimersByTime(1);\n\n expect(sendSingleMock).toHaveBeenCalledTimes(2);\n expect(sendSingleMock.mock.calls).toEqual([[item1], [item2]]);\n });\n\n it('multiple item transports', () => {\n const transport = new MockTransport();\n const { transports } = initializeFaro(\n mockConfig({\n isolate: true,\n instrumentations: [],\n transports: [transport],\n batching: {\n enabled: true,\n sendTimeout: 1,\n },\n })\n );\n\n const item1 = makeExceptionTransportItem('Error', 'Kaboom');\n const item2 = makeExceptionTransportItem('Error', 'Kaboom');\n\n transports.execute(item1);\n transports.execute(item2);\n jest.advanceTimersByTime(1);\n\n expect(sendMock).toHaveBeenCalledWith([item1, item2]);\n });\n });\n});\n\nfunction makeExceptionTransportItem(type: string, value: string): TransportItem<ExceptionEvent> {\n return {\n type: TransportItemType.EXCEPTION,\n payload: {\n type,\n value,\n timestamp: getCurrentTimestamp(),\n stacktrace: {\n frames: [],\n },\n },\n meta: {},\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, EventEvent, ExceptionEvent, LogEvent, MeasurementEvent, TraceEvent } from '../api';\nimport type { Patterns } from '../config';\nimport type { Extension } from '../extensions';\nimport type { Meta } from '../metas';\n\nimport type { TransportItemType } from './const';\n\nexport type TransportItemPayload<P = APIEvent> = P;\n\nexport type SendFn<P = APIEvent> = (items: Array<TransportItem<P>>) => void;\nexport type BeforeSendHook<P = APIEvent> = (item: TransportItem<P>) => TransportItem<P> | null;\n\nexport interface TransportItem<P = APIEvent> {\n type: TransportItemType;\n payload: TransportItemPayload<P>;\n meta: Meta;\n}\n\nexport interface Transport extends Extension {\n send(items: TransportItem | TransportItem[]): void | Promise<void>;\n\n // returns URLs to be ignored by tracing, to not cause a feedback loop\n getIgnoreUrls(): Patterns;\n // returns wether the transport supports processing of a batches of items\n isBatched(): boolean;\n}\n\nexport type BodyKey = 'exceptions' | 'logs' | 'measurements' | 'traces' | 'events';\n\nexport interface TransportBody {\n meta: Meta;\n\n exceptions?: ExceptionEvent[];\n logs?: LogEvent[];\n measurements?: MeasurementEvent[];\n traces?: TraceEvent;\n events?: EventEvent[];\n}\n\nexport interface Transports {\n add: (...transports: Transport[]) => void;\n addBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n addIgnoreErrorsPatterns: (...ignoreErrorsPatterns: Array<Patterns | undefined>) => void;\n execute: (transportItem: TransportItem) => void;\n getBeforeSendHooks: () => BeforeSendHook[];\n isPaused: () => boolean;\n remove: (...transports: Transport[]) => void;\n removeBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n transports: Transport[];\n pause: () => void;\n unpause: () => void;\n}\n\nexport interface BatchExecutorOptions {\n readonly enabled?: boolean;\n // If no new signal arrives after \"batchSendTimeout\" ms, send the payload. If set to 0, timeout is disabled\n readonly sendTimeout?: number;\n // Buffer \"sendLimit\" is the number of signals before sending the payload\n readonly itemLimit?: number;\n readonly paused?: boolean;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, EventEvent, ExceptionEvent, LogEvent, MeasurementEvent, TraceEvent } from '../api';\nimport type { Patterns } from '../config';\nimport type { Extension } from '../extensions';\nimport type { Meta } from '../metas';\n\nimport type { TransportItemType } from './const';\n\nexport type TransportItemPayload<P = APIEvent> = P;\n\nexport type SendFn<P = APIEvent> = (items: Array<TransportItem<P>>) => void;\nexport type BeforeSendHook<P = APIEvent> = (item: TransportItem<P>) => TransportItem<P> | null;\n\nexport interface TransportItem<P = APIEvent> {\n type: TransportItemType;\n payload: TransportItemPayload<P>;\n meta: Meta;\n}\n\nexport interface Transport extends Extension {\n send(items: TransportItem | TransportItem[]): void | Promise<void>;\n\n // returns URLs to be ignored by tracing, to not cause a feedback loop\n getIgnoreUrls(): Patterns;\n // returns wether the transport supports processing of a batches of items\n isBatched(): boolean;\n}\n\nexport type BodyKey = 'exceptions' | 'logs' | 'measurements' | 'traces' | 'events';\n\nexport interface TransportBody {\n meta: Meta;\n\n exceptions?: ExceptionEvent[];\n logs?: LogEvent[];\n measurements?: MeasurementEvent[];\n traces?: TraceEvent;\n events?: EventEvent[];\n}\n\nexport interface Transports {\n add: (...transports: Transport[]) => void;\n addBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n execute: (transportItem: TransportItem) => void;\n getBeforeSendHooks: () => BeforeSendHook[];\n isPaused: () => boolean;\n remove: (...transports: Transport[]) => void;\n removeBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n transports: Transport[];\n pause: () => void;\n unpause: () => void;\n}\n\nexport interface BatchExecutorOptions {\n readonly enabled?: boolean;\n // If no new signal arrives after \"batchSendTimeout\" ms, send the payload. If set to 0, timeout is disabled\n readonly sendTimeout?: number;\n // Buffer \"sendLimit\" is the number of signals before sending the payload\n readonly itemLimit?: number;\n readonly paused?: boolean;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = void 0;
3
+ exports.merge = exports.Observable = exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = void 0;
4
4
  var deepEqual_1 = require("./deepEqual");
5
5
  Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deepEqual_1.deepEqual; } });
6
6
  var date_1 = require("./date");
@@ -53,4 +53,7 @@ var json_1 = require("./json");
53
53
  Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return json_1.getCircularDependencyReplacer; } });
54
54
  Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return json_1.stringifyExternalJson; } });
55
55
  Object.defineProperty(exports, "stringifyObjectValues", { enumerable: true, get: function () { return json_1.stringifyObjectValues; } });
56
+ var reactive_1 = require("./reactive");
57
+ Object.defineProperty(exports, "Observable", { enumerable: true, get: function () { return reactive_1.Observable; } });
58
+ Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return reactive_1.merge; } });
56
59
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,yCAAwC;AAA/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ey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,2BA8Bc;AA7BZ,6FAAA,OAAO,OAAA;AACP,+FAAA,SAAS,OAAA;AACT,gGAAA,UAAU,OAAA;AACV,oGAAA,cAAc,OAAA;AACd,+FAAA,SAAS,OAAA;AACT,sGAAA,gBAAgB,OAAA;AAChB,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,kGAAA,YAAY,OAAA;AACZ,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,gGAAA,UAAU,OAAA;AACV,kGAAA,YAAY,OAAA;AACZ,2FAAA,KAAK,OAAA;AACL,2FAAA,KAAK,OAAA;AACL,kGAAA,YAAY,OAAA;AACZ,4FAAA,MAAM,OAAA;AACN,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,sGAAA,gBAAgB,OAAA;AAChB,gGAAA,UAAU,OAAA;AACV,gGAAA,UAAU,OAAA;AACV,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,6FAAA,OAAO,OAAA;AAIT,yCAAsE;AAA7D,yGAAA,YAAY,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAEhD,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAG5B,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAEnB,2CAA2C;AAAlC,yGAAA,WAAW,OAAA;AAEpB,+BAAiC;AAAxB,+FAAA,OAAO,OAAA;AAEhB,+BAAqG;AAA5F,qHAAA,6BAA6B,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAEpF,uCAA+C;AAAtC,sGAAA,UAAU,OAAA;AAAE,iGAAA,KAAK,OAAA","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n\nexport { Observable, merge } from './reactive';\nexport type { Subscription } from './reactive';\n"]}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.merge = exports.Observable = void 0;
4
+ var Observable = /** @class */ (function () {
5
+ function Observable() {
6
+ this.subscribers = [];
7
+ }
8
+ /**
9
+ * Subscribes a callback function to the observable.
10
+ * @param callback - The function to call when the observable emits a value.
11
+ * @returns A subscription object with an unsubscribe method to cancel the subscription.
12
+ */
13
+ Observable.prototype.subscribe = function (callback) {
14
+ var _this = this;
15
+ this.subscribers.push(callback);
16
+ return {
17
+ unsubscribe: function () { return _this.unsubscribe(callback); },
18
+ };
19
+ };
20
+ /**
21
+ * Notifies all subscribers with the given data.
22
+ * @param data - The data to emit to all subscribers.
23
+ */
24
+ Observable.prototype.notify = function (data) {
25
+ this.subscribers.forEach(function (callback) { return callback(data); });
26
+ };
27
+ /**
28
+ * Subscribes a callback function to the observable and automatically unsubscribes after the first emission.
29
+ * @param callback - The function to call when the observable emits a value.
30
+ * @returns A subscription object with an unsubscribe method to cancel the subscription.
31
+ */
32
+ Observable.prototype.first = function (callback) {
33
+ var subscription = this.subscribe(function (data) {
34
+ callback(data);
35
+ subscription.unsubscribe();
36
+ });
37
+ return subscription;
38
+ };
39
+ /**
40
+ * Emits values from the source observable until the provided predicate function returns false.
41
+ * @param predicate - A function that evaluates each value emitted by the source observable.
42
+ * @returns A new observable that emits values from the source observable while the predicate returns true.
43
+ */
44
+ Observable.prototype.takeWhile = function (predicate) {
45
+ var result = new Observable();
46
+ var subscription = this.subscribe(function (value) {
47
+ if (predicate(value)) {
48
+ result.notify(value);
49
+ }
50
+ else {
51
+ subscription.unsubscribe();
52
+ }
53
+ });
54
+ return result;
55
+ };
56
+ /**
57
+ * Unsubscribes all subscribers by clearing the subscribers array.
58
+ *
59
+ * @remarks
60
+ * This method sets the `subscribers` array to an empty array, effectively removing all current subscribers.
61
+ */
62
+ Observable.prototype.unsubscribeAll = function () {
63
+ this.subscribers = [];
64
+ };
65
+ Observable.prototype.unsubscribe = function (callback) {
66
+ this.subscribers = this.subscribers.filter(function (sub) { return sub !== callback; });
67
+ };
68
+ return Observable;
69
+ }());
70
+ exports.Observable = Observable;
71
+ /**
72
+ * Merges multiple observables into a single observable.
73
+ *
74
+ * @template T - The type of the values emitted by the observables.
75
+ * @param {...Observable[]} observables - The observables to merge.
76
+ * @returns {Observable} A new observable that emits values from all input observables.
77
+ */
78
+ function merge() {
79
+ var observables = [];
80
+ for (var _i = 0; _i < arguments.length; _i++) {
81
+ observables[_i] = arguments[_i];
82
+ }
83
+ var mainObservable = new Observable();
84
+ var subscriptions = [];
85
+ observables.forEach(function (observable) {
86
+ var subscription = observable.subscribe(function (value) {
87
+ mainObservable.notify(value);
88
+ });
89
+ subscriptions.push(subscription);
90
+ });
91
+ return {
92
+ subscribe: mainObservable.subscribe.bind(mainObservable),
93
+ takeWhile: mainObservable.takeWhile.bind(mainObservable),
94
+ first: mainObservable.first.bind(mainObservable),
95
+ notify: mainObservable.notify.bind(mainObservable),
96
+ unsubscribeAll: function () {
97
+ observables.forEach(function (observable) {
98
+ observable.unsubscribeAll();
99
+ });
100
+ },
101
+ };
102
+ }
103
+ exports.merge = merge;
104
+ //# sourceMappingURL=reactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../../../../src/utils/reactive.ts"],"names":[],"mappings":";;;AAIA;IAGE;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;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,KAAK,QAAQ,EAAhB,CAAgB,CAAC,CAAC;IACxE,CAAC;IACH,iBAAC;AAAD,CAAC,AAzED,IAyEC;AAzEY,gCAAU;AA2EvB;;;;;;GAMG;AACH,SAAgB,KAAK;IAAI,qBAAoC;SAApC,UAAoC,EAApC,qBAAoC,EAApC,IAAoC;QAApC,gCAAoC;;IAC3D,IAAM,cAAc,GAAG,IAAI,UAAU,EAAK,CAAC;IAC3C,IAAM,aAAa,GAAmB,EAAE,CAAC;IAEzC,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;QAC7B,IAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,UAAC,KAAQ;YACjD,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,SAAS,EAAE,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC;QACxD,SAAS,EAAE,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC;QACxD,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC;QAChD,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;QAClD,cAAc,EAAE;YACd,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;gBAC7B,UAAU,CAAC,cAAc,EAAE,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC;KACe,CAAC;AACrB,CAAC;AAtBD,sBAsBC","sourcesContent":["export interface Subscription {\n unsubscribe: () => void;\n}\n\nexport class Observable<T = any> {\n private subscribers: Array<(data: T) => void>;\n\n constructor() {\n this.subscribers = [];\n }\n\n /**\n * Subscribes a callback function to the observable.\n * @param callback - The function to call when the observable emits a value.\n * @returns A subscription object with an unsubscribe method to cancel the subscription.\n */\n subscribe(callback: (data: T) => void): Subscription {\n this.subscribers.push(callback);\n\n return {\n unsubscribe: () => this.unsubscribe(callback),\n };\n }\n\n /**\n * Notifies all subscribers with the given data.\n * @param data - The data to emit to all subscribers.\n */\n notify(data: T): void {\n this.subscribers.forEach((callback) => callback(data));\n }\n\n /**\n * Subscribes a callback function to the observable and automatically unsubscribes after the first emission.\n * @param callback - The function to call when the observable emits a value.\n * @returns A subscription object with an unsubscribe method to cancel the subscription.\n */\n first(callback: (data: T) => void): Subscription {\n const subscription = this.subscribe((data) => {\n callback(data);\n subscription.unsubscribe();\n });\n\n return subscription;\n }\n\n /**\n * Emits values from the source observable until the provided predicate function returns false.\n * @param predicate - A function that evaluates each value emitted by the source observable.\n * @returns A new observable that emits values from the source observable while the predicate returns true.\n */\n takeWhile(predicate: (value: T) => boolean): Observable<T> {\n const result = new Observable<T>();\n const subscription = this.subscribe((value: T) => {\n if (predicate(value)) {\n result.notify(value);\n } else {\n subscription.unsubscribe();\n }\n });\n\n return result;\n }\n\n /**\n * Unsubscribes all subscribers by clearing the subscribers array.\n *\n * @remarks\n * This method sets the `subscribers` array to an empty array, effectively removing all current subscribers.\n */\n unsubscribeAll(): void {\n this.subscribers = [];\n }\n\n private unsubscribe(callback: (data: any) => void): void {\n this.subscribers = this.subscribers.filter((sub) => sub !== callback);\n }\n}\n\n/**\n * Merges multiple observables into a single observable.\n *\n * @template T - The type of the values emitted by the observables.\n * @param {...Observable[]} observables - The observables to merge.\n * @returns {Observable} A new observable that emits values from all input observables.\n */\nexport function merge<T>(...observables: Array<Observable<T>>): Observable<T> {\n const mainObservable = new Observable<T>();\n const subscriptions: Subscription[] = [];\n\n observables.forEach((observable) => {\n const subscription = observable.subscribe((value: T) => {\n mainObservable.notify(value);\n });\n subscriptions.push(subscription);\n });\n\n return {\n subscribe: mainObservable.subscribe.bind(mainObservable),\n takeWhile: mainObservable.takeWhile.bind(mainObservable),\n first: mainObservable.first.bind(mainObservable),\n notify: mainObservable.notify.bind(mainObservable),\n unsubscribeAll: () => {\n observables.forEach((observable) => {\n observable.unsubscribeAll();\n });\n },\n } as Observable<T>;\n}\n"]}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var __1 = require("..");
4
+ describe('Reactive', function () {
5
+ describe('Observable', function () {
6
+ it('Creates an observable, subscribe to it, and emit values', function () {
7
+ var observable = new __1.Observable();
8
+ var callback = jest.fn();
9
+ observable.subscribe(callback);
10
+ observable.notify(1);
11
+ observable.notify(2);
12
+ expect(callback).toHaveBeenCalledTimes(2);
13
+ expect(callback).toHaveBeenNthCalledWith(1, 1);
14
+ expect(callback).toHaveBeenNthCalledWith(2, 2);
15
+ });
16
+ it('Unsubscribes from an observable', function () {
17
+ var observable = new __1.Observable();
18
+ var callback = jest.fn();
19
+ var subscription = observable.subscribe(callback);
20
+ observable.notify(1);
21
+ subscription.unsubscribe();
22
+ observable.notify(2);
23
+ expect(callback).toHaveBeenCalledTimes(1);
24
+ expect(callback).toHaveBeenCalledWith(1);
25
+ });
26
+ it('Unsubscribes all subscriptions from the observable when unsubscribeAll is called', function () {
27
+ var observable = new __1.Observable();
28
+ var callback = jest.fn();
29
+ observable.subscribe(callback);
30
+ observable.subscribe(callback);
31
+ observable.subscribe(callback);
32
+ observable.notify(1);
33
+ observable.unsubscribeAll();
34
+ observable.subscribe(callback);
35
+ observable.subscribe(callback);
36
+ observable.subscribe(callback);
37
+ expect(callback).toHaveBeenCalledTimes(3);
38
+ expect(callback).toHaveBeenCalledWith(1);
39
+ });
40
+ it('takes emitted values until the predicate returns false', function () {
41
+ var observable = new __1.Observable();
42
+ var callback = jest.fn();
43
+ observable.takeWhile(function (value) { return value <= 2; }).subscribe(callback);
44
+ observable.notify(1);
45
+ observable.notify(2);
46
+ observable.notify(3);
47
+ expect(callback).toHaveBeenCalledTimes(2);
48
+ expect(callback).toHaveBeenNthCalledWith(1, 1);
49
+ expect(callback).toHaveBeenNthCalledWith(2, 2);
50
+ });
51
+ it('subscribes to the first emitted value and unsubscribes after', function () {
52
+ var observable = new __1.Observable();
53
+ var callback = jest.fn();
54
+ observable.first(callback);
55
+ observable.notify(1);
56
+ observable.notify(2);
57
+ expect(callback).toHaveBeenCalledTimes(1);
58
+ expect(callback).toHaveBeenCalledWith(1);
59
+ });
60
+ it('unsubscribes a callback from the list of subscribers', function () {
61
+ var observable = new __1.Observable();
62
+ var callback = jest.fn();
63
+ var sub = observable.subscribe(callback);
64
+ observable.notify(1);
65
+ sub.unsubscribe();
66
+ observable.notify(2);
67
+ expect(callback).toHaveBeenCalledTimes(1);
68
+ expect(callback).toHaveBeenCalledWith(1);
69
+ });
70
+ });
71
+ describe('Merge', function () {
72
+ it('Merges multiple observables into a single observable using the merge() function', function () {
73
+ var observable1 = new __1.Observable();
74
+ var observable2 = new __1.Observable();
75
+ var callback = jest.fn();
76
+ (0, __1.merge)(observable1, observable2).subscribe(callback);
77
+ observable1.notify(1);
78
+ observable2.notify('A');
79
+ observable1.notify(2);
80
+ observable2.notify('B');
81
+ expect(callback).toHaveBeenCalledTimes(4);
82
+ expect(callback).toHaveBeenNthCalledWith(1, 1);
83
+ expect(callback).toHaveBeenNthCalledWith(2, 'A');
84
+ expect(callback).toHaveBeenNthCalledWith(3, 2);
85
+ expect(callback).toHaveBeenNthCalledWith(4, 'B');
86
+ });
87
+ it('Unsubscribes from all observables when merge.unsubscribeAll isCalled', function () {
88
+ var observable1 = new __1.Observable();
89
+ var observable2 = new __1.Observable();
90
+ var callback = jest.fn();
91
+ var mergeObserver = (0, __1.merge)(observable1, observable2);
92
+ mergeObserver.subscribe(callback);
93
+ observable1.notify(1);
94
+ observable2.notify(2);
95
+ mergeObserver.unsubscribeAll();
96
+ observable1.notify(3);
97
+ observable2.notify(4);
98
+ expect(callback).toHaveBeenCalledTimes(2);
99
+ expect(callback).toHaveBeenNthCalledWith(1, 1);
100
+ expect(callback).toHaveBeenNthCalledWith(2, 2);
101
+ });
102
+ });
103
+ });
104
+ //# sourceMappingURL=reactive.test.js.map
@@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AAC;YAC/B,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACtB,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAEtB,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { merge, Observable } from '..';\n\ndescribe('Reactive', () => {\n describe('Observable', () => {\n it('Creates an observable, subscribe to it, and emit values', () => {\n const observable = new Observable<number>();\n const callback = jest.fn();\n\n observable.subscribe(callback);\n observable.notify(1);\n observable.notify(2);\n\n expect(callback).toHaveBeenCalledTimes(2);\n expect(callback).toHaveBeenNthCalledWith(1, 1);\n expect(callback).toHaveBeenNthCalledWith(2, 2);\n });\n\n it('Unsubscribes from an observable', () => {\n const observable = new Observable<number>();\n const callback = jest.fn();\n\n const subscription = observable.subscribe(callback);\n observable.notify(1);\n\n subscription.unsubscribe();\n observable.notify(2);\n\n expect(callback).toHaveBeenCalledTimes(1);\n expect(callback).toHaveBeenCalledWith(1);\n });\n\n it('Unsubscribes all subscriptions from the observable when unsubscribeAll is called', () => {\n const observable = new Observable<number>();\n const callback = jest.fn();\n\n observable.subscribe(callback);\n observable.subscribe(callback);\n observable.subscribe(callback);\n\n observable.notify(1);\n observable.unsubscribeAll();\n\n observable.subscribe(callback);\n observable.subscribe(callback);\n observable.subscribe(callback);\n\n expect(callback).toHaveBeenCalledTimes(3);\n expect(callback).toHaveBeenCalledWith(1);\n });\n\n it('takes emitted values until the predicate returns false', () => {\n const observable = new Observable<number>();\n const callback = jest.fn();\n\n observable.takeWhile((value) => value <= 2).subscribe(callback);\n observable.notify(1);\n observable.notify(2);\n observable.notify(3);\n\n expect(callback).toHaveBeenCalledTimes(2);\n expect(callback).toHaveBeenNthCalledWith(1, 1);\n expect(callback).toHaveBeenNthCalledWith(2, 2);\n });\n\n it('subscribes to the first emitted value and unsubscribes after', () => {\n const observable = new Observable<number>();\n const callback = jest.fn();\n\n observable.first(callback);\n observable.notify(1);\n observable.notify(2);\n\n expect(callback).toHaveBeenCalledTimes(1);\n expect(callback).toHaveBeenCalledWith(1);\n });\n\n it('unsubscribes a callback from the list of subscribers', () => {\n const observable = new Observable<number>();\n const callback = jest.fn();\n\n const sub = observable.subscribe(callback);\n observable.notify(1);\n sub.unsubscribe();\n observable.notify(2);\n\n expect(callback).toHaveBeenCalledTimes(1);\n expect(callback).toHaveBeenCalledWith(1);\n });\n });\n\n describe('Merge', () => {\n it('Merges multiple observables into a single observable using the merge() function', () => {\n const observable1 = new Observable<number | string>();\n const observable2 = new Observable<number | string>();\n const callback = jest.fn();\n\n merge(observable1, observable2).subscribe(callback);\n\n observable1.notify(1);\n observable2.notify('A');\n observable1.notify(2);\n observable2.notify('B');\n\n expect(callback).toHaveBeenCalledTimes(4);\n expect(callback).toHaveBeenNthCalledWith(1, 1);\n expect(callback).toHaveBeenNthCalledWith(2, 'A');\n expect(callback).toHaveBeenNthCalledWith(3, 2);\n expect(callback).toHaveBeenNthCalledWith(4, 'B');\n });\n\n it('Unsubscribes from all observables when merge.unsubscribeAll isCalled', () => {\n const observable1 = new Observable<number>();\n const observable2 = new Observable<number>();\n const callback = jest.fn();\n\n const mergeObserver = merge(observable1, observable2);\n mergeObserver.subscribe(callback);\n\n observable1.notify(1);\n observable2.notify(2);\n\n mergeObserver.unsubscribeAll();\n observable1.notify(3);\n observable2.notify(4);\n\n expect(callback).toHaveBeenCalledTimes(2);\n expect(callback).toHaveBeenNthCalledWith(1, 1);\n expect(callback).toHaveBeenNthCalledWith(2, 2);\n });\n });\n});\n"]}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // auto-generated by bin/genVersion.ts
5
- exports.VERSION = '1.14.0';
5
+ exports.VERSION = '1.14.2';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.14.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.14.2';\n"]}
@@ -0,0 +1,7 @@
1
+ export declare class ItemBuffer<T> {
2
+ private buffer;
3
+ constructor();
4
+ addItem(item: T): void;
5
+ flushBuffer(cb?: (item: T) => void): void;
6
+ size(): number;
7
+ }
@@ -0,0 +1,11 @@
1
+ import type { Transports } from '../transports';
2
+ import type { TracesAPI } from './traces/types';
3
+ export declare const mockMetas: {
4
+ add: jest.Mock<any, any, any>;
5
+ remove: jest.Mock<any, any, any>;
6
+ addListener: jest.Mock<any, any, any>;
7
+ removeListener: jest.Mock<any, any, any>;
8
+ value: {};
9
+ };
10
+ export declare const mockTransports: Transports;
11
+ export declare const mockTracesApi: TracesAPI;
@@ -0,0 +1,3 @@
1
+ export declare const USER_ACTION_START_MESSAGE_TYPE = "user-action-start";
2
+ export declare const USER_ACTION_END_MESSAGE_TYPE = "user-action-end";
3
+ export declare const USER_ACTION_CANCEL_MESSAGE_TYPE = "user-action-cancel";
@@ -1,8 +1,19 @@
1
1
  import type { Config } from '../../config';
2
2
  import type { InternalLogger } from '../../internalLogger';
3
3
  import type { Metas } from '../../metas';
4
- import { Transports } from '../../transports';
4
+ import type { TransportItem, Transports } from '../../transports';
5
5
  import type { UnpatchedConsole } from '../../unpatchedConsole';
6
+ import type { ItemBuffer } from '../ItemBuffer';
6
7
  import type { TracesAPI } from '../traces';
8
+ import type { ApiMessageBusMessages } from '../types';
7
9
  import type { EventsAPI } from './types';
8
- export declare function initializeEventsAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, tracesApi: TracesAPI): EventsAPI;
10
+ export declare function initializeEventsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }: {
11
+ unpatchedConsole: UnpatchedConsole;
12
+ internalLogger: InternalLogger;
13
+ config: Config;
14
+ metas: Metas;
15
+ transports: Transports;
16
+ tracesApi: TracesAPI;
17
+ actionBuffer: ItemBuffer<TransportItem>;
18
+ getMessage: () => ApiMessageBusMessages | undefined;
19
+ }): EventsAPI;