@salesforce/core 2.36.1 → 2.36.4
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/CHANGELOG.md +17 -0
- package/lib/config/config.js +4 -2
- package/lib/org.d.ts +34 -0
- package/lib/org.js +62 -0
- package/lib/schema/validator.d.ts +7 -5
- package/lib/schema/validator.js +42 -67
- package/lib/sfdxProject.d.ts +2 -2
- package/lib/sfdxProject.js +2 -4
- package/messages/org.json +3 -1
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.36.4](https://github.com/forcedotcom/sfdx-core/compare/v2.36.3...v2.36.4) (2022-04-28)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- disable strictSchema ([2f44345](https://github.com/forcedotcom/sfdx-core/commit/2f44345d6dc11673b921b6c65cd548b7f31a0dad))
|
|
10
|
+
- replace JSEN with AJV (wip) ([87ca60c](https://github.com/forcedotcom/sfdx-core/commit/87ca60c48a82618008d761bdd6086727f712aeff))
|
|
11
|
+
- schema comment ([a0868d1](https://github.com/forcedotcom/sfdx-core/commit/a0868d157fbc8757cdbd28472aecfbf597c0f9d2))
|
|
12
|
+
- test failures and cleanup ([95c0710](https://github.com/forcedotcom/sfdx-core/commit/95c0710938b399c858cddfdf5100892ee2e7cf90))
|
|
13
|
+
|
|
14
|
+
### [2.36.3](https://github.com/forcedotcom/sfdx-core/compare/v2.36.2...v2.36.3) (2022-04-21)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- log rotation errors ([#562](https://github.com/forcedotcom/sfdx-core/issues/562)) ([16a5423](https://github.com/forcedotcom/sfdx-core/commit/16a5423079daad37e1ada6d47767923ec0b7cc94))
|
|
19
|
+
|
|
20
|
+
### [2.36.2](https://github.com/forcedotcom/sfdx-core/compare/v2.36.1...v2.36.2) (2022-04-20)
|
|
21
|
+
|
|
5
22
|
### [2.36.1](https://github.com/forcedotcom/sfdx-core/compare/v2.36.0...v2.36.1) (2022-04-14)
|
|
6
23
|
|
|
7
24
|
### Bug Fixes
|
package/lib/config/config.js
CHANGED
|
@@ -16,7 +16,6 @@ const sfdxError_1 = require("../sfdxError");
|
|
|
16
16
|
const sfdc_1 = require("../util/sfdc");
|
|
17
17
|
const sfdcUrl_1 = require("../util/sfdcUrl");
|
|
18
18
|
const configFile_1 = require("./configFile");
|
|
19
|
-
const log = logger_1.Logger.childFromRoot('core:config');
|
|
20
19
|
const SFDX_CONFIG_FILE_NAME = 'sfdx-config.json';
|
|
21
20
|
/**
|
|
22
21
|
* The files where sfdx config values are stored for projects and the global space.
|
|
@@ -64,9 +63,12 @@ class Config extends configFile_1.ConfigFile {
|
|
|
64
63
|
*/
|
|
65
64
|
static addAllowedProperties(metas) {
|
|
66
65
|
const currentMetaKeys = Object.keys(Config.propertyConfigMap);
|
|
66
|
+
// If logger is needed elsewhere in this file, do not move this outside of the Config class.
|
|
67
|
+
// It was causing issues with Bunyan log rotation. See https://github.com/forcedotcom/sfdx-core/pull/562
|
|
68
|
+
const logger = logger_1.Logger.childFromRoot('core:config');
|
|
67
69
|
metas.forEach((meta) => {
|
|
68
70
|
if (currentMetaKeys.includes(meta.key)) {
|
|
69
|
-
|
|
71
|
+
logger.info(`Key ${meta.key} already exists in allowedProperties, skipping.`);
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
72
74
|
Config.allowedProperties.push(meta);
|
package/lib/org.d.ts
CHANGED
|
@@ -113,6 +113,17 @@ export declare class Org extends AsyncCreatable<Org.Options> {
|
|
|
113
113
|
* @returns {ScratchOrgCreateResult}
|
|
114
114
|
*/
|
|
115
115
|
scratchOrgCreate(options: ScratchOrgRequest): Promise<ScratchOrgCreateResult>;
|
|
116
|
+
/**
|
|
117
|
+
* Reports sandbox org creation status. If the org is ready, authenticates to the org.
|
|
118
|
+
*
|
|
119
|
+
* @param {sandboxname} string the sandbox name
|
|
120
|
+
* @param options Wait: The amount of time to wait before timing out, Interval: The time interval between polling
|
|
121
|
+
* @returns {SandboxProcessObject} the sandbox process object
|
|
122
|
+
*/
|
|
123
|
+
sandboxStatus(sandboxname: string, options: {
|
|
124
|
+
wait?: Duration;
|
|
125
|
+
interval?: Duration;
|
|
126
|
+
}): Promise<SandboxProcessObject>;
|
|
116
127
|
/**
|
|
117
128
|
* Clean all data files in the org's data path. Usually <workspace>/.sfdx/orgs/<username>.
|
|
118
129
|
*
|
|
@@ -264,6 +275,29 @@ export declare class Org extends AsyncCreatable<Org.Options> {
|
|
|
264
275
|
* **Throws** *{@link SfdxError} Throws and unsupported error.
|
|
265
276
|
*/
|
|
266
277
|
protected getDefaultOptions(): Org.Options;
|
|
278
|
+
/**
|
|
279
|
+
* Query the sandbox for the SandboxProcessObject by sandbox name
|
|
280
|
+
*
|
|
281
|
+
* @param sandboxName The name of the sandbox to query
|
|
282
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
283
|
+
*/
|
|
284
|
+
private queryLatestSandboxProcessBySandboxName;
|
|
285
|
+
/**
|
|
286
|
+
* Gets the sandboxProcessObject and then polls for it to complete.
|
|
287
|
+
*
|
|
288
|
+
* @param sandboxProcessName sanbox process name
|
|
289
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
290
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
291
|
+
*/
|
|
292
|
+
private authWithRetriesByName;
|
|
293
|
+
/**
|
|
294
|
+
* Polls the sandbox org for the sandboxProcessObject.
|
|
295
|
+
*
|
|
296
|
+
* @param sandboxProcessObj: The in-progress sandbox signup request
|
|
297
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
298
|
+
* @returns {SandboxProcessObject}
|
|
299
|
+
*/
|
|
300
|
+
private authWithRetries;
|
|
267
301
|
private queryProduction;
|
|
268
302
|
/**
|
|
269
303
|
* this method will delete the sandbox org from the production org and clean up any local files
|
package/lib/org.js
CHANGED
|
@@ -110,6 +110,16 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
110
110
|
async scratchOrgCreate(options) {
|
|
111
111
|
return scratchOrgCreate_1.scratchOrgCreate({ ...options, hubOrg: this });
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Reports sandbox org creation status. If the org is ready, authenticates to the org.
|
|
115
|
+
*
|
|
116
|
+
* @param {sandboxname} string the sandbox name
|
|
117
|
+
* @param options Wait: The amount of time to wait before timing out, Interval: The time interval between polling
|
|
118
|
+
* @returns {SandboxProcessObject} the sandbox process object
|
|
119
|
+
*/
|
|
120
|
+
async sandboxStatus(sandboxname, options) {
|
|
121
|
+
return this.authWithRetriesByName(sandboxname, options);
|
|
122
|
+
}
|
|
113
123
|
/**
|
|
114
124
|
* Clean all data files in the org's data path. Usually <workspace>/.sfdx/orgs/<username>.
|
|
115
125
|
*
|
|
@@ -500,6 +510,58 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
500
510
|
getDefaultOptions() {
|
|
501
511
|
throw new sfdxError_1.SfdxError('Not Supported');
|
|
502
512
|
}
|
|
513
|
+
/**
|
|
514
|
+
* Query the sandbox for the SandboxProcessObject by sandbox name
|
|
515
|
+
*
|
|
516
|
+
* @param sandboxName The name of the sandbox to query
|
|
517
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
518
|
+
*/
|
|
519
|
+
async queryLatestSandboxProcessBySandboxName(sandboxNameIn) {
|
|
520
|
+
var _a;
|
|
521
|
+
const { tooling } = this.getConnection();
|
|
522
|
+
this.logger.debug('QueryLatestSandboxProcessBySandboxName called with SandboxName: %s ', sandboxNameIn);
|
|
523
|
+
const queryStr = `SELECT Id, Status, SandboxName, SandboxInfoId, LicenseType, CreatedDate, CopyProgress, SandboxOrganization, SourceId, Description, EndDate FROM SandboxProcess WHERE SandboxName='${sandboxNameIn}' AND Status != 'D' ORDER BY CreatedDate DESC LIMIT 1`;
|
|
524
|
+
const queryResult = await tooling.query(queryStr);
|
|
525
|
+
this.logger.debug('Return from calling queryToolingApi: %s ', queryResult);
|
|
526
|
+
if (((_a = queryResult === null || queryResult === void 0 ? void 0 : queryResult.records) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
527
|
+
return queryResult.records[0];
|
|
528
|
+
}
|
|
529
|
+
else if (queryResult.records && queryResult.records.length > 1) {
|
|
530
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'MultiSandboxProcessNotFoundBySandboxName', [sandboxNameIn]);
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'SandboxProcessNotFoundBySandboxName', [sandboxNameIn]);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Gets the sandboxProcessObject and then polls for it to complete.
|
|
538
|
+
*
|
|
539
|
+
* @param sandboxProcessName sanbox process name
|
|
540
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
541
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
542
|
+
*/
|
|
543
|
+
async authWithRetriesByName(sandboxProcessName, options) {
|
|
544
|
+
return this.authWithRetries(await this.queryLatestSandboxProcessBySandboxName(sandboxProcessName), options);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Polls the sandbox org for the sandboxProcessObject.
|
|
548
|
+
*
|
|
549
|
+
* @param sandboxProcessObj: The in-progress sandbox signup request
|
|
550
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
551
|
+
* @returns {SandboxProcessObject}
|
|
552
|
+
*/
|
|
553
|
+
async authWithRetries(sandboxProcessObj, options) {
|
|
554
|
+
var _a;
|
|
555
|
+
const retries = options.wait ? options.wait.seconds / kit_1.Duration.seconds(30).seconds : 0;
|
|
556
|
+
const pollInterval = (_a = options.interval) !== null && _a !== void 0 ? _a : kit_1.Duration.seconds(30);
|
|
557
|
+
this.logger.debug('AuthWithRetries sandboxProcessObj %s, retries %i', sandboxProcessObj, retries);
|
|
558
|
+
return this.pollStatusAndAuth({
|
|
559
|
+
sandboxProcessObj,
|
|
560
|
+
retries,
|
|
561
|
+
shouldPoll: retries > 0,
|
|
562
|
+
pollInterval,
|
|
563
|
+
});
|
|
564
|
+
}
|
|
503
565
|
async queryProduction(org, field, value) {
|
|
504
566
|
return org.connection.singleRecordQuery(`SELECT SandboxInfoId FROM SandboxProcess WHERE ${field} ='${value}' AND Status NOT IN ('D', 'E')`, { tooling: true });
|
|
505
567
|
}
|
|
@@ -46,10 +46,12 @@ export declare class SchemaValidator {
|
|
|
46
46
|
*/
|
|
47
47
|
validateSync(json: AnyJson): AnyJson;
|
|
48
48
|
/**
|
|
49
|
-
* Loads local, external schemas from URIs
|
|
50
|
-
*
|
|
49
|
+
* Loads local, external schemas from URIs in the same directory as the local schema file.
|
|
50
|
+
* Does not support loading from remote URIs.
|
|
51
|
+
* Returns a map of external schema local URIs to loaded schema JSON objects.
|
|
51
52
|
*
|
|
52
|
-
* @param schema The main schema to
|
|
53
|
+
* @param schema The main schema to look up references ($ref) in.
|
|
54
|
+
* @returns An array of found referenced schemas.
|
|
53
55
|
*/
|
|
54
56
|
private loadExternalSchemas;
|
|
55
57
|
/**
|
|
@@ -60,9 +62,9 @@ export declare class SchemaValidator {
|
|
|
60
62
|
private loadExternalSchema;
|
|
61
63
|
/**
|
|
62
64
|
* Get a string representation of the schema validation errors.
|
|
65
|
+
* Adds additional (human friendly) information to certain errors.
|
|
63
66
|
*
|
|
64
|
-
* @param errors An array of
|
|
65
|
-
* @param schema The validation schema.
|
|
67
|
+
* @param errors An array of AJV (DefinedError) objects.
|
|
66
68
|
*/
|
|
67
69
|
private getErrorsText;
|
|
68
70
|
}
|
package/lib/schema/validator.js
CHANGED
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.SchemaValidator = void 0;
|
|
10
|
+
const fs = require("fs");
|
|
10
11
|
const path = require("path");
|
|
12
|
+
const ajv_1 = require("ajv");
|
|
11
13
|
const kit_1 = require("@salesforce/kit");
|
|
12
|
-
const ts_types_1 = require("@salesforce/ts-types");
|
|
13
|
-
const validator = require("jsen");
|
|
14
14
|
const sfdxError_1 = require("../sfdxError");
|
|
15
|
-
const fs_1 = require("../util/fs");
|
|
16
15
|
/**
|
|
17
16
|
* Loads a JSON schema and performs validations against JSON objects.
|
|
18
17
|
*/
|
|
@@ -33,7 +32,7 @@ class SchemaValidator {
|
|
|
33
32
|
*/
|
|
34
33
|
async load() {
|
|
35
34
|
if (!this.schema) {
|
|
36
|
-
this.schema = await
|
|
35
|
+
this.schema = kit_1.parseJsonMap(await fs.promises.readFile(this.schemaPath, 'utf8'));
|
|
37
36
|
this.logger.debug(`Schema loaded for ${this.schemaPath}`);
|
|
38
37
|
}
|
|
39
38
|
return this.schema;
|
|
@@ -43,7 +42,7 @@ class SchemaValidator {
|
|
|
43
42
|
*/
|
|
44
43
|
loadSync() {
|
|
45
44
|
if (!this.schema) {
|
|
46
|
-
this.schema =
|
|
45
|
+
this.schema = kit_1.parseJsonMap(fs.readFileSync(this.schemaPath, 'utf8'));
|
|
47
46
|
this.logger.debug(`Schema loaded for ${this.schemaPath}`);
|
|
48
47
|
}
|
|
49
48
|
return this.schema;
|
|
@@ -75,47 +74,54 @@ class SchemaValidator {
|
|
|
75
74
|
validateSync(json) {
|
|
76
75
|
const schema = this.loadSync();
|
|
77
76
|
const externalSchemas = this.loadExternalSchemas(schema);
|
|
77
|
+
const ajv = new ajv_1.default({
|
|
78
|
+
allErrors: true,
|
|
79
|
+
schemas: externalSchemas,
|
|
80
|
+
useDefaults: true,
|
|
81
|
+
// TODO: We may someday want to enable strictSchema. This is disabled for now
|
|
82
|
+
// because the CLI team does not "own" the @salesforce/schemas repository.
|
|
83
|
+
// Invalid schema would cause errors wherever SchemaValidator is used.
|
|
84
|
+
strictSchema: false,
|
|
85
|
+
});
|
|
86
|
+
// JSEN to AJV migration note - regarding the following "TODO":
|
|
87
|
+
// I don't think that AJV has a way to throw an error if an additional property exists in the data
|
|
88
|
+
// It does however have a top level option for `removeAdditional` https://ajv.js.org/options.html#removeadditional
|
|
89
|
+
// Regardless, this would be a breaking changes and I do not think it should be implemented.
|
|
78
90
|
// TODO: We should default to throw an error when a property is specified
|
|
79
91
|
// that is not in the schema, but the only option to do this right now is
|
|
80
92
|
// to specify "removeAdditional: false" in every object.
|
|
81
|
-
const validate =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
const validate = ajv.compile(schema);
|
|
94
|
+
// AJV will modify the original json object. We need to make a clone of the
|
|
95
|
+
// json to keep this backwards compatible with JSEN functionality
|
|
96
|
+
const jsonClone = JSON.parse(JSON.stringify(json));
|
|
97
|
+
const valid = validate(jsonClone);
|
|
98
|
+
if (!valid) {
|
|
86
99
|
if (validate.errors) {
|
|
87
|
-
const errors = this.getErrorsText(validate.errors
|
|
100
|
+
const errors = this.getErrorsText(validate.errors);
|
|
88
101
|
throw new sfdxError_1.SfdxError(`Validation errors:\n${errors}`, 'ValidationSchemaFieldErrors');
|
|
89
102
|
}
|
|
90
103
|
else {
|
|
91
104
|
throw new sfdxError_1.SfdxError('Unknown schema validation error', 'ValidationSchemaUnknown');
|
|
92
105
|
}
|
|
93
106
|
}
|
|
94
|
-
return
|
|
107
|
+
// We return the cloned JSON because it will have defaults included
|
|
108
|
+
// This is configured with the 'useDefaults' option above.
|
|
109
|
+
return jsonClone;
|
|
95
110
|
}
|
|
96
111
|
/**
|
|
97
|
-
* Loads local, external schemas from URIs
|
|
98
|
-
*
|
|
112
|
+
* Loads local, external schemas from URIs in the same directory as the local schema file.
|
|
113
|
+
* Does not support loading from remote URIs.
|
|
114
|
+
* Returns a map of external schema local URIs to loaded schema JSON objects.
|
|
99
115
|
*
|
|
100
|
-
* @param schema The main schema to
|
|
116
|
+
* @param schema The main schema to look up references ($ref) in.
|
|
117
|
+
* @returns An array of found referenced schemas.
|
|
101
118
|
*/
|
|
102
119
|
loadExternalSchemas(schema) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// eslint-disable-next-line no-useless-escape
|
|
106
|
-
.map((ref) => ref && RegExp(/([\w\.]+)#/).exec(ref))
|
|
120
|
+
return kit_1.getJsonValuesByName(schema, '$ref')
|
|
121
|
+
.map((ref) => ref && RegExp(/([\w\.]+)#/).exec(ref)) // eslint-disable-line no-useless-escape
|
|
107
122
|
.map((match) => match && match[1])
|
|
108
123
|
.filter((uri) => !!uri)
|
|
109
124
|
.map((uri) => this.loadExternalSchema(uri));
|
|
110
|
-
schemas.forEach((externalSchema) => {
|
|
111
|
-
if (ts_types_1.isString(externalSchema.id)) {
|
|
112
|
-
externalSchemas[externalSchema.id] = externalSchema;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
throw new sfdxError_1.SfdxError(`Unexpected external schema id type: ${typeof externalSchema.id}`, 'ValidationSchemaTypeError');
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
return externalSchemas;
|
|
119
125
|
}
|
|
120
126
|
/**
|
|
121
127
|
* Load another schema relative to the primary schema when referenced. Only supports local schema URIs.
|
|
@@ -125,7 +131,7 @@ class SchemaValidator {
|
|
|
125
131
|
loadExternalSchema(uri) {
|
|
126
132
|
const schemaPath = path.join(this.schemasDir, `${uri}.json`);
|
|
127
133
|
try {
|
|
128
|
-
return
|
|
134
|
+
return kit_1.parseJsonMap(fs.readFileSync(schemaPath, 'utf8'));
|
|
129
135
|
}
|
|
130
136
|
catch (err) {
|
|
131
137
|
if (err.code === 'ENOENT') {
|
|
@@ -136,52 +142,21 @@ class SchemaValidator {
|
|
|
136
142
|
}
|
|
137
143
|
/**
|
|
138
144
|
* Get a string representation of the schema validation errors.
|
|
145
|
+
* Adds additional (human friendly) information to certain errors.
|
|
139
146
|
*
|
|
140
|
-
* @param errors An array of
|
|
141
|
-
* @param schema The validation schema.
|
|
147
|
+
* @param errors An array of AJV (DefinedError) objects.
|
|
142
148
|
*/
|
|
143
|
-
getErrorsText(errors
|
|
149
|
+
getErrorsText(errors) {
|
|
144
150
|
return errors
|
|
145
151
|
.map((error) => {
|
|
146
|
-
|
|
147
|
-
const property = RegExp(/^([a-zA-Z0-9\.]+)\.([a-zA-Z0-9]+)$/).exec(error.path);
|
|
148
|
-
const getPropValue = (prop) => {
|
|
149
|
-
const reducer = (obj, name) => {
|
|
150
|
-
if (!ts_types_1.isJsonMap(obj))
|
|
151
|
-
return;
|
|
152
|
-
if (ts_types_1.isJsonMap(obj.properties))
|
|
153
|
-
return obj.properties[name];
|
|
154
|
-
if (name === '0')
|
|
155
|
-
return ts_types_1.asJsonArray(obj.items);
|
|
156
|
-
return obj[name] || obj[prop];
|
|
157
|
-
};
|
|
158
|
-
return error.path.split('.').reduce(reducer, schema);
|
|
159
|
-
};
|
|
160
|
-
const getEnumValues = () => {
|
|
161
|
-
const enumSchema = ts_types_1.asJsonMap(getPropValue('enum'));
|
|
162
|
-
return (enumSchema && ts_types_1.getJsonArray(enumSchema, 'enum', []).join(', ')) || '';
|
|
163
|
-
};
|
|
152
|
+
const msg = `${error.schemaPath}: ${error.message}`;
|
|
164
153
|
switch (error.keyword) {
|
|
165
154
|
case 'additionalProperties':
|
|
166
|
-
|
|
167
|
-
// eslint-disable-next-line no-case-declarations
|
|
168
|
-
const additionalProperties = ts_types_1.get(error, 'additionalProperties');
|
|
169
|
-
return `${error.path} should NOT have additional properties '${additionalProperties}'`;
|
|
170
|
-
case 'required':
|
|
171
|
-
if (property) {
|
|
172
|
-
return `${property[1]} should have required property ${property[2]}`;
|
|
173
|
-
}
|
|
174
|
-
return `should have required property '${error.path}'`;
|
|
175
|
-
case 'oneOf':
|
|
176
|
-
return `${error.path} should match exactly one schema in oneOf`;
|
|
155
|
+
return `${msg} '${error.params.additionalProperty}'`;
|
|
177
156
|
case 'enum':
|
|
178
|
-
return `${
|
|
179
|
-
case 'type': {
|
|
180
|
-
const _path = error.path === '' ? 'Root of JSON object' : error.path;
|
|
181
|
-
return `${_path} is an invalid type. Expected type [${getPropValue('type')}]`;
|
|
182
|
-
}
|
|
157
|
+
return `${msg} '${error.params.allowedValues.join(', ')}'`;
|
|
183
158
|
default:
|
|
184
|
-
return
|
|
159
|
+
return msg;
|
|
185
160
|
}
|
|
186
161
|
})
|
|
187
162
|
.join('\n');
|
package/lib/sfdxProject.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare class SfdxProjectJson extends ConfigFile<ConfigFile.Options> {
|
|
|
81
81
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
82
82
|
* A warning is logged by default when the file is invalid.
|
|
83
83
|
*
|
|
84
|
-
* ***See*** [sfdx-project.schema.json] (https://
|
|
84
|
+
* ***See*** [sfdx-project.schema.json] (https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
85
85
|
*/
|
|
86
86
|
schemaValidate(): Promise<void>;
|
|
87
87
|
/**
|
|
@@ -95,7 +95,7 @@ export declare class SfdxProjectJson extends ConfigFile<ConfigFile.Options> {
|
|
|
95
95
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
96
96
|
* A warning is logged by default when the file is invalid.
|
|
97
97
|
*
|
|
98
|
-
* ***See*** [sfdx-project.schema.json] (https://
|
|
98
|
+
* ***See*** [sfdx-project.schema.json] (https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
99
99
|
*/
|
|
100
100
|
schemaValidateSync(): void;
|
|
101
101
|
/**
|
package/lib/sfdxProject.js
CHANGED
|
@@ -87,7 +87,7 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
|
|
|
87
87
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
88
88
|
* A warning is logged by default when the file is invalid.
|
|
89
89
|
*
|
|
90
|
-
* ***See*** [sfdx-project.schema.json] (https://
|
|
90
|
+
* ***See*** [sfdx-project.schema.json] (https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
91
91
|
*/
|
|
92
92
|
async schemaValidate() {
|
|
93
93
|
if (!this.hasRead) {
|
|
@@ -98,7 +98,6 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
|
|
|
98
98
|
try {
|
|
99
99
|
const projectJsonSchemaPath = require.resolve('@salesforce/schemas/sfdx-project.schema.json');
|
|
100
100
|
const validator = new validator_1.SchemaValidator(this.logger, projectJsonSchemaPath);
|
|
101
|
-
await validator.load();
|
|
102
101
|
await validator.validate(this.getContents());
|
|
103
102
|
}
|
|
104
103
|
catch (err) {
|
|
@@ -129,7 +128,7 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
|
|
|
129
128
|
* Set the `SFDX_PROJECT_JSON_VALIDATION` environment variable to `true` to throw an error when schema validation fails.
|
|
130
129
|
* A warning is logged by default when the file is invalid.
|
|
131
130
|
*
|
|
132
|
-
* ***See*** [sfdx-project.schema.json] (https://
|
|
131
|
+
* ***See*** [sfdx-project.schema.json] (https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)
|
|
133
132
|
*/
|
|
134
133
|
schemaValidateSync() {
|
|
135
134
|
if (!this.hasRead) {
|
|
@@ -140,7 +139,6 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
|
|
|
140
139
|
try {
|
|
141
140
|
const projectJsonSchemaPath = require.resolve('@salesforce/schemas/sfdx-project.schema.json');
|
|
142
141
|
const validator = new validator_1.SchemaValidator(this.logger, projectJsonSchemaPath);
|
|
143
|
-
validator.loadSync();
|
|
144
142
|
validator.validateSync(this.getContents());
|
|
145
143
|
}
|
|
146
144
|
catch (err) {
|
package/messages/org.json
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
"SandboxNotFound": "We can't find a SandboxProcess for the sandbox org %s.",
|
|
10
10
|
"SandboxInfoCreateFailed": "The sandbox org creation failed with a result of %s.",
|
|
11
11
|
"MissingAuthUsername": "The sandbox %s does not have an authorized username.",
|
|
12
|
-
"OrgPollingTimeout": "Sandbox status is %s; timed out waiting for completion."
|
|
12
|
+
"OrgPollingTimeout": "Sandbox status is %s; timed out waiting for completion.",
|
|
13
|
+
"SandboxProcessNotFoundBySandboxName": "We can't find a SandboxProcess with the SandboxName %s.",
|
|
14
|
+
"MultiSandboxProcessNotFoundBySandboxName": "We found more than one SandboxProcess with the SandboxName %s."
|
|
13
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "2.36.
|
|
3
|
+
"version": "2.36.4",
|
|
4
4
|
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@types/graceful-fs": "^4.1.5",
|
|
42
42
|
"@types/jsforce": "^1.9.41",
|
|
43
43
|
"@types/mkdirp": "^1.0.1",
|
|
44
|
+
"ajv": "^8.11.0",
|
|
44
45
|
"archiver": "^5.3.0",
|
|
45
46
|
"debug": "^3.1.0",
|
|
46
47
|
"faye": "^1.4.0",
|
|
47
48
|
"graceful-fs": "^4.2.4",
|
|
48
49
|
"js2xmlparser": "^4.0.1",
|
|
49
|
-
"jsen": "0.6.6",
|
|
50
50
|
"jsforce": "^1.11.0",
|
|
51
51
|
"jsonwebtoken": "8.5.0",
|
|
52
52
|
"mkdirp": "1.0.4",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"@salesforce/ts-sinon": "1.3.21",
|
|
61
61
|
"@types/archiver": "^5.1.1",
|
|
62
62
|
"@types/debug": "0.0.30",
|
|
63
|
-
"@types/jsen": "0.0.19",
|
|
64
63
|
"@types/jsonwebtoken": "8.3.2",
|
|
65
64
|
"@types/semver": "^7.3.9",
|
|
66
65
|
"@types/shelljs": "0.7.8",
|