@salesforce/plugin-data 3.3.5 → 3.4.1

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 CHANGED
@@ -76,6 +76,7 @@ sf plugins
76
76
 
77
77
  <!-- commands -->
78
78
 
79
+ - [`sf data create file`](#sf-data-create-file)
79
80
  - [`sf data create record`](#sf-data-create-record)
80
81
  - [`sf data delete bulk`](#sf-data-delete-bulk)
81
82
  - [`sf data delete record`](#sf-data-delete-record)
@@ -95,6 +96,55 @@ sf plugins
95
96
  - [`sf force data bulk status`](#sf-force-data-bulk-status)
96
97
  - [`sf force data bulk upsert`](#sf-force-data-bulk-upsert)
97
98
 
99
+ ## `sf data create file`
100
+
101
+ Upload a local file to an org.
102
+
103
+ ```
104
+ USAGE
105
+ $ sf data create file -o <value> -f <value> [--json] [--flags-dir <value>] [--api-version <value>] [-t <value>] [-i
106
+ <value>]
107
+
108
+ FLAGS
109
+ -f, --file=<value> (required) Path of file to upload.
110
+ -i, --parent-id=<value> ID of the record to attach the file to.
111
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
112
+ configuration variable is already set.
113
+ -t, --title=<value> New title given to the file (ContentDocument) after it's uploaded.
114
+ --api-version=<value> Override the api version used for api requests made by this command
115
+
116
+ GLOBAL FLAGS
117
+ --flags-dir=<value> Import flag values from a directory.
118
+ --json Format output as json.
119
+
120
+ DESCRIPTION
121
+ Upload a local file to an org.
122
+
123
+ This command always creates a new file in the org; you can't update an existing file. After a successful upload, the
124
+ command displays the ID of the new ContentDocument record which represents the uploaded file.
125
+
126
+ By default, the uploaded file isn't attached to a record; in the Salesforce UI the file shows up in the Files tab. You
127
+ can optionally attach the file to an existing record, such as an account, as long as you know its record ID.
128
+
129
+ You can also give the file a new name after it's been uploaded; by default its name in the org is the same as the
130
+ local file name.
131
+
132
+ EXAMPLES
133
+ Upload the local file "resources/astro.png" to your default org:
134
+
135
+ $ sf data create file --file resources/astro.png
136
+
137
+ Give the file a different filename after it's uploaded to the org with alias "my-scratch":
138
+
139
+ $ sf data create file --file resources/astro.png --title AstroOnABoat.png --target-org my-scratch
140
+
141
+ Attach the file to a record in the org:
142
+
143
+ $ sf data create file --file path/to/astro.png --parent-id a03fakeLoJWPIA3
144
+ ```
145
+
146
+ _See code: [src/commands/data/create/file.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/create/file.ts)_
147
+
98
148
  ## `sf data create record`
99
149
 
100
150
  Create and insert a record into a Salesforce or Tooling API object.
@@ -149,7 +199,7 @@ EXAMPLES
149
199
  TracedEntityId=01p17000000R6bLAAS"
150
200
  ```
151
201
 
152
- _See code: [src/commands/data/create/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/create/record.ts)_
202
+ _See code: [src/commands/data/create/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/create/record.ts)_
153
203
 
154
204
  ## `sf data delete bulk`
155
205
 
@@ -196,7 +246,7 @@ EXAMPLES
196
246
  $ sf data delete bulk --sobject MyObject__c --file files/delete.csv --wait 5 --target-org my-scratch
197
247
  ```
198
248
 
199
- _See code: [src/commands/data/delete/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/delete/bulk.ts)_
249
+ _See code: [src/commands/data/delete/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/delete/bulk.ts)_
200
250
 
201
251
  ## `sf data delete record`
202
252
 
@@ -257,7 +307,7 @@ EXAMPLES
257
307
  $ sf data delete record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
258
308
  ```
259
309
 
260
- _See code: [src/commands/data/delete/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/delete/record.ts)_
310
+ _See code: [src/commands/data/delete/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/delete/record.ts)_
261
311
 
262
312
  ## `sf data delete resume`
263
313
 
@@ -296,7 +346,7 @@ EXAMPLES
296
346
  $ sf data delete resume --use-most-recent --target-org my-scratch
297
347
  ```
298
348
 
299
- _See code: [src/commands/data/delete/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/delete/resume.ts)_
349
+ _See code: [src/commands/data/delete/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/delete/resume.ts)_
300
350
 
301
351
  ## `sf data export beta tree`
302
352
 
@@ -354,7 +404,7 @@ EXAMPLES
354
404
  my-scratch
355
405
  ```
356
406
 
357
- _See code: [src/commands/data/export/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/export/beta/tree.ts)_
407
+ _See code: [src/commands/data/export/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/export/beta/tree.ts)_
358
408
 
359
409
  ## `sf data export tree`
360
410
 
@@ -414,7 +464,7 @@ EXAMPLES
414
464
  my-scratch
415
465
  ```
416
466
 
417
- _See code: [src/commands/data/export/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/export/tree.ts)_
467
+ _See code: [src/commands/data/export/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/export/tree.ts)_
418
468
 
419
469
  ## `sf data get record`
420
470
 
@@ -478,7 +528,7 @@ EXAMPLES
478
528
  $ sf data get record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
479
529
  ```
480
530
 
481
- _See code: [src/commands/data/get/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/get/record.ts)_
531
+ _See code: [src/commands/data/get/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/get/record.ts)_
482
532
 
483
533
  ## `sf data import beta tree`
484
534
 
@@ -521,7 +571,7 @@ EXAMPLES
521
571
  $ sf data import beta tree --plan Account-Contact-plan.json
522
572
  ```
523
573
 
524
- _See code: [src/commands/data/import/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/import/beta/tree.ts)_
574
+ _See code: [src/commands/data/import/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/import/beta/tree.ts)_
525
575
 
526
576
  ## `sf data import tree`
527
577
 
@@ -571,7 +621,7 @@ EXAMPLES
571
621
  $ sf data import tree --plan Account-Contact-plan.json
572
622
  ```
573
623
 
574
- _See code: [src/commands/data/import/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/import/tree.ts)_
624
+ _See code: [src/commands/data/import/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/import/tree.ts)_
575
625
 
576
626
  ## `sf data query`
577
627
 
@@ -635,7 +685,7 @@ EXAMPLES
635
685
  $ sf data query --query "SELECT Id FROM Contact" --bulk --wait 0
636
686
  ```
637
687
 
638
- _See code: [src/commands/data/query.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/query.ts)_
688
+ _See code: [src/commands/data/query.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/query.ts)_
639
689
 
640
690
  ## `sf data query resume`
641
691
 
@@ -673,7 +723,7 @@ EXAMPLES
673
723
  $ sf data query resume --bulk-query-id 7500x000005BdFzXXX
674
724
  ```
675
725
 
676
- _See code: [src/commands/data/query/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/query/resume.ts)_
726
+ _See code: [src/commands/data/query/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/query/resume.ts)_
677
727
 
678
728
  ## `sf data resume`
679
729
 
@@ -710,7 +760,7 @@ EXAMPLES
710
760
  $ sf data resume --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA
711
761
  ```
712
762
 
713
- _See code: [src/commands/data/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/resume.ts)_
763
+ _See code: [src/commands/data/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/resume.ts)_
714
764
 
715
765
  ## `sf data update record`
716
766
 
@@ -772,7 +822,7 @@ EXAMPLES
772
822
  "ExpirationDate=2017-12-01T00:58:04.000+0000"
773
823
  ```
774
824
 
775
- _See code: [src/commands/data/update/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/update/record.ts)_
825
+ _See code: [src/commands/data/update/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/update/record.ts)_
776
826
 
777
827
  ## `sf data upsert bulk`
778
828
 
@@ -825,7 +875,7 @@ EXAMPLES
825
875
  my-scratch
826
876
  ```
827
877
 
828
- _See code: [src/commands/data/upsert/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/upsert/bulk.ts)_
878
+ _See code: [src/commands/data/upsert/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/upsert/bulk.ts)_
829
879
 
830
880
  ## `sf data upsert resume`
831
881
 
@@ -864,7 +914,7 @@ EXAMPLES
864
914
  $ sf data upsert resume --use-most-recent --target-org my-scratch
865
915
  ```
866
916
 
867
- _See code: [src/commands/data/upsert/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/data/upsert/resume.ts)_
917
+ _See code: [src/commands/data/upsert/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/data/upsert/resume.ts)_
868
918
 
869
919
  ## `sf force data bulk delete`
870
920
 
@@ -911,7 +961,7 @@ EXAMPLES
911
961
  $ sf force data bulk delete --sobject MyObject__c --file files/delete.csv --wait 5 --target-org my-scratch
912
962
  ```
913
963
 
914
- _See code: [src/commands/force/data/bulk/delete.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/force/data/bulk/delete.ts)_
964
+ _See code: [src/commands/force/data/bulk/delete.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/force/data/bulk/delete.ts)_
915
965
 
916
966
  ## `sf force data bulk status`
917
967
 
@@ -948,7 +998,7 @@ EXAMPLES
948
998
  $ sf force data bulk status --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA --target-org my-scratch
949
999
  ```
950
1000
 
951
- _See code: [src/commands/force/data/bulk/status.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/force/data/bulk/status.ts)_
1001
+ _See code: [src/commands/force/data/bulk/status.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/force/data/bulk/status.ts)_
952
1002
 
953
1003
  ## `sf force data bulk upsert`
954
1004
 
@@ -1006,6 +1056,6 @@ EXAMPLES
1006
1056
  --target-org my-scratch
1007
1057
  ```
1008
1058
 
1009
- _See code: [src/commands/force/data/bulk/upsert.ts](https://github.com/salesforcecli/plugin-data/blob/3.3.5/src/commands/force/data/bulk/upsert.ts)_
1059
+ _See code: [src/commands/force/data/bulk/upsert.ts](https://github.com/salesforcecli/plugin-data/blob/3.4.1/src/commands/force/data/bulk/upsert.ts)_
1010
1060
 
1011
1061
  <!-- commandsstop -->
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2023, 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 { readFile } from 'node:fs/promises';
8
+ import { basename } from 'node:path';
9
+ import FormData from 'form-data';
10
+ export async function file2CV(conn, filepath, title) {
11
+ const req = {
12
+ PathOnClient: filepath,
13
+ Title: title,
14
+ };
15
+ const form = new FormData();
16
+ form.append('VersionData', await readFile(filepath), { filename: title ?? basename(filepath) });
17
+ form.append('entity_content', JSON.stringify(req), { contentType: 'application/json' });
18
+ // POST the multipart form to Salesforce's API, can't use the normal "create" action because it doesn't support multipart
19
+ const CV = await conn.request({
20
+ url: '/sobjects/ContentVersion',
21
+ headers: { ...form.getHeaders() },
22
+ body: form.getBuffer(),
23
+ method: 'POST',
24
+ });
25
+ return conn.singleRecordQuery(`Select Id, ContentDocumentId, Title, FileExtension from ContentVersion where Id='${CV.id}'`);
26
+ }
27
+ //# sourceMappingURL=fileToContentVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileToContentVersion.js","sourceRoot":"","sources":["../../../src/api/file/fileToContentVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,OAAO,QAAQ,MAAM,WAAW,CAAC;AAejC,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAgB,EAAE,QAAgB,EAAE,KAAc;IAC9E,MAAM,GAAG,GAAgC;QACvC,YAAY,EAAE,QAAQ;QACtB,KAAK,EAAE,KAAK;KACb,CAAC;IAEF,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAExF,yHAAyH;IACzH,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAa;QACxC,GAAG,EAAE,0BAA0B;QAC/B,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,EAAE;QACjC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;QACtB,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,iBAAiB,CAC3B,oFAAoF,EAAE,CAAC,EAAE,GAAG,CAC7F,CAAC;AACJ,CAAC"}
@@ -0,0 +1,73 @@
1
+ /*
2
+ * Copyright (c) 2023, 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 { SfCommand, Flags } from '@salesforce/sf-plugins-core';
8
+ import { Messages, SfError } from '@salesforce/core';
9
+ import { file2CV } from '../../../api/file/fileToContentVersion.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ const messages = Messages.loadMessages('@salesforce/plugin-data', 'data.create.file');
12
+ export default class DataCreateFile extends SfCommand {
13
+ static summary = messages.getMessage('summary');
14
+ static description = messages.getMessage('description');
15
+ static examples = messages.getMessages('examples');
16
+ static flags = {
17
+ 'target-org': Flags.requiredOrg(),
18
+ 'api-version': Flags.orgApiVersion(),
19
+ title: Flags.string({
20
+ summary: messages.getMessage('flags.title.summary'),
21
+ char: 't',
22
+ required: false,
23
+ }),
24
+ file: Flags.file({
25
+ summary: messages.getMessage('flags.file.summary'),
26
+ char: 'f',
27
+ required: true,
28
+ exists: true,
29
+ }),
30
+ // it really could be most any valid ID
31
+ // eslint-disable-next-line sf-plugin/id-flag-suggestions
32
+ 'parent-id': Flags.salesforceId({
33
+ summary: messages.getMessage('flags.parent-id.summary'),
34
+ char: 'i',
35
+ length: 'both',
36
+ }),
37
+ };
38
+ async run() {
39
+ const { flags } = await this.parse(DataCreateFile);
40
+ const conn = flags['target-org'].getConnection(flags['api-version']);
41
+ const cv = await file2CV(conn, flags.file, flags.title);
42
+ this.logSuccess(messages.getMessage('createSuccess', [cv.ContentDocumentId]));
43
+ if (!flags['parent-id']) {
44
+ return cv;
45
+ }
46
+ const CDLReq = {
47
+ ContentDocumentId: cv.ContentDocumentId,
48
+ LinkedEntityId: flags['parent-id'],
49
+ ShareType: 'V',
50
+ };
51
+ try {
52
+ const CDLCreateResult = await conn.sobject('ContentDocumentLink').create(CDLReq);
53
+ if (CDLCreateResult.success) {
54
+ this.logSuccess(messages.getMessage('attachSuccess', [flags['parent-id']]));
55
+ return cv;
56
+ }
57
+ else {
58
+ throw SfError.create({
59
+ message: messages.getMessage('attachFailure'),
60
+ data: CDLCreateResult.errors,
61
+ });
62
+ }
63
+ }
64
+ catch (e) {
65
+ const error = SfError.wrap(e);
66
+ if (error.name === 'INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY') {
67
+ error.actions = messages.getMessages('insufficientAccessActions');
68
+ }
69
+ throw error;
70
+ }
71
+ }
72
+ }
73
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.js","sourceRoot":"","sources":["../../../../src/commands/data/create/file.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,53 @@
1
+ # summary
2
+
3
+ Upload a local file to an org.
4
+
5
+ # description
6
+
7
+ This command always creates a new file in the org; you can't update an existing file. After a successful upload, the command displays the ID of the new ContentDocument record which represents the uploaded file.
8
+
9
+ By default, the uploaded file isn't attached to a record; in the Salesforce UI the file shows up in the Files tab. You can optionally attach the file to an existing record, such as an account, as long as you know its record ID.
10
+
11
+ You can also give the file a new name after it's been uploaded; by default its name in the org is the same as the local file name.
12
+
13
+ # flags.title.summary
14
+
15
+ New title given to the file (ContentDocument) after it's uploaded.
16
+
17
+ # examples
18
+
19
+ - Upload the local file "resources/astro.png" to your default org:
20
+
21
+ <%= config.bin %> <%= command.id %> --file resources/astro.png
22
+
23
+ - Give the file a different filename after it's uploaded to the org with alias "my-scratch":
24
+
25
+ <%= config.bin %> <%= command.id %> --file resources/astro.png --title AstroOnABoat.png --target-org my-scratch
26
+
27
+ - Attach the file to a record in the org:
28
+
29
+ <%= config.bin %> <%= command.id %> --file path/to/astro.png --parent-id a03fakeLoJWPIA3
30
+
31
+ # flags.file.summary
32
+
33
+ Path of file to upload.
34
+
35
+ # flags.parent-id.summary
36
+
37
+ ID of the record to attach the file to.
38
+
39
+ # createSuccess
40
+
41
+ Created file with ContentDocumentId %s.
42
+
43
+ # attachSuccess
44
+
45
+ File attached to record with ID %s.
46
+
47
+ # attachFailure
48
+
49
+ The file was successfully uploaded, but we weren't able to attach it to the record.
50
+
51
+ # insufficientAccessActions
52
+
53
+ - Check that the record ID is correct and that you have access to it.