Socket
Socket
Sign inDemoInstall

@microsoft/vscode-azext-utils

Package Overview
Dependencies
Maintainers
10
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/vscode-azext-utils - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

hostapi.d.ts

224

index.d.ts

@@ -12,3 +12,3 @@ /*---------------------------------------------------------------------------------------------

import { AzureExtensionApi, AzureExtensionApiProvider } from './api';
import { AppResource } from './unified';
import type { Activity, ActivityTreeItemOptions, AppResource, OnErrorActivityData, OnProgressActivityData, OnStartActivityData, OnSuccessActivityData } from './hostapi'; // This must remain `import type` or else a circular reference will result

@@ -180,3 +180,148 @@ /**

/**
* AzExtTreeItem properties that can be called but should not be overridden
*/
export interface SealedAzExtTreeItem {
/**
* This id represents the effective/serializable full id of the item in the tree. It always starts with the parent's fullId and ends with either the AzExtTreeItem.id property (if implemented) or AzExtTreeItem.label property
* This is used for AzureTreeDataProvider.findTreeItem and openInPortal
*/
readonly fullId: string;
readonly parent?: AzExtParentTreeItem;
readonly treeDataProvider: AzExtTreeDataProvider;
/**
* The subscription information for this branch of the tree
* Throws an error if this branch of the tree is not actually for Azure resources
*/
readonly subscription: ISubscriptionContext;
/**
* Values to mask in error messages whenever an action uses this tree item
* NOTE: Some values are automatically masked without the need to add anything here, like the label and parts of the id if it's an Azure id
*/
readonly valuesToMask: string[];
/**
* Set to true if the label of this tree item does not need to be masked
*/
suppressMaskLabel?: boolean;
/**
* Refresh this node in the tree
*/
refresh(context: IActionContext): Promise<void>;
/**
* This class wraps deleteTreeItemImpl and ensures the tree is updated correctly when an item is deleted
*/
deleteTreeItem(context: IActionContext): Promise<void>;
/**
* Displays a 'Loading...' icon and temporarily changes the item's description while `callback` is being run
*/
runWithTemporaryDescription(context: IActionContext, description: string, callback: () => Promise<void>): Promise<void>;
}
// AzExtTreeItem stuff we need them to implement
/**
* AzExtTreeItem properties that can be overridden
*/
export interface AbstractAzExtTreeItem {
id?: string;
label: string;
/**
* Additional information about a tree item that is appended to the label with the format `label (description)`
*/
description?: string;
iconPath?: TreeItemIconPath;
commandId?: string;
tooltip?: string;
collapsibleState?: TreeItemCollapsibleState;
/**
* The arguments to pass in when executing `commandId`. If not specified, this tree item will be used.
*/
commandArgs?: unknown[];
contextValue: string;
/**
* Implement this to display child resources. Should not be called directly
* @param clearCache If true, you should start the "Load more..." process over
* @param context The action context
*/
loadMoreChildrenImpl?(clearCache: boolean, context: IActionContext): Promise<AzExtTreeItem[]>;
/**
* Implement this as a part of the "Load more..." action. Should not be called directly
* @returns 'true' if there are more children and a "Load more..." node should be displayed
*/
hasMoreChildrenImpl?(): boolean;
/**
* Implement this if you want the 'create' option to show up in the tree picker. Should not be called directly
* @param context The action context and any additional user-defined options that are passed to the `AzExtParentTreeItem.createChild` or `AzExtTreeDataProvider.showTreeItemPicker`
*/
createChildImpl?(context: ICreateChildImplContext): Promise<AzExtTreeItem>;
/**
* Override this if you want non-default (i.e. non-alphabetical) sorting of children. Should not be called directly
* @param item1 The first item to compare
* @param item2 The second item to compare
* @returns A negative number if the item1 occurs before item2; positive if item1 occurs after item2; 0 if they are equivalent
*/
compareChildrenImpl?(item1: AzExtTreeItem, item2: AzExtTreeItem): number;
/**
* If this treeItem should not show up in the tree picker or you want custom logic to show quick picks, implement this to provide a child that corresponds to the expectedContextValue. Should not be called directly
* Otherwise, all children will be shown in the tree picker
*/
pickTreeItemImpl?(expectedContextValues: (string | RegExp)[], context: IActionContext): AzExtTreeItem | undefined | Promise<AzExtTreeItem | undefined>;
/**
* Implement this to support the 'delete' action in the tree. Should not be called directly
*/
deleteTreeItemImpl?(context: IActionContext): Promise<void>;
/**
* Implement this to execute any async code when this node is refreshed. Should not be called directly
*/
refreshImpl?(context: IActionContext): Promise<void>;
/**
* Optional function to filter items displayed in the tree picker. Should not be called directly
* If not implemented, it's assumed that 'isAncestorOf' evaluates to true
*/
isAncestorOfImpl?(contextValue: string | RegExp): boolean;
/**
* If implemented, resolves the tooltip at the time of hovering, and the value of the `tooltip` property is ignored. Otherwise, the `tooltip` property is used.
*/
resolveTooltip?(): Promise<string | MarkdownString>;
}
export type IAzExtTreeItem = AbstractAzExtTreeItem & SealedAzExtTreeItem;
export interface IAzExtParentTreeItem extends IAzExtTreeItem {
/**
* Implement this to display child resources. Should not be called directly
* @param clearCache If true, you should start the "Load more..." process over
* @param context The action context
*/
loadMoreChildrenImpl(clearCache: boolean, context: IActionContext): Promise<AzExtTreeItem[]>;
/**
* Implement this as a part of the "Load more..." action. Should not be called directly
* @returns 'true' if there are more children and a "Load more..." node should be displayed
*/
hasMoreChildrenImpl(): boolean;
}
/**
* Base class for all tree items in an *Az*ure *ext*ension, even if those resources aren't actually in Azure.

@@ -186,3 +331,3 @@ * This provides more value than `TreeItem` (provided by `vscode`)

*/
export declare abstract class AzExtTreeItem {
export declare abstract class AzExtTreeItem implements IAzExtTreeItem {
//#region Properties implemented by base class

@@ -330,3 +475,3 @@ /**

export class InvalidTreeItem extends AzExtParentTreeItem {
export declare class InvalidTreeItem extends AzExtParentTreeItem {
public contextValue: string;

@@ -348,3 +493,3 @@ public label: string;

*/
export declare abstract class AzExtParentTreeItem extends AzExtTreeItem {
export declare abstract class AzExtParentTreeItem extends AzExtTreeItem implements IAzExtParentTreeItem {
//#region Properties implemented by base class

@@ -499,3 +644,3 @@ /**

*/
export function addExtensionValueToMask(...values: (string | undefined)[]): void;
export declare function addExtensionValueToMask(...values: (string | undefined)[]): void;

@@ -631,3 +776,3 @@ /**

interface IHandlerContext extends IActionContext {
export interface IHandlerContext extends IActionContext {
/**

@@ -639,3 +784,3 @@ * The id for the callback, used as the id for the telemetry event. This may be modified by any handler

interface IErrorHandlerContext extends IHandlerContext {
export interface IErrorHandlerContext extends IHandlerContext {
/**

@@ -657,3 +802,3 @@ * The error to be handled. This may be modified by any handler

*/
export function registerOnActionStartHandler(handler: OnActionStartHandler): Disposable;
export declare function registerOnActionStartHandler(handler: OnActionStartHandler): Disposable;

@@ -664,3 +809,3 @@ /**

*/
export function registerErrorHandler(handler: ErrorHandler): Disposable;
export declare function registerErrorHandler(handler: ErrorHandler): Disposable;

@@ -671,3 +816,3 @@ /**

*/
export function registerTelemetryHandler(handler: TelemetryHandler): Disposable;
export declare function registerTelemetryHandler(handler: TelemetryHandler): Disposable;

@@ -895,28 +1040,5 @@ export declare function parseError(error: any): IParsedError;

export interface ActivityTreeItemOptions {
label: string;
contextValuesToAdd?: string[];
collapsibleState?: TreeItemCollapsibleState;
getChildren?: (parent: AzExtParentTreeItem) => AzExtTreeItem[] | Promise<AzExtTreeItem[]>;
}
type ActivityEventData<T> = ActivityTreeItemOptions & T;
export type OnStartActivityData = ActivityEventData<{}>;
export type OnProgressActivityData = ActivityEventData<{ message?: string }>;
export type OnSuccessActivityData = ActivityEventData<{}>;
export type OnErrorActivityData = ActivityEventData<{ error: unknown }>;
export declare interface Activity {
id: string;
cancellationTokenSource?: CancellationTokenSource;
onStart: Event<OnStartActivityData>;
onProgress: Event<OnProgressActivityData>;
onSuccess: Event<OnSuccessActivityData>;
onError: Event<OnErrorActivityData>;
}
export type ActivityTask<R> = (progress: Progress<{ message?: string, increment?: number }>, cancellationToken: CancellationToken) => Promise<R>;
export abstract class ActivityBase<R> implements Activity {
export declare abstract class ActivityBase<R> implements Activity {
public readonly onStart: Event<OnStartActivityData>;

@@ -1170,3 +1292,3 @@ public readonly onProgress: Event<OnProgressActivityData>;

*/
export function createApiProvider(azExts: AzureExtensionApi[]): AzureExtensionApiProvider;
export declare function createApiProvider(azExts: AzureExtensionApi[]): AzureExtensionApiProvider;

@@ -1193,3 +1315,3 @@ /**

*/
export function createAzExtOutputChannel(name: string, extensionPrefix: string): IAzExtOutputChannel;
export declare function createAzExtOutputChannel(name: string, extensionPrefix: string): IAzExtOutputChannel;

@@ -1201,5 +1323,5 @@ /**

*/
export function openReadOnlyJson(node: { label: string, fullId: string }, data: {}): Promise<void>;
export declare function openReadOnlyJson(node: { label: string, fullId: string }, data: {}): Promise<void>;
export class ReadOnlyContent {
export declare class ReadOnlyContent {
public append(content: string): Promise<void>;

@@ -1216,3 +1338,3 @@ public clear(): void;

*/
export function openReadOnlyContent(node: { label: string, fullId: string }, content: string, fileExtension: string, options?: TextDocumentShowOptions): Promise<ReadOnlyContent>;
export declare function openReadOnlyContent(node: { label: string, fullId: string }, content: string, fileExtension: string, options?: TextDocumentShowOptions): Promise<ReadOnlyContent>;

@@ -1350,3 +1472,3 @@ /**

*/
export function registerReportIssueCommand(commandId: string): void;
export declare function registerReportIssueCommand(commandId: string): void;

@@ -1366,5 +1488,5 @@ /**

export function maskValue(data: string, valueToMask: string | undefined): string;
export declare function maskValue(data: string, valueToMask: string | undefined): string;
export function openUrl(url: string): Promise<void>;
export declare function openUrl(url: string): Promise<void>;

@@ -1375,3 +1497,3 @@ /**

*/
export function nonNullProp<TSource, TKey extends keyof TSource>(source: TSource, name: TKey): NonNullable<TSource[TKey]>;
export declare function nonNullProp<TSource, TKey extends keyof TSource>(source: TSource, name: TKey): NonNullable<TSource[TKey]>;

@@ -1381,3 +1503,3 @@ /**

*/
export function nonNullValue<T>(value: T | undefined, propertyNameOrMessage?: string): T;
export declare function nonNullValue<T>(value: T | undefined, propertyNameOrMessage?: string): T;

@@ -1387,3 +1509,3 @@ /**

*/
export function nonNullOrEmptyValue(value: string | undefined, propertyNameOrMessage?: string): string;
export declare function nonNullOrEmptyValue(value: string | undefined, propertyNameOrMessage?: string): string;

@@ -1397,2 +1519,12 @@ /**

*/
export function findFreePort(startPort?: number, maxAttempts?: number, timeout?: number): Promise<number>;
export declare function findFreePort(startPort?: number, maxAttempts?: number, timeout?: number): Promise<number>;
/**
* @param message Message to display in the confirmation modal
* ex: `Are you sure you want to delete function app "{0}"?`
*/
export declare class DeleteConfirmationStep extends AzureWizardPromptStep<IActionContext> {
public constructor(message: string);
public prompt(wizardContext: IActionContext): Promise<void>;
public shouldPrompt(wizardContext: IActionContext): boolean;
}

@@ -8,3 +8,2 @@ "use strict";

exports.ExecuteActivity = void 0;
const vscode_1 = require("vscode");
const localize_1 = require("../../localize");

@@ -22,3 +21,2 @@ const GenericTreeItem_1 = require("../../tree/GenericTreeItem");

label: this.label,
collapsibleState: vscode_1.TreeItemCollapsibleState.None,
};

@@ -30,3 +28,2 @@ }

label: this.label,
collapsibleState: activityResult ? vscode_1.TreeItemCollapsibleState.Expanded : vscode_1.TreeItemCollapsibleState.None,
getChildren: activityResult ? ((parent) => {

@@ -51,3 +48,2 @@ const appResource = {

label: this.label,
collapsibleState: vscode_1.TreeItemCollapsibleState.Expanded,
getChildren: (parent) => {

@@ -54,0 +50,0 @@ return [

@@ -53,3 +53,4 @@ "use strict";

__exportStar(require("./activityLog/Activity"), exports);
__exportStar(require("./wizard/DeleteConfirmationStep"), exports);
// NOTE: The auto-fix action "source.organizeImports" does weird things with this file, but there doesn't seem to be a way to disable it on a per-file basis so we'll just let it happen
//# sourceMappingURL=index.js.map
{
"name": "@microsoft/vscode-azext-utils",
"author": "Microsoft Corporation",
"version": "0.1.2",
"version": "0.2.0",
"description": "Common UI tools for developing Azure extensions for VS Code",

@@ -6,0 +6,0 @@ "tags": [

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