@kitalive/sfdx-plugin 0.2.1 → 0.3.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 +10 -10
- package/lib/bulk.js +80 -33
- package/lib/bulk.js.map +1 -1
- package/lib/commands/kit/data/bulk/delete.js +37 -10
- package/lib/commands/kit/data/bulk/delete.js.map +1 -1
- package/lib/commands/kit/data/bulk/query.js +10 -3
- package/lib/commands/kit/data/bulk/query.js.map +1 -1
- package/lib/commands/kit/data/csv/convert.js +51 -19
- package/lib/commands/kit/data/csv/convert.js.map +1 -1
- package/lib/commands/kit/layout/assignments/deploy.js +8 -3
- package/lib/commands/kit/layout/assignments/deploy.js.map +1 -1
- package/lib/commands/kit/layout/assignments/retrieve.d.ts +1 -0
- package/lib/commands/kit/layout/assignments/retrieve.js +51 -16
- package/lib/commands/kit/layout/assignments/retrieve.js.map +1 -1
- package/lib/commands/kit/script/execute.d.ts +1 -1
- package/lib/commands/kit/script/execute.js +13 -8
- package/lib/commands/kit/script/execute.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +26 -14
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g @kitalive/sfdx-plugin
|
|
|
18
18
|
$ sfdx COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ sfdx (-v|--version|version)
|
|
21
|
-
@kitalive/sfdx-plugin/0.
|
|
21
|
+
@kitalive/sfdx-plugin/0.3.0 darwin-x64 node-v16.14.2
|
|
22
22
|
$ sfdx --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ sfdx COMMAND
|
|
@@ -80,7 +80,7 @@ EXAMPLE
|
|
|
80
80
|
$ sfdx kit:data:bulk:delete -q 'SELECT Id FROM Opportunity WHERE CloseDate < LAST_N_YEARS:5'
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
_See code: [src/commands/kit/data/bulk/delete.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
83
|
+
_See code: [src/commands/kit/data/bulk/delete.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/data/bulk/delete.ts)_
|
|
84
84
|
|
|
85
85
|
## `sfdx kit:data:bulk:insert -o <string> -f <filepath> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
86
86
|
|
|
@@ -165,7 +165,7 @@ EXAMPLES
|
|
|
165
165
|
$ sfdx kit:data:bulk:insert -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -w 10
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
_See code: [src/commands/kit/data/bulk/insert.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
168
|
+
_See code: [src/commands/kit/data/bulk/insert.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/data/bulk/insert.ts)_
|
|
169
169
|
|
|
170
170
|
## `sfdx kit:data:bulk:query -q <string> [-f <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
171
171
|
|
|
@@ -197,7 +197,7 @@ EXAMPLE
|
|
|
197
197
|
$ sfdx kit:data:bulk:query -q 'SELECT Id, Name FROM Account' -f ./path/to/Account.csv
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
_See code: [src/commands/kit/data/bulk/query.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
200
|
+
_See code: [src/commands/kit/data/bulk/query.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/data/bulk/query.ts)_
|
|
201
201
|
|
|
202
202
|
## `sfdx kit:data:bulk:update -o <string> -f <filepath> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
203
203
|
|
|
@@ -282,7 +282,7 @@ EXAMPLES
|
|
|
282
282
|
$ sfdx kit:data:bulk:update -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -w 10
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
-
_See code: [src/commands/kit/data/bulk/update.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
285
|
+
_See code: [src/commands/kit/data/bulk/update.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/data/bulk/update.ts)_
|
|
286
286
|
|
|
287
287
|
## `sfdx kit:data:bulk:upsert -o <string> -f <filepath> -i <string> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
288
288
|
|
|
@@ -371,7 +371,7 @@ EXAMPLES
|
|
|
371
371
|
10
|
|
372
372
|
```
|
|
373
373
|
|
|
374
|
-
_See code: [src/commands/kit/data/bulk/upsert.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
374
|
+
_See code: [src/commands/kit/data/bulk/upsert.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/data/bulk/upsert.ts)_
|
|
375
375
|
|
|
376
376
|
## `sfdx kit:data:csv:convert [-f <filepath>] [-o <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
377
377
|
|
|
@@ -420,7 +420,7 @@ EXAMPLES
|
|
|
420
420
|
$ sfdx kit:data:csv:convert -f ./path/to/input.csv -o ./path/to/output.csv -c ./path/to/convert.js -e cp932 -d :
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
-
_See code: [src/commands/kit/data/csv/convert.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
423
|
+
_See code: [src/commands/kit/data/csv/convert.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/data/csv/convert.ts)_
|
|
424
424
|
|
|
425
425
|
## `sfdx kit:layout:assignments:deploy -f <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
426
426
|
|
|
@@ -453,7 +453,7 @@ EXAMPLES
|
|
|
453
453
|
$ sfdx kit:layout:assignments:deploy -u me@my.org -f config/layout-assignments.sandbox.json
|
|
454
454
|
```
|
|
455
455
|
|
|
456
|
-
_See code: [src/commands/kit/layout/assignments/deploy.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
456
|
+
_See code: [src/commands/kit/layout/assignments/deploy.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/layout/assignments/deploy.ts)_
|
|
457
457
|
|
|
458
458
|
## `sfdx kit:layout:assignments:retrieve -f <string> [-p <string>] [-o <string>] [--merge] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
459
459
|
|
|
@@ -497,7 +497,7 @@ EXAMPLES
|
|
|
497
497
|
$ sfdx kit:layout:assignments:retrieve -u me@my.org -f config/layout-assignments.sandbox.json
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
_See code: [src/commands/kit/layout/assignments/retrieve.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
500
|
+
_See code: [src/commands/kit/layout/assignments/retrieve.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/layout/assignments/retrieve.ts)_
|
|
501
501
|
|
|
502
502
|
## `sfdx kit:script:execute [-f <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
503
503
|
|
|
@@ -540,5 +540,5 @@ EXAMPLES
|
|
|
540
540
|
$ NODE_OPTIONS=--experimental-repl-await sfdx kit:script:execute
|
|
541
541
|
```
|
|
542
542
|
|
|
543
|
-
_See code: [src/commands/kit/script/execute.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.
|
|
543
|
+
_See code: [src/commands/kit/script/execute.ts](https://github.com/Kitalive-Inc/sfdx-plugin/blob/v0.3.0/src/commands/kit/script/execute.ts)_
|
|
544
544
|
<!-- commandsstop -->
|
package/lib/bulk.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createBulkCommand = exports.normalizeDateString = exports.bulkLoad = exports.bulkQuery = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const command_1 = require("@salesforce/command");
|
|
6
5
|
const dayjs = require("dayjs");
|
|
7
6
|
const csv = require("fast-csv");
|
|
@@ -13,30 +12,33 @@ const utils = require("./utils");
|
|
|
13
12
|
function bulkQuery(conn, query) {
|
|
14
13
|
return new Promise((resolve, reject) => {
|
|
15
14
|
const records = [];
|
|
16
|
-
conn.bulk
|
|
15
|
+
conn.bulk
|
|
16
|
+
.query(query)
|
|
17
17
|
.on('error', reject)
|
|
18
|
-
.on('record', record => records.push(record))
|
|
18
|
+
.on('record', (record) => records.push(record))
|
|
19
19
|
.on('end', () => resolve(records));
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
exports.bulkQuery = bulkQuery;
|
|
23
23
|
function bulkLoad(conn, sobject, operation, rows, options) {
|
|
24
|
-
const
|
|
24
|
+
const { batchSize = 10000, wait, ...jobOptions } = options || {};
|
|
25
25
|
const job = conn.bulk.createJob(sobject, operation, jobOptions);
|
|
26
26
|
const fetchResults = async (records) => ({
|
|
27
27
|
job: await job.check(),
|
|
28
28
|
batches: await job.list(),
|
|
29
|
-
records
|
|
29
|
+
records,
|
|
30
30
|
});
|
|
31
|
-
const executeBatch = batchRows => new Promise((resolve, reject) => {
|
|
31
|
+
const executeBatch = (batchRows) => new Promise((resolve, reject) => {
|
|
32
32
|
const batch = job.createBatch();
|
|
33
|
-
batch.on('error', e => {
|
|
33
|
+
batch.on('error', (e) => {
|
|
34
34
|
if (e.message.startsWith('Polling time out'))
|
|
35
35
|
job.emit('error', e);
|
|
36
36
|
reject(e);
|
|
37
37
|
});
|
|
38
|
-
batch.on('queue',
|
|
39
|
-
batch
|
|
38
|
+
batch.on('queue', () => {
|
|
39
|
+
batch
|
|
40
|
+
.check()
|
|
41
|
+
.then((result) => {
|
|
40
42
|
if (result.state === 'Failed') {
|
|
41
43
|
reject(result.stateMessage);
|
|
42
44
|
}
|
|
@@ -46,11 +48,13 @@ function bulkLoad(conn, sobject, operation, rows, options) {
|
|
|
46
48
|
else {
|
|
47
49
|
fetchResults([]).then(resolve).catch(reject);
|
|
48
50
|
}
|
|
49
|
-
})
|
|
51
|
+
})
|
|
52
|
+
.catch(reject);
|
|
50
53
|
});
|
|
51
54
|
batch.on('response', resolve);
|
|
52
|
-
batch.execute(batchRows, error => error && reject(error));
|
|
55
|
+
batch.execute(batchRows, (error) => error && reject(error));
|
|
53
56
|
});
|
|
57
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
54
58
|
return new Promise(async (resolve, reject) => {
|
|
55
59
|
job.on('error', reject);
|
|
56
60
|
try {
|
|
@@ -74,17 +78,28 @@ function normalizeDateString(str, format) {
|
|
|
74
78
|
}
|
|
75
79
|
exports.normalizeDateString = normalizeDateString;
|
|
76
80
|
const converters = {
|
|
77
|
-
date: value => normalizeDateString(value, 'YYYY-MM-DD'),
|
|
78
|
-
datetime: normalizeDateString
|
|
81
|
+
date: (value) => normalizeDateString(value, 'YYYY-MM-DD'),
|
|
82
|
+
datetime: normalizeDateString,
|
|
79
83
|
};
|
|
80
84
|
const csvFlags = convert_1.default['flagsConfig'];
|
|
81
85
|
const createBulkCommand = (operation) => {
|
|
82
86
|
var _a;
|
|
83
87
|
const config = {
|
|
84
|
-
object: command_1.flags.string({
|
|
88
|
+
object: command_1.flags.string({
|
|
89
|
+
char: 'o',
|
|
90
|
+
required: true,
|
|
91
|
+
description: `the sObject name to ${operation}`,
|
|
92
|
+
}),
|
|
85
93
|
// csv settings
|
|
86
|
-
csvfile: command_1.flags.filepath({
|
|
87
|
-
|
|
94
|
+
csvfile: command_1.flags.filepath({
|
|
95
|
+
char: 'f',
|
|
96
|
+
required: true,
|
|
97
|
+
description: `the CSV file path that defines the records to ${operation}`,
|
|
98
|
+
}),
|
|
99
|
+
resultfile: command_1.flags.filepath({
|
|
100
|
+
char: 'r',
|
|
101
|
+
description: `the CSV file path for writing the ${operation} results`,
|
|
102
|
+
}),
|
|
88
103
|
encoding: csvFlags.encoding,
|
|
89
104
|
delimiter: csvFlags.delimiter,
|
|
90
105
|
quote: csvFlags.quote,
|
|
@@ -92,19 +107,43 @@ const createBulkCommand = (operation) => {
|
|
|
92
107
|
trim: csvFlags.trim,
|
|
93
108
|
mapping: csvFlags.mapping,
|
|
94
109
|
converter: csvFlags.converter,
|
|
95
|
-
setnull: command_1.flags.boolean({
|
|
96
|
-
|
|
110
|
+
setnull: command_1.flags.boolean({
|
|
111
|
+
description: `set blank values as null values during ${operation} operations (default: empty field values are ignored)`,
|
|
112
|
+
}),
|
|
113
|
+
convertonly: command_1.flags.boolean({
|
|
114
|
+
description: `output converted.csv file and skip ${operation} for debugging`,
|
|
115
|
+
}),
|
|
97
116
|
// job settings
|
|
98
|
-
concurrencymode: command_1.flags.string({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
117
|
+
concurrencymode: command_1.flags.string({
|
|
118
|
+
default: 'Parallel',
|
|
119
|
+
description: 'the concurrency mode (Parallel or Serial) for the job',
|
|
120
|
+
}),
|
|
121
|
+
assignmentruleid: command_1.flags.string({
|
|
122
|
+
description: 'the ID of a specific assignment rule to run for a case or a lead.',
|
|
123
|
+
}),
|
|
124
|
+
batchsize: command_1.flags.integer({
|
|
125
|
+
char: 's',
|
|
126
|
+
min: 1,
|
|
127
|
+
max: 10000,
|
|
128
|
+
default: 10000,
|
|
129
|
+
description: 'the batch size of the job',
|
|
130
|
+
}),
|
|
131
|
+
wait: command_1.flags.integer({
|
|
132
|
+
char: 'w',
|
|
133
|
+
min: 0,
|
|
134
|
+
description: 'the number of minutes to wait for the command to complete before displaying the results',
|
|
135
|
+
}),
|
|
102
136
|
};
|
|
103
137
|
const examples = [
|
|
104
|
-
`$ sfdx kit:data:bulk:${operation} -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json
|
|
138
|
+
`$ sfdx kit:data:bulk:${operation} -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json`,
|
|
105
139
|
];
|
|
106
140
|
if (operation === 'upsert') {
|
|
107
|
-
config['externalid'] = command_1.flags.string({
|
|
141
|
+
config['externalid'] = command_1.flags.string({
|
|
142
|
+
char: 'i',
|
|
143
|
+
required: true,
|
|
144
|
+
default: 'Id',
|
|
145
|
+
description: 'the column name of the external ID',
|
|
146
|
+
});
|
|
108
147
|
examples.push('$ sfdx kit:data:bulk:upsert -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -i MyExternalId__c -w 10');
|
|
109
148
|
}
|
|
110
149
|
else {
|
|
@@ -112,8 +151,8 @@ const createBulkCommand = (operation) => {
|
|
|
112
151
|
}
|
|
113
152
|
return _a = class extends command_1.SfdxCommand {
|
|
114
153
|
async run() {
|
|
115
|
-
const { object, csvfile, mapping, converter, encoding, delimiter, quote, skiplines, trim, setnull } = this.flags;
|
|
116
|
-
const mappingJson =
|
|
154
|
+
const { object, csvfile, mapping, converter, encoding, delimiter, quote, skiplines, trim, setnull, } = this.flags;
|
|
155
|
+
const mappingJson = mapping ? await fs.readJson(mapping) : undefined;
|
|
117
156
|
const script = converter ? this.loadScript(converter) : {};
|
|
118
157
|
const fieldTypes = await this.getFieldTypes(object);
|
|
119
158
|
this.ux.startSpinner('Processing csv');
|
|
@@ -128,7 +167,7 @@ const createBulkCommand = (operation) => {
|
|
|
128
167
|
setnull,
|
|
129
168
|
mapping: mappingJson,
|
|
130
169
|
convert: script.convert,
|
|
131
|
-
fieldTypes
|
|
170
|
+
fieldTypes,
|
|
132
171
|
});
|
|
133
172
|
if (script.finish) {
|
|
134
173
|
const result = await script.finish(rows, this);
|
|
@@ -148,7 +187,7 @@ const createBulkCommand = (operation) => {
|
|
|
148
187
|
concurrencyMode: this.flags.concurrencymode,
|
|
149
188
|
assignmentRuleId: this.flags.assignmentruleid,
|
|
150
189
|
batchSize: this.flags.batchsize,
|
|
151
|
-
wait: this.flags.wait
|
|
190
|
+
wait: this.flags.wait,
|
|
152
191
|
});
|
|
153
192
|
const batchErrors = [];
|
|
154
193
|
if (this.flags.wait) {
|
|
@@ -160,7 +199,7 @@ const createBulkCommand = (operation) => {
|
|
|
160
199
|
if (message) {
|
|
161
200
|
batchErrors.push({ line: i + 2, message, data });
|
|
162
201
|
}
|
|
163
|
-
return
|
|
202
|
+
return { ...data, Id: id, Errors: message };
|
|
164
203
|
});
|
|
165
204
|
if (batchErrors.length) {
|
|
166
205
|
result.errors = batchErrors;
|
|
@@ -183,8 +222,15 @@ const createBulkCommand = (operation) => {
|
|
|
183
222
|
}
|
|
184
223
|
}
|
|
185
224
|
async parseCsv(input, options) {
|
|
186
|
-
const { encoding, delimiter, quote, skiplines, trim, mapping, convert, setnull, fieldTypes } = options !== null && options !== void 0 ? options : {};
|
|
187
|
-
return await (0, convert_2.parseCsv)(input, {
|
|
225
|
+
const { encoding, delimiter, quote, skiplines, trim, mapping, convert, setnull, fieldTypes, } = options !== null && options !== void 0 ? options : {};
|
|
226
|
+
return await (0, convert_2.parseCsv)(input, {
|
|
227
|
+
encoding,
|
|
228
|
+
delimiter,
|
|
229
|
+
quote,
|
|
230
|
+
skiplines,
|
|
231
|
+
trim,
|
|
232
|
+
mapping,
|
|
233
|
+
convert: (row) => {
|
|
188
234
|
const result = convert ? convert(row) : row;
|
|
189
235
|
if (!result)
|
|
190
236
|
return;
|
|
@@ -204,7 +250,8 @@ const createBulkCommand = (operation) => {
|
|
|
204
250
|
}
|
|
205
251
|
}
|
|
206
252
|
return result;
|
|
207
|
-
}
|
|
253
|
+
},
|
|
254
|
+
});
|
|
208
255
|
}
|
|
209
256
|
bulkLoad(conn, sobject, op, rows, options) {
|
|
210
257
|
return bulkLoad(conn, sobject, op, rows, options);
|
|
@@ -223,7 +270,7 @@ const createBulkCommand = (operation) => {
|
|
|
223
270
|
},
|
|
224
271
|
_a.description = [
|
|
225
272
|
`bulk ${operation} records from a CSV file`,
|
|
226
|
-
'For information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.'
|
|
273
|
+
'For information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.',
|
|
227
274
|
].join('\n'),
|
|
228
275
|
_a.examples = examples,
|
|
229
276
|
_a.requiresUsername = true,
|
package/lib/bulk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.js","sourceRoot":"","s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,GAAG,IAAK;QACxB,kBAAe,GAAG,KAAM;QAExB,cAAW,GAAG,MAAO;WA0LtC;AACJ,CAAC,CAAC;AAlRW,QAAA,iBAAiB,qBAkR5B"}
|
|
@@ -5,11 +5,12 @@ const soql_parser_js_1 = require("soql-parser-js");
|
|
|
5
5
|
const bulk_1 = require("../../../../bulk");
|
|
6
6
|
class DeleteCommand extends command_1.SfdxCommand {
|
|
7
7
|
async run() {
|
|
8
|
+
var _a;
|
|
8
9
|
const query = (0, soql_parser_js_1.parseQuery)(this.flags.query);
|
|
9
10
|
query.fields = [(0, soql_parser_js_1.getField)('Id')];
|
|
10
11
|
const soql = (0, soql_parser_js_1.composeQuery)(query);
|
|
11
12
|
const conn = this.org.getConnection();
|
|
12
|
-
const { concurrencymode: concurrencyMode, batchsize: batchSize, wait, hard } = this.flags;
|
|
13
|
+
const { concurrencymode: concurrencyMode, batchsize: batchSize, wait, hard, } = this.flags;
|
|
13
14
|
this.ux.startSpinner(hard ? 'Bulk hard delete' : 'Bulk delete');
|
|
14
15
|
try {
|
|
15
16
|
const rows = await this.bulkQuery(conn, soql);
|
|
@@ -18,10 +19,16 @@ class DeleteCommand extends command_1.SfdxCommand {
|
|
|
18
19
|
return { records: [] };
|
|
19
20
|
}
|
|
20
21
|
const operation = hard ? 'hardDelete' : 'delete';
|
|
21
|
-
const result = await this.bulkLoad(conn, query.sObject, operation, rows, {
|
|
22
|
+
const result = await this.bulkLoad(conn, query.sObject, operation, rows, {
|
|
23
|
+
concurrencyMode,
|
|
24
|
+
batchSize,
|
|
25
|
+
wait,
|
|
26
|
+
});
|
|
22
27
|
if (wait) {
|
|
23
28
|
const { numberRecordsProcessed, numberRecordsFailed } = result.job;
|
|
24
|
-
const errors = result.records
|
|
29
|
+
const errors = result.records
|
|
30
|
+
.filter((r) => !r.success)
|
|
31
|
+
.map((r) => ({ id: r.id, errors: r.errors.join(', ') }));
|
|
25
32
|
this.ux.stopSpinner(`${numberRecordsProcessed} processed, ${numberRecordsFailed} failed.`);
|
|
26
33
|
if (errors.length) {
|
|
27
34
|
this.ux.styledHeader('Error details');
|
|
@@ -31,7 +38,7 @@ class DeleteCommand extends command_1.SfdxCommand {
|
|
|
31
38
|
else {
|
|
32
39
|
this.ux.stopSpinner();
|
|
33
40
|
this.ux.log('Check bulk job status with the command: ');
|
|
34
|
-
this.ux.log(`sfdx force:org:open -u ${this.flags.targetusername} -p "lightning/setup/AsyncApiJobStatus/page?address=%2F${result.job.id}"`);
|
|
41
|
+
this.ux.log(`sfdx force:org:open -u ${this.flags.targetusername} -p "lightning/setup/AsyncApiJobStatus/page?address=%2F${(_a = result.job) === null || _a === void 0 ? void 0 : _a.id}"`);
|
|
35
42
|
}
|
|
36
43
|
return result;
|
|
37
44
|
}
|
|
@@ -50,15 +57,35 @@ class DeleteCommand extends command_1.SfdxCommand {
|
|
|
50
57
|
exports.default = DeleteCommand;
|
|
51
58
|
DeleteCommand.description = 'bulk delete records by SOQL select query';
|
|
52
59
|
DeleteCommand.examples = [
|
|
53
|
-
|
|
60
|
+
"$ sfdx kit:data:bulk:delete -q 'SELECT Id FROM Opportunity WHERE CloseDate < LAST_N_YEARS:5'",
|
|
54
61
|
];
|
|
55
62
|
DeleteCommand.requiresUsername = true;
|
|
56
63
|
DeleteCommand.requiresProject = false;
|
|
57
64
|
DeleteCommand.flagsConfig = {
|
|
58
|
-
query: command_1.flags.string({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
query: command_1.flags.string({
|
|
66
|
+
char: 'q',
|
|
67
|
+
required: true,
|
|
68
|
+
description: 'SOQL query to delete',
|
|
69
|
+
}),
|
|
70
|
+
hard: command_1.flags.boolean({
|
|
71
|
+
default: false,
|
|
72
|
+
description: 'perform a hard delete',
|
|
73
|
+
}),
|
|
74
|
+
concurrencymode: command_1.flags.string({
|
|
75
|
+
default: 'Parallel',
|
|
76
|
+
description: 'the concurrency mode (Parallel or Serial) for the job',
|
|
77
|
+
}),
|
|
78
|
+
batchsize: command_1.flags.integer({
|
|
79
|
+
char: 's',
|
|
80
|
+
min: 1,
|
|
81
|
+
max: 10000,
|
|
82
|
+
default: 10000,
|
|
83
|
+
description: 'the batch size of the job',
|
|
84
|
+
}),
|
|
85
|
+
wait: command_1.flags.integer({
|
|
86
|
+
char: 'w',
|
|
87
|
+
min: 0,
|
|
88
|
+
description: 'the number of minutes to wait for the command to complete before displaying the results',
|
|
89
|
+
}),
|
|
63
90
|
};
|
|
64
91
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/kit/data/bulk/delete.ts"],"names":[],"mappings":";;AAAA,iDAAyD;AAEzD,mDAAoE;AACpE,2CAAmE;AAEnE,MAAqB,aAAc,SAAQ,qBAAW;
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/kit/data/bulk/delete.ts"],"names":[],"mappings":";;AAAA,iDAAyD;AAEzD,mDAAoE;AACpE,2CAAmE;AAEnE,MAAqB,aAAc,SAAQ,qBAAW;IAuC7C,KAAK,CAAC,GAAG;;QACd,MAAM,KAAK,GAAG,IAAA,2BAAU,EAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3C,KAAK,CAAC,MAAM,GAAG,CAAC,IAAA,yBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,IAAA,6BAAY,EAAC,KAAK,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACtC,MAAM,EACJ,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,IAAI,EACJ,IAAI,GACL,GAAG,IAAI,CAAC,KAAK,CAAC;QAEf,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC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AAS,EAAE,eAAK,CAAC,OAAO,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,KAAK;QACV,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,2BAA2B;KACzC,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,OAAO,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,CAAC;QACN,WAAW,EACT,yFAAyF;KAC5F,CAAC;CACH,CAAC"}
|
|
@@ -39,12 +39,19 @@ class QueryCommand extends command_1.SfdxCommand {
|
|
|
39
39
|
exports.default = QueryCommand;
|
|
40
40
|
QueryCommand.description = 'bulk query records';
|
|
41
41
|
QueryCommand.examples = [
|
|
42
|
-
|
|
42
|
+
"$ sfdx kit:data:bulk:query -q 'SELECT Id, Name FROM Account' -f ./path/to/Account.csv",
|
|
43
43
|
];
|
|
44
44
|
QueryCommand.requiresUsername = true;
|
|
45
45
|
QueryCommand.requiresProject = false;
|
|
46
46
|
QueryCommand.flagsConfig = {
|
|
47
|
-
query: command_1.flags.string({
|
|
48
|
-
|
|
47
|
+
query: command_1.flags.string({
|
|
48
|
+
char: 'q',
|
|
49
|
+
required: true,
|
|
50
|
+
description: 'SOQL query to export',
|
|
51
|
+
}),
|
|
52
|
+
csvfile: command_1.flags.string({
|
|
53
|
+
char: 'f',
|
|
54
|
+
description: 'output csv file (default: standard output)',
|
|
55
|
+
}),
|
|
49
56
|
};
|
|
50
57
|
//# sourceMappingURL=query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/kit/data/bulk/query.ts"],"names":[],"mappings":";;AAAA,6CAAyC;AACzC,iDAAyD;AAEzD,yBAAyB;AACzB,2CAA6C;AAE7C,MAAqB,YAAa,SAAQ,qBAAW;
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/kit/data/bulk/query.ts"],"names":[],"mappings":";;AAAA,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AAC;IAEO,SAAS,CAAC,IAAI,EAAE,KAAK;QAC3B,OAAO,IAAA,gBAAS,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC;;AAvDH,+BAwDC;AAvDe,wBAAW,GAAG,oBAAoB,CAAC;AAEnC,qBAAQ,GAAG;IACvB,uFAAuF;CACxF,CAAC;AAEe,6BAAgB,GAAG,IAAI,CAAC;AACxB,4BAAe,GAAG,KAAK,CAAC;AAExB,wBAAW,GAAG;IAC7B,KAAK,EAAE,eAAK,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,sBAAsB;KACpC,CAAC;IACF,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4CAA4C;KAC1D,CAAC;CACH,CAAC"}
|
|
@@ -9,8 +9,8 @@ const path = require("path");
|
|
|
9
9
|
const stream_1 = require("stream");
|
|
10
10
|
class CsvConvertCommand extends command_1.SfdxCommand {
|
|
11
11
|
async run() {
|
|
12
|
-
const { inputfile, outputfile, mapping, converter, encoding, delimiter, quote, skiplines, trim } = this.flags;
|
|
13
|
-
const mappingJson = mapping ?
|
|
12
|
+
const { inputfile, outputfile, mapping, converter, encoding, delimiter, quote, skiplines, trim, } = this.flags;
|
|
13
|
+
const mappingJson = mapping ? await fs.readJson(mapping) : undefined;
|
|
14
14
|
const convert = converter ? this.loadConverter(converter) : undefined;
|
|
15
15
|
const input = inputfile ? fs.createReadStream(inputfile) : process.stdin;
|
|
16
16
|
const rows = await parseCsv(input, {
|
|
@@ -20,10 +20,12 @@ class CsvConvertCommand extends command_1.SfdxCommand {
|
|
|
20
20
|
skiplines,
|
|
21
21
|
trim,
|
|
22
22
|
mapping: mappingJson,
|
|
23
|
-
convert
|
|
23
|
+
convert,
|
|
24
24
|
});
|
|
25
25
|
if (!this.flags.json) {
|
|
26
|
-
const output = outputfile
|
|
26
|
+
const output = outputfile
|
|
27
|
+
? fs.createWriteStream(outputfile)
|
|
28
|
+
: process.stdout;
|
|
27
29
|
this.writeCsv(rows, output);
|
|
28
30
|
}
|
|
29
31
|
return rows;
|
|
@@ -39,20 +41,47 @@ exports.default = CsvConvertCommand;
|
|
|
39
41
|
CsvConvertCommand.description = 'convert CSV data using column mapping file or Node.js script';
|
|
40
42
|
CsvConvertCommand.examples = [
|
|
41
43
|
'$ sfdx kit:data:csv:convert -f ./path/to/input.csv -m ./path/to/mapping.json',
|
|
42
|
-
'$ sfdx kit:data:csv:convert -f ./path/to/input.csv -o ./path/to/output.csv -c ./path/to/convert.js -e cp932 -d :'
|
|
44
|
+
'$ sfdx kit:data:csv:convert -f ./path/to/input.csv -o ./path/to/output.csv -c ./path/to/convert.js -e cp932 -d :',
|
|
43
45
|
];
|
|
44
46
|
CsvConvertCommand.requiresUsername = false;
|
|
45
47
|
CsvConvertCommand.requiresProject = false;
|
|
46
48
|
CsvConvertCommand.flagsConfig = {
|
|
47
|
-
inputfile: command_1.flags.filepath({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
inputfile: command_1.flags.filepath({
|
|
50
|
+
char: 'f',
|
|
51
|
+
description: 'the path of the input CSV file (default: standard input)',
|
|
52
|
+
}),
|
|
53
|
+
outputfile: command_1.flags.filepath({
|
|
54
|
+
char: 'o',
|
|
55
|
+
description: 'the path of the output CSV file (default: standard output)',
|
|
56
|
+
}),
|
|
57
|
+
encoding: command_1.flags.string({
|
|
58
|
+
char: 'e',
|
|
59
|
+
default: 'utf8',
|
|
60
|
+
description: 'the input CSV file encoding',
|
|
61
|
+
}),
|
|
62
|
+
delimiter: command_1.flags.string({
|
|
63
|
+
char: 'd',
|
|
64
|
+
default: ',',
|
|
65
|
+
description: 'the input CSV file delimiter',
|
|
66
|
+
}),
|
|
67
|
+
quote: command_1.flags.string({
|
|
68
|
+
char: 'q',
|
|
69
|
+
default: '"',
|
|
70
|
+
description: 'the input CSV file quote character',
|
|
71
|
+
}),
|
|
72
|
+
skiplines: command_1.flags.integer({
|
|
73
|
+
default: 0,
|
|
74
|
+
description: 'the number of lines to skip',
|
|
75
|
+
}),
|
|
53
76
|
trim: command_1.flags.boolean({ description: 'trim all white space from columns' }),
|
|
54
|
-
mapping: command_1.flags.filepath({
|
|
55
|
-
|
|
77
|
+
mapping: command_1.flags.filepath({
|
|
78
|
+
char: 'm',
|
|
79
|
+
description: 'the path of the JSON file that defines CSV column mappings',
|
|
80
|
+
}),
|
|
81
|
+
converter: command_1.flags.filepath({
|
|
82
|
+
char: 'c',
|
|
83
|
+
description: 'the path of the script to convert CSV rows',
|
|
84
|
+
}),
|
|
56
85
|
};
|
|
57
86
|
function parseCsv(input, options) {
|
|
58
87
|
const { encoding, delimiter, quote, skiplines, trim, mapping, convert } = options !== null && options !== void 0 ? options : {};
|
|
@@ -60,14 +89,16 @@ function parseCsv(input, options) {
|
|
|
60
89
|
const mapper = mapping ? columnMapper(mapping) : undefined;
|
|
61
90
|
let lines = 2;
|
|
62
91
|
const rows = [];
|
|
63
|
-
const parser = csv
|
|
92
|
+
const parser = csv
|
|
93
|
+
.parse({
|
|
64
94
|
headers: true,
|
|
65
95
|
ignoreEmpty: true,
|
|
66
|
-
delimiter: delimiter === '\\t' ? '\t' :
|
|
96
|
+
delimiter: delimiter === '\\t' ? '\t' : delimiter || ',',
|
|
67
97
|
quote: quote !== null && quote !== void 0 ? quote : '"',
|
|
68
98
|
skipLines: skiplines,
|
|
69
|
-
trim
|
|
70
|
-
})
|
|
99
|
+
trim,
|
|
100
|
+
})
|
|
101
|
+
.on('data', (row) => {
|
|
71
102
|
try {
|
|
72
103
|
if (mapper)
|
|
73
104
|
row = mapper(row);
|
|
@@ -81,7 +112,7 @@ function parseCsv(input, options) {
|
|
|
81
112
|
throw new Error(`A error occurred in csv file at line ${lines}: ${e.message}\ndata: ${JSON.stringify(row)}`);
|
|
82
113
|
}
|
|
83
114
|
});
|
|
84
|
-
const callback = e => e ? reject(e) : resolve(rows);
|
|
115
|
+
const callback = (e) => (e ? reject(e) : resolve(rows));
|
|
85
116
|
if (!encoding || encoding === 'utf8') {
|
|
86
117
|
(0, stream_1.pipeline)(input, parser, callback);
|
|
87
118
|
}
|
|
@@ -92,6 +123,7 @@ function parseCsv(input, options) {
|
|
|
92
123
|
}
|
|
93
124
|
exports.parseCsv = parseCsv;
|
|
94
125
|
function loadScript(file) {
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
95
127
|
const script = require(path.resolve(file));
|
|
96
128
|
if (!script.convert)
|
|
97
129
|
throw new Error('function convert is not exported');
|
|
@@ -100,7 +132,7 @@ function loadScript(file) {
|
|
|
100
132
|
exports.loadScript = loadScript;
|
|
101
133
|
function columnMapper(mapping) {
|
|
102
134
|
const keys = Object.keys(mapping);
|
|
103
|
-
return row => {
|
|
135
|
+
return (row) => {
|
|
104
136
|
const result = {};
|
|
105
137
|
for (const to of keys) {
|
|
106
138
|
const from = mapping[to];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../../../src/commands/kit/data/csv/convert.ts"],"names":[],"mappings":";;;AAAA,iDAAyD;AAEzD,gCAAgC;AAChC,+BAA+B;AAC/B,2CAA0C;AAC1C,6BAA6B;AAC7B,mCAA4C;AAE5C,MAAqB,iBAAkB,SAAQ,qBAAW;
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../../../src/commands/kit/data/csv/convert.ts"],"names":[],"mappings":";;;AAAA,iDAAyD;AAEzD,gCAAgC;AAChC,+BAA+B;AAC/B,2CAA0C;AAC1C,6BAA6B;AAC7B,mCAA4C;AAE5C,MAAqB,iBAAkB,SAAQ,qBAAW;IAmDjD,KAAK,CAAC,GAAG;QACd,MAAM,EACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,KAAK,EACL,SAAS,EACT,IAAI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IAAI,QAAQ,KAAK,MAAM,EAAE;YACpC,IAAA,iBAAQ,EAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;SACnC;aAAM;YACL,IAAA,iBAAQ,EAAC,KAAK,EAAE,IAAA,yBAAY,EAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;SAC3D;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAlDD,4BAkDC;AAED,SAAgB,UAAU,CAAC,IAAI;IAC7B,8DAA8D;IAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC;AAChB,CAAC;AALD,gCAKC;AAED,SAAgB,YAAY,CAAC,OAAO;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;YACzB,IAAI,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,gBAAgB,CAAC,CAAC;YACzE,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;SACxB;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAXD,oCAWC"}
|
|
@@ -10,7 +10,7 @@ class LayoutAssignmentsDeployCommand extends command_1.SfdxCommand {
|
|
|
10
10
|
const layoutAssignmentsPerProfile = await this.readFile(this.flags.file);
|
|
11
11
|
const profiles = Object.entries(layoutAssignmentsPerProfile).map(([fullName, layoutAssignments]) => ({ fullName, layoutAssignments }));
|
|
12
12
|
// limit 10 records per one API call
|
|
13
|
-
return Promise.all((0, utils_1.chunk)(profiles, 10).map(data => this.deploy(data))).then(a => [].concat(...a));
|
|
13
|
+
return Promise.all((0, utils_1.chunk)(profiles, 10).map((data) => this.deploy(data))).then((a) => [].concat(...a));
|
|
14
14
|
}
|
|
15
15
|
readFile(file) {
|
|
16
16
|
const inputFile = path.join(this.project.getPath(), file);
|
|
@@ -25,11 +25,16 @@ LayoutAssignmentsDeployCommand.description = 'deploy page layout assignments fro
|
|
|
25
25
|
LayoutAssignmentsDeployCommand.examples = [
|
|
26
26
|
'$ sfdx kit:layout:assignments:deploy',
|
|
27
27
|
'$ sfdx kit:layout:assignments:deploy -f config/layout-assignments.scratch.json',
|
|
28
|
-
'$ sfdx kit:layout:assignments:deploy -u me@my.org -f config/layout-assignments.sandbox.json'
|
|
28
|
+
'$ sfdx kit:layout:assignments:deploy -u me@my.org -f config/layout-assignments.sandbox.json',
|
|
29
29
|
];
|
|
30
30
|
LayoutAssignmentsDeployCommand.requiresUsername = true;
|
|
31
31
|
LayoutAssignmentsDeployCommand.requiresProject = true;
|
|
32
32
|
LayoutAssignmentsDeployCommand.flagsConfig = {
|
|
33
|
-
file: command_1.flags.string({
|
|
33
|
+
file: command_1.flags.string({
|
|
34
|
+
char: 'f',
|
|
35
|
+
required: true,
|
|
36
|
+
description: 'input file path',
|
|
37
|
+
default: 'config/layout-assignments.json',
|
|
38
|
+
}),
|
|
34
39
|
};
|
|
35
40
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../src/commands/kit/layout/assignments/deploy.ts"],"names":[],"mappings":";;AAAA,iDAAyD;AACzD,+BAA+B;AAE/B,6BAA6B;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../src/commands/kit/layout/assignments/deploy.ts"],"names":[],"mappings":";;AAA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Q,GAAG;IACvB,sCAAsC;IACtC,gFAAgF;IAChF,6FAA6F;CAC9F,CAAC;AAEe,+CAAgB,GAAG,IAAI,CAAC;AACxB,8CAAe,GAAG,IAAI,CAAC;AAEvB,0CAAW,GAAG;IAC7B,IAAI,EAAE,eAAK,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,iBAAiB;QAC9B,OAAO,EAAE,gCAAgC;KAC1C,CAAC;CACH,CAAC"}
|
|
@@ -13,6 +13,7 @@ export default class LayoutAssignmentsRetrieveCommand extends SfdxCommand {
|
|
|
13
13
|
};
|
|
14
14
|
run(): Promise<LayoutAssignmentsPerProfile>;
|
|
15
15
|
objectNamesFromLayouts(): Promise<string[]>;
|
|
16
|
+
private getProjectConfig;
|
|
16
17
|
private getProfileNames;
|
|
17
18
|
private getProfiles;
|
|
18
19
|
private findFiles;
|
|
@@ -8,27 +8,36 @@ const path = require("path");
|
|
|
8
8
|
const utils_1 = require("../../../../utils");
|
|
9
9
|
class LayoutAssignmentsRetrieveCommand extends command_1.SfdxCommand {
|
|
10
10
|
async run() {
|
|
11
|
-
const filterObjects = this.flags.object
|
|
11
|
+
const filterObjects = this.flags.object
|
|
12
|
+
? this.flags.object.split(',')
|
|
13
|
+
: await this.objectNamesFromLayouts();
|
|
12
14
|
if (filterObjects.length === 0)
|
|
13
15
|
throw new core_1.SfdxError('There are no objects to retrieve');
|
|
14
|
-
const data = this.flags.merge
|
|
15
|
-
|
|
16
|
+
const data = this.flags.merge
|
|
17
|
+
? await this.readFile(this.flags.file)
|
|
18
|
+
: {};
|
|
19
|
+
const profileNames = this.flags.profile
|
|
20
|
+
? this.flags.profile.split(',')
|
|
21
|
+
: await this.getProfileNames();
|
|
16
22
|
this.ux.log(`retrieve layout assignments\n\tprofiles: ${profileNames.join(', ')}\n\tobjects: ${filterObjects.join(', ')}`);
|
|
17
23
|
// limit 10 records per one API call
|
|
18
|
-
const profiles = await Promise.all((0, utils_1.chunk)(profileNames, 10).map(names => this.getProfiles(names))).then(a => [].concat(...a));
|
|
24
|
+
const profiles = await Promise.all((0, utils_1.chunk)(profileNames, 10).map((names) => this.getProfiles(names))).then((a) => [].concat(...a));
|
|
19
25
|
for (const profile of profiles) {
|
|
20
26
|
if (!profile.fullName || !profile.layoutAssignments)
|
|
21
27
|
continue;
|
|
22
|
-
data[profile.fullName] = profile.layoutAssignments
|
|
28
|
+
data[profile.fullName] = profile.layoutAssignments
|
|
29
|
+
.filter((assignment) => filterObjects.includes(assignment.layout.split('-')[0]))
|
|
30
|
+
.sort((a, b) => a.layout.localeCompare(b.layout));
|
|
23
31
|
}
|
|
24
32
|
this.ux.log('save to ' + this.flags.file);
|
|
25
33
|
await this.writeFile(this.flags.file, data);
|
|
26
34
|
return data;
|
|
27
35
|
}
|
|
28
36
|
async objectNamesFromLayouts() {
|
|
29
|
-
//
|
|
30
|
-
const config = await this.
|
|
31
|
-
const packageDir = config.packageDirectories &&
|
|
37
|
+
// eslint-disable-next-line
|
|
38
|
+
const config = await this.getProjectConfig();
|
|
39
|
+
const packageDir = config.packageDirectories &&
|
|
40
|
+
config.packageDirectories.find((dir) => dir.default);
|
|
32
41
|
if (!packageDir)
|
|
33
42
|
return [];
|
|
34
43
|
const pattern = path.join(this.project.getPath(), packageDir.path, '**/*.layout-meta.xml');
|
|
@@ -37,10 +46,18 @@ class LayoutAssignmentsRetrieveCommand extends command_1.SfdxCommand {
|
|
|
37
46
|
const object = path.basename(filepath).split('-')[0];
|
|
38
47
|
objectCounts[object] = (objectCounts[object] || 0) + 1;
|
|
39
48
|
}
|
|
40
|
-
return Object.keys(objectCounts)
|
|
49
|
+
return Object.keys(objectCounts)
|
|
50
|
+
.filter((object) => objectCounts[object] >= 2)
|
|
51
|
+
.sort();
|
|
52
|
+
}
|
|
53
|
+
getProjectConfig() {
|
|
54
|
+
return this.project.resolveProjectConfig();
|
|
41
55
|
}
|
|
42
56
|
getProfileNames() {
|
|
43
|
-
return this.org
|
|
57
|
+
return this.org
|
|
58
|
+
.getConnection()
|
|
59
|
+
.metadata.list({ type: 'Profile' })
|
|
60
|
+
.then((profiles) => profiles.map((p) => p.fullName));
|
|
44
61
|
}
|
|
45
62
|
getProfiles(names) {
|
|
46
63
|
return this.org.getConnection().metadata.read('Profile', names);
|
|
@@ -52,7 +69,9 @@ class LayoutAssignmentsRetrieveCommand extends command_1.SfdxCommand {
|
|
|
52
69
|
return fs.readJson(path.join(this.project.getPath(), file));
|
|
53
70
|
}
|
|
54
71
|
writeFile(file, data) {
|
|
55
|
-
return fs.outputJson(path.join(this.project.getPath(), file), data, {
|
|
72
|
+
return fs.outputJson(path.join(this.project.getPath(), file), data, {
|
|
73
|
+
spaces: '\t',
|
|
74
|
+
});
|
|
56
75
|
}
|
|
57
76
|
}
|
|
58
77
|
exports.default = LayoutAssignmentsRetrieveCommand;
|
|
@@ -60,14 +79,30 @@ LayoutAssignmentsRetrieveCommand.description = 'retrieve page layout assignments
|
|
|
60
79
|
LayoutAssignmentsRetrieveCommand.examples = [
|
|
61
80
|
'$ sfdx kit:layout:assignments:retrieve',
|
|
62
81
|
'$ sfdx kit:layout:assignments:retrieve -p Admin,Standard,StandardAul -o Account,CustomObject__c -f config/layout-assignments.scratch.json',
|
|
63
|
-
'$ sfdx kit:layout:assignments:retrieve -u me@my.org -f config/layout-assignments.sandbox.json'
|
|
82
|
+
'$ sfdx kit:layout:assignments:retrieve -u me@my.org -f config/layout-assignments.sandbox.json',
|
|
64
83
|
];
|
|
65
84
|
LayoutAssignmentsRetrieveCommand.requiresUsername = true;
|
|
66
85
|
LayoutAssignmentsRetrieveCommand.requiresProject = true;
|
|
67
86
|
LayoutAssignmentsRetrieveCommand.flagsConfig = {
|
|
68
|
-
file: command_1.flags.string({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
87
|
+
file: command_1.flags.string({
|
|
88
|
+
char: 'f',
|
|
89
|
+
required: true,
|
|
90
|
+
description: 'output file path',
|
|
91
|
+
default: 'config/layout-assignments.json',
|
|
92
|
+
}),
|
|
93
|
+
profile: command_1.flags.string({
|
|
94
|
+
char: 'p',
|
|
95
|
+
required: false,
|
|
96
|
+
description: 'comma separated profile names to retrieve (default: all profiles)',
|
|
97
|
+
}),
|
|
98
|
+
object: command_1.flags.string({
|
|
99
|
+
char: 'o',
|
|
100
|
+
required: false,
|
|
101
|
+
description: 'comma separated object names to retrieve (default: objects which have multiple layouts)',
|
|
102
|
+
}),
|
|
103
|
+
merge: command_1.flags.boolean({
|
|
104
|
+
required: false,
|
|
105
|
+
description: 'merge retrieved configurations with existing file',
|
|
106
|
+
}),
|
|
72
107
|
};
|
|
73
108
|
//# sourceMappingURL=retrieve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve.js","sourceRoot":"","sources":["../../../../../src/commands/kit/layout/assignments/retrieve.ts"],"names":[],"mappings":";;AAAA,iDAAyD;AACzD,2CAA6C;AAC7C,kCAAkC;AAClC,+BAA+B;AAC/B,6BAA6B;
|
|
1
|
+
{"version":3,"file":"retrieve.js","sourceRoot":"","sources":["../../../../../src/commands/kit/layout/assignments/retrieve.ts"],"names":[],"mappings":";;AAAA,iDAAyD;AACzD,2CAA6C;AAC7C,kCAAkC;AAClC,+BAA+B;AAC/B,6BAA6B;AAK7B,6CAA0C;AAE1C,MAAqB,gCAAiC,SAAQ,qBAAW;IAsChE,KAAK,CAAC,GAAG;QACd,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM;YACrC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;YAC9B,CAAC,CAAC,MAAM,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACxC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;YAC5B,MAAM,IAAI,gBAAS,CAAC,kCAAkC,CAAC,CAAC;QAE1D,MAAM,IAAI,GAAgC,IAAI,CAAC,KAAK,CAAC,KAA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ACT,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE,gCAAgC;KAC1C,CAAC;IACF,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,mEAAmE;KACtE,CAAC;IACF,MAAM,EAAE,eAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,yFAAyF;KAC5F,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,OAAO,CAAC;QACnB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,mDAAmD;KACjE,CAAC;CACH,CAAC"}
|
|
@@ -4,7 +4,7 @@ export default class ScriptExecuteCommand extends SfdxCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static aliases: string[];
|
|
6
6
|
static strict: boolean;
|
|
7
|
-
protected static
|
|
7
|
+
protected static supportsUsername: boolean;
|
|
8
8
|
protected static requiresProject: boolean;
|
|
9
9
|
protected static flagsConfig: {
|
|
10
10
|
file: flags.Discriminated<flags.String>;
|
|
@@ -7,19 +7,21 @@ const repl = require("repl");
|
|
|
7
7
|
const yargs_1 = require("yargs");
|
|
8
8
|
class ScriptExecuteCommand extends command_1.SfdxCommand {
|
|
9
9
|
async run() {
|
|
10
|
+
var _a, _b;
|
|
10
11
|
const { file } = this.flags;
|
|
11
12
|
module.paths.push('./node_modules');
|
|
12
13
|
if (file) {
|
|
13
14
|
const fileIndex = process.argv.indexOf(file);
|
|
14
15
|
const argv = (0, yargs_1.default)([]).parse(process.argv.slice(fileIndex + 1));
|
|
15
16
|
const script = fs.readFileSync(file).toString('utf8');
|
|
16
|
-
const loader = name => {
|
|
17
|
+
const loader = (name) => {
|
|
17
18
|
if (name.startsWith('.'))
|
|
18
19
|
name = path.resolve(path.dirname(file), name);
|
|
19
20
|
return require(name);
|
|
20
21
|
};
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
21
23
|
const asyncFunction = Object.getPrototypeOf(async () => { }).constructor;
|
|
22
|
-
return await new asyncFunction('require', 'argv', 'context', 'conn', script)(loader, argv, this, this.org.getConnection());
|
|
24
|
+
return await new asyncFunction('require', 'argv', 'context', 'conn', script)(loader, argv, this, (_a = this.org) === null || _a === void 0 ? void 0 : _a.getConnection());
|
|
23
25
|
}
|
|
24
26
|
else {
|
|
25
27
|
this.ux.log('Starting sfdx REPL mode');
|
|
@@ -30,8 +32,8 @@ class ScriptExecuteCommand extends command_1.SfdxCommand {
|
|
|
30
32
|
const replServer = repl.start('> ');
|
|
31
33
|
replServer.context.require = require;
|
|
32
34
|
replServer.context.context = this;
|
|
33
|
-
replServer.context.conn = this.org.getConnection();
|
|
34
|
-
return new Promise(resolve => replServer.on('exit', () => resolve()));
|
|
35
|
+
replServer.context.conn = (_b = this.org) === null || _b === void 0 ? void 0 : _b.getConnection();
|
|
36
|
+
return new Promise((resolve) => replServer.on('exit', () => resolve()));
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -41,20 +43,23 @@ ScriptExecuteCommand.description = [
|
|
|
41
43
|
'Available variables in Node.js scripts',
|
|
42
44
|
' argv: Parsed command line arguments after the file option',
|
|
43
45
|
' conn: jsforce Connection',
|
|
44
|
-
' context: SfdxCommand'
|
|
46
|
+
' context: SfdxCommand',
|
|
45
47
|
].join('\n');
|
|
46
48
|
ScriptExecuteCommand.examples = [
|
|
47
49
|
'$ sfdx kit:script -f ./path/to/script.js',
|
|
48
50
|
'$ sfdx kit:script:execute',
|
|
49
51
|
"> await conn.query('SELECT Id, Name FROM Account LIMIT 1')",
|
|
50
52
|
'Top level await is not enabled by default in REPL before Node.js v16',
|
|
51
|
-
'$ NODE_OPTIONS=--experimental-repl-await sfdx kit:script:execute'
|
|
53
|
+
'$ NODE_OPTIONS=--experimental-repl-await sfdx kit:script:execute',
|
|
52
54
|
];
|
|
53
55
|
ScriptExecuteCommand.aliases = ['kit:script'];
|
|
54
56
|
ScriptExecuteCommand.strict = false;
|
|
55
|
-
ScriptExecuteCommand.
|
|
57
|
+
ScriptExecuteCommand.supportsUsername = true;
|
|
56
58
|
ScriptExecuteCommand.requiresProject = false;
|
|
57
59
|
ScriptExecuteCommand.flagsConfig = {
|
|
58
|
-
file: command_1.flags.filepath({
|
|
60
|
+
file: command_1.flags.filepath({
|
|
61
|
+
char: 'f',
|
|
62
|
+
description: 'the path of the Node.js script file to execute',
|
|
63
|
+
}),
|
|
59
64
|
};
|
|
60
65
|
//# sourceMappingURL=execute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/kit/script/execute.ts"],"names":[],"mappings":";;AAAA,iDAAyD;AACzD,+BAA+B;AAC/B,6BAA6B;AAC7B,6BAA6B;AAC7B,iCAA0B;AAE1B,MAAqB,oBAAqB,SAAQ,qBAAW;
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/kit/script/execute.ts"],"names":[],"mappings":";;AAAA,iDAAyD;AACzD,+BAA+B;AAC/B,6BAA6B;AAC7B,6BAA6B;AAC7B,iCAA0B;AAE1B,MAAqB,oBAAqB,SAAQ,qBAAW;IA6BpD,KAAK,CAAC,GAAG;;QACd,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAEpC,IAAI,IAAI,EAAE;YACR,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7C,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,EAAE,CAA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AO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;SACzE;IACH,CAAC;;AAhEH,uCAiEC;AAhEe,gCAAW,GAAG;IAC1B,gDAAgD;IAChD,wCAAwC;IACxC,6DAA6D;IAC7D,4BAA4B;IAC5B,wBAAwB;CACzB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEC,6BAAQ,GAAG;IACvB,0CAA0C;IAC1C,2BAA2B;IAC3B,4DAA4D;IAC5D,sEAAsE;IACtE,kEAAkE;CACnE,CAAC;AAEY,4BAAO,GAAG,CAAC,YAAY,CAAC,CAAC;AACzB,2BAAM,GAAG,KAAK,CAAC;AACZ,qCAAgB,GAAG,IAAI,CAAC;AACxB,oCAAe,GAAG,KAAK,CAAC;AAExB,gCAAW,GAAG;IAC7B,IAAI,EAAE,eAAK,CAAC,QAAQ,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,gDAAgD;KAC9D,CAAC;CACH,CAAC"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.2.1","commands":{"kit:script:execute":{"id":"kit:script:execute","description":"execute Node.js scripts in SfdxCommand context\nAvailable variables in Node.js scripts\n argv: Parsed command line arguments after the file option\n conn: jsforce Connection\n context: SfdxCommand","usage":"<%= command.id %> [-f <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":["kit:script"],"examples":["$ sfdx kit:script -f ./path/to/script.js","$ sfdx kit:script:execute","> await conn.query('SELECT Id, Name FROM Account LIMIT 1')","Top level await is not enabled by default in REPL before Node.js v16","$ NODE_OPTIONS=--experimental-repl-await sfdx kit:script:execute"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"file":{"name":"file","type":"option","char":"f","description":"the path of the Node.js script file to execute"}},"args":[]},"kit:data:bulk:delete":{"id":"kit:data:bulk:delete","description":"bulk delete records by SOQL select query","usage":"<%= command.id %> -q <string> [--hard] [--concurrencymode <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:delete -q 'SELECT Id FROM Opportunity WHERE CloseDate < LAST_N_YEARS:5'"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"query":{"name":"query","type":"option","char":"q","description":"SOQL query to delete","required":true},"hard":{"name":"hard","type":"boolean","description":"perform a hard delete","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"}},"args":[]},"kit:data:bulk:insert":{"id":"kit:data:bulk:insert","description":"bulk insert records from a CSV file\nFor information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.","usage":"<%= command.id %> -o <string> -f <filepath> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:insert -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json","$ sfdx kit:data:bulk:insert -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -w 10"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"object":{"name":"object","type":"option","char":"o","description":"the sObject name to insert","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"the CSV file path that defines the records to insert","required":true},"resultfile":{"name":"resultfile","type":"option","char":"r","description":"the CSV file path for writing the insert results"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"},"setnull":{"name":"setnull","type":"boolean","description":"set blank values as null values during insert operations (default: empty field values are ignored)","allowNo":false},"convertonly":{"name":"convertonly","type":"boolean","description":"output converted.csv file and skip insert for debugging","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"assignmentruleid":{"name":"assignmentruleid","type":"option","description":"the ID of a specific assignment rule to run for a case or a lead."},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"}},"args":[]},"kit:data:bulk:query":{"id":"kit:data:bulk:query","description":"bulk query records","usage":"<%= command.id %> -q <string> [-f <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:query -q 'SELECT Id, Name FROM Account' -f ./path/to/Account.csv"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"query":{"name":"query","type":"option","char":"q","description":"SOQL query to export","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"output csv file (default: standard output)"}},"args":[]},"kit:data:bulk:update":{"id":"kit:data:bulk:update","description":"bulk update records from a CSV file\nFor information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.","usage":"<%= command.id %> -o <string> -f <filepath> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:update -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json","$ sfdx kit:data:bulk:update -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -w 10"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"object":{"name":"object","type":"option","char":"o","description":"the sObject name to update","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"the CSV file path that defines the records to update","required":true},"resultfile":{"name":"resultfile","type":"option","char":"r","description":"the CSV file path for writing the update results"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"},"setnull":{"name":"setnull","type":"boolean","description":"set blank values as null values during update operations (default: empty field values are ignored)","allowNo":false},"convertonly":{"name":"convertonly","type":"boolean","description":"output converted.csv file and skip update for debugging","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"assignmentruleid":{"name":"assignmentruleid","type":"option","description":"the ID of a specific assignment rule to run for a case or a lead."},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"}},"args":[]},"kit:data:bulk:upsert":{"id":"kit:data:bulk:upsert","description":"bulk upsert records from a CSV file\nFor information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.","usage":"<%= command.id %> -o <string> -f <filepath> -i <string> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:upsert -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json","$ sfdx kit:data:bulk:upsert -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -i MyExternalId__c -w 10"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"object":{"name":"object","type":"option","char":"o","description":"the sObject name to upsert","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"the CSV file path that defines the records to upsert","required":true},"resultfile":{"name":"resultfile","type":"option","char":"r","description":"the CSV file path for writing the upsert results"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"},"setnull":{"name":"setnull","type":"boolean","description":"set blank values as null values during upsert operations (default: empty field values are ignored)","allowNo":false},"convertonly":{"name":"convertonly","type":"boolean","description":"output converted.csv file and skip upsert for debugging","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"assignmentruleid":{"name":"assignmentruleid","type":"option","description":"the ID of a specific assignment rule to run for a case or a lead."},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"},"externalid":{"name":"externalid","type":"option","char":"i","description":"the column name of the external ID","required":true,"default":"Id"}},"args":[]},"kit:data:csv:convert":{"id":"kit:data:csv:convert","description":"convert CSV data using column mapping file or Node.js script","usage":"<%= command.id %> [-f <filepath>] [-o <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:csv:convert -f ./path/to/input.csv -m ./path/to/mapping.json","$ sfdx kit:data:csv:convert -f ./path/to/input.csv -o ./path/to/output.csv -c ./path/to/convert.js -e cp932 -d :"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"inputfile":{"name":"inputfile","type":"option","char":"f","description":"the path of the input CSV file (default: standard input)"},"outputfile":{"name":"outputfile","type":"option","char":"o","description":"the path of the output CSV file (default: standard output)"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"}},"args":[]},"kit:layout:assignments:deploy":{"id":"kit:layout:assignments:deploy","description":"deploy page layout assignments from JSON file","usage":"<%= command.id %> -f <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:layout:assignments:deploy","$ sfdx kit:layout:assignments:deploy -f config/layout-assignments.scratch.json","$ sfdx kit:layout:assignments:deploy -u me@my.org -f config/layout-assignments.sandbox.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"file":{"name":"file","type":"option","char":"f","description":"input file path","required":true,"default":"config/layout-assignments.json"}},"args":[]},"kit:layout:assignments:retrieve":{"id":"kit:layout:assignments:retrieve","description":"retrieve page layout assignments and save to JSON file","usage":"<%= command.id %> -f <string> [-p <string>] [-o <string>] [--merge] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:layout:assignments:retrieve","$ sfdx kit:layout:assignments:retrieve -p Admin,Standard,StandardAul -o Account,CustomObject__c -f config/layout-assignments.scratch.json","$ sfdx kit:layout:assignments:retrieve -u me@my.org -f config/layout-assignments.sandbox.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"file":{"name":"file","type":"option","char":"f","description":"output file path","required":true,"default":"config/layout-assignments.json"},"profile":{"name":"profile","type":"option","char":"p","description":"comma separated profile names to retrieve (default: all profiles)","required":false},"object":{"name":"object","type":"option","char":"o","description":"comma separated object names to retrieve (default: objects which have multiple layouts)","required":false},"merge":{"name":"merge","type":"boolean","description":"merge retrieved configurations with existing file","required":false,"allowNo":false}},"args":[]}}}
|
|
1
|
+
{"version":"0.3.0","commands":{"kit:script:execute":{"id":"kit:script:execute","description":"execute Node.js scripts in SfdxCommand context\nAvailable variables in Node.js scripts\n argv: Parsed command line arguments after the file option\n conn: jsforce Connection\n context: SfdxCommand","usage":"<%= command.id %> [-f <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":["kit:script"],"examples":["$ sfdx kit:script -f ./path/to/script.js","$ sfdx kit:script:execute","> await conn.query('SELECT Id, Name FROM Account LIMIT 1')","Top level await is not enabled by default in REPL before Node.js v16","$ NODE_OPTIONS=--experimental-repl-await sfdx kit:script:execute"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"file":{"name":"file","type":"option","char":"f","description":"the path of the Node.js script file to execute"}},"args":[]},"kit:data:bulk:delete":{"id":"kit:data:bulk:delete","description":"bulk delete records by SOQL select query","usage":"<%= command.id %> -q <string> [--hard] [--concurrencymode <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:delete -q 'SELECT Id FROM Opportunity WHERE CloseDate < LAST_N_YEARS:5'"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"query":{"name":"query","type":"option","char":"q","description":"SOQL query to delete","required":true},"hard":{"name":"hard","type":"boolean","description":"perform a hard delete","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"}},"args":[]},"kit:data:bulk:insert":{"id":"kit:data:bulk:insert","description":"bulk insert records from a CSV file\nFor information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.","usage":"<%= command.id %> -o <string> -f <filepath> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:insert -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json","$ sfdx kit:data:bulk:insert -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -w 10"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"object":{"name":"object","type":"option","char":"o","description":"the sObject name to insert","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"the CSV file path that defines the records to insert","required":true},"resultfile":{"name":"resultfile","type":"option","char":"r","description":"the CSV file path for writing the insert results"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"},"setnull":{"name":"setnull","type":"boolean","description":"set blank values as null values during insert operations (default: empty field values are ignored)","allowNo":false},"convertonly":{"name":"convertonly","type":"boolean","description":"output converted.csv file and skip insert for debugging","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"assignmentruleid":{"name":"assignmentruleid","type":"option","description":"the ID of a specific assignment rule to run for a case or a lead."},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"}},"args":[]},"kit:data:bulk:query":{"id":"kit:data:bulk:query","description":"bulk query records","usage":"<%= command.id %> -q <string> [-f <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:query -q 'SELECT Id, Name FROM Account' -f ./path/to/Account.csv"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"query":{"name":"query","type":"option","char":"q","description":"SOQL query to export","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"output csv file (default: standard output)"}},"args":[]},"kit:data:bulk:update":{"id":"kit:data:bulk:update","description":"bulk update records from a CSV file\nFor information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.","usage":"<%= command.id %> -o <string> -f <filepath> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:update -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json","$ sfdx kit:data:bulk:update -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -w 10"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"object":{"name":"object","type":"option","char":"o","description":"the sObject name to update","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"the CSV file path that defines the records to update","required":true},"resultfile":{"name":"resultfile","type":"option","char":"r","description":"the CSV file path for writing the update results"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"},"setnull":{"name":"setnull","type":"boolean","description":"set blank values as null values during update operations (default: empty field values are ignored)","allowNo":false},"convertonly":{"name":"convertonly","type":"boolean","description":"output converted.csv file and skip update for debugging","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"assignmentruleid":{"name":"assignmentruleid","type":"option","description":"the ID of a specific assignment rule to run for a case or a lead."},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"}},"args":[]},"kit:data:bulk:upsert":{"id":"kit:data:bulk:upsert","description":"bulk upsert records from a CSV file\nFor information about CSV file formats, see [Prepare CSV Files](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm) in the Bulk API Developer Guide.","usage":"<%= command.id %> -o <string> -f <filepath> -i <string> [-r <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--setnull] [--convertonly] [--concurrencymode <string>] [--assignmentruleid <string>] [-s <integer>] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:bulk:upsert -o Account -f ./path/to/Account.csv -m ./path/to/mapping.json","$ sfdx kit:data:bulk:upsert -o MyObject__c -f ./path/to/MyObject__c.csv -c ./path/to/convert.js -i MyExternalId__c -w 10"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"object":{"name":"object","type":"option","char":"o","description":"the sObject name to upsert","required":true},"csvfile":{"name":"csvfile","type":"option","char":"f","description":"the CSV file path that defines the records to upsert","required":true},"resultfile":{"name":"resultfile","type":"option","char":"r","description":"the CSV file path for writing the upsert results"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"},"setnull":{"name":"setnull","type":"boolean","description":"set blank values as null values during upsert operations (default: empty field values are ignored)","allowNo":false},"convertonly":{"name":"convertonly","type":"boolean","description":"output converted.csv file and skip upsert for debugging","allowNo":false},"concurrencymode":{"name":"concurrencymode","type":"option","description":"the concurrency mode (Parallel or Serial) for the job","default":"Parallel"},"assignmentruleid":{"name":"assignmentruleid","type":"option","description":"the ID of a specific assignment rule to run for a case or a lead."},"batchsize":{"name":"batchsize","type":"option","char":"s","description":"the batch size of the job","default":10000},"wait":{"name":"wait","type":"option","char":"w","description":"the number of minutes to wait for the command to complete before displaying the results"},"externalid":{"name":"externalid","type":"option","char":"i","description":"the column name of the external ID","required":true,"default":"Id"}},"args":[]},"kit:data:csv:convert":{"id":"kit:data:csv:convert","description":"convert CSV data using column mapping file or Node.js script","usage":"<%= command.id %> [-f <filepath>] [-o <filepath>] [-e <string>] [-d <string>] [-q <string>] [--skiplines <integer>] [--trim] [-m <filepath>] [-c <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:data:csv:convert -f ./path/to/input.csv -m ./path/to/mapping.json","$ sfdx kit:data:csv:convert -f ./path/to/input.csv -o ./path/to/output.csv -c ./path/to/convert.js -e cp932 -d :"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"inputfile":{"name":"inputfile","type":"option","char":"f","description":"the path of the input CSV file (default: standard input)"},"outputfile":{"name":"outputfile","type":"option","char":"o","description":"the path of the output CSV file (default: standard output)"},"encoding":{"name":"encoding","type":"option","char":"e","description":"the input CSV file encoding","default":"utf8"},"delimiter":{"name":"delimiter","type":"option","char":"d","description":"the input CSV file delimiter","default":","},"quote":{"name":"quote","type":"option","char":"q","description":"the input CSV file quote character","default":"\""},"skiplines":{"name":"skiplines","type":"option","description":"the number of lines to skip","default":0},"trim":{"name":"trim","type":"boolean","description":"trim all white space from columns","allowNo":false},"mapping":{"name":"mapping","type":"option","char":"m","description":"the path of the JSON file that defines CSV column mappings"},"converter":{"name":"converter","type":"option","char":"c","description":"the path of the script to convert CSV rows"}},"args":[]},"kit:layout:assignments:deploy":{"id":"kit:layout:assignments:deploy","description":"deploy page layout assignments from JSON file","usage":"<%= command.id %> -f <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:layout:assignments:deploy","$ sfdx kit:layout:assignments:deploy -f config/layout-assignments.scratch.json","$ sfdx kit:layout:assignments:deploy -u me@my.org -f config/layout-assignments.sandbox.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"file":{"name":"file","type":"option","char":"f","description":"input file path","required":true,"default":"config/layout-assignments.json"}},"args":[]},"kit:layout:assignments:retrieve":{"id":"kit:layout:assignments:retrieve","description":"retrieve page layout assignments and save to JSON file","usage":"<%= command.id %> -f <string> [-p <string>] [-o <string>] [--merge] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@kitalive/sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx kit:layout:assignments:retrieve","$ sfdx kit:layout:assignments:retrieve -p Admin,Standard,StandardAul -o Account,CustomObject__c -f config/layout-assignments.scratch.json","$ sfdx kit:layout:assignments:retrieve -u me@my.org -f config/layout-assignments.sandbox.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"file":{"name":"file","type":"option","char":"f","description":"output file path","required":true,"default":"config/layout-assignments.json"},"profile":{"name":"profile","type":"option","char":"p","description":"comma separated profile names to retrieve (default: all profiles)","required":false},"object":{"name":"object","type":"option","char":"o","description":"comma separated object names to retrieve (default: objects which have multiple layouts)","required":false},"merge":{"name":"merge","type":"boolean","description":"merge retrieved configurations with existing file","required":false,"allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitalive/sfdx-plugin",
|
|
3
3
|
"description": "Kitalive SFDX plugin",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"author": "Akihiro Ono",
|
|
6
6
|
"bugs": "https://github.com/Kitalive-Inc/sfdx-plugin/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -13,28 +13,35 @@
|
|
|
13
13
|
"iconv-lite": "^0.6.2",
|
|
14
14
|
"jsforce": "^1.10.1",
|
|
15
15
|
"soql-parser-js": "^4.3.0",
|
|
16
|
-
"tslib": "^
|
|
16
|
+
"tslib": "^2",
|
|
17
17
|
"yargs": "^17.3.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
+
"@oclif/core": "^1",
|
|
20
21
|
"@oclif/dev-cli": "^1",
|
|
21
|
-
"@oclif/plugin-help": "^
|
|
22
|
+
"@oclif/plugin-help": "^3",
|
|
22
23
|
"@oclif/test": "^1",
|
|
23
|
-
"@salesforce/dev-config": "
|
|
24
|
+
"@salesforce/dev-config": "^2",
|
|
24
25
|
"@salesforce/ts-sinon": "^1.3.0",
|
|
25
|
-
"@types/
|
|
26
|
+
"@types/jest": "^27.4.1",
|
|
26
27
|
"@types/jsforce": "^1.9.29",
|
|
27
|
-
"@types/mocha": "^5",
|
|
28
28
|
"@types/yargs": "^17.0.8",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^5.16.0",
|
|
30
|
+
"@typescript-eslint/parser": "^5.16.0",
|
|
29
31
|
"chai": "^4",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"eslint": "^8.12.0",
|
|
33
|
+
"eslint-config-prettier": "^8.5.0",
|
|
34
|
+
"globby": "^11",
|
|
35
|
+
"husky": "^7.0.4",
|
|
36
|
+
"jest": "^27.5.1",
|
|
37
|
+
"lint-staged": "^12.3.7",
|
|
38
|
+
"prettier": "^2.6.1",
|
|
39
|
+
"ts-jest": "^27.1.4",
|
|
40
|
+
"ts-node": "^10",
|
|
34
41
|
"typescript": "^4.2.3"
|
|
35
42
|
},
|
|
36
43
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
44
|
+
"node": ">=12.0.0"
|
|
38
45
|
},
|
|
39
46
|
"files": [
|
|
40
47
|
"/lib",
|
|
@@ -64,11 +71,16 @@
|
|
|
64
71
|
},
|
|
65
72
|
"repository": "Kitalive-Inc/sfdx-plugin",
|
|
66
73
|
"scripts": {
|
|
67
|
-
"lint": "
|
|
74
|
+
"lint": "eslint src/**/*.ts",
|
|
68
75
|
"postpack": "rm -f oclif.manifest.json",
|
|
69
|
-
"posttest": "
|
|
76
|
+
"posttest": "yarn lint",
|
|
70
77
|
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
|
|
71
|
-
"
|
|
78
|
+
"prepare": "husky install",
|
|
79
|
+
"test": "jest --coverage",
|
|
72
80
|
"version": "oclif-dev readme && git add README.md"
|
|
81
|
+
},
|
|
82
|
+
"lint-staged": {
|
|
83
|
+
"src/**/*.ts": "yarn lint --fix",
|
|
84
|
+
"*.ts": "prettier --write"
|
|
73
85
|
}
|
|
74
86
|
}
|