@salesforce/core 3.7.6 → 3.7.9

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 (58) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -4
  3. package/lib/config/config.d.ts +7 -5
  4. package/lib/config/config.js +14 -9
  5. package/lib/config/configAggregator.d.ts +2 -2
  6. package/lib/config/configAggregator.js +2 -2
  7. package/lib/config/configFile.d.ts +2 -2
  8. package/lib/config/configFile.js +22 -20
  9. package/lib/config/configStore.js +5 -5
  10. package/lib/config/keychainConfig.js +4 -3
  11. package/lib/crypto/keyChainImpl.js +12 -10
  12. package/lib/deviceOauthService.js +2 -2
  13. package/lib/exported.d.ts +3 -4
  14. package/lib/exported.js +9 -7
  15. package/lib/global.js +2 -2
  16. package/lib/globalInfo/accessors/aliasAccessor.js +2 -2
  17. package/lib/globalInfo/sfdxDataHandler.d.ts +1 -1
  18. package/lib/globalInfo/sfdxDataHandler.js +5 -4
  19. package/lib/logger.d.ts +3 -3
  20. package/lib/logger.js +21 -19
  21. package/lib/messages.d.ts +42 -3
  22. package/lib/messages.js +55 -12
  23. package/lib/org/authInfo.d.ts +1 -1
  24. package/lib/org/authInfo.js +6 -6
  25. package/lib/org/authRemover.d.ts +2 -2
  26. package/lib/org/authRemover.js +2 -2
  27. package/lib/org/connection.d.ts +1 -1
  28. package/lib/org/connection.js +4 -4
  29. package/lib/org/org.d.ts +4 -4
  30. package/lib/org/org.js +16 -16
  31. package/lib/org/permissionSetAssignment.js +2 -2
  32. package/lib/org/scratchOrgCreate.js +4 -4
  33. package/lib/org/scratchOrgErrorCodes.js +6 -6
  34. package/lib/org/scratchOrgInfoApi.js +16 -16
  35. package/lib/org/scratchOrgInfoGenerator.d.ts +3 -3
  36. package/lib/org/scratchOrgInfoGenerator.js +17 -17
  37. package/lib/org/scratchOrgSettingsGenerator.js +2 -2
  38. package/lib/org/user.js +4 -4
  39. package/lib/schema/printer.js +2 -2
  40. package/lib/schema/validator.d.ts +4 -4
  41. package/lib/schema/validator.js +13 -13
  42. package/lib/{sfdxError.d.ts → sfError.d.ts} +14 -14
  43. package/lib/{sfdxError.js → sfError.js} +20 -21
  44. package/lib/{sfdxProject.d.ts → sfProject.d.ts} +37 -27
  45. package/lib/{sfdxProject.js → sfProject.js} +77 -65
  46. package/lib/status/pollingClient.js +3 -3
  47. package/lib/status/streamingClient.d.ts +2 -2
  48. package/lib/status/streamingClient.js +6 -6
  49. package/lib/testSetup.d.ts +4 -4
  50. package/lib/testSetup.js +8 -8
  51. package/lib/util/internal.d.ts +28 -2
  52. package/lib/util/internal.js +64 -6
  53. package/lib/util/sfdcUrl.d.ts +2 -2
  54. package/lib/util/sfdcUrl.js +2 -2
  55. package/lib/webOAuthServer.js +10 -10
  56. package/package.json +5 -5
  57. package/lib/util/fs.d.ts +0 -201
  58. package/lib/util/fs.js +0 -378
@@ -13,10 +13,10 @@ import { JsonMap } from '@salesforce/ts-types';
13
13
  * const messages = Messages.load('myPackageName', 'myBundleName');
14
14
  *
15
15
  * // To throw a non-bundle based error:
16
- * throw new SfdxError(message.getMessage('myError'), 'MyErrorName');
16
+ * throw new SfError(message.getMessage('myError'), 'MyErrorName');
17
17
  * ```
18
18
  */
19
- export declare class SfdxError extends NamedError {
19
+ export declare class SfError extends NamedError {
20
20
  /**
21
21
  * Action messages. Hints to the users regarding what can be done to fix related issues.
22
22
  */
@@ -35,21 +35,21 @@ export declare class SfdxError extends NamedError {
35
35
  */
36
36
  private _code?;
37
37
  /**
38
- * Create an SfdxError.
38
+ * Create an SfError.
39
39
  *
40
40
  * @param message The error message.
41
- * @param name The error name. Defaults to 'SfdxError'.
41
+ * @param name The error name. Defaults to 'SfError'.
42
42
  * @param actions The action message(s).
43
43
  * @param exitCodeOrCause The exit code which will be used by SfdxCommand or he underlying error that caused this error to be raised.
44
44
  * @param cause The underlying error that caused this error to be raised.
45
45
  */
46
46
  constructor(message: string, name?: string, actions?: string[], exitCodeOrCause?: number | Error, cause?: Error);
47
47
  /**
48
- * Convert an Error to an SfdxError.
48
+ * Convert an Error to an SfError.
49
49
  *
50
50
  * @param err The error to convert.
51
51
  */
52
- static wrap(err: Error | string): SfdxError;
52
+ static wrap(err: Error | string): SfError;
53
53
  get code(): string | undefined | any;
54
54
  set code(code: string);
55
55
  /**
@@ -57,20 +57,20 @@ export declare class SfdxError extends NamedError {
57
57
  *
58
58
  * @param context The command name.
59
59
  */
60
- setContext(context: string): SfdxError;
60
+ setContext(context: string): SfError;
61
61
  /**
62
62
  * An additional payload for the error. For convenience `this` object is returned.
63
63
  *
64
64
  * @param data The payload data.
65
65
  */
66
- setData(data: unknown): SfdxError;
66
+ setData(data: unknown): SfError;
67
67
  /**
68
- * Convert an {@link SfdxError} state to an object. Returns a plain object representing the state of this error.
68
+ * Convert an {@link SfError} state to an object. Returns a plain object representing the state of this error.
69
69
  */
70
70
  toObject(): JsonMap;
71
- /**
72
- * @deprecated Does nothing. Do not use. This is kept around to support older versions of SfdxCommand.
73
- * @param commandName
74
- */
75
- setCommandName(): void;
71
+ }
72
+ /**
73
+ * @deprecated use SfError instead
74
+ */
75
+ export declare class SfdxError extends SfError {
76
76
  }
@@ -6,7 +6,7 @@
6
6
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.SfdxError = void 0;
9
+ exports.SfdxError = exports.SfError = void 0;
10
10
  const kit_1 = require("@salesforce/kit");
11
11
  const ts_types_1 = require("@salesforce/ts-types");
12
12
  /**
@@ -22,22 +22,22 @@ const ts_types_1 = require("@salesforce/ts-types");
22
22
  * const messages = Messages.load('myPackageName', 'myBundleName');
23
23
  *
24
24
  * // To throw a non-bundle based error:
25
- * throw new SfdxError(message.getMessage('myError'), 'MyErrorName');
25
+ * throw new SfError(message.getMessage('myError'), 'MyErrorName');
26
26
  * ```
27
27
  */
28
- class SfdxError extends kit_1.NamedError {
28
+ class SfError extends kit_1.NamedError {
29
29
  /**
30
- * Create an SfdxError.
30
+ * Create an SfError.
31
31
  *
32
32
  * @param message The error message.
33
- * @param name The error name. Defaults to 'SfdxError'.
33
+ * @param name The error name. Defaults to 'SfError'.
34
34
  * @param actions The action message(s).
35
35
  * @param exitCodeOrCause The exit code which will be used by SfdxCommand or he underlying error that caused this error to be raised.
36
36
  * @param cause The underlying error that caused this error to be raised.
37
37
  */
38
38
  constructor(message, name, actions, exitCodeOrCause, cause) {
39
39
  cause = exitCodeOrCause instanceof Error ? exitCodeOrCause : cause;
40
- super(name || 'SfdxError', message || name, cause);
40
+ super(name || 'SfError', message || name, cause);
41
41
  this.actions = actions;
42
42
  if (typeof exitCodeOrCause === 'number') {
43
43
  this.exitCode = exitCodeOrCause;
@@ -47,23 +47,23 @@ class SfdxError extends kit_1.NamedError {
47
47
  }
48
48
  }
49
49
  /**
50
- * Convert an Error to an SfdxError.
50
+ * Convert an Error to an SfError.
51
51
  *
52
52
  * @param err The error to convert.
53
53
  */
54
54
  static wrap(err) {
55
55
  if ((0, ts_types_1.isString)(err)) {
56
- return new SfdxError(err);
56
+ return new SfError(err);
57
57
  }
58
- if (err instanceof SfdxError) {
58
+ if (err instanceof SfError) {
59
59
  return err;
60
60
  }
61
- const sfdxError = new SfdxError(err.message, err.name, undefined, err);
61
+ const sfError = new SfError(err.message, err.name, undefined, err);
62
62
  // If the original error has a code, use that instead of name.
63
63
  if ((0, ts_types_1.hasString)(err, 'code')) {
64
- sfdxError.code = err.code;
64
+ sfError.code = err.code;
65
65
  }
66
- return sfdxError;
66
+ return sfError;
67
67
  }
68
68
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
69
  get code() {
@@ -91,7 +91,7 @@ class SfdxError extends kit_1.NamedError {
91
91
  return this;
92
92
  }
93
93
  /**
94
- * Convert an {@link SfdxError} state to an object. Returns a plain object representing the state of this error.
94
+ * Convert an {@link SfError} state to an object. Returns a plain object representing the state of this error.
95
95
  */
96
96
  toObject() {
97
97
  const obj = {
@@ -109,13 +109,12 @@ class SfdxError extends kit_1.NamedError {
109
109
  }
110
110
  return obj;
111
111
  }
112
- /**
113
- * @deprecated Does nothing. Do not use. This is kept around to support older versions of SfdxCommand.
114
- * @param commandName
115
- */
116
- setCommandName() {
117
- /** Do nothing. */
118
- }
112
+ }
113
+ exports.SfError = SfError;
114
+ /**
115
+ * @deprecated use SfError instead
116
+ */
117
+ class SfdxError extends SfError {
119
118
  }
120
119
  exports.SfdxError = SfdxError;
121
- //# sourceMappingURL=sfdxError.js.map
120
+ //# sourceMappingURL=sfError.js.map
@@ -54,7 +54,7 @@ export declare type ProjectJson = ConfigContents & {
54
54
  * be in a top level property that represents your project or plugin.
55
55
  *
56
56
  * ```
57
- * const project = await SfdxProject.resolve();
57
+ * const project = await SfProject.resolve();
58
58
  * const projectJson = await project.resolveProjectConfig();
59
59
  * const myPluginProperties = projectJson.get('myplugin') || {};
60
60
  * myPluginProperties.myprop = 'someValue';
@@ -64,7 +64,7 @@ export declare type ProjectJson = ConfigContents & {
64
64
  *
65
65
  * **See** [force:project:create](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_create_new.htm)
66
66
  */
67
- export declare class SfdxProjectJson extends ConfigFile {
67
+ export declare class SfProjectJson extends ConfigFile {
68
68
  static BLOCKLIST: string[];
69
69
  static getFileName(): string;
70
70
  static getDefaultOptions(isGlobal?: boolean): ConfigFile.Options;
@@ -115,7 +115,7 @@ export declare class SfdxProjectJson extends ConfigFile {
115
115
  */
116
116
  getUniquePackageDirectories(): NamedPackageDir[];
117
117
  /**
118
- * Get a list of the unique package names from within sfdx-project.json. Use {@link SfdxProject.getUniquePackageDirectories}
118
+ * Get a list of the unique package names from within sfdx-project.json. Use {@link SfProject.getUniquePackageDirectories}
119
119
  * for data other than the names.
120
120
  */
121
121
  getUniquePackageNames(): string[];
@@ -131,51 +131,51 @@ export declare class SfdxProjectJson extends ConfigFile {
131
131
  private validateKeys;
132
132
  }
133
133
  /**
134
- * Represents an SFDX project directory. This directory contains a {@link SfdxProjectJson} config file as well as
134
+ * Represents an SFDX project directory. This directory contains a {@link SfProjectJson} config file as well as
135
135
  * a hidden .sfdx folder that contains all the other local project config files.
136
136
  *
137
137
  * ```
138
- * const project = await SfdxProject.resolve();
138
+ * const project = await SfProject.resolve();
139
139
  * const projectJson = await project.resolveProjectConfig();
140
140
  * console.log(projectJson.sfdcLoginUrl);
141
141
  * ```
142
142
  */
143
- export declare class SfdxProject {
143
+ export declare class SfProject {
144
144
  private path;
145
145
  private static instances;
146
146
  private projectConfig;
147
- private sfdxProjectJson;
148
- private sfdxProjectJsonGlobal;
147
+ private sfProjectJson;
148
+ private sfProjectJsonGlobal;
149
149
  private packageDirectories?;
150
150
  private activePackage;
151
151
  /**
152
- * Do not directly construct instances of this class -- use {@link SfdxProject.resolve} instead.
152
+ * Do not directly construct instances of this class -- use {@link SfProject.resolve} instead.
153
153
  *
154
154
  * @ignore
155
155
  */
156
- private constructor();
156
+ protected constructor(path: string);
157
157
  /**
158
158
  * Get a Project from a given path or from the working directory.
159
159
  *
160
160
  * @param path The path of the project.
161
161
  *
162
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
162
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
163
163
  */
164
- static resolve(path?: string): Promise<SfdxProject>;
164
+ static resolve(path?: string): Promise<SfProject>;
165
165
  /**
166
166
  * Get a Project from a given path or from the working directory.
167
167
  *
168
168
  * @param path The path of the project.
169
169
  *
170
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
170
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
171
171
  */
172
- static getInstance(path?: string): SfdxProject;
172
+ static getInstance(path?: string): SfProject;
173
173
  /**
174
174
  * Performs an upward directory search for an sfdx project file. Returns the absolute path to the project.
175
175
  *
176
176
  * @param dir The directory path to start traversing from.
177
177
  *
178
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
178
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
179
179
  *
180
180
  * **See** {@link traverseForFile}
181
181
  *
@@ -187,7 +187,7 @@ export declare class SfdxProject {
187
187
  *
188
188
  * @param dir The directory path to start traversing from.
189
189
  *
190
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
190
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
191
191
  *
192
192
  * **See** {@link traverseForFileSync}
193
193
  *
@@ -202,24 +202,24 @@ export declare class SfdxProject {
202
202
  * Get the sfdx-project.json config. The global sfdx-project.json is used for user defaults
203
203
  * that are not checked in to the project specific file.
204
204
  *
205
- * *Note:* When reading values from {@link SfdxProjectJson}, it is recommended to use
206
- * {@link SfdxProject.resolveProjectConfig} instead.
205
+ * *Note:* When reading values from {@link SfProjectJson}, it is recommended to use
206
+ * {@link SfProject.resolveProjectConfig} instead.
207
207
  *
208
208
  * @param isGlobal True to get the global project file, otherwise the local project config.
209
209
  */
210
- retrieveSfdxProjectJson(isGlobal?: boolean): Promise<SfdxProjectJson>;
210
+ retrieveSfProjectJson(isGlobal?: boolean): Promise<SfProjectJson>;
211
211
  /**
212
212
  * Get the sfdx-project.json config. The global sfdx-project.json is used for user defaults
213
213
  * that are not checked in to the project specific file.
214
214
  *
215
- * *Note:* When reading values from {@link SfdxProjectJson}, it is recommended to use
216
- * {@link SfdxProject.resolveProjectConfig} instead.
215
+ * *Note:* When reading values from {@link SfProjectJson}, it is recommended to use
216
+ * {@link SfProject.resolveProjectConfig} instead.
217
217
  *
218
- * This is the sync method of {@link SfdxProject.resolveSfdxProjectJson}
218
+ * This is the sync method of {@link SfProject.resolveSfProjectJson}
219
219
  *
220
220
  * @param isGlobal True to get the global project file, otherwise the local project config.
221
221
  */
222
- getSfdxProjectJson(isGlobal?: boolean): SfdxProjectJson;
222
+ getSfProjectJson(isGlobal?: boolean): SfProjectJson;
223
223
  /**
224
224
  * Returns a read-only list of `packageDirectories` within sfdx-project.json, first reading
225
225
  * and validating the file if necessary. i.e. modifying this array will not affect the
@@ -238,7 +238,7 @@ export declare class SfdxProject {
238
238
  */
239
239
  getUniquePackageDirectories(): NamedPackageDir[];
240
240
  /**
241
- * Get a list of the unique package names from within sfdx-project.json. Use {@link SfdxProject.getUniquePackageDirectories}
241
+ * Get a list of the unique package names from within sfdx-project.json. Use {@link SfProject.getUniquePackageDirectories}
242
242
  * for data other than the names.
243
243
  */
244
244
  getUniquePackageNames(): string[];
@@ -293,11 +293,11 @@ export declare class SfdxProject {
293
293
  */
294
294
  getDefaultPackage(): NamedPackageDir;
295
295
  /**
296
- * The project config is resolved from local and global {@link SfdxProjectJson},
296
+ * The project config is resolved from local and global {@link SfProjectJson},
297
297
  * {@link ConfigAggregator}, and a set of defaults. It is recommended to use
298
- * this when reading values from SfdxProjectJson.
298
+ * this when reading values from SfProjectJson.
299
299
  *
300
- * The global {@link SfdxProjectJson} is used to allow the user to provide default values they
300
+ * The global {@link SfProjectJson} is used to allow the user to provide default values they
301
301
  * may not want checked into their project's source.
302
302
  *
303
303
  * @returns A resolved config object that contains a bunch of different
@@ -305,3 +305,13 @@ export declare class SfdxProject {
305
305
  */
306
306
  resolveProjectConfig(): Promise<JsonMap>;
307
307
  }
308
+ /**
309
+ * @deprecated use SfProject instead
310
+ */
311
+ export declare class SfdxProject extends SfProject {
312
+ }
313
+ /**
314
+ * @deprecated use SfProjectJson instead
315
+ */
316
+ export declare class SfdxProjectJson extends SfProjectJson {
317
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SfdxProject = exports.SfdxProjectJson = void 0;
3
+ exports.SfdxProjectJson = exports.SfdxProject = exports.SfProject = exports.SfProjectJson = void 0;
4
4
  /*
5
5
  * Copyright (c) 2020, salesforce.com, inc.
6
6
  * All rights reserved.
@@ -8,15 +8,15 @@ exports.SfdxProject = exports.SfdxProjectJson = void 0;
8
8
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
9
  */
10
10
  const path_1 = require("path");
11
+ const fs = require("fs");
11
12
  const kit_1 = require("@salesforce/kit");
12
13
  const ts_types_1 = require("@salesforce/ts-types");
13
14
  const sfdcUrl_1 = require("./util/sfdcUrl");
14
15
  const configAggregator_1 = require("./config/configAggregator");
15
16
  const configFile_1 = require("./config/configFile");
16
17
  const validator_1 = require("./schema/validator");
17
- const fs_1 = require("./util/fs");
18
18
  const internal_1 = require("./util/internal");
19
- const sfdxError_1 = require("./sfdxError");
19
+ const sfError_1 = require("./sfError");
20
20
  const sfdc_1 = require("./util/sfdc");
21
21
  const messages_1 = require("./messages");
22
22
  messages_1.Messages.importMessagesDirectory(__dirname);
@@ -36,7 +36,7 @@ const coreMessages = messages_1.Messages.load('@salesforce/core', 'core', ['inva
36
36
  * be in a top level property that represents your project or plugin.
37
37
  *
38
38
  * ```
39
- * const project = await SfdxProject.resolve();
39
+ * const project = await SfProject.resolve();
40
40
  * const projectJson = await project.resolveProjectConfig();
41
41
  * const myPluginProperties = projectJson.get('myplugin') || {};
42
42
  * myPluginProperties.myprop = 'someValue';
@@ -46,12 +46,12 @@ const coreMessages = messages_1.Messages.load('@salesforce/core', 'core', ['inva
46
46
  *
47
47
  * **See** [force:project:create](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_create_new.htm)
48
48
  */
49
- class SfdxProjectJson extends configFile_1.ConfigFile {
49
+ class SfProjectJson extends configFile_1.ConfigFile {
50
50
  static getFileName() {
51
51
  return internal_1.SFDX_PROJECT_JSON;
52
52
  }
53
53
  static getDefaultOptions(isGlobal = false) {
54
- const options = configFile_1.ConfigFile.getDefaultOptions(isGlobal, SfdxProjectJson.getFileName());
54
+ const options = configFile_1.ConfigFile.getDefaultOptions(isGlobal, SfProjectJson.getFileName());
55
55
  options.isState = false;
56
56
  return options;
57
57
  }
@@ -229,7 +229,7 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
229
229
  return uniqueValues;
230
230
  }
231
231
  /**
232
- * Get a list of the unique package names from within sfdx-project.json. Use {@link SfdxProject.getUniquePackageDirectories}
232
+ * Get a list of the unique package names from within sfdx-project.json. Use {@link SfProject.getUniquePackageDirectories}
233
233
  * for data other than the names.
234
234
  */
235
235
  getUniquePackageNames() {
@@ -248,31 +248,31 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
248
248
  return this.getContents().packageDirectories && this.getContents().packageDirectories.length > 1;
249
249
  }
250
250
  doesPackageExist(packagePath) {
251
- return fs_1.fs.existsSync(packagePath);
251
+ return fs.existsSync(packagePath);
252
252
  }
253
253
  validateKeys() {
254
254
  // Verify that the configObject does not have upper case keys; throw if it does. Must be heads down camel case.
255
- const upperCaseKey = sfdc_1.sfdc.findUpperCaseKeys(this.toObject(), SfdxProjectJson.BLOCKLIST);
255
+ const upperCaseKey = sfdc_1.sfdc.findUpperCaseKeys(this.toObject(), SfProjectJson.BLOCKLIST);
256
256
  if (upperCaseKey) {
257
257
  throw coreMessages.createError('invalidJsonCasing', [upperCaseKey, this.getPath()]);
258
258
  }
259
259
  }
260
260
  }
261
- exports.SfdxProjectJson = SfdxProjectJson;
262
- SfdxProjectJson.BLOCKLIST = ['packageAliases'];
261
+ exports.SfProjectJson = SfProjectJson;
262
+ SfProjectJson.BLOCKLIST = ['packageAliases'];
263
263
  /**
264
- * Represents an SFDX project directory. This directory contains a {@link SfdxProjectJson} config file as well as
264
+ * Represents an SFDX project directory. This directory contains a {@link SfProjectJson} config file as well as
265
265
  * a hidden .sfdx folder that contains all the other local project config files.
266
266
  *
267
267
  * ```
268
- * const project = await SfdxProject.resolve();
268
+ * const project = await SfProject.resolve();
269
269
  * const projectJson = await project.resolveProjectConfig();
270
270
  * console.log(projectJson.sfdcLoginUrl);
271
271
  * ```
272
272
  */
273
- class SfdxProject {
273
+ class SfProject {
274
274
  /**
275
- * Do not directly construct instances of this class -- use {@link SfdxProject.resolve} instead.
275
+ * Do not directly construct instances of this class -- use {@link SfProject.resolve} instead.
276
276
  *
277
277
  * @ignore
278
278
  */
@@ -284,38 +284,38 @@ class SfdxProject {
284
284
  *
285
285
  * @param path The path of the project.
286
286
  *
287
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
287
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
288
288
  */
289
289
  static async resolve(path) {
290
290
  path = await this.resolveProjectPath(path || process.cwd());
291
- if (!SfdxProject.instances.has(path)) {
292
- const project = new SfdxProject(path);
293
- SfdxProject.instances.set(path, project);
291
+ if (!SfProject.instances.has(path)) {
292
+ const project = new SfProject(path);
293
+ SfProject.instances.set(path, project);
294
294
  }
295
- return (0, ts_types_1.ensure)(SfdxProject.instances.get(path));
295
+ return (0, ts_types_1.ensure)(SfProject.instances.get(path));
296
296
  }
297
297
  /**
298
298
  * Get a Project from a given path or from the working directory.
299
299
  *
300
300
  * @param path The path of the project.
301
301
  *
302
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
302
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
303
303
  */
304
304
  static getInstance(path) {
305
305
  // Store instance based on the path of the actual project.
306
306
  path = this.resolveProjectPathSync(path || process.cwd());
307
- if (!SfdxProject.instances.has(path)) {
308
- const project = new SfdxProject(path);
309
- SfdxProject.instances.set(path, project);
307
+ if (!SfProject.instances.has(path)) {
308
+ const project = new SfProject(path);
309
+ SfProject.instances.set(path, project);
310
310
  }
311
- return (0, ts_types_1.ensure)(SfdxProject.instances.get(path));
311
+ return (0, ts_types_1.ensure)(SfProject.instances.get(path));
312
312
  }
313
313
  /**
314
314
  * Performs an upward directory search for an sfdx project file. Returns the absolute path to the project.
315
315
  *
316
316
  * @param dir The directory path to start traversing from.
317
317
  *
318
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
318
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
319
319
  *
320
320
  * **See** {@link traverseForFile}
321
321
  *
@@ -329,7 +329,7 @@ class SfdxProject {
329
329
  *
330
330
  * @param dir The directory path to start traversing from.
331
331
  *
332
- * **Throws** *{@link SfdxError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
332
+ * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
333
333
  *
334
334
  * **See** {@link traverseForFileSync}
335
335
  *
@@ -348,54 +348,54 @@ class SfdxProject {
348
348
  * Get the sfdx-project.json config. The global sfdx-project.json is used for user defaults
349
349
  * that are not checked in to the project specific file.
350
350
  *
351
- * *Note:* When reading values from {@link SfdxProjectJson}, it is recommended to use
352
- * {@link SfdxProject.resolveProjectConfig} instead.
351
+ * *Note:* When reading values from {@link SfProjectJson}, it is recommended to use
352
+ * {@link SfProject.resolveProjectConfig} instead.
353
353
  *
354
354
  * @param isGlobal True to get the global project file, otherwise the local project config.
355
355
  */
356
- async retrieveSfdxProjectJson(isGlobal = false) {
357
- const options = SfdxProjectJson.getDefaultOptions(isGlobal);
356
+ async retrieveSfProjectJson(isGlobal = false) {
357
+ const options = SfProjectJson.getDefaultOptions(isGlobal);
358
358
  if (isGlobal) {
359
- if (!this.sfdxProjectJsonGlobal) {
360
- this.sfdxProjectJsonGlobal = await SfdxProjectJson.create(options);
359
+ if (!this.sfProjectJsonGlobal) {
360
+ this.sfProjectJsonGlobal = await SfProjectJson.create(options);
361
361
  }
362
- return this.sfdxProjectJsonGlobal;
362
+ return this.sfProjectJsonGlobal;
363
363
  }
364
364
  else {
365
365
  options.rootFolder = this.getPath();
366
- if (!this.sfdxProjectJson) {
367
- this.sfdxProjectJson = await SfdxProjectJson.create(options);
366
+ if (!this.sfProjectJson) {
367
+ this.sfProjectJson = await SfProjectJson.create(options);
368
368
  }
369
- return this.sfdxProjectJson;
369
+ return this.sfProjectJson;
370
370
  }
371
371
  }
372
372
  /**
373
373
  * Get the sfdx-project.json config. The global sfdx-project.json is used for user defaults
374
374
  * that are not checked in to the project specific file.
375
375
  *
376
- * *Note:* When reading values from {@link SfdxProjectJson}, it is recommended to use
377
- * {@link SfdxProject.resolveProjectConfig} instead.
376
+ * *Note:* When reading values from {@link SfProjectJson}, it is recommended to use
377
+ * {@link SfProject.resolveProjectConfig} instead.
378
378
  *
379
- * This is the sync method of {@link SfdxProject.resolveSfdxProjectJson}
379
+ * This is the sync method of {@link SfProject.resolveSfProjectJson}
380
380
  *
381
381
  * @param isGlobal True to get the global project file, otherwise the local project config.
382
382
  */
383
- getSfdxProjectJson(isGlobal = false) {
384
- const options = SfdxProjectJson.getDefaultOptions(isGlobal);
383
+ getSfProjectJson(isGlobal = false) {
384
+ const options = SfProjectJson.getDefaultOptions(isGlobal);
385
385
  if (isGlobal) {
386
- if (!this.sfdxProjectJsonGlobal) {
387
- this.sfdxProjectJsonGlobal = new SfdxProjectJson(options);
388
- this.sfdxProjectJsonGlobal.readSync();
386
+ if (!this.sfProjectJsonGlobal) {
387
+ this.sfProjectJsonGlobal = new SfProjectJson(options);
388
+ this.sfProjectJsonGlobal.readSync();
389
389
  }
390
- return this.sfdxProjectJsonGlobal;
390
+ return this.sfProjectJsonGlobal;
391
391
  }
392
392
  else {
393
393
  options.rootFolder = this.getPath();
394
- if (!this.sfdxProjectJson) {
395
- this.sfdxProjectJson = new SfdxProjectJson(options);
396
- this.sfdxProjectJson.readSync();
394
+ if (!this.sfProjectJson) {
395
+ this.sfProjectJson = new SfProjectJson(options);
396
+ this.sfProjectJson.readSync();
397
397
  }
398
- return this.sfdxProjectJson;
398
+ return this.sfProjectJson;
399
399
  }
400
400
  }
401
401
  /**
@@ -405,7 +405,7 @@ class SfdxProject {
405
405
  */
406
406
  getPackageDirectories() {
407
407
  if (!this.packageDirectories) {
408
- this.packageDirectories = this.getSfdxProjectJson().getPackageDirectoriesSync();
408
+ this.packageDirectories = this.getSfProjectJson().getPackageDirectoriesSync();
409
409
  }
410
410
  return this.packageDirectories;
411
411
  }
@@ -420,14 +420,14 @@ class SfdxProject {
420
420
  * for packaging operations that want to do something for each package entry.
421
421
  */
422
422
  getUniquePackageDirectories() {
423
- return this.getSfdxProjectJson().getUniquePackageDirectories();
423
+ return this.getSfProjectJson().getUniquePackageDirectories();
424
424
  }
425
425
  /**
426
- * Get a list of the unique package names from within sfdx-project.json. Use {@link SfdxProject.getUniquePackageDirectories}
426
+ * Get a list of the unique package names from within sfdx-project.json. Use {@link SfProject.getUniquePackageDirectories}
427
427
  * for data other than the names.
428
428
  */
429
429
  getUniquePackageNames() {
430
- return this.getSfdxProjectJson().getUniquePackageNames();
430
+ return this.getSfProjectJson().getUniquePackageNames();
431
431
  }
432
432
  /**
433
433
  * Returns the package from a file path.
@@ -471,13 +471,13 @@ class SfdxProject {
471
471
  * Has package directories defined in the project.
472
472
  */
473
473
  hasPackages() {
474
- return this.getSfdxProjectJson().hasPackages();
474
+ return this.getSfProjectJson().hasPackages();
475
475
  }
476
476
  /**
477
477
  * Has multiple package directories (MPD) defined in the project.
478
478
  */
479
479
  hasMultiplePackages() {
480
- return this.getSfdxProjectJson().hasMultiplePackages();
480
+ return this.getSfProjectJson().hasMultiplePackages();
481
481
  }
482
482
  /**
483
483
  * Get the currently activated package on the project. This has no implication on sfdx-project.json
@@ -506,17 +506,17 @@ class SfdxProject {
506
506
  */
507
507
  getDefaultPackage() {
508
508
  if (!this.hasPackages()) {
509
- throw new sfdxError_1.SfdxError('The sfdx-project.json does not have any packageDirectories defined.');
509
+ throw new sfError_1.SfError('The sfdx-project.json does not have any packageDirectories defined.');
510
510
  }
511
511
  const defaultPackage = this.getPackageDirectories().find((packageDir) => packageDir.default === true);
512
512
  return defaultPackage || this.getPackageDirectories()[0];
513
513
  }
514
514
  /**
515
- * The project config is resolved from local and global {@link SfdxProjectJson},
515
+ * The project config is resolved from local and global {@link SfProjectJson},
516
516
  * {@link ConfigAggregator}, and a set of defaults. It is recommended to use
517
- * this when reading values from SfdxProjectJson.
517
+ * this when reading values from SfProjectJson.
518
518
  *
519
- * The global {@link SfdxProjectJson} is used to allow the user to provide default values they
519
+ * The global {@link SfProjectJson} is used to allow the user to provide default values they
520
520
  * may not want checked into their project's source.
521
521
  *
522
522
  * @returns A resolved config object that contains a bunch of different
@@ -527,8 +527,8 @@ class SfdxProject {
527
527
  if (!this.projectConfig) {
528
528
  // Do fs operations in parallel
529
529
  const [global, local, configAggregator] = await Promise.all([
530
- this.retrieveSfdxProjectJson(true),
531
- this.retrieveSfdxProjectJson(),
530
+ this.retrieveSfProjectJson(true),
531
+ this.retrieveSfProjectJson(),
532
532
  configAggregator_1.ConfigAggregator.create(),
533
533
  ]);
534
534
  await Promise.all([global.read(), local.read()]);
@@ -551,7 +551,19 @@ class SfdxProject {
551
551
  return this.projectConfig;
552
552
  }
553
553
  }
554
+ exports.SfProject = SfProject;
555
+ // Cache of SfProject instances per path.
556
+ SfProject.instances = new Map();
557
+ /**
558
+ * @deprecated use SfProject instead
559
+ */
560
+ class SfdxProject extends SfProject {
561
+ }
554
562
  exports.SfdxProject = SfdxProject;
555
- // Cache of SfdxProject instances per path.
556
- SfdxProject.instances = new Map();
557
- //# sourceMappingURL=sfdxProject.js.map
563
+ /**
564
+ * @deprecated use SfProjectJson instead
565
+ */
566
+ class SfdxProjectJson extends SfProjectJson {
567
+ }
568
+ exports.SfdxProjectJson = SfdxProjectJson;
569
+ //# sourceMappingURL=sfProject.js.map