///
import Module from 'module';
import type { AnyType } from '../types.js';
declare global {
var collabLandSecrets: Record;
}
/**
* Enumeration of environment types
*/
export declare enum EnvType {
/**
* Production
*/
PROD = "production",
/**
* Staging (preparing for production)
*/
STAGING = "staging",
/**
* QA - ready for QA
*/
QA = "qa",
/**
* Development mode
*/
DEV = "dev",
/**
* For tests
*/
TEST = "test"
}
/**
* Enumeration of resource types
*/
export declare enum ResourceType {
/**
* DynamoDB table for APIs
*/
DynamoDBAPITable = "DynamoDBAPITable",
/**
* DynamoDB table for CollabLand entities
*/
DynamoDBTable = "DynamoDBTable",
/**
* S3 bucket name
*/
S3Bucket = "S3Bucket",
/**
* SQS queue for jobs
*/
SQSJobsQueue = "SQSJobsQueue",
SQSJobsJoinQueue = "SQSJobsJoinQueue",
SQSJobsEventsQueue = "SQSJobsEventsQueue",
/**
* SNS topic for jobs
*/
SNSJobsTopic = "SNSJobsTopic",
/**
* KMS CMK alias
*/
KMSKeyAlias = "KMSKeyAlias",
/**
* Elastic BeanStalk API server
*/
APIServer = "APIServer",
/**
* Secret name
*/
SecretName = "SecretName",
/**
* Redpacket claims queue name
*/
SQSRedPacketClaimsQueue = "SQSRedPacketClaimsQueue",
/**
* Token claims queue name
*/
SQSTokenClaimsQueue = "SQSTokenClaimsQueue",
/**
* Token simple claims queue name
*/
SQSTokenSimpleClaimsQueue = "SQSTokenSimpleClaimsQueue",
APIServerURL = "APIServerURL",
LoginURL = "LoginURL",
CommandCenterURL = "CommandCenterURL",
WalletConnectionURL = "WalletConnectionURL",
GCPBigqueryDatabaseID = "GCPBigqueryDatabaseID",
GCPBigqueryTableID = "GCPBigqueryTableID",
GCPBigqueryMixPanelTableID = "GCPBigqueryMixPanelTableID",
GCPBigqueryTelefrensTableID = "GCPBigqueryTelefrensTableID",
GCPBigqueryTipLitErrorsTableID = "GCPBigqueryTipLitErrorsTableID"
}
/**
* Descriptor for a resource name
*/
export type ResourceDescriptor = {
/**
* Hard-coded resource names keyed by env types.
*/
mappedNames?: Partial>;
/**
* The name of an environment variable that can be used to configure the
* resource name
*/
envVarName?: string;
/**
* The default resource name if no environment variable is set
*/
defaultName?: string;
/**
* Resource name template with optional references to `${envName}`/`${envType}`
*/
template?: string;
};
/**
* import from another file as this will grow
* maybe something like this
*
* ```ts
* const AWSResourcesDict = yaml.load(readFileSync('./resources-dict.yml', 'utf8'))
* as AWSResourcesType;
* ```
* Default values for resources
*/
export declare const AWSResources: Record;
/**
* Get the environment full name (team + environment)
*/
export declare function getEnvName(): string | undefined;
/**
* Get the environment type, default to `EnvType.QA`
*/
export declare function getEnv(name?: string): EnvType;
/**
* Set the environment name
* @param env - Environment name
*/
export declare function setEnv(env: EnvType | string): void;
/**
* Check if Collab.Land is running in production mode
*/
export declare function isProduction(): boolean;
/**
* Check if Collab.Land running in development mode
* @returns
*/
export declare function isDevelopment(): boolean;
/**
* Get the string value of an environment variable
* @param name - Name of the variable
* @param defaultValue - Default value
* @returns
*/
export declare function getEnvVar(name: string, defaultValue: string): string;
/**
* Get the string value of an environment variable
* @param name - Name of the variable
* @returns
*/
export declare function getEnvVar(name: string): string | undefined;
/**
* Get the number value of an environment variable
* @param name - Name of the variable
* @returns
*/
export declare function getEnvVarAsNumber(name: string): number | undefined;
/**
* Get the number value of an environment variable
* @param name - Name of the variable
* @param defaultValue - Default value
* @returns
*/
export declare function getEnvVarAsNumber(name: string, defaultValue: number): number;
/**
* Get the environment variable as boolean
* @param name - Variable name
* @param defaultValue - Default value
* @returns false if the lowercase string value is 'false`, '0', 'no', 'n', or ''
*/
export declare function getEnvVarAsBoolean(name: string, defaultValue?: boolean): boolean;
/**
* Get the object value of an environment variable
* @param name - Name of the variable
* @returns
*/
export declare function getEnvVarAsObject(name: string): T | undefined;
/**
* Get the object value of an environment variable
* @param name - Name of the variable
* @param defaultValue - Default value
* @returns
*/
export declare function getEnvVarAsObject(name: string, defaultValue: T): T;
/**
* Set an environment variable to the given value. It does not override existing
* variables.
* @param name - Name of the variable
* @param value - Value that can be serialized as a string
* @param override - Override existing variable
* @returns
*/
export declare function setEnvVar(name: string, value: unknown, override?: boolean): string | null | undefined;
/**
* Delete an environment variable
* @param name - Name of the variable
*/
export declare function unsetEnvVar(name: string): void;
/**
* Get the resource name
* 1. Use a custom resource name configured for the given env
* 2. Use the value from an environment variable if it's set
* 3. Try to build the name from the template
* @param resource - Resource type
* @param env
* @returns
*/
export declare function getResourceName(resource: ResourceType, env?: string): string;
/**
* Server types
*/
export declare enum ServerType {
APIServer = "APIServer",
JobServer = "JobServer",
DiscordServer = "DiscordServer",
CronServer = "CronServer"
}
/**
* Job server types
*/
export declare enum JobServerType {
/**
* The job server that handles `join` flow
*/
join = "join",
/**
* The job server that runs background checks
*/
background = "background",
/**
* The job server that runs event-driven checks
*/
events = "events"
}
/**
* Get the job server type from the env var
* @returns
*/
export declare function getJobServerType(): JobServerType;
/**
* API server types
*/
export declare enum APIServerType {
main = "main",
claim = "claim"
}
/**
* Get the api server type from the env var
* @returns
*/
export declare function getAPIServerType(): string;
export declare function getCommandCenterURL(): string;
/**
* Get the base url of CollabLand API server
* @returns Base url of CollabLand API server
*/
export declare function getApiServerURL(): string;
export declare function getLoginURL(): string;
export declare function getWalletConnectionURL(): string;
export declare function getWalletConnectionDomain(): string;
/**
* Strip the extension from a filename if it has one.
* @param name - A filename.
* @return The filename without a path.
*/
export declare function stripExt(name: string): string;
/**
* Check if the given module is the main entry
* @param module - `import.meta.url` for ESM or `module` for CommonJS
* @returns
*/
export declare function isMain(module: string | Module): boolean;