@salesforce/core 3.13.0 → 3.15.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/config/config.d.ts +23 -1
  3. package/lib/config/config.js +28 -18
  4. package/lib/config/configAggregator.d.ts +37 -24
  5. package/lib/config/configAggregator.js +83 -41
  6. package/lib/config/envVars.js +3 -3
  7. package/lib/config/sandboxProcessCache.d.ts +15 -0
  8. package/lib/config/sandboxProcessCache.js +38 -0
  9. package/lib/exported.d.ts +5 -3
  10. package/lib/exported.js +8 -2
  11. package/lib/globalInfo/accessors/sandboxAccessor.d.ts +36 -0
  12. package/lib/globalInfo/accessors/sandboxAccessor.js +63 -0
  13. package/lib/globalInfo/globalInfoConfig.d.ts +2 -0
  14. package/lib/globalInfo/globalInfoConfig.js +5 -0
  15. package/lib/globalInfo/sfdxDataHandler.d.ts +12 -2
  16. package/lib/globalInfo/sfdxDataHandler.js +116 -25
  17. package/lib/globalInfo/types.d.ts +19 -1
  18. package/lib/globalInfo/types.js +1 -0
  19. package/lib/org/authInfo.d.ts +2 -1
  20. package/lib/org/authInfo.js +2 -1
  21. package/lib/org/connection.js +4 -4
  22. package/lib/org/org.d.ts +61 -39
  23. package/lib/org/org.js +261 -159
  24. package/lib/org/scratchOrgCache.d.ts +19 -0
  25. package/lib/org/scratchOrgCache.js +33 -0
  26. package/lib/org/scratchOrgCreate.d.ts +25 -16
  27. package/lib/org/scratchOrgCreate.js +110 -41
  28. package/lib/org/scratchOrgErrorCodes.d.ts +8 -2
  29. package/lib/org/scratchOrgErrorCodes.js +26 -3
  30. package/lib/org/scratchOrgInfoApi.d.ts +19 -8
  31. package/lib/org/scratchOrgInfoApi.js +91 -42
  32. package/lib/org/scratchOrgLifecycleEvents.d.ts +2 -0
  33. package/lib/org/scratchOrgLifecycleEvents.js +20 -1
  34. package/lib/org/scratchOrgSettingsGenerator.d.ts +7 -2
  35. package/lib/org/scratchOrgSettingsGenerator.js +1 -0
  36. package/lib/sfProject.js +1 -1
  37. package/lib/status/pollingClient.js +1 -0
  38. package/lib/testSetup.js +0 -2
  39. package/messages/org.md +9 -1
  40. package/messages/scratchOrgCreate.md +20 -0
  41. package/package.json +2 -2
package/lib/org/org.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
2
- import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types';
2
+ import { AnyJson, JsonMap, Nullable, Optional } from '@salesforce/ts-types';
3
3
  import { ConfigAggregator } from '../config/configAggregator';
4
4
  import { OrgUsersConfig } from '../config/orgUsersConfig';
5
- import { SandboxOrgConfig } from '../config/sandboxOrgConfig';
5
+ import { SfSandbox } from '../globalInfo';
6
6
  import { Connection } from './connection';
7
7
  import { AuthFields, AuthInfo } from './authInfo';
8
8
  import { ScratchOrgCreateOptions, ScratchOrgCreateResult } from './scratchOrgCreate';
@@ -20,7 +20,7 @@ export declare enum OrgTypes {
20
20
  export interface StatusEvent {
21
21
  sandboxProcessObj: SandboxProcessObject;
22
22
  interval: number;
23
- retries: number;
23
+ remainingWait: number;
24
24
  waitingOnAuth: boolean;
25
25
  }
26
26
  export interface ResultEvent {
@@ -36,7 +36,8 @@ export declare enum SandboxEvents {
36
36
  EVENT_STATUS = "status",
37
37
  EVENT_ASYNC_RESULT = "asyncResult",
38
38
  EVENT_RESULT = "result",
39
- EVENT_AUTH = "auth"
39
+ EVENT_AUTH = "auth",
40
+ EVENT_RESUME = "resume"
40
41
  }
41
42
  export interface SandboxUserAuthResponse {
42
43
  authUserName: string;
@@ -44,7 +45,7 @@ export interface SandboxUserAuthResponse {
44
45
  instanceUrl: string;
45
46
  loginUrl: string;
46
47
  }
47
- export interface SandboxProcessObject {
48
+ export declare type SandboxProcessObject = {
48
49
  Id: string;
49
50
  Status: string;
50
51
  SandboxName: string;
@@ -57,13 +58,17 @@ export interface SandboxProcessObject {
57
58
  Description?: string;
58
59
  ApexClassId?: string;
59
60
  EndDate?: string;
60
- }
61
+ };
61
62
  export declare type SandboxRequest = {
62
63
  SandboxName: string;
63
64
  LicenseType?: string;
64
65
  SourceId?: string;
65
66
  Description?: string;
66
67
  };
68
+ export declare type ResumeSandboxRequest = {
69
+ SandboxName?: string;
70
+ SandboxProcessObjId?: string;
71
+ };
67
72
  export declare type ScratchOrgRequest = Pick<ScratchOrgCreateOptions, 'connectedAppConsumerKey' | 'durationDays' | 'nonamespace' | 'noancestors' | 'wait' | 'retry' | 'apiversion' | 'definitionjson' | 'definitionfile' | 'orgConfig' | 'clientSecret'>;
68
73
  /**
69
74
  * Provides a way to manage a locally authenticated Org.
@@ -109,9 +114,23 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
109
114
  * @param sandboxReq SandboxRequest options to create the sandbox with
110
115
  * @param options Wait: The amount of time to wait before timing out, Interval: The time interval between polling
111
116
  */
112
- createSandbox(sandboxReq: SandboxRequest, options: {
117
+ createSandbox(sandboxReq: SandboxRequest, options?: {
118
+ wait?: Duration;
119
+ interval?: Duration;
120
+ async?: boolean;
121
+ }): Promise<SandboxProcessObject>;
122
+ /**
123
+ * resume a sandbox creation from a production org
124
+ * 'this' needs to be a production org with sandbox licenses available
125
+ *
126
+ * @param resumeSandboxRequest SandboxRequest options to create the sandbox with
127
+ * @param options Wait: The amount of time to wait (default: 30 minutes) before timing out,
128
+ * Interval: The time interval (default: 30 seconds) between polling
129
+ */
130
+ resumeSandbox(resumeSandboxRequest: ResumeSandboxRequest, options?: {
113
131
  wait?: Duration;
114
132
  interval?: Duration;
133
+ async?: boolean;
115
134
  }): Promise<SandboxProcessObject>;
116
135
  /**
117
136
  * Creates a scratchOrg
@@ -133,9 +152,7 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
133
152
  */
134
153
  retrieveOrgUsersConfig(): Promise<OrgUsersConfig>;
135
154
  /**
136
- * Removes the scratch org config file at $HOME/.sfdx/[name].json, any project level org
137
- * files, all user auth files for the org, matching default config settings, and any
138
- * matching aliases.
155
+ * Cleans up all org related artifacts including users, sandbox config(if a sandbox and auth file.
139
156
  *
140
157
  * @param throwWhenRemoveFails Determines if the call should throw an error or fail silently.
141
158
  */
@@ -259,17 +276,18 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
259
276
  */
260
277
  removeUsername(auth: AuthInfo | string): Promise<Org>;
261
278
  /**
262
- * Sets the key/value pair in the sandbox config for this org. For convenience `this` object is returned.
279
+ * set the sandbox config related to this given org
263
280
  *
264
- *
265
- * @param {key} The key for this value
266
- * @param {value} The value to save
281
+ * @param orgId {string} orgId of the sandbox
282
+ * @param config {SfSandbox} config of the sandbox
267
283
  */
268
- setSandboxOrgConfigField(field: SandboxOrgConfig.Fields, value: string): Promise<Org>;
284
+ setSandboxConfig(orgId: string, config: SfSandbox): Promise<Org>;
269
285
  /**
270
- * Returns an org config field. Returns undefined if the field is not set or invalid.
286
+ * get the sandbox config for the given orgId
287
+ *
288
+ * @param orgId {string} orgId of the sandbox
271
289
  */
272
- getSandboxOrgConfigField(field: SandboxOrgConfig.Fields): Promise<any>;
290
+ getSandboxConfig(orgId: string): Promise<Nullable<SfSandbox>>;
273
291
  /**
274
292
  * Retrieves the highest api version that is supported by the target server instance. If the apiVersion configured for
275
293
  * Sfdx is greater than the one returned in this call an api version mismatch occurs. In the case of the CLI that
@@ -300,6 +318,28 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
300
318
  * Returns the JSForce connection for the org.
301
319
  */
302
320
  getConnection(): Connection;
321
+ supportsSourceTracking(): Promise<boolean>;
322
+ /**
323
+ * query SandboxProcess via sandbox name
324
+ *
325
+ * @param name SandboxName to query for
326
+ * @private
327
+ */
328
+ querySandboxProcessBySandboxName(name: string): Promise<SandboxProcessObject>;
329
+ /**
330
+ * query SandboxProcess via SandboxInfoId
331
+ *
332
+ * @param id SandboxInfoId to query for
333
+ * @private
334
+ */
335
+ querySandboxProcessBySandboxInfoId(id: string): Promise<SandboxProcessObject>;
336
+ /**
337
+ * query SandboxProcess via Id
338
+ *
339
+ * @param id SandboxProcessId to query for
340
+ * @private
341
+ */
342
+ querySandboxProcessById(id: string): Promise<SandboxProcessObject>;
303
343
  /**
304
344
  * Initialize async components.
305
345
  */
@@ -334,10 +374,6 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
334
374
  * Deletes the users config file
335
375
  */
336
376
  private removeUsersConfig;
337
- /**
338
- * @ignore
339
- */
340
- private retrieveSandboxOrgConfig;
341
377
  private manageDelete;
342
378
  /**
343
379
  * Remove the org users auth file.
@@ -345,38 +381,24 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
345
381
  * @param throwWhenRemoveFails true if manageDelete should throw or not if the deleted fails.
346
382
  */
347
383
  private removeUsers;
348
- /**
349
- * Remove an associate sandbox config.
350
- *
351
- * @param throwWhenRemoveFails true if manageDelete should throw or not if the deleted fails.
352
- */
353
384
  private removeSandboxConfig;
354
385
  private writeSandboxAuthFile;
355
- /**
356
- * Polls for the new sandbox to be created - and will write the associated auth files
357
- *
358
- * @private
359
- * @param options
360
- * sandboxProcessObj: The in-progress sandbox signup request
361
- * retries: the number of retries to poll for every 30s
362
- * shouldPoll: wait for polling, or just return
363
- * pollInterval: Duration to sleep between poll events, default 30 seconds
364
- */
365
386
  private pollStatusAndAuth;
366
387
  /**
367
- * query SandboxProcess via SandboxInfoId
388
+ * query SandboxProcess using supplied where clause
368
389
  *
369
- * @param id SandboxInfoId to query for
390
+ * @param where clause to query for
370
391
  * @private
371
392
  */
372
393
  private querySandboxProcess;
373
394
  /**
374
395
  * determines if the sandbox has successfully been created
375
396
  *
376
- * @param sandboxProcessObj sandbox signup progeress
397
+ * @param sandboxProcessObj sandbox signup progress
377
398
  * @private
378
399
  */
379
400
  private sandboxSignupComplete;
401
+ private validateWaitOptions;
380
402
  }
381
403
  export declare namespace Org {
382
404
  /**