Skip to content

Commit

Permalink
Merge pull request #1700 from Accenture/task/1674-ensure-journey-acti…
Browse files Browse the repository at this point in the history
…vities-are-always-sorted-the-same-way-to-make-git-comparison-easier

Task/1674 ensure journey activities and entry-event fields are sorted to ease pull request reviews
  • Loading branch information
JoernBerkefeld authored Sep 12, 2024
2 parents f2176b1 + 607c31c commit 6e79ccb
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 71 deletions.
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Event.d.ts.map

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

2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Journey.d.ts.map

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

7 changes: 7 additions & 0 deletions @types/lib/util/util.d.ts

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

2 changes: 1 addition & 1 deletion @types/lib/util/util.d.ts.map

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

10 changes: 7 additions & 3 deletions lib/metadataTypes/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,9 @@ class Event extends MetadataType {
*/
static checkSalesforceEntryEvents(ca, isPublished) {
// 1 check eventDataConfig
const edcObjects = ca.eventDataConfig.objects;
const edcObjects = ca.eventDataConfig.objects.sort((a, b) =>
a.dePrefix.localeCompare(b.dePrefix)
);
const errors = [];
const dePrefixFields = {};
const dePrefixRelationshipMap = {};
Expand All @@ -701,6 +703,8 @@ class Event extends MetadataType {
// if it has no value this is the entry-source object itself
const referencedObject =
object.referenceObject === '' ? ca.objectAPIName : object.referenceObject;
// sort list of fields alphabetically
object.fields.sort();
// check if object was cached earlier
if (!this.sfObjects.workflowObjects.includes(referencedObject)) {
errors.push(`Salesforce object ${referencedObject} not found on connected org.`);
Expand All @@ -711,7 +715,7 @@ class Event extends MetadataType {
// check if we found fields for the object
errors.push(
`Fields for Salesforce object ${referencedObject} could not be checked. Fields selected in entry event: ` +
object.fields.sort().join(', ')
object.fields.join(', ')
);
} else {
// check if the fields selected in the eventDefinition are actually available
Expand Down Expand Up @@ -947,7 +951,7 @@ class Event extends MetadataType {
ca.eventDataSummary =
'string' === typeof ca.eventDataSummary
? // @ts-expect-error transforming this from API-string-format to from mcdev-format
ca.eventDataSummary.split('; ').filter(Boolean)
ca.eventDataSummary.split('; ').filter(Boolean).sort()
: ca.eventDataSummary;
ca.passThroughArgument =
'string' === typeof ca.passThroughArgument
Expand Down
Loading

0 comments on commit 6e79ccb

Please sign in to comment.