@salesforce/sf-plugins-core 2.2.2 → 2.2.3

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.
@@ -215,6 +215,7 @@ export declare abstract class SfCommand<T> extends Command {
215
215
  * @param text the text to display as a header.
216
216
  */
217
217
  styledHeader(text: string): void;
218
+ logJson(json: AnyJson | unknown): void;
218
219
  /**
219
220
  * Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
220
221
  *
@@ -251,7 +252,6 @@ export declare abstract class SfCommand<T> extends Command {
251
252
  * Wrap the command error into the standardized JSON structure.
252
253
  */
253
254
  protected toErrorJson(error: SfCommand.Error): SfCommand.Error;
254
- protected logJson(json: AnyJson | unknown): void;
255
255
  protected assignProject(): Promise<SfProject>;
256
256
  protected catch(error: Error | SfError | SfCommand.Error): Promise<SfCommand.Error>;
257
257
  /**
package/lib/sfCommand.js CHANGED
@@ -147,6 +147,13 @@ class SfCommand extends core_1.Command {
147
147
  styledHeader(text) {
148
148
  this.ux.styledHeader(text);
149
149
  }
150
+ // eslint-disable-next-line class-methods-use-this
151
+ logJson(json) {
152
+ // If `--json` is enabled, then the ux instance on the class will disable output, which
153
+ // means that the logJson method will not output anything. So, we need to create a new
154
+ // instance of the ux class that does not have output disabled in order to log the json.
155
+ new ux_1.Ux().styledJSON(json);
156
+ }
150
157
  /**
151
158
  * Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
152
159
  *
@@ -235,13 +242,6 @@ class SfCommand extends core_1.Command {
235
242
  };
236
243
  }
237
244
  // eslint-disable-next-line class-methods-use-this
238
- logJson(json) {
239
- // If `--json` is enabled, then the ux instance on the class will disable output, which
240
- // means that the logJson method will not output anything. So, we need to create a new
241
- // instance of the ux class that does not have output disabled in order to log the json.
242
- new ux_1.Ux().styledJSON(json);
243
- }
244
- // eslint-disable-next-line class-methods-use-this
245
245
  async assignProject() {
246
246
  try {
247
247
  return await core_2.SfProject.resolve();
package/lib/stubUx.d.ts CHANGED
@@ -12,6 +12,7 @@ export declare function stubUx(sandbox: SinonSandbox): {
12
12
  };
13
13
  export declare function stubSfCommandUx(sandbox: SinonSandbox): {
14
14
  log: import("sinon").SinonStub<[message?: string | undefined, ...args: any[]], void>;
15
+ logJson: import("sinon").SinonStub<[json: unknown], void>;
15
16
  logToStderr: import("sinon").SinonStub<[message?: string | undefined, ...args: any[]], void>;
16
17
  logSuccess: import("sinon").SinonStub<[message: string], void>;
17
18
  logSensitive: import("sinon").SinonStub<[msg?: string | undefined], void>;
package/lib/stubUx.js CHANGED
@@ -24,6 +24,7 @@ exports.stubUx = stubUx;
24
24
  function stubSfCommandUx(sandbox) {
25
25
  return {
26
26
  log: sandbox.stub(sfCommand_1.SfCommand.prototype, 'log'),
27
+ logJson: sandbox.stub(sfCommand_1.SfCommand.prototype, 'logJson'),
27
28
  logToStderr: sandbox.stub(sfCommand_1.SfCommand.prototype, 'logToStderr'),
28
29
  logSuccess: sandbox.stub(sfCommand_1.SfCommand.prototype, 'logSuccess'),
29
30
  logSensitive: sandbox.stub(sfCommand_1.SfCommand.prototype, 'logSensitive'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Utils for writing Salesforce CLI plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",