sfdx-easy-sources 0.8.3 → 0.9.1-develop.1
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/lib/commands/easysources/allmeta/minify.d.ts +1 -0
- package/lib/commands/easysources/allmeta/minify.js +17 -2
- package/lib/commands/easysources/allmeta/minify.js.map +1 -1
- package/lib/commands/easysources/objecttranslations/merge.d.ts +1 -3
- package/lib/commands/easysources/objecttranslations/merge.js +46 -17
- package/lib/commands/easysources/objecttranslations/merge.js.map +1 -1
- package/lib/commands/easysources/objecttranslations/minify.d.ts +1 -3
- package/lib/commands/easysources/objecttranslations/minify.js +52 -32
- package/lib/commands/easysources/objecttranslations/minify.js.map +1 -1
- package/lib/commands/easysources/objecttranslations/split.js +79 -55
- package/lib/commands/easysources/objecttranslations/split.js.map +1 -1
- package/lib/commands/easysources/objecttranslations/upsert.d.ts +1 -3
- package/lib/commands/easysources/objecttranslations/upsert.js +109 -75
- package/lib/commands/easysources/objecttranslations/upsert.js.map +1 -1
- package/lib/commands/easysources/permissionsets/clean.js +4 -5
- package/lib/commands/easysources/permissionsets/clean.js.map +1 -1
- package/lib/commands/easysources/permissionsets/delete.js +4 -5
- package/lib/commands/easysources/permissionsets/delete.js.map +1 -1
- package/lib/commands/easysources/permissionsets/minify.js +52 -32
- package/lib/commands/easysources/permissionsets/minify.js.map +1 -1
- package/lib/commands/easysources/profiles/clean.js +4 -5
- package/lib/commands/easysources/profiles/clean.js.map +1 -1
- package/lib/commands/easysources/profiles/delete.js +4 -5
- package/lib/commands/easysources/profiles/delete.js.map +1 -1
- package/lib/commands/easysources/profiles/minify.js +52 -32
- package/lib/commands/easysources/profiles/minify.js.map +1 -1
- package/lib/commands/easysources/profiles/split.js +1 -1
- package/lib/commands/easysources/recordtypes/clean.js +5 -5
- package/lib/commands/easysources/recordtypes/clean.js.map +1 -1
- package/lib/commands/easysources/recordtypes/delete.js +5 -5
- package/lib/commands/easysources/recordtypes/delete.js.map +1 -1
- package/lib/commands/easysources/recordtypes/merge.js +24 -9
- package/lib/commands/easysources/recordtypes/merge.js.map +1 -1
- package/lib/commands/easysources/recordtypes/split.js +58 -40
- package/lib/commands/easysources/recordtypes/split.js.map +1 -1
- package/lib/commands/easysources/recordtypes/updatekey.js +38 -22
- package/lib/commands/easysources/recordtypes/updatekey.js.map +1 -1
- package/lib/commands/easysources/recordtypes/upsert.js +90 -64
- package/lib/commands/easysources/recordtypes/upsert.js.map +1 -1
- package/lib/commands/easysources/translations/minify.js +53 -31
- package/lib/commands/easysources/translations/minify.js.map +1 -1
- package/lib/utils/commands/keyupdater.d.ts +5 -1
- package/lib/utils/commands/keyupdater.js +37 -23
- package/lib/utils/commands/keyupdater.js.map +1 -1
- package/lib/utils/commands/merger.d.ts +4 -0
- package/lib/utils/commands/merger.js +11 -5
- package/lib/utils/commands/merger.js.map +1 -1
- package/lib/utils/commands/splitter.d.ts +5 -1
- package/lib/utils/commands/splitter.js +62 -48
- package/lib/utils/commands/splitter.js.map +1 -1
- package/lib/utils/commands/upserter.d.ts +3 -3
- package/lib/utils/commands/upserter.js +128 -102
- package/lib/utils/commands/upserter.js.map +1 -1
- package/lib/utils/commands/utils.d.ts +11 -0
- package/lib/utils/commands/utils.js +35 -1
- package/lib/utils/commands/utils.js.map +1 -1
- package/lib/utils/constants/constants_applications.d.ts +2 -8
- package/lib/utils/constants/constants_globalvaluesets.d.ts +2 -8
- package/lib/utils/constants/constants_globalvaluesettranslations.d.ts +2 -8
- package/lib/utils/constants/constants_labels.d.ts +2 -8
- package/lib/utils/constants/constants_objecttranslations.d.ts +14 -56
- package/lib/utils/constants/constants_permissionsets.d.ts +2 -8
- package/lib/utils/constants/constants_profiles.d.ts +4 -16
- package/lib/utils/constants/constants_translations.d.ts +12 -48
- package/lib/utils/csvWriter.d.ts +9 -0
- package/lib/utils/csvWriter.js +53 -0
- package/lib/utils/csvWriter.js.map +1 -0
- package/lib/utils/utils.d.ts +1 -4
- package/lib/utils/utils.js +8 -1
- package/lib/utils/utils.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +3 -2
|
@@ -11,8 +11,6 @@ const os = require("os");
|
|
|
11
11
|
const command_1 = require("@salesforce/command");
|
|
12
12
|
const core_1 = require("@salesforce/core");
|
|
13
13
|
const filesUtils_1 = require("../../../utils/filesUtils");
|
|
14
|
-
// import { generateTagId } from '../../../utils/utils'
|
|
15
|
-
const { Parser } = require('json2csv');
|
|
16
14
|
const constants_recordtypes_1 = require("../../../utils/constants/constants_recordtypes");
|
|
17
15
|
const performance_1 = require("../../../utils/performance");
|
|
18
16
|
const path_1 = require("path");
|
|
@@ -20,6 +18,9 @@ const utils_1 = require("../../../utils/utils");
|
|
|
20
18
|
const constants_1 = require("../../../utils/constants/constants");
|
|
21
19
|
const utils_recordtypes_1 = require("../../../utils/utils_recordtypes");
|
|
22
20
|
const localSettings_1 = require("../../../utils/localSettings");
|
|
21
|
+
const utils_2 = require("../../../utils/commands/utils");
|
|
22
|
+
const csvWriter_1 = require("../../../utils/csvWriter");
|
|
23
|
+
const utils_3 = require("../../../utils/commands/utils");
|
|
23
24
|
const fs = require('fs-extra');
|
|
24
25
|
const settings = (0, localSettings_1.loadSettings)();
|
|
25
26
|
// Initialize Messages with the current plugin directory
|
|
@@ -65,13 +66,15 @@ Split.flagsConfig = {
|
|
|
65
66
|
};
|
|
66
67
|
// Export function for programmatic API
|
|
67
68
|
async function recordTypeSplit(options = {}) {
|
|
69
|
+
const csvWriter = new csvWriter_1.default();
|
|
68
70
|
const baseInputDir = (0, path_1.join)((options["sf-xml"] || settings['salesforce-xml-path'] || constants_1.DEFAULT_SFXML_PATH), constants_recordtypes_1.RECORDTYPES_SUBPATH);
|
|
69
71
|
const baseOutputDir = (0, path_1.join)((options["es-csv"] || settings['easysources-csv-path'] || constants_1.DEFAULT_ESCSV_PATH), constants_recordtypes_1.RECORDTYPES_SUBPATH);
|
|
70
72
|
const inputObject = (options.object);
|
|
71
73
|
const inputRecordType = (options.recordtype);
|
|
74
|
+
// Initialize result object
|
|
75
|
+
const result = { result: 'OK', items: {} };
|
|
72
76
|
if (!fs.existsSync(baseInputDir)) {
|
|
73
|
-
|
|
74
|
-
return;
|
|
77
|
+
return (0, utils_2.jsonAndPrintError)('Input folder ' + baseInputDir + ' does not exist!');
|
|
75
78
|
}
|
|
76
79
|
var objectList = [];
|
|
77
80
|
if (inputObject) {
|
|
@@ -96,50 +99,65 @@ async function recordTypeSplit(options = {}) {
|
|
|
96
99
|
}
|
|
97
100
|
for (const filename of recordTypeList) {
|
|
98
101
|
const fullFilename = filename.endsWith(constants_recordtypes_1.RECORDTYPES_EXTENSION) ? filename : filename + constants_recordtypes_1.RECORDTYPES_EXTENSION;
|
|
99
|
-
console.log('Splitting: ' + (0, path_1.join)(obj, fullFilename));
|
|
100
|
-
const inputFile = (0, path_1.join)(baseInputDir, obj, 'recordTypes', fullFilename);
|
|
101
|
-
const xmlFileContent = (await (0, filesUtils_1.readXmlFromFile)(inputFile)) ?? {};
|
|
102
|
-
const recordtypeProperties = xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] ?? {};
|
|
103
102
|
const recordTypeName = (0, filesUtils_1.removeExtension)(fullFilename);
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
myjson = [myjson];
|
|
115
|
-
var jsforcsv = (0, utils_recordtypes_1.transformXMLtoCSV)(myjson);
|
|
116
|
-
// generate _tagId column
|
|
117
|
-
(0, utils_1.generateTagId)(jsforcsv, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].key, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers);
|
|
118
|
-
if (options.sort === 'true') {
|
|
119
|
-
jsforcsv = (0, utils_1.sortByKey)(jsforcsv);
|
|
120
|
-
}
|
|
121
|
-
const headers = constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers;
|
|
122
|
-
const parser = new Parser({ fields: [...headers, '_tagid'] });
|
|
123
|
-
const csv = parser.parse(jsforcsv);
|
|
124
|
-
const outputFileCSV = (0, path_1.join)(outputDir, (0, filesUtils_1.calcCsvFilename)(recordTypeName, tag_section));
|
|
125
|
-
if (!fs.existsSync(outputDir)) {
|
|
126
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
103
|
+
const fileKey = `${obj}/${recordTypeName}`;
|
|
104
|
+
console.log('Splitting: ' + (0, path_1.join)(obj, fullFilename));
|
|
105
|
+
try {
|
|
106
|
+
const inputFile = (0, path_1.join)(baseInputDir, obj, 'recordTypes', fullFilename);
|
|
107
|
+
const xmlFileContent = (await (0, filesUtils_1.readXmlFromFile)(inputFile)) ?? {};
|
|
108
|
+
const recordtypeProperties = xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] ?? {};
|
|
109
|
+
const outputDir = (0, path_1.join)(baseOutputDir, obj, 'recordTypes', recordTypeName);
|
|
110
|
+
// Delete outputDir if it exists to ensure a clean split
|
|
111
|
+
if (fs.existsSync(outputDir)) {
|
|
112
|
+
fs.removeSync(outputDir);
|
|
127
113
|
}
|
|
128
|
-
|
|
129
|
-
|
|
114
|
+
for (const tag_section in constants_recordtypes_1.RECORDTYPE_ITEMS) {
|
|
115
|
+
var myjson = recordtypeProperties[constants_recordtypes_1.RECORDTYPES_PICKVAL_ROOT];
|
|
116
|
+
if (myjson == undefined)
|
|
117
|
+
continue;
|
|
118
|
+
if (!Array.isArray(myjson))
|
|
119
|
+
myjson = [myjson];
|
|
120
|
+
var jsforcsv = (0, utils_recordtypes_1.transformXMLtoCSV)(myjson);
|
|
121
|
+
// generate _tagId column
|
|
122
|
+
(0, utils_1.generateTagId)(jsforcsv, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].key, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers);
|
|
123
|
+
if (options.sort === 'true') {
|
|
124
|
+
jsforcsv = (0, utils_1.sortByKey)(jsforcsv);
|
|
125
|
+
}
|
|
126
|
+
const headers = constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers;
|
|
127
|
+
const outputFileCSV = (0, path_1.join)(outputDir, (0, filesUtils_1.calcCsvFilename)(recordTypeName, tag_section));
|
|
128
|
+
if (!fs.existsSync(outputDir)) {
|
|
129
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const csvContent = await csvWriter.toCsv(jsforcsv, headers);
|
|
133
|
+
fs.writeFileSync(outputFileCSV, csvContent, { flag: 'w+' });
|
|
134
|
+
// file written successfully
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.error(err);
|
|
138
|
+
throw new Error(`Failed to write CSV file ${outputFileCSV}: ${err.message}`);
|
|
139
|
+
}
|
|
140
|
+
xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG][tag_section] = null;
|
|
130
141
|
}
|
|
131
|
-
|
|
132
|
-
|
|
142
|
+
if (fs.existsSync(outputDir)) {
|
|
143
|
+
const outputFileXML = (0, path_1.join)(outputDir, recordTypeName + constants_1.XML_PART_EXTENSION);
|
|
144
|
+
xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] = (0, utils_3.sortObjectKeys)(xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG]);
|
|
145
|
+
(0, filesUtils_1.writeXmlToFile)(outputFileXML, xmlFileContent);
|
|
133
146
|
}
|
|
134
|
-
|
|
147
|
+
// File processed successfully
|
|
148
|
+
result.items[fileKey] = { result: 'OK' };
|
|
135
149
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
150
|
+
catch (error) {
|
|
151
|
+
// File processing failed
|
|
152
|
+
console.error(`Error processing file ${fullFilename}:`, error);
|
|
153
|
+
result.items[fileKey] = {
|
|
154
|
+
result: 'KO',
|
|
155
|
+
error: error.message || 'Unknown error occurred'
|
|
156
|
+
};
|
|
139
157
|
}
|
|
140
158
|
}
|
|
141
159
|
}
|
|
142
|
-
return
|
|
160
|
+
return result;
|
|
143
161
|
}
|
|
144
162
|
exports.recordTypeSplit = recordTypeSplit;
|
|
145
163
|
//# sourceMappingURL=split.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../../src/commands/easysources/recordtypes/split.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,0DAA6G;AAC7G,
|
|
1
|
+
{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../../src/commands/easysources/recordtypes/split.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,0DAA6G;AAC7G,0FAA8K;AAC9K,4DAAqD;AACrD,+BAA4B;AAC5B,gDAAgE;AAChE,kEAAgH;AAChH,wEAAqE;AACrE,gEAA4D;AAC5D,yDAAkE;AAClE,wDAAiD;AACjD,yDAA+D;AAC/D,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE/B,MAAM,QAAQ,GAAG,IAAA,4BAAY,GAAE,CAAC;AAEhC,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;AAEjF,MAAqB,KAAM,SAAQ,qBAAW;IAgCnC,KAAK,CAAC,GAAG;QACZ,qBAAW,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEjD,qBAAW,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QAEhC,OAAO,MAA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AO,GAAG,EAAE;wBACV,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;wBACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,aAAa,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;qBAChF;oBAED,cAAc,CAAC,4CAAoB,CAAC,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;iBAC5D;gBAED,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;oBAC1B,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,cAAc,GAAG,8BAAkB,CAAC,CAAC;oBAC3E,cAAc,CAAC,4CAAoB,CAAC,GAAG,IAAA,sBAAc,EAAC,cAAc,CAAC,4CAAoB,CAAC,CAAC,CAAC;oBAC5F,IAAA,2BAAc,EAAC,aAAa,EAAE,cAAc,CAAC,CAAC;iBACjD;gBAED,8BAA8B;gBAC9B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;aAE5C;YAAC,OAAO,KAAK,EAAE;gBACZ,yBAAyB;gBACzB,OAAO,CAAC,KAAK,CAAC,yBAAyB,YAAY,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC/D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG;oBACpB,MAAM,EAAE,IAAI;oBACZ,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,wBAAwB;iBACnD,CAAC;aACL;SACJ;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA/GD,0CA+GC"}
|
|
@@ -12,12 +12,13 @@ const command_1 = require("@salesforce/command");
|
|
|
12
12
|
const core_1 = require("@salesforce/core");
|
|
13
13
|
const filesUtils_1 = require("../../../utils/filesUtils");
|
|
14
14
|
const utils_1 = require("../../../utils/utils");
|
|
15
|
-
const { Parser, transforms: { unwind } } = require('json2csv');
|
|
16
15
|
const constants_1 = require("../../../utils/constants/constants");
|
|
17
16
|
const performance_1 = require("../../../utils/performance");
|
|
18
17
|
const path_1 = require("path");
|
|
19
18
|
const constants_recordtypes_1 = require("../../../utils/constants/constants_recordtypes");
|
|
20
19
|
const localSettings_1 = require("../../../utils/localSettings");
|
|
20
|
+
const utils_2 = require("../../../utils/commands/utils");
|
|
21
|
+
const csvWriter_1 = require("../../../utils/csvWriter");
|
|
21
22
|
const fs = require('fs-extra');
|
|
22
23
|
const settings = (0, localSettings_1.loadSettings)();
|
|
23
24
|
// Initialize Messages with the current plugin directory
|
|
@@ -59,12 +60,14 @@ UpdateKey.flagsConfig = {
|
|
|
59
60
|
};
|
|
60
61
|
// Export function for API usage
|
|
61
62
|
async function recordTypeUpdateKey(options = {}) {
|
|
63
|
+
const csvWriter = new csvWriter_1.default();
|
|
62
64
|
const baseInputDir = (0, path_1.join)((options["es-csv"] || settings['easysources-csv-path'] || constants_1.DEFAULT_ESCSV_PATH), constants_recordtypes_1.RECORDTYPES_SUBPATH);
|
|
63
65
|
const inputObject = (options.object);
|
|
64
66
|
const inputRecordType = (options.recordtype);
|
|
67
|
+
// Initialize result object
|
|
68
|
+
const result = { result: 'OK', items: {} };
|
|
65
69
|
if (!fs.existsSync(baseInputDir)) {
|
|
66
|
-
|
|
67
|
-
return { outputString: 'ERROR: Input folder does not exist' };
|
|
70
|
+
return (0, utils_2.jsonAndPrintError)('Input folder ' + baseInputDir + ' does not exist!');
|
|
68
71
|
}
|
|
69
72
|
var objectList = [];
|
|
70
73
|
if (inputObject) {
|
|
@@ -89,31 +92,44 @@ async function recordTypeUpdateKey(options = {}) {
|
|
|
89
92
|
}
|
|
90
93
|
// dir is the record type name without the extension
|
|
91
94
|
for (const dir of recordTypeList) {
|
|
95
|
+
const fileKey = `${obj}/${dir}`;
|
|
92
96
|
console.log('UpdateKey: ' + dir);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
97
|
+
try {
|
|
98
|
+
// key is each profile section (applicationVisibilities, classAccess ecc)
|
|
99
|
+
for (const tag_section in constants_recordtypes_1.RECORDTYPE_ITEMS) {
|
|
100
|
+
const csvFilePath = (0, path_1.join)(baseInputDir, obj, 'recordTypes', dir, (0, filesUtils_1.calcCsvFilename)(dir, tag_section));
|
|
101
|
+
if (fs.existsSync(csvFilePath)) {
|
|
102
|
+
var jsonArray = await (0, filesUtils_1.readCsvToJsonArray)(csvFilePath);
|
|
103
|
+
(0, utils_1.generateTagId)(jsonArray, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].key, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers);
|
|
104
|
+
if (options.sort === 'true' || options.sort === true || options.sort === undefined) {
|
|
105
|
+
jsonArray = (0, utils_1.sortByKey)(jsonArray);
|
|
106
|
+
}
|
|
107
|
+
const headers = constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers;
|
|
108
|
+
try {
|
|
109
|
+
const csvContent = await csvWriter.toCsv(jsonArray, headers);
|
|
110
|
+
fs.writeFileSync(csvFilePath, csvContent, { flag: 'w+' });
|
|
111
|
+
// file written successfully
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
console.error(err);
|
|
115
|
+
throw new Error(`Failed to write CSV file ${csvFilePath}: ${err.message}`);
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
}
|
|
119
|
+
// Record type processed successfully
|
|
120
|
+
result.items[fileKey] = { result: 'OK' };
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
// Record type processing failed
|
|
124
|
+
console.error(`Error updating key for record type ${dir}:`, error);
|
|
125
|
+
result.items[fileKey] = {
|
|
126
|
+
result: 'KO',
|
|
127
|
+
error: error.message || 'Unknown error occurred'
|
|
128
|
+
};
|
|
113
129
|
}
|
|
114
130
|
}
|
|
115
131
|
}
|
|
116
|
-
return
|
|
132
|
+
return result;
|
|
117
133
|
}
|
|
118
134
|
exports.recordTypeUpdateKey = recordTypeUpdateKey;
|
|
119
135
|
//# sourceMappingURL=updatekey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatekey.js","sourceRoot":"","sources":["../../../../src/commands/easysources/recordtypes/updatekey.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,0DAA+E;AAC/E,gDAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"updatekey.js","sourceRoot":"","sources":["../../../../src/commands/easysources/recordtypes/updatekey.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,0DAA+E;AAC/E,gDAA+D;AAC/D,kEAAwE;AACxE,4DAAqD;AACrD,+BAA4B;AAC5B,0FAAuG;AACvG,gEAA4D;AAC5D,yDAAkE;AAClE,wDAAiD;AACjD,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE/B,MAAM,QAAQ,GAAG,IAAA,4BAAY,GAAE,CAAC;AAEhC,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC;AAErF,MAAqB,SAAU,SAAQ,qBAAW;IA4BvC,KAAK,CAAC,GAAG;QACZ,qBAAW,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAErD,qBAAW,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QAEhC,OAAO,MAAM,CAA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AC,CAAC;4BACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,WAAW,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;yBAC9E;qBACJ;iBACJ;gBAED,qCAAqC;gBACrC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;aAE5C;YAAC,OAAO,KAAK,EAAE;gBACZ,gCAAgC;gBAChC,OAAO,CAAC,KAAK,CAAC,sCAAsC,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;gBACnE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG;oBACpB,MAAM,EAAE,IAAI;oBACZ,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,wBAAwB;iBACnD,CAAC;aACL;SACJ;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAlFD,kDAkFC"}
|
|
@@ -12,7 +12,6 @@ const command_1 = require("@salesforce/command");
|
|
|
12
12
|
const core_1 = require("@salesforce/core");
|
|
13
13
|
const filesUtils_1 = require("../../../utils/filesUtils");
|
|
14
14
|
const utils_1 = require("../../../utils/utils");
|
|
15
|
-
const { Parser, transforms: { unwind } } = require('json2csv');
|
|
16
15
|
const constants_1 = require("../../../utils/constants/constants");
|
|
17
16
|
const performance_1 = require("../../../utils/performance");
|
|
18
17
|
const path_1 = require("path");
|
|
@@ -20,6 +19,8 @@ const constants_recordtypes_1 = require("../../../utils/constants/constants_reco
|
|
|
20
19
|
const utils_recordtypes_1 = require("../../../utils/utils_recordtypes");
|
|
21
20
|
const localSettings_1 = require("../../../utils/localSettings");
|
|
22
21
|
const utils_2 = require("../../../utils/commands/utils");
|
|
22
|
+
const csvWriter_1 = require("../../../utils/csvWriter");
|
|
23
|
+
const split_1 = require("./split");
|
|
23
24
|
const fs = require('fs-extra');
|
|
24
25
|
const settings = (0, localSettings_1.loadSettings)();
|
|
25
26
|
// Initialize Messages with the current plugin directory
|
|
@@ -66,13 +67,15 @@ Upsert.flagsConfig = {
|
|
|
66
67
|
};
|
|
67
68
|
// Export function for programmatic API
|
|
68
69
|
async function recordTypeUpsert(options = {}) {
|
|
70
|
+
const csvWriter = new csvWriter_1.default();
|
|
69
71
|
const baseInputDir = (0, path_1.join)((options["sf-xml"] || settings['salesforce-xml-path'] || constants_1.DEFAULT_SFXML_PATH), constants_recordtypes_1.RECORDTYPES_SUBPATH);
|
|
70
72
|
const baseOutputDir = (0, path_1.join)((options["es-csv"] || settings['easysources-csv-path'] || constants_1.DEFAULT_ESCSV_PATH), constants_recordtypes_1.RECORDTYPES_SUBPATH);
|
|
71
73
|
const inputObject = (options.object);
|
|
72
74
|
const inputRecordType = (options.recordtype);
|
|
75
|
+
// Initialize result object
|
|
76
|
+
const result = { result: 'OK', items: {} };
|
|
73
77
|
if (!fs.existsSync(baseInputDir)) {
|
|
74
|
-
|
|
75
|
-
return;
|
|
78
|
+
return (0, utils_2.jsonAndPrintError)('Input folder ' + baseInputDir + ' does not exist!');
|
|
76
79
|
}
|
|
77
80
|
var objectList = [];
|
|
78
81
|
if (inputObject) {
|
|
@@ -97,77 +100,100 @@ async function recordTypeUpsert(options = {}) {
|
|
|
97
100
|
}
|
|
98
101
|
for (const filename of recordTypeList) {
|
|
99
102
|
const fullFilename = filename.endsWith(constants_recordtypes_1.RECORDTYPES_EXTENSION) ? filename : filename + constants_recordtypes_1.RECORDTYPES_EXTENSION;
|
|
100
|
-
console.log('Upserting: ' + filename);
|
|
101
|
-
const inputFile = (0, path_1.join)(baseInputDir, obj, 'recordTypes', fullFilename);
|
|
102
103
|
const recordtypeName = (0, filesUtils_1.removeExtension)(fullFilename);
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
object: obj,
|
|
112
|
-
recordtype
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
104
|
+
const fileKey = `${obj}/${recordtypeName}`;
|
|
105
|
+
console.log('Upserting: ' + filename);
|
|
106
|
+
try {
|
|
107
|
+
const inputFile = (0, path_1.join)(baseInputDir, obj, 'recordTypes', fullFilename);
|
|
108
|
+
const outputDir = (0, path_1.join)(baseOutputDir, obj, 'recordTypes', recordtypeName);
|
|
109
|
+
const inputFilePart = (0, path_1.join)(baseOutputDir, obj, 'recordTypes', recordtypeName, recordtypeName + constants_1.XML_PART_EXTENSION);
|
|
110
|
+
// If outputDir or inputFilePart doesn't exist, run split command instead
|
|
111
|
+
if (!fs.existsSync(outputDir) || !fs.existsSync(inputFilePart)) {
|
|
112
|
+
console.log('⚠️ Output csv directory or -part.xml file not found. Running split command for object: ' + obj + ', recordtype: ' + filename);
|
|
113
|
+
// Create flags for split command with just the current object and recordtype
|
|
114
|
+
const splitFlags = {
|
|
115
|
+
...options,
|
|
116
|
+
object: obj,
|
|
117
|
+
recordtype: filename
|
|
118
|
+
};
|
|
119
|
+
// Call split function and handle its result
|
|
120
|
+
const splitResult = await (0, split_1.recordTypeSplit)(splitFlags);
|
|
121
|
+
if (splitResult.items && splitResult.items[fileKey]) {
|
|
122
|
+
result.items[fileKey] = splitResult.items[fileKey];
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
result.items[fileKey] = { result: 'KO', error: 'Split operation failed' };
|
|
126
|
+
}
|
|
122
127
|
continue;
|
|
123
|
-
if (!Array.isArray(jsonArray))
|
|
124
|
-
jsonArray = [jsonArray];
|
|
125
|
-
var jsonArrayNew = (0, utils_recordtypes_1.transformXMLtoCSV)(jsonArray);
|
|
126
|
-
(0, utils_1.generateTagId)(jsonArrayNew, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].key, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers);
|
|
127
|
-
const headers = constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers;
|
|
128
|
-
const transforms = [unwind({ paths: headers })];
|
|
129
|
-
const parser = new Parser({ fields: [...headers, '_tagid'], transforms });
|
|
130
|
-
const outputFile = (0, path_1.join)(outputDir, (0, filesUtils_1.calcCsvFilename)(recordtypeName, tag_section));
|
|
131
|
-
if (!fs.existsSync(outputDir)) {
|
|
132
|
-
fs.mkdirSync(outputDir);
|
|
133
128
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
const xmlFileContent = (await (0, filesUtils_1.readXmlFromFile)(inputFile)) ?? {};
|
|
130
|
+
const recordtypeProperties = xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] ?? {};
|
|
131
|
+
for (const tag_section in constants_recordtypes_1.RECORDTYPE_ITEMS) {
|
|
132
|
+
var jsonArray = recordtypeProperties[tag_section];
|
|
133
|
+
if (jsonArray == undefined)
|
|
134
|
+
continue;
|
|
135
|
+
if (!Array.isArray(jsonArray))
|
|
136
|
+
jsonArray = [jsonArray];
|
|
137
|
+
var jsonArrayNew = (0, utils_recordtypes_1.transformXMLtoCSV)(jsonArray);
|
|
138
|
+
(0, utils_1.generateTagId)(jsonArrayNew, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].key, constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers);
|
|
139
|
+
const headers = constants_recordtypes_1.RECORDTYPE_ITEMS[tag_section].headers;
|
|
140
|
+
const outputFile = (0, path_1.join)(outputDir, (0, filesUtils_1.calcCsvFilename)(recordtypeName, tag_section));
|
|
141
|
+
if (!fs.existsSync(outputDir)) {
|
|
142
|
+
fs.mkdirSync(outputDir);
|
|
143
|
+
}
|
|
144
|
+
if (fs.existsSync(outputFile)) {
|
|
145
|
+
const csvFilePath = (0, path_1.join)(baseOutputDir, obj, 'recordTypes', recordtypeName, (0, filesUtils_1.calcCsvFilename)(recordtypeName, tag_section));
|
|
146
|
+
var jsonMapOld = await (0, filesUtils_1.readCsvToJsonMap)(csvFilePath);
|
|
147
|
+
var jsonMapNew = (0, filesUtils_1.jsonArrayCsvToMap)(jsonArrayNew);
|
|
148
|
+
jsonMapNew.forEach((value, key) => {
|
|
149
|
+
jsonMapOld.set(key, value);
|
|
150
|
+
});
|
|
151
|
+
jsonArrayNew = Array.from(jsonMapOld.values());
|
|
152
|
+
}
|
|
153
|
+
if (options.sort === 'true') {
|
|
154
|
+
jsonArrayNew = (0, utils_1.sortByKey)(jsonArrayNew);
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
const csvContent = await csvWriter.toCsv(jsonArrayNew, headers);
|
|
158
|
+
fs.writeFileSync(outputFile, csvContent, { flag: 'w+' });
|
|
159
|
+
// file written successfully
|
|
160
|
+
}
|
|
161
|
+
catch (err) {
|
|
162
|
+
console.error(err);
|
|
163
|
+
throw new Error(`Failed to write CSV file ${outputFile}: ${err.message}`);
|
|
164
|
+
}
|
|
165
|
+
xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG][tag_section] = null;
|
|
142
166
|
}
|
|
143
|
-
if (
|
|
144
|
-
|
|
167
|
+
if (fs.existsSync(inputFilePart)) {
|
|
168
|
+
const xmlFileContentPart = (await (0, filesUtils_1.readXmlFromFile)(inputFilePart)) ?? {};
|
|
169
|
+
const recordtypePropertiesPart = xmlFileContentPart[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] ?? {};
|
|
170
|
+
for (var k in recordtypeProperties) {
|
|
171
|
+
recordtypePropertiesPart[k] = recordtypeProperties[k];
|
|
172
|
+
}
|
|
173
|
+
xmlFileContentPart[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] = recordtypePropertiesPart;
|
|
174
|
+
xmlFileContentPart[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] = (0, utils_2.sortObjectKeys)(xmlFileContentPart[constants_recordtypes_1.RECORDTYPES_ROOT_TAG]);
|
|
175
|
+
(0, filesUtils_1.writeXmlToFile)(inputFilePart, xmlFileContentPart);
|
|
145
176
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
177
|
+
else {
|
|
178
|
+
if (fs.existsSync((0, path_1.join)(baseInputDir, obj, 'recordTypes', recordtypeName))) {
|
|
179
|
+
recordtypeProperties[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] = (0, utils_2.sortObjectKeys)(recordtypeProperties[constants_recordtypes_1.RECORDTYPES_ROOT_TAG]);
|
|
180
|
+
(0, filesUtils_1.writeXmlToFile)(inputFilePart, recordtypeProperties);
|
|
181
|
+
}
|
|
149
182
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
xmlFileContent[constants_recordtypes_1.RECORDTYPES_ROOT_TAG][tag_section] = null;
|
|
154
|
-
}
|
|
155
|
-
if (fs.existsSync(inputFilePart)) {
|
|
156
|
-
const xmlFileContentPart = (await (0, filesUtils_1.readXmlFromFile)(inputFilePart)) ?? {};
|
|
157
|
-
const recordtypePropertiesPart = xmlFileContentPart[constants_recordtypes_1.RECORDTYPES_ROOT_TAG] ?? {};
|
|
158
|
-
for (var k in recordtypeProperties) {
|
|
159
|
-
recordtypePropertiesPart[k] = recordtypeProperties[k];
|
|
160
|
-
}
|
|
161
|
-
(0, filesUtils_1.writeXmlToFile)(inputFilePart, xmlFileContentPart);
|
|
183
|
+
// File processed successfully
|
|
184
|
+
result.items[fileKey] = { result: 'OK' };
|
|
162
185
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
186
|
+
catch (error) {
|
|
187
|
+
// File processing failed
|
|
188
|
+
console.error(`Error processing file ${fullFilename}:`, error);
|
|
189
|
+
result.items[fileKey] = {
|
|
190
|
+
result: 'KO',
|
|
191
|
+
error: error.message || 'Unknown error occurred'
|
|
192
|
+
};
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
195
|
}
|
|
170
|
-
return
|
|
196
|
+
return result;
|
|
171
197
|
}
|
|
172
198
|
exports.recordTypeUpsert = recordTypeUpsert;
|
|
173
199
|
//# sourceMappingURL=upsert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert.js","sourceRoot":"","sources":["../../../../src/commands/easysources/recordtypes/upsert.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,0DAAkJ;AAClJ,gDAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"upsert.js","sourceRoot":"","sources":["../../../../src/commands/easysources/recordtypes/upsert.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,0DAAkJ;AAClJ,gDAA+D;AAC/D,kEAAgH;AAChH,4DAAqD;AACrD,+BAA4B;AAC5B,0FAAoJ;AACpJ,wEAAqE;AACrE,gEAA4D;AAC5D,yDAAkF;AAClF,wDAAiD;AACjD,mCAA0C;AAC1C,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE/B,MAAM,QAAQ,GAAG,IAAA,4BAAY,GAAE,CAAC;AAEhC,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;AAElF,MAAqB,MAAO,SAAQ,qBAAW;IAkCpC,KAAK,CAAC,GAAG;QACZ,qBAAW,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAElD,qBAAW,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QAEhC,OAAO,MAAM,CAAC;IAClB,CAAC;;AA1CL,yBA2CC;AA1CiB,kBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,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