/
orgUsersConfig.ts
55 lines (51 loc) · 1.35 KB
/
orgUsersConfig.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { Global } from '../global';
import { ConfigFile } from './configFile';
type UserConfig = {
usernames: string[];
};
/**
* A config file that stores usernames for an org.
*/
export class OrgUsersConfig extends ConfigFile<OrgUsersConfig.Options, UserConfig> {
/**
* Constructor.
* **Do not directly construct instances of this class -- use {@link OrgUsersConfig.create} instead.**
*
* @param options The options for the class instance
* @ignore
*/
public constructor(options?: OrgUsersConfig.Options) {
super(options);
}
/**
* Gets the config options for a given org ID.
*
* @param orgId The orgId. Generally this org would have multiple users configured.
*/
public static getOptions(orgId: string): OrgUsersConfig.Options {
return {
isGlobal: true,
isState: true,
filename: `${orgId}.json`,
orgId,
stateFolder: Global.SFDX_STATE_FOLDER,
};
}
}
export namespace OrgUsersConfig {
/**
* The config file options.
*/
export type Options = {
/**
* The org id associated with this user.
*/
orgId: string;
} & ConfigFile.Options;
}