@salesforce/sf-plugins-core 1.7.0 → 1.7.3

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 CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
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
4
 
5
+ ### [1.7.3](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.2...v1.7.3) (2022-03-17)
6
+
7
+ ### Bug Fixes
8
+
9
+ - use OptionFlag interface so that exactlyOne can be used ([0e65453](https://github.com/salesforcecli/sf-plugins-core/commit/0e65453dacb68a90f4af2387e571edbd4077ba1b))
10
+
11
+ ### [1.7.2](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.1...v1.7.2) (2022-03-15)
12
+
13
+ ### Bug Fixes
14
+
15
+ - need to pass ms to timedPrompt function ([f285e07](https://github.com/salesforcecli/sf-plugins-core/commit/f285e07525937798d0251da69c86c05cc683edfd))
16
+
17
+ ### [1.7.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.0...v1.7.1) (2022-03-11)
18
+
19
+ ### Bug Fixes
20
+
21
+ - add oclif enum to exports ([71ee6ac](https://github.com/salesforcecli/sf-plugins-core/commit/71ee6ac7942790ffc519512ade67330614ada51b))
22
+ - expose timed prompt in command class ([3b056c6](https://github.com/salesforcecli/sf-plugins-core/commit/3b056c668d3379ada6f85e2e5b5f6da76c1a3223))
23
+
5
24
  ## [1.7.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.6.1...v1.7.0) (2022-03-11)
6
25
 
7
26
  ### Features
package/lib/exported.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare const Flags: {
11
11
  directory: (opts?: ({
12
12
  exists?: boolean | undefined;
13
13
  } & Partial<import("@oclif/core/lib/interfaces").OptionFlag<string>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
14
+ enum: <T = string>(opts: import("@oclif/core/lib/interfaces").EnumFlagOptions<T>) => import("@oclif/core/lib/interfaces").OptionFlag<T>;
14
15
  file: (opts?: ({
15
16
  exists?: boolean | undefined;
16
17
  } & Partial<import("@oclif/core/lib/interfaces").OptionFlag<string>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
package/lib/exported.js CHANGED
@@ -46,6 +46,7 @@ const duration_1 = require("./flags/duration");
46
46
  exports.Flags = {
47
47
  boolean: core_1.Flags.boolean,
48
48
  directory: core_1.Flags.directory,
49
+ enum: core_1.Flags.enum,
49
50
  file: core_1.Flags.file,
50
51
  integer: core_1.Flags.integer,
51
52
  string: core_1.Flags.string,
@@ -1,7 +1,7 @@
1
1
  import { Interfaces } from '@oclif/core';
2
2
  import { Duration } from '@salesforce/kit';
3
3
  declare type DurationUnit = Lowercase<keyof typeof Duration.Unit>;
4
- export interface DurationFlagConfig extends Partial<Interfaces.OptionFlagProps> {
4
+ export interface DurationFlagConfig extends Partial<Interfaces.OptionFlag<Duration>> {
5
5
  unit: Required<DurationUnit>;
6
6
  defaultValue?: number;
7
7
  min?: number;
@@ -58,7 +58,7 @@ exports.optionalOrgFlag = core_1.Flags.build({
58
58
  char: 'e',
59
59
  parse: async (input) => await maybeGetOrg(input),
60
60
  default: async () => await maybeGetOrg(),
61
- defaultHelp: async () => { var _a; return (_a = (await maybeGetOrg(undefined))) === null || _a === void 0 ? void 0 : _a.getUsername(); },
61
+ defaultHelp: async () => { var _a; return (_a = (await maybeGetOrg())) === null || _a === void 0 ? void 0 : _a.getUsername(); },
62
62
  });
63
63
  /**
64
64
  * An required org, specified by username or alias
@@ -82,8 +82,8 @@ exports.optionalOrgFlag = core_1.Flags.build({
82
82
  exports.requiredOrgFlag = core_1.Flags.build({
83
83
  char: 'e',
84
84
  parse: async (input) => await getOrgOrThrow(input),
85
- default: async () => await getOrgOrThrow(undefined),
86
- defaultHelp: async () => { var _a; return (_a = (await getOrgOrThrow(undefined))) === null || _a === void 0 ? void 0 : _a.getUsername(); },
85
+ default: async () => await getOrgOrThrow(),
86
+ defaultHelp: async () => { var _a; return (_a = (await getOrgOrThrow())) === null || _a === void 0 ? void 0 : _a.getUsername(); },
87
87
  });
88
88
  /**
89
89
  * An required org that is a devHub
@@ -107,7 +107,7 @@ exports.requiredOrgFlag = core_1.Flags.build({
107
107
  exports.requiredHubFlag = core_1.Flags.build({
108
108
  char: 'v',
109
109
  parse: async (input) => await getHubOrThrow(input),
110
- default: async () => await getHubOrThrow(undefined),
111
- defaultHelp: async () => { var _a; return (_a = (await getHubOrThrow(undefined))) === null || _a === void 0 ? void 0 : _a.getUsername(); },
110
+ default: async () => await getHubOrThrow(),
111
+ defaultHelp: async () => { var _a; return (_a = (await getHubOrThrow())) === null || _a === void 0 ? void 0 : _a.getUsername(); },
112
112
  });
113
113
  //# sourceMappingURL=orgFlags.js.map
@@ -1,5 +1,5 @@
1
1
  import { Interfaces } from '@oclif/core';
2
- export interface IdFlagConfig extends Partial<Interfaces.OptionFlagProps> {
2
+ export interface IdFlagConfig extends Partial<Interfaces.OptionFlag<string>> {
3
3
  /**
4
4
  * Can specify if the version must be 15 or 18 characters long. Leave blank to allow either 15 or 18.
5
5
  */
@@ -80,6 +80,10 @@ export declare abstract class SfCommand<T> extends Command {
80
80
  * }
81
81
  */
82
82
  prompt<R = Prompter.Answers>(questions: Prompter.Questions<R>, initialAnswers?: Partial<R>): Promise<R>;
83
+ /**
84
+ * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
85
+ */
86
+ timedPrompt<R = Prompter.Answers>(questions: Prompter.Questions<R>, ms?: number, initialAnswers?: Partial<R>): Promise<R>;
83
87
  _run<R>(): Promise<R | undefined>;
84
88
  /**
85
89
  * Wrap the command result into the standardized JSON structure.
package/lib/sfCommand.js CHANGED
@@ -113,6 +113,12 @@ class SfCommand extends core_1.Command {
113
113
  async prompt(questions, initialAnswers) {
114
114
  return this.prompter.prompt(questions, initialAnswers);
115
115
  }
116
+ /**
117
+ * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
118
+ */
119
+ async timedPrompt(questions, ms = 10000, initialAnswers) {
120
+ return this.prompter.timedPrompt(questions, ms, initialAnswers);
121
+ }
116
122
  async _run() {
117
123
  if (this.statics.requiresProject) {
118
124
  this.project = await this.assignProject();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "1.7.0",
3
+ "version": "1.7.3",
4
4
  "description": "Utils for writing deploy and retrieve plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",