Skip to content

Commit

Permalink
fix: refactor to use new Package1Version class and its methods
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Sep 27, 2022
1 parent 8694880 commit 037fd11
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 34 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^1.14.2",
"@salesforce/command": "^5.2.6",
"@salesforce/core": "^3.3.0",
"@salesforce/kit": "^1.6.0",
"@salesforce/command": "^5.2.10",
"@salesforce/core": "^3.30.8",
"@salesforce/kit": "^1.6.1",
"@salesforce/packaging": "^0.0.36",
"tslib": "^2",
"chalk": "^4.1.2"
Expand Down
7 changes: 3 additions & 4 deletions src/commands/force/package1/beta/version/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Lifecycle, Messages } from '@salesforce/core';
import { Duration } from '@salesforce/kit';
import { package1VersionCreate, PackageVersionEvents, PackagingSObjects } from '@salesforce/packaging';
import { Package1Version, PackageVersionEvents, PackagingSObjects } from '@salesforce/packaging';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package1_version_create');
Expand Down Expand Up @@ -86,9 +86,8 @@ export class Package1VersionCreateCommand extends SfdxCommand {
}
);
}

const result: PackageUploadRequest = await package1VersionCreate(
this.org.getConnection(),
const pkg1 = new Package1Version(this.org.getConnection());
const result = await pkg1.create(
{
MetadataPackageId: this.flags.packageid as string,
VersionName: this.flags.name as string,
Expand Down
5 changes: 3 additions & 2 deletions src/commands/force/package1/beta/version/create/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as os from 'os';
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import { package1VersionCreateGet, PackagingSObjects } from '@salesforce/packaging';
import { Package1Version, PackagingSObjects } from '@salesforce/packaging';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package1_version_create_get');
Expand All @@ -27,7 +27,8 @@ export class Package1VersionCreateGetCommand extends SfdxCommand {
};

public async run(): Promise<PackagingSObjects.PackageUploadRequest> {
const result = await package1VersionCreateGet(this.org.getConnection(), this.flags.requestid);
const pkg1 = new Package1Version(this.org.getConnection());
const result = await pkg1.createReport(this.flags.requestid);

if (result.Status === 'ERROR') {
// toolbelt was accessing request.Errors.errors, I'm unsure about this type, but was unable to reproduce an error
Expand Down
6 changes: 3 additions & 3 deletions src/commands/force/package1/beta/version/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import { Package1Display, package1Display } from '@salesforce/packaging';
import { Package1Display, Package1Version } from '@salesforce/packaging';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package1_version_display');
Expand All @@ -31,8 +31,8 @@ export class Package1VersionDisplayCommand extends SfdxCommand {
};

public async run(): Promise<Package1Display[]> {
const conn = this.org.getConnection();
const results = await package1Display(conn, this.flags.packageversionid);
const pkg1 = new Package1Version(this.org.getConnection());
const results = await pkg1.display(this.flags.packageversionid);

if (results.length === 0) {
this.ux.log('No results found');
Expand Down
5 changes: 3 additions & 2 deletions src/commands/force/package1/beta/version/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import { Package1Display, package1VersionList } from '@salesforce/packaging';
import { Package1Display, Package1Version } from '@salesforce/packaging';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package1_version_list');
Expand All @@ -31,7 +31,8 @@ export class Package1VersionListCommand extends SfdxCommand {
};

public async run(): Promise<Package1Display[]> {
const result = await package1VersionList(this.org.getConnection(), this.flags.packageid);
const pkg1 = new Package1Version(this.org.getConnection());
const result = await pkg1.list(this.flags.packageid);

if (result.length) {
this.ux.table(result, {
Expand Down
40 changes: 20 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1038,23 +1038,23 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.7.0"

"@salesforce/command@^5.1.0", "@salesforce/command@^5.1.3", "@salesforce/command@^5.2.6":
version "5.2.6"
resolved "https://registry.yarnpkg.com/@salesforce/command/-/command-5.2.6.tgz#649e3c1ab2c4f5a71b1c908f95a644c1b398d7da"
integrity sha512-Rsvk8k4ZKwZiMD6STSTHMNPigqkr+hycuRwjm1pk57vDDSllVVa3R8yv0em1OoJsiyIH7l/zhRQ6IcZ7ObM7Jg==
"@salesforce/command@^5.1.0", "@salesforce/command@^5.1.3", "@salesforce/command@^5.2.10":
version "5.2.10"
resolved "https://registry.yarnpkg.com/@salesforce/command/-/command-5.2.10.tgz#e879444218fc2381cd386a6408019f1de990c6ae"
integrity sha512-Vtyih+a4vWPISJFQgXASqHSMFpYbeXSg1kA7VAq2FCgLnhepJVyA6Vx3leWq/h/fQDW4+QpfI4mg2siQO03ugw==
dependencies:
"@oclif/core" "^1.14.1"
"@oclif/plugin-help" "^5.1.11"
"@oclif/test" "^2.1.0"
"@salesforce/core" "^3.26.2"
"@salesforce/kit" "^1.6.0"
"@salesforce/ts-types" "^1.5.20"
"@salesforce/core" "^3.30.8"
"@salesforce/kit" "^1.6.1"
"@salesforce/ts-types" "^1.5.21"
chalk "^2.4.2"

"@salesforce/core@^3.15.5", "@salesforce/core@^3.19.5", "@salesforce/core@^3.20.1", "@salesforce/core@^3.24.1", "@salesforce/core@^3.26.1", "@salesforce/core@^3.26.2", "@salesforce/core@^3.3.0", "@salesforce/core@^3.30.0":
version "3.30.0"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.30.0.tgz#51c986aba5bb4b599fbff1d8c3f9e37508f9206f"
integrity sha512-qU48fYMBcqZOVAUXaRYUleuelqfR8CERc1LUTJwmufRocieCHSx9PVXVRDgWl9KW09xcDyv8hu8RL5IaAVfWKA==
"@salesforce/core@^3.15.5", "@salesforce/core@^3.19.5", "@salesforce/core@^3.20.1", "@salesforce/core@^3.24.1", "@salesforce/core@^3.26.1", "@salesforce/core@^3.30.0", "@salesforce/core@^3.30.8":
version "3.30.8"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.30.8.tgz#e40ee555b4eae5c74ae337d74c5db5a8f0d5fc59"
integrity sha512-5ixL5R9F600RfHtskuFLossGWAa2BDzysQk6Ns5OsHLY87U/1bH8edf+fubamf3aDaZaMIrcBoucQ2OJVmPtYw==
dependencies:
"@salesforce/bunyan" "^2.0.0"
"@salesforce/kit" "^1.5.41"
Expand Down Expand Up @@ -1119,12 +1119,12 @@
typedoc-plugin-external-module-name "~4.0.0"
typescript "^4.1.3"

"@salesforce/kit@^1.5.17", "@salesforce/kit@^1.5.41", "@salesforce/kit@^1.5.42", "@salesforce/kit@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.6.0.tgz#0305dea2c9847d4b08068c4a9d436da5c9a5ce5e"
integrity sha512-8VZvWYl61jBaUIqo+pNoDvVqaZKPmqauvkhJHvcr/+D7+EXsjne9PDMggy5mNQJvonD6iegR/h3BqcWrppSaeQ==
"@salesforce/kit@^1.5.17", "@salesforce/kit@^1.5.41", "@salesforce/kit@^1.5.42", "@salesforce/kit@^1.6.0", "@salesforce/kit@^1.6.1":
version "1.6.1"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.6.1.tgz#73a16205f957e527b2cc9bfcebc55b6880f3169b"
integrity sha512-ZuQrzUo1jili5xl9LbJOsIra07C4FIRy5f9PLGi8lXEKGIJ2qg21VCLlREGV5tz5Qm1aYsCYW9rjQQzME1ou8Q==
dependencies:
"@salesforce/ts-types" "^1.5.20"
"@salesforce/ts-types" "^1.5.21"
shx "^0.3.3"
tslib "^2.2.0"

Expand Down Expand Up @@ -1227,10 +1227,10 @@
sinon "^5.1.1"
tslib "^2.2.0"

"@salesforce/ts-types@^1.5.17", "@salesforce/ts-types@^1.5.20":
version "1.5.20"
resolved "https://registry.yarnpkg.com/@salesforce/ts-types/-/ts-types-1.5.20.tgz#f6875a710ceca48223b240026a14af6d3b39882f"
integrity sha512-Ov6um4CWd63EvkRavkHG0J/P9XYL55sdkDWPMr7+AIgqh5flHxDRz09/C4e9M94aX30rzJxW4TVX6EBf4Cu2BQ==
"@salesforce/ts-types@^1.5.17", "@salesforce/ts-types@^1.5.20", "@salesforce/ts-types@^1.5.21":
version "1.5.21"
resolved "https://registry.yarnpkg.com/@salesforce/ts-types/-/ts-types-1.5.21.tgz#e62784872f0e74bf4ae13381dc58aa4644ee2df3"
integrity sha512-qG8r8WOzqpFOHaH3EGU3IwGrY/pSv9NQp4B0wGxOuPDBbraXVvd3KhWVStxaLGKBkJClJ7/+t+iCSP82sEiGcg==
dependencies:
tslib "^2.2.0"

Expand Down

0 comments on commit 037fd11

Please sign in to comment.