@salesforce/core 3.24.4 → 3.25.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 +18 -0
- package/lib/config/config.js +7 -0
- package/lib/logger.js +2 -2
- package/lib/org/authRemover.js +2 -7
- package/lib/org/orgConfigProperties.js +5 -0
- package/lib/stateAggregator/accessors/orgAccessor.d.ts +2 -8
- package/lib/stateAggregator/accessors/orgAccessor.js +13 -7
- package/messages/config.md +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.25.1](https://github.com/forcedotcom/sfdx-core/compare/v3.25.0...v3.25.1) (2022-08-03)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- add interop between templates config/env var ([eea3d05](https://github.com/forcedotcom/sfdx-core/commit/eea3d055b75ceb61639e06bc53e309a01f70a8e2))
|
|
10
|
+
|
|
11
|
+
## [3.25.0](https://github.com/forcedotcom/sfdx-core/compare/v3.24.5...v3.25.0) (2022-07-29)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- orgAccessor.get has throwOnNotFound option ([a2ee821](https://github.com/forcedotcom/sfdx-core/commit/a2ee8219adf692de7de17ba254e05f501ef5814c))
|
|
16
|
+
|
|
17
|
+
### [3.24.5](https://github.com/forcedotcom/sfdx-core/compare/v3.24.4...v3.24.5) (2022-07-28)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- set correct file mode for log file ([30aa3fc](https://github.com/forcedotcom/sfdx-core/commit/30aa3fc09ba2bf0db600ee6528fde5b0ff97b217))
|
|
22
|
+
|
|
5
23
|
### [3.24.4](https://github.com/forcedotcom/sfdx-core/compare/v3.24.3...v3.24.4) (2022-07-28)
|
|
6
24
|
|
|
7
25
|
### [3.24.3](https://github.com/forcedotcom/sfdx-core/compare/v3.24.2...v3.24.3) (2022-07-28)
|
package/lib/config/config.js
CHANGED
|
@@ -40,6 +40,7 @@ const messages = messages_1.Messages.load('@salesforce/core', 'config', [
|
|
|
40
40
|
'restDeploy',
|
|
41
41
|
'instanceUrl',
|
|
42
42
|
'disable-telemetry',
|
|
43
|
+
'customOrgMetadataTemplates',
|
|
43
44
|
]);
|
|
44
45
|
const SFDX_CONFIG_FILE_NAME = 'sfdx-config.json';
|
|
45
46
|
const CONFIG_FILE_NAME = 'config.json';
|
|
@@ -200,6 +201,12 @@ exports.SFDX_ALLOWED_PROPERTIES = [
|
|
|
200
201
|
failedMessage: messages.getMessage('invalidBooleanConfigValue'),
|
|
201
202
|
},
|
|
202
203
|
},
|
|
204
|
+
{
|
|
205
|
+
key: SfdxPropertyKeys.CUSTOM_ORG_METADATA_TEMPLATES,
|
|
206
|
+
newKey: orgConfigProperties_1.OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES,
|
|
207
|
+
deprecated: true,
|
|
208
|
+
description: messages.getMessage(SfdxPropertyKeys.CUSTOM_ORG_METADATA_TEMPLATES),
|
|
209
|
+
},
|
|
203
210
|
{
|
|
204
211
|
key: SfdxPropertyKeys.REST_DEPLOY,
|
|
205
212
|
description: messages.getMessage(SfdxPropertyKeys.REST_DEPLOY),
|
package/lib/logger.js
CHANGED
|
@@ -291,11 +291,11 @@ class Logger {
|
|
|
291
291
|
fs.mkdirSync(path.dirname(logFile));
|
|
292
292
|
}
|
|
293
293
|
else {
|
|
294
|
-
fs.mkdirSync(path.dirname(logFile), { mode:
|
|
294
|
+
fs.mkdirSync(path.dirname(logFile), { mode: 0o700 });
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
catch (err2) {
|
|
298
|
-
|
|
298
|
+
throw sfError_1.SfError.wrap(err2);
|
|
299
299
|
}
|
|
300
300
|
try {
|
|
301
301
|
fs.writeFileSync(logFile, '', { mode: '600' });
|
package/lib/org/authRemover.js
CHANGED
|
@@ -14,7 +14,6 @@ const messages_1 = require("../messages");
|
|
|
14
14
|
const stateAggregator_1 = require("../stateAggregator");
|
|
15
15
|
const orgConfigProperties_1 = require("./orgConfigProperties");
|
|
16
16
|
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
17
|
-
const coreMessages = messages_1.Messages.load('@salesforce/core', 'core', ['namedOrgNotFound']);
|
|
18
17
|
const messages = messages_1.Messages.load('@salesforce/core', 'auth', ['targetOrgNotSet']);
|
|
19
18
|
/**
|
|
20
19
|
* Handles the removing of authorizations, which includes deleting the auth file
|
|
@@ -72,12 +71,8 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
|
|
|
72
71
|
* @returns {Promise<SfOrg>}
|
|
73
72
|
*/
|
|
74
73
|
async findAuth(usernameOrAlias) {
|
|
75
|
-
const username = await this.resolveUsername(usernameOrAlias
|
|
76
|
-
|
|
77
|
-
if (!auth) {
|
|
78
|
-
throw coreMessages.createError('namedOrgNotFound');
|
|
79
|
-
}
|
|
80
|
-
return auth;
|
|
74
|
+
const username = await this.resolveUsername(usernameOrAlias ?? this.getTargetOrg());
|
|
75
|
+
return this.stateAggregator.orgs.get(username, false, true);
|
|
81
76
|
}
|
|
82
77
|
/**
|
|
83
78
|
* Finds all org authorizations in the global info file (.sf/sf.json)
|
|
@@ -27,6 +27,7 @@ const messages = messages_1.Messages.load('@salesforce/core', 'config', [
|
|
|
27
27
|
'org-max-query-limit',
|
|
28
28
|
'target-dev-hub',
|
|
29
29
|
'target-org',
|
|
30
|
+
'org-custom-metadata-templates',
|
|
30
31
|
]);
|
|
31
32
|
var OrgConfigProperties;
|
|
32
33
|
(function (OrgConfigProperties) {
|
|
@@ -64,6 +65,10 @@ var OrgConfigProperties;
|
|
|
64
65
|
OrgConfigProperties["ORG_ISV_DEBUGGER_URL"] = "org-isv-debugger-url";
|
|
65
66
|
})(OrgConfigProperties = exports.OrgConfigProperties || (exports.OrgConfigProperties = {}));
|
|
66
67
|
exports.ORG_CONFIG_ALLOWED_PROPERTIES = [
|
|
68
|
+
{
|
|
69
|
+
key: OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES,
|
|
70
|
+
description: messages.getMessage(OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES),
|
|
71
|
+
},
|
|
67
72
|
{
|
|
68
73
|
key: OrgConfigProperties.TARGET_ORG,
|
|
69
74
|
description: messages.getMessage(OrgConfigProperties.TARGET_ORG),
|
|
@@ -26,7 +26,7 @@ export declare abstract class BaseOrgAccessor<T extends ConfigFile, P extends Co
|
|
|
26
26
|
private contents;
|
|
27
27
|
private logger;
|
|
28
28
|
/**
|
|
29
|
-
* Read the auth file for the given
|
|
29
|
+
* Read the auth file for the given username. Once the file has been read, it can be re-accessed with the `get` method.
|
|
30
30
|
*
|
|
31
31
|
* @param username username to read
|
|
32
32
|
* @param decrypt if true, decrypt encrypted values
|
|
@@ -39,13 +39,7 @@ export declare abstract class BaseOrgAccessor<T extends ConfigFile, P extends Co
|
|
|
39
39
|
* @param decrypt if true, decrypt encrypted values
|
|
40
40
|
*/
|
|
41
41
|
readAll(decrypt?: boolean): Promise<P[]>;
|
|
42
|
-
|
|
43
|
-
* Return the contents of the username's auth file from cache. The `read` or `readAll` methods must be called first in order to populate the cache.
|
|
44
|
-
*
|
|
45
|
-
* @param username username to get
|
|
46
|
-
* @param decrypt if true, decrypt encrypted values
|
|
47
|
-
*/
|
|
48
|
-
get(username: string, decrypt?: boolean): Nullable<P>;
|
|
42
|
+
get(username: string, decrypt?: boolean, throwOnNotFound?: true): P;
|
|
49
43
|
/**
|
|
50
44
|
* Return the contents of all the auth files from cache. The `read` or `readAll` methods must be called first in order to populate the cache.
|
|
51
45
|
*
|
|
@@ -14,6 +14,7 @@ const authInfoConfig_1 = require("../../config/authInfoConfig");
|
|
|
14
14
|
const global_1 = require("../../global");
|
|
15
15
|
const types_1 = require("../types");
|
|
16
16
|
const logger_1 = require("../../logger");
|
|
17
|
+
const messages_1 = require("../../messages");
|
|
17
18
|
/**
|
|
18
19
|
* @deprecated
|
|
19
20
|
*/
|
|
@@ -62,7 +63,7 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
62
63
|
this.contents = new Map();
|
|
63
64
|
}
|
|
64
65
|
/**
|
|
65
|
-
* Read the auth file for the given
|
|
66
|
+
* Read the auth file for the given username. Once the file has been read, it can be re-accessed with the `get` method.
|
|
66
67
|
*
|
|
67
68
|
* @param username username to read
|
|
68
69
|
* @param decrypt if true, decrypt encrypted values
|
|
@@ -96,13 +97,21 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
96
97
|
return this.getAll(decrypt);
|
|
97
98
|
}
|
|
98
99
|
/**
|
|
99
|
-
* Return the contents of the username's auth file from cache.
|
|
100
|
+
* Return the contents of the username's auth file from cache.
|
|
101
|
+
* The `read` or `readAll` methods must be called first in order to populate the cache.
|
|
102
|
+
* If throwOnNotFound is not true, an empty object {} is returned if the org is not found.
|
|
100
103
|
*
|
|
101
104
|
* @param username username to get
|
|
102
105
|
* @param decrypt if true, decrypt encrypted values
|
|
106
|
+
* @param throwOnNotFound if true, throw if the auth file does not already exist in the cache
|
|
103
107
|
*/
|
|
104
|
-
get(username, decrypt = false) {
|
|
108
|
+
get(username, decrypt = false, throwOnNotFound = false) {
|
|
105
109
|
const config = this.configs.get(username);
|
|
110
|
+
if (throwOnNotFound && config?.keys().length === 0) {
|
|
111
|
+
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
112
|
+
const messages = messages_1.Messages.load('@salesforce/core', 'core', ['namedOrgNotFound']);
|
|
113
|
+
throw messages.createError('namedOrgNotFound', [username]);
|
|
114
|
+
}
|
|
106
115
|
if (config) {
|
|
107
116
|
this.contents.set(username, config.getContents(decrypt));
|
|
108
117
|
}
|
|
@@ -115,10 +124,7 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
115
124
|
* @returns
|
|
116
125
|
*/
|
|
117
126
|
getAll(decrypt = false) {
|
|
118
|
-
return [...this.configs.keys()].
|
|
119
|
-
const org = this.get(username, decrypt);
|
|
120
|
-
return org && !(0, kit_1.isEmpty)(org) ? orgs.concat([org]) : orgs;
|
|
121
|
-
}, []);
|
|
127
|
+
return [...this.configs.keys()].map((username) => this.get(username, decrypt)).filter((org) => !(0, kit_1.isEmpty)(org));
|
|
122
128
|
}
|
|
123
129
|
/**
|
|
124
130
|
* Returns true if the username has been cached.
|
package/messages/config.md
CHANGED
|
@@ -142,3 +142,11 @@ URL of the Salesforce instance hosting your org. Default: https://login.salesfor
|
|
|
142
142
|
# org-instance-url
|
|
143
143
|
|
|
144
144
|
URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com.
|
|
145
|
+
|
|
146
|
+
# customOrgMetadataTemplates
|
|
147
|
+
|
|
148
|
+
A valid repository URL or directory for the custom org metadata templates.
|
|
149
|
+
|
|
150
|
+
# org-custom-metadata-templates
|
|
151
|
+
|
|
152
|
+
A valid repository URL or directory for the custom org metadata templates.
|