Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add auth
Tomas Valenta1047a65b53c0
diff --git a/components/AuthForm.tsx b/components/AuthForm.tsxindex ae96ac2e0..558e7c374 100644--- a/components/AuthForm.tsx+++ b/components/AuthForm.tsx@@ -80,7 +80,7 @@ function AuthForm({ authType }: Props) {setErrMessage('')}- router.replace('/projects')+ router.replace('/')setIsLoading(false)}diff --git a/components/DeploymentEditor.tsx b/components/DeploymentEditor.tsxnew file mode 100644index 000000000..e424cf7a0--- /dev/null+++ b/components/DeploymentEditor.tsx@@ -0,0 +1,113 @@+import ReactFlow, {+ Controls,+ MiniMap,+ Background,+} from 'reactflow'+import { shallow } from 'zustand/shallow'++import { createStore, State } from 'state/store'++import 'reactflow/dist/style.css'+import { api_deployments } from '@prisma/client'+import { useSupabaseClient } from '@supabase/auth-helpers-react'+import { useEffect, useState } from 'react'++const selector = (state: State) => ({+ nodes: state.nodes,+ edges: state.edges,+ onNodesChange: state.onNodesChange,+ onEdgesChange: state.onEdgesChange,+ onConnect: state.onConnect,+})++const useStore = createStore(+ [+ {+ id: '1',+ type: 'input',+ data: { label: 'Input' },+ position: { x: 250, y: 25 },+ },++ {+ id: '2',+ data: { label: 'Default' },+ position: { x: 100, y: 125 },+ },+ {+ id: '3',+ type: 'output',+ data: { label: 'Output' },+ position: { x: 250, y: 250 },+ },+ ],+ [+ { id: 'e1-2', source: '1', target: '2' },+ { id: 'e2-3', source: '2', target: '3' },+ ]+)++export interface Props {+ deployment: api_deployments+}+++function useDeployment(deployment: api_deployments) {+ const [latest, setLatest] = useState<api_deployments>(deployment)+ const client = useSupabaseClient()++ useEffect(function subscribe() {+ const sub = client.channel('any')+ .on('postgres_changes',+ {+ event: 'UPDATE',+ schema: 'public',+ table: 'api_deployments',+ filter: `id=eq.${deployment.id}`,+ }, payload => {+ console.log('Change received!', payload)+ setLatest(l => ({ ...l, data: payload.new.data }))+ })+ .subscribe()++ return () => {+ sub.unsubscribe()+ }+ }, [deployment, client])++ return latest+}+++++export default function DeploymentEditor({ deployment }: Props) {+ const {+ nodes,+ edges,+ onNodesChange,+ onEdgesChange,+ onConnect,+ } = useStore(selector, shallow)++ const syncedDeployment = useDeployment(deployment)++ console.log(syncedDeployment)++ return (+ <ReactFlow+ nodes={nodes}+ edges={edges}+ onNodesChange={onNodesChange}+ onEdgesChange={onEdgesChange}+ onConnect={onConnect}+ fitViewOptions={{ padding: 0.2 }}+ proOptions={{ hideAttribution: true }}+ fitView+ >+ <Controls position="top-right">+ </Controls>+ <Background />+ </ReactFlow >+ )+}diff --git a/components/Flow.tsx b/components/Flow.tsxdeleted file mode 100644index 9021f52a6..000000000--- a/components/Flow.tsx+++ /dev/null@@ -1,66 +0,0 @@-import ReactFlow, {- Controls,- MiniMap,- Background,-} from 'reactflow'-import { shallow } from 'zustand/shallow'--import { createStore, State } from 'state/store'--import 'reactflow/dist/style.css'--const selector = (state: State) => ({- nodes: state.nodes,- edges: state.edges,- onNodesChange: state.onNodesChange,- onEdgesChange: state.onEdgesChange,- onConnect: state.onConnect,-})--const useStore = createStore(- [- {- id: '1',- type: 'input',- data: { label: 'Input' },- position: { x: 250, y: 25 },- },-- {- id: '2',- data: { label: 'Default' },- position: { x: 100, y: 125 },- },- {- id: '3',- type: 'output',- data: { label: 'Output' },- position: { x: 250, y: 250 },- },- ],- [- { id: 'e1-2', source: '1', target: '2' },- { id: 'e2-3', source: '2', target: '3' },- ]-)--export default function Flow() {- const { nodes, edges, onNodesChange, onEdgesChange, onConnect } = useStore(selector, shallow)-- return (- <ReactFlow- nodes={nodes}- edges={edges}- onNodesChange={onNodesChange}- onEdgesChange={onEdgesChange}- onConnect={onConnect}- fitViewOptions={{ padding: 0.2 }}- proOptions={{ hideAttribution: true }}- fitView- >- <MiniMap />- <Controls />- <Background />- </ReactFlow >- )-}diff --git a/components/Header/index.tsx b/components/Header/index.tsxindex 9701e3d7a..1ba1908d5 100644--- a/components/Header/index.tsx+++ b/components/Header/index.tsx@@ -10,8 +10,21 @@ function Header({ }: Props) {const user = useUser()return (- <div className="flex items-center justify-between border-b bg-white border-slate-200 px-3">- <div className="flex items-center space-x-4">+ <div className="+ flex+ items-center+ justify-end+ border-b+ bg-white+ border-slate-200+ px-3+ py-1.5+ ">+ <div className="+ flex+ items-center+ space-x-4+ "><Linkhref={{pathname: '/settings',diff --git a/components/Layout.tsx b/components/Layout.tsxdeleted file mode 100644index c7493ab43..000000000--- a/components/Layout.tsx+++ /dev/null@@ -1,20 +0,0 @@-import { useState } from 'react'-import { AppProps } from 'next/app'-import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'-import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'--export interface Props {- appProps: AppProps<{ initialSession: Session }>-}--export default function Dashboard({ appProps: { pageProps, Component } }: Props) {- const [supabaseClient] = useState(() => createBrowserSupabaseClient())- return (- <SessionContextProvider- supabaseClient={supabaseClient}- initialSession={pageProps.initialSession}- >- <Component {...pageProps} />- </SessionContextProvider>- )-}diff --git a/db/prisma.ts b/db/prisma.tsnew file mode 100644index 000000000..e7a9ccc3c--- /dev/null+++ b/db/prisma.ts@@ -0,0 +1,17 @@+import { PrismaClient } from '@prisma/client'+export * from '@prisma/client'++let prisma: PrismaClient++//check if we are running in production mode+if (process.env.NODE_ENV === 'production') {+ prisma = new PrismaClient()+} else {+ //check if there is already a connection to the database+ if (!(global as any).prisma) {+ (global as any).prisma = new PrismaClient()+ }+ prisma = (global as any).prisma+}++export { prisma }diff --git a/next.config.js b/next.config.jsindex ae887958d..2398a09ab 100644--- a/next.config.js+++ b/next.config.js@@ -1,7 +1,9 @@/** @type {import('next').NextConfig} */const nextConfig = {- reactStrictMode: true,swcMinify: true,+ experimental: {+ swcPlugins: [['next-superjson-plugin', {}]],+ },}module.exports = nextConfigdiff --git a/package.json b/package.jsonindex 51ade7987..2ce191b9c 100644--- a/package.json+++ b/package.json@@ -10,9 +10,13 @@"start": "next start","lint": "next lint","lint:fix": "next lint --fix",- "dev:debug": "NODE_OPTIONS='--inspect' next dev"+ "dev:debug": "NODE_OPTIONS='--inspect' next dev",+ "db:generate": "prisma generate",+ "db:pull": "prisma db pull",+ "postinstall": "yarn db:generate"},"dependencies": {+ "@prisma/client": "^4.11.0","@supabase/auth-helpers-nextjs": "^0.5.5","@supabase/auth-helpers-react": "^0.3.1","@supabase/supabase-js": "^2.10.0",@@ -21,11 +25,13 @@"immer": "^9.0.19","lucide-react": "^0.122.0","next": "13.2.3",+ "next-superjson-plugin": "^0.5.6","randomcolor": "^0.6.2","react": "18.2.0","react-dom": "18.2.0","reactflow": "^11.5.6","server-only": "^0.0.1",+ "superjson": "^1.12.2","swr": "^2.0.4","tailwind-merge": "^1.10.0","zustand": "^4.3.5"@@ -44,6 +50,7 @@"eslint-plugin-unused-imports": "^2.0.0","postcss": "^8.4.21","postcss-import": "^15.1.0",+ "prisma": "^4.11.0","tailwindcss": "^3.2.7","typescript": "^4.9.5","vercel": "^28.16.12"diff --git a/pages/_app.tsx b/pages/_app.tsxindex 45a63b968..e4817bc67 100644--- a/pages/_app.tsx+++ b/pages/_app.tsx@@ -2,9 +2,13 @@ import type { AppProps } from 'next/app'import { Inter, JetBrains_Mono } from 'next/font/google'import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'+import { useState } from 'react'+import { useRouter } from 'next/router'+import clsx from 'clsx'import 'styles/global.css'-import { useState } from 'react'++import Header from '@/components/Header'const inter = Inter({subsets: ['latin'],@@ -17,14 +21,42 @@ const jetBrains = JetBrains_Mono({})export default function App(props: AppProps<{ initialSession: Session }>) {+ const router = useRouter()const [supabaseClient] = useState(() => createBrowserSupabaseClient())++ const isSignIn = router.pathname === '/sign' && router.query.signup !== 'true'+ const isSignUp = router.pathname === '/sign' && router.query.signup === 'true'+return (- <main className={`${inter.variable} font-sans ${jetBrains.variable} flex h-inherit`}>+ <main className={clsx(+ inter.variable,+ 'font-sans',+ jetBrains.variable,+ 'flex',+ 'h-inherit',+ 'w-full',+ 'flex-1',+ 'flex-col',+ 'overflow-hidden',+ )}><SessionContextProvidersupabaseClient={supabaseClient}initialSession={props.pageProps.initialSession}>- <props.Component {...props.pageProps} />++ {!isSignIn && !isSignUp &&+ <Header />+ }+ <div+ className="+ flex+ flex-1+ flex-col+ overflow-hidden+ "+ >+ <props.Component {...props.pageProps} />+ </div></SessionContextProvider></main>)diff --git a/pages/index.tsx b/pages/index.tsxnew file mode 100644index 000000000..6af064820--- /dev/null+++ b/pages/index.tsx@@ -0,0 +1,129 @@+import type { GetServerSideProps } from 'next'+import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'++import { prisma, api_deployments } from 'db/prisma'+import { notEmpty } from '@/utils/notEmpty'+import DeploymentEditor from '@/components/DeploymentEditor'++export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {+ const supabase = createServerSupabaseClient(ctx)+ const {+ data: { session },+ } = await supabase.auth.getSession()++ if (!session) {+ return {+ redirect: {+ destination: '/sign',+ permanent: false,+ },+ }+ }+++ const user = await prisma.auth_users.findUniqueOrThrow({+ where: {+ id: session.user.id,+ },+ select: {+ users_teams: {+ where: {+ teams: {+ is_default: {+ equals: true,+ },+ },+ },+ select: {+ teams: {+ select: {+ id: true,+ api_deployments: true,+ },+ }+ }+ }+ },+ })++ const hasDefaultTeam = user?.users_teams.some(t => t.teams)+ if (!hasDefaultTeam) {+ // User is one of the old users without default team - create default team.+ const team = await prisma.teams.create({+ data: {+ name: session.user.email || session.user.id,+ is_default: true,+ api_deployments: {+ create: {+ data: {},+ },+ },+ users_teams: {+ create: {+ users: {+ connect: {+ id: session.user.id,+ }+ }+ }+ },+ },+ include: {+ api_deployments: true+ },+ })++ if (!team.api_deployments) {+ return {+ notFound: true+ }+ }++ return {+ props: {+ deployment: team.api_deployments,+ }+ }+ }+++ const apiDeploymentsFromDefaultTeam = user+ .users_teams+ .flatMap(t => t.teams.api_deployments)+ .filter(notEmpty)++ if (apiDeploymentsFromDefaultTeam.length > 0) {+ return {+ props: {+ deployment: apiDeploymentsFromDefaultTeam[0],+ }+ }+ }++ const defaultDeployment = await prisma.api_deployments.create({+ data: {+ data: {},+ team_id: user.users_teams[0].teams.id,+ },+ })++ return {+ props: {+ deployment: defaultDeployment,+ }+ }+}++interface Props {+ deployment: api_deployments+}++function ProjectPage({ deployment }: Props) {+ return (+ <DeploymentEditor+ deployment={deployment}+ />+ )+}++export default ProjectPagediff --git a/prisma/schema.prisma b/prisma/schema.prismanew file mode 100644index 000000000..afde3e011--- /dev/null+++ b/prisma/schema.prisma@@ -0,0 +1,450 @@+generator js {+ provider = "prisma-client-js"+ previewFeatures = ["multiSchema", "views"]+}++datasource db {+ provider = "postgresql"+ url = env("SUPABASE_POSTGRES_POOL_URL")+ schemas = ["auth", "public"]+}++model audit_log_entries {+ instance_id String? @db.Uuid+ id String @id @db.Uuid+ payload Json? @db.Json+ created_at DateTime? @db.Timestamptz(6)+ ip_address String @default("") @db.VarChar(64)++ @@index([instance_id], map: "audit_logs_instance_id_idx")+ @@schema("auth")+}++model identities {+ id String+ user_id String @db.Uuid+ identity_data Json+ provider String+ last_sign_in_at DateTime? @db.Timestamptz(6)+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ email String? @default(dbgenerated("lower((identity_data ->> 'email'::text))"))+ users auth_users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@id([provider, id])+ @@index([user_id])+ @@index([email])+ @@schema("auth")+}++model instances {+ id String @id @db.Uuid+ uuid String? @db.Uuid+ raw_base_config String?+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)++ @@schema("auth")+}++model mfa_amr_claims {+ session_id String @db.Uuid+ created_at DateTime @db.Timestamptz(6)+ updated_at DateTime @db.Timestamptz(6)+ authentication_method String+ id String @id(map: "amr_id_pk") @db.Uuid+ sessions sessions @relation(fields: [session_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@unique([session_id, authentication_method], map: "mfa_amr_claims_session_id_authentication_method_pkey")+ @@schema("auth")+}++model mfa_challenges {+ id String @id @db.Uuid+ factor_id String @db.Uuid+ created_at DateTime @db.Timestamptz(6)+ verified_at DateTime? @db.Timestamptz(6)+ ip_address String @db.Inet+ mfa_factors mfa_factors @relation(fields: [factor_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "mfa_challenges_auth_factor_id_fkey")++ @@schema("auth")+}++model mfa_factors {+ id String @id @db.Uuid+ user_id String @db.Uuid+ friendly_name String?+ factor_type factor_type+ status factor_status+ created_at DateTime @db.Timestamptz(6)+ updated_at DateTime @db.Timestamptz(6)+ secret String?+ mfa_challenges mfa_challenges[]+ users auth_users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@index([user_id, created_at], map: "factor_id_created_at_idx")+ @@schema("auth")+}++model refresh_tokens {+ instance_id String? @db.Uuid+ id BigInt @id @default(autoincrement())+ token String? @unique(map: "refresh_tokens_token_unique") @db.VarChar(255)+ user_id String? @db.VarChar(255)+ revoked Boolean?+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ parent String? @db.VarChar(255)+ session_id String? @db.Uuid+ sessions sessions? @relation(fields: [session_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@index([session_id], map: "refresh_token_session_id")+ @@index([instance_id])+ @@index([instance_id, user_id])+ @@index([parent])+ @@index([session_id, revoked])+ @@index([token])+ @@schema("auth")+}++model saml_providers {+ id String @id @db.Uuid+ sso_provider_id String @db.Uuid+ entity_id String @unique+ metadata_xml String+ metadata_url String?+ attribute_mapping Json?+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ sso_providers sso_providers @relation(fields: [sso_provider_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@index([sso_provider_id])+ @@schema("auth")+}++model saml_relay_states {+ id String @id @db.Uuid+ sso_provider_id String @db.Uuid+ request_id String+ for_email String?+ redirect_to String?+ from_ip_address String? @db.Inet+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ sso_providers sso_providers @relation(fields: [sso_provider_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@index([for_email])+ @@index([sso_provider_id])+ @@schema("auth")+}++model schema_migrations {+ version String @id @db.VarChar(255)++ @@schema("auth")+}++model sessions {+ id String @id @db.Uuid+ user_id String @db.Uuid+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ factor_id String? @db.Uuid+ aal aal_level?+ not_after DateTime? @db.Timestamptz(6)+ mfa_amr_claims mfa_amr_claims[]+ refresh_tokens refresh_tokens[]+ users auth_users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@index([user_id])+ @@index([user_id, created_at], map: "user_id_created_at_idx")+ @@schema("auth")+}++model sso_domains {+ id String @id @db.Uuid+ sso_provider_id String @db.Uuid+ domain String+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ sso_providers sso_providers @relation(fields: [sso_provider_id], references: [id], onDelete: Cascade, onUpdate: NoAction)++ @@index([sso_provider_id])+ @@schema("auth")+}++model sso_providers {+ id String @id @db.Uuid+ resource_id String?+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ saml_providers saml_providers[]+ saml_relay_states saml_relay_states[]+ sso_domains sso_domains[]++ @@schema("auth")+}++model auth_users {+ instance_id String? @db.Uuid+ id String @id @db.Uuid+ aud String? @db.VarChar(255)+ role String? @db.VarChar(255)+ email String? @db.VarChar(255)+ encrypted_password String? @db.VarChar(255)+ email_confirmed_at DateTime? @db.Timestamptz(6)+ invited_at DateTime? @db.Timestamptz(6)+ confirmation_token String? @db.VarChar(255)+ confirmation_sent_at DateTime? @db.Timestamptz(6)+ recovery_token String? @db.VarChar(255)+ recovery_sent_at DateTime? @db.Timestamptz(6)+ email_change_token_new String? @db.VarChar(255)+ email_change String? @db.VarChar(255)+ email_change_sent_at DateTime? @db.Timestamptz(6)+ last_sign_in_at DateTime? @db.Timestamptz(6)+ raw_app_meta_data Json?+ raw_user_meta_data Json?+ is_super_admin Boolean?+ created_at DateTime? @db.Timestamptz(6)+ updated_at DateTime? @db.Timestamptz(6)+ phone String? @unique @db.VarChar(15)+ phone_confirmed_at DateTime? @db.Timestamptz(6)+ phone_change String? @default("") @db.VarChar(15)+ phone_change_token String? @default("") @db.VarChar(255)+ phone_change_sent_at DateTime? @db.Timestamptz(6)+ confirmed_at DateTime? @default(dbgenerated("LEAST(email_confirmed_at, phone_confirmed_at)")) @db.Timestamptz(6)+ email_change_token_current String? @default("") @db.VarChar(255)+ email_change_confirm_status Int? @default(0) @db.SmallInt+ banned_until DateTime? @db.Timestamptz(6)+ reauthentication_token String? @default("") @db.VarChar(255)+ reauthentication_sent_at DateTime? @db.Timestamptz(6)+ is_sso_user Boolean @default(false)+ identities identities[]+ mfa_factors mfa_factors[]+ sessions sessions[]+ api_keys api_keys[]+ code_snippets code_snippets[]+ user_feedback user_feedback[]+ users public_users?+ users_teams users_teams[]++ @@index([instance_id])+ @@map("users")+ @@schema("auth")+}++model api_keys {+ api_key String @id+ owner_id String @db.Uuid+ users auth_users @relation(fields: [owner_id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@schema("public")+}++model apps {+ id String @id+ title String?+ created_at DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamptz(6)+ repository_id BigInt?+ team_id String? @db.Uuid+ repository_branch String?+ repository_path String @default("./")+ subdomain String? @unique+ github_repositories github_repositories? @relation(fields: [repository_id], references: [repository_id], onDelete: NoAction, onUpdate: NoAction)+ teams teams? @relation(fields: [team_id], references: [id], onDelete: NoAction, onUpdate: NoAction)+ apps_content apps_content?++ @@schema("public")+}++model apps_content {+ created_at DateTime @default(now()) @db.Timestamptz(6)+ updated_at DateTime @default(now()) @db.Timestamptz(6)+ content Json?+ app_id String @id+ apps apps @relation(fields: [app_id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@schema("public")+}++model apps_feedback {+ id BigInt @id @default(autoincrement())+ created_at DateTime @default(now()) @db.Timestamptz(6)+ appId String+ feedback String?+ properties Json? @db.Json++ @@schema("public")+}++model code_snippets {+ id String @id+ creator_id String @db.Uuid+ title String @default("\"\"")+ code String?+ created_at DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamptz(6)+ env_vars Json @default("{}") @db.Json+ template String @default("Nodejs")+ users auth_users @relation(fields: [creator_id], references: [id], onDelete: NoAction, onUpdate: NoAction)+ envs envs[]+ published_code_snippets published_code_snippets?++ @@schema("public")+}++model envs {+ id String @id+ code_snippet_id String?+ template String?+ deps String[]+ state env_state?+ code_snippets code_snippets? @relation(fields: [code_snippet_id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@schema("public")+}++model published_code_snippets {+ code_snippet_id String @unique+ title String @default("")+ code String @default("")+ published_at DateTime? @default(now()) @db.Timestamptz(6)+ id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid+ env_vars Json @default("{}") @db.Json+ template String @default("Nodejs")+ code_snippets code_snippets @relation(fields: [code_snippet_id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@schema("public")+}++model slack_installations {+ id String+ created_at DateTime @default(now()) @db.Timestamptz(6)+ devbook_app_id String+ installation_data Json++ @@id([id, devbook_app_id])+ @@schema("public")+}++model teams {+ id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid+ created_at DateTime @default(now()) @db.Timestamptz(6)+ name String?+ is_default Boolean @default(false)+ api_deployments api_deployments?+ apps apps[]+ users_teams users_teams[]++ @@schema("public")+}++model user_feedback {+ id BigInt @id @default(autoincrement())+ created_at DateTime? @default(now()) @db.Timestamptz(6)+ user_id String? @db.Uuid+ feedback String?+ users auth_users? @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@schema("public")+}++model public_users {+ id String @id @db.Uuid+ created_at DateTime? @default(now()) @db.Timestamptz(6)+ email String?+ users auth_users @relation(fields: [id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@map("users")+ @@schema("public")+}++model users_teams {+ created_at DateTime @default(now()) @db.Timestamptz(6)+ user_id String @db.Uuid+ team_id String @db.Uuid+ teams teams @relation(fields: [team_id], references: [id], onDelete: NoAction, onUpdate: NoAction)+ users auth_users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@id([user_id, team_id])+ @@schema("public")+}++model github_repositories {+ repository_id BigInt @id(map: "github_installations_pkey") @default(autoincrement())+ installation_id BigInt+ installated_at DateTime @default(now()) @db.Timestamptz(6)+ repository_fullname String+ apps apps[]++ @@schema("public")+}++model api_deployments {+ id BigInt @id(map: "deployments_pkey") @default(autoincrement())+ created_at DateTime? @default(now()) @db.Timestamptz(6)+ data Json+ team_id String @unique @db.Uuid+ teams teams @relation(fields: [team_id], references: [id], onDelete: NoAction, onUpdate: NoAction)++ @@schema("public")+}++enum aal_level {+ aal1+ aal2+ aal3++ @@schema("auth")+}++enum factor_status {+ unverified+ verified++ @@schema("auth")+}++enum factor_type {+ totp+ webauthn++ @@schema("auth")+}++enum env_state {+ Building+ Failed+ Done+ None++ @@schema("public")+}++enum template {+ Nodejs+ Go+ Bash+ Python3+ Java+ Rust+ Perl+ PHP+ Ansys+ Typescript++ @@schema("public")+}++enum template_old {+ None+ Nodejs+ Go+ Bash+ Python+ Java+ Rust+ Perl+ PHP++ @@schema("public")+}diff --git a/styles/global.css b/styles/global.cssindex b7d61ee86..a7af12c73 100644--- a/styles/global.css+++ b/styles/global.css@@ -1,6 +1,6 @@+@tailwind base;@tailwind components;@tailwind utilities;-@tailwind base;@layer base {:root {@@ -25,4 +25,5 @@#__next {@apply flex h-inherit flex-col items-center;}+}diff --git a/tailwind.config.js b/tailwind.config.jsindex 1bfb5d91a..6cdd3af62 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -1,7 +1,7 @@const { fontFamily } = require('tailwindcss/defaultTheme')module.exports = {- content: ['./{pages, components, styles}/**/*.{js,ts,jsx,tsx,css}'],+ content: ['./components/**/*.{js,ts,jsx,tsx,css}', './pages/**/*.{js,ts,jsx,tsx,css}', './styles/**/*.{js,ts,jsx,tsx,css}'],darkMode: 'class',theme: {extend: {@@ -9,7 +9,24 @@ module.exports = {sans: ['var(--font-inter)', ...fontFamily.sans],mono: ['var(--font-jet-brains)', ...fontFamily.mono],},+ spacing: {+ 120: '30rem',+ },height: { inherit: 'inherit' },+ colors: {+ gray: {+ 100: '#FBFBFB',+ },+ green: {+ 400: '#E9F5E6',+ 800: '#20BC69',+ },+ cyan: {+ 100: '#b3d1fb',+ 200: '#AFCDF3',+ 500: '#5BA0FA',+ }+ },},},}diff --git a/utils/notEmpty.ts b/utils/notEmpty.tsnew file mode 100644index 000000000..433679074--- /dev/null+++ b/utils/notEmpty.ts@@ -0,0 +1,3 @@+export function notEmpty<T>(value: T | null | undefined): value is T {+ return value !== null && value !== undefined+}\ No newline at end of filediff --git a/yarn.lock b/yarn.lockindex 08bf7e275..5e7cee419 100644--- a/yarn.lock+++ b/yarn.lock@@ -1446,6 +1446,23 @@tiny-glob "^0.2.9"tslib "^2.4.0"+"@prisma/client@^4.11.0":+ version "4.11.0"+ resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.11.0.tgz#41d5664dea4172c954190a432f70b86d3e2e629b"+ integrity sha512-0INHYkQIqgAjrt7NzhYpeDQi8x3Nvylc2uDngKyFDDj1tTRQ4uV1HnVmd1sQEraeVAN63SOK0dgCKQHlvjL0KA==+ dependencies:+ "@prisma/engines-version" "4.11.0-57.8fde8fef4033376662cad983758335009d522acb"++"@prisma/engines-version@4.11.0-57.8fde8fef4033376662cad983758335009d522acb":+ version "4.11.0-57.8fde8fef4033376662cad983758335009d522acb"+ resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.11.0-57.8fde8fef4033376662cad983758335009d522acb.tgz#74af5ff56170c78e93ce46c56510160f58cd3c01"+ integrity sha512-3Vd8Qq06d5xD8Ch5WauWcUUrsVPdMC6Ge8ILji8RFfyhUpqon6qSyGM0apvr1O8n8qH8cKkEFqRPsYjuz5r83g==++"@prisma/[email protected]":+ version "4.11.0"+ resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-4.11.0.tgz#c99749bfe20f58e8f4d2b5e04fee0785eba440e1"+ integrity sha512-0AEBi2HXGV02cf6ASsBPhfsVIbVSDC9nbQed4iiY5eHttW9ZtMxHThuKZE1pnESbr8HRdgmFSa/Kn4OSNYuibg==+"@reactflow/[email protected]":version "11.1.8"resolved "https://registry.yarnpkg.com/@reactflow/background/-/background-11.1.8.tgz#e804eb82ade6f70ab5f218dc767051083497c0f7"@@ -3031,6 +3048,13 @@ cookie@^0.4.1:resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432"integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==+copy-anything@^3.0.2:+ version "3.0.3"+ resolved "https://registry.yarnpkg.com/copy-anything/-/copy-anything-3.0.3.tgz#206767156f08da0e02efd392f71abcdf79643559"+ integrity sha512-fpW2W/BqEzqPp29QS+MwwfisHCQZtiduTe/m8idFo0xbti9fIZ2WVhAsCv4ggFVH3AgCkVdpoOCtQC6gBrdhjw==+ dependencies:+ is-what "^4.1.8"+core-js-compat@^3.25.1:version "3.29.0"resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.29.0.tgz#1b8d9eb4191ab112022e7f6364b99b65ea52f528"@@ -4804,6 +4828,13 @@ hast-util-whitespace@^2.0.0:resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz#0ec64e257e6fc216c7d14c8a1b74d27d650b4557"integrity sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==+hoist-non-react-statics@^3.3.2:+ version "3.3.2"+ resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"+ integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==+ dependencies:+ react-is "^16.7.0"+http-cache-semantics@^4.0.0:version "4.1.1"resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"@@ -5220,6 +5251,11 @@ is-weakset@^2.0.1:call-bind "^1.0.2"get-intrinsic "^1.1.1"+is-what@^4.1.8:+ version "4.1.8"+ resolved "https://registry.yarnpkg.com/is-what/-/is-what-4.1.8.tgz#0e2a8807fda30980ddb2571c79db3d209b14cbe4"+ integrity sha512-yq8gMao5upkPoGEU9LsB2P+K3Kt8Q3fQFCGyNCWOAnJAMzEXVV9drYb0TXr42TTliLLhKIBvulgAXgtLLnwzGA==+is-wsl@^2.2.0:version "2.2.0"resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271"@@ -6147,6 +6183,13 @@ netmask@^2.0.2:resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7"integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==+next-superjson-plugin@^0.5.6:+ version "0.5.6"+ resolved "https://registry.yarnpkg.com/next-superjson-plugin/-/next-superjson-plugin-0.5.6.tgz#dbb76f6559becccb41f83a7aff1938be7c52057b"+ integrity sha512-vokzkgtr3axon5uXobhXJWN6/YlPOHdcAb/BeR+d0rXA3h1b5h98A+V0TgMUf+vcy9RvBqte/ppaJfkOwi4NGA==+ dependencies:+ hoist-non-react-statics "^3.3.2"+next-tick@^1.1.0:version "1.1.0"resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb"@@ -6927,6 +6970,13 @@ [email protected], pretty-ms@^7.0.1:dependencies:parse-ms "^2.1.0"+prisma@^4.11.0:+ version "4.11.0"+ resolved "https://registry.yarnpkg.com/prisma/-/prisma-4.11.0.tgz#9695ba4129a43eab3e76b5f7a033c6c020377725"+ integrity sha512-4zZmBXssPUEiX+GeL0MUq/Yyie4ltiKmGu7jCJFnYMamNrrulTBc+D+QwAQSJ01tyzeGHlD13kOnqPwRipnlNw==+ dependencies:+ "@prisma/engines" "4.11.0"+process-nextick-args@~2.0.0:version "2.0.1"resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"@@ -7063,7 +7113,7 @@ [email protected]:loose-envify "^1.1.0"scheduler "^0.23.0"-react-is@^16.13.1:+react-is@^16.13.1, react-is@^16.7.0:version "16.13.1"resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==@@ -7700,6 +7750,13 @@ stylehacks@^5.1.1:browserslist "^4.21.4"postcss-selector-parser "^6.0.4"+superjson@^1.12.2:+ version "1.12.2"+ resolved "https://registry.yarnpkg.com/superjson/-/superjson-1.12.2.tgz#072471f1e6add2d95a38b77fef8c7a199d82103a"+ integrity sha512-ugvUo9/WmvWOjstornQhsN/sR9mnGtWGYeTxFuqLb4AiT4QdUavjGFRALCPKWWnAiUJ4HTpytj5e0t5HoMRkXg==+ dependencies:+ copy-anything "^3.0.2"+supports-color@^5.3.0:version "5.5.0"resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"