@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
79 lines (78 loc) • 2.97 kB
TypeScript
/**
* It returns the environment variables of the environment
* where the Node process is running.
*
* This function exists to prevent the access of the process
* global variable which is discouraged via the no-process-env
* ESLint rule.
*
* @returns Current process environment variables.
*/
export declare function getEnvironmentVariables(): NodeJS.ProcessEnv;
/**
* Returns the value of the SHOPIFY_CLI_PARTNERS_TOKEN environment variable.
*
* @returns Current process environment variables.
*/
export declare function getPartnersToken(): string | undefined;
/**
* Check if the current proccess is running using the partners token.
*
* @returns True if the current proccess is running using the partners token.
*/
export declare function usePartnersToken(): boolean;
/**
* Returns the value of the organization id from the environment variables.
*
* @returns True if the current proccess is running using the partners token.
*/
export declare function getOrganization(): string | undefined;
/**
* Return the backend port value.
*
* @returns The port as a number. Undefined otherwise.
*/
export declare function getBackendPort(): number | undefined;
/**
* Returns the information of the identity & refresh tokens, provided by environment variables.
*
* @returns The identity token information in case it exists.
*/
export declare function getIdentityTokenInformation(): {
accessToken: string;
refreshToken: string;
userId: string;
} | undefined;
/**
* Checks if the JSON output is enabled via flag (--json or -j) or environment variable (SHOPIFY_FLAG_JSON).
*
* @param environment - Process environment variables.
* @returns True if the JSON output is enabled, false otherwise.
*/
export declare function jsonOutputEnabled(environment?: NodeJS.ProcessEnv): boolean;
/**
* If true, the CLI should not use the Partners API.
*
* @returns True if the SHOPIFY_CLI_NEVER_USE_PARTNERS_API environment variable is set.
*/
export declare function blockPartnersAccess(): boolean;
/**
* If true, the CLI should not use the network level retry.
*
* If there is an error when calling a network API that looks like a DNS or connectivity issue, the CLI will by default
* automatically retry the request.
*
* @param environment - Process environment variables.
* @returns True if the SHOPIFY_CLI_SKIP_NETWORK_LEVEL_RETRY environment variable is set.
*/
export declare function skipNetworkLevelRetry(environment?: NodeJS.ProcessEnv): boolean;
/**
* Returns the default maximum request time for network calls in milliseconds.
*
* After this long, API requests may be cancelled by an AbortSignal. The limit can be overridden by setting the
* SHOPIFY_CLI_MAX_REQUEST_TIME_FOR_NETWORK_CALLS environment variable.
*
* @param environment - Process environment variables.
* @returns The maximum request time in milliseconds.
*/
export declare function maxRequestTimeForNetworkCallsMs(environment?: NodeJS.ProcessEnv): number;