@salesforce/core 6.7.7-qa.1 → 7.1.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.
package/lib/index.d.ts CHANGED
@@ -35,4 +35,5 @@ export { ScratchOrgCreateOptions, ScratchOrgCreateResult, scratchOrgCreate, scra
35
35
  export { ScratchOrgInfo } from './org/scratchOrgTypes';
36
36
  export { ScratchOrgLifecycleEvent, scratchOrgLifecycleEventName, scratchOrgLifecycleStages, } from './org/scratchOrgLifecycleEvents';
37
37
  export { ScratchOrgCache } from './org/scratchOrgCache';
38
+ export { default as ScratchOrgSettingsGenerator } from './org/scratchOrgSettingsGenerator';
38
39
  export * from './util/sfdc';
package/lib/index.js CHANGED
@@ -19,9 +19,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
19
19
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
20
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
21
  };
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
22
25
  Object.defineProperty(exports, "__esModule", { value: true });
23
26
  exports.scratchOrgLifecycleEventName = exports.scratchOrgResume = exports.scratchOrgCreate = exports.lockInit = exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfError = exports.SchemaValidator = exports.SfProjectJson = exports.SfProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.OrgTypes = exports.SandboxEvents = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.ConfigAggregator = exports.SandboxRequestCache = exports.SF_ALLOWED_PROPERTIES = exports.SFDX_ALLOWED_PROPERTIES = exports.SfConfigProperties = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.StateAggregator = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
24
- exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = void 0;
27
+ exports.ScratchOrgSettingsGenerator = exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = void 0;
25
28
  const messages_1 = require("./messages");
26
29
  ;
27
30
  var configFile_1 = require("./config/configFile");
@@ -109,6 +112,8 @@ Object.defineProperty(exports, "scratchOrgLifecycleEventName", { enumerable: tru
109
112
  Object.defineProperty(exports, "scratchOrgLifecycleStages", { enumerable: true, get: function () { return scratchOrgLifecycleEvents_1.scratchOrgLifecycleStages; } });
110
113
  var scratchOrgCache_1 = require("./org/scratchOrgCache");
111
114
  Object.defineProperty(exports, "ScratchOrgCache", { enumerable: true, get: function () { return scratchOrgCache_1.ScratchOrgCache; } });
115
+ var scratchOrgSettingsGenerator_1 = require("./org/scratchOrgSettingsGenerator");
116
+ Object.defineProperty(exports, "ScratchOrgSettingsGenerator", { enumerable: true, get: function () { return __importDefault(scratchOrgSettingsGenerator_1).default; } });
112
117
  // Utility sub-modules
113
118
  __exportStar(require("./util/sfdc"), exports);
114
119
  //# sourceMappingURL=index.js.map
@@ -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));
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "6.7.7-qa.1",
3
+ "version": "7.1.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",