@grafana/faro-core 2.3.1 → 2.5.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 +13 -1
- package/dist/bundle/faro-core.iife.js +1 -1
- package/dist/bundle/types/api/exceptions/types.d.ts +2 -0
- package/dist/bundle/types/api/index.d.ts +1 -0
- package/dist/bundle/types/api/noop.d.ts +2 -0
- package/dist/bundle/types/api/userActions/userAction.d.ts +1 -0
- package/dist/bundle/types/extensions/baseExtension.d.ts +1 -1
- package/dist/bundle/types/index.d.ts +2 -2
- package/dist/bundle/types/metas/index.d.ts +1 -1
- package/dist/bundle/types/metas/types.d.ts +19 -2
- package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/bundle/types/utils/date.d.ts +18 -0
- package/dist/bundle/types/utils/index.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 +29 -40
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/api/exceptions/types.js.map +1 -1
- package/dist/cjs/api/index.js +3 -1
- package/dist/cjs/api/index.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/noop.js +30 -0
- package/dist/cjs/api/noop.js.map +1 -0
- 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 +57 -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/index.js +2 -1
- package/dist/cjs/index.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/index.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/metas/types.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 +11 -10
- 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/date.js +24 -0
- package/dist/cjs/utils/date.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/index.js +2 -1
- package/dist/cjs/utils/index.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/api/exceptions/initialize.js +6 -4
- package/dist/esm/api/exceptions/initialize.js.map +1 -1
- package/dist/esm/api/exceptions/types.js.map +1 -1
- package/dist/esm/api/index.js +1 -0
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/noop.js +27 -0
- package/dist/esm/api/noop.js.map +1 -0
- package/dist/esm/api/userActions/userAction.js +11 -2
- package/dist/esm/api/userActions/userAction.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/metas/index.js.map +1 -1
- package/dist/esm/metas/types.js.map +1 -1
- package/dist/esm/sdk/registerFaro.js +2 -1
- package/dist/esm/sdk/registerFaro.js.map +1 -1
- package/dist/esm/utils/date.js +23 -0
- package/dist/esm/utils/date.js.map +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/api/exceptions/types.d.ts +2 -0
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/noop.d.ts +2 -0
- package/dist/types/api/userActions/userAction.d.ts +1 -0
- package/dist/types/extensions/baseExtension.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/metas/index.d.ts +1 -1
- package/dist/types/metas/types.d.ts +19 -2
- package/dist/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/utils/date.d.ts +18 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/dist/spec/core/src/api/ItemBuffer.js +0 -27
- package/dist/spec/core/src/api/ItemBuffer.js.map +0 -1
- package/dist/spec/core/src/api/apiTestHelpers.js +0 -40
- package/dist/spec/core/src/api/apiTestHelpers.js.map +0 -1
- package/dist/spec/core/src/api/events/index.js +0 -6
- package/dist/spec/core/src/api/events/index.js.map +0 -1
- package/dist/spec/core/src/api/events/initialize.js +0 -54
- package/dist/spec/core/src/api/events/initialize.js.map +0 -1
- package/dist/spec/core/src/api/events/initialize.test.js +0 -171
- package/dist/spec/core/src/api/events/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/events/types.js +0 -3
- package/dist/spec/core/src/api/events/types.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/const.js +0 -17
- package/dist/spec/core/src/api/exceptions/const.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/index.js +0 -9
- package/dist/spec/core/src/api/exceptions/index.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/initialize.js +0 -104
- package/dist/spec/core/src/api/exceptions/initialize.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/initialize.test.js +0 -317
- package/dist/spec/core/src/api/exceptions/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/exceptions/types.js +0 -3
- package/dist/spec/core/src/api/exceptions/types.js.map +0 -1
- package/dist/spec/core/src/api/index.js +0 -15
- package/dist/spec/core/src/api/index.js.map +0 -1
- package/dist/spec/core/src/api/initialize.js +0 -56
- package/dist/spec/core/src/api/initialize.js.map +0 -1
- package/dist/spec/core/src/api/initialize.test.js +0 -33
- package/dist/spec/core/src/api/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/itemBuffer.test.js +0 -36
- package/dist/spec/core/src/api/itemBuffer.test.js.map +0 -1
- package/dist/spec/core/src/api/logs/const.js +0 -17
- package/dist/spec/core/src/api/logs/const.js.map +0 -1
- package/dist/spec/core/src/api/logs/index.js +0 -8
- package/dist/spec/core/src/api/logs/index.js.map +0 -1
- package/dist/spec/core/src/api/logs/initialize.js +0 -58
- package/dist/spec/core/src/api/logs/initialize.js.map +0 -1
- package/dist/spec/core/src/api/logs/initialize.test.js +0 -185
- package/dist/spec/core/src/api/logs/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/logs/types.js +0 -3
- package/dist/spec/core/src/api/logs/types.js.map +0 -1
- package/dist/spec/core/src/api/measurements/index.js +0 -6
- package/dist/spec/core/src/api/measurements/index.js.map +0 -1
- package/dist/spec/core/src/api/measurements/initialize.js +0 -60
- package/dist/spec/core/src/api/measurements/initialize.js.map +0 -1
- package/dist/spec/core/src/api/measurements/initialize.test.js +0 -244
- package/dist/spec/core/src/api/measurements/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/measurements/types.js +0 -3
- package/dist/spec/core/src/api/measurements/types.js.map +0 -1
- package/dist/spec/core/src/api/meta/index.js +0 -6
- package/dist/spec/core/src/api/meta/index.js.map +0 -1
- package/dist/spec/core/src/api/meta/initialize.js +0 -92
- package/dist/spec/core/src/api/meta/initialize.js.map +0 -1
- package/dist/spec/core/src/api/meta/initilialize.test.js +0 -135
- package/dist/spec/core/src/api/meta/initilialize.test.js.map +0 -1
- package/dist/spec/core/src/api/meta/types.js +0 -3
- package/dist/spec/core/src/api/meta/types.js.map +0 -1
- package/dist/spec/core/src/api/traces/index.js +0 -6
- package/dist/spec/core/src/api/traces/index.js.map +0 -1
- package/dist/spec/core/src/api/traces/initialize.js +0 -48
- package/dist/spec/core/src/api/traces/initialize.js.map +0 -1
- package/dist/spec/core/src/api/traces/types.js +0 -3
- package/dist/spec/core/src/api/traces/types.js.map +0 -1
- package/dist/spec/core/src/api/types.js +0 -3
- package/dist/spec/core/src/api/types.js.map +0 -1
- package/dist/spec/core/src/api/userActions/const.js +0 -11
- package/dist/spec/core/src/api/userActions/const.js.map +0 -1
- package/dist/spec/core/src/api/userActions/index.js +0 -11
- package/dist/spec/core/src/api/userActions/index.js.map +0 -1
- package/dist/spec/core/src/api/userActions/initialize.js +0 -80
- package/dist/spec/core/src/api/userActions/initialize.js.map +0 -1
- package/dist/spec/core/src/api/userActions/initialize.test.js +0 -82
- package/dist/spec/core/src/api/userActions/initialize.test.js.map +0 -1
- package/dist/spec/core/src/api/userActions/types.js +0 -11
- package/dist/spec/core/src/api/userActions/types.js.map +0 -1
- package/dist/spec/core/src/api/userActions/userAction.js +0 -126
- package/dist/spec/core/src/api/userActions/userAction.js.map +0 -1
- package/dist/spec/core/src/api/userActions/userAction.test.js +0 -85
- package/dist/spec/core/src/api/userActions/userAction.test.js.map +0 -1
- package/dist/spec/core/src/api/utils.js +0 -10
- package/dist/spec/core/src/api/utils.js.map +0 -1
- package/dist/spec/core/src/api/utils.test.js +0 -20
- package/dist/spec/core/src/api/utils.test.js.map +0 -1
- package/dist/spec/core/src/config/const.js +0 -10
- package/dist/spec/core/src/config/const.js.map +0 -1
- package/dist/spec/core/src/config/index.js +0 -7
- package/dist/spec/core/src/config/index.js.map +0 -1
- package/dist/spec/core/src/config/types.js +0 -3
- package/dist/spec/core/src/config/types.js.map +0 -1
- package/dist/spec/core/src/consts.js +0 -5
- package/dist/spec/core/src/consts.js.map +0 -1
- package/dist/spec/core/src/extensions/baseExtension.js +0 -57
- package/dist/spec/core/src/extensions/baseExtension.js.map +0 -1
- package/dist/spec/core/src/extensions/index.js +0 -6
- package/dist/spec/core/src/extensions/index.js.map +0 -1
- package/dist/spec/core/src/extensions/types.js +0 -3
- package/dist/spec/core/src/extensions/types.js.map +0 -1
- package/dist/spec/core/src/faro.test.js +0 -40
- package/dist/spec/core/src/faro.test.js.map +0 -1
- package/dist/spec/core/src/globalObject/globalObject.js +0 -12
- package/dist/spec/core/src/globalObject/globalObject.js.map +0 -1
- package/dist/spec/core/src/globalObject/index.js +0 -6
- package/dist/spec/core/src/globalObject/index.js.map +0 -1
- package/dist/spec/core/src/index.js +0 -103
- package/dist/spec/core/src/index.js.map +0 -1
- package/dist/spec/core/src/initialize.js +0 -31
- package/dist/spec/core/src/initialize.js.map +0 -1
- package/dist/spec/core/src/instrumentations/base.js +0 -31
- package/dist/spec/core/src/instrumentations/base.js.map +0 -1
- package/dist/spec/core/src/instrumentations/index.js +0 -10
- package/dist/spec/core/src/instrumentations/index.js.map +0 -1
- package/dist/spec/core/src/instrumentations/initialize.js +0 -70
- package/dist/spec/core/src/instrumentations/initialize.js.map +0 -1
- package/dist/spec/core/src/instrumentations/registerInitial.js +0 -8
- package/dist/spec/core/src/instrumentations/registerInitial.js.map +0 -1
- package/dist/spec/core/src/instrumentations/types.js +0 -3
- package/dist/spec/core/src/instrumentations/types.js.map +0 -1
- package/dist/spec/core/src/internalLogger/const.js +0 -22
- package/dist/spec/core/src/internalLogger/const.js.map +0 -1
- package/dist/spec/core/src/internalLogger/createInternalLogger.js +0 -64
- package/dist/spec/core/src/internalLogger/createInternalLogger.js.map +0 -1
- package/dist/spec/core/src/internalLogger/index.js +0 -13
- package/dist/spec/core/src/internalLogger/index.js.map +0 -1
- package/dist/spec/core/src/internalLogger/initialize.js +0 -12
- package/dist/spec/core/src/internalLogger/initialize.js.map +0 -1
- package/dist/spec/core/src/internalLogger/types.js +0 -3
- package/dist/spec/core/src/internalLogger/types.js.map +0 -1
- package/dist/spec/core/src/metas/index.js +0 -8
- package/dist/spec/core/src/metas/index.js.map +0 -1
- package/dist/spec/core/src/metas/initialize.js +0 -51
- package/dist/spec/core/src/metas/initialize.js.map +0 -1
- package/dist/spec/core/src/metas/initialize.test.js +0 -20
- package/dist/spec/core/src/metas/initialize.test.js.map +0 -1
- package/dist/spec/core/src/metas/registerInitial.js +0 -53
- package/dist/spec/core/src/metas/registerInitial.js.map +0 -1
- package/dist/spec/core/src/metas/types.js +0 -3
- package/dist/spec/core/src/metas/types.js.map +0 -1
- package/dist/spec/core/src/sdk/const.js +0 -5
- package/dist/spec/core/src/sdk/const.js.map +0 -1
- package/dist/spec/core/src/sdk/faroGlobalObject.js +0 -22
- package/dist/spec/core/src/sdk/faroGlobalObject.js.map +0 -1
- package/dist/spec/core/src/sdk/index.js +0 -13
- package/dist/spec/core/src/sdk/index.js.map +0 -1
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js +0 -28
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js.map +0 -1
- package/dist/spec/core/src/sdk/registerFaro.js +0 -25
- package/dist/spec/core/src/sdk/registerFaro.js.map +0 -1
- package/dist/spec/core/src/sdk/types.js +0 -3
- package/dist/spec/core/src/sdk/types.js.map +0 -1
- package/dist/spec/core/src/semantic.js +0 -12
- package/dist/spec/core/src/semantic.js.map +0 -1
- package/dist/spec/core/src/testUtils/index.js +0 -14
- package/dist/spec/core/src/testUtils/index.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockConfig.js +0 -27
- package/dist/spec/core/src/testUtils/mockConfig.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockInternalLogger.js +0 -12
- package/dist/spec/core/src/testUtils/mockInternalLogger.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockStacktraceParser.js +0 -21
- package/dist/spec/core/src/testUtils/mockStacktraceParser.js.map +0 -1
- package/dist/spec/core/src/testUtils/mockTransport.js +0 -45
- package/dist/spec/core/src/testUtils/mockTransport.js.map +0 -1
- package/dist/spec/core/src/testUtils/testPromise.js +0 -14
- package/dist/spec/core/src/testUtils/testPromise.js.map +0 -1
- package/dist/spec/core/src/transports/base.js +0 -34
- package/dist/spec/core/src/transports/base.js.map +0 -1
- package/dist/spec/core/src/transports/batchExecutor.js +0 -82
- package/dist/spec/core/src/transports/batchExecutor.js.map +0 -1
- package/dist/spec/core/src/transports/batchExecutor.test.js +0 -179
- package/dist/spec/core/src/transports/batchExecutor.test.js.map +0 -1
- package/dist/spec/core/src/transports/const.js +0 -20
- package/dist/spec/core/src/transports/const.js.map +0 -1
- package/dist/spec/core/src/transports/index.js +0 -15
- package/dist/spec/core/src/transports/index.js.map +0 -1
- package/dist/spec/core/src/transports/initialize.js +0 -188
- package/dist/spec/core/src/transports/initialize.js.map +0 -1
- package/dist/spec/core/src/transports/registerInitial.js +0 -9
- package/dist/spec/core/src/transports/registerInitial.js.map +0 -1
- package/dist/spec/core/src/transports/transports.test.js +0 -258
- package/dist/spec/core/src/transports/transports.test.js.map +0 -1
- package/dist/spec/core/src/transports/types.js +0 -3
- package/dist/spec/core/src/transports/types.js.map +0 -1
- package/dist/spec/core/src/transports/utils.js +0 -73
- package/dist/spec/core/src/transports/utils.js.map +0 -1
- package/dist/spec/core/src/transports/utils.test.js +0 -216
- package/dist/spec/core/src/transports/utils.test.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/const.js +0 -16
- package/dist/spec/core/src/unpatchedConsole/const.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/index.js +0 -9
- package/dist/spec/core/src/unpatchedConsole/index.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/initialize.js +0 -12
- package/dist/spec/core/src/unpatchedConsole/initialize.js.map +0 -1
- package/dist/spec/core/src/unpatchedConsole/types.js +0 -3
- package/dist/spec/core/src/unpatchedConsole/types.js.map +0 -1
- package/dist/spec/core/src/utils/baseObject.js +0 -3
- package/dist/spec/core/src/utils/baseObject.js.map +0 -1
- package/dist/spec/core/src/utils/date.js +0 -15
- package/dist/spec/core/src/utils/date.js.map +0 -1
- package/dist/spec/core/src/utils/deepEqual.js +0 -61
- package/dist/spec/core/src/utils/deepEqual.js.map +0 -1
- package/dist/spec/core/src/utils/deepEqual.test.js +0 -103
- package/dist/spec/core/src/utils/deepEqual.test.js.map +0 -1
- package/dist/spec/core/src/utils/index.js +0 -60
- package/dist/spec/core/src/utils/index.js.map +0 -1
- package/dist/spec/core/src/utils/is.js +0 -66
- package/dist/spec/core/src/utils/is.js.map +0 -1
- package/dist/spec/core/src/utils/is.test.js +0 -21
- package/dist/spec/core/src/utils/is.test.js.map +0 -1
- package/dist/spec/core/src/utils/json.js +0 -32
- package/dist/spec/core/src/utils/json.js.map +0 -1
- package/dist/spec/core/src/utils/json.test.js +0 -35
- package/dist/spec/core/src/utils/json.test.js.map +0 -1
- package/dist/spec/core/src/utils/logLevels.js +0 -22
- package/dist/spec/core/src/utils/logLevels.js.map +0 -1
- package/dist/spec/core/src/utils/noop.js +0 -5
- package/dist/spec/core/src/utils/noop.js.map +0 -1
- package/dist/spec/core/src/utils/promiseBuffer.js +0 -42
- package/dist/spec/core/src/utils/promiseBuffer.js.map +0 -1
- package/dist/spec/core/src/utils/promiseBuffer.test.js +0 -146
- package/dist/spec/core/src/utils/promiseBuffer.test.js.map +0 -1
- package/dist/spec/core/src/utils/reactive.js +0 -90
- package/dist/spec/core/src/utils/reactive.js.map +0 -1
- package/dist/spec/core/src/utils/reactive.test.js +0 -117
- package/dist/spec/core/src/utils/reactive.test.js.map +0 -1
- package/dist/spec/core/src/utils/sampling.js +0 -7
- package/dist/spec/core/src/utils/sampling.js.map +0 -1
- package/dist/spec/core/src/utils/sampling.test.js +0 -17
- package/dist/spec/core/src/utils/sampling.test.js.map +0 -1
- package/dist/spec/core/src/utils/shortId.js +0 -11
- package/dist/spec/core/src/utils/shortId.js.map +0 -1
- package/dist/spec/core/src/utils/sourceMaps.js +0 -8
- package/dist/spec/core/src/utils/sourceMaps.js.map +0 -1
- package/dist/spec/core/src/utils/sourceMaps.test.js +0 -17
- package/dist/spec/core/src/utils/sourceMaps.test.js.map +0 -1
- package/dist/spec/core/src/version.js +0 -6
- package/dist/spec/core/src/version.js.map +0 -1
- package/dist/types/core/src/api/ItemBuffer.d.ts +0 -7
- package/dist/types/core/src/api/apiTestHelpers.d.ts +0 -13
- package/dist/types/core/src/api/events/index.d.ts +0 -2
- package/dist/types/core/src/api/events/initialize.d.ts +0 -17
- package/dist/types/core/src/api/events/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/events/types.d.ts +0 -29
- package/dist/types/core/src/api/exceptions/const.d.ts +0 -2
- package/dist/types/core/src/api/exceptions/index.d.ts +0 -3
- package/dist/types/core/src/api/exceptions/initialize.d.ts +0 -17
- package/dist/types/core/src/api/exceptions/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/exceptions/types.d.ts +0 -61
- package/dist/types/core/src/api/index.d.ts +0 -11
- package/dist/types/core/src/api/initialize.d.ts +0 -7
- package/dist/types/core/src/api/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/itemBuffer.test.d.ts +0 -1
- package/dist/types/core/src/api/logs/const.d.ts +0 -2
- package/dist/types/core/src/api/logs/index.d.ts +0 -3
- package/dist/types/core/src/api/logs/initialize.d.ts +0 -17
- package/dist/types/core/src/api/logs/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/logs/types.d.ts +0 -24
- package/dist/types/core/src/api/measurements/index.d.ts +0 -2
- package/dist/types/core/src/api/measurements/initialize.d.ts +0 -17
- package/dist/types/core/src/api/measurements/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/measurements/types.d.ts +0 -25
- package/dist/types/core/src/api/meta/index.d.ts +0 -2
- package/dist/types/core/src/api/meta/initialize.d.ts +0 -15
- package/dist/types/core/src/api/meta/initilialize.test.d.ts +0 -1
- package/dist/types/core/src/api/meta/types.d.ts +0 -21
- package/dist/types/core/src/api/traces/index.d.ts +0 -2
- package/dist/types/core/src/api/traces/initialize.d.ts +0 -7
- package/dist/types/core/src/api/traces/types.d.ts +0 -20
- package/dist/types/core/src/api/types.d.ts +0 -14
- package/dist/types/core/src/api/userActions/const.d.ts +0 -8
- package/dist/types/core/src/api/userActions/index.d.ts +0 -4
- package/dist/types/core/src/api/userActions/initialize.d.ts +0 -21
- package/dist/types/core/src/api/userActions/initialize.test.d.ts +0 -1
- package/dist/types/core/src/api/userActions/types.d.ts +0 -55
- package/dist/types/core/src/api/userActions/userAction.d.ts +0 -36
- package/dist/types/core/src/api/userActions/userAction.test.d.ts +0 -1
- package/dist/types/core/src/api/utils.d.ts +0 -2
- package/dist/types/core/src/api/utils.test.d.ts +0 -1
- package/dist/types/core/src/config/const.d.ts +0 -6
- package/dist/types/core/src/config/index.d.ts +0 -2
- package/dist/types/core/src/config/types.d.ts +0 -237
- package/dist/types/core/src/consts.d.ts +0 -1
- package/dist/types/core/src/extensions/baseExtension.d.ts +0 -15
- package/dist/types/core/src/extensions/index.d.ts +0 -2
- package/dist/types/core/src/extensions/types.d.ts +0 -16
- package/dist/types/core/src/faro.test.d.ts +0 -1
- package/dist/types/core/src/globalObject/globalObject.d.ts +0 -6
- package/dist/types/core/src/globalObject/index.d.ts +0 -2
- package/dist/types/core/src/index.d.ts +0 -25
- package/dist/types/core/src/initialize.d.ts +0 -3
- package/dist/types/core/src/instrumentations/base.d.ts +0 -9
- package/dist/types/core/src/instrumentations/index.d.ts +0 -4
- package/dist/types/core/src/instrumentations/initialize.d.ts +0 -8
- package/dist/types/core/src/instrumentations/registerInitial.d.ts +0 -2
- package/dist/types/core/src/instrumentations/types.d.ts +0 -14
- package/dist/types/core/src/internalLogger/const.d.ts +0 -11
- package/dist/types/core/src/internalLogger/createInternalLogger.d.ts +0 -4
- package/dist/types/core/src/internalLogger/index.d.ts +0 -4
- package/dist/types/core/src/internalLogger/initialize.d.ts +0 -5
- package/dist/types/core/src/internalLogger/types.d.ts +0 -7
- package/dist/types/core/src/metas/index.d.ts +0 -3
- package/dist/types/core/src/metas/initialize.d.ts +0 -5
- package/dist/types/core/src/metas/initialize.test.d.ts +0 -1
- package/dist/types/core/src/metas/registerInitial.d.ts +0 -2
- package/dist/types/core/src/metas/types.d.ts +0 -118
- package/dist/types/core/src/sdk/const.d.ts +0 -1
- package/dist/types/core/src/sdk/faroGlobalObject.d.ts +0 -2
- package/dist/types/core/src/sdk/index.d.ts +0 -4
- package/dist/types/core/src/sdk/internalFaroGlobalObject.d.ts +0 -4
- package/dist/types/core/src/sdk/registerFaro.d.ts +0 -10
- package/dist/types/core/src/sdk/types.d.ts +0 -18
- package/dist/types/core/src/semantic.d.ts +0 -8
- package/dist/types/core/src/testUtils/index.d.ts +0 -6
- package/dist/types/core/src/testUtils/mockConfig.d.ts +0 -2
- package/dist/types/core/src/testUtils/mockInternalLogger.d.ts +0 -2
- package/dist/types/core/src/testUtils/mockStacktraceParser.d.ts +0 -2
- package/dist/types/core/src/testUtils/mockTransport.d.ts +0 -13
- package/dist/types/core/src/testUtils/testPromise.d.ts +0 -7
- package/dist/types/core/src/transports/base.d.ts +0 -8
- package/dist/types/core/src/transports/batchExecutor.d.ts +0 -16
- package/dist/types/core/src/transports/batchExecutor.test.d.ts +0 -1
- package/dist/types/core/src/transports/const.d.ts +0 -9
- package/dist/types/core/src/transports/index.d.ts +0 -6
- package/dist/types/core/src/transports/initialize.d.ts +0 -6
- package/dist/types/core/src/transports/registerInitial.d.ts +0 -2
- package/dist/types/core/src/transports/transports.test.d.ts +0 -1
- package/dist/types/core/src/transports/types.d.ts +0 -45
- package/dist/types/core/src/transports/utils.d.ts +0 -5
- package/dist/types/core/src/transports/utils.test.d.ts +0 -1
- package/dist/types/core/src/unpatchedConsole/const.d.ts +0 -2
- package/dist/types/core/src/unpatchedConsole/index.d.ts +0 -3
- package/dist/types/core/src/unpatchedConsole/initialize.d.ts +0 -4
- package/dist/types/core/src/unpatchedConsole/types.d.ts +0 -1
- package/dist/types/core/src/utils/baseObject.d.ts +0 -6
- package/dist/types/core/src/utils/date.d.ts +0 -3
- package/dist/types/core/src/utils/deepEqual.d.ts +0 -1
- package/dist/types/core/src/utils/deepEqual.test.d.ts +0 -1
- package/dist/types/core/src/utils/index.d.ts +0 -16
- package/dist/types/core/src/utils/is.d.ts +0 -32
- package/dist/types/core/src/utils/is.test.d.ts +0 -1
- package/dist/types/core/src/utils/json.d.ts +0 -3
- package/dist/types/core/src/utils/json.test.d.ts +0 -1
- package/dist/types/core/src/utils/logLevels.d.ts +0 -10
- package/dist/types/core/src/utils/noop.d.ts +0 -1
- package/dist/types/core/src/utils/promiseBuffer.d.ts +0 -14
- package/dist/types/core/src/utils/promiseBuffer.test.d.ts +0 -1
- package/dist/types/core/src/utils/reactive.d.ts +0 -17
- package/dist/types/core/src/utils/reactive.test.d.ts +0 -1
- package/dist/types/core/src/utils/sampling.d.ts +0 -1
- package/dist/types/core/src/utils/sampling.test.d.ts +0 -1
- package/dist/types/core/src/utils/shortId.d.ts +0 -1
- package/dist/types/core/src/utils/sourceMaps.d.ts +0 -1
- package/dist/types/core/src/utils/sourceMaps.test.d.ts +0 -1
- package/dist/types/core/src/version.d.ts +0 -1
package/dist/cjs/utils/is.js
CHANGED
|
@@ -9,7 +9,7 @@ function isTypeof(value, type) {
|
|
|
9
9
|
return typeof value === type;
|
|
10
10
|
}
|
|
11
11
|
function isToString(value, type) {
|
|
12
|
-
return Object.prototype.toString.call(value) ===
|
|
12
|
+
return Object.prototype.toString.call(value) === `[object ${type}]`;
|
|
13
13
|
}
|
|
14
14
|
function isInstanceOf(value, reference) {
|
|
15
15
|
try {
|
|
@@ -19,38 +19,34 @@ function isInstanceOf(value, reference) {
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.isUndefined = (
|
|
23
|
-
exports.isNull = (
|
|
24
|
-
exports.isString = (
|
|
25
|
-
exports.isNumber = (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.isThenable = (function (value) { return (0, exports.isFunction)(value === null || value === void 0 ? void 0 : value.then); });
|
|
36
|
-
exports.isPrimitive = (function (value) { return !(0, exports.isObject)(value) && !(0, exports.isFunction)(value); });
|
|
22
|
+
exports.isUndefined = ((value) => isTypeof(value, 'undefined'));
|
|
23
|
+
exports.isNull = ((value) => isTypeof(value, 'null'));
|
|
24
|
+
exports.isString = ((value) => isTypeof(value, 'string'));
|
|
25
|
+
exports.isNumber = ((value) => (isTypeof(value, 'number') && !isNaN(value)) || isTypeof(value, 'bigint'));
|
|
26
|
+
exports.isInt = ((value) => (0, exports.isNumber)(value) && Number.isInteger(value));
|
|
27
|
+
exports.isBoolean = ((value) => isTypeof(value, 'boolean'));
|
|
28
|
+
exports.isSymbol = ((value) => isTypeof(value, 'symbol'));
|
|
29
|
+
exports.isObject = ((value) => !(0, exports.isNull)(value) && isTypeof(value, 'object'));
|
|
30
|
+
exports.isFunction = ((value) => isTypeof(value, 'function'));
|
|
31
|
+
exports.isArray = ((value) => isToString(value, 'Array'));
|
|
32
|
+
exports.isRegExp = ((value) => isToString(value, 'RegExp'));
|
|
33
|
+
exports.isThenable = ((value) => (0, exports.isFunction)(value === null || value === void 0 ? void 0 : value.then));
|
|
34
|
+
exports.isPrimitive = ((value) => !(0, exports.isObject)(value) && !(0, exports.isFunction)(value));
|
|
37
35
|
exports.isEventDefined = typeof Event !== 'undefined';
|
|
38
|
-
exports.isEvent = (
|
|
36
|
+
exports.isEvent = ((value) => exports.isEventDefined && isInstanceOf(value, Event));
|
|
39
37
|
exports.isErrorDefined = typeof Error !== 'undefined';
|
|
40
|
-
exports.isError = (
|
|
41
|
-
exports.isErrorEvent = (
|
|
42
|
-
exports.isDomError = (
|
|
43
|
-
exports.isDomException = (
|
|
38
|
+
exports.isError = ((value) => exports.isErrorDefined && isInstanceOf(value, Error));
|
|
39
|
+
exports.isErrorEvent = ((value) => isToString(value, 'ErrorEvent'));
|
|
40
|
+
exports.isDomError = ((value) => isToString(value, 'DOMError'));
|
|
41
|
+
exports.isDomException = ((value) => isToString(value, 'DOMException'));
|
|
44
42
|
exports.isElementDefined = typeof Element !== 'undefined';
|
|
45
|
-
exports.isElement = (
|
|
43
|
+
exports.isElement = ((value) => exports.isElementDefined && isInstanceOf(value, Element));
|
|
46
44
|
exports.isMapDefined = typeof Map !== 'undefined';
|
|
47
|
-
exports.isMap = (
|
|
48
|
-
exports.isSyntheticEvent = (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'stopPropagation' in value;
|
|
53
|
-
});
|
|
45
|
+
exports.isMap = ((value) => exports.isMapDefined && isInstanceOf(value, Map));
|
|
46
|
+
exports.isSyntheticEvent = ((value) => (0, exports.isObject)(value) &&
|
|
47
|
+
'nativeEvent' in value &&
|
|
48
|
+
'preventDefault' in value &&
|
|
49
|
+
'stopPropagation' in value);
|
|
54
50
|
function isEmpty(value) {
|
|
55
51
|
if (value == null) {
|
|
56
52
|
return true;
|
package/dist/cjs/utils/is.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is.js","sourceRoot":"","sources":["../../../src/utils/is.ts"],"names":[],"mappings":";;;AAEA,4BAEC;AAED,gCAEC;AAED,oCAMC;AA2DD,0BAcC;AAvFD,SAAgB,QAAQ,CAAc,KAAc,EAAE,IAAY;IAChE,OAAO,OAAO,KAAK,KAAK,IAAI,CAAC;AAC/B,CAAC;AAED,SAAgB,UAAU,CAAc,KAAc,EAAE,IAAY;IAClE,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"is.js","sourceRoot":"","sources":["../../../src/utils/is.ts"],"names":[],"mappings":";;;AAEA,4BAEC;AAED,gCAEC;AAED,oCAMC;AA2DD,0BAcC;AAvFD,SAAgB,QAAQ,CAAc,KAAc,EAAE,IAAY;IAChE,OAAO,OAAO,KAAK,KAAK,IAAI,CAAC;AAC/B,CAAC;AAED,SAAgB,UAAU,CAAc,KAAc,EAAE,IAAY;IAClE,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,WAAW,IAAI,GAAG,CAAC;AACtE,CAAC;AAED,SAAgB,YAAY,CAA2B,KAAc,EAAE,SAAY;IACjF,IAAI,CAAC;QACH,OAAO,KAAK,YAAY,SAAS,CAAC;IACpC,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAEY,QAAA,WAAW,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAA0B,CAAC;AAE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AAEjG,QAAA,YAAY,GAAG,OAAO,GAAG,KAAK,WAAW,CAAC;AAE1C,QAAA,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAY,IAAI,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAA8B,CAAC;AAE3F,QAAA,gBAAgB,GAAG,CAAC,CAAC,KAAc,EAAE,EAAE,CAClD,IAAA,gBAAQ,EAAC,KAAK,CAAC;IACf,aAAa,IAAI,KAAK;IACtB,gBAAgB,IAAI,KAAK;IACzB,iBAAiB,IAAI,KAAK,CAAiC,CAAC;AAE9D,SAAgB,OAAO,CAAC,KAAU;IAChC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAA,eAAO,EAAC,KAAK,CAAC,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["export type IsFnHelper<T = unknown> = (value: unknown) => value is T;\n\nexport function isTypeof<T = unknown>(value: unknown, type: string): value is T {\n return typeof value === type;\n}\n\nexport function isToString<T = unknown>(value: unknown, type: string): value is T {\n return Object.prototype.toString.call(value) === `[object ${type}]`;\n}\n\nexport function isInstanceOf<T extends Function = any>(value: unknown, reference: T): value is T {\n try {\n return value instanceof reference;\n } catch (_err) {\n return false;\n }\n}\n\nexport const isUndefined = ((value) => isTypeof(value, 'undefined')) as IsFnHelper<undefined>;\n\nexport const isNull = ((value) => isTypeof(value, 'null')) as IsFnHelper<null>;\n\nexport const isString = ((value) => isTypeof(value, 'string')) as IsFnHelper<string>;\n\nexport const isNumber = ((value) =>\n (isTypeof<number>(value, 'number') && !isNaN(value)) || isTypeof(value, 'bigint')) as IsFnHelper<number | bigint>;\n\nexport const isInt = ((value) => isNumber(value) && Number.isInteger(value)) as IsFnHelper<number>;\n\nexport const isBoolean = ((value) => isTypeof(value, 'boolean')) as IsFnHelper<boolean>;\n\nexport const isSymbol = ((value) => isTypeof(value, 'symbol')) as IsFnHelper<Symbol>;\n\nexport const isObject = ((value) => !isNull(value) && isTypeof(value, 'object')) as IsFnHelper<object>;\n\nexport const isFunction = ((value) => isTypeof(value, 'function')) as IsFnHelper<Function>;\n\nexport const isArray = ((value) => isToString(value, 'Array')) as IsFnHelper<unknown[]>;\n\nexport const isRegExp = ((value) => isToString(value, 'RegExp')) as IsFnHelper<string>;\n\nexport const isThenable = ((value) => isFunction((value as any)?.then)) as IsFnHelper<{ then: Function }>;\n\nexport const isPrimitive = ((value) => !isObject(value) && !isFunction(value)) as IsFnHelper<\n string | number | bigint | boolean | symbol\n>;\n\nexport const isEventDefined = typeof Event !== 'undefined';\n\nexport const isEvent = ((value) => isEventDefined && isInstanceOf(value, Event)) as IsFnHelper<Event>;\n\nexport const isErrorDefined = typeof Error !== 'undefined';\n\nexport const isError = ((value) => isErrorDefined && isInstanceOf(value, Error)) as IsFnHelper<Error>;\n\nexport const isErrorEvent = ((value) => isToString(value, 'ErrorEvent')) as IsFnHelper<ErrorEvent>;\n\nexport const isDomError = ((value) => isToString(value, 'DOMError')) as IsFnHelper<DOMException>;\n\nexport const isDomException = ((value) => isToString(value, 'DOMException')) as IsFnHelper<DOMException>;\n\nexport const isElementDefined = typeof Element !== 'undefined';\n\nexport const isElement = ((value) => isElementDefined && isInstanceOf(value, Element)) as IsFnHelper<Element>;\n\nexport const isMapDefined = typeof Map !== 'undefined';\n\nexport const isMap = ((value) => isMapDefined && isInstanceOf(value, Map)) as IsFnHelper<Map<any, any>>;\n\nexport const isSyntheticEvent = ((value: unknown) =>\n isObject(value) &&\n 'nativeEvent' in value &&\n 'preventDefault' in value &&\n 'stopPropagation' in value) as unknown as IsFnHelper<Event>;\n\nexport function isEmpty(value: any): boolean {\n if (value == null) {\n return true;\n }\n\n if (isArray(value) || isString(value)) {\n return value.length === 0;\n }\n\n if (isObject(value)) {\n return Object.keys(value).length === 0;\n }\n\n return false;\n}\n"]}
|
package/dist/cjs/utils/json.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getCircularDependencyReplacer = getCircularDependencyReplacer;
|
|
4
4
|
exports.stringifyExternalJson = stringifyExternalJson;
|
|
5
5
|
exports.stringifyObjectValues = stringifyObjectValues;
|
|
6
|
-
|
|
6
|
+
const is_1 = require("./is");
|
|
7
7
|
function getCircularDependencyReplacer() {
|
|
8
|
-
|
|
8
|
+
const valueSeen = new WeakSet();
|
|
9
9
|
return function (_key, value) {
|
|
10
10
|
if ((0, is_1.isObject)(value) && value !== null) {
|
|
11
11
|
if (valueSeen.has(value)) {
|
|
@@ -16,15 +16,12 @@ function getCircularDependencyReplacer() {
|
|
|
16
16
|
return value;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function stringifyExternalJson(json) {
|
|
20
|
-
if (json === void 0) { json = {}; }
|
|
19
|
+
function stringifyExternalJson(json = {}) {
|
|
21
20
|
return JSON.stringify(json !== null && json !== void 0 ? json : {}, getCircularDependencyReplacer());
|
|
22
21
|
}
|
|
23
|
-
function stringifyObjectValues(obj) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) {
|
|
27
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
22
|
+
function stringifyObjectValues(obj = {}) {
|
|
23
|
+
const o = {};
|
|
24
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
28
25
|
o[key] = (0, is_1.isObject)(value) && value !== null ? stringifyExternalJson(value) : String(value);
|
|
29
26
|
}
|
|
30
27
|
return o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":";;AAEA,sEAWC;AAQD,sDAEC;AAED,sDAQC;AAjCD,
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":";;AAEA,sEAWC;AAQD,sDAEC;AAED,sDAQC;AAjCD,6BAAgC;AAEhC,SAAgB,6BAA6B;IAC3C,MAAM,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,OAAO,UAAU,IAAqB,EAAE,KAAc;QACpD,IAAI,IAAA,aAAQ,EAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACtC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAQD,SAAgB,qBAAqB,CAAC,OAAY,EAAE;IAClD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,EAAE,6BAA6B,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,qBAAqB,CAAC,MAA+B,EAAE;IACrE,MAAM,CAAC,GAA2B,EAAE,CAAC;IAErC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,CAAC,CAAC,GAAG,CAAC,GAAG,IAAA,aAAQ,EAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["import { isObject } from './is';\n\nexport function getCircularDependencyReplacer() {\n const valueSeen = new WeakSet();\n return function (_key: string | Symbol, value: unknown) {\n if (isObject(value) && value !== null) {\n if (valueSeen.has(value)) {\n return null;\n }\n valueSeen.add(value);\n }\n return value;\n };\n}\n\ntype JSONObject = {\n [key: string]: JSONValue;\n};\ntype JSONArray = JSONValue[] & {};\ntype JSONValue = string | number | boolean | null | JSONObject | JSONArray;\n\nexport function stringifyExternalJson(json: any = {}) {\n return JSON.stringify(json ?? {}, getCircularDependencyReplacer());\n}\n\nexport function stringifyObjectValues(obj: Record<string, unknown> = {}) {\n const o: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n o[key] = isObject(value) && value !== null ? stringifyExternalJson(value) : String(value);\n }\n\n return o;\n}\n"]}
|
|
@@ -2,41 +2,41 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPromiseBuffer = createPromiseBuffer;
|
|
4
4
|
function createPromiseBuffer(options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const { size, concurrency } = options;
|
|
6
|
+
const buffer = []; // pending, not-yet-started tasks
|
|
7
|
+
let inProgress = 0; // counter for tasks currently in progress
|
|
8
|
+
const work = () => {
|
|
9
9
|
// if there's space for a task and buffer is not empty,
|
|
10
10
|
// take one task from buffer and run it
|
|
11
11
|
if (inProgress < concurrency && buffer.length) {
|
|
12
|
-
|
|
12
|
+
const { producer, resolve, reject } = buffer.shift();
|
|
13
13
|
inProgress++;
|
|
14
|
-
producer().then(
|
|
14
|
+
producer().then((result) => {
|
|
15
15
|
inProgress--;
|
|
16
16
|
work();
|
|
17
|
-
|
|
18
|
-
},
|
|
17
|
+
resolve(result);
|
|
18
|
+
}, (reason) => {
|
|
19
19
|
inProgress--;
|
|
20
20
|
work();
|
|
21
|
-
|
|
21
|
+
reject(reason);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
const add = (promiseProducer) => {
|
|
26
26
|
if (buffer.length + inProgress >= size) {
|
|
27
27
|
throw new Error('Task buffer full');
|
|
28
28
|
}
|
|
29
|
-
return new Promise(
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
30
|
buffer.push({
|
|
31
31
|
producer: promiseProducer,
|
|
32
|
-
resolve
|
|
33
|
-
reject
|
|
32
|
+
resolve,
|
|
33
|
+
reject,
|
|
34
34
|
});
|
|
35
35
|
work();
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
return {
|
|
39
|
-
add
|
|
39
|
+
add,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
//# sourceMappingURL=promiseBuffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promiseBuffer.js","sourceRoot":"","sources":["../../../src/utils/promiseBuffer.ts"],"names":[],"mappings":";;AAmBA,kDAmDC;AAnDD,SAAgB,mBAAmB,CAAI,OAA6B;
|
|
1
|
+
{"version":3,"file":"promiseBuffer.js","sourceRoot":"","sources":["../../../src/utils/promiseBuffer.ts"],"names":[],"mappings":";;AAmBA,kDAmDC;AAnDD,SAAgB,mBAAmB,CAAI,OAA6B;IAClE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEtC,MAAM,MAAM,GAAyB,EAAE,CAAC,CAAC,iCAAiC;IAC1E,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC,0CAA0C;IAE9D,MAAM,IAAI,GAAG,GAAG,EAAE;QAChB,uDAAuD;QACvD,uCAAuC;QACvC,IAAI,UAAU,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAC9C,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAG,CAAC;YAEtD,UAAU,EAAE,CAAC;YAEb,QAAQ,EAAE,CAAC,IAAI,CACb,CAAC,MAAM,EAAE,EAAE;gBACT,UAAU,EAAE,CAAC;gBAEb,IAAI,EAAE,CAAC;gBAEP,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;gBACT,UAAU,EAAE,CAAC;gBAEb,IAAI,EAAE,CAAC;gBAEP,MAAM,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,GAAG,GAA4B,CAAC,eAAe,EAAE,EAAE;QACvD,IAAI,MAAM,CAAC,MAAM,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,MAAM,CAAC,IAAI,CAAC;gBACV,QAAQ,EAAE,eAAe;gBACzB,OAAO;gBACP,MAAM;aACP,CAAC,CAAC;YACH,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,GAAG;KACJ,CAAC;AACJ,CAAC","sourcesContent":["export interface PromiseBufferOptions {\n // total number of concurrent tasks\n concurrency: number;\n // total number of uncompleted tasks to accept\n size: number;\n}\n\nexport type PromiseProducer<T> = () => PromiseLike<T>;\n\nexport interface PromiseBuffer<T> {\n add(promiseProducer: PromiseProducer<T>): PromiseLike<T>;\n}\n\nexport interface BufferItem<T> {\n producer: PromiseProducer<T>;\n resolve: (value: T) => void;\n reject: (reason?: any) => void;\n}\n\nexport function createPromiseBuffer<T>(options: PromiseBufferOptions): PromiseBuffer<T> {\n const { size, concurrency } = options;\n\n const buffer: Array<BufferItem<T>> = []; // pending, not-yet-started tasks\n let inProgress = 0; // counter for tasks currently in progress\n\n const work = () => {\n // if there's space for a task and buffer is not empty,\n // take one task from buffer and run it\n if (inProgress < concurrency && buffer.length) {\n const { producer, resolve, reject } = buffer.shift()!;\n\n inProgress++;\n\n producer().then(\n (result) => {\n inProgress--;\n\n work();\n\n resolve(result);\n },\n (reason) => {\n inProgress--;\n\n work();\n\n reject(reason);\n }\n );\n }\n };\n\n const add: PromiseBuffer<T>['add'] = (promiseProducer) => {\n if (buffer.length + inProgress >= size) {\n throw new Error('Task buffer full');\n }\n\n return new Promise<T>((resolve, reject) => {\n buffer.push({\n producer: promiseProducer,\n resolve,\n reject,\n });\n work();\n });\n };\n\n return {\n add,\n };\n}\n"]}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Observable = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class Observable {
|
|
5
|
+
constructor() {
|
|
6
6
|
this.subscribers = [];
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
var _this = this;
|
|
8
|
+
subscribe(subscriber) {
|
|
10
9
|
this.subscribers.push(subscriber);
|
|
11
10
|
return {
|
|
12
|
-
unsubscribe:
|
|
11
|
+
unsubscribe: () => this.unsubscribe(subscriber),
|
|
13
12
|
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
this.subscribers = this.subscribers.filter(
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
this.subscribers.forEach(
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
}
|
|
14
|
+
unsubscribe(subscriber) {
|
|
15
|
+
this.subscribers = this.subscribers.filter((sub) => sub !== subscriber);
|
|
16
|
+
}
|
|
17
|
+
notify(value) {
|
|
18
|
+
this.subscribers.forEach((subscriber) => subscriber(value));
|
|
19
|
+
}
|
|
20
|
+
first() {
|
|
21
|
+
const result = new Observable();
|
|
22
|
+
const internalSubscriber = (data) => {
|
|
24
23
|
result.notify(data);
|
|
25
24
|
subscription.unsubscribe();
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const subscription = this.subscribe(internalSubscriber);
|
|
27
|
+
const resultUnsubscribeFn = result.unsubscribe.bind(result);
|
|
29
28
|
return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
}
|
|
30
|
+
takeWhile(predicate) {
|
|
31
|
+
const result = new Observable();
|
|
32
|
+
const internalSubscriber = (value) => {
|
|
34
33
|
if (predicate(value)) {
|
|
35
34
|
result.notify(value);
|
|
36
35
|
}
|
|
@@ -39,52 +38,46 @@ var Observable = /** @class */ (function () {
|
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
this.subscribe(internalSubscriber);
|
|
42
|
-
|
|
41
|
+
const resultUnsubscribeFn = result.unsubscribe.bind(result);
|
|
43
42
|
return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
}
|
|
44
|
+
filter(predicate) {
|
|
45
|
+
const result = new Observable();
|
|
46
|
+
const internalSubscriber = (value) => {
|
|
48
47
|
if (predicate(value)) {
|
|
49
48
|
result.notify(value);
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
this.subscribe(internalSubscriber);
|
|
53
|
-
|
|
52
|
+
const resultUnsubscribeFn = result.unsubscribe.bind(result);
|
|
54
53
|
return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var mergerObservable = new Observable();
|
|
62
|
-
var subscriptions = [];
|
|
63
|
-
observables.forEach(function (observable) {
|
|
64
|
-
var subscription = observable.subscribe(function (value) {
|
|
54
|
+
}
|
|
55
|
+
merge(...observables) {
|
|
56
|
+
const mergerObservable = new Observable();
|
|
57
|
+
const subscriptions = [];
|
|
58
|
+
observables.forEach((observable) => {
|
|
59
|
+
const subscription = observable.subscribe((value) => {
|
|
65
60
|
mergerObservable.notify(value);
|
|
66
61
|
});
|
|
67
62
|
subscriptions.push(subscription);
|
|
68
63
|
});
|
|
69
|
-
|
|
70
|
-
mergerObservable.unsubscribe =
|
|
71
|
-
subscriptions.forEach(
|
|
64
|
+
const originalUnsubscribeAll = mergerObservable.unsubscribeAll.bind(mergerObservable);
|
|
65
|
+
mergerObservable.unsubscribe = () => {
|
|
66
|
+
subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
72
67
|
originalUnsubscribeAll();
|
|
73
68
|
};
|
|
74
69
|
return mergerObservable;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
observable.unsubscribe = function (subscriber) {
|
|
70
|
+
}
|
|
71
|
+
withUnsubscribeOverride(observable, resultUnsubscribeFn, internalSubscriber) {
|
|
72
|
+
observable.unsubscribe = (subscriber) => {
|
|
79
73
|
resultUnsubscribeFn(subscriber);
|
|
80
|
-
|
|
74
|
+
this.unsubscribe(internalSubscriber);
|
|
81
75
|
};
|
|
82
76
|
return observable;
|
|
83
|
-
}
|
|
84
|
-
|
|
77
|
+
}
|
|
78
|
+
unsubscribeAll() {
|
|
85
79
|
this.subscribers = [];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
89
82
|
exports.Observable = Observable;
|
|
90
83
|
//# sourceMappingURL=reactive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../../src/utils/reactive.ts"],"names":[],"mappings":";;;AAMA;
|
|
1
|
+
{"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../../src/utils/reactive.ts"],"names":[],"mappings":";;;AAMA,MAAa,UAAU;IAAvB;QACU,gBAAW,GAAyB,EAAE,CAAC;IA+FjD,CAAC;IA7FC,SAAS,CAAC,UAAyB;QACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU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aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;YACpE,sBAAsB,EAAE,CAAC;QAC3B,CAAC,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAEO,uBAAuB,CAC7B,UAAyB,EACzB,mBAAwD,EACxD,kBAAiC;QAEjC,UAAU,CAAC,WAAW,GAAG,CAAC,UAAyB,EAAE,EAAE;YACrD,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAChC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;CACF;AAhGD,gCAgGC","sourcesContent":["export type Subscription = {\n unsubscribe: () => void;\n};\n\ntype Subscriber<T> = (value: T) => void;\n\nexport class Observable<T = any> {\n private subscribers: Array<Subscriber<T>> = [];\n\n subscribe(subscriber: Subscriber<T>): Subscription {\n this.subscribers.push(subscriber);\n return {\n unsubscribe: () => this.unsubscribe(subscriber),\n };\n }\n\n unsubscribe(subscriber: Subscriber<T>): void {\n this.subscribers = this.subscribers.filter((sub) => sub !== subscriber);\n }\n\n notify(value: T): void {\n this.subscribers.forEach((subscriber) => subscriber(value));\n }\n\n first(): Observable<T> {\n const result = new Observable<T>();\n\n const internalSubscriber = (data: T): void => {\n result.notify(data);\n subscription.unsubscribe();\n };\n const subscription = this.subscribe(internalSubscriber);\n const resultUnsubscribeFn = result.unsubscribe.bind(result);\n return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);\n }\n\n takeWhile(predicate: (value: T) => boolean): Observable<T> {\n const result = new Observable<T>();\n const internalSubscriber = (value: T): void => {\n if (predicate(value)) {\n result.notify(value);\n } else {\n result.unsubscribe(internalSubscriber);\n }\n };\n this.subscribe(internalSubscriber);\n const resultUnsubscribeFn = result.unsubscribe.bind(result);\n return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);\n }\n\n filter(predicate: (value: T) => boolean): Observable<T> {\n const result = new Observable<T>();\n\n const internalSubscriber = (value: T): void => {\n if (predicate(value)) {\n result.notify(value);\n }\n };\n this.subscribe(internalSubscriber);\n\n const resultUnsubscribeFn = result.unsubscribe.bind(result);\n return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);\n }\n\n merge(...observables: Array<Observable<T>>): Observable<T> {\n const mergerObservable = new Observable<T>();\n const subscriptions: Subscription[] = [];\n\n observables.forEach((observable) => {\n const subscription = observable.subscribe((value: T) => {\n mergerObservable.notify(value);\n });\n\n subscriptions.push(subscription);\n });\n\n const originalUnsubscribeAll = mergerObservable.unsubscribeAll.bind(mergerObservable);\n\n mergerObservable.unsubscribe = () => {\n subscriptions.forEach((subscription) => subscription.unsubscribe());\n originalUnsubscribeAll();\n };\n\n return mergerObservable;\n }\n\n private withUnsubscribeOverride(\n observable: Observable<T>,\n resultUnsubscribeFn: (subscriber: Subscriber<T>) => void,\n internalSubscriber: Subscriber<T>\n ) {\n observable.unsubscribe = (subscriber: Subscriber<T>) => {\n resultUnsubscribeFn(subscriber);\n this.unsubscribe(internalSubscriber);\n };\n\n return observable;\n }\n\n private unsubscribeAll(): void {\n this.subscribers = [];\n }\n}\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.genShortID = genShortID;
|
|
4
|
-
|
|
5
|
-
function genShortID(length) {
|
|
6
|
-
if (length === void 0) { length = 10; }
|
|
4
|
+
const alphabet = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789';
|
|
5
|
+
function genShortID(length = 10) {
|
|
7
6
|
return Array.from(Array(length))
|
|
8
|
-
.map(
|
|
7
|
+
.map(() => alphabet[Math.floor(Math.random() * alphabet.length)])
|
|
9
8
|
.join('');
|
|
10
9
|
}
|
|
11
10
|
//# sourceMappingURL=shortId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortId.js","sourceRoot":"","sources":["../../../src/utils/shortId.ts"],"names":[],"mappings":";;AAEA,gCAIC;AAND,
|
|
1
|
+
{"version":3,"file":"shortId.js","sourceRoot":"","sources":["../../../src/utils/shortId.ts"],"names":[],"mappings":";;AAEA,gCAIC;AAND,MAAM,QAAQ,GAAG,6DAA6D,CAAC;AAE/E,SAAgB,UAAU,CAAC,MAAM,GAAG,EAAE;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7B,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAE,CAAC;SACjE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC","sourcesContent":["const alphabet = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789';\n\nexport function genShortID(length = 10): string {\n return Array.from(Array(length))\n .map(() => alphabet[Math.floor(Math.random() * alphabet.length)]!)\n .join('');\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBundleId = getBundleId;
|
|
4
|
-
|
|
4
|
+
const globalObject_1 = require("../globalObject");
|
|
5
5
|
function getBundleId(appName) {
|
|
6
|
-
return globalObject_1.globalObject === null || globalObject_1.globalObject === void 0 ? void 0 : globalObject_1.globalObject[
|
|
6
|
+
return globalObject_1.globalObject === null || globalObject_1.globalObject === void 0 ? void 0 : globalObject_1.globalObject[`__faroBundleId_${appName}`];
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=sourceMaps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceMaps.js","sourceRoot":"","sources":["../../../src/utils/sourceMaps.ts"],"names":[],"mappings":";;AAEA,kCAEC;AAJD,
|
|
1
|
+
{"version":3,"file":"sourceMaps.js","sourceRoot":"","sources":["../../../src/utils/sourceMaps.ts"],"names":[],"mappings":";;AAEA,kCAEC;AAJD,kDAA+C;AAE/C,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAQ,2BAAoB,aAApB,2BAAY,uBAAZ,2BAAY,CAAW,kBAAkB,OAAO,EAAE,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import { globalObject } from '../globalObject';\n\nexport function getBundleId(appName: string): string | undefined {\n return (globalObject as any)?.[`__faroBundleId_${appName}`];\n}\n"]}
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.5.0';\n"]}
|
|
@@ -16,7 +16,8 @@ export function initializeExceptionsAPI({ internalLogger, config, metas, transpo
|
|
|
16
16
|
};
|
|
17
17
|
const getStacktraceParser = () => stacktraceParser;
|
|
18
18
|
const { ignoreErrors = [], preserveOriginalError } = config;
|
|
19
|
-
const pushError = (error, { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs, originalError, fingerprint } = {}) => {
|
|
19
|
+
const pushError = (error, { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs, originalError, fingerprint, fatal, } = {}) => {
|
|
20
|
+
var _a;
|
|
20
21
|
if (isErrorIgnored(ignoreErrors, originalError !== null && originalError !== void 0 ? originalError : error)) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
@@ -24,12 +25,12 @@ export function initializeExceptionsAPI({ internalLogger, config, metas, transpo
|
|
|
24
25
|
const ctx = stringifyObjectValues(Object.assign(Object.assign({}, parseCause(originalError !== null && originalError !== void 0 ? originalError : error)), (context !== null && context !== void 0 ? context : {})));
|
|
25
26
|
const item = {
|
|
26
27
|
meta: metas.value,
|
|
27
|
-
payload: Object.assign(Object.assign(Object.assign({ type: type || error.name || defaultExceptionType, value: error.message, timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(), trace: spanContext
|
|
28
|
+
payload: Object.assign(Object.assign(Object.assign(Object.assign({ type: type || error.name || defaultExceptionType, value: error.message, timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(), trace: spanContext
|
|
28
29
|
? {
|
|
29
30
|
trace_id: spanContext.traceId,
|
|
30
31
|
span_id: spanContext.spanId,
|
|
31
32
|
}
|
|
32
|
-
: tracesApi.getTraceContext() }, (isEmpty(ctx) ? {} : { context: ctx })), (preserveOriginalError ? { originalError } : {})), (fingerprint ? { fingerprint } : {})),
|
|
33
|
+
: tracesApi.getTraceContext() }, (isEmpty(ctx) ? {} : { context: ctx })), (preserveOriginalError ? { originalError } : {})), (fingerprint ? { fingerprint } : {})), (fatal !== undefined ? { fatal } : {})),
|
|
33
34
|
type: TransportItemType.EXCEPTION,
|
|
34
35
|
};
|
|
35
36
|
stackFrames = stackFrames !== null && stackFrames !== void 0 ? stackFrames : (error.stack ? stacktraceParser === null || stacktraceParser === void 0 ? void 0 : stacktraceParser(error).frames : undefined);
|
|
@@ -41,9 +42,10 @@ export function initializeExceptionsAPI({ internalLogger, config, metas, transpo
|
|
|
41
42
|
const testingPayload = {
|
|
42
43
|
type: item.payload.type,
|
|
43
44
|
value: item.payload.value,
|
|
44
|
-
|
|
45
|
+
stacktrace: item.payload.stacktrace,
|
|
45
46
|
context: item.payload.context,
|
|
46
47
|
fingerprint: item.payload.fingerprint,
|
|
48
|
+
fatal: (_a = item.payload.fatal) !== null && _a !== void 0 ? _a : false,
|
|
47
49
|
};
|
|
48
50
|
if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {
|
|
49
51
|
internalLogger.debug('Skipping error push because it is the same as the last one\n', item.payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,MAAM,UAAU,uBAAuB,CAAC,EACtC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,cAAc,GASf;;IACC,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,qBAAqB,EACr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AC;AAED,SAAS,UAAU,CAAC,KAA+B;IACjD,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAExB,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,wKAAwK;QACxK,sGAAsG;IACxG,CAAC;SAAM,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC7E,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;SAAM,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,YAAsB,EAAE,KAA+B;IAC7E,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACvC,OAAO,iBAAiB,CAAC,YAAY,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Config, Patterns } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isEmpty,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\nimport type { UserActionsAPI } from '../userActions';\nimport { addItemToUserActionBuffer } from '../userActions/initialize';\nimport { shouldIgnoreEvent } from '../utils';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n userActionsApi,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n userActionsApi: UserActionsAPI;\n}): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context' | 'fingerprint' | 'fatal'> | null =\n null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const { ignoreErrors = [], preserveOriginalError } = config;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n {\n skipDedupe,\n stackFrames,\n type,\n context,\n spanContext,\n timestampOverwriteMs,\n originalError,\n fingerprint,\n fatal,\n } = {}\n ) => {\n if (isErrorIgnored(ignoreErrors, originalError ?? error)) {\n return;\n }\n try {\n const ctx = stringifyObjectValues({\n ...parseCause(originalError ?? error),\n ...(context ?? {}),\n });\n\n const item: TransportItem<ExceptionEvent<typeof preserveOriginalError>> = {\n meta: metas.value,\n payload: {\n type: type || error.name || defaultExceptionType,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n ...(isEmpty(ctx) ? {} : { context: ctx }),\n ...(preserveOriginalError ? { originalError } : {}),\n ...(fingerprint ? { fingerprint } : {}),\n ...(fatal !== undefined ? { fatal } : {}),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stacktrace: item.payload.stacktrace,\n context: item.payload.context,\n fingerprint: item.payload.fingerprint,\n fatal: item.payload.fatal ?? false,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n if (!addItemToUserActionBuffer(userActionsApi.getActiveUserAction(), item)) {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n\nfunction isErrorIgnored(ignoreErrors: Patterns, error: ErrorWithIndexProperties): boolean {\n const { message, name, stack } = error;\n return shouldIgnoreEvent(ignoreErrors, message + ' ' + name + ' ' + stack);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/exceptions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SpanContext } from '@opentelemetry/api';\n\nimport type { TraceContext } from '../traces';\nimport type { UserAction } from '../types';\n\nexport type StacktraceParser = (err: ExtendedError) => Stacktrace;\n\nexport interface ExceptionStackFrame {\n filename: string;\n function: string;\n\n colno?: number;\n lineno?: number;\n\n bundleid?: string;\n}\n\nexport interface ExtendedError extends Error {\n columnNumber?: number;\n stacktrace?: Error['stack'];\n}\n\nexport interface Stacktrace {\n frames: ExceptionStackFrame[];\n}\n\nexport type ExceptionContext = Record<string, string>;\n\nexport interface ExceptionEventDefault {\n timestamp: string;\n type: string;\n value: string;\n\n fingerprint?: string;\n stacktrace?: Stacktrace;\n trace?: TraceContext;\n context?: ExceptionContext;\n\n action?: UserAction;\n}\n\n/**\n * The ExceptionEventExtended type is used to represent an exception event with an additional error\n * property and is only meant for client side use. The additional property is removed by Faro before\n * sending the event to the transport.\n */\nexport type ExceptionEventExtended = ExceptionEventDefault & {\n originalError?: Error;\n};\n\nexport type ExceptionEvent<EXTENDED = ExceptionEventDefault> = EXTENDED extends boolean\n ? ExceptionEventExtended\n : ExceptionEventDefault;\n\nexport interface PushErrorOptions {\n fingerprint?: string;\n skipDedupe?: boolean;\n stackFrames?: ExceptionStackFrame[];\n type?: string;\n context?: ExceptionContext;\n spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;\n timestampOverwriteMs?: number;\n /**\n * Retains the original error object in the payload after parsing.\n * This is primarily for internal, advanced use cases.\n * Faro users should not need to use this option.\n */\n originalError?: Error;\n}\n\n// ts type is missing the cause property\nexport type ErrorWithIndexProperties = Error & {\n cause?: any;\n};\n\nexport interface ExceptionsAPI {\n changeStacktraceParser: (stacktraceParser: StacktraceParser) => void;\n getStacktraceParser: () => StacktraceParser | undefined;\n pushError: (value: ErrorWithIndexProperties, options?: PushErrorOptions) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/exceptions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SpanContext } from '@opentelemetry/api';\n\nimport type { TraceContext } from '../traces';\nimport type { UserAction } from '../types';\n\nexport type StacktraceParser = (err: ExtendedError) => Stacktrace;\n\nexport interface ExceptionStackFrame {\n filename: string;\n function: string;\n\n colno?: number;\n lineno?: number;\n\n bundleid?: string;\n}\n\nexport interface ExtendedError extends Error {\n columnNumber?: number;\n stacktrace?: Error['stack'];\n}\n\nexport interface Stacktrace {\n frames: ExceptionStackFrame[];\n}\n\nexport type ExceptionContext = Record<string, string>;\n\nexport interface ExceptionEventDefault {\n timestamp: string;\n type: string;\n value: string;\n\n fatal?: boolean;\n fingerprint?: string;\n stacktrace?: Stacktrace;\n trace?: TraceContext;\n context?: ExceptionContext;\n\n action?: UserAction;\n}\n\n/**\n * The ExceptionEventExtended type is used to represent an exception event with an additional error\n * property and is only meant for client side use. The additional property is removed by Faro before\n * sending the event to the transport.\n */\nexport type ExceptionEventExtended = ExceptionEventDefault & {\n originalError?: Error;\n};\n\nexport type ExceptionEvent<EXTENDED = ExceptionEventDefault> = EXTENDED extends boolean\n ? ExceptionEventExtended\n : ExceptionEventDefault;\n\nexport interface PushErrorOptions {\n fatal?: boolean;\n fingerprint?: string;\n skipDedupe?: boolean;\n stackFrames?: ExceptionStackFrame[];\n type?: string;\n context?: ExceptionContext;\n spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;\n timestampOverwriteMs?: number;\n /**\n * Retains the original error object in the payload after parsing.\n * This is primarily for internal, advanced use cases.\n * Faro users should not need to use this option.\n */\n originalError?: Error;\n}\n\n// ts type is missing the cause property\nexport type ErrorWithIndexProperties = Error & {\n cause?: any;\n};\n\nexport interface ExceptionsAPI {\n changeStacktraceParser: (stacktraceParser: StacktraceParser) => void;\n getStacktraceParser: () => StacktraceParser | undefined;\n pushError: (value: ErrorWithIndexProperties, options?: PushErrorOptions) => void;\n}\n"]}
|
package/dist/esm/api/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { initializeAPI } from './initialize';
|
|
2
|
+
export { getNoopAPI } from './noop';
|
|
2
3
|
export { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';
|
|
3
4
|
export { defaultLogArgsSerializer } from './logs';
|
|
4
5
|
export { UserActionImportance, UserActionState, userActionsMessageBus, } from './userActions';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAKpC,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAYhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAOlD,OAAO,EACL,oBAAoB,EAEpB,eAAe,EAIf,qBAAqB,GACtB,MAAM,eAAe,CAAC","sourcesContent":["export { initializeAPI } from './initialize';\nexport { getNoopAPI } from './noop';\nexport type { API, APIEvent, UserAction } from './types';\n\nexport type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';\n\nexport { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';\nexport type {\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n PushErrorOptions,\n Stacktrace,\n StacktraceParser,\n ExceptionEventExtended,\n} from './exceptions';\n\nexport { defaultLogArgsSerializer } from './logs';\nexport type { LogContext, LogEvent, LogArgsSerializer, LogsAPI, PushLogOptions } from './logs';\n\nexport type { MeasurementEvent, MeasurementsAPI, PushMeasurementOptions } from './measurements';\n\nexport type { MetaAPI } from './meta';\n\nexport {\n UserActionImportance,\n type UserActionImportanceType,\n UserActionState,\n type UserActionInterface,\n type UserActionInternalInterface,\n type UserActionsAPI,\n userActionsMessageBus,\n} from './userActions';\n\nexport type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';\n"]}
|