Create package for consuming extension API (#530)

This commit is contained in:
Alex Weininger 2023-01-30 11:31:13 -08:00 коммит произвёл GitHub
Родитель e13a79cd0a
Коммит 4c48d4364e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
61 изменённых файлов: 2029 добавлений и 772 удалений

Просмотреть файл

@ -1,2 +1,5 @@
gulpfile.ts
.eslintrc.js
out
dist
vscode-azureresources-api.d.ts

2
.vscode/settings.json поставляемый
Просмотреть файл

@ -14,6 +14,6 @@
"**/node_modules": true,
".vscode-test": true
},
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.importModuleSpecifier": "project-relative",
"typescript.tsdk": "node_modules/typescript/lib"
}

20
api/.npmignore Normal file
Просмотреть файл

@ -0,0 +1,20 @@
node_modules/
.vscode/
src/
tsconfig.json
*.tgz
test/
out/test/
**/*.js.map
.vscode-test/
gulpfile.js
test-results.xml
.eslintignore
.eslintrc.js
resources/*.png
*.tsbuildinfo
out/**/*.d.ts
out/**/*.d.ts.map
out/**/*.js.map
api-extractor.json

398
api/api-extractor.json Normal file
Просмотреть файл

@ -0,0 +1,398 @@
/**
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
/**
* Optionally specifies another JSON config file that this file extends from. This provides a way for
* standard settings to be shared across multiple projects.
*
* If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
* the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
* resolved using NodeJS require().
*
* SUPPORTED TOKENS: none
* DEFAULT VALUE: ""
*/
// "extends": "./shared/api-extractor-base.json"
// "extends": "my-package/include/api-extractor-base.json"
/**
* Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
* typically contains the tsconfig.json and package.json config files, but the path is user-defined.
*
* The path is resolved relative to the folder of the config file that contains the setting.
*
* The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
* parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
* that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
* will be reported.
*
* SUPPORTED TOKENS: <lookup>
* DEFAULT VALUE: "<lookup>"
*/
// "projectFolder": "..",
/**
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
* analyzes the symbols exported by this module.
*
* The file extension must be ".d.ts" and not ".ts".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
*/
"mainEntryPointFilePath": "<projectFolder>/out/src/index.d.ts",
/**
* A list of NPM package names whose exports should be treated as part of this package.
*
* For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
* and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
* of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
* imports library2. To avoid this, we can specify:
*
* "bundledPackages": [ "library2" ],
*
* This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
* local files for library1.
*/
"bundledPackages": [],
/**
* Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
* will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
* To use the OS's default newline kind, specify "os".
*
* DEFAULT VALUE: "crlf"
*/
// "newlineKind": "crlf",
/**
* Set to true when invoking API Extractor's test harness. When `testMode` is true, the `toolVersion` field in the
* .api.json file is assigned an empty string to prevent spurious diffs in output files tracked for tests.
*
* DEFAULT VALUE: "false"
*/
// "testMode": false,
/**
* Specifies how API Extractor sorts members of an enum when generating the .api.json file. By default, the output
* files will be sorted alphabetically, which is "by-name". To keep the ordering in the source code, specify
* "preserve".
*
* DEFAULT VALUE: "by-name"
*/
// "enumMemberOrder": "by-name",
/**
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
*/
"compiler": {
/**
* Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* Note: This setting will be ignored if "overrideTsconfig" is used.
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
*/
"tsconfigFilePath": "<projectFolder>/tsconfig.json"
/**
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
* The object must conform to the TypeScript tsconfig schema:
*
* http://json.schemastore.org/tsconfig
*
* If omitted, then the tsconfig.json file will be read from the "projectFolder".
*
* DEFAULT VALUE: no overrideTsconfig section
*/
// "overrideTsconfig": {
// . . .
// }
/**
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
* and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
* dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
* for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
*
* DEFAULT VALUE: false
*/
// "skipLibCheck": true,
},
/**
* Configures how the API report file (*.api.md) will be generated.
*/
"apiReport": {
/**
* (REQUIRED) Whether to generate an API report.
*/
"enabled": false
/**
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
* a full file path.
*
* The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
*
* SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<unscopedPackageName>.api.md"
*/
// "reportFileName": "<unscopedPackageName>.api.md",
/**
* Specifies the folder where the API report file is written. The file name portion is determined by
* the "reportFileName" setting.
*
* The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
* e.g. for an API review.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/"
*/
// "reportFolder": "<projectFolder>/temp/",
/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by
* the "reportFileName" setting.
*
* After the temporary file is written to disk, it is compared with the file in the "reportFolder".
* If they are different, a production build will fail.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/"
*/
// "reportTempFolder": "<projectFolder>/temp/",
/**
* Whether "forgotten exports" should be included in the API report file. Forgotten exports are declarations
* flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to
* learn more.
*
* DEFAULT VALUE: "false"
*/
// "includeForgottenExports": false
},
/**
* Configures how the doc model file (*.api.json) will be generated.
*/
"docModel": {
/**
* (REQUIRED) Whether to generate a doc model file.
*/
"enabled": false
/**
* The output path for the doc model file. The file extension should be ".api.json".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
*/
// "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json",
/**
* Whether "forgotten exports" should be included in the doc model file. Forgotten exports are declarations
* flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to
* learn more.
*
* DEFAULT VALUE: "false"
*/
// "includeForgottenExports": false,
/**
* The base URL where the project's source code can be viewed on a website such as GitHub or
* Azure DevOps. This URL path corresponds to the `<projectFolder>` path on disk.
*
* This URL is concatenated with the file paths serialized to the doc model to produce URL file paths to individual API items.
* For example, if the `projectFolderUrl` is "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor" and an API
* item's file path is "api/ExtractorConfig.ts", the full URL file path would be
* "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor/api/ExtractorConfig.js".
*
* Can be omitted if you don't need source code links in your API documentation reference.
*
* SUPPORTED TOKENS: none
* DEFAULT VALUE: ""
*/
// "projectFolderUrl": "http://github.com/path/to/your/projectFolder"
},
/**
* Configures how the .d.ts rollup file will be generated.
*/
"dtsRollup": {
/**
* (REQUIRED) Whether to generate the .d.ts rollup file.
*/
"enabled": true,
/**
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
* This file will include all declarations that are exported by the main entry point.
*
* If the path is an empty string, then this file will not be written.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
*/
"untrimmedFilePath": "",
/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release.
* This file will include only declarations that are marked as "@public", "@beta", or "@alpha".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
// "alphaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-alpha.d.ts",
/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
* This file will include only declarations that are marked as "@public" or "@beta".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
// "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
* This file will include only declarations that are marked as "@public".
*
* If the path is an empty string, then this file will not be written.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts"
/**
* When a declaration is trimmed, by default it will be replaced by a code comment such as
* "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
* declaration completely.
*
* DEFAULT VALUE: false
*/
// "omitTrimmingComments": true
},
/**
* Configures how the tsdoc-metadata.json file will be generated.
*/
"tsdocMetadata": {
/**
* Whether to generate the tsdoc-metadata.json file.
*
* DEFAULT VALUE: true
*/
"enabled": false
/**
* Specifies where the TSDoc metadata file should be written.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
* "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
* falls back to "tsdoc-metadata.json" in the package folder.
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<lookup>"
*/
// "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
},
/**
* Configures how API Extractor reports error and warning messages produced during analysis.
*
* There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
*/
"messages": {
/**
* Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
* the input .d.ts files.
*
* TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
*
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
*/
"compilerMessageReporting": {
/**
* Configures the default routing for messages that don't match an explicit rule in this table.
*/
"default": {
/**
* Specifies whether the message should be written to the the tool's output log. Note that
* the "addToApiReportFile" property may supersede this option.
*
* Possible values: "error", "warning", "none"
*
* Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
* and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
* the "--local" option), the warning is displayed but the build will not fail.
*
* DEFAULT VALUE: "warning"
*/
"logLevel": "warning"
/**
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
* then the message will be written inside that file; otherwise, the message is instead logged according to
* the "logLevel" option.
*
* DEFAULT VALUE: false
*/
// "addToApiReportFile": false
}
// "TS2551": {
// "logLevel": "warning",
// "addToApiReportFile": true
// },
//
// . . .
},
/**
* Configures handling of messages reported by API Extractor during its analysis.
*
* API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
*
* DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
*/
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
// "addToApiReportFile": false
},
"ae-unresolved-link": {
"logLevel": "none"
},
"ae-missing-release-tag": {
"logLevel": "none"
}
//
// . . .
},
/**
* Configures handling of messages reported by the TSDoc parser when analyzing code comments.
*
* TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
*
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
*/
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
// "addToApiReportFile": false
}
// "tsdoc-link-tag-unescaped-text": {
// "logLevel": "warning",
// "addToApiReportFile": true
// },
//
// . . .
}
}
}

20
api/package.json Normal file
Просмотреть файл

@ -0,0 +1,20 @@
{
"name": "@microsoft/vscode-azureresources-api",
"version": "2.0.0",
"description": "Type declarations and client library for the Azure Resources extension API",
"main": "out/index.js",
"types": "dist/vscode-azureresources-api.d.ts",
"scripts": {
"prepack": "npm run api-extractor",
"api-extractor": "npm run build && api-extractor run",
"build": "tsc -p ./"
},
"author": "Microsoft",
"license": "MIT",
"devDependencies": {
"@azure/ms-rest-azure-env": "^2.0.0",
"@microsoft/vscode-azext-utils": "^0.4.0",
"@types/node": "^16.0.0",
"@types/vscode": "^1.64.0"
}
}

Просмотреть файл

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Normalized type for Azure resources that uniquely identifies resource type for the purposes
* of the Azure extensions
*/
export enum AzExtResourceType {
AppServices = 'AppServices',
AzureCosmosDb = 'AzureCosmosDb',
ContainerApps = 'ContainerApps',
ContainerAppsEnvironment = 'ContainerAppsEnvironment',
FunctionApp = 'FunctionApp',
PostgresqlServersFlexible = 'PostgresqlServersFlexible',
PostgresqlServersStandard = 'PostgresqlServersStandard',
StaticWebApps = 'StaticWebApps',
StorageAccounts = 'StorageAccounts',
VirtualMachines = 'VirtualMachines',
ResourceGroup = 'ResourceGroup',
// Below are not supported but have icons in the Resources extension
ApiManagementService = 'ApiManagementService',
ApplicationInsights = 'ApplicationInsights',
AppServiceKubernetesEnvironment = 'AppServiceKubernetesEnvironment',
AppServicePlans = 'AppServicePlans',
AvailabilitySets = 'AvailabilitySets',
BatchAccounts = 'BatchAccounts',
CacheRedis = 'CacheRedis',
ContainerRegistry = 'ContainerRegistry',
ContainerServiceManagedClusters = 'ContainerServiceManagedClusters',
CustomLocations = 'CustomLocations',
DeviceIotHubs = 'DeviceIotHubs',
DevTestLabs = 'DevTestLabs',
Disks = 'Disks',
EventGridDomains = 'EventGridDomains',
EventGridEventSubscriptions = 'EventGridEventSubscriptions',
EventGridTopics = 'EventGridTopics',
EventHubNamespaces = 'EventHubNamespaces',
FrontDoorAndCdnProfiles = 'FrontDoorAndCdnProfiles',
Images = 'Images',
KeyVaults = 'KeyVaults',
KubernetesConnectedClusters = 'KubernetesConnectedClusters',
LoadBalancers = 'LoadBalancers',
LogicApp = 'LogicApp',
LogicWorkflows = 'LogicWorkflows',
ManagedIdentityUserAssignedIdentities = 'ManagedIdentityUserAssignedIdentities',
MysqlServers = 'MysqlServers',
NetworkApplicationGateways = 'NetworkApplicationGateways',
NetworkApplicationSecurityGroups = 'NetworkApplicationSecurityGroups',
NetworkInterfaces = 'NetworkInterfaces',
NetworkLocalNetworkGateways = 'NetworkLocalNetworkGateways',
NetworkPublicIpPrefixes = 'NetworkPublicIpPrefixes',
NetworkRouteTables = 'NetworkRouteTables',
NetworkSecurityGroups = 'NetworkSecurityGroups',
NetworkVirtualNetworkGateways = 'NetworkVirtualNetworkGateways',
NetworkWatchers = 'NetworkWatchers',
NotificationHubNamespaces = 'NotificationHubNamespaces',
OperationalInsightsWorkspaces = 'OperationalInsightsWorkspaces',
OperationsManagementSolutions = 'OperationsManagementSolutions',
PublicIpAddresses = 'PublicIpAddresses',
ServiceBusNamespaces = 'ServiceBusNamespaces',
ServiceFabricClusters = 'ServiceFabricClusters',
ServiceFabricMeshApplications = 'ServiceFabricMeshApplications',
SignalRService = 'SignalRService',
SpringApps = 'SpringApps',
SqlDatabases = 'SqlDatabases',
SqlServers = 'SqlServers',
VirtualMachineScaleSets = 'VirtualMachineScaleSets',
VirtualNetworks = 'VirtualNetworks',
WebHostingEnvironments = 'WebHostingEnvironments',
}

16
api/src/activity.ts Normal file
Просмотреть файл

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// TODO: move Activity related declarations to this package
import type { Activity } from "@microsoft/vscode-azext-utils/hostapi";
export interface ActivityApi {
/**
* Registers an activity to appear in the activity window.
*
* @param activity - The activity information to show.
*/
registerActivity(activity: Activity): Promise<void>;
}

16
api/src/extensionApi.ts Normal file
Просмотреть файл

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { ActivityApi } from "./activity";
import type { ResourcesApi } from "./resources/resourcesApi";
import { AzureExtensionApi } from "./utils/apiUtils";
/**
* The current (v2) Azure Resources extension API.
*/
export interface AzureResourcesExtensionApi extends AzureExtensionApi {
activity: ActivityApi;
resources: ResourcesApi;
}

16
api/src/index.ts Normal file
Просмотреть файл

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export * from './activity';
export * from './AzExtResourceType';
export * from './extensionApi';
export * from './resources/azure';
export * from './resources/base';
export * from './resources/resourcesApi';
export * from './resources/workspace';
export * from './utils/apiUtils';
export * from './utils/getApi';
export * from './utils/wrapper';

156
api/src/resources/azure.ts Normal file
Просмотреть файл

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { Environment } from '@azure/ms-rest-azure-env';
import * as vscode from 'vscode';
import type { AzExtResourceType } from '../AzExtResourceType';
import type { BranchDataProvider, ResourceBase, ResourceModelBase } from './base';
/**
* Represents a means of obtaining authentication data for an Azure subscription.
*/
export interface AzureAuthentication {
/**
* Gets a VS Code authentication session for an Azure subscription.
*
* @param scopes - The scopes for which the authentication is needed.
*
* @returns A VS Code authentication session or undefined, if none could be obtained.
*/
getSession(scopes?: string[]): vscode.ProviderResult<vscode.AuthenticationSession>;
}
/**
* Represents an Azure subscription.
*/
export interface AzureSubscription {
/**
* Access to the authentication session associated with this subscription.
*/
readonly authentication: AzureAuthentication;
/**
* The Azure environment to which this subscription belongs.
*/
readonly environment: Environment;
/**
* Whether this subscription belongs to a custom cloud.
*/
readonly isCustomCloud: boolean;
/**
* The display name of this subscription.
*/
readonly name: string;
/**
* The ID of this subscription.
*/
readonly subscriptionId: string;
/**
* The tenant to which this subscription belongs or undefined, if not associated with a specific tenant.
*/
readonly tenantId: string;
}
/**
* Represents a type of resource as designated by Azure.
*/
export interface AzureResourceType {
/**
* The kinds of resources that this type can represent.
*/
readonly kinds?: string[];
/**
* The (general) type of resource.
*/
readonly type: string;
}
/**
* Represents an individual resource in Azure.
*/
export interface AzureResource extends ResourceBase {
/**
* The Azure-designated type of this resource.
*/
readonly azureResourceType: AzureResourceType;
/**
* The location in which this resource exists.
*/
readonly location?: string;
/**
* The resource group to which this resource belongs.
*/
readonly resourceGroup?: string;
/**
* The type of this resource.
*
* @remarks This value is used to map resources to their associated branch data provider.
*/
readonly resourceType?: AzExtResourceType;
/**
* The Azure subscription to which this resource belongs.
*/
readonly subscription: AzureSubscription;
/**
* The tags associated with this resource.
*/
readonly tags?: {
[propertyName: string]: string;
};
/**
* A copy of the raw resource.
*/
readonly raw: {};
}
export interface ViewPropertiesModel {
/**
* File name displayed in VS Code.
*/
label: string;
/**
* Raw data associated with the resource to populate the properties file.
*/
data: {};
}
/**
* Represents a model of an individual Azure resource or its child items.
*/
export interface AzureResourceModel extends ResourceModelBase {
/**
* The Azure ID of this resource.
*
* @remarks This property is expected to be implemented on "application-level" resources, but may also be applicable to its child items.
*/
readonly azureResourceId?: string;
/**
* The URL of the area of Azure portal related to this item.
*/
readonly portalUrl?: vscode.Uri;
/**
* Define to enable the "View Properties" command.
*/
readonly viewProperties?: ViewPropertiesModel;
}
/**
* A provider for visualizing items in the Azure resource tree (e.g. Cosmos DB, Storage, etc.).
*/
export type AzureResourceBranchDataProvider<TModel extends AzureResourceModel> = BranchDataProvider<AzureResource, TModel>;

78
api/src/resources/base.ts Normal file
Просмотреть файл

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
/**
* Represents the base type for all Azure and workspace resources.
*/
export interface ResourceBase {
/**
* The ID of this resource.
*
* @remarks This value should be unique across all resources.
*/
readonly id: string;
/**
* The display name of this resource.
*/
readonly name: string;
}
/**
* Represents the base type for models of resources and their child items.
*/
export interface ResourceModelBase {
/**
* The ID of this model.
*
* @remarks This value should be unique across all models of its type.
*/
readonly id?: string;
}
/**
* The base interface for providers of Azure and workspace resources.
*/
export interface ResourceProvider<TResourceSource, TResource extends ResourceBase> {
/**
* Fired when the provider's resources have changed.
*/
readonly onDidChangeResource?: vscode.Event<TResource | undefined>;
/**
* Called to supply the resources used as the basis for the resource views.
*
* @param source - The source from which resources should be generated.
*
* @returns The resources to be displayed in the resource view.
*/
getResources(source: TResourceSource): vscode.ProviderResult<TResource[]>;
}
/**
* The base interface for visualizers of Azure and workspace resources.
*/
export interface BranchDataProvider<TResource extends ResourceBase, TModel extends ResourceModelBase> extends vscode.TreeDataProvider<TModel> {
/**
* Get the children of `element`.
*
* @param element - The element from which the provider gets children. Unlike a traditional tree data provider, this will never be `undefined`.
*
* @returns Children of `element`.
*/
getChildren(element: TModel): vscode.ProviderResult<TModel[]>;
/**
* Called to get the provider's model element for a specific resource.
*
* @remarks getChildren() assumes that the provider passes a known (TModel) model item, or undefined when getting the "root" children.
* However, branch data providers have no "root" so this function is called for each matching resource to obtain a starting branch item.
*
* @returns The provider's model element for `resource`.
*/
getResourceItem(element: TResource): TModel | Thenable<TModel>;
}

Просмотреть файл

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from "vscode";
import { AzExtResourceType } from "../AzExtResourceType";
import { AzureResourceBranchDataProvider, AzureResourceModel } from "./azure";
import { WorkspaceResourceBranchDataProvider, WorkspaceResourceModel, WorkspaceResourceProvider, WorkspaceResourceType } from "./workspace";
// scope down vscode.TreeDataProvider to exactly what's allowed to be used
export type ResourceGroupsTreeDataProvider = Pick<vscode.TreeDataProvider<unknown>, 'getChildren' | 'getTreeItem'>;
export type VSCodeRevealOptions = Parameters<vscode.TreeView<unknown>['reveal']>['1'];
export interface ResourcesApi {
/**
* {@link vscode.TreeDataProvider} representing the Azure tree view.
*/
readonly azureResourceTreeDataProvider: ResourceGroupsTreeDataProvider;
/**
* Registers an Azure resource branch data provider.
*
* @param type - The Azure resource type associated with the provider. Must be unique.
* @param resolver - The branch data provider for the resource type.
*
* @returns A disposable that unregisters the provider.
*/
registerAzureResourceBranchDataProvider<TModel extends AzureResourceModel>(type: AzExtResourceType, provider: AzureResourceBranchDataProvider<TModel>): vscode.Disposable;
/**
* {@link vscode.TreeDataProvider} representing the Workspace tree view.
*/
readonly workspaceResourceTreeDataProvider: ResourceGroupsTreeDataProvider;
/**
* Registers a provider of workspace resources.
*
* @param provider - The resource provider.
*
* @returns A disposable that unregisters the provider.
*/
registerWorkspaceResourceProvider(provider: WorkspaceResourceProvider): vscode.Disposable;
/**
* Registers a workspace resource branch data provider.
*
* @param type - The workspace resource type associated with the provider. Must be unique.
* @param provider - The branch data provider for the resource type.
*
* @returns A disposable that unregisters the provider.
*/
registerWorkspaceResourceBranchDataProvider<TModel extends WorkspaceResourceModel>(type: WorkspaceResourceType, provider: WorkspaceResourceBranchDataProvider<TModel>): vscode.Disposable;
/**
* Reveal a resource in the Azure tree view. Works with subscriptions, resource groups, or resources.
*
* @param id - The Azure Resource ID to reveal in the Azure tree view.
* @param options - Options for revealing the resource. See {@link vscode.TreeView.reveal}
*/
revealAzureResource(id: string, options?: VSCodeRevealOptions): Promise<void>;
}

Просмотреть файл

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import type { BranchDataProvider, ResourceBase, ResourceModelBase, ResourceProvider } from './base';
/**
* Respresents a specific type of workspace resource.
*
* @remarks This value should be unique across all types of workspace resources.
*/
export type WorkspaceResourceType = string;
/**
* An indivdual root resource for a workspace.
*/
export interface WorkspaceResource extends ResourceBase {
/**
* The folder to which this resource belongs.
* Leave undefined if this resource is a global or system-level resource
* not associated with a specific workspace folder.
*/
readonly folder?: vscode.WorkspaceFolder;
/**
* The type of this resource.
*
* @remarks This value is used to map resources to their associated branch data provider.
*/
readonly resourceType: WorkspaceResourceType;
}
/**
* Represents a model of an individual workspace resource or its child items.
*/
export type WorkspaceResourceModel = ResourceModelBase;
/**
* A provider for supplying items for the workspace resource tree (e.g., storage emulator, function apps in workspace, etc.).
*/
export type WorkspaceResourceProvider = ResourceProvider<void, WorkspaceResource>;
/**
* A provider for visualizing items in the workspace resource tree (e.g., storage emulator, function apps in workspace, etc.).
*/
export type WorkspaceResourceBranchDataProvider<TModel extends WorkspaceResourceModel> = BranchDataProvider<WorkspaceResource, TModel>;

80
api/src/utils/apiUtils.ts Normal file
Просмотреть файл

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from "vscode";
export interface AzureExtensionApi {
/**
* The API version for this extension. It should be versioned separately from the extension and ideally remains backwards compatible.
*/
apiVersion: string;
}
export interface GetApiOptions {
/**
* The ID of the extension requesting the API.
*
* @remarks This is used for telemetry purposes, to measure which extensions are using the API.
*/
readonly extensionId?: string;
}
export namespace apiUtils {
export interface AzureExtensionApiProvider {
/**
* Provides the API for an Azure Extension.
*
* @param apiVersionRange - The version range of the API you need. Any semver syntax is allowed. For example "1" will return any "1.x.x" version or "1.2" will return any "1.2.x" version
* @param options - Options for initializing the API. See {@link GetApiOptions}
* @throws - Error if a matching version is not found.
*/
getApi<T extends AzureExtensionApi>(apiVersionRange: string, options?: GetApiOptions): T;
}
export class ExtensionNotFoundError extends Error {
constructor(extensionId: string) {
super(`Extension with id ${extensionId} not found.`);
}
}
/**
* Gets the exported API from the given extension id and version range.
*
* @param extensionId - The extension id to get the API from
* @param apiVersionRange - The version range of the API you need. Any semver syntax is allowed. For example "1" will return any "1.x.x" version or "1.2" will return any "1.2.x" version
* @param options - The options to pass when creating the API. If `options.extensionId` is left undefined, it's set to the caller extension id.
* @throws Error if extension with id is not installed.
*/
export async function getAzureExtensionApi<T extends AzureExtensionApi>(context: vscode.ExtensionContext, extensionId: string, apiVersionRange: string, options?: GetApiOptions): Promise<T> {
const apiProvider: AzureExtensionApiProvider | undefined = await getExtensionExports(extensionId);
if (apiProvider) {
return apiProvider.getApi<T>(apiVersionRange, {
...options,
extensionId: options?.extensionId ?? context.extension.id
});
}
throw new ExtensionNotFoundError(extensionId);
}
/**
* Get extension exports for the extension with the given id. Activates extension first if needed.
*
* @returns `undefined` if the extension is not installed
*/
export async function getExtensionExports<T>(extensionId: string): Promise<T | undefined> {
const extension: vscode.Extension<T> | undefined = vscode.extensions.getExtension(extensionId);
if (extension) {
if (!extension.isActive) {
await extension.activate();
}
return extension.exports;
}
return undefined;
}
}

12
api/src/utils/getApi.ts Normal file
Просмотреть файл

@ -0,0 +1,12 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import type { AzureResourcesExtensionApi } from '../extensionApi';
import { apiUtils, GetApiOptions } from "./apiUtils";
export async function getAzureResourcesExtensionApi(extensionContext: vscode.ExtensionContext, apiVersionRange: '2.0.0', options?: GetApiOptions): Promise<AzureResourcesExtensionApi> {
return apiUtils.getAzureExtensionApi<AzureResourcesExtensionApi>(extensionContext, 'ms-azuretools.vscode-azureresourcegroups', apiVersionRange, options);
}

53
api/src/utils/wrapper.ts Normal file
Просмотреть файл

@ -0,0 +1,53 @@
/**
* Interface describing an object that wraps another object.
*
* The host extension will wrap all tree nodes provided by the client
* extensions. When commands are executed, the wrapper objects are
* sent directly to the client extension, which will need to unwrap
* them. The `registerCommandWithTreeNodeUnwrapping` method below, used
* in place of `registerCommand`, will intelligently do this
* unwrapping automatically (i.e., will not unwrap if the arguments
* aren't wrappers)
*/
export declare interface Wrapper {
unwrap<T>(): T;
}
export function isWrapper(maybeWrapper: unknown): maybeWrapper is Wrapper {
if (maybeWrapper && typeof maybeWrapper === 'object' &&
(maybeWrapper as Wrapper).unwrap && typeof (maybeWrapper as Wrapper).unwrap === 'function') {
return true;
}
return false;
}
export function unwrapArgs<T>(args?: unknown[]): [node?: T, nodes?: T[], ...args: unknown[]] {
const maybeNodeWrapper = args?.[0];
const maybeNodeWrapperArray = args?.[1];
const remainingArgs = args?.slice(2) ?? [];
let node: T | undefined;
if (maybeNodeWrapper && isWrapper(maybeNodeWrapper)) {
// If the first arg is a wrapper, unwrap it
node = maybeNodeWrapper.unwrap<T>();
} else if (maybeNodeWrapper) {
// Otherwise, assume it is just a T
node = maybeNodeWrapper as T;
}
let nodes: T[] | undefined;
if (maybeNodeWrapperArray && Array.isArray(maybeNodeWrapperArray) && maybeNodeWrapperArray.every(n => isWrapper(n))) {
// If the first arg is an array of wrappers, unwrap them
const wrappedNodes = maybeNodeWrapperArray as Wrapper[];
nodes = [];
for (const n of wrappedNodes) {
nodes.push(n.unwrap<T>())
}
} else if (maybeNodeWrapperArray && Array.isArray(maybeNodeWrapperArray)) {
// Otherwise, assume it is just an array of T's
nodes = maybeNodeWrapperArray as T[];
}
return [node, nodes, ...remainingArgs];
}

15
api/tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,15 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"rootDir": ".",
"outDir": "out",
"baseUrl": "./",
},
"exclude": [
"node_modules",
"out",
"dist",
]
}

6
hostapi.v2.internal.d.ts поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
import { AzureResource, AzureResourcesApi, AzureResourcesHostApi, AzureSubscription, ResourceProvider } from "@microsoft/vscode-azext-utils/hostapi.v2";
import * as vscode from 'vscode';
import { AzureResource, AzureResourcesExtensionApi, AzureSubscription, ResourceProvider, ResourcesApi } from "./api/src/index";
// v2 types that are internal to resource groups (for now)
@ -8,7 +8,7 @@ import * as vscode from 'vscode';
*/
export type AzureResourceProvider = ResourceProvider<AzureSubscription, AzureResource>;
export interface AzureResourcesHostApiInternal extends AzureResourcesHostApi {
export interface AzureResourcesHostApiInternal extends ResourcesApi {
/**
* Registers a provider of Azure resources.
*
@ -19,6 +19,6 @@ export interface AzureResourcesHostApiInternal extends AzureResourcesHostApi {
registerAzureResourceProvider(provider: AzureResourceProvider): vscode.Disposable;
}
export interface AzureResourcesApiInternal extends AzureResourcesApi {
export interface AzureResourcesApiInternal extends AzureResourcesExtensionApi {
resources: AzureResourcesHostApiInternal;
}

1614
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -535,11 +535,13 @@
"webpack": "npm run build && gulp webpack-dev",
"webpack-prod": "npm run build && gulp webpack-prod",
"webpack-profile": "webpack --profile --json --mode production > webpack-stats.json && echo Use http://webpack.github.io/analyse to analyze the stats",
"all": "npm i && npm run lint && npm test"
"all": "npm i && npm run lint && npm test",
"api-extractor": "tsc -p ./api && api-extractor run -c ./api/api-extractor.json"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.33.8",
"@microsoft/eslint-config-azuretools": "^0.1.0",
"@microsoft/vscode-azext-dev": "^0.1.4",
"@microsoft/vscode-azext-dev": "^0.1.5",
"@types/gulp": "^4.0.6",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.0",
@ -554,7 +556,8 @@
"mocha": "^10.1.0",
"mocha-junit-reporter": "^1.23.1",
"mocha-multi-reporters": "^1.1.7",
"ts-node": "^7.0.1",
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "^4.3.5",
"vsce": "^2.11.0",
"webpack": "^5.28.0",

Просмотреть файл

@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType, IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { AzureExtensionApiProvider } from "@microsoft/vscode-azext-utils/api";
import { AppResource } from "@microsoft/vscode-azext-utils/hostapi";
import { AzureResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { commands, Extension, extensions } from "vscode";
import { AzExtResourceType, AzureResource } from '../api/src/index';
import { azureExtensions, IAzExtMetadata, IAzExtTutorial } from "./azureExtensions";
import { contributesKey } from "./constants";

Просмотреть файл

@ -6,8 +6,8 @@
import { GenericResource, ResourceGroup } from '@azure/arm-resources';
import { getResourceGroupFromId, uiUtils } from "@microsoft/vscode-azext-azureutils";
import { callWithTelemetryAndErrorHandling, getAzExtResourceType, IActionContext, nonNullProp } from '@microsoft/vscode-azext-utils';
import { AzureResource, AzureSubscription } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { AzureResource, AzureSubscription } from '../../api/src/index';
import { AzureResourceProvider } from '../../hostapi.v2.internal';
import { createResourceClient } from '../utils/azureClients';
import { createSubscriptionContext } from '../utils/v2/credentialsUtils';

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
import { AzExtResourceType } from '../../api/src/index';
import { contributesKey } from '../constants';
interface ResourceGroupsContribution {

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureResource, AzureSubscription, ResourceBase, ResourceProvider, WorkspaceResource, WorkspaceResourceProvider } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { AzureResource, AzureSubscription, ResourceBase, ResourceProvider, WorkspaceResource, WorkspaceResourceProvider } from '../../api/src/index';
import { AzureResourceProvider } from '../../hostapi.v2.internal';
export function isArray<T>(maybeArray: T[] | null | undefined): maybeArray is T[] {

Просмотреть файл

@ -4,8 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { SubscriptionTreeItemBase } from "@microsoft/vscode-azext-azureutils";
import { AzExtParentTreeItem, AzExtTreeDataProvider, AzExtTreeItem, IActionContext, isWrapper, ITreeItemPickerContext, PickTreeItemWithCompatibility } from "@microsoft/vscode-azext-utils";
import { AzExtParentTreeItem, AzExtTreeDataProvider, AzExtTreeItem, IActionContext, ITreeItemPickerContext, PickTreeItemWithCompatibility } from "@microsoft/vscode-azext-utils";
import { Disposable, Event, TreeItem, TreeView } from "vscode";
import { isWrapper } from "../../../api/src/index";
import { ResourceGroupsItem } from "../../tree/ResourceGroupsItem";
import { ResourceTreeDataProviderBase } from "../../tree/ResourceTreeDataProviderBase";
import { CompatibleAzureAccountTreeItem } from "./CompatibleAzureAccountTreeItem";

Просмотреть файл

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { AzExtParentTreeItem, AzExtTreeDataProvider, AzExtTreeItem, IFindTreeItemContext, ITreeItemPickerContext } from "@microsoft/vscode-azext-utils";
import { BranchDataProvider, ResourceBase, ResourceModelBase } from "@microsoft/vscode-azext-utils/hostapi.v2";
import * as vscode from 'vscode';
import { BranchDataProvider, ResourceBase, ResourceModelBase } from "../../../api/src/index";
export abstract class CompatibleBranchDataProviderBase<TResource extends ResourceBase, TModel extends AzExtTreeItem & ResourceModelBase> extends AzExtTreeDataProvider implements BranchDataProvider<TResource, TModel>, vscode.Disposable {
protected readonly overrideOnDidChangeTreeDataEmitter = new vscode.EventEmitter<TModel | undefined>();

Просмотреть файл

@ -5,7 +5,7 @@
import { AzExtTreeItem, ISubscriptionContext } from '@microsoft/vscode-azext-utils';
import type { AppResource, AppResourceResolver } from '@microsoft/vscode-azext-utils/hostapi';
import type { AzureResource, ResourceModelBase } from '@microsoft/vscode-azext-utils/hostapi.v2';
import type { AzureResource, ResourceModelBase } from '../../../../api/src/index';
import { createSubscriptionContext } from '../../../utils/v2/credentialsUtils';
import { CompatibleBranchDataProviderBase } from '../CompatibleBranchDataProviderBase';
import { CompatibleResolvedApplicationResourceTreeItem } from './CompatibleApplicationResourceTreeItem';

Просмотреть файл

@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtParentTreeItem, AzExtResourceType, AzExtTreeDataProvider, AzExtTreeItem, IActionContext, ISubscriptionContext, nonNullProp, TreeItemIconPath } from "@microsoft/vscode-azext-utils";
import { AzExtParentTreeItem, AzExtTreeDataProvider, AzExtTreeItem, IActionContext, ISubscriptionContext, nonNullProp, TreeItemIconPath } from "@microsoft/vscode-azext-utils";
import type { ResolvedAppResourceBase } from "@microsoft/vscode-azext-utils/hostapi";
import { AzureResource } from "@microsoft/vscode-azext-utils/hostapi.v2";
import { TreeItemCollapsibleState } from "vscode";
import { AzExtResourceType, AzureResource } from "../../../../api/src/index";
import { getIconPath } from "../../../utils/azureUtils";
/**

Просмотреть файл

@ -3,8 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType, AzExtTreeItem, ContextValueFilter, getAzExtResourceType, ITreeItemPickerContext, PickTreeItemWithCompatibility } from "@microsoft/vscode-azext-utils";
import { AzExtTreeItem, ContextValueFilter, getAzExtResourceType, ITreeItemPickerContext, PickTreeItemWithCompatibility } from "@microsoft/vscode-azext-utils";
import { PickAppResourceOptions } from "@microsoft/vscode-azext-utils/hostapi";
import { AzExtResourceType } from "../../../api/src/index";
import { ext } from "../../extensionVariables";
import { BranchDataItemCache } from "../../tree/BranchDataItemCache";

Просмотреть файл

@ -3,9 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType, callWithTelemetryAndErrorHandlingSync } from "@microsoft/vscode-azext-utils";
import { callWithTelemetryAndErrorHandlingSync } from "@microsoft/vscode-azext-utils";
import { AppResourceResolver } from "@microsoft/vscode-azext-utils/hostapi";
import { Disposable } from "vscode";
import { AzExtResourceType } from "../../../api/src/index";
import { ext } from "../../extensionVariables";
import { CompatibleApplicationResourceBranchDataProvider } from "./application/CompatibleApplicationResourceBranchDataProvider";

Просмотреть файл

@ -5,8 +5,8 @@
import { AzExtParentTreeItem, AzExtTreeItem } from "@microsoft/vscode-azext-utils";
import { WorkspaceResourceProvider } from "@microsoft/vscode-azext-utils/hostapi";
import { WorkspaceResource, WorkspaceResourceProvider as V2WorkspaceResourceProvider } from "@microsoft/vscode-azext-utils/hostapi.v2";
import { Event } from "vscode";
import { WorkspaceResource, WorkspaceResourceProvider as V2WorkspaceResourceProvider } from "../../../../api/src/index";
import { CompatibleWorkspaceResourceBranchDataProvider } from "./CompatibleWorkspaceResourceBranchDataProvider";
export class CompatibilityWorkspaceResourceProvider implements V2WorkspaceResourceProvider {

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import type { WorkspaceResource } from '@microsoft/vscode-azext-utils/hostapi';
import type { WorkspaceResource as v2WorkspaceResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import type { WorkspaceResource as v2WorkspaceResource } from '../../../../api/src/index';
import { CompatibleBranchDataProviderBase } from '../CompatibleBranchDataProviderBase';
export class CompatibleWorkspaceResourceBranchDataProvider<TResource extends WorkspaceResource & v2WorkspaceResource> extends CompatibleBranchDataProviderBase<TResource, TResource> {

Просмотреть файл

@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType, callWithTelemetryAndErrorHandling } from '@microsoft/vscode-azext-utils';
import { AzureResource, BranchDataProvider, ResourceModelBase, VSCodeRevealOptions, WorkspaceResource, WorkspaceResourceProvider } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { callWithTelemetryAndErrorHandling } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
import { AzExtResourceType, AzureResource, BranchDataProvider, ResourceModelBase, VSCodeRevealOptions, WorkspaceResource, WorkspaceResourceProvider } from '../../api/src/index';
import { AzureResourceProvider, AzureResourcesHostApiInternal } from '../../hostapi.v2.internal';
import { revealResource } from '../commands/revealResource';
import { AzureResourceBranchDataProviderManager } from '../tree/azure/AzureResourceBranchDataProviderManager';

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType } from "@microsoft/vscode-azext-utils";
import { AppResource } from "@microsoft/vscode-azext-utils/hostapi";
import { AzExtResourceType } from "../api/src/index";
import { localize } from "./utils/localize";
export const azureExtensions: IAzExtMetadata[] = [

Просмотреть файл

@ -5,8 +5,8 @@
import { IResourceGroupWizardContext, LocationListStep, ResourceGroupCreateStep, ResourceGroupNameStep } from '@microsoft/vscode-azext-azureutils';
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, ExecuteActivityContext, IActionContext, nonNullProp, subscriptionExperience } from '@microsoft/vscode-azext-utils';
import { AzureSubscription } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { window } from 'vscode';
import { AzureSubscription } from '../../api/src/index';
import { ext } from '../extensionVariables';
import { SubscriptionItem } from '../tree/azure/SubscriptionItem';
import { createActivityContext } from '../utils/activityUtils';

Просмотреть файл

@ -6,7 +6,7 @@
import { ResourceGroup } from '@azure/arm-resources';
import { uiUtils } from '@microsoft/vscode-azext-azureutils';
import { AzureWizard, IActionContext, IAzureQuickPickItem, nonNullProp, subscriptionExperience, UserCancelledError } from '@microsoft/vscode-azext-utils';
import { AzureResource, AzureSubscription } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { AzureResource, AzureSubscription } from '../../../../api/src/index';
import { createResourceGroup } from '../../../api/DefaultAzureResourceProvider';
import { ext } from '../../../extensionVariables';
import { GroupingItem } from '../../../tree/azure/GroupingItem';

Просмотреть файл

@ -5,8 +5,8 @@
import { uiUtils } from "@microsoft/vscode-azext-azureutils";
import { IActionContext, nonNullProp, subscriptionExperience } from "@microsoft/vscode-azext-utils";
import { AzureSubscription } from "@microsoft/vscode-azext-utils/hostapi.v2";
import { QuickPickItem } from "vscode";
import { AzureSubscription } from "../../../api/src/index";
import { ext } from "../../extensionVariables";
import { createResourceClient } from "../../utils/azureClients";
import { localize } from "../../utils/localize";

Просмотреть файл

@ -5,7 +5,7 @@
import { ParsedAzureResourceId } from '@microsoft/vscode-azext-azureutils';
import { AzExtTreeItem, IActionContext, parseError } from '@microsoft/vscode-azext-utils';
import { VSCodeRevealOptions } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { VSCodeRevealOptions } from '../../api/src/index';
import { ext } from '../extensionVariables';
import { ResourceGroupsItem } from '../tree/ResourceGroupsItem';
import { ResourceTreeDataProviderBase } from '../tree/ResourceTreeDataProviderBase';

Просмотреть файл

@ -6,10 +6,10 @@
import { ResourceManagementClient, Tags } from "@azure/arm-resources";
import { uiUtils } from "@microsoft/vscode-azext-azureutils";
import { AzExtTreeFileSystem, AzExtTreeFileSystemItem, callWithTelemetryAndErrorHandling, IActionContext, nonNullValue } from '@microsoft/vscode-azext-utils';
import { AzureResource, AzureSubscription } from "@microsoft/vscode-azext-utils/hostapi.v2";
import * as jsonc from 'jsonc-parser';
import * as os from "os";
import { commands, Diagnostic, DiagnosticSeverity, FileStat, FileType, languages, MessageItem, Uri, window } from "vscode";
import { AzureResource, AzureSubscription } from "../../../api/src/index";
import { ext } from "../../extensionVariables";
import { createResourceClient } from "../../utils/azureClients";
import { localize } from "../../utils/localize";

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { azureResourceExperience, IActionContext } from "@microsoft/vscode-azext-utils";
import { AzureResource } from "@microsoft/vscode-azext-utils/hostapi.v2";
import { AzureResource } from "../../../api/src/index";
import { ext } from "../../extensionVariables";
import { AzureResourceItem } from "../../tree/azure/AzureResourceItem";

Просмотреть файл

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { azureResourceExperience, IActionContext, openReadOnlyJson } from '@microsoft/vscode-azext-utils';
import { ViewPropertiesModel } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { randomUUID } from 'crypto';
import { ViewPropertiesModel } from '../../api/src/index';
import { ext } from '../extensionVariables';
import { ResourceGroupsItem } from '../tree/ResourceGroupsItem';
import { localize } from '../utils/localize';

Просмотреть файл

@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { isAzExtTreeItem, Wrapper } from '@microsoft/vscode-azext-utils';
import { AzureResourceModel, BranchDataProvider, ResourceBase, ResourceModelBase, ViewPropertiesModel } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { isAzExtTreeItem } from '@microsoft/vscode-azext-utils';
import { randomUUID } from 'crypto';
import * as vscode from 'vscode';
import { AzureResourceModel, BranchDataProvider, ResourceBase, ResourceModelBase, ViewPropertiesModel, Wrapper } from '../../api/src/index';
import { BranchDataItemCache } from './BranchDataItemCache';
import { ResourceGroupsItem } from './ResourceGroupsItem';

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BranchDataProvider, ResourceBase, ResourceModelBase } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { BranchDataProvider, ResourceBase, ResourceModelBase } from '../../api/src/index';
export abstract class ResourceBranchDataProviderManagerBase<TResourceType, TBranchDataProvider extends BranchDataProvider<ResourceBase, ResourceModelBase>> extends vscode.Disposable {
private readonly branchDataProviderMap = new Map<TResourceType, { provider: TBranchDataProvider, listener: vscode.Disposable | undefined }>();

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { ISubscriptionContext } from "@microsoft/vscode-azext-utils";
import { AzureSubscription } from "@microsoft/vscode-azext-utils/hostapi.v2";
import { AzureSubscription } from "../../api/src/index";
import { ResourceGroupsItem } from "./ResourceGroupsItem";
export interface ResourceGroupsTreeContext {

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ResourceBase, ResourceModelBase } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { ResourceBase, ResourceModelBase } from '../../api/src/index';
import { BranchDataItemCache } from './BranchDataItemCache';
import { BranchDataItemWrapper } from './BranchDataProviderItem';
import { ResourceGroupsItem } from './ResourceGroupsItem';

Просмотреть файл

@ -3,8 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType } from "@microsoft/vscode-azext-utils";
import { AzureResource, BranchDataProvider, ResourceModelBase } from "@microsoft/vscode-azext-utils/hostapi.v2";
import { AzExtResourceType, AzureResource, BranchDataProvider, ResourceModelBase } from "../../../api/src/index";
import { ResourceBranchDataProviderManagerBase } from '../ResourceBranchDataProviderManagerBase';
export class AzureResourceBranchDataProviderManager extends ResourceBranchDataProviderManagerBase<AzExtResourceType, BranchDataProvider<AzureResource, ResourceModelBase>>{

Просмотреть файл

@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType, nonNullValue, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import { AzureResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { nonNullValue, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
import { AzExtResourceType, AzureResource } from '../../../api/src/index';
import { azureExtensions } from '../../azureExtensions';
import { GroupBySettings } from '../../commands/explorer/groupBy';
import { ext } from '../../extensionVariables';

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureResource, BranchDataProvider, ResourceBase, ResourceModelBase } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { FileChangeType, TreeItem, Uri } from 'vscode';
import { AzureResource, BranchDataProvider, ResourceBase, ResourceModelBase } from '../../../api/src/index';
import { ResourceTags } from '../../commands/tags/TagFileSystem';
import { ext } from '../../extensionVariables';
import { createPortalUrl } from '../../utils/v2/createPortalUrl';

Просмотреть файл

@ -5,8 +5,8 @@
import { AzExtServiceClientCredentials, IActionContext, nonNullProp, registerEvent } from '@microsoft/vscode-azext-utils';
import { AzureExtensionApiProvider } from '@microsoft/vscode-azext-utils/api';
import { AzureSubscription, ResourceModelBase } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { AzureSubscription, ResourceModelBase } from '../../../api/src/index';
import { AzureResourceProviderManager } from '../../api/ResourceProviderManagers';
import { showHiddenTypesSettingKey } from '../../constants';
import { ext } from '../../extensionVariables';

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureResource, AzureResourceModel, BranchDataProvider } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { AzureResource, AzureResourceModel, BranchDataProvider } from '../../../api/src/index';
import { DefaultAzureResourceItem } from './DefaultAzureResourceItem';
export class DefaultAzureResourceBranchDataProvider implements BranchDataProvider<AzureResource, AzureResourceModel> {

Просмотреть файл

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { createContextValue } from '@microsoft/vscode-azext-utils';
import { AzureResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { AzureResource } from '../../../api/src/index';
import { AzExtWrapper, getAzureExtensions } from '../../AzExtWrapper';
import { getIconPath } from '../../utils/azureUtils';
import { localize } from "../../utils/localize";

Просмотреть файл

@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType, createContextValue, ISubscriptionContext, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import { AzureResource, AzureResourceBranchDataProvider, AzureResourceModel, AzureSubscription, ViewPropertiesModel } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { createContextValue, ISubscriptionContext, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
import { AzExtResourceType, AzureResource, AzureResourceBranchDataProvider, AzureResourceModel, AzureSubscription, ViewPropertiesModel } from '../../../api/src/index';
import { ITagsModel, ResourceTags } from '../../commands/tags/TagFileSystem';
import { ext } from '../../extensionVariables';
import { getIconPath } from '../../utils/azureUtils';

Просмотреть файл

@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzExtResourceType, ISubscriptionContext } from "@microsoft/vscode-azext-utils";
import { AzureSubscription } from "@microsoft/vscode-azext-utils/hostapi.v2";
import { ISubscriptionContext } from "@microsoft/vscode-azext-utils";
import * as vscode from "vscode";
import { AzExtResourceType, AzureSubscription } from "../../../api/src/index";
import { AzureResourceProviderManager } from "../../api/ResourceProviderManagers";
import { azureExtensions } from "../../azureExtensions";
import { showHiddenTypesSettingKey } from "../../constants";

Просмотреть файл

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { AzExtTreeItem } from '@microsoft/vscode-azext-utils';
import { AzureResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { AzureResource } from '../../../api/src/index';
import { AzureResourceProviderManager } from '../../api/ResourceProviderManagers';
import { ext } from '../../extensionVariables';
import { localize } from '../../utils/localize';

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BranchDataProvider, ResourceModelBase, WorkspaceResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { BranchDataProvider, ResourceModelBase, WorkspaceResource } from '../../../api/src/index';
interface WorkspaceResourceModel extends ResourceModelBase {
readonly name: string;

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BranchDataProvider, ResourceModelBase, WorkspaceResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import { BranchDataProvider, ResourceModelBase, WorkspaceResource } from '../../../api/src/index';
import { ResourceBranchDataProviderManagerBase } from '../ResourceBranchDataProviderManagerBase';
export class WorkspaceResourceBranchDataProviderManager extends ResourceBranchDataProviderManagerBase<string, BranchDataProvider<WorkspaceResource, ResourceModelBase>> {

Просмотреть файл

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { WorkspaceResource } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { WorkspaceResource } from '../../../api/src/index';
import { WorkspaceResourceProviderManager } from '../../api/ResourceProviderManagers';
import { BranchDataItemCache } from '../BranchDataItemCache';
import { BranchDataItemWrapper } from '../BranchDataProviderItem';

Просмотреть файл

@ -4,10 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import { getResourceGroupFromId } from '@microsoft/vscode-azext-azureutils';
import { AzExtResourceType, nonNullProp, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import { nonNullProp, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import { AppResource, GroupingConfig, GroupNodeConfiguration } from '@microsoft/vscode-azext-utils/hostapi';
import * as path from 'path';
import { ThemeIcon } from 'vscode';
import { AzExtResourceType } from '../../api/src/index';
import { IAzExtMetadata, legacyTypeMap } from '../azureExtensions';
import { localize } from './localize';
import { treeUtils } from './treeUtils';

Просмотреть файл

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { OpenInPortalOptions } from "@microsoft/vscode-azext-azureutils";
import { AzureSubscription } from "@microsoft/vscode-azext-utils/hostapi.v2";
import * as vscode from 'vscode';
import { AzureSubscription } from "../../../api/src/index";
// TODO move to shared package
export function createPortalUrl(subscription: AzureSubscription, id: string, options?: OpenInPortalOptions): vscode.Uri {

Просмотреть файл

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { AzExtServiceClientCredentials, ISubscriptionContext } from '@microsoft/vscode-azext-dev';
import { AzureSubscription } from '@microsoft/vscode-azext-utils/hostapi.v2';
import * as vscode from 'vscode';
import { AzureSubscription } from '../../../api/src/index';
import { localize } from '../../utils/localize';
/**

Просмотреть файл

@ -18,13 +18,16 @@
"*": [
"node_modules/@types/*",
"*"
]
],
},
"skipLibCheck": false
},
"exclude": [
"node_modules",
".vscode-test",
"gulpfile.ts"
"gulpfile.ts",
"api/dist",
"api/out",
"out"
]
}