Skip to content

Commit

Permalink
Revert "feat!: component set components are now DecodableMaps (#1080)" (
Browse files Browse the repository at this point in the history
#1101)

This reverts commit 26aef11.
  • Loading branch information
shetzel authored Sep 5, 2023
1 parent a0e7143 commit 615c477
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 257 deletions.
23 changes: 12 additions & 11 deletions src/collections/componentSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
PackageTypeMembers,
} from './types';
import { LazyCollection } from './lazyCollection';
import { DecodeableMap } from './decodeableMap';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/source-deploy-retrieve', 'sdr');
Expand Down Expand Up @@ -74,14 +73,14 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
public forceIgnoredPaths?: Set<string>;
private logger: Logger;
private registry: RegistryAccess;
private components = new DecodeableMap<string, DecodeableMap<string, SourceComponent>>();
private components = new Map<string, Map<string, SourceComponent>>();

// internal component maps used by this.getObject() when building manifests.
private destructiveComponents = {
[DestructiveChangesType.PRE]: new DecodeableMap<string, DecodeableMap<string, SourceComponent>>(),
[DestructiveChangesType.POST]: new DecodeableMap<string, DecodeableMap<string, SourceComponent>>(),
[DestructiveChangesType.PRE]: new Map<string, Map<string, SourceComponent>>(),
[DestructiveChangesType.POST]: new Map<string, Map<string, SourceComponent>>(),
};
private manifestComponents = new DecodeableMap<string, DecodeableMap<string, SourceComponent>>();
private manifestComponents = new Map<string, Map<string, SourceComponent>>();

private destructiveChangesType = DestructiveChangesType.POST;

Expand Down Expand Up @@ -113,11 +112,11 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
return size;
}

public get destructiveChangesPre(): DecodeableMap<string, DecodeableMap<string, SourceComponent>> {
public get destructiveChangesPre(): Map<string, Map<string, SourceComponent>> {
return this.destructiveComponents[DestructiveChangesType.PRE];
}

public get destructiveChangesPost(): DecodeableMap<string, DecodeableMap<string, SourceComponent>> {
public get destructiveChangesPost(): Map<string, Map<string, SourceComponent>> {
return this.destructiveComponents[DestructiveChangesType.POST];
}

Expand Down Expand Up @@ -486,7 +485,7 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
public add(component: ComponentLike, deletionType?: DestructiveChangesType): void {
const key = simpleKey(component);
if (!this.components.has(key)) {
this.components.set(key, new DecodeableMap<string, SourceComponent>());
this.components.set(key, new Map<string, SourceComponent>());
}

if (!(component instanceof SourceComponent)) {
Expand All @@ -503,12 +502,12 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
this.logger.debug(`Marking component for delete: ${component.fullName}`);
const deletions = this.destructiveComponents[deletionType];
if (!deletions.has(key)) {
deletions.set(key, new DecodeableMap<string, SourceComponent>());
deletions.set(key, new Map<string, SourceComponent>());
}
deletions.get(key)?.set(sourceKey(component), component);
} else {
if (!this.manifestComponents.has(key)) {
this.manifestComponents.set(key, new DecodeableMap<string, SourceComponent>());
this.manifestComponents.set(key, new Map<string, SourceComponent>());
}
this.manifestComponents.get(key)?.set(sourceKey(component), component);
}
Expand Down Expand Up @@ -543,8 +542,10 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
* @returns `true` if the component is in the set
*/
public has(component: ComponentLike): boolean {
// Compare the component key as is and decoded. Decoding the key before comparing can solve some edge cases
// in component fullNames such as Layouts. See: https://github.com/forcedotcom/cli/issues/1683
const key = simpleKey(component);
if (this.components.has(key)) {
if (this.components.has(key) || this.components.has(decodeURIComponent(key))) {
return true;
}

Expand Down
78 changes: 0 additions & 78 deletions src/collections/decodeableMap.ts

This file was deleted.

168 changes: 0 additions & 168 deletions test/collections/decodeableMap.test.ts

This file was deleted.

0 comments on commit 615c477

Please sign in to comment.