@salesforce/core 4.0.0-v3.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +93 -44
  3. package/lib/config/aliasesConfig.d.ts +12 -0
  4. package/lib/config/aliasesConfig.js +28 -0
  5. package/lib/config/authInfoConfig.d.ts +19 -0
  6. package/lib/config/authInfoConfig.js +35 -0
  7. package/lib/config/config.d.ts +181 -48
  8. package/lib/config/config.js +382 -159
  9. package/lib/config/configAggregator.d.ts +59 -42
  10. package/lib/config/configAggregator.js +135 -82
  11. package/lib/config/configFile.d.ts +2 -2
  12. package/lib/config/configFile.js +40 -31
  13. package/lib/config/configGroup.d.ts +9 -9
  14. package/lib/config/configGroup.js +13 -11
  15. package/lib/config/configStore.d.ts +9 -9
  16. package/lib/config/configStore.js +29 -26
  17. package/lib/config/envVars.d.ts +102 -0
  18. package/lib/config/envVars.js +457 -0
  19. package/lib/config/orgUsersConfig.d.ts +8 -0
  20. package/lib/config/orgUsersConfig.js +12 -0
  21. package/lib/config/sandboxOrgConfig.d.ts +8 -0
  22. package/lib/config/sandboxOrgConfig.js +12 -0
  23. package/lib/config/sandboxProcessCache.d.ts +16 -0
  24. package/lib/config/sandboxProcessCache.js +38 -0
  25. package/lib/config/tokensConfig.d.ts +10 -0
  26. package/lib/config/tokensConfig.js +29 -0
  27. package/lib/config/ttlConfig.d.ts +34 -0
  28. package/lib/config/ttlConfig.js +50 -0
  29. package/lib/crypto/crypto.js +29 -16
  30. package/lib/crypto/keyChain.js +4 -4
  31. package/lib/crypto/keyChainImpl.d.ts +5 -3
  32. package/lib/crypto/keyChainImpl.js +65 -66
  33. package/lib/crypto/secureBuffer.d.ts +1 -1
  34. package/lib/crypto/secureBuffer.js +1 -1
  35. package/lib/deviceOauthService.d.ts +5 -5
  36. package/lib/deviceOauthService.js +37 -33
  37. package/lib/exported.d.ts +22 -15
  38. package/lib/exported.js +49 -25
  39. package/lib/global.d.ts +17 -3
  40. package/lib/global.js +46 -13
  41. package/lib/lifecycleEvents.d.ts +39 -2
  42. package/lib/lifecycleEvents.js +77 -3
  43. package/lib/logger.d.ts +21 -11
  44. package/lib/logger.js +121 -105
  45. package/lib/messages.d.ts +53 -36
  46. package/lib/messages.js +89 -97
  47. package/lib/org/authInfo.d.ts +84 -72
  48. package/lib/org/authInfo.js +326 -320
  49. package/lib/org/authRemover.d.ts +16 -23
  50. package/lib/org/authRemover.js +62 -60
  51. package/lib/org/connection.d.ts +33 -59
  52. package/lib/org/connection.js +129 -190
  53. package/lib/org/index.js +6 -2
  54. package/lib/org/org.d.ts +263 -38
  55. package/lib/org/org.js +734 -149
  56. package/lib/org/orgConfigProperties.d.ts +69 -0
  57. package/lib/org/orgConfigProperties.js +121 -0
  58. package/lib/org/permissionSetAssignment.js +6 -15
  59. package/lib/org/scratchOrgCache.d.ts +20 -0
  60. package/lib/org/scratchOrgCache.js +33 -0
  61. package/lib/org/scratchOrgCreate.d.ts +54 -0
  62. package/lib/org/scratchOrgCreate.js +214 -0
  63. package/lib/org/scratchOrgErrorCodes.d.ts +10 -0
  64. package/lib/org/scratchOrgErrorCodes.js +79 -0
  65. package/lib/org/scratchOrgFeatureDeprecation.d.ts +26 -0
  66. package/lib/org/scratchOrgFeatureDeprecation.js +105 -0
  67. package/lib/org/scratchOrgInfoApi.d.ts +68 -0
  68. package/lib/org/scratchOrgInfoApi.js +416 -0
  69. package/lib/org/scratchOrgInfoGenerator.d.ts +64 -0
  70. package/lib/org/scratchOrgInfoGenerator.js +237 -0
  71. package/lib/org/scratchOrgLifecycleEvents.d.ts +10 -0
  72. package/lib/org/scratchOrgLifecycleEvents.js +41 -0
  73. package/lib/org/scratchOrgSettingsGenerator.d.ts +79 -0
  74. package/lib/org/scratchOrgSettingsGenerator.js +277 -0
  75. package/lib/org/scratchOrgTypes.d.ts +43 -0
  76. package/lib/{status/client.js → org/scratchOrgTypes.js} +1 -1
  77. package/lib/org/user.d.ts +7 -2
  78. package/lib/org/user.js +78 -54
  79. package/lib/schema/printer.d.ts +6 -0
  80. package/lib/schema/printer.js +49 -46
  81. package/lib/schema/validator.d.ts +12 -10
  82. package/lib/schema/validator.js +56 -76
  83. package/lib/{sfdxError.d.ts → sfError.d.ts} +12 -15
  84. package/lib/{sfdxError.js → sfError.js} +42 -24
  85. package/lib/{sfdxProject.d.ts → sfProject.d.ts} +75 -35
  86. package/lib/sfProject.js +651 -0
  87. package/lib/stateAggregator/accessors/aliasAccessor.d.ts +98 -0
  88. package/lib/stateAggregator/accessors/aliasAccessor.js +146 -0
  89. package/lib/stateAggregator/accessors/orgAccessor.d.ts +101 -0
  90. package/lib/stateAggregator/accessors/orgAccessor.js +240 -0
  91. package/lib/stateAggregator/accessors/sandboxAccessor.d.ts +8 -0
  92. package/lib/stateAggregator/accessors/sandboxAccessor.js +28 -0
  93. package/lib/stateAggregator/accessors/tokenAccessor.d.ts +63 -0
  94. package/lib/stateAggregator/accessors/tokenAccessor.js +80 -0
  95. package/lib/stateAggregator/index.d.ts +4 -0
  96. package/lib/stateAggregator/index.js +27 -0
  97. package/lib/stateAggregator/stateAggregator.d.ts +25 -0
  98. package/lib/stateAggregator/stateAggregator.js +46 -0
  99. package/lib/status/myDomainResolver.d.ts +1 -1
  100. package/lib/status/myDomainResolver.js +10 -10
  101. package/lib/status/pollingClient.d.ts +2 -6
  102. package/lib/status/pollingClient.js +38 -64
  103. package/lib/status/streamingClient.d.ts +5 -80
  104. package/lib/status/streamingClient.js +74 -94
  105. package/lib/status/types.d.ts +89 -0
  106. package/lib/status/types.js +18 -0
  107. package/lib/testSetup.d.ts +212 -79
  108. package/lib/testSetup.js +478 -182
  109. package/lib/util/cache.d.ts +11 -0
  110. package/lib/util/cache.js +70 -0
  111. package/lib/util/checkLightningDomain.d.ts +1 -0
  112. package/lib/util/checkLightningDomain.js +29 -0
  113. package/lib/util/directoryWriter.d.ts +12 -0
  114. package/lib/util/directoryWriter.js +54 -0
  115. package/lib/util/getJwtAudienceUrl.d.ts +4 -0
  116. package/lib/util/getJwtAudienceUrl.js +19 -0
  117. package/lib/util/internal.d.ts +28 -2
  118. package/lib/util/internal.js +65 -8
  119. package/lib/util/jsonXmlTools.d.ts +14 -0
  120. package/lib/util/jsonXmlTools.js +39 -0
  121. package/lib/util/mapKeys.d.ts +14 -0
  122. package/lib/util/mapKeys.js +52 -0
  123. package/lib/util/sfdc.d.ts +51 -63
  124. package/lib/util/sfdc.js +75 -127
  125. package/lib/util/sfdcUrl.d.ts +64 -0
  126. package/lib/util/sfdcUrl.js +197 -0
  127. package/lib/util/structuredWriter.d.ts +9 -0
  128. package/lib/util/structuredWriter.js +3 -0
  129. package/lib/util/zipWriter.d.ts +16 -0
  130. package/lib/util/zipWriter.js +68 -0
  131. package/lib/webOAuthServer.d.ts +20 -7
  132. package/lib/webOAuthServer.js +107 -60
  133. package/messageTransformer/messageTransformer.ts +93 -0
  134. package/messages/auth.md +11 -3
  135. package/messages/config.md +94 -6
  136. package/messages/connection.md +8 -0
  137. package/messages/core.json +3 -3
  138. package/messages/core.md +11 -1
  139. package/messages/envVars.md +313 -0
  140. package/messages/org.md +64 -0
  141. package/messages/scratchOrgCreate.md +23 -0
  142. package/messages/scratchOrgErrorCodes.md +115 -0
  143. package/messages/scratchOrgFeatureDeprecation.md +11 -0
  144. package/messages/scratchOrgInfoApi.md +20 -0
  145. package/messages/scratchOrgInfoGenerator.md +27 -0
  146. package/messages/user.md +12 -0
  147. package/package.json +138 -66
  148. package/CHANGELOG.md +0 -699
  149. package/lib/config/aliases.d.ts +0 -56
  150. package/lib/config/aliases.js +0 -96
  151. package/lib/config/globalInfoConfig.d.ts +0 -74
  152. package/lib/config/globalInfoConfig.js +0 -144
  153. package/lib/config/keychainConfig.d.ts +0 -19
  154. package/lib/config/keychainConfig.js +0 -43
  155. package/lib/config/sfdxDataHandler.d.ts +0 -36
  156. package/lib/config/sfdxDataHandler.js +0 -165
  157. package/lib/sfdxProject.js +0 -546
  158. package/lib/status/client.d.ts +0 -15
  159. package/lib/util/fs.d.ts +0 -198
  160. package/lib/util/fs.js +0 -374
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018, Salesforce.com, Inc.
1
+ Copyright (c) 2023, 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
@@ -1,9 +1,19 @@
1
1
  [![NPM](https://img.shields.io/npm/v/@salesforce/core.svg)](https://www.npmjs.com/package/@salesforce/core)
2
2
  [![CircleCI](https://circleci.com/gh/forcedotcom/sfdx-core.svg?style=svg&circle-token=2377ca31221869e9d13448313620486da80e595f)](https://circleci.com/gh/forcedotcom/sfdx-core)
3
3
 
4
+ - [Description](#description)
5
+ - [Usage](#usage)
6
+ - [Contributing](#contributing)
7
+ - [Using TestSetup](#using-testsetup)
8
+ - [Mocking Authorizations](#mocking-authorizations)
9
+ - [Mocking Config Files](#mocking-config-files)
10
+ - [Using the Built-in Sinon Sandboxes](#using-the-built-in-sinon-sandboxes)
11
+ - [Testing Expected Failures](#testing-expected-failures)
12
+ - [Testing Log Lines](#testing-log-lines)
13
+
4
14
  # Description
5
15
 
6
- The @salesforce/core library provides client-side management of Salesforce DX projects, org authentication, connections to Salesforce APIs, and other utilities. Much of the core functionality that powers the Salesforcedx plug-ins comes from this library. You can use this functionality in your plug-ins too.
16
+ The @salesforce/core library provides client-side management of Salesforce DX projects, org authentication, connections to Salesforce APIs, and other utilities. Much of the core functionality that powers the Salesforce CLI plugins comes from this library. You can use this functionality in your plugins too.
7
17
 
8
18
  # Usage
9
19
 
@@ -13,37 +23,25 @@ See the [API documentation](https://forcedotcom.github.io/sfdx-core/).
13
23
 
14
24
  If you are interested in contributing, please take a look at the [CONTRIBUTING](CONTRIBUTING.md) guide.
15
25
 
16
- # Related Docs and Repositories
17
-
18
- - [@salesforce/command](https://github.com/forcedotcom/cli-packages/tree/main/packages/command) - Contains base Salesforce CLI command, `SfdxCommand`.
19
- - [@salesforce/plugin-generator](https://github.com/forcedotcom/sfdx-plugin-generate) - The generator plug-in for building plug-ins for Salesforce CLI.
20
-
21
26
  # Using TestSetup
22
27
 
23
28
  The Salesforce DX Core Library provides a unit testing utility to help with mocking and sand-boxing core components. This feature allows unit tests to execute without needing to make API calls to salesforce.com.
24
29
 
25
- ## Mocking AuthInfo
30
+ ## Mocking Authorizations
26
31
 
27
32
  Here you can mock authorization for a Salesforce scratch org.
28
33
 
29
34
  ```typescript
30
35
  import { strictEqual } from 'assert';
31
- import { MockTestOrgData, testSetup } from '@salesforce/core/lib/testSetup';
36
+ import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup';
32
37
  import { AuthInfo } from '@salesforce/core';
33
38
 
34
- const $$ = testSetup();
35
-
36
39
  describe('Mocking Auth data', () => {
40
+ const $$ = new TestContext();
37
41
  it('example', async () => {
38
42
  const testData = new MockTestOrgData();
39
- $$.setConfigStubContents('GlobalInfo', {
40
- contents: {
41
- orgs: {
42
- [testData.username]: await testData.getConfig(),
43
- },
44
- },
45
- });
46
- const auth: AuthInfo = await AuthInfo.create({ username: testData.username });
43
+ await $$.stubAuths(testData);
44
+ const auth = await AuthInfo.create({ username: testData.username });
47
45
  strictEqual(auth.getUsername(), testData.username);
48
46
  });
49
47
  });
@@ -52,58 +50,86 @@ describe('Mocking Auth data', () => {
52
50
  After having a valid AuthInfo object you can then create fake connections to a Salesforce.com scratch org. This allows for writing tests that can validate result responses for SOQL queries and REST endpoints.
53
51
 
54
52
  ```typescript
55
- import { AuthInfo, Connection, SfdxError } from '@salesforce/core';
56
- import { MockTestOrgData, testSetup } from '@salesforce/core/lib/testSetup';
53
+ import { AuthInfo, Connection, SfError } from '@salesforce/core';
54
+ import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup';
57
55
  import { AnyJson, ensureJsonMap, JsonMap } from '@salesforce/ts-types';
58
56
  import { ensureString } from '@salesforce/ts-types';
59
57
  import { deepStrictEqual } from 'assert';
60
58
  import { QueryResult } from 'jsforce';
61
59
 
62
- const $$ = testSetup();
63
-
64
60
  describe('Mocking a force server call', () => {
61
+ const $$ = new TestContext();
65
62
  it('example', async () => {
66
63
  const records: AnyJson = { records: ['123456', '234567'] };
67
64
  const testData = new MockTestOrgData();
68
- $$.setConfigStubContents('GlobalInfo', {
69
- contents: {
70
- orgs: {
71
- [testData.username]: await testData.getConfig(),
72
- },
73
- },
74
- });
65
+ await $$.stubAuths(testData);
75
66
  $$.fakeConnectionRequest = (request: AnyJson): Promise<AnyJson> => {
76
- const _request: JsonMap = ensureJsonMap(request);
67
+ const _request = ensureJsonMap(request);
77
68
  if (request && ensureString(_request.url).includes('Account')) {
78
69
  return Promise.resolve(records);
79
70
  } else {
80
- return Promise.reject(new SfdxError(`Unexpected request: ${_request.url}`));
71
+ return Promise.reject(new SfError(`Unexpected request: ${_request.url}`));
81
72
  }
82
73
  };
83
- const connection: Connection = await Connection.create({
74
+ const connection = await Connection.create({
84
75
  authInfo: await AuthInfo.create({ username: testData.username }),
85
76
  });
86
- const result: QueryResult<{}> = await connection.query('select Id From Account');
77
+ const result = await connection.query('select Id From Account');
87
78
  deepStrictEqual(result, records);
88
79
  });
89
80
  });
90
81
  ```
91
82
 
83
+ ## Mocking Config Files
84
+
85
+ You can mock the contents of various config files
86
+
87
+ ```typescript
88
+ import { strictEqual } from 'assert';
89
+ import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup';
90
+ import { StateAggregator, OrgConfigProperties } from '@salesforce/core';
91
+
92
+ describe('Mocking Aliases', () => {
93
+ const $$ = new TestContext();
94
+ it('example', async () => {
95
+ const testData = new MockTestOrgData();
96
+ await $$.stubAliases({ myAlias: testData.username });
97
+ const alias = (await StateAggregator.getInstance()).aliases.get(testData.username);
98
+ strictEqual(alias, 'myAlais');
99
+ });
100
+ });
101
+
102
+ describe('Mocking Config', () => {
103
+ it('example', async () => {
104
+ const testData = new MockTestOrgData();
105
+ await $$.stubConfig({ [OrgConfigProperties.TARGET_ORG]: testData.username });
106
+ const { value } = (await ConfigAggregator.create()).getInfo(OrgConfigProperties.TARGET_ORG);
107
+ strictEqual(value, testData.username);
108
+ });
109
+ });
110
+
111
+ describe('Mocking Arbitrary Config Files', () => {
112
+ it('example', async () => {
113
+ // MyConfigFile must extend the ConfigFile class in order for this to work properly.
114
+ $$.setConfigStubContents('MyConfigFile', { contents: { foo: 'bar' } });
115
+ });
116
+ });
117
+ ```
118
+
92
119
  ## Using the Built-in Sinon Sandboxes
93
120
 
94
- sfdx-core uses Sinon as its underlying mocking system. If you're unfamiliar with Sinon and it's sandboxing concept you can find more information here:
121
+ sfdx-core uses Sinon as its underlying mocking system. If you're unfamiliar with Sinon and its sandboxing concept you can find more information here:
95
122
  https://sinonjs.org/
96
123
  Sinon `stub`s and `spy`s must be cleaned up after test invocations. To ease the use of Sinon with sfdx core we've exposed our sandbox in TestSetup. After adding your own `stub`s and/or `spy`s they will automatically be cleaned up after each test using mocha's afterEach method.
97
124
 
98
125
  ```typescript
99
126
  import { strictEqual } from 'assert';
100
127
 
101
- import { testSetup } from '@salesforce/core/lib/testSetup';
128
+ import { TestContext } from '@salesforce/core/lib/testSetup';
102
129
  import * as os from 'os';
103
130
 
104
- const $$ = testSetup();
105
-
106
131
  describe('Using the built in Sinon sandbox.', () => {
132
+ const $$ = new TestContext();
107
133
  it('example', async () => {
108
134
  const unsupportedOS = 'LEO';
109
135
  $$.SANDBOX.stub(os, 'platform').returns(unsupportedOS);
@@ -117,13 +143,13 @@ describe('Using the built in Sinon sandbox.', () => {
117
143
  It's important to have negative tests that ensure proper error handling. With `shouldThrow` it's easy to test for expected async rejections.
118
144
 
119
145
  ```typescript
120
- import { SfdxError } from '@salesforce/core';
146
+ import { SfError } from '@salesforce/core';
121
147
  import { shouldThrow } from '@salesforce/core/lib/testSetup';
122
148
  import { strictEqual } from 'assert';
123
149
 
124
150
  class TestObject {
125
151
  public static async method() {
126
- throw new SfdxError('Error', 'ExpectedError');
152
+ throw new SfError('Error', 'ExpectedError');
127
153
  }
128
154
  }
129
155
 
@@ -138,17 +164,39 @@ describe('Testing for expected errors', () => {
138
164
  });
139
165
  ```
140
166
 
167
+ You can also use `shouldThrowSync` for syncrhonous functions you expect to fail
168
+
169
+ ```typescript
170
+ import { SfError } from '@salesforce/core';
171
+ import { shouldThrowSync } from '@salesforce/core/lib/testSetup';
172
+ import { strictEqual } from 'assert';
173
+
174
+ class TestObject {
175
+ public static method() {
176
+ throw new SfError('Error', 'ExpectedError');
177
+ }
178
+ }
179
+
180
+ describe('Testing for expected errors', () => {
181
+ it('example', async () => {
182
+ try {
183
+ shouldThrowSync(() => TestObject.method());
184
+ } catch (e) {
185
+ strictEqual(e.name, 'ExpectedError');
186
+ }
187
+ });
188
+ });
189
+ ```
190
+
141
191
  ## Testing Log Lines
142
192
 
143
193
  It's also useful to check expected values and content from log lines. TestSetup configures the sfdx-core logger to use an in memory LogLine storage structure. These can be easily accessed from tests.
144
194
 
145
195
  ```typescript
146
196
  import { Logger, LogLine } from '@salesforce/core';
147
- import { testSetup } from '@salesforce/core/lib/testSetup';
197
+ import { TestContext } from '@salesforce/core/lib/testSetup';
148
198
  import { strictEqual } from 'assert';
149
199
 
150
- const $$ = testSetup();
151
-
152
200
  const TEST_STRING = 'foo was here';
153
201
 
154
202
  class TestObject {
@@ -162,10 +210,11 @@ class TestObject {
162
210
  }
163
211
 
164
212
  describe('Testing log lines', () => {
213
+ const $$ = new TestContext();
165
214
  it('example', async () => {
166
- const obj: TestObject = new TestObject($$.TEST_LOGGER);
215
+ const obj = new TestObject($$.TEST_LOGGER);
167
216
  obj.method();
168
- const records: LogLine[] = $$.TEST_LOGGER.getBufferedRecords();
217
+ const records = $$.TEST_LOGGER.getBufferedRecords();
169
218
  strictEqual(records.length, 1);
170
219
  strictEqual(records[0].msg, TEST_STRING);
171
220
  });
@@ -0,0 +1,12 @@
1
+ import { ConfigGroup } from './configGroup';
2
+ import { ConfigContents, ConfigValue } from './configStore';
3
+ /**
4
+ * Different groups of aliases. Currently only support orgs.
5
+ */
6
+ export declare enum AliasGroup {
7
+ ORGS = "orgs"
8
+ }
9
+ export declare class AliasesConfig extends ConfigGroup<ConfigGroup.Options> {
10
+ static getDefaultOptions(): ConfigGroup.Options;
11
+ protected setMethod(contents: ConfigContents, key: string, value?: ConfigValue): void;
12
+ }
@@ -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.AliasesConfig = exports.AliasGroup = void 0;
10
+ const configGroup_1 = require("./configGroup");
11
+ /**
12
+ * Different groups of aliases. Currently only support orgs.
13
+ */
14
+ var AliasGroup;
15
+ (function (AliasGroup) {
16
+ AliasGroup["ORGS"] = "orgs";
17
+ })(AliasGroup = exports.AliasGroup || (exports.AliasGroup = {}));
18
+ class AliasesConfig extends configGroup_1.ConfigGroup {
19
+ static getDefaultOptions() {
20
+ return { ...configGroup_1.ConfigGroup.getOptions(AliasGroup.ORGS, 'alias.json'), isGlobal: true, isState: true };
21
+ }
22
+ // eslint-disable-next-line class-methods-use-this
23
+ setMethod(contents, key, value) {
24
+ contents[key] = value;
25
+ }
26
+ }
27
+ exports.AliasesConfig = AliasesConfig;
28
+ //# sourceMappingURL=aliasesConfig.js.map
@@ -0,0 +1,19 @@
1
+ import { AuthFields } from '../org';
2
+ import { ConfigFile } from './configFile';
3
+ /**
4
+ * An auth config file that stores information such as access tokens, usernames, etc.,
5
+ * in the global sfdx directory (~/.sfdx).
6
+ *
7
+ * ```
8
+ * const authInfo = await AuthInfoConfig.create(AuthInfoConfig.getOptions(username));
9
+ * ```
10
+ */
11
+ export declare class AuthInfoConfig extends ConfigFile<ConfigFile.Options, AuthFields> {
12
+ protected static encryptedKeys: RegExp[];
13
+ /**
14
+ * Gets the config options for a given org ID.
15
+ *
16
+ * @param username The username for the org.
17
+ */
18
+ static getOptions(username: string): ConfigFile.Options;
19
+ }
@@ -0,0 +1,35 @@
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.AuthInfoConfig = void 0;
10
+ const configFile_1 = require("./configFile");
11
+ /**
12
+ * An auth config file that stores information such as access tokens, usernames, etc.,
13
+ * in the global sfdx directory (~/.sfdx).
14
+ *
15
+ * ```
16
+ * const authInfo = await AuthInfoConfig.create(AuthInfoConfig.getOptions(username));
17
+ * ```
18
+ */
19
+ class AuthInfoConfig extends configFile_1.ConfigFile {
20
+ /**
21
+ * Gets the config options for a given org ID.
22
+ *
23
+ * @param username The username for the org.
24
+ */
25
+ static getOptions(username) {
26
+ return {
27
+ isGlobal: true,
28
+ isState: true,
29
+ filename: `${username}.json`,
30
+ };
31
+ }
32
+ }
33
+ exports.AuthInfoConfig = AuthInfoConfig;
34
+ AuthInfoConfig.encryptedKeys = [/token/i, /password/i, /secret/i];
35
+ //# sourceMappingURL=authInfoConfig.js.map