Skip to content

Commit

Permalink
Merge dependabot changes [ci skip] (#42)
Browse files Browse the repository at this point in the history
* chore(deps): bump tslib from 1.14.1 to 2.1.0

Bumps [tslib](https://github.com/Microsoft/tslib) from 1.14.1 to 2.1.0.
- [Release notes](https://github.com/Microsoft/tslib/releases)
- [Commits](microsoft/tslib@v1.14.1...2.1.0)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump eslint-config-salesforce-typescript

Bumps [eslint-config-salesforce-typescript](https://github.com/forcedotcom/sfdx-dev-packages) from 0.1.0 to 0.2.0.
- [Release notes](https://github.com/forcedotcom/sfdx-dev-packages/releases)
- [Commits](https://github.com/forcedotcom/sfdx-dev-packages/compare/eslint-config-salesforce-typescript@[email protected])

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump eslint-plugin-jsdoc from 27.1.2 to 31.6.0

Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 27.1.2 to 31.6.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](gajus/eslint-plugin-jsdoc@v27.1.2...v31.6.0)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump mocha from 7.2.0 to 8.2.1

Bumps [mocha](https://github.com/mochajs/mocha) from 7.2.0 to 8.2.1.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](mochajs/mocha@v7.2.0...v8.2.1)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump pretty-quick from 2.0.2 to 3.1.0

Bumps [pretty-quick](https://github.com/azz/pretty-quick) from 2.0.2 to 3.1.0.
- [Release notes](https://github.com/azz/pretty-quick/releases)
- [Commits](prettier/pretty-quick@v2.0.2...v3.1.0)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump @salesforce/core from 2.16.3 to 2.18.0

Bumps [@salesforce/core](https://github.com/forcedotcom/sfdx-core) from 2.16.3 to 2.18.0.
- [Release notes](https://github.com/forcedotcom/sfdx-core/releases)
- [Changelog](https://github.com/forcedotcom/sfdx-core/blob/main/CHANGELOG.md)
- [Commits](forcedotcom/sfdx-core@v2.16.3...v2.18.0)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump @salesforce/dev-scripts from 0.6.2 to 0.7.0

Bumps [@salesforce/dev-scripts](https://github.com/forcedotcom/sfdx-dev-packages) from 0.6.2 to 0.7.0.
- [Release notes](https://github.com/forcedotcom/sfdx-dev-packages/releases)
- [Commits](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/[email protected]...@salesforce/[email protected])

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump @salesforce/ts-sinon from 1.1.3 to 1.3.0

Bumps [@salesforce/ts-sinon](https://github.com/forcedotcom/sfdx-dev-packages) from 1.1.3 to 1.3.0.
- [Release notes](https://github.com/forcedotcom/sfdx-dev-packages/releases)
- [Commits](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/[email protected]...@salesforce/[email protected])

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump shx from 0.2.2 to 0.3.3

Bumps [shx](https://github.com/shelljs/shx) from 0.2.2 to 0.3.3.
- [Release notes](https://github.com/shelljs/shx/releases)
- [Changelog](https://github.com/shelljs/shx/blob/master/CHANGELOG.md)
- [Commits](shelljs/shx@v0.2.2...v0.3.3)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps-dev): bump ts-node from 8.10.2 to 9.1.1

Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.10.2 to 9.1.1.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](TypeStrong/ts-node@v8.10.2...v9.1.1)

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump tslib from 1.14.1 to 2.1.0

Bumps [tslib](https://github.com/Microsoft/tslib) from 1.14.1 to 2.1.0.
- [Release notes](https://github.com/Microsoft/tslib/releases)
- [Commits](microsoft/tslib@v1.14.1...2.1.0)

Signed-off-by: dependabot[bot] <[email protected]>

* chore: resolve linting issues

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
mdonnalley and dependabot[bot] authored Feb 3, 2021
1 parent 5f571bc commit f619f4c
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 146 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
"@oclif/config": "^1.17.0",
"@salesforce/command": "^3.0.4",
"@salesforce/core": "^2.16.4",
"tslib": "^1"
"tslib": "^2"
},
"devDependencies": {
"@oclif/dev-cli": "^1.22.2",
"@salesforce/dev-config": "^2.0.0",
"@salesforce/dev-scripts": "0.6.2",
"@salesforce/dev-config": "^2.1.0",
"@salesforce/dev-scripts": "0.7.0",
"@salesforce/prettier-config": "^0.0.1",
"@salesforce/ts-sinon": "1.1.3",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@salesforce/ts-sinon": "1.3.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-salesforce": "^0.1.0",
"eslint-config-salesforce-license": "^0.1.0",
"eslint-config-salesforce-typescript": "^0.1.0",
"eslint-config-salesforce-typescript": "^0.2.0",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsdoc": "^27.0.3",
Expand All @@ -35,10 +35,10 @@
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"shx": "0.2.2",
"shx": "0.3.3",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.3"
"typescript": "^4.1.3"
},
"config": {
"commitizen": {
Expand Down
14 changes: 9 additions & 5 deletions src/commands/force/user/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Logger,
Messages,
Org,
REQUIRED_FIELDS,
SfdxError,
User,
UserFields,
Expand Down Expand Up @@ -106,7 +107,8 @@ export class UserCreateCommand extends SfdxCommand {
name: 'Permission Set Assignment',
value: permsetArray.join(','),
});
} catch (err) {
} catch (error) {
const err = error as SfdxError;
this.failures.push({
name: 'Permission Set Assignment',
message: err.message,
Expand All @@ -120,13 +122,15 @@ export class UserCreateCommand extends SfdxCommand {
const password = User.generatePasswordUtf8();
await this.user.assignPassword(this.authInfo, password);
password.value((pass: Buffer) => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.authInfo.save({ password: pass.toString('utf-8') });
this.successes.push({
name: 'Password Assignment',
value: pass.toString(),
});
});
} catch (err) {
} catch (error) {
const err = error as SfdxError;
this.failures.push({
name: 'Password Assignment',
message: err.message,
Expand Down Expand Up @@ -171,10 +175,10 @@ export class UserCreateCommand extends SfdxCommand {
private async aggregateFields(defaultFields: UserFields): Promise<UserFields & Dictionary<string>> {
// start with the default fields, then add the fields from the file, then (possibly overwritting) add the fields from the cli varargs param
if (this.flags.definitionfile) {
const content = await fs.readJson(this.flags.definitionfile);
const content = (await fs.readJson(this.flags.definitionfile)) as UserFields;
Object.keys(content).forEach((key) => {
// cast entries to lowercase to standardize
defaultFields[this.lowerFirstLetter(key)] = content[key];
defaultFields[this.lowerFirstLetter(key)] = content[key] as keyof typeof REQUIRED_FIELDS;
});
}

Expand All @@ -190,7 +194,7 @@ export class UserCreateCommand extends SfdxCommand {

// check if "profileName" was passed, this needs to become a profileId before calling User.create
if (defaultFields['profileName']) {
const name: string = defaultFields['profileName'] || 'Standard User';
const name = (defaultFields['profileName'] || 'Standard User') as string;
this.logger.debug(`Querying org for profile name [${name}]`);
const response: QueryResult<{ Id: string }> = await this.org
.getConnection()
Expand Down
18 changes: 10 additions & 8 deletions src/commands/force/user/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import * as os from 'os';
import { SfdxCommand } from '@salesforce/command';
import { Messages, Connection, Aliases, AuthInfo, ConfigAggregator } from '@salesforce/core';
import { Messages, Connection, Aliases, ConfigAggregator } from '@salesforce/core';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-user', 'list');
Expand All @@ -24,7 +24,9 @@ type AuthList = {
};

type UserInfo = { Username: string; ProfileId: string; Id: string };
type UserInfoMap = Record<string, UserInfo>;
type ProfileInfo = { Id: string; Name: string };
type ProfileInfoMap = Record<string, string>;

export class UserListCommand extends SfdxCommand {
public static readonly description = messages.getMessage('description');
Expand All @@ -35,9 +37,9 @@ export class UserListCommand extends SfdxCommand {

public async run(): Promise<AuthList[]> {
this.conn = this.org.getConnection();
const userInfos: UserInfo = await this.buildUserInfos();
const profileInfos: ProfileInfo = await this.buildProfileInfos();
const userAuthData: AuthInfo[] = await this.org.readUserAuthFiles();
const userInfos = await this.buildUserInfos();
const profileInfos = await this.buildProfileInfos();
const userAuthData = await this.org.readUserAuthFiles();
const aliases = await Aliases.create(Aliases.getDefaultOptions());

const authList: AuthList[] = userAuthData.map((authData) => {
Expand Down Expand Up @@ -81,14 +83,14 @@ export class UserListCommand extends SfdxCommand {
* @private
* @return Promise<UserInfo>
*/
private async buildUserInfos(): Promise<UserInfo> {
private async buildUserInfos(): Promise<UserInfoMap> {
const userRecords = await this.conn.query<UserInfo>('SELECT username, profileid, id FROM User');

if (userRecords.records) {
return userRecords.records.reduce((userInfo, { Username, ProfileId, Id }) => {
userInfo[Username] = { ProfileId, Id };
return userInfo;
});
}, {});
}
}

Expand All @@ -98,14 +100,14 @@ export class UserListCommand extends SfdxCommand {
* @private
* @return Promise<ProfileInfo>
*/
private async buildProfileInfos(): Promise<ProfileInfo> {
private async buildProfileInfos(): Promise<ProfileInfoMap> {
const profileRecords = await this.conn.query<ProfileInfo>('SELECT id, name FROM Profile');

if (profileRecords.records) {
return profileRecords.records.reduce((profileInfo, { Id, Name }) => {
profileInfo[Id] = Name;
return profileInfo;
});
}, {});
}
}
}
9 changes: 5 additions & 4 deletions src/commands/force/user/password/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class UserPasswordGenerateCommand extends SfdxCommand {
private passwordData: PasswordData[] = [];

public async run(): Promise<PasswordData[]> {
this.usernames = this.flags.onbehalfof ?? [this.org.getUsername()];
this.usernames = (this.flags.onbehalfof as string[]) ?? [this.org.getUsername()];

for (const aliasOrUsername of this.usernames) {
try {
Expand Down Expand Up @@ -63,9 +63,10 @@ export class UserPasswordGenerateCommand extends SfdxCommand {

await authInfo.save();
} catch (e) {
const err = e as SfdxError;
if (
e.message.includes('Cannot set password for self') ||
e.message.includes('The requested Resource does not exist')
err.message.includes('Cannot set password for self') ||
err.message.includes('The requested Resource does not exist')
) {
// we don't have access to the apiVersion from what happened in the try, so until v51 is r2, we have to check versions the hard way
const authInfo: AuthInfo = await AuthInfo.create({ username: aliasOrUsername });
Expand All @@ -80,7 +81,7 @@ export class UserPasswordGenerateCommand extends SfdxCommand {
}
throw new SfdxError(messages.getMessage('noSelfSetErrorV50'), 'noSelfSetError');
}
throw SfdxError.wrap(e);
throw SfdxError.wrap(err);
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/commands/force/user/permset/assign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class UserPermsetAssignCommand extends SfdxCommand {

public async run(): Promise<Result> {
try {
this.usernames = this.flags.onbehalfof ?? [this.org.getUsername()];
this.usernames = (this.flags.onbehalfof as string[]) ?? [this.org.getUsername()];

const connection: Connection = this.org.getConnection();
const org = await Org.create({ connection });
Expand All @@ -68,12 +68,13 @@ export class UserPermsetAssignCommand extends SfdxCommand {
await user.assignPermissionSets(userId, [this.flags.permsetname]);
this.successes.push({
name: aliasOrUsername,
value: this.flags.permsetname,
value: this.flags.permsetname as string,
});
} catch (e) {
const err = e as SfdxError;
this.failures.push({
name: aliasOrUsername,
message: e.message,
message: err.message,
});
}
}
Expand Down
3 changes: 3 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off',
// Easily return a promise in a mocked method.
'@typescript-eslint/require-await': 'off',

'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
},
};
2 changes: 1 addition & 1 deletion test/commands/user/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

/* eslint-disable @typescript-eslint/ban-ts-ignore */
/* eslint-disable @typescript-eslint/ban-ts-comment */

import { $$, expect, test } from '@salesforce/command/lib/test';
import { Aliases, AuthInfo, Connection, DefaultUserFields, fs, Logger, Org, User } from '@salesforce/core';
Expand Down
Loading

0 comments on commit f619f4c

Please sign in to comment.