@salesforce/core 8.23.5-dev.0 → 8.23.5-qaext.0
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/index.d.ts +6 -1
- package/lib/index.js +11 -2
- package/lib/org/scratchOrgInfoGenerator.js +12 -1
- package/lib/schema/project-scratch-def/features.d.ts +4 -0
- package/lib/schema/project-scratch-def/features.js +25 -0
- package/lib/schema/project-scratch-def/patternFeaturesList.d.ts +1 -0
- package/lib/schema/project-scratch-def/patternFeaturesList.js +69 -0
- package/lib/schema/project-scratch-def/scratchOrgDef.d.ts +178 -0
- package/lib/schema/project-scratch-def/scratchOrgDef.js +73 -0
- package/lib/schema/project-scratch-def/settings.d.ts +150 -0
- package/lib/schema/project-scratch-def/settings.js +591 -0
- package/lib/schema/project-scratch-def/simpleFeaturesList.d.ts +1 -0
- package/lib/schema/project-scratch-def/simpleFeaturesList.js +272 -0
- package/lib/schema/sfdx-project/bundleEntry.d.ts +11 -0
- package/lib/schema/sfdx-project/bundleEntry.js +28 -0
- package/lib/schema/sfdx-project/packageDir.d.ts +103 -0
- package/lib/schema/sfdx-project/packageDir.js +165 -0
- package/lib/schema/sfdx-project/registryPresets.d.ts +2 -0
- package/lib/schema/sfdx-project/registryPresets.js +12 -0
- package/lib/schema/sfdx-project/registryVariants.d.ts +104 -0
- package/lib/schema/sfdx-project/registryVariants.js +57 -0
- package/lib/schema/sfdx-project/replacements.d.ts +70 -0
- package/lib/schema/sfdx-project/replacements.js +76 -0
- package/lib/schema/sfdx-project/sfdxProjectJson.d.ts +201 -0
- package/lib/schema/sfdx-project/sfdxProjectJson.js +89 -0
- package/lib/schema/validator.d.ts +8 -0
- package/lib/schema/validator.js +8 -0
- package/lib/sfProject.d.ts +7 -5
- package/lib/sfProject.js +17 -21
- package/package.json +52 -6
package/lib/schema/validator.js
CHANGED
|
@@ -40,6 +40,8 @@ const fs_1 = require("../fs/fs");
|
|
|
40
40
|
const sfError_1 = require("../sfError");
|
|
41
41
|
/**
|
|
42
42
|
* Loads a JSON schema and performs validations against JSON objects.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated For sfdx-project.json and scratch org definitions, use the exported zod schemas (ProjectJsonSchema, ScratchOrgDefSchema) from '@salesforce/core'. For custom schemas, use a schema validator library like zod directly.
|
|
43
45
|
*/
|
|
44
46
|
class SchemaValidator {
|
|
45
47
|
schemaPath;
|
|
@@ -59,6 +61,8 @@ class SchemaValidator {
|
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
61
63
|
* Loads a JSON schema from the `schemaPath` parameter provided at instantiation.
|
|
64
|
+
*
|
|
65
|
+
* @deprecated For sfdx-project.json and scratch org definitions, use the exported zod schemas (ProjectJsonSchema, ScratchOrgDefSchema) from '@salesforce/core'. For custom schemas, use a schema validator library like zod directly.
|
|
62
66
|
*/
|
|
63
67
|
async load() {
|
|
64
68
|
if (!this.schema) {
|
|
@@ -69,6 +73,8 @@ class SchemaValidator {
|
|
|
69
73
|
}
|
|
70
74
|
/**
|
|
71
75
|
* Loads a JSON schema from the `schemaPath` parameter provided at instantiation.
|
|
76
|
+
*
|
|
77
|
+
* @deprecated For sfdx-project.json and scratch org definitions, use the exported zod schemas (ProjectJsonSchema, ScratchOrgDefSchema) from '@salesforce/core'. For custom schemas, use a schema validator library like zod directly.
|
|
72
78
|
*/
|
|
73
79
|
loadSync() {
|
|
74
80
|
if (!this.schema) {
|
|
@@ -86,6 +92,7 @@ class SchemaValidator {
|
|
|
86
92
|
*
|
|
87
93
|
* @param json A JSON value to validate against this instance's target schema.
|
|
88
94
|
* @returns The validated JSON data.
|
|
95
|
+
* @deprecated For sfdx-project.json and scratch org definitions, use the exported zod schemas (ProjectJsonSchema, ScratchOrgDefSchema) from '@salesforce/core'. For custom schemas, use a schema validator library like zod directly.
|
|
89
96
|
*/
|
|
90
97
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
91
98
|
async validate(json) {
|
|
@@ -100,6 +107,7 @@ class SchemaValidator {
|
|
|
100
107
|
*
|
|
101
108
|
* @param json A JSON value to validate against this instance's target schema.
|
|
102
109
|
* @returns The validated JSON data.
|
|
110
|
+
* @deprecated For sfdx-project.json and scratch org definitions, use the exported zod schemas (ProjectJsonSchema, ScratchOrgDefSchema) from '@salesforce/core'. For custom schemas, use a schema validator library like zod directly.
|
|
103
111
|
*/
|
|
104
112
|
validateSync(json) {
|
|
105
113
|
const schema = this.loadSync();
|
package/lib/sfProject.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Dictionary, JsonMap, Nullable, Optional } from '@salesforce/ts-types';
|
|
2
|
-
import { PackageDir,
|
|
2
|
+
import { PackageDir, PackagePackageDir } from './schema/sfdx-project/packageDir';
|
|
3
|
+
import { BundleEntry } from './schema/sfdx-project/bundleEntry';
|
|
4
|
+
import { type ProjectJson as ProjectJsonType } from './schema/sfdx-project/sfdxProjectJson';
|
|
3
5
|
import { ConfigFile } from './config/configFile';
|
|
4
6
|
import { ConfigContents } from './config/configStackTypes';
|
|
5
7
|
type NameAndFullPath = {
|
|
@@ -14,8 +16,7 @@ type NameAndFullPath = {
|
|
|
14
16
|
};
|
|
15
17
|
export type NamedPackagingDir = PackagePackageDir & NameAndFullPath;
|
|
16
18
|
export type NamedPackageDir = PackageDir & NameAndFullPath;
|
|
17
|
-
export type
|
|
18
|
-
export type ProjectJson = ConfigContents & ProjectJsonSchema;
|
|
19
|
+
export type ProjectJson = ConfigContents & ProjectJsonType;
|
|
19
20
|
/**
|
|
20
21
|
* The sfdx-project.json config object. This file determines if a folder is a valid sfdx project.
|
|
21
22
|
*
|
|
@@ -56,7 +57,7 @@ export declare class SfProjectJson extends ConfigFile<ConfigFile.Options, Projec
|
|
|
56
57
|
* Validates sfdx-project.json against the schema.
|
|
57
58
|
*
|
|
58
59
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
59
|
-
* A warning is
|
|
60
|
+
* A warning is emitted by default when the file is invalid.
|
|
60
61
|
*
|
|
61
62
|
* ***See*** [sfdx-project.schema.json] ((https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
62
63
|
*/
|
|
@@ -70,7 +71,7 @@ export declare class SfProjectJson extends ConfigFile<ConfigFile.Options, Projec
|
|
|
70
71
|
* Validates sfdx-project.json against the schema.
|
|
71
72
|
*
|
|
72
73
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
73
|
-
* A warning is
|
|
74
|
+
* A warning is emitted by default when the file is invalid.
|
|
74
75
|
*
|
|
75
76
|
* ***See*** [sfdx-project.schema.json] ((https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
76
77
|
*/
|
|
@@ -400,3 +401,4 @@ export declare class SfProject {
|
|
|
400
401
|
export declare const isPackagingDirectory: (packageDir: PackageDir) => packageDir is PackagePackageDir;
|
|
401
402
|
/** differentiate between the Base PackageDir (path, maybe default) and the Packaging version (package and maybe a LOT of other fields) by whether is has the `package` property */
|
|
402
403
|
export declare const isNamedPackagingDirectory: (packageDir: NamedPackageDir) => packageDir is NamedPackagingDir;
|
|
404
|
+
export {};
|
package/lib/sfProject.js
CHANGED
|
@@ -10,15 +10,16 @@ exports.isNamedPackagingDirectory = exports.isPackagingDirectory = exports.SfPro
|
|
|
10
10
|
const node_path_1 = require("node:path");
|
|
11
11
|
const kit_1 = require("@salesforce/kit");
|
|
12
12
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
13
|
+
const sfdxProjectJson_1 = require("./schema/sfdx-project/sfdxProjectJson");
|
|
13
14
|
const fs_1 = require("./fs/fs");
|
|
14
15
|
const sfdcUrl_1 = require("./util/sfdcUrl");
|
|
15
16
|
const configAggregator_1 = require("./config/configAggregator");
|
|
16
17
|
const configFile_1 = require("./config/configFile");
|
|
17
|
-
const validator_1 = require("./schema/validator");
|
|
18
18
|
const internal_1 = require("./util/internal");
|
|
19
19
|
const sfError_1 = require("./sfError");
|
|
20
20
|
const messages_1 = require("./messages");
|
|
21
21
|
const findUppercaseKeys_1 = require("./util/findUppercaseKeys");
|
|
22
|
+
const lifecycleEvents_1 = require("./lifecycleEvents");
|
|
22
23
|
;
|
|
23
24
|
const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "%s does not contain a valid Salesforce DX project."], ["schemaValidationError", "The config file \"%s\" is not schema valid.\nDue to: %s"], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", "In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ \"path\": \"packageDirectory1\", \"default\": true }, { \"path\": \"packageDirectory2\" }]`"], ["missingPackageDirectory", "The path \"%s\", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root."], ["invalidPackageDirectory", "The path \"%s\", specified in sfdx-project.json, must be indicated as a relative path to the project root."], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", "The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `\"default\": false` key and try again."], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
|
|
24
25
|
/**
|
|
@@ -87,7 +88,7 @@ class SfProjectJson extends configFile_1.ConfigFile {
|
|
|
87
88
|
* Validates sfdx-project.json against the schema.
|
|
88
89
|
*
|
|
89
90
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
90
|
-
* A warning is
|
|
91
|
+
* A warning is emitted by default when the file is invalid.
|
|
91
92
|
*
|
|
92
93
|
* ***See*** [sfdx-project.schema.json] ((https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
93
94
|
*/
|
|
@@ -96,19 +97,16 @@ class SfProjectJson extends configFile_1.ConfigFile {
|
|
|
96
97
|
// read calls back into this method after necessarily setting this.hasRead=true
|
|
97
98
|
await this.read();
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
catch (err) {
|
|
105
|
-
const error = err;
|
|
100
|
+
const result = sfdxProjectJson_1.ProjectJsonSchema.safeParse(this.getContents());
|
|
101
|
+
if (!result.success) {
|
|
102
|
+
const errorMessages = result.error.issues.map((err) => `${err.path.join('.')}: ${err.message}`).join('\n');
|
|
103
|
+
const fullMessage = messages.getMessage('schemaValidationError', [this.getPath(), errorMessages]);
|
|
106
104
|
// Don't throw errors if the global isn't valid, but still warn the user.
|
|
107
105
|
if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
|
|
108
|
-
throw messages.createError('schemaValidationError', [this.getPath(),
|
|
106
|
+
throw messages.createError('schemaValidationError', [this.getPath(), errorMessages], [this.getPath()]);
|
|
109
107
|
}
|
|
110
108
|
else {
|
|
111
|
-
|
|
109
|
+
await lifecycleEvents_1.Lifecycle.getInstance().emitWarning(fullMessage);
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
112
|
}
|
|
@@ -124,7 +122,7 @@ class SfProjectJson extends configFile_1.ConfigFile {
|
|
|
124
122
|
* Validates sfdx-project.json against the schema.
|
|
125
123
|
*
|
|
126
124
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
127
|
-
* A warning is
|
|
125
|
+
* A warning is emitted by default when the file is invalid.
|
|
128
126
|
*
|
|
129
127
|
* ***See*** [sfdx-project.schema.json] ((https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
130
128
|
*/
|
|
@@ -133,19 +131,17 @@ class SfProjectJson extends configFile_1.ConfigFile {
|
|
|
133
131
|
// read calls back into this method after necessarily setting this.hasRead=true
|
|
134
132
|
this.readSync();
|
|
135
133
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
const error = err;
|
|
134
|
+
const result = sfdxProjectJson_1.ProjectJsonSchema.safeParse(this.getContents());
|
|
135
|
+
if (!result.success) {
|
|
136
|
+
const errorMessages = result.error.issues.map((err) => `${err.path.join('.')}: ${err.message}`).join('\n');
|
|
137
|
+
const fullMessage = messages.getMessage('schemaValidationError', [this.getPath(), errorMessages]);
|
|
143
138
|
// Don't throw errors if the global isn't valid, but still warn the user.
|
|
144
139
|
if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
|
|
145
|
-
throw messages.createError('schemaValidationError', [this.getPath(),
|
|
140
|
+
throw messages.createError('schemaValidationError', [this.getPath(), errorMessages], [this.getPath()]);
|
|
146
141
|
}
|
|
147
142
|
else {
|
|
148
|
-
|
|
143
|
+
// For sync method, we can't await emitWarning, so we use void to fire and forget
|
|
144
|
+
void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(fullMessage);
|
|
149
145
|
}
|
|
150
146
|
}
|
|
151
147
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "8.23.5-
|
|
3
|
+
"version": "8.23.5-qaext.0",
|
|
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",
|
|
@@ -22,10 +22,13 @@
|
|
|
22
22
|
"./project": "./lib/sfProject.js",
|
|
23
23
|
"./sfError": "./lib/sfError.js",
|
|
24
24
|
"./stateAggregator": "./lib/stateAggregator/stateAggregator.js",
|
|
25
|
-
"./testSetup": "./lib/testSetup.js"
|
|
25
|
+
"./testSetup": "./lib/testSetup.js",
|
|
26
|
+
"./sfdx-project.schema.json": "./lib/sfdx-project.schema.json",
|
|
27
|
+
"./project-scratch-def.schema.json": "./lib/project-scratch-def.schema.json"
|
|
26
28
|
},
|
|
27
29
|
"scripts": {
|
|
28
30
|
"build": "wireit",
|
|
31
|
+
"bundle-check": "wireit",
|
|
29
32
|
"clean": "sf-clean",
|
|
30
33
|
"clean-all": "sf-clean all",
|
|
31
34
|
"compile": "wireit",
|
|
@@ -37,9 +40,11 @@
|
|
|
37
40
|
"prepack": "sf-prepack",
|
|
38
41
|
"prepare": "sf-install",
|
|
39
42
|
"test": "wireit",
|
|
40
|
-
"test:nuts": "
|
|
43
|
+
"test:nuts": "wireit",
|
|
41
44
|
"test:only": "wireit",
|
|
42
|
-
"test:perf": "ts-node test/perf/logger/main.test.ts"
|
|
45
|
+
"test:perf": "ts-node test/perf/logger/main.test.ts",
|
|
46
|
+
"update:features": "ts-node scripts/schemas/update-features.ts",
|
|
47
|
+
"update:settings": "ts-node scripts/schemas/update-settings.ts"
|
|
43
48
|
},
|
|
44
49
|
"keywords": [
|
|
45
50
|
"force",
|
|
@@ -57,7 +62,6 @@
|
|
|
57
62
|
"dependencies": {
|
|
58
63
|
"@jsforce/jsforce-node": "^3.10.8",
|
|
59
64
|
"@salesforce/kit": "^3.2.4",
|
|
60
|
-
"@salesforce/schemas": "^1.10.3",
|
|
61
65
|
"@salesforce/ts-types": "^2.0.12",
|
|
62
66
|
"ajv": "^8.17.1",
|
|
63
67
|
"change-case": "^4.1.2",
|
|
@@ -73,7 +77,8 @@
|
|
|
73
77
|
"pino-pretty": "^11.3.0",
|
|
74
78
|
"proper-lockfile": "^4.1.2",
|
|
75
79
|
"semver": "^7.7.3",
|
|
76
|
-
"ts-retry-promise": "^0.8.1"
|
|
80
|
+
"ts-retry-promise": "^0.8.1",
|
|
81
|
+
"zod": "^4.1.12"
|
|
77
82
|
},
|
|
78
83
|
"devDependencies": {
|
|
79
84
|
"@salesforce/dev-scripts": "^10.1.1",
|
|
@@ -172,6 +177,19 @@
|
|
|
172
177
|
"link-check"
|
|
173
178
|
]
|
|
174
179
|
},
|
|
180
|
+
"test:nuts": {
|
|
181
|
+
"command": "mocha \"test/**/*.nut.ts\" --timeout 500000",
|
|
182
|
+
"dependencies": [
|
|
183
|
+
"compile"
|
|
184
|
+
],
|
|
185
|
+
"files": [
|
|
186
|
+
"test/nut/**/*",
|
|
187
|
+
"src/**/*.ts",
|
|
188
|
+
"**/tsconfig.json",
|
|
189
|
+
".mocha*"
|
|
190
|
+
],
|
|
191
|
+
"output": []
|
|
192
|
+
},
|
|
175
193
|
"bundle-check": {
|
|
176
194
|
"command": "node scripts/build.mjs",
|
|
177
195
|
"dependencies": [
|
|
@@ -197,6 +215,34 @@
|
|
|
197
215
|
},
|
|
198
216
|
"compile-typedoc": {
|
|
199
217
|
"command": "tsc -p typedocExamples"
|
|
218
|
+
},
|
|
219
|
+
"build:schema:project": {
|
|
220
|
+
"command": "ts-node scripts/schemas/build-schema-project.ts",
|
|
221
|
+
"dependencies": [
|
|
222
|
+
"compile"
|
|
223
|
+
],
|
|
224
|
+
"files": [
|
|
225
|
+
"src/schema/sfdx-project/**/*.ts",
|
|
226
|
+
"scripts/schemas/build-schema-project.ts",
|
|
227
|
+
"scripts/schemas/consts.ts"
|
|
228
|
+
],
|
|
229
|
+
"output": [
|
|
230
|
+
"lib/sfdx-project.schema.json"
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
"build:schema:scratch": {
|
|
234
|
+
"command": "ts-node scripts/schemas/build-schema-scratch.ts",
|
|
235
|
+
"dependencies": [
|
|
236
|
+
"compile"
|
|
237
|
+
],
|
|
238
|
+
"files": [
|
|
239
|
+
"src/schema/project-scratch-def/**/*.ts",
|
|
240
|
+
"scripts/schemas/build-schema-scratch.ts",
|
|
241
|
+
"scripts/schemas/consts.ts"
|
|
242
|
+
],
|
|
243
|
+
"output": [
|
|
244
|
+
"lib/project-scratch-def.schema.json"
|
|
245
|
+
]
|
|
200
246
|
}
|
|
201
247
|
}
|
|
202
248
|
}
|