UNPKG

@salesforce/core

Version:

Core libraries to interact with SFDX projects, orgs, and APIs.

30 lines 1.32 kB
"use strict"; 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 sfdc_1 = require("./sfdc"); async function checkLightningDomain(url) { var _a, _b; const domain = `https://${(_a = /https?:\/\/([^.]*)/.exec(url)) === null || _a === void 0 ? void 0 : _a.slice(1, 2).pop()}.lightning.force.com`; const quantity = (_b = new kit_1.Env().getNumber('SFDX_DOMAIN_RETRY', 240)) !== null && _b !== void 0 ? _b : 0; const timeout = new kit_1.Duration(quantity, kit_1.Duration.Unit.SECONDS); if (sfdc_1.sfdc.isInternalUrl(url) || 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