@salesforce/core 3.6.4 → 3.7.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.
- package/CHANGELOG.md +36 -10
- package/lib/config/config.d.ts +4 -0
- package/lib/config/config.js +4 -0
- package/lib/deviceOauthService.d.ts +3 -3
- package/lib/deviceOauthService.js +17 -18
- package/lib/exported.d.ts +3 -4
- package/lib/exported.js +1 -2
- package/lib/global.js +1 -1
- package/lib/globalInfo/accessors/aliasAccessor.d.ts +18 -1
- package/lib/globalInfo/accessors/aliasAccessor.js +29 -6
- package/lib/logger.d.ts +1 -1
- package/lib/logger.js +1 -1
- package/lib/org/authInfo.d.ts +15 -40
- package/lib/org/authInfo.js +30 -71
- package/lib/org/connection.d.ts +18 -25
- package/lib/org/connection.js +50 -78
- package/lib/org/org.js +4 -5
- package/lib/org/user.d.ts +1 -0
- package/lib/org/user.js +11 -2
- package/lib/status/pollingClient.d.ts +2 -1
- package/lib/status/streamingClient.d.ts +3 -77
- package/lib/status/streamingClient.js +3 -9
- package/lib/testSetup.d.ts +4 -3
- package/lib/testSetup.js +1 -1
- package/lib/util/getJwtAudienceUrl.d.ts +2 -2
- package/lib/util/sfdcUrl.js +1 -0
- package/lib/webOAuthServer.d.ts +2 -3
- package/lib/webOAuthServer.js +2 -1
- package/messages/config.md +6 -2
- package/package.json +4 -2
- package/lib/status/client.d.ts +0 -15
- package/lib/status/client.js +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,40 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [3.
|
|
5
|
+
### [3.7.1](https://github.com/forcedotcom/sfdx-core/compare/v3.7.0...v3.7.1) (2021-10-28)
|
|
6
|
+
|
|
7
|
+
## [3.7.0](https://github.com/forcedotcom/sfdx-core/compare/v3.6.6...v3.7.0) (2021-10-12)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* use jsforce v2 ([#457](https://github.com/forcedotcom/sfdx-core/issues/457)) ([4a9094e](https://github.com/forcedotcom/sfdx-core/commit/4a9094e958288cdcc6c69f5d87b10a70a437d8e9))
|
|
6
13
|
|
|
14
|
+
### [3.6.6](https://github.com/forcedotcom/sfdx-core/compare/v3.6.5...v3.6.6) (2021-10-08)
|
|
15
|
+
|
|
16
|
+
### [3.6.5](https://github.com/forcedotcom/sfdx-core/compare/v3.6.4...v3.6.5) (2021-09-29)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
- add getValue to AliasAccessor ([c4b69f5](https://github.com/forcedotcom/sfdx-core/commit/c4b69f5ff38547fad640c64833291fe0c6e06a79))
|
|
11
21
|
|
|
12
|
-
### [3.6.
|
|
22
|
+
### [3.6.4](https://github.com/forcedotcom/sfdx-core/compare/v3.6.3...v3.6.4) (2021-09-23)
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- edit the env var blurbs ([#482](https://github.com/forcedotcom/sfdx-core/issues/482)) ([bbbdb6d](https://github.com/forcedotcom/sfdx-core/commit/bbbdb6d0800015e94ce0f0c551eec8ed73dd87c6))
|
|
13
27
|
|
|
28
|
+
### [3.6.3](https://github.com/forcedotcom/sfdx-core/compare/v3.6.2...v3.6.3) (2021-09-23)
|
|
14
29
|
|
|
15
30
|
### Bug Fixes
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
- edit the config var blurbs ([#480](https://github.com/forcedotcom/sfdx-core/issues/480)) ([f845512](https://github.com/forcedotcom/sfdx-core/commit/f8455121bfd96f27495bc124dc06570632dfce70))
|
|
18
33
|
|
|
19
34
|
### [3.6.2](https://github.com/forcedotcom/sfdx-core/compare/v3.6.1...v3.6.2) (2021-09-17)
|
|
20
35
|
|
|
21
|
-
|
|
22
36
|
### Bug Fixes
|
|
23
37
|
|
|
24
|
-
|
|
38
|
+
- improve time to build auths for many orgs @W-9914839@ ([#478](https://github.com/forcedotcom/sfdx-core/issues/478)) ([c788541](https://github.com/forcedotcom/sfdx-core/commit/c7885415d59994b28552227f0b84dcee5d3ec7cf))
|
|
25
39
|
|
|
26
40
|
### [3.6.1](https://github.com/forcedotcom/sfdx-core/compare/v3.6.0...v3.6.1) (2021-09-13)
|
|
27
41
|
|
|
28
|
-
|
|
29
42
|
### Bug Fixes
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
- remove tokens associated with org ([#477](https://github.com/forcedotcom/sfdx-core/issues/477)) ([5034fa2](https://github.com/forcedotcom/sfdx-core/commit/5034fa2d4c52d347c00499e137a71366e4feba7f))
|
|
32
45
|
|
|
33
46
|
## [3.6.0](https://github.com/forcedotcom/sfdx-core/compare/v3.5.0...v3.6.0) (2021-09-10)
|
|
34
47
|
|
|
35
|
-
|
|
36
48
|
### Features
|
|
37
49
|
|
|
38
|
-
|
|
50
|
+
- add help section helper ([#474](https://github.com/forcedotcom/sfdx-core/issues/474)) ([b34c2d7](https://github.com/forcedotcom/sfdx-core/commit/b34c2d7a442aed2cf091fd394a7c3656287d1dbf))
|
|
39
51
|
|
|
40
52
|
## [3.5.0](https://github.com/forcedotcom/sfdx-core/compare/v3.4.5...v3.5.0) (2021-09-09)
|
|
41
53
|
|
|
@@ -203,6 +215,20 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
203
215
|
- add GlobalInfo config file ([#397](https://github.com/forcedotcom/sfdx-core/issues/397)) ([579998b](https://github.com/forcedotcom/sfdx-core/commit/579998b6ee70dbb9772e65896bbabf6d812aae23))
|
|
204
216
|
- default to reading files from cache ([12b5930](https://github.com/forcedotcom/sfdx-core/commit/12b59301df96395c4edcbfb0816dbddd45af95db))
|
|
205
217
|
|
|
218
|
+
### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
|
|
219
|
+
|
|
220
|
+
### Bug Fixes
|
|
221
|
+
|
|
222
|
+
- crmforce.mil ([e263d5d](https://github.com/forcedotcom/sfdx-core/commit/e263d5d74be9c0651e5c2676d6eec1c31fca05e4))
|
|
223
|
+
|
|
224
|
+
## [2.28.0](https://github.com/forcedotcom/sfdx-core/compare/v2.27.2...v2.28.0) (2021-09-16)
|
|
225
|
+
|
|
226
|
+
### Features
|
|
227
|
+
|
|
228
|
+
- add custom templates config ([3cf8a8c](https://github.com/forcedotcom/sfdx-core/commit/3cf8a8cee1e7196efced989dcca9b545e1283386))
|
|
229
|
+
- add validator for custom templates config ([dd2bcfe](https://github.com/forcedotcom/sfdx-core/commit/dd2bcfe8e7fee5c5c1c6321189ec04288103d5b6))
|
|
230
|
+
- update config name ([72e84bf](https://github.com/forcedotcom/sfdx-core/commit/72e84bfacef48a1c2d00a61ebbae3f632601abbd))
|
|
231
|
+
|
|
206
232
|
### [2.27.2](https://github.com/forcedotcom/sfdx-core/compare/v2.27.1...v2.27.2) (2021-08-05)
|
|
207
233
|
|
|
208
234
|
### Bug Fixes
|
package/lib/config/config.d.ts
CHANGED
|
@@ -80,6 +80,10 @@ export declare enum SfdxPropertyKeys {
|
|
|
80
80
|
* Disables telemetry reporting
|
|
81
81
|
*/
|
|
82
82
|
DISABLE_TELEMETRY = "disableTelemetry",
|
|
83
|
+
/**
|
|
84
|
+
* Custom templates repo or local location.
|
|
85
|
+
*/
|
|
86
|
+
CUSTOM_ORG_METADATA_TEMPLATES = "customOrgMetadataTemplates",
|
|
83
87
|
/**
|
|
84
88
|
* allows users to override the 10,000 result query limit
|
|
85
89
|
*/
|
package/lib/config/config.js
CHANGED
|
@@ -73,6 +73,10 @@ var SfdxPropertyKeys;
|
|
|
73
73
|
* Disables telemetry reporting
|
|
74
74
|
*/
|
|
75
75
|
SfdxPropertyKeys["DISABLE_TELEMETRY"] = "disableTelemetry";
|
|
76
|
+
/**
|
|
77
|
+
* Custom templates repo or local location.
|
|
78
|
+
*/
|
|
79
|
+
SfdxPropertyKeys["CUSTOM_ORG_METADATA_TEMPLATES"] = "customOrgMetadataTemplates";
|
|
76
80
|
/**
|
|
77
81
|
* allows users to override the 10,000 result query limit
|
|
78
82
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncCreatable } from '@salesforce/kit';
|
|
2
|
-
import {
|
|
2
|
+
import { OAuth2Config } from 'jsforce/lib/oauth2';
|
|
3
3
|
import { Nullable, JsonMap } from '@salesforce/ts-types';
|
|
4
4
|
import { AuthInfo } from './org/authInfo';
|
|
5
5
|
export interface DeviceCodeResponse extends JsonMap {
|
|
@@ -34,7 +34,7 @@ export interface DeviceCodePollingResponse extends JsonMap {
|
|
|
34
34
|
* const authInfo = await deviceOauthService.authorizeAndSave(approval);
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export declare class DeviceOauthService extends AsyncCreatable<
|
|
37
|
+
export declare class DeviceOauthService extends AsyncCreatable<OAuth2Config> {
|
|
38
38
|
static RESPONSE_TYPE: string;
|
|
39
39
|
static GRANT_TYPE: string;
|
|
40
40
|
static SCOPE: string;
|
|
@@ -42,7 +42,7 @@ export declare class DeviceOauthService extends AsyncCreatable<OAuth2Options> {
|
|
|
42
42
|
private logger;
|
|
43
43
|
private options;
|
|
44
44
|
private pollingCount;
|
|
45
|
-
constructor(options:
|
|
45
|
+
constructor(options: OAuth2Config);
|
|
46
46
|
/**
|
|
47
47
|
* Begin the authorization flow by requesting the login
|
|
48
48
|
*
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.DeviceOauthService = void 0;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const Transport = require("jsforce/lib/transport");
|
|
12
|
+
const url_1 = require("url");
|
|
13
|
+
const transport_1 = require("jsforce/lib/transport");
|
|
15
14
|
const kit_1 = require("@salesforce/kit");
|
|
16
15
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
17
16
|
const logger_1 = require("./logger");
|
|
@@ -27,7 +26,7 @@ async function wait(ms = 1000) {
|
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
async function makeRequest(options) {
|
|
30
|
-
const rawResponse = await new
|
|
29
|
+
const rawResponse = await new transport_1.default().httpRequest(options);
|
|
31
30
|
const response = kit_1.parseJsonMap(rawResponse.body);
|
|
32
31
|
if (response.error) {
|
|
33
32
|
const err = new sfdxError_1.SfdxError('Request Failed.');
|
|
@@ -109,36 +108,36 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
109
108
|
this.logger.debug(`this.options.loginUrl: ${this.options.loginUrl}`);
|
|
110
109
|
}
|
|
111
110
|
getLoginOptions(url) {
|
|
111
|
+
const body = new url_1.URLSearchParams();
|
|
112
|
+
body.append('client_id', ts_types_1.ensureString(this.options.clientId));
|
|
113
|
+
body.append('response_type', DeviceOauthService.RESPONSE_TYPE);
|
|
114
|
+
body.append('scope', DeviceOauthService.SCOPE);
|
|
112
115
|
return {
|
|
113
116
|
url,
|
|
114
117
|
headers: connection_1.SFDX_HTTP_HEADERS,
|
|
115
118
|
method: 'POST',
|
|
116
|
-
|
|
117
|
-
client_id: ts_types_1.ensureString(this.options.clientId),
|
|
118
|
-
response_type: DeviceOauthService.RESPONSE_TYPE,
|
|
119
|
-
scope: DeviceOauthService.SCOPE,
|
|
120
|
-
},
|
|
119
|
+
body,
|
|
121
120
|
};
|
|
122
121
|
}
|
|
123
122
|
getPollingOptions(url, code) {
|
|
123
|
+
const body = new url_1.URLSearchParams();
|
|
124
|
+
body.append('client_id', ts_types_1.ensureString(this.options.clientId));
|
|
125
|
+
body.append('grant_type', DeviceOauthService.GRANT_TYPE);
|
|
126
|
+
body.append('code', code);
|
|
124
127
|
return {
|
|
125
128
|
url,
|
|
126
129
|
headers: connection_1.SFDX_HTTP_HEADERS,
|
|
127
130
|
method: 'POST',
|
|
128
|
-
|
|
129
|
-
code,
|
|
130
|
-
grant_type: DeviceOauthService.GRANT_TYPE,
|
|
131
|
-
client_id: ts_types_1.ensureString(this.options.clientId),
|
|
132
|
-
},
|
|
131
|
+
body,
|
|
133
132
|
};
|
|
134
133
|
}
|
|
135
134
|
getDeviceFlowRequestUrl() {
|
|
136
135
|
return `${ts_types_1.ensureString(this.options.loginUrl)}/services/oauth2/token`;
|
|
137
136
|
}
|
|
138
|
-
async poll(
|
|
137
|
+
async poll(httpRequest) {
|
|
139
138
|
this.logger.debug(`polling for device approval (attempt ${this.pollingCount} of ${DeviceOauthService.POLLING_COUNT_MAX})`);
|
|
140
139
|
try {
|
|
141
|
-
return await makeRequest(
|
|
140
|
+
return await makeRequest(httpRequest);
|
|
142
141
|
}
|
|
143
142
|
catch (e) {
|
|
144
143
|
const err = e.data;
|
|
@@ -160,11 +159,11 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
160
159
|
shouldContinuePolling() {
|
|
161
160
|
return this.pollingCount < DeviceOauthService.POLLING_COUNT_MAX;
|
|
162
161
|
}
|
|
163
|
-
async pollForDeviceApproval(
|
|
162
|
+
async pollForDeviceApproval(httpRequest, interval) {
|
|
164
163
|
this.logger.debug('BEGIN POLLING FOR DEVICE APPROVAL');
|
|
165
164
|
let result;
|
|
166
165
|
while (this.shouldContinuePolling()) {
|
|
167
|
-
result = await this.poll(
|
|
166
|
+
result = await this.poll(httpRequest);
|
|
168
167
|
if (result) {
|
|
169
168
|
this.logger.debug('POLLING FOR DEVICE APPROVAL SUCCESS');
|
|
170
169
|
break;
|
package/lib/exported.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { OAuth2Config } from 'jsforce';
|
|
2
2
|
export { ConfigFile } from './config/configFile';
|
|
3
3
|
export { EnvironmentVariable, SUPPORTED_ENV_VARS } from './config/envVars';
|
|
4
4
|
export { BaseConfigStore, ConfigContents, ConfigEntry, ConfigStore, ConfigValue } from './config/configStore';
|
|
@@ -7,7 +7,7 @@ export { DeviceOauthService, DeviceCodeResponse, DeviceCodePollingResponse } fro
|
|
|
7
7
|
export { OrgUsersConfig } from './config/orgUsersConfig';
|
|
8
8
|
export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SFDX_ALLOWED_PROPERTIES, } from './config/config';
|
|
9
9
|
export { ConfigInfo, ConfigAggregator } from './config/configAggregator';
|
|
10
|
-
export { AuthFields, AuthInfo,
|
|
10
|
+
export { AuthFields, AuthInfo, OrgAuthorization } from './org/authInfo';
|
|
11
11
|
export { AuthRemover } from './org/authRemover';
|
|
12
12
|
export { Connection, SFDX_HTTP_HEADERS } from './org/connection';
|
|
13
13
|
export { Mode, Global } from './global';
|
|
@@ -23,9 +23,8 @@ export { PackageDir, NamedPackageDir, PackageDirDependency, SfdxProject, SfdxPro
|
|
|
23
23
|
export { SchemaPrinter } from './schema/printer';
|
|
24
24
|
export { SchemaValidator } from './schema/validator';
|
|
25
25
|
export { SfdxError } from './sfdxError';
|
|
26
|
-
export { StatusResult } from './status/client';
|
|
27
26
|
export { PollingClient } from './status/pollingClient';
|
|
28
|
-
export { CometClient, CometSubscription, StreamingClient } from './status/streamingClient';
|
|
27
|
+
export { CometClient, CometSubscription, StreamingClient, StatusResult } from './status/streamingClient';
|
|
29
28
|
export { MyDomainResolver } from './status/myDomainResolver';
|
|
30
29
|
export { DefaultUserFields, REQUIRED_FIELDS, User, UserFields } from './org/user';
|
|
31
30
|
export { PermissionSetAssignment, PermissionSetAssignmentFields } from './org/permissionSetAssignment';
|
package/lib/exported.js
CHANGED
|
@@ -16,7 +16,7 @@ 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.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = 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.
|
|
19
|
+
exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = 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.SFDX_ALLOWED_PROPERTIES = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.SfInfoKeys = exports.GlobalInfo = exports.BaseConfigStore = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.ConfigFile = void 0;
|
|
20
20
|
const messages_1 = require("./messages");
|
|
21
21
|
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
22
22
|
var configFile_1 = require("./config/configFile");
|
|
@@ -41,7 +41,6 @@ var configAggregator_1 = require("./config/configAggregator");
|
|
|
41
41
|
Object.defineProperty(exports, "ConfigAggregator", { enumerable: true, get: function () { return configAggregator_1.ConfigAggregator; } });
|
|
42
42
|
var authInfo_1 = require("./org/authInfo");
|
|
43
43
|
Object.defineProperty(exports, "AuthInfo", { enumerable: true, get: function () { return authInfo_1.AuthInfo; } });
|
|
44
|
-
Object.defineProperty(exports, "OAuth2WithVerifier", { enumerable: true, get: function () { return authInfo_1.OAuth2WithVerifier; } });
|
|
45
44
|
var authRemover_1 = require("./org/authRemover");
|
|
46
45
|
Object.defineProperty(exports, "AuthRemover", { enumerable: true, get: function () { return authRemover_1.AuthRemover; } });
|
|
47
46
|
var connection_1 = require("./org/connection");
|
package/lib/global.js
CHANGED
|
@@ -79,5 +79,5 @@ Global.SF_DIR = path.join(os.homedir(), Global.SF_STATE_FOLDER);
|
|
|
79
79
|
/**
|
|
80
80
|
* The full system path to the global log file.
|
|
81
81
|
*/
|
|
82
|
-
Global.LOG_FILE_PATH = path.join(Global.
|
|
82
|
+
Global.LOG_FILE_PATH = path.join(Global.SF_DIR, 'sf.log');
|
|
83
83
|
//# sourceMappingURL=global.js.map
|
|
@@ -6,7 +6,7 @@ export declare class AliasAccessor {
|
|
|
6
6
|
private globalInfo;
|
|
7
7
|
constructor(globalInfo: GlobalInfo);
|
|
8
8
|
/**
|
|
9
|
-
* Returns all the aliases for all the
|
|
9
|
+
* Returns all the aliases for all the values
|
|
10
10
|
*/
|
|
11
11
|
getAll(): SfAliases;
|
|
12
12
|
/**
|
|
@@ -21,12 +21,29 @@ export declare class AliasAccessor {
|
|
|
21
21
|
* @param entity the aliasable entity that you want to get the alias of
|
|
22
22
|
*/
|
|
23
23
|
get(entity: Aliasable): Nullable<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the value that corresponds to the given alias if it exists
|
|
26
|
+
*
|
|
27
|
+
* @param alias the alias that corresponds to a value
|
|
28
|
+
*/
|
|
29
|
+
getValue(alias: string): Nullable<string>;
|
|
24
30
|
/**
|
|
25
31
|
* Returns the username that corresponds to the given alias if it exists
|
|
26
32
|
*
|
|
27
33
|
* @param alias the alias that corresponds to a username
|
|
28
34
|
*/
|
|
29
35
|
getUsername(alias: string): Nullable<string>;
|
|
36
|
+
/**
|
|
37
|
+
* If the provided string is an alias, it returns the corresponding value.
|
|
38
|
+
* If the provided string is not an alias, we assume that the provided string
|
|
39
|
+
* is the value and return it.
|
|
40
|
+
*
|
|
41
|
+
* This method is helpful when you don't know if the string you have is a value
|
|
42
|
+
* or an alias.
|
|
43
|
+
*
|
|
44
|
+
* @param valueOrAlias a string that might be a value or might be an alias
|
|
45
|
+
*/
|
|
46
|
+
resolveValue(valueOrAlias: string): string;
|
|
30
47
|
/**
|
|
31
48
|
* If the provided string is an alias, it returns the corresponding username.
|
|
32
49
|
* If the provided string is not an alias, we assume that the provided string
|
|
@@ -16,9 +16,9 @@ class AliasAccessor {
|
|
|
16
16
|
getAll(entity) {
|
|
17
17
|
const all = this.globalInfo.get(types_1.SfInfoKeys.ALIASES) || {};
|
|
18
18
|
if (entity) {
|
|
19
|
-
const
|
|
19
|
+
const value = this.getNameOf(entity);
|
|
20
20
|
return Object.entries(all)
|
|
21
|
-
.filter((entry) => entry[1] ===
|
|
21
|
+
.filter((entry) => entry[1] === value)
|
|
22
22
|
.map((entry) => entry[0]);
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
@@ -34,6 +34,15 @@ class AliasAccessor {
|
|
|
34
34
|
var _a;
|
|
35
35
|
return (_a = this.getAll(entity).find((alias) => alias)) !== null && _a !== void 0 ? _a : null;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the value that corresponds to the given alias if it exists
|
|
39
|
+
*
|
|
40
|
+
* @param alias the alias that corresponds to a value
|
|
41
|
+
*/
|
|
42
|
+
getValue(alias) {
|
|
43
|
+
var _a;
|
|
44
|
+
return (_a = this.getAll()[alias]) !== null && _a !== void 0 ? _a : null;
|
|
45
|
+
}
|
|
37
46
|
/**
|
|
38
47
|
* Returns the username that corresponds to the given alias if it exists
|
|
39
48
|
*
|
|
@@ -43,6 +52,20 @@ class AliasAccessor {
|
|
|
43
52
|
var _a;
|
|
44
53
|
return (_a = this.getAll()[alias]) !== null && _a !== void 0 ? _a : null;
|
|
45
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* If the provided string is an alias, it returns the corresponding value.
|
|
57
|
+
* If the provided string is not an alias, we assume that the provided string
|
|
58
|
+
* is the value and return it.
|
|
59
|
+
*
|
|
60
|
+
* This method is helpful when you don't know if the string you have is a value
|
|
61
|
+
* or an alias.
|
|
62
|
+
*
|
|
63
|
+
* @param valueOrAlias a string that might be a value or might be an alias
|
|
64
|
+
*/
|
|
65
|
+
resolveValue(valueOrAlias) {
|
|
66
|
+
var _a;
|
|
67
|
+
return (_a = this.getValue(valueOrAlias)) !== null && _a !== void 0 ? _a : valueOrAlias;
|
|
68
|
+
}
|
|
46
69
|
/**
|
|
47
70
|
* If the provided string is an alias, it returns the corresponding username.
|
|
48
71
|
* If the provided string is not an alias, we assume that the provided string
|
|
@@ -64,8 +87,8 @@ class AliasAccessor {
|
|
|
64
87
|
* @param entity the aliasable entity that's being aliased
|
|
65
88
|
*/
|
|
66
89
|
set(alias, entity) {
|
|
67
|
-
const
|
|
68
|
-
this.globalInfo.set(`${types_1.SfInfoKeys.ALIASES}["${alias}"]`,
|
|
90
|
+
const value = this.getNameOf(entity);
|
|
91
|
+
this.globalInfo.set(`${types_1.SfInfoKeys.ALIASES}["${alias}"]`, value);
|
|
69
92
|
}
|
|
70
93
|
/**
|
|
71
94
|
* Updates the alias for the given aliasable entity
|
|
@@ -74,8 +97,8 @@ class AliasAccessor {
|
|
|
74
97
|
* @param entity the aliasable entity that's being aliased
|
|
75
98
|
*/
|
|
76
99
|
update(alias, entity) {
|
|
77
|
-
const
|
|
78
|
-
this.globalInfo.update(`${types_1.SfInfoKeys.ALIASES}["${alias}"]`,
|
|
100
|
+
const value = this.getNameOf(entity);
|
|
101
|
+
this.globalInfo.update(`${types_1.SfInfoKeys.ALIASES}["${alias}"]`, value);
|
|
79
102
|
}
|
|
80
103
|
unset(alias) {
|
|
81
104
|
delete this.globalInfo.get(types_1.SfInfoKeys.ALIASES)[alias];
|
package/lib/logger.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export declare class Logger {
|
|
|
150
150
|
/**
|
|
151
151
|
* The name of the root sfdx `Logger`.
|
|
152
152
|
*/
|
|
153
|
-
static readonly ROOT_NAME = "
|
|
153
|
+
static readonly ROOT_NAME = "sf";
|
|
154
154
|
/**
|
|
155
155
|
* The default `LoggerLevel` when constructing new `Logger` instances.
|
|
156
156
|
*/
|
package/lib/logger.js
CHANGED
package/lib/org/authInfo.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
2
|
-
import {
|
|
3
|
-
import { OAuth2,
|
|
2
|
+
import { Nullable } from '@salesforce/ts-types';
|
|
3
|
+
import { OAuth2, OAuth2Config as JsforceOAuth2Config } from 'jsforce';
|
|
4
4
|
import { Connection } from './connection';
|
|
5
|
+
export declare type OAuth2Config = JsforceOAuth2Config & {
|
|
6
|
+
privateKey?: string;
|
|
7
|
+
privateKeyFile?: string;
|
|
8
|
+
authCode?: string;
|
|
9
|
+
refreshToken?: string;
|
|
10
|
+
loginUrl?: string;
|
|
11
|
+
};
|
|
5
12
|
/**
|
|
6
13
|
* Fields for authorization, org, and local information.
|
|
7
14
|
*/
|
|
@@ -63,46 +70,12 @@ export declare type ConnectionOptions = AuthFields & {
|
|
|
63
70
|
/**
|
|
64
71
|
* OAuth options.
|
|
65
72
|
*/
|
|
66
|
-
oauth2?: Partial<
|
|
73
|
+
oauth2?: Partial<OAuth2Config>;
|
|
67
74
|
/**
|
|
68
75
|
* Refresh token callback.
|
|
69
76
|
*/
|
|
70
77
|
refreshFn?: RefreshFn;
|
|
71
78
|
};
|
|
72
|
-
/**
|
|
73
|
-
* Extend OAuth2 to add code verifier support for the auth code (web auth) flow
|
|
74
|
-
* const oauth2 = new OAuth2WithVerifier({ loginUrl, clientSecret, clientId, redirectUri });
|
|
75
|
-
*
|
|
76
|
-
* const authUrl = oauth2.getAuthorizationUrl({
|
|
77
|
-
* state: 'foo',
|
|
78
|
-
* prompt: 'login',
|
|
79
|
-
* scope: 'api web'
|
|
80
|
-
* });
|
|
81
|
-
* console.log(authUrl);
|
|
82
|
-
* const authCode = await retrieveCode();
|
|
83
|
-
* const authInfo = await AuthInfo.create({ oauth2Options: { clientId, clientSecret, loginUrl, authCode }, oauth2});
|
|
84
|
-
* console.log(`access token: ${authInfo.getFields(true).accessToken}`);
|
|
85
|
-
*/
|
|
86
|
-
export declare class OAuth2WithVerifier extends OAuth2 {
|
|
87
|
-
readonly codeVerifier: string;
|
|
88
|
-
constructor(options: OAuth2Options);
|
|
89
|
-
/**
|
|
90
|
-
* Overrides jsforce.OAuth2.getAuthorizationUrl. Get Salesforce OAuth2 authorization page
|
|
91
|
-
* URL to redirect user agent, adding a verification code for added security.
|
|
92
|
-
*
|
|
93
|
-
* @param params
|
|
94
|
-
*/
|
|
95
|
-
getAuthorizationUrl(params: Record<string, unknown>): string;
|
|
96
|
-
requestToken(code: string, callback?: (err: Error, tokenResponse: TokenResponse) => void): Promise<TokenResponse>;
|
|
97
|
-
/**
|
|
98
|
-
* Overrides jsforce.OAuth2._postParams because jsforce's oauth impl doesn't support
|
|
99
|
-
* coder_verifier and code_challenge. This enables the server to disallow trading a one-time auth code
|
|
100
|
-
* for an access/refresh token when the verifier and challenge are out of alignment.
|
|
101
|
-
*
|
|
102
|
-
* See https://github.com/jsforce/jsforce/issues/665
|
|
103
|
-
*/
|
|
104
|
-
protected _postParams(params: Record<string, unknown>, callback: AnyFunction): Promise<any>;
|
|
105
|
-
}
|
|
106
79
|
export declare const DEFAULT_CONNECTED_APP_INFO: {
|
|
107
80
|
clientId: string;
|
|
108
81
|
legacyClientId: string;
|
|
@@ -180,9 +153,9 @@ export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
|
|
|
180
153
|
*
|
|
181
154
|
* @param options The options to generate the URL.
|
|
182
155
|
*/
|
|
183
|
-
static getAuthorizationUrl(options:
|
|
156
|
+
static getAuthorizationUrl(options: OAuth2Config & {
|
|
184
157
|
scope?: string;
|
|
185
|
-
}, oauth2?:
|
|
158
|
+
}, oauth2?: OAuth2): string;
|
|
186
159
|
/**
|
|
187
160
|
* Parse a sfdx auth url, usually obtained by `authInfo.getSfdxAuthUrl`.
|
|
188
161
|
*
|
|
@@ -235,6 +208,8 @@ export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
|
|
|
235
208
|
* Get the auth fields (decrypted) needed to make a connection.
|
|
236
209
|
*/
|
|
237
210
|
getConnectionOptions(): ConnectionOptions;
|
|
211
|
+
getClientId(): string;
|
|
212
|
+
getRedirectUri(): string;
|
|
238
213
|
/**
|
|
239
214
|
* Get the authorization fields.
|
|
240
215
|
*
|
|
@@ -320,7 +295,7 @@ export declare namespace AuthInfo {
|
|
|
320
295
|
/**
|
|
321
296
|
* OAuth options.
|
|
322
297
|
*/
|
|
323
|
-
oauth2Options?:
|
|
298
|
+
oauth2Options?: OAuth2Config;
|
|
324
299
|
/**
|
|
325
300
|
* Options for the access token auth.
|
|
326
301
|
*/
|