@ds-sfdc/sfparty 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ds-sfdc/sfparty",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Salesforce metadata XML splitter for CI/CD",
5
5
  "type": "module",
6
6
  "repository": {
@@ -68,8 +68,9 @@ export class Package {
68
68
  packageDefinition.metadataDefinition.fallbackVersion
69
69
  }
70
70
  that.packageJSON = json
71
- if (json.Package.types !== undefined)
71
+ if (json.Package.types !== undefined) {
72
72
  transformJSON(json.Package.types)
73
+ }
73
74
  cleanPackage(that)
74
75
  }
75
76
 
@@ -80,6 +81,7 @@ export class Package {
80
81
  )
81
82
  if (that.packageJSON.Package == undefined)
82
83
  throw new Error('Package initialization failed')
84
+
83
85
  if (that.packageJSON.Package.types === undefined)
84
86
  return 'No types found'
85
87
 
@@ -93,6 +95,12 @@ export class Package {
93
95
  )
94
96
  }
95
97
  })
98
+
99
+ // remove all types nodes that have no members
100
+ that.packageJSON.Package.types =
101
+ that.packageJSON.Package.types.filter(
102
+ (subType) => subType.members.length > 0,
103
+ )
96
104
  }
97
105
  }
98
106
 
@@ -74,4 +74,5 @@ export const metadataDefinition = {
74
74
  tabSettings: ['tab', 'visibility'],
75
75
  userPermissions: ['name', 'enabled'],
76
76
  },
77
+ delta: false,
77
78
  }
@@ -83,4 +83,5 @@ export const metadataDefinition = {
83
83
  userPermissions: ['name', 'enabled'],
84
84
  },
85
85
  xmlFirst: 'fullName',
86
+ delta: false,
86
87
  }
@@ -124,4 +124,5 @@ export const metadataDefinition = {
124
124
  rules: 'WorkflowRule',
125
125
  tasks: 'WorkflowTask',
126
126
  },
127
+ delta: true,
127
128
  }
@@ -32,7 +32,7 @@ export class Combine {
32
32
  mtime: undefined,
33
33
  }
34
34
  #json = {}
35
- #diffOnly = false
35
+ #delta = false
36
36
  #addedFiles = []
37
37
  #deletedFiles = []
38
38
  #mainDeleted = false
@@ -86,11 +86,6 @@ export class Combine {
86
86
  combine() {
87
87
  return new Promise((resolve, reject) => {
88
88
  const that = this
89
- that.#diffOnly =
90
- global.metaTypes[that.metadataDefinition.alias].add.files
91
- .length > 0 ||
92
- global.metaTypes[that.metadataDefinition.alias].remove.files
93
- .length > 0
94
89
 
95
90
  if (!fileUtils.directoryExists({ dirPath: that.sourceDir, fs }))
96
91
  reject(`Path does not exist: ${that.sourceDir}`)
@@ -148,6 +143,9 @@ export class Combine {
148
143
  i.toLowerCase().includes(`/main.${global.format}`),
149
144
  )
150
145
 
146
+ // set delta based on metadata definition
147
+ that.#delta = that.metadataDefinition.delta
148
+
151
149
  let success = processParts(that)
152
150
  // Ensure we only match existing metadata type directory and item
153
151
 
@@ -156,7 +154,7 @@ export class Combine {
156
154
  !that.metadataDefinition.packageTypeIsDirectory &&
157
155
  global.git.enabled
158
156
  ) {
159
- if (!that.#diffOnly || that.#addedFiles.length > 0) {
157
+ if (!that.#delta || that.#addedFiles.length > 0) {
160
158
  that.addPkg.addMember(
161
159
  that.#root,
162
160
  that.#fileName.shortName,
@@ -164,7 +162,7 @@ export class Combine {
164
162
  }
165
163
 
166
164
  // only include the workflow node if main part file is delete
167
- if (that.#diffOnly && that.#mainDeleted) {
165
+ if (that.#delta && that.#mainDeleted) {
168
166
  that.desPkg.addMember(
169
167
  that.#root,
170
168
  that.#fileName.shortName,
@@ -389,7 +387,7 @@ export class Combine {
389
387
  )
390
388
  }
391
389
 
392
- if (that.#diffOnly) {
390
+ if (that.#delta) {
393
391
  if (
394
392
  !that.#addedFiles
395
393
  .concat(that.#deletedFiles)
@@ -152,7 +152,7 @@ it('should correctly process the json object returned from the XML file', async
152
152
  name: 'PermissionSet',
153
153
  },
154
154
  {
155
- members: ['Test', 'Test.yaml'],
155
+ members: ['Test.yaml'],
156
156
  name: 'Workflow',
157
157
  },
158
158
  ],
@@ -182,10 +182,6 @@ it('should correctly process the json object returned from the XML file', async
182
182
  members: ['Test'],
183
183
  name: 'PermissionSet',
184
184
  },
185
- {
186
- members: ['Test'],
187
- name: 'Workflow',
188
- },
189
185
  ],
190
186
  version: '56.0',
191
187
  },