@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,123 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_this._state = types_1.UserActionState.Started;
|
|
50
|
-
_this._start();
|
|
51
|
-
return _this;
|
|
3
|
+
const transports_1 = require("../../transports");
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const ItemBuffer_1 = require("../ItemBuffer");
|
|
6
|
+
const const_1 = require("./const");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
class UserAction extends utils_1.Observable {
|
|
9
|
+
constructor({ name, parentId, trigger, transports, attributes, trackUserActionsExcludeItem, importance = const_1.UserActionImportance.Normal, pushEvent, }) {
|
|
10
|
+
super();
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.attributes = attributes;
|
|
13
|
+
this.id = (0, utils_1.genShortID)();
|
|
14
|
+
this.trigger = trigger;
|
|
15
|
+
this.parentId = parentId !== null && parentId !== void 0 ? parentId : this.id;
|
|
16
|
+
this.trackUserActionsExcludeItem = trackUserActionsExcludeItem;
|
|
17
|
+
this.importance = importance;
|
|
18
|
+
this._pushEvent = pushEvent;
|
|
19
|
+
this._itemBuffer = new ItemBuffer_1.ItemBuffer();
|
|
20
|
+
this._transports = transports;
|
|
21
|
+
this._state = types_1.UserActionState.Started;
|
|
22
|
+
this._start();
|
|
52
23
|
}
|
|
53
|
-
|
|
24
|
+
addItem(item) {
|
|
54
25
|
if (this._state === types_1.UserActionState.Started) {
|
|
55
26
|
this._itemBuffer.addItem(item);
|
|
56
27
|
return true;
|
|
57
28
|
}
|
|
58
29
|
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
30
|
+
}
|
|
31
|
+
_start() {
|
|
61
32
|
this._state = types_1.UserActionState.Started;
|
|
62
33
|
if (this._state === types_1.UserActionState.Started) {
|
|
63
34
|
this.startTime = (0, utils_1.dateNow)();
|
|
64
35
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
36
|
+
}
|
|
37
|
+
halt() {
|
|
67
38
|
if (this._state !== types_1.UserActionState.Started) {
|
|
68
39
|
return;
|
|
69
40
|
}
|
|
70
41
|
this._state = types_1.UserActionState.Halted;
|
|
71
42
|
this.notify(this._state);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var _this = this;
|
|
43
|
+
}
|
|
44
|
+
cancel() {
|
|
75
45
|
if (this._state === types_1.UserActionState.Started) {
|
|
76
46
|
// Empty the buffer
|
|
77
|
-
this._itemBuffer.flushBuffer(
|
|
78
|
-
|
|
47
|
+
this._itemBuffer.flushBuffer((item) => {
|
|
48
|
+
this._transports.execute(item);
|
|
79
49
|
});
|
|
80
50
|
}
|
|
81
51
|
this._state = types_1.UserActionState.Cancelled;
|
|
82
52
|
this.notify(this._state);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
var _this = this;
|
|
53
|
+
}
|
|
54
|
+
end() {
|
|
86
55
|
if (this._state === types_1.UserActionState.Cancelled) {
|
|
87
56
|
return;
|
|
88
57
|
}
|
|
89
|
-
|
|
90
|
-
|
|
58
|
+
const endTime = (0, utils_1.dateNow)();
|
|
59
|
+
const duration = endTime - this.startTime;
|
|
91
60
|
this._state = types_1.UserActionState.Ended;
|
|
92
|
-
this._itemBuffer.flushBuffer(
|
|
93
|
-
if (isExcludeFromUserAction(item,
|
|
94
|
-
|
|
61
|
+
this._itemBuffer.flushBuffer((item) => {
|
|
62
|
+
if (isExcludeFromUserAction(item, this.trackUserActionsExcludeItem)) {
|
|
63
|
+
this._transports.execute(item);
|
|
95
64
|
return;
|
|
96
65
|
}
|
|
97
|
-
|
|
98
|
-
parentId:
|
|
99
|
-
name:
|
|
66
|
+
const userActionItem = Object.assign(Object.assign({}, item), { payload: Object.assign(Object.assign({}, item.payload), { action: {
|
|
67
|
+
parentId: this.id,
|
|
68
|
+
name: this.name,
|
|
100
69
|
} }) });
|
|
101
|
-
|
|
70
|
+
this._transports.execute(userActionItem);
|
|
102
71
|
});
|
|
103
72
|
this._state = types_1.UserActionState.Ended;
|
|
104
73
|
this.notify(this._state);
|
|
105
|
-
this._pushEvent(const_1.userActionEventName,
|
|
74
|
+
this._pushEvent(const_1.userActionEventName, Object.assign({ userActionName: this.name, userActionStartTime: this.startTime.toString(), userActionEndTime: endTime.toString(), userActionDuration: duration.toString(), userActionTrigger: this.trigger, userActionImportance: this.importance }, (0, utils_1.stringifyObjectValues)(this.attributes)), undefined, {
|
|
106
75
|
timestampOverwriteMs: this.startTime,
|
|
107
|
-
customPayloadTransformer:
|
|
76
|
+
customPayloadTransformer: (payload) => {
|
|
108
77
|
payload.action = {
|
|
109
|
-
id:
|
|
110
|
-
name:
|
|
78
|
+
id: this.id,
|
|
79
|
+
name: this.name,
|
|
111
80
|
};
|
|
112
81
|
return payload;
|
|
113
82
|
},
|
|
114
83
|
});
|
|
115
|
-
}
|
|
116
|
-
|
|
84
|
+
}
|
|
85
|
+
getState() {
|
|
117
86
|
return this._state;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
}(utils_1.Observable));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
121
89
|
exports.default = UserAction;
|
|
122
90
|
function isExcludeFromUserAction(item, trackUserActionsExcludeItem) {
|
|
123
91
|
return ((trackUserActionsExcludeItem === null || trackUserActionsExcludeItem === void 0 ? void 0 : trackUserActionsExcludeItem(item)) ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAction.js","sourceRoot":"","sources":["../../../../src/api/userActions/userAction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"userAction.js","sourceRoot":"","sources":["../../../../src/api/userActions/userAction.ts"],"names":[],"mappings":";;AAAA,iDAA0F;AAC1F,uCAAqF;AAErF,8CAA2C;AAI3C,mCAAmG;AACnG,mCAAgH;AAEhH,MAAqB,UACnB,SAAQ,kBAAU;IAiBlB,YAAY,EACV,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,UAAU,EACV,2BAA2B,EAC3B,UAAU,GAAG,4BAAoB,CAAC,MAAM,EACxC,SAAS,GAUV;QACC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,IAAI,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAU,EAAiB,CAAC;QACnD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,uBAAe,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,IAAmB;QACzB,IAAI,IAAI,CAAC,MAAM,KAAK,uBAAe,CAAC,OAAO,EAAE,CAAC;YAC5C,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,MAAM,GAAG,uBAAe,CAAC,OAAO,CAAC;QACtC,IAAI,IAAI,CAAC,MAAM,KAAK,uBAAe,CAAC,OAAO,EAAE,CAAC;YAC5C,IAAI,CAAC,SAAS,GAAG,IAAA,eAAO,GAAE,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,MAAM,KAAK,uBAAe,CAAC,OAAO,EAAE,CAAC;YAC5C,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,uBAAe,CAAC,MAAM,CAAC;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,MAAM,KAAK,uBAAe,CAAC,OAAO,EAAE,CAAC;YAC5C,mBAAmB;YACnB,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;gBACpC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,uBAAe,CAAC,SAAS,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,GAAG;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,uBAAe,CAAC,SAAS,EAAE,CAAC;YAC9C,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,IAAA,eAAO,GAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC,SAAU,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,uBAAe,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YACpC,IAAI,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC,2BAA2B,CAAC,EAAE,CAAC;gBACpE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC/B,OAAO;YACT,CAAC;YAED,MAAM,cAAc,GAAG,gCAClB,IAAI,KACP,OAAO,kCACF,IAAI,CAAC,OAAO,KACf,MAAM,EAAE;wBACN,QAAQ,EAAE,IAAI,CAAC,EAAE;wBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;qBAChB,MAEa,CAAC;YAEnB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,uBAAe,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEzB,IAAI,CAAC,UAAU,CACb,2BAAmB,kBAEjB,cAAc,EAAE,IAAI,CAAC,IAAI,EACzB,mBAAmB,EAAE,IAAI,CAAC,SAAU,CAAC,QAAQ,EAAE,EAC/C,iBAAiB,EAAE,OAAO,CAAC,QAAQ,EAAE,EACrC,kBAAkB,EAAE,QAAQ,CAAC,QAAQ,EAAE,EACvC,iBAAiB,EAAE,IAAI,CAAC,OAAQ,EAChC,oBAAoB,EAAE,IAAI,CAAC,UAAU,IAClC,IAAA,6BAAqB,EAAC,IAAI,CAAC,UAAU,CAAC,GAE3C,SAAS,EACT;YACE,oBAAoB,EAAE,IAAI,CAAC,SAAS;YACpC,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE;gBACpC,OAAO,CAAC,MAAM,GAAG;oBACf,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC;gBAEF,OAAO,OAAO,CAAC;YACjB,CAAC;SACF,CACF,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AApJD,6BAoJC;AAED,SAAS,uBAAuB,CAC9B,IAA6B,EAC7B,2BAAqF;IAErF,OAAO,CACL,CAAA,2BAA2B,aAA3B,2BAA2B,uBAA3B,2BAA2B,CAAG,IAAI,CAAC;QACnC,CAAC,IAAI,CAAC,IAAI,KAAK,8BAAiB,CAAC,WAAW,IAAK,IAAI,CAAC,OAA4B,CAAC,IAAI,KAAK,YAAY,CAAC,CAC1G,CAAC;AACJ,CAAC","sourcesContent":["import { type TransportItem, TransportItemType, type Transports } from '../../transports';\nimport { dateNow, genShortID, Observable, stringifyObjectValues } from '../../utils';\nimport type { EventsAPI } from '../events/types';\nimport { ItemBuffer } from '../ItemBuffer';\nimport { type MeasurementEvent } from '../measurements/types';\nimport { type APIEvent } from '../types';\n\nimport { userActionEventName, UserActionImportance, type UserActionImportanceType } from './const';\nimport { type UserActionInternalInterface, UserActionState, type UserActionTransportItemBuffer } from './types';\n\nexport default class UserAction\n extends Observable\n implements UserActionInternalInterface, UserActionTransportItemBuffer\n{\n name: string;\n id: string;\n attributes?: Record<string, string>;\n parentId: string;\n trigger: string;\n importance: UserActionImportanceType;\n startTime?: number;\n trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;\n\n private _state: UserActionState;\n private _itemBuffer: ItemBuffer<TransportItem>;\n private _transports: Transports;\n private _pushEvent: EventsAPI['pushEvent'];\n\n constructor({\n name,\n parentId,\n trigger,\n transports,\n attributes,\n trackUserActionsExcludeItem,\n importance = UserActionImportance.Normal,\n pushEvent,\n }: {\n name: string;\n transports: Transports;\n parentId?: string;\n trigger: string;\n attributes?: Record<string, string>;\n trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;\n importance?: UserActionImportanceType;\n pushEvent: EventsAPI['pushEvent'];\n }) {\n super();\n this.name = name;\n this.attributes = attributes;\n this.id = genShortID();\n this.trigger = trigger;\n this.parentId = parentId ?? this.id;\n this.trackUserActionsExcludeItem = trackUserActionsExcludeItem;\n this.importance = importance;\n this._pushEvent = pushEvent;\n\n this._itemBuffer = new ItemBuffer<TransportItem>();\n this._transports = transports;\n this._state = UserActionState.Started;\n this._start();\n }\n\n addItem(item: TransportItem): boolean {\n if (this._state === UserActionState.Started) {\n this._itemBuffer.addItem(item);\n return true;\n }\n return false;\n }\n\n private _start(): void {\n this._state = UserActionState.Started;\n if (this._state === UserActionState.Started) {\n this.startTime = dateNow();\n }\n }\n\n halt() {\n if (this._state !== UserActionState.Started) {\n return;\n }\n this._state = UserActionState.Halted;\n this.notify(this._state);\n }\n\n cancel() {\n if (this._state === UserActionState.Started) {\n // Empty the buffer\n this._itemBuffer.flushBuffer((item) => {\n this._transports.execute(item);\n });\n }\n\n this._state = UserActionState.Cancelled;\n this.notify(this._state);\n }\n\n end() {\n if (this._state === UserActionState.Cancelled) {\n return;\n }\n\n const endTime = dateNow();\n const duration = endTime - this.startTime!;\n this._state = UserActionState.Ended;\n this._itemBuffer.flushBuffer((item) => {\n if (isExcludeFromUserAction(item, this.trackUserActionsExcludeItem)) {\n this._transports.execute(item);\n return;\n }\n\n const userActionItem = {\n ...item,\n payload: {\n ...item.payload,\n action: {\n parentId: this.id,\n name: this.name,\n },\n },\n } as TransportItem;\n\n this._transports.execute(userActionItem);\n });\n\n this._state = UserActionState.Ended;\n this.notify(this._state);\n\n this._pushEvent(\n userActionEventName,\n {\n userActionName: this.name,\n userActionStartTime: this.startTime!.toString(),\n userActionEndTime: endTime.toString(),\n userActionDuration: duration.toString(),\n userActionTrigger: this.trigger!,\n userActionImportance: this.importance,\n ...stringifyObjectValues(this.attributes),\n },\n undefined,\n {\n timestampOverwriteMs: this.startTime,\n customPayloadTransformer: (payload) => {\n payload.action = {\n id: this.id,\n name: this.name,\n };\n\n return payload;\n },\n }\n );\n }\n\n getState(): UserActionState {\n return this._state;\n }\n}\n\nfunction isExcludeFromUserAction(\n item: TransportItem<APIEvent>,\n trackUserActionsExcludeItem: ((item: TransportItem<APIEvent>) => boolean) | undefined\n) {\n return (\n trackUserActionsExcludeItem?.(item) ||\n (item.type === TransportItemType.MEASUREMENT && (item.payload as MeasurementEvent).type === 'web-vitals')\n );\n}\n"]}
|
package/dist/cjs/api/utils.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shouldIgnoreEvent = shouldIgnoreEvent;
|
|
4
|
-
|
|
4
|
+
const is_1 = require("../utils/is");
|
|
5
5
|
function shouldIgnoreEvent(patterns, msg) {
|
|
6
|
-
return patterns.some(
|
|
6
|
+
return patterns.some((pattern) => {
|
|
7
7
|
return (0, is_1.isString)(pattern) ? msg.includes(pattern) : !!msg.match(pattern);
|
|
8
8
|
});
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/api/utils.ts"],"names":[],"mappings":";;AAGA,8CAIC;AAND,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/api/utils.ts"],"names":[],"mappings":";;AAGA,8CAIC;AAND,oCAAuC;AAEvC,SAAgB,iBAAiB,CAAC,QAAkB,EAAE,GAAW;IAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAC/B,OAAO,IAAA,aAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Patterns } from '../config/types';\nimport { isString } from '../utils/is';\n\nexport function shouldIgnoreEvent(patterns: Patterns, msg: string): boolean {\n return patterns.some((pattern) => {\n return isString(pattern) ? msg.includes(pattern) : !!msg.match(pattern);\n });\n}\n"]}
|
|
@@ -1,57 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.BaseExtension = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const internalLogger_1 = require("../internalLogger");
|
|
5
|
+
const unpatchedConsole_1 = require("../unpatchedConsole");
|
|
6
|
+
class BaseExtension {
|
|
7
|
+
constructor() {
|
|
17
8
|
this.unpatchedConsole = unpatchedConsole_1.defaultUnpatchedConsole;
|
|
18
9
|
this.internalLogger = internalLogger_1.defaultInternalLogger;
|
|
19
10
|
this.config = {};
|
|
20
11
|
this.metas = {};
|
|
21
12
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
(_a = this.internalLogger).info.apply(_a, __spreadArray(["".concat(this.name, "\n")], args, false));
|
|
37
|
-
};
|
|
38
|
-
BaseExtension.prototype.logWarn = function () {
|
|
39
|
-
var _a;
|
|
40
|
-
var args = [];
|
|
41
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
42
|
-
args[_i] = arguments[_i];
|
|
43
|
-
}
|
|
44
|
-
(_a = this.internalLogger).warn.apply(_a, __spreadArray(["".concat(this.name, "\n")], args, false));
|
|
45
|
-
};
|
|
46
|
-
BaseExtension.prototype.logError = function () {
|
|
47
|
-
var _a;
|
|
48
|
-
var args = [];
|
|
49
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
50
|
-
args[_i] = arguments[_i];
|
|
51
|
-
}
|
|
52
|
-
(_a = this.internalLogger).error.apply(_a, __spreadArray(["".concat(this.name, "\n")], args, false));
|
|
53
|
-
};
|
|
54
|
-
return BaseExtension;
|
|
55
|
-
}());
|
|
13
|
+
logDebug(...args) {
|
|
14
|
+
this.internalLogger.debug(`${this.name}\n`, ...args);
|
|
15
|
+
}
|
|
16
|
+
logInfo(...args) {
|
|
17
|
+
this.internalLogger.info(`${this.name}\n`, ...args);
|
|
18
|
+
}
|
|
19
|
+
logWarn(...args) {
|
|
20
|
+
this.internalLogger.warn(`${this.name}\n`, ...args);
|
|
21
|
+
}
|
|
22
|
+
logError(...args) {
|
|
23
|
+
this.internalLogger.error(`${this.name}\n`, ...args);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
56
26
|
exports.BaseExtension = BaseExtension;
|
|
57
27
|
//# sourceMappingURL=baseExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseExtension.js","sourceRoot":"","sources":["../../../src/extensions/baseExtension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"baseExtension.js","sourceRoot":"","sources":["../../../src/extensions/baseExtension.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAE1D,0DAA8D;AAI9D,MAAsB,aAAa;IAAnC;QAIE,qBAAgB,GAAG,0CAAuB,CAAC;QAC3C,mBAAc,GAAG,sCAAqB,CAAC;QACvC,WAAM,GAAG,EAAY,CAAC;QACtB,UAAK,GAAG,EAAW,CAAC;IAiBtB,CAAC;IAfC,QAAQ,CAAC,GAAG,IAAe;QACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,CAAC,GAAG,IAAe;QACxB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,CAAC,GAAG,IAAe;QACxB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ,CAAC,GAAG,IAAe;QACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACvD,CAAC;CACF;AAxBD,sCAwBC","sourcesContent":["import type { Config } from '../config';\nimport { defaultInternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport { defaultUnpatchedConsole } from '../unpatchedConsole';\n\nimport type { Extension } from './types';\n\nexport abstract class BaseExtension implements Extension {\n abstract readonly name: string;\n abstract readonly version: string;\n\n unpatchedConsole = defaultUnpatchedConsole;\n internalLogger = defaultInternalLogger;\n config = {} as Config;\n metas = {} as Metas;\n\n logDebug(...args: unknown[]): void {\n this.internalLogger.debug(`${this.name}\\n`, ...args);\n }\n\n logInfo(...args: unknown[]): void {\n this.internalLogger.info(`${this.name}\\n`, ...args);\n }\n\n logWarn(...args: unknown[]): void {\n this.internalLogger.warn(`${this.name}\\n`, ...args);\n }\n\n logError(...args: unknown[]): void {\n this.internalLogger.error(`${this.name}\\n`, ...args);\n }\n}\n"]}
|
package/dist/cjs/initialize.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initializeFaro = initializeFaro;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const api_1 = require("./api");
|
|
5
|
+
const instrumentations_1 = require("./instrumentations");
|
|
6
|
+
const internalLogger_1 = require("./internalLogger");
|
|
7
|
+
const metas_1 = require("./metas");
|
|
8
|
+
const sdk_1 = require("./sdk");
|
|
9
|
+
const transports_1 = require("./transports");
|
|
10
|
+
const unpatchedConsole_1 = require("./unpatchedConsole");
|
|
11
11
|
function initializeFaro(config) {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const unpatchedConsole = (0, unpatchedConsole_1.initializeUnpatchedConsole)(config);
|
|
13
|
+
const internalLogger = (0, internalLogger_1.initializeInternalLogger)(unpatchedConsole, config);
|
|
14
14
|
if ((0, sdk_1.isInternalFaroOnGlobalObject)() && !config.isolate) {
|
|
15
15
|
internalLogger.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');
|
|
16
16
|
return undefined;
|
|
17
17
|
}
|
|
18
18
|
internalLogger.debug('Initializing');
|
|
19
19
|
// Initializing the APIs
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const metas = (0, metas_1.initializeMetas)(unpatchedConsole, internalLogger, config);
|
|
21
|
+
const transports = (0, transports_1.initializeTransports)(unpatchedConsole, internalLogger, config, metas);
|
|
22
|
+
const api = (0, api_1.initializeAPI)(unpatchedConsole, internalLogger, config, metas, transports);
|
|
23
|
+
const instrumentations = (0, instrumentations_1.initializeInstrumentations)(unpatchedConsole, internalLogger, config, metas, transports, api);
|
|
24
|
+
const faro = (0, sdk_1.registerFaro)(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations);
|
|
25
25
|
// make sure Faro is initialized before registering default metas, instrumentations, transports etc.
|
|
26
26
|
(0, metas_1.registerInitialMetas)(faro);
|
|
27
27
|
(0, transports_1.registerInitialTransports)(faro);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":";;AAUA,wCA2BC;AArCD
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":";;AAUA,wCA2BC;AArCD,+BAAsC;AAEtC,yDAAiG;AACjG,qDAA4D;AAC5D,mCAAgE;AAChE,+BAAmE;AAEnE,6CAA+E;AAC/E,yDAAgE;AAEhE,SAAgB,cAAc,CAAC,MAAc;IAC3C,MAAM,gBAAgB,GAAG,IAAA,6CAA0B,EAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,cAAc,GAAG,IAAA,yCAAwB,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAE1E,IAAI,IAAA,kCAA4B,GAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtD,cAAc,CAAC,KAAK,CAClB,oIAAoI,CACrI,CAAC;QAEF,OAAO,SAAU,CAAC;IACpB,CAAC;IAED,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAErC,wBAAwB;IACxB,MAAM,KAAK,GAAG,IAAA,uBAAe,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACxE,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACzF,MAAM,GAAG,GAAG,IAAA,mBAAa,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACvF,MAAM,gBAAgB,GAAG,IAAA,6CAA0B,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IACtH,MAAM,IAAI,GAAG,IAAA,kBAAY,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAE9G,oGAAoG;IACpG,IAAA,4BAAoB,EAAC,IAAI,CAAC,CAAC;IAC3B,IAAA,sCAAyB,EAAC,IAAI,CAAC,CAAC;IAChC,IAAA,kDAA+B,EAAC,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { initializeAPI } from './api';\nimport type { Config } from './config';\nimport { initializeInstrumentations, registerInitialInstrumentations } from './instrumentations';\nimport { initializeInternalLogger } from './internalLogger';\nimport { initializeMetas, registerInitialMetas } from './metas';\nimport { isInternalFaroOnGlobalObject, registerFaro } from './sdk';\nimport type { Faro } from './sdk';\nimport { initializeTransports, registerInitialTransports } from './transports';\nimport { initializeUnpatchedConsole } from './unpatchedConsole';\n\nexport function initializeFaro(config: Config): Faro {\n const unpatchedConsole = initializeUnpatchedConsole(config);\n const internalLogger = initializeInternalLogger(unpatchedConsole, config);\n\n if (isInternalFaroOnGlobalObject() && !config.isolate) {\n internalLogger.error(\n 'Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the \"isolate\" property'\n );\n\n return undefined!;\n }\n\n internalLogger.debug('Initializing');\n\n // Initializing the APIs\n const metas = initializeMetas(unpatchedConsole, internalLogger, config);\n const transports = initializeTransports(unpatchedConsole, internalLogger, config, metas);\n const api = initializeAPI(unpatchedConsole, internalLogger, config, metas, transports);\n const instrumentations = initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api);\n const faro = registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations);\n\n // make sure Faro is initialized before registering default metas, instrumentations, transports etc.\n registerInitialMetas(faro);\n registerInitialTransports(faro);\n registerInitialInstrumentations(faro);\n\n return faro;\n}\n"]}
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.BaseInstrumentation = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_this.transports = {};
|
|
26
|
-
return _this;
|
|
4
|
+
const extensions_1 = require("../extensions");
|
|
5
|
+
class BaseInstrumentation extends extensions_1.BaseExtension {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.api = {};
|
|
9
|
+
this.transports = {};
|
|
27
10
|
}
|
|
28
|
-
|
|
29
|
-
}(extensions_1.BaseExtension));
|
|
11
|
+
}
|
|
30
12
|
exports.BaseInstrumentation = BaseInstrumentation;
|
|
31
13
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/instrumentations/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/instrumentations/base.ts"],"names":[],"mappings":";;;AACA,8CAA8C;AAK9C,MAAsB,mBAAoB,SAAQ,0BAAa;IAA/D;;QACE,QAAG,GAAQ,EAAS,CAAC;QACrB,eAAU,GAAe,EAAgB,CAAC;IAG5C,CAAC;CAAA;AALD,kDAKC","sourcesContent":["import type { API } from '../api';\nimport { BaseExtension } from '../extensions';\nimport type { Transports } from '../transports';\n\nimport type { Instrumentation } from './types';\n\nexport abstract class BaseInstrumentation extends BaseExtension implements Instrumentation {\n api: API = {} as API;\n transports: Transports = {} as Transports;\n\n abstract initialize(): void;\n}\n"]}
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.initializeInstrumentations = initializeInstrumentations;
|
|
13
4
|
function initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api) {
|
|
14
5
|
internalLogger.debug('Initializing instrumentations');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var newInstrumentations = [];
|
|
18
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
19
|
-
newInstrumentations[_i] = arguments[_i];
|
|
20
|
-
}
|
|
6
|
+
const instrumentations = [];
|
|
7
|
+
const add = (...newInstrumentations) => {
|
|
21
8
|
internalLogger.debug('Adding instrumentations');
|
|
22
|
-
newInstrumentations.forEach(
|
|
23
|
-
internalLogger.debug(
|
|
24
|
-
|
|
9
|
+
newInstrumentations.forEach((newInstrumentation) => {
|
|
10
|
+
internalLogger.debug(`Adding "${newInstrumentation.name}" instrumentation`);
|
|
11
|
+
const exists = instrumentations.some((existingInstrumentation) => existingInstrumentation.name === newInstrumentation.name);
|
|
25
12
|
if (exists) {
|
|
26
|
-
internalLogger.warn(
|
|
13
|
+
internalLogger.warn(`Instrumentation ${newInstrumentation.name} is already added`);
|
|
27
14
|
return;
|
|
28
15
|
}
|
|
29
16
|
newInstrumentation.unpatchedConsole = unpatchedConsole;
|
|
@@ -36,23 +23,19 @@ function initializeInstrumentations(unpatchedConsole, internalLogger, config, me
|
|
|
36
23
|
newInstrumentation.initialize();
|
|
37
24
|
});
|
|
38
25
|
};
|
|
39
|
-
|
|
40
|
-
var instrumentationsToRemove = [];
|
|
41
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
42
|
-
instrumentationsToRemove[_i] = arguments[_i];
|
|
43
|
-
}
|
|
26
|
+
const remove = (...instrumentationsToRemove) => {
|
|
44
27
|
internalLogger.debug('Removing instrumentations');
|
|
45
|
-
instrumentationsToRemove.forEach(
|
|
28
|
+
instrumentationsToRemove.forEach((instrumentationToRemove) => {
|
|
46
29
|
var _a, _b;
|
|
47
|
-
internalLogger.debug(
|
|
48
|
-
|
|
30
|
+
internalLogger.debug(`Removing "${instrumentationToRemove.name}" instrumentation`);
|
|
31
|
+
const existingInstrumentationIndex = instrumentations.reduce((acc, existingInstrumentation, existingTransportIndex) => {
|
|
49
32
|
if (acc === null && existingInstrumentation.name === instrumentationToRemove.name) {
|
|
50
33
|
return existingTransportIndex;
|
|
51
34
|
}
|
|
52
35
|
return null;
|
|
53
36
|
}, null);
|
|
54
37
|
if (existingInstrumentationIndex === null) {
|
|
55
|
-
internalLogger.warn(
|
|
38
|
+
internalLogger.warn(`Instrumentation "${instrumentationToRemove.name}" is not added`);
|
|
56
39
|
return;
|
|
57
40
|
}
|
|
58
41
|
(_b = (_a = instrumentations[existingInstrumentationIndex]).destroy) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
@@ -60,11 +43,11 @@ function initializeInstrumentations(unpatchedConsole, internalLogger, config, me
|
|
|
60
43
|
});
|
|
61
44
|
};
|
|
62
45
|
return {
|
|
63
|
-
add
|
|
46
|
+
add,
|
|
64
47
|
get instrumentations() {
|
|
65
|
-
return
|
|
48
|
+
return [...instrumentations];
|
|
66
49
|
},
|
|
67
|
-
remove
|
|
50
|
+
remove,
|
|
68
51
|
};
|
|
69
52
|
}
|
|
70
53
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/instrumentations/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/instrumentations/initialize.ts"],"names":[],"mappings":";;AASA,gEA6EC;AA7ED,SAAgB,0BAA0B,CACxC,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,GAAQ;IAER,cAAc,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAEtD,MAAM,gBAAgB,GAAsB,EAAE,CAAC;IAE/C,MAAM,GAAG,GAA4B,CAAC,GAAG,mBAAmB,EAAE,EAAE;QAC9D,cAAc,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAEhD,mBAAmB,CAAC,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE;YACjD,cAAc,CAAC,KAAK,CAAC,WAAW,kBAAkB,CAAC,IAAI,mBAAmB,CAAC,CAAC;YAE5E,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAClC,CAAC,uBAAuB,EAAE,EAAE,CAAC,uBAAuB,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,CACtF,CAAC;YAEF,IAAI,MAAM,EAAE,CAAC;gBACX,cAAc,CAAC,IAAI,CAAC,mBAAmB,kBAAkB,CAAC,IAAI,mBAAmB,CAAC,CAAC;gBAEnF,OAAO;YACT,CAAC;YAED,kBAAkB,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;YACvD,kBAAkB,CAAC,cAAc,GAAG,cAAc,CAAC;YACnD,kBAAkB,CAAC,MAAM,GAAG,MAAM,CAAC;YACnC,kBAAkB,CAAC,KAAK,GAAG,KAAK,CAAC;YACjC,kBAAkB,CAAC,UAAU,GAAG,UAAU,CAAC;YAC3C,kBAAkB,CAAC,GAAG,GAAG,GAAG,CAAC;YAE7B,gBAAgB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAE1C,kBAAkB,CAAC,UAAU,EAAE,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,MAAM,GAA+B,CAAC,GAAG,wBAAwB,EAAE,EAAE;QACzE,cAAc,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAElD,wBAAwB,CAAC,OAAO,CAAC,CAAC,uBAAuB,EAAE,EAAE;;YAC3D,cAAc,CAAC,KAAK,CAAC,aAAa,uBAAuB,CAAC,IAAI,mBAAmB,CAAC,CAAC;YAEnF,MAAM,4BAA4B,GAAG,gBAAgB,CAAC,MAAM,CAC1D,CAAC,GAAG,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,EAAE;gBACvD,IAAI,GAAG,KAAK,IAAI,IAAI,uBAAuB,CAAC,IAAI,KAAK,uBAAuB,CAAC,IAAI,EAAE,CAAC;oBAClF,OAAO,sBAAsB,CAAC;gBAChC,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,EACD,IAAI,CACL,CAAC;YAEF,IAAI,4BAA4B,KAAK,IAAI,EAAE,CAAC;gBAC1C,cAAc,CAAC,IAAI,CAAC,oBAAoB,uBAAuB,CAAC,IAAI,gBAAgB,CAAC,CAAC;gBAEtF,OAAO;YACT,CAAC;YAED,MAAA,MAAA,gBAAgB,CAAC,4BAA4B,CAAE,EAAC,OAAO,kDAAI,CAAC;YAE5D,gBAAgB,CAAC,MAAM,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,GAAG;QACH,IAAI,gBAAgB;YAClB,OAAO,CAAC,GAAG,gBAAgB,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["import type { API } from '../api';\nimport 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 type { Instrumentation, Instrumentations } from './types';\n\nexport function initializeInstrumentations(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n api: API\n): Instrumentations {\n internalLogger.debug('Initializing instrumentations');\n\n const instrumentations: Instrumentation[] = [];\n\n const add: Instrumentations['add'] = (...newInstrumentations) => {\n internalLogger.debug('Adding instrumentations');\n\n newInstrumentations.forEach((newInstrumentation) => {\n internalLogger.debug(`Adding \"${newInstrumentation.name}\" instrumentation`);\n\n const exists = instrumentations.some(\n (existingInstrumentation) => existingInstrumentation.name === newInstrumentation.name\n );\n\n if (exists) {\n internalLogger.warn(`Instrumentation ${newInstrumentation.name} is already added`);\n\n return;\n }\n\n newInstrumentation.unpatchedConsole = unpatchedConsole;\n newInstrumentation.internalLogger = internalLogger;\n newInstrumentation.config = config;\n newInstrumentation.metas = metas;\n newInstrumentation.transports = transports;\n newInstrumentation.api = api;\n\n instrumentations.push(newInstrumentation);\n\n newInstrumentation.initialize();\n });\n };\n\n const remove: Instrumentations['remove'] = (...instrumentationsToRemove) => {\n internalLogger.debug('Removing instrumentations');\n\n instrumentationsToRemove.forEach((instrumentationToRemove) => {\n internalLogger.debug(`Removing \"${instrumentationToRemove.name}\" instrumentation`);\n\n const existingInstrumentationIndex = instrumentations.reduce<number | null>(\n (acc, existingInstrumentation, existingTransportIndex) => {\n if (acc === null && existingInstrumentation.name === instrumentationToRemove.name) {\n return existingTransportIndex;\n }\n\n return null;\n },\n null\n );\n\n if (existingInstrumentationIndex === null) {\n internalLogger.warn(`Instrumentation \"${instrumentationToRemove.name}\" is not added`);\n\n return;\n }\n\n instrumentations[existingInstrumentationIndex]!.destroy?.();\n\n instrumentations.splice(existingInstrumentationIndex, 1);\n });\n };\n\n return {\n add,\n get instrumentations() {\n return [...instrumentations];\n },\n remove,\n };\n}\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerInitialInstrumentations = registerInitialInstrumentations;
|
|
4
4
|
function registerInitialInstrumentations(faro) {
|
|
5
|
-
|
|
6
|
-
(_a = faro.instrumentations).add.apply(_a, faro.config.instrumentations);
|
|
5
|
+
faro.instrumentations.add(...faro.config.instrumentations);
|
|
7
6
|
}
|
|
8
7
|
//# sourceMappingURL=registerInitial.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/instrumentations/registerInitial.ts"],"names":[],"mappings":";;AAEA,0EAEC;AAFD,SAAgB,+BAA+B,CAAC,IAAU
|
|
1
|
+
{"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/instrumentations/registerInitial.ts"],"names":[],"mappings":";;AAEA,0EAEC;AAFD,SAAgB,+BAA+B,CAAC,IAAU;IACxD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import type { Faro } from '../sdk';\n\nexport function registerInitialInstrumentations(faro: Faro): void {\n faro.instrumentations.add(...faro.config.instrumentations);\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultInternalLoggerLevel = exports.defaultInternalLogger = exports.defaultInternalLoggerPrefix = exports.InternalLoggerLevel = void 0;
|
|
4
|
-
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
5
|
var InternalLoggerLevel;
|
|
6
6
|
(function (InternalLoggerLevel) {
|
|
7
7
|
InternalLoggerLevel[InternalLoggerLevel["OFF"] = 0] = "OFF";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/internalLogger/const.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/internalLogger/const.ts"],"names":[],"mappings":";;;AAAA,oCAAgC;AAIhC,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,2DAAO,CAAA;IACP,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,6DAAQ,CAAA;IACR,mEAAW,CAAA;AACb,CAAC,EANW,mBAAmB,mCAAnB,mBAAmB,QAM9B;AAEY,QAAA,2BAA2B,GAAG,MAAM,CAAC;AAErC,QAAA,qBAAqB,GAAmB;IACnD,KAAK,EAAE,YAAI;IACX,KAAK,EAAE,YAAI;IACX,IAAI,EAAE,YAAI;IACV,MAAM,EAAE,mCAA2B;IACnC,IAAI,EAAE,YAAI;CACF,CAAC;AAEE,QAAA,0BAA0B,GAAG,mBAAmB,CAAC,KAAK,CAAC","sourcesContent":["import { noop } from '../utils';\n\nimport type { InternalLogger } from './types';\n\nexport enum InternalLoggerLevel {\n OFF = 0,\n ERROR = 1,\n WARN = 2,\n INFO = 3,\n VERBOSE = 4,\n}\n\nexport const defaultInternalLoggerPrefix = 'Faro';\n\nexport const defaultInternalLogger: InternalLogger = {\n debug: noop,\n error: noop,\n info: noop,\n prefix: defaultInternalLoggerPrefix,\n warn: noop,\n} as const;\n\nexport const defaultInternalLoggerLevel = InternalLoggerLevel.ERROR;\n"]}
|