(url: string)
| 1 | export function isValidDatabaseUrl(url: string) { |
| 2 | try { |
| 3 | const databaseUrl = new URL(url); |
| 4 | const schemaFromSearchParam = databaseUrl.searchParams.get("schema"); |
| 5 | |
| 6 | if (schemaFromSearchParam === "") { |
| 7 | console.error( |
| 8 | "Invalid Database URL: The schema search param can't have an empty value. To use the `public` schema, either omit the schema param entirely or specify it in full: `?schema=public`" |
| 9 | ); |
| 10 | return false; |
| 11 | } |
| 12 | |
| 13 | return true; |
| 14 | } catch (err) { |
| 15 | console.error(err); |
| 16 | return false; |
| 17 | } |
| 18 | } |
no test coverage detected
searching dependent graphs…