Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mdonnalley/prevent-va…
Browse files Browse the repository at this point in the history
…lidation-on-encrypted-value
  • Loading branch information
mshanemc committed Jun 24, 2024
2 parents 9fc3987 + 80cb289 commit 2bb6f98
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 66 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [8.0.3](https://github.com/forcedotcom/sfdx-core/compare/8.0.2...8.0.3) (2024-06-21)


### Bug Fixes

* allow uppercase keys inside project.plugins ([5b112f8](https://github.com/forcedotcom/sfdx-core/commit/5b112f8c124a2c19dc1a090b97bb32a20cc11d83))



## [8.0.2](https://github.com/forcedotcom/sfdx-core/compare/8.0.1...8.0.2) (2024-06-20)


Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@salesforce/core",
"version": "8.0.2",
"version": "8.0.3",
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
"main": "lib/index",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -75,16 +75,14 @@
"@salesforce/dev-scripts": "^10.1.1",
"@salesforce/ts-sinon": "^1.4.22",
"@types/benchmark": "^2.1.5",
"@types/chai-string": "^1.4.5",
"@types/fast-levenshtein": "^0.0.4",
"@types/jsonwebtoken": "9.0.6",
"@types/proper-lockfile": "^4.1.4",
"@types/semver": "^7.5.8",
"benchmark": "^2.1.4",
"chai-string": "^1.5.0",
"ts-node": "^10.9.2",
"ts-patch": "^3.2.0",
"typescript": "^5.4.5"
"typescript": "5.4.5"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/sfProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export type ProjectJson = ConfigContents & ProjectJsonSchema;
*/
export class SfProjectJson extends ConfigFile<ConfigFile.Options, ProjectJson> {
/** json properties that are uppercase, or allow uppercase keys inside them */
public static BLOCKLIST = ['packageAliases'];
public static BLOCKLIST = ['packageAliases', 'plugins'];

public static getFileName(): string {
return SFDX_PROJECT_JSON;
Expand Down
43 changes: 31 additions & 12 deletions test/unit/projectTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,38 @@ describe('SfProject', () => {
});

describe('json', () => {
it('allows uppercase packaging aliases on write', async () => {
const json = await SfProjectJson.create();
json.set('packageAliases', { MyName: 'somePackage' });
await json.write();
// @ts-expect-error possibly undefined
expect($$.getConfigStubContents('SfProjectJson').packageAliases['MyName']).to.equal('somePackage');
});
it('allows uppercase packaging aliases on read', async () => {
$$.setConfigStubContents('SfProjectJson', { contents: { packageAliases: { MyName: 'somePackage' } } });
const json = await SfProjectJson.create();
// @ts-expect-error possibly undefined
expect(json.get('packageAliases')['MyName']).to.equal('somePackage');
describe('allowed uppercase', () => {
describe('packageAliases', () => {
it('allows uppercase packaging aliases on write', async () => {
const json = await SfProjectJson.create();
json.set('packageAliases', { MyName: 'somePackage' });
await json.write();
// @ts-expect-error possibly undefined
expect($$.getConfigStubContents('SfProjectJson').packageAliases['MyName']).to.equal('somePackage');
});
it('allows uppercase packaging aliases on read', async () => {
$$.setConfigStubContents('SfProjectJson', { contents: { packageAliases: { MyName: 'somePackage' } } });
const json = await SfProjectJson.create();
// @ts-expect-error possibly undefined
expect(json.get('packageAliases')['MyName']).to.equal('somePackage');
});
});
describe('plugins', () => {
const pluginsContent = { SomePlugin: 'value', SomeOtherPlugin: { NestedCap: true } };
it('allows uppercase keys in plugins on write', async () => {
const json = await SfProjectJson.create();
json.set('plugins', pluginsContent);
await json.write();
expect($$.getConfigStubContents('SfProjectJson').plugins).to.deep.equal(pluginsContent);
});
it('allows uppercase keys in plugins on read', async () => {
$$.setConfigStubContents('SfProjectJson', { contents: { plugins: pluginsContent } });
const json = await SfProjectJson.create();
expect(json.get('plugins')).to.deep.equal(pluginsContent);
});
});
});

it('getPackageDirectories should transform packageDir paths to have path separators that match the OS', async () => {
let defaultPP: string;
let transformedDefaultPP: string;
Expand Down
9 changes: 2 additions & 7 deletions test/unit/util/directoryWriterTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ import * as os from 'node:os';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { Readable } from 'node:stream';
import * as chai from 'chai';
import chaiString from 'chai-string';
import { expect } from 'chai';
import { DirectoryWriter } from '../../../src/util/directoryWriter';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { expect } = chai;
chai.use(chaiString);

function validateFileContents(filePath: string, expectedContents: string): void {
const fileContents = fs.readFileSync(filePath, 'utf8');
expect(fileContents).to.equal(expectedContents);
Expand All @@ -32,7 +27,7 @@ describe('DirectoryWriter', () => {
});
it('addToStore - string', async () => {
const contents = 'my-contents';
expect(directoryPath).to.startWith(os.tmpdir());
expect(directoryPath.startsWith(os.tmpdir())).to.be.true;
await directoryWriter.addToStore(contents, filename);
await directoryWriter.finalize();
expect(fs.existsSync(path.join(directoryPath, filename))).to.be.true;
Expand Down
52 changes: 10 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -681,14 +681,7 @@
resolved "https://registry.yarnpkg.com/@types/benchmark/-/benchmark-2.1.5.tgz#940c1850c18fdfdaee3fd6ed29cd92ae0d445b45"
integrity sha512-cKio2eFB3v7qmKcvIHLUMw/dIx/8bhWPuzpzRT4unCPRTD8VdA9Zb0afxpcxOqR4PixRS7yT42FqGS8BYL8g1w==

"@types/chai-string@^1.4.5":
version "1.4.5"
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.4.5.tgz#988ff37526386e9c354219b163d7ecf81bab8d2d"
integrity sha512-IecXRMSnpUvRnTztdpSdjcmcW7EdNme65bfDCQMi7XrSEPGmyDYYTEfc5fcactWDA6ioSm8o7NUqg9QxjBCCEw==
dependencies:
"@types/chai" "*"

"@types/chai@*", "@types/chai@^4.3.14":
"@types/chai@^4.3.14":
version "4.3.16"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.16.tgz#b1572967f0b8b60bf3f87fe1d854a5604ea70c82"
integrity sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ==
Expand Down Expand Up @@ -1290,11 +1283,6 @@ capital-case@^1.0.4:
tslib "^2.0.3"
upper-case-first "^2.0.2"

chai-string@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.5.0.tgz#0bdb2d8a5f1dbe90bc78ec493c1c1c180dd4d3d2"
integrity sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==

chai@^4.3.10:
version "4.4.1"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.4.1.tgz#3603fa6eba35425b0f2ac91a009fe924106e50d1"
Expand Down Expand Up @@ -4691,16 +4679,7 @@ srcset@^5.0.0:
resolved "https://registry.yarnpkg.com/srcset/-/srcset-5.0.1.tgz#e660a728f195419e4afa95121099bc9efb7a1e36"
integrity sha512-/P1UYbGfJVlxZag7aABNRrulEXAwCSDo7fklafOQrantuPTDmYgijJMks2zusPCVzgW9+4P69mq7w6pYuZpgxw==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -4760,14 +4739,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -5065,11 +5037,16 @@ typedoc@^0.25.13:
minimatch "^9.0.3"
shiki "^0.14.7"

"typescript@^4.6.4 || ^5.2.2", typescript@^5.4.3, typescript@^5.4.5:
[email protected]:
version "5.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==

"typescript@^4.6.4 || ^5.2.2", typescript@^5.4.3:
version "5.5.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507"
integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==

unbox-primitive@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e"
Expand Down Expand Up @@ -5264,7 +5241,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -5282,15 +5259,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

3 comments on commit 2bb6f98

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - ubuntu-latest

Benchmark suite Current: 2bb6f98 Previous: e88f741 Ratio
Child logger creation 474649 ops/sec (±1.59%) 467749 ops/sec (±2.35%) 0.99
Logging a string on root logger 767091 ops/sec (±7.42%) 713829 ops/sec (±8.69%) 0.93
Logging an object on root logger 632734 ops/sec (±5.75%) 634704 ops/sec (±8.41%) 1.00
Logging an object with a message on root logger 5367 ops/sec (±211.45%) 8887 ops/sec (±202.35%) 1.66
Logging an object with a redacted prop on root logger 511730 ops/sec (±12.37%) 468133 ops/sec (±13.64%) 0.91
Logging a nested 3-level object on root logger 369777 ops/sec (±8.09%) 402002 ops/sec (±6.40%) 1.09

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - windows-latest

Benchmark suite Current: 2bb6f98 Previous: e88f741 Ratio
Child logger creation 328142 ops/sec (±0.89%) 329149 ops/sec (±0.79%) 1.00
Logging a string on root logger 823574 ops/sec (±6.57%) 737202 ops/sec (±5.95%) 0.90
Logging an object on root logger 602671 ops/sec (±7.42%) 593848 ops/sec (±4.45%) 0.99
Logging an object with a message on root logger 2945 ops/sec (±223.89%) 6190 ops/sec (±204.15%) 2.10
Logging an object with a redacted prop on root logger 448898 ops/sec (±9.89%) 476806 ops/sec (±6.94%) 1.06
Logging a nested 3-level object on root logger 321049 ops/sec (±5.88%) 336007 ops/sec (±4.68%) 1.05

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Logger Benchmarks - windows-latest'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 2bb6f98 Previous: e88f741 Ratio
Logging an object with a message on root logger 2945 ops/sec (±223.89%) 6190 ops/sec (±204.15%) 2.10

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.