@salesforce/core 8.18.7 → 8.19.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/lib/config/config.js +7 -30
- package/lib/config/configFile.d.ts +1 -1
- package/lib/config/configFile.js +18 -41
- package/lib/crypto/crypto.js +1 -3
- package/lib/crypto/keyChainImpl.d.ts +2 -2
- package/lib/crypto/keyChainImpl.js +10 -11
- package/lib/deviceOauthService.js +2 -2
- package/lib/fs/fs.d.ts +6 -0
- package/lib/fs/fs.js +79 -0
- package/lib/fs/types.d.ts +31 -0
- package/lib/fs/types.js +3 -0
- package/lib/global.js +5 -5
- package/lib/index.d.ts +4 -1
- package/lib/index.js +4 -1
- package/lib/lifecycleEvents.js +0 -3
- package/lib/logger/cleanup.js +3 -26
- package/lib/logger/logger.d.ts +1 -1
- package/lib/logger/logger.js +1 -1
- package/lib/messages.js +2 -1
- package/lib/org/authInfo.js +6 -6
- package/lib/org/connection.d.ts +1 -1
- package/lib/org/connection.js +5 -3
- package/lib/org/org.js +18 -20
- package/lib/org/permissionSetAssignment.js +4 -8
- package/lib/org/scratchOrgCreate.js +1 -1
- package/lib/org/scratchOrgInfoApi.js +2 -2
- package/lib/org/scratchOrgInfoGenerator.js +3 -3
- package/lib/org/scratchOrgSettingsGenerator.js +1 -1
- package/lib/org/user.js +4 -3
- package/lib/schema/validator.js +5 -5
- package/lib/sfProject.js +2 -25
- package/lib/stateAggregator/accessors/aliasAccessor.js +14 -7
- package/lib/stateAggregator/accessors/orgAccessor.d.ts +2 -2
- package/lib/stateAggregator/accessors/orgAccessor.js +3 -3
- package/lib/status/myDomainResolver.d.ts +0 -2
- package/lib/status/myDomainResolver.js +0 -12
- package/lib/status/streamingClient.d.ts +2 -2
- package/lib/status/streamingClient.js +11 -11
- package/lib/testSetup.js +3 -3
- package/lib/util/directoryWriter.js +7 -7
- package/lib/util/fileLocking.d.ts +3 -1
- package/lib/util/fileLocking.js +19 -31
- package/lib/util/findUppercaseKeys.js +2 -2
- package/lib/util/internal.js +3 -26
- package/lib/util/lockRetryOptions.d.ts +1 -2
- package/lib/util/lockRetryOptions.js +2 -5
- package/lib/util/sfdcUrl.js +3 -2
- package/lib/util/time.js +2 -2
- package/lib/webOAuthServer.js +7 -7
- package/package.json +4 -2
package/lib/org/authInfo.js
CHANGED
|
@@ -37,12 +37,12 @@ exports.AuthInfo = exports.DEFAULT_CONNECTED_APP_INFO = void 0;
|
|
|
37
37
|
const node_crypto_1 = require("node:crypto");
|
|
38
38
|
const node_path_1 = require("node:path");
|
|
39
39
|
const os = __importStar(require("node:os"));
|
|
40
|
-
const fs = __importStar(require("node:fs"));
|
|
41
40
|
const kit_1 = require("@salesforce/kit");
|
|
42
41
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
43
42
|
const jsforce_node_1 = require("@jsforce/jsforce-node");
|
|
44
43
|
const transport_1 = __importDefault(require("@jsforce/jsforce-node/lib/transport"));
|
|
45
44
|
const jwt = __importStar(require("jsonwebtoken"));
|
|
45
|
+
const fs_1 = require("../fs/fs");
|
|
46
46
|
const config_1 = require("../config/config");
|
|
47
47
|
const configAggregator_1 = require("../config/configAggregator");
|
|
48
48
|
const logger_1 = require("../logger/logger");
|
|
@@ -54,8 +54,8 @@ const messages_1 = require("../messages");
|
|
|
54
54
|
const sfdcUrl_1 = require("../util/sfdcUrl");
|
|
55
55
|
const findSuggestion_1 = require("../util/findSuggestion");
|
|
56
56
|
const connection_1 = require("./connection");
|
|
57
|
-
const orgConfigProperties_1 = require("./orgConfigProperties");
|
|
58
57
|
const org_1 = require("./org");
|
|
58
|
+
const orgConfigProperties_1 = require("./orgConfigProperties");
|
|
59
59
|
;
|
|
60
60
|
const messages = new messages_1.Messages('@salesforce/core', 'core', new Map([["authInfoCreationError", "Must pass a username and/or OAuth options when creating an AuthInfo instance."], ["authInfoOverwriteError", "Cannot create an AuthInfo instance that will overwrite existing auth data."], ["authInfoOverwriteError.actions", ["Create the AuthInfo instance using existing auth data by just passing the username. E.g., `AuthInfo.create({ username: 'my@user.org' });`."]], ["authCodeExchangeError", "Error authenticating with auth code due to: %s"], ["authCodeUsernameRetrievalError", "Could not retrieve the username after successful auth code exchange.\n\nDue to: %s"], ["jwtAuthError", "Error authenticating with JWT config due to: %s"], ["jwtAuthErrors", "Error authenticating with JWT.\nErrors encountered:\n%s"], ["refreshTokenAuthError", "Error authenticating with the refresh token due to: %s"], ["invalidSfdxAuthUrlError", "Invalid SFDX authorization URL. Must be in the format \"force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>\". Note that the \"instanceUrl\" inside the SFDX authorization URL doesn\\'t include the protocol (\"https://\"). Run \"org display --target-org\" on an org to see an example of an SFDX authorization URL."], ["orgDataNotAvailableError", "An attempt to refresh the authentication token failed with a 'Data Not Found Error'. The org identified by username %s does not appear to exist. Likely cause is that the org was deleted by another user or has expired."], ["orgDataNotAvailableError.actions", ["Run `sfdx force:org:list --clean` to remove stale org authentications.", "Use `sfdx force:config:set` to update the defaultusername.", "Use `sfdx force:org:create` to create a new org.", "Use `sfdx auth` to authenticate an existing org."]], ["namedOrgNotFound", "No authorization information found for %s."], ["noAliasesFound", "Nothing to set."], ["invalidFormat", "Setting aliases must be in the format <key>=<value> but found: [%s]."], ["invalidJsonCasing", "All JSON input must have heads down camelcase keys. E.g., `{ sfdcLoginUrl: \"https://login.salesforce.com\" }`\nFound \"%s\" at %s"], ["missingClientId", "Client ID is required for JWT authentication."]]));
|
|
61
61
|
// parses the id field returned from jsForce oauth2 methods to get
|
|
@@ -283,7 +283,7 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
283
283
|
try {
|
|
284
284
|
const soi = await AuthInfo.queryScratchOrg(hubAuthInfo.username, fields.orgId);
|
|
285
285
|
// if any return a result
|
|
286
|
-
logger.debug(`found orgId ${fields.orgId} in devhub ${hubAuthInfo.username}`);
|
|
286
|
+
logger.debug(`found orgId ${fields.orgId ?? '<undefined>'} in devhub ${hubAuthInfo.username}`);
|
|
287
287
|
try {
|
|
288
288
|
await orgAuthInfo.save({
|
|
289
289
|
...fields,
|
|
@@ -378,7 +378,7 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
378
378
|
const result = data.records.filter((r) => r.ScratchOrg === trimmedId)[0];
|
|
379
379
|
if (result)
|
|
380
380
|
return result;
|
|
381
|
-
throw new sfError_1.SfError(`DevHub ${devHubUsername} has no active scratch orgs that match ${trimmedId}`, 'NoActiveScratchOrgFound');
|
|
381
|
+
throw new sfError_1.SfError(`DevHub ${devHubUsername ?? '<undefined>'} has no active scratch orgs that match ${trimmedId}`, 'NoActiveScratchOrgFound');
|
|
382
382
|
}
|
|
383
383
|
/**
|
|
384
384
|
* Get the username.
|
|
@@ -803,7 +803,7 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
805
|
async readJwtKey(keyFile) {
|
|
806
|
-
return fs.promises.readFile(keyFile, 'utf8');
|
|
806
|
+
return fs_1.fs.promises.readFile(keyFile, 'utf8');
|
|
807
807
|
}
|
|
808
808
|
// Build OAuth config for a JWT auth flow
|
|
809
809
|
async authJwt(options) {
|
|
@@ -933,7 +933,7 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
933
933
|
// Exchange the auth code for an access token and refresh token.
|
|
934
934
|
let authFields;
|
|
935
935
|
try {
|
|
936
|
-
this.logger.debug(`Exchanging auth code for access token using loginUrl: ${options.loginUrl}`);
|
|
936
|
+
this.logger.debug(`Exchanging auth code for access token using loginUrl: ${options.loginUrl ?? '<undefined>'}`);
|
|
937
937
|
authFields = await oauth2.requestToken((0, ts_types_1.ensure)(options.authCode));
|
|
938
938
|
}
|
|
939
939
|
catch (err) {
|
package/lib/org/connection.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { StreamPromise } from '@jsforce/jsforce-node/lib/util/promise';
|
|
|
6
6
|
import { ConfigAggregator } from '../config/configAggregator';
|
|
7
7
|
import { AuthFields, AuthInfo } from './authInfo';
|
|
8
8
|
export declare const SFDX_HTTP_HEADERS: {
|
|
9
|
+
'user-agent'?: string | undefined;
|
|
9
10
|
'content-type': string;
|
|
10
|
-
'user-agent': string;
|
|
11
11
|
};
|
|
12
12
|
export declare const DNS_ERROR_NAME = "DomainNotFoundError";
|
|
13
13
|
export type DeployOptionsWithRest = Partial<DeployOptions> & {
|
package/lib/org/connection.js
CHANGED
|
@@ -20,13 +20,15 @@ const sfError_1 = require("../sfError");
|
|
|
20
20
|
const sfdc_1 = require("../util/sfdc");
|
|
21
21
|
const messages_1 = require("../messages");
|
|
22
22
|
const lifecycleEvents_1 = require("../lifecycleEvents");
|
|
23
|
+
const global_1 = require("../global");
|
|
23
24
|
const orgConfigProperties_1 = require("./orgConfigProperties");
|
|
24
25
|
;
|
|
25
26
|
const messages = new messages_1.Messages('@salesforce/core', 'connection', new Map([["incorrectAPIVersionError", "Invalid API version %s. Expecting format \"[1-9][0-9].0\", i.e. 42.0"], ["domainNotFoundError", "The org cannot be found"], ["domainNotFoundError.actions", ["Verify that the org still exists,", "If your org is newly created, wait a minute and run your command again,", "If you deployed or updated the org's My Domain, logout from the CLI and authenticate again,", "If you are running in a CI environment with a DNS that blocks external IPs, try setting SFDX_DISABLE_DNS_CHECK=true"]], ["noInstanceUrlError", "Connection has no instanceUrl."], ["noInstanceUrlError.actions", "Make sure the instanceUrl is set in your command or config."], ["noApiVersionsError", "Org failed to respond with its list of API versions. This is usually the result of domain changes like activating MyDomain or Enhanced Domains"], ["noApiVersionsError.actions", "Re-authenticate to the org."]]));
|
|
26
27
|
const clientId = `sfdx toolbelt:${process.env.SFDX_SET_CLIENT_IDS ?? ''}`;
|
|
27
28
|
exports.SFDX_HTTP_HEADERS = {
|
|
28
29
|
'content-type': 'application/json',
|
|
29
|
-
|
|
30
|
+
// web browser security keeps you from setting user-agent
|
|
31
|
+
...(global_1.Global.isWeb ? {} : { 'user-agent': clientId }),
|
|
30
32
|
};
|
|
31
33
|
exports.DNS_ERROR_NAME = 'DomainNotFoundError';
|
|
32
34
|
/**
|
|
@@ -173,7 +175,7 @@ class Connection extends jsforce_node_1.Connection {
|
|
|
173
175
|
return this.maxApiVersion;
|
|
174
176
|
}
|
|
175
177
|
await this.isResolvable();
|
|
176
|
-
this.logger.debug(`Fetching API versions supported for org: ${this.getUsername()}`);
|
|
178
|
+
this.logger.debug(`Fetching API versions supported for org: ${this.getUsername() ?? ''}`);
|
|
177
179
|
const versions = await this.request(`${this.instanceUrl}/services/data`);
|
|
178
180
|
// if the server doesn't return a list of versions, it's possibly a instanceUrl issue where the local file is out of date.
|
|
179
181
|
if (!Array.isArray(versions)) {
|
|
@@ -372,7 +374,7 @@ class Connection extends jsforce_node_1.Connection {
|
|
|
372
374
|
if (lastChecked) {
|
|
373
375
|
const now = new Date();
|
|
374
376
|
const has24HoursPastSinceLastCheck = now.getTime() - lastChecked > kit_1.Duration.hours(24).milliseconds;
|
|
375
|
-
this.logger.debug(`API version cache last checked on ${lastCheckedDateString} (now is ${now.toLocaleString()})`);
|
|
377
|
+
this.logger.debug(`API version cache last checked on ${lastCheckedDateString ?? '<undefined>'} (now is ${now.toLocaleString()})`);
|
|
376
378
|
if (!has24HoursPastSinceLastCheck && version) {
|
|
377
379
|
// return cached API version
|
|
378
380
|
this.logger.debug(`Using cached API version: ${version}`);
|
package/lib/org/org.js
CHANGED
|
@@ -29,16 +29,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
__setModuleDefault(result, mod);
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
-
};
|
|
35
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
33
|
exports.Org = exports.SandboxEvents = exports.OrgTypes = void 0;
|
|
37
34
|
exports.sandboxIsResumable = sandboxIsResumable;
|
|
38
|
-
const
|
|
39
|
-
const fs = __importStar(require("node:fs"));
|
|
35
|
+
const path = __importStar(require("node:path"));
|
|
40
36
|
const kit_1 = require("@salesforce/kit");
|
|
41
37
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
38
|
+
const fs_1 = require("../fs/fs");
|
|
42
39
|
const config_1 = require("../config/config");
|
|
43
40
|
const configAggregator_1 = require("../config/configAggregator");
|
|
44
41
|
const orgUsersConfig_1 = require("../config/orgUsersConfig");
|
|
@@ -175,13 +172,13 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
175
172
|
* @file Absolute file path to the metadata file
|
|
176
173
|
*/
|
|
177
174
|
async getMetadataUIURL(typeName, file) {
|
|
178
|
-
const botFileNameToId = async (conn, filePath) => (await conn.singleRecordQuery(`SELECT id FROM BotDefinition WHERE DeveloperName='${
|
|
175
|
+
const botFileNameToId = async (conn, filePath) => (await conn.singleRecordQuery(`SELECT id FROM BotDefinition WHERE DeveloperName='${path.basename(filePath, '.bot-meta.xml')}'`)).Id;
|
|
179
176
|
/** query flexipage via toolingAPI to get its ID (starts with 0M0) */
|
|
180
|
-
const flexiPageFilenameToId = async (conn, filePath) => (await conn.singleRecordQuery(`SELECT id FROM flexipage WHERE DeveloperName='${
|
|
177
|
+
const flexiPageFilenameToId = async (conn, filePath) => (await conn.singleRecordQuery(`SELECT id FROM flexipage WHERE DeveloperName='${path.basename(filePath, '.flexipage-meta.xml')}'`, { tooling: true })).Id;
|
|
181
178
|
/** query the rest API to turn a flow's filepath into a FlowId (starts with 301) */
|
|
182
179
|
const flowFileNameToId = async (conn, filePath) => {
|
|
183
180
|
try {
|
|
184
|
-
const flow = await conn.singleRecordQuery(`SELECT DurableId FROM FlowVersionView WHERE FlowDefinitionView.ApiName = '${
|
|
181
|
+
const flow = await conn.singleRecordQuery(`SELECT DurableId FROM FlowVersionView WHERE FlowDefinitionView.ApiName = '${path.basename(filePath, '.flow-meta.xml')}' ORDER BY VersionNumber DESC LIMIT 1`);
|
|
185
182
|
return flow.DurableId;
|
|
186
183
|
}
|
|
187
184
|
catch (error) {
|
|
@@ -190,7 +187,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
190
187
|
};
|
|
191
188
|
const customObjectFileNameToId = async (conn, filePath) => {
|
|
192
189
|
try {
|
|
193
|
-
const customObject = await conn.singleRecordQuery(`SELECT Id FROM CustomObject WHERE DeveloperName = '${
|
|
190
|
+
const customObject = await conn.singleRecordQuery(`SELECT Id FROM CustomObject WHERE DeveloperName = '${path.basename(filePath.replace(/__c/g, ''), '.object-meta.xml')}'`, {
|
|
194
191
|
tooling: true,
|
|
195
192
|
});
|
|
196
193
|
return customObject.Id;
|
|
@@ -201,7 +198,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
201
198
|
};
|
|
202
199
|
const apexClassFileNameToId = async (conn, filePath) => {
|
|
203
200
|
try {
|
|
204
|
-
const apexClass = await conn.singleRecordQuery(`SELECT Id FROM ApexClass WHERE Name = '${
|
|
201
|
+
const apexClass = await conn.singleRecordQuery(`SELECT Id FROM ApexClass WHERE Name = '${path.basename(filePath, '.cls')}'`, {
|
|
205
202
|
tooling: true,
|
|
206
203
|
});
|
|
207
204
|
return apexClass.Id;
|
|
@@ -222,7 +219,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
222
219
|
redirectUri = `/AiCopilot/copilotStudio.app#/copilot/builder?copilotId=${await botFileNameToId(this.connection, file)}`;
|
|
223
220
|
break;
|
|
224
221
|
case 'ApexPage':
|
|
225
|
-
redirectUri = `/apex/${
|
|
222
|
+
redirectUri = `/apex/${path.basename(file).replace('.page-meta.xml', '').replace('.page', '')}`;
|
|
226
223
|
break;
|
|
227
224
|
case 'Flow':
|
|
228
225
|
redirectUri = `/builder_platform_interaction/flowBuilder.app?flowId=${await flowFileNameToId(this.connection, file)}`;
|
|
@@ -459,7 +456,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
459
456
|
}
|
|
460
457
|
throw err;
|
|
461
458
|
}
|
|
462
|
-
return this.manageDelete(async () => fs.promises.rmdir(dataPath), dataPath, throwWhenRemoveFails);
|
|
459
|
+
return this.manageDelete(async () => fs_1.fs.promises.rmdir(dataPath), dataPath, throwWhenRemoveFails);
|
|
463
460
|
}
|
|
464
461
|
/**
|
|
465
462
|
* @ignore
|
|
@@ -512,7 +509,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
512
509
|
const devHubConnection = (await Org.create({ aliasOrUsername })).getConnection();
|
|
513
510
|
const thisOrgAuthConfig = this.getConnection().getAuthInfoFields();
|
|
514
511
|
const trimmedId = (0, sfdc_1.trimTo15)(thisOrgAuthConfig.orgId);
|
|
515
|
-
const DEV_HUB_SOQL = `SELECT CreatedDate,Edition,ExpirationDate FROM ActiveScratchOrg WHERE ScratchOrg='${trimmedId}'`;
|
|
512
|
+
const DEV_HUB_SOQL = `SELECT CreatedDate,Edition,ExpirationDate FROM ActiveScratchOrg WHERE ScratchOrg='${trimmedId ?? '<undefined>'}'`;
|
|
516
513
|
try {
|
|
517
514
|
const results = await devHubConnection.query(DEV_HUB_SOQL);
|
|
518
515
|
if (results.records.length !== 1) {
|
|
@@ -732,7 +729,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
732
729
|
throw new sfError_1.SfError(`Invalid Salesforce ID format: ${by.id}`, 'InvalidSalesforceId');
|
|
733
730
|
}
|
|
734
731
|
}
|
|
735
|
-
const whereClause = by.id ? `Id='${by.id}'` : `SandboxName='${by.name}'`;
|
|
732
|
+
const whereClause = by.id ? `Id='${by.id}'` : `SandboxName='${by.name ?? '<undefined>'}'`;
|
|
736
733
|
const soql = `SELECT ${sandboxInfoFields.join(',')} FROM SandboxInfo WHERE ${whereClause} ORDER BY CreatedDate DESC`;
|
|
737
734
|
const result = (await this.connection.tooling.query(soql)).records.filter((item) => !item.IsDeleted);
|
|
738
735
|
if (result.length === 0) {
|
|
@@ -819,7 +816,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
819
816
|
throw new sfError_1.SfError('Missing auth info', 'MissingAuthInfo');
|
|
820
817
|
}
|
|
821
818
|
const authInfo = (0, ts_types_1.isString)(auth) ? await authInfo_1.AuthInfo.create({ username: auth }) : auth;
|
|
822
|
-
this.logger.debug(`adding username ${authInfo.getFields().username}`);
|
|
819
|
+
this.logger.debug(`adding username ${authInfo.getFields().username ?? '<undefined>'}`);
|
|
823
820
|
const orgConfig = await this.retrieveOrgUsersConfig();
|
|
824
821
|
const contents = await orgConfig.read();
|
|
825
822
|
// TODO: This is kind of screwy because contents values can be `AnyJson | object`...
|
|
@@ -857,7 +854,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
857
854
|
throw new sfError_1.SfError('Missing auth info', 'MissingAuthInfoError');
|
|
858
855
|
}
|
|
859
856
|
const authInfo = (0, ts_types_1.isString)(auth) ? await authInfo_1.AuthInfo.create({ username: auth }) : auth;
|
|
860
|
-
this.logger.debug(`removing username ${authInfo.getFields().username}`);
|
|
857
|
+
this.logger.debug(`removing username ${authInfo.getFields().username ?? '<undefined>'}`);
|
|
861
858
|
const orgConfig = await this.retrieveOrgUsersConfig();
|
|
862
859
|
const contents = await orgConfig.read();
|
|
863
860
|
const targetUser = authInfo.getFields().username;
|
|
@@ -1033,7 +1030,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
1033
1030
|
}
|
|
1034
1031
|
async getLocalDataDir(orgDataPath) {
|
|
1035
1032
|
const rootFolder = await config_1.Config.resolveRootFolder(false);
|
|
1036
|
-
return
|
|
1033
|
+
return path.join(rootFolder, global_1.Global.SFDX_STATE_FOLDER, orgDataPath ? orgDataPath : 'orgs');
|
|
1037
1034
|
}
|
|
1038
1035
|
/**
|
|
1039
1036
|
* Gets the sandboxProcessObject and then polls for it to complete.
|
|
@@ -1114,7 +1111,8 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
1114
1111
|
let result;
|
|
1115
1112
|
try {
|
|
1116
1113
|
// grab sandboxName from config or try to calculate from the sandbox username
|
|
1117
|
-
const sandboxName = sandbox?.sandboxName ??
|
|
1114
|
+
const sandboxName = sandbox?.sandboxName ??
|
|
1115
|
+
(this.getUsername() ?? '').split(`${resolvedProdOrg.getUsername() ?? '<undefined>'}.`)[1];
|
|
1118
1116
|
if (!sandboxName) {
|
|
1119
1117
|
this.logger.debug('Sandbox name is not available');
|
|
1120
1118
|
// jump to query by orgId
|
|
@@ -1170,7 +1168,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
1170
1168
|
}
|
|
1171
1169
|
try {
|
|
1172
1170
|
const devHubConn = resolvedDevHub.getConnection();
|
|
1173
|
-
const username = this.getUsername();
|
|
1171
|
+
const username = (0, ts_types_1.ensureString)(this.getUsername(), 'org is missing username');
|
|
1174
1172
|
const activeScratchOrgRecordId = (await devHubConn.singleRecordQuery(`SELECT Id FROM ActiveScratchOrg WHERE SignupUsername='${username}'`)).Id;
|
|
1175
1173
|
this.logger.trace(`found matching ActiveScratchOrg with SignupUsername: ${username}. Deleting...`);
|
|
1176
1174
|
await this.destroyScratchOrg(resolvedDevHub, activeScratchOrgRecordId);
|
|
@@ -1459,7 +1457,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
1459
1457
|
async removeSourceTrackingFiles() {
|
|
1460
1458
|
try {
|
|
1461
1459
|
const rootFolder = await config_1.Config.resolveRootFolder(false);
|
|
1462
|
-
await fs.promises.rm(
|
|
1460
|
+
await fs_1.fs.promises.rm(path.join(rootFolder, global_1.Global.SF_STATE_FOLDER, 'orgs', this.getOrgId()), {
|
|
1463
1461
|
recursive: true,
|
|
1464
1462
|
force: true,
|
|
1465
1463
|
});
|
|
@@ -98,23 +98,19 @@ class PermissionSetAssignment {
|
|
|
98
98
|
*/
|
|
99
99
|
parsePermissionSetString(permSetString) {
|
|
100
100
|
const nsPrefixMatch = RegExp(/(\w+(?=__))(__)(.*)/).exec(permSetString);
|
|
101
|
-
let nsPrefix;
|
|
102
|
-
let permSetName;
|
|
103
101
|
if (nsPrefixMatch) {
|
|
104
102
|
try {
|
|
105
|
-
nsPrefix = nsPrefixMatch[1];
|
|
106
|
-
permSetName = nsPrefixMatch[3];
|
|
103
|
+
const nsPrefix = nsPrefixMatch[1];
|
|
104
|
+
const permSetName = nsPrefixMatch[3];
|
|
107
105
|
this.logger.debug(`Using namespacePrefix ${nsPrefix} for permission set ${permSetName}`);
|
|
106
|
+
return { nsPrefix, permSetName };
|
|
108
107
|
}
|
|
109
108
|
catch (e) {
|
|
110
109
|
// Don't fail if we parse wrong.
|
|
111
110
|
this.logger.debug(e);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
|
-
|
|
115
|
-
permSetName = permSetString;
|
|
116
|
-
}
|
|
117
|
-
return { nsPrefix, permSetName };
|
|
113
|
+
return { nsPrefix: undefined, permSetName: permSetString };
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
116
|
exports.PermissionSetAssignment = PermissionSetAssignment;
|
|
@@ -192,7 +192,7 @@ const scratchOrgCreate = async (options) => {
|
|
|
192
192
|
// we'll need this scratch org connection later;
|
|
193
193
|
const scratchOrg = await org_1.Org.create({ aliasOrUsername: soi.Username ?? soi.SignupUsername });
|
|
194
194
|
const username = scratchOrg.getUsername();
|
|
195
|
-
logger.debug(`scratch org username ${username}`);
|
|
195
|
+
logger.debug(`scratch org username ${username ?? '<undefined>'}`);
|
|
196
196
|
await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'deploy settings', scratchOrgInfo: soi });
|
|
197
197
|
const configAggregator = await configAggregator_1.ConfigAggregator.create();
|
|
198
198
|
const [authInfo] = await setExitCodeIfError(68)(Promise.all([
|
|
@@ -65,7 +65,7 @@ const buildOAuth2Options = async (options) => {
|
|
|
65
65
|
loginUrl: getOrgInstanceAuthority(options.scratchOrgInfoComplete, options.hubOrg.getField(org_1.Org.Fields.LOGIN_URL), options.signupTargetLoginUrl),
|
|
66
66
|
};
|
|
67
67
|
logger.debug(`isJwtFlow: ${isJwtFlow}`);
|
|
68
|
-
logger.debug(`using resolved loginUrl: ${oauth2Options.loginUrl}`);
|
|
68
|
+
logger.debug(`using resolved loginUrl: ${oauth2Options.loginUrl ?? '<undefined>'}`);
|
|
69
69
|
if (isJwtFlow && !process.env.SFDX_CLIENT_SECRET) {
|
|
70
70
|
oauth2Options.privateKeyFile = options.hubOrg.getConnection().getAuthInfoFields().privateKey;
|
|
71
71
|
const retries = options?.retry ?? kit_1.env.getNumber('SFDX_JWT_AUTH_RETRY_ATTEMPTS') ?? 0;
|
|
@@ -187,7 +187,7 @@ const authorizeScratchOrg = async (options) => {
|
|
|
187
187
|
// If we didn't already try authenticating with the LoginUrl from ScratchOrgInfo object,
|
|
188
188
|
// try the oauth flow again using it now.
|
|
189
189
|
if (scratchOrgInfoComplete.LoginUrl && oAuth2Options.options.loginUrl !== scratchOrgInfoComplete.LoginUrl) {
|
|
190
|
-
logger.debug(`Auth failed with loginUrl ${oAuth2Options.options.loginUrl} so trying with ${scratchOrgInfoComplete.LoginUrl}`);
|
|
190
|
+
logger.debug(`Auth failed with loginUrl ${oAuth2Options.options.loginUrl ?? '<undefined>'} so trying with ${scratchOrgInfoComplete.LoginUrl}`);
|
|
191
191
|
oAuth2Options.options = { ...oAuth2Options.options, ...{ loginUrl: scratchOrgInfoComplete.LoginUrl } };
|
|
192
192
|
try {
|
|
193
193
|
authInfo = await getAuthInfo({
|
|
@@ -7,9 +7,9 @@ exports.getScratchOrgInfoPayload = exports.generateScratchOrgInfo = exports.getA
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const node_fs_1 = require("node:fs");
|
|
11
10
|
const kit_1 = require("@salesforce/kit");
|
|
12
11
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
|
+
const fs_1 = require("../fs/fs");
|
|
13
13
|
const sfProject_1 = require("../sfProject");
|
|
14
14
|
const webOAuthServer_1 = require("../webOAuthServer");
|
|
15
15
|
const messages_1 = require("../messages");
|
|
@@ -122,7 +122,7 @@ const getAncestorIds = async (scratchOrgInfo, projectJson, hubOrg) => {
|
|
|
122
122
|
if (packageDir.ancestorId && packageAliases?.[packageDir.ancestorId]) {
|
|
123
123
|
return packageAliases[packageDir.ancestorId];
|
|
124
124
|
}
|
|
125
|
-
throw new sfError_1.SfError(`Invalid ancestorId ${packageDir.ancestorId}`, 'InvalidAncestorId');
|
|
125
|
+
throw new sfError_1.SfError(`Invalid ancestorId ${packageDir.ancestorId ?? '<undefined>'}`, 'InvalidAncestorId');
|
|
126
126
|
}));
|
|
127
127
|
// strip out '' due to NONE
|
|
128
128
|
return Array.from(new Set(ancestorIds.filter((id) => id !== ''))).join(';');
|
|
@@ -223,7 +223,7 @@ const getScratchOrgInfoPayload = async (options) => {
|
|
|
223
223
|
exports.getScratchOrgInfoPayload = getScratchOrgInfoPayload;
|
|
224
224
|
const parseDefinitionFile = async (definitionFile) => {
|
|
225
225
|
try {
|
|
226
|
-
const fileData = await
|
|
226
|
+
const fileData = await fs_1.fs.promises.readFile(definitionFile, 'utf8');
|
|
227
227
|
const defFileContents = (0, kit_1.parseJson)(fileData);
|
|
228
228
|
// remove key '$schema' from the definition file
|
|
229
229
|
delete defFileContents['$schema'];
|
|
@@ -276,7 +276,7 @@ class SettingsGenerator {
|
|
|
276
276
|
.map((failure) => `[${failure.problemType}] ${failure.fullName} : ${failure.problem} `)
|
|
277
277
|
.join('\n');
|
|
278
278
|
throw sfError_1.SfError.create({
|
|
279
|
-
message: `A scratch org was created with username ${username}, but the settings failed to deploy due to: \n${failures}`,
|
|
279
|
+
message: `A scratch org was created with username ${username ?? '<undefined>'}, but the settings failed to deploy due to: \n${failures}`,
|
|
280
280
|
name: 'ProblemDeployingSettings',
|
|
281
281
|
data: { ...result, username },
|
|
282
282
|
});
|
package/lib/org/user.js
CHANGED
|
@@ -213,7 +213,7 @@ class User extends kit_1.AsyncCreatable {
|
|
|
213
213
|
* @param password [throwWhenRemoveFails = User.generatePasswordUtf8()] A SecureBuffer containing the new password.
|
|
214
214
|
*/
|
|
215
215
|
async assignPassword(info, password = User.generatePasswordUtf8()) {
|
|
216
|
-
this.logger.debug(`Attempting to set password for userId: ${info.getFields().userId} username: ${info.getFields().username}`);
|
|
216
|
+
this.logger.debug(`Attempting to set password for userId: ${info.getFields().userId ?? '<undefined>'} username: ${info.getFields().username ?? '<undefined>'}`);
|
|
217
217
|
const userConnection = await connection_1.Connection.create({ authInfo: info });
|
|
218
218
|
return new Promise((resolve, reject) => {
|
|
219
219
|
// no promises in async method
|
|
@@ -221,8 +221,9 @@ class User extends kit_1.AsyncCreatable {
|
|
|
221
221
|
password.value(async (buffer) => {
|
|
222
222
|
try {
|
|
223
223
|
const soap = userConnection.soap;
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
const userId = (0, ts_types_1.ensureString)(info.getFields().userId);
|
|
225
|
+
await soap.setPassword(userId, buffer.toString('utf8'));
|
|
226
|
+
this.logger.debug(`Set password for userId: ${userId}`);
|
|
226
227
|
resolve();
|
|
227
228
|
}
|
|
228
229
|
catch (e) {
|
package/lib/schema/validator.js
CHANGED
|
@@ -34,9 +34,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.SchemaValidator = void 0;
|
|
36
36
|
const path = __importStar(require("node:path"));
|
|
37
|
-
const fs = __importStar(require("node:fs"));
|
|
38
37
|
const ajv_1 = __importDefault(require("ajv"));
|
|
39
38
|
const kit_1 = require("@salesforce/kit");
|
|
39
|
+
const fs_1 = require("../fs/fs");
|
|
40
40
|
const sfError_1 = require("../sfError");
|
|
41
41
|
/**
|
|
42
42
|
* Loads a JSON schema and performs validations against JSON objects.
|
|
@@ -62,7 +62,7 @@ class SchemaValidator {
|
|
|
62
62
|
*/
|
|
63
63
|
async load() {
|
|
64
64
|
if (!this.schema) {
|
|
65
|
-
this.schema = (0, kit_1.parseJsonMap)(await fs.promises.readFile(this.schemaPath, 'utf8'));
|
|
65
|
+
this.schema = (0, kit_1.parseJsonMap)(await fs_1.fs.promises.readFile(this.schemaPath, 'utf8'));
|
|
66
66
|
this.logger.debug(`Schema loaded for ${this.schemaPath}`);
|
|
67
67
|
}
|
|
68
68
|
return this.schema;
|
|
@@ -72,7 +72,7 @@ class SchemaValidator {
|
|
|
72
72
|
*/
|
|
73
73
|
loadSync() {
|
|
74
74
|
if (!this.schema) {
|
|
75
|
-
this.schema = (0, kit_1.parseJsonMap)(fs.readFileSync(this.schemaPath, 'utf8'));
|
|
75
|
+
this.schema = (0, kit_1.parseJsonMap)(fs_1.fs.readFileSync(this.schemaPath, 'utf8'));
|
|
76
76
|
this.logger.debug(`Schema loaded for ${this.schemaPath}`);
|
|
77
77
|
}
|
|
78
78
|
return this.schema;
|
|
@@ -165,7 +165,7 @@ class SchemaValidator {
|
|
|
165
165
|
loadExternalSchema(uri) {
|
|
166
166
|
const schemaPath = path.join(this.schemasDir, `${uri}.json`);
|
|
167
167
|
try {
|
|
168
|
-
return (0, kit_1.parseJsonMap)(fs.readFileSync(schemaPath, 'utf8'));
|
|
168
|
+
return (0, kit_1.parseJsonMap)(fs_1.fs.readFileSync(schemaPath, 'utf8'));
|
|
169
169
|
}
|
|
170
170
|
catch (err) {
|
|
171
171
|
if (err.code === 'ENOENT') {
|
|
@@ -184,7 +184,7 @@ class SchemaValidator {
|
|
|
184
184
|
getErrorsText(errors) {
|
|
185
185
|
return errors
|
|
186
186
|
.map((error) => {
|
|
187
|
-
const msg = `${error.schemaPath}: ${error.message}`;
|
|
187
|
+
const msg = `${error.schemaPath}: ${error.message ?? '<no error message>'}`;
|
|
188
188
|
switch (error.keyword) {
|
|
189
189
|
case 'additionalProperties':
|
|
190
190
|
return `${msg} '${error.params.additionalProperty}'`;
|
package/lib/sfProject.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.isNamedPackagingDirectory = exports.isPackagingDirectory = exports.SfProject = exports.SfProjectJson = void 0;
|
|
27
4
|
/*
|
|
@@ -31,9 +8,9 @@ exports.isNamedPackagingDirectory = exports.isPackagingDirectory = exports.SfPro
|
|
|
31
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
32
9
|
*/
|
|
33
10
|
const node_path_1 = require("node:path");
|
|
34
|
-
const fs = __importStar(require("node:fs"));
|
|
35
11
|
const kit_1 = require("@salesforce/kit");
|
|
36
12
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
13
|
+
const fs_1 = require("./fs/fs");
|
|
37
14
|
const sfdcUrl_1 = require("./util/sfdcUrl");
|
|
38
15
|
const configAggregator_1 = require("./config/configAggregator");
|
|
39
16
|
const configFile_1 = require("./config/configFile");
|
|
@@ -307,7 +284,7 @@ class SfProjectJson extends configFile_1.ConfigFile {
|
|
|
307
284
|
// keep it because testSetup stubs it!
|
|
308
285
|
// eslint-disable-next-line class-methods-use-this
|
|
309
286
|
doesPackageExist(packagePath) {
|
|
310
|
-
return fs.existsSync(packagePath);
|
|
287
|
+
return fs_1.fs.existsSync(packagePath);
|
|
311
288
|
}
|
|
312
289
|
validateKeys() {
|
|
313
290
|
(0, findUppercaseKeys_1.ensureNoUppercaseKeys)(this.getPath())(SfProjectJson.BLOCKLIST)(this.toObject());
|
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.getFileLocation = exports.AliasAccessor = exports.FILENAME = exports.DEFAULT_GROUP = void 0;
|
|
10
10
|
const node_path_1 = require("node:path");
|
|
11
11
|
const node_os_1 = require("node:os");
|
|
12
|
-
const promises_1 = require("node:fs/promises");
|
|
13
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const fs_1 = require("../../fs/fs");
|
|
14
14
|
const global_1 = require("../../global");
|
|
15
15
|
const sfError_1 = require("../../sfError");
|
|
16
16
|
const fileLocking_1 = require("../../util/fileLocking");
|
|
@@ -104,7 +104,7 @@ class AliasAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
104
104
|
*/
|
|
105
105
|
async unsetAndSave(alias) {
|
|
106
106
|
const lockResponse = await (0, fileLocking_1.lockInit)(this.fileLocation);
|
|
107
|
-
await this.readFileToAliasStore();
|
|
107
|
+
await this.readFileToAliasStore(false);
|
|
108
108
|
this.aliasStore.delete(alias);
|
|
109
109
|
return lockResponse.writeAndUnlock(aliasStoreToRawFileContents(this.aliasStore));
|
|
110
110
|
}
|
|
@@ -115,7 +115,7 @@ class AliasAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
115
115
|
*/
|
|
116
116
|
async unsetValuesAndSave(aliasees) {
|
|
117
117
|
const lockResponse = await (0, fileLocking_1.lockInit)(this.fileLocation);
|
|
118
|
-
await this.readFileToAliasStore();
|
|
118
|
+
await this.readFileToAliasStore(false);
|
|
119
119
|
(0, kit_1.ensureArray)(aliasees)
|
|
120
120
|
.flatMap((a) => this.getAll(a))
|
|
121
121
|
.map((a) => this.aliasStore.delete(a));
|
|
@@ -137,15 +137,22 @@ class AliasAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
137
137
|
* go to the fileSystem and read the file, storing a copy in the class's store
|
|
138
138
|
* if the file doesn't exist, create it empty
|
|
139
139
|
*/
|
|
140
|
-
async readFileToAliasStore() {
|
|
140
|
+
async readFileToAliasStore(useLock = false) {
|
|
141
|
+
const lockResponse = useLock ? await (0, fileLocking_1.lockInit)(this.fileLocation) : undefined;
|
|
141
142
|
try {
|
|
142
|
-
this.aliasStore = fileContentsRawToAliasStore(await
|
|
143
|
+
this.aliasStore = fileContentsRawToAliasStore(await fs_1.fs.promises.readFile(this.fileLocation, 'utf-8'));
|
|
144
|
+
if (lockResponse)
|
|
145
|
+
return await lockResponse.unlock();
|
|
143
146
|
}
|
|
144
147
|
catch (e) {
|
|
145
148
|
if (e instanceof Error && 'code' in e && typeof e.code === 'string' && ['ENOENT', 'ENOTDIR'].includes(e.code)) {
|
|
146
|
-
await
|
|
149
|
+
await fs_1.fs.promises.mkdir((0, node_path_1.dirname)(this.fileLocation), { recursive: true });
|
|
147
150
|
this.aliasStore = new Map();
|
|
148
|
-
|
|
151
|
+
await fs_1.fs.promises.writeFile(this.fileLocation, aliasStoreToRawFileContents(this.aliasStore));
|
|
152
|
+
return lockResponse ? await lockResponse.unlock() : undefined;
|
|
153
|
+
}
|
|
154
|
+
if (lockResponse) {
|
|
155
|
+
await lockResponse.unlock();
|
|
149
156
|
}
|
|
150
157
|
throw e;
|
|
151
158
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
1
|
import { Nullable } from '@salesforce/ts-types';
|
|
3
2
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
3
|
+
import { fs } from '../../fs/fs';
|
|
4
4
|
import { AuthInfoConfig } from '../../config/authInfoConfig';
|
|
5
5
|
import { AuthFields } from '../../org/authInfo';
|
|
6
6
|
import { ConfigFile } from '../../config/configFile';
|
|
@@ -49,7 +49,7 @@ export declare abstract class BaseOrgAccessor<T extends ConfigFile, P extends Co
|
|
|
49
49
|
*
|
|
50
50
|
* @param username
|
|
51
51
|
*/
|
|
52
|
-
stat(username: string): Promise<Nullable<fs.
|
|
52
|
+
stat(username: string): Promise<Nullable<Awaited<ReturnType<typeof fs.promises.stat>>>>;
|
|
53
53
|
/**
|
|
54
54
|
* Returns true if there is an auth file for the given username
|
|
55
55
|
*
|
|
@@ -30,10 +30,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.OrgAccessor = exports.BaseOrgAccessor = void 0;
|
|
33
|
-
const fs = __importStar(require("node:fs"));
|
|
34
33
|
const path = __importStar(require("node:path"));
|
|
35
34
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
36
35
|
const kit_1 = require("@salesforce/kit");
|
|
36
|
+
const fs_1 = require("../../fs/fs");
|
|
37
37
|
const authInfoConfig_1 = require("../../config/authInfoConfig");
|
|
38
38
|
const global_1 = require("../../global");
|
|
39
39
|
const logger_1 = require("../../logger/logger");
|
|
@@ -165,7 +165,7 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
165
165
|
*/
|
|
166
166
|
async hasFile(username) {
|
|
167
167
|
try {
|
|
168
|
-
await fs.promises.access(this.parseFilename(username));
|
|
168
|
+
await fs_1.fs.promises.access(this.parseFilename(username));
|
|
169
169
|
return true;
|
|
170
170
|
}
|
|
171
171
|
catch {
|
|
@@ -247,7 +247,7 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
247
247
|
async getAllFiles() {
|
|
248
248
|
const regex = this.getFileRegex();
|
|
249
249
|
try {
|
|
250
|
-
return (await fs.promises.readdir(global_1.Global.DIR)).filter((file) => regex.test(file));
|
|
250
|
+
return (await fs_1.fs.promises.readdir(global_1.Global.DIR)).filter((file) => regex.test(file));
|
|
251
251
|
}
|
|
252
252
|
catch {
|
|
253
253
|
return [];
|
|
@@ -38,8 +38,6 @@ export declare class MyDomainResolver extends AsyncOptionalCreatable<MyDomainRes
|
|
|
38
38
|
* executing the dns loookup.
|
|
39
39
|
*/
|
|
40
40
|
resolve(): Promise<string>;
|
|
41
|
-
/** @deprecated there is nothing using this in forcedotcom, salesforcecli, or public github search */
|
|
42
|
-
getCnames(): Promise<string[]>;
|
|
43
41
|
/**
|
|
44
42
|
* Used to initialize asynchronous components.
|
|
45
43
|
*/
|
|
@@ -111,18 +111,6 @@ class MyDomainResolver extends kit_1.AsyncOptionalCreatable {
|
|
|
111
111
|
const client = await pollingClient_1.PollingClient.create(pollingOptions);
|
|
112
112
|
return (0, ts_types_1.ensureString)(await client.subscribe());
|
|
113
113
|
}
|
|
114
|
-
/** @deprecated there is nothing using this in forcedotcom, salesforcecli, or public github search */
|
|
115
|
-
async getCnames() {
|
|
116
|
-
try {
|
|
117
|
-
await this.resolve();
|
|
118
|
-
return await (0, node_util_1.promisify)(node_dns_1.resolveCname)(this.options.url.host);
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
this.logger.debug(`An error occurred trying to resolve: ${this.options.url.host}`);
|
|
122
|
-
this.logger.debug(`Error: ${e.message}`);
|
|
123
|
-
return [];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
114
|
/**
|
|
127
115
|
* Used to initialize asynchronous components.
|
|
128
116
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AsyncOptionalCreatable, Duration, Env } from '@salesforce/kit
|
|
2
|
-
import { AnyJson } from '@salesforce/ts-types
|
|
1
|
+
import { AsyncOptionalCreatable, Duration, Env } from '@salesforce/kit';
|
|
2
|
+
import { AnyJson } from '@salesforce/ts-types';
|
|
3
3
|
import { Org } from '../org/org';
|
|
4
4
|
import { CometClient, CometSubscription, Message, StatusResult, StreamingExtension, StreamProcessor } from './types';
|
|
5
5
|
export { CometClient, CometSubscription, Message, StatusResult, StreamingExtension, StreamProcessor };
|