@salesforce/core 4.0.0 → 4.1.0
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/LICENSE.txt +1 -1
- package/README.md +93 -44
- package/lib/config/authInfoConfig.d.ts +19 -0
- package/lib/config/authInfoConfig.js +35 -0
- package/lib/config/config.d.ts +87 -22
- package/lib/config/config.js +117 -65
- package/lib/config/configAggregator.d.ts +41 -35
- package/lib/config/configAggregator.js +102 -73
- package/lib/config/configFile.d.ts +2 -2
- package/lib/config/configFile.js +38 -29
- package/lib/config/configStore.d.ts +9 -9
- package/lib/config/configStore.js +17 -15
- package/lib/config/envVars.d.ts +15 -9
- package/lib/config/envVars.js +71 -47
- package/lib/config/orgUsersConfig.js +2 -0
- package/lib/config/sandboxOrgConfig.js +2 -0
- package/lib/config/sandboxProcessCache.d.ts +16 -0
- package/lib/config/sandboxProcessCache.js +38 -0
- package/lib/config/tokensConfig.d.ts +10 -0
- package/lib/config/tokensConfig.js +29 -0
- package/lib/config/ttlConfig.d.ts +34 -0
- package/lib/config/ttlConfig.js +50 -0
- package/lib/crypto/crypto.js +15 -22
- package/lib/crypto/keyChain.js +2 -3
- package/lib/crypto/keyChainImpl.d.ts +5 -3
- package/lib/crypto/keyChainImpl.js +58 -61
- package/lib/crypto/secureBuffer.d.ts +1 -1
- package/lib/deviceOauthService.d.ts +3 -3
- package/lib/deviceOauthService.js +27 -25
- package/lib/exported.d.ts +15 -12
- package/lib/exported.js +28 -16
- package/lib/global.d.ts +11 -3
- package/lib/global.js +39 -12
- package/lib/lifecycleEvents.d.ts +1 -1
- package/lib/lifecycleEvents.js +3 -0
- package/lib/logger.d.ts +19 -9
- package/lib/logger.js +112 -86
- package/lib/messages.d.ts +53 -36
- package/lib/messages.js +81 -91
- package/lib/org/authInfo.d.ts +56 -20
- package/lib/org/authInfo.js +232 -131
- package/lib/org/authRemover.d.ts +8 -7
- package/lib/org/authRemover.js +32 -28
- package/lib/org/connection.d.ts +13 -37
- package/lib/org/connection.js +78 -124
- package/lib/org/index.js +5 -1
- package/lib/org/org.d.ts +151 -48
- package/lib/org/org.js +468 -225
- package/lib/org/orgConfigProperties.d.ts +64 -3
- package/lib/org/orgConfigProperties.js +96 -4
- package/lib/org/permissionSetAssignment.js +4 -13
- package/lib/org/scratchOrgCache.d.ts +20 -0
- package/lib/org/scratchOrgCache.js +33 -0
- package/lib/org/scratchOrgCreate.d.ts +28 -17
- package/lib/org/scratchOrgCreate.js +125 -53
- package/lib/org/scratchOrgErrorCodes.d.ts +9 -3
- package/lib/org/scratchOrgErrorCodes.js +34 -17
- package/lib/org/scratchOrgFeatureDeprecation.js +1 -6
- package/lib/org/scratchOrgInfoApi.d.ts +21 -47
- package/lib/org/scratchOrgInfoApi.js +129 -63
- package/lib/org/scratchOrgInfoGenerator.d.ts +6 -5
- package/lib/org/scratchOrgInfoGenerator.js +76 -62
- package/lib/org/scratchOrgLifecycleEvents.d.ts +10 -0
- package/lib/org/scratchOrgLifecycleEvents.js +41 -0
- package/lib/org/scratchOrgSettingsGenerator.d.ts +44 -21
- package/lib/org/scratchOrgSettingsGenerator.js +165 -98
- package/lib/org/scratchOrgTypes.d.ts +43 -0
- package/lib/org/scratchOrgTypes.js +9 -0
- package/lib/org/user.d.ts +1 -1
- package/lib/org/user.js +25 -34
- package/lib/schema/printer.d.ts +6 -0
- package/lib/schema/printer.js +34 -31
- package/lib/schema/validator.d.ts +12 -10
- package/lib/schema/validator.js +56 -76
- package/lib/{sfdxError.d.ts → sfError.d.ts} +12 -20
- package/lib/{sfdxError.js → sfError.js} +40 -30
- package/lib/{sfdxProject.d.ts → sfProject.d.ts} +75 -35
- package/lib/sfProject.js +651 -0
- package/lib/stateAggregator/accessors/aliasAccessor.d.ts +129 -0
- package/lib/stateAggregator/accessors/aliasAccessor.js +263 -0
- package/lib/stateAggregator/accessors/orgAccessor.d.ts +101 -0
- package/lib/stateAggregator/accessors/orgAccessor.js +240 -0
- package/lib/stateAggregator/accessors/sandboxAccessor.d.ts +8 -0
- package/lib/stateAggregator/accessors/sandboxAccessor.js +28 -0
- package/lib/stateAggregator/accessors/tokenAccessor.d.ts +63 -0
- package/lib/stateAggregator/accessors/tokenAccessor.js +80 -0
- package/lib/stateAggregator/index.d.ts +4 -0
- package/lib/stateAggregator/index.js +27 -0
- package/lib/stateAggregator/stateAggregator.d.ts +25 -0
- package/lib/stateAggregator/stateAggregator.js +46 -0
- package/lib/status/myDomainResolver.d.ts +1 -1
- package/lib/status/myDomainResolver.js +4 -4
- package/lib/status/pollingClient.js +4 -4
- package/lib/status/streamingClient.d.ts +2 -2
- package/lib/status/streamingClient.js +58 -63
- package/lib/status/types.d.ts +2 -2
- package/lib/testSetup.d.ts +204 -75
- package/lib/testSetup.js +468 -164
- package/lib/util/cache.d.ts +2 -2
- package/lib/util/cache.js +6 -6
- package/lib/util/checkLightningDomain.js +3 -4
- package/lib/util/directoryWriter.d.ts +12 -0
- package/lib/util/directoryWriter.js +54 -0
- package/lib/util/getJwtAudienceUrl.js +1 -1
- package/lib/util/internal.d.ts +28 -2
- package/lib/util/internal.js +65 -8
- package/lib/util/jsonXmlTools.js +2 -4
- package/lib/util/mapKeys.d.ts +9 -9
- package/lib/util/mapKeys.js +13 -9
- package/lib/util/sfdc.d.ts +51 -51
- package/lib/util/sfdc.js +74 -79
- package/lib/util/sfdcUrl.d.ts +5 -19
- package/lib/util/sfdcUrl.js +40 -49
- package/lib/util/structuredWriter.d.ts +9 -0
- package/lib/util/structuredWriter.js +3 -0
- package/lib/util/zipWriter.d.ts +8 -6
- package/lib/util/zipWriter.js +13 -13
- package/lib/webOAuthServer.d.ts +20 -6
- package/lib/webOAuthServer.js +102 -56
- package/messageTransformer/messageTransformer.ts +93 -0
- package/messages/auth.md +9 -1
- package/messages/config.md +42 -6
- package/messages/connection.md +8 -0
- package/messages/core.md +10 -0
- package/messages/envVars.md +37 -3
- package/messages/org.md +21 -1
- package/messages/scratchOrgCreate.md +2 -6
- package/messages/scratchOrgErrorCodes.md +17 -1
- package/messages/scratchOrgInfoApi.md +9 -0
- package/messages/scratchOrgInfoGenerator.md +9 -1
- package/package.json +123 -46
- package/CHANGELOG.md +0 -1244
- package/lib/config/keychainConfig.d.ts +0 -19
- package/lib/config/keychainConfig.js +0 -43
- package/lib/globalInfo/accessors/aliasAccessor.d.ts +0 -83
- package/lib/globalInfo/accessors/aliasAccessor.js +0 -130
- package/lib/globalInfo/accessors/orgAccessor.d.ts +0 -13
- package/lib/globalInfo/accessors/orgAccessor.js +0 -45
- package/lib/globalInfo/accessors/tokenAccessor.d.ts +0 -13
- package/lib/globalInfo/accessors/tokenAccessor.js +0 -35
- package/lib/globalInfo/globalInfoConfig.d.ts +0 -36
- package/lib/globalInfo/globalInfoConfig.js +0 -105
- package/lib/globalInfo/index.d.ts +0 -6
- package/lib/globalInfo/index.js +0 -29
- package/lib/globalInfo/sfdxDataHandler.d.ts +0 -43
- package/lib/globalInfo/sfdxDataHandler.js +0 -217
- package/lib/globalInfo/types.d.ts +0 -39
- package/lib/globalInfo/types.js +0 -10
- package/lib/sfdxProject.js +0 -557
- package/lib/util/fs.d.ts +0 -201
- package/lib/util/fs.js +0 -378
|
@@ -9,17 +9,15 @@
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.DeviceOauthService = void 0;
|
|
12
|
-
const url_1 = require("url");
|
|
13
12
|
const transport_1 = require("jsforce/lib/transport");
|
|
14
13
|
const kit_1 = require("@salesforce/kit");
|
|
15
14
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
15
|
+
const FormData = require("form-data");
|
|
16
16
|
const logger_1 = require("./logger");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const connection_1 = require("./org/connection");
|
|
17
|
+
const org_1 = require("./org");
|
|
18
|
+
const sfError_1 = require("./sfError");
|
|
20
19
|
const messages_1 = require("./messages");
|
|
21
|
-
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
22
|
-
const messages = messages_1.Messages.load('@salesforce/core', 'auth', ['pollingTimeout']);
|
|
20
|
+
const messages = new messages_1.Messages('@salesforce/core', 'auth', new Map([["targetOrgNotSet", "A default user is not set."], ["targetOrgNotSet.actions", ["Run the \"sfdx auth\" commands with --setdefaultusername to connect to an org and set it as your default org.", "Run \"force:org:create\" with --setdefaultusername to create a scratch org and set it as your default org.", "Run \"sfdx config:set defaultusername=<username>\" to set your default username."]], ["portInUse", "Cannot start the OAuth redirect server on port %s."], ["portInUse.actions", ["Kill the process running on port %s or use a custom connected app and update OauthLocalPort in the sfdx-project.json file."]], ["invalidRequestMethod", "Invalid request method: %s"], ["invalidRequestUri", "Invalid request uri: %s"], ["pollingTimeout", "The device authorization request timed out. After executing force:auth:device:login, you must approve access to the device within 10 minutes. This can happen if the URL wasn\u2019t copied into the browser, login was not attempted, or the 2FA process was not completed within 10 minutes. Request authorization again."], ["serverErrorHTMLResponse", "<html><head><style>body {background-color:#F4F6F9; font-family: Arial, sans-serif; font-size: 0.8125rem; line-height: 1.5rem; color: #16325c;} #center {margin: auto; width: 370px; padding: 100px 0px 20px;} #logo-container {margin-left: auto; margin-right: auto; text-align: center;} #logo {max-width: 180px; max-height: 113px; margin-bottom: 2rem; border: 0;} #header {font-size: 1.5rem; text-align: center; margin-bottom: 1rem;} #message {background-color: #FFFFFF; margin: 0px auto; padding: 1.25rem; border-radius: 0.25rem; border: 1px solid #D8DDE6;} #footer {height: 24px; width: 370px; text-align: center; font-size: .75rem; position: absolute; bottom: 10;}</style></head><body><div id=\"center\"><div id=\"logo-container\"><img id=\"logo\" aria-hidden=\"true\" name=\"logo\" alt=\"Salesforce\" src=\"data:image/svg+xml;base64,%s\"></div><div id=\"header\">%s</div><div id=\"message\">%s<br/><br/>This is most likely <b>not</b> an error with the Salesforce CLI. Please ensure all information is accurate and try again.</div><div id=\"footer\">© %s Salesforce, Inc. All rights reserved.</div></div></body></html>"], ["missingAuthCode", "No authentication code found on login response."], ["serverSuccessHTMLResponse", "<html><head><style>body {background-color:#F4F6F9; font-family: Arial, sans-serif; font-size: 0.8125rem; line-height: 1.5rem; color: #16325c;} #center {margin: auto; width: 300px; padding: 100px 0px 20px;} #logo-container {margin-left: auto; margin-right: auto; text-align: center;} #logo {max-width: 180px; max-height: 113px; margin-bottom: 2rem; border: 0;} #header {font-size: 1.5rem; text-align: center; margin-bottom: 1rem;} #message {background-color: #FFFFFF; margin: 0px auto; padding: 1.25rem; border-radius: 0.25rem; border: 1px solid #D8DDE6;} #footer {height: 24px; width: 300px; text-align: center; font-size: .75rem; position: absolute; bottom: 10;}</style></head><body><div id=\"center\"><div id=\"logo-container\"><img id=\"logo\" aria-hidden=\"true\" name=\"logo\" alt=\"Salesforce\" src=\"data:image/svg+xml;base64,%s\"></div><div id=\"header\">Authentication Successful</div><div id=\"message\">You've successfully logged in. You can now close this browser tab or window.</div><div id=\"footer\">© %s Salesforce, Inc. All rights reserved.</div></div></body></html>"], ["serverSfdcImage", "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIxLjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAyNjIgMTg0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNjIgMTg0OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2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C0xLjEsMi40LTIsMy40CgkJCQkJYy0wLjgsMC45LTEuNywxLjYtMi44LDEuOWMtMSwwLjQtMi4zLDAuNi0zLjcsMC42Yy0wLjcsMC0xLjQsMC0yLjItMC4yYy0wLjYtMC4xLTAuOS0wLjItMS40LTAuNGMtMC4yLTAuMS0wLjMtMC4zLTAuMi0wLjYKCQkJCQljMC4xLTAuMywxLTIuNywxLjEtMy4xYzAuMi0wLjQsMC41LTAuMiwwLjUtMC4yYzAuMywwLjEsMC41LDAuMiwwLjgsMC4zYzAuNCwwLjEsMC44LDAuMSwxLjIsMC4xYzAuNywwLDEuMy0wLjEsMS44LTAuMwoJCQkJCWMwLjYtMC4yLDEtMC42LDEuNC0xLjFjMC40LTAuNSwwLjctMS4yLDEuMS0yLjFjMC4zLTAuOSwwLjYtMi4yLDAuOS0zLjdsMy40LTE4LjloLTMuM2MtMC40LDAtMC41LTAuMi0wLjUtMC41bDAuNi0zLjEKCQkJCQljMC4xLTAuNSwwLjUtMC40LDAuNS0wLjRoMy40bDAuMi0xYzAuNS0zLDEuNS01LjMsMy02LjhjMS41LTEuNSwzLjctMi4zLDYuNC0yLjNjMC44LDAsMS41LDAuMSwyLjEsMC4yCgkJCQkJQzE1NSw2NC44LDE1NS41LDY0LjksMTU2LDY1LjF6IE04OC42LDk3LjZjMCwwLjMtMC4yLDAuNS0wLjQsMC41aC00Yy0wLjMsMC0wLjQtMC4yLTAuNC0wLjVWNjUuNWMwLTAuMiwwLjItMC41LDAuNC0wLjVoNAoJCQkJCWMwLjMsMCwwLjQsMC4yLDAuNCwwLjVWOTcuNnoiLz4KCQkJPC9nPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K"]]));
|
|
23
21
|
async function wait(ms = 1000) {
|
|
24
22
|
return new Promise((resolve) => {
|
|
25
23
|
setTimeout(resolve, ms);
|
|
@@ -29,7 +27,9 @@ async function makeRequest(options) {
|
|
|
29
27
|
const rawResponse = await new transport_1.default().httpRequest(options);
|
|
30
28
|
const response = (0, kit_1.parseJsonMap)(rawResponse.body);
|
|
31
29
|
if (response.error) {
|
|
32
|
-
const
|
|
30
|
+
const errorDescription = typeof response.error_description === 'string' ? response.error_description : '';
|
|
31
|
+
const error = typeof response.error === 'string' ? response.error : 'Unknown';
|
|
32
|
+
const err = new sfError_1.SfError(`Request Failed: ${error} ${errorDescription}`);
|
|
33
33
|
err.data = Object.assign(response, { status: rawResponse.statusCode });
|
|
34
34
|
throw err;
|
|
35
35
|
}
|
|
@@ -59,9 +59,9 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
59
59
|
this.pollingCount = 0;
|
|
60
60
|
this.options = options;
|
|
61
61
|
if (!this.options.clientId)
|
|
62
|
-
this.options.clientId =
|
|
62
|
+
this.options.clientId = org_1.DEFAULT_CONNECTED_APP_INFO.clientId;
|
|
63
63
|
if (!this.options.loginUrl)
|
|
64
|
-
this.options.loginUrl =
|
|
64
|
+
this.options.loginUrl = org_1.AuthInfo.getDefaultInstanceUrl();
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Begin the authorization flow by requesting the login
|
|
@@ -82,8 +82,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
82
82
|
const deviceFlowRequestUrl = this.getDeviceFlowRequestUrl();
|
|
83
83
|
const pollingOptions = this.getPollingOptions(deviceFlowRequestUrl, loginData.device_code);
|
|
84
84
|
const interval = kit_1.Duration.seconds(loginData.interval).milliseconds;
|
|
85
|
-
|
|
86
|
-
return response;
|
|
85
|
+
return this.pollForDeviceApproval(pollingOptions, interval);
|
|
87
86
|
}
|
|
88
87
|
/**
|
|
89
88
|
* Creates and saves new AuthInfo
|
|
@@ -91,7 +90,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
91
90
|
* @returns {Promise<AuthInfo>}
|
|
92
91
|
*/
|
|
93
92
|
async authorizeAndSave(approval) {
|
|
94
|
-
const authInfo = await
|
|
93
|
+
const authInfo = await org_1.AuthInfo.create({
|
|
95
94
|
oauth2Options: {
|
|
96
95
|
loginUrl: approval.instance_url,
|
|
97
96
|
refreshToken: approval.refresh_token,
|
|
@@ -108,27 +107,27 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
108
107
|
this.logger.debug(`this.options.loginUrl: ${this.options.loginUrl}`);
|
|
109
108
|
}
|
|
110
109
|
getLoginOptions(url) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
const form = new FormData();
|
|
111
|
+
form.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
|
|
112
|
+
form.append('response_type', DeviceOauthService.RESPONSE_TYPE);
|
|
113
|
+
form.append('scope', DeviceOauthService.SCOPE);
|
|
115
114
|
return {
|
|
116
115
|
url,
|
|
117
|
-
headers:
|
|
116
|
+
headers: { ...org_1.SFDX_HTTP_HEADERS, ...form.getHeaders() },
|
|
118
117
|
method: 'POST',
|
|
119
|
-
body,
|
|
118
|
+
body: form.getBuffer(),
|
|
120
119
|
};
|
|
121
120
|
}
|
|
122
121
|
getPollingOptions(url, code) {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
const form = new FormData();
|
|
123
|
+
form.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
|
|
124
|
+
form.append('grant_type', DeviceOauthService.GRANT_TYPE);
|
|
125
|
+
form.append('code', code);
|
|
127
126
|
return {
|
|
128
127
|
url,
|
|
129
|
-
headers:
|
|
128
|
+
headers: { ...org_1.SFDX_HTTP_HEADERS, ...form.getHeaders() },
|
|
130
129
|
method: 'POST',
|
|
131
|
-
body,
|
|
130
|
+
body: form.getBuffer(),
|
|
132
131
|
};
|
|
133
132
|
}
|
|
134
133
|
getDeviceFlowRequestUrl() {
|
|
@@ -140,7 +139,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
140
139
|
return await makeRequest(httpRequest);
|
|
141
140
|
}
|
|
142
141
|
catch (e) {
|
|
143
|
-
|
|
142
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions */
|
|
144
143
|
const err = e.data;
|
|
145
144
|
if (err.error && err.status === 400 && err.error === 'authorization_pending') {
|
|
146
145
|
// do nothing because we're still waiting
|
|
@@ -155,6 +154,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
155
154
|
}
|
|
156
155
|
throw err;
|
|
157
156
|
}
|
|
157
|
+
/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions */
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
shouldContinuePolling() {
|
|
@@ -164,6 +164,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
164
164
|
this.logger.debug('BEGIN POLLING FOR DEVICE APPROVAL');
|
|
165
165
|
let result;
|
|
166
166
|
while (this.shouldContinuePolling()) {
|
|
167
|
+
// eslint-disable-next-line no-await-in-loop
|
|
167
168
|
result = await this.poll(httpRequest);
|
|
168
169
|
if (result) {
|
|
169
170
|
this.logger.debug('POLLING FOR DEVICE APPROVAL SUCCESS');
|
|
@@ -171,6 +172,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
171
172
|
}
|
|
172
173
|
else {
|
|
173
174
|
this.logger.debug(`waiting ${interval} ms...`);
|
|
175
|
+
// eslint-disable-next-line no-await-in-loop
|
|
174
176
|
await wait(interval);
|
|
175
177
|
this.pollingCount += 1;
|
|
176
178
|
}
|
package/lib/exported.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export { OAuth2Config } from 'jsforce';
|
|
2
2
|
export { ConfigFile } from './config/configFile';
|
|
3
|
+
export { TTLConfig } from './config/ttlConfig';
|
|
3
4
|
export { envVars, EnvironmentVariable, SUPPORTED_ENV_VARS, EnvVars } from './config/envVars';
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
5
|
+
export { ConfigContents, ConfigEntry, ConfigStore, ConfigValue } from './config/configStore';
|
|
6
|
+
export { SfTokens, StateAggregator } from './stateAggregator';
|
|
6
7
|
export { DeviceOauthService, DeviceCodeResponse, DeviceCodePollingResponse } from './deviceOauthService';
|
|
7
8
|
export { OrgUsersConfig } from './config/orgUsersConfig';
|
|
8
|
-
export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SFDX_ALLOWED_PROPERTIES, } from './config/config';
|
|
9
|
+
export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SfConfigProperties, SFDX_ALLOWED_PROPERTIES, SF_ALLOWED_PROPERTIES, } from './config/config';
|
|
10
|
+
export { SandboxRequestCacheEntry, SandboxRequestCache } from './config/sandboxProcessCache';
|
|
9
11
|
export { ConfigInfo, ConfigAggregator } from './config/configAggregator';
|
|
10
|
-
export { AuthFields, AuthInfo, OrgAuthorization } from './org/authInfo';
|
|
12
|
+
export { AuthFields, AuthInfo, AuthSideEffects, OrgAuthorization } from './org/authInfo';
|
|
11
13
|
export { AuthRemover } from './org/authRemover';
|
|
12
14
|
export { Connection, SFDX_HTTP_HEADERS } from './org/connection';
|
|
13
15
|
export { Mode, Global } from './global';
|
|
@@ -16,20 +18,21 @@ export { WebOAuthServer } from './webOAuthServer';
|
|
|
16
18
|
export { SfdcUrl } from './util/sfdcUrl';
|
|
17
19
|
export { getJwtAudienceUrl } from './util/getJwtAudienceUrl';
|
|
18
20
|
export { Fields, FieldValue, LoggerLevel, LoggerLevelValue, LogLine, LoggerOptions, LoggerStream, Logger, } from './logger';
|
|
19
|
-
export { Messages } from './messages';
|
|
20
|
-
export { Org, SandboxProcessObject, StatusEvent, SandboxEvents, SandboxUserAuthResponse, SandboxUserAuthRequest, SandboxRequest, OrgTypes, ResultEvent, ScratchOrgRequest, } from './org';
|
|
21
|
+
export { Messages, StructuredMessage } from './messages';
|
|
22
|
+
export { Org, SandboxProcessObject, StatusEvent, SandboxEvents, SandboxUserAuthResponse, SandboxUserAuthRequest, SandboxRequest, ResumeSandboxRequest, OrgTypes, ResultEvent, ScratchOrgRequest, } from './org';
|
|
21
23
|
export { OrgConfigProperties, ORG_CONFIG_ALLOWED_PROPERTIES } from './org/orgConfigProperties';
|
|
22
|
-
export { PackageDir, NamedPackageDir, PackageDirDependency,
|
|
23
|
-
export { SchemaPrinter } from './schema/printer';
|
|
24
|
+
export { PackageDir, NamedPackageDir, PackageDirDependency, SfProject, SfProjectJson } from './sfProject';
|
|
24
25
|
export { SchemaValidator } from './schema/validator';
|
|
25
|
-
export {
|
|
26
|
+
export { SchemaPrinter } from './schema/printer';
|
|
27
|
+
export { SfError } from './sfError';
|
|
26
28
|
export { PollingClient } from './status/pollingClient';
|
|
27
29
|
export { CometClient, CometSubscription, StreamingClient, StatusResult } from './status/streamingClient';
|
|
28
30
|
export { MyDomainResolver } from './status/myDomainResolver';
|
|
29
31
|
export { DefaultUserFields, REQUIRED_FIELDS, User, UserFields } from './org/user';
|
|
30
32
|
export { PermissionSetAssignment, PermissionSetAssignmentFields } from './org/permissionSetAssignment';
|
|
31
|
-
export { ScratchOrgCreateOptions, ScratchOrgCreateResult, scratchOrgCreate } from './org/scratchOrgCreate';
|
|
32
|
-
export { ScratchOrgInfo } from './org/
|
|
33
|
-
export
|
|
33
|
+
export { ScratchOrgCreateOptions, ScratchOrgCreateResult, scratchOrgCreate, scratchOrgResume, } from './org/scratchOrgCreate';
|
|
34
|
+
export { ScratchOrgInfo } from './org/scratchOrgTypes';
|
|
35
|
+
export { ScratchOrgLifecycleEvent, scratchOrgLifecycleEventName, scratchOrgLifecycleStages, } from './org/scratchOrgLifecycleEvents';
|
|
36
|
+
export { ScratchOrgCache } from './org/scratchOrgCache';
|
|
34
37
|
export * from './util/sfdc';
|
|
35
38
|
export * from './util/sfdcUrl';
|
package/lib/exported.js
CHANGED
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
9
|
if (k2 === undefined) k2 = k;
|
|
10
|
-
Object.
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
11
15
|
}) : (function(o, m, k, k2) {
|
|
12
16
|
if (k2 === undefined) k2 = k;
|
|
13
17
|
o[k2] = m[k];
|
|
@@ -16,21 +20,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
20
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
21
|
};
|
|
18
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.scratchOrgCreate = exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.
|
|
23
|
+
exports.scratchOrgLifecycleEventName = exports.scratchOrgResume = exports.scratchOrgCreate = exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfError = exports.SchemaPrinter = exports.SchemaValidator = exports.SfProjectJson = exports.SfProject = 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.SandboxRequestCache = exports.SF_ALLOWED_PROPERTIES = exports.SFDX_ALLOWED_PROPERTIES = exports.SfConfigProperties = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.StateAggregator = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
|
|
24
|
+
exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = void 0;
|
|
20
25
|
const messages_1 = require("./messages");
|
|
21
|
-
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
22
26
|
var configFile_1 = require("./config/configFile");
|
|
23
27
|
Object.defineProperty(exports, "ConfigFile", { enumerable: true, get: function () { return configFile_1.ConfigFile; } });
|
|
28
|
+
var ttlConfig_1 = require("./config/ttlConfig");
|
|
29
|
+
Object.defineProperty(exports, "TTLConfig", { enumerable: true, get: function () { return ttlConfig_1.TTLConfig; } });
|
|
24
30
|
var envVars_1 = require("./config/envVars");
|
|
25
31
|
Object.defineProperty(exports, "envVars", { enumerable: true, get: function () { return envVars_1.envVars; } });
|
|
26
32
|
Object.defineProperty(exports, "EnvironmentVariable", { enumerable: true, get: function () { return envVars_1.EnvironmentVariable; } });
|
|
27
33
|
Object.defineProperty(exports, "SUPPORTED_ENV_VARS", { enumerable: true, get: function () { return envVars_1.SUPPORTED_ENV_VARS; } });
|
|
28
34
|
Object.defineProperty(exports, "EnvVars", { enumerable: true, get: function () { return envVars_1.EnvVars; } });
|
|
29
|
-
var
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
var globalInfo_1 = require("./globalInfo");
|
|
32
|
-
Object.defineProperty(exports, "GlobalInfo", { enumerable: true, get: function () { return globalInfo_1.GlobalInfo; } });
|
|
33
|
-
Object.defineProperty(exports, "SfInfoKeys", { enumerable: true, get: function () { return globalInfo_1.SfInfoKeys; } });
|
|
35
|
+
var stateAggregator_1 = require("./stateAggregator");
|
|
36
|
+
Object.defineProperty(exports, "StateAggregator", { enumerable: true, get: function () { return stateAggregator_1.StateAggregator; } });
|
|
34
37
|
var deviceOauthService_1 = require("./deviceOauthService");
|
|
35
38
|
Object.defineProperty(exports, "DeviceOauthService", { enumerable: true, get: function () { return deviceOauthService_1.DeviceOauthService; } });
|
|
36
39
|
var orgUsersConfig_1 = require("./config/orgUsersConfig");
|
|
@@ -38,7 +41,11 @@ Object.defineProperty(exports, "OrgUsersConfig", { enumerable: true, get: functi
|
|
|
38
41
|
var config_1 = require("./config/config");
|
|
39
42
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
|
|
40
43
|
Object.defineProperty(exports, "SfdxPropertyKeys", { enumerable: true, get: function () { return config_1.SfdxPropertyKeys; } });
|
|
44
|
+
Object.defineProperty(exports, "SfConfigProperties", { enumerable: true, get: function () { return config_1.SfConfigProperties; } });
|
|
41
45
|
Object.defineProperty(exports, "SFDX_ALLOWED_PROPERTIES", { enumerable: true, get: function () { return config_1.SFDX_ALLOWED_PROPERTIES; } });
|
|
46
|
+
Object.defineProperty(exports, "SF_ALLOWED_PROPERTIES", { enumerable: true, get: function () { return config_1.SF_ALLOWED_PROPERTIES; } });
|
|
47
|
+
var sandboxProcessCache_1 = require("./config/sandboxProcessCache");
|
|
48
|
+
Object.defineProperty(exports, "SandboxRequestCache", { enumerable: true, get: function () { return sandboxProcessCache_1.SandboxRequestCache; } });
|
|
42
49
|
var configAggregator_1 = require("./config/configAggregator");
|
|
43
50
|
Object.defineProperty(exports, "ConfigAggregator", { enumerable: true, get: function () { return configAggregator_1.ConfigAggregator; } });
|
|
44
51
|
var authInfo_1 = require("./org/authInfo");
|
|
@@ -71,15 +78,15 @@ Object.defineProperty(exports, "OrgTypes", { enumerable: true, get: function ()
|
|
|
71
78
|
var orgConfigProperties_1 = require("./org/orgConfigProperties");
|
|
72
79
|
Object.defineProperty(exports, "OrgConfigProperties", { enumerable: true, get: function () { return orgConfigProperties_1.OrgConfigProperties; } });
|
|
73
80
|
Object.defineProperty(exports, "ORG_CONFIG_ALLOWED_PROPERTIES", { enumerable: true, get: function () { return orgConfigProperties_1.ORG_CONFIG_ALLOWED_PROPERTIES; } });
|
|
74
|
-
var
|
|
75
|
-
Object.defineProperty(exports, "
|
|
76
|
-
Object.defineProperty(exports, "
|
|
77
|
-
var printer_1 = require("./schema/printer");
|
|
78
|
-
Object.defineProperty(exports, "SchemaPrinter", { enumerable: true, get: function () { return printer_1.SchemaPrinter; } });
|
|
81
|
+
var sfProject_1 = require("./sfProject");
|
|
82
|
+
Object.defineProperty(exports, "SfProject", { enumerable: true, get: function () { return sfProject_1.SfProject; } });
|
|
83
|
+
Object.defineProperty(exports, "SfProjectJson", { enumerable: true, get: function () { return sfProject_1.SfProjectJson; } });
|
|
79
84
|
var validator_1 = require("./schema/validator");
|
|
80
85
|
Object.defineProperty(exports, "SchemaValidator", { enumerable: true, get: function () { return validator_1.SchemaValidator; } });
|
|
81
|
-
var
|
|
82
|
-
Object.defineProperty(exports, "
|
|
86
|
+
var printer_1 = require("./schema/printer");
|
|
87
|
+
Object.defineProperty(exports, "SchemaPrinter", { enumerable: true, get: function () { return printer_1.SchemaPrinter; } });
|
|
88
|
+
var sfError_1 = require("./sfError");
|
|
89
|
+
Object.defineProperty(exports, "SfError", { enumerable: true, get: function () { return sfError_1.SfError; } });
|
|
83
90
|
var pollingClient_1 = require("./status/pollingClient");
|
|
84
91
|
Object.defineProperty(exports, "PollingClient", { enumerable: true, get: function () { return pollingClient_1.PollingClient; } });
|
|
85
92
|
var streamingClient_1 = require("./status/streamingClient");
|
|
@@ -95,8 +102,13 @@ var permissionSetAssignment_1 = require("./org/permissionSetAssignment");
|
|
|
95
102
|
Object.defineProperty(exports, "PermissionSetAssignment", { enumerable: true, get: function () { return permissionSetAssignment_1.PermissionSetAssignment; } });
|
|
96
103
|
var scratchOrgCreate_1 = require("./org/scratchOrgCreate");
|
|
97
104
|
Object.defineProperty(exports, "scratchOrgCreate", { enumerable: true, get: function () { return scratchOrgCreate_1.scratchOrgCreate; } });
|
|
105
|
+
Object.defineProperty(exports, "scratchOrgResume", { enumerable: true, get: function () { return scratchOrgCreate_1.scratchOrgResume; } });
|
|
106
|
+
var scratchOrgLifecycleEvents_1 = require("./org/scratchOrgLifecycleEvents");
|
|
107
|
+
Object.defineProperty(exports, "scratchOrgLifecycleEventName", { enumerable: true, get: function () { return scratchOrgLifecycleEvents_1.scratchOrgLifecycleEventName; } });
|
|
108
|
+
Object.defineProperty(exports, "scratchOrgLifecycleStages", { enumerable: true, get: function () { return scratchOrgLifecycleEvents_1.scratchOrgLifecycleStages; } });
|
|
109
|
+
var scratchOrgCache_1 = require("./org/scratchOrgCache");
|
|
110
|
+
Object.defineProperty(exports, "ScratchOrgCache", { enumerable: true, get: function () { return scratchOrgCache_1.ScratchOrgCache; } });
|
|
98
111
|
// Utility sub-modules
|
|
99
|
-
__exportStar(require("./util/fs"), exports);
|
|
100
112
|
__exportStar(require("./util/sfdc"), exports);
|
|
101
113
|
__exportStar(require("./util/sfdcUrl"), exports);
|
|
102
114
|
//# sourceMappingURL=exported.js.map
|
package/lib/global.d.ts
CHANGED
|
@@ -28,18 +28,26 @@ export declare class Global {
|
|
|
28
28
|
* The global folder in which sf state is stored.
|
|
29
29
|
*/
|
|
30
30
|
static readonly SF_STATE_FOLDER = ".sf";
|
|
31
|
+
/**
|
|
32
|
+
* The preferred global folder in which state is stored.
|
|
33
|
+
*/
|
|
34
|
+
static readonly STATE_FOLDER = ".sfdx";
|
|
31
35
|
/**
|
|
32
36
|
* The full system path to the global sfdx state folder.
|
|
33
37
|
*
|
|
34
38
|
* **See** {@link Global.SFDX_STATE_FOLDER}
|
|
35
39
|
*/
|
|
36
|
-
static
|
|
40
|
+
static get SFDX_DIR(): string;
|
|
37
41
|
/**
|
|
38
42
|
* The full system path to the global sf state folder.
|
|
39
43
|
*
|
|
40
|
-
* **See**
|
|
44
|
+
* **See** {@link Global.SF_STATE_FOLDER}
|
|
45
|
+
*/
|
|
46
|
+
static get SF_DIR(): string;
|
|
47
|
+
/**
|
|
48
|
+
* The full system path to the preferred global state folder
|
|
41
49
|
*/
|
|
42
|
-
static
|
|
50
|
+
static get DIR(): string;
|
|
43
51
|
/**
|
|
44
52
|
* The full system path to the global log file.
|
|
45
53
|
*/
|
package/lib/global.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Global = exports.Mode = void 0;
|
|
10
|
+
const fs = require("fs");
|
|
10
11
|
const os = require("os");
|
|
11
12
|
const path = require("path");
|
|
12
13
|
const kit_1 = require("@salesforce/kit");
|
|
13
|
-
const
|
|
14
|
+
const sfError_1 = require("./sfError");
|
|
14
15
|
/**
|
|
15
16
|
* Represents an environment mode. Supports `production`, `development`, `demo`, and `test`
|
|
16
17
|
* with the default mode being `production`.
|
|
@@ -28,6 +29,28 @@ var Mode;
|
|
|
28
29
|
* Global constants, methods, and configuration.
|
|
29
30
|
*/
|
|
30
31
|
class Global {
|
|
32
|
+
/**
|
|
33
|
+
* The full system path to the global sfdx state folder.
|
|
34
|
+
*
|
|
35
|
+
* **See** {@link Global.SFDX_STATE_FOLDER}
|
|
36
|
+
*/
|
|
37
|
+
static get SFDX_DIR() {
|
|
38
|
+
return path.join(os.homedir(), Global.SFDX_STATE_FOLDER);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The full system path to the global sf state folder.
|
|
42
|
+
*
|
|
43
|
+
* **See** {@link Global.SF_STATE_FOLDER}
|
|
44
|
+
*/
|
|
45
|
+
static get SF_DIR() {
|
|
46
|
+
return path.join(os.homedir(), Global.SF_STATE_FOLDER);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The full system path to the preferred global state folder
|
|
50
|
+
*/
|
|
51
|
+
static get DIR() {
|
|
52
|
+
return path.join(os.homedir(), Global.SFDX_STATE_FOLDER);
|
|
53
|
+
}
|
|
31
54
|
/**
|
|
32
55
|
* Gets the current mode environment variable as a {@link Mode} instance.
|
|
33
56
|
*
|
|
@@ -46,7 +69,17 @@ class Global {
|
|
|
46
69
|
*/
|
|
47
70
|
static async createDir(dirPath) {
|
|
48
71
|
dirPath = dirPath ? path.join(Global.SFDX_DIR, dirPath) : Global.SFDX_DIR;
|
|
49
|
-
|
|
72
|
+
try {
|
|
73
|
+
if (process.platform === 'win32') {
|
|
74
|
+
await fs.promises.mkdir(dirPath, { recursive: true });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
await fs.promises.mkdir(dirPath, { recursive: true, mode: 0o700 });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
throw new sfError_1.SfError(`Failed to create directory or set permissions for: ${dirPath}`);
|
|
82
|
+
}
|
|
50
83
|
}
|
|
51
84
|
}
|
|
52
85
|
exports.Global = Global;
|
|
@@ -65,19 +98,13 @@ Global.SFDX_STATE_FOLDER = '.sfdx';
|
|
|
65
98
|
*/
|
|
66
99
|
Global.SF_STATE_FOLDER = '.sf';
|
|
67
100
|
/**
|
|
68
|
-
* The
|
|
69
|
-
*
|
|
70
|
-
* **See** {@link Global.SFDX_STATE_FOLDER}
|
|
71
|
-
*/
|
|
72
|
-
Global.SFDX_DIR = path.join(os.homedir(), Global.SFDX_STATE_FOLDER);
|
|
73
|
-
/**
|
|
74
|
-
* The full system path to the global sf state folder.
|
|
75
|
-
*
|
|
76
|
-
* **See** {@link Global.SF_STATE_FOLDER}
|
|
101
|
+
* The preferred global folder in which state is stored.
|
|
77
102
|
*/
|
|
78
|
-
Global.
|
|
103
|
+
Global.STATE_FOLDER = Global.SFDX_STATE_FOLDER;
|
|
79
104
|
/**
|
|
80
105
|
* The full system path to the global log file.
|
|
81
106
|
*/
|
|
107
|
+
// member ordering conflicts with the TS use-before-declaration error
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
82
109
|
Global.LOG_FILE_PATH = path.join(Global.SF_DIR, 'sf.log');
|
|
83
110
|
//# sourceMappingURL=global.js.map
|
package/lib/lifecycleEvents.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyJson } from '@salesforce/ts-types';
|
|
2
|
-
|
|
2
|
+
type callback = (data: any) => Promise<void>;
|
|
3
3
|
/**
|
|
4
4
|
* An asynchronous event listener and emitter that follows the singleton pattern. The singleton pattern allows lifecycle
|
|
5
5
|
* events to be emitted from deep within a library and still be consumed by any other library or tool. It allows other
|
package/lib/lifecycleEvents.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.Lifecycle = void 0;
|
|
|
10
10
|
const Debug = require("debug");
|
|
11
11
|
const semver_1 = require("semver");
|
|
12
12
|
// needed for TS to not put everything inside /lib/src
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
14
|
// @ts-ignore
|
|
14
15
|
const pjson = require("../package.json");
|
|
15
16
|
/**
|
|
@@ -85,6 +86,7 @@ class Lifecycle {
|
|
|
85
86
|
/**
|
|
86
87
|
* return the package.json version of the sfdx-core library.
|
|
87
88
|
*/
|
|
89
|
+
// eslint-disable-next-line class-methods-use-this
|
|
88
90
|
version() {
|
|
89
91
|
return pjson.version;
|
|
90
92
|
}
|
|
@@ -175,6 +177,7 @@ class Lifecycle {
|
|
|
175
177
|
}
|
|
176
178
|
else {
|
|
177
179
|
for (const cb of listeners) {
|
|
180
|
+
// eslint-disable-next-line no-await-in-loop
|
|
178
181
|
await cb(data);
|
|
179
182
|
}
|
|
180
183
|
}
|
package/lib/logger.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Writable } from 'stream';
|
|
|
6
6
|
* @param input The input to be serialized.
|
|
7
7
|
* **See** {@link https://github.com/forcedotcom/node-bunyan#serializers|Bunyan Serializers API}
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type Serializer = (input: unknown) => unknown;
|
|
10
10
|
/**
|
|
11
11
|
* A collection of named `Serializer`s.
|
|
12
12
|
*
|
|
@@ -62,7 +62,7 @@ export declare enum LoggerLevel {
|
|
|
62
62
|
FATAL = 60
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* `Logger` format types.
|
|
66
66
|
*/
|
|
67
67
|
export declare enum LoggerFormat {
|
|
68
68
|
JSON = 0,
|
|
@@ -99,7 +99,7 @@ export interface LoggerStream {
|
|
|
99
99
|
/**
|
|
100
100
|
* Any numeric `Logger` level.
|
|
101
101
|
*/
|
|
102
|
-
export
|
|
102
|
+
export type LoggerLevelValue = LoggerLevel | number;
|
|
103
103
|
/**
|
|
104
104
|
* A collection of named `FieldValue`s.
|
|
105
105
|
*
|
|
@@ -111,7 +111,7 @@ export interface Fields {
|
|
|
111
111
|
/**
|
|
112
112
|
* All possible field value types.
|
|
113
113
|
*/
|
|
114
|
-
export
|
|
114
|
+
export type FieldValue = string | number | boolean;
|
|
115
115
|
/**
|
|
116
116
|
* Log line interface
|
|
117
117
|
*/
|
|
@@ -163,6 +163,17 @@ export declare class Logger {
|
|
|
163
163
|
static readonly LEVEL_NAMES: string[];
|
|
164
164
|
private static readonly lifecycle;
|
|
165
165
|
private static rootLogger?;
|
|
166
|
+
/**
|
|
167
|
+
* The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
|
|
168
|
+
* See 'period' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
|
|
169
|
+
*/
|
|
170
|
+
readonly logRotationPeriod: string;
|
|
171
|
+
/**
|
|
172
|
+
* The number of backup rotated log files to keep.
|
|
173
|
+
* Example: '3' will have the base sf.log file, and the past 3 (period) log files.
|
|
174
|
+
* See 'count' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
|
|
175
|
+
*/
|
|
176
|
+
readonly logRotationCount: number;
|
|
166
177
|
/**
|
|
167
178
|
* Whether debug is enabled for this Logger.
|
|
168
179
|
*/
|
|
@@ -174,7 +185,7 @@ export declare class Logger {
|
|
|
174
185
|
*
|
|
175
186
|
* @param optionsOrName A set of `LoggerOptions` or name to use with the default options.
|
|
176
187
|
*
|
|
177
|
-
* **Throws** *{@link
|
|
188
|
+
* **Throws** *{@link SfError}{ name: 'RedundantRootLoggerError' }* More than one attempt is made to construct the root
|
|
178
189
|
* `Logger`.
|
|
179
190
|
*/
|
|
180
191
|
constructor(optionsOrName: LoggerOptions | string);
|
|
@@ -211,7 +222,7 @@ export declare class Logger {
|
|
|
211
222
|
*
|
|
212
223
|
* @param {string} levelName The level name to convert to a `LoggerLevel` enum value.
|
|
213
224
|
*
|
|
214
|
-
* **Throws** *{@link
|
|
225
|
+
* **Throws** *{@link SfError}{ name: 'UnrecognizedLoggerLevelNameError' }* The level name was not case-insensitively recognized as a valid `LoggerLevel` value.
|
|
215
226
|
* @see {@Link LoggerLevel}
|
|
216
227
|
*/
|
|
217
228
|
static getLevelByName(levelName: string): LoggerLevelValue;
|
|
@@ -249,7 +260,7 @@ export declare class Logger {
|
|
|
249
260
|
*
|
|
250
261
|
* @param {LoggerLevelValue} [level] The logger level.
|
|
251
262
|
*
|
|
252
|
-
* **Throws** *{@link
|
|
263
|
+
* **Throws** *{@link SfError}{ name: 'UnrecognizedLoggerLevelNameError' }* A value of `level` read from `SFDX_LOG_LEVEL`
|
|
253
264
|
* was invalid.
|
|
254
265
|
*
|
|
255
266
|
* ```
|
|
@@ -299,8 +310,7 @@ export declare class Logger {
|
|
|
299
310
|
/**
|
|
300
311
|
* Close the logger, including any streams, and remove all listeners.
|
|
301
312
|
*
|
|
302
|
-
* @param fn A function with signature `(stream: LoggerStream) => void` to call for each stream with
|
|
303
|
-
* the stream as an arg.
|
|
313
|
+
* @param fn A function with signature `(stream: LoggerStream) => void` to call for each stream with the stream as an arg.
|
|
304
314
|
*/
|
|
305
315
|
close(fn?: (stream: LoggerStream) => void): void;
|
|
306
316
|
/**
|