@dynatrace/react-native-plugin 2.225.0 → 2.231.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -6
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridge.java +10 -0
- package/files/plugin.gradle +1 -1
- package/ios/DynatraceRNBridge.m +11 -0
- package/ios/lib/Dynatrace.xcframework/Info.plist +69 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_armv7/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_armv7/Dynatrace.framework/Headers/Dynatrace.h +952 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_armv7/Dynatrace.framework/Headers/Framework.h +18 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_armv7/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_armv7/Dynatrace.framework/Modules/module.modulemap +6 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_i386_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_i386_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +952 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_i386_x86_64-simulator/Dynatrace.framework/Headers/Framework.h +18 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_i386_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_i386_x86_64-simulator/Dynatrace.framework/Modules/module.modulemap +6 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_i386_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +147 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Headers/Dynatrace.h +952 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Headers/Framework.h +18 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Modules/module.modulemap +6 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +952 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Headers/Framework.h +18 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/module.modulemap +6 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +135 -0
- package/lib/community/Picker.js +33 -0
- package/lib/dynatrace-reporter.js +30 -0
- package/lib/dynatrace-transformer.js +50 -0
- package/lib/instrumentor/base/Application.js +17 -0
- package/lib/instrumentor/base/Dynatrace.js +275 -0
- package/lib/instrumentor/base/DynatraceAction.js +66 -0
- package/lib/instrumentor/base/DynatraceBridge.js +5 -0
- package/lib/instrumentor/base/ElementHelper.js +58 -0
- package/lib/instrumentor/base/ErrorHandler.js +52 -0
- package/lib/instrumentor/base/Logger.js +15 -0
- package/lib/instrumentor/base/NullAction.js +27 -0
- package/lib/instrumentor/base/Picker.js +32 -0
- package/lib/instrumentor/base/RefreshControl.js +35 -0
- package/lib/instrumentor/base/Touchable.js +103 -0
- package/lib/instrumentor/base/UserPrivacyOptions.js +22 -0
- package/lib/instrumentor/base/configuration/AutoStartupConfiguration.js +17 -0
- package/lib/instrumentor/base/configuration/Configuration.js +26 -0
- package/lib/instrumentor/base/configuration/ConfigurationDefaults.js +13 -0
- package/lib/instrumentor/base/configuration/ManualStartupConfiguration.js +34 -0
- package/lib/instrumentor/base/interface/IAutoConfiguration.js +2 -0
- package/lib/instrumentor/base/interface/IDynatrace.js +2 -0
- package/lib/instrumentor/base/interface/IDynatraceAction.js +2 -0
- package/lib/instrumentor/base/interface/IDynatraceBridge.js +2 -0
- package/lib/instrumentor/base/interface/IDynatraceProperties.js +2 -0
- package/lib/instrumentor/base/interface/ILogger.js +2 -0
- package/lib/instrumentor/base/model/DataCollectionLevel.js +11 -0
- package/lib/instrumentor/base/model/LogLevel.js +8 -0
- package/lib/instrumentor/base/model/Platform.js +9 -0
- package/lib/instrumentor/base/util/StringUtils.js +8 -0
- package/lib/instrumentor/dynatrace-instrumentation.js +1 -0
- package/lib/instrumentor/model/reference.js +2 -0
- package/lib/instrumentor/model/types.js +16 -0
- package/lib/instrumentor/parser/babel.js +63 -0
- package/lib/jsx-runtime.js +41 -0
- package/lib/metro/getSourceMapInfo.js +22 -0
- package/lib/react/Component.js +68 -0
- package/lib/react-native/RefreshControl.js +14 -0
- package/lib/react-native/Touchables.js +63 -0
- package/lib/react-native/index.js +12 -0
- package/lib/react-native.js +25 -0
- package/package.json +155 -1
- package/scripts/android.js +123 -0
- package/scripts/api/CustomArguments.js +2 -0
- package/scripts/api/CustomArgumentsBuilder.js +2 -0
- package/scripts/api/model/Platform.js +8 -0
- package/scripts/config.js +73 -0
- package/scripts/core/CustomArgumentsBuilderImpl.js +22 -0
- package/scripts/core/CustomArgumentsImpl.js +33 -0
- package/scripts/core/InstrumentCall.js +89 -0
- package/scripts/fileOperationHelper.js +184 -0
- package/scripts/install.js +47 -0
- package/scripts/instrument.js +7 -0
- package/scripts/ios.js +179 -0
- package/scripts/logger.js +79 -0
- package/scripts/pathsConstants.js +60 -0
- package/scripts/start.js +6 -0
- package/scripts/uninstall.js +80 -0
- package/scripts/util/CustomArgumentUtil.js +57 -0
- package/scripts/util/SourceMapUtil.js +30 -0
- package/scripts/util/StartUtil.js +9 -0
- package/scripts/util/instrumentUtil.js +28 -0
- package/typings/react-native-dynatrace.d.ts +6 -0
- package/util/constants.js +0 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Dynatrace-Framework.h
|
|
3
|
+
// Dynatrace-Framework
|
|
4
|
+
//
|
|
5
|
+
// Created by Neal T. Leverenz on 11/25/15.
|
|
6
|
+
// Copyright © 2015-2016 Dynatrace LLC. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <UIKit/UIKit.h>
|
|
10
|
+
|
|
11
|
+
//! Project version number for Dynatrace-Framework.
|
|
12
|
+
FOUNDATION_EXPORT double Dynatrace_FrameworkVersionNumber;
|
|
13
|
+
|
|
14
|
+
//! Project version string for Dynatrace-Framework.
|
|
15
|
+
FOUNDATION_EXPORT const unsigned char Dynatrace_FrameworkVersionString[];
|
|
16
|
+
|
|
17
|
+
// In this header, you should import all the public headers of your framework
|
|
18
|
+
#import "Dynatrace.h"
|
package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Info.plist
ADDED
|
Binary file
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>files</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Headers/Dynatrace.h</key>
|
|
8
|
+
<data>
|
|
9
|
+
08B/rXRJ/U7Nz9k76LvdO4tEMgE=
|
|
10
|
+
</data>
|
|
11
|
+
<key>Headers/Framework.h</key>
|
|
12
|
+
<data>
|
|
13
|
+
hbWCbhq55d3gxKmT0rNr7XvJlfI=
|
|
14
|
+
</data>
|
|
15
|
+
<key>Info.plist</key>
|
|
16
|
+
<data>
|
|
17
|
+
Wq/wrw+Y0oCswo169stEXV8/SGI=
|
|
18
|
+
</data>
|
|
19
|
+
<key>Modules/module.modulemap</key>
|
|
20
|
+
<data>
|
|
21
|
+
tWkPDtmIBqJPfR50Pm7FSuCb2cE=
|
|
22
|
+
</data>
|
|
23
|
+
</dict>
|
|
24
|
+
<key>files2</key>
|
|
25
|
+
<dict>
|
|
26
|
+
<key>Headers/Dynatrace.h</key>
|
|
27
|
+
<dict>
|
|
28
|
+
<key>hash2</key>
|
|
29
|
+
<data>
|
|
30
|
+
Axt48ZGCuQQp2dck/PrlAbOh2Fl5ah2qHwbet4Hb/yI=
|
|
31
|
+
</data>
|
|
32
|
+
</dict>
|
|
33
|
+
<key>Headers/Framework.h</key>
|
|
34
|
+
<dict>
|
|
35
|
+
<key>hash2</key>
|
|
36
|
+
<data>
|
|
37
|
+
uATfbZu3lX8Rq+Sam+OyoFPIP1k1BAXnvNSvl18wybQ=
|
|
38
|
+
</data>
|
|
39
|
+
</dict>
|
|
40
|
+
<key>Modules/module.modulemap</key>
|
|
41
|
+
<dict>
|
|
42
|
+
<key>hash2</key>
|
|
43
|
+
<data>
|
|
44
|
+
n9MTZjyZepetf/qGDoaHk2xrIszdlK8S0NCbsZL2pNE=
|
|
45
|
+
</data>
|
|
46
|
+
</dict>
|
|
47
|
+
</dict>
|
|
48
|
+
<key>rules</key>
|
|
49
|
+
<dict>
|
|
50
|
+
<key>^.*</key>
|
|
51
|
+
<true/>
|
|
52
|
+
<key>^.*\.lproj/</key>
|
|
53
|
+
<dict>
|
|
54
|
+
<key>optional</key>
|
|
55
|
+
<true/>
|
|
56
|
+
<key>weight</key>
|
|
57
|
+
<real>1000</real>
|
|
58
|
+
</dict>
|
|
59
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
60
|
+
<dict>
|
|
61
|
+
<key>omit</key>
|
|
62
|
+
<true/>
|
|
63
|
+
<key>weight</key>
|
|
64
|
+
<real>1100</real>
|
|
65
|
+
</dict>
|
|
66
|
+
<key>^Base\.lproj/</key>
|
|
67
|
+
<dict>
|
|
68
|
+
<key>weight</key>
|
|
69
|
+
<real>1010</real>
|
|
70
|
+
</dict>
|
|
71
|
+
<key>^version.plist$</key>
|
|
72
|
+
<true/>
|
|
73
|
+
</dict>
|
|
74
|
+
<key>rules2</key>
|
|
75
|
+
<dict>
|
|
76
|
+
<key>.*\.dSYM($|/)</key>
|
|
77
|
+
<dict>
|
|
78
|
+
<key>weight</key>
|
|
79
|
+
<real>11</real>
|
|
80
|
+
</dict>
|
|
81
|
+
<key>^(.*/)?\.DS_Store$</key>
|
|
82
|
+
<dict>
|
|
83
|
+
<key>omit</key>
|
|
84
|
+
<true/>
|
|
85
|
+
<key>weight</key>
|
|
86
|
+
<real>2000</real>
|
|
87
|
+
</dict>
|
|
88
|
+
<key>^.*</key>
|
|
89
|
+
<true/>
|
|
90
|
+
<key>^.*\.lproj/</key>
|
|
91
|
+
<dict>
|
|
92
|
+
<key>optional</key>
|
|
93
|
+
<true/>
|
|
94
|
+
<key>weight</key>
|
|
95
|
+
<real>1000</real>
|
|
96
|
+
</dict>
|
|
97
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
98
|
+
<dict>
|
|
99
|
+
<key>omit</key>
|
|
100
|
+
<true/>
|
|
101
|
+
<key>weight</key>
|
|
102
|
+
<real>1100</real>
|
|
103
|
+
</dict>
|
|
104
|
+
<key>^Base\.lproj/</key>
|
|
105
|
+
<dict>
|
|
106
|
+
<key>weight</key>
|
|
107
|
+
<real>1010</real>
|
|
108
|
+
</dict>
|
|
109
|
+
<key>^Info\.plist$</key>
|
|
110
|
+
<dict>
|
|
111
|
+
<key>omit</key>
|
|
112
|
+
<true/>
|
|
113
|
+
<key>weight</key>
|
|
114
|
+
<real>20</real>
|
|
115
|
+
</dict>
|
|
116
|
+
<key>^PkgInfo$</key>
|
|
117
|
+
<dict>
|
|
118
|
+
<key>omit</key>
|
|
119
|
+
<true/>
|
|
120
|
+
<key>weight</key>
|
|
121
|
+
<real>20</real>
|
|
122
|
+
</dict>
|
|
123
|
+
<key>^embedded\.provisionprofile$</key>
|
|
124
|
+
<dict>
|
|
125
|
+
<key>weight</key>
|
|
126
|
+
<real>20</real>
|
|
127
|
+
</dict>
|
|
128
|
+
<key>^version\.plist$</key>
|
|
129
|
+
<dict>
|
|
130
|
+
<key>weight</key>
|
|
131
|
+
<real>20</real>
|
|
132
|
+
</dict>
|
|
133
|
+
</dict>
|
|
134
|
+
</dict>
|
|
135
|
+
</plist>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("proxy-polyfill");
|
|
5
|
+
const types_1 = require("../instrumentor/model/types");
|
|
6
|
+
const PickerRN = require('@react-native-community/picker');
|
|
7
|
+
const dynatraceProxy = new Proxy(PickerRN, {
|
|
8
|
+
get(target, property) {
|
|
9
|
+
if (dynatraceInstrument[property] !== undefined) {
|
|
10
|
+
return dynatraceInstrument[property];
|
|
11
|
+
}
|
|
12
|
+
return target[property];
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const PickerModified = (_a = class Picker extends PickerRN.Picker {
|
|
16
|
+
},
|
|
17
|
+
_a._dtInfo = { type: types_1.Types.Picker },
|
|
18
|
+
_a);
|
|
19
|
+
let PickerModifiedIOS;
|
|
20
|
+
if (typeof PickerRN.PickerIOS === 'object') {
|
|
21
|
+
PickerModifiedIOS = Object.assign({ _dtInfo: { type: types_1.Types.Picker } }, PickerRN.PickerIOS);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
PickerModifiedIOS = (_b = class PickerIOS extends PickerRN.PickerIOS {
|
|
25
|
+
},
|
|
26
|
+
_b._dtInfo = { type: types_1.Types.Picker },
|
|
27
|
+
_b);
|
|
28
|
+
}
|
|
29
|
+
const dynatraceInstrument = {
|
|
30
|
+
Picker: PickerModified,
|
|
31
|
+
PickerIOS: PickerModifiedIOS,
|
|
32
|
+
};
|
|
33
|
+
module.exports = dynatraceProxy;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
const files = require('../scripts/fileOperationHelper');
|
|
12
|
+
const paths = require('../scripts/pathsConstants');
|
|
13
|
+
const TerminalReporter = require('metro/src/lib/TerminalReporter');
|
|
14
|
+
const { Terminal } = require('metro-core');
|
|
15
|
+
const reporter = new TerminalReporter(new Terminal(process.stdout));
|
|
16
|
+
function update(event) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (event) {
|
|
19
|
+
if (event.type === 'transform_cache_reset') {
|
|
20
|
+
try {
|
|
21
|
+
yield files.default.deleteDirectory(paths.default.getBuildPath());
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
reporter.update(event);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
module.exports.update = update;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUpstreamTransformer = exports.transform = void 0;
|
|
4
|
+
const instrumentor = require("./instrumentor/dynatrace-instrumentation");
|
|
5
|
+
const pathsConstants_1 = require("../scripts/pathsConstants");
|
|
6
|
+
const config = require("../scripts/config");
|
|
7
|
+
const logger_1 = require("../scripts/logger");
|
|
8
|
+
const nodePath = require("path");
|
|
9
|
+
const CustomArgumentUtil_1 = require("../scripts/util/CustomArgumentUtil");
|
|
10
|
+
const customArguments = CustomArgumentUtil_1.readCustomArguments();
|
|
11
|
+
function transform(src, filename, options) {
|
|
12
|
+
if (typeof src === 'object') {
|
|
13
|
+
({ src, filename, options } = src);
|
|
14
|
+
}
|
|
15
|
+
let reactOptions = undefined;
|
|
16
|
+
try {
|
|
17
|
+
if (customArguments.isCustomConfigurationPathSet()) {
|
|
18
|
+
reactOptions = config.readConfig(nodePath.join(pathsConstants_1.default.getApplicationPath(), customArguments.getCustomConfigurationPath()));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
reactOptions = config.readConfig(nodePath.join(pathsConstants_1.default.getConfigFilePath()));
|
|
22
|
+
}
|
|
23
|
+
src = instrumentor.instrument(src, filename, reactOptions.react);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
if (e.message === config.ERROR_CONFIG_NOT_AVAILABLE) {
|
|
27
|
+
console.log('dynatrace.config.js not found!');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log("Couldn't instrument file: " + filename);
|
|
31
|
+
logger_1.default.logErrorSync(e.message);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return getUpstreamTransformer(reactOptions === null || reactOptions === void 0 ? void 0 : reactOptions.react).transform({
|
|
35
|
+
src,
|
|
36
|
+
filename,
|
|
37
|
+
options,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.transform = transform;
|
|
41
|
+
function getUpstreamTransformer(reactOptions) {
|
|
42
|
+
if (reactOptions !== undefined &&
|
|
43
|
+
reactOptions.upstreamTransformer !== undefined) {
|
|
44
|
+
return require(reactOptions.upstreamTransformer);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return require('metro-react-native-babel-transformer/src/index');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.getUpstreamTransformer = getUpstreamTransformer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationHandler = void 0;
|
|
4
|
+
const ErrorHandler_1 = require("./ErrorHandler");
|
|
5
|
+
const Dynatrace_1 = require("./Dynatrace");
|
|
6
|
+
const Configuration_1 = require("./configuration/Configuration");
|
|
7
|
+
const Logger_1 = require("./Logger");
|
|
8
|
+
exports.ApplicationHandler = {
|
|
9
|
+
startup() {
|
|
10
|
+
if (!Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
11
|
+
Logger_1.Logger.logDebug('Configuration set: ' +
|
|
12
|
+
JSON.stringify(Configuration_1.Configuration.loadConfiguration()));
|
|
13
|
+
ErrorHandler_1.ErrorHandler(Dynatrace_1.Dynatrace, Logger_1.Logger).registerErrorHandler();
|
|
14
|
+
Logger_1.Logger.logInfo('Dynatrace React Native Plugin started!');
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Dynatrace = void 0;
|
|
13
|
+
const StringUtils_1 = require("./util/StringUtils");
|
|
14
|
+
const DynatraceAction_1 = require("./DynatraceAction");
|
|
15
|
+
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
16
|
+
const NullAction_1 = require("./NullAction");
|
|
17
|
+
const DataCollectionLevel_1 = require("./model/DataCollectionLevel");
|
|
18
|
+
const UserPrivacyOptions_1 = require("./UserPrivacyOptions");
|
|
19
|
+
const Logger_1 = require("./Logger");
|
|
20
|
+
const Configuration_1 = require("./configuration/Configuration");
|
|
21
|
+
const ErrorHandler_1 = require("./ErrorHandler");
|
|
22
|
+
const types_1 = require("../model/types");
|
|
23
|
+
let counter = 0;
|
|
24
|
+
function getCounter() {
|
|
25
|
+
return counter++;
|
|
26
|
+
}
|
|
27
|
+
exports.Dynatrace = {
|
|
28
|
+
start(configuration) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (!Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
31
|
+
if (configuration != undefined) {
|
|
32
|
+
yield DynatraceBridge_1.DynatraceNative.start(configuration);
|
|
33
|
+
if (configuration.reportCrash) {
|
|
34
|
+
ErrorHandler_1.ErrorHandler(exports.Dynatrace, Logger_1.Logger).registerErrorHandler();
|
|
35
|
+
}
|
|
36
|
+
Configuration_1.Configuration.setConfiguration(configuration);
|
|
37
|
+
Logger_1.Logger.logDebug('Manual Configuration set: ' + JSON.stringify(configuration));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new Error('Configuration is empty! Not allowed for Manual Startup!');
|
|
41
|
+
}
|
|
42
|
+
Logger_1.Logger.logInfo('Dynatrace React Native Plugin started!');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
withMonitoring(Component, name) {
|
|
47
|
+
if (Component) {
|
|
48
|
+
if (Component.prototype != undefined && Component.prototype.isReactComponent != undefined) {
|
|
49
|
+
Component._dtInfo = {
|
|
50
|
+
type: types_1.Types.ClassComponent,
|
|
51
|
+
name: name
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
Component._dtInfo = {
|
|
56
|
+
type: types_1.Types.FunctionalComponent,
|
|
57
|
+
name: name
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return Component;
|
|
62
|
+
},
|
|
63
|
+
enterAction(name, platform) {
|
|
64
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
65
|
+
const key = getCounter();
|
|
66
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(name)) {
|
|
67
|
+
DynatraceBridge_1.DynatraceNative.enterAction(name, key, platform);
|
|
68
|
+
Logger_1.Logger.logDebug(`Enter Action - ${name}`);
|
|
69
|
+
return new DynatraceAction_1.DynatraceAction(key, name);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
Logger_1.Logger.logDebug('Action Name was empty or null! Action will have no effect.');
|
|
73
|
+
return new NullAction_1.NullAction();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
Logger_1.Logger.logInfo("React Native plugin has not been started yet! Action can't be created!");
|
|
78
|
+
return new NullAction_1.NullAction();
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
reportError(errorName, errorCode, platform) {
|
|
82
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
83
|
+
DynatraceBridge_1.DynatraceNative.reportErrorWithoutStacktrace(errorName, errorCode, platform);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Error will not be reported!');
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
reportErrorFromHandler(isFatal, errorName, reason, stacktrace, platform) {
|
|
90
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
91
|
+
const reasonNewLineIndex = reason.indexOf('\n');
|
|
92
|
+
if (reasonNewLineIndex != -1) {
|
|
93
|
+
reason = reason.substring(0, reasonNewLineIndex);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (isFatal) {
|
|
97
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, platform);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
reportErrorWithStacktrace(errorName, reason, stacktrace, platform) {
|
|
104
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
105
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
106
|
+
const reasonNewLineIndex = reason.indexOf('\n');
|
|
107
|
+
if (reasonNewLineIndex != -1) {
|
|
108
|
+
reason = reason.substring(0, reasonNewLineIndex);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Error will not be reported!');
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
reportErrorStacktrace(errorName, errorValue, reason, stacktrace, platform) {
|
|
118
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
119
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
120
|
+
const reasonNewLineIndex = reason.indexOf('\n');
|
|
121
|
+
if (reasonNewLineIndex != -1) {
|
|
122
|
+
reason = reason.substring(0, reasonNewLineIndex);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
DynatraceBridge_1.DynatraceNative.reportError(errorName, errorValue, reason, stacktrace, platform);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Error will not be reported!');
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
reportCrash(crashName, reason, stacktrace, platform) {
|
|
132
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
133
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(crashName)) {
|
|
134
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
135
|
+
const reasonNewLineIndex = reason.indexOf('\n');
|
|
136
|
+
if (reasonNewLineIndex != -1) {
|
|
137
|
+
reason = reason.substring(0, reasonNewLineIndex);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, reason, stacktrace, false, platform);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Crash will not be reported!');
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
reportCrashWithException(crashName, crash, platform) {
|
|
148
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
149
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(crashName) &&
|
|
150
|
+
!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(crash.stack)) {
|
|
151
|
+
let crashReason = crash.message;
|
|
152
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(crashReason)) {
|
|
153
|
+
const reasonNewLineIndex = crashReason.indexOf('\n');
|
|
154
|
+
if (reasonNewLineIndex != -1) {
|
|
155
|
+
crashReason = crashReason.substring(0, reasonNewLineIndex);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, crashReason, crash.stack, true, platform);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Crash will not be reported!');
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
endSession(platform) {
|
|
166
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
167
|
+
DynatraceBridge_1.DynatraceNative.endVisit(platform);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Session will not be ended!');
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
identifyUser(user, platform) {
|
|
174
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
175
|
+
DynatraceBridge_1.DynatraceNative.identifyUser(user, platform);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Session will not be tagged!');
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
setGPSLocation(latitude, longitude, platform) {
|
|
182
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
183
|
+
DynatraceBridge_1.DynatraceNative.setGPSLocation(latitude, longitude, platform);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! GPS Position will not be set!');
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
isCrashReportingOptedIn(platform) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
192
|
+
return yield DynatraceBridge_1.DynatraceNative.isCrashReportingOptedIn(platform);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Crash reporting value not available!');
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
setCrashReportingOptedIn(crashReporting, platform) {
|
|
201
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
202
|
+
DynatraceBridge_1.DynatraceNative.setCrashReportingOptedIn(crashReporting, platform);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Crash reporting value will not be set!');
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
getDataCollectionLevel(platform) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
211
|
+
return yield DynatraceBridge_1.DynatraceNative.getDataCollectionLevel(platform);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Data Collection level not available!');
|
|
215
|
+
return DataCollectionLevel_1.DataCollectionLevel.Off;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
setDataCollectionLevel(dataCollectionLevel, platform) {
|
|
220
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
221
|
+
DynatraceBridge_1.DynatraceNative.setDataCollectionLevel(dataCollectionLevel, platform);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Data Collection level will not be set!');
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
getUserPrivacyOptions(platform) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
230
|
+
const options = yield DynatraceBridge_1.DynatraceNative.getUserPrivacyOptions(platform);
|
|
231
|
+
const currentOptions = new UserPrivacyOptions_1.UserPrivacyOptions(options.dataCollectionLevel, options.crashReportingOptedIn);
|
|
232
|
+
return currentOptions;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! User Privacy Options are not available!');
|
|
236
|
+
return new UserPrivacyOptions_1.UserPrivacyOptions(DataCollectionLevel_1.DataCollectionLevel.Off, false);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
applyUserPrivacyOptions(userPrivacyOptions, platform) {
|
|
241
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
242
|
+
if ((userPrivacyOptions.crashReportingOptedIn === true ||
|
|
243
|
+
userPrivacyOptions.crashReportingOptedIn === false) &&
|
|
244
|
+
userPrivacyOptions.dataCollectionLevel in DataCollectionLevel_1.DataCollectionLevel) {
|
|
245
|
+
DynatraceBridge_1.DynatraceNative.applyUserPrivacyOptions(userPrivacyOptions, platform);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
Logger_1.Logger.logInfo("React Native plugin has not been started yet! User Privacy Options can't be applied!");
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
flushEvents(platform) {
|
|
253
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
254
|
+
DynatraceBridge_1.DynatraceNative.flushEvents(platform);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Flushing Event not possible!');
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
setBeaconHeaders(headers, platform) {
|
|
261
|
+
if (Configuration_1.Configuration.isConfigurationAvailable()) {
|
|
262
|
+
if (headers && headers.size > 0) {
|
|
263
|
+
const obj = {};
|
|
264
|
+
headers.forEach((value, key) => (obj[key] = value));
|
|
265
|
+
DynatraceBridge_1.DynatraceNative.setBeaconHeaders(obj, platform);
|
|
266
|
+
}
|
|
267
|
+
else if (!headers || typeof headers !== 'undefined') {
|
|
268
|
+
DynatraceBridge_1.DynatraceNative.setBeaconHeaders(null, platform);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
Logger_1.Logger.logInfo('React Native plugin has not been started yet! Setting Beacon Headers is not possible!');
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynatraceAction = void 0;
|
|
4
|
+
const StringUtils_1 = require("./util/StringUtils");
|
|
5
|
+
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
6
|
+
const Logger_1 = require("./Logger");
|
|
7
|
+
class DynatraceAction {
|
|
8
|
+
constructor(key, name) {
|
|
9
|
+
this.key = key;
|
|
10
|
+
this.name = name;
|
|
11
|
+
}
|
|
12
|
+
reportError(errorName, errorCode, platform) {
|
|
13
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(errorName)) {
|
|
14
|
+
DynatraceBridge_1.DynatraceNative.reportErrorInAction(this.key, errorName, errorCode, platform);
|
|
15
|
+
Logger_1.Logger.logDebug(`Report Error ${errorName} of ${errorCode} in Action - ${this.name}`);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
Logger_1.Logger.logDebug(`Report Error not working because of invalid errorName: ${errorName}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
reportEvent(eventName, platform) {
|
|
22
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(eventName)) {
|
|
23
|
+
DynatraceBridge_1.DynatraceNative.reportEventInAction(this.key, eventName, platform);
|
|
24
|
+
Logger_1.Logger.logDebug(`Report Event ${eventName} in Action - ${this.name}`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
Logger_1.Logger.logDebug(`Report Event not working because of invalid eventName: ${eventName}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
reportStringValue(valueName, value, platform) {
|
|
31
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
|
|
32
|
+
DynatraceBridge_1.DynatraceNative.reportStringValueInAction(this.key, valueName, value, platform);
|
|
33
|
+
Logger_1.Logger.logDebug(`Report Value ${valueName} of ${value} in Action - ${this.name}`);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
Logger_1.Logger.logDebug(`Report Value not working because of invalid valueName: ${valueName}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
reportIntValue(valueName, value, platform) {
|
|
40
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
|
|
41
|
+
DynatraceBridge_1.DynatraceNative.reportIntValueInAction(this.key, valueName, value, platform);
|
|
42
|
+
Logger_1.Logger.logDebug(`Report Value ${valueName} of ${value} in Action - ${this.name}`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
Logger_1.Logger.logDebug(`Report Value not working because of invalid valueName: ${valueName}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
reportDoubleValue(valueName, value, platform) {
|
|
49
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
|
|
50
|
+
DynatraceBridge_1.DynatraceNative.reportDoubleValueInAction(this.key, valueName, value, platform);
|
|
51
|
+
Logger_1.Logger.logDebug(`Report Value ${valueName} of ${value} in Action - ${this.name}`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
Logger_1.Logger.logDebug(`Report Value not working because of invalid valueName: ${valueName}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
leaveAction(platform) {
|
|
58
|
+
DynatraceBridge_1.DynatraceNative.leaveAction(this.key, platform);
|
|
59
|
+
Logger_1.Logger.logDebug(`Leave Action - ${this.name}`);
|
|
60
|
+
}
|
|
61
|
+
cancel(platform) {
|
|
62
|
+
DynatraceBridge_1.DynatraceNative.cancelAction(this.key, platform);
|
|
63
|
+
Logger_1.Logger.logDebug(`Cancel Action - ${this.name}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.DynatraceAction = DynatraceAction;
|