@salesforce/plugin-data 2.6.3 → 2.6.4-test.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 +113 -113
- package/lib/BulkBaseCommand.js +26 -26
- package/lib/BulkBaseCommand.js.map +1 -1
- package/lib/api/data/tree/exportApi.js +31 -30
- package/lib/api/data/tree/exportApi.js.map +1 -1
- package/lib/api/data/tree/importApi.js +46 -43
- package/lib/api/data/tree/importApi.js.map +1 -1
- package/lib/batcher.js +24 -17
- package/lib/batcher.js.map +1 -1
- package/lib/bulkDataRequestCache.js +21 -26
- package/lib/bulkDataRequestCache.js.map +1 -1
- package/lib/bulkOperationCommand.js +55 -57
- package/lib/bulkOperationCommand.js.map +1 -1
- package/lib/bulkUtils.js +20 -20
- package/lib/bulkUtils.js.map +1 -1
- package/lib/commands/data/create/record.js +38 -39
- package/lib/commands/data/create/record.js.map +1 -1
- package/lib/commands/data/delete/bulk.js +14 -15
- package/lib/commands/data/delete/bulk.js.map +1 -1
- package/lib/commands/data/delete/record.js +48 -49
- package/lib/commands/data/delete/record.js.map +1 -1
- package/lib/commands/data/delete/resume.js +16 -17
- package/lib/commands/data/delete/resume.js.map +1 -1
- package/lib/commands/data/export/tree.js +38 -39
- package/lib/commands/data/export/tree.js.map +1 -1
- package/lib/commands/data/get/record.js +50 -51
- package/lib/commands/data/get/record.js.map +1 -1
- package/lib/commands/data/import/tree.js +45 -46
- package/lib/commands/data/import/tree.js.map +1 -1
- package/lib/commands/data/query/resume.js +40 -42
- package/lib/commands/data/query/resume.js.map +1 -1
- package/lib/commands/data/query.js +91 -93
- package/lib/commands/data/query.js.map +1 -1
- package/lib/commands/data/resume.js +45 -40
- package/lib/commands/data/resume.js.map +1 -1
- package/lib/commands/data/update/record.js +61 -62
- package/lib/commands/data/update/record.js.map +1 -1
- package/lib/commands/data/upsert/bulk.js +24 -25
- package/lib/commands/data/upsert/bulk.js.map +1 -1
- package/lib/commands/data/upsert/resume.js +15 -16
- package/lib/commands/data/upsert/resume.js.map +1 -1
- package/lib/commands/force/data/bulk/delete.js +42 -43
- package/lib/commands/force/data/bulk/delete.js.map +1 -1
- package/lib/commands/force/data/bulk/status.js +40 -35
- package/lib/commands/force/data/bulk/status.js.map +1 -1
- package/lib/commands/force/data/bulk/upsert.js +54 -55
- package/lib/commands/force/data/bulk/upsert.js.map +1 -1
- package/lib/dataCommand.js +16 -21
- package/lib/dataCommand.js.map +1 -1
- package/lib/dataSoqlQueryTypes.js +4 -9
- package/lib/dataSoqlQueryTypes.js.map +1 -1
- package/lib/flags.js +12 -13
- package/lib/flags.js.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/queryUtils.js +8 -13
- package/lib/queryUtils.js.map +1 -1
- package/lib/reporters.js +52 -59
- package/lib/reporters.js.map +1 -1
- package/lib/resumeBulkCommand.js +37 -39
- package/lib/resumeBulkCommand.js.map +1 -1
- package/lib/types.js +1 -2
- package/oclif.lock +8086 -0
- package/oclif.manifest.json +1614 -854
- package/package.json +33 -50
|
@@ -1,24 +1,74 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const messages =
|
|
21
|
-
class DataSoqlQueryCommand extends
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { Logger, Messages, SfError } from '@salesforce/core';
|
|
11
|
+
import { ensureJsonArray, ensureJsonMap, ensureString, getArray, isJsonArray, toJsonMap, } from '@salesforce/ts-types';
|
|
12
|
+
import { Duration } from '@salesforce/kit';
|
|
13
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
14
|
+
import { orgFlags, perflogFlag, resultFormatFlag } from '../../flags.js';
|
|
15
|
+
import { FieldType } from '../../dataSoqlQueryTypes.js';
|
|
16
|
+
import { displayResults, transformBulkResults } from '../../queryUtils.js';
|
|
17
|
+
import { BulkQueryRequestCache } from '../../bulkDataRequestCache.js';
|
|
18
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
19
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'soql.query');
|
|
20
|
+
export class DataSoqlQueryCommand extends SfCommand {
|
|
21
|
+
static summary = messages.getMessage('summary');
|
|
22
|
+
static description = messages.getMessage('description');
|
|
23
|
+
static examples = messages.getMessages('examples');
|
|
24
|
+
static aliases = ['force:data:soql:query'];
|
|
25
|
+
static deprecateAliases = true;
|
|
26
|
+
static flags = {
|
|
27
|
+
...orgFlags,
|
|
28
|
+
query: Flags.string({
|
|
29
|
+
char: 'q',
|
|
30
|
+
summary: messages.getMessage('flags.query.summary'),
|
|
31
|
+
exactlyOne: ['query', 'file'],
|
|
32
|
+
}),
|
|
33
|
+
file: Flags.file({
|
|
34
|
+
char: 'f',
|
|
35
|
+
exists: true,
|
|
36
|
+
summary: messages.getMessage('flags.file.summary'),
|
|
37
|
+
exactlyOne: ['query', 'file'],
|
|
38
|
+
aliases: ['soqlqueryfile'],
|
|
39
|
+
deprecateAliases: true,
|
|
40
|
+
}),
|
|
41
|
+
'use-tooling-api': Flags.boolean({
|
|
42
|
+
char: 't',
|
|
43
|
+
summary: messages.getMessage('flags.use-tooling-api.summary'),
|
|
44
|
+
aliases: ['usetoolingapi'],
|
|
45
|
+
deprecateAliases: true,
|
|
46
|
+
}),
|
|
47
|
+
bulk: Flags.boolean({
|
|
48
|
+
char: 'b',
|
|
49
|
+
default: false,
|
|
50
|
+
summary: messages.getMessage('flags.bulk.summary'),
|
|
51
|
+
exclusive: ['use-tooling-api'],
|
|
52
|
+
}),
|
|
53
|
+
wait: Flags.duration({
|
|
54
|
+
unit: 'minutes',
|
|
55
|
+
char: 'w',
|
|
56
|
+
summary: messages.getMessage('flags.wait.summary'),
|
|
57
|
+
dependsOn: ['bulk'],
|
|
58
|
+
exclusive: ['async'],
|
|
59
|
+
}),
|
|
60
|
+
async: Flags.boolean({
|
|
61
|
+
summary: messages.getMessage('flags.async.summary'),
|
|
62
|
+
dependsOn: ['bulk'],
|
|
63
|
+
exclusive: ['wait'],
|
|
64
|
+
}),
|
|
65
|
+
'all-rows': Flags.boolean({
|
|
66
|
+
summary: messages.getMessage('flags.all-rows.summary'),
|
|
67
|
+
}),
|
|
68
|
+
'result-format': resultFormatFlag,
|
|
69
|
+
perflog: perflogFlag,
|
|
70
|
+
};
|
|
71
|
+
logger;
|
|
22
72
|
// will init from run
|
|
23
73
|
/**
|
|
24
74
|
* Command run implementation
|
|
@@ -35,7 +85,7 @@ class DataSoqlQueryCommand extends sf_plugins_core_1.SfCommand {
|
|
|
35
85
|
*
|
|
36
86
|
*/
|
|
37
87
|
async run() {
|
|
38
|
-
this.logger = await
|
|
88
|
+
this.logger = await Logger.child('data:soql:query');
|
|
39
89
|
const flags = (await this.parse(DataSoqlQueryCommand)).flags;
|
|
40
90
|
try {
|
|
41
91
|
// soqlqueryfile will be present if flags.query isn't. Oclif exactlyOne isn't quite that clever
|
|
@@ -44,10 +94,10 @@ class DataSoqlQueryCommand extends sf_plugins_core_1.SfCommand {
|
|
|
44
94
|
if (flags['result-format'] !== 'json')
|
|
45
95
|
this.spinner.start(messages.getMessage('queryRunningMessage'));
|
|
46
96
|
const queryResult = flags.bulk
|
|
47
|
-
? await this.runBulkSoqlQuery(conn, queryString, flags.async ?
|
|
97
|
+
? await this.runBulkSoqlQuery(conn, queryString, flags.async ? Duration.minutes(0) : flags.wait ?? Duration.minutes(0), flags['all-rows'] === true)
|
|
48
98
|
: await this.runSoqlQuery(flags['use-tooling-api'] ? conn.tooling : conn, queryString, this.logger, this.configAggregator.getInfo('org-max-query-limit').value, flags['all-rows']);
|
|
49
99
|
if (!this.jsonEnabled()) {
|
|
50
|
-
|
|
100
|
+
displayResults({ ...queryResult }, flags['result-format']);
|
|
51
101
|
}
|
|
52
102
|
return queryResult.result;
|
|
53
103
|
}
|
|
@@ -64,23 +114,23 @@ class DataSoqlQueryCommand extends sf_plugins_core_1.SfCommand {
|
|
|
64
114
|
* @param timeout
|
|
65
115
|
*/
|
|
66
116
|
async runBulkSoqlQuery(connection, query, timeout, allRows = false) {
|
|
67
|
-
connection.bulk2.pollTimeout = timeout.milliseconds ??
|
|
117
|
+
connection.bulk2.pollTimeout = timeout.milliseconds ?? Duration.minutes(5).milliseconds;
|
|
68
118
|
let res;
|
|
69
119
|
try {
|
|
70
120
|
res = (await connection.bulk2.query(query, allRows ? { scanAll: true } : {})) ?? [];
|
|
71
|
-
return
|
|
121
|
+
return transformBulkResults(res, query);
|
|
72
122
|
}
|
|
73
123
|
catch (e) {
|
|
74
124
|
const err = e;
|
|
75
125
|
if (timeout.minutes === 0 && err.name === 'JobPollingTimeout') {
|
|
76
126
|
// async query, so we can't throw an error, suggest data:query:resume --queryid <id>
|
|
77
|
-
const cache = await
|
|
127
|
+
const cache = await BulkQueryRequestCache.create();
|
|
78
128
|
await cache.createCacheEntryForRequest(err.jobId, connection.getUsername(), connection.getApiVersion());
|
|
79
129
|
this.log(messages.getMessage('bulkQueryTimeout', [err.jobId, err.jobId, connection.getUsername()]));
|
|
80
130
|
return { columns: [], result: { done: false, records: [], totalSize: 0, id: err.jobId }, query };
|
|
81
131
|
}
|
|
82
132
|
else {
|
|
83
|
-
throw
|
|
133
|
+
throw SfError.wrap(err);
|
|
84
134
|
}
|
|
85
135
|
}
|
|
86
136
|
}
|
|
@@ -95,7 +145,7 @@ class DataSoqlQueryCommand extends sf_plugins_core_1.SfCommand {
|
|
|
95
145
|
this.warn(`The query result is missing ${result.totalSize - result.records.length} records due to a ${maxFetch} record limit. Increase the number of records returned by setting the config value "org-max-query-limit" or the environment variable "SF_ORG_MAX_QUERY_LIMIT" to ${result.totalSize} or greater than ${maxFetch}.`);
|
|
96
146
|
}
|
|
97
147
|
logger.debug(`Query complete with ${result.totalSize} records returned`);
|
|
98
|
-
const columns = result.totalSize ? await
|
|
148
|
+
const columns = result.totalSize ? await retrieveColumns(connection, query, logger) : [];
|
|
99
149
|
return {
|
|
100
150
|
query,
|
|
101
151
|
columns,
|
|
@@ -103,61 +153,10 @@ class DataSoqlQueryCommand extends sf_plugins_core_1.SfCommand {
|
|
|
103
153
|
};
|
|
104
154
|
}
|
|
105
155
|
}
|
|
106
|
-
exports.DataSoqlQueryCommand = DataSoqlQueryCommand;
|
|
107
|
-
DataSoqlQueryCommand.summary = messages.getMessage('summary');
|
|
108
|
-
DataSoqlQueryCommand.description = messages.getMessage('description');
|
|
109
|
-
DataSoqlQueryCommand.examples = messages.getMessages('examples');
|
|
110
|
-
DataSoqlQueryCommand.aliases = ['force:data:soql:query'];
|
|
111
|
-
DataSoqlQueryCommand.deprecateAliases = true;
|
|
112
|
-
DataSoqlQueryCommand.flags = {
|
|
113
|
-
...flags_1.orgFlags,
|
|
114
|
-
query: sf_plugins_core_1.Flags.string({
|
|
115
|
-
char: 'q',
|
|
116
|
-
summary: messages.getMessage('flags.query.summary'),
|
|
117
|
-
exactlyOne: ['query', 'file'],
|
|
118
|
-
}),
|
|
119
|
-
file: sf_plugins_core_1.Flags.file({
|
|
120
|
-
char: 'f',
|
|
121
|
-
exists: true,
|
|
122
|
-
summary: messages.getMessage('flags.file.summary'),
|
|
123
|
-
exactlyOne: ['query', 'file'],
|
|
124
|
-
aliases: ['soqlqueryfile'],
|
|
125
|
-
deprecateAliases: true,
|
|
126
|
-
}),
|
|
127
|
-
'use-tooling-api': sf_plugins_core_1.Flags.boolean({
|
|
128
|
-
char: 't',
|
|
129
|
-
summary: messages.getMessage('flags.use-tooling-api.summary'),
|
|
130
|
-
aliases: ['usetoolingapi'],
|
|
131
|
-
deprecateAliases: true,
|
|
132
|
-
}),
|
|
133
|
-
bulk: sf_plugins_core_1.Flags.boolean({
|
|
134
|
-
char: 'b',
|
|
135
|
-
default: false,
|
|
136
|
-
summary: messages.getMessage('flags.bulk.summary'),
|
|
137
|
-
exclusive: ['use-tooling-api'],
|
|
138
|
-
}),
|
|
139
|
-
wait: sf_plugins_core_1.Flags.duration({
|
|
140
|
-
unit: 'minutes',
|
|
141
|
-
char: 'w',
|
|
142
|
-
summary: messages.getMessage('flags.wait.summary'),
|
|
143
|
-
dependsOn: ['bulk'],
|
|
144
|
-
exclusive: ['async'],
|
|
145
|
-
}),
|
|
146
|
-
async: sf_plugins_core_1.Flags.boolean({
|
|
147
|
-
summary: messages.getMessage('flags.async.summary'),
|
|
148
|
-
dependsOn: ['bulk'],
|
|
149
|
-
exclusive: ['wait'],
|
|
150
|
-
}),
|
|
151
|
-
'all-rows': sf_plugins_core_1.Flags.boolean({
|
|
152
|
-
summary: messages.getMessage('flags.all-rows.summary'),
|
|
153
|
-
}),
|
|
154
|
-
'result-format': flags_1.resultFormatFlag,
|
|
155
|
-
perflog: flags_1.perflogFlag,
|
|
156
|
-
};
|
|
157
156
|
const searchSubColumnsRecursively = (parent) => {
|
|
158
|
-
const column =
|
|
159
|
-
const name =
|
|
160
|
-
const child =
|
|
157
|
+
const column = ensureJsonMap(parent);
|
|
158
|
+
const name = ensureString(column.columnName);
|
|
159
|
+
const child = getArray(parent, 'joinColumns');
|
|
161
160
|
return child.length ? child.map((c) => `${name}.${searchSubColumnsRecursively(c).join('.')}`) : [name];
|
|
162
161
|
};
|
|
163
162
|
/**
|
|
@@ -170,36 +169,35 @@ const searchSubColumnsRecursively = (parent) => {
|
|
|
170
169
|
* @param query
|
|
171
170
|
* @param logger
|
|
172
171
|
*/
|
|
173
|
-
const retrieveColumns = async (connection, query, logger) => {
|
|
172
|
+
export const retrieveColumns = async (connection, query, logger) => {
|
|
174
173
|
logger?.debug('fetching columns for query');
|
|
175
174
|
// eslint-disable-next-line no-underscore-dangle
|
|
176
175
|
const columnUrl = `${connection._baseUrl()}/query?q=${encodeURIComponent(query)}&columns=true`;
|
|
177
|
-
const results =
|
|
178
|
-
return recursivelyFindColumns(
|
|
176
|
+
const results = toJsonMap(await connection.request(columnUrl));
|
|
177
|
+
return recursivelyFindColumns(ensureJsonArray(results.columnMetadata));
|
|
179
178
|
};
|
|
180
|
-
exports.retrieveColumns = retrieveColumns;
|
|
181
179
|
const recursivelyFindColumns = (data) => {
|
|
182
180
|
const columns = [];
|
|
183
181
|
for (let column of data) {
|
|
184
|
-
column =
|
|
185
|
-
const name =
|
|
186
|
-
if (
|
|
182
|
+
column = ensureJsonMap(column);
|
|
183
|
+
const name = ensureString(column.columnName);
|
|
184
|
+
if (isJsonArray(column.joinColumns) && column.joinColumns.length > 0) {
|
|
187
185
|
if (column.aggregate) {
|
|
188
186
|
const field = {
|
|
189
|
-
fieldType:
|
|
187
|
+
fieldType: FieldType.subqueryField,
|
|
190
188
|
name,
|
|
191
189
|
fields: [],
|
|
192
190
|
};
|
|
193
191
|
for (let subcolumn of column.joinColumns) {
|
|
194
|
-
subcolumn =
|
|
195
|
-
if (
|
|
192
|
+
subcolumn = ensureJsonMap(subcolumn);
|
|
193
|
+
if (isJsonArray(column.joinColumns) && column.joinColumns.length > 0) {
|
|
196
194
|
if (field.fields)
|
|
197
195
|
field.fields.push(...recursivelyFindColumns([subcolumn]));
|
|
198
196
|
}
|
|
199
197
|
else {
|
|
200
198
|
const f = {
|
|
201
|
-
fieldType:
|
|
202
|
-
name:
|
|
199
|
+
fieldType: FieldType.field,
|
|
200
|
+
name: ensureString(ensureJsonMap(subcolumn).columnName),
|
|
203
201
|
};
|
|
204
202
|
if (field.fields)
|
|
205
203
|
field.fields.push(f);
|
|
@@ -212,7 +210,7 @@ const recursivelyFindColumns = (data) => {
|
|
|
212
210
|
const allSubFieldNames = searchSubColumnsRecursively(subcolumn);
|
|
213
211
|
for (const subFields of allSubFieldNames) {
|
|
214
212
|
columns.push({
|
|
215
|
-
fieldType:
|
|
213
|
+
fieldType: FieldType.field,
|
|
216
214
|
name: `${name}.${subFields}`,
|
|
217
215
|
});
|
|
218
216
|
}
|
|
@@ -221,8 +219,8 @@ const recursivelyFindColumns = (data) => {
|
|
|
221
219
|
}
|
|
222
220
|
else if (column.aggregate) {
|
|
223
221
|
const field = {
|
|
224
|
-
fieldType:
|
|
225
|
-
name:
|
|
222
|
+
fieldType: FieldType.functionField,
|
|
223
|
+
name: ensureString(column.displayName),
|
|
226
224
|
};
|
|
227
225
|
// If it isn't an alias, skip so the display name is used when messaging rows
|
|
228
226
|
if (!/expr[0-9]+/.test(name)) {
|
|
@@ -231,7 +229,7 @@ const recursivelyFindColumns = (data) => {
|
|
|
231
229
|
columns.push(field);
|
|
232
230
|
}
|
|
233
231
|
else {
|
|
234
|
-
columns.push({ fieldType:
|
|
232
|
+
columns.push({ fieldType: FieldType.field, name });
|
|
235
233
|
}
|
|
236
234
|
}
|
|
237
235
|
return columns;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/commands/data/query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/commands/data/query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAc,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAEL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,WAAW,EAEX,SAAS,GACV,MAAM,sBAAsB,CAAC;AAC9B,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,CAAC,SAAS,EAAE;YAC3B,MAAM,KAAK,GAAU;gBACnB,SAAS,EAAE,SAAS,CAAC,aAAa;gBAClC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC;aACvC,CAAC;YACF,6EAA6E;YAC7E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAC5B,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;aACpB;YACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAW,CAAC,CAAC;SAC7D;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,17 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
10
|
+
import { SfCommand, Flags, Ux } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { orgFlags } from '../../flags.js';
|
|
12
|
+
import { Batcher } from '../../batcher.js';
|
|
13
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'data.resume');
|
|
15
|
+
export default class Status extends SfCommand {
|
|
16
|
+
static state = 'deprecated';
|
|
17
|
+
static deprecationOptions = {
|
|
18
|
+
to: 'force:data:bulk:status',
|
|
19
|
+
message: 'Use force:data:bulk:status instead',
|
|
20
|
+
};
|
|
21
|
+
static summary = messages.getMessage('summary');
|
|
22
|
+
static description = messages.getMessage('description');
|
|
23
|
+
static examples = messages.getMessages('examples');
|
|
24
|
+
static flags = {
|
|
25
|
+
...orgFlags,
|
|
26
|
+
'batch-id': Flags.salesforceId({
|
|
27
|
+
length: 18,
|
|
28
|
+
char: 'b',
|
|
29
|
+
startsWith: '751',
|
|
30
|
+
summary: messages.getMessage('flags.batch-id.summary'),
|
|
31
|
+
aliases: ['batchid'],
|
|
32
|
+
deprecateAliases: true,
|
|
33
|
+
}),
|
|
34
|
+
'job-id': Flags.salesforceId({
|
|
35
|
+
length: 18,
|
|
36
|
+
char: 'i',
|
|
37
|
+
startsWith: '750',
|
|
38
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
39
|
+
required: true,
|
|
40
|
+
aliases: ['jobid'],
|
|
41
|
+
deprecateAliases: true,
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
10
44
|
async run() {
|
|
11
45
|
const { flags } = await this.parse(Status);
|
|
12
46
|
this.spinner.start('Getting Status');
|
|
13
47
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
14
|
-
const batcher = new
|
|
48
|
+
const batcher = new Batcher(conn, new Ux({ jsonEnabled: this.jsonEnabled() }), this.config.bin, this.config.pjson.oclif.topicSeparator ?? ':');
|
|
15
49
|
if (flags['job-id'] && flags['batch-id']) {
|
|
16
50
|
// view batch status
|
|
17
51
|
const job = conn.bulk.job(flags['job-id']);
|
|
@@ -24,7 +58,7 @@ class Status extends sf_plugins_core_1.SfCommand {
|
|
|
24
58
|
}
|
|
25
59
|
});
|
|
26
60
|
if (!found) {
|
|
27
|
-
throw new
|
|
61
|
+
throw new SfError(messages.getMessage('NoBatchFound', [flags['batch-id'], flags['job-id']]), 'NoBatchFound');
|
|
28
62
|
}
|
|
29
63
|
this.spinner.stop();
|
|
30
64
|
return batches;
|
|
@@ -37,33 +71,4 @@ class Status extends sf_plugins_core_1.SfCommand {
|
|
|
37
71
|
}
|
|
38
72
|
}
|
|
39
73
|
}
|
|
40
|
-
Status.state = 'deprecated';
|
|
41
|
-
Status.deprecationOptions = {
|
|
42
|
-
to: 'force:data:bulk:status',
|
|
43
|
-
message: 'Use force:data:bulk:status instead',
|
|
44
|
-
};
|
|
45
|
-
Status.summary = messages.getMessage('summary');
|
|
46
|
-
Status.description = messages.getMessage('description');
|
|
47
|
-
Status.examples = messages.getMessages('examples');
|
|
48
|
-
Status.flags = {
|
|
49
|
-
...flags_1.orgFlags,
|
|
50
|
-
'batch-id': sf_plugins_core_1.Flags.salesforceId({
|
|
51
|
-
length: 18,
|
|
52
|
-
char: 'b',
|
|
53
|
-
startsWith: '751',
|
|
54
|
-
summary: messages.getMessage('flags.batch-id.summary'),
|
|
55
|
-
aliases: ['batchid'],
|
|
56
|
-
deprecateAliases: true,
|
|
57
|
-
}),
|
|
58
|
-
'job-id': sf_plugins_core_1.Flags.salesforceId({
|
|
59
|
-
length: 18,
|
|
60
|
-
char: 'i',
|
|
61
|
-
startsWith: '750',
|
|
62
|
-
summary: messages.getMessage('flags.job-id.summary'),
|
|
63
|
-
required: true,
|
|
64
|
-
aliases: ['jobid'],
|
|
65
|
-
deprecateAliases: true,
|
|
66
|
-
}),
|
|
67
|
-
};
|
|
68
|
-
exports.default = Status;
|
|
69
74
|
//# sourceMappingURL=resume.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../src/commands/data/resume.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../src/commands/data/resume.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MA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,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;aAC9G;YAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,OAAO,CAAC;SAChB;aAAM;YACL,kBAAkB;YAClB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,wBAAwB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1E,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,SAAS,CAAC;SAClB;IACH,CAAC"}
|
|
@@ -1,19 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
10
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { orgFlags } from '../../../flags.js';
|
|
12
|
+
import { collectErrorMessages, query, stringToDictionary } from '../../../dataCommand.js';
|
|
13
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'record.update');
|
|
15
|
+
const commonMessages = Messages.loadMessages('@salesforce/plugin-data', 'messages');
|
|
16
|
+
export default class Update extends SfCommand {
|
|
17
|
+
static summary = messages.getMessage('summary');
|
|
18
|
+
static description = messages.getMessage('description');
|
|
19
|
+
static examples = messages.getMessages('examples');
|
|
20
|
+
static aliases = ['force:data:record:update'];
|
|
21
|
+
static deprecateAliases = true;
|
|
22
|
+
static flags = {
|
|
23
|
+
...orgFlags,
|
|
24
|
+
sobject: Flags.string({
|
|
25
|
+
char: 's',
|
|
26
|
+
required: true,
|
|
27
|
+
summary: messages.getMessage('flags.sobject.summary'),
|
|
28
|
+
aliases: ['sobjecttype'],
|
|
29
|
+
deprecateAliases: true,
|
|
30
|
+
}),
|
|
31
|
+
// eslint-disable-next-line sf-plugin/id-flag-suggestions
|
|
32
|
+
'record-id': Flags.salesforceId({
|
|
33
|
+
char: 'i',
|
|
34
|
+
length: 'both',
|
|
35
|
+
summary: messages.getMessage('flags.record-id.summary'),
|
|
36
|
+
exactlyOne: ['where', 'record-id'],
|
|
37
|
+
aliases: ['sobjectid'],
|
|
38
|
+
deprecateAliases: true,
|
|
39
|
+
}),
|
|
40
|
+
where: Flags.string({
|
|
41
|
+
char: 'w',
|
|
42
|
+
summary: messages.getMessage('flags.where.summary'),
|
|
43
|
+
exactlyOne: ['where', 'record-id'],
|
|
44
|
+
}),
|
|
45
|
+
values: Flags.string({
|
|
46
|
+
char: 'v',
|
|
47
|
+
required: true,
|
|
48
|
+
summary: messages.getMessage('flags.values.summary'),
|
|
49
|
+
}),
|
|
50
|
+
'use-tooling-api': Flags.boolean({
|
|
51
|
+
char: 't',
|
|
52
|
+
summary: messages.getMessage('flags.use-tooling-api.summary'),
|
|
53
|
+
aliases: ['usetoolingapi'],
|
|
54
|
+
deprecateAliases: true,
|
|
55
|
+
}),
|
|
56
|
+
perflog: Flags.boolean({
|
|
57
|
+
summary: commonMessages.getMessage('perfLogLevelOption'),
|
|
58
|
+
hidden: true,
|
|
59
|
+
deprecated: {
|
|
60
|
+
version: '57',
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
17
64
|
async run() {
|
|
18
65
|
const { flags } = await this.parse(Update);
|
|
19
66
|
this.spinner.start('Updating Record');
|
|
@@ -22,15 +69,15 @@ class Update extends sf_plugins_core_1.SfCommand {
|
|
|
22
69
|
? flags['target-org'].getConnection(flags['api-version']).tooling
|
|
23
70
|
: flags['target-org'].getConnection(flags['api-version']);
|
|
24
71
|
// oclif isn't smart of enough to know that if record-id is not set, then where is set
|
|
25
|
-
const sObjectId = flags['record-id'] ?? (await
|
|
72
|
+
const sObjectId = flags['record-id'] ?? (await query(conn, flags.sobject, flags.where)).Id;
|
|
26
73
|
try {
|
|
27
|
-
const updateObject = { ...
|
|
74
|
+
const updateObject = { ...stringToDictionary(flags.values), Id: sObjectId };
|
|
28
75
|
const result = await conn.sobject(flags.sobject).update(updateObject);
|
|
29
76
|
if (result.success) {
|
|
30
77
|
this.log(messages.getMessage('updateSuccess', [sObjectId]));
|
|
31
78
|
}
|
|
32
79
|
else {
|
|
33
|
-
const errors =
|
|
80
|
+
const errors = collectErrorMessages(result);
|
|
34
81
|
this.error(messages.getMessage('updateFailure', [errors]));
|
|
35
82
|
}
|
|
36
83
|
this.spinner.stop(status);
|
|
@@ -40,7 +87,7 @@ class Update extends sf_plugins_core_1.SfCommand {
|
|
|
40
87
|
status = 'Failed';
|
|
41
88
|
this.spinner.stop(status);
|
|
42
89
|
if (isSaveResult(err)) {
|
|
43
|
-
throw new
|
|
90
|
+
throw new SfError(messages.getMessage('updateFailureWithFields', [err.errorCode, err.message, (err.fields ?? []).join(',')]));
|
|
44
91
|
}
|
|
45
92
|
else {
|
|
46
93
|
throw err;
|
|
@@ -48,54 +95,6 @@ class Update extends sf_plugins_core_1.SfCommand {
|
|
|
48
95
|
}
|
|
49
96
|
}
|
|
50
97
|
}
|
|
51
|
-
Update.summary = messages.getMessage('summary');
|
|
52
|
-
Update.description = messages.getMessage('description');
|
|
53
|
-
Update.examples = messages.getMessages('examples');
|
|
54
|
-
Update.aliases = ['force:data:record:update'];
|
|
55
|
-
Update.deprecateAliases = true;
|
|
56
|
-
Update.flags = {
|
|
57
|
-
...flags_1.orgFlags,
|
|
58
|
-
sobject: sf_plugins_core_1.Flags.string({
|
|
59
|
-
char: 's',
|
|
60
|
-
required: true,
|
|
61
|
-
summary: messages.getMessage('flags.sobject.summary'),
|
|
62
|
-
aliases: ['sobjecttype'],
|
|
63
|
-
deprecateAliases: true,
|
|
64
|
-
}),
|
|
65
|
-
// eslint-disable-next-line sf-plugin/id-flag-suggestions
|
|
66
|
-
'record-id': sf_plugins_core_1.Flags.salesforceId({
|
|
67
|
-
char: 'i',
|
|
68
|
-
length: 'both',
|
|
69
|
-
summary: messages.getMessage('flags.record-id.summary'),
|
|
70
|
-
exactlyOne: ['where', 'record-id'],
|
|
71
|
-
aliases: ['sobjectid'],
|
|
72
|
-
deprecateAliases: true,
|
|
73
|
-
}),
|
|
74
|
-
where: sf_plugins_core_1.Flags.string({
|
|
75
|
-
char: 'w',
|
|
76
|
-
summary: messages.getMessage('flags.where.summary'),
|
|
77
|
-
exactlyOne: ['where', 'record-id'],
|
|
78
|
-
}),
|
|
79
|
-
values: sf_plugins_core_1.Flags.string({
|
|
80
|
-
char: 'v',
|
|
81
|
-
required: true,
|
|
82
|
-
summary: messages.getMessage('flags.values.summary'),
|
|
83
|
-
}),
|
|
84
|
-
'use-tooling-api': sf_plugins_core_1.Flags.boolean({
|
|
85
|
-
char: 't',
|
|
86
|
-
summary: messages.getMessage('flags.use-tooling-api.summary'),
|
|
87
|
-
aliases: ['usetoolingapi'],
|
|
88
|
-
deprecateAliases: true,
|
|
89
|
-
}),
|
|
90
|
-
perflog: sf_plugins_core_1.Flags.boolean({
|
|
91
|
-
summary: commonMessages.getMessage('perfLogLevelOption'),
|
|
92
|
-
hidden: true,
|
|
93
|
-
deprecated: {
|
|
94
|
-
version: '57',
|
|
95
|
-
},
|
|
96
|
-
}),
|
|
97
|
-
};
|
|
98
|
-
exports.default = Update;
|
|
99
98
|
const isSaveResult = (error) => {
|
|
100
99
|
const se = error;
|
|
101
100
|
return Boolean(se.fields && se.errorCode && se.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../../../src/commands/data/update/record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../../../src/commands/data/update/record.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE1F,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;AACnF,MAAM,cAAc,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,UAAU,CAAC,CAAC;AAEpF,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAqB;IAChD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,OAAO,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACvD,MAAM,CAAU,gBAAgB,GAAG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