@grafana/faro-core 1.0.0-beta4 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/bundle/faro-core.iife.js +1 -1
- package/dist/cjs/api/events/initialize.js +1 -1
- package/dist/cjs/api/events/initialize.js.map +1 -1
- package/dist/cjs/api/exceptions/initialize.js +1 -1
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/api/initialize.js +3 -3
- package/dist/cjs/api/initialize.js.map +1 -1
- package/dist/cjs/api/logs/initialize.js +1 -1
- package/dist/cjs/api/logs/initialize.js.map +1 -1
- package/dist/cjs/api/measurements/initialize.js +4 -3
- package/dist/cjs/api/measurements/initialize.js.map +1 -1
- package/dist/cjs/api/measurements/types.js.map +1 -1
- package/dist/cjs/api/meta/initialize.js +14 -1
- package/dist/cjs/api/meta/initialize.js.map +1 -1
- package/dist/cjs/api/meta/types.js.map +1 -1
- package/dist/cjs/api/traces/initialize.js +1 -1
- package/dist/cjs/api/traces/initialize.js.map +1 -1
- package/dist/cjs/config/types.js.map +1 -1
- package/dist/cjs/{utils/extensions.js → extensions/baseExtension.js} +15 -17
- package/dist/cjs/extensions/baseExtension.js.map +1 -0
- package/dist/cjs/extensions/index.js +6 -0
- package/dist/cjs/extensions/index.js.map +1 -0
- package/dist/cjs/extensions/types.js +3 -0
- package/dist/cjs/extensions/types.js.map +1 -0
- package/dist/cjs/index.js +12 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/initialize.js +11 -21
- package/dist/cjs/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/base.js +6 -3
- package/dist/cjs/instrumentations/base.js.map +1 -1
- package/dist/cjs/instrumentations/index.js +3 -1
- package/dist/cjs/instrumentations/index.js.map +1 -1
- package/dist/cjs/instrumentations/initialize.js +8 -2
- package/dist/cjs/instrumentations/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/registerInitial.js +9 -0
- package/dist/cjs/instrumentations/registerInitial.js.map +1 -0
- package/dist/cjs/instrumentations/types.js.map +1 -1
- package/dist/cjs/internalLogger/const.js.map +1 -1
- package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/cjs/internalLogger/index.js +2 -1
- package/dist/cjs/internalLogger/index.js.map +1 -1
- package/dist/cjs/internalLogger/initialize.js.map +1 -1
- package/dist/cjs/metas/index.js +3 -1
- package/dist/cjs/metas/index.js.map +1 -1
- package/dist/cjs/metas/initialize.js +4 -30
- package/dist/cjs/metas/initialize.js.map +1 -1
- package/dist/cjs/metas/registerInitial.js +42 -0
- package/dist/cjs/metas/registerInitial.js.map +1 -0
- package/dist/cjs/metas/types.js.map +1 -1
- package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/index.js +3 -3
- package/dist/cjs/sdk/index.js.map +1 -1
- package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/{register.js → registerFaro.js} +13 -3
- package/dist/cjs/sdk/registerFaro.js.map +1 -0
- package/dist/cjs/semantic.js +1 -0
- package/dist/cjs/semantic.js.map +1 -1
- package/dist/cjs/testUtils/mockConfig.js.map +1 -1
- package/dist/cjs/transports/base.js +2 -2
- package/dist/cjs/transports/base.js.map +1 -1
- package/dist/cjs/transports/index.js +3 -1
- package/dist/cjs/transports/index.js.map +1 -1
- package/dist/cjs/transports/initialize.js +5 -4
- package/dist/cjs/transports/initialize.js.map +1 -1
- package/dist/cjs/transports/registerInitial.js +11 -0
- package/dist/cjs/transports/registerInitial.js.map +1 -0
- package/dist/cjs/transports/types.js.map +1 -1
- package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -3
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/shortId.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/api/events/initialize.js +1 -1
- package/dist/esm/api/events/initialize.js.map +1 -1
- package/dist/esm/api/exceptions/initialize.js +1 -1
- package/dist/esm/api/exceptions/initialize.js.map +1 -1
- package/dist/esm/api/initialize.js +3 -3
- package/dist/esm/api/initialize.js.map +1 -1
- package/dist/esm/api/logs/initialize.js +1 -1
- package/dist/esm/api/logs/initialize.js.map +1 -1
- package/dist/esm/api/measurements/initialize.js +4 -3
- package/dist/esm/api/measurements/initialize.js.map +1 -1
- package/dist/esm/api/measurements/types.js.map +1 -1
- package/dist/esm/api/meta/initialize.js +14 -1
- package/dist/esm/api/meta/initialize.js.map +1 -1
- package/dist/esm/api/meta/types.js.map +1 -1
- package/dist/esm/api/traces/initialize.js +1 -1
- package/dist/esm/api/traces/initialize.js.map +1 -1
- package/dist/esm/config/types.js.map +1 -1
- package/dist/esm/extensions/baseExtension.js +23 -0
- package/dist/esm/extensions/baseExtension.js.map +1 -0
- package/dist/esm/extensions/index.js +2 -0
- package/dist/esm/extensions/index.js.map +1 -0
- package/dist/esm/extensions/types.js +2 -0
- package/dist/esm/extensions/types.js.map +1 -0
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/initialize.js +14 -23
- package/dist/esm/initialize.js.map +1 -1
- package/dist/esm/instrumentations/base.js +6 -1
- package/dist/esm/instrumentations/base.js.map +1 -1
- package/dist/esm/instrumentations/index.js +1 -0
- package/dist/esm/instrumentations/index.js.map +1 -1
- package/dist/esm/instrumentations/initialize.js +8 -2
- package/dist/esm/instrumentations/initialize.js.map +1 -1
- package/dist/esm/instrumentations/registerInitial.js +4 -0
- package/dist/esm/instrumentations/registerInitial.js.map +1 -0
- package/dist/esm/instrumentations/types.js.map +1 -1
- package/dist/esm/internalLogger/const.js.map +1 -1
- package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/esm/internalLogger/index.js +1 -1
- package/dist/esm/internalLogger/index.js.map +1 -1
- package/dist/esm/internalLogger/initialize.js.map +1 -1
- package/dist/esm/metas/index.js +1 -0
- package/dist/esm/metas/index.js.map +1 -1
- package/dist/esm/metas/initialize.js +4 -18
- package/dist/esm/metas/initialize.js.map +1 -1
- package/dist/esm/metas/registerInitial.js +25 -0
- package/dist/esm/metas/registerInitial.js.map +1 -0
- package/dist/esm/metas/types.js.map +1 -1
- package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
- package/dist/esm/sdk/index.js +1 -1
- package/dist/esm/sdk/index.js.map +1 -1
- package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/esm/sdk/registerFaro.js +21 -0
- package/dist/esm/sdk/registerFaro.js.map +1 -0
- package/dist/esm/semantic.js +1 -0
- package/dist/esm/semantic.js.map +1 -1
- package/dist/esm/testUtils/mockConfig.js.map +1 -1
- package/dist/esm/transports/base.js +1 -1
- package/dist/esm/transports/base.js.map +1 -1
- package/dist/esm/transports/index.js +1 -0
- package/dist/esm/transports/index.js.map +1 -1
- package/dist/esm/transports/initialize.js +5 -4
- package/dist/esm/transports/initialize.js.map +1 -1
- package/dist/esm/transports/registerInitial.js +6 -0
- package/dist/esm/transports/registerInitial.js.map +1 -0
- package/dist/esm/transports/types.js.map +1 -1
- package/dist/esm/unpatchedConsole/initialize.js.map +1 -1
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/shortId.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/api/events/initialize.d.ts +2 -1
- package/dist/types/api/exceptions/initialize.d.ts +2 -1
- package/dist/types/api/initialize.d.ts +2 -1
- package/dist/types/api/logs/initialize.d.ts +2 -1
- package/dist/types/api/measurements/initialize.d.ts +2 -1
- package/dist/types/api/measurements/types.d.ts +2 -1
- package/dist/types/api/meta/initialize.d.ts +2 -1
- package/dist/types/api/meta/types.d.ts +5 -3
- package/dist/types/api/traces/initialize.d.ts +2 -1
- package/dist/types/config/types.d.ts +2 -1
- package/dist/types/extensions/baseExtension.d.ts +15 -0
- package/dist/types/extensions/index.d.ts +2 -0
- package/dist/types/extensions/types.d.ts +16 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/instrumentations/base.d.ts +5 -1
- package/dist/types/instrumentations/index.d.ts +1 -0
- package/dist/types/instrumentations/initialize.d.ts +5 -1
- package/dist/types/instrumentations/registerInitial.d.ts +2 -0
- package/dist/types/instrumentations/types.d.ts +5 -1
- package/dist/types/internalLogger/index.d.ts +1 -1
- package/dist/types/metas/index.d.ts +2 -1
- package/dist/types/metas/initialize.d.ts +2 -1
- package/dist/types/metas/registerInitial.d.ts +2 -0
- package/dist/types/metas/types.d.ts +6 -1
- package/dist/types/sdk/index.d.ts +1 -1
- package/dist/types/sdk/registerFaro.d.ts +10 -0
- package/dist/types/semantic.d.ts +1 -0
- package/dist/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/transports/base.d.ts +1 -1
- package/dist/types/transports/index.d.ts +1 -0
- package/dist/types/transports/initialize.d.ts +3 -1
- package/dist/types/transports/registerInitial.d.ts +2 -0
- package/dist/types/transports/types.d.ts +1 -1
- package/dist/types/utils/index.d.ts +0 -2
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/dist/cjs/sdk/register.js.map +0 -1
- package/dist/cjs/utils/extensions.js.map +0 -1
- package/dist/esm/sdk/register.js +0 -11
- package/dist/esm/sdk/register.js.map +0 -1
- package/dist/esm/utils/extensions.js +0 -23
- package/dist/esm/utils/extensions.js.map +0 -1
- package/dist/types/sdk/register.d.ts +0 -4
- package/dist/types/utils/extensions.d.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/transports/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/transports/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,kCAAoC;AAEpC,iCAA4C;AAG5C,SAAgB,iBAAiB,CAAC,QAAkB,EAAE,GA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AAC,IAAI,CAAC,sBAAc,iBAAiB,CAAC,IAAI,oBAAgB,CAAC,CAAC;gBAE1E,OAAO;aACR;YAED,UAAU,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,IAAM,qBAAqB,GAAwC;QAAC,iCAA0B;aAA1B,UAA0B,EAA1B,qBAA0B,EAA1B,IAA0B;YAA1B,4CAA0B;;QAC5F,eAAe,CAAC,MAAM,CAAC,UAAC,cAAc,IAAK,OAAA,CAAC,uBAAuB,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAjD,CAAiD,CAAC,CAAC;IAChG,CAAC,CAAC;IAEF,IAAM,OAAO,GAA0B;QACrC,cAAc,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAE7C,MAAM,GAAG,KAAK,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,KAAA;QACH,kBAAkB,oBAAA;QAClB,uBAAuB,yBAAA;QACvB,kBAAkB,oBAAA;QAClB,OAAO,SAAA;QACP,QAAQ,UAAA;QACR,KAAK,OAAA;QACL,MAAM,QAAA;QACN,qBAAqB,uBAAA;QACrB,IAAI,UAAU;YACZ,yBAAW,UAAU,QAAE;QACzB,CAAC;QACD,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AApID,oDAoIC","sourcesContent":["import type { ExceptionEvent } from '../api';\nimport type { Config, Patterns } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { isString } from '../utils';\n\nimport { TransportItemType } from './const';\nimport type { BeforeSendHook, Transport, Transports } from './types';\n\nexport function shouldIgnoreEvent(patterns: Patterns, msg: string): boolean {\n return patterns.some((pattern) => {\n return isString(pattern) ? msg.includes(pattern) : !!msg.match(pattern);\n });\n}\n\nexport function createBeforeSendHookFromIgnorePatterns(patterns: Patterns): BeforeSendHook {\n return (item) => {\n if (item.type === TransportItemType.EXCEPTION && item.payload) {\n const evt = item.payload as ExceptionEvent;\n const msg = `${evt.type}: ${evt.value}`;\n\n if (shouldIgnoreEvent(patterns, msg)) {\n return null;\n }\n }\n\n return item;\n };\n}\n\nexport function initializeTransports(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas\n): Transports {\n internalLogger.debug('Initializing transports');\n\n const transports: Transport[] = [];\n\n let paused = config.paused;\n\n let beforeSendHooks: BeforeSendHook[] = [];\n\n const add: Transports['add'] = (...newTransports) => {\n internalLogger.debug('Adding transports');\n\n newTransports.forEach((newTransport) => {\n internalLogger.debug(`Adding \"${newTransport.name}\" transport`);\n\n const exists = transports.some((existingTransport) => existingTransport === newTransport);\n\n if (exists) {\n internalLogger.warn(`Transport ${newTransport.name} is already added`);\n\n return;\n }\n\n newTransport.unpatchedConsole = unpatchedConsole;\n newTransport.internalLogger = internalLogger;\n newTransport.config = config;\n newTransport.metas = metas;\n\n transports.push(newTransport);\n });\n };\n\n const addBeforeSendHooks: Transports['addBeforeSendHooks'] = (...newBeforeSendHooks) => {\n internalLogger.debug('Adding beforeSendHooks\\n', beforeSendHooks);\n\n newBeforeSendHooks.forEach((beforeSendHook) => {\n if (beforeSendHook) {\n beforeSendHooks.push(beforeSendHook);\n }\n });\n };\n\n const addIgnoreErrorsPatterns: Transports['addIgnoreErrorsPatterns'] = (...ignoreErrorsPatterns) => {\n internalLogger.debug('Adding ignoreErrorsPatterns\\n', ignoreErrorsPatterns);\n\n ignoreErrorsPatterns.forEach((ignoreErrorsPattern) => {\n if (ignoreErrorsPattern) {\n beforeSendHooks.push(createBeforeSendHookFromIgnorePatterns(ignoreErrorsPattern));\n }\n });\n };\n\n const execute: Transports['execute'] = (item) => {\n if (!paused) {\n let actualItem = item;\n\n for (const hook of beforeSendHooks) {\n const modified = hook(actualItem);\n\n if (modified === null) {\n return;\n }\n\n actualItem = modified;\n }\n\n for (const transport of transports) {\n internalLogger.debug(`Transporting item using ${transport.name}\\n`, actualItem);\n\n transport.send(actualItem);\n }\n }\n };\n\n const getBeforeSendHooks: Transports['getBeforeSendHooks'] = () => [...beforeSendHooks];\n\n const isPaused: Transports['isPaused'] = () => paused;\n\n const pause: Transports['pause'] = () => {\n internalLogger.debug('Pausing transports');\n\n paused = true;\n };\n\n const remove: Transports['remove'] = (...transportsToRemove) => {\n internalLogger.debug('Removing transports');\n\n transportsToRemove.forEach((transportToRemove) => {\n internalLogger.debug(`Removing \"${transportToRemove.name}\" transport`);\n\n const existingTransportIndex = transports.indexOf(transportToRemove);\n\n if (existingTransportIndex === -1) {\n internalLogger.warn(`Transport \"${transportToRemove.name}\" is not added`);\n\n return;\n }\n\n transports.splice(existingTransportIndex, 1);\n });\n };\n\n const removeBeforeSendHooks: Transports['removeBeforeSendHooks'] = (...beforeSendHooksToRemove) => {\n beforeSendHooks.filter((beforeSendHook) => !beforeSendHooksToRemove.includes(beforeSendHook));\n };\n\n const unpause: Transports['unpause'] = () => {\n internalLogger.debug('Unpausing transports');\n\n paused = false;\n };\n\n return {\n add,\n addBeforeSendHooks,\n addIgnoreErrorsPatterns,\n getBeforeSendHooks,\n execute,\n isPaused,\n pause,\n remove,\n removeBeforeSendHooks,\n get transports() {\n return [...transports];\n },\n unpause,\n };\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerInitialTransports = void 0;
|
|
4
|
+
function registerInitialTransports(faro) {
|
|
5
|
+
var _a;
|
|
6
|
+
(_a = faro.transports).add.apply(_a, faro.config.transports);
|
|
7
|
+
faro.transports.addBeforeSendHooks(faro.config.beforeSend);
|
|
8
|
+
faro.transports.addIgnoreErrorsPatterns(faro.config.ignoreErrors);
|
|
9
|
+
}
|
|
10
|
+
exports.registerInitialTransports = registerInitialTransports;
|
|
11
|
+
//# sourceMappingURL=registerInitial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/transports/registerInitial.ts"],"names":[],"mappings":";;;AAEA,SAAgB,yBAAyB,CAAC,IAAU;;IAClD,CAAA,KAAA,IAAI,CAAC,UAAU,CAAA,CAAC,GAAG,WAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;IAC/C,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC;AAJD,8DAIC","sourcesContent":["import type { Faro } from '../sdk';\n\nexport function registerInitialTransports(faro: Faro): void {\n faro.transports.add(...faro.config.transports);\n faro.transports.addBeforeSendHooks(faro.config.beforeSend);\n faro.transports.addIgnoreErrorsPatterns(faro.config.ignoreErrors);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, EventEvent, ExceptionEvent, LogEvent, MeasurementEvent, TraceEvent } from '../api';\nimport type { Patterns } from '../config';\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, EventEvent, ExceptionEvent, LogEvent, MeasurementEvent, TraceEvent } from '../api';\nimport type { Patterns } from '../config';\nimport type { Extension } from '../extensions';\nimport type { Meta } from '../metas';\n\nimport type { TransportItemType } from './const';\n\nexport type TransportItemPayload<P = APIEvent> = P;\n\nexport type BeforeSendHook<P = APIEvent> = (item: TransportItem<P>) => TransportItem<P> | null;\n\nexport interface TransportItem<P = APIEvent> {\n type: TransportItemType;\n payload: TransportItemPayload<P>;\n meta: Meta;\n}\n\nexport interface Transport extends Extension {\n send(item: TransportItem): void | Promise<void>;\n\n // returns URLs to be ignored by tracing, to not cause a feedback loop\n getIgnoreUrls(): Patterns;\n}\n\nexport interface TransportBody {\n meta: Meta;\n\n exceptions?: ExceptionEvent[];\n logs?: LogEvent[];\n measurements?: MeasurementEvent[];\n traces?: TraceEvent;\n events?: EventEvent[];\n}\n\nexport interface Transports {\n add: (...transports: Transport[]) => void;\n addBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n addIgnoreErrorsPatterns: (...ignoreErrorsPatterns: Array<Patterns | undefined>) => void;\n execute: (transportItem: TransportItem) => void;\n getBeforeSendHooks: () => BeforeSendHook[];\n isPaused: () => boolean;\n remove: (...transports: Transport[]) => void;\n removeBeforeSendHooks: (...hooks: Array<BeforeSendHook | undefined>) => void;\n transports: Transport[];\n pause: () => void;\n unpause: () => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/unpatchedConsole/initialize.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/unpatchedConsole/initialize.ts"],"names":[],"mappings":";;;AAEA,iCAAkD;AAGvC,QAAA,gBAAgB,GAAqB,+BAAuB,CAAC;AAExE,SAAgB,0BAA0B,CAAC,MAAc;;IACvD,wBAAgB,GAAG,MAAA,MAAM,CAAC,gBAAgB,mCAAI,wBAAgB,CAAC;IAE/D,OAAO,wBAAgB,CAAC;AAC1B,CAAC;AAJD,gEAIC","sourcesContent":["import type { Config } from '../config';\n\nimport { defaultUnpatchedConsole } from './const';\nimport type { UnpatchedConsole } from './types';\n\nexport let unpatchedConsole: UnpatchedConsole = defaultUnpatchedConsole;\n\nexport function initializeUnpatchedConsole(config: Config): UnpatchedConsole {\n unpatchedConsole = config.unpatchedConsole ?? unpatchedConsole;\n\n return unpatchedConsole;\n}\n"]}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual =
|
|
4
|
-
var extensions_1 = require("./extensions");
|
|
5
|
-
Object.defineProperty(exports, "BaseExtension", { enumerable: true, get: function () { return extensions_1.BaseExtension; } });
|
|
3
|
+
exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = void 0;
|
|
6
4
|
var deepEqual_1 = require("./deepEqual");
|
|
7
5
|
Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deepEqual_1.deepEqual; } });
|
|
8
6
|
var getCurrentTimestamp_1 = require("./getCurrentTimestamp");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAE5B,2BA6Bc;AA5BZ,6FAAA,OAAO,OAAA;AACP,+FAAA,SAAS,OAAA;AACT,gGAAA,UAAU,OAAA;AACV,oGAAA,cAAc,OAAA;AACd,+FAAA,SAAS,OAAA;AACT,sGAAA,gBAAgB,OAAA;AAChB,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,kGAAA,YAAY,OAAA;AACZ,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,gGAAA,UAAU,OAAA;AACV,kGAAA,YAAY,OAAA;AACZ,2FAAA,KAAK,OAAA;AACL,2FAAA,KAAK,OAAA;AACL,kGAAA,YAAY,OAAA;AACZ,4FAAA,MAAM,OAAA;AACN,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,sGAAA,gBAAgB,OAAA;AAChB,gGAAA,UAAU,OAAA;AACV,gGAAA,UAAU,OAAA;AACV,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AAIb,yCAAsE;AAA7D,yGAAA,YAAY,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAEhD,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAG5B,qCAAuC;AAA9B,qGAAA,UAAU,OAAA","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './getCurrentTimestamp';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n"]}
|
|
@@ -1 +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,
|
|
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"]}
|
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,
|
|
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.1';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
2
|
import { deepEqual, getCurrentTimestamp, isNull } from '../../utils';
|
|
3
|
-
export function initializeEventsAPI(internalLogger, config,
|
|
3
|
+
export function initializeEventsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
|
|
4
4
|
let lastPayload = null;
|
|
5
5
|
const pushEvent = (name, attributes, domain, { skipDedupe } = {}) => {
|
|
6
6
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAc,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAc,MAAM,kBAAkB,CAAC;AAEhF,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAKrE,MAAM,UAAU,mBAAmB,CACjC,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,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":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport type { EventEvent, EventsAPI } from './types';\n\nexport function initializeEventsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): EventsAPI {\n let lastPayload: Pick<EventEvent, 'name' | 'domain' | 'attributes'> | null = null;\n\n const pushEvent: EventsAPI['pushEvent'] = (name, attributes, domain, { skipDedupe } = {}) => {\n try {\n const item: TransportItem<EventEvent> = {\n meta: metas.value,\n payload: {\n name,\n domain: domain ?? config.eventDomain,\n attributes,\n timestamp: getCurrentTimestamp(),\n trace: 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 transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n return {\n pushEvent,\n };\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { TransportItemType } from '../../transports';
|
|
|
2
2
|
import { deepEqual, getCurrentTimestamp, isNull } from '../../utils';
|
|
3
3
|
import { defaultExceptionType } from './const';
|
|
4
4
|
let stacktraceParser;
|
|
5
|
-
export function initializeExceptionsAPI(internalLogger, config,
|
|
5
|
+
export function initializeExceptionsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
|
|
6
6
|
var _a;
|
|
7
7
|
internalLogger.debug('Initializing exceptions API');
|
|
8
8
|
let lastPayload = null;
|
|
@@ -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;
|
|
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,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,MAAM,UAAU,uBAAuB,CACrC,iBAAmC,EACnC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,SAAoB;;IAEpB,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAiE,IAAI,CAAC;IAErF,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,mBAAmB,GAAI,gBAAgB,CAAC;IAC7D,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAyC,GAAG,EAAE,CAAC,gBAAgB,CAAC;IAEzF,MAAM,SAAS,GAA+B,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;QAC9F,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,oBAAoB,CAAC;QAElD,MAAM,IAAI,GAAkC;YAC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;QACnB,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, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport { defaultExceptionType } from './const';\nimport type { ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace'> | 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 pushError: ExceptionsAPI['pushError'] = (error, { skipDedupe, stackFrames, type } = {}) => {\n type = type || error.name || defaultExceptionType;\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type,\n value: error.message,\n timestamp: getCurrentTimestamp(),\n trace: tracesApi.getTraceContext(),\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 };\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 transports.execute(item);\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n"]}
|
|
@@ -4,9 +4,9 @@ import { initializeLogsAPI } from './logs';
|
|
|
4
4
|
import { initializeMeasurementsAPI } from './measurements';
|
|
5
5
|
import { initializeMetaAPI } from './meta';
|
|
6
6
|
import { initializeTracesAPI } from './traces';
|
|
7
|
-
export function initializeAPI(internalLogger, config,
|
|
7
|
+
export function initializeAPI(unpatchedConsole, internalLogger, config, metas, transports) {
|
|
8
8
|
internalLogger.debug('Initializing API');
|
|
9
|
-
const tracesApi = initializeTracesAPI(internalLogger, config,
|
|
10
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, tracesApi), initializeExceptionsAPI(internalLogger, config,
|
|
9
|
+
const tracesApi = initializeTracesAPI(unpatchedConsole, internalLogger, config, metas, transports);
|
|
10
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, tracesApi), initializeExceptionsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi)), initializeMetaAPI(unpatchedConsole, internalLogger, config, metas, transports)), initializeLogsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi)), initializeMeasurementsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi)), initializeEventsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi));
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,UAAU,aAAa,CAC3B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB;IAEtB,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEzC,MAAM,SAAS,GAAG,mBAAmB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAEnG,+FACK,SAAS,GACT,uBAAuB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,GAC/F,iBAAiB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,GAC9E,iBAAiB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,GACzF,yBAAyB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,GACjG,mBAAmB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,EAC9F;AACJ,CAAC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { initializeEventsAPI } from './events';\nimport { initializeExceptionsAPI } from './exceptions';\nimport { initializeLogsAPI } from './logs';\nimport { initializeMeasurementsAPI } from './measurements';\nimport { initializeMetaAPI } from './meta';\nimport { initializeTracesAPI } from './traces';\nimport type { API } from './types';\n\nexport function initializeAPI(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports\n): API {\n internalLogger.debug('Initializing API');\n\n const tracesApi = initializeTracesAPI(unpatchedConsole, internalLogger, config, metas, transports);\n\n return {\n ...tracesApi,\n ...initializeExceptionsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n ...initializeMetaAPI(unpatchedConsole, internalLogger, config, metas, transports),\n ...initializeLogsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n ...initializeMeasurementsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n ...initializeEventsAPI(unpatchedConsole, internalLogger, config, metas, transports, tracesApi),\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
2
|
import { deepEqual, defaultLogLevel, getCurrentTimestamp, isNull } from '../../utils';
|
|
3
|
-
export function initializeLogsAPI(internalLogger, config,
|
|
3
|
+
export function initializeLogsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
|
|
4
4
|
internalLogger.debug('Initializing logs API');
|
|
5
5
|
let lastPayload = null;
|
|
6
6
|
const pushLog = (args, { context, level, skipDedupe } = {}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/logs/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/logs/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGpE,OAAO,EAAE,SAAS,EAAE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,CAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAClG,cAAc,CAAC,KAAK,CAAC,4DAA4D,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEjG,OAAO;aACR;YAED,WAAW,GAAG,cAAc,CAAC;YAE7B,cAAc,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAE5C,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;SAClD;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 { TransportItem, TransportItemType } from '../../transports';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, defaultLogLevel, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport type { LogEvent, LogsAPI } from './types';\n\nexport function initializeLogsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): LogsAPI {\n internalLogger.debug('Initializing logs API');\n\n let lastPayload: Pick<LogEvent, 'message' | 'level' | 'context'> | null = null;\n\n const pushLog: LogsAPI['pushLog'] = (args, { context, level, skipDedupe } = {}) => {\n try {\n const item: TransportItem<LogEvent> = {\n type: TransportItemType.LOG,\n payload: {\n message: args\n .map((arg) => {\n try {\n return String(arg);\n } catch (err) {\n return '';\n }\n })\n .join(' '),\n level: level ?? defaultLogLevel,\n context: context ?? {},\n timestamp: getCurrentTimestamp(),\n trace: 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 transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing log\\n', err);\n }\n };\n\n return {\n pushLog,\n };\n}\n"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
|
-
import { deepEqual, isNull } from '../../utils';
|
|
3
|
-
export function initializeMeasurementsAPI(internalLogger, config,
|
|
2
|
+
import { deepEqual, getCurrentTimestamp, isNull } from '../../utils';
|
|
3
|
+
export function initializeMeasurementsAPI(_unpatchedConsole, internalLogger, config, metas, transports, tracesApi) {
|
|
4
4
|
internalLogger.debug('Initializing measurements API');
|
|
5
5
|
let lastPayload = null;
|
|
6
6
|
const pushMeasurement = (payload, { skipDedupe } = {}) => {
|
|
7
|
+
var _a;
|
|
7
8
|
try {
|
|
8
9
|
const item = {
|
|
9
10
|
type: TransportItemType.MEASUREMENT,
|
|
10
|
-
payload: Object.assign(Object.assign({}, payload), { trace: tracesApi.getTraceContext() }),
|
|
11
|
+
payload: Object.assign(Object.assign({}, payload), { trace: tracesApi.getTraceContext(), timestamp: (_a = payload.timestamp) !== null && _a !== void 0 ? _a : getCurrentTimestamp() }),
|
|
11
12
|
meta: metas.value,
|
|
12
13
|
};
|
|
13
14
|
const testingPayload = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/measurements/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/measurements/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGpE,OA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AC;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 { TransportItem, TransportItemType } from '../../transports';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isNull } from '../../utils';\nimport type { TracesAPI } from '../traces';\n\nimport type { MeasurementEvent, MeasurementsAPI } from './types';\n\nexport function initializeMeasurementsAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n tracesApi: TracesAPI\n): MeasurementsAPI {\n internalLogger.debug('Initializing measurements API');\n\n let lastPayload: Pick<MeasurementEvent, 'type' | 'values'> | null = null;\n\n const pushMeasurement: MeasurementsAPI['pushMeasurement'] = (payload, { skipDedupe } = {}) => {\n try {\n const item: TransportItem<MeasurementEvent> = {\n type: TransportItemType.MEASUREMENT,\n payload: {\n ...payload,\n trace: tracesApi.getTraceContext(),\n timestamp: payload.timestamp ?? getCurrentTimestamp(),\n },\n meta: metas.value,\n };\n\n const testingPayload = {\n type: item.payload.type,\n values: item.payload.values,\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 transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing measurement\\n', err);\n }\n };\n\n return {\n pushMeasurement,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/measurements/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceContext } from '../traces';\n\nexport interface MeasurementEvent<V extends { [label: string]: number } = { [label: string]: number }> {\n type: string;\n values: V;\n\n trace?: TraceContext;\n}\n\nexport interface PushMeasurementOptions {\n skipDedupe?: boolean;\n}\n\nexport interface MeasurementsAPI {\n pushMeasurement: (payload: MeasurementEvent, options?: PushMeasurementOptions) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/measurements/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceContext } from '../traces';\n\nexport interface MeasurementEvent<V extends { [label: string]: number } = { [label: string]: number }> {\n type: string;\n values: V;\n\n timestamp: string;\n trace?: TraceContext;\n}\n\nexport interface PushMeasurementOptions {\n skipDedupe?: boolean;\n}\n\nexport interface MeasurementsAPI {\n pushMeasurement: (\n // TODO: change this back once we have aligned the measurement event types: See: https://github.com/grafana/faro-web-sdk/issues/110\n payload: Omit<MeasurementEvent, 'timestamp'> & Partial<Pick<MeasurementEvent, 'timestamp'>>,\n options?: PushMeasurementOptions\n ) => void;\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export function initializeMetaAPI(internalLogger, _config,
|
|
1
|
+
export function initializeMetaAPI(_unpatchedConsole, internalLogger, _config, metas, _transports) {
|
|
2
2
|
internalLogger.debug('Initializing meta API');
|
|
3
3
|
let metaSession = undefined;
|
|
4
4
|
let metaUser = undefined;
|
|
5
|
+
let metaView = undefined;
|
|
5
6
|
const setUser = (user) => {
|
|
6
7
|
if (metaUser) {
|
|
7
8
|
metas.remove(metaUser);
|
|
@@ -21,12 +22,24 @@ export function initializeMetaAPI(internalLogger, _config, _transports, metas) {
|
|
|
21
22
|
metas.add(metaSession);
|
|
22
23
|
};
|
|
23
24
|
const getSession = () => metas.value.session;
|
|
25
|
+
const setView = (view) => {
|
|
26
|
+
if (metaView) {
|
|
27
|
+
metas.remove(metaView);
|
|
28
|
+
}
|
|
29
|
+
metaView = {
|
|
30
|
+
view,
|
|
31
|
+
};
|
|
32
|
+
metas.add(metaView);
|
|
33
|
+
};
|
|
34
|
+
const getView = () => metas.value.view;
|
|
24
35
|
return {
|
|
25
36
|
setUser,
|
|
26
37
|
resetUser: setUser,
|
|
27
38
|
setSession,
|
|
28
39
|
resetSession: setSession,
|
|
29
40
|
getSession,
|
|
41
|
+
setView,
|
|
42
|
+
getView,
|
|
30
43
|
};
|
|
31
44
|
}
|
|
32
45
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/meta/initialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/meta/initialize.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,iBAAiB,CAC/B,iBAAmC,EACnC,cAA8B,EAC9B,OAAe,EACf,KAAY,EACZ,WAAuB;IAEvB,cAAc,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE9C,IAAI,WAAW,GAA8B,SAAS,CAAC;IACvD,IAAI,QAAQ,GAA8B,SAAS,CAAC;IACpD,IAAI,QAAQ,GAA8B,SAAS,CAAC;IAEpD,MAAM,OAAO,GAAuB,CAAC,IAAI,EAAE,EAAE;QAC3C,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SACxB;QAED,QAAQ,GAAG;YACT,IAAI;SACL,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,UAAU,GAA0B,CAAC,OAAO,EAAE,EAAE;QACpD,IAAI,WAAW,EAAE;YACf,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;SAC3B;QAED,WAAW,GAAG;YACZ,OAAO;SACR,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,MAAM,UAAU,GAA0B,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;IAEpE,MAAM,OAAO,GAAuB,CAAC,IAAI,EAAE,EAAE;QAC3C,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SACxB;QAED,QAAQ,GAAG;YACT,IAAI;SACL,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,OAAO,GAAuB,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;IAE3D,OAAO;QACL,OAAO;QACP,SAAS,EAAE,OAA+B;QAC1C,UAAU;QACV,YAAY,EAAE,UAAqC;QACnD,UAAU;QACV,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Meta, Metas } from '../../metas';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\n\nimport type { MetaAPI } from './types';\n\nexport function initializeMetaAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config,\n metas: Metas,\n _transports: Transports\n): MetaAPI {\n internalLogger.debug('Initializing meta API');\n\n let metaSession: Partial<Meta> | undefined = undefined;\n let metaUser: Partial<Meta> | undefined = undefined;\n let metaView: Partial<Meta> | undefined = undefined;\n\n const setUser: MetaAPI['setUser'] = (user) => {\n if (metaUser) {\n metas.remove(metaUser);\n }\n\n metaUser = {\n user,\n };\n\n metas.add(metaUser);\n };\n\n const setSession: MetaAPI['setSession'] = (session) => {\n if (metaSession) {\n metas.remove(metaSession);\n }\n\n metaSession = {\n session,\n };\n\n metas.add(metaSession);\n };\n\n const getSession: MetaAPI['getSession'] = () => metas.value.session;\n\n const setView: MetaAPI['setView'] = (view) => {\n if (metaView) {\n metas.remove(metaView);\n }\n\n metaView = {\n view,\n };\n\n metas.add(metaView);\n };\n\n const getView: MetaAPI['getView'] = () => metas.value.view;\n\n return {\n setUser,\n resetUser: setUser as MetaAPI['resetUser'],\n setSession,\n resetSession: setSession as MetaAPI['resetSession'],\n getSession,\n setView,\n getView,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/meta/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MetaSession, MetaUser } from '../../metas';\n\nexport interface MetaAPI {\n setUser: (user
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/meta/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MetaSession, MetaUser, MetaView } from '../../metas';\n\nexport interface MetaAPI {\n setUser: (user?: MetaUser | undefined) => void;\n resetUser: () => void;\n setSession: (session?: MetaSession | undefined) => void;\n resetSession: () => void;\n getSession: () => MetaSession | undefined;\n setView: (view?: MetaView | undefined) => void;\n getView: () => MetaView | undefined;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransportItemType } from '../../transports';
|
|
2
|
-
export function initializeTracesAPI(internalLogger, _config,
|
|
2
|
+
export function initializeTracesAPI(_unpatchedConsole, internalLogger, _config, metas, transports) {
|
|
3
3
|
internalLogger.debug('Initializing traces API');
|
|
4
4
|
let otel = undefined;
|
|
5
5
|
const initOTEL = (trace, context) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/traces/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAc,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/traces/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAc,MAAM,kBAAkB,CAAC;AAKhF,MAAM,UAAU,mBAAmB,CACjC,iBAAmC,EACnC,cAA8B,EAC9B,OAAe,EACf,KAAY,EACZ,UAAsB;IAEtB,cAAc,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAEhD,IAAI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../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItem, TransportItemType, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\n\nimport type { OTELApi, TraceEvent, TracesAPI } from './types';\n\nexport function initializeTracesAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config,\n metas: Metas,\n transports: Transports\n): TracesAPI {\n internalLogger.debug('Initializing traces API');\n\n let otel: OTELApi | undefined = undefined;\n\n const initOTEL: TracesAPI['initOTEL'] = (trace, context) => {\n internalLogger.debug('Initializing OpenTelemetry');\n\n otel = {\n trace,\n context,\n };\n };\n\n const getTraceContext: TracesAPI['getTraceContext'] = () => {\n const ctx = otel?.trace.getSpanContext(otel.context.active());\n\n return !ctx\n ? undefined\n : {\n trace_id: ctx.traceId,\n span_id: ctx.spanId,\n };\n };\n\n const pushTraces: TracesAPI['pushTraces'] = (payload) => {\n try {\n const item: TransportItem<TraceEvent> = {\n type: TransportItemType.TRACE,\n payload,\n meta: metas.value,\n };\n\n internalLogger.debug('Pushing trace\\n', item);\n\n transports.execute(item);\n } catch (err) {\n internalLogger.error('Error pushing trace\\n', err);\n }\n };\n\n const getOTEL: TracesAPI['getOTEL'] = () => otel;\n\n const isOTELInitialized: TracesAPI['isOTELInitialized'] = () => !!otel;\n\n return {\n getOTEL,\n getTraceContext,\n initOTEL,\n isOTELInitialized,\n pushTraces,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, StacktraceParser } from '../api';\nimport type { Instrumentation } from '../instrumentations';\nimport type { InternalLoggerLevel } from '../internalLogger';\nimport type { MetaApp, MetaItem, MetaSession, MetaUser } from '../metas';\nimport type { BeforeSendHook, Transport } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nexport interface Config<P = APIEvent> {\n app: MetaApp;\n dedupe: boolean;\n globalObjectKey: string;\n isolate: boolean;\n instrumentations: Instrumentation[];\n internalLoggerLevel: InternalLoggerLevel;\n metas: MetaItem[];\n parseStacktrace: StacktraceParser;\n paused: boolean;\n preventGlobalExposure: boolean;\n transports: Transport[];\n unpatchedConsole: UnpatchedConsole;\n\n beforeSend?: BeforeSendHook<P>;\n ignoreErrors?: Patterns;\n session?: MetaSession;\n user?: MetaUser;\n eventDomain?: string;\n}\n\nexport type Patterns = Array<string | RegExp>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, StacktraceParser } from '../api';\nimport type { Instrumentation } from '../instrumentations';\nimport type { InternalLoggerLevel } from '../internalLogger';\nimport type { MetaApp, MetaItem, MetaSession, MetaUser, MetaView } from '../metas';\nimport type { BeforeSendHook, Transport } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nexport interface Config<P = APIEvent> {\n app: MetaApp;\n dedupe: boolean;\n globalObjectKey: string;\n isolate: boolean;\n instrumentations: Instrumentation[];\n internalLoggerLevel: InternalLoggerLevel;\n metas: MetaItem[];\n parseStacktrace: StacktraceParser;\n paused: boolean;\n preventGlobalExposure: boolean;\n transports: Transport[];\n unpatchedConsole: UnpatchedConsole;\n\n beforeSend?: BeforeSendHook<P>;\n ignoreErrors?: Patterns;\n session?: MetaSession;\n user?: MetaUser;\n view?: MetaView;\n eventDomain?: string;\n}\n\nexport type Patterns = Array<string | RegExp>;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defaultInternalLogger } from '../internalLogger';
|
|
2
|
+
import { defaultUnpatchedConsole } from '../unpatchedConsole';
|
|
3
|
+
export class BaseExtension {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.unpatchedConsole = defaultUnpatchedConsole;
|
|
6
|
+
this.internalLogger = defaultInternalLogger;
|
|
7
|
+
this.config = {};
|
|
8
|
+
this.metas = {};
|
|
9
|
+
}
|
|
10
|
+
logDebug(...args) {
|
|
11
|
+
this.internalLogger.debug(`${this.name}\n`, ...args);
|
|
12
|
+
}
|
|
13
|
+
logInfo(...args) {
|
|
14
|
+
this.internalLogger.info(`${this.name}\n`, ...args);
|
|
15
|
+
}
|
|
16
|
+
logWarn(...args) {
|
|
17
|
+
this.internalLogger.warn(`${this.name}\n`, ...args);
|
|
18
|
+
}
|
|
19
|
+
logError(...args) {
|
|
20
|
+
this.internalLogger.error(`${this.name}\n`, ...args);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=baseExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseExtension.js","sourceRoot":"","sources":["../../../src/extensions/baseExtension.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,MAAM,OAAgB,aAAa;IAAnC;QAIE,qBAAgB,GAAG,uBAAuB,CAAC;QAC3C,mBAAc,GAAG,qBAAqB,CAAC;QACvC,WAAM,GAAG,EAAY,CAAC;QACtB,UAAK,GAAG,EAAW,CAAC;IAiBtB,CAAC;IAfC,QAAQ,CAAC,GAAG,IAAe;QACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,CAAC,GAAG,IAAe;QACxB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,CAAC,GAAG,IAAe;QACxB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ,CAAC,GAAG,IAAe;QACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACvD,CAAC;CACF","sourcesContent":["import type { Config } from '../config';\nimport { defaultInternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport { defaultUnpatchedConsole } from '../unpatchedConsole';\n\nimport type { Extension } from './types';\n\nexport abstract class BaseExtension implements Extension {\n abstract readonly name: string;\n abstract readonly version: string;\n\n unpatchedConsole = defaultUnpatchedConsole;\n internalLogger = defaultInternalLogger;\n config = {} as Config;\n metas = {} as Metas;\n\n logDebug(...args: unknown[]): void {\n this.internalLogger.debug(`${this.name}\\n`, ...args);\n }\n\n logInfo(...args: unknown[]): void {\n this.internalLogger.info(`${this.name}\\n`, ...args);\n }\n\n logWarn(...args: unknown[]): void {\n this.internalLogger.warn(`${this.name}\\n`, ...args);\n }\n\n logError(...args: unknown[]): void {\n this.internalLogger.error(`${this.name}\\n`, ...args);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { BaseExtension } from './baseExtension';\n\nexport type { Extension } from './types';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/extensions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nexport interface Extension {\n readonly name: string;\n readonly version: string;\n\n internalLogger: InternalLogger;\n unpatchedConsole: UnpatchedConsole;\n config: Config;\n metas: Metas;\n\n logDebug(...args: unknown[]): void;\n logInfo(...args: unknown[]): void;\n logWarn(...args: unknown[]): void;\n logError(...args: unknown[]): void;\n}\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject, } from './sdk';
|
|
2
1
|
export { defaultExceptionType } from './api';
|
|
2
|
+
export { BaseExtension } from './extensions';
|
|
3
3
|
export { globalObject } from './globalObject';
|
|
4
4
|
export { initializeFaro } from './initialize';
|
|
5
5
|
export { defaultGlobalObjectKey } from './config';
|
|
6
6
|
export { BaseInstrumentation } from './instrumentations';
|
|
7
7
|
export { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';
|
|
8
|
+
export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject, } from './sdk';
|
|
9
|
+
export { Conventions } from './semantic';
|
|
8
10
|
export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';
|
|
9
11
|
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
10
|
-
export { allLogLevels,
|
|
12
|
+
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';
|
|
11
13
|
export { VERSION } from './version';
|
|
12
|
-
export { Conventions } from './semantic';
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"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ptionType } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport { Conventions } from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n} from './utils';\n\nexport { VERSION } from './version';\n"]}
|
package/dist/esm/initialize.js
CHANGED
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import { initializeAPI } from './api';
|
|
2
|
-
import { initializeInstrumentations } from './instrumentations';
|
|
2
|
+
import { initializeInstrumentations, registerInitialInstrumentations } from './instrumentations';
|
|
3
3
|
import { initializeInternalLogger } from './internalLogger';
|
|
4
|
-
import { initializeMetas } from './metas';
|
|
4
|
+
import { initializeMetas, registerInitialMetas } from './metas';
|
|
5
5
|
import { isInternalFaroOnGlobalObject, registerFaro } from './sdk';
|
|
6
|
-
import { initializeTransports } from './transports';
|
|
6
|
+
import { initializeTransports, registerInitialTransports } from './transports';
|
|
7
7
|
import { initializeUnpatchedConsole } from './unpatchedConsole';
|
|
8
8
|
export function initializeFaro(config) {
|
|
9
9
|
const unpatchedConsole = initializeUnpatchedConsole(config);
|
|
10
10
|
const internalLogger = initializeInternalLogger(unpatchedConsole, config);
|
|
11
|
-
internalLogger.debug('Initializing');
|
|
12
11
|
if (isInternalFaroOnGlobalObject() && !config.isolate) {
|
|
13
12
|
internalLogger.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');
|
|
14
13
|
return undefined;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const faro = registerFaro(internalLogger,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
pause: transports.pause,
|
|
28
|
-
transports,
|
|
29
|
-
unpatchedConsole,
|
|
30
|
-
unpause: transports.unpause,
|
|
31
|
-
instrumentations: initializeInstrumentations(internalLogger, config),
|
|
32
|
-
});
|
|
33
|
-
// make sure Faro is initialized before initializing instrumentations
|
|
34
|
-
faro.instrumentations.add(...config.instrumentations);
|
|
15
|
+
internalLogger.debug('Initializing');
|
|
16
|
+
// Initializing the APIs
|
|
17
|
+
const metas = initializeMetas(unpatchedConsole, internalLogger, config);
|
|
18
|
+
const transports = initializeTransports(unpatchedConsole, internalLogger, config, metas);
|
|
19
|
+
const api = initializeAPI(unpatchedConsole, internalLogger, config, metas, transports);
|
|
20
|
+
const instrumentations = initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api);
|
|
21
|
+
const faro = registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations);
|
|
22
|
+
// make sure Faro is initialized before registering default metas, instrumentations, transports etc.
|
|
23
|
+
registerInitialMetas(faro);
|
|
24
|
+
registerInitialTransports(faro);
|
|
25
|
+
registerInitialInstrumentations(faro);
|
|
35
26
|
return faro;
|
|
36
27
|
}
|
|
37
28
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,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C3B,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAChC,+BAA+B,CAAC,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { initializeAPI } from './api';\nimport type { Config } from './config';\nimport { initializeInstrumentations, registerInitialInstrumentations } from './instrumentations';\nimport { initializeInternalLogger } from './internalLogger';\nimport { initializeMetas, registerInitialMetas } from './metas';\nimport { isInternalFaroOnGlobalObject, registerFaro } from './sdk';\nimport type { Faro } from './sdk';\nimport { initializeTransports, registerInitialTransports } from './transports';\nimport { initializeUnpatchedConsole } from './unpatchedConsole';\n\nexport function initializeFaro(config: Config): Faro {\n const unpatchedConsole = initializeUnpatchedConsole(config);\n const internalLogger = initializeInternalLogger(unpatchedConsole, config);\n\n if (isInternalFaroOnGlobalObject() && !config.isolate) {\n internalLogger.error(\n 'Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the \"isolate\" property'\n );\n\n return undefined!;\n }\n\n internalLogger.debug('Initializing');\n\n // Initializing the APIs\n const metas = initializeMetas(unpatchedConsole, internalLogger, config);\n const transports = initializeTransports(unpatchedConsole, internalLogger, config, metas);\n const api = initializeAPI(unpatchedConsole, internalLogger, config, metas, transports);\n const instrumentations = initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api);\n const faro = registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations);\n\n // make sure Faro is initialized before registering default metas, instrumentations, transports etc.\n registerInitialMetas(faro);\n registerInitialTransports(faro);\n registerInitialInstrumentations(faro);\n\n return faro;\n}\n"]}
|