UNPKG

2.19 kBTypeScriptView Raw
1import { URL } from 'node:url';
2import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
3/**
4 * A class used to resolve MyDomains. After a ScratchOrg is created its host name my not be propagated to the
5 * Salesforce DNS service. This service is not exclusive to Salesforce My Domain URL and could be used for any hostname.
6 *
7 * ```
8 * (async () => {
9 * const options: MyDomainResolver.Options = {
10 * url: new URL('http://mydomain.salesforce.com'),
11 * timeout: Duration.minutes(5),
12 * frequency: Duration.seconds(10)
13 * };
14 * const resolver: MyDomainResolver = await MyDomainResolver.create(options);
15 * const ipAddress: AnyJson = await resolver.resolve();
16 * console.log(`Successfully resolved host: ${options.url} to address: ${ipAddress}`);
17 * })();
18 * ```
19 */
20export declare class MyDomainResolver extends AsyncOptionalCreatable<MyDomainResolver.Options> {
21 static DEFAULT_DOMAIN: URL;
22 private logger;
23 private options;
24 /**
25 * Constructor
26 * **Do not directly construct instances of this class -- use {@link MyDomainResolver.create} instead.**
27 *
28 * @param options The options for the class instance
29 */
30 constructor(options?: MyDomainResolver.Options);
31 getTimeout(): Duration;
32 getFrequency(): Duration;
33 /**
34 * Method that performs the dns lookup of the host. If the lookup fails the internal polling client will try again
35 * given the optional interval. Returns the resolved ip address.
36 *
37 * If SFDX_DISABLE_DNS_CHECK environment variable is set to true, it will immediately return the host without
38 * executing the dns loookup.
39 */
40 resolve(): Promise<string>;
41 getCnames(): Promise<string[]>;
42 /**
43 * Used to initialize asynchronous components.
44 */
45 protected init(): Promise<void>;
46}
47export declare namespace MyDomainResolver {
48 /**
49 * Options for the MyDomain DNS resolver.
50 */
51 type Options = {
52 /**
53 * The host to resolve.
54 */
55 url: URL;
56 /**
57 * The retry interval.
58 */
59 timeout?: Duration;
60 /**
61 * The retry timeout.
62 */
63 frequency?: Duration;
64 };
65}