sfdx-easy-sources 0.9.1-develop.3 → 0.9.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/README.md +44 -2
- package/lib/api/permissionsets.d.ts +19 -4
- package/lib/api/permissionsets.js +19 -3
- package/lib/api/permissionsets.js.map +1 -1
- package/lib/api/profiles.d.ts +16 -1
- package/lib/api/profiles.js +16 -0
- package/lib/api/profiles.js.map +1 -1
- package/lib/commands/easysources/permissionsets/customupsert.d.ts +25 -0
- package/lib/commands/easysources/permissionsets/customupsert.js +70 -0
- package/lib/commands/easysources/permissionsets/customupsert.js.map +1 -0
- package/lib/commands/easysources/permissionsets/delete.js +2 -74
- package/lib/commands/easysources/permissionsets/delete.js.map +1 -1
- package/lib/commands/easysources/profiles/customupsert.d.ts +18 -0
- package/lib/commands/easysources/profiles/customupsert.js +64 -0
- package/lib/commands/easysources/profiles/customupsert.js.map +1 -0
- package/lib/commands/easysources/profiles/delete.js +2 -74
- package/lib/commands/easysources/profiles/delete.js.map +1 -1
- package/lib/utils/commands/customupserter.d.ts +10 -0
- package/lib/utils/commands/customupserter.js +152 -0
- package/lib/utils/commands/customupserter.js.map +1 -0
- package/lib/utils/commands/deleter.d.ts +10 -0
- package/lib/utils/commands/deleter.js +130 -0
- package/lib/utils/commands/deleter.js.map +1 -0
- package/messages/permissionsets_customupsert.json +15 -0
- package/messages/profiles_customupsert.json +15 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -10,17 +10,10 @@ exports.profileDelete = void 0;
|
|
|
10
10
|
const os = require("os");
|
|
11
11
|
const command_1 = require("@salesforce/command");
|
|
12
12
|
const core_1 = require("@salesforce/core");
|
|
13
|
-
const fs = require('fs-extra');
|
|
14
|
-
const path_1 = require("path");
|
|
15
13
|
const performance_1 = require("../../../utils/performance");
|
|
16
14
|
const constants_profiles_1 = require("../../../utils/constants/constants_profiles");
|
|
17
|
-
const
|
|
18
|
-
const utils_1 = require("../../../utils/utils");
|
|
15
|
+
const deleter_1 = require("../../../utils/commands/deleter");
|
|
19
16
|
const constants_1 = require("../../../utils/constants/constants");
|
|
20
|
-
const localSettings_1 = require("../../../utils/localSettings");
|
|
21
|
-
const csvWriter_1 = require("../../../utils/csvWriter");
|
|
22
|
-
const utils_2 = require("../../../utils/commands/utils");
|
|
23
|
-
const settings = (0, localSettings_1.loadSettings)();
|
|
24
17
|
// Initialize Messages with the current plugin directory
|
|
25
18
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
26
19
|
// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
|
|
@@ -65,72 +58,7 @@ Delete.flagsConfig = {
|
|
|
65
58
|
};
|
|
66
59
|
// Export a profile-specific delete function that encapsulates profile constants
|
|
67
60
|
async function profileDelete(options) {
|
|
68
|
-
|
|
69
|
-
const type = options.type;
|
|
70
|
-
const tagid = options.tagid;
|
|
71
|
-
if (!type)
|
|
72
|
-
throw new Error('Type parameter is required');
|
|
73
|
-
if (!tagid)
|
|
74
|
-
throw new Error('TagId parameter is required');
|
|
75
|
-
if (!Object.keys(constants_profiles_1.PROFILE_ITEMS).includes(type))
|
|
76
|
-
throw new Error('Invalid type parameter');
|
|
77
|
-
const baseInputDir = (0, path_1.join)((options["es-csv"] || settings['easysources-csv-path'] || constants_1.DEFAULT_ESCSV_PATH), constants_profiles_1.PROFILES_SUBPATH);
|
|
78
|
-
const inputProfile = options.input;
|
|
79
|
-
try {
|
|
80
|
-
(0, filesUtils_1.checkDirOrErrorSync)(baseInputDir);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
return (0, utils_2.jsonAndPrintError)(error.message);
|
|
84
|
-
}
|
|
85
|
-
// Initialize result object
|
|
86
|
-
const result = { result: 'OK', items: {} };
|
|
87
|
-
var dirList = [];
|
|
88
|
-
if (inputProfile) {
|
|
89
|
-
dirList = inputProfile.split(',');
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
dirList = fs.readdirSync(baseInputDir, { withFileTypes: true })
|
|
93
|
-
.filter(item => item.isDirectory())
|
|
94
|
-
.map(item => item.name);
|
|
95
|
-
}
|
|
96
|
-
// dir is the profile name without the extension
|
|
97
|
-
for (const dir of dirList) {
|
|
98
|
-
try {
|
|
99
|
-
console.log('Deleting on: ' + dir);
|
|
100
|
-
// type is a profile section (applicationVisibilities, classAccess ecc)
|
|
101
|
-
const csvFilePath = (0, path_1.join)(baseInputDir, dir, (0, filesUtils_1.calcCsvFilename)(dir, type));
|
|
102
|
-
if (fs.existsSync(csvFilePath)) {
|
|
103
|
-
var jsonMap = await (0, filesUtils_1.readCsvToJsonMap)(csvFilePath);
|
|
104
|
-
for (var k of tagid.split(',')) {
|
|
105
|
-
jsonMap.delete(k);
|
|
106
|
-
}
|
|
107
|
-
var jsonArray = Array.from(jsonMap.values());
|
|
108
|
-
const headers = constants_profiles_1.PROFILE_ITEMS[type].headers;
|
|
109
|
-
if (options.sort === 'true') {
|
|
110
|
-
jsonArray = (0, utils_1.sortByKey)(jsonArray);
|
|
111
|
-
}
|
|
112
|
-
try {
|
|
113
|
-
const csvContent = await csvWriter.toCsv(jsonArray, headers);
|
|
114
|
-
fs.writeFileSync(csvFilePath, csvContent, { flag: 'w+' });
|
|
115
|
-
// file written successfully
|
|
116
|
-
}
|
|
117
|
-
catch (err) {
|
|
118
|
-
console.error(err);
|
|
119
|
-
throw new Error(`Error writing cleaned CSV for profile ${dir}, section ${type}`);
|
|
120
|
-
}
|
|
121
|
-
// Profile processed successfully
|
|
122
|
-
result.items[dir] = { result: 'OK' };
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
console.error(`Error processing profile ${dir}:`, error);
|
|
127
|
-
result.items[dir] = {
|
|
128
|
-
result: 'KO',
|
|
129
|
-
error: error.message || 'Unknown error occurred'
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return result;
|
|
61
|
+
return (0, deleter_1.deleteFromCsv)(options, constants_profiles_1.PROFILES_SUBPATH, constants_profiles_1.PROFILE_ITEMS);
|
|
134
62
|
}
|
|
135
63
|
exports.profileDelete = profileDelete;
|
|
136
64
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/easysources/profiles/delete.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/easysources/profiles/delete.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,4DAAqD;AACrD,oFAA8F;AAC9F,6DAAgE;AAChE,kEAAwE;AAExE,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;AAE/E,MAAqB,MAAO,SAAQ,qBAAW;IAiCpC,KAAK,CAAC,GAAG;QACZ,qBAAW,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE/C,qBAAW,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC;IAClB,CAAC;;AAxCL,yBAyCC;AAxCiB,kBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAExD,eAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AAEzD,WAAI,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAEvB,kBAAW,GAAG;IAC3B,uCAAuC;IACvC,QAAQ,EAAE,eAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,8BAAkB,CAAC,CAAC;KACjF,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;KAC3D,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;KAC1D,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;KAC3D,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,IAAI,CAAC;QACb,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC,CAAC;QACjE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QAC1B,OAAO,EAAE,MAAM;KAClB,CAAC;CACL,CAAC;AAYN,gFAAgF;AACzE,KAAK,UAAU,aAAa,CAAC,OAAY;IAC5C,OAAO,IAAA,uBAAa,EAAC,OAAO,EAAE,qCAAgB,EAAE,kCAAa,CAAC,CAAC;AACnE,CAAC;AAFD,sCAEC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic custom upsert function for adding/updating entries in CSV files
|
|
3
|
+
* Takes a JSON content object and inserts/updates it in the specified CSV files
|
|
4
|
+
*
|
|
5
|
+
* @param flags - Command flags containing options
|
|
6
|
+
* @param file_subpath - Subpath for the specific metadata type (e.g., PROFILES_SUBPATH, PERMSETS_SUBPATH)
|
|
7
|
+
* @param file_items - Configuration object containing metadata type definitions and headers
|
|
8
|
+
* @returns Promise with custom upsert operation result
|
|
9
|
+
*/
|
|
10
|
+
export declare function customUpsert(flags: any, file_subpath: string, file_items: any): Promise<any>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customUpsert = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const constants_1 = require("../constants/constants");
|
|
6
|
+
const filesUtils_1 = require("../filesUtils");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const localSettings_1 = require("../localSettings");
|
|
9
|
+
const csvWriter_1 = require("../csvWriter");
|
|
10
|
+
const utils_2 = require("./utils");
|
|
11
|
+
const fs = require('fs-extra');
|
|
12
|
+
const settings = (0, localSettings_1.loadSettings)();
|
|
13
|
+
/**
|
|
14
|
+
* Generic custom upsert function for adding/updating entries in CSV files
|
|
15
|
+
* Takes a JSON content object and inserts/updates it in the specified CSV files
|
|
16
|
+
*
|
|
17
|
+
* @param flags - Command flags containing options
|
|
18
|
+
* @param file_subpath - Subpath for the specific metadata type (e.g., PROFILES_SUBPATH, PERMSETS_SUBPATH)
|
|
19
|
+
* @param file_items - Configuration object containing metadata type definitions and headers
|
|
20
|
+
* @returns Promise with custom upsert operation result
|
|
21
|
+
*/
|
|
22
|
+
async function customUpsert(flags, file_subpath, file_items) {
|
|
23
|
+
const csvWriter = new csvWriter_1.default();
|
|
24
|
+
const type = flags.type;
|
|
25
|
+
const content = flags.content;
|
|
26
|
+
const baseInputDir = (0, path_1.join)((flags["es-csv"] || settings['easysources-csv-path'] || constants_1.DEFAULT_ESCSV_PATH), file_subpath);
|
|
27
|
+
const inputProfile = flags.input;
|
|
28
|
+
// Parse and validate content parameter
|
|
29
|
+
let contentJson;
|
|
30
|
+
try {
|
|
31
|
+
if (!type)
|
|
32
|
+
throw new Error('Type parameter is required');
|
|
33
|
+
if (!content)
|
|
34
|
+
throw new Error('Content parameter is required');
|
|
35
|
+
if (!Object.keys(file_items).includes(type))
|
|
36
|
+
throw new Error('Invalid type parameter');
|
|
37
|
+
// Check if content is already an object (API usage) or a string (CLI usage)
|
|
38
|
+
if (typeof content === 'object' && content !== null) {
|
|
39
|
+
// Already parsed (API usage)
|
|
40
|
+
contentJson = content;
|
|
41
|
+
}
|
|
42
|
+
else if (typeof content === 'string') {
|
|
43
|
+
// Parse JSON string (CLI usage)
|
|
44
|
+
try {
|
|
45
|
+
contentJson = JSON.parse(content);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw new Error('Content parameter must be valid JSON');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
throw new Error('Content must be a JSON string or object');
|
|
53
|
+
}
|
|
54
|
+
// Validate that content is an object or array
|
|
55
|
+
if (typeof contentJson !== 'object' || contentJson === null) {
|
|
56
|
+
throw new Error('Content must be a valid JSON object or array');
|
|
57
|
+
}
|
|
58
|
+
// Ensure contentJson is always an array for validation
|
|
59
|
+
const contentArray = Array.isArray(contentJson) ? contentJson : [contentJson];
|
|
60
|
+
// Validate that each item contains the required key field
|
|
61
|
+
const keyField = file_items[type].key;
|
|
62
|
+
const keyFields = Array.isArray(keyField) ? keyField : [keyField];
|
|
63
|
+
for (const item of contentArray) {
|
|
64
|
+
// Check if at least one key field is present
|
|
65
|
+
const hasRequiredKey = keyFields.some(field => item.hasOwnProperty(field));
|
|
66
|
+
if (!hasRequiredKey) {
|
|
67
|
+
const keyFieldsList = keyFields.join(' and ');
|
|
68
|
+
throw new Error(`Content must contain the required key field(s): ${keyFieldsList} for type '${type}'`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
(0, filesUtils_1.checkDirOrErrorSync)(baseInputDir);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return (0, utils_2.jsonAndPrintError)(error.message);
|
|
75
|
+
}
|
|
76
|
+
// Initialize result object
|
|
77
|
+
const result = { result: 'OK', items: {} };
|
|
78
|
+
var dirList = [];
|
|
79
|
+
if (inputProfile) {
|
|
80
|
+
dirList = inputProfile.split(',');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
dirList = fs.readdirSync(baseInputDir, { withFileTypes: true })
|
|
84
|
+
.filter(item => item.isDirectory())
|
|
85
|
+
.map(item => item.name);
|
|
86
|
+
}
|
|
87
|
+
// Ensure contentJson is always an array
|
|
88
|
+
const contentArray = Array.isArray(contentJson) ? contentJson : [contentJson];
|
|
89
|
+
// dir is the profile/permissionset name without the extension
|
|
90
|
+
for (const dir of dirList) {
|
|
91
|
+
try {
|
|
92
|
+
console.log('Custom upserting on: ' + dir);
|
|
93
|
+
// type is a section (applicationVisibilities, classAccess ecc)
|
|
94
|
+
const csvFilePath = (0, path_1.join)(baseInputDir, dir, (0, filesUtils_1.calcCsvFilename)(dir, type));
|
|
95
|
+
const headers = file_items[type].headers;
|
|
96
|
+
const keyField = file_items[type].key;
|
|
97
|
+
var jsonMap;
|
|
98
|
+
if (fs.existsSync(csvFilePath)) {
|
|
99
|
+
jsonMap = await (0, filesUtils_1.readCsvToJsonMap)(csvFilePath);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// If CSV doesn't exist, create a new empty map
|
|
103
|
+
jsonMap = new Map();
|
|
104
|
+
}
|
|
105
|
+
// Process each item in the content array
|
|
106
|
+
for (const newItem of contentArray) {
|
|
107
|
+
// Generate tagid for the new item
|
|
108
|
+
const itemArray = [newItem];
|
|
109
|
+
(0, utils_1.generateTagId)(itemArray, keyField, headers);
|
|
110
|
+
const itemWithTagId = itemArray[0];
|
|
111
|
+
// Get the key value from the item
|
|
112
|
+
const keyValue = itemWithTagId._tagid || itemWithTagId[keyField];
|
|
113
|
+
if (!keyValue) {
|
|
114
|
+
console.warn(`Warning: Could not generate key for item in ${dir}, type ${type}. Skipping item.`);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
// Upsert the item (add or update)
|
|
118
|
+
jsonMap.set(keyValue, itemWithTagId);
|
|
119
|
+
}
|
|
120
|
+
var jsonArray = Array.from(jsonMap.values());
|
|
121
|
+
if (flags.sort === 'true') {
|
|
122
|
+
jsonArray = (0, utils_1.sortByKey)(jsonArray);
|
|
123
|
+
}
|
|
124
|
+
// Ensure directory exists
|
|
125
|
+
const dirPath = (0, path_1.join)(baseInputDir, dir);
|
|
126
|
+
if (!fs.existsSync(dirPath)) {
|
|
127
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const csvContent = await csvWriter.toCsv(jsonArray, headers);
|
|
131
|
+
fs.writeFileSync(csvFilePath, csvContent, { flag: 'w+' });
|
|
132
|
+
// file written successfully
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
console.error(err);
|
|
136
|
+
throw new Error(`Error writing CSV for ${dir}, section ${type}`);
|
|
137
|
+
}
|
|
138
|
+
// Item processed successfully
|
|
139
|
+
result.items[dir] = { result: 'OK' };
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error(`Error processing ${dir}:`, error);
|
|
143
|
+
result.items[dir] = {
|
|
144
|
+
result: 'KO',
|
|
145
|
+
error: error.message || 'Unknown error occurred'
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
exports.customUpsert = customUpsert;
|
|
152
|
+
//# sourceMappingURL=customupserter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customupserter.js","sourceRoot":"","sources":["../../../src/utils/commands/customupserter.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,sDAA4D;AAC5D,8CAAuF;AACvF,oCAAoD;AACpD,oDAAgD;AAChD,4CAAqC;AACrC,mCAA4C;AAC5C,MAAM,EAAE,GAAG,OA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,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SAExC;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;YACjD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG;gBAChB,MAAM,EAAE,IAAI;gBACZ,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,wBAAwB;aACnD,CAAC;SACL;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA/ID,oCA+IC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic delete function for removing entries from CSV files based on tagid patterns
|
|
3
|
+
* Supports wildcard patterns for bulk deletions
|
|
4
|
+
*
|
|
5
|
+
* @param flags - Command flags containing options
|
|
6
|
+
* @param file_subpath - Subpath for the specific metadata type (e.g., PROFILES_SUBPATH, PERMSETS_SUBPATH)
|
|
7
|
+
* @param file_items - Configuration object containing metadata type definitions and headers
|
|
8
|
+
* @returns Promise with delete operation result
|
|
9
|
+
*/
|
|
10
|
+
export declare function deleteFromCsv(flags: any, file_subpath: string, file_items: any): Promise<any>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteFromCsv = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const constants_1 = require("../constants/constants");
|
|
6
|
+
const filesUtils_1 = require("../filesUtils");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const localSettings_1 = require("../localSettings");
|
|
9
|
+
const csvWriter_1 = require("../csvWriter");
|
|
10
|
+
const utils_2 = require("./utils");
|
|
11
|
+
const fs = require('fs-extra');
|
|
12
|
+
const settings = (0, localSettings_1.loadSettings)();
|
|
13
|
+
/**
|
|
14
|
+
* Generic delete function for removing entries from CSV files based on tagid patterns
|
|
15
|
+
* Supports wildcard patterns for bulk deletions
|
|
16
|
+
*
|
|
17
|
+
* @param flags - Command flags containing options
|
|
18
|
+
* @param file_subpath - Subpath for the specific metadata type (e.g., PROFILES_SUBPATH, PERMSETS_SUBPATH)
|
|
19
|
+
* @param file_items - Configuration object containing metadata type definitions and headers
|
|
20
|
+
* @returns Promise with delete operation result
|
|
21
|
+
*/
|
|
22
|
+
async function deleteFromCsv(flags, file_subpath, file_items) {
|
|
23
|
+
const csvWriter = new csvWriter_1.default();
|
|
24
|
+
const type = flags.type;
|
|
25
|
+
const tagid = flags.tagid;
|
|
26
|
+
const baseInputDir = (0, path_1.join)((flags["es-csv"] || settings['easysources-csv-path'] || constants_1.DEFAULT_ESCSV_PATH), file_subpath);
|
|
27
|
+
const inputProfile = flags.input;
|
|
28
|
+
try {
|
|
29
|
+
if (!type)
|
|
30
|
+
throw new Error('Type parameter is required');
|
|
31
|
+
if (!tagid)
|
|
32
|
+
throw new Error('TagId parameter is required');
|
|
33
|
+
if (!Object.keys(file_items).includes(type))
|
|
34
|
+
throw new Error('Invalid type parameter');
|
|
35
|
+
(0, filesUtils_1.checkDirOrErrorSync)(baseInputDir);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return (0, utils_2.jsonAndPrintError)(error.message);
|
|
39
|
+
}
|
|
40
|
+
// Initialize result object
|
|
41
|
+
const result = { result: 'OK', items: {} };
|
|
42
|
+
var dirList = [];
|
|
43
|
+
if (inputProfile) {
|
|
44
|
+
dirList = inputProfile.split(',');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
dirList = fs.readdirSync(baseInputDir, { withFileTypes: true })
|
|
48
|
+
.filter(item => item.isDirectory())
|
|
49
|
+
.map(item => item.name);
|
|
50
|
+
}
|
|
51
|
+
// dir is the profile/permissionset name without the extension
|
|
52
|
+
for (const dir of dirList) {
|
|
53
|
+
try {
|
|
54
|
+
console.log('Deleting on: ' + dir);
|
|
55
|
+
// type is a section (applicationVisibilities, classAccess ecc)
|
|
56
|
+
const csvFilePath = (0, path_1.join)(baseInputDir, dir, (0, filesUtils_1.calcCsvFilename)(dir, type));
|
|
57
|
+
if (fs.existsSync(csvFilePath)) {
|
|
58
|
+
var jsonMap = await (0, filesUtils_1.readCsvToJsonMap)(csvFilePath);
|
|
59
|
+
for (var k of tagid.split(',')) {
|
|
60
|
+
const trimmedK = k.trim();
|
|
61
|
+
// Check if wildcard pattern is used
|
|
62
|
+
if (trimmedK.startsWith('*') || trimmedK.endsWith('*')) {
|
|
63
|
+
const keysToDelete = [];
|
|
64
|
+
if (trimmedK.startsWith('*') && trimmedK.endsWith('*')) {
|
|
65
|
+
// *esempio* - contains
|
|
66
|
+
const searchTerm = trimmedK.slice(1, -1);
|
|
67
|
+
for (const key of jsonMap.keys()) {
|
|
68
|
+
if (key.includes(searchTerm)) {
|
|
69
|
+
keysToDelete.push(key);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (trimmedK.startsWith('*')) {
|
|
74
|
+
// *esempio - ends with
|
|
75
|
+
const searchTerm = trimmedK.slice(1);
|
|
76
|
+
for (const key of jsonMap.keys()) {
|
|
77
|
+
if (key.endsWith(searchTerm)) {
|
|
78
|
+
keysToDelete.push(key);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (trimmedK.endsWith('*')) {
|
|
83
|
+
// esempio* - starts with
|
|
84
|
+
const searchTerm = trimmedK.slice(0, -1);
|
|
85
|
+
for (const key of jsonMap.keys()) {
|
|
86
|
+
if (key.startsWith(searchTerm)) {
|
|
87
|
+
keysToDelete.push(key);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Delete all matching keys
|
|
92
|
+
for (const keyToDelete of keysToDelete) {
|
|
93
|
+
jsonMap.delete(keyToDelete);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// No wildcard - exact match
|
|
98
|
+
jsonMap.delete(trimmedK);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var jsonArray = Array.from(jsonMap.values());
|
|
102
|
+
const headers = file_items[type].headers;
|
|
103
|
+
if (flags.sort === 'true') {
|
|
104
|
+
jsonArray = (0, utils_1.sortByKey)(jsonArray);
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
const csvContent = await csvWriter.toCsv(jsonArray, headers);
|
|
108
|
+
fs.writeFileSync(csvFilePath, csvContent, { flag: 'w+' });
|
|
109
|
+
// file written successfully
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
console.error(err);
|
|
113
|
+
throw new Error(`Error writing cleaned CSV for ${dir}, section ${type}`);
|
|
114
|
+
}
|
|
115
|
+
// Item processed successfully
|
|
116
|
+
result.items[dir] = { result: 'OK' };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.error(`Error processing ${dir}:`, error);
|
|
121
|
+
result.items[dir] = {
|
|
122
|
+
result: 'KO',
|
|
123
|
+
error: error.message || 'Unknown error occurred'
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
exports.deleteFromCsv = deleteFromCsv;
|
|
130
|
+
//# sourceMappingURL=deleter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleter.js","sourceRoot":"","sources":["../../../src/utils/commands/deleter.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,sDAA4D;AAC5D,8CAAuF;AACvF,oCAAqC;AACrC,oDAAgD;AAChD,4CAAqC;AACrC,mCAA4C;AAC5C,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE/B,MAAM,QAAQ,GAAG,IAAA,4BAAY,GAAE,CAAC;AAEhC;;;;;;;;GAQG;AACI,KAAK,UAAU,aAAa,CAAC,KAAU,EAAE,YAAoB,EAAE,UAAe;IACjF,MAAM,SAAS,GAA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C/B;gBAAC,OAAO,GAAG,EAAE;oBACV,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,aAAa,IAAI,EAAE,CAAC,CAAC;iBAC5E;gBAED,8BAA8B;gBAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;aACxC;SAEJ;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;YACjD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG;gBAChB,MAAM,EAAE,IAAI;gBACZ,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,wBAAwB;aACnD,CAAC;SACL;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAjHD,sCAiHC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commandDescription": "Inserts or updates entries in csv files based on JSON content input",
|
|
3
|
+
"esCsvFlagDescription": "Specify a custom dir for input csv permission sets. Default: '%s'",
|
|
4
|
+
"inputFlagDescription": "Specify a permission set. Example: MyPermissionSet",
|
|
5
|
+
"typeFlagDescription": "Specify the type of resource you want to upsert. Required.",
|
|
6
|
+
"contentFlagDescription": "Specify the JSON content you want to insert/update. Required. Can be a single object or an array of objects.",
|
|
7
|
+
"sortFlagDescription" : "Specify if results must be sorted. Default '%s'",
|
|
8
|
+
"examples": [
|
|
9
|
+
"sf easysources permissionsets customupsert -t applicationVisibilities -j '{\"application\":\"MyApp\",\"default\":true,\"visible\":true}'",
|
|
10
|
+
"sf easysources permissionsets customupsert -t classAccesses -j '{\"apexClass\":\"MyClass\",\"enabled\":true}'",
|
|
11
|
+
"sf easysources permissionsets customupsert -t fieldPermissions -j '{\"field\":\"Account.CustomField__c\",\"editable\":true,\"readable\":true}'",
|
|
12
|
+
"sf easysources permissionsets customupsert -t objectPermissions -j '{\"object\":\"CustomObject__c\",\"allowCreate\":true,\"allowRead\":true,\"allowEdit\":true,\"allowDelete\":false}'",
|
|
13
|
+
"sf easysources permissionsets customupsert -i MyPermSet -t classAccesses -j '[{\"apexClass\":\"Class1\",\"enabled\":true},{\"apexClass\":\"Class2\",\"enabled\":true}]'"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commandDescription": "Inserts or updates entries in csv files based on JSON content input",
|
|
3
|
+
"esCsvFlagDescription": "Specify a custom dir for input csv profiles. Default: '%s'",
|
|
4
|
+
"inputFlagDescription": "Specify a profile. Example: Admin",
|
|
5
|
+
"typeFlagDescription": "Specify the type of resource you want to upsert. Required.",
|
|
6
|
+
"contentFlagDescription": "Specify the JSON content you want to insert/update. Required. Can be a single object or an array of objects.",
|
|
7
|
+
"sortFlagDescription" : "Specify if results must be sorted. Default '%s'",
|
|
8
|
+
"examples": [
|
|
9
|
+
"sf easysources profiles customupsert -t applicationVisibilities -j '{\"application\":\"MyApp\",\"default\":true,\"visible\":true}'",
|
|
10
|
+
"sf easysources profiles customupsert -t classAccesses -j '{\"apexClass\":\"MyClass\",\"enabled\":true}'",
|
|
11
|
+
"sf easysources profiles customupsert -t fieldPermissions -j '{\"field\":\"Account.CustomField__c\",\"editable\":true,\"readable\":true}'",
|
|
12
|
+
"sf easysources profiles customupsert -t objectPermissions -j '{\"object\":\"CustomObject__c\",\"allowCreate\":true,\"allowRead\":true,\"allowEdit\":true,\"allowDelete\":false}'",
|
|
13
|
+
"sf easysources profiles customupsert -i Admin -t classAccesses -j '[{\"apexClass\":\"Class1\",\"enabled\":true},{\"apexClass\":\"Class2\",\"enabled\":true}]'"
|
|
14
|
+
]
|
|
15
|
+
}
|