Skip to content

Commit 794492b

Browse files
committed
feat: add suppressGetSessionWarning option to suppress server-side warnings
- Add suppressGetSessionWarning property to GoTrueClientSettings type - Initialize suppressGetSessionWarning in GoTrueClient constructor - Add test case to verify warning suppression works correctly - Mark as experimental feature in JSDoc comments
1 parent e658156 commit 794492b

File tree

3 files changed

+195
-116
lines changed

3 files changed

+195
-116
lines changed

src/GoTrueClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const DEFAULT_OPTIONS: Omit<
128128
flowType: 'implicit',
129129
debug: false,
130130
hasCustomAuthorizationHeader: false,
131+
suppressGetSessionWarning: false,
131132
}
132133

133134
async function lockNoOp<R>(name: string, acquireTimeout: number, fn: () => Promise<R>): Promise<R> {
@@ -234,6 +235,7 @@ export default class GoTrueClient {
234235
this.detectSessionInUrl = settings.detectSessionInUrl
235236
this.flowType = settings.flowType
236237
this.hasCustomAuthorizationHeader = settings.hasCustomAuthorizationHeader
238+
this.suppressGetSessionWarning = settings.suppressGetSessionWarning
237239

238240
if (settings.lock) {
239241
this.lock = settings.lock

src/lib/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ export type GoTrueClientOptions = {
9595
* @experimental
9696
*/
9797
hasCustomAuthorizationHeader?: boolean
98+
/**
99+
* Set to "true" if you want to suppress the warning when getting a session in server side environments.
100+
* @experimental
101+
*/
102+
suppressGetSessionWarning?: boolean
98103
}
99104

100105
export type WeakPasswordReasons = 'length' | 'characters' | 'pwned' | (string & {})

0 commit comments

Comments
 (0)