@salesforce/plugin-data 2.2.0 → 2.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/lib/BulkBaseCommand.js +103 -0
- package/lib/BulkBaseCommand.js.map +1 -0
- package/lib/api/data/tree/importApi.js +11 -2
- package/lib/api/data/tree/importApi.js.map +1 -1
- package/lib/batcher.js +24 -3
- package/lib/batcher.js.map +1 -1
- package/lib/bulkDataRequestCache.js +147 -0
- package/lib/bulkDataRequestCache.js.map +1 -0
- package/lib/bulkOperationCommand.js +123 -0
- package/lib/bulkOperationCommand.js.map +1 -0
- package/lib/bulkUtils.js +48 -0
- package/lib/bulkUtils.js.map +1 -0
- package/lib/commands/data/delete/bulk.js +12 -59
- package/lib/commands/data/delete/bulk.js.map +1 -1
- package/lib/commands/data/delete/record.js +2 -0
- package/lib/commands/data/delete/record.js.map +1 -1
- package/lib/commands/data/delete/resume.js +35 -0
- package/lib/commands/data/delete/resume.js.map +1 -0
- package/lib/commands/data/get/record.js +2 -0
- package/lib/commands/data/get/record.js.map +1 -1
- package/lib/commands/data/import/tree.js +1 -1
- package/lib/commands/data/import/tree.js.map +1 -1
- package/lib/commands/data/query/resume.js +22 -14
- package/lib/commands/data/query/resume.js.map +1 -1
- package/lib/commands/data/query.js +55 -102
- package/lib/commands/data/query.js.map +1 -1
- package/lib/commands/data/resume.js +9 -4
- package/lib/commands/data/resume.js.map +1 -1
- package/lib/commands/data/update/record.js +2 -0
- package/lib/commands/data/update/record.js.map +1 -1
- package/lib/commands/data/upsert/bulk.js +11 -56
- package/lib/commands/data/upsert/bulk.js.map +1 -1
- package/lib/commands/data/upsert/resume.js +34 -0
- package/lib/commands/data/upsert/resume.js.map +1 -0
- package/lib/commands/force/data/bulk/delete.js +79 -0
- package/lib/commands/force/data/bulk/delete.js.map +1 -0
- package/lib/commands/force/data/bulk/status.js +64 -0
- package/lib/commands/force/data/bulk/status.js.map +1 -0
- package/lib/commands/force/data/bulk/upsert.js +88 -0
- package/lib/commands/force/data/bulk/upsert.js.map +1 -0
- package/lib/flags.js +16 -3
- package/lib/flags.js.map +1 -1
- package/lib/queryUtils.js +45 -0
- package/lib/queryUtils.js.map +1 -0
- package/lib/reporters.js +52 -13
- package/lib/reporters.js.map +1 -1
- package/lib/resumeBulkCommand.js +63 -0
- package/lib/resumeBulkCommand.js.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/messages/batcher.md +3 -3
- package/messages/bulk.base.command.md +24 -0
- package/messages/bulk.delete.md +5 -5
- package/messages/bulk.delete.resume.md +17 -0
- package/messages/bulk.operation.command.md +15 -0
- package/messages/bulk.report.md +4 -0
- package/messages/bulk.resume.command.md +15 -0
- package/messages/bulk.status.md +5 -5
- package/messages/bulk.upsert.md +5 -5
- package/messages/bulk.upsert.resume.md +17 -0
- package/messages/bulkv2.delete.md +19 -0
- package/messages/bulkv2.upsert.md +25 -0
- package/messages/data.resume.md +29 -0
- package/messages/importApi.md +3 -4
- package/messages/messages.md +28 -0
- package/messages/reporter.md +3 -0
- package/messages/soql.query.md +2 -2
- package/oclif.manifest.json +503 -63
- package/package.json +36 -21
|
@@ -63,8 +63,10 @@ Update.flags = {
|
|
|
63
63
|
aliases: ['sobjecttype'],
|
|
64
64
|
deprecateAliases: true,
|
|
65
65
|
}),
|
|
66
|
+
// eslint-disable-next-line sf-plugin/id-flag-suggestions
|
|
66
67
|
'record-id': sf_plugins_core_1.Flags.salesforceId({
|
|
67
68
|
char: 'i',
|
|
69
|
+
length: 'both',
|
|
68
70
|
summary: messages.getMessage('flags.recordId'),
|
|
69
71
|
exactlyOne: ['where', 'record-id'],
|
|
70
72
|
aliases: ['sobjectid'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../../../src/commands/data/update/record.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAAqD;AAErD,iEAA+D;AAC/D,0CAA0C;AAC1C,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,CAAC,qBAAqB,CAAC;QACnD,OAAO,EAAE,CAAC,eAAe,CAAC;QAC1B,gBAAgB,EAAE,IAAI;KACvB,CAAC;IACF,OAAO,EAAE,uBAAK,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,oBAAoB,CAAC;QACxD,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE;YACV,OAAO,EAAE,IAAI;SACd;KACF,CAAC;CACH,CAAC;AAqCJ,MAAM,YAAY,GAAG,CAAC,KAAkC,EAAsB,EAAE;IAC9E,MAAM,EAAE,GAAG,KAAkB,CAAC;IAC9B,OAAO,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC;AAC1D,CAAC,CAAC"}
|
|
@@ -6,50 +6,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
* Licensed under the BSD 3-Clause license.
|
|
7
7
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
8
|
*/
|
|
9
|
-
const fs = require("fs");
|
|
10
9
|
const core_1 = require("@salesforce/core");
|
|
11
10
|
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
const bulkDataRequestCache_1 = require("../../../bulkDataRequestCache");
|
|
12
|
+
const bulkOperationCommand_1 = require("../../../bulkOperationCommand");
|
|
13
|
+
const bulkUtils_1 = require("../../../bulkUtils");
|
|
15
14
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
|
-
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', '
|
|
17
|
-
class Upsert extends
|
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'bulkv2.upsert');
|
|
16
|
+
class Upsert extends bulkOperationCommand_1.BulkOperationCommand {
|
|
18
17
|
async run() {
|
|
19
18
|
const { flags } = await this.parse(Upsert);
|
|
20
19
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const csvStream = fs.createReadStream(flags.file, { encoding: 'utf-8' });
|
|
24
|
-
const concurrencyMode = flags.serial ? 'Serial' : 'Parallel';
|
|
25
|
-
const job = conn.bulk.createJob(flags.sobject, 'upsert', {
|
|
20
|
+
await (0, bulkUtils_1.validateSobjectType)(flags.sobject, conn);
|
|
21
|
+
return this.runBulkOperation(flags.sobject, flags.file, conn, flags.async ? 0 : flags.wait?.minutes, 'upsert', {
|
|
26
22
|
extIdField: flags['external-id'],
|
|
27
|
-
concurrencyMode,
|
|
28
|
-
});
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises,no-async-promise-executor
|
|
30
|
-
return new Promise(async (resolve, reject) => {
|
|
31
|
-
job.on('error', (err) => {
|
|
32
|
-
reject(err);
|
|
33
|
-
});
|
|
34
|
-
try {
|
|
35
|
-
resolve(await batcher.createAndExecuteBatches(job, csvStream, flags.sobject, flags.wait?.minutes));
|
|
36
|
-
this.spinner.stop();
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
this.spinner.stop('error');
|
|
40
|
-
reject(e);
|
|
41
|
-
}
|
|
42
23
|
});
|
|
43
24
|
}
|
|
25
|
+
// eslint-disable-next-line class-methods-use-this
|
|
26
|
+
async getCache() {
|
|
27
|
+
return bulkDataRequestCache_1.BulkUpsertRequestCache.create();
|
|
28
|
+
}
|
|
44
29
|
}
|
|
45
30
|
exports.default = Upsert;
|
|
46
31
|
Upsert.summary = messages.getMessage('summary');
|
|
47
32
|
Upsert.description = messages.getMessage('description');
|
|
48
33
|
Upsert.examples = messages.getMessages('examples');
|
|
49
|
-
Upsert.aliases = ['force:data:bulk:upsert'];
|
|
50
|
-
Upsert.deprecateAliases = true;
|
|
51
34
|
Upsert.flags = {
|
|
52
|
-
...flags_1.orgFlags,
|
|
53
35
|
'external-id': sf_plugins_core_1.Flags.string({
|
|
54
36
|
char: 'i',
|
|
55
37
|
summary: messages.getMessage('flags.externalid'),
|
|
@@ -57,32 +39,5 @@ Upsert.flags = {
|
|
|
57
39
|
aliases: ['externalid'],
|
|
58
40
|
deprecateAliases: true,
|
|
59
41
|
}),
|
|
60
|
-
file: sf_plugins_core_1.Flags.file({
|
|
61
|
-
exists: true,
|
|
62
|
-
char: 'f',
|
|
63
|
-
summary: messages.getMessage('flags.csvfile'),
|
|
64
|
-
required: true,
|
|
65
|
-
aliases: ['csvfile'],
|
|
66
|
-
deprecateAliases: true,
|
|
67
|
-
}),
|
|
68
|
-
sobject: sf_plugins_core_1.Flags.string({
|
|
69
|
-
char: 's',
|
|
70
|
-
summary: messages.getMessage('flags.sobjecttype'),
|
|
71
|
-
required: true,
|
|
72
|
-
aliases: ['sobjecttype'],
|
|
73
|
-
deprecateAliases: true,
|
|
74
|
-
}),
|
|
75
|
-
wait: sf_plugins_core_1.Flags.duration({
|
|
76
|
-
char: 'w',
|
|
77
|
-
unit: 'minutes',
|
|
78
|
-
summary: messages.getMessage('flags.wait'),
|
|
79
|
-
min: 0,
|
|
80
|
-
default: kit_1.Duration.minutes(0),
|
|
81
|
-
}),
|
|
82
|
-
serial: sf_plugins_core_1.Flags.boolean({
|
|
83
|
-
char: 'r',
|
|
84
|
-
summary: messages.getMessage('flags.serial'),
|
|
85
|
-
default: false,
|
|
86
|
-
}),
|
|
87
42
|
};
|
|
88
43
|
//# sourceMappingURL=bulk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../../../src/commands/data/upsert/bulk.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../../../src/commands/data/upsert/bulk.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2CAA4C;AAC5C,iEAAoD;AACpD,wEAAuE;AACvE,wEAAqE;AAErE,kDAAyD;AAEzD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AY,CAAC;QACvB,gBAAgB,EAAE,IAAI;KACvB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
* Licensed under the BSD 3-Clause license.
|
|
7
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
const core_1 = require("@salesforce/core");
|
|
10
|
+
const bulkDataRequestCache_1 = require("../../../bulkDataRequestCache");
|
|
11
|
+
const resumeBulkCommand_1 = require("../../../resumeBulkCommand");
|
|
12
|
+
const bulkUtils_1 = require("../../../bulkUtils");
|
|
13
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'bulk.upsert.resume');
|
|
15
|
+
class UpsertResume extends resumeBulkCommand_1.ResumeBulkCommand {
|
|
16
|
+
async run() {
|
|
17
|
+
const { flags } = await this.parse(UpsertResume);
|
|
18
|
+
const cache = await bulkDataRequestCache_1.BulkUpsertRequestCache.create();
|
|
19
|
+
const resumeOptions = await cache.resolveResumeOptionsFromCache(flags['job-id'], flags['use-most-recent'], flags['target-org'], flags['api-version']);
|
|
20
|
+
this.connection = resumeOptions.options.connection;
|
|
21
|
+
this.operation = 'upsert';
|
|
22
|
+
resumeOptions.options.operation = 'upsert';
|
|
23
|
+
const resumeResults = await this.resume(resumeOptions, flags.wait);
|
|
24
|
+
if ((0, bulkUtils_1.isBulkV2RequestDone)(resumeResults.jobInfo)) {
|
|
25
|
+
await bulkDataRequestCache_1.BulkUpsertRequestCache.unset(resumeOptions.jobInfo.id);
|
|
26
|
+
}
|
|
27
|
+
return resumeResults;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = UpsertResume;
|
|
31
|
+
UpsertResume.summary = messages.getMessage('summary');
|
|
32
|
+
UpsertResume.description = messages.getMessage('description');
|
|
33
|
+
UpsertResume.examples = messages.getMessages('examples');
|
|
34
|
+
//# sourceMappingURL=resume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/commands/data/upsert/resume.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2CAA4C;AAE5C,wEAAuE;AACvE,kEAA+D;AAC/D,kDAAyD;AAEzD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,oBAAoB,CAAC,CAAC;AAExF,MAAqB,YAAa,SAAQ,qCAAiB;IAKlD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,MAAM,6CAAsB,CAAC,MAAM,EAAE,CAAC;QACpD,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,6BAA6B,CAC7D,KAAK,CAAC,QAAQ,CAAC,EACf,KAAK,CAAC,iBAAiB,CAAC,EACxB,KAAK,CAAC,YAAY,CAAC,EACnB,KAAK,CAAC,aAAa,CAAC,CACrB,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC;QACnD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,aAAa,CAAC,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE3C,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACnE,IAAI,IAAA,+BAAmB,EAAC,aAAa,CAAC,OAAO,CAAC,EAAE;YAC9C,MAAM,6CAAsB,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SAC9D;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;;AAvBH,+BAwBC;AAvBwB,oBAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,wBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,qBAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
* Licensed under the BSD 3-Clause license.
|
|
7
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const flags_1 = require("../../../../flags");
|
|
14
|
+
const batcher_1 = require("../../../../batcher");
|
|
15
|
+
const bulkUtils_1 = require("../../../../bulkUtils");
|
|
16
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
|
+
const messages = core_1.Messages.load('@salesforce/plugin-data', 'bulk.delete', [
|
|
18
|
+
'examples',
|
|
19
|
+
'summary',
|
|
20
|
+
'description',
|
|
21
|
+
'flags.csvfile',
|
|
22
|
+
'flags.sobjecttype',
|
|
23
|
+
'flags.wait',
|
|
24
|
+
]);
|
|
25
|
+
class Delete extends sf_plugins_core_1.SfCommand {
|
|
26
|
+
async run() {
|
|
27
|
+
const { flags } = await this.parse(Delete);
|
|
28
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
29
|
+
this.spinner.start('Bulk Delete');
|
|
30
|
+
await (0, bulkUtils_1.validateSobjectType)(flags.sobject, conn);
|
|
31
|
+
const csvRecords = fs.createReadStream(flags.file, { encoding: 'utf-8' });
|
|
32
|
+
const job = conn.bulk.createJob(flags.sobject, 'delete');
|
|
33
|
+
const batcher = new batcher_1.Batcher(conn, new sf_plugins_core_1.Ux({ jsonEnabled: this.jsonEnabled() }), this.config.bin, this.config.pjson.oclif.topicSeparator ?? ':');
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises,no-async-promise-executor
|
|
35
|
+
return new Promise(async (resolve, reject) => {
|
|
36
|
+
job.on('error', (err) => {
|
|
37
|
+
throw err;
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
resolve(await batcher.createAndExecuteBatches(job, csvRecords, flags.sobject, flags.wait?.minutes));
|
|
41
|
+
this.spinner.stop();
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
this.spinner.stop('error');
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.default = Delete;
|
|
51
|
+
Delete.examples = messages.getMessages('examples');
|
|
52
|
+
Delete.summary = messages.getMessage('summary');
|
|
53
|
+
Delete.description = messages.getMessage('description');
|
|
54
|
+
Delete.flags = {
|
|
55
|
+
...flags_1.orgFlags,
|
|
56
|
+
file: sf_plugins_core_1.Flags.file({
|
|
57
|
+
char: 'f',
|
|
58
|
+
summary: messages.getMessage('flags.csvfile'),
|
|
59
|
+
required: true,
|
|
60
|
+
exists: true,
|
|
61
|
+
aliases: ['csvfile'],
|
|
62
|
+
deprecateAliases: true,
|
|
63
|
+
}),
|
|
64
|
+
sobject: sf_plugins_core_1.Flags.string({
|
|
65
|
+
char: 's',
|
|
66
|
+
summary: messages.getMessage('flags.sobjecttype'),
|
|
67
|
+
required: true,
|
|
68
|
+
aliases: ['sobjecttype'],
|
|
69
|
+
deprecateAliases: true,
|
|
70
|
+
}),
|
|
71
|
+
wait: sf_plugins_core_1.Flags.duration({
|
|
72
|
+
char: 'w',
|
|
73
|
+
unit: 'minutes',
|
|
74
|
+
summary: messages.getMessage('flags.wait'),
|
|
75
|
+
min: 0,
|
|
76
|
+
default: kit_1.Duration.minutes(0),
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/delete.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,yBAAyB;AAEzB,2CAAwD;AACxD,iEAAmE;AACnE,yCAA2C;AAC3C,6CAA6C;AAC7C,iDAAiE;AACjE,qDAA4D;AAE5D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,IAAI,CAAC,yBAAyB,EAAE,aAAa,EAAE;IACvE,UAAU;IACV,SAAS;IACT,aAAa;IACb,eAAe;IACf,mBAAmB;IACnB,YAAY;CACb,CAAC,CAAC;AAEH,MAAqB,MAAO,SAAQ,2BAA4B;IA+BvD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE3C,MAAM,IAAI,GAAe,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACjF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAElC,MAAM,IAAA,+BAAmB,EAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAE/C,MAAM,UAAU,GAAe,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QACtF,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS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CAAC,eAAe,CAAC;QAC7C,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,CAAC,SAAS,CAAC;QACpB,gBAAgB,EAAE,IAAI;KACvB,CAAC;IACF,OAAO,EAAE,uBAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC;QACjD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,aAAa,CAAC;QACxB,gBAAgB,EAAE,IAAI;KACvB,CAAC;IACF,IAAI,EAAE,uBAAK,CAAC,QAAQ,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;QAC1C,GAAG,EAAE,CAAC;QACN,OAAO,EAAE,cAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KAC7B,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@salesforce/core");
|
|
4
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
5
|
+
const flags_1 = require("../../../../flags");
|
|
6
|
+
const batcher_1 = require("../../../../batcher");
|
|
7
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
8
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'bulk.status');
|
|
9
|
+
class Status extends sf_plugins_core_1.SfCommand {
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags } = await this.parse(Status);
|
|
12
|
+
this.spinner.start('Getting Status');
|
|
13
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
14
|
+
const batcher = new batcher_1.Batcher(conn, new sf_plugins_core_1.Ux({ jsonEnabled: this.jsonEnabled() }), this.config.bin, this.config.pjson.oclif.topicSeparator ?? ':');
|
|
15
|
+
if (flags['job-id'] && flags['batch-id']) {
|
|
16
|
+
// view batch status
|
|
17
|
+
const job = conn.bulk.job(flags['job-id']);
|
|
18
|
+
let found = false;
|
|
19
|
+
const batches = await job.list();
|
|
20
|
+
batches.forEach((batch) => {
|
|
21
|
+
if (batch.id === flags['batch-id']) {
|
|
22
|
+
batcher.bulkStatus(batch);
|
|
23
|
+
found = true;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
if (!found) {
|
|
27
|
+
throw new core_1.SfError(messages.getMessage('NoBatchFound', [flags['batch-id'], flags['job-id']]), 'NoBatchFound');
|
|
28
|
+
}
|
|
29
|
+
this.spinner.stop();
|
|
30
|
+
return batches;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// view job status
|
|
34
|
+
const jobStatus = await batcher.fetchAndDisplayJobStatus(flags['job-id']);
|
|
35
|
+
this.spinner.stop();
|
|
36
|
+
return jobStatus;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = Status;
|
|
41
|
+
Status.summary = messages.getMessage('summary');
|
|
42
|
+
Status.description = messages.getMessage('description');
|
|
43
|
+
Status.examples = messages.getMessages('examples');
|
|
44
|
+
Status.flags = {
|
|
45
|
+
...flags_1.orgFlags,
|
|
46
|
+
'batch-id': sf_plugins_core_1.Flags.salesforceId({
|
|
47
|
+
length: 18,
|
|
48
|
+
char: 'b',
|
|
49
|
+
startsWith: '751',
|
|
50
|
+
summary: messages.getMessage('flags.batchid'),
|
|
51
|
+
aliases: ['batchid'],
|
|
52
|
+
deprecateAliases: true,
|
|
53
|
+
}),
|
|
54
|
+
'job-id': sf_plugins_core_1.Flags.salesforceId({
|
|
55
|
+
length: 18,
|
|
56
|
+
char: 'i',
|
|
57
|
+
startsWith: '750',
|
|
58
|
+
summary: messages.getMessage('flags.jobid'),
|
|
59
|
+
required: true,
|
|
60
|
+
aliases: ['jobid'],
|
|
61
|
+
deprecateAliases: true,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/status.ts"],"names":[],"mappings":";;AAOA,2CAAqD;AACrD,iEAAmE;AACnE,6CAA6C;AAC7C,iDAA8C;AAG9C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAEjF,MAAqB,MAAO,SAAQ,2BAAuB;IA0BlD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,MAAM,OAAO,GAAG,IAAI,iBAAO,CACzB,IAAI,EACJ,IAAI,oBAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,EAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,EACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,IAAI,GAAG,CAC9C,CAAC;QACF,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE;YACxC,oBAAoB;YACpB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC3C,IAAI,KAAK,GAAG,KAAK,CAAC;YAElB,MAAM,OAAO,GAAgB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9C,OAAO,CAAC,OAAO,CA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AM,EAAE,EAAE;QACV,IAAI,EAAE,GAAG;QACT,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC;QAC3C,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,gBAAgB,EAAE,IAAI;KACvB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
* Licensed under the BSD 3-Clause license.
|
|
7
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const flags_1 = require("../../../../flags");
|
|
14
|
+
const batcher_1 = require("../../../../batcher");
|
|
15
|
+
const bulkUtils_1 = require("../../../../bulkUtils");
|
|
16
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'bulk.upsert');
|
|
18
|
+
class Upsert extends sf_plugins_core_1.SfCommand {
|
|
19
|
+
async run() {
|
|
20
|
+
const { flags } = await this.parse(Upsert);
|
|
21
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
22
|
+
this.spinner.start('Bulk Upsert');
|
|
23
|
+
await (0, bulkUtils_1.validateSobjectType)(flags.sobject, conn);
|
|
24
|
+
const batcher = new batcher_1.Batcher(conn, new sf_plugins_core_1.Ux({ jsonEnabled: this.jsonEnabled() }), this.config.bin, this.config.pjson.oclif.topicSeparator ?? ':');
|
|
25
|
+
const csvStream = fs.createReadStream(flags.file, { encoding: 'utf-8' });
|
|
26
|
+
const concurrencyMode = flags.serial ? 'Serial' : 'Parallel';
|
|
27
|
+
const job = conn.bulk.createJob(flags.sobject, 'upsert', {
|
|
28
|
+
extIdField: flags['external-id'],
|
|
29
|
+
concurrencyMode,
|
|
30
|
+
});
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises,no-async-promise-executor
|
|
32
|
+
return new Promise(async (resolve, reject) => {
|
|
33
|
+
job.on('error', (err) => {
|
|
34
|
+
reject(err);
|
|
35
|
+
});
|
|
36
|
+
try {
|
|
37
|
+
resolve(await batcher.createAndExecuteBatches(job, csvStream, flags.sobject, flags.wait?.minutes));
|
|
38
|
+
this.spinner.stop();
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
this.spinner.stop('error');
|
|
42
|
+
reject(e);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = Upsert;
|
|
48
|
+
Upsert.summary = messages.getMessage('summary');
|
|
49
|
+
Upsert.description = messages.getMessage('description');
|
|
50
|
+
Upsert.examples = messages.getMessages('examples');
|
|
51
|
+
Upsert.flags = {
|
|
52
|
+
...flags_1.orgFlags,
|
|
53
|
+
'external-id': sf_plugins_core_1.Flags.string({
|
|
54
|
+
char: 'i',
|
|
55
|
+
summary: messages.getMessage('flags.externalid'),
|
|
56
|
+
required: true,
|
|
57
|
+
aliases: ['externalid'],
|
|
58
|
+
deprecateAliases: true,
|
|
59
|
+
}),
|
|
60
|
+
file: sf_plugins_core_1.Flags.file({
|
|
61
|
+
exists: true,
|
|
62
|
+
char: 'f',
|
|
63
|
+
summary: messages.getMessage('flags.csvfile'),
|
|
64
|
+
required: true,
|
|
65
|
+
aliases: ['csvfile'],
|
|
66
|
+
deprecateAliases: true,
|
|
67
|
+
}),
|
|
68
|
+
sobject: sf_plugins_core_1.Flags.string({
|
|
69
|
+
char: 's',
|
|
70
|
+
summary: messages.getMessage('flags.sobjecttype'),
|
|
71
|
+
required: true,
|
|
72
|
+
aliases: ['sobjecttype'],
|
|
73
|
+
deprecateAliases: true,
|
|
74
|
+
}),
|
|
75
|
+
wait: sf_plugins_core_1.Flags.duration({
|
|
76
|
+
char: 'w',
|
|
77
|
+
unit: 'minutes',
|
|
78
|
+
summary: messages.getMessage('flags.wait'),
|
|
79
|
+
min: 0,
|
|
80
|
+
default: kit_1.Duration.minutes(0),
|
|
81
|
+
}),
|
|
82
|
+
serial: sf_plugins_core_1.Flags.boolean({
|
|
83
|
+
char: 'r',
|
|
84
|
+
summary: messages.getMessage('flags.serial'),
|
|
85
|
+
default: false,
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=upsert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsert.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/upsert.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,2CAA4C;AAC5C,iEAAmE;AACnE,yCAA2C;AAC3C,6CAA6C;AAC7C,iDAAiE;AACjE,qDAA4D;AAE5D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAEjF,MAAqB,MAAO,SAAQ,2BAA4B;IA2CvD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAElC,MAAM,IAAA,+BAAmB,EAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAE/C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T,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC;QAC5C,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC"}
|
package/lib/flags.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.orgFlags = exports.perflogFlag = void 0;
|
|
3
|
+
exports.resultFormatFlag = exports.orgFlags = exports.perflogFlag = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
6
|
* All rights reserved.
|
|
@@ -10,7 +10,12 @@ exports.orgFlags = exports.perflogFlag = void 0;
|
|
|
10
10
|
const core_1 = require("@salesforce/core");
|
|
11
11
|
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
12
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
13
|
-
const messages = core_1.Messages.load('@salesforce/plugin-data', 'messages', [
|
|
13
|
+
const messages = core_1.Messages.load('@salesforce/plugin-data', 'messages', [
|
|
14
|
+
'perfLogLevelOption',
|
|
15
|
+
'perfLogLevelOptionLong',
|
|
16
|
+
'flags.resultFormat',
|
|
17
|
+
'flags.targetOrg.summary',
|
|
18
|
+
]);
|
|
14
19
|
exports.perflogFlag = sf_plugins_core_1.Flags.boolean({
|
|
15
20
|
summary: messages.getMessage('perfLogLevelOption'),
|
|
16
21
|
description: messages.getMessage('perfLogLevelOptionLong'),
|
|
@@ -20,8 +25,16 @@ exports.perflogFlag = sf_plugins_core_1.Flags.boolean({
|
|
|
20
25
|
},
|
|
21
26
|
});
|
|
22
27
|
exports.orgFlags = {
|
|
23
|
-
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
28
|
+
'target-org': { ...sf_plugins_core_1.requiredOrgFlagWithDeprecations, summary: messages.getMessage('flags.targetOrg.summary') },
|
|
24
29
|
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
25
30
|
loglevel: sf_plugins_core_1.loglevel,
|
|
26
31
|
};
|
|
32
|
+
exports.resultFormatFlag = sf_plugins_core_1.Flags.string({
|
|
33
|
+
char: 'r',
|
|
34
|
+
summary: messages.getMessage('flags.resultFormat'),
|
|
35
|
+
options: ['human', 'json', 'csv'],
|
|
36
|
+
default: 'human',
|
|
37
|
+
aliases: ['resultformat'],
|
|
38
|
+
deprecateAliases: true,
|
|
39
|
+
});
|
|
27
40
|
//# sourceMappingURL=flags.js.map
|
package/lib/flags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAA4C;AAC5C,iEAKqC;AAErC,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,IAAI,CAAC,yBAAyB,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAA4C;AAC5C,iEAKqC;AAErC,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,IAAI,CAAC,yBAAyB,EAAE,UAAU,EAAE;IACpE,oBAAoB;IACpB,wBAAwB;IACxB,oBAAoB;IACpB,yBAAyB;CAC1B,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,uBAAK,CAAC,OAAO,CAAC;IACvC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;IAClD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;IAC1D,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;KACd;CACF,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAG;IACtB,YAAY,EAAE,EAAE,GAAG,iDAA+B,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAAE;IAC7G,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;CACT,CAAC;AAEW,QAAA,gBAAgB,GAAG,uBAAK,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;IAClD,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC;IACjC,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,gBAAgB,EAAE,IAAI;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformBulkResults = exports.displayResults = void 0;
|
|
4
|
+
const dataSoqlQueryTypes_1 = require("./dataSoqlQueryTypes");
|
|
5
|
+
const reporters_1 = require("./reporters");
|
|
6
|
+
const displayResults = (queryResult, resultFormat) => {
|
|
7
|
+
let reporter;
|
|
8
|
+
switch (resultFormat) {
|
|
9
|
+
case 'human':
|
|
10
|
+
reporter = new reporters_1.HumanReporter(queryResult, queryResult.columns);
|
|
11
|
+
break;
|
|
12
|
+
case 'json':
|
|
13
|
+
reporter = new reporters_1.JsonReporter(queryResult, queryResult.columns);
|
|
14
|
+
break;
|
|
15
|
+
case 'csv':
|
|
16
|
+
reporter = new reporters_1.CsvReporter(queryResult, queryResult.columns);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
// delegate to selected reporter
|
|
20
|
+
reporter.display();
|
|
21
|
+
};
|
|
22
|
+
exports.displayResults = displayResults;
|
|
23
|
+
/**
|
|
24
|
+
* transforms Bulk 2.0 results to match the SOQL query results
|
|
25
|
+
*
|
|
26
|
+
* @param results results object
|
|
27
|
+
* @param query query string
|
|
28
|
+
*/
|
|
29
|
+
const transformBulkResults = (results, query) => {
|
|
30
|
+
/*
|
|
31
|
+
bulk queries return a different payload, it's a [{column: data}, {column: data}]
|
|
32
|
+
so we just need to grab the first object, find the keys (columns) and create the columns
|
|
33
|
+
*/
|
|
34
|
+
const columns = Object.keys(results[0] ?? {}).map((name) => ({
|
|
35
|
+
fieldType: dataSoqlQueryTypes_1.FieldType.field,
|
|
36
|
+
name,
|
|
37
|
+
}));
|
|
38
|
+
return {
|
|
39
|
+
columns,
|
|
40
|
+
result: { done: true, records: results, totalSize: results.length },
|
|
41
|
+
query,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.transformBulkResults = transformBulkResults;
|
|
45
|
+
//# sourceMappingURL=queryUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryUtils.js","sourceRoot":"","sources":["../src/queryUtils.ts"],"names":[],"mappings":";;;AAOA,6DAAyE;AACzE,2CAAoF;AAE7E,MAAM,cAAc,GAAG,CAAC,WAA4B,EAAE,YAAyB,EAAQ,EAAE;IAC9F,IAAI,QAAoD,CAAC;IACzD,QAAQ,YAAY,EAAE;QACpB,KAAK,OAAO;YACV,QAAQ,GAAG,IAAI,yBAAa,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAC/D,MAAM;QACR,KAAK,MAAM;YACT,QAAQ,GAAG,IAAI,wBAAY,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAC9D,MAAM;QACR,KAAK,KAAK;YACR,QAAQ,GAAG,IAAI,uBAAW,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAC7D,MAAM;KACT;IACD,gCAAgC;IAChC,QAAQ,CAAC,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC;AAfW,QAAA,cAAc,kBAezB;AAEF;;;;;GAKG;AACI,MAAM,oBAAoB,GAAG,CAAC,OAAiB,EAAE,KAAa,EAAmB,EAAE;IACxF;;;SAGK;IACL,MAAM,OAAO,GAAY,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpE,SAAS,EAAE,8BAAS,CAAC,KAAK;QAC1B,IAAI;KACL,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,OAAO;QACP,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE;QACnE,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,oBAAoB,wBAe/B"}
|
package/lib/reporters.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getResultMessage = exports.getFailedBatchesForDisplay = exports.getBulk2JobTotals = exports.getBatchTotals = exports.BatchInfoColumns = exports.escape = exports.JsonReporter = exports.CsvReporter = exports.HumanReporter = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
6
|
* All rights reserved.
|
|
@@ -12,9 +12,11 @@ const core_1 = require("@salesforce/core");
|
|
|
12
12
|
const core_2 = require("@oclif/core");
|
|
13
13
|
const chalk = require("chalk");
|
|
14
14
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
15
|
+
const change_case_1 = require("change-case");
|
|
15
16
|
const dataSoqlQueryTypes_1 = require("./dataSoqlQueryTypes");
|
|
16
17
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
18
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'soql.query');
|
|
19
|
+
const reporterMessages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'reporter');
|
|
18
20
|
class Reporter {
|
|
19
21
|
constructor() {
|
|
20
22
|
this.logger = core_1.Logger.childFromRoot('reporter');
|
|
@@ -149,12 +151,12 @@ class HumanReporter extends QueryReporter {
|
|
|
149
151
|
Object.entries(record).forEach(([key, value]) => {
|
|
150
152
|
if (!index) {
|
|
151
153
|
Reflect.defineProperty(result, `${child.toString()}.${key}`, {
|
|
152
|
-
value: value
|
|
154
|
+
value: value ?? chalk.bold('null'),
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
157
|
else {
|
|
156
158
|
Reflect.defineProperty(newResult, `${child.toString()}.${key}`, {
|
|
157
|
-
value: value
|
|
159
|
+
value: value ?? chalk.bold('null'),
|
|
158
160
|
});
|
|
159
161
|
}
|
|
160
162
|
});
|
|
@@ -295,14 +297,6 @@ class JsonReporter extends QueryReporter {
|
|
|
295
297
|
}
|
|
296
298
|
}
|
|
297
299
|
exports.JsonReporter = JsonReporter;
|
|
298
|
-
/**
|
|
299
|
-
* A list of the accepted reporter types
|
|
300
|
-
*/
|
|
301
|
-
exports.FormatTypes = {
|
|
302
|
-
human: HumanReporter,
|
|
303
|
-
csv: CsvReporter,
|
|
304
|
-
json: JsonReporter,
|
|
305
|
-
};
|
|
306
300
|
const prepColumns = (columns) => {
|
|
307
301
|
const formattedColumns = {};
|
|
308
302
|
columns
|
|
@@ -313,11 +307,11 @@ const prepColumns = (columns) => {
|
|
|
313
307
|
get: (row) => {
|
|
314
308
|
// first test if key exists, if so, return value
|
|
315
309
|
if (Reflect.has(row, field)) {
|
|
316
|
-
return Reflect.get(row, field)
|
|
310
|
+
return Reflect.get(row, field) ?? '';
|
|
317
311
|
}
|
|
318
312
|
else {
|
|
319
313
|
// if not, try to find it query
|
|
320
|
-
return (0, ts_types_1.get)(row, field)
|
|
314
|
+
return (0, ts_types_1.get)(row, field) ?? '';
|
|
321
315
|
}
|
|
322
316
|
},
|
|
323
317
|
}));
|
|
@@ -337,4 +331,49 @@ const escape = (value) => {
|
|
|
337
331
|
return value;
|
|
338
332
|
};
|
|
339
333
|
exports.escape = escape;
|
|
334
|
+
exports.BatchInfoColumns = {
|
|
335
|
+
id: { header: 'Batch Id' },
|
|
336
|
+
state: { header: 'State' },
|
|
337
|
+
failed: { header: 'Failed' },
|
|
338
|
+
stateMessage: { header: 'Message' },
|
|
339
|
+
};
|
|
340
|
+
const getBatchTotals = (batches) => batches.reduce((acc, batch) => {
|
|
341
|
+
acc.total += parseInt(batch.numberRecordsProcessed, 10);
|
|
342
|
+
acc.failed += parseInt(batch.numberRecordsFailed, 10);
|
|
343
|
+
acc.success = acc.total - acc.failed;
|
|
344
|
+
return acc;
|
|
345
|
+
}, { total: 0, failed: 0, success: 0 });
|
|
346
|
+
exports.getBatchTotals = getBatchTotals;
|
|
347
|
+
function getBulk2JobTotals(results) {
|
|
348
|
+
const ttls = { total: 0, failed: 0, success: 0, unprocessed: 0 };
|
|
349
|
+
ttls.total =
|
|
350
|
+
Object.keys(results.successfulResults).length +
|
|
351
|
+
Object.keys(results.failedResults).length +
|
|
352
|
+
Object.keys(results.unprocessedRecords).length;
|
|
353
|
+
ttls.failed = Object.keys(results.failedResults).length;
|
|
354
|
+
ttls.success = Object.keys(results.successfulResults).length;
|
|
355
|
+
ttls.unprocessed = Object.keys(results.unprocessedRecords).length;
|
|
356
|
+
return ttls;
|
|
357
|
+
}
|
|
358
|
+
exports.getBulk2JobTotals = getBulk2JobTotals;
|
|
359
|
+
const getFailedBatchesForDisplay = (batches) => {
|
|
360
|
+
const failedBatches = batches.filter((batch) => parseInt(batch.numberRecordsFailed, 10) > 0);
|
|
361
|
+
const batchesForTable = failedBatches.map((batch) => ({
|
|
362
|
+
id: batch.id,
|
|
363
|
+
state: batch.state,
|
|
364
|
+
failed: `${batch.numberRecordsFailed.toString().padStart(5, ' ')}/${batch.numberRecordsProcessed
|
|
365
|
+
.toString()
|
|
366
|
+
.padStart(5, ' ')}`,
|
|
367
|
+
stateMessage: batch.stateMessage,
|
|
368
|
+
}));
|
|
369
|
+
return batchesForTable;
|
|
370
|
+
};
|
|
371
|
+
exports.getFailedBatchesForDisplay = getFailedBatchesForDisplay;
|
|
372
|
+
const getResultMessage = (jobInfo) => reporterMessages.getMessage('bulkV2Result', [
|
|
373
|
+
jobInfo.id,
|
|
374
|
+
(0, change_case_1.capitalCase)(jobInfo.state),
|
|
375
|
+
jobInfo.numberRecordsProcessed,
|
|
376
|
+
jobInfo.numberRecordsFailed,
|
|
377
|
+
]);
|
|
378
|
+
exports.getResultMessage = getResultMessage;
|
|
340
379
|
//# sourceMappingURL=reporters.js.map
|