@sharinpix/sharinpix-sf-cli 1.7.0 → 1.8.0
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 +47 -4
- package/lib/commands/sharinpix/form/push.d.ts +2 -0
- package/lib/commands/sharinpix/form/push.js +30 -10
- package/lib/commands/sharinpix/form/push.js.map +1 -1
- package/lib/commands/sharinpix/permission/pull.js +3 -3
- package/lib/commands/sharinpix/permission/pull.js.map +1 -1
- package/lib/commands/sharinpix/permission/push.d.ts +2 -0
- package/lib/commands/sharinpix/permission/push.js +33 -13
- package/lib/commands/sharinpix/permission/push.js.map +1 -1
- package/messages/sharinpix.form.push.md +17 -1
- package/messages/sharinpix.permission.pull.md +1 -1
- package/messages/sharinpix.permission.push.md +17 -1
- package/oclif.manifest.json +22 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,6 +47,10 @@ sf sharinpix permission pull -o yourusername@salesforce.com
|
|
|
47
47
|
# Push form templates and permissions to Salesforce
|
|
48
48
|
sf sharinpix form push -o yourusername@salesforce.com
|
|
49
49
|
sf sharinpix permission push -o yourusername@salesforce.com
|
|
50
|
+
|
|
51
|
+
# Push with deletion of orphaned records (records that exist in Salesforce but have no corresponding local files)
|
|
52
|
+
sf sharinpix form push -o yourusername@salesforce.com --delete
|
|
53
|
+
sf sharinpix permission push -o yourusername@salesforce.com -d
|
|
50
54
|
```
|
|
51
55
|
|
|
52
56
|
## Issues
|
|
@@ -101,6 +105,25 @@ sf plugins link .
|
|
|
101
105
|
sf plugins
|
|
102
106
|
```
|
|
103
107
|
|
|
108
|
+
## Key Features
|
|
109
|
+
|
|
110
|
+
### Deletion Functionality
|
|
111
|
+
|
|
112
|
+
Both `form push` and `permission push` commands support a `--delete/-d` flag that provides automatic cleanup of orphaned records:
|
|
113
|
+
|
|
114
|
+
- **Orphaned Records**: Records that exist in your Salesforce org but no longer have corresponding local JSON files
|
|
115
|
+
- **Safety**: Deletion only occurs when the flag is explicitly provided
|
|
116
|
+
- **Reporting**: The command reports how many records were deleted, failed, uploaded, and skipped
|
|
117
|
+
- **Error Handling**: If a deletion fails, it's logged as a warning and counted in the failed total
|
|
118
|
+
|
|
119
|
+
**⚠️ Important**: Use the `--delete` flag with caution as deletions cannot be undone. Always ensure you have backups of your data before using this feature.
|
|
120
|
+
|
|
121
|
+
**Example Workflow**:
|
|
122
|
+
|
|
123
|
+
1. Pull existing records: `sf sharinpix form pull`
|
|
124
|
+
2. Remove unwanted local JSON files
|
|
125
|
+
3. Push with cleanup: `sf sharinpix form push --delete`
|
|
126
|
+
|
|
104
127
|
## Commands
|
|
105
128
|
|
|
106
129
|
<!-- commands -->
|
|
@@ -152,9 +175,10 @@ Push SharinPix form templates to Salesforce org.
|
|
|
152
175
|
|
|
153
176
|
```
|
|
154
177
|
USAGE
|
|
155
|
-
$ sf sharinpix form push -o <value> [--json] [--flags-dir <value>]
|
|
178
|
+
$ sf sharinpix form push -o <value> [--json] [--flags-dir <value>] [-d]
|
|
156
179
|
|
|
157
180
|
FLAGS
|
|
181
|
+
-d, --delete Delete form templates from org that no longer have corresponding local files.
|
|
158
182
|
-o, --org=<value> (required) The Salesforce org to push form templates to.
|
|
159
183
|
|
|
160
184
|
GLOBAL FLAGS
|
|
@@ -177,7 +201,16 @@ EXAMPLES
|
|
|
177
201
|
|
|
178
202
|
$ sf sharinpix form push --target-org myorg@example.com
|
|
179
203
|
|
|
204
|
+
Push form templates and delete orphaned records:
|
|
205
|
+
|
|
206
|
+
$ sf sharinpix form push --delete
|
|
207
|
+
|
|
180
208
|
FLAG DESCRIPTIONS
|
|
209
|
+
-d, --delete Delete form templates from org that no longer have corresponding local files.
|
|
210
|
+
|
|
211
|
+
When enabled, this flag will delete form template records from the Salesforce org if their corresponding local JSON
|
|
212
|
+
files are missing. Use with caution as this operation cannot be undone.
|
|
213
|
+
|
|
181
214
|
-o, --org=<value> The Salesforce org to push form templates to.
|
|
182
215
|
|
|
183
216
|
The target Salesforce org where the SharinPix form templates will be uploaded and stored.
|
|
@@ -202,8 +235,8 @@ DESCRIPTION
|
|
|
202
235
|
Pull SharinPix permissions from Salesforce org.
|
|
203
236
|
|
|
204
237
|
Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local
|
|
205
|
-
sharinpix/
|
|
206
|
-
the sharinpix**Json**c field.
|
|
238
|
+
sharinpix/permissions directory. This command fetches the permission metadata and the JSON configuration data stored
|
|
239
|
+
in the sharinpix**Json**c field.
|
|
207
240
|
|
|
208
241
|
EXAMPLES
|
|
209
242
|
Pull all SharinPix permissions from the default org:
|
|
@@ -226,9 +259,10 @@ Push SharinPix permissions to Salesforce org.
|
|
|
226
259
|
|
|
227
260
|
```
|
|
228
261
|
USAGE
|
|
229
|
-
$ sf sharinpix permission push -o <value> [--json] [--flags-dir <value>]
|
|
262
|
+
$ sf sharinpix permission push -o <value> [--json] [--flags-dir <value>] [-d]
|
|
230
263
|
|
|
231
264
|
FLAGS
|
|
265
|
+
-d, --delete Delete SharinPix permissions from org that no longer have corresponding local files.
|
|
232
266
|
-o, --org=<value> (required) The Salesforce org to push SharinPix permissions to.
|
|
233
267
|
|
|
234
268
|
GLOBAL FLAGS
|
|
@@ -251,7 +285,16 @@ EXAMPLES
|
|
|
251
285
|
|
|
252
286
|
$ sf sharinpix permission push --target-org myorg@example.com
|
|
253
287
|
|
|
288
|
+
Push SharinPix permissions and delete orphaned records:
|
|
289
|
+
|
|
290
|
+
$ sf sharinpix permission push --delete
|
|
291
|
+
|
|
254
292
|
FLAG DESCRIPTIONS
|
|
293
|
+
-d, --delete Delete SharinPix permissions from org that no longer have corresponding local files.
|
|
294
|
+
|
|
295
|
+
When enabled, this flag will delete SharinPix permission records from the Salesforce org if their corresponding
|
|
296
|
+
local JSON files are missing. Use with caution as this operation cannot be undone.
|
|
297
|
+
|
|
255
298
|
-o, --org=<value> The Salesforce org to push SharinPix permissions to.
|
|
256
299
|
|
|
257
300
|
The target Salesforce org where the SharinPix permissions will be uploaded and stored.
|
|
@@ -4,6 +4,7 @@ export type PushResult = {
|
|
|
4
4
|
uploaded?: number;
|
|
5
5
|
failed?: number;
|
|
6
6
|
skipped?: number;
|
|
7
|
+
deleted?: number;
|
|
7
8
|
};
|
|
8
9
|
export default class Push extends SfCommand<PushResult> {
|
|
9
10
|
static readonly summary: string;
|
|
@@ -11,6 +12,7 @@ export default class Push extends SfCommand<PushResult> {
|
|
|
11
12
|
static readonly examples: string[];
|
|
12
13
|
static readonly flags: {
|
|
13
14
|
org: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
delete: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
16
|
};
|
|
15
17
|
run(): Promise<PushResult>;
|
|
16
18
|
}
|
|
@@ -17,6 +17,12 @@ export default class Push extends SfCommand {
|
|
|
17
17
|
summary: messages.getMessage('flags.org.summary'),
|
|
18
18
|
description: messages.getMessage('flags.org.description'),
|
|
19
19
|
}),
|
|
20
|
+
delete: Flags.boolean({
|
|
21
|
+
char: 'd',
|
|
22
|
+
summary: messages.getMessage('flags.delete.summary'),
|
|
23
|
+
description: messages.getMessage('flags.delete.description'),
|
|
24
|
+
default: false,
|
|
25
|
+
}),
|
|
20
26
|
};
|
|
21
27
|
async run() {
|
|
22
28
|
const { flags } = await this.parse(Push);
|
|
@@ -25,15 +31,6 @@ export default class Push extends SfCommand {
|
|
|
25
31
|
.readdirSync('sharinpix/forms')
|
|
26
32
|
.filter((file) => file.endsWith('.json'))
|
|
27
33
|
.map((file) => path.join('sharinpix/forms', file));
|
|
28
|
-
if (files.length === 0) {
|
|
29
|
-
this.log('No form template files found in the specified directory.');
|
|
30
|
-
return {
|
|
31
|
-
name: 'OK',
|
|
32
|
-
uploaded: 0,
|
|
33
|
-
failed: 0,
|
|
34
|
-
skipped: 0,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
34
|
const body = {
|
|
38
35
|
// eslint-disable-next-line camelcase
|
|
39
36
|
form_template_create: true,
|
|
@@ -46,6 +43,7 @@ export default class Push extends SfCommand {
|
|
|
46
43
|
let uploaded = 0;
|
|
47
44
|
let failed = 0;
|
|
48
45
|
let skipped = 0;
|
|
46
|
+
let deleted = 0;
|
|
49
47
|
for (const file of files) {
|
|
50
48
|
try {
|
|
51
49
|
const fileContent = fs.readFileSync(file, 'utf8');
|
|
@@ -122,12 +120,34 @@ export default class Push extends SfCommand {
|
|
|
122
120
|
continue;
|
|
123
121
|
}
|
|
124
122
|
}
|
|
125
|
-
|
|
123
|
+
// Handle deletion of records that no longer have corresponding local files
|
|
124
|
+
if (flags.delete) {
|
|
125
|
+
const localFileNames = new Set(files.map((file) => {
|
|
126
|
+
const fileContent = fs.readFileSync(file, 'utf8');
|
|
127
|
+
const json = JSON.parse(fileContent);
|
|
128
|
+
return json.name;
|
|
129
|
+
}));
|
|
130
|
+
for (const [recordName, record] of existingMap) {
|
|
131
|
+
if (!localFileNames.has(recordName)) {
|
|
132
|
+
try {
|
|
133
|
+
await connection.sobject('sharinpix__FormTemplate__c').delete(record.Id);
|
|
134
|
+
this.log(messages.getMessage('info.deleted', [recordName]));
|
|
135
|
+
deleted++;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
this.warn(`Failed to delete form template ${recordName}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
139
|
+
failed++;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
this.log(messages.getMessage('info.summary', [uploaded, failed, skipped, deleted]));
|
|
126
145
|
return {
|
|
127
146
|
name: 'OK',
|
|
128
147
|
uploaded,
|
|
129
148
|
failed,
|
|
130
149
|
skipped,
|
|
150
|
+
deleted,
|
|
131
151
|
};
|
|
132
152
|
}
|
|
133
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/form/push.ts"],"names":[],"mapp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4B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;wBACzE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;wBAC5D,OAAO,EAAE,CAAC;oBACZ,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,IAAI,CAAC,IAAI,CACP,kCAAkC,UAAU,KAC1C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;wBACF,MAAM,EAAE,CAAC;oBACX,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QAEpF,OAAO;YACL,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,MAAM;YACN,OAAO;YACP,OAAO;SACR,CAAC;IACJ,CAAC"}
|
|
@@ -20,8 +20,8 @@ export default class Pull extends SfCommand {
|
|
|
20
20
|
async run() {
|
|
21
21
|
const { flags } = await this.parse(Pull);
|
|
22
22
|
const connection = flags.org.getConnection('63.0');
|
|
23
|
-
fs.mkdirSync('sharinpix/
|
|
24
|
-
const records = (await connection.query('SELECT Id, Name, sharinpix__Description__c,
|
|
23
|
+
fs.mkdirSync('sharinpix/permissions', { recursive: true });
|
|
24
|
+
const records = (await connection.query('SELECT Id, Name, sharinpix__Description__c, sharinpix__Json__c FROM sharinpix__SharinPixPermission__c order by LastModifiedDate desc')).records;
|
|
25
25
|
let permissionsDownloaded = 0;
|
|
26
26
|
let permissionsFailed = 0;
|
|
27
27
|
for (const record of records) {
|
|
@@ -32,7 +32,7 @@ export default class Pull extends SfCommand {
|
|
|
32
32
|
name: record.Name,
|
|
33
33
|
};
|
|
34
34
|
const safeFilename = createSafeFilename(record.Name);
|
|
35
|
-
fs.writeFileSync(`sharinpix/
|
|
35
|
+
fs.writeFileSync(`sharinpix/permissions/${safeFilename}.json`, JSON.stringify(permissionData, null, 2));
|
|
36
36
|
this.log(messages.getMessage('info.hello', [record.Name, record.sharinpix__Description__c || 'No description']));
|
|
37
37
|
permissionsDownloaded++;
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/permission/pull.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,2BAA2B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/permission/pull.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,2BAA2B,CAAC,C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CAAC,IAAI,CAAC,CAAC;gBACrD,EAAE,CAAC,aAAa,CAAC,yBAAyB,YAAY,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACxG,IAAI,CAAC,GAAG,CACN,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,yBAAyB,IAAI,gBAAgB,CAAC,CAAC,CACvG,CAAC;gBACF,qBAAqB,EAAE,CAAC;YAC1B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,8EAA8E;gBAC9E,IAAI,CAAC,IAAI,CACP,wCAAwC,MAAM,CAAC,IAAI,KACjD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;gBACF,iBAAiB,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,2BAA2B,qBAAqB,6BAA6B,iBAAiB,UAAU,CAAC,CAAC;QAEnH,OAAO;YACL,IAAI,EAAE,IAAI;YACV,qBAAqB;YACrB,iBAAiB;SAClB,CAAC;IACJ,CAAC"}
|
|
@@ -4,6 +4,7 @@ export type PushResult = {
|
|
|
4
4
|
uploaded?: number;
|
|
5
5
|
failed?: number;
|
|
6
6
|
skipped?: number;
|
|
7
|
+
deleted?: number;
|
|
7
8
|
};
|
|
8
9
|
export default class Push extends SfCommand<PushResult> {
|
|
9
10
|
static readonly summary: string;
|
|
@@ -11,6 +12,7 @@ export default class Push extends SfCommand<PushResult> {
|
|
|
11
12
|
static readonly examples: string[];
|
|
12
13
|
static readonly flags: {
|
|
13
14
|
org: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
delete: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
16
|
};
|
|
15
17
|
run(): Promise<PushResult>;
|
|
16
18
|
}
|
|
@@ -17,28 +17,26 @@ export default class Push extends SfCommand {
|
|
|
17
17
|
summary: messages.getMessage('flags.org.summary'),
|
|
18
18
|
description: messages.getMessage('flags.org.description'),
|
|
19
19
|
}),
|
|
20
|
+
delete: Flags.boolean({
|
|
21
|
+
char: 'd',
|
|
22
|
+
summary: messages.getMessage('flags.delete.summary'),
|
|
23
|
+
description: messages.getMessage('flags.delete.description'),
|
|
24
|
+
default: false,
|
|
25
|
+
}),
|
|
20
26
|
};
|
|
21
27
|
async run() {
|
|
22
28
|
const { flags } = await this.parse(Push);
|
|
23
29
|
const connection = flags.org.getConnection('63.0');
|
|
24
30
|
const files = fs
|
|
25
|
-
.readdirSync('sharinpix/
|
|
31
|
+
.readdirSync('sharinpix/permissions')
|
|
26
32
|
.filter((file) => file.endsWith('.json'))
|
|
27
|
-
.map((file) => path.join('sharinpix/
|
|
28
|
-
|
|
29
|
-
this.log('No SharinPix permission files found in the specified directory.');
|
|
30
|
-
return {
|
|
31
|
-
name: 'OK',
|
|
32
|
-
uploaded: 0,
|
|
33
|
-
failed: 0,
|
|
34
|
-
skipped: 0,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
const existingRecords = (await connection.query('SELECT Id, Name, sharinpix__Description__c, sharinpix__ID__c, sharinpix__Json__c FROM sharinpix__SharinPixPermission__c')).records;
|
|
33
|
+
.map((file) => path.join('sharinpix/permissions', file));
|
|
34
|
+
const existingRecords = (await connection.query('SELECT Id, Name, sharinpix__Description__c, sharinpix__Json__c FROM sharinpix__SharinPixPermission__c')).records;
|
|
38
35
|
const existingMap = new Map(existingRecords.map((record) => [record.Name, record]));
|
|
39
36
|
let uploaded = 0;
|
|
40
37
|
let failed = 0;
|
|
41
38
|
let skipped = 0;
|
|
39
|
+
let deleted = 0;
|
|
42
40
|
for (const file of files) {
|
|
43
41
|
try {
|
|
44
42
|
const fileContent = fs.readFileSync(file, 'utf8');
|
|
@@ -96,12 +94,34 @@ export default class Push extends SfCommand {
|
|
|
96
94
|
continue;
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
|
-
|
|
97
|
+
// Handle deletion of records that no longer have corresponding local files
|
|
98
|
+
if (flags.delete) {
|
|
99
|
+
const localFileNames = new Set(files.map((file) => {
|
|
100
|
+
const fileContent = fs.readFileSync(file, 'utf8');
|
|
101
|
+
const json = JSON.parse(fileContent);
|
|
102
|
+
return json.name;
|
|
103
|
+
}));
|
|
104
|
+
for (const [recordName, record] of existingMap) {
|
|
105
|
+
if (!localFileNames.has(recordName)) {
|
|
106
|
+
try {
|
|
107
|
+
await connection.sobject('sharinpix__SharinPixPermission__c').delete(record.Id);
|
|
108
|
+
this.log(messages.getMessage('info.deleted', [recordName]));
|
|
109
|
+
deleted++;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
this.warn(`Failed to delete SharinPix permission ${recordName}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
113
|
+
failed++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
this.log(messages.getMessage('info.summary', [uploaded, failed, skipped, deleted]));
|
|
100
119
|
return {
|
|
101
120
|
name: 'OK',
|
|
102
121
|
uploaded,
|
|
103
122
|
failed,
|
|
104
123
|
skipped,
|
|
124
|
+
deleted,
|
|
105
125
|
};
|
|
106
126
|
}
|
|
107
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/permission/push.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAA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CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;wBACF,MAAM,EAAE,CAAC;oBACX,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QAEpF,OAAO;YACL,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,MAAM;YACN,OAAO;YACP,OAAO;SACR,CAAC;IACJ,CAAC"}
|
|
@@ -14,6 +14,14 @@ The Salesforce org to push form templates to.
|
|
|
14
14
|
|
|
15
15
|
The target Salesforce org where the SharinPix form templates will be uploaded and stored.
|
|
16
16
|
|
|
17
|
+
# flags.delete.summary
|
|
18
|
+
|
|
19
|
+
Delete form templates from org that no longer have corresponding local files.
|
|
20
|
+
|
|
21
|
+
# flags.delete.description
|
|
22
|
+
|
|
23
|
+
When enabled, this flag will delete form template records from the Salesforce org if their corresponding local JSON files are missing. Use with caution as this operation cannot be undone.
|
|
24
|
+
|
|
17
25
|
# examples
|
|
18
26
|
|
|
19
27
|
- Push all form templates to the default org:
|
|
@@ -24,6 +32,10 @@ The target Salesforce org where the SharinPix form templates will be uploaded an
|
|
|
24
32
|
|
|
25
33
|
<%= config.bin %> <%= command.id %> --target-org myorg@example.com
|
|
26
34
|
|
|
35
|
+
- Push form templates and delete orphaned records:
|
|
36
|
+
|
|
37
|
+
<%= config.bin %> <%= command.id %> --delete
|
|
38
|
+
|
|
27
39
|
# info.created
|
|
28
40
|
|
|
29
41
|
Created form template %s
|
|
@@ -36,6 +48,10 @@ Updated form template %s
|
|
|
36
48
|
|
|
37
49
|
Skipped form template %s (no changes detected)
|
|
38
50
|
|
|
51
|
+
# info.deleted
|
|
52
|
+
|
|
53
|
+
Deleted form template %s
|
|
54
|
+
|
|
39
55
|
# info.summary
|
|
40
56
|
|
|
41
|
-
Push completed: %d forms uploaded, %d forms failed, %d forms skipped
|
|
57
|
+
Push completed: %d forms uploaded, %d forms failed, %d forms skipped, %d forms deleted
|
|
@@ -4,7 +4,7 @@ Pull SharinPix permissions from Salesforce org.
|
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local sharinpix/
|
|
7
|
+
Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local sharinpix/permissions directory. This command fetches the permission metadata and the JSON configuration data stored in the sharinpix**Json**c field.
|
|
8
8
|
|
|
9
9
|
# flags.org.summary
|
|
10
10
|
|
|
@@ -14,6 +14,14 @@ The Salesforce org to push SharinPix permissions to.
|
|
|
14
14
|
|
|
15
15
|
The target Salesforce org where the SharinPix permissions will be uploaded and stored.
|
|
16
16
|
|
|
17
|
+
# flags.delete.summary
|
|
18
|
+
|
|
19
|
+
Delete SharinPix permissions from org that no longer have corresponding local files.
|
|
20
|
+
|
|
21
|
+
# flags.delete.description
|
|
22
|
+
|
|
23
|
+
When enabled, this flag will delete SharinPix permission records from the Salesforce org if their corresponding local JSON files are missing. Use with caution as this operation cannot be undone.
|
|
24
|
+
|
|
17
25
|
# examples
|
|
18
26
|
|
|
19
27
|
- Push all SharinPix permissions to the default org:
|
|
@@ -24,6 +32,10 @@ The target Salesforce org where the SharinPix permissions will be uploaded and s
|
|
|
24
32
|
|
|
25
33
|
<%= config.bin %> <%= command.id %> --target-org myorg@example.com
|
|
26
34
|
|
|
35
|
+
- Push SharinPix permissions and delete orphaned records:
|
|
36
|
+
|
|
37
|
+
<%= config.bin %> <%= command.id %> --delete
|
|
38
|
+
|
|
27
39
|
# info.created
|
|
28
40
|
|
|
29
41
|
Created SharinPix permission %s
|
|
@@ -36,6 +48,10 @@ Updated SharinPix permission %s
|
|
|
36
48
|
|
|
37
49
|
Skipped SharinPix permission %s (no changes detected)
|
|
38
50
|
|
|
51
|
+
# info.deleted
|
|
52
|
+
|
|
53
|
+
Deleted SharinPix permission %s
|
|
54
|
+
|
|
39
55
|
# info.summary
|
|
40
56
|
|
|
41
|
-
Push completed: %d permissions uploaded, %d permissions failed, %d permissions skipped
|
|
57
|
+
Push completed: %d permissions uploaded, %d permissions failed, %d permissions skipped, %d permissions deleted
|
package/oclif.manifest.json
CHANGED
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"description": "Uploads SharinPix form templates from local JSON files to the connected Salesforce org. This command reads form templates from the local directory and creates or updates corresponding records in Salesforce. Existing forms will be updated unless the force flag is used to skip them.",
|
|
70
70
|
"examples": [
|
|
71
71
|
"Push all form templates to the default org:\n<%= config.bin %> <%= command.id %>",
|
|
72
|
-
"Push form templates to a specific org:\n<%= config.bin %> <%= command.id %> --target-org myorg@example.com"
|
|
72
|
+
"Push form templates to a specific org:\n<%= config.bin %> <%= command.id %> --target-org myorg@example.com",
|
|
73
|
+
"Push form templates and delete orphaned records:\n<%= config.bin %> <%= command.id %> --delete"
|
|
73
74
|
],
|
|
74
75
|
"flags": {
|
|
75
76
|
"json": {
|
|
@@ -97,6 +98,14 @@
|
|
|
97
98
|
"hasDynamicHelp": true,
|
|
98
99
|
"multiple": false,
|
|
99
100
|
"type": "option"
|
|
101
|
+
},
|
|
102
|
+
"delete": {
|
|
103
|
+
"char": "d",
|
|
104
|
+
"description": "When enabled, this flag will delete form template records from the Salesforce org if their corresponding local JSON files are missing. Use with caution as this operation cannot be undone.",
|
|
105
|
+
"name": "delete",
|
|
106
|
+
"summary": "Delete form templates from org that no longer have corresponding local files.",
|
|
107
|
+
"allowNo": false,
|
|
108
|
+
"type": "boolean"
|
|
100
109
|
}
|
|
101
110
|
},
|
|
102
111
|
"hasDynamicHelp": true,
|
|
@@ -129,7 +138,7 @@
|
|
|
129
138
|
"sharinpix:permission:pull": {
|
|
130
139
|
"aliases": [],
|
|
131
140
|
"args": {},
|
|
132
|
-
"description": "Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local sharinpix/
|
|
141
|
+
"description": "Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local sharinpix/permissions directory. This command fetches the permission metadata and the JSON configuration data stored in the sharinpix**Json**c field.",
|
|
133
142
|
"examples": [
|
|
134
143
|
"Pull all SharinPix permissions from the default org:\n<%= config.bin %> <%= command.id %>",
|
|
135
144
|
"Pull SharinPix permissions from a specific org:\n<%= config.bin %> <%= command.id %> --target-org myorg@example.com"
|
|
@@ -195,7 +204,8 @@
|
|
|
195
204
|
"description": "Uploads SharinPix permissions from local JSON files to the connected Salesforce org. This command reads permission configurations from the local directory and creates or updates corresponding records in Salesforce. The sharinpix**Json**c field will be updated with the JSON configuration data.",
|
|
196
205
|
"examples": [
|
|
197
206
|
"Push all SharinPix permissions to the default org:\n<%= config.bin %> <%= command.id %>",
|
|
198
|
-
"Push SharinPix permissions to a specific org:\n<%= config.bin %> <%= command.id %> --target-org myorg@example.com"
|
|
207
|
+
"Push SharinPix permissions to a specific org:\n<%= config.bin %> <%= command.id %> --target-org myorg@example.com",
|
|
208
|
+
"Push SharinPix permissions and delete orphaned records:\n<%= config.bin %> <%= command.id %> --delete"
|
|
199
209
|
],
|
|
200
210
|
"flags": {
|
|
201
211
|
"json": {
|
|
@@ -223,6 +233,14 @@
|
|
|
223
233
|
"hasDynamicHelp": true,
|
|
224
234
|
"multiple": false,
|
|
225
235
|
"type": "option"
|
|
236
|
+
},
|
|
237
|
+
"delete": {
|
|
238
|
+
"char": "d",
|
|
239
|
+
"description": "When enabled, this flag will delete SharinPix permission records from the Salesforce org if their corresponding local JSON files are missing. Use with caution as this operation cannot be undone.",
|
|
240
|
+
"name": "delete",
|
|
241
|
+
"summary": "Delete SharinPix permissions from org that no longer have corresponding local files.",
|
|
242
|
+
"allowNo": false,
|
|
243
|
+
"type": "boolean"
|
|
226
244
|
}
|
|
227
245
|
},
|
|
228
246
|
"hasDynamicHelp": true,
|
|
@@ -253,5 +271,5 @@
|
|
|
253
271
|
]
|
|
254
272
|
}
|
|
255
273
|
},
|
|
256
|
-
"version": "1.
|
|
274
|
+
"version": "1.8.0"
|
|
257
275
|
}
|