@salesforce/core 3.7.1 → 3.7.5
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 +96 -2
- 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 +12 -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 -5
- package/lib/crypto/secureBuffer.js +1 -1
- package/lib/deviceOauthService.js +5 -4
- package/lib/exported.d.ts +2 -2
- package/lib/exported.js +6 -2
- package/lib/globalInfo/globalInfoConfig.js +1 -1
- package/lib/globalInfo/sfdxDataHandler.js +11 -11
- package/lib/lifecycleEvents.d.ts +38 -1
- package/lib/lifecycleEvents.js +73 -2
- package/lib/logger.js +13 -12
- package/lib/messages.js +10 -9
- package/lib/org/authInfo.d.ts +2 -6
- package/lib/org/authInfo.js +44 -41
- package/lib/org/connection.js +14 -11
- package/lib/org/org.d.ts +121 -9
- package/lib/org/org.js +373 -36
- package/lib/org/orgConfigProperties.js +1 -1
- package/lib/org/permissionSetAssignment.js +3 -3
- package/lib/org/user.js +20 -20
- package/lib/schema/printer.js +18 -18
- package/lib/schema/validator.js +8 -8
- package/lib/sfdxError.d.ts +1 -1
- package/lib/sfdxError.js +3 -2
- package/lib/sfdxProject.js +15 -13
- package/lib/status/myDomainResolver.js +3 -3
- package/lib/status/pollingClient.d.ts +0 -1
- package/lib/status/pollingClient.js +2 -2
- package/lib/status/streamingClient.d.ts +2 -3
- package/lib/status/streamingClient.js +16 -22
- package/lib/status/types.d.ts +89 -0
- package/lib/status/types.js +18 -0
- package/lib/testSetup.d.ts +3 -2
- package/lib/testSetup.js +25 -25
- package/lib/util/cache.js +3 -3
- package/lib/util/fs.js +12 -12
- package/lib/util/sfdc.js +3 -3
- package/lib/util/sfdcUrl.d.ts +2 -1
- package/lib/util/sfdcUrl.js +16 -8
- package/lib/webOAuthServer.js +7 -7
- package/messages/core.json +3 -3
- package/messages/core.md +1 -1
- package/messages/envVars.md +53 -13
- package/messages/org.md +36 -0
- package/package.json +39 -46
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]);
|
|
@@ -315,7 +316,7 @@ const _darwinImpl = {
|
|
|
315
316
|
}
|
|
316
317
|
},
|
|
317
318
|
};
|
|
318
|
-
const secretFile = path.join(os_1.homedir(), global_1.Global.SFDX_STATE_FOLDER, 'key.json');
|
|
319
|
+
const secretFile = path.join((0, os_1.homedir)(), global_1.Global.SFDX_STATE_FOLDER, 'key.json');
|
|
319
320
|
var SecretField;
|
|
320
321
|
(function (SecretField) {
|
|
321
322
|
SecretField["SERVICE"] = "service";
|
|
@@ -341,9 +342,9 @@ async function _readFile() {
|
|
|
341
342
|
// The file and access is validated before this method is called
|
|
342
343
|
const fileContents = await fs_1.fs.readJsonMap(secretFile);
|
|
343
344
|
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]),
|
|
345
|
+
account: (0, ts_types_1.ensureString)(fileContents[SecretField.ACCOUNT]),
|
|
346
|
+
password: (0, ts_types_1.asString)(fileContents[SecretField.KEY]),
|
|
347
|
+
service: (0, ts_types_1.ensureString)(fileContents[SecretField.SERVICE]),
|
|
347
348
|
};
|
|
348
349
|
}
|
|
349
350
|
// istanbul ignore next - getPassword/setPassword is always mocked out
|
|
@@ -405,7 +406,7 @@ class GenericKeychainAccess {
|
|
|
405
406
|
}
|
|
406
407
|
async isValidFileAccess(cb) {
|
|
407
408
|
try {
|
|
408
|
-
const root = os_1.homedir();
|
|
409
|
+
const root = (0, os_1.homedir)();
|
|
409
410
|
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
411
|
await cb(null);
|
|
411
412
|
}
|
|
@@ -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 } from './org
|
|
20
|
+
export { Org, SandboxProcessObject, StatusEvent, SandboxEvents, SandboxUserAuthResponse, SandboxUserAuthRequest, SandboxRequest, OrgTypes, ResultEvent, } 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';
|
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.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.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");
|
|
@@ -62,8 +64,10 @@ Object.defineProperty(exports, "LoggerLevel", { enumerable: true, get: function
|
|
|
62
64
|
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
|
63
65
|
var messages_2 = require("./messages");
|
|
64
66
|
Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_2.Messages; } });
|
|
65
|
-
var org_1 = require("./org
|
|
67
|
+
var org_1 = require("./org");
|
|
66
68
|
Object.defineProperty(exports, "Org", { enumerable: true, get: function () { return org_1.Org; } });
|
|
69
|
+
Object.defineProperty(exports, "SandboxEvents", { enumerable: true, get: function () { return org_1.SandboxEvents; } });
|
|
70
|
+
Object.defineProperty(exports, "OrgTypes", { enumerable: true, get: function () { return org_1.OrgTypes; } });
|
|
67
71
|
var orgConfigProperties_1 = require("./org/orgConfigProperties");
|
|
68
72
|
Object.defineProperty(exports, "OrgConfigProperties", { enumerable: true, get: function () { return orgConfigProperties_1.OrgConfigProperties; } });
|
|
69
73
|
Object.defineProperty(exports, "ORG_CONFIG_ALLOWED_PROPERTIES", { enumerable: true, get: function () { return orgConfigProperties_1.ORG_CONFIG_ALLOWED_PROPERTIES; } });
|
|
@@ -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.d.ts
CHANGED
|
@@ -16,16 +16,29 @@ declare type callback = (data: any) => Promise<void>;
|
|
|
16
16
|
*
|
|
17
17
|
* // Deep in the deploy code, fire the event for all libraries and plugins to hear.
|
|
18
18
|
* Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed);
|
|
19
|
+
*
|
|
20
|
+
* // if you don't need to await anything
|
|
21
|
+
* use `void Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed)` ;
|
|
19
22
|
* ```
|
|
20
23
|
*/
|
|
21
24
|
export declare class Lifecycle {
|
|
22
|
-
private debug;
|
|
23
25
|
private readonly listeners;
|
|
26
|
+
static readonly telemetryEventName = "telemetry";
|
|
27
|
+
static readonly warningEventName = "warning";
|
|
28
|
+
private debug;
|
|
24
29
|
private constructor();
|
|
30
|
+
/**
|
|
31
|
+
* return the package.json version of the sfdx-core library.
|
|
32
|
+
*/
|
|
33
|
+
static staticVersion(): string;
|
|
25
34
|
/**
|
|
26
35
|
* Retrieve the singleton instance of this class so that all listeners and emitters can interact from any library or tool
|
|
27
36
|
*/
|
|
28
37
|
static getInstance(): Lifecycle;
|
|
38
|
+
/**
|
|
39
|
+
* return the package.json version of the sfdx-core library.
|
|
40
|
+
*/
|
|
41
|
+
version(): string;
|
|
29
42
|
/**
|
|
30
43
|
* Remove all listeners for a given event
|
|
31
44
|
*
|
|
@@ -38,6 +51,18 @@ export declare class Lifecycle {
|
|
|
38
51
|
* @param eventName The name of the event to get listeners of
|
|
39
52
|
*/
|
|
40
53
|
getListeners(eventName: string): callback[];
|
|
54
|
+
/**
|
|
55
|
+
* Create a listener for the `telemetry` event
|
|
56
|
+
*
|
|
57
|
+
* @param cb The callback function to run when the event is emitted
|
|
58
|
+
*/
|
|
59
|
+
onTelemetry(cb: (data: Record<string, unknown>) => Promise<void>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Create a listener for the `warning` event
|
|
62
|
+
*
|
|
63
|
+
* @param cb The callback function to run when the event is emitted
|
|
64
|
+
*/
|
|
65
|
+
onWarning(cb: (warning: string) => Promise<void>): void;
|
|
41
66
|
/**
|
|
42
67
|
* Create a new listener for a given event
|
|
43
68
|
*
|
|
@@ -45,6 +70,18 @@ export declare class Lifecycle {
|
|
|
45
70
|
* @param cb The callback function to run when the event is emitted
|
|
46
71
|
*/
|
|
47
72
|
on<T = AnyJson>(eventName: string, cb: (data: T) => Promise<void>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Emit a `telemetry` event, causing all callback functions to be run in the order they were registered
|
|
75
|
+
*
|
|
76
|
+
* @param data The data to emit
|
|
77
|
+
*/
|
|
78
|
+
emitTelemetry(data: AnyJson): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Emit a `warning` event, causing all callback functions to be run in the order they were registered
|
|
81
|
+
*
|
|
82
|
+
* @param data The warning (string) to emit
|
|
83
|
+
*/
|
|
84
|
+
emitWarning(warning: string): Promise<void>;
|
|
48
85
|
/**
|
|
49
86
|
* Emit a given event, causing all callback functions to be run in the order they were registered
|
|
50
87
|
*
|
package/lib/lifecycleEvents.js
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Lifecycle = void 0;
|
|
10
10
|
const Debug = require("debug");
|
|
11
|
+
const semver_1 = require("semver");
|
|
12
|
+
// needed for TS to not put everything inside /lib/src
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
const pjson = require("../package.json");
|
|
11
15
|
/**
|
|
12
16
|
* An asynchronous event listener and emitter that follows the singleton pattern. The singleton pattern allows lifecycle
|
|
13
17
|
* events to be emitted from deep within a library and still be consumed by any other library or tool. It allows other
|
|
@@ -24,12 +28,21 @@ const Debug = require("debug");
|
|
|
24
28
|
*
|
|
25
29
|
* // Deep in the deploy code, fire the event for all libraries and plugins to hear.
|
|
26
30
|
* Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed);
|
|
31
|
+
*
|
|
32
|
+
* // if you don't need to await anything
|
|
33
|
+
* use `void Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed)` ;
|
|
27
34
|
* ```
|
|
28
35
|
*/
|
|
29
36
|
class Lifecycle {
|
|
30
|
-
constructor() {
|
|
37
|
+
constructor(listeners = {}) {
|
|
38
|
+
this.listeners = listeners;
|
|
31
39
|
this.debug = Debug(`sfdx:${this.constructor.name}`);
|
|
32
|
-
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* return the package.json version of the sfdx-core library.
|
|
43
|
+
*/
|
|
44
|
+
static staticVersion() {
|
|
45
|
+
return pjson.version;
|
|
33
46
|
}
|
|
34
47
|
/**
|
|
35
48
|
* Retrieve the singleton instance of this class so that all listeners and emitters can interact from any library or tool
|
|
@@ -52,10 +65,29 @@ class Lifecycle {
|
|
|
52
65
|
//
|
|
53
66
|
// Nothing should EVER be removed, even across major versions.
|
|
54
67
|
if (!global.salesforceCoreLifecycle) {
|
|
68
|
+
// it's not been loaded yet (basic singleton pattern)
|
|
55
69
|
global.salesforceCoreLifecycle = new Lifecycle();
|
|
56
70
|
}
|
|
71
|
+
else if (
|
|
72
|
+
// an older version was loaded that should be replaced
|
|
73
|
+
(0, semver_1.compare)(global.salesforceCoreLifecycle.version(), Lifecycle.staticVersion()) === -1) {
|
|
74
|
+
const oldInstance = global.salesforceCoreLifecycle;
|
|
75
|
+
// use the newer version and transfer any listeners from the old version
|
|
76
|
+
// object spread keeps them from being references
|
|
77
|
+
global.salesforceCoreLifecycle = new Lifecycle({ ...oldInstance.listeners });
|
|
78
|
+
// clean up any listeners on the old version
|
|
79
|
+
Object.keys(oldInstance.listeners).map((eventName) => {
|
|
80
|
+
oldInstance.removeAllListeners(eventName);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
57
83
|
return global.salesforceCoreLifecycle;
|
|
58
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* return the package.json version of the sfdx-core library.
|
|
87
|
+
*/
|
|
88
|
+
version() {
|
|
89
|
+
return pjson.version;
|
|
90
|
+
}
|
|
59
91
|
/**
|
|
60
92
|
* Remove all listeners for a given event
|
|
61
93
|
*
|
|
@@ -79,6 +111,22 @@ class Lifecycle {
|
|
|
79
111
|
return [];
|
|
80
112
|
}
|
|
81
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Create a listener for the `telemetry` event
|
|
116
|
+
*
|
|
117
|
+
* @param cb The callback function to run when the event is emitted
|
|
118
|
+
*/
|
|
119
|
+
onTelemetry(cb) {
|
|
120
|
+
this.on(Lifecycle.telemetryEventName, cb);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Create a listener for the `warning` event
|
|
124
|
+
*
|
|
125
|
+
* @param cb The callback function to run when the event is emitted
|
|
126
|
+
*/
|
|
127
|
+
onWarning(cb) {
|
|
128
|
+
this.on(Lifecycle.warningEventName, cb);
|
|
129
|
+
}
|
|
82
130
|
/**
|
|
83
131
|
* Create a new listener for a given event
|
|
84
132
|
*
|
|
@@ -93,6 +141,27 @@ class Lifecycle {
|
|
|
93
141
|
listeners.push(cb);
|
|
94
142
|
this.listeners[eventName] = listeners;
|
|
95
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Emit a `telemetry` event, causing all callback functions to be run in the order they were registered
|
|
146
|
+
*
|
|
147
|
+
* @param data The data to emit
|
|
148
|
+
*/
|
|
149
|
+
async emitTelemetry(data) {
|
|
150
|
+
return this.emit(Lifecycle.telemetryEventName, data);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Emit a `warning` event, causing all callback functions to be run in the order they were registered
|
|
154
|
+
*
|
|
155
|
+
* @param data The warning (string) to emit
|
|
156
|
+
*/
|
|
157
|
+
async emitWarning(warning) {
|
|
158
|
+
// if there are no listeners, warnings should go to the node process so they're not lost
|
|
159
|
+
// this also preserves behavior in UT where there's a spy on process.emitWarning
|
|
160
|
+
if (this.getListeners(Lifecycle.warningEventName).length === 0) {
|
|
161
|
+
process.emitWarning(warning);
|
|
162
|
+
}
|
|
163
|
+
return this.emit(Lifecycle.warningEventName, warning);
|
|
164
|
+
}
|
|
96
165
|
/**
|
|
97
166
|
* Emit a given event, causing all callback functions to be run in the order they were registered
|
|
98
167
|
*
|
|
@@ -112,4 +181,6 @@ class Lifecycle {
|
|
|
112
181
|
}
|
|
113
182
|
}
|
|
114
183
|
exports.Lifecycle = Lifecycle;
|
|
184
|
+
Lifecycle.telemetryEventName = 'telemetry';
|
|
185
|
+
Lifecycle.warningEventName = 'warning';
|
|
115
186
|
//# sourceMappingURL=lifecycleEvents.js.map
|
package/lib/logger.js
CHANGED
|
@@ -204,7 +204,7 @@ class Logger {
|
|
|
204
204
|
*/
|
|
205
205
|
static getLevelByName(levelName) {
|
|
206
206
|
levelName = levelName.toUpperCase();
|
|
207
|
-
if (!ts_types_1.isKeyOf(LoggerLevel, levelName)) {
|
|
207
|
+
if (!(0, ts_types_1.isKeyOf)(LoggerLevel, levelName)) {
|
|
208
208
|
throw new sfdxError_1.SfdxError(`Invalid log level "${levelName}".`, 'UnrecognizedLoggerLevelNameError');
|
|
209
209
|
}
|
|
210
210
|
return LoggerLevel[levelName];
|
|
@@ -344,6 +344,7 @@ class Logger {
|
|
|
344
344
|
/**
|
|
345
345
|
* Gets the underlying Bunyan logger.
|
|
346
346
|
*/
|
|
347
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
347
348
|
getBunyanLogger() {
|
|
348
349
|
return this.bunyan;
|
|
349
350
|
}
|
|
@@ -433,7 +434,7 @@ class Logger {
|
|
|
433
434
|
}
|
|
434
435
|
// close file streams, flush buffer to disk
|
|
435
436
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
436
|
-
if (entry.type === 'file' && entry.stream && ts_types_1.isFunction(entry.stream.end)) {
|
|
437
|
+
if (entry.type === 'file' && entry.stream && (0, ts_types_1.isFunction)(entry.stream.end)) {
|
|
437
438
|
entry.stream.end();
|
|
438
439
|
}
|
|
439
440
|
});
|
|
@@ -500,7 +501,7 @@ class Logger {
|
|
|
500
501
|
debugCallback(cb) {
|
|
501
502
|
if (this.getLevel() === LoggerLevel.DEBUG || process.env.DEBUG) {
|
|
502
503
|
const result = cb();
|
|
503
|
-
if (ts_types_1.isArray(result)) {
|
|
504
|
+
if ((0, ts_types_1.isArray)(result)) {
|
|
504
505
|
this.bunyan.debug(this.applyFilters(LoggerLevel.DEBUG, ...result));
|
|
505
506
|
}
|
|
506
507
|
else {
|
|
@@ -561,18 +562,18 @@ class Logger {
|
|
|
561
562
|
stream: new stream_1.Writable({
|
|
562
563
|
write: (chunk, encoding, next) => {
|
|
563
564
|
try {
|
|
564
|
-
const json = kit_1.parseJsonMap(chunk.toString());
|
|
565
|
-
const logLevel = ts_types_1.ensureNumber(json.level);
|
|
565
|
+
const json = (0, kit_1.parseJsonMap)(chunk.toString());
|
|
566
|
+
const logLevel = (0, ts_types_1.ensureNumber)(json.level);
|
|
566
567
|
if (this.getLevel() <= logLevel) {
|
|
567
568
|
let debuggerName = 'core';
|
|
568
|
-
if (ts_types_1.isString(json.log)) {
|
|
569
|
+
if ((0, ts_types_1.isString)(json.log)) {
|
|
569
570
|
debuggerName = json.log;
|
|
570
571
|
if (!debuggers[debuggerName]) {
|
|
571
572
|
debuggers[debuggerName] = Debug(`${this.getName()}:${debuggerName}`);
|
|
572
573
|
}
|
|
573
574
|
}
|
|
574
575
|
const level = LoggerLevel[logLevel];
|
|
575
|
-
ts_types_1.ensure(debuggers[debuggerName])(`${level} ${json.msg}`);
|
|
576
|
+
(0, ts_types_1.ensure)(debuggers[debuggerName])(`${level} ${json.msg}`);
|
|
576
577
|
}
|
|
577
578
|
}
|
|
578
579
|
catch (err) {
|
|
@@ -664,7 +665,7 @@ const FILTERED_KEYS = [
|
|
|
664
665
|
// SFDX code and plugins should never show tokens or connect app information in the logs
|
|
665
666
|
const _filter = (...args) => {
|
|
666
667
|
return args.map((arg) => {
|
|
667
|
-
if (ts_types_1.isArray(arg)) {
|
|
668
|
+
if ((0, ts_types_1.isArray)(arg)) {
|
|
668
669
|
return _filter(...arg);
|
|
669
670
|
}
|
|
670
671
|
if (arg) {
|
|
@@ -673,10 +674,10 @@ const _filter = (...args) => {
|
|
|
673
674
|
if (arg instanceof Buffer) {
|
|
674
675
|
_arg = '<Buffer>';
|
|
675
676
|
}
|
|
676
|
-
else if (ts_types_1.isObject(arg)) {
|
|
677
|
+
else if ((0, ts_types_1.isObject)(arg)) {
|
|
677
678
|
_arg = JSON.stringify(arg);
|
|
678
679
|
}
|
|
679
|
-
else if (ts_types_1.isString(arg)) {
|
|
680
|
+
else if ((0, ts_types_1.isString)(arg)) {
|
|
680
681
|
_arg = arg;
|
|
681
682
|
}
|
|
682
683
|
else {
|
|
@@ -687,7 +688,7 @@ const _filter = (...args) => {
|
|
|
687
688
|
let expElement = key;
|
|
688
689
|
let expName = key;
|
|
689
690
|
// Filtered keys can be strings or objects containing regular expression components.
|
|
690
|
-
if (ts_types_1.isPlainObject(key)) {
|
|
691
|
+
if ((0, ts_types_1.isPlainObject)(key)) {
|
|
691
692
|
expElement = key.regex;
|
|
692
693
|
expName = key.name;
|
|
693
694
|
}
|
|
@@ -701,7 +702,7 @@ const _filter = (...args) => {
|
|
|
701
702
|
});
|
|
702
703
|
_arg = _arg.replace(/(00D\w{12,15})![.\w]*/, `<${HIDDEN}>`);
|
|
703
704
|
// return an object if an object was logged; otherwise return the filtered string.
|
|
704
|
-
return ts_types_1.isObject(arg) ? kit_1.parseJson(_arg) : _arg;
|
|
705
|
+
return (0, ts_types_1.isObject)(arg) ? (0, kit_1.parseJson)(_arg) : _arg;
|
|
705
706
|
}
|
|
706
707
|
else {
|
|
707
708
|
return arg;
|
package/lib/messages.js
CHANGED
|
@@ -67,16 +67,17 @@ const jsAndJsonLoader = (filePath, fileContents) => {
|
|
|
67
67
|
let json;
|
|
68
68
|
try {
|
|
69
69
|
json = JSON.parse(fileContents);
|
|
70
|
-
if (!ts_types_1.isObject(json)) {
|
|
70
|
+
if (!(0, ts_types_1.isObject)(json)) {
|
|
71
71
|
// Bubble up
|
|
72
72
|
throw new Error(`Unexpected token. Found returned content type '${typeof json}'.`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
76
|
// Provide a nicer error message for a common JSON parse error; Unexpected token
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
parseError
|
|
77
|
+
const error = err;
|
|
78
|
+
if (error.message.startsWith('Unexpected token')) {
|
|
79
|
+
const parseError = new Error(`Invalid JSON content in message file: ${filePath}\n${error.message}`);
|
|
80
|
+
parseError.name = error.name;
|
|
80
81
|
throw parseError;
|
|
81
82
|
}
|
|
82
83
|
throw err;
|
|
@@ -275,7 +276,7 @@ class Messages {
|
|
|
275
276
|
if (!packageName) {
|
|
276
277
|
const errMessage = `Invalid or missing package.json file at '${moduleMessagesDirPath}'. If not using a package.json, pass in a packageName.`;
|
|
277
278
|
try {
|
|
278
|
-
packageName = ts_types_1.asString(ts_types_1.ensureJsonMap(Messages.readFile(path.join(moduleMessagesDirPath, 'package.json'))).name);
|
|
279
|
+
packageName = (0, ts_types_1.asString)((0, ts_types_1.ensureJsonMap)(Messages.readFile(path.join(moduleMessagesDirPath, 'package.json'))).name);
|
|
279
280
|
if (!packageName) {
|
|
280
281
|
throw new kit_1.NamedError('MissingPackageName', errMessage);
|
|
281
282
|
}
|
|
@@ -446,7 +447,7 @@ class Messages {
|
|
|
446
447
|
// 'myMessageError' -> `MyMessageError`
|
|
447
448
|
// 'error.myMessage' -> `MyMessageError`
|
|
448
449
|
// 'errors.myMessage' -> `MyMessageError`
|
|
449
|
-
const errName = `${kit_1.upperFirst(key.replace(/^errors*\./, ''))}${/Error$/.exec(key) ? '' : 'Error'}`;
|
|
450
|
+
const errName = `${(0, kit_1.upperFirst)(key.replace(/^errors*\./, ''))}${/Error$/.exec(key) ? '' : 'Error'}`;
|
|
450
451
|
const errMessage = this.getMessage(key, tokens);
|
|
451
452
|
let errActions;
|
|
452
453
|
try {
|
|
@@ -464,7 +465,7 @@ class Messages {
|
|
|
464
465
|
const parentKey = group[1];
|
|
465
466
|
const childKey = group[2];
|
|
466
467
|
const childObject = map.get(parentKey);
|
|
467
|
-
if (childObject && ts_types_1.isJsonMap(childObject)) {
|
|
468
|
+
if (childObject && (0, ts_types_1.isJsonMap)(childObject)) {
|
|
468
469
|
const childMap = new Map(Object.entries(childObject));
|
|
469
470
|
return this.getMessageWithMap(childKey, tokens, childMap);
|
|
470
471
|
}
|
|
@@ -474,9 +475,9 @@ class Messages {
|
|
|
474
475
|
throw new kit_1.NamedError('MissingMessageError', `Missing message ${this.bundleName}:${key} for locale ${Messages.getLocale()}.`);
|
|
475
476
|
}
|
|
476
477
|
const msg = map.get(key);
|
|
477
|
-
const messages = (ts_types_1.isArray(msg) ? msg : [msg]);
|
|
478
|
+
const messages = ((0, ts_types_1.isArray)(msg) ? msg : [msg]);
|
|
478
479
|
return messages.map((message) => {
|
|
479
|
-
ts_types_1.ensureString(message);
|
|
480
|
+
(0, ts_types_1.ensureString)(message);
|
|
480
481
|
return util.format(message, ...tokens);
|
|
481
482
|
});
|
|
482
483
|
}
|