@sap/swa-for-sapbas-vsx
Advanced tools
Comparing version 1.0.4 to 1.1.0
{ | ||
"name": "@sap/swa-for-sapbas-vsx", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"author": "SAP SE", | ||
@@ -5,0 +5,0 @@ "description": "Javascript module for SWA tracking to be consumed by VsCode extensions", |
@@ -71,10 +71,17 @@ [![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/) | ||
The following fields can be used for creating SWA reports: | ||
**eventType**: The event we are reporting happened ex. Generator Success | ||
**user**: Hashed user ID unless privacy is activated then "NA" | ||
**Custom event parameters**: | ||
1. IAAS (aws,ali,azure) | ||
2. Datacenter (stg10.int, cry10.int, ap21, prd40) | ||
3. Version | ||
4. Is SAP User | ||
5. The unique caller ID that extensions put in param | ||
6 - 9. Extension's custom events provided via 'track' API | ||
| SWA Field | Origin | | ||
| ------------- | ------------- | | ||
| **eventType** | The "myEvent" parameter sent via track API | | ||
| **user** | Hashed user ID unless privacy is activated, then "na" | | ||
| **Custom event parameter 1** | Event additional data 1, "custom event 1" sent via track API | | ||
| **Custom event parameter 2** | Event additional data 2, "custom event 2" sent via track API | | ||
| **Custom event parameter 3** | Event additional data 3, "custom event 3" sent via track API | | ||
| **Custom event parameter 4** | Event additional data 4, "custom event 4" sent via track API | | ||
| **Custom event parameter 5** | Event additional data 5, "custom event 5" sent via track API | | ||
| **Custom event parameter 6** | IAAS (aws,ali,azure), set by the lib automatically | | ||
| **Custom event parameter 7** | Datacenter (stg10.int, cry10.int, ap21, prd40), set by the lib automatically | | ||
| **Custom event parameter 8** | Version (currently not supported), set by the lib automatically | | ||
| **Custom event parameter 9** | Is SAP User where allowed, empty overwise, set by the lib automatically | | ||
| **Custom event parameter 10** | The unique caller ID "vsxPublisher.vsxPackageName", set by lib automatically | | ||
@@ -29,17 +29,19 @@ 'use strict'; | ||
async _prepareCustomEvents(custom_events) { | ||
const myCusEvent = _.slice(custom_events, 0, 4); | ||
const myCusEvent = _.slice(custom_events, 0, 5); | ||
const toReturn = {}; | ||
toReturn.e_a = this._getIAASParam(); | ||
toReturn.e_2 = this._getDataCenterParam(); | ||
toReturn.e_3 = this._getVersion(); | ||
toReturn.e_4 = this._getIsSAPUser(); | ||
toReturn.e_5 = this.reporterUniqueId; | ||
let key = "e_a"; | ||
for (let i = 0; i < myCusEvent.length; i += 1) { | ||
// custom events object should be { "e_a": "val", "e_2": "val", "e_3": "val"....} | ||
// first 5 vals are reserved for API | ||
const key = "e_" + (i + 6).toString(); | ||
// custom events object should be { "e_a": "val", "e_2": "val", "e_3": "val"....} | ||
// first 5 vals are custom, next 5 reserved for API | ||
if (i > 0) | ||
key = "e_" + (i + 1).toString(); | ||
toReturn[key] = myCusEvent[i]; | ||
} | ||
toReturn.e_6 = this._getIAASParam(); | ||
toReturn.e_7 = this._getDataCenterParam(); | ||
toReturn.e_8 = this._getVersion(); | ||
toReturn.e_9 = this._getIsSAPUser(); | ||
toReturn.e_10 = this.reporterUniqueId; | ||
return toReturn; | ||
@@ -46,0 +48,0 @@ } |
@@ -10,9 +10,9 @@ const swa = require("../src/index.js"); | ||
res => { | ||
assert(res.e_6 === "1" && res.e_7 === "2" && res.e_8 === "3" && res.e_9 === "4","Custom params not inserted correctly") | ||
assert(res.e_a === "1" && res.e_2 === "2" && res.e_3 === "3" && res.e_4 === "4" && res.e_5 === "5" ,"Custom params not inserted correctly") | ||
}) | ||
}); | ||
it("validate max size of sent obj", () => { | ||
return swaObj._prepareCustomEvents(["1","2","3","4","5","6","4","5","6"]).then( | ||
return swaObj._prepareCustomEvents(["1","2","3","4","5","6","4","5","6","10"]).then( | ||
res => { | ||
assert(Object.keys(res).length < 10, "custom events object over max size"); | ||
assert(Object.keys(res).length < 11, "custom events object over max size"); | ||
} | ||
@@ -24,3 +24,3 @@ ) | ||
res => { | ||
assert(Object.keys(res).length >= 4, "custom events object first 4 elements not reserved.") | ||
assert(Object.keys(res).length >= 5, "custom events object first 5 elements not reserved.") | ||
} | ||
@@ -27,0 +27,0 @@ ) |
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
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
35535
185
87