@salesforce/core 3.13.0 → 3.13.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 +6 -0
- package/lib/config/config.js +4 -2
- package/lib/globalInfo/sfdxDataHandler.js +17 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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.13.1](https://github.com/forcedotcom/sfdx-core/compare/v3.13.0...v3.13.1) (2022-04-21)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- log rotation errors ([#564](https://github.com/forcedotcom/sfdx-core/issues/564)) ([8a4c9de](https://github.com/forcedotcom/sfdx-core/commit/8a4c9de85840ae0efa0ee8a27494d63a61545da5))
|
|
10
|
+
|
|
5
11
|
## [3.13.0](https://github.com/forcedotcom/sfdx-core/compare/v3.12.2...v3.13.0) (2022-04-20)
|
|
6
12
|
|
|
7
13
|
### Features
|
package/lib/config/config.js
CHANGED
|
@@ -42,7 +42,6 @@ const messages = messages_1.Messages.load('@salesforce/core', 'config', [
|
|
|
42
42
|
'instanceUrl',
|
|
43
43
|
'disable-telemetry',
|
|
44
44
|
]);
|
|
45
|
-
const log = logger_1.Logger.childFromRoot('core:config');
|
|
46
45
|
const SFDX_CONFIG_FILE_NAME = 'sfdx-config.json';
|
|
47
46
|
const CONFIG_FILE_NAME = 'config.json';
|
|
48
47
|
var SfConfigProperties;
|
|
@@ -277,9 +276,12 @@ class Config extends configFile_1.ConfigFile {
|
|
|
277
276
|
*/
|
|
278
277
|
static addAllowedProperties(metas) {
|
|
279
278
|
const currentMetaKeys = Object.keys(Config.propertyConfigMap());
|
|
279
|
+
// If logger is needed elsewhere in this file, do not move this outside of the Config class.
|
|
280
|
+
// It was causing issues with Bunyan log rotation. See https://github.com/forcedotcom/sfdx-core/pull/562
|
|
281
|
+
const logger = logger_1.Logger.childFromRoot('core:config');
|
|
280
282
|
metas.forEach((meta) => {
|
|
281
283
|
if (currentMetaKeys.includes(meta.key)) {
|
|
282
|
-
|
|
284
|
+
logger.info(`Key ${meta.key} already exists in allowedProperties, skipping.`);
|
|
283
285
|
return;
|
|
284
286
|
}
|
|
285
287
|
Config.allowedProperties.push(meta);
|
|
@@ -31,10 +31,8 @@ class SfdxDataHandler {
|
|
|
31
31
|
this.handlers = [new AuthHandler(), new AliasesHandler()];
|
|
32
32
|
}
|
|
33
33
|
async write(latest = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.setOriginal(latest);
|
|
37
|
-
}
|
|
34
|
+
await Promise.all(this.handlers.map((handler) => handler.write(latest, this.original)));
|
|
35
|
+
this.setOriginal(latest);
|
|
38
36
|
}
|
|
39
37
|
async merge(sfData = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
|
|
40
38
|
let merged = (0, globalInfoConfig_1.deepCopy)(sfData);
|
|
@@ -103,17 +101,17 @@ class AuthHandler extends BaseHandler {
|
|
|
103
101
|
}
|
|
104
102
|
async write(latest, original) {
|
|
105
103
|
const { changed, deleted } = await this.findChanges(latest, original);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
config.setContentsFromObject(authData);
|
|
110
|
-
await config.write();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
for (const username of deleted) {
|
|
104
|
+
await Promise.all(Object.entries(changed)
|
|
105
|
+
.filter(([, authData]) => authData)
|
|
106
|
+
.map(async ([username, authData]) => {
|
|
114
107
|
const config = await this.createAuthFileConfig(username);
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
config.setContentsFromObject(authData);
|
|
109
|
+
return config.write();
|
|
110
|
+
}));
|
|
111
|
+
await Promise.all(deleted.map(async (username) => {
|
|
112
|
+
const config = await this.createAuthFileConfig(username);
|
|
113
|
+
return config.unlink();
|
|
114
|
+
}));
|
|
117
115
|
}
|
|
118
116
|
async findChanges(latest, original) {
|
|
119
117
|
var _a;
|
|
@@ -146,16 +144,14 @@ class AuthHandler extends BaseHandler {
|
|
|
146
144
|
}
|
|
147
145
|
async listAllAuthorizations() {
|
|
148
146
|
const filenames = await this.listAllAuthFiles();
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
return Promise.all(filenames
|
|
148
|
+
.map((f) => (0, path_1.basename)(f, (0, path_1.extname)(f)))
|
|
149
|
+
.map(async (username) => {
|
|
152
150
|
const configFile = await this.createAuthFileConfig(username);
|
|
153
151
|
const contents = configFile.getContents();
|
|
154
152
|
const stat = await configFile.stat();
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
return auths;
|
|
153
|
+
return { ...contents, timestamp: stat.mtime.toISOString() };
|
|
154
|
+
}));
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
157
|
exports.AuthHandler = AuthHandler;
|