mirror of
https://github.com/supabase/supabase.git
synced 2026-10-19 08:09:11 +03:00
Merge branch 'master' of github.com:supabase/supabase into feat/abac-scaffold-ui
This commit is contained in:
commit
f47cc57744
4 files changed
+35
-20
No files matched your search
@@ -189,29 +189,34 @@ export function parseSupaTable(data: {
|
||||
relationships: Dictionary<any>[]
|
||||
}): SupaTable {
|
||||
const { table, columns, primaryKeys, relationships } = data
|
||||
const supaColumns: SupaColumn[] = columns.map((x) => {
|
||||
|
||||
const supaColumns: SupaColumn[] = columns.map((column) => {
|
||||
const temp = {
|
||||
position: x.ordinal_position,
|
||||
name: x.name,
|
||||
defaultValue: x.default_value,
|
||||
dataType: x.data_type,
|
||||
format: x.format,
|
||||
position: column.ordinal_position,
|
||||
name: column.name,
|
||||
defaultValue: column.default_value,
|
||||
dataType: column.data_type,
|
||||
format: column.format,
|
||||
isPrimaryKey: false,
|
||||
isIdentity: x.is_identity,
|
||||
isGeneratable: x.identity_generation == 'BY DEFAULT',
|
||||
isNullable: x.is_nullable,
|
||||
isUpdatable: x.is_updatable,
|
||||
enum: x.enums,
|
||||
comment: x.comment,
|
||||
isIdentity: column.is_identity,
|
||||
isGeneratable: column.identity_generation == 'BY DEFAULT',
|
||||
isNullable: column.is_nullable,
|
||||
isUpdatable: column.is_updatable,
|
||||
enum: column.enums,
|
||||
comment: column.comment,
|
||||
targetTableSchema: null,
|
||||
targetTableName: null,
|
||||
targetColumnName: null,
|
||||
}
|
||||
const primaryKey = primaryKeys.find((pk) => pk.name == x.name)
|
||||
const primaryKey = primaryKeys.find((pk) => pk.name == column.name)
|
||||
temp.isPrimaryKey = !!primaryKey
|
||||
|
||||
const relationship = relationships.find((r) => {
|
||||
return r.source_column_name == x.name
|
||||
const relationship = relationships.find((relation) => {
|
||||
return (
|
||||
relation.source_schema === column.schema &&
|
||||
relation.source_table_name === column.table &&
|
||||
relation.source_column_name === column.name
|
||||
)
|
||||
})
|
||||
if (relationship) {
|
||||
temp.targetTableSchema = relationship.target_table_schema
|
||||
|
||||
@@ -11,7 +11,8 @@ const baseDomainRegex =
|
||||
/^((ftp|http|https):\/\/)?(www.)?(?!.*(ftp|http|https|www.))[a-zA-Z0-9_*-]+(\.[a-zA-Z0-9_*-]+)+((\/)[\w#]+)*(\/\w+\?[a-zA-Z0-9_]+=\w+(&[a-zA-Z0-9_]+=\w+)*)+(?:\.[a-z]+)*(?::\d+)?(?![^<]*(?:<\/\w+>|\/?>))(.*)?\/?(.)*?$/gm
|
||||
|
||||
// iOS deep linking scheme https://benoitpasquier.com/deep-linking-url-scheme-ios/
|
||||
const appRegex = /^[a-z0-9]+([.][a-z0-9]+)*:\/(\/[-a-z0-9._~!$&'()*+,;=:@%]+)+$/i
|
||||
const appRegex =
|
||||
/^[a-z0-9]+([.][a-z0-9]+)*:\/(\/[-a-z0-9._~!$&'()*+,;=:@%]+)+(?:\.[a-z]+)*(?::\d+)?(?![^<]*(?:<\/\w+>|\/?>))(.*)?\/?(.)*?$/i
|
||||
|
||||
// Regex from https://stackoverflow.com/a/18696953/4807782
|
||||
const localhostRegex = /^(?:^|\s)((https?:\/\/)?(?:localhost|[\w-]+(?:\.[\w-]+)+)(:\d+)?(\/\S*)?)/i
|
||||
|
||||
@@ -5,10 +5,10 @@ export const REGIONS = {
|
||||
WEST_US: 'West US (North California)',
|
||||
EAST_US: 'East US (North Virginia)',
|
||||
CENTRAL_CANADA: 'Canada (Central)',
|
||||
WEST_EU: 'West Europe (Ireland)',
|
||||
WEST_EU_2: 'West Europe (London)',
|
||||
// 'North EU': 'North Europe',
|
||||
CENTRAL_EU: 'Central Europe (Frankfurt)',
|
||||
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)',
|
||||
|
||||
@@ -18,6 +18,15 @@ describe('Auth.constants: domainRegex', () => {
|
||||
const output4 = domainRegex.test(mockInput4)
|
||||
expect(output4).toBe(true)
|
||||
})
|
||||
test('should validate app-based domains', () => {
|
||||
const mockInput1 = 'exp://exp.host/some-app'
|
||||
const output1 = domainRegex.test(mockInput1)
|
||||
expect(output1).toBe(true)
|
||||
|
||||
const mockInput2 = 'exp://exp.host/some-app?release-channel=default'
|
||||
const output2 = domainRegex.test(mockInput2)
|
||||
expect(output2).toBe(true)
|
||||
})
|
||||
test('should validate subdomains', () => {
|
||||
const mockInput1 = 'https://app.supabase.com'
|
||||
const output1 = domainRegex.test(mockInput1)
|
||||
|
||||
Reference in new issue
Block a user