xml-disassembler 1.2.8 → 1.2.10
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/CHANGELOG.md +12 -0
- package/README.md +9 -13
- package/disassemble.log +93 -93
- package/dist/index.cjs +46 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.min.umd.js +1 -1
- package/dist/index.min.umd.js.map +1 -1
- package/dist/index.mjs +46 -52
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +46 -52
- package/dist/index.umd.js.map +1 -1
- package/dist/typings/helpers/types.d.ts +1 -1
- package/dist/typings/service/buildDisassembledFiles.d.ts +1 -1
- package/dist/typings/service/buildLeafFile.d.ts +1 -1
- package/dist/typings/service/buildNestedFiles.d.ts +1 -1
- package/dist/typings/service/buildReassembledFiles.d.ts +1 -1
- package/dist/typings/service/disassembleXMLFileHandler.d.ts +2 -2
- package/dist/typings/service/reassembleXMLFileHandler.d.ts +1 -1
- package/package.json +9 -2
- package/CONTRIBUTING.md +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.2.10](https://github.com/mcarvin8/xml-disassembler/compare/v1.2.9...v1.2.10) (2024-04-24)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- remove extra space in leaf file, normalize variable names, change `xmlPath` to `filePath` in classes ([61a204c](https://github.com/mcarvin8/xml-disassembler/commit/61a204cac95a831e6543f54acb70451c07b824a6))
|
|
6
|
+
|
|
7
|
+
## [1.2.9](https://github.com/mcarvin8/xml-disassembler/compare/v1.2.8...v1.2.9) (2024-04-24)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- remove leaf content sorting due to issues with multi-line leaf tags ([eacc56d](https://github.com/mcarvin8/xml-disassembler/commit/eacc56df49fe1c20ee1846859525d1067986b9d3))
|
|
12
|
+
|
|
1
13
|
## [1.2.8](https://github.com/mcarvin8/xml-disassembler/compare/v1.2.7...v1.2.8) (2024-04-08)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ Import the `DisassembleXMLFileHandler` class from the package.
|
|
|
100
100
|
```typescript
|
|
101
101
|
/*
|
|
102
102
|
FLAGS
|
|
103
|
-
-
|
|
103
|
+
- filePath: Path to 1 XML file or a directory of XML files to disassemble. If the path provided is a directory, only the files in the immediate directory will be disassembled.
|
|
104
104
|
- uniqueIdElements: (Optional) Comma-separated list of unique and required ID elements used to name disassembled files for nested elements.
|
|
105
105
|
Defaults to SHA-256 hash if unique ID elements are undefined or not found.
|
|
106
106
|
- prePurge: (Optional) Boolean value. If set to true, purge pre-existing disassembled directories prior to disassembling the file.
|
|
@@ -112,7 +112,7 @@ import { DisassembleXMLFileHandler } from "xml-disassembler";
|
|
|
112
112
|
|
|
113
113
|
const handler = new DisassembleXMLFileHandler();
|
|
114
114
|
await handler.disassemble({
|
|
115
|
-
|
|
115
|
+
filePath: "test/baselines/general",
|
|
116
116
|
uniqueIdElements:
|
|
117
117
|
"application,apexClass,name,externalDataSource,flow,object,apexPage,recordType,tab,field",
|
|
118
118
|
prePurge: true,
|
|
@@ -122,25 +122,25 @@ await handler.disassemble({
|
|
|
122
122
|
|
|
123
123
|
## Reassembling Files
|
|
124
124
|
|
|
125
|
-
Reassemble 1 XML directory (`
|
|
125
|
+
Reassemble 1 XML directory (`filePath`) containing disassembled files back into 1 XML file.
|
|
126
126
|
|
|
127
|
-
**NOTE**: You should be reassembling files created by this package's `DisassembleXMLFileHandler` class for intended results. This class will assume all disassembled files in `
|
|
127
|
+
**NOTE**: You should be reassembling files created by this package's `DisassembleXMLFileHandler` class for intended results. This class will assume all disassembled files in `filePath` have the same XML Root Element. The reassembled XML file will be created in the parent directory of `filePath` and will overwrite the original file used to create the original disassembled directories, if it still exists and the `fileExtension` flag matches the original file extension.
|
|
128
128
|
|
|
129
129
|
Import the `ReassembleXMLFileHandler` class from the package.
|
|
130
130
|
|
|
131
131
|
```typescript
|
|
132
132
|
/*
|
|
133
133
|
FLAGS
|
|
134
|
-
-
|
|
134
|
+
- filePath: Path to the disassembled XML files to reassemble (must be a directory)
|
|
135
135
|
- fileExtension: (Optional) Desired file extension for the final XML (default: `.xml`)
|
|
136
|
-
- postPurge: (Optional) Boolean value. If set to true, purge the disassembled file directory (
|
|
136
|
+
- postPurge: (Optional) Boolean value. If set to true, purge the disassembled file directory (filePath) after reassembly.
|
|
137
137
|
Defaults to false.
|
|
138
138
|
*/
|
|
139
139
|
import { ReassembleXMLFileHandler } from "xml-disassembler";
|
|
140
140
|
|
|
141
141
|
const handler = new ReassembleXMLFileHandler();
|
|
142
142
|
await handler.reassemble({
|
|
143
|
-
|
|
143
|
+
filePath: "test/baselines/general/HR_Admin",
|
|
144
144
|
fileExtension: "permissionset-meta.xml",
|
|
145
145
|
postPurge: true,
|
|
146
146
|
});
|
|
@@ -204,7 +204,7 @@ if (debug) {
|
|
|
204
204
|
|
|
205
205
|
const disassembleHandler = new DisassembleXMLFileHandler();
|
|
206
206
|
await disassembleHandler.disassemble({
|
|
207
|
-
|
|
207
|
+
filePath: "test/baselines/general",
|
|
208
208
|
uniqueIdElements:
|
|
209
209
|
"application,apexClass,name,externalDataSource,flow,object,apexPage,recordType,tab,field",
|
|
210
210
|
prePurge: true,
|
|
@@ -213,7 +213,7 @@ await disassembleHandler.disassemble({
|
|
|
213
213
|
|
|
214
214
|
const reassembleHandler = new ReassembleXMLFileHandler();
|
|
215
215
|
await reassembleHandler.reassemble({
|
|
216
|
-
|
|
216
|
+
filePath: "test/baselines/general/HR_Admin",
|
|
217
217
|
fileExtension: "permissionset-meta.xml",
|
|
218
218
|
});
|
|
219
219
|
```
|
|
@@ -223,7 +223,3 @@ await reassembleHandler.reassemble({
|
|
|
223
223
|
This project was created from a template provided by [Allan Oricil](https://github.com/AllanOricil). Thank you Allan!
|
|
224
224
|
|
|
225
225
|
His original [license](https://github.com/AllanOricil/js-template/blob/main/LICENSE) remains in this project.
|
|
226
|
-
|
|
227
|
-
## Contributing
|
|
228
|
-
|
|
229
|
-
Any contributions you would like to make are appreciated. Please see [CONTRIBUTING](https://github.com/mcarvin8/xml-disassembler/blob/main/CONTRIBUTING.md).
|
package/disassemble.log
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
[2024-04-
|
|
2
|
-
[2024-04-
|
|
3
|
-
[2024-04-
|
|
4
|
-
[2024-04-
|
|
5
|
-
[2024-04-
|
|
6
|
-
[2024-04-
|
|
7
|
-
[2024-04-
|
|
8
|
-
[2024-04-
|
|
9
|
-
[2024-04-
|
|
10
|
-
[2024-04-
|
|
11
|
-
[2024-04-
|
|
12
|
-
[2024-04-
|
|
13
|
-
[2024-04-
|
|
14
|
-
[2024-04-
|
|
15
|
-
[2024-04-
|
|
16
|
-
[2024-04-
|
|
17
|
-
[2024-04-
|
|
18
|
-
[2024-04-
|
|
19
|
-
[2024-04-
|
|
20
|
-
[2024-04-
|
|
21
|
-
[2024-04-
|
|
22
|
-
[2024-04-
|
|
23
|
-
[2024-04-
|
|
24
|
-
[2024-04-
|
|
25
|
-
[2024-04-
|
|
26
|
-
[2024-04-
|
|
27
|
-
[2024-04-
|
|
28
|
-
[2024-04-
|
|
29
|
-
[2024-04-
|
|
30
|
-
[2024-04-
|
|
31
|
-
[2024-04-
|
|
32
|
-
[2024-04-
|
|
33
|
-
[2024-04-
|
|
34
|
-
[2024-04-
|
|
35
|
-
[2024-04-
|
|
36
|
-
[2024-04-
|
|
37
|
-
[2024-04-
|
|
38
|
-
[2024-04-
|
|
39
|
-
[2024-04-
|
|
40
|
-
[2024-04-
|
|
41
|
-
[2024-04-
|
|
42
|
-
[2024-04-
|
|
43
|
-
[2024-04-
|
|
44
|
-
[2024-04-
|
|
45
|
-
[2024-04-
|
|
46
|
-
[2024-04-
|
|
47
|
-
[2024-04-
|
|
48
|
-
[2024-04-
|
|
49
|
-
[2024-04-
|
|
50
|
-
[2024-04-
|
|
51
|
-
[2024-04-
|
|
52
|
-
[2024-04-
|
|
53
|
-
[2024-04-
|
|
54
|
-
[2024-04-
|
|
55
|
-
[2024-04-
|
|
56
|
-
[2024-04-
|
|
57
|
-
[2024-04-
|
|
58
|
-
[2024-04-
|
|
59
|
-
[2024-04-
|
|
60
|
-
[2024-04-
|
|
61
|
-
[2024-04-
|
|
62
|
-
[2024-04-
|
|
63
|
-
[2024-04-
|
|
64
|
-
[2024-04-
|
|
65
|
-
[2024-04-
|
|
66
|
-
[2024-04-
|
|
67
|
-
[2024-04-
|
|
68
|
-
[2024-04-
|
|
69
|
-
[2024-04-
|
|
70
|
-
[2024-04-
|
|
71
|
-
[2024-04-
|
|
72
|
-
[2024-04-
|
|
73
|
-
[2024-04-
|
|
74
|
-
[2024-04-
|
|
75
|
-
[2024-04-
|
|
76
|
-
[2024-04-
|
|
77
|
-
[2024-04-
|
|
78
|
-
[2024-04-
|
|
79
|
-
[2024-04-
|
|
80
|
-
[2024-04-
|
|
81
|
-
[2024-04-
|
|
82
|
-
[2024-04-
|
|
83
|
-
[2024-04-
|
|
84
|
-
[2024-04-
|
|
85
|
-
[2024-04-
|
|
86
|
-
[2024-04-
|
|
87
|
-
[2024-04-
|
|
88
|
-
[2024-04-
|
|
89
|
-
[2024-04-
|
|
90
|
-
[2024-04-
|
|
91
|
-
[2024-04-
|
|
92
|
-
[2024-04-
|
|
93
|
-
[2024-04-
|
|
1
|
+
[2024-04-24T12:45:09.261] [DEBUG] default - Parsing file to disassemble: mock/general/HR_Admin.permissionset-meta.xml
|
|
2
|
+
[2024-04-24T12:45:09.268] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/applicationVisibilities/JobApps__Recruiting.applicationVisibilities-meta.xml
|
|
3
|
+
[2024-04-24T12:45:09.269] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/classAccesses/Send_Email_Confirmation.classAccesses-meta.xml
|
|
4
|
+
[2024-04-24T12:45:09.269] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/fieldPermissions/Job_Request__c.Salary__c.fieldPermissions-meta.xml
|
|
5
|
+
[2024-04-24T12:45:09.270] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/objectPermissions/Job_Request__c.objectPermissions-meta.xml
|
|
6
|
+
[2024-04-24T12:45:09.271] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/pageAccesses/Job_Request_Web_Form.pageAccesses-meta.xml
|
|
7
|
+
[2024-04-24T12:45:09.271] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/recordTypeVisibilities/Recruiting.DevManager.recordTypeVisibilities-meta.xml
|
|
8
|
+
[2024-04-24T12:45:09.272] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/tabSettings/Job_Request__c.tabSettings-meta.xml
|
|
9
|
+
[2024-04-24T12:45:09.272] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/userPermissions/APIEnabled.userPermissions-meta.xml
|
|
10
|
+
[2024-04-24T12:45:09.273] [DEBUG] default - Created disassembled file: mock/general/HR_Admin/HR_Admin.permissionset-meta.xml
|
|
11
|
+
[2024-04-24T12:45:09.276] [DEBUG] default - Parsing directory to reassemble: mock/general/HR_Admin
|
|
12
|
+
[2024-04-24T12:45:09.290] [DEBUG] default - Created reassembled file: mock/general/HR_Admin.permissionset-meta.xml
|
|
13
|
+
[2024-04-24T12:45:09.291] [DEBUG] default - Parsing file to disassemble: mock/attributes/notes.xml
|
|
14
|
+
[2024-04-24T12:45:09.293] [DEBUG] default - Created disassembled file: mock/attributes/notes/nest/103c6c8b.nest-meta.xml
|
|
15
|
+
[2024-04-24T12:45:09.293] [DEBUG] default - Created disassembled file: mock/attributes/notes/nest/f876f2be.nest-meta.xml
|
|
16
|
+
[2024-04-24T12:45:09.294] [DEBUG] default - Parsing directory to reassemble: mock/attributes/notes
|
|
17
|
+
[2024-04-24T12:45:09.296] [DEBUG] default - Created reassembled file: mock/attributes/notes.xml
|
|
18
|
+
[2024-04-24T12:45:09.296] [DEBUG] default - Parsing file to disassemble: mock/cdata/VidLand_US.marketingappextension-meta.xml
|
|
19
|
+
[2024-04-24T12:45:09.298] [DEBUG] default - Created disassembled file: mock/cdata/VidLand_US/marketingAppExtActions/register_user.marketingAppExtActions-meta.xml
|
|
20
|
+
[2024-04-24T12:45:09.298] [DEBUG] default - Created disassembled file: mock/cdata/VidLand_US/VidLand_US.marketingappextension-meta.xml
|
|
21
|
+
[2024-04-24T12:45:09.299] [DEBUG] default - Parsing directory to reassemble: mock/cdata/VidLand_US
|
|
22
|
+
[2024-04-24T12:45:09.301] [DEBUG] default - Created reassembled file: mock/cdata/VidLand_US.xml
|
|
23
|
+
[2024-04-24T12:45:09.302] [DEBUG] default - Parsing file to disassemble: mock/comments/Numbers-fr.globalValueSetTranslation-meta.xml
|
|
24
|
+
[2024-04-24T12:45:09.303] [DEBUG] default - Created disassembled file: mock/comments/Numbers-fr/valueTranslation/30e8b6d2.valueTranslation-meta.xml
|
|
25
|
+
[2024-04-24T12:45:09.303] [DEBUG] default - Created disassembled file: mock/comments/Numbers-fr/valueTranslation/d7dd1420.valueTranslation-meta.xml
|
|
26
|
+
[2024-04-24T12:45:09.303] [DEBUG] default - Created disassembled file: mock/comments/Numbers-fr/valueTranslation/d8852ede.valueTranslation-meta.xml
|
|
27
|
+
[2024-04-24T12:45:09.304] [DEBUG] default - Parsing directory to reassemble: mock/comments/Numbers-fr
|
|
28
|
+
[2024-04-24T12:45:09.306] [DEBUG] default - Created reassembled file: mock/comments/Numbers-fr.globalValueSetTranslation-meta.xml
|
|
29
|
+
[2024-04-24T12:45:09.307] [DEBUG] default - Parsing file to disassemble: mock/deeply-nested-unique-id-element/Get_Info.flow-meta.xml
|
|
30
|
+
[2024-04-24T12:45:09.312] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/actionCalls/Get_Info.actionCalls-meta.xml
|
|
31
|
+
[2024-04-24T12:45:09.312] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/actionCalls/Post_to_Contact_s_Feed.actionCalls-meta.xml
|
|
32
|
+
[2024-04-24T12:45:09.313] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/assignments/Set_Contact_ID.assignments-meta.xml
|
|
33
|
+
[2024-04-24T12:45:09.313] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/decisions/Update_If_Existing.decisions-meta.xml
|
|
34
|
+
[2024-04-24T12:45:09.313] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/decisions/Update_or_Create.decisions-meta.xml
|
|
35
|
+
[2024-04-24T12:45:09.314] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/dynamicChoiceSets/accounts.dynamicChoiceSets-meta.xml
|
|
36
|
+
[2024-04-24T12:45:09.314] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/formulas/created_or_updated.formulas-meta.xml
|
|
37
|
+
[2024-04-24T12:45:09.315] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/processMetadataValues/BuilderType.processMetadataValues-meta.xml
|
|
38
|
+
[2024-04-24T12:45:09.315] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/processMetadataValues/CanvasMode.processMetadataValues-meta.xml
|
|
39
|
+
[2024-04-24T12:45:09.316] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/processMetadataValues/OriginBuilderType.processMetadataValues-meta.xml
|
|
40
|
+
[2024-04-24T12:45:09.316] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/recordCreates/Create_Contact.recordCreates-meta.xml
|
|
41
|
+
[2024-04-24T12:45:09.316] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/recordLookups/Find_a_Match.recordLookups-meta.xml
|
|
42
|
+
[2024-04-24T12:45:09.316] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/recordUpdates/Update_Contact.recordUpdates-meta.xml
|
|
43
|
+
[2024-04-24T12:45:09.317] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/screens/Confirm.screens-meta.xml
|
|
44
|
+
[2024-04-24T12:45:09.317] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/screens/Contact_Info.screens-meta.xml
|
|
45
|
+
[2024-04-24T12:45:09.317] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/start/Contact_Info.start-meta.xml
|
|
46
|
+
[2024-04-24T12:45:09.318] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/textTemplates/chatterMessage.textTemplates-meta.xml
|
|
47
|
+
[2024-04-24T12:45:09.318] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/variables/ComplexObjectExample.variables-meta.xml
|
|
48
|
+
[2024-04-24T12:45:09.318] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/variables/contact.variables-meta.xml
|
|
49
|
+
[2024-04-24T12:45:09.319] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/variables/existingId.variables-meta.xml
|
|
50
|
+
[2024-04-24T12:45:09.319] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/variables/updateExisting.variables-meta.xml
|
|
51
|
+
[2024-04-24T12:45:09.319] [DEBUG] default - Created disassembled file: mock/deeply-nested-unique-id-element/Get_Info/Get_Info.flow-meta.xml
|
|
52
|
+
[2024-04-24T12:45:09.320] [DEBUG] default - Parsing directory to reassemble: mock/deeply-nested-unique-id-element/Get_Info
|
|
53
|
+
[2024-04-24T12:45:09.338] [DEBUG] default - Created reassembled file: mock/deeply-nested-unique-id-element/Get_Info.flow-meta.xml
|
|
54
|
+
[2024-04-24T12:45:09.340] [DEBUG] default - Parsing file to disassemble: mock/array-of-leafs/Dreamhouse.app-meta.xml
|
|
55
|
+
[2024-04-24T12:45:09.342] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/39049d21.actionOverrides-meta.xml
|
|
56
|
+
[2024-04-24T12:45:09.342] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/735c1659.actionOverrides-meta.xml
|
|
57
|
+
[2024-04-24T12:45:09.343] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/b04e9f9b.actionOverrides-meta.xml
|
|
58
|
+
[2024-04-24T12:45:09.343] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/c8cc7a99.actionOverrides-meta.xml
|
|
59
|
+
[2024-04-24T12:45:09.343] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/brand/c9db422b.brand-meta.xml
|
|
60
|
+
[2024-04-24T12:45:09.344] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/Dreamhouse.app-meta.xml
|
|
61
|
+
[2024-04-24T12:45:09.345] [DEBUG] default - Parsing directory to reassemble: mock/array-of-leafs/Dreamhouse
|
|
62
|
+
[2024-04-24T12:45:09.349] [DEBUG] default - Created reassembled file: mock/array-of-leafs/Dreamhouse.app-meta.xml
|
|
63
|
+
[2024-04-24T12:45:09.353] [DEBUG] default - Parsing file to disassemble: mock/array-of-leafs/Dreamhouse.app-meta.xml
|
|
64
|
+
[2024-04-24T12:45:09.356] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/39049d21.actionOverrides-meta.xml
|
|
65
|
+
[2024-04-24T12:45:09.356] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/735c1659.actionOverrides-meta.xml
|
|
66
|
+
[2024-04-24T12:45:09.356] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/b04e9f9b.actionOverrides-meta.xml
|
|
67
|
+
[2024-04-24T12:45:09.357] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/actionOverrides/c8cc7a99.actionOverrides-meta.xml
|
|
68
|
+
[2024-04-24T12:45:09.357] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/brand/c9db422b.brand-meta.xml
|
|
69
|
+
[2024-04-24T12:45:09.357] [DEBUG] default - Created disassembled file: mock/array-of-leafs/Dreamhouse/Dreamhouse.app-meta.xml
|
|
70
|
+
[2024-04-24T12:45:09.358] [DEBUG] default - Parsing directory to reassemble: mock/array-of-leafs/Dreamhouse
|
|
71
|
+
[2024-04-24T12:45:09.360] [DEBUG] default - Created reassembled file: mock/array-of-leafs/Dreamhouse.app-meta.xml
|
|
72
|
+
[2024-04-24T12:45:09.362] [DEBUG] default - Parsing file to disassemble: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin.permissionset-meta.xml
|
|
73
|
+
[2024-04-24T12:45:09.363] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/applicationVisibilities/JobApps__Recruiting.applicationVisibilities-meta.xml
|
|
74
|
+
[2024-04-24T12:45:09.363] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/classAccesses/Send_Email_Confirmation.classAccesses-meta.xml
|
|
75
|
+
[2024-04-24T12:45:09.363] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/fieldPermissions/Job_Request__c.Salary__c.fieldPermissions-meta.xml
|
|
76
|
+
[2024-04-24T12:45:09.364] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/objectPermissions/Job_Request__c.objectPermissions-meta.xml
|
|
77
|
+
[2024-04-24T12:45:09.364] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/pageAccesses/Job_Request_Web_Form.pageAccesses-meta.xml
|
|
78
|
+
[2024-04-24T12:45:09.364] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/recordTypeVisibilities/Recruiting.DevManager.recordTypeVisibilities-meta.xml
|
|
79
|
+
[2024-04-24T12:45:09.365] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/tabSettings/Job_Request__c.tabSettings-meta.xml
|
|
80
|
+
[2024-04-24T12:45:09.365] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/userPermissions/APIEnabled.userPermissions-meta.xml
|
|
81
|
+
[2024-04-24T12:45:09.365] [DEBUG] default - Created disassembled file: /home/runner/work/xml-disassembler/xml-disassembler/mock/no-namespace/HR_Admin/HR_Admin.permissionset-meta.xml
|
|
82
|
+
[2024-04-24T12:45:09.366] [DEBUG] default - Parsing directory to reassemble: mock/no-namespace/HR_Admin
|
|
83
|
+
[2024-04-24T12:45:09.370] [DEBUG] default - Created reassembled file: mock/no-namespace/HR_Admin.permissionset-meta.xml
|
|
84
|
+
[2024-04-24T12:45:09.371] [ERROR] default - The file path provided is not an XML file: /home/runner/work/xml-disassembler/xml-disassembler/mock/not-an-xml.txt
|
|
85
|
+
[2024-04-24T12:45:09.371] [ERROR] default - The provided path to reassemble is not a directory: mock/no-namespace/HR_Admin/HR_Admin.permissionset-meta.xml
|
|
86
|
+
[2024-04-24T12:45:09.372] [DEBUG] default - Parsing file to disassemble: mock/no-root-element/Assessment_Bot.bot-meta.xml
|
|
87
|
+
[2024-04-24T12:45:09.372] [ERROR] default - mock/no-root-element/Assessment_Bot.bot-meta.xml was unabled to be parsed and will not be processed. Confirm formatting and try again.
|
|
88
|
+
[2024-04-24T12:45:09.373] [DEBUG] default - Parsing directory to reassemble: mock/no-root-element/Assessment_Bot
|
|
89
|
+
[2024-04-24T12:45:09.373] [ERROR] default - mock/no-root-element/Assessment_Bot/Assessment_Bot.bot-meta.xml was unabled to be parsed and will not be processed. Confirm formatting and try again.
|
|
90
|
+
[2024-04-24T12:45:09.374] [ERROR] default - mock/no-root-element/Assessment_Bot/botMlDomain/419e0199.botMlDomain-meta.xml was unabled to be parsed and will not be processed. Confirm formatting and try again.
|
|
91
|
+
[2024-04-24T12:45:09.374] [ERROR] default - No files under mock/no-root-element/Assessment_Bot were parsed successfully. A reassembled XML file was not created.
|
|
92
|
+
[2024-04-24T12:45:09.375] [DEBUG] default - Parsing file to disassemble: mock/no-nested-elements/HR_Admin.xml
|
|
93
|
+
[2024-04-24T12:45:09.375] [ERROR] default - The XML file mock/no-nested-elements/HR_Admin.xml only has leaf elements. This file will not be disassembled.
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
42
42
|
const XML_HEADER = '<?xml version="1.0" encoding="UTF-8"?>';
|
|
43
43
|
const INDENT = " ";
|
|
44
44
|
|
|
45
|
-
function buildReassembledFile(combinedXmlContents,
|
|
45
|
+
function buildReassembledFile(combinedXmlContents, reassembledPath, xmlElement, xmlRootElementHeader) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
47
|
let finalXmlContent = combinedXmlContents.join("\n");
|
|
48
48
|
finalXmlContent = finalXmlContent.replace(/<\?xml version="1.0" encoding="UTF-8"\?>/g, "");
|
|
@@ -58,8 +58,8 @@ function buildReassembledFile(combinedXmlContents, filePath, xmlElement, xmlRoot
|
|
|
58
58
|
});
|
|
59
59
|
finalXmlContent = finalXmlContent.replace(/(\n\s*){2,}/g, `\n${INDENT}`);
|
|
60
60
|
const closeTag = `</${xmlElement}>`;
|
|
61
|
-
yield promises.writeFile(
|
|
62
|
-
logger.debug(`Created reassembled file: ${
|
|
61
|
+
yield promises.writeFile(reassembledPath, `${XML_HEADER}\n${xmlRootElementHeader}${finalXmlContent}${closeTag}`);
|
|
62
|
+
logger.debug(`Created reassembled file: ${reassembledPath}`);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -158,30 +158,30 @@ class ReassembleXMLFileHandler {
|
|
|
158
158
|
}
|
|
159
159
|
reassemble(xmlAttributes) {
|
|
160
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const {
|
|
161
|
+
const { filePath, fileExtension, postPurge = false } = xmlAttributes;
|
|
162
162
|
let combinedXmlContents = [];
|
|
163
|
-
const fileStat = yield promises.stat(
|
|
163
|
+
const fileStat = yield promises.stat(filePath);
|
|
164
164
|
if (!fileStat.isDirectory()) {
|
|
165
|
-
logger.error(`The provided
|
|
165
|
+
logger.error(`The provided path to reassemble is not a directory: ${filePath}`);
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
logger.debug(`Parsing directory to reassemble: ${
|
|
169
|
-
const [subCombinedXmlContents, rootResult] = yield this.processFilesInDirectory(
|
|
168
|
+
logger.debug(`Parsing directory to reassemble: ${filePath}`);
|
|
169
|
+
const [subCombinedXmlContents, rootResult] = yield this.processFilesInDirectory(filePath);
|
|
170
170
|
combinedXmlContents = subCombinedXmlContents;
|
|
171
|
-
const parentDirectory = node_path.dirname(
|
|
172
|
-
const subdirectoryBasename = node_path.basename(
|
|
171
|
+
const parentDirectory = node_path.dirname(filePath);
|
|
172
|
+
const subdirectoryBasename = node_path.basename(filePath);
|
|
173
173
|
const fileName = fileExtension
|
|
174
174
|
? `${subdirectoryBasename}.${fileExtension}`
|
|
175
175
|
: `${subdirectoryBasename}.xml`;
|
|
176
|
-
const
|
|
176
|
+
const outputPath = node_path.join(parentDirectory, fileName);
|
|
177
177
|
if (rootResult !== undefined) {
|
|
178
178
|
const [rootElementName, rootElementHeader] = rootResult;
|
|
179
|
-
yield buildReassembledFile(combinedXmlContents,
|
|
179
|
+
yield buildReassembledFile(combinedXmlContents, outputPath, rootElementName, rootElementHeader);
|
|
180
180
|
if (postPurge)
|
|
181
|
-
yield promises.rm(
|
|
181
|
+
yield promises.rm(filePath, { recursive: true });
|
|
182
182
|
}
|
|
183
183
|
else {
|
|
184
|
-
logger.error(`No files under ${
|
|
184
|
+
logger.error(`No files under ${filePath} were parsed successfully. A reassembled XML file was not created.`);
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
187
|
}
|
|
@@ -216,11 +216,11 @@ function getShortHash(element) {
|
|
|
216
216
|
return fullHash.slice(0, 8);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
function buildNestedFile(element,
|
|
219
|
+
function buildNestedFile(element, disassembledPath, uniqueIdElements, rootElementName, rootElementHeader, parentKey, indent) {
|
|
220
220
|
return __awaiter(this, void 0, void 0, function* () {
|
|
221
221
|
let elementContent = "";
|
|
222
222
|
const fieldName = findUniqueIdElement(element, uniqueIdElements);
|
|
223
|
-
const outputDirectory = node_path.join(
|
|
223
|
+
const outputDirectory = node_path.join(disassembledPath, parentKey);
|
|
224
224
|
const outputFileName = `${fieldName}.${parentKey}-meta.xml`;
|
|
225
225
|
const outputPath = node_path.join(outputDirectory, outputFileName);
|
|
226
226
|
yield promises.mkdir(outputDirectory, { recursive: true });
|
|
@@ -239,39 +239,33 @@ function buildNestedFile(element, metadataPath, uniqueIdElements, rootElementNam
|
|
|
239
239
|
|
|
240
240
|
function processElement(params) {
|
|
241
241
|
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
-
const { element,
|
|
242
|
+
const { element, disassembledPath, uniqueIdElements, rootElementName, rootElementHeader, key, indent, leafContent, leafCount, hasNestedElements, } = params;
|
|
243
243
|
if (typeof element === "object") {
|
|
244
|
-
yield buildNestedFile(element,
|
|
244
|
+
yield buildNestedFile(element, disassembledPath, uniqueIdElements, rootElementName, rootElementHeader, key, indent);
|
|
245
245
|
return [leafContent, leafCount, true];
|
|
246
246
|
}
|
|
247
247
|
else {
|
|
248
|
-
const
|
|
249
|
-
const updatedLeafContent = `${leafContent}${indent}<${key}>${String(fieldValue)}</${key}>\n`;
|
|
248
|
+
const updatedLeafContent = `${leafContent}${indent}<${key}>${String(element)}</${key}>\n`;
|
|
250
249
|
return [updatedLeafContent, leafCount + 1, hasNestedElements];
|
|
251
250
|
}
|
|
252
251
|
});
|
|
253
252
|
}
|
|
254
253
|
|
|
255
|
-
function buildLeafFile(leafContent,
|
|
254
|
+
function buildLeafFile(leafContent, disassembledPath, baseName, rootElementName, rootElementHeader) {
|
|
256
255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
257
256
|
let leafFile = `${XML_HEADER}\n`;
|
|
258
257
|
leafFile += `${rootElementHeader}\n`;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
.sort((a, b) => a.localeCompare(b))
|
|
263
|
-
.join("\n");
|
|
264
|
-
leafFile += sortedLeafContent;
|
|
265
|
-
leafFile += `\n</${rootElementName}>`;
|
|
266
|
-
const leafOutputPath = node_path.join(metadataPath, `${baseName}.xml`);
|
|
258
|
+
leafFile += leafContent;
|
|
259
|
+
leafFile += `</${rootElementName}>`;
|
|
260
|
+
const leafOutputPath = node_path.join(disassembledPath, `${baseName}.xml`);
|
|
267
261
|
yield promises.writeFile(leafOutputPath, leafFile);
|
|
268
262
|
logger.debug(`Created disassembled file: ${leafOutputPath}`);
|
|
269
263
|
});
|
|
270
264
|
}
|
|
271
265
|
|
|
272
|
-
function buildDisassembledFiles(
|
|
266
|
+
function buildDisassembledFiles(filePath, disassembledPath, uniqueIdElements, baseName, indent, postPurge) {
|
|
273
267
|
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
const parsedXml = yield parseXML(
|
|
268
|
+
const parsedXml = yield parseXML(filePath);
|
|
275
269
|
if (parsedXml === undefined)
|
|
276
270
|
return;
|
|
277
271
|
const rootElementName = Object.keys(parsedXml)[1];
|
|
@@ -285,7 +279,7 @@ function buildDisassembledFiles(xmlPath, metadataPath, uniqueIdElements, baseNam
|
|
|
285
279
|
for (const element of rootElement[key]) {
|
|
286
280
|
const [updatedLeafContent, updatedLeafCount, updatedHasNestedElements] = yield processElement({
|
|
287
281
|
element,
|
|
288
|
-
|
|
282
|
+
disassembledPath,
|
|
289
283
|
uniqueIdElements,
|
|
290
284
|
rootElementName,
|
|
291
285
|
rootElementHeader,
|
|
@@ -303,7 +297,7 @@ function buildDisassembledFiles(xmlPath, metadataPath, uniqueIdElements, baseNam
|
|
|
303
297
|
else {
|
|
304
298
|
const [updatedLeafContent, updatedLeafCount, updatedHasNestedElements] = yield processElement({
|
|
305
299
|
element: rootElement[key],
|
|
306
|
-
|
|
300
|
+
disassembledPath,
|
|
307
301
|
uniqueIdElements,
|
|
308
302
|
rootElementName,
|
|
309
303
|
rootElementHeader,
|
|
@@ -319,14 +313,14 @@ function buildDisassembledFiles(xmlPath, metadataPath, uniqueIdElements, baseNam
|
|
|
319
313
|
}
|
|
320
314
|
}
|
|
321
315
|
if (!hasNestedElements) {
|
|
322
|
-
logger.error(`The XML file ${
|
|
316
|
+
logger.error(`The XML file ${filePath} only has leaf elements. This file will not be disassembled.`);
|
|
323
317
|
return;
|
|
324
318
|
}
|
|
325
319
|
if (leafCount > 0) {
|
|
326
|
-
yield buildLeafFile(leafContent,
|
|
320
|
+
yield buildLeafFile(leafContent, disassembledPath, baseName, rootElementName, rootElementHeader);
|
|
327
321
|
}
|
|
328
322
|
if (postPurge) {
|
|
329
|
-
promises.unlink(
|
|
323
|
+
promises.unlink(filePath);
|
|
330
324
|
}
|
|
331
325
|
});
|
|
332
326
|
}
|
|
@@ -334,31 +328,31 @@ function buildDisassembledFiles(xmlPath, metadataPath, uniqueIdElements, baseNam
|
|
|
334
328
|
class DisassembleXMLFileHandler {
|
|
335
329
|
disassemble(xmlAttributes) {
|
|
336
330
|
return __awaiter(this, void 0, void 0, function* () {
|
|
337
|
-
const {
|
|
338
|
-
const fileStat = yield promises.stat(
|
|
331
|
+
const { filePath, uniqueIdElements, prePurge = false, postPurge = false, } = xmlAttributes;
|
|
332
|
+
const fileStat = yield promises.stat(filePath);
|
|
339
333
|
if (fileStat.isFile()) {
|
|
340
|
-
const
|
|
341
|
-
if (!
|
|
342
|
-
logger.error(`The file path
|
|
334
|
+
const resolvedPath = node_path.resolve(filePath);
|
|
335
|
+
if (!resolvedPath.endsWith(".xml")) {
|
|
336
|
+
logger.error(`The file path provided is not an XML file: ${resolvedPath}`);
|
|
343
337
|
return;
|
|
344
338
|
}
|
|
345
|
-
const
|
|
339
|
+
const dirPath = node_path.dirname(resolvedPath);
|
|
346
340
|
yield this.processFile({
|
|
347
|
-
|
|
348
|
-
filePath,
|
|
341
|
+
dirPath,
|
|
342
|
+
filePath: resolvedPath,
|
|
349
343
|
uniqueIdElements,
|
|
350
344
|
prePurge,
|
|
351
345
|
postPurge,
|
|
352
346
|
});
|
|
353
347
|
}
|
|
354
348
|
else if (fileStat.isDirectory()) {
|
|
355
|
-
const
|
|
356
|
-
for (const
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
349
|
+
const subFiles = yield promises.readdir(filePath);
|
|
350
|
+
for (const subFile of subFiles) {
|
|
351
|
+
const subFilePath = node_path.join(filePath, subFile);
|
|
352
|
+
if (subFilePath.endsWith(".xml")) {
|
|
359
353
|
yield this.processFile({
|
|
360
|
-
|
|
361
|
-
filePath,
|
|
354
|
+
dirPath: filePath,
|
|
355
|
+
filePath: subFilePath,
|
|
362
356
|
uniqueIdElements,
|
|
363
357
|
prePurge,
|
|
364
358
|
postPurge,
|
|
@@ -370,12 +364,12 @@ class DisassembleXMLFileHandler {
|
|
|
370
364
|
}
|
|
371
365
|
processFile(xmlAttributes) {
|
|
372
366
|
return __awaiter(this, void 0, void 0, function* () {
|
|
373
|
-
const {
|
|
367
|
+
const { dirPath, filePath, uniqueIdElements, prePurge, postPurge } = xmlAttributes;
|
|
374
368
|
logger.debug(`Parsing file to disassemble: ${filePath}`);
|
|
375
369
|
const fullName = node_path.basename(filePath, node_path.extname(filePath));
|
|
376
370
|
const baseName = fullName.split(".")[0];
|
|
377
371
|
let outputPath;
|
|
378
|
-
outputPath = node_path.join(
|
|
372
|
+
outputPath = node_path.join(dirPath, baseName);
|
|
379
373
|
if (prePurge && node_fs.existsSync(outputPath))
|
|
380
374
|
yield promises.rm(outputPath, { recursive: true });
|
|
381
375
|
yield buildDisassembledFiles(filePath, outputPath, uniqueIdElements, fullName, INDENT, postPurge);
|