The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Convert some layout files to tsx and split up lib/constants into smaller files
Joshen Lima3bebcff5910
diff --git a/studio/components/layouts/AccountLayout.tsx b/studio/components/layouts/AccountLayout/AccountLayout.tsxsimilarity index 92%rename from studio/components/layouts/AccountLayout.tsxrename to studio/components/layouts/AccountLayout/AccountLayout.tsxindex 65bc7f74afd..e6cd2c1d28d 100644--- a/studio/components/layouts/AccountLayout.tsx+++ b/studio/components/layouts/AccountLayout/AccountLayout.tsx@@ -4,7 +4,7 @@ import { observer } from 'mobx-react-lite'import { API_URL, IS_PLATFORM } from 'lib/constants'import { useStore } from 'hooks'-import WithSidebar from 'components/layouts/WithSidebar'+import WithSidebar from './WithSidebar'/*** layout for dashboard homepage, account and org settings@@ -105,13 +105,7 @@ const AccountLayout = ({ children, title, breadcrumbs }: any) => {style={{ maxHeight: '100vh' }}className="w-full flex flex-col flex-1 overflow-y-auto">- {/* @ts-ignore */}- <WithSidebar- breadcrumbs={breadcrumbs}- links={linksWithHeaders}- title={title}- hideIconSidebar- >+ <WithSidebar title={title} breadcrumbs={breadcrumbs} links={linksWithHeaders}>{children}</WithSidebar></main>diff --git a/studio/components/layouts/WithSidebar.js b/studio/components/layouts/AccountLayout/WithSidebar.tsxsimilarity index 70%rename from studio/components/layouts/WithSidebar.jsrename to studio/components/layouts/AccountLayout/WithSidebar.tsxindex 1ed25f39869..c9ec89d0e4b 100644--- a/studio/components/layouts/WithSidebar.js+++ b/studio/components/layouts/AccountLayout/WithSidebar.tsx@@ -1,25 +1,22 @@import Link from 'next/link'-// import IconSidebar from 'components/Layouts/IconSidebar'+import { CSSProperties, FC, ReactNode } from 'react'import { Menu, Typography, IconArrowUpRight, Badge } from '@supabase/ui'-import LayoutHeader from './ProjectLayout/LayoutHeader'+import LayoutHeader from '../ProjectLayout/LayoutHeader'-/**- * layout for all pages under /project/ route- *- * @param {String} title- * @param {JSX.Element|JSX.Element[]} header- * @param {JSX.Element|JSX.Element[]} children- * @param {CSSProperties} sidebarStyle- * @param {Array<Object>} icons 1st level group links- * @param {Array<Object>} links 2nd level links related to group link- * @param {Array<Object>} subitems subitems link to different sections on the same page- * @param {Number} subitemsParentKey index of subitems parent link- * @param {boolean} hideIconSidebar Hides the left-most icon bar- * @param {JSX.Element|JSX.Element[]} customSidebarContent For injecting custom JSX into the sidebar- * @param {string} projectRef Project ref string used in url- */+interface Props {+ title: string+ breadcrumbs: any[]+ links: any[]+ header?: ReactNode+ subitems?: any[]+ subitemsParentKey?: number+ sidebarStyle?: CSSProperties+ hideSidebar?: boolean+ customSidebarContent?: ReactNode+ children: ReactNode+}-const WithSidebar = ({+const WithSidebar: FC<Props> = ({title,header,breadcrumbs = [],@@ -28,18 +25,14 @@ const WithSidebar = ({links,subitems,subitemsParentKey,- icons = [],- hideIconSidebar = false,hideSidebar = false,customSidebarContent,- projectRef,}) => {const noContent = !links && !customSidebarContentconst linksHaveHeaders = links && links[0].headingreturn (<div className={`flex `}>- {/* {!hideIconSidebar && <IconSidebar links={icons} projectRef={projectRef} key="IconSidebar" />} */}{!hideSidebar && !noContent && (<divid="with-sidebar"@@ -89,8 +82,8 @@ const WithSidebar = ({}export default WithSidebar-const LinksWithHeaders = ({ links, subitems, subitemsParentKey }) => {- return links.map((x) => (+const LinksWithHeaders: FC<any> = ({ links, subitems, subitemsParentKey }) => {+ return links.map((x: any) => (<div key={x.heading} className="py-5 border-b dark:border-dark px-3"><Menu.Group title={x.heading} />{x.versionLabel && (@@ -108,13 +101,14 @@ const LinksWithHeaders = ({ links, subitems, subitemsParentKey }) => {</div>))}-const LinksWithoutHeaders = ({ links, subitems, subitemsParentKey }) => {+const LinksWithoutHeaders: FC<any> = ({ links, subitems, subitemsParentKey }) => {return (<ul className="dash-product-menu space-y-1">- {links.map((x, i) => {+ {links.map((x: any, i: number) => {// disable active state for link with subitemsconst isActive = x.isActive && !subitems- let render = (++ let render: any = (<SidebarItemkey={`${x.key || x.as}-${i}-sidebarItem`}id={`${x.key || x.as}-${i}`}@@ -127,8 +121,9 @@ const LinksWithoutHeaders = ({ links, subitems, subitemsParentKey }) => {external={x.external || false}/>)+if (subitems && x.subitemsKey === subitemsParentKey) {- const subItemsRender = subitems.map((y, i) => (+ const subItemsRender = subitems.map((y: any, i: number) => (<SidebarItemkey={`${y.key || y.as}-${i}-sidebarItem`}id={`${y.key || y.as}-${i}`}@@ -141,24 +136,24 @@ const LinksWithoutHeaders = ({ links, subitems, subitemsParentKey }) => {))render = [render, ...subItemsRender]}+return render})}</ul>)}-const SidebarItem = ({ id, label, as, href, slug, isActive, isSubitem, onClick, external }) => {+const SidebarItem: FC<any> = ({ id, label, as, href, isActive, isSubitem, onClick, external }) => {return (<Link href={href || ''} as={as || ''}><a className="block" target={external ? '_blank' : '_self'}><Menu.Itemrounded+ key={id}style={{marginLeft: isSubitem && '.5rem',}}active={isActive ? true : false}- key={id}- id={slug}onClick={onClick || (() => {})}icon={external && <IconArrowUpRight size={'tiny'} />}>diff --git a/studio/components/layouts/WizardLayout.js b/studio/components/layouts/WizardLayout.tsxsimilarity index 87%rename from studio/components/layouts/WizardLayout.jsrename to studio/components/layouts/WizardLayout.tsxindex b3aca5bc5ec..12b442a748a 100644--- a/studio/components/layouts/WizardLayout.js+++ b/studio/components/layouts/WizardLayout.tsx@@ -1,9 +1,9 @@-import React from 'react'+import { FC } from 'react'import Link from 'next/link'import BaseLayout from 'components/layouts'import { IconChevronRight, Typography } from '@supabase/ui'-const WizardLayout = ({ organization, project, children }) => {+const WizardLayout: FC<any> = ({ organization, project, children }) => {return (<BaseLayout hideHeader hideIconBar><div className="flex flex-col h-full w-full">@@ -19,7 +19,7 @@ const WizardLayout = ({ organization, project, children }) => {}export default WizardLayout-const Header = ({ organization, project }) => {+const Header: FC<any> = ({ organization, project }) => {let stepNumber = organization ? 1 : project ? 2 : 0return (<div className="p-3 border-b dark:border-dark">@@ -50,13 +50,13 @@ const Header = ({ organization, project }) => {<Typography.Text type="secondary"><IconChevronRight size="small" /></Typography.Text>- <Typography.Text small type={stepNumber < 1 && 'secondary'}>+ <Typography.Text small type={stepNumber < 1 ? 'secondary' : 'default'}><a>{project ? project.name : 'Create a new project'}</a></Typography.Text><Typography.Text type="secondary"><IconChevronRight size="small" /></Typography.Text>- <Typography.Text small type={stepNumber < 2 && 'secondary'}>+ <Typography.Text small type={stepNumber < 2 ? 'secondary' : 'default'}><a>{project ? project.name : 'Extend your database'}</a></Typography.Text></div>diff --git a/studio/components/layouts/index.ts b/studio/components/layouts/index.tsindex 2e0d1bff809..cd935838e4e 100644--- a/studio/components/layouts/index.ts+++ b/studio/components/layouts/index.ts@@ -7,6 +7,10 @@ import DocsLayout from './DocsLayout/DocsLayout'import SettingsLayout from './SettingsLayout/SettingsLayout'import StorageLayout from './StorageLayout/StorageLayout'+import AccountLayout from './AccountLayout/AccountLayout'+import WizardLayout from './WizardLayout'+import VercelIntegrationLayout from './VercelIntegrationLayout'+export {AuthLayout,DatabaseLayout,@@ -15,5 +19,8 @@ export {SQLEditorLayout,SettingsLayout,StorageLayout,+ AccountLayout,+ WizardLayout,+ VercelIntegrationLayout,}export default ProjectLayoutdiff --git a/studio/components/to-be-cleaned/Reports/Reports.constants.ts b/studio/components/to-be-cleaned/Reports/Reports.constants.tsnew file mode 100644index 00000000000..bcb6cd0a382--- /dev/null+++ b/studio/components/to-be-cleaned/Reports/Reports.constants.ts@@ -0,0 +1,19 @@+export const NEW_REPORT_SKELETON = {+ name: 'new report',+ description: '',+ type: 'report',+ visibility: 'project',+ content: {+ schema_version: 1,+ period_start: {+ time_period: '7d',+ date: '',+ },+ period_end: {+ time_period: 'today',+ date: '',+ },+ interval: '1d',+ layout: [],+ },+}diff --git a/studio/components/to-be-cleaned/Reports/Reports.utils.ts b/studio/components/to-be-cleaned/Reports/Reports.utils.tsindex 2d373495ff3..1c061871f35 100644--- a/studio/components/to-be-cleaned/Reports/Reports.utils.ts+++ b/studio/components/to-be-cleaned/Reports/Reports.utils.ts@@ -1,5 +1,5 @@import { useProjectContentStore } from 'stores/projectContentStore'-import { NEW_REPORT_SKELETON } from 'lib/constants'+import { NEW_REPORT_SKELETON } from './Reports.constants'import toast from 'react-hot-toast'function handleErr(error: any) {diff --git a/studio/lib/constants.js b/studio/lib/constants.jsdeleted file mode 100644index 99549324a8a..00000000000--- a/studio/lib/constants.js+++ /dev/null@@ -1,802 +0,0 @@-import { IconArchive, IconDatabase, IconHeart, IconKey } from '@supabase/ui'-import { concat, sortBy } from 'lodash'--// Ideally we'd split this into smaller, more scoped and easily readable files-// And shift them under common/constants/xxx.ts--export const IS_PLATFORM = process.env.NEXT_PUBLIC_IS_PLATFORM === 'true'-export const API_URL = IS_PLATFORM ? process.env.NEXT_PUBLIC_API_URL : '/api'-export const PG_META_URL = IS_PLATFORM- ? process.env.PLATFORM_PG_META_URL- : process.env.STUDIO_PG_META_URL--export const POSTGRES_SUPER_ADMIN = 'supabase_admin'-export const POSTGRES_AUTH_ADMIN = 'supabase_auth_admin'-export const POSTGRES_STORAGE_ADMIN = 'supabase_storage_admin'-export const POSTGRES_POSTGREST = 'authenticator'-export const POSTGRES_PGBOUNCER = 'pgbouncer'--export const DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'--export const QUEUES = {- // All infra tasks- INFRA: {- id: 'infra',- tasks: {- CREATE: 'create', // initialises a new server- DELETE: 'delete', // destroys a server- UPDATE: 'update', // updates the server's config- REPLACE: 'replace', // replace the server- },- },- DB: {- id: 'database',- tasks: {- CREATE: 'create', // initialises a new server- DELETE: 'delete', // destroys a server- UPDATE: 'update', // updates the server's config- RESTORE: 'restore', // restore a db with a given backup file- },- },- DUMP: {- id: 'dump',- tasks: {- BULK_PREPARE: 'bulk_prepare',- DUMP: 'dump',- PREPARE: 'prepare',- },- },- RESTORE: {- id: 'restore',- tasks: {- PREPARE: 'prepare',- RESTORE: 'restore',- },- },- EVENTS: {- id: 'events',- tasks: {- organization_created: 'organization.created',- organization_updated: 'organization.updated',- organization_deleted: 'organization.deleted',- project_created: 'project.created',- project_updated: 'project.updated',- project_deleted: 'project.deleted',- },- },-}--// alias regions remain as the starting point for project creation-// they are immediately translated to their respective cloud regions-// and are afterward never referred to-export const REGIONS = {- WEST_US: 'West US (North California)',- EAST_US: 'East US (North Virginia)',- CENTRAL_CANADA: 'Canada (Central)',- WEST_EU: 'West EU (Ireland)',- WEST_EU_2: 'West EU (London)',- // 'North EU': 'North EU',- CENTRAL_EU: 'Central EU (Frankfurt)',- SOUTH_ASIA: 'South Asia (Mumbai)',- SOUTHEAST_ASIA: 'Southeast Asia (Singapore)',- NORTHEAST_ASIA: 'Northeast Asia (Tokyo)',- NORTHEAST_ASIA_2: 'Northeast Asia (Seoul)',- OCEANIA: 'Oceania (Sydney)',- SOUTH_AMERICA: 'South America (São Paulo)',- // SOUTH_AFRICA: 'South Africa (Cape Town)',-}--export const REGIONS_DEFAULT = REGIONS.EAST_US--export const PROVIDERS = {- // Digital Ocean- DO: {- id: 'DO',- name: 'digitalocean',- DEFAULT_SSH_KEY: '26347828',- regions: {- EAST_US: 'nyc1', // New York City, United States- // 'North EU': 'ams3', //Amsterdam, the Netherlands- WEST_US: 'sfo2', // San Francisco, United States- SOUTHEAST_ASIA: 'sgp1', // Singapore- WEST_US: 'lon1', // London- CENTRAL_EU: 'fra1', // Frankfurt- CENTRAL_CANADA: 'tor1', // Toronto- SOUTH_ASIA: 'blr1', // Bangalore- },- sizes: {- 512: '512mb', // Don't use - https://developers.digitalocean.com/documentation/changelog/api-v2/new-size-slugs-for-droplet-plan-changes/- 's-1vcpu-1gb': {- id: 's-1vcpu-1gb',- description: '',- },- },- },- AWS: {- id: 'AWS',- name: 'aws',- DEFAULT_SSH_KEY: 'supabase-app-instance',- regions: {- EAST_US: 'us-east-1', // North Virginia- // 'North EU': 'eu-north-1', // Stockholm- WEST_US: 'us-west-1', // North California- SOUTHEAST_ASIA: 'ap-southeast-1', // Singapore- NORTHEAST_ASIA: 'ap-northeast-1', // Tokyo- NORTHEAST_ASIA_2: 'ap-northeast-2', //Seoul- OCEANIA: 'ap-southeast-2', // Sydney- WEST_EU: 'eu-west-1', // Ireland- WEST_EU_2: 'eu-west-2', // London- CENTRAL_EU: 'eu-central-1', // Frankfurt- CENTRAL_CANADA: 'ca-central-1', // Central Canada- SOUTH_ASIA: 'ap-south-1', // Mumbai- SOUTH_AMERICA: 'sa-east-1', // Sao Paulo- // SOUTH_AFRICA: 'af-south-1', // Cape Town- },- sizes: {- nano: {- x86_64: 't3.nano',- arm64: 't4g.nano',- description: '512mb RAM',- },- micro: {- x86_64: 't3.micro',- arm64: 't4g.micro',- description: '1gb RAM',- },- medium: {- x86_64: 'm5a.large',- arm64: 'm6g.medium',- description: '4gb RAM',- },- },- },-}--// @todo ini update for prod-export const AWS_SUPPORTED_AZ = {- EAST_US: ['us-east-1a', 'us-east-1b', 'us-east-1c', 'us-east-1d', 'us-east-1e', 'us-east-1f'],- SOUTHEAST_ASIA: ['ap-southeast-1a', 'ap-southeast-1b', 'ap-southeast-1c'],- WEST_EU: ['eu-west-1a', 'eu-west-1b', 'eu-west-1c'],-}--export const SERVICE_STATUS = {- INACTIVE: 'INACTIVE',- ACTIVE_HEALTHY: 'ACTIVE_HEALTHY',- ACTIVE_UNHEALTHY: 'ACTIVE_UNHEALTHY',- COMING_UP: 'COMING_UP',- UNKNOWN: 'UNKNOWN',- GOING_DOWN: 'GOING_DOWN',- INIT_FAILED: 'INIT_FAILED',- REMOVED: 'REMOVED',-}--export const PROJECT_STATUS = {- INACTIVE: 'INACTIVE',- ACTIVE_HEALTHY: 'ACTIVE_HEALTHY',- ACTIVE_UNHEALTHY: 'ACTIVE_UNHEALTHY',- COMING_UP: 'COMING_UP',- UNKNOWN: 'UNKNOWN',- GOING_DOWN: 'GOING_DOWN',- INIT_FAILED: 'INIT_FAILED',- REMOVED: 'REMOVED',- RESTORING: 'RESTORING',-}--// Not used anywhere but referenced in a comment in interfaces.js (L12)-export const APPS = {- AUTO_API: {- id: 'AUTO_API',- name: 'Auto API',- },-}--export const SIDE_PANEL_KEYS = {- ROW: 'ROW',- TABLE: 'TABLE',- COLUMN: 'COLUMN',-}--export const FILTER_CONDITIONS = {- EQ: {- name: 'EQ',- tooltip: 'Equals to',- },- NEQ: {- name: 'NEQ',- tooltip: 'Not equals to',- },- GT: {- name: 'GT',- tooltip: 'Greater than',- },- LT: {- name: 'LT',- tooltip: 'Less than',- },- GTE: {- name: 'GTE',- tooltip: 'Greater than or equals to',- },- LTE: {- name: 'LTE',- tooltip: 'Less than or equals to',- },- LIKE: {- name: 'LIKE',- tooltip: 'Pattern matching with %',- },- ILIKE: {- name: 'ILIKE',- tooltip: 'Case sensitive matching',- },- IS: {- name: 'IS',- tooltip: 'Checks for exact quality',- },- IN: {- name: 'IN',- tooltip: 'Checks if value in list',- },-}--// Data types primarily for mapping icon in editor--export const NUMERICAL_TYPES = ['int2', 'int4', 'int8', 'float4', 'float8']-export const JSON_TYPES = ['json', 'jsonb']-export const TEXT_TYPES = ['text', 'varchar']-export const TIMESTAMP_TYPES = ['date', 'time', 'timestamp', 'timetz', 'timestamptz']-export const OTHER_DATA_TYPES = ['uuid', 'bool']-export const POSTGRES_DATA_TYPES = sortBy(- concat(NUMERICAL_TYPES, JSON_TYPES, TEXT_TYPES, TIMESTAMP_TYPES, OTHER_DATA_TYPES)-)--// Keyboard Shortcuts Related-export const SHORTCUT_KEYS = {- VIEW_ALL_SHORTCUTS: 'VIEW_ALL_SHORTCUTS',- TOGGLE_FILTER_MENU: 'TOGGLE_FILTER_MENU',- TOGGLE_SORT_MENU: 'TOGGLE_SORT_MENU',- CLOSE_SIDE_PANEL: 'CLOSE_SIDE_PANEL',- EDIT_CELL: 'EDIT_CELL',- COPY_CELL: 'COPY_CELL',- PASTE_CELL: 'PASTE_CELL',- CREATE_ROW: 'CREATE_ROW',- EDIT_ROW: 'EDIT_ROW',- DELETE_ROW: 'DELETE_ROW',- SCROLL_EDGES: 'SCROLL_EDGES',-}--export const GENERAL_SHORTCUTS = [- {- key: SHORTCUT_KEYS.VIEW_ALL_SHORTCUTS,- name: 'View all shortcuts',- keys: ['Shift+/'],- },- {- key: SHORTCUT_KEYS.CLOSE_SIDE_PANEL,- name: 'Close side panel',- keys: ['Esc'],- },-]--export const generateEditorShortcuts = (clientOS) => {- let metaKey = '⌘'- if (clientOS === 'windows') metaKey = 'Ctrl'- return [- {- key: SHORTCUT_KEYS.EDIT_CELL,- name: 'Edit current cell',- keys: ['Enter'],- },- {- key: SHORTCUT_KEYS.COPY_CELL,- name: 'Copy value of current cell',- keys: [`${metaKey}+C`],- },- {- key: SHORTCUT_KEYS.PASTE_CELL,- name: 'Paste value into current cell',- keys: [`${metaKey}+V`],- },- {- key: SHORTCUT_KEYS.CREATE_ROW,- name: 'Create a new row',- keys: ['Shift+Enter'],- },- {- key: SHORTCUT_KEYS.SCROLL_EDGES,- name: 'Scroll to edges of the table',- keys: [`${metaKey}+↑`, `${metaKey}+→`, `${metaKey}+↓`, `${metaKey}+←`],- },- ]-}--export const EDITOR_STATUS = {- SAVING: 'SAVING',- READY: 'READY',-}--export const POLICY_MODAL_VIEWS = {- SELECTION: 'SELECTION',- TEMPLATES: 'TEMPLATES',- EDITOR: 'EDITOR',- REVIEW: 'REVIEW',-}--export const STRIPE_PRODUCT_IDS = {- PAYG: process?.env?.NEXT_PUBLIC_STRIPE_PAYG_TIER_ID,- PRO: process?.env?.NEXT_PUBLIC_STRIPE_PRO_TIER_ID,- FREE: process?.env?.NEXT_PUBLIC_STRIPE_FREE_TIER_ID,-}--export const TIER_NAMES = {- PAYG: 'Pay as you go',- PRO: 'Pro',- FREE: 'Free',-}--export const DEFAULT_PRODUCTS = [- {- // Free tier- price: process?.env?.NEXT_PUBLIC_STRIPE_PRODUCT_FREE_TIER_PRICE_FREE,- },-]--export const PGBOUNCER_CONFIG = {- pool_mode: 'transaction',- default_pool_size: 15,- ignore_startup_parameters: 'extra_float_digits',-}--export const DEFAULT_ORG_PROJECTS_LIMIT = 3-export const DEFAULT_MINIMUM_PASSWORD_STRENGTH = 4--const METRIC_CATEGORIES_ICON_SIZE = 16--export const METRIC_CATEGORIES = {- // API: {- // label: 'All API usage',- // icon: <IconActivity />,- // key: 'api',- // },- API_DATABASE: {- label: 'Database API',- icon: <IconDatabase size={METRIC_CATEGORIES_ICON_SIZE} />,- key: 'api_database',- },- API_AUTH: {- label: 'Auth API',- icon: <IconKey size={METRIC_CATEGORIES_ICON_SIZE} />,- key: 'api_auth',- },- API_STORAGE: {- label: 'Storage API',- icon: <IconArchive size={METRIC_CATEGORIES_ICON_SIZE} />,- key: 'api_storage',- },- // API_REALTIME: {- // label: 'Realtime API',- // icon: '',- // key: 'api_realtime',- // },- INSTANCE: {- label: 'Instance health',- icon: <IconHeart size={METRIC_CATEGORIES_ICON_SIZE} />,- key: 'instance',- },- // POSTGRES: {- // label: 'Postgres usage',- // icon: '',- // key: 'postgres',- // },-}--export const METRICS = [- {- key: 'cpu_usage',- label: 'CPU % usage',- provider: 'infra-monitoring',- category: METRIC_CATEGORIES.INSTANCE,- },- {- key: 'ram_usage',- label: 'Memory % usage',- provider: 'infra-monitoring',- category: METRIC_CATEGORIES.INSTANCE,- },- {- key: 'total_realtime_egress',- label: 'Realtime Connection Egress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- {- key: 'total_realtime_get_requests',- label: 'Realtime Connection Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_REALTIME,- },- {- key: 'total_realtime_ingress',- label: 'Realtime Connection Ingress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_REALTIME,- },- // {- // key: 'total_realtime_post_requests',- // label: 'total_realtime_post_requests',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API_REALTIME,- // },- {- key: 'total_realtime_requests',- label: 'Connection Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_REALTIME,- },-- /**- * API- */- {- key: 'total_rest_ingress',- label: 'API Ingress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },- {- key: 'total_rest_egress',- label: 'API Egress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },- {- key: 'total_rest_requests',- label: 'API Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },- {- key: 'total_rest_get_requests',- label: 'API GET Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },- {- key: 'total_rest_post_requests',- label: 'API POST Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },- {- key: 'total_rest_patch_requests',- label: 'API PATCH Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },- {- key: 'total_rest_delete_requests',- label: 'API DELETE Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },- {- key: 'total_rest_options_requests',- label: 'API OPTIONS Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_DATABASE,- },-- /**- * Auth- */-- // {- // key: 'total_auth_users',- // label: 'Total Auth Users',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API_AUTH,- // },- {- key: 'total_auth_ingress',- label: 'Auth Ingress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },- {- key: 'total_auth_egress',- label: 'Auth Egress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },- {- key: 'total_auth_requests',- label: 'Auth Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },- {- key: 'total_auth_get_requests',- label: 'Auth GET Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },- {- key: 'total_auth_post_requests',- label: 'Auth POST Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },- {- key: 'total_auth_patch_requests',- label: 'Auth PATCH requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },- {- key: 'total_auth_options_requests',- label: 'Auth OPTIONS requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },-- /**- * Storage- */- {- key: 'total_storage_ingress',- label: 'Storage Ingress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_storage_egress',- label: 'Storage Egress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_storage_requests',- label: 'Storage Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_storage_get_requests',- label: 'Storage GET Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_storage_post_requests',- label: 'Storage POST Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_storage_delete_requests',- label: 'Storage DELETE Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_storage_options_requests',- label: 'Storage OPTIONS Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_auth_delete_requests',- label: 'Auth DELETE Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_AUTH,- },-- {- key: 'total_egress',- label: 'All Egress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- // {- // key: 'total_auth_emails',- // name: 'total_auth_emails',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API,- // },- // {- // key: 'total_auth_texts',- // name: 'total_auth_texts',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API,- // },-- {- key: 'total_get_requests',- label: 'All GET Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- // {- // key: 'total_db_size_bytes',- // name: 'total_db_size_bytes',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API,- // },- // {- // key: 'total_storage_size_bytes',- // name: 'total_storage_size_bytes',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API,- // },- // {- // key: 'total_realtime_delete_requests',- // label: 'total_realtime_delete_requests',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API_REALTIME,- // },- {- key: 'total_storage_patch_requests',- label: 'Storage PATCH Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API_STORAGE,- },- {- key: 'total_requests',- label: 'All Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- // {- // key: 'total_realtime_options_requests',- // label: 'total_realtime_options_requests',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API_REALTIME,- // },-- {- key: 'total_patch_requests',- label: 'All PATCH Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- {- key: 'total_post_requests',- label: 'All POST Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },-- {- key: 'total_ingress',- label: 'All Ingress',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- // {- // key: 'total_realtime_patch_requests',- // label: 'total_realtime_patch_requests',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API_REALTIME,- // },- {- key: 'total_delete_requests',- label: 'All DELETE Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- {- key: 'total_options_requests',- label: 'All OPTIONS Requests',- provider: 'daily-stats',- category: METRIC_CATEGORIES.API,- },- // {- // key: 'total_db_egress_bytes',- // name: 'total_db_egress_bytes',- // provider: 'daily-stats',- // category: METRIC_CATEGORIES.API,- // },-]--export const TIME_PERIODS_BILLING = [- {- key: 'currentBillingCycle',- label: 'Current billing cycle',- interval: '1d',- },- {- key: 'previousBillingCycle',- label: 'Previous billing cycle',- interval: '1d',- },-]--export const TIME_PERIODS_REPORTS = [- {- key: '7d',- label: 'Last 7 days',- interval: '1d',- },- {- key: '30d',- label: 'Last 30 days',- interval: '1d',- },- // {- // key: '60d',- // label: 'Last 60 days',- // interval: '1d',- // },- // {- // key: '120d',- // label: 'Last 120 days',- // interval: '1d',- // },- {- key: 'startMonth',- label: 'This month',- interval: '1d',- },-]--export const TIME_PERIODS_INFRA = [- {- key: '1h',- label: 'Last hour',- interval: '1m',- },- {- key: '3h',- label: 'Last 3 hours',- interval: '5m',- },- {- key: '1d',- label: 'Last 24 hours',- interval: '30m',- },-]--export const NEW_REPORT_SKELETON = {- name: 'new report',- description: '',- type: 'report',- visibility: 'project',- content: {- schema_version: 1,- period_start: {- time_period: '7d',- date: '',- },- period_end: {- time_period: 'today',- date: '',- },- interval: '1d',- layout: [],- },-}--export const PASSWORD_STRENGTH = {- 0: 'This password is not acceptable.',- 1: 'This password is not secure enough.',- 2: 'This password is not secure enough.',- 3: 'Not bad, but your password must be harder to guess.',- 4: 'This password is strong.',-}--export const PASSWORD_STRENGTH_COLOR = {- 0: 'bg-red-500',- 1: 'bg-red-400',- 2: 'bg-yellow-500',- 3: 'bg-yellow-500',- 4: 'bg-green-500',-}--export const PASSWORD_STRENGTH_PERCENTAGE = {- 0: '10%',- 1: '30%',- 2: '50%',- 3: '80%',- 4: '100%',-}diff --git a/studio/lib/constants/index.ts b/studio/lib/constants/index.tsnew file mode 100644index 00000000000..2a2742886ae--- /dev/null+++ b/studio/lib/constants/index.ts@@ -0,0 +1,89 @@+import { sortBy, concat } from 'lodash'++export * from './infrastructure'+export * from './metrics'++export const IS_PLATFORM = process.env.NEXT_PUBLIC_IS_PLATFORM === 'true'+export const API_URL = IS_PLATFORM ? process.env.NEXT_PUBLIC_API_URL : '/api'+export const PG_META_URL = IS_PLATFORM+ ? process.env.PLATFORM_PG_META_URL+ : process.env.STUDIO_PG_META_URL++export const DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'++// Data types primarily for mapping icon in editor++export const NUMERICAL_TYPES = ['int2', 'int4', 'int8', 'float4', 'float8']+export const JSON_TYPES = ['json', 'jsonb']+export const TEXT_TYPES = ['text', 'varchar']+export const TIMESTAMP_TYPES = ['date', 'time', 'timestamp', 'timetz', 'timestamptz']+export const OTHER_DATA_TYPES = ['uuid', 'bool']+export const POSTGRES_DATA_TYPES = sortBy(+ concat(NUMERICAL_TYPES, JSON_TYPES, TEXT_TYPES, TIMESTAMP_TYPES, OTHER_DATA_TYPES)+)++// Keyboard Shortcuts Related+export const SHORTCUT_KEYS = {+ VIEW_ALL_SHORTCUTS: 'VIEW_ALL_SHORTCUTS',+ TOGGLE_FILTER_MENU: 'TOGGLE_FILTER_MENU',+ TOGGLE_SORT_MENU: 'TOGGLE_SORT_MENU',+ CLOSE_SIDE_PANEL: 'CLOSE_SIDE_PANEL',+ EDIT_CELL: 'EDIT_CELL',+ COPY_CELL: 'COPY_CELL',+ PASTE_CELL: 'PASTE_CELL',+ CREATE_ROW: 'CREATE_ROW',+ EDIT_ROW: 'EDIT_ROW',+ DELETE_ROW: 'DELETE_ROW',+ SCROLL_EDGES: 'SCROLL_EDGES',+}++export const GENERAL_SHORTCUTS = [+ {+ key: SHORTCUT_KEYS.VIEW_ALL_SHORTCUTS,+ name: 'View all shortcuts',+ keys: ['Shift+/'],+ },+ {+ key: SHORTCUT_KEYS.CLOSE_SIDE_PANEL,+ name: 'Close side panel',+ keys: ['Esc'],+ },+]++export const generateEditorShortcuts = (clientOS: string) => {+ const metaKey = clientOS === 'windows' ? 'Ctrl' : '⌘'+ return [+ {+ key: SHORTCUT_KEYS.EDIT_CELL,+ name: 'Edit current cell',+ keys: ['Enter'],+ },+ {+ key: SHORTCUT_KEYS.COPY_CELL,+ name: 'Copy value of current cell',+ keys: [`${metaKey}+C`],+ },+ {+ key: SHORTCUT_KEYS.PASTE_CELL,+ name: 'Paste value into current cell',+ keys: [`${metaKey}+V`],+ },+ {+ key: SHORTCUT_KEYS.CREATE_ROW,+ name: 'Create a new row',+ keys: ['Shift+Enter'],+ },+ {+ key: SHORTCUT_KEYS.SCROLL_EDGES,+ name: 'Scroll to edges of the table',+ keys: [`${metaKey}+↑`, `${metaKey}+→`, `${metaKey}+↓`, `${metaKey}+←`],+ },+ ]+}++export const POLICY_MODAL_VIEWS = {+ SELECTION: 'SELECTION',+ TEMPLATES: 'TEMPLATES',+ EDITOR: 'EDITOR',+ REVIEW: 'REVIEW',+}diff --git a/studio/lib/constants/infrastructure.ts b/studio/lib/constants/infrastructure.tsnew file mode 100644index 00000000000..137e979afd5--- /dev/null+++ b/studio/lib/constants/infrastructure.ts@@ -0,0 +1,124 @@+// Alias regions remain as the starting point for project creation+// they are immediately translated to their respective cloud regions+// and are afterward never referred to+export const REGIONS = {+ WEST_US: 'West US (North California)',+ EAST_US: 'East US (North Virginia)',+ CENTRAL_CANADA: 'Canada (Central)',+ WEST_EU: 'West EU (Ireland)',+ WEST_EU_2: 'West EU (London)',+ // 'North EU': 'North EU',+ CENTRAL_EU: 'Central EU (Frankfurt)',+ SOUTH_ASIA: 'South Asia (Mumbai)',+ SOUTHEAST_ASIA: 'Southeast Asia (Singapore)',+ NORTHEAST_ASIA: 'Northeast Asia (Tokyo)',+ NORTHEAST_ASIA_2: 'Northeast Asia (Seoul)',+ OCEANIA: 'Oceania (Sydney)',+ SOUTH_AMERICA: 'South America (São Paulo)',+ // SOUTH_AFRICA: 'South Africa (Cape Town)',+}++export const REGIONS_DEFAULT = REGIONS.EAST_US++export const PROVIDERS = {+ AWS: {+ id: 'AWS',+ name: 'aws',+ DEFAULT_SSH_KEY: 'supabase-app-instance',+ regions: {+ EAST_US: 'us-east-1', // North Virginia+ // 'North EU': 'eu-north-1', // Stockholm+ WEST_US: 'us-west-1', // North California+ SOUTHEAST_ASIA: 'ap-southeast-1', // Singapore+ NORTHEAST_ASIA: 'ap-northeast-1', // Tokyo+ NORTHEAST_ASIA_2: 'ap-northeast-2', //Seoul+ OCEANIA: 'ap-southeast-2', // Sydney+ WEST_EU: 'eu-west-1', // Ireland+ WEST_EU_2: 'eu-west-2', // London+ CENTRAL_EU: 'eu-central-1', // Frankfurt+ CENTRAL_CANADA: 'ca-central-1', // Central Canada+ SOUTH_ASIA: 'ap-south-1', // Mumbai+ SOUTH_AMERICA: 'sa-east-1', // Sao Paulo+ // SOUTH_AFRICA: 'af-south-1', // Cape Town+ },+ sizes: {+ nano: {+ x86_64: 't3.nano',+ arm64: 't4g.nano',+ description: '512mb RAM',+ },+ micro: {+ x86_64: 't3.micro',+ arm64: 't4g.micro',+ description: '1gb RAM',+ },+ medium: {+ x86_64: 'm5a.large',+ arm64: 'm6g.medium',+ description: '4gb RAM',+ },+ },+ },+}++// @todo ini update for prod+export const AWS_SUPPORTED_AZ = {+ EAST_US: ['us-east-1a', 'us-east-1b', 'us-east-1c', 'us-east-1d', 'us-east-1e', 'us-east-1f'],+ SOUTHEAST_ASIA: ['ap-southeast-1a', 'ap-southeast-1b', 'ap-southeast-1c'],+ WEST_EU: ['eu-west-1a', 'eu-west-1b', 'eu-west-1c'],+}++export const SERVICE_STATUS = {+ INACTIVE: 'INACTIVE',+ ACTIVE_HEALTHY: 'ACTIVE_HEALTHY',+ ACTIVE_UNHEALTHY: 'ACTIVE_UNHEALTHY',+ COMING_UP: 'COMING_UP',+ UNKNOWN: 'UNKNOWN',+ GOING_DOWN: 'GOING_DOWN',+ INIT_FAILED: 'INIT_FAILED',+ REMOVED: 'REMOVED',+}++export const PROJECT_STATUS = {+ INACTIVE: 'INACTIVE',+ ACTIVE_HEALTHY: 'ACTIVE_HEALTHY',+ ACTIVE_UNHEALTHY: 'ACTIVE_UNHEALTHY',+ COMING_UP: 'COMING_UP',+ UNKNOWN: 'UNKNOWN',+ GOING_DOWN: 'GOING_DOWN',+ INIT_FAILED: 'INIT_FAILED',+ REMOVED: 'REMOVED',+ RESTORING: 'RESTORING',+}++export const STRIPE_PRODUCT_IDS = {+ PAYG: process?.env?.NEXT_PUBLIC_STRIPE_PAYG_TIER_ID,+ PRO: process?.env?.NEXT_PUBLIC_STRIPE_PRO_TIER_ID,+ FREE: process?.env?.NEXT_PUBLIC_STRIPE_FREE_TIER_ID,+}++export const DEFAULT_MINIMUM_PASSWORD_STRENGTH = 4++export const PASSWORD_STRENGTH = {+ 0: 'This password is not acceptable.',+ 1: 'This password is not secure enough.',+ 2: 'This password is not secure enough.',+ 3: 'Not bad, but your password must be harder to guess.',+ 4: 'This password is strong.',+}++export const PASSWORD_STRENGTH_COLOR = {+ 0: 'bg-red-500',+ 1: 'bg-red-400',+ 2: 'bg-yellow-500',+ 3: 'bg-yellow-500',+ 4: 'bg-green-500',+}++export const PASSWORD_STRENGTH_PERCENTAGE = {+ 0: '10%',+ 1: '30%',+ 2: '50%',+ 3: '80%',+ 4: '100%',+}diff --git a/studio/lib/constants/metrics.tsx b/studio/lib/constants/metrics.tsxnew file mode 100644index 00000000000..f6f0e8f9b23--- /dev/null+++ b/studio/lib/constants/metrics.tsx@@ -0,0 +1,406 @@+import { IconActivity, IconArchive, IconDatabase, IconKey, IconHeart } from '@supabase/ui'++export const METRIC_CATEGORIES = {+ API: {+ label: 'All API usage',+ icon: <IconActivity />,+ key: 'api',+ },+ API_DATABASE: {+ label: 'Database API',+ icon: <IconDatabase size={16} />,+ key: 'api_database',+ },+ API_AUTH: {+ label: 'Auth API',+ icon: <IconKey size={16} />,+ key: 'api_auth',+ },+ API_STORAGE: {+ label: 'Storage API',+ icon: <IconArchive size={16} />,+ key: 'api_storage',+ },+ API_REALTIME: {+ label: 'Realtime API',+ icon: '',+ key: 'api_realtime',+ },+ INSTANCE: {+ label: 'Instance health',+ icon: <IconHeart size={16} />,+ key: 'instance',+ },+ // POSTGRES: {+ // label: 'Postgres usage',+ // icon: '',+ // key: 'postgres',+ // },+}++export const METRICS = [+ {+ key: 'cpu_usage',+ label: 'CPU % usage',+ provider: 'infra-monitoring',+ category: METRIC_CATEGORIES.INSTANCE,+ },+ {+ key: 'ram_usage',+ label: 'Memory % usage',+ provider: 'infra-monitoring',+ category: METRIC_CATEGORIES.INSTANCE,+ },+ {+ key: 'total_realtime_egress',+ label: 'Realtime Connection Egress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ {+ key: 'total_realtime_get_requests',+ label: 'Realtime Connection Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_REALTIME,+ },+ {+ key: 'total_realtime_ingress',+ label: 'Realtime Connection Ingress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_REALTIME,+ },+ // {+ // key: 'total_realtime_post_requests',+ // label: 'total_realtime_post_requests',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API_REALTIME,+ // },+ {+ key: 'total_realtime_requests',+ label: 'Connection Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_REALTIME,+ },++ /**+ * API+ */+ {+ key: 'total_rest_ingress',+ label: 'API Ingress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },+ {+ key: 'total_rest_egress',+ label: 'API Egress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },+ {+ key: 'total_rest_requests',+ label: 'API Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },+ {+ key: 'total_rest_get_requests',+ label: 'API GET Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },+ {+ key: 'total_rest_post_requests',+ label: 'API POST Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },+ {+ key: 'total_rest_patch_requests',+ label: 'API PATCH Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },+ {+ key: 'total_rest_delete_requests',+ label: 'API DELETE Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },+ {+ key: 'total_rest_options_requests',+ label: 'API OPTIONS Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_DATABASE,+ },++ /**+ * Auth+ */++ // {+ // key: 'total_auth_users',+ // label: 'Total Auth Users',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API_AUTH,+ // },+ {+ key: 'total_auth_ingress',+ label: 'Auth Ingress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },+ {+ key: 'total_auth_egress',+ label: 'Auth Egress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },+ {+ key: 'total_auth_requests',+ label: 'Auth Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },+ {+ key: 'total_auth_get_requests',+ label: 'Auth GET Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },+ {+ key: 'total_auth_post_requests',+ label: 'Auth POST Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },+ {+ key: 'total_auth_patch_requests',+ label: 'Auth PATCH requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },+ {+ key: 'total_auth_options_requests',+ label: 'Auth OPTIONS requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },++ /**+ * Storage+ */+ {+ key: 'total_storage_ingress',+ label: 'Storage Ingress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_storage_egress',+ label: 'Storage Egress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_storage_requests',+ label: 'Storage Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_storage_get_requests',+ label: 'Storage GET Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_storage_post_requests',+ label: 'Storage POST Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_storage_delete_requests',+ label: 'Storage DELETE Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_storage_options_requests',+ label: 'Storage OPTIONS Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_auth_delete_requests',+ label: 'Auth DELETE Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_AUTH,+ },++ {+ key: 'total_egress',+ label: 'All Egress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ // {+ // key: 'total_auth_emails',+ // name: 'total_auth_emails',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API,+ // },+ // {+ // key: 'total_auth_texts',+ // name: 'total_auth_texts',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API,+ // },++ {+ key: 'total_get_requests',+ label: 'All GET Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ // {+ // key: 'total_db_size_bytes',+ // name: 'total_db_size_bytes',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API,+ // },+ // {+ // key: 'total_storage_size_bytes',+ // name: 'total_storage_size_bytes',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API,+ // },+ // {+ // key: 'total_realtime_delete_requests',+ // label: 'total_realtime_delete_requests',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API_REALTIME,+ // },+ {+ key: 'total_storage_patch_requests',+ label: 'Storage PATCH Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API_STORAGE,+ },+ {+ key: 'total_requests',+ label: 'All Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ // {+ // key: 'total_realtime_options_requests',+ // label: 'total_realtime_options_requests',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API_REALTIME,+ // },++ {+ key: 'total_patch_requests',+ label: 'All PATCH Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ {+ key: 'total_post_requests',+ label: 'All POST Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },++ {+ key: 'total_ingress',+ label: 'All Ingress',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ // {+ // key: 'total_realtime_patch_requests',+ // label: 'total_realtime_patch_requests',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API_REALTIME,+ // },+ {+ key: 'total_delete_requests',+ label: 'All DELETE Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ {+ key: 'total_options_requests',+ label: 'All OPTIONS Requests',+ provider: 'daily-stats',+ category: METRIC_CATEGORIES.API,+ },+ // {+ // key: 'total_db_egress_bytes',+ // name: 'total_db_egress_bytes',+ // provider: 'daily-stats',+ // category: METRIC_CATEGORIES.API,+ // },+]++export const TIME_PERIODS_BILLING = [+ {+ key: 'currentBillingCycle',+ label: 'Current billing cycle',+ interval: '1d',+ },+ {+ key: 'previousBillingCycle',+ label: 'Previous billing cycle',+ interval: '1d',+ },+]++export const TIME_PERIODS_REPORTS = [+ {+ key: '7d',+ label: 'Last 7 days',+ interval: '1d',+ },+ {+ key: '30d',+ label: 'Last 30 days',+ interval: '1d',+ },+ // {+ // key: '60d',+ // label: 'Last 60 days',+ // interval: '1d',+ // },+ // {+ // key: '120d',+ // label: 'Last 120 days',+ // interval: '1d',+ // },+ {+ key: 'startMonth',+ label: 'This month',+ interval: '1d',+ },+]++export const TIME_PERIODS_INFRA = [+ {+ key: '1h',+ label: 'Last hour',+ interval: '1m',+ },+ {+ key: '3h',+ label: 'Last 3 hours',+ interval: '5m',+ },+ {+ key: '1d',+ label: 'Last 24 hours',+ interval: '30m',+ },+]diff --git a/studio/lib/vercelConfigs.js b/studio/lib/vercelConfigs.tssimilarity index 100%rename from studio/lib/vercelConfigs.jsrename to studio/lib/vercelConfigs.tsdiff --git a/studio/pages/account/me.tsx b/studio/pages/account/me.tsxindex 1e9772ada44..4415b5735b3 100644--- a/studio/pages/account/me.tsx+++ b/studio/pages/account/me.tsx@@ -6,7 +6,7 @@ import { IconMoon, IconSun, Select, Typography } from '@supabase/ui'import { useProfile, useStore, withAuth } from 'hooks'import { post } from 'lib/common/fetch'import { API_URL } from 'lib/constants'-import AccountLayout from 'components/layouts/AccountLayout'+import { AccountLayout } from 'components/layouts'import Panel from 'components/to-be-cleaned/Panel'import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'diff --git a/studio/pages/index.tsx b/studio/pages/index.tsxindex 8ca0da82a19..8c1965fe4aa 100644--- a/studio/pages/index.tsx+++ b/studio/pages/index.tsx@@ -9,7 +9,7 @@ import { Project } from 'types'import { useStore, withAuth } from 'hooks'import { post, delete_ } from 'lib/common/fetch'import { API_URL, IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'-import AccountLayout from 'components/layouts/AccountLayout'+import { AccountLayout } from 'components/layouts'import Landing from 'components/interfaces/Home/Landing'import ProjectList from 'components/interfaces/Home/ProjectList'import OrganizationDropdown from 'components/to-be-cleaned/Dropdown/OrganizationDropdown'diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsxindex 742c7f33ebd..dd5ecad24d6 100644--- a/studio/pages/new/[slug].tsx+++ b/studio/pages/new/[slug].tsx@@ -24,7 +24,7 @@ import {} from 'lib/constants'import { useStore, withAuth } from 'hooks'-import WizardLayout from 'components/layouts/WizardLayout'+import { WizardLayout } from 'components/layouts'import FormField from 'components/to-be-cleaned/forms/FormField'import Panel from 'components/to-be-cleaned/Panel'import InformationBox from 'components/ui/InformationBox'diff --git a/studio/pages/new/index.tsx b/studio/pages/new/index.tsxindex caf36307d65..ac8c09cb1c9 100644--- a/studio/pages/new/index.tsx+++ b/studio/pages/new/index.tsx@@ -7,7 +7,7 @@ import Router from 'next/router'import { API_URL } from 'lib/constants'import { useStore, withAuth } from 'hooks'import { post } from 'lib/common/fetch'-import WizardLayout from 'components/layouts/WizardLayout'+import { WizardLayout } from 'components/layouts'import FormField from 'components/to-be-cleaned/forms/FormField'import Panel from 'components/to-be-cleaned/Panel'diff --git a/studio/pages/org/[slug]/settings.tsx b/studio/pages/org/[slug]/settings.tsxindex 12cc8e989ee..a6938928e3b 100644--- a/studio/pages/org/[slug]/settings.tsx+++ b/studio/pages/org/[slug]/settings.tsx@@ -25,7 +25,7 @@ import {import { API_URL } from 'lib/constants'import { useOrganizationDetail, useStore, withAuth } from 'hooks'import { post, delete_ } from 'lib/common/fetch'-import AccountLayout from 'components/layouts/AccountLayout'+import { AccountLayout } from 'components/layouts'import { BillingSettings, InvoicesSettings } from 'components/interfaces/Organization'import Table from 'components/to-be-cleaned/Table'