@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,43 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Messages } from '@salesforce/core';
|
|
10
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { BulkUpsertRequestCache } from '../../../bulkDataRequestCache.js';
|
|
12
|
+
import { BulkOperationCommand } from '../../../bulkOperationCommand.js';
|
|
13
|
+
import { validateSobjectType } from '../../../bulkUtils.js';
|
|
14
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
15
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'bulkv2.upsert');
|
|
16
|
+
export default class Upsert extends BulkOperationCommand {
|
|
17
|
+
static summary = messages.getMessage('summary');
|
|
18
|
+
static description = messages.getMessage('description');
|
|
19
|
+
static examples = messages.getMessages('examples');
|
|
20
|
+
static flags = {
|
|
21
|
+
'external-id': Flags.string({
|
|
22
|
+
char: 'i',
|
|
23
|
+
summary: messages.getMessage('flags.external-id.summary'),
|
|
24
|
+
required: true,
|
|
25
|
+
aliases: ['externalid'],
|
|
26
|
+
deprecateAliases: true,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
17
29
|
async run() {
|
|
18
30
|
const { flags } = await this.parse(Upsert);
|
|
19
31
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
20
|
-
await
|
|
32
|
+
await validateSobjectType(flags.sobject, conn);
|
|
21
33
|
return this.runBulkOperation(flags.sobject, flags.file, conn, flags.async ? 0 : flags.wait?.minutes, flags.verbose, 'upsert', {
|
|
22
34
|
extIdField: flags['external-id'],
|
|
23
35
|
});
|
|
24
36
|
}
|
|
25
37
|
// eslint-disable-next-line class-methods-use-this
|
|
26
38
|
async getCache() {
|
|
27
|
-
return
|
|
39
|
+
return BulkUpsertRequestCache.create();
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
|
-
Upsert.summary = messages.getMessage('summary');
|
|
31
|
-
Upsert.description = messages.getMessage('description');
|
|
32
|
-
Upsert.examples = messages.getMessages('examples');
|
|
33
|
-
Upsert.flags = {
|
|
34
|
-
'external-id': sf_plugins_core_1.Flags.string({
|
|
35
|
-
char: 'i',
|
|
36
|
-
summary: messages.getMessage('flags.external-id.summary'),
|
|
37
|
-
required: true,
|
|
38
|
-
aliases: ['externalid'],
|
|
39
|
-
deprecateAliases: true,
|
|
40
|
-
}),
|
|
41
|
-
};
|
|
42
|
-
exports.default = Upsert;
|
|
43
42
|
//# sourceMappingURL=bulk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../../../src/commands/data/upsert/bulk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../../../src/commands/data/upsert/bulk.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,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,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;AAEnF,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,oBAAoB;IAC/C,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;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC;YAC1B,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC;YACzD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,CAAC,YAAY,CAAC;YACvB,gBAAgB,EAAE,IAAI;SACvB,CAAC;KACH,CAAC;IAEK,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;QAErE,MAAM,mBAAmB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAE/C,OAAO,IAAI,CAAC,gBAAgB,CAC1B,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,IAAI,EACV,IAAI,EACJ,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EACrC,KAAK,CAAC,OAAO,EACb,QAAQ,EACR;YACE,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC;SACjC,CACF,CAAC;IACJ,CAAC;IAED,kDAAkD;IACxC,KAAK,CAAC,QAAQ;QACtB,OAAO,sBAAsB,CAAC,MAAM,EAAE,CAAC;IACzC,CAAC"}
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Messages } from '@salesforce/core';
|
|
10
|
+
import { BulkUpsertRequestCache } from '../../../bulkDataRequestCache.js';
|
|
11
|
+
import { ResumeBulkCommand } from '../../../resumeBulkCommand.js';
|
|
12
|
+
import { isBulkV2RequestDone } from '../../../bulkUtils.js';
|
|
13
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'bulk.upsert.resume');
|
|
15
|
+
export default class UpsertResume extends ResumeBulkCommand {
|
|
16
|
+
static summary = messages.getMessage('summary');
|
|
17
|
+
static description = messages.getMessage('description');
|
|
18
|
+
static examples = messages.getMessages('examples');
|
|
16
19
|
async run() {
|
|
17
20
|
const { flags } = await this.parse(UpsertResume);
|
|
18
|
-
const cache = await
|
|
21
|
+
const cache = await BulkUpsertRequestCache.create();
|
|
19
22
|
const resumeOptions = await cache.resolveResumeOptionsFromCache(flags['job-id'], flags['use-most-recent'], flags['target-org'], flags['api-version']);
|
|
20
23
|
this.connection = resumeOptions.options.connection;
|
|
21
24
|
this.operation = 'upsert';
|
|
22
25
|
resumeOptions.options.operation = 'upsert';
|
|
23
26
|
const resumeResults = await this.resume(resumeOptions, flags.wait);
|
|
24
|
-
if (
|
|
25
|
-
await
|
|
27
|
+
if (isBulkV2RequestDone(resumeResults.jobInfo)) {
|
|
28
|
+
await BulkUpsertRequestCache.unset(resumeOptions.jobInfo.id);
|
|
26
29
|
}
|
|
27
30
|
return resumeResults;
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
|
-
UpsertResume.summary = messages.getMessage('summary');
|
|
31
|
-
UpsertResume.description = messages.getMessage('description');
|
|
32
|
-
UpsertResume.examples = messages.getMessages('examples');
|
|
33
|
-
exports.default = UpsertResume;
|
|
34
33
|
//# sourceMappingURL=resume.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/commands/data/upsert/resume.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/commands/data/upsert/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,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,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,oBAAoB,CAAC,CAAC;AAExF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAAiB;IAClD,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;IAE5D,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,MAAM,sBAAsB,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,mBAAmB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;YAC9C,MAAM,sBAAsB,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SAC9D;QACD,OAAO,aAAa,CAAC;IACvB,CAAC"}
|
|
@@ -1,29 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { Messages } from '@salesforce/core';
|
|
11
|
+
import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core';
|
|
12
|
+
import { Duration } from '@salesforce/kit';
|
|
13
|
+
import { orgFlags } from '../../../../flags.js';
|
|
14
|
+
import { Batcher } from '../../../../batcher.js';
|
|
15
|
+
import { validateSobjectType } from '../../../../bulkUtils.js';
|
|
16
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
17
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'bulk.delete');
|
|
18
|
+
export default class Delete extends SfCommand {
|
|
19
|
+
static examples = messages.getMessages('examples');
|
|
20
|
+
static summary = messages.getMessage('summary');
|
|
21
|
+
static description = messages.getMessage('description');
|
|
22
|
+
static flags = {
|
|
23
|
+
...orgFlags,
|
|
24
|
+
file: Flags.file({
|
|
25
|
+
char: 'f',
|
|
26
|
+
summary: messages.getMessage('flags.file.summary'),
|
|
27
|
+
required: true,
|
|
28
|
+
exists: true,
|
|
29
|
+
aliases: ['csvfile'],
|
|
30
|
+
deprecateAliases: true,
|
|
31
|
+
}),
|
|
32
|
+
sobject: Flags.string({
|
|
33
|
+
char: 's',
|
|
34
|
+
summary: messages.getMessage('flags.sobject.summary'),
|
|
35
|
+
required: true,
|
|
36
|
+
aliases: ['sobjecttype'],
|
|
37
|
+
deprecateAliases: true,
|
|
38
|
+
}),
|
|
39
|
+
wait: Flags.duration({
|
|
40
|
+
char: 'w',
|
|
41
|
+
unit: 'minutes',
|
|
42
|
+
summary: messages.getMessage('flags.wait.summary'),
|
|
43
|
+
min: 0,
|
|
44
|
+
default: Duration.minutes(0),
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
19
47
|
async run() {
|
|
20
48
|
const { flags } = await this.parse(Delete);
|
|
21
49
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
22
50
|
this.spinner.start('Bulk Delete');
|
|
23
|
-
await
|
|
51
|
+
await validateSobjectType(flags.sobject, conn);
|
|
24
52
|
const csvRecords = fs.createReadStream(flags.file, { encoding: 'utf-8' });
|
|
25
53
|
const job = conn.bulk.createJob(flags.sobject, 'delete');
|
|
26
|
-
const batcher = new
|
|
54
|
+
const batcher = new Batcher(conn, new Ux({ jsonEnabled: this.jsonEnabled() }), this.config.bin, this.config.pjson.oclif.topicSeparator ?? ':');
|
|
27
55
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises,no-async-promise-executor
|
|
28
56
|
return new Promise(async (resolve, reject) => {
|
|
29
57
|
job.on('error', (err) => {
|
|
@@ -40,33 +68,4 @@ class Delete extends sf_plugins_core_1.SfCommand {
|
|
|
40
68
|
});
|
|
41
69
|
}
|
|
42
70
|
}
|
|
43
|
-
Delete.examples = messages.getMessages('examples');
|
|
44
|
-
Delete.summary = messages.getMessage('summary');
|
|
45
|
-
Delete.description = messages.getMessage('description');
|
|
46
|
-
Delete.flags = {
|
|
47
|
-
...flags_1.orgFlags,
|
|
48
|
-
file: sf_plugins_core_1.Flags.file({
|
|
49
|
-
char: 'f',
|
|
50
|
-
summary: messages.getMessage('flags.file.summary'),
|
|
51
|
-
required: true,
|
|
52
|
-
exists: true,
|
|
53
|
-
aliases: ['csvfile'],
|
|
54
|
-
deprecateAliases: true,
|
|
55
|
-
}),
|
|
56
|
-
sobject: sf_plugins_core_1.Flags.string({
|
|
57
|
-
char: 's',
|
|
58
|
-
summary: messages.getMessage('flags.sobject.summary'),
|
|
59
|
-
required: true,
|
|
60
|
-
aliases: ['sobjecttype'],
|
|
61
|
-
deprecateAliases: true,
|
|
62
|
-
}),
|
|
63
|
-
wait: sf_plugins_core_1.Flags.duration({
|
|
64
|
-
char: 'w',
|
|
65
|
-
unit: 'minutes',
|
|
66
|
-
summary: messages.getMessage('flags.wait.summary'),
|
|
67
|
-
min: 0,
|
|
68
|
-
default: kit_1.Duration.minutes(0),
|
|
69
|
-
}),
|
|
70
|
-
};
|
|
71
|
-
exports.default = Delete;
|
|
72
71
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/delete.ts"],"names":[],"mappings":"AAAA;;;;;GAKG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CAAC,KAAK,CAAC,cAAc,IAAI,GAAG,CAC9C,CAAC;QAEF,4FAA4F;QAC5F,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAQ,EAAE;gBAC5B,MAAM,GAAG,CAAC;YACZ,CAAC,CAAC,CAAC;YAEH,IAAI;gBACF,OAAO,CAAC,MAAM,OAAO,CAAC,uBAAuB,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;gBACpG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;aACrB;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC3B,MAAM,CAAC,CAAC,CAAC,CAAC;aACX;QACH,CAAC,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -1,17 +1,46 @@
|
|
|
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 { Flags, SfCommand, 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', 'bulk.status');
|
|
15
|
+
export default class Status extends SfCommand {
|
|
16
|
+
static summary = messages.getMessage('summary');
|
|
17
|
+
static description = messages.getMessage('description');
|
|
18
|
+
static examples = messages.getMessages('examples');
|
|
19
|
+
static flags = {
|
|
20
|
+
...orgFlags,
|
|
21
|
+
'batch-id': Flags.salesforceId({
|
|
22
|
+
length: 18,
|
|
23
|
+
char: 'b',
|
|
24
|
+
startsWith: '751',
|
|
25
|
+
summary: messages.getMessage('flags.batch-id.summary'),
|
|
26
|
+
aliases: ['batchid'],
|
|
27
|
+
deprecateAliases: true,
|
|
28
|
+
}),
|
|
29
|
+
'job-id': Flags.salesforceId({
|
|
30
|
+
length: 18,
|
|
31
|
+
char: 'i',
|
|
32
|
+
startsWith: '750',
|
|
33
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
34
|
+
required: true,
|
|
35
|
+
aliases: ['jobid'],
|
|
36
|
+
deprecateAliases: true,
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
10
39
|
async run() {
|
|
11
40
|
const { flags } = await this.parse(Status);
|
|
12
41
|
this.spinner.start('Getting Status');
|
|
13
42
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
14
|
-
const batcher = new
|
|
43
|
+
const batcher = new Batcher(conn, new Ux({ jsonEnabled: this.jsonEnabled() }), this.config.bin, this.config.pjson.oclif.topicSeparator ?? ':');
|
|
15
44
|
if (flags['job-id'] && flags['batch-id']) {
|
|
16
45
|
// view batch status
|
|
17
46
|
const job = conn.bulk.job(flags['job-id']);
|
|
@@ -24,7 +53,7 @@ class Status extends sf_plugins_core_1.SfCommand {
|
|
|
24
53
|
}
|
|
25
54
|
});
|
|
26
55
|
if (!found) {
|
|
27
|
-
throw new
|
|
56
|
+
throw new SfError(messages.getMessage('NoBatchFound', [flags['batch-id'], flags['job-id']]), 'NoBatchFound');
|
|
28
57
|
}
|
|
29
58
|
this.spinner.stop();
|
|
30
59
|
return batches;
|
|
@@ -37,28 +66,4 @@ class Status extends sf_plugins_core_1.SfCommand {
|
|
|
37
66
|
}
|
|
38
67
|
}
|
|
39
68
|
}
|
|
40
|
-
Status.summary = messages.getMessage('summary');
|
|
41
|
-
Status.description = messages.getMessage('description');
|
|
42
|
-
Status.examples = messages.getMessages('examples');
|
|
43
|
-
Status.flags = {
|
|
44
|
-
...flags_1.orgFlags,
|
|
45
|
-
'batch-id': sf_plugins_core_1.Flags.salesforceId({
|
|
46
|
-
length: 18,
|
|
47
|
-
char: 'b',
|
|
48
|
-
startsWith: '751',
|
|
49
|
-
summary: messages.getMessage('flags.batch-id.summary'),
|
|
50
|
-
aliases: ['batchid'],
|
|
51
|
-
deprecateAliases: true,
|
|
52
|
-
}),
|
|
53
|
-
'job-id': sf_plugins_core_1.Flags.salesforceId({
|
|
54
|
-
length: 18,
|
|
55
|
-
char: 'i',
|
|
56
|
-
startsWith: '750',
|
|
57
|
-
summary: messages.getMessage('flags.job-id.summary'),
|
|
58
|
-
required: true,
|
|
59
|
-
aliases: ['jobid'],
|
|
60
|
-
deprecateAliases: true,
|
|
61
|
-
}),
|
|
62
|
-
};
|
|
63
|
-
exports.default = Status;
|
|
64
69
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;A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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,27 +1,67 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { Messages } from '@salesforce/core';
|
|
11
|
+
import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core';
|
|
12
|
+
import { Duration } from '@salesforce/kit';
|
|
13
|
+
import { orgFlags } from '../../../../flags.js';
|
|
14
|
+
import { Batcher } from '../../../../batcher.js';
|
|
15
|
+
import { validateSobjectType } from '../../../../bulkUtils.js';
|
|
16
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
17
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'bulk.upsert');
|
|
18
|
+
export default class Upsert extends SfCommand {
|
|
19
|
+
static summary = messages.getMessage('summary');
|
|
20
|
+
static description = messages.getMessage('description');
|
|
21
|
+
static examples = messages.getMessages('examples');
|
|
22
|
+
static flags = {
|
|
23
|
+
...orgFlags,
|
|
24
|
+
'external-id': Flags.string({
|
|
25
|
+
char: 'i',
|
|
26
|
+
summary: messages.getMessage('flags.external-id.summary'),
|
|
27
|
+
required: true,
|
|
28
|
+
aliases: ['externalid'],
|
|
29
|
+
deprecateAliases: true,
|
|
30
|
+
}),
|
|
31
|
+
file: Flags.file({
|
|
32
|
+
exists: true,
|
|
33
|
+
char: 'f',
|
|
34
|
+
summary: messages.getMessage('flags.file.summary'),
|
|
35
|
+
required: true,
|
|
36
|
+
aliases: ['csvfile'],
|
|
37
|
+
deprecateAliases: true,
|
|
38
|
+
}),
|
|
39
|
+
sobject: Flags.string({
|
|
40
|
+
char: 's',
|
|
41
|
+
summary: messages.getMessage('flags.sobject.summary'),
|
|
42
|
+
required: true,
|
|
43
|
+
aliases: ['sobjecttype'],
|
|
44
|
+
deprecateAliases: true,
|
|
45
|
+
}),
|
|
46
|
+
wait: Flags.duration({
|
|
47
|
+
char: 'w',
|
|
48
|
+
unit: 'minutes',
|
|
49
|
+
summary: messages.getMessage('flags.wait.summary'),
|
|
50
|
+
min: 0,
|
|
51
|
+
default: Duration.minutes(0),
|
|
52
|
+
}),
|
|
53
|
+
serial: Flags.boolean({
|
|
54
|
+
char: 'r',
|
|
55
|
+
summary: messages.getMessage('flags.serial.summary'),
|
|
56
|
+
default: false,
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
19
59
|
async run() {
|
|
20
60
|
const { flags } = await this.parse(Upsert);
|
|
21
61
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
22
62
|
this.spinner.start('Bulk Upsert');
|
|
23
|
-
await
|
|
24
|
-
const batcher = new
|
|
63
|
+
await validateSobjectType(flags.sobject, conn);
|
|
64
|
+
const batcher = new Batcher(conn, new Ux({ jsonEnabled: this.jsonEnabled() }), this.config.bin, this.config.pjson.oclif.topicSeparator ?? ':');
|
|
25
65
|
const csvStream = fs.createReadStream(flags.file, { encoding: 'utf-8' });
|
|
26
66
|
const concurrencyMode = flags.serial ? 'Serial' : 'Parallel';
|
|
27
67
|
const job = conn.bulk.createJob(flags.sobject, 'upsert', {
|
|
@@ -44,45 +84,4 @@ class Upsert extends sf_plugins_core_1.SfCommand {
|
|
|
44
84
|
});
|
|
45
85
|
}
|
|
46
86
|
}
|
|
47
|
-
Upsert.summary = messages.getMessage('summary');
|
|
48
|
-
Upsert.description = messages.getMessage('description');
|
|
49
|
-
Upsert.examples = messages.getMessages('examples');
|
|
50
|
-
Upsert.flags = {
|
|
51
|
-
...flags_1.orgFlags,
|
|
52
|
-
'external-id': sf_plugins_core_1.Flags.string({
|
|
53
|
-
char: 'i',
|
|
54
|
-
summary: messages.getMessage('flags.external-id.summary'),
|
|
55
|
-
required: true,
|
|
56
|
-
aliases: ['externalid'],
|
|
57
|
-
deprecateAliases: true,
|
|
58
|
-
}),
|
|
59
|
-
file: sf_plugins_core_1.Flags.file({
|
|
60
|
-
exists: true,
|
|
61
|
-
char: 'f',
|
|
62
|
-
summary: messages.getMessage('flags.file.summary'),
|
|
63
|
-
required: true,
|
|
64
|
-
aliases: ['csvfile'],
|
|
65
|
-
deprecateAliases: true,
|
|
66
|
-
}),
|
|
67
|
-
sobject: sf_plugins_core_1.Flags.string({
|
|
68
|
-
char: 's',
|
|
69
|
-
summary: messages.getMessage('flags.sobject.summary'),
|
|
70
|
-
required: true,
|
|
71
|
-
aliases: ['sobjecttype'],
|
|
72
|
-
deprecateAliases: true,
|
|
73
|
-
}),
|
|
74
|
-
wait: sf_plugins_core_1.Flags.duration({
|
|
75
|
-
char: 'w',
|
|
76
|
-
unit: 'minutes',
|
|
77
|
-
summary: messages.getMessage('flags.wait.summary'),
|
|
78
|
-
min: 0,
|
|
79
|
-
default: kit_1.Duration.minutes(0),
|
|
80
|
-
}),
|
|
81
|
-
serial: sf_plugins_core_1.Flags.boolean({
|
|
82
|
-
char: 'r',
|
|
83
|
-
summary: messages.getMessage('flags.serial.summary'),
|
|
84
|
-
default: false,
|
|
85
|
-
}),
|
|
86
|
-
};
|
|
87
|
-
exports.default = Upsert;
|
|
88
87
|
//# sourceMappingURL=upsert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/upsert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upsert.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/upsert.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAqB,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,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,aAAa,CAAC,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAA4B;IACvD,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;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,GAAG,QAAQ;Q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CAAC,IAAI,EAAE,CAAC;aACrB;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC3B,MAAM,CAAC,CAAC,CAAC,CAAC;aACX;QACH,CAAC,CAAC,CAAC;IACL,CAAC"}
|
package/lib/dataCommand.js
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
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
|
-
const messages =
|
|
14
|
-
const logNestedObject = (obj, indentation = 0) => {
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
10
|
+
import { ux } from '@oclif/core';
|
|
11
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
12
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'messages');
|
|
13
|
+
export const logNestedObject = (obj, indentation = 0) => {
|
|
15
14
|
const space = ' '.repeat(indentation);
|
|
16
15
|
Object.entries(obj).forEach(([key, value]) => {
|
|
17
16
|
if (!!value && typeof value === 'object') {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
ux.log(`${space}${key}:`);
|
|
18
|
+
logNestedObject(value, indentation + 2);
|
|
20
19
|
}
|
|
21
20
|
else {
|
|
22
|
-
|
|
21
|
+
ux.log(`${space}${key}: ${value}`);
|
|
23
22
|
}
|
|
24
23
|
});
|
|
25
24
|
};
|
|
26
|
-
exports.logNestedObject = logNestedObject;
|
|
27
25
|
/**
|
|
28
26
|
* Takes a sequence of key=value string pairs and produces an object out of them.
|
|
29
27
|
* If you repeat the key, it replaces the value with the subsequent value.
|
|
@@ -106,24 +104,21 @@ const parseKeyValueSequence = (text) => {
|
|
|
106
104
|
}
|
|
107
105
|
return keyValuePairs;
|
|
108
106
|
};
|
|
109
|
-
const stringToDictionary = (str) => {
|
|
107
|
+
export const stringToDictionary = (str) => {
|
|
110
108
|
const keyValuePairs = parseKeyValueSequence(str);
|
|
111
109
|
return transformKeyValueSequence(keyValuePairs);
|
|
112
110
|
};
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
const query = async (conn, objectType, where) => {
|
|
117
|
-
const queryObject = (0, exports.stringToDictionary)(where);
|
|
111
|
+
export const collectErrorMessages = (result) => result.success === false ? ['\nErrors:', ...result.errors.map((err) => ` ${err.message}`)].join('\n') : '';
|
|
112
|
+
export const query = async (conn, objectType, where) => {
|
|
113
|
+
const queryObject = stringToDictionary(where);
|
|
118
114
|
const sobject = conn.sobject(objectType);
|
|
119
115
|
const records = await sobject.find(queryObject, 'id');
|
|
120
116
|
if (!records || records.length === 0) {
|
|
121
|
-
throw new
|
|
117
|
+
throw new SfError(messages.getMessage('DataRecordGetNoRecord'), 'DataRecordGetNoRecord');
|
|
122
118
|
}
|
|
123
119
|
if (records.length > 1) {
|
|
124
|
-
throw new
|
|
120
|
+
throw new SfError(messages.getMessage('DataRecordGetMultipleRecords', [where, objectType, records.length]), 'DataRecordGetMultipleRecords');
|
|
125
121
|
}
|
|
126
122
|
return records[0];
|
|
127
123
|
};
|
|
128
|
-
exports.query = query;
|
|
129
124
|
//# sourceMappingURL=dataCommand.js.map
|