@dynatrace/cordova-plugin 1.259.2 → 1.261.2

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.
Files changed (39) hide show
  1. package/README.md +30 -3
  2. package/files/iOS/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Dynatrace +0 -0
  3. package/files/iOS/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  4. package/files/iOS/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Info.plist +0 -0
  5. package/files/iOS/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  6. package/files/iOS/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
  7. package/files/iOS/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  8. package/files/iOS/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
  9. package/files/iOS/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  10. package/files/iOS/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  11. package/files/iOS/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +11 -11
  12. package/files/iOS/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Dynatrace +0 -0
  13. package/files/iOS/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  14. package/files/iOS/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Info.plist +0 -0
  15. package/files/iOS/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos.swiftsourceinfo +0 -0
  16. package/files/iOS/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
  17. package/files/iOS/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  18. package/files/iOS/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
  19. package/files/iOS/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos-simulator.swiftsourceinfo +0 -0
  20. package/files/iOS/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/x86_64-apple-tvos-simulator.swiftsourceinfo +0 -0
  21. package/files/iOS/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +11 -11
  22. package/files/plugin.gradle +1 -1
  23. package/package.json +4 -6
  24. package/plugin.xml +2 -2
  25. package/scripts/Android.js +8 -3
  26. package/scripts/Ios.js +2 -4
  27. package/scripts/config/ConfigurationUtil.js +7 -14
  28. package/scripts/config/javascript/JavaScriptAgentConfiguration.js +5 -1
  29. package/scripts/config/javascript/JavaScriptAgentConfigurationBuilder.js +6 -1
  30. package/scripts/doctor/DoctorAnalyzer.js +2 -1
  31. package/scripts/helpers/FileHelper.js +7 -30
  32. package/scripts/helpers/InstallHelper.js +42 -52
  33. package/scripts/helpers/InstrumentHelper.js +65 -74
  34. package/scripts/helpers/PathHelper.js +37 -97
  35. package/scripts/html/HtmlInstrumentation.js +23 -18
  36. package/scripts/html/HtmlReader.js +11 -19
  37. package/scripts/html/HtmlUtil.js +43 -15
  38. package/scripts/logger/FileLogger.js +7 -9
  39. package/scripts/utils/InstrumentUtil.js +1 -2
package/README.md CHANGED
@@ -15,6 +15,7 @@ The `dynatrace-cordova-plugin` is the old version of this plugin. Consider it de
15
15
  * SDK version 21+
16
16
  * Gradle version 6.1.1+ ([How to update?](#updating-to-gradle-6))
17
17
  * Android Gradle plugin version 4.0+
18
+ * Java 11
18
19
  * For iOS users: Minimum iOS 11
19
20
  * For JavaScript Agent: access to API of cluster
20
21
  * Node: > 14.x
@@ -23,8 +24,8 @@ The `dynatrace-cordova-plugin` is the old version of this plugin. Consider it de
23
24
 
24
25
  This agent versions are configured in this plugin:
25
26
 
26
- * iOS Agent: 8.259.1.1009
27
- * Android Agent: 8.259.1.1008
27
+ * iOS Agent: 8.261.1.1006
28
+ * Android Agent: 8.261.2.1013
28
29
  ## Quick Setup
29
30
 
30
31
  1. [Installation of the plugin](#1-installation-of-the-plugin)
@@ -46,6 +47,7 @@ This agent versions are configured in this plugin:
46
47
  * [Hybrid related configuration](#hybrid-related-configuration)
47
48
  * [JavaScript Agent configuration](#javascript-agent-configuration)
48
49
  * [JavaScript Agent Snippet Mode](#javascript-agent-snippet-mode)
50
+ * [HTML Instrumentation Requirements](#html-instrumentation-requirements)
49
51
  * [Allow any certificate](#allow-any-certificate)
50
52
  * [Manual instrumentation](#manual-instrumentation)
51
53
  * [Create custom action](#create-custom-action)
@@ -260,10 +262,11 @@ module.exports = {
260
262
 
261
263
  ## JavaScript Agent configuration
262
264
 
263
- Basically all needed properties for the JavaScript Agent are predefined by the downloadable `dynatrace.config.js`. There are three available properties:
265
+ Basically all needed properties for the JavaScript Agent are predefined by the downloadable `dynatrace.config.js`. There are four available properties:
264
266
  * `url` - Dynatrace API url to retrieve the JS agent script tag.
265
267
  * `mode` - Values can be numbers 0-4 depending on what JavaScript Agent code snippet you want to use.
266
268
  * `allowanycert` - Allows the plugin to ignore certificate issues when retrieving the JavaScript Agent.
269
+ * `htmlFiles` - A string array which allows you to specify .html files to be instrumented. **Note**: The `htmlFiles` property should only be used if you have html files that are not automatically instrumented by the plugin.
267
270
 
268
271
 
269
272
  ### JavaScript Agent Snippet Mode
@@ -291,6 +294,24 @@ The above example will use mode option 2 and retrieve the synchronous code snipp
291
294
  **Note:**
292
295
  The default url value will be used if mode is not included in the `dynatrace.config.js` file or if mode exists and the value is not valid (i.e. not a number 0 through 4).
293
296
 
297
+ ### HTML Instrumentation Requirements
298
+
299
+ When doing a build, the plugin searches through the assets folders of each platform (Android & iOS) to find suitable HTML files and instrument them. Currently, the instrumentation of an HTML file is triggered by the following patterns:
300
+
301
+ * HTML file contains a script with the src `cordova.js`
302
+ * HTML file contains an ionic tag like `ion-app` or `app-root`
303
+ * HTML files defined via dynatrace.config.js property `htmlFiles`
304
+
305
+ ```js
306
+ module.exports = {
307
+ js : {
308
+ htmlFiles : ['public/index.html']
309
+ },
310
+ }
311
+ ```
312
+
313
+ Be aware that relative paths will always be used based on the assets folder. Cordova or Capacitor will automatically sync your .html files to the assets folder of the platform used. For example, in Android this is usually `platforms/android/app/src/main/assets`.
314
+
294
315
  ### Allow any certificate
295
316
 
296
317
  If you are having an issue retrieving the JavaScript Agent and see an error message relating to a certificate:
@@ -781,6 +802,12 @@ When using Apple Pay with WKWebView, there are specific checks that WebKit (Appl
781
802
 
782
803
  ## Changelog
783
804
 
805
+ 1.261.2
806
+ * Updated Android (8.261.2.1013) & iOS Agent (8.261.1.1006)
807
+ * Fixed file not found during doctor command
808
+ * Minimum Java Version was raised to 11
809
+ * Added [htmlFiles](#html-instrumentation-requirements) to dynatrace.config.js to customize instrumented html files
810
+
784
811
  1.259.2
785
812
  * Updated Android (8.259.1.1008) & iOS Agent (8.259.1.1009)
786
813
  * Hooks using now correct script names (case sensitive)
@@ -1,5 +1,5 @@
1
1
  // Dynatrace.h
2
- // Version: 8.259.1.1009
2
+ // Version: 8.261.1.1006
3
3
  //
4
4
  // These materials contain confidential information and
5
5
  // trade secrets of Dynatrace Corporation. You shall
@@ -1,5 +1,5 @@
1
1
  // Dynatrace.h
2
- // Version: 8.259.1.1009
2
+ // Version: 8.261.1.1006
3
3
  //
4
4
  // These materials contain confidential information and
5
5
  // trade secrets of Dynatrace Corporation. You shall
@@ -10,7 +10,7 @@
10
10
  </data>
11
11
  <key>Headers/Dynatrace.h</key>
12
12
  <data>
13
- WvdtHg1tS2J7xOlne1BkkLIgCpQ=
13
+ NifilzdtOC0iZg+t3zoF5GNPJfI=
14
14
  </data>
15
15
  <key>Headers/Framework.h</key>
16
16
  <data>
@@ -18,15 +18,15 @@
18
18
  </data>
19
19
  <key>Info.plist</key>
20
20
  <data>
21
- Vr/LuUeBy0PQxAHrYF3kNLxudCk=
21
+ HC0CLtK5DMsHu0UxE7GMzr06e1w=
22
22
  </data>
23
23
  <key>Modules/Dynatrace.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
24
24
  <data>
25
- L1WJZfEEdd6rLWYaal59NJS5Ixs=
25
+ KU5TGczeOlC6vTylTnaUHP635sI=
26
26
  </data>
27
27
  <key>Modules/Dynatrace.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
28
28
  <data>
29
- uIrLOV/7LQKPKTDprHB66LqDdu8=
29
+ MGMZB5wkZzeaU8cG9aeY/3l3HYE=
30
30
  </data>
31
31
  <key>Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
32
32
  <data>
@@ -46,7 +46,7 @@
46
46
  </data>
47
47
  <key>Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
48
48
  <data>
49
- FXOCzE+RQXuDPxhupKfgFGO4ElQ=
49
+ 9e5DcO2fHmkeLcdJVL/Hn3a4DU0=
50
50
  </data>
51
51
  <key>Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
52
52
  <data>
@@ -66,7 +66,7 @@
66
66
  </data>
67
67
  <key>Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
68
68
  <data>
69
- bAJ5tzgrXNP4bxwH10ErHClUgFI=
69
+ lH1f8eC+M8AyHKC8ICpwgwb4Ewc=
70
70
  </data>
71
71
  <key>Modules/module.modulemap</key>
72
72
  <data>
@@ -86,7 +86,7 @@
86
86
  <dict>
87
87
  <key>hash2</key>
88
88
  <data>
89
- MFFWoUGl76BQ1O8HWeF0HEL2ZiKpDlvMS0gd+f9BCzE=
89
+ JCAWfTwigtxWqrL0vtxEfdixVD7MvQYbwANIDP3lI70=
90
90
  </data>
91
91
  </dict>
92
92
  <key>Headers/Framework.h</key>
@@ -100,14 +100,14 @@
100
100
  <dict>
101
101
  <key>hash2</key>
102
102
  <data>
103
- oPflhqBaPrPm09m0iqiS7+QkVRRSfTW0SvzmReG2RpA=
103
+ c3s/oqqudpNxw1ZVv7wcg+9/0wD8jriI6ARKv8SGke8=
104
104
  </data>
105
105
  </dict>
106
106
  <key>Modules/Dynatrace.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
107
107
  <dict>
108
108
  <key>hash2</key>
109
109
  <data>
110
- SXIq1LY/u3Tmkc97eL6dmCuLYc6BoH6IIkWVY7Kf2MY=
110
+ QqY9r3u4nucbNk2ymZQbLJUGc1tMwJGJlposKHZ9djw=
111
111
  </data>
112
112
  </dict>
113
113
  <key>Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
@@ -142,7 +142,7 @@
142
142
  <dict>
143
143
  <key>hash2</key>
144
144
  <data>
145
- RqqQz7RjyDIFNqK8eiN//OIb6eqW15a+aoGRbUNEnik=
145
+ taSooZYjgt0noeq6YJWpMYrwoeFRcr077WlPAmPDB2M=
146
146
  </data>
147
147
  </dict>
148
148
  <key>Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
@@ -177,7 +177,7 @@
177
177
  <dict>
178
178
  <key>hash2</key>
179
179
  <data>
180
- CdNiucJKplpcnww0HasRN84bGA3SPP2VfnzrFhqRjNs=
180
+ t5W4pxmzFsh8cmeP7eHDq+AGLJfuvxLg2/d5m4/YsBY=
181
181
  </data>
182
182
  </dict>
183
183
  <key>Modules/module.modulemap</key>
@@ -1,5 +1,5 @@
1
1
  // Dynatrace.h
2
- // Version: 8.259.1.1009
2
+ // Version: 8.261.1.1006
3
3
  //
4
4
  // These materials contain confidential information and
5
5
  // trade secrets of Dynatrace Corporation. You shall
@@ -1,5 +1,5 @@
1
1
  // Dynatrace.h
2
- // Version: 8.259.1.1009
2
+ // Version: 8.261.1.1006
3
3
  //
4
4
  // These materials contain confidential information and
5
5
  // trade secrets of Dynatrace Corporation. You shall
@@ -10,7 +10,7 @@
10
10
  </data>
11
11
  <key>Headers/Dynatrace.h</key>
12
12
  <data>
13
- WvdtHg1tS2J7xOlne1BkkLIgCpQ=
13
+ NifilzdtOC0iZg+t3zoF5GNPJfI=
14
14
  </data>
15
15
  <key>Headers/Framework.h</key>
16
16
  <data>
@@ -18,15 +18,15 @@
18
18
  </data>
19
19
  <key>Info.plist</key>
20
20
  <data>
21
- qp9fUz3hubba0qI7MOCGr+4iX5k=
21
+ a2PhhksuExssct2oEARGJDsPGGc=
22
22
  </data>
23
23
  <key>Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos-simulator.swiftsourceinfo</key>
24
24
  <data>
25
- 0IjOlmShSkILXU9QeJ/7ERG9lzA=
25
+ 1XJQn0umjQU+oy4hQlz+cxZe8Js=
26
26
  </data>
27
27
  <key>Modules/Dynatrace.swiftmodule/Project/x86_64-apple-tvos-simulator.swiftsourceinfo</key>
28
28
  <data>
29
- WT/47/eXcCQG2BfitEc2oHke4OA=
29
+ u1FyEsZ73cbB+S56hakfxWiWfTo=
30
30
  </data>
31
31
  <key>Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.abi.json</key>
32
32
  <data>
@@ -46,7 +46,7 @@
46
46
  </data>
47
47
  <key>Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.swiftmodule</key>
48
48
  <data>
49
- j8FQrJcBREE7pYKGgmflr3pfsIQ=
49
+ NB+4GThj7CtFTTK70RFAIOcBsoM=
50
50
  </data>
51
51
  <key>Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.abi.json</key>
52
52
  <data>
@@ -66,7 +66,7 @@
66
66
  </data>
67
67
  <key>Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.swiftmodule</key>
68
68
  <data>
69
- GG2jIJjQA5zhkzIy096wbvMYJg0=
69
+ QEHTIr79ri9OX9VNrdmxFp1LLUI=
70
70
  </data>
71
71
  <key>Modules/module.modulemap</key>
72
72
  <data>
@@ -86,7 +86,7 @@
86
86
  <dict>
87
87
  <key>hash2</key>
88
88
  <data>
89
- MFFWoUGl76BQ1O8HWeF0HEL2ZiKpDlvMS0gd+f9BCzE=
89
+ JCAWfTwigtxWqrL0vtxEfdixVD7MvQYbwANIDP3lI70=
90
90
  </data>
91
91
  </dict>
92
92
  <key>Headers/Framework.h</key>
@@ -100,14 +100,14 @@
100
100
  <dict>
101
101
  <key>hash2</key>
102
102
  <data>
103
- 7x/SR7jA5ykuf1f4K3AAEcZAnDyVMmMthsMFJlx8Jt8=
103
+ eE8buGeF03Nj2aoz3Z14j1zw5ysbNzg4tIt8Uxu7h3o=
104
104
  </data>
105
105
  </dict>
106
106
  <key>Modules/Dynatrace.swiftmodule/Project/x86_64-apple-tvos-simulator.swiftsourceinfo</key>
107
107
  <dict>
108
108
  <key>hash2</key>
109
109
  <data>
110
- 7b4sg36gagRVa9Ualg1BwDxWq2UEVScGbj2WjKK/3bE=
110
+ NOu9w0/H/Nud6nQxzugOIxpQFtKOFsWnEuZrqNpngbE=
111
111
  </data>
112
112
  </dict>
113
113
  <key>Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.abi.json</key>
@@ -142,7 +142,7 @@
142
142
  <dict>
143
143
  <key>hash2</key>
144
144
  <data>
145
- vWhnYNSIWwcjAgxmbpPAgYUbEFwwcDOZcB4pRERSQYQ=
145
+ 9qS8e7hdnoxLTezffYmeKqcFDrZxy6bxs2S/H90CiCQ=
146
146
  </data>
147
147
  </dict>
148
148
  <key>Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.abi.json</key>
@@ -177,7 +177,7 @@
177
177
  <dict>
178
178
  <key>hash2</key>
179
179
  <data>
180
- S2EJa2aJU6hvXaLuMuWEnON1s72p2QXso8LX5R61dQ8=
180
+ PUQHuwP6ZUMgyWEG0BSf+UBXwV7dz7nZCK943wUFd80=
181
181
  </data>
182
182
  </dict>
183
183
  <key>Modules/module.modulemap</key>
@@ -1,3 +1,3 @@
1
1
  dependencies {
2
- classpath 'com.dynatrace.tools.android:gradle-plugin:8.259.1.1008'
2
+ classpath 'com.dynatrace.tools.android:gradle-plugin:8.261.2.1013'
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/cordova-plugin",
3
- "version": "1.259.2",
3
+ "version": "1.261.2",
4
4
  "description": "This plugin gives you the ability to use the Dynatrace instrumentation in your hybrid application (Cordova, Ionic, ..). It uses the Mobile Agent, the JavaScript Agent. The Mobile Agent will give you all device specific values containing lifecycle information and the Javascript Agent will allow you to manually instrument your JavaScript/TypeScript code out of the box (Typescript definitions included). The JavaScript Agent will cover the network calls and will automatically detect them.",
5
5
  "cordova": {
6
6
  "id": "dynatrace-cordova-plugin",
@@ -34,13 +34,12 @@
34
34
  "homepage": "https://www.dynatrace.com/",
35
35
  "license": "SEE LICENSE IN LICENSE.md",
36
36
  "dependencies": {
37
- "axios": "^1.3.3",
37
+ "axios": "^1.3.4",
38
38
  "cordova-common": "^4.1.0",
39
- "jsdom": "^21.1.0",
39
+ "jsdom": "^21.1.1",
40
40
  "plist": "^3.0.6"
41
41
  },
42
42
  "devDependencies": {
43
- "@types/fs-extra": "^9.0.12",
44
43
  "@types/jest": "^29.2.0",
45
44
  "@types/jsdom": "^20.0.1",
46
45
  "@types/mock-fs": "^4.13.1",
@@ -55,9 +54,8 @@
55
54
  "eslint-plugin-prefer-arrow": "^1.2.3",
56
55
  "eslint-plugin-unicorn": "^41.0.1",
57
56
  "cordova": "^11.0.0",
58
- "fs-extra": "^10.0.0",
59
57
  "jest": "^29.2.2",
60
- "mock-fs": "^4.14.0",
58
+ "mock-fs": "^5.2.0",
61
59
  "npm-check-updates": "^12.5.8",
62
60
  "prettier": "^2.6.1",
63
61
  "shelljs": "^0.8.4",
package/plugin.xml CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
4
  id="dynatrace-cordova-plugin"
5
- version="1.259.2">
5
+ version="1.261.2">
6
6
  <name>Dynatrace</name>
7
7
  <description>Dynatrace Cordova Plugin</description>
8
8
 
@@ -41,7 +41,7 @@
41
41
  <source-file src="other/DynatraceCordovaPlugin.m"/>
42
42
  </platform>
43
43
  <platform name="android">
44
- <framework src="com.dynatrace.agent:agent-android:8.259.1.1008" />
44
+ <framework src="com.dynatrace.agent:agent-android:8.261.2.1013" />
45
45
  <source-file src="other/DynatraceCordovaPlugin.java" target-dir="src/com/dynatrace/cordova/plugin" />
46
46
 
47
47
  <config-file target="config.xml" parent="/*">
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.getGradleApplyBuildScript = exports.getGradleApplyDynatraceScript = void 0;
4
4
  var path_1 = require("path");
5
+ var fs_1 = require("fs");
5
6
  var FileHelper_1 = require("./helpers/FileHelper");
6
7
  var Logger_1 = require("./logger/Logger");
7
8
  var PathHelper_1 = require("./helpers/PathHelper");
@@ -14,11 +15,15 @@ var getGradleApplyBuildScript = function () {
14
15
  };
15
16
  exports.getGradleApplyBuildScript = getGradleApplyBuildScript;
16
17
  var instrumentAndroidPlatform = function (pathToGradle, remove) {
17
- var path = (0, FileHelper_1.checkIfFileExistsSync)(pathToGradle);
18
- if (!path.endsWith('.gradle')) {
18
+ if ((0, fs_1.existsSync)(pathToGradle)) {
19
+ if (!pathToGradle.endsWith('.gradle')) {
20
+ throw new Error("Can't find .gradle file. gradle path must also include the gradle file!");
21
+ }
22
+ changeCordovaBuildGradleFile(pathToGradle, remove);
23
+ }
24
+ else {
19
25
  throw new Error("Can't find .gradle file. gradle path must also include the gradle file!");
20
26
  }
21
- changeCordovaBuildGradleFile(path, remove);
22
27
  };
23
28
  exports.instrumentAndroidPlatform = instrumentAndroidPlatform;
24
29
  var changeCordovaBuildGradleFile = function (pathToGradle, remove) {
package/scripts/Ios.js CHANGED
@@ -49,6 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.searchForPListFile = exports.modifyPListFile = void 0;
51
51
  var path_1 = require("path");
52
+ var fs_1 = require("fs");
52
53
  var plist_1 = require("plist");
53
54
  var FileHelper_1 = require("./helpers/FileHelper");
54
55
  var Logger_1 = require("./logger/Logger");
@@ -66,10 +67,7 @@ var modifyPListFile = function (pathToPList, iosConfig, removeOnly) { return __a
66
67
  if (!pathToPList.endsWith('.plist')) {
67
68
  throw new Error("Can't find .plist file. plist path must also include the plist file!");
68
69
  }
69
- try {
70
- (0, FileHelper_1.checkIfFileExistsSync)(pathToPList);
71
- }
72
- catch (e) {
70
+ if (!(0, fs_1.existsSync)(pathToPList)) {
73
71
  throw new Error('Could not read plist file: ' + pathToPList);
74
72
  }
75
73
  _a.label = 3;
@@ -37,33 +37,26 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.checkConfiguration = void 0;
40
+ var fs_1 = require("fs");
40
41
  var FileHelper_1 = require("../helpers/FileHelper");
41
42
  var Logger_1 = require("../logger/Logger");
42
43
  var PathHelper_1 = require("../helpers/PathHelper");
43
44
  var checkConfiguration = function () { return __awaiter(void 0, void 0, void 0, function () {
44
- var pathToDynatraceConfig, e_1, defaultConfigContent;
45
+ var pathToDynatraceConfig, defaultConfigContent;
45
46
  return __generator(this, function (_a) {
46
47
  switch (_a.label) {
47
48
  case 0:
48
49
  pathToDynatraceConfig = (0, PathHelper_1.getConfigFilePath)();
49
- _a.label = 1;
50
- case 1:
51
- _a.trys.push([1, 3, , 6]);
52
- return [4, (0, FileHelper_1.checkIfFileExists)(pathToDynatraceConfig)];
53
- case 2:
54
- _a.sent();
55
- return [3, 6];
56
- case 3:
57
- e_1 = _a.sent();
50
+ if (!!(0, fs_1.existsSync)(pathToDynatraceConfig)) return [3, 3];
58
51
  return [4, (0, FileHelper_1.readTextFromFile)((0, PathHelper_1.getDefaultConfig)())];
59
- case 4:
52
+ case 1:
60
53
  defaultConfigContent = _a.sent();
61
54
  return [4, (0, FileHelper_1.writeTextToFile)(pathToDynatraceConfig, defaultConfigContent)];
62
- case 5:
55
+ case 2:
63
56
  _a.sent();
64
57
  Logger_1.Logger.getInstance().logInfo('Created dynatrace.config.js - Please insert your configuration and update the file!');
65
- return [3, 6];
66
- case 6: return [2];
58
+ _a.label = 3;
59
+ case 3: return [2];
67
60
  }
68
61
  });
69
62
  }); };
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JavaScriptAgentConfiguration = void 0;
4
4
  var JavaScriptAgentMode_1 = require("./JavaScriptAgentMode");
5
5
  var JavaScriptAgentConfiguration = (function () {
6
- function JavaScriptAgentConfiguration(agentUrl, agentMode, allowAnyCertificate) {
6
+ function JavaScriptAgentConfiguration(agentUrl, agentMode, allowAnyCertificate, htmlFiles) {
7
7
  this.agentUrl = agentUrl.replace(JavaScriptAgentMode_1.JAVA_SCRIPT_AGENT_MODE_NAMES[0], JavaScriptAgentMode_1.JAVA_SCRIPT_AGENT_MODE_NAMES[agentMode]);
8
8
  this.agentMode = agentMode;
9
9
  this.allowAnyCertificate = allowAnyCertificate;
10
+ this.htmlFiles = htmlFiles;
10
11
  }
11
12
  JavaScriptAgentConfiguration.prototype.getAgentUrl = function () {
12
13
  return this.agentUrl;
@@ -29,6 +30,9 @@ var JavaScriptAgentConfiguration = (function () {
29
30
  }
30
31
  return false;
31
32
  };
33
+ JavaScriptAgentConfiguration.prototype.getHtmlFiles = function () {
34
+ return this.htmlFiles;
35
+ };
32
36
  return JavaScriptAgentConfiguration;
33
37
  }());
34
38
  exports.JavaScriptAgentConfiguration = JavaScriptAgentConfiguration;
@@ -8,6 +8,7 @@ var JavaScriptAgentConfigurationBuilder = (function () {
8
8
  function JavaScriptAgentConfigurationBuilder(agentUrl) {
9
9
  this.agentMode = JavaScriptAgentMode_1.DEFAULT_JAVASCRIPT_AGENT_MODE;
10
10
  this.anyCertificateAllowed = JavaScriptAgentConfigurationConstants_1.DEFAULT_IS_ANY_CERTIFICATE_ALLOWED;
11
+ this.htmlFiles = [];
11
12
  this.agentUrl = this.patchIncorrectJSUrl(agentUrl);
12
13
  }
13
14
  JavaScriptAgentConfigurationBuilder.prototype.setAgentMode = function (agentMode) {
@@ -20,8 +21,12 @@ var JavaScriptAgentConfigurationBuilder = (function () {
20
21
  this.anyCertificateAllowed = anyCertificateAllowed;
21
22
  return this;
22
23
  };
24
+ JavaScriptAgentConfigurationBuilder.prototype.setHtmlFiles = function (htmlFiles) {
25
+ this.htmlFiles = htmlFiles;
26
+ return this;
27
+ };
23
28
  JavaScriptAgentConfigurationBuilder.prototype.build = function () {
24
- return new JavaScriptAgentConfiguration_1.JavaScriptAgentConfiguration(this.agentUrl, this.agentMode, this.anyCertificateAllowed);
29
+ return new JavaScriptAgentConfiguration_1.JavaScriptAgentConfiguration(this.agentUrl, this.agentMode, this.anyCertificateAllowed, this.htmlFiles);
25
30
  };
26
31
  JavaScriptAgentConfigurationBuilder.prototype.patchIncorrectJSUrl = function (url) {
27
32
  return url.replace('ApiToken=', 'Api-Token=');
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.DoctorAnalyzer = void 0;
40
+ var fs_1 = require("fs");
40
41
  var Logger_1 = require("../logger/Logger");
41
42
  var FileHelper_1 = require("../helpers/FileHelper");
42
43
  var PathHelper_1 = require("../helpers/PathHelper");
@@ -52,7 +53,7 @@ var DoctorAnalyzer = (function () {
52
53
  switch (_c.label) {
53
54
  case 0:
54
55
  _c.trys.push([0, 2, , 3]);
55
- if (!(0, FileHelper_1.checkIfFileExistsSync)((0, PathHelper_1.getLogPath)())) {
56
+ if (!(0, fs_1.existsSync)((0, PathHelper_1.getLogPath)())) {
56
57
  (0, FileHelper_1.createDirectorySync)((0, PathHelper_1.getLogPath)());
57
58
  }
58
59
  _a = FileHelper_1.writeTextToFileSync;
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getProjectBuilderAsString = exports.getDynatraceConfigAsObject = exports.getPlistAsPath = exports.isGradleAvailable = exports.isPlatformAvailable = exports.copyFileSync = exports.copyFile = exports.renameFileSync = exports.renameFile = exports.deleteFileSync = exports.deleteFile = exports.deleteDirectory = exports.createDirectorySync = exports.createDirectory = exports.writeTextToFileSync = exports.writeTextToFile = exports.readTextFromFile = exports.readTextFromFileSync = exports.checkIfFileExistsSync = exports.checkIfFileExists = exports.appendFileSync = exports.searchFileExtInDirectoryNonRecursive = exports.searchFileExtInDirectoryRecursive = exports.searchFilesInDirectoryRecursive = void 0;
39
+ exports.getProjectBuilderAsString = exports.getDynatraceConfigAsObject = exports.getPlistAsPath = exports.isGradleAvailable = exports.isPlatformAvailable = exports.copyFileSync = exports.copyFile = exports.renameFileSync = exports.renameFile = exports.deleteFileSync = exports.deleteFile = exports.deleteDirectory = exports.createDirectorySync = exports.createDirectory = exports.writeTextToFileSync = exports.writeTextToFile = exports.readTextFromFile = exports.readTextFromFileSync = exports.appendFileSync = exports.searchFileExtInDirectoryNonRecursive = exports.searchFileExtInDirectoryRecursive = exports.searchFilesInDirectoryRecursive = void 0;
40
40
  var fs_1 = require("fs");
41
41
  var path_1 = require("path");
42
42
  var Logger_1 = require("../logger/Logger");
@@ -138,24 +138,6 @@ var appendFileSync = function (file, text) {
138
138
  (0, fs_1.appendFileSync)(file, text);
139
139
  };
140
140
  exports.appendFileSync = appendFileSync;
141
- var checkIfFileExists = function (_file) { return __awaiter(void 0, void 0, void 0, function () {
142
- return __generator(this, function (_a) {
143
- return [2, new Promise(function (resolve, reject) {
144
- (0, fs_1.stat)(_file, function (err) {
145
- if (err) {
146
- reject("".concat(err, " - File doesn't exist: ").concat((0, path_1.resolve)(_file)));
147
- }
148
- resolve(_file);
149
- });
150
- })];
151
- });
152
- }); };
153
- exports.checkIfFileExists = checkIfFileExists;
154
- var checkIfFileExistsSync = function (_file) {
155
- (0, fs_1.statSync)(_file);
156
- return _file;
157
- };
158
- exports.checkIfFileExistsSync = checkIfFileExistsSync;
159
141
  var readTextFromFileSync = function (_file) { return (0, fs_1.readFileSync)(_file, 'utf8'); };
160
142
  exports.readTextFromFileSync = readTextFromFileSync;
161
143
  var readTextFromFile = function (_file) { return __awaiter(void 0, void 0, void 0, function () {
@@ -327,14 +309,11 @@ var copyFileSync = function (filePath, destPath) {
327
309
  };
328
310
  exports.copyFileSync = copyFileSync;
329
311
  var isPlatformAvailable = function (path, platform) {
330
- try {
331
- (0, exports.checkIfFileExistsSync)(path);
332
- return true;
333
- }
334
- catch (e) {
312
+ if (!(0, fs_1.existsSync)(path)) {
335
313
  Logger_1.Logger.getInstance().logWarning("".concat(platform, " Location doesn't exist - Skip ").concat(platform, " instrumentation and configuration."));
336
314
  return false;
337
315
  }
316
+ return true;
338
317
  };
339
318
  exports.isPlatformAvailable = isPlatformAvailable;
340
319
  var isGradleAvailable = function (isCap) { return isCap !== undefined && isCap
@@ -363,21 +342,19 @@ var getPlistAsPath = function (isCap) { return __awaiter(void 0, void 0, void 0,
363
342
  }); };
364
343
  exports.getPlistAsPath = getPlistAsPath;
365
344
  var getDynatraceConfigAsObject = function () {
366
- try {
367
- (0, exports.checkIfFileExistsSync)((0, PathHelper_1.getConfigFilePath)());
345
+ if ((0, fs_1.existsSync)((0, PathHelper_1.getConfigFilePath)())) {
368
346
  return require((0, PathHelper_1.getConfigFilePath)());
369
347
  }
370
- catch (e) {
348
+ else {
371
349
  return undefined;
372
350
  }
373
351
  };
374
352
  exports.getDynatraceConfigAsObject = getDynatraceConfigAsObject;
375
353
  var getProjectBuilderAsString = function () {
376
- try {
377
- (0, exports.checkIfFileExistsSync)((0, PathHelper_1.getAndroidGradleVersion)());
354
+ if ((0, fs_1.existsSync)((0, PathHelper_1.getAndroidGradleVersion)())) {
378
355
  return (0, exports.readTextFromFileSync)((0, PathHelper_1.getAndroidGradleVersion)());
379
356
  }
380
- catch (e) {
357
+ else {
381
358
  return undefined;
382
359
  }
383
360
  };