@grafana/faro-core 2.3.0 → 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 +8 -5
- 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 -83
- 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 +1 @@
|
|
|
1
|
-
var GrafanaFaroCore=function(e){"use strict";class t{constructor(e,t){var n,r;this.signalBuffer=[],this.itemLimit=null!==(n=null==t?void 0:t.itemLimit)&&void 0!==n?n:50,this.sendTimeout=null!==(r=null==t?void 0:t.sendTimeout)&&void 0!==r?r:250,this.paused=(null==t?void 0:t.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()})}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval(()=>this.flush(),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const t=new Map;return e.forEach(e=>{const n=JSON.stringify(e.meta);let r=t.get(n);r=void 0===r?[e]:[...r,e],t.set(n,r)}),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var n;e.TransportItemType=void 0,(n=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",n.LOG="log",n.MEASUREMENT="measurement",n.TRACE="trace",n.EVENT="event";const r={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function i(e,n,r,i){var a;n.debug("Initializing transports");const o=[];let u=r.paused,c=[];const l=e=>{let t=e;for(const e of c){const n=t.map(e).filter(Boolean);if(0===n.length)return[];t=s(n,r)}return t},d=e=>{const t=l(e);if(0!==t.length)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let g;(null===(a=r.batching)||void 0===a?void 0:a.enabled)&&(g=new t(d,{sendTimeout:r.batching.sendTimeout,itemLimit:r.batching.itemLimit,paused:u}));return{add:(...t)=>{n.debug("Adding transports"),t.forEach(t=>{n.debug(`Adding "${t.name}" transport`);o.some(e=>e===t)?n.warn(`Transport ${t.name} is already added`):(t.unpatchedConsole=e,t.internalLogger=n,t.config=r,t.metas=i,o.push(t))})},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",c),e.forEach(e=>{e&&c.push(e)})},getBeforeSendHooks:()=>[...c],execute:e=>{var t;u||((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&(null==g||g.addItem(e)),(e=>{var t,i;if((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&o.every(e=>e.isBatched()))return;const[s]=l([e]);if(void 0!==s)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,s),e.isBatched()?(null===(i=r.batching)||void 0===i?void 0:i.enabled)||e.send([s]):e.send(s)})(e))},isPaused:()=>u,pause:()=>{n.debug("Pausing transports"),null==g||g.pause(),u=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach(e=>{n.debug(`Removing "${e.name}" transport`);const t=o.indexOf(e);-1!==t?o.splice(t,1):n.warn(`Transport "${e.name}" is not added`)})},removeBeforeSendHooks:(...e)=>{c.filter(t=>!e.includes(t))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),null==g||g.start(),u=!1}}}function s(t,n){if(n.preserveOriginalError)for(const n of t)n.type===e.TransportItemType.EXCEPTION&&delete n.payload.originalError;return t}function a(e,t){return typeof e===t}function o(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function u(e,t){try{return e instanceof t}catch(e){return!1}}const c=e=>a(e,"null"),l=e=>a(e,"string"),d=e=>a(e,"number")&&!isNaN(e)||a(e,"bigint"),g=e=>!c(e)&&a(e,"object"),p=e=>a(e,"function"),f=e=>o(e,"Array"),m="undefined"!=typeof Event,b="undefined"!=typeof Error,h=e=>b&&u(e,Error),v="undefined"!=typeof Element,E="undefined"!=typeof Map;function y(e){return null==e||(f(e)||l(e)?0===e.length:!!g(e)&&0===Object.keys(e).length)}function I(e,t){if(e===t)return!0;if(a(e,"number")&&isNaN(e))return a(t,"number")&&isNaN(t);const n=f(e),r=f(t);if(n!==r)return!1;if(n&&r){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!==r--;)if(!I(e[r],t[r]))return!1;return!0}const i=g(e),s=g(t);if(i!==s)return!1;if(e&&t&&i&&s){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;for(let r of n)if(!I(e[r],t[r]))return!1;return!0}return!1}function O(){return Date.now()}function T(){return(new Date).toISOString()}function S(e){return new Date(e).toISOString()}var A;e.LogLevel=void 0,(A=e.LogLevel||(e.LogLevel={})).TRACE="trace",A.DEBUG="debug",A.INFO="info",A.LOG="log",A.WARN="warn",A.ERROR="error";const L=e.LogLevel.LOG,j=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function _(){}const x="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map(()=>x[Math.floor(59*Math.random())]).join("")}const w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function R(){const e=new WeakSet;return function(t,n){if(g(n)&&null!==n){if(e.has(n))return null;e.add(n)}return n}}function U(e={}){return JSON.stringify(null!=e?e:{},R())}function k(e={}){const t={};for(const[n,r]of Object.entries(e))t[n]=g(r)&&null!==r?U(r):String(r);return t}class C{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter(t=>t!==e)}notify(e){this.subscribers.forEach(t=>t(e))}first(){const e=new C,t=t=>{e.notify(t),n.unsubscribe()},n=this.subscribe(t),r=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,r,t)}takeWhile(e){const t=new C,n=r=>{e(r)?t.notify(r):t.unsubscribe(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}filter(e){const t=new C,n=n=>{e(n)&&t.notify(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}merge(...e){const t=new C,n=[];e.forEach(e=>{const r=e.subscribe(e=>{t.notify(e)});n.push(r)});const r=t.unsubscribeAll.bind(t);return t.unsubscribe=()=>{n.forEach(e=>e.unsubscribe()),r()},t}withUnsubscribeOverride(e,t,n){return e.unsubscribe=e=>{t(e),this.unsubscribe(n)},e}unsubscribeAll(){this.subscribers=[]}}var B;e.InternalLoggerLevel=void 0,(B=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[B.OFF=0]="OFF",B[B.ERROR=1]="ERROR",B[B.WARN=2]="WARN",B[B.INFO=3]="INFO",B[B.VERBOSE=4]="VERBOSE";const P={debug:_,error:_,info:_,prefix:"Faro",warn:_},M=e.InternalLoggerLevel.ERROR,F=Object.assign({},console);let D=F;function V(e){var t;return D=null!==(t=e.unpatchedConsole)&&void 0!==t?t:D,D}function $(t=F,n=M){const r=P;return n>e.InternalLoggerLevel.OFF&&(r.error=n>=e.InternalLoggerLevel.ERROR?function(...e){t.error(`${r.prefix}\n`,...e)}:_,r.warn=n>=e.InternalLoggerLevel.WARN?function(...e){t.warn(`${r.prefix}\n`,...e)}:_,r.info=n>=e.InternalLoggerLevel.INFO?function(...e){t.info(`${r.prefix}\n`,...e)}:_,r.debug=n>=e.InternalLoggerLevel.VERBOSE?function(...e){t.debug(`${r.prefix}\n`,...e)}:_),r}let z=P;function G(e,t){return z=$(e,t.internalLoggerLevel),z}class H{constructor(){this.unpatchedConsole=F,this.internalLogger=P,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}function K(e,t){var n,r;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const i=null===(n=e.resourceSpans)||void 0===n?void 0:n[0];if(void 0===i)return e;const s=(null==i?void 0:i.scopeSpans)||[],a=(null===(r=null==t?void 0:t[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},i),{scopeSpans:[...s,...a]})]})}const W={Normal:"normal",Critical:"critical"};var X;e.UserActionState=void 0,(X=e.UserActionState||(e.UserActionState={}))[X.Started=0]="Started",X[X.Halted=1]="Halted",X[X.Cancelled=2]="Cancelled",X[X.Ended=3]="Ended";class J{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(p(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}class q extends C{constructor({name:t,parentId:n,trigger:r,transports:i,attributes:s,trackUserActionsExcludeItem:a,importance:o=W.Normal,pushEvent:u}){super(),this.name=t,this.attributes=s,this.id=N(),this.trigger=r,this.parentId=null!=n?n:this.id,this.trackUserActionsExcludeItem=a,this.importance=o,this._pushEvent=u,this._itemBuffer=new J,this._transports=i,this._state=e.UserActionState.Started,this._start()}addItem(t){return this._state===e.UserActionState.Started&&(this._itemBuffer.addItem(t),!0)}_start(){this._state=e.UserActionState.Started,this._state===e.UserActionState.Started&&(this.startTime=O())}halt(){this._state===e.UserActionState.Started&&(this._state=e.UserActionState.Halted,this.notify(this._state))}cancel(){this._state===e.UserActionState.Started&&this._itemBuffer.flushBuffer(e=>{this._transports.execute(e)}),this._state=e.UserActionState.Cancelled,this.notify(this._state)}end(){if(this._state===e.UserActionState.Cancelled)return;const t=O(),n=t-this.startTime;this._state=e.UserActionState.Ended,this._itemBuffer.flushBuffer(t=>{if(function(t,n){return(null==n?void 0:n(t))||t.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===t.payload.type}(t,this.trackUserActionsExcludeItem))return void this._transports.execute(t);const n=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{action:{parentId:this.id,name:this.name}})});this._transports.execute(n)}),this._state=e.UserActionState.Ended,this.notify(this._state),this._pushEvent("faro.user.action",Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:t.toString(),userActionDuration:n.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},k(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:e=>(e.action={id:this.id,name:this.name},e)})}getState(){return this._state}}const Q=new C;function Y(t,n){if(!t)return!1;return(null==t?void 0:t.getState())===e.UserActionState.Started&&(t.addItem(n),!0)}const Z="Error";let ee;function te({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){var o;t.debug("Initializing exceptions API");let u=null;ee=null!==(o=n.parseStacktrace)&&void 0!==o?o:ee;const d=e=>{t.debug("Changing stacktrace parser"),ee=null!=e?e:ee},{ignoreErrors:p=[],preserveOriginalError:m}=n;return d(n.parseStacktrace),{changeStacktraceParser:d,getStacktraceParser:()=>ee,pushError:(o,{skipDedupe:d,stackFrames:b,type:v,context:E,spanContext:O,timestampOverwriteMs:A,originalError:L,fingerprint:j}={})=>{if(!function(e,t){const{message:n,name:r,stack:i}=t;return s=e,a=n+" "+r+" "+i,s.some(e=>l(e)?a.includes(e):!!a.match(e));var s,a}(p,null!=L?L:o))try{const l=k(Object.assign(Object.assign({},function(e){let t=e.cause;h(t)?t=e.cause.toString():null!==t&&(g(e.cause)||f(e.cause))?t=U(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(null!=L?L:o)),null!=E?E:{})),p={meta:r.value,payload:Object.assign(Object.assign(Object.assign({type:v||o.name||Z,value:o.message,timestamp:A?S(A):T(),trace:O?{trace_id:O.traceId,span_id:O.spanId}:s.getTraceContext()},y(l)?{}:{context:l}),m?{originalError:L}:{}),j?{fingerprint:j}:{}),type:e.TransportItemType.EXCEPTION};(null==(b=null!=b?b:o.stack?null==ee?void 0:ee(o).frames:void 0)?void 0:b.length)&&(p.payload.stacktrace={frames:b});const _={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace,context:p.payload.context,fingerprint:p.payload.fingerprint};if(!d&&n.dedupe&&!c(u)&&I(_,u))return void t.debug("Skipping error push because it is the same as the last one\n",p.payload);u=_,t.debug("Pushing exception\n",p),Y(a.getActiveUserAction(),p)||i.execute(p)}catch(e){t.error("Error pushing event",e)}}}}const ne=e=>e.map(e=>{try{return String(e)}catch(e){return""}}).join(" ");function re(t,n,r,i,s){n.debug("Initializing API");let a=null;const o=function({transports:t,internalLogger:n,config:r,pushEvent:i}){var s;const a=null===(s=r.userActionsInstrumentation)||void 0===s?void 0:s.excludeItem;let o;const u=()=>o;return{startUserAction:(r,s,c)=>{if(void 0===u()){const n=new q({name:r,transports:t,attributes:s,trigger:(null==c?void 0:c.triggerName)||"faroApiCall",importance:(null==c?void 0:c.importance)||W.Normal,trackUserActionsExcludeItem:a,pushEvent:i});return n.filter(t=>[e.UserActionState.Ended,e.UserActionState.Cancelled].includes(t)).first().subscribe(()=>{o=void 0}),Q.notify({type:"user_action_start",userAction:n}),o=n,o}n.error("Attempted to create a new user action while one is already running. This is not possible.")},getActiveUserAction:u}}({transports:s,config:r,internalLogger:n,pushEvent:(e,t,r,i)=>{a?a(e,t,r,i):n.warn("pushEventImpl is not initialized. Event dropped:",{name:e,attributes:t,domain:r,options:i})}}),u=function(t,n,r,i,s){let a;return n.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,t)=>{n.debug("Initializing OpenTelemetry"),a={trace:e,context:t}},isOTELInitialized:()=>!!a,pushTraces:t=>{try{const r={type:e.TransportItemType.TRACE,payload:t,meta:i.value};n.debug("Pushing trace\n",r),s.execute(r)}catch(e){n.error("Error pushing trace\n",e)}}}}(0,n,0,i,s),d={internalLogger:n,userActionsApi:o,config:r,metas:i,transports:s,tracesApi:u},g=function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){let o=null;return{pushEvent:(u,l,d,{skipDedupe:g,spanContext:p,timestampOverwriteMs:f,customPayloadTransformer:m=e=>e}={})=>{try{const b=k(l),h={meta:r.value,payload:m({name:u,domain:null!=d?d:n.eventDomain,attributes:y(b)?void 0:b,timestamp:f?S(f):T(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext()}),type:e.TransportItemType.EVENT},v={name:h.payload.name,attributes:h.payload.attributes,domain:h.payload.domain};if(!g&&n.dedupe&&!c(o)&&I(v,o))return void t.debug("Skipping event push because it is the same as the last one\n",h.payload);o=v,t.debug("Pushing event\n",h),Y(a.getActiveUserAction(),h)||i.execute(h)}catch(e){t.error("Error pushing event",e)}}}}(d);return a=g.pushEvent,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},u),te(d)),function({internalLogger:e,metas:t}){let n,r,i,s;e.debug("Initializing meta API");const a=e=>{r&&t.remove(r),r={user:e},t.add(r)},o=(e,r)=>{var i;const s=null==r?void 0:r.overrides,a=s?{overrides:Object.assign(Object.assign({},null===(i=null==n?void 0:n.session)||void 0===i?void 0:i.overrides),s)}:{};n&&t.remove(n),n={session:Object.assign(Object.assign({},y(e)?void 0:e),a)},t.add(n)},u=()=>t.value.session,c=()=>t.value.page;return{setUser:a,resetUser:a,setSession:o,resetSession:o,getSession:u,setView:(e,n)=>{var r;if((null==n?void 0:n.overrides)&&o(u(),{overrides:n.overrides}),(null===(r=null==i?void 0:i.view)||void 0===r?void 0:r.name)===(null==e?void 0:e.name))return;const s=i;i={view:e},t.add(i),s&&t.remove(s)},getView:()=>t.value.view,setPage:e=>{var n;const r=l(e)?Object.assign(Object.assign({},null!==(n=null==s?void 0:s.page)&&void 0!==n?n:c()),{id:e}):e;s&&t.remove(s),s={page:r},t.add(s)},getPage:c}}(d)),function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){var o;t.debug("Initializing logs API");let u=null;const l=null!==(o=n.logArgsSerializer)&&void 0!==o?o:ne;return{pushLog:(o,{context:d,level:g,skipDedupe:p,spanContext:f,timestampOverwriteMs:m}={})=>{try{const b=k(d),h={type:e.TransportItemType.LOG,payload:{message:l(o),level:null!=g?g:L,context:y(b)?void 0:b,timestamp:m?S(m):T(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:s.getTraceContext()},meta:r.value},v={message:h.payload.message,level:h.payload.level,context:h.payload.context};if(!p&&n.dedupe&&!c(u)&&I(v,u))return void t.debug("Skipping log push because it is the same as the last one\n",h.payload);u=v,t.debug("Pushing log\n",h),Y(a.getActiveUserAction(),h)||i.execute(h)}catch(e){t.error("Error pushing log\n",e)}}}}(d)),function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){t.debug("Initializing measurements API");let o=null;return{pushMeasurement:(u,{skipDedupe:l,context:d,spanContext:g,timestampOverwriteMs:p}={})=>{try{const f=k(d),m={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},u),{trace:g?{trace_id:g.traceId,span_id:g.spanId}:s.getTraceContext(),timestamp:p?S(p):T(),context:y(f)?void 0:f}),meta:r.value},b={type:m.payload.type,values:m.payload.values,context:m.payload.context};if(!l&&n.dedupe&&!c(o)&&I(b,o))return void t.debug("Skipping measurement push because it is the same as the last one\n",m.payload);o=b,t.debug("Pushing measurement\n",m),Y(a.getActiveUserAction(),m)||i.execute(m)}catch(e){t.error("Error pushing measurement\n",e)}}}}(d)),g),o)}const ie="2.3.0";const se="_faroInternal";function ae(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(w,se,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function oe(){return se in w}function ue(t,n,r,i,s,a,o){return n.debug("Initializing Faro"),e.faro={api:a,config:r,instrumentations:o,internalLogger:n,metas:i,pause:s.pause,transports:s,unpatchedConsole:t,unpause:s.unpause},ae(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in w)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(w,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=H,e.BaseInstrumentation=class extends H{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends H{isBatched(){return!1}getIgnoreUrls(){return[]}},e.EVENT_CLICK="click",e.EVENT_NAVIGATION="navigation",e.EVENT_OVERRIDES_SERVICE_NAME="service_name_override",e.EVENT_ROUTE_CHANGE="route_change",e.EVENT_SESSION_EXTEND="session_extend",e.EVENT_SESSION_RESUME="session_resume",e.EVENT_SESSION_START="session_start",e.EVENT_VIEW_CHANGED="view_changed",e.Observable=C,e.UserActionImportance=W,e.VERSION=ie,e.allLogLevels=j,e.clampSamplingRate=function(e){return Math.min(1,Math.max(0,e))},e.createInternalLogger=$,e.createPromiseBuffer=function(e){const{size:t,concurrency:n}=e,r=[];let i=0;const s=()=>{if(i<n&&r.length){const{producer:e,resolve:t,reject:n}=r.shift();i++,e().then(e=>{i--,s(),t(e)},e=>{i--,s(),n(e)})}};return{add:e=>{if(r.length+i>=t)throw new Error("Task buffer full");return new Promise((t,n)=>{r.push({producer:e,resolve:t,reject:n}),s()})}}},e.dateNow=O,e.deepEqual=I,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map(e=>g(e)?U(e):String(e)).join(" "),e.defaultExceptionType=Z,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=M,e.defaultLogArgsSerializer=ne,e.defaultLogLevel=L,e.defaultUnpatchedConsole=F,e.genShortID=N,e.getCircularDependencyReplacer=R,e.getCurrentTimestamp=T,e.getInternalFaroFromGlobalObject=function(){return w[se]},e.getTransportBody=function(t){let n={meta:{}};return void 0!==t[0]&&(n.meta=t[0].meta),t.forEach(t=>{switch(t.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:{const e=r[t.type],i=n[e];n=Object.assign(Object.assign({},n),{[e]:void 0===i?[t.payload]:[...i,t.payload]});break}case e.TransportItemType.TRACE:n=Object.assign(Object.assign({},n),{traces:K(n.traces,t.payload.resourceSpans)})}}),n},e.globalObject=w,e.initializeFaro=function(e){const t=V(e),n=G(t,e);if(oe()&&!e.isolate)return void n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');n.debug("Initializing");const r=function(e,t){let n=[],r=[];const i=()=>n.reduce((e,t)=>Object.assign(e,p(t)?t():t),{}),s=()=>{if(r.length){const e=i();r.forEach(t=>t(e))}};return{add:(...e)=>{t.debug("Adding metas\n",e),n.push(...e),s()},remove:(...e)=>{t.debug("Removing metas\n",e),n=n.filter(t=>!e.includes(t)),s()},addListener:e=>{t.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),r=r.filter(t=>t!==e)},get value(){return i()}}}(0,n),s=i(t,n,e,r),a=re(0,n,e,r,s),o=function(e,t,n,r,i,s){t.debug("Initializing instrumentations");const a=[];return{add:(...o)=>{t.debug("Adding instrumentations"),o.forEach(o=>{t.debug(`Adding "${o.name}" instrumentation`),a.some(e=>e.name===o.name)?t.warn(`Instrumentation ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=t,o.config=n,o.metas=r,o.transports=i,o.api=s,a.push(o),o.initialize())})},get instrumentations(){return[...a]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach(e=>{var n,r;t.debug(`Removing "${e.name}" instrumentation`);const i=a.reduce((t,n,r)=>null===t&&n.name===e.name?r:null,null);null!==i?(null===(r=(n=a[i]).destroy)||void 0===r||r.call(n),a.splice(i,1)):t.warn(`Instrumentation "${e.name}" is not added`)})}}}(t,n,e,r,s,a),u=ue(t,n,e,r,s,a,o);return function(e){var t,n;const r={sdk:{version:ie,name:"faro"},app:{bundleId:e.config.app.name&&(i=e.config.app.name,null==w?void 0:w[`__faroBundleId_${i}`])}};var i;const s=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.session;s&&e.api.setSession(s),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(u),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(u),function(e){e.instrumentations.add(...e.config.instrumentations)}(u),u},e.internalGlobalObjectKey=se,e.isArray=f,e.isBoolean=e=>a(e,"boolean"),e.isDomError=e=>o(e,"DOMError"),e.isDomException=e=>o(e,"DOMException"),e.isElement=e=>v&&u(e,Element),e.isElementDefined=v,e.isEmpty=y,e.isError=h,e.isErrorDefined=b,e.isErrorEvent=e=>o(e,"ErrorEvent"),e.isEvent=e=>m&&u(e,Event),e.isEventDefined=m,e.isFunction=p,e.isInstanceOf=u,e.isInt=e=>d(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=oe,e.isMap=e=>E&&u(e,Map),e.isMapDefined=E,e.isNull=c,e.isNumber=d,e.isObject=g,e.isPrimitive=e=>!g(e)&&!p(e),e.isRegExp=e=>o(e,"RegExp"),e.isString=l,e.isSymbol=e=>a(e,"symbol"),e.isSyntheticEvent=e=>g(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>p(null==e?void 0:e.then),e.isToString=o,e.isTypeof=a,e.isUndefined=e=>a(e,"undefined"),e.noop=_,e.setInternalFaroOnGlobalObject=ae,e.stringifyExternalJson=U,e.stringifyObjectValues=k,e.transportItemTypeToBodyKey=r,e.unknownString="unknown",e.userActionsMessageBus=Q,e}({});
|
|
1
|
+
var GrafanaFaroCore=function(e){"use strict";class t{constructor(e,t){var n,r;this.signalBuffer=[],this.itemLimit=null!==(n=null==t?void 0:t.itemLimit)&&void 0!==n?n:50,this.sendTimeout=null!==(r=null==t?void 0:t.sendTimeout)&&void 0!==r?r:250,this.paused=(null==t?void 0:t.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()})}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval(()=>this.flush(),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const t=new Map;return e.forEach(e=>{const n=JSON.stringify(e.meta);let r=t.get(n);r=void 0===r?[e]:[...r,e],t.set(n,r)}),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var n;e.TransportItemType=void 0,(n=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",n.LOG="log",n.MEASUREMENT="measurement",n.TRACE="trace",n.EVENT="event";const r={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function i(e,n,r,i){var a;n.debug("Initializing transports");const o=[];let u=r.paused,c=[];const l=e=>{let t=e;for(const e of c){const n=t.map(e).filter(Boolean);if(0===n.length)return[];t=s(n,r)}return t},d=e=>{const t=l(e);if(0!==t.length)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let g;(null===(a=r.batching)||void 0===a?void 0:a.enabled)&&(g=new t(d,{sendTimeout:r.batching.sendTimeout,itemLimit:r.batching.itemLimit,paused:u}));return{add:(...t)=>{n.debug("Adding transports"),t.forEach(t=>{n.debug(`Adding "${t.name}" transport`);o.some(e=>e===t)?n.warn(`Transport ${t.name} is already added`):(t.unpatchedConsole=e,t.internalLogger=n,t.config=r,t.metas=i,o.push(t))})},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",c),e.forEach(e=>{e&&c.push(e)})},getBeforeSendHooks:()=>[...c],execute:e=>{var t;u||((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&(null==g||g.addItem(e)),(e=>{var t,i;if((null===(t=r.batching)||void 0===t?void 0:t.enabled)&&o.every(e=>e.isBatched()))return;const[s]=l([e]);if(void 0!==s)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,s),e.isBatched()?(null===(i=r.batching)||void 0===i?void 0:i.enabled)||e.send([s]):e.send(s)})(e))},isPaused:()=>u,pause:()=>{n.debug("Pausing transports"),null==g||g.pause(),u=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach(e=>{n.debug(`Removing "${e.name}" transport`);const t=o.indexOf(e);-1!==t?o.splice(t,1):n.warn(`Transport "${e.name}" is not added`)})},removeBeforeSendHooks:(...e)=>{c.filter(t=>!e.includes(t))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),null==g||g.start(),u=!1}}}function s(t,n){if(n.preserveOriginalError)for(const n of t)n.type===e.TransportItemType.EXCEPTION&&delete n.payload.originalError;return t}function a(e,t){return typeof e===t}function o(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function u(e,t){try{return e instanceof t}catch(e){return!1}}const c=e=>a(e,"null"),l=e=>a(e,"string"),d=e=>a(e,"number")&&!isNaN(e)||a(e,"bigint"),g=e=>!c(e)&&a(e,"object"),p=e=>a(e,"function"),f=e=>o(e,"Array"),m="undefined"!=typeof Event,b="undefined"!=typeof Error,h=e=>b&&u(e,Error),v="undefined"!=typeof Element,E="undefined"!=typeof Map;function y(e){return null==e||(f(e)||l(e)?0===e.length:!!g(e)&&0===Object.keys(e).length)}function I(e,t){if(e===t)return!0;if(a(e,"number")&&isNaN(e))return a(t,"number")&&isNaN(t);const n=f(e),r=f(t);if(n!==r)return!1;if(n&&r){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!==r--;)if(!I(e[r],t[r]))return!1;return!0}const i=g(e),s=g(t);if(i!==s)return!1;if(e&&t&&i&&s){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;for(let r of n)if(!I(e[r],t[r]))return!1;return!0}return!1}function O(){return Date.now()}function T(){return(new Date).toISOString()}function S(e){return new Date(e).toISOString()}var A;e.LogLevel=void 0,(A=e.LogLevel||(e.LogLevel={})).TRACE="trace",A.DEBUG="debug",A.INFO="info",A.LOG="log",A.WARN="warn",A.ERROR="error";const L=e.LogLevel.LOG,j=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function _(){}const x="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map(()=>x[Math.floor(59*Math.random())]).join("")}const w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function R(){const e=new WeakSet;return function(t,n){if(g(n)&&null!==n){if(e.has(n))return null;e.add(n)}return n}}function U(e={}){return JSON.stringify(null!=e?e:{},R())}function k(e={}){const t={};for(const[n,r]of Object.entries(e))t[n]=g(r)&&null!==r?U(r):String(r);return t}class C{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter(t=>t!==e)}notify(e){this.subscribers.forEach(t=>t(e))}first(){const e=new C,t=t=>{e.notify(t),n.unsubscribe()},n=this.subscribe(t),r=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,r,t)}takeWhile(e){const t=new C,n=r=>{e(r)?t.notify(r):t.unsubscribe(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}filter(e){const t=new C,n=n=>{e(n)&&t.notify(n)};this.subscribe(n);const r=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,r,n)}merge(...e){const t=new C,n=[];e.forEach(e=>{const r=e.subscribe(e=>{t.notify(e)});n.push(r)});const r=t.unsubscribeAll.bind(t);return t.unsubscribe=()=>{n.forEach(e=>e.unsubscribe()),r()},t}withUnsubscribeOverride(e,t,n){return e.unsubscribe=e=>{t(e),this.unsubscribe(n)},e}unsubscribeAll(){this.subscribers=[]}}var B;e.InternalLoggerLevel=void 0,(B=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[B.OFF=0]="OFF",B[B.ERROR=1]="ERROR",B[B.WARN=2]="WARN",B[B.INFO=3]="INFO",B[B.VERBOSE=4]="VERBOSE";const P={debug:_,error:_,info:_,prefix:"Faro",warn:_},M=e.InternalLoggerLevel.ERROR,F=Object.assign({},console);let D=F;function V(e){var t;return D=null!==(t=e.unpatchedConsole)&&void 0!==t?t:D,D}function $(t=F,n=M){const r=P;return n>e.InternalLoggerLevel.OFF&&(r.error=n>=e.InternalLoggerLevel.ERROR?function(...e){t.error(`${r.prefix}\n`,...e)}:_,r.warn=n>=e.InternalLoggerLevel.WARN?function(...e){t.warn(`${r.prefix}\n`,...e)}:_,r.info=n>=e.InternalLoggerLevel.INFO?function(...e){t.info(`${r.prefix}\n`,...e)}:_,r.debug=n>=e.InternalLoggerLevel.VERBOSE?function(...e){t.debug(`${r.prefix}\n`,...e)}:_),r}let z=P;function G(e,t){return z=$(e,t.internalLoggerLevel),z}class H{constructor(){this.unpatchedConsole=F,this.internalLogger=P,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}function K(e,t){var n,r;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const i=null===(n=e.resourceSpans)||void 0===n?void 0:n[0];if(void 0===i)return e;const s=(null==i?void 0:i.scopeSpans)||[],a=(null===(r=null==t?void 0:t[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},i),{scopeSpans:[...s,...a]})]})}const W={Normal:"normal",Critical:"critical"};var X;e.UserActionState=void 0,(X=e.UserActionState||(e.UserActionState={}))[X.Started=0]="Started",X[X.Halted=1]="Halted",X[X.Cancelled=2]="Cancelled",X[X.Ended=3]="Ended";class J{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(p(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}class q extends C{constructor({name:t,parentId:n,trigger:r,transports:i,attributes:s,trackUserActionsExcludeItem:a,importance:o=W.Normal,pushEvent:u}){super(),this.name=t,this.attributes=s,this.id=N(),this.trigger=r,this.parentId=null!=n?n:this.id,this.trackUserActionsExcludeItem=a,this.importance=o,this._pushEvent=u,this._itemBuffer=new J,this._transports=i,this._state=e.UserActionState.Started,this._start()}addItem(t){return this._state===e.UserActionState.Started&&(this._itemBuffer.addItem(t),!0)}_start(){this._state=e.UserActionState.Started,this._state===e.UserActionState.Started&&(this.startTime=O())}halt(){this._state===e.UserActionState.Started&&(this._state=e.UserActionState.Halted,this.notify(this._state))}cancel(){this._state===e.UserActionState.Started&&this._itemBuffer.flushBuffer(e=>{this._transports.execute(e)}),this._state=e.UserActionState.Cancelled,this.notify(this._state)}end(){if(this._state===e.UserActionState.Cancelled)return;const t=O(),n=t-this.startTime;this._state=e.UserActionState.Ended,this._itemBuffer.flushBuffer(t=>{if(function(t,n){return(null==n?void 0:n(t))||t.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===t.payload.type}(t,this.trackUserActionsExcludeItem))return void this._transports.execute(t);const n=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{action:{parentId:this.id,name:this.name}})});this._transports.execute(n)}),this._state=e.UserActionState.Ended,this.notify(this._state),this._pushEvent("faro.user.action",Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:t.toString(),userActionDuration:n.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},k(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:e=>(e.action={id:this.id,name:this.name},e)})}getState(){return this._state}}const Q=new C;function Y(t,n){if(!t)return!1;return(null==t?void 0:t.getState())===e.UserActionState.Started&&(t.addItem(n),!0)}const Z="Error";let ee;function te({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){var o;t.debug("Initializing exceptions API");let u=null;ee=null!==(o=n.parseStacktrace)&&void 0!==o?o:ee;const d=e=>{t.debug("Changing stacktrace parser"),ee=null!=e?e:ee},{ignoreErrors:p=[],preserveOriginalError:m}=n;return d(n.parseStacktrace),{changeStacktraceParser:d,getStacktraceParser:()=>ee,pushError:(o,{skipDedupe:d,stackFrames:b,type:v,context:E,spanContext:O,timestampOverwriteMs:A,originalError:L,fingerprint:j}={})=>{if(!function(e,t){const{message:n,name:r,stack:i}=t;return s=e,a=n+" "+r+" "+i,s.some(e=>l(e)?a.includes(e):!!a.match(e));var s,a}(p,null!=L?L:o))try{const l=k(Object.assign(Object.assign({},function(e){let t=e.cause;h(t)?t=e.cause.toString():null!==t&&(g(e.cause)||f(e.cause))?t=U(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(null!=L?L:o)),null!=E?E:{})),p={meta:r.value,payload:Object.assign(Object.assign(Object.assign({type:v||o.name||Z,value:o.message,timestamp:A?S(A):T(),trace:O?{trace_id:O.traceId,span_id:O.spanId}:s.getTraceContext()},y(l)?{}:{context:l}),m?{originalError:L}:{}),j?{fingerprint:j}:{}),type:e.TransportItemType.EXCEPTION};(null==(b=null!=b?b:o.stack?null==ee?void 0:ee(o).frames:void 0)?void 0:b.length)&&(p.payload.stacktrace={frames:b});const _={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace,context:p.payload.context,fingerprint:p.payload.fingerprint};if(!d&&n.dedupe&&!c(u)&&I(_,u))return void t.debug("Skipping error push because it is the same as the last one\n",p.payload);u=_,t.debug("Pushing exception\n",p),Y(a.getActiveUserAction(),p)||i.execute(p)}catch(e){t.error("Error pushing event",e)}}}}const ne=e=>e.map(e=>{try{return String(e)}catch(e){return""}}).join(" ");function re(t,n,r,i,s){n.debug("Initializing API");let a=null;const o=function({transports:t,internalLogger:n,config:r,pushEvent:i}){var s;const a=null===(s=r.userActionsInstrumentation)||void 0===s?void 0:s.excludeItem;let o;const u=()=>o;return{startUserAction:(r,s,c)=>{if(void 0===u()){const n=new q({name:r,transports:t,attributes:s,trigger:(null==c?void 0:c.triggerName)||"faroApiCall",importance:(null==c?void 0:c.importance)||W.Normal,trackUserActionsExcludeItem:a,pushEvent:i});return n.filter(t=>[e.UserActionState.Ended,e.UserActionState.Cancelled].includes(t)).first().subscribe(()=>{o=void 0}),Q.notify({type:"user_action_start",userAction:n}),o=n,o}n.error("Attempted to create a new user action while one is already running. This is not possible.")},getActiveUserAction:u}}({transports:s,config:r,internalLogger:n,pushEvent:(e,t,r,i)=>{a?a(e,t,r,i):n.warn("pushEventImpl is not initialized. Event dropped:",{name:e,attributes:t,domain:r,options:i})}}),u=function(t,n,r,i,s){let a;return n.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,t)=>{n.debug("Initializing OpenTelemetry"),a={trace:e,context:t}},isOTELInitialized:()=>!!a,pushTraces:t=>{try{const r={type:e.TransportItemType.TRACE,payload:t,meta:i.value};n.debug("Pushing trace\n",r),s.execute(r)}catch(e){n.error("Error pushing trace\n",e)}}}}(0,n,0,i,s),d={internalLogger:n,userActionsApi:o,config:r,metas:i,transports:s,tracesApi:u},g=function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){let o=null;return{pushEvent:(u,l,d,{skipDedupe:g,spanContext:p,timestampOverwriteMs:f,customPayloadTransformer:m=e=>e}={})=>{try{const b=k(l),h={meta:r.value,payload:m({name:u,domain:null!=d?d:n.eventDomain,attributes:y(b)?void 0:b,timestamp:f?S(f):T(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext()}),type:e.TransportItemType.EVENT},v={name:h.payload.name,attributes:h.payload.attributes,domain:h.payload.domain};if(!g&&n.dedupe&&!c(o)&&I(v,o))return void t.debug("Skipping event push because it is the same as the last one\n",h.payload);o=v,t.debug("Pushing event\n",h),Y(a.getActiveUserAction(),h)||i.execute(h)}catch(e){t.error("Error pushing event",e)}}}}(d);return a=g.pushEvent,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},u),te(d)),function({internalLogger:e,metas:t}){let n,r,i,s;e.debug("Initializing meta API");const a=e=>{r&&t.remove(r),r={user:e},t.add(r)},o=(e,r)=>{var i;const s=null==r?void 0:r.overrides,a=s?{overrides:Object.assign(Object.assign({},null===(i=null==n?void 0:n.session)||void 0===i?void 0:i.overrides),s)}:{};n&&t.remove(n),n={session:Object.assign(Object.assign({},y(e)?void 0:e),a)},t.add(n)},u=()=>t.value.session,c=()=>t.value.page;return{setUser:a,resetUser:a,setSession:o,resetSession:o,getSession:u,setView:(e,n)=>{var r;if((null==n?void 0:n.overrides)&&o(u(),{overrides:n.overrides}),(null===(r=null==i?void 0:i.view)||void 0===r?void 0:r.name)===(null==e?void 0:e.name))return;const s=i;i={view:e},t.add(i),s&&t.remove(s)},getView:()=>t.value.view,setPage:e=>{var n;const r=l(e)?Object.assign(Object.assign({},null!==(n=null==s?void 0:s.page)&&void 0!==n?n:c()),{id:e}):e;s&&t.remove(s),s={page:r},t.add(s)},getPage:c}}(d)),function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){var o;t.debug("Initializing logs API");let u=null;const l=null!==(o=n.logArgsSerializer)&&void 0!==o?o:ne;return{pushLog:(o,{context:d,level:g,skipDedupe:p,spanContext:f,timestampOverwriteMs:m}={})=>{try{const b=k(d),h={type:e.TransportItemType.LOG,payload:{message:l(o),level:null!=g?g:L,context:y(b)?void 0:b,timestamp:m?S(m):T(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:s.getTraceContext()},meta:r.value},v={message:h.payload.message,level:h.payload.level,context:h.payload.context};if(!p&&n.dedupe&&!c(u)&&I(v,u))return void t.debug("Skipping log push because it is the same as the last one\n",h.payload);u=v,t.debug("Pushing log\n",h),Y(a.getActiveUserAction(),h)||i.execute(h)}catch(e){t.error("Error pushing log\n",e)}}}}(d)),function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:s,userActionsApi:a}){t.debug("Initializing measurements API");let o=null;return{pushMeasurement:(u,{skipDedupe:l,context:d,spanContext:g,timestampOverwriteMs:p}={})=>{try{const f=k(d),m={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},u),{trace:g?{trace_id:g.traceId,span_id:g.spanId}:s.getTraceContext(),timestamp:p?S(p):T(),context:y(f)?void 0:f}),meta:r.value},b={type:m.payload.type,values:m.payload.values,context:m.payload.context};if(!l&&n.dedupe&&!c(o)&&I(b,o))return void t.debug("Skipping measurement push because it is the same as the last one\n",m.payload);o=b,t.debug("Pushing measurement\n",m),Y(a.getActiveUserAction(),m)||i.execute(m)}catch(e){t.error("Error pushing measurement\n",e)}}}}(d)),g),o)}const ie="2.4.0";const se="_faroInternal";function ae(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(w,se,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function oe(){return se in w}function ue(t,n,r,i,s,a,o){return n.debug("Initializing Faro"),e.faro={api:a,config:r,instrumentations:o,internalLogger:n,metas:i,pause:s.pause,transports:s,unpatchedConsole:t,unpause:s.unpause},ae(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in w)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(w,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=H,e.BaseInstrumentation=class extends H{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends H{isBatched(){return!1}getIgnoreUrls(){return[]}},e.EVENT_CLICK="click",e.EVENT_NAVIGATION="navigation",e.EVENT_OVERRIDES_SERVICE_NAME="service_name_override",e.EVENT_ROUTE_CHANGE="route_change",e.EVENT_SESSION_EXTEND="session_extend",e.EVENT_SESSION_RESUME="session_resume",e.EVENT_SESSION_START="session_start",e.EVENT_VIEW_CHANGED="view_changed",e.Observable=C,e.UserActionImportance=W,e.VERSION=ie,e.allLogLevels=j,e.clampSamplingRate=function(e){return Math.min(1,Math.max(0,e))},e.createInternalLogger=$,e.createPromiseBuffer=function(e){const{size:t,concurrency:n}=e,r=[];let i=0;const s=()=>{if(i<n&&r.length){const{producer:e,resolve:t,reject:n}=r.shift();i++,e().then(e=>{i--,s(),t(e)},e=>{i--,s(),n(e)})}};return{add:e=>{if(r.length+i>=t)throw new Error("Task buffer full");return new Promise((t,n)=>{r.push({producer:e,resolve:t,reject:n}),s()})}}},e.dateNow=O,e.deepEqual=I,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map(e=>g(e)?U(e):String(e)).join(" "),e.defaultExceptionType=Z,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=M,e.defaultLogArgsSerializer=ne,e.defaultLogLevel=L,e.defaultUnpatchedConsole=F,e.genShortID=N,e.getCircularDependencyReplacer=R,e.getCurrentTimestamp=T,e.getInternalFaroFromGlobalObject=function(){return w[se]},e.getTransportBody=function(t){let n={meta:{}};return void 0!==t[0]&&(n.meta=t[0].meta),t.forEach(t=>{switch(t.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:{const e=r[t.type],i=n[e];n=Object.assign(Object.assign({},n),{[e]:void 0===i?[t.payload]:[...i,t.payload]});break}case e.TransportItemType.TRACE:n=Object.assign(Object.assign({},n),{traces:K(n.traces,t.payload.resourceSpans)})}}),n},e.globalObject=w,e.initializeFaro=function(e){const t=V(e),n=G(t,e);if(oe()&&!e.isolate)return void n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');n.debug("Initializing");const r=function(e,t){let n=[],r=[];const i=()=>n.reduce((e,t)=>Object.assign(e,p(t)?t():t),{}),s=()=>{if(r.length){const e=i();r.forEach(t=>t(e))}};return{add:(...e)=>{t.debug("Adding metas\n",e),n.push(...e),s()},remove:(...e)=>{t.debug("Removing metas\n",e),n=n.filter(t=>!e.includes(t)),s()},addListener:e=>{t.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),r=r.filter(t=>t!==e)},get value(){return i()}}}(0,n),s=i(t,n,e,r),a=re(0,n,e,r,s),o=function(e,t,n,r,i,s){t.debug("Initializing instrumentations");const a=[];return{add:(...o)=>{t.debug("Adding instrumentations"),o.forEach(o=>{t.debug(`Adding "${o.name}" instrumentation`),a.some(e=>e.name===o.name)?t.warn(`Instrumentation ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=t,o.config=n,o.metas=r,o.transports=i,o.api=s,a.push(o),o.initialize())})},get instrumentations(){return[...a]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach(e=>{var n,r;t.debug(`Removing "${e.name}" instrumentation`);const i=a.reduce((t,n,r)=>null===t&&n.name===e.name?r:null,null);null!==i?(null===(r=(n=a[i]).destroy)||void 0===r||r.call(n),a.splice(i,1)):t.warn(`Instrumentation "${e.name}" is not added`)})}}}(t,n,e,r,s,a),u=ue(t,n,e,r,s,a,o);return function(e){var t,n;const r={sdk:{version:ie,name:"faro"},app:{bundleId:e.config.app.name&&(i=e.config.app.name,null==w?void 0:w[`__faroBundleId_${i}`])}};var i;const s=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.session;s&&e.api.setSession(s),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(u),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(u),function(e){e.instrumentations.add(...e.config.instrumentations)}(u),u},e.internalGlobalObjectKey=se,e.isArray=f,e.isBoolean=e=>a(e,"boolean"),e.isDomError=e=>o(e,"DOMError"),e.isDomException=e=>o(e,"DOMException"),e.isElement=e=>v&&u(e,Element),e.isElementDefined=v,e.isEmpty=y,e.isError=h,e.isErrorDefined=b,e.isErrorEvent=e=>o(e,"ErrorEvent"),e.isEvent=e=>m&&u(e,Event),e.isEventDefined=m,e.isFunction=p,e.isInstanceOf=u,e.isInt=e=>d(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=oe,e.isMap=e=>E&&u(e,Map),e.isMapDefined=E,e.isNull=c,e.isNumber=d,e.isObject=g,e.isPrimitive=e=>!g(e)&&!p(e),e.isRegExp=e=>o(e,"RegExp"),e.isString=l,e.isSymbol=e=>a(e,"symbol"),e.isSyntheticEvent=e=>g(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>p(null==e?void 0:e.then),e.isToString=o,e.isTypeof=a,e.isUndefined=e=>a(e,"undefined"),e.noop=_,e.setInternalFaroOnGlobalObject=ae,e.stringifyExternalJson=U,e.stringifyObjectValues=k,e.transportItemTypeToBodyKey=r,e.unknownString="unknown",e.userActionsMessageBus=Q,e}({});
|
|
@@ -5,7 +5,7 @@ export declare abstract class BaseExtension implements Extension {
|
|
|
5
5
|
abstract readonly name: string;
|
|
6
6
|
abstract readonly version: string;
|
|
7
7
|
unpatchedConsole: Console;
|
|
8
|
-
internalLogger: import("
|
|
8
|
+
internalLogger: import("..").InternalLogger;
|
|
9
9
|
config: Config;
|
|
10
10
|
metas: Metas;
|
|
11
11
|
logDebug(...args: unknown[]): void;
|
|
@@ -4,7 +4,7 @@ import type { Transport, TransportItem } from '../transports';
|
|
|
4
4
|
export declare class MockTransport extends BaseTransport implements Transport {
|
|
5
5
|
private ignoreURLs;
|
|
6
6
|
readonly name = "@grafana/transport-mock";
|
|
7
|
-
readonly version = "2.
|
|
7
|
+
readonly version = "2.4.0";
|
|
8
8
|
items: TransportItem[];
|
|
9
9
|
constructor(ignoreURLs?: Patterns);
|
|
10
10
|
send(items: TransportItem[]): void | Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.
|
|
1
|
+
export declare const VERSION = "2.4.0";
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ItemBuffer = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const is_1 = require("../utils/is");
|
|
5
|
+
class ItemBuffer {
|
|
6
|
+
constructor() {
|
|
7
7
|
this.buffer = [];
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
addItem(item) {
|
|
10
10
|
this.buffer.push(item);
|
|
11
|
-
}
|
|
12
|
-
|
|
11
|
+
}
|
|
12
|
+
flushBuffer(cb) {
|
|
13
13
|
if ((0, is_1.isFunction)(cb)) {
|
|
14
|
-
for (
|
|
15
|
-
var item = _a[_i];
|
|
14
|
+
for (const item of this.buffer) {
|
|
16
15
|
cb(item);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
this.buffer.length = 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
19
|
+
}
|
|
20
|
+
size() {
|
|
22
21
|
return this.buffer.length;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
26
24
|
exports.ItemBuffer = ItemBuffer;
|
|
27
25
|
//# sourceMappingURL=ItemBuffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemBuffer.js","sourceRoot":"","sources":["../../../src/api/ItemBuffer.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"ItemBuffer.js","sourceRoot":"","sources":["../../../src/api/ItemBuffer.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAEzC,MAAa,UAAU;IAGrB;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,IAAO;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,WAAW,CAAC,EAAsB;QAChC,IAAI,IAAA,eAAU,EAAC,EAAE,CAAC,EAAE,CAAC;YACnB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAC/B,EAAE,CAAC,IAAI,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF;AAxBD,gCAwBC","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,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initializeEventsAPI = initializeEventsAPI;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function initializeEventsAPI(
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
4
|
+
const transports_1 = require("../../transports");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const date_1 = require("../../utils/date");
|
|
7
|
+
const initialize_1 = require("../userActions/initialize");
|
|
8
|
+
function initializeEventsAPI({ internalLogger, config, metas, transports, tracesApi, userActionsApi, }) {
|
|
9
|
+
let lastPayload = null;
|
|
10
|
+
const pushEvent = (name, attributes, domain, { skipDedupe, spanContext, timestampOverwriteMs, customPayloadTransformer = (payload) => payload } = {}) => {
|
|
13
11
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const attrs = (0, utils_1.stringifyObjectValues)(attributes);
|
|
13
|
+
const item = {
|
|
16
14
|
meta: metas.value,
|
|
17
15
|
payload: customPayloadTransformer({
|
|
18
|
-
name
|
|
16
|
+
name,
|
|
19
17
|
domain: domain !== null && domain !== void 0 ? domain : config.eventDomain,
|
|
20
18
|
attributes: (0, utils_1.isEmpty)(attrs) ? undefined : attrs,
|
|
21
19
|
timestamp: timestampOverwriteMs ? (0, date_1.timestampToIsoString)(timestampOverwriteMs) : (0, utils_1.getCurrentTimestamp)(),
|
|
@@ -28,7 +26,7 @@ function initializeEventsAPI(_a) {
|
|
|
28
26
|
}),
|
|
29
27
|
type: transports_1.TransportItemType.EVENT,
|
|
30
28
|
};
|
|
31
|
-
|
|
29
|
+
const testingPayload = {
|
|
32
30
|
name: item.payload.name,
|
|
33
31
|
attributes: item.payload.attributes,
|
|
34
32
|
domain: item.payload.domain,
|
|
@@ -48,7 +46,7 @@ function initializeEventsAPI(_a) {
|
|
|
48
46
|
}
|
|
49
47
|
};
|
|
50
48
|
return {
|
|
51
|
-
pushEvent
|
|
49
|
+
pushEvent,
|
|
52
50
|
};
|
|
53
51
|
}
|
|
54
52
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":";;AAcA,kDAuEC;AAlFD
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":";;AAcA,kDAuEC;AAlFD,iDAAqD;AAGrD,uCAAqG;AACrG,2CAAwD;AAGxD,0DAAsE;AAItE,SAAgB,mBAAmB,CAAC,EAClC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,cAAc,GASf;IACC,IAAI,WAAW,GAA8D,IAAI,CAAC;IAElF,MAAM,SAAS,GAA2B,CACxC,IAAI,EACJ,UAAU,EACV,MAAM,EACN,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE,wBAAwB,GAAG,CAAC,OAAmB,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,EACnH,EAAE;QACF,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAA,6BAAqB,EAAC,UAAU,CAAC,CAAC;YAEhD,MAAM,IAAI,GAA8B;gBACtC,IAAI,EAAE,KAAK,CAAC,KAAK;gBACjB,OAAO,EAAE,wBAAwB,CAAC;oBAChC,IAAI;oBACJ,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,MAAM,CAAC,WAAW;oBACpC,UAAU,EAAE,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;oBAC9C,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAA,2BAAoB,EAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAA,2BAAmB,GAAE;oBACpG,KAAK,EAAE,WAAW;wBAChB,CAAC,CAAC;4BACE,QAAQ,EAAE,WAAW,CAAC,OAAO;4BAC7B,OAAO,EAAE,WAAW,CAAC,MAAM;yBAC5B;wBACH,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE;iBAChC,CAAC;gBACF,IAAI,EAAE,8BAAiB,CAAC,KAAK;aAC9B,CAAC;YAEF,MAAM,cAAc,GAAG;gBACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;gBACvB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;gBACnC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE,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;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,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultErrorArgsSerializer = exports.defaultExceptionType = void 0;
|
|
4
|
-
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
5
|
exports.defaultExceptionType = 'Error';
|
|
6
|
-
|
|
6
|
+
const defaultErrorArgsSerializer = (args) => {
|
|
7
7
|
return args
|
|
8
|
-
.map(
|
|
8
|
+
.map((arg) => {
|
|
9
9
|
if ((0, utils_1.isObject)(arg)) {
|
|
10
10
|
return (0, utils_1.stringifyExternalJson)(arg);
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/exceptions/const.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/exceptions/const.ts"],"names":[],"mappings":";;;AAAA,uCAA8D;AAEjD,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAErC,MAAM,0BAA0B,GAAG,CAAC,IAAsB,EAAE,EAAE;IACnE,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,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,51 +1,38 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.initializeExceptionsAPI = initializeExceptionsAPI;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function initializeExceptionsAPI(
|
|
23
|
-
var
|
|
24
|
-
var internalLogger = _a.internalLogger, config = _a.config, metas = _a.metas, transports = _a.transports, tracesApi = _a.tracesApi, userActionsApi = _a.userActionsApi;
|
|
4
|
+
const transports_1 = require("../../transports");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const date_1 = require("../../utils/date");
|
|
7
|
+
const initialize_1 = require("../userActions/initialize");
|
|
8
|
+
const utils_2 = require("../utils");
|
|
9
|
+
const const_1 = require("./const");
|
|
10
|
+
let stacktraceParser;
|
|
11
|
+
function initializeExceptionsAPI({ internalLogger, config, metas, transports, tracesApi, userActionsApi, }) {
|
|
12
|
+
var _a;
|
|
25
13
|
internalLogger.debug('Initializing exceptions API');
|
|
26
|
-
|
|
27
|
-
stacktraceParser = (
|
|
28
|
-
|
|
14
|
+
let lastPayload = null;
|
|
15
|
+
stacktraceParser = (_a = config.parseStacktrace) !== null && _a !== void 0 ? _a : stacktraceParser;
|
|
16
|
+
const changeStacktraceParser = (newStacktraceParser) => {
|
|
29
17
|
internalLogger.debug('Changing stacktrace parser');
|
|
30
18
|
stacktraceParser = newStacktraceParser !== null && newStacktraceParser !== void 0 ? newStacktraceParser : stacktraceParser;
|
|
31
19
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
20
|
+
const getStacktraceParser = () => stacktraceParser;
|
|
21
|
+
const { ignoreErrors = [], preserveOriginalError } = config;
|
|
22
|
+
const pushError = (error, { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs, originalError, fingerprint } = {}) => {
|
|
36
23
|
if (isErrorIgnored(ignoreErrors, originalError !== null && originalError !== void 0 ? originalError : error)) {
|
|
37
24
|
return;
|
|
38
25
|
}
|
|
39
26
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
const ctx = (0, utils_1.stringifyObjectValues)(Object.assign(Object.assign({}, parseCause(originalError !== null && originalError !== void 0 ? originalError : error)), (context !== null && context !== void 0 ? context : {})));
|
|
28
|
+
const item = {
|
|
42
29
|
meta: metas.value,
|
|
43
|
-
payload:
|
|
30
|
+
payload: Object.assign(Object.assign(Object.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
31
|
? {
|
|
45
32
|
trace_id: spanContext.traceId,
|
|
46
33
|
span_id: spanContext.spanId,
|
|
47
34
|
}
|
|
48
|
-
: tracesApi.getTraceContext() }, ((0, utils_1.isEmpty)(ctx) ? {} : { context: ctx })), (preserveOriginalError ? { originalError
|
|
35
|
+
: tracesApi.getTraceContext() }, ((0, utils_1.isEmpty)(ctx) ? {} : { context: ctx })), (preserveOriginalError ? { originalError } : {})), (fingerprint ? { fingerprint } : {})),
|
|
49
36
|
type: transports_1.TransportItemType.EXCEPTION,
|
|
50
37
|
};
|
|
51
38
|
stackFrames = stackFrames !== null && stackFrames !== void 0 ? stackFrames : (error.stack ? stacktraceParser === null || stacktraceParser === void 0 ? void 0 : stacktraceParser(error).frames : undefined);
|
|
@@ -54,7 +41,7 @@ function initializeExceptionsAPI(_a) {
|
|
|
54
41
|
frames: stackFrames,
|
|
55
42
|
};
|
|
56
43
|
}
|
|
57
|
-
|
|
44
|
+
const testingPayload = {
|
|
58
45
|
type: item.payload.type,
|
|
59
46
|
value: item.payload.value,
|
|
60
47
|
stackTrace: item.payload.stacktrace,
|
|
@@ -77,13 +64,13 @@ function initializeExceptionsAPI(_a) {
|
|
|
77
64
|
};
|
|
78
65
|
changeStacktraceParser(config.parseStacktrace);
|
|
79
66
|
return {
|
|
80
|
-
changeStacktraceParser
|
|
81
|
-
getStacktraceParser
|
|
82
|
-
pushError
|
|
67
|
+
changeStacktraceParser,
|
|
68
|
+
getStacktraceParser,
|
|
69
|
+
pushError,
|
|
83
70
|
};
|
|
84
71
|
}
|
|
85
72
|
function parseCause(error) {
|
|
86
|
-
|
|
73
|
+
let cause = error.cause;
|
|
87
74
|
if ((0, utils_1.isError)(cause)) {
|
|
88
75
|
cause = error.cause.toString();
|
|
89
76
|
// 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.
|
|
@@ -95,10 +82,10 @@ function parseCause(error) {
|
|
|
95
82
|
else if (cause != null) {
|
|
96
83
|
cause = error.cause.toString();
|
|
97
84
|
}
|
|
98
|
-
return cause == null ? {} : { cause
|
|
85
|
+
return cause == null ? {} : { cause };
|
|
99
86
|
}
|
|
100
87
|
function isErrorIgnored(ignoreErrors, error) {
|
|
101
|
-
|
|
88
|
+
const { message, name, stack } = error;
|
|
102
89
|
return (0, utils_2.shouldIgnoreEvent)(ignoreErrors, message + ' ' + name + ' ' + stack);
|
|
103
90
|
}
|
|
104
91
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;AA4BA,0DAyGC;AAlID,iDAAqD;AAGrD,uCAUqB;AACrB,2CAAwD;AAGxD,0DAAsE;AACtE,oCAA6C;AAE7C,mCAA+C;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,SAAgB,uBAAuB,CAAC,EACtC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,cAAc,GASf;;IACC,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAA6F,IAAI,CAAC;IAEjH,gBAAgB,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,gBAAgB,CAAC;IAE9D,MAAM,sBAAsB,GAA4C,CAAC,mBAAmB,EAAE,EAAE;QAC9F,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,gBAAgB,GAAG,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,gBAAgB,CAAC;IAC7D,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAyC,GAAG,EAAE,CAAC,gBAAgB,CAAC;IAEzF,MAAM,EAAE,YAAY,GAAG,EAAE,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAAC;IAE5D,MAAM,SAAS,GAA+B,CAC5C,KAAK,EACL,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,EAAE,EAC9G,EAAE;QACF,IAAI,cAAc,CAAC,YAAY,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,KAAK,CAAC,EAAE,CAAC;YACzD,OAAO;QACT,CAAC;QACD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAA,6BAAqB,kCAC5B,UAAU,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,KAAK,CAAC,GAClC,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,EAClB,CAAC;YAEH,MAAM,IAAI,GAAgE;gBACxE,IAAI,EAAE,KAAK,CAAC,KAAK;gBACjB,OAAO,8CACL,IAAI,EAAE,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,4BAAoB,EAChD,KAAK,EAAE,KAAK,CAAC,OAAO,EACpB,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAA,2BAAoB,EAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAA,2BAAmB,GAAE,EACpG,KAAK,EAAE,WAAW;wBAChB,CAAC,CAAC;4BACE,QAAQ,EAAE,WAAW,CAAC,OAAO;4BAC7B,OAAO,EAAE,WAAW,CAAC,MAAM;yBAC5B;wBACH,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE,IAC5B,CAAC,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,GACtC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAChD,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACxC;gBACD,IAAI,EAAE,8BAAiB,CAAC,SAAS;aAClC,CAAC;YAEF,WAAW,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAE1F,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,EAAE,CAAC;gBACxB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG;oBACxB,MAAM,EAAE,WAAW;iBACpB,CAAC;YACJ,CAAC;YAED,MAAM,cAAc,GAAG;gBACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;gBACvB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;gBACnC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;gBAC7B,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;aACtC,CAAC;YAEF,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAA,cAAM,EAAC,WAAW,CAAC,IAAI,IAAA,iBAAS,EAAC,cAAc,EAAE,WAAW,CAAC,EAAE,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,qBAAqB,EAAE,IAAI,CAAC,CAAC;YAElD,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,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAE/C,OAAO;QACL,sBAAsB;QACtB,mBAAmB;QACnB,SAAS;KACV,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAA+B;IACjD,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAExB,IAAI,IAAA,eAAO,EAAC,KAAK,CAAC,EAAE,CAAC;QACnB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,wKAAwK;QACxK,sGAAsG;IACxG,CAAC;SAAM,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAA,eAAO,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC7E,KAAK,GAAG,IAAA,6BAAqB,EAAC,KAAK,CAAC,KAAK,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,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,YAAsB,EAAE,KAA+B;IAC7E,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;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"]}
|
|
@@ -1,56 +1,45 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.initializeAPI = initializeAPI;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
const events_1 = require("./events");
|
|
5
|
+
const exceptions_1 = require("./exceptions");
|
|
6
|
+
const logs_1 = require("./logs");
|
|
7
|
+
const measurements_1 = require("./measurements");
|
|
8
|
+
const meta_1 = require("./meta");
|
|
9
|
+
const traces_1 = require("./traces");
|
|
10
|
+
const userActions_1 = require("./userActions");
|
|
22
11
|
function initializeAPI(unpatchedConsole, internalLogger, config, metas, transports) {
|
|
23
12
|
internalLogger.debug('Initializing API');
|
|
24
13
|
// Create a deferred pushEvent function that will be set once events API is initialized
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
let pushEventImpl = null;
|
|
15
|
+
const pushEventWrapper = (name, attributes, domain, options) => {
|
|
27
16
|
if (pushEventImpl) {
|
|
28
17
|
pushEventImpl(name, attributes, domain, options);
|
|
29
18
|
}
|
|
30
19
|
else {
|
|
31
|
-
internalLogger.warn('pushEventImpl is not initialized. Event dropped:', { name
|
|
20
|
+
internalLogger.warn('pushEventImpl is not initialized. Event dropped:', { name, attributes, domain, options });
|
|
32
21
|
}
|
|
33
22
|
};
|
|
34
23
|
// Initialize user actions API with the wrapper function
|
|
35
|
-
|
|
36
|
-
transports
|
|
37
|
-
config
|
|
38
|
-
internalLogger
|
|
24
|
+
const userActionsApi = (0, userActions_1.initializeUserActionsAPI)({
|
|
25
|
+
transports,
|
|
26
|
+
config,
|
|
27
|
+
internalLogger,
|
|
39
28
|
pushEvent: pushEventWrapper,
|
|
40
29
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
unpatchedConsole
|
|
44
|
-
internalLogger
|
|
45
|
-
userActionsApi
|
|
46
|
-
config
|
|
47
|
-
metas
|
|
48
|
-
transports
|
|
49
|
-
tracesApi
|
|
30
|
+
const tracesApi = (0, traces_1.initializeTracesAPI)(unpatchedConsole, internalLogger, config, metas, transports);
|
|
31
|
+
const props = {
|
|
32
|
+
unpatchedConsole,
|
|
33
|
+
internalLogger,
|
|
34
|
+
userActionsApi,
|
|
35
|
+
config,
|
|
36
|
+
metas,
|
|
37
|
+
transports,
|
|
38
|
+
tracesApi,
|
|
50
39
|
};
|
|
51
40
|
// Initialize events API and set the actual implementation
|
|
52
|
-
|
|
41
|
+
const eventsApi = (0, events_1.initializeEventsAPI)(props);
|
|
53
42
|
pushEventImpl = eventsApi.pushEvent;
|
|
54
|
-
return
|
|
43
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, tracesApi), (0, exceptions_1.initializeExceptionsAPI)(props)), (0, meta_1.initializeMetaAPI)(props)), (0, logs_1.initializeLogsAPI)(props)), (0, measurements_1.initializeMeasurementsAPI)(props)), eventsApi), userActionsApi);
|
|
55
44
|
}
|
|
56
45
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":";;AAgBA,sCAoDC;AA9DD,qCAA+C;AAE/C,6CAAuD;AACvD,iCAA2C;AAC3C,iDAA2D;AAC3D,iCAA2C;AAC3C,qCAA+C;AAE/C,+CAAyD;AAEzD,SAAgB,aAAa,CAC3B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB;IAEtB,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEzC,uFAAuF;IACvF,IAAI,aAAa,GAAkC,IAAI,CAAC;IACxD,MAAM,gBAAgB,GAA2B,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QACrF,IAAI,aAAa,EAAE,CAAC;YAClB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,cAAc,CAAC,IAAI,CAAC,kDAAkD,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QACjH,CAAC;IACH,CAAC,CAAC;IAEF,wDAAwD;IACxD,MAAM,cAAc,GAAG,IAAA,sCAAwB,EAAC;QAC9C,UAAU;QACV,MAAM;QACN,cAAc;QACd,SAAS,EAAE,gBAAgB;KAC5B,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAEnG,MAAM,KAAK,GAAG;QACZ,gBAAgB;QAChB,cAAc;QACd,cAAc;QACd,MAAM;QACN,KAAK;QACL,UAAU;QACV,SAAS;KACV,CAAC;IAEF,0DAA0D;IAC1D,MAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,KAAK,CAAC,CAAC;IAC7C,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC;IAEpC,6GACK,SAAS,GACT,IAAA,oCAAuB,EAAC,KAAK,CAAC,GAC9B,IAAA,wBAAiB,EAAC,KAAK,CAAC,GACxB,IAAA,wBAAiB,EAAC,KAAK,CAAC,GACxB,IAAA,wCAAyB,EAAC,KAAK,CAAC,GAChC,SAAS,GACT,cAAc,EACjB;AACJ,CAAC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { initializeEventsAPI } from './events';\nimport type { EventsAPI } from './events/types';\nimport { initializeExceptionsAPI } from './exceptions';\nimport { initializeLogsAPI } from './logs';\nimport { initializeMeasurementsAPI } from './measurements';\nimport { initializeMetaAPI } from './meta';\nimport { initializeTracesAPI } from './traces';\nimport type { API } from './types';\nimport { initializeUserActionsAPI } from './userActions';\n\nexport function initializeAPI(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports\n): API {\n internalLogger.debug('Initializing API');\n\n // Create a deferred pushEvent function that will be set once events API is initialized\n let pushEventImpl: EventsAPI['pushEvent'] | null = null;\n const pushEventWrapper: EventsAPI['pushEvent'] = (name, attributes, domain, options) => {\n if (pushEventImpl) {\n pushEventImpl(name, attributes, domain, options);\n } else {\n internalLogger.warn('pushEventImpl is not initialized. Event dropped:', { name, attributes, domain, options });\n }\n };\n\n // Initialize user actions API with the wrapper function\n const userActionsApi = initializeUserActionsAPI({\n transports,\n config,\n internalLogger,\n pushEvent: pushEventWrapper,\n });\n\n const tracesApi = initializeTracesAPI(unpatchedConsole, internalLogger, config, metas, transports);\n\n const props = {\n unpatchedConsole,\n internalLogger,\n userActionsApi,\n config,\n metas,\n transports,\n tracesApi,\n };\n\n // Initialize events API and set the actual implementation\n const eventsApi = initializeEventsAPI(props);\n pushEventImpl = eventsApi.pushEvent;\n\n return {\n ...tracesApi,\n ...initializeExceptionsAPI(props),\n ...initializeMetaAPI(props),\n ...initializeLogsAPI(props),\n ...initializeMeasurementsAPI(props),\n ...eventsApi,\n ...userActionsApi,\n };\n}\n"]}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultLogArgsSerializer = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.join(' ');
|
|
15
|
-
};
|
|
4
|
+
const defaultLogArgsSerializer = (args) => args
|
|
5
|
+
.map((arg) => {
|
|
6
|
+
try {
|
|
7
|
+
return String(arg);
|
|
8
|
+
}
|
|
9
|
+
catch (_err) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
.join(' ');
|
|
16
14
|
exports.defaultLogArgsSerializer = defaultLogArgsSerializer;
|
|
17
15
|
//# sourceMappingURL=const.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/logs/const.ts"],"names":[],"mappings":";;;AAEO,
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/logs/const.ts"],"names":[],"mappings":";;;AAEO,MAAM,wBAAwB,GAAsB,CAAC,IAAI,EAAE,EAAE,CAClE,IAAI;KACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,CAAC,CAAC;AATF,QAAA,wBAAwB,4BAStB","sourcesContent":["import type { LogArgsSerializer } from './types';\n\nexport const defaultLogArgsSerializer: LogArgsSerializer = (args) =>\n args\n .map((arg) => {\n try {\n return String(arg);\n } catch (_err) {\n return '';\n }\n })\n .join(' ');\n"]}
|