@salesforce/plugin-data 3.5.2 → 3.5.3
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 +39 -127
- package/lib/commands/data/export/{beta → legacy}/tree.js +11 -8
- package/lib/commands/data/export/legacy/tree.js.map +1 -0
- package/lib/commands/data/export/tree.js +10 -7
- package/lib/commands/data/export/tree.js.map +1 -1
- package/lib/commands/data/import/legacy/tree.js +85 -0
- package/lib/commands/data/import/legacy/tree.js.map +1 -0
- package/lib/commands/data/import/tree.js +10 -40
- package/lib/commands/data/import/tree.js.map +1 -1
- package/lib/commands/data/query.js +4 -4
- package/lib/commands/data/query.js.map +1 -1
- package/lib/commands/data/resume.js +0 -5
- package/lib/commands/data/resume.js.map +1 -1
- package/messages/tree.export.md +9 -1
- package/messages/tree.import.legacy.md +60 -0
- package/messages/tree.import.md +11 -24
- package/oclif.manifest.json +438 -383
- package/package.json +9 -9
- package/lib/commands/data/export/beta/tree.js.map +0 -1
- package/lib/commands/data/import/beta/tree.js +0 -52
- package/lib/commands/data/import/beta/tree.js.map +0 -1
- package/messages/tree.import.beta.md +0 -43
package/README.md
CHANGED
|
@@ -81,10 +81,8 @@ sf plugins
|
|
|
81
81
|
- [`sf data delete bulk`](#sf-data-delete-bulk)
|
|
82
82
|
- [`sf data delete record`](#sf-data-delete-record)
|
|
83
83
|
- [`sf data delete resume`](#sf-data-delete-resume)
|
|
84
|
-
- [`sf data export beta tree`](#sf-data-export-beta-tree)
|
|
85
84
|
- [`sf data export tree`](#sf-data-export-tree)
|
|
86
85
|
- [`sf data get record`](#sf-data-get-record)
|
|
87
|
-
- [`sf data import beta tree`](#sf-data-import-beta-tree)
|
|
88
86
|
- [`sf data import tree`](#sf-data-import-tree)
|
|
89
87
|
- [`sf data query`](#sf-data-query)
|
|
90
88
|
- [`sf data query resume`](#sf-data-query-resume)
|
|
@@ -143,7 +141,7 @@ EXAMPLES
|
|
|
143
141
|
$ sf data create file --file path/to/astro.png --parent-id a03fakeLoJWPIA3
|
|
144
142
|
```
|
|
145
143
|
|
|
146
|
-
_See code: [src/commands/data/create/file.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
144
|
+
_See code: [src/commands/data/create/file.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/create/file.ts)_
|
|
147
145
|
|
|
148
146
|
## `sf data create record`
|
|
149
147
|
|
|
@@ -199,7 +197,7 @@ EXAMPLES
|
|
|
199
197
|
TracedEntityId=01p17000000R6bLAAS"
|
|
200
198
|
```
|
|
201
199
|
|
|
202
|
-
_See code: [src/commands/data/create/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
200
|
+
_See code: [src/commands/data/create/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/create/record.ts)_
|
|
203
201
|
|
|
204
202
|
## `sf data delete bulk`
|
|
205
203
|
|
|
@@ -257,7 +255,7 @@ FLAG DESCRIPTIONS
|
|
|
257
255
|
and can be enabled only by a system administrator.
|
|
258
256
|
```
|
|
259
257
|
|
|
260
|
-
_See code: [src/commands/data/delete/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
258
|
+
_See code: [src/commands/data/delete/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/delete/bulk.ts)_
|
|
261
259
|
|
|
262
260
|
## `sf data delete record`
|
|
263
261
|
|
|
@@ -318,7 +316,7 @@ EXAMPLES
|
|
|
318
316
|
$ sf data delete record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
|
|
319
317
|
```
|
|
320
318
|
|
|
321
|
-
_See code: [src/commands/data/delete/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
319
|
+
_See code: [src/commands/data/delete/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/delete/record.ts)_
|
|
322
320
|
|
|
323
321
|
## `sf data delete resume`
|
|
324
322
|
|
|
@@ -357,65 +355,7 @@ EXAMPLES
|
|
|
357
355
|
$ sf data delete resume --use-most-recent --target-org my-scratch
|
|
358
356
|
```
|
|
359
357
|
|
|
360
|
-
_See code: [src/commands/data/delete/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
361
|
-
|
|
362
|
-
## `sf data export beta tree`
|
|
363
|
-
|
|
364
|
-
Export data from an org into one or more JSON files.
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
USAGE
|
|
368
|
-
$ sf data export beta tree -o <value> -q <value> [--json] [--flags-dir <value>] [--api-version <value>] [-p] [-x <value>]
|
|
369
|
-
[-d <value>]
|
|
370
|
-
|
|
371
|
-
FLAGS
|
|
372
|
-
-d, --output-dir=<value> Directory in which to generate the JSON files; default is current directory.
|
|
373
|
-
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
374
|
-
configuration variable is already set.
|
|
375
|
-
-p, --plan Generate multiple sObject tree files and a plan definition file for aggregated import.
|
|
376
|
-
-q, --query=<value> (required) SOQL query, or filepath of a file that contains the query, to retrieve records.
|
|
377
|
-
-x, --prefix=<value> Prefix of generated files.
|
|
378
|
-
--api-version=<value> Override the api version used for api requests made by this command
|
|
379
|
-
|
|
380
|
-
GLOBAL FLAGS
|
|
381
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
382
|
-
--json Format output as json.
|
|
383
|
-
|
|
384
|
-
DESCRIPTION
|
|
385
|
-
Export data from an org into one or more JSON files.
|
|
386
|
-
|
|
387
|
-
Specify a SOQL query, either directly at the command line or read from a file, to retrieve the data you want to
|
|
388
|
-
export. The exported data is written to JSON files in sObject tree format, which is a collection of nested,
|
|
389
|
-
parent-child records with a single root record. Use these JSON files to import data into an org with the "sf data
|
|
390
|
-
import tree" command.
|
|
391
|
-
|
|
392
|
-
If your SOQL query references multiple objects, the command generates a single JSON file by default. You can specify
|
|
393
|
-
the --plan flag to generate separate JSON files for each object and a plan definition file that aggregates them. You
|
|
394
|
-
then specify just this plan definition file when you import the data into an org.
|
|
395
|
-
|
|
396
|
-
The SOQL query can return a maximum of 2,000 records. For more information, see the REST API Developer Guide.
|
|
397
|
-
(https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm).
|
|
398
|
-
|
|
399
|
-
EXAMPLES
|
|
400
|
-
Export records retrieved with the specified SOQL query into a single JSON file in the current directory; the command
|
|
401
|
-
uses your default org:
|
|
402
|
-
|
|
403
|
-
$ sf data export beta tree --query "SELECT Id, Name, (SELECT Name, Address__c FROM Properties__r) FROM \
|
|
404
|
-
Broker__c"
|
|
405
|
-
|
|
406
|
-
Export data using a SOQL query in the "query.txt" file and generate JSON files for each object and a plan that
|
|
407
|
-
aggregates them:
|
|
408
|
-
|
|
409
|
-
$ sf data export beta tree --query query.txt --plan
|
|
410
|
-
|
|
411
|
-
Prepend "export-demo" before each generated file and generate the files in the "export-out" directory; run the
|
|
412
|
-
command on the org with alias "my-scratch":
|
|
413
|
-
|
|
414
|
-
$ sf data export beta tree --query query.txt --plan --prefix export-demo --output-dir export-out --target-org \
|
|
415
|
-
my-scratch
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
_See code: [src/commands/data/export/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.2/src/commands/data/export/beta/tree.ts)_
|
|
358
|
+
_See code: [src/commands/data/delete/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/delete/resume.ts)_
|
|
419
359
|
|
|
420
360
|
## `sf data export tree`
|
|
421
361
|
|
|
@@ -456,12 +396,13 @@ DESCRIPTION
|
|
|
456
396
|
|
|
457
397
|
ALIASES
|
|
458
398
|
$ sf force data tree export
|
|
399
|
+
$ sf data export beta tree
|
|
459
400
|
|
|
460
401
|
EXAMPLES
|
|
461
402
|
Export records retrieved with the specified SOQL query into a single JSON file in the current directory; the command
|
|
462
403
|
uses your default org:
|
|
463
404
|
|
|
464
|
-
$ sf data export tree --query "SELECT Id, Name, (SELECT Name,
|
|
405
|
+
$ sf data export tree --query "SELECT Id, Name, (SELECT Name, Address**c FROM Properties**r) FROM Broker\_\_c"
|
|
465
406
|
|
|
466
407
|
Export data using a SOQL query in the "query.txt" file and generate JSON files for each object and a plan that
|
|
467
408
|
aggregates them:
|
|
@@ -475,7 +416,7 @@ EXAMPLES
|
|
|
475
416
|
my-scratch
|
|
476
417
|
```
|
|
477
418
|
|
|
478
|
-
_See code: [src/commands/data/export/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
419
|
+
_See code: [src/commands/data/export/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/export/tree.ts)_
|
|
479
420
|
|
|
480
421
|
## `sf data get record`
|
|
481
422
|
|
|
@@ -539,51 +480,7 @@ EXAMPLES
|
|
|
539
480
|
$ sf data get record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
|
|
540
481
|
```
|
|
541
482
|
|
|
542
|
-
_See code: [src/commands/data/get/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
543
|
-
|
|
544
|
-
## `sf data import beta tree`
|
|
545
|
-
|
|
546
|
-
Import data from one or more JSON files into an org.
|
|
547
|
-
|
|
548
|
-
```
|
|
549
|
-
USAGE
|
|
550
|
-
$ sf data import beta tree -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-f <value>...] [-p
|
|
551
|
-
<value>]
|
|
552
|
-
|
|
553
|
-
FLAGS
|
|
554
|
-
-f, --files=<value>... Comma-separated and in-order JSON files that contain the records, in sObject tree format,
|
|
555
|
-
that you want to insert.
|
|
556
|
-
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
557
|
-
configuration variable is already set.
|
|
558
|
-
-p, --plan=<value> Plan definition file to insert multiple data files.
|
|
559
|
-
--api-version=<value> Override the api version used for api requests made by this command
|
|
560
|
-
|
|
561
|
-
GLOBAL FLAGS
|
|
562
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
563
|
-
--json Format output as json.
|
|
564
|
-
|
|
565
|
-
DESCRIPTION
|
|
566
|
-
Import data from one or more JSON files into an org.
|
|
567
|
-
|
|
568
|
-
The JSON files that contain the data are in sObject tree format, which is a collection of nested, parent-child records
|
|
569
|
-
with a single root record. Use the "sf data export tree" command to generate these JSON files.
|
|
570
|
-
|
|
571
|
-
If you used the --plan flag when exporting the data to generate a plan definition file, use the --plan flag to
|
|
572
|
-
reference the file when you import. If you're not using a plan, use the --files flag to list the files. If you specify
|
|
573
|
-
multiple JSON files that depend on each other in a parent-child relationship, be sure you list them in the correct
|
|
574
|
-
order.
|
|
575
|
-
|
|
576
|
-
EXAMPLES
|
|
577
|
-
Import the records contained in two JSON files into the org with alias "my-scratch":
|
|
578
|
-
|
|
579
|
-
$ sf data import beta tree --files Contact.json,Account.json --target-org my-scratch
|
|
580
|
-
|
|
581
|
-
Import records using a plan definition file into your default org:
|
|
582
|
-
|
|
583
|
-
$ sf data import beta tree --plan Account-Contact-plan.json
|
|
584
|
-
```
|
|
585
|
-
|
|
586
|
-
_See code: [src/commands/data/import/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.2/src/commands/data/import/beta/tree.ts)_
|
|
483
|
+
_See code: [src/commands/data/get/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/get/record.ts)_
|
|
587
484
|
|
|
588
485
|
## `sf data import tree`
|
|
589
486
|
|
|
@@ -591,7 +488,7 @@ Import data from one or more JSON files into an org.
|
|
|
591
488
|
|
|
592
489
|
```
|
|
593
490
|
USAGE
|
|
594
|
-
$ sf data import tree -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-f <value>...
|
|
491
|
+
$ sf data import tree -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-f <value>...] [-p <value>]
|
|
595
492
|
|
|
596
493
|
FLAGS
|
|
597
494
|
-f, --files=<value>... Comma-separated and in-order JSON files that contain the records, in sObject tree format,
|
|
@@ -616,12 +513,9 @@ DESCRIPTION
|
|
|
616
513
|
multiple JSON files that depend on each other in a parent-child relationship, be sure you list them in the correct
|
|
617
514
|
order.
|
|
618
515
|
|
|
619
|
-
The sObject Tree API supports requests that contain up to 200 records. For more information, see the REST API
|
|
620
|
-
Developer Guide.
|
|
621
|
-
(https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm)
|
|
622
|
-
|
|
623
516
|
ALIASES
|
|
624
517
|
$ sf force data tree import
|
|
518
|
+
$ sf data import beta tree
|
|
625
519
|
|
|
626
520
|
EXAMPLES
|
|
627
521
|
Import the records contained in two JSON files into the org with alias "my-scratch":
|
|
@@ -631,9 +525,27 @@ EXAMPLES
|
|
|
631
525
|
Import records using a plan definition file into your default org:
|
|
632
526
|
|
|
633
527
|
$ sf data import tree --plan Account-Contact-plan.json
|
|
528
|
+
|
|
529
|
+
FLAG DESCRIPTIONS
|
|
530
|
+
-p, --plan=<value> Plan definition file to insert multiple data files.
|
|
531
|
+
|
|
532
|
+
Unlike when you use the `--files` flag, the files listed in the plan definition file **can** contain more then 200
|
|
533
|
+
records. When the CLI executes the import, it automatically batches the records to comply with the 200 record limit
|
|
534
|
+
set by the API.
|
|
535
|
+
|
|
536
|
+
The order in which you list the files in the plan definition file matters. Specifically, records with lookups to
|
|
537
|
+
records in another file should be listed AFTER that file. For example, let's say you're loading Account and Contact
|
|
538
|
+
records, and the contacts have references to those accounts. Be sure you list the Accounts file before the Contacts
|
|
539
|
+
file.
|
|
540
|
+
|
|
541
|
+
The plan definition file has the following schema:
|
|
542
|
+
|
|
543
|
+
- items(object) - SObject Type: Definition of records to be insert per SObject Type
|
|
544
|
+
- sobject(string) - Name of SObject: Child file references must have SObject roots of this type
|
|
545
|
+
- files(array) - Files: An array of files paths to load
|
|
634
546
|
```
|
|
635
547
|
|
|
636
|
-
_See code: [src/commands/data/import/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
548
|
+
_See code: [src/commands/data/import/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/import/tree.ts)_
|
|
637
549
|
|
|
638
550
|
## `sf data query`
|
|
639
551
|
|
|
@@ -697,7 +609,7 @@ EXAMPLES
|
|
|
697
609
|
$ sf data query --query "SELECT Id FROM Contact" --bulk --wait 0
|
|
698
610
|
```
|
|
699
611
|
|
|
700
|
-
_See code: [src/commands/data/query.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
612
|
+
_See code: [src/commands/data/query.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/query.ts)_
|
|
701
613
|
|
|
702
614
|
## `sf data query resume`
|
|
703
615
|
|
|
@@ -735,7 +647,7 @@ EXAMPLES
|
|
|
735
647
|
$ sf data query resume --bulk-query-id 7500x000005BdFzXXX
|
|
736
648
|
```
|
|
737
649
|
|
|
738
|
-
_See code: [src/commands/data/query/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
650
|
+
_See code: [src/commands/data/query/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/query/resume.ts)_
|
|
739
651
|
|
|
740
652
|
## `sf data resume`
|
|
741
653
|
|
|
@@ -772,7 +684,7 @@ EXAMPLES
|
|
|
772
684
|
$ sf data resume --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA
|
|
773
685
|
```
|
|
774
686
|
|
|
775
|
-
_See code: [src/commands/data/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
687
|
+
_See code: [src/commands/data/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/resume.ts)_
|
|
776
688
|
|
|
777
689
|
## `sf data update record`
|
|
778
690
|
|
|
@@ -834,7 +746,7 @@ EXAMPLES
|
|
|
834
746
|
"ExpirationDate=2017-12-01T00:58:04.000+0000"
|
|
835
747
|
```
|
|
836
748
|
|
|
837
|
-
_See code: [src/commands/data/update/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
749
|
+
_See code: [src/commands/data/update/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/update/record.ts)_
|
|
838
750
|
|
|
839
751
|
## `sf data upsert bulk`
|
|
840
752
|
|
|
@@ -887,7 +799,7 @@ EXAMPLES
|
|
|
887
799
|
my-scratch
|
|
888
800
|
```
|
|
889
801
|
|
|
890
|
-
_See code: [src/commands/data/upsert/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
802
|
+
_See code: [src/commands/data/upsert/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/upsert/bulk.ts)_
|
|
891
803
|
|
|
892
804
|
## `sf data upsert resume`
|
|
893
805
|
|
|
@@ -926,7 +838,7 @@ EXAMPLES
|
|
|
926
838
|
$ sf data upsert resume --use-most-recent --target-org my-scratch
|
|
927
839
|
```
|
|
928
840
|
|
|
929
|
-
_See code: [src/commands/data/upsert/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
841
|
+
_See code: [src/commands/data/upsert/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/data/upsert/resume.ts)_
|
|
930
842
|
|
|
931
843
|
## `sf force data bulk delete`
|
|
932
844
|
|
|
@@ -973,7 +885,7 @@ EXAMPLES
|
|
|
973
885
|
$ sf force data bulk delete --sobject MyObject__c --file files/delete.csv --wait 5 --target-org my-scratch
|
|
974
886
|
```
|
|
975
887
|
|
|
976
|
-
_See code: [src/commands/force/data/bulk/delete.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
888
|
+
_See code: [src/commands/force/data/bulk/delete.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/force/data/bulk/delete.ts)_
|
|
977
889
|
|
|
978
890
|
## `sf force data bulk status`
|
|
979
891
|
|
|
@@ -1010,7 +922,7 @@ EXAMPLES
|
|
|
1010
922
|
$ sf force data bulk status --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA --target-org my-scratch
|
|
1011
923
|
```
|
|
1012
924
|
|
|
1013
|
-
_See code: [src/commands/force/data/bulk/status.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
925
|
+
_See code: [src/commands/force/data/bulk/status.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/force/data/bulk/status.ts)_
|
|
1014
926
|
|
|
1015
927
|
## `sf force data bulk upsert`
|
|
1016
928
|
|
|
@@ -1068,6 +980,6 @@ EXAMPLES
|
|
|
1068
980
|
--target-org my-scratch
|
|
1069
981
|
```
|
|
1070
982
|
|
|
1071
|
-
_See code: [src/commands/force/data/bulk/upsert.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.
|
|
983
|
+
_See code: [src/commands/force/data/bulk/upsert.ts](https://github.com/salesforcecli/plugin-data/blob/3.5.3/src/commands/force/data/bulk/upsert.ts)_
|
|
1072
984
|
|
|
1073
985
|
<!-- commandsstop -->
|
|
@@ -6,16 +6,20 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Messages } from '@salesforce/core';
|
|
8
8
|
import { SfCommand, Flags, Ux } from '@salesforce/sf-plugins-core';
|
|
9
|
-
import { orgFlags
|
|
10
|
-
import {
|
|
9
|
+
import { orgFlags } from '../../../../flags.js';
|
|
10
|
+
import { ExportApi } from '../../../../api/data/tree/exportApi.js';
|
|
11
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
12
|
const messages = Messages.loadMessages('@salesforce/plugin-data', 'tree.export');
|
|
13
13
|
export default class Export extends SfCommand {
|
|
14
14
|
static summary = messages.getMessage('summary');
|
|
15
15
|
static description = messages.getMessage('description');
|
|
16
16
|
static examples = messages.getMessages('examples');
|
|
17
|
-
|
|
18
|
-
static state = '
|
|
17
|
+
static hidden = true;
|
|
18
|
+
static state = 'deprecated';
|
|
19
|
+
static deprecationOptions = {
|
|
20
|
+
to: 'data tree export',
|
|
21
|
+
message: messages.getMessage('LegacyDeprecation'),
|
|
22
|
+
};
|
|
19
23
|
static flags = {
|
|
20
24
|
...orgFlags,
|
|
21
25
|
query: Flags.string({
|
|
@@ -30,7 +34,6 @@ export default class Export extends SfCommand {
|
|
|
30
34
|
prefix: Flags.string({
|
|
31
35
|
char: 'x',
|
|
32
36
|
summary: messages.getMessage('flags.prefix.summary'),
|
|
33
|
-
parse: prefixValidation,
|
|
34
37
|
}),
|
|
35
38
|
'output-dir': Flags.directory({
|
|
36
39
|
char: 'd',
|
|
@@ -41,15 +44,15 @@ export default class Export extends SfCommand {
|
|
|
41
44
|
};
|
|
42
45
|
async run() {
|
|
43
46
|
const { flags } = await this.parse(Export);
|
|
47
|
+
const ux = new Ux({ jsonEnabled: this.jsonEnabled() });
|
|
48
|
+
const exportApi = new ExportApi(flags['target-org'], ux);
|
|
44
49
|
const exportConfig = {
|
|
45
50
|
outputDir: flags['output-dir'],
|
|
46
51
|
plan: flags.plan,
|
|
47
52
|
prefix: flags.prefix,
|
|
48
53
|
query: flags.query,
|
|
49
|
-
conn: flags['target-org'].getConnection(flags['api-version']),
|
|
50
|
-
ux: new Ux({ jsonEnabled: this.jsonEnabled() }),
|
|
51
54
|
};
|
|
52
|
-
return
|
|
55
|
+
return exportApi.export(exportConfig);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../../src/commands/data/export/legacy/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAgB,MAAM,wCAAwC,CAAC;AAGjF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,C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G;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;QACzD,MAAM,YAAY,GAAiB;YACjC,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;YAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC;QACF,OAAO,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC"}
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Messages } from '@salesforce/core';
|
|
8
8
|
import { SfCommand, Flags, Ux } from '@salesforce/sf-plugins-core';
|
|
9
|
-
import { orgFlags } from '../../../flags.js';
|
|
10
|
-
import {
|
|
9
|
+
import { orgFlags, prefixValidation } from '../../../flags.js';
|
|
10
|
+
import { runExport } from '../../../export.js';
|
|
11
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
12
|
const messages = Messages.loadMessages('@salesforce/plugin-data', 'tree.export');
|
|
13
13
|
export default class Export extends SfCommand {
|
|
14
14
|
static summary = messages.getMessage('summary');
|
|
15
15
|
static description = messages.getMessage('description');
|
|
16
16
|
static examples = messages.getMessages('examples');
|
|
17
|
-
static aliases = ['force:data:tree:export'];
|
|
17
|
+
static aliases = ['force:data:tree:export', 'data:export:beta:tree'];
|
|
18
18
|
static deprecateAliases = true;
|
|
19
19
|
static flags = {
|
|
20
20
|
...orgFlags,
|
|
@@ -30,6 +30,7 @@ export default class Export extends SfCommand {
|
|
|
30
30
|
prefix: Flags.string({
|
|
31
31
|
char: 'x',
|
|
32
32
|
summary: messages.getMessage('flags.prefix.summary'),
|
|
33
|
+
parse: prefixValidation,
|
|
33
34
|
}),
|
|
34
35
|
'output-dir': Flags.directory({
|
|
35
36
|
char: 'd',
|
|
@@ -39,17 +40,19 @@ export default class Export extends SfCommand {
|
|
|
39
40
|
}),
|
|
40
41
|
};
|
|
41
42
|
async run() {
|
|
42
|
-
this.info('Try the the new "sf data export beta tree" command. It support SOQL queries with up to 5 levels of objects!');
|
|
43
43
|
const { flags } = await this.parse(Export);
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (flags.plan) {
|
|
45
|
+
this.warn(messages.getMessage('PlanJsonWarning'));
|
|
46
|
+
}
|
|
46
47
|
const exportConfig = {
|
|
47
48
|
outputDir: flags['output-dir'],
|
|
48
49
|
plan: flags.plan,
|
|
49
50
|
prefix: flags.prefix,
|
|
50
51
|
query: flags.query,
|
|
52
|
+
conn: flags['target-org'].getConnection(flags['api-version']),
|
|
53
|
+
ux: new Ux({ jsonEnabled: this.jsonEnabled() }),
|
|
51
54
|
};
|
|
52
|
-
return
|
|
55
|
+
return runExport(exportConfig);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
//# sourceMappingURL=tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../src/commands/data/export/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../src/commands/data/export/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,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ACxB,CAAC;QACF,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;YAC5B,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;YACxD,OAAO,EAAE,CAAC,WAAW,CAAC;YACtB,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,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,YAAY,GAAiB;YACjC,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;YAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC7D,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;SAChD,CAAC;QACF,OAAO,SAAS,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { Messages } from '@salesforce/core';
|
|
8
|
+
import { getString } from '@salesforce/ts-types';
|
|
9
|
+
import { SfCommand, Flags, arrayWithDeprecation } from '@salesforce/sf-plugins-core';
|
|
10
|
+
import { ImportApi } from '../../../../api/data/tree/importApi.js';
|
|
11
|
+
import { orgFlags } from '../../../../flags.js';
|
|
12
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
|
+
const messages = Messages.loadMessages('@salesforce/plugin-data', 'tree.import.legacy');
|
|
14
|
+
/**
|
|
15
|
+
* Command that provides data import capability via the SObject Tree Save API.
|
|
16
|
+
*/
|
|
17
|
+
export default class Import extends SfCommand {
|
|
18
|
+
static summary = messages.getMessage('summary');
|
|
19
|
+
static description = messages.getMessage('description');
|
|
20
|
+
static examples = messages.getMessages('examples');
|
|
21
|
+
static hidden = true;
|
|
22
|
+
static state = 'deprecated';
|
|
23
|
+
static deprecationOptions = {
|
|
24
|
+
message: messages.getMessage('deprecation'),
|
|
25
|
+
};
|
|
26
|
+
static flags = {
|
|
27
|
+
...orgFlags,
|
|
28
|
+
files: arrayWithDeprecation({
|
|
29
|
+
char: 'f',
|
|
30
|
+
summary: messages.getMessage('flags.files.summary'),
|
|
31
|
+
exclusive: ['plan'],
|
|
32
|
+
aliases: ['sobjecttreefiles'],
|
|
33
|
+
deprecateAliases: true,
|
|
34
|
+
}),
|
|
35
|
+
plan: Flags.file({
|
|
36
|
+
char: 'p',
|
|
37
|
+
summary: messages.getMessage('flags.plan.summary'),
|
|
38
|
+
exists: true,
|
|
39
|
+
}),
|
|
40
|
+
'content-type': Flags.string({
|
|
41
|
+
char: 'c',
|
|
42
|
+
summary: messages.getMessage('flags.content-type.summary'),
|
|
43
|
+
hidden: true,
|
|
44
|
+
aliases: ['contenttype'],
|
|
45
|
+
deprecateAliases: true,
|
|
46
|
+
deprecated: { message: messages.getMessage('flags.content-type.deprecation') },
|
|
47
|
+
}),
|
|
48
|
+
// displays the schema for a data import plan
|
|
49
|
+
'config-help': Flags.boolean({
|
|
50
|
+
summary: messages.getMessage('flags.config-help.summary'),
|
|
51
|
+
aliases: ['confighelp'],
|
|
52
|
+
deprecateAliases: true,
|
|
53
|
+
hidden: true,
|
|
54
|
+
deprecated: { message: messages.getMessage('flags.config-help.deprecation') },
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
async run() {
|
|
58
|
+
const { flags } = await this.parse(Import);
|
|
59
|
+
const importApi = new ImportApi(flags['target-org']);
|
|
60
|
+
if (flags['config-help']) {
|
|
61
|
+
// Display config help and return
|
|
62
|
+
const schema = importApi.getSchema();
|
|
63
|
+
this.log(messages.getMessage('schema-help'));
|
|
64
|
+
return schema;
|
|
65
|
+
}
|
|
66
|
+
const importConfig = {
|
|
67
|
+
sobjectTreeFiles: flags.files,
|
|
68
|
+
contentType: flags['content-type'],
|
|
69
|
+
plan: flags.plan,
|
|
70
|
+
};
|
|
71
|
+
const importResults = await importApi.import(importConfig);
|
|
72
|
+
const processedResult = (importResults.responseRefs ?? []).map((ref) => {
|
|
73
|
+
const type = getString(importResults.sobjectTypes, ref.referenceId, 'Unknown');
|
|
74
|
+
return { refId: ref.referenceId, type, id: ref.id };
|
|
75
|
+
});
|
|
76
|
+
this.styledHeader('Import Results');
|
|
77
|
+
this.table(processedResult, {
|
|
78
|
+
refId: { header: 'Reference ID' },
|
|
79
|
+
type: { header: 'Type' },
|
|
80
|
+
id: { header: 'ID' },
|
|
81
|
+
});
|
|
82
|
+
return processedResult;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../../src/commands/data/import/legacy/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAW,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,SAAS,EAAgB,MAAM,wCAAwC,CAAC;AACjF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AAC,GAAG,EAAE,EAAE;YACrF,MAAM,IAAI,GAAG,SAAS,CAAC,aAAa,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;YAC/E,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE;YAC1B,KAAK,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;YACjC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;YACxB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACrB,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACzB,CAAC"}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
6
|
*/
|
|
7
7
|
import { Messages } from '@salesforce/core';
|
|
8
|
-
import { getString } from '@salesforce/ts-types';
|
|
9
8
|
import { SfCommand, Flags, arrayWithDeprecation } from '@salesforce/sf-plugins-core';
|
|
10
|
-
import {
|
|
9
|
+
import { importFromPlan } from '../../../api/data/tree/importPlan.js';
|
|
10
|
+
import { importFromFiles } from '../../../api/data/tree/importFiles.js';
|
|
11
11
|
import { orgFlags } from '../../../flags.js';
|
|
12
12
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
13
|
const messages = Messages.loadMessages('@salesforce/plugin-data', 'tree.import');
|
|
@@ -18,66 +18,36 @@ export default class Import extends SfCommand {
|
|
|
18
18
|
static summary = messages.getMessage('summary');
|
|
19
19
|
static description = messages.getMessage('description');
|
|
20
20
|
static examples = messages.getMessages('examples');
|
|
21
|
-
static aliases = ['force:data:tree:import'];
|
|
21
|
+
static aliases = ['force:data:tree:import', 'data:import:beta:tree'];
|
|
22
22
|
static deprecateAliases = true;
|
|
23
23
|
static flags = {
|
|
24
24
|
...orgFlags,
|
|
25
25
|
files: arrayWithDeprecation({
|
|
26
26
|
char: 'f',
|
|
27
27
|
summary: messages.getMessage('flags.files.summary'),
|
|
28
|
-
|
|
28
|
+
exactlyOne: ['files', 'plan'],
|
|
29
29
|
aliases: ['sobjecttreefiles'],
|
|
30
30
|
deprecateAliases: true,
|
|
31
31
|
}),
|
|
32
32
|
plan: Flags.file({
|
|
33
33
|
char: 'p',
|
|
34
34
|
summary: messages.getMessage('flags.plan.summary'),
|
|
35
|
+
description: messages.getMessage('flags.plan.description'),
|
|
36
|
+
exactlyOne: ['files', 'plan'],
|
|
35
37
|
exists: true,
|
|
36
38
|
}),
|
|
37
|
-
'content-type': Flags.string({
|
|
38
|
-
char: 'c',
|
|
39
|
-
summary: messages.getMessage('flags.content-type.summary'),
|
|
40
|
-
hidden: true,
|
|
41
|
-
aliases: ['contenttype'],
|
|
42
|
-
deprecateAliases: true,
|
|
43
|
-
deprecated: { message: messages.getMessage('flags.content-type.deprecation') },
|
|
44
|
-
}),
|
|
45
|
-
// displays the schema for a data import plan
|
|
46
|
-
'config-help': Flags.boolean({
|
|
47
|
-
summary: messages.getMessage('flags.config-help.summary'),
|
|
48
|
-
aliases: ['confighelp'],
|
|
49
|
-
deprecateAliases: true,
|
|
50
|
-
hidden: true,
|
|
51
|
-
deprecated: { message: messages.getMessage('flags.config-help.deprecation') },
|
|
52
|
-
}),
|
|
53
39
|
};
|
|
54
40
|
async run() {
|
|
55
41
|
const { flags } = await this.parse(Import);
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
// Display config help and return
|
|
59
|
-
const schema = importApi.getSchema();
|
|
60
|
-
this.log(messages.getMessage('schema-help'));
|
|
61
|
-
return schema;
|
|
62
|
-
}
|
|
63
|
-
const importConfig = {
|
|
64
|
-
sobjectTreeFiles: flags.files,
|
|
65
|
-
contentType: flags['content-type'],
|
|
66
|
-
plan: flags.plan,
|
|
67
|
-
};
|
|
68
|
-
const importResults = await importApi.import(importConfig);
|
|
69
|
-
const processedResult = (importResults.responseRefs ?? []).map((ref) => {
|
|
70
|
-
const type = getString(importResults.sobjectTypes, ref.referenceId, 'Unknown');
|
|
71
|
-
return { refId: ref.referenceId, type, id: ref.id };
|
|
72
|
-
});
|
|
42
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
43
|
+
const results = flags.plan ? await importFromPlan(conn, flags.plan) : await importFromFiles(conn, flags.files);
|
|
73
44
|
this.styledHeader('Import Results');
|
|
74
|
-
this.table(
|
|
45
|
+
this.table(results, {
|
|
75
46
|
refId: { header: 'Reference ID' },
|
|
76
47
|
type: { header: 'Type' },
|
|
77
48
|
id: { header: 'ID' },
|
|
78
49
|
});
|
|
79
|
-
|
|
80
|
-
return processedResult;
|
|
50
|
+
return results;
|
|
81
51
|
}
|
|
82
52
|
}
|
|
83
53
|
//# sourceMappingURL=tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../src/commands/data/import/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../src/commands/data/import/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,QAAQ,CAAC,kCAAkC,CAAC,MA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