Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/core/postgrest-js/src/PostgrestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export default class PostgrestClient<
* @param relation - The table or view name to query
*/
from(relation: string): PostgrestQueryBuilder<ClientOptions, Schema, any, any> {
if (!relation || typeof relation !== 'string' || relation.trim() === '') {
throw new Error('Invalid relation name: relation must be a non-empty string.')
}

const url = new URL(`${this.url}/${relation}`)
return new PostgrestQueryBuilder(url, {
headers: new Headers(this.headers),
Expand Down
Loading