@salesforce/core 3.7.3 → 3.7.6
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 +223 -0
- package/LICENSE.txt +1 -1
- package/lib/config/config.js +15 -15
- package/lib/config/configAggregator.js +4 -4
- package/lib/config/configFile.js +9 -9
- package/lib/config/configStore.js +14 -13
- package/lib/config/envVars.d.ts +20 -5
- package/lib/config/envVars.js +75 -10
- package/lib/config/keychainConfig.js +1 -1
- package/lib/crypto/crypto.js +6 -6
- package/lib/crypto/keyChainImpl.js +6 -6
- package/lib/crypto/secureBuffer.js +1 -1
- package/lib/deviceOauthService.js +5 -4
- package/lib/exported.d.ts +4 -2
- package/lib/exported.js +5 -1
- package/lib/globalInfo/globalInfoConfig.js +1 -1
- package/lib/globalInfo/sfdxDataHandler.js +11 -11
- package/lib/lifecycleEvents.js +2 -2
- package/lib/logger.js +12 -13
- package/lib/messages.js +10 -9
- package/lib/org/authInfo.js +45 -43
- package/lib/org/connection.d.ts +6 -1
- package/lib/org/connection.js +22 -8
- package/lib/org/org.d.ts +12 -2
- package/lib/org/org.js +62 -56
- package/lib/org/orgConfigProperties.js +1 -1
- package/lib/org/permissionSetAssignment.js +3 -3
- package/lib/org/scratchOrgCreate.d.ts +43 -0
- package/lib/org/scratchOrgCreate.js +142 -0
- package/lib/org/scratchOrgErrorCodes.d.ts +4 -0
- package/lib/org/scratchOrgErrorCodes.js +62 -0
- package/lib/org/scratchOrgFeatureDeprecation.d.ts +26 -0
- package/lib/org/scratchOrgFeatureDeprecation.js +110 -0
- package/lib/org/scratchOrgInfoApi.d.ts +94 -0
- package/lib/org/scratchOrgInfoApi.js +350 -0
- package/lib/org/scratchOrgInfoGenerator.d.ts +63 -0
- package/lib/org/scratchOrgInfoGenerator.js +223 -0
- package/lib/org/scratchOrgSettingsGenerator.d.ts +56 -0
- package/lib/org/scratchOrgSettingsGenerator.js +210 -0
- package/lib/org/user.js +24 -23
- package/lib/schema/printer.js +18 -18
- package/lib/schema/validator.js +8 -8
- package/lib/sfdxError.js +2 -2
- package/lib/sfdxProject.js +15 -13
- package/lib/status/myDomainResolver.js +3 -3
- package/lib/status/pollingClient.d.ts +2 -2
- package/lib/status/pollingClient.js +10 -4
- package/lib/status/streamingClient.d.ts +1 -1
- package/lib/status/streamingClient.js +6 -6
- package/lib/testSetup.js +21 -21
- package/lib/util/cache.js +3 -3
- package/lib/util/fs.js +12 -12
- package/lib/util/jsonXmlTools.d.ts +14 -0
- package/lib/util/jsonXmlTools.js +41 -0
- package/lib/util/mapKeys.d.ts +14 -0
- package/lib/util/mapKeys.js +48 -0
- package/lib/util/sfdc.js +3 -3
- package/lib/util/sfdcUrl.js +3 -3
- package/lib/util/zipWriter.d.ts +14 -0
- package/lib/util/zipWriter.js +68 -0
- package/lib/webOAuthServer.js +8 -8
- package/messages/envVars.md +53 -13
- package/messages/org.md +4 -0
- package/messages/scratchOrgCreate.md +27 -0
- package/messages/scratchOrgErrorCodes.md +99 -0
- package/messages/scratchOrgFeatureDeprecation.md +11 -0
- package/messages/scratchOrgInfoApi.md +11 -0
- package/messages/scratchOrgInfoGenerator.md +19 -0
- package/messages/user.md +4 -0
- package/package.json +33 -30
package/lib/config/envVars.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = void 0;
|
|
3
|
+
exports.envVars = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
6
|
* All rights reserved.
|
|
@@ -12,7 +12,7 @@ const change_case_1 = require("change-case");
|
|
|
12
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
13
|
const messages_1 = require("../messages");
|
|
14
14
|
const global_1 = require("../global");
|
|
15
|
-
messages_1.Messages.importMessagesDirectory(path_1.join(__dirname));
|
|
15
|
+
messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
|
|
16
16
|
const messages = messages_1.Messages.loadMessages('@salesforce/core', 'envVars');
|
|
17
17
|
var EnvironmentVariable;
|
|
18
18
|
(function (EnvironmentVariable) {
|
|
@@ -50,6 +50,11 @@ var EnvironmentVariable;
|
|
|
50
50
|
EnvironmentVariable["SFDX_SOURCE_MEMBER_POLLING_TIMEOUT"] = "SFDX_SOURCE_MEMBER_POLLING_TIMEOUT";
|
|
51
51
|
EnvironmentVariable["SFDX_USE_GENERIC_UNIX_KEYCHAIN"] = "SFDX_USE_GENERIC_UNIX_KEYCHAIN";
|
|
52
52
|
EnvironmentVariable["SFDX_USE_PROGRESS_BAR"] = "SFDX_USE_PROGRESS_BAR";
|
|
53
|
+
EnvironmentVariable["SFDX_LAZY_LOAD_MODULES"] = "SFDX_LAZY_LOAD_MODULES";
|
|
54
|
+
EnvironmentVariable["SFDX_S3_HOST"] = "SFDX_S3_HOST";
|
|
55
|
+
EnvironmentVariable["SFDX_UPDATE_INSTRUCTIONS"] = "SFDX_UPDATE_INSTRUCTIONS";
|
|
56
|
+
EnvironmentVariable["SFDX_INSTALLER"] = "SFDX_INSTALLER";
|
|
57
|
+
EnvironmentVariable["SFDX_ENV"] = "SFDX_ENV";
|
|
53
58
|
EnvironmentVariable["SF_TARGET_ORG"] = "SF_TARGET_ORG";
|
|
54
59
|
EnvironmentVariable["SF_TARGET_DEV_HUB"] = "SF_TARGET_DEV_HUB";
|
|
55
60
|
EnvironmentVariable["SF_ACCESS_TOKEN"] = "SF_ACCESS_TOKEN";
|
|
@@ -76,8 +81,13 @@ var EnvironmentVariable;
|
|
|
76
81
|
EnvironmentVariable["SF_SOURCE_MEMBER_POLLING_TIMEOUT"] = "SF_SOURCE_MEMBER_POLLING_TIMEOUT";
|
|
77
82
|
EnvironmentVariable["SF_USE_GENERIC_UNIX_KEYCHAIN"] = "SF_USE_GENERIC_UNIX_KEYCHAIN";
|
|
78
83
|
EnvironmentVariable["SF_USE_PROGRESS_BAR"] = "SF_USE_PROGRESS_BAR";
|
|
84
|
+
EnvironmentVariable["SF_LAZY_LOAD_MODULES"] = "SF_LAZY_LOAD_MODULES";
|
|
85
|
+
EnvironmentVariable["SF_S3_HOST"] = "SF_S3_HOST";
|
|
86
|
+
EnvironmentVariable["SF_UPDATE_INSTRUCTIONS"] = "SF_UPDATE_INSTRUCTIONS";
|
|
87
|
+
EnvironmentVariable["SF_INSTALLER"] = "SF_INSTALLER";
|
|
88
|
+
EnvironmentVariable["SF_ENV"] = "SF_ENV";
|
|
79
89
|
})(EnvironmentVariable = exports.EnvironmentVariable || (exports.EnvironmentVariable = {}));
|
|
80
|
-
const getMessage = (environmentVariable) => messages.getMessage(change_case_1.camelCase(environmentVariable));
|
|
90
|
+
const getMessage = (environmentVariable) => messages.getMessage((0, change_case_1.camelCase)(environmentVariable));
|
|
81
91
|
exports.SUPPORTED_ENV_VARS = {
|
|
82
92
|
[EnvironmentVariable.FORCE_SHOW_SPINNER]: {
|
|
83
93
|
description: getMessage(EnvironmentVariable.FORCE_SHOW_SPINNER),
|
|
@@ -197,7 +207,7 @@ exports.SUPPORTED_ENV_VARS = {
|
|
|
197
207
|
synonymOf: EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE,
|
|
198
208
|
},
|
|
199
209
|
[EnvironmentVariable.SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE]: {
|
|
200
|
-
description: messages.getMessage(change_case_1.camelCase(EnvironmentVariable.SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
|
|
210
|
+
description: messages.getMessage((0, change_case_1.camelCase)(EnvironmentVariable.SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
|
|
201
211
|
synonymOf: EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE,
|
|
202
212
|
},
|
|
203
213
|
[EnvironmentVariable.SFDX_REST_DEPLOY]: {
|
|
@@ -216,6 +226,26 @@ exports.SUPPORTED_ENV_VARS = {
|
|
|
216
226
|
description: getMessage(EnvironmentVariable.SFDX_USE_PROGRESS_BAR),
|
|
217
227
|
synonymOf: EnvironmentVariable.SF_USE_PROGRESS_BAR,
|
|
218
228
|
},
|
|
229
|
+
[EnvironmentVariable.SFDX_LAZY_LOAD_MODULES]: {
|
|
230
|
+
description: getMessage(EnvironmentVariable.SFDX_USE_PROGRESS_BAR),
|
|
231
|
+
synonymOf: EnvironmentVariable.SF_LAZY_LOAD_MODULES,
|
|
232
|
+
},
|
|
233
|
+
[EnvironmentVariable.SFDX_S3_HOST]: {
|
|
234
|
+
description: getMessage(EnvironmentVariable.SFDX_S3_HOST),
|
|
235
|
+
synonymOf: EnvironmentVariable.SF_S3_HOST,
|
|
236
|
+
},
|
|
237
|
+
[EnvironmentVariable.SFDX_UPDATE_INSTRUCTIONS]: {
|
|
238
|
+
description: getMessage(EnvironmentVariable.SFDX_UPDATE_INSTRUCTIONS),
|
|
239
|
+
synonymOf: null,
|
|
240
|
+
},
|
|
241
|
+
[EnvironmentVariable.SFDX_INSTALLER]: {
|
|
242
|
+
description: getMessage(EnvironmentVariable.SFDX_INSTALLER),
|
|
243
|
+
synonymOf: null,
|
|
244
|
+
},
|
|
245
|
+
[EnvironmentVariable.SFDX_ENV]: {
|
|
246
|
+
description: getMessage(EnvironmentVariable.SFDX_ENV),
|
|
247
|
+
synonymOf: null,
|
|
248
|
+
},
|
|
219
249
|
[EnvironmentVariable.SF_TARGET_ORG]: {
|
|
220
250
|
description: getMessage(EnvironmentVariable.SF_TARGET_ORG),
|
|
221
251
|
synonymOf: null,
|
|
@@ -306,7 +336,7 @@ exports.SUPPORTED_ENV_VARS = {
|
|
|
306
336
|
synonymOf: null,
|
|
307
337
|
},
|
|
308
338
|
[EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE]: {
|
|
309
|
-
description: messages.getMessage(change_case_1.camelCase(EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
|
|
339
|
+
description: messages.getMessage((0, change_case_1.camelCase)(EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
|
|
310
340
|
synonymOf: null,
|
|
311
341
|
},
|
|
312
342
|
[EnvironmentVariable.SF_SOURCE_MEMBER_POLLING_TIMEOUT]: {
|
|
@@ -321,22 +351,53 @@ exports.SUPPORTED_ENV_VARS = {
|
|
|
321
351
|
description: getMessage(EnvironmentVariable.SF_USE_PROGRESS_BAR),
|
|
322
352
|
synonymOf: null,
|
|
323
353
|
},
|
|
354
|
+
[EnvironmentVariable.SF_LAZY_LOAD_MODULES]: {
|
|
355
|
+
description: getMessage(EnvironmentVariable.SF_LAZY_LOAD_MODULES),
|
|
356
|
+
synonymOf: null,
|
|
357
|
+
},
|
|
358
|
+
[EnvironmentVariable.SF_S3_HOST]: {
|
|
359
|
+
description: getMessage(EnvironmentVariable.SF_S3_HOST),
|
|
360
|
+
synonymOf: null,
|
|
361
|
+
},
|
|
362
|
+
[EnvironmentVariable.SF_UPDATE_INSTRUCTIONS]: {
|
|
363
|
+
description: getMessage(EnvironmentVariable.SF_UPDATE_INSTRUCTIONS),
|
|
364
|
+
synonymOf: null,
|
|
365
|
+
},
|
|
366
|
+
[EnvironmentVariable.SF_INSTALLER]: {
|
|
367
|
+
description: getMessage(EnvironmentVariable.SF_INSTALLER),
|
|
368
|
+
synonymOf: null,
|
|
369
|
+
},
|
|
370
|
+
[EnvironmentVariable.SF_ENV]: {
|
|
371
|
+
description: getMessage(EnvironmentVariable.SF_ENV),
|
|
372
|
+
synonymOf: null,
|
|
373
|
+
},
|
|
324
374
|
};
|
|
325
375
|
class EnvVars extends kit_1.Env {
|
|
326
|
-
constructor() {
|
|
327
|
-
super();
|
|
376
|
+
constructor(env = process.env) {
|
|
377
|
+
super(env);
|
|
328
378
|
this.resolve();
|
|
329
379
|
}
|
|
330
|
-
|
|
331
|
-
|
|
380
|
+
static defaultPrefix() {
|
|
381
|
+
if (process.argv[0].startsWith('sfdx'))
|
|
382
|
+
return 'SFDX_';
|
|
383
|
+
if (process.argv[0].startsWith('sf'))
|
|
384
|
+
return 'SF_';
|
|
385
|
+
return 'SFDX_';
|
|
386
|
+
}
|
|
387
|
+
propertyToEnvName(property, prefix = EnvVars.defaultPrefix()) {
|
|
388
|
+
return `${prefix || ''}${(0, change_case_1.snakeCase)(property).toUpperCase()}`;
|
|
332
389
|
}
|
|
333
|
-
setPropertyFromEnv(property, prefix =
|
|
390
|
+
setPropertyFromEnv(property, prefix = EnvVars.defaultPrefix()) {
|
|
334
391
|
const envName = this.propertyToEnvName(property, prefix);
|
|
335
392
|
const value = this.getString(envName);
|
|
336
393
|
if (value) {
|
|
337
394
|
this.setString(property, value);
|
|
338
395
|
}
|
|
339
396
|
}
|
|
397
|
+
getPropertyFromEnv(property, prefix = EnvVars.defaultPrefix()) {
|
|
398
|
+
const envName = this.propertyToEnvName(property, prefix);
|
|
399
|
+
return this.get(envName);
|
|
400
|
+
}
|
|
340
401
|
asDictionary() {
|
|
341
402
|
return this.entries().reduce((accumulator, [key, value]) => {
|
|
342
403
|
accumulator[key] = value;
|
|
@@ -363,6 +424,10 @@ class EnvVars extends kit_1.Env {
|
|
|
363
424
|
}
|
|
364
425
|
});
|
|
365
426
|
}
|
|
427
|
+
get(envName) {
|
|
428
|
+
return this.asDictionary()[envName];
|
|
429
|
+
}
|
|
366
430
|
}
|
|
367
431
|
exports.EnvVars = EnvVars;
|
|
432
|
+
exports.envVars = new EnvVars();
|
|
368
433
|
//# sourceMappingURL=envVars.js.map
|
|
@@ -34,7 +34,7 @@ class KeychainConfig extends configFile_1.ConfigFile {
|
|
|
34
34
|
if (newContents != null) {
|
|
35
35
|
this.setContents(newContents);
|
|
36
36
|
}
|
|
37
|
-
await fs_1.fs.mkdirp(path_1.dirname(this.getPath()));
|
|
37
|
+
await fs_1.fs.mkdirp((0, path_1.dirname)(this.getPath()));
|
|
38
38
|
await fs_1.fs.writeFile(this.getPath(), JSON.stringify(this.getContents(), null, 4), { mode: '600' });
|
|
39
39
|
return this.getContents();
|
|
40
40
|
}
|
package/lib/crypto/crypto.js
CHANGED
|
@@ -25,7 +25,7 @@ const AUTH_TAG_LENGTH = 32;
|
|
|
25
25
|
const ENCRYPTED_CHARS = /[a-f0-9]/;
|
|
26
26
|
const KEY_NAME = 'sfdx';
|
|
27
27
|
const ACCOUNT = 'local';
|
|
28
|
-
messages_1.Messages.importMessagesDirectory(path_1.join(__dirname));
|
|
28
|
+
messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
|
|
29
29
|
const messages = messages_1.Messages.load('@salesforce/core', 'encryption', [
|
|
30
30
|
'keychainPasswordCreationError',
|
|
31
31
|
'invalidEncryptedFormatError',
|
|
@@ -34,7 +34,7 @@ const messages = messages_1.Messages.load('@salesforce/core', 'encryption', [
|
|
|
34
34
|
]);
|
|
35
35
|
const makeSecureBuffer = (password) => {
|
|
36
36
|
const newSb = new secureBuffer_1.SecureBuffer();
|
|
37
|
-
newSb.consume(Buffer.from(ts_types_1.ensure(password), 'utf8'));
|
|
37
|
+
newSb.consume(Buffer.from((0, ts_types_1.ensure)(password), 'utf8'));
|
|
38
38
|
return newSb;
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
@@ -56,7 +56,7 @@ const keychainPromises = {
|
|
|
56
56
|
if (err)
|
|
57
57
|
return reject(err);
|
|
58
58
|
cache_1.Cache.set(`${service}:${account}`, makeSecureBuffer(password));
|
|
59
|
-
return resolve({ username: account, password: ts_types_1.ensure(password) });
|
|
59
|
+
return resolve({ username: account, password: (0, ts_types_1.ensure)(password) });
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -64,7 +64,7 @@ const keychainPromises = {
|
|
|
64
64
|
const pw = sb.value((buffer) => buffer.toString('utf8'));
|
|
65
65
|
cache_1.Cache.set(`${service}:${account}`, makeSecureBuffer(pw));
|
|
66
66
|
return new Promise((resolve) => {
|
|
67
|
-
return resolve({ username: account, password: ts_types_1.ensure(pw) });
|
|
67
|
+
return resolve({ username: account, password: (0, ts_types_1.ensure)(pw) });
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
},
|
|
@@ -203,7 +203,7 @@ class Crypto extends kit_1.AsyncOptionalCreatable {
|
|
|
203
203
|
}
|
|
204
204
|
const key = crypto.randomBytes(Math.ceil(16)).toString('hex');
|
|
205
205
|
// Create a new password in the KeyChain.
|
|
206
|
-
await keychainPromises.setPassword(ts_types_1.ensure(this.options.keychain), KEY_NAME, ACCOUNT, key);
|
|
206
|
+
await keychainPromises.setPassword((0, ts_types_1.ensure)(this.options.keychain), KEY_NAME, ACCOUNT, key);
|
|
207
207
|
return this.init();
|
|
208
208
|
}
|
|
209
209
|
else {
|
|
@@ -213,7 +213,7 @@ class Crypto extends kit_1.AsyncOptionalCreatable {
|
|
|
213
213
|
}
|
|
214
214
|
async getKeyChain(platform) {
|
|
215
215
|
if (!this.options.keychain) {
|
|
216
|
-
this.options.keychain = await keyChain_1.retrieveKeychain(platform);
|
|
216
|
+
this.options.keychain = await (0, keyChain_1.retrieveKeychain)(platform);
|
|
217
217
|
}
|
|
218
218
|
return this.options.keychain;
|
|
219
219
|
}
|
|
@@ -135,6 +135,7 @@ class KeychainAccess {
|
|
|
135
135
|
return await this.osImpl.onGetCommandClose(code, stdout, stderr, opts, fn);
|
|
136
136
|
}
|
|
137
137
|
catch (e) {
|
|
138
|
+
// @ts-ignore
|
|
138
139
|
if (e.retry) {
|
|
139
140
|
if (retryCount >= GET_PASSWORD_RETRY_COUNT) {
|
|
140
141
|
throw messages.createError('passwordRetryError', [GET_PASSWORD_RETRY_COUNT]);
|
|
@@ -215,7 +216,6 @@ const _linuxImpl = {
|
|
|
215
216
|
// This is a workaround for linux.
|
|
216
217
|
// Calling secret-tool too fast can cause it to return an unexpected error. (below)
|
|
217
218
|
if (stderr != null && stderr.includes('invalid or unencryptable secret')) {
|
|
218
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
219
219
|
// @ts-ignore TODO: make an error subclass with this field
|
|
220
220
|
error.retry = true;
|
|
221
221
|
// Throwing here allows us to perform a retry in KeychainAccess
|
|
@@ -315,7 +315,7 @@ const _darwinImpl = {
|
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
317
|
};
|
|
318
|
-
const secretFile = path.join(os_1.homedir(), global_1.Global.SFDX_STATE_FOLDER, 'key.json');
|
|
318
|
+
const secretFile = path.join((0, os_1.homedir)(), global_1.Global.SFDX_STATE_FOLDER, 'key.json');
|
|
319
319
|
var SecretField;
|
|
320
320
|
(function (SecretField) {
|
|
321
321
|
SecretField["SERVICE"] = "service";
|
|
@@ -341,9 +341,9 @@ async function _readFile() {
|
|
|
341
341
|
// The file and access is validated before this method is called
|
|
342
342
|
const fileContents = await fs_1.fs.readJsonMap(secretFile);
|
|
343
343
|
return {
|
|
344
|
-
account: ts_types_1.ensureString(fileContents[SecretField.ACCOUNT]),
|
|
345
|
-
password: ts_types_1.asString(fileContents[SecretField.KEY]),
|
|
346
|
-
service: ts_types_1.ensureString(fileContents[SecretField.SERVICE]),
|
|
344
|
+
account: (0, ts_types_1.ensureString)(fileContents[SecretField.ACCOUNT]),
|
|
345
|
+
password: (0, ts_types_1.asString)(fileContents[SecretField.KEY]),
|
|
346
|
+
service: (0, ts_types_1.ensureString)(fileContents[SecretField.SERVICE]),
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
349
|
// istanbul ignore next - getPassword/setPassword is always mocked out
|
|
@@ -405,7 +405,7 @@ class GenericKeychainAccess {
|
|
|
405
405
|
}
|
|
406
406
|
async isValidFileAccess(cb) {
|
|
407
407
|
try {
|
|
408
|
-
const root = os_1.homedir();
|
|
408
|
+
const root = (0, os_1.homedir)();
|
|
409
409
|
await fs_1.fs.access(path.join(root, global_1.Global.SFDX_STATE_FOLDER), fs_1.fs.constants.R_OK | fs_1.fs.constants.X_OK | fs_1.fs.constants.W_OK);
|
|
410
410
|
await cb(null);
|
|
411
411
|
}
|
|
@@ -40,7 +40,7 @@ class SecureBuffer {
|
|
|
40
40
|
value(cb) {
|
|
41
41
|
if (cb) {
|
|
42
42
|
const cipher = crypto.createDecipheriv(cipherName, this.key, this.iv);
|
|
43
|
-
const a = cipher.update(ts_types_1.ensure(this.secret));
|
|
43
|
+
const a = cipher.update((0, ts_types_1.ensure)(this.secret));
|
|
44
44
|
const b = cipher.final();
|
|
45
45
|
const c = Buffer.concat([a, b]);
|
|
46
46
|
try {
|
|
@@ -27,7 +27,7 @@ async function wait(ms = 1000) {
|
|
|
27
27
|
}
|
|
28
28
|
async function makeRequest(options) {
|
|
29
29
|
const rawResponse = await new transport_1.default().httpRequest(options);
|
|
30
|
-
const response = kit_1.parseJsonMap(rawResponse.body);
|
|
30
|
+
const response = (0, kit_1.parseJsonMap)(rawResponse.body);
|
|
31
31
|
if (response.error) {
|
|
32
32
|
const err = new sfdxError_1.SfdxError('Request Failed.');
|
|
33
33
|
err.data = Object.assign(response, { status: rawResponse.statusCode });
|
|
@@ -109,7 +109,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
109
109
|
}
|
|
110
110
|
getLoginOptions(url) {
|
|
111
111
|
const body = new url_1.URLSearchParams();
|
|
112
|
-
body.append('client_id', ts_types_1.ensureString(this.options.clientId));
|
|
112
|
+
body.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
|
|
113
113
|
body.append('response_type', DeviceOauthService.RESPONSE_TYPE);
|
|
114
114
|
body.append('scope', DeviceOauthService.SCOPE);
|
|
115
115
|
return {
|
|
@@ -121,7 +121,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
121
121
|
}
|
|
122
122
|
getPollingOptions(url, code) {
|
|
123
123
|
const body = new url_1.URLSearchParams();
|
|
124
|
-
body.append('client_id', ts_types_1.ensureString(this.options.clientId));
|
|
124
|
+
body.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
|
|
125
125
|
body.append('grant_type', DeviceOauthService.GRANT_TYPE);
|
|
126
126
|
body.append('code', code);
|
|
127
127
|
return {
|
|
@@ -132,7 +132,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
getDeviceFlowRequestUrl() {
|
|
135
|
-
return `${ts_types_1.ensureString(this.options.loginUrl)}/services/oauth2/token`;
|
|
135
|
+
return `${(0, ts_types_1.ensureString)(this.options.loginUrl)}/services/oauth2/token`;
|
|
136
136
|
}
|
|
137
137
|
async poll(httpRequest) {
|
|
138
138
|
this.logger.debug(`polling for device approval (attempt ${this.pollingCount} of ${DeviceOauthService.POLLING_COUNT_MAX})`);
|
|
@@ -140,6 +140,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
140
140
|
return await makeRequest(httpRequest);
|
|
141
141
|
}
|
|
142
142
|
catch (e) {
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
144
|
const err = e.data;
|
|
144
145
|
if (err.error && err.status === 400 && err.error === 'authorization_pending') {
|
|
145
146
|
// do nothing because we're still waiting
|
package/lib/exported.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { OAuth2Config } from 'jsforce';
|
|
2
2
|
export { ConfigFile } from './config/configFile';
|
|
3
|
-
export { EnvironmentVariable, SUPPORTED_ENV_VARS } from './config/envVars';
|
|
3
|
+
export { envVars, EnvironmentVariable, SUPPORTED_ENV_VARS, EnvVars } from './config/envVars';
|
|
4
4
|
export { BaseConfigStore, ConfigContents, ConfigEntry, ConfigStore, ConfigValue } from './config/configStore';
|
|
5
5
|
export { GlobalInfo, SfEntry, SfInfo, SfInfoKeys, SfOrg, SfOrgs, SfToken, SfTokens } from './globalInfo';
|
|
6
6
|
export { DeviceOauthService, DeviceCodeResponse, DeviceCodePollingResponse } from './deviceOauthService';
|
|
@@ -17,7 +17,7 @@ export { SfdcUrl } from './util/sfdcUrl';
|
|
|
17
17
|
export { getJwtAudienceUrl } from './util/getJwtAudienceUrl';
|
|
18
18
|
export { Fields, FieldValue, LoggerLevel, LoggerLevelValue, LogLine, LoggerOptions, LoggerStream, Logger, } from './logger';
|
|
19
19
|
export { Messages } from './messages';
|
|
20
|
-
export { Org, SandboxProcessObject, StatusEvent, SandboxEvents, SandboxUserAuthResponse, SandboxUserAuthRequest, SandboxRequest, OrgTypes, ResultEvent, } from './org';
|
|
20
|
+
export { Org, SandboxProcessObject, StatusEvent, SandboxEvents, SandboxUserAuthResponse, SandboxUserAuthRequest, SandboxRequest, OrgTypes, ResultEvent, ScratchOrgRequest, } from './org';
|
|
21
21
|
export { OrgConfigProperties, ORG_CONFIG_ALLOWED_PROPERTIES } from './org/orgConfigProperties';
|
|
22
22
|
export { PackageDir, NamedPackageDir, PackageDirDependency, SfdxProject, SfdxProjectJson } from './sfdxProject';
|
|
23
23
|
export { SchemaPrinter } from './schema/printer';
|
|
@@ -28,6 +28,8 @@ export { CometClient, CometSubscription, StreamingClient, StatusResult } from '.
|
|
|
28
28
|
export { MyDomainResolver } from './status/myDomainResolver';
|
|
29
29
|
export { DefaultUserFields, REQUIRED_FIELDS, User, UserFields } from './org/user';
|
|
30
30
|
export { PermissionSetAssignment, PermissionSetAssignmentFields } from './org/permissionSetAssignment';
|
|
31
|
+
export { ScratchOrgCreateOptions, ScratchOrgCreateResult, scratchOrgCreate } from './org/scratchOrgCreate';
|
|
32
|
+
export { ScratchOrgInfo } from './org/scratchOrgInfoApi';
|
|
31
33
|
export * from './util/fs';
|
|
32
34
|
export * from './util/sfdc';
|
|
33
35
|
export * from './util/sfdcUrl';
|
package/lib/exported.js
CHANGED
|
@@ -16,14 +16,16 @@ 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.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.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;
|
|
19
|
+
exports.scratchOrgCreate = 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.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.ConfigAggregator = exports.SFDX_ALLOWED_PROPERTIES = 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.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");
|
|
23
23
|
Object.defineProperty(exports, "ConfigFile", { enumerable: true, get: function () { return configFile_1.ConfigFile; } });
|
|
24
24
|
var envVars_1 = require("./config/envVars");
|
|
25
|
+
Object.defineProperty(exports, "envVars", { enumerable: true, get: function () { return envVars_1.envVars; } });
|
|
25
26
|
Object.defineProperty(exports, "EnvironmentVariable", { enumerable: true, get: function () { return envVars_1.EnvironmentVariable; } });
|
|
26
27
|
Object.defineProperty(exports, "SUPPORTED_ENV_VARS", { enumerable: true, get: function () { return envVars_1.SUPPORTED_ENV_VARS; } });
|
|
28
|
+
Object.defineProperty(exports, "EnvVars", { enumerable: true, get: function () { return envVars_1.EnvVars; } });
|
|
27
29
|
var configStore_1 = require("./config/configStore");
|
|
28
30
|
Object.defineProperty(exports, "BaseConfigStore", { enumerable: true, get: function () { return configStore_1.BaseConfigStore; } });
|
|
29
31
|
var globalInfo_1 = require("./globalInfo");
|
|
@@ -91,6 +93,8 @@ Object.defineProperty(exports, "REQUIRED_FIELDS", { enumerable: true, get: funct
|
|
|
91
93
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_1.User; } });
|
|
92
94
|
var permissionSetAssignment_1 = require("./org/permissionSetAssignment");
|
|
93
95
|
Object.defineProperty(exports, "PermissionSetAssignment", { enumerable: true, get: function () { return permissionSetAssignment_1.PermissionSetAssignment; } });
|
|
96
|
+
var scratchOrgCreate_1 = require("./org/scratchOrgCreate");
|
|
97
|
+
Object.defineProperty(exports, "scratchOrgCreate", { enumerable: true, get: function () { return scratchOrgCreate_1.scratchOrgCreate; } });
|
|
94
98
|
// Utility sub-modules
|
|
95
99
|
__exportStar(require("./util/fs"), exports);
|
|
96
100
|
__exportStar(require("./util/sfdc"), exports);
|
|
@@ -65,7 +65,7 @@ class GlobalInfo extends configFile_1.ConfigFile {
|
|
|
65
65
|
return new aliasAccessor_1.AliasAccessor(this);
|
|
66
66
|
}
|
|
67
67
|
set(key, value) {
|
|
68
|
-
if (ts_types_1.isPlainObject(value)) {
|
|
68
|
+
if ((0, ts_types_1.isPlainObject)(value)) {
|
|
69
69
|
value = this.timestamp(value);
|
|
70
70
|
}
|
|
71
71
|
super.set(key, value);
|
|
@@ -37,7 +37,7 @@ class SfdxDataHandler {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
async merge(sfData = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
|
|
40
|
-
let merged = globalInfoConfig_1.deepCopy(sfData);
|
|
40
|
+
let merged = (0, globalInfoConfig_1.deepCopy)(sfData);
|
|
41
41
|
for (const handler of this.handlers) {
|
|
42
42
|
merged = Object.assign(merged, await handler.merge(merged));
|
|
43
43
|
}
|
|
@@ -45,7 +45,7 @@ class SfdxDataHandler {
|
|
|
45
45
|
return merged;
|
|
46
46
|
}
|
|
47
47
|
setOriginal(data) {
|
|
48
|
-
this.original = globalInfoConfig_1.deepCopy(data);
|
|
48
|
+
this.original = (0, globalInfoConfig_1.deepCopy)(data);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.SfdxDataHandler = SfdxDataHandler;
|
|
@@ -53,7 +53,7 @@ class BaseHandler {
|
|
|
53
53
|
async merge(sfData = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
|
|
54
54
|
var _a, _b;
|
|
55
55
|
const sfdxData = await this.migrate();
|
|
56
|
-
const merged = globalInfoConfig_1.deepCopy(sfData);
|
|
56
|
+
const merged = (0, globalInfoConfig_1.deepCopy)(sfData);
|
|
57
57
|
// Only merge the key this handler is responsible for.
|
|
58
58
|
const key = this.sfKey;
|
|
59
59
|
const sfKeys = Object.keys((_a = sfData[key]) !== null && _a !== void 0 ? _a : {});
|
|
@@ -61,11 +61,11 @@ class BaseHandler {
|
|
|
61
61
|
const commonKeys = sfKeys.filter((k) => sfdxKeys.includes(k));
|
|
62
62
|
for (const k of commonKeys) {
|
|
63
63
|
const [newer, older] = [sfData[key][k], sfdxData[key][k]].sort((a, b) => {
|
|
64
|
-
if (ts_types_1.isPlainObject(a) && ts_types_1.isPlainObject(b))
|
|
64
|
+
if ((0, ts_types_1.isPlainObject)(a) && (0, ts_types_1.isPlainObject)(b))
|
|
65
65
|
return new Date(a.timestamp) < new Date(b.timestamp) ? 1 : -1;
|
|
66
66
|
return 0;
|
|
67
67
|
});
|
|
68
|
-
kit_1.set(merged, `${key}["${k}"]`, Object.assign({}, older, newer));
|
|
68
|
+
(0, kit_1.set)(merged, `${key}["${k}"]`, Object.assign({}, older, newer));
|
|
69
69
|
}
|
|
70
70
|
// Keys that exist in .sfdx but not .sf are added becase we assume
|
|
71
71
|
// that this means the key was created using sfdx.
|
|
@@ -78,7 +78,7 @@ class BaseHandler {
|
|
|
78
78
|
// assume that we should migrate any keys that exist in in .sfdx
|
|
79
79
|
const unhandledSfdxKeys = sfdxKeys.filter((k) => !sfKeys.includes(k));
|
|
80
80
|
for (const k of unhandledSfdxKeys) {
|
|
81
|
-
kit_1.set(merged, `${key}["${k}"]`, sfdxData[key][k]);
|
|
81
|
+
(0, kit_1.set)(merged, `${key}["${k}"]`, sfdxData[key][k]);
|
|
82
82
|
}
|
|
83
83
|
// Keys that exist in .sf but not .sfdx are deleted because we assume
|
|
84
84
|
// that this means the key was deleted while using sfdx.
|
|
@@ -98,7 +98,7 @@ class AuthHandler extends BaseHandler {
|
|
|
98
98
|
}
|
|
99
99
|
async migrate() {
|
|
100
100
|
const oldAuths = await this.listAllAuthorizations();
|
|
101
|
-
const newAuths = oldAuths.reduce((x, y) => Object.assign(x, { [ts_types_1.ensureString(y.username)]: y }), {});
|
|
101
|
+
const newAuths = oldAuths.reduce((x, y) => Object.assign(x, { [(0, ts_types_1.ensureString)(y.username)]: y }), {});
|
|
102
102
|
return { [this.sfKey]: newAuths };
|
|
103
103
|
}
|
|
104
104
|
async write(latest, original) {
|
|
@@ -148,7 +148,7 @@ class AuthHandler extends BaseHandler {
|
|
|
148
148
|
const filenames = await this.listAllAuthFiles();
|
|
149
149
|
const auths = [];
|
|
150
150
|
for (const filename of filenames) {
|
|
151
|
-
const username = path_1.basename(filename, path_1.extname(filename));
|
|
151
|
+
const username = (0, path_1.basename)(filename, (0, path_1.extname)(filename));
|
|
152
152
|
const configFile = await this.createAuthFileConfig(username);
|
|
153
153
|
const contents = configFile.getContents();
|
|
154
154
|
const stat = await configFile.stat();
|
|
@@ -167,7 +167,7 @@ class AliasesHandler extends BaseHandler {
|
|
|
167
167
|
this.sfKey = types_1.SfInfoKeys.ALIASES;
|
|
168
168
|
}
|
|
169
169
|
async migrate() {
|
|
170
|
-
const aliasesFilePath = path_1.join(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
|
|
170
|
+
const aliasesFilePath = (0, path_1.join)(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
|
|
171
171
|
try {
|
|
172
172
|
const sfdxAliases = (await fs_1.fs.readJson(aliasesFilePath)).orgs;
|
|
173
173
|
return { [this.sfKey]: { ...sfdxAliases } };
|
|
@@ -179,7 +179,7 @@ class AliasesHandler extends BaseHandler {
|
|
|
179
179
|
// AliasesHandler implements its own merge method because the structure of aliases is flat instead of nested by SfInfoKey types.
|
|
180
180
|
async merge(sfData = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
|
|
181
181
|
const sfdxAliases = (await this.migrate())[types_1.SfInfoKeys.ALIASES];
|
|
182
|
-
const merged = globalInfoConfig_1.deepCopy(sfData);
|
|
182
|
+
const merged = (0, globalInfoConfig_1.deepCopy)(sfData);
|
|
183
183
|
/* Overwrite `sf` aliases with `sfdx` aliases
|
|
184
184
|
* `sf` will always modify `sfdx` files but `sfdx` won't modify `sf` files
|
|
185
185
|
* because of this we can assume that any changes in `sfdx` files that aren't
|
|
@@ -208,7 +208,7 @@ class AliasesHandler extends BaseHandler {
|
|
|
208
208
|
return merged;
|
|
209
209
|
}
|
|
210
210
|
async write(latest) {
|
|
211
|
-
const aliasesFilePath = path_1.join(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
|
|
211
|
+
const aliasesFilePath = (0, path_1.join)(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
|
|
212
212
|
fs_1.fs.writeJson(aliasesFilePath, { orgs: latest[types_1.SfInfoKeys.ALIASES] });
|
|
213
213
|
}
|
|
214
214
|
}
|
package/lib/lifecycleEvents.js
CHANGED
|
@@ -70,7 +70,7 @@ class Lifecycle {
|
|
|
70
70
|
}
|
|
71
71
|
else if (
|
|
72
72
|
// an older version was loaded that should be replaced
|
|
73
|
-
semver_1.compare(global.salesforceCoreLifecycle.version(), Lifecycle.staticVersion()) === -1) {
|
|
73
|
+
(0, semver_1.compare)(global.salesforceCoreLifecycle.version(), Lifecycle.staticVersion()) === -1) {
|
|
74
74
|
const oldInstance = global.salesforceCoreLifecycle;
|
|
75
75
|
// use the newer version and transfer any listeners from the old version
|
|
76
76
|
// object spread keeps them from being references
|
|
@@ -170,7 +170,7 @@ class Lifecycle {
|
|
|
170
170
|
*/
|
|
171
171
|
async emit(eventName, data) {
|
|
172
172
|
const listeners = this.getListeners(eventName);
|
|
173
|
-
if (listeners.length === 0) {
|
|
173
|
+
if (listeners.length === 0 && eventName !== Lifecycle.warningEventName) {
|
|
174
174
|
this.debug(`A lifecycle event with the name ${eventName} does not exist. An event must be registered before it can be emitted.`);
|
|
175
175
|
}
|
|
176
176
|
else {
|
package/lib/logger.js
CHANGED
|
@@ -11,7 +11,6 @@ const events_1 = require("events");
|
|
|
11
11
|
const os = require("os");
|
|
12
12
|
const path = require("path");
|
|
13
13
|
const stream_1 = require("stream");
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
14
|
// @ts-ignore
|
|
16
15
|
const Bunyan = require("@salesforce/bunyan");
|
|
17
16
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -204,7 +203,7 @@ class Logger {
|
|
|
204
203
|
*/
|
|
205
204
|
static getLevelByName(levelName) {
|
|
206
205
|
levelName = levelName.toUpperCase();
|
|
207
|
-
if (!ts_types_1.isKeyOf(LoggerLevel, levelName)) {
|
|
206
|
+
if (!(0, ts_types_1.isKeyOf)(LoggerLevel, levelName)) {
|
|
208
207
|
throw new sfdxError_1.SfdxError(`Invalid log level "${levelName}".`, 'UnrecognizedLoggerLevelNameError');
|
|
209
208
|
}
|
|
210
209
|
return LoggerLevel[levelName];
|
|
@@ -434,7 +433,7 @@ class Logger {
|
|
|
434
433
|
}
|
|
435
434
|
// close file streams, flush buffer to disk
|
|
436
435
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
437
|
-
if (entry.type === 'file' && entry.stream && ts_types_1.isFunction(entry.stream.end)) {
|
|
436
|
+
if (entry.type === 'file' && entry.stream && (0, ts_types_1.isFunction)(entry.stream.end)) {
|
|
438
437
|
entry.stream.end();
|
|
439
438
|
}
|
|
440
439
|
});
|
|
@@ -501,7 +500,7 @@ class Logger {
|
|
|
501
500
|
debugCallback(cb) {
|
|
502
501
|
if (this.getLevel() === LoggerLevel.DEBUG || process.env.DEBUG) {
|
|
503
502
|
const result = cb();
|
|
504
|
-
if (ts_types_1.isArray(result)) {
|
|
503
|
+
if ((0, ts_types_1.isArray)(result)) {
|
|
505
504
|
this.bunyan.debug(this.applyFilters(LoggerLevel.DEBUG, ...result));
|
|
506
505
|
}
|
|
507
506
|
else {
|
|
@@ -562,18 +561,18 @@ class Logger {
|
|
|
562
561
|
stream: new stream_1.Writable({
|
|
563
562
|
write: (chunk, encoding, next) => {
|
|
564
563
|
try {
|
|
565
|
-
const json = kit_1.parseJsonMap(chunk.toString());
|
|
566
|
-
const logLevel = ts_types_1.ensureNumber(json.level);
|
|
564
|
+
const json = (0, kit_1.parseJsonMap)(chunk.toString());
|
|
565
|
+
const logLevel = (0, ts_types_1.ensureNumber)(json.level);
|
|
567
566
|
if (this.getLevel() <= logLevel) {
|
|
568
567
|
let debuggerName = 'core';
|
|
569
|
-
if (ts_types_1.isString(json.log)) {
|
|
568
|
+
if ((0, ts_types_1.isString)(json.log)) {
|
|
570
569
|
debuggerName = json.log;
|
|
571
570
|
if (!debuggers[debuggerName]) {
|
|
572
571
|
debuggers[debuggerName] = Debug(`${this.getName()}:${debuggerName}`);
|
|
573
572
|
}
|
|
574
573
|
}
|
|
575
574
|
const level = LoggerLevel[logLevel];
|
|
576
|
-
ts_types_1.ensure(debuggers[debuggerName])(`${level} ${json.msg}`);
|
|
575
|
+
(0, ts_types_1.ensure)(debuggers[debuggerName])(`${level} ${json.msg}`);
|
|
577
576
|
}
|
|
578
577
|
}
|
|
579
578
|
catch (err) {
|
|
@@ -665,7 +664,7 @@ const FILTERED_KEYS = [
|
|
|
665
664
|
// SFDX code and plugins should never show tokens or connect app information in the logs
|
|
666
665
|
const _filter = (...args) => {
|
|
667
666
|
return args.map((arg) => {
|
|
668
|
-
if (ts_types_1.isArray(arg)) {
|
|
667
|
+
if ((0, ts_types_1.isArray)(arg)) {
|
|
669
668
|
return _filter(...arg);
|
|
670
669
|
}
|
|
671
670
|
if (arg) {
|
|
@@ -674,10 +673,10 @@ const _filter = (...args) => {
|
|
|
674
673
|
if (arg instanceof Buffer) {
|
|
675
674
|
_arg = '<Buffer>';
|
|
676
675
|
}
|
|
677
|
-
else if (ts_types_1.isObject(arg)) {
|
|
676
|
+
else if ((0, ts_types_1.isObject)(arg)) {
|
|
678
677
|
_arg = JSON.stringify(arg);
|
|
679
678
|
}
|
|
680
|
-
else if (ts_types_1.isString(arg)) {
|
|
679
|
+
else if ((0, ts_types_1.isString)(arg)) {
|
|
681
680
|
_arg = arg;
|
|
682
681
|
}
|
|
683
682
|
else {
|
|
@@ -688,7 +687,7 @@ const _filter = (...args) => {
|
|
|
688
687
|
let expElement = key;
|
|
689
688
|
let expName = key;
|
|
690
689
|
// Filtered keys can be strings or objects containing regular expression components.
|
|
691
|
-
if (ts_types_1.isPlainObject(key)) {
|
|
690
|
+
if ((0, ts_types_1.isPlainObject)(key)) {
|
|
692
691
|
expElement = key.regex;
|
|
693
692
|
expName = key.name;
|
|
694
693
|
}
|
|
@@ -702,7 +701,7 @@ const _filter = (...args) => {
|
|
|
702
701
|
});
|
|
703
702
|
_arg = _arg.replace(/(00D\w{12,15})![.\w]*/, `<${HIDDEN}>`);
|
|
704
703
|
// return an object if an object was logged; otherwise return the filtered string.
|
|
705
|
-
return ts_types_1.isObject(arg) ? kit_1.parseJson(_arg) : _arg;
|
|
704
|
+
return (0, ts_types_1.isObject)(arg) ? (0, kit_1.parseJson)(_arg) : _arg;
|
|
706
705
|
}
|
|
707
706
|
else {
|
|
708
707
|
return arg;
|