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 CHANGED
@@ -28,8 +28,8 @@ With this plugin you can:
28
28
  | Metadata Label| Metadata api | Available commands | Programmatic API |
29
29
  | :---: | :---: | :---: | :---: |
30
30
  | All Meta | allmeta | split, upsert, merge, minify, retrieve | ❌ |
31
- | Profiles | profiles | split, upsert, merge, minify, updatekey, delete, clean, clearempty, arealigned | ✅ **Complete** |
32
- | Permission Sets | permissionsets | split, upsert, merge, minify, updatekey, delete, clean, clearempty, arealigned | ✅ **Complete** |
31
+ | Profiles | profiles | split, upsert, merge, minify, updatekey, delete, customupsert, clean, clearempty, arealigned | ✅ **Complete** |
32
+ | Permission Sets | permissionsets | split, upsert, merge, minify, updatekey, delete, customupsert, clean, clearempty, arealigned | ✅ **Complete** |
33
33
  | Record Types | recordtypes | split, upsert, merge, updatekey, delete, clean, arealigned | ✅ **Complete** |
34
34
  | Labels | labels | split, upsert, merge, updatekey, arealigned | ✅ **Complete** |
35
35
  | Global Value Sets | globalvaluesets | split, upsert, merge, updatekey, arealigned | ✅ **Complete** |
@@ -68,8 +68,18 @@ async function automateMetadata() {
68
68
  await profiles.upsert({ input: 'Admin' });
69
69
  await profiles.merge({ input: 'Admin' });
70
70
 
71
+ // Custom upsert with JSON content
72
+ await profiles.customUpsert({
73
+ type: 'classAccesses',
74
+ content: { apexClass: 'MyClass', enabled: true }
75
+ });
76
+
71
77
  // Same pattern for all metadata types
72
78
  await permissionsets.split();
79
+ await permissionsets.customUpsert({
80
+ type: 'objectPermissions',
81
+ content: { object: 'Account', allowRead: true, allowEdit: true }
82
+ });
73
83
  await labels.upsert();
74
84
  await objectTranslations.minify();
75
85
  }
@@ -99,6 +109,7 @@ Based on the source type, this plugin provides the following commands:
99
109
  - **Split**: Splits the resources into various CSV files, and creates an XML file containing all the tags that weren't split
100
110
  - **Merge**: Merges back all the resources previously split from CSV files into XML format
101
111
  - **Upsert**: Similar to split, but adds new entries to existing CSV files instead of recreating them
112
+ - **CustomUpsert**: Inserts or updates specific entries in CSV files using JSON content, with automatic key calculation and smart field handling
102
113
  - **Updatekey**: Updates the `_tagid` column when developers make changes directly in CSV files
103
114
  - **Delete**: Bulk deletes a single permission from all resources of the same type (only applies to Profiles, PermissionSets and Record Types)
104
115
  - **Minify**: Removes entries that don't add value to the file (available for profiles, permissionsets, objecttranslations, and translations)
@@ -209,6 +220,37 @@ Another scenario could be during a cherry pick or a merge conflict. Suppose a de
209
220
  Suppose the developer deletes a field on the org, he needs to delete all the references for that field for all Profiles, PermissionSets and RecordTypes.
210
221
  This command is intended to delete references, and it has flags to specify the name of the field. Run with --help flag to get a better description of the possible flags for each metadata type.
211
222
 
223
+ ### CustomUpsert
224
+ **Note: only applies to Profiles and PermissionSets**
225
+
226
+ The customupsert command allows you to insert or update specific entries in CSV files using JSON content, providing a powerful way to programmatically manage permissions without manually editing CSV files.
227
+
228
+ **Key Features:**
229
+ - **JSON Input**: Pass structured data directly via the `--content` flag (single object or array)
230
+ - **Smart Field Handling**:
231
+ - Non-existent keys in the JSON are automatically ignored
232
+ - Omitted existing keys result in empty values in the CSV
233
+ - **Automatic Key Calculation**: The `_tagid` is automatically calculated based on the metadata type configuration
234
+ - **Bulk Operations**: Process multiple entries at once by passing an array
235
+ - **Target Specific Items**: Use `--input` to target specific profiles/permission sets, or omit to process all
236
+
237
+ **Examples:**
238
+ ```sh-session
239
+ # Insert/update a single class access permission
240
+ $ sf easysources profiles customupsert -t classAccesses -j '{"apexClass":"MyClass","enabled":true}'
241
+
242
+ # Insert/update multiple entries at once
243
+ $ sf easysources profiles customupsert -t classAccesses -j '[{"apexClass":"Class1","enabled":true},{"apexClass":"Class2","enabled":false}]'
244
+
245
+ # Update field permissions for a specific profile
246
+ $ sf easysources profiles customupsert -i Admin -t fieldPermissions -j '{"field":"Account.CustomField__c","editable":true,"readable":true}'
247
+
248
+ # Update object permissions for all permission sets
249
+ $ sf easysources permissionsets customupsert -t objectPermissions -j '{"object":"CustomObject__c","allowRead":true,"allowEdit":true}'
250
+ ```
251
+
252
+ This command is particularly useful for automation scripts, CI/CD pipelines, or when you need to apply the same permission changes across multiple profiles or permission sets programmatically.
253
+
212
254
  ### Minify
213
255
 
214
256
  This command is very useful if you don't want to have in your csv files all the lines that don't add value to the file. The minify command is available for **profiles**, **permissionsets**, **objecttranslations**, and **translations**.
@@ -24,10 +24,12 @@ export interface PermissionSetOptions extends PathOptions {
24
24
  'include-types'?: string;
25
25
  /** Log directory path (clean only) */
26
26
  'log-dir'?: string;
27
- /** Specific permission type to target (upsert, delete only) */
27
+ /** Specific permission type to target (upsert, delete, customUpsert only) */
28
28
  type?: string;
29
29
  /** Specific tag ID to target (upsert, delete only) */
30
30
  tagid?: string;
31
+ /** JSON content to insert/update (customUpsert only) - can be object or JSON string */
32
+ content?: string | object | object[];
31
33
  }
32
34
  /**
33
35
  * Permission Sets namespace containing all programmatic API functions for Salesforce Permission Set metadata operations.
@@ -44,20 +46,27 @@ export interface PermissionSetOptions extends PathOptions {
44
46
  * - updateKey(): Updates permission set keys in CSV files
45
47
  * - minify(): Removes entries with only false permissions
46
48
  * - delete(): Deletes specific entries from CSV files
49
+ * - customUpsert(): Inserts or updates entries via JSON content
47
50
  * - clean(): Removes references to non-existent metadata
48
51
  *
49
52
  * @example
50
53
  * ```javascript
51
- * const { permissionsets } = require('sfdx-easy-sources');
54
+ * const { permissionSets } = require('sfdx-easy-sources');
52
55
  *
53
56
  * // Using default settings from easysources-settings.json
54
- * await permissionsets.split({ input: 'MyPermSet' });
57
+ * await permissionSets.split({ input: 'MyPermSet' });
55
58
  *
56
59
  * // Override specific paths
57
- * await permissionsets.upsert({
60
+ * await permissionSets.upsert({
58
61
  * 'sf-xml': './custom-metadata-path',
59
62
  * 'es-csv': './custom-csv-path'
60
63
  * });
64
+ *
65
+ * // Custom upsert with JSON content
66
+ * await permissionSets.customUpsert({
67
+ * type: 'objectPermissions',
68
+ * content: { object: 'Account', allowRead: true, allowEdit: true }
69
+ * });
61
70
  * ```
62
71
  */
63
72
  export declare const permissionSets: {
@@ -109,6 +118,12 @@ export declare const permissionSets: {
109
118
  * @returns Promise resolving to operation result
110
119
  */
111
120
  delete: (options: PermissionSetOptions) => Promise<AnyJson>;
121
+ /**
122
+ * Inserts or updates specific entries in permission set CSV files using JSON content.
123
+ * @param options Configuration options for the custom upsert operation
124
+ * @returns Promise resolving to operation result
125
+ */
126
+ customUpsert: (options: PermissionSetOptions) => Promise<AnyJson>;
112
127
  /**
113
128
  * Cleans permission set CSV files by removing references to non-existent metadata.
114
129
  * @param options Optional configuration, automatically resolved from settings if not provided
@@ -11,6 +11,7 @@ const clearempty_1 = require("../commands/easysources/permissionsets/clearempty"
11
11
  const minify_1 = require("../commands/easysources/permissionsets/minify");
12
12
  const delete_1 = require("../commands/easysources/permissionsets/delete");
13
13
  const clean_1 = require("../commands/easysources/permissionsets/clean");
14
+ const customupsert_1 = require("../commands/easysources/permissionsets/customupsert");
14
15
  /**
15
16
  * Permission Sets namespace containing all programmatic API functions for Salesforce Permission Set metadata operations.
16
17
  *
@@ -26,20 +27,27 @@ const clean_1 = require("../commands/easysources/permissionsets/clean");
26
27
  * - updateKey(): Updates permission set keys in CSV files
27
28
  * - minify(): Removes entries with only false permissions
28
29
  * - delete(): Deletes specific entries from CSV files
30
+ * - customUpsert(): Inserts or updates entries via JSON content
29
31
  * - clean(): Removes references to non-existent metadata
30
32
  *
31
33
  * @example
32
34
  * ```javascript
33
- * const { permissionsets } = require('sfdx-easy-sources');
35
+ * const { permissionSets } = require('sfdx-easy-sources');
34
36
  *
35
37
  * // Using default settings from easysources-settings.json
36
- * await permissionsets.split({ input: 'MyPermSet' });
38
+ * await permissionSets.split({ input: 'MyPermSet' });
37
39
  *
38
40
  * // Override specific paths
39
- * await permissionsets.upsert({
41
+ * await permissionSets.upsert({
40
42
  * 'sf-xml': './custom-metadata-path',
41
43
  * 'es-csv': './custom-csv-path'
42
44
  * });
45
+ *
46
+ * // Custom upsert with JSON content
47
+ * await permissionSets.customUpsert({
48
+ * type: 'objectPermissions',
49
+ * content: { object: 'Account', allowRead: true, allowEdit: true }
50
+ * });
43
51
  * ```
44
52
  */
45
53
  exports.permissionSets = {
@@ -107,6 +115,14 @@ exports.permissionSets = {
107
115
  delete: async (options) => {
108
116
  return await (0, delete_1.permissionsetDelete)(options);
109
117
  },
118
+ /**
119
+ * Inserts or updates specific entries in permission set CSV files using JSON content.
120
+ * @param options Configuration options for the custom upsert operation
121
+ * @returns Promise resolving to operation result
122
+ */
123
+ customUpsert: async (options) => {
124
+ return await (0, customupsert_1.permissionsetCustomUpsert)(options);
125
+ },
110
126
  /**
111
127
  * Cleans permission set CSV files by removing references to non-existent metadata.
112
128
  * @param options Optional configuration, automatically resolved from settings if not provided
@@ -1 +1 @@
1
- {"version":3,"file":"permissionsets.js","sourceRoot":"","sources":["../../src/api/permissionsets.ts"],"names":[],"mappings":";;;AAGA,uEAAuE;AACvE,wEAAkF;AAClF,0EAAoF;AACpF,wEAAkF;AAClF,gFAA0F;AAC1F,kFAA4F;AAC5F,kFAA4F;AAC5F,0EAAoF;AACpF,0EAAoF;AACpF,wEAAkF;AAmClF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACU,QAAA,cAAc,GAAG;IAC5B;;;;OAIG;IACH,KAAK,EAAE,KAAK,EAAE,UAAgC,EAAE,EAAoB,EAAE;QACpE,OAAO,MAAM,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,UAAgC,EAAE,EAAoB,EAAE;QACrE,OAAO,MAAM,IAAA,4BAAmB,EAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,KAAK,EAAE,KAAK,EAAE,UAAgC,EAAE,EAAoB,EAAE;QACpE,OAAO,MAAM,IAAA,0BAAkB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AAK,EAAE,UAAgC,EAAE,EAAoB,EAAE;QACpE,OAAO,MAAM,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC"}
@@ -26,10 +26,12 @@ export interface ProfileOptions extends PathOptions {
26
26
  'include-types'?: string;
27
27
  /** Log directory path (clean only) */
28
28
  'log-dir'?: string;
29
- /** Specific permission type to target (upsert, delete only) */
29
+ /** Specific permission type to target (upsert, delete, customUpsert only) */
30
30
  type?: string;
31
31
  /** Specific tag ID to target (upsert, delete only) */
32
32
  tagid?: string;
33
+ /** JSON content to insert/update (customUpsert only) - can be object or JSON string */
34
+ content?: string | object | object[];
33
35
  }
34
36
  /**
35
37
  * Profiles namespace containing all programmatic API functions for Salesforce Profile metadata operations.
@@ -46,6 +48,7 @@ export interface ProfileOptions extends PathOptions {
46
48
  * - updateKey(): Updates profile keys in CSV files
47
49
  * - minify(): Removes entries with only false permissions
48
50
  * - delete(): Deletes specific entries from CSV files
51
+ * - customUpsert(): Inserts or updates entries via JSON content
49
52
  * - clean(): Removes references to non-existent metadata
50
53
  *
51
54
  * @example
@@ -60,6 +63,12 @@ export interface ProfileOptions extends PathOptions {
60
63
  * 'sf-xml': './custom-metadata-path',
61
64
  * 'es-csv': './custom-csv-path'
62
65
  * });
66
+ *
67
+ * // Custom upsert with JSON content
68
+ * await profiles.customUpsert({
69
+ * type: 'classAccesses',
70
+ * content: { apexClass: 'MyClass', enabled: true }
71
+ * });
63
72
  * ```
64
73
  */
65
74
  export declare const profiles: {
@@ -111,6 +120,12 @@ export declare const profiles: {
111
120
  * @returns Promise resolving to operation result
112
121
  */
113
122
  delete: (options: ProfileOptions) => Promise<AnyJson>;
123
+ /**
124
+ * Inserts or updates specific entries in profile CSV files using JSON content.
125
+ * @param options Configuration options for the custom upsert operation
126
+ * @returns Promise resolving to operation result
127
+ */
128
+ customUpsert: (options: ProfileOptions) => Promise<AnyJson>;
114
129
  /**
115
130
  * Cleans profile CSV files by removing references to non-existent metadata.
116
131
  * @param options Optional configuration, automatically resolved from settings if not provided
@@ -11,6 +11,7 @@ const clearempty_1 = require("../commands/easysources/profiles/clearempty");
11
11
  const minify_1 = require("../commands/easysources/profiles/minify");
12
12
  const delete_1 = require("../commands/easysources/profiles/delete");
13
13
  const clean_1 = require("../commands/easysources/profiles/clean");
14
+ const customupsert_1 = require("../commands/easysources/profiles/customupsert");
14
15
  /**
15
16
  * Profiles namespace containing all programmatic API functions for Salesforce Profile metadata operations.
16
17
  *
@@ -26,6 +27,7 @@ const clean_1 = require("../commands/easysources/profiles/clean");
26
27
  * - updateKey(): Updates profile keys in CSV files
27
28
  * - minify(): Removes entries with only false permissions
28
29
  * - delete(): Deletes specific entries from CSV files
30
+ * - customUpsert(): Inserts or updates entries via JSON content
29
31
  * - clean(): Removes references to non-existent metadata
30
32
  *
31
33
  * @example
@@ -40,6 +42,12 @@ const clean_1 = require("../commands/easysources/profiles/clean");
40
42
  * 'sf-xml': './custom-metadata-path',
41
43
  * 'es-csv': './custom-csv-path'
42
44
  * });
45
+ *
46
+ * // Custom upsert with JSON content
47
+ * await profiles.customUpsert({
48
+ * type: 'classAccesses',
49
+ * content: { apexClass: 'MyClass', enabled: true }
50
+ * });
43
51
  * ```
44
52
  */
45
53
  exports.profiles = {
@@ -107,6 +115,14 @@ exports.profiles = {
107
115
  delete: async (options) => {
108
116
  return await (0, delete_1.profileDelete)(options);
109
117
  },
118
+ /**
119
+ * Inserts or updates specific entries in profile CSV files using JSON content.
120
+ * @param options Configuration options for the custom upsert operation
121
+ * @returns Promise resolving to operation result
122
+ */
123
+ customUpsert: async (options) => {
124
+ return await (0, customupsert_1.profileCustomUpsert)(options);
125
+ },
110
126
  /**
111
127
  * Cleans profile CSV files by removing references to non-existent metadata.
112
128
  * @param options Optional configuration, automatically resolved from settings if not provided
@@ -1 +1 @@
1
- {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/api/profiles.ts"],"names":[],"mappings":";;;AAGA,gEAAgE;AAChE,kEA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;;OAIG;IACH,SAAS,EAAE,KAAK,EAAE,OAAuB,EAAoB,EAAE;QAC7D,OAAO,MAAM,IAAA,4BAAgB,EAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,UAA0B,EAAE,EAAoB,EAAE;QAC/D,OAAO,MAAM,IAAA,sBAAa,EAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,OAAuB,EAAoB,EAAE;QAC1D,OAAO,MAAM,IAAA,sBAAa,EAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,YAAY,EAAE,KAAK,EAAE,OAAuB,EAAoB,EAAE;QAChE,OAAO,MAAM,IAAA,kCAAmB,EAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,KAAK,EAAE,KAAK,EAAE,UAA0B,EAAE,EAAoB,EAAE;QAC9D,OAAO,MAAM,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { flags, SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class CustomUpsert extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ protected static flagsConfig: {
10
+ "es-csv": flags.Discriminated<flags.String>;
11
+ input: flags.Discriminated<flags.String>;
12
+ type: flags.Discriminated<flags.String>;
13
+ content: flags.Discriminated<flags.String>;
14
+ sort: flags.Discriminated<flags.Enum<string>>;
15
+ };
16
+ run(): Promise<AnyJson>;
17
+ }
18
+ /**
19
+ * Permission set-specific custom upsert function that encapsulates all permission set constants
20
+ * This function can be used programmatically without needing to pass permission set constants
21
+ *
22
+ * @param options - Options object containing command flags
23
+ * @returns Promise with custom upsert operation result
24
+ */
25
+ export declare function permissionsetCustomUpsert(options: any): Promise<any>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.permissionsetCustomUpsert = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const os = require("os");
11
+ const command_1 = require("@salesforce/command");
12
+ const core_1 = require("@salesforce/core");
13
+ const performance_1 = require("../../../utils/performance");
14
+ const constants_permissionsets_1 = require("../../../utils/constants/constants_permissionsets");
15
+ const customupserter_1 = require("../../../utils/commands/customupserter");
16
+ const constants_1 = require("../../../utils/constants/constants");
17
+ // Initialize Messages with the current plugin directory
18
+ core_1.Messages.importMessagesDirectory(__dirname);
19
+ // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
20
+ // or any library that is using the messages framework can also be loaded this way.
21
+ const messages = core_1.Messages.loadMessages('sfdx-easy-sources', 'permissionsets_customupsert');
22
+ class CustomUpsert extends command_1.SfdxCommand {
23
+ async run() {
24
+ performance_1.default.getInstance().start();
25
+ var result = await permissionsetCustomUpsert(this.flags);
26
+ performance_1.default.getInstance().end();
27
+ return result;
28
+ }
29
+ }
30
+ exports.default = CustomUpsert;
31
+ CustomUpsert.description = messages.getMessage('commandDescription');
32
+ CustomUpsert.examples = messages.getMessage('examples').split(os.EOL);
33
+ CustomUpsert.args = [{ name: 'file' }];
34
+ CustomUpsert.flagsConfig = {
35
+ // flag with a value (-n, --name=VALUE)
36
+ "es-csv": command_1.flags.string({
37
+ char: 'c',
38
+ description: messages.getMessage('esCsvFlagDescription', [constants_1.DEFAULT_ESCSV_PATH]),
39
+ }),
40
+ input: command_1.flags.string({
41
+ char: 'i',
42
+ description: messages.getMessage('inputFlagDescription'),
43
+ }),
44
+ type: command_1.flags.string({
45
+ char: 't',
46
+ description: messages.getMessage('typeFlagDescription'),
47
+ }),
48
+ content: command_1.flags.string({
49
+ char: 'j',
50
+ description: messages.getMessage('contentFlagDescription'),
51
+ }),
52
+ sort: command_1.flags.enum({
53
+ char: 'S',
54
+ description: messages.getMessage('sortFlagDescription', ['true']),
55
+ options: ['true', 'false'],
56
+ default: 'true',
57
+ }),
58
+ };
59
+ /**
60
+ * Permission set-specific custom upsert function that encapsulates all permission set constants
61
+ * This function can be used programmatically without needing to pass permission set constants
62
+ *
63
+ * @param options - Options object containing command flags
64
+ * @returns Promise with custom upsert operation result
65
+ */
66
+ async function permissionsetCustomUpsert(options) {
67
+ return (0, customupserter_1.customUpsert)(options, constants_permissionsets_1.PERMSETS_SUBPATH, constants_permissionsets_1.PERMSET_ITEMS);
68
+ }
69
+ exports.permissionsetCustomUpsert = permissionsetCustomUpsert;
70
+ //# sourceMappingURL=customupsert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customupsert.js","sourceRoot":"","sources":["../../../../src/commands/easysources/permissionsets/customupsert.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,4DAAqD;AACrD,gGAAoG;AACpG,2EAAsE;AACtE,kEAAwE;AAGxE,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC;AAE3F,MAAqB,YAAa,SAAQ,qBAAW;IAiC1C,KAAK,CAAC,GAAG;QACZ,qBAAW,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;QAElC,IAAI,MAAM,GAAG,MAAM,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEzD,qBAAW,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QAEhC,OAAO,MAAM,CAAC;IAClB,CAAC;;AAzCL,+BA0CC;AAzCiB,wBAAW,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-10,17 +10,10 @@ exports.permissionsetDelete = 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_permissionsets_1 = require("../../../utils/constants/constants_permissionsets");
17
- const filesUtils_1 = require("../../../utils/filesUtils");
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,
@@ -71,72 +64,7 @@ Delete.flagsConfig = {
71
64
  * @returns Promise with delete operation result
72
65
  */
73
66
  async function permissionsetDelete(options) {
74
- const csvWriter = new csvWriter_1.default();
75
- const type = options.type;
76
- const tagid = options.tagid;
77
- if (!type)
78
- throw new core_1.SfError(messages.getMessage('errorNoTypeFlag'));
79
- if (!tagid)
80
- throw new core_1.SfError(messages.getMessage('errorNoTagIdFlag'));
81
- if (!Object.keys(constants_permissionsets_1.PERMSET_ITEMS).includes(type))
82
- throw new core_1.SfError(messages.getMessage('errorNoValidTypeFlag'));
83
- const baseInputDir = (0, path_1.join)((options["es-csv"] || settings['easysources-csv-path'] || constants_1.DEFAULT_ESCSV_PATH), constants_permissionsets_1.PERMSETS_SUBPATH);
84
- const inputProfile = options.input;
85
- try {
86
- (0, filesUtils_1.checkDirOrErrorSync)(baseInputDir);
87
- }
88
- catch (error) {
89
- return (0, utils_2.jsonAndPrintError)(error.message);
90
- }
91
- // Initialize result object
92
- const result = { result: 'OK', items: {} };
93
- var dirList = [];
94
- if (inputProfile) {
95
- dirList = inputProfile.split(',');
96
- }
97
- else {
98
- dirList = fs.readdirSync(baseInputDir, { withFileTypes: true })
99
- .filter(item => item.isDirectory())
100
- .map(item => item.name);
101
- }
102
- // dir is the profile name without the extension
103
- for (const dir of dirList) {
104
- try {
105
- console.log('Deleting on: ' + dir);
106
- // type is a profile section (applicationVisibilities, classAccess ecc)
107
- const csvFilePath = (0, path_1.join)(baseInputDir, dir, (0, filesUtils_1.calcCsvFilename)(dir, type));
108
- if (fs.existsSync(csvFilePath)) {
109
- var jsonMap = await (0, filesUtils_1.readCsvToJsonMap)(csvFilePath);
110
- for (var k of tagid.split(',')) {
111
- jsonMap.delete(k);
112
- }
113
- var jsonArray = Array.from(jsonMap.values());
114
- const headers = constants_permissionsets_1.PERMSET_ITEMS[type].headers;
115
- if (options.sort === 'true') {
116
- jsonArray = (0, utils_1.sortByKey)(jsonArray);
117
- }
118
- try {
119
- const csvContent = await csvWriter.toCsv(jsonArray, headers);
120
- fs.writeFileSync(csvFilePath, csvContent, { flag: 'w+' });
121
- // file written successfully
122
- }
123
- catch (err) {
124
- console.error(err);
125
- throw new Error(`Error writing cleaned CSV for permissionSet ${dir}, section ${type}`);
126
- }
127
- // PermissionSet processed successfully
128
- result.items[dir] = { result: 'OK' };
129
- }
130
- }
131
- catch (error) {
132
- console.error(`Error processing permissionSet ${dir}:`, error);
133
- result.items[dir] = {
134
- result: 'KO',
135
- error: error.message || 'Unknown error occurred'
136
- };
137
- }
138
- }
139
- return result;
67
+ return (0, deleter_1.deleteFromCsv)(options, constants_permissionsets_1.PERMSETS_SUBPATH, constants_permissionsets_1.PERMSET_ITEMS);
140
68
  }
141
69
  exports.permissionsetDelete = permissionsetDelete;
142
70
  //# sourceMappingURL=delete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/easysources/permissionsets/delete.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAAqD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AAC,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;AAaN;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CAAC,OAAY;IAClD,OAAO,IAAA,uBAAa,EAAC,OAAO,EAAE,2CAAgB,EAAE,wCAAa,CAAC,CAAC;AACnE,CAAC;AAFD,kDAEC"}
@@ -0,0 +1,18 @@
1
+ import { flags, SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class CustomUpsert extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ protected static flagsConfig: {
10
+ "es-csv": flags.Discriminated<flags.String>;
11
+ input: flags.Discriminated<flags.String>;
12
+ type: flags.Discriminated<flags.String>;
13
+ content: flags.Discriminated<flags.String>;
14
+ sort: flags.Discriminated<flags.Enum<string>>;
15
+ };
16
+ run(): Promise<AnyJson>;
17
+ }
18
+ export declare function profileCustomUpsert(options: any): Promise<any>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.profileCustomUpsert = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const os = require("os");
11
+ const command_1 = require("@salesforce/command");
12
+ const core_1 = require("@salesforce/core");
13
+ const performance_1 = require("../../../utils/performance");
14
+ const constants_profiles_1 = require("../../../utils/constants/constants_profiles");
15
+ const customupserter_1 = require("../../../utils/commands/customupserter");
16
+ const constants_1 = require("../../../utils/constants/constants");
17
+ // Initialize Messages with the current plugin directory
18
+ core_1.Messages.importMessagesDirectory(__dirname);
19
+ // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
20
+ // or any library that is using the messages framework can also be loaded this way.
21
+ const messages = core_1.Messages.loadMessages('sfdx-easy-sources', 'profiles_customupsert');
22
+ class CustomUpsert extends command_1.SfdxCommand {
23
+ async run() {
24
+ performance_1.default.getInstance().start();
25
+ const result = await profileCustomUpsert(this.flags);
26
+ performance_1.default.getInstance().end();
27
+ return result;
28
+ }
29
+ }
30
+ exports.default = CustomUpsert;
31
+ CustomUpsert.description = messages.getMessage('commandDescription');
32
+ CustomUpsert.examples = messages.getMessage('examples').split(os.EOL);
33
+ CustomUpsert.args = [{ name: 'file' }];
34
+ CustomUpsert.flagsConfig = {
35
+ // flag with a value (-n, --name=VALUE)
36
+ "es-csv": command_1.flags.string({
37
+ char: 'c',
38
+ description: messages.getMessage('esCsvFlagDescription', [constants_1.DEFAULT_ESCSV_PATH]),
39
+ }),
40
+ input: command_1.flags.string({
41
+ char: 'i',
42
+ description: messages.getMessage('inputFlagDescription'),
43
+ }),
44
+ type: command_1.flags.string({
45
+ char: 't',
46
+ description: messages.getMessage('typeFlagDescription'),
47
+ }),
48
+ content: command_1.flags.string({
49
+ char: 'j',
50
+ description: messages.getMessage('contentFlagDescription'),
51
+ }),
52
+ sort: command_1.flags.enum({
53
+ char: 'S',
54
+ description: messages.getMessage('sortFlagDescription', ['true']),
55
+ options: ['true', 'false'],
56
+ default: 'true',
57
+ }),
58
+ };
59
+ // Export a profile-specific custom upsert function that encapsulates profile constants
60
+ async function profileCustomUpsert(options) {
61
+ return (0, customupserter_1.customUpsert)(options, constants_profiles_1.PROFILES_SUBPATH, constants_profiles_1.PROFILE_ITEMS);
62
+ }
63
+ exports.profileCustomUpsert = profileCustomUpsert;
64
+ //# sourceMappingURL=customupsert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customupsert.js","sourceRoot":"","sources":["../../../../src/commands/easysources/profiles/customupsert.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAE5C,4DAAqD;AACrD,oFAA8F;AAC9F,2EAAsE;AACtE,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,uBAAuB,CAAC,CAAC;AAErF,MAAqB,YAAa,SAAQ,qBAAW;IAiC1C,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;QAChC,OAAO,MAAM,CAAC;IAClB,CAAC;;AAxCL,+BAyCC;AAxCiB,wBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAExD,qBAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AAEzD,iBAAI,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAEvB,wBAAW,GAAG;IAC3B,uCAAuC;IACvC,QAAQ,EAAE,eAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,8BAA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