@salesforce/sf-plugins-core 1.19.1 → 1.19.2

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/lib/sfCommand.js CHANGED
@@ -171,14 +171,7 @@ class SfCommand extends core_1.Command {
171
171
  * @return true if the user confirms, false if they do not.
172
172
  */
173
173
  async confirm(message, ms = 10000) {
174
- const { confirmed } = await this.timedPrompt([
175
- {
176
- name: 'confirmed',
177
- message,
178
- type: 'confirm',
179
- },
180
- ], ms);
181
- return confirmed;
174
+ return this.prompter.confirm(message, ms);
182
175
  }
183
176
  /**
184
177
  * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
@@ -9,6 +9,14 @@ export declare class Prompter {
9
9
  * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
10
10
  */
11
11
  timedPrompt<T extends Prompter.Answers>(questions: Prompter.Questions<T>, ms?: number, initialAnswers?: Partial<T>): Promise<T>;
12
+ /**
13
+ * Simplified prompt for single-question confirmation. Times out and throws after 10s
14
+ *
15
+ * @param message text to display. Do not include a question mark.
16
+ * @param ms milliseconds to wait for user input. Defaults to 10s.
17
+ * @return true if the user confirms, false if they do not.
18
+ */
19
+ confirm(message: string, ms?: number): Promise<boolean>;
12
20
  }
13
21
  export declare namespace Prompter {
14
22
  type Answers<T = Record<string, unknown>> = T & Record<string, unknown>;
@@ -41,6 +41,23 @@ class Prompter {
41
41
  return result;
42
42
  });
43
43
  }
44
+ /**
45
+ * Simplified prompt for single-question confirmation. Times out and throws after 10s
46
+ *
47
+ * @param message text to display. Do not include a question mark.
48
+ * @param ms milliseconds to wait for user input. Defaults to 10s.
49
+ * @return true if the user confirms, false if they do not.
50
+ */
51
+ async confirm(message, ms = 10000) {
52
+ const { confirmed } = await this.timedPrompt([
53
+ {
54
+ name: 'confirmed',
55
+ message,
56
+ type: 'confirm',
57
+ },
58
+ ], ms);
59
+ return confirmed;
60
+ }
44
61
  }
45
62
  exports.Prompter = Prompter;
46
63
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "1.19.1",
3
+ "version": "1.19.2",
4
4
  "description": "Utils for writing deploy and retrieve plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",