Skip to content

Commit 86232c1

Browse files
authored
Merge pull request #7 from salesforcecli/ew/generate
Generate, migrage, and report commands
2 parents 4e4a198 + 2099082 commit 86232c1

36 files changed

+3042
-198
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ node_modules
4747
# os specific files
4848
.DS_Store
4949
.idea
50+
51+
52+
# Temp
53+
ignore/

README.md

Lines changed: 162 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ git clone git@github.com:salesforcecli/plugin-data-seeding
8787
yarn && yarn build
8888
```
8989

90-
To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
90+
To use your plugin, run using the local `./bin/dev.js` or `./bin/dev.cmd` file.
9191

9292
```bash
9393
# Run using local run file.
94-
./bin/dev hello world
94+
./bin/dev.js data-seeding generate
9595
```
9696

9797
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
@@ -107,43 +107,188 @@ sf plugins
107107

108108
<!-- commands -->
109109

110-
- [`sf hello world`](#sf-hello-world)
110+
- [`sf data-seeding generate`](#sf-data-seeding-generate)
111+
- [`sf data-seeding generate report`](#sf-data-seeding-generate-report)
112+
- [`sf data-seeding migrate`](#sf-data-seeding-migrate)
113+
- [`sf data-seeding migrate report`](#sf-data-seeding-migrate-report)
111114

112-
## `sf hello world`
115+
## `sf data-seeding generate`
113116

114-
Say hello.
117+
Generate synthetic org data that mimics existing data in a source org, and then load it into a separate target org.
115118

116119
```
117120
USAGE
118-
$ sf hello world [--json] [--flags-dir <value>] [-n <value>]
121+
$ sf data-seeding generate -o <value> -s <value> -f <value> [--json] [--flags-dir <value>] [-w <value> | --async]
119122
120123
FLAGS
121-
-n, --name=<value> [default: World] The name of the person you'd like to say hello to.
124+
-f, --config-file=<value> (required) Path to the data seeding JSON configuration file.
125+
-o, --target-org=<value> (required) Username or alias of the target org into which the generated data will be
126+
loaded.
127+
-s, --source-org=<value> (required) Username or alias of the source org that contains the data that AI will mimic.
128+
-w, --wait=<value> [default: 33 minutes] Number of minutes to wait for the command to complete; when reached,
129+
the command completes asynchronously if necessary.
130+
--async Run the command asynchronously and immediately return control of the terminal.
122131
123132
GLOBAL FLAGS
124133
--flags-dir=<value> Import flag values from a directory.
125134
--json Format output as json.
126135
127136
DESCRIPTION
128-
Say hello.
137+
Generate synthetic org data that mimics existing data in a source org, and then load it into a separate target org.
129138
130-
Say hello either to the world or someone you know.
139+
This command uses AI to generate synthetic (or "fake") data that has a similar format to selected data in a source
140+
org. The command uses a JSON configuration file to define the characteristics of the synthetic data. For example, the
141+
configuration file might specify the number of records to generate for one or more Salesforce objects, along with the
142+
subset of fields to include. Once generated, the data is automatically loaded into the specified target org. You must
143+
be authenticated to both the source and target orgs before running this command.
144+
145+
By default, this command runs synchronously and outputs the job ID, along with a running status of each execution
146+
phase, such as querying the source org or generating the data. If you prefer, you can run the command asynchronously
147+
by specifying the --async flag so that the control of the terminal is immediately returned to you. Then use the job ID
148+
to run the "data-seeding generate report" command to view the status.
149+
150+
EXAMPLES
151+
Generate synthetic data similar to existing data in the org with alias "mySourceOrg" then load it into the org with
152+
alias "myTargetOrg"; use the specified config file to determine the format of the generated data:
153+
154+
$ sf data-seeding generate --source-org mySourceOrg --target-org myTargetOrg --config-file \
155+
./config/seed-config.json
156+
157+
Generate synthetic data using org usernames and run the command asynchronously:
158+
159+
$ sf data-seeding generate --source-org source@org.com" --target-org target@org.com" --config-file \
160+
./config/seed-config.json --async
161+
162+
Generate synthetic data using org aliases; if after 5 minutes the command hasn't finished, it completes
163+
asynchronously:
164+
165+
$ sf data-seeding generate --source-org source@org.com" --target-org target@org.com" --config-file \
166+
./config/seed-config.json --wait 5
167+
```
168+
169+
_See code: [src/commands/data-seeding/generate/index.ts](https://github.com/salesforcecli/plugin-data-seeding/blob/v1.0.10/src/commands/data-seeding/generate/index.ts)_
170+
171+
## `sf data-seeding generate report`
172+
173+
Display the status of a data-seeding generate job.
174+
175+
```
176+
USAGE
177+
$ sf data-seeding generate report [--json] [--flags-dir <value>] [-i <value>] [-r]
178+
179+
FLAGS
180+
-i, --job-id=<value> ID of a specific execution of the "data-seeding generate" command.
181+
-r, --use-most-recent View the status of the most recently run "data-seeding generate" command.
182+
183+
GLOBAL FLAGS
184+
--flags-dir=<value> Import flag values from a directory.
185+
--json Format output as json.
186+
187+
DESCRIPTION
188+
Display the status of a data-seeding generate job.
189+
190+
This command displays the status of a previously initiated or completed execution of the "data-seeding generate"
191+
command. Run this command by either passing it the job ID returned by "data-seeding generate", or use the
192+
--use-most-recent flag to view the status of the most recently run "data-seeding generate" command.
131193
132194
EXAMPLES
133-
Say hello to the world:
195+
Display the status of a specific execution of the "data-seeding generate" command:
134196
135-
$ sf hello world
197+
$ sf data-seeding generate report --job-id 1234-5678-AAAA-BBBB
136198
137-
Say hello to someone you know:
199+
Display the status of the most recently run "data-seeding generate" command:
200+
201+
$ sf data-seeding generate report --use-most-recent
202+
```
203+
204+
_See code: [src/commands/data-seeding/generate/report.ts](https://github.com/salesforcecli/plugin-data-seeding/blob/v1.0.10/src/commands/data-seeding/generate/report.ts)_
205+
206+
## `sf data-seeding migrate`
207+
208+
Migrate data from one org to another.
209+
210+
```
211+
USAGE
212+
$ sf data-seeding migrate -o <value> -s <value> -f <value> [--json] [--flags-dir <value>] [-w <value> | --async]
213+
214+
FLAGS
215+
-f, --config-file=<value> (required) Path to the data migration JSON configuration file.
216+
-o, --target-org=<value> (required) Username or alias of the target org into which the migrated data is loaded.
217+
-s, --source-org=<value> (required) Username or alias of the source org that contains the data to be migrated.
218+
-w, --wait=<value> [default: 33 minutes] Number of minutes to wait for the command to complete; when reached,
219+
the command completes asynchronously if necessary.
220+
--async Run the command asynchronously and immediately return control of the terminal.
221+
222+
GLOBAL FLAGS
223+
--flags-dir=<value> Import flag values from a directory.
224+
--json Format output as json.
225+
226+
DESCRIPTION
227+
Migrate data from one org to another.
228+
229+
This command migrates selected data from a source org and loads it into a target org. The command uses a JSON
230+
configuration file that defines the characteristics of the data. For example, the configuration file might specify a
231+
number of records from one or more Salesforce objects to migrate, along with the subset of fields to include. You must
232+
be authenticated to both the source and target orgs before running this command.
233+
234+
By default, this command runs synchronously and outputs a job ID along with a running status of each execution phase,
235+
such as querying the source org or loading into the target. If you prefer, you can run the command asynchronously by
236+
specifying the --async flag so that the control of the terminal is immediately returned to you. Then use the job ID to
237+
run the "data-seeding migrate report" command to view the status.
238+
239+
EXAMPLES
240+
Migrate data from the org with alias "mySourceOrg" to the org with alias "myTargetOrg"; use the specified
241+
configuration file to determine the data to migrate:
242+
243+
$ sf data-seeding migrate --source-org mySourceOrg --target-org myTargetOrg --config-file \
244+
./config/data-seed.json
245+
246+
Migrate data by specifying usernames for the source and target orgs, and run the command asynchronously:
247+
248+
$ sf data-seeding migrate --source-org source@org.com --target-org target@org.com \
249+
--config-file=./config/data-seed.json --async
250+
251+
Migrate data using org aliases; if after 5 minutes the command hasn't finished, it completes asynchronously:
252+
253+
$ sf data-seeding migrate --source-org mySourceOrg --target-org myTargetOrg --config-file \
254+
./config/data-seed.json --wait 5
255+
```
256+
257+
_See code: [src/commands/data-seeding/migrate/index.ts](https://github.com/salesforcecli/plugin-data-seeding/blob/v1.0.10/src/commands/data-seeding/migrate/index.ts)_
258+
259+
## `sf data-seeding migrate report`
260+
261+
Display the status of a data-seeding migrate job.
262+
263+
```
264+
USAGE
265+
$ sf data-seeding migrate report [--json] [--flags-dir <value>] [-i <value>] [-r]
266+
267+
FLAGS
268+
-i, --job-id=<value> ID of a specific execution of the "data-seeding migrate" command.
269+
-r, --use-most-recent View the status of the most recently run "data-seeding migrate" command.
270+
271+
GLOBAL FLAGS
272+
--flags-dir=<value> Import flag values from a directory.
273+
--json Format output as json.
274+
275+
DESCRIPTION
276+
Display the status of a data-seeding migrate job.
277+
278+
This command displays the status of a previously initiated or completed execution of the "data-seeding migrate"
279+
command. Run this command by either passing it the job ID returned by "data-seeding migrate", or use the
280+
--use-most-recent flag to view the status of the most recently run "data-seeding migrate" command.
281+
282+
EXAMPLES
283+
Display the status of a specific execution of the "data-seeding migrate" command:
138284
139-
$ sf hello world --name Astro
285+
$ sf data-seeding migrate report --job-id 1234-5678-AAAA-BBBB
140286
141-
FLAG DESCRIPTIONS
142-
-n, --name=<value> The name of the person you'd like to say hello to.
287+
Display the status of the most recently run "data-seeding migrate" command:
143288
144-
This person can be anyone in the world!
289+
$ sf data-seeding migrate report --use-most-recent
145290
```
146291

147-
_See code: [src/commands/hello/world.ts](https://github.com/salesforcecli/plugin-data-seeding/blob/1.0.10/src/commands/hello/world.ts)_
292+
_See code: [src/commands/data-seeding/migrate/report.ts](https://github.com/salesforcecli/plugin-data-seeding/blob/v1.0.10/src/commands/data-seeding/migrate/report.ts)_
148293

149294
<!-- commandsstop -->

command-snapshot.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
[
22
{
33
"alias": [],
4-
"command": "hello:world",
4+
"command": "data-seeding:generate",
55
"flagAliases": [],
6-
"flagChars": ["n"],
7-
"flags": ["flags-dir", "json", "name"],
6+
"flagChars": ["f", "o", "s", "w"],
7+
"flags": ["async", "config-file", "flags-dir", "json", "source-org", "target-org", "wait"],
8+
"plugin": "@salesforce/plugin-data-seeding"
9+
},
10+
{
11+
"alias": [],
12+
"command": "data-seeding:generate:report",
13+
"flagAliases": [],
14+
"flagChars": ["i", "r"],
15+
"flags": ["flags-dir", "job-id", "json", "use-most-recent"],
16+
"plugin": "@salesforce/plugin-data-seeding"
17+
},
18+
{
19+
"alias": [],
20+
"command": "data-seeding:migrate",
21+
"flagAliases": [],
22+
"flagChars": ["f", "o", "s", "w"],
23+
"flags": ["async", "config-file", "flags-dir", "json", "source-org", "target-org", "wait"],
24+
"plugin": "@salesforce/plugin-data-seeding"
25+
},
26+
{
27+
"alias": [],
28+
"command": "data-seeding:migrate:report",
29+
"flagAliases": [],
30+
"flagChars": ["i", "r"],
31+
"flags": ["flags-dir", "job-id", "json", "use-most-recent"],
832
"plugin": "@salesforce/plugin-data-seeding"
933
}
1034
]

0 commit comments

Comments
 (0)