@salesforce/sf-plugins-core 1.13.1 → 1.13.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/CHANGELOG.md +7 -0
- package/lib/exported.d.ts +7 -12
- package/lib/flags/duration.d.ts +6 -1
- package/lib/flags/duration.js +2 -19
- package/lib/flags/salesforceId.d.ts +6 -1
- package/lib/flags/salesforceId.js +2 -21
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.13.2](https://github.com/salesforcecli/sf-plugins-core/compare/v1.13.1...v1.13.2) (2022-08-09)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- add function overloads to custom flags ([12c1178](https://github.com/salesforcecli/sf-plugins-core/commit/12c117837a08bc8cf8eff41832f95a19d3386b18))
|
|
10
|
+
- compile errors ([3782a70](https://github.com/salesforcecli/sf-plugins-core/commit/3782a703b7b0eddbc3d47a7dcbdf33272bdfd6fc))
|
|
11
|
+
|
|
5
12
|
### [1.13.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.13.0...v1.13.1) (2022-08-03)
|
|
6
13
|
|
|
7
14
|
### Bug Fixes
|
package/lib/exported.d.ts
CHANGED
|
@@ -6,23 +6,18 @@ export { Progress, Prompter, generateTableChoices } from './ux';
|
|
|
6
6
|
export { SfHook } from './hooks';
|
|
7
7
|
export * from './types';
|
|
8
8
|
export { SfCommand, SfCommandInterface, StandardColors } from './sfCommand';
|
|
9
|
+
import { salesforceIdFlag } from './flags/salesforceId';
|
|
10
|
+
import { durationFlag } from './flags/duration';
|
|
9
11
|
export declare const Flags: {
|
|
10
12
|
boolean: typeof import("@oclif/core/lib/parser/flags").boolean;
|
|
11
|
-
directory:
|
|
12
|
-
exists?: boolean | undefined;
|
|
13
|
-
} & Partial<import("@oclif/core/lib/interfaces").OptionFlag<string>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
13
|
+
directory: typeof import("@oclif/core/lib/parser/flags").directory;
|
|
14
14
|
enum: <T = string>(opts: import("@oclif/core/lib/interfaces").EnumFlagOptions<T>) => import("@oclif/core/lib/interfaces").OptionFlag<T>;
|
|
15
|
-
file:
|
|
16
|
-
|
|
17
|
-
} & Partial<import("@oclif/core/lib/interfaces").OptionFlag<string>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
18
|
-
integer: (opts?: ({
|
|
19
|
-
min?: number | undefined;
|
|
20
|
-
max?: number | undefined;
|
|
21
|
-
} & Partial<import("@oclif/core/lib/interfaces").OptionFlag<number>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
15
|
+
file: typeof import("@oclif/core/lib/parser/flags").file;
|
|
16
|
+
integer: typeof import("@oclif/core/lib/parser/flags").integer;
|
|
22
17
|
string: import("@oclif/core/lib/interfaces").Definition<string>;
|
|
23
18
|
url: import("@oclif/core/lib/interfaces").Definition<import("url").URL>;
|
|
24
|
-
duration:
|
|
25
|
-
salesforceId:
|
|
19
|
+
duration: typeof durationFlag;
|
|
20
|
+
salesforceId: typeof salesforceIdFlag;
|
|
26
21
|
orgApiVersion: import("@oclif/core/lib/interfaces").Definition<string>;
|
|
27
22
|
requiredOrg: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org>;
|
|
28
23
|
requiredHub: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org>;
|
package/lib/flags/duration.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export interface DurationFlagConfig extends Partial<Interfaces.OptionFlag<Durati
|
|
|
24
24
|
* }),
|
|
25
25
|
* }
|
|
26
26
|
*/
|
|
27
|
-
export declare
|
|
27
|
+
export declare function durationFlag(durationConfig: DurationFlagConfig & ({
|
|
28
|
+
required: true;
|
|
29
|
+
} | {
|
|
30
|
+
default: Interfaces.Default<Duration>;
|
|
31
|
+
})): Interfaces.OptionFlag<Duration>;
|
|
32
|
+
export declare function durationFlag(durationConfig: DurationFlagConfig): Interfaces.OptionFlag<Duration | undefined>;
|
|
28
33
|
export {};
|
|
29
34
|
//# sourceMappingURL=duration.d.ts.map
|
package/lib/flags/duration.js
CHANGED
|
@@ -12,31 +12,14 @@ const core_2 = require("@salesforce/core");
|
|
|
12
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
13
|
core_2.Messages.importMessagesDirectory(__dirname);
|
|
14
14
|
const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
|
|
15
|
-
|
|
16
|
-
* Duration flag with built-in default and min/max validation
|
|
17
|
-
* You must specify a unit
|
|
18
|
-
* Defaults to undefined if you don't specify a default
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
22
|
-
* public static flags = {
|
|
23
|
-
* 'wait': duration({
|
|
24
|
-
* min: 1,
|
|
25
|
-
* unit: 'minutes'
|
|
26
|
-
* defaultValue: 33,
|
|
27
|
-
* char: 'w',
|
|
28
|
-
* description: 'Wait time in minutes'
|
|
29
|
-
* }),
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
|
-
const durationFlag = (durationConfig) => {
|
|
15
|
+
function durationFlag(durationConfig) {
|
|
33
16
|
const { defaultValue, min, max, unit, ...baseProps } = durationConfig;
|
|
34
17
|
return core_1.Flags.build({
|
|
35
18
|
...baseProps,
|
|
36
19
|
parse: async (input) => validate(input, { min, max, unit }),
|
|
37
20
|
default: defaultValue ? async () => toDuration(defaultValue, unit) : undefined,
|
|
38
21
|
})();
|
|
39
|
-
}
|
|
22
|
+
}
|
|
40
23
|
exports.durationFlag = durationFlag;
|
|
41
24
|
const validate = (input, config) => {
|
|
42
25
|
const { min, max, unit } = config || {};
|
|
@@ -28,5 +28,10 @@ export interface IdFlagConfig extends Partial<Interfaces.OptionFlag<string>> {
|
|
|
28
28
|
* }),
|
|
29
29
|
* }
|
|
30
30
|
*/
|
|
31
|
-
export declare
|
|
31
|
+
export declare function salesforceIdFlag(inputs: IdFlagConfig & ({
|
|
32
|
+
required: true;
|
|
33
|
+
} | {
|
|
34
|
+
default: Interfaces.Default<string>;
|
|
35
|
+
})): Interfaces.OptionFlag<string>;
|
|
36
|
+
export declare function salesforceIdFlag(inputs?: IdFlagConfig): Interfaces.OptionFlag<string | undefined>;
|
|
32
37
|
//# sourceMappingURL=salesforceId.d.ts.map
|
|
@@ -11,33 +11,14 @@ const core_1 = require("@oclif/core");
|
|
|
11
11
|
const core_2 = require("@salesforce/core");
|
|
12
12
|
core_2.Messages.importMessagesDirectory(__dirname);
|
|
13
13
|
const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
|
|
14
|
-
|
|
15
|
-
* Id flag with built-in validation. Short character is `i`
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
19
|
-
* public static flags = {
|
|
20
|
-
* // set length or prefix
|
|
21
|
-
* 'flag-name': salesforceId({ length: 15, startsWith: '00D' }),
|
|
22
|
-
* // add flag properties
|
|
23
|
-
* 'flag2': salesforceId({
|
|
24
|
-
* required: true,
|
|
25
|
-
* description: 'flag2 description',
|
|
26
|
-
* }),
|
|
27
|
-
* // override the character i
|
|
28
|
-
* 'flag3': salesforceId({
|
|
29
|
-
* char: 'j',
|
|
30
|
-
* }),
|
|
31
|
-
* }
|
|
32
|
-
*/
|
|
33
|
-
const salesforceIdFlag = (inputs = {}) => {
|
|
14
|
+
function salesforceIdFlag(inputs = {}) {
|
|
34
15
|
const { length, startsWith, ...baseProps } = inputs;
|
|
35
16
|
return core_1.Flags.build({
|
|
36
17
|
char: 'i',
|
|
37
18
|
...baseProps,
|
|
38
19
|
parse: async (input) => validate(input, { length, startsWith }),
|
|
39
20
|
})();
|
|
40
|
-
}
|
|
21
|
+
}
|
|
41
22
|
exports.salesforceIdFlag = salesforceIdFlag;
|
|
42
23
|
const validate = (input, config) => {
|
|
43
24
|
const { length, startsWith } = config || {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/sf-plugins-core",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"description": "Utils for writing deploy and retrieve plugins",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"/messages"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@oclif/core": "^1.13.
|
|
35
|
+
"@oclif/core": "^1.13.9",
|
|
36
36
|
"@salesforce/core": "^3.25.0",
|
|
37
37
|
"@salesforce/kit": "^1.5.44",
|
|
38
38
|
"@salesforce/ts-types": "^1.5.20",
|