@salesforce/core 3.31.17 → 3.31.19

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.
@@ -148,7 +148,14 @@ class Connection extends jsforce_1.Connection {
148
148
  */
149
149
  request(request, options) {
150
150
  const httpRequest = (0, ts_types_1.isString)(request) ? { method: 'GET', url: request } : request;
151
- httpRequest.headers = Object.assign({}, exports.SFDX_HTTP_HEADERS, httpRequest.headers);
151
+ // prevent duplicate headers by lowercasing the keys on the incoming request
152
+ const lowercasedHeaders = httpRequest.headers
153
+ ? Object.fromEntries(Object.entries(httpRequest.headers).map(([key, value]) => [key.toLowerCase(), value]))
154
+ : {};
155
+ httpRequest.headers = {
156
+ ...exports.SFDX_HTTP_HEADERS,
157
+ ...lowercasedHeaders,
158
+ };
152
159
  this.logger.debug(`request: ${JSON.stringify(httpRequest)}`);
153
160
  return super.request(httpRequest, options);
154
161
  }
@@ -76,6 +76,7 @@ class SchemaValidator {
76
76
  const externalSchemas = this.loadExternalSchemas(schema);
77
77
  const ajv = new ajv_1.default({
78
78
  allErrors: true,
79
+ allowUnionTypes: true,
79
80
  schemas: externalSchemas,
80
81
  useDefaults: true,
81
82
  // TODO: We may someday want to enable strictSchema. This is disabled for now
package/lib/sfProject.js CHANGED
@@ -59,13 +59,11 @@ class SfProjectJson extends configFile_1.ConfigFile {
59
59
  async read() {
60
60
  const contents = await super.read();
61
61
  this.validateKeys();
62
- await this.schemaValidate();
63
62
  return contents;
64
63
  }
65
64
  readSync() {
66
65
  const contents = super.readSync();
67
66
  this.validateKeys();
68
- this.schemaValidateSync();
69
67
  return contents;
70
68
  }
71
69
  async write(newContents) {
@@ -73,7 +71,6 @@ class SfProjectJson extends configFile_1.ConfigFile {
73
71
  this.setContents(newContents);
74
72
  }
75
73
  this.validateKeys();
76
- await this.schemaValidate();
77
74
  return super.write();
78
75
  }
79
76
  writeSync(newContents) {
@@ -81,7 +78,6 @@ class SfProjectJson extends configFile_1.ConfigFile {
81
78
  this.setContents(newContents);
82
79
  }
83
80
  this.validateKeys();
84
- this.schemaValidateSync();
85
81
  return super.writeSync();
86
82
  }
87
83
  getContents() {
@@ -108,21 +104,19 @@ class SfProjectJson extends configFile_1.ConfigFile {
108
104
  // read calls back into this method after necessarily setting this.hasRead=true
109
105
  await this.read();
110
106
  }
111
- else {
112
- try {
113
- const projectJsonSchemaPath = require.resolve('@salesforce/schemas/sfdx-project.schema.json');
114
- const validator = new validator_1.SchemaValidator(this.logger, projectJsonSchemaPath);
115
- await validator.validate(this.getContents());
107
+ try {
108
+ const projectJsonSchemaPath = require.resolve('@salesforce/schemas/sfdx-project.schema.json');
109
+ const validator = new validator_1.SchemaValidator(this.logger, projectJsonSchemaPath);
110
+ await validator.validate(this.getContents());
111
+ }
112
+ catch (err) {
113
+ const error = err;
114
+ // Don't throw errors if the global isn't valid, but still warn the user.
115
+ if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
116
+ throw messages.createError('schemaValidationError', [this.getPath(), error.message], [this.getPath()], error);
116
117
  }
117
- catch (err) {
118
- const error = err;
119
- // Don't throw errors if the global isn't valid, but still warn the user.
120
- if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
121
- throw messages.createError('schemaValidationError', [this.getPath(), error.message], [this.getPath()], error);
122
- }
123
- else {
124
- this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), error.message]));
125
- }
118
+ else {
119
+ this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), error.message]));
126
120
  }
127
121
  }
128
122
  }
@@ -147,21 +141,19 @@ class SfProjectJson extends configFile_1.ConfigFile {
147
141
  // read calls back into this method after necessarily setting this.hasRead=true
148
142
  this.readSync();
149
143
  }
150
- else {
151
- try {
152
- const projectJsonSchemaPath = require.resolve('@salesforce/schemas/sfdx-project.schema.json');
153
- const validator = new validator_1.SchemaValidator(this.logger, projectJsonSchemaPath);
154
- validator.validateSync(this.getContents());
144
+ try {
145
+ const projectJsonSchemaPath = require.resolve('@salesforce/schemas/sfdx-project.schema.json');
146
+ const validator = new validator_1.SchemaValidator(this.logger, projectJsonSchemaPath);
147
+ validator.validateSync(this.getContents());
148
+ }
149
+ catch (err) {
150
+ const error = err;
151
+ // Don't throw errors if the global isn't valid, but still warn the user.
152
+ if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
153
+ throw messages.createError('schemaValidationError', [this.getPath(), error.message], [this.getPath()], error);
155
154
  }
156
- catch (err) {
157
- const error = err;
158
- // Don't throw errors if the global isn't valid, but still warn the user.
159
- if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
160
- throw messages.createError('schemaValidationError', [this.getPath(), error.message], [this.getPath()], error);
161
- }
162
- else {
163
- this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), error.message]));
164
- }
155
+ else {
156
+ this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), error.message]));
165
157
  }
166
158
  }
167
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.31.17",
3
+ "version": "3.31.19",
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",
@@ -61,15 +61,15 @@
61
61
  "@types/chai-string": "^1.4.2",
62
62
  "@types/debug": "0.0.31",
63
63
  "@types/jsen": "0.0.21",
64
- "@types/jsonwebtoken": "8.5.7",
65
- "@types/lodash": "^4.14.182",
64
+ "@types/jsonwebtoken": "8.5.9",
65
+ "@types/lodash": "^4.14.186",
66
66
  "@types/shelljs": "0.8.11",
67
- "@typescript-eslint/eslint-plugin": "^5.33.0",
68
- "@typescript-eslint/parser": "^5.33.0",
67
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
68
+ "@typescript-eslint/parser": "^5.41.0",
69
69
  "chai": "^4.3.4",
70
70
  "chai-string": "^1.5.0",
71
71
  "commitizen": "^3.1.2",
72
- "eslint": "^8.21.0",
72
+ "eslint": "^8.26.0",
73
73
  "eslint-config-prettier": "^8.5.0",
74
74
  "eslint-config-salesforce": "^1.1.0",
75
75
  "eslint-config-salesforce-license": "^0.1.6",