@salesforce/core 9.1.0 → 9.1.2
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/lib/logger/logger.d.ts +2 -2
- package/lib/logger/logger.js +3 -3
- package/lib/sfProject.js +10 -8
- package/lib/util/sfdcUrl.js +11 -10
- package/package.json +1 -1
package/lib/logger/logger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger as PinoLogger,
|
|
1
|
+
import { type Logger as PinoLogger, type TransportSingleOptions } from 'pino';
|
|
2
2
|
/**
|
|
3
3
|
* The common set of `Logger` options.
|
|
4
4
|
*/
|
|
@@ -259,5 +259,5 @@ export declare class Logger {
|
|
|
259
259
|
fatal(...args: unknown[]): Logger;
|
|
260
260
|
}
|
|
261
261
|
/** return various streams that the logger could send data to, depending on the options and env */
|
|
262
|
-
export declare const getWriteStream: (level?: string) =>
|
|
262
|
+
export declare const getWriteStream: (level?: string) => TransportSingleOptions;
|
|
263
263
|
export declare const computeLevel: (optionsLevel?: number | string) => string;
|
package/lib/logger/logger.js
CHANGED
|
@@ -452,12 +452,12 @@ const levelFromOption = (value) => {
|
|
|
452
452
|
case 'string':
|
|
453
453
|
return value;
|
|
454
454
|
default:
|
|
455
|
-
return pino_1.
|
|
455
|
+
return pino_1.levels.labels[Logger.DEFAULT_LEVEL];
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
// /** match a number to a pino level, or if a match isn't found, the next highest level */
|
|
459
|
-
const numberToLevel = (level) => pino_1.
|
|
460
|
-
Object.entries(pino_1.
|
|
459
|
+
const numberToLevel = (level) => pino_1.levels.labels[level] ??
|
|
460
|
+
Object.entries(pino_1.levels.labels).find(([value]) => Number(value) > level)?.[1] ??
|
|
461
461
|
'warn';
|
|
462
462
|
const getDefaultLevel = () => {
|
|
463
463
|
const logLevelFromEnvVar = new kit_1.Env().getString('SF_LOG_LEVEL');
|
package/lib/sfProject.js
CHANGED
|
@@ -668,27 +668,27 @@ class SfProject {
|
|
|
668
668
|
configAggregator_1.ConfigAggregator.create(),
|
|
669
669
|
]);
|
|
670
670
|
await Promise.all([global.read(), local.read()]);
|
|
671
|
-
|
|
671
|
+
const config = (0, kit_1.defaults)(local.toObject(), global.toObject());
|
|
672
672
|
// Add fields in sfdx-config.json
|
|
673
|
-
Object.assign(
|
|
673
|
+
Object.assign(config, configAggregator.getConfig());
|
|
674
674
|
// we don't have a login url yet, so use instanceUrl from config or default
|
|
675
675
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
676
|
-
if (!
|
|
676
|
+
if (!config.sfdcLoginUrl) {
|
|
677
677
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
678
|
-
|
|
678
|
+
config.sfdcLoginUrl = configAggregator.getConfig()['org-instance-url'] ?? sfdcUrl_1.SfdcUrl.PRODUCTION;
|
|
679
679
|
}
|
|
680
680
|
// LEGACY - Allow override of sfdcLoginUrl via env var FORCE_SFDC_LOGIN_URL
|
|
681
681
|
if (process.env.FORCE_SFDC_LOGIN_URL) {
|
|
682
682
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
683
|
-
|
|
683
|
+
config.sfdcLoginUrl = process.env.FORCE_SFDC_LOGIN_URL;
|
|
684
684
|
}
|
|
685
685
|
// Allow override of signupTargetLoginUrl via env var SFDX_SCRATCH_ORG_CREATION_LOGIN_URL
|
|
686
686
|
if (process.env.SFDX_SCRATCH_ORG_CREATION_LOGIN_URL) {
|
|
687
687
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
688
|
-
|
|
688
|
+
config.signupTargetLoginUrl = process.env.SFDX_SCRATCH_ORG_CREATION_LOGIN_URL;
|
|
689
689
|
}
|
|
690
690
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
691
|
-
const loginUrl =
|
|
691
|
+
const loginUrl = config.sfdcLoginUrl;
|
|
692
692
|
if (loginUrl) {
|
|
693
693
|
if (!sfdcUrl_1.SfdcUrl.isValidUrl(loginUrl) ||
|
|
694
694
|
(!new sfdcUrl_1.SfdcUrl(loginUrl).isSalesforceDomain() && !new sfdcUrl_1.SfdcUrl(loginUrl).isInternalUrl())) {
|
|
@@ -696,13 +696,15 @@ class SfProject {
|
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
699
|
-
const signupUrl =
|
|
699
|
+
const signupUrl = config.signupTargetLoginUrl;
|
|
700
700
|
if (signupUrl) {
|
|
701
701
|
if (!sfdcUrl_1.SfdcUrl.isValidUrl(signupUrl) ||
|
|
702
702
|
(!new sfdcUrl_1.SfdcUrl(signupUrl).isSalesforceDomain() && !new sfdcUrl_1.SfdcUrl(signupUrl).isInternalUrl())) {
|
|
703
703
|
throw messages.createError('invalidProjectLoginUrl', [signupUrl]);
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
+
// Only cache after validation passes
|
|
707
|
+
this.projectConfig = config;
|
|
706
708
|
}
|
|
707
709
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
708
710
|
return this.projectConfig;
|
package/lib/util/sfdcUrl.js
CHANGED
|
@@ -108,7 +108,7 @@ class SfdcUrl extends node_url_1.URL {
|
|
|
108
108
|
'.salesforce.com',
|
|
109
109
|
'.salesforceliveagent.com',
|
|
110
110
|
'.secure.force.com',
|
|
111
|
-
'crmforce.mil',
|
|
111
|
+
'.crmforce.mil',
|
|
112
112
|
'.sfcrmproducts.cn',
|
|
113
113
|
];
|
|
114
114
|
const allowlistOfSalesforceHosts = ['developer.salesforce.com', 'trailhead.salesforce.com'];
|
|
@@ -120,19 +120,20 @@ class SfdcUrl extends node_url_1.URL {
|
|
|
120
120
|
* @returns {boolean} true if this is an internal domain
|
|
121
121
|
*/
|
|
122
122
|
isInternalUrl() {
|
|
123
|
-
const
|
|
124
|
-
'.vpod.',
|
|
125
|
-
'
|
|
126
|
-
'stm.
|
|
123
|
+
const INTERNAL_SFDC_SUFFIXES = [
|
|
124
|
+
'.vpod.salesforce.com',
|
|
125
|
+
'.vpod.force.com',
|
|
126
|
+
'.stm.salesforce.com',
|
|
127
|
+
'.stm.force.com',
|
|
127
128
|
'.blitz.salesforce.com',
|
|
128
129
|
'.stm.salesforce.ms',
|
|
129
130
|
'.pc-rnd.force.com',
|
|
130
131
|
'.pc-rnd.salesforce.com',
|
|
131
|
-
'.crm.dev',
|
|
132
|
+
'.crm.dev',
|
|
132
133
|
];
|
|
133
|
-
return (this.
|
|
134
|
+
return (this.hostname === 'gs1.salesforce.com' ||
|
|
134
135
|
this.isLocalUrl() ||
|
|
135
|
-
|
|
136
|
+
INTERNAL_SFDC_SUFFIXES.some((suffix) => this.hostname.endsWith(suffix)));
|
|
136
137
|
}
|
|
137
138
|
/**
|
|
138
139
|
* Tests whether this url runs on a local machine
|
|
@@ -140,8 +141,8 @@ class SfdcUrl extends node_url_1.URL {
|
|
|
140
141
|
* @returns {boolean} true if this is a local machine
|
|
141
142
|
*/
|
|
142
143
|
isLocalUrl() {
|
|
143
|
-
const
|
|
144
|
-
return
|
|
144
|
+
const LOCAL_SFDC_SUFFIXES = ['.localhost.sfdcdev.salesforce.com', '.internal.salesforce.com'];
|
|
145
|
+
return LOCAL_SFDC_SUFFIXES.some((suffix) => this.hostname.endsWith(suffix));
|
|
145
146
|
}
|
|
146
147
|
toLightningDomain() {
|
|
147
148
|
if (this.origin.endsWith('.my.salesforce.mil')) {
|