UNPKG

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