UNPKG

@topgroup/diginext

Version:

A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.

167 lines (166 loc) 8.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.guestRoleRoutes = exports.memberRoleRoutes = exports.moderatorRoleRoutes = exports.adminRoleRoutes = exports.credentialFields = exports.webhookEventStatusList = exports.webhookChannelList = exports.systemEventList = exports.buildPlatformList = exports.sslIssuerList = exports.appStatusList = exports.cronjobStatusList = exports.backupStatusList = exports.deployStatusList = exports.buildStatusList = exports.gitProviderDomainList = exports.gitProviderDomain = exports.availableResourceSizes = exports.availableGitProviders = exports.storageProviderList = exports.registryProviderList = exports.cloudDatabaseList = exports.cloudProviderList = exports.requestMethodList = exports.retentionTypes = exports.logTypes = void 0; const array_1 = require("../plugins/array"); // log type exports.logTypes = ["debug", "warn", "error", "fatal"]; // data retention exports.retentionTypes = ["limit", "duration"]; // http methods exports.requestMethodList = ["GET", "POST", "PATCH", "DELETE"]; // cloud providers exports.cloudProviderList = ["gcloud", "digitalocean", "custom"]; // database providers exports.cloudDatabaseList = ["mongodb", "mysql", "mariadb", "postgresql", "sqlserver", "sqlite", "redis", "dynamodb"]; // container registry providers exports.registryProviderList = ["gcloud", "digitalocean", "dockerhub"]; // cloud storage providers exports.storageProviderList = ["gcloud", "do_space", "aws_s3"]; // git providers exports.availableGitProviders = ["bitbucket", "github" /**, "gitlab" */]; // resource types exports.availableResourceSizes = ["none", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x"]; // git provider domains exports.gitProviderDomain = { bitbucket: "bitbucket.org", github: "github.com", gitlab: "gitlab.com", }; exports.gitProviderDomainList = ["bitbucket.org", "github.com"]; // build status exports.buildStatusList = ["pending", "start", "building", "failed", "success", "cancelled"]; // deploy status exports.deployStatusList = ["pending", "in_progress", "failed", "success", "cancelled"]; // backup status exports.backupStatusList = ["start", "in_progress", "failed", "success", "cancelled"]; // cronjob status exports.cronjobStatusList = ["in_progress", "failed", "success", "cancelled"]; /** * App status: * - `deploying`: App is being deployed. * - `healthy`: App's containers are running well. * - `partial_healthy`: Some of the app's containers are unhealthy. * - `undeployed`: App has not been deployed yet. * - `failed`: App's containers are unable to deploy due to image pull back-off or image pulling errors. * - `crashed`: App's containers are facing some unexpected errors. * - `unknown`: Other unknown errors. */ exports.appStatusList = ["deploying", "healthy", "partial_healthy", "undeployed", "failed", "crashed", "unknown"]; /** * @default "letsencrypt" */ exports.sslIssuerList = ["letsencrypt", "custom", "none"]; // build platforms exports.buildPlatformList = [ "linux/arm64", "linux/amd64", "linux/amd64/v2", "linux/riscv64", "linux/ppc64le", "linux/s390x", "linux/386", "linux/mips64le", "linux/mips64", "linux/arm/v7", "linux/arm/v6", ]; // system status // export const systemStatusList = ["incident", "recover"] as const; // export type SystemStatus = typeof systemStatusList[number]; // webhook events exports.systemEventList = [ // "system_status", "build_status", "deploy_status", "dbbackup_status", "app_status", "project_status", "environment_status", ]; // webhook channels exports.webhookChannelList = ["http_callback", "email", "sms", "web_push", "push_notification", "instant_message"]; exports.webhookEventStatusList = (0, array_1.filterUniqueItems)([...exports.buildStatusList, ...exports.deployStatusList, ...exports.backupStatusList, ...exports.appStatusList]); /** * Credential fields / maskFields / sensitive fields */ exports.credentialFields = [ // account "access_token", "token.access_token", "owner.password", "owner.token.access_token", "settings.ai.apiKey", // clusters & registries "apiAccessToken", "serviceAccount", "dockerPassword", "kubeConfig", "imagePullSecret.value", "registry.apiAccessToken", "registry.dockerPassword", "registry.serviceAccount", "registry.imagePullSecret.value", // git "bitbucket_oauth.consumer_secret", "bitbucket_oauth.app_password", "github_oauth.client_secret", "github_oauth.personal_access_token", // metadata "metadata.email", "metadata.access_token", "metadata.apiAccessToken", "metadata.serviceAccount", "metadata.dockerPassword", "metadata.kubeConfig", ]; /** * ROLES & PERMISSIONS: API Routes */ exports.adminRoleRoutes = [{ path: "*", permissions: ["full"], scope: [] }]; exports.moderatorRoleRoutes = [{ path: "*", permissions: ["own", "read", "create", "update"], scope: [] }]; exports.memberRoleRoutes = [ { path: "*", permissions: ["own", "read"], scope: [] }, { path: "/api/v1/deploy", permissions: ["read", "create", "update"], scope: [] }, { path: "/api/v1/domain", permissions: ["read", "create", "update"], scope: [] }, { path: "/api/v1/project", permissions: ["own", "read", "create", "update"], scope: [] }, { path: "/api/v1/app", permissions: ["own", "read", "create", "update"], scope: [] }, { path: "/api/v1/app/environment", permissions: ["read", "create", "update"], scope: [] }, { path: "/api/v1/app/deploy_environment", permissions: ["read", "create", "update"], scope: [] }, { path: "/api/v1/app/environment/variables", permissions: ["read", "create", "update"], scope: [] }, { path: "/api/v1/build/start", permissions: ["full"], scope: [] }, { path: "/api/v1/build/stop", permissions: ["full"], scope: [] }, { path: "/api/v1/release", permissions: ["own", "read", "create", "update"], scope: [] }, { path: "/api/v1/release/from-build", permissions: ["own", "read", "create", "update"], scope: [] }, { path: "/api/v1/release/preview", permissions: ["own", "read", "create", "update"], scope: [] }, { path: "/api/v1/git", permissions: ["own", "public"], scope: [] }, { path: "/api/v1/git/orgs", permissions: ["own", "public"], scope: [] }, { path: "/api/v1/git/orgs/repos", permissions: ["read", "create", "update"], scope: [] }, { path: "/api/v1/git/public-key", permissions: [], scope: [] }, { path: "/api/v1/git/ssh/create", permissions: [], scope: [] }, { path: "/api/v1/git/ssh/generate", permissions: [], scope: [] }, { path: "/api/v1/git/ssh/verify", permissions: [], scope: [] }, { path: "/api/v1/user", permissions: ["read"], scope: [] }, { path: "/api/v1/user/join-workspace", permissions: ["update"], scope: [] }, { path: "/api/v1/role", permissions: ["read"], scope: [] }, { path: "/api/v1/workspace", permissions: ["read"], scope: [] }, { path: "/api/v1/workspace/invite", permissions: ["create"], scope: [] }, { path: "/api/v1/api_key", permissions: [], scope: [] }, { path: "/api/v1/service_account", permissions: ["own", "public"], scope: [] }, ]; exports.guestRoleRoutes = [ { path: "*", permissions: ["own", "create"], scope: [] }, { path: "/api/v1/deploy", permissions: ["create"], scope: [] }, { path: "/api/v1/build", permissions: ["own"], scope: [] }, { path: "/api/v1/build/start", permissions: ["create"], scope: [] }, { path: "/api/v1/build/stop", permissions: ["create", "update"], scope: [] }, { path: "/api/v1/release", permissions: ["read", "create", "update"], scope: [] }, { path: "/api/v1/release/from-build", permissions: ["own", "read", "create", "update"], scope: [] }, { path: "/api/v1/release/preview", permissions: ["own", "read", "create", "update"], scope: [] }, { path: "/api/v1/user", permissions: ["read"], scope: [] }, { path: "/api/v1/user/join-workspace", permissions: ["update"], scope: [] }, { path: "/api/v1/role", permissions: ["read"], scope: [] }, { path: "/api/v1/workspace", permissions: ["read"], scope: [] }, { path: "/api/v1/workspace/invite", permissions: [], scope: [] }, { path: "/api/v1/api_key", permissions: [], scope: [] }, { path: "/api/v1/service_account", permissions: [], scope: [] }, ];