@salesforce/plugin-data 2.1.21 → 2.1.22
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 +947 -320
- package/lib/api/data/tree/exportApi.js +66 -73
- package/lib/api/data/tree/exportApi.js.map +1 -1
- package/lib/api/data/tree/importApi.js +62 -62
- package/lib/api/data/tree/importApi.js.map +1 -1
- package/lib/batcher.js +80 -101
- package/lib/batcher.js.map +1 -1
- package/lib/commands/data/create/record.js +64 -0
- package/lib/commands/data/create/record.js.map +1 -0
- package/lib/commands/data/delete/bulk.js +78 -0
- package/lib/commands/data/delete/bulk.js.map +1 -0
- package/lib/commands/data/delete/record.js +83 -0
- package/lib/commands/data/delete/record.js.map +1 -0
- package/lib/commands/data/export/tree.js +57 -0
- package/lib/commands/data/export/tree.js.map +1 -0
- package/lib/commands/data/get/record.js +73 -0
- package/lib/commands/data/get/record.js.map +1 -0
- package/lib/commands/data/import/tree.js +85 -0
- package/lib/commands/data/import/tree.js.map +1 -0
- package/lib/commands/data/query/resume.js +55 -0
- package/lib/commands/data/query/resume.js.map +1 -0
- package/lib/commands/data/query.js +283 -0
- package/lib/commands/data/query.js.map +1 -0
- package/lib/commands/data/resume.js +64 -0
- package/lib/commands/data/resume.js.map +1 -0
- package/lib/commands/data/update/record.js +101 -0
- package/lib/commands/data/update/record.js.map +1 -0
- package/lib/commands/data/upsert/bulk.js +88 -0
- package/lib/commands/data/upsert/bulk.js.map +1 -0
- package/lib/dataCommand.js +103 -202
- package/lib/dataCommand.js.map +1 -1
- package/lib/dataSoqlQueryTypes.js +2 -6
- package/lib/dataSoqlQueryTypes.js.map +1 -1
- package/lib/flags.js +27 -0
- package/lib/flags.js.map +1 -0
- package/lib/reporters.js +58 -66
- package/lib/reporters.js.map +1 -1
- package/messages/batcher.md +39 -0
- package/messages/bulk.delete.md +31 -0
- package/messages/bulk.report.md +17 -0
- package/messages/bulk.status.md +29 -0
- package/messages/bulk.upsert.md +43 -0
- package/messages/exportApi.md +25 -0
- package/messages/importApi.md +52 -0
- package/messages/messages.md +20 -0
- package/messages/record.create.md +45 -0
- package/messages/record.delete.md +53 -0
- package/messages/record.get.md +47 -0
- package/messages/record.update.md +61 -0
- package/messages/soql.query.md +72 -0
- package/messages/tree.export.md +41 -0
- package/messages/tree.import.md +37 -0
- package/oclif.manifest.json +1 -1
- package/package.json +50 -51
- package/lib/api/data/tree/exportApi.d.ts +0 -77
- package/lib/api/data/tree/importApi.d.ts +0 -60
- package/lib/batcher.d.ts +0 -79
- package/lib/commands/force/data/bulk/delete.d.ts +0 -11
- package/lib/commands/force/data/bulk/delete.js +0 -58
- package/lib/commands/force/data/bulk/delete.js.map +0 -1
- package/lib/commands/force/data/bulk/status.d.ts +0 -11
- package/lib/commands/force/data/bulk/status.js +0 -61
- package/lib/commands/force/data/bulk/status.js.map +0 -1
- package/lib/commands/force/data/bulk/upsert.d.ts +0 -11
- package/lib/commands/force/data/bulk/upsert.js +0 -76
- package/lib/commands/force/data/bulk/upsert.js.map +0 -1
- package/lib/commands/force/data/record/create.d.ts +0 -10
- package/lib/commands/force/data/record/create.js +0 -58
- package/lib/commands/force/data/record/create.js.map +0 -1
- package/lib/commands/force/data/record/delete.d.ts +0 -10
- package/lib/commands/force/data/record/delete.js +0 -72
- package/lib/commands/force/data/record/delete.js.map +0 -1
- package/lib/commands/force/data/record/get.d.ts +0 -10
- package/lib/commands/force/data/record/get.js +0 -65
- package/lib/commands/force/data/record/get.js.map +0 -1
- package/lib/commands/force/data/record/update.d.ts +0 -10
- package/lib/commands/force/data/record/update.js +0 -90
- package/lib/commands/force/data/record/update.js.map +0 -1
- package/lib/commands/force/data/soql/bulk/report.d.ts +0 -9
- package/lib/commands/force/data/soql/bulk/report.js +0 -45
- package/lib/commands/force/data/soql/bulk/report.js.map +0 -1
- package/lib/commands/force/data/soql/query.d.ts +0 -64
- package/lib/commands/force/data/soql/query.js +0 -300
- package/lib/commands/force/data/soql/query.js.map +0 -1
- package/lib/commands/force/data/tree/export.d.ts +0 -10
- package/lib/commands/force/data/tree/export.js +0 -52
- package/lib/commands/force/data/tree/export.js.map +0 -1
- package/lib/commands/force/data/tree/import.d.ts +0 -19
- package/lib/commands/force/data/tree/import.js +0 -81
- package/lib/commands/force/data/tree/import.js.map +0 -1
- package/lib/dataCommand.d.ts +0 -57
- package/lib/dataSoqlQueryTypes.d.ts +0 -63
- package/lib/index.d.ts +0 -2
- package/lib/reporters.d.ts +0 -57
- package/messages/batcher.json +0 -12
- package/messages/bulk.delete.json +0 -12
- package/messages/bulk.report.json +0 -7
- package/messages/bulk.status.json +0 -12
- package/messages/bulk.upsert.json +0 -14
- package/messages/exportApi.json +0 -8
- package/messages/importApi.json +0 -16
- package/messages/messages.json +0 -11
- package/messages/record.create.json +0 -15
- package/messages/record.delete.json +0 -16
- package/messages/record.get.json +0 -14
- package/messages/record.update.json +0 -18
- package/messages/soql.query.json +0 -26
- package/messages/tree.export.json +0 -11
- package/messages/tree.import.json +0 -13
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DataSoqlQueryCommand = exports.SoqlQuery = void 0;
|
|
10
|
-
const os = require("os");
|
|
11
|
-
const fs = require("fs");
|
|
12
|
-
const command_1 = require("@salesforce/command");
|
|
13
|
-
const core_1 = require("@oclif/core");
|
|
14
|
-
const core_2 = require("@salesforce/core");
|
|
15
|
-
const ts_types_1 = require("@salesforce/ts-types");
|
|
16
|
-
const kit_1 = require("@salesforce/kit");
|
|
17
|
-
const reporters_1 = require("../../../../reporters");
|
|
18
|
-
const dataSoqlQueryTypes_1 = require("../../../../dataSoqlQueryTypes");
|
|
19
|
-
const dataCommand_1 = require("../../../../dataCommand");
|
|
20
|
-
core_2.Messages.importMessagesDirectory(__dirname);
|
|
21
|
-
const messages = core_2.Messages.loadMessages('@salesforce/plugin-data', 'soql.query');
|
|
22
|
-
const commonMessages = core_2.Messages.loadMessages('@salesforce/plugin-data', 'messages');
|
|
23
|
-
/**
|
|
24
|
-
* Class to handle a soql query
|
|
25
|
-
*
|
|
26
|
-
* Will collect all records and the column metadata of the query
|
|
27
|
-
*/
|
|
28
|
-
class SoqlQuery {
|
|
29
|
-
/**
|
|
30
|
-
* Executs a SOQL query using the bulk 2.0 API
|
|
31
|
-
*
|
|
32
|
-
* @param connection
|
|
33
|
-
* @param query
|
|
34
|
-
* @param timeout
|
|
35
|
-
* @param ux
|
|
36
|
-
*/
|
|
37
|
-
async runBulkSoqlQuery(connection, query, timeout = kit_1.Duration.seconds(10), ux) {
|
|
38
|
-
connection.bulk2.pollTimeout = timeout.milliseconds ?? kit_1.Duration.minutes(5).milliseconds;
|
|
39
|
-
let res;
|
|
40
|
-
try {
|
|
41
|
-
res = (await connection.bulk2.query(query)) ?? [];
|
|
42
|
-
return this.transformBulkResults(res, query);
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
const err = e;
|
|
46
|
-
if (timeout.minutes === 0 && err.message.includes('Polling time out')) {
|
|
47
|
-
// async query, so we can't throw an error, suggest force:data:query:report --queryid <id>
|
|
48
|
-
ux.log(messages.getMessage('bulkQueryTimeout', [err.jobId, err.jobId, connection.getUsername()]));
|
|
49
|
-
return { columns: [], result: { done: false, records: [], totalSize: 0, id: err.jobId }, query };
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
throw core_2.SfError.wrap(err);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* transforms Bulk 2.0 results to match the SOQL query results
|
|
58
|
-
*
|
|
59
|
-
* @param results results object
|
|
60
|
-
* @param query query string
|
|
61
|
-
*/
|
|
62
|
-
transformBulkResults(results, query) {
|
|
63
|
-
/*
|
|
64
|
-
bulk queries return a different payload, it's a [{column: data}, {column: data}]
|
|
65
|
-
so we just need to grab the first object, find the keys (columns) and create the columns
|
|
66
|
-
*/
|
|
67
|
-
const columns = Object.keys(results[0] ?? {}).map((name) => ({
|
|
68
|
-
fieldType: dataSoqlQueryTypes_1.FieldType.field,
|
|
69
|
-
name,
|
|
70
|
-
}));
|
|
71
|
-
return {
|
|
72
|
-
columns,
|
|
73
|
-
result: { done: true, records: results, totalSize: results.length },
|
|
74
|
-
query,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
async runSoqlQuery(connection, query, logger, configAgg) {
|
|
78
|
-
logger.debug('running query');
|
|
79
|
-
// take the limit from the config, then default 50,000
|
|
80
|
-
const queryOpts = {
|
|
81
|
-
autoFetch: true,
|
|
82
|
-
maxFetch: configAgg.getInfo('maxQueryLimit').value ?? 50000,
|
|
83
|
-
};
|
|
84
|
-
const result = await new Promise((resolve, reject) => {
|
|
85
|
-
const records = [];
|
|
86
|
-
const res = connection
|
|
87
|
-
.query(query)
|
|
88
|
-
.on('record', (rec) => records.push(rec))
|
|
89
|
-
.on('error', (err) => reject(err))
|
|
90
|
-
.on('end', () => {
|
|
91
|
-
resolve({
|
|
92
|
-
done: true,
|
|
93
|
-
totalSize: (0, ts_types_1.getNumber)(res, 'totalSize', 0),
|
|
94
|
-
records,
|
|
95
|
-
});
|
|
96
|
-
})
|
|
97
|
-
.run(queryOpts);
|
|
98
|
-
});
|
|
99
|
-
if (result.records.length && result.totalSize > result.records.length) {
|
|
100
|
-
core_1.CliUx.ux.warn(`The query result is missing ${result.totalSize - result.records.length} records due to a ${queryOpts.maxFetch} record limit. Increase the number of records returned by setting the config value "maxQueryLimit" or the environment variable "SFDX_MAX_QUERY_LIMIT" to ${result.totalSize} or greater than ${queryOpts.maxFetch}.`);
|
|
101
|
-
}
|
|
102
|
-
logger.debug(`Query complete with ${result.totalSize} records returned`);
|
|
103
|
-
const columns = result.totalSize ? await this.retrieveColumns(connection, query, logger) : [];
|
|
104
|
-
return {
|
|
105
|
-
query,
|
|
106
|
-
columns,
|
|
107
|
-
result,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Utility to fetch the columns involved in a soql query.
|
|
112
|
-
*
|
|
113
|
-
* Columns are then transformed into one of three types, Field, SubqueryField and FunctionField. List of
|
|
114
|
-
* fields is returned as the product.
|
|
115
|
-
*
|
|
116
|
-
* @param connection
|
|
117
|
-
* @param query
|
|
118
|
-
*/
|
|
119
|
-
async retrieveColumns(connection, query, logger) {
|
|
120
|
-
logger?.debug('fetching columns for query');
|
|
121
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
122
|
-
const columnUrl = `${connection._baseUrl()}/query?q=${encodeURIComponent(query)}&columns=true`;
|
|
123
|
-
const results = (0, ts_types_1.toJsonMap)(await connection.request(columnUrl));
|
|
124
|
-
return this.recursivelyFindColumns((0, ts_types_1.ensureJsonArray)(results.columnMetadata));
|
|
125
|
-
}
|
|
126
|
-
recursivelyFindColumns(data) {
|
|
127
|
-
const columns = [];
|
|
128
|
-
for (let column of data) {
|
|
129
|
-
column = (0, ts_types_1.ensureJsonMap)(column);
|
|
130
|
-
const name = (0, ts_types_1.ensureString)(column.columnName);
|
|
131
|
-
if ((0, ts_types_1.isJsonArray)(column.joinColumns) && column.joinColumns.length > 0) {
|
|
132
|
-
if (column.aggregate) {
|
|
133
|
-
const field = {
|
|
134
|
-
fieldType: dataSoqlQueryTypes_1.FieldType.subqueryField,
|
|
135
|
-
name,
|
|
136
|
-
fields: [],
|
|
137
|
-
};
|
|
138
|
-
for (let subcolumn of column.joinColumns) {
|
|
139
|
-
subcolumn = (0, ts_types_1.ensureJsonMap)(subcolumn);
|
|
140
|
-
if ((0, ts_types_1.isJsonArray)(column.joinColumns) && column.joinColumns.length > 0) {
|
|
141
|
-
if (field.fields)
|
|
142
|
-
field.fields.push(...this.recursivelyFindColumns([subcolumn]));
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
const f = {
|
|
146
|
-
fieldType: dataSoqlQueryTypes_1.FieldType.field,
|
|
147
|
-
name: (0, ts_types_1.ensureString)((0, ts_types_1.ensureJsonMap)(subcolumn).columnName),
|
|
148
|
-
};
|
|
149
|
-
if (field.fields)
|
|
150
|
-
field.fields.push(f);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
columns.push(field);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
for (const subcolumn of column.joinColumns) {
|
|
157
|
-
const allSubFieldNames = this.searchSubColumnsRecursively(subcolumn);
|
|
158
|
-
for (const subFields of allSubFieldNames) {
|
|
159
|
-
columns.push({
|
|
160
|
-
fieldType: dataSoqlQueryTypes_1.FieldType.field,
|
|
161
|
-
name: `${name}.${subFields}`,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else if (column.aggregate) {
|
|
168
|
-
const field = {
|
|
169
|
-
fieldType: dataSoqlQueryTypes_1.FieldType.functionField,
|
|
170
|
-
name: (0, ts_types_1.ensureString)(column.displayName),
|
|
171
|
-
};
|
|
172
|
-
// If it isn't an alias, skip so the display name is used when messaging rows
|
|
173
|
-
if (!/expr[0-9]+/.test(name)) {
|
|
174
|
-
field.alias = name;
|
|
175
|
-
}
|
|
176
|
-
columns.push(field);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
columns.push({ fieldType: dataSoqlQueryTypes_1.FieldType.field, name });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return columns;
|
|
183
|
-
}
|
|
184
|
-
searchSubColumnsRecursively(parent) {
|
|
185
|
-
const column = (0, ts_types_1.ensureJsonMap)(parent);
|
|
186
|
-
const name = (0, ts_types_1.ensureString)(column.columnName);
|
|
187
|
-
let names = [name];
|
|
188
|
-
const child = (0, ts_types_1.getArray)(parent, 'joinColumns');
|
|
189
|
-
if (child.length) {
|
|
190
|
-
// if we're recursively searching, reset the 'parent' - it gets added back below
|
|
191
|
-
names = [];
|
|
192
|
-
// recursively search for related column names
|
|
193
|
-
child.map((c) => names.push(`${name}.${this.searchSubColumnsRecursively(c).join('.')}`));
|
|
194
|
-
}
|
|
195
|
-
return names;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
exports.SoqlQuery = SoqlQuery;
|
|
199
|
-
class DataSoqlQueryCommand extends dataCommand_1.DataCommand {
|
|
200
|
-
/**
|
|
201
|
-
* Command run implementation
|
|
202
|
-
*
|
|
203
|
-
* Returns either a DataSoqlQueryResult or a SfdxResult.
|
|
204
|
-
* When the user is using global '--json' flag an instance of SfdxResult is returned.
|
|
205
|
-
* This is necessary since '--json' flag reports results in the form of SfdxResult
|
|
206
|
-
* and bypasses the definition of start result. The goal is to have the output
|
|
207
|
-
* from '--json' and '--resulformat json' be the same.
|
|
208
|
-
*
|
|
209
|
-
* The DataSoqlQueryResult is necessary to communicate user selections to the reporters.
|
|
210
|
-
* The 'this' object available during display() function does not include user input to
|
|
211
|
-
* the command, which are necessary for reporter selection.
|
|
212
|
-
*
|
|
213
|
-
*/
|
|
214
|
-
async run() {
|
|
215
|
-
try {
|
|
216
|
-
if (this.flags.resultformat !== 'json')
|
|
217
|
-
this.ux.startSpinner(messages.getMessage('queryRunningMessage'));
|
|
218
|
-
const queryString = this.flags.query ?? fs.readFileSync(this.flags.soqlqueryfile, 'utf8');
|
|
219
|
-
let queryResult;
|
|
220
|
-
const soqlQuery = new SoqlQuery();
|
|
221
|
-
if (this.flags.bulk) {
|
|
222
|
-
queryResult = await soqlQuery.runBulkSoqlQuery(this.org.getConnection(), queryString, this.flags.wait, this.ux);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
queryResult = await soqlQuery.runSoqlQuery(this.getConnection(), queryString, this.logger, this.configAggregator);
|
|
226
|
-
}
|
|
227
|
-
this.displayResults({ ...queryResult });
|
|
228
|
-
return queryResult.result;
|
|
229
|
-
}
|
|
230
|
-
finally {
|
|
231
|
-
if (this.flags.resultformat !== 'json')
|
|
232
|
-
this.ux.stopSpinner();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
displayResults(queryResult) {
|
|
236
|
-
// bypass if --json flag present
|
|
237
|
-
if (!this.flags.json) {
|
|
238
|
-
let reporter;
|
|
239
|
-
switch (this.flags.resultformat) {
|
|
240
|
-
case 'human':
|
|
241
|
-
reporter = new reporters_1.HumanReporter(queryResult, queryResult.columns, this.ux, this.logger);
|
|
242
|
-
break;
|
|
243
|
-
case 'json':
|
|
244
|
-
reporter = new reporters_1.JsonReporter(queryResult, queryResult.columns, this.ux, this.logger);
|
|
245
|
-
break;
|
|
246
|
-
case 'csv':
|
|
247
|
-
reporter = new reporters_1.CsvReporter(queryResult, queryResult.columns, this.ux, this.logger);
|
|
248
|
-
break;
|
|
249
|
-
default:
|
|
250
|
-
throw new Error(`result format is invalid: ${this.flags.resultformat}`);
|
|
251
|
-
}
|
|
252
|
-
// delegate to selected reporter
|
|
253
|
-
reporter.display();
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
exports.DataSoqlQueryCommand = DataSoqlQueryCommand;
|
|
258
|
-
DataSoqlQueryCommand.description = messages.getMessage('description');
|
|
259
|
-
DataSoqlQueryCommand.requiresUsername = true;
|
|
260
|
-
DataSoqlQueryCommand.examples = messages.getMessage('examples').split(os.EOL);
|
|
261
|
-
DataSoqlQueryCommand.flagsConfig = {
|
|
262
|
-
query: command_1.flags.string({
|
|
263
|
-
char: 'q',
|
|
264
|
-
description: messages.getMessage('queryToExecute'),
|
|
265
|
-
exclusive: ['soqlqueryfile'],
|
|
266
|
-
exactlyOne: ['query', 'soqlqueryfile'],
|
|
267
|
-
}),
|
|
268
|
-
soqlqueryfile: command_1.flags.filepath({
|
|
269
|
-
char: 'f',
|
|
270
|
-
description: messages.getMessage('soqlqueryfile'),
|
|
271
|
-
exclusive: ['query'],
|
|
272
|
-
exactlyOne: ['query', 'soqlqueryfile'],
|
|
273
|
-
}),
|
|
274
|
-
usetoolingapi: command_1.flags.boolean({
|
|
275
|
-
char: 't',
|
|
276
|
-
description: messages.getMessage('queryToolingDescription'),
|
|
277
|
-
}),
|
|
278
|
-
bulk: command_1.flags.boolean({
|
|
279
|
-
char: 'b',
|
|
280
|
-
default: false,
|
|
281
|
-
description: messages.getMessage('bulkDescription'),
|
|
282
|
-
exclusive: ['usetoolingapi'],
|
|
283
|
-
}),
|
|
284
|
-
wait: command_1.flags.minutes({
|
|
285
|
-
char: 'w',
|
|
286
|
-
description: messages.getMessage('waitDescription'),
|
|
287
|
-
dependsOn: ['bulk'],
|
|
288
|
-
}),
|
|
289
|
-
resultformat: command_1.flags.enum({
|
|
290
|
-
char: 'r',
|
|
291
|
-
description: messages.getMessage('resultFormatDescription'),
|
|
292
|
-
options: ['human', 'csv', 'json'],
|
|
293
|
-
default: 'human',
|
|
294
|
-
}),
|
|
295
|
-
perflog: command_1.flags.boolean({
|
|
296
|
-
description: commonMessages.getMessage('perfLogLevelOption'),
|
|
297
|
-
dependsOn: ['json'],
|
|
298
|
-
}),
|
|
299
|
-
};
|
|
300
|
-
//# sourceMappingURL=query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/soql/query.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yBAAyB;AACzB,yBAAyB;AACzB,iDAA6D;AAE7D,sCAAoC;AACpC,2CAA+F;AAE/F,mDAU8B;AAC9B,yCAA2C;AAC3C,qDAA8F;AAC9F,uEAAmF;AACnF,yDAAsD;AAEtD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;AAChF,MAAM,cAAc,G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|
|
2
|
-
import { FlagsConfig } from '@salesforce/command';
|
|
3
|
-
import { DataPlanPart, SObjectTreeFileContents } from '../../../../dataSoqlQueryTypes';
|
|
4
|
-
export default class Export extends SfdxCommand {
|
|
5
|
-
static readonly description: string;
|
|
6
|
-
static readonly examples: string[];
|
|
7
|
-
static readonly requiresUsername = true;
|
|
8
|
-
static readonly flagsConfig: FlagsConfig;
|
|
9
|
-
run(): Promise<DataPlanPart[] | SObjectTreeFileContents>;
|
|
10
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const os = require("os");
|
|
10
|
-
const command_1 = require("@salesforce/command");
|
|
11
|
-
const command_2 = require("@salesforce/command");
|
|
12
|
-
const core_1 = require("@salesforce/core");
|
|
13
|
-
const exportApi_1 = require("../../../../api/data/tree/exportApi");
|
|
14
|
-
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
-
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'tree.export');
|
|
16
|
-
class Export extends command_1.SfdxCommand {
|
|
17
|
-
async run() {
|
|
18
|
-
const { query, plan, prefix, outputdir: outputDir } = this.flags;
|
|
19
|
-
const exportApi = new exportApi_1.ExportApi(this.org, this.ux);
|
|
20
|
-
const exportConfig = {
|
|
21
|
-
outputDir: outputDir,
|
|
22
|
-
plan: plan,
|
|
23
|
-
prefix: prefix,
|
|
24
|
-
query: query,
|
|
25
|
-
};
|
|
26
|
-
return exportApi.export(exportConfig);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.default = Export;
|
|
30
|
-
Export.description = messages.getMessage('description');
|
|
31
|
-
Export.examples = messages.getMessage('examples').split(os.EOL);
|
|
32
|
-
Export.requiresUsername = true;
|
|
33
|
-
Export.flagsConfig = {
|
|
34
|
-
query: command_2.flags.string({
|
|
35
|
-
char: 'q',
|
|
36
|
-
description: messages.getMessage('query'),
|
|
37
|
-
required: true,
|
|
38
|
-
}),
|
|
39
|
-
plan: command_2.flags.boolean({
|
|
40
|
-
char: 'p',
|
|
41
|
-
description: messages.getMessage('plan'),
|
|
42
|
-
}),
|
|
43
|
-
prefix: command_2.flags.string({
|
|
44
|
-
char: 'x',
|
|
45
|
-
description: messages.getMessage('prefix'),
|
|
46
|
-
}),
|
|
47
|
-
outputdir: command_2.flags.directory({
|
|
48
|
-
char: 'd',
|
|
49
|
-
description: messages.getMessage('outputdir'),
|
|
50
|
-
}),
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=export.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/tree/export.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,yBAAyB;AAEzB,iDAAkD;AAClD,iDAAyD;AACzD,2CAAiD;AACjD,mEAA8E;AAG9E,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAEjF,MAAqB,MAAO,SAAQ,qBAAW;IAwBtC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACjE,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,GAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAiB;YACjC,SAAS,EAAE,SAAmB;YAC9B,IAAI,EAAE,IAAe;YACrB,MAAM,EAAE,MAAgB;YACxB,KAAK,EAAE,KAAe;SACvB,CAAC;QACF,OAAO,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;;AAlCH,yBAmCC;AAlCwB,kBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,eAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACzD,uBAAgB,GAAG,IAAI,CAAC;AACxB,kBAAW,GAAgB;IAChD,KAAK,EAAE,eAAK,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;QACzC,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,OAAO,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC;KACzC,CAAC;IACF,MAAM,EAAE,eAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC;KAC3C,CAAC;IACF,SAAS,EAAE,eAAK,CAAC,SAAS,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;KAC9C,CAAC;CACH,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { FlagsConfig, SfdxCommand, SfdxResult } from '@salesforce/command';
|
|
2
|
-
import { JsonMap } from '@salesforce/ts-types';
|
|
3
|
-
interface ImportResult {
|
|
4
|
-
refId: string;
|
|
5
|
-
type: string;
|
|
6
|
-
id: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Command that provides data import capability via the SObject Tree Save API.
|
|
10
|
-
*/
|
|
11
|
-
export default class Import extends SfdxCommand {
|
|
12
|
-
static readonly description: string;
|
|
13
|
-
static readonly examples: string[];
|
|
14
|
-
static readonly requiresUsername = true;
|
|
15
|
-
static readonly flagsConfig: FlagsConfig;
|
|
16
|
-
static result: SfdxResult;
|
|
17
|
-
run(): Promise<ImportResult[] | JsonMap>;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const os = require("os");
|
|
10
|
-
const command_1 = require("@salesforce/command");
|
|
11
|
-
const core_1 = require("@salesforce/core");
|
|
12
|
-
const ts_types_1 = require("@salesforce/ts-types");
|
|
13
|
-
const importApi_1 = require("../../../../api/data/tree/importApi");
|
|
14
|
-
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
-
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'tree.import');
|
|
16
|
-
/**
|
|
17
|
-
* Command that provides data import capability via the SObject Tree Save API.
|
|
18
|
-
*/
|
|
19
|
-
class Import extends command_1.SfdxCommand {
|
|
20
|
-
async run() {
|
|
21
|
-
const importApi = new importApi_1.ImportApi(this.org);
|
|
22
|
-
if (this.flags.confighelp) {
|
|
23
|
-
// Display config help and return
|
|
24
|
-
const schema = importApi.getSchema();
|
|
25
|
-
if (!this.flags.json) {
|
|
26
|
-
const schemaLines = new core_1.SchemaPrinter(this.logger, schema).getLines();
|
|
27
|
-
schemaLines.forEach((line) => this.ux.log(line));
|
|
28
|
-
// turn off table output
|
|
29
|
-
this.result.tableColumnData = undefined;
|
|
30
|
-
}
|
|
31
|
-
return schema;
|
|
32
|
-
}
|
|
33
|
-
const importConfig = {
|
|
34
|
-
sobjectTreeFiles: this.flags.sobjecttreefiles,
|
|
35
|
-
contentType: this.flags.contenttype,
|
|
36
|
-
plan: this.flags.plan,
|
|
37
|
-
};
|
|
38
|
-
const importResults = await importApi.import(importConfig);
|
|
39
|
-
let processedResult = [];
|
|
40
|
-
if (importResults.responseRefs?.length) {
|
|
41
|
-
processedResult = importResults.responseRefs.map((ref) => {
|
|
42
|
-
const type = (0, ts_types_1.getString)(importResults.sobjectTypes, ref.referenceId, 'Unknown');
|
|
43
|
-
return { refId: ref.referenceId, type, id: ref.id };
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
this.ux.styledHeader('Import Results');
|
|
47
|
-
return processedResult;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.default = Import;
|
|
51
|
-
Import.description = messages.getMessage('description');
|
|
52
|
-
Import.examples = messages.getMessage('examples').split(os.EOL);
|
|
53
|
-
Import.requiresUsername = true;
|
|
54
|
-
Import.flagsConfig = {
|
|
55
|
-
sobjecttreefiles: command_1.flags.array({
|
|
56
|
-
char: 'f',
|
|
57
|
-
description: messages.getMessage('sobjecttreefiles'),
|
|
58
|
-
exclusive: ['plan'],
|
|
59
|
-
}),
|
|
60
|
-
plan: command_1.flags.filepath({
|
|
61
|
-
char: 'p',
|
|
62
|
-
description: messages.getMessage('plan'),
|
|
63
|
-
}),
|
|
64
|
-
contenttype: command_1.flags.string({
|
|
65
|
-
char: 'c',
|
|
66
|
-
description: messages.getMessage('contenttype'),
|
|
67
|
-
hidden: true,
|
|
68
|
-
}),
|
|
69
|
-
// displays the schema for a data import plan
|
|
70
|
-
confighelp: command_1.flags.boolean({
|
|
71
|
-
description: messages.getMessage('confighelp'),
|
|
72
|
-
}),
|
|
73
|
-
};
|
|
74
|
-
Import.result = {
|
|
75
|
-
tableColumnData: {
|
|
76
|
-
refId: { header: 'Reference ID' },
|
|
77
|
-
type: { header: 'Type' },
|
|
78
|
-
id: { header: 'ID' },
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=import.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/tree/import.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,yBAAyB;AAEzB,iDAAkF;AAClF,2CAAgE;AAChE,mDAA0D;AAC1D,mEAA8E;AAE9E,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAQjF;;GAEG;AACH,MAAqB,MAAO,SAAQ,qBAAW;IAiCtC,KAAK,CAAC,GAAG;QACd,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,GAAU,CAAC,CAAC;QAEjD,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACzB,iCAAiC;YACjC,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;gBACpB,MAAM,WAAW,GAAG,IAAI,oBAAa,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACtE,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;gBACjD,wBAAwB;gBACxB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,SAAS,CAAC;aACzC;YAED,OAAO,MAAM,CAAC;SACf;QAED,MAAM,YAAY,GAAiB;YACjC,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,gBAA4B;YACzD,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAqB;YAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAc;SA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,CAAC,UAAU,CAAC,aAAa,CAAC;QAC/C,MAAM,EAAE,IAAI;KACb,CAAC;IACF,6CAA6C;IAC7C,UAAU,EAAE,eAAK,CAAC,OAAO,CAAC;QACxB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;KAC/C,CAAC;CACH,CAAC;AAEY,aAAM,GAAe;IACjC,eAAe,EAAE;QACf,KAAK,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;QACjC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;QACxB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;KACrB;CACF,CAAC"}
|
package/lib/dataCommand.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { SfdxCommand } from '@salesforce/command';
|
|
2
|
-
import { AnyJson, Dictionary } from '@salesforce/ts-types';
|
|
3
|
-
import { Connection, Org } from '@salesforce/core';
|
|
4
|
-
import { Record as jsforceRecord, SaveResult, SObject } from 'jsforce';
|
|
5
|
-
import { Tooling } from '@salesforce/core/lib/org';
|
|
6
|
-
export interface Metric {
|
|
7
|
-
requestPath: string;
|
|
8
|
-
perfMetrics: AnyJson;
|
|
9
|
-
}
|
|
10
|
-
interface Result {
|
|
11
|
-
status: number;
|
|
12
|
-
result: AnyJson;
|
|
13
|
-
perfMetrics?: Metric[];
|
|
14
|
-
}
|
|
15
|
-
type ConnectionInternals = {
|
|
16
|
-
_callOptions?: {
|
|
17
|
-
perfOption?: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare abstract class DataCommand extends SfdxCommand {
|
|
21
|
-
private static metrics;
|
|
22
|
-
static addMetric(metric: Metric): void;
|
|
23
|
-
static getMetrics(): Metric[];
|
|
24
|
-
validateIdXorWhereFlags(): void;
|
|
25
|
-
collectErrorMessages(result: SaveResult): string;
|
|
26
|
-
throwIfPathDoesntExist(path: string): Promise<void>;
|
|
27
|
-
getJsonResultObject(result?: AnyJson, status?: number): Result;
|
|
28
|
-
/**
|
|
29
|
-
* Necessary where plugin commands are extending a base class that extends SfdxCommand
|
|
30
|
-
*
|
|
31
|
-
* @returns Org
|
|
32
|
-
*/
|
|
33
|
-
ensureOrg(): Org;
|
|
34
|
-
getConnection(): (Tooling | Connection) & ConnectionInternals;
|
|
35
|
-
query(sobject: SObject<unknown>, where: string): Promise<jsforceRecord>;
|
|
36
|
-
protected stringToDictionary(str: string): Dictionary<string | boolean | Record<string, unknown>>;
|
|
37
|
-
protected normalize<T>(results: T | T[]): T;
|
|
38
|
-
protected logNestedObject(obj: never, indentation?: number): void;
|
|
39
|
-
/**
|
|
40
|
-
* Takes a sequence of key=value string pairs and produces an object out of them.
|
|
41
|
-
* If you repeat the key, it replaces the value with the subsequent value.
|
|
42
|
-
*
|
|
43
|
-
* @param [keyValuePairs] - The list of key=value pair strings.
|
|
44
|
-
*/
|
|
45
|
-
private transformKeyValueSequence;
|
|
46
|
-
private convertToBooleanIfApplicable;
|
|
47
|
-
/**
|
|
48
|
-
* Splits a sequence of 'key=value key="leftValue rightValue" key=value'
|
|
49
|
-
* into a list of key=value pairs, paying attention to quoted whitespace.
|
|
50
|
-
*
|
|
51
|
-
* This is NOT a full push down-automaton so do NOT expect full error handling/recovery.
|
|
52
|
-
*
|
|
53
|
-
* @param {string} text - The sequence to split
|
|
54
|
-
*/
|
|
55
|
-
private parseKeyValueSequence;
|
|
56
|
-
}
|
|
57
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { QueryResult } from 'jsforce';
|
|
2
|
-
import { Optional } from '@salesforce/ts-types';
|
|
3
|
-
export declare enum FieldType {
|
|
4
|
-
field = 0,
|
|
5
|
-
subqueryField = 1,
|
|
6
|
-
functionField = 2
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* interface to represent a field when describing the fields that make up a query result
|
|
10
|
-
*/
|
|
11
|
-
export interface Field {
|
|
12
|
-
fieldType: FieldType;
|
|
13
|
-
name: string;
|
|
14
|
-
fields?: Field[];
|
|
15
|
-
alias?: Optional<string>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Type to define SoqlQuery results
|
|
19
|
-
*/
|
|
20
|
-
export type SoqlQueryResult = {
|
|
21
|
-
query: string;
|
|
22
|
-
result: QueryResult<unknown> & {
|
|
23
|
-
id?: string;
|
|
24
|
-
};
|
|
25
|
-
columns: Field[];
|
|
26
|
-
};
|
|
27
|
-
export type BasicRecord = {
|
|
28
|
-
[index: string]: {
|
|
29
|
-
records: BasicRecord[];
|
|
30
|
-
} | unknown;
|
|
31
|
-
attributes: {
|
|
32
|
-
type: string;
|
|
33
|
-
url: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export interface DataPlanPart {
|
|
37
|
-
sobject: string;
|
|
38
|
-
saveRefs: boolean;
|
|
39
|
-
resolveRefs: boolean;
|
|
40
|
-
files: Array<string | (DataPlanPart & {
|
|
41
|
-
file: string;
|
|
42
|
-
})>;
|
|
43
|
-
}
|
|
44
|
-
export type SObjectTreeInput = {
|
|
45
|
-
attributes: {
|
|
46
|
-
type: string;
|
|
47
|
-
referenceId: string;
|
|
48
|
-
};
|
|
49
|
-
} & {
|
|
50
|
-
[index: string]: {
|
|
51
|
-
records: SObjectTreeInput[];
|
|
52
|
-
} | unknown;
|
|
53
|
-
};
|
|
54
|
-
export type SObjectTreeFileContents = {
|
|
55
|
-
records: SObjectTreeInput[];
|
|
56
|
-
};
|
|
57
|
-
export declare const hasNestedRecords: <T>(element: unknown) => element is {
|
|
58
|
-
records: T[];
|
|
59
|
-
};
|
|
60
|
-
export declare const isAttributesElement: (element: SObjectTreeInput['attributes'] | unknown) => element is {
|
|
61
|
-
type: string;
|
|
62
|
-
referenceId: string;
|
|
63
|
-
};
|
package/lib/index.d.ts
DELETED