@sharinpix/sharinpix-sf-cli 1.8.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -2
- package/lib/commands/sharinpix/form/csv2json.d.ts +12 -0
- package/lib/commands/sharinpix/form/csv2json.js +159 -0
- package/lib/commands/sharinpix/form/csv2json.js.map +1 -0
- package/lib/commands/sharinpix/form/json2csv.d.ts +12 -0
- package/lib/commands/sharinpix/form/json2csv.js +97 -0
- package/lib/commands/sharinpix/form/json2csv.js.map +1 -0
- package/lib/commands/sharinpix/form/pull.d.ts +1 -0
- package/lib/commands/sharinpix/form/pull.js +9 -1
- package/lib/commands/sharinpix/form/pull.js.map +1 -1
- package/lib/commands/sharinpix/form/push.d.ts +1 -0
- package/lib/commands/sharinpix/form/push.js +47 -60
- package/lib/commands/sharinpix/form/push.js.map +1 -1
- package/lib/commands/sharinpix/permission/push.js +29 -40
- package/lib/commands/sharinpix/permission/push.js.map +1 -1
- package/lib/helpers/form/elementKeyOrder.d.ts +1 -0
- package/lib/helpers/form/elementKeyOrder.js +53 -0
- package/lib/helpers/form/elementKeyOrder.js.map +1 -0
- package/lib/helpers/utils.d.ts +9 -0
- package/lib/helpers/utils.js +57 -0
- package/lib/helpers/utils.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/messages/sharinpix.form.csv2json.md +49 -0
- package/messages/sharinpix.form.json2csv.md +37 -0
- package/messages/sharinpix.form.pull.md +12 -0
- package/messages/sharinpix.form.push.md +12 -0
- package/oclif.lock +55 -11
- package/oclif.manifest.json +123 -3
- package/package.json +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/form/push.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/form/push.ts"],"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able @typescript-eslint/naming-convention */
|
|
2
2
|
/* eslint-disable no-await-in-loop */
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
3
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
6
4
|
import { Messages } from '@salesforce/core';
|
|
7
|
-
import { isJsonEqual } from '../../../helpers/utils.js';
|
|
5
|
+
import { isJsonEqual, readJsonFile, getNameFromJson, getJsonFiles, formatErrorMessage, } from '../../../helpers/utils.js';
|
|
8
6
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
9
7
|
const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', 'sharinpix.permission.push');
|
|
10
8
|
export default class Push extends SfCommand {
|
|
@@ -27,10 +25,7 @@ export default class Push extends SfCommand {
|
|
|
27
25
|
async run() {
|
|
28
26
|
const { flags } = await this.parse(Push);
|
|
29
27
|
const connection = flags.org.getConnection('63.0');
|
|
30
|
-
const files =
|
|
31
|
-
.readdirSync('sharinpix/permissions')
|
|
32
|
-
.filter((file) => file.endsWith('.json'))
|
|
33
|
-
.map((file) => path.join('sharinpix/permissions', file));
|
|
28
|
+
const files = getJsonFiles('sharinpix/permissions');
|
|
34
29
|
const existingRecords = (await connection.query('SELECT Id, Name, sharinpix__Description__c, sharinpix__Json__c FROM sharinpix__SharinPixPermission__c')).records;
|
|
35
30
|
const existingMap = new Map(existingRecords.map((record) => [record.Name, record]));
|
|
36
31
|
let uploaded = 0;
|
|
@@ -38,29 +33,25 @@ export default class Push extends SfCommand {
|
|
|
38
33
|
let skipped = 0;
|
|
39
34
|
let deleted = 0;
|
|
40
35
|
for (const file of files) {
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const fileName = json.name;
|
|
36
|
+
const processFile = async () => {
|
|
37
|
+
const json = readJsonFile(file);
|
|
38
|
+
const fileName = getNameFromJson(json);
|
|
45
39
|
const existingRecord = existingMap.get(fileName);
|
|
46
|
-
const existingId = existingRecord?.Id ?? null;
|
|
47
40
|
const jsonWithoutName = { ...json };
|
|
48
41
|
delete jsonWithoutName.name;
|
|
49
42
|
if (existingRecord) {
|
|
50
|
-
// Check if permission has changed by comparing with stored JSON
|
|
51
43
|
try {
|
|
52
44
|
const existingJson = JSON.parse(existingRecord.sharinpix__Json__c);
|
|
53
45
|
if (isJsonEqual(jsonWithoutName, existingJson)) {
|
|
54
46
|
this.log(messages.getMessage('info.skipped', [fileName]));
|
|
55
47
|
skipped++;
|
|
56
|
-
|
|
48
|
+
return;
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
51
|
catch (parseError) {
|
|
60
52
|
this.warn(`Failed to parse stored JSON for ${fileName}, proceeding with update`);
|
|
61
53
|
}
|
|
62
54
|
}
|
|
63
|
-
// Update or create the permission record
|
|
64
55
|
const permissionData = {
|
|
65
56
|
Name: fileName,
|
|
66
57
|
// eslint-disable-next-line camelcase
|
|
@@ -70,48 +61,46 @@ export default class Push extends SfCommand {
|
|
|
70
61
|
sharinpix__Description__c: existingRecord.sharinpix__Description__c,
|
|
71
62
|
}),
|
|
72
63
|
};
|
|
73
|
-
if (
|
|
74
|
-
// Update existing record
|
|
64
|
+
if (existingRecord?.Id) {
|
|
75
65
|
await connection.sobject('sharinpix__SharinPixPermission__c').update({
|
|
76
66
|
...permissionData,
|
|
77
|
-
Id:
|
|
67
|
+
Id: existingRecord.Id,
|
|
78
68
|
});
|
|
79
|
-
this.log(messages.getMessage('info.updated', [fileName]));
|
|
80
69
|
}
|
|
81
70
|
else {
|
|
82
|
-
// Create new record
|
|
83
71
|
await connection.sobject('sharinpix__SharinPixPermission__c').create(permissionData);
|
|
84
|
-
this.log(messages.getMessage('info.created', [fileName]));
|
|
85
72
|
}
|
|
73
|
+
this.log(messages.getMessage(existingRecord ? 'info.updated' : 'info.created', [fileName]));
|
|
86
74
|
uploaded++;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
75
|
+
};
|
|
76
|
+
await processFile().catch((error) => {
|
|
77
|
+
try {
|
|
78
|
+
const json = readJsonFile(file);
|
|
79
|
+
const fileName = getNameFromJson(json);
|
|
80
|
+
this.warn(`Failed to push SharinPix permission ${fileName}: ${formatErrorMessage(error)}`);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
this.warn(`Failed to parse JSON for SharinPix permission in ${file}: ${formatErrorMessage(error)}`);
|
|
84
|
+
}
|
|
93
85
|
failed++;
|
|
94
|
-
|
|
95
|
-
}
|
|
86
|
+
});
|
|
96
87
|
}
|
|
97
|
-
// Handle deletion of records that no longer have corresponding local files
|
|
98
88
|
if (flags.delete) {
|
|
99
89
|
const localFileNames = new Set(files.map((file) => {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
return json.name;
|
|
90
|
+
const json = readJsonFile(file);
|
|
91
|
+
return getNameFromJson(json);
|
|
103
92
|
}));
|
|
104
93
|
for (const [recordName, record] of existingMap) {
|
|
105
94
|
if (!localFileNames.has(recordName)) {
|
|
106
|
-
|
|
107
|
-
|
|
95
|
+
await connection.sobject('sharinpix__SharinPixPermission__c').delete(record.Id)
|
|
96
|
+
.then(() => {
|
|
108
97
|
this.log(messages.getMessage('info.deleted', [recordName]));
|
|
109
98
|
deleted++;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this.warn(`Failed to delete SharinPix permission ${recordName}: ${error
|
|
99
|
+
})
|
|
100
|
+
.catch((error) => {
|
|
101
|
+
this.warn(`Failed to delete SharinPix permission ${recordName}: ${formatErrorMessage(error)}`);
|
|
113
102
|
failed++;
|
|
114
|
-
}
|
|
103
|
+
});
|
|
115
104
|
}
|
|
116
105
|
}
|
|
117
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/permission/push.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/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O,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QAEpF,OAAO;YACL,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,MAAM;YACN,OAAO;YACP,OAAO;SACR,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ELEMENT_KEY_ORDER: readonly string[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const ELEMENT_KEY_ORDER = [
|
|
2
|
+
'id',
|
|
3
|
+
'index',
|
|
4
|
+
'label',
|
|
5
|
+
'type',
|
|
6
|
+
'elemType',
|
|
7
|
+
'richDescription',
|
|
8
|
+
'info',
|
|
9
|
+
'apiName',
|
|
10
|
+
'codeScan',
|
|
11
|
+
'inputType',
|
|
12
|
+
'magicFill',
|
|
13
|
+
'mobileApp',
|
|
14
|
+
'sfMapping',
|
|
15
|
+
'visibility',
|
|
16
|
+
'placeholder',
|
|
17
|
+
'validations',
|
|
18
|
+
'autocomplete',
|
|
19
|
+
'defaultValue',
|
|
20
|
+
'labelFormula',
|
|
21
|
+
'sfFieldUpdate',
|
|
22
|
+
'disabledFormula',
|
|
23
|
+
'allowBlankUpdate',
|
|
24
|
+
'defaultValueFormula',
|
|
25
|
+
'preserveRelaunchValueFormula',
|
|
26
|
+
'max',
|
|
27
|
+
'min',
|
|
28
|
+
'decimal',
|
|
29
|
+
'disabled',
|
|
30
|
+
'setToNow',
|
|
31
|
+
'calendarFormat',
|
|
32
|
+
'setToNowButton',
|
|
33
|
+
'options',
|
|
34
|
+
'description',
|
|
35
|
+
'required',
|
|
36
|
+
'style',
|
|
37
|
+
'sfRecordMapping',
|
|
38
|
+
'sfPullRecordMapping',
|
|
39
|
+
'parentId',
|
|
40
|
+
'sectionId',
|
|
41
|
+
'columnLabels',
|
|
42
|
+
'sortable',
|
|
43
|
+
'addFormula',
|
|
44
|
+
'addOptions',
|
|
45
|
+
'deleteFormula',
|
|
46
|
+
'height',
|
|
47
|
+
'size',
|
|
48
|
+
'readonly',
|
|
49
|
+
'step',
|
|
50
|
+
'rows',
|
|
51
|
+
'cols',
|
|
52
|
+
];
|
|
53
|
+
//# sourceMappingURL=elementKeyOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementKeyOrder.js","sourceRoot":"","sources":["../../../src/helpers/form/elementKeyOrder.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,IAAI;IACJ,OAAO;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,iBAAiB;IACjB,MAAM;IACN,SAAS;IACT,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,qBAAqB;IACrB,8BAA8B;IAC9B,KAAK;IACL,KAAK;IACL,SAAS;IACT,UAAU;IACV,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,SAAS;IACT,aAAa;IACb,UAAU;IACV,OAAO;IACP,iBAAiB;IACjB,qBAAqB;IACrB,UAAU;IACV,WAAW;IACX,cAAc;IACd,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,QAAQ;IACR,MAAM;IACN,UAAU;IACV,MAAM;IACN,MAAM;IACN,MAAM;CACE,CAAC"}
|
package/lib/helpers/utils.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
export declare function isJsonEqual(obj1: unknown, obj2: unknown): boolean;
|
|
2
2
|
export declare function createSafeFilename(name: string): string;
|
|
3
|
+
export declare function readJsonFile(filePath: string): Record<string, unknown>;
|
|
4
|
+
export declare function writeJsonFile(filePath: string, data: unknown): void;
|
|
5
|
+
export declare function fetchJson(url: string): Promise<unknown>;
|
|
6
|
+
export declare function getNameFromJson(json: Record<string, unknown>): string;
|
|
7
|
+
export declare function ensureDirectoryExists(dirPath: string): void;
|
|
8
|
+
export declare function formatErrorMessage(error: unknown): string;
|
|
9
|
+
export declare function getJsonFiles(dirPath: string): string[];
|
|
10
|
+
export declare function getCsvFiles(dirPath: string): string[];
|
|
11
|
+
export declare function orderElementKeys(keys: string[]): string[];
|
package/lib/helpers/utils.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as crypto from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { ELEMENT_KEY_ORDER } from './form/elementKeyOrder.js';
|
|
2
4
|
export function isJsonEqual(obj1, obj2) {
|
|
3
5
|
return JSON.stringify(obj1) === JSON.stringify(obj2);
|
|
4
6
|
}
|
|
@@ -6,4 +8,59 @@ export function createSafeFilename(name) {
|
|
|
6
8
|
const md5Hash = crypto.createHash('md5').update(name).digest('hex').slice(0, 8);
|
|
7
9
|
return `${name.replaceAll(/[^a-zA-Z0-9]/g, '_')}-${md5Hash}`;
|
|
8
10
|
}
|
|
11
|
+
export function readJsonFile(filePath) {
|
|
12
|
+
const fileContent = fs.readFileSync(filePath, 'utf8');
|
|
13
|
+
return JSON.parse(fileContent);
|
|
14
|
+
}
|
|
15
|
+
export function writeJsonFile(filePath, data) {
|
|
16
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
|
|
17
|
+
}
|
|
18
|
+
export async function fetchJson(url) {
|
|
19
|
+
const response = await fetch(url, {
|
|
20
|
+
headers: { Accept: 'application/json' },
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
24
|
+
}
|
|
25
|
+
return response.json();
|
|
26
|
+
}
|
|
27
|
+
export function getNameFromJson(json) {
|
|
28
|
+
return json.name;
|
|
29
|
+
}
|
|
30
|
+
export function ensureDirectoryExists(dirPath) {
|
|
31
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
export function formatErrorMessage(error) {
|
|
34
|
+
return error instanceof Error ? error.message : 'Unknown error';
|
|
35
|
+
}
|
|
36
|
+
export function getJsonFiles(dirPath) {
|
|
37
|
+
return fs
|
|
38
|
+
.readdirSync(dirPath)
|
|
39
|
+
.filter((file) => file.endsWith('.json'))
|
|
40
|
+
.map((file) => `${dirPath}/${file}`);
|
|
41
|
+
}
|
|
42
|
+
export function getCsvFiles(dirPath) {
|
|
43
|
+
return fs
|
|
44
|
+
.readdirSync(dirPath)
|
|
45
|
+
.filter((file) => file.endsWith('.csv'))
|
|
46
|
+
.map((file) => `${dirPath}/${file}`);
|
|
47
|
+
}
|
|
48
|
+
export function orderElementKeys(keys) {
|
|
49
|
+
const keySet = new Set(keys);
|
|
50
|
+
const ordered = [];
|
|
51
|
+
const unknownKeys = [];
|
|
52
|
+
for (const key of ELEMENT_KEY_ORDER) {
|
|
53
|
+
if (keySet.has(key)) {
|
|
54
|
+
ordered.push(key);
|
|
55
|
+
keySet.delete(key);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const key of keys) {
|
|
59
|
+
if (keySet.has(key)) {
|
|
60
|
+
unknownKeys.push(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
unknownKeys.sort();
|
|
64
|
+
return [...ordered, ...unknownKeys];
|
|
65
|
+
}
|
|
9
66
|
//# sourceMappingURL=utils.js.map
|
package/lib/helpers/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,UAAU,WAAW,CAAC,IAAa,EAAE,IAAa;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CAAC;QACrB,CAAC;IACH,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,WAAW,CAAC,IAAI,EAAE,CAAC;IAEnB,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,WAAW,CAAC,CAAC;AACtC,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as formPull } from './commands/sharinpix/form/pull.js';
|
|
2
2
|
export { default as formPush } from './commands/sharinpix/form/push.js';
|
|
3
|
+
export { default as formJson2Csv } from './commands/sharinpix/form/json2csv.js';
|
|
4
|
+
export { default as formCsv2Json } from './commands/sharinpix/form/csv2json.js';
|
|
3
5
|
export { default as permissionPull } from './commands/sharinpix/permission/pull.js';
|
|
4
6
|
export { default as permissionPush } from './commands/sharinpix/permission/push.js';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as formPull } from './commands/sharinpix/form/pull.js';
|
|
2
2
|
export { default as formPush } from './commands/sharinpix/form/push.js';
|
|
3
|
+
export { default as formJson2Csv } from './commands/sharinpix/form/json2csv.js';
|
|
4
|
+
export { default as formCsv2Json } from './commands/sharinpix/form/csv2json.js';
|
|
3
5
|
export { default as permissionPull } from './commands/sharinpix/permission/pull.js';
|
|
4
6
|
export { default as permissionPush } from './commands/sharinpix/permission/push.js';
|
|
5
7
|
//# 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,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"}
|
|
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,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate JSON files from SharinPix form CSV definitions.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Scans the local `sharinpix/forms` directory for SharinPix form CSV definition files and generates corresponding JSON files. Each CSV file is expected to have a header row of element keys and one row per element, as produced by the json2csv command.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Generate JSON files for all local SharinPix form CSV definitions:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %>
|
|
14
|
+
|
|
15
|
+
# info.converted
|
|
16
|
+
|
|
17
|
+
Converted %s to JSON
|
|
18
|
+
|
|
19
|
+
# info.skipped
|
|
20
|
+
|
|
21
|
+
Skipped %s: %s
|
|
22
|
+
|
|
23
|
+
# info.summary
|
|
24
|
+
|
|
25
|
+
Conversion completed: %d file(s) converted, %d file(s) skipped
|
|
26
|
+
|
|
27
|
+
# error.directoryNotFound
|
|
28
|
+
|
|
29
|
+
Directory %s not found or could not be read: %s
|
|
30
|
+
|
|
31
|
+
# error.noDataRows
|
|
32
|
+
|
|
33
|
+
No data rows found
|
|
34
|
+
|
|
35
|
+
# error.jsonNotFound
|
|
36
|
+
|
|
37
|
+
Corresponding JSON file %s does not exist
|
|
38
|
+
|
|
39
|
+
# error.jsonReadFailed
|
|
40
|
+
|
|
41
|
+
Failed to read JSON file %s: %s
|
|
42
|
+
|
|
43
|
+
# error.jsonInvalid
|
|
44
|
+
|
|
45
|
+
Invalid JSON in file %s: %s
|
|
46
|
+
|
|
47
|
+
# error.jsonNotObject
|
|
48
|
+
|
|
49
|
+
JSON file %s is not a valid form definition (expected an object)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate CSV files from SharinPix form JSON definitions.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Scans the local `sharinpix/forms` directory for SharinPix form JSON definition files and generates corresponding CSV files. The CSV files contain a header row built from all element keys and one row per element. Nested values are stringified.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Generate CSV files for all local SharinPix form JSON definitions:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %>
|
|
14
|
+
|
|
15
|
+
# info.converted
|
|
16
|
+
|
|
17
|
+
Converted %s to CSV
|
|
18
|
+
|
|
19
|
+
# info.skipped
|
|
20
|
+
|
|
21
|
+
Skipped %s: %s
|
|
22
|
+
|
|
23
|
+
# info.summary
|
|
24
|
+
|
|
25
|
+
Conversion completed: %d file(s) converted, %d file(s) skipped
|
|
26
|
+
|
|
27
|
+
# error.directoryNotFound
|
|
28
|
+
|
|
29
|
+
Directory %s not found or could not be read: %s
|
|
30
|
+
|
|
31
|
+
# error.noElementsArray
|
|
32
|
+
|
|
33
|
+
No 'elements' array found
|
|
34
|
+
|
|
35
|
+
# error.emptyElementsArray
|
|
36
|
+
|
|
37
|
+
Empty 'elements' array
|
|
@@ -14,6 +14,14 @@ The Salesforce org to pull form templates from.
|
|
|
14
14
|
|
|
15
15
|
The target Salesforce org containing the SharinPix form templates to be pulled.
|
|
16
16
|
|
|
17
|
+
# flags.csv.summary
|
|
18
|
+
|
|
19
|
+
Also generate CSV files from the downloaded JSON form definitions.
|
|
20
|
+
|
|
21
|
+
# flags.csv.description
|
|
22
|
+
|
|
23
|
+
When enabled, after downloading all form templates as JSON into `sharinpix/forms`, the command runs the JSON-to-CSV conversion (same as `sharinpix:form:json2csv`).
|
|
24
|
+
|
|
17
25
|
# examples
|
|
18
26
|
|
|
19
27
|
- Pull all form templates from the default org:
|
|
@@ -24,6 +32,10 @@ The target Salesforce org containing the SharinPix form templates to be pulled.
|
|
|
24
32
|
|
|
25
33
|
<%= config.bin %> <%= command.id %> --target-org myorg@example.com
|
|
26
34
|
|
|
35
|
+
- Pull form templates and also generate CSV files:
|
|
36
|
+
|
|
37
|
+
<%= config.bin %> <%= command.id %> --csv
|
|
38
|
+
|
|
27
39
|
# info.hello
|
|
28
40
|
|
|
29
41
|
Pulled form template %s from %s
|
|
@@ -22,6 +22,14 @@ Delete form templates from org that no longer have corresponding local files.
|
|
|
22
22
|
|
|
23
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
24
|
|
|
25
|
+
# flags.csv.summary
|
|
26
|
+
|
|
27
|
+
Convert local CSV files to JSON before pushing.
|
|
28
|
+
|
|
29
|
+
# flags.csv.description
|
|
30
|
+
|
|
31
|
+
When enabled, the command first runs the CSV-to-JSON conversion (same as `sharinpix:form:csv2json`) on files in `sharinpix/forms`, then proceeds to push the resulting JSON files.
|
|
32
|
+
|
|
25
33
|
# examples
|
|
26
34
|
|
|
27
35
|
- Push all form templates to the default org:
|
|
@@ -36,6 +44,10 @@ When enabled, this flag will delete form template records from the Salesforce or
|
|
|
36
44
|
|
|
37
45
|
<%= config.bin %> <%= command.id %> --delete
|
|
38
46
|
|
|
47
|
+
- Convert CSV to JSON, then push:
|
|
48
|
+
|
|
49
|
+
<%= config.bin %> <%= command.id %> --csv
|
|
50
|
+
|
|
39
51
|
# info.created
|
|
40
52
|
|
|
41
53
|
Created form template %s
|
package/oclif.lock
CHANGED
|
@@ -2711,6 +2711,13 @@
|
|
|
2711
2711
|
resolved "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz"
|
|
2712
2712
|
integrity sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==
|
|
2713
2713
|
|
|
2714
|
+
"@types/mock-fs@^4.13.4":
|
|
2715
|
+
version "4.13.4"
|
|
2716
|
+
resolved "https://registry.yarnpkg.com/@types/mock-fs/-/mock-fs-4.13.4.tgz#e73edb4b4889d44d23f1ea02d6eebe50aa30b09a"
|
|
2717
|
+
integrity sha512-mXmM0o6lULPI8z3XNnQCpL0BGxPwx1Ul1wXYEPBGl4efShyxW2Rln0JOPEWGyZaYZMM6OVXM/15zUuFMY52ljg==
|
|
2718
|
+
dependencies:
|
|
2719
|
+
"@types/node" "*"
|
|
2720
|
+
|
|
2714
2721
|
"@types/mute-stream@^0.0.4":
|
|
2715
2722
|
version "0.0.4"
|
|
2716
2723
|
resolved "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz"
|
|
@@ -3958,7 +3965,14 @@ create-require@^1.1.0:
|
|
|
3958
3965
|
resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz"
|
|
3959
3966
|
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
|
|
3960
3967
|
|
|
3961
|
-
cross-
|
|
3968
|
+
cross-env@^7.0.3:
|
|
3969
|
+
version "7.0.3"
|
|
3970
|
+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
|
|
3971
|
+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
|
|
3972
|
+
dependencies:
|
|
3973
|
+
cross-spawn "^7.0.1"
|
|
3974
|
+
|
|
3975
|
+
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.6:
|
|
3962
3976
|
version "7.0.6"
|
|
3963
3977
|
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz"
|
|
3964
3978
|
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
|
|
@@ -3991,16 +4005,36 @@ csstype@^3.0.2:
|
|
|
3991
4005
|
resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz"
|
|
3992
4006
|
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
|
3993
4007
|
|
|
4008
|
+
csv-generate@^4.5.0:
|
|
4009
|
+
version "4.5.0"
|
|
4010
|
+
resolved "https://registry.yarnpkg.com/csv-generate/-/csv-generate-4.5.0.tgz#5fbbb89bd9f8ce705871c9baf02e1d4bb4000fb3"
|
|
4011
|
+
integrity sha512-aQr/vmOKyBSBHNwYhAoXw1+kUsPnMSwmYgpNoo36rIXoG1ecWILnvPGZeQ6oUjzrWknZAD3+jfpqYOBAl4x15A==
|
|
4012
|
+
|
|
3994
4013
|
csv-parse@^5.5.2:
|
|
3995
4014
|
version "5.6.0"
|
|
3996
4015
|
resolved "https://registry.npmjs.org/csv-parse/-/csv-parse-5.6.0.tgz"
|
|
3997
4016
|
integrity sha512-l3nz3euub2QMg5ouu5U09Ew9Wf6/wQ8I++ch1loQ0ljmzhmfZYrH9fflS22i/PQEvsPvxCwxgz5q7UB8K1JO4Q==
|
|
3998
4017
|
|
|
3999
|
-
csv-
|
|
4018
|
+
csv-parse@^6.1.0:
|
|
4019
|
+
version "6.1.0"
|
|
4020
|
+
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-6.1.0.tgz#c642ec5b7fc57c1f477a07d179beb5ff0dfd5ed0"
|
|
4021
|
+
integrity sha512-CEE+jwpgLn+MmtCpVcPtiCZpVtB6Z2OKPTr34pycYYoL7sxdOkXDdQ4lRiw6ioC0q6BLqhc6cKweCVvral8yhw==
|
|
4022
|
+
|
|
4023
|
+
csv-stringify@^6.4.4, csv-stringify@^6.6.0:
|
|
4000
4024
|
version "6.6.0"
|
|
4001
4025
|
resolved "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.6.0.tgz"
|
|
4002
4026
|
integrity sha512-YW32lKOmIBgbxtu3g5SaiqWNwa/9ISQt2EcgOq0+RAIFufFp9is6tqNnKahqE5kuKvrnYAzs28r+s6pXJR8Vcw==
|
|
4003
4027
|
|
|
4028
|
+
csv@^6.4.1:
|
|
4029
|
+
version "6.4.1"
|
|
4030
|
+
resolved "https://registry.yarnpkg.com/csv/-/csv-6.4.1.tgz#c9a62130c025f8adb2a85a75d4c2608612995822"
|
|
4031
|
+
integrity sha512-ajGosmTGnTwYyGl8STqZDu7R6LkDf3xL39XiOmliV/GufQeVUxHzTKIm4NOBCwmEuujK7B6isxs4Uqt9GcRCvA==
|
|
4032
|
+
dependencies:
|
|
4033
|
+
csv-generate "^4.5.0"
|
|
4034
|
+
csv-parse "^6.1.0"
|
|
4035
|
+
csv-stringify "^6.6.0"
|
|
4036
|
+
stream-transform "^3.4.0"
|
|
4037
|
+
|
|
4004
4038
|
dargs@^7.0.0:
|
|
4005
4039
|
version "7.0.0"
|
|
4006
4040
|
resolved "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz"
|
|
@@ -6443,9 +6477,9 @@ just-extend@^6.2.0:
|
|
|
6443
6477
|
resolved "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz"
|
|
6444
6478
|
integrity sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==
|
|
6445
6479
|
|
|
6446
|
-
jwa@^1.4.
|
|
6480
|
+
jwa@^1.4.2:
|
|
6447
6481
|
version "1.4.2"
|
|
6448
|
-
resolved "https://registry.
|
|
6482
|
+
resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.2.tgz#16011ac6db48de7b102777e57897901520eec7b9"
|
|
6449
6483
|
integrity sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==
|
|
6450
6484
|
dependencies:
|
|
6451
6485
|
buffer-equal-constant-time "^1.0.1"
|
|
@@ -6453,11 +6487,11 @@ jwa@^1.4.1:
|
|
|
6453
6487
|
safe-buffer "^5.0.1"
|
|
6454
6488
|
|
|
6455
6489
|
jws@^3.2.2:
|
|
6456
|
-
version "3.2.
|
|
6457
|
-
resolved "https://registry.
|
|
6458
|
-
integrity sha512-
|
|
6490
|
+
version "3.2.3"
|
|
6491
|
+
resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.3.tgz#5ac0690b460900a27265de24520526853c0b8ca1"
|
|
6492
|
+
integrity sha512-byiJ0FLRdLdSVSReO/U4E7RoEyOCKnEnEPMjq3HxWtvzLsV08/i5RQKsFVNkCldrCaPr2vDNAOMsfs8T/Hze7g==
|
|
6459
6493
|
dependencies:
|
|
6460
|
-
jwa "^1.4.
|
|
6494
|
+
jwa "^1.4.2"
|
|
6461
6495
|
safe-buffer "^5.0.1"
|
|
6462
6496
|
|
|
6463
6497
|
keyv@^4.5.3:
|
|
@@ -6938,9 +6972,9 @@ math-intrinsics@^1.1.0:
|
|
|
6938
6972
|
integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==
|
|
6939
6973
|
|
|
6940
6974
|
mdast-util-to-hast@^13.0.0:
|
|
6941
|
-
version "13.2.
|
|
6942
|
-
resolved "https://registry.
|
|
6943
|
-
integrity sha512-
|
|
6975
|
+
version "13.2.1"
|
|
6976
|
+
resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz#d7ff84ca499a57e2c060ae67548ad950e689a053"
|
|
6977
|
+
integrity sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==
|
|
6944
6978
|
dependencies:
|
|
6945
6979
|
"@types/hast" "^3.0.0"
|
|
6946
6980
|
"@types/mdast" "^4.0.0"
|
|
@@ -7237,6 +7271,11 @@ mocha@^10.7.0:
|
|
|
7237
7271
|
yargs-parser "^20.2.9"
|
|
7238
7272
|
yargs-unparser "^2.0.0"
|
|
7239
7273
|
|
|
7274
|
+
mock-fs@^5.5.0:
|
|
7275
|
+
version "5.5.0"
|
|
7276
|
+
resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-5.5.0.tgz#94a46d299aaa588e735a201cbe823c876e91f385"
|
|
7277
|
+
integrity sha512-d/P1M/RacgM3dB0sJ8rjeRNXxtapkPCUnMGmIN0ixJ16F/E4GUZCvWcSGfWGz8eaXYvn1s9baUwNjI4LOPEjiA==
|
|
7278
|
+
|
|
7240
7279
|
mri@^1.2.0:
|
|
7241
7280
|
version "1.2.0"
|
|
7242
7281
|
resolved "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz"
|
|
@@ -9232,6 +9271,11 @@ stream-combiner2@~1.1.1:
|
|
|
9232
9271
|
duplexer2 "~0.1.0"
|
|
9233
9272
|
readable-stream "^2.0.2"
|
|
9234
9273
|
|
|
9274
|
+
stream-transform@^3.4.0:
|
|
9275
|
+
version "3.4.0"
|
|
9276
|
+
resolved "https://registry.yarnpkg.com/stream-transform/-/stream-transform-3.4.0.tgz#38d562fbdad38c3b6cda959ad36751014bb26e18"
|
|
9277
|
+
integrity sha512-QO3OGhKyeIV8p6eRQdG+W6WounFw519zk690hHCNfhgfP9bylVS+NTXsuBc7n+RsGn31UgFPGrWYIgoAbArKEw==
|
|
9278
|
+
|
|
9235
9279
|
"string-width-cjs@npm:string-width@^4.2.0":
|
|
9236
9280
|
version "4.2.3"
|
|
9237
9281
|
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|