@microsoft/vscode-azext-utils
Advanced tools
@@ -136,4 +136,2 @@ "use strict"; | ||
| errorData.message = (0, masking_1.maskUserInfo)(errorData.message, context.valuesToMask); | ||
| context.telemetry.properties.azureSubscriptionId = context.subscriptionId; | ||
| context.telemetry.properties.azureResourceId = context.resourceId; | ||
| if (errorData.stepName) { | ||
@@ -231,4 +229,2 @@ context.telemetry.properties.lastStep = errorData.stepName; | ||
| context.telemetry.measurements.duration = (end - start) / 1000; | ||
| context.telemetry.properties.azureSubscriptionId = context.subscriptionId; | ||
| context.telemetry.properties.azureResourceId = context.resourceId; | ||
| // de-dupe | ||
@@ -235,0 +231,0 @@ context.valuesToMask = context.valuesToMask.filter((v, index) => context.valuesToMask.indexOf(v) === index); |
@@ -36,2 +36,4 @@ "use strict"; | ||
| wizardContext.subscriptionId = pickedAzureResource.resource.subscription.subscriptionId; | ||
| wizardContext.telemetry.properties.subscriptionId = pickedAzureResource.resource.subscription.subscriptionId; | ||
| wizardContext.telemetry.properties.resourceId = pickedAzureResource.resource.id; | ||
| return pickedAzureResource; | ||
@@ -38,0 +40,0 @@ }); |
@@ -35,2 +35,3 @@ "use strict"; | ||
| wizardContext.subscription = pickedSubscription.subscription; | ||
| wizardContext.telemetry.properties.subscriptionId = pickedSubscription.subscription.subscriptionId; | ||
| return pickedSubscription; | ||
@@ -37,0 +38,0 @@ }); |
@@ -22,2 +22,3 @@ "use strict"; | ||
| const AzExtTreeItem_1 = require("./tree/AzExtTreeItem"); | ||
| const vscode_azureresources_api_1 = require("@microsoft/vscode-azureresources-api"); | ||
| function isTreeElementBase(object) { | ||
@@ -40,23 +41,4 @@ return typeof object === 'object' && object !== null && 'getTreeItem' in object; | ||
| return yield (0, callWithTelemetryAndErrorHandling_1.callWithTelemetryAndErrorHandling)(telemetryId || commandId, (context) => __awaiter(this, void 0, void 0, function* () { | ||
| var _a, _b, _c; | ||
| if (args.length > 0) { | ||
| const firstArg = args[0]; | ||
| if (firstArg instanceof vscode_1.Uri) { | ||
| context.telemetry.properties.contextValue = 'Uri'; | ||
| } | ||
| else if (firstArg && typeof firstArg === 'object' && 'contextValue' in firstArg && typeof firstArg.contextValue === 'string') { | ||
| context.telemetry.properties.contextValue = firstArg.contextValue; | ||
| } | ||
| else if (isTreeElementBase(firstArg)) { | ||
| context.telemetry.properties.contextValue = (yield firstArg.getTreeItem()).contextValue; | ||
| } | ||
| if (isResourceGroupsItem(firstArg)) { | ||
| context.resourceId = (_a = firstArg === null || firstArg === void 0 ? void 0 : firstArg.resource) === null || _a === void 0 ? void 0 : _a.id; | ||
| context.subscriptionId = (_c = (_b = firstArg === null || firstArg === void 0 ? void 0 : firstArg.resource) === null || _b === void 0 ? void 0 : _b.subscription) === null || _c === void 0 ? void 0 : _c.subscriptionId; | ||
| } | ||
| for (const arg of args) { | ||
| if (arg instanceof AzExtTreeItem_1.AzExtTreeItem) { | ||
| (0, addTreeItemValuesToMask_1.addTreeItemValuesToMask)(context, arg, 'command'); | ||
| } | ||
| } | ||
| yield setTelemetryProperties(context, args); | ||
| } | ||
@@ -74,2 +56,46 @@ return callback(context, ...args); | ||
| } | ||
| function setTelemetryProperties(context, args) { | ||
| var _a, _b, _c; | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const firstArg = args[0]; | ||
| if (firstArg instanceof vscode_1.Uri) { | ||
| context.telemetry.properties.contextValue = 'Uri'; | ||
| } | ||
| else if (firstArg && typeof firstArg === 'object' && 'contextValue' in firstArg && typeof firstArg.contextValue === 'string') { | ||
| context.telemetry.properties.contextValue = firstArg.contextValue; | ||
| } | ||
| else if (isTreeElementBase(firstArg)) { | ||
| context.telemetry.properties.contextValue = (yield firstArg.getTreeItem()).contextValue; | ||
| } | ||
| // handles items from the resource groups extension | ||
| if (isResourceGroupsItem(firstArg)) { | ||
| context.telemetry.properties.resourceId = (_a = firstArg === null || firstArg === void 0 ? void 0 : firstArg.resource) === null || _a === void 0 ? void 0 : _a.id; | ||
| context.telemetry.properties.subscriptionId = (_c = (_b = firstArg === null || firstArg === void 0 ? void 0 : firstArg.resource) === null || _b === void 0 ? void 0 : _b.subscription) === null || _c === void 0 ? void 0 : _c.subscriptionId; | ||
| } | ||
| // handles items from v1 extensions | ||
| for (const arg of args) { | ||
| if (arg instanceof AzExtTreeItem_1.AzExtTreeItem) { | ||
| context.telemetry.properties.resourceId = arg.id; | ||
| context.telemetry.properties.subscriptionId = arg.subscription.subscriptionId; | ||
| (0, addTreeItemValuesToMask_1.addTreeItemValuesToMask)(context, arg, 'command'); | ||
| } | ||
| } | ||
| // handles items from v2 extensions that are shaped like: | ||
| // id: string; | ||
| // subscription: { | ||
| // subscriptionId: string; | ||
| // } | ||
| // we don't enforce this shape so it won't work in all cases, but for ACA we mostly follow this pattern | ||
| const [node, nodes] = (0, vscode_azureresources_api_1.unwrapArgs)(args); | ||
| const allNodes = [node, ...nodes !== null && nodes !== void 0 ? nodes : []]; | ||
| for (const node of allNodes) { | ||
| if (node && typeof node === 'object' && 'id' in node && typeof node.id === 'string') { | ||
| context.telemetry.properties.resourceId = node.id; | ||
| if ('subscription' in node && node.subscription && typeof node.subscription === 'object' && 'subscriptionId' in node.subscription && typeof node.subscription.subscriptionId === 'string') { | ||
| context.telemetry.properties.subscriptionId = node.subscription.subscriptionId; | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| //# sourceMappingURL=registerCommand.js.map |
+1
-1
| { | ||
| "name": "@microsoft/vscode-azext-utils", | ||
| "author": "Microsoft Corporation", | ||
| "version": "2.6.0", | ||
| "version": "2.6.1", | ||
| "description": "Common UI tools for developing Azure extensions for VS Code", | ||
@@ -6,0 +6,0 @@ "tags": [ |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
444889
0.32%8634
0.29%