@microsoft/vscode-azext-azureappsettings
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -11,4 +11,5 @@ import type { SlotConfigNamesResource, StringDictionary } from '@azure/arm-appservice'; | ||
updateApplicationSettings(appSettings: StringDictionary): Promise<StringDictionary>; | ||
isContainer?: boolean; | ||
listSlotConfigurationNames?(): Promise<SlotConfigNamesResource>; | ||
updateSlotConfigurationNames?(appSettings: SlotConfigNamesResource): Promise<SlotConfigNamesResource>; | ||
} |
@@ -5,2 +5,3 @@ import type { StringDictionary } from '@azure/arm-appservice'; | ||
export declare function validateAppSettingKey(settings: StringDictionary, client: IAppSettingsClient, newKey: string, oldKey?: string): string | undefined; | ||
export declare function validateAppSettingValue(value: string): string | undefined; | ||
interface AppSettingsTreeItemOptions { | ||
@@ -7,0 +8,0 @@ supportsSlots?: boolean; |
@@ -16,4 +16,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AppSettingsTreeItem = exports.validateAppSettingKey = void 0; | ||
exports.AppSettingsTreeItem = exports.validateAppSettingValue = exports.validateAppSettingKey = void 0; | ||
const vscode_azext_utils_1 = require("@microsoft/vscode-azext-utils"); | ||
const vscode = require("vscode"); | ||
const vscode_1 = require("vscode"); | ||
@@ -25,2 +26,5 @@ const AppSettingTreeItem_1 = require("./AppSettingTreeItem"); | ||
} | ||
if (client.isContainer && !(/^[-._a-zA-Z][-._a-zA-Z0-9]*$/.test(newKey))) { | ||
return 'App setting names must begin with a letter, number, period ("."), or underscore ("_") and can only contain letters, numbers (0-9), periods ("."), and underscores ("_")'; | ||
} | ||
newKey = newKey.trim(); | ||
@@ -41,2 +45,9 @@ if (newKey.length === 0) { | ||
exports.validateAppSettingKey = validateAppSettingKey; | ||
function validateAppSettingValue(value) { | ||
if (!value.trim()) { | ||
return vscode.l10n.t('App setting values cannot be null, undefined or an empty string.'); | ||
} | ||
return undefined; | ||
} | ||
exports.validateAppSettingValue = validateAppSettingValue; | ||
class AppSettingsTreeItem extends vscode_azext_utils_1.AzExtParentTreeItem { | ||
@@ -123,3 +134,4 @@ constructor(parent, clientProvider, extensionPrefix, options) { | ||
prompt: `Enter value for "${newKey}"`, | ||
stepName: 'appSettingValue' | ||
stepName: 'appSettingValue', | ||
validateInput: (v) => validateAppSettingValue(v) | ||
}); | ||
@@ -126,0 +138,0 @@ if (!settings.properties) { |
{ | ||
"name": "@microsoft/vscode-azext-azureappsettings", | ||
"author": "Microsoft Corporation", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Common features and tools surrounding App Settings for the Azure VS Code extensions", | ||
@@ -45,12 +45,12 @@ "tags": [ | ||
"@typescript-eslint/eslint-plugin": "^5.53.0", | ||
"@vscode/test-electron": "^2.1.5", | ||
"@vscode/test-electron": "^2.3.8", | ||
"eslint": "^8.34.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"fs-extra": "^10.0.0", | ||
"globby": "^11.0.2", | ||
"mocha": "^9.1.3", | ||
"mocha-junit-reporter": "^2.0.2", | ||
"mocha-multi-reporters": "^1.1.7", | ||
"fs-extra": "^10.0.0", | ||
"globby": "^11.0.2", | ||
"typescript": "^4.9.4" | ||
} | ||
} |
23420
393