@salesforce/plugin-data 2.1.21 → 2.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +947 -320
  2. package/lib/api/data/tree/exportApi.js +66 -73
  3. package/lib/api/data/tree/exportApi.js.map +1 -1
  4. package/lib/api/data/tree/importApi.js +62 -62
  5. package/lib/api/data/tree/importApi.js.map +1 -1
  6. package/lib/batcher.js +80 -101
  7. package/lib/batcher.js.map +1 -1
  8. package/lib/commands/data/create/record.js +64 -0
  9. package/lib/commands/data/create/record.js.map +1 -0
  10. package/lib/commands/data/delete/bulk.js +78 -0
  11. package/lib/commands/data/delete/bulk.js.map +1 -0
  12. package/lib/commands/data/delete/record.js +83 -0
  13. package/lib/commands/data/delete/record.js.map +1 -0
  14. package/lib/commands/data/export/tree.js +57 -0
  15. package/lib/commands/data/export/tree.js.map +1 -0
  16. package/lib/commands/data/get/record.js +73 -0
  17. package/lib/commands/data/get/record.js.map +1 -0
  18. package/lib/commands/data/import/tree.js +85 -0
  19. package/lib/commands/data/import/tree.js.map +1 -0
  20. package/lib/commands/data/query/resume.js +55 -0
  21. package/lib/commands/data/query/resume.js.map +1 -0
  22. package/lib/commands/data/query.js +283 -0
  23. package/lib/commands/data/query.js.map +1 -0
  24. package/lib/commands/data/resume.js +64 -0
  25. package/lib/commands/data/resume.js.map +1 -0
  26. package/lib/commands/data/update/record.js +101 -0
  27. package/lib/commands/data/update/record.js.map +1 -0
  28. package/lib/commands/data/upsert/bulk.js +88 -0
  29. package/lib/commands/data/upsert/bulk.js.map +1 -0
  30. package/lib/dataCommand.js +103 -202
  31. package/lib/dataCommand.js.map +1 -1
  32. package/lib/dataSoqlQueryTypes.js +2 -6
  33. package/lib/dataSoqlQueryTypes.js.map +1 -1
  34. package/lib/flags.js +27 -0
  35. package/lib/flags.js.map +1 -0
  36. package/lib/reporters.js +58 -66
  37. package/lib/reporters.js.map +1 -1
  38. package/messages/batcher.md +39 -0
  39. package/messages/bulk.delete.md +31 -0
  40. package/messages/bulk.report.md +17 -0
  41. package/messages/bulk.status.md +29 -0
  42. package/messages/bulk.upsert.md +43 -0
  43. package/messages/exportApi.md +25 -0
  44. package/messages/importApi.md +52 -0
  45. package/messages/messages.md +20 -0
  46. package/messages/record.create.md +45 -0
  47. package/messages/record.delete.md +53 -0
  48. package/messages/record.get.md +47 -0
  49. package/messages/record.update.md +61 -0
  50. package/messages/soql.query.md +72 -0
  51. package/messages/tree.export.md +41 -0
  52. package/messages/tree.import.md +37 -0
  53. package/oclif.manifest.json +1 -1
  54. package/package.json +50 -51
  55. package/lib/api/data/tree/exportApi.d.ts +0 -77
  56. package/lib/api/data/tree/importApi.d.ts +0 -60
  57. package/lib/batcher.d.ts +0 -79
  58. package/lib/commands/force/data/bulk/delete.d.ts +0 -11
  59. package/lib/commands/force/data/bulk/delete.js +0 -58
  60. package/lib/commands/force/data/bulk/delete.js.map +0 -1
  61. package/lib/commands/force/data/bulk/status.d.ts +0 -11
  62. package/lib/commands/force/data/bulk/status.js +0 -61
  63. package/lib/commands/force/data/bulk/status.js.map +0 -1
  64. package/lib/commands/force/data/bulk/upsert.d.ts +0 -11
  65. package/lib/commands/force/data/bulk/upsert.js +0 -76
  66. package/lib/commands/force/data/bulk/upsert.js.map +0 -1
  67. package/lib/commands/force/data/record/create.d.ts +0 -10
  68. package/lib/commands/force/data/record/create.js +0 -58
  69. package/lib/commands/force/data/record/create.js.map +0 -1
  70. package/lib/commands/force/data/record/delete.d.ts +0 -10
  71. package/lib/commands/force/data/record/delete.js +0 -72
  72. package/lib/commands/force/data/record/delete.js.map +0 -1
  73. package/lib/commands/force/data/record/get.d.ts +0 -10
  74. package/lib/commands/force/data/record/get.js +0 -65
  75. package/lib/commands/force/data/record/get.js.map +0 -1
  76. package/lib/commands/force/data/record/update.d.ts +0 -10
  77. package/lib/commands/force/data/record/update.js +0 -90
  78. package/lib/commands/force/data/record/update.js.map +0 -1
  79. package/lib/commands/force/data/soql/bulk/report.d.ts +0 -9
  80. package/lib/commands/force/data/soql/bulk/report.js +0 -45
  81. package/lib/commands/force/data/soql/bulk/report.js.map +0 -1
  82. package/lib/commands/force/data/soql/query.d.ts +0 -64
  83. package/lib/commands/force/data/soql/query.js +0 -300
  84. package/lib/commands/force/data/soql/query.js.map +0 -1
  85. package/lib/commands/force/data/tree/export.d.ts +0 -10
  86. package/lib/commands/force/data/tree/export.js +0 -52
  87. package/lib/commands/force/data/tree/export.js.map +0 -1
  88. package/lib/commands/force/data/tree/import.d.ts +0 -19
  89. package/lib/commands/force/data/tree/import.js +0 -81
  90. package/lib/commands/force/data/tree/import.js.map +0 -1
  91. package/lib/dataCommand.d.ts +0 -57
  92. package/lib/dataSoqlQueryTypes.d.ts +0 -63
  93. package/lib/index.d.ts +0 -2
  94. package/lib/reporters.d.ts +0 -57
  95. package/messages/batcher.json +0 -12
  96. package/messages/bulk.delete.json +0 -12
  97. package/messages/bulk.report.json +0 -7
  98. package/messages/bulk.status.json +0 -12
  99. package/messages/bulk.upsert.json +0 -14
  100. package/messages/exportApi.json +0 -8
  101. package/messages/importApi.json +0 -16
  102. package/messages/messages.json +0 -11
  103. package/messages/record.create.json +0 -15
  104. package/messages/record.delete.json +0 -16
  105. package/messages/record.get.json +0 -14
  106. package/messages/record.update.json +0 -18
  107. package/messages/soql.query.json +0 -26
  108. package/messages/tree.export.json +0 -11
  109. package/messages/tree.import.json +0 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-data",
3
- "version": "2.1.21",
3
+ "version": "2.1.22",
4
4
  "description": "Plugin for salesforce data commands",
5
5
  "author": "Salesforce",
6
6
  "main": "lib/index.js",
@@ -13,11 +13,7 @@
13
13
  "sfdx-plugin"
14
14
  ],
15
15
  "license": "BSD-3-Clause",
16
- "config": {
17
- "commitizen": {
18
- "path": "cz-conventional-changelog"
19
- }
20
- },
16
+ "config": {},
21
17
  "oclif": {
22
18
  "commands": "./lib/commands",
23
19
  "bin": "sfdx",
@@ -27,31 +23,33 @@
27
23
  "@salesforce/plugin-command-reference"
28
24
  ],
29
25
  "topics": {
30
- "force": {
31
- "description": "tools for the Salesforce developer",
26
+ "data": {
27
+ "description": "manipulate records in your org",
28
+ "longDescription": "Use the data commands to manipulate records in your org. Commands are available to help you work with various APIs. Import CSV files with the Bulk API. Export and import data with the SObject Tree Save API. Perform simple CRUD operations on individual records with the REST API.",
32
29
  "subtopics": {
33
- "data": {
34
- "description": "manipulate records in your org",
35
- "longDescription": "Use the data commands to manipulate records in your org. Commands are available to help you work with various APIs. Import CSV files with the Bulk API. Export and import data with the SObject Tree Save API. Perform simple CRUD operations on individual records with the REST API.",
36
- "subtopics": {
37
- "bulk": {
38
- "description": "manipulate records using the bulk API"
39
- },
40
- "record": {
41
- "description": "manipulate records using the enterprise API"
42
- },
43
- "soql": {
44
- "description": "fetch records using SOQL",
45
- "subtopics": {
46
- "bulk": {
47
- "description": "fetch records using the bulk 2.0 API"
48
- }
49
- }
50
- },
51
- "tree": {
52
- "description": "import/export records using the tree API"
53
- }
54
- }
30
+ "create": {
31
+ "description": "create a record"
32
+ },
33
+ "delete": {
34
+ "description": "delete a single record or multiple records in bulk"
35
+ },
36
+ "export": {
37
+ "description": "export data from your org"
38
+ },
39
+ "get": {
40
+ "description": "get a single record"
41
+ },
42
+ "import": {
43
+ "description": "import data via the tree api"
44
+ },
45
+ "query": {
46
+ "description": "query records"
47
+ },
48
+ "update": {
49
+ "description": "update a single record"
50
+ },
51
+ "upsert": {
52
+ "description": "upsert many records via the bulk API"
55
53
  }
56
54
  }
57
55
  }
@@ -78,56 +76,56 @@
78
76
  "format": "sf-format",
79
77
  "lint": "sf-lint",
80
78
  "postpack": "shx rm -f oclif.manifest.json",
81
- "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference",
79
+ "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference && yarn test:json-schema",
82
80
  "prepack": "sf-prepack",
83
81
  "prepare": "sf-install",
84
82
  "pretest": "sf-compile-test",
85
83
  "test": "sf-test",
86
84
  "test:command-reference": "./bin/dev commandreference:generate --erroronwarnings",
87
85
  "test:deprecation-policy": "./bin/dev snapshot:compare",
86
+ "test:json-schema": "./bin/dev schema:compare",
88
87
  "test:nuts": "nyc mocha \"./test/**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
89
88
  "version": "oclif readme"
90
89
  },
91
90
  "dependencies": {
92
- "@oclif/core": "^1.20.0",
93
- "@salesforce/command": "^5.2.37",
91
+ "@oclif/core": "^1.22.0",
94
92
  "@salesforce/core": "^3.32.12",
93
+ "@salesforce/kit": "^1.7.0",
94
+ "@salesforce/sf-plugins-core": "^1.21.3",
95
95
  "@salesforce/ts-types": "^1.7.2",
96
96
  "@types/fs-extra": "^9.0.13",
97
97
  "chalk": "^4.1.0",
98
98
  "csv-parse": "^4.16.3",
99
- "csv-stringify": "^6.0.5",
99
+ "csv-stringify": "^6.2.3",
100
100
  "fs-extra": "^10.0.1",
101
101
  "jsforce": "^2.0.0-beta.19",
102
102
  "tslib": "^2"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@oclif/plugin-command-snapshot": "^3.2.16",
106
- "@salesforce/cli-plugins-testkit": "^1.4.24",
106
+ "@salesforce/cli-plugins-testkit": "^3.2.15",
107
107
  "@salesforce/dev-config": "^3.0.1",
108
- "@salesforce/dev-scripts": "2.0.4",
109
- "@salesforce/plugin-command-reference": "^1.5.10",
108
+ "@salesforce/dev-scripts": "^3.1.0",
109
+ "@salesforce/plugin-command-reference": "^2.2.8",
110
110
  "@salesforce/prettier-config": "^0.0.2",
111
- "@salesforce/ts-sinon": "^1.4.2",
111
+ "@salesforce/ts-sinon": "^1.4.3",
112
112
  "@swc/core": "^1.3.24",
113
113
  "@types/chai-as-promised": "^7.1.3",
114
114
  "@types/graceful-fs": "^4.1.5",
115
- "@types/mkdirp": "^1.0.1",
116
115
  "@types/shelljs": "^0.8.10",
117
- "@typescript-eslint/eslint-plugin": "^4.33.0",
118
- "@typescript-eslint/parser": "^4.33.0",
116
+ "@typescript-eslint/eslint-plugin": "^5.47.0",
117
+ "@typescript-eslint/parser": "^5.47.0",
119
118
  "chai": "^4.3.7",
120
119
  "chai-as-promised": "^7.1.1",
121
- "cz-conventional-changelog": "^3.3.0",
122
- "eslint": "^7.27.0",
123
- "eslint-config-prettier": "^8.3.0",
124
- "eslint-config-salesforce": "^0.1.6",
120
+ "eslint": "^8.21.0",
121
+ "eslint-config-prettier": "^8.6.0",
122
+ "eslint-config-salesforce": "^1.1.0",
125
123
  "eslint-config-salesforce-license": "^0.1.6",
126
- "eslint-config-salesforce-typescript": "^0.2.7",
124
+ "eslint-config-salesforce-typescript": "^1.1.1",
127
125
  "eslint-plugin-header": "^3.1.1",
128
126
  "eslint-plugin-import": "2.26.0",
129
- "eslint-plugin-jsdoc": "^35.1.3",
130
- "eslint-plugin-prettier": "^3.1.3",
127
+ "eslint-plugin-jsdoc": "^39.3.6",
128
+ "eslint-plugin-sf-plugin": "^1.3.1",
131
129
  "fast-xml-parser": "^3.20.3",
132
130
  "husky": "^7.0.4",
133
131
  "mocha": "^9.1.3",
@@ -138,11 +136,12 @@
138
136
  "shelljs": "^0.8.3",
139
137
  "shx": "^0.3.3",
140
138
  "sinon": "10.0.0",
139
+ "strip-ansi": "^6.0.1",
141
140
  "ts-node": "^10.4.0",
142
- "typescript": "^4.9.3"
141
+ "typescript": "^4.9.4"
143
142
  },
144
143
  "sfdx": {
145
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-data/2.1.21.crt",
146
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-data/2.1.21.sig"
144
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-data/2.1.22.crt",
145
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-data/2.1.22.sig"
147
146
  }
148
147
  }
@@ -1,77 +0,0 @@
1
- import { Org } from '@salesforce/core';
2
- import { UX } from '@salesforce/command';
3
- import { DataPlanPart, SObjectTreeFileContents } from '../../../dataSoqlQueryTypes';
4
- export interface ExportConfig {
5
- query: string;
6
- outputDir?: string;
7
- plan?: boolean;
8
- prefix?: string;
9
- }
10
- /**
11
- * Exports data from an org into sObject tree format.
12
- */
13
- export declare class ExportApi {
14
- private readonly org;
15
- private readonly ux;
16
- private logger;
17
- private objectTypeRegistry;
18
- private refFromIdByType;
19
- private typeRefIndexes;
20
- private config;
21
- constructor(org: Org, ux: UX);
22
- /**
23
- * Invokes the provided SOQL query against a target Org. Results
24
- * are converted into SObject Tree format.
25
- *
26
- * @param config
27
- */
28
- export(config: ExportConfig): Promise<SObjectTreeFileContents | DataPlanPart[]>;
29
- /**
30
- * Ensures a valid query is defined in the export configuration,
31
- * which can be either a soql query or a path to a file containing
32
- * a soql query.
33
- *
34
- * @param config - The export configuration.
35
- */
36
- private validate;
37
- private processQueryResults;
38
- /**
39
- * Register object types and type hierarchy for plan generation
40
- **/
41
- private recordObjectTypes;
42
- private queryResultsToTree;
43
- private processRecords;
44
- private incrementTypeRefIndex;
45
- private processRecordAttributes;
46
- private processRecordAttribute;
47
- private loadMetadata;
48
- private isQueryResult;
49
- private isSpecificTypeWithMetadata;
50
- private getRelationshipFieldName;
51
- private isRelationship;
52
- private isRelationshipWithMetadata;
53
- private getRelatedTo;
54
- private getRelatedToWithMetadata;
55
- /**
56
- * Register object type's id to reference mapping
57
- *
58
- * @param refId like '@AccountRef1'
59
- * */
60
- private saveRecordRef;
61
- /**
62
- * Walk the final data set and split out into files. The main queried
63
- * object is the parent, and has a different saveRefs and resolveRefs
64
- * values. All the references have been created at this point.
65
- */
66
- private generateDataPlan;
67
- private writeObjectTypeDataFile;
68
- /**
69
- * This method is used as a second pass to establish references that couldn't be determined
70
- * in the initial pass done by processRecordList. It looks for relationship fields that
71
- * contain an id.
72
- */
73
- private finalApplyRefs;
74
- private countRecords;
75
- private getPrefixedFileName;
76
- private writeDataFileSync;
77
- }
@@ -1,60 +0,0 @@
1
- import { Dictionary, JsonMap } from '@salesforce/ts-types';
2
- import { Org } from '@salesforce/core';
3
- export interface ImportConfig {
4
- contentType?: string;
5
- sobjectTreeFiles?: string[];
6
- plan?: string;
7
- }
8
- interface ResponseRefs {
9
- referenceId: string;
10
- id: string;
11
- }
12
- export interface ImportResults {
13
- responseRefs?: ResponseRefs[];
14
- sobjectTypes?: Dictionary;
15
- errors?: string[];
16
- }
17
- /**
18
- * Imports data into an org that was exported to files using the export API.
19
- */
20
- export declare class ImportApi {
21
- private readonly org;
22
- private logger;
23
- private responseRefs;
24
- private sobjectUrlMap;
25
- private schemaValidator;
26
- private sobjectTypes;
27
- private config;
28
- private importPlanConfig;
29
- constructor(org: Org);
30
- /**
31
- * Inserts given SObject Tree content into given target Org.
32
- *
33
- * @param config
34
- */
35
- import(config: ImportConfig): Promise<ImportResults>;
36
- getSchema(): JsonMap;
37
- private getPlanPromises;
38
- /**
39
- * Validates the import configuration. If a plan is passed, validates
40
- * the plan per the schema.
41
- *
42
- * @param config - The data import configuration.
43
- * @returns Promise.<ImportConfig>
44
- */
45
- private validate;
46
- /**
47
- * Create a hash of sobject { ReferenceId: Type } assigned to this.sobjectTypes.
48
- * Used to display the sobject type in the results.
49
- *
50
- * @param content The content string defined by the file(s).
51
- * @param isJson
52
- */
53
- private createSObjectTypeMap;
54
- private getSObjectTreeFileMeta;
55
- private parseSObjectTreeFile;
56
- private sendSObjectTreeRequest;
57
- private parseSObjectTreeResponse;
58
- private importSObjectTreeFile;
59
- }
60
- export {};
package/lib/batcher.d.ts DELETED
@@ -1,79 +0,0 @@
1
- /// <reference types="node" />
2
- import { ReadStream } from 'fs';
3
- import { Connection } from '@salesforce/core';
4
- import { UX } from '@salesforce/command';
5
- import { Job, JobInfo } from 'jsforce/job';
6
- import { BulkIngestBatchResult } from 'jsforce/lib/api/bulk';
7
- import { BatchInfo } from 'jsforce/batch';
8
- type BatchEntry = Record<string, string>;
9
- export type Batches = BatchEntry[][];
10
- export type BulkResult = {
11
- $: {
12
- xmlns: string;
13
- };
14
- id: string;
15
- jobId: string;
16
- state: string;
17
- createdDate: string;
18
- systemModStamp: string;
19
- numberRecordsProcessed: string;
20
- numberRecordsFailed: string;
21
- totalProcessingTime: string;
22
- apiActiveProcessingTime: string;
23
- apexProcessingTime: string;
24
- };
25
- export declare class Batcher {
26
- private conn;
27
- private ux;
28
- constructor(conn: Connection, ux: UX);
29
- /**
30
- * get and display the job status; close the job if completed
31
- *
32
- * @param jobId {string}
33
- * @param doneCallback
34
- */
35
- fetchAndDisplayJobStatus(jobId: string, doneCallback?: (...args: [{
36
- job: JobInfo;
37
- }]) => void): Promise<JobInfo>;
38
- bulkStatus(summary: JobInfo | BatchInfo, results?: BulkIngestBatchResult, batchNum?: number, isJob?: boolean): JobInfo | BatchInfo;
39
- /**
40
- * create and execute batches based on the record arrays; wait for completion response if -w flag is set with > 0 minutes
41
- * to get proper logging/printing to console pass the instance of UX that called this method
42
- *
43
- * @param job {Job}
44
- * @param records
45
- * @param sobjectType {string}
46
- * @param wait {number}
47
- */
48
- createAndExecuteBatches(job: Job & {
49
- id?: string;
50
- }, records: ReadStream, sobjectType: string, wait?: number): Promise<BulkResult[] | JobInfo[]>;
51
- /**
52
- * The timeout error handling is messy so to increase readability
53
- * break it out into it's own method
54
- *
55
- * @param err The timeout Error
56
- * @private
57
- */
58
- private parseTimeOutError;
59
- /**
60
- * register completion event listeners on the batch
61
- * exposed for unit testing
62
- *
63
- * @param newBatch
64
- * @param batchesCompleted
65
- * @param overallInfo
66
- * @param batchNum
67
- * @param totalNumBatches
68
- * @param waitMins
69
- */
70
- private waitForCompletion;
71
- /**
72
- * registers the listener in charge of distributing all csv records into batches
73
- *
74
- * @param readStream - the read stream
75
- * @returns {Promise<Batches>}
76
- */
77
- private splitIntoBatches;
78
- }
79
- export {};
@@ -1,11 +0,0 @@
1
- import { FlagsConfig } from '@salesforce/command';
2
- import { JobInfo } from 'jsforce/job';
3
- import { BulkResult } from '../../../../batcher';
4
- import { DataCommand } from '../../../../dataCommand';
5
- export default class Delete extends DataCommand {
6
- static readonly description: string;
7
- static readonly examples: string[];
8
- static readonly requiresUsername = true;
9
- static readonly flagsConfig: FlagsConfig;
10
- run(): Promise<BulkResult[] | JobInfo[]>;
11
- }
@@ -1,58 +0,0 @@
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 os = require("os");
10
- const fs = require("fs");
11
- const core_1 = require("@salesforce/core");
12
- const command_1 = require("@salesforce/command");
13
- const batcher_1 = require("../../../../batcher");
14
- const dataCommand_1 = require("../../../../dataCommand");
15
- core_1.Messages.importMessagesDirectory(__dirname);
16
- const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'bulk.delete');
17
- class Delete extends dataCommand_1.DataCommand {
18
- async run() {
19
- let result;
20
- try {
21
- await this.throwIfPathDoesntExist(this.flags.csvfile);
22
- const conn = this.ensureOrg().getConnection();
23
- this.ux.startSpinner('Bulk Delete');
24
- const csvRecords = fs.createReadStream(this.flags.csvfile, { encoding: 'utf-8' });
25
- const job = conn.bulk.createJob(this.flags.sobjecttype, 'delete');
26
- const batcher = new batcher_1.Batcher(conn, this.ux);
27
- result = await batcher.createAndExecuteBatches(job, csvRecords, this.flags.sobjecttype, this.flags.wait);
28
- this.ux.stopSpinner();
29
- return result;
30
- }
31
- catch (e) {
32
- this.ux.stopSpinner('error');
33
- throw core_1.SfError.wrap(e);
34
- }
35
- }
36
- }
37
- exports.default = Delete;
38
- Delete.description = messages.getMessage('description');
39
- Delete.examples = messages.getMessage('examples').split(os.EOL);
40
- Delete.requiresUsername = true;
41
- Delete.flagsConfig = {
42
- csvfile: command_1.flags.filepath({
43
- char: 'f',
44
- description: messages.getMessage('flags.csvfile'),
45
- required: true,
46
- }),
47
- sobjecttype: command_1.flags.string({
48
- char: 's',
49
- description: messages.getMessage('flags.sobjecttype'),
50
- required: true,
51
- }),
52
- wait: command_1.flags.minutes({
53
- char: 'w',
54
- description: messages.getMessage('flags.wait'),
55
- min: 0,
56
- }),
57
- };
58
- //# sourceMappingURL=delete.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/delete.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,yBAAyB;AAEzB,2CAAiE;AACjE,iDAAyD;AAEzD,iDAA0D;AAC1D,yDAAsD;AAEtD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAEjF,MAAqB,MAAO,SAAQ,yBAAW;IAsBtC,KAAK,CAAC,GAAG;QACd,IAAI,MAAgC,CAAC;QAErC,IAAI;YACF,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAiB,CAAC,CAAC;YAEhE,MAAM,IAAI,GAAe,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,EAAE,CAAC;YAC1D,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;YAEpC,MAAM,UAAU,GAAe,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAiB,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YACxG,MAAM,GAAG,GAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAmB,CAAC;YAEzF,MAAM,OAAO,GAAY,IAAI,iBAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YAEpD,MAAM,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAC5C,GAAG,EACH,UAAU,EACV,IAAI,CAAC,KAAK,CAAC,WAAqB,EAChC,IAAI,CAAC,KAAK,CAAC,IAAc,CAC1B,CAAC;YAEF,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC7B,MAAM,cAAO,CAAC,IAAI,CAAC,CAAU,CAAC,CAAC;SAChC;IACH,CAAC;;AAjDH,yBAkDC;AAjDwB,kBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,eAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACzD,uBAAgB,GAAG,IAAI,CAAC;AACxB,kBAAW,GAAgB;IAChD,OAAO,EAAE,eAAK,CAAC,QAAQ,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC;QACjD,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,WAAW,EAAE,eAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC;QACrD,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,OAAO,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;QAC9C,GAAG,EAAE,CAAC;KACP,CAAC;CACH,CAAC"}
@@ -1,11 +0,0 @@
1
- import { BatchInfo } from 'jsforce/lib/api/bulk';
2
- import { JobInfo } from 'jsforce/job';
3
- import { FlagsConfig } from '@salesforce/command';
4
- import { DataCommand } from '../../../../dataCommand';
5
- export default class Status extends DataCommand {
6
- static readonly description: string;
7
- static readonly examples: string[];
8
- static readonly requiresUsername = true;
9
- static readonly flagsConfig: FlagsConfig;
10
- run(): Promise<BatchInfo[] | JobInfo>;
11
- }
@@ -1,61 +0,0 @@
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 os = require("os");
10
- const command_1 = require("@salesforce/command");
11
- const core_1 = require("@salesforce/core");
12
- const batcher_1 = require("../../../../batcher");
13
- const dataCommand_1 = require("../../../../dataCommand");
14
- core_1.Messages.importMessagesDirectory(__dirname);
15
- const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'bulk.status');
16
- class Status extends dataCommand_1.DataCommand {
17
- async run() {
18
- this.ux.startSpinner('Getting Status');
19
- const conn = this.ensureOrg().getConnection();
20
- const batcher = new batcher_1.Batcher(conn, this.ux);
21
- if (this.flags.jobid && this.flags.batchid) {
22
- // view batch status
23
- const job = conn.bulk.job(this.flags.jobid);
24
- let found = false;
25
- const batches = await job.list();
26
- batches.forEach((batch) => {
27
- if (batch.id === this.flags.batchid) {
28
- batcher.bulkStatus(batch);
29
- found = true;
30
- }
31
- });
32
- if (!found) {
33
- throw new core_1.SfError(messages.getMessage('NoBatchFound', [this.flags.batchid, this.flags.jobid]), 'NoBatchFound');
34
- }
35
- this.ux.stopSpinner();
36
- return batches;
37
- }
38
- else {
39
- // view job status
40
- const jobStatus = await batcher.fetchAndDisplayJobStatus(this.flags.jobid);
41
- this.ux.stopSpinner();
42
- return jobStatus;
43
- }
44
- }
45
- }
46
- exports.default = Status;
47
- Status.description = messages.getMessage('description');
48
- Status.examples = messages.getMessage('examples').split(os.EOL);
49
- Status.requiresUsername = true;
50
- Status.flagsConfig = {
51
- batchid: command_1.flags.string({
52
- char: 'b',
53
- description: messages.getMessage('flags.batchid'),
54
- }),
55
- jobid: command_1.flags.string({
56
- char: 'i',
57
- description: messages.getMessage('flags.jobid'),
58
- required: true,
59
- }),
60
- };
61
- //# sourceMappingURL=status.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/status.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,yBAAyB;AAGzB,iDAAyD;AACzD,2CAAiE;AACjE,iDAA8C;AAC9C,yDAAsD;AAEtD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAEjF,MAAqB,MAAO,SAAQ,yBAAW;IAgBtC,KAAK,CAAC,GAAG;QACd,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACvC,MAAM,IAAI,GAAe,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3C,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YAC1C,oBAAoB;YACpB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,KAAK,GAAG,KAAK,CAAC;YAElB,MAAM,OAAO,GAAgB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9C,OAAO,CAAC,OAAO,CAAC,CAAC,KAAgB,EAAE,EAAE;gBACnC,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;oBACnC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;oBAC1B,KAAK,GAAG,IAAI,CAAC;iBACd;YACH,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,EAAE;gBACV,MAAM,IAAI,cAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;aAChH;YAED,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO,OAAO,CAAC;SAChB;aAAM;YACL,kBAAkB;YAClB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC;YACrF,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;;AA5CH,yBA6CC;AA5CwB,kBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,eAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACzD,uBAAgB,GAAG,IAAI,CAAC;AACxB,kBAAW,GAAgB;IAChD,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC;KAClD,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC;QAC/C,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC"}
@@ -1,11 +0,0 @@
1
- import { FlagsConfig } from '@salesforce/command';
2
- import { JobInfo } from 'jsforce/job';
3
- import { BulkResult } from '../../../../batcher';
4
- import { DataCommand } from '../../../../dataCommand';
5
- export default class Upsert extends DataCommand {
6
- static readonly description: string;
7
- static readonly examples: string[];
8
- static readonly requiresUsername = true;
9
- static readonly flagsConfig: FlagsConfig;
10
- run(): Promise<JobInfo[] | BulkResult[]>;
11
- }
@@ -1,76 +0,0 @@
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 os = require("os");
10
- const fs = require("fs");
11
- const command_1 = require("@salesforce/command");
12
- const core_1 = require("@salesforce/core");
13
- const batcher_1 = require("../../../../batcher");
14
- const dataCommand_1 = require("../../../../dataCommand");
15
- core_1.Messages.importMessagesDirectory(__dirname);
16
- const messages = core_1.Messages.loadMessages('@salesforce/plugin-data', 'bulk.upsert');
17
- class Upsert extends dataCommand_1.DataCommand {
18
- async run() {
19
- const conn = this.ensureOrg().getConnection();
20
- this.ux.startSpinner('Bulk Upsert');
21
- await this.throwIfPathDoesntExist(this.flags.csvfile);
22
- const batcher = new batcher_1.Batcher(conn, this.ux);
23
- const csvStream = fs.createReadStream(this.flags.csvfile, { encoding: 'utf-8' });
24
- const concurrencyMode = this.flags.serial ? 'Serial' : 'Parallel';
25
- const job = conn.bulk.createJob(this.flags.sobjecttype, 'upsert', {
26
- extIdField: this.flags.externalid,
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, this.flags.sobjecttype, this.flags.wait));
36
- this.ux.stopSpinner();
37
- }
38
- catch (e) {
39
- this.ux.stopSpinner('error');
40
- reject(e);
41
- }
42
- });
43
- }
44
- }
45
- exports.default = Upsert;
46
- Upsert.description = messages.getMessage('description');
47
- Upsert.examples = messages.getMessage('examples').split(os.EOL);
48
- Upsert.requiresUsername = true;
49
- Upsert.flagsConfig = {
50
- externalid: command_1.flags.string({
51
- char: 'i',
52
- description: messages.getMessage('flags.externalid'),
53
- required: true,
54
- }),
55
- csvfile: command_1.flags.filepath({
56
- char: 'f',
57
- description: messages.getMessage('flags.csvfile'),
58
- required: true,
59
- }),
60
- sobjecttype: command_1.flags.string({
61
- char: 's',
62
- description: messages.getMessage('flags.sobjecttype'),
63
- required: true,
64
- }),
65
- wait: command_1.flags.minutes({
66
- char: 'w',
67
- description: messages.getMessage('flags.wait'),
68
- min: 0,
69
- }),
70
- serial: command_1.flags.boolean({
71
- char: 'r',
72
- description: messages.getMessage('flags.serial'),
73
- default: false,
74
- }),
75
- };
76
- //# sourceMappingURL=upsert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upsert.js","sourceRoot":"","sources":["../../../../../src/commands/force/data/bulk/upsert.ts"],"names":[],"mappings":"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"}
@@ -1,10 +0,0 @@
1
- import { FlagsConfig } from '@salesforce/command';
2
- import { SaveResult } from 'jsforce';
3
- import { DataCommand } from '../../../../dataCommand';
4
- export default class Create extends DataCommand {
5
- static readonly description: string;
6
- static readonly examples: string[];
7
- static readonly requiresUsername = true;
8
- static readonly flagsConfig: FlagsConfig;
9
- run(): Promise<SaveResult>;
10
- }