@salesforce/core 3.7.5 → 3.7.8

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 (79) hide show
  1. package/CHANGELOG.md +219 -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 +7 -6
  10. package/lib/config/keychainConfig.js +4 -3
  11. package/lib/crypto/keyChainImpl.js +12 -11
  12. package/lib/deviceOauthService.js +2 -2
  13. package/lib/exported.d.ts +6 -5
  14. package/lib/exported.js +11 -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/lifecycleEvents.js +1 -1
  20. package/lib/logger.d.ts +3 -3
  21. package/lib/logger.js +20 -19
  22. package/lib/messages.d.ts +42 -3
  23. package/lib/messages.js +55 -12
  24. package/lib/org/authInfo.d.ts +1 -1
  25. package/lib/org/authInfo.js +8 -9
  26. package/lib/org/authRemover.d.ts +2 -2
  27. package/lib/org/authRemover.js +2 -2
  28. package/lib/org/connection.d.ts +7 -2
  29. package/lib/org/connection.js +17 -4
  30. package/lib/org/org.d.ts +16 -6
  31. package/lib/org/org.js +54 -51
  32. package/lib/org/permissionSetAssignment.js +2 -2
  33. package/lib/org/scratchOrgCreate.d.ts +43 -0
  34. package/lib/org/scratchOrgCreate.js +142 -0
  35. package/lib/org/scratchOrgErrorCodes.d.ts +4 -0
  36. package/lib/org/scratchOrgErrorCodes.js +62 -0
  37. package/lib/org/scratchOrgFeatureDeprecation.d.ts +26 -0
  38. package/lib/org/scratchOrgFeatureDeprecation.js +110 -0
  39. package/lib/org/scratchOrgInfoApi.d.ts +94 -0
  40. package/lib/org/scratchOrgInfoApi.js +350 -0
  41. package/lib/org/scratchOrgInfoGenerator.d.ts +63 -0
  42. package/lib/org/scratchOrgInfoGenerator.js +223 -0
  43. package/lib/org/scratchOrgSettingsGenerator.d.ts +56 -0
  44. package/lib/org/scratchOrgSettingsGenerator.js +210 -0
  45. package/lib/org/user.js +8 -7
  46. package/lib/schema/printer.js +2 -2
  47. package/lib/schema/validator.d.ts +4 -4
  48. package/lib/schema/validator.js +13 -13
  49. package/lib/{sfdxError.d.ts → sfError.d.ts} +14 -14
  50. package/lib/{sfdxError.js → sfError.js} +20 -21
  51. package/lib/{sfdxProject.d.ts → sfProject.d.ts} +37 -27
  52. package/lib/{sfdxProject.js → sfProject.js} +77 -65
  53. package/lib/status/pollingClient.d.ts +2 -2
  54. package/lib/status/pollingClient.js +10 -4
  55. package/lib/status/streamingClient.d.ts +1 -1
  56. package/lib/status/streamingClient.js +6 -6
  57. package/lib/testSetup.d.ts +4 -4
  58. package/lib/testSetup.js +8 -8
  59. package/lib/util/internal.d.ts +28 -2
  60. package/lib/util/internal.js +64 -6
  61. package/lib/util/jsonXmlTools.d.ts +14 -0
  62. package/lib/util/jsonXmlTools.js +41 -0
  63. package/lib/util/mapKeys.d.ts +14 -0
  64. package/lib/util/mapKeys.js +48 -0
  65. package/lib/util/sfdcUrl.d.ts +2 -2
  66. package/lib/util/sfdcUrl.js +2 -2
  67. package/lib/util/zipWriter.d.ts +14 -0
  68. package/lib/util/zipWriter.js +68 -0
  69. package/lib/webOAuthServer.js +11 -11
  70. package/messages/org.md +4 -0
  71. package/messages/scratchOrgCreate.md +27 -0
  72. package/messages/scratchOrgErrorCodes.md +99 -0
  73. package/messages/scratchOrgFeatureDeprecation.md +11 -0
  74. package/messages/scratchOrgInfoApi.md +11 -0
  75. package/messages/scratchOrgInfoGenerator.md +19 -0
  76. package/messages/user.md +4 -0
  77. package/package.json +4 -1
  78. package/lib/util/fs.d.ts +0 -201
  79. package/lib/util/fs.js +0 -378
@@ -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
@@ -1,7 +1,7 @@
1
1
  import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
2
2
  import { AnyJson } from '@salesforce/ts-types';
3
3
  import { Logger } from '../logger';
4
- import { StatusResult } from './streamingClient';
4
+ import { StatusResult } from './types';
5
5
  /**
6
6
  * This is a polling client that can be used to poll the status of long running tasks. It can be used as a replacement
7
7
  * for Streaming when streaming topics are not available or when streaming handshakes are failing. Why wouldn't you
@@ -38,7 +38,7 @@ export declare class PollingClient extends AsyncOptionalCreatable<PollingClient.
38
38
  * Returns a promise to call the specified polling function using the interval and timeout specified
39
39
  * in the polling options.
40
40
  */
41
- subscribe(): Promise<AnyJson | undefined>;
41
+ subscribe<T = AnyJson>(): Promise<T>;
42
42
  }
43
43
  export declare namespace PollingClient {
44
44
  /**
@@ -11,7 +11,8 @@ const kit_1 = require("@salesforce/kit");
11
11
  const ts_types_1 = require("@salesforce/ts-types");
12
12
  const ts_retry_promise_1 = require("ts-retry-promise");
13
13
  const logger_1 = require("../logger");
14
- const sfdxError_1 = require("../sfdxError");
14
+ const sfError_1 = require("../sfError");
15
+ const lifecycleEvents_1 = require("../lifecycleEvents");
15
16
  /**
16
17
  * This is a polling client that can be used to poll the status of long running tasks. It can be used as a replacement
17
18
  * for Streaming when streaming topics are not available or when streaming handshakes are failing. Why wouldn't you
@@ -60,9 +61,14 @@ class PollingClient extends kit_1.AsyncOptionalCreatable {
60
61
  result = await this.options.poll();
61
62
  }
62
63
  catch (error) {
63
- errorInPollingFunction = error;
64
+ const err = (errorInPollingFunction = error);
65
+ if (['ETIMEDOUT', 'ENOTFOUND', 'ECONNRESET', 'socket hang up'].some((retryableNetworkError) => err.message.includes(retryableNetworkError))) {
66
+ this.logger.debug('Network error on the request', err);
67
+ await lifecycleEvents_1.Lifecycle.getInstance().emitWarning('Network error occurred. Continuing to poll.');
68
+ throw sfError_1.SfError.wrap(err);
69
+ }
64
70
  // there was an actual error thrown, so we don't want to keep retrying
65
- throw new ts_retry_promise_1.NotRetryableError(error.name);
71
+ throw new ts_retry_promise_1.NotRetryableError(err.name);
66
72
  }
67
73
  if (result.completed) {
68
74
  return result.payload;
@@ -82,7 +88,7 @@ class PollingClient extends kit_1.AsyncOptionalCreatable {
82
88
  throw errorInPollingFunction;
83
89
  }
84
90
  this.logger.debug('Polling timed out');
85
- throw new sfdxError_1.SfdxError('The client has timed out.', (_a = this.options.timeoutErrorName) !== null && _a !== void 0 ? _a : 'PollingClientTimeout');
91
+ throw new sfError_1.SfError('The client has timed out.', (_a = this.options.timeoutErrorName) !== null && _a !== void 0 ? _a : 'PollingClientTimeout');
86
92
  }
87
93
  }
88
94
  }
@@ -113,7 +113,7 @@ export declare class StreamingClient extends AsyncOptionalCreatable<StreamingCli
113
113
  * Subscribe to streaming events. When the streaming processor that's set in the options completes execution it
114
114
  * returns a payload in the StatusResult object. The payload is just echoed here for convenience.
115
115
  *
116
- * **Throws** *{@link SfdxError}{ name: '{@link StreamingClient.TimeoutErrorType.SUBSCRIBE}'}* When the subscribe timeout occurs.
116
+ * **Throws** *{@link SfError}{ name: '{@link StreamingClient.TimeoutErrorType.SUBSCRIBE}'}* When the subscribe timeout occurs.
117
117
  *
118
118
  * @param streamInit This function should call the platform apis that result in streaming updates on push topics.
119
119
  * {@link StatusResult}
@@ -13,7 +13,7 @@ const lib_1 = require("@salesforce/kit/lib");
13
13
  const lib_2 = require("@salesforce/ts-types/lib");
14
14
  const Faye = require("faye");
15
15
  const logger_1 = require("../logger");
16
- const sfdxError_1 = require("../sfdxError");
16
+ const sfError_1 = require("../sfError");
17
17
  const messages_1 = require("../messages");
18
18
  const types_1 = require("./types");
19
19
  Object.defineProperty(exports, "CometClient", { enumerable: true, get: function () { return types_1.CometClient; } });
@@ -151,7 +151,7 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
151
151
  this.cometClient.setHeader('Authorization', `OAuth ${accessToken}`);
152
152
  }
153
153
  else {
154
- throw new sfdxError_1.SfdxError('Missing or invalid access token', 'MissingOrInvalidAccessToken');
154
+ throw new sfError_1.SfError('Missing or invalid access token', 'MissingOrInvalidAccessToken');
155
155
  }
156
156
  this.log(`Streaming client target url: ${this.targetUrl}`);
157
157
  this.log(`options.subscribeTimeout (ms): ${this.options.subscribeTimeout.milliseconds}`);
@@ -201,7 +201,7 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
201
201
  * Subscribe to streaming events. When the streaming processor that's set in the options completes execution it
202
202
  * returns a payload in the StatusResult object. The payload is just echoed here for convenience.
203
203
  *
204
- * **Throws** *{@link SfdxError}{ name: '{@link StreamingClient.TimeoutErrorType.SUBSCRIBE}'}* When the subscribe timeout occurs.
204
+ * **Throws** *{@link SfError}{ name: '{@link StreamingClient.TimeoutErrorType.SUBSCRIBE}'}* When the subscribe timeout occurs.
205
205
  *
206
206
  * @param streamInit This function should call the platform apis that result in streaming updates on push topics.
207
207
  * {@link StatusResult}
@@ -342,13 +342,13 @@ exports.StreamingClient = StreamingClient;
342
342
  logger.warn('envDep is deprecated');
343
343
  }
344
344
  if (!streamProcessor) {
345
- throw new sfdxError_1.SfdxError('Missing stream processor', 'MissingArg');
345
+ throw new sfError_1.SfError('Missing stream processor', 'MissingArg');
346
346
  }
347
347
  if (!org) {
348
- throw new sfdxError_1.SfdxError('Missing org', 'MissingArg');
348
+ throw new sfError_1.SfError('Missing org', 'MissingArg');
349
349
  }
350
350
  if (!channel) {
351
- throw new sfdxError_1.SfdxError('Missing streaming channel', 'MissingArg');
351
+ throw new sfError_1.SfError('Missing streaming channel', 'MissingArg');
352
352
  }
353
353
  this.org = org;
354
354
  this.apiVersion = org.getConnection().getApiVersion();
@@ -4,7 +4,7 @@ import * as sinonType from 'sinon';
4
4
  import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types';
5
5
  import { ConfigContents } from './config/configStore';
6
6
  import { Logger } from './logger';
7
- import { SfdxError } from './sfdxError';
7
+ import { SfError } from './sfError';
8
8
  import { CometClient, CometSubscription, Message, StreamingExtension } from './status/streamingClient';
9
9
  import { SfOrg } from './globalInfo';
10
10
  /**
@@ -85,7 +85,7 @@ export interface TestContext {
85
85
  [configName: string]: Optional<ConfigStub>;
86
86
  GlobalInfo?: ConfigStub;
87
87
  Aliases?: ConfigStub;
88
- SfdxProjectJson?: ConfigStub;
88
+ SfProjectJson?: ConfigStub;
89
89
  SfdxConfig?: ConfigStub;
90
90
  };
91
91
  /**
@@ -252,7 +252,7 @@ export declare const testSetup: (sinon?: any) => TestContext;
252
252
  *
253
253
  * **See** {@link shouldThrow}
254
254
  */
255
- export declare const unexpectedResult: SfdxError;
255
+ export declare const unexpectedResult: SfError;
256
256
  /**
257
257
  * Use for this testing pattern:
258
258
  * ```
@@ -302,7 +302,7 @@ export interface StreamingMockCometSubscriptionOptions {
302
302
  /**
303
303
  * If it's an error that states what that error should be.
304
304
  */
305
- subscriptionErrbackError?: SfdxError;
305
+ subscriptionErrbackError?: SfError;
306
306
  /**
307
307
  * A list of messages to playback for the client. One message per process tick.
308
308
  */