@salesforce/core 6.7.7-qa.0 → 7.0.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.
@@ -5,7 +5,7 @@ import { ConfigContents, ConfigValue, Key } from './configStackTypes';
5
5
  /**
6
6
  * Interface for meta information about config properties
7
7
  */
8
- export interface ConfigPropertyMeta {
8
+ export type ConfigPropertyMeta = {
9
9
  /**
10
10
  * The config property name.
11
11
  */
@@ -35,11 +35,11 @@ export interface ConfigPropertyMeta {
35
35
  * Is only used if deprecated is set to true.
36
36
  */
37
37
  newKey?: string;
38
- }
38
+ };
39
39
  /**
40
40
  * Config property input validation
41
41
  */
42
- export interface ConfigPropertyMetaInput {
42
+ export type ConfigPropertyMetaInput = {
43
43
  /**
44
44
  * Tests if the input value is valid and returns true if the input data is valid.
45
45
  *
@@ -50,7 +50,7 @@ export interface ConfigPropertyMetaInput {
50
50
  * The message to return in the error if the validation fails.
51
51
  */
52
52
  failedMessage: string | ((value: ConfigValue) => string);
53
- }
53
+ };
54
54
  export declare enum SfConfigProperties {
55
55
  /**
56
56
  * Disables telemetry reporting
@@ -4,7 +4,7 @@ import { Config, ConfigPropertyMeta } from './config';
4
4
  /**
5
5
  * Information about a config property.
6
6
  */
7
- export interface ConfigInfo {
7
+ export type ConfigInfo = {
8
8
  /**
9
9
  * key The config key.
10
10
  */
@@ -37,7 +37,7 @@ export interface ConfigInfo {
37
37
  * True if the config property is deprecated.
38
38
  */
39
39
  deprecated?: boolean;
40
- }
40
+ };
41
41
  /**
42
42
  * Aggregate global and local project config files, as well as environment variables for
43
43
  * `config.json`. The resolution happens in the following bottom-up order:
@@ -169,7 +169,7 @@ export declare namespace ConfigFile {
169
169
  /**
170
170
  * The interface for Config options.
171
171
  */
172
- interface Options extends BaseConfigStore.Options {
172
+ type Options = {
173
173
  /**
174
174
  * The root folder where the config file is stored.
175
175
  */
@@ -198,5 +198,5 @@ export declare namespace ConfigFile {
198
198
  * Indicates if init should throw if the corresponding config file is not found.
199
199
  */
200
200
  throwOnNotFound?: boolean;
201
- }
201
+ } & BaseConfigStore.Options;
202
202
  }
@@ -6,7 +6,7 @@ import { ConfigContents, ConfigEntry, ConfigValue, Key } from './configStackType
6
6
  /**
7
7
  * An interface for a config object with a persistent store.
8
8
  */
9
- export interface ConfigStore<P extends ConfigContents = ConfigContents> {
9
+ export type ConfigStore<P extends ConfigContents = ConfigContents> = {
10
10
  entries(): ConfigEntry[];
11
11
  get<K extends Key<P>>(key: K, decrypt: boolean): P[K];
12
12
  get<T extends ConfigValue>(key: string, decrypt: boolean): T;
@@ -23,7 +23,7 @@ export interface ConfigStore<P extends ConfigContents = ConfigContents> {
23
23
  values(): ConfigValue[];
24
24
  forEach(actionFn: (key: string, value: ConfigValue) => void): void;
25
25
  getContents(): P;
26
- }
26
+ };
27
27
  /**
28
28
  * An abstract class that implements all the config management functions but
29
29
  * none of the storage functions.
@@ -207,7 +207,7 @@ export declare namespace BaseConfigStore {
207
207
  /**
208
208
  * Options for the config store.
209
209
  */
210
- interface Options {
210
+ type Options = {
211
211
  /**
212
212
  * Keys to encrypt.
213
213
  *
@@ -217,5 +217,5 @@ export declare namespace BaseConfigStore {
217
217
  * defining a new class.
218
218
  */
219
219
  encryptedKeys?: Array<string | RegExp>;
220
- }
220
+ };
221
221
  }
@@ -25,11 +25,11 @@ export declare namespace OrgUsersConfig {
25
25
  /**
26
26
  * The config file options.
27
27
  */
28
- interface Options extends ConfigFile.Options {
28
+ type Options = {
29
29
  /**
30
30
  * The org id associated with this user.
31
31
  */
32
32
  orgId: string;
33
- }
33
+ } & ConfigFile.Options;
34
34
  }
35
35
  export {};
@@ -22,12 +22,12 @@ export declare namespace SandboxOrgConfig {
22
22
  /**
23
23
  * The config file options.
24
24
  */
25
- interface Options extends ConfigFile.Options {
25
+ type Options = {
26
26
  /**
27
27
  * The org id associated with this sandbox.
28
28
  */
29
29
  orgId: string;
30
- }
30
+ } & ConfigFile.Options;
31
31
  enum Fields {
32
32
  /**
33
33
  * The username of the user who created the sandbox.
@@ -1,11 +1,11 @@
1
1
  import { AsyncOptionalCreatable } from '@salesforce/kit';
2
2
  import { KeyChain } from './keyChainImpl';
3
- interface CryptoOptions {
3
+ type CryptoOptions = {
4
4
  keychain?: KeyChain;
5
5
  platform?: string;
6
6
  retryStatus?: string;
7
7
  noResetOnClose?: boolean;
8
- }
8
+ };
9
9
  /**
10
10
  * Class for managing encrypting and decrypting private auth information.
11
11
  */
@@ -8,7 +8,7 @@ export type FsIfc = Pick<typeof nodeFs, 'statSync'>;
8
8
  /**
9
9
  * Basic keychain interface.
10
10
  */
11
- export interface PasswordStore {
11
+ export type PasswordStore = {
12
12
  /**
13
13
  * Gets a password
14
14
  *
@@ -24,7 +24,7 @@ export interface PasswordStore {
24
24
  * @param fn function callback for password.
25
25
  */
26
26
  setPassword(opts: ProgramOpts, fn: (error: Nullable<Error>, contents?: SecretContents) => void): Promise<void>;
27
- }
27
+ };
28
28
  /**
29
29
  * @private
30
30
  */
@@ -58,12 +58,12 @@ export declare class KeychainAccess implements PasswordStore {
58
58
  */
59
59
  setPassword(opts: ProgramOpts, fn: (error: Nullable<Error>, contents?: SecretContents) => void): Promise<void>;
60
60
  }
61
- interface ProgramOpts {
61
+ type ProgramOpts = {
62
62
  account: string;
63
63
  service: string;
64
64
  password?: string;
65
- }
66
- interface OsImpl {
65
+ };
66
+ type OsImpl = {
67
67
  getProgram(): string;
68
68
  getProgramOptions(opts: ProgramOpts): string[];
69
69
  getCommandFunc(opts: ProgramOpts, fn: (program: string, opts: string[]) => childProcess.ChildProcess): childProcess.ChildProcess;
@@ -71,7 +71,7 @@ interface OsImpl {
71
71
  setProgramOptions(opts: ProgramOpts): string[];
72
72
  setCommandFunc(opts: ProgramOpts, fn: (program: string, opts: string[]) => childProcess.ChildProcess): childProcess.ChildProcess;
73
73
  onSetCommandClose(code: number, stdout: string, stderr: string, opts: ProgramOpts, fn: (err: Nullable<Error>) => void): Promise<void>;
74
- }
74
+ };
75
75
  declare enum SecretField {
76
76
  SERVICE = "service",
77
77
  ACCOUNT = "account",
@@ -2,13 +2,13 @@ import { AsyncCreatable } from '@salesforce/kit';
2
2
  import { OAuth2Config } from '@jsforce/jsforce-node';
3
3
  import { JsonMap, Nullable } from '@salesforce/ts-types';
4
4
  import { AuthInfo } from './org/authInfo';
5
- export interface DeviceCodeResponse extends JsonMap {
5
+ export type DeviceCodeResponse = {
6
6
  device_code: string;
7
7
  interval: number;
8
8
  user_code: string;
9
9
  verification_uri: string;
10
- }
11
- export interface DeviceCodePollingResponse extends JsonMap {
10
+ } & JsonMap;
11
+ export type DeviceCodePollingResponse = {
12
12
  access_token: string;
13
13
  refresh_token: string;
14
14
  signature: string;
@@ -17,7 +17,7 @@ export interface DeviceCodePollingResponse extends JsonMap {
17
17
  id: string;
18
18
  token_type: string;
19
19
  issued_at: string;
20
- }
20
+ } & JsonMap;
21
21
  /**
22
22
  * Handles device based login flows
23
23
  *
@@ -2,7 +2,7 @@ import { Logger as PinoLogger } from 'pino';
2
2
  /**
3
3
  * The common set of `Logger` options.
4
4
  */
5
- export interface LoggerOptions {
5
+ export type LoggerOptions = {
6
6
  /**
7
7
  * The logger name.
8
8
  */
@@ -17,7 +17,7 @@ export interface LoggerOptions {
17
17
  fields?: Fields;
18
18
  /** log to memory instead of to a file. Intended for Unit Testing */
19
19
  useMemoryLogger?: boolean;
20
- }
20
+ };
21
21
  /**
22
22
  * Standard `Logger` levels.
23
23
  *
@@ -46,7 +46,7 @@ export type FieldValue = string | number | boolean | Fields;
46
46
  /**
47
47
  * Log line interface
48
48
  */
49
- export interface LogLine {
49
+ export type LogLine = {
50
50
  name: string;
51
51
  hostname: string;
52
52
  pid: string;
@@ -55,7 +55,7 @@ export interface LogLine {
55
55
  msg: string;
56
56
  time: string;
57
57
  v: number;
58
- }
58
+ };
59
59
  /**
60
60
  * A logging abstraction powered by {@link https://github.com/pinojs/pino | Pino} that provides both a default
61
61
  * logger configuration that will log to the default path, and a way to create custom loggers based on the same foundation.
@@ -1,4 +1,4 @@
1
- import * as ts from 'typescript';
1
+ import ts from 'typescript';
2
2
  /**
3
3
  *
4
4
  * @experimental
@@ -5,33 +5,13 @@
5
5
  * Licensed under the BSD 3-Clause license.
6
6
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
- 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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
10
  };
31
11
  Object.defineProperty(exports, "__esModule", { value: true });
32
12
  exports.messageTransformer = void 0;
33
13
  // eslint-disable-next-line import/no-extraneous-dependencies
34
- const ts = __importStar(require("typescript"));
14
+ const typescript_1 = __importDefault(require("typescript"));
35
15
  const messages_1 = require("./messages");
36
16
  /**
37
17
  *
@@ -43,23 +23,23 @@ const messageTransformer = () => {
43
23
  const transformerFactory = (context) => (sourceFile) => {
44
24
  if (
45
25
  // if there are no messages, no transformation is needed
46
- !sourceFile.statements.some((i) => ts.isImportDeclaration(i) && i.importClause?.getText().includes('Messages')) ||
26
+ !sourceFile.statements.some((i) => typescript_1.default.isImportDeclaration(i) && i.importClause?.getText().includes('Messages')) ||
47
27
  // don't transform the transformer itself
48
28
  sourceFile.fileName.includes('messageTransformer.ts')) {
49
29
  return sourceFile;
50
30
  }
51
31
  const visitor = (node) => {
52
- if (ts.isExpressionStatement(node) && node.getText().includes('importMessagesDirectory')) {
32
+ if (typescript_1.default.isExpressionStatement(node) && node.getText().includes('importMessagesDirectory')) {
53
33
  // importMessagesDirectory now happens at compile, not in runtime
54
34
  // returning undefined removes the node
55
- return ts.factory.createEmptyStatement();
35
+ return typescript_1.default.factory.createEmptyStatement();
56
36
  }
57
37
  if (
58
38
  // transform a runtime load call into hardcoded messages values
59
39
  // const foo = Messages.load|loadMessages('pluginName', 'messagesFile' ...) =>
60
40
  // const foo = new Messages('pluginName', 'messagesFile', new Map([['key', 'value']]))
61
- ts.isCallExpression(node) &&
62
- ts.isPropertyAccessExpression(node.expression) &&
41
+ typescript_1.default.isCallExpression(node) &&
42
+ typescript_1.default.isPropertyAccessExpression(node.expression) &&
63
43
  node.expression.expression.getText() === 'Messages' &&
64
44
  node.expression.name.getText().includes('load')) {
65
45
  // we always want the first two arguments, which are the plugin name and the messages file name
@@ -76,9 +56,9 @@ const messageTransformer = () => {
76
56
  ]);
77
57
  }
78
58
  // it might be a node that contains one of the things we're interested in, so keep digging
79
- return ts.visitEachChild(node, visitor, context);
59
+ return typescript_1.default.visitEachChild(node, visitor, context);
80
60
  };
81
- return ts.visitNode(sourceFile, visitor, ts.isSourceFile);
61
+ return typescript_1.default.visitNode(sourceFile, visitor, typescript_1.default.isSourceFile);
82
62
  };
83
63
  return transformerFactory;
84
64
  };
@@ -86,19 +66,19 @@ exports.messageTransformer = messageTransformer;
86
66
  exports.default = exports.messageTransformer;
87
67
  const getTextWithoutQuotes = (node) => node.getText().replace(/'/g, '');
88
68
  /** turn a loaded message map into */
89
- const messageMapToHardcodedMap = (messages) => ts.factory.createArrayLiteralExpression(Array.from(messages).map(([key, value]) => {
69
+ const messageMapToHardcodedMap = (messages) => typescript_1.default.factory.createArrayLiteralExpression(Array.from(messages).map(([key, value]) => {
90
70
  // case 1: string
91
71
  if (typeof value === 'string') {
92
- return ts.factory.createArrayLiteralExpression([
93
- ts.factory.createStringLiteral(key),
94
- ts.factory.createStringLiteral(value),
72
+ return typescript_1.default.factory.createArrayLiteralExpression([
73
+ typescript_1.default.factory.createStringLiteral(key),
74
+ typescript_1.default.factory.createStringLiteral(value),
95
75
  ]);
96
76
  }
97
77
  else if (Array.isArray(value)) {
98
78
  // case 2: string[]
99
- return ts.factory.createArrayLiteralExpression([
100
- ts.factory.createStringLiteral(key),
101
- ts.factory.createArrayLiteralExpression(value.map((v) => ts.factory.createStringLiteral(v))),
79
+ return typescript_1.default.factory.createArrayLiteralExpression([
80
+ typescript_1.default.factory.createStringLiteral(key),
81
+ typescript_1.default.factory.createArrayLiteralExpression(value.map((v) => typescript_1.default.factory.createStringLiteral(v))),
102
82
  ]);
103
83
  }
104
84
  else {
@@ -56,11 +56,11 @@ export type OrgAuthorization = {
56
56
  /**
57
57
  * Options for access token flow.
58
58
  */
59
- export interface AccessTokenOptions {
59
+ export type AccessTokenOptions = {
60
60
  accessToken?: string;
61
61
  loginUrl?: string;
62
62
  instanceUrl?: string;
63
- }
63
+ };
64
64
  export type AuthSideEffects = {
65
65
  alias?: string;
66
66
  setDefault: boolean;
@@ -334,7 +334,7 @@ export declare namespace AuthInfo {
334
334
  /**
335
335
  * Constructor options for AuthInfo.
336
336
  */
337
- interface Options {
337
+ type Options = {
338
338
  /**
339
339
  * Org signup username.
340
340
  */
@@ -355,5 +355,5 @@ export declare namespace AuthInfo {
355
355
  */
356
356
  parentUsername?: string;
357
357
  isDevHub?: boolean;
358
- }
358
+ };
359
359
  }
@@ -647,22 +647,22 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
647
647
  // If options were passed, use those before checking cache and reading an auth file.
648
648
  let authConfig;
649
649
  if (options) {
650
- const clonedOptions = structuredClone(options);
651
- if (this.isTokenOptions(clonedOptions)) {
652
- authConfig = clonedOptions;
653
- const userInfo = await this.retrieveUserInfo((0, ts_types_1.ensureString)(clonedOptions.instanceUrl), (0, ts_types_1.ensureString)(clonedOptions.accessToken));
650
+ options = structuredClone(options);
651
+ if (this.isTokenOptions(options)) {
652
+ authConfig = options;
653
+ const userInfo = await this.retrieveUserInfo((0, ts_types_1.ensureString)(options.instanceUrl), (0, ts_types_1.ensureString)(options.accessToken));
654
654
  this.update({ username: userInfo?.username, orgId: userInfo?.organizationId });
655
655
  }
656
656
  else {
657
657
  if (this.options.parentUsername) {
658
658
  const parentFields = await this.loadDecryptedAuthFromConfig(this.options.parentUsername);
659
- clonedOptions.clientId = parentFields.clientId;
659
+ options.clientId = parentFields.clientId;
660
660
  if (process.env.SFDX_CLIENT_SECRET) {
661
- clonedOptions.clientSecret = process.env.SFDX_CLIENT_SECRET;
661
+ options.clientSecret = process.env.SFDX_CLIENT_SECRET;
662
662
  }
663
663
  else {
664
664
  // Grab whatever flow is defined
665
- Object.assign(clonedOptions, {
665
+ Object.assign(options, {
666
666
  clientSecret: parentFields.clientSecret,
667
667
  privateKey: parentFields.privateKey ? (0, node_path_1.resolve)(parentFields.privateKey) : parentFields.privateKey,
668
668
  });
@@ -670,22 +670,22 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
670
670
  }
671
671
  // jwt flow
672
672
  // Support both sfdx and jsforce private key values
673
- if (!clonedOptions.privateKey && clonedOptions.privateKeyFile) {
674
- clonedOptions.privateKey = (0, node_path_1.resolve)(clonedOptions.privateKeyFile);
673
+ if (!options.privateKey && options.privateKeyFile) {
674
+ options.privateKey = (0, node_path_1.resolve)(options.privateKeyFile);
675
675
  }
676
- if (clonedOptions.privateKey) {
677
- authConfig = await this.authJwt(clonedOptions);
676
+ if (options.privateKey) {
677
+ authConfig = await this.authJwt(options);
678
678
  }
679
- else if (!clonedOptions.authCode && clonedOptions.refreshToken) {
679
+ else if (!options.authCode && options.refreshToken) {
680
680
  // refresh token flow (from sfdxUrl or OAuth refreshFn)
681
- authConfig = await this.buildRefreshTokenConfig(clonedOptions);
681
+ authConfig = await this.buildRefreshTokenConfig(options);
682
682
  }
683
683
  else if (this.options.oauth2 instanceof jsforce_node_1.OAuth2) {
684
684
  // authcode exchange / web auth flow
685
- authConfig = await this.exchangeToken(clonedOptions, this.options.oauth2);
685
+ authConfig = await this.exchangeToken(options, this.options.oauth2);
686
686
  }
687
687
  else {
688
- authConfig = await this.exchangeToken(clonedOptions);
688
+ authConfig = await this.exchangeToken(options);
689
689
  }
690
690
  }
691
691
  authConfig.isDevHub = await this.determineIfDevHub((0, ts_types_1.ensureString)(authConfig.instanceUrl), (0, ts_types_1.ensureString)(authConfig.accessToken));
@@ -159,16 +159,16 @@ export declare const SingleRecordQueryErrors: {
159
159
  NoRecords: string;
160
160
  MultipleRecords: string;
161
161
  };
162
- export interface SingleRecordQueryOptions {
162
+ export type SingleRecordQueryOptions = {
163
163
  tooling?: boolean;
164
164
  returnChoicesOnMultiple?: boolean;
165
165
  choiceField?: string;
166
- }
166
+ };
167
167
  export declare namespace Connection {
168
168
  /**
169
169
  * Connection Options.
170
170
  */
171
- interface Options<S extends Schema> {
171
+ type Options<S extends Schema> = {
172
172
  /**
173
173
  * AuthInfo instance.
174
174
  */
@@ -181,5 +181,5 @@ export declare namespace Connection {
181
181
  * Additional connection parameters.
182
182
  */
183
183
  connectionOptions?: ConnectionConfig<S>;
184
- }
184
+ };
185
185
  }
package/lib/org/org.d.ts CHANGED
@@ -16,21 +16,21 @@ export declare enum OrgTypes {
16
16
  Scratch = "scratch",
17
17
  Sandbox = "sandbox"
18
18
  }
19
- export interface StatusEvent {
19
+ export type StatusEvent = {
20
20
  sandboxProcessObj: SandboxProcessObject;
21
21
  interval: number;
22
22
  remainingWait: number;
23
23
  waitingOnAuth: boolean;
24
- }
25
- export interface ResultEvent {
24
+ };
25
+ export type ResultEvent = {
26
26
  sandboxProcessObj: SandboxProcessObject;
27
27
  sandboxRes: SandboxUserAuthResponse;
28
- }
29
- export interface SandboxUserAuthRequest {
28
+ };
29
+ export type SandboxUserAuthRequest = {
30
30
  sandboxName: string;
31
31
  clientId: string;
32
32
  callbackUrl: string;
33
- }
33
+ };
34
34
  export declare enum SandboxEvents {
35
35
  EVENT_STATUS = "status",
36
36
  EVENT_ASYNC_RESULT = "asyncResult",
@@ -39,12 +39,12 @@ export declare enum SandboxEvents {
39
39
  EVENT_RESUME = "resume",
40
40
  EVENT_MULTIPLE_SBX_PROCESSES = "multipleMatchingSbxProcesses"
41
41
  }
42
- export interface SandboxUserAuthResponse {
42
+ export type SandboxUserAuthResponse = {
43
43
  authUserName: string;
44
44
  authCode: string;
45
45
  instanceUrl: string;
46
46
  loginUrl: string;
47
- }
47
+ };
48
48
  export declare function sandboxIsResumable(value: string): boolean;
49
49
  export type SandboxProcessObject = {
50
50
  Id: string;
@@ -515,12 +515,12 @@ export declare namespace Org {
515
515
  /**
516
516
  * Constructor Options for and Org.
517
517
  */
518
- interface Options {
518
+ type Options = {
519
519
  aliasOrUsername?: string;
520
520
  connection?: Connection;
521
521
  aggregator?: ConfigAggregator;
522
522
  isDevHub?: boolean;
523
- }
523
+ };
524
524
  /**
525
525
  * Scratch Org status.
526
526
  */
@@ -2,10 +2,10 @@ import { Org } from './org';
2
2
  /**
3
3
  * Map of fields name for a permission set assignment
4
4
  */
5
- export interface PermissionSetAssignmentFields {
5
+ export type PermissionSetAssignmentFields = {
6
6
  assigneeId: string;
7
7
  permissionSetId: string;
8
- }
8
+ };
9
9
  /**
10
10
  * A class for assigning a Salesforce User to one or more permission sets.
11
11
  */
@@ -3,14 +3,14 @@ import { Org } from './org';
3
3
  import { ScratchOrgInfo } from './scratchOrgTypes';
4
4
  import { AuthFields, AuthInfo } from './authInfo';
5
5
  export declare const DEFAULT_STREAM_TIMEOUT_MINUTES = 6;
6
- export interface ScratchOrgCreateResult {
6
+ export type ScratchOrgCreateResult = {
7
7
  username?: string;
8
8
  scratchOrgInfo?: ScratchOrgInfo;
9
9
  authInfo?: AuthInfo;
10
10
  authFields?: AuthFields;
11
11
  warnings: string[];
12
- }
13
- export interface ScratchOrgCreateOptions {
12
+ };
13
+ export type ScratchOrgCreateOptions = {
14
14
  /** the environment hub org */
15
15
  hubOrg: Org;
16
16
  /** The connected app consumer key. */
@@ -49,6 +49,6 @@ export interface ScratchOrgCreateOptions {
49
49
  setDefault?: boolean;
50
50
  /** if false, do not use source tracking for this scratch org */
51
51
  tracksSource?: boolean;
52
- }
52
+ };
53
53
  export declare const scratchOrgResume: (jobId: string) => Promise<ScratchOrgCreateResult>;
54
54
  export declare const scratchOrgCreate: (options: ScratchOrgCreateOptions) => Promise<ScratchOrgCreateResult>;
@@ -1,10 +1,10 @@
1
- interface FeatureTypes {
1
+ type FeatureTypes = {
2
2
  simpleFeatureMapping: {
3
3
  [key: string]: string[];
4
4
  };
5
5
  quantifiedFeatureMapping: Record<string, string | number | boolean | null | undefined>;
6
6
  deprecatedFeatures: string[];
7
- }
7
+ };
8
8
  export declare class ScratchOrgFeatureDeprecation {
9
9
  private featureTypes;
10
10
  constructor(options?: FeatureTypes);
@@ -2,7 +2,7 @@ import { SfProjectJson } from '../sfProject';
2
2
  import { Org } from './org';
3
3
  import { ScratchOrgInfo } from './scratchOrgTypes';
4
4
  type PartialScratchOrgInfo = Pick<ScratchOrgInfo, 'ConnectedAppConsumerKey' | 'AuthCode' | 'Snapshot' | 'Status' | 'LoginUrl' | 'SignupEmail' | 'SignupUsername' | 'SignupInstance' | 'Username'>;
5
- export interface ScratchOrgInfoPayload extends PartialScratchOrgInfo {
5
+ export type ScratchOrgInfoPayload = {
6
6
  orgName: string;
7
7
  package2AncestorIds: string;
8
8
  features: string | string[];
@@ -10,7 +10,7 @@ export interface ScratchOrgInfoPayload extends PartialScratchOrgInfo {
10
10
  namespace: string;
11
11
  connectedAppCallbackUrl: string;
12
12
  durationDays: number;
13
- }
13
+ } & PartialScratchOrgInfo;
14
14
  /**
15
15
  * Generates the package2AncestorIds scratch org property
16
16
  *
@@ -2,9 +2,9 @@ import { AuthFields } from './authInfo';
2
2
  import { ScratchOrgInfo } from './scratchOrgTypes';
3
3
  export declare const scratchOrgLifecycleEventName = "scratchOrgLifecycleEvent";
4
4
  export declare const scratchOrgLifecycleStages: readonly ["prepare request", "send request", "wait for org", "available", "authenticate", "deploy settings", "done"];
5
- export interface ScratchOrgLifecycleEvent {
5
+ export type ScratchOrgLifecycleEvent = {
6
6
  stage: (typeof scratchOrgLifecycleStages)[number];
7
7
  scratchOrgInfo?: ScratchOrgInfo;
8
- }
8
+ };
9
9
  export declare const emit: (event: ScratchOrgLifecycleEvent) => Promise<void>;
10
10
  export declare const emitPostOrgCreate: (authFields: AuthFields) => Promise<void>;
@@ -11,17 +11,17 @@ export declare enum RequestStatus {
11
11
  Canceling = "Canceling",
12
12
  Canceled = "Canceled"
13
13
  }
14
- export interface SettingType {
14
+ export type SettingType = {
15
15
  members: string[];
16
16
  name: 'CustomObject' | 'RecordType' | 'BusinessProcess' | 'Settings';
17
- }
18
- export interface PackageFile {
17
+ };
18
+ export type PackageFile = {
19
19
  '@': {
20
20
  xmlns: string;
21
21
  };
22
22
  types: SettingType[];
23
23
  version: string;
24
- }
24
+ };
25
25
  export declare const createObjectFileContent: ({ allRecordTypes, allBusinessProcesses, apiVersion, settingData, objectSettingsData, }: {
26
26
  allRecordTypes?: string[];
27
27
  allBusinessProcesses?: string[];
@@ -1,5 +1,5 @@
1
1
  import { JsonMap } from '@salesforce/ts-types';
2
- export interface ScratchOrgInfo {
2
+ export type ScratchOrgInfo = {
3
3
  AdminEmail?: string;
4
4
  readonly CreatedDate?: string;
5
5
  ConnectedAppCallbackUrl?: string;
@@ -36,8 +36,8 @@ export interface ScratchOrgInfo {
36
36
  enabled: string[];
37
37
  disabled: string[];
38
38
  };
39
- }
40
- export interface ObjectSetting extends JsonMap {
39
+ };
40
+ export type ObjectSetting = {
41
41
  sharingModel?: string;
42
42
  defaultRecordType?: string;
43
- }
43
+ } & JsonMap;
package/lib/org/user.d.ts CHANGED
@@ -62,15 +62,15 @@ export declare namespace DefaultUserFields {
62
62
  * Used to initialize default values for fields based on a templateUser user. This user will be part of the
63
63
  * Standard User profile.
64
64
  */
65
- interface Options {
65
+ type Options = {
66
66
  templateUser: string;
67
67
  newUserName?: string;
68
- }
68
+ };
69
69
  }
70
- export interface PasswordConditions {
70
+ export type PasswordConditions = {
71
71
  length: number;
72
72
  complexity: number;
73
- }
73
+ };
74
74
  /**
75
75
  * A class for creating a User, generating a password for a user, and assigning a user to one or more permission sets.
76
76
  * See methods for examples.
@@ -181,7 +181,7 @@ export declare namespace User {
181
181
  * Used to initialize default values for fields based on a templateUser user. This user will be part of the
182
182
  * Standard User profile.
183
183
  */
184
- interface Options {
184
+ type Options = {
185
185
  org: Org;
186
- }
186
+ };
187
187
  }
package/lib/sfError.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnyJson, JsonMap } from '@salesforce/ts-types';
1
+ import { AnyJson } from '@salesforce/ts-types';
2
2
  export type SfErrorOptions<T extends ErrorDataProperties = ErrorDataProperties> = {
3
3
  message: string;
4
4
  exitCode?: number;
@@ -10,6 +10,14 @@ export type SfErrorOptions<T extends ErrorDataProperties = ErrorDataProperties>
10
10
  actions?: string[];
11
11
  };
12
12
  type ErrorDataProperties = AnyJson;
13
+ type SfErrorToObjectResult = {
14
+ name: string;
15
+ message: string;
16
+ exitCode: number;
17
+ actions?: string[];
18
+ context?: string;
19
+ data?: ErrorDataProperties;
20
+ };
13
21
  /**
14
22
  * A generalized sfdx error which also contains an action. The action is used in the
15
23
  * CLI to help guide users past the error.
@@ -77,6 +85,6 @@ export declare class SfError<T extends ErrorDataProperties = ErrorDataProperties
77
85
  /**
78
86
  * Convert an {@link SfError} state to an object. Returns a plain object representing the state of this error.
79
87
  */
80
- toObject(): JsonMap;
88
+ toObject(): SfErrorToObjectResult;
81
89
  }
82
90
  export {};
package/lib/sfError.js CHANGED
@@ -60,7 +60,9 @@ class SfError extends Error {
60
60
  super(message);
61
61
  this.name = name;
62
62
  this.cause = exitCodeOrCause instanceof Error ? exitCodeOrCause : cause;
63
- this.actions = actions;
63
+ if (actions?.length) {
64
+ this.actions = actions;
65
+ }
64
66
  if (typeof exitCodeOrCause === 'number') {
65
67
  this.exitCode = exitCodeOrCause;
66
68
  }
@@ -77,8 +79,12 @@ class SfError extends Error {
77
79
  /** like the constructor, but takes an typed object and let you also set context and data properties */
78
80
  static create(inputs) {
79
81
  const error = new SfError(inputs.message, inputs.name, inputs.actions, inputs.exitCode, inputs.cause);
80
- error.data = inputs.data;
81
- error.context = inputs.context;
82
+ if (inputs.data) {
83
+ error.data = inputs.data;
84
+ }
85
+ if (inputs.context) {
86
+ error.context = inputs.context;
87
+ }
82
88
  return error;
83
89
  }
84
90
  /**
@@ -134,7 +140,7 @@ class SfError extends Error {
134
140
  name: this.name,
135
141
  message: this.message ?? this.name,
136
142
  exitCode: this.exitCode,
137
- actions: this.actions,
143
+ ...(this.actions?.length ? { actions: this.actions } : {}),
138
144
  ...(this.context ? { context: this.context } : {}),
139
145
  ...(this.data ? { data: this.data } : {}),
140
146
  };
@@ -49,7 +49,7 @@ export declare namespace MyDomainResolver {
49
49
  /**
50
50
  * Options for the MyDomain DNS resolver.
51
51
  */
52
- interface Options {
52
+ type Options = {
53
53
  /**
54
54
  * The host to resolve.
55
55
  */
@@ -62,5 +62,5 @@ export declare namespace MyDomainResolver {
62
62
  * The retry timeout.
63
63
  */
64
64
  frequency?: Duration;
65
- }
65
+ };
66
66
  }
@@ -44,7 +44,7 @@ export declare namespace PollingClient {
44
44
  /**
45
45
  * Options for the polling client.
46
46
  */
47
- interface Options {
47
+ type Options = {
48
48
  /**
49
49
  * Polling function.
50
50
  */
@@ -65,7 +65,7 @@ export declare namespace PollingClient {
65
65
  * ```
66
66
  */
67
67
  timeoutErrorName?: string;
68
- }
68
+ };
69
69
  /**
70
70
  * Default options set for polling. The default options specify a timeout of 3 minutes and polling frequency of 15
71
71
  * seconds;
@@ -7,7 +7,7 @@ export { CometClient, CometSubscription, Message, StatusResult, StreamingExtensi
7
7
  * Inner streaming client interface. This implements the Cometd behavior.
8
8
  * Also allows for mocking the functional behavior.
9
9
  */
10
- export interface StreamingClientIfc {
10
+ export type StreamingClientIfc = {
11
11
  /**
12
12
  * Returns a comet client implementation.
13
13
  *
@@ -20,7 +20,7 @@ export interface StreamingClientIfc {
20
20
  * @param logLine A log message passed to the the assigned function.
21
21
  */
22
22
  setLogger: (logLine: (message: string) => void) => void;
23
- }
23
+ };
24
24
  /**
25
25
  * Api wrapper to support Salesforce streaming. The client contains an internal implementation of a cometd specification.
26
26
  *
@@ -142,7 +142,7 @@ export declare namespace StreamingClient {
142
142
  *
143
143
  * @interface
144
144
  */
145
- interface Options {
145
+ type Options = {
146
146
  /**
147
147
  * The org streaming target.
148
148
  */
@@ -171,7 +171,7 @@ export declare namespace StreamingClient {
171
171
  * The function for build the inner client impl. Allows for mocking.
172
172
  */
173
173
  streamingImpl: StreamingClientIfc;
174
- }
174
+ };
175
175
  /**
176
176
  * Default Streaming Options. Uses Faye as the cometd impl.
177
177
  */
@@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events';
3
3
  import { AnyFunction, AnyJson, JsonMap } from '@salesforce/ts-types';
4
4
  export type Message = JsonMap;
5
5
  export type Callback<T = unknown> = (...args: any[]) => T;
6
- export interface StatusResult {
6
+ export type StatusResult = {
7
7
  /**
8
8
  * If the result of the streaming or polling client is expected to return a result
9
9
  */
@@ -13,18 +13,18 @@ export interface StatusResult {
13
13
  * the messaging exchanges with the endpoint.
14
14
  */
15
15
  completed: boolean;
16
- }
16
+ };
17
17
  /**
18
18
  * The subscription object returned from the cometd subscribe object.
19
19
  */
20
- export interface CometSubscription {
20
+ export type CometSubscription = {
21
21
  callback(callback: () => void): void;
22
22
  errback(callback: (error: Error) => void): void;
23
- }
23
+ };
24
24
  /**
25
25
  * Types for defining extensions.
26
26
  */
27
- export interface StreamingExtension {
27
+ export type StreamingExtension = {
28
28
  /**
29
29
  * Extension for outgoing message.
30
30
  *
@@ -39,7 +39,7 @@ export interface StreamingExtension {
39
39
  * @param callback The callback to invoke after the message is processed.
40
40
  */
41
41
  incoming?: (message: JsonMap, callback: AnyFunction) => void;
42
- }
42
+ };
43
43
  /**
44
44
  * Function type for processing messages
45
45
  */
@@ -17,7 +17,7 @@ export { SecureBuffer } from './crypto/secureBuffer';
17
17
  * individual tests. Test's stubs should always go on the DEFAULT which is exposed
18
18
  * on the TestContext.
19
19
  */
20
- export interface SandboxTypes {
20
+ export type SandboxTypes = {
21
21
  DEFAULT: SinonSandbox;
22
22
  CRYPTO: SinonSandbox;
23
23
  CONFIG: SinonSandbox;
@@ -25,11 +25,11 @@ export interface SandboxTypes {
25
25
  CONNECTION: SinonSandbox;
26
26
  FS: SinonSandbox;
27
27
  ORGS: SinonSandbox;
28
- }
28
+ };
29
29
  /**
30
30
  * Different hooks into {@link ConfigFile} used for testing instead of doing file IO.
31
31
  */
32
- export interface ConfigStub {
32
+ export type ConfigStub = {
33
33
  /**
34
34
  * readFn A function that controls all aspect of {@link ConfigFile.read}. For example, it won't set the contents
35
35
  * unless explicitly done. Only use this if you know what you are doing. Use retrieveContents
@@ -52,7 +52,7 @@ export interface ConfigStub {
52
52
  * A function to conditionally read based on the config instance. The `this` value will be the config instance.
53
53
  */
54
54
  retrieveContents?: () => Promise<JsonMap>;
55
- }
55
+ };
56
56
  /**
57
57
  * Instantiate a @salesforce/core test context.
58
58
  */
@@ -325,7 +325,7 @@ export declare enum StreamingMockSubscriptionCall {
325
325
  /**
326
326
  * Additional subscription options for the StreamingMock.
327
327
  */
328
- export interface StreamingMockCometSubscriptionOptions {
328
+ export type StreamingMockCometSubscriptionOptions = {
329
329
  /**
330
330
  * Target URL.
331
331
  */
@@ -346,7 +346,7 @@ export interface StreamingMockCometSubscriptionOptions {
346
346
  * A list of messages to playback for the client. One message per process tick.
347
347
  */
348
348
  messagePlaylist?: Message[];
349
- }
349
+ };
350
350
  /**
351
351
  * Simulates a comet subscription to a streaming channel.
352
352
  */
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  import { Readable } from 'node:stream';
4
- export interface StructuredWriter {
4
+ export type StructuredWriter = {
5
5
  addToStore(contents: string | Readable | Buffer, path: string): Promise<void>;
6
6
  finalize(): Promise<void>;
7
7
  getDestinationPath(): string | undefined;
8
8
  get buffer(): Buffer;
9
- }
9
+ };
@@ -80,9 +80,9 @@ export declare class WebOAuthServer extends AsyncCreatable<WebOAuthServer.Option
80
80
  private validateState;
81
81
  }
82
82
  export declare namespace WebOAuthServer {
83
- interface Options {
83
+ type Options = {
84
84
  oauthConfig: JwtOAuth2Config;
85
- }
85
+ };
86
86
  type Request = http.IncomingMessage & {
87
87
  query: {
88
88
  code: string;
@@ -168,9 +168,9 @@ export declare class WebServer extends AsyncCreatable<WebServer.Options> {
168
168
  private getSocketTimeout;
169
169
  }
170
170
  declare namespace WebServer {
171
- interface Options {
171
+ type Options = {
172
172
  port?: number;
173
173
  host?: string;
174
- }
174
+ };
175
175
  }
176
176
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "6.7.7-qa.0",
3
+ "version": "7.0.0",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",
@@ -9,60 +9,17 @@
9
9
  "node": ">=18.0.0"
10
10
  },
11
11
  "exports": {
12
- ".": {
13
- "types": "./lib/index.d.ts",
14
- "require": "./lib/index.js",
15
- "import": "./lib/index.js",
16
- "default": "./lib/index.js"
17
- },
18
- "./testSetup": {
19
- "types": "./lib/testSetup.d.ts",
20
- "require": "./lib/testSetup.js",
21
- "import": "./lib/testSetup.js",
22
- "default": "./lib/testSetup.js"
23
- },
24
- "./messages": {
25
- "types": "./lib/messages.d.ts",
26
- "require": "./lib/messages.js",
27
- "import": "./lib/messages.js",
28
- "default": "./lib/messages.js"
29
- },
30
- "./sfError": {
31
- "types": "./lib/sfError.d.ts",
32
- "require": "./lib/sfError.js",
33
- "import": "./lib/sfError.js",
34
- "default": "./lib/sfError.js"
35
- },
36
- "./lifecycle": {
37
- "types": "./lib/lifecycleEvents.d.ts",
38
- "require": "./lib/lifecycleEvents.js",
39
- "import": "./lib/lifecycleEvents.js",
40
- "default": "./lib/lifecycleEvents.js"
41
- },
42
- "./logger": {
43
- "types": "./lib/logger/logger.d.ts",
44
- "require": "./lib/logger/logger.js",
45
- "import": "./lib/logger/logger.js",
46
- "default": "./lib/logger/logger.js"
47
- },
48
- "./configAggregator": {
49
- "types": "./lib/config/configAggregator.d.ts",
50
- "require": "./lib/config/configAggregator.js",
51
- "import": "./lib/config/configAggregator.js",
52
- "default": "./lib/config/configAggregator.js"
53
- },
54
- "./project": {
55
- "types": "./lib/sfProject.d.ts",
56
- "require": "./lib/sfProject.js",
57
- "import": "./lib/sfProject.js",
58
- "default": "./lib/sfProject.js"
59
- },
60
- "./messageTransformer": {
61
- "types": "./lib/messageTransformer.d.ts",
62
- "require": "./lib/messageTransformer.js",
63
- "import": "./lib/messageTransformer.js",
64
- "default": "./lib/messageTransformer.js"
65
- }
12
+ ".": "./lib/index.js",
13
+ "./testSetup": "./lib/testSetup.js",
14
+ "./messages": "./lib/messages.js",
15
+ "./sfError": "./lib/sfError.js",
16
+ "./lifecycle": "./lib/lifecycleEvents.js",
17
+ "./logger": "./lib/logger/logger.js",
18
+ "./configAggregator": "./lib/config/configAggregator.js",
19
+ "./stateAggregator": "./lib/stateAggregator/stateAggregator.js",
20
+ "./config": "./lib/config/config.js",
21
+ "./project": "./lib/sfProject.js",
22
+ "./messageTransformer": "./lib/messageTransformer.js"
66
23
  },
67
24
  "scripts": {
68
25
  "build": "wireit",
@@ -94,7 +51,7 @@
94
51
  "messageTransformer/messageTransformer.ts"
95
52
  ],
96
53
  "dependencies": {
97
- "@jsforce/jsforce-node": "^3.0.0-next.3",
54
+ "@jsforce/jsforce-node": "^3.1.0",
98
55
  "@salesforce/kit": "^3.1.0",
99
56
  "@salesforce/schemas": "^1.7.0",
100
57
  "@salesforce/ts-types": "^2.0.9",
@@ -113,7 +70,7 @@
113
70
  "ts-retry-promise": "^0.7.1"
114
71
  },
115
72
  "devDependencies": {
116
- "@salesforce/dev-scripts": "^8.4.2",
73
+ "@salesforce/dev-scripts": "^8.5.0",
117
74
  "@salesforce/ts-sinon": "^1.4.19",
118
75
  "@types/benchmark": "^2.1.5",
119
76
  "@types/chai-string": "^1.4.5",