@salesforce/core 8.26.0 → 8.26.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/lib/org/scratchOrgInfoGenerator.js +18 -3
- package/lib/schema/project-scratch-def/scratchOrgDef.d.ts +8 -8
- package/lib/schema/project-scratch-def/scratchOrgDef.js +8 -8
- package/lib/schema/project-scratch-def/simpleFeaturesList.js +1 -0
- package/package.json +1 -1
- package/schemas/project-scratch-def.schema.json +9 -8
|
@@ -181,12 +181,14 @@ exports.generateScratchOrgInfo = generateScratchOrgInfo;
|
|
|
181
181
|
*/
|
|
182
182
|
const getScratchOrgInfoPayload = async (options) => {
|
|
183
183
|
let warnings = [];
|
|
184
|
-
//
|
|
184
|
+
// Merge after all validations complete
|
|
185
185
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
186
186
|
const scratchOrgInfoPayload = {
|
|
187
187
|
...(options.definitionfile ? await parseDefinitionFile(options.definitionfile) : {}),
|
|
188
|
-
...(options.definitionjson
|
|
189
|
-
|
|
188
|
+
...(options.definitionjson
|
|
189
|
+
? await validateInputDef(JSON.parse(options.definitionjson), 'definitionjson')
|
|
190
|
+
: {}),
|
|
191
|
+
...(options.orgConfig ? await validateInputDef(options.orgConfig, 'orgConfig') : {}),
|
|
190
192
|
};
|
|
191
193
|
// scratchOrgInfoPayload must be heads down camelcase.
|
|
192
194
|
Object.keys(scratchOrgInfoPayload).forEach((key) => {
|
|
@@ -223,6 +225,19 @@ const getScratchOrgInfoPayload = async (options) => {
|
|
|
223
225
|
};
|
|
224
226
|
};
|
|
225
227
|
exports.getScratchOrgInfoPayload = getScratchOrgInfoPayload;
|
|
228
|
+
/**
|
|
229
|
+
* Validates input definition objects (definitionjson or orgConfig) against schema
|
|
230
|
+
* Emits warnings if validation issues are found
|
|
231
|
+
*/
|
|
232
|
+
const validateInputDef = async (input, source) => {
|
|
233
|
+
const result = scratchOrgDef_1.ScratchOrgDefSchema.safeParse(input);
|
|
234
|
+
if (!result.success) {
|
|
235
|
+
const errorMessages = result.error.issues.map((err) => `${err.path.join('.')}: ${err.message}`).join('\n');
|
|
236
|
+
await lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`Scratch org definition validation issues in ${source}:\n${errorMessages}`);
|
|
237
|
+
return input;
|
|
238
|
+
}
|
|
239
|
+
return result.data;
|
|
240
|
+
};
|
|
226
241
|
const parseDefinitionFile = async (definitionFile) => {
|
|
227
242
|
try {
|
|
228
243
|
const fileData = await fs_1.fs.promises.readFile(definitionFile, 'utf8');
|
|
@@ -6,14 +6,14 @@ import { z } from 'zod';
|
|
|
6
6
|
export declare const ScratchOrgDefSchema: z.ZodObject<{
|
|
7
7
|
orgName: z.ZodOptional<z.ZodString>;
|
|
8
8
|
edition: z.ZodEnum<{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
9
|
+
group: "group";
|
|
10
|
+
developer: "developer";
|
|
11
|
+
enterprise: "enterprise";
|
|
12
|
+
"partner-developer": "partner-developer";
|
|
13
|
+
"partner-enterprise": "partner-enterprise";
|
|
14
|
+
"partner-group": "partner-group";
|
|
15
|
+
"partner-professional": "partner-professional";
|
|
16
|
+
professional: "professional";
|
|
17
17
|
}>;
|
|
18
18
|
country: z.ZodOptional<z.ZodString>;
|
|
19
19
|
username: z.ZodOptional<z.ZodString>;
|
|
@@ -19,14 +19,14 @@ exports.ScratchOrgDefSchema = zod_1.z
|
|
|
19
19
|
orgName: zod_1.z.string().optional().describe('The name of the scratch org.').meta({ title: 'Organization Name' }),
|
|
20
20
|
edition: zod_1.z
|
|
21
21
|
.enum([
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
22
|
+
'developer',
|
|
23
|
+
'enterprise',
|
|
24
|
+
'group',
|
|
25
|
+
'partner-developer',
|
|
26
|
+
'partner-enterprise',
|
|
27
|
+
'partner-group',
|
|
28
|
+
'partner-professional',
|
|
29
|
+
'professional',
|
|
30
30
|
])
|
|
31
31
|
.describe('The Salesforce edition of the scratch org.'),
|
|
32
32
|
country: zod_1.z
|
package/package.json
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"description": "The Salesforce edition of the scratch org.",
|
|
12
12
|
"type": "string",
|
|
13
13
|
"enum": [
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
14
|
+
"developer",
|
|
15
|
+
"enterprise",
|
|
16
|
+
"group",
|
|
17
|
+
"partner-developer",
|
|
18
|
+
"partner-enterprise",
|
|
19
|
+
"partner-group",
|
|
20
|
+
"partner-professional",
|
|
21
|
+
"professional"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"country": {
|
|
@@ -452,6 +452,7 @@
|
|
|
452
452
|
"EinsteinGPTForDevelopers",
|
|
453
453
|
"EinsteinRecommendationBuilder",
|
|
454
454
|
"EinsteinRecommendationBuilderMetadata",
|
|
455
|
+
"EinsteinSalesRepFdbk",
|
|
455
456
|
"EinsteinSearch",
|
|
456
457
|
"EinsteinVisits",
|
|
457
458
|
"EinsteinVisitsED",
|