Skip to content

Commit b112335

Browse files
chore: follow IDEs warnings, improvements, switch to promise read to see perf
1 parent 3a10b04 commit b112335

19 files changed

+39
-56
lines changed

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ xunit.xml
2020
junit-custom.xml
2121
*.received.*
2222

23-
# nyc test coverage
24-
.nyc_output
25-
2623
# Eclipse
2724
.project
2825

@@ -91,9 +88,6 @@ typings/
9188
# Optional REPL history
9289
.node_repl_history
9390

94-
# Output of 'npm pack'
95-
*.tgz
96-
9791
# Yarn Integrity file
9892
.yarn-integrity
9993

src/client/metadataApiDeploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class MetadataApiDeploy extends MetadataTransfer<
152152
}
153153
const connection = await this.getConnection();
154154
// Recasting to use the project's version of the type
155-
return connection.metadata.checkDeployStatus(this.id, true) as unknown as MetadataApiDeployStatus;
155+
return (await connection.metadata.checkDeployStatus(this.id, true)) as unknown as MetadataApiDeployStatus;
156156
}
157157

158158
/**

src/client/metadataTransfer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export abstract class MetadataTransfer<
4646
private transferId: Options['id'];
4747
private event = new EventEmitter();
4848
private usernameOrConnection: string | Connection;
49-
private apiVersion?: string;
49+
private readonly apiVersion?: string;
5050

5151
public constructor({ usernameOrConnection, components, apiVersion, id }: Options) {
5252
this.usernameOrConnection = usernameOrConnection;

src/client/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ export type MetadataApiDeployStatus = {
140140
export type DeployDetails = {
141141
componentFailures?: DeployMessage | DeployMessage[];
142142
componentSuccesses?: DeployMessage | DeployMessage[];
143-
// TODO: Add types for RetrieveResult
144-
// retrieveResult?:
145143
runTestResult?: RunTestResult;
146144
};
147145

src/collections/componentSet.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,10 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
221221
if (resolveIncludeSet && !deletionType) {
222222
resolveIncludeSet.add(component);
223223
}
224-
if (resolvePreSet && deletionType === DestructiveChangesType.PRE) {
225-
resolvePreSet.add(component, DestructiveChangesType.PRE);
226-
}
227-
if (resolvePostSet && deletionType === DestructiveChangesType.POST) {
228-
resolvePostSet.add(component, DestructiveChangesType.POST);
224+
if (resolvePreSet && deletionType) {
225+
resolvePreSet.add(component, deletionType);
229226
}
227+
230228
const memberIsWildcard = component.fullName === ComponentSet.WILDCARD;
231229
if (options.resolveSourcePaths === undefined || !memberIsWildcard || options.forceAddWildcards) {
232230
result.add(component, deletionType);

src/collections/componentSetBuilder.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,19 @@ const getOrgComponentFilter = (
319319
): FromConnectionOptions['componentFilter'] =>
320320
metadata?.metadataEntries?.length
321321
? (component: Partial<FileProperties>): boolean => {
322+
// {
323+
// "createdById": "005KR000000mVHLYA2",
324+
// "createdByName": "User User",
325+
// "createdDate": "2025-03-05T21:15:23.000Z",
326+
// "fileName": "classes/FileUtilitiesTest.cls",
327+
// "fullName": "FileUtilitiesTest",
328+
// "id": "01pKR000000FgMQYA0",
329+
// "lastModifiedById": "005KR000000mVHLYA2",
330+
// "lastModifiedByName": "User User",
331+
// "lastModifiedDate": "2025-03-05T21:15:23.000Z",
332+
// "manageableState": "unmanaged",
333+
// "type": "ApexClass"
334+
// }
322335
if (component.type && component.fullName) {
323336
const mdMapEntry = mdMap.get(component.type);
324337
// using minimatch versus RegExp provides better (more expected) matching results

src/convert/metadataConverter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class MetadataConverter {
2929
public static readonly DESTRUCTIVE_CHANGES_PRE_XML_FILE = 'destructiveChangesPre.xml';
3030
public static readonly DEFAULT_PACKAGE_PREFIX = 'metadataPackage';
3131

32-
private registry: RegistryAccess;
32+
private readonly registry: RegistryAccess;
3333

3434
public constructor(registry = new RegistryAccess()) {
3535
this.registry = registry;

src/convert/replacements.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ export const replacementIterations = async (input: string, replacements: MarkedR
6666
const lifecycleInstance = Lifecycle.getInstance();
6767
let output = input;
6868
for (const replacement of replacements) {
69-
// TODO: node 16+ has String.replaceAll for non-regex scenarios
70-
const regex =
71-
typeof replacement.toReplace === 'string' ? new RegExp(replacement.toReplace, 'g') : replacement.toReplace;
72-
const replaced = output.replace(regex, replacement.replaceWith ?? '');
69+
const replaced = output.replaceAll(new RegExp(replacement.toReplace, 'g'), replacement.replaceWith ?? '');
7370

7471
if (replaced !== output) {
7572
output = replaced;

src/convert/streams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export abstract class ComponentWriter extends Writable {
118118
protected rootDestination?: SourcePath;
119119
protected logger: Logger;
120120

121-
public constructor(rootDestination?: SourcePath) {
121+
protected constructor(rootDestination?: SourcePath) {
122122
super({ objectMode: true });
123123
this.rootDestination = rootDestination;
124124
this.logger = Logger.childFromRoot(this.constructor.name);

src/registry/registryAccess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Messages.importMessagesDirectory(__dirname);
1717
const messages = Messages.loadMessages('@salesforce/source-deploy-retrieve', 'sdr');
1818

1919
export class RegistryAccess {
20-
private registry: MetadataRegistry;
20+
private readonly registry: MetadataRegistry;
2121
private strictFolderTypes?: MetadataType[];
2222
private folderContentTypes?: MetadataType[];
2323
private aliasTypes?: MetadataType[];

0 commit comments

Comments
 (0)