@salesforce/core 8.23.7 → 8.24.1-dev.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/LICENSE.txt +1 -1
- package/README.md +27 -0
- 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 +2 -0
- package/lib/schema/project-scratch-def/features.js +36 -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 +176 -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 +84 -0
- package/lib/schema/sfdx-project/packageDir.js +146 -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 +62 -9
- package/schemas/project-scratch-def.schema.json +1789 -0
- package/schemas/sfdx-project.schema.json +909 -0
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.
|
|
3
|
+
"version": "8.24.1-dev.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": "./schemas/sfdx-project.schema.json",
|
|
27
|
+
"./project-scratch-def.schema.json": "./schemas/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",
|
|
@@ -51,13 +56,13 @@
|
|
|
51
56
|
"docs",
|
|
52
57
|
"lib",
|
|
53
58
|
"messages",
|
|
59
|
+
"schemas",
|
|
54
60
|
"!lib/**/*.map",
|
|
55
61
|
"messageTransformer/messageTransformer.ts"
|
|
56
62
|
],
|
|
57
63
|
"dependencies": {
|
|
58
|
-
"@jsforce/jsforce-node": "^3.10.
|
|
64
|
+
"@jsforce/jsforce-node": "^3.10.12-dev.0",
|
|
59
65
|
"@salesforce/kit": "^3.2.4",
|
|
60
|
-
"@salesforce/schemas": "^1.10.3",
|
|
61
66
|
"@salesforce/ts-types": "^2.0.12",
|
|
62
67
|
"ajv": "^8.17.1",
|
|
63
68
|
"change-case": "^4.1.2",
|
|
@@ -73,7 +78,8 @@
|
|
|
73
78
|
"pino-pretty": "^11.3.0",
|
|
74
79
|
"proper-lockfile": "^4.1.2",
|
|
75
80
|
"semver": "^7.7.3",
|
|
76
|
-
"ts-retry-promise": "^0.8.1"
|
|
81
|
+
"ts-retry-promise": "^0.8.1",
|
|
82
|
+
"zod": "^4.1.12"
|
|
77
83
|
},
|
|
78
84
|
"devDependencies": {
|
|
79
85
|
"@salesforce/dev-scripts": "^10.1.1",
|
|
@@ -109,8 +115,13 @@
|
|
|
109
115
|
},
|
|
110
116
|
"compile": {
|
|
111
117
|
"command": "tspc -p . --pretty --incremental",
|
|
118
|
+
"dependencies": [
|
|
119
|
+
"build:schema:project",
|
|
120
|
+
"build:schema:scratch"
|
|
121
|
+
],
|
|
112
122
|
"files": [
|
|
113
123
|
"src/**/*.ts",
|
|
124
|
+
"src/**/*.json",
|
|
114
125
|
"tsconfig.json",
|
|
115
126
|
"messages",
|
|
116
127
|
"messageTransformer"
|
|
@@ -153,6 +164,10 @@
|
|
|
153
164
|
},
|
|
154
165
|
"test:only": {
|
|
155
166
|
"command": "nyc mocha \"test/unit/**/*.test.ts\"",
|
|
167
|
+
"dependencies": [
|
|
168
|
+
"build:schema:project",
|
|
169
|
+
"build:schema:scratch"
|
|
170
|
+
],
|
|
156
171
|
"env": {
|
|
157
172
|
"FORCE_COLOR": "2"
|
|
158
173
|
},
|
|
@@ -170,9 +185,23 @@
|
|
|
170
185
|
"dependencies": [
|
|
171
186
|
"test:only",
|
|
172
187
|
"test:compile",
|
|
173
|
-
"link-check"
|
|
188
|
+
"link-check",
|
|
189
|
+
"bundle-check"
|
|
174
190
|
]
|
|
175
191
|
},
|
|
192
|
+
"test:nuts": {
|
|
193
|
+
"command": "mocha \"test/**/*.nut.ts\" --timeout 500000",
|
|
194
|
+
"dependencies": [
|
|
195
|
+
"compile"
|
|
196
|
+
],
|
|
197
|
+
"files": [
|
|
198
|
+
"test/nut/**/*",
|
|
199
|
+
"src/**/*.ts",
|
|
200
|
+
"**/tsconfig.json",
|
|
201
|
+
".mocha*"
|
|
202
|
+
],
|
|
203
|
+
"output": []
|
|
204
|
+
},
|
|
176
205
|
"bundle-check": {
|
|
177
206
|
"command": "node scripts/build.mjs",
|
|
178
207
|
"dependencies": [
|
|
@@ -187,7 +216,7 @@
|
|
|
187
216
|
]
|
|
188
217
|
},
|
|
189
218
|
"link-check": {
|
|
190
|
-
"command": "node -e \"process.exit(process.env.CI ? 0 : 1)\" || linkinator \"./*.md\" --skip \"examples/README.md|CHANGELOG.md|node_modules|test/|confluence.internal.salesforce.com|my.salesforce.com|%s\" --markdown --retry --directory-listing --verbosity error",
|
|
219
|
+
"command": "node -e \"process.exit(process.env.CI ? 0 : 1)\" || linkinator \"./*.md\" --skip \"examples/README.md|CHANGELOG.md|node_modules|test/|confluence.internal.salesforce.com|my.salesforce.com|%s|npmjs.com\" --markdown --retry --directory-listing --verbosity error",
|
|
191
220
|
"files": [
|
|
192
221
|
"./*.md",
|
|
193
222
|
"./examples/**/*.md",
|
|
@@ -198,6 +227,30 @@
|
|
|
198
227
|
},
|
|
199
228
|
"compile-typedoc": {
|
|
200
229
|
"command": "tsc -p typedocExamples"
|
|
230
|
+
},
|
|
231
|
+
"build:schema:project": {
|
|
232
|
+
"command": "ts-node scripts/schemas/build-schema-project.ts",
|
|
233
|
+
"files": [
|
|
234
|
+
"src/schema/sfdx-project/**/*.ts",
|
|
235
|
+
"scripts/schemas/build-schema-project.ts",
|
|
236
|
+
"scripts/schemas/consts.ts"
|
|
237
|
+
],
|
|
238
|
+
"output": [
|
|
239
|
+
"schemas/sfdx-project.schema.json"
|
|
240
|
+
],
|
|
241
|
+
"clean": "if-file-deleted"
|
|
242
|
+
},
|
|
243
|
+
"build:schema:scratch": {
|
|
244
|
+
"command": "ts-node scripts/schemas/build-schema-scratch.ts",
|
|
245
|
+
"files": [
|
|
246
|
+
"src/schema/project-scratch-def/**/*.ts",
|
|
247
|
+
"scripts/schemas/build-schema-scratch.ts",
|
|
248
|
+
"scripts/schemas/consts.ts"
|
|
249
|
+
],
|
|
250
|
+
"output": [
|
|
251
|
+
"schemas/project-scratch-def.schema.json"
|
|
252
|
+
],
|
|
253
|
+
"clean": "if-file-deleted"
|
|
201
254
|
}
|
|
202
255
|
}
|
|
203
256
|
}
|