@salesforce/core 3.19.0 → 3.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +6 -18
  3. package/lib/config/aliasesConfig.d.ts +12 -0
  4. package/lib/config/aliasesConfig.js +27 -0
  5. package/lib/config/authInfoConfig.d.ts +19 -0
  6. package/lib/config/authInfoConfig.js +35 -0
  7. package/lib/config/configAggregator.d.ts +7 -5
  8. package/lib/config/configAggregator.js +25 -9
  9. package/lib/config/configFile.js +2 -2
  10. package/lib/config/configGroup.d.ts +141 -0
  11. package/lib/config/configGroup.js +224 -0
  12. package/lib/config/configStore.d.ts +2 -2
  13. package/lib/config/configStore.js +1 -2
  14. package/lib/config/envVars.d.ts +2 -3
  15. package/lib/config/envVars.js +8 -13
  16. package/lib/config/tokensConfig.d.ts +10 -0
  17. package/lib/config/tokensConfig.js +28 -0
  18. package/lib/crypto/keyChainImpl.js +1 -1
  19. package/lib/exported.d.ts +1 -1
  20. package/lib/exported.js +6 -5
  21. package/lib/global.d.ts +8 -0
  22. package/lib/global.js +10 -0
  23. package/lib/org/authInfo.d.ts +3 -2
  24. package/lib/org/authInfo.js +55 -37
  25. package/lib/org/authRemover.d.ts +6 -5
  26. package/lib/org/authRemover.js +22 -16
  27. package/lib/org/connection.js +3 -2
  28. package/lib/org/org.d.ts +12 -4
  29. package/lib/org/org.js +28 -26
  30. package/lib/org/scratchOrgCreate.js +5 -8
  31. package/lib/{globalInfo → stateAggregator}/accessors/aliasAccessor.d.ts +79 -1
  32. package/lib/{globalInfo → stateAggregator}/accessors/aliasAccessor.js +119 -2
  33. package/lib/stateAggregator/accessors/orgAccessor.d.ts +50 -0
  34. package/lib/stateAggregator/accessors/orgAccessor.js +197 -0
  35. package/lib/{globalInfo → stateAggregator}/accessors/sandboxAccessor.d.ts +12 -1
  36. package/lib/{globalInfo → stateAggregator}/accessors/sandboxAccessor.js +22 -2
  37. package/lib/stateAggregator/accessors/tokenAccessor.d.ts +28 -0
  38. package/lib/{globalInfo → stateAggregator}/accessors/tokenAccessor.js +34 -2
  39. package/lib/{globalInfo → stateAggregator}/globalInfoConfig.d.ts +11 -8
  40. package/lib/{globalInfo → stateAggregator}/globalInfoConfig.js +7 -4
  41. package/lib/stateAggregator/index.d.ts +7 -0
  42. package/lib/{globalInfo → stateAggregator}/index.js +5 -1
  43. package/lib/{globalInfo → stateAggregator}/sfdxDataHandler.d.ts +7 -1
  44. package/lib/{globalInfo → stateAggregator}/sfdxDataHandler.js +25 -2
  45. package/lib/stateAggregator/stateAggregator.d.ts +20 -0
  46. package/lib/stateAggregator/stateAggregator.js +38 -0
  47. package/lib/{globalInfo → stateAggregator}/types.d.ts +25 -10
  48. package/lib/{globalInfo → stateAggregator}/types.js +3 -0
  49. package/lib/testSetup.d.ts +30 -6
  50. package/lib/testSetup.js +79 -11
  51. package/lib/util/sfdcUrl.d.ts +3 -9
  52. package/lib/util/sfdcUrl.js +29 -28
  53. package/messages/core.md +10 -0
  54. package/messages/scratchOrgCreate.md +0 -4
  55. package/messages/scratchOrgInfoApi.md +4 -0
  56. package/package.json +4 -4
  57. package/lib/globalInfo/accessors/orgAccessor.d.ts +0 -13
  58. package/lib/globalInfo/accessors/orgAccessor.js +0 -45
  59. package/lib/globalInfo/accessors/tokenAccessor.d.ts +0 -13
  60. package/lib/globalInfo/index.d.ts +0 -6
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2020, 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.ConfigGroup = void 0;
10
+ const ts_types_1 = require("@salesforce/ts-types");
11
+ const sfError_1 = require("../sfError");
12
+ const configFile_1 = require("./configFile");
13
+ /**
14
+ * A config file that stores config values in groups. e.g. to store different config
15
+ * values for different commands, without having manually manipulate the config.
16
+ *
17
+ * **Note:** All config methods are overwritten to use the {@link ConfigGroup.setDefaultGroup}.
18
+ *
19
+ * ```
20
+ * class MyPluginConfig extends ConfigGroup<ConfigGroup.Options> {
21
+ * public static getFileName(): string {
22
+ * return 'myPluginConfigFilename.json';
23
+ * }
24
+ * }
25
+ * const myConfig = await MyPluginConfig.create(ConfigGroup.getOptions('all'));
26
+ * myConfig.setDefaultGroup('myCommand'); // Can be set in your command's init.
27
+ * myConfig.set('mykey', 'myvalue'); // Sets 'myKey' for the 'myCommand' group.
28
+ * myConfig.setInGroup('myKey', 'myvalue', 'all'); // Manually set in another group.
29
+ * await myConfig.write();
30
+ * ```
31
+ */
32
+ class ConfigGroup extends configFile_1.ConfigFile {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.defaultGroup = 'default';
36
+ }
37
+ /**
38
+ * Get ConfigGroup specific options, such as the default group.
39
+ *
40
+ * @param defaultGroup The default group to use when creating the config.
41
+ * @param filename The filename of the config file. Uses the static {@link getFileName} by default.
42
+ */
43
+ static getOptions(defaultGroup, filename) {
44
+ const options = configFile_1.ConfigFile.getDefaultOptions(true, filename);
45
+ const configGroupOptions = { defaultGroup };
46
+ Object.assign(configGroupOptions, options);
47
+ return configGroupOptions;
48
+ }
49
+ /**
50
+ * Sets the default group for all {@link BaseConfigStore} methods to use.
51
+ * **Throws** *{@link SfError}{ name: 'MissingGroupName' }* The group parameter is null or undefined.
52
+ *
53
+ * @param group The group.
54
+ */
55
+ setDefaultGroup(group) {
56
+ if (!group) {
57
+ throw new sfError_1.SfError('null or undefined group', 'MissingGroupName');
58
+ }
59
+ this.defaultGroup = group;
60
+ }
61
+ /**
62
+ * Set a group of entries in a bulk save. Returns The new properties that were saved.
63
+ *
64
+ * @param newEntries An object representing the aliases to set.
65
+ * @param group The group the property belongs to.
66
+ */
67
+ async updateValues(newEntries, group) {
68
+ // Make sure the contents are loaded
69
+ await this.read();
70
+ Object.entries(newEntries).forEach(([key, val]) => this.setInGroup(key, val, group || this.defaultGroup));
71
+ await this.write();
72
+ return newEntries;
73
+ }
74
+ /**
75
+ * Set a value on a group. Returns the promise resolved when the value is set.
76
+ *
77
+ * @param key The key.
78
+ * @param value The value.
79
+ * @param group The group.
80
+ */
81
+ async updateValue(key, value, group) {
82
+ // Make sure the content is loaded
83
+ await this.read();
84
+ this.setInGroup(key, value, group || this.defaultGroup);
85
+ // Then save it
86
+ await this.write();
87
+ }
88
+ /**
89
+ * Gets an array of key value pairs.
90
+ */
91
+ entries() {
92
+ const group = this.getGroup();
93
+ if (group) {
94
+ return (0, ts_types_1.definiteEntriesOf)(group);
95
+ }
96
+ return [];
97
+ }
98
+ /**
99
+ * Returns a specified element from ConfigGroup. Returns the associated value.
100
+ *
101
+ * @param key The key.
102
+ */
103
+ get(key) {
104
+ return this.getInGroup(key);
105
+ }
106
+ /**
107
+ * Returns a boolean if an element with the specified key exists in the default group.
108
+ *
109
+ * @param {string} key The key.
110
+ */
111
+ has(key) {
112
+ const group = this.getGroup();
113
+ return !!group && super.has(this.defaultGroup) && !!group[key];
114
+ }
115
+ /**
116
+ * Returns an array of the keys from the default group.
117
+ */
118
+ keys() {
119
+ return Object.keys(this.getGroup(this.defaultGroup) || {});
120
+ }
121
+ /**
122
+ * Returns an array of the values from the default group.
123
+ */
124
+ values() {
125
+ return (0, ts_types_1.definiteValuesOf)(this.getGroup(this.defaultGroup) || {});
126
+ }
127
+ /**
128
+ * Add or updates an element with the specified key in the default group.
129
+ *
130
+ * @param key The key.
131
+ * @param value The value.
132
+ */
133
+ set(key, value) {
134
+ return this.setInGroup(key, value, this.defaultGroup);
135
+ }
136
+ /**
137
+ * Removes an element with the specified key from the default group. Returns `true` if the item was deleted.
138
+ *
139
+ * @param key The key.
140
+ */
141
+ unset(key) {
142
+ const groupContents = this.getGroup(this.defaultGroup);
143
+ if (groupContents) {
144
+ delete groupContents[key];
145
+ return true;
146
+ }
147
+ return false;
148
+ }
149
+ /**
150
+ * Remove all key value pairs from the default group.
151
+ */
152
+ clear() {
153
+ delete this.getContents()[this.defaultGroup];
154
+ }
155
+ /**
156
+ * Get all config contents for a group.
157
+ *
158
+ * @param {string} [group = 'default'] The group.
159
+ */
160
+ getGroup(group = this.defaultGroup) {
161
+ return (0, ts_types_1.getJsonMap)(this.getContents(), group) || undefined;
162
+ }
163
+ /**
164
+ * Returns the value associated to the key and group, or undefined if there is none.
165
+ *
166
+ * @param key The key.
167
+ * @param group The group. Defaults to the default group.
168
+ */
169
+ getInGroup(key, group) {
170
+ const groupContents = this.getGroup(group);
171
+ if (groupContents) {
172
+ return groupContents[key];
173
+ }
174
+ }
175
+ /**
176
+ * Convert the config object to a json object.
177
+ */
178
+ toObject() {
179
+ return this.getContents();
180
+ }
181
+ /**
182
+ * Convert an object to a {@link ConfigContents} and set it as the config contents.
183
+ *
184
+ * @param {object} obj The object.
185
+ */
186
+ // eslint-disable-next-line @typescript-eslint/ban-types
187
+ setContentsFromObject(obj) {
188
+ const contents = new Map(Object.entries(obj));
189
+ Array.from(contents.entries()).forEach(([groupKey, groupContents]) => {
190
+ if (groupContents) {
191
+ Object.entries(groupContents).forEach(([contentKey, contentValue]) => {
192
+ this.setInGroup(contentKey, contentValue, groupKey);
193
+ });
194
+ }
195
+ });
196
+ }
197
+ /**
198
+ * Sets the value for the key and group in the config object.
199
+ *
200
+ * @param key The key.
201
+ * @param value The value.
202
+ * @param group The group. Uses the default group if not specified.
203
+ */
204
+ setInGroup(key, value, group) {
205
+ group = group || this.defaultGroup;
206
+ if (!super.has(group)) {
207
+ super.set(group, {});
208
+ }
209
+ const content = this.getGroup(group) || {};
210
+ this.setMethod(content, key, value);
211
+ return content;
212
+ }
213
+ /**
214
+ * Initialize the asynchronous dependencies.
215
+ */
216
+ async init() {
217
+ await super.init();
218
+ if (this.options.defaultGroup) {
219
+ this.setDefaultGroup(this.options.defaultGroup);
220
+ }
221
+ }
222
+ }
223
+ exports.ConfigGroup = ConfigGroup;
224
+ //# sourceMappingURL=configGroup.js.map
@@ -12,7 +12,7 @@ export declare type ConfigEntry = [string, ConfigValue];
12
12
  /**
13
13
  * The type of content a config stores.
14
14
  */
15
- export declare type ConfigContents = Dictionary<ConfigValue>;
15
+ export declare type ConfigContents<T = ConfigValue> = Dictionary<T>;
16
16
  export declare type Key<P extends ConfigContents> = Extract<keyof P, string>;
17
17
  /**
18
18
  * An interface for a config object with a persistent store.
@@ -166,7 +166,7 @@ export declare abstract class BaseConfigStore<T extends BaseConfigStore.Options
166
166
  *
167
167
  * @param obj The object.
168
168
  */
169
- setContentsFromObject<U extends object>(obj: U): void;
169
+ setContentsFromObject<U extends JsonMap>(obj: U): void;
170
170
  protected getEncryptedKeys(): Array<string | RegExp>;
171
171
  /**
172
172
  * This config file has encrypted keys and it should attempt to encrypt them.
@@ -198,9 +198,8 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
198
198
  *
199
199
  * @param obj The object.
200
200
  */
201
- // eslint-disable-next-line @typescript-eslint/ban-types
202
201
  setContentsFromObject(obj) {
203
- this.contents = {};
202
+ this.contents = (this.hasEncryption() ? this.recursiveEncrypt(obj) : {});
204
203
  Object.entries(obj).forEach(([key, value]) => {
205
204
  this.setMethod(this.contents, key, value);
206
205
  });
@@ -87,10 +87,9 @@ declare type EnvType = {
87
87
  export declare const SUPPORTED_ENV_VARS: EnvType;
88
88
  export declare class EnvVars extends Env {
89
89
  constructor(env?: NodeJS.ProcessEnv);
90
+ static propertyToEnvName(property: string, prefix?: string): string;
90
91
  private static defaultPrefix;
91
- propertyToEnvName(property: string, prefix?: string | undefined): string;
92
- setPropertyFromEnv(property: string, prefix?: string | undefined): void;
93
- getPropertyFromEnv<T>(property: string, prefix?: string | undefined): T | undefined;
92
+ getPropertyFromEnv<T>(property: string, prefix?: string): Nullable<T>;
94
93
  asDictionary(): Dictionary<unknown>;
95
94
  asMap(): Map<string, string>;
96
95
  private resolve;
@@ -337,7 +337,7 @@ exports.SUPPORTED_ENV_VARS = {
337
337
  },
338
338
  [EnvironmentVariable.SF_ORG_MAX_QUERY_LIMIT]: {
339
339
  description: getMessage(EnvironmentVariable.SF_ORG_MAX_QUERY_LIMIT),
340
- synonymOf: null,
340
+ synonymOf: EnvironmentVariable.SFDX_MAX_QUERY_LIMIT,
341
341
  },
342
342
  [EnvironmentVariable.SF_MDAPI_TEMP_DIR]: {
343
343
  description: getMessage(EnvironmentVariable.SF_MDAPI_TEMP_DIR),
@@ -397,6 +397,9 @@ class EnvVars extends kit_1.Env {
397
397
  super(env);
398
398
  this.resolve();
399
399
  }
400
+ static propertyToEnvName(property, prefix = EnvVars.defaultPrefix()) {
401
+ return `${prefix || ''}${(0, change_case_1.snakeCase)(property).toUpperCase()}`;
402
+ }
400
403
  static defaultPrefix() {
401
404
  if (process.argv[0].startsWith('sfdx'))
402
405
  return 'SFDX_';
@@ -404,19 +407,11 @@ class EnvVars extends kit_1.Env {
404
407
  return 'SF_';
405
408
  return 'SFDX_';
406
409
  }
407
- propertyToEnvName(property, prefix = EnvVars.defaultPrefix()) {
408
- return `${prefix || ''}${(0, change_case_1.snakeCase)(property).toUpperCase()}`;
409
- }
410
- setPropertyFromEnv(property, prefix = EnvVars.defaultPrefix()) {
411
- const envName = this.propertyToEnvName(property, prefix);
412
- const value = this.getString(envName);
413
- if (value) {
414
- this.setString(property, value);
415
- }
416
- }
417
410
  getPropertyFromEnv(property, prefix = EnvVars.defaultPrefix()) {
418
- const envName = this.propertyToEnvName(property, prefix);
419
- return this.get(envName);
411
+ var _a;
412
+ const envName = EnvVars.propertyToEnvName(property, prefix);
413
+ const synonym = (_a = exports.SUPPORTED_ENV_VARS[envName]) === null || _a === void 0 ? void 0 : _a.synonymOf;
414
+ return this.get(envName) || this.get(synonym);
420
415
  }
421
416
  asDictionary() {
422
417
  return this.entries().reduce((accumulator, [key, value]) => {
@@ -0,0 +1,10 @@
1
+ import { Optional } from '@salesforce/ts-types';
2
+ import { SfTokens } from '../stateAggregator';
3
+ import { ConfigFile } from './configFile';
4
+ import { ConfigContents, ConfigValue } from './configStore';
5
+ export declare class TokensConfig extends ConfigFile<ConfigFile.Options, SfTokens> {
6
+ protected static encryptedKeys: RegExp[];
7
+ static getDefaultOptions(): ConfigFile.Options;
8
+ protected getMethod(contents: ConfigContents, key: string): Optional<ConfigValue>;
9
+ protected setMethod(contents: ConfigContents, key: string, value?: ConfigValue): void;
10
+ }
@@ -0,0 +1,28 @@
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.TokensConfig = void 0;
10
+ const configFile_1 = require("./configFile");
11
+ class TokensConfig extends configFile_1.ConfigFile {
12
+ static getDefaultOptions() {
13
+ return {
14
+ isGlobal: true,
15
+ isState: true,
16
+ filename: 'tokens.json',
17
+ };
18
+ }
19
+ getMethod(contents, key) {
20
+ return contents[key];
21
+ }
22
+ setMethod(contents, key, value) {
23
+ contents[key] = value;
24
+ }
25
+ }
26
+ exports.TokensConfig = TokensConfig;
27
+ TokensConfig.encryptedKeys = [/token/gi, /password/gi, /secret/gi];
28
+ //# sourceMappingURL=tokensConfig.js.map
@@ -317,7 +317,7 @@ const _darwinImpl = {
317
317
  }
318
318
  },
319
319
  };
320
- const getSecretFile = () => path.join(global_1.Global.SFDX_DIR, 'key.json');
320
+ const getSecretFile = () => path.join(global_1.Global.DIR, 'key.json');
321
321
  var SecretField;
322
322
  (function (SecretField) {
323
323
  SecretField["SERVICE"] = "service";
package/lib/exported.d.ts CHANGED
@@ -3,7 +3,7 @@ export { ConfigFile } from './config/configFile';
3
3
  export { TTLConfig } from './config/ttlConfig';
4
4
  export { envVars, EnvironmentVariable, SUPPORTED_ENV_VARS, EnvVars } from './config/envVars';
5
5
  export { BaseConfigStore, ConfigContents, ConfigEntry, ConfigStore, ConfigValue } from './config/configStore';
6
- export { GlobalInfo, SfEntry, SfInfo, SfInfoKeys, SfOrg, SfOrgs, SfToken, SfTokens } from './globalInfo';
6
+ export { GlobalInfo, SfEntry, SfInfo, SfInfoKeys, SfOrg, SfOrgs, SfToken, SfTokens, StateAggregator, } from './stateAggregator';
7
7
  export { DeviceOauthService, DeviceCodeResponse, DeviceCodePollingResponse } from './deviceOauthService';
8
8
  export { OrgUsersConfig } from './config/orgUsersConfig';
9
9
  export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SfConfigProperties, SFDX_ALLOWED_PROPERTIES, SF_ALLOWED_PROPERTIES, } from './config/config';
package/lib/exported.js CHANGED
@@ -16,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SfError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = 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.SfdxConfigAggregator = exports.ConfigAggregator = exports.SandboxRequestCache = exports.SF_ALLOWED_PROPERTIES = exports.SFDX_ALLOWED_PROPERTIES = exports.SfConfigProperties = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.SfInfoKeys = exports.GlobalInfo = exports.BaseConfigStore = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
20
- exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = exports.scratchOrgLifecycleEventName = exports.scratchOrgResume = exports.scratchOrgCreate = exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = void 0;
19
+ exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SfError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = 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.SfdxConfigAggregator = 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.SfInfoKeys = exports.GlobalInfo = exports.BaseConfigStore = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
20
+ exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = exports.scratchOrgLifecycleEventName = exports.scratchOrgResume = exports.scratchOrgCreate = exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = void 0;
21
21
  const messages_1 = require("./messages");
22
22
  messages_1.Messages.importMessagesDirectory(__dirname);
23
23
  var configFile_1 = require("./config/configFile");
@@ -31,9 +31,10 @@ Object.defineProperty(exports, "SUPPORTED_ENV_VARS", { enumerable: true, get: fu
31
31
  Object.defineProperty(exports, "EnvVars", { enumerable: true, get: function () { return envVars_1.EnvVars; } });
32
32
  var configStore_1 = require("./config/configStore");
33
33
  Object.defineProperty(exports, "BaseConfigStore", { enumerable: true, get: function () { return configStore_1.BaseConfigStore; } });
34
- var globalInfo_1 = require("./globalInfo");
35
- Object.defineProperty(exports, "GlobalInfo", { enumerable: true, get: function () { return globalInfo_1.GlobalInfo; } });
36
- Object.defineProperty(exports, "SfInfoKeys", { enumerable: true, get: function () { return globalInfo_1.SfInfoKeys; } });
34
+ var stateAggregator_1 = require("./stateAggregator");
35
+ Object.defineProperty(exports, "GlobalInfo", { enumerable: true, get: function () { return stateAggregator_1.GlobalInfo; } });
36
+ Object.defineProperty(exports, "SfInfoKeys", { enumerable: true, get: function () { return stateAggregator_1.SfInfoKeys; } });
37
+ Object.defineProperty(exports, "StateAggregator", { enumerable: true, get: function () { return stateAggregator_1.StateAggregator; } });
37
38
  var deviceOauthService_1 = require("./deviceOauthService");
38
39
  Object.defineProperty(exports, "DeviceOauthService", { enumerable: true, get: function () { return deviceOauthService_1.DeviceOauthService; } });
39
40
  var orgUsersConfig_1 = require("./config/orgUsersConfig");
package/lib/global.d.ts CHANGED
@@ -28,6 +28,10 @@ export declare class Global {
28
28
  * The global folder in which sf state is stored.
29
29
  */
30
30
  static readonly SF_STATE_FOLDER = ".sf";
31
+ /**
32
+ * The peferred global folder in which state is stored.
33
+ */
34
+ static readonly STATE_FOLDER = ".sfdx";
31
35
  /**
32
36
  * The full system path to the global sfdx state folder.
33
37
  *
@@ -40,6 +44,10 @@ export declare class Global {
40
44
  * **See** {@link Global.SF_STATE_FOLDER}
41
45
  */
42
46
  static get SF_DIR(): string;
47
+ /**
48
+ * The full system path to the peferred global state folder
49
+ */
50
+ static get DIR(): string;
43
51
  /**
44
52
  * The full system path to the global log file.
45
53
  */
package/lib/global.js CHANGED
@@ -44,6 +44,12 @@ class Global {
44
44
  static get SF_DIR() {
45
45
  return path.join(os.homedir(), Global.SF_STATE_FOLDER);
46
46
  }
47
+ /**
48
+ * The full system path to the peferred global state folder
49
+ */
50
+ static get DIR() {
51
+ return path.join(os.homedir(), Global.SFDX_STATE_FOLDER);
52
+ }
47
53
  /**
48
54
  * Gets the current mode environment variable as a {@link Mode} instance.
49
55
  *
@@ -80,6 +86,10 @@ Global.SFDX_STATE_FOLDER = '.sfdx';
80
86
  * The global folder in which sf state is stored.
81
87
  */
82
88
  Global.SF_STATE_FOLDER = '.sf';
89
+ /**
90
+ * The peferred global folder in which state is stored.
91
+ */
92
+ Global.STATE_FOLDER = Global.SFDX_STATE_FOLDER;
83
93
  /**
84
94
  * The full system path to the global log file.
85
95
  */
@@ -126,7 +126,7 @@ export declare const DEFAULT_CONNECTED_APP_INFO: {
126
126
  export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
127
127
  private usingAccessToken;
128
128
  private logger;
129
- private globalInfo;
129
+ private stateAggregator;
130
130
  private username;
131
131
  private options;
132
132
  /**
@@ -289,7 +289,8 @@ export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
289
289
  private loadDecryptedAuthFromConfig;
290
290
  private isTokenOptions;
291
291
  private refreshFn;
292
- private buildJwtConfig;
292
+ private authJwt;
293
+ private tryJwtAuth;
293
294
  private buildRefreshTokenConfig;
294
295
  /**
295
296
  * Performs an authCode exchange but the Oauth2 feature of jsforce is extended to include a code_challenge