@salesforce/sf-plugins-core 1.21.6 → 1.21.8

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/deployer.d.ts CHANGED
@@ -75,7 +75,7 @@ export declare namespace Deployer {
75
75
  * ```
76
76
  */
77
77
  type Options<T = AnyJson> = JsonMap & {
78
- [key: string]: T;
78
+ [key: string]: T | undefined;
79
79
  };
80
80
  }
81
81
  //# sourceMappingURL=deployer.d.ts.map
@@ -1,8 +1,8 @@
1
1
  export type IdFlagConfig = {
2
2
  /**
3
- * Can specify if the version must be 15 or 18 characters long. Leave blank to allow either 15 or 18.
3
+ * Can specify if the version must be 15 or 18 characters long or 'both'. Leave blank to allow either 15 or 18.
4
4
  */
5
- length?: 15 | 18;
5
+ length?: 15 | 18 | 'both';
6
6
  /**
7
7
  * If the ID belongs to a certain sobject type, specify the 3 character prefix.
8
8
  */
@@ -39,11 +39,12 @@ exports.salesforceIdFlag = core_1.Flags.custom({
39
39
  });
40
40
  const validate = (input, config) => {
41
41
  const { length, startsWith } = config ?? {};
42
- if (length && input.length !== length) {
43
- throw messages.createError('errors.InvalidIdLength', [length]);
44
- }
45
- if (!length && ![15, 18].includes(input.length)) {
46
- throw messages.createError('errors.InvalidIdLength', ['15 or 18']);
42
+ // If the flag doesn't specify a length or specifies "both", then let it accept both 15 or 18.
43
+ const allowedIdLength = (!length || length === 'both') ? [15, 18] : [length];
44
+ if (!allowedIdLength.includes(input.length)) {
45
+ throw messages.createError('errors.InvalidIdLength', [
46
+ allowedIdLength.join(` ${messages.getMessage('errors.InvalidIdLength.or')} `),
47
+ ]);
47
48
  }
48
49
  if (!core_2.sfdc.validateSalesforceId(input)) {
49
50
  throw messages.createError('errors.InvalidId');
package/lib/util.d.ts CHANGED
@@ -1,11 +1,5 @@
1
1
  import { EnvironmentVariable, OrgConfigProperties, SfdxPropertyKeys } from '@salesforce/core';
2
- export type HelpSection = {
3
- header: string;
4
- body: Array<{
5
- name: string;
6
- description: string;
7
- } | undefined>;
8
- };
2
+ import { HelpSection } from '@oclif/core';
9
3
  /**
10
4
  * Function to build a help section for command help.
11
5
  * Takes a string to be used as section header text and an array of enums
package/lib/util.js CHANGED
@@ -42,10 +42,11 @@ function toHelpSection(header, ...vars) {
42
42
  return Object.entries(v).map(([name, description]) => ({ name, description }));
43
43
  }
44
44
  })
45
- .filter((b) => b);
45
+ .filter(isHelpSectionBodyEntry);
46
46
  return { header, body };
47
47
  }
48
48
  exports.toHelpSection = toHelpSection;
49
+ const isHelpSectionBodyEntry = (entry) => typeof entry === 'object' && entry !== null && 'name' in entry && 'description' in entry;
49
50
  function parseVarArgs(args, argv) {
50
51
  const final = {};
51
52
  const argVals = Object.values(args);
@@ -14,6 +14,10 @@ This command is required to run from within a Salesforce project directory.
14
14
 
15
15
  The id must be %s characters.
16
16
 
17
+ # errors.InvalidIdLength.or
18
+
19
+ or
20
+
17
21
  # errors.InvalidId
18
22
 
19
23
  The id is invalid.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "1.21.6",
3
+ "version": "1.21.8",
4
4
  "description": "Utils for writing deploy and retrieve plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",