-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: no nullish in template literal #627
Conversation
@@ -320,7 +320,9 @@ export class PackageAncestry extends AsyncCreatable<PackageAncestryOptions> { | |||
// Check to see if the package is an unlocked package | |||
// if so, throw and error since ancestry only applies to managed packages | |||
await this.validatePackageType(); | |||
const normalQuery = `${SELECT_PACKAGE_VERSION} WHERE AncestorId = NULL AND Package2Id = '${this.requestedPackageId}' ${releasedOnlyFilter}`; | |||
const normalQuery = `${SELECT_PACKAGE_VERSION} WHERE AncestorId = NULL AND Package2Id = '${ | |||
this.requestedPackageId ?? '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where queries and consts are being built, I preserved the existing behavior (with `?? '') to let the server handle the missing value like it currently would
@@ -205,19 +205,21 @@ export async function createPackageVersionCreateRequest( | |||
if (hasSeedMetadata) { | |||
// Zip the seedMetadataFolder folder and put the zip in {packageVersBlobDirectory}/{seedMetadataZipFile} | |||
Logger.childFromRoot('packageConvert:pollForStatusWithInterval').debug( | |||
`Including metadata found in '${context.seedmetadata}'.` | |||
`Including metadata found in '${context.seedmetadata ?? '<undefined seedmetadata>'}'.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logs get a more descriptive indicator of what's missing from where
@@ -145,7 +145,7 @@ export class PackageVersion { | |||
frequency: Duration.seconds(0), | |||
timeout: Duration.seconds(0), | |||
} | |||
): Promise<Partial<PackageVersionCreateRequestResult>> { | |||
): Promise<PackageVersionCreateRequestResult> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function called at the bottom (byId) claims its return type is PackageVersionCreateRequestResult
.
Other consumers of byId also return a PackageVersionCreateRequestResult
so I used that.
the very loose Partial
would have forced lots of undefined checks.
@@ -411,8 +411,9 @@ export class PackageVersion { | |||
} | |||
|
|||
private static getPackage2VersionFields(connection: Connection): string[] { | |||
const apiVersion = connection.getApiVersion(); | |||
return Package2VersionFields.filter((field) => (apiVersion > '60.0' ? true : field !== 'ValidatedAsync')); | |||
return parseInt(connection.getApiVersion(), 10) > 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparing strings via >
works fine until we get to 100, after which 100.0
< 99.0
so use numbers when comparing numbers
@@ -411,8 +411,9 @@ export class PackageVersion { | |||
} | |||
|
|||
private static getPackage2VersionFields(connection: Connection): string[] { | |||
const apiVersion = connection.getApiVersion(); | |||
return Package2VersionFields.filter((field) => (apiVersion > '60.0' ? true : field !== 'ValidatedAsync')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the conditional didn't need to be checked for every field
@@ -476,34 +477,29 @@ export class PackageVersion { | |||
* @returns Package2Version | |||
*/ | |||
public async getData(force = false): Promise<Package2Version> | never { | |||
let is05i = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope
label2: BY_LABEL.PACKAGE_VERSION_ID.label, | ||
}; | ||
} | ||
const queryConfig: { id: string; clause: string; label1: string; label2: string } = this.id.startsWith('05i') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const > let
@@ -202,8 +202,8 @@ export async function getPackageVersionId(versionId: string, connection: Connect | |||
}); | |||
} | |||
|
|||
export function escapeInstallationKey(key?: string): Nullable<string> { | |||
return key ? key.replace(/\\/g, '\\\\').replace(/'/g, "\\'") : null; | |||
export function escapeInstallationKey(key: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every consumer was passing a string
updates the deps for all the other PRs.
applies our linter rule ( no nullish in template literals)
reduce
let