@grafana/faro-core 1.14.3 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/faro-core.iife.js +1 -1
- package/dist/bundle/types/api/const.d.ts +4 -3
- package/dist/bundle/types/api/index.d.ts +2 -2
- package/dist/bundle/types/api/logs/initialize.d.ts +1 -1
- package/dist/bundle/types/api/measurements/initialize.d.ts +1 -2
- package/dist/bundle/types/api/traces/initialize.d.ts +1 -1
- package/dist/bundle/types/api/types.d.ts +16 -6
- package/dist/bundle/types/extensions/baseExtension.d.ts +1 -1
- package/dist/bundle/types/globalObject/globalObject.d.ts +1 -2
- package/dist/bundle/types/index.d.ts +3 -3
- package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/bundle/types/utils/index.d.ts +1 -1
- package/dist/bundle/types/utils/reactive.d.ts +12 -41
- package/dist/bundle/types/version.d.ts +1 -1
- package/dist/cjs/api/ItemBuffer.js.map +1 -1
- package/dist/cjs/api/const.js +5 -4
- package/dist/cjs/api/const.js.map +1 -1
- package/dist/cjs/api/events/initialize.js +2 -3
- package/dist/cjs/api/events/initialize.js.map +1 -1
- package/dist/cjs/api/exceptions/const.js.map +1 -1
- package/dist/cjs/api/exceptions/initialize.js +2 -3
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/api/index.js +5 -4
- package/dist/cjs/api/index.js.map +1 -1
- package/dist/cjs/api/initialize.js +2 -2
- package/dist/cjs/api/initialize.js.map +1 -1
- package/dist/cjs/api/logs/const.js.map +1 -1
- package/dist/cjs/api/logs/initialize.js +2 -3
- package/dist/cjs/api/logs/initialize.js.map +1 -1
- package/dist/cjs/api/measurements/initialize.js +2 -3
- package/dist/cjs/api/measurements/initialize.js.map +1 -1
- package/dist/cjs/api/meta/initialize.js +1 -2
- package/dist/cjs/api/meta/initialize.js.map +1 -1
- package/dist/cjs/api/traces/initialize.js +1 -2
- package/dist/cjs/api/traces/initialize.js.map +1 -1
- package/dist/cjs/api/types.js.map +1 -1
- package/dist/cjs/api/userActionLifecycleHandler.js +4 -5
- package/dist/cjs/api/userActionLifecycleHandler.js.map +1 -1
- package/dist/cjs/api/utils.js +1 -2
- package/dist/cjs/api/utils.js.map +1 -1
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/initialize.js +1 -2
- package/dist/cjs/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/base.js.map +1 -1
- package/dist/cjs/instrumentations/initialize.js +1 -2
- 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 +1 -2
- package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/cjs/internalLogger/initialize.js +2 -2
- package/dist/cjs/internalLogger/initialize.js.map +1 -1
- package/dist/cjs/metas/initialize.js +1 -2
- package/dist/cjs/metas/initialize.js.map +1 -1
- package/dist/cjs/metas/registerInitial.js +1 -2
- package/dist/cjs/metas/registerInitial.js.map +1 -1
- package/dist/cjs/sdk/faroGlobalObject.js +1 -2
- package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/internalFaroGlobalObject.js +3 -4
- package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/registerFaro.js +2 -2
- package/dist/cjs/sdk/registerFaro.js.map +1 -1
- package/dist/cjs/testUtils/mockConfig.js +1 -2
- package/dist/cjs/testUtils/mockConfig.js.map +1 -1
- package/dist/cjs/testUtils/mockStacktraceParser.js.map +1 -1
- package/dist/cjs/testUtils/mockTransport.js.map +1 -1
- package/dist/cjs/testUtils/testPromise.js +1 -2
- package/dist/cjs/testUtils/testPromise.js.map +1 -1
- package/dist/cjs/transports/batchExecutor.js.map +1 -1
- package/dist/cjs/transports/const.js +1 -1
- package/dist/cjs/transports/const.js.map +1 -1
- package/dist/cjs/transports/initialize.js +1 -2
- 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 +2 -3
- package/dist/cjs/transports/utils.js.map +1 -1
- package/dist/cjs/unpatchedConsole/initialize.js +2 -2
- package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
- package/dist/cjs/utils/date.js +3 -4
- package/dist/cjs/utils/date.js.map +1 -1
- package/dist/cjs/utils/deepEqual.js +1 -2
- package/dist/cjs/utils/deepEqual.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -2
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/is.js +5 -5
- package/dist/cjs/utils/is.js.map +1 -1
- package/dist/cjs/utils/json.js +3 -4
- package/dist/cjs/utils/json.js.map +1 -1
- package/dist/cjs/utils/logLevels.js +1 -1
- package/dist/cjs/utils/logLevels.js.map +1 -1
- package/dist/cjs/utils/noop.js +1 -2
- package/dist/cjs/utils/noop.js.map +1 -1
- package/dist/cjs/utils/promiseBuffer.js +1 -2
- package/dist/cjs/utils/promiseBuffer.js.map +1 -1
- package/dist/cjs/utils/reactive.js +61 -75
- package/dist/cjs/utils/reactive.js.map +1 -1
- package/dist/cjs/utils/shortId.js +1 -2
- package/dist/cjs/utils/shortId.js.map +1 -1
- package/dist/cjs/utils/sourceMaps.js +1 -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/ItemBuffer.js.map +1 -1
- package/dist/esm/api/const.js +4 -3
- package/dist/esm/api/const.js.map +1 -1
- package/dist/esm/api/events/initialize.js +2 -2
- package/dist/esm/api/events/initialize.js.map +1 -1
- package/dist/esm/api/exceptions/const.js.map +1 -1
- package/dist/esm/api/exceptions/initialize.js +2 -2
- package/dist/esm/api/exceptions/initialize.js.map +1 -1
- package/dist/esm/api/index.js +1 -1
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/logs/const.js.map +1 -1
- package/dist/esm/api/logs/initialize.js +2 -2
- package/dist/esm/api/logs/initialize.js.map +1 -1
- package/dist/esm/api/measurements/initialize.js +2 -2
- package/dist/esm/api/measurements/initialize.js.map +1 -1
- package/dist/esm/api/meta/initialize.js.map +1 -1
- package/dist/esm/api/traces/initialize.js.map +1 -1
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/api/userActionLifecycleHandler.js +4 -4
- package/dist/esm/api/userActionLifecycleHandler.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/initialize.js.map +1 -1
- package/dist/esm/instrumentations/initialize.js.map +1 -1
- package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/esm/metas/initialize.js.map +1 -1
- package/dist/esm/metas/registerInitial.js.map +1 -1
- package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
- package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/esm/testUtils/mockStacktraceParser.js.map +1 -1
- package/dist/esm/transports/batchExecutor.js.map +1 -1
- package/dist/esm/transports/initialize.js.map +1 -1
- package/dist/esm/transports/utils.js.map +1 -1
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/is.js.map +1 -1
- package/dist/esm/utils/json.js.map +1 -1
- package/dist/esm/utils/promiseBuffer.js.map +1 -1
- package/dist/esm/utils/reactive.js +55 -69
- package/dist/esm/utils/reactive.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/spec/core/src/api/ItemBuffer.js.map +1 -1
- package/dist/spec/core/src/api/const.js +5 -4
- package/dist/spec/core/src/api/const.js.map +1 -1
- package/dist/spec/core/src/api/events/initialize.js +2 -3
- package/dist/spec/core/src/api/events/initialize.js.map +1 -1
- package/dist/spec/core/src/api/events/initialize.test.js +3 -3
- package/dist/spec/core/src/api/events/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/const.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/initialize.js +2 -3
- package/dist/spec/core/src/api/exceptions/initialize.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/initialize.test.js +3 -3
- package/dist/spec/core/src/api/exceptions/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/index.js +5 -4
- package/dist/spec/core/src/api/index.js.map +1 -1
- package/dist/spec/core/src/api/initialize.js +2 -2
- package/dist/spec/core/src/api/initialize.js.map +1 -1
- package/dist/spec/core/src/api/initialize.test.js +17 -7
- package/dist/spec/core/src/api/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/logs/const.js.map +1 -1
- package/dist/spec/core/src/api/logs/initialize.js +2 -3
- package/dist/spec/core/src/api/logs/initialize.js.map +1 -1
- package/dist/spec/core/src/api/logs/initialize.test.js +3 -3
- package/dist/spec/core/src/api/logs/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/measurements/initialize.js +2 -3
- package/dist/spec/core/src/api/measurements/initialize.js.map +1 -1
- package/dist/spec/core/src/api/measurements/initialize.test.js +3 -3
- package/dist/spec/core/src/api/measurements/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/meta/initialize.js +1 -2
- package/dist/spec/core/src/api/meta/initialize.js.map +1 -1
- package/dist/spec/core/src/api/traces/initialize.js +1 -2
- package/dist/spec/core/src/api/traces/initialize.js.map +1 -1
- package/dist/spec/core/src/api/types.js.map +1 -1
- package/dist/spec/core/src/api/userActionLifecycleHandler.js +4 -5
- package/dist/spec/core/src/api/userActionLifecycleHandler.js.map +1 -1
- package/dist/spec/core/src/api/userActionLifecycleHandler.test.js +26 -9
- package/dist/spec/core/src/api/userActionLifecycleHandler.test.js.map +1 -1
- package/dist/spec/core/src/api/utils.js +1 -2
- package/dist/spec/core/src/api/utils.js.map +1 -1
- package/dist/spec/core/src/index.js +6 -6
- package/dist/spec/core/src/index.js.map +1 -1
- package/dist/spec/core/src/initialize.js +1 -2
- package/dist/spec/core/src/initialize.js.map +1 -1
- package/dist/spec/core/src/instrumentations/base.js.map +1 -1
- package/dist/spec/core/src/instrumentations/initialize.js +1 -2
- package/dist/spec/core/src/instrumentations/initialize.js.map +1 -1
- package/dist/spec/core/src/instrumentations/registerInitial.js +1 -2
- package/dist/spec/core/src/instrumentations/registerInitial.js.map +1 -1
- package/dist/spec/core/src/internalLogger/const.js +1 -1
- package/dist/spec/core/src/internalLogger/const.js.map +1 -1
- package/dist/spec/core/src/internalLogger/createInternalLogger.js +1 -2
- package/dist/spec/core/src/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/spec/core/src/internalLogger/initialize.js +2 -2
- package/dist/spec/core/src/internalLogger/initialize.js.map +1 -1
- package/dist/spec/core/src/metas/initialize.js +1 -2
- package/dist/spec/core/src/metas/initialize.js.map +1 -1
- package/dist/spec/core/src/metas/registerInitial.js +1 -2
- package/dist/spec/core/src/metas/registerInitial.js.map +1 -1
- package/dist/spec/core/src/sdk/faroGlobalObject.js +1 -2
- package/dist/spec/core/src/sdk/faroGlobalObject.js.map +1 -1
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js +3 -4
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/spec/core/src/sdk/registerFaro.js +2 -2
- package/dist/spec/core/src/sdk/registerFaro.js.map +1 -1
- package/dist/spec/core/src/testUtils/mockConfig.js +1 -2
- package/dist/spec/core/src/testUtils/mockConfig.js.map +1 -1
- package/dist/spec/core/src/testUtils/mockStacktraceParser.js.map +1 -1
- package/dist/spec/core/src/testUtils/mockTransport.js.map +1 -1
- package/dist/spec/core/src/testUtils/testPromise.js +1 -2
- package/dist/spec/core/src/testUtils/testPromise.js.map +1 -1
- package/dist/spec/core/src/transports/batchExecutor.js.map +1 -1
- package/dist/spec/core/src/transports/const.js +1 -1
- package/dist/spec/core/src/transports/const.js.map +1 -1
- package/dist/spec/core/src/transports/initialize.js +1 -2
- package/dist/spec/core/src/transports/initialize.js.map +1 -1
- package/dist/spec/core/src/transports/registerInitial.js +1 -2
- package/dist/spec/core/src/transports/registerInitial.js.map +1 -1
- package/dist/spec/core/src/transports/transports.test.js.map +1 -1
- package/dist/spec/core/src/transports/utils.js +2 -3
- package/dist/spec/core/src/transports/utils.js.map +1 -1
- package/dist/spec/core/src/unpatchedConsole/initialize.js +2 -2
- package/dist/spec/core/src/unpatchedConsole/initialize.js.map +1 -1
- package/dist/spec/core/src/utils/date.js +3 -4
- package/dist/spec/core/src/utils/date.js.map +1 -1
- package/dist/spec/core/src/utils/deepEqual.js +1 -2
- package/dist/spec/core/src/utils/deepEqual.js.map +1 -1
- package/dist/spec/core/src/utils/index.js +1 -2
- package/dist/spec/core/src/utils/index.js.map +1 -1
- package/dist/spec/core/src/utils/is.js +5 -5
- package/dist/spec/core/src/utils/is.js.map +1 -1
- package/dist/spec/core/src/utils/json.js +3 -4
- package/dist/spec/core/src/utils/json.js.map +1 -1
- package/dist/spec/core/src/utils/logLevels.js +1 -1
- package/dist/spec/core/src/utils/logLevels.js.map +1 -1
- package/dist/spec/core/src/utils/noop.js +1 -2
- package/dist/spec/core/src/utils/noop.js.map +1 -1
- package/dist/spec/core/src/utils/promiseBuffer.js +1 -2
- package/dist/spec/core/src/utils/promiseBuffer.js.map +1 -1
- package/dist/spec/core/src/utils/promiseBuffer.test.js +2 -2
- package/dist/spec/core/src/utils/reactive.js +61 -75
- package/dist/spec/core/src/utils/reactive.js.map +1 -1
- package/dist/spec/core/src/utils/reactive.test.js +32 -19
- package/dist/spec/core/src/utils/reactive.test.js.map +1 -1
- package/dist/spec/core/src/utils/shortId.js +1 -2
- package/dist/spec/core/src/utils/shortId.js.map +1 -1
- package/dist/spec/core/src/utils/sourceMaps.js +1 -2
- package/dist/spec/core/src/utils/sourceMaps.js.map +1 -1
- package/dist/spec/core/src/version.js +1 -1
- package/dist/spec/core/src/version.js.map +1 -1
- package/dist/types/api/const.d.ts +4 -3
- package/dist/types/api/index.d.ts +2 -2
- package/dist/types/api/logs/initialize.d.ts +1 -1
- package/dist/types/api/measurements/initialize.d.ts +1 -2
- package/dist/types/api/traces/initialize.d.ts +1 -1
- package/dist/types/api/types.d.ts +16 -6
- package/dist/types/core/src/api/const.d.ts +4 -3
- package/dist/types/core/src/api/index.d.ts +2 -2
- package/dist/types/core/src/api/logs/initialize.d.ts +1 -1
- package/dist/types/core/src/api/measurements/initialize.d.ts +1 -2
- package/dist/types/core/src/api/traces/initialize.d.ts +1 -1
- package/dist/types/core/src/api/types.d.ts +16 -6
- package/dist/types/core/src/extensions/baseExtension.d.ts +1 -1
- package/dist/types/core/src/globalObject/globalObject.d.ts +1 -2
- package/dist/types/core/src/index.d.ts +3 -3
- package/dist/types/core/src/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/core/src/utils/index.d.ts +1 -1
- package/dist/types/core/src/utils/reactive.d.ts +12 -41
- package/dist/types/core/src/version.d.ts +1 -1
- package/dist/types/extensions/baseExtension.d.ts +1 -1
- package/dist/types/globalObject/globalObject.d.ts +1 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/reactive.d.ts +12 -41
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ var LogLevel;
|
|
|
9
9
|
LogLevel["LOG"] = "log";
|
|
10
10
|
LogLevel["WARN"] = "warn";
|
|
11
11
|
LogLevel["ERROR"] = "error";
|
|
12
|
-
})(LogLevel
|
|
12
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
13
13
|
exports.defaultLogLevel = LogLevel.LOG;
|
|
14
14
|
exports.allLogLevels = [
|
|
15
15
|
LogLevel.TRACE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logLevels.js","sourceRoot":"","sources":["../../../src/utils/logLevels.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EAPW,QAAQ,
|
|
1
|
+
{"version":3,"file":"logLevels.js","sourceRoot":"","sources":["../../../src/utils/logLevels.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB;AAEY,QAAA,eAAe,GAAG,QAAQ,CAAC,GAAG,CAAC;AAE/B,QAAA,YAAY,GAAwC;IAC/D,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,GAAG;IACZ,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,KAAK;CACN,CAAC","sourcesContent":["export enum LogLevel {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n LOG = 'log',\n WARN = 'warn',\n ERROR = 'error',\n}\n\nexport const defaultLogLevel = LogLevel.LOG;\n\nexport const allLogLevels: Readonly<Array<Readonly<LogLevel>>> = [\n LogLevel.TRACE,\n LogLevel.DEBUG,\n LogLevel.INFO,\n LogLevel.LOG,\n LogLevel.WARN,\n LogLevel.ERROR,\n] as const;\n"]}
|
package/dist/cjs/utils/noop.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop.js","sourceRoot":"","sources":["../../../src/utils/noop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"noop.js","sourceRoot":"","sources":["../../../src/utils/noop.ts"],"names":[],"mappings":";;AAAA,oBAA+B;AAA/B,SAAgB,IAAI,KAAU,CAAC","sourcesContent":["export function noop(): void {}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPromiseBuffer =
|
|
3
|
+
exports.createPromiseBuffer = createPromiseBuffer;
|
|
4
4
|
function createPromiseBuffer(options) {
|
|
5
5
|
var size = options.size, concurrency = options.concurrency;
|
|
6
6
|
var buffer = []; // pending, not-yet-started tasks
|
|
@@ -39,5 +39,4 @@ function createPromiseBuffer(options) {
|
|
|
39
39
|
add: add,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
exports.createPromiseBuffer = createPromiseBuffer;
|
|
43
42
|
//# sourceMappingURL=promiseBuffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promiseBuffer.js","sourceRoot":"","sources":["../../../src/utils/promiseBuffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promiseBuffer.js","sourceRoot":"","sources":["../../../src/utils/promiseBuffer.ts"],"names":[],"mappings":";;AAmBA,kDAmDC;AAnDD,SAAgB,mBAAmB,CAAI,OAA6B;IAC1D,IAAA,IAAI,GAAkB,OAAO,KAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,CAAa;IAEtC,IAAM,MAAM,GAAyB,EAAE,CAAC,CAAC,iCAAiC;IAC1E,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC,0CAA0C;IAE9D,IAAM,IAAI,GAAG;QACX,uDAAuD;QACvD,uCAAuC;QACvC,IAAI,UAAU,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACxC,IAAA,KAAgC,MAAM,CAAC,KAAK,EAAG,EAA7C,QAAQ,cAAA,EAAE,SAAO,aAAA,EAAE,QAAM,YAAoB,CAAC;YAEtD,UAAU,EAAE,CAAC;YAEb,QAAQ,EAAE,CAAC,IAAI,CACb,UAAC,MAAM;gBACL,UAAU,EAAE,CAAC;gBAEb,IAAI,EAAE,CAAC;gBAEP,SAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,EACD,UAAC,MAAM;gBACL,UAAU,EAAE,CAAC;gBAEb,IAAI,EAAE,CAAC;gBAEP,QAAM,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,IAAM,GAAG,GAA4B,UAAC,eAAe;QACnD,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,UAAC,OAAO,EAAE,MAAM;YACpC,MAAM,CAAC,IAAI,CAAC;gBACV,QAAQ,EAAE,eAAe;gBACzB,OAAO,SAAA;gBACP,MAAM,QAAA;aACP,CAAC,CAAC;YACH,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,KAAA;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,104 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Observable = void 0;
|
|
4
4
|
var Observable = /** @class */ (function () {
|
|
5
5
|
function Observable() {
|
|
6
6
|
this.subscribers = [];
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
* Subscribes a callback function to the observable.
|
|
10
|
-
* @param callback - The function to call when the observable emits a value.
|
|
11
|
-
* @returns A subscription object with an unsubscribe method to cancel the subscription.
|
|
12
|
-
*/
|
|
13
|
-
Observable.prototype.subscribe = function (callback) {
|
|
8
|
+
Observable.prototype.subscribe = function (subscriber) {
|
|
14
9
|
var _this = this;
|
|
15
|
-
this.subscribers.push(
|
|
10
|
+
this.subscribers.push(subscriber);
|
|
16
11
|
return {
|
|
17
|
-
unsubscribe: function () { return _this.unsubscribe(
|
|
12
|
+
unsubscribe: function () { return _this.unsubscribe(subscriber); },
|
|
18
13
|
};
|
|
19
14
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* @param data - The data to emit to all subscribers.
|
|
23
|
-
*/
|
|
24
|
-
Observable.prototype.notify = function (data) {
|
|
25
|
-
this.subscribers.forEach(function (callback) { return callback(data); });
|
|
15
|
+
Observable.prototype.unsubscribe = function (subscriber) {
|
|
16
|
+
this.subscribers = this.subscribers.filter(function (sub) { return sub !== subscriber; });
|
|
26
17
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
callback(data);
|
|
18
|
+
Observable.prototype.notify = function (value) {
|
|
19
|
+
this.subscribers.forEach(function (subscriber) { return subscriber(value); });
|
|
20
|
+
};
|
|
21
|
+
Observable.prototype.first = function () {
|
|
22
|
+
var result = new Observable();
|
|
23
|
+
var internalSubscriber = function (data) {
|
|
24
|
+
result.notify(data);
|
|
35
25
|
subscription.unsubscribe();
|
|
36
|
-
}
|
|
37
|
-
|
|
26
|
+
};
|
|
27
|
+
var subscription = this.subscribe(internalSubscriber);
|
|
28
|
+
var resultUnsubscribeFn = result.unsubscribe.bind(result);
|
|
29
|
+
return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);
|
|
38
30
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Emits values from the source observable until the provided predicate function returns false.
|
|
41
|
-
* @param predicate - A function that evaluates each value emitted by the source observable.
|
|
42
|
-
* @returns A new observable that emits values from the source observable while the predicate returns true.
|
|
43
|
-
*/
|
|
44
31
|
Observable.prototype.takeWhile = function (predicate) {
|
|
45
32
|
var result = new Observable();
|
|
46
|
-
var
|
|
33
|
+
var internalSubscriber = function (value) {
|
|
47
34
|
if (predicate(value)) {
|
|
48
35
|
result.notify(value);
|
|
49
36
|
}
|
|
50
37
|
else {
|
|
51
|
-
|
|
38
|
+
result.unsubscribe(internalSubscriber);
|
|
52
39
|
}
|
|
40
|
+
};
|
|
41
|
+
this.subscribe(internalSubscriber);
|
|
42
|
+
var resultUnsubscribeFn = result.unsubscribe.bind(result);
|
|
43
|
+
return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);
|
|
44
|
+
};
|
|
45
|
+
Observable.prototype.filter = function (predicate) {
|
|
46
|
+
var result = new Observable();
|
|
47
|
+
var internalSubscriber = function (value) {
|
|
48
|
+
if (predicate(value)) {
|
|
49
|
+
result.notify(value);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
this.subscribe(internalSubscriber);
|
|
53
|
+
var resultUnsubscribeFn = result.unsubscribe.bind(result);
|
|
54
|
+
return this.withUnsubscribeOverride(result, resultUnsubscribeFn, internalSubscriber);
|
|
55
|
+
};
|
|
56
|
+
Observable.prototype.merge = function () {
|
|
57
|
+
var observables = [];
|
|
58
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
59
|
+
observables[_i] = arguments[_i];
|
|
60
|
+
}
|
|
61
|
+
var mergerObservable = new Observable();
|
|
62
|
+
var subscriptions = [];
|
|
63
|
+
observables.forEach(function (observable) {
|
|
64
|
+
var subscription = observable.subscribe(function (value) {
|
|
65
|
+
mergerObservable.notify(value);
|
|
66
|
+
});
|
|
67
|
+
subscriptions.push(subscription);
|
|
53
68
|
});
|
|
54
|
-
|
|
69
|
+
var originalUnsubscribeAll = mergerObservable.unsubscribeAll.bind(mergerObservable);
|
|
70
|
+
mergerObservable.unsubscribe = function () {
|
|
71
|
+
subscriptions.forEach(function (subscription) { return subscription.unsubscribe(); });
|
|
72
|
+
originalUnsubscribeAll();
|
|
73
|
+
};
|
|
74
|
+
return mergerObservable;
|
|
75
|
+
};
|
|
76
|
+
Observable.prototype.withUnsubscribeOverride = function (observable, resultUnsubscribeFn, internalSubscriber) {
|
|
77
|
+
var _this = this;
|
|
78
|
+
observable.unsubscribe = function (subscriber) {
|
|
79
|
+
resultUnsubscribeFn(subscriber);
|
|
80
|
+
_this.unsubscribe(internalSubscriber);
|
|
81
|
+
};
|
|
82
|
+
return observable;
|
|
55
83
|
};
|
|
56
|
-
/**
|
|
57
|
-
* Unsubscribes all subscribers by clearing the subscribers array.
|
|
58
|
-
*
|
|
59
|
-
* @remarks
|
|
60
|
-
* This method sets the `subscribers` array to an empty array, effectively removing all current subscribers.
|
|
61
|
-
*/
|
|
62
84
|
Observable.prototype.unsubscribeAll = function () {
|
|
63
85
|
this.subscribers = [];
|
|
64
86
|
};
|
|
65
|
-
Observable.prototype.unsubscribe = function (callback) {
|
|
66
|
-
this.subscribers = this.subscribers.filter(function (sub) { return sub !== callback; });
|
|
67
|
-
};
|
|
68
87
|
return Observable;
|
|
69
88
|
}());
|
|
70
89
|
exports.Observable = Observable;
|
|
71
|
-
/**
|
|
72
|
-
* Merges multiple observables into a single observable.
|
|
73
|
-
*
|
|
74
|
-
* @template T - The type of the values emitted by the observables.
|
|
75
|
-
* @param {...Observable[]} observables - The observables to merge.
|
|
76
|
-
* @returns {Observable} A new observable that emits values from all input observables.
|
|
77
|
-
*/
|
|
78
|
-
function merge() {
|
|
79
|
-
var observables = [];
|
|
80
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
81
|
-
observables[_i] = arguments[_i];
|
|
82
|
-
}
|
|
83
|
-
var mainObservable = new Observable();
|
|
84
|
-
var subscriptions = [];
|
|
85
|
-
observables.forEach(function (observable) {
|
|
86
|
-
var subscription = observable.subscribe(function (value) {
|
|
87
|
-
mainObservable.notify(value);
|
|
88
|
-
});
|
|
89
|
-
subscriptions.push(subscription);
|
|
90
|
-
});
|
|
91
|
-
return {
|
|
92
|
-
subscribe: mainObservable.subscribe.bind(mainObservable),
|
|
93
|
-
takeWhile: mainObservable.takeWhile.bind(mainObservable),
|
|
94
|
-
first: mainObservable.first.bind(mainObservable),
|
|
95
|
-
notify: mainObservable.notify.bind(mainObservable),
|
|
96
|
-
unsubscribeAll: function () {
|
|
97
|
-
observables.forEach(function (observable) {
|
|
98
|
-
observable.unsubscribeAll();
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
exports.merge = merge;
|
|
104
90
|
//# sourceMappingURL=reactive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../../src/utils/reactive.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../../src/utils/reactive.ts"],"names":[],"mappings":";;;AAMA;I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a,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,IAAM,sBAAsB,GAAG,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAEtF,gBAAgB,CAAC,WAAW,GAAG;YAC7B,aAAa,CAAC,OAAO,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,WAAW,EAAE,EAA1B,CAA0B,CAAC,CAAC;YACpE,sBAAsB,EAAE,CAAC;QAC3B,CAAC,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAEO,4CAAuB,GAA/B,UACE,UAAyB,EACzB,mBAAwD,EACxD,kBAAiC;QAHnC,iBAWC;QANC,UAAU,CAAC,WAAW,GAAG,UAAC,UAAyB;YACjD,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAChC,KAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;IAEO,mCAAc,GAAtB;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IACH,iBAAC;AAAD,CAAC,AAhGD,IAgGC;AAhGY,gCAAU","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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.genShortID =
|
|
3
|
+
exports.genShortID = genShortID;
|
|
4
4
|
var alphabet = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789';
|
|
5
5
|
function genShortID(length) {
|
|
6
6
|
if (length === void 0) { length = 10; }
|
|
@@ -8,5 +8,4 @@ function genShortID(length) {
|
|
|
8
8
|
.map(function () { return alphabet[Math.floor(Math.random() * alphabet.length)]; })
|
|
9
9
|
.join('');
|
|
10
10
|
}
|
|
11
|
-
exports.genShortID = genShortID;
|
|
12
11
|
//# sourceMappingURL=shortId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortId.js","sourceRoot":"","sources":["../../../src/utils/shortId.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shortId.js","sourceRoot":"","sources":["../../../src/utils/shortId.ts"],"names":[],"mappings":";;AAEA,gCAIC;AAND,IAAM,QAAQ,GAAG,6DAA6D,CAAC;AAE/E,SAAgB,UAAU,CAAC,MAAW;IAAX,uBAAA,EAAA,WAAW;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7B,GAAG,CAAC,cAAM,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAE,EAAtD,CAAsD,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,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBundleId =
|
|
3
|
+
exports.getBundleId = getBundleId;
|
|
4
4
|
var globalObject_1 = require("../globalObject");
|
|
5
5
|
function getBundleId(appName) {
|
|
6
6
|
return globalObject_1.globalObject === null || globalObject_1.globalObject === void 0 ? void 0 : globalObject_1.globalObject["__faroBundleId_".concat(appName)];
|
|
7
7
|
}
|
|
8
|
-
exports.getBundleId = getBundleId;
|
|
9
8
|
//# sourceMappingURL=sourceMaps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceMaps.js","sourceRoot":"","sources":["../../../src/utils/sourceMaps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sourceMaps.js","sourceRoot":"","sources":["../../../src/utils/sourceMaps.ts"],"names":[],"mappings":";;AAEA,kCAEC;AAJD,gDAA+C;AAE/C,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAQ,2BAAoB,aAApB,2BAAY,uBAAZ,2BAAY,CAAW,yBAAkB,OAAO,CAAE,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,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.15.0';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemBuffer.js","sourceRoot":"","sources":["../../../src/api/ItemBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAO,UAAU;IAGrB;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,IAAO;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,WAAW,CAAC,EAAsB;QAChC,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"ItemBuffer.js","sourceRoot":"","sources":["../../../src/api/ItemBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAO,UAAU;IAGrB;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,IAAO;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,WAAW,CAAC,EAAsB;QAChC,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;YACnB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAC/B,EAAE,CAAC,IAAI,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { isFunction } from '../utils/is';\n\nexport class ItemBuffer<T> {\n private buffer: T[];\n\n constructor() {\n this.buffer = [];\n }\n\n addItem(item: T) {\n this.buffer.push(item);\n }\n\n flushBuffer(cb?: (item: T) => void) {\n if (isFunction(cb)) {\n for (const item of this.buffer) {\n cb(item);\n }\n }\n\n this.buffer.length = 0;\n }\n\n size() {\n return this.buffer.length;\n }\n}\n"]}
|
package/dist/esm/api/const.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
1
|
+
export const USER_ACTION_START = 'user-action-start';
|
|
2
|
+
export const USER_ACTION_END = 'user-action-end';
|
|
3
|
+
export const USER_ACTION_CANCEL = 'user-action-cancel';
|
|
4
|
+
export const USER_ACTION_HALT = 'user-action-halt';
|
|
4
5
|
//# sourceMappingURL=const.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/api/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/api/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC","sourcesContent":["export const USER_ACTION_START = 'user-action-start';\nexport const USER_ACTION_END = 'user-action-end';\nexport const USER_ACTION_CANCEL = 'user-action-cancel';\nexport const USER_ACTION_HALT = 'user-action-halt';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
2
|
import { deepEqual, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';
|
|
3
3
|
import { timestampToIsoString } from '../../utils/date';
|
|
4
|
-
import {
|
|
4
|
+
import { USER_ACTION_START } from '../const';
|
|
5
5
|
export function initializeEventsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }) {
|
|
6
6
|
let lastPayload = null;
|
|
7
7
|
const pushEvent = (name, attributes, domain, { skipDedupe, spanContext, timestampOverwriteMs, customPayloadTransformer = (payload) => payload } = {}) => {
|
|
@@ -35,7 +35,7 @@ export function initializeEventsAPI({ internalLogger, config, metas, transports,
|
|
|
35
35
|
lastPayload = testingPayload;
|
|
36
36
|
internalLogger.debug('Pushing event\n', item);
|
|
37
37
|
const msg = getMessage();
|
|
38
|
-
if (msg && msg.type ===
|
|
38
|
+
if (msg && msg.type === USER_ACTION_START) {
|
|
39
39
|
actionBuffer.addItem(item);
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAO7C,MAAM,UAAU,mBAAmB,CAAC,EAClC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,GAUX;IACC,IAAI,WAAW,GAA8D,IAAI,CAAC;IAElF,MAAM,SAAS,GAA2B,CACxC,IAAI,EACJ,UAAU,EACV,MAAM,EACN,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE,wBAAwB,GAAG,CAAC,OAAmB,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,EACnH,EAAE;QACF,IAAI,CAAC;YACH,MAAM,KAA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,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;gBAC1C,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport { USER_ACTION_START } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\n\nimport type { EventEvent, EventsAPI } from './types';\n\nexport function initializeEventsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): EventsAPI {\n let lastPayload: Pick<EventEvent, 'name' | 'domain' | 'attributes'> | null = null;\n\n const pushEvent: EventsAPI['pushEvent'] = (\n name,\n attributes,\n domain,\n { skipDedupe, spanContext, timestampOverwriteMs, customPayloadTransformer = (payload: EventEvent) => payload } = {}\n ) => {\n try {\n const attrs = stringifyObjectValues(attributes);\n\n const item: TransportItem<EventEvent> = {\n meta: metas.value,\n payload: customPayloadTransformer({\n name,\n domain: domain ?? config.eventDomain,\n attributes: isEmpty(attrs) ? undefined : attrs,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n }),\n type: TransportItemType.EVENT,\n };\n\n const testingPayload = {\n name: item.payload.name,\n attributes: item.payload.attributes,\n domain: item.payload.domain,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping event push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing event\\n', item);\n\n const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START) {\n actionBuffer.addItem(item);\n } else {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n return {\n pushEvent,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/exceptions/const.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAsB,EAAE,EAAE;IACnE,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/exceptions/const.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAsB,EAAE,EAAE;IACnE,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { isObject, stringifyExternalJson } from '../../utils';\n\nexport const defaultExceptionType = 'Error';\n\nexport const defaultErrorArgsSerializer = (args: [any?, ...any[]]) => {\n return args\n .map((arg) => {\n if (isObject(arg)) {\n return stringifyExternalJson(arg);\n }\n\n return String(arg);\n })\n .join(' ');\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
2
|
import { deepEqual, getCurrentTimestamp, isArray, isEmpty, isError, isNull, isObject, stringifyExternalJson, stringifyObjectValues, } from '../../utils';
|
|
3
3
|
import { timestampToIsoString } from '../../utils/date';
|
|
4
|
-
import {
|
|
4
|
+
import { USER_ACTION_START } from '../const';
|
|
5
5
|
import { shouldIgnoreEvent } from '../utils';
|
|
6
6
|
import { defaultExceptionType } from './const';
|
|
7
7
|
let stacktraceParser;
|
|
@@ -57,7 +57,7 @@ export function initializeExceptionsAPI({ internalLogger, config, metas, transpo
|
|
|
57
57
|
lastPayload = testingPayload;
|
|
58
58
|
internalLogger.debug('Pushing exception\n', item);
|
|
59
59
|
const msg = getMessage();
|
|
60
|
-
if (msg && msg.type ===
|
|
60
|
+
if (msg && msg.type === USER_ACTION_START) {
|
|
61
61
|
actionBuffer.addItem(item);
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
@@ -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;AACxD,OAAO,EAAE,
|
|
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;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C,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,YAAY,EACZ,UAAU,GAUX;;IACC,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAA6E,IAAI,CAAC;IAEjG,gBAAgB,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,gBAAgB,CAAC;IAE9D,MAAM,sBAAsB,GAA4C,CAAC,mBAAmB,EAAE,EAAE;QAC9F,cAAc,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEnD,gBAAgB,GAAG,mBAAmB,aAAnB,mBAAmB,cAAnB,mBA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;IAEF,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAE/C,OAAO;QACL,sBAAsB;QACtB,mBAAmB;QACnB,SAAS;KACV,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAA+B;IACjD,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAExB,IAAI,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 { USER_ACTION_START } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\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 actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const { ignoreErrors = [] } = config;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs } = {}\n ) => {\n if (isErrorIgnored(ignoreErrors, error)) {\n return;\n }\n try {\n const ctx = stringifyObjectValues({\n ...parseCause(error),\n ...(context ?? {}),\n });\n\n const item: TransportItem<ExceptionEvent> = {\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 context: isEmpty(ctx) ? undefined : ctx,\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 };\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 const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START) {\n actionBuffer.addItem(item);\n } else {\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"]}
|
package/dist/esm/api/index.js
CHANGED
|
@@ -2,5 +2,5 @@ export { initializeAPI } from './initialize';
|
|
|
2
2
|
export { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';
|
|
3
3
|
export { defaultLogArgsSerializer } from './logs';
|
|
4
4
|
export { apiMessageBus } from './initialize';
|
|
5
|
-
export {
|
|
5
|
+
export { USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START, USER_ACTION_HALT } from './const';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -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,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAWhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AASlD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { initializeAPI } from './initialize';\nexport type {\n API,\n APIEvent,\n ApiMessageBusMessages,\n UserActionCancelMessage,\n UserActionEndMessage,\n UserActionStartMessage,\n UserActionHaltMessage,\n UserAction,\n} 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} 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 type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';\n\nexport { apiMessageBus } from './initialize';\n\nexport { USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START, USER_ACTION_HALT } from './const';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/logs/const.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,IAAI,EAAE,EAAE,CAClE,IAAI;KACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,IAAI;
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/logs/const.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,IAAI,EAAE,EAAE,CAClE,IAAI;KACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,CAAC,CAAC","sourcesContent":["import type { LogArgsSerializer } from './types';\n\nexport const defaultLogArgsSerializer: LogArgsSerializer = (args) =>\n args\n .map((arg) => {\n try {\n return String(arg);\n } catch (err) {\n return '';\n }\n })\n .join(' ');\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
2
|
import { deepEqual, defaultLogLevel, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';
|
|
3
3
|
import { timestampToIsoString } from '../../utils/date';
|
|
4
|
-
import {
|
|
4
|
+
import { USER_ACTION_START } from '../const';
|
|
5
5
|
import { defaultLogArgsSerializer } from './const';
|
|
6
6
|
export function initializeLogsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }) {
|
|
7
7
|
var _a;
|
|
@@ -39,7 +39,7 @@ export function initializeLogsAPI({ internalLogger, config, metas, transports, t
|
|
|
39
39
|
lastPayload = testingPayload;
|
|
40
40
|
internalLogger.debug('Pushing log\n', item);
|
|
41
41
|
const msg = getMessage();
|
|
42
|
-
if (msg && msg.type ===
|
|
42
|
+
if (msg && msg.type === USER_ACTION_START) {
|
|
43
43
|
actionBuffer.addItem(item);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/logs/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/logs/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACtH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGnD,MAAM,UAAU,iBAAiB,CAAC,EAChC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,GAUX;;IACC,cAAc,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE9C,IAAI,WAAW,GAA2D,IAAI,CAAC;IAE/E,MAAM,iBAAiB,GAAG,MAAA,MAAM,CAAC,iBAAiB,mCAAI,wBAAwB,CAAC;IAE/E,MAAM,OAAO,GAAuB,CAClC,IAAI,EACJ,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CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAE5C,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;YACzB,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;gBAC1C,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, defaultLogLevel, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport { USER_ACTION_START } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\n\nimport { defaultLogArgsSerializer } from './const';\nimport type { LogEvent, LogsAPI } from './types';\n\nexport function initializeLogsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): LogsAPI {\n internalLogger.debug('Initializing logs API');\n\n let lastPayload: Pick<LogEvent, 'message' | 'level' | 'context'> | null = null;\n\n const logArgsSerializer = config.logArgsSerializer ?? defaultLogArgsSerializer;\n\n const pushLog: LogsAPI['pushLog'] = (\n args,\n { context, level, skipDedupe, spanContext, timestampOverwriteMs } = {}\n ) => {\n try {\n const ctx = stringifyObjectValues(context);\n\n const item: TransportItem<LogEvent> = {\n type: TransportItemType.LOG,\n payload: {\n message: logArgsSerializer(args),\n level: level ?? defaultLogLevel,\n context: isEmpty(ctx) ? undefined : ctx,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n },\n meta: metas.value,\n };\n\n const testingPayload = {\n message: item.payload.message,\n level: item.payload.level,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping log 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 log\\n', item);\n\n const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START) {\n actionBuffer.addItem(item);\n } else {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing log\\n', err);\n }\n };\n\n return {\n pushLog,\n };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
2
|
import { deepEqual, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';
|
|
3
3
|
import { timestampToIsoString } from '../../utils/date';
|
|
4
|
-
import {
|
|
4
|
+
import { USER_ACTION_START } from '../const';
|
|
5
5
|
export function initializeMeasurementsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }) {
|
|
6
6
|
internalLogger.debug('Initializing measurements API');
|
|
7
7
|
let lastPayload = null;
|
|
@@ -30,7 +30,7 @@ export function initializeMeasurementsAPI({ internalLogger, config, metas, trans
|
|
|
30
30
|
lastPayload = testingPayload;
|
|
31
31
|
internalLogger.debug('Pushing measurement\n', item);
|
|
32
32
|
const msg = getMessage();
|
|
33
|
-
if (msg && msg.type ===
|
|
33
|
+
if (msg && msg.type === USER_ACTION_START) {
|
|
34
34
|
actionBuffer.addItem(item);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/measurements/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/measurements/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAO7C,MAAM,UAAU,yBAAyB,CAAC,EACxC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,GAUX;IACC,cAAc,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAEtD,IAAI,WAAW,GAAiE,IAAI,CAAC;IAErF,MAAM,eAAe,GAAuC,CAC1D,OAAO,EACP,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,EAAE,EAC/D,EAAE;QACF,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAE3C,MAAM,IAAI,GAAoC;gBAC5C,IAAI,EAAE,iBAAiB,CAAC,WAAW;gBACnC,OAAO,kCACF,OAAO,KACV,KAAK,EAAE,WAAW;wBAChB,CAAC,CAAC;4BACE,QAAQ,EAAE,WAAW,CA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C;IACH,CAAC,CAAC;IAEF,OAAO;QACL,eAAe;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport { USER_ACTION_START } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\n\nimport type { MeasurementEvent, MeasurementsAPI } from './types';\n\nexport function initializeMeasurementsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): MeasurementsAPI {\n internalLogger.debug('Initializing measurements API');\n\n let lastPayload: Pick<MeasurementEvent, 'type' | 'values' | 'context'> | null = null;\n\n const pushMeasurement: MeasurementsAPI['pushMeasurement'] = (\n payload,\n { skipDedupe, context, spanContext, timestampOverwriteMs } = {}\n ) => {\n try {\n const ctx = stringifyObjectValues(context);\n\n const item: TransportItem<MeasurementEvent> = {\n type: TransportItemType.MEASUREMENT,\n payload: {\n ...payload,\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n context: isEmpty(ctx) ? undefined : ctx,\n },\n meta: metas.value,\n };\n\n const testingPayload = {\n type: item.payload.type,\n values: item.payload.values,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping measurement 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 measurement\\n', item);\n\n const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START) {\n actionBuffer.addItem(item);\n } else {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing measurement\\n', err);\n }\n };\n\n return {\n pushMeasurement,\n };\n}\n"]}
|