Skip to content

Commit

Permalink
Upgraded to 4.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hknokh2 committed Feb 1, 2025
1 parent 3562004 commit 6fa0a18
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 47 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### v4.10.2
**Fixes**
- Fetch target object metadata when mapped to another object
- Resolved the issue where an unnecessary trailing semicolon was added after the composite `externalId`

### v4.10.0
**New:**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

48 changes: 34 additions & 14 deletions js/common/extensions-implementations.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/common/extensions-implementations.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/models/sfdmu-models.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/models/sfdmu-models.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sfdmu-gui-app",
"version": "4.10.0",
"version": "4.10.2",
"description": "SFDMU GUI App",
"repository": "forcedotcom/SFDX-Data-Move-Utility-Desktop-App",
"license": "BSD-3-Clause",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ export class ObjectManagerEditorController {
// Set the sobject id in the config
const config = DatabaseService.getConfig();
const objectSet = DatabaseService.getObjectSet();
const newSObjectId = objectSet.objects.find(x => x.name == this.selectedSObjectOption.value)?.id;
const newSObject = objectSet.objects.find(x => x.name == this.selectedSObjectOption.value);
const newSObjectId = newSObject?.id;
const mustupdateDatabase = config.sObjectId != newSObjectId;
config.sObjectId = newSObjectId;

Expand All @@ -217,6 +218,12 @@ export class ObjectManagerEditorController {
LogService.info(`SObject ${this.selectedSObject.name} is not initialized.`);
}

for (const mapping of newSObject.fieldMapping) {
if (mapping.targetObject) {
await this.$app.describeWorkspaceSObjectAsync(mapping.targetObject);
}
}

// Setup the fields
await this.setup();
//this.$app.buildFooter();
Expand Down
72 changes: 48 additions & 24 deletions src/common/extensions-implementations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,35 @@ Array.prototype.flatBy = function <TChild, TParent>(this: TParent[], flatByProp:
}, [] as TChild[]);
};

Array.prototype.groupByProp = function <T, GroupKey extends keyof T>(
this: T[],
groupByProperty: GroupKey,
groupKeyProperty: string,
groupArrayProperty: string
): Array<IGroupedObject<T, GroupKey>> {
const groupMap = new Map<T[GroupKey], Array<{ [prop: string]: any }>>();

for (const obj of this) {
const key = obj[groupByProperty];

if (!groupMap.has(key)) {
groupMap.set(key, []);
}

const group = groupMap.get(key);

group?.push({ ...obj });
}

const groupedArray = Array.from(groupMap.entries()).map(([key, values]) => ({
[groupKeyProperty]: key,
[groupArrayProperty]: values,
}));

return groupedArray.sort((a, b) => (a[groupKeyProperty] > b[groupKeyProperty]) ? 1 : -1);
};


// String prototype extensions implementation ------------------------------------------------------------
String.prototype.format = function (this: string, ...args: any[]) {
return this.replace(/{(\d+)}/g, function (match: string, number: number) {
Expand Down Expand Up @@ -284,34 +313,29 @@ String.prototype.replaceStrings = function (this: string, ...replacements: Repla
return result;
};

String.prototype.trimEnd = function (charToTrim?: string): string {
if (!this) {
return this;
}
if (!charToTrim) {
return this.replace(/\s+$/, ''); // Default behavior for spaces
}
const regex = new RegExp(`${charToTrim}+$`);
return this.replace(regex, '');
};

Array.prototype.groupByProp = function <T, GroupKey extends keyof T>(
this: T[],
groupByProperty: GroupKey,
groupKeyProperty: string,
groupArrayProperty: string
): Array<IGroupedObject<T, GroupKey>> {
const groupMap = new Map<T[GroupKey], Array<{ [prop: string]: any }>>();

for (const obj of this) {
const key = obj[groupByProperty];

if (!groupMap.has(key)) {
groupMap.set(key, []);
}

const group = groupMap.get(key);

group?.push({ ...obj });
String.prototype.trimStart = function (charToTrim?: string): string {
if (!this) {
return this;
}
if (!charToTrim) {
return this.replace(/^\s+/, ''); // Default behavior for spaces
}
const regex = new RegExp(`^${charToTrim}+`);
return this.replace(regex, '');
};

const groupedArray = Array.from(groupMap.entries()).map(([key, values]) => ({
[groupKeyProperty]: key,
[groupArrayProperty]: values,
}));

return groupedArray.sort((a, b) => (a[groupKeyProperty] > b[groupKeyProperty]) ? 1 : -1);
};


// RegExp extensions implementation ------------------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions src/common/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,24 @@ declare global {
*/
replaceStrings(...replacements: Replacement[]): string;

/**
* Removes the specified character from the end of the string.
* If no character is provided, whitespace will be trimmed by default.
*
* @param charToTrim - The character to remove from the end of the string. If not specified, whitespace will be trimmed.
* @returns A new string with the specified character removed from the end.
*/
trimEnd(charToTrim?: string): string;

/**
* Removes the specified character from the start of the string.
* If no character is provided, whitespace will be trimmed by default.
*
* @param charToTrim - The character to remove from the start of the string. If not specified, whitespace will be trimmed.
* @returns A new string with the specified character removed from the start.
*/
trimStart(charToTrim?: string): string;

}

// RegExp prototype extensions declaration ------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/models/sfdmu-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ export class ScriptObject extends ScriptEntityBase {
return this._externalId || this.defaultExternalId;
}
set externalId(value: string) {
this._externalId = value;
this._externalId = value.trimEnd(';');
}

/**
Expand Down

0 comments on commit 6fa0a18

Please sign in to comment.