@grafana/faro-core 1.0.0-beta3 → 1.0.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/README.md +14 -12
- package/dist/bundle/faro-core.iife.js +1 -0
- package/dist/cjs/api/events/initialize.js +1 -1
- package/dist/cjs/api/events/initialize.js.map +1 -1
- package/dist/cjs/api/exceptions/initialize.js +1 -1
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/api/initialize.js +3 -3
- package/dist/cjs/api/initialize.js.map +1 -1
- package/dist/cjs/api/logs/initialize.js +1 -1
- package/dist/cjs/api/logs/initialize.js.map +1 -1
- package/dist/cjs/api/measurements/initialize.js +1 -1
- package/dist/cjs/api/measurements/initialize.js.map +1 -1
- package/dist/cjs/api/meta/initialize.js +14 -1
- package/dist/cjs/api/meta/initialize.js.map +1 -1
- package/dist/cjs/api/meta/types.js.map +1 -1
- package/dist/cjs/api/traces/initialize.js +1 -1
- package/dist/cjs/api/traces/initialize.js.map +1 -1
- package/dist/cjs/config/types.js.map +1 -1
- package/dist/cjs/{utils/extensions.js → extensions/baseExtension.js} +15 -17
- package/dist/cjs/extensions/baseExtension.js.map +1 -0
- package/dist/cjs/extensions/index.js +6 -0
- package/dist/cjs/extensions/index.js.map +1 -0
- package/dist/cjs/extensions/types.js +3 -0
- package/dist/cjs/extensions/types.js.map +1 -0
- package/dist/cjs/index.js +12 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/initialize.js +11 -21
- package/dist/cjs/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/base.js +6 -3
- package/dist/cjs/instrumentations/base.js.map +1 -1
- package/dist/cjs/instrumentations/index.js +3 -1
- package/dist/cjs/instrumentations/index.js.map +1 -1
- package/dist/cjs/instrumentations/initialize.js +8 -2
- package/dist/cjs/instrumentations/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/registerInitial.js +9 -0
- package/dist/cjs/instrumentations/registerInitial.js.map +1 -0
- package/dist/cjs/instrumentations/types.js.map +1 -1
- package/dist/cjs/internalLogger/const.js.map +1 -1
- package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/cjs/internalLogger/index.js +2 -1
- package/dist/cjs/internalLogger/index.js.map +1 -1
- package/dist/cjs/internalLogger/initialize.js.map +1 -1
- package/dist/cjs/metas/index.js +3 -1
- package/dist/cjs/metas/index.js.map +1 -1
- package/dist/cjs/metas/initialize.js +4 -30
- package/dist/cjs/metas/initialize.js.map +1 -1
- package/dist/cjs/metas/registerInitial.js +42 -0
- package/dist/cjs/metas/registerInitial.js.map +1 -0
- package/dist/cjs/metas/types.js.map +1 -1
- package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/index.js +3 -3
- package/dist/cjs/sdk/index.js.map +1 -1
- package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/{register.js → registerFaro.js} +13 -3
- package/dist/cjs/sdk/registerFaro.js.map +1 -0
- package/dist/cjs/semantic.js +1 -0
- package/dist/cjs/semantic.js.map +1 -1
- package/dist/cjs/testUtils/mockConfig.js.map +1 -1
- package/dist/cjs/transports/base.js +2 -2
- package/dist/cjs/transports/base.js.map +1 -1
- package/dist/cjs/transports/index.js +3 -1
- package/dist/cjs/transports/index.js.map +1 -1
- package/dist/cjs/transports/initialize.js +5 -4
- package/dist/cjs/transports/initialize.js.map +1 -1
- package/dist/cjs/transports/registerInitial.js +11 -0
- package/dist/cjs/transports/registerInitial.js.map +1 -0
- package/dist/cjs/transports/types.js.map +1 -1
- package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
- package/dist/cjs/utils/deepEqual.js +58 -5
- package/dist/cjs/utils/deepEqual.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -3
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/shortId.js.map +1 -1
- package/dist/cjs/version.js +2 -2
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/api/events/initialize.js +1 -1
- package/dist/esm/api/events/initialize.js.map +1 -1
- package/dist/esm/api/exceptions/initialize.js +1 -1
- package/dist/esm/api/exceptions/initialize.js.map +1 -1
- package/dist/esm/api/initialize.js +3 -3
- package/dist/esm/api/initialize.js.map +1 -1
- package/dist/esm/api/logs/initialize.js +1 -1
- package/dist/esm/api/logs/initialize.js.map +1 -1
- package/dist/esm/api/measurements/initialize.js +1 -1
- package/dist/esm/api/measurements/initialize.js.map +1 -1
- package/dist/esm/api/meta/initialize.js +14 -1
- package/dist/esm/api/meta/initialize.js.map +1 -1
- package/dist/esm/api/meta/types.js.map +1 -1
- package/dist/esm/api/traces/initialize.js +1 -1
- package/dist/esm/api/traces/initialize.js.map +1 -1
- package/dist/esm/config/types.js.map +1 -1
- package/dist/esm/extensions/baseExtension.js +23 -0
- package/dist/esm/extensions/baseExtension.js.map +1 -0
- package/dist/esm/extensions/index.js +2 -0
- package/dist/esm/extensions/index.js.map +1 -0
- package/dist/esm/extensions/types.js +2 -0
- package/dist/esm/extensions/types.js.map +1 -0
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/initialize.js +14 -23
- package/dist/esm/initialize.js.map +1 -1
- package/dist/esm/instrumentations/base.js +6 -1
- package/dist/esm/instrumentations/base.js.map +1 -1
- package/dist/esm/instrumentations/index.js +1 -0
- package/dist/esm/instrumentations/index.js.map +1 -1
- package/dist/esm/instrumentations/initialize.js +8 -2
- package/dist/esm/instrumentations/initialize.js.map +1 -1
- package/dist/esm/instrumentations/registerInitial.js +4 -0
- package/dist/esm/instrumentations/registerInitial.js.map +1 -0
- package/dist/esm/instrumentations/types.js.map +1 -1
- package/dist/esm/internalLogger/const.js.map +1 -1
- package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/esm/internalLogger/index.js +1 -1
- package/dist/esm/internalLogger/index.js.map +1 -1
- package/dist/esm/internalLogger/initialize.js.map +1 -1
- package/dist/esm/metas/index.js +1 -0
- package/dist/esm/metas/index.js.map +1 -1
- package/dist/esm/metas/initialize.js +4 -18
- package/dist/esm/metas/initialize.js.map +1 -1
- package/dist/esm/metas/registerInitial.js +25 -0
- package/dist/esm/metas/registerInitial.js.map +1 -0
- package/dist/esm/metas/types.js.map +1 -1
- package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
- package/dist/esm/sdk/index.js +1 -1
- package/dist/esm/sdk/index.js.map +1 -1
- package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/esm/sdk/registerFaro.js +21 -0
- package/dist/esm/sdk/registerFaro.js.map +1 -0
- package/dist/esm/semantic.js +1 -0
- package/dist/esm/semantic.js.map +1 -1
- package/dist/esm/testUtils/mockConfig.js.map +1 -1
- package/dist/esm/transports/base.js +1 -1
- package/dist/esm/transports/base.js.map +1 -1
- package/dist/esm/transports/index.js +1 -0
- package/dist/esm/transports/index.js.map +1 -1
- package/dist/esm/transports/initialize.js +5 -4
- package/dist/esm/transports/initialize.js.map +1 -1
- package/dist/esm/transports/registerInitial.js +6 -0
- package/dist/esm/transports/registerInitial.js.map +1 -0
- package/dist/esm/transports/types.js.map +1 -1
- package/dist/esm/unpatchedConsole/initialize.js.map +1 -1
- package/dist/esm/utils/deepEqual.js +55 -2
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/shortId.js.map +1 -1
- package/dist/esm/version.js +2 -2
- package/dist/esm/version.js.map +1 -1
- package/dist/{cjs → types}/api/events/index.d.ts +0 -0
- package/dist/{cjs → types}/api/events/initialize.d.ts +2 -1
- package/dist/{cjs → types}/api/events/types.d.ts +0 -0
- package/dist/{cjs → types}/api/exceptions/const.d.ts +0 -0
- package/dist/{cjs → types}/api/exceptions/index.d.ts +0 -0
- package/dist/{cjs → types}/api/exceptions/initialize.d.ts +2 -1
- package/dist/{cjs → types}/api/exceptions/types.d.ts +0 -0
- package/dist/{cjs → types}/api/index.d.ts +0 -0
- package/dist/types/api/initialize.d.ts +7 -0
- package/dist/{cjs → types}/api/logs/index.d.ts +0 -0
- package/dist/{esm → types}/api/logs/initialize.d.ts +2 -1
- package/dist/{cjs → types}/api/logs/types.d.ts +0 -0
- package/dist/{cjs → types}/api/measurements/index.d.ts +0 -0
- package/dist/{esm → types}/api/measurements/initialize.d.ts +2 -1
- package/dist/{cjs → types}/api/measurements/types.d.ts +0 -0
- package/dist/{cjs → types}/api/meta/index.d.ts +0 -0
- package/dist/types/api/meta/initialize.d.ts +7 -0
- package/dist/types/api/meta/types.d.ts +10 -0
- package/dist/{cjs → types}/api/traces/index.d.ts +0 -0
- package/dist/types/api/traces/initialize.d.ts +7 -0
- package/dist/{cjs → types}/api/traces/types.d.ts +0 -0
- package/dist/{cjs → types}/api/types.d.ts +0 -0
- package/dist/{cjs → types}/config/const.d.ts +0 -0
- package/dist/{cjs → types}/config/index.d.ts +0 -0
- package/dist/{esm → types}/config/types.d.ts +2 -1
- package/dist/types/extensions/baseExtension.d.ts +15 -0
- package/dist/types/extensions/index.d.ts +2 -0
- package/dist/types/extensions/types.d.ts +16 -0
- package/dist/{cjs → types}/globalObject/globalObject.d.ts +0 -0
- package/dist/{cjs → types}/globalObject/index.d.ts +0 -0
- package/dist/{cjs → types}/index.d.ts +7 -5
- package/dist/{cjs → types}/initialize.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/base.d.ts +5 -1
- package/dist/{cjs → types}/instrumentations/index.d.ts +1 -0
- package/dist/types/instrumentations/initialize.d.ts +8 -0
- package/dist/types/instrumentations/registerInitial.d.ts +2 -0
- package/dist/{cjs → types}/instrumentations/types.d.ts +5 -1
- package/dist/{cjs → types}/internalLogger/const.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/createInternalLogger.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/index.d.ts +1 -1
- package/dist/{cjs → types}/internalLogger/initialize.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/types.d.ts +0 -0
- package/dist/{cjs → types}/metas/index.d.ts +2 -1
- package/dist/types/metas/initialize.d.ts +5 -0
- package/dist/types/metas/registerInitial.d.ts +2 -0
- package/dist/{cjs → types}/metas/types.d.ts +4 -1
- package/dist/{cjs → types}/sdk/const.d.ts +0 -0
- package/dist/{cjs → types}/sdk/faroGlobalObject.d.ts +0 -0
- package/dist/{cjs → types}/sdk/index.d.ts +1 -1
- package/dist/{cjs → types}/sdk/internalFaroGlobalObject.d.ts +0 -0
- package/dist/{esm/sdk/types.d.ts → types/sdk/registerFaro.d.ts} +3 -11
- package/dist/{cjs → types}/sdk/types.d.ts +0 -0
- package/dist/{cjs → types}/semantic.d.ts +1 -0
- package/dist/{cjs → types}/testUtils/index.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockConfig.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockInternalLogger.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockStacktraceParser.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockTransport.d.ts +1 -1
- package/dist/{cjs → types}/testUtils/testPromise.d.ts +0 -0
- package/dist/{cjs → types}/transports/base.d.ts +1 -1
- package/dist/{cjs → types}/transports/const.d.ts +0 -0
- package/dist/{cjs → types}/transports/index.d.ts +1 -0
- package/dist/{cjs → types}/transports/initialize.d.ts +3 -1
- package/dist/types/transports/registerInitial.d.ts +2 -0
- package/dist/{esm → types}/transports/types.d.ts +1 -1
- package/dist/{cjs → types}/transports/utils.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/const.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/index.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/initialize.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/types.d.ts +0 -0
- package/dist/{cjs → types}/utils/baseObject.d.ts +0 -0
- package/dist/types/utils/deepEqual.d.ts +1 -0
- package/dist/{cjs → types}/utils/getCurrentTimestamp.d.ts +0 -0
- package/dist/{cjs → types}/utils/index.d.ts +0 -2
- package/dist/{cjs → types}/utils/is.d.ts +0 -0
- package/dist/{cjs → types}/utils/logLevels.d.ts +0 -0
- package/dist/{cjs → types}/utils/noop.d.ts +0 -0
- package/dist/{cjs → types}/utils/promiseBuffer.d.ts +0 -0
- package/dist/{cjs → types}/utils/shortId.d.ts +0 -0
- package/dist/types/version.d.ts +1 -0
- package/package.json +21 -15
- package/dist/cjs/api/events/initialize.test.d.ts +0 -1
- package/dist/cjs/api/events/initialize.test.js +0 -92
- package/dist/cjs/api/events/initialize.test.js.map +0 -1
- package/dist/cjs/api/exceptions/initialize.test.d.ts +0 -1
- package/dist/cjs/api/exceptions/initialize.test.js +0 -138
- package/dist/cjs/api/exceptions/initialize.test.js.map +0 -1
- package/dist/cjs/api/initialize.d.ts +0 -6
- package/dist/cjs/api/logs/initialize.d.ts +0 -7
- package/dist/cjs/api/logs/initialize.test.d.ts +0 -1
- package/dist/cjs/api/logs/initialize.test.js +0 -88
- package/dist/cjs/api/logs/initialize.test.js.map +0 -1
- package/dist/cjs/api/measurements/initialize.d.ts +0 -7
- package/dist/cjs/api/measurements/initialize.test.d.ts +0 -1
- package/dist/cjs/api/measurements/initialize.test.js +0 -123
- package/dist/cjs/api/measurements/initialize.test.js.map +0 -1
- package/dist/cjs/api/meta/initialize.d.ts +0 -6
- package/dist/cjs/api/meta/types.d.ts +0 -8
- package/dist/cjs/api/traces/initialize.d.ts +0 -6
- package/dist/cjs/config/types.d.ts +0 -26
- package/dist/cjs/faro.test.d.ts +0 -1
- package/dist/cjs/faro.test.js +0 -42
- package/dist/cjs/faro.test.js.map +0 -1
- package/dist/cjs/instrumentations/initialize.d.ts +0 -4
- package/dist/cjs/metas/initialize.d.ts +0 -4
- package/dist/cjs/metas/initialize.test.d.ts +0 -1
- package/dist/cjs/metas/initialize.test.js +0 -21
- package/dist/cjs/metas/initialize.test.js.map +0 -1
- package/dist/cjs/sdk/register.d.ts +0 -4
- package/dist/cjs/sdk/register.js.map +0 -1
- package/dist/cjs/transports/transports.test.d.ts +0 -1
- package/dist/cjs/transports/transports.test.js +0 -141
- package/dist/cjs/transports/transports.test.js.map +0 -1
- package/dist/cjs/transports/types.d.ts +0 -37
- package/dist/cjs/utils/deepEqual.d.ts +0 -2
- package/dist/cjs/utils/extensions.d.ts +0 -19
- package/dist/cjs/utils/extensions.js.map +0 -1
- package/dist/cjs/utils/promiseBuffer.test.d.ts +0 -1
- package/dist/cjs/utils/promiseBuffer.test.js +0 -146
- package/dist/cjs/utils/promiseBuffer.test.js.map +0 -1
- package/dist/cjs/version.d.ts +0 -1
- package/dist/esm/api/events/index.d.ts +0 -2
- package/dist/esm/api/events/initialize.d.ts +0 -7
- package/dist/esm/api/events/initialize.test.d.ts +0 -1
- package/dist/esm/api/events/initialize.test.js +0 -87
- package/dist/esm/api/events/initialize.test.js.map +0 -1
- package/dist/esm/api/events/types.d.ts +0 -15
- package/dist/esm/api/exceptions/const.d.ts +0 -1
- package/dist/esm/api/exceptions/index.d.ts +0 -3
- package/dist/esm/api/exceptions/initialize.d.ts +0 -7
- package/dist/esm/api/exceptions/initialize.test.d.ts +0 -1
- package/dist/esm/api/exceptions/initialize.test.js +0 -133
- package/dist/esm/api/exceptions/initialize.test.js.map +0 -1
- package/dist/esm/api/exceptions/types.d.ts +0 -32
- package/dist/esm/api/index.d.ts +0 -9
- package/dist/esm/api/initialize.d.ts +0 -6
- package/dist/esm/api/logs/index.d.ts +0 -2
- package/dist/esm/api/logs/initialize.test.d.ts +0 -1
- package/dist/esm/api/logs/initialize.test.js +0 -83
- package/dist/esm/api/logs/initialize.test.js.map +0 -1
- package/dist/esm/api/logs/types.d.ts +0 -18
- package/dist/esm/api/measurements/index.d.ts +0 -2
- package/dist/esm/api/measurements/initialize.test.d.ts +0 -1
- package/dist/esm/api/measurements/initialize.test.js +0 -107
- package/dist/esm/api/measurements/initialize.test.js.map +0 -1
- package/dist/esm/api/measurements/types.d.ts +0 -16
- package/dist/esm/api/meta/index.d.ts +0 -2
- package/dist/esm/api/meta/initialize.d.ts +0 -6
- package/dist/esm/api/meta/types.d.ts +0 -8
- package/dist/esm/api/traces/index.d.ts +0 -2
- package/dist/esm/api/traces/initialize.d.ts +0 -6
- package/dist/esm/api/traces/types.d.ts +0 -20
- package/dist/esm/api/types.d.ts +0 -8
- package/dist/esm/config/const.d.ts +0 -1
- package/dist/esm/config/index.d.ts +0 -2
- package/dist/esm/faro.test.d.ts +0 -1
- package/dist/esm/faro.test.js +0 -40
- package/dist/esm/faro.test.js.map +0 -1
- package/dist/esm/globalObject/globalObject.d.ts +0 -7
- package/dist/esm/globalObject/index.d.ts +0 -2
- package/dist/esm/index.d.ts +0 -22
- package/dist/esm/initialize.d.ts +0 -3
- package/dist/esm/instrumentations/base.d.ts +0 -5
- package/dist/esm/instrumentations/index.d.ts +0 -3
- package/dist/esm/instrumentations/initialize.d.ts +0 -4
- package/dist/esm/instrumentations/types.d.ts +0 -10
- package/dist/esm/internalLogger/const.d.ts +0 -11
- package/dist/esm/internalLogger/createInternalLogger.d.ts +0 -4
- package/dist/esm/internalLogger/index.d.ts +0 -4
- package/dist/esm/internalLogger/initialize.d.ts +0 -5
- package/dist/esm/internalLogger/types.d.ts +0 -7
- package/dist/esm/metas/index.d.ts +0 -2
- package/dist/esm/metas/initialize.d.ts +0 -4
- package/dist/esm/metas/initialize.test.d.ts +0 -1
- package/dist/esm/metas/initialize.test.js +0 -19
- package/dist/esm/metas/initialize.test.js.map +0 -1
- package/dist/esm/metas/types.d.ts +0 -56
- package/dist/esm/sdk/const.d.ts +0 -1
- package/dist/esm/sdk/faroGlobalObject.d.ts +0 -2
- package/dist/esm/sdk/index.d.ts +0 -4
- package/dist/esm/sdk/internalFaroGlobalObject.d.ts +0 -4
- package/dist/esm/sdk/register.d.ts +0 -4
- package/dist/esm/sdk/register.js +0 -11
- package/dist/esm/sdk/register.js.map +0 -1
- package/dist/esm/semantic.d.ts +0 -7
- package/dist/esm/testUtils/index.d.ts +0 -6
- package/dist/esm/testUtils/mockConfig.d.ts +0 -2
- package/dist/esm/testUtils/mockInternalLogger.d.ts +0 -2
- package/dist/esm/testUtils/mockStacktraceParser.d.ts +0 -2
- package/dist/esm/testUtils/mockTransport.d.ts +0 -12
- package/dist/esm/testUtils/testPromise.d.ts +0 -7
- package/dist/esm/transports/base.d.ts +0 -6
- package/dist/esm/transports/const.d.ts +0 -8
- package/dist/esm/transports/index.d.ts +0 -5
- package/dist/esm/transports/initialize.d.ts +0 -6
- package/dist/esm/transports/transports.test.d.ts +0 -1
- package/dist/esm/transports/transports.test.js +0 -110
- package/dist/esm/transports/transports.test.js.map +0 -1
- package/dist/esm/transports/utils.d.ts +0 -2
- package/dist/esm/unpatchedConsole/const.d.ts +0 -2
- package/dist/esm/unpatchedConsole/index.d.ts +0 -3
- package/dist/esm/unpatchedConsole/initialize.d.ts +0 -4
- package/dist/esm/unpatchedConsole/types.d.ts +0 -1
- package/dist/esm/utils/baseObject.d.ts +0 -6
- package/dist/esm/utils/deepEqual.d.ts +0 -2
- package/dist/esm/utils/extensions.d.ts +0 -19
- package/dist/esm/utils/extensions.js +0 -23
- package/dist/esm/utils/extensions.js.map +0 -1
- package/dist/esm/utils/getCurrentTimestamp.d.ts +0 -1
- package/dist/esm/utils/index.d.ts +0 -12
- package/dist/esm/utils/is.d.ts +0 -31
- package/dist/esm/utils/logLevels.d.ts +0 -10
- package/dist/esm/utils/noop.d.ts +0 -1
- package/dist/esm/utils/promiseBuffer.d.ts +0 -14
- package/dist/esm/utils/promiseBuffer.test.d.ts +0 -1
- package/dist/esm/utils/promiseBuffer.test.js +0 -87
- package/dist/esm/utils/promiseBuffer.test.js.map +0 -1
- package/dist/esm/utils/shortId.d.ts +0 -1
- package/dist/esm/version.d.ts +0 -1
package/dist/esm/initialize.js
CHANGED
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import { initializeAPI } from './api';
|
|
2
|
-
import { initializeInstrumentations } from './instrumentations';
|
|
2
|
+
import { initializeInstrumentations, registerInitialInstrumentations } from './instrumentations';
|
|
3
3
|
import { initializeInternalLogger } from './internalLogger';
|
|
4
|
-
import { initializeMetas } from './metas';
|
|
4
|
+
import { initializeMetas, registerInitialMetas } from './metas';
|
|
5
5
|
import { isInternalFaroOnGlobalObject, registerFaro } from './sdk';
|
|
6
|
-
import { initializeTransports } from './transports';
|
|
6
|
+
import { initializeTransports, registerInitialTransports } from './transports';
|
|
7
7
|
import { initializeUnpatchedConsole } from './unpatchedConsole';
|
|
8
8
|
export function initializeFaro(config) {
|
|
9
9
|
const unpatchedConsole = initializeUnpatchedConsole(config);
|
|
10
10
|
const internalLogger = initializeInternalLogger(unpatchedConsole, config);
|
|
11
|
-
internalLogger.debug('Initializing');
|
|
12
11
|
if (isInternalFaroOnGlobalObject() && !config.isolate) {
|
|
13
12
|
internalLogger.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');
|
|
14
13
|
return undefined;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const faro = registerFaro(internalLogger,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
pause: transports.pause,
|
|
28
|
-
transports,
|
|
29
|
-
unpatchedConsole,
|
|
30
|
-
unpause: transports.unpause,
|
|
31
|
-
instrumentations: initializeInstrumentations(internalLogger, config),
|
|
32
|
-
});
|
|
33
|
-
// make sure Faro is initialized before initializing instrumentations
|
|
34
|
-
faro.instrumentations.add(...config.instrumentations);
|
|
15
|
+
internalLogger.debug('Initializing');
|
|
16
|
+
// Initializing the APIs
|
|
17
|
+
const metas = initializeMetas(unpatchedConsole, internalLogger, config);
|
|
18
|
+
const transports = initializeTransports(unpatchedConsole, internalLogger, config, metas);
|
|
19
|
+
const api = initializeAPI(unpatchedConsole, internalLogger, config, metas, transports);
|
|
20
|
+
const instrumentations = initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api);
|
|
21
|
+
const faro = registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations);
|
|
22
|
+
// make sure Faro is initialized before registering default metas, instrumentations, transports etc.
|
|
23
|
+
registerInitialMetas(faro);
|
|
24
|
+
registerInitialTransports(faro);
|
|
25
|
+
registerInitialInstrumentations(faro);
|
|
35
26
|
return faro;
|
|
36
27
|
}
|
|
37
28
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,gBAAgB,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,cAAc,GAAG,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAE1E,IAAI,4BAA4B,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACrD,cAAc,CAAC,KAAK,CAClB,oIAAoI,CACrI,CAAC;QAEF,OAAO,SAAU,CAAC;KACnB;IAED,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAErC,wBAAwB;IACxB,MAAM,KAAK,GAAG,eAAe,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACxE,MAAM,UAAU,GAAG,oBAAoB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACzF,MAAM,GAAG,GAAG,aAAa,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACvF,MAAM,gBAAgB,GAAG,0BAA0B,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IACtH,MAAM,IAAI,GAAG,YAAY,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAE9G,oGAAoG;IACpG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC3B,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAChC,+BAA+B,CAAC,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,4 +1,9 @@
|
|
|
1
|
-
import { BaseExtension } from '../
|
|
1
|
+
import { BaseExtension } from '../extensions';
|
|
2
2
|
export class BaseInstrumentation extends BaseExtension {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.api = {};
|
|
6
|
+
this.transports = {};
|
|
7
|
+
}
|
|
3
8
|
}
|
|
4
9
|
//# 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,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,MAAM,OAAgB,mBAAoB,SAAQ,aAAa;IAA/D;;QACE,QAAG,GAAQ,EAAS,CAAC;QACrB,eAAU,GAAe,EAAgB,CAAC;IAG5C,CAAC;CAAA","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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { BaseInstrumentation } from './base';\n\nexport { initializeInstrumentations } from './initialize';\n\nexport type { Instrumentation, Instrumentations } from './types';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { BaseInstrumentation } from './base';\n\nexport { initializeInstrumentations } from './initialize';\n\nexport { registerInitialInstrumentations } from './registerInitial';\n\nexport type { Instrumentation, Instrumentations } from './types';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function initializeInstrumentations(internalLogger,
|
|
1
|
+
export function initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api) {
|
|
2
2
|
internalLogger.debug('Initializing instrumentations');
|
|
3
3
|
const instrumentations = [];
|
|
4
4
|
const add = (...newInstrumentations) => {
|
|
@@ -7,9 +7,15 @@ export function initializeInstrumentations(internalLogger, _config) {
|
|
|
7
7
|
internalLogger.debug(`Adding "${newInstrumentation.name}" instrumentation`);
|
|
8
8
|
const exists = instrumentations.some((existingInstrumentation) => existingInstrumentation.name === newInstrumentation.name);
|
|
9
9
|
if (exists) {
|
|
10
|
-
internalLogger.warn(`
|
|
10
|
+
internalLogger.warn(`Instrumentation ${newInstrumentation.name} is already added`);
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
+
newInstrumentation.unpatchedConsole = unpatchedConsole;
|
|
14
|
+
newInstrumentation.internalLogger = internalLogger;
|
|
15
|
+
newInstrumentation.config = config;
|
|
16
|
+
newInstrumentation.metas = metas;
|
|
17
|
+
newInstrumentation.transports = transports;
|
|
18
|
+
newInstrumentation.api = api;
|
|
13
19
|
instrumentations.push(newInstrumentation);
|
|
14
20
|
newInstrumentation.initialize();
|
|
15
21
|
});
|
|
@@ -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,MAAM,UAAU,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;gBACV,cAAc,CAAC,IAAI,CAAC,mBAAmB,kBAAkB,CAAC,IAAI,mBAAmB,CAAC,CAAC;gBAEnF,OAAO;aACR;YAED,kBAAkB,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;YACvD,kBAAkB,CAAC,cAAc,GAAG,cAAc,CAAC;YACnD,kBAAkB,CAAC,MAAM,G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AC;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) {\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/instrumentations/registerInitial.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,+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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/instrumentations/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Extension } from '../
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/instrumentations/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { API } from '../api';\nimport type { Extension } from '../extensions';\nimport type { Transports } from '../transports';\n\nexport interface Instrumentation extends Extension {\n api: API;\n transports: Transports;\n\n initialize: VoidFunction;\n\n destroy?: VoidFunction;\n}\n\nexport interface Instrumentations {\n add: (...instrumentations: Instrumentation[]) => void;\n instrumentations: Instrumentation[];\n remove: (...instrumentations: Instrumentation[]) => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/internalLogger/const.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/internalLogger/const.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhC,MAAM,CAAN,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,2DAAO,CAAA;IACP,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,6DAAQ,CAAA;IACR,mEAAW,CAAA;AACb,CAAC,EANW,mBAAmB,KAAnB,mBAAmB,QAM9B;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAmB;IACnD,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,2BAA2B;IACnC,IAAI,EAAE,IAAI;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInternalLogger.js","sourceRoot":"","sources":["../../../src/internalLogger/createInternalLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"createInternalLogger.js","sourceRoot":"","sources":["../../../src/internalLogger/createInternalLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,M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';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { noop } from '../utils';\n\nimport { defaultInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './const';\nimport type { InternalLogger } from './types';\n\nexport function createInternalLogger(\n unpatchedConsole: UnpatchedConsole = defaultUnpatchedConsole,\n internalLoggerLevel = defaultInternalLoggerLevel\n): InternalLogger {\n const internalLogger = defaultInternalLogger;\n\n if (internalLoggerLevel > InternalLoggerLevel.OFF) {\n internalLogger.error =\n internalLoggerLevel >= InternalLoggerLevel.ERROR\n ? function (...args) {\n unpatchedConsole.error(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.warn =\n internalLoggerLevel >= InternalLoggerLevel.WARN\n ? function (...args) {\n unpatchedConsole.warn(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.info =\n internalLoggerLevel >= InternalLoggerLevel.INFO\n ? function (...args) {\n unpatchedConsole.info(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.debug =\n internalLoggerLevel >= InternalLoggerLevel.VERBOSE\n ? function (...args) {\n unpatchedConsole.debug(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n }\n\n return internalLogger;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defaultInternalLoggerLevel, InternalLoggerLevel } from './const';
|
|
1
|
+
export { defaultInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './const';
|
|
2
2
|
export { createInternalLogger } from './createInternalLogger';
|
|
3
3
|
export { initializeInternalLogger, internalLogger } from './initialize';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internalLogger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internalLogger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { defaultInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './const';\n\nexport { createInternalLogger } from './createInternalLogger';\n\nexport { initializeInternalLogger, internalLogger } from './initialize';\n\nexport type { InternalLogger } from './types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/internalLogger/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/internalLogger/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,CAAC,IAAI,cAAc,GAAmB,qBAAqB,CAAC;AAElE,MAAM,UAAU,wBAAwB,CAAC,gBAAkC,EAAE,MAAc;IACzF,cAAc,GAAG,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAEpF,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import type { Config } from '../config';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { defaultInternalLogger } from './const';\nimport { createInternalLogger } from './createInternalLogger';\nimport type { InternalLogger } from './types';\n\nexport let internalLogger: InternalLogger = defaultInternalLogger;\n\nexport function initializeInternalLogger(unpatchedConsole: UnpatchedConsole, config: Config): InternalLogger {\n internalLogger = createInternalLogger(unpatchedConsole, config.internalLoggerLevel);\n\n return internalLogger;\n}\n"]}
|
package/dist/esm/metas/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { initializeMetas } from './initialize';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n} from './types';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { initializeMetas } from './initialize';\n\nexport { registerInitialMetas } from './registerInitial';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n} from './types';\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { isFunction } from '../utils';
|
|
2
|
-
|
|
3
|
-
export function initializeMetas(internalLogger, config) {
|
|
4
|
-
var _a;
|
|
2
|
+
export function initializeMetas(_unpatchedConsole, internalLogger, _config) {
|
|
5
3
|
let items = [];
|
|
6
4
|
let listeners = [];
|
|
7
5
|
const getValue = () => items.reduce((acc, item) => Object.assign(acc, isFunction(item) ? item() : item), {});
|
|
@@ -21,25 +19,13 @@ export function initializeMetas(internalLogger, config) {
|
|
|
21
19
|
items = items.filter((currentItem) => !itemsToRemove.includes(currentItem));
|
|
22
20
|
notifyListeners();
|
|
23
21
|
};
|
|
24
|
-
const initial = {
|
|
25
|
-
sdk: {
|
|
26
|
-
name: '@grafana/faro-core',
|
|
27
|
-
version: VERSION,
|
|
28
|
-
integrations: config.instrumentations.map(({ name, version }) => ({ name, version })),
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
if (config.app) {
|
|
32
|
-
initial.app = config.app;
|
|
33
|
-
}
|
|
34
|
-
if (config.user) {
|
|
35
|
-
initial.user = config.user;
|
|
36
|
-
}
|
|
37
|
-
add(initial, ...((_a = config.metas) !== null && _a !== void 0 ? _a : []));
|
|
38
22
|
const addListener = (listener) => {
|
|
23
|
+
internalLogger.debug('Adding metas listener\n', listener);
|
|
39
24
|
listeners.push(listener);
|
|
40
25
|
};
|
|
41
26
|
const removeListener = (listener) => {
|
|
42
|
-
|
|
27
|
+
internalLogger.debug('Removing metas listener\n', listener);
|
|
28
|
+
listeners = listeners.filter((currentListener) => currentListener !== listener);
|
|
43
29
|
};
|
|
44
30
|
return {
|
|
45
31
|
add,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/metas/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/metas/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,MAAM,UAAU,eAAe,CAC7B,iBAAmC,EACnC,cAA8B,EAC9B,OAAe;IAEf,IAAI,KAAK,GAAe,EAAE,CAAC;IAC3B,IAAI,SAAS,GAAoB,EAAE,CAAC;IAEpC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAO,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEnH,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,IAAI,SAAS,CAAC,MAAM,EAAE;YACpB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAA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'../internalLogger';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { isFunction } from '../utils';\n\nimport type { Meta, MetaItem, Metas, MetasListener } from './types';\n\nexport function initializeMetas(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config\n): Metas {\n let items: MetaItem[] = [];\n let listeners: MetasListener[] = [];\n\n const getValue = () => items.reduce<Meta>((acc, item) => Object.assign(acc, isFunction(item) ? item() : item), {});\n\n const notifyListeners = () => {\n if (listeners.length) {\n const value = getValue();\n\n listeners.forEach((listener) => listener(value));\n }\n };\n\n const add: Metas['add'] = (...newItems) => {\n internalLogger.debug('Adding metas\\n', newItems);\n\n items.push(...newItems);\n\n notifyListeners();\n };\n\n const remove: Metas['remove'] = (...itemsToRemove) => {\n internalLogger.debug('Removing metas\\n', itemsToRemove);\n\n items = items.filter((currentItem) => !itemsToRemove.includes(currentItem));\n\n notifyListeners();\n };\n\n const addListener: Metas['addListener'] = (listener) => {\n internalLogger.debug('Adding metas listener\\n', listener);\n\n listeners.push(listener);\n };\n\n const removeListener: Metas['removeListener'] = (listener) => {\n internalLogger.debug('Removing metas listener\\n', listener);\n\n listeners = listeners.filter((currentListener) => currentListener !== listener);\n };\n\n return {\n add,\n remove,\n addListener,\n removeListener,\n get value() {\n return getValue();\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VERSION } from '../version';
|
|
2
|
+
export function registerInitialMetas(faro) {
|
|
3
|
+
var _a;
|
|
4
|
+
const initial = {
|
|
5
|
+
sdk: {
|
|
6
|
+
name: '@grafana/faro-core',
|
|
7
|
+
version: VERSION,
|
|
8
|
+
integrations: faro.config.instrumentations.map(({ name, version }) => ({ name, version })),
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
if (faro.config.session) {
|
|
12
|
+
faro.api.setSession(faro.config.session);
|
|
13
|
+
}
|
|
14
|
+
if (faro.config.app) {
|
|
15
|
+
initial.app = faro.config.app;
|
|
16
|
+
}
|
|
17
|
+
if (faro.config.user) {
|
|
18
|
+
initial.user = faro.config.user;
|
|
19
|
+
}
|
|
20
|
+
if (faro.config.view) {
|
|
21
|
+
initial.view = faro.config.view;
|
|
22
|
+
}
|
|
23
|
+
faro.metas.add(initial, ...((_a = faro.config.metas) !== null && _a !== void 0 ? _a : []));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=registerInitial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/metas/registerInitial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,MAAM,UAAU,oBAAoB,CAAC,IAAU;;IAC7C,MAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,OAAO;YAChB,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;SAC3F;KACF,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KAC1C;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;QACnB,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;KAC/B;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;QACpB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;KACjC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;QACpB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;KACjC;IAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import type { Faro } from '../sdk';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n name: '@grafana/faro-core',\n version: VERSION,\n integrations: faro.config.instrumentations.map(({ name, version }) => ({ name, version })),\n },\n };\n\n if (faro.config.session) {\n faro.api.setSession(faro.config.session);\n }\n\n if (faro.config.app) {\n initial.app = faro.config.app;\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/metas/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MetaGetter<P = Partial<Meta>> = () => P;\n\nexport type MetaItem<P = Partial<Meta>> = P | MetaGetter<P>;\n\nexport type MetasListener = (value: Meta) => void;\n\nexport interface Metas {\n add: (...getters: MetaItem[]) => void;\n remove: (...getters: MetaItem[]) => void;\n addListener: (listener: MetasListener) => void;\n removeListener: (listener: MetasListener) => void;\n value: Meta;\n}\n\nexport type MetaAttributes = Record<string, string>;\n\nexport interface MetaSDKIntegration {\n name?: string;\n version?: string;\n}\n\nexport interface MetaSDK {\n name?: string;\n version?: string;\n integrations?: MetaSDKIntegration[];\n}\n\nexport interface MetaApp {\n name?: string;\n release?: string;\n version?: string;\n environment?: string;\n}\n\nexport interface MetaUser {\n email?: string;\n id?: string;\n username?: string;\n attributes?: MetaAttributes;\n}\n\nexport interface MetaSession {\n id?: string;\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/metas/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MetaGetter<P = Partial<Meta>> = () => P;\n\nexport type MetaItem<P = Partial<Meta>> = P | MetaGetter<P>;\n\nexport type MetasListener = (value: Meta) => void;\n\nexport interface Metas {\n add: (...getters: MetaItem[]) => void;\n remove: (...getters: MetaItem[]) => void;\n addListener: (listener: MetasListener) => void;\n removeListener: (listener: MetasListener) => void;\n value: Meta;\n}\n\nexport type MetaAttributes = Record<string, string>;\n\nexport interface MetaSDKIntegration {\n name?: string;\n version?: string;\n}\n\nexport interface MetaSDK {\n name?: string;\n version?: string;\n integrations?: MetaSDKIntegration[];\n}\n\nexport interface MetaApp {\n name?: string;\n release?: string;\n version?: string;\n environment?: string;\n}\n\nexport interface MetaUser {\n email?: string;\n id?: string;\n username?: string;\n attributes?: MetaAttributes;\n}\n\nexport interface MetaSession {\n id?: string;\n attributes?: MetaAttributes;\n}\n\nexport interface MetaPage {\n id?: string;\n url?: string;\n attributes?: MetaAttributes;\n}\n\nexport interface MetaBrowser {\n name?: string;\n version?: string;\n os?: string;\n mobile?: boolean;\n}\n\nexport interface MetaView {\n name: string;\n}\n\nexport interface Meta {\n sdk?: MetaSDK;\n app?: MetaApp;\n user?: MetaUser;\n session?: MetaSession;\n page?: MetaPage;\n browser?: MetaBrowser;\n view?: MetaView;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/faroGlobalObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"faroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/faroGlobalObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,MAAM,UAAU,qBAAqB,CAAC,IAAU;IAC9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE;QACtC,IAAI,CAAC,cAAc,CAAC,KAAK,CACvB,gEAAgE,IAAI,CAAC,MAAM,CAAC,eAAe,OAAO,CACnG,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,IAAI,YAAY,EAAE;YAC/C,IAAI,CAAC,cAAc,CAAC,IAAI,CACtB,4CAA4C,IAAI,CAAC,MAAM,CAAC,eAAe,+GAA+G,CACvL,CAAC;YAEF,OAAO;SACR;QAED,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;YAC/D,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ;SAAM;QACL,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;KAC5F;AACH,CAAC","sourcesContent":["import { globalObject } from '../globalObject';\n\nimport type { Faro } from './types';\n\nexport function setFaroOnGlobalObject(faro: Faro): void {\n if (!faro.config.preventGlobalExposure) {\n faro.internalLogger.debug(\n `Registering public faro reference in the global scope using \"${faro.config.globalObjectKey}\" key`\n );\n\n if (faro.config.globalObjectKey in globalObject) {\n faro.internalLogger.warn(\n `Skipping global registration due to key \"${faro.config.globalObjectKey}\" being used already. Please set \"globalObjectKey\" to something else or set \"preventGlobalExposure\" to \"true\"`\n );\n\n return;\n }\n\n Object.defineProperty(globalObject, faro.config.globalObjectKey, {\n configurable: false,\n writable: false,\n value: faro,\n });\n } else {\n faro.internalLogger.debug('Skipping registering public Faro instance in the global scope');\n }\n}\n"]}
|
package/dist/esm/sdk/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { internalGlobalObjectKey } from './const';
|
|
2
|
-
export { faro, registerFaro } from './
|
|
2
|
+
export { faro, registerFaro } from './registerFaro';
|
|
3
3
|
export { getInternalFromGlobalObject as getInternalFaroFromGlobalObject, isInternalFaroOnGlobalObject as isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject as setInternalFaroOnGlobalObject, } from './internalFaroGlobalObject';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EACL,2BAA2B,IAAI,+BAA+B,EAC9D,4BAA4B,IAAI,4BAA4B,EAC5D,6BAA6B,IAAI,6BAA6B,GAC/D,MAAM,4BAA4B,CAAC","sourcesContent":["export { internalGlobalObjectKey } from './const';\n\nexport { faro, registerFaro } from './registerFaro';\n\nexport {\n getInternalFromGlobalObject as getInternalFaroFromGlobalObject,\n isInternalFaroOnGlobalObject as isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject as setInternalFaroOnGlobalObject,\n} from './internalFaroGlobalObject';\n\nexport type { Faro } from './types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalFaroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/internalFaroGlobalObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"internalFaroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/internalFaroGlobalObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGlD,MAAM,UAAU,2BAA2B;IACzC,OAAO,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,IAAU;IACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAEjF,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,uBAAuB,EAAE;YAC3D,YAAY,EAAE,KAAK;YACnB,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ;SAAM;QACL,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;KAC3F;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,OAAO,uBAAuB,IAAI,YAAY,CAAC;AACjD,CAAC","sourcesContent":["import { globalObject } from '../globalObject';\n\nimport { internalGlobalObjectKey } from './const';\nimport type { Faro } from './types';\n\nexport function getInternalFromGlobalObject(): Faro | undefined {\n return globalObject[internalGlobalObjectKey];\n}\n\nexport function setInternalFaroOnGlobalObject(faro: Faro): void {\n if (!faro.config.isolate) {\n faro.internalLogger.debug('Registering internal Faro instance on global object');\n\n Object.defineProperty(globalObject, internalGlobalObjectKey, {\n configurable: false,\n enumerable: false,\n writable: false,\n value: faro,\n });\n } else {\n faro.internalLogger.debug('Skipping registering internal Faro instance on global object');\n }\n}\n\nexport function isInternalFaroOnGlobalObject(): boolean {\n return internalGlobalObjectKey in globalObject;\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { setFaroOnGlobalObject } from './faroGlobalObject';
|
|
2
|
+
import { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';
|
|
3
|
+
export let faro = {};
|
|
4
|
+
export function registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations) {
|
|
5
|
+
internalLogger.debug('Initializing Faro');
|
|
6
|
+
faro = {
|
|
7
|
+
api,
|
|
8
|
+
config,
|
|
9
|
+
instrumentations,
|
|
10
|
+
internalLogger,
|
|
11
|
+
metas,
|
|
12
|
+
pause: transports.pause,
|
|
13
|
+
transports,
|
|
14
|
+
unpatchedConsole,
|
|
15
|
+
unpause: transports.unpause,
|
|
16
|
+
};
|
|
17
|
+
setInternalFaroOnGlobalObject(faro);
|
|
18
|
+
setFaroOnGlobalObject(faro);
|
|
19
|
+
return faro;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=registerFaro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerFaro.js","sourceRoot":"","sources":["../../../src/sdk/registerFaro.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAG3E,MAAM,CAAC,IAAI,IAAI,GAAS,EAAU,CAAC;AAEnC,MAAM,UAAU,YAAY,CAC1B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,GAAQ,EACR,gBAAkC;IAElC,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAE1C,IAAI,GAAG;QACL,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,cAAc;QACd,KAAK;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,UAAU;QACV,gBAAgB;QAChB,OAAO,EAAE,UAAU,CAAC,OAAO;KAC5B,CAAC;IAEF,6BAA6B,CAAC,IAAI,CAAC,CAAC;IAEpC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAE5B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { API } from '../api';\nimport type { Config } from '../config';\nimport type { Instrumentations } from '../instrumentations';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { setFaroOnGlobalObject } from './faroGlobalObject';\nimport { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';\nimport type { Faro } from './types';\n\nexport let faro: Faro = {} as Faro;\n\nexport function registerFaro(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n api: API,\n instrumentations: Instrumentations\n): Faro {\n internalLogger.debug('Initializing Faro');\n\n faro = {\n api,\n config,\n instrumentations,\n internalLogger,\n metas,\n pause: transports.pause,\n transports,\n unpatchedConsole,\n unpause: transports.unpause,\n };\n\n setInternalFaroOnGlobalObject(faro);\n\n setFaroOnGlobalObject(faro);\n\n return faro;\n}\n"]}
|
package/dist/esm/semantic.js
CHANGED
package/dist/esm/semantic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic.js","sourceRoot":"","sources":["../../src/semantic.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"semantic.js","sourceRoot":"","sources":["../../src/semantic.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,eAAe;QAC9B,YAAY,EAAE,cAAc;KAC7B;CACO,CAAC","sourcesContent":["export const Conventions = {\n EventNames: {\n CLICK: 'click',\n NAVIGATION: 'navigation',\n SESSION_START: 'session_start',\n VIEW_CHANGED: 'view_changed',\n },\n} as const;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockConfig.js","sourceRoot":"","sources":["../../../src/testUtils/mockConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"mockConfig.js","sourceRoot":"","sources":["../../../src/testUtils/mockConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,UAAU,CAAC,YAA6B,EAAE;IACxD,uBACE,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;SACjB,EACD,MAAM,EAAE,IAAI,EACZ,eAAe,EAAE,MAAM,EACvB,mBAAmB,EAAE,0BAA0B,EAC/C,gBAAgB,EAAE,EAAE,EACpB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,EAAE,EACT,eAAe,EAAE,oBAAoB,EACrC,MAAM,EAAE,KAAK,EACb,qBAAqB,EAAE,IAAI,EAC3B,UAAU,EAAE,EAAE,EACd,gBAAgB,EAAE,OAAO,IACtB,SAAS,EACZ;AACJ,CAAC","sourcesContent":["import type { Config } from '../config';\nimport { defaultInternalLoggerLevel } from '../internalLogger';\n\nimport { mockStacktraceParser } from './mockStacktraceParser';\n\nexport function mockConfig(overrides: Partial<Config> = {}): Config {\n return {\n app: {\n name: 'test',\n version: '1.0.0',\n },\n dedupe: true,\n globalObjectKey: 'faro',\n internalLoggerLevel: defaultInternalLoggerLevel,\n instrumentations: [],\n isolate: true,\n metas: [],\n parseStacktrace: mockStacktraceParser,\n paused: false,\n preventGlobalExposure: true,\n transports: [],\n unpatchedConsole: console,\n ...overrides,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/transports/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/transports/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C,MAAM,OAAgB,aAAc,SAAQ,aAAa;IAGvD,aAAa;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { BaseExtension } from '../extensions';\n\nimport type { Transport, TransportItem } from './types';\n\nexport abstract class BaseTransport extends BaseExtension implements Transport {\n abstract send(item: TransportItem): void | Promise<void>;\n\n getIgnoreUrls(): Array<string | RegExp> {\n return [];\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { initializeTransports } from './initialize';
|
|
2
2
|
export { BaseTransport } from './base';
|
|
3
3
|
export { TransportItemType, transportItemTypeToBodyKey } from './const';
|
|
4
|
+
export { registerInitialTransports } from './registerInitial';
|
|
4
5
|
export { getTransportBody } from './utils';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAW9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { initializeTransports } from './initialize';\n\nexport { BaseTransport } from './base';\n\nexport { TransportItemType, transportItemTypeToBodyKey } from './const';\n\nexport { registerInitialTransports } from './registerInitial';\n\nexport type {\n BeforeSendHook,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './types';\n\nexport { getTransportBody } from './utils';\n"]}
|
|
@@ -17,7 +17,7 @@ export function createBeforeSendHookFromIgnorePatterns(patterns) {
|
|
|
17
17
|
return item;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
export function initializeTransports(internalLogger, config) {
|
|
20
|
+
export function initializeTransports(unpatchedConsole, internalLogger, config, metas) {
|
|
21
21
|
internalLogger.debug('Initializing transports');
|
|
22
22
|
const transports = [];
|
|
23
23
|
let paused = config.paused;
|
|
@@ -31,6 +31,10 @@ export function initializeTransports(internalLogger, config) {
|
|
|
31
31
|
internalLogger.warn(`Transport ${newTransport.name} is already added`);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
+
newTransport.unpatchedConsole = unpatchedConsole;
|
|
35
|
+
newTransport.internalLogger = internalLogger;
|
|
36
|
+
newTransport.config = config;
|
|
37
|
+
newTransport.metas = metas;
|
|
34
38
|
transports.push(newTransport);
|
|
35
39
|
});
|
|
36
40
|
};
|
|
@@ -91,9 +95,6 @@ export function initializeTransports(internalLogger, config) {
|
|
|
91
95
|
internalLogger.debug('Unpausing transports');
|
|
92
96
|
paused = false;
|
|
93
97
|
};
|
|
94
|
-
add(...config.transports);
|
|
95
|
-
addBeforeSendHooks(config.beforeSend);
|
|
96
|
-
addIgnoreErrorsPatterns(config.ignoreErrors);
|
|
97
98
|
return {
|
|
98
99
|
add,
|
|
99
100
|
addBeforeSendHooks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/transports/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/transports/initialize.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,UAAU,iBAA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,CAAC;IAEF,MAAM,qBAAqB,GAAwC,CAAC,GAAG,uBAAuB,EAAE,EAAE;QAChG,eAAe,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;IAChG,CAAC,CAAC;IAEF,MAAM,OAAO,GAA0B,GAAG,EAAE;QAC1C,cAAc,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAE7C,MAAM,GAAG,KAAK,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO;QACL,GAAG;QACH,kBAAkB;QAClB,uBAAuB;QACvB,kBAAkB;QAClB,OAAO;QACP,QAAQ;QACR,KAAK;QACL,MAAM;QACN,qBAAqB;QACrB,IAAI,UAAU;YACZ,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;QACzB,CAAC;QACD,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import type { ExceptionEvent } from '../api';\nimport type { Config, Patterns } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { isString } from '../utils';\n\nimport { TransportItemType } from './const';\nimport type { BeforeSendHook, Transport, Transports } from './types';\n\nexport function shouldIgnoreEvent(patterns: Patterns, msg: string): boolean {\n return patterns.some((pattern) => {\n return isString(pattern) ? msg.includes(pattern) : !!msg.match(pattern);\n });\n}\n\nexport function createBeforeSendHookFromIgnorePatterns(patterns: Patterns): BeforeSendHook {\n return (item) => {\n if (item.type === TransportItemType.EXCEPTION && item.payload) {\n const evt = item.payload as ExceptionEvent;\n const msg = `${evt.type}: ${evt.value}`;\n\n if (shouldIgnoreEvent(patterns, msg)) {\n return null;\n }\n }\n\n return item;\n };\n}\n\nexport function initializeTransports(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas\n): Transports {\n internalLogger.debug('Initializing transports');\n\n const transports: Transport[] = [];\n\n let paused = config.paused;\n\n let beforeSendHooks: BeforeSendHook[] = [];\n\n const add: Transports['add'] = (...newTransports) => {\n internalLogger.debug('Adding transports');\n\n newTransports.forEach((newTransport) => {\n internalLogger.debug(`Adding \"${newTransport.name}\" transport`);\n\n const exists = transports.some((existingTransport) => existingTransport === newTransport);\n\n if (exists) {\n internalLogger.warn(`Transport ${newTransport.name} is already added`);\n\n return;\n }\n\n newTransport.unpatchedConsole = unpatchedConsole;\n newTransport.internalLogger = internalLogger;\n newTransport.config = config;\n newTransport.metas = metas;\n\n transports.push(newTransport);\n });\n };\n\n const addBeforeSendHooks: Transports['addBeforeSendHooks'] = (...newBeforeSendHooks) => {\n internalLogger.debug('Adding beforeSendHooks\\n', beforeSendHooks);\n\n newBeforeSendHooks.forEach((beforeSendHook) => {\n if (beforeSendHook) {\n beforeSendHooks.push(beforeSendHook);\n }\n });\n };\n\n const addIgnoreErrorsPatterns: Transports['addIgnoreErrorsPatterns'] = (...ignoreErrorsPatterns) => {\n internalLogger.debug('Adding ignoreErrorsPatterns\\n', ignoreErrorsPatterns);\n\n ignoreErrorsPatterns.forEach((ignoreErrorsPattern) => {\n if (ignoreErrorsPattern) {\n beforeSendHooks.push(createBeforeSendHookFromIgnorePatterns(ignoreErrorsPattern));\n }\n });\n };\n\n const execute: Transports['execute'] = (item) => {\n if (!paused) {\n let actualItem = item;\n\n for (const hook of beforeSendHooks) {\n const modified = hook(actualItem);\n\n if (modified === null) {\n return;\n }\n\n actualItem = modified;\n }\n\n for (const transport of transports) {\n internalLogger.debug(`Transporting item using ${transport.name}\\n`, actualItem);\n\n transport.send(actualItem);\n }\n }\n };\n\n const getBeforeSendHooks: Transports['getBeforeSendHooks'] = () => [...beforeSendHooks];\n\n const isPaused: Transports['isPaused'] = () => paused;\n\n const pause: Transports['pause'] = () => {\n internalLogger.debug('Pausing transports');\n\n paused = true;\n };\n\n const remove: Transports['remove'] = (...transportsToRemove) => {\n internalLogger.debug('Removing transports');\n\n transportsToRemove.forEach((transportToRemove) => {\n internalLogger.debug(`Removing \"${transportToRemove.name}\" transport`);\n\n const existingTransportIndex = transports.indexOf(transportToRemove);\n\n if (existingTransportIndex === -1) {\n internalLogger.warn(`Transport \"${transportToRemove.name}\" is not added`);\n\n return;\n }\n\n transports.splice(existingTransportIndex, 1);\n });\n };\n\n const removeBeforeSendHooks: Transports['removeBeforeSendHooks'] = (...beforeSendHooksToRemove) => {\n beforeSendHooks.filter((beforeSendHook) => !beforeSendHooksToRemove.includes(beforeSendHook));\n };\n\n const unpause: Transports['unpause'] = () => {\n internalLogger.debug('Unpausing transports');\n\n paused = false;\n };\n\n return {\n add,\n addBeforeSendHooks,\n addIgnoreErrorsPatterns,\n getBeforeSendHooks,\n execute,\n isPaused,\n pause,\n remove,\n removeBeforeSendHooks,\n get transports() {\n return [...transports];\n },\n unpause,\n };\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registerInitialTransports(faro) {
|
|
2
|
+
faro.transports.add(...faro.config.transports);
|
|
3
|
+
faro.transports.addBeforeSendHooks(faro.config.beforeSend);
|
|
4
|
+
faro.transports.addIgnoreErrorsPatterns(faro.config.ignoreErrors);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=registerInitial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/transports/registerInitial.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,yBAAyB,CAAC,IAAU;IAClD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import type { Faro } from '../sdk';\n\nexport function registerInitialTransports(faro: Faro): void {\n faro.transports.add(...faro.config.transports);\n faro.transports.addBeforeSendHooks(faro.config.beforeSend);\n faro.transports.addIgnoreErrorsPatterns(faro.config.ignoreErrors);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, EventEvent, ExceptionEvent, LogEvent, MeasurementEvent, TraceEvent } from '../api';\nimport type { Patterns } from '../config';\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, EventEvent, ExceptionEvent, LogEvent, MeasurementEvent, TraceEvent } from '../api';\nimport type { Patterns } from '../config';\nimport type { Extension } from '../extensions';\nimport type { Meta } from '../metas';\n\nimport type { TransportItemType } from './const';\n\nexport type TransportItemPayload<P = APIEvent> = P;\n\nexport type BeforeSendHook<P = APIEvent> = (item: TransportItem<P>) => TransportItem<P> | null;\n\nexport interface TransportItem<P = APIEvent> {\n type: TransportItemType;\n payload: TransportItemPayload<P>;\n meta: Meta;\n}\n\nexport interface Transport extends Extension {\n send(item: TransportItem): void | Promise<void>;\n\n // returns URLs to be ignored by tracing, to not cause a feedback loop\n getIgnoreUrls(): Patterns;\n}\n\nexport interface TransportBody {\n meta: Meta;\n\n exceptions?: ExceptionEvent[];\n logs?: LogEvent[];\n measurements?: MeasurementEvent[];\n traces?: TraceEvent;\n events?: EventEvent[];\n}\n\nexport interface Transports {\n add: (...transports: Transport[]) => void;\n addBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n addIgnoreErrorsPatterns: (...ignoreErrorsPatterns: Array<Patterns | undefined>) => void;\n execute: (transportItem: TransportItem) => void;\n getBeforeSendHooks: () => BeforeSendHook[];\n isPaused: () => boolean;\n remove: (...transports: Transport[]) => void;\n removeBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n transports: Transport[];\n pause: () => void;\n unpause: () => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/unpatchedConsole/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/unpatchedConsole/initialize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGlD,MAAM,CAAC,IAAI,gBAAgB,GAAqB,uBAAuB,CAAC;AAExE,MAAM,UAAU,0BAA0B,CAAC,MAAc;;IACvD,gBAAgB,GAAG,MAAA,MAAM,CAAC,gBAAgB,mCAAI,gBAAgB,CAAC;IAE/D,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import type { Config } from '../config';\n\nimport { defaultUnpatchedConsole } from './const';\nimport type { UnpatchedConsole } from './types';\n\nexport let unpatchedConsole: UnpatchedConsole = defaultUnpatchedConsole;\n\nexport function initializeUnpatchedConsole(config: Config): UnpatchedConsole {\n unpatchedConsole = config.unpatchedConsole ?? unpatchedConsole;\n\n return unpatchedConsole;\n}\n"]}
|