@sharinpix/sharinpix-sf-cli 1.2.0 → 1.4.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 CHANGED
@@ -34,10 +34,12 @@ This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.co
34
34
 
35
35
  We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
36
36
 
37
- ## Install
37
+ ## Usage
38
38
 
39
39
  ```bash
40
- sf plugins install @sharinpix/sharinpix-sf-cli@x.y.z
40
+ sf org login web
41
+ sf plugins install @sharinpix/sharinpix-sf-cli
42
+ sf sharinpix form pull -o yourusername@salesforce.com
41
43
  ```
42
44
 
43
45
  ## Issues
@@ -95,6 +97,9 @@ sf plugins
95
97
 
96
98
  <!-- commands -->
97
99
  * [`sf sharinpix form pull`](#sf-sharinpix-form-pull)
100
+ * [`sf sharinpix form push`](#sf-sharinpix-form-push)
101
+ * [`sf sharinpix permission pull`](#sf-sharinpix-permission-pull)
102
+ * [`sf sharinpix permission push`](#sf-sharinpix-permission-push)
98
103
 
99
104
  ## `sf sharinpix form pull`
100
105
 
@@ -132,4 +137,115 @@ FLAG DESCRIPTIONS
132
137
 
133
138
  The target Salesforce org containing the SharinPix form templates to be pulled.
134
139
  ```
140
+
141
+ ## `sf sharinpix form push`
142
+
143
+ Push SharinPix form templates to Salesforce org.
144
+
145
+ ```
146
+ USAGE
147
+ $ sf sharinpix form push -o <value> [--json] [--flags-dir <value>]
148
+
149
+ FLAGS
150
+ -o, --org=<value> (required) The Salesforce org to push form templates to.
151
+
152
+ GLOBAL FLAGS
153
+ --flags-dir=<value> Import flag values from a directory.
154
+ --json Format output as json.
155
+
156
+ DESCRIPTION
157
+ Push SharinPix form templates to Salesforce org.
158
+
159
+ Uploads SharinPix form templates from local JSON files to the connected Salesforce org. This command reads form
160
+ templates from the local directory and creates or updates corresponding records in Salesforce. Existing forms will be
161
+ updated unless the force flag is used to skip them.
162
+
163
+ EXAMPLES
164
+ Push all form templates to the default org:
165
+
166
+ $ sf sharinpix form push
167
+
168
+ Push form templates to a specific org:
169
+
170
+ $ sf sharinpix form push --target-org myorg@example.com
171
+
172
+ FLAG DESCRIPTIONS
173
+ -o, --org=<value> The Salesforce org to push form templates to.
174
+
175
+ The target Salesforce org where the SharinPix form templates will be uploaded and stored.
176
+ ```
177
+
178
+ ## `sf sharinpix permission pull`
179
+
180
+ Pull SharinPix permissions from Salesforce org.
181
+
182
+ ```
183
+ USAGE
184
+ $ sf sharinpix permission pull -o <value> [--json] [--flags-dir <value>]
185
+
186
+ FLAGS
187
+ -o, --org=<value> (required) The Salesforce org to pull SharinPix permissions from.
188
+
189
+ GLOBAL FLAGS
190
+ --flags-dir=<value> Import flag values from a directory.
191
+ --json Format output as json.
192
+
193
+ DESCRIPTION
194
+ Pull SharinPix permissions from Salesforce org.
195
+
196
+ Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local
197
+ sharinpix/permission directory. This command fetches the permission metadata and the JSON configuration data stored in
198
+ the sharinpix**Json**c field.
199
+
200
+ EXAMPLES
201
+ Pull all SharinPix permissions from the default org:
202
+
203
+ $ sf sharinpix permission pull
204
+
205
+ Pull SharinPix permissions from a specific org:
206
+
207
+ $ sf sharinpix permission pull --target-org myorg@example.com
208
+
209
+ FLAG DESCRIPTIONS
210
+ -o, --org=<value> The Salesforce org to pull SharinPix permissions from.
211
+
212
+ The target Salesforce org containing the SharinPix permissions to be pulled.
213
+ ```
214
+
215
+ ## `sf sharinpix permission push`
216
+
217
+ Push SharinPix permissions to Salesforce org.
218
+
219
+ ```
220
+ USAGE
221
+ $ sf sharinpix permission push -o <value> [--json] [--flags-dir <value>]
222
+
223
+ FLAGS
224
+ -o, --org=<value> (required) The Salesforce org to push SharinPix permissions to.
225
+
226
+ GLOBAL FLAGS
227
+ --flags-dir=<value> Import flag values from a directory.
228
+ --json Format output as json.
229
+
230
+ DESCRIPTION
231
+ Push SharinPix permissions to Salesforce org.
232
+
233
+ Uploads SharinPix permissions from local JSON files to the connected Salesforce org. This command reads permission
234
+ configurations from the local directory and creates or updates corresponding records in Salesforce. The
235
+ sharinpix**Json**c field will be updated with the JSON configuration data.
236
+
237
+ EXAMPLES
238
+ Push all SharinPix permissions to the default org:
239
+
240
+ $ sf sharinpix permission push
241
+
242
+ Push SharinPix permissions to a specific org:
243
+
244
+ $ sf sharinpix permission push --target-org myorg@example.com
245
+
246
+ FLAG DESCRIPTIONS
247
+ -o, --org=<value> The Salesforce org to push SharinPix permissions to.
248
+
249
+ The target Salesforce org where the SharinPix permissions will be uploaded and stored.
250
+ ```
135
251
  <!-- commandsstop -->
@@ -0,0 +1,16 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type PushResult = {
3
+ name: string;
4
+ uploaded?: number;
5
+ failed?: number;
6
+ skipped?: number;
7
+ };
8
+ export default class Push extends SfCommand<PushResult> {
9
+ static readonly summary: string;
10
+ static readonly description: string;
11
+ static readonly examples: string[];
12
+ static readonly flags: {
13
+ org: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
14
+ };
15
+ run(): Promise<PushResult>;
16
+ }
@@ -0,0 +1,129 @@
1
+ /* eslint-disable no-console */
2
+ /* eslint-disable no-await-in-loop */
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
6
+ import { Messages } from '@salesforce/core';
7
+ import { isJsonEqual } from '../../../helpers/json-utils.js';
8
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
9
+ const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', 'sharinpix.form.push');
10
+ export default class Push extends SfCommand {
11
+ static summary = messages.getMessage('summary');
12
+ static description = messages.getMessage('description');
13
+ static examples = messages.getMessages('examples');
14
+ static flags = {
15
+ org: Flags.requiredOrg({
16
+ char: 'o',
17
+ summary: messages.getMessage('flags.org.summary'),
18
+ description: messages.getMessage('flags.org.description'),
19
+ }),
20
+ };
21
+ async run() {
22
+ const { flags } = await this.parse(Push);
23
+ const connection = flags.org.getConnection('63.0');
24
+ const files = fs
25
+ .readdirSync('sharinpix/forms')
26
+ .filter((file) => file.endsWith('.json'))
27
+ .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
+ const responseToken = await connection.apex.post('/sharinpix/Token', {
38
+ // eslint-disable-next-line camelcase
39
+ form_template_create: true,
40
+ });
41
+ const existingRecords = (await connection.query('SELECT Id, Name, sharinpix__FormUrl__c, sharinpix__Description__c FROM sharinpix__FormTemplate__c')).records;
42
+ const existingMap = new Map(existingRecords.map((record) => [record.Name, record]));
43
+ let uploaded = 0;
44
+ let failed = 0;
45
+ let skipped = 0;
46
+ for (const file of files) {
47
+ try {
48
+ const fileName = path.basename(file, '.json');
49
+ const fileContent = fs.readFileSync(file, 'utf8');
50
+ const json = JSON.parse(fileContent);
51
+ const existingRecord = existingMap.get(fileName);
52
+ const existingId = existingRecord?.Id ?? null;
53
+ if (existingRecord) {
54
+ // Check if form has changed by comparing with stored JSON
55
+ const response = await fetch(existingRecord?.sharinpix__FormUrl__c + '.json', {
56
+ headers: {
57
+ Accept: 'application/json',
58
+ },
59
+ });
60
+ if (!response.ok) {
61
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
62
+ }
63
+ const existingJson = await response.json();
64
+ if (existingJson) {
65
+ try {
66
+ if (isJsonEqual(json, existingJson)) {
67
+ this.log(messages.getMessage('info.skipped', [fileName]));
68
+ skipped++;
69
+ continue;
70
+ }
71
+ }
72
+ catch (parseError) {
73
+ this.warn(`Failed to parse stored JSON for ${fileName}, proceeding with update`);
74
+ failed++;
75
+ continue;
76
+ }
77
+ }
78
+ }
79
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
80
+ const responseData = await (await fetch(`${responseToken.host}/api/v1/form/templates`, {
81
+ method: 'POST',
82
+ body: JSON.stringify({
83
+ sfid: existingId ?? undefined,
84
+ config: {
85
+ name: fileName,
86
+ ...json,
87
+ },
88
+ }),
89
+ headers: {
90
+ 'Content-Type': 'application/json',
91
+ Accept: 'application/json',
92
+ Authorization: `Bearer ${responseToken.token}`,
93
+ },
94
+ })).json();
95
+ const formTemplateJson = JSON.stringify({
96
+ ...json,
97
+ url: responseData.url,
98
+ });
99
+ await connection.apex.post('/sharinpix/FormTemplateImport', {
100
+ recordId: existingId ?? undefined,
101
+ name: fileName,
102
+ url: responseData.url,
103
+ formTemplateJson,
104
+ });
105
+ if (existingId) {
106
+ this.log(messages.getMessage('info.updated', [fileName]));
107
+ }
108
+ else {
109
+ this.log(messages.getMessage('info.created', [fileName]));
110
+ }
111
+ uploaded++;
112
+ }
113
+ catch (error) {
114
+ const fileName = path.basename(file, '.json');
115
+ this.warn(`Failed to push form template ${fileName}: ${error instanceof Error ? error.message : 'Unknown error'}`);
116
+ failed++;
117
+ continue;
118
+ }
119
+ }
120
+ this.log(messages.getMessage('info.summary', [uploaded, failed, skipped]));
121
+ return {
122
+ name: 'OK',
123
+ uploaded,
124
+ failed,
125
+ skipped,
126
+ };
127
+ }
128
+ }
129
+ //# sourceMappingURL=push.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/form/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,EAAE,MAAM,gCAAgC,CAAC;AAE7D,QAAQ,CAAC,kCAAkC,CAAC,MA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7
+ export default class Pull extends SfCommand<PullResult> {
8
+ static readonly summary: string;
9
+ static readonly description: string;
10
+ static readonly examples: string[];
11
+ static readonly flags: {
12
+ org: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<PullResult>;
15
+ }
@@ -0,0 +1,47 @@
1
+ /* eslint-disable no-console */
2
+ /* eslint-disable no-await-in-loop */
3
+ import fs from 'node:fs';
4
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
5
+ import { Messages } from '@salesforce/core';
6
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
7
+ const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', 'sharinpix.permission.pull');
8
+ export default class Pull extends SfCommand {
9
+ static summary = messages.getMessage('summary');
10
+ static description = messages.getMessage('description');
11
+ static examples = messages.getMessages('examples');
12
+ static flags = {
13
+ org: Flags.requiredOrg({
14
+ char: 'o',
15
+ summary: messages.getMessage('flags.org.summary'),
16
+ description: messages.getMessage('flags.org.description'),
17
+ }),
18
+ };
19
+ async run() {
20
+ const { flags } = await this.parse(Pull);
21
+ const connection = flags.org.getConnection('63.0');
22
+ fs.mkdirSync('sharinpix/permission', { recursive: true });
23
+ const records = (await connection.query('SELECT Id, Name, sharinpix__Description__c, sharinpix__ID__c, sharinpix__Json__c FROM sharinpix__SharinPixPermission__c order by LastModifiedDate desc')).records;
24
+ let permissionsDownloaded = 0;
25
+ let permissionsFailed = 0;
26
+ for (const record of records) {
27
+ try {
28
+ const permissionData = JSON.parse(record.sharinpix__Json__c);
29
+ fs.writeFileSync(`sharinpix/permission/${record.Name}.json`, JSON.stringify(permissionData, null, 2));
30
+ this.log(messages.getMessage('info.hello', [record.Name, record.sharinpix__Description__c || 'No description']));
31
+ permissionsDownloaded++;
32
+ }
33
+ catch (error) {
34
+ // Skip permissions that can't be fetched (e.g., network errors, invalid data)
35
+ this.warn(`Failed to fetch SharinPix permission ${record.Name}: ${error instanceof Error ? error.message : 'Unknown error'}`);
36
+ permissionsFailed++;
37
+ }
38
+ }
39
+ this.log(`Successfully downloaded ${permissionsDownloaded} SharinPix permission(s). ${permissionsFailed} failed.`);
40
+ return {
41
+ name: 'OK',
42
+ permissionsDownloaded,
43
+ permissionsFailed,
44
+ };
45
+ }
46
+ }
47
+ //# sourceMappingURL=pull.js.map
@@ -0,0 +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;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,2BAA2B,CAAC,CAAC;AAgBnG,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAqB;IAC9C,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC;YACrB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC;YACjD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC;SAC1D,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,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QAEnH,OAAO;YACL,IAAI,EAAE,IAAI;YACV,qBAAqB;YACrB,iBAAiB;SAClB,CAAC;IACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type PushResult = {
3
+ name: string;
4
+ uploaded?: number;
5
+ failed?: number;
6
+ skipped?: number;
7
+ };
8
+ export default class Push extends SfCommand<PushResult> {
9
+ static readonly summary: string;
10
+ static readonly description: string;
11
+ static readonly examples: string[];
12
+ static readonly flags: {
13
+ org: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
14
+ };
15
+ run(): Promise<PushResult>;
16
+ }
@@ -0,0 +1,104 @@
1
+ /* eslint-disable no-console */
2
+ /* eslint-disable no-await-in-loop */
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
6
+ import { Messages } from '@salesforce/core';
7
+ import { isJsonEqual } from '../../../helpers/json-utils.js';
8
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
9
+ const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', 'sharinpix.permission.push');
10
+ export default class Push extends SfCommand {
11
+ static summary = messages.getMessage('summary');
12
+ static description = messages.getMessage('description');
13
+ static examples = messages.getMessages('examples');
14
+ static flags = {
15
+ org: Flags.requiredOrg({
16
+ char: 'o',
17
+ summary: messages.getMessage('flags.org.summary'),
18
+ description: messages.getMessage('flags.org.description'),
19
+ }),
20
+ };
21
+ async run() {
22
+ const { flags } = await this.parse(Push);
23
+ const connection = flags.org.getConnection('63.0');
24
+ const files = fs
25
+ .readdirSync('sharinpix/permission')
26
+ .filter((file) => file.endsWith('.json'))
27
+ .map((file) => path.join('sharinpix/permission', file));
28
+ if (files.length === 0) {
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;
38
+ const existingMap = new Map(existingRecords.map((record) => [record.Name, record]));
39
+ let uploaded = 0;
40
+ let failed = 0;
41
+ let skipped = 0;
42
+ for (const file of files) {
43
+ try {
44
+ const fileName = path.basename(file, '.json');
45
+ const fileContent = fs.readFileSync(file, 'utf8');
46
+ const json = JSON.parse(fileContent);
47
+ const existingRecord = existingMap.get(fileName);
48
+ const existingId = existingRecord?.Id ?? null;
49
+ if (existingRecord) {
50
+ // Check if permission has changed by comparing with stored JSON
51
+ try {
52
+ const existingJson = JSON.parse(existingRecord.sharinpix__Json__c);
53
+ if (isJsonEqual(json, existingJson)) {
54
+ this.log(messages.getMessage('info.skipped', [fileName]));
55
+ skipped++;
56
+ continue;
57
+ }
58
+ }
59
+ catch (parseError) {
60
+ this.warn(`Failed to parse stored JSON for ${fileName}, proceeding with update`);
61
+ }
62
+ }
63
+ // Update or create the permission record
64
+ const permissionData = {
65
+ Name: fileName,
66
+ // eslint-disable-next-line camelcase
67
+ sharinpix__Json__c: JSON.stringify(json),
68
+ ...(existingRecord?.sharinpix__Description__c && {
69
+ // eslint-disable-next-line camelcase
70
+ sharinpix__Description__c: existingRecord.sharinpix__Description__c,
71
+ }),
72
+ };
73
+ if (existingId) {
74
+ // Update existing record
75
+ await connection.sobject('sharinpix__SharinPixPermission__c').update({
76
+ ...permissionData,
77
+ Id: existingId,
78
+ });
79
+ this.log(messages.getMessage('info.updated', [fileName]));
80
+ }
81
+ else {
82
+ // Create new record
83
+ await connection.sobject('sharinpix__SharinPixPermission__c').create(permissionData);
84
+ this.log(messages.getMessage('info.created', [fileName]));
85
+ }
86
+ uploaded++;
87
+ }
88
+ catch (error) {
89
+ const fileName = path.basename(file, '.json');
90
+ this.warn(`Failed to push SharinPix permission ${fileName}: ${error instanceof Error ? error.message : 'Unknown error'}`);
91
+ failed++;
92
+ continue;
93
+ }
94
+ }
95
+ this.log(messages.getMessage('info.summary', [uploaded, failed, skipped]));
96
+ return {
97
+ name: 'OK',
98
+ uploaded,
99
+ failed,
100
+ skipped,
101
+ };
102
+ }
103
+ }
104
+ //# sourceMappingURL=push.js.map
@@ -0,0 +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,EAAE,MAAM,gCAAgC,CAAC;AAE7D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,2BAA2B,CAAC,CAAC;AAiBnG,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAqB;IAC9C,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC;YACrB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC;YACjD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC;SAC1D,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,G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cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC5D,CAAC;qBAAM,CAAC;oBACN,oBAAoB;oBACpB,MAAM,UAAU,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;oBACrF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC5D,CAAC;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC9C,IAAI,CAAC,IAAI,CACP,uCAAuC,QAAQ,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAC/G,CAAC;gBACF,MAAM,EAAE,CAAC;gBACT,SAAS;YACX,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QAE3E,OAAO;YACL,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,MAAM;YACN,OAAO;SACR,CAAC;IACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function isJsonEqual(obj1: unknown, obj2: unknown): boolean;
@@ -0,0 +1,4 @@
1
+ export function isJsonEqual(obj1, obj2) {
2
+ return JSON.stringify(obj1) === JSON.stringify(obj2);
3
+ }
4
+ //# sourceMappingURL=json-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-utils.js","sourceRoot":"","sources":["../../src/helpers/json-utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,IAAa,EAAE,IAAa;IACtD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- declare const _default: {};
2
- export default _default;
1
+ export { default as formPull } from './commands/sharinpix/form/pull.js';
2
+ export { default as formPush } from './commands/sharinpix/form/push.js';
3
+ export { default as permissionPull } from './commands/sharinpix/permission/pull.js';
4
+ export { default as permissionPush } from './commands/sharinpix/permission/push.js';
package/lib/index.js CHANGED
@@ -1,2 +1,5 @@
1
- export default {};
1
+ export { default as formPull } from './commands/sharinpix/form/pull.js';
2
+ export { default as formPush } from './commands/sharinpix/form/push.js';
3
+ export { default as permissionPull } from './commands/sharinpix/permission/pull.js';
4
+ export { default as permissionPush } from './commands/sharinpix/permission/push.js';
2
5
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yCAAyC,CAAC"}
@@ -0,0 +1,41 @@
1
+ # summary
2
+
3
+ Push SharinPix form templates to Salesforce org.
4
+
5
+ # description
6
+
7
+ 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.
8
+
9
+ # flags.org.summary
10
+
11
+ The Salesforce org to push form templates to.
12
+
13
+ # flags.org.description
14
+
15
+ The target Salesforce org where the SharinPix form templates will be uploaded and stored.
16
+
17
+ # examples
18
+
19
+ - Push all form templates to the default org:
20
+
21
+ <%= config.bin %> <%= command.id %>
22
+
23
+ - Push form templates to a specific org:
24
+
25
+ <%= config.bin %> <%= command.id %> --target-org myorg@example.com
26
+
27
+ # info.created
28
+
29
+ Created form template %s
30
+
31
+ # info.updated
32
+
33
+ Updated form template %s
34
+
35
+ # info.skipped
36
+
37
+ Skipped form template %s (no changes detected)
38
+
39
+ # info.summary
40
+
41
+ Push completed: %d forms uploaded, %d forms failed, %d forms skipped
@@ -0,0 +1,29 @@
1
+ # summary
2
+
3
+ Pull SharinPix permissions from Salesforce org.
4
+
5
+ # description
6
+
7
+ Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local sharinpix/permission directory. This command fetches the permission metadata and the JSON configuration data stored in the sharinpix**Json**c field.
8
+
9
+ # flags.org.summary
10
+
11
+ The Salesforce org to pull SharinPix permissions from.
12
+
13
+ # flags.org.description
14
+
15
+ The target Salesforce org containing the SharinPix permissions to be pulled.
16
+
17
+ # examples
18
+
19
+ - Pull all SharinPix permissions from the default org:
20
+
21
+ <%= config.bin %> <%= command.id %>
22
+
23
+ - Pull SharinPix permissions from a specific org:
24
+
25
+ <%= config.bin %> <%= command.id %> --target-org myorg@example.com
26
+
27
+ # info.hello
28
+
29
+ Pulled SharinPix permission %s (%s)
@@ -0,0 +1,41 @@
1
+ # summary
2
+
3
+ Push SharinPix permissions to Salesforce org.
4
+
5
+ # description
6
+
7
+ 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.
8
+
9
+ # flags.org.summary
10
+
11
+ The Salesforce org to push SharinPix permissions to.
12
+
13
+ # flags.org.description
14
+
15
+ The target Salesforce org where the SharinPix permissions will be uploaded and stored.
16
+
17
+ # examples
18
+
19
+ - Push all SharinPix permissions to the default org:
20
+
21
+ <%= config.bin %> <%= command.id %>
22
+
23
+ - Push SharinPix permissions to a specific org:
24
+
25
+ <%= config.bin %> <%= command.id %> --target-org myorg@example.com
26
+
27
+ # info.created
28
+
29
+ Created SharinPix permission %s
30
+
31
+ # info.updated
32
+
33
+ Updated SharinPix permission %s
34
+
35
+ # info.skipped
36
+
37
+ Skipped SharinPix permission %s (no changes detected)
38
+
39
+ # info.summary
40
+
41
+ Push completed: %d permissions uploaded, %d permissions failed, %d permissions skipped
@@ -62,7 +62,196 @@
62
62
  "pull:sharinpix:form",
63
63
  "pull:form:sharinpix"
64
64
  ]
65
+ },
66
+ "sharinpix:form:push": {
67
+ "aliases": [],
68
+ "args": {},
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
+ "examples": [
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"
73
+ ],
74
+ "flags": {
75
+ "json": {
76
+ "description": "Format output as json.",
77
+ "helpGroup": "GLOBAL",
78
+ "name": "json",
79
+ "allowNo": false,
80
+ "type": "boolean"
81
+ },
82
+ "flags-dir": {
83
+ "helpGroup": "GLOBAL",
84
+ "name": "flags-dir",
85
+ "summary": "Import flag values from a directory.",
86
+ "hasDynamicHelp": false,
87
+ "multiple": false,
88
+ "type": "option"
89
+ },
90
+ "org": {
91
+ "char": "o",
92
+ "description": "The target Salesforce org where the SharinPix form templates will be uploaded and stored.",
93
+ "name": "org",
94
+ "noCacheDefault": true,
95
+ "required": true,
96
+ "summary": "The Salesforce org to push form templates to.",
97
+ "hasDynamicHelp": true,
98
+ "multiple": false,
99
+ "type": "option"
100
+ }
101
+ },
102
+ "hasDynamicHelp": true,
103
+ "hiddenAliases": [],
104
+ "id": "sharinpix:form:push",
105
+ "pluginAlias": "@sharinpix/sharinpix-sf-cli",
106
+ "pluginName": "@sharinpix/sharinpix-sf-cli",
107
+ "pluginType": "core",
108
+ "strict": true,
109
+ "summary": "Push SharinPix form templates to Salesforce org.",
110
+ "enableJsonFlag": true,
111
+ "isESM": true,
112
+ "relativePath": [
113
+ "lib",
114
+ "commands",
115
+ "sharinpix",
116
+ "form",
117
+ "push.js"
118
+ ],
119
+ "aliasPermutations": [],
120
+ "permutations": [
121
+ "sharinpix:form:push",
122
+ "form:sharinpix:push",
123
+ "form:push:sharinpix",
124
+ "sharinpix:push:form",
125
+ "push:sharinpix:form",
126
+ "push:form:sharinpix"
127
+ ]
128
+ },
129
+ "sharinpix:permission:pull": {
130
+ "aliases": [],
131
+ "args": {},
132
+ "description": "Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local sharinpix/permission directory. This command fetches the permission metadata and the JSON configuration data stored in the sharinpix**Json**c field.",
133
+ "examples": [
134
+ "Pull all SharinPix permissions from the default org:\n<%= config.bin %> <%= command.id %>",
135
+ "Pull SharinPix permissions from a specific org:\n<%= config.bin %> <%= command.id %> --target-org myorg@example.com"
136
+ ],
137
+ "flags": {
138
+ "json": {
139
+ "description": "Format output as json.",
140
+ "helpGroup": "GLOBAL",
141
+ "name": "json",
142
+ "allowNo": false,
143
+ "type": "boolean"
144
+ },
145
+ "flags-dir": {
146
+ "helpGroup": "GLOBAL",
147
+ "name": "flags-dir",
148
+ "summary": "Import flag values from a directory.",
149
+ "hasDynamicHelp": false,
150
+ "multiple": false,
151
+ "type": "option"
152
+ },
153
+ "org": {
154
+ "char": "o",
155
+ "description": "The target Salesforce org containing the SharinPix permissions to be pulled.",
156
+ "name": "org",
157
+ "noCacheDefault": true,
158
+ "required": true,
159
+ "summary": "The Salesforce org to pull SharinPix permissions from.",
160
+ "hasDynamicHelp": true,
161
+ "multiple": false,
162
+ "type": "option"
163
+ }
164
+ },
165
+ "hasDynamicHelp": true,
166
+ "hiddenAliases": [],
167
+ "id": "sharinpix:permission:pull",
168
+ "pluginAlias": "@sharinpix/sharinpix-sf-cli",
169
+ "pluginName": "@sharinpix/sharinpix-sf-cli",
170
+ "pluginType": "core",
171
+ "strict": true,
172
+ "summary": "Pull SharinPix permissions from Salesforce org.",
173
+ "enableJsonFlag": true,
174
+ "isESM": true,
175
+ "relativePath": [
176
+ "lib",
177
+ "commands",
178
+ "sharinpix",
179
+ "permission",
180
+ "pull.js"
181
+ ],
182
+ "aliasPermutations": [],
183
+ "permutations": [
184
+ "sharinpix:permission:pull",
185
+ "permission:sharinpix:pull",
186
+ "permission:pull:sharinpix",
187
+ "sharinpix:pull:permission",
188
+ "pull:sharinpix:permission",
189
+ "pull:permission:sharinpix"
190
+ ]
191
+ },
192
+ "sharinpix:permission:push": {
193
+ "aliases": [],
194
+ "args": {},
195
+ "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
+ "examples": [
197
+ "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"
199
+ ],
200
+ "flags": {
201
+ "json": {
202
+ "description": "Format output as json.",
203
+ "helpGroup": "GLOBAL",
204
+ "name": "json",
205
+ "allowNo": false,
206
+ "type": "boolean"
207
+ },
208
+ "flags-dir": {
209
+ "helpGroup": "GLOBAL",
210
+ "name": "flags-dir",
211
+ "summary": "Import flag values from a directory.",
212
+ "hasDynamicHelp": false,
213
+ "multiple": false,
214
+ "type": "option"
215
+ },
216
+ "org": {
217
+ "char": "o",
218
+ "description": "The target Salesforce org where the SharinPix permissions will be uploaded and stored.",
219
+ "name": "org",
220
+ "noCacheDefault": true,
221
+ "required": true,
222
+ "summary": "The Salesforce org to push SharinPix permissions to.",
223
+ "hasDynamicHelp": true,
224
+ "multiple": false,
225
+ "type": "option"
226
+ }
227
+ },
228
+ "hasDynamicHelp": true,
229
+ "hiddenAliases": [],
230
+ "id": "sharinpix:permission:push",
231
+ "pluginAlias": "@sharinpix/sharinpix-sf-cli",
232
+ "pluginName": "@sharinpix/sharinpix-sf-cli",
233
+ "pluginType": "core",
234
+ "strict": true,
235
+ "summary": "Push SharinPix permissions to Salesforce org.",
236
+ "enableJsonFlag": true,
237
+ "isESM": true,
238
+ "relativePath": [
239
+ "lib",
240
+ "commands",
241
+ "sharinpix",
242
+ "permission",
243
+ "push.js"
244
+ ],
245
+ "aliasPermutations": [],
246
+ "permutations": [
247
+ "sharinpix:permission:push",
248
+ "permission:sharinpix:push",
249
+ "permission:push:sharinpix",
250
+ "sharinpix:push:permission",
251
+ "push:sharinpix:permission",
252
+ "push:permission:sharinpix"
253
+ ]
65
254
  }
66
255
  },
67
- "version": "1.2.0"
256
+ "version": "1.4.0"
68
257
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sharinpix/sharinpix-sf-cli",
3
3
  "description": "SharinPix salesforce cli plugin",
4
- "version": "1.2.0",
4
+ "version": "1.4.0",
5
5
  "dependencies": {
6
6
  "@oclif/core": "^4",
7
7
  "@salesforce/core": "^8",
@@ -60,7 +60,7 @@
60
60
  "postpack": "sf-clean --ignore-signing-artifacts",
61
61
  "prepack": "sf-prepack",
62
62
  "test": "wireit",
63
- "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
63
+ "test:nuts": "TS_NODE_PROJECT=./test/tsconfig.json nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
64
64
  "test:only": "wireit",
65
65
  "version": "oclif readme",
66
66
  "prepare": "husky",