Files
supabase/apps/studio/components/interfaces/Auth/Users/Users.constants.ts
T
Joshen Lim fc7fb50aa2 Organize pg meta queries for studio (#43562)
## Context

We reached to a consensus that we'll keep manually written queries
within the `pg-meta` package

I'll shift queries over in several PRs but wanted to double check if the
changes here is a good folder structure

## Changes involved

- Am organizing dashboard queries in `pg-meta` based on product
  - So folder structure will be `/sql/studio/[product]/*.ts`
- Every constant will be exported directly from `pg-meta`'s index
- So consumption in dashboard will just be `import { xxx } from
'@supabase/pg-meta`

cc @avallete and @soedirgo on this one - lemme know if this is alright,
or if there's a preferred way to do this
2026-03-10 09:34:11 +07:00

53 lines
2.2 KiB
TypeScript

import { type OptimizedSearchColumns } from '@supabase/pg-meta'
import { BASE_PATH } from 'lib/constants'
import { PROVIDER_PHONE, PROVIDERS_SCHEMAS } from '../AuthProvidersFormValidation'
export type Filter = 'all' | 'verified' | 'unverified' | 'anonymous'
export type SpecificFilterColumn = OptimizedSearchColumns | 'name' | 'freeform'
export const UUIDV4_LEFT_PREFIX_REGEX =
/^(?:[0-9a-f]{1,8}|[0-9a-f]{8}-|[0-9a-f]{8}-[0-9a-f]{1,4}|[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{0,3}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{0,3}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{0,12})$/i
export const PHONE_NUMBER_LEFT_PREFIX_REGEX = /^[+]?[0-9]{0,15}$/
export const PANEL_PADDING = 'px-5 py-5'
// [Joshen] Temporary fix as bulk delete will fire n requests since Auth + API do not have a bulk delete endpoint yet
export const MAX_BULK_DELETE = 20
export const PROVIDER_FILTER_OPTIONS = PROVIDERS_SCHEMAS.map((provider) => ({
name: provider.title,
value: 'key' in provider ? provider.key : provider.title.toLowerCase(),
icon: `${BASE_PATH}/img/icons/${provider.misc.iconKey}.svg`,
iconClass: provider.title === 'GitHub' ? 'dark:invert' : '',
})).concat(
PROVIDER_PHONE.properties.SMS_PROVIDER.enum.map((x) => ({
name: x.label,
value: x.value,
icon: `${BASE_PATH}/img/icons/${x.icon}`,
iconClass: '',
}))
)
export type UsersTableColumn = {
id: string
name: string
minWidth?: number
width?: number
resizable?: boolean
}
export type ColumnConfiguration = { id: string; width?: number }
export const USERS_TABLE_COLUMNS: UsersTableColumn[] = [
{ id: 'img', name: '', minWidth: 95, width: 95, resizable: false },
{ id: 'id', name: 'UID', width: 280 },
{ id: 'name', name: 'Display name', minWidth: 0, width: 150 },
{ id: 'email', name: 'Email', width: 300 },
{ id: 'phone', name: 'Phone' },
{ id: 'providers', name: 'Providers', minWidth: 150 },
{ id: 'provider_type', name: 'Provider type', minWidth: 150 },
{ id: 'created_at', name: 'Created at', width: 260 },
{ id: 'last_sign_in_at', name: 'Last sign in at', width: 260 },
]