Skip to content

add TS doc for public API and types #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/AzureAppConfigurationOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
16 changes: 16 additions & 0 deletions src/keyvault/AzureAppConfigurationKeyVaultOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>;
}
11 changes: 11 additions & 0 deletions src/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AzureAppConfiguration>;
/**
* 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<AzureAppConfiguration>;
export async function load(
connectionStringOrEndpoint: string | URL,
Expand Down