Skip to content

Commit

Permalink
Merge pull request #770 from salesforcecli/sm/nut-api-version
Browse files Browse the repository at this point in the history
Sm/nut api version
  • Loading branch information
shetzel authored Oct 3, 2023
2 parents ec53333 + 048a1dc commit 7d03499
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 29 deletions.
4 changes: 2 additions & 2 deletions messages/retrieve.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ If you specify this parameter, don’t specify --metadata or --source-dir.

# flags.metadata.summary

Metadata component names to retrieve. Wildcards ( * ) supported as long as you use quotes, such as 'ApexClass:MyClass*'
Metadata component names to retrieve. Wildcards ( `*` ) supported as long as you use quotes, such as `ApexClass:MyClass*`

# flags.package-name.summary

Expand Down Expand Up @@ -187,7 +187,7 @@ The retrieve target directory [%s] overlaps one of your package directories. Spe

# apiVersionMsgDetailed

%s v%s metadata from %s using the v%s SOAP API
%s %s metadata from %s using the v%s SOAP API

# wantsToRetrieveCustomFields

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@salesforce/kit": "^3.0.9",
"@salesforce/sf-plugins-core": "^3.1.22",
"@salesforce/source-deploy-retrieve": "^9.7.15",
"@salesforce/source-tracking": "^4.2.12",
"@salesforce/source-tracking": "^4.2.16",
"chalk": "^4.1.2",
"shelljs": "^0.8.5",
"tslib": "^2"
Expand Down
58 changes: 56 additions & 2 deletions test/nuts/tracking/remoteChanges.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ describe('remote changes', () => {
});

describe('remote changes: add', () => {
const className = 'CreatedClass';
const className = 'Class1';
it('adds on the server', async () => {
const createResult = await conn.tooling.create('ApexClass', {
Name: className,
Body: 'public class CreatedClass {}',
Body: `public class ${className} {}`,
Status: 'Active',
});
if (!Array.isArray(createResult) && createResult.success) {
Expand Down Expand Up @@ -256,6 +256,60 @@ describe('remote changes', () => {
});
});

describe('remote changes: apiVersion', () => {
let originalProject: { sourceApiVersion: string };
let originalProjectSourceApiVersion: string;
before(async () => {
originalProject = JSON.parse(
await fs.promises.readFile(path.join(session.project.dir, 'sfdx-project.json'), 'utf8')
) as {
sourceApiVersion: string;
};
originalProjectSourceApiVersion = originalProject.sourceApiVersion;
});

it('adds on the server', async () => {
const className = 'Class2';
const createResult = await conn.tooling.create('ApexClass', {
Name: className,
Body: `public class ${className} {}`,
Status: 'Active',
});
if (!Array.isArray(createResult) && createResult.success) {
expect(createResult.id).to.be.a('string');
}
});
it('can pull the update using current project apiVersion', () => {
const result = execCmd<RetrieveResultJson>('project:retrieve:start', { ensureExitCode: 0 }).shellOutput;
expect(result).to.include(`v${originalProjectSourceApiVersion} metadata`);
});

it('adds on the server', async () => {
const className = 'Class3';
const createResult = await conn.tooling.create('ApexClass', {
Name: className,
Body: `public class ${className} {}`,
Status: 'Active',
});
if (!Array.isArray(createResult) && createResult.success) {
expect(createResult.id).to.be.a('string');
}
});

it('can pull the update using a lower apiVersion', async () => {
const newApiVersion = originalProjectSourceApiVersion
.split('.')
.map((v, i) => (i === 0 ? (parseInt(v, 10) - 1).toString() : v))
.join('.');
await fs.promises.writeFile(
path.join(session.project.dir, 'sfdx-project.json'),
JSON.stringify({ ...originalProject, sourceApiVersion: newApiVersion })
);
const result = execCmd<RetrieveResultJson>('project:retrieve:start', { ensureExitCode: 0 }).shellOutput;
expect(result).to.include(`v${newApiVersion} metadata`);
});
});

describe('remote changes: mixed', () => {
it('all three types of changes on the server');
it('can see the changes in status');
Expand Down
48 changes: 24 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,14 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.7.1"

"@salesforce/core@^5.2.0", "@salesforce/core@^5.2.10", "@salesforce/core@^5.2.6", "@salesforce/core@^5.2.7", "@salesforce/core@^5.2.9":
version "5.3.1"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-5.3.1.tgz#93c49760faa7b503bbfea8376d80a66815065e4a"
integrity sha512-LEQ3Yp7GxexsGXxT85Pp4AgOzzqY9Y3kol8ByVsHpHGvs8XLRbKl44IPxTXBdMB2roFM+Iosd46i0KbTuh2MQg==
"@salesforce/core@^5.2.0", "@salesforce/core@^5.2.10", "@salesforce/core@^5.2.6", "@salesforce/core@^5.2.7", "@salesforce/core@^5.2.9", "@salesforce/core@^5.3.1", "@salesforce/core@^5.3.3":
version "5.3.3"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-5.3.3.tgz#394c50cd9007591b5858c33f08fc6f7a18c9abfb"
integrity sha512-MRp4RpF4cf6eXPuXaRfrjqZYoesh/EvuTrxGd7d3D/XVMlxO5HiuNqpUvAXa5fN3Co8gxVvw7Uj2AYERHxnXYQ==
dependencies:
"@salesforce/kit" "^3.0.11"
"@salesforce/kit" "^3.0.12"
"@salesforce/schemas" "^1.6.0"
"@salesforce/ts-types" "^2.0.7"
"@salesforce/ts-types" "^2.0.8"
"@types/semver" "^7.5.2"
ajv "^8.12.0"
change-case "^4.1.2"
Expand Down Expand Up @@ -1024,12 +1024,12 @@
typescript "^4.9.5"
wireit "^0.9.5"

"@salesforce/kit@^3.0.11", "@salesforce/kit@^3.0.9":
version "3.0.11"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-3.0.11.tgz#d03160b658da9817c05e62479ca18283087a0fc0"
integrity sha512-ar44uFJfc/RCDWjz7LlrOtFCFHgNNUpddxe0eJCLqQuR/Xs3IlLZKuovWTx322Rzu+V9IIKrIdpz2IqA95/ClA==
"@salesforce/kit@^3.0.11", "@salesforce/kit@^3.0.12", "@salesforce/kit@^3.0.13", "@salesforce/kit@^3.0.9":
version "3.0.13"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-3.0.13.tgz#10b47ad6e0e27c3a9f97eb6a5cdcfffa9ba1f163"
integrity sha512-HLQ5L5bBi0tsMeH5ZHJAhHUpvNUNPQoNJt2O82Jf6C60GGsrlzwzQ5ONAHGNBgKSZ7HLr0UGL5xaA+hE9uOcgw==
dependencies:
"@salesforce/ts-types" "^2.0.7"
"@salesforce/ts-types" "^2.0.8"
tslib "^2.6.2"

"@salesforce/plugin-command-reference@^3.0.33":
Expand Down Expand Up @@ -1121,12 +1121,12 @@
chalk "^4"
inquirer "^8.2.5"

"@salesforce/source-deploy-retrieve@^9.7.15", "@salesforce/source-deploy-retrieve@^9.7.2", "@salesforce/source-deploy-retrieve@^9.7.8":
version "9.7.15"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-9.7.15.tgz#a891e95101816a7e33854bc42ba21fafbdb1728e"
integrity sha512-av9Ojd9B/uegLNJth41aVPvAVPh8N0CllzfiDG5qbtDXW7WV/bqgWjiiiGc1U6RWnJ9OmQZNL/EjaSX0UPhiLA==
"@salesforce/source-deploy-retrieve@^9.7.15", "@salesforce/source-deploy-retrieve@^9.7.2", "@salesforce/source-deploy-retrieve@^9.7.20":
version "9.7.21"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-9.7.21.tgz#9d1b65ce0d50080a6886d04779049127ee7f37b9"
integrity sha512-MJvaDLzPUVpizdNGQ4ufwkmX8ogcQ0E1WkoTaPE0yionJgmIR78035TtJgnkuj+SDhHWhX1ABKbrkxzLn7obMg==
dependencies:
"@salesforce/core" "^5.2.9"
"@salesforce/core" "^5.3.1"
"@salesforce/kit" "^3.0.11"
"@salesforce/ts-types" "^2.0.7"
fast-levenshtein "^3.0.0"
Expand Down Expand Up @@ -1156,15 +1156,15 @@
shelljs "^0.8.4"
sinon "^10.0.0"

"@salesforce/source-tracking@^4.2.10", "@salesforce/source-tracking@^4.2.12":
version "4.2.12"
resolved "https://registry.yarnpkg.com/@salesforce/source-tracking/-/source-tracking-4.2.12.tgz#91250ac48f70985c8529d601fd9237d7b5193269"
integrity sha512-hxN4rMmyOmZoUJTy5fyg33ovhKc0ffCqX6j0EqAX90gHO4OQqNMWvweogbzX7h8nkFyNv+ZLyDeJBAdMnTgnWw==
"@salesforce/source-tracking@^4.2.10", "@salesforce/source-tracking@^4.2.16":
version "4.2.16"
resolved "https://registry.yarnpkg.com/@salesforce/source-tracking/-/source-tracking-4.2.16.tgz#e64a7eeeb122045b61588b44c8c2e533ba5aa92a"
integrity sha512-HAuLaY+RrdKvWjx9FVYMrYlIUW4JyQtF/TA5hbDpy4Rw8IUOgrYyt+IaoiAAtMyRqU8En8fJBUqiq4qFvhdpCA==
dependencies:
"@salesforce/core" "^5.2.0"
"@salesforce/kit" "^3.0.9"
"@salesforce/source-deploy-retrieve" "^9.7.8"
"@salesforce/ts-types" "^2.0.6"
"@salesforce/core" "^5.3.3"
"@salesforce/kit" "^3.0.13"
"@salesforce/source-deploy-retrieve" "^9.7.20"
"@salesforce/ts-types" "^2.0.8"
fast-xml-parser "^4.2.5"
graceful-fs "^4.2.11"
isomorphic-git "1.23.0"
Expand Down

0 comments on commit 7d03499

Please sign in to comment.