@newrelic/browser-agent 0.0.7
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/LICENSE +201 -0
- package/README.md +187 -0
- package/dist/bundled/es5/index.js +2 -0
- package/dist/bundled/es5/index.js.map +1 -0
- package/dist/bundled/es6/index.js +2 -0
- package/dist/bundled/es6/index.js.map +1 -0
- package/dist/cjs/index.d.ts +19 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types.d.ts +94 -0
- package/dist/cjs/types.js +28 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/api/api.d.ts +10 -0
- package/dist/cjs/utils/api/api.js +40 -0
- package/dist/cjs/utils/api/api.js.map +1 -0
- package/dist/cjs/utils/config/build-configs.d.ts +6 -0
- package/dist/cjs/utils/config/build-configs.js +68 -0
- package/dist/cjs/utils/config/build-configs.js.map +1 -0
- package/dist/cjs/utils/features/features.d.ts +5 -0
- package/dist/cjs/utils/features/features.js +14 -0
- package/dist/cjs/utils/features/features.js.map +1 -0
- package/dist/cjs/utils/features/initialize.d.ts +5 -0
- package/dist/cjs/utils/features/initialize.js +51 -0
- package/dist/cjs/utils/features/initialize.js.map +1 -0
- package/dist/es/index.d.ts +19 -0
- package/dist/es/index.js +55 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/types.d.ts +94 -0
- package/dist/es/types.js +24 -0
- package/dist/es/types.js.map +1 -0
- package/dist/es/utils/api/api.d.ts +10 -0
- package/dist/es/utils/api/api.js +36 -0
- package/dist/es/utils/api/api.js.map +1 -0
- package/dist/es/utils/config/build-configs.d.ts +6 -0
- package/dist/es/utils/config/build-configs.js +64 -0
- package/dist/es/utils/config/build-configs.js.map +1 -0
- package/dist/es/utils/features/features.d.ts +5 -0
- package/dist/es/utils/features/features.js +10 -0
- package/dist/es/utils/features/features.js.map +1 -0
- package/dist/es/utils/features/initialize.d.ts +5 -0
- package/dist/es/utils/features/initialize.js +24 -0
- package/dist/es/utils/features/initialize.js.map +1 -0
- package/dist/umd/index.d.ts +19 -0
- package/dist/umd/index.js +69 -0
- package/dist/umd/index.js.map +1 -0
- package/dist/umd/types.d.ts +94 -0
- package/dist/umd/types.js +38 -0
- package/dist/umd/types.js.map +1 -0
- package/dist/umd/utils/api/api.d.ts +10 -0
- package/dist/umd/utils/api/api.js +50 -0
- package/dist/umd/utils/api/api.js.map +1 -0
- package/dist/umd/utils/config/build-configs.d.ts +6 -0
- package/dist/umd/utils/config/build-configs.js +78 -0
- package/dist/umd/utils/config/build-configs.js.map +1 -0
- package/dist/umd/utils/features/features.d.ts +5 -0
- package/dist/umd/utils/features/features.js +24 -0
- package/dist/umd/utils/features/features.js.map +1 -0
- package/dist/umd/utils/features/initialize.d.ts +5 -0
- package/dist/umd/utils/features/initialize.js +63 -0
- package/dist/umd/utils/features/initialize.js.map +1 -0
- package/dist/webpack-analysis.html +38 -0
- package/package.json +77 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NrFeatures } from "../../types";
|
|
2
|
+
import { now } from '@newrelic/browser-agent-core/common/timing/now';
|
|
3
|
+
export class Api {
|
|
4
|
+
constructor(parent) {
|
|
5
|
+
this.importedMethods = {
|
|
6
|
+
storeError: null
|
|
7
|
+
};
|
|
8
|
+
this._initialized = false;
|
|
9
|
+
this._initialized = true;
|
|
10
|
+
this._parent = parent;
|
|
11
|
+
}
|
|
12
|
+
noticeError(err, customAttributes) {
|
|
13
|
+
if (this._initialized && !!this.importedMethods.storeError) {
|
|
14
|
+
if (typeof err !== 'string' && !(err instanceof Error))
|
|
15
|
+
return invalidCall('noticeError', err, 'Error | String');
|
|
16
|
+
err = typeof err === 'string' ? new Error(err) : err;
|
|
17
|
+
const time = now();
|
|
18
|
+
const internal = false;
|
|
19
|
+
return this.importedMethods.storeError(err, time, internal, customAttributes);
|
|
20
|
+
}
|
|
21
|
+
if (!this._parent.initialized && !this.importedMethods.storeError)
|
|
22
|
+
return notInitialized(this._parent.id, NrFeatures.JSERRORS);
|
|
23
|
+
if (this._parent.initialized && !this.importedMethods.storeError)
|
|
24
|
+
return isDisabled(this._parent.id, NrFeatures.JSERRORS, 'noticeError');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function notInitialized(agentIdentifier, featureName) {
|
|
28
|
+
console.warn(`Agent ${agentIdentifier} is calling a ${featureName} Feature API, but the Browser Agent has not been started... Please start the agent using .start({...opts})`);
|
|
29
|
+
}
|
|
30
|
+
function isDisabled(agentIdentifier, featureName, methodName) {
|
|
31
|
+
console.warn(`The ${featureName} Feature of agent ${agentIdentifier} Has Been Disabled. Method "${methodName}" will not do anything!`);
|
|
32
|
+
}
|
|
33
|
+
function invalidCall(methodName, argument, validType) {
|
|
34
|
+
console.warn(`"${methodName}" was called with an invalid argument: ${argument}. This method only accepts ${validType} types for that argument.`);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/utils/api/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,gDAAgD,CAAA;AAEpE,MAAM,OAAO,GAAG;IAOd,YAAY,MAAM;QANlB,oBAAe,GAAwC;YACrD,UAAU,EAAE,IAAI;SACjB,CAAA;QACO,iBAAY,GAAG,KAAK,CAAA;QAI1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAED,WAAW,CAAC,GAAmB,EAAE,gBAAyB;QAExD,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE;YAC1D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;gBAAE,OA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+1,64 @@
|
|
|
1
|
+
export function buildConfigs(options) {
|
|
2
|
+
const info = {
|
|
3
|
+
beacon: '',
|
|
4
|
+
errorBeacon: undefined,
|
|
5
|
+
licenseKey: '',
|
|
6
|
+
applicationID: '',
|
|
7
|
+
sa: undefined,
|
|
8
|
+
queueTime: undefined,
|
|
9
|
+
applicationTime: undefined,
|
|
10
|
+
ttGuid: undefined,
|
|
11
|
+
user: undefined,
|
|
12
|
+
account: undefined,
|
|
13
|
+
product: undefined,
|
|
14
|
+
extra: undefined,
|
|
15
|
+
userAttributes: undefined,
|
|
16
|
+
atts: undefined,
|
|
17
|
+
transactionName: undefined,
|
|
18
|
+
tNamePlain: undefined
|
|
19
|
+
};
|
|
20
|
+
const config = {
|
|
21
|
+
privacy: { cookies_enabled: undefined },
|
|
22
|
+
ajax: { deny_list: undefined },
|
|
23
|
+
distributed_tracing: {
|
|
24
|
+
enabled: undefined,
|
|
25
|
+
exclude_newrelic_header: undefined,
|
|
26
|
+
cors_use_newrelic_header: undefined,
|
|
27
|
+
cors_use_tracecontext_headers: undefined,
|
|
28
|
+
allowed_origins: undefined
|
|
29
|
+
},
|
|
30
|
+
page_view_timing: { enabled: undefined },
|
|
31
|
+
ssl: undefined,
|
|
32
|
+
obfuscate: undefined
|
|
33
|
+
};
|
|
34
|
+
const loader_config = {
|
|
35
|
+
accountID: undefined,
|
|
36
|
+
trustKey: undefined,
|
|
37
|
+
agentID: undefined,
|
|
38
|
+
licenseKey: '',
|
|
39
|
+
applicationID: '',
|
|
40
|
+
xpid: undefined
|
|
41
|
+
};
|
|
42
|
+
Object.keys(options).forEach(key => {
|
|
43
|
+
if (key === 'beacon') {
|
|
44
|
+
info.beacon = options[key];
|
|
45
|
+
info.errorBeacon = options[key];
|
|
46
|
+
}
|
|
47
|
+
if (Object.keys(info).includes(key))
|
|
48
|
+
info[key] = options[key];
|
|
49
|
+
if (Object.keys(config).includes(key))
|
|
50
|
+
config[key] = options[key];
|
|
51
|
+
if (Object.keys(loader_config).includes(key))
|
|
52
|
+
loader_config[key] = options[key];
|
|
53
|
+
});
|
|
54
|
+
if (!validateInfo(info) || !validateLoaderConfig(loader_config))
|
|
55
|
+
console.warn("Missing required config data");
|
|
56
|
+
return { info, config, loader_config };
|
|
57
|
+
}
|
|
58
|
+
function validateInfo(info) {
|
|
59
|
+
return !(!info.applicationID || !info.licenseKey || !info.beacon);
|
|
60
|
+
}
|
|
61
|
+
function validateLoaderConfig(loader_config) {
|
|
62
|
+
return !(!loader_config.applicationID || !loader_config.licenseKey);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=build-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-configs.js","sourceRoot":"","sources":["../../../../src/utils/config/build-configs.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,OAAkB;IAC7C,MAAM,IAAI,GAAW;QACnB,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,SAAS;QACtB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;QACjB,EAAE,EAAE,SAAS;QACb,SAAS,EAAE,SAAS;QACpB,eAAe,EAAE,SAAS;QAC1B,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,SAAS;QAChB,cAAc,EAAE,SAAS;QACzB,IAAI,EAAE,SAAS;QACf,eAAe,EAAE,SAAS;QAC1B,UAAU,EAAE,SAAS;KACtB,CAAA;IAED,MAAM,MAAM,GAAa;QACvB,OAAO,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE;QACvC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;QAC9B,mBAAmB,EAAE;YACnB,OAAO,EAAE,SAAS;YAClB,uBAAuB,EAAE,SAAS;YAClC,wBAAwB,EAAE,SAAS;YACnC,6BAA6B,EAAE,SAAS;YACxC,eAAe,EAAE,SAAS;SAC3B;QACD,gB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AC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACnE,CAAC;AAED,SAAS,oBAAoB,CAAC,aAA6B;IACzD,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;AACrE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NrFeatures, NrFeature } from "../../types";
|
|
2
|
+
export class Features {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.errors = new NrFeature(NrFeatures.JSERRORS);
|
|
5
|
+
}
|
|
6
|
+
getEnabledFeatures() {
|
|
7
|
+
return Object.values(this).filter(feature => feature.enabled);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/utils/features/features.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,OAAO,QAAQ;IAArB;QACI,WAAM,GAAG,IAAI,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAK/C,CAAC;IAHG,kBAAkB;QACd,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjE,CAAC;CACJ"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NrFeatures } from '../../types';
|
|
2
|
+
import { Api } from '../api/api';
|
|
3
|
+
import { Features } from './features';
|
|
4
|
+
import { Aggregator } from '@newrelic/browser-agent-core/common/aggregate/aggregator';
|
|
5
|
+
export declare function initializeFeatures(agentIdentifier: string, api: Api, sharedAggregator: Aggregator, features: Features): Promise<NrFeatures[]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { NrFeatures } from '../../types';
|
|
11
|
+
export function initializeFeatures(agentIdentifier, api, sharedAggregator, features) {
|
|
12
|
+
return Promise.all(features.getEnabledFeatures().map((feature) => __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
if (feature.auto) {
|
|
14
|
+
const { Instrument } = yield import(`@newrelic/browser-agent-core/features/${feature.name}/instrument`);
|
|
15
|
+
const featureInstrumentation = new Instrument(agentIdentifier);
|
|
16
|
+
}
|
|
17
|
+
const { Aggregate } = yield import(`@newrelic/browser-agent-core/features/${feature.name}/aggregate`);
|
|
18
|
+
const featureAggregator = new Aggregate(agentIdentifier, sharedAggregator);
|
|
19
|
+
if (feature.name === NrFeatures.JSERRORS)
|
|
20
|
+
api.importedMethods.storeError = (...args) => featureAggregator.storeError(...args);
|
|
21
|
+
return feature.name;
|
|
22
|
+
})));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=initialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/utils/features/initialize.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,MAAM,UAAU,kBAAkB,CAAC,eAAuB,EAAE,GAAQ,EAAE,gBAA4B,EAAE,QAAkB;IAElH,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAAC,CAAM,OAAO,EAAC,EAAE;QACjE,IAAI,OAAO,CAAC,IAAI,EAAE;YACd,MAAM,EAAE,UAAU,EAAE,GAAwB,MAAM,MAAM,CAAC,yCAAyC,OAAO,CAAC,IAAI,aAAa,CAAC,CAAA;YAC5H,MAAM,sBAAsB,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC,CAAA;SACjE;QACD,MAAM,EAAE,SAAS,EAAE,GAAuB,MAAM,MAAM,CAAC,yCAAyC,OAAO,CAAC,IAAI,YAAY,CAAC,CAAA;QACzH,MAAM,iBAAiB,GAAG,IAAI,SAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAA;QAC1E,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,QAAQ;YAAE,GAAG,CAAC,eAAe,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAA;QAC7H,OAAO,OAAO,CAAC,IAAI,CAAA;IACvB,CAAC,CAAA,CAAC,CAAC,CAAA;AACP,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NrInfo, NrConfig, NrLoaderConfig, NrOptions } from './types';
|
|
2
|
+
import { Features } from './utils/features/features';
|
|
3
|
+
export declare class BrowserAgent {
|
|
4
|
+
private _initialized;
|
|
5
|
+
private _id;
|
|
6
|
+
private _api;
|
|
7
|
+
private _aggregator;
|
|
8
|
+
get config(): {
|
|
9
|
+
info: NrInfo;
|
|
10
|
+
config: NrConfig;
|
|
11
|
+
loader_config: NrLoaderConfig;
|
|
12
|
+
};
|
|
13
|
+
get initialized(): boolean;
|
|
14
|
+
get id(): any;
|
|
15
|
+
features: Features;
|
|
16
|
+
start: (options: NrOptions) => Promise<boolean>;
|
|
17
|
+
noticeError: (err: Error | String, customAttributes?: Object | undefined) => void;
|
|
18
|
+
}
|
|
19
|
+
export default BrowserAgent;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "@newrelic/browser-agent-core/common/config/config", "./utils/api/api", "./utils/config/build-configs", "./utils/features/features", "./utils/features/initialize", "@newrelic/browser-agent-core/common/window/nreum", "@newrelic/browser-agent-core/common/ids/unique-id", "@newrelic/browser-agent-core/common/aggregate/aggregator"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.BrowserAgent = void 0;
|
|
22
|
+
const config_1 = require("@newrelic/browser-agent-core/common/config/config");
|
|
23
|
+
const api_1 = require("./utils/api/api");
|
|
24
|
+
const build_configs_1 = require("./utils/config/build-configs");
|
|
25
|
+
const features_1 = require("./utils/features/features");
|
|
26
|
+
const initialize_1 = require("./utils/features/initialize");
|
|
27
|
+
const nreum_1 = require("@newrelic/browser-agent-core/common/window/nreum");
|
|
28
|
+
const unique_id_1 = require("@newrelic/browser-agent-core/common/ids/unique-id");
|
|
29
|
+
const aggregator_1 = require("@newrelic/browser-agent-core/common/aggregate/aggregator");
|
|
30
|
+
class BrowserAgent {
|
|
31
|
+
constructor() {
|
|
32
|
+
this._initialized = false;
|
|
33
|
+
this._id = (0, unique_id_1.generateRandomHexString)(16);
|
|
34
|
+
this._api = new api_1.Api(this);
|
|
35
|
+
this._aggregator = new aggregator_1.Aggregator({ agentIdentifier: this._id });
|
|
36
|
+
this.features = new features_1.Features();
|
|
37
|
+
this.start = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (this._initialized)
|
|
39
|
+
return false;
|
|
40
|
+
this._initialized = true;
|
|
41
|
+
const { info, config, loader_config } = (0, build_configs_1.buildConfigs)(options);
|
|
42
|
+
if (info)
|
|
43
|
+
(0, config_1.setInfo)(this._id, info);
|
|
44
|
+
if (config)
|
|
45
|
+
(0, config_1.setConfiguration)(this._id, config);
|
|
46
|
+
if (loader_config)
|
|
47
|
+
(0, config_1.setLoaderConfig)(this._id, config);
|
|
48
|
+
(0, config_1.setRuntime)(this._id, { maxBytes: 30000 });
|
|
49
|
+
const initializedFeatures = yield (0, initialize_1.initializeFeatures)(this._id, this._api, this._aggregator, this.features);
|
|
50
|
+
(0, nreum_1.gosNREUMInitializedAgents)(this._id, initializedFeatures, 'features');
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
this.noticeError = (err, customAttributes) => this._api.noticeError(err, customAttributes);
|
|
54
|
+
}
|
|
55
|
+
get config() {
|
|
56
|
+
return {
|
|
57
|
+
info: (0, config_1.getInfo)(this._id),
|
|
58
|
+
config: (0, config_1.getConfiguration)(this._id),
|
|
59
|
+
loader_config: (0, config_1.getLoaderConfig)(this._id)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
get initialized() { return this._initialized; }
|
|
63
|
+
;
|
|
64
|
+
get id() { return this._id; }
|
|
65
|
+
}
|
|
66
|
+
exports.BrowserAgent = BrowserAgent;
|
|
67
|
+
exports.default = BrowserAgent;
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;IAAA,8EAAsK;IAGtK,yCAAqC;IACrC,gEAA2D;IAC3D,wDAAoD;IACpD,4DAAgE;IAChE,4EAA4F;IAC5F,iFAA2F;IAC3F,yFAAqF;IAGrF,MAAa,YAAY;QAAzB;YACU,iBAAY,GAAG,KAAK,CAAA;YACpB,QAAG,GAAG,IAAA,mCAAuB,EAAC,EAAE,CAAC,CAAC;YAClC,SAAI,GAAG,IAAI,SAAG,CAAC,IAAI,CAAC,CAAA;YACpB,gBAAW,GAAG,IAAI,uBAAU,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;YAW5D,aAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAA;YACzB,UAAK,GAAG,CAAO,OAAkB,EAAE,EAAE;gBAC1C,IAAI,IAAI,CAAC,YAAY;oBAAE,OAAO,KAAK,CAAA;gBACnC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;gBACxB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,4BAAY,EAAC,OAAO,CAAC,CAAA;gBAC7D,IAAI,IAAI;oBAAE,IAAA,gBAAO,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;gBACjC,IAAI,MAAM;oBAAE,IAAA,yBAAgB,EAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBAC9C,IAAI,aAAa;oBAAE,IAAA,wBAAe,EAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBACpD,IAAA,mBAAU,EAAC,IAAI,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;gBAEzC,MAAM,mBAAmB,GAAG,MAAM,IAAA,+BAAkB,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;gBAE1G,IAAA,iCAAyB,EAAC,IAAI,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,CAAC,CAAA;gBAEpE,OAAO,IAAI,CAAA;YAEb,CAAC,CAAA,CAAA;YACM,gBAAW,GAAG,CAAC,GAAmB,EAAE,gBAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;QACxH,CAAC;QA3BC,IAAW,MAAM;YACf,OAAO;gBACL,IAAI,EAAE,IAAA,gBAAO,EAAC,IAAI,CAAC,GAAG,CAAC;gBACvB,MAAM,EAAE,IAAA,yBAAgB,EAAC,IAAI,CAAC,GAAG,CAAC;gBAClC,aAAa,EAAE,IAAA,wBAAe,EAAC,IAAI,CAAC,GAAG,CAAC;aACzC,CAAA;QACH,CAAC;QACD,IAAW,WAAW,KAAK,OAAO,IAAI,CAAC,YAAY,CAAA,CAAC,CAAC;QAAA,CAAC;QACtD,IAAW,EAAE,KAAK,OAAO,IAAI,CAAC,GAAG,CAAA,CAAC,CAAC;KAmBpC;IAjCD,oCAiCC;IAED,kBAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export interface NrInterface {
|
|
2
|
+
config: {
|
|
3
|
+
info: NrInfo;
|
|
4
|
+
config: NrConfig;
|
|
5
|
+
loader_config: NrLoaderConfig;
|
|
6
|
+
};
|
|
7
|
+
features: AppFeatures;
|
|
8
|
+
start: NrInitialize;
|
|
9
|
+
noticeError: NrNoticeError;
|
|
10
|
+
}
|
|
11
|
+
export declare class NrFeature {
|
|
12
|
+
name: NrFeatures;
|
|
13
|
+
private _enabled;
|
|
14
|
+
private _auto;
|
|
15
|
+
constructor(name: NrFeatures);
|
|
16
|
+
get enabled(): boolean;
|
|
17
|
+
set enabled(val: boolean);
|
|
18
|
+
get auto(): boolean;
|
|
19
|
+
set auto(val: boolean);
|
|
20
|
+
}
|
|
21
|
+
export interface AppFeatures {
|
|
22
|
+
'errors': NrFeature;
|
|
23
|
+
}
|
|
24
|
+
export interface NrOptions extends NrInfo, NrConfig, NrLoaderConfig {
|
|
25
|
+
}
|
|
26
|
+
interface NrShared {
|
|
27
|
+
applicationID?: string;
|
|
28
|
+
licenseKey?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface NrInfo extends NrShared {
|
|
31
|
+
applicationID: string;
|
|
32
|
+
licenseKey: string;
|
|
33
|
+
beacon: string;
|
|
34
|
+
errorBeacon?: string;
|
|
35
|
+
sa?: number;
|
|
36
|
+
queueTime?: number;
|
|
37
|
+
applicationTime?: number;
|
|
38
|
+
ttGuid?: string;
|
|
39
|
+
user?: string;
|
|
40
|
+
account?: string;
|
|
41
|
+
product?: string;
|
|
42
|
+
extra?: string;
|
|
43
|
+
userAttributes?: string;
|
|
44
|
+
atts?: string;
|
|
45
|
+
transactionName?: string;
|
|
46
|
+
tNamePlain?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface NrConfig {
|
|
49
|
+
privacy?: {
|
|
50
|
+
cookies_enabled?: boolean;
|
|
51
|
+
};
|
|
52
|
+
ajax?: {
|
|
53
|
+
deny_list?: string[];
|
|
54
|
+
};
|
|
55
|
+
distributed_tracing?: {
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
exclude_newrelic_header?: boolean;
|
|
58
|
+
cors_use_newrelic_header?: boolean;
|
|
59
|
+
cors_use_tracecontext_headers?: boolean;
|
|
60
|
+
allowed_origins?: string[];
|
|
61
|
+
};
|
|
62
|
+
page_view_timing?: {
|
|
63
|
+
enabled?: boolean;
|
|
64
|
+
};
|
|
65
|
+
ssl?: boolean;
|
|
66
|
+
obfuscate?: {
|
|
67
|
+
regex?: string | RegExp;
|
|
68
|
+
replacement?: string;
|
|
69
|
+
}[];
|
|
70
|
+
}
|
|
71
|
+
export interface NrLoaderConfig extends NrShared {
|
|
72
|
+
accountID?: string;
|
|
73
|
+
trustKey?: string;
|
|
74
|
+
agentID?: string;
|
|
75
|
+
xpid?: string;
|
|
76
|
+
licenseKey: string;
|
|
77
|
+
applicationID: string;
|
|
78
|
+
}
|
|
79
|
+
export declare enum NrFeatures {
|
|
80
|
+
JSERRORS = "js-errors"
|
|
81
|
+
}
|
|
82
|
+
export declare type NrStoreError = (err: Error | String, time?: Number, internal?: any, customAttributes?: any) => void;
|
|
83
|
+
export declare type NrInitialize = (opts: NrOptions) => Promise<Boolean>;
|
|
84
|
+
export declare type NrNoticeError = (err: Error | String, customAttributes: Object) => void;
|
|
85
|
+
export interface NrFeaturesWithApi {
|
|
86
|
+
[NrFeatures.JSERRORS]: {
|
|
87
|
+
noticeError: NrStoreError;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export interface NrImportPaths {
|
|
91
|
+
aggregate: string;
|
|
92
|
+
instrument: string;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NrFeatures = exports.NrFeature = void 0;
|
|
13
|
+
class NrFeature {
|
|
14
|
+
constructor(name) {
|
|
15
|
+
this.name = name;
|
|
16
|
+
this._enabled = true;
|
|
17
|
+
this._auto = true;
|
|
18
|
+
}
|
|
19
|
+
get enabled() {
|
|
20
|
+
return this._enabled;
|
|
21
|
+
}
|
|
22
|
+
set enabled(val) {
|
|
23
|
+
this._enabled = Boolean(val);
|
|
24
|
+
}
|
|
25
|
+
get auto() {
|
|
26
|
+
return this._auto;
|
|
27
|
+
}
|
|
28
|
+
set auto(val) {
|
|
29
|
+
this._auto = val;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.NrFeature = NrFeature;
|
|
33
|
+
var NrFeatures;
|
|
34
|
+
(function (NrFeatures) {
|
|
35
|
+
NrFeatures["JSERRORS"] = "js-errors";
|
|
36
|
+
})(NrFeatures = exports.NrFeatures || (exports.NrFeatures = {}));
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;IAOA,MAAa,SAAS;QAIlB,YAAmB,IAAgB;YAAhB,SAAI,GAAJ,IAAI,CAAY;YAH3B,aAAQ,GAAY,IAAI,CAAA;YACxB,UAAK,GAAY,IAAI,CAAA;QAEQ,CAAC;QAEtC,IAAI,OAAO;YACP,OAAO,IAAI,CAAC,QAAQ,CAAA;QACxB,CAAC;QAED,IAAI,OAAO,CAAC,GAAY;YACpB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAChC,CAAC;QAED,IAAI,IAAI;YACJ,OAAO,IAAI,CAAC,KAAK,CAAA;QACrB,CAAC;QAED,IAAI,IAAI,CAAC,GAAY;YACjB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;QACpB,CAAC;KACJ;IArBD,8BAqBC;IAuDD,IAAY,UAKX;IALD,WAAY,UAAU;QAClB,oCAAoB,CAAA;IAIxB,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NrStoreError } from "../../types";
|
|
2
|
+
export declare class Api {
|
|
3
|
+
importedMethods: {
|
|
4
|
+
storeError: NrStoreError | null;
|
|
5
|
+
};
|
|
6
|
+
private _initialized;
|
|
7
|
+
private _parent;
|
|
8
|
+
constructor(parent: any);
|
|
9
|
+
noticeError(err: Error | String, customAttributes?: Object): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "../../types", "@newrelic/browser-agent-core/common/timing/now"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Api = void 0;
|
|
13
|
+
const types_1 = require("../../types");
|
|
14
|
+
const now_1 = require("@newrelic/browser-agent-core/common/timing/now");
|
|
15
|
+
class Api {
|
|
16
|
+
constructor(parent) {
|
|
17
|
+
this.importedMethods = {
|
|
18
|
+
storeError: null
|
|
19
|
+
};
|
|
20
|
+
this._initialized = false;
|
|
21
|
+
this._initialized = true;
|
|
22
|
+
this._parent = parent;
|
|
23
|
+
}
|
|
24
|
+
noticeError(err, customAttributes) {
|
|
25
|
+
if (this._initialized && !!this.importedMethods.storeError) {
|
|
26
|
+
if (typeof err !== 'string' && !(err instanceof Error))
|
|
27
|
+
return invalidCall('noticeError', err, 'Error | String');
|
|
28
|
+
err = typeof err === 'string' ? new Error(err) : err;
|
|
29
|
+
const time = (0, now_1.now)();
|
|
30
|
+
const internal = false;
|
|
31
|
+
return this.importedMethods.storeError(err, time, internal, customAttributes);
|
|
32
|
+
}
|
|
33
|
+
if (!this._parent.initialized && !this.importedMethods.storeError)
|
|
34
|
+
return notInitialized(this._parent.id, types_1.NrFeatures.JSERRORS);
|
|
35
|
+
if (this._parent.initialized && !this.importedMethods.storeError)
|
|
36
|
+
return isDisabled(this._parent.id, types_1.NrFeatures.JSERRORS, 'noticeError');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Api = Api;
|
|
40
|
+
function notInitialized(agentIdentifier, featureName) {
|
|
41
|
+
console.warn(`Agent ${agentIdentifier} is calling a ${featureName} Feature API, but the Browser Agent has not been started... Please start the agent using .start({...opts})`);
|
|
42
|
+
}
|
|
43
|
+
function isDisabled(agentIdentifier, featureName, methodName) {
|
|
44
|
+
console.warn(`The ${featureName} Feature of agent ${agentIdentifier} Has Been Disabled. Method "${methodName}" will not do anything!`);
|
|
45
|
+
}
|
|
46
|
+
function invalidCall(methodName, argument, validType) {
|
|
47
|
+
console.warn(`"${methodName}" was called with an invalid argument: ${argument}. This method only accepts ${validType} types for that argument.`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/utils/api/api.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,uCAAsD;IACtD,wEAAoE;IAEpE,MAAa,GAAG;QAOd,YAAY,MAAM;YANlB,oBAAe,GAAwC;gBACrD,UAAU,EAAE,IAAI;aACjB,CAAA;YACO,iBAAY,GAAG,KAAK,CAAA;YAI1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;YACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACvB,CAAC;QAED,WAAW,CAAC,GAAmB,EAAE,gBAAyB;YAExD,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE;gBAC1D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;oBAAE,OAAO,WAAW,CAAC,aAAa,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAA;gBAEhH,GAAG,GAAG,OAA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=== "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildConfigs = void 0;
|
|
13
|
+
function buildConfigs(options) {
|
|
14
|
+
const info = {
|
|
15
|
+
beacon: '',
|
|
16
|
+
errorBeacon: undefined,
|
|
17
|
+
licenseKey: '',
|
|
18
|
+
applicationID: '',
|
|
19
|
+
sa: undefined,
|
|
20
|
+
queueTime: undefined,
|
|
21
|
+
applicationTime: undefined,
|
|
22
|
+
ttGuid: undefined,
|
|
23
|
+
user: undefined,
|
|
24
|
+
account: undefined,
|
|
25
|
+
product: undefined,
|
|
26
|
+
extra: undefined,
|
|
27
|
+
userAttributes: undefined,
|
|
28
|
+
atts: undefined,
|
|
29
|
+
transactionName: undefined,
|
|
30
|
+
tNamePlain: undefined
|
|
31
|
+
};
|
|
32
|
+
const config = {
|
|
33
|
+
privacy: { cookies_enabled: undefined },
|
|
34
|
+
ajax: { deny_list: undefined },
|
|
35
|
+
distributed_tracing: {
|
|
36
|
+
enabled: undefined,
|
|
37
|
+
exclude_newrelic_header: undefined,
|
|
38
|
+
cors_use_newrelic_header: undefined,
|
|
39
|
+
cors_use_tracecontext_headers: undefined,
|
|
40
|
+
allowed_origins: undefined
|
|
41
|
+
},
|
|
42
|
+
page_view_timing: { enabled: undefined },
|
|
43
|
+
ssl: undefined,
|
|
44
|
+
obfuscate: undefined
|
|
45
|
+
};
|
|
46
|
+
const loader_config = {
|
|
47
|
+
accountID: undefined,
|
|
48
|
+
trustKey: undefined,
|
|
49
|
+
agentID: undefined,
|
|
50
|
+
licenseKey: '',
|
|
51
|
+
applicationID: '',
|
|
52
|
+
xpid: undefined
|
|
53
|
+
};
|
|
54
|
+
Object.keys(options).forEach(key => {
|
|
55
|
+
if (key === 'beacon') {
|
|
56
|
+
info.beacon = options[key];
|
|
57
|
+
info.errorBeacon = options[key];
|
|
58
|
+
}
|
|
59
|
+
if (Object.keys(info).includes(key))
|
|
60
|
+
info[key] = options[key];
|
|
61
|
+
if (Object.keys(config).includes(key))
|
|
62
|
+
config[key] = options[key];
|
|
63
|
+
if (Object.keys(loader_config).includes(key))
|
|
64
|
+
loader_config[key] = options[key];
|
|
65
|
+
});
|
|
66
|
+
if (!validateInfo(info) || !validateLoaderConfig(loader_config))
|
|
67
|
+
console.warn("Missing required config data");
|
|
68
|
+
return { info, config, loader_config };
|
|
69
|
+
}
|
|
70
|
+
exports.buildConfigs = buildConfigs;
|
|
71
|
+
function validateInfo(info) {
|
|
72
|
+
return !(!info.applicationID || !info.licenseKey || !info.beacon);
|
|
73
|
+
}
|
|
74
|
+
function validateLoaderConfig(loader_config) {
|
|
75
|
+
return !(!loader_config.applicationID || !loader_config.licenseKey);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=build-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-configs.js","sourceRoot":"","sources":["../../../../src/utils/config/build-configs.ts"],"names":[],"mappings":";;;;;;;;;;;;IAEA,SAAgB,YAAY,CAAC,OAAkB;QAC7C,MAAM,IAAI,GAAW;YACnB,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,SAAS;YACtB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE;YACjB,EAAE,EAAE,SAAS;YACb,SAAS,EAAE,SAAS;YACpB,eAAe,EAAE,SAAS;YAC1B,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,SAAS;YAChB,cAAc,EAAE,SAAS;YACzB,IAAI,EAAE,SAAS;YACf,eAAe,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AAC;gBAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QACjF,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAA;QAC7G,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;IACxC,CAAC;IAxDD,oCAwDC;IAED,SAAS,YAAY,CAAC,IAAY;QAChC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnE,CAAC;IAED,SAAS,oBAAoB,CAAC,aAA6B;QACzD,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;IACrE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "../../types"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Features = void 0;
|
|
13
|
+
const types_1 = require("../../types");
|
|
14
|
+
class Features {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.errors = new types_1.NrFeature(types_1.NrFeatures.JSERRORS);
|
|
17
|
+
}
|
|
18
|
+
getEnabledFeatures() {
|
|
19
|
+
return Object.values(this).filter(feature => feature.enabled);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Features = Features;
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/utils/features/features.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,uCAAmD;IAEnD,MAAa,QAAQ;QAArB;YACI,WAAM,GAAG,IAAI,iBAAS,CAAC,kBAAU,CAAC,QAAQ,CAAC,CAAA;QAK/C,CAAC;QAHG,kBAAkB;YACd,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACjE,CAAC;KACJ;IAND,4BAMC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NrFeatures } from '../../types';
|
|
2
|
+
import { Api } from '../api/api';
|
|
3
|
+
import { Features } from './features';
|
|
4
|
+
import { Aggregator } from '@newrelic/browser-agent-core/common/aggregate/aggregator';
|
|
5
|
+
export declare function initializeFeatures(agentIdentifier: string, api: Api, sharedAggregator: Aggregator, features: Features): Promise<NrFeatures[]>;
|