@salesforce/plugin-org 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,42 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.12.0](https://github.com/salesforcecli/plugin-org/compare/v1.11.2...v1.12.0) (2022-04-22)
6
+
7
+ ### Features
8
+
9
+ - new command org:status ([9524fb6](https://github.com/salesforcecli/plugin-org/commit/9524fb67285cf608d4f7a4dd9c11b2475f643866))
10
+
11
+ ### Bug Fixes
12
+
13
+ - for set alias ([99c77f0](https://github.com/salesforcecli/plugin-org/commit/99c77f0be12df5c03ee8b1f11e7c9425910ec1b1))
14
+
15
+ ### [1.11.2](https://github.com/salesforcecli/plugin-org/compare/v1.11.1...v1.11.2) (2022-02-21)
16
+
17
+ ### Bug Fixes
18
+
19
+ - only local config ([54e7b93](https://github.com/salesforcecli/plugin-org/commit/54e7b934008bae5a12934932c239c6ff59e2f22e))
20
+ - try to create local config first ([f84c64f](https://github.com/salesforcecli/plugin-org/commit/f84c64f46ed5141bab3167cba04f75ad4e59484b))
21
+ - use Aliases.parseAndUpdate ([0b1860f](https://github.com/salesforcecli/plugin-org/commit/0b1860fb1b535ff2b5a84e4dcb1b691c4b85cdba))
22
+
23
+ ### [1.11.1](https://github.com/salesforcecli/plugin-org/compare/v1.11.0...v1.11.1) (2022-01-28)
24
+
25
+ ### Features
26
+
27
+ - scratchOrg create ([955667e](https://github.com/salesforcecli/plugin-org/commit/955667e2d3e7e6444903c89ad065b9161444b22b))
28
+
29
+ ### Bug Fixes
30
+
31
+ - add initial org:beta:create command ([1cf6bdb](https://github.com/salesforcecli/plugin-org/commit/1cf6bdb1399e20e2fc72a9f0c15080e95b26e219))
32
+ - add initial org:beta:create command ([d2a89e2](https://github.com/salesforcecli/plugin-org/commit/d2a89e24a956136bb11d161618234b33842787e7))
33
+ - add org:beta:create command for sandboxes, UTs ([654ca50](https://github.com/salesforcecli/plugin-org/commit/654ca50ee2192342c6df382e9e20f8b33f9fd73f))
34
+ - add sandbox create/open/delete NUT ([60c81aa](https://github.com/salesforcecli/plugin-org/commit/60c81aa6330b87cecb06a84cca2994c7d466c3f5))
35
+ - bump testkit to fix yarn.lock ([454afbd](https://github.com/salesforcecli/plugin-org/commit/454afbd6649e2ceaabdaeeb27ce9a3d5e5f9c813))
36
+ - disable nuts-on-windows w/latest ([0bf02b1](https://github.com/salesforcecli/plugin-org/commit/0bf02b191d2ef039c5800ef233bba142b82bf975))
37
+ - manual release for beta:org:create ([a33137f](https://github.com/salesforcecli/plugin-org/commit/a33137f04602bb36033c73132098e311206ebafe))
38
+ - merge conflicts ([cd02453](https://github.com/salesforcecli/plugin-org/commit/cd024538fe2616fe3b46ef477d268e41f2516bea))
39
+ - use compatible types from command/test ([a4de0b0](https://github.com/salesforcecli/plugin-org/commit/a4de0b06be0f899b07a6651b61febf6732069ef0))
40
+
5
41
  ## [1.11.0](https://github.com/salesforcecli/plugin-org/compare/v1.10.1...v1.11.0) (2021-12-02)
6
42
 
7
43
  ### Features
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018, Salesforce.com, Inc.
1
+ Copyright (c) 2022, Salesforce.com, Inc.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
package/README.md CHANGED
@@ -78,19 +78,85 @@ sfdx plugins
78
78
 
79
79
  <!-- commands -->
80
80
 
81
+ - [`sfdx force:org:beta:create [name=value...] [-t scratch|sandbox] [-f <filepath>] [-n] [-c] [-i <string>] [-s] [-a <string>] [-w <minutes>] [-d <integer>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceorgbetacreate-namevalue--t-scratchsandbox--f-filepath--n--c--i-string--s--a-string--w-minutes--d-integer--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
81
82
  - [`sfdx force:org:delete [-p] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceorgdelete--p--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
82
83
  - [`sfdx force:org:display [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceorgdisplay--u-string---apiversion-string---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
83
84
  - [`sfdx force:org:list [--all] [-p --clean] [--skipconnectionstatus] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceorglist---all--p---clean---skipconnectionstatus---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
84
85
  - [`sfdx force:org:open [-b <string> | -r] [-p <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceorgopen--b-string---r--p-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
86
+ - [`sfdx force:org:status -n <string> [-s] [-a <string>] [-w <minutes>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceorgstatus--n-string--s--a-string--w-minutes--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
85
87
 
86
- ## `sfdx force:org:delete [-p] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
88
+ ## `sfdx force:org:beta:create [name=value...] [-t scratch|sandbox] [-f <filepath>] [-n] [-c] [-i <string>] [-s] [-a <string>] [-w <minutes>] [-d <integer>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
87
89
 
88
- mark a scratch or sandbox org for deletion
90
+ create a scratch or sandbox org
91
+
92
+ ```
93
+ USAGE
94
+ $ sfdx force:org:beta:create [name=value...] [-t scratch|sandbox] [-f <filepath>] [-n] [-c] [-i <string>] [-s] [-a
95
+ <string>] [-w <minutes>] [-d <integer>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
96
+ trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
97
+
98
+ OPTIONS
99
+ -a, --setalias=setalias alias for the created org
100
+
101
+ -c, --noancestors do not include second-generation
102
+ package ancestors in the scratch org
103
+
104
+ -d, --durationdays=durationdays duration of the scratch org (in
105
+ days) (default:7, min:1, max:30)
106
+
107
+ -f, --definitionfile=definitionfile path to an org definition file
108
+
109
+ -i, --clientid=clientid connected app consumer key; not
110
+ supported for sandbox org creation
111
+
112
+ -n, --nonamespace create the scratch org with no
113
+ namespace
114
+
115
+ -s, --setdefaultusername set the created org as the default
116
+ username
117
+
118
+ -t, --type=(scratch|sandbox) [default: scratch] type of org to
119
+ create
120
+
121
+ -u, --targetusername=targetusername username or alias for the target
122
+ org; overrides default target org
89
123
 
124
+ -v, --targetdevhubusername=targetdevhubusername username or alias for the dev hub
125
+ org; overrides default dev hub org
126
+
127
+ -w, --wait=wait [default: 6 minutes] the streaming
128
+ client socket timeout (in minutes)
129
+
130
+ --apiversion=apiversion override the api version used for
131
+ api requests made by this command
132
+
133
+ --json format output as json
134
+
135
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
136
+ this command invocation
137
+
138
+ DESCRIPTION
139
+ Creates a scratch org or a sandbox org using the values specified in a configuration file or key=value pairs that you
140
+ specify on the command line. Values specified on the command line override values in the configuration file. Specify a
141
+ configuration file or provide key=value pairs while creating a scratch org or a sandbox. When creating scratch orgs,
142
+ —targetdevhubusername (-v) must be a Dev Hub org. When creating sandboxes, the --targetusername (-u) must be a
143
+ production org with sandbox licenses. The —type (-t) is required if creating a sandbox.
144
+
145
+ EXAMPLES
146
+ $ sfdx force:org:create -f config/enterprise-scratch-def.json -a MyScratchOrg
147
+ $ sfdx force:org:create edition=Developer -a MyScratchOrg -s -v devHub
148
+ $ sfdx force:org:create -f config/enterprise-scratch-def.json -a ScratchOrgWithOverrides
149
+ username=testuser1@mycompany.org
150
+ $ sfdx force:org:create -t sandbox -f config/dev-sandbox-def.json -a MyDevSandbox -u prodOrg
90
151
  ```
152
+
153
+ _See code: [src/commands/force/org/beta/create.ts](https://github.com/salesforcecli/plugin-org/blob/v1.11.2/src/commands/force/org/beta/create.ts)_
154
+
155
+ ## `sfdx force:org:delete [-p] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
156
+
91
157
  mark a scratch or sandbox org for deletion
92
- To mark the org for deletion without being prompted to confirm, specify --noprompt.
93
158
 
159
+ ```
94
160
  USAGE
95
161
  $ sfdx force:org:delete [-p] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
96
162
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
@@ -120,18 +186,13 @@ EXAMPLES
120
186
  $ sfdx force:org:delete -u MyOrgAlias -p
121
187
  ```
122
188
 
123
- _See code: [src/commands/force/org/delete.ts](https://github.com/salesforcecli/plugin-org/blob/v1.10.1/src/commands/force/org/delete.ts)_
189
+ _See code: [src/commands/force/org/delete.ts](https://github.com/salesforcecli/plugin-org/blob/v1.11.2/src/commands/force/org/delete.ts)_
124
190
 
125
191
  ## `sfdx force:org:display [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
126
192
 
127
193
  get the description for the current or target org
128
194
 
129
195
  ```
130
- get the description for the current or target org
131
- Output includes your access token, client Id, connected status, org ID, instance URL, username, and alias, if applicable.
132
- Use --verbose to include the SFDX auth URL. WARNING: The SFDX auth URL contains sensitive information, such as a refresh token that can be used to access an org. Don't share or distribute this URL or token.
133
- Including --verbose displays the sfdxAuthUrl property only if you authenticated to the org using auth:web:login (not auth:jwt:grant)
134
-
135
196
  USAGE
136
197
  $ sfdx force:org:display [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel
137
198
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
@@ -166,15 +227,13 @@ EXAMPLES
166
227
  sfdx force:org:display -u TestOrg1 --json > tmp/MyOrgDesc.json
167
228
  ```
168
229
 
169
- _See code: [src/commands/force/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/v1.10.1/src/commands/force/org/display.ts)_
230
+ _See code: [src/commands/force/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/v1.11.2/src/commands/force/org/display.ts)_
170
231
 
171
232
  ## `sfdx force:org:list [--all] [-p --clean] [--skipconnectionstatus] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
172
233
 
173
234
  list all orgs you’ve created or authenticated to
174
235
 
175
236
  ```
176
- list all orgs you’ve created or authenticated to
177
-
178
237
  USAGE
179
238
  $ sfdx force:org:list [--all] [-p --clean] [--skipconnectionstatus] [--verbose] [--json] [--loglevel
180
239
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
@@ -204,19 +263,13 @@ EXAMPLES
204
263
  sfdx force:org:list --verbose --json > tmp/MyOrgList.json
205
264
  ```
206
265
 
207
- _See code: [src/commands/force/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/v1.10.1/src/commands/force/org/list.ts)_
266
+ _See code: [src/commands/force/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/v1.11.2/src/commands/force/org/list.ts)_
208
267
 
209
268
  ## `sfdx force:org:open [-b <string> | -r] [-p <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
210
269
 
211
270
  open your default scratch org, or another specified org
212
271
 
213
272
  ```
214
- open your default scratch org, or another specified org
215
- To open a specific page, specify the portion of the URL after "https://MyDomainName.my.salesforce.com/" as --path.
216
- For example, specify "--path lightning" to open Lightning Experience, or specify "--path /apex/YourPage" to open a Visualforce page.
217
- To generate a URL but not launch it in your browser, specify --urlonly.
218
- To open in a specific browser, use the --browser parameter. Supported browsers are "chrome", "edge", and "firefox". If you don't specify --browser, the org opens in your default browser.
219
-
220
273
  USAGE
221
274
  $ sfdx force:org:open [-b <string> | -r] [-p <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
222
275
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
@@ -245,7 +298,7 @@ DESCRIPTION
245
298
  Visualforce page.
246
299
  To generate a URL but not launch it in your browser, specify --urlonly.
247
300
  To open in a specific browser, use the --browser parameter. Supported browsers are "chrome", "edge", and "firefox". If
248
- you don't specify --browser, the org opens in your default browser.
301
+ you don't specify --browser, the org opens in your default browser.
249
302
 
250
303
  EXAMPLES
251
304
  sfdx force:org:open
@@ -255,6 +308,54 @@ EXAMPLES
255
308
  sfdx force:org:open -u me@my.org -b firefox
256
309
  ```
257
310
 
258
- _See code: [src/commands/force/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/v1.10.1/src/commands/force/org/open.ts)_
311
+ _See code: [src/commands/force/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/v1.11.2/src/commands/force/org/open.ts)_
312
+
313
+ ## `sfdx force:org:status -n <string> [-s] [-a <string>] [-w <minutes>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
314
+
315
+ report status of sandbox creation or clone and authenticate to it
316
+
317
+ ```
318
+ USAGE
319
+ $ sfdx force:org:status -n <string> [-s] [-a <string>] [-w <minutes>] [-u <string>] [--apiversion <string>] [--json]
320
+ [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
321
+
322
+ OPTIONS
323
+ -a, --setalias=setalias alias for the created or cloned org
324
+
325
+ -n, --sandboxname=sandboxname (required) name of the sandbox org
326
+ to check status for
327
+
328
+ -s, --setdefaultusername set the created or cloned org as
329
+ your default
330
+
331
+ -u, --targetusername=targetusername username or alias for the target
332
+ org; overrides default target org
333
+
334
+ -w, --wait=wait [default: 6 minutes] number of
335
+ minutes to wait while polling for
336
+ status
337
+
338
+ --apiversion=apiversion override the api version used for
339
+ api requests made by this command
340
+
341
+ --json format output as json
342
+
343
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
344
+ this command invocation
345
+
346
+ DESCRIPTION
347
+ Use this command to check the status of your sandbox creation or clone and, if the sandbox is ready, authenticate to
348
+ it.
349
+ Use the --wait (-w) parameter to specify the number of minutes that the command waits for the sandbox creation or
350
+ clone to complete before returning control of the terminal to you.
351
+ Set the --targetusername (-u) parameter to the username or alias of the production org that contains the sandbox
352
+ license.
353
+
354
+ EXAMPLES
355
+ sfdx force:org:status --sandboxname DevSbx1 --setalias MySandbox -u prodOrg
356
+ sfdx force:org:status --sandboxname DevSbx1 --wait 45 --setdefaultusername -u prodOrg
357
+ ```
358
+
359
+ _See code: [src/commands/force/org/status.ts](https://github.com/salesforcecli/plugin-org/blob/v1.11.2/src/commands/force/org/status.ts)_
259
360
 
260
361
  <!-- commandsstop -->
@@ -0,0 +1,27 @@
1
+ import { FlagsConfig, SfdxCommand } from '@salesforce/command';
2
+ import { AuthFields, SandboxProcessObject, ScratchOrgInfo } from '@salesforce/core';
3
+ export interface ScratchOrgProcessObject {
4
+ username?: string;
5
+ scratchOrgInfo: ScratchOrgInfo;
6
+ authFields?: AuthFields;
7
+ warnings: string[];
8
+ orgId: string;
9
+ }
10
+ export declare class Create extends SfdxCommand {
11
+ static readonly description: string;
12
+ static readonly examples: string[];
13
+ static readonly supportsDevhubUsername = true;
14
+ static readonly supportsUsername = true;
15
+ static readonly varargs = true;
16
+ static readonly flagsConfig: FlagsConfig;
17
+ protected readonly lifecycleEventNames: string[];
18
+ private sandboxAuth?;
19
+ run(): Promise<SandboxProcessObject | ScratchOrgProcessObject>;
20
+ private validateSandboxFlags;
21
+ private lowerToUpper;
22
+ private createSandboxRequest;
23
+ private createSandbox;
24
+ private readJsonDefFile;
25
+ private setAliasAndDefaultUsername;
26
+ private createScratchOrg;
27
+ }
@@ -0,0 +1,310 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Create = void 0;
10
+ const os = require("os");
11
+ const fs = require("fs");
12
+ const command_1 = require("@salesforce/command");
13
+ const kit_1 = require("@salesforce/kit");
14
+ const core_1 = require("@salesforce/core");
15
+ const sandboxReporter_1 = require("../../../../shared/sandboxReporter");
16
+ core_1.Messages.importMessagesDirectory(__dirname);
17
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-org', 'create');
18
+ class Create extends command_1.SfdxCommand {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.lifecycleEventNames = ['postorgcreate'];
22
+ }
23
+ async run() {
24
+ this.logger.debug('Create started with args %s ', this.flags);
25
+ if (this.flags.type === core_1.OrgTypes.Sandbox) {
26
+ this.validateSandboxFlags();
27
+ return this.createSandbox();
28
+ }
29
+ else {
30
+ // default to scratch org
31
+ return this.createScratchOrg();
32
+ }
33
+ }
34
+ validateSandboxFlags() {
35
+ if (!this.flags.targetusername) {
36
+ throw core_1.SfdxError.create('@salesforce/plugin-org', 'create', 'requiresUsername');
37
+ }
38
+ if (this.flags.retry !== 0) {
39
+ throw core_1.SfdxError.create('@salesforce/plugin-org', 'create', 'retryIsNotValidForSandboxes');
40
+ }
41
+ if (this.flags.clientid) {
42
+ this.ux.warn(messages.getMessage('clientIdNotSupported', [this.flags.clientid]));
43
+ }
44
+ if (this.flags.nonamespace) {
45
+ this.ux.warn(messages.getMessage('noNamespaceNotSupported', [this.flags.nonamespace]));
46
+ }
47
+ if (this.flags.noancestors) {
48
+ this.ux.warn(messages.getMessage('noAncestorsNotSupported', [this.flags.noancestors]));
49
+ }
50
+ if (this.flags.durationdays) {
51
+ this.ux.warn(messages.getMessage('durationDaysNotSupported', [this.flags.durationdays]));
52
+ }
53
+ }
54
+ lowerToUpper(object) {
55
+ // the API has keys defined in capital camel case, while the definition schema has them as lower camel case
56
+ // we need to convert lower camel case to upper before merging options so they will override properly
57
+ Object.keys(object).map((key) => {
58
+ const upperCase = key.charAt(0).toUpperCase();
59
+ if (key.charAt(0) !== upperCase) {
60
+ const capitalKey = upperCase + key.slice(1);
61
+ object[capitalKey] = object[key];
62
+ delete object[key];
63
+ }
64
+ });
65
+ return object;
66
+ }
67
+ createSandboxRequest() {
68
+ this.logger.debug('Create Varargs: %s ', this.varargs);
69
+ let sandboxDefFileContents = this.readJsonDefFile();
70
+ let capitalizedVarArgs = {};
71
+ if (sandboxDefFileContents) {
72
+ sandboxDefFileContents = this.lowerToUpper(sandboxDefFileContents);
73
+ }
74
+ if (this.varargs) {
75
+ capitalizedVarArgs = this.lowerToUpper(this.varargs);
76
+ }
77
+ // varargs override file input
78
+ const sandboxReq = { SandboxName: undefined, ...sandboxDefFileContents, ...capitalizedVarArgs };
79
+ if (!sandboxReq.SandboxName) {
80
+ // sandbox names are 10 chars or less, a radix of 36 = [a-z][0-9]
81
+ // technically without querying the production org, the generated name could already exist, but the chances of that are lower than the perf penalty of querying and verifying
82
+ sandboxReq.SandboxName = `sbx${Date.now().toString(36).slice(-7)}`;
83
+ this.ux.warn(`No SandboxName defined, generating new SandboxName: ${sandboxReq.SandboxName}`);
84
+ }
85
+ if (!sandboxReq.LicenseType) {
86
+ throw core_1.SfdxError.create('@salesforce/plugin-org', 'create', 'missingLicenseType');
87
+ }
88
+ return sandboxReq;
89
+ }
90
+ async createSandbox() {
91
+ const prodOrg = await core_1.Org.create({ aliasOrUsername: this.flags.targetusername });
92
+ const lifecycle = core_1.Lifecycle.getInstance();
93
+ // register the sandbox event listeners before calling `prodOrg.createSandbox()`
94
+ // `on` doesn't support synchronous methods
95
+ // eslint-disable-next-line @typescript-eslint/require-await
96
+ lifecycle.on(core_1.SandboxEvents.EVENT_ASYNC_RESULT, async (results) => {
97
+ this.ux.log(messages.getMessage('sandboxSuccess', [results.Id, results.SandboxName, this.flags.targetusername]));
98
+ });
99
+ // eslint-disable-next-line @typescript-eslint/require-await
100
+ lifecycle.on(core_1.SandboxEvents.EVENT_STATUS, async (results) => {
101
+ this.ux.log(sandboxReporter_1.SandboxReporter.sandboxProgress(results));
102
+ });
103
+ // eslint-disable-next-line @typescript-eslint/require-await
104
+ lifecycle.on(core_1.SandboxEvents.EVENT_AUTH, async (results) => {
105
+ this.sandboxAuth = results;
106
+ });
107
+ lifecycle.on(core_1.SandboxEvents.EVENT_RESULT, async (results) => {
108
+ var _a;
109
+ const { sandboxReadyForUse, data } = sandboxReporter_1.SandboxReporter.logSandboxProcessResult(results);
110
+ this.ux.log(sandboxReadyForUse);
111
+ this.ux.styledHeader('Sandbox Org Creation Status');
112
+ this.ux.table(data, {
113
+ columns: [
114
+ { key: 'key', label: 'Name' },
115
+ { key: 'value', label: 'Value' },
116
+ ],
117
+ });
118
+ if ((_a = results.sandboxRes) === null || _a === void 0 ? void 0 : _a.authUserName) {
119
+ if (this.flags.setalias) {
120
+ const alias = await core_1.Aliases.create(core_1.Aliases.getDefaultOptions());
121
+ alias.set(this.flags.setalias, results.sandboxRes.authUserName);
122
+ const result = await alias.write();
123
+ this.logger.debug('Set Alias: %s result: %s', this.flags.setalias, result);
124
+ }
125
+ if (this.flags.setdefaultusername) {
126
+ const globalConfig = this.configAggregator.getGlobalConfig();
127
+ globalConfig.set(core_1.Config.DEFAULT_USERNAME, results.sandboxRes.authUserName);
128
+ const result = await globalConfig.write();
129
+ this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
130
+ }
131
+ }
132
+ });
133
+ const sandboxReq = this.createSandboxRequest();
134
+ this.logger.debug('Calling create with SandboxRequest: %s ', sandboxReq);
135
+ const wait = this.flags.wait;
136
+ try {
137
+ return prodOrg.createSandbox(sandboxReq, { wait });
138
+ }
139
+ catch (e) {
140
+ // guaranteed to be SfdxError from core;
141
+ const err = e;
142
+ if (err === null || err === void 0 ? void 0 : err.message.includes('The org cannot be found')) {
143
+ // there was most likely an issue with DNS when auth'ing to the new sandbox, but it was created.
144
+ if (this.flags.setalias && this.sandboxAuth) {
145
+ const alias = await core_1.Aliases.create(core_1.Aliases.getDefaultOptions());
146
+ alias.set(this.flags.setalias, this.sandboxAuth.authUserName);
147
+ const result = await alias.write();
148
+ this.logger.debug('Set Alias: %s result: %s', this.flags.setalias, result);
149
+ }
150
+ if (this.flags.setdefaultusername && this.sandboxAuth) {
151
+ const globalConfig = this.configAggregator.getGlobalConfig();
152
+ globalConfig.set(core_1.Config.DEFAULT_USERNAME, this.sandboxAuth.authUserName);
153
+ const result = await globalConfig.write();
154
+ this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
155
+ }
156
+ err.actions = [messages.getMessage('dnsTimeout'), messages.getMessage('partialSuccess')];
157
+ err.exitCode = 68;
158
+ throw err;
159
+ }
160
+ }
161
+ }
162
+ readJsonDefFile() {
163
+ // the -f option
164
+ if (this.flags.definitionfile) {
165
+ this.logger.debug('Reading JSON DefFile %s ', this.flags.definitionfile);
166
+ return JSON.parse(fs.readFileSync(this.flags.definitionfile, 'utf-8'));
167
+ }
168
+ }
169
+ async setAliasAndDefaultUsername(username) {
170
+ const aliases = await core_1.Aliases.create(core_1.Aliases.getDefaultOptions());
171
+ if (this.flags.setalias) {
172
+ await aliases.updateValue(this.flags.setalias, username);
173
+ this.logger.debug('Set Alias: %s result: %s', this.flags.setalias);
174
+ }
175
+ if (this.flags.setdefaultusername) {
176
+ let config;
177
+ try {
178
+ config = await core_1.Config.create({ isGlobal: false });
179
+ }
180
+ catch {
181
+ config = await core_1.Config.create({ isGlobal: true });
182
+ }
183
+ const value = aliases.getKeysByValue(username)[0] || username;
184
+ const result = config.set(core_1.Config.DEFAULT_USERNAME, value);
185
+ await config.write();
186
+ this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
187
+ }
188
+ }
189
+ async createScratchOrg() {
190
+ this.logger.debug('OK, will do scratch org creation');
191
+ if (!this.hubOrg) {
192
+ throw core_1.SfdxError.create('@salesforce/plugin-org', 'create', 'RequiresDevhubUsernameError');
193
+ }
194
+ // Ensure we have an org config input source.
195
+ if (!this.flags.definitionfile && Object.keys(this.varargs).length === 0) {
196
+ throw new core_1.SfdxError(messages.getMessage('noConfig'));
197
+ }
198
+ this.logger.debug('validation complete');
199
+ let secret;
200
+ if (this.flags.clientid) {
201
+ // If the user supplied a specific client ID, we have no way of knowing if it's
202
+ // a certificate-based Connected App or not. Therefore, we have to assume that
203
+ // we'll need the client secret, so prompt the user for it.
204
+ secret = await this.ux.prompt(messages.getMessage('secretPrompt'), {
205
+ type: 'mask',
206
+ });
207
+ }
208
+ const createCommandOptions = {
209
+ connectedAppConsumerKey: this.flags.clientid,
210
+ durationDays: this.flags.durationdays,
211
+ nonamespace: this.flags.nonamespace,
212
+ noancestors: this.flags.noancestors,
213
+ wait: this.flags.wait,
214
+ retry: this.flags.retry,
215
+ apiversion: this.flags.apiversion,
216
+ definitionfile: this.flags.definitionfile,
217
+ orgConfig: this.varargs,
218
+ clientSecret: secret,
219
+ };
220
+ const { username, scratchOrgInfo, authFields, warnings } = await this.hubOrg.scratchOrgCreate(createCommandOptions);
221
+ await core_1.Lifecycle.getInstance().emit('scratchOrgInfo', scratchOrgInfo);
222
+ await this.setAliasAndDefaultUsername(username);
223
+ // emit postorgcreate event for hook
224
+ const postOrgCreateHookInfo = [authFields].map((element) => ({
225
+ accessToken: element.accessToken,
226
+ clientId: element.clientId,
227
+ created: element.created,
228
+ createdOrgInstance: element.createdOrgInstance,
229
+ devHubUsername: element.devHubUsername,
230
+ expirationDate: element.expirationDate,
231
+ instanceUrl: element.instanceUrl,
232
+ loginUrl: element.loginUrl,
233
+ orgId: element.orgId,
234
+ username: element.username,
235
+ }))[0];
236
+ await core_1.Lifecycle.getInstance().emit('postorgcreate', postOrgCreateHookInfo);
237
+ this.logger.debug(`orgConfig.loginUrl: ${authFields.loginUrl}`);
238
+ this.logger.debug(`orgConfig.instanceUrl: ${authFields.instanceUrl}`);
239
+ this.ux.log(messages.getMessage('scratchOrgCreateSuccess', [authFields.orgId, username]));
240
+ if (warnings.length > 0) {
241
+ warnings.forEach((warning) => {
242
+ this.ux.warn(warning);
243
+ });
244
+ }
245
+ return {
246
+ username,
247
+ scratchOrgInfo,
248
+ authFields,
249
+ warnings,
250
+ orgId: authFields.orgId,
251
+ };
252
+ }
253
+ }
254
+ exports.Create = Create;
255
+ Create.description = messages.getMessage('description');
256
+ Create.examples = messages.getMessage('examples').split(os.EOL);
257
+ Create.supportsDevhubUsername = true;
258
+ Create.supportsUsername = true;
259
+ Create.varargs = true;
260
+ Create.flagsConfig = {
261
+ type: command_1.flags.enum({
262
+ char: 't',
263
+ description: messages.getMessage('flags.type'),
264
+ options: [core_1.OrgTypes.Scratch, core_1.OrgTypes.Sandbox],
265
+ default: core_1.OrgTypes.Scratch,
266
+ }),
267
+ definitionfile: command_1.flags.filepath({
268
+ char: 'f',
269
+ description: messages.getMessage('flags.definitionFile'),
270
+ }),
271
+ nonamespace: command_1.flags.boolean({
272
+ char: 'n',
273
+ description: messages.getMessage('flags.noNamespace'),
274
+ }),
275
+ noancestors: command_1.flags.boolean({
276
+ char: 'c',
277
+ description: messages.getMessage('flags.noAncestors'),
278
+ }),
279
+ clientid: command_1.flags.string({
280
+ char: 'i',
281
+ description: messages.getMessage('flags.clientId'),
282
+ }),
283
+ setdefaultusername: command_1.flags.boolean({
284
+ char: 's',
285
+ description: messages.getMessage('flags.setDefaultUsername'),
286
+ }),
287
+ setalias: command_1.flags.string({
288
+ char: 'a',
289
+ description: messages.getMessage('flags.setAlias'),
290
+ }),
291
+ wait: command_1.flags.minutes({
292
+ char: 'w',
293
+ description: messages.getMessage('flags.wait'),
294
+ min: 6,
295
+ default: kit_1.Duration.minutes(6),
296
+ }),
297
+ durationdays: command_1.flags.integer({
298
+ char: 'd',
299
+ description: messages.getMessage('flags.durationDays'),
300
+ min: 1,
301
+ max: 30,
302
+ }),
303
+ retry: command_1.flags.number({
304
+ hidden: true,
305
+ default: 0,
306
+ max: 10,
307
+ description: messages.getMessage('flags.retry'),
308
+ }),
309
+ };
310
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../src/commands/force/org/beta/create.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yBAAyB;AACzB,yBAAyB;AACzB,iDAAsE;AACtE,yCAA2C;AAC3C,2CAiB0B;AAE1B,wEAAqE;AAErE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;AAU3E,MAAa,MAAO,SAAQ,qBAAW;IAAvC;;QAwDqB,wB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;KACnD,CAAC;IACF,kBAAkB,EAAE,eAAK,CAAC,OAAO,CAAC;QAChC,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;KAC7D,CAAC;IACF,QAAQ,EAAE,eAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,gBAAgB,CAAC;KACnD,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;QACN,OAAO,EAAE,cAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KAC7B,CAAC;IACF,YAAY,EAAE,eAAK,CAAC,OAAO,CAAC;QAC1B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;QACtD,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;KACR,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,MAAM,CAAC;QAClB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,EAAE;QACP,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC;KAChD,CAAC;CACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { FlagsConfig, SfdxCommand } from '@salesforce/command';
2
+ import { SandboxProcessObject } from '@salesforce/core';
3
+ export declare class OrgStatusCommand extends SfdxCommand {
4
+ static readonly examples: string[];
5
+ static readonly description: string;
6
+ static readonly requiresProject = false;
7
+ static readonly requiresUsername = true;
8
+ static readonly flagsConfig: FlagsConfig;
9
+ run(): Promise<SandboxProcessObject>;
10
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.OrgStatusCommand = void 0;
10
+ const os_1 = require("os");
11
+ const command_1 = require("@salesforce/command");
12
+ const core_1 = require("@salesforce/core");
13
+ const kit_1 = require("@salesforce/kit");
14
+ const sandboxReporter_1 = require("../../../shared/sandboxReporter");
15
+ core_1.Messages.importMessagesDirectory(__dirname);
16
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-org', 'status');
17
+ class OrgStatusCommand extends command_1.SfdxCommand {
18
+ async run() {
19
+ this.logger.debug('Status started with args %s ', this.flags);
20
+ const lifecycle = core_1.Lifecycle.getInstance();
21
+ // eslint-disable-next-line @typescript-eslint/require-await
22
+ lifecycle.on(core_1.SandboxEvents.EVENT_STATUS, async (results) => {
23
+ this.ux.log(sandboxReporter_1.SandboxReporter.sandboxProgress(results));
24
+ });
25
+ lifecycle.on(core_1.SandboxEvents.EVENT_RESULT, async (results) => {
26
+ var _a;
27
+ const resultMsg = `Sandbox ${results.sandboxProcessObj.SandboxName}(${results.sandboxProcessObj.Id}) is ready for use.`;
28
+ this.ux.log(resultMsg);
29
+ const { data } = sandboxReporter_1.SandboxReporter.logSandboxProcessResult(results);
30
+ this.ux.styledHeader('Sandbox Org Status');
31
+ this.ux.table(data, {
32
+ columns: [
33
+ { key: 'key', label: 'Name' },
34
+ { key: 'value', label: 'Value' },
35
+ ],
36
+ });
37
+ if ((_a = results.sandboxRes) === null || _a === void 0 ? void 0 : _a.authUserName) {
38
+ if (this.flags.setalias) {
39
+ const aliases = await core_1.Aliases.create(core_1.Aliases.getDefaultOptions());
40
+ const result = await aliases.updateValue(this.flags.setalias, results.sandboxRes.authUserName);
41
+ this.logger.debug('Set Alias: %s result: %s', this.flags.setalias, result);
42
+ }
43
+ if (this.flags.setdefaultusername) {
44
+ const globalConfig = this.configAggregator.getGlobalConfig();
45
+ globalConfig.set(core_1.Config.DEFAULT_USERNAME, results.sandboxRes.authUserName);
46
+ const result = await globalConfig.write();
47
+ this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
48
+ }
49
+ }
50
+ });
51
+ this.logger.debug('Calling auth for SandboxName args: %s ', this.flags.sandboxname);
52
+ const results = await this.org.sandboxStatus(this.flags.sandboxname, { wait: this.flags.wait });
53
+ this.logger.debug('Results for auth call: %s ', results);
54
+ if (!results) {
55
+ this.ux.styledHeader('Sandbox Org Creation Status');
56
+ this.ux.log('No SandboxProcess Result Found');
57
+ }
58
+ return results;
59
+ }
60
+ }
61
+ exports.OrgStatusCommand = OrgStatusCommand;
62
+ OrgStatusCommand.examples = messages.getMessage('examples').split(os_1.EOL);
63
+ OrgStatusCommand.description = messages.getMessage('description');
64
+ OrgStatusCommand.requiresProject = false;
65
+ OrgStatusCommand.requiresUsername = true;
66
+ OrgStatusCommand.flagsConfig = {
67
+ sandboxname: command_1.flags.string({
68
+ char: 'n',
69
+ description: messages.getMessage('flags.sandboxname'),
70
+ required: true,
71
+ }),
72
+ setdefaultusername: command_1.flags.boolean({
73
+ char: 's',
74
+ description: messages.getMessage('flags.setdefaultusername'),
75
+ }),
76
+ setalias: command_1.flags.string({
77
+ char: 'a',
78
+ description: messages.getMessage('flags.setalias'),
79
+ }),
80
+ wait: command_1.flags.minutes({
81
+ char: 'w',
82
+ description: messages.getMessage('flags.wait'),
83
+ min: kit_1.Duration.minutes(2),
84
+ default: kit_1.Duration.minutes(6),
85
+ }),
86
+ };
87
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/commands/force/org/status.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2BAAyB;AACzB,iDAAsE;AACtE,2CAS0B;AAC1B,yCAA2C;AAC3C,qEAAkE;AAElE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,Q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AC,EAAE,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;SAC/C;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;;AAvEH,4CAwEC;AAvEwB,yBAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,QAAG,CAAC,CAAC;AACtD,4BAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,gCAAe,GAAG,KAAK,CAAC;AACxB,iCAAgB,GAAG,IAAI,CAAC;AAExB,4BAAW,GAAgB;IAChD,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,kBAAkB,EAAE,eAAK,CAAC,OAAO,CAAC;QAChC,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;KAC7D,CAAC;IACF,QAAQ,EAAE,eAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,gBAAgB,CAAC;KACnD,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,OAAO,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;QAC9C,GAAG,EAAE,cAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACxB,OAAO,EAAE,cAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KAC7B,CAAC;CACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import * as Config from '@oclif/config';
2
+ import { Optional } from '@salesforce/ts-types';
3
+ import { AuthFields } from '@salesforce/core';
4
+ declare type HookOpts<T> = {
5
+ Command: Config.Command.Class;
6
+ argv: string[];
7
+ commandId: string;
8
+ result: Optional<T>;
9
+ };
10
+ export declare type OrgCreateResult = Pick<AuthFields, 'accessToken' | 'clientId' | 'created' | 'createdOrgInstance' | 'devHubUsername' | 'expirationDate' | 'instanceUrl' | 'loginUrl' | 'orgId' | 'username'>;
11
+ declare type PostOrgCreateOpts = HookOpts<OrgCreateResult>;
12
+ /**
13
+ * Extends OCLIF's Hooks interface to add types for hooks that run on sfdx org commands
14
+ */
15
+ export interface OrgHooks extends Config.Hooks {
16
+ postorgcreate: PostOrgCreateOpts;
17
+ }
18
+ export declare type OrgHook<T> = (this: Config.Hook.Context, options: T extends keyof Config.Hooks ? OrgHooks[T] : T) => any;
19
+ export declare namespace OrgHook {
20
+ type PostOrgCreate = Config.Hook<OrgHooks['postorgcreate']>;
21
+ }
22
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=orgHooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orgHooks.js","sourceRoot":"","sources":["../../src/shared/orgHooks.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,12 @@
1
+ import { StatusEvent, ResultEvent } from '@salesforce/core';
2
+ export declare class SandboxReporter {
3
+ static sandboxProgress(update: StatusEvent): string;
4
+ static logSandboxProcessResult(result: ResultEvent): {
5
+ sandboxReadyForUse: string;
6
+ data: Array<{
7
+ key: string;
8
+ value: string | number;
9
+ }>;
10
+ };
11
+ private static getSecondsToHuman;
12
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SandboxReporter = void 0;
4
+ const kit_1 = require("@salesforce/kit");
5
+ class SandboxReporter {
6
+ static sandboxProgress(update) {
7
+ const { retries, interval, sandboxProcessObj, waitingOnAuth } = update;
8
+ const waitTimeInSec = retries * interval;
9
+ const waitTime = SandboxReporter.getSecondsToHuman(waitTimeInSec);
10
+ const waitTimeMsg = `Sleeping ${interval} seconds. Will wait ${waitTime} more before timing out.`;
11
+ const sandboxIdentifierMsg = `${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id})`;
12
+ const waitingOnAuthMessage = waitingOnAuth ? ', waiting on JWT auth' : '';
13
+ const completionMessage = `(${sandboxProcessObj.CopyProgress}% completed${waitingOnAuthMessage})`;
14
+ return `Sandbox request ${sandboxIdentifierMsg} is ${sandboxProcessObj.Status} ${completionMessage}. ${waitTimeMsg}`;
15
+ }
16
+ static logSandboxProcessResult(result
17
+ // sandboxProcessObj.CopyProgress is a number
18
+ ) {
19
+ const { sandboxProcessObj, sandboxRes } = result;
20
+ const sandboxReadyForUse = `Sandbox ${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id}) is ready for use.`;
21
+ const data = [
22
+ { key: 'Id', value: sandboxProcessObj.Id },
23
+ { key: 'SandboxName', value: sandboxProcessObj.SandboxName },
24
+ { key: 'Status', value: sandboxProcessObj.Status },
25
+ { key: 'CopyProgress', value: sandboxProcessObj.CopyProgress },
26
+ { key: 'Description', value: sandboxProcessObj.Description },
27
+ { key: 'LicenseType', value: sandboxProcessObj.LicenseType },
28
+ { key: 'SandboxInfoId', value: sandboxProcessObj.SandboxInfoId },
29
+ { key: 'SourceId', value: sandboxProcessObj.SourceId },
30
+ { key: 'SandboxOrg', value: sandboxProcessObj.SandboxOrganization },
31
+ { key: 'Created Date', value: sandboxProcessObj.CreatedDate },
32
+ { key: 'ApexClassId', value: sandboxProcessObj.ApexClassId },
33
+ { key: 'Authorized Sandbox Username', value: sandboxRes.authUserName },
34
+ ];
35
+ return { sandboxReadyForUse, data };
36
+ }
37
+ static getSecondsToHuman(waitTimeInSec) {
38
+ const hours = kit_1.Duration.hours(Math.floor(waitTimeInSec / 3600));
39
+ const minutes = kit_1.Duration.minutes(Math.floor((waitTimeInSec % 3600) / 60));
40
+ const seconds = kit_1.Duration.seconds(Math.floor(waitTimeInSec % 60));
41
+ const hDisplay = hours.hours > 0 ? hours.toString() + ' ' : '';
42
+ const mDisplay = minutes.minutes > 0 ? minutes.toString() + ' ' : '';
43
+ const sDisplay = seconds.seconds > 0 ? seconds.toString() : '';
44
+ return (hDisplay + mDisplay + sDisplay).trim();
45
+ }
46
+ }
47
+ exports.SandboxReporter = SandboxReporter;
48
+ //# sourceMappingURL=sandboxReporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandboxReporter.js","sourceRoot":"","sources":["../../src/shared/sandboxReporter.ts"],"names":[],"mappings":";;;AAOA,yCAA2C;AAE3C,MAAa,eAAe;IACnB,MAAM,CAAC,eAAe,CAAC,MAAmB;QAC/C,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;QACvE,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;QAEzC,MAAM,QAAQ,GAAW,eAAe,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;QAC1E,MAAM,WAAW,GAAG,YAAY,QAAQ,uBAAuB,QAAQ,0BAA0B,CAAC;QAClG,MAAM,oBAAoB,GAAG,GAAG,iBAAiB,CAAC,WAAW,IAAI,iBAAiB,CAAC,EAAE,GAAG,CAAC;QACzF,MAAM,oBAAoB,GAAW,aAAa,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAC;QAClF,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,YAAY,cAAc,oBAAoB,GAAG,CAAC;QAElG,OAAO,mBAAmB,oBAAoB,OAAO,iBAAiB,CAAC,MAAM,IAAI,iBAAiB,KAAK,WAAW,EAAE,CAAC;IACvH,CAAC;IAEM,MAAM,CAAC,uBAAuB,CACnC,MAAmB;IACnB,6CAA6C;;QAE7C,MAAM,EAAE,iBAAiB,EAAE,UAAU,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CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,cAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC1E,MAAM,OAAO,GAAG,cAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC,CAAC,CAAC;QAEjE,MAAM,QAAQ,GAAW,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,MAAM,QAAQ,GAAW,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7E,MAAM,QAAQ,GAAW,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEvE,OAAO,CAAC,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,CAAC;CACF;AAlDD,0CAkDC"}
@@ -0,0 +1,37 @@
1
+ {
2
+ "description": "create a scratch or sandbox org \nCreates a scratch org or a sandbox org using the values specified in a configuration file or key=value pairs that you specify on the command line. Values specified on the command line override values in the configuration file. Specify a configuration file or provide key=value pairs while creating a scratch org or a sandbox. When creating scratch orgs, —targetdevhubusername (-v) must be a Dev Hub org. When creating sandboxes, the --targetusername (-u) must be a production org with sandbox licenses. The —type (-t) is required if creating a sandbox.\n\n",
3
+ "examples": [
4
+ "$ sfdx force:org:create -f config/enterprise-scratch-def.json -a MyScratchOrg",
5
+ "$ sfdx force:org:create edition=Developer -a MyScratchOrg -s -v devHub",
6
+ "$ sfdx force:org:create -f config/enterprise-scratch-def.json -a ScratchOrgWithOverrides username=testuser1@mycompany.org",
7
+ "$ sfdx force:org:create -t sandbox -f config/dev-sandbox-def.json -a MyDevSandbox -u prodOrg"
8
+ ],
9
+ "flags": {
10
+ "clientId": "connected app consumer key; not supported for sandbox org creation",
11
+ "setDefaultUsername": "set the created org as the default username",
12
+ "setAlias": "alias for the created org",
13
+ "definitionFile": "path to an org definition file",
14
+ "definitionJson": "org definition in JSON format",
15
+ "noNamespace": "create the scratch org with no namespace",
16
+ "noAncestors": "do not include second-generation package ancestors in the scratch org",
17
+ "env": "environment where the scratch org is created: %s",
18
+ "type": "type of org to create",
19
+ "durationDays": "duration of the scratch org (in days) (default:7, min:1, max:30)",
20
+ "retry": "Number of scratch org auth retries after scratch org is successfully signed up.",
21
+ "wait": "the streaming client socket timeout (in minutes)"
22
+ },
23
+ "scratchOrgCreateSuccess": "Successfully created scratch org: %s, username: %s.",
24
+ "clientIdNotSupported": "-i | --clientid is not supported for the sandbox org create command. Its value, %s, has been ignored.",
25
+ "noNamespaceNotSupported": "-n | --nonamespace is not supported for the sandbox org create command. Its value, %s, has been ignored.",
26
+ "noAncestorsNotSupported": "-c | --noancestors is not supported for the sandbox org create command. Its value, %s, has been ignored.",
27
+ "durationDaysNotSupported": "-d | --durationdays is not supported for the sandbox org create command. Its value, %s, has been ignored.",
28
+ "retryIsNotValidForSandboxes": "One cannot use flag retry with Sandbox org create.",
29
+ "sandboxSuccess": "The sandbox org creation process %s is in progress. Run \"sfdx force:org:status -n %s -u %s\" to check for status. If the org is ready, checking the status also authorizes the org for use with Salesforce CLI.",
30
+ "requiresUsername": "This command requires a username. Specify it with the -u parameter or with the \"sfdx config:set defaultusername=<username>\" command.",
31
+ "missingLicenseType": "The sandbox license type is required, but you didn't provide a value. Specify the license type in the sandbox definition file with the \"licenseType\" option, or specify the option as a name-value pair at the command-line. See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_sandbox_definition.htm for more information.",
32
+ "dnsTimeout": "The sandbox was successfully created and authenticated. However, the sandbox DNS records aren't ready yet and so the sandbox may not be available. Run \"force:org:list\" and check if the sandbox is listed correctly. If it isn't listed, run \"force:org:status\" to view its status and, if necessary, authenticate to it again. If this issue happens frequently, try setting the SFDX_DNS_TIMEOUT environment variable to a larger number; the default value is 3 seconds.",
33
+ "partialSuccess": "If you specified the -a or -s parameters, but the sandbox wasn't immediately available, the \"force:org:create\" command may not have finished setting the alias or defaultusername. If so, set the alias manually with \"sfdx alias:set\" and the defaultusername with \"sfdx config:set\".",
34
+ "noConfig": "Please specify an org configuration via file and/or key=value pairs.",
35
+ "RequiresDevhubUsernameError": "This command requires a dev hub org username set either with a flag or by default in the config.",
36
+ "secretPrompt": "OAuth client secret of personal connected app?"
37
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "examples": [
3
+ "sfdx force:org:status --sandboxname DevSbx1 --setalias MySandbox -u prodOrg",
4
+ "sfdx force:org:status --sandboxname DevSbx1 --wait 45 --setdefaultusername -u prodOrg"
5
+ ],
6
+ "description": "report status of sandbox creation or clone and authenticate to it\nUse this command to check the status of your sandbox creation or clone and, if the sandbox is ready, authenticate to it.\nUse the --wait (-w) parameter to specify the number of minutes that the command waits for the sandbox creation or clone to complete before returning control of the terminal to you.\nSet the --targetusername (-u) parameter to the username or alias of the production org that contains the sandbox license.",
7
+ "flags": {
8
+ "sandboxname": "name of the sandbox org to check status for",
9
+ "wait": "number of minutes to wait while polling for status",
10
+ "setdefaultusername": "set the created or cloned org as your default",
11
+ "setalias": "alias for the created or cloned org"
12
+ }
13
+ }
@@ -1 +1 @@
1
- {"version":"1.11.0","commands":{"force:org:delete":{"id":"force:org:delete","description":"mark a scratch or sandbox org for deletion \nTo mark the org for deletion without being prompted to confirm, specify --noprompt.","usage":"<%= command.id %> [-p] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["$ sfdx force:org:delete -u me@my.org","$ sfdx force:org:delete -u MyOrgAlias -p"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetdevhubusername":{"name":"targetdevhubusername","type":"option","char":"v","description":"username or alias for the dev hub org; overrides default dev hub org"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"noprompt":{"name":"noprompt","type":"boolean","char":"p","description":"no prompt to confirm deletion","allowNo":false}},"args":[]},"force:org:display":{"id":"force:org:display","description":"get the description for the current or target org\nOutput includes your access token, client Id, connected status, org ID, instance URL, username, and alias, if applicable.\nUse --verbose to include the SFDX auth URL. WARNING: The SFDX auth URL contains sensitive information, such as a refresh token that can be used to access an org. Don't share or distribute this URL or token.\nIncluding --verbose displays the sfdxAuthUrl property only if you authenticated to the org using auth:web:login (not auth:jwt:grant)","usage":"<%= command.id %> [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["sfdx force:org:display","sfdx force:org:display -u me@my.org","sfdx force:org:display -u TestOrg1 --json","sfdx force:org:display -u TestOrg1 --json > tmp/MyOrgDesc.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"verbose":{"name":"verbose","type":"boolean","description":"emit additional command output to stdout","allowNo":false}},"args":[]},"force:org:list":{"id":"force:org:list","description":"list all orgs you’ve created or authenticated to","usage":"<%= command.id %> [--all] [-p --clean] [--skipconnectionstatus] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["sfdx force:org:list","sfdx force:org:list --verbose --json","sfdx force:org:list --verbose --json > tmp/MyOrgList.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"verbose":{"name":"verbose","type":"boolean","description":"list more information about each org","allowNo":false},"all":{"name":"all","type":"boolean","description":"include expired, deleted, and unknown-status scratch orgs","allowNo":false},"clean":{"name":"clean","type":"boolean","description":"remove all local org authorizations for non-active orgs","allowNo":false},"noprompt":{"name":"noprompt","type":"boolean","char":"p","description":"do not prompt for confirmation","allowNo":false},"skipconnectionstatus":{"name":"skipconnectionstatus","type":"boolean","description":"skip retrieving the connection status of non-scratch orgs","allowNo":false}},"args":[]},"force:org:open":{"id":"force:org:open","description":"open your default scratch org, or another specified org\nTo open a specific page, specify the portion of the URL after \"https://MyDomainName.my.salesforce.com/\" as --path.\nFor example, specify \"--path lightning\" to open Lightning Experience, or specify \"--path /apex/YourPage\" to open a Visualforce page.\nTo generate a URL but not launch it in your browser, specify --urlonly.\nTo open in a specific browser, use the --browser parameter. Supported browsers are \"chrome\", \"edge\", and \"firefox\". If you don't specify --browser, the org opens in your default browser.","usage":"<%= command.id %> [-b <string> | -r] [-p <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["sfdx force:org:open","sfdx force:org:open -u me@my.org","sfdx force:org:open -u MyTestOrg1","sfdx force:org:open -r -p lightning","sfdx force:org:open -u me@my.org -b firefox"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"browser":{"name":"browser","type":"option","char":"b","description":"browser where the org opens","options":["chrome","edge","firefox"]},"path":{"name":"path","type":"option","char":"p","description":"navigation URL path"},"urlonly":{"name":"urlonly","type":"boolean","char":"r","description":"display navigation URL, but don’t launch browser","allowNo":false}},"args":[]}}}
1
+ {"version":"1.12.0","commands":{"force:org:delete":{"id":"force:org:delete","description":"mark a scratch or sandbox org for deletion \nTo mark the org for deletion without being prompted to confirm, specify --noprompt.","usage":"<%= command.id %> [-p] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["$ sfdx force:org:delete -u me@my.org","$ sfdx force:org:delete -u MyOrgAlias -p"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetdevhubusername":{"name":"targetdevhubusername","type":"option","char":"v","description":"username or alias for the dev hub org; overrides default dev hub org"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"noprompt":{"name":"noprompt","type":"boolean","char":"p","description":"no prompt to confirm deletion","allowNo":false}},"args":[]},"force:org:display":{"id":"force:org:display","description":"get the description for the current or target org\nOutput includes your access token, client Id, connected status, org ID, instance URL, username, and alias, if applicable.\nUse --verbose to include the SFDX auth URL. WARNING: The SFDX auth URL contains sensitive information, such as a refresh token that can be used to access an org. Don't share or distribute this URL or token.\nIncluding --verbose displays the sfdxAuthUrl property only if you authenticated to the org using auth:web:login (not auth:jwt:grant)","usage":"<%= command.id %> [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["sfdx force:org:display","sfdx force:org:display -u me@my.org","sfdx force:org:display -u TestOrg1 --json","sfdx force:org:display -u TestOrg1 --json > tmp/MyOrgDesc.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"verbose":{"name":"verbose","type":"boolean","description":"emit additional command output to stdout","allowNo":false}},"args":[]},"force:org:list":{"id":"force:org:list","description":"list all orgs you’ve created or authenticated to","usage":"<%= command.id %> [--all] [-p --clean] [--skipconnectionstatus] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["sfdx force:org:list","sfdx force:org:list --verbose --json","sfdx force:org:list --verbose --json > tmp/MyOrgList.json"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"verbose":{"name":"verbose","type":"boolean","description":"list more information about each org","allowNo":false},"all":{"name":"all","type":"boolean","description":"include expired, deleted, and unknown-status scratch orgs","allowNo":false},"clean":{"name":"clean","type":"boolean","description":"remove all local org authorizations for non-active orgs","allowNo":false},"noprompt":{"name":"noprompt","type":"boolean","char":"p","description":"do not prompt for confirmation","allowNo":false},"skipconnectionstatus":{"name":"skipconnectionstatus","type":"boolean","description":"skip retrieving the connection status of non-scratch orgs","allowNo":false}},"args":[]},"force:org:open":{"id":"force:org:open","description":"open your default scratch org, or another specified org\nTo open a specific page, specify the portion of the URL after \"https://MyDomainName.my.salesforce.com/\" as --path.\nFor example, specify \"--path lightning\" to open Lightning Experience, or specify \"--path /apex/YourPage\" to open a Visualforce page.\nTo generate a URL but not launch it in your browser, specify --urlonly.\nTo open in a specific browser, use the --browser parameter. Supported browsers are \"chrome\", \"edge\", and \"firefox\". If you don't specify --browser, the org opens in your default browser.","usage":"<%= command.id %> [-b <string> | -r] [-p <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["sfdx force:org:open","sfdx force:org:open -u me@my.org","sfdx force:org:open -u MyTestOrg1","sfdx force:org:open -r -p lightning","sfdx force:org:open -u me@my.org -b firefox"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"browser":{"name":"browser","type":"option","char":"b","description":"browser where the org opens","options":["chrome","edge","firefox"]},"path":{"name":"path","type":"option","char":"p","description":"navigation URL path"},"urlonly":{"name":"urlonly","type":"boolean","char":"r","description":"display navigation URL, but don’t launch browser","allowNo":false}},"args":[]},"force:org:status":{"id":"force:org:status","description":"report status of sandbox creation or clone and authenticate to it\nUse this command to check the status of your sandbox creation or clone and, if the sandbox is ready, authenticate to it.\nUse the --wait (-w) parameter to specify the number of minutes that the command waits for the sandbox creation or clone to complete before returning control of the terminal to you.\nSet the --targetusername (-u) parameter to the username or alias of the production org that contains the sandbox license.","usage":"<%= command.id %> -n <string> [-s] [-a <string>] [-w <minutes>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["sfdx force:org:status --sandboxname DevSbx1 --setalias MySandbox -u prodOrg","sfdx force:org:status --sandboxname DevSbx1 --wait 45 --setdefaultusername -u prodOrg"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"sandboxname":{"name":"sandboxname","type":"option","char":"n","description":"name of the sandbox org to check status for","required":true},"setdefaultusername":{"name":"setdefaultusername","type":"boolean","char":"s","description":"set the created or cloned org as your default","allowNo":false},"setalias":{"name":"setalias","type":"option","char":"a","description":"alias for the created or cloned org"},"wait":{"name":"wait","type":"option","char":"w","description":"number of minutes to wait while polling for status","default":{"quantity":6,"unit":0}}},"args":[]},"force:org:beta:create":{"id":"force:org:beta:create","description":"create a scratch or sandbox org \nCreates a scratch org or a sandbox org using the values specified in a configuration file or key=value pairs that you specify on the command line. Values specified on the command line override values in the configuration file. Specify a configuration file or provide key=value pairs while creating a scratch org or a sandbox. When creating scratch orgs, —targetdevhubusername (-v) must be a Dev Hub org. When creating sandboxes, the --targetusername (-u) must be a production org with sandbox licenses. The —type (-t) is required if creating a sandbox.\n\n","usage":"<%= command.id %> [name=value...] [-t scratch|sandbox] [-f <filepath>] [-n] [-c] [-i <string>] [-s] [-a <string>] [-w <minutes>] [-d <integer>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-org","pluginType":"core","aliases":[],"examples":["$ sfdx force:org:create -f config/enterprise-scratch-def.json -a MyScratchOrg","$ sfdx force:org:create edition=Developer -a MyScratchOrg -s -v devHub","$ sfdx force:org:create -f config/enterprise-scratch-def.json -a ScratchOrgWithOverrides username=testuser1@mycompany.org","$ sfdx force:org:create -t sandbox -f config/dev-sandbox-def.json -a MyDevSandbox -u prodOrg"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetdevhubusername":{"name":"targetdevhubusername","type":"option","char":"v","description":"username or alias for the dev hub org; overrides default dev hub org"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"type":{"name":"type","type":"option","char":"t","description":"type of org to create","helpValue":"(scratch|sandbox)","options":["scratch","sandbox"],"default":"scratch"},"definitionfile":{"name":"definitionfile","type":"option","char":"f","description":"path to an org definition file"},"nonamespace":{"name":"nonamespace","type":"boolean","char":"n","description":"create the scratch org with no namespace","allowNo":false},"noancestors":{"name":"noancestors","type":"boolean","char":"c","description":"do not include second-generation package ancestors in the scratch org","allowNo":false},"clientid":{"name":"clientid","type":"option","char":"i","description":"connected app consumer key; not supported for sandbox org creation"},"setdefaultusername":{"name":"setdefaultusername","type":"boolean","char":"s","description":"set the created org as the default username","allowNo":false},"setalias":{"name":"setalias","type":"option","char":"a","description":"alias for the created org"},"wait":{"name":"wait","type":"option","char":"w","description":"the streaming client socket timeout (in minutes)","default":{"quantity":6,"unit":0}},"durationdays":{"name":"durationdays","type":"option","char":"d","description":"duration of the scratch org (in days) (default:7, min:1, max:30)"},"retry":{"name":"retry","type":"option","description":"Number of scratch org auth retries after scratch org is successfully signed up.","hidden":true,"default":0}},"args":[]}}}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-org",
3
3
  "description": "A template repository for sfdx plugins",
4
- "version": "1.11.0",
4
+ "version": "1.12.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "dependencies": {
8
8
  "@oclif/config": "^1.18.1",
9
- "@salesforce/command": "^4.2.0",
10
- "@salesforce/core": "^2.31.0",
9
+ "@salesforce/command": "^4.2.2",
10
+ "@salesforce/core": "^2.36.3",
11
11
  "@salesforce/kit": "^1.5.17",
12
12
  "open": "8.4.0",
13
13
  "tslib": "^2"
@@ -15,12 +15,13 @@
15
15
  "devDependencies": {
16
16
  "@oclif/dev-cli": "^1",
17
17
  "@oclif/plugin-command-snapshot": "^2.2.2",
18
- "@salesforce/cli-plugins-testkit": "^1.4.10",
19
- "@salesforce/dev-config": "^2.1.2",
20
- "@salesforce/dev-scripts": "^1.0.0",
18
+ "@salesforce/cli-plugins-testkit": "^1.5.3",
19
+ "@salesforce/dev-config": "^3.0.0",
20
+ "@salesforce/dev-scripts": "^2.0.0",
21
21
  "@salesforce/plugin-command-reference": "^1.3.0",
22
22
  "@salesforce/prettier-config": "^0.0.2",
23
23
  "@salesforce/ts-sinon": "1.3.21",
24
+ "@types/shelljs": "^0.8.10",
24
25
  "@typescript-eslint/eslint-plugin": "^4.33.0",
25
26
  "@typescript-eslint/parser": "^4.33.0",
26
27
  "chai": "^4.2.0",
@@ -32,21 +33,25 @@
32
33
  "eslint-config-salesforce-license": "^0.1.6",
33
34
  "eslint-config-salesforce-typescript": "^0.2.8",
34
35
  "eslint-plugin-header": "^3.0.0",
35
- "eslint-plugin-import": "2.25.2",
36
+ "eslint-plugin-import": "2.25.4",
36
37
  "eslint-plugin-jsdoc": "^35.1.2",
37
38
  "eslint-plugin-prettier": "^3.1.3",
38
39
  "husky": "^7.0.4",
39
40
  "lint-staged": "^11.0.0",
40
- "mocha": "^8.4.0",
41
+ "mocha": "^9.1.3",
41
42
  "moment": "^2.29.1",
42
43
  "nyc": "^15.1.0",
43
44
  "prettier": "^2.4.1",
44
45
  "pretty-quick": "^3.1.0",
45
- "shx": "0.3.3",
46
+ "shelljs": "^0.8.5",
47
+ "shx": "0.3.4",
46
48
  "sinon": "10.0.0",
47
49
  "ts-node": "^10.0.0",
48
50
  "typescript": "^4.4.4"
49
51
  },
52
+ "resolutions": {
53
+ "@salesforce/core": "^2.36.3"
54
+ },
50
55
  "config": {
51
56
  "commitizen": {
52
57
  "path": "cz-conventional-changelog"
@@ -108,13 +113,14 @@
108
113
  "test:command-reference": "./bin/run commandreference:generate --erroronwarnings",
109
114
  "test:deprecation-policy": "./bin/run snapshot:compare",
110
115
  "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
116
+ "test:nuts:sandbox": "nyc mocha \"**/*.sandboxNut.ts\" --slow 450000 --timeout 7200000",
111
117
  "version": "oclif-dev readme"
112
118
  },
113
119
  "publishConfig": {
114
120
  "access": "public"
115
121
  },
116
122
  "sfdx": {
117
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/1.11.0.crt",
118
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/1.11.0.sig"
123
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/1.12.0.crt",
124
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/1.12.0.sig"
119
125
  }
120
126
  }