From c2cd5733c499882b4a6d4d1dce82b7f629078155 Mon Sep 17 00:00:00 2001 From: Yan Zhang Date: Mon, 27 Nov 2023 15:18:22 +0800 Subject: [PATCH] add TSdoc for public API and types --- src/AzureAppConfigurationOptions.ts | 14 ++++++++++++++ .../AzureAppConfigurationKeyVaultOptions.ts | 16 ++++++++++++++++ src/load.ts | 11 +++++++++++ 3 files changed, 41 insertions(+) diff --git a/src/AzureAppConfigurationOptions.ts b/src/AzureAppConfigurationOptions.ts index 11a9ba5b..de3b6da3 100644 --- a/src/AzureAppConfigurationOptions.ts +++ b/src/AzureAppConfigurationOptions.ts @@ -28,7 +28,21 @@ export interface AzureAppConfigurationOptions { * Backslash `\` character is reserved and must be escaped using another backslash `\`. */ selectors?: { keyFilter: string, labelFilter?: string }[]; + + /** + * Specifies prefixes to be trimmed from the keys of all key-values retrieved from Azure App Configuration. + * This is useful when you want to remove a common prefix from all keys to avoid repetition. + * The provided prefixes will be sorted in descending order and the longest matching prefix will be trimmed first. + */ trimKeyPrefixes?: string[]; + + /** + * Specifies custom options to be used when creating the AppConfigurationClient. + */ clientOptions?: AppConfigurationClientOptions; + + /** + * Specifies options used to resolve Vey Vault references. + */ keyVaultOptions?: AzureAppConfigurationKeyVaultOptions; } \ No newline at end of file diff --git a/src/keyvault/AzureAppConfigurationKeyVaultOptions.ts b/src/keyvault/AzureAppConfigurationKeyVaultOptions.ts index 9b85beef..2b5c7d87 100644 --- a/src/keyvault/AzureAppConfigurationKeyVaultOptions.ts +++ b/src/keyvault/AzureAppConfigurationKeyVaultOptions.ts @@ -4,8 +4,24 @@ import { TokenCredential } from "@azure/identity"; import { SecretClient } from "@azure/keyvault-secrets"; +/** + * Options used to resolve Key Vault references. + */ export interface AzureAppConfigurationKeyVaultOptions { + /** + * Specifies the Key Vault secret client used for resolving Key Vault references. + */ secretClients?: SecretClient[]; + + /** + * Specifies the credentials used to authenticate to key vaults that have no applied SecretClient. + */ credential?: TokenCredential; + + /** + * Specifies the callback used to resolve key vault references that have no applied SecretClient. + * @param keyVaultReference The Key Vault reference to resolve. + * @returns The secret value. + */ secretResolver?: (keyVaultReference: URL) => string | Promise; } \ No newline at end of file diff --git a/src/load.ts b/src/load.ts index dbb64196..a44d4042 100644 --- a/src/load.ts +++ b/src/load.ts @@ -8,7 +8,18 @@ import { AzureAppConfigurationImpl } from "./AzureAppConfigurationImpl"; import { AzureAppConfigurationOptions, MaxRetries, MaxRetryDelayInMs } from "./AzureAppConfigurationOptions"; import * as RequestTracing from "./requestTracing/constants"; +/** + * Loads the data from Azure App Configuration service and returns an instance of AzureAppConfiguration. + * @param connectionString The connection string for the App Configuration store. + * @param options Optional parameters. + */ export async function load(connectionString: string, options?: AzureAppConfigurationOptions): Promise; +/** + * Loads the data from Azure App Configuration service and returns an instance of AzureAppConfiguration. + * @param endpoint The URL to the App Configuration store. + * @param credential The credential to use to connect to the App Configuration store. + * @param options Optional parameters. + */ export async function load(endpoint: URL | string, credential: TokenCredential, options?: AzureAppConfigurationOptions): Promise; export async function load( connectionStringOrEndpoint: string | URL,