trigger.dev
Version:
A Command-Line Interface for Trigger.dev projects
23 lines (22 loc) • 1.01 kB
TypeScript
export type DeployEnvironment = "prod" | "staging" | "preview";
export type DeployEnvironmentSource = "flag" | "apiKey" | "default";
/**
* The environment an environment API key (`tr_prod_…`, `tr_stg_…`, …) belongs to.
* Returns undefined for personal and organization access tokens, or no token.
*/
export declare function environmentFromApiKey(accessToken: string | undefined): DeployEnvironment | "dev" | undefined;
/**
* Picks the environment for deploy and promote. An explicit `--env` or `--prod` wins,
* then the environment of an API key in TRIGGER_ACCESS_TOKEN, then prod.
*
* The server deploys to the API key's environment whatever `--env` says, so a mismatch
* is an error rather than a deploy to an environment the user didn't ask for.
*/
export declare function resolveDeployEnvironment({ env, prod, accessToken, }: {
env?: DeployEnvironment | "production";
prod?: boolean;
accessToken?: string;
}): {
env: DeployEnvironment;
source: DeployEnvironmentSource;
};