@salesforce/plugin-settings 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE.txt +12 -0
- package/README.md +214 -0
- package/lib/commands/config/get.d.ts +12 -0
- package/lib/commands/config/get.js +49 -0
- package/lib/commands/config/get.js.map +1 -0
- package/lib/commands/config/list.d.ts +8 -0
- package/lib/commands/config/list.js +30 -0
- package/lib/commands/config/list.js.map +1 -0
- package/lib/commands/config/set.d.ts +20 -0
- package/lib/commands/config/set.js +110 -0
- package/lib/commands/config/set.js.map +1 -0
- package/lib/commands/config/unset.d.ts +12 -0
- package/lib/commands/config/unset.js +53 -0
- package/lib/commands/config/unset.js.map +1 -0
- package/lib/config.d.ts +19 -0
- package/lib/config.js +72 -0
- package/lib/config.js.map +1 -0
- package/lib/hooks/init/load_config_meta.d.ts +3 -0
- package/lib/hooks/init/load_config_meta.js +59 -0
- package/lib/hooks/init/load_config_meta.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -0
- package/messages/get.md +25 -0
- package/messages/list.md +13 -0
- package/messages/set.md +47 -0
- package/messages/unset.md +25 -0
- package/oclif.manifest.json +1 -0
- package/package.json +129 -0
- package/schemas/config-get.json +53 -0
- package/schemas/config-list.json +53 -0
- package/schemas/config-set.json +53 -0
- package/schemas/config-unset.json +53 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
## 1.0.0 (2022-09-08)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- allow test lib dir ([e7462c3](https://github.com/salesforcecli/plugin-settings/commit/e7462c366cd6e94837628c1c2786023934698694))
|
|
10
|
+
- migrate plugin-config commands ([b1eb3f3](https://github.com/salesforcecli/plugin-settings/commit/b1eb3f397cbfd172e87d73b9038d66f91ce69bc4))
|
|
11
|
+
- whoops ([3765278](https://github.com/salesforcecli/plugin-settings/commit/376527852b5f37c201d813dee9599a3453e25b67))
|
|
12
|
+
|
|
13
|
+
# Changelog
|
|
14
|
+
|
|
15
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2022, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# plugin-settings
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@salesforce/plugin-settings) [](https://circleci.com/gh/salesforcecli/plugin-settings/tree/main) [](https://npmjs.org/package/@salesforce/plugin-settings) [](https://raw.githubusercontent.com/salesforcecli/plugin-settings/main/LICENSE.txt)
|
|
4
|
+
|
|
5
|
+
Config and alias commands for the `sf` Salesforce CLI
|
|
6
|
+
|
|
7
|
+
> NOTE: This repo combines `plugin-config` and `plugin-alias` for `sf`.
|
|
8
|
+
>
|
|
9
|
+
> If you are looking for the `sfdx` command repos, they can be found here: [plugin-config](https://github.com/salesforcecli/plugin-config) and [plugin-alias](https://github.com/salesforcecli/plugin-alias)
|
|
10
|
+
|
|
11
|
+
This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
|
|
12
|
+
|
|
13
|
+
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
sf plugins install settings@x.y.z
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Issues
|
|
22
|
+
|
|
23
|
+
Please report any issues at https://github.com/forcedotcom/cli/issues
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
28
|
+
2. Create a new issue before starting your project so that we can keep track of
|
|
29
|
+
what you are trying to add/fix. That way, we can also offer suggestions or
|
|
30
|
+
let you know if there is already an effort in progress.
|
|
31
|
+
3. Fork this repository.
|
|
32
|
+
4. [Build the plugin locally](#build)
|
|
33
|
+
5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
|
|
34
|
+
6. Edit the code in your fork.
|
|
35
|
+
7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
|
|
36
|
+
8. Sign CLA (see [CLA](#cla) below).
|
|
37
|
+
9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
|
|
38
|
+
|
|
39
|
+
### CLA
|
|
40
|
+
|
|
41
|
+
External contributors will be required to sign a Contributor's License
|
|
42
|
+
Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
|
|
43
|
+
|
|
44
|
+
### Build
|
|
45
|
+
|
|
46
|
+
To build the plugin locally, make sure to have yarn installed and run the following commands:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Clone the repository
|
|
50
|
+
git clone git@github.com:salesforcecli/plugin-settings
|
|
51
|
+
|
|
52
|
+
# Install the dependencies and compile
|
|
53
|
+
yarn install
|
|
54
|
+
yarn build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
To use your plugin, run using the local `./bin/run` or `./bin/run.cmd` file.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Run using local run file.
|
|
61
|
+
./bin/run config
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Link your plugin to the sf cli
|
|
68
|
+
sf plugins link .
|
|
69
|
+
# To verify
|
|
70
|
+
sf plugins
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
# Commands
|
|
74
|
+
|
|
75
|
+
<!-- commands -->
|
|
76
|
+
|
|
77
|
+
- [`sf config get`](#sf-config-get)
|
|
78
|
+
- [`sf config list`](#sf-config-list)
|
|
79
|
+
- [`sf config set`](#sf-config-set)
|
|
80
|
+
- [`sf config unset`](#sf-config-unset)
|
|
81
|
+
|
|
82
|
+
## `sf config get`
|
|
83
|
+
|
|
84
|
+
Get the value of a configuration variable.
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
USAGE
|
|
88
|
+
$ sf config get [--json] [--verbose]
|
|
89
|
+
|
|
90
|
+
FLAGS
|
|
91
|
+
--verbose Display whether the configuration variables are set locally or globally.
|
|
92
|
+
|
|
93
|
+
GLOBAL FLAGS
|
|
94
|
+
--json Format output as json.
|
|
95
|
+
|
|
96
|
+
DESCRIPTION
|
|
97
|
+
Get the value of a configuration variable.
|
|
98
|
+
|
|
99
|
+
Run "sf config list" to see all the configuration variables you've set. Global configuration variable are always
|
|
100
|
+
displayed; local ones are displayed if you run the command in a project directory. Run "sf config set" to set a
|
|
101
|
+
configuration variable.
|
|
102
|
+
|
|
103
|
+
EXAMPLES
|
|
104
|
+
Get the value of the "target-org" configuration variable.
|
|
105
|
+
|
|
106
|
+
$ sf config get target-org
|
|
107
|
+
|
|
108
|
+
Get multiple configuration variables and display whether they're set locally or globally:
|
|
109
|
+
|
|
110
|
+
$ sf config get target-org api-version --verbose
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## `sf config list`
|
|
114
|
+
|
|
115
|
+
List the configuration variables that you've previously set.
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
USAGE
|
|
119
|
+
$ sf config list [--json]
|
|
120
|
+
|
|
121
|
+
GLOBAL FLAGS
|
|
122
|
+
--json Format output as json.
|
|
123
|
+
|
|
124
|
+
DESCRIPTION
|
|
125
|
+
List the configuration variables that you've previously set.
|
|
126
|
+
|
|
127
|
+
Global configuration variables apply to any directory and are always displayed. If you run this command from a project
|
|
128
|
+
directory, local configuration variables are also displayed.
|
|
129
|
+
|
|
130
|
+
EXAMPLES
|
|
131
|
+
List both global configuration variables and those local to your project:
|
|
132
|
+
|
|
133
|
+
$ sf config list
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## `sf config set`
|
|
137
|
+
|
|
138
|
+
Set one or more configuration variables, such as your default org.
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
USAGE
|
|
142
|
+
$ sf config set [--json] [-g]
|
|
143
|
+
|
|
144
|
+
FLAGS
|
|
145
|
+
-g, --global Set the configuration variables globally, so they can be used from any directory.
|
|
146
|
+
|
|
147
|
+
GLOBAL FLAGS
|
|
148
|
+
--json Format output as json.
|
|
149
|
+
|
|
150
|
+
DESCRIPTION
|
|
151
|
+
Set one or more configuration variables, such as your default org.
|
|
152
|
+
|
|
153
|
+
Use configuration variables to set CLI defaults, such as your default org or the API version you want the CLI to use.
|
|
154
|
+
For example, if you set the "target-org" configuration variable, you don't need to specify it as a "sf deploy
|
|
155
|
+
metadata" flag if you're deploying to your default org.
|
|
156
|
+
|
|
157
|
+
Local configuration variables apply only to your current project. Global variables, specified with the --global flag,
|
|
158
|
+
apply in any directory.
|
|
159
|
+
|
|
160
|
+
The resolution order if you've set a flag value in multiple ways is as follows:
|
|
161
|
+
|
|
162
|
+
1. Flag value specified at the command line.
|
|
163
|
+
|
|
164
|
+
2. Local (project-level) configuration variable.
|
|
165
|
+
|
|
166
|
+
3. Global configuration variable.
|
|
167
|
+
|
|
168
|
+
Run "sf config list" to see the configuration variables you've already set and their level (local or global).
|
|
169
|
+
|
|
170
|
+
EXAMPLES
|
|
171
|
+
Set the local target-org configuration variable to an org username:
|
|
172
|
+
|
|
173
|
+
$ sf config set target-org=me@my.org
|
|
174
|
+
|
|
175
|
+
Set the local target-org configuration variable to an alias:
|
|
176
|
+
|
|
177
|
+
$ sf config set target-org=my-scratch-org
|
|
178
|
+
|
|
179
|
+
Set the global target-org configuration variable:
|
|
180
|
+
|
|
181
|
+
$ sf config set --global target-org=my-scratch-org
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## `sf config unset`
|
|
185
|
+
|
|
186
|
+
Unset local or global configuration variables.
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
USAGE
|
|
190
|
+
$ sf config unset [--json] [-g]
|
|
191
|
+
|
|
192
|
+
FLAGS
|
|
193
|
+
-g, --global Unset the configuration variables globally, so they can no longer be used from any directory.
|
|
194
|
+
|
|
195
|
+
GLOBAL FLAGS
|
|
196
|
+
--json Format output as json.
|
|
197
|
+
|
|
198
|
+
DESCRIPTION
|
|
199
|
+
Unset local or global configuration variables.
|
|
200
|
+
|
|
201
|
+
Local configuration variables apply only to your current project. Global configuration variables apply in any
|
|
202
|
+
directory.
|
|
203
|
+
|
|
204
|
+
EXAMPLES
|
|
205
|
+
Unset the local "target-org" configuration variable:
|
|
206
|
+
|
|
207
|
+
$ sf config unset target-org
|
|
208
|
+
|
|
209
|
+
Unset multiple configuration variables globally:
|
|
210
|
+
|
|
211
|
+
$ sf config unset target-org api-version --global
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
<!-- commandsstop -->
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfigCommand, ConfigResponses } from '../../config';
|
|
2
|
+
export declare class Get extends ConfigCommand<ConfigResponses> {
|
|
3
|
+
static readonly description: string;
|
|
4
|
+
static readonly summary: string;
|
|
5
|
+
static readonly examples: string[];
|
|
6
|
+
static readonly strict = false;
|
|
7
|
+
static readonly flags: {
|
|
8
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
};
|
|
10
|
+
static configurationVariablesSection: import("@salesforce/sf-plugins-core/lib/util").HelpSection;
|
|
11
|
+
run(): Promise<ConfigResponses>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Get = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
* Licensed under the BSD 3-Clause license.
|
|
8
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
+
*/
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const core_2 = require("@salesforce/core");
|
|
12
|
+
const config_1 = require("../../config");
|
|
13
|
+
core_2.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const messages = core_2.Messages.loadMessages('@salesforce/plugin-settings', 'get');
|
|
15
|
+
class Get extends config_1.ConfigCommand {
|
|
16
|
+
async run() {
|
|
17
|
+
const { argv, flags } = await this.parse(Get);
|
|
18
|
+
if (!argv || argv.length === 0) {
|
|
19
|
+
throw messages.createError('error.NoConfigKeysFound');
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const aggregator = await core_2.ConfigAggregator.create();
|
|
23
|
+
argv.forEach((configName) => {
|
|
24
|
+
try {
|
|
25
|
+
this.pushSuccess(aggregator.getInfo(configName, true));
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
this.pushFailure(configName, err);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (!this.jsonEnabled()) {
|
|
32
|
+
this.output('Get Config', flags.verbose);
|
|
33
|
+
}
|
|
34
|
+
return this.responses;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Get = Get;
|
|
39
|
+
Get.description = messages.getMessage('description');
|
|
40
|
+
Get.summary = messages.getMessage('summary');
|
|
41
|
+
Get.examples = messages.getMessages('examples');
|
|
42
|
+
Get.strict = false;
|
|
43
|
+
Get.flags = {
|
|
44
|
+
verbose: core_1.Flags.boolean({
|
|
45
|
+
summary: messages.getMessage('flags.verbose.summary'),
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
Get.configurationVariablesSection = config_1.CONFIG_HELP_SECTION;
|
|
49
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/config/get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CAAC,CAAC;AAC5C,UAAM,GAAG,KAAK,CAAC;AACf,SAAK,GAAG;IAC7B,OAAO,EAAE,YAAK,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC;KACtD,CAAC;CACH,CAAC;AAEY,iCAA6B,GAAG,4BAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigCommand, ConfigResponses } from '../../config';
|
|
2
|
+
export default class List extends ConfigCommand<ConfigResponses> {
|
|
3
|
+
static readonly description: string;
|
|
4
|
+
static readonly summary: string;
|
|
5
|
+
static readonly examples: string[];
|
|
6
|
+
static flags: {};
|
|
7
|
+
run(): Promise<ConfigResponses>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
* Licensed under the BSD 3-Clause license.
|
|
7
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
const core_1 = require("@salesforce/core");
|
|
10
|
+
const config_1 = require("../../config");
|
|
11
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
12
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-settings', 'list');
|
|
13
|
+
class List extends config_1.ConfigCommand {
|
|
14
|
+
async run() {
|
|
15
|
+
const aggregator = await core_1.ConfigAggregator.create();
|
|
16
|
+
aggregator.getConfigInfo().forEach((c) => {
|
|
17
|
+
this.pushSuccess(c);
|
|
18
|
+
});
|
|
19
|
+
if (!this.jsonEnabled()) {
|
|
20
|
+
this.output('List Config', true);
|
|
21
|
+
}
|
|
22
|
+
return this.responses;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = List;
|
|
26
|
+
List.description = messages.getMessage('description');
|
|
27
|
+
List.summary = messages.getMessage('summary');
|
|
28
|
+
List.examples = messages.getMessages('examples');
|
|
29
|
+
List.flags = {};
|
|
30
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/config/list.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2CAA8D;AAC9D,yCAA8D;AAE9D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;AAE9E,MAAqB,IAAK,SAAQ,sBAA8B;IAMvD,KAAK,CAAC,GAAG;QACd,MAAM,UAAU,GAAG,MAAM,uBAAgB,CAAC,MAAM,EAAE,CAAC;QAEnD,UAAU,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACvC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YACvB,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;SAClC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;;AAjBH,uBAkBC;AAjBwB,gBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,YAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,aAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AACrD,UAAK,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Config } from '@salesforce/core';
|
|
2
|
+
import { ConfigCommand, ConfigResponses } from '../../config';
|
|
3
|
+
export declare class Set extends ConfigCommand<ConfigResponses> {
|
|
4
|
+
static readonly description: string;
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly strict = false;
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
global: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
static configurationVariablesSection: import("@salesforce/sf-plugins-core/lib/util").HelpSection;
|
|
12
|
+
run(): Promise<ConfigResponses>;
|
|
13
|
+
protected resolveArguments(): Promise<string[]>;
|
|
14
|
+
protected parseConfigKeysAndValues(): Promise<{
|
|
15
|
+
[index: string]: string;
|
|
16
|
+
}>;
|
|
17
|
+
protected loadConfig(global: boolean): Promise<Config>;
|
|
18
|
+
private isOrgKey;
|
|
19
|
+
private validateOrg;
|
|
20
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Set = void 0;
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const core_2 = require("@salesforce/core");
|
|
12
|
+
const config_1 = require("../../config");
|
|
13
|
+
core_2.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const messages = core_2.Messages.loadMessages('@salesforce/plugin-settings', 'set');
|
|
15
|
+
class Set extends config_1.ConfigCommand {
|
|
16
|
+
async run() {
|
|
17
|
+
const { flags } = await this.parse(Set);
|
|
18
|
+
const config = await this.loadConfig(flags.global);
|
|
19
|
+
let value = '';
|
|
20
|
+
const configs = await this.parseConfigKeysAndValues();
|
|
21
|
+
for (const name of Object.keys(configs)) {
|
|
22
|
+
try {
|
|
23
|
+
value = configs[name];
|
|
24
|
+
// core's builtin config validation requires synchronous functions but there's
|
|
25
|
+
// currently no way to validate an org synchronously. Therefore, we have to manually
|
|
26
|
+
// validate the org here and manually set the error message if it fails
|
|
27
|
+
if (this.isOrgKey(name) && value)
|
|
28
|
+
await this.validateOrg(value);
|
|
29
|
+
config.set(name, value);
|
|
30
|
+
this.responses.push({ name, value, success: true });
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
this.pushFailure(name, err, value);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
await config.write();
|
|
37
|
+
if (!this.jsonEnabled()) {
|
|
38
|
+
this.output('Set Config', false);
|
|
39
|
+
}
|
|
40
|
+
return this.responses;
|
|
41
|
+
}
|
|
42
|
+
async resolveArguments() {
|
|
43
|
+
const { args, argv } = await this.parse(Set);
|
|
44
|
+
const argVals = Object.values(args);
|
|
45
|
+
return argv.filter((val) => !argVals.includes(val));
|
|
46
|
+
}
|
|
47
|
+
async parseConfigKeysAndValues() {
|
|
48
|
+
const configs = {};
|
|
49
|
+
const args = await this.resolveArguments();
|
|
50
|
+
if (!args.length) {
|
|
51
|
+
throw messages.createError('error.ArgumentsRequired');
|
|
52
|
+
}
|
|
53
|
+
// Support `config set key value`
|
|
54
|
+
if (args.length === 2 && !args[0].includes('=')) {
|
|
55
|
+
return { [args[0]]: args[1] };
|
|
56
|
+
}
|
|
57
|
+
// Ensure that all args are in the right format (e.g. key=value key1=value1)
|
|
58
|
+
args.forEach((arg) => {
|
|
59
|
+
const split = arg.split('=');
|
|
60
|
+
if (split.length !== 2) {
|
|
61
|
+
throw messages.createError('error.InvalidArgumentFormat', [arg]);
|
|
62
|
+
}
|
|
63
|
+
const [name, value] = split;
|
|
64
|
+
if (configs[name]) {
|
|
65
|
+
throw messages.createError('error.DuplicateArgument', [name]);
|
|
66
|
+
}
|
|
67
|
+
configs[name] = value || undefined;
|
|
68
|
+
});
|
|
69
|
+
return configs;
|
|
70
|
+
}
|
|
71
|
+
async loadConfig(global) {
|
|
72
|
+
try {
|
|
73
|
+
const config = await core_2.Config.create(core_2.Config.getDefaultOptions(global));
|
|
74
|
+
await config.read();
|
|
75
|
+
return config;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (error instanceof core_2.SfdxError) {
|
|
79
|
+
error.actions = error.actions || [];
|
|
80
|
+
error.actions.push('Run with --global to set for your entire workspace.');
|
|
81
|
+
}
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
isOrgKey(name) {
|
|
86
|
+
const orgKeys = [core_2.OrgConfigProperties.TARGET_DEV_HUB, core_2.OrgConfigProperties.TARGET_ORG];
|
|
87
|
+
return orgKeys.includes(name);
|
|
88
|
+
}
|
|
89
|
+
async validateOrg(value) {
|
|
90
|
+
try {
|
|
91
|
+
await core_2.Org.create({ aliasOrUsername: value });
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
throw new Error(`Invalid config value: org "${value}" is not authenticated.`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.Set = Set;
|
|
99
|
+
Set.description = messages.getMessage('description');
|
|
100
|
+
Set.summary = messages.getMessage('summary');
|
|
101
|
+
Set.examples = messages.getMessages('examples');
|
|
102
|
+
Set.strict = false;
|
|
103
|
+
Set.flags = {
|
|
104
|
+
global: core_1.Flags.boolean({
|
|
105
|
+
char: 'g',
|
|
106
|
+
summary: messages.getMessage('flags.global.summary'),
|
|
107
|
+
}),
|
|
108
|
+
};
|
|
109
|
+
Set.configurationVariablesSection = config_1.CONFIG_HELP_SECTION;
|
|
110
|
+
//# sourceMappingURL=set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/config/set.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,sCAAoC;AACpC,2CAAyF;AACzF,yCAAmF;AAEnF,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CA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K,GAAG;IAC7B,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;KACrD,CAAC;CACH,CAAC;AAEY,iCAA6B,GAAG,4BAAmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfigCommand, ConfigResponses } from '../../config';
|
|
2
|
+
export declare class UnSet extends ConfigCommand<ConfigResponses> {
|
|
3
|
+
static readonly description: string;
|
|
4
|
+
static readonly summary: string;
|
|
5
|
+
static readonly examples: string[];
|
|
6
|
+
static readonly strict = false;
|
|
7
|
+
static configurationVariablesSection: import("@salesforce/sf-plugins-core/lib/util").HelpSection;
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
global: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<ConfigResponses>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UnSet = void 0;
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const core_2 = require("@salesforce/core");
|
|
12
|
+
const config_1 = require("../../config");
|
|
13
|
+
core_2.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const messages = core_2.Messages.loadMessages('@salesforce/plugin-settings', 'unset');
|
|
15
|
+
class UnSet extends config_1.ConfigCommand {
|
|
16
|
+
async run() {
|
|
17
|
+
const { argv, flags } = await this.parse(UnSet);
|
|
18
|
+
if (!argv || argv.length === 0) {
|
|
19
|
+
throw messages.createError('error.NoConfigKeysFound');
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const config = await core_2.Config.create(core_2.Config.getDefaultOptions(flags.global));
|
|
23
|
+
await config.read();
|
|
24
|
+
argv.forEach((key) => {
|
|
25
|
+
try {
|
|
26
|
+
config.unset(key);
|
|
27
|
+
this.responses.push({ name: key, success: true });
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
this.pushFailure(key, err);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
await config.write();
|
|
34
|
+
if (!this.jsonEnabled()) {
|
|
35
|
+
this.output('Unset Config', false);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return this.responses;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.UnSet = UnSet;
|
|
42
|
+
UnSet.description = messages.getMessage('description');
|
|
43
|
+
UnSet.summary = messages.getMessage('summary');
|
|
44
|
+
UnSet.examples = messages.getMessages('examples');
|
|
45
|
+
UnSet.strict = false;
|
|
46
|
+
UnSet.configurationVariablesSection = config_1.CONFIG_HELP_SECTION;
|
|
47
|
+
UnSet.flags = {
|
|
48
|
+
global: core_1.Flags.boolean({
|
|
49
|
+
char: 'g',
|
|
50
|
+
summary: messages.getMessage('flags.global.summary'),
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=unset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unset.js","sourceRoot":"","sources":["../../../src/commands/config/unset.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,sCAAoC;AACpC,2CAAoD;AACpD,yCAAmF;AAEnF,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;AAE/E,MAAa,KAAM,SAAQ,sBAA8B;IAehD,KAAK,CAAC,GAAG;QACd,MA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;IAC7B,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;KACrD,CAAC;CACH,CAAC"}
|
package/lib/config.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { ConfigInfo } from '@salesforce/core';
|
|
3
|
+
export declare type Msg = {
|
|
4
|
+
name: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
success: boolean;
|
|
7
|
+
location?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
error?: Error;
|
|
11
|
+
};
|
|
12
|
+
export declare type ConfigResponses = Msg[];
|
|
13
|
+
export declare const CONFIG_HELP_SECTION: import("@salesforce/sf-plugins-core/lib/util").HelpSection;
|
|
14
|
+
export declare abstract class ConfigCommand<T> extends SfCommand<T> {
|
|
15
|
+
protected responses: ConfigResponses;
|
|
16
|
+
protected pushSuccess(configInfo: ConfigInfo): void;
|
|
17
|
+
protected pushFailure(name: string, err: string | Error, value?: string): void;
|
|
18
|
+
protected output(title: string, verbose: boolean): void;
|
|
19
|
+
}
|
package/lib/config.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ConfigCommand = exports.CONFIG_HELP_SECTION = void 0;
|
|
10
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
const sf_plugins_core_2 = require("@salesforce/sf-plugins-core");
|
|
13
|
+
exports.CONFIG_HELP_SECTION = (0, sf_plugins_core_2.toHelpSection)('CONFIGURATION VARIABLES', core_1.SfdxPropertyKeys.API_VERSION, core_1.SfdxPropertyKeys.DISABLE_TELEMETRY, core_1.SfdxPropertyKeys.INSTANCE_URL, core_1.SfdxPropertyKeys.MAX_QUERY_LIMIT, core_1.SfdxPropertyKeys.REST_DEPLOY, core_1.OrgConfigProperties.TARGET_ORG, core_1.OrgConfigProperties.TARGET_DEV_HUB);
|
|
14
|
+
class ConfigCommand extends sf_plugins_core_1.SfCommand {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.responses = [];
|
|
18
|
+
}
|
|
19
|
+
pushSuccess(configInfo) {
|
|
20
|
+
this.responses.push({
|
|
21
|
+
name: configInfo.key,
|
|
22
|
+
value: configInfo.value,
|
|
23
|
+
success: true,
|
|
24
|
+
location: configInfo.location,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
pushFailure(name, err, value) {
|
|
28
|
+
const error = core_1.SfdxError.wrap(err);
|
|
29
|
+
this.responses.push({
|
|
30
|
+
name,
|
|
31
|
+
success: false,
|
|
32
|
+
value,
|
|
33
|
+
error,
|
|
34
|
+
message: error.message.replace(/\.\.$/, '.'),
|
|
35
|
+
});
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
}
|
|
38
|
+
output(title, verbose) {
|
|
39
|
+
if (this.responses.length === 0) {
|
|
40
|
+
this.log('No results found');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const columns = {
|
|
44
|
+
name: { header: 'Name' },
|
|
45
|
+
};
|
|
46
|
+
if (!title.includes('Unset')) {
|
|
47
|
+
columns.value = {
|
|
48
|
+
header: 'Value',
|
|
49
|
+
get: (row) => row.value ?? '',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (!title.includes('List')) {
|
|
53
|
+
columns.success = { header: 'Success' };
|
|
54
|
+
}
|
|
55
|
+
if (verbose) {
|
|
56
|
+
columns.location = {
|
|
57
|
+
header: 'Location',
|
|
58
|
+
get: (row) => row.location ?? '',
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (this.responses.find((msg) => msg.error)) {
|
|
62
|
+
columns.message = {
|
|
63
|
+
header: 'Message',
|
|
64
|
+
get: (row) => row.message ?? '',
|
|
65
|
+
};
|
|
66
|
+
this.responses.map((msg) => (msg.message = msg.error?.message));
|
|
67
|
+
}
|
|
68
|
+
this.table(this.responses, columns, { title });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.ConfigCommand = ConfigCommand;
|
|
72
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iEAAwD;AAExD,2CAAgG;AAChG,iEAA4D;AAc/C,QAAA,mBAAmB,GAAG,IAAA,+BAAa,EAC9C,yBAAyB,EACzB,uBAAgB,CAAC,WAAW,EAC5B,uBAAgB,CAAC,iBAAiB,EAClC,uBAAgB,CAAC,YAAY,EAC7B,uBAAgB,CAAC,eAAe,EAChC,uBAAgB,CAAC,WAAW,EAC5B,0BAAmB,CAAC,UAAU,EAC9B,0BAAmB,CAAC,cAAc,CACnC,CAAC;AAEF,MAAsB,aAAiB,SAAQ,2BAAY;IAA3D;;QACY,cAAS,GAAoB,EAAE,CAAC;IA6D5C,CAAC;IA3DW,WAAW,CAAC,UAAsB;QAC1C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,UAAU,CAAC,GAAG;YACpB,KAAK,EAAE,UAAU,CAAC,KAA2B;YAC7C,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAC9B,CAAC,CAAC;IACL,CAAC;IAES,WAAW,CAAC,IAAY,EAAE,GAAmB,EAAE,KAAc;QACrE,MAAM,KAAK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SAAS;gBACjB,GAAG,EAAE,CAAC,GAAG,EAAU,EAAE,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE;aACxC,CAAC;YACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;SACjE;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;CACF;AA9DD,sCA8DC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const core_1 = require("@oclif/core");
|
|
10
|
+
const core_2 = require("@salesforce/core");
|
|
11
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
|
+
const log = core_2.Logger.childFromRoot('plugin-settings:load_config_meta');
|
|
13
|
+
const OCLIF_META_PJSON_KEY = 'configMeta';
|
|
14
|
+
function loadConfigMeta(plugin) {
|
|
15
|
+
let configMetaRequireLocation;
|
|
16
|
+
try {
|
|
17
|
+
const configMetaPath = (0, ts_types_1.get)(plugin, `pjson.oclif.${OCLIF_META_PJSON_KEY}`, null);
|
|
18
|
+
if (typeof configMetaPath !== 'string') {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const relativePath = (0, core_1.tsPath)(plugin.root, configMetaPath);
|
|
22
|
+
// use relative path if it exists, require string as is
|
|
23
|
+
configMetaRequireLocation = relativePath ?? configMetaPath;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!configMetaRequireLocation) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
|
|
33
|
+
const configMetaPathModule = require(configMetaRequireLocation);
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
|
|
35
|
+
return configMetaPathModule?.default ?? configMetaPathModule;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
log.error(`Error trying to load config meta from ${configMetaRequireLocation}`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const hook = ({ config }) => {
|
|
43
|
+
const flattenedConfigMetas = (config.plugins || [])
|
|
44
|
+
.map((plugin) => {
|
|
45
|
+
const configMeta = loadConfigMeta(plugin);
|
|
46
|
+
if (!configMeta) {
|
|
47
|
+
log.info(`No config meta found for ${plugin.name}`);
|
|
48
|
+
}
|
|
49
|
+
return configMeta;
|
|
50
|
+
})
|
|
51
|
+
.filter(ts_types_1.isObject)
|
|
52
|
+
.flat();
|
|
53
|
+
if (flattenedConfigMetas.length) {
|
|
54
|
+
core_2.Config.addAllowedProperties(flattenedConfigMetas);
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
};
|
|
58
|
+
exports.default = hook;
|
|
59
|
+
//# sourceMappingURL=load_config_meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load_config_meta.js","sourceRoot":"","sources":["../../../src/hooks/init/load_config_meta.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAGH,sCAAqC;AACrC,2CAAsE;AACtE,mDAAqD;AAErD,MAAM,GAAG,GAAG,aAAM,CAAC,aAAa,CAAC,kCAAkC,CAAC,CAAC;AACrE,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,SAAS,cAA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nD;IACD,OAAO;AACT,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,iBAAS,EAAE,CAAC"}
|
package/messages/get.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Get the value of a configuration variable.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Run "sf config list" to see all the configuration variables you've set. Global configuration variable are always displayed; local ones are displayed if you run the command in a project directory. Run "sf config set" to set a configuration variable.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Get the value of the "target-org" configuration variable.
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> target-org
|
|
14
|
+
|
|
15
|
+
- Get multiple configuration variables and display whether they're set locally or globally:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> target-org api-version --verbose
|
|
18
|
+
|
|
19
|
+
# flags.verbose.summary
|
|
20
|
+
|
|
21
|
+
Display whether the configuration variables are set locally or globally.
|
|
22
|
+
|
|
23
|
+
# error.NoConfigKeysFound
|
|
24
|
+
|
|
25
|
+
You must provide one or more configuration variables to get. Run "sf config list" to see the configuration variables you've previously set.
|
package/messages/list.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
List the configuration variables that you've previously set.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Global configuration variables apply to any directory and are always displayed. If you run this command from a project directory, local configuration variables are also displayed.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- List both global configuration variables and those local to your project:
|
|
12
|
+
|
|
13
|
+
$ <%= config.bin %> <%= command.id %>
|
package/messages/set.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Set one or more configuration variables, such as your default org.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Use configuration variables to set CLI defaults, such as your default org or the API version you want the CLI to use. For example, if you set the "target-org" configuration variable, you don't need to specify it as a "sf deploy metadata" flag if you're deploying to your default org.
|
|
8
|
+
|
|
9
|
+
Local configuration variables apply only to your current project. Global variables, specified with the --global flag, apply in any directory.
|
|
10
|
+
|
|
11
|
+
The resolution order if you've set a flag value in multiple ways is as follows:
|
|
12
|
+
|
|
13
|
+
1. Flag value specified at the command line.
|
|
14
|
+
2. Local (project-level) configuration variable.
|
|
15
|
+
3. Global configuration variable.
|
|
16
|
+
|
|
17
|
+
Run "sf config list" to see the configuration variables you've already set and their level (local or global).
|
|
18
|
+
|
|
19
|
+
# examples
|
|
20
|
+
|
|
21
|
+
- Set the local target-org configuration variable to an org username:
|
|
22
|
+
|
|
23
|
+
<%= config.bin %> <%= command.id %> target-org=me@my.org
|
|
24
|
+
|
|
25
|
+
- Set the local target-org configuration variable to an alias:
|
|
26
|
+
|
|
27
|
+
<%= config.bin %> <%= command.id %> target-org=my-scratch-org
|
|
28
|
+
|
|
29
|
+
- Set the global target-org configuration variable:
|
|
30
|
+
|
|
31
|
+
<%= config.bin %> <%= command.id %> --global target-org=my-scratch-org
|
|
32
|
+
|
|
33
|
+
# flags.global.summary
|
|
34
|
+
|
|
35
|
+
Set the configuration variables globally, so they can be used from any directory.
|
|
36
|
+
|
|
37
|
+
# error.InvalidArgumentFormat
|
|
38
|
+
|
|
39
|
+
Set configuration variables with this format: key=value or key="value with spaces". Use the --help flag to view the available configuration variables.
|
|
40
|
+
|
|
41
|
+
# error.DuplicateArgument
|
|
42
|
+
|
|
43
|
+
Found duplicate argument %s. You can specify a configuration variable only one time in a single command execution. Remove the duplicate and try again.
|
|
44
|
+
|
|
45
|
+
# error.ArgumentsRequired
|
|
46
|
+
|
|
47
|
+
You must provide one or more configuration variables to set. Use the --help flag to view the available configuration variables.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Unset local or global configuration variables.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Local configuration variables apply only to your current project. Global configuration variables apply in any directory.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Unset the local "target-org" configuration variable:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> target-org
|
|
14
|
+
|
|
15
|
+
- Unset multiple configuration variables globally:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> target-org api-version --global
|
|
18
|
+
|
|
19
|
+
# flags.global.summary
|
|
20
|
+
|
|
21
|
+
Unset the configuration variables globally, so they can no longer be used from any directory.
|
|
22
|
+
|
|
23
|
+
# error.NoConfigKeysFound
|
|
24
|
+
|
|
25
|
+
You must provide one or more configuration variables to unset. Run "sf config list" to see the configuration variables you've previously set.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"1.0.0","commands":{"config:get":{"id":"config:get","summary":"Get the value of a configuration variable.","description":"Run \"sf config list\" to see all the configuration variables you've set. Global configuration variable are always displayed; local ones are displayed if you run the command in a project directory. Run \"sf config set\" to set a configuration variable.","strict":false,"pluginName":"@salesforce/plugin-settings","pluginAlias":"@salesforce/plugin-settings","pluginType":"core","aliases":[],"examples":["Get the value of the \"target-org\" configuration variable.\n<%= config.bin %> <%= command.id %> target-org","Get multiple configuration variables and display whether they're set locally or globally:\n<%= config.bin %> <%= command.id %> target-org api-version --verbose"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"verbose":{"name":"verbose","type":"boolean","summary":"Display whether the configuration variables are set locally or globally.","allowNo":false}},"args":[],"configurationVariablesSection":{"header":"CONFIGURATION VARIABLES","body":[{"name":"apiVersion","description":"API version of your project. Default: API version of your Dev Hub org. (sfdx only)"},{"name":"disableTelemetry","description":"Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"},{"name":"instanceUrl","description":"URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"},{"name":"maxQueryLimit","description":"Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"},{"name":"restDeploy","description":"Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"},{"name":"target-org","description":"Username or alias of the org that all commands run against by default. (sf only)"},{"name":"target-dev-hub","description":"Username or alias of your default Dev Hub org. (sf only)"}]}},"config:list":{"id":"config:list","summary":"List the configuration variables that you've previously set.","description":"Global configuration variables apply to any directory and are always displayed. If you run this command from a project directory, local configuration variables are also displayed.","strict":true,"pluginName":"@salesforce/plugin-settings","pluginAlias":"@salesforce/plugin-settings","pluginType":"core","aliases":[],"examples":["List both global configuration variables and those local to your project:\n$ <%= config.bin %> <%= command.id %>"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false}},"args":[]},"config:set":{"id":"config:set","summary":"Set one or more configuration variables, such as your default org.","description":"Use configuration variables to set CLI defaults, such as your default org or the API version you want the CLI to use. For example, if you set the \"target-org\" configuration variable, you don't need to specify it as a \"sf deploy metadata\" flag if you're deploying to your default org.\n\nLocal configuration variables apply only to your current project. Global variables, specified with the --global flag, apply in any directory.\n\nThe resolution order if you've set a flag value in multiple ways is as follows:\n\n 1. Flag value specified at the command line.\n 2. Local (project-level) configuration variable.\n 3. Global configuration variable.\n\nRun \"sf config list\" to see the configuration variables you've already set and their level (local or global).","strict":false,"pluginName":"@salesforce/plugin-settings","pluginAlias":"@salesforce/plugin-settings","pluginType":"core","aliases":[],"examples":["Set the local target-org configuration variable to an org username:\n<%= config.bin %> <%= command.id %> target-org=me@my.org","Set the local target-org configuration variable to an alias:\n<%= config.bin %> <%= command.id %> target-org=my-scratch-org","Set the global target-org configuration variable:\n<%= config.bin %> <%= command.id %> --global target-org=my-scratch-org"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"global":{"name":"global","type":"boolean","char":"g","summary":"Set the configuration variables globally, so they can be used from any directory.","allowNo":false}},"args":[],"configurationVariablesSection":{"header":"CONFIGURATION VARIABLES","body":[{"name":"apiVersion","description":"API version of your project. Default: API version of your Dev Hub org. (sfdx only)"},{"name":"disableTelemetry","description":"Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"},{"name":"instanceUrl","description":"URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"},{"name":"maxQueryLimit","description":"Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"},{"name":"restDeploy","description":"Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"},{"name":"target-org","description":"Username or alias of the org that all commands run against by default. (sf only)"},{"name":"target-dev-hub","description":"Username or alias of your default Dev Hub org. (sf only)"}]}},"config:unset":{"id":"config:unset","summary":"Unset local or global configuration variables.","description":"Local configuration variables apply only to your current project. Global configuration variables apply in any directory.","strict":false,"pluginName":"@salesforce/plugin-settings","pluginAlias":"@salesforce/plugin-settings","pluginType":"core","aliases":[],"examples":["Unset the local \"target-org\" configuration variable:\n<%= config.bin %> <%= command.id %> target-org","Unset multiple configuration variables globally:\n<%= config.bin %> <%= command.id %> target-org api-version --global"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"global":{"name":"global","type":"boolean","char":"g","summary":"Unset the configuration variables globally, so they can no longer be used from any directory.","allowNo":false}},"args":[],"configurationVariablesSection":{"header":"CONFIGURATION VARIABLES","body":[{"name":"apiVersion","description":"API version of your project. Default: API version of your Dev Hub org. (sfdx only)"},{"name":"disableTelemetry","description":"Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"},{"name":"instanceUrl","description":"URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"},{"name":"maxQueryLimit","description":"Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"},{"name":"restDeploy","description":"Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"},{"name":"target-org","description":"Username or alias of the org that all commands run against by default. (sf only)"},{"name":"target-dev-hub","description":"Username or alias of your default Dev Hub org. (sf only)"}]}}}}
|
package/package.json
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/plugin-settings",
|
|
3
|
+
"description": "configure the Salesforce CLI",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"author": "Salesforce",
|
|
6
|
+
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@oclif/core": "^1.13.10",
|
|
9
|
+
"@salesforce/core": "^3.26.1",
|
|
10
|
+
"@salesforce/sf-plugins-core": "^1.13.2",
|
|
11
|
+
"tslib": "^2"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@oclif/plugin-command-snapshot": "^3.1.3",
|
|
15
|
+
"@oclif/test": "^2.1.1",
|
|
16
|
+
"@salesforce/cli-plugins-testkit": "^2.3.10",
|
|
17
|
+
"@salesforce/dev-config": "^3.1.0",
|
|
18
|
+
"@salesforce/dev-scripts": "^2.0.4",
|
|
19
|
+
"@salesforce/kit": "^1.5.45",
|
|
20
|
+
"@salesforce/plugin-command-reference": "^2.2.8",
|
|
21
|
+
"@salesforce/prettier-config": "^0.0.2",
|
|
22
|
+
"@salesforce/ts-sinon": "^1.3.21",
|
|
23
|
+
"@salesforce/ts-types": "^1.5.20",
|
|
24
|
+
"@types/fs-extra": "^9.0.13",
|
|
25
|
+
"@types/shelljs": "^0.8.11",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
27
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
28
|
+
"chai": "^4.3.6",
|
|
29
|
+
"eslint": "^7.32.0",
|
|
30
|
+
"eslint-config-prettier": "^8.5.0",
|
|
31
|
+
"eslint-config-salesforce": "^0.1.6",
|
|
32
|
+
"eslint-config-salesforce-license": "^0.1.6",
|
|
33
|
+
"eslint-config-salesforce-typescript": "^0.2.8",
|
|
34
|
+
"eslint-plugin-header": "^3.1.1",
|
|
35
|
+
"eslint-plugin-import": "2.25.2",
|
|
36
|
+
"eslint-plugin-jsdoc": "^35.5.1",
|
|
37
|
+
"eslint-plugin-prettier": "^3.4.1",
|
|
38
|
+
"eslint-plugin-sf-plugin": "^0.3.0",
|
|
39
|
+
"fs-extra": "^10.1.0",
|
|
40
|
+
"husky": "^7.0.4",
|
|
41
|
+
"lint-staged": "^11.2.6",
|
|
42
|
+
"mocha": "^9.2.2",
|
|
43
|
+
"nyc": "^15.1.0",
|
|
44
|
+
"oclif": "^2.7.0",
|
|
45
|
+
"prettier": "^2.7.1",
|
|
46
|
+
"pretty-quick": "^3.1.3",
|
|
47
|
+
"shelljs": "^0.8.5",
|
|
48
|
+
"shx": "0.3.3",
|
|
49
|
+
"sinon": "10.0.0",
|
|
50
|
+
"ts-node": "^10.9.1",
|
|
51
|
+
"typescript": "^4.7.4"
|
|
52
|
+
},
|
|
53
|
+
"config": {
|
|
54
|
+
"commitizen": {
|
|
55
|
+
"path": "cz-conventional-changelog"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=14.0.0"
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"/lib",
|
|
63
|
+
"/messages",
|
|
64
|
+
"/oclif.manifest.json",
|
|
65
|
+
"/schemas"
|
|
66
|
+
],
|
|
67
|
+
"homepage": "https://github.com/salesforcecli/plugin-settings",
|
|
68
|
+
"keywords": [
|
|
69
|
+
"force",
|
|
70
|
+
"salesforce",
|
|
71
|
+
"sfdx",
|
|
72
|
+
"salesforcedx",
|
|
73
|
+
"sfdx-plugin",
|
|
74
|
+
"sf-plugin",
|
|
75
|
+
"sf"
|
|
76
|
+
],
|
|
77
|
+
"license": "BSD-3-Clause",
|
|
78
|
+
"main": "lib/index.js",
|
|
79
|
+
"oclif": {
|
|
80
|
+
"commands": "./lib/commands",
|
|
81
|
+
"bin": "sf",
|
|
82
|
+
"topicSeparator": " ",
|
|
83
|
+
"hooks": {
|
|
84
|
+
"init": [
|
|
85
|
+
"./lib/hooks/init/load_config_meta"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"devPlugins": [
|
|
89
|
+
"@oclif/plugin-help",
|
|
90
|
+
"@oclif/plugin-command-snapshot",
|
|
91
|
+
"@salesforce/plugin-command-reference"
|
|
92
|
+
],
|
|
93
|
+
"topics": {
|
|
94
|
+
"config": {
|
|
95
|
+
"description": "Commands to configure Salesforce CLI."
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"repository": "salesforcecli/plugin-settings",
|
|
100
|
+
"scripts": {
|
|
101
|
+
"build": "sf-build",
|
|
102
|
+
"clean": "sf-clean",
|
|
103
|
+
"clean-all": "sf-clean all",
|
|
104
|
+
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
|
|
105
|
+
"compile": "sf-compile",
|
|
106
|
+
"docs": "sf-docs",
|
|
107
|
+
"format": "sf-format",
|
|
108
|
+
"lint": "sf-lint",
|
|
109
|
+
"postpack": "shx rm -f oclif.manifest.json",
|
|
110
|
+
"posttest": "yarn lint && yarn test:deprecation-policy && yarn test:json-schema && yarn test:command-reference",
|
|
111
|
+
"prepack": "sf-prepack",
|
|
112
|
+
"prepare": "sf-install",
|
|
113
|
+
"pretest": "sf-compile-test",
|
|
114
|
+
"reformat": "prettier --config .prettierrc --write './*.{js,json,md}' './**/*.{ts,json,md}'",
|
|
115
|
+
"test": "sf-test",
|
|
116
|
+
"test:command-reference": "./bin/dev commandreference:generate --erroronwarnings",
|
|
117
|
+
"test:deprecation-policy": "./bin/dev snapshot:compare",
|
|
118
|
+
"test:json-schema": "./bin/dev schema:compare",
|
|
119
|
+
"test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
|
|
120
|
+
"version": "oclif readme"
|
|
121
|
+
},
|
|
122
|
+
"publishConfig": {
|
|
123
|
+
"access": "public"
|
|
124
|
+
},
|
|
125
|
+
"sfdx": {
|
|
126
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-settings/1.0.0.crt",
|
|
127
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-settings/1.0.0.sig"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$ref": "#/definitions/ConfigResponses",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"ConfigResponses": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"$ref": "#/definitions/Msg"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"Msg": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"value": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"success": {
|
|
21
|
+
"type": "boolean"
|
|
22
|
+
},
|
|
23
|
+
"location": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"path": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"message": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"error": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"message": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"stack": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": ["name", "message"],
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["name", "success"],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$ref": "#/definitions/ConfigResponses",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"ConfigResponses": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"$ref": "#/definitions/Msg"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"Msg": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"value": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"success": {
|
|
21
|
+
"type": "boolean"
|
|
22
|
+
},
|
|
23
|
+
"location": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"path": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"message": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"error": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"message": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"stack": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": ["name", "message"],
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["name", "success"],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$ref": "#/definitions/ConfigResponses",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"ConfigResponses": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"$ref": "#/definitions/Msg"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"Msg": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"value": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"success": {
|
|
21
|
+
"type": "boolean"
|
|
22
|
+
},
|
|
23
|
+
"location": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"path": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"message": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"error": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"message": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"stack": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": ["name", "message"],
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["name", "success"],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$ref": "#/definitions/ConfigResponses",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"ConfigResponses": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"$ref": "#/definitions/Msg"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"Msg": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"value": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"success": {
|
|
21
|
+
"type": "boolean"
|
|
22
|
+
},
|
|
23
|
+
"location": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"path": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"message": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"error": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"message": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"stack": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": ["name", "message"],
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["name", "success"],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|