Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Implement naming convention for createClient functions #547

Merged
merged 2 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createSupabaseClient
} from '@supabase/auth-helpers-shared';

export function createBrowserSupabaseClient<
export function createClientComponentClient<
Database = any,
SchemaName extends string & keyof Database = 'public' extends keyof Database
? 'public'
Expand Down
13 changes: 7 additions & 6 deletions packages/nextjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export type WritableRequestCookies = ReadonlyRequestCookies & {
set: (name: string, value: string, options?: CookieOptions) => void;
};

export { createBrowserSupabaseClient } from './browserClient';
export { createServerSupabaseClient } from './serverClient';
export { createMiddlewareSupabaseClient } from './middlewareClient';
export { createServerComponentSupabaseClient } from './serverComponentClient';
export { createRouteHandlerSupabaseClient } from './routeHandlerClient';
export { createServerActionSupabaseClient } from './serverActionClient';
export { createPagesBrowserClient } from './pagesBrowserClient';
export { createPagesServerClient } from './pagesServerClient';
export { createMiddlewareClient } from './middlewareClient';
export { createClientComponentClient } from './clientComponentClient';
export { createServerComponentClient } from './serverComponentClient';
export { createRouteHandlerClient } from './routeHandlerClient';
export { createServerActionClient } from './serverActionClient';
2 changes: 1 addition & 1 deletion packages/nextjs/src/middlewareClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class NextMiddlewareAuthStorageAdapter extends CookieAuthStorageAdapter {
}
}

export function createMiddlewareSupabaseClient<
export function createMiddlewareClient<
Database = any,
SchemaName extends string & keyof Database = 'public' extends keyof Database
? 'public'
Expand Down
3 changes: 3 additions & 0 deletions packages/nextjs/src/pagesBrowserClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createClientComponentClient } from './clientComponentClient';

export const createPagesBrowserClient = createClientComponentClient;
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class NextServerAuthStorageAdapter extends CookieAuthStorageAdapter {
}
}

export function createServerSupabaseClient<
export function createPagesServerClient<
Database = any,
SchemaName extends string & keyof Database = 'public' extends keyof Database
? 'public'
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/src/routeHandlerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class NextRouteHandlerAuthStorageAdapter extends CookieAuthStorageAdapter {
}
}

export function createRouteHandlerSupabaseClient<
export function createRouteHandlerClient<
Database = any,
SchemaName extends string & keyof Database = 'public' extends keyof Database
? 'public'
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/src/serverActionClient.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { createRouteHandlerSupabaseClient } from './routeHandlerClient';
import { createRouteHandlerClient } from './routeHandlerClient';

export const createServerActionSupabaseClient = createRouteHandlerSupabaseClient;
export const createServerActionClient = createRouteHandlerClient;
4 changes: 1 addition & 3 deletions packages/nextjs/src/serverComponentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ class NextServerComponentAuthStorageAdapter extends CookieAuthStorageAdapter {
}
}

export const createRouteHandlerSupabaseClient = createServerComponentSupabaseClient;
silentworks marked this conversation as resolved.
Show resolved Hide resolved

export function createServerComponentSupabaseClient<
export function createServerComponentClient<
Database = any,
SchemaName extends string & keyof Database = 'public' extends keyof Database
? 'public'
Expand Down