feat: add hasura cloud

This commit is contained in:
nafees nazik
2023-10-18 22:40:34 +05:30
parent ebe4f70b51
commit a6e02238ad
4 changed files with 575 additions and 560 deletions
+22 -19
View File
@@ -14,6 +14,7 @@ import {
INTEGRATION_GITHUB,
INTEGRATION_GITLAB,
INTEGRATION_HASHICORP_VAULT,
INTEGRATION_HASURA_CLOUD,
INTEGRATION_HEROKU,
INTEGRATION_LARAVELFORGE,
INTEGRATION_NETLIFY,
@@ -76,7 +77,8 @@ export interface IIntegration {
| "cloud-66"
| "northflank"
| "windmill"
| "gcp-secret-manager";
| "gcp-secret-manager"
| "hasura-cloud";
integrationAuth: Types.ObjectId;
metadata: Metadata;
}
@@ -86,67 +88,67 @@ const integrationSchema = new Schema<IIntegration>(
workspace: {
type: Schema.Types.ObjectId,
ref: "Workspace",
required: true,
required: true
},
environment: {
type: String,
required: true,
required: true
},
isActive: {
type: Boolean,
required: true,
required: true
},
url: {
// for custom self-hosted integrations (e.g. self-hosted GitHub enterprise)
type: String,
default: null,
default: null
},
app: {
// name of app in provider
type: String,
default: null,
default: null
},
appId: {
// id of app in provider
type: String,
default: null,
default: null
},
targetEnvironment: {
// target environment
type: String,
default: null,
default: null
},
targetEnvironmentId: {
type: String,
default: null,
default: null
},
targetService: {
// railway-specific service
// qovery-specific project
type: String,
default: null,
default: null
},
targetServiceId: {
// railway-specific service
// qovery specific project
type: String,
default: null,
default: null
},
owner: {
// github-specific repo owner-login
type: String,
default: null,
default: null
},
path: {
// aws-parameter-store-specific path
// (also) vercel preview-branch
type: String,
default: null,
default: null
},
region: {
// aws-parameter-store-specific path
type: String,
default: null,
default: null
},
scope: {
// qovery-specific scope
@@ -183,19 +185,20 @@ const integrationSchema = new Schema<IIntegration>(
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
INTEGRATION_CLOUD_66,
INTEGRATION_NORTHFLANK,
INTEGRATION_GCP_SECRET_MANAGER
INTEGRATION_GCP_SECRET_MANAGER,
INTEGRATION_HASURA_CLOUD
],
required: true,
required: true
},
integrationAuth: {
type: Schema.Types.ObjectId,
ref: "IntegrationAuth",
required: true,
required: true
},
secretPath: {
type: String,
required: true,
default: "/",
default: "/"
},
metadata: {
type: Schema.Types.Mixed,
@@ -203,7 +206,7 @@ const integrationSchema = new Schema<IIntegration>(
}
},
{
timestamps: true,
timestamps: true
}
);
@@ -16,6 +16,7 @@ import {
INTEGRATION_GITHUB,
INTEGRATION_GITLAB,
INTEGRATION_HASHICORP_VAULT,
INTEGRATION_HASURA_CLOUD,
INTEGRATION_HEROKU,
INTEGRATION_LARAVELFORGE,
INTEGRATION_NETLIFY,
@@ -62,7 +63,8 @@ import {
| "teamcity"
| "northflank"
| "windmill"
| "gcp-secret-manager";
| "gcp-secret-manager"
| "hasura-cloud";
teamId: string;
accountId: string;
url: string;
@@ -87,7 +89,7 @@ import {
workspace: {
type: Schema.Types.ObjectId,
ref: "Workspace",
required: true,
required: true
},
integration: {
type: String,
@@ -117,89 +119,85 @@ import {
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
INTEGRATION_CLOUD_66,
INTEGRATION_NORTHFLANK,
INTEGRATION_GCP_SECRET_MANAGER
INTEGRATION_GCP_SECRET_MANAGER,
INTEGRATION_HASURA_CLOUD
],
required: true,
required: true
},
teamId: {
// vercel-specific integration param
type: String,
type: String
},
url: {
// for any self-hosted integrations (e.g. self-hosted hashicorp-vault)
type: String,
type: String
},
namespace: {
// hashicorp-vault-specific integration param
type: String,
type: String
},
accountId: {
// netlify-specific integration param
type: String,
type: String
},
refreshCiphertext: {
type: String,
select: false,
select: false
},
refreshIV: {
type: String,
select: false,
select: false
},
refreshTag: {
type: String,
select: false,
select: false
},
accessIdCiphertext: {
type: String,
select: false,
select: false
},
accessIdIV: {
type: String,
select: false,
select: false
},
accessIdTag: {
type: String,
select: false,
select: false
},
accessCiphertext: {
type: String,
select: false,
select: false
},
accessIV: {
type: String,
select: false,
select: false
},
accessTag: {
type: String,
select: false,
select: false
},
accessExpiresAt: {
type: Date,
select: false,
select: false
},
algorithm: { // the encryption algorithm used
algorithm: {
// the encryption algorithm used
type: String,
enum: [ALGORITHM_AES_256_GCM],
required: true,
required: true
},
keyEncoding: {
type: String,
enum: [
ENCODING_SCHEME_UTF8,
ENCODING_SCHEME_BASE64,
],
required: true,
enum: [ENCODING_SCHEME_UTF8, ENCODING_SCHEME_BASE64],
required: true
},
metadata: {
type: Schema.Types.Mixed
}
},
{
timestamps: true,
timestamps: true
}
);
export const IntegrationAuth = model<IIntegrationAuth>(
"IntegrationAuth",
integrationAuthSchema
);
export const IntegrationAuth = model<IIntegrationAuth>("IntegrationAuth", integrationAuthSchema);
+48 -36
View File
@@ -22,7 +22,7 @@ export const INTEGRATION_GITLAB = "gitlab";
export const INTEGRATION_RENDER = "render";
export const INTEGRATION_RAILWAY = "railway";
export const INTEGRATION_FLYIO = "flyio";
export const INTEGRATION_LARAVELFORGE = "laravel-forge"
export const INTEGRATION_LARAVELFORGE = "laravel-forge";
export const INTEGRATION_CIRCLECI = "circleci";
export const INTEGRATION_TRAVISCI = "travisci";
export const INTEGRATION_TEAMCITY = "teamcity";
@@ -38,6 +38,7 @@ export const INTEGRATION_WINDMILL = "windmill";
export const INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM = "digital-ocean-app-platform";
export const INTEGRATION_CLOUD_66 = "cloud-66";
export const INTEGRATION_NORTHFLANK = "northflank";
export const INTEGRATION_HASURA_CLOUD = "hasura-cloud";
export const INTEGRATION_SET = new Set([
INTEGRATION_GCP_SECRET_MANAGER,
INTEGRATION_AZURE_KEY_VAULT,
@@ -63,7 +64,8 @@ export const INTEGRATION_SET = new Set([
INTEGRATION_BITBUCKET,
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
INTEGRATION_CLOUD_66,
INTEGRATION_NORTHFLANK
INTEGRATION_NORTHFLANK,
INTEGRATION_HASURA_CLOUD
]);
// integration types
@@ -71,15 +73,14 @@ export const INTEGRATION_OAUTH2 = "oauth2";
// integration oauth endpoints
export const INTEGRATION_GCP_TOKEN_URL = "https://oauth2.googleapis.com/token";
export const INTEGRATION_AZURE_TOKEN_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
export const INTEGRATION_AZURE_TOKEN_URL =
"https://login.microsoftonline.com/common/oauth2/v2.0/token";
export const INTEGRATION_HEROKU_TOKEN_URL = "https://id.heroku.com/oauth/token";
export const INTEGRATION_VERCEL_TOKEN_URL =
"https://api.vercel.com/v2/oauth/access_token";
export const INTEGRATION_VERCEL_TOKEN_URL = "https://api.vercel.com/v2/oauth/access_token";
export const INTEGRATION_NETLIFY_TOKEN_URL = "https://api.netlify.com/oauth/token";
export const INTEGRATION_GITHUB_TOKEN_URL =
"https://github.com/login/oauth/access_token";
export const INTEGRATION_GITHUB_TOKEN_URL = "https://github.com/login/oauth/access_token";
export const INTEGRATION_GITLAB_TOKEN_URL = "https://gitlab.com/oauth/token";
export const INTEGRATION_BITBUCKET_TOKEN_URL = "https://bitbucket.org/site/oauth2/access_token"
export const INTEGRATION_BITBUCKET_TOKEN_URL = "https://bitbucket.org/site/oauth2/access_token";
// integration apps endpoints
export const INTEGRATION_GCP_API_URL = "https://cloudresourcemanager.googleapis.com";
@@ -106,11 +107,13 @@ export const INTEGRATION_WINDMILL_API_URL = "https://app.windmill.dev/api";
export const INTEGRATION_DIGITAL_OCEAN_API_URL = "https://api.digitalocean.com";
export const INTEGRATION_CLOUD_66_API_URL = "https://app.cloud66.com/api";
export const INTEGRATION_NORTHFLANK_API_URL = "https://api.northflank.com";
export const INTEGRATION_HASURA_CLOUD_API_URL = "https://data.pro.hasura.io/v1/graphql";
export const INTEGRATION_GCP_SECRET_MANAGER_SERVICE_NAME = "secretmanager.googleapis.com"
export const INTEGRATION_GCP_SECRET_MANAGER_SERVICE_NAME = "secretmanager.googleapis.com";
export const INTEGRATION_GCP_SECRET_MANAGER_URL = `https://${INTEGRATION_GCP_SECRET_MANAGER_SERVICE_NAME}`;
export const INTEGRATION_GCP_SERVICE_USAGE_URL = "https://serviceusage.googleapis.com";
export const INTEGRATION_GCP_CLOUD_PLATFORM_SCOPE = "https://www.googleapis.com/auth/cloud-platform";
export const INTEGRATION_GCP_CLOUD_PLATFORM_SCOPE =
"https://www.googleapis.com/auth/cloud-platform";
export const getIntegrationOptions = async () => {
const INTEGRATION_OPTIONS = [
@@ -121,7 +124,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "oauth",
clientId: await getClientIdHeroku(),
docsLink: "",
docsLink: ""
},
{
name: "Vercel",
@@ -131,7 +134,7 @@ export const getIntegrationOptions = async () => {
type: "oauth",
clientId: "",
clientSlug: await getClientSlugVercel(),
docsLink: "",
docsLink: ""
},
{
name: "Netlify",
@@ -140,7 +143,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "oauth",
clientId: await getClientIdNetlify(),
docsLink: "",
docsLink: ""
},
{
name: "GitHub",
@@ -149,7 +152,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "oauth",
clientId: await getClientIdGitHub(),
docsLink: "",
docsLink: ""
},
{
name: "Render",
@@ -158,7 +161,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Railway",
@@ -167,7 +170,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Fly.io",
@@ -176,7 +179,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "AWS Parameter Store",
@@ -185,7 +188,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "custom",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Laravel Forge",
@@ -194,7 +197,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "AWS Secrets Manager",
@@ -203,7 +206,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "custom",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Azure Key Vault",
@@ -212,7 +215,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "oauth",
clientId: await getClientIdAzure(),
docsLink: "",
docsLink: ""
},
{
name: "Circle CI",
@@ -221,7 +224,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "GitLab",
@@ -230,7 +233,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "custom",
clientId: await getClientIdGitLab(),
docsLink: "",
docsLink: ""
},
{
name: "Terraform Cloud",
@@ -239,7 +242,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
cliendId: "",
docsLink: "",
docsLink: ""
},
{
name: "Travis CI",
@@ -248,7 +251,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "TeamCity",
@@ -257,7 +260,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Supabase",
@@ -266,7 +269,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Checkly",
@@ -275,7 +278,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Qovery",
@@ -284,7 +287,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "HashiCorp Vault",
@@ -293,7 +296,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "GCP Secret Manager",
@@ -329,7 +332,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Windmill",
@@ -338,7 +341,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Digital Ocean App Platform",
@@ -347,7 +350,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Cloud 66",
@@ -356,7 +359,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "pat",
clientId: "",
docsLink: "",
docsLink: ""
},
{
name: "Northflank",
@@ -367,7 +370,16 @@ export const getIntegrationOptions = async () => {
clientId: "",
docsLink: ""
},
]
{
name: "Hasura Cloud",
slug: "hasura-cloud",
image: "Northflank.png",
isAvailable: true,
type: "pat",
clientId: "",
docsLink: ""
}
];
return INTEGRATION_OPTIONS;
}
};
+40 -38
View File
@@ -6,74 +6,75 @@ const integrationSlugNameMapping: Mapping = {
"azure-key-vault": "Azure Key Vault",
"aws-parameter-store": "AWS Parameter Store",
"aws-secret-manager": "AWS Secrets Manager",
"heroku": "Heroku",
"vercel": "Vercel",
"netlify": "Netlify",
"github": "GitHub",
"gitlab": "GitLab",
"render": "Render",
heroku: "Heroku",
vercel: "Vercel",
netlify: "Netlify",
github: "GitHub",
gitlab: "GitLab",
render: "Render",
"laravel-forge": "Laravel Forge",
"railway": "Railway",
"flyio": "Fly.io",
"circleci": "CircleCI",
"travisci": "TravisCI",
"supabase": "Supabase",
"checkly": "Checkly",
"qovery": "Qovery",
railway: "Railway",
flyio: "Fly.io",
circleci: "CircleCI",
travisci: "TravisCI",
supabase: "Supabase",
checkly: "Checkly",
qovery: "Qovery",
"terraform-cloud": "Terraform Cloud",
"teamcity": "TeamCity",
teamcity: "TeamCity",
"hashicorp-vault": "Vault",
"cloudflare-pages": "Cloudflare Pages",
"codefresh": "Codefresh",
codefresh: "Codefresh",
"digital-ocean-app-platform": "Digital Ocean App Platform",
"bitbucket": "BitBucket",
bitbucket: "BitBucket",
"cloud-66": "Cloud 66",
"northflank": "Northflank",
"windmill": "Windmill",
"gcp-secret-manager": "GCP Secret Manager"
}
northflank: "Northflank",
windmill: "Windmill",
"gcp-secret-manager": "GCP Secret Manager",
"hasura-cloud": "Hasura Cloud"
};
const envMapping: Mapping = {
Development: "dev",
Staging: "staging",
Production: "prod",
Testing: "test",
Testing: "test"
};
const reverseEnvMapping: Mapping = {
dev: "Development",
staging: "Staging",
prod: "Production",
test: "Testing",
test: "Testing"
};
const contextNetlifyMapping: Mapping = {
"dev": "Local development",
dev: "Local development",
"branch-deploy": "Branch deploys",
"deploy-preview": "Deploy Previews",
"production": "Production"
}
production: "Production"
};
const reverseContextNetlifyMapping: Mapping = {
"Local development": "dev",
"Branch deploys": "branch-deploy",
"Deploy Previews": "deploy-preview",
"Production": "production"
}
Production: "production"
};
const plansDev: Mapping = {
"starter": "prod_Mb4ATFT5QAHoPM",
"team": "prod_NEpD2WMXUS2eDn",
"professional": "prod_Mb4CetZ2jE7jdl",
"enterprise": "licence_key_required"
}
starter: "prod_Mb4ATFT5QAHoPM",
team: "prod_NEpD2WMXUS2eDn",
professional: "prod_Mb4CetZ2jE7jdl",
enterprise: "licence_key_required"
};
const plansProd: Mapping = {
"starter": "prod_Mb8oR5XNwyFTul",
"team": "prod_NEp7fAB3UJWK6A",
"professional": "prod_Mb8pUIpA0OUi5N",
"enterprise": "licence_key_required"
}
starter: "prod_Mb8oR5XNwyFTul",
team: "prod_NEp7fAB3UJWK6A",
professional: "prod_Mb8pUIpA0OUi5N",
enterprise: "licence_key_required"
};
const plans = plansProd || plansDev;
@@ -83,4 +84,5 @@ export {
integrationSlugNameMapping,
plans,
reverseContextNetlifyMapping,
reverseEnvMapping}
reverseEnvMapping
};