@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
29 lines • 1.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
const url_1 = require("url");
const kit_1 = require("@salesforce/kit");
const myDomainResolver_1 = require("../status/myDomainResolver");
const sfdcUrl_1 = require("./sfdcUrl");
async function checkLightningDomain(url) {
const domain = `https://${/https?:\/\/([^.]*)/.exec(url)?.slice(1, 2).pop()}.lightning.force.com`;
const quantity = new kit_1.Env().getNumber('SFDX_DOMAIN_RETRY', 240) ?? 0;
const timeout = new kit_1.Duration(quantity, kit_1.Duration.Unit.SECONDS);
if (new sfdcUrl_1.SfdcUrl(url).isInternalUrl() || timeout.seconds === 0) {
return true;
}
const resolver = await myDomainResolver_1.MyDomainResolver.create({
url: new url_1.URL(domain),
timeout,
frequency: new kit_1.Duration(1, kit_1.Duration.Unit.SECONDS),
});
await resolver.resolve();
return true;
}
exports.default = checkLightningDomain;
//# sourceMappingURL=checkLightningDomain.js.map