UNPKG

2.93 kBTypeScriptView Raw
1/// <reference types="node" />
2import { URL } from 'url';
3export declare function getLoginAudienceCombos(audienceUrl: string, loginUrl: string): [string, string][];
4export declare class SfdcUrl extends URL {
5 /**
6 * Salesforce URLs
7 */
8 static readonly SANDBOX = "https://test.salesforce.com";
9 static readonly PRODUCTION = "https://login.salesforce.com";
10 private static readonly cache;
11 private logger;
12 constructor(input: string | URL, base?: string | URL);
13 static isValidUrl(input: string | URL): boolean;
14 /**
15 * Returns the appropriate jwt audience url for this url
16 * Use SFDX_AUDIENCE_URL env var to override the audience url
17 *
18 * @param createdOrgInstance The Salesforce instance the org was created on. e.g. `cs42`
19 * @return {Promise<string>} The audience url
20 */
21 getJwtAudienceUrl(createdOrgInstance?: string): Promise<string>;
22 /**
23 * Tests whether this url contains a Salesforce owned domain
24 *
25 * @return {boolean} true if this is a salesforce domain
26 */
27 isSalesforceDomain(): boolean;
28 /**
29 * Tests whether this url is an internal Salesforce domain
30 *
31 * @returns {boolean} true if this is an internal domain
32 */
33 isInternalUrl(): boolean;
34 /**
35 * Tests whether this url runs on a local machine
36 *
37 * @returns {boolean} true if this is a local machine
38 */
39 isLocalUrl(): boolean;
40 toLightningDomain(): string;
41 /**
42 * Tests whether this url has the lightning domain extension
43 * This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
44 * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
45 *
46 * @returns {Promise<true | never>} The resolved ip address or never
47 * @throws {@link SfError} If can't resolve DNS.
48 */
49 checkLightningDomain(): Promise<true | never>;
50 /**
51 * Method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
52 * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
53 *
54 * @returns the resolved ip address.
55 * @throws {@link SfError} If can't resolve DNS.
56 */
57 lookup(): Promise<string>;
58 /**
59 * Tests whether this url is a sandbox url
60 *
61 * @Deprecated - identification of a sandbox instance by URL alone is not deterministic
62 * @param createdOrgInstance The Salesforce instance the org was created on. e.g. `cs42`
63 * @returns {boolean}
64 */
65 isSandboxUrl(createdOrgInstance?: string): boolean;
66 /**
67 * Test whether this url represents a lightning domain
68 *
69 * @returns {boolean} true if this domain is a lightning domain
70 */
71 isLightningDomain(): boolean;
72}