@grafana/faro-core 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/faro-core.iife.js +1 -1
- package/dist/bundle/types/extensions/baseExtension.d.ts +1 -1
- package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/bundle/types/version.d.ts +1 -1
- package/dist/cjs/api/ItemBuffer.js +11 -13
- package/dist/cjs/api/ItemBuffer.js.map +1 -1
- package/dist/cjs/api/events/initialize.js +12 -14
- package/dist/cjs/api/events/initialize.js.map +1 -1
- package/dist/cjs/api/exceptions/const.js +3 -3
- package/dist/cjs/api/exceptions/const.js.map +1 -1
- package/dist/cjs/api/exceptions/initialize.js +26 -39
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/api/initialize.js +25 -36
- package/dist/cjs/api/initialize.js.map +1 -1
- package/dist/cjs/api/logs/const.js +10 -12
- package/dist/cjs/api/logs/const.js.map +1 -1
- package/dist/cjs/api/logs/initialize.js +14 -16
- package/dist/cjs/api/logs/initialize.js.map +1 -1
- package/dist/cjs/api/measurements/initialize.js +12 -25
- package/dist/cjs/api/measurements/initialize.js.map +1 -1
- package/dist/cjs/api/meta/initialize.js +29 -41
- package/dist/cjs/api/meta/initialize.js.map +1 -1
- package/dist/cjs/api/traces/initialize.js +17 -17
- package/dist/cjs/api/traces/initialize.js.map +1 -1
- package/dist/cjs/api/userActions/initialize.js +23 -24
- package/dist/cjs/api/userActions/initialize.js.map +1 -1
- package/dist/cjs/api/userActions/userAction.js +48 -80
- package/dist/cjs/api/userActions/userAction.js.map +1 -1
- package/dist/cjs/api/utils.js +2 -2
- package/dist/cjs/api/utils.js.map +1 -1
- package/dist/cjs/extensions/baseExtension.js +17 -47
- package/dist/cjs/extensions/baseExtension.js.map +1 -1
- package/dist/cjs/initialize.js +14 -14
- package/dist/cjs/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/base.js +7 -25
- package/dist/cjs/instrumentations/base.js.map +1 -1
- package/dist/cjs/instrumentations/initialize.js +14 -31
- package/dist/cjs/instrumentations/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/registerInitial.js +1 -2
- package/dist/cjs/instrumentations/registerInitial.js.map +1 -1
- package/dist/cjs/internalLogger/const.js +1 -1
- package/dist/cjs/internalLogger/const.js.map +1 -1
- package/dist/cjs/internalLogger/createInternalLogger.js +13 -40
- package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/cjs/internalLogger/initialize.js +2 -2
- package/dist/cjs/internalLogger/initialize.js.map +1 -1
- package/dist/cjs/metas/initialize.js +18 -26
- package/dist/cjs/metas/initialize.js.map +1 -1
- package/dist/cjs/metas/registerInitial.js +7 -28
- package/dist/cjs/metas/registerInitial.js.map +1 -1
- package/dist/cjs/sdk/faroGlobalObject.js +3 -3
- package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/internalFaroGlobalObject.js +2 -2
- package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/registerFaro.js +9 -9
- package/dist/cjs/sdk/registerFaro.js.map +1 -1
- package/dist/cjs/testUtils/mockConfig.js +6 -18
- package/dist/cjs/testUtils/mockConfig.js.map +1 -1
- package/dist/cjs/testUtils/mockInternalLogger.js +1 -1
- package/dist/cjs/testUtils/mockInternalLogger.js.map +1 -1
- package/dist/cjs/testUtils/mockStacktraceParser.js +5 -5
- package/dist/cjs/testUtils/mockStacktraceParser.js.map +1 -1
- package/dist/cjs/testUtils/mockTransport.js +17 -37
- package/dist/cjs/testUtils/mockTransport.js.map +1 -1
- package/dist/cjs/testUtils/testPromise.js +3 -3
- package/dist/cjs/testUtils/testPromise.js.map +1 -1
- package/dist/cjs/transports/base.js +7 -27
- package/dist/cjs/transports/base.js.map +1 -1
- package/dist/cjs/transports/batchExecutor.js +24 -36
- package/dist/cjs/transports/batchExecutor.js.map +1 -1
- package/dist/cjs/transports/const.js +7 -8
- package/dist/cjs/transports/const.js.map +1 -1
- package/dist/cjs/transports/initialize.js +50 -79
- package/dist/cjs/transports/initialize.js.map +1 -1
- package/dist/cjs/transports/registerInitial.js +1 -2
- package/dist/cjs/transports/registerInitial.js.map +1 -1
- package/dist/cjs/transports/utils.js +13 -34
- package/dist/cjs/transports/utils.js.map +1 -1
- package/dist/cjs/unpatchedConsole/const.js +1 -12
- package/dist/cjs/unpatchedConsole/const.js.map +1 -1
- package/dist/cjs/unpatchedConsole/initialize.js +1 -1
- package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
- package/dist/cjs/utils/deepEqual.js +14 -16
- package/dist/cjs/utils/deepEqual.js.map +1 -1
- package/dist/cjs/utils/is.js +25 -29
- package/dist/cjs/utils/is.js.map +1 -1
- package/dist/cjs/utils/json.js +6 -9
- package/dist/cjs/utils/json.js.map +1 -1
- package/dist/cjs/utils/promiseBuffer.js +14 -14
- package/dist/cjs/utils/promiseBuffer.js.map +1 -1
- package/dist/cjs/utils/reactive.js +43 -50
- package/dist/cjs/utils/reactive.js.map +1 -1
- package/dist/cjs/utils/shortId.js +3 -4
- package/dist/cjs/utils/shortId.js.map +1 -1
- package/dist/cjs/utils/sourceMaps.js +2 -2
- package/dist/cjs/utils/sourceMaps.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/extensions/baseExtension.d.ts +1 -1
- package/dist/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/dist/spec/core/src/api/ItemBuffer.js +0 -27
- package/dist/spec/core/src/api/ItemBuffer.js.map +0 -1
- package/dist/spec/core/src/api/apiTestHelpers.js +0 -40
- package/dist/spec/core/src/api/apiTestHelpers.js.map +0 -1
- package/dist/spec/core/src/api/events/index.js +0 -6
- package/dist/spec/core/src/api/events/index.js.map +0 -1
- package/dist/spec/core/src/api/events/initialize.js +0 -54
- package/dist/spec/core/src/api/events/initialize.js.map +0 -1
- package/dist/spec/core/src/api/events/initialize.test.js +0 -171
- package/dist/spec/core/src/api/events/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/events/types.js +0 -3
- package/dist/spec/core/src/api/events/types.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/const.js +0 -17
- package/dist/spec/core/src/api/exceptions/const.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/index.js +0 -9
- package/dist/spec/core/src/api/exceptions/index.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/initialize.js +0 -104
- package/dist/spec/core/src/api/exceptions/initialize.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/initialize.test.js +0 -317
- package/dist/spec/core/src/api/exceptions/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/types.js +0 -3
- package/dist/spec/core/src/api/exceptions/types.js.map +0 -1
- package/dist/spec/core/src/api/index.js +0 -15
- package/dist/spec/core/src/api/index.js.map +0 -1
- package/dist/spec/core/src/api/initialize.js +0 -56
- package/dist/spec/core/src/api/initialize.js.map +0 -1
- package/dist/spec/core/src/api/initialize.test.js +0 -33
- package/dist/spec/core/src/api/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/itemBuffer.test.js +0 -36
- package/dist/spec/core/src/api/itemBuffer.test.js.map +0 -1
- package/dist/spec/core/src/api/logs/const.js +0 -17
- package/dist/spec/core/src/api/logs/const.js.map +0 -1
- package/dist/spec/core/src/api/logs/index.js +0 -8
- package/dist/spec/core/src/api/logs/index.js.map +0 -1
- package/dist/spec/core/src/api/logs/initialize.js +0 -58
- package/dist/spec/core/src/api/logs/initialize.js.map +0 -1
- package/dist/spec/core/src/api/logs/initialize.test.js +0 -185
- package/dist/spec/core/src/api/logs/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/logs/types.js +0 -3
- package/dist/spec/core/src/api/logs/types.js.map +0 -1
- package/dist/spec/core/src/api/measurements/index.js +0 -6
- package/dist/spec/core/src/api/measurements/index.js.map +0 -1
- package/dist/spec/core/src/api/measurements/initialize.js +0 -60
- package/dist/spec/core/src/api/measurements/initialize.js.map +0 -1
- package/dist/spec/core/src/api/measurements/initialize.test.js +0 -244
- package/dist/spec/core/src/api/measurements/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/measurements/types.js +0 -3
- package/dist/spec/core/src/api/measurements/types.js.map +0 -1
- package/dist/spec/core/src/api/meta/index.js +0 -6
- package/dist/spec/core/src/api/meta/index.js.map +0 -1
- package/dist/spec/core/src/api/meta/initialize.js +0 -92
- package/dist/spec/core/src/api/meta/initialize.js.map +0 -1
- package/dist/spec/core/src/api/meta/initilialize.test.js +0 -135
- package/dist/spec/core/src/api/meta/initilialize.test.js.map +0 -1
- package/dist/spec/core/src/api/meta/types.js +0 -3
- package/dist/spec/core/src/api/meta/types.js.map +0 -1
- package/dist/spec/core/src/api/traces/index.js +0 -6
- package/dist/spec/core/src/api/traces/index.js.map +0 -1
- package/dist/spec/core/src/api/traces/initialize.js +0 -48
- package/dist/spec/core/src/api/traces/initialize.js.map +0 -1
- package/dist/spec/core/src/api/traces/types.js +0 -3
- package/dist/spec/core/src/api/traces/types.js.map +0 -1
- package/dist/spec/core/src/api/types.js +0 -3
- package/dist/spec/core/src/api/types.js.map +0 -1
- package/dist/spec/core/src/api/userActions/const.js +0 -11
- package/dist/spec/core/src/api/userActions/const.js.map +0 -1
- package/dist/spec/core/src/api/userActions/index.js +0 -11
- package/dist/spec/core/src/api/userActions/index.js.map +0 -1
- package/dist/spec/core/src/api/userActions/initialize.js +0 -80
- package/dist/spec/core/src/api/userActions/initialize.js.map +0 -1
- package/dist/spec/core/src/api/userActions/initialize.test.js +0 -82
- package/dist/spec/core/src/api/userActions/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/userActions/types.js +0 -11
- package/dist/spec/core/src/api/userActions/types.js.map +0 -1
- package/dist/spec/core/src/api/userActions/userAction.js +0 -126
- package/dist/spec/core/src/api/userActions/userAction.js.map +0 -1
- package/dist/spec/core/src/api/userActions/userAction.test.js +0 -85
- package/dist/spec/core/src/api/userActions/userAction.test.js.map +0 -1
- package/dist/spec/core/src/api/utils.js +0 -10
- package/dist/spec/core/src/api/utils.js.map +0 -1
- package/dist/spec/core/src/api/utils.test.js +0 -20
- package/dist/spec/core/src/api/utils.test.js.map +0 -1
- package/dist/spec/core/src/config/const.js +0 -10
- package/dist/spec/core/src/config/const.js.map +0 -1
- package/dist/spec/core/src/config/index.js +0 -7
- package/dist/spec/core/src/config/index.js.map +0 -1
- package/dist/spec/core/src/config/types.js +0 -3
- package/dist/spec/core/src/config/types.js.map +0 -1
- package/dist/spec/core/src/consts.js +0 -5
- package/dist/spec/core/src/consts.js.map +0 -1
- package/dist/spec/core/src/extensions/baseExtension.js +0 -57
- package/dist/spec/core/src/extensions/baseExtension.js.map +0 -1
- package/dist/spec/core/src/extensions/index.js +0 -6
- package/dist/spec/core/src/extensions/index.js.map +0 -1
- package/dist/spec/core/src/extensions/types.js +0 -3
- package/dist/spec/core/src/extensions/types.js.map +0 -1
- package/dist/spec/core/src/faro.test.js +0 -40
- package/dist/spec/core/src/faro.test.js.map +0 -1
- package/dist/spec/core/src/globalObject/globalObject.js +0 -12
- package/dist/spec/core/src/globalObject/globalObject.js.map +0 -1
- package/dist/spec/core/src/globalObject/index.js +0 -6
- package/dist/spec/core/src/globalObject/index.js.map +0 -1
- package/dist/spec/core/src/index.js +0 -103
- package/dist/spec/core/src/index.js.map +0 -1
- package/dist/spec/core/src/initialize.js +0 -31
- package/dist/spec/core/src/initialize.js.map +0 -1
- package/dist/spec/core/src/instrumentations/base.js +0 -31
- package/dist/spec/core/src/instrumentations/base.js.map +0 -1
- package/dist/spec/core/src/instrumentations/index.js +0 -10
- package/dist/spec/core/src/instrumentations/index.js.map +0 -1
- package/dist/spec/core/src/instrumentations/initialize.js +0 -70
- package/dist/spec/core/src/instrumentations/initialize.js.map +0 -1
- package/dist/spec/core/src/instrumentations/registerInitial.js +0 -8
- package/dist/spec/core/src/instrumentations/registerInitial.js.map +0 -1
- package/dist/spec/core/src/instrumentations/types.js +0 -3
- package/dist/spec/core/src/instrumentations/types.js.map +0 -1
- package/dist/spec/core/src/internalLogger/const.js +0 -22
- package/dist/spec/core/src/internalLogger/const.js.map +0 -1
- package/dist/spec/core/src/internalLogger/createInternalLogger.js +0 -64
- package/dist/spec/core/src/internalLogger/createInternalLogger.js.map +0 -1
- package/dist/spec/core/src/internalLogger/index.js +0 -13
- package/dist/spec/core/src/internalLogger/index.js.map +0 -1
- package/dist/spec/core/src/internalLogger/initialize.js +0 -12
- package/dist/spec/core/src/internalLogger/initialize.js.map +0 -1
- package/dist/spec/core/src/internalLogger/types.js +0 -3
- package/dist/spec/core/src/internalLogger/types.js.map +0 -1
- package/dist/spec/core/src/metas/index.js +0 -8
- package/dist/spec/core/src/metas/index.js.map +0 -1
- package/dist/spec/core/src/metas/initialize.js +0 -51
- package/dist/spec/core/src/metas/initialize.js.map +0 -1
- package/dist/spec/core/src/metas/initialize.test.js +0 -20
- package/dist/spec/core/src/metas/initialize.test.js.map +0 -1
- package/dist/spec/core/src/metas/registerInitial.js +0 -53
- package/dist/spec/core/src/metas/registerInitial.js.map +0 -1
- package/dist/spec/core/src/metas/types.js +0 -3
- package/dist/spec/core/src/metas/types.js.map +0 -1
- package/dist/spec/core/src/sdk/const.js +0 -5
- package/dist/spec/core/src/sdk/const.js.map +0 -1
- package/dist/spec/core/src/sdk/faroGlobalObject.js +0 -22
- package/dist/spec/core/src/sdk/faroGlobalObject.js.map +0 -1
- package/dist/spec/core/src/sdk/index.js +0 -13
- package/dist/spec/core/src/sdk/index.js.map +0 -1
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js +0 -28
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js.map +0 -1
- package/dist/spec/core/src/sdk/registerFaro.js +0 -25
- package/dist/spec/core/src/sdk/registerFaro.js.map +0 -1
- package/dist/spec/core/src/sdk/types.js +0 -3
- package/dist/spec/core/src/sdk/types.js.map +0 -1
- package/dist/spec/core/src/semantic.js +0 -12
- package/dist/spec/core/src/semantic.js.map +0 -1
- package/dist/spec/core/src/testUtils/index.js +0 -14
- package/dist/spec/core/src/testUtils/index.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockConfig.js +0 -27
- package/dist/spec/core/src/testUtils/mockConfig.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockInternalLogger.js +0 -12
- package/dist/spec/core/src/testUtils/mockInternalLogger.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockStacktraceParser.js +0 -21
- package/dist/spec/core/src/testUtils/mockStacktraceParser.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockTransport.js +0 -45
- package/dist/spec/core/src/testUtils/mockTransport.js.map +0 -1
- package/dist/spec/core/src/testUtils/testPromise.js +0 -14
- package/dist/spec/core/src/testUtils/testPromise.js.map +0 -1
- package/dist/spec/core/src/transports/base.js +0 -34
- package/dist/spec/core/src/transports/base.js.map +0 -1
- package/dist/spec/core/src/transports/batchExecutor.js +0 -82
- package/dist/spec/core/src/transports/batchExecutor.js.map +0 -1
- package/dist/spec/core/src/transports/batchExecutor.test.js +0 -179
- package/dist/spec/core/src/transports/batchExecutor.test.js.map +0 -1
- package/dist/spec/core/src/transports/const.js +0 -20
- package/dist/spec/core/src/transports/const.js.map +0 -1
- package/dist/spec/core/src/transports/index.js +0 -15
- package/dist/spec/core/src/transports/index.js.map +0 -1
- package/dist/spec/core/src/transports/initialize.js +0 -188
- package/dist/spec/core/src/transports/initialize.js.map +0 -1
- package/dist/spec/core/src/transports/registerInitial.js +0 -9
- package/dist/spec/core/src/transports/registerInitial.js.map +0 -1
- package/dist/spec/core/src/transports/transports.test.js +0 -258
- package/dist/spec/core/src/transports/transports.test.js.map +0 -1
- package/dist/spec/core/src/transports/types.js +0 -3
- package/dist/spec/core/src/transports/types.js.map +0 -1
- package/dist/spec/core/src/transports/utils.js +0 -73
- package/dist/spec/core/src/transports/utils.js.map +0 -1
- package/dist/spec/core/src/transports/utils.test.js +0 -216
- package/dist/spec/core/src/transports/utils.test.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/const.js +0 -16
- package/dist/spec/core/src/unpatchedConsole/const.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/index.js +0 -9
- package/dist/spec/core/src/unpatchedConsole/index.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/initialize.js +0 -12
- package/dist/spec/core/src/unpatchedConsole/initialize.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/types.js +0 -3
- package/dist/spec/core/src/unpatchedConsole/types.js.map +0 -1
- package/dist/spec/core/src/utils/baseObject.js +0 -3
- package/dist/spec/core/src/utils/baseObject.js.map +0 -1
- package/dist/spec/core/src/utils/date.js +0 -15
- package/dist/spec/core/src/utils/date.js.map +0 -1
- package/dist/spec/core/src/utils/deepEqual.js +0 -61
- package/dist/spec/core/src/utils/deepEqual.js.map +0 -1
- package/dist/spec/core/src/utils/deepEqual.test.js +0 -103
- package/dist/spec/core/src/utils/deepEqual.test.js.map +0 -1
- package/dist/spec/core/src/utils/index.js +0 -60
- package/dist/spec/core/src/utils/index.js.map +0 -1
- package/dist/spec/core/src/utils/is.js +0 -66
- package/dist/spec/core/src/utils/is.js.map +0 -1
- package/dist/spec/core/src/utils/is.test.js +0 -21
- package/dist/spec/core/src/utils/is.test.js.map +0 -1
- package/dist/spec/core/src/utils/json.js +0 -32
- package/dist/spec/core/src/utils/json.js.map +0 -1
- package/dist/spec/core/src/utils/json.test.js +0 -35
- package/dist/spec/core/src/utils/json.test.js.map +0 -1
- package/dist/spec/core/src/utils/logLevels.js +0 -22
- package/dist/spec/core/src/utils/logLevels.js.map +0 -1
- package/dist/spec/core/src/utils/noop.js +0 -5
- package/dist/spec/core/src/utils/noop.js.map +0 -1
- package/dist/spec/core/src/utils/promiseBuffer.js +0 -42
- package/dist/spec/core/src/utils/promiseBuffer.js.map +0 -1
- package/dist/spec/core/src/utils/promiseBuffer.test.js +0 -146
- package/dist/spec/core/src/utils/promiseBuffer.test.js.map +0 -1
- package/dist/spec/core/src/utils/reactive.js +0 -90
- package/dist/spec/core/src/utils/reactive.js.map +0 -1
- package/dist/spec/core/src/utils/reactive.test.js +0 -117
- package/dist/spec/core/src/utils/reactive.test.js.map +0 -1
- package/dist/spec/core/src/utils/sampling.js +0 -7
- package/dist/spec/core/src/utils/sampling.js.map +0 -1
- package/dist/spec/core/src/utils/sampling.test.js +0 -17
- package/dist/spec/core/src/utils/sampling.test.js.map +0 -1
- package/dist/spec/core/src/utils/shortId.js +0 -11
- package/dist/spec/core/src/utils/shortId.js.map +0 -1
- package/dist/spec/core/src/utils/sourceMaps.js +0 -8
- package/dist/spec/core/src/utils/sourceMaps.js.map +0 -1
- package/dist/spec/core/src/utils/sourceMaps.test.js +0 -17
- package/dist/spec/core/src/utils/sourceMaps.test.js.map +0 -1
- package/dist/spec/core/src/version.js +0 -6
- package/dist/spec/core/src/version.js.map +0 -1
- package/dist/types/core/src/api/ItemBuffer.d.ts +0 -7
- package/dist/types/core/src/api/apiTestHelpers.d.ts +0 -13
- package/dist/types/core/src/api/events/index.d.ts +0 -2
- package/dist/types/core/src/api/events/initialize.d.ts +0 -17
- package/dist/types/core/src/api/events/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/events/types.d.ts +0 -29
- package/dist/types/core/src/api/exceptions/const.d.ts +0 -2
- package/dist/types/core/src/api/exceptions/index.d.ts +0 -3
- package/dist/types/core/src/api/exceptions/initialize.d.ts +0 -17
- package/dist/types/core/src/api/exceptions/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/exceptions/types.d.ts +0 -61
- package/dist/types/core/src/api/index.d.ts +0 -11
- package/dist/types/core/src/api/initialize.d.ts +0 -7
- package/dist/types/core/src/api/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/itemBuffer.test.d.ts +0 -1
- package/dist/types/core/src/api/logs/const.d.ts +0 -2
- package/dist/types/core/src/api/logs/index.d.ts +0 -3
- package/dist/types/core/src/api/logs/initialize.d.ts +0 -17
- package/dist/types/core/src/api/logs/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/logs/types.d.ts +0 -24
- package/dist/types/core/src/api/measurements/index.d.ts +0 -2
- package/dist/types/core/src/api/measurements/initialize.d.ts +0 -17
- package/dist/types/core/src/api/measurements/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/measurements/types.d.ts +0 -25
- package/dist/types/core/src/api/meta/index.d.ts +0 -2
- package/dist/types/core/src/api/meta/initialize.d.ts +0 -15
- package/dist/types/core/src/api/meta/initilialize.test.d.ts +0 -1
- package/dist/types/core/src/api/meta/types.d.ts +0 -21
- package/dist/types/core/src/api/traces/index.d.ts +0 -2
- package/dist/types/core/src/api/traces/initialize.d.ts +0 -7
- package/dist/types/core/src/api/traces/types.d.ts +0 -20
- package/dist/types/core/src/api/types.d.ts +0 -14
- package/dist/types/core/src/api/userActions/const.d.ts +0 -8
- package/dist/types/core/src/api/userActions/index.d.ts +0 -4
- package/dist/types/core/src/api/userActions/initialize.d.ts +0 -21
- package/dist/types/core/src/api/userActions/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/userActions/types.d.ts +0 -55
- package/dist/types/core/src/api/userActions/userAction.d.ts +0 -36
- package/dist/types/core/src/api/userActions/userAction.test.d.ts +0 -1
- package/dist/types/core/src/api/utils.d.ts +0 -2
- package/dist/types/core/src/api/utils.test.d.ts +0 -1
- package/dist/types/core/src/config/const.d.ts +0 -6
- package/dist/types/core/src/config/index.d.ts +0 -2
- package/dist/types/core/src/config/types.d.ts +0 -237
- package/dist/types/core/src/consts.d.ts +0 -1
- package/dist/types/core/src/extensions/baseExtension.d.ts +0 -15
- package/dist/types/core/src/extensions/index.d.ts +0 -2
- package/dist/types/core/src/extensions/types.d.ts +0 -16
- package/dist/types/core/src/faro.test.d.ts +0 -1
- package/dist/types/core/src/globalObject/globalObject.d.ts +0 -6
- package/dist/types/core/src/globalObject/index.d.ts +0 -2
- package/dist/types/core/src/index.d.ts +0 -25
- package/dist/types/core/src/initialize.d.ts +0 -3
- package/dist/types/core/src/instrumentations/base.d.ts +0 -9
- package/dist/types/core/src/instrumentations/index.d.ts +0 -4
- package/dist/types/core/src/instrumentations/initialize.d.ts +0 -8
- package/dist/types/core/src/instrumentations/registerInitial.d.ts +0 -2
- package/dist/types/core/src/instrumentations/types.d.ts +0 -14
- package/dist/types/core/src/internalLogger/const.d.ts +0 -11
- package/dist/types/core/src/internalLogger/createInternalLogger.d.ts +0 -4
- package/dist/types/core/src/internalLogger/index.d.ts +0 -4
- package/dist/types/core/src/internalLogger/initialize.d.ts +0 -5
- package/dist/types/core/src/internalLogger/types.d.ts +0 -7
- package/dist/types/core/src/metas/index.d.ts +0 -3
- package/dist/types/core/src/metas/initialize.d.ts +0 -5
- package/dist/types/core/src/metas/initialize.test.d.ts +0 -1
- package/dist/types/core/src/metas/registerInitial.d.ts +0 -2
- package/dist/types/core/src/metas/types.d.ts +0 -118
- package/dist/types/core/src/sdk/const.d.ts +0 -1
- package/dist/types/core/src/sdk/faroGlobalObject.d.ts +0 -2
- package/dist/types/core/src/sdk/index.d.ts +0 -4
- package/dist/types/core/src/sdk/internalFaroGlobalObject.d.ts +0 -4
- package/dist/types/core/src/sdk/registerFaro.d.ts +0 -10
- package/dist/types/core/src/sdk/types.d.ts +0 -18
- package/dist/types/core/src/semantic.d.ts +0 -8
- package/dist/types/core/src/testUtils/index.d.ts +0 -6
- package/dist/types/core/src/testUtils/mockConfig.d.ts +0 -2
- package/dist/types/core/src/testUtils/mockInternalLogger.d.ts +0 -2
- package/dist/types/core/src/testUtils/mockStacktraceParser.d.ts +0 -2
- package/dist/types/core/src/testUtils/mockTransport.d.ts +0 -13
- package/dist/types/core/src/testUtils/testPromise.d.ts +0 -7
- package/dist/types/core/src/transports/base.d.ts +0 -8
- package/dist/types/core/src/transports/batchExecutor.d.ts +0 -16
- package/dist/types/core/src/transports/batchExecutor.test.d.ts +0 -1
- package/dist/types/core/src/transports/const.d.ts +0 -9
- package/dist/types/core/src/transports/index.d.ts +0 -6
- package/dist/types/core/src/transports/initialize.d.ts +0 -6
- package/dist/types/core/src/transports/registerInitial.d.ts +0 -2
- package/dist/types/core/src/transports/transports.test.d.ts +0 -1
- package/dist/types/core/src/transports/types.d.ts +0 -45
- package/dist/types/core/src/transports/utils.d.ts +0 -5
- package/dist/types/core/src/transports/utils.test.d.ts +0 -1
- package/dist/types/core/src/unpatchedConsole/const.d.ts +0 -2
- package/dist/types/core/src/unpatchedConsole/index.d.ts +0 -3
- package/dist/types/core/src/unpatchedConsole/initialize.d.ts +0 -4
- package/dist/types/core/src/unpatchedConsole/types.d.ts +0 -1
- package/dist/types/core/src/utils/baseObject.d.ts +0 -6
- package/dist/types/core/src/utils/date.d.ts +0 -3
- package/dist/types/core/src/utils/deepEqual.d.ts +0 -1
- package/dist/types/core/src/utils/deepEqual.test.d.ts +0 -1
- package/dist/types/core/src/utils/index.d.ts +0 -16
- package/dist/types/core/src/utils/is.d.ts +0 -32
- package/dist/types/core/src/utils/is.test.d.ts +0 -1
- package/dist/types/core/src/utils/json.d.ts +0 -3
- package/dist/types/core/src/utils/json.test.d.ts +0 -1
- package/dist/types/core/src/utils/logLevels.d.ts +0 -10
- package/dist/types/core/src/utils/noop.d.ts +0 -1
- package/dist/types/core/src/utils/promiseBuffer.d.ts +0 -14
- package/dist/types/core/src/utils/promiseBuffer.test.d.ts +0 -1
- package/dist/types/core/src/utils/reactive.d.ts +0 -17
- package/dist/types/core/src/utils/reactive.test.d.ts +0 -1
- package/dist/types/core/src/utils/sampling.d.ts +0 -1
- package/dist/types/core/src/utils/sampling.test.d.ts +0 -1
- package/dist/types/core/src/utils/shortId.d.ts +0 -1
- package/dist/types/core/src/utils/sourceMaps.d.ts +0 -1
- package/dist/types/core/src/utils/sourceMaps.test.d.ts +0 -1
- package/dist/types/core/src/version.d.ts +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ItemBuffer = void 0;
|
|
4
|
-
var is_1 = require("../utils/is");
|
|
5
|
-
var ItemBuffer = /** @class */ (function () {
|
|
6
|
-
function ItemBuffer() {
|
|
7
|
-
this.buffer = [];
|
|
8
|
-
}
|
|
9
|
-
ItemBuffer.prototype.addItem = function (item) {
|
|
10
|
-
this.buffer.push(item);
|
|
11
|
-
};
|
|
12
|
-
ItemBuffer.prototype.flushBuffer = function (cb) {
|
|
13
|
-
if ((0, is_1.isFunction)(cb)) {
|
|
14
|
-
for (var _i = 0, _a = this.buffer; _i < _a.length; _i++) {
|
|
15
|
-
var item = _a[_i];
|
|
16
|
-
cb(item);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
this.buffer.length = 0;
|
|
20
|
-
};
|
|
21
|
-
ItemBuffer.prototype.size = function () {
|
|
22
|
-
return this.buffer.length;
|
|
23
|
-
};
|
|
24
|
-
return ItemBuffer;
|
|
25
|
-
}());
|
|
26
|
-
exports.ItemBuffer = ItemBuffer;
|
|
27
|
-
//# sourceMappingURL=ItemBuffer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ItemBuffer.js","sourceRoot":"","sources":["../../../../../src/api/ItemBuffer.ts"],"names":[],"mappings":";;;AAAA,kCAAyC;AAEzC;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,4BAAO,GAAP,UAAQ,IAAO;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,gCAAW,GAAX,UAAY,EAAsB;QAChC,IAAI,IAAA,eAAU,EAAC,EAAE,CAAC,EAAE,CAAC;YACnB,KAAmB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE,CAAC;gBAA5B,IAAM,IAAI,SAAA;gBACb,EAAE,CAAC,IAAI,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,yBAAI,GAAJ;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IACH,iBAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,gCAAU","sourcesContent":["import { isFunction } from '../utils/is';\n\nexport class ItemBuffer<T> {\n private buffer: T[];\n\n constructor() {\n this.buffer = [];\n }\n\n addItem(item: T) {\n this.buffer.push(item);\n }\n\n flushBuffer(cb?: (item: T) => void) {\n if (isFunction(cb)) {\n for (const item of this.buffer) {\n cb(item);\n }\n }\n\n this.buffer.length = 0;\n }\n\n size() {\n return this.buffer.length;\n }\n}\n"]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mockUserActionsApi = exports.mockTracesApi = exports.mockTransports = exports.mockMetas = void 0;
|
|
4
|
-
exports.mockMetas = {
|
|
5
|
-
add: jest.fn(),
|
|
6
|
-
remove: jest.fn(),
|
|
7
|
-
addListener: jest.fn(),
|
|
8
|
-
removeListener: jest.fn(),
|
|
9
|
-
value: {},
|
|
10
|
-
};
|
|
11
|
-
exports.mockTransports = {
|
|
12
|
-
add: jest.fn(),
|
|
13
|
-
addBeforeSendHooks: jest.fn(),
|
|
14
|
-
execute: jest.fn(),
|
|
15
|
-
getBeforeSendHooks: jest.fn(),
|
|
16
|
-
remove: jest.fn(),
|
|
17
|
-
removeBeforeSendHooks: jest.fn(),
|
|
18
|
-
isPaused: function () {
|
|
19
|
-
throw new Error('Function not implemented.');
|
|
20
|
-
},
|
|
21
|
-
transports: [],
|
|
22
|
-
pause: function () {
|
|
23
|
-
throw new Error('Function not implemented.');
|
|
24
|
-
},
|
|
25
|
-
unpause: function () {
|
|
26
|
-
throw new Error('Function not implemented.');
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
exports.mockTracesApi = {
|
|
30
|
-
getOTEL: jest.fn(),
|
|
31
|
-
getTraceContext: jest.fn(),
|
|
32
|
-
initOTEL: jest.fn(),
|
|
33
|
-
isOTELInitialized: jest.fn(),
|
|
34
|
-
pushTraces: jest.fn(),
|
|
35
|
-
};
|
|
36
|
-
exports.mockUserActionsApi = {
|
|
37
|
-
startUserAction: jest.fn(),
|
|
38
|
-
getActiveUserAction: jest.fn(),
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=apiTestHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiTestHelpers.js","sourceRoot":"","sources":["../../../../../src/api/apiTestHelpers.ts"],"names":[],"mappings":";;;AAKa,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;IACd,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;IACjB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;IACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;IACzB,KAAK,EAAE,EAAE;CACV,CAAC;AAEW,QAAA,cAAc,GAAe;IACxC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;IACd,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE;IAC7B,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;IAClB,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE;IAC7B,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;IACjB,qBAAqB,EAAE,IAAI,CAAC,EAAE,EAAE;IAChC,QAAQ,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,UAAU,EAAE,EAAE;IACd,KAAK,EAAE;QACL,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,EAAE;QACP,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC;AAEW,QAAA,aAAa,GAAc;IACtC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;IAClB,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE;IAC1B,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;IACnB,iBAAiB,EAAE,IAAI,CAAC,EAAE,EAAE;IAC5B,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;CACtB,CAAC;AAEW,QAAA,kBAAkB,GAAmB;IAChD,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE;IAC1B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;CAC/B,CAAC","sourcesContent":["import type { Transports } from '../transports';\n\nimport type { TracesAPI } from './traces/types';\nimport type { UserActionsAPI } from './userActions/types';\n\nexport const mockMetas = {\n add: jest.fn(),\n remove: jest.fn(),\n addListener: jest.fn(),\n removeListener: jest.fn(),\n value: {},\n};\n\nexport const mockTransports: Transports = {\n add: jest.fn(),\n addBeforeSendHooks: jest.fn(),\n execute: jest.fn(),\n getBeforeSendHooks: jest.fn(),\n remove: jest.fn(),\n removeBeforeSendHooks: jest.fn(),\n isPaused: function (): boolean {\n throw new Error('Function not implemented.');\n },\n transports: [],\n pause: function (): void {\n throw new Error('Function not implemented.');\n },\n unpause: function (): void {\n throw new Error('Function not implemented.');\n },\n};\n\nexport const mockTracesApi: TracesAPI = {\n getOTEL: jest.fn(),\n getTraceContext: jest.fn(),\n initOTEL: jest.fn(),\n isOTELInitialized: jest.fn(),\n pushTraces: jest.fn(),\n};\n\nexport const mockUserActionsApi: UserActionsAPI = {\n startUserAction: jest.fn(),\n getActiveUserAction: jest.fn(),\n};\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initializeEventsAPI = void 0;
|
|
4
|
-
var initialize_1 = require("./initialize");
|
|
5
|
-
Object.defineProperty(exports, "initializeEventsAPI", { enumerable: true, get: function () { return initialize_1.initializeEventsAPI; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/api/events/index.ts"],"names":[],"mappings":";;;AACA,2CAAmD;AAA1C,iHAAA,mBAAmB,OAAA","sourcesContent":["export type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './types';\nexport { initializeEventsAPI } from './initialize';\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initializeEventsAPI = initializeEventsAPI;
|
|
4
|
-
var transports_1 = require("../../transports");
|
|
5
|
-
var utils_1 = require("../../utils");
|
|
6
|
-
var date_1 = require("../../utils/date");
|
|
7
|
-
var initialize_1 = require("../userActions/initialize");
|
|
8
|
-
function initializeEventsAPI(_a) {
|
|
9
|
-
var internalLogger = _a.internalLogger, config = _a.config, metas = _a.metas, transports = _a.transports, tracesApi = _a.tracesApi, userActionsApi = _a.userActionsApi;
|
|
10
|
-
var lastPayload = null;
|
|
11
|
-
var pushEvent = function (name, attributes, domain, _a) {
|
|
12
|
-
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs, _c = _b.customPayloadTransformer, customPayloadTransformer = _c === void 0 ? function (payload) { return payload; } : _c;
|
|
13
|
-
try {
|
|
14
|
-
var attrs = (0, utils_1.stringifyObjectValues)(attributes);
|
|
15
|
-
var item = {
|
|
16
|
-
meta: metas.value,
|
|
17
|
-
payload: customPayloadTransformer({
|
|
18
|
-
name: name,
|
|
19
|
-
domain: domain !== null && domain !== void 0 ? domain : config.eventDomain,
|
|
20
|
-
attributes: (0, utils_1.isEmpty)(attrs) ? undefined : attrs,
|
|
21
|
-
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
|
|
22
|
-
trace: spanContext
|
|
23
|
-
? {
|
|
24
|
-
trace_id: spanContext.traceId,
|
|
25
|
-
span_id: spanContext.spanId,
|
|
26
|
-
}
|
|
27
|
-
: tracesApi.getTraceContext(),
|
|
28
|
-
}),
|
|
29
|
-
type: transports_1.TransportItemType.EVENT,
|
|
30
|
-
};
|
|
31
|
-
var testingPayload = {
|
|
32
|
-
name: item.payload.name,
|
|
33
|
-
attributes: item.payload.attributes,
|
|
34
|
-
domain: item.payload.domain,
|
|
35
|
-
};
|
|
36
|
-
if (!skipDedupe && config.dedupe && !(0, utils_1.isNull)(lastPayload) && (0, utils_1.deepEqual)(testingPayload, lastPayload)) {
|
|
37
|
-
internalLogger.debug('Skipping event push because it is the same as the last one\n', item.payload);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
lastPayload = testingPayload;
|
|
41
|
-
internalLogger.debug('Pushing event\n', item);
|
|
42
|
-
if (!(0, initialize_1.addItemToUserActionBuffer)(userActionsApi.getActiveUserAction(), item)) {
|
|
43
|
-
transports.execute(item);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
internalLogger.error('Error pushing event', err);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
return {
|
|
51
|
-
pushEvent: pushEvent,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../../../src/api/events/initialize.ts"],"names":[],"mappings":";;AAcA,kDAuEC;AAlFD,+CAAqD;AAGrD,qCAAqG;AACrG,yCAAwD;AAGxD,wDAAsE;AAItE,SAAgB,mBAAmB,CAAC,EAenC;QAdC,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,cAAc,oBAAA;IAUd,IAAI,WAAW,G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AC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE,CAAC;gBACnG,cAAc,CAAC,KAAK,CAAC,8DAA8D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEnG,OAAO;YACT,CAAC;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAE9C,IAAI,CAAC,IAAA,sCAAyB,EAAC,cAAc,CAAC,mBAAmB,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC3E,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,WAAA;KACV,CAAC;AACJ,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\nimport type { UserActionsAPI } from '../userActions';\nimport { addItemToUserActionBuffer } from '../userActions/initialize';\n\nimport type { EventEvent, EventsAPI } from './types';\n\nexport function initializeEventsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n userActionsApi,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n userActionsApi: UserActionsAPI;\n}): EventsAPI {\n let lastPayload: Pick<EventEvent, 'name' | 'domain' | 'attributes'> | null = null;\n\n const pushEvent: EventsAPI['pushEvent'] = (\n name,\n attributes,\n domain,\n { skipDedupe, spanContext, timestampOverwriteMs, customPayloadTransformer = (payload: EventEvent) => payload } = {}\n ) => {\n try {\n const attrs = stringifyObjectValues(attributes);\n\n const item: TransportItem<EventEvent> = {\n meta: metas.value,\n payload: customPayloadTransformer({\n name,\n domain: domain ?? config.eventDomain,\n attributes: isEmpty(attrs) ? undefined : attrs,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n }),\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 if (!addItemToUserActionBuffer(userActionsApi.getActiveUserAction(), item)) {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n return {\n pushEvent,\n };\n}\n"]}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var initialize_1 = require("../../initialize");
|
|
7
|
-
var testUtils_1 = require("../../testUtils");
|
|
8
|
-
var apiTestHelpers_1 = require("../apiTestHelpers");
|
|
9
|
-
var userAction_1 = __importDefault(require("../userActions/userAction"));
|
|
10
|
-
var initialize_2 = require("./initialize");
|
|
11
|
-
describe('api.events', function () {
|
|
12
|
-
function createAPI(_a) {
|
|
13
|
-
var _b = _a === void 0 ? { dedupe: true } : _a, dedupe = _b.dedupe;
|
|
14
|
-
var transport = new testUtils_1.MockTransport();
|
|
15
|
-
var config = (0, testUtils_1.mockConfig)({
|
|
16
|
-
dedupe: dedupe,
|
|
17
|
-
transports: [transport],
|
|
18
|
-
});
|
|
19
|
-
var api = (0, initialize_1.initializeFaro)(config).api;
|
|
20
|
-
return [api, transport];
|
|
21
|
-
}
|
|
22
|
-
describe('pushEvent', function () {
|
|
23
|
-
var api;
|
|
24
|
-
var transport;
|
|
25
|
-
beforeEach(function () {
|
|
26
|
-
var _a;
|
|
27
|
-
_a = createAPI(), api = _a[0], transport = _a[1];
|
|
28
|
-
});
|
|
29
|
-
describe('Filtering', function () {
|
|
30
|
-
it('filters the same event', function () {
|
|
31
|
-
api.pushEvent('test', {
|
|
32
|
-
a: '1',
|
|
33
|
-
});
|
|
34
|
-
expect(transport.items).toHaveLength(1);
|
|
35
|
-
api.pushEvent('test', {
|
|
36
|
-
a: '1',
|
|
37
|
-
});
|
|
38
|
-
expect(transport.items).toHaveLength(1);
|
|
39
|
-
});
|
|
40
|
-
it("doesn't filter events with same name and partially same values", function () {
|
|
41
|
-
api.pushEvent('test', {
|
|
42
|
-
a: '1',
|
|
43
|
-
});
|
|
44
|
-
expect(transport.items).toHaveLength(1);
|
|
45
|
-
api.pushEvent('test', {
|
|
46
|
-
a: '1',
|
|
47
|
-
b: '2',
|
|
48
|
-
});
|
|
49
|
-
expect(transport.items).toHaveLength(2);
|
|
50
|
-
});
|
|
51
|
-
it("doesn't filter events with different name and same values", function () {
|
|
52
|
-
api.pushEvent('test1', {
|
|
53
|
-
a: '1',
|
|
54
|
-
});
|
|
55
|
-
expect(transport.items).toHaveLength(1);
|
|
56
|
-
api.pushEvent('test2', {
|
|
57
|
-
a: '1',
|
|
58
|
-
});
|
|
59
|
-
expect(transport.items).toHaveLength(2);
|
|
60
|
-
});
|
|
61
|
-
it("filters an event and doesn't filter the next different one", function () {
|
|
62
|
-
api.pushEvent('test1', {
|
|
63
|
-
a: '1',
|
|
64
|
-
});
|
|
65
|
-
expect(transport.items).toHaveLength(1);
|
|
66
|
-
api.pushEvent('test1', {
|
|
67
|
-
a: '1',
|
|
68
|
-
});
|
|
69
|
-
expect(transport.items).toHaveLength(1);
|
|
70
|
-
api.pushEvent('test2', {
|
|
71
|
-
b: '1',
|
|
72
|
-
});
|
|
73
|
-
expect(transport.items).toHaveLength(2);
|
|
74
|
-
});
|
|
75
|
-
it("doesn't filter when dedupe is false", function () {
|
|
76
|
-
var _a;
|
|
77
|
-
_a = createAPI({ dedupe: false }), api = _a[0], transport = _a[1];
|
|
78
|
-
api.pushEvent('test');
|
|
79
|
-
expect(transport.items).toHaveLength(1);
|
|
80
|
-
api.pushEvent('test');
|
|
81
|
-
expect(transport.items).toHaveLength(2);
|
|
82
|
-
});
|
|
83
|
-
it("doesn't filter when skipDedupe is true", function () {
|
|
84
|
-
api.pushEvent('test');
|
|
85
|
-
expect(transport.items).toHaveLength(1);
|
|
86
|
-
api.pushEvent('test', {}, undefined, { skipDedupe: true });
|
|
87
|
-
expect(transport.items).toHaveLength(2);
|
|
88
|
-
});
|
|
89
|
-
it('uses traceId and spanId from custom context', function () {
|
|
90
|
-
var _a;
|
|
91
|
-
var spanContext = {
|
|
92
|
-
traceId: 'my-trace-id',
|
|
93
|
-
spanId: 'my-span-id',
|
|
94
|
-
};
|
|
95
|
-
var mockGetTraceContext = jest.fn();
|
|
96
|
-
jest.spyOn(api, 'getTraceContext').mockImplementationOnce(mockGetTraceContext);
|
|
97
|
-
api.pushEvent('test', undefined, undefined, { spanContext: spanContext });
|
|
98
|
-
expect(mockGetTraceContext).not.toHaveBeenCalled();
|
|
99
|
-
expect(((_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload).trace).toStrictEqual({
|
|
100
|
-
trace_id: 'my-trace-id',
|
|
101
|
-
span_id: 'my-span-id',
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
it('Sets the timestamp to the provided custom timestamp', function () {
|
|
105
|
-
var _a;
|
|
106
|
-
api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });
|
|
107
|
-
expect(transport.items).toHaveLength(1);
|
|
108
|
-
expect(((_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload).timestamp).toBe('1970-01-01T00:00:00.123Z');
|
|
109
|
-
});
|
|
110
|
-
it('stringifies all values in the attributes object', function () {
|
|
111
|
-
var _a;
|
|
112
|
-
api.pushEvent('test', {
|
|
113
|
-
// @ts-expect-error
|
|
114
|
-
a: 1,
|
|
115
|
-
b: 'foo',
|
|
116
|
-
// @ts-expect-error
|
|
117
|
-
c: true,
|
|
118
|
-
// @ts-expect-error
|
|
119
|
-
d: { e: 'bar' },
|
|
120
|
-
// @ts-expect-error
|
|
121
|
-
g: null,
|
|
122
|
-
// @ts-expect-error
|
|
123
|
-
h: undefined,
|
|
124
|
-
// @ts-expect-error
|
|
125
|
-
i: [1, 2, 3],
|
|
126
|
-
});
|
|
127
|
-
// @ts-expect-error
|
|
128
|
-
expect((_a = transport.items[0]) === null || _a === void 0 ? void 0 : _a.payload.attributes).toStrictEqual({
|
|
129
|
-
a: '1',
|
|
130
|
-
b: 'foo',
|
|
131
|
-
c: 'true',
|
|
132
|
-
d: '{"e":"bar"}',
|
|
133
|
-
g: 'null',
|
|
134
|
-
h: 'undefined',
|
|
135
|
-
i: '[1,2,3]',
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
it('does not stringify empty attributes', function () {
|
|
139
|
-
api.pushEvent('test');
|
|
140
|
-
api.pushEvent('test2', {});
|
|
141
|
-
expect(transport.items).toHaveLength(2);
|
|
142
|
-
expect(transport.items[0].payload.attributes).toBeUndefined();
|
|
143
|
-
expect(transport.items[0].payload.attributes).toBeUndefined();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
describe('User action', function () {
|
|
148
|
-
it('buffers the error if a user action is in progress', function () {
|
|
149
|
-
var internalLogger = testUtils_1.mockInternalLogger;
|
|
150
|
-
var config = (0, testUtils_1.mockConfig)();
|
|
151
|
-
var api = (0, initialize_2.initializeEventsAPI)({
|
|
152
|
-
unpatchedConsole: console,
|
|
153
|
-
internalLogger: internalLogger,
|
|
154
|
-
config: config,
|
|
155
|
-
metas: apiTestHelpers_1.mockMetas,
|
|
156
|
-
transports: apiTestHelpers_1.mockTransports,
|
|
157
|
-
tracesApi: apiTestHelpers_1.mockTracesApi,
|
|
158
|
-
userActionsApi: apiTestHelpers_1.mockUserActionsApi,
|
|
159
|
-
});
|
|
160
|
-
apiTestHelpers_1.mockUserActionsApi.getActiveUserAction.mockReturnValueOnce(new userAction_1.default({
|
|
161
|
-
name: 'test',
|
|
162
|
-
trigger: 'foo',
|
|
163
|
-
transports: apiTestHelpers_1.mockTransports,
|
|
164
|
-
pushEvent: jest.fn(),
|
|
165
|
-
}));
|
|
166
|
-
api.pushEvent('test');
|
|
167
|
-
expect(apiTestHelpers_1.mockTransports.execute).not.toHaveBeenCalled();
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
//# sourceMappingURL=initialize.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.test.js","sourceRoot":"","sources":["../../../../../../src/api/events/initialize.test.ts"],"names":[],"mappings":";;;;;AACA,+CAAkD;AAClD,6CAAgF;AAChF,oDAAiG;AAEjG,yEAAmD;AAEnD,2CAAmD;AAGnD,QAAQ,CAAC,YAAY,EAAE;IACrB,SAAS,SAAS,CAAC,EAAkD;YAAlD,qBAAkC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAA,EAAhD,MAAM,YAAA;QACzB,IAAM,SAAS,GAAG,IAAI,yBAAa,EAAE,CAAC;QACtC,IAAM,MAAM,GAAG,IAAA,sBAAU,EAAC;YACxB,MAAM,QAAA;YACN,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC,CAAC;QAEK,IAAA,GAAG,GA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,CAAC;gBACxC,MAAM,CAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAA+B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;gBAC7F,MAAM,CAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAA+B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;YAC/F,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE;QACtB,EAAE,CAAC,mDAAmD,EAAE;YACtD,IAAM,cAAc,GAAG,8BAAkB,CAAC;YAC1C,IAAM,MAAM,GAAG,IAAA,sBAAU,GAAE,CAAC;YAE5B,IAAM,GAAG,GAAG,IAAA,gCAAmB,EAAC;gBAC9B,gBAAgB,EAAE,OAAO;gBACzB,cAAc,gBAAA;gBACd,MAAM,QAAA;gBACN,KAAK,EAAE,0BAAS;gBAChB,UAAU,EAAE,+BAAc;gBAC1B,SAAS,EAAE,8BAAa;gBACxB,cAAc,EAAE,mCAAkB;aACnC,CAAC,CAAC;YAEF,mCAAkB,CAAC,mBAAiC,CAAC,mBAAmB,CACvE,IAAI,oBAAU,CAAC;gBACb,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,+BAAc;gBAC1B,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE;aACrB,CAAC,CACH,CAAC;YACF,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACtB,MAAM,CAAC,+BAAc,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import type { TransportItem } from '../..';\nimport { initializeFaro } from '../../initialize';\nimport { mockConfig, mockInternalLogger, MockTransport } from '../../testUtils';\nimport { mockMetas, mockTracesApi, mockTransports, mockUserActionsApi } from '../apiTestHelpers';\nimport type { API } from '../types';\nimport UserAction from '../userActions/userAction';\n\nimport { initializeEventsAPI } from './initialize';\nimport type { EventEvent, PushEventOptions } from './types';\n\ndescribe('api.events', () => {\n function createAPI({ dedupe }: { dedupe: boolean } = { dedupe: true }): [API, MockTransport] {\n const transport = new MockTransport();\n const config = mockConfig({\n dedupe,\n transports: [transport],\n });\n\n const { api } = initializeFaro(config);\n\n return [api, transport];\n }\n\n describe('pushEvent', () => {\n let api: API;\n let transport: MockTransport;\n\n beforeEach(() => {\n [api, transport] = createAPI();\n });\n\n describe('Filtering', () => {\n it('filters the same event', () => {\n api.pushEvent('test', {\n a: '1',\n });\n expect(transport.items).toHaveLength(1);\n\n api.pushEvent('test', {\n a: '1',\n });\n expect(transport.items).toHaveLength(1);\n });\n\n it(\"doesn't filter events with same name and partially same values\", () => {\n api.pushEvent('test', {\n a: '1',\n });\n expect(transport.items).toHaveLength(1);\n\n api.pushEvent('test', {\n a: '1',\n b: '2',\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with different name and same values\", () => {\n api.pushEvent('test1', {\n a: '1',\n });\n expect(transport.items).toHaveLength(1);\n\n api.pushEvent('test2', {\n a: '1',\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"filters an event and doesn't filter the next different one\", () => {\n api.pushEvent('test1', {\n a: '1',\n });\n expect(transport.items).toHaveLength(1);\n\n api.pushEvent('test1', {\n a: '1',\n });\n expect(transport.items).toHaveLength(1);\n\n api.pushEvent('test2', {\n b: '1',\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when dedupe is false\", () => {\n [api, transport] = createAPI({ dedupe: false });\n\n api.pushEvent('test');\n expect(transport.items).toHaveLength(1);\n\n api.pushEvent('test');\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when skipDedupe is true\", () => {\n api.pushEvent('test');\n expect(transport.items).toHaveLength(1);\n\n api.pushEvent('test', {}, undefined, { skipDedupe: true });\n expect(transport.items).toHaveLength(2);\n });\n\n it('uses traceId and spanId from custom context', () => {\n const spanContext: PushEventOptions['spanContext'] = {\n traceId: 'my-trace-id',\n spanId: 'my-span-id',\n };\n\n const mockGetTraceContext = jest.fn();\n jest.spyOn(api, 'getTraceContext').mockImplementationOnce(mockGetTraceContext);\n\n api.pushEvent('test', undefined, undefined, { spanContext });\n\n expect(mockGetTraceContext).not.toHaveBeenCalled();\n expect((transport.items[0]?.payload as EventEvent).trace).toStrictEqual({\n trace_id: 'my-trace-id',\n span_id: 'my-span-id',\n });\n });\n\n it('Sets the timestamp to the provided custom timestamp', () => {\n api.pushEvent('test', undefined, undefined, { timestampOverwriteMs: 123 });\n expect(transport.items).toHaveLength(1);\n expect((transport.items[0]?.payload as EventEvent).timestamp).toBe('1970-01-01T00:00:00.123Z');\n });\n\n it('stringifies all values in the attributes object', () => {\n api.pushEvent('test', {\n // @ts-expect-error\n a: 1,\n b: 'foo',\n // @ts-expect-error\n c: true,\n // @ts-expect-error\n d: { e: 'bar' },\n // @ts-expect-error\n g: null,\n // @ts-expect-error\n h: undefined,\n // @ts-expect-error\n i: [1, 2, 3],\n });\n\n // @ts-expect-error\n expect(transport.items[0]?.payload.attributes).toStrictEqual({\n a: '1',\n b: 'foo',\n c: 'true',\n d: '{\"e\":\"bar\"}',\n g: 'null',\n h: 'undefined',\n i: '[1,2,3]',\n });\n });\n\n it('does not stringify empty attributes', () => {\n api.pushEvent('test');\n api.pushEvent('test2', {});\n expect(transport.items).toHaveLength(2);\n expect((transport.items[0] as TransportItem<EventEvent>).payload.attributes).toBeUndefined();\n expect((transport.items[0] as TransportItem<EventEvent>).payload.attributes).toBeUndefined();\n });\n });\n });\n\n describe('User action', () => {\n it('buffers the error if a user action is in progress', () => {\n const internalLogger = mockInternalLogger;\n const config = mockConfig();\n\n const api = initializeEventsAPI({\n unpatchedConsole: console,\n internalLogger,\n config,\n metas: mockMetas,\n transports: mockTransports,\n tracesApi: mockTracesApi,\n userActionsApi: mockUserActionsApi,\n });\n\n (mockUserActionsApi.getActiveUserAction as jest.Mock).mockReturnValueOnce(\n new UserAction({\n name: 'test',\n trigger: 'foo',\n transports: mockTransports,\n pushEvent: jest.fn(),\n })\n );\n api.pushEvent('test');\n expect(mockTransports.execute).not.toHaveBeenCalled();\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/api/events/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SpanContext } from '@opentelemetry/api';\n\nimport type { TraceContext } from '../traces';\nimport type { UserAction } from '../types';\n\nexport type EventAttributes = Record<string, string>;\n\nexport interface EventEvent {\n name: string;\n timestamp: string;\n\n domain?: string;\n attributes?: EventAttributes;\n trace?: TraceContext;\n\n action?: UserAction;\n}\n\nexport interface PushEventOptions {\n skipDedupe?: boolean;\n spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;\n timestampOverwriteMs?: number;\n\n /**\n * Allows manual transformation of the payload before adding it to the internal buffer.\n *\n * @param payload - The event payload to be transformed.\n * @returns The transformed event payload.\n *\n * @remarks This should be used sparingly and only in special cases where custom payload processing cannot be deferred to the before-send hook.\n */\n customPayloadTransformer?: (payload: EventEvent) => EventEvent;\n}\n\nexport interface EventsAPI {\n pushEvent: (name: string, attributes?: EventAttributes, domain?: string, options?: PushEventOptions) => void;\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultErrorArgsSerializer = exports.defaultExceptionType = void 0;
|
|
4
|
-
var utils_1 = require("../../utils");
|
|
5
|
-
exports.defaultExceptionType = 'Error';
|
|
6
|
-
var defaultErrorArgsSerializer = function (args) {
|
|
7
|
-
return args
|
|
8
|
-
.map(function (arg) {
|
|
9
|
-
if ((0, utils_1.isObject)(arg)) {
|
|
10
|
-
return (0, utils_1.stringifyExternalJson)(arg);
|
|
11
|
-
}
|
|
12
|
-
return String(arg);
|
|
13
|
-
})
|
|
14
|
-
.join(' ');
|
|
15
|
-
};
|
|
16
|
-
exports.defaultErrorArgsSerializer = defaultErrorArgsSerializer;
|
|
17
|
-
//# sourceMappingURL=const.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../../../src/api/exceptions/const.ts"],"names":[],"mappings":";;;AAAA,qCAA8D;AAEjD,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAErC,IAAM,0BAA0B,GAAG,UAAC,IAAsB;IAC/D,OAAO,IAAI;SACR,GAAG,CAAC,UAAC,GAAG;QACP,IAAI,IAAA,gBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,IAAA,6BAAqB,EAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC;AAVW,QAAA,0BAA0B,8BAUrC","sourcesContent":["import { isObject, stringifyExternalJson } from '../../utils';\n\nexport const defaultExceptionType = 'Error';\n\nexport const defaultErrorArgsSerializer = (args: [any?, ...any[]]) => {\n return args\n .map((arg) => {\n if (isObject(arg)) {\n return stringifyExternalJson(arg);\n }\n\n return String(arg);\n })\n .join(' ');\n};\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initializeExceptionsAPI = exports.defaultErrorArgsSerializer = exports.defaultExceptionType = void 0;
|
|
4
|
-
var const_1 = require("./const");
|
|
5
|
-
Object.defineProperty(exports, "defaultExceptionType", { enumerable: true, get: function () { return const_1.defaultExceptionType; } });
|
|
6
|
-
Object.defineProperty(exports, "defaultErrorArgsSerializer", { enumerable: true, get: function () { return const_1.defaultErrorArgsSerializer; } });
|
|
7
|
-
var initialize_1 = require("./initialize");
|
|
8
|
-
Object.defineProperty(exports, "initializeExceptionsAPI", { enumerable: true, get: function () { return initialize_1.initializeExceptionsAPI; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/api/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,iCAA2E;AAAlE,6GAAA,oBAAoB,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAEzD,2CAAuD;AAA9C,qHAAA,uBAAuB,OAAA","sourcesContent":["export { defaultExceptionType, defaultErrorArgsSerializer } from './const';\n\nexport { initializeExceptionsAPI } from './initialize';\n\nexport type {\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n PushErrorOptions,\n Stacktrace,\n StacktraceParser,\n ErrorWithIndexProperties,\n ExceptionEventExtended,\n} from './types';\n"]}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.initializeExceptionsAPI = initializeExceptionsAPI;
|
|
15
|
-
var transports_1 = require("../../transports");
|
|
16
|
-
var utils_1 = require("../../utils");
|
|
17
|
-
var date_1 = require("../../utils/date");
|
|
18
|
-
var initialize_1 = require("../userActions/initialize");
|
|
19
|
-
var utils_2 = require("../utils");
|
|
20
|
-
var const_1 = require("./const");
|
|
21
|
-
var stacktraceParser;
|
|
22
|
-
function initializeExceptionsAPI(_a) {
|
|
23
|
-
var _b;
|
|
24
|
-
var internalLogger = _a.internalLogger, config = _a.config, metas = _a.metas, transports = _a.transports, tracesApi = _a.tracesApi, userActionsApi = _a.userActionsApi;
|
|
25
|
-
internalLogger.debug('Initializing exceptions API');
|
|
26
|
-
var lastPayload = null;
|
|
27
|
-
stacktraceParser = (_b = config.parseStacktrace) !== null && _b !== void 0 ? _b : stacktraceParser;
|
|
28
|
-
var changeStacktraceParser = function (newStacktraceParser) {
|
|
29
|
-
internalLogger.debug('Changing stacktrace parser');
|
|
30
|
-
stacktraceParser = newStacktraceParser !== null && newStacktraceParser !== void 0 ? newStacktraceParser : stacktraceParser;
|
|
31
|
-
};
|
|
32
|
-
var getStacktraceParser = function () { return stacktraceParser; };
|
|
33
|
-
var _c = config.ignoreErrors, ignoreErrors = _c === void 0 ? [] : _c, preserveOriginalError = config.preserveOriginalError;
|
|
34
|
-
var pushError = function (error, _a) {
|
|
35
|
-
var _b = _a === void 0 ? {} : _a, skipDedupe = _b.skipDedupe, stackFrames = _b.stackFrames, type = _b.type, context = _b.context, spanContext = _b.spanContext, timestampOverwriteMs = _b.timestampOverwriteMs, originalError = _b.originalError, fingerprint = _b.fingerprint;
|
|
36
|
-
if (isErrorIgnored(ignoreErrors, originalError !== null && originalError !== void 0 ? originalError : error)) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
try {
|
|
40
|
-
var ctx = (0, utils_1.stringifyObjectValues)(__assign(__assign({}, parseCause(originalError !== null && originalError !== void 0 ? originalError : error)), (context !== null && context !== void 0 ? context : {})));
|
|
41
|
-
var item = {
|
|
42
|
-
meta: metas.value,
|
|
43
|
-
payload: __assign(__assign(__assign({ type: type || error.name || const_1.defaultExceptionType, value: error.message, timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(), trace: spanContext
|
|
44
|
-
? {
|
|
45
|
-
trace_id: spanContext.traceId,
|
|
46
|
-
span_id: spanContext.spanId,
|
|
47
|
-
}
|
|
48
|
-
: tracesApi.getTraceContext() }, ((0, utils_1.isEmpty)(ctx) ? {} : { context: ctx })), (preserveOriginalError ? { originalError: originalError } : {})), (fingerprint ? { fingerprint: fingerprint } : {})),
|
|
49
|
-
type: transports_1.TransportItemType.EXCEPTION,
|
|
50
|
-
};
|
|
51
|
-
stackFrames = stackFrames !== null && stackFrames !== void 0 ? stackFrames : (error.stack ? stacktraceParser === null || stacktraceParser === void 0 ? void 0 : stacktraceParser(error).frames : undefined);
|
|
52
|
-
if (stackFrames === null || stackFrames === void 0 ? void 0 : stackFrames.length) {
|
|
53
|
-
item.payload.stacktrace = {
|
|
54
|
-
frames: stackFrames,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
var testingPayload = {
|
|
58
|
-
type: item.payload.type,
|
|
59
|
-
value: item.payload.value,
|
|
60
|
-
stackTrace: item.payload.stacktrace,
|
|
61
|
-
context: item.payload.context,
|
|
62
|
-
fingerprint: item.payload.fingerprint,
|
|
63
|
-
};
|
|
64
|
-
if (!skipDedupe && config.dedupe && !(0, utils_1.isNull)(lastPayload) && (0, utils_1.deepEqual)(testingPayload, lastPayload)) {
|
|
65
|
-
internalLogger.debug('Skipping error push because it is the same as the last one\n', item.payload);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
lastPayload = testingPayload;
|
|
69
|
-
internalLogger.debug('Pushing exception\n', item);
|
|
70
|
-
if (!(0, initialize_1.addItemToUserActionBuffer)(userActionsApi.getActiveUserAction(), item)) {
|
|
71
|
-
transports.execute(item);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
internalLogger.error('Error pushing event', err);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
changeStacktraceParser(config.parseStacktrace);
|
|
79
|
-
return {
|
|
80
|
-
changeStacktraceParser: changeStacktraceParser,
|
|
81
|
-
getStacktraceParser: getStacktraceParser,
|
|
82
|
-
pushError: pushError,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function parseCause(error) {
|
|
86
|
-
var cause = error.cause;
|
|
87
|
-
if ((0, utils_1.isError)(cause)) {
|
|
88
|
-
cause = error.cause.toString();
|
|
89
|
-
// typeof operator on null returns "object". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.
|
|
90
|
-
// MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null
|
|
91
|
-
}
|
|
92
|
-
else if (cause !== null && ((0, utils_1.isObject)(error.cause) || (0, utils_1.isArray)(error.cause))) {
|
|
93
|
-
cause = (0, utils_1.stringifyExternalJson)(error.cause);
|
|
94
|
-
}
|
|
95
|
-
else if (cause != null) {
|
|
96
|
-
cause = error.cause.toString();
|
|
97
|
-
}
|
|
98
|
-
return cause == null ? {} : { cause: cause };
|
|
99
|
-
}
|
|
100
|
-
function isErrorIgnored(ignoreErrors, error) {
|
|
101
|
-
var message = error.message, name = error.name, stack = error.stack;
|
|
102
|
-
return (0, utils_2.shouldIgnoreEvent)(ignoreErrors, message + ' ' + name + ' ' + stack);
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;AA4BA,0DAyGC;AAlID,+CAAqD;AAGrD,qCAUqB;AACrB,yCAAwD;AAGxD,wDAAsE;AACtE,kCAA6C;AAE7C,iCAA+C;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,SAAgB,uBAAuB,CAAC,EAevC;;QAdC,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,cAAc,oBAAA;IAUd,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,G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AK,CAAC,CAAC;IAC7C,CAAC;SAAM,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,YAAsB,EAAE,KAA+B;IACrE,IAAA,OAAO,GAAkB,KAAK,QAAvB,EAAE,IAAI,GAAY,KAAK,KAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;IACvC,OAAO,IAAA,yBAAiB,EAAC,YAAY,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Config, Patterns } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isEmpty,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\nimport type { UserActionsAPI } from '../userActions';\nimport { addItemToUserActionBuffer } from '../userActions/initialize';\nimport { shouldIgnoreEvent } from '../utils';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n userActionsApi,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n userActionsApi: UserActionsAPI;\n}): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context' | 'fingerprint'> | 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 { ignoreErrors = [], preserveOriginalError } = config;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs, originalError, fingerprint } = {}\n ) => {\n if (isErrorIgnored(ignoreErrors, originalError ?? error)) {\n return;\n }\n try {\n const ctx = stringifyObjectValues({\n ...parseCause(originalError ?? error),\n ...(context ?? {}),\n });\n\n const item: TransportItem<ExceptionEvent<typeof preserveOriginalError>> = {\n meta: metas.value,\n payload: {\n type: type || error.name || defaultExceptionType,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n ...(isEmpty(ctx) ? {} : { context: ctx }),\n ...(preserveOriginalError ? { originalError } : {}),\n ...(fingerprint ? { fingerprint } : {}),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n context: item.payload.context,\n fingerprint: item.payload.fingerprint,\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 if (!addItemToUserActionBuffer(userActionsApi.getActiveUserAction(), item)) {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n\nfunction isErrorIgnored(ignoreErrors: Patterns, error: ErrorWithIndexProperties): boolean {\n const { message, name, stack } = error;\n return shouldIgnoreEvent(ignoreErrors, message + ' ' + name + ' ' + stack);\n}\n"]}
|