From 28c5e4437a941717241e26e622273c61864370a1 Mon Sep 17 00:00:00 2001 From: Alex Weininger Date: Wed, 7 Sep 2022 13:01:50 -0700 Subject: [PATCH] Changes to tree item picker (#1232) Co-authored-by: Brandon Waterloo [MSFT] <36966225+bwateratmsft@users.noreply.github.com> --- utils/hostapi.v2.d.ts | 96 +++++++++++++++---- utils/index.d.ts | 21 ++++ utils/src/index.ts | 1 + .../registerCommandWithTreeNodeUnboxing.ts | 2 +- .../ContextValueQuickPickStep.ts | 29 +----- .../quickPickWizard/FindByIdQuickPickStep.ts | 3 +- .../QuickPickWithCreateStep.ts | 3 +- .../quickPickWizard/RecursiveQuickPickStep.ts | 3 +- .../experiences/appResourceExperience.ts | 22 ++--- .../experiences/contextValueExperience.ts | 12 ++- .../AzureResourceQuickPickWizardContext.ts | 8 +- .../QuickPickAppResourceStep.ts | 12 +-- .../QuickPickAzureResourceGroupStep.ts | 3 +- .../QuickPickAzureSubscriptionStep.ts | 3 +- .../QuickPickGroupStep.ts | 3 +- .../quickPickAzureResource/tempTypes.ts | 28 ++---- utils/test/isBox.test.ts | 2 +- 17 files changed, 149 insertions(+), 102 deletions(-) diff --git a/utils/hostapi.v2.d.ts b/utils/hostapi.v2.d.ts index b6289593cd..0405211ab8 100644 --- a/utils/hostapi.v2.d.ts +++ b/utils/hostapi.v2.d.ts @@ -1,4 +1,54 @@ -import { IActionContext } from "./index"; +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +import { AzExtTreeItem, IActionContext } from "./index"; +import * as vscode from 'vscode'; +import type { Environment } from '@azure/ms-rest-azure-env'; +import { AzExtResourceType } from "./src/AzExtResourceType"; + +export interface ApplicationAuthentication { + getSession(scopes?: string[]): vscode.ProviderResult; +} + +/** + * Information specific to the Subscription + */ +export interface ApplicationSubscription { + readonly authentication: ApplicationAuthentication; + readonly displayName: string; + readonly subscriptionId: string; + readonly environment: Environment; + readonly isCustomCloud: boolean; +} + +export interface ResourceBase { + readonly id: string; + readonly name: string; +} + +export interface ApplicationResourceType { + readonly type: string; + readonly kinds?: string[]; +} + +/** + * Represents an individual resource in Azure. + * @remarks The `id` property is expected to be the Azure resource ID. + */ +export interface ApplicationResource extends ResourceBase { + readonly subscription: ApplicationSubscription; + readonly type: ApplicationResourceType; + readonly azExtResourceType?: AzExtResourceType; + readonly location?: string; + readonly resourceGroup?: string; + /** Resource tags */ + readonly tags?: { + [propertyName: string]: string; + }; + /* add more properties from GenericResource if needed */ +} /** * Interface describing an object that wraps another object. @@ -12,28 +62,40 @@ import { IActionContext } from "./index"; * aren't boxes) */ export interface Box { - unwrap(): Promise; + unwrap(): T; } -/** - * Tests to see if something is a box, by ensuring it is an object - * and has an "unwrap" function - * @param maybeBox An object to test if it is a box - * @returns True if a box, false otherwise - */ -export declare function isBox(maybeBox: unknown): maybeBox is Box; - /** * Describes command callbacks for tree node context menu commands */ export type TreeNodeCommandCallback = (context: IActionContext, node?: T, nodes?: T[], ...args: any[]) => any; /** - * Used to register VSCode tree node context menu commands that are in the host extension's tree. It wraps your callback with consistent error and telemetry handling - * Use debounce property if you need a delay between clicks for this particular command - * A telemetry event is automatically sent whenever a command is executed. The telemetry event ID will default to the same as the - * commandId passed in, but can be overridden per command with telemetryId - * The telemetry event for this command will be named telemetryId if specified, otherwise it defaults to the commandId - * NOTE: If the environment variable `DEBUGTELEMETRY` is set to a non-empty, non-zero value, then telemetry will not be sent. If the value is 'verbose' or 'v', telemetry will be displayed in the console window. + * Describes filtering based on context value. Items that pass the filter will + * match at least one of the `include` filters, but none of the `exclude` filters. */ -export declare function registerCommandWithTreeNodeUnboxing(commandId: string, callback: TreeNodeCommandCallback, debounce?: number, telemetryId?: string): void; +export interface ContextValueFilter { + /** + * This filter will include items that match *any* of the values in the array. + * When a string is used, exact value comparison is done. + */ + include: string | RegExp | (string | RegExp)[]; + + /** + * This filter will exclude items that match *any* of the values in the array. + * When a string is used, exact value comparison is done. + */ + exclude?: string | RegExp | (string | RegExp)[]; +} + +export interface ContextValueFilterableTreeNodeV2 { + readonly quickPickOptions: { + readonly contextValues: Array; + readonly isLeaf: boolean; + } +} + +export type ContextValueFilterableTreeNode = ContextValueFilterableTreeNodeV2 | AzExtTreeItem; + +// temporary type until we have the real type from RGs +export type ResourceGroupsItem = ContextValueFilterableTreeNode; diff --git a/utils/index.d.ts b/utils/index.d.ts index 0f01f5b888..37a47b6d09 100644 --- a/utils/index.d.ts +++ b/utils/index.d.ts @@ -10,6 +10,7 @@ import { CancellationToken, CancellationTokenSource, Disposable, Event, Extensio import { TargetPopulation } from 'vscode-tas-client'; import { AzureExtensionApi, AzureExtensionApiProvider } from './api'; import type { Activity, ActivityTreeItemOptions, AppResource, OnErrorActivityData, OnProgressActivityData, OnStartActivityData, OnSuccessActivityData } from './hostapi'; // This must remain `import type` or else a circular reference will result +import type { Box, ContextValueFilter, ResourceGroupsItem, TreeNodeCommandCallback } from './hostapi.v2'; export declare interface RunWithTemporaryDescriptionOptions { description: string; @@ -1678,3 +1679,23 @@ export declare enum AzExtResourceType { VirtualNetworks = 'VirtualNetworks', WebHostingEnvironments = 'WebHostingEnvironments', } + +/** + * Tests to see if something is a box, by ensuring it is an object + * and has an "unwrap" function + * @param maybeBox An object to test if it is a box + * @returns True if a box, false otherwise + */ +export declare function isBox(maybeBox: unknown): maybeBox is Box; + +export declare function appResourceExperience(context: IActionContext, tdp: TreeDataProvider, resourceType: AzExtResourceType, childItemFilter?: ContextValueFilter): Promise; + +/** + * Used to register VSCode tree node context menu commands that are in the host extension's tree. It wraps your callback with consistent error and telemetry handling + * Use debounce property if you need a delay between clicks for this particular command + * A telemetry event is automatically sent whenever a command is executed. The telemetry event ID will default to the same as the + * commandId passed in, but can be overridden per command with telemetryId + * The telemetry event for this command will be named telemetryId if specified, otherwise it defaults to the commandId + * NOTE: If the environment variable `DEBUGTELEMETRY` is set to a non-empty, non-zero value, then telemetry will not be sent. If the value is 'verbose' or 'v', telemetry will be displayed in the console window. + */ +export declare function registerCommandWithTreeNodeUnboxing(commandId: string, callback: TreeNodeCommandCallback, debounce?: number, telemetryId?: string): void; diff --git a/utils/src/index.ts b/utils/src/index.ts index 25af2ff87a..288318eddc 100644 --- a/utils/src/index.ts +++ b/utils/src/index.ts @@ -37,4 +37,5 @@ export * from './utils/contextUtils'; export * from './activityLog/activities/ExecuteActivity'; export * from './getAzExtResourceType'; export * from './AzExtResourceType'; +export * from './treev2/quickPickWizard/experiences/appResourceExperience'; // 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 diff --git a/utils/src/registerCommandWithTreeNodeUnboxing.ts b/utils/src/registerCommandWithTreeNodeUnboxing.ts index 33cf4a5096..4adfd0ed2a 100644 --- a/utils/src/registerCommandWithTreeNodeUnboxing.ts +++ b/utils/src/registerCommandWithTreeNodeUnboxing.ts @@ -28,7 +28,7 @@ export function registerCommandWithTreeNodeUnboxing(commandId: string, treeNo const boxedNodes = maybeNodeBoxArray as Box[]; nodes = []; for (const n of boxedNodes) { - nodes.push(await n.unwrap()) + nodes.push(n.unwrap()) } } else if (maybeNodeBoxArray && Array.isArray(maybeNodeBoxArray)) { // Otherwise, assume it is just an array of T's diff --git a/utils/src/treev2/quickPickWizard/ContextValueQuickPickStep.ts b/utils/src/treev2/quickPickWizard/ContextValueQuickPickStep.ts index b44002d9d7..5a787fb937 100644 --- a/utils/src/treev2/quickPickWizard/ContextValueQuickPickStep.ts +++ b/utils/src/treev2/quickPickWizard/ContextValueQuickPickStep.ts @@ -3,37 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as types from '../../../index'; import { GenericQuickPickOptions, GenericQuickPickStep } from './GenericQuickPickStep'; import { isAzExtParentTreeItem } from '../../tree/InternalInterfaces'; import { QuickPickWizardContext } from './QuickPickWizardContext'; - -/** - * Describes filtering based on context value. Items that pass the filter will - * match at least one of the `include` filters, but none of the `exclude` filters. - */ -export interface ContextValueFilter { - /** - * This filter will include items that match *any* of the values in the array. - * When a string is used, exact value comparison is done. - */ - include: string | RegExp | (string | RegExp)[]; - - /** - * This filter will exclude items that match *any* of the values in the array. - * When a string is used, exact value comparison is done. - */ - exclude?: string | RegExp | (string | RegExp)[]; -} - -export interface ContextValueFilterableTreeNodeV2 { - readonly quickPickOptions: { - readonly contextValues: Array; - readonly isLeaf: boolean; - } -} - -export type ContextValueFilterableTreeNode = ContextValueFilterableTreeNodeV2 | types.AzExtTreeItem; +import { ContextValueFilter, ContextValueFilterableTreeNode, ContextValueFilterableTreeNodeV2 } from '../../../hostapi.v2'; export interface ContextValueFilterQuickPickOptions extends GenericQuickPickOptions { contextValueFilter: ContextValueFilter; diff --git a/utils/src/treev2/quickPickWizard/FindByIdQuickPickStep.ts b/utils/src/treev2/quickPickWizard/FindByIdQuickPickStep.ts index cf56e2c5fe..edbcbc4497 100644 --- a/utils/src/treev2/quickPickWizard/FindByIdQuickPickStep.ts +++ b/utils/src/treev2/quickPickWizard/FindByIdQuickPickStep.ts @@ -7,8 +7,9 @@ import * as types from '../../../index'; import * as vscode from 'vscode'; import { getLastNode, QuickPickWizardContext } from './QuickPickWizardContext'; import { isAzExtParentTreeItem } from '../../tree/InternalInterfaces'; -import { ContextValueFilterableTreeNodeV2, isContextValueFilterableTreeNodeV2 } from './ContextValueQuickPickStep'; +import { isContextValueFilterableTreeNodeV2 } from './ContextValueQuickPickStep'; import { GenericQuickPickStep, SkipIfOneQuickPickOptions } from './GenericQuickPickStep'; +import { ContextValueFilterableTreeNodeV2 } from '../../../hostapi.v2'; interface FindableByIdTreeNodeV2 extends ContextValueFilterableTreeNodeV2 { id: vscode.Uri; diff --git a/utils/src/treev2/quickPickWizard/QuickPickWithCreateStep.ts b/utils/src/treev2/quickPickWizard/QuickPickWithCreateStep.ts index a7e7fa36a1..e076d7fede 100644 --- a/utils/src/treev2/quickPickWizard/QuickPickWithCreateStep.ts +++ b/utils/src/treev2/quickPickWizard/QuickPickWithCreateStep.ts @@ -5,8 +5,9 @@ import * as types from '../../../index'; import { getLastNode, QuickPickWizardContext } from './QuickPickWizardContext'; -import { ContextValueFilterableTreeNode, ContextValueFilterQuickPickOptions, ContextValueQuickPickStep } from './ContextValueQuickPickStep'; +import { ContextValueFilterQuickPickOptions, ContextValueQuickPickStep } from './ContextValueQuickPickStep'; import { localize } from '../../localize'; +import { ContextValueFilterableTreeNode } from '../../../hostapi.v2'; type CreateCallback = () => TNode | Promise; interface CreateQuickPickOptions extends ContextValueFilterQuickPickOptions { diff --git a/utils/src/treev2/quickPickWizard/RecursiveQuickPickStep.ts b/utils/src/treev2/quickPickWizard/RecursiveQuickPickStep.ts index 0456b7e632..56050f7738 100644 --- a/utils/src/treev2/quickPickWizard/RecursiveQuickPickStep.ts +++ b/utils/src/treev2/quickPickWizard/RecursiveQuickPickStep.ts @@ -3,8 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { ContextValueFilterableTreeNode } from '../../../hostapi.v2'; import * as types from '../../../index'; -import { ContextValueFilterableTreeNode, ContextValueFilterQuickPickOptions, ContextValueQuickPickStep } from './ContextValueQuickPickStep'; +import { ContextValueFilterQuickPickOptions, ContextValueQuickPickStep } from './ContextValueQuickPickStep'; import { getLastNode, QuickPickWizardContext } from './QuickPickWizardContext'; export class RecursiveQuickPickStep> extends ContextValueQuickPickStep { diff --git a/utils/src/treev2/quickPickWizard/experiences/appResourceExperience.ts b/utils/src/treev2/quickPickWizard/experiences/appResourceExperience.ts index daeb6c515d..f12e596e1e 100644 --- a/utils/src/treev2/quickPickWizard/experiences/appResourceExperience.ts +++ b/utils/src/treev2/quickPickWizard/experiences/appResourceExperience.ts @@ -3,20 +3,23 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as types from '../../../../index'; import * as vscode from 'vscode'; -import { ContextValueFilter } from '../ContextValueQuickPickStep'; import { QuickPickAzureSubscriptionStep } from '../quickPickAzureResource/QuickPickAzureSubscriptionStep'; import { QuickPickGroupStep } from '../quickPickAzureResource/QuickPickGroupStep'; import { QuickPickAppResourceStep } from '../quickPickAzureResource/QuickPickAppResourceStep'; import { AzureResourceQuickPickWizardContext } from '../quickPickAzureResource/AzureResourceQuickPickWizardContext'; import { RecursiveQuickPickStep } from '../RecursiveQuickPickStep'; -import { Box, ResourceGroupsItem } from '../quickPickAzureResource/tempTypes'; import { getLastNode } from '../QuickPickWizardContext'; import { NoResourceFoundError } from '../../../errors'; - -export async function appResourceExperience(context: types.IActionContext, tdp: vscode.TreeDataProvider, resourceType: types.AzExtResourceType, childItemFilter?: ContextValueFilter): Promise { - const promptSteps: types.AzureWizardPromptStep[] = [ +import { IActionContext } from '../../../../index'; +import { AzureWizardPromptStep } from '../../../wizard/AzureWizardPromptStep'; +import { AzExtResourceType } from '../../../AzExtResourceType'; +import { AzureWizard } from '../../../wizard/AzureWizard'; +import { ContextValueFilter, ResourceGroupsItem } from '../../../../hostapi.v2'; +import { isBox } from '../../../registerCommandWithTreeNodeUnboxing'; + +export async function appResourceExperience(context: IActionContext, tdp: vscode.TreeDataProvider, resourceType: AzExtResourceType, childItemFilter?: ContextValueFilter): Promise { + const promptSteps: AzureWizardPromptStep[] = [ new QuickPickAzureSubscriptionStep(tdp), new QuickPickGroupStep(tdp, { groupType: resourceType, @@ -38,7 +41,7 @@ export async function appResourceExperience(context: types.IActionContext const wizardContext = context as AzureResourceQuickPickWizardContext; wizardContext.pickedNodes = []; - const wizard = new types.AzureWizard(context, { + const wizard = new AzureWizard(context, { hideStepCount: true, promptSteps: promptSteps, }); @@ -50,9 +53,6 @@ export async function appResourceExperience(context: types.IActionContext if (!lastPickedItem) { throw new NoResourceFoundError(wizardContext); } else { - // Treat lastPickedItem as a box containing the desired end object - // TODO - const pickedAsBox = lastPickedItem as unknown as Box; - return pickedAsBox.unwrap(); + return isBox(lastPickedItem) ? lastPickedItem.unwrap() : lastPickedItem as unknown as TPick; } } diff --git a/utils/src/treev2/quickPickWizard/experiences/contextValueExperience.ts b/utils/src/treev2/quickPickWizard/experiences/contextValueExperience.ts index 570fa14cc8..24f672d46f 100644 --- a/utils/src/treev2/quickPickWizard/experiences/contextValueExperience.ts +++ b/utils/src/treev2/quickPickWizard/experiences/contextValueExperience.ts @@ -3,15 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as types from '../../../../index'; import * as vscode from 'vscode'; -import { ContextValueFilter, ContextValueFilterableTreeNode } from '../ContextValueQuickPickStep'; import { RecursiveQuickPickStep } from '../RecursiveQuickPickStep'; import { getLastNode, QuickPickWizardContext } from '../QuickPickWizardContext'; import { NoResourceFoundError } from '../../../errors'; +import { AzureWizardPromptStep } from '../../../wizard/AzureWizardPromptStep'; +import { IActionContext } from '../../../../index'; +import { AzureWizard } from '../../../wizard/AzureWizard'; +import { ContextValueFilter, ContextValueFilterableTreeNode } from '../../../../hostapi.v2'; -export async function contextValueExperience(context: types.IActionContext, tdp: vscode.TreeDataProvider, contextValueFilter: ContextValueFilter): Promise { - const promptSteps: types.AzureWizardPromptStep>[] = [ +export async function contextValueExperience(context: IActionContext, tdp: vscode.TreeDataProvider, contextValueFilter: ContextValueFilter): Promise { + const promptSteps: AzureWizardPromptStep>[] = [ new RecursiveQuickPickStep(tdp, { contextValueFilter: contextValueFilter, skipIfOne: false, @@ -22,7 +24,7 @@ export async function contextValueExperience; wizardContext.pickedNodes = []; - const wizard = new types.AzureWizard(context, { + const wizard = new AzureWizard(context, { hideStepCount: true, promptSteps: promptSteps, }); diff --git a/utils/src/treev2/quickPickWizard/quickPickAzureResource/AzureResourceQuickPickWizardContext.ts b/utils/src/treev2/quickPickWizard/quickPickAzureResource/AzureResourceQuickPickWizardContext.ts index be86bd9dd6..64fc5ae076 100644 --- a/utils/src/treev2/quickPickWizard/quickPickAzureResource/AzureResourceQuickPickWizardContext.ts +++ b/utils/src/treev2/quickPickWizard/quickPickAzureResource/AzureResourceQuickPickWizardContext.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { ApplicationResource, ApplicationSubscription, ResourceGroupsItem } from "../../../../hostapi.v2"; import { QuickPickWizardContext } from "../QuickPickWizardContext"; -import { ApplicationResource, ApplicationSubscription, ResourceGroupsItem } from "./tempTypes"; export interface AzureResourceQuickPickWizardContext extends QuickPickWizardContext { - subscription: ApplicationSubscription | undefined; - resource: ApplicationResource | undefined; - resourceGroup: string | undefined; + subscription?: ApplicationSubscription; + resource?: ApplicationResource; + resourceGroup?: string; } diff --git a/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickAppResourceStep.ts b/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickAppResourceStep.ts index 0e076c6aff..61061328e6 100644 --- a/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickAppResourceStep.ts +++ b/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickAppResourceStep.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { ContextValueFilter, ResourceGroupsItem } from '../../../../hostapi.v2'; import * as types from '../../../../index'; -import { ContextValueFilter } from '../ContextValueQuickPickStep'; import { GenericQuickPickOptions, GenericQuickPickStep } from '../GenericQuickPickStep'; import { AzureResourceQuickPickWizardContext } from './AzureResourceQuickPickWizardContext'; -import { AppResourceItem, ResourceGroupsItem } from './tempTypes'; +import { AppResourceItem } from './tempTypes'; interface AppResourceQuickPickOptions extends GenericQuickPickOptions { resourceType: types.AzExtResourceType; @@ -19,8 +19,8 @@ export class QuickPickAppResourceStep extends GenericQuickPickStep { public constructor(tdp: vscode.TreeDataProvider, options?: GenericQuickPickOptions) { diff --git a/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickGroupStep.ts b/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickGroupStep.ts index f2633c1a7d..4cd292917d 100644 --- a/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickGroupStep.ts +++ b/utils/src/treev2/quickPickWizard/quickPickAzureResource/QuickPickGroupStep.ts @@ -7,7 +7,8 @@ import * as types from '../../../../index'; import * as vscode from 'vscode'; import { GenericQuickPickStep, SkipIfOneQuickPickOptions } from '../GenericQuickPickStep'; import { AzureResourceQuickPickWizardContext } from './AzureResourceQuickPickWizardContext'; -import { GroupingItem, ResourceGroupsItem } from './tempTypes'; +import { GroupingItem } from './tempTypes'; +import { ResourceGroupsItem } from '../../../../hostapi.v2'; interface GroupQuickPickOptions extends SkipIfOneQuickPickOptions { groupType: types.AzExtResourceType; diff --git a/utils/src/treev2/quickPickWizard/quickPickAzureResource/tempTypes.ts b/utils/src/treev2/quickPickWizard/quickPickAzureResource/tempTypes.ts index 4a4a5d258f..16191ea3ee 100644 --- a/utils/src/treev2/quickPickWizard/quickPickAzureResource/tempTypes.ts +++ b/utils/src/treev2/quickPickWizard/quickPickAzureResource/tempTypes.ts @@ -3,38 +3,22 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { ApplicationResource, ApplicationSubscription, ResourceGroupsItem } from '../../../../hostapi.v2'; import * as types from '../../../../index'; -import { ContextValueFilterableTreeNode } from '../ContextValueQuickPickStep'; // TODO: THIS FILE IS TEMPORARY // // It needs to be replaced by real Resources extension interfaces // -export type ResourceGroupsItem = ContextValueFilterableTreeNode; +// These are assumptions made about the nodes in the tree export type SubscriptionItem = ResourceGroupsItem & { subscription: ApplicationSubscription; -}; +} export type GroupingItem = ResourceGroupsItem & { resourceType?: types.AzExtResourceType } -export type AppResourceItem = ResourceGroupsItem & ApplicationResource; - -type ResourceBase = {}; - -/** - * Represents an individual resource in Azure. - * @remarks The `id` property is expected to be the Azure resource ID. - */ -export interface ApplicationResource extends ResourceBase { - readonly subscription: ApplicationSubscription; - readonly azExtResourceType?: types.AzExtResourceType; - readonly resourceGroup?: string; -} - -export type ApplicationSubscription = unknown; - -export interface Box { - unwrap(): T; -} +export type AppResourceItem = ResourceGroupsItem & { + resource: ApplicationResource; +}; diff --git a/utils/test/isBox.test.ts b/utils/test/isBox.test.ts index a8f367d22e..383e65e7eb 100644 --- a/utils/test/isBox.test.ts +++ b/utils/test/isBox.test.ts @@ -21,7 +21,7 @@ suite('isBox', () => { test('Box', () => { const actualBox: Box = { - unwrap: () => { return Promise.resolve(undefined as unknown as T) }, + unwrap: () => { return undefined as unknown as T }, }; assert.strictEqual(isBox(actualBox), true);