@dynatrace/cordova-plugin
Advanced tools
Comparing version 2.295.1 to 2.297.1
@@ -575,3 +575,3 @@ { | ||
{ | ||
"filePath": "\/opt\/jenkins\/workspace\/eAgent_ios-agent_release_8.295.x\/adk\/DynatraceUEM\/Dynatrace\/SwiftUIExtensions.swift", | ||
"filePath": "\/opt\/jenkins\/workspace\/eAgent_ios-agent_release_8.297.x\/adk\/DynatraceUEM\/Dynatrace\/SwiftUIExtensions.swift", | ||
"kind": "BooleanLiteral", | ||
@@ -578,0 +578,0 @@ "offset": 1277, |
@@ -575,3 +575,3 @@ { | ||
{ | ||
"filePath": "\/opt\/jenkins\/workspace\/eAgent_ios-agent_release_8.295.x\/adk\/DynatraceUEM\/Dynatrace\/SwiftUIExtensions.swift", | ||
"filePath": "\/opt\/jenkins\/workspace\/eAgent_ios-agent_release_8.297.x\/adk\/DynatraceUEM\/Dynatrace\/SwiftUIExtensions.swift", | ||
"kind": "BooleanLiteral", | ||
@@ -578,0 +578,0 @@ "offset": 1277, |
@@ -575,3 +575,3 @@ { | ||
{ | ||
"filePath": "\/opt\/jenkins\/workspace\/eAgent_ios-agent_release_8.295.x\/adk\/DynatraceUEM\/Dynatrace\/SwiftUIExtensions.swift", | ||
"filePath": "\/opt\/jenkins\/workspace\/eAgent_ios-agent_release_8.297.x\/adk\/DynatraceUEM\/Dynatrace\/SwiftUIExtensions.swift", | ||
"kind": "BooleanLiteral", | ||
@@ -578,0 +578,0 @@ "offset": 1277, |
{ | ||
"name": "@dynatrace/cordova-plugin", | ||
"version": "2.295.1", | ||
"version": "2.297.1", | ||
"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.", | ||
@@ -40,4 +40,4 @@ "cordova": { | ||
"dependencies": { | ||
"axios": "^1.7.2", | ||
"jsdom": "^24.1.0", | ||
"axios": "^1.7.5", | ||
"jsdom": "^22.1.0", | ||
"plist": "^3.1.0" | ||
@@ -44,0 +44,0 @@ }, |
@@ -34,4 +34,4 @@ [![N|Solid](https://assets.dynatrace.com/content/dam/dynatrace/misc/dynatrace_web.png)](https://dynatrace.com) | ||
* Android Agent: 8.295.1.1006 | ||
* iOS Agent: 8.295.1.1020 | ||
* Android Agent: 8.297.1.1003 | ||
* iOS Agent: 8.297.1.1004 | ||
@@ -53,2 +53,3 @@ ## Quick Setup | ||
* [Cookie Proxy](#cookie-proxy) | ||
* [Capacitor Cookie Proxy](#capacitor-cookie-proxy) | ||
* [JS Agent Path](#js-agent-path) | ||
@@ -86,2 +87,3 @@ * [Gradle Path](#gradle-path) | ||
* [Doctor Dynatrace](#doctor-dynatrace) | ||
* [Instrumentation Overhead](#instrumentation-overhead) | ||
* [Troubleshooting and current restrictions](#troubleshooting-and-current-restrictions) | ||
@@ -206,3 +208,3 @@ * [iOS Session Correlation issues](#ios-session-correlation-issues) | ||
Issues with cookies are somehow a persistent companion in Ionic or Capacitor applications. Therefor we provide a proxy script which is wrapping the document.cookie API and are storing the cookies which are important for the Dynatrace Agents in the session storage. Of course this wrapping is still calling the original API. | ||
Issues with cookies are somehow a persistent companion in Ionic or Capacitor applications. Therefor we provide a proxy script which is wrapping the document.cookie API and are storing the cookies which are important for the Dynatrace Agents in the session storage. Of course this wrapping is still calling the original API. Please see the [Capacitor Cookie Proxy](#capacitor-cookie-proxy) section below if you are using `CapacitorCookies` in your application. If not, please see the configuration below. | ||
@@ -222,2 +224,20 @@ Per default the cookie proxy is turned off. To make use of this proxy you need to enable it in the cordova configuration in the dynatrace.config.js: | ||
### Capacitor Cookie Proxy | ||
If you are using `CapacitorCookies` in your capacitor application, we have added another proxy option that includes the logic used with `CapacitorCookies`. To use this option, you will need to set `CapacitorCookies` to false in your capacitor configuration and then add the following option in your `dynatrace.config.js` file: | ||
```js | ||
module.exports = { | ||
cordova : { | ||
capacitorCookieProxy: true | ||
}, | ||
... | ||
} | ||
``` | ||
If you are not using `CapacitorCookies` in your application, please be sure to follow the steps in the [Cookie Proxy](#cookie-proxy) section instead. | ||
**NOTE:** | ||
If `CapacitorCookies` is set to true, we will not inject our proxy as there have been issues when using both `CapacitorCookies` and our proxy at the same time. Also, if you have both `cookieProxy` and `capacitorCookieProxy` set to true while `CapacitorCookies` is set to false, we will add the capacitor cookie proxy. | ||
### JS Agent Path | ||
@@ -832,2 +852,15 @@ | ||
## Instrumentation Overhead | ||
When using auto-instrumenation through our plugin, here are some examples of the size differences before and after instrumentation for release builds: | ||
| Built with | App template | Version | Size Before | Size After | Difference | | ||
|----------------------|-------------------------|-------------|-----------------|----------------|----------------| | ||
| Cordova - Android | cordova-app-hello-world | 13.0.0 | 2.4 MB | 2.6 MB | 0.2 MB | | ||
| Cordova - iOS | cordova-app-hello-world | 7.1.0 | 749 KB | 9.1 MB | 8.35 MB | | ||
| Ionic - Android | Tabs | 13.0.0 | 3.4 MB | 3.5 MB | 0.1 MB | | ||
| Ionic - iOS | Tabs | 7.1.0 | 3.8 MB | 12.2 MB | 8.4 MB | | ||
| Capacitor - Android | ionic-conference-app | 4.6.3 | 16.2 MB | 16.3 MB | 0.1 MB | | ||
| Capacitor - iOS | ionic-conference-app | 4.6.3 | 33.2 MB | 37.4 MB | 4.2 MB | | ||
## Troubleshooting and current restrictions | ||
@@ -864,2 +897,7 @@ **Note:** | ||
2.297.1 | ||
* Updated Android (8.297.1.1003) & iOS Agent (8.297.1.1004) | ||
* Added [Instrumentation Overhead](#instrumentation-overhead) section | ||
* Added [Capacitor Cookie Proxy](#capacitor-cookie-proxy) option for when `CapacitorCookies` is needed | ||
2.295.1 | ||
@@ -866,0 +904,0 @@ * Updated Android (8.295.1.1006) & iOS Agent (8.295.1.1020) |
@@ -40,2 +40,3 @@ "use strict"; | ||
cordovaConfigurationBuilder.setCookieProxy(Boolean(rawConfig.cordova.cookieProxy)); | ||
cordovaConfigurationBuilder.setCapacitorCookieProxy(Boolean(rawConfig.cordova.capacitorCookieProxy)); | ||
cordovaConfigurationBuilder.setJsAgentPath((0, PluginUtil_1.sanitizePath)(rawConfig.cordova.jsAgentPath)); | ||
@@ -42,0 +43,0 @@ cordovaConfigurationBuilder.setGradlePath((0, PluginUtil_1.sanitizePath)(rawConfig.cordova.gradlePath)); |
@@ -5,5 +5,6 @@ "use strict"; | ||
var CordovaPluginConfiguration = (function () { | ||
function CordovaPluginConfiguration(debugEnabled, cookieProxy, cspUrl, jsAgentPath, gradlePath, plistPath) { | ||
function CordovaPluginConfiguration(debugEnabled, cookieProxy, capacitorCookieProxy, cspUrl, jsAgentPath, gradlePath, plistPath) { | ||
this.debugEnabled = debugEnabled; | ||
this.cookieProxy = cookieProxy; | ||
this.capacitorCookieProxy = capacitorCookieProxy; | ||
this.cspUrl = cspUrl; | ||
@@ -26,2 +27,5 @@ this.jsAgentPath = jsAgentPath; | ||
}; | ||
CordovaPluginConfiguration.prototype.isCapacitorCookieProxyEnabled = function () { | ||
return this.capacitorCookieProxy; | ||
}; | ||
CordovaPluginConfiguration.prototype.isJsAgentPathAvailable = function () { | ||
@@ -28,0 +32,0 @@ return this.jsAgentPath !== undefined; |
@@ -10,2 +10,3 @@ "use strict"; | ||
this.cookieProxy = CordovaPluginConfigurationConstants_1.DEFAULT_COOKIE_PROXY; | ||
this.capacitorCookieProxy = CordovaPluginConfigurationConstants_1.DEFAULT_CAPACITOR_COOKIE_PROXY; | ||
} | ||
@@ -24,2 +25,6 @@ CordovaPluginConfigurationBuilder.prototype.setDebugMode = function (debug) { | ||
}; | ||
CordovaPluginConfigurationBuilder.prototype.setCapacitorCookieProxy = function (capacitorCookieProxy) { | ||
this.capacitorCookieProxy = capacitorCookieProxy; | ||
return this; | ||
}; | ||
CordovaPluginConfigurationBuilder.prototype.setJsAgentPath = function (jsAgentPath) { | ||
@@ -38,3 +43,3 @@ this.jsAgentPath = jsAgentPath; | ||
CordovaPluginConfigurationBuilder.prototype.build = function () { | ||
return new CordovaPluginConfiguration_1.CordovaPluginConfiguration(this.debug, this.cookieProxy, this.cspUrl, this.jsAgentPath, this.gradlePath, this.plistPath); | ||
return new CordovaPluginConfiguration_1.CordovaPluginConfiguration(this.debug, this.cookieProxy, this.capacitorCookieProxy, this.cspUrl, this.jsAgentPath, this.gradlePath, this.plistPath); | ||
}; | ||
@@ -41,0 +46,0 @@ return CordovaPluginConfigurationBuilder; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_COOKIE_PROXY = exports.DEFAULT_DEBUG_MODE = void 0; | ||
exports.DEFAULT_CAPACITOR_COOKIE_PROXY = exports.DEFAULT_COOKIE_PROXY = exports.DEFAULT_DEBUG_MODE = void 0; | ||
exports.DEFAULT_DEBUG_MODE = false; | ||
exports.DEFAULT_COOKIE_PROXY = false; | ||
exports.DEFAULT_CAPACITOR_COOKIE_PROXY = false; |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.instrument = exports.parseCommandLine = exports.CONFIG_JSAGENT_FILE = exports.CONFIG_FILE = exports.CONFIG_PLIST_FILE = exports.CONFIG_GRADLE_FILE = void 0; | ||
exports.instrument = exports.cookieProxyToInject = exports.isCapacitorCookiesEnabled = exports.parseCommandLine = exports.CONFIG_JSAGENT_FILE = exports.CONFIG_FILE = exports.CONFIG_PLIST_FILE = exports.CONFIG_GRADLE_FILE = void 0; | ||
var path_1 = require("path"); | ||
@@ -57,2 +57,3 @@ var Android_1 = require("../Android"); | ||
var instrumentHelper = require("./InstrumentHelper"); | ||
var HtmlConstants_1 = require("../html/HtmlConstants"); | ||
exports.CONFIG_GRADLE_FILE = '--gradle'; | ||
@@ -86,6 +87,59 @@ exports.CONFIG_PLIST_FILE = '--plist'; | ||
exports.parseCommandLine = parseCommandLine; | ||
function isCapacitorCookiesEnabled(path) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var capConfigContent, _a, capCookiesIndex, capConfig, i, capCookiesEnabled, e_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 5, , 6]); | ||
if (!path) return [3, 2]; | ||
return [4, (0, FileHelper_1.readTextFromFile)(path)]; | ||
case 1: | ||
_a = _b.sent(); | ||
return [3, 4]; | ||
case 2: return [4, (0, FileHelper_1.readTextFromFile)((0, PathHelper_1.getCapacitorConfig)())]; | ||
case 3: | ||
_a = _b.sent(); | ||
_b.label = 4; | ||
case 4: | ||
capConfigContent = _a; | ||
capCookiesIndex = capConfigContent.indexOf("CapacitorCookies"); | ||
if (capCookiesIndex > -1) { | ||
capConfig = capConfigContent.substring(capCookiesIndex, capConfigContent.indexOf("}", capCookiesIndex)).split("\n"); | ||
for (i = 0; i < capConfig.length; i++) { | ||
if (capConfig[i].includes("enabled")) { | ||
capCookiesEnabled = capConfig[i].includes("true") ? true : false; | ||
if (capCookiesEnabled === true) { | ||
Logger_1.Logger.getInstance().logWarning("Capacitor config file found! CapacitorCookies is enabled so we will not inject the cookie proxy! Please see https://www.npmjs.com/package/@dynatrace/cordova-plugin#capacitor-cookie-proxy for more information!"); | ||
} | ||
return [2, capConfig[i].includes("true") ? true : false]; | ||
} | ||
} | ||
} | ||
return [3, 6]; | ||
case 5: | ||
e_1 = _b.sent(); | ||
Logger_1.Logger.getInstance().logWarning("Capacitor config file is not available - Cannot check CapacitorCookies!"); | ||
return [3, 6]; | ||
case 6: return [2, false]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.isCapacitorCookiesEnabled = isCapacitorCookiesEnabled; | ||
var cookieProxyToInject = function (isCapacitor, isCapacitorCookiesEnabled, cordovaConfig) { | ||
if (isCapacitor) { | ||
return !isCapacitorCookiesEnabled && cordovaConfig.isCapacitorCookieProxyEnabled() | ||
? HtmlConstants_1.CAPACITOR_COOKIE_PROXY_SRC | ||
: !isCapacitorCookiesEnabled && cordovaConfig.isCookieProxyEnabled() && !cordovaConfig.isCapacitorCookieProxyEnabled() | ||
? HtmlConstants_1.COOKIE_PROXY_SRC | ||
: undefined; | ||
} | ||
return cordovaConfig.isCookieProxyEnabled() === true ? HtmlConstants_1.COOKIE_PROXY_SRC : undefined; | ||
}; | ||
exports.cookieProxyToInject = cookieProxyToInject; | ||
var instrument = function (process) { return __awaiter(void 0, void 0, void 0, function () { | ||
var _a, cliBuildArgs, jsagentContent, configJson, buildProperties, htmlFiles, htmlInstrumentation, _b, e_1, htmlInstrumentation, _c, e_2, e_3; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
var _a, cliBuildArgs, jsagentContent, configJson, isCapCookiesEnabled, buildProperties, htmlFiles, _b, htmlInstrumentation, _c, e_2, htmlInstrumentation, _d, e_3, e_4; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
case 0: | ||
@@ -96,14 +150,14 @@ Logger_1.Logger.getInstance().logInfo('Starting Configuration of application ..'); | ||
case 1: | ||
_a.apply(void 0, [_d.sent()]); | ||
_a.apply(void 0, [_e.sent()]); | ||
cliBuildArgs = (0, InstrumentUtil_1.setCliBuildArgs)(process); | ||
buildProperties = (0, InstrumentUtil_1.setBuildProperties)(instrumentHelper.parseCommandLine(process.argv.slice(2))); | ||
if (!((buildProperties.iosAvailable === true) || (buildProperties.androidAvailable === true))) return [3, 26]; | ||
if (!((buildProperties.iosAvailable === true) || (buildProperties.androidAvailable === true))) return [3, 29]; | ||
if (buildProperties.isCapacitor === false) { | ||
(0, HtmlUtil_1.removeOldDtAgent)((0, PathHelper_1.getDownloadJSAgentPath)()); | ||
} | ||
_d.label = 2; | ||
_e.label = 2; | ||
case 2: | ||
_d.trys.push([2, 24, , 25]); | ||
_e.trys.push([2, 27, , 28]); | ||
Logger_1.Logger.getInstance().logInfo('Trying to read configuration file: ' + buildProperties.pathToConfig); | ||
if (!(buildProperties.pathToConfig !== undefined)) return [3, 23]; | ||
if (!(buildProperties.pathToConfig !== undefined)) return [3, 26]; | ||
configJson = new ConfigurationReader_1.ConfigurationReader().readConfiguration(buildProperties.pathToConfig); | ||
@@ -115,10 +169,20 @@ Logger_1.Logger.setType(LoggerType_1.LoggerType.FileLogger, configJson.getCordovaPluginConfiguration().isDebugEnabled()); | ||
case 3: | ||
jsagentContent = _d.sent(); | ||
jsagentContent = _e.sent(); | ||
return [3, 6]; | ||
case 4: return [4, (0, DownloadAgent_1.downloadAgent)(configJson)]; | ||
case 5: | ||
jsagentContent = _d.sent(); | ||
_d.label = 6; | ||
jsagentContent = _e.sent(); | ||
_e.label = 6; | ||
case 6: | ||
htmlFiles = []; | ||
if (!(buildProperties.isCapacitor === true)) return [3, 8]; | ||
return [4, isCapacitorCookiesEnabled()]; | ||
case 7: | ||
_b = _e.sent(); | ||
return [3, 9]; | ||
case 8: | ||
_b = false; | ||
_e.label = 9; | ||
case 9: | ||
isCapCookiesEnabled = _b; | ||
if (configJson.getJavaScriptAgentConfiguration() !== undefined) { | ||
@@ -128,6 +192,6 @@ htmlFiles = configJson.getJavaScriptAgentConfiguration().getHtmlFiles(); | ||
if (!((buildProperties.androidAvailable === true) && | ||
((cliBuildArgs.android === true) || cliBuildArgs.capacitor === 'android'))) return [3, 14]; | ||
_d.label = 7; | ||
case 7: | ||
_d.trys.push([7, 12, 13, 14]); | ||
((cliBuildArgs.android === true) || cliBuildArgs.capacitor === 'android'))) return [3, 17]; | ||
_e.label = 10; | ||
case 10: | ||
_e.trys.push([10, 15, 16, 17]); | ||
Logger_1.Logger.getInstance().logInfo('Starting Android Configuration with Dynatrace!'); | ||
@@ -143,33 +207,33 @@ if (buildProperties.pathToGradle != null) { | ||
} | ||
if (!(jsagentContent === undefined)) return [3, 8]; | ||
if (!(jsagentContent === undefined)) return [3, 11]; | ||
Logger_1.Logger.getInstance() | ||
.logWarning('Not instrumenting HTML files since there is no available JSAgent to inject!'); | ||
return [3, 11]; | ||
case 8: | ||
htmlInstrumentation = new HtmlInstrumentation_1.HTMLInstrumentation(buildProperties.androidAssetPath, jsagentContent, configJson.getCordovaPluginConfiguration().isCookieProxyEnabled(), htmlFiles); | ||
_b = UpdateSecurity_1.updateSecurity; | ||
return [3, 14]; | ||
case 11: | ||
htmlInstrumentation = new HtmlInstrumentation_1.HTMLInstrumentation(buildProperties.androidAssetPath, jsagentContent, (0, exports.cookieProxyToInject)(buildProperties.isCapacitor, isCapCookiesEnabled, configJson.getCordovaPluginConfiguration()), htmlFiles); | ||
_c = UpdateSecurity_1.updateSecurity; | ||
return [4, htmlInstrumentation.instrument()]; | ||
case 9: return [4, _b.apply(void 0, [_d.sent(), configJson])]; | ||
case 10: | ||
_d.sent(); | ||
_d.label = 11; | ||
case 11: return [3, 14]; | ||
case 12: | ||
e_1 = _d.sent(); | ||
if (e_1 instanceof Error) { | ||
Logger_1.Logger.getInstance().logError(e_1.message); | ||
case 12: return [4, _c.apply(void 0, [_e.sent(), configJson])]; | ||
case 13: | ||
_e.sent(); | ||
_e.label = 14; | ||
case 14: return [3, 17]; | ||
case 15: | ||
e_2 = _e.sent(); | ||
if (e_2 instanceof Error) { | ||
Logger_1.Logger.getInstance().logError(e_2.message); | ||
} | ||
return [3, 14]; | ||
case 13: | ||
return [3, 17]; | ||
case 16: | ||
Logger_1.Logger.getInstance().logInfo('Finished Android Configuration with Dynatrace!'); | ||
return [7]; | ||
case 14: | ||
if (!((buildProperties.iosAvailable === true) && ((cliBuildArgs.ios === true) || cliBuildArgs.capacitor === 'ios'))) return [3, 23]; | ||
_d.label = 15; | ||
case 15: | ||
_d.trys.push([15, 21, 22, 23]); | ||
case 17: | ||
if (!((buildProperties.iosAvailable === true) && ((cliBuildArgs.ios === true) || cliBuildArgs.capacitor === 'ios'))) return [3, 26]; | ||
_e.label = 18; | ||
case 18: | ||
_e.trys.push([18, 24, 25, 26]); | ||
Logger_1.Logger.getInstance().logInfo('Starting iOS Configuration with Dynatrace!'); | ||
return [4, (0, Ios_1.modifyPListFile)(buildProperties.pathToPList, configJson.getIosConfiguration(), false)]; | ||
case 16: | ||
_d.sent(); | ||
case 19: | ||
_e.sent(); | ||
buildProperties.iosAssetsPath = (0, PathHelper_1.getIOSAssetsPath)(); | ||
@@ -179,40 +243,40 @@ if ((buildProperties.isCapacitor === false) && buildProperties.iosAssetsPath !== undefined) { | ||
} | ||
if (!(jsagentContent === undefined)) return [3, 17]; | ||
if (!(jsagentContent === undefined)) return [3, 20]; | ||
Logger_1.Logger.getInstance(). | ||
logWarning('Not instrumenting HTML files since there is no available JSAgent to inject!'); | ||
return [3, 20]; | ||
case 17: | ||
if (!(buildProperties.iosAssetsPath !== undefined)) return [3, 20]; | ||
htmlInstrumentation = new HtmlInstrumentation_1.HTMLInstrumentation(buildProperties.iosAssetsPath, jsagentContent, configJson.getCordovaPluginConfiguration().isCookieProxyEnabled(), htmlFiles); | ||
_c = UpdateSecurity_1.updateSecurity; | ||
return [3, 23]; | ||
case 20: | ||
if (!(buildProperties.iosAssetsPath !== undefined)) return [3, 23]; | ||
htmlInstrumentation = new HtmlInstrumentation_1.HTMLInstrumentation(buildProperties.iosAssetsPath, jsagentContent, (0, exports.cookieProxyToInject)(buildProperties.isCapacitor, isCapCookiesEnabled, configJson.getCordovaPluginConfiguration()), htmlFiles); | ||
_d = UpdateSecurity_1.updateSecurity; | ||
return [4, htmlInstrumentation.instrument()]; | ||
case 18: return [4, _c.apply(void 0, [_d.sent(), configJson])]; | ||
case 19: | ||
_d.sent(); | ||
_d.label = 20; | ||
case 20: return [3, 23]; | ||
case 21: | ||
e_2 = _d.sent(); | ||
if (e_2 instanceof Error) { | ||
Logger_1.Logger.getInstance().logError(e_2.message); | ||
} | ||
return [3, 23]; | ||
case 21: return [4, _d.apply(void 0, [_e.sent(), configJson])]; | ||
case 22: | ||
Logger_1.Logger.getInstance().logInfo('Finished iOS Configuration with Dynatrace!'); | ||
return [7]; | ||
case 23: return [3, 25]; | ||
_e.sent(); | ||
_e.label = 23; | ||
case 23: return [3, 26]; | ||
case 24: | ||
e_3 = _d.sent(); | ||
e_3 = _e.sent(); | ||
if (e_3 instanceof Error) { | ||
Logger_1.Logger.getInstance().logError(e_3.message); | ||
} | ||
if (e_3 instanceof DownloadAgent_1.StopBuildError) { | ||
throw e_3; | ||
return [3, 26]; | ||
case 25: | ||
Logger_1.Logger.getInstance().logInfo('Finished iOS Configuration with Dynatrace!'); | ||
return [7]; | ||
case 26: return [3, 28]; | ||
case 27: | ||
e_4 = _e.sent(); | ||
if (e_4 instanceof Error) { | ||
Logger_1.Logger.getInstance().logError(e_4.message); | ||
} | ||
return [3, 25]; | ||
case 25: return [3, 27]; | ||
case 26: | ||
if (e_4 instanceof DownloadAgent_1.StopBuildError) { | ||
throw e_4; | ||
} | ||
return [3, 28]; | ||
case 28: return [3, 30]; | ||
case 29: | ||
Logger_1.Logger.getInstance().logWarning('Both Android and iOS Folder are not available - Skip Configuration.'); | ||
_d.label = 27; | ||
case 27: | ||
_e.label = 30; | ||
case 30: | ||
Logger_1.Logger.getInstance().logInfo('Finished Configuration of Cordova application ..'); | ||
@@ -219,0 +283,0 @@ Logger_1.Logger.getInstance().closeLogger(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isCapacitorApp = exports.getCapacitorConfig = exports.getCapCliPackage = exports.getIosAssetsPathCapacitor = exports.getAndroidAssetsPathCapacitor = exports.getIosPlistPathCapacitor = exports.getAndroidPathCapacitor = exports.getIosPathCapacitor = exports.getDynatracePluginGradleFile = exports.getDynatraceGradleFile = exports.getLogPath = exports.getCurrentLogPath = exports.getCookieProxyPath = exports.getSwallowApiPath = exports.getDownloadJSAgentPath = exports.getIOSAssetsPath = exports.getAndroidAssetsPath = exports.getConfigFilePath = exports.getDefaultConfig = exports.getAndroidGradleVersionNewer = exports.getAndroidGradleVersion = exports.dynatraceConfigExists = exports.isIonic = exports.getIonicConfig = exports.getDoctorLogPath = exports.getAndroidGradleFile = exports.getPluginPath = exports.getPluginPackage = exports.getAndroidPath = exports.getIosPath = exports.getApplicationPackage = exports.getApplicationPath = exports.setRoot = exports.FILE_COOKIE_PROXY = exports.FILE_SWALLOW_API = exports.FILE_JSAGENT = exports.FOLDER_ASSETS = void 0; | ||
exports.isCapacitorApp = exports.getCapacitorCookieProxyPath = exports.getCapacitorConfig = exports.getCapCliPackage = exports.getIosAssetsPathCapacitor = exports.getAndroidAssetsPathCapacitor = exports.getIosPlistPathCapacitor = exports.getAndroidPathCapacitor = exports.getIosPathCapacitor = exports.getDynatracePluginGradleFile = exports.getDynatraceGradleFile = exports.getLogPath = exports.getCurrentLogPath = exports.getCookieProxyPath = exports.getSwallowApiPath = exports.getDownloadJSAgentPath = exports.getIOSAssetsPath = exports.getAndroidAssetsPath = exports.getConfigFilePath = exports.getDefaultConfig = exports.getAndroidGradleVersionNewer = exports.getAndroidGradleVersion = exports.dynatraceConfigExists = exports.isIonic = exports.getIonicConfig = exports.getDoctorLogPath = exports.getAndroidGradleFile = exports.getPluginPath = exports.getPluginPackage = exports.getAndroidPath = exports.getIosPath = exports.getApplicationPackage = exports.getApplicationPath = exports.setRoot = exports.FILE_CAPACITOR_COOKIE_PROXY = exports.FILE_COOKIE_PROXY = exports.FILE_SWALLOW_API = exports.FILE_JSAGENT = exports.FOLDER_ASSETS = void 0; | ||
var path_1 = require("path"); | ||
@@ -17,5 +17,8 @@ var fs_1 = require("fs"); | ||
var FILE_CURRENT_LOG = 'currentLog.txt'; | ||
var FILE_CAPACITOR_CONFIG_TS = (0, path_1.join)(__dirname, '..', '..', '..', '..', '..', 'capacitor.config.ts'); | ||
var FILE_CAPACITOR_CONFIG_JSON = (0, path_1.join)(__dirname, '..', '..', '..', '..', '..', 'capacitor.config.json'); | ||
exports.FILE_JSAGENT = 'dtAgent.js'; | ||
exports.FILE_SWALLOW_API = 'dtrum-swallow-api.js'; | ||
exports.FILE_COOKIE_PROXY = 'dt-cookie-proxy.js'; | ||
exports.FILE_CAPACITOR_COOKIE_PROXY = 'dt-cookie-proxy-cap.js'; | ||
var rootPath = __dirname; | ||
@@ -86,2 +89,4 @@ var setRoot = function (newRoot) { | ||
exports.getCookieProxyPath = getCookieProxyPath; | ||
var getCapacitorCookieProxyPath = function () { return (0, path_1.join)(getPluginPath(), FOLDER_SCRIPTS, 'snippets', exports.FILE_CAPACITOR_COOKIE_PROXY); }; | ||
exports.getCapacitorCookieProxyPath = getCapacitorCookieProxyPath; | ||
var getCurrentLogPath = function () { return (0, path_1.join)(getLogPath(), FILE_CURRENT_LOG); }; | ||
@@ -129,4 +134,9 @@ exports.getCurrentLogPath = getCurrentLogPath; | ||
var getCapacitorConfig = function (checkForTs) { | ||
return (checkForTs === true) ? (0, path_1.join)(__dirname, '..', '..', '..', '..', '..', 'capacitor.config.ts') | ||
: (0, path_1.join)(__dirname, '..', '..', '..', '..', '..', 'capacitor.config.json'); | ||
if ((0, fs_1.existsSync)(FILE_CAPACITOR_CONFIG_TS) || checkForTs === true) { | ||
return FILE_CAPACITOR_CONFIG_TS; | ||
} | ||
else if ((0, fs_1.existsSync)(FILE_CAPACITOR_CONFIG_JSON)) { | ||
return FILE_CAPACITOR_CONFIG_JSON; | ||
} | ||
return ''; | ||
}; | ||
@@ -133,0 +143,0 @@ exports.getCapacitorConfig = getCapacitorConfig; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.COOKIE_PROXY_SRC = exports.SWALLOW_API_SRC = exports.OLD_AGENT_SRC = exports.HTML_REQUIRED = exports.HTML_IDENTIFIER = exports.DEFAULT_COOKIE_PROXY_INJECTION = exports.DEFAULT_SWALLOW_API_INJECTION = void 0; | ||
var CordovaPluginConfigurationConstants_1 = require("../config/cordova/CordovaPluginConfigurationConstants"); | ||
exports.CAPACITOR_COOKIE_PROXY_SRC = exports.COOKIE_PROXY_SRC = exports.SWALLOW_API_SRC = exports.OLD_AGENT_SRC = exports.HTML_REQUIRED = exports.HTML_IDENTIFIER = exports.DEFAULT_SWALLOW_API_INJECTION = void 0; | ||
exports.DEFAULT_SWALLOW_API_INJECTION = true; | ||
exports.DEFAULT_COOKIE_PROXY_INJECTION = CordovaPluginConfigurationConstants_1.DEFAULT_COOKIE_PROXY; | ||
exports.HTML_IDENTIFIER = ['ion-app', 'app-root']; | ||
@@ -12,1 +10,2 @@ exports.HTML_REQUIRED = ['<html', '<head', '</head>', '</html>']; | ||
exports.COOKIE_PROXY_SRC = 'assets/dt-cookie-proxy.js'; | ||
exports.CAPACITOR_COOKIE_PROXY_SRC = 'assets/dt-cookie-proxy-cap.js'; |
@@ -44,6 +44,6 @@ "use strict"; | ||
var HTMLInstrumentation = (function () { | ||
function HTMLInstrumentation(folder, jsAgentContent, cookieProxyEnabled, htmlPathsConfigured) { | ||
function HTMLInstrumentation(folder, jsAgentContent, cookieProxySource, htmlPathsConfigured) { | ||
this.folder = folder; | ||
this.jsAgentContent = jsAgentContent; | ||
this.cookieProxyEnabled = cookieProxyEnabled; | ||
this.cookieProxySource = cookieProxySource; | ||
this.htmlPathsConfigured = htmlPathsConfigured; | ||
@@ -53,3 +53,3 @@ } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var htmlFiles, _a, _b, _i, htmlFiles_1, htmlFile, htmlModifier; | ||
var htmlFiles, _a, _b, instrumentationLogMessage, _i, htmlFiles_1, htmlFile, htmlModifier; | ||
return __generator(this, function (_c) { | ||
@@ -68,2 +68,14 @@ switch (_c.label) { | ||
case 3: | ||
instrumentationLogMessage = '\n\nSuccessfully added JSAgent '; | ||
if (this.cookieProxySource !== undefined) { | ||
if (this.cookieProxySource.includes('-cap.js')) { | ||
instrumentationLogMessage = instrumentationLogMessage + 'and Capacitor Cookie Proxy to HTML file(s):'; | ||
} | ||
else { | ||
instrumentationLogMessage = instrumentationLogMessage + 'and Cookie Proxy to HTML file(s):'; | ||
} | ||
} | ||
else { | ||
instrumentationLogMessage = instrumentationLogMessage + 'to HTML file(s):'; | ||
} | ||
_i = 0, htmlFiles_1 = htmlFiles; | ||
@@ -77,6 +89,7 @@ _c.label = 4; | ||
htmlModifier.setSwallowAPIEnabled(true); | ||
htmlModifier.setCookieProxyEnabled(this.cookieProxyEnabled); | ||
htmlModifier.setCookieProxySource(this.cookieProxySource); | ||
return [4, htmlModifier.modify()]; | ||
case 5: | ||
_c.sent(); | ||
instrumentationLogMessage = instrumentationLogMessage + "\n\t".concat(htmlFile.getPath()); | ||
_c.label = 6; | ||
@@ -87,3 +100,3 @@ case 6: | ||
case 7: | ||
Logger_1.Logger.getInstance().logInfo('Successfully updated the JSAgent in HTML file!'); | ||
Logger_1.Logger.getInstance().logInfo(instrumentationLogMessage + '\n'); | ||
_c.label = 8; | ||
@@ -90,0 +103,0 @@ case 8: return [2, htmlFiles]; |
@@ -44,2 +44,3 @@ "use strict"; | ||
var HtmlUtil_1 = require("./HtmlUtil"); | ||
var InstrumentUtil_1 = require("../utils/InstrumentUtil"); | ||
var HTMLModifier = (function () { | ||
@@ -49,3 +50,3 @@ function HTMLModifier(htmlFile) { | ||
this.swallowAPIEnabled = HtmlConstants_1.DEFAULT_SWALLOW_API_INJECTION; | ||
this.cookieProxyScript = HtmlConstants_1.DEFAULT_COOKIE_PROXY_INJECTION; | ||
this.cookieProxySource = undefined; | ||
} | ||
@@ -56,4 +57,4 @@ HTMLModifier.prototype.setJSAgentContent = function (jsAgentContent) { | ||
}; | ||
HTMLModifier.prototype.setCookieProxyEnabled = function (cookieProxy) { | ||
this.cookieProxyScript = cookieProxy; | ||
HTMLModifier.prototype.setCookieProxySource = function (cookieProxySource) { | ||
this.cookieProxySource = cookieProxySource; | ||
return this; | ||
@@ -76,5 +77,23 @@ }; | ||
}; | ||
HTMLModifier.prototype.isCookieProxyInHtml = function () { | ||
return this.elementExistsInHtml([HtmlConstants_1.COOKIE_PROXY_SRC, HtmlConstants_1.CAPACITOR_COOKIE_PROXY_SRC]); | ||
}; | ||
HTMLModifier.prototype.isSwallowApiInHtml = function () { | ||
return this.elementExistsInHtml([HtmlConstants_1.SWALLOW_API_SRC]); | ||
}; | ||
HTMLModifier.prototype.elementExistsInHtml = function (elements) { | ||
var scripts = this.htmlFile.getDOM().window.document.getElementsByTagName('script'); | ||
for (var i = 0; i < scripts.length; i++) { | ||
var item = scripts.item(i); | ||
for (var i_1 = 0; i_1 < elements.length; i_1++) { | ||
if (item !== null && item.src.includes(elements[i_1]) && item.parentNode !== null) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
}; | ||
HTMLModifier.prototype.modify = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var head, scriptTag; | ||
var head, scriptTag, cookieProxyProps; | ||
return __generator(this, function (_a) { | ||
@@ -89,3 +108,8 @@ switch (_a.label) { | ||
if (!this.swallowAPIEnabled) return [3, 2]; | ||
head.prepend(this.createScriptTag(HtmlConstants_1.SWALLOW_API_SRC)); | ||
if (!this.isSwallowApiInHtml()) { | ||
head.prepend(this.createScriptTag(HtmlConstants_1.SWALLOW_API_SRC)); | ||
} | ||
else { | ||
Logger_1.Logger.getInstance().logWarning('Not adding swallow api to HTML file since it already exists!'); | ||
} | ||
return [4, (0, HtmlUtil_1.copySwallowAPI)((0, path_1.join)(this.htmlFile.getPath(), '..'))]; | ||
@@ -101,5 +125,11 @@ case 1: | ||
} | ||
if (!(this.cookieProxyScript === true)) return [3, 4]; | ||
head.prepend(this.createScriptTag(HtmlConstants_1.COOKIE_PROXY_SRC)); | ||
return [4, (0, HtmlUtil_1.copyCookieProxy)((0, path_1.join)(this.htmlFile.getPath(), '..'))]; | ||
if (!(this.cookieProxySource !== undefined)) return [3, 4]; | ||
cookieProxyProps = (0, InstrumentUtil_1.getCookieProxyProps)(this.cookieProxySource); | ||
if (!this.isCookieProxyInHtml()) { | ||
head.prepend(this.createScriptTag(this.cookieProxySource)); | ||
} | ||
else { | ||
Logger_1.Logger.getInstance().logWarning("Not adding ".concat(cookieProxyProps.name, " to HTML file since it already exists!")); | ||
} | ||
return [4, (0, HtmlUtil_1.copyCookieProxy)((0, path_1.join)(this.htmlFile.getPath(), '..'), cookieProxyProps)]; | ||
case 3: | ||
@@ -106,0 +136,0 @@ _a.sent(); |
@@ -152,3 +152,3 @@ "use strict"; | ||
exports.copySwallowAPI = copySwallowAPI; | ||
var copyCookieProxy = function (destinationDirectory) { return __awaiter(void 0, void 0, void 0, function () { | ||
var copyCookieProxy = function (destinationDirectory, cookieProxyProps) { return __awaiter(void 0, void 0, void 0, function () { | ||
var destAssets, cookieProxy, e_2; | ||
@@ -163,6 +163,6 @@ return __generator(this, function (_a) { | ||
_a.trys.push([2, 5, , 6]); | ||
return [4, (0, FileHelper_1.readTextFromFile)((0, PathHelper_1.getCookieProxyPath)())]; | ||
return [4, (0, FileHelper_1.readTextFromFile)(cookieProxyProps.path)]; | ||
case 3: | ||
cookieProxy = _a.sent(); | ||
return [4, (0, FileHelper_1.writeTextToFile)((0, path_1.resolve)(destAssets, PathHelper_1.FILE_COOKIE_PROXY), cookieProxy)]; | ||
return [4, (0, FileHelper_1.writeTextToFile)((0, path_1.resolve)(destAssets, cookieProxyProps.fileName), cookieProxy)]; | ||
case 4: | ||
@@ -173,3 +173,3 @@ _a.sent(); | ||
e_2 = _a.sent(); | ||
Logger_1.Logger.getInstance().logError('Error while copying cookie proxy to platforms folder: ' + e_2); | ||
Logger_1.Logger.getInstance().logError(cookieProxyProps.errorLog + e_2); | ||
return [3, 6]; | ||
@@ -176,0 +176,0 @@ case 6: return [2]; |
@@ -15,18 +15,23 @@ "use strict"; | ||
var sessionStoragePrefix = '_dt.'; | ||
if (typeof Document !== 'undefined') { | ||
var cookieDesc_1 = Object.getOwnPropertyDescriptor(Document.prototype, 'cookie') || | ||
Object.getOwnPropertyDescriptor(HTMLDocument.prototype, 'cookie'); | ||
if (cookieDesc_1 !== undefined && (cookieDesc_1.configurable === true)) { | ||
Object.defineProperty(document, 'cookie', { | ||
get: function () { | ||
var cookies = cookieDesc_1.get.call(document); | ||
return patchCookies(cookies); | ||
}, | ||
set: function (val) { | ||
cookieDesc_1.set.call(document, val); | ||
setCookie(val); | ||
}, | ||
}); | ||
try { | ||
if (typeof Document !== 'undefined') { | ||
var cookieDesc_1 = Object.getOwnPropertyDescriptor(Document.prototype, 'cookie') || | ||
Object.getOwnPropertyDescriptor(HTMLDocument.prototype, 'cookie'); | ||
if ((cookieDesc_1 === null || cookieDesc_1 === void 0 ? void 0 : cookieDesc_1.configurable) === true) { | ||
Object.defineProperty(document, 'cookie', { | ||
get: function () { | ||
var cookies = cookieDesc_1.get.call(document); | ||
return patchCookies(cookies); | ||
}, | ||
set: function (val) { | ||
cookieDesc_1.set.call(document, val); | ||
setCookie(val); | ||
}, | ||
}); | ||
} | ||
} | ||
} | ||
catch (e) { | ||
console.warn('[DYNATRACE]: Unable to setup the cookie proxy!\n' + e); | ||
} | ||
var setCookie = function (value) { | ||
@@ -33,0 +38,0 @@ if (value !== undefined) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.setBuildProperties = exports.setCliBuildArgs = void 0; | ||
exports.getCookieProxyProps = exports.setBuildProperties = exports.setCliBuildArgs = void 0; | ||
var path_1 = require("path"); | ||
@@ -74,1 +74,18 @@ var FileHelper_1 = require("../helpers/FileHelper"); | ||
exports.setBuildProperties = setBuildProperties; | ||
var getCookieProxyProps = function (cookieProxySource) { | ||
var cookieProxyProps = cookieProxySource.includes('-cap') ? | ||
{ | ||
path: (0, PathHelper_1.getCapacitorCookieProxyPath)(), | ||
name: 'capacitor cookie proxy', | ||
fileName: PathHelper_1.FILE_CAPACITOR_COOKIE_PROXY, | ||
errorLog: 'Error while copying capacitor cookie proxy to platforms folder: ' | ||
} : | ||
{ | ||
path: (0, PathHelper_1.getCookieProxyPath)(), | ||
name: 'cookie proxy', | ||
fileName: PathHelper_1.FILE_COOKIE_PROXY, | ||
errorLog: 'Error while copying cookie proxy to platforms folder: ' | ||
}; | ||
return cookieProxyProps; | ||
}; | ||
exports.getCookieProxyProps = getCookieProxyProps; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 17 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24932678
173
6665
1052
19
+ Added@tootallnate/once@2.0.0(transitive)
+ Addedabab@2.0.6(transitive)
+ Addedagent-base@6.0.2(transitive)
+ Addedcssstyle@3.0.0(transitive)
+ Addeddata-urls@4.0.0(transitive)
+ Addeddomexception@4.0.0(transitive)
+ Addedhtml-encoding-sniffer@3.0.0(transitive)
+ Addedhttp-proxy-agent@5.0.0(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addedjsdom@22.1.0(transitive)
+ Addedrrweb-cssom@0.6.0(transitive)
+ Addedtr46@4.1.1(transitive)
+ Addedw3c-xmlserializer@4.0.0(transitive)
+ Addedwhatwg-encoding@2.0.0(transitive)
+ Addedwhatwg-mimetype@3.0.0(transitive)
+ Addedwhatwg-url@12.0.1(transitive)
+ Addedxml-name-validator@4.0.0(transitive)
- Removedagent-base@7.1.1(transitive)
- Removedcssstyle@4.1.0(transitive)
- Removeddata-urls@5.0.0(transitive)
- Removedhtml-encoding-sniffer@4.0.0(transitive)
- Removedhttp-proxy-agent@7.0.2(transitive)
- Removedhttps-proxy-agent@7.0.5(transitive)
- Removedjsdom@24.1.3(transitive)
- Removedrrweb-cssom@0.7.1(transitive)
- Removedtr46@5.0.0(transitive)
- Removedw3c-xmlserializer@5.0.0(transitive)
- Removedwhatwg-encoding@3.1.1(transitive)
- Removedwhatwg-mimetype@4.0.0(transitive)
- Removedwhatwg-url@14.0.0(transitive)
- Removedxml-name-validator@5.0.0(transitive)
Updatedaxios@^1.7.5
Updatedjsdom@^22.1.0