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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +9 -70
  8. package/lib/exported.js +9 -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/prompts.d.ts +13 -0
  20. package/lib/prompts.js +25 -0
  21. package/lib/sfCommand.d.ts +26 -94
  22. package/lib/sfCommand.js +130 -131
  23. package/lib/sfCommandNamespace.d.ts +24 -0
  24. package/lib/sfCommandNamespace.js +2 -0
  25. package/lib/stubUx.d.ts +7 -9
  26. package/lib/stubUx.js +30 -37
  27. package/lib/tsconfig.tsbuildinfo +1 -1
  28. package/lib/util.d.ts +1 -0
  29. package/lib/util.js +9 -13
  30. package/lib/ux/base.d.ts +1 -1
  31. package/lib/ux/base.js +2 -5
  32. package/lib/ux/progress.d.ts +1 -1
  33. package/lib/ux/progress.js +15 -17
  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/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2023, Salesforce.com, Inc.
1
+ Copyright (c) 2024, Salesforce.com, Inc.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
package/README.md CHANGED
@@ -16,10 +16,7 @@ The SfCommand abstract class extends [@oclif/core's Command class](https://githu
16
16
  - Provides functions that help place success messages, warnings and errors into the correct location in JSON results
17
17
  - Enables additional help sections to the standard oclif command help output
18
18
  - Provides access to the [cli-ux cli actions](https://github.com/oclif/cli-ux#cliaction). This avoids having to import that interface from cli-ux and manually handling the `--json` flag.
19
-
20
- ## Prompter Class
21
-
22
- A general purpose class that prompts a user for information. See [inquirer NPM Module](https://www.npmjs.com/package/inquirer) for more information.
19
+ - Provides simple, stubbable prompts for confirmation and secrets
23
20
 
24
21
  ## Flags
25
22
 
@@ -29,7 +26,7 @@ Flags is a convenience reference to [@oclif/core#Flags](https://github.com/oclif
29
26
 
30
27
  These flags can be imported into a command and used like any other flag. See code examples in the links
31
28
 
32
- - [orgApiVersionFlag](src/flags/apiVersion.ts)
29
+ - [orgApiVersionFlag](src/flags/orgApiVersion.ts)
33
30
  - specifies a Salesforce API version.
34
31
  - reads from Config (if available)
35
32
  - validates version is still active
@@ -14,7 +14,7 @@
14
14
  * }
15
15
  * ```
16
16
  */
17
- export declare const orgApiVersionFlagWithDeprecations: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
17
+ export declare const orgApiVersionFlagWithDeprecations: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
18
18
  /**
19
19
  * Use only for commands that maintain sfdx compatibility.
20
20
  * Flag will be hidden and will show a warning if used.
@@ -23,23 +23,23 @@ export declare const orgApiVersionFlagWithDeprecations: import("@oclif/core/lib/
23
23
  * @deprecated
24
24
  *
25
25
  */
26
- export declare const loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
26
+ export declare const loglevel: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
27
27
  /**
28
28
  * @deprecated
29
29
  */
30
- export declare const optionalOrgFlagWithDeprecations: import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces").CustomOptions>;
30
+ export declare const optionalOrgFlagWithDeprecations: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
31
31
  /**
32
32
  * @deprecated
33
33
  */
34
- export declare const requiredOrgFlagWithDeprecations: import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces").CustomOptions>;
34
+ export declare const requiredOrgFlagWithDeprecations: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
35
35
  /**
36
36
  * @deprecated
37
37
  */
38
- export declare const requiredHubFlagWithDeprecations: import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces").CustomOptions>;
38
+ export declare const requiredHubFlagWithDeprecations: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
39
39
  /**
40
40
  * @deprecated
41
41
  */
42
- export declare const optionalHubFlagWithDeprecations: import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
42
+ export declare const optionalHubFlagWithDeprecations: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
43
43
  export type ArrayWithDeprecationOptions = {
44
44
  multiple?: true;
45
45
  parse?: undefined;
@@ -47,7 +47,7 @@ export type ArrayWithDeprecationOptions = {
47
47
  /**
48
48
  * @deprecated
49
49
  */
50
- export declare const arrayWithDeprecation: import("@oclif/core/lib/interfaces").FlagDefinition<string[], ArrayWithDeprecationOptions, {
50
+ export declare const arrayWithDeprecation: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<string[], ArrayWithDeprecationOptions, {
51
51
  multiple: true;
52
52
  requiredOrDefaulted: true;
53
53
  }>;
@@ -1,16 +1,13 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2020, 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.arrayWithDeprecation = exports.optionalHubFlagWithDeprecations = exports.requiredHubFlagWithDeprecations = exports.requiredOrgFlagWithDeprecations = exports.optionalOrgFlagWithDeprecations = exports.loglevel = exports.orgApiVersionFlagWithDeprecations = void 0;
10
- const core_1 = require("@oclif/core");
11
- const core_2 = require("@salesforce/core");
12
- const orgApiVersion_1 = require("./flags/orgApiVersion");
13
- const orgFlags_1 = require("./flags/orgFlags");
7
+ import { Flags } from '@oclif/core';
8
+ import { Lifecycle, Messages } from '@salesforce/core';
9
+ import { orgApiVersionFlag } from './flags/orgApiVersion.js';
10
+ import { optionalHubFlag, optionalOrgFlag, requiredHubFlag, requiredOrgFlag } from './flags/orgFlags.js';
14
11
  /**
15
12
  * Adds an alias for the deprecated sfdx-style "apiversion" and provides a warning if it is used
16
13
  * See orgApiVersionFlag for full details
@@ -27,12 +24,12 @@ const orgFlags_1 = require("./flags/orgFlags");
27
24
  * }
28
25
  * ```
29
26
  */
30
- exports.orgApiVersionFlagWithDeprecations = (0, orgApiVersion_1.orgApiVersionFlag)({
27
+ export const orgApiVersionFlagWithDeprecations = orgApiVersionFlag({
31
28
  aliases: ['apiversion'],
32
29
  deprecateAliases: true,
33
30
  });
34
- core_2.Messages.importMessagesDirectory(__dirname);
35
- const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
31
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
32
+ const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
36
33
  /**
37
34
  * Use only for commands that maintain sfdx compatibility.
38
35
  * Flag will be hidden and will show a warning if used.
@@ -41,7 +38,7 @@ const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'me
41
38
  * @deprecated
42
39
  *
43
40
  */
44
- exports.loglevel = core_1.Flags.string({
41
+ export const loglevel = Flags.string({
45
42
  hidden: true,
46
43
  deprecated: {
47
44
  message: messages.getMessage('warning.loglevel'),
@@ -54,20 +51,20 @@ const deprecatedOrgAliases = {
54
51
  /**
55
52
  * @deprecated
56
53
  */
57
- exports.optionalOrgFlagWithDeprecations = (0, orgFlags_1.optionalOrgFlag)({
54
+ export const optionalOrgFlagWithDeprecations = optionalOrgFlag({
58
55
  ...deprecatedOrgAliases,
59
56
  });
60
57
  /**
61
58
  * @deprecated
62
59
  */
63
- exports.requiredOrgFlagWithDeprecations = (0, orgFlags_1.requiredOrgFlag)({
60
+ export const requiredOrgFlagWithDeprecations = requiredOrgFlag({
64
61
  ...deprecatedOrgAliases,
65
62
  required: true,
66
63
  });
67
64
  /**
68
65
  * @deprecated
69
66
  */
70
- exports.requiredHubFlagWithDeprecations = (0, orgFlags_1.requiredHubFlag)({
67
+ export const requiredHubFlagWithDeprecations = requiredHubFlag({
71
68
  aliases: ['targetdevhubusername'],
72
69
  deprecateAliases: true,
73
70
  required: true,
@@ -75,7 +72,7 @@ exports.requiredHubFlagWithDeprecations = (0, orgFlags_1.requiredHubFlag)({
75
72
  /**
76
73
  * @deprecated
77
74
  */
78
- exports.optionalHubFlagWithDeprecations = (0, orgFlags_1.optionalHubFlag)({
75
+ export const optionalHubFlagWithDeprecations = optionalHubFlag({
79
76
  aliases: ['targetdevhubusername'],
80
77
  deprecateAliases: true,
81
78
  required: false,
@@ -83,7 +80,7 @@ exports.optionalHubFlagWithDeprecations = (0, orgFlags_1.optionalHubFlag)({
83
80
  /**
84
81
  * @deprecated
85
82
  */
86
- exports.arrayWithDeprecation = core_1.Flags.custom({
83
+ export const arrayWithDeprecation = Flags.custom({
87
84
  multiple: true,
88
85
  delimiter: ',',
89
86
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -94,7 +91,7 @@ exports.arrayWithDeprecation = core_1.Flags.custom({
94
91
  parse: async (input, ctx) => {
95
92
  const inputParts = ctx.token.input.split(',').map((i) => i.trim());
96
93
  if (inputParts.length > 1) {
97
- await core_2.Lifecycle.getInstance().emitWarning(messages.getMessage('warning.arrayInputFormat'));
94
+ await Lifecycle.getInstance().emitWarning(messages.getMessage('warning.arrayInputFormat'));
98
95
  }
99
96
  return input;
100
97
  },
@@ -0,0 +1,22 @@
1
+ import type { ChalkInstance } from 'chalk';
2
+ import { SfCommand } from './sfCommandNamespace.js';
3
+ /**
4
+ * Format errors and actions for human consumption. Adds 'Error (<ErrorCode>):',
5
+ * When there are actions, we add 'Try this:' in blue
6
+ * followed by each action in red on its own line.
7
+ * If Error.code is present it is output last in parentheses
8
+ *
9
+ * @returns {string} Returns decorated messages.
10
+ */
11
+ /**
12
+ * Utility function to format actions lines
13
+ *
14
+ * @param actions
15
+ * @param options
16
+ * @private
17
+ */
18
+ export declare const formatActions: (actions: string[], options?: {
19
+ actionColor: ChalkInstance;
20
+ }) => string[];
21
+ export declare const formatError: (error: SfCommand.Error) => string;
22
+ //# sourceMappingURL=errorFormatting.d.ts.map
@@ -0,0 +1,41 @@
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 { Mode, Messages, envVars } from '@salesforce/core';
8
+ import { StandardColors } from './ux/standardColors.js';
9
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
10
+ const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
11
+ /**
12
+ * Format errors and actions for human consumption. Adds 'Error (<ErrorCode>):',
13
+ * When there are actions, we add 'Try this:' in blue
14
+ * followed by each action in red on its own line.
15
+ * If Error.code is present it is output last in parentheses
16
+ *
17
+ * @returns {string} Returns decorated messages.
18
+ */
19
+ /**
20
+ * Utility function to format actions lines
21
+ *
22
+ * @param actions
23
+ * @param options
24
+ * @private
25
+ */
26
+ export const formatActions = (actions, options = { actionColor: StandardColors.info }) => actions.length
27
+ ? [
28
+ `\n${StandardColors.info(messages.getMessage('actions.tryThis'))}\n`,
29
+ ...actions.map((a) => `${options.actionColor(a)}`),
30
+ ]
31
+ : [];
32
+ export const formatError = (error) => [
33
+ `${formatErrorPrefix(error)} ${error.message}`,
34
+ ...formatActions(error.actions ?? []),
35
+ error.stack && envVars.getString('SF_ENV') === Mode.DEVELOPMENT
36
+ ? StandardColors.info(`\n*** Internal Diagnostic ***\n\n${error.stack}\n******\n`)
37
+ : [],
38
+ ].join('\n');
39
+ const formatErrorPrefix = (error) => `${StandardColors.error(messages.getMessage('error.prefix', [formatErrorCode(error)]))}`;
40
+ const formatErrorCode = (error) => typeof error.code === 'string' || typeof error.code === 'number' ? ` (${error.code})` : '';
41
+ //# sourceMappingURL=errorFormatting.js.map
package/lib/exported.d.ts CHANGED
@@ -1,71 +1,10 @@
1
- /// <reference types="node" />
2
- import { Flags as OclifFlags } from '@oclif/core';
3
- export { toHelpSection, parseVarArgs } from './util';
4
- export { Deployable, Deployer, DeployerResult } from './deployer';
5
- export { Deauthorizer } from './deauthorizer';
6
- export { Progress, Prompter, generateTableChoices, Ux, Spinner, Separator } from './ux';
7
- export { SfHook } from './hooks';
8
- export * from './types';
9
- export { SfCommand, SfCommandInterface, StandardColors } from './sfCommand';
10
- export * from './compatibility';
11
- export * from './stubUx';
12
- export declare const Flags: {
13
- boolean: typeof OclifFlags.boolean;
14
- directory: import("@oclif/core/lib/interfaces").FlagDefinition<string, {
15
- exists?: boolean | undefined;
16
- }, {
17
- multiple: false;
18
- requiredOrDefaulted: false;
19
- }>;
20
- file: import("@oclif/core/lib/interfaces").FlagDefinition<string, {
21
- exists?: boolean | undefined;
22
- }, {
23
- multiple: false;
24
- requiredOrDefaulted: false;
25
- }>;
26
- integer: import("@oclif/core/lib/interfaces").FlagDefinition<number, {
27
- max?: number | undefined;
28
- min?: number | undefined;
29
- }, {
30
- multiple: false;
31
- requiredOrDefaulted: false;
32
- }>;
33
- string: import("@oclif/core/lib/interfaces").FlagDefinition<string, import("@oclif/core/lib/interfaces").CustomOptions, {
34
- multiple: false;
35
- requiredOrDefaulted: false;
36
- }>;
37
- url: import("@oclif/core/lib/interfaces").FlagDefinition<import("url").URL, import("@oclif/core/lib/interfaces").CustomOptions, {
38
- multiple: false;
39
- requiredOrDefaulted: false;
40
- }>;
41
- custom: typeof OclifFlags.custom;
42
- duration: import("@oclif/core/lib/interfaces").FlagDefinition<import("@salesforce/kit").Duration, import("./flags/duration").DurationFlagConfig, {
43
- multiple: false;
44
- requiredOrDefaulted: true;
45
- }>;
46
- salesforceId: import("@oclif/core/lib/interfaces").FlagDefinition<string, import("./flags/salesforceId").IdFlagConfig, {
47
- multiple: false;
48
- requiredOrDefaulted: false;
49
- }>;
50
- orgApiVersion: import("@oclif/core/lib/interfaces").FlagDefinition<string, import("@oclif/core/lib/interfaces").CustomOptions, {
51
- multiple: false;
52
- requiredOrDefaulted: false;
53
- }>;
54
- requiredOrg: import("@oclif/core/lib/interfaces").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces").CustomOptions, {
55
- multiple: false;
56
- requiredOrDefaulted: true;
57
- }>;
58
- requiredHub: import("@oclif/core/lib/interfaces").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces").CustomOptions, {
59
- multiple: false;
60
- requiredOrDefaulted: true;
61
- }>;
62
- optionalOrg: import("@oclif/core/lib/interfaces").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces").CustomOptions, {
63
- multiple: false;
64
- requiredOrDefaulted: true;
65
- }>;
66
- optionalHub: import("@oclif/core/lib/interfaces").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces").CustomOptions, {
67
- multiple: false;
68
- requiredOrDefaulted: true;
69
- }>;
70
- };
1
+ export { toHelpSection, parseVarArgs } from './util.js';
2
+ export { Progress } from './ux/progress.js';
3
+ export { Spinner } from './ux/spinner.js';
4
+ export { Ux } from './ux/ux.js';
5
+ export { StandardColors } from './ux/standardColors.js';
6
+ export { SfCommand, SfCommandInterface } from './sfCommand.js';
7
+ export * from './compatibility.js';
8
+ export * from './stubUx.js';
9
+ export { Flags } from './flags/flags.js';
71
10
  //# sourceMappingURL=exported.d.ts.map
package/lib/exported.js CHANGED
@@ -1,69 +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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.Flags = exports.StandardColors = exports.SfCommand = exports.SfHook = exports.Separator = exports.Spinner = exports.Ux = exports.generateTableChoices = exports.Prompter = exports.Progress = exports.Deauthorizer = exports.Deployer = exports.Deployable = exports.parseVarArgs = exports.toHelpSection = void 0;
24
- const core_1 = require("@oclif/core");
25
- var util_1 = require("./util");
26
- Object.defineProperty(exports, "toHelpSection", { enumerable: true, get: function () { return util_1.toHelpSection; } });
27
- Object.defineProperty(exports, "parseVarArgs", { enumerable: true, get: function () { return util_1.parseVarArgs; } });
28
- var deployer_1 = require("./deployer");
29
- Object.defineProperty(exports, "Deployable", { enumerable: true, get: function () { return deployer_1.Deployable; } });
30
- Object.defineProperty(exports, "Deployer", { enumerable: true, get: function () { return deployer_1.Deployer; } });
31
- var deauthorizer_1 = require("./deauthorizer");
32
- Object.defineProperty(exports, "Deauthorizer", { enumerable: true, get: function () { return deauthorizer_1.Deauthorizer; } });
33
- var ux_1 = require("./ux");
34
- Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return ux_1.Progress; } });
35
- Object.defineProperty(exports, "Prompter", { enumerable: true, get: function () { return ux_1.Prompter; } });
36
- Object.defineProperty(exports, "generateTableChoices", { enumerable: true, get: function () { return ux_1.generateTableChoices; } });
37
- Object.defineProperty(exports, "Ux", { enumerable: true, get: function () { return ux_1.Ux; } });
38
- Object.defineProperty(exports, "Spinner", { enumerable: true, get: function () { return ux_1.Spinner; } });
39
- Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return ux_1.Separator; } });
40
- var hooks_1 = require("./hooks");
41
- Object.defineProperty(exports, "SfHook", { enumerable: true, get: function () { return hooks_1.SfHook; } });
42
- __exportStar(require("./types"), exports);
43
- var sfCommand_1 = require("./sfCommand");
44
- Object.defineProperty(exports, "SfCommand", { enumerable: true, get: function () { return sfCommand_1.SfCommand; } });
45
- Object.defineProperty(exports, "StandardColors", { enumerable: true, get: function () { return sfCommand_1.StandardColors; } });
46
- __exportStar(require("./compatibility"), exports);
47
- __exportStar(require("./stubUx"), exports);
48
- // custom flags
49
- const orgFlags_1 = require("./flags/orgFlags");
50
- const salesforceId_1 = require("./flags/salesforceId");
51
- const orgApiVersion_1 = require("./flags/orgApiVersion");
52
- const duration_1 = require("./flags/duration");
53
- exports.Flags = {
54
- boolean: core_1.Flags.boolean,
55
- directory: core_1.Flags.directory,
56
- file: core_1.Flags.file,
57
- integer: core_1.Flags.integer,
58
- string: core_1.Flags.string,
59
- url: core_1.Flags.url,
60
- custom: core_1.Flags.custom,
61
- duration: duration_1.durationFlag,
62
- salesforceId: salesforceId_1.salesforceIdFlag,
63
- orgApiVersion: orgApiVersion_1.orgApiVersionFlag,
64
- requiredOrg: orgFlags_1.requiredOrgFlag,
65
- requiredHub: orgFlags_1.requiredHubFlag,
66
- optionalOrg: orgFlags_1.optionalOrgFlag,
67
- optionalHub: orgFlags_1.optionalHubFlag,
68
- };
7
+ export { toHelpSection, parseVarArgs } from './util.js';
8
+ export { Progress } from './ux/progress.js';
9
+ export { Spinner } from './ux/spinner.js';
10
+ export { Ux } from './ux/ux.js';
11
+ export { StandardColors } from './ux/standardColors.js';
12
+ export { SfCommand } from './sfCommand.js';
13
+ export * from './compatibility.js';
14
+ export * from './stubUx.js';
15
+ export { Flags } from './flags/flags.js';
69
16
  //# sourceMappingURL=exported.js.map
@@ -26,7 +26,7 @@ export type DurationFlagConfig = {
26
26
  * }
27
27
  * ```
28
28
  */
29
- export declare const durationFlag: import("@oclif/core/lib/interfaces").FlagDefinition<Duration, DurationFlagConfig, {
29
+ export declare const durationFlag: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<Duration, DurationFlagConfig, {
30
30
  multiple: false;
31
31
  requiredOrDefaulted: true;
32
32
  }>;
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.durationFlag = void 0;
4
1
  /*
5
2
  * Copyright (c) 2020, salesforce.com, inc.
6
3
  * All rights reserved.
7
4
  * Licensed under the BSD 3-Clause license.
8
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
6
  */
10
- const core_1 = require("@oclif/core");
11
- const core_2 = require("@salesforce/core");
12
- const kit_1 = require("@salesforce/kit");
13
- core_2.Messages.importMessagesDirectory(__dirname);
14
- const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
7
+ import { Flags } from '@oclif/core';
8
+ import { Messages } from '@salesforce/core';
9
+ import { Duration } from '@salesforce/kit';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
15
12
  /**
16
13
  * Duration flag with built-in default and min/max validation
17
14
  * You must specify a unit
@@ -32,7 +29,7 @@ const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'me
32
29
  * }
33
30
  * ```
34
31
  */
35
- exports.durationFlag = core_1.Flags.custom({
32
+ export const durationFlag = Flags.custom({
36
33
  // eslint-disable-next-line @typescript-eslint/require-await
37
34
  parse: async (input, _, opts) => validate(input, opts),
38
35
  // eslint-disable-next-line @typescript-eslint/require-await
@@ -63,5 +60,5 @@ const validate = (input, config) => {
63
60
  }
64
61
  return toDuration(parsedInput, unit);
65
62
  };
66
- const toDuration = (parsedInput, unit) => kit_1.Duration[unit](parsedInput);
63
+ const toDuration = (parsedInput, unit) => Duration[unit](parsedInput);
67
64
  //# sourceMappingURL=duration.js.map
@@ -0,0 +1,63 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Flags as OclifFlags } from '@oclif/core';
3
+ export declare const Flags: {
4
+ boolean: typeof OclifFlags.boolean;
5
+ directory: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<string, {
6
+ exists?: boolean | undefined;
7
+ }, {
8
+ multiple: false;
9
+ requiredOrDefaulted: false;
10
+ }>;
11
+ file: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<string, {
12
+ exists?: boolean | undefined;
13
+ }, {
14
+ multiple: false;
15
+ requiredOrDefaulted: false;
16
+ }>;
17
+ integer: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<number, {
18
+ max?: number | undefined;
19
+ min?: number | undefined;
20
+ }, {
21
+ multiple: false;
22
+ requiredOrDefaulted: false;
23
+ }>;
24
+ string: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
25
+ multiple: false;
26
+ requiredOrDefaulted: false;
27
+ }>;
28
+ option: typeof OclifFlags.option;
29
+ url: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<import("url").URL, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
30
+ multiple: false;
31
+ requiredOrDefaulted: false;
32
+ }>;
33
+ custom: typeof OclifFlags.custom;
34
+ duration: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<import("@salesforce/kit").Duration, import("./duration.js").DurationFlagConfig, {
35
+ multiple: false;
36
+ requiredOrDefaulted: true;
37
+ }>;
38
+ salesforceId: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<string, import("./salesforceId.js").IdFlagConfig, {
39
+ multiple: false;
40
+ requiredOrDefaulted: false;
41
+ }>;
42
+ orgApiVersion: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
43
+ multiple: false;
44
+ requiredOrDefaulted: false;
45
+ }>;
46
+ requiredOrg: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
47
+ multiple: false;
48
+ requiredOrDefaulted: true;
49
+ }>;
50
+ requiredHub: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
51
+ multiple: false;
52
+ requiredOrDefaulted: true;
53
+ }>;
54
+ optionalOrg: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
55
+ multiple: false;
56
+ requiredOrDefaulted: true;
57
+ }>;
58
+ optionalHub: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
59
+ multiple: false;
60
+ requiredOrDefaulted: true;
61
+ }>;
62
+ };
63
+ //# sourceMappingURL=flags.d.ts.map
@@ -0,0 +1,30 @@
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 { Flags as OclifFlags } from '@oclif/core';
8
+ // custom flags
9
+ import { requiredOrgFlag, requiredHubFlag, optionalOrgFlag, optionalHubFlag } from './orgFlags.js';
10
+ import { salesforceIdFlag } from './salesforceId.js';
11
+ import { orgApiVersionFlag } from './orgApiVersion.js';
12
+ import { durationFlag } from './duration.js';
13
+ export const Flags = {
14
+ boolean: OclifFlags.boolean,
15
+ directory: OclifFlags.directory,
16
+ file: OclifFlags.file,
17
+ integer: OclifFlags.integer,
18
+ string: OclifFlags.string,
19
+ option: OclifFlags.option,
20
+ url: OclifFlags.url,
21
+ custom: OclifFlags.custom,
22
+ duration: durationFlag,
23
+ salesforceId: salesforceIdFlag,
24
+ orgApiVersion: orgApiVersionFlag,
25
+ requiredOrg: requiredOrgFlag,
26
+ requiredHub: requiredHubFlag,
27
+ optionalOrg: optionalOrgFlag,
28
+ optionalHub: optionalHubFlag,
29
+ };
30
+ //# sourceMappingURL=flags.js.map
@@ -21,7 +21,7 @@ export declare const maxDeprecatedUrl = "https://help.salesforce.com/s/articleVi
21
21
  * }
22
22
  * ```
23
23
  */
24
- export declare const orgApiVersionFlag: import("@oclif/core/lib/interfaces").FlagDefinition<string, import("@oclif/core/lib/interfaces").CustomOptions, {
24
+ export declare const orgApiVersionFlag: import("@oclif/core/lib/interfaces/parser.js").FlagDefinition<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions, {
25
25
  multiple: false;
26
26
  requiredOrDefaulted: false;
27
27
  }>;
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.orgApiVersionFlag = exports.maxDeprecatedUrl = exports.maxDeprecated = exports.minValidApiVersion = void 0;
4
1
  /*
5
2
  * Copyright (c) 2020, salesforce.com, inc.
6
3
  * All rights reserved.
7
4
  * Licensed under the BSD 3-Clause license.
8
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
6
  */
10
- const core_1 = require("@oclif/core");
11
- const core_2 = require("@salesforce/core");
12
- core_2.Messages.importMessagesDirectory(__dirname);
13
- const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
7
+ import { Flags } from '@oclif/core';
8
+ import { Messages, Lifecycle, OrgConfigProperties, validateApiVersion } from '@salesforce/core';
9
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
10
+ const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
14
11
  // versions below this are retired
15
- exports.minValidApiVersion = 21;
12
+ export const minValidApiVersion = 21;
16
13
  // this and all un-retired versions below it are deprecated
17
- exports.maxDeprecated = 30;
18
- exports.maxDeprecatedUrl = 'https://help.salesforce.com/s/articleView?id=000354473&type=1;';
14
+ export const maxDeprecated = 30;
15
+ export const maxDeprecatedUrl = 'https://help.salesforce.com/s/articleView?id=000354473&type=1;';
19
16
  /**
20
17
  * apiVersion for a salesforce org's rest api.
21
18
  * Will validate format and that the api version is still supported.
@@ -36,32 +33,32 @@ exports.maxDeprecatedUrl = 'https://help.salesforce.com/s/articleView?id=0003544
36
33
  * }
37
34
  * ```
38
35
  */
39
- exports.orgApiVersionFlag = core_1.Flags.custom({
36
+ export const orgApiVersionFlag = Flags.custom({
40
37
  parse: async (input) => validate(input),
41
38
  default: async () => getDefaultFromConfig(),
42
39
  description: messages.getMessage('flags.apiVersion.description'),
43
40
  });
44
41
  const getDefaultFromConfig = async () => {
45
42
  // (perf) only import ConfigAggregator if necessary
46
- const { ConfigAggregator } = await Promise.resolve().then(() => require('@salesforce/core'));
43
+ const { ConfigAggregator } = await import('@salesforce/core');
47
44
  const config = await ConfigAggregator.create();
48
- const apiVersionFromConfig = config.getInfo(core_2.OrgConfigProperties.ORG_API_VERSION)?.value;
45
+ const apiVersionFromConfig = config.getInfo(OrgConfigProperties.ORG_API_VERSION)?.value;
49
46
  if (apiVersionFromConfig) {
50
- await core_2.Lifecycle.getInstance().emitWarning(messages.getMessage('flags.apiVersion.overrideWarning', [apiVersionFromConfig]));
47
+ await Lifecycle.getInstance().emitWarning(messages.getMessage('flags.apiVersion.overrideWarning', [apiVersionFromConfig]));
51
48
  return validate(apiVersionFromConfig);
52
49
  }
53
50
  };
54
51
  const validate = async (input) => {
55
52
  // basic format check
56
- if (!(0, core_2.validateApiVersion)(input)) {
53
+ if (!validateApiVersion(input)) {
57
54
  throw messages.createError('errors.InvalidApiVersion', [input]);
58
55
  }
59
56
  const requestedVersion = parseInt(input, 10);
60
- if (requestedVersion < exports.minValidApiVersion) {
61
- throw messages.createError('errors.RetiredApiVersion', [exports.minValidApiVersion]);
57
+ if (requestedVersion < minValidApiVersion) {
58
+ throw messages.createError('errors.RetiredApiVersion', [minValidApiVersion]);
62
59
  }
63
- if (requestedVersion <= exports.maxDeprecated) {
64
- await core_2.Lifecycle.getInstance().emitWarning(messages.getMessage('flags.apiVersion.warning.deprecated', [exports.maxDeprecated, exports.maxDeprecatedUrl]));
60
+ if (requestedVersion <= maxDeprecated) {
61
+ await Lifecycle.getInstance().emitWarning(messages.getMessage('flags.apiVersion.warning.deprecated', [maxDeprecated, maxDeprecatedUrl]));
65
62
  }
66
63
  return input;
67
64
  };