UNPKG

2.6 kBTypeScriptView Raw
1import { JsonMap, Optional } from '@salesforce/ts-types/lib';
2import { ConfigGroup } from './configGroup';
3import { ConfigContents, ConfigValue } from './configStore';
4/**
5 * Different groups of aliases. Currently only support orgs.
6 */
7export declare enum AliasGroup {
8 ORGS = "orgs"
9}
10/**
11 * Aliases specify alternate names for groups of properties used by the Salesforce CLI, such as orgs.
12 * By default, all aliases are stored under 'orgs', but groups allow aliases to be applied for
13 * other commands, settings, and parameters.
14 *
15 * **Note:** All aliases are stored at the global level.
16 *
17 * ```
18 * const aliases = await Aliases.create({});
19 * aliases.set('myAlias', 'username@company.org');
20 * await aliases.write();
21 * // Shorthand to get an alias.
22 * const username: string = await Aliases.fetch('myAlias');
23 * ```
24 * https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_usernames_orgs.htm
25 *
26 * @deprecated Replaced by GlobalInfo in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo}
27 */
28export declare class Aliases extends ConfigGroup<ConfigGroup.Options> {
29 /**
30 * Constructor
31 * **Do not directly construct instances of this class -- use {@link Aliases.create} instead.**
32 *
33 * @param options The options for the class instance
34 */
35 constructor(options: ConfigGroup.Options);
36 /**
37 * The aliases state file filename.
38 */
39 static getFileName(): string;
40 /**
41 * Get Aliases specific options.
42 */
43 static getDefaultOptions(): ConfigGroup.Options;
44 /**
45 * Updates a group of aliases in a bulk save and returns the new aliases that were saved.
46 *
47 * ```
48 * const aliases = await Aliases.parseAndUpdate(['foo=bar', 'bar=baz'])
49 * ```
50 *
51 * @param aliasKeyAndValues An array of strings in the format `<alias>=<value>`.
52 * Each element will be saved in the Aliases state file under the group.
53 * @param group The group the alias belongs to. Defaults to ORGS.
54 */
55 static parseAndUpdate(aliasKeyAndValues: string[], group?: AliasGroup): Promise<JsonMap>;
56 /**
57 * Get an alias from a key and group. Shorthand for `Alias.create({}).get(key)`. Returns the promise resolved when the
58 * alias is created.
59 *
60 * @param key The value of the alias to match.
61 * @param group The group the alias belongs to. Defaults to Orgs.
62 */
63 static fetch(key: string, group?: AliasGroup): Promise<Optional<string>>;
64 protected setMethod(contents: ConfigContents, key: string, value?: ConfigValue): void;
65}