@salesforce/sf-plugins-core 1.13.1 → 1.14.1

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,19 @@
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.14.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.13.2...v1.14.1) (2022-08-23)
6
+
7
+ ### Features
8
+
9
+ - update custom flag definitions ([828daac](https://github.com/salesforcecli/sf-plugins-core/commit/828daac881124e7f1ef75a2efbcbd0de4a71bb3c))
10
+
11
+ ### [1.13.2](https://github.com/salesforcecli/sf-plugins-core/compare/v1.13.1...v1.13.2) (2022-08-09)
12
+
13
+ ### Bug Fixes
14
+
15
+ - add function overloads to custom flags ([12c1178](https://github.com/salesforcecli/sf-plugins-core/commit/12c117837a08bc8cf8eff41832f95a19d3386b18))
16
+ - compile errors ([3782a70](https://github.com/salesforcecli/sf-plugins-core/commit/3782a703b7b0eddbc3d47a7dcbdf33272bdfd6fc))
17
+
5
18
  ### [1.13.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.13.0...v1.13.1) (2022-08-03)
6
19
 
7
20
  ### Bug Fixes
package/lib/exported.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ import { Flags as OclifFlags } from '@oclif/core';
2
3
  export { toHelpSection } from './util';
3
4
  export { Deployable, Deployer, DeployerResult } from './deployer';
4
5
  export { Deauthorizer } from './deauthorizer';
@@ -7,25 +8,25 @@ export { SfHook } from './hooks';
7
8
  export * from './types';
8
9
  export { SfCommand, SfCommandInterface, StandardColors } from './sfCommand';
9
10
  export declare const Flags: {
10
- boolean: typeof import("@oclif/core/lib/parser/flags").boolean;
11
- directory: (opts?: ({
11
+ boolean: typeof OclifFlags.boolean;
12
+ directory: import("@oclif/core/lib/interfaces").Definition<string, {
12
13
  exists?: boolean | undefined;
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>;
15
- file: (opts?: ({
14
+ }>;
15
+ enum: typeof OclifFlags._enum;
16
+ file: import("@oclif/core/lib/interfaces").Definition<string, {
16
17
  exists?: boolean | undefined;
17
- } & Partial<import("@oclif/core/lib/interfaces").OptionFlag<string>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
18
- integer: (opts?: ({
18
+ }>;
19
+ integer: import("@oclif/core/lib/interfaces").Definition<number, {
19
20
  min?: number | undefined;
20
21
  max?: number | undefined;
21
- } & Partial<import("@oclif/core/lib/interfaces").OptionFlag<number>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
22
- string: import("@oclif/core/lib/interfaces").Definition<string>;
23
- url: import("@oclif/core/lib/interfaces").Definition<import("url").URL>;
24
- duration: (durationConfig: import("./flags/duration").DurationFlagConfig) => import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/kit").Duration | undefined>;
25
- salesforceId: (inputs?: import("./flags/salesforceId").IdFlagConfig) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
26
- orgApiVersion: import("@oclif/core/lib/interfaces").Definition<string>;
27
- requiredOrg: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org>;
28
- requiredHub: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org>;
29
- optionalOrg: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org | undefined>;
22
+ }>;
23
+ string: import("@oclif/core/lib/interfaces").Definition<string, Record<string, unknown>>;
24
+ url: import("@oclif/core/lib/interfaces").Definition<import("url").URL, Record<string, unknown>>;
25
+ duration: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/kit").Duration, import("./flags/duration").DurationFlagConfig>;
26
+ salesforceId: import("@oclif/core/lib/interfaces").Definition<string, import("./flags/salesforceId").IdFlagConfig>;
27
+ orgApiVersion: import("@oclif/core/lib/interfaces").Definition<string, Record<string, unknown>>;
28
+ requiredOrg: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org, Record<string, unknown>>;
29
+ requiredHub: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org, Record<string, unknown>>;
30
+ optionalOrg: import("@oclif/core/lib/interfaces").Definition<import("@salesforce/core").Org | undefined, Record<string, unknown>>;
30
31
  };
31
32
  //# sourceMappingURL=exported.d.ts.map
@@ -1,12 +1,11 @@
1
- import { Interfaces } from '@oclif/core';
2
1
  import { Duration } from '@salesforce/kit';
3
2
  declare type DurationUnit = Lowercase<keyof typeof Duration.Unit>;
4
- export interface DurationFlagConfig extends Partial<Interfaces.OptionFlag<Duration>> {
3
+ export declare type DurationFlagConfig = {
5
4
  unit: Required<DurationUnit>;
6
5
  defaultValue?: number;
7
6
  min?: number;
8
7
  max?: number;
9
- }
8
+ };
10
9
  /**
11
10
  * Duration flag with built-in default and min/max validation
12
11
  * You must specify a unit
@@ -24,6 +23,6 @@ export interface DurationFlagConfig extends Partial<Interfaces.OptionFlag<Durati
24
23
  * }),
25
24
  * }
26
25
  */
27
- export declare const durationFlag: (durationConfig: DurationFlagConfig) => Interfaces.OptionFlag<Duration | undefined>;
26
+ export declare const durationFlag: import("@oclif/core/lib/interfaces").Definition<Duration, DurationFlagConfig>;
28
27
  export {};
29
28
  //# sourceMappingURL=duration.d.ts.map
@@ -29,15 +29,12 @@ const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'me
29
29
  * }),
30
30
  * }
31
31
  */
32
- const durationFlag = (durationConfig) => {
33
- const { defaultValue, min, max, unit, ...baseProps } = durationConfig;
34
- return core_1.Flags.build({
35
- ...baseProps,
36
- parse: async (input) => validate(input, { min, max, unit }),
37
- default: defaultValue ? async () => toDuration(defaultValue, unit) : undefined,
38
- })();
39
- };
40
- exports.durationFlag = durationFlag;
32
+ exports.durationFlag = core_1.Flags.custom({
33
+ parse: async (input, _, opts) => validate(input, opts),
34
+ default: async (context) => {
35
+ return context.options.defaultValue ? toDuration(context.options.defaultValue, context.options.unit) : undefined;
36
+ },
37
+ });
41
38
  const validate = (input, config) => {
42
39
  const { min, max, unit } = config || {};
43
40
  let parsedInput;
@@ -9,5 +9,5 @@ export declare const maxDeprecatedUrl = "https://help.salesforce.com/s/articleVi
9
9
  * CAVEAT: unlike the apiversion flag on sfdxCommand, this does not set the version on the org/connection
10
10
  * We leave this up to the plugins to implement
11
11
  */
12
- export declare const orgApiVersionFlag: import("@oclif/core/lib/interfaces").Definition<string>;
12
+ export declare const orgApiVersionFlag: import("@oclif/core/lib/interfaces").Definition<string, Record<string, unknown>>;
13
13
  //# sourceMappingURL=orgApiVersion.d.ts.map
@@ -24,7 +24,7 @@ exports.maxDeprecatedUrl = 'https://help.salesforce.com/s/articleView?id=0003544
24
24
  * CAVEAT: unlike the apiversion flag on sfdxCommand, this does not set the version on the org/connection
25
25
  * We leave this up to the plugins to implement
26
26
  */
27
- exports.orgApiVersionFlag = core_1.Flags.build({
27
+ exports.orgApiVersionFlag = core_1.Flags.custom({
28
28
  parse: async (input) => validate(input),
29
29
  default: async () => await getDefaultFromConfig(),
30
30
  description: messages.getMessage('flags.apiVersion.description'),
@@ -16,7 +16,7 @@ import { Org } from '@salesforce/core';
16
16
  * }),
17
17
  * }
18
18
  */
19
- export declare const optionalOrgFlag: import("@oclif/core/lib/interfaces").Definition<Org | undefined>;
19
+ export declare const optionalOrgFlag: import("@oclif/core/lib/interfaces").Definition<Org | undefined, Record<string, unknown>>;
20
20
  /**
21
21
  * A required org, specified by username or alias
22
22
  * Will throw if the specified org default do not exist
@@ -36,7 +36,7 @@ export declare const optionalOrgFlag: import("@oclif/core/lib/interfaces").Defin
36
36
  * }),
37
37
  * }
38
38
  */
39
- export declare const requiredOrgFlag: import("@oclif/core/lib/interfaces").Definition<Org>;
39
+ export declare const requiredOrgFlag: import("@oclif/core/lib/interfaces").Definition<Org, Record<string, unknown>>;
40
40
  /**
41
41
  * A required org that is a devHub
42
42
  * Will throw if the specified org does not exist
@@ -56,5 +56,5 @@ export declare const requiredOrgFlag: import("@oclif/core/lib/interfaces").Defin
56
56
  * }),
57
57
  * }
58
58
  */
59
- export declare const requiredHubFlag: import("@oclif/core/lib/interfaces").Definition<Org>;
59
+ export declare const requiredHubFlag: import("@oclif/core/lib/interfaces").Definition<Org, Record<string, unknown>>;
60
60
  //# sourceMappingURL=orgFlags.d.ts.map
@@ -64,7 +64,7 @@ const getHubOrThrow = async (aliasOrUsername) => {
64
64
  * }),
65
65
  * }
66
66
  */
67
- exports.optionalOrgFlag = core_1.Flags.build({
67
+ exports.optionalOrgFlag = core_1.Flags.custom({
68
68
  char: 'e',
69
69
  parse: async (input) => await maybeGetOrg(input),
70
70
  default: async () => await maybeGetOrg(),
@@ -89,7 +89,7 @@ exports.optionalOrgFlag = core_1.Flags.build({
89
89
  * }),
90
90
  * }
91
91
  */
92
- exports.requiredOrgFlag = core_1.Flags.build({
92
+ exports.requiredOrgFlag = core_1.Flags.custom({
93
93
  char: 'e',
94
94
  parse: async (input) => await getOrgOrThrow(input),
95
95
  default: async () => await getOrgOrThrow(),
@@ -114,7 +114,7 @@ exports.requiredOrgFlag = core_1.Flags.build({
114
114
  * }),
115
115
  * }
116
116
  */
117
- exports.requiredHubFlag = core_1.Flags.build({
117
+ exports.requiredHubFlag = core_1.Flags.custom({
118
118
  char: 'v',
119
119
  parse: async (input) => await getHubOrThrow(input),
120
120
  default: async () => await getHubOrThrow(),
@@ -1,5 +1,4 @@
1
- import { Interfaces } from '@oclif/core';
2
- export interface IdFlagConfig extends Partial<Interfaces.OptionFlag<string>> {
1
+ export declare type IdFlagConfig = {
3
2
  /**
4
3
  * Can specify if the version must be 15 or 18 characters long. Leave blank to allow either 15 or 18.
5
4
  */
@@ -8,7 +7,7 @@ export interface IdFlagConfig extends Partial<Interfaces.OptionFlag<string>> {
8
7
  * If the ID belongs to a certain sobject type, specify the 3 character prefix.
9
8
  */
10
9
  startsWith?: string;
11
- }
10
+ };
12
11
  /**
13
12
  * Id flag with built-in validation. Short character is `i`
14
13
  *
@@ -28,5 +27,5 @@ export interface IdFlagConfig extends Partial<Interfaces.OptionFlag<string>> {
28
27
  * }),
29
28
  * }
30
29
  */
31
- export declare const salesforceIdFlag: (inputs?: IdFlagConfig) => Interfaces.OptionFlag<string | undefined>;
30
+ export declare const salesforceIdFlag: import("@oclif/core/lib/interfaces").Definition<string, IdFlagConfig>;
32
31
  //# sourceMappingURL=salesforceId.d.ts.map
@@ -30,15 +30,10 @@ const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'me
30
30
  * }),
31
31
  * }
32
32
  */
33
- const salesforceIdFlag = (inputs = {}) => {
34
- const { length, startsWith, ...baseProps } = inputs;
35
- return core_1.Flags.build({
36
- char: 'i',
37
- ...baseProps,
38
- parse: async (input) => validate(input, { length, startsWith }),
39
- })();
40
- };
41
- exports.salesforceIdFlag = salesforceIdFlag;
33
+ exports.salesforceIdFlag = core_1.Flags.custom({
34
+ parse: async (input, _ctx, opts) => validate(input, opts),
35
+ char: 'i',
36
+ });
42
37
  const validate = (input, config) => {
43
38
  const { length, startsWith } = config || {};
44
39
  if (length && input.length !== length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "1.13.1",
3
+ "version": "1.14.1",
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.0",
35
+ "@oclif/core": "^1.15.0",
36
36
  "@salesforce/core": "^3.25.0",
37
37
  "@salesforce/kit": "^1.5.44",
38
38
  "@salesforce/ts-types": "^1.5.20",