@grafana/faro-core 1.0.2 → 1.0.4
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/cjs/metas/types.js.map +1 -1
- package/dist/cjs/testUtils/mockTransport.js +4 -1
- package/dist/cjs/testUtils/mockTransport.js.map +1 -1
- package/dist/cjs/transports/base.js.map +1 -1
- package/dist/cjs/transports/types.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/metas/types.js.map +1 -1
- package/dist/esm/testUtils/mockTransport.js +3 -1
- package/dist/esm/testUtils/mockTransport.js.map +1 -1
- package/dist/esm/transports/base.js.map +1 -1
- package/dist/esm/transports/types.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/events/index.js +6 -0
- package/dist/spec/core/src/api/events/index.js.map +1 -0
- package/dist/spec/core/src/api/events/initialize.js +44 -0
- package/dist/spec/core/src/api/events/initialize.js.map +1 -0
- package/dist/spec/core/src/api/events/initialize.test.js +86 -0
- package/dist/spec/core/src/api/events/initialize.test.js.map +1 -0
- package/dist/spec/core/src/api/events/types.js +3 -0
- package/dist/spec/core/src/api/events/types.js.map +1 -0
- package/dist/spec/core/src/api/exceptions/const.js +5 -0
- package/dist/spec/core/src/api/exceptions/const.js.map +1 -0
- package/dist/spec/core/src/api/exceptions/index.js +8 -0
- package/dist/spec/core/src/api/exceptions/index.js.map +1 -0
- package/dist/spec/core/src/api/exceptions/initialize.js +58 -0
- package/dist/spec/core/src/api/exceptions/initialize.js.map +1 -0
- package/dist/spec/core/src/api/exceptions/initialize.test.js +133 -0
- package/dist/spec/core/src/api/exceptions/initialize.test.js.map +1 -0
- package/dist/spec/core/src/api/exceptions/types.js +3 -0
- package/dist/spec/core/src/api/exceptions/types.js.map +1 -0
- package/dist/spec/core/src/api/index.js +8 -0
- package/dist/spec/core/src/api/index.js.map +1 -0
- package/dist/spec/core/src/api/initialize.js +27 -0
- package/dist/spec/core/src/api/initialize.js.map +1 -0
- package/dist/spec/core/src/api/logs/index.js +6 -0
- package/dist/spec/core/src/api/logs/index.js.map +1 -0
- package/dist/spec/core/src/api/logs/initialize.js +54 -0
- package/dist/spec/core/src/api/logs/initialize.js.map +1 -0
- package/dist/spec/core/src/api/logs/initialize.test.js +82 -0
- package/dist/spec/core/src/api/logs/initialize.test.js.map +1 -0
- package/dist/spec/core/src/api/logs/types.js +3 -0
- package/dist/spec/core/src/api/logs/types.js.map +1 -0
- package/dist/spec/core/src/api/measurements/index.js +6 -0
- package/dist/spec/core/src/api/measurements/index.js.map +1 -0
- package/dist/spec/core/src/api/measurements/initialize.js +50 -0
- package/dist/spec/core/src/api/measurements/initialize.js.map +1 -0
- package/dist/spec/core/src/api/measurements/initialize.test.js +117 -0
- package/dist/spec/core/src/api/measurements/initialize.test.js.map +1 -0
- package/dist/spec/core/src/api/measurements/types.js +3 -0
- package/dist/spec/core/src/api/measurements/types.js.map +1 -0
- package/dist/spec/core/src/api/meta/index.js +6 -0
- package/dist/spec/core/src/api/meta/index.js.map +1 -0
- package/dist/spec/core/src/api/meta/initialize.js +49 -0
- package/dist/spec/core/src/api/meta/initialize.js.map +1 -0
- package/dist/spec/core/src/api/meta/types.js +3 -0
- package/dist/spec/core/src/api/meta/types.js.map +1 -0
- package/dist/spec/core/src/api/traces/index.js +6 -0
- package/dist/spec/core/src/api/traces/index.js.map +1 -0
- package/dist/spec/core/src/api/traces/initialize.js +49 -0
- package/dist/spec/core/src/api/traces/initialize.js.map +1 -0
- package/dist/spec/core/src/api/traces/types.js +3 -0
- package/dist/spec/core/src/api/traces/types.js.map +1 -0
- package/dist/spec/core/src/api/types.js +3 -0
- package/dist/spec/core/src/api/types.js.map +1 -0
- package/dist/spec/core/src/config/const.js +5 -0
- package/dist/spec/core/src/config/const.js.map +1 -0
- package/dist/spec/core/src/config/index.js +6 -0
- package/dist/spec/core/src/config/index.js.map +1 -0
- package/dist/spec/core/src/config/types.js +3 -0
- package/dist/spec/core/src/config/types.js.map +1 -0
- package/dist/spec/core/src/extensions/baseExtension.js +57 -0
- package/dist/spec/core/src/extensions/baseExtension.js.map +1 -0
- package/dist/spec/core/src/extensions/index.js +6 -0
- package/dist/spec/core/src/extensions/index.js.map +1 -0
- package/dist/spec/core/src/extensions/types.js +3 -0
- package/dist/spec/core/src/extensions/types.js.map +1 -0
- package/dist/spec/core/src/faro.test.js +40 -0
- package/dist/spec/core/src/faro.test.js.map +1 -0
- package/dist/spec/core/src/globalObject/globalObject.js +6 -0
- package/dist/spec/core/src/globalObject/globalObject.js.map +1 -0
- package/dist/spec/core/src/globalObject/index.js +6 -0
- package/dist/spec/core/src/globalObject/index.js.map +1 -0
- package/dist/spec/core/src/index.js +75 -0
- package/dist/spec/core/src/index.js.map +1 -0
- package/dist/spec/core/src/initialize.js +32 -0
- package/dist/spec/core/src/initialize.js.map +1 -0
- package/dist/spec/core/src/instrumentations/base.js +31 -0
- package/dist/spec/core/src/instrumentations/base.js.map +1 -0
- package/dist/spec/core/src/instrumentations/index.js +10 -0
- package/dist/spec/core/src/instrumentations/index.js.map +1 -0
- package/dist/spec/core/src/instrumentations/initialize.js +71 -0
- package/dist/spec/core/src/instrumentations/initialize.js.map +1 -0
- package/dist/spec/core/src/instrumentations/registerInitial.js +9 -0
- package/dist/spec/core/src/instrumentations/registerInitial.js.map +1 -0
- package/dist/spec/core/src/instrumentations/types.js +3 -0
- package/dist/spec/core/src/instrumentations/types.js.map +1 -0
- package/dist/spec/core/src/internalLogger/const.js +22 -0
- package/dist/spec/core/src/internalLogger/const.js.map +1 -0
- package/dist/spec/core/src/internalLogger/createInternalLogger.js +65 -0
- package/dist/spec/core/src/internalLogger/createInternalLogger.js.map +1 -0
- package/dist/spec/core/src/internalLogger/index.js +13 -0
- package/dist/spec/core/src/internalLogger/index.js.map +1 -0
- package/dist/spec/core/src/internalLogger/initialize.js +12 -0
- package/dist/spec/core/src/internalLogger/initialize.js.map +1 -0
- package/dist/spec/core/src/internalLogger/types.js +3 -0
- package/dist/spec/core/src/internalLogger/types.js.map +1 -0
- package/dist/spec/core/src/metas/index.js +8 -0
- package/dist/spec/core/src/metas/index.js.map +1 -0
- package/dist/spec/core/src/metas/initialize.js +52 -0
- package/dist/spec/core/src/metas/initialize.js.map +1 -0
- package/dist/spec/core/src/metas/initialize.test.js +20 -0
- package/dist/spec/core/src/metas/initialize.test.js.map +1 -0
- package/dist/spec/core/src/metas/registerInitial.js +42 -0
- package/dist/spec/core/src/metas/registerInitial.js.map +1 -0
- package/dist/spec/core/src/metas/types.js +3 -0
- package/dist/spec/core/src/metas/types.js.map +1 -0
- package/dist/spec/core/src/sdk/const.js +5 -0
- package/dist/spec/core/src/sdk/const.js.map +1 -0
- package/dist/spec/core/src/sdk/faroGlobalObject.js +23 -0
- package/dist/spec/core/src/sdk/faroGlobalObject.js.map +1 -0
- package/dist/spec/core/src/sdk/index.js +13 -0
- package/dist/spec/core/src/sdk/index.js.map +1 -0
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js +29 -0
- package/dist/spec/core/src/sdk/internalFaroGlobalObject.js.map +1 -0
- package/dist/spec/core/src/sdk/registerFaro.js +25 -0
- package/dist/spec/core/src/sdk/registerFaro.js.map +1 -0
- package/dist/spec/core/src/sdk/types.js +3 -0
- package/dist/spec/core/src/sdk/types.js.map +1 -0
- package/dist/spec/core/src/semantic.js +12 -0
- package/dist/spec/core/src/semantic.js.map +1 -0
- package/dist/spec/core/src/testUtils/index.js +14 -0
- package/dist/spec/core/src/testUtils/index.js.map +1 -0
- package/dist/spec/core/src/testUtils/mockConfig.js +25 -0
- package/dist/spec/core/src/testUtils/mockConfig.js.map +1 -0
- package/dist/spec/core/src/testUtils/mockInternalLogger.js +12 -0
- package/dist/spec/core/src/testUtils/mockInternalLogger.js.map +1 -0
- package/dist/spec/core/src/testUtils/mockStacktraceParser.js +21 -0
- package/dist/spec/core/src/testUtils/mockStacktraceParser.js.map +1 -0
- package/dist/spec/core/src/testUtils/mockTransport.js +44 -0
- package/dist/spec/core/src/testUtils/mockTransport.js.map +1 -0
- package/dist/spec/core/src/testUtils/testPromise.js +15 -0
- package/dist/spec/core/src/testUtils/testPromise.js.map +1 -0
- package/dist/spec/core/src/transports/base.js +31 -0
- package/dist/spec/core/src/transports/base.js.map +1 -0
- package/dist/spec/core/src/transports/const.js +20 -0
- package/dist/spec/core/src/transports/const.js.map +1 -0
- package/dist/spec/core/src/transports/index.js +15 -0
- package/dist/spec/core/src/transports/index.js.map +1 -0
- package/dist/spec/core/src/transports/initialize.js +151 -0
- package/dist/spec/core/src/transports/initialize.js.map +1 -0
- package/dist/spec/core/src/transports/registerInitial.js +11 -0
- package/dist/spec/core/src/transports/registerInitial.js.map +1 -0
- package/dist/spec/core/src/transports/transports.test.js +139 -0
- package/dist/spec/core/src/transports/transports.test.js.map +1 -0
- package/dist/spec/core/src/transports/types.js +3 -0
- package/dist/spec/core/src/transports/types.js.map +1 -0
- package/dist/spec/core/src/transports/utils.js +13 -0
- package/dist/spec/core/src/transports/utils.js.map +1 -0
- package/dist/spec/core/src/unpatchedConsole/const.js +16 -0
- package/dist/spec/core/src/unpatchedConsole/const.js.map +1 -0
- package/dist/spec/core/src/unpatchedConsole/index.js +9 -0
- package/dist/spec/core/src/unpatchedConsole/index.js.map +1 -0
- package/dist/spec/core/src/unpatchedConsole/initialize.js +12 -0
- package/dist/spec/core/src/unpatchedConsole/initialize.js.map +1 -0
- package/dist/spec/core/src/unpatchedConsole/types.js +3 -0
- package/dist/spec/core/src/unpatchedConsole/types.js.map +1 -0
- package/dist/spec/core/src/utils/baseObject.js +3 -0
- package/dist/spec/core/src/utils/baseObject.js.map +1 -0
- package/dist/spec/core/src/utils/deepEqual.js +62 -0
- package/dist/spec/core/src/utils/deepEqual.js.map +1 -0
- package/dist/spec/core/src/utils/deepEqual.test.js +103 -0
- package/dist/spec/core/src/utils/deepEqual.test.js.map +1 -0
- package/dist/spec/core/src/utils/getCurrentTimestamp.js +8 -0
- package/dist/spec/core/src/utils/getCurrentTimestamp.js.map +1 -0
- package/dist/spec/core/src/utils/index.js +47 -0
- package/dist/spec/core/src/utils/index.js.map +1 -0
- package/dist/spec/core/src/utils/is.js +53 -0
- package/dist/spec/core/src/utils/is.js.map +1 -0
- package/dist/spec/core/src/utils/logLevels.js +22 -0
- package/dist/spec/core/src/utils/logLevels.js.map +1 -0
- package/dist/spec/core/src/utils/noop.js +6 -0
- package/dist/spec/core/src/utils/noop.js.map +1 -0
- package/dist/spec/core/src/utils/promiseBuffer.js +43 -0
- package/dist/spec/core/src/utils/promiseBuffer.js.map +1 -0
- package/dist/spec/core/src/utils/promiseBuffer.test.js +146 -0
- package/dist/spec/core/src/utils/promiseBuffer.test.js.map +1 -0
- package/dist/spec/core/src/utils/shortId.js +12 -0
- package/dist/spec/core/src/utils/shortId.js.map +1 -0
- package/dist/spec/core/src/version.js +6 -0
- package/dist/spec/core/src/version.js.map +1 -0
- package/dist/types/core/src/api/events/index.d.ts +2 -0
- package/dist/types/core/src/api/events/initialize.d.ts +8 -0
- package/dist/types/core/src/api/events/initialize.test.d.ts +1 -0
- package/dist/types/core/src/api/events/types.d.ts +15 -0
- package/dist/types/core/src/api/exceptions/const.d.ts +1 -0
- package/dist/types/core/src/api/exceptions/index.d.ts +3 -0
- package/dist/types/core/src/api/exceptions/initialize.d.ts +8 -0
- package/dist/types/core/src/api/exceptions/initialize.test.d.ts +1 -0
- package/dist/types/core/src/api/exceptions/types.d.ts +32 -0
- package/dist/types/core/src/api/index.d.ts +9 -0
- package/dist/types/core/src/api/initialize.d.ts +7 -0
- package/dist/types/core/src/api/logs/index.d.ts +2 -0
- package/dist/types/core/src/api/logs/initialize.d.ts +8 -0
- package/dist/types/core/src/api/logs/initialize.test.d.ts +1 -0
- package/dist/types/core/src/api/logs/types.d.ts +18 -0
- package/dist/types/core/src/api/measurements/index.d.ts +2 -0
- package/dist/types/core/src/api/measurements/initialize.d.ts +8 -0
- package/dist/types/core/src/api/measurements/initialize.test.d.ts +1 -0
- package/dist/types/core/src/api/measurements/types.d.ts +17 -0
- package/dist/types/core/src/api/meta/index.d.ts +2 -0
- package/dist/types/core/src/api/meta/initialize.d.ts +7 -0
- package/dist/types/core/src/api/meta/types.d.ts +10 -0
- package/dist/types/core/src/api/traces/index.d.ts +2 -0
- package/dist/types/core/src/api/traces/initialize.d.ts +7 -0
- package/dist/types/core/src/api/traces/types.d.ts +20 -0
- package/dist/types/core/src/api/types.d.ts +8 -0
- package/dist/types/core/src/config/const.d.ts +1 -0
- package/dist/types/core/src/config/index.d.ts +2 -0
- package/dist/types/core/src/config/types.d.ts +27 -0
- package/dist/types/core/src/extensions/baseExtension.d.ts +15 -0
- package/dist/types/core/src/extensions/index.d.ts +2 -0
- package/dist/types/core/src/extensions/types.d.ts +16 -0
- package/dist/types/core/src/faro.test.d.ts +1 -0
- package/dist/types/core/src/globalObject/globalObject.d.ts +7 -0
- package/dist/types/core/src/globalObject/index.d.ts +2 -0
- package/dist/types/core/src/index.d.ts +24 -0
- package/dist/types/core/src/initialize.d.ts +3 -0
- package/dist/types/core/src/instrumentations/base.d.ts +9 -0
- package/dist/types/core/src/instrumentations/index.d.ts +4 -0
- package/dist/types/core/src/instrumentations/initialize.d.ts +8 -0
- package/dist/types/core/src/instrumentations/registerInitial.d.ts +2 -0
- package/dist/types/core/src/instrumentations/types.d.ts +14 -0
- package/dist/types/core/src/internalLogger/const.d.ts +11 -0
- package/dist/types/core/src/internalLogger/createInternalLogger.d.ts +4 -0
- package/dist/types/core/src/internalLogger/index.d.ts +4 -0
- package/dist/types/core/src/internalLogger/initialize.d.ts +5 -0
- package/dist/types/core/src/internalLogger/types.d.ts +7 -0
- package/dist/types/core/src/metas/index.d.ts +3 -0
- package/dist/types/core/src/metas/initialize.d.ts +5 -0
- package/dist/types/core/src/metas/initialize.test.d.ts +1 -0
- package/dist/types/core/src/metas/registerInitial.d.ts +2 -0
- package/dist/types/core/src/metas/types.d.ts +67 -0
- package/dist/types/core/src/sdk/const.d.ts +1 -0
- package/dist/types/core/src/sdk/faroGlobalObject.d.ts +2 -0
- package/dist/types/core/src/sdk/index.d.ts +4 -0
- package/dist/types/core/src/sdk/internalFaroGlobalObject.d.ts +4 -0
- package/dist/types/core/src/sdk/registerFaro.d.ts +10 -0
- package/dist/types/core/src/sdk/types.d.ts +18 -0
- package/dist/types/core/src/semantic.d.ts +8 -0
- package/dist/types/core/src/testUtils/index.d.ts +6 -0
- package/dist/types/core/src/testUtils/mockConfig.d.ts +2 -0
- package/dist/types/core/src/testUtils/mockInternalLogger.d.ts +2 -0
- package/dist/types/core/src/testUtils/mockStacktraceParser.d.ts +2 -0
- package/dist/types/core/src/testUtils/mockTransport.d.ts +12 -0
- package/dist/types/core/src/testUtils/testPromise.d.ts +7 -0
- package/dist/types/core/src/transports/base.d.ts +6 -0
- package/dist/types/core/src/transports/const.d.ts +8 -0
- package/dist/types/core/src/transports/index.d.ts +6 -0
- package/dist/types/core/src/transports/initialize.d.ts +8 -0
- package/dist/types/core/src/transports/registerInitial.d.ts +2 -0
- package/dist/types/core/src/transports/transports.test.d.ts +1 -0
- package/dist/types/core/src/transports/types.d.ts +37 -0
- package/dist/types/core/src/transports/utils.d.ts +2 -0
- package/dist/types/core/src/unpatchedConsole/const.d.ts +2 -0
- package/dist/types/core/src/unpatchedConsole/index.d.ts +3 -0
- package/dist/types/core/src/unpatchedConsole/initialize.d.ts +4 -0
- package/dist/types/core/src/unpatchedConsole/types.d.ts +1 -0
- package/dist/types/core/src/utils/baseObject.d.ts +6 -0
- package/dist/types/core/src/utils/deepEqual.d.ts +1 -0
- package/dist/types/core/src/utils/deepEqual.test.d.ts +1 -0
- package/dist/types/core/src/utils/getCurrentTimestamp.d.ts +1 -0
- package/dist/types/core/src/utils/index.d.ts +10 -0
- package/dist/types/core/src/utils/is.d.ts +31 -0
- package/dist/types/core/src/utils/logLevels.d.ts +10 -0
- package/dist/types/core/src/utils/noop.d.ts +1 -0
- package/dist/types/core/src/utils/promiseBuffer.d.ts +14 -0
- package/dist/types/core/src/utils/promiseBuffer.test.d.ts +1 -0
- package/dist/types/core/src/utils/shortId.d.ts +1 -0
- package/dist/types/core/src/version.d.ts +1 -0
- package/dist/types/metas/types.d.ts +6 -0
- package/dist/types/testUtils/mockTransport.d.ts +2 -2
- package/dist/types/transports/base.d.ts +1 -1
- package/dist/types/transports/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var testUtils_1 = require("../testUtils");
|
|
40
|
+
var promiseBuffer_1 = require("./promiseBuffer");
|
|
41
|
+
function defer(fn) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
45
|
+
setImmediate(function () {
|
|
46
|
+
fn();
|
|
47
|
+
resolve();
|
|
48
|
+
});
|
|
49
|
+
})];
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
describe('PromiseBuffer', function () {
|
|
54
|
+
it('add() new promise that resolves when task is completed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var buf, _a;
|
|
56
|
+
return __generator(this, function (_b) {
|
|
57
|
+
switch (_b.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
buf = (0, promiseBuffer_1.createPromiseBuffer)({ size: 2, concurrency: 2 });
|
|
60
|
+
_a = expect;
|
|
61
|
+
return [4 /*yield*/, buf.add(function () { return Promise.resolve('hi'); })];
|
|
62
|
+
case 1:
|
|
63
|
+
_a.apply(void 0, [_b.sent()]).toEqual('hi');
|
|
64
|
+
return [2 /*return*/];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}); });
|
|
68
|
+
it('executes tasks concurrently, limited to concurrency setting', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
var promises, buf, addTask;
|
|
70
|
+
var _a, _b, _c, _d;
|
|
71
|
+
return __generator(this, function (_e) {
|
|
72
|
+
switch (_e.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
promises = [];
|
|
75
|
+
buf = (0, promiseBuffer_1.createPromiseBuffer)({
|
|
76
|
+
size: 10,
|
|
77
|
+
concurrency: 2,
|
|
78
|
+
});
|
|
79
|
+
addTask = function (id) {
|
|
80
|
+
return buf.add(function () {
|
|
81
|
+
var prom = (0, testUtils_1.createTestPromise)(id);
|
|
82
|
+
promises.push(prom);
|
|
83
|
+
return prom.promise;
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
addTask(1);
|
|
87
|
+
addTask(2);
|
|
88
|
+
addTask(3);
|
|
89
|
+
// 1 & 2 have started to execute. 3d is not started
|
|
90
|
+
expect(promises).toHaveLength(2);
|
|
91
|
+
expect((_a = promises[0]) === null || _a === void 0 ? void 0 : _a.id).toEqual(1);
|
|
92
|
+
expect((_b = promises[1]) === null || _b === void 0 ? void 0 : _b.id).toEqual(2);
|
|
93
|
+
// resolve first two
|
|
94
|
+
(_c = promises[0]) === null || _c === void 0 ? void 0 : _c.resolve();
|
|
95
|
+
(_d = promises[1]) === null || _d === void 0 ? void 0 : _d.resolve();
|
|
96
|
+
return [4 /*yield*/, defer(function () {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
// 3 has started to be executed
|
|
99
|
+
expect(promises).toHaveLength(3);
|
|
100
|
+
expect((_a = promises[2]) === null || _a === void 0 ? void 0 : _a.id).toEqual(3);
|
|
101
|
+
(_b = promises[2]) === null || _b === void 0 ? void 0 : _b.resolve();
|
|
102
|
+
})];
|
|
103
|
+
case 1:
|
|
104
|
+
_e.sent();
|
|
105
|
+
return [2 /*return*/];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}); });
|
|
109
|
+
it('rejects tasks that exceed buffer size', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
110
|
+
var promises, buf, addTask;
|
|
111
|
+
var _a;
|
|
112
|
+
return __generator(this, function (_b) {
|
|
113
|
+
switch (_b.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
promises = [];
|
|
116
|
+
buf = (0, promiseBuffer_1.createPromiseBuffer)({
|
|
117
|
+
size: 3,
|
|
118
|
+
concurrency: 2,
|
|
119
|
+
});
|
|
120
|
+
addTask = function (id) {
|
|
121
|
+
return buf.add(function () {
|
|
122
|
+
var prom = (0, testUtils_1.createTestPromise)(id);
|
|
123
|
+
promises.push(prom);
|
|
124
|
+
return prom.promise;
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
// adding 3 tasks works, 2 of them begin executing
|
|
128
|
+
addTask(1);
|
|
129
|
+
addTask(2);
|
|
130
|
+
addTask(3);
|
|
131
|
+
expect(promises).toHaveLength(2);
|
|
132
|
+
// adding 4th task fails
|
|
133
|
+
expect(function () { return addTask(4); }).toThrow('Task buffer full');
|
|
134
|
+
// finishing a task allows new tasks to be added again
|
|
135
|
+
(_a = promises[0]) === null || _a === void 0 ? void 0 : _a.resolve();
|
|
136
|
+
return [4 /*yield*/, defer(function () {
|
|
137
|
+
addTask(4);
|
|
138
|
+
})];
|
|
139
|
+
case 1:
|
|
140
|
+
_b.sent();
|
|
141
|
+
return [2 /*return*/];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}); });
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=promiseBuffer.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseBuffer.test.js","sourceRoot":"","sources":["../../../../../src/utils/promiseBuffer.test.ts"],"names":[],"mappings":"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","sourcesContent":["import { createTestPromise, TestPromise } from '../testUtils';\n\nimport { createPromiseBuffer } from './promiseBuffer';\n\nasync function defer(fn: () => void) {\n return new Promise<void>((resolve) => {\n setImmediate(() => {\n fn();\n resolve();\n });\n });\n}\n\ndescribe('PromiseBuffer', () => {\n it('add() new promise that resolves when task is completed', async () => {\n const buf = createPromiseBuffer({ size: 2, concurrency: 2 });\n expect(await buf.add(() => Promise.resolve('hi'))).toEqual('hi');\n });\n\n it('executes tasks concurrently, limited to concurrency setting', async () => {\n const promises: Array<TestPromise<void>> = [];\n const buf = createPromiseBuffer({\n size: 10,\n concurrency: 2,\n });\n\n const addTask = (id: number) => {\n return buf.add(() => {\n const prom = createTestPromise<void>(id);\n promises.push(prom);\n return prom.promise;\n });\n };\n\n addTask(1);\n addTask(2);\n addTask(3);\n\n // 1 & 2 have started to execute. 3d is not started\n expect(promises).toHaveLength(2);\n expect(promises[0]?.id).toEqual(1);\n expect(promises[1]?.id).toEqual(2);\n\n // resolve first two\n promises[0]?.resolve();\n promises[1]?.resolve();\n\n await defer(() => {\n // 3 has started to be executed\n expect(promises).toHaveLength(3);\n expect(promises[2]?.id).toEqual(3);\n promises[2]?.resolve();\n });\n });\n\n it('rejects tasks that exceed buffer size', async () => {\n const promises: Array<TestPromise<void>> = [];\n const buf = createPromiseBuffer({\n size: 3,\n concurrency: 2,\n });\n\n const addTask = (id: number) => {\n return buf.add(() => {\n const prom = createTestPromise<void>(id);\n promises.push(prom);\n return prom.promise;\n });\n };\n\n // adding 3 tasks works, 2 of them begin executing\n addTask(1);\n addTask(2);\n addTask(3);\n expect(promises).toHaveLength(2);\n // adding 4th task fails\n expect(() => addTask(4)).toThrow('Task buffer full');\n\n // finishing a task allows new tasks to be added again\n promises[0]?.resolve();\n\n await defer(() => {\n addTask(4);\n });\n });\n});\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genShortID = void 0;
|
|
4
|
+
var alphabet = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789';
|
|
5
|
+
function genShortID(length) {
|
|
6
|
+
if (length === void 0) { length = 10; }
|
|
7
|
+
return Array.from(Array(length))
|
|
8
|
+
.map(function () { return alphabet[Math.floor(Math.random() * alphabet.length)]; })
|
|
9
|
+
.join('');
|
|
10
|
+
}
|
|
11
|
+
exports.genShortID = genShortID;
|
|
12
|
+
//# sourceMappingURL=shortId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortId.js","sourceRoot":"","sources":["../../../../../src/utils/shortId.ts"],"names":[],"mappings":";;;AAAA,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;AAJD,gCAIC","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"]}
|
|
@@ -0,0 +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 = '1.0.4';\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config } from '../../config';
|
|
2
|
+
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
+
import type { Metas } from '../../metas';
|
|
4
|
+
import { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { TracesAPI } from '../traces';
|
|
7
|
+
import type { EventsAPI } from './types';
|
|
8
|
+
export declare function initializeEventsAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, tracesApi: TracesAPI): EventsAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TraceContext } from '../traces';
|
|
2
|
+
export type EventAttributes = Record<string, string>;
|
|
3
|
+
export interface EventEvent {
|
|
4
|
+
name: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
domain?: string;
|
|
7
|
+
attributes?: EventAttributes;
|
|
8
|
+
trace?: TraceContext;
|
|
9
|
+
}
|
|
10
|
+
export interface PushEventOptions {
|
|
11
|
+
skipDedupe?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface EventsAPI {
|
|
14
|
+
pushEvent: (name: string, attributes?: EventAttributes, domain?: string, options?: PushEventOptions) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultExceptionType = "Error";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config } from '../../config';
|
|
2
|
+
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
+
import type { Metas } from '../../metas';
|
|
4
|
+
import type { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { TracesAPI } from '../traces';
|
|
7
|
+
import type { ExceptionsAPI } from './types';
|
|
8
|
+
export declare function initializeExceptionsAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, tracesApi: TracesAPI): ExceptionsAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TraceContext } from '../traces';
|
|
2
|
+
export type StacktraceParser = (err: ExtendedError) => Stacktrace;
|
|
3
|
+
export interface ExceptionStackFrame {
|
|
4
|
+
filename: string;
|
|
5
|
+
function: string;
|
|
6
|
+
colno?: number;
|
|
7
|
+
lineno?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ExtendedError extends Error {
|
|
10
|
+
columnNumber?: number;
|
|
11
|
+
stacktrace?: Error['stack'];
|
|
12
|
+
}
|
|
13
|
+
export interface Stacktrace {
|
|
14
|
+
frames: ExceptionStackFrame[];
|
|
15
|
+
}
|
|
16
|
+
export interface ExceptionEvent {
|
|
17
|
+
timestamp: string;
|
|
18
|
+
type: string;
|
|
19
|
+
value: string;
|
|
20
|
+
stacktrace?: Stacktrace;
|
|
21
|
+
trace?: TraceContext;
|
|
22
|
+
}
|
|
23
|
+
export interface PushErrorOptions {
|
|
24
|
+
skipDedupe?: boolean;
|
|
25
|
+
stackFrames?: ExceptionStackFrame[];
|
|
26
|
+
type?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ExceptionsAPI {
|
|
29
|
+
changeStacktraceParser: (stacktraceParser: StacktraceParser) => void;
|
|
30
|
+
getStacktraceParser: () => StacktraceParser | undefined;
|
|
31
|
+
pushError: (value: Error, options?: PushErrorOptions) => void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { initializeAPI } from './initialize';
|
|
2
|
+
export type { API, APIEvent } from './types';
|
|
3
|
+
export type { EventAttributes, EventEvent, EventsAPI } from './events';
|
|
4
|
+
export { defaultExceptionType } from './exceptions';
|
|
5
|
+
export type { ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, PushErrorOptions, Stacktrace, StacktraceParser, } from './exceptions';
|
|
6
|
+
export type { LogContext, LogEvent, LogsAPI, PushLogOptions } from './logs';
|
|
7
|
+
export type { MeasurementEvent, MeasurementsAPI, PushMeasurementOptions } from './measurements';
|
|
8
|
+
export type { MetaAPI } from './meta';
|
|
9
|
+
export type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Config } from '../config';
|
|
2
|
+
import type { InternalLogger } from '../internalLogger';
|
|
3
|
+
import type { Metas } from '../metas';
|
|
4
|
+
import type { Transports } from '../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
6
|
+
import type { API } from './types';
|
|
7
|
+
export declare function initializeAPI(unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports): API;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config } from '../../config';
|
|
2
|
+
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
+
import type { Metas } from '../../metas';
|
|
4
|
+
import type { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { TracesAPI } from '../traces';
|
|
7
|
+
import type { LogsAPI } from './types';
|
|
8
|
+
export declare function initializeLogsAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, tracesApi: TracesAPI): LogsAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BaseObject, LogLevel } from '../../utils';
|
|
2
|
+
import type { TraceContext } from '../traces';
|
|
3
|
+
export type LogContext = BaseObject;
|
|
4
|
+
export interface LogEvent {
|
|
5
|
+
context: LogContext;
|
|
6
|
+
level: LogLevel;
|
|
7
|
+
message: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
trace?: TraceContext;
|
|
10
|
+
}
|
|
11
|
+
export interface PushLogOptions {
|
|
12
|
+
context?: LogContext;
|
|
13
|
+
level?: LogLevel;
|
|
14
|
+
skipDedupe?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface LogsAPI {
|
|
17
|
+
pushLog: (args: unknown[], options?: PushLogOptions) => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config } from '../../config';
|
|
2
|
+
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
+
import type { Metas } from '../../metas';
|
|
4
|
+
import type { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { TracesAPI } from '../traces';
|
|
7
|
+
import type { MeasurementsAPI } from './types';
|
|
8
|
+
export declare function initializeMeasurementsAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, tracesApi: TracesAPI): MeasurementsAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TraceContext } from '../traces';
|
|
2
|
+
export interface MeasurementEvent<V extends {
|
|
3
|
+
[label: string]: number;
|
|
4
|
+
} = {
|
|
5
|
+
[label: string]: number;
|
|
6
|
+
}> {
|
|
7
|
+
type: string;
|
|
8
|
+
values: V;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
trace?: TraceContext;
|
|
11
|
+
}
|
|
12
|
+
export interface PushMeasurementOptions {
|
|
13
|
+
skipDedupe?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface MeasurementsAPI {
|
|
16
|
+
pushMeasurement: (payload: Omit<MeasurementEvent, 'timestamp'> & Partial<Pick<MeasurementEvent, 'timestamp'>>, options?: PushMeasurementOptions) => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Config } from '../../config';
|
|
2
|
+
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
+
import type { Metas } from '../../metas';
|
|
4
|
+
import type { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { MetaAPI } from './types';
|
|
7
|
+
export declare function initializeMetaAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, _config: Config, metas: Metas, _transports: Transports): MetaAPI;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MetaSession, MetaUser, MetaView } from '../../metas';
|
|
2
|
+
export interface MetaAPI {
|
|
3
|
+
setUser: (user?: MetaUser | undefined) => void;
|
|
4
|
+
resetUser: () => void;
|
|
5
|
+
setSession: (session?: MetaSession | undefined) => void;
|
|
6
|
+
resetSession: () => void;
|
|
7
|
+
getSession: () => MetaSession | undefined;
|
|
8
|
+
setView: (view?: MetaView | undefined) => void;
|
|
9
|
+
getView: () => MetaView | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Config } from '../../config';
|
|
2
|
+
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
+
import type { Metas } from '../../metas';
|
|
4
|
+
import { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { TracesAPI } from './types';
|
|
7
|
+
export declare function initializeTracesAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, _config: Config, metas: Metas, transports: Transports): TracesAPI;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ContextAPI as OTELContextAPI, TraceAPI as OTELTraceAPI } from '@opentelemetry/api';
|
|
2
|
+
import type { IResourceSpans } from '@opentelemetry/otlp-transformer';
|
|
3
|
+
export interface TraceEvent {
|
|
4
|
+
resourceSpans?: IResourceSpans[];
|
|
5
|
+
}
|
|
6
|
+
export interface OTELApi {
|
|
7
|
+
trace: OTELTraceAPI;
|
|
8
|
+
context: OTELContextAPI;
|
|
9
|
+
}
|
|
10
|
+
export interface TracesAPI {
|
|
11
|
+
getOTEL: () => OTELApi | undefined;
|
|
12
|
+
getTraceContext: () => TraceContext | undefined;
|
|
13
|
+
initOTEL: (trace: OTELTraceAPI, context: OTELContextAPI) => void;
|
|
14
|
+
isOTELInitialized: () => boolean;
|
|
15
|
+
pushTraces: (traces: TraceEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface TraceContext {
|
|
18
|
+
trace_id: string;
|
|
19
|
+
span_id: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EventEvent, EventsAPI } from './events';
|
|
2
|
+
import type { ExceptionEvent, ExceptionsAPI } from './exceptions';
|
|
3
|
+
import type { LogEvent, LogsAPI } from './logs';
|
|
4
|
+
import type { MeasurementEvent, MeasurementsAPI } from './measurements';
|
|
5
|
+
import type { MetaAPI } from './meta';
|
|
6
|
+
import type { TraceEvent, TracesAPI } from './traces';
|
|
7
|
+
export type APIEvent = LogEvent | ExceptionEvent | MeasurementEvent | TraceEvent | EventEvent;
|
|
8
|
+
export type API = LogsAPI & ExceptionsAPI & MeasurementsAPI & TracesAPI & MetaAPI & EventsAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultGlobalObjectKey = "faro";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { APIEvent, StacktraceParser } from '../api';
|
|
2
|
+
import type { Instrumentation } from '../instrumentations';
|
|
3
|
+
import type { InternalLoggerLevel } from '../internalLogger';
|
|
4
|
+
import type { MetaApp, MetaItem, MetaSession, MetaUser, MetaView } from '../metas';
|
|
5
|
+
import type { BeforeSendHook, Transport } from '../transports';
|
|
6
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
7
|
+
export interface Config<P = APIEvent> {
|
|
8
|
+
app: MetaApp;
|
|
9
|
+
dedupe: boolean;
|
|
10
|
+
globalObjectKey: string;
|
|
11
|
+
isolate: boolean;
|
|
12
|
+
instrumentations: Instrumentation[];
|
|
13
|
+
internalLoggerLevel: InternalLoggerLevel;
|
|
14
|
+
metas: MetaItem[];
|
|
15
|
+
parseStacktrace: StacktraceParser;
|
|
16
|
+
paused: boolean;
|
|
17
|
+
preventGlobalExposure: boolean;
|
|
18
|
+
transports: Transport[];
|
|
19
|
+
unpatchedConsole: UnpatchedConsole;
|
|
20
|
+
beforeSend?: BeforeSendHook<P>;
|
|
21
|
+
ignoreErrors?: Patterns;
|
|
22
|
+
session?: MetaSession;
|
|
23
|
+
user?: MetaUser;
|
|
24
|
+
view?: MetaView;
|
|
25
|
+
eventDomain?: string;
|
|
26
|
+
}
|
|
27
|
+
export type Patterns = Array<string | RegExp>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Config } from '../config';
|
|
2
|
+
import type { Metas } from '../metas';
|
|
3
|
+
import type { Extension } from './types';
|
|
4
|
+
export declare abstract class BaseExtension implements Extension {
|
|
5
|
+
abstract readonly name: string;
|
|
6
|
+
abstract readonly version: string;
|
|
7
|
+
unpatchedConsole: Console;
|
|
8
|
+
internalLogger: import("../internalLogger").InternalLogger;
|
|
9
|
+
config: Config<import("..").APIEvent>;
|
|
10
|
+
metas: Metas;
|
|
11
|
+
logDebug(...args: unknown[]): void;
|
|
12
|
+
logInfo(...args: unknown[]): void;
|
|
13
|
+
logWarn(...args: unknown[]): void;
|
|
14
|
+
logError(...args: unknown[]): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Config } from '../config';
|
|
2
|
+
import type { InternalLogger } from '../internalLogger';
|
|
3
|
+
import type { Metas } from '../metas';
|
|
4
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
5
|
+
export interface Extension {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly version: string;
|
|
8
|
+
internalLogger: InternalLogger;
|
|
9
|
+
unpatchedConsole: UnpatchedConsole;
|
|
10
|
+
config: Config;
|
|
11
|
+
metas: Metas;
|
|
12
|
+
logDebug(...args: unknown[]): void;
|
|
13
|
+
logInfo(...args: unknown[]): void;
|
|
14
|
+
logWarn(...args: unknown[]): void;
|
|
15
|
+
logError(...args: unknown[]): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Faro, internalGlobalObjectKey } from '../sdk';
|
|
3
|
+
export type GlobalObject<T = typeof window | typeof global> = T & {
|
|
4
|
+
[label: string]: Faro;
|
|
5
|
+
[internalGlobalObjectKey]: Faro;
|
|
6
|
+
};
|
|
7
|
+
export declare const globalObject: GlobalObject<typeof globalThis | (Window & typeof globalThis)>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { defaultExceptionType } from './api';
|
|
2
|
+
export type { API, APIEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, MetaAPI, OTELApi, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, } from './api';
|
|
3
|
+
export { BaseExtension } from './extensions';
|
|
4
|
+
export type { Extension } from './extensions';
|
|
5
|
+
export { globalObject } from './globalObject';
|
|
6
|
+
export type { GlobalObject } from './globalObject';
|
|
7
|
+
export { initializeFaro } from './initialize';
|
|
8
|
+
export { defaultGlobalObjectKey } from './config';
|
|
9
|
+
export type { Config, Patterns } from './config';
|
|
10
|
+
export { BaseInstrumentation } from './instrumentations';
|
|
11
|
+
export type { Instrumentation, Instrumentations } from './instrumentations';
|
|
12
|
+
export { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';
|
|
13
|
+
export type { InternalLogger } from './internalLogger';
|
|
14
|
+
export type { Meta, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, } from './metas';
|
|
15
|
+
export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject, } from './sdk';
|
|
16
|
+
export type { Faro } from './sdk';
|
|
17
|
+
export { Conventions } from './semantic';
|
|
18
|
+
export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';
|
|
19
|
+
export type { BeforeSendHook, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
|
|
20
|
+
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
21
|
+
export type { UnpatchedConsole } from './unpatchedConsole';
|
|
22
|
+
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, } from './utils';
|
|
23
|
+
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, } from './utils';
|
|
24
|
+
export { VERSION } from './version';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { API } from '../api';
|
|
2
|
+
import { BaseExtension } from '../extensions';
|
|
3
|
+
import type { Transports } from '../transports';
|
|
4
|
+
import type { Instrumentation } from './types';
|
|
5
|
+
export declare abstract class BaseInstrumentation extends BaseExtension implements Instrumentation {
|
|
6
|
+
api: API;
|
|
7
|
+
transports: Transports;
|
|
8
|
+
abstract initialize(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { API } from '../api';
|
|
2
|
+
import type { Config } from '../config';
|
|
3
|
+
import type { InternalLogger } from '../internalLogger';
|
|
4
|
+
import type { Metas } from '../metas';
|
|
5
|
+
import type { Transports } from '../transports';
|
|
6
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
7
|
+
import type { Instrumentations } from './types';
|
|
8
|
+
export declare function initializeInstrumentations(unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, api: API): Instrumentations;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { API } from '../api';
|
|
2
|
+
import type { Extension } from '../extensions';
|
|
3
|
+
import type { Transports } from '../transports';
|
|
4
|
+
export interface Instrumentation extends Extension {
|
|
5
|
+
api: API;
|
|
6
|
+
transports: Transports;
|
|
7
|
+
initialize: VoidFunction;
|
|
8
|
+
destroy?: VoidFunction;
|
|
9
|
+
}
|
|
10
|
+
export interface Instrumentations {
|
|
11
|
+
add: (...instrumentations: Instrumentation[]) => void;
|
|
12
|
+
instrumentations: Instrumentation[];
|
|
13
|
+
remove: (...instrumentations: Instrumentation[]) => void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InternalLogger } from './types';
|
|
2
|
+
export declare enum InternalLoggerLevel {
|
|
3
|
+
OFF = 0,
|
|
4
|
+
ERROR = 1,
|
|
5
|
+
WARN = 2,
|
|
6
|
+
INFO = 3,
|
|
7
|
+
VERBOSE = 4
|
|
8
|
+
}
|
|
9
|
+
export declare const defaultInternalLoggerPrefix = "Faro";
|
|
10
|
+
export declare const defaultInternalLogger: InternalLogger;
|
|
11
|
+
export declare const defaultInternalLoggerLevel = InternalLoggerLevel.ERROR;
|