feat(release): prepare 1.1.0 candidate
This commit is contained in:
parent
5a34f66981
commit
5205dcdfa9
736 changed files with 115667 additions and 12203 deletions
|
|
@ -20,25 +20,37 @@ export interface CreateClientOptions {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Supabase 클라이언트 생성.
|
||||
* url 또는 anonKey가 비어있으면 "dummy" 클라이언트를 반환 — 모든 쿼리는 빈 결과.
|
||||
* 이렇게 해야 env가 세팅되지 않은 상태에서도 빌드/SSR이 실패하지 않는다.
|
||||
*/
|
||||
export function createD3roSupabaseClient(options: CreateClientOptions): D3roSupabaseClient {
|
||||
const { url, anonKey, auth } = options
|
||||
export class SupabaseConfigurationError extends Error {
|
||||
readonly code = 'SUPABASE_CONFIGURATION_MISSING'
|
||||
|
||||
constructor() {
|
||||
super('Supabase public URL and anonymous key are required.')
|
||||
this.name = 'SupabaseConfigurationError'
|
||||
}
|
||||
}
|
||||
|
||||
export function requireSupabasePublicConfig(options: CreateClientOptions): {
|
||||
url: string
|
||||
anonKey: string
|
||||
} {
|
||||
const url = options.url?.trim()
|
||||
const anonKey = options.anonKey?.trim()
|
||||
|
||||
if (!url || !anonKey) {
|
||||
// Env가 없으면 fallback URL로 생성. 실제 호출은 런타임에 실패하지만
|
||||
// 빌드/타입체크는 통과. 앱 상단에서 isClientConfigured()로 체크해야 함.
|
||||
return createClient<Database>('https://placeholder.supabase.co', 'placeholder-anon-key', {
|
||||
auth: {
|
||||
persistSession: false,
|
||||
autoRefreshToken: false
|
||||
}
|
||||
})
|
||||
throw new SupabaseConfigurationError()
|
||||
}
|
||||
|
||||
return { url, anonKey }
|
||||
}
|
||||
|
||||
/**
|
||||
* Supabase 클라이언트 생성.
|
||||
* 필수 공개 설정이 없으면 가짜 백엔드로 진행하지 않고 즉시 실패한다.
|
||||
*/
|
||||
export function createD3roSupabaseClient(options: CreateClientOptions): D3roSupabaseClient {
|
||||
const { auth } = options
|
||||
const { url, anonKey } = requireSupabasePublicConfig(options)
|
||||
|
||||
return createClient<Database>(url, anonKey, {
|
||||
auth: {
|
||||
persistSession: auth?.persistSession ?? true,
|
||||
|
|
@ -52,5 +64,5 @@ export function createD3roSupabaseClient(options: CreateClientOptions): D3roSupa
|
|||
* Env가 실제로 세팅되었는지 확인. UI에서 "Supabase 미설정" 경고 표시용.
|
||||
*/
|
||||
export function isClientConfigured(options: CreateClientOptions): boolean {
|
||||
return Boolean(options.url && options.anonKey)
|
||||
return Boolean(options.url?.trim() && options.anonKey?.trim())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue