@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.
@@ -181,12 +181,14 @@ exports.generateScratchOrgInfo = generateScratchOrgInfo;
181
181
  */
182
182
  const getScratchOrgInfoPayload = async (options) => {
183
183
  let warnings = [];
184
- // orgConfig input overrides definitionjson (-j option; hidden/deprecated) overrides definitionfile (-f option)
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 ? JSON.parse(options.definitionjson) : {}),
189
- ...(options.orgConfig ?? {}),
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
- 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";
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
- 'Developer',
23
- 'Enterprise',
24
- 'Group',
25
- 'Partner Developer',
26
- 'Partner Enterprise',
27
- 'Partner Group',
28
- 'Partner Professional',
29
- 'Professional',
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
@@ -112,6 +112,7 @@ exports.simpleFeaturesList = [
112
112
  'EinsteinGPTForDevelopers',
113
113
  'EinsteinRecommendationBuilder',
114
114
  'EinsteinRecommendationBuilderMetadata',
115
+ 'EinsteinSalesRepFdbk',
115
116
  'EinsteinSearch',
116
117
  'EinsteinVisits',
117
118
  'EinsteinVisitsED',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.26.0",
3
+ "version": "8.26.1",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",
@@ -11,14 +11,14 @@
11
11
  "description": "The Salesforce edition of the scratch org.",
12
12
  "type": "string",
13
13
  "enum": [
14
- "Developer",
15
- "Enterprise",
16
- "Group",
17
- "Partner Developer",
18
- "Partner Enterprise",
19
- "Partner Group",
20
- "Partner Professional",
21
- "Professional"
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",