From ccd458b876d063bb99ff4f8537d84368a072bd27 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Tue, 31 May 2022 10:20:31 -0700 Subject: [PATCH] Update typings for getAzureFunctions request (#19556) --- .../src/dialogs/addSqlBindingQuickpick.ts | 2 +- extensions/sql-bindings/src/sql-bindings.d.ts | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/extensions/sql-bindings/src/dialogs/addSqlBindingQuickpick.ts b/extensions/sql-bindings/src/dialogs/addSqlBindingQuickpick.ts index 045c4d8066..45f0c459a3 100644 --- a/extensions/sql-bindings/src/dialogs/addSqlBindingQuickpick.ts +++ b/extensions/sql-bindings/src/dialogs/addSqlBindingQuickpick.ts @@ -44,7 +44,7 @@ export async function launchAddSqlBindingQuickpick(uri: vscode.Uri | undefined): } // get all the Azure functions in the file - const azureFunctions = getAzureFunctionsResult.azureFunctions; + const azureFunctions = getAzureFunctionsResult.azureFunctions.map(af => typeof (af) === 'string' ? af : af.name); if (azureFunctions.length === 0) { void vscode.window.showErrorMessage(constants.noAzureFunctionsInFile); diff --git a/extensions/sql-bindings/src/sql-bindings.d.ts b/extensions/sql-bindings/src/sql-bindings.d.ts index f81dbda319..dbff04aa1d 100644 --- a/extensions/sql-bindings/src/sql-bindings.d.ts +++ b/extensions/sql-bindings/src/sql-bindings.d.ts @@ -121,14 +121,26 @@ declare module 'sql-bindings' { filePath: string; } + export interface AzureFunction { + /** + * The name of the function + */ + name: string; + /** + * The route of the function if it has an HTTP trigger with a route specified + */ + route?: string | undefined; + } + /** * Result from a get Azure Functions request */ - export interface GetAzureFunctionsResult extends ResultStatus { + export interface GetAzureFunctionsResult { /** - * Array of names of Azure Functions in the file + * Array of Azure Functions in the file + * Note : The string list response will eventually be deprecated and replaced completely with the AzureFunction list */ - azureFunctions: string[]; + azureFunctions: string[] | AzureFunction[]; } /**