@salesforce/sf-plugins-core 5.0.13 → 5.0.14-dev.1

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 (52) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +2 -5
  3. package/lib/compatibility.d.ts +7 -7
  4. package/lib/compatibility.js +14 -17
  5. package/lib/errorFormatting.d.ts +22 -0
  6. package/lib/errorFormatting.js +41 -0
  7. package/lib/exported.d.ts +10 -70
  8. package/lib/exported.js +10 -62
  9. package/lib/flags/duration.d.ts +1 -1
  10. package/lib/flags/duration.js +7 -10
  11. package/lib/flags/flags.d.ts +63 -0
  12. package/lib/flags/flags.js +30 -0
  13. package/lib/flags/orgApiVersion.d.ts +1 -1
  14. package/lib/flags/orgApiVersion.js +16 -19
  15. package/lib/flags/orgFlags.d.ts +4 -4
  16. package/lib/flags/orgFlags.js +30 -37
  17. package/lib/flags/salesforceId.d.ts +1 -1
  18. package/lib/flags/salesforceId.js +6 -9
  19. package/lib/sfCommand.d.ts +26 -94
  20. package/lib/sfCommand.js +130 -131
  21. package/lib/sfCommandNamespace.d.ts +24 -0
  22. package/lib/sfCommandNamespace.js +2 -0
  23. package/lib/stubUx.d.ts +7 -9
  24. package/lib/stubUx.js +30 -37
  25. package/lib/tsconfig.tsbuildinfo +1 -1
  26. package/lib/util.d.ts +1 -0
  27. package/lib/util.js +9 -13
  28. package/lib/ux/base.d.ts +1 -1
  29. package/lib/ux/base.js +2 -5
  30. package/lib/ux/progress.d.ts +1 -1
  31. package/lib/ux/progress.js +15 -17
  32. package/lib/ux/prompts.d.ts +17 -0
  33. package/lib/ux/prompts.js +26 -0
  34. package/lib/ux/spinner.d.ts +1 -1
  35. package/lib/ux/spinner.js +8 -12
  36. package/lib/ux/standardColors.d.ts +7 -0
  37. package/lib/ux/standardColors.js +14 -0
  38. package/lib/ux/ux.d.ts +2 -4
  39. package/lib/ux/ux.js +14 -18
  40. package/package.json +17 -11
  41. package/lib/deauthorizer.d.ts +0 -22
  42. package/lib/deauthorizer.js +0 -35
  43. package/lib/deployer.d.ts +0 -81
  44. package/lib/deployer.js +0 -58
  45. package/lib/hooks.d.ts +0 -34
  46. package/lib/hooks.js +0 -30
  47. package/lib/types/index.d.ts +0 -128
  48. package/lib/types/index.js +0 -55
  49. package/lib/ux/index.d.ts +0 -6
  50. package/lib/ux/index.js +0 -22
  51. package/lib/ux/prompter.d.ts +0 -40
  52. package/lib/ux/prompter.js +0 -99
package/lib/util.js CHANGED
@@ -1,15 +1,10 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.parseVarArgs = exports.toHelpSection = void 0;
10
- const core_1 = require("@salesforce/core");
11
- core_1.Messages.importMessagesDirectory(__dirname);
12
- const messages = core_1.Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
7
+ import { ORG_CONFIG_ALLOWED_PROPERTIES, SFDX_ALLOWED_PROPERTIES, SUPPORTED_ENV_VARS, Messages, } from '@salesforce/core';
13
8
  /**
14
9
  * Function to build a help section for command help.
15
10
  * Takes a string to be used as section header text and an array of enums
@@ -19,19 +14,19 @@ const messages = core_1.Messages.loadMessages('@salesforce/sf-plugins-core', 'me
19
14
  * @param header
20
15
  * @param vars
21
16
  */
22
- function toHelpSection(header, ...vars) {
17
+ export function toHelpSection(header, ...vars) {
23
18
  const body = vars
24
19
  .flatMap((v) => {
25
20
  if (typeof v === 'string') {
26
- const orgConfig = core_1.ORG_CONFIG_ALLOWED_PROPERTIES.find(({ key }) => key.toString() === v);
21
+ const orgConfig = ORG_CONFIG_ALLOWED_PROPERTIES.find(({ key }) => key.toString() === v);
27
22
  if (orgConfig) {
28
23
  return { name: orgConfig.key, description: orgConfig.description };
29
24
  }
30
- const sfdxProperty = core_1.SFDX_ALLOWED_PROPERTIES.find(({ key }) => key.toString() === v);
25
+ const sfdxProperty = SFDX_ALLOWED_PROPERTIES.find(({ key }) => key.toString() === v);
31
26
  if (sfdxProperty) {
32
27
  return { name: sfdxProperty.key.valueOf(), description: sfdxProperty.description };
33
28
  }
34
- const envVar = Object.entries(core_1.SUPPORTED_ENV_VARS).find(([k]) => k === v);
29
+ const envVar = Object.entries(SUPPORTED_ENV_VARS).find(([k]) => k === v);
35
30
  if (envVar) {
36
31
  const [eKey, data] = envVar;
37
32
  return { name: eKey, description: data.description };
@@ -45,9 +40,8 @@ function toHelpSection(header, ...vars) {
45
40
  .filter(isHelpSectionBodyEntry);
46
41
  return { header, body };
47
42
  }
48
- exports.toHelpSection = toHelpSection;
49
43
  const isHelpSectionBodyEntry = (entry) => typeof entry === 'object' && entry !== null && 'name' in entry && 'description' in entry;
50
- function parseVarArgs(args, argv) {
44
+ export function parseVarArgs(args, argv) {
51
45
  const final = {};
52
46
  const argVals = Object.values(args);
53
47
  // Remove arguments from varargs
@@ -56,6 +50,8 @@ function parseVarArgs(args, argv) {
56
50
  if (varargs.length === 2 && !varargs[0].includes('=')) {
57
51
  return { [varargs[0]]: varargs[1] };
58
52
  }
53
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
54
+ const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
59
55
  // Ensure that all args are in the right format (e.g. key=value key1=value1)
60
56
  varargs.forEach((arg) => {
61
57
  const split = arg.split('=');
@@ -70,5 +66,5 @@ function parseVarArgs(args, argv) {
70
66
  });
71
67
  return final;
72
68
  }
73
- exports.parseVarArgs = parseVarArgs;
69
+ export const removeEmpty = (obj) => Object.fromEntries(Object.entries(obj).filter(([, v]) => v != null));
74
70
  //# sourceMappingURL=util.js.map
package/lib/ux/base.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnyFunction } from '@salesforce/ts-types';
1
+ import type { AnyFunction } from '@salesforce/ts-types';
2
2
  export declare class UxBase {
3
3
  readonly outputEnabled: boolean;
4
4
  constructor(outputEnabled: boolean);
package/lib/ux/base.js CHANGED
@@ -1,13 +1,11 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.UxBase = void 0;
10
- class UxBase {
7
+ export class UxBase {
8
+ outputEnabled;
11
9
  constructor(outputEnabled) {
12
10
  this.outputEnabled = outputEnabled;
13
11
  }
@@ -16,5 +14,4 @@ class UxBase {
16
14
  fn();
17
15
  }
18
16
  }
19
- exports.UxBase = UxBase;
20
17
  //# sourceMappingURL=base.js.map
@@ -1,4 +1,4 @@
1
- import { UxBase } from '.';
1
+ import { UxBase } from './base.js';
2
2
  /**
3
3
  * Class for display a progress bar to the console. Will automatically be suppressed if the --json flag is present.
4
4
  */
@@ -1,22 +1,28 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Progress = void 0;
10
- const util = require("node:util");
11
- const core_1 = require("@oclif/core");
12
- const _1 = require(".");
7
+ import * as util from 'node:util';
8
+ import { ux } from '@oclif/core';
9
+ import { UxBase } from './base.js';
13
10
  /**
14
11
  * Class for display a progress bar to the console. Will automatically be suppressed if the --json flag is present.
15
12
  */
16
- class Progress extends _1.UxBase {
13
+ export class Progress extends UxBase {
14
+ static DEFAULT_OPTIONS = {
15
+ title: 'PROGRESS',
16
+ format: '%s | {bar} | {value}/{total} Components',
17
+ barCompleteChar: '\u2588',
18
+ barIncompleteChar: '\u2591',
19
+ linewrap: true,
20
+ };
21
+ bar;
22
+ total;
23
+ started = false;
17
24
  constructor(outputEnabled) {
18
25
  super(outputEnabled);
19
- this.started = false;
20
26
  }
21
27
  /**
22
28
  * Set the total number of expected components.
@@ -35,7 +41,7 @@ class Progress extends _1.UxBase {
35
41
  this.started = true;
36
42
  this.maybeNoop(() => {
37
43
  const { title, ...rest } = { ...Progress.DEFAULT_OPTIONS, ...options };
38
- this.bar = core_1.ux.progress({
44
+ this.bar = ux.progress({
39
45
  ...rest,
40
46
  format: util.format(rest.format, title),
41
47
  });
@@ -70,12 +76,4 @@ class Progress extends _1.UxBase {
70
76
  this.bar.stop();
71
77
  }
72
78
  }
73
- exports.Progress = Progress;
74
- Progress.DEFAULT_OPTIONS = {
75
- title: 'PROGRESS',
76
- format: '%s | {bar} | {value}/{total} Components',
77
- barCompleteChar: '\u2588',
78
- barIncompleteChar: '\u2591',
79
- linewrap: true,
80
- };
81
79
  //# sourceMappingURL=progress.js.map
@@ -0,0 +1,17 @@
1
+ export type PromptInputs<T> = {
2
+ /** text to display. Do not include a question mark */
3
+ message: string;
4
+ /** after this many ms, the prompt will time out. If a default value is provided, the default will be used. Otherwise the prompt will throw an error */
5
+ ms?: number;
6
+ /**
7
+ * default value to offer to the user. Will be used if the user does not respond within the timeout period.
8
+ */
9
+ defaultAnswer?: T;
10
+ };
11
+ export declare const confirm: ({ message, ms, defaultAnswer, }: PromptInputs<boolean>) => Promise<boolean>;
12
+ export declare const secretPrompt: ({ message, ms }: PromptInputs<string>) => Promise<string>;
13
+ export declare const prompts: {
14
+ confirm: ({ message, ms, defaultAnswer, }: PromptInputs<boolean>) => Promise<boolean>;
15
+ secretPrompt: ({ message, ms }: PromptInputs<string>) => Promise<string>;
16
+ };
17
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { setTimeout } from 'node:timers/promises';
8
+ import { SfError } from '@salesforce/core';
9
+ export const confirm = async ({ message, ms = 10000, defaultAnswer = false, }) => {
10
+ const promptConfirm = (await import('@inquirer/confirm')).default;
11
+ const answer = promptConfirm({ message, default: defaultAnswer });
12
+ return Promise.race([answer, handleTimeout(answer, ms, defaultAnswer)]);
13
+ };
14
+ export const secretPrompt = async ({ message, ms = 60000 }) => {
15
+ const promptSecret = (await import('@inquirer/password')).default;
16
+ const answer = promptSecret({ message });
17
+ return Promise.race([answer, handleTimeout(answer, ms)]);
18
+ };
19
+ const handleTimeout = async (answer, ms, defaultAnswer) => setTimeout(ms, undefined, { ref: false }).then(() => {
20
+ answer.cancel();
21
+ if (typeof defaultAnswer !== 'undefined')
22
+ return defaultAnswer;
23
+ throw new SfError('Prompt timed out.');
24
+ });
25
+ export const prompts = { confirm, secretPrompt };
26
+ //# sourceMappingURL=prompts.js.map
@@ -1,4 +1,4 @@
1
- import { UxBase } from '.';
1
+ import { UxBase } from './base.js';
2
2
  /**
3
3
  * This class is a light wrapper around ux.action that allows us to
4
4
  * automatically suppress any actions if `--json` flag is present.
package/lib/ux/spinner.js CHANGED
@@ -1,19 +1,16 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Spinner = void 0;
10
- const core_1 = require("@oclif/core");
11
- const _1 = require(".");
7
+ import { ux } from '@oclif/core';
8
+ import { UxBase } from './base.js';
12
9
  /**
13
10
  * This class is a light wrapper around ux.action that allows us to
14
11
  * automatically suppress any actions if `--json` flag is present.
15
12
  */
16
- class Spinner extends _1.UxBase {
13
+ export class Spinner extends UxBase {
17
14
  constructor(outputEnabled) {
18
15
  super(outputEnabled);
19
16
  }
@@ -22,33 +19,32 @@ class Spinner extends _1.UxBase {
22
19
  */
23
20
  // eslint-disable-next-line class-methods-use-this
24
21
  get status() {
25
- return core_1.ux.action.status;
22
+ return ux.action.status;
26
23
  }
27
24
  /**
28
25
  * Set the status of the current spinner.
29
26
  */
30
27
  // eslint-disable-next-line class-methods-use-this
31
28
  set status(status) {
32
- core_1.ux.action.status = status;
29
+ ux.action.status = status;
33
30
  }
34
31
  /**
35
32
  * Start a spinner on the console.
36
33
  */
37
34
  start(action, status, opts) {
38
- this.maybeNoop(() => core_1.ux.action.start(action, status, opts));
35
+ this.maybeNoop(() => ux.action.start(action, status, opts));
39
36
  }
40
37
  /**
41
38
  * Stop the spinner on the console.
42
39
  */
43
40
  stop(msg) {
44
- this.maybeNoop(() => core_1.ux.action.stop(msg));
41
+ this.maybeNoop(() => ux.action.stop(msg));
45
42
  }
46
43
  /**
47
44
  * Pause the spinner on the console.
48
45
  */
49
46
  pause(fn, icon) {
50
- this.maybeNoop(() => core_1.ux.action.pause(fn, icon));
47
+ this.maybeNoop(() => ux.action.pause(fn, icon));
51
48
  }
52
49
  }
53
- exports.Spinner = Spinner;
54
50
  //# sourceMappingURL=spinner.js.map
@@ -0,0 +1,7 @@
1
+ export declare const StandardColors: {
2
+ error: import("chalk").ChalkInstance;
3
+ warning: import("chalk").ChalkInstance;
4
+ info: import("chalk").ChalkInstance;
5
+ success: import("chalk").ChalkInstance;
6
+ };
7
+ //# sourceMappingURL=standardColors.d.ts.map
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import chalk from 'chalk';
8
+ export const StandardColors = {
9
+ error: chalk.bold.red,
10
+ warning: chalk.bold.yellow,
11
+ info: chalk.dim,
12
+ success: chalk.bold.green,
13
+ };
14
+ //# sourceMappingURL=standardColors.js.map
package/lib/ux/ux.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { ux } from '@oclif/core';
2
2
  import { AnyJson } from '@salesforce/ts-types';
3
- import { UxBase } from './base';
4
- import { Prompter } from './prompter';
5
- import { Spinner } from './spinner';
3
+ import { UxBase } from './base.js';
4
+ import { Spinner } from './spinner.js';
6
5
  /**
7
6
  * UX methods for plugins. Automatically suppress console output if outputEnabled is set to false.
8
7
  *
@@ -21,7 +20,6 @@ import { Spinner } from './spinner';
21
20
  */
22
21
  export declare class Ux extends UxBase {
23
22
  readonly spinner: Spinner;
24
- readonly prompter: Prompter;
25
23
  readonly outputEnabled: boolean;
26
24
  constructor({ jsonEnabled }?: {
27
25
  jsonEnabled: boolean;
package/lib/ux/ux.js CHANGED
@@ -1,16 +1,12 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Ux = void 0;
10
- const core_1 = require("@oclif/core");
11
- const base_1 = require("./base");
12
- const prompter_1 = require("./prompter");
13
- const spinner_1 = require("./spinner");
7
+ import { ux } from '@oclif/core';
8
+ import { UxBase } from './base.js';
9
+ import { Spinner } from './spinner.js';
14
10
  /**
15
11
  * UX methods for plugins. Automatically suppress console output if outputEnabled is set to false.
16
12
  *
@@ -27,12 +23,13 @@ const spinner_1 = require("./spinner");
27
23
  *
28
24
  * ```
29
25
  */
30
- class Ux extends base_1.UxBase {
26
+ export class Ux extends UxBase {
27
+ spinner;
28
+ outputEnabled;
31
29
  constructor({ jsonEnabled } = { jsonEnabled: false }) {
32
30
  super(!jsonEnabled);
33
31
  this.outputEnabled = !jsonEnabled;
34
- this.spinner = new spinner_1.Spinner(this.outputEnabled);
35
- this.prompter = new prompter_1.Prompter();
32
+ this.spinner = new Spinner(this.outputEnabled);
36
33
  }
37
34
  /**
38
35
  * Log a message to the console. This will be automatically suppressed if output is disabled.
@@ -41,7 +38,7 @@ class Ux extends base_1.UxBase {
41
38
  * @param args Args to be used for formatting.
42
39
  */
43
40
  log(message, ...args) {
44
- this.maybeNoop(() => core_1.ux.log(message, ...args));
41
+ this.maybeNoop(() => ux.log(message, ...args));
45
42
  }
46
43
  /**
47
44
  * Log a warning message to the console. This will be automatically suppressed if output is disabled.
@@ -49,7 +46,7 @@ class Ux extends base_1.UxBase {
49
46
  * @param message Warning message to log.
50
47
  */
51
48
  warn(message) {
52
- this.maybeNoop(() => core_1.ux.warn(message));
49
+ this.maybeNoop(() => ux.warn(message));
53
50
  }
54
51
  /**
55
52
  * Display a table to the console. This will be automatically suppressed if output is disabled.
@@ -59,7 +56,7 @@ class Ux extends base_1.UxBase {
59
56
  * @param options Options for how the table should be displayed
60
57
  */
61
58
  table(data, columns, options) {
62
- this.maybeNoop(() => core_1.ux.table(data, columns, { 'no-truncate': true, ...options }));
59
+ this.maybeNoop(() => ux.table(data, columns, { 'no-truncate': true, ...options }));
63
60
  }
64
61
  /**
65
62
  * Display a url to the console. This will be automatically suppressed if output is disabled.
@@ -69,7 +66,7 @@ class Ux extends base_1.UxBase {
69
66
  * @param params
70
67
  */
71
68
  url(text, uri, params = {}) {
72
- this.maybeNoop(() => core_1.ux.url(text, uri, params));
69
+ this.maybeNoop(() => ux.url(text, uri, params));
73
70
  }
74
71
  /**
75
72
  * Display stylized JSON to the console. This will be automatically suppressed if output is disabled.
@@ -77,7 +74,7 @@ class Ux extends base_1.UxBase {
77
74
  * @param obj JSON to display
78
75
  */
79
76
  styledJSON(obj) {
80
- this.maybeNoop(() => core_1.ux.styledJSON(obj));
77
+ this.maybeNoop(() => ux.styledJSON(obj));
81
78
  }
82
79
  /**
83
80
  * Display stylized object to the console. This will be automatically suppressed if output is disabled.
@@ -86,7 +83,7 @@ class Ux extends base_1.UxBase {
86
83
  * @param keys Keys of object to display
87
84
  */
88
85
  styledObject(obj, keys) {
89
- this.maybeNoop(() => core_1.ux.styledObject(obj, keys));
86
+ this.maybeNoop(() => ux.styledObject(obj, keys));
90
87
  }
91
88
  /**
92
89
  * Display stylized header to the console. This will be automatically suppressed if output is disabled.
@@ -94,8 +91,7 @@ class Ux extends base_1.UxBase {
94
91
  * @param text header to display
95
92
  */
96
93
  styledHeader(text) {
97
- this.maybeNoop(() => core_1.ux.styledHeader(text));
94
+ this.maybeNoop(() => ux.styledHeader(text));
98
95
  }
99
96
  }
100
- exports.Ux = Ux;
101
97
  //# sourceMappingURL=ux.js.map
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "5.0.13",
3
+ "version": "5.0.14-dev.1",
4
4
  "description": "Utils for writing Salesforce CLI plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
7
+ "type": "module",
7
8
  "license": "BSD-3-Clause",
8
9
  "scripts": {
9
10
  "build": "wireit",
@@ -21,6 +22,13 @@
21
22
  "test": "wireit",
22
23
  "test:only": "wireit"
23
24
  },
25
+ "exports": {
26
+ "./SfCommand": "./lib/SfCommand.js",
27
+ "./Flags": "./lib/flags/flags.js",
28
+ "./Ux": "./lib/ux/ux.js",
29
+ "./StandardColors": "./lib/ux/standardColors.js",
30
+ ".": "./lib/exported.js"
31
+ },
24
32
  "repository": "salesforcecli/sf-plugins-core",
25
33
  "bugs": {
26
34
  "url": "https://github.com/salesforcecli/sf-plugins-core/issues"
@@ -35,22 +43,20 @@
35
43
  "node": ">=18.0.0"
36
44
  },
37
45
  "dependencies": {
38
- "@oclif/core": "^3.15.1",
39
- "@salesforce/core": "^6.4.1",
46
+ "@inquirer/confirm": "^2.0.15",
47
+ "@inquirer/password": "^1.1.14",
48
+ "@oclif/core": "^3.16.0",
49
+ "@salesforce/core": "^6.4.2",
40
50
  "@salesforce/kit": "^3.0.15",
41
51
  "@salesforce/ts-types": "^2.0.9",
42
- "@types/inquirer": "^8.2.3",
43
- "chalk": "^4",
44
- "inquirer": "^8.2.5"
52
+ "chalk": "^5.3.0"
45
53
  },
46
54
  "devDependencies": {
47
- "@oclif/test": "^3.1.5",
48
- "@salesforce/dev-scripts": "^8.1.2",
55
+ "@inquirer/type": "^1.1.5",
56
+ "@salesforce/dev-scripts": "^8.1.3",
49
57
  "eslint-plugin-sf-plugin": "^1.17.0",
50
- "shelljs": "0.8.5",
51
- "strip-ansi": "6.0.1",
52
58
  "ts-node": "^10.9.2",
53
- "typescript": "^4.9.5"
59
+ "typescript": "^5.3.3"
54
60
  },
55
61
  "publishConfig": {
56
62
  "access": "public"
@@ -1,22 +0,0 @@
1
- import { JsonMap } from '@salesforce/ts-types';
2
- /**
3
- * The Deauthorizer is an abstract class that is used to implement a concrete implementation of deauthorizing an environment.
4
- */
5
- export declare abstract class Deauthorizer<T = JsonMap> {
6
- removeAll(): Promise<Deauthorizer.Result>;
7
- /**
8
- * This method should return a list of all the environments a deauthorizer could deauthorize.
9
- */
10
- abstract find(): Promise<Record<string, T>>;
11
- /**
12
- * This method should deauthorize an environment.
13
- */
14
- abstract remove(id: string): Promise<boolean>;
15
- }
16
- export declare namespace Deauthorizer {
17
- type Result = {
18
- successes: string[];
19
- failures: string[];
20
- };
21
- }
22
- //# sourceMappingURL=deauthorizer.d.ts.map
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022, 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.Deauthorizer = void 0;
10
- /**
11
- * The Deauthorizer is an abstract class that is used to implement a concrete implementation of deauthorizing an environment.
12
- */
13
- class Deauthorizer {
14
- async removeAll() {
15
- const result = {
16
- successes: [],
17
- failures: [],
18
- };
19
- const environments = await this.find();
20
- for (const id of Object.keys(environments)) {
21
- try {
22
- // avoid configFile collision bug
23
- // eslint-disable-next-line no-await-in-loop
24
- await this.remove(id);
25
- result.successes.push(id);
26
- }
27
- catch {
28
- result.failures.push(id);
29
- }
30
- }
31
- return result;
32
- }
33
- }
34
- exports.Deauthorizer = Deauthorizer;
35
- //# sourceMappingURL=deauthorizer.js.map
package/lib/deployer.d.ts DELETED
@@ -1,81 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'node:events';
3
- import { AnyJson, JsonMap } from '@salesforce/ts-types';
4
- import { QuestionCollection, Answers } from 'inquirer';
5
- export type DeployerResult = {
6
- exitCode: number;
7
- };
8
- export declare abstract class Deployable {
9
- abstract getName(): string;
10
- abstract getType(): string;
11
- abstract getPath(): string;
12
- abstract getParent(): Deployer;
13
- }
14
- /**
15
- * Interface for deploying Deployables.
16
- */
17
- export declare abstract class Deployer extends EventEmitter {
18
- /**
19
- * Deployables are individual pieces that can be deployed on their own. For example,
20
- * each package in a salesforce project is considered a deployable that can be deployed
21
- * on its own.
22
- */
23
- deployables: Deployable[];
24
- private prompter;
25
- /**
26
- * Method for displaying deploy progress to the user
27
- */
28
- progress(current: number, total: number, message: string): void;
29
- /**
30
- * Log messages to the console
31
- */
32
- log(msg?: string | undefined, ...args: string[]): void;
33
- /**
34
- * Prompt user for additional information
35
- */
36
- prompt<T extends Answers>(questions: QuestionCollection<T>, initialAnswers?: Partial<T>): Promise<T>;
37
- /**
38
- * Overwrite the deployables property on the class.
39
- */
40
- selectDeployables(deployables: Deployable[]): void;
41
- /**
42
- * The human readable name of the deployer
43
- */
44
- abstract getName(): string;
45
- /**
46
- * Perform any initialization or setup. This is the time to prompt the
47
- * user for any needed information.
48
- *
49
- * If options are passed it, it should use those instead of prompting the for the passed in information
50
- *
51
- * Uses the returned dictionary as the information to store in the deploy-options.json file.
52
- */
53
- abstract setup(flags: Deployer.Flags, options: Deployer.Options): Promise<Deployer.Options>;
54
- /**
55
- * Deploy the app.
56
- */
57
- abstract deploy<R extends DeployerResult>(): Promise<void | R>;
58
- }
59
- export declare namespace Deployer {
60
- type Flags = {
61
- interactive: boolean;
62
- };
63
- /**
64
- * This interface represents the aggregation of all deployer options, e.g.
65
- *
66
- * @example
67
- * ```
68
- * {
69
- * 'Salesforce Apps': {
70
- * testLevel: 'RunLocalTests',
71
- * apps: ['force-app'],
72
- * },
73
- * 'Salesforce Functions': { username: 'user@salesforce.com' },
74
- * }
75
- * ```
76
- */
77
- type Options<T = AnyJson> = JsonMap & {
78
- [key: string]: T | undefined;
79
- };
80
- }
81
- //# sourceMappingURL=deployer.d.ts.map