Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap/swa-for-sapbas-vsx

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/swa-for-sapbas-vsx - npm Package Compare versions

Comparing version 1.2.7 to 1.2.14

5

package.json
{
"name": "@sap/swa-for-sapbas-vsx",
"version": "1.2.7",
"version": "1.2.14",
"author": "SAP SE",

@@ -27,4 +27,5 @@ "description": "Javascript module for SWA tracking to be consumed by VsCode extensions",

"lodash": "4.17.21",
"matomo-tracker": "2.2.2"
"matomo-tracker": "2.2.2",
"semver": "7.3.5"
}
}

@@ -84,2 +84,9 @@ [![Build Status](https://gkedevxlondon.jaas-gcp.cloud.sap.corp/buildStatus/icon?job=swa_ci/master)](https://gkedevxlondon.jaas-gcp.cloud.sap.corp/job/swa_ci/job/master/)

#### Use Different Target
SWA can report usage to a different target.
These reports are always anonymized.
```js
swa.setTarget(<targetUrl>, <targetToken>);
```
## Enable usage analytics reporting from VS Code

@@ -86,0 +93,0 @@ If you have a VS Code extension that is released to VS Code marketplace and you would like to collect its usage when it runs in VS Code, do the following:

50

src/index.js

@@ -5,3 +5,6 @@ 'use strict';

const MatomoTracker = require('matomo-tracker');
const semverLt = require('semver/functions/lt')
const SWA_LIB_VERSION = require(__dirname + '/../package.json').version;
const SITE_TOKEN_ENV_NAME = "SWA_TARGET_SITE_TOKEN";

@@ -21,2 +24,3 @@ const SITE_URL_ENV_NAME = "SWA_TARGET_SITE_URL";

this.isExternalTarget = false
this.errorListener = errorListener
this.disableTracking = false;

@@ -30,11 +34,3 @@ this.baseUrl = this._getProcessEnv(SITE_URL_ENV_NAME, VS_CODE_DEFAULTS.URL);

this._validateRequiredParams();
this.matomo = new MatomoTracker(this.apiToken, this.baseUrl, true);
if(_.isFunction(errorListener)) {
const internalErrorListener = (err) => {
if(err && err != 204) {
errorListener(err);
}
}
this.matomo.on('error', internalErrorListener);
}
this._setMatomoTracker(this.apiToken, this.baseUrl, this.errorListener)
}

@@ -100,2 +96,5 @@

}
if(!this._hasMinimalAllowedVersion()) {
this.disableTracking = true;
}
}

@@ -120,2 +119,14 @@ }

_hasMinimalAllowedVersion() {
const minimalAllowedVersion = this._getProcessEnv("SWA_MINIMAL_ALLOWED_VERSION", "na");
if (minimalAllowedVersion != "na") {
const isLibVersionSmallerThanAllowed = semverLt(SWA_LIB_VERSION, minimalAllowedVersion)
if (isLibVersionSmallerThanAllowed) {
console.log(`Current lib version ${SWA_LIB_VERSION} is not sufficient for the minimal allowed version ${minimalAllowedVersion}`);
return false;
}
}
return true;
}
_isAppStudio() {

@@ -202,7 +213,20 @@ return this._getProcessEnv("H2O_URL","na") !== "na";

setTarget(targetUrl, targetToken) {
if (targetUrl != null && targetToken != null) {
this.baseUrl = targetUrl;
this.apiToken = targetToken;
_setMatomoTracker(apiToken, baseUrl, errorListener) {
this.matomo = new MatomoTracker(apiToken, baseUrl, true);
if(_.isFunction(errorListener)) {
const internalErrorListener = (err) => {
if(err && err != 204) {
errorListener(err);
}
}
this.matomo.on('error', internalErrorListener);
}
}
setTarget(baseUrl, apiToken) {
if (apiToken != null && baseUrl != null) {
this.isExternalTarget = true
this.baseUrl = baseUrl;
this.apiToken = apiToken;
this._setMatomoTracker(apiToken, baseUrl, this.errorListener)
}

@@ -209,0 +233,0 @@ }

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc