@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 +1 -1
- package/lib/flags/salesforceId.d.ts +2 -2
- package/lib/flags/salesforceId.js +6 -5
- package/lib/util.d.ts +1 -7
- package/lib/util.js +2 -1
- package/messages/messages.md +4 -0
- package/package.json +1 -1
package/lib/deployer.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type IdFlagConfig = {
|
|
2
2
|
/**
|
|
3
|
-
* Can specify if the version must be 15 or 18 characters long.
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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(
|
|
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);
|
package/messages/messages.md
CHANGED